From 94ac0eb8a05aa5003a0c1ff186924e439c6c33c0 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 6 Nov 2024 12:45:43 -0800 Subject: [PATCH 01/62] remove superfluous attribute mutations & export only `MapFullscreen` --- public/script/leaflet-fullscreen.js | 108 ++++++++++++---------------- 1 file changed, 45 insertions(+), 63 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 0b7df83..c7cec97 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -1,57 +1,13 @@ // noinspection JSIgnoredPromiseFromCall, JSUnresolvedReference, JSUnusedGlobalSymbols import { + bind, Control, DomEvent, DomUtil, Map, - bind, - control, - map as leafletMap, } from '../leaflet/leaflet-src.esm.js' -Control.Fullscreen = Control.extend({ - _click(e) { - DomEvent.stopPropagation(e) - DomEvent.preventDefault(e) - this._map.toggleFullscreen(this.options) - }, - - _toggleTitle() { - this.link.title = this.options.title[this._map.isFullscreen()] - }, - - onAdd(map) { - const container = DomUtil.create( - 'div', - 'leaflet-control-fullscreen leaflet-bar leaflet-control', - ) - - this.link = DomUtil.create( - 'a', - 'leaflet-control-fullscreen-button leaflet-bar-part', - container, - ) - this.link.href = '#' - - this._map = map - this._map.on('fullscreenchange', this._toggleTitle, this) - this._toggleTitle() - - DomEvent.on(this.link, 'click', this._click, this) - - return container - }, - - options: { - position: 'topleft', - title: { - false: 'View Fullscreen', - true: 'Exit Fullscreen', - }, - }, -}) - Map.include({ _disablePseudoFullscreen(container) { DomUtil.removeClass(container, 'leaflet-pseudo-fullscreen') @@ -135,9 +91,51 @@ Map.mergeOptions({ fullscreenControl: false, }) +const ControlFullscreen = Control.extend({ + _click(e) { + DomEvent.stopPropagation(e) + DomEvent.preventDefault(e) + this._map.toggleFullscreen(this.options) + }, + + _toggleTitle() { + this.link.title = this.options.title[this._map.isFullscreen()] + }, + + onAdd(map) { + const container = DomUtil.create( + 'div', + 'leaflet-control-fullscreen leaflet-bar leaflet-control', + ) + + this.link = DomUtil.create( + 'a', + 'leaflet-control-fullscreen-button leaflet-bar-part', + container, + ) + this.link.href = '#' + + this._map = map + this._map.on('fullscreenchange', this._toggleTitle, this) + this._toggleTitle() + + DomEvent.on(this.link, 'click', this._click, this) + + return container + }, + + options: { + position: 'topleft', + title: { + false: 'View Fullscreen', + true: 'Exit Fullscreen', + }, + }, +}) + Map.addInitHook(function addInitHookHandler() { if (this.options.fullscreenControl) { - this.fullscreenControl = new Control.Fullscreen( + this.fullscreenControl = new ControlFullscreen( this.options.fullscreenControl, ) this.addControl(this.fullscreenControl) @@ -168,20 +166,4 @@ Map.addInitHook(function addInitHookHandler() { } }) -control.fullscreen = function fullscreenHandler(options) { - return new Control.Fullscreen(options) -} - -function map(id, options) { - return new Map(id, options) -} - -function createFullscreenMap({ center, id, onClick = () => {}, zoom }) { - return leafletMap(id, { - center, - fullscreenControl: true, - zoom, - }).on('click', onClick) -} - -export { Control, Map, control, createFullscreenMap, map } +export { Map as MapFullscreen } From a34731859871596886f5c294c0d35081eba723b3 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 6 Nov 2024 12:46:37 -0800 Subject: [PATCH 02/62] `MapFullscreen` integration in fullscreen accessibility tutorial --- public/tutorial/accessibility/script/fullscreen.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/public/tutorial/accessibility/script/fullscreen.js b/public/tutorial/accessibility/script/fullscreen.js index 9518ea1..8b357d6 100644 --- a/public/tutorial/accessibility/script/fullscreen.js +++ b/public/tutorial/accessibility/script/fullscreen.js @@ -1,10 +1,17 @@ -import { createFullscreenMap } from '../../../script/leaflet-fullscreen.js' +import { attributionOsm, urlTemplateOsm } from '../../../script/base-layers.js' import { marker } from '../../../leaflet-adapter/marker.js' import { tileLayer } from '../../../leaflet-adapter/tile-layer/tile-layer.js' -import { attributionOsm, urlTemplateOsm } from '../../../script/base-layers.js' +import { MapFullscreen } from '../../../script/leaflet-fullscreen.js' + +function mapFullscreen({ id, ...props }) { + return new MapFullscreen(id, { + fullscreenControl: true, + ...props, + }) +} const altText = 'Kyiv', - map = createFullscreenMap({ + map = mapFullscreen({ center: [50.4501, 30.5234], id: 'map', zoom: 4, From bb82f47845d19e6631aae84c79e254dfd1b38b57 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Mon, 11 Nov 2024 17:34:10 -0800 Subject: [PATCH 03/62] `fullscreenMap` function replaces `MapFullscreen` class --- public/script/leaflet-fullscreen.js | 249 +++++++++++++--------------- 1 file changed, 111 insertions(+), 138 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index c7cec97..930326f 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -1,169 +1,142 @@ -// noinspection JSIgnoredPromiseFromCall, JSUnresolvedReference, JSUnusedGlobalSymbols - import { - bind, - Control, + control, DomEvent, DomUtil, - Map, + map as leafletMap, } from '../leaflet/leaflet-src.esm.js' -Map.include({ - _disablePseudoFullscreen(container) { - DomUtil.removeClass(container, 'leaflet-pseudo-fullscreen') - this._setFullscreen(false) - this.fire('fullscreenchange') - }, - - _enablePseudoFullscreen(container) { - DomUtil.addClass(container, 'leaflet-pseudo-fullscreen') - this._setFullscreen(true) - this.fire('fullscreenchange') - }, - - _onFullscreenChange() { - const fullscreenElement = - document.fullscreenElement || - document.mozFullScreenElement || - document.webkitFullscreenElement || - document.msFullscreenElement - - if (fullscreenElement === this.getContainer() && !this._isFullscreen) { - this._setFullscreen(true) - this.fire('fullscreenchange') - } else if ( - fullscreenElement !== this.getContainer() && - this._isFullscreen - ) { - this._setFullscreen(false) - this.fire('fullscreenchange') - } - }, - - _setFullscreen(fullscreen) { - this._isFullscreen = fullscreen - const container = this.getContainer() - if (fullscreen) { - DomUtil.addClass(container, 'leaflet-fullscreen-on') - } else { - DomUtil.removeClass(container, 'leaflet-fullscreen-on') - } - this.invalidateSize() - }, - - isFullscreen() { - return this._isFullscreen || false - }, - - toggleFullscreen(options) { - const container = this.getContainer() - if (this.isFullscreen()) { - if (options && options.pseudoFullscreen) { - this._disablePseudoFullscreen(container) - } else if (document.exitFullscreen) { - document.exitFullscreen() - } else if (document.mozCancelFullScreen) { - document.mozCancelFullScreen() - } else if (document.webkitCancelFullScreen) { - document.webkitCancelFullScreen() - } else if (document.msExitFullscreen) { - document.msExitFullscreen() - } else { - this._disablePseudoFullscreen(container) - } - } else if (options && options.pseudoFullscreen) { - this._enablePseudoFullscreen(container) - } else if (container.requestFullscreen) { - container.requestFullscreen() - } else if (container.mozRequestFullScreen) { - container.mozRequestFullScreen() - } else if (container.webkitRequestFullscreen) { - container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT) - } else if (container.msRequestFullscreen) { - container.msRequestFullscreen() - } else { - this._enablePseudoFullscreen(container) - } - }, -}) - -Map.mergeOptions({ - fullscreenControl: false, -}) - -const ControlFullscreen = Control.extend({ - _click(e) { - DomEvent.stopPropagation(e) - DomEvent.preventDefault(e) - this._map.toggleFullscreen(this.options) - }, - - _toggleTitle() { - this.link.title = this.options.title[this._map.isFullscreen()] - }, +function getFullscreenChangeEventName() { + if ('onfullscreenchange' in document) return 'fullscreenchange' + else if ('onmozfullscreenchange' in document) return 'mozfullscreenchange' + else if ('onwebkitfullscreenchange' in document) + return 'webkitfullscreenchange' + else if ('onmsfullscreenchange' in document) return 'MSFullscreenChange' + return null +} + +function createFullscreenControl(options = {}) { + const mergedOptions = { + position: 'topleft', + title: { + false: 'View Fullscreen', + true: 'Exit Fullscreen', + }, + ...options, + } + const fullscreenControl = control({ position: mergedOptions.position }) - onAdd(map) { + fullscreenControl.onAdd = function onAdd(map) { const container = DomUtil.create( 'div', 'leaflet-control-fullscreen leaflet-bar leaflet-control', ) - this.link = DomUtil.create( + const link = DomUtil.create( 'a', 'leaflet-control-fullscreen-button leaflet-bar-part', container, ) - this.link.href = '#' - this._map = map - this._map.on('fullscreenchange', this._toggleTitle, this) - this._toggleTitle() + link.href = '#' + link.title = mergedOptions.title[isFullscreen(map)] - DomEvent.on(this.link, 'click', this._click, this) + DomEvent.on(link, 'click', function onClick(e) { + DomEvent.stopPropagation(e) + DomEvent.preventDefault(e) + toggleFullscreen(map, mergedOptions) + }) return container - }, - - options: { - position: 'topleft', - title: { - false: 'View Fullscreen', - true: 'Exit Fullscreen', - }, - }, -}) + } -Map.addInitHook(function addInitHookHandler() { - if (this.options.fullscreenControl) { - this.fullscreenControl = new ControlFullscreen( - this.options.fullscreenControl, - ) - this.addControl(this.fullscreenControl) + return fullscreenControl +} + +function isFullscreen(map) { + return map._isFullscreen || false +} + +/** + * @param {*} map + * @param {boolean} isFullscreen + */ +function setFullscreen(map, isFullscreen) { + map._isFullscreen = isFullscreen + const container = map.getContainer() + if (isFullscreen) DomUtil.addClass(container, 'leaflet-fullscreen-on') + else DomUtil.removeClass(container, 'leaflet-fullscreen-on') + map.invalidateSize() +} + +function enablePseudoFullscreen(map) { + const container = map.getContainer() + DomUtil.addClass(container, 'leaflet-pseudo-fullscreen') + setFullscreen(map, true) + map.fire('fullscreenchange') +} + +function disablePseudoFullscreen(map) { + const container = map.getContainer() + DomUtil.removeClass(container, 'leaflet-pseudo-fullscreen') + setFullscreen(map, false) + map.fire('fullscreenchange') +} + +function toggleFullscreen(map, options = {}) { + const container = map.getContainer() + + if (isFullscreen(map)) { + if (options.pseudoFullscreen) disablePseudoFullscreen(map) + else if (document.exitFullscreen) document.exitFullscreen() + else disablePseudoFullscreen(map) + } else if (options.pseudoFullscreen) enablePseudoFullscreen(map) + else if (container.requestFullscreen) container.requestFullscreen() + else enablePseudoFullscreen(map) +} + +function onFullscreenChange(map) { + const fullscreenElement = + document.fullscreenElement || + document.mozFullScreenElement || + document.webkitFullscreenElement || + document.msFullscreenElement + + if (fullscreenElement === map.getContainer()) { + if (!map._isFullscreen) { + setFullscreen(map, true) + map.fire('fullscreenchange') + } + } else if (map._isFullscreen) { + setFullscreen(map, false) + map.fire('fullscreenchange') } +} - let fullscreenchange +export function fullscreenMap(id, options = {}) { + const map = leafletMap(id, options) - if ('onfullscreenchange' in document) { - fullscreenchange = 'fullscreenchange' - } else if ('onmozfullscreenchange' in document) { - fullscreenchange = 'mozfullscreenchange' - } else if ('onwebkitfullscreenchange' in document) { - fullscreenchange = 'webkitfullscreenchange' - } else if ('onmsfullscreenchange' in document) { - fullscreenchange = 'MSFullscreenChange' + map._isFullscreen = false + + if (options.fullscreenControl) { + const fullscreenControl = createFullscreenControl(options.fullscreenControl) + fullscreenControl.addTo(map) } - if (fullscreenchange) { - const onFullscreenChange = bind(this._onFullscreenChange, this) + const fullscreenChangeEvent = getFullscreenChangeEventName() + + function handleFullscreenChange() { + return onFullscreenChange(map) + } - this.whenReady(function whenReadyHandler() { - DomEvent.on(document, fullscreenchange, onFullscreenChange) + if (fullscreenChangeEvent) { + map.whenReady(function readyHandler() { + DomEvent.on(document, fullscreenChangeEvent, handleFullscreenChange) }) - this.on('unload', function onUnloadHandler() { - DomEvent.off(document, fullscreenchange, onFullscreenChange) + map.on('unload', function unloadHandler() { + DomEvent.off(document, fullscreenChangeEvent, handleFullscreenChange) }) } -}) -export { Map as MapFullscreen } + return map +} From bb22034a8e14bcc083ff4f71f49355c212b85dfe Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Mon, 11 Nov 2024 17:34:41 -0800 Subject: [PATCH 04/62] `fullscreenMap` integration in fullscreen accessibility tutorial --- public/tutorial/accessibility/script/fullscreen.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/tutorial/accessibility/script/fullscreen.js b/public/tutorial/accessibility/script/fullscreen.js index 8b357d6..2ea9c44 100644 --- a/public/tutorial/accessibility/script/fullscreen.js +++ b/public/tutorial/accessibility/script/fullscreen.js @@ -1,10 +1,10 @@ import { attributionOsm, urlTemplateOsm } from '../../../script/base-layers.js' import { marker } from '../../../leaflet-adapter/marker.js' import { tileLayer } from '../../../leaflet-adapter/tile-layer/tile-layer.js' -import { MapFullscreen } from '../../../script/leaflet-fullscreen.js' +import { fullscreenMap } from '../../../script/leaflet-fullscreen.js' function mapFullscreen({ id, ...props }) { - return new MapFullscreen(id, { + return fullscreenMap(id, { fullscreenControl: true, ...props, }) From d052f209cf073380d8b1c9e077f117be8ecb9305 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Mon, 11 Nov 2024 17:37:29 -0800 Subject: [PATCH 05/62] remove JSDoc `setFullscreen` parameters --- public/script/leaflet-fullscreen.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 930326f..7ac1b42 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -56,10 +56,6 @@ function isFullscreen(map) { return map._isFullscreen || false } -/** - * @param {*} map - * @param {boolean} isFullscreen - */ function setFullscreen(map, isFullscreen) { map._isFullscreen = isFullscreen const container = map.getContainer() From d5f56ee74a67df3a455f9da042afecce8b17a43e Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 14:40:39 -0800 Subject: [PATCH 06/62] `useBoolean` implementation --- public/script/leaflet-fullscreen.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 7ac1b42..7809679 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -5,6 +5,18 @@ import { map as leafletMap, } from '../leaflet/leaflet-src.esm.js' +function useBoolean(initialValue = false) { + let state = initialValue + return { + get() { + return state + }, + set(newState) { + state = newState + }, + } +} + function getFullscreenChangeEventName() { if ('onfullscreenchange' in document) return 'fullscreenchange' else if ('onmozfullscreenchange' in document) return 'mozfullscreenchange' From f0c49fa7283980c0202138072f5cb9c90df2b379 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 14:47:02 -0800 Subject: [PATCH 07/62] `useBoolean` integration replaces `map._isFullscreen` mutations --- public/script/leaflet-fullscreen.js | 85 ++++++++++++++--------------- 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 7809679..94398af 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -26,7 +26,7 @@ function getFullscreenChangeEventName() { return null } -function createFullscreenControl(options = {}) { +function createFullscreenControl(options = {}, getFullscreen, setFullscreen) { const mergedOptions = { position: 'topleft', title: { @@ -35,6 +35,7 @@ function createFullscreenControl(options = {}) { }, ...options, } + const fullscreenControl = control({ position: mergedOptions.position }) fullscreenControl.onAdd = function onAdd(map) { @@ -50,12 +51,12 @@ function createFullscreenControl(options = {}) { ) link.href = '#' - link.title = mergedOptions.title[isFullscreen(map)] + link.title = mergedOptions.title[getFullscreen()] DomEvent.on(link, 'click', function onClick(e) { DomEvent.stopPropagation(e) DomEvent.preventDefault(e) - toggleFullscreen(map, mergedOptions) + toggleFullscreen(map, mergedOptions, getFullscreen, setFullscreen) }) return container @@ -64,76 +65,74 @@ function createFullscreenControl(options = {}) { return fullscreenControl } -function isFullscreen(map) { - return map._isFullscreen || false -} +function setFullscreenState(map, newState, getFullscreen, setFullscreen) { + setFullscreen(newState) -function setFullscreen(map, isFullscreen) { - map._isFullscreen = isFullscreen const container = map.getContainer() - if (isFullscreen) DomUtil.addClass(container, 'leaflet-fullscreen-on') + if (getFullscreen()) DomUtil.addClass(container, 'leaflet-fullscreen-on') else DomUtil.removeClass(container, 'leaflet-fullscreen-on') + map.invalidateSize() } -function enablePseudoFullscreen(map) { +function enablePseudoFullscreen(map, getFullscreen, setFullscreen) { const container = map.getContainer() DomUtil.addClass(container, 'leaflet-pseudo-fullscreen') - setFullscreen(map, true) + setFullscreenState(map, true, getFullscreen, setFullscreen) map.fire('fullscreenchange') } -function disablePseudoFullscreen(map) { +function disablePseudoFullscreen(map, getFullscreen, setFullscreen) { const container = map.getContainer() DomUtil.removeClass(container, 'leaflet-pseudo-fullscreen') - setFullscreen(map, false) + setFullscreenState(map, false, getFullscreen, setFullscreen) map.fire('fullscreenchange') } -function toggleFullscreen(map, options = {}) { +function toggleFullscreen(map, options = {}, getFullscreen, setFullscreen) { const container = map.getContainer() - if (isFullscreen(map)) { - if (options.pseudoFullscreen) disablePseudoFullscreen(map) + if (getFullscreen()) { + if (options.pseudoFullscreen) + disablePseudoFullscreen(map, getFullscreen, setFullscreen) else if (document.exitFullscreen) document.exitFullscreen() - else disablePseudoFullscreen(map) - } else if (options.pseudoFullscreen) enablePseudoFullscreen(map) + else disablePseudoFullscreen(map, getFullscreen, setFullscreen) + } else if (options.pseudoFullscreen) + enablePseudoFullscreen(map, getFullscreen, setFullscreen) else if (container.requestFullscreen) container.requestFullscreen() - else enablePseudoFullscreen(map) -} - -function onFullscreenChange(map) { - const fullscreenElement = - document.fullscreenElement || - document.mozFullScreenElement || - document.webkitFullscreenElement || - document.msFullscreenElement - - if (fullscreenElement === map.getContainer()) { - if (!map._isFullscreen) { - setFullscreen(map, true) - map.fire('fullscreenchange') - } - } else if (map._isFullscreen) { - setFullscreen(map, false) - map.fire('fullscreenchange') - } + else enablePseudoFullscreen(map, getFullscreen, setFullscreen) } export function fullscreenMap(id, options = {}) { const map = leafletMap(id, options) - map._isFullscreen = false + const { get: getFullscreen, set: setFullscreen } = useBoolean() - if (options.fullscreenControl) { - const fullscreenControl = createFullscreenControl(options.fullscreenControl) - fullscreenControl.addTo(map) - } + if (options.fullscreenControl) + createFullscreenControl( + options.fullscreenControl, + getFullscreen, + setFullscreen, + ).addTo(map) const fullscreenChangeEvent = getFullscreenChangeEventName() function handleFullscreenChange() { - return onFullscreenChange(map) + if ( + map.getContainer() === + (document.fullscreenElement || + document.mozFullScreenElement || + document.webkitFullscreenElement || + document.msFullscreenElement) + ) { + if (!getFullscreen()) { + setFullscreenState(map, true, getFullscreen, setFullscreen) + map.fire('fullscreenchange') + } + } else if (getFullscreen()) { + setFullscreenState(map, false, getFullscreen, setFullscreen) + map.fire('fullscreenchange') + } } if (fullscreenChangeEvent) { From 62f001451acfa6f89b3d98c4947524702090b8d7 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 18:01:53 -0800 Subject: [PATCH 08/62] `onLinkClick` increases semantic specificity, replacing `onClick` --- public/script/leaflet-fullscreen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 94398af..fd0be86 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -53,7 +53,7 @@ function createFullscreenControl(options = {}, getFullscreen, setFullscreen) { link.href = '#' link.title = mergedOptions.title[getFullscreen()] - DomEvent.on(link, 'click', function onClick(e) { + DomEvent.on(link, 'click', function onLinkClick(e) { DomEvent.stopPropagation(e) DomEvent.preventDefault(e) toggleFullscreen(map, mergedOptions, getFullscreen, setFullscreen) From 36ea0e69c9eb3ccf8d3604274357cf2b52c062ec Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 18:03:05 -0800 Subject: [PATCH 09/62] `Object.assign` preferred over attribute assignment operator --- public/script/leaflet-fullscreen.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index fd0be86..77fb0ee 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -50,8 +50,7 @@ function createFullscreenControl(options = {}, getFullscreen, setFullscreen) { container, ) - link.href = '#' - link.title = mergedOptions.title[getFullscreen()] + Object.assign(link, { href: '#' }) DomEvent.on(link, 'click', function onLinkClick(e) { DomEvent.stopPropagation(e) From 92e9e578f7d4632d894420061477002e9a17f850 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 18:04:09 -0800 Subject: [PATCH 10/62] `updateTitle` restores dynamic title update functionality of original fullscreen control extension --- public/script/leaflet-fullscreen.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 77fb0ee..86e1762 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -58,6 +58,13 @@ function createFullscreenControl(options = {}, getFullscreen, setFullscreen) { toggleFullscreen(map, mergedOptions, getFullscreen, setFullscreen) }) + function updateTitle() { + Object.assign(link, { title: mergedOptions.title[getFullscreen()] }) + } + + updateTitle() + map.on('fullscreenchange', updateTitle) + return container } From 85751a42907cb0c204599e4dd5c7659dca510056 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 18:09:22 -0800 Subject: [PATCH 11/62] consistent 24-hour time format `HH:MM` --- SECURITY.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index 3810178..bd8c586 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -45,7 +45,7 @@ The following potential vulnerabilities were **resolved** after detection. - **Detected by:** Dependabot - **Vulnerable package:** [rollup](https://www.npmjs.com/package/rollup) - **Detection time:** 2024-09-24 19:48 -- **Resolution time:** 2024-09-25 4:41 +- **Resolution time:** 2024-09-25 04:41 - **Resolution version (`@stassi/leaf`):** [v0.0.30](https://github.com/Stassi/leaf/releases/tag/v0.0.30) - **CVSS (severity):** 8.3 (high) - **Advisory:** [GHSA-gcx4-mw62-g8wm](https://github.com/advisories/GHSA-gcx4-mw62-g8wm) @@ -61,7 +61,7 @@ The following potential vulnerabilities were **resolved** after detection. - **Detection times:** - **Dependabot**: 2024-09-24 19:48 - **Snyk**: 2024-09-23 19:08 -- **Resolution time:** 2024-09-25 5:05 +- **Resolution time:** 2024-09-25 05:05 - **Resolution version (`@stassi/leaf`):** [v0.0.31](https://github.com/Stassi/leaf/releases/tag/v0.0.31) - **CVSS (severity):** - **Dependabot**: 7.7 (high) @@ -76,8 +76,8 @@ The following potential vulnerabilities were **resolved** after detection. - **Detected by:** Snyk - **Vulnerable package:** [cross-spawn](https://www.npmjs.com/package/cross-spawn) (via [serve](https://www.npmjs.com/package/serve)) -- **Detection time:** 2024-11-07 8:43 -- **Resolution time:** 2024-11-12 1:13 +- **Detection time:** 2024-11-07 08:43 +- **Resolution time:** 2024-11-12 01:13 - **Resolution version (`@stassi/leaf`):** [v0.0.78](https://github.com/Stassi/leaf/releases/tag/v0.0.78) - **CVSS (severity):** 8.7 (high) - **Advisory:** [SNYK-JS-CROSSSPAWN-8303230](https://security.snyk.io/vuln/SNYK-JS-CROSSSPAWN-8303230) From a9300fac43bc69bea7a6ead39806ad58c9bfa4e9 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 18:47:30 -0800 Subject: [PATCH 12/62] `useLink` implementation --- public/script/leaflet-fullscreen.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 86e1762..a62e56f 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -17,6 +17,18 @@ function useBoolean(initialValue = false) { } } +function useLink(initialValue) { + const state = initialValue + return { + assign(props) { + Object.assign(state, props) + }, + onClick(handler) { + DomEvent.on(state, 'click', handler) + }, + } +} + function getFullscreenChangeEventName() { if ('onfullscreenchange' in document) return 'fullscreenchange' else if ('onmozfullscreenchange' in document) return 'mozfullscreenchange' From 0bd7bf837ef9734952f32e40037347a705cd819a Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 18:50:19 -0800 Subject: [PATCH 13/62] `useLink` integration simplifies link element operations --- public/script/leaflet-fullscreen.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index a62e56f..0b8eb99 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -56,22 +56,24 @@ function createFullscreenControl(options = {}, getFullscreen, setFullscreen) { 'leaflet-control-fullscreen leaflet-bar leaflet-control', ) - const link = DomUtil.create( - 'a', - 'leaflet-control-fullscreen-button leaflet-bar-part', - container, + const { assign: linkAssign, onClick: onLinkClick } = useLink( + DomUtil.create( + 'a', + 'leaflet-control-fullscreen-button leaflet-bar-part', + container, + ), ) - Object.assign(link, { href: '#' }) - - DomEvent.on(link, 'click', function onLinkClick(e) { + onLinkClick(function handleLinkClick(e) { DomEvent.stopPropagation(e) DomEvent.preventDefault(e) toggleFullscreen(map, mergedOptions, getFullscreen, setFullscreen) }) + linkAssign({ href: '#' }) + function updateTitle() { - Object.assign(link, { title: mergedOptions.title[getFullscreen()] }) + linkAssign({ title: mergedOptions.title[getFullscreen()] }) } updateTitle() From e5b5d74ec2a8a58d3ff30c3a1d3ee831304bc5b2 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 19:42:18 -0800 Subject: [PATCH 14/62] cascading property destructuring with top-level default values --- public/script/leaflet-fullscreen.js | 62 ++++++++++++++++------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 0b8eb99..31581be 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -38,17 +38,12 @@ function getFullscreenChangeEventName() { return null } -function createFullscreenControl(options = {}, getFullscreen, setFullscreen) { - const mergedOptions = { - position: 'topleft', - title: { - false: 'View Fullscreen', - true: 'Exit Fullscreen', - }, - ...options, - } - - const fullscreenControl = control({ position: mergedOptions.position }) +function createFullscreenControl( + { position, title, ...optionsProps } = {}, + getFullscreen, + setFullscreen, +) { + const fullscreenControl = control({ position }) fullscreenControl.onAdd = function onAdd(map) { const container = DomUtil.create( @@ -67,13 +62,13 @@ function createFullscreenControl(options = {}, getFullscreen, setFullscreen) { onLinkClick(function handleLinkClick(e) { DomEvent.stopPropagation(e) DomEvent.preventDefault(e) - toggleFullscreen(map, mergedOptions, getFullscreen, setFullscreen) + toggleFullscreen(map, optionsProps, getFullscreen, setFullscreen) }) linkAssign({ href: '#' }) function updateTitle() { - linkAssign({ title: mergedOptions.title[getFullscreen()] }) + linkAssign({ title: title[getFullscreen()] }) } updateTitle() @@ -109,31 +104,44 @@ function disablePseudoFullscreen(map, getFullscreen, setFullscreen) { map.fire('fullscreenchange') } -function toggleFullscreen(map, options = {}, getFullscreen, setFullscreen) { +function toggleFullscreen( + map, + { pseudoFullscreen } = {}, + getFullscreen, + setFullscreen, +) { const container = map.getContainer() if (getFullscreen()) { - if (options.pseudoFullscreen) + if (pseudoFullscreen) disablePseudoFullscreen(map, getFullscreen, setFullscreen) else if (document.exitFullscreen) document.exitFullscreen() else disablePseudoFullscreen(map, getFullscreen, setFullscreen) - } else if (options.pseudoFullscreen) + } else if (pseudoFullscreen) enablePseudoFullscreen(map, getFullscreen, setFullscreen) else if (container.requestFullscreen) container.requestFullscreen() else enablePseudoFullscreen(map, getFullscreen, setFullscreen) } -export function fullscreenMap(id, options = {}) { - const map = leafletMap(id, options) - - const { get: getFullscreen, set: setFullscreen } = useBoolean() - - if (options.fullscreenControl) - createFullscreenControl( - options.fullscreenControl, - getFullscreen, - setFullscreen, - ).addTo(map) +export function fullscreenMap({ + fullscreenControlOptions = { + position: 'topleft', + title: { + false: 'View Fullscreen', + true: 'Exit Fullscreen', + }, + }, + id, + ...mapOptions +}) { + const { get: getFullscreen, set: setFullscreen } = useBoolean(), + map = leafletMap(id, mapOptions) + + createFullscreenControl( + fullscreenControlOptions, + getFullscreen, + setFullscreen, + ).addTo(map) const fullscreenChangeEvent = getFullscreenChangeEventName() From 2aff1125cf3bcf8c2cd931b244e4e35e1d09d36d Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 19:43:28 -0800 Subject: [PATCH 15/62] cascading property destructuring integration (unary interface) --- public/tutorial/accessibility/script/fullscreen.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/public/tutorial/accessibility/script/fullscreen.js b/public/tutorial/accessibility/script/fullscreen.js index 2ea9c44..724f2e8 100644 --- a/public/tutorial/accessibility/script/fullscreen.js +++ b/public/tutorial/accessibility/script/fullscreen.js @@ -3,15 +3,8 @@ import { marker } from '../../../leaflet-adapter/marker.js' import { tileLayer } from '../../../leaflet-adapter/tile-layer/tile-layer.js' import { fullscreenMap } from '../../../script/leaflet-fullscreen.js' -function mapFullscreen({ id, ...props }) { - return fullscreenMap(id, { - fullscreenControl: true, - ...props, - }) -} - const altText = 'Kyiv', - map = mapFullscreen({ + map = fullscreenMap({ center: [50.4501, 30.5234], id: 'map', zoom: 4, From afd727a59ac94ed824828c62cadd2a95f3348c33 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 20:05:32 -0800 Subject: [PATCH 16/62] - `control` variable inlined from `createFullscreenControl` function - `pseudoFullscreen` property converted to boolean from nested object --- public/script/leaflet-fullscreen.js | 93 ++++++++++++----------------- 1 file changed, 38 insertions(+), 55 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 31581be..495eb53 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -1,5 +1,5 @@ import { - control, + control as leafletControl, DomEvent, DomUtil, map as leafletMap, @@ -38,48 +38,6 @@ function getFullscreenChangeEventName() { return null } -function createFullscreenControl( - { position, title, ...optionsProps } = {}, - getFullscreen, - setFullscreen, -) { - const fullscreenControl = control({ position }) - - fullscreenControl.onAdd = function onAdd(map) { - const container = DomUtil.create( - 'div', - 'leaflet-control-fullscreen leaflet-bar leaflet-control', - ) - - const { assign: linkAssign, onClick: onLinkClick } = useLink( - DomUtil.create( - 'a', - 'leaflet-control-fullscreen-button leaflet-bar-part', - container, - ), - ) - - onLinkClick(function handleLinkClick(e) { - DomEvent.stopPropagation(e) - DomEvent.preventDefault(e) - toggleFullscreen(map, optionsProps, getFullscreen, setFullscreen) - }) - - linkAssign({ href: '#' }) - - function updateTitle() { - linkAssign({ title: title[getFullscreen()] }) - } - - updateTitle() - map.on('fullscreenchange', updateTitle) - - return container - } - - return fullscreenControl -} - function setFullscreenState(map, newState, getFullscreen, setFullscreen) { setFullscreen(newState) @@ -104,12 +62,7 @@ function disablePseudoFullscreen(map, getFullscreen, setFullscreen) { map.fire('fullscreenchange') } -function toggleFullscreen( - map, - { pseudoFullscreen } = {}, - getFullscreen, - setFullscreen, -) { +function toggleFullscreen(map, pseudoFullscreen, getFullscreen, setFullscreen) { const container = map.getContainer() if (getFullscreen()) { @@ -124,8 +77,9 @@ function toggleFullscreen( } export function fullscreenMap({ - fullscreenControlOptions = { + fullscreenControlOptions: { position, pseudoFullscreen, title } = { position: 'topleft', + pseudoFullscreen: false, title: { false: 'View Fullscreen', true: 'Exit Fullscreen', @@ -135,13 +89,42 @@ export function fullscreenMap({ ...mapOptions }) { const { get: getFullscreen, set: setFullscreen } = useBoolean(), + control = leafletControl({ position }), map = leafletMap(id, mapOptions) - createFullscreenControl( - fullscreenControlOptions, - getFullscreen, - setFullscreen, - ).addTo(map) + control.onAdd = function onControlAdd(addedMap) { + const container = DomUtil.create( + 'div', + 'leaflet-control-fullscreen leaflet-bar leaflet-control', + ) + + const { assign: linkAssign, onClick: onLinkClick } = useLink( + DomUtil.create( + 'a', + 'leaflet-control-fullscreen-button leaflet-bar-part', + container, + ), + ) + + onLinkClick(function handleLinkClick(e) { + DomEvent.stopPropagation(e) + DomEvent.preventDefault(e) + toggleFullscreen(addedMap, pseudoFullscreen, getFullscreen, setFullscreen) + }) + + linkAssign({ href: '#' }) + + function updateTitle() { + linkAssign({ title: title[getFullscreen()] }) + } + + updateTitle() + addedMap.on('fullscreenchange', updateTitle) + + return container + } + + control.addTo(map) const fullscreenChangeEvent = getFullscreenChangeEventName() From e2e95e77263f876ae3dc977eb3082fb8bdf6f876 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 22:00:26 -0800 Subject: [PATCH 17/62] remove deprecated `pseudoFullscreen` feature --- public/script/leaflet-fullscreen.js | 39 ++++++----------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 495eb53..9385ccc 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -48,38 +48,9 @@ function setFullscreenState(map, newState, getFullscreen, setFullscreen) { map.invalidateSize() } -function enablePseudoFullscreen(map, getFullscreen, setFullscreen) { - const container = map.getContainer() - DomUtil.addClass(container, 'leaflet-pseudo-fullscreen') - setFullscreenState(map, true, getFullscreen, setFullscreen) - map.fire('fullscreenchange') -} - -function disablePseudoFullscreen(map, getFullscreen, setFullscreen) { - const container = map.getContainer() - DomUtil.removeClass(container, 'leaflet-pseudo-fullscreen') - setFullscreenState(map, false, getFullscreen, setFullscreen) - map.fire('fullscreenchange') -} - -function toggleFullscreen(map, pseudoFullscreen, getFullscreen, setFullscreen) { - const container = map.getContainer() - - if (getFullscreen()) { - if (pseudoFullscreen) - disablePseudoFullscreen(map, getFullscreen, setFullscreen) - else if (document.exitFullscreen) document.exitFullscreen() - else disablePseudoFullscreen(map, getFullscreen, setFullscreen) - } else if (pseudoFullscreen) - enablePseudoFullscreen(map, getFullscreen, setFullscreen) - else if (container.requestFullscreen) container.requestFullscreen() - else enablePseudoFullscreen(map, getFullscreen, setFullscreen) -} - export function fullscreenMap({ - fullscreenControlOptions: { position, pseudoFullscreen, title } = { + fullscreenControlOptions: { position, title } = { position: 'topleft', - pseudoFullscreen: false, title: { false: 'View Fullscreen', true: 'Exit Fullscreen', @@ -109,7 +80,13 @@ export function fullscreenMap({ onLinkClick(function handleLinkClick(e) { DomEvent.stopPropagation(e) DomEvent.preventDefault(e) - toggleFullscreen(addedMap, pseudoFullscreen, getFullscreen, setFullscreen) + + const addedMapContainer = addedMap.getContainer() + + if (getFullscreen()) { + if (document.exitFullscreen) document.exitFullscreen() + } else if (addedMapContainer.requestFullscreen) + addedMapContainer.requestFullscreen() }) linkAssign({ href: '#' }) From 8647e28b3d8d2b74bb06901602be2aadd87b3683 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 22:13:38 -0800 Subject: [PATCH 18/62] merged `map.fire` call moved to bottom of `setFullscreenState` scope from `fullscreenMap` scope --- public/script/leaflet-fullscreen.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 9385ccc..b321572 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -46,6 +46,7 @@ function setFullscreenState(map, newState, getFullscreen, setFullscreen) { else DomUtil.removeClass(container, 'leaflet-fullscreen-on') map.invalidateSize() + map.fire('fullscreenchange') } export function fullscreenMap({ @@ -115,11 +116,9 @@ export function fullscreenMap({ ) { if (!getFullscreen()) { setFullscreenState(map, true, getFullscreen, setFullscreen) - map.fire('fullscreenchange') } } else if (getFullscreen()) { setFullscreenState(map, false, getFullscreen, setFullscreen) - map.fire('fullscreenchange') } } From 652b5491a6f6300babede6f31832d337f05afee8 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Tue, 12 Nov 2024 22:18:22 -0800 Subject: [PATCH 19/62] `element` parameter in `useLink` renamed from `initialValue` & inlined `state` alias --- public/script/leaflet-fullscreen.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index b321572..d29a968 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -17,14 +17,13 @@ function useBoolean(initialValue = false) { } } -function useLink(initialValue) { - const state = initialValue +function useLink(element) { return { assign(props) { - Object.assign(state, props) + Object.assign(element, props) }, onClick(handler) { - DomEvent.on(state, 'click', handler) + DomEvent.on(element, 'click', handler) }, } } From 566a35edec61a942d02fc28f2ccd3025ec99592f Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 02:56:11 -0800 Subject: [PATCH 20/62] inline `setFullscreenState` --- public/script/leaflet-fullscreen.js | 34 +++++++++++++++-------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index d29a968..7d87627 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -37,17 +37,6 @@ function getFullscreenChangeEventName() { return null } -function setFullscreenState(map, newState, getFullscreen, setFullscreen) { - setFullscreen(newState) - - const container = map.getContainer() - if (getFullscreen()) DomUtil.addClass(container, 'leaflet-fullscreen-on') - else DomUtil.removeClass(container, 'leaflet-fullscreen-on') - - map.invalidateSize() - map.fire('fullscreenchange') -} - export function fullscreenMap({ fullscreenControlOptions: { position, title } = { position: 'topleft', @@ -106,18 +95,31 @@ export function fullscreenMap({ const fullscreenChangeEvent = getFullscreenChangeEventName() function handleFullscreenChange() { + const container = map.getContainer(), + fullscreen = getFullscreen() + if ( - map.getContainer() === + container === (document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement) ) { - if (!getFullscreen()) { - setFullscreenState(map, true, getFullscreen, setFullscreen) + if (!fullscreen) { + setFullscreen(true) + + DomUtil.addClass(container, 'leaflet-fullscreen-on') + + map.invalidateSize() + map.fire('fullscreenchange') } - } else if (getFullscreen()) { - setFullscreenState(map, false, getFullscreen, setFullscreen) + } else if (fullscreen) { + setFullscreen(false) + + DomUtil.removeClass(container, 'leaflet-fullscreen-on') + + map.invalidateSize() + map.fire('fullscreenchange') } } From 9d172206fedb94ace123266a3f66a7b4d98fb949 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 03:02:30 -0800 Subject: [PATCH 21/62] `useBoolean().toggle` replaces `useBoolean().set` --- public/script/leaflet-fullscreen.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 7d87627..12cb368 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -11,8 +11,8 @@ function useBoolean(initialValue = false) { get() { return state }, - set(newState) { - state = newState + toggle() { + state = !state }, } } @@ -48,7 +48,7 @@ export function fullscreenMap({ id, ...mapOptions }) { - const { get: getFullscreen, set: setFullscreen } = useBoolean(), + const { get: getFullscreen, toggle: toggleFullscreen } = useBoolean(), control = leafletControl({ position }), map = leafletMap(id, mapOptions) @@ -106,7 +106,7 @@ export function fullscreenMap({ document.msFullscreenElement) ) { if (!fullscreen) { - setFullscreen(true) + toggleFullscreen() DomUtil.addClass(container, 'leaflet-fullscreen-on') @@ -114,7 +114,7 @@ export function fullscreenMap({ map.fire('fullscreenchange') } } else if (fullscreen) { - setFullscreen(false) + toggleFullscreen() DomUtil.removeClass(container, 'leaflet-fullscreen-on') From 18a2aa8e445d1de151a56cfb4d279a3a96fb3149 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 03:06:28 -0800 Subject: [PATCH 22/62] remove obsolete `fullscreenElement` vendor prefixes --- public/script/leaflet-fullscreen.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 12cb368..b4e40b9 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -98,13 +98,7 @@ export function fullscreenMap({ const container = map.getContainer(), fullscreen = getFullscreen() - if ( - container === - (document.fullscreenElement || - document.mozFullScreenElement || - document.webkitFullscreenElement || - document.msFullscreenElement) - ) { + if (container === document.fullscreenElement) { if (!fullscreen) { toggleFullscreen() From 9ed4745690081f512666b07b17bf88536a5cf2b6 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 03:12:26 -0800 Subject: [PATCH 23/62] flat control flow optimization --- public/script/leaflet-fullscreen.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index b4e40b9..7520ce2 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -95,22 +95,19 @@ export function fullscreenMap({ const fullscreenChangeEvent = getFullscreenChangeEventName() function handleFullscreenChange() { - const container = map.getContainer(), - fullscreen = getFullscreen() + const container = map.getContainer() - if (container === document.fullscreenElement) { - if (!fullscreen) { - toggleFullscreen() + if (getFullscreen()) { + toggleFullscreen() - DomUtil.addClass(container, 'leaflet-fullscreen-on') + DomUtil.removeClass(container, 'leaflet-fullscreen-on') - map.invalidateSize() - map.fire('fullscreenchange') - } - } else if (fullscreen) { + map.invalidateSize() + map.fire('fullscreenchange') + } else if (container === document.fullscreenElement) { toggleFullscreen() - DomUtil.removeClass(container, 'leaflet-fullscreen-on') + DomUtil.addClass(container, 'leaflet-fullscreen-on') map.invalidateSize() map.fire('fullscreenchange') From bc1396f591d2db44a4d97e4c657ee73e17630a4b Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 03:21:12 -0800 Subject: [PATCH 24/62] remove obsolete `onfullscreenchange` vendor prefixes --- public/script/leaflet-fullscreen.js | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 7520ce2..76510a9 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -28,15 +28,6 @@ function useLink(element) { } } -function getFullscreenChangeEventName() { - if ('onfullscreenchange' in document) return 'fullscreenchange' - else if ('onmozfullscreenchange' in document) return 'mozfullscreenchange' - else if ('onwebkitfullscreenchange' in document) - return 'webkitfullscreenchange' - else if ('onmsfullscreenchange' in document) return 'MSFullscreenChange' - return null -} - export function fullscreenMap({ fullscreenControlOptions: { position, title } = { position: 'topleft', @@ -92,8 +83,6 @@ export function fullscreenMap({ control.addTo(map) - const fullscreenChangeEvent = getFullscreenChangeEventName() - function handleFullscreenChange() { const container = map.getContainer() @@ -114,15 +103,13 @@ export function fullscreenMap({ } } - if (fullscreenChangeEvent) { - map.whenReady(function readyHandler() { - DomEvent.on(document, fullscreenChangeEvent, handleFullscreenChange) - }) + map.whenReady(function readyHandler() { + DomEvent.on(document, 'fullscreenchange', handleFullscreenChange) + }) - map.on('unload', function unloadHandler() { - DomEvent.off(document, fullscreenChangeEvent, handleFullscreenChange) - }) - } + map.on('unload', function unloadHandler() { + DomEvent.off(document, 'fullscreenchange', handleFullscreenChange) + }) return map } From c2f5f13e4062a46036c946b256040f4af7e8d766 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 03:59:58 -0800 Subject: [PATCH 25/62] `getFullscreen` ternary replaces if/else-if blocks, reducing duplication --- public/script/leaflet-fullscreen.js | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 76510a9..53ed1f8 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -84,23 +84,15 @@ export function fullscreenMap({ control.addTo(map) function handleFullscreenChange() { - const container = map.getContainer() - - if (getFullscreen()) { - toggleFullscreen() - - DomUtil.removeClass(container, 'leaflet-fullscreen-on') - - map.invalidateSize() - map.fire('fullscreenchange') - } else if (container === document.fullscreenElement) { - toggleFullscreen() + ;(getFullscreen() ? DomUtil.removeClass : DomUtil.addClass)( + map.getContainer(), + 'leaflet-fullscreen-on', + ) - DomUtil.addClass(container, 'leaflet-fullscreen-on') + toggleFullscreen() - map.invalidateSize() - map.fire('fullscreenchange') - } + map.invalidateSize() + map.fire('fullscreenchange') } map.whenReady(function readyHandler() { From 1951457ab6730a24def596efe7eecca14b660f0e Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 04:07:53 -0800 Subject: [PATCH 26/62] `joinClasses` accepts a class name array, improving readability --- public/script/leaflet-fullscreen.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 53ed1f8..a4b0ddb 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -5,6 +5,10 @@ import { map as leafletMap, } from '../leaflet/leaflet-src.esm.js' +function joinClasses(classes) { + return classes.join(' ') +} + function useBoolean(initialValue = false) { let state = initialValue return { @@ -46,13 +50,17 @@ export function fullscreenMap({ control.onAdd = function onControlAdd(addedMap) { const container = DomUtil.create( 'div', - 'leaflet-control-fullscreen leaflet-bar leaflet-control', + joinClasses([ + 'leaflet-bar', + 'leaflet-control', + 'leaflet-control-fullscreen', + ]), ) const { assign: linkAssign, onClick: onLinkClick } = useLink( DomUtil.create( 'a', - 'leaflet-control-fullscreen-button leaflet-bar-part', + joinClasses(['leaflet-bar-part', 'leaflet-control-fullscreen-button']), container, ), ) From f2054a23618d54873e2cdf554431a0ef8035b7b8 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 04:20:21 -0800 Subject: [PATCH 27/62] `fullscreenChangeEvent` extracts 4 identical strings --- public/script/leaflet-fullscreen.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index a4b0ddb..de2148f 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -32,6 +32,8 @@ function useLink(element) { } } +const fullscreenChangeEvent = 'fullscreenchange' + export function fullscreenMap({ fullscreenControlOptions: { position, title } = { position: 'topleft', @@ -84,7 +86,7 @@ export function fullscreenMap({ } updateTitle() - addedMap.on('fullscreenchange', updateTitle) + addedMap.on(fullscreenChangeEvent, updateTitle) return container } @@ -100,15 +102,15 @@ export function fullscreenMap({ toggleFullscreen() map.invalidateSize() - map.fire('fullscreenchange') + map.fire(fullscreenChangeEvent) } map.whenReady(function readyHandler() { - DomEvent.on(document, 'fullscreenchange', handleFullscreenChange) + DomEvent.on(document, fullscreenChangeEvent, handleFullscreenChange) }) map.on('unload', function unloadHandler() { - DomEvent.off(document, 'fullscreenchange', handleFullscreenChange) + DomEvent.off(document, fullscreenChangeEvent, handleFullscreenChange) }) return map From 7b7400359232999279afe194f4cb442490ed1af5 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 04:37:35 -0800 Subject: [PATCH 28/62] `updateTitle` hoisted to `fullscreenMap` scope, replaces `fullscreenChangeEvent` firing --- public/script/leaflet-fullscreen.js | 32 +++++++++++++---------------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index de2148f..86540e1 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -47,19 +47,16 @@ export function fullscreenMap({ }) { const { get: getFullscreen, toggle: toggleFullscreen } = useBoolean(), control = leafletControl({ position }), - map = leafletMap(id, mapOptions) - - control.onAdd = function onControlAdd(addedMap) { - const container = DomUtil.create( + map = leafletMap(id, mapOptions), + container = DomUtil.create( 'div', joinClasses([ 'leaflet-bar', 'leaflet-control', 'leaflet-control-fullscreen', ]), - ) - - const { assign: linkAssign, onClick: onLinkClick } = useLink( + ), + { assign: linkAssign, onClick: onLinkClick } = useLink( DomUtil.create( 'a', joinClasses(['leaflet-bar-part', 'leaflet-control-fullscreen-button']), @@ -67,6 +64,15 @@ export function fullscreenMap({ ), ) + linkAssign({ href: '#' }) + + function updateTitle() { + linkAssign({ title: title[getFullscreen()] }) + } + + control.onAdd = function onControlAdd(addedMap) { + updateTitle() + onLinkClick(function handleLinkClick(e) { DomEvent.stopPropagation(e) DomEvent.preventDefault(e) @@ -79,15 +85,6 @@ export function fullscreenMap({ addedMapContainer.requestFullscreen() }) - linkAssign({ href: '#' }) - - function updateTitle() { - linkAssign({ title: title[getFullscreen()] }) - } - - updateTitle() - addedMap.on(fullscreenChangeEvent, updateTitle) - return container } @@ -100,9 +97,8 @@ export function fullscreenMap({ ) toggleFullscreen() - + updateTitle() map.invalidateSize() - map.fire(fullscreenChangeEvent) } map.whenReady(function readyHandler() { From 6b45934ca462af4d6ef41044066698868046f63b Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 04:40:38 -0800 Subject: [PATCH 29/62] `handleLinkClick` adopts async/await --- public/script/leaflet-fullscreen.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 86540e1..f3fe673 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -73,16 +73,16 @@ export function fullscreenMap({ control.onAdd = function onControlAdd(addedMap) { updateTitle() - onLinkClick(function handleLinkClick(e) { + onLinkClick(async function handleLinkClick(e) { DomEvent.stopPropagation(e) DomEvent.preventDefault(e) const addedMapContainer = addedMap.getContainer() if (getFullscreen()) { - if (document.exitFullscreen) document.exitFullscreen() + if (document.exitFullscreen) await document.exitFullscreen() } else if (addedMapContainer.requestFullscreen) - addedMapContainer.requestFullscreen() + await addedMapContainer.requestFullscreen() }) return container From 956ac4104310cd48d34a6bd333135a57c0db757b Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 04:46:00 -0800 Subject: [PATCH 30/62] `[join]ClassNames` renamed from `[join]Classes`, increasing semantic accuracy --- public/script/leaflet-fullscreen.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index f3fe673..7f30e07 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -5,8 +5,8 @@ import { map as leafletMap, } from '../leaflet/leaflet-src.esm.js' -function joinClasses(classes) { - return classes.join(' ') +function joinClassNames(classNames) { + return classNames.join(' ') } function useBoolean(initialValue = false) { @@ -50,7 +50,7 @@ export function fullscreenMap({ map = leafletMap(id, mapOptions), container = DomUtil.create( 'div', - joinClasses([ + joinClassNames([ 'leaflet-bar', 'leaflet-control', 'leaflet-control-fullscreen', @@ -59,7 +59,10 @@ export function fullscreenMap({ { assign: linkAssign, onClick: onLinkClick } = useLink( DomUtil.create( 'a', - joinClasses(['leaflet-bar-part', 'leaflet-control-fullscreen-button']), + joinClassNames([ + 'leaflet-bar-part', + 'leaflet-control-fullscreen-button', + ]), container, ), ) From 6f55de18eb532b3575bf27b80236a7f614839f23 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 04:56:42 -0800 Subject: [PATCH 31/62] `fullscreenMap` `onAdd` ternary replaces if/else-if blocks --- public/script/leaflet-fullscreen.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 7f30e07..e239a13 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -80,12 +80,9 @@ export function fullscreenMap({ DomEvent.stopPropagation(e) DomEvent.preventDefault(e) - const addedMapContainer = addedMap.getContainer() - - if (getFullscreen()) { - if (document.exitFullscreen) await document.exitFullscreen() - } else if (addedMapContainer.requestFullscreen) - await addedMapContainer.requestFullscreen() + await (getFullscreen() + ? document?.exitFullscreen() + : addedMap.getContainer()?.requestFullscreen()) }) return container From 4dc697940eb55a6097698f4f771ecc1c33f88ac5 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 14:26:36 -0800 Subject: [PATCH 32/62] `mapLifecycleListener` wraps `onMapLifecycleEvent`, simplifying map event bindings --- public/script/leaflet-fullscreen.js | 35 ++++++++++++++++------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index e239a13..ebb88e1 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -90,24 +90,27 @@ export function fullscreenMap({ control.addTo(map) - function handleFullscreenChange() { - ;(getFullscreen() ? DomUtil.removeClass : DomUtil.addClass)( - map.getContainer(), - 'leaflet-fullscreen-on', - ) - - toggleFullscreen() - updateTitle() - map.invalidateSize() + function mapLifecycleListener(documentFirstReady) { + return function onMapLifecycleEvent() { + DomEvent[documentFirstReady ? 'on' : 'off']( + document, + fullscreenChangeEvent, + function handleFullscreenChange() { + ;(getFullscreen() ? DomUtil.removeClass : DomUtil.addClass)( + map.getContainer(), + 'leaflet-fullscreen-on', + ) + + toggleFullscreen() + updateTitle() + map.invalidateSize() + }, + ) + } } - map.whenReady(function readyHandler() { - DomEvent.on(document, fullscreenChangeEvent, handleFullscreenChange) - }) - - map.on('unload', function unloadHandler() { - DomEvent.off(document, fullscreenChangeEvent, handleFullscreenChange) - }) + map.whenReady(mapLifecycleListener(true)) + map.on('unload', mapLifecycleListener(false)) return map } From d16917e32eb94ec407512111e669f98f922ef18e Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 14:36:25 -0800 Subject: [PATCH 33/62] sort imperative statements by ascending element complexity (`link` < `control` < `map`) --- public/script/leaflet-fullscreen.js | 44 ++++++++++++++--------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index ebb88e1..35342bd 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -46,8 +46,6 @@ export function fullscreenMap({ ...mapOptions }) { const { get: getFullscreen, toggle: toggleFullscreen } = useBoolean(), - control = leafletControl({ position }), - map = leafletMap(id, mapOptions), container = DomUtil.create( 'div', joinClassNames([ @@ -65,31 +63,14 @@ export function fullscreenMap({ ]), container, ), - ) - - linkAssign({ href: '#' }) + ), + control = leafletControl({ position }), + map = leafletMap(id, mapOptions) function updateTitle() { linkAssign({ title: title[getFullscreen()] }) } - control.onAdd = function onControlAdd(addedMap) { - updateTitle() - - onLinkClick(async function handleLinkClick(e) { - DomEvent.stopPropagation(e) - DomEvent.preventDefault(e) - - await (getFullscreen() - ? document?.exitFullscreen() - : addedMap.getContainer()?.requestFullscreen()) - }) - - return container - } - - control.addTo(map) - function mapLifecycleListener(documentFirstReady) { return function onMapLifecycleEvent() { DomEvent[documentFirstReady ? 'on' : 'off']( @@ -109,6 +90,25 @@ export function fullscreenMap({ } } + linkAssign({ href: '#' }) + + control.onAdd = function onControlAdd(addedMap) { + updateTitle() + + onLinkClick(async function handleLinkClick(e) { + DomEvent.stopPropagation(e) + DomEvent.preventDefault(e) + + await (getFullscreen() + ? document?.exitFullscreen() + : addedMap.getContainer()?.requestFullscreen()) + }) + + return container + } + + control.addTo(map) + map.whenReady(mapLifecycleListener(true)) map.on('unload', mapLifecycleListener(false)) From 7cb213c6ff8025f07d70866e69e65cee5967e17b Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 14:38:18 -0800 Subject: [PATCH 34/62] remove `useBoolean` default parameter (simplification) --- public/script/leaflet-fullscreen.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 35342bd..a9a4693 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -9,7 +9,7 @@ function joinClassNames(classNames) { return classNames.join(' ') } -function useBoolean(initialValue = false) { +function useBoolean(initialValue) { let state = initialValue return { get() { @@ -45,7 +45,7 @@ export function fullscreenMap({ id, ...mapOptions }) { - const { get: getFullscreen, toggle: toggleFullscreen } = useBoolean(), + const { get: getFullscreen, toggle: toggleFullscreen } = useBoolean(false), container = DomUtil.create( 'div', joinClassNames([ From 27cc3a0697d3850746d2c50d4dffe397cd1bcc08 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 14:43:17 -0800 Subject: [PATCH 35/62] inline `fullscreenChangeEvent` --- public/script/leaflet-fullscreen.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index a9a4693..00a6554 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -32,8 +32,6 @@ function useLink(element) { } } -const fullscreenChangeEvent = 'fullscreenchange' - export function fullscreenMap({ fullscreenControlOptions: { position, title } = { position: 'topleft', @@ -75,7 +73,7 @@ export function fullscreenMap({ return function onMapLifecycleEvent() { DomEvent[documentFirstReady ? 'on' : 'off']( document, - fullscreenChangeEvent, + 'fullscreenchange', function handleFullscreenChange() { ;(getFullscreen() ? DomUtil.removeClass : DomUtil.addClass)( map.getContainer(), From 912fd3bc732ff640ff984e677324b848fa1ac457 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 14:51:20 -0800 Subject: [PATCH 36/62] parameterize `classNames` with default values --- public/script/leaflet-fullscreen.js | 32 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 00a6554..92fa784 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -33,7 +33,19 @@ function useLink(element) { } export function fullscreenMap({ - fullscreenControlOptions: { position, title } = { + fullscreenControlOptions: { + classNames: { container: containerClassNames, link: linkClassNames }, + position, + title, + } = { + classNames: { + container: [ + 'leaflet-bar', + 'leaflet-control', + 'leaflet-control-fullscreen', + ], + link: ['leaflet-bar-part', 'leaflet-control-fullscreen-button'], + }, position: 'topleft', title: { false: 'View Fullscreen', @@ -44,23 +56,9 @@ export function fullscreenMap({ ...mapOptions }) { const { get: getFullscreen, toggle: toggleFullscreen } = useBoolean(false), - container = DomUtil.create( - 'div', - joinClassNames([ - 'leaflet-bar', - 'leaflet-control', - 'leaflet-control-fullscreen', - ]), - ), + container = DomUtil.create('div', joinClassNames(containerClassNames)), { assign: linkAssign, onClick: onLinkClick } = useLink( - DomUtil.create( - 'a', - joinClassNames([ - 'leaflet-bar-part', - 'leaflet-control-fullscreen-button', - ]), - container, - ), + DomUtil.create('a', joinClassNames(linkClassNames), container), ), control = leafletControl({ position }), map = leafletMap(id, mapOptions) From 665ea43b15ac0cc5d4a2dc76ff907d45df4943e4 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 14:58:38 -0800 Subject: [PATCH 37/62] parameterize `classNames.mapFullscreen` --- public/script/leaflet-fullscreen.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 92fa784..741f121 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -34,7 +34,11 @@ function useLink(element) { export function fullscreenMap({ fullscreenControlOptions: { - classNames: { container: containerClassNames, link: linkClassNames }, + classNames: { + container: containerClassNames, + link: linkClassNames, + mapFullscreen: mapFullscreenClassName, + }, position, title, } = { @@ -45,6 +49,7 @@ export function fullscreenMap({ 'leaflet-control-fullscreen', ], link: ['leaflet-bar-part', 'leaflet-control-fullscreen-button'], + mapFullscreen: 'leaflet-fullscreen-on', }, position: 'topleft', title: { @@ -75,7 +80,7 @@ export function fullscreenMap({ function handleFullscreenChange() { ;(getFullscreen() ? DomUtil.removeClass : DomUtil.addClass)( map.getContainer(), - 'leaflet-fullscreen-on', + mapFullscreenClassName, ) toggleFullscreen() From e45449a52e749ba007999f29b338def3824d4f78 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 15:09:03 -0800 Subject: [PATCH 38/62] `fullscreenOptions` renamed from `fullscreenControlOptions` --- public/script/leaflet-fullscreen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index 741f121..c86cee5 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -33,7 +33,7 @@ function useLink(element) { } export function fullscreenMap({ - fullscreenControlOptions: { + fullscreenOptions: { classNames: { container: containerClassNames, link: linkClassNames, From 0afa798271d6099ce1b43c5f5b7c61b7706608b0 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 15:10:14 -0800 Subject: [PATCH 39/62] parent `control` nests `position` & `title` --- public/script/leaflet-fullscreen.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/public/script/leaflet-fullscreen.js b/public/script/leaflet-fullscreen.js index c86cee5..5e52c34 100644 --- a/public/script/leaflet-fullscreen.js +++ b/public/script/leaflet-fullscreen.js @@ -39,8 +39,7 @@ export function fullscreenMap({ link: linkClassNames, mapFullscreen: mapFullscreenClassName, }, - position, - title, + control: { position, title }, } = { classNames: { container: [ @@ -51,10 +50,12 @@ export function fullscreenMap({ link: ['leaflet-bar-part', 'leaflet-control-fullscreen-button'], mapFullscreen: 'leaflet-fullscreen-on', }, - position: 'topleft', - title: { - false: 'View Fullscreen', - true: 'Exit Fullscreen', + control: { + position: 'topleft', + title: { + false: 'View Fullscreen', + true: 'Exit Fullscreen', + }, }, }, id, From 2092e85529dcd55c9896fea719eb0c53d25f3cb5 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 15:15:00 -0800 Subject: [PATCH 40/62] `leaflet-fullscreen\fullscreen-map.js` moved to dedicated submodule directory from `script\leaflet-fullscreen.js` --- .../fullscreen-map.js} | 0 public/tutorial/accessibility/script/fullscreen.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename public/{script/leaflet-fullscreen.js => leaflet-fullscreen/fullscreen-map.js} (100%) diff --git a/public/script/leaflet-fullscreen.js b/public/leaflet-fullscreen/fullscreen-map.js similarity index 100% rename from public/script/leaflet-fullscreen.js rename to public/leaflet-fullscreen/fullscreen-map.js diff --git a/public/tutorial/accessibility/script/fullscreen.js b/public/tutorial/accessibility/script/fullscreen.js index 724f2e8..e08e95e 100644 --- a/public/tutorial/accessibility/script/fullscreen.js +++ b/public/tutorial/accessibility/script/fullscreen.js @@ -1,7 +1,7 @@ import { attributionOsm, urlTemplateOsm } from '../../../script/base-layers.js' import { marker } from '../../../leaflet-adapter/marker.js' import { tileLayer } from '../../../leaflet-adapter/tile-layer/tile-layer.js' -import { fullscreenMap } from '../../../script/leaflet-fullscreen.js' +import { fullscreenMap } from '../../../leaflet-fullscreen/fullscreen-map.js' const altText = 'Kyiv', map = fullscreenMap({ From 8c95257ece7aaadcde679e0fe32136faaff79329 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 15:20:41 -0800 Subject: [PATCH 41/62] `joinClassNames` submodule extraction --- public/leaflet-fullscreen/fullscreen-map.js | 4 +--- public/leaflet-fullscreen/join-class-names.js | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 public/leaflet-fullscreen/join-class-names.js diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index 5e52c34..c882175 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -5,9 +5,7 @@ import { map as leafletMap, } from '../leaflet/leaflet-src.esm.js' -function joinClassNames(classNames) { - return classNames.join(' ') -} +import { joinClassNames } from './join-class-names.js' function useBoolean(initialValue) { let state = initialValue diff --git a/public/leaflet-fullscreen/join-class-names.js b/public/leaflet-fullscreen/join-class-names.js new file mode 100644 index 0000000..cbaccb6 --- /dev/null +++ b/public/leaflet-fullscreen/join-class-names.js @@ -0,0 +1,3 @@ +export function joinClassNames(classNames) { + return classNames.join(' ') +} From bc043665dd542e5134ce11c195244ebfe56e3431 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 15:23:16 -0800 Subject: [PATCH 42/62] `useBoolean` submodule extraction --- public/leaflet-fullscreen/fullscreen-map.js | 13 +------------ public/leaflet-fullscreen/use-boolean.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 public/leaflet-fullscreen/use-boolean.js diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index c882175..7246bd7 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -6,18 +6,7 @@ import { } from '../leaflet/leaflet-src.esm.js' import { joinClassNames } from './join-class-names.js' - -function useBoolean(initialValue) { - let state = initialValue - return { - get() { - return state - }, - toggle() { - state = !state - }, - } -} +import { useBoolean } from './use-boolean.js' function useLink(element) { return { diff --git a/public/leaflet-fullscreen/use-boolean.js b/public/leaflet-fullscreen/use-boolean.js new file mode 100644 index 0000000..52c909a --- /dev/null +++ b/public/leaflet-fullscreen/use-boolean.js @@ -0,0 +1,11 @@ +export function useBoolean(initialValue) { + let state = initialValue + return { + get() { + return state + }, + toggle() { + state = !state + }, + } +} From 3f3bafb2b744f6d16494d1ca69b28dbad1c4ce0e Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 15:26:53 -0800 Subject: [PATCH 43/62] `useLink` submodule extraction --- public/leaflet-fullscreen/fullscreen-map.js | 12 +----------- public/leaflet-fullscreen/use-link.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 public/leaflet-fullscreen/use-link.js diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index 7246bd7..3d60afe 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -7,17 +7,7 @@ import { import { joinClassNames } from './join-class-names.js' import { useBoolean } from './use-boolean.js' - -function useLink(element) { - return { - assign(props) { - Object.assign(element, props) - }, - onClick(handler) { - DomEvent.on(element, 'click', handler) - }, - } -} +import { useLink } from './use-link.js' export function fullscreenMap({ fullscreenOptions: { diff --git a/public/leaflet-fullscreen/use-link.js b/public/leaflet-fullscreen/use-link.js new file mode 100644 index 0000000..00c6ca1 --- /dev/null +++ b/public/leaflet-fullscreen/use-link.js @@ -0,0 +1,12 @@ +import { DomEvent } from '../leaflet/leaflet-src.esm.js' + +export function useLink(element) { + return { + assign(props) { + Object.assign(element, props) + }, + onClick(handler) { + DomEvent.on(element, 'click', handler) + }, + } +} From 2092d7020105fabf67dccd143c668f61140ea2ac Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 15:39:49 -0800 Subject: [PATCH 44/62] `setControlTitle` parameterizes `fullscreen` boolean, replacing `updateTitle` and improving separation of concerns (SoC) --- public/leaflet-fullscreen/fullscreen-map.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index 3d60afe..17e209f 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -46,8 +46,8 @@ export function fullscreenMap({ control = leafletControl({ position }), map = leafletMap(id, mapOptions) - function updateTitle() { - linkAssign({ title: title[getFullscreen()] }) + function setControlTitle(fullscreen) { + linkAssign({ title: title[fullscreen] }) } function mapLifecycleListener(documentFirstReady) { @@ -56,14 +56,14 @@ export function fullscreenMap({ document, 'fullscreenchange', function handleFullscreenChange() { - ;(getFullscreen() ? DomUtil.removeClass : DomUtil.addClass)( + const fullscreen = getFullscreen() + ;(fullscreen ? DomUtil.removeClass : DomUtil.addClass)( map.getContainer(), mapFullscreenClassName, ) - - toggleFullscreen() - updateTitle() + setControlTitle(fullscreen) map.invalidateSize() + toggleFullscreen() }, ) } @@ -72,7 +72,7 @@ export function fullscreenMap({ linkAssign({ href: '#' }) control.onAdd = function onControlAdd(addedMap) { - updateTitle() + setControlTitle(getFullscreen()) onLinkClick(async function handleLinkClick(e) { DomEvent.stopPropagation(e) From 51fce2d2c2e1a8f2365c146f3e4265ed99d7ae8a Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 15:50:27 -0800 Subject: [PATCH 45/62] inline erroneous `fullscreen` constant to restore control flow --- public/leaflet-fullscreen/fullscreen-map.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index 17e209f..2cfde0f 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -56,14 +56,14 @@ export function fullscreenMap({ document, 'fullscreenchange', function handleFullscreenChange() { - const fullscreen = getFullscreen() - ;(fullscreen ? DomUtil.removeClass : DomUtil.addClass)( + ;(getFullscreen() ? DomUtil.removeClass : DomUtil.addClass)( map.getContainer(), mapFullscreenClassName, ) - setControlTitle(fullscreen) + map.invalidateSize() toggleFullscreen() + setControlTitle(getFullscreen()) }, ) } From e5d4cb9ce6eb296919cdb3702df06105128db0d6 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 15:55:41 -0800 Subject: [PATCH 46/62] explicit `*State` variable naming in returned `useBoolean` methods, increasing semantic specificity --- public/leaflet-fullscreen/fullscreen-map.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index 2cfde0f..02d2566 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -38,7 +38,8 @@ export function fullscreenMap({ id, ...mapOptions }) { - const { get: getFullscreen, toggle: toggleFullscreen } = useBoolean(false), + const { get: getFullscreenState, toggle: toggleFullscreenState } = + useBoolean(false), container = DomUtil.create('div', joinClassNames(containerClassNames)), { assign: linkAssign, onClick: onLinkClick } = useLink( DomUtil.create('a', joinClassNames(linkClassNames), container), @@ -56,14 +57,14 @@ export function fullscreenMap({ document, 'fullscreenchange', function handleFullscreenChange() { - ;(getFullscreen() ? DomUtil.removeClass : DomUtil.addClass)( + ;(getFullscreenState() ? DomUtil.removeClass : DomUtil.addClass)( map.getContainer(), mapFullscreenClassName, ) map.invalidateSize() - toggleFullscreen() - setControlTitle(getFullscreen()) + toggleFullscreenState() + setControlTitle(getFullscreenState()) }, ) } @@ -72,13 +73,13 @@ export function fullscreenMap({ linkAssign({ href: '#' }) control.onAdd = function onControlAdd(addedMap) { - setControlTitle(getFullscreen()) + setControlTitle(getFullscreenState()) onLinkClick(async function handleLinkClick(e) { DomEvent.stopPropagation(e) DomEvent.preventDefault(e) - await (getFullscreen() + await (getFullscreenState() ? document?.exitFullscreen() : addedMap.getContainer()?.requestFullscreen()) }) From 1f6b17acb9f6a3111be766b2b19446d92a403619 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 15:59:58 -0800 Subject: [PATCH 47/62] improve inner function naming consistency & readability --- public/leaflet-fullscreen/fullscreen-map.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index 02d2566..b0d819e 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -52,11 +52,11 @@ export function fullscreenMap({ } function mapLifecycleListener(documentFirstReady) { - return function onMapLifecycleEvent() { + return function handleFullscreenMapLifecycleEvent() { DomEvent[documentFirstReady ? 'on' : 'off']( document, 'fullscreenchange', - function handleFullscreenChange() { + function handleFullscreenMapChange() { ;(getFullscreenState() ? DomUtil.removeClass : DomUtil.addClass)( map.getContainer(), mapFullscreenClassName, From 3d257058979904dd4c962442e9d652cdac47320e Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 16:08:18 -0800 Subject: [PATCH 48/62] `setControlTitle` submodule extraction --- public/leaflet-fullscreen/fullscreen-map.js | 17 +++++++++++------ public/leaflet-fullscreen/set-control-title.js | 3 +++ 2 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 public/leaflet-fullscreen/set-control-title.js diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index b0d819e..e49b608 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -6,6 +6,7 @@ import { } from '../leaflet/leaflet-src.esm.js' import { joinClassNames } from './join-class-names.js' +import { setControlTitle } from './set-control-title.js' import { useBoolean } from './use-boolean.js' import { useLink } from './use-link.js' @@ -47,10 +48,6 @@ export function fullscreenMap({ control = leafletControl({ position }), map = leafletMap(id, mapOptions) - function setControlTitle(fullscreen) { - linkAssign({ title: title[fullscreen] }) - } - function mapLifecycleListener(documentFirstReady) { return function handleFullscreenMapLifecycleEvent() { DomEvent[documentFirstReady ? 'on' : 'off']( @@ -64,7 +61,11 @@ export function fullscreenMap({ map.invalidateSize() toggleFullscreenState() - setControlTitle(getFullscreenState()) + setControlTitle({ + fullscreen: getFullscreenState(), + linkAssign, + title, + }) }, ) } @@ -73,7 +74,11 @@ export function fullscreenMap({ linkAssign({ href: '#' }) control.onAdd = function onControlAdd(addedMap) { - setControlTitle(getFullscreenState()) + setControlTitle({ + fullscreen: getFullscreenState(), + linkAssign, + title, + }) onLinkClick(async function handleLinkClick(e) { DomEvent.stopPropagation(e) diff --git a/public/leaflet-fullscreen/set-control-title.js b/public/leaflet-fullscreen/set-control-title.js new file mode 100644 index 0000000..2c48900 --- /dev/null +++ b/public/leaflet-fullscreen/set-control-title.js @@ -0,0 +1,3 @@ +export function setControlTitle({ fullscreen, linkAssign, title }) { + linkAssign({ title: title[fullscreen] }) +} From 9554e83c08df617fbd15461bbfb03c59c515e2e1 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 18:31:32 -0800 Subject: [PATCH 49/62] `mapLifecycleListener` submodule extraction --- public/leaflet-fullscreen/fullscreen-map.js | 40 +++++++------------ .../map-lifecycle-listener.js | 34 ++++++++++++++++ 2 files changed, 48 insertions(+), 26 deletions(-) create mode 100644 public/leaflet-fullscreen/map-lifecycle-listener.js diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index e49b608..1ac95d2 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -6,6 +6,7 @@ import { } from '../leaflet/leaflet-src.esm.js' import { joinClassNames } from './join-class-names.js' +import { mapLifecycleListener } from './map-lifecycle-listener.js' import { setControlTitle } from './set-control-title.js' import { useBoolean } from './use-boolean.js' import { useLink } from './use-link.js' @@ -46,30 +47,17 @@ export function fullscreenMap({ DomUtil.create('a', joinClassNames(linkClassNames), container), ), control = leafletControl({ position }), - map = leafletMap(id, mapOptions) - - function mapLifecycleListener(documentFirstReady) { - return function handleFullscreenMapLifecycleEvent() { - DomEvent[documentFirstReady ? 'on' : 'off']( - document, - 'fullscreenchange', - function handleFullscreenMapChange() { - ;(getFullscreenState() ? DomUtil.removeClass : DomUtil.addClass)( - map.getContainer(), - mapFullscreenClassName, - ) - - map.invalidateSize() - toggleFullscreenState() - setControlTitle({ - fullscreen: getFullscreenState(), - linkAssign, - title, - }) - }, - ) - } - } + map = leafletMap(id, mapOptions), + handleMapLifecycleChange = (documentFirstReady) => + mapLifecycleListener({ + documentFirstReady, + getFullscreenState, + linkAssign, + map, + mapFullscreenClassName, + title, + toggleFullscreenState, + }) linkAssign({ href: '#' }) @@ -94,8 +82,8 @@ export function fullscreenMap({ control.addTo(map) - map.whenReady(mapLifecycleListener(true)) - map.on('unload', mapLifecycleListener(false)) + map.whenReady(handleMapLifecycleChange(true)) + map.on('unload', handleMapLifecycleChange(false)) return map } diff --git a/public/leaflet-fullscreen/map-lifecycle-listener.js b/public/leaflet-fullscreen/map-lifecycle-listener.js new file mode 100644 index 0000000..df111d9 --- /dev/null +++ b/public/leaflet-fullscreen/map-lifecycle-listener.js @@ -0,0 +1,34 @@ +import { DomEvent, DomUtil } from '../leaflet/leaflet-src.esm.js' + +import { setControlTitle } from './set-control-title.js' + +export function mapLifecycleListener({ + documentFirstReady, + getFullscreenState, + linkAssign, + map, + mapFullscreenClassName, + title, + toggleFullscreenState, +}) { + return function handleFullscreenMapLifecycleEvent() { + DomEvent[documentFirstReady ? 'on' : 'off']( + document, + 'fullscreenchange', + function handleFullscreenMapChange() { + ;(getFullscreenState() ? DomUtil.removeClass : DomUtil.addClass)( + map.getContainer(), + mapFullscreenClassName, + ) + + map.invalidateSize() + toggleFullscreenState() + setControlTitle({ + fullscreen: getFullscreenState(), + linkAssign, + title, + }) + }, + ) + } +} From f7156e07775d062b4e2f3edc49443bd558575fec Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 18:34:42 -0800 Subject: [PATCH 50/62] `handleControlAdded` renamed from `onControlAdd`, increasing function naming consistency --- public/leaflet-fullscreen/fullscreen-map.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index 1ac95d2..dc08026 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -61,7 +61,7 @@ export function fullscreenMap({ linkAssign({ href: '#' }) - control.onAdd = function onControlAdd(addedMap) { + control.onAdd = function handleControlAdded(addedMap) { setControlTitle({ fullscreen: getFullscreenState(), linkAssign, From 0feb092f5e5dc9b2763e07af85cd8481b8b7e111 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 19:01:01 -0800 Subject: [PATCH 51/62] `controlAddedListener` submodule extraction --- .../control-added-listener.js | 30 +++++++++++++++++++ public/leaflet-fullscreen/fullscreen-map.js | 29 +++++------------- 2 files changed, 38 insertions(+), 21 deletions(-) create mode 100644 public/leaflet-fullscreen/control-added-listener.js diff --git a/public/leaflet-fullscreen/control-added-listener.js b/public/leaflet-fullscreen/control-added-listener.js new file mode 100644 index 0000000..09bd9b5 --- /dev/null +++ b/public/leaflet-fullscreen/control-added-listener.js @@ -0,0 +1,30 @@ +import { DomEvent } from '../leaflet/leaflet-src.esm.js' + +import { setControlTitle } from './set-control-title.js' + +export function controlAddedListener({ + container, + getFullscreenState, + linkAssign, + onLinkClick, + title, +}) { + return function handleControlAdded(map) { + setControlTitle({ + fullscreen: getFullscreenState(), + linkAssign, + title, + }) + + onLinkClick(async function handleLinkClick(e) { + DomEvent.stopPropagation(e) + DomEvent.preventDefault(e) + + await (getFullscreenState() + ? document?.exitFullscreen() + : map.getContainer()?.requestFullscreen()) + }) + + return container + } +} diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index dc08026..2f97d84 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -1,13 +1,12 @@ import { control as leafletControl, - DomEvent, DomUtil, map as leafletMap, } from '../leaflet/leaflet-src.esm.js' +import { controlAddedListener } from './control-added-listener.js' import { joinClassNames } from './join-class-names.js' import { mapLifecycleListener } from './map-lifecycle-listener.js' -import { setControlTitle } from './set-control-title.js' import { useBoolean } from './use-boolean.js' import { useLink } from './use-link.js' @@ -61,25 +60,13 @@ export function fullscreenMap({ linkAssign({ href: '#' }) - control.onAdd = function handleControlAdded(addedMap) { - setControlTitle({ - fullscreen: getFullscreenState(), - linkAssign, - title, - }) - - onLinkClick(async function handleLinkClick(e) { - DomEvent.stopPropagation(e) - DomEvent.preventDefault(e) - - await (getFullscreenState() - ? document?.exitFullscreen() - : addedMap.getContainer()?.requestFullscreen()) - }) - - return container - } - + control.onAdd = controlAddedListener({ + container, + getFullscreenState, + linkAssign, + onLinkClick, + title, + }) control.addTo(map) map.whenReady(handleMapLifecycleChange(true)) From 20e06f87760b245bf175c8fc16125f5aa8018e51 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 19:09:18 -0800 Subject: [PATCH 52/62] `titleOptions` abstraction improves prop-passing to `setControlTitle` --- public/leaflet-fullscreen/control-added-listener.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/public/leaflet-fullscreen/control-added-listener.js b/public/leaflet-fullscreen/control-added-listener.js index 09bd9b5..3e10218 100644 --- a/public/leaflet-fullscreen/control-added-listener.js +++ b/public/leaflet-fullscreen/control-added-listener.js @@ -5,15 +5,13 @@ import { setControlTitle } from './set-control-title.js' export function controlAddedListener({ container, getFullscreenState, - linkAssign, onLinkClick, - title, + ...titleOptions }) { return function handleControlAdded(map) { setControlTitle({ fullscreen: getFullscreenState(), - linkAssign, - title, + ...titleOptions, }) onLinkClick(async function handleLinkClick(e) { From bd94080f61f558da114a15b206f24e352a0b5913 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 19:18:28 -0800 Subject: [PATCH 53/62] `linkAssign` call moved to `useLink` argument --- public/leaflet-fullscreen/fullscreen-map.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index 2f97d84..d01f4de 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -43,7 +43,10 @@ export function fullscreenMap({ useBoolean(false), container = DomUtil.create('div', joinClassNames(containerClassNames)), { assign: linkAssign, onClick: onLinkClick } = useLink( - DomUtil.create('a', joinClassNames(linkClassNames), container), + Object.assign( + DomUtil.create('a', joinClassNames(linkClassNames), container), + { href: '#' }, + ), ), control = leafletControl({ position }), map = leafletMap(id, mapOptions), @@ -58,8 +61,6 @@ export function fullscreenMap({ toggleFullscreenState, }) - linkAssign({ href: '#' }) - control.onAdd = controlAddedListener({ container, getFullscreenState, From 8b004bbe25e7404ce46b33a4add60f0dd9d5ce62 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 19:22:09 -0800 Subject: [PATCH 54/62] consolidated in `state` subdirectory: - useBoolean - useLink --- public/leaflet-fullscreen/fullscreen-map.js | 4 ++-- public/leaflet-fullscreen/{ => state}/use-boolean.js | 0 public/leaflet-fullscreen/{ => state}/use-link.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename public/leaflet-fullscreen/{ => state}/use-boolean.js (100%) rename public/leaflet-fullscreen/{ => state}/use-link.js (76%) diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index d01f4de..b8b3bfc 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -7,8 +7,8 @@ import { import { controlAddedListener } from './control-added-listener.js' import { joinClassNames } from './join-class-names.js' import { mapLifecycleListener } from './map-lifecycle-listener.js' -import { useBoolean } from './use-boolean.js' -import { useLink } from './use-link.js' +import { useBoolean } from './state/use-boolean.js' +import { useLink } from './state/use-link.js' export function fullscreenMap({ fullscreenOptions: { diff --git a/public/leaflet-fullscreen/use-boolean.js b/public/leaflet-fullscreen/state/use-boolean.js similarity index 100% rename from public/leaflet-fullscreen/use-boolean.js rename to public/leaflet-fullscreen/state/use-boolean.js diff --git a/public/leaflet-fullscreen/use-link.js b/public/leaflet-fullscreen/state/use-link.js similarity index 76% rename from public/leaflet-fullscreen/use-link.js rename to public/leaflet-fullscreen/state/use-link.js index 00c6ca1..87fba4c 100644 --- a/public/leaflet-fullscreen/use-link.js +++ b/public/leaflet-fullscreen/state/use-link.js @@ -1,4 +1,4 @@ -import { DomEvent } from '../leaflet/leaflet-src.esm.js' +import { DomEvent } from '../../leaflet/leaflet-src.esm.js' export function useLink(element) { return { From 7409f2f1c61c6e3891716e52eb12bcfec0296994 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 19:28:40 -0800 Subject: [PATCH 55/62] extend `useLink` interface to accept `initialProps` --- public/leaflet-fullscreen/fullscreen-map.js | 10 ++++------ public/leaflet-fullscreen/state/use-link.js | 12 ++++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index b8b3bfc..764ecf1 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -42,12 +42,10 @@ export function fullscreenMap({ const { get: getFullscreenState, toggle: toggleFullscreenState } = useBoolean(false), container = DomUtil.create('div', joinClassNames(containerClassNames)), - { assign: linkAssign, onClick: onLinkClick } = useLink( - Object.assign( - DomUtil.create('a', joinClassNames(linkClassNames), container), - { href: '#' }, - ), - ), + { assign: linkAssign, onClick: onLinkClick } = useLink({ + element: DomUtil.create('a', joinClassNames(linkClassNames), container), + initialProps: { href: '#' }, + }), control = leafletControl({ position }), map = leafletMap(id, mapOptions), handleMapLifecycleChange = (documentFirstReady) => diff --git a/public/leaflet-fullscreen/state/use-link.js b/public/leaflet-fullscreen/state/use-link.js index 87fba4c..fd0e4a7 100644 --- a/public/leaflet-fullscreen/state/use-link.js +++ b/public/leaflet-fullscreen/state/use-link.js @@ -1,10 +1,14 @@ import { DomEvent } from '../../leaflet/leaflet-src.esm.js' -export function useLink(element) { +export function useLink({ element, initialProps }) { + function assign(props) { + Object.assign(element, props) + } + + assign(initialProps) + return { - assign(props) { - Object.assign(element, props) - }, + assign, onClick(handler) { DomEvent.on(element, 'click', handler) }, From 68a0bee1f7c8dea3cfafe8429db8ea39444f7685 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 19:36:28 -0800 Subject: [PATCH 56/62] consolidated in `control` subdirectory: - controlAddedListener - setControlTitle --- .../leaflet-fullscreen/{ => control}/control-added-listener.js | 2 +- public/leaflet-fullscreen/{ => control}/set-control-title.js | 0 public/leaflet-fullscreen/fullscreen-map.js | 2 +- public/leaflet-fullscreen/map-lifecycle-listener.js | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename public/leaflet-fullscreen/{ => control}/control-added-listener.js (90%) rename public/leaflet-fullscreen/{ => control}/set-control-title.js (100%) diff --git a/public/leaflet-fullscreen/control-added-listener.js b/public/leaflet-fullscreen/control/control-added-listener.js similarity index 90% rename from public/leaflet-fullscreen/control-added-listener.js rename to public/leaflet-fullscreen/control/control-added-listener.js index 3e10218..bab5e9b 100644 --- a/public/leaflet-fullscreen/control-added-listener.js +++ b/public/leaflet-fullscreen/control/control-added-listener.js @@ -1,4 +1,4 @@ -import { DomEvent } from '../leaflet/leaflet-src.esm.js' +import { DomEvent } from '../../leaflet/leaflet-src.esm.js' import { setControlTitle } from './set-control-title.js' diff --git a/public/leaflet-fullscreen/set-control-title.js b/public/leaflet-fullscreen/control/set-control-title.js similarity index 100% rename from public/leaflet-fullscreen/set-control-title.js rename to public/leaflet-fullscreen/control/set-control-title.js diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index 764ecf1..199cf3e 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -4,7 +4,7 @@ import { map as leafletMap, } from '../leaflet/leaflet-src.esm.js' -import { controlAddedListener } from './control-added-listener.js' +import { controlAddedListener } from './control/control-added-listener.js' import { joinClassNames } from './join-class-names.js' import { mapLifecycleListener } from './map-lifecycle-listener.js' import { useBoolean } from './state/use-boolean.js' diff --git a/public/leaflet-fullscreen/map-lifecycle-listener.js b/public/leaflet-fullscreen/map-lifecycle-listener.js index df111d9..0944ee2 100644 --- a/public/leaflet-fullscreen/map-lifecycle-listener.js +++ b/public/leaflet-fullscreen/map-lifecycle-listener.js @@ -1,6 +1,6 @@ import { DomEvent, DomUtil } from '../leaflet/leaflet-src.esm.js' -import { setControlTitle } from './set-control-title.js' +import { setControlTitle } from './control/set-control-title.js' export function mapLifecycleListener({ documentFirstReady, From cb32af99fd444a5b552cbad85027ec7368b8fd14 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 19:38:48 -0800 Subject: [PATCH 57/62] consolidated `mapLifecycleListener` in `map` subdirectory --- public/leaflet-fullscreen/fullscreen-map.js | 2 +- .../leaflet-fullscreen/{ => map}/map-lifecycle-listener.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) rename public/leaflet-fullscreen/{ => map}/map-lifecycle-listener.js (84%) diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index 199cf3e..6897245 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -6,7 +6,7 @@ import { import { controlAddedListener } from './control/control-added-listener.js' import { joinClassNames } from './join-class-names.js' -import { mapLifecycleListener } from './map-lifecycle-listener.js' +import { mapLifecycleListener } from './map/map-lifecycle-listener.js' import { useBoolean } from './state/use-boolean.js' import { useLink } from './state/use-link.js' diff --git a/public/leaflet-fullscreen/map-lifecycle-listener.js b/public/leaflet-fullscreen/map/map-lifecycle-listener.js similarity index 84% rename from public/leaflet-fullscreen/map-lifecycle-listener.js rename to public/leaflet-fullscreen/map/map-lifecycle-listener.js index 0944ee2..dbc3c2d 100644 --- a/public/leaflet-fullscreen/map-lifecycle-listener.js +++ b/public/leaflet-fullscreen/map/map-lifecycle-listener.js @@ -1,6 +1,5 @@ -import { DomEvent, DomUtil } from '../leaflet/leaflet-src.esm.js' - -import { setControlTitle } from './control/set-control-title.js' +import { DomEvent, DomUtil } from '../../leaflet/leaflet-src.esm.js' +import { setControlTitle } from '../control/set-control-title.js' export function mapLifecycleListener({ documentFirstReady, From 88dc0f8c1e51c190d1e235a7c6b630e7a58ccc58 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 19:45:33 -0800 Subject: [PATCH 58/62] consolidated `joinClassNames` in `dom-node-class` subdirectory --- .../leaflet-fullscreen/{ => dom-node-class}/join-class-names.js | 0 public/leaflet-fullscreen/fullscreen-map.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename public/leaflet-fullscreen/{ => dom-node-class}/join-class-names.js (100%) diff --git a/public/leaflet-fullscreen/join-class-names.js b/public/leaflet-fullscreen/dom-node-class/join-class-names.js similarity index 100% rename from public/leaflet-fullscreen/join-class-names.js rename to public/leaflet-fullscreen/dom-node-class/join-class-names.js diff --git a/public/leaflet-fullscreen/fullscreen-map.js b/public/leaflet-fullscreen/fullscreen-map.js index 6897245..c85b6e5 100644 --- a/public/leaflet-fullscreen/fullscreen-map.js +++ b/public/leaflet-fullscreen/fullscreen-map.js @@ -5,7 +5,7 @@ import { } from '../leaflet/leaflet-src.esm.js' import { controlAddedListener } from './control/control-added-listener.js' -import { joinClassNames } from './join-class-names.js' +import { joinClassNames } from './dom-node-class/join-class-names.js' import { mapLifecycleListener } from './map/map-lifecycle-listener.js' import { useBoolean } from './state/use-boolean.js' import { useLink } from './state/use-link.js' From 639a5a40bfd5199373620db381f9abe421a1a180 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 19:53:56 -0800 Subject: [PATCH 59/62] npm update `puppeteer@^23.8.0` --- package-lock.json | 32 ++++++++++++++++---------------- package.json | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index fae7af0..550cdff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ "jest-environment-puppeteer": "^10.1.4", "jest-puppeteer": "^10.1.4", "prettier": "3.3.3", - "puppeteer": "^23.7.1", + "puppeteer": "^23.8.0", "rollup": "^4.25.0", "rollup-plugin-modify": "^3.0.0", "rollup-plugin-styles": "^4.0.0", @@ -4655,9 +4655,9 @@ } }, "node_modules/devtools-protocol": { - "version": "0.0.1354347", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1354347.tgz", - "integrity": "sha512-BlmkSqV0V84E2WnEnoPnwyix57rQxAM5SKJjf4TbYOCGLAWtz8CDH8RIaGOjPgPCXo2Mce3kxSY497OySidY3Q==", + "version": "0.0.1367902", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1367902.tgz", + "integrity": "sha512-XxtPuC3PGakY6PD7dG66/o8KwJ/LkH2/EKe19Dcw58w53dv4/vSQEkn/SzuyhHE2q4zPgCkxQBxus3VV4ql+Pg==", "dev": true, "license": "BSD-3-Clause" }, @@ -11337,9 +11337,9 @@ } }, "node_modules/puppeteer": { - "version": "23.7.1", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-23.7.1.tgz", - "integrity": "sha512-jS6XehagMvxQ12etwY/4EOYZ0Sm8GAsrtGhdQn4AqpJAyHc3RYl7tGd4QYh/MmShDw8sF9FWYQqGidhoXaqokQ==", + "version": "23.8.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-23.8.0.tgz", + "integrity": "sha512-MFWDMWoCcOpwNwQIjA9gPKWrEUbj8bLCzkK56w5lZPMUT6wK4FfpgOEPxKffVmXEMYMZzgcjxzqy15b/Q1ibaw==", "dev": true, "hasInstallScript": true, "license": "Apache-2.0", @@ -11347,8 +11347,8 @@ "@puppeteer/browsers": "2.4.1", "chromium-bidi": "0.8.0", "cosmiconfig": "^9.0.0", - "devtools-protocol": "0.0.1354347", - "puppeteer-core": "23.7.1", + "devtools-protocol": "0.0.1367902", + "puppeteer-core": "23.8.0", "typed-query-selector": "^2.12.0" }, "bin": { @@ -11359,16 +11359,16 @@ } }, "node_modules/puppeteer-core": { - "version": "23.7.1", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-23.7.1.tgz", - "integrity": "sha512-Om/qCZhd+HLoAr7GltrRAZpS3uOXwHu7tXAoDbNcJADHjG2zeAlDArgyIPXYGG4QB/EQUHk13Q6RklNxGM73Pg==", + "version": "23.8.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-23.8.0.tgz", + "integrity": "sha512-c2ymGN2M//We7pC+JhP2dE/g4+qnT89BO+EMSZyJmecN3DN6RNqErA7eH7DrWoNIcU75r2nP4VHa4pswAL6NVg==", "dev": true, "license": "Apache-2.0", "dependencies": { "@puppeteer/browsers": "2.4.1", "chromium-bidi": "0.8.0", "debug": "^4.3.7", - "devtools-protocol": "0.0.1354347", + "devtools-protocol": "0.0.1367902", "typed-query-selector": "^2.12.0", "ws": "^8.18.0" }, @@ -12662,9 +12662,9 @@ } }, "node_modules/streamx": { - "version": "2.20.1", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.20.1.tgz", - "integrity": "sha512-uTa0mU6WUC65iUvzKH4X9hEdvSW7rbPxPtwfWiLMSj3qTdQbAiUboZTxauKfpFuGIGa1C2BYijZ7wgdUXICJhA==", + "version": "2.20.2", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.20.2.tgz", + "integrity": "sha512-aDGDLU+j9tJcUdPGOaHmVF1u/hhI+CsGkT02V3OKlHDV7IukOI+nTWAGkiZEKCO35rWN1wIr4tS7YFr1f4qSvA==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 4204966..024befa 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "jest-environment-puppeteer": "^10.1.4", "jest-puppeteer": "^10.1.4", "prettier": "3.3.3", - "puppeteer": "^23.7.1", + "puppeteer": "^23.8.0", "rollup": "^4.25.0", "rollup-plugin-modify": "^3.0.0", "rollup-plugin-styles": "^4.0.0", From 7dbfcd2f02f4fca6c20b343d89e76bddcd850712 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 19:55:28 -0800 Subject: [PATCH 60/62] npm update `rollup@^4.26.0` --- package-lock.json | 152 +++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 77 insertions(+), 77 deletions(-) diff --git a/package-lock.json b/package-lock.json index 550cdff..31c4d90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,7 +56,7 @@ "jest-puppeteer": "^10.1.4", "prettier": "3.3.3", "puppeteer": "^23.8.0", - "rollup": "^4.25.0", + "rollup": "^4.26.0", "rollup-plugin-modify": "^3.0.0", "rollup-plugin-styles": "^4.0.0", "shx": "^0.3.4", @@ -1864,9 +1864,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.25.0.tgz", - "integrity": "sha512-CC/ZqFZwlAIbU1wUPisHyV/XRc5RydFrNLtgl3dGYskdwPZdt4HERtKm50a/+DtTlKeCq9IXFEWR+P6blwjqBA==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.26.0.tgz", + "integrity": "sha512-gJNwtPDGEaOEgejbaseY6xMFu+CPltsc8/T+diUTTbOQLqD+bnrJq9ulH6WD69TqwqWmrfRAtUv30cCFZlbGTQ==", "cpu": [ "arm" ], @@ -1878,9 +1878,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.25.0.tgz", - "integrity": "sha512-/Y76tmLGUJqVBXXCfVS8Q8FJqYGhgH4wl4qTA24E9v/IJM0XvJCGQVSW1QZ4J+VURO9h8YCa28sTFacZXwK7Rg==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.26.0.tgz", + "integrity": "sha512-YJa5Gy8mEZgz5JquFruhJODMq3lTHWLm1fOy+HIANquLzfIOzE9RA5ie3JjCdVb9r46qfAQY/l947V0zfGJ0OQ==", "cpu": [ "arm64" ], @@ -1892,9 +1892,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.25.0.tgz", - "integrity": "sha512-YVT6L3UrKTlC0FpCZd0MGA7NVdp7YNaEqkENbWQ7AOVOqd/7VzyHpgIpc1mIaxRAo1ZsJRH45fq8j4N63I/vvg==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.26.0.tgz", + "integrity": "sha512-ErTASs8YKbqTBoPLp/kA1B1Um5YSom8QAc4rKhg7b9tyyVqDBlQxy7Bf2wW7yIlPGPg2UODDQcbkTlruPzDosw==", "cpu": [ "arm64" ], @@ -1906,9 +1906,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.25.0.tgz", - "integrity": "sha512-ZRL+gexs3+ZmmWmGKEU43Bdn67kWnMeWXLFhcVv5Un8FQcx38yulHBA7XR2+KQdYIOtD0yZDWBCudmfj6lQJoA==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.26.0.tgz", + "integrity": "sha512-wbgkYDHcdWW+NqP2mnf2NOuEbOLzDblalrOWcPyY6+BRbVhliavon15UploG7PpBRQ2bZJnbmh8o3yLoBvDIHA==", "cpu": [ "x64" ], @@ -1920,9 +1920,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.25.0.tgz", - "integrity": "sha512-xpEIXhiP27EAylEpreCozozsxWQ2TJbOLSivGfXhU4G1TBVEYtUPi2pOZBnvGXHyOdLAUUhPnJzH3ah5cqF01g==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.26.0.tgz", + "integrity": "sha512-Y9vpjfp9CDkAG4q/uwuhZk96LP11fBz/bYdyg9oaHYhtGZp7NrbkQrj/66DYMMP2Yo/QPAsVHkV891KyO52fhg==", "cpu": [ "arm64" ], @@ -1934,9 +1934,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.25.0.tgz", - "integrity": "sha512-sC5FsmZGlJv5dOcURrsnIK7ngc3Kirnx3as2XU9uER+zjfyqIjdcMVgzy4cOawhsssqzoAX19qmxgJ8a14Qrqw==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.26.0.tgz", + "integrity": "sha512-A/jvfCZ55EYPsqeaAt/yDAG4q5tt1ZboWMHEvKAH9Zl92DWvMIbnZe/f/eOXze65aJaaKbL+YeM0Hz4kLQvdwg==", "cpu": [ "x64" ], @@ -1948,9 +1948,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.25.0.tgz", - "integrity": "sha512-uD/dbLSs1BEPzg564TpRAQ/YvTnCds2XxyOndAO8nJhaQcqQGFgv/DAVko/ZHap3boCvxnzYMa3mTkV/B/3SWA==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.26.0.tgz", + "integrity": "sha512-paHF1bMXKDuizaMODm2bBTjRiHxESWiIyIdMugKeLnjuS1TCS54MF5+Y5Dx8Ui/1RBPVRE09i5OUlaLnv8OGnA==", "cpu": [ "arm" ], @@ -1962,9 +1962,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.25.0.tgz", - "integrity": "sha512-ZVt/XkrDlQWegDWrwyC3l0OfAF7yeJUF4fq5RMS07YM72BlSfn2fQQ6lPyBNjt+YbczMguPiJoCfaQC2dnflpQ==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.26.0.tgz", + "integrity": "sha512-cwxiHZU1GAs+TMxvgPfUDtVZjdBdTsQwVnNlzRXC5QzIJ6nhfB4I1ahKoe9yPmoaA/Vhf7m9dB1chGPpDRdGXg==", "cpu": [ "arm" ], @@ -1976,9 +1976,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.25.0.tgz", - "integrity": "sha512-qboZ+T0gHAW2kkSDPHxu7quaFaaBlynODXpBVnPxUgvWYaE84xgCKAPEYE+fSMd3Zv5PyFZR+L0tCdYCMAtG0A==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.26.0.tgz", + "integrity": "sha512-4daeEUQutGRCW/9zEo8JtdAgtJ1q2g5oHaoQaZbMSKaIWKDQwQ3Yx0/3jJNmpzrsScIPtx/V+1AfibLisb3AMQ==", "cpu": [ "arm64" ], @@ -1990,9 +1990,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.25.0.tgz", - "integrity": "sha512-ndWTSEmAaKr88dBuogGH2NZaxe7u2rDoArsejNslugHZ+r44NfWiwjzizVS1nUOHo+n1Z6qV3X60rqE/HlISgw==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.26.0.tgz", + "integrity": "sha512-eGkX7zzkNxvvS05ROzJ/cO/AKqNvR/7t1jA3VZDi2vRniLKwAWxUr85fH3NsvtxU5vnUUKFHKh8flIBdlo2b3Q==", "cpu": [ "arm64" ], @@ -2004,9 +2004,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.25.0.tgz", - "integrity": "sha512-BVSQvVa2v5hKwJSy6X7W1fjDex6yZnNKy3Kx1JGimccHft6HV0THTwNtC2zawtNXKUu+S5CjXslilYdKBAadzA==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.26.0.tgz", + "integrity": "sha512-Odp/lgHbW/mAqw/pU21goo5ruWsytP7/HCC/liOt0zcGG0llYWKrd10k9Fj0pdj3prQ63N5yQLCLiE7HTX+MYw==", "cpu": [ "ppc64" ], @@ -2018,9 +2018,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.25.0.tgz", - "integrity": "sha512-G4hTREQrIdeV0PE2JruzI+vXdRnaK1pg64hemHq2v5fhv8C7WjVaeXc9P5i4Q5UC06d/L+zA0mszYIKl+wY8oA==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.26.0.tgz", + "integrity": "sha512-MBR2ZhCTzUgVD0OJdTzNeF4+zsVogIR1U/FsyuFerwcqjZGvg2nYe24SAHp8O5sN8ZkRVbHwlYeHqcSQ8tcYew==", "cpu": [ "riscv64" ], @@ -2032,9 +2032,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.25.0.tgz", - "integrity": "sha512-9T/w0kQ+upxdkFL9zPVB6zy9vWW1deA3g8IauJxojN4bnz5FwSsUAD034KpXIVX5j5p/rn6XqumBMxfRkcHapQ==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.26.0.tgz", + "integrity": "sha512-YYcg8MkbN17fMbRMZuxwmxWqsmQufh3ZJFxFGoHjrE7bv0X+T6l3glcdzd7IKLiwhT+PZOJCblpnNlz1/C3kGQ==", "cpu": [ "s390x" ], @@ -2046,9 +2046,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.25.0.tgz", - "integrity": "sha512-ThcnU0EcMDn+J4B9LD++OgBYxZusuA7iemIIiz5yzEcFg04VZFzdFjuwPdlURmYPZw+fgVrFzj4CA64jSTG4Ig==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.26.0.tgz", + "integrity": "sha512-ZuwpfjCwjPkAOxpjAEjabg6LRSfL7cAJb6gSQGZYjGhadlzKKywDkCUnJ+KEfrNY1jH5EEoSIKLCb572jSiglA==", "cpu": [ "x64" ], @@ -2060,9 +2060,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.25.0.tgz", - "integrity": "sha512-zx71aY2oQxGxAT1JShfhNG79PnjYhMC6voAjzpu/xmMjDnKNf6Nl/xv7YaB/9SIa9jDYf8RBPWEnjcdlhlv1rQ==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.26.0.tgz", + "integrity": "sha512-+HJD2lFS86qkeF8kNu0kALtifMpPCZU80HvwztIKnYwym3KnA1os6nsX4BGSTLtS2QVAGG1P3guRgsYyMA0Yhg==", "cpu": [ "x64" ], @@ -2074,9 +2074,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.25.0.tgz", - "integrity": "sha512-JT8tcjNocMs4CylWY/CxVLnv8e1lE7ff1fi6kbGocWwxDq9pj30IJ28Peb+Y8yiPNSF28oad42ApJB8oUkwGww==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.26.0.tgz", + "integrity": "sha512-WUQzVFWPSw2uJzX4j6YEbMAiLbs0BUysgysh8s817doAYhR5ybqTI1wtKARQKo6cGop3pHnrUJPFCsXdoFaimQ==", "cpu": [ "arm64" ], @@ -2088,9 +2088,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.25.0.tgz", - "integrity": "sha512-dRLjLsO3dNOfSN6tjyVlG+Msm4IiZnGkuZ7G5NmpzwF9oOc582FZG05+UdfTbz5Jd4buK/wMb6UeHFhG18+OEg==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.26.0.tgz", + "integrity": "sha512-D4CxkazFKBfN1akAIY6ieyOqzoOoBV1OICxgUblWxff/pSjCA2khXlASUx7mK6W1oP4McqhgcCsu6QaLj3WMWg==", "cpu": [ "ia32" ], @@ -2102,9 +2102,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.25.0.tgz", - "integrity": "sha512-/RqrIFtLB926frMhZD0a5oDa4eFIbyNEwLLloMTEjmqfwZWXywwVVOVmwTsuyhC9HKkVEZcOOi+KV4U9wmOdlg==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.26.0.tgz", + "integrity": "sha512-2x8MO1rm4PGEP0xWbubJW5RtbNLk3puzAMaLQd3B3JHVw4KcHlmXcO+Wewx9zCoo7EUFiMlu/aZbCJ7VjMzAag==", "cpu": [ "x64" ], @@ -11867,9 +11867,9 @@ } }, "node_modules/rollup": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.25.0.tgz", - "integrity": "sha512-uVbClXmR6wvx5R1M3Od4utyLUxrmOcEm3pAtMphn73Apq19PDtHpgZoEvqH2YnnaNUuvKmg2DgRd2Sqv+odyqg==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.26.0.tgz", + "integrity": "sha512-ilcl12hnWonG8f+NxU6BlgysVA0gvY2l8N0R84S1HcINbW20bvwuCngJkkInV6LXhwRpucsW5k1ovDwEdBVrNg==", "dev": true, "license": "MIT", "dependencies": { @@ -11883,24 +11883,24 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.25.0", - "@rollup/rollup-android-arm64": "4.25.0", - "@rollup/rollup-darwin-arm64": "4.25.0", - "@rollup/rollup-darwin-x64": "4.25.0", - "@rollup/rollup-freebsd-arm64": "4.25.0", - "@rollup/rollup-freebsd-x64": "4.25.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.25.0", - "@rollup/rollup-linux-arm-musleabihf": "4.25.0", - "@rollup/rollup-linux-arm64-gnu": "4.25.0", - "@rollup/rollup-linux-arm64-musl": "4.25.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.25.0", - "@rollup/rollup-linux-riscv64-gnu": "4.25.0", - "@rollup/rollup-linux-s390x-gnu": "4.25.0", - "@rollup/rollup-linux-x64-gnu": "4.25.0", - "@rollup/rollup-linux-x64-musl": "4.25.0", - "@rollup/rollup-win32-arm64-msvc": "4.25.0", - "@rollup/rollup-win32-ia32-msvc": "4.25.0", - "@rollup/rollup-win32-x64-msvc": "4.25.0", + "@rollup/rollup-android-arm-eabi": "4.26.0", + "@rollup/rollup-android-arm64": "4.26.0", + "@rollup/rollup-darwin-arm64": "4.26.0", + "@rollup/rollup-darwin-x64": "4.26.0", + "@rollup/rollup-freebsd-arm64": "4.26.0", + "@rollup/rollup-freebsd-x64": "4.26.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.26.0", + "@rollup/rollup-linux-arm-musleabihf": "4.26.0", + "@rollup/rollup-linux-arm64-gnu": "4.26.0", + "@rollup/rollup-linux-arm64-musl": "4.26.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.26.0", + "@rollup/rollup-linux-riscv64-gnu": "4.26.0", + "@rollup/rollup-linux-s390x-gnu": "4.26.0", + "@rollup/rollup-linux-x64-gnu": "4.26.0", + "@rollup/rollup-linux-x64-musl": "4.26.0", + "@rollup/rollup-win32-arm64-msvc": "4.26.0", + "@rollup/rollup-win32-ia32-msvc": "4.26.0", + "@rollup/rollup-win32-x64-msvc": "4.26.0", "fsevents": "~2.3.2" } }, diff --git a/package.json b/package.json index 024befa..70bc855 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "jest-puppeteer": "^10.1.4", "prettier": "3.3.3", "puppeteer": "^23.8.0", - "rollup": "^4.25.0", + "rollup": "^4.26.0", "rollup-plugin-modify": "^3.0.0", "rollup-plugin-styles": "^4.0.0", "shx": "^0.3.4", From ff69cd441241775752b853d8a019e5f686a8897b Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 19:58:40 -0800 Subject: [PATCH 61/62] update npm lockfile --- package-lock.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 31c4d90..e5a0d00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3877,9 +3877,9 @@ } }, "node_modules/ci-info": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.0.0.tgz", - "integrity": "sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.1.0.tgz", + "integrity": "sha512-HutrvTNsF48wnxkzERIXOe5/mlcfFcbfCmwcg6CJnizbSue78AbDt+1cgl26zwn61WFxhcPykPfZrbqjGmBb4A==", "dev": true, "funding": [ { @@ -4785,9 +4785,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.56", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.56.tgz", - "integrity": "sha512-7lXb9dAvimCFdvUMTyucD4mnIndt/xhRKFAlky0CyFogdnNmdPQNoHI23msF/2V4mpTxMzgMdjK4+YRlFlRQZw==", + "version": "1.5.57", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.57.tgz", + "integrity": "sha512-xS65H/tqgOwUBa5UmOuNSLuslDo7zho0y/lgQw35pnrqiZh7UOWHCeL/Bt6noJATbA6tpQJGCifsFsIRZj1Fqg==", "dev": true, "license": "ISC" }, @@ -4865,9 +4865,9 @@ } }, "node_modules/es-abstract": { - "version": "1.23.3", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", - "integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==", + "version": "1.23.4", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.4.tgz", + "integrity": "sha512-HR1gxH5OaiN7XH7uiWH0RLw0RcFySiSoW1ctxmD1ahTw3uGBtkmm/ng0tDU1OtYx5OK6EOL5Y6O21cDflG3Jcg==", "dev": true, "license": "MIT", "dependencies": { @@ -4886,7 +4886,7 @@ "function.prototype.name": "^1.1.6", "get-intrinsic": "^1.2.4", "get-symbol-description": "^1.0.2", - "globalthis": "^1.0.3", + "globalthis": "^1.0.4", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.2", "has-proto": "^1.0.3", @@ -4902,10 +4902,10 @@ "is-string": "^1.0.7", "is-typed-array": "^1.1.13", "is-weakref": "^1.0.2", - "object-inspect": "^1.13.1", + "object-inspect": "^1.13.3", "object-keys": "^1.1.1", "object.assign": "^4.1.5", - "regexp.prototype.flags": "^1.5.2", + "regexp.prototype.flags": "^1.5.3", "safe-array-concat": "^1.1.2", "safe-regex-test": "^1.0.3", "string.prototype.trim": "^1.2.9", From 8495368390223990e595d1d86dbaae3cecccf926 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 13 Nov 2024 20:03:01 -0800 Subject: [PATCH 62/62] 0.0.80 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e5a0d00..1ab5818 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@stassi/leaf", - "version": "0.0.79", + "version": "0.0.80", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@stassi/leaf", - "version": "0.0.79", + "version": "0.0.80", "cpu": [ "arm64", "x64" diff --git a/package.json b/package.json index 70bc855..979cd2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@stassi/leaf", - "version": "0.0.79", + "version": "0.0.80", "description": "Leaflet adapter.", "keywords": [ "cartography",