@ogc-maps/storybook-components 0.4.0 → 0.4.1

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.
@@ -1,10 +1,10 @@
1
- import { jsx as p, jsxs as f } from "react/jsx-runtime";
1
+ import { jsx as p, jsxs as g } from "react/jsx-runtime";
2
2
  import { useState as m, useRef as y, useEffect as E } from "react";
3
3
  function H({
4
- layers: i,
4
+ layers: e,
5
5
  onExport: s,
6
6
  loading: o = !1,
7
- disabled: g = !1,
7
+ disabled: f = !1,
8
8
  className: l = ""
9
9
  }) {
10
10
  const [n, u] = m(!1), [h, x] = m(!1), [w, v] = m(void 0), t = y(null);
@@ -16,31 +16,31 @@ function H({
16
16
  const b = 12;
17
17
  v(d ? r.top - b : window.innerHeight - r.bottom - b);
18
18
  }
19
- function e(r) {
19
+ function i(r) {
20
20
  t.current && !t.current.contains(r.target) && u(!1);
21
21
  }
22
- return document.addEventListener("click", e), () => document.removeEventListener("click", e);
22
+ return document.addEventListener("click", i), () => document.removeEventListener("click", i);
23
23
  }, [n]);
24
- const a = g || o || i.length === 0, c = [
24
+ const a = f || o || e.length === 0, c = [
25
25
  "mapui:inline-flex mapui:items-center mapui:gap-1.5 mapui:rounded mapui:border mapui:border-gray-300",
26
26
  "mapui:bg-white mapui:px-3 mapui:py-1.5 mapui:text-sm mapui:text-gray-700 mapui:transition-colors",
27
27
  a ? "mapui:cursor-not-allowed mapui:opacity-50" : "mapui:cursor-pointer hover:mapui:bg-gray-50 hover:mapui:border-gray-400"
28
28
  ].join(" ");
29
- return i.length === 1 ? /* @__PURE__ */ p(
29
+ return e.length === 1 ? /* @__PURE__ */ p(
30
30
  "button",
31
31
  {
32
32
  className: `${c} ${l}`.trim(),
33
33
  disabled: a,
34
- onClick: () => !a && s(i[0]),
35
- children: o ? "Exporting..." : `Export ${i[0].label}`
34
+ onClick: () => !a && s(e[0]),
35
+ children: o ? "Exporting..." : `Export ${e[0].label}`
36
36
  }
37
- ) : /* @__PURE__ */ f("div", { ref: t, className: `mapui:relative mapui:inline-block ${l}`.trim(), children: [
38
- /* @__PURE__ */ f(
37
+ ) : /* @__PURE__ */ g("div", { ref: t, className: `mapui:relative mapui:inline-block ${l}`.trim(), children: [
38
+ /* @__PURE__ */ g(
39
39
  "button",
40
40
  {
41
41
  className: c,
42
42
  disabled: a,
43
- onClick: () => !a && u((e) => !e),
43
+ onClick: () => !a && u((i) => !i),
44
44
  "aria-haspopup": "listbox",
45
45
  "aria-expanded": n,
46
46
  children: [
@@ -53,20 +53,20 @@ function H({
53
53
  "ul",
54
54
  {
55
55
  role: "listbox",
56
- className: `mapui:absolute mapui:left-0 mapui:z-10 mapui:min-w-[160px] mapui:overflow-y-auto mapui:rounded mapui:border mapui:border-gray-200 mapui:bg-white mapui:py-1 mapui:shadow-lg ${h ? "mapui:bottom-full mapui:mb-1" : "mapui:top-full mapui:mt-1"}`,
56
+ className: `mapui:absolute mapui:right-0 mapui:z-10 mapui:min-w-[160px] mapui:overflow-y-auto mapui:rounded mapui:border mapui:border-gray-200 mapui:bg-white mapui:py-1 mapui:shadow-lg ${h ? "mapui:bottom-full mapui:mb-1" : "mapui:top-full mapui:mt-1"}`,
57
57
  style: { maxHeight: w },
58
- children: i.map((e) => /* @__PURE__ */ p(
58
+ children: e.map((i) => /* @__PURE__ */ p(
59
59
  "li",
60
60
  {
61
61
  role: "option",
62
62
  "aria-selected": !1,
63
63
  className: "mapui:cursor-pointer mapui:px-3 mapui:py-1.5 mapui:text-sm mapui:text-gray-700 hover:mapui:bg-gray-100",
64
64
  onClick: () => {
65
- s(e), u(!1);
65
+ s(i), u(!1);
66
66
  },
67
- children: e.label
67
+ children: i.label
68
68
  },
69
- e.id
69
+ i.id
70
70
  ))
71
71
  }
72
72
  )
@@ -1,49 +1,50 @@
1
1
  import { jsxs as o, jsx as s } from "react/jsx-runtime";
2
2
  import { useState as g, useCallback as u } from "react";
3
- function w({
3
+ function E({
4
4
  layers: l,
5
5
  activeLayerIds: f,
6
6
  onToggleVisibility: v,
7
7
  onReorder: i,
8
- className: x = ""
8
+ className: x = "",
9
+ hideTitle: h
9
10
  }) {
10
- const [n, r] = g(null), [h, m] = g(null), D = u(
11
+ const [n, r] = g(null), [D, m] = g(null), b = u(
11
12
  (a, e) => {
12
13
  r(e), a.dataTransfer.effectAllowed = "move", a.dataTransfer.setData("text/plain", e);
13
14
  },
14
15
  []
15
- ), b = u(
16
+ ), N = u(
16
17
  (a, e) => {
17
18
  a.preventDefault(), a.dataTransfer.dropEffect = "move", m(e);
18
19
  },
19
20
  []
20
- ), N = u(() => {
21
+ ), O = u(() => {
21
22
  m(null);
22
- }, []), O = u(
23
+ }, []), I = u(
23
24
  (a, e) => {
24
25
  if (a.preventDefault(), m(null), r(null), !i || !n || n === e) return;
25
- const p = l.map((L) => L.id), c = p.indexOf(n), t = p.indexOf(e);
26
+ const p = l.map((j) => j.id), c = p.indexOf(n), t = p.indexOf(e);
26
27
  if (c === -1 || t === -1) return;
27
28
  const d = [...p];
28
29
  d.splice(c, 1), d.splice(t, 0, n), i(d);
29
30
  },
30
31
  [n, l, i]
31
- ), I = u(() => {
32
+ ), L = u(() => {
32
33
  r(null), m(null);
33
34
  }, []);
34
35
  return /* @__PURE__ */ o("div", { className: `mapui:flex mapui:flex-col mapui:gap-1 ${x}`.trim(), children: [
35
- /* @__PURE__ */ s("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Layers" }),
36
+ !h && /* @__PURE__ */ s("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Layers" }),
36
37
  /* @__PURE__ */ s("ul", { className: "mapui:m-0 mapui:list-none mapui:p-0", children: l.map((a) => {
37
- const e = f.includes(a.id), p = n === a.id, c = h === a.id;
38
+ const e = f.includes(a.id), p = n === a.id, c = D === a.id;
38
39
  return /* @__PURE__ */ o(
39
40
  "li",
40
41
  {
41
42
  draggable: !!i,
42
- onDragStart: i ? (t) => D(t, a.id) : void 0,
43
- onDragOver: i ? (t) => b(t, a.id) : void 0,
44
- onDragLeave: i ? N : void 0,
45
- onDrop: i ? (t) => O(t, a.id) : void 0,
46
- onDragEnd: i ? I : void 0,
43
+ onDragStart: i ? (t) => b(t, a.id) : void 0,
44
+ onDragOver: i ? (t) => N(t, a.id) : void 0,
45
+ onDragLeave: i ? O : void 0,
46
+ onDrop: i ? (t) => I(t, a.id) : void 0,
47
+ onDragEnd: i ? L : void 0,
47
48
  className: [
48
49
  "mapui:flex mapui:items-center mapui:gap-2 mapui:rounded mapui:px-2 mapui:py-1.5",
49
50
  "mapui:select-none mapui:transition-colors",
@@ -79,5 +80,5 @@ function w({
79
80
  ] });
80
81
  }
81
82
  export {
82
- w as L
83
+ E as L
83
84
  };
@@ -0,0 +1,106 @@
1
+ import { jsxs as t, jsx as i } from "react/jsx-runtime";
2
+ import { useMemo as f, useCallback as l } from "react";
3
+ function C({
4
+ layers: n,
5
+ activeFilters: h,
6
+ onFilterChange: r,
7
+ onClearFilters: g,
8
+ className: c = "",
9
+ hideTitle: d
10
+ }) {
11
+ const b = f(
12
+ () => n.filter((e) => {
13
+ var u;
14
+ return (u = e.search) == null ? void 0 : u.fields.length;
15
+ }),
16
+ [n]
17
+ ), x = l(
18
+ (e, u, m) => {
19
+ r(e, u, m || void 0);
20
+ },
21
+ [r]
22
+ ), y = l(
23
+ (e, u, m) => {
24
+ r(e, u, m === "" ? void 0 : Number(m));
25
+ },
26
+ [r]
27
+ ), v = l(
28
+ (e, u, m) => {
29
+ r(e, u, m || void 0);
30
+ },
31
+ [r]
32
+ );
33
+ return b.length === 0 ? /* @__PURE__ */ t("div", { className: `mapui:flex mapui:flex-col mapui:gap-1 ${c}`.trim(), children: [
34
+ !d && /* @__PURE__ */ i("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Search & Filter" }),
35
+ /* @__PURE__ */ i("p", { className: "mapui:m-0 mapui:text-xs mapui:text-gray-500", children: "No searchable layers configured." })
36
+ ] }) : /* @__PURE__ */ t("div", { className: `mapui:flex mapui:flex-col mapui:gap-3 ${c}`.trim(), children: [
37
+ !d && /* @__PURE__ */ i("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Search & Filter" }),
38
+ b.map((e) => {
39
+ const u = h[e.id] ?? {}, m = Object.values(u).some((a) => a !== void 0);
40
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-2 mapui:border-b mapui:border-gray-100 mapui:pb-2 last:mapui:border-0", children: [
41
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:justify-between", children: [
42
+ /* @__PURE__ */ i("span", { className: "mapui:text-xs mapui:font-medium mapui:text-gray-600", children: e.label }),
43
+ m && /* @__PURE__ */ i(
44
+ "button",
45
+ {
46
+ type: "button",
47
+ onClick: () => g(e.id),
48
+ className: "mapui:cursor-pointer mapui:border-none mapui:bg-transparent mapui:p-0 mapui:text-xs mapui:text-blue-600 hover:mapui:text-blue-800",
49
+ children: "Clear"
50
+ }
51
+ )
52
+ ] }),
53
+ e.search.fields.map((a) => {
54
+ const o = u[a.property], s = a.options;
55
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-0.5", children: [
56
+ /* @__PURE__ */ i("label", { className: "mapui:text-xs mapui:text-gray-500", children: a.label }),
57
+ a.type === "text" && /* @__PURE__ */ i(
58
+ "input",
59
+ {
60
+ type: "text",
61
+ value: o ?? "",
62
+ placeholder: a.placeholder ?? "",
63
+ onChange: (p) => x(e.id, a.property, p.target.value),
64
+ className: "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500"
65
+ }
66
+ ),
67
+ a.type === "number" && /* @__PURE__ */ i(
68
+ "input",
69
+ {
70
+ type: "number",
71
+ value: o ?? "",
72
+ placeholder: a.placeholder ?? "",
73
+ onChange: (p) => y(e.id, a.property, p.target.value),
74
+ className: "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500"
75
+ }
76
+ ),
77
+ a.type === "datetime" && /* @__PURE__ */ i(
78
+ "input",
79
+ {
80
+ type: "datetime-local",
81
+ value: o ?? "",
82
+ onChange: (p) => x(e.id, a.property, p.target.value),
83
+ className: "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500"
84
+ }
85
+ ),
86
+ a.type === "select" && /* @__PURE__ */ t(
87
+ "select",
88
+ {
89
+ value: o ?? "",
90
+ onChange: (p) => v(e.id, a.property, p.target.value),
91
+ className: "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500",
92
+ children: [
93
+ /* @__PURE__ */ i("option", { value: "", children: a.placeholder ?? "Select..." }),
94
+ s == null ? void 0 : s.map((p) => /* @__PURE__ */ i("option", { value: p, children: p }, p))
95
+ ]
96
+ }
97
+ )
98
+ ] }, a.property);
99
+ })
100
+ ] }, e.id);
101
+ })
102
+ ] });
103
+ }
104
+ export {
105
+ C as S
106
+ };
@@ -1,4 +1,4 @@
1
- import { E as r } from "../../ExportButton-D2xn4G74.js";
1
+ import { E as r } from "../../ExportButton-CLsWoW4m.js";
2
2
  export {
3
3
  r as ExportButton
4
4
  };
@@ -5,6 +5,7 @@ export interface LayerPanelProps {
5
5
  onToggleVisibility: (layerId: string) => void;
6
6
  onReorder?: (layerIds: string[]) => void;
7
7
  className?: string;
8
+ hideTitle?: boolean;
8
9
  }
9
- export declare function LayerPanel({ layers, activeLayerIds, onToggleVisibility, onReorder, className, }: LayerPanelProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function LayerPanel({ layers, activeLayerIds, onToggleVisibility, onReorder, className, hideTitle, }: LayerPanelProps): import("react/jsx-runtime").JSX.Element;
10
11
  //# sourceMappingURL=LayerPanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LayerPanel.d.ts","sourceRoot":"","sources":["../../../src/components/LayerPanel/LayerPanel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,SAAc,GACf,EAAE,eAAe,2CAwGjB"}
1
+ {"version":3,"file":"LayerPanel.d.ts","sourceRoot":"","sources":["../../../src/components/LayerPanel/LayerPanel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,SAAc,EACd,SAAS,GACV,EAAE,eAAe,2CA0GjB"}
@@ -1,4 +1,4 @@
1
- import { L as r } from "../../LayerPanel-K00X2QUj.js";
1
+ import { L as r } from "../../LayerPanel-BHpb8dbm.js";
2
2
  export {
3
3
  r as LayerPanel
4
4
  };
@@ -1,11 +1,11 @@
1
- import { LayerConfig, SearchFilterValues, OgcApiSource } from '../../types';
1
+ import { LayerConfig, SearchFilterValues } from '../../types';
2
2
  export interface SearchPanelProps {
3
3
  layers: LayerConfig[];
4
- sources?: OgcApiSource[];
5
4
  activeFilters: Record<string, SearchFilterValues>;
6
5
  onFilterChange: (layerId: string, property: string, value: string | number | undefined) => void;
7
6
  onClearFilters: (layerId: string) => void;
8
7
  className?: string;
8
+ hideTitle?: boolean;
9
9
  }
10
- export declare function SearchPanel({ layers, sources, activeFilters, onFilterChange, onClearFilters, className, }: SearchPanelProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function SearchPanel({ layers, activeFilters, onFilterChange, onClearFilters, className, hideTitle, }: SearchPanelProps): import("react/jsx-runtime").JSX.Element;
11
11
  //# sourceMappingURL=SearchPanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SearchPanel.d.ts","sourceRoot":"","sources":["../../../src/components/SearchPanel/SearchPanel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAe,MAAM,aAAa,CAAC;AAG9F,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAClD,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAChG,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,OAAY,EACZ,aAAa,EACb,cAAc,EACd,cAAc,EACd,SAAc,GACf,EAAE,gBAAgB,2CAoKlB"}
1
+ {"version":3,"file":"SearchPanel.d.ts","sourceRoot":"","sources":["../../../src/components/SearchPanel/SearchPanel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAe,MAAM,aAAa,CAAC;AAEhF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAClD,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAChG,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,aAAa,EACb,cAAc,EACd,cAAc,EACd,SAAc,EACd,SAAS,GACV,EAAE,gBAAgB,2CAkIlB"}
@@ -1,4 +1,4 @@
1
- import { S as r } from "../../SearchPanel-CFVQV6JJ.js";
1
+ import { S as r } from "../../SearchPanel-B5GPX1gF.js";
2
2
  export {
3
3
  r as SearchPanel
4
4
  };
@@ -1,13 +1,12 @@
1
- import { u as t, a, b as r } from "../useCsvExport-wr7hy0P-.js";
2
- import { f as o, a as c, b as u, g as f, c as g, d as i } from "../ogcApi-BuXSs9i0.js";
1
+ import { f as t, a, b as l, g as r, c, d as o, u, e as g, h as i } from "../useCsvExport-C4WAm7kG.js";
3
2
  export {
4
- o as fetchCollections,
5
- c as fetchFeatures,
6
- u as fetchQueryables,
7
- f as getFilteredVectorTileUrl,
8
- g as getTileJsonUrl,
9
- i as getVectorTileUrl,
10
- t as useCsvExport,
11
- a as useOgcCollections,
12
- r as useOgcFeatures
3
+ t as fetchCollections,
4
+ a as fetchFeatures,
5
+ l as fetchQueryables,
6
+ r as getFilteredVectorTileUrl,
7
+ c as getTileJsonUrl,
8
+ o as getVectorTileUrl,
9
+ u as useCsvExport,
10
+ g as useOgcCollections,
11
+ i as useOgcFeatures
13
12
  };
package/dist/main.js CHANGED
@@ -1,56 +1,55 @@
1
1
  import { B as o } from "./BasemapSwitcher-BW7lyZ2Y.js";
2
2
  import { C as t } from "./CollapsibleControl-VFUTWb_5.js";
3
- import { C as i, f as l, a as c } from "./CoordinateDisplay-PxPmVjpm.js";
4
- import { E as f } from "./ExportButton-D2xn4G74.js";
3
+ import { C as s, f as l, a as c } from "./CoordinateDisplay-PxPmVjpm.js";
4
+ import { E as f } from "./ExportButton-CLsWoW4m.js";
5
5
  import { F as S } from "./FeatureDetailPanel-DpcaTS9I.js";
6
- import { F as p } from "./FeatureTooltip-CM0ZTudi.js";
7
- import { L as g } from "./LayerPanel-K00X2QUj.js";
8
- import { L as d } from "./Legend-D4cc1JzQ.js";
9
- import { S as F } from "./SearchPanel-CFVQV6JJ.js";
10
- import { d as L, f as P, u as T, a as b, b as v } from "./useCsvExport-wr7hy0P-.js";
11
- import { f as D, a as E, b as M, g as U, c as V, d as w } from "./ogcApi-BuXSs9i0.js";
12
- import { BasemapConfigSchema as A, CirclePaintSchema as I, CircleStyleSchema as J, FillPaintSchema as Q, FillStyleSchema as j, FilterConfigSchema as k, LayerConfigSchema as q, LegendConfigSchema as z, LegendEntrySchema as G, LinePaintSchema as H, LineStyleSchema as K, MapConfigSchema as N, OgcApiSourceSchema as R, SearchConfigSchema as W, SearchFieldSchema as X, StyleConfigSchema as Y, UIConfigSchema as Z, ViewConfigSchema as _, safeValidateMapConfig as $, validateMapConfig as ee } from "./schemas/index.js";
6
+ import { F as C } from "./FeatureTooltip-CM0ZTudi.js";
7
+ import { L as g } from "./LayerPanel-BHpb8dbm.js";
8
+ import { L as u } from "./Legend-D4cc1JzQ.js";
9
+ import { S as F } from "./SearchPanel-B5GPX1gF.js";
10
+ import { i as L, j as P, f as T, a as v, b as B, g as D, c as E, d as M, u as U, e as V, h as b } from "./useCsvExport-C4WAm7kG.js";
11
+ import { BasemapConfigSchema as O, CirclePaintSchema as j, CircleStyleSchema as A, FillPaintSchema as I, FillStyleSchema as J, FilterConfigSchema as Q, LayerConfigSchema as k, LegendConfigSchema as q, LegendEntrySchema as z, LinePaintSchema as G, LineStyleSchema as H, MapConfigSchema as K, OgcApiSourceSchema as N, SearchConfigSchema as R, SearchFieldSchema as W, StyleConfigSchema as X, UIConfigSchema as Y, ViewConfigSchema as Z, safeValidateMapConfig as _, validateMapConfig as $ } from "./schemas/index.js";
13
12
  import './style.css';export {
14
- A as BasemapConfigSchema,
13
+ O as BasemapConfigSchema,
15
14
  o as BasemapSwitcher,
16
- I as CirclePaintSchema,
17
- J as CircleStyleSchema,
15
+ j as CirclePaintSchema,
16
+ A as CircleStyleSchema,
18
17
  t as CollapsibleControl,
19
- i as CoordinateDisplay,
18
+ s as CoordinateDisplay,
20
19
  f as ExportButton,
21
20
  S as FeatureDetailPanel,
22
- p as FeatureTooltip,
23
- Q as FillPaintSchema,
24
- j as FillStyleSchema,
25
- k as FilterConfigSchema,
26
- q as LayerConfigSchema,
21
+ C as FeatureTooltip,
22
+ I as FillPaintSchema,
23
+ J as FillStyleSchema,
24
+ Q as FilterConfigSchema,
25
+ k as LayerConfigSchema,
27
26
  g as LayerPanel,
28
- d as Legend,
29
- z as LegendConfigSchema,
30
- G as LegendEntrySchema,
31
- H as LinePaintSchema,
32
- K as LineStyleSchema,
33
- N as MapConfigSchema,
34
- R as OgcApiSourceSchema,
35
- W as SearchConfigSchema,
36
- X as SearchFieldSchema,
27
+ u as Legend,
28
+ q as LegendConfigSchema,
29
+ z as LegendEntrySchema,
30
+ G as LinePaintSchema,
31
+ H as LineStyleSchema,
32
+ K as MapConfigSchema,
33
+ N as OgcApiSourceSchema,
34
+ R as SearchConfigSchema,
35
+ W as SearchFieldSchema,
37
36
  F as SearchPanel,
38
- Y as StyleConfigSchema,
39
- Z as UIConfigSchema,
40
- _ as ViewConfigSchema,
37
+ X as StyleConfigSchema,
38
+ Y as UIConfigSchema,
39
+ Z as ViewConfigSchema,
41
40
  L as downloadCsv,
42
41
  P as featuresToCsv,
43
- D as fetchCollections,
44
- E as fetchFeatures,
45
- M as fetchQueryables,
42
+ T as fetchCollections,
43
+ v as fetchFeatures,
44
+ B as fetchQueryables,
46
45
  l as formatDMS,
47
46
  c as formatDecimal,
48
- U as getFilteredVectorTileUrl,
49
- V as getTileJsonUrl,
50
- w as getVectorTileUrl,
51
- $ as safeValidateMapConfig,
52
- T as useCsvExport,
53
- b as useOgcCollections,
54
- v as useOgcFeatures,
55
- ee as validateMapConfig
47
+ D as getFilteredVectorTileUrl,
48
+ E as getTileJsonUrl,
49
+ M as getVectorTileUrl,
50
+ _ as safeValidateMapConfig,
51
+ U as useCsvExport,
52
+ V as useOgcCollections,
53
+ b as useOgcFeatures,
54
+ $ as validateMapConfig
56
55
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- /*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--mapui-font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--mapui-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--mapui-color-blue-50:oklch(97% .014 254.604);--mapui-color-blue-100:oklch(93.2% .032 255.585);--mapui-color-blue-300:oklch(80.9% .105 251.813);--mapui-color-blue-500:oklch(62.3% .214 259.815);--mapui-color-blue-600:oklch(54.6% .245 262.881);--mapui-color-blue-700:oklch(48.8% .243 264.376);--mapui-color-gray-100:oklch(96.7% .003 264.542);--mapui-color-gray-200:oklch(92.8% .006 264.531);--mapui-color-gray-300:oklch(87.2% .01 258.338);--mapui-color-gray-400:oklch(70.7% .022 261.325);--mapui-color-gray-500:oklch(55.1% .027 264.364);--mapui-color-gray-600:oklch(44.6% .03 256.802);--mapui-color-gray-700:oklch(37.3% .034 259.733);--mapui-color-gray-800:oklch(27.8% .033 256.848);--mapui-color-black:#000;--mapui-color-white:#fff;--mapui-spacing:.25rem;--mapui-container-lg:32rem;--mapui-text-xs:.75rem;--mapui-text-xs--line-height:calc(1/.75);--mapui-text-sm:.875rem;--mapui-text-sm--line-height:calc(1.25/.875);--mapui-text-lg:1.125rem;--mapui-text-lg--line-height:calc(1.75/1.125);--mapui-font-weight-medium:500;--mapui-font-weight-semibold:600;--mapui-tracking-wide:.025em;--mapui-radius-sm:.25rem;--mapui-radius-md:.375rem;--mapui-radius-lg:.5rem;--mapui-default-transition-duration:.15s;--mapui-default-transition-timing-function:cubic-bezier(.4,0,.2,1);--mapui-default-font-family:var(--mapui-font-sans);--mapui-default-mono-font-family:var(--mapui-font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--mapui-default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--mapui-default-font-feature-settings,normal);font-variation-settings:var(--mapui-default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--mapui-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--mapui-default-mono-font-feature-settings,normal);font-variation-settings:var(--mapui-default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.mapui\:absolute{position:absolute}.mapui\:fixed{position:fixed}.mapui\:relative{position:relative}.mapui\:inset-0{inset:calc(var(--mapui-spacing)*0)}.mapui\:top-0{top:calc(var(--mapui-spacing)*0)}.mapui\:top-full{top:100%}.mapui\:right-full{right:100%}.mapui\:bottom-full{bottom:100%}.mapui\:left-0{left:calc(var(--mapui-spacing)*0)}.mapui\:z-10{z-index:10}.mapui\:z-50{z-index:50}.mapui\:m-0{margin:calc(var(--mapui-spacing)*0)}.mapui\:mt-0{margin-top:calc(var(--mapui-spacing)*0)}.mapui\:mt-1{margin-top:calc(var(--mapui-spacing)*1)}.mapui\:mt-2{margin-top:calc(var(--mapui-spacing)*2)}.mapui\:mr-2{margin-right:calc(var(--mapui-spacing)*2)}.mapui\:mb-0{margin-bottom:calc(var(--mapui-spacing)*0)}.mapui\:mb-1{margin-bottom:calc(var(--mapui-spacing)*1)}.mapui\:mb-1\.5{margin-bottom:calc(var(--mapui-spacing)*1.5)}.mapui\:mb-2{margin-bottom:calc(var(--mapui-spacing)*2)}.mapui\:contents{display:contents}.mapui\:flex{display:flex}.mapui\:grid{display:grid}.mapui\:inline-block{display:inline-block}.mapui\:inline-flex{display:inline-flex}.mapui\:h-0\.5{height:calc(var(--mapui-spacing)*.5)}.mapui\:h-3{height:calc(var(--mapui-spacing)*3)}.mapui\:h-4{height:calc(var(--mapui-spacing)*4)}.mapui\:h-6{height:calc(var(--mapui-spacing)*6)}.mapui\:h-10{height:calc(var(--mapui-spacing)*10)}.mapui\:h-12{height:calc(var(--mapui-spacing)*12)}.mapui\:max-h-\[80vh\]{max-height:80vh}.mapui\:max-h-\[calc\(100vh-4rem\)\]{max-height:calc(100vh - 4rem)}.mapui\:w-3{width:calc(var(--mapui-spacing)*3)}.mapui\:w-4{width:calc(var(--mapui-spacing)*4)}.mapui\:w-6{width:calc(var(--mapui-spacing)*6)}.mapui\:w-10{width:calc(var(--mapui-spacing)*10)}.mapui\:w-16{width:calc(var(--mapui-spacing)*16)}.mapui\:w-64{width:calc(var(--mapui-spacing)*64)}.mapui\:w-72{width:calc(var(--mapui-spacing)*72)}.mapui\:w-full{width:100%}.mapui\:max-w-\[240px\]{max-width:240px}.mapui\:max-w-lg{max-width:var(--mapui-container-lg)}.mapui\:min-w-\[140px\]{min-width:140px}.mapui\:min-w-\[160px\]{min-width:160px}.mapui\:flex-1{flex:1}.mapui\:shrink-0{flex-shrink:0}.mapui\:cursor-grab{cursor:grab}.mapui\:cursor-not-allowed{cursor:not-allowed}.mapui\:cursor-pointer{cursor:pointer}.mapui\:list-none{list-style-type:none}.mapui\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.mapui\:flex-col{flex-direction:column}.mapui\:flex-wrap{flex-wrap:wrap}.mapui\:items-center{align-items:center}.mapui\:justify-between{justify-content:space-between}.mapui\:justify-center{justify-content:center}.mapui\:gap-0\.5{gap:calc(var(--mapui-spacing)*.5)}.mapui\:gap-1{gap:calc(var(--mapui-spacing)*1)}.mapui\:gap-1\.5{gap:calc(var(--mapui-spacing)*1.5)}.mapui\:gap-2{gap:calc(var(--mapui-spacing)*2)}.mapui\:gap-3{gap:calc(var(--mapui-spacing)*3)}.mapui\:gap-4{gap:calc(var(--mapui-spacing)*4)}:where(.mapui\:space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--mapui-spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--mapui-spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.mapui\:space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--mapui-spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--mapui-spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.mapui\:space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--mapui-spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--mapui-spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.mapui\:gap-x-4{column-gap:calc(var(--mapui-spacing)*4)}.mapui\:gap-y-2{row-gap:calc(var(--mapui-spacing)*2)}.mapui\:truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.mapui\:overflow-hidden{overflow:hidden}.mapui\:overflow-y-auto{overflow-y:auto}.mapui\:rounded{border-radius:.25rem}.mapui\:rounded-full{border-radius:3.40282e38px}.mapui\:rounded-lg{border-radius:var(--mapui-radius-lg)}.mapui\:rounded-md{border-radius:var(--mapui-radius-md)}.mapui\:rounded-sm{border-radius:var(--mapui-radius-sm)}.mapui\:border{border-style:var(--tw-border-style);border-width:1px}.mapui\:border-0{border-style:var(--tw-border-style);border-width:0}.mapui\:border-2{border-style:var(--tw-border-style);border-width:2px}.mapui\:border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.mapui\:border-none{--tw-border-style:none;border-style:none}.mapui\:border-blue-500{border-color:var(--mapui-color-blue-500)}.mapui\:border-gray-100{border-color:var(--mapui-color-gray-100)}.mapui\:border-gray-200{border-color:var(--mapui-color-gray-200)}.mapui\:border-gray-300{border-color:var(--mapui-color-gray-300)}.mapui\:bg-black\/40{background-color:var(--mapui-color-black)}@supports (color:color-mix(in lab,red,red)){.mapui\:bg-black\/40{background-color:color-mix(in oklab,var(--mapui-color-black)40%,transparent)}}.mapui\:bg-black\/60{background-color:var(--mapui-color-black)}@supports (color:color-mix(in lab,red,red)){.mapui\:bg-black\/60{background-color:color-mix(in oklab,var(--mapui-color-black)60%,transparent)}}.mapui\:bg-blue-50{background-color:var(--mapui-color-blue-50)}.mapui\:bg-blue-100{background-color:var(--mapui-color-blue-100)}.mapui\:bg-blue-500{background-color:var(--mapui-color-blue-500)}.mapui\:bg-gray-100{background-color:var(--mapui-color-gray-100)}.mapui\:bg-transparent{background-color:#0000}.mapui\:bg-white{background-color:var(--mapui-color-white)}.mapui\:object-cover{object-fit:cover}.mapui\:p-0{padding:calc(var(--mapui-spacing)*0)}.mapui\:p-2{padding:calc(var(--mapui-spacing)*2)}.mapui\:p-3{padding:calc(var(--mapui-spacing)*3)}.mapui\:p-4{padding:calc(var(--mapui-spacing)*4)}.mapui\:px-2{padding-inline:calc(var(--mapui-spacing)*2)}.mapui\:px-3{padding-inline:calc(var(--mapui-spacing)*3)}.mapui\:px-4{padding-inline:calc(var(--mapui-spacing)*4)}.mapui\:py-0\.5{padding-block:calc(var(--mapui-spacing)*.5)}.mapui\:py-1{padding-block:calc(var(--mapui-spacing)*1)}.mapui\:py-1\.5{padding-block:calc(var(--mapui-spacing)*1.5)}.mapui\:py-2{padding-block:calc(var(--mapui-spacing)*2)}.mapui\:py-3{padding-block:calc(var(--mapui-spacing)*3)}.mapui\:pb-2{padding-bottom:calc(var(--mapui-spacing)*2)}.mapui\:pl-1{padding-left:calc(var(--mapui-spacing)*1)}.mapui\:font-mono{font-family:var(--mapui-font-mono)}.mapui\:text-lg{font-size:var(--mapui-text-lg);line-height:var(--tw-leading,var(--mapui-text-lg--line-height))}.mapui\:text-sm{font-size:var(--mapui-text-sm);line-height:var(--tw-leading,var(--mapui-text-sm--line-height))}.mapui\:text-xs{font-size:var(--mapui-text-xs);line-height:var(--tw-leading,var(--mapui-text-xs--line-height))}.mapui\:leading-none{--tw-leading:1;line-height:1}.mapui\:font-medium{--tw-font-weight:var(--mapui-font-weight-medium);font-weight:var(--mapui-font-weight-medium)}.mapui\:font-semibold{--tw-font-weight:var(--mapui-font-weight-semibold);font-weight:var(--mapui-font-weight-semibold)}.mapui\:tracking-wide{--tw-tracking:var(--mapui-tracking-wide);letter-spacing:var(--mapui-tracking-wide)}.mapui\:break-words{overflow-wrap:break-word}.mapui\:text-blue-300{color:var(--mapui-color-blue-300)}.mapui\:text-blue-600{color:var(--mapui-color-blue-600)}.mapui\:text-blue-700{color:var(--mapui-color-blue-700)}.mapui\:text-gray-400{color:var(--mapui-color-gray-400)}.mapui\:text-gray-500{color:var(--mapui-color-gray-500)}.mapui\:text-gray-600{color:var(--mapui-color-gray-600)}.mapui\:text-gray-700{color:var(--mapui-color-gray-700)}.mapui\:text-gray-800{color:var(--mapui-color-gray-800)}.mapui\:text-white{color:var(--mapui-color-white)}.mapui\:uppercase{text-transform:uppercase}.mapui\:accent-blue-600{accent-color:var(--mapui-color-blue-600)}.mapui\:opacity-50{opacity:.5}.mapui\:opacity-100{opacity:1}.mapui\:shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.mapui\:shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.mapui\:transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--mapui-default-transition-timing-function));transition-duration:var(--tw-duration,var(--mapui-default-transition-duration))}.mapui\:outline-none{--tw-outline-style:none;outline-style:none}.mapui\:select-none{-webkit-user-select:none;user-select:none}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}
1
+ /*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--mapui-font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--mapui-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--mapui-color-blue-50:oklch(97% .014 254.604);--mapui-color-blue-100:oklch(93.2% .032 255.585);--mapui-color-blue-300:oklch(80.9% .105 251.813);--mapui-color-blue-500:oklch(62.3% .214 259.815);--mapui-color-blue-600:oklch(54.6% .245 262.881);--mapui-color-blue-700:oklch(48.8% .243 264.376);--mapui-color-gray-100:oklch(96.7% .003 264.542);--mapui-color-gray-200:oklch(92.8% .006 264.531);--mapui-color-gray-300:oklch(87.2% .01 258.338);--mapui-color-gray-400:oklch(70.7% .022 261.325);--mapui-color-gray-500:oklch(55.1% .027 264.364);--mapui-color-gray-600:oklch(44.6% .03 256.802);--mapui-color-gray-700:oklch(37.3% .034 259.733);--mapui-color-gray-800:oklch(27.8% .033 256.848);--mapui-color-black:#000;--mapui-color-white:#fff;--mapui-spacing:.25rem;--mapui-container-lg:32rem;--mapui-text-xs:.75rem;--mapui-text-xs--line-height:calc(1/.75);--mapui-text-sm:.875rem;--mapui-text-sm--line-height:calc(1.25/.875);--mapui-text-lg:1.125rem;--mapui-text-lg--line-height:calc(1.75/1.125);--mapui-font-weight-medium:500;--mapui-font-weight-semibold:600;--mapui-tracking-wide:.025em;--mapui-radius-sm:.25rem;--mapui-radius-md:.375rem;--mapui-radius-lg:.5rem;--mapui-default-transition-duration:.15s;--mapui-default-transition-timing-function:cubic-bezier(.4,0,.2,1);--mapui-default-font-family:var(--mapui-font-sans);--mapui-default-mono-font-family:var(--mapui-font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--mapui-default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--mapui-default-font-feature-settings,normal);font-variation-settings:var(--mapui-default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--mapui-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--mapui-default-mono-font-feature-settings,normal);font-variation-settings:var(--mapui-default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.mapui\:absolute{position:absolute}.mapui\:fixed{position:fixed}.mapui\:relative{position:relative}.mapui\:inset-0{inset:calc(var(--mapui-spacing)*0)}.mapui\:top-0{top:calc(var(--mapui-spacing)*0)}.mapui\:top-full{top:100%}.mapui\:right-0{right:calc(var(--mapui-spacing)*0)}.mapui\:right-full{right:100%}.mapui\:bottom-full{bottom:100%}.mapui\:z-10{z-index:10}.mapui\:z-50{z-index:50}.mapui\:m-0{margin:calc(var(--mapui-spacing)*0)}.mapui\:mt-0{margin-top:calc(var(--mapui-spacing)*0)}.mapui\:mt-1{margin-top:calc(var(--mapui-spacing)*1)}.mapui\:mt-2{margin-top:calc(var(--mapui-spacing)*2)}.mapui\:mr-2{margin-right:calc(var(--mapui-spacing)*2)}.mapui\:mb-0{margin-bottom:calc(var(--mapui-spacing)*0)}.mapui\:mb-1{margin-bottom:calc(var(--mapui-spacing)*1)}.mapui\:mb-1\.5{margin-bottom:calc(var(--mapui-spacing)*1.5)}.mapui\:mb-2{margin-bottom:calc(var(--mapui-spacing)*2)}.mapui\:contents{display:contents}.mapui\:flex{display:flex}.mapui\:grid{display:grid}.mapui\:inline-block{display:inline-block}.mapui\:inline-flex{display:inline-flex}.mapui\:h-0\.5{height:calc(var(--mapui-spacing)*.5)}.mapui\:h-3{height:calc(var(--mapui-spacing)*3)}.mapui\:h-4{height:calc(var(--mapui-spacing)*4)}.mapui\:h-6{height:calc(var(--mapui-spacing)*6)}.mapui\:h-10{height:calc(var(--mapui-spacing)*10)}.mapui\:h-12{height:calc(var(--mapui-spacing)*12)}.mapui\:max-h-\[80vh\]{max-height:80vh}.mapui\:max-h-\[calc\(100vh-4rem\)\]{max-height:calc(100vh - 4rem)}.mapui\:w-3{width:calc(var(--mapui-spacing)*3)}.mapui\:w-4{width:calc(var(--mapui-spacing)*4)}.mapui\:w-6{width:calc(var(--mapui-spacing)*6)}.mapui\:w-10{width:calc(var(--mapui-spacing)*10)}.mapui\:w-16{width:calc(var(--mapui-spacing)*16)}.mapui\:w-64{width:calc(var(--mapui-spacing)*64)}.mapui\:w-72{width:calc(var(--mapui-spacing)*72)}.mapui\:w-full{width:100%}.mapui\:max-w-\[240px\]{max-width:240px}.mapui\:max-w-lg{max-width:var(--mapui-container-lg)}.mapui\:min-w-\[140px\]{min-width:140px}.mapui\:min-w-\[160px\]{min-width:160px}.mapui\:flex-1{flex:1}.mapui\:shrink-0{flex-shrink:0}.mapui\:cursor-grab{cursor:grab}.mapui\:cursor-not-allowed{cursor:not-allowed}.mapui\:cursor-pointer{cursor:pointer}.mapui\:list-none{list-style-type:none}.mapui\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.mapui\:flex-col{flex-direction:column}.mapui\:flex-wrap{flex-wrap:wrap}.mapui\:items-center{align-items:center}.mapui\:justify-between{justify-content:space-between}.mapui\:justify-center{justify-content:center}.mapui\:gap-0\.5{gap:calc(var(--mapui-spacing)*.5)}.mapui\:gap-1{gap:calc(var(--mapui-spacing)*1)}.mapui\:gap-1\.5{gap:calc(var(--mapui-spacing)*1.5)}.mapui\:gap-2{gap:calc(var(--mapui-spacing)*2)}.mapui\:gap-3{gap:calc(var(--mapui-spacing)*3)}.mapui\:gap-4{gap:calc(var(--mapui-spacing)*4)}:where(.mapui\:space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--mapui-spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--mapui-spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.mapui\:space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--mapui-spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--mapui-spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.mapui\:space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--mapui-spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--mapui-spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.mapui\:gap-x-4{column-gap:calc(var(--mapui-spacing)*4)}.mapui\:gap-y-2{row-gap:calc(var(--mapui-spacing)*2)}.mapui\:truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.mapui\:overflow-hidden{overflow:hidden}.mapui\:overflow-y-auto{overflow-y:auto}.mapui\:rounded{border-radius:.25rem}.mapui\:rounded-full{border-radius:3.40282e38px}.mapui\:rounded-lg{border-radius:var(--mapui-radius-lg)}.mapui\:rounded-md{border-radius:var(--mapui-radius-md)}.mapui\:rounded-sm{border-radius:var(--mapui-radius-sm)}.mapui\:border{border-style:var(--tw-border-style);border-width:1px}.mapui\:border-0{border-style:var(--tw-border-style);border-width:0}.mapui\:border-2{border-style:var(--tw-border-style);border-width:2px}.mapui\:border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.mapui\:border-none{--tw-border-style:none;border-style:none}.mapui\:border-blue-500{border-color:var(--mapui-color-blue-500)}.mapui\:border-gray-100{border-color:var(--mapui-color-gray-100)}.mapui\:border-gray-200{border-color:var(--mapui-color-gray-200)}.mapui\:border-gray-300{border-color:var(--mapui-color-gray-300)}.mapui\:bg-black\/40{background-color:var(--mapui-color-black)}@supports (color:color-mix(in lab,red,red)){.mapui\:bg-black\/40{background-color:color-mix(in oklab,var(--mapui-color-black)40%,transparent)}}.mapui\:bg-black\/60{background-color:var(--mapui-color-black)}@supports (color:color-mix(in lab,red,red)){.mapui\:bg-black\/60{background-color:color-mix(in oklab,var(--mapui-color-black)60%,transparent)}}.mapui\:bg-blue-50{background-color:var(--mapui-color-blue-50)}.mapui\:bg-blue-100{background-color:var(--mapui-color-blue-100)}.mapui\:bg-blue-500{background-color:var(--mapui-color-blue-500)}.mapui\:bg-gray-100{background-color:var(--mapui-color-gray-100)}.mapui\:bg-transparent{background-color:#0000}.mapui\:bg-white{background-color:var(--mapui-color-white)}.mapui\:object-cover{object-fit:cover}.mapui\:p-0{padding:calc(var(--mapui-spacing)*0)}.mapui\:p-2{padding:calc(var(--mapui-spacing)*2)}.mapui\:p-3{padding:calc(var(--mapui-spacing)*3)}.mapui\:p-4{padding:calc(var(--mapui-spacing)*4)}.mapui\:px-2{padding-inline:calc(var(--mapui-spacing)*2)}.mapui\:px-3{padding-inline:calc(var(--mapui-spacing)*3)}.mapui\:px-4{padding-inline:calc(var(--mapui-spacing)*4)}.mapui\:py-0\.5{padding-block:calc(var(--mapui-spacing)*.5)}.mapui\:py-1{padding-block:calc(var(--mapui-spacing)*1)}.mapui\:py-1\.5{padding-block:calc(var(--mapui-spacing)*1.5)}.mapui\:py-2{padding-block:calc(var(--mapui-spacing)*2)}.mapui\:py-3{padding-block:calc(var(--mapui-spacing)*3)}.mapui\:pb-2{padding-bottom:calc(var(--mapui-spacing)*2)}.mapui\:pl-1{padding-left:calc(var(--mapui-spacing)*1)}.mapui\:font-mono{font-family:var(--mapui-font-mono)}.mapui\:text-lg{font-size:var(--mapui-text-lg);line-height:var(--tw-leading,var(--mapui-text-lg--line-height))}.mapui\:text-sm{font-size:var(--mapui-text-sm);line-height:var(--tw-leading,var(--mapui-text-sm--line-height))}.mapui\:text-xs{font-size:var(--mapui-text-xs);line-height:var(--tw-leading,var(--mapui-text-xs--line-height))}.mapui\:leading-none{--tw-leading:1;line-height:1}.mapui\:font-medium{--tw-font-weight:var(--mapui-font-weight-medium);font-weight:var(--mapui-font-weight-medium)}.mapui\:font-semibold{--tw-font-weight:var(--mapui-font-weight-semibold);font-weight:var(--mapui-font-weight-semibold)}.mapui\:tracking-wide{--tw-tracking:var(--mapui-tracking-wide);letter-spacing:var(--mapui-tracking-wide)}.mapui\:break-words{overflow-wrap:break-word}.mapui\:text-blue-300{color:var(--mapui-color-blue-300)}.mapui\:text-blue-600{color:var(--mapui-color-blue-600)}.mapui\:text-blue-700{color:var(--mapui-color-blue-700)}.mapui\:text-gray-400{color:var(--mapui-color-gray-400)}.mapui\:text-gray-500{color:var(--mapui-color-gray-500)}.mapui\:text-gray-600{color:var(--mapui-color-gray-600)}.mapui\:text-gray-700{color:var(--mapui-color-gray-700)}.mapui\:text-gray-800{color:var(--mapui-color-gray-800)}.mapui\:text-white{color:var(--mapui-color-white)}.mapui\:uppercase{text-transform:uppercase}.mapui\:accent-blue-600{accent-color:var(--mapui-color-blue-600)}.mapui\:opacity-50{opacity:.5}.mapui\:opacity-100{opacity:1}.mapui\:shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.mapui\:shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.mapui\:transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--mapui-default-transition-timing-function));transition-duration:var(--tw-duration,var(--mapui-default-transition-duration))}.mapui\:outline-none{--tw-outline-style:none;outline-style:none}.mapui\:select-none{-webkit-user-select:none;user-select:none}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}
@@ -0,0 +1,146 @@
1
+ import { useState as d, useEffect as j, useCallback as w } from "react";
2
+ function b(e) {
3
+ return e.endsWith("/") ? e.slice(0, -1) : e;
4
+ }
5
+ async function C(e) {
6
+ const n = await fetch(e);
7
+ if (!n.ok)
8
+ throw new Error(`OGC API request failed: ${n.status} ${n.statusText} (${e})`);
9
+ return n.json();
10
+ }
11
+ async function R(e) {
12
+ const n = `${b(e)}/collections?f=json`;
13
+ return (await C(n)).collections;
14
+ }
15
+ async function S(e, n, t = {}) {
16
+ var c;
17
+ const r = b(e), s = new URLSearchParams({ f: "geojson" });
18
+ if (t.limit != null && s.set("limit", String(t.limit)), t.offset != null && s.set("offset", String(t.offset)), t.bbox && s.set("bbox", t.bbox.join(",")), (c = t.properties) != null && c.length && s.set("properties", t.properties.join(",")), t.datetime && s.set("datetime", t.datetime), t.filter)
19
+ for (const [a, o] of Object.entries(t.filter))
20
+ s.set(a, String(o));
21
+ const i = `${r}/collections/${encodeURIComponent(n)}/items?${s}`;
22
+ return C(i);
23
+ }
24
+ async function k(e, n) {
25
+ const r = `${b(e)}/collections/${encodeURIComponent(n)}/queryables?f=schemajson`;
26
+ return C(r);
27
+ }
28
+ function v(e, n, t = "WebMercatorQuad") {
29
+ return `${b(e)}/collections/${encodeURIComponent(n)}/tiles/${encodeURIComponent(t)}/tilejson.json`;
30
+ }
31
+ function L(e, n, t = "WebMercatorQuad") {
32
+ return `${b(e)}/collections/${encodeURIComponent(n)}/tiles/${encodeURIComponent(t)}/{z}/{x}/{y}`;
33
+ }
34
+ function I(e, n, t, r = "WebMercatorQuad") {
35
+ const i = `${b(e)}/collections/${encodeURIComponent(n)}/tiles/${encodeURIComponent(r)}/{z}/{x}/{y}`;
36
+ if (!t || Object.keys(t).length === 0) return i;
37
+ const c = new URLSearchParams();
38
+ for (const [a, o] of Object.entries(t))
39
+ c.set(a, String(o));
40
+ return `${i}?${c}`;
41
+ }
42
+ function J(e) {
43
+ const [n, t] = d([]), [r, s] = d(!1), [i, c] = d(null);
44
+ return j(() => {
45
+ if (!e) return;
46
+ let a = !1;
47
+ return s(!0), c(null), R(e).then((o) => {
48
+ a || t(o);
49
+ }).catch((o) => {
50
+ a || c(o instanceof Error ? o : new Error(String(o)));
51
+ }).finally(() => {
52
+ a || s(!1);
53
+ }), () => {
54
+ a = !0;
55
+ };
56
+ }, [e]), { collections: n, loading: r, error: i };
57
+ }
58
+ function T(e, n, t = {}) {
59
+ const [r, s] = d([]), [i, c] = d(!1), [a, o] = d(null), [g, f] = d(!1), p = JSON.stringify(t);
60
+ return j(() => {
61
+ if (!e || !n) return;
62
+ let h = !1;
63
+ c(!0), o(null);
64
+ const u = JSON.parse(p);
65
+ return S(e, n, u).then((l) => {
66
+ if (!h) {
67
+ s(l.features);
68
+ const y = u.limit ?? 10, m = u.offset ?? 0;
69
+ l.numberMatched != null ? f(m + l.features.length < l.numberMatched) : f(l.features.length >= y);
70
+ }
71
+ }).catch((l) => {
72
+ h || (o(l instanceof Error ? l : new Error(String(l))), s([]), f(!1));
73
+ }).finally(() => {
74
+ h || c(!1);
75
+ }), () => {
76
+ h = !0;
77
+ };
78
+ }, [e, n, p]), { features: r, loading: i, error: a, hasMore: g };
79
+ }
80
+ function $(e, n) {
81
+ return e.includes('"') || e.includes(n) || e.includes(`
82
+ `) ? `"${e.replace(/"/g, '""')}"` : e;
83
+ }
84
+ function E(e, n) {
85
+ const t = (e.properties ?? {})[n];
86
+ return t == null ? "" : typeof t == "object" ? JSON.stringify(t) : String(t);
87
+ }
88
+ function U(e, n = {}) {
89
+ const { fields: t, includeGeometry: r = !1, delimiter: s = "," } = n;
90
+ if (e.length === 0) return "";
91
+ const i = t ?? [...new Set(e.flatMap((o) => Object.keys(o.properties ?? {})))], c = r ? [...i, "geometry"] : i, a = e.map((o) => {
92
+ const g = i.map(
93
+ (f) => $(E(o, f), s)
94
+ );
95
+ return r && g.push($(JSON.stringify(o.geometry), s)), g.join(s);
96
+ });
97
+ return [c.map((o) => $(o, s)).join(s), ...a].join(`
98
+ `);
99
+ }
100
+ function M(e, n) {
101
+ const t = new Blob([e], { type: "text/csv;charset=utf-8;" }), r = URL.createObjectURL(t), s = document.createElement("a");
102
+ s.href = r, s.download = n, s.style.display = "none", document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(r);
103
+ }
104
+ function z({
105
+ baseUrl: e,
106
+ limit: n = 1e3,
107
+ csvOptions: t
108
+ }) {
109
+ const [r, s] = d(!1), [i, c] = d(null);
110
+ return { exportCsv: w(
111
+ async (o, g = `${o}.csv`) => {
112
+ s(!0), c(null);
113
+ const f = [], p = Math.min(n, 1e3);
114
+ let h = 0;
115
+ try {
116
+ for (; f.length < n; ) {
117
+ const l = n - f.length, y = Math.min(p, l), m = await S(e, o, {
118
+ limit: y,
119
+ offset: h
120
+ });
121
+ if (f.push(...m.features), h += m.features.length, m.features.length < y || m.numberMatched != null && h >= m.numberMatched) break;
122
+ }
123
+ const u = U(f, t);
124
+ M(u, g);
125
+ } catch (u) {
126
+ c(u instanceof Error ? u : new Error(String(u)));
127
+ } finally {
128
+ s(!1);
129
+ }
130
+ },
131
+ [e, n, t]
132
+ ), loading: r, error: i };
133
+ }
134
+ export {
135
+ S as a,
136
+ k as b,
137
+ v as c,
138
+ L as d,
139
+ J as e,
140
+ R as f,
141
+ I as g,
142
+ T as h,
143
+ M as i,
144
+ U as j,
145
+ z as u
146
+ };
@@ -48,18 +48,18 @@ export interface OgcFeatureCollection {
48
48
  type?: string;
49
49
  }>;
50
50
  }
51
- /** A single queryable property definition. */
51
+ /** A single queryable property definition (OGC API schemajson format). */
52
52
  export interface QueryableProperty {
53
- title?: string;
54
- description?: string;
55
- type: string;
56
- enum?: string[];
53
+ name?: string;
54
+ type?: string;
55
+ $ref?: string;
57
56
  }
58
- /** OGC API queryables response. */
57
+ /** OGC API queryables response (schemajson format). */
59
58
  export interface OgcQueryables {
59
+ $id?: string;
60
+ $schema?: string;
60
61
  type: string;
61
62
  title?: string;
62
- description?: string;
63
63
  properties: Record<string, QueryableProperty>;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,CACtC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EACxC,eAAe,GAAE,MAA0B,GAC1C,MAAM,CAUR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ogc-maps/storybook-components",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "main": "./dist/main.js",
6
6
  "publishConfig": {
@@ -1,135 +0,0 @@
1
- import { jsxs as n, jsx as r } from "react/jsx-runtime";
2
- import { useMemo as x, useState as C, useEffect as Q, useCallback as l } from "react";
3
- import { b as $ } from "./ogcApi-BuXSs9i0.js";
4
- function E({
5
- layers: c,
6
- sources: d = [],
7
- activeFilters: g,
8
- onFilterChange: s,
9
- onClearFilters: y,
10
- className: b = ""
11
- }) {
12
- const o = x(
13
- () => c.filter((e) => {
14
- var i;
15
- return (i = e.search) == null ? void 0 : i.fields.length;
16
- }),
17
- [c]
18
- ), [f, v] = C({}), N = x(
19
- () => o.map((e) => e.id).join(","),
20
- [o]
21
- );
22
- Q(() => {
23
- o.forEach(async (e) => {
24
- var a;
25
- const i = d.find((p) => p.id === e.sourceId);
26
- if (!i) return;
27
- if ((a = e.search) == null ? void 0 : a.fields.some(
28
- (p) => p.type === "select" && (!p.options || p.options.length === 0)
29
- ))
30
- try {
31
- const p = await $(i.url, e.collection);
32
- v((m) => ({
33
- ...m,
34
- [e.id]: p.properties
35
- }));
36
- } catch (p) {
37
- console.error(`Failed to fetch queryables for layer ${e.id}`, p);
38
- }
39
- });
40
- }, [N, o, d]);
41
- const h = l(
42
- (e, i, t) => {
43
- s(e, i, t || void 0);
44
- },
45
- [s]
46
- ), S = l(
47
- (e, i, t) => {
48
- s(e, i, t === "" ? void 0 : Number(t));
49
- },
50
- [s]
51
- ), j = l(
52
- (e, i, t) => {
53
- s(e, i, t || void 0);
54
- },
55
- [s]
56
- );
57
- return o.length === 0 ? /* @__PURE__ */ n("div", { className: `mapui:flex mapui:flex-col mapui:gap-1 ${b}`.trim(), children: [
58
- /* @__PURE__ */ r("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Search & Filter" }),
59
- /* @__PURE__ */ r("p", { className: "mapui:m-0 mapui:text-xs mapui:text-gray-500", children: "No searchable layers configured." })
60
- ] }) : /* @__PURE__ */ n("div", { className: `mapui:flex mapui:flex-col mapui:gap-3 ${b}`.trim(), children: [
61
- /* @__PURE__ */ r("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Search & Filter" }),
62
- o.map((e) => {
63
- const i = g[e.id] ?? {}, t = Object.values(i).some((a) => a !== void 0);
64
- return /* @__PURE__ */ n("div", { className: "mapui:flex mapui:flex-col mapui:gap-2 mapui:border-b mapui:border-gray-100 mapui:pb-2 last:mapui:border-0", children: [
65
- /* @__PURE__ */ n("div", { className: "mapui:flex mapui:items-center mapui:justify-between", children: [
66
- /* @__PURE__ */ r("span", { className: "mapui:text-xs mapui:font-medium mapui:text-gray-600", children: e.label }),
67
- t && /* @__PURE__ */ r(
68
- "button",
69
- {
70
- type: "button",
71
- onClick: () => y(e.id),
72
- className: "mapui:cursor-pointer mapui:border-none mapui:bg-transparent mapui:p-0 mapui:text-xs mapui:text-blue-600 hover:mapui:text-blue-800",
73
- children: "Clear"
74
- }
75
- )
76
- ] }),
77
- e.search.fields.map((a) => {
78
- const p = i[a.property];
79
- let m = a.options;
80
- if (a.type === "select" && (!m || m.length === 0)) {
81
- const u = f[e.id];
82
- u && u[a.property] && (m = u[a.property].enum);
83
- }
84
- return /* @__PURE__ */ n("div", { className: "mapui:flex mapui:flex-col mapui:gap-0.5", children: [
85
- /* @__PURE__ */ r("label", { className: "mapui:text-xs mapui:text-gray-500", children: a.label }),
86
- a.type === "text" && /* @__PURE__ */ r(
87
- "input",
88
- {
89
- type: "text",
90
- value: p ?? "",
91
- placeholder: a.placeholder ?? "",
92
- onChange: (u) => h(e.id, a.property, u.target.value),
93
- className: "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500"
94
- }
95
- ),
96
- a.type === "number" && /* @__PURE__ */ r(
97
- "input",
98
- {
99
- type: "number",
100
- value: p ?? "",
101
- placeholder: a.placeholder ?? "",
102
- onChange: (u) => S(e.id, a.property, u.target.value),
103
- className: "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500"
104
- }
105
- ),
106
- a.type === "datetime" && /* @__PURE__ */ r(
107
- "input",
108
- {
109
- type: "datetime-local",
110
- value: p ?? "",
111
- onChange: (u) => h(e.id, a.property, u.target.value),
112
- className: "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500"
113
- }
114
- ),
115
- a.type === "select" && /* @__PURE__ */ n(
116
- "select",
117
- {
118
- value: p ?? "",
119
- onChange: (u) => j(e.id, a.property, u.target.value),
120
- className: "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500",
121
- children: [
122
- /* @__PURE__ */ r("option", { value: "", children: a.placeholder ?? "Select..." }),
123
- m == null ? void 0 : m.map((u) => /* @__PURE__ */ r("option", { value: u, children: u }, u))
124
- ]
125
- }
126
- )
127
- ] }, a.property);
128
- })
129
- ] }, e.id);
130
- })
131
- ] });
132
- }
133
- export {
134
- E as S
135
- };
@@ -1,48 +0,0 @@
1
- function c(t) {
2
- return t.endsWith("/") ? t.slice(0, -1) : t;
3
- }
4
- async function f(t) {
5
- const n = await fetch(t);
6
- if (!n.ok)
7
- throw new Error(`OGC API request failed: ${n.status} ${n.statusText} (${t})`);
8
- return n.json();
9
- }
10
- async function u(t) {
11
- const n = `${c(t)}/collections?f=json`;
12
- return (await f(n)).collections;
13
- }
14
- async function b(t, n, e = {}) {
15
- var r;
16
- const o = c(t), s = new URLSearchParams({ f: "geojson" });
17
- if (e.limit != null && s.set("limit", String(e.limit)), e.offset != null && s.set("offset", String(e.offset)), e.bbox && s.set("bbox", e.bbox.join(",")), (r = e.properties) != null && r.length && s.set("properties", e.properties.join(",")), e.datetime && s.set("datetime", e.datetime), e.filter)
18
- for (const [i, l] of Object.entries(e.filter))
19
- s.set(i, String(l));
20
- const a = `${o}/collections/${encodeURIComponent(n)}/items?${s}`;
21
- return f(a);
22
- }
23
- async function d(t, n) {
24
- const o = `${c(t)}/collections/${encodeURIComponent(n)}/queryables?f=json`;
25
- return f(o);
26
- }
27
- function $(t, n, e = "WebMercatorQuad") {
28
- return `${c(t)}/collections/${encodeURIComponent(n)}/tiles/${encodeURIComponent(e)}/tilejson.json`;
29
- }
30
- function m(t, n, e = "WebMercatorQuad") {
31
- return `${c(t)}/collections/${encodeURIComponent(n)}/tiles/${encodeURIComponent(e)}/{z}/{x}/{y}`;
32
- }
33
- function U(t, n, e, o = "WebMercatorQuad") {
34
- const a = `${c(t)}/collections/${encodeURIComponent(n)}/tiles/${encodeURIComponent(o)}/{z}/{x}/{y}`;
35
- if (!e || Object.keys(e).length === 0) return a;
36
- const r = new URLSearchParams();
37
- for (const [i, l] of Object.entries(e))
38
- r.set(i, String(l));
39
- return `${a}?${r}`;
40
- }
41
- export {
42
- b as a,
43
- d as b,
44
- $ as c,
45
- m as d,
46
- u as f,
47
- U as g
48
- };
@@ -1,101 +0,0 @@
1
- import { useState as d, useEffect as C, useCallback as S } from "react";
2
- import { f as w, a as E } from "./ogcApi-BuXSs9i0.js";
3
- function x(e) {
4
- const [n, s] = d([]), [o, t] = d(!1), [a, l] = d(null);
5
- return C(() => {
6
- if (!e) return;
7
- let f = !1;
8
- return t(!0), l(null), w(e).then((r) => {
9
- f || s(r);
10
- }).catch((r) => {
11
- f || l(r instanceof Error ? r : new Error(String(r)));
12
- }).finally(() => {
13
- f || t(!1);
14
- }), () => {
15
- f = !0;
16
- };
17
- }, [e]), { collections: n, loading: o, error: a };
18
- }
19
- function J(e, n, s = {}) {
20
- const [o, t] = d([]), [a, l] = d(!1), [f, r] = d(null), [p, i] = d(!1), m = JSON.stringify(s);
21
- return C(() => {
22
- if (!e || !n) return;
23
- let h = !1;
24
- l(!0), r(null);
25
- const u = JSON.parse(m);
26
- return E(e, n, u).then((c) => {
27
- if (!h) {
28
- t(c.features);
29
- const y = u.limit ?? 10, g = u.offset ?? 0;
30
- c.numberMatched != null ? i(g + c.features.length < c.numberMatched) : i(c.features.length >= y);
31
- }
32
- }).catch((c) => {
33
- h || (r(c instanceof Error ? c : new Error(String(c))), t([]), i(!1));
34
- }).finally(() => {
35
- h || l(!1);
36
- }), () => {
37
- h = !0;
38
- };
39
- }, [e, n, m]), { features: o, loading: a, error: f, hasMore: p };
40
- }
41
- function b(e, n) {
42
- return e.includes('"') || e.includes(n) || e.includes(`
43
- `) ? `"${e.replace(/"/g, '""')}"` : e;
44
- }
45
- function M(e, n) {
46
- const s = (e.properties ?? {})[n];
47
- return s == null ? "" : typeof s == "object" ? JSON.stringify(s) : String(s);
48
- }
49
- function O(e, n = {}) {
50
- const { fields: s, includeGeometry: o = !1, delimiter: t = "," } = n;
51
- if (e.length === 0) return "";
52
- const a = s ?? [...new Set(e.flatMap((r) => Object.keys(r.properties ?? {})))], l = o ? [...a, "geometry"] : a, f = e.map((r) => {
53
- const p = a.map(
54
- (i) => b(M(r, i), t)
55
- );
56
- return o && p.push(b(JSON.stringify(r.geometry), t)), p.join(t);
57
- });
58
- return [l.map((r) => b(r, t)).join(t), ...f].join(`
59
- `);
60
- }
61
- function j(e, n) {
62
- const s = new Blob([e], { type: "text/csv;charset=utf-8;" }), o = URL.createObjectURL(s), t = document.createElement("a");
63
- t.href = o, t.download = n, t.style.display = "none", document.body.appendChild(t), t.click(), document.body.removeChild(t), URL.revokeObjectURL(o);
64
- }
65
- function N({
66
- baseUrl: e,
67
- limit: n = 1e3,
68
- csvOptions: s
69
- }) {
70
- const [o, t] = d(!1), [a, l] = d(null);
71
- return { exportCsv: S(
72
- async (r, p = `${r}.csv`) => {
73
- t(!0), l(null);
74
- const i = [], m = Math.min(n, 1e3);
75
- let h = 0;
76
- try {
77
- for (; i.length < n; ) {
78
- const c = n - i.length, y = Math.min(m, c), g = await E(e, r, {
79
- limit: y,
80
- offset: h
81
- });
82
- if (i.push(...g.features), h += g.features.length, g.features.length < y || g.numberMatched != null && h >= g.numberMatched) break;
83
- }
84
- const u = O(i, s);
85
- j(u, p);
86
- } catch (u) {
87
- l(u instanceof Error ? u : new Error(String(u)));
88
- } finally {
89
- t(!1);
90
- }
91
- },
92
- [e, n, s]
93
- ), loading: o, error: a };
94
- }
95
- export {
96
- x as a,
97
- J as b,
98
- j as d,
99
- O as f,
100
- N as u
101
- };