@ogc-maps/storybook-components 0.5.3 → 0.6.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/dist/components/LayerEditor/LayerEditor.d.ts +2 -1
- package/dist/components/LayerEditor/LayerEditor.d.ts.map +1 -1
- package/dist/components/LayerEditor/LayerList.d.ts +2 -1
- package/dist/components/LayerEditor/LayerList.d.ts.map +1 -1
- package/dist/components/SpriteEditor/SpriteSourceEditor.d.ts +7 -0
- package/dist/components/SpriteEditor/SpriteSourceEditor.d.ts.map +1 -0
- package/dist/components/SpriteEditor/SpriteSourceList.d.ts +7 -0
- package/dist/components/SpriteEditor/SpriteSourceList.d.ts.map +1 -0
- package/dist/components/SpriteEditor/index.d.ts +5 -0
- package/dist/components/SpriteEditor/index.d.ts.map +1 -0
- package/dist/components/StyleEditor/IconImagePicker.d.ts +8 -0
- package/dist/components/StyleEditor/IconImagePicker.d.ts.map +1 -0
- package/dist/components/StyleEditor/PropertyField.d.ts +2 -1
- package/dist/components/StyleEditor/PropertyField.d.ts.map +1 -1
- package/dist/components/StyleEditor/PropertyGroup.d.ts +2 -1
- package/dist/components/StyleEditor/PropertyGroup.d.ts.map +1 -1
- package/dist/components/StyleEditor/StyleEditor.d.ts +2 -1
- package/dist/components/StyleEditor/StyleEditor.d.ts.map +1 -1
- package/dist/components/StyleEditor/propertyMetadata.d.ts +1 -1
- package/dist/components/StyleEditor/propertyMetadata.d.ts.map +1 -1
- package/dist/components/admin/FormField.d.ts +2 -1
- package/dist/components/admin/FormField.d.ts.map +1 -1
- package/dist/components/admin/InfoTip.d.ts +6 -0
- package/dist/components/admin/InfoTip.d.ts.map +1 -0
- package/dist/components/admin/index.d.ts +2 -0
- package/dist/components/admin/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/cql2-onoyCbps.js +413 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +18 -17
- package/dist/{index-DoToolWp.js → index-B2DIcC-4.js} +33 -28
- package/dist/main.js +1156 -832
- package/dist/schemas/config.d.ts +40 -0
- package/dist/schemas/config.d.ts.map +1 -1
- package/dist/schemas/index.js +3 -3
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +16 -15
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/spriteUtils.d.ts +32 -0
- package/dist/utils/spriteUtils.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/cql2-Dhe6Ny6v.js +0 -352
package/dist/cql2-Dhe6Ny6v.js
DELETED
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
import { useState as f, useEffect as $, useCallback as M } from "react";
|
|
2
|
-
function g(e) {
|
|
3
|
-
return e.endsWith("/") ? e.slice(0, -1) : e;
|
|
4
|
-
}
|
|
5
|
-
async function p(e) {
|
|
6
|
-
const t = await fetch(e);
|
|
7
|
-
if (!t.ok)
|
|
8
|
-
throw new Error(`OGC API request failed: ${t.status} ${t.statusText} (${e})`);
|
|
9
|
-
return t.json();
|
|
10
|
-
}
|
|
11
|
-
async function R(e) {
|
|
12
|
-
const t = `${g(e)}/collections?f=json`;
|
|
13
|
-
return (await p(t)).collections;
|
|
14
|
-
}
|
|
15
|
-
async function j(e, t, n = {}) {
|
|
16
|
-
var a;
|
|
17
|
-
const s = g(e), r = new URLSearchParams({ f: "geojson" });
|
|
18
|
-
if (n.limit != null && r.set("limit", String(n.limit)), n.offset != null && r.set("offset", String(n.offset)), n.bbox && r.set("bbox", n.bbox.join(",")), (a = n.properties) != null && a.length && r.set("properties", n.properties.join(",")), n.datetime && r.set("datetime", n.datetime), n.cql2Filter)
|
|
19
|
-
r.set("filter-lang", "cql2-json"), r.set("filter", JSON.stringify(n.cql2Filter));
|
|
20
|
-
else if (n.filter)
|
|
21
|
-
for (const [c, o] of Object.entries(n.filter))
|
|
22
|
-
r.set(c, String(o));
|
|
23
|
-
const i = `${s}/collections/${encodeURIComponent(t)}/items?${r}`;
|
|
24
|
-
return p(i);
|
|
25
|
-
}
|
|
26
|
-
async function x(e, t) {
|
|
27
|
-
const s = `${g(e)}/collections/${encodeURIComponent(t)}/queryables?f=schemajson`;
|
|
28
|
-
return p(s);
|
|
29
|
-
}
|
|
30
|
-
async function k(e, t) {
|
|
31
|
-
const s = `${g(e)}/collections/${encodeURIComponent(t)}?f=json`;
|
|
32
|
-
return p(s);
|
|
33
|
-
}
|
|
34
|
-
async function V(e) {
|
|
35
|
-
const t = `${g(e)}/conformance?f=json`;
|
|
36
|
-
return p(t);
|
|
37
|
-
}
|
|
38
|
-
async function A(e, t, n = "WebMercatorQuad") {
|
|
39
|
-
const s = U(e, t, n);
|
|
40
|
-
return p(s);
|
|
41
|
-
}
|
|
42
|
-
async function B(e, t, n = {}) {
|
|
43
|
-
return (await j(e, t, {
|
|
44
|
-
...n,
|
|
45
|
-
limit: 0
|
|
46
|
-
})).numberMatched ?? null;
|
|
47
|
-
}
|
|
48
|
-
function U(e, t, n = "WebMercatorQuad") {
|
|
49
|
-
return `${g(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(n)}/tilejson.json`;
|
|
50
|
-
}
|
|
51
|
-
function G(e, t, n = "WebMercatorQuad") {
|
|
52
|
-
return `${g(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(n)}/{z}/{x}/{y}`;
|
|
53
|
-
}
|
|
54
|
-
function K(e, t, n, s = "WebMercatorQuad") {
|
|
55
|
-
const i = `${g(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(s)}/{z}/{x}/{y}`;
|
|
56
|
-
if (!n || Object.keys(n).length === 0) return i;
|
|
57
|
-
const a = new URLSearchParams();
|
|
58
|
-
for (const [c, o] of Object.entries(n))
|
|
59
|
-
a.set(c, String(o));
|
|
60
|
-
return `${i}?${a}`;
|
|
61
|
-
}
|
|
62
|
-
async function _(e, t, n, s) {
|
|
63
|
-
var c;
|
|
64
|
-
const r = s != null && s.query ? { op: "like", args: [{ property: n }, `%${s.query}%`] } : void 0, i = await j(e, t, {
|
|
65
|
-
properties: [n],
|
|
66
|
-
limit: (s == null ? void 0 : s.limit) ?? 50,
|
|
67
|
-
cql2Filter: r
|
|
68
|
-
}), a = /* @__PURE__ */ new Set();
|
|
69
|
-
for (const o of i.features) {
|
|
70
|
-
const l = (c = o.properties) == null ? void 0 : c[n];
|
|
71
|
-
l != null && typeof l == "string" && a.add(l);
|
|
72
|
-
}
|
|
73
|
-
return Array.from(a).sort();
|
|
74
|
-
}
|
|
75
|
-
function H(e, t, n, s = "WebMercatorQuad") {
|
|
76
|
-
const i = `${g(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(s)}/{z}/{x}/{y}`;
|
|
77
|
-
if (!n) return i;
|
|
78
|
-
const a = new URLSearchParams({
|
|
79
|
-
"filter-lang": "cql2-json",
|
|
80
|
-
filter: JSON.stringify(n)
|
|
81
|
-
});
|
|
82
|
-
return `${i}?${a}`;
|
|
83
|
-
}
|
|
84
|
-
function X(e) {
|
|
85
|
-
const [t, n] = f([]), [s, r] = f(!1), [i, a] = f(null);
|
|
86
|
-
return $(() => {
|
|
87
|
-
if (!e) return;
|
|
88
|
-
let c = !1;
|
|
89
|
-
return r(!0), a(null), R(e).then((o) => {
|
|
90
|
-
c || n(o);
|
|
91
|
-
}).catch((o) => {
|
|
92
|
-
c || a(o instanceof Error ? o : new Error(String(o)));
|
|
93
|
-
}).finally(() => {
|
|
94
|
-
c || r(!1);
|
|
95
|
-
}), () => {
|
|
96
|
-
c = !0;
|
|
97
|
-
};
|
|
98
|
-
}, [e]), { collections: t, loading: s, error: i };
|
|
99
|
-
}
|
|
100
|
-
function Y(e, t) {
|
|
101
|
-
const [n, s] = f(null), [r, i] = f(!1), [a, c] = f(null);
|
|
102
|
-
return $(() => {
|
|
103
|
-
if (!e || !t) return;
|
|
104
|
-
let o = !1;
|
|
105
|
-
return i(!0), c(null), x(e, t).then((l) => {
|
|
106
|
-
o || s(l);
|
|
107
|
-
}).catch((l) => {
|
|
108
|
-
o || c(l instanceof Error ? l : new Error(String(l)));
|
|
109
|
-
}).finally(() => {
|
|
110
|
-
o || i(!1);
|
|
111
|
-
}), () => {
|
|
112
|
-
o = !0;
|
|
113
|
-
};
|
|
114
|
-
}, [e, t]), { queryables: n, loading: r, error: a };
|
|
115
|
-
}
|
|
116
|
-
function Z(e, t, n = {}) {
|
|
117
|
-
const [s, r] = f([]), [i, a] = f(!1), [c, o] = f(null), [l, d] = f(!1), m = JSON.stringify(n);
|
|
118
|
-
return $(() => {
|
|
119
|
-
if (!e || !t) return;
|
|
120
|
-
let b = !1;
|
|
121
|
-
a(!0), o(null);
|
|
122
|
-
const h = JSON.parse(m);
|
|
123
|
-
return j(e, t, h).then((u) => {
|
|
124
|
-
if (!b) {
|
|
125
|
-
r(u.features);
|
|
126
|
-
const w = h.limit ?? 10, S = h.offset ?? 0;
|
|
127
|
-
u.numberMatched != null ? d(S + u.features.length < u.numberMatched) : d(u.features.length >= w);
|
|
128
|
-
}
|
|
129
|
-
}).catch((u) => {
|
|
130
|
-
b || (o(u instanceof Error ? u : new Error(String(u))), r([]), d(!1));
|
|
131
|
-
}).finally(() => {
|
|
132
|
-
b || a(!1);
|
|
133
|
-
}), () => {
|
|
134
|
-
b = !0;
|
|
135
|
-
};
|
|
136
|
-
}, [e, t, m]), { features: s, loading: i, error: c, hasMore: l };
|
|
137
|
-
}
|
|
138
|
-
function E(e, t) {
|
|
139
|
-
return e.includes('"') || e.includes(t) || e.includes(`
|
|
140
|
-
`) ? `"${e.replace(/"/g, '""')}"` : e;
|
|
141
|
-
}
|
|
142
|
-
function q(e, t) {
|
|
143
|
-
const n = (e.properties ?? {})[t];
|
|
144
|
-
return n == null ? "" : typeof n == "object" ? JSON.stringify(n) : String(n);
|
|
145
|
-
}
|
|
146
|
-
function L(e, t = {}) {
|
|
147
|
-
const { fields: n, includeGeometry: s = !1, delimiter: r = "," } = t;
|
|
148
|
-
if (e.length === 0) return "";
|
|
149
|
-
const i = n ?? [...new Set(e.flatMap((o) => Object.keys(o.properties ?? {})))], a = s ? [...i, "geometry"] : i, c = e.map((o) => {
|
|
150
|
-
const l = i.map(
|
|
151
|
-
(d) => E(q(o, d), r)
|
|
152
|
-
);
|
|
153
|
-
return s && l.push(E(JSON.stringify(o.geometry), r)), l.join(r);
|
|
154
|
-
});
|
|
155
|
-
return [a.map((o) => E(o, r)).join(r), ...c].join(`
|
|
156
|
-
`);
|
|
157
|
-
}
|
|
158
|
-
function F(e, t) {
|
|
159
|
-
const n = new Blob([e], { type: "text/csv;charset=utf-8;" }), s = URL.createObjectURL(n), r = document.createElement("a");
|
|
160
|
-
r.href = s, r.download = t, r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(s);
|
|
161
|
-
}
|
|
162
|
-
function ee({
|
|
163
|
-
baseUrl: e,
|
|
164
|
-
limit: t = 1e3,
|
|
165
|
-
csvOptions: n
|
|
166
|
-
}) {
|
|
167
|
-
const [s, r] = f(!1), [i, a] = f(null);
|
|
168
|
-
return { exportCsv: M(
|
|
169
|
-
async (o, l = `${o}.csv`, d) => {
|
|
170
|
-
r(!0), a(null);
|
|
171
|
-
const m = [], b = Math.min(t, 1e3);
|
|
172
|
-
let h = 0;
|
|
173
|
-
try {
|
|
174
|
-
for (; m.length < t; ) {
|
|
175
|
-
const w = t - m.length, S = Math.min(b, w), y = await j(e, o, {
|
|
176
|
-
limit: S,
|
|
177
|
-
offset: h,
|
|
178
|
-
cql2Filter: d
|
|
179
|
-
});
|
|
180
|
-
if (m.push(...y.features), h += y.features.length, y.features.length < S || y.numberMatched != null && h >= y.numberMatched) break;
|
|
181
|
-
}
|
|
182
|
-
const u = L(m, n);
|
|
183
|
-
F(u, l);
|
|
184
|
-
} catch (u) {
|
|
185
|
-
a(u instanceof Error ? u : new Error(String(u)));
|
|
186
|
-
} finally {
|
|
187
|
-
r(!1);
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
[e, t, n]
|
|
191
|
-
), loading: s, error: i };
|
|
192
|
-
}
|
|
193
|
-
function te(e, t) {
|
|
194
|
-
const [n, s] = f(null), [r, i] = f(!1), [a, c] = f(null);
|
|
195
|
-
return $(() => {
|
|
196
|
-
if (!e || !t) return;
|
|
197
|
-
let o = !1;
|
|
198
|
-
return i(!0), c(null), k(e, t).then((l) => {
|
|
199
|
-
o || s(l);
|
|
200
|
-
}).catch((l) => {
|
|
201
|
-
o || c(l instanceof Error ? l : new Error(String(l)));
|
|
202
|
-
}).finally(() => {
|
|
203
|
-
o || i(!1);
|
|
204
|
-
}), () => {
|
|
205
|
-
o = !0;
|
|
206
|
-
};
|
|
207
|
-
}, [e, t]), { collection: n, loading: r, error: a };
|
|
208
|
-
}
|
|
209
|
-
function ne(e) {
|
|
210
|
-
if (!e) return;
|
|
211
|
-
const t = [], n = {};
|
|
212
|
-
for (const [s, r] of Object.entries(e))
|
|
213
|
-
r.visible !== !1 && (t.push(s), r.label && (n[s] = r.label));
|
|
214
|
-
return { fields: t, labels: n };
|
|
215
|
-
}
|
|
216
|
-
function C(e, t) {
|
|
217
|
-
return { op: "=", args: [{ property: e }, t] };
|
|
218
|
-
}
|
|
219
|
-
function re(e, t) {
|
|
220
|
-
return { op: "<>", args: [{ property: e }, t] };
|
|
221
|
-
}
|
|
222
|
-
function J(e, t) {
|
|
223
|
-
return { op: ">", args: [{ property: e }, t] };
|
|
224
|
-
}
|
|
225
|
-
function v(e, t) {
|
|
226
|
-
return { op: ">=", args: [{ property: e }, t] };
|
|
227
|
-
}
|
|
228
|
-
function N(e, t) {
|
|
229
|
-
return { op: "<", args: [{ property: e }, t] };
|
|
230
|
-
}
|
|
231
|
-
function I(e, t) {
|
|
232
|
-
return { op: "<=", args: [{ property: e }, t] };
|
|
233
|
-
}
|
|
234
|
-
function Q(e, t, n) {
|
|
235
|
-
return { op: "between", args: [{ property: e }, t, n] };
|
|
236
|
-
}
|
|
237
|
-
function se(e, t) {
|
|
238
|
-
return { op: "like", args: [{ property: e }, t] };
|
|
239
|
-
}
|
|
240
|
-
function oe(e, t) {
|
|
241
|
-
return { op: "in", args: [{ property: e }, t] };
|
|
242
|
-
}
|
|
243
|
-
function ie(e) {
|
|
244
|
-
return { op: "isNull", args: [{ property: e }] };
|
|
245
|
-
}
|
|
246
|
-
function O(...e) {
|
|
247
|
-
const t = e.filter((n) => n != null);
|
|
248
|
-
return t.length === 0 ? null : t.length === 1 ? t[0] : { op: "and", args: t };
|
|
249
|
-
}
|
|
250
|
-
function ce(...e) {
|
|
251
|
-
const t = e.filter((n) => n != null);
|
|
252
|
-
return t.length === 0 ? null : t.length === 1 ? t[0] : { op: "or", args: t };
|
|
253
|
-
}
|
|
254
|
-
function ae(e) {
|
|
255
|
-
return { op: "not", args: [e] };
|
|
256
|
-
}
|
|
257
|
-
function T(e, t) {
|
|
258
|
-
return { op: "t_after", args: [{ property: e }, t] };
|
|
259
|
-
}
|
|
260
|
-
function z(e, t) {
|
|
261
|
-
return { op: "t_before", args: [{ property: e }, t] };
|
|
262
|
-
}
|
|
263
|
-
function P(e, t, n) {
|
|
264
|
-
const s = "date" in t ? t.date : t.timestamp, r = "date" in n ? n.date : n.timestamp;
|
|
265
|
-
return { op: "t_during", args: [{ property: e }, { interval: [s, r] }] };
|
|
266
|
-
}
|
|
267
|
-
function le(e) {
|
|
268
|
-
const t = Object.entries(e).filter(([, n]) => n !== void 0 && n !== "").map(([n, s]) => C(n, s));
|
|
269
|
-
return O(...t);
|
|
270
|
-
}
|
|
271
|
-
function ue(e, t) {
|
|
272
|
-
const n = new Map(t.map((r) => [r.property, r])), s = Object.entries(e).map(([r, i]) => {
|
|
273
|
-
if (i === void 0) return null;
|
|
274
|
-
const a = n.get(r);
|
|
275
|
-
if (typeof i == "string")
|
|
276
|
-
return i === "" ? null : (a == null ? void 0 : a.type) === "datetime" ? C(r, { timestamp: i }) : C(r, i);
|
|
277
|
-
if (typeof i == "number")
|
|
278
|
-
return C(r, i);
|
|
279
|
-
if (typeof i == "object") {
|
|
280
|
-
if ("start" in i || "end" in i) {
|
|
281
|
-
const { start: c, end: o } = i;
|
|
282
|
-
return c && o ? P(r, { timestamp: c }, { timestamp: o }) : c ? T(r, { timestamp: c }) : o ? z(r, { timestamp: o }) : null;
|
|
283
|
-
}
|
|
284
|
-
if ("value" in i && "operator" in i) {
|
|
285
|
-
const { value: c, operator: o } = i;
|
|
286
|
-
if (c == null || String(c) === "") return null;
|
|
287
|
-
switch (o) {
|
|
288
|
-
case "gt":
|
|
289
|
-
return J(r, c);
|
|
290
|
-
case "lt":
|
|
291
|
-
return N(r, c);
|
|
292
|
-
case "gte":
|
|
293
|
-
return v(r, c);
|
|
294
|
-
case "lte":
|
|
295
|
-
return I(r, c);
|
|
296
|
-
default:
|
|
297
|
-
return C(r, c);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
if ("min" in i && "max" in i) {
|
|
301
|
-
const { min: c, max: o } = i;
|
|
302
|
-
return c === void 0 || o === void 0 ? null : Q(r, c, o);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
return null;
|
|
306
|
-
});
|
|
307
|
-
return O(...s);
|
|
308
|
-
}
|
|
309
|
-
function fe(e) {
|
|
310
|
-
return JSON.stringify(e);
|
|
311
|
-
}
|
|
312
|
-
export {
|
|
313
|
-
ce as A,
|
|
314
|
-
ne as B,
|
|
315
|
-
fe as C,
|
|
316
|
-
T as D,
|
|
317
|
-
z as E,
|
|
318
|
-
P as F,
|
|
319
|
-
ee as G,
|
|
320
|
-
te as H,
|
|
321
|
-
X as I,
|
|
322
|
-
Z as J,
|
|
323
|
-
Y as K,
|
|
324
|
-
F as L,
|
|
325
|
-
L as M,
|
|
326
|
-
O as a,
|
|
327
|
-
Q as b,
|
|
328
|
-
R as c,
|
|
329
|
-
V as d,
|
|
330
|
-
C as e,
|
|
331
|
-
k as f,
|
|
332
|
-
_ as g,
|
|
333
|
-
B as h,
|
|
334
|
-
j as i,
|
|
335
|
-
x as j,
|
|
336
|
-
A as k,
|
|
337
|
-
le as l,
|
|
338
|
-
ue as m,
|
|
339
|
-
H as n,
|
|
340
|
-
K as o,
|
|
341
|
-
U as p,
|
|
342
|
-
G as q,
|
|
343
|
-
J as r,
|
|
344
|
-
v as s,
|
|
345
|
-
oe as t,
|
|
346
|
-
ie as u,
|
|
347
|
-
se as v,
|
|
348
|
-
N as w,
|
|
349
|
-
I as x,
|
|
350
|
-
re as y,
|
|
351
|
-
ae as z
|
|
352
|
-
};
|