@mattilsynet/design 2.2.28 → 2.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mtds/alert/alert.js +8 -9
- package/mtds/alert/alert.js.map +1 -1
- package/mtds/analytics/analytics.js +104 -165
- package/mtds/analytics/analytics.js.map +1 -1
- package/mtds/app/app-observer.js +28 -74
- package/mtds/app/app-observer.js.map +1 -1
- package/mtds/app/app-toggle.js +26 -16
- package/mtds/app/app-toggle.js.map +1 -1
- package/mtds/app/app-toggle2.js +10 -4
- package/mtds/app/app-toggle2.js.map +1 -1
- package/mtds/app/app.js +32 -36
- package/mtds/app/app.js.map +1 -1
- package/mtds/atlas/atlas-element.d.ts +27 -0
- package/mtds/atlas/atlas-element.js +63 -84
- package/mtds/atlas/atlas-element.js.map +1 -1
- package/mtds/atlas/atlas-marker.js +28 -48
- package/mtds/atlas/atlas-marker.js.map +1 -1
- package/mtds/atlas/atlas-matgeo.d.ts +3 -8
- package/mtds/atlas/atlas-matgeo.js +36 -66
- package/mtds/atlas/atlas-matgeo.js.map +1 -1
- package/mtds/atlas/atlas-wms.js +11 -21
- package/mtds/atlas/atlas-wms.js.map +1 -1
- package/mtds/atlas/atlas.css.js +2 -2
- package/mtds/atlas/atlas.css.js.map +1 -1
- package/mtds/atlas/atlas.js +23 -23
- package/mtds/atlas/atlas.js.map +1 -1
- package/mtds/atlas/atlas.stories.d.ts +1 -0
- package/mtds/atlas/cluster.js +697 -1576
- package/mtds/atlas/cluster.js.map +1 -1
- package/mtds/atlas.iife.js +4 -4
- package/mtds/atlas.js +11 -10
- package/mtds/avatar/avatar.js +8 -8
- package/mtds/avatar/avatar.js.map +1 -1
- package/mtds/badge/badge.js +7 -7
- package/mtds/badge/badge.js.map +1 -1
- package/mtds/breadcrumbs/breadcrumbs-observer.js +9 -10
- package/mtds/breadcrumbs/breadcrumbs-observer.js.map +1 -1
- package/mtds/breadcrumbs/breadcrumbs.js +13 -14
- package/mtds/breadcrumbs/breadcrumbs.js.map +1 -1
- package/mtds/button/button.js +14 -16
- package/mtds/button/button.js.map +1 -1
- package/mtds/card/card.js +12 -14
- package/mtds/card/card.js.map +1 -1
- package/mtds/chart/chart-axis.js +15 -27
- package/mtds/chart/chart-axis.js.map +1 -1
- package/mtds/chart/chart-bars.js +13 -15
- package/mtds/chart/chart-bars.js.map +1 -1
- package/mtds/chart/chart-element.js +48 -83
- package/mtds/chart/chart-element.js.map +1 -1
- package/mtds/chart/chart-lines.js +32 -54
- package/mtds/chart/chart-lines.js.map +1 -1
- package/mtds/chart/chart-pies.js +14 -34
- package/mtds/chart/chart-pies.js.map +1 -1
- package/mtds/chart/chart.css.js +2 -2
- package/mtds/chart/chart.css.js.map +1 -1
- package/mtds/chart/chart.js +12 -12
- package/mtds/chart/chart.js.map +1 -1
- package/mtds/chip/chip.js +8 -8
- package/mtds/chip/chip.js.map +1 -1
- package/mtds/chip/chip.stories.d.ts +1 -0
- package/mtds/details/details.js +12 -14
- package/mtds/details/details.js.map +1 -1
- package/mtds/dialog/dialog-observer.js +22 -35
- package/mtds/dialog/dialog-observer.js.map +1 -1
- package/mtds/dialog/dialog.js +12 -12
- package/mtds/dialog/dialog.js.map +1 -1
- package/mtds/divider/divider.js +10 -10
- package/mtds/divider/divider.js.map +1 -1
- package/mtds/errorsummary/errorsummary-observer.js +8 -11
- package/mtds/errorsummary/errorsummary-observer.js.map +1 -1
- package/mtds/errorsummary/errorsummary.js +11 -11
- package/mtds/errorsummary/errorsummary.js.map +1 -1
- package/mtds/external/@turf/boolean-point-in-polygon/dist/esm/index.js +19 -27
- package/mtds/external/@turf/boolean-point-in-polygon/dist/esm/index.js.map +1 -1
- package/mtds/external/@turf/helpers/dist/esm/index.js +16 -29
- package/mtds/external/@turf/helpers/dist/esm/index.js.map +1 -1
- package/mtds/external/@turf/invariant/dist/esm/index.js +13 -20
- package/mtds/external/@turf/invariant/dist/esm/index.js.map +1 -1
- package/mtds/external/leaflet/dist/leaflet-src.js +3096 -6004
- package/mtds/external/leaflet/dist/leaflet-src.js.map +1 -1
- package/mtds/external/leaflet/dist/leaflet.css.js +2 -2
- package/mtds/external/leaflet/dist/leaflet.css.js.map +1 -1
- package/mtds/external/point-in-polygon-hao/dist/esm/index.js +16 -46
- package/mtds/external/point-in-polygon-hao/dist/esm/index.js.map +1 -1
- package/mtds/external/robust-predicates/esm/orient2d.js +19 -163
- package/mtds/external/robust-predicates/esm/orient2d.js.map +1 -1
- package/mtds/external/robust-predicates/esm/util.js +25 -85
- package/mtds/external/robust-predicates/esm/util.js.map +1 -1
- package/mtds/field/field-observer.js +53 -119
- package/mtds/field/field-observer.js.map +1 -1
- package/mtds/field/field.d.ts +0 -1
- package/mtds/field/field.js +145 -177
- package/mtds/field/field.js.map +1 -1
- package/mtds/fieldset/fieldset-observer.js +14 -24
- package/mtds/fieldset/fieldset-observer.js.map +1 -1
- package/mtds/fieldset/fieldset.d.ts +3 -9
- package/mtds/fieldset/fieldset.js +20 -23
- package/mtds/fieldset/fieldset.js.map +1 -1
- package/mtds/fileupload/fileupload.js +8 -9
- package/mtds/fileupload/fileupload.js.map +1 -1
- package/mtds/fileupload/fileupload.stories.d.ts +1 -0
- package/mtds/helptext/helptext.js +15 -15
- package/mtds/helptext/helptext.js.map +1 -1
- package/mtds/illustrations/index.json +2 -2
- package/mtds/index.iife.js +15 -15
- package/mtds/index.js +27 -26
- package/mtds/index.js.map +1 -1
- package/mtds/input/input.js +28 -30
- package/mtds/input/input.js.map +1 -1
- package/mtds/law/law-helper.js +77 -143
- package/mtds/law/law-helper.js.map +1 -1
- package/mtds/law/law.js +6 -6
- package/mtds/law/law.js.map +1 -1
- package/mtds/layout/layout.js +10 -13
- package/mtds/layout/layout.js.map +1 -1
- package/mtds/link/link.js +7 -8
- package/mtds/link/link.js.map +1 -1
- package/mtds/logo/logo-observer.js +12 -18
- package/mtds/logo/logo-observer.js.map +1 -1
- package/mtds/logo/logo.js +8 -8
- package/mtds/logo/logo.js.map +1 -1
- package/mtds/package.json.js +2 -2
- package/mtds/pagination/pagination-helper.js +11 -17
- package/mtds/pagination/pagination-helper.js.map +1 -1
- package/mtds/pagination/pagination.js +30 -30
- package/mtds/pagination/pagination.js.map +1 -1
- package/mtds/popover/popover-observer.js +33 -45
- package/mtds/popover/popover-observer.js.map +1 -1
- package/mtds/popover/popover.js +12 -13
- package/mtds/popover/popover.js.map +1 -1
- package/mtds/progress/progress.js +8 -8
- package/mtds/progress/progress.js.map +1 -1
- package/mtds/react-atlas.js +13 -12
- package/mtds/react-types.d.ts +1 -0
- package/mtds/react.js +80 -80
- package/mtds/skeleton/skeleton.js +8 -8
- package/mtds/skeleton/skeleton.js.map +1 -1
- package/mtds/spinner/spinner.js +8 -8
- package/mtds/spinner/spinner.js.map +1 -1
- package/mtds/steps/steps.js +7 -7
- package/mtds/steps/steps.js.map +1 -1
- package/mtds/styles.css +1 -4591
- package/mtds/styles.json +43 -43
- package/mtds/styles.module.css.js +112 -167
- package/mtds/styles.module.css.js.map +1 -1
- package/mtds/table/table-observer.js +19 -22
- package/mtds/table/table-observer.js.map +1 -1
- package/mtds/table/table.d.ts +7 -0
- package/mtds/table/table.js +43 -18
- package/mtds/table/table.js.map +1 -1
- package/mtds/tabs/tabs.js +21 -25
- package/mtds/tabs/tabs.js.map +1 -1
- package/mtds/tag/tag.js +8 -8
- package/mtds/tag/tag.js.map +1 -1
- package/mtds/tailwind.css +6 -25
- package/mtds/toast/toast-helper.js +20 -35
- package/mtds/toast/toast-helper.js.map +1 -1
- package/mtds/toast/toast-observer.js +15 -30
- package/mtds/toast/toast-observer.js.map +1 -1
- package/mtds/toast/toast.js +37 -45
- package/mtds/toast/toast.js.map +1 -1
- package/mtds/togglegroup/togglegroup-observer.js +10 -15
- package/mtds/togglegroup/togglegroup-observer.js.map +1 -1
- package/mtds/togglegroup/togglegroup.js +24 -21
- package/mtds/togglegroup/togglegroup.js.map +1 -1
- package/mtds/tooltip/tooltip-observer.js +32 -48
- package/mtds/tooltip/tooltip-observer.js.map +1 -1
- package/mtds/typography/typography.js +19 -28
- package/mtds/typography/typography.js.map +1 -1
- package/mtds/utils.js +89 -129
- package/mtds/utils.js.map +1 -1
- package/mtds/validation/validation-observer.d.ts +1 -0
- package/mtds/validation/validation-observer.js +31 -0
- package/mtds/validation/validation-observer.js.map +1 -0
- package/mtds/validation/validation.js +12 -12
- package/mtds/validation/validation.js.map +1 -1
- package/package.json +8 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atlas-marker.js","sources":["../../designsystem/atlas/atlas-marker.ts"],"sourcesContent":["import L from \"leaflet\";\nimport { attr, defineElement, MTDSElement, off, on, tag } from \"../utils\";\nimport type { MTDSAtlasElement } from \"./atlas-element\";\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t\"mtds-atlas-marker\": MTDSAtlasMarkerElement;\n\t}\n}\n\nlet SLOT = 0;\nexport class MTDSAtlasMarkerElement extends MTDSElement {\n\tatlas?: MTDSAtlasElement;\n\tmarker?: L.Marker;\n\n\tstatic get observedAttributes() {\n\t\treturn [\"hidden\", \"draggable\", \"data-latlng\", \"popovertarget\"]; // Using ES2015 syntax for backwards compatibility\n\t}\n\tconnectedCallback() {\n\t\tqueueMicrotask(() => {\n\t\t\tconst html = tag(\"slot\", { name: `${++SLOT}` });\n\t\t\tconst icon = new L.DivIcon({ html, iconSize: [0, 0] });\n\t\t\tthis.atlas = this.closest<MTDSAtlasElement>(\"mtds-atlas\") || undefined;\n\t\t\tthis.marker = new L.Marker(this.#parseLatLng(), {\n\t\t\t\tdraggable: this.draggable,\n\t\t\t\tkeyboard: false,\n\t\t\t\ticon,\n\t\t\t});\n\t\t\tthis.marker.bindPopup(() => `#${attr(this, \"popovertarget\")}`);\n\t\t\tthis.marker.on(\"dragend\", this.#handleDragEnd);\n\n\t\t\ton(this, \"click,keydown\", this); // Listen for clicks to toggle popup\n\t\t\tattr(this, \"slot\", `${SLOT}`); // Link slot to marker icon\n\t\t\tattr(this, \"role\", \"button\");\n\t\t\tattr(this, \"tabindex\", \"0\");\n\t\t\tthis.attributeChangedCallback(\"hidden\"); // Maybe add to map\n\t\t}); // Let the atlas parent initialize first\n\t}\n\tattributeChangedCallback(name: string) {\n\t\tconst mark = this.marker;\n\t\tconst cluster = this.atlas?.cluster;\n\t\tif (name === \"popovertarget\") mark?.getPopup()?.update();\n\t\tif (name === \"data-latlng\") {\n\t\t\tconst latlng = this.#parseLatLng();\n\t\t\tmark?.getLatLng().equals(latlng) || mark?.setLatLng(latlng);\n\t\t}\n\t\tif (name === \"draggable\")\n\t\t\tmark?.dragging?.[this.draggable ? \"enable\" : \"disable\"]();\n\t\tif (name === \"hidden\" && mark && cluster)\n\t\t\tcluster[this.hidden ? \"removeLayer\" : \"addLayer\"](mark);\n\t}\n\tdisconnectedCallback() {\n\t\toff(this, \"click,keydown\", this);\n\t\tthis.marker?.unbindPopup().off(\"dragend\", this.#handleDragEnd).remove();\n\t\tthis.marker = this.atlas = undefined;\n\t}\n\thandleEvent(event: KeyboardEvent) {\n\t\tif (event.type === \"click\") return this.marker?.fire(\"click\"); //this.atlas?.togglePopup(this.marker, this);\n\t\tif (event.key === \" \") event.preventDefault(); // Prevent page scroll on space key\n\t\tif (event.key === \" \" || event.key === \"Enter\") this.click(); // Forward keyvoard to click for accessibility\n\t}\n\tget latlng() {\n\t\treturn attr(this, \"data-latlng\") || \"\";\n\t}\n\tset latlng(latlng: string) {\n\t\tattr(this, \"data-latlng\", latlng);\n\t}\n\t#parseLatLng() {\n\t\treturn this.latlng?.split(\",\").map(parseFloat) as L.LatLngTuple;\n\t}\n\t#handleDragEnd(detail: L.LeafletEvent) {\n\t\tconst slot = detail.target._icon\n\t\t\t?.firstElementChild as HTMLSlotElement | null;\n\t\tconst self =\n\t\t\tslot?.assignedElements?.()?.[0] as MTDSAtlasMarkerElement | null;\n\t\tconst { lat, lng } = detail.target.getLatLng(); // Using L.Marker.getLatLng() to get position also when in spiderified cluster\n\t\tif (self) self.latlng = `${lat},${lng}`;\n\t\tself?.dispatchEvent(new CustomEvent(\"dragend\", { detail, bubbles: true }));\n\t}\n}\n\ndefineElement(\"mtds-atlas-marker\", MTDSAtlasMarkerElement);\n"],"names":[],"mappings":";;AAUA,
|
|
1
|
+
{"version":3,"file":"atlas-marker.js","sources":["../../designsystem/atlas/atlas-marker.ts"],"sourcesContent":["import L from \"leaflet\";\nimport { attr, defineElement, MTDSElement, off, on, tag } from \"../utils\";\nimport type { MTDSAtlasElement } from \"./atlas-element\";\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t\"mtds-atlas-marker\": MTDSAtlasMarkerElement;\n\t}\n}\n\nlet SLOT = 0;\nexport class MTDSAtlasMarkerElement extends MTDSElement {\n\tatlas?: MTDSAtlasElement;\n\tmarker?: L.Marker;\n\n\tstatic get observedAttributes() {\n\t\treturn [\"hidden\", \"draggable\", \"data-latlng\", \"popovertarget\"]; // Using ES2015 syntax for backwards compatibility\n\t}\n\tconnectedCallback() {\n\t\tqueueMicrotask(() => {\n\t\t\tconst html = tag(\"slot\", { name: `${++SLOT}` });\n\t\t\tconst icon = new L.DivIcon({ html, iconSize: [0, 0] });\n\t\t\tthis.atlas = this.closest<MTDSAtlasElement>(\"mtds-atlas\") || undefined;\n\t\t\tthis.marker = new L.Marker(this.#parseLatLng(), {\n\t\t\t\tdraggable: this.draggable,\n\t\t\t\tkeyboard: false,\n\t\t\t\ticon,\n\t\t\t});\n\t\t\tthis.marker.bindPopup(() => `#${attr(this, \"popovertarget\")}`);\n\t\t\tthis.marker.on(\"dragend\", this.#handleDragEnd);\n\n\t\t\ton(this, \"click,keydown\", this); // Listen for clicks to toggle popup\n\t\t\tattr(this, \"slot\", `${SLOT}`); // Link slot to marker icon\n\t\t\tattr(this, \"role\", \"button\");\n\t\t\tattr(this, \"tabindex\", \"0\");\n\t\t\tthis.attributeChangedCallback(\"hidden\"); // Maybe add to map\n\t\t}); // Let the atlas parent initialize first\n\t}\n\tattributeChangedCallback(name: string) {\n\t\tconst mark = this.marker;\n\t\tconst cluster = this.atlas?.cluster;\n\t\tif (name === \"popovertarget\") mark?.getPopup()?.update();\n\t\tif (name === \"data-latlng\") {\n\t\t\tconst latlng = this.#parseLatLng();\n\t\t\tmark?.getLatLng().equals(latlng) || mark?.setLatLng(latlng);\n\t\t}\n\t\tif (name === \"draggable\")\n\t\t\tmark?.dragging?.[this.draggable ? \"enable\" : \"disable\"]();\n\t\tif (name === \"hidden\" && mark && cluster)\n\t\t\tcluster[this.hidden ? \"removeLayer\" : \"addLayer\"](mark);\n\t}\n\tdisconnectedCallback() {\n\t\toff(this, \"click,keydown\", this);\n\t\tthis.marker?.unbindPopup().off(\"dragend\", this.#handleDragEnd).remove();\n\t\tthis.marker = this.atlas = undefined;\n\t}\n\thandleEvent(event: KeyboardEvent) {\n\t\tif (event.type === \"click\") return this.marker?.fire(\"click\"); //this.atlas?.togglePopup(this.marker, this);\n\t\tif (event.key === \" \") event.preventDefault(); // Prevent page scroll on space key\n\t\tif (event.key === \" \" || event.key === \"Enter\") this.click(); // Forward keyvoard to click for accessibility\n\t}\n\tget latlng() {\n\t\treturn attr(this, \"data-latlng\") || \"\";\n\t}\n\tset latlng(latlng: string) {\n\t\tattr(this, \"data-latlng\", latlng);\n\t}\n\t#parseLatLng() {\n\t\treturn this.latlng?.split(\",\").map(parseFloat) as L.LatLngTuple;\n\t}\n\t#handleDragEnd(detail: L.LeafletEvent) {\n\t\tconst slot = detail.target._icon\n\t\t\t?.firstElementChild as HTMLSlotElement | null;\n\t\tconst self =\n\t\t\tslot?.assignedElements?.()?.[0] as MTDSAtlasMarkerElement | null;\n\t\tconst { lat, lng } = detail.target.getLatLng(); // Using L.Marker.getLatLng() to get position also when in spiderified cluster\n\t\tif (self) self.latlng = `${lat},${lng}`;\n\t\tself?.dispatchEvent(new CustomEvent(\"dragend\", { detail, bubbles: true }));\n\t}\n}\n\ndefineElement(\"mtds-atlas-marker\", MTDSAtlasMarkerElement);\n"],"names":["SLOT","MTDSAtlasMarkerElement","MTDSElement","html","tag","icon","L","#parseLatLng","attr","#handleDragEnd","on","name","mark","cluster","latlng","off","event","detail","self","lat","lng","defineElement"],"mappings":";;AAUA,IAAIA,IAAO;AACJ,MAAMC,UAA+BC,EAAY;AAAA,EACvD;AAAA,EACA;AAAA,EAEA,WAAW,qBAAqB;AAC/B,WAAO,CAAC,UAAU,aAAa,eAAe,eAAe;AAAA,EAC9D;AAAA,EACA,oBAAoB;AACnB,mBAAe,MAAM;AACpB,YAAMC,IAAOC,EAAI,QAAQ,EAAE,MAAM,GAAG,EAAEJ,CAAI,IAAI,GACxCK,IAAO,IAAIC,EAAE,QAAQ,EAAE,MAAAH,GAAM,UAAU,CAAC,GAAG,CAAC,GAAG;AACrD,WAAK,QAAQ,KAAK,QAA0B,YAAY,KAAK,QAC7D,KAAK,SAAS,IAAIG,EAAE,OAAO,KAAKC,MAAgB;AAAA,QAC/C,WAAW,KAAK;AAAA,QAChB,UAAU;AAAA,QACV,MAAAF;AAAA,MAAA,CACA,GACD,KAAK,OAAO,UAAU,MAAM,IAAIG,EAAK,MAAM,eAAe,CAAC,EAAE,GAC7D,KAAK,OAAO,GAAG,WAAW,KAAKC,EAAc,GAE7CC,EAAG,MAAM,iBAAiB,IAAI,GAC9BF,EAAK,MAAM,QAAQ,GAAGR,CAAI,EAAE,GAC5BQ,EAAK,MAAM,QAAQ,QAAQ,GAC3BA,EAAK,MAAM,YAAY,GAAG,GAC1B,KAAK,yBAAyB,QAAQ;AAAA,IACvC,CAAC;AAAA,EACF;AAAA,EACA,yBAAyBG,GAAc;AACtC,UAAMC,IAAO,KAAK,QACZC,IAAU,KAAK,OAAO;AAE5B,QADIF,MAAS,mBAAiBC,GAAM,SAAA,GAAY,OAAA,GAC5CD,MAAS,eAAe;AAC3B,YAAMG,IAAS,KAAKP,GAAA;AACpB,MAAAK,GAAM,YAAY,OAAOE,CAAM,KAAKF,GAAM,UAAUE,CAAM;AAAA,IAC3D;AACA,IAAIH,MAAS,eACZC,GAAM,WAAW,KAAK,YAAY,WAAW,SAAS,EAAA,GACnDD,MAAS,YAAYC,KAAQC,KAChCA,EAAQ,KAAK,SAAS,gBAAgB,UAAU,EAAED,CAAI;AAAA,EACxD;AAAA,EACA,uBAAuB;AACtB,IAAAG,EAAI,MAAM,iBAAiB,IAAI,GAC/B,KAAK,QAAQ,cAAc,IAAI,WAAW,KAAKN,EAAc,EAAE,OAAA,GAC/D,KAAK,SAAS,KAAK,QAAQ;AAAA,EAC5B;AAAA,EACA,YAAYO,GAAsB;AACjC,QAAIA,EAAM,SAAS,gBAAgB,KAAK,QAAQ,KAAK,OAAO;AAC5D,IAAIA,EAAM,QAAQ,OAAKA,EAAM,eAAA,IACzBA,EAAM,QAAQ,OAAOA,EAAM,QAAQ,iBAAc,MAAA;AAAA,EACtD;AAAA,EACA,IAAI,SAAS;AACZ,WAAOR,EAAK,MAAM,aAAa,KAAK;AAAA,EACrC;AAAA,EACA,IAAI,OAAOM,GAAgB;AAC1B,IAAAN,EAAK,MAAM,eAAeM,CAAM;AAAA,EACjC;AAAA,EACAP,KAAe;AACd,WAAO,KAAK,QAAQ,MAAM,GAAG,EAAE,IAAI,UAAU;AAAA,EAC9C;AAAA,EACAE,GAAeQ,GAAwB;AAGtC,UAAMC,IAFOD,EAAO,OAAO,OACxB,mBAEI,mBAAA,IAAuB,CAAC,GACzB,EAAE,KAAAE,GAAK,KAAAC,EAAA,IAAQH,EAAO,OAAO,UAAA;AACnC,IAAIC,MAAMA,EAAK,SAAS,GAAGC,CAAG,IAAIC,CAAG,KACrCF,GAAM,cAAc,IAAI,YAAY,WAAW,EAAE,QAAAD,GAAQ,SAAS,GAAA,CAAM,CAAC;AAAA,EAC1E;AACD;AAEAI,EAAc,qBAAqBpB,CAAsB;"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { default as L } from 'leaflet';
|
|
2
2
|
import { MTDSElement } from '../utils';
|
|
3
|
-
import { MTDSAtlasElement } from './atlas-element';
|
|
3
|
+
import { MTDSAtlasCollection, MTDSAtlasElement } from './atlas-element';
|
|
4
4
|
type Feature = L.Polygon["feature"];
|
|
5
|
-
type Collection = Record<string, unknown>;
|
|
6
|
-
type Collections = Map<string, Collection>;
|
|
7
5
|
type LayerWithFeature = L.Layer & {
|
|
8
6
|
feature?: Feature;
|
|
9
7
|
};
|
|
@@ -14,12 +12,9 @@ declare global {
|
|
|
14
12
|
interface GlobalEventHandlersEventMap {
|
|
15
13
|
atlasfeatureclick: CustomEvent<Omit<L.LeafletMouseEvent, "target"> & {
|
|
16
14
|
targets: LayerWithFeature[];
|
|
17
|
-
collections:
|
|
15
|
+
collections: MTDSAtlasCollection[];
|
|
18
16
|
}>;
|
|
19
17
|
}
|
|
20
|
-
interface Window {
|
|
21
|
-
_matgeoCollections?: Promise<Collections>;
|
|
22
|
-
}
|
|
23
18
|
}
|
|
24
19
|
export declare class MTDSAtlasMatgeoElement extends MTDSElement {
|
|
25
20
|
#private;
|
|
@@ -32,6 +27,6 @@ export declare class MTDSAtlasMatgeoElement extends MTDSElement {
|
|
|
32
27
|
disconnectedCallback(): void;
|
|
33
28
|
refresh(nocache?: boolean | L.LeafletEvent): void;
|
|
34
29
|
handleEvent(event: L.LeafletMouseEvent): void;
|
|
35
|
-
getCollection(): Promise<
|
|
30
|
+
getCollection(): Promise<MTDSAtlasCollection | undefined>;
|
|
36
31
|
}
|
|
37
32
|
export {};
|
|
@@ -1,93 +1,63 @@
|
|
|
1
|
-
import { booleanPointInPolygon } from "../external/@turf/boolean-point-in-polygon/dist/esm/index.js";
|
|
2
|
-
import { point } from "../external/@turf/helpers/dist/esm/index.js";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
if (isBrowser() && !window._matgeoCollections)
|
|
8
|
-
window._matgeoCollections = fetch(MATGEO_URL).then((res) => res.json()).then((d) => new Map(d.collections?.map((c) => [c.id, c])));
|
|
9
|
-
class MTDSAtlasMatgeoElement extends MTDSElement {
|
|
1
|
+
import { booleanPointInPolygon as c } from "../external/@turf/boolean-point-in-polygon/dist/esm/index.js";
|
|
2
|
+
import { point as d } from "../external/@turf/helpers/dist/esm/index.js";
|
|
3
|
+
import r from "../external/leaflet/dist/leaflet-src.js";
|
|
4
|
+
import { defineElement as g, MTDSElement as m, debounce as p, attr as n } from "../utils.js";
|
|
5
|
+
const h = "moveend zoomend refresh";
|
|
6
|
+
class u extends m {
|
|
10
7
|
atlas;
|
|
11
8
|
geojson;
|
|
12
9
|
static get observedAttributes() {
|
|
13
10
|
return ["hidden", "data-collection", "data-color", "popovertarget"];
|
|
14
11
|
}
|
|
15
12
|
constructor() {
|
|
16
|
-
super();
|
|
17
|
-
this.refresh = debounce(this.refresh, 300);
|
|
13
|
+
super(), this.refresh = p(this.refresh, 300);
|
|
18
14
|
}
|
|
19
15
|
connectedCallback() {
|
|
20
16
|
queueMicrotask(() => {
|
|
21
|
-
this.atlas = this.closest("mtds-atlas") || void 0
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
onEachFeature: (_, layer) => layer.on("click", this.handleEvent, this)
|
|
26
|
-
}).bindPopup(() => `#${attr(this, "popovertarget")}`);
|
|
27
|
-
this.refresh();
|
|
28
|
-
this.attributeChangedCallback("hidden");
|
|
17
|
+
this.atlas = this.closest("mtds-atlas") || void 0, this.atlas?.map?.on(h, this.refresh, this), this.geojson = new r.GeoJSON(null, {
|
|
18
|
+
style: this.#t(),
|
|
19
|
+
onEachFeature: (t, s) => s.on("click", this.handleEvent, this)
|
|
20
|
+
}).bindPopup(() => `#${n(this, "popovertarget")}`), this.refresh(), this.attributeChangedCallback("hidden");
|
|
29
21
|
});
|
|
30
22
|
}
|
|
31
|
-
attributeChangedCallback(
|
|
32
|
-
const geojson = this.
|
|
33
|
-
|
|
34
|
-
if (name === "popovertarget") geojson?.getPopup()?.update();
|
|
35
|
-
if (name === "data-color") geojson?.setStyle(this.#getStyle());
|
|
36
|
-
if (name === "data-collection") this.refresh();
|
|
37
|
-
if (name === "hidden" && geojson && map)
|
|
38
|
-
map[this.hidden ? "removeLayer" : "addLayer"](geojson);
|
|
23
|
+
attributeChangedCallback(t) {
|
|
24
|
+
const s = this.geojson, o = this.atlas?.map;
|
|
25
|
+
t === "popovertarget" && s?.getPopup()?.update(), t === "data-color" && s?.setStyle(this.#t()), t === "data-collection" && this.refresh(), t === "hidden" && s && o && o[this.hidden ? "removeLayer" : "addLayer"](s);
|
|
39
26
|
}
|
|
40
27
|
disconnectedCallback() {
|
|
41
|
-
this.atlas?.map?.off(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const bbox = this.atlas?.map?.getBounds().toBBoxString();
|
|
51
|
-
if (!collections.has(collection))
|
|
52
|
-
console.warn(
|
|
53
|
-
`mtds-atlas-matgeo: Please set a vaild \x1B[103mdata-collection="${Array.from(collections.keys()).join(" | ")}"\x1B[m`
|
|
54
|
-
);
|
|
55
|
-
else
|
|
56
|
-
fetch(`${MATGEO_URL}/${collection}/items?bbox=${bbox}${cache}`).then((res) => res.json()).then((data) => this.geojson?.clearLayers().addData(data));
|
|
28
|
+
this.atlas?.map?.off(h, this.refresh, this), this.geojson?.unbindPopup().remove(), this.geojson = this.atlas = void 0;
|
|
29
|
+
}
|
|
30
|
+
refresh(t) {
|
|
31
|
+
!this.geojson || !this.atlas?.map?.hasLayer(this.geojson) || this.getCollection().then((s) => {
|
|
32
|
+
const o = s?.links.find(({ rel: e }) => e === "items"), a = t === !0 ? `&nocache=${Date.now()}` : "", i = this.atlas?.map?.getBounds().toBBoxString();
|
|
33
|
+
s ? fetch(`${o?.href}?bbox=${i}${a}`).then((e) => e.json()).then((e) => this.geojson?.clearLayers().addData(e)) : this.atlas?.getCollections().then((e) => {
|
|
34
|
+
const l = `mtds-atlas-matgeo: Please set a vaild \x1B[103mdata-collection="${Object.keys(e).join(" | ")}"\x1B[m`;
|
|
35
|
+
console.warn(l);
|
|
36
|
+
});
|
|
57
37
|
});
|
|
58
38
|
}
|
|
59
|
-
handleEvent(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
this.
|
|
66
|
-
|
|
67
|
-
const inside = layer.feature?.geometry && booleanPointInPolygon(point$1, layer.feature.geometry) || layer instanceof L.Marker && layer.getLatLng().equals(event.latlng);
|
|
68
|
-
if (inside) targets.push(layer);
|
|
69
|
-
});
|
|
70
|
-
this.dispatchEvent(new MouseEvent("click", event.originalEvent));
|
|
71
|
-
this.dispatchEvent(
|
|
72
|
-
new CustomEvent("atlasfeatureclick", { detail, bubbles: true })
|
|
39
|
+
handleEvent(t) {
|
|
40
|
+
t.originalEvent.stopPropagation(), this.atlas?.getCollections().then((s) => {
|
|
41
|
+
const o = [t.target], a = { ...t, targets: o, collections: s }, i = d([t.latlng.lng, t.latlng.lat]);
|
|
42
|
+
this.atlas?.map?.eachLayer((e) => {
|
|
43
|
+
if (e === t.target) return;
|
|
44
|
+
(e.feature?.geometry && c(i, e.feature.geometry) || e instanceof r.Marker && e.getLatLng().equals(t.latlng)) && o.push(e);
|
|
45
|
+
}), this.dispatchEvent(new MouseEvent("click", t.originalEvent)), this.dispatchEvent(
|
|
46
|
+
new CustomEvent("atlasfeatureclick", { detail: a, bubbles: !0 })
|
|
73
47
|
);
|
|
74
48
|
});
|
|
75
49
|
}
|
|
76
50
|
async getCollection() {
|
|
77
|
-
|
|
78
|
-
return getCollections().then((col) => col.get(id));
|
|
51
|
+
return this.atlas?.getCollections().then((t) => t?.[n(this, "data-collection") || ""]);
|
|
79
52
|
}
|
|
80
|
-
#
|
|
53
|
+
#t() {
|
|
81
54
|
return {
|
|
82
|
-
color: `var(--mtds-color-${
|
|
55
|
+
color: `var(--mtds-color-${n(this, "data-color") || "main"}-base-default)`
|
|
83
56
|
};
|
|
84
57
|
}
|
|
85
58
|
}
|
|
86
|
-
|
|
87
|
-
function getCollections() {
|
|
88
|
-
return window._matgeoCollections || Promise.resolve(/* @__PURE__ */ new Map());
|
|
89
|
-
}
|
|
59
|
+
g("mtds-atlas-matgeo", u);
|
|
90
60
|
export {
|
|
91
|
-
MTDSAtlasMatgeoElement
|
|
61
|
+
u as MTDSAtlasMatgeoElement
|
|
92
62
|
};
|
|
93
63
|
//# sourceMappingURL=atlas-matgeo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atlas-matgeo.js","sources":["../../designsystem/atlas/atlas-matgeo.ts"],"sourcesContent":["import { booleanPointInPolygon as inGeo } from \"@turf/boolean-point-in-polygon\";\nimport { point as turfPoint } from \"@turf/helpers\";\n\nimport L from \"leaflet\";\nimport {
|
|
1
|
+
{"version":3,"file":"atlas-matgeo.js","sources":["../../designsystem/atlas/atlas-matgeo.ts"],"sourcesContent":["import { booleanPointInPolygon as inGeo } from \"@turf/boolean-point-in-polygon\";\nimport { point as turfPoint } from \"@turf/helpers\";\n\nimport L from \"leaflet\";\nimport { attr, debounce, defineElement, MTDSElement } from \"../utils\";\nimport type { MTDSAtlasCollection, MTDSAtlasElement } from \"./atlas-element\";\n\ntype Feature = L.Polygon[\"feature\"];\ntype LayerWithFeature = L.Layer & { feature?: Feature };\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t\"mtds-atlas-matgeo\": MTDSAtlasMatgeoElement;\n\t}\n\tinterface GlobalEventHandlersEventMap {\n\t\tatlasfeatureclick: CustomEvent<\n\t\t\tOmit<L.LeafletMouseEvent, \"target\"> & {\n\t\t\t\ttargets: LayerWithFeature[];\n\t\t\t\tcollections: MTDSAtlasCollection[];\n\t\t\t}\n\t\t>;\n\t}\n}\n\nconst EVENTS = \"moveend zoomend refresh\";\n\nexport class MTDSAtlasMatgeoElement extends MTDSElement {\n\tatlas?: MTDSAtlasElement;\n\tgeojson?: L.GeoJSON;\n\n\tstatic get observedAttributes() {\n\t\treturn [\"hidden\", \"data-collection\", \"data-color\", \"popovertarget\"]; // Using ES2015 syntax for backwards compatibility\n\t}\n\tconstructor() {\n\t\tsuper();\n\t\tthis.refresh = debounce(this.refresh, 300); // Debounce to avoid too many requests\n\t}\n\tconnectedCallback() {\n\t\tqueueMicrotask(() => {\n\t\t\tthis.atlas = this.closest<MTDSAtlasElement>(\"mtds-atlas\") || undefined;\n\t\t\tthis.atlas?.map?.on(EVENTS, this.refresh, this);\n\t\t\tthis.geojson = new L.GeoJSON(null, {\n\t\t\t\tstyle: this.#getStyle(),\n\t\t\t\tonEachFeature: (_, layer) => layer.on(\"click\", this.handleEvent, this),\n\t\t\t}).bindPopup(() => `#${attr(this, \"popovertarget\")}`);\n\t\t\tthis.refresh();\n\t\t\tthis.attributeChangedCallback(\"hidden\"); // Maybe add to map\n\t\t}); // Let the atlas parent initialize first\n\t}\n\tattributeChangedCallback(name?: string) {\n\t\tconst geojson = this.geojson;\n\t\tconst map = this.atlas?.map;\n\t\tif (name === \"popovertarget\") geojson?.getPopup()?.update();\n\t\tif (name === \"data-color\") geojson?.setStyle(this.#getStyle());\n\t\tif (name === \"data-collection\") this.refresh();\n\t\tif (name === \"hidden\" && geojson && map)\n\t\t\tmap[this.hidden ? \"removeLayer\" : \"addLayer\"](geojson);\n\t}\n\tdisconnectedCallback() {\n\t\tthis.atlas?.map?.off(EVENTS, this.refresh, this);\n\t\tthis.geojson?.unbindPopup().remove();\n\t\tthis.geojson = this.atlas = undefined;\n\t}\n\trefresh(nocache?: boolean | L.LeafletEvent) {\n\t\tif (!this.geojson || !this.atlas?.map?.hasLayer(this.geojson)) return;\n\t\tthis.getCollection().then((collection) => {\n\t\t\tconst items = collection?.links.find(({ rel }) => rel === \"items\");\n\t\t\tconst cache = nocache === true ? `&nocache=${Date.now()}` : \"\";\n\t\t\tconst bbox = this.atlas?.map?.getBounds().toBBoxString();\n\n\t\t\tif (!collection)\n\t\t\t\tthis.atlas?.getCollections().then((collections) => {\n\t\t\t\t\tconst message = `mtds-atlas-matgeo: Please set a vaild \\x1B[103mdata-collection=\"${Object.keys(collections).join(\" | \")}\"\\x1B[m`;\n\t\t\t\t\tconsole.warn(message);\n\t\t\t\t});\n\t\t\telse\n\t\t\t\tfetch(`${items?.href}?bbox=${bbox}${cache}`)\n\t\t\t\t\t.then((res) => res.json())\n\t\t\t\t\t.then((data) => this.geojson?.clearLayers().addData(data));\n\t\t});\n\t}\n\thandleEvent(event: L.LeafletMouseEvent) {\n\t\tevent.originalEvent.stopPropagation(); // Prevent clicks from bubbling from ShadowDOM\n\t\tthis.atlas?.getCollections().then((collections) => {\n\t\t\tconst targets: LayerWithFeature[] = [event.target]; // Leaflet does not list all clicked layers, so we find them manually\n\t\t\tconst detail = { ...event, targets, collections };\n\t\t\tconst point = turfPoint([event.latlng.lng, event.latlng.lat]);\n\n\t\t\tthis.atlas?.map?.eachLayer((layer: LayerWithFeature) => {\n\t\t\t\tif (layer === event.target) return; // Already added\n\t\t\t\tconst inside =\n\t\t\t\t\t(layer.feature?.geometry && inGeo(point, layer.feature.geometry)) ||\n\t\t\t\t\t(layer instanceof L.Marker && layer.getLatLng().equals(event.latlng));\n\t\t\t\tif (inside) targets.push(layer);\n\t\t\t});\n\n\t\t\tthis.dispatchEvent(new MouseEvent(\"click\", event.originalEvent)); // Forward click, but from <mtds-atlas-matgeo> element\n\t\t\tthis.dispatchEvent(\n\t\t\t\tnew CustomEvent(\"atlasfeatureclick\", { detail, bubbles: true }),\n\t\t\t);\n\t\t});\n\t}\n\tasync getCollection() {\n\t\treturn this.atlas\n\t\t\t?.getCollections()\n\t\t\t.then((cols) => cols?.[attr(this, \"data-collection\") || \"\"]);\n\t}\n\t#getStyle() {\n\t\treturn {\n\t\t\tcolor: `var(--mtds-color-${attr(this, \"data-color\") || \"main\"}-base-default)`,\n\t\t};\n\t}\n}\n\ndefineElement(\"mtds-atlas-matgeo\", MTDSAtlasMatgeoElement);\n"],"names":["EVENTS","MTDSAtlasMatgeoElement","MTDSElement","debounce","L","#getStyle","_","layer","attr","name","geojson","map","nocache","collection","items","rel","cache","bbox","res","data","collections","message","event","targets","detail","point","turfPoint","inGeo","cols","defineElement"],"mappings":";;;;AAuBA,MAAMA,IAAS;AAER,MAAMC,UAA+BC,EAAY;AAAA,EACvD;AAAA,EACA;AAAA,EAEA,WAAW,qBAAqB;AAC/B,WAAO,CAAC,UAAU,mBAAmB,cAAc,eAAe;AAAA,EACnE;AAAA,EACA,cAAc;AACb,UAAA,GACA,KAAK,UAAUC,EAAS,KAAK,SAAS,GAAG;AAAA,EAC1C;AAAA,EACA,oBAAoB;AACnB,mBAAe,MAAM;AACpB,WAAK,QAAQ,KAAK,QAA0B,YAAY,KAAK,QAC7D,KAAK,OAAO,KAAK,GAAGH,GAAQ,KAAK,SAAS,IAAI,GAC9C,KAAK,UAAU,IAAII,EAAE,QAAQ,MAAM;AAAA,QAClC,OAAO,KAAKC,GAAA;AAAA,QACZ,eAAe,CAACC,GAAGC,MAAUA,EAAM,GAAG,SAAS,KAAK,aAAa,IAAI;AAAA,MAAA,CACrE,EAAE,UAAU,MAAM,IAAIC,EAAK,MAAM,eAAe,CAAC,EAAE,GACpD,KAAK,QAAA,GACL,KAAK,yBAAyB,QAAQ;AAAA,IACvC,CAAC;AAAA,EACF;AAAA,EACA,yBAAyBC,GAAe;AACvC,UAAMC,IAAU,KAAK,SACfC,IAAM,KAAK,OAAO;AACxB,IAAIF,MAAS,mBAAiBC,GAAS,SAAA,GAAY,OAAA,GAC/CD,MAAS,gBAAcC,GAAS,SAAS,KAAKL,IAAW,GACzDI,MAAS,qBAAmB,KAAK,QAAA,GACjCA,MAAS,YAAYC,KAAWC,KACnCA,EAAI,KAAK,SAAS,gBAAgB,UAAU,EAAED,CAAO;AAAA,EACvD;AAAA,EACA,uBAAuB;AACtB,SAAK,OAAO,KAAK,IAAIV,GAAQ,KAAK,SAAS,IAAI,GAC/C,KAAK,SAAS,YAAA,EAAc,OAAA,GAC5B,KAAK,UAAU,KAAK,QAAQ;AAAA,EAC7B;AAAA,EACA,QAAQY,GAAoC;AAC3C,IAAI,CAAC,KAAK,WAAW,CAAC,KAAK,OAAO,KAAK,SAAS,KAAK,OAAO,KAC5D,KAAK,cAAA,EAAgB,KAAK,CAACC,MAAe;AACzC,YAAMC,IAAQD,GAAY,MAAM,KAAK,CAAC,EAAE,KAAAE,EAAA,MAAUA,MAAQ,OAAO,GAC3DC,IAAQJ,MAAY,KAAO,YAAY,KAAK,KAAK,KAAK,IACtDK,IAAO,KAAK,OAAO,KAAK,UAAA,EAAY,aAAA;AAE1C,MAAKJ,IAMJ,MAAM,GAAGC,GAAO,IAAI,SAASG,CAAI,GAAGD,CAAK,EAAE,EACzC,KAAK,CAACE,MAAQA,EAAI,KAAA,CAAM,EACxB,KAAK,CAACC,MAAS,KAAK,SAAS,YAAA,EAAc,QAAQA,CAAI,CAAC,IAP1D,KAAK,OAAO,eAAA,EAAiB,KAAK,CAACC,MAAgB;AAClD,cAAMC,IAAU,mEAAmE,OAAO,KAAKD,CAAW,EAAE,KAAK,KAAK,CAAC;AACvH,gBAAQ,KAAKC,CAAO;AAAA,MACrB,CAAC;AAAA,IAKH,CAAC;AAAA,EACF;AAAA,EACA,YAAYC,GAA4B;AACvC,IAAAA,EAAM,cAAc,gBAAA,GACpB,KAAK,OAAO,eAAA,EAAiB,KAAK,CAACF,MAAgB;AAClD,YAAMG,IAA8B,CAACD,EAAM,MAAM,GAC3CE,IAAS,EAAE,GAAGF,GAAO,SAAAC,GAAS,aAAAH,EAAA,GAC9BK,IAAQC,EAAU,CAACJ,EAAM,OAAO,KAAKA,EAAM,OAAO,GAAG,CAAC;AAE5D,WAAK,OAAO,KAAK,UAAU,CAACf,MAA4B;AACvD,YAAIA,MAAUe,EAAM,OAAQ;AAI5B,SAFEf,EAAM,SAAS,YAAYoB,EAAMF,GAAOlB,EAAM,QAAQ,QAAQ,KAC9DA,aAAiBH,EAAE,UAAUG,EAAM,YAAY,OAAOe,EAAM,MAAM,MACxDC,EAAQ,KAAKhB,CAAK;AAAA,MAC/B,CAAC,GAED,KAAK,cAAc,IAAI,WAAW,SAASe,EAAM,aAAa,CAAC,GAC/D,KAAK;AAAA,QACJ,IAAI,YAAY,qBAAqB,EAAE,QAAAE,GAAQ,SAAS,IAAM;AAAA,MAAA;AAAA,IAEhE,CAAC;AAAA,EACF;AAAA,EACA,MAAM,gBAAgB;AACrB,WAAO,KAAK,OACT,eAAA,EACD,KAAK,CAACI,MAASA,IAAOpB,EAAK,MAAM,iBAAiB,KAAK,EAAE,CAAC;AAAA,EAC7D;AAAA,EACAH,KAAY;AACX,WAAO;AAAA,MACN,OAAO,oBAAoBG,EAAK,MAAM,YAAY,KAAK,MAAM;AAAA,IAAA;AAAA,EAE/D;AACD;AAEAqB,EAAc,qBAAqB5B,CAAsB;"}
|
package/mtds/atlas/atlas-wms.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { defineElement, MTDSElement, attr } from "../utils.js";
|
|
3
|
-
class
|
|
1
|
+
import s from "../external/leaflet/dist/leaflet-src.js";
|
|
2
|
+
import { defineElement as a, MTDSElement as i, attr as r } from "../utils.js";
|
|
3
|
+
class d extends i {
|
|
4
4
|
atlas;
|
|
5
5
|
wms;
|
|
6
6
|
static get observedAttributes() {
|
|
@@ -8,32 +8,22 @@ class MTDSAtlasWMSElement extends MTDSElement {
|
|
|
8
8
|
}
|
|
9
9
|
connectedCallback() {
|
|
10
10
|
queueMicrotask(() => {
|
|
11
|
-
this.atlas = this.closest("mtds-atlas") || void 0;
|
|
12
|
-
this.refresh();
|
|
11
|
+
this.atlas = this.closest("mtds-atlas") || void 0, this.refresh();
|
|
13
12
|
});
|
|
14
13
|
}
|
|
15
|
-
attributeChangedCallback(
|
|
16
|
-
|
|
17
|
-
if (name === "popovertarget") this.wms?.getPopup()?.update();
|
|
18
|
-
if (name === "hidden" && this.wms) {
|
|
19
|
-
this.atlas?.map?.[this.hidden ? "removeLayer" : "addLayer"](this.wms);
|
|
20
|
-
this.wms.bringToFront();
|
|
21
|
-
}
|
|
14
|
+
attributeChangedCallback(t) {
|
|
15
|
+
t === "data-url" && this.refresh(), t === "popovertarget" && this.wms?.getPopup()?.update(), t === "hidden" && this.wms && (this.atlas?.map?.[this.hidden ? "removeLayer" : "addLayer"](this.wms), this.wms.bringToFront());
|
|
22
16
|
}
|
|
23
17
|
refresh() {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
this.wms?.unbindPopup().remove();
|
|
27
|
-
this.wms = new L.TileLayer.WMS(`${url.origin}${url.pathname}`, params);
|
|
28
|
-
this.attributeChangedCallback("hidden");
|
|
18
|
+
const t = new URL(r(this, "data-url") || ""), e = Object.fromEntries(t.searchParams.entries());
|
|
19
|
+
this.wms?.unbindPopup().remove(), this.wms = new s.TileLayer.WMS(`${t.origin}${t.pathname}`, e), this.attributeChangedCallback("hidden");
|
|
29
20
|
}
|
|
30
21
|
disconnectedCallback() {
|
|
31
|
-
this.wms?.unbindPopup().remove();
|
|
32
|
-
this.wms = this.atlas = void 0;
|
|
22
|
+
this.wms?.unbindPopup().remove(), this.wms = this.atlas = void 0;
|
|
33
23
|
}
|
|
34
24
|
}
|
|
35
|
-
|
|
25
|
+
a("mtds-atlas-wms", d);
|
|
36
26
|
export {
|
|
37
|
-
MTDSAtlasWMSElement
|
|
27
|
+
d as MTDSAtlasWMSElement
|
|
38
28
|
};
|
|
39
29
|
//# sourceMappingURL=atlas-wms.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atlas-wms.js","sources":["../../designsystem/atlas/atlas-wms.ts"],"sourcesContent":["import L from \"leaflet\";\nimport { attr, defineElement, MTDSElement } from \"../utils\";\nimport type { MTDSAtlasElement } from \"./atlas-element\";\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t\"mtds-atlas-wms\": MTDSAtlasWMSElement;\n\t}\n}\n\nexport class MTDSAtlasWMSElement extends MTDSElement {\n\tatlas?: MTDSAtlasElement;\n\twms?: L.TileLayer.WMS;\n\n\tstatic get observedAttributes() {\n\t\treturn [\"hidden\", \"data-url\", \"popovertarget\"]; // Using ES2015 syntax for backwards compatibility\n\t}\n\tconnectedCallback() {\n\t\tqueueMicrotask(() => {\n\t\t\tthis.atlas = this.closest<MTDSAtlasElement>(\"mtds-atlas\") || undefined;\n\t\t\tthis.refresh();\n\t\t}); // Let the atlas parent initialize first\n\t}\n\tattributeChangedCallback(name?: string) {\n\t\tif (name === \"data-url\") this.refresh();\n\t\tif (name === \"popovertarget\") this.wms?.getPopup()?.update();\n\t\tif (name === \"hidden\" && this.wms) {\n\t\t\tthis.atlas?.map?.[this.hidden ? \"removeLayer\" : \"addLayer\"](this.wms);\n\t\t\tthis.wms.bringToFront();\n\t\t}\n\t}\n\trefresh() {\n\t\tconst url = new URL(attr(this, \"data-url\") || \"\");\n\t\tconst params = Object.fromEntries(url.searchParams.entries());\n\t\tthis.wms?.unbindPopup().remove();\n\t\tthis.wms = new L.TileLayer.WMS(`${url.origin}${url.pathname}`, params);\n\t\tthis.attributeChangedCallback(\"hidden\"); // Maybe add to map\n\t}\n\tdisconnectedCallback() {\n\t\tthis.wms?.unbindPopup().remove();\n\t\tthis.wms = this.atlas = undefined;\n\t}\n}\n\ndefineElement(\"mtds-atlas-wms\", MTDSAtlasWMSElement);\n"],"names":[],"mappings":";;AAUO,
|
|
1
|
+
{"version":3,"file":"atlas-wms.js","sources":["../../designsystem/atlas/atlas-wms.ts"],"sourcesContent":["import L from \"leaflet\";\nimport { attr, defineElement, MTDSElement } from \"../utils\";\nimport type { MTDSAtlasElement } from \"./atlas-element\";\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t\"mtds-atlas-wms\": MTDSAtlasWMSElement;\n\t}\n}\n\nexport class MTDSAtlasWMSElement extends MTDSElement {\n\tatlas?: MTDSAtlasElement;\n\twms?: L.TileLayer.WMS;\n\n\tstatic get observedAttributes() {\n\t\treturn [\"hidden\", \"data-url\", \"popovertarget\"]; // Using ES2015 syntax for backwards compatibility\n\t}\n\tconnectedCallback() {\n\t\tqueueMicrotask(() => {\n\t\t\tthis.atlas = this.closest<MTDSAtlasElement>(\"mtds-atlas\") || undefined;\n\t\t\tthis.refresh();\n\t\t}); // Let the atlas parent initialize first\n\t}\n\tattributeChangedCallback(name?: string) {\n\t\tif (name === \"data-url\") this.refresh();\n\t\tif (name === \"popovertarget\") this.wms?.getPopup()?.update();\n\t\tif (name === \"hidden\" && this.wms) {\n\t\t\tthis.atlas?.map?.[this.hidden ? \"removeLayer\" : \"addLayer\"](this.wms);\n\t\t\tthis.wms.bringToFront();\n\t\t}\n\t}\n\trefresh() {\n\t\tconst url = new URL(attr(this, \"data-url\") || \"\");\n\t\tconst params = Object.fromEntries(url.searchParams.entries());\n\t\tthis.wms?.unbindPopup().remove();\n\t\tthis.wms = new L.TileLayer.WMS(`${url.origin}${url.pathname}`, params);\n\t\tthis.attributeChangedCallback(\"hidden\"); // Maybe add to map\n\t}\n\tdisconnectedCallback() {\n\t\tthis.wms?.unbindPopup().remove();\n\t\tthis.wms = this.atlas = undefined;\n\t}\n}\n\ndefineElement(\"mtds-atlas-wms\", MTDSAtlasWMSElement);\n"],"names":["MTDSAtlasWMSElement","MTDSElement","name","url","attr","params","L","defineElement"],"mappings":";;AAUO,MAAMA,UAA4BC,EAAY;AAAA,EACpD;AAAA,EACA;AAAA,EAEA,WAAW,qBAAqB;AAC/B,WAAO,CAAC,UAAU,YAAY,eAAe;AAAA,EAC9C;AAAA,EACA,oBAAoB;AACnB,mBAAe,MAAM;AACpB,WAAK,QAAQ,KAAK,QAA0B,YAAY,KAAK,QAC7D,KAAK,QAAA;AAAA,IACN,CAAC;AAAA,EACF;AAAA,EACA,yBAAyBC,GAAe;AACvC,IAAIA,MAAS,cAAY,KAAK,QAAA,GAC1BA,MAAS,mBAAiB,KAAK,KAAK,SAAA,GAAY,OAAA,GAChDA,MAAS,YAAY,KAAK,QAC7B,KAAK,OAAO,MAAM,KAAK,SAAS,gBAAgB,UAAU,EAAE,KAAK,GAAG,GACpE,KAAK,IAAI,aAAA;AAAA,EAEX;AAAA,EACA,UAAU;AACT,UAAMC,IAAM,IAAI,IAAIC,EAAK,MAAM,UAAU,KAAK,EAAE,GAC1CC,IAAS,OAAO,YAAYF,EAAI,aAAa,SAAS;AAC5D,SAAK,KAAK,YAAA,EAAc,OAAA,GACxB,KAAK,MAAM,IAAIG,EAAE,UAAU,IAAI,GAAGH,EAAI,MAAM,GAAGA,EAAI,QAAQ,IAAIE,CAAM,GACrE,KAAK,yBAAyB,QAAQ;AAAA,EACvC;AAAA,EACA,uBAAuB;AACtB,SAAK,KAAK,YAAA,EAAc,OAAA,GACxB,KAAK,MAAM,KAAK,QAAQ;AAAA,EACzB;AACD;AAEAE,EAAc,kBAAkBP,CAAmB;"}
|
package/mtds/atlas/atlas.css.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t = `/* NOTE: Using --mtds- not --mtds- since we're inside shadow dom */
|
|
2
2
|
:host {
|
|
3
3
|
--mtdsc-atlas-border: 1px solid var(--mtds-color-border-subtle);
|
|
4
4
|
--mtdsc-atlas-cluster-border: 1px solid;
|
|
@@ -123,6 +123,6 @@ const css = `/* NOTE: Using --mtds- not --mtds- since we're inside shadow dom */
|
|
|
123
123
|
.leaflet-popup:has(slot) .leaflet-popup-content { margin: 0; font: inherit }
|
|
124
124
|
`;
|
|
125
125
|
export {
|
|
126
|
-
|
|
126
|
+
t as default
|
|
127
127
|
};
|
|
128
128
|
//# sourceMappingURL=atlas.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atlas.css.js","sources":["../../designsystem/atlas/atlas.css?raw"],"sourcesContent":["export default \"/* NOTE: Using --mtds- not --mtds- since we're inside shadow dom */\\n:host {\\n\\t--mtdsc-atlas-border: 1px solid var(--mtds-color-border-subtle);\\n\\t--mtdsc-atlas-cluster-border: 1px solid;\\n\\t--mtdsc-atlas-marker-background: var(--mtds-color-base-default);\\n\\t--mtdsc-atlas-marker-border: 1px solid;\\n\\t--mtdsc-atlas-marker-color: var(--mtds-color-base-contrast-default);\\n\\t--mtdsc-atlas-marker-inset: 3px;\\n\\t--mtdsc-atlas-marker-shadow: rgba(0,0,0,.2);\\n\\t--mtdsc-atlas-marker-size: var(--mtds-6);\\n\\t--mtdsc-atlas-tile-background: #fbfbfb;\\n\\t--mtdsc-atlas-tile-filter: grayscale(1) contrast(0.75) brightness(1.15);\\n\\n\\tborder-radius: var(--mtds-border-radius-md);\\n\\taspect-ratio: 2;\\n\\toverflow: clip;\\n\\tposition: relative;\\n}\\n:host(:not([hidden])) { display: block }\\n:host([data-cursor=\\\"pointer\\\"]) .leaflet-grab { cursor: pointer }\\n\\n/* Focus */\\n.leaflet-control-zoom a:focus-visible,\\n:host:has(.leaflet-container:focus-visible),\\n::slotted(mtds-atlas-marker:focus-visible) {\\n\\tbox-shadow: var(--mtdsc-focus-boxShadow);\\n\\toutline: var(--mtdsc-focus-outline);\\n\\toutline-offset: var(--mtds-border-width-focus);\\n}\\n\\n/* Tiles */\\n.leaflet-kartverket-tiles { filter: var(--mtdsc-atlas-tile-filter); transition: filter 0.5s }\\n.leaflet-container {\\n\\tbackground: var(--mtdsc-atlas-tile-background);\\n\\tborder-radius: inherit;\\n\\tborder: var(--mtdsc-atlas-border);\\n\\tbox-sizing: border-box;\\n\\tfont: inherit;\\n\\theight: 100%;\\n\\tmargin: 0;\\n\\toutline: 0;\\n\\tposition: relative;\\n\\tz-index: 1; /* Ensure <slot> is always on top */\\n}\\n:host([data-tiles=\\\"color\\\"]) {\\n\\t--mtdsc-atlas-tile-background: #e5fcfd;\\n\\t--mtdsc-atlas-tile-filter: grayscale(0.2);\\n}\\n\\n/* Controls */\\n.leaflet-control-attribution { font-size: 12px; border-top-left-radius: var(--mtds-border-radius-md) }\\n.leaflet-control-zoom { border-radius: var(--mtds-border-radius-md); border: 1px solid var(--mtds-color-border-default) }\\n.leaflet-control-zoom a { background: var(--mtds-color-surface-default); border-color: inherit; color: var(--mtds-color-text-default); height: var(--mtds-10); line-height: var(--mtds-10); transition: 0.2s; width: var(--mtds-10) }\\n.leaflet-control-zoom a:first-child { border-top-left-radius: inherit; border-top-right-radius: inherit }\\n.leaflet-control-zoom a:last-child { border-bottom-left-radius: inherit; border-bottom-right-radius: inherit }\\n.leaflet-control-zoom a:hover { background: var(--mtds-color-surface-hover) }\\n.leaflet-control-zoom a:active { background: var(--mtds-color-surface-active) }\\n\\n/* Markers */\\n.leaflet-marker-generated-icon,\\n::slotted(mtds-atlas-marker) {\\n\\tall: unset;\\n\\tcolor: var(--mtdsc-atlas-marker-color);\\n\\tbackground: var(--mtdsc-atlas-marker-background);\\n\\tborder-radius: 100%;\\n\\tbox-sizing: border-box;\\n\\tcursor: pointer;\\n\\tdisplay: grid;\\n\\tplace-items: center;\\n\\tplace-content: center;\\n\\tfont-size: var(--mtds-body-sm-font-size);\\n\\tfont-weight: var(--mtds-font-weight-bold);\\n\\theight: var(--mtdsc-atlas-marker-size);\\n\\t/* biome-ignore lint/complexity/noImportantStyles: Overwrite Tailwind */\\n\\tmargin-bottom: calc(var(--mtdsc-atlas-marker-size) * .25 + var(--mtdsc-atlas-marker-inset))!important;\\n\\twidth: var(--mtdsc-atlas-marker-size);\\n}\\n.leaflet-marker-generated-icon::after,\\n::slotted(mtds-atlas-marker)::after {\\n\\tbox-shadow: 2px 2px 2px var(--mtdsc-atlas-marker-shadow);\\n\\taspect-ratio: 1;\\n\\tbackground: var(--mtdsc-atlas-marker-color);\\n\\tcolor: var(--mtdsc-atlas-marker-background);\\n\\tborder-radius: 50% 50% 0 50%;\\n\\t/* biome-ignore lint/complexity/noImportantStyles: Overwrite Tailwind */\\n\\tborder: var(--mtdsc-atlas-marker-border)!important;\\n\\tcontent: \\\"\\\";\\n\\trotate: 45deg;\\n\\tposition: absolute;\\n\\tinset: calc(var(--mtdsc-atlas-marker-inset) * -1);\\n\\tz-index: -1;\\n}\\n::slotted(mtds-atlas-marker[data-color]) {\\n\\t--mtdsc-atlas-marker-background: var(--mtds-color-base-default); /* Ensure data-color is respected */\\n\\t--mtdsc-atlas-marker-color: var(--mtds-color-base-contrast-default);\\n}\\n::slotted(mtds-atlas-marker.leaflet-drag-target) {\\n\\tcursor: grabbing;\\n}\\n\\n.leaflet-marker-generated-slot,\\n.leaflet-marker-icon slot { display: block; position: absolute; left: 0; top: 0; translate: -50% -100% }\\n.leaflet-marker-icon { background: none; border: 0 }\\n.leaflet-cluster-icon {\\n\\tbox-shadow: 0 3px 3px var(--mtdsc-atlas-marker-shadow);\\n\\tbackground-color: var(--mtds-color-base-default);\\n\\tborder-radius: 100%;\\n\\tborder: var(--mtdsc-atlas-cluster-border);\\n\\tbox-sizing: border-box;\\n\\toutline: 1px solid var(--mtds-color-base-default);\\n\\tcolor: var(--mtds-color-base-contrast-default);\\n\\tdisplay: flex;\\n\\tfont-size: var(--mtds-body-xs-font-size);\\n\\tfont-weight: var(--mtds-font-weight-bold);\\n\\tplace-content: center;\\n\\tplace-items: center;\\n}\\n\\n/* Popover */\\n.leaflet-popup:has(slot) .leaflet-popup-tip { background: var(--mtds-color-surface-default) }\\n.leaflet-popup:has(slot) .leaflet-popup-close-button { display: none } /* Popup closes on clicking marker anyway */\\n.leaflet-popup:has(slot) .leaflet-popup-content-wrapper { display: contents } /* No need for styling this element */\\n.leaflet-popup:has(slot) .leaflet-popup-content { margin: 0; font: inherit }\\n\""],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"atlas.css.js","sources":["../../designsystem/atlas/atlas.css?raw"],"sourcesContent":["export default \"/* NOTE: Using --mtds- not --mtds- since we're inside shadow dom */\\n:host {\\n\\t--mtdsc-atlas-border: 1px solid var(--mtds-color-border-subtle);\\n\\t--mtdsc-atlas-cluster-border: 1px solid;\\n\\t--mtdsc-atlas-marker-background: var(--mtds-color-base-default);\\n\\t--mtdsc-atlas-marker-border: 1px solid;\\n\\t--mtdsc-atlas-marker-color: var(--mtds-color-base-contrast-default);\\n\\t--mtdsc-atlas-marker-inset: 3px;\\n\\t--mtdsc-atlas-marker-shadow: rgba(0,0,0,.2);\\n\\t--mtdsc-atlas-marker-size: var(--mtds-6);\\n\\t--mtdsc-atlas-tile-background: #fbfbfb;\\n\\t--mtdsc-atlas-tile-filter: grayscale(1) contrast(0.75) brightness(1.15);\\n\\n\\tborder-radius: var(--mtds-border-radius-md);\\n\\taspect-ratio: 2;\\n\\toverflow: clip;\\n\\tposition: relative;\\n}\\n:host(:not([hidden])) { display: block }\\n:host([data-cursor=\\\"pointer\\\"]) .leaflet-grab { cursor: pointer }\\n\\n/* Focus */\\n.leaflet-control-zoom a:focus-visible,\\n:host:has(.leaflet-container:focus-visible),\\n::slotted(mtds-atlas-marker:focus-visible) {\\n\\tbox-shadow: var(--mtdsc-focus-boxShadow);\\n\\toutline: var(--mtdsc-focus-outline);\\n\\toutline-offset: var(--mtds-border-width-focus);\\n}\\n\\n/* Tiles */\\n.leaflet-kartverket-tiles { filter: var(--mtdsc-atlas-tile-filter); transition: filter 0.5s }\\n.leaflet-container {\\n\\tbackground: var(--mtdsc-atlas-tile-background);\\n\\tborder-radius: inherit;\\n\\tborder: var(--mtdsc-atlas-border);\\n\\tbox-sizing: border-box;\\n\\tfont: inherit;\\n\\theight: 100%;\\n\\tmargin: 0;\\n\\toutline: 0;\\n\\tposition: relative;\\n\\tz-index: 1; /* Ensure <slot> is always on top */\\n}\\n:host([data-tiles=\\\"color\\\"]) {\\n\\t--mtdsc-atlas-tile-background: #e5fcfd;\\n\\t--mtdsc-atlas-tile-filter: grayscale(0.2);\\n}\\n\\n/* Controls */\\n.leaflet-control-attribution { font-size: 12px; border-top-left-radius: var(--mtds-border-radius-md) }\\n.leaflet-control-zoom { border-radius: var(--mtds-border-radius-md); border: 1px solid var(--mtds-color-border-default) }\\n.leaflet-control-zoom a { background: var(--mtds-color-surface-default); border-color: inherit; color: var(--mtds-color-text-default); height: var(--mtds-10); line-height: var(--mtds-10); transition: 0.2s; width: var(--mtds-10) }\\n.leaflet-control-zoom a:first-child { border-top-left-radius: inherit; border-top-right-radius: inherit }\\n.leaflet-control-zoom a:last-child { border-bottom-left-radius: inherit; border-bottom-right-radius: inherit }\\n.leaflet-control-zoom a:hover { background: var(--mtds-color-surface-hover) }\\n.leaflet-control-zoom a:active { background: var(--mtds-color-surface-active) }\\n\\n/* Markers */\\n.leaflet-marker-generated-icon,\\n::slotted(mtds-atlas-marker) {\\n\\tall: unset;\\n\\tcolor: var(--mtdsc-atlas-marker-color);\\n\\tbackground: var(--mtdsc-atlas-marker-background);\\n\\tborder-radius: 100%;\\n\\tbox-sizing: border-box;\\n\\tcursor: pointer;\\n\\tdisplay: grid;\\n\\tplace-items: center;\\n\\tplace-content: center;\\n\\tfont-size: var(--mtds-body-sm-font-size);\\n\\tfont-weight: var(--mtds-font-weight-bold);\\n\\theight: var(--mtdsc-atlas-marker-size);\\n\\t/* biome-ignore lint/complexity/noImportantStyles: Overwrite Tailwind */\\n\\tmargin-bottom: calc(var(--mtdsc-atlas-marker-size) * .25 + var(--mtdsc-atlas-marker-inset))!important;\\n\\twidth: var(--mtdsc-atlas-marker-size);\\n}\\n.leaflet-marker-generated-icon::after,\\n::slotted(mtds-atlas-marker)::after {\\n\\tbox-shadow: 2px 2px 2px var(--mtdsc-atlas-marker-shadow);\\n\\taspect-ratio: 1;\\n\\tbackground: var(--mtdsc-atlas-marker-color);\\n\\tcolor: var(--mtdsc-atlas-marker-background);\\n\\tborder-radius: 50% 50% 0 50%;\\n\\t/* biome-ignore lint/complexity/noImportantStyles: Overwrite Tailwind */\\n\\tborder: var(--mtdsc-atlas-marker-border)!important;\\n\\tcontent: \\\"\\\";\\n\\trotate: 45deg;\\n\\tposition: absolute;\\n\\tinset: calc(var(--mtdsc-atlas-marker-inset) * -1);\\n\\tz-index: -1;\\n}\\n::slotted(mtds-atlas-marker[data-color]) {\\n\\t--mtdsc-atlas-marker-background: var(--mtds-color-base-default); /* Ensure data-color is respected */\\n\\t--mtdsc-atlas-marker-color: var(--mtds-color-base-contrast-default);\\n}\\n::slotted(mtds-atlas-marker.leaflet-drag-target) {\\n\\tcursor: grabbing;\\n}\\n\\n.leaflet-marker-generated-slot,\\n.leaflet-marker-icon slot { display: block; position: absolute; left: 0; top: 0; translate: -50% -100% }\\n.leaflet-marker-icon { background: none; border: 0 }\\n.leaflet-cluster-icon {\\n\\tbox-shadow: 0 3px 3px var(--mtdsc-atlas-marker-shadow);\\n\\tbackground-color: var(--mtds-color-base-default);\\n\\tborder-radius: 100%;\\n\\tborder: var(--mtdsc-atlas-cluster-border);\\n\\tbox-sizing: border-box;\\n\\toutline: 1px solid var(--mtds-color-base-default);\\n\\tcolor: var(--mtds-color-base-contrast-default);\\n\\tdisplay: flex;\\n\\tfont-size: var(--mtds-body-xs-font-size);\\n\\tfont-weight: var(--mtds-font-weight-bold);\\n\\tplace-content: center;\\n\\tplace-items: center;\\n}\\n\\n/* Popover */\\n.leaflet-popup:has(slot) .leaflet-popup-tip { background: var(--mtds-color-surface-default) }\\n.leaflet-popup:has(slot) .leaflet-popup-close-button { display: none } /* Popup closes on clicking marker anyway */\\n.leaflet-popup:has(slot) .leaflet-popup-content-wrapper { display: contents } /* No need for styling this element */\\n.leaflet-popup:has(slot) .leaflet-popup-content { margin: 0; font: inherit }\\n\""],"names":["css"],"mappings":"AAAA,MAAAA,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
package/mtds/atlas/atlas.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { toCustomElementProps } from "../utils.js";
|
|
4
|
-
import { MTDSAtlasElement } from "./atlas-element.js";
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
return /* @__PURE__ */
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as o } from "react";
|
|
3
|
+
import { toCustomElementProps as s } from "../utils.js";
|
|
4
|
+
import { MATGEO_URL as M, MTDSAtlasElement as p } from "./atlas-element.js";
|
|
5
|
+
const n = o(
|
|
6
|
+
function(t, r) {
|
|
7
|
+
return /* @__PURE__ */ a("mtds-atlas", { ref: r, ...s(t) });
|
|
8
8
|
}
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return /* @__PURE__ */ jsx("mtds-atlas-marker", { ref, ...toCustomElementProps(props) });
|
|
9
|
+
), c = Object.assign(n, {
|
|
10
|
+
Marker: o(
|
|
11
|
+
function(t, r) {
|
|
12
|
+
return /* @__PURE__ */ a("mtds-atlas-marker", { ref: r, ...s(t) });
|
|
14
13
|
}
|
|
15
14
|
),
|
|
16
|
-
Matgeo:
|
|
17
|
-
function
|
|
18
|
-
return /* @__PURE__ */
|
|
15
|
+
Matgeo: o(
|
|
16
|
+
function({ onFeatureClick: t, ...r }, m) {
|
|
17
|
+
return /* @__PURE__ */ a(
|
|
19
18
|
"mtds-atlas-matgeo",
|
|
20
19
|
{
|
|
21
|
-
ref,
|
|
22
|
-
onatlasfeatureclick:
|
|
23
|
-
...
|
|
20
|
+
ref: m,
|
|
21
|
+
onatlasfeatureclick: t,
|
|
22
|
+
...s(r)
|
|
24
23
|
}
|
|
25
24
|
);
|
|
26
25
|
}
|
|
27
26
|
),
|
|
28
|
-
WMS:
|
|
29
|
-
function
|
|
30
|
-
return /* @__PURE__ */
|
|
27
|
+
WMS: o(
|
|
28
|
+
function(t, r) {
|
|
29
|
+
return /* @__PURE__ */ a("mtds-atlas-wms", { ref: r, ...s(t) });
|
|
31
30
|
}
|
|
32
31
|
)
|
|
33
32
|
});
|
|
34
33
|
export {
|
|
35
|
-
Atlas,
|
|
36
|
-
|
|
34
|
+
c as Atlas,
|
|
35
|
+
M as MATGEO_URL,
|
|
36
|
+
p as MTDSAtlasElement
|
|
37
37
|
};
|
|
38
38
|
//# sourceMappingURL=atlas.js.map
|
package/mtds/atlas/atlas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atlas.js","sources":["../../designsystem/atlas/atlas.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { CustomReactElementProps } from \"../react-types\";\nimport { toCustomElementProps } from \"../utils\";\nimport type {\n\tMTDSAtlasElement,\n\tMTDSAtlasMarkerElement,\n\tMTDSAtlasMatgeoElement,\n\tMTDSAtlasWMSElement,\n} from \"./atlas-element\";\n\nexport * from \"./atlas-element\"; // Expose { L } for Leaflet import\n\ndeclare global {\n\tnamespace React.JSX {\n\t\tinterface IntrinsicElements {\n\t\t\t\"mtds-atlas\": CustomReactElementProps<MTDSAtlasElement> & {\n\t\t\t\t\"data-cluster\"?: number | `${number}` | boolean | \"true\" | \"false\";\n\t\t\t\t\"data-scrollzoom\"?: boolean | \"true\" | \"false\";\n\t\t\t\t\"data-tiles\"?: \"color\" | \"gray\";\n\t\t\t\t\"data-view\"?: string | number[];\n\t\t\t};\n\t\t\t\"mtds-atlas-marker\": CustomReactElementProps<MTDSAtlasMarkerElement> & {\n\t\t\t\t\"data-latlng\": string;\n\t\t\t};\n\t\t\t\"mtds-atlas-wms\": CustomReactElementProps<MTDSAtlasWMSElement> & {\n\t\t\t\t\"data-url\": string;\n\t\t\t};\n\t\t\t\"mtds-atlas-matgeo\": CustomReactElementProps<MTDSAtlasMatgeoElement> & {\n\t\t\t\t\"data-collection\": string;\n\t\t\t\tonatlasfeatureclick?: (\n\t\t\t\t\tevent: GlobalEventHandlersEventMap[\"atlasfeatureclick\"],\n\t\t\t\t) => void;\n\t\t\t};\n\t\t}\n\t}\n}\n\nexport type AtlasProps = React.JSX.IntrinsicElements[\"mtds-atlas\"];\nexport type AtlasMarkerProps = React.JSX.IntrinsicElements[\"mtds-atlas-marker\"];\nexport type AtlasWMSProps = React.JSX.IntrinsicElements[\"mtds-atlas-wms\"];\nexport type AtlasMatgeoProps =\n\tReact.JSX.IntrinsicElements[\"mtds-atlas-matgeo\"] & {\n\t\tonFeatureClick?: React.JSX.IntrinsicElements[\"mtds-atlas-matgeo\"][\"onatlasfeatureclick\"];\n\t};\n\nconst AtlasComp = forwardRef<MTDSAtlasElement, AtlasProps>(\n\tfunction Atlas(props, ref) {\n\t\treturn <mtds-atlas ref={ref} {...toCustomElementProps(props)} />;\n\t},\n);\n\nexport const Atlas = Object.assign(AtlasComp, {\n\tMarker: forwardRef<MTDSAtlasMarkerElement, AtlasMarkerProps>(\n\t\tfunction AtlasMarker(props, ref) {\n\t\t\treturn <mtds-atlas-marker ref={ref} {...toCustomElementProps(props)} />;\n\t\t},\n\t),\n\tMatgeo: forwardRef<MTDSAtlasMatgeoElement, AtlasMatgeoProps>(\n\t\tfunction AtlasMatgeo({ onFeatureClick, ...rest }, ref) {\n\t\t\treturn (\n\t\t\t\t<mtds-atlas-matgeo\n\t\t\t\t\tref={ref}\n\t\t\t\t\tonatlasfeatureclick={onFeatureClick}\n\t\t\t\t\t{...toCustomElementProps(rest)}\n\t\t\t\t/>\n\t\t\t);\n\t\t},\n\t),\n\tWMS: forwardRef<MTDSAtlasWMSElement, AtlasWMSProps>(\n\t\tfunction AtlasWMS(props, ref) {\n\t\t\treturn <mtds-atlas-wms ref={ref} {...toCustomElementProps(props)} />;\n\t\t},\n\t),\n});\n"],"names":["Atlas"],"mappings":";;;;AA6CA,
|
|
1
|
+
{"version":3,"file":"atlas.js","sources":["../../designsystem/atlas/atlas.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { CustomReactElementProps } from \"../react-types\";\nimport { toCustomElementProps } from \"../utils\";\nimport type {\n\tMTDSAtlasElement,\n\tMTDSAtlasMarkerElement,\n\tMTDSAtlasMatgeoElement,\n\tMTDSAtlasWMSElement,\n} from \"./atlas-element\";\n\nexport * from \"./atlas-element\"; // Expose { L } for Leaflet import\n\ndeclare global {\n\tnamespace React.JSX {\n\t\tinterface IntrinsicElements {\n\t\t\t\"mtds-atlas\": CustomReactElementProps<MTDSAtlasElement> & {\n\t\t\t\t\"data-cluster\"?: number | `${number}` | boolean | \"true\" | \"false\";\n\t\t\t\t\"data-scrollzoom\"?: boolean | \"true\" | \"false\";\n\t\t\t\t\"data-tiles\"?: \"color\" | \"gray\";\n\t\t\t\t\"data-view\"?: string | number[];\n\t\t\t};\n\t\t\t\"mtds-atlas-marker\": CustomReactElementProps<MTDSAtlasMarkerElement> & {\n\t\t\t\t\"data-latlng\": string;\n\t\t\t};\n\t\t\t\"mtds-atlas-wms\": CustomReactElementProps<MTDSAtlasWMSElement> & {\n\t\t\t\t\"data-url\": string;\n\t\t\t};\n\t\t\t\"mtds-atlas-matgeo\": CustomReactElementProps<MTDSAtlasMatgeoElement> & {\n\t\t\t\t\"data-collection\": string;\n\t\t\t\tonatlasfeatureclick?: (\n\t\t\t\t\tevent: GlobalEventHandlersEventMap[\"atlasfeatureclick\"],\n\t\t\t\t) => void;\n\t\t\t};\n\t\t}\n\t}\n}\n\nexport type AtlasProps = React.JSX.IntrinsicElements[\"mtds-atlas\"];\nexport type AtlasMarkerProps = React.JSX.IntrinsicElements[\"mtds-atlas-marker\"];\nexport type AtlasWMSProps = React.JSX.IntrinsicElements[\"mtds-atlas-wms\"];\nexport type AtlasMatgeoProps =\n\tReact.JSX.IntrinsicElements[\"mtds-atlas-matgeo\"] & {\n\t\tonFeatureClick?: React.JSX.IntrinsicElements[\"mtds-atlas-matgeo\"][\"onatlasfeatureclick\"];\n\t};\n\nconst AtlasComp = forwardRef<MTDSAtlasElement, AtlasProps>(\n\tfunction Atlas(props, ref) {\n\t\treturn <mtds-atlas ref={ref} {...toCustomElementProps(props)} />;\n\t},\n);\n\nexport const Atlas = Object.assign(AtlasComp, {\n\tMarker: forwardRef<MTDSAtlasMarkerElement, AtlasMarkerProps>(\n\t\tfunction AtlasMarker(props, ref) {\n\t\t\treturn <mtds-atlas-marker ref={ref} {...toCustomElementProps(props)} />;\n\t\t},\n\t),\n\tMatgeo: forwardRef<MTDSAtlasMatgeoElement, AtlasMatgeoProps>(\n\t\tfunction AtlasMatgeo({ onFeatureClick, ...rest }, ref) {\n\t\t\treturn (\n\t\t\t\t<mtds-atlas-matgeo\n\t\t\t\t\tref={ref}\n\t\t\t\t\tonatlasfeatureclick={onFeatureClick}\n\t\t\t\t\t{...toCustomElementProps(rest)}\n\t\t\t\t/>\n\t\t\t);\n\t\t},\n\t),\n\tWMS: forwardRef<MTDSAtlasWMSElement, AtlasWMSProps>(\n\t\tfunction AtlasWMS(props, ref) {\n\t\t\treturn <mtds-atlas-wms ref={ref} {...toCustomElementProps(props)} />;\n\t\t},\n\t),\n});\n"],"names":["AtlasComp","forwardRef","props","ref","toCustomElementProps","Atlas","onFeatureClick","rest","jsx"],"mappings":";;;;AA6CA,MAAMA,IAAYC;AAAA,EACjB,SAAeC,GAAOC,GAAK;AAC1B,6BAAQ,cAAA,EAAW,KAAAA,GAAW,GAAGC,EAAqBF,CAAK,GAAG;AAAA,EAC/D;AACD,GAEaG,IAAQ,OAAO,OAAOL,GAAW;AAAA,EAC7C,QAAQC;AAAA,IACP,SAAqBC,GAAOC,GAAK;AAChC,+BAAQ,qBAAA,EAAkB,KAAAA,GAAW,GAAGC,EAAqBF,CAAK,GAAG;AAAA,IACtE;AAAA,EAAA;AAAA,EAED,QAAQD;AAAA,IACP,SAAqB,EAAE,gBAAAK,GAAgB,GAAGC,EAAA,GAAQJ,GAAK;AACtD,aACC,gBAAAK;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,KAAAL;AAAA,UACA,qBAAqBG;AAAA,UACpB,GAAGF,EAAqBG,CAAI;AAAA,QAAA;AAAA,MAAA;AAAA,IAGhC;AAAA,EAAA;AAAA,EAED,KAAKN;AAAA,IACJ,SAAkBC,GAAOC,GAAK;AAC7B,+BAAQ,kBAAA,EAAe,KAAAA,GAAW,GAAGC,EAAqBF,CAAK,GAAG;AAAA,IACnE;AAAA,EAAA;AAEF,CAAC;"}
|
|
@@ -19,6 +19,7 @@ export declare const WithClustering: Story;
|
|
|
19
19
|
export declare const WithPopover: Story;
|
|
20
20
|
export declare const WithPopoverDynamic: Story;
|
|
21
21
|
export declare const WithMatgeo: Story;
|
|
22
|
+
export declare const WithMatgeoToggle: Story;
|
|
22
23
|
export declare const WithWMS: Story;
|
|
23
24
|
export declare const WithTooltip: Story;
|
|
24
25
|
export declare const WithClickToAddMarker: Story;
|