@sjvair/monitor-map 3.0.1 → 3.0.3

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 (151) hide show
  1. package/dist/lib/LoadScreen.js +15 -15
  2. package/dist/lib/{src/MapView.js → MainMapView.js} +2 -2
  3. package/dist/lib/MapLegend.js +13 -0
  4. package/dist/lib/MonitorDetailPanel.js +169 -0
  5. package/dist/lib/MonitorMapLayout.js +91 -0
  6. package/dist/lib/_virtual/_rolldown/runtime.js +11 -0
  7. package/dist/lib/assets/logos/airgradient-blue.js +4 -0
  8. package/dist/lib/assets/logos/airnow-compact.js +4 -0
  9. package/dist/lib/assets/logos/carb-compact.js +4 -0
  10. package/dist/lib/assets/logos/purpleair-compact.js +4 -0
  11. package/dist/lib/assets/logos/sjvair.js +4 -0
  12. package/dist/lib/collocation-sites/CollocationTooltip.js +1 -1
  13. package/dist/lib/collocation-sites/collocations-map-integration.svelte.js +20 -20
  14. package/dist/lib/components/DataBox.js +1 -1
  15. package/dist/lib/components/DisplayOption.js +1 -1
  16. package/dist/lib/components/MapLayersDisplayOptions.js +47 -31
  17. package/dist/lib/components/SegmentedControl.js +4 -4
  18. package/dist/lib/components/ToggleSwitch.js +1 -1
  19. package/dist/lib/components/ui/button/button.js +4 -4
  20. package/dist/lib/components/ui/range-calendar/range-calendar-caption.js +57 -54
  21. package/dist/lib/components/ui/range-calendar/range-calendar-cell.js +19 -18
  22. package/dist/lib/components/ui/range-calendar/range-calendar-day.js +19 -18
  23. package/dist/lib/components/ui/range-calendar/range-calendar-grid-body.js +17 -16
  24. package/dist/lib/components/ui/range-calendar/range-calendar-grid-head.js +17 -16
  25. package/dist/lib/components/ui/range-calendar/range-calendar-grid-row.js +19 -18
  26. package/dist/lib/components/ui/range-calendar/range-calendar-grid.js +19 -18
  27. package/dist/lib/components/ui/range-calendar/range-calendar-head-cell.js +19 -18
  28. package/dist/lib/components/ui/range-calendar/range-calendar-header.js +19 -18
  29. package/dist/lib/components/ui/range-calendar/range-calendar-month-select.js +31 -31
  30. package/dist/lib/components/ui/range-calendar/range-calendar-month.js +19 -19
  31. package/dist/lib/components/ui/range-calendar/range-calendar-months.js +19 -19
  32. package/dist/lib/components/ui/range-calendar/range-calendar-nav.js +19 -19
  33. package/dist/lib/components/ui/range-calendar/range-calendar-next-button.js +27 -26
  34. package/dist/lib/components/ui/range-calendar/range-calendar-prev-button.js +27 -26
  35. package/dist/lib/components/ui/range-calendar/range-calendar-year-select.js +29 -29
  36. package/dist/lib/components/ui/range-calendar/range-calendar.js +154 -154
  37. package/dist/lib/data-chart/DataChart.js +76 -76
  38. package/dist/lib/ev-stations/components/EvStationClusterTooltip.js +16 -0
  39. package/dist/lib/ev-stations/components/EvStationTooltip.js +120 -0
  40. package/dist/lib/ev-stations/components/EvStationsDisplayOptions.js +41 -0
  41. package/dist/lib/ev-stations/data-maps.js +4 -0
  42. package/dist/lib/ev-stations/ev-station-icons.js +32 -0
  43. package/dist/lib/ev-stations/ev-stations-cluster-renderer.js +118 -0
  44. package/dist/lib/ev-stations/ev-stations-map-integration.svelte.js +181 -0
  45. package/dist/lib/ev-stations/ev-stations.svelte.js +33 -0
  46. package/dist/lib/ev-stations/zip-codes.js +136 -0
  47. package/dist/lib/hms/components/HMSFireLegend.js +35 -0
  48. package/dist/lib/hms/hms.svelte.js +12 -12
  49. package/dist/lib/index.js +19 -17
  50. package/dist/lib/map/Map.js +1 -1
  51. package/dist/lib/map/MapStyleDisplayOptions.js +16 -16
  52. package/dist/lib/map/Menu.js +23 -24
  53. package/dist/lib/map/integrations/map-display-option.svelte.js +3 -2
  54. package/dist/lib/map/integrations/map-icon-manager.js +4 -1
  55. package/dist/lib/map/utils.js +16 -13
  56. package/dist/lib/monitors/components/MonitorClusterTooltip.js +4 -4
  57. package/dist/lib/monitors/components/MonitorMarkersLegend.js +35 -0
  58. package/dist/lib/monitors/components/MonitorSubscriptionManager.js +1 -1
  59. package/dist/lib/monitors/components/MonitorTooltip.js +1 -1
  60. package/dist/lib/monitors/components/MonitorWidgetModal.js +1 -1
  61. package/dist/lib/monitors/components/MonitorsDisplayOptions.js +48 -39
  62. package/dist/lib/monitors/monitors-icon-manager.svelte.js +24 -17
  63. package/dist/lib/monitors/monitors-map-integration.svelte.js +65 -59
  64. package/dist/lib/monitors/monitors.svelte.js +38 -42
  65. package/dist/lib/router-context.js +13 -0
  66. package/dist/lib/routes.js +10 -0
  67. package/dist/lib/search/Search.js +124 -0
  68. package/dist/lib/search/service.js +90 -0
  69. package/dist/lib/sjvair-air.webp +0 -0
  70. package/dist/lib/sjvair-air2.webp +0 -0
  71. package/dist/lib/sjvair-icon.avif +0 -0
  72. package/dist/lib/sjvair-icon.png +0 -0
  73. package/dist/lib/sjvair-icon2.avif +0 -0
  74. package/dist/lib/sjvair-icon2.png +0 -0
  75. package/dist/lib/sjvair-sjv.avif +0 -0
  76. package/dist/lib/sjvair-sjv.webp +0 -0
  77. package/dist/lib/sjvair-sjv2.avif +0 -0
  78. package/dist/lib/sjvair-sjv2.webp +0 -0
  79. package/dist/lib/utils.js +9 -3
  80. package/package.json +37 -36
  81. package/src/lib/LoadScreen.svelte +5 -5
  82. package/src/lib/MainMapView.svelte +1 -0
  83. package/src/lib/MapLegend.svelte +15 -0
  84. package/src/lib/MonitorDetailPanel.svelte +152 -0
  85. package/src/lib/MonitorMapLayout.svelte +193 -0
  86. package/src/lib/components/MapLayersDisplayOptions.svelte +27 -10
  87. package/src/lib/ev-stations/components/EvStationsDisplayOptions.svelte +14 -2
  88. package/src/lib/ev-stations/ev-stations-map-integration.svelte.ts +4 -4
  89. package/src/lib/hms/components/HMSFireLegend.svelte +21 -0
  90. package/src/lib/index.ts +34 -0
  91. package/src/lib/map/Map.svelte +1 -0
  92. package/src/lib/map/Menu.svelte +4 -7
  93. package/src/lib/map/integrations/map-display-option.svelte.ts +5 -1
  94. package/src/lib/map/integrations/map-icon-manager.ts +7 -3
  95. package/src/lib/monitors/components/MonitorsDisplayOptions.svelte +4 -1
  96. package/src/lib/monitors/monitors-icon-manager.svelte.ts +3 -1
  97. package/src/lib/monitors/monitors-map-integration.svelte.ts +9 -9
  98. package/src/lib/monitors/monitors.svelte.ts +1 -3
  99. package/src/lib/router-context.ts +48 -0
  100. package/src/lib/routes.ts +8 -0
  101. package/src/lib/search/Search.svelte +189 -0
  102. package/src/lib/search/service.ts +101 -0
  103. package/src/lib/utils.ts +11 -0
  104. package/dist/lib/assets/icons/adjustment-horizontal.js +0 -4
  105. package/dist/lib/node_modules/@internationalized/date/dist/private/CalendarDate.js +0 -122
  106. package/dist/lib/node_modules/@internationalized/date/dist/private/DateFormatter.js +0 -84
  107. package/dist/lib/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js +0 -91
  108. package/dist/lib/node_modules/@internationalized/date/dist/private/conversion.js +0 -104
  109. package/dist/lib/node_modules/@internationalized/date/dist/private/manipulation.js +0 -159
  110. package/dist/lib/node_modules/@internationalized/date/dist/private/queries.js +0 -32
  111. package/dist/lib/node_modules/@internationalized/date/dist/private/string.js +0 -37
  112. package/dist/lib/node_modules/@internationalized/date/dist/private/utils.js +0 -6
  113. package/dist/lib/node_modules/clsx/dist/clsx.js +0 -16
  114. package/dist/lib/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -1723
  115. package/dist/lib/node_modules/tailwind-variants/dist/chunk-LQJYWU4O.js +0 -70
  116. package/dist/lib/node_modules/tailwind-variants/dist/chunk-RZF76H2U.js +0 -166
  117. package/dist/lib/node_modules/tailwind-variants/dist/index.js +0 -19
  118. package/dist/lib/node_modules/uplot/dist/uPlot.esm.js +0 -2147
  119. package/dist/lib/src/MonitorDetailPanel.js +0 -169
  120. package/dist/lib/src/router.js +0 -9
  121. package/dist/monitor-map/MonitorDetailPanel.css +0 -1
  122. package/dist/monitor-map/assets/MonitorDetailPanel-DmN3xPui.js +0 -15
  123. package/dist/monitor-map/assets/validate-routes-CgbRa8fT.js +0 -1
  124. package/dist/monitor-map/inter-cyrillic-ext-wght-normal.woff2 +0 -0
  125. package/dist/monitor-map/inter-cyrillic-wght-normal.woff2 +0 -0
  126. package/dist/monitor-map/inter-greek-ext-wght-normal.woff2 +0 -0
  127. package/dist/monitor-map/inter-greek-wght-normal.woff2 +0 -0
  128. package/dist/monitor-map/inter-latin-ext-wght-normal.woff2 +0 -0
  129. package/dist/monitor-map/inter-latin-wght-normal.woff2 +0 -0
  130. package/dist/monitor-map/inter-vietnamese-wght-normal.woff2 +0 -0
  131. package/dist/monitor-map/lungs.svg +0 -99
  132. package/dist/monitor-map/sjvair-air.avif +0 -0
  133. package/dist/monitor-map/sjvair-air.png +0 -0
  134. package/dist/monitor-map/sjvair-air.webp +0 -0
  135. package/dist/monitor-map/sjvair-air2.avif +0 -0
  136. package/dist/monitor-map/sjvair-air2.png +0 -0
  137. package/dist/monitor-map/sjvair-air2.webp +0 -0
  138. package/dist/monitor-map/sjvair-icon.avif +0 -0
  139. package/dist/monitor-map/sjvair-icon.png +0 -0
  140. package/dist/monitor-map/sjvair-icon.webp +0 -0
  141. package/dist/monitor-map/sjvair-icon2.avif +0 -0
  142. package/dist/monitor-map/sjvair-icon2.png +0 -0
  143. package/dist/monitor-map/sjvair-icon2.webp +0 -0
  144. package/dist/monitor-map/sjvair-sjv.avif +0 -0
  145. package/dist/monitor-map/sjvair-sjv.png +0 -0
  146. package/dist/monitor-map/sjvair-sjv.webp +0 -0
  147. package/dist/monitor-map/sjvair-sjv2.avif +0 -0
  148. package/dist/monitor-map/sjvair-sjv2.png +0 -0
  149. package/dist/monitor-map/sjvair-sjv2.webp +0 -0
  150. package/dist/monitor-map/sjvairMonitorMap.css +0 -1
  151. package/dist/monitor-map/sjvairMonitorMap.js +0 -4042
@@ -1,68 +1,64 @@
1
- import { route as e } from "../src/router.js";
2
- import * as t from "svelte/internal/client";
1
+ import * as e from "svelte/internal/client";
2
+ import { XMap as t } from "@tstk/builtin-extensions";
3
3
  import { getMonitors as n, getMonitorsLatest as r, getMonitorsMeta as i } from "@sjvair/sdk";
4
- import { XMap as a } from "@tstk/builtin-extensions";
5
- import { Interval as o } from "@tstk/utils";
4
+ import { Interval as a } from "@tstk/utils";
6
5
  //#region src/lib/monitors/monitors.svelte.ts
7
- var s = class {
8
- autoUpdate = new o(async () => await this.update(), 120 * 1e3);
9
- #e = t.state(!1);
6
+ var o = class {
7
+ autoUpdate = new a(async () => await this.update(), 120 * 1e3);
8
+ #e = e.state(!1);
10
9
  get initialized() {
11
- return t.get(this.#e);
10
+ return e.get(this.#e);
12
11
  }
13
- set initialized(e) {
14
- t.set(this.#e, e, !0);
12
+ set initialized(t) {
13
+ e.set(this.#e, t, !0);
15
14
  }
16
- #t = t.state(null);
15
+ #t = e.state(null);
17
16
  get latest() {
18
- return t.get(this.#t);
17
+ return e.get(this.#t);
19
18
  }
20
- set latest(e) {
21
- t.set(this.#t, e, !0);
19
+ set latest(t) {
20
+ e.set(this.#t, t, !0);
22
21
  }
23
- #n = t.state(null);
22
+ #n = e.state(null);
24
23
  get list() {
25
- return t.get(this.#n);
24
+ return e.get(this.#n);
26
25
  }
27
- set list(e) {
28
- t.set(this.#n, e, !0);
26
+ set list(t) {
27
+ e.set(this.#n, t, !0);
29
28
  }
30
- #r = t.state(null);
29
+ #r = e.state(null);
31
30
  get meta() {
32
- return t.get(this.#r);
31
+ return e.get(this.#r);
33
32
  }
34
- set meta(e) {
35
- t.set(this.#r, e, !0);
33
+ set meta(t) {
34
+ e.set(this.#r, t, !0);
36
35
  }
37
- #i = t.state(null);
36
+ #i = e.state(null);
38
37
  get pollutant() {
39
- return t.get(this.#i);
38
+ return e.get(this.#i);
40
39
  }
41
- set pollutant(e) {
42
- t.set(this.#i, e, !0);
40
+ set pollutant(t) {
41
+ e.set(this.#i, t, !0);
43
42
  }
44
- #a = t.derived(() => this.meta?.entryType(this.pollutant ?? this.meta.default_pollutant).asIter.levels || null);
43
+ #a = e.derived(() => this.meta?.entryType(this.pollutant ?? this.meta.default_pollutant).asIter.levels || null);
45
44
  get levels() {
46
- return t.get(this.#a);
45
+ return e.get(this.#a);
47
46
  }
48
- set levels(e) {
49
- t.set(this.#a, e);
47
+ set levels(t) {
48
+ e.set(this.#a, t);
50
49
  }
51
- async init() {
52
- if (this.initialized) return;
53
- [this.list, this.meta] = await Promise.all([n(), i()]);
54
- let t = e.search.pollutant;
55
- this.pollutant = t === "pm25" || t === "o3" ? t : this.meta.default_pollutant, this.latest = await c(this.pollutant), this.autoUpdate.start(), this.initialized = !0;
50
+ async init(e) {
51
+ this.initialized ||= ([this.list, this.meta] = await Promise.all([n(), i()]), this.pollutant = e === "pm25" || e === "o3" ? e : this.meta.default_pollutant, this.latest = await s(this.pollutant), this.autoUpdate.start(), !0);
56
52
  }
57
53
  async update() {
58
- this.initialized && ([this.list, this.latest] = await Promise.all([n(), c(this.pollutant || this.meta?.default_pollutant || "pm25")]));
54
+ this.initialized && ([this.list, this.latest] = await Promise.all([n(), s(this.pollutant || this.meta?.default_pollutant || "pm25")]));
59
55
  }
60
56
  };
61
- async function c(e) {
62
- let t = await r(e), n = new a();
63
- for (let e of t) n.set(e.id, e);
64
- return n;
57
+ async function s(e) {
58
+ let n = await r(e), i = new t();
59
+ for (let e of n) i.set(e.id, e);
60
+ return i;
65
61
  }
66
- var l = new s();
62
+ var c = new o();
67
63
  //#endregion
68
- export { l as monitorsManager };
64
+ export { c as monitorsManager };
@@ -0,0 +1,13 @@
1
+ import { getContext as e, setContext as t } from "svelte";
2
+ //#region src/lib/router-context.ts
3
+ var n = Symbol("monitor-map-router");
4
+ function r(e) {
5
+ t(n, e);
6
+ }
7
+ function i() {
8
+ let t = e(n);
9
+ if (!t) throw Error("monitor-map router context not found. Wrap your app root with provideMonitorMapRouter(...) before rendering monitor-map components.");
10
+ return t;
11
+ }
12
+ //#endregion
13
+ export { n as ROUTER_KEY, r as provideMonitorMapRouter, i as useMonitorMapRouter };
@@ -0,0 +1,10 @@
1
+ import e from "./MonitorMapLayout.js";
2
+ import t from "./MainMapView.js";
3
+ //#region src/lib/routes.ts
4
+ var n = {
5
+ layout: e,
6
+ "/": t,
7
+ "/monitor/:id": () => import("./MonitorDetailPanel.js")
8
+ };
9
+ //#endregion
10
+ export { n as monitorMapRoutes };
@@ -0,0 +1,124 @@
1
+ import { mapManager as e } from "../map/map.svelte.js";
2
+ import { monitorsMapIntegration as t } from "../monitors/monitors-map-integration.svelte.js";
3
+ import { useMonitorMapRouter as n } from "../router-context.js";
4
+ import { debounce as r } from "../utils.js";
5
+ import { geocode as i, monitorSearch as a } from "./service.js";
6
+ import "svelte/internal/disclose-version";
7
+ import * as o from "svelte/internal/client";
8
+ import { onDestroy as s } from "svelte";
9
+ import { Marker as c } from "@maptiler/sdk";
10
+ import { SearchIcon as l } from "@lucide/svelte";
11
+ //#region src/lib/search/Search.svelte
12
+ var u = o.from_html("<button class=\"px-2 text-gray-400 hover:text-gray-600 text-xl leading-none cursor-pointer\" aria-label=\"Clear search\">×</button>"), d = o.from_html("<img class=\"w-10 h-10 object-contain mr-3 shrink-0\"/>"), f = o.from_html("<button class=\"flex items-center w-full h-12 px-4 hover:brightness-95 bg-white text-left\"><!> <span class=\"text-sm truncate\"> </span></button>"), p = o.from_html("<p class=\"text-xs text-muted-foreground truncate\"> </p>"), m = o.from_html("<button class=\"flex items-center w-full h-12 px-4 hover:brightness-95 bg-white text-left\"><span class=\"svg-icon location-on bg-brand w-6 h-6 shrink-0 mr-3\"></span> <div class=\"min-w-0\"><p class=\"text-sm font-medium truncate\"> </p> <!></div></button>"), h = o.from_html("<div><div class=\"flex items-center w-full h-12 shrink-0\"><button class=\"w-12 h-12 shrink-0 flex items-center justify-center rounded-full bg-brand border-4 border-white\" aria-label=\"Open search\"><!></button> <div class=\"overflow-hidden w-full h-full flex items-center\"><input type=\"text\" placeholder=\"Search monitors or locations...\" class=\"h-full px-2 text-sm bg-transparent border-none outline-none w-full\"/> <!></div></div> <div></div></div>");
13
+ function g(g, _) {
14
+ o.push(_, !0);
15
+ let { navigate: v, basePath: y } = n(), b = o.state(!0), x = o.state(""), S = o.state(o.proxy([])), C = o.state(null), w = o.state(null);
16
+ function T(e) {
17
+ function t(t) {
18
+ !o.get(b) && !e.contains(t.target) && (o.set(b, !0), o.set(x, ""), o.set(S, [], !0));
19
+ }
20
+ return document.addEventListener("click", t, !0), { destroy() {
21
+ document.removeEventListener("click", t, !0);
22
+ } };
23
+ }
24
+ async function E() {
25
+ o.get(b) && (o.set(b, !1), o.get(w)?.focus());
26
+ }
27
+ function D() {
28
+ o.set(x, ""), o.set(S, [], !0), o.get(C)?.remove(), o.set(C, null);
29
+ }
30
+ async function O() {
31
+ let e = o.get(x);
32
+ if (!e) {
33
+ o.set(S, [], !0), o.get(C)?.remove(), o.set(C, null);
34
+ return;
35
+ }
36
+ let t = await a(e);
37
+ if (o.get(x) === e) if (t.length) o.set(S, t, !0);
38
+ else if (e.length > 4) {
39
+ let t = await i(e);
40
+ if (o.get(x) !== e) return;
41
+ o.set(S, t, !0);
42
+ } else o.set(S, [], !0);
43
+ }
44
+ let k = r(O, 500);
45
+ async function A(n) {
46
+ if (o.set(b, !0), o.set(x, ""), o.set(S, [], !0), o.get(C)?.remove(), o.set(C, null), e.map && n.monitor.position) {
47
+ let { coordinates: t } = n.monitor.position, r = [t[0], t[1]];
48
+ e.map.flyTo({
49
+ center: r,
50
+ zoom: 12
51
+ });
52
+ }
53
+ await v(`${y}/monitor/:id`, { params: { id: n.monitor.id } }), t.selectedMonitorId = n.monitor.id;
54
+ }
55
+ function j(t) {
56
+ let { feature: n } = t;
57
+ if (o.get(C)?.remove(), o.set(C, null), e.map) {
58
+ let t = [n.center[0], n.center[1]];
59
+ o.set(C, new c().setLngLat(t).addTo(e.map));
60
+ let r = n.place_type?.[0] === "address";
61
+ e.map.flyTo({
62
+ center: t,
63
+ ...r && { zoom: 16 }
64
+ });
65
+ }
66
+ o.set(S, [], !0), o.set(b, !0);
67
+ }
68
+ s(() => {
69
+ o.get(C)?.remove();
70
+ });
71
+ var M = h(), N = o.child(M), P = o.child(N);
72
+ l(o.child(P), {
73
+ size: "24",
74
+ color: "#FFFFFF"
75
+ }), o.reset(P);
76
+ var F = o.sibling(P, 2), I = o.child(F);
77
+ o.remove_input_defaults(I), o.bind_this(I, (e) => o.set(w, e), () => o.get(w));
78
+ var L = o.sibling(I, 2), R = (e) => {
79
+ var t = u();
80
+ o.delegated("click", t, D), o.append(e, t);
81
+ };
82
+ o.if(L, (e) => {
83
+ o.get(x) && !o.get(b) && e(R);
84
+ }), o.reset(F), o.reset(N);
85
+ var z = o.sibling(N, 2);
86
+ o.each(z, 21, () => o.get(S), (e) => e.type === "monitor" ? e.monitor.id : e.feature.place_name, (e, t) => {
87
+ var n = o.comment(), r = o.first_child(n), i = (e) => {
88
+ var n = f(), r = o.child(n), i = (e) => {
89
+ var n = d();
90
+ o.template_effect(() => {
91
+ o.set_attribute(n, "src", o.get(t).logo.url), o.set_attribute(n, "alt", o.get(t).logo.alt);
92
+ }), o.append(e, n);
93
+ };
94
+ o.if(r, (e) => {
95
+ o.get(t).logo.url && e(i);
96
+ });
97
+ var a = o.sibling(r, 2), s = o.child(a, !0);
98
+ o.reset(a), o.reset(n), o.template_effect(() => o.set_text(s, o.get(t).monitor.name)), o.delegated("click", n, () => A(o.get(t))), o.append(e, n);
99
+ }, a = (e) => {
100
+ let n = o.derived(() => o.get(t).feature.place_name.indexOf(","));
101
+ var r = m(), i = o.sibling(o.child(r), 2), a = o.child(i), s = o.child(a, !0);
102
+ o.reset(a);
103
+ var c = o.sibling(a, 2), l = (e) => {
104
+ var r = p(), i = o.child(r, !0);
105
+ o.reset(r), o.template_effect((e) => o.set_text(i, e), [() => o.get(t).feature.place_name.substring(o.get(n) + 1).trim()]), o.append(e, r);
106
+ };
107
+ o.if(c, (e) => {
108
+ o.get(n) >= 0 && e(l);
109
+ }), o.reset(i), o.reset(r), o.template_effect((e) => o.set_text(s, e), [() => o.get(t).feature.place_name.substring(0, o.get(n) < 0 ? void 0 : o.get(n))]), o.delegated("click", r, () => j(o.get(t))), o.append(e, r);
110
+ };
111
+ o.if(r, (e) => {
112
+ o.get(t).type === "monitor" ? e(i) : e(a, -1);
113
+ }), o.append(e, n);
114
+ }), o.reset(z), o.reset(M), o.action(M, (e) => T?.(e)), o.template_effect(() => {
115
+ o.set_class(M, 1, o.clsx([
116
+ "flex flex-col bg-white shadow-md overflow-hidden transition-all duration-300 select-none",
117
+ o.get(b) ? "w-12 h-12 rounded-full" : "w-90 rounded-3xl",
118
+ !o.get(b) && o.get(S).length ? "max-h-90" : "max-h-12"
119
+ ])), o.set_attribute(I, "tabindex", o.get(b) ? -1 : 0), o.set_class(z, 1, o.clsx(["overflow-y-auto transition-all duration-300 divide-y divide-gray-100", o.get(b) ? "max-h-0" : "max-h-80"]));
120
+ }), o.delegated("click", P, E), o.delegated("input", I, k), o.bind_value(I, () => o.get(x), (e) => o.set(x, e)), o.append(g, M), o.pop();
121
+ }
122
+ o.delegate(["click", "input"]);
123
+ //#endregion
124
+ export { g as default };
@@ -0,0 +1,90 @@
1
+ import { monitorsManager as e } from "../monitors/monitors.svelte.js";
2
+ import t from "../assets/logos/airgradient-blue.js";
3
+ import n from "../assets/logos/airnow-compact.js";
4
+ import r from "../assets/logos/carb-compact.js";
5
+ import i from "../assets/logos/purpleair-compact.js";
6
+ import a from "../assets/logos/sjvair.js";
7
+ import { geocoding as o } from "@maptiler/sdk";
8
+ //#region src/lib/search/service.ts
9
+ var s = [-119.8, 36.76];
10
+ function c(e) {
11
+ switch (e.data_source.name) {
12
+ case "AQview": return {
13
+ url: r,
14
+ alt: "AQview"
15
+ };
16
+ case "AirNow.gov": return {
17
+ url: n,
18
+ alt: "AirNow.gov"
19
+ };
20
+ case "PurpleAir": return {
21
+ url: i,
22
+ alt: "PurpleAir"
23
+ };
24
+ case "Central California Asthma Collaborative": return {
25
+ url: a,
26
+ alt: "Central California Asthma Collaborative"
27
+ };
28
+ case "AirGradient": return {
29
+ url: t,
30
+ alt: "AirGradient"
31
+ };
32
+ default: return console.warn(`[search] Unknown data source: ${e.data_source.name}`), {
33
+ url: "",
34
+ alt: ""
35
+ };
36
+ }
37
+ }
38
+ var l = null;
39
+ function u() {
40
+ return l ??= d();
41
+ }
42
+ function d() {
43
+ return new Promise((e) => {
44
+ if (!navigator.geolocation) {
45
+ e(s);
46
+ return;
47
+ }
48
+ let t = setTimeout(() => e(s), 3e3);
49
+ navigator.geolocation.getCurrentPosition((n) => {
50
+ clearTimeout(t), e([n.coords.longitude, n.coords.latitude]);
51
+ }, () => {
52
+ clearTimeout(t), e(s);
53
+ });
54
+ });
55
+ }
56
+ async function f(t) {
57
+ if (!e.latest) return [];
58
+ let n = t.toLowerCase(), r = [], i = [], a = [];
59
+ for (let t of e.latest.values()) {
60
+ let e = t.name.toLowerCase();
61
+ e === n ? r.push(t) : e.startsWith(n) ? i.push(t) : e.includes(n) && a.push(t);
62
+ }
63
+ return [
64
+ ...r,
65
+ ...i,
66
+ ...a
67
+ ].slice(0, 4).map((e) => ({
68
+ type: "monitor",
69
+ monitor: e,
70
+ logo: c(e)
71
+ }));
72
+ }
73
+ async function p(e) {
74
+ let t = await u();
75
+ try {
76
+ return (await o.forward(e, {
77
+ country: ["us"],
78
+ fuzzyMatch: !0,
79
+ limit: 4,
80
+ proximity: t
81
+ })).features.map((e) => ({
82
+ type: "geocode",
83
+ feature: e
84
+ }));
85
+ } catch {
86
+ return [];
87
+ }
88
+ }
89
+ //#endregion
90
+ export { p as geocode, f as monitorSearch };
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/dist/lib/utils.js CHANGED
@@ -1,8 +1,14 @@
1
- import e from "./node_modules/clsx/dist/clsx.js";
2
- import { twMerge as t } from "./node_modules/tailwind-merge/dist/bundle-mjs.js";
1
+ import { clsx as e } from "clsx";
2
+ import { twMerge as t } from "tailwind-merge";
3
3
  //#region src/lib/utils.ts
4
4
  function n(...n) {
5
5
  return t(e(n));
6
6
  }
7
+ function r(e, t) {
8
+ let n;
9
+ return (...r) => {
10
+ clearTimeout(n), n = setTimeout(() => e(...r), t);
11
+ };
12
+ }
7
13
  //#endregion
8
- export { n as cn };
14
+ export { n as cn, r as debounce };
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@sjvair/monitor-map",
3
3
  "description": "SJVAir's interactive monitor map",
4
- "version": "3.0.1",
4
+ "version": "3.0.3",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
- "build": "vite build",
7
+ "build:local": "PROD_MODE=local vite build",
8
+ "build": "PROD_MODE=production vite build",
8
9
  "build:lib": "vite build --config vite.config.lib.ts",
9
10
  "preview": "vite preview",
10
11
  "check": "svelte-check --tsconfig ./tsconfig.json",
@@ -24,64 +25,64 @@
24
25
  },
25
26
  "files": [
26
27
  "src/lib",
27
- "dist/lib",
28
- "dist/monitor-map"
28
+ "dist/lib"
29
29
  ],
30
30
  "sideEffects": [
31
31
  "**/*.css"
32
32
  ],
33
33
  "peerDependencies": {
34
+ "sv-router": "^0.16.2",
34
35
  "svelte": "^5.0.0"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@eslint/compat": "^2.1.0",
38
39
  "@eslint/js": "^10.0.1",
39
40
  "@fontsource-variable/inter": "^5.2.8",
40
- "@internationalized/date": "^3.12.1",
41
- "@lucide/svelte": "^1.16.0",
41
+ "@sveltejs/enhanced-img": "^0.11.0",
42
+ "@sveltejs/vite-plugin-svelte": "^7.2.0",
43
+ "@tailwindcss/vite": "^4.3.2",
44
+ "@types/node": "^26.1.1",
45
+ "eslint": "^10.6.0",
46
+ "eslint-config-prettier": "^10.1.8",
47
+ "eslint-plugin-svelte": "^3.20.0",
48
+ "globals": "^17.7.0",
49
+ "postcss": "^8.5.16",
50
+ "prettier": "^3.9.4",
51
+ "prettier-plugin-svelte": "^4.1.1",
52
+ "prettier-plugin-tailwindcss": "^0.8.0",
53
+ "shadcn-svelte": "^1.4.0",
54
+ "svelte": "^5.56.4",
55
+ "svelte-check": "^4.7.2",
56
+ "tailwindcss": "^4.3.2",
57
+ "tw-animate-css": "^1.4.0",
58
+ "typescript": "^6.0.3",
59
+ "typescript-eslint": "^8.63.0",
60
+ "vite": "^8.1.3"
61
+ },
62
+ "dependencies": {
63
+ "@internationalized/date": "^3.12.2",
64
+ "@lucide/svelte": "^1.23.0",
42
65
  "@maptiler/sdk": "^4.0.2",
43
66
  "@maptiler/weather": "^3.1.1",
44
67
  "@sjvair/sdk": "npm:@jsr/sjvair__sdk@^3.0.2",
45
- "@sveltejs/enhanced-img": "^0.10.4",
46
- "@sveltejs/vite-plugin-svelte": "^7.1.2",
47
- "@tailwindcss/vite": "^4.3.0",
48
68
  "@tstk/builtin-extensions": "npm:@jsr/tstk__builtin-extensions@^1.0.8",
49
- "@tstk/decorators": "npm:@jsr/tstk__decorators@^1.0.5",
50
- "@tstk/types": "npm:@jsr/tstk__types@^1.1.0",
51
69
  "@tstk/utils": "npm:@jsr/tstk__utils@^1.1.2",
52
70
  "@turf/area": "^7.3.5",
71
+ "@turf/clusters-dbscan": "^7.3.5",
53
72
  "@turf/helpers": "^7.3.5",
54
73
  "@types/geojson": "^7946.0.16",
55
- "@types/node": "^25.9.1",
56
74
  "bits-ui": "^2.18.1",
57
75
  "clsx": "^2.1.1",
58
- "color2k": "^2.0.3",
59
- "date-fns": "^4.3.0",
60
- "eslint": "^10.4.0",
61
- "eslint-config-prettier": "^10.1.8",
62
- "eslint-plugin-svelte": "^3.17.1",
63
- "globals": "^17.6.0",
64
- "postcss": "^8.5.15",
65
- "prettier": "^3.8.3",
66
- "prettier-plugin-svelte": "^4.0.1",
67
- "prettier-plugin-tailwindcss": "^0.8.0",
68
- "shadcn-svelte": "^1.2.7",
69
- "svelte": "^5.55.9",
70
- "svelte-check": "^4.4.8",
76
+ "color2k": "^2.0.4",
77
+ "date-fns": "^4.4.0",
71
78
  "tailwind-merge": "^3.6.0",
72
79
  "tailwind-variants": "^3.2.2",
73
- "tailwindcss": "^4.3.0",
74
- "tw-animate-css": "^1.4.0",
75
- "typescript": "^6.0.3",
76
- "typescript-eslint": "^8.60.0",
77
- "uplot": "^1.6.32",
78
- "vite": "^8.0.14"
79
- },
80
- "dependencies": {
81
- "@turf/clusters-dbscan": "^7.3.5",
82
- "sv-router": "^0.16.2"
80
+ "uplot": "^1.6.32"
83
81
  },
84
82
  "keywords": [
85
83
  "svelte"
86
- ]
84
+ ],
85
+ "allowScripts": {
86
+ "sharp@0.34.5": true
87
+ }
87
88
  }
@@ -32,14 +32,14 @@
32
32
 
33
33
  {#if loadScreenState.enabled}
34
34
  <div
35
- class="absolute top-0 left-0 z-50 flex h-full w-full flex-col items-center justify-center gap-4 overflow-hidden bg-white"
35
+ class="absolute top-0 left-0 z-50 flex h-full w-full items-center justify-center overflow-hidden bg-white"
36
36
  {@attach animationTrigger}
37
37
  >
38
- <div>
38
+ <div class="flex justify-around gap-4">
39
39
  <enhanced:img
40
40
  src="$lib/assets/logos/sjvair-parts/sjvair-icon.webp"
41
41
  alt="SJVAir Icon"
42
- class="icon inline-block h-24! w-auto! transition-all duration-500 ease-out"
42
+ class="icon inline-block h-24! w-auto! transition-all duration-500 ease-out object-contain"
43
43
  class:translate-x-0={loadScreenState.entered}
44
44
  class:-translate-x-full={!loadScreenState.entered}
45
45
  class:opacity-100={loadScreenState.entered}
@@ -48,7 +48,7 @@
48
48
  <enhanced:img
49
49
  src="$lib/assets/logos/sjvair-parts/sjvair-sjv.webp"
50
50
  alt="SJV"
51
- class="sjv inline-block h-24! w-auto! transition-all duration-500 ease-out"
51
+ class="sjv inline-block h-24! w-auto! transition-all duration-500 ease-out object-contain"
52
52
  class:translate-y-0={loadScreenState.entered}
53
53
  class:-translate-y-full={!loadScreenState.entered}
54
54
  class:opacity-100={loadScreenState.entered}
@@ -57,7 +57,7 @@
57
57
  <enhanced:img
58
58
  src="$lib/assets/logos/sjvair-parts/sjvair-air.webp"
59
59
  alt="Air"
60
- class="air inline-block h-24! w-auto! transition-all duration-500 ease-out"
60
+ class="air inline-block h-24! w-auto! transition-all duration-500 ease-out object-contain"
61
61
  class:translate-y-0={loadScreenState.entered}
62
62
  class:translate-y-full={!loadScreenState.entered}
63
63
  class:opacity-100={loadScreenState.entered}
@@ -0,0 +1 @@
1
+ <!-- Map view — the map renders in App.svelte, not in the router outlet -->
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ import MonitorMarkersLegend from "$lib/monitors/components/MonitorMarkersLegend.svelte";
3
+ import HMSFireLegend from "$lib/hms/components/HMSFireLegend.svelte";
4
+ </script>
5
+
6
+ <!--
7
+ <div class="z-10 absolute bottom-6 left-6 w-1/2 lg:w-1/5">
8
+ <MonitorMarkersLegend />
9
+ <HMSFireLegend />
10
+ </div>
11
+ -->
12
+ <div class="flex flex-col gap-1 pointer-events-none pl-4 pb-4">
13
+ <HMSFireLegend />
14
+ <MonitorMarkersLegend />
15
+ </div>