@sjvair/monitor-map 3.0.0 → 3.0.2

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 (145) hide show
  1. package/dist/lib/LoadScreen.js +73 -0
  2. package/dist/lib/actions.js +9 -0
  3. package/dist/lib/assets/icons/adjustment-horizontal.js +4 -0
  4. package/dist/lib/collocation-sites/CollocationTooltip.js +105 -0
  5. package/dist/lib/collocation-sites/collocations-icon-manager.svelte.js +21 -0
  6. package/dist/lib/collocation-sites/collocations-map-integration.svelte.js +84 -0
  7. package/dist/lib/collocation-sites/collocations.svelte.js +26 -0
  8. package/dist/lib/colors.js +25 -0
  9. package/dist/lib/components/DataBox.js +30 -0
  10. package/dist/lib/components/DisplayOption.js +10 -0
  11. package/dist/lib/components/MapLayersDisplayOptions.js +78 -0
  12. package/dist/lib/components/SegmentedControl.js +37 -0
  13. package/dist/lib/components/ToggleSwitch.js +17 -0
  14. package/dist/lib/components/ui/button/button.js +34 -0
  15. package/dist/lib/components/ui/range-calendar/range-calendar-caption.js +79 -0
  16. package/dist/lib/components/ui/range-calendar/range-calendar-cell.js +34 -0
  17. package/dist/lib/components/ui/range-calendar/range-calendar-day.js +34 -0
  18. package/dist/lib/components/ui/range-calendar/range-calendar-grid-body.js +26 -0
  19. package/dist/lib/components/ui/range-calendar/range-calendar-grid-head.js +26 -0
  20. package/dist/lib/components/ui/range-calendar/range-calendar-grid-row.js +34 -0
  21. package/dist/lib/components/ui/range-calendar/range-calendar-grid.js +34 -0
  22. package/dist/lib/components/ui/range-calendar/range-calendar-head-cell.js +34 -0
  23. package/dist/lib/components/ui/range-calendar/range-calendar-header.js +34 -0
  24. package/dist/lib/components/ui/range-calendar/range-calendar-month-select.js +61 -0
  25. package/dist/lib/components/ui/range-calendar/range-calendar-month.js +25 -0
  26. package/dist/lib/components/ui/range-calendar/range-calendar-months.js +25 -0
  27. package/dist/lib/components/ui/range-calendar/range-calendar-nav.js +25 -0
  28. package/dist/lib/components/ui/range-calendar/range-calendar-next-button.js +57 -0
  29. package/dist/lib/components/ui/range-calendar/range-calendar-prev-button.js +57 -0
  30. package/dist/lib/components/ui/range-calendar/range-calendar-year-select.js +59 -0
  31. package/dist/lib/components/ui/range-calendar/range-calendar.js +272 -0
  32. package/dist/lib/data-chart/DataChart.js +142 -0
  33. package/dist/lib/data-chart/DateRange.js +15 -0
  34. package/dist/lib/data-chart/chart-utils.js +99 -0
  35. package/dist/lib/data-chart/data-chart.svelte.js +28 -0
  36. package/dist/lib/data-chart/requests.js +30 -0
  37. package/dist/lib/data-chart/tooltip.js +101 -0
  38. package/dist/lib/hms/hms-fire-icon-manager.js +39 -0
  39. package/dist/lib/hms/hms-fire-map-integration.svelte.js +97 -0
  40. package/dist/lib/hms/hms-smoke-map-integration.svelte.js +84 -0
  41. package/dist/lib/hms/hms.svelte.js +78 -0
  42. package/dist/lib/index.js +19 -0
  43. package/dist/lib/map/Map.js +14 -0
  44. package/dist/lib/map/MapStyleDisplayOptions.js +43 -0
  45. package/dist/lib/map/Menu.js +45 -0
  46. package/dist/lib/map/icons.js +31 -0
  47. package/dist/lib/map/integrations/base-layer-seperator.js +12 -0
  48. package/dist/lib/map/integrations/click-manager.js +33 -0
  49. package/dist/lib/map/integrations/integrations-manager.js +12 -0
  50. package/dist/lib/map/integrations/map-display-option.svelte.js +18 -0
  51. package/dist/lib/map/integrations/map-geojson-integration.svelte.js +17 -0
  52. package/dist/lib/map/integrations/map-icon-manager.js +43 -0
  53. package/dist/lib/map/integrations/map-integration.svelte.js +5 -0
  54. package/dist/lib/map/integrations/map-layer-integration.svelte.js +23 -0
  55. package/dist/lib/map/integrations/tooltip.svelte.js +81 -0
  56. package/dist/lib/map/map.svelte.js +51 -0
  57. package/dist/lib/map/utils.js +30 -0
  58. package/dist/lib/monitors/components/MonitorClusterTooltip.js +83 -0
  59. package/dist/lib/monitors/components/MonitorSubscriptionManager.js +104 -0
  60. package/dist/lib/monitors/components/MonitorTooltip.js +59 -0
  61. package/dist/lib/monitors/components/MonitorWidgetModal.js +40 -0
  62. package/dist/lib/monitors/components/MonitorsDisplayOptions.js +76 -0
  63. package/dist/lib/monitors/monitor-utils.js +26 -0
  64. package/dist/lib/monitors/monitors-cluster-renderer.js +212 -0
  65. package/dist/lib/monitors/monitors-icon-manager.svelte.js +71 -0
  66. package/dist/lib/monitors/monitors-map-integration.svelte.js +270 -0
  67. package/dist/lib/monitors/monitors.svelte.js +68 -0
  68. package/dist/lib/node_modules/@internationalized/date/dist/private/CalendarDate.js +122 -0
  69. package/dist/lib/node_modules/@internationalized/date/dist/private/DateFormatter.js +84 -0
  70. package/dist/lib/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js +91 -0
  71. package/dist/lib/node_modules/@internationalized/date/dist/private/conversion.js +104 -0
  72. package/dist/lib/node_modules/@internationalized/date/dist/private/manipulation.js +159 -0
  73. package/dist/lib/node_modules/@internationalized/date/dist/private/queries.js +32 -0
  74. package/dist/lib/node_modules/@internationalized/date/dist/private/string.js +37 -0
  75. package/dist/lib/node_modules/@internationalized/date/dist/private/utils.js +6 -0
  76. package/dist/lib/node_modules/clsx/dist/clsx.js +16 -0
  77. package/dist/lib/node_modules/tailwind-merge/dist/bundle-mjs.js +1723 -0
  78. package/dist/lib/node_modules/tailwind-variants/dist/chunk-LQJYWU4O.js +70 -0
  79. package/dist/lib/node_modules/tailwind-variants/dist/chunk-RZF76H2U.js +166 -0
  80. package/dist/lib/node_modules/tailwind-variants/dist/index.js +19 -0
  81. package/dist/lib/node_modules/uplot/dist/uPlot.esm.js +2147 -0
  82. package/dist/lib/sjvair-air.avif +0 -0
  83. package/dist/lib/sjvair-air.png +0 -0
  84. package/dist/lib/sjvair-air.webp +0 -0
  85. package/dist/lib/sjvair-air2.avif +0 -0
  86. package/dist/lib/sjvair-air2.png +0 -0
  87. package/dist/lib/sjvair-air2.webp +0 -0
  88. package/dist/lib/sjvair-icon.avif +0 -0
  89. package/dist/lib/sjvair-icon.png +0 -0
  90. package/dist/lib/sjvair-icon.webp +0 -0
  91. package/dist/lib/sjvair-icon2.avif +0 -0
  92. package/dist/lib/sjvair-icon2.png +0 -0
  93. package/dist/lib/sjvair-icon2.webp +0 -0
  94. package/dist/lib/sjvair-sjv.avif +0 -0
  95. package/dist/lib/sjvair-sjv.png +0 -0
  96. package/dist/lib/sjvair-sjv.webp +0 -0
  97. package/dist/lib/sjvair-sjv2.avif +0 -0
  98. package/dist/lib/sjvair-sjv2.png +0 -0
  99. package/dist/lib/sjvair-sjv2.webp +0 -0
  100. package/dist/lib/src/MapView.js +7 -0
  101. package/dist/lib/src/MonitorDetailPanel.js +169 -0
  102. package/dist/lib/src/router.js +9 -0
  103. package/dist/lib/utils.js +8 -0
  104. package/dist/lib/weather.js +8 -0
  105. package/dist/lib/wind/wind.svelte.js +21 -0
  106. package/dist/monitor-map/MonitorDetailPanel.css +1 -0
  107. package/dist/monitor-map/assets/MonitorDetailPanel-BU_pXZjp.js +15 -0
  108. package/dist/monitor-map/assets/validate-routes-CgbRa8fT.js +1 -0
  109. package/dist/monitor-map/inter-cyrillic-ext-wght-normal.woff2 +0 -0
  110. package/dist/monitor-map/inter-cyrillic-wght-normal.woff2 +0 -0
  111. package/dist/monitor-map/inter-greek-ext-wght-normal.woff2 +0 -0
  112. package/dist/monitor-map/inter-greek-wght-normal.woff2 +0 -0
  113. package/dist/monitor-map/inter-latin-ext-wght-normal.woff2 +0 -0
  114. package/dist/monitor-map/inter-latin-wght-normal.woff2 +0 -0
  115. package/dist/monitor-map/inter-vietnamese-wght-normal.woff2 +0 -0
  116. package/dist/monitor-map/lungs.svg +99 -0
  117. package/dist/monitor-map/sjvair-air.avif +0 -0
  118. package/dist/monitor-map/sjvair-air.png +0 -0
  119. package/dist/monitor-map/sjvair-air.webp +0 -0
  120. package/dist/monitor-map/sjvair-air2.avif +0 -0
  121. package/dist/monitor-map/sjvair-air2.png +0 -0
  122. package/dist/monitor-map/sjvair-air2.webp +0 -0
  123. package/dist/monitor-map/sjvair-icon.avif +0 -0
  124. package/dist/monitor-map/sjvair-icon.png +0 -0
  125. package/dist/monitor-map/sjvair-icon.webp +0 -0
  126. package/dist/monitor-map/sjvair-icon2.avif +0 -0
  127. package/dist/monitor-map/sjvair-icon2.png +0 -0
  128. package/dist/monitor-map/sjvair-icon2.webp +0 -0
  129. package/dist/monitor-map/sjvair-sjv.avif +0 -0
  130. package/dist/monitor-map/sjvair-sjv.png +0 -0
  131. package/dist/monitor-map/sjvair-sjv.webp +0 -0
  132. package/dist/monitor-map/sjvair-sjv2.avif +0 -0
  133. package/dist/monitor-map/sjvair-sjv2.png +0 -0
  134. package/dist/monitor-map/sjvair-sjv2.webp +0 -0
  135. package/dist/monitor-map/sjvairMonitorMap.css +1 -0
  136. package/dist/monitor-map/sjvairMonitorMap.js +4042 -0
  137. package/package.json +1 -1
  138. package/src/lib/components/MapLayersDisplayOptions.svelte +23 -10
  139. package/src/lib/ev-stations/components/EvStationsDisplayOptions.svelte +14 -2
  140. package/src/lib/ev-stations/ev-stations-map-integration.svelte.ts +4 -4
  141. package/src/lib/map/integrations/map-display-option.svelte.ts +5 -1
  142. package/src/lib/map/integrations/map-icon-manager.ts +4 -3
  143. package/src/lib/monitors/components/MonitorsDisplayOptions.svelte +4 -1
  144. package/src/lib/monitors/monitors-icon-manager.svelte.ts +3 -1
  145. package/src/lib/monitors/monitors-map-integration.svelte.ts +9 -9
@@ -0,0 +1,39 @@
1
+ import { asDataURI as e, fireIcon as t } from "../map/icons.js";
2
+ import { MapIconManager as n } from "../map/integrations/map-icon-manager.js";
3
+ //#region src/lib/hms/hms-fire-icon-manager.ts
4
+ var r = {
5
+ sm: {
6
+ color: "#FFD700",
7
+ size: 20
8
+ },
9
+ md: {
10
+ color: "#FF8C00",
11
+ size: 24
12
+ },
13
+ lg: {
14
+ color: "#FF4500",
15
+ size: 28
16
+ },
17
+ xl: {
18
+ color: "#DC143C",
19
+ size: 32
20
+ },
21
+ xxl: {
22
+ color: "#8B0000",
23
+ size: 36
24
+ }
25
+ };
26
+ function i(e) {
27
+ return e < 10 ? "hms-fire-sm" : e < 50 ? "hms-fire-md" : e < 150 ? "hms-fire-lg" : e < 350 ? "hms-fire-xl" : "hms-fire-xxl";
28
+ }
29
+ var a = class extends n {
30
+ constructor() {
31
+ super();
32
+ for (let [n, { color: i, size: a }] of Object.entries(r)) {
33
+ let r = new Image(a, a);
34
+ r.src = e(t(i, a)), this.register(`hms-fire-${n}`, r);
35
+ }
36
+ }
37
+ };
38
+ //#endregion
39
+ export { a as HMSFireIconManager, i as getTierIconId };
@@ -0,0 +1,97 @@
1
+ import { mapManager as e } from "../map/map.svelte.js";
2
+ import { MapIconLayerIntegration as t } from "../map/integrations/map-geojson-integration.svelte.js";
3
+ import { hmsManager as n } from "./hms.svelte.js";
4
+ import { HMSFireIconManager as r, getTierIconId as i } from "./hms-fire-icon-manager.js";
5
+ import * as a from "svelte/internal/client";
6
+ //#region src/lib/hms/hms-fire-map-integration.svelte.ts
7
+ var o = 10, s = new class extends t {
8
+ referenceId = "hms-fire";
9
+ #e = a.state(!0);
10
+ get enabled() {
11
+ return a.get(this.#e);
12
+ }
13
+ set enabled(e) {
14
+ a.set(this.#e, e, !0);
15
+ }
16
+ icons = new r();
17
+ #t = a.state(!1);
18
+ get zoomedIn() {
19
+ return a.get(this.#t);
20
+ }
21
+ set zoomedIn(e) {
22
+ a.set(this.#t, e, !0);
23
+ }
24
+ get features() {
25
+ return this.zoomedIn ? this.hotspotFeatures : this.groupFeatures;
26
+ }
27
+ get mapLayer() {
28
+ return {
29
+ id: this.referenceId,
30
+ type: "symbol",
31
+ source: this.referenceId,
32
+ layout: {
33
+ "icon-image": ["get", "icon"],
34
+ "icon-allow-overlap": !0,
35
+ "icon-ignore-placement": !0
36
+ },
37
+ paint: {}
38
+ };
39
+ }
40
+ get mapSource() {
41
+ return {
42
+ type: "geojson",
43
+ promoteId: "id",
44
+ data: {
45
+ type: "FeatureCollection",
46
+ features: this.features
47
+ }
48
+ };
49
+ }
50
+ get groupFeatures() {
51
+ return (n.fireGroups ?? []).map((e) => ({
52
+ type: "Feature",
53
+ properties: {
54
+ id: e.id,
55
+ icon: i(e.avgFrp),
56
+ avgFrp: e.avgFrp,
57
+ count: e.count
58
+ },
59
+ geometry: {
60
+ type: "Point",
61
+ coordinates: e.coordinates
62
+ }
63
+ }));
64
+ }
65
+ get hotspotFeatures() {
66
+ return (n.fire ?? []).map((e) => ({
67
+ type: "Feature",
68
+ properties: {
69
+ id: e.id,
70
+ icon: i(e.frp),
71
+ frp: e.frp
72
+ },
73
+ geometry: e.geometry
74
+ }));
75
+ }
76
+ onZoom = () => {
77
+ e.map && (this.zoomedIn = e.map.getZoom() >= o);
78
+ };
79
+ constructor() {
80
+ super(), a.effect_root(() => {
81
+ a.user_effect(() => {
82
+ let t = this.features;
83
+ !e.map || !this.enabled || e.setDataSource(this.referenceId, t);
84
+ });
85
+ });
86
+ }
87
+ apply() {
88
+ e.map && this.icons.loadIcons().then(() => {
89
+ !e.map || !this.enabled || (this.remove(), this.zoomedIn = e.map.getZoom() >= o, e.map.addSource(this.referenceId, this.mapSource), e.map.addLayer(this.mapLayer, this.beforeLayer), e.map.on("zoom", this.onZoom));
90
+ }).catch(console.error);
91
+ }
92
+ remove() {
93
+ e.map?.off("zoom", this.onZoom), super.remove();
94
+ }
95
+ }();
96
+ //#endregion
97
+ export { s as hmsFireMapIntegration };
@@ -0,0 +1,84 @@
1
+ import { mapManager as e } from "../map/map.svelte.js";
2
+ import { MapGeoJSONIntegration as t } from "../map/integrations/map-geojson-integration.svelte.js";
3
+ import { hmsManager as n } from "./hms.svelte.js";
4
+ import * as r from "svelte/internal/client";
5
+ var i = new class extends t {
6
+ referenceId = "hms-smoke";
7
+ #e = r.state(!0);
8
+ get enabled() {
9
+ return r.get(this.#e);
10
+ }
11
+ set enabled(e) {
12
+ r.set(this.#e, e, !0);
13
+ }
14
+ get features() {
15
+ return (n.smoke ?? []).map((e) => ({
16
+ type: "Feature",
17
+ properties: {
18
+ id: e.id,
19
+ density: e.density
20
+ },
21
+ geometry: e.geometry
22
+ }));
23
+ }
24
+ get mapLayer() {
25
+ return {
26
+ id: this.referenceId,
27
+ type: "fill",
28
+ source: this.referenceId,
29
+ layout: {},
30
+ paint: {
31
+ "fill-color": [
32
+ "match",
33
+ ["get", "density"],
34
+ "light",
35
+ "#bfc8c3",
36
+ "medium",
37
+ "#757b78",
38
+ "#333634"
39
+ ],
40
+ "fill-opacity": [
41
+ "match",
42
+ ["get", "density"],
43
+ "light",
44
+ .2,
45
+ "medium",
46
+ .3,
47
+ .4
48
+ ],
49
+ "fill-outline-color": [
50
+ "match",
51
+ ["get", "density"],
52
+ "light",
53
+ "#bfc8c3",
54
+ "medium",
55
+ "#757b78",
56
+ "#333634"
57
+ ]
58
+ }
59
+ };
60
+ }
61
+ get mapSource() {
62
+ return {
63
+ type: "geojson",
64
+ promoteId: "id",
65
+ data: {
66
+ type: "FeatureCollection",
67
+ features: this.features
68
+ }
69
+ };
70
+ }
71
+ constructor() {
72
+ super(), r.effect_root(() => {
73
+ r.user_effect(() => {
74
+ let t = this.features;
75
+ !e.map || !this.enabled || e.setDataSource(this.referenceId, t);
76
+ });
77
+ });
78
+ }
79
+ apply() {
80
+ e.map && (this.remove(), e.map.addSource(this.referenceId, this.mapSource), super.apply());
81
+ }
82
+ }();
83
+ //#endregion
84
+ export { i as hmsSmokeMapIntegration };
@@ -0,0 +1,78 @@
1
+ import * as e from "svelte/internal/client";
2
+ import { SvelteMap as t } from "svelte/reactivity";
3
+ import { featureCollection as n, point as r } from "@turf/helpers";
4
+ import { getHMSFire as i, getHMSSmoke as a } from "@sjvair/sdk/hms";
5
+ import o from "@turf/clusters-dbscan";
6
+ //#region src/lib/hms/hms.svelte.ts
7
+ var s = 2, c = 1, l = class {
8
+ #e = e.state();
9
+ get smoke() {
10
+ return e.get(this.#e);
11
+ }
12
+ set smoke(t) {
13
+ e.set(this.#e, t, !0);
14
+ }
15
+ #t = e.state();
16
+ get fire() {
17
+ return e.get(this.#t);
18
+ }
19
+ set fire(t) {
20
+ e.set(this.#t, t, !0);
21
+ }
22
+ #n = e.state();
23
+ get fireGroups() {
24
+ return e.get(this.#n);
25
+ }
26
+ set fireGroups(t) {
27
+ e.set(this.#n, t, !0);
28
+ }
29
+ async init() {
30
+ await Promise.allSettled([this.loadSmoke(), this.loadFire()]);
31
+ }
32
+ async loadSmoke() {
33
+ this.smoke = await a();
34
+ }
35
+ async loadFire() {
36
+ try {
37
+ let e = u((await i()).filter((e) => e.frp !== null));
38
+ this.fire = e, this.fireGroups = d(e);
39
+ } catch (e) {
40
+ console.error("HMS fire load failed:", e);
41
+ }
42
+ }
43
+ };
44
+ function u(e) {
45
+ let t = /* @__PURE__ */ new Map();
46
+ for (let n of e) {
47
+ let [e, r] = n.geometry.coordinates, i = `${e},${r}`, a = t.get(i);
48
+ (!a || n.timestamp > a.timestamp) && t.set(i, n);
49
+ }
50
+ return Array.from(t.values());
51
+ }
52
+ function d(e) {
53
+ if (!e.length) return [];
54
+ let i = o(n(e.map((e) => r(e.geometry.coordinates, {
55
+ fireId: e.id,
56
+ frp: e.frp
57
+ }))), s, {
58
+ minPoints: c,
59
+ units: "kilometers"
60
+ }), a = new t();
61
+ for (let e of i.features) {
62
+ let t = e.properties, n = t.dbscan === "noise" ? `noise-${t.fireId}` : `cluster-${t.cluster}`, [r, i] = e.geometry.coordinates, o = a.get(n) ?? {
63
+ frps: [],
64
+ lngs: [],
65
+ lats: []
66
+ };
67
+ o.frps.push(t.frp), o.lngs.push(r), o.lats.push(i), a.set(n, o);
68
+ }
69
+ return Array.from(a.entries()).map(([e, { frps: t, lngs: n, lats: r }]) => ({
70
+ id: `hms-fire-group-${e}`,
71
+ coordinates: [n.reduce((e, t) => e + t, 0) / n.length, r.reduce((e, t) => e + t, 0) / r.length],
72
+ avgFrp: t.reduce((e, t) => e + t, 0) / t.length,
73
+ count: t.length
74
+ }));
75
+ }
76
+ var f = new l();
77
+ //#endregion
78
+ export { f as hmsManager };
@@ -0,0 +1,19 @@
1
+ import { monitorsManager as e } from "./monitors/monitors.svelte.js";
2
+ import { collocationSitesManager as t } from "./collocation-sites/collocations.svelte.js";
3
+ import { DefaultMapStyle as n, initializeMap as r, mapManager as i } from "./map/map.svelte.js";
4
+ import { MapIntegration as a } from "./map/integrations/map-integration.svelte.js";
5
+ import { MapLayerIntegration as o } from "./map/integrations/map-layer-integration.svelte.js";
6
+ import { MapIconLayerIntegration as s } from "./map/integrations/map-geojson-integration.svelte.js";
7
+ import { monitorsMapIntegration as c } from "./monitors/monitors-map-integration.svelte.js";
8
+ import { collocationSitesMapIntegration as l } from "./collocation-sites/collocations-map-integration.svelte.js";
9
+ import { baseLayerSeperator as u } from "./map/integrations/base-layer-seperator.js";
10
+ import { windMapIntegration as d } from "./wind/wind.svelte.js";
11
+ import f from "./map/Map.js";
12
+ import p from "./map/Menu.js";
13
+ import m, { disable as h, enable as g, loadScreenState as _ } from "./LoadScreen.js";
14
+ import v from "./components/SegmentedControl.js";
15
+ import y from "./components/ToggleSwitch.js";
16
+ import b from "./monitors/components/MonitorsDisplayOptions.js";
17
+ import x from "./components/MapLayersDisplayOptions.js";
18
+ import S from "./map/MapStyleDisplayOptions.js";
19
+ export { n as DefaultMapStyle, m as LoadScreen, f as Map, s as MapGeoJSONIntegration, a as MapIntegration, o as MapLayerIntegration, x as MapLayersDisplayOptions, S as MapStyleDisplayOptions, p as Menu, b as MonitorsDisplayOptions, v as SegmentedControl, y as ToggleSwitch, u as baseLayerSeperator, t as collocationSitesManager, l as collocationSitesMapIntegration, h as disableLoadScreen, g as enableLoadScreen, r as initializeMap, _ as loadScreenState, i as mapManager, e as monitorsManager, c as monitorsMapIntegration, d as windMapIntegration };
@@ -0,0 +1,14 @@
1
+ import { initializeMap as e } from "./map.svelte.js";
2
+ import { integrationsManager as t } from "./integrations/integrations-manager.js";
3
+ import * as n from "svelte/internal/client";
4
+ import "svelte/internal/disclose-version";
5
+ import "@maptiler/sdk/dist/maptiler-sdk.css";
6
+ //#region src/lib/map/Map.svelte
7
+ var r = n.from_html("<div style=\"width: 100%; height: 100%;\"></div>");
8
+ function i(i, a) {
9
+ n.push(a, !0), t.register(...a.integrations);
10
+ var o = r();
11
+ n.attach(o, () => e), n.append(i, o), n.pop();
12
+ }
13
+ //#endregion
14
+ export { i as default };
@@ -0,0 +1,43 @@
1
+ import { MAP_STYLE_OPTIONS as e } from "./utils.js";
2
+ import { DefaultMapStyle as t, mapManager as n } from "./map.svelte.js";
3
+ import { integrationsManager as r } from "./integrations/integrations-manager.js";
4
+ import i from "../components/DisplayOption.js";
5
+ import * as a from "svelte/internal/client";
6
+ import "svelte/internal/disclose-version";
7
+ import "@maptiler/sdk";
8
+ //#region src/lib/map/MapStyleDisplayOptions.svelte
9
+ var o = a.from_html("<option> </option>"), s = a.from_html("<option> </option>"), c = a.from_html("<p class=\"text-lg font-bold underline\">Map Styles</p> <label for=\"mapStyleType\">Style</label> <select id=\"mapStyleType\" name=\"selectedOption\" class=\"rounded border p-1\"></select> <label for=\"mapStyleVariant\">Variant</label> <select id=\"mapStyleType\" name=\"selectedOption\" class=\"rounded border p-1\"></select>", 1);
10
+ function l(l, u) {
11
+ a.push(u, !0);
12
+ let d = t, f = a.state(a.proxy(t.getReferenceStyle())), p = a.state(a.proxy(t)), m = a.derived(() => a.get(f).getVariants());
13
+ a.user_effect(() => {
14
+ let e = a.get(f) !== d.getReferenceStyle(), t = a.get(p) !== d;
15
+ n.map !== null && (e && !t ? a.set(p, a.get(f).getDefaultVariant(), !0) : t && (n.map.once("style.load", async () => {
16
+ d = a.get(p), r.refresh();
17
+ }), n.map.setStyle(a.get(p))));
18
+ }), i(l, {
19
+ children: (t, n) => {
20
+ var r = c(), i = a.sibling(a.first_child(r), 4);
21
+ a.each(i, 21, () => e, a.index, (e, t) => {
22
+ var n = o(), r = a.child(n, !0);
23
+ a.reset(n);
24
+ var i = {};
25
+ a.template_effect((e) => {
26
+ a.set_text(r, e), i !== (i = a.get(t)) && (n.value = (n.__value = a.get(t)) ?? "");
27
+ }, [() => a.get(t).getName()]), a.append(e, n);
28
+ }), a.reset(i);
29
+ var l = a.sibling(i, 4);
30
+ a.each(l, 21, () => a.get(m), a.index, (e, t) => {
31
+ var n = s(), r = a.child(n, !0);
32
+ a.reset(n);
33
+ var i = {};
34
+ a.template_effect((e) => {
35
+ a.set_text(r, e), i !== (i = a.get(t)) && (n.value = (n.__value = a.get(t)) ?? "");
36
+ }, [() => a.get(t).getName()]), a.append(e, n);
37
+ }), a.reset(l), a.bind_select_value(i, () => a.get(f), (e) => a.set(f, e)), a.bind_select_value(l, () => a.get(p), (e) => a.set(p, e)), a.append(t, r);
38
+ },
39
+ $$slots: { default: !0 }
40
+ }), a.pop();
41
+ }
42
+ //#endregion
43
+ export { l as default };
@@ -0,0 +1,45 @@
1
+ import e from "../assets/icons/adjustment-horizontal.js";
2
+ import * as t from "svelte/internal/client";
3
+ import "svelte/internal/disclose-version";
4
+ //#region src/lib/map/Menu.svelte
5
+ var n = t.from_html("<div data-trigger=\"\"><button aria-label=\"Display Options\"><img alt=\"SJVAir Icon\" class=\"size-8\" width=\"24\" height=\"24\"/></button> <div><div data-trigger=\"\" class=\"absolute top-0 left-0 flex h-fit w-full items-start justify-between gap-4 p-2 flex-wrap\"><!></div></div></div>");
6
+ function r(r, i) {
7
+ let a = t.state(!1);
8
+ function o() {
9
+ t.get(a) || t.set(a, !0);
10
+ }
11
+ function s() {
12
+ t.get(a) && t.set(a, !1);
13
+ }
14
+ let c = (e) => e !== null, l = (e) => {
15
+ function t(t) {
16
+ if (c(t.target) && e.contains(t.target)) return "trigger" in t.target.dataset ? s() : o();
17
+ s();
18
+ }
19
+ return document.body.addEventListener("click", t), () => document.body.removeEventListener("click", t);
20
+ };
21
+ var u = n();
22
+ let d;
23
+ var f = t.child(u);
24
+ let p;
25
+ var m = t.child(f);
26
+ t.reset(f);
27
+ var h = t.sibling(f, 2);
28
+ let g;
29
+ var _ = t.child(h), v = t.child(_);
30
+ t.snippet(v, () => i.children ?? t.noop), t.reset(_), t.reset(h), t.reset(u), t.attach(u, () => l), t.template_effect(() => {
31
+ d = t.set_class(u, 1, "absolute top-0 left-0 flex items-center justify-center overflow-hidden rounded bg-white p-1 shadow transition-all duration-0 select-none", null, d, {
32
+ "rounded-full": !t.get(a),
33
+ "delay-100": !t.get(a)
34
+ }), p = t.set_class(f, 1, "relative size-8 transition-all", null, p, {
35
+ "w-0": t.get(a),
36
+ "h-0": t.get(a),
37
+ "opacity-0": t.get(a)
38
+ }), t.set_attribute(m, "src", e), g = t.set_class(h, 1, "relative flex h-0 w-0 items-center justify-center overflow-x-hidden overflow-y-scroll transition-all duration-250", null, g, {
39
+ "h-55": t.get(a),
40
+ "w-135": t.get(a)
41
+ });
42
+ }), t.append(r, u);
43
+ }
44
+ //#endregion
45
+ export { r as default };
@@ -0,0 +1,31 @@
1
+ import { darken as e } from "color2k";
2
+ //#region src/lib/map/icons.ts
3
+ function t(t, n, r) {
4
+ return `<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
5
+ <rect x="${n / 2}" y="${n / 2}" width="${24 - n}" height="${24 - n}"
6
+ fill="${t}" stroke="${e(r ?? t, .1)}" stroke-width="${n}"/>
7
+ </svg>`;
8
+ }
9
+ function n(t, n, r) {
10
+ return `<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
11
+ <circle cx="12" cy="12" r="${12 - n}" fill="${t}" stroke="${e(r ?? t, .1)}" stroke-width="${n}"/>
12
+ </svg>`;
13
+ }
14
+ function r(t, n, r) {
15
+ return `<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
16
+ <polygon points="${`12,${n} ${24 - n},${24 - n} ${n},${24 - n}`}"
17
+ fill="${t}" stroke="${e(r ?? t, .1)}" stroke-width="${n}"/>
18
+ </svg>`;
19
+ }
20
+ var i = "M495.9 248H392c-4.4 0-8 3.6-8 8s3.6 8 8 8H495.9C491.7 390.2 390.2 491.7 264 495.9V392c0-4.4-3.6-8-8-8s-8 3.6-8 8V495.9C121.8 491.7 20.3 390.2 16.1 264H120c4.4 0 8-3.6 8-8s-3.6-8-8-8H16.1C20.3 121.8 121.8 20.3 248 16.1V120c0 4.4 3.6 8 8 8s8-3.6 8-8V16.1C390.2 20.3 491.7 121.8 495.9 248zM0 256a256 256 0 1 0 512 0A256 256 0 1 0 0 256z", a = 16;
21
+ function o(e, t = "#ffffff") {
22
+ return `<svg width="56" height="56" viewBox="0 0 56 56" xmlns="http://www.w3.org/2000/svg">${e.replace("<svg ", `<svg x="${a}" y="${a}" `)}<svg x="0" y="0" width="56" height="56" viewBox="-8 -8 528 528"><path d="${i}" fill="${t}" stroke="${t}" stroke-width="5"/></svg></svg>`;
23
+ }
24
+ function s(e) {
25
+ return `data:image/svg+xml;utf8,${encodeURIComponent(e)}`;
26
+ }
27
+ function c(e, t) {
28
+ return `<svg width="${t}" height="${t}" viewBox="0 -960 960 960" xmlns="http://www.w3.org/2000/svg" fill="${e}"><path d="M200-400q0 52 21 98.5t60 81.5q-1-5-1-9v-9q0-32 12-60t35-51l113-111 113 111q23 23 35 51t12 60v9q0 4-1 9 39-35 60-81.5t21-98.5q0-50-18.5-94.5T608-574q-20 13-42 19.5t-45 6.5q-62 0-107.5-41T361-690q-39 33-69 68.5t-50.5 72Q221-513 210.5-475T200-400Zm240 52-57 56q-11 11-17 25t-6 29q0 32 23.5 55t56.5 23q33 0 56.5-23t23.5-55q0-16-6-29.5T497-292l-57-56Zm0-492v132q0 34 23.5 57t57.5 23q18 0 33.5-7.5T582-658l18-22q74 42 117 117t43 163q0 134-93 227T440-80q-134 0-227-93t-93-227q0-129 86.5-245T440-840Zm400 320q-17 0-28.5-11.5T800-560q0-17 11.5-28.5T840-600q17 0 28.5 11.5T880-560q0 17-11.5 28.5T840-520Zm-40-120v-200h80v200h-80Z"/></svg>`;
29
+ }
30
+ //#endregion
31
+ export { s as asDataURI, n as circle, c as fireIcon, t as square, r as triangle, o as withCrosshair };
@@ -0,0 +1,12 @@
1
+ import { MapLayerIntegration as e } from "./map-layer-integration.svelte.js";
2
+ var t = new class extends e {
3
+ referenceId = "Base Layer Seperator";
4
+ enabled = !0;
5
+ mapLayer = {
6
+ id: this.referenceId,
7
+ type: "custom",
8
+ render: function() {}
9
+ };
10
+ }();
11
+ //#endregion
12
+ export { t as baseLayerSeperator };
@@ -0,0 +1,33 @@
1
+ import { mapManager as e } from "../map.svelte.js";
2
+ var t = new class {
3
+ registrations = [];
4
+ isListening = !1;
5
+ register(e, t) {
6
+ let n = new Set(e), r = this.registrations.find((e) => e.layerIds.some((e) => n.has(e)));
7
+ r ? (r.layerIds = e, r.handler = t) : this.registrations.push({
8
+ layerIds: e,
9
+ handler: t
10
+ }), this.ensureListener();
11
+ }
12
+ unregister(e) {
13
+ let t = new Set(e);
14
+ this.registrations = this.registrations.filter((e) => !e.layerIds.some((e) => t.has(e))), this.registrations.length === 0 && this.removeListener();
15
+ }
16
+ ensureListener() {
17
+ this.isListening || !e.map || (e.map.on("click", this.handleClick), this.isListening = !0);
18
+ }
19
+ removeListener() {
20
+ this.isListening &&= (e.map?.off("click", this.handleClick), !1);
21
+ }
22
+ handleClick = (t) => {
23
+ if (!e.map) return;
24
+ let n = this.registrations.flatMap((e) => e.layerIds), r = e.map.queryRenderedFeatures(t.point, { layers: n });
25
+ if (!r.length) return;
26
+ let i = r[0].layer.id, a = this.registrations.find((e) => e.layerIds.includes(i));
27
+ if (!a) return;
28
+ let o = r.filter((e) => a.layerIds.includes(e.layer.id));
29
+ a.handler(o, t);
30
+ };
31
+ }();
32
+ //#endregion
33
+ export { t as clickManager };
@@ -0,0 +1,12 @@
1
+ import { XMap as e } from "@tstk/builtin-extensions";
2
+ var t = new class {
3
+ integrations = new e();
4
+ register(...e) {
5
+ for (let t of e) this.integrations.set(t.referenceId, t);
6
+ }
7
+ refresh() {
8
+ for (let e of this.integrations.values()) e.enabled ? e.apply() : e.remove && e.remove();
9
+ }
10
+ }();
11
+ //#endregion
12
+ export { t as integrationsManager };
@@ -0,0 +1,18 @@
1
+ import * as e from "svelte/internal/client";
2
+ //#region src/lib/map/integrations/map-display-option.svelte.ts
3
+ var t = class {
4
+ #e;
5
+ get value() {
6
+ return e.get(this.#e);
7
+ }
8
+ set value(t) {
9
+ e.set(this.#e, t, !0);
10
+ }
11
+ icon;
12
+ label;
13
+ constructor(t, n, r) {
14
+ this.icon = r, this.label = t, this.#e = e.state(e.proxy(n));
15
+ }
16
+ };
17
+ //#endregion
18
+ export { t as MapDisplayOption };
@@ -0,0 +1,17 @@
1
+ import { mapManager as e } from "../map.svelte.js";
2
+ import { MapLayerIntegration as t } from "./map-layer-integration.svelte.js";
3
+ import "svelte/internal/client";
4
+ //#region src/lib/map/integrations/map-geojson-integration.svelte.ts
5
+ var n = class extends t {
6
+ remove() {
7
+ super.remove(), e.map?.getSource(this.referenceId) && e.map.removeSource(this.referenceId);
8
+ }
9
+ }, r = class extends n {
10
+ apply() {
11
+ e.map && this.icons.loadIcons().then(() => {
12
+ this.remove(), e.map?.addSource(this.referenceId, this.mapSource), super.apply();
13
+ });
14
+ }
15
+ };
16
+ //#endregion
17
+ export { n as MapGeoJSONIntegration, r as MapIconLayerIntegration };
@@ -0,0 +1,43 @@
1
+ import { mapManager as e } from "../map.svelte.js";
2
+ import { SvelteMap as t } from "svelte/reactivity";
3
+ //#region src/lib/map/integrations/map-icon-manager.ts
4
+ var n = class {
5
+ icons = new t();
6
+ constructor(e) {
7
+ e && (this.icons = e);
8
+ }
9
+ get(e) {
10
+ return this.icons.get(e);
11
+ }
12
+ has(e) {
13
+ return this.icons.has(e);
14
+ }
15
+ async loadIcons() {
16
+ e.map && await Promise.all(this.icons.values().map((t) => this.loadImage(t, e.map)));
17
+ }
18
+ register(e, t) {
19
+ let n = {
20
+ id: e,
21
+ image: t
22
+ };
23
+ this.icons.set(e, n);
24
+ }
25
+ loadImage(e, t) {
26
+ return this.applyImage("add", e, t);
27
+ }
28
+ updateImage(e, t) {
29
+ return this.applyImage("update", e, t);
30
+ }
31
+ applyImage(e, t, n) {
32
+ let r = () => e === "add" ? n.addImage(t.id, t.image) : n.updateImage(t.id, t.image);
33
+ return t.image.complete ? (r(), Promise.resolve()) : new Promise((e, n) => {
34
+ t.image.onload = () => {
35
+ r(), e();
36
+ }, t.image.onerror = (e) => {
37
+ n(Error(`Failed to load image ${t.id}: ${e}`, { cause: e }));
38
+ };
39
+ });
40
+ }
41
+ };
42
+ //#endregion
43
+ export { n as MapIconManager };
@@ -0,0 +1,5 @@
1
+ import "svelte/internal/client";
2
+ //#region src/lib/map/integrations/map-integration.svelte.ts
3
+ var e = class {};
4
+ //#endregion
5
+ export { e as MapIntegration };
@@ -0,0 +1,23 @@
1
+ import { mapManager as e } from "../map.svelte.js";
2
+ import { MapIntegration as t } from "./map-integration.svelte.js";
3
+ import * as n from "svelte/internal/client";
4
+ import { untrack as r } from "svelte";
5
+ //#region src/lib/map/integrations/map-layer-integration.svelte.ts
6
+ var i = class extends t {
7
+ beforeLayer;
8
+ constructor() {
9
+ super(), n.effect_root(() => {
10
+ n.user_effect(() => {
11
+ e.map && this.enabled ? r(() => this.apply()) : e.map && !this.enabled && r(() => this.remove());
12
+ });
13
+ });
14
+ }
15
+ apply() {
16
+ e.map && (e.map.getLayer(this.referenceId) || e.map.addLayer(this.mapLayer, this.beforeLayer), e.map.setLayoutProperty(this.referenceId, "visibility", this.enabled ? "visible" : "none"));
17
+ }
18
+ remove() {
19
+ e.map?.getLayer(this.referenceId) && e.map.removeLayer(this.referenceId);
20
+ }
21
+ };
22
+ //#endregion
23
+ export { i as MapLayerIntegration };