@mattilsynet/design 3.1.16 → 3.1.18

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.
Files changed (45) hide show
  1. package/mtds/atlas/atlas-element.d.ts +1 -1
  2. package/mtds/atlas/atlas-element.js +41 -42
  3. package/mtds/atlas/atlas-element.js.map +1 -1
  4. package/mtds/atlas/atlas-matgeo.d.ts +0 -1
  5. package/mtds/atlas/atlas-matgeo.js +20 -22
  6. package/mtds/atlas/atlas-matgeo.js.map +1 -1
  7. package/mtds/atlas.iife.js +4 -4
  8. package/mtds/chart/chart.js +13 -12
  9. package/mtds/chart/chart.js.map +1 -1
  10. package/mtds/details/details.js +9 -9
  11. package/mtds/details/details.js.map +1 -1
  12. package/mtds/dialog/dialog.js +8 -9
  13. package/mtds/dialog/dialog.js.map +1 -1
  14. package/mtds/field/field.js +0 -1
  15. package/mtds/index.d.ts +1 -1
  16. package/mtds/index.iife.js +16 -196
  17. package/mtds/index.js +17 -35
  18. package/mtds/index.js.map +1 -1
  19. package/mtds/logo/logo.js +15 -7
  20. package/mtds/logo/logo.js.map +1 -1
  21. package/mtds/package.json.js +1 -1
  22. package/mtds/print/print.d.ts +8 -0
  23. package/mtds/print/print.js +11 -0
  24. package/mtds/print/print.js.map +1 -0
  25. package/mtds/print/print.stories.d.ts +2 -0
  26. package/mtds/react.d.ts +1 -0
  27. package/mtds/react.js +30 -28
  28. package/mtds/react.js.map +1 -1
  29. package/mtds/styles.css +1 -1
  30. package/mtds/styles.json +45 -44
  31. package/mtds/styles.module.css.js +82 -80
  32. package/mtds/styles.module.css.js.map +1 -1
  33. package/mtds/tag/tag.js +14 -5
  34. package/mtds/tag/tag.js.map +1 -1
  35. package/mtds/toast/toast.js +0 -1
  36. package/mtds/utils.d.ts +1 -1
  37. package/mtds/utils.js +7 -7
  38. package/mtds/utils.js.map +1 -1
  39. package/package.json +16 -14
  40. package/mtds/external/@u-elements/u-combobox/dist/u-combobox.js +0 -284
  41. package/mtds/external/@u-elements/u-combobox/dist/u-combobox.js.map +0 -1
  42. package/mtds/external/@u-elements/u-tabs/dist/u-tabs.js +0 -201
  43. package/mtds/external/@u-elements/u-tabs/dist/u-tabs.js.map +0 -1
  44. package/mtds/print/print.css.js +0 -185
  45. package/mtds/print/print.css.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import { default as L } from 'leaflet';
2
2
  import { MTDSElement } from '../utils';
3
- export { L };
4
3
  export { MTDSAtlasMarkerElement } from './atlas-marker';
5
4
  export { MTDSAtlasMatgeoElement } from './atlas-matgeo';
6
5
  export { MTDSAtlasWMSElement } from './atlas-wms';
6
+ export { L };
7
7
  type Link = {
8
8
  href: string;
9
9
  rel: string;
@@ -1,96 +1,95 @@
1
1
  import i from "../external/leaflet/dist/leaflet-src.js";
2
- import f from "../external/leaflet/dist/leaflet.css.js";
2
+ import h from "../external/leaflet/dist/leaflet.css.js";
3
3
  import "./cluster.js";
4
- import { isBrowser as h, defineElement as g, MTDSElement as C, tag as p, attachStyle as v, attr as a, on as w, off as b } from "../utils.js";
5
- import k from "./atlas.css.js";
6
- import { MTDSAtlasMarkerElement as z } from "./atlas-marker.js";
7
- import { MTDSAtlasMatgeoElement as B } from "./atlas-matgeo.js";
8
- import { MTDSAtlasWMSElement as K } from "./atlas-wms.js";
9
- let r = 0;
10
- const d = 18, S = "https://cache.kartverket.no/v1/wmts/1.0.0/topo/default/webmercator/{z}/{y}/{x}.png", E = "https://matgeoservice-256616427209.europe-north1.run.app/ogc/features/collections", T = [
4
+ import { defineElement as u, isBrowser as f, MTDSElement as g, tag as m, attachStyle as C, attr as a, on as v, off as w } from "../utils.js";
5
+ import b from "./atlas.css.js";
6
+ import { MTDSAtlasMarkerElement as O } from "./atlas-marker.js";
7
+ import { MTDSAtlasMatgeoElement as R } from "./atlas-matgeo.js";
8
+ import { MTDSAtlasWMSElement as D } from "./atlas-wms.js";
9
+ let l = 0;
10
+ const p = 18, k = "https://cache.kartverket.no/v1/wmts/1.0.0/topo/default/webmercator/{z}/{y}/{x}.png", S = "https://matgeoservice-256616427209.europe-north1.run.app/ogc/features/collections", E = [
11
11
  [57.5, 4.73],
12
12
  [71.5, 31.44]
13
13
  ];
14
- h() && !window._matgeoCollections && (window._matgeoCollections = fetch(E).then((l) => l.json()).then((l) => l.collections.map((t) => [t.id, t])).then(Object.fromEntries));
15
- class c extends C {
14
+ class r extends g {
16
15
  cluster;
17
16
  map;
18
17
  static get observedAttributes() {
19
18
  return ["data-view", "data-scrollzoom"];
20
19
  }
21
20
  constructor() {
22
- super(), this.attachShadow({ mode: "open" }).append(p("figure")), v(this, `@layer leaflet{${f}}
23
- @layer mt.v3-1-16design{${k}`);
21
+ super(), this.attachShadow({ mode: "open" }).append(m("figure")), C(this, `@layer leaflet{${h}}
22
+ @layer mt.v3-1-18design{${b}`);
24
23
  }
25
24
  connectedCallback() {
26
- const t = this.shadowRoot?.lastElementChild, o = a(this, "data-cluster") ?? "false", e = new i.TileLayer(S, {
25
+ const t = this.shadowRoot?.lastElementChild, e = a(this, "data-cluster") ?? "false", o = new i.TileLayer(k, {
27
26
  attribution: "© Kartverket",
28
27
  className: "leaflet-kartverket-tiles",
29
- maxZoom: d
28
+ maxZoom: p
30
29
  });
31
30
  this.map = new i.Map(t, {
32
31
  attributionControl: !1,
33
32
  fadeAnimation: !1,
34
33
  // Prevent popup fades
35
- layers: [e],
34
+ layers: [o],
36
35
  zoomControl: !1,
37
36
  zoomSnap: 0.2
38
- }), w(this, "pointerup click", this.#t), this.map.addControl(new i.Control.Attribution({ prefix: "" })), this.map.addControl(new i.Control.Zoom({ position: "bottomright" })), this.map.on("popupopen popupclose", this.#e, this), this.cluster = new i.MarkerClusterGroup({
37
+ }), v(this, "pointerup click", this.#t), this.map.addControl(new i.Control.Attribution({ prefix: "" })), this.map.addControl(new i.Control.Zoom({ position: "bottomright" })), this.map.on("popupopen popupclose", this.#e, this), this.cluster = new i.MarkerClusterGroup({
39
38
  zoomToBoundsOnClick: !0,
40
39
  showCoverageOnHover: !1,
41
- disableClusteringAtZoom: o === "false" ? 1 : Number(o) || d + 1,
40
+ disableClusteringAtZoom: e === "false" ? 1 : Number(e) || p + 1,
42
41
  iconCreateFunction: (s) => new i.DivIcon({
43
42
  html: `${s.getChildCount()}`,
44
43
  className: "leaflet-cluster-icon",
45
44
  iconSize: [30, 30]
46
45
  })
47
46
  }).addTo(this.map);
48
- for (const s of c.observedAttributes)
47
+ for (const s of r.observedAttributes)
49
48
  this.attributeChangedCallback(s, null, a(this, s));
50
49
  }
51
- attributeChangedCallback(t, o, e) {
52
- t === "data-view" && this.setView(e || ""), t === "data-scrollzoom" && this.map?.scrollWheelZoom[e === "false" ? "disable" : "enable"]();
50
+ attributeChangedCallback(t, e, o) {
51
+ t === "data-view" && this.setView(o || ""), t === "data-scrollzoom" && this.map?.scrollWheelZoom[o === "false" ? "disable" : "enable"]();
53
52
  }
54
- setView(t, o) {
55
- const e = `${t}`.split(",").map(parseFloat).filter(Number.isFinite), s = this.cluster?.getBounds();
56
- if (e.length === 3) return this.map?.setView([e[0], e[1]], e[2], o);
57
- if (t !== "fit") return this.map?.fitBounds(T, o);
58
- if (s?.isValid()) return this.map?.fitBounds(s.pad(0.1), o);
53
+ setView(t, e) {
54
+ const o = `${t}`.split(",").map(parseFloat).filter(Number.isFinite), s = this.cluster?.getBounds();
55
+ if (o.length === 3) return this.map?.setView([o[0], o[1]], o[2], e);
56
+ if (t !== "fit") return this.map?.fitBounds(E, e);
57
+ if (s?.isValid()) return this.map?.fitBounds(s.pad(0.1), e);
59
58
  this.cluster?.once("layeradd", () => {
60
59
  setTimeout(() => this.setView("fit"), 50);
61
60
  });
62
61
  }
63
- latLngFromPoint(t, o) {
64
- return this.map?.pointerEventToLatLng({ clientX: t, clientY: o });
62
+ latLngFromPoint(t, e) {
63
+ return this.map?.pointerEventToLatLng({ clientX: t, clientY: e });
65
64
  }
66
65
  disconnectedCallback() {
67
- b(this, "pointerup click", this.#t), this.map?.remove(), this.map = this.cluster = void 0;
66
+ w(this, "pointerup click", this.#t), this.map?.remove(), this.map = this.cluster = void 0;
68
67
  }
69
68
  async getCollections() {
70
- return window._matgeoCollections || Promise.resolve({});
69
+ return window._matgeoCollections || (window._matgeoCollections = fetch(S).then((t) => t.json()).then((t) => t.collections.map((e) => [e.id, e])).then(Object.fromEntries)), window._matgeoCollections;
71
70
  }
72
- #e({ type: t, popup: o }) {
73
- const e = t === "popupopen", s = o.getElement()?.querySelector(".leaflet-popup-content"), u = s?.querySelector(":scope > slot"), m = s?.textContent?.match(/^#(\S+)/)?.[1] || "", n = document.getElementById(u?.name || m);
74
- if (!n) return e && m && o.close();
75
- i.Util.setOptions(o, { maxWidth: this.offsetWidth - 40 }), a(n, "data-popover", e ? a(n, "popover") : null), a(n, "popover", e ? null : a(n, "data-popover")), a(n, "slot", e ? n.id : null), e && o.setContent(p("slot", { name: n.id }));
71
+ #e({ type: t, popup: e }) {
72
+ const o = t === "popupopen", s = e.getElement()?.querySelector(".leaflet-popup-content"), d = s?.querySelector(":scope > slot"), c = s?.textContent?.match(/^#(\S+)/)?.[1] || "", n = document.getElementById(d?.name || c);
73
+ if (!n) return o && c && e.close();
74
+ i.Util.setOptions(e, { maxWidth: this.offsetWidth - 40 }), a(n, "data-popover", o ? a(n, "popover") : null), a(n, "popover", o ? null : a(n, "data-popover")), a(n, "slot", o ? n.id : null), o && e.setContent(m("slot", { name: n.id }));
76
75
  }
77
76
  #t(t) {
78
- t.type === "click" ? r && t.stopPropagation?.() : document.body.classList.contains("leaflet-dragging") && (r = setTimeout(() => {
79
- r = 0;
77
+ t.type === "click" ? l && t.stopPropagation?.() : document.body.classList.contains("leaflet-dragging") && (l = setTimeout(() => {
78
+ l = 0;
80
79
  }, 50));
81
80
  }
82
81
  }
83
- g("mtds-atlas", c);
84
- h() && (i.Marker.prototype.options.icon = new i.DivIcon({
82
+ u("mtds-atlas", r);
83
+ f() && (i.Marker.prototype.options.icon = new i.DivIcon({
85
84
  html: '<div class="leaflet-marker-generated-slot"><div class="leaflet-marker-generated-icon"></div></div>',
86
85
  iconSize: [0, 0]
87
86
  }));
88
87
  export {
89
88
  i as L,
90
- E as MATGEO_URL,
91
- c as MTDSAtlasElement,
92
- z as MTDSAtlasMarkerElement,
93
- B as MTDSAtlasMatgeoElement,
94
- K as MTDSAtlasWMSElement
89
+ S as MATGEO_URL,
90
+ r as MTDSAtlasElement,
91
+ O as MTDSAtlasMarkerElement,
92
+ R as MTDSAtlasMatgeoElement,
93
+ D as MTDSAtlasWMSElement
95
94
  };
96
95
  //# sourceMappingURL=atlas-element.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"atlas-element.js","sources":["../../designsystem/atlas/atlas-element.ts"],"sourcesContent":["import L from \"leaflet\";\nimport LeafletCSS from \"leaflet/dist/leaflet.css?raw\";\nimport type {} from \"leaflet.markercluster\"; // Extend L namespace\nimport \"./cluster.js\";\nimport {\n\tattachStyle,\n\tattr,\n\tdefineElement,\n\tisBrowser,\n\tMTDSElement,\n\toff,\n\ton,\n\ttag,\n} from \"../utils\";\nimport css from \"./atlas.css?raw\";\nexport { L };\nexport { MTDSAtlasMarkerElement } from \"./atlas-marker\";\nexport { MTDSAtlasMatgeoElement } from \"./atlas-matgeo\";\nexport { MTDSAtlasWMSElement } from \"./atlas-wms\";\n\n// TODO: Add minimum zoom level for adding markers (minimum 17 som standard?)\n// TODO: Add search helper (https://ws.geonorge.no/adresser/v1/openapi.json + https://ws.geonorge.no/adresser/v1/#/default/get_sok)\n// TODO: matgeo-autoload popover info\n\ntype Link = { href: string; rel: string; type: string; title: string };\ntype BBox = [number, number, number, number];\nexport type MTDSAtlasCollections = Record<string, MTDSAtlasCollection>;\nexport type MTDSAtlasCollection = {\n\tcrs: string[];\n\tdescription: string;\n\textent: { spatial: { bbox: BBox[] } };\n\tgeometry: string;\n\tid: string;\n\titemType: string;\n\tlinks: Link[];\n\ttitle: string;\n};\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t\"mtds-atlas\": MTDSAtlasElement;\n\t}\n\n\tinterface Window {\n\t\t_matgeoCollections?: Promise<MTDSAtlasCollections>;\n\t}\n}\n\nlet SKIP_CLICK: number | NodeJS.Timeout = 0;\nconst KARTVERKET_MAX_ZOOM = 18; // Kartverket does not support more than zoom level 18\nconst KARTVERKET_TILES_URL =\n\t\"https://cache.kartverket.no/v1/wmts/1.0.0/topo/default/webmercator/{z}/{y}/{x}.png\";\nexport const MATGEO_URL =\n\t\"https://matgeoservice-256616427209.europe-north1.run.app/ogc/features/collections\";\nconst BOUNDS_NORWAY: L.LatLngBoundsLiteral = [\n\t[57.5, 4.73],\n\t[71.5, 31.44],\n];\n\nif (isBrowser() && !window._matgeoCollections)\n\twindow._matgeoCollections = fetch(MATGEO_URL)\n\t\t.then((res) => res.json())\n\t\t.then((d) => d.collections.map((c: MTDSAtlasCollection) => [c.id, c]))\n\t\t.then(Object.fromEntries);\n\nexport class MTDSAtlasElement extends MTDSElement {\n\tcluster?: L.MarkerClusterGroup;\n\tmap?: L.Map;\n\n\tstatic get observedAttributes() {\n\t\treturn [\"data-view\", \"data-scrollzoom\"]; // Using ES2015 syntax for backwards compatibility\n\t}\n\tconstructor() {\n\t\tsuper();\n\t\tthis.attachShadow({ mode: \"open\" }).append(tag(\"figure\"));\n\t\tattachStyle(this, `@layer leaflet{${LeafletCSS}}\\n@layer mt.design{${css}`);\n\t}\n\tconnectedCallback() {\n\t\tconst container = this.shadowRoot?.lastElementChild as HTMLElement;\n\t\tconst cluster = attr(this, \"data-cluster\") ?? \"false\";\n\t\tconst tiles = new L.TileLayer(KARTVERKET_TILES_URL, {\n\t\t\tattribution: \"&copy; Kartverket\",\n\t\t\tclassName: \"leaflet-kartverket-tiles\",\n\t\t\tmaxZoom: KARTVERKET_MAX_ZOOM,\n\t\t});\n\n\t\tthis.map = new L.Map(container, {\n\t\t\tattributionControl: false,\n\t\t\tfadeAnimation: false, // Prevent popup fades\n\t\t\tlayers: [tiles],\n\t\t\tzoomControl: false,\n\t\t\tzoomSnap: 0.2,\n\t\t});\n\n\t\ton(this, \"pointerup click\", this.#skipClick); // Prevent clicks from bubbling up unless sent from Leaflet\n\t\tthis.map.addControl(new L.Control.Attribution({ prefix: \"\" }));\n\t\tthis.map.addControl(new L.Control.Zoom({ position: \"bottomright\" }));\n\t\tthis.map.on(\"popupopen popupclose\", this.#handlePopup, this);\n\t\tthis.cluster = new L.MarkerClusterGroup({\n\t\t\tzoomToBoundsOnClick: true,\n\t\t\tshowCoverageOnHover: false,\n\t\t\tdisableClusteringAtZoom:\n\t\t\t\tcluster === \"false\" ? 1 : Number(cluster) || KARTVERKET_MAX_ZOOM + 1,\n\t\t\ticonCreateFunction: (cluster: L.MarkerCluster) =>\n\t\t\t\tnew L.DivIcon({\n\t\t\t\t\thtml: `${cluster.getChildCount()}`,\n\t\t\t\t\tclassName: \"leaflet-cluster-icon\",\n\t\t\t\t\ticonSize: [30, 30],\n\t\t\t\t}),\n\t\t}).addTo(this.map);\n\n\t\t// Initial setup attributes\n\t\tfor (const name of MTDSAtlasElement.observedAttributes)\n\t\t\tthis.attributeChangedCallback(name, null, attr(this, name));\n\t}\n\tattributeChangedCallback(name: string, _prev?: null, next?: string | null) {\n\t\tif (name === \"data-view\") this.setView(next || \"\");\n\t\tif (name === \"data-scrollzoom\")\n\t\t\tthis.map?.scrollWheelZoom[next === \"false\" ? \"disable\" : \"enable\"]();\n\t}\n\tsetView(view: string | number[], opts?: L.FitBoundsOptions) {\n\t\tconst p = `${view}`.split(\",\").map(parseFloat).filter(Number.isFinite);\n\t\tconst b = this.cluster?.getBounds();\n\n\t\tif (p.length === 3) return this.map?.setView([p[0], p[1]], p[2], opts);\n\t\tif (view !== \"fit\") return this.map?.fitBounds(BOUNDS_NORWAY, opts);\n\t\tif (b?.isValid()) return this.map?.fitBounds(b.pad(0.1), opts);\n\t\tthis.cluster?.once(\"layeradd\", () => {\n\t\t\tsetTimeout(() => this.setView(\"fit\"), 50); // Add all markers before fitting\n\t\t});\n\t}\n\tlatLngFromPoint(x: number, y: number) {\n\t\t// @ts-expect-error -- Missing from Leaflet@2.0.0-alpha.1 types\n\t\treturn this.map?.pointerEventToLatLng({ clientX: x, clientY: y });\n\t}\n\tdisconnectedCallback() {\n\t\toff(this, \"pointerup click\", this.#skipClick);\n\t\tthis.map?.remove();\n\t\tthis.map = this.cluster = undefined;\n\t}\n\tasync getCollections() {\n\t\treturn (\n\t\t\twindow._matgeoCollections || Promise.resolve({} as MTDSAtlasCollections)\n\t\t);\n\t}\n\t#handlePopup({ type, popup }: { type: string; popup: L.Popup }) {\n\t\tconst open = type === \"popupopen\";\n\t\tconst cont = popup.getElement()?.querySelector(\".leaflet-popup-content\");\n\t\tconst slot = cont?.querySelector<HTMLSlotElement>(\":scope > slot\");\n\t\tconst id = cont?.textContent?.match(/^#(\\S+)/)?.[1] || \"\";\n\t\tconst el = document.getElementById(slot?.name || id); // If content of popup is #id, replace with <slot>\n\n\t\tif (!el) return open && id && popup.close(); // Close popup if target element not found\n\t\tL.Util.setOptions(popup, { maxWidth: this.offsetWidth - 40 });\n\t\tattr(el, \"data-popover\", open ? attr(el, \"popover\") : null); // Store previous popover mode\n\t\tattr(el, \"popover\", open ? null : attr(el, \"data-popover\")); // But temporarily remove it so popover renders\n\t\tattr(el, \"slot\", open ? el.id : null); // Render popover in slot\n\t\tif (open) popup.setContent(tag(\"slot\", { name: el.id }));\n\t}\n\t#skipClick(event: Partial<MouseEvent>) {\n\t\tif (event.type === \"click\") SKIP_CLICK && event.stopPropagation?.();\n\t\telse if (document.body.classList.contains(\"leaflet-dragging\"))\n\t\t\tSKIP_CLICK = setTimeout(() => {\n\t\t\t\tSKIP_CLICK = 0;\n\t\t\t}, 50); // Was dragging, so skip succeeding click\n\t}\n}\n\ndefineElement(\"mtds-atlas\", MTDSAtlasElement);\n\nif (isBrowser())\n\tL.Marker.prototype.options.icon = new L.DivIcon({\n\t\thtml: '<div class=\"leaflet-marker-generated-slot\"><div class=\"leaflet-marker-generated-icon\"></div></div>',\n\t\ticonSize: [0, 0],\n\t});\n"],"names":["SKIP_CLICK","KARTVERKET_MAX_ZOOM","KARTVERKET_TILES_URL","MATGEO_URL","BOUNDS_NORWAY","isBrowser","res","d","c","MTDSAtlasElement","MTDSElement","tag","attachStyle","LeafletCSS","css","container","cluster","attr","tiles","L","on","#skipClick","#handlePopup","name","_prev","next","view","opts","p","b","x","y","off","type","popup","open","cont","slot","id","el","event","defineElement"],"mappings":";;;;;;;;AAgDA,IAAIA,IAAsC;AAC1C,MAAMC,IAAsB,IACtBC,IACL,sFACYC,IACZ,qFACKC,IAAuC;AAAA,EAC5C,CAAC,MAAM,IAAI;AAAA,EACX,CAAC,MAAM,KAAK;AACb;AAEIC,EAAA,KAAe,CAAC,OAAO,uBAC1B,OAAO,qBAAqB,MAAMF,CAAU,EAC1C,KAAK,CAACG,MAAQA,EAAI,MAAM,EACxB,KAAK,CAACC,MAAMA,EAAE,YAAY,IAAI,CAACC,MAA2B,CAACA,EAAE,IAAIA,CAAC,CAAC,CAAC,EACpE,KAAK,OAAO,WAAW;AAEnB,MAAMC,UAAyBC,EAAY;AAAA,EACjD;AAAA,EACA;AAAA,EAEA,WAAW,qBAAqB;AAC/B,WAAO,CAAC,aAAa,iBAAiB;AAAA,EACvC;AAAA,EACA,cAAc;AACb,UAAA,GACA,KAAK,aAAa,EAAE,MAAM,OAAA,CAAQ,EAAE,OAAOC,EAAI,QAAQ,CAAC,GACxDC,EAAY,MAAM,kBAAkBC,CAAU;AAAA,0BAA4BC,CAAA,EAAA;AAAA,EAC3E;AAAA,EACA,oBAAoB;AACnB,UAAMC,IAAY,KAAK,YAAY,kBAC7BC,IAAUC,EAAK,MAAM,cAAc,KAAK,SACxCC,IAAQ,IAAIC,EAAE,UAAUjB,GAAsB;AAAA,MACnD,aAAa;AAAA,MACb,WAAW;AAAA,MACX,SAASD;AAAA,IAAA,CACT;AAED,SAAK,MAAM,IAAIkB,EAAE,IAAIJ,GAAW;AAAA,MAC/B,o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,IAAOI,EAAG,KAAK,IAAI,GAChCJ,KAAMD,EAAM,WAAWvB,EAAI,QAAQ,EAAE,MAAM4B,EAAG,GAAA,CAAI,CAAC;AAAA,EACxD;AAAA,EACAlB,GAAWmB,GAA4B;AACtC,IAAIA,EAAM,SAAS,UAASxC,KAAcwC,EAAM,kBAAA,IACvC,SAAS,KAAK,UAAU,SAAS,kBAAkB,MAC3DxC,IAAa,WAAW,MAAM;AAC7B,MAAAA,IAAa;AAAA,IACd,GAAG,EAAE;AAAA,EACP;AACD;AAEAyC,EAAc,cAAchC,CAAgB;AAExCJ,EAAA,MACHc,EAAE,OAAO,UAAU,QAAQ,OAAO,IAAIA,EAAE,QAAQ;AAAA,EAC/C,MAAM;AAAA,EACN,UAAU,CAAC,GAAG,CAAC;AAAA,CACf;"}
1
+ {"version":3,"file":"atlas-element.js","sources":["../../designsystem/atlas/atlas-element.ts"],"sourcesContent":["import L from \"leaflet\";\nimport LeafletCSS from \"leaflet/dist/leaflet.css?raw\";\nimport type {} from \"leaflet.markercluster\"; // Extend L namespace\nimport \"./cluster.js\";\nimport {\n\tattachStyle,\n\tattr,\n\tdefineElement,\n\tisBrowser,\n\tMTDSElement,\n\toff,\n\ton,\n\ttag,\n} from \"../utils\";\nimport css from \"./atlas.css?raw\";\n\nexport { MTDSAtlasMarkerElement } from \"./atlas-marker\";\nexport { MTDSAtlasMatgeoElement } from \"./atlas-matgeo\";\nexport { MTDSAtlasWMSElement } from \"./atlas-wms\";\nexport { L };\n\n// TODO: Add minimum zoom level for adding markers (minimum 17 som standard?)\n// TODO: Add search helper (https://ws.geonorge.no/adresser/v1/openapi.json + https://ws.geonorge.no/adresser/v1/#/default/get_sok)\n// TODO: matgeo-autoload popover info\n\ntype Link = { href: string; rel: string; type: string; title: string };\ntype BBox = [number, number, number, number];\nexport type MTDSAtlasCollections = Record<string, MTDSAtlasCollection>;\nexport type MTDSAtlasCollection = {\n\tcrs: string[];\n\tdescription: string;\n\textent: { spatial: { bbox: BBox[] } };\n\tgeometry: string;\n\tid: string;\n\titemType: string;\n\tlinks: Link[];\n\ttitle: string;\n};\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t\"mtds-atlas\": MTDSAtlasElement;\n\t}\n\n\tinterface Window {\n\t\t_matgeoCollections?: Promise<MTDSAtlasCollections>;\n\t}\n}\n\nlet SKIP_CLICK: number | NodeJS.Timeout = 0;\nconst KARTVERKET_MAX_ZOOM = 18; // Kartverket does not support more than zoom level 18\nconst KARTVERKET_TILES_URL =\n\t\"https://cache.kartverket.no/v1/wmts/1.0.0/topo/default/webmercator/{z}/{y}/{x}.png\";\nexport const MATGEO_URL =\n\t\"https://matgeoservice-256616427209.europe-north1.run.app/ogc/features/collections\";\nconst BOUNDS_NORWAY: L.LatLngBoundsLiteral = [\n\t[57.5, 4.73],\n\t[71.5, 31.44],\n];\n\nexport class MTDSAtlasElement extends MTDSElement {\n\tcluster?: L.MarkerClusterGroup;\n\tmap?: L.Map;\n\n\tstatic get observedAttributes() {\n\t\treturn [\"data-view\", \"data-scrollzoom\"]; // Using ES2015 syntax for backwards compatibility\n\t}\n\tconstructor() {\n\t\tsuper();\n\t\tthis.attachShadow({ mode: \"open\" }).append(tag(\"figure\"));\n\t\tattachStyle(this, `@layer leaflet{${LeafletCSS}}\\n@layer mt.design{${css}`);\n\t}\n\tconnectedCallback() {\n\t\tconst container = this.shadowRoot?.lastElementChild as HTMLElement;\n\t\tconst cluster = attr(this, \"data-cluster\") ?? \"false\";\n\t\tconst tiles = new L.TileLayer(KARTVERKET_TILES_URL, {\n\t\t\tattribution: \"&copy; Kartverket\",\n\t\t\tclassName: \"leaflet-kartverket-tiles\",\n\t\t\tmaxZoom: KARTVERKET_MAX_ZOOM,\n\t\t});\n\n\t\tthis.map = new L.Map(container, {\n\t\t\tattributionControl: false,\n\t\t\tfadeAnimation: false, // Prevent popup fades\n\t\t\tlayers: [tiles],\n\t\t\tzoomControl: false,\n\t\t\tzoomSnap: 0.2,\n\t\t});\n\n\t\ton(this, \"pointerup click\", this.#skipClick); // Prevent clicks from bubbling up unless sent from Leaflet\n\t\tthis.map.addControl(new L.Control.Attribution({ prefix: \"\" }));\n\t\tthis.map.addControl(new L.Control.Zoom({ position: \"bottomright\" }));\n\t\tthis.map.on(\"popupopen popupclose\", this.#handlePopup, this);\n\t\tthis.cluster = new L.MarkerClusterGroup({\n\t\t\tzoomToBoundsOnClick: true,\n\t\t\tshowCoverageOnHover: false,\n\t\t\tdisableClusteringAtZoom:\n\t\t\t\tcluster === \"false\" ? 1 : Number(cluster) || KARTVERKET_MAX_ZOOM + 1,\n\t\t\ticonCreateFunction: (cluster: L.MarkerCluster) =>\n\t\t\t\tnew L.DivIcon({\n\t\t\t\t\thtml: `${cluster.getChildCount()}`,\n\t\t\t\t\tclassName: \"leaflet-cluster-icon\",\n\t\t\t\t\ticonSize: [30, 30],\n\t\t\t\t}),\n\t\t}).addTo(this.map);\n\n\t\t// Initial setup attributes\n\t\tfor (const name of MTDSAtlasElement.observedAttributes)\n\t\t\tthis.attributeChangedCallback(name, null, attr(this, name));\n\t}\n\tattributeChangedCallback(name: string, _prev?: null, next?: string | null) {\n\t\tif (name === \"data-view\") this.setView(next || \"\");\n\t\tif (name === \"data-scrollzoom\")\n\t\t\tthis.map?.scrollWheelZoom[next === \"false\" ? \"disable\" : \"enable\"]();\n\t}\n\tsetView(view: string | number[], opts?: L.FitBoundsOptions) {\n\t\tconst p = `${view}`.split(\",\").map(parseFloat).filter(Number.isFinite);\n\t\tconst b = this.cluster?.getBounds();\n\n\t\tif (p.length === 3) return this.map?.setView([p[0], p[1]], p[2], opts);\n\t\tif (view !== \"fit\") return this.map?.fitBounds(BOUNDS_NORWAY, opts);\n\t\tif (b?.isValid()) return this.map?.fitBounds(b.pad(0.1), opts);\n\t\tthis.cluster?.once(\"layeradd\", () => {\n\t\t\tsetTimeout(() => this.setView(\"fit\"), 50); // Add all markers before fitting\n\t\t});\n\t}\n\tlatLngFromPoint(x: number, y: number) {\n\t\t// @ts-expect-error -- Missing from Leaflet@2.0.0-alpha.1 types\n\t\treturn this.map?.pointerEventToLatLng({ clientX: x, clientY: y });\n\t}\n\tdisconnectedCallback() {\n\t\toff(this, \"pointerup click\", this.#skipClick);\n\t\tthis.map?.remove();\n\t\tthis.map = this.cluster = undefined;\n\t}\n\tasync getCollections() {\n\t\tif (!window._matgeoCollections)\n\t\t\twindow._matgeoCollections = fetch(MATGEO_URL)\n\t\t\t\t.then((res) => res.json())\n\t\t\t\t.then((d) => d.collections.map((c: MTDSAtlasCollection) => [c.id, c]))\n\t\t\t\t.then(Object.fromEntries);\n\t\treturn window._matgeoCollections;\n\t}\n\t#handlePopup({ type, popup }: { type: string; popup: L.Popup }) {\n\t\tconst open = type === \"popupopen\";\n\t\tconst cont = popup.getElement()?.querySelector(\".leaflet-popup-content\");\n\t\tconst slot = cont?.querySelector<HTMLSlotElement>(\":scope > slot\");\n\t\tconst id = cont?.textContent?.match(/^#(\\S+)/)?.[1] || \"\";\n\t\tconst el = document.getElementById(slot?.name || id); // If content of popup is #id, replace with <slot>\n\n\t\tif (!el) return open && id && popup.close(); // Close popup if target element not found\n\t\tL.Util.setOptions(popup, { maxWidth: this.offsetWidth - 40 });\n\t\tattr(el, \"data-popover\", open ? attr(el, \"popover\") : null); // Store previous popover mode\n\t\tattr(el, \"popover\", open ? null : attr(el, \"data-popover\")); // But temporarily remove it so popover renders\n\t\tattr(el, \"slot\", open ? el.id : null); // Render popover in slot\n\t\tif (open) popup.setContent(tag(\"slot\", { name: el.id }));\n\t}\n\t#skipClick(event: Partial<MouseEvent>) {\n\t\tif (event.type === \"click\") SKIP_CLICK && event.stopPropagation?.();\n\t\telse if (document.body.classList.contains(\"leaflet-dragging\"))\n\t\t\tSKIP_CLICK = setTimeout(() => {\n\t\t\t\tSKIP_CLICK = 0;\n\t\t\t}, 50); // Was dragging, so skip succeeding click\n\t}\n}\n\ndefineElement(\"mtds-atlas\", MTDSAtlasElement);\n\nif (isBrowser())\n\tL.Marker.prototype.options.icon = new L.DivIcon({\n\t\thtml: '<div class=\"leaflet-marker-generated-slot\"><div class=\"leaflet-marker-generated-icon\"></div></div>',\n\t\ticonSize: [0, 0],\n\t});\n"],"names":["SKIP_CLICK","KARTVERKET_MAX_ZOOM","KARTVERKET_TILES_URL","MATGEO_URL","BOUNDS_NORWAY","MTDSAtlasElement","MTDSElement","tag","attachStyle","LeafletCSS","css","container","cluster","attr","tiles","L","on","#skipClick","#handlePopup","name","_prev","next","view","opts","p","b","x","y","off","res","d","c","type","popup","open","cont","slot","id","el","event","defineElement","isBrowser"],"mappings":";;;;;;;;AAiDA,IAAIA,IAAsC;AAC1C,MAAMC,IAAsB,IACtBC,IACL,sFACYC,IACZ,qFACKC,IAAuC;AAAA,EAC5C,CAAC,MAAM,IAAI;AAAA,EACX,CAAC,MAAM,KAAK;AACb;AAEO,MAAMC,UAAyBC,EAAY;AAAA,EACjD;AAAA,EACA;AAAA,EAEA,WAAW,qBAAqB;AAC/B,WAAO,CAAC,aAAa,iBAAiB;AAAA,EACvC;AAAA,EACA,cAAc;AACb,UAAA,GACA,KAAK,aAAa,EAAE,MAAM,OAAA,CAAQ,EAAE,OAAOC,EAAI,QAAQ,CAAC,GACxDC,EAAY,MAAM,kBAAkBC,CAAU;AAAA,0BAA4BC,CAAA,EAAA;AAAA,EAC3E;AAAA,EACA,oBAAoB;AACnB,UAAMC,IAAY,KAAK,YAAY,kBAC7BC,IAAUC,EAAK,MAAM,cAAc,KAAK,SACxCC,IAAQ,IAAIC,EAAE,UAAUb,GAAsB;AAAA,MACnD,aAAa;AAAA,MACb,WAAW;AAAA,MACX,SAASD;AAAA,IAAA,CACT;AAED,SAAK,MAAM,IAAIc,EAAE,IAAIJ,GAAW;AAAA,MAC/B,oBAAoB;AAAA,MACpB,eAAe;AAAA;AAAA,MACf,QAAQ,CAACG,CAAK;AAAA,MACd,aAAa;AAAA,MACb,UAAU;AAAA,IAAA,CACV,GAEDE,EAAG,MAAM,mBAAmB,KAA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DzB,EAAKyB,GAAI,QAAQJ,IAAOI,EAAG,KAAK,IAAI,GAChCJ,KAAMD,EAAM,WAAW1B,EAAI,QAAQ,EAAE,MAAM+B,EAAG,GAAA,CAAI,CAAC;AAAA,EACxD;AAAA,EACArB,GAAWsB,GAA4B;AACtC,IAAIA,EAAM,SAAS,UAASvC,KAAcuC,EAAM,kBAAA,IACvC,SAAS,KAAK,UAAU,SAAS,kBAAkB,MAC3DvC,IAAa,WAAW,MAAM;AAC7B,MAAAA,IAAa;AAAA,IACd,GAAG,EAAE;AAAA,EACP;AACD;AAEAwC,EAAc,cAAcnC,CAAgB;AAExCoC,EAAA,MACH1B,EAAE,OAAO,UAAU,QAAQ,OAAO,IAAIA,EAAE,QAAQ;AAAA,EAC/C,MAAM;AAAA,EACN,UAAU,CAAC,GAAG,CAAC;AAAA,CACf;"}
@@ -17,7 +17,6 @@ declare global {
17
17
  }
18
18
  }
19
19
  export declare class MTDSAtlasMatgeoElement extends MTDSElement {
20
- #private;
21
20
  atlas?: MTDSAtlasElement;
22
21
  geojson?: L.GeoJSON;
23
22
  static get observedAttributes(): string[];
@@ -1,47 +1,47 @@
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 p, debounce as m, attr as n } from "../utils.js";
5
- const h = "moveend zoomend refresh";
6
- class u extends p {
1
+ import { booleanPointInPolygon as g } from "../external/@turf/boolean-point-in-polygon/dist/esm/index.js";
2
+ import { point as p } from "../external/@turf/helpers/dist/esm/index.js";
3
+ import h from "../external/leaflet/dist/leaflet-src.js";
4
+ import { defineElement as m, MTDSElement as f, debounce as u, attr as n } from "../utils.js";
5
+ const c = "moveend zoomend refresh";
6
+ class b extends f {
7
7
  atlas;
8
8
  geojson;
9
9
  static get observedAttributes() {
10
10
  return ["hidden", "data-collection", "data-color", "popovertarget"];
11
11
  }
12
12
  constructor() {
13
- super(), this.refresh = m(this.refresh, 300);
13
+ super(), this.refresh = u(this.refresh, 300);
14
14
  }
15
15
  connectedCallback() {
16
16
  queueMicrotask(() => {
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(),
17
+ this.atlas = this.closest("mtds-atlas") || void 0, this.atlas?.map?.on(c, this.refresh, this), this.geojson = new h.GeoJSON(null, {
18
+ style: d(this),
19
19
  onEachFeature: (t, s) => s.on("click", this.handleEvent, this)
20
20
  }).bindPopup(() => `#${n(this, "popovertarget")}`), this.refresh(), this.attributeChangedCallback("hidden");
21
21
  });
22
22
  }
23
23
  attributeChangedCallback(t) {
24
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);
25
+ t === "popovertarget" && s?.getPopup()?.update(), t === "data-color" && s?.setStyle(d(this)), t === "data-collection" && this.refresh(), t === "hidden" && s && o && o[this.hidden ? "removeLayer" : "addLayer"](s);
26
26
  }
27
27
  disconnectedCallback() {
28
- this.atlas?.map?.off(h, this.refresh, this), this.geojson?.unbindPopup().remove(), this.geojson = this.atlas = void 0;
28
+ this.atlas?.map?.off(c, this.refresh, this), this.geojson?.unbindPopup().remove(), this.geojson = this.atlas = void 0;
29
29
  }
30
30
  refresh(t) {
31
31
  !this.geojson || !this.atlas?.map?.hasLayer(this.geojson) || this.getCollection().then((s) => {
32
32
  const o = s?.links.find(({ rel: e }) => e === "items"), a = t === !0 ? `&nocache=${Date.now()}` : "", i = this.atlas?.map?.getBounds().toBBoxString();
33
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 data-collection="${Object.keys(e).join(" | ")}"`;
35
- console.warn(l);
34
+ const r = `mtds-atlas-matgeo: Please set a vaild data-collection="${Object.keys(e).join(" | ")}"`;
35
+ console.warn(r);
36
36
  });
37
37
  });
38
38
  }
39
39
  handleEvent(t) {
40
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]);
41
+ const o = [t.target], a = { ...t, targets: o, collections: s }, i = p([t.latlng.lng, t.latlng.lat]);
42
42
  this.atlas?.map?.eachLayer((e) => {
43
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);
44
+ (e.feature?.geometry && g(i, e.feature.geometry) || e instanceof h.Marker && e.getLatLng().equals(t.latlng)) && o.push(e);
45
45
  }), this.dispatchEvent(new MouseEvent("click", t.originalEvent)), this.dispatchEvent(
46
46
  new CustomEvent("atlasfeatureclick", { detail: a, bubbles: !0 })
47
47
  );
@@ -50,14 +50,12 @@ class u extends p {
50
50
  async getCollection() {
51
51
  return this.atlas?.getCollections().then((t) => t?.[n(this, "data-collection") || ""]);
52
52
  }
53
- #t() {
54
- return {
55
- color: `var(--mtds-color-${n(this, "data-color") || "main"}-base-default)`
56
- };
57
- }
58
53
  }
59
- g("mtds-atlas-matgeo", u);
54
+ const d = (l) => ({
55
+ color: `var(--mtds-color-${n(l, "data-color") || "main"}-base-default)`
56
+ });
57
+ m("mtds-atlas-matgeo", b);
60
58
  export {
61
- u as MTDSAtlasMatgeoElement
59
+ b as MTDSAtlasMatgeoElement
62
60
  };
63
61
  //# 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 { 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 data-collection=\"${Object.keys(collections).join(\" | \")}\"`;\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,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KAAK,CAAC;AAC9G,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;"}
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: getStyle(this),\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(getStyle(this));\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 data-collection=\"${Object.keys(collections).join(\" | \")}\"`;\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}\nconst getStyle = (self: MTDSAtlasMatgeoElement) => ({\n\tcolor: `var(--mtds-color-${attr(self, \"data-color\") || \"main\"}-base-default)`,\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","self","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,OAAOC,EAAS,IAAI;AAAA,QACpB,eAAe,CAACC,GAAGC,MAAUA,EAAM,GAAG,SAAS,KAAK,aAAa,IAAI;AAAA,MAAA,CACrE,EA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