@ogc-maps/storybook-components 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/dist/{BasemapSwitcher-BW7lyZ2Y.js → BasemapSwitcher-DuqVusX0.js} +9 -9
- package/dist/CollapsibleControl-BTIkiTmU.js +60 -0
- package/dist/CoordinateDisplay-BblQ34mS.js +154 -0
- package/dist/{ExportButton-Ck1dESnc.js → ExportButton-C8hCCsav.js} +7 -7
- package/dist/{FeatureDetailPanel-CkFpdEKW.js → FeatureDetailPanel-DgCHiNi9.js} +16 -16
- package/dist/FeatureTooltip-DHjMZC0u.js +49 -0
- package/dist/{LayerPanel-SCdJ8948.js → LayerPanel-BkDbZ66Z.js} +23 -23
- package/dist/Legend-CvBd-v0n.js +285 -0
- package/dist/PropertyList-0EonV_BQ.js +33 -0
- package/dist/SearchPanel-DIb7aYVs.js +725 -0
- package/dist/components/BasemapSwitcher/index.js +1 -1
- package/dist/components/CollapsibleControl/CollapsibleControl.d.ts +4 -1
- package/dist/components/CollapsibleControl/CollapsibleControl.d.ts.map +1 -1
- package/dist/components/CollapsibleControl/index.js +1 -1
- package/dist/components/CompassControl/CompassControl.d.ts +19 -0
- package/dist/components/CompassControl/CompassControl.d.ts.map +1 -0
- package/dist/components/CompassControl/index.d.ts +3 -0
- package/dist/components/CompassControl/index.d.ts.map +1 -0
- package/dist/components/CoordinateDisplay/CoordinateDisplay.d.ts +35 -4
- package/dist/components/CoordinateDisplay/CoordinateDisplay.d.ts.map +1 -1
- package/dist/components/CoordinateDisplay/CoordinateDisplay.test.d.ts +2 -0
- package/dist/components/CoordinateDisplay/CoordinateDisplay.test.d.ts.map +1 -0
- package/dist/components/CoordinateDisplay/index.d.ts +1 -1
- package/dist/components/CoordinateDisplay/index.d.ts.map +1 -1
- package/dist/components/CoordinateDisplay/index.js +5 -3
- package/dist/components/Cql2FilterEditor/Cql2FilterEditor.d.ts +9 -0
- package/dist/components/Cql2FilterEditor/Cql2FilterEditor.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/Cql2Preview.d.ts +6 -0
- package/dist/components/Cql2FilterEditor/Cql2Preview.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/FilterRuleEditor.d.ts +9 -0
- package/dist/components/Cql2FilterEditor/FilterRuleEditor.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/FilterRuleGroupEditor.d.ts +10 -0
- package/dist/components/Cql2FilterEditor/FilterRuleGroupEditor.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/FilterValueInput.d.ts +12 -0
- package/dist/components/Cql2FilterEditor/FilterValueInput.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/ParameterizableField.d.ts +30 -0
- package/dist/components/Cql2FilterEditor/ParameterizableField.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/index.d.ts +2 -0
- package/dist/components/Cql2FilterEditor/index.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/operatorOptions.d.ts +9 -0
- package/dist/components/Cql2FilterEditor/operatorOptions.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/styles.d.ts +3 -0
- package/dist/components/Cql2FilterEditor/styles.d.ts.map +1 -0
- package/dist/components/ExportButton/index.js +1 -1
- package/dist/components/ExportModal/ExportModal.d.ts +20 -1
- package/dist/components/ExportModal/ExportModal.d.ts.map +1 -1
- package/dist/components/ExportModal/index.d.ts +1 -1
- package/dist/components/ExportModal/index.d.ts.map +1 -1
- package/dist/components/FeatureDetailPanel/index.js +1 -1
- package/dist/components/FeatureTooltip/index.js +1 -1
- package/dist/components/GlobalSearchBar/GlobalSearchBar.d.ts +25 -0
- package/dist/components/GlobalSearchBar/GlobalSearchBar.d.ts.map +1 -0
- package/dist/components/GlobalSearchBar/GlobalSearchBar.test.d.ts +2 -0
- package/dist/components/GlobalSearchBar/GlobalSearchBar.test.d.ts.map +1 -0
- package/dist/components/GlobalSearchBar/index.d.ts +3 -0
- package/dist/components/GlobalSearchBar/index.d.ts.map +1 -0
- package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.d.ts +22 -0
- package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.d.ts.map +1 -0
- package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.test.d.ts +2 -0
- package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.test.d.ts.map +1 -0
- package/dist/components/GlobalSearchConfigEditor/index.d.ts +3 -0
- package/dist/components/GlobalSearchConfigEditor/index.d.ts.map +1 -0
- package/dist/components/ImageryEditor/ImageryEditor.d.ts +0 -1
- package/dist/components/ImageryEditor/ImageryEditor.d.ts.map +1 -1
- package/dist/components/ImageryEditor/index.d.ts +2 -1
- package/dist/components/ImageryEditor/index.d.ts.map +1 -1
- package/dist/components/ImageryPanel/ImageryPanel.d.ts.map +1 -1
- package/dist/components/InfoControl/InfoControl.d.ts +12 -0
- package/dist/components/InfoControl/InfoControl.d.ts.map +1 -0
- package/dist/components/InfoControl/InfoModal.d.ts +16 -0
- package/dist/components/InfoControl/InfoModal.d.ts.map +1 -0
- package/dist/components/InfoControl/index.d.ts +5 -0
- package/dist/components/InfoControl/index.d.ts.map +1 -0
- package/dist/components/LayerEditor/LayerEditor.d.ts +6 -1
- package/dist/components/LayerEditor/LayerEditor.d.ts.map +1 -1
- package/dist/components/LayerEditor/LayerList.d.ts +8 -1
- package/dist/components/LayerEditor/LayerList.d.ts.map +1 -1
- package/dist/components/LayerEditor/index.d.ts +1 -1
- package/dist/components/LayerEditor/index.d.ts.map +1 -1
- package/dist/components/LayerPanel/index.js +1 -1
- package/dist/components/Legend/Legend.d.ts +7 -1
- package/dist/components/Legend/Legend.d.ts.map +1 -1
- package/dist/components/Legend/index.js +1 -1
- package/dist/components/PropertyFilterPanel/PropertyFilterPanel.d.ts +21 -0
- package/dist/components/PropertyFilterPanel/PropertyFilterPanel.d.ts.map +1 -0
- package/dist/components/PropertyFilterPanel/index.d.ts +3 -0
- package/dist/components/PropertyFilterPanel/index.d.ts.map +1 -0
- package/dist/components/QueryPanel/QueryPanel.d.ts +14 -0
- package/dist/components/QueryPanel/QueryPanel.d.ts.map +1 -0
- package/dist/components/QueryPanel/index.d.ts +3 -0
- package/dist/components/QueryPanel/index.d.ts.map +1 -0
- package/dist/components/ResultsDrawer/ResultsDrawer.d.ts +29 -4
- package/dist/components/ResultsDrawer/ResultsDrawer.d.ts.map +1 -1
- package/dist/components/ResultsDrawer/index.d.ts +1 -1
- package/dist/components/ResultsDrawer/index.d.ts.map +1 -1
- package/dist/components/ResultsDrawer/tableUtils.d.ts +11 -0
- package/dist/components/ResultsDrawer/tableUtils.d.ts.map +1 -0
- package/dist/components/ScaleBarControl/ScaleBarControl.d.ts +32 -0
- package/dist/components/ScaleBarControl/ScaleBarControl.d.ts.map +1 -0
- package/dist/components/ScaleBarControl/index.d.ts +2 -0
- package/dist/components/ScaleBarControl/index.d.ts.map +1 -0
- package/dist/components/SearchPanel/SearchPanel.d.ts +15 -2
- package/dist/components/SearchPanel/SearchPanel.d.ts.map +1 -1
- package/dist/components/SearchPanel/index.js +1 -1
- package/dist/components/SelectionPanel/SelectionPanel.d.ts +3 -1
- package/dist/components/SelectionPanel/SelectionPanel.d.ts.map +1 -1
- package/dist/components/SideMenuPanel/SideMenuPanel.d.ts +51 -0
- package/dist/components/SideMenuPanel/SideMenuPanel.d.ts.map +1 -0
- package/dist/components/SideMenuPanel/index.d.ts +3 -0
- package/dist/components/SideMenuPanel/index.d.ts.map +1 -0
- package/dist/components/SourceEditor/SourceEditor.d.ts +3 -1
- package/dist/components/SourceEditor/SourceEditor.d.ts.map +1 -1
- package/dist/components/SourceEditor/SourceList.d.ts +6 -1
- package/dist/components/SourceEditor/SourceList.d.ts.map +1 -1
- package/dist/components/SourceEditor/index.d.ts +1 -1
- package/dist/components/SourceEditor/index.d.ts.map +1 -1
- package/dist/components/StyleEditor/DataDrivenColorEditor.d.ts +8 -3
- package/dist/components/StyleEditor/DataDrivenColorEditor.d.ts.map +1 -1
- package/dist/components/StyleEditor/PropertyField.d.ts +6 -3
- package/dist/components/StyleEditor/PropertyField.d.ts.map +1 -1
- package/dist/components/StyleEditor/PropertyGroup.d.ts +6 -3
- package/dist/components/StyleEditor/PropertyGroup.d.ts.map +1 -1
- package/dist/components/StyleEditor/StyleEditor.d.ts +7 -3
- package/dist/components/StyleEditor/StyleEditor.d.ts.map +1 -1
- package/dist/components/UIConfigEditor/UIConfigEditor.d.ts +13 -2
- package/dist/components/UIConfigEditor/UIConfigEditor.d.ts.map +1 -1
- package/dist/components/UserMenu/UserMenu.d.ts +15 -0
- package/dist/components/UserMenu/UserMenu.d.ts.map +1 -0
- package/dist/components/UserMenu/index.d.ts +3 -0
- package/dist/components/UserMenu/index.d.ts.map +1 -0
- package/dist/components/ViewEditor/ViewEditor.d.ts.map +1 -1
- package/dist/components/index.d.ts +26 -5
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/shared/controlIcons.d.ts +10 -0
- package/dist/components/shared/controlIcons.d.ts.map +1 -0
- package/dist/geo-DUdRIR7u.js +9776 -0
- package/dist/hooks/index.d.ts +5 -3
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +68 -59
- package/dist/hooks/useExport.d.ts +7 -7
- package/dist/hooks/useExport.d.ts.map +1 -1
- package/dist/id-C2J6iu8_.js +11 -0
- package/dist/index-BtQnyWPg.js +3718 -0
- package/dist/main.js +13801 -2600
- package/dist/schemas/config.d.ts +2127 -5011
- package/dist/schemas/config.d.ts.map +1 -1
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +35 -24
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +47 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +56 -33
- package/dist/useSelection-BFHYsPvU.js +224 -0
- package/dist/utils/colorPalettes.d.ts +4 -2
- package/dist/utils/colorPalettes.d.ts.map +1 -1
- package/dist/utils/colorThemes.d.ts +12 -0
- package/dist/utils/colorThemes.d.ts.map +1 -0
- package/dist/utils/cql2.d.ts +34 -5
- package/dist/utils/cql2.d.ts.map +1 -1
- package/dist/utils/exportConverters.d.ts +16 -0
- package/dist/utils/exportConverters.d.ts.map +1 -0
- package/dist/utils/geo.d.ts +59 -0
- package/dist/utils/geo.d.ts.map +1 -1
- package/dist/utils/id.d.ts +2 -0
- package/dist/utils/id.d.ts.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +477 -0
- package/dist/utils/ogcApi.d.ts +31 -6
- package/dist/utils/ogcApi.d.ts.map +1 -1
- package/dist/utils/propertyFilters.d.ts +35 -0
- package/dist/utils/propertyFilters.d.ts.map +1 -0
- package/dist/utils/queryParameters.d.ts +23 -0
- package/dist/utils/queryParameters.d.ts.map +1 -0
- package/dist/utils/queryableHelpers.d.ts +4 -0
- package/dist/utils/queryableHelpers.d.ts.map +1 -1
- package/dist/utils/slugify.d.ts +2 -0
- package/dist/utils/slugify.d.ts.map +1 -0
- package/package.json +31 -14
- package/dist/CollapsibleControl-qo9daiD8.js +0 -53
- package/dist/CoordinateDisplay-PxPmVjpm.js +0 -47
- package/dist/FeatureTooltip-DxzN-jnp.js +0 -49
- package/dist/Legend-BLWBzD7Y.js +0 -275
- package/dist/PropertyList-BGXHLVBM.js +0 -33
- package/dist/SearchPanel-4Y12jfuP.js +0 -401
- package/dist/components/PropertyDisplayEditor/__tests__/PropertyDisplayEditor.test.d.ts +0 -2
- package/dist/components/PropertyDisplayEditor/__tests__/PropertyDisplayEditor.test.d.ts.map +0 -1
- package/dist/geo-PA_KiJwy.js +0 -1169
- package/dist/index-Cz_PEKV1.js +0 -3035
- package/dist/schemas/__tests__/config.test.d.ts +0 -2
- package/dist/schemas/__tests__/config.test.d.ts.map +0 -1
- package/dist/utils/__tests__/cql2.test.d.ts +0 -2
- package/dist/utils/__tests__/cql2.test.d.ts.map +0 -1
- package/dist/utils/__tests__/expressionColors.test.d.ts +0 -2
- package/dist/utils/__tests__/expressionColors.test.d.ts.map +0 -1
- package/dist/utils/__tests__/propertyDisplay.test.d.ts +0 -2
- package/dist/utils/__tests__/propertyDisplay.test.d.ts.map +0 -1
- package/dist/utils/__tests__/queryableHelpers.test.d.ts +0 -2
- package/dist/utils/__tests__/queryableHelpers.test.d.ts.map +0 -1
- package/dist/utils/__tests__/wkt.test.d.ts +0 -2
- package/dist/utils/__tests__/wkt.test.d.ts.map +0 -1
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { useState as c, useEffect as v, useCallback as M, useMemo as F } from "react";
|
|
2
|
+
import { o as P, v as A, t as L, m as Q, a4 as q, j as k, n as J, a5 as N, a6 as T, a7 as j, a8 as B, a9 as x } from "./geo-DUdRIR7u.js";
|
|
3
|
+
function _(e, t) {
|
|
4
|
+
const [o, f] = c([]), [a, u] = c(!1), [i, g] = c(null), n = t ? `${t.type}:${t.name}:${t.value}` : "";
|
|
5
|
+
return v(() => {
|
|
6
|
+
if (!e) return;
|
|
7
|
+
let s = !1;
|
|
8
|
+
return u(!0), g(null), P(e, t).then((m) => {
|
|
9
|
+
s || f(m);
|
|
10
|
+
}).catch((m) => {
|
|
11
|
+
s || g(m instanceof Error ? m : new Error(String(m)));
|
|
12
|
+
}).finally(() => {
|
|
13
|
+
s || u(!1);
|
|
14
|
+
}), () => {
|
|
15
|
+
s = !0;
|
|
16
|
+
};
|
|
17
|
+
}, [e, n]), { collections: o, loading: a, error: i };
|
|
18
|
+
}
|
|
19
|
+
function R(e, t) {
|
|
20
|
+
const [o, f] = c(null), [a, u] = c(!1), [i, g] = c(null);
|
|
21
|
+
return v(() => {
|
|
22
|
+
if (!e || !t) return;
|
|
23
|
+
let n = !1;
|
|
24
|
+
return u(!0), g(null), A(e, t).then((s) => {
|
|
25
|
+
n || f(s);
|
|
26
|
+
}).catch((s) => {
|
|
27
|
+
n || g(s instanceof Error ? s : new Error(String(s)));
|
|
28
|
+
}).finally(() => {
|
|
29
|
+
n || u(!1);
|
|
30
|
+
}), () => {
|
|
31
|
+
n = !0;
|
|
32
|
+
};
|
|
33
|
+
}, [e, t]), { queryables: o, loading: a, error: i };
|
|
34
|
+
}
|
|
35
|
+
function V(e, t, o = {}, f) {
|
|
36
|
+
const [a, u] = c([]), [i, g] = c(!1), [n, s] = c(null), [m, d] = c(!1), r = JSON.stringify(o), y = f ? `${f.type}:${f.name}:${f.value}` : "";
|
|
37
|
+
return v(() => {
|
|
38
|
+
if (!e || !t) return;
|
|
39
|
+
let h = !1;
|
|
40
|
+
g(!0), s(null);
|
|
41
|
+
const p = JSON.parse(r);
|
|
42
|
+
return L(e, t, p, f).then((l) => {
|
|
43
|
+
if (!h) {
|
|
44
|
+
u(l.features);
|
|
45
|
+
const E = p.limit ?? 10, S = p.offset ?? 0;
|
|
46
|
+
l.numberMatched != null ? d(S + l.features.length < l.numberMatched) : d(l.features.length >= E);
|
|
47
|
+
}
|
|
48
|
+
}).catch((l) => {
|
|
49
|
+
h || (s(l instanceof Error ? l : new Error(String(l))), u([]), d(!1));
|
|
50
|
+
}).finally(() => {
|
|
51
|
+
h || g(!1);
|
|
52
|
+
}), () => {
|
|
53
|
+
h = !0;
|
|
54
|
+
};
|
|
55
|
+
}, [e, t, r, y]), { features: a, loading: i, error: n, hasMore: m };
|
|
56
|
+
}
|
|
57
|
+
function W({
|
|
58
|
+
baseUrl: e,
|
|
59
|
+
limit: t = 1e3,
|
|
60
|
+
csvOptions: o
|
|
61
|
+
}) {
|
|
62
|
+
const [f, a] = c(!1), [u, i] = c(null);
|
|
63
|
+
return { exportCsv: M(
|
|
64
|
+
async (n, s = `${n}.csv`, m) => {
|
|
65
|
+
a(!0), i(null);
|
|
66
|
+
const d = [], r = Math.min(t, 1e3);
|
|
67
|
+
let y = 0;
|
|
68
|
+
try {
|
|
69
|
+
for (; d.length < t; ) {
|
|
70
|
+
const p = t - d.length, l = Math.min(r, p), E = await L(e, n, {
|
|
71
|
+
limit: l,
|
|
72
|
+
offset: y,
|
|
73
|
+
cql2Filter: m
|
|
74
|
+
});
|
|
75
|
+
if (d.push(...E.features), y += E.features.length, E.features.length < l || E.numberMatched != null && y >= E.numberMatched) break;
|
|
76
|
+
}
|
|
77
|
+
const h = Q(d, o);
|
|
78
|
+
q(h, s);
|
|
79
|
+
} catch (h) {
|
|
80
|
+
i(h instanceof Error ? h : new Error(String(h)));
|
|
81
|
+
} finally {
|
|
82
|
+
a(!1);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
[e, t, o]
|
|
86
|
+
), loading: f, error: u };
|
|
87
|
+
}
|
|
88
|
+
function Y({
|
|
89
|
+
baseUrl: e = "",
|
|
90
|
+
limit: t = 1e5,
|
|
91
|
+
converters: o
|
|
92
|
+
}) {
|
|
93
|
+
const [f, a] = c(!1), [u, i] = c(null), [g, n] = c(null), s = M(
|
|
94
|
+
async (d, r, y, h, p) => {
|
|
95
|
+
const l = p ?? e, E = o[r];
|
|
96
|
+
if (!E) {
|
|
97
|
+
n(new Error(`Unknown export format: ${r}`));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
a(!0), i("Fetching features..."), n(null);
|
|
101
|
+
const S = [], O = Math.min(t, 1e3);
|
|
102
|
+
let $ = 0;
|
|
103
|
+
try {
|
|
104
|
+
for (; S.length < t; ) {
|
|
105
|
+
const z = t - S.length, D = Math.min(O, z), C = await L(l, d, {
|
|
106
|
+
limit: D,
|
|
107
|
+
offset: $,
|
|
108
|
+
cql2Filter: h
|
|
109
|
+
});
|
|
110
|
+
S.push(...C.features), $ += C.features.length;
|
|
111
|
+
const b = C.numberMatched;
|
|
112
|
+
if (b != null ? i(`Fetching features... (${S.length} of ${b})`) : i(`Fetching features... (${S.length})`), C.features.length < D || b != null && $ >= b) break;
|
|
113
|
+
}
|
|
114
|
+
i("Converting...");
|
|
115
|
+
const w = await E(S, d);
|
|
116
|
+
k(w.blob, y);
|
|
117
|
+
} catch (w) {
|
|
118
|
+
n(w instanceof Error ? w : new Error(String(w)));
|
|
119
|
+
} finally {
|
|
120
|
+
a(!1), i(null);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
[e, t, o]
|
|
124
|
+
), m = M(
|
|
125
|
+
async (d, r, y, h) => {
|
|
126
|
+
const p = o[y];
|
|
127
|
+
if (!p) {
|
|
128
|
+
n(new Error(`Unknown export format: ${y}`));
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
a(!0), i("Converting..."), n(null);
|
|
132
|
+
try {
|
|
133
|
+
const l = await p(d, r);
|
|
134
|
+
k(l.blob, h);
|
|
135
|
+
} catch (l) {
|
|
136
|
+
n(l instanceof Error ? l : new Error(String(l)));
|
|
137
|
+
} finally {
|
|
138
|
+
a(!1), i(null);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
[o]
|
|
142
|
+
);
|
|
143
|
+
return { runExport: s, exportFeatures: m, loading: f, progress: u, error: g };
|
|
144
|
+
}
|
|
145
|
+
function Z(e, t) {
|
|
146
|
+
const [o, f] = c(null), [a, u] = c(!1), [i, g] = c(null);
|
|
147
|
+
return v(() => {
|
|
148
|
+
if (!e || !t) return;
|
|
149
|
+
let n = !1;
|
|
150
|
+
return u(!0), g(null), J(e, t).then((s) => {
|
|
151
|
+
n || f(s);
|
|
152
|
+
}).catch((s) => {
|
|
153
|
+
n || g(s instanceof Error ? s : new Error(String(s)));
|
|
154
|
+
}).finally(() => {
|
|
155
|
+
n || u(!1);
|
|
156
|
+
}), () => {
|
|
157
|
+
n = !0;
|
|
158
|
+
};
|
|
159
|
+
}, [e, t]), { collection: o, loading: a, error: i };
|
|
160
|
+
}
|
|
161
|
+
function U() {
|
|
162
|
+
const [e, t] = c(null), [o, f] = c([]), [a, u] = c("km"), i = F(
|
|
163
|
+
() => e ? N(e, o, a) : null,
|
|
164
|
+
[e, o, a]
|
|
165
|
+
), g = F(
|
|
166
|
+
() => e ? T(e, o) : null,
|
|
167
|
+
[e, o]
|
|
168
|
+
), n = F(
|
|
169
|
+
() => e ? j(o) : null,
|
|
170
|
+
[e, o]
|
|
171
|
+
), s = M((r) => {
|
|
172
|
+
t(r), f([]), r && u(B(r));
|
|
173
|
+
}, []), m = M((r) => {
|
|
174
|
+
f((y) => [...y, r]);
|
|
175
|
+
}, []), d = M(() => {
|
|
176
|
+
f([]);
|
|
177
|
+
}, []);
|
|
178
|
+
return { mode: e, points: o, unit: a, measurement: i, geometryData: g, pointsData: n, setMode: s, setUnit: u, addPoint: m, clear: d };
|
|
179
|
+
}
|
|
180
|
+
const K = 1e3;
|
|
181
|
+
function I() {
|
|
182
|
+
const [e, t] = c(null), [o, f] = c(null), [a, u] = c([]), i = F(() => a.length === 0 ? null : {
|
|
183
|
+
type: "FeatureCollection",
|
|
184
|
+
features: a.map((r) => ({
|
|
185
|
+
type: "Feature",
|
|
186
|
+
properties: r.properties,
|
|
187
|
+
geometry: r.geometry
|
|
188
|
+
}))
|
|
189
|
+
}, [a]), g = M((r) => {
|
|
190
|
+
t(r);
|
|
191
|
+
}, []), n = M((r) => {
|
|
192
|
+
f(r), u([]);
|
|
193
|
+
}, []), s = M((r) => {
|
|
194
|
+
u((y) => {
|
|
195
|
+
const h = new Set(y.map(x)), p = r.filter((E) => !h.has(x(E))), l = [...y, ...p];
|
|
196
|
+
return l.length > K ? l.slice(0, K) : l;
|
|
197
|
+
});
|
|
198
|
+
}, []), m = M((r) => {
|
|
199
|
+
u((y) => y.filter((h) => x(h) !== r));
|
|
200
|
+
}, []), d = M(() => {
|
|
201
|
+
u([]);
|
|
202
|
+
}, []);
|
|
203
|
+
return {
|
|
204
|
+
mode: e,
|
|
205
|
+
activeLayerId: o,
|
|
206
|
+
features: a,
|
|
207
|
+
highlightData: i,
|
|
208
|
+
setMode: g,
|
|
209
|
+
setActiveLayerId: n,
|
|
210
|
+
addFeatures: s,
|
|
211
|
+
removeFeature: m,
|
|
212
|
+
clearFeatures: d
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
export {
|
|
216
|
+
Y as a,
|
|
217
|
+
U as b,
|
|
218
|
+
Z as c,
|
|
219
|
+
_ as d,
|
|
220
|
+
V as e,
|
|
221
|
+
R as f,
|
|
222
|
+
I as g,
|
|
223
|
+
W as u
|
|
224
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { ColorThemeId } from './colorThemes';
|
|
1
2
|
/**
|
|
2
|
-
* Returns a color from the categorical palette,
|
|
3
|
+
* Returns a color from the categorical palette, optionally scoped to a theme.
|
|
4
|
+
* Cycles when index exceeds palette length.
|
|
3
5
|
*/
|
|
4
|
-
export declare function getColorFromPalette(index: number): string;
|
|
6
|
+
export declare function getColorFromPalette(index: number, theme?: ColorThemeId): string;
|
|
5
7
|
//# sourceMappingURL=colorPalettes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorPalettes.d.ts","sourceRoot":"","sources":["../../src/utils/colorPalettes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"colorPalettes.d.ts","sourceRoot":"","sources":["../../src/utils/colorPalettes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAErE;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,GAAG,MAAM,CAE/E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ColorThemeId = 'default' | 'earth' | 'ocean' | 'warm' | 'cool' | 'monochrome' | 'accessible';
|
|
2
|
+
export interface ColorTheme {
|
|
3
|
+
id: ColorThemeId;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
palette: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare const COLOR_THEMES: Record<ColorThemeId, ColorTheme>;
|
|
9
|
+
export declare const COLOR_THEME_IDS: ColorThemeId[];
|
|
10
|
+
export declare function getThemePalette(theme?: ColorThemeId): string[];
|
|
11
|
+
export declare function getColorFromTheme(index: number, theme?: ColorThemeId): string;
|
|
12
|
+
//# sourceMappingURL=colorThemes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorThemes.d.ts","sourceRoot":"","sources":["../../src/utils/colorThemes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,GACN,YAAY,GACZ,YAAY,CAAC;AAEjB,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,YAAY,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,UAAU,CAsHzD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,YAAY,EAQzC,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE,YAAY,GAAG,MAAM,EAAE,CAG9D;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,GAAG,MAAM,CAG7E"}
|
package/dist/utils/cql2.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FilterRule, FilterRuleGroup, RelativeDateValue, Cql2QueryShape } from '../types';
|
|
1
2
|
/**
|
|
2
3
|
* CQL2 JSON (OGC Common Query Language 2) types and builder utilities.
|
|
3
4
|
*
|
|
@@ -23,13 +24,16 @@ export type CQL2Timestamp = {
|
|
|
23
24
|
export type CQL2Interval = {
|
|
24
25
|
interval: [string, string];
|
|
25
26
|
};
|
|
27
|
+
/** CQL2 operators that appear in serialized expression nodes. */
|
|
28
|
+
export type CQL2Operator = '=' | '<>' | '>' | '>=' | '<' | '<=' | 'like' | 'in' | 'isNull' | 'and' | 'or' | 'not' | 't_after' | 't_before' | 't_during' | 's_intersects' | 's_within';
|
|
26
29
|
/**
|
|
27
|
-
* A CQL2 expression node.
|
|
28
|
-
*
|
|
29
|
-
* and
|
|
30
|
+
* A CQL2 expression node. The `op` field is constrained to operators
|
|
31
|
+
* that actually appear in serialized CQL2 JSON. UI-level operators like
|
|
32
|
+
* 'between' and 's_dwithin' decompose into simpler expressions before
|
|
33
|
+
* reaching this type.
|
|
30
34
|
*/
|
|
31
35
|
export type CQL2Expression = {
|
|
32
|
-
op:
|
|
36
|
+
op: CQL2Operator;
|
|
33
37
|
args: unknown[];
|
|
34
38
|
};
|
|
35
39
|
export declare function eq(property: string, value: string | number | boolean | CQL2Date | CQL2Timestamp): CQL2Expression;
|
|
@@ -67,7 +71,11 @@ export type CQL2Geometry = {
|
|
|
67
71
|
export declare function sIntersects(property: string, geometry: CQL2Geometry): CQL2Expression;
|
|
68
72
|
/** S_WITHIN — tests whether the first geometry is completely within the second. */
|
|
69
73
|
export declare function sWithin(property: string, geometry: CQL2Geometry): CQL2Expression;
|
|
70
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* S_DWITHIN — tests whether two geometries are within a specified distance.
|
|
76
|
+
* tipg/pygeofilter doesn't support s_dwithin directly, so we buffer the
|
|
77
|
+
* geometry client-side using turf and use s_intersects instead.
|
|
78
|
+
*/
|
|
71
79
|
export declare function sDwithin(property: string, geometry: CQL2Geometry, distance: number, units?: string): CQL2Expression;
|
|
72
80
|
/**
|
|
73
81
|
* Converts a simple key-value filter record to a CQL2 expression.
|
|
@@ -83,4 +91,25 @@ export declare function fromSimpleFilters(filters: Record<string, string | numbe
|
|
|
83
91
|
export declare function fromStructuredFilters(filters: Record<string, import('../types').SearchFilterValue>, fields: import('../types').SearchField[]): CQL2Expression | null;
|
|
84
92
|
/** Serializes a CQL2 expression to a JSON string for use as a query parameter. */
|
|
85
93
|
export declare function serializeCql2(expr: CQL2Expression): string;
|
|
94
|
+
/**
|
|
95
|
+
* Resolves a relative date value (e.g., "3 years ago") to an ISO timestamp string.
|
|
96
|
+
* Supports parameterized offsets resolved from `params`. The optional `now` parameter
|
|
97
|
+
* overrides the current date (useful for testing).
|
|
98
|
+
*/
|
|
99
|
+
export declare function resolveRelativeDate(value: RelativeDateValue, params?: Record<string, unknown>, now?: Date): string;
|
|
100
|
+
export declare function isFilterRuleGroup(item: FilterRule | FilterRuleGroup): item is FilterRuleGroup;
|
|
101
|
+
/**
|
|
102
|
+
* Converts a FilterRuleGroup (visual query builder model) to a CQL2Expression.
|
|
103
|
+
*
|
|
104
|
+
* @param group - The rule group to convert
|
|
105
|
+
* @param params - Runtime parameter values (for parameterized templates)
|
|
106
|
+
* @param selectionGeometry - Geometry from selected feature(s) for spatial operators
|
|
107
|
+
* @returns CQL2Expression or null if the group produces no valid expressions
|
|
108
|
+
*/
|
|
109
|
+
export declare function fromFilterRuleGroup(group: FilterRuleGroup, params?: Record<string, unknown>, selectionGeometry?: CQL2Geometry | null): CQL2Expression | null;
|
|
110
|
+
/**
|
|
111
|
+
* Builds a full query shape from a FilterRuleGroup, including sort and limit metadata.
|
|
112
|
+
* Use this when you need the complete query (filter + sort + limit) rather than just the CQL2 filter.
|
|
113
|
+
*/
|
|
114
|
+
export declare function buildCql2Query(group: FilterRuleGroup, params?: Record<string, unknown>, selectionGeometry?: CQL2Geometry | null): Cql2QueryShape;
|
|
86
115
|
//# sourceMappingURL=cql2.d.ts.map
|
package/dist/utils/cql2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cql2.d.ts","sourceRoot":"","sources":["../../src/utils/cql2.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"cql2.d.ts","sourceRoot":"","sources":["../../src/utils/cql2.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,uEAAuE;AACvE,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,yDAAyD;AACzD,MAAM,MAAM,Q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B,mBAAmB,CACjC,KAAK,EAAE,eAAe,EACtB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,iBAAiB,CAAC,EAAE,YAAY,GAAG,IAAI,GACtC,cAAc,GAAG,IAAI,CASvB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,eAAe,EACtB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,iBAAiB,CAAC,EAAE,YAAY,GAAG,IAAI,GACtC,cAAc,CA0BhB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GeoJsonFeature } from './ogcApi';
|
|
2
|
+
export type FormatConverter = (features: GeoJsonFeature[], collectionId: string) => Promise<{
|
|
3
|
+
blob: Blob;
|
|
4
|
+
filename: string;
|
|
5
|
+
}> | {
|
|
6
|
+
blob: Blob;
|
|
7
|
+
filename: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const csvConverter: FormatConverter;
|
|
10
|
+
export declare const geojsonConverter: FormatConverter;
|
|
11
|
+
export declare const kmlConverter: FormatConverter;
|
|
12
|
+
export declare const shapefileConverter: FormatConverter;
|
|
13
|
+
export declare const flatgeobufConverter: FormatConverter;
|
|
14
|
+
export declare const geopackageConverter: FormatConverter;
|
|
15
|
+
export declare const exportConverters: Record<string, FormatConverter>;
|
|
16
|
+
//# sourceMappingURL=exportConverters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exportConverters.d.ts","sourceRoot":"","sources":["../../src/utils/exportConverters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,MAAM,MAAM,eAAe,GAAG,CAC5B,QAAQ,EAAE,cAAc,EAAE,EAC1B,YAAY,EAAE,MAAM,KACjB,OAAO,CAAC;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAalF,eAAO,MAAM,YAAY,EAAE,eAM1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,eAM9B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,eAS1B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,eAmDhC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,eASjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,eAqBjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAO5D,CAAC"}
|
package/dist/utils/geo.d.ts
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
1
|
export type BBox = [number, number, number, number];
|
|
2
|
+
/**
|
|
3
|
+
* Combines multiple geometries into a single geometry.
|
|
4
|
+
* Returns the geometry directly if only one, or a GeometryCollection if multiple.
|
|
5
|
+
* Returns null if the array is empty.
|
|
6
|
+
*/
|
|
7
|
+
export declare function combineGeometries(geometries: Record<string, unknown>[]): Record<string, unknown> | null;
|
|
2
8
|
export declare function bboxFromGeometry(geometry: Record<string, unknown>): BBox | null;
|
|
9
|
+
/** Default target zoom used when fitting to a point/zero-area feature. */
|
|
10
|
+
export declare const DEFAULT_POINT_ZOOM = 16;
|
|
11
|
+
/** Default cap applied to {@link ZoomToFeatureOptions.maxZoom} for polygon/line geometries. */
|
|
12
|
+
export declare const DEFAULT_POLYGON_MAX_ZOOM = 18;
|
|
13
|
+
export interface ZoomToFeatureOptions {
|
|
14
|
+
/** Layer's configured minZoom — result.zoom will be clamped ≥ this. */
|
|
15
|
+
layerMinZoom?: number;
|
|
16
|
+
/** Layer's configured maxZoom — result.zoom will be clamped ≤ this. */
|
|
17
|
+
layerMaxZoom?: number;
|
|
18
|
+
/** Preferred zoom for point geometries. Defaults to {@link DEFAULT_POINT_ZOOM}. */
|
|
19
|
+
pointZoom?: number;
|
|
20
|
+
/** Padding in px applied when using fitBounds. */
|
|
21
|
+
padding?: number;
|
|
22
|
+
/** Cap passed to fitBounds so very small polygons don't zoom to level 22. */
|
|
23
|
+
maxZoom?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A fitBounds-style instruction: "fit this bbox in the viewport with padding,
|
|
27
|
+
* but don't zoom past `maxZoom`". The app layer converts this to
|
|
28
|
+
* `map.fitBounds(bbox, { padding, maxZoom })`.
|
|
29
|
+
*
|
|
30
|
+
* Note: MapLibre's `fitBounds` does not accept a `minZoom` option, so we don't
|
|
31
|
+
* expose one on the instruction. The layer's `minZoom` is enforced by the map's
|
|
32
|
+
* layer definition (tiles below that zoom simply don't render) rather than by
|
|
33
|
+
* the fit itself.
|
|
34
|
+
*/
|
|
35
|
+
export interface ZoomToBoundsInstruction {
|
|
36
|
+
type: 'fitBounds';
|
|
37
|
+
bbox: BBox;
|
|
38
|
+
padding: number;
|
|
39
|
+
maxZoom: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A flyTo-style instruction: "center the viewport on this point at this zoom".
|
|
43
|
+
* The app layer converts this to `map.flyTo({ center, zoom })`.
|
|
44
|
+
*/
|
|
45
|
+
export interface ZoomToCenterInstruction {
|
|
46
|
+
type: 'flyTo';
|
|
47
|
+
center: [number, number];
|
|
48
|
+
zoom: number;
|
|
49
|
+
}
|
|
50
|
+
export type ZoomToFeatureInstruction = ZoomToBoundsInstruction | ZoomToCenterInstruction;
|
|
51
|
+
/**
|
|
52
|
+
* Compute an instruction for zooming a map to a feature so that:
|
|
53
|
+
* - Point/zero-area geometries center at a sensible zoom (not zoomed out to the
|
|
54
|
+
* bbox padding fallback).
|
|
55
|
+
* - Polygon/line geometries fit their bbox with padding, capped at `maxZoom` so
|
|
56
|
+
* tiny features don't snap to max zoom.
|
|
57
|
+
* - The layer's configured `minZoom`/`maxZoom` are respected as bounds.
|
|
58
|
+
*
|
|
59
|
+
* Returns `null` if the geometry has no usable coordinates.
|
|
60
|
+
*/
|
|
61
|
+
export declare function zoomToFeature(geometry: Record<string, unknown> | null | undefined, options?: ZoomToFeatureOptions): ZoomToFeatureInstruction | null;
|
|
3
62
|
//# sourceMappingURL=geo.d.ts.map
|
package/dist/utils/geo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo.d.ts","sourceRoot":"","sources":["../../src/utils/geo.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAkBpD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,IAAI,CAqB/E"}
|
|
1
|
+
{"version":3,"file":"geo.d.ts","sourceRoot":"","sources":["../../src/utils/geo.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAkBpD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAIvG;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,IAAI,CAqB/E;AA6BD,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,+FAA+F;AAC/F,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,MAAM,WAAW,oBAAoB;IACnC,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,wBAAwB,GAAG,uBAAuB,GAAG,uBAAuB,CAAC;AASzF;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,EACpD,OAAO,GAAE,oBAAyB,GACjC,wBAAwB,GAAG,IAAI,CAkCjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../src/utils/id.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,IAAI,MAAM,CAUnC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
export * from './ogcApi';
|
|
2
2
|
export * from './csvExport';
|
|
3
3
|
export * from './cql2';
|
|
4
|
+
export * from './propertyFilters';
|
|
4
5
|
export * from './propertyDisplay';
|
|
5
6
|
export * from './queryableHelpers';
|
|
6
7
|
export * from './spriteUtils';
|
|
7
8
|
export * from './colorPalettes';
|
|
9
|
+
export * from './colorThemes';
|
|
8
10
|
export * from './expressionColors';
|
|
9
11
|
export * from './measure';
|
|
10
12
|
export * from './selection';
|
|
11
13
|
export * from './boxDraw';
|
|
14
|
+
export * from './geo';
|
|
15
|
+
export * from './download';
|
|
16
|
+
export * from './exportFormats';
|
|
17
|
+
export * from './queryParameters';
|
|
18
|
+
export * from './exportConverters';
|
|
19
|
+
export * from './id';
|
|
20
|
+
export * from './slugify';
|
|
12
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,MAAM,CAAC;AACrB,cAAc,WAAW,CAAC"}
|