@element-editor/react 0.0.0-stage → 0.2.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.
Files changed (60) hide show
  1. package/AGENTS.md +429 -0
  2. package/LICENSE +21 -0
  3. package/README.md +49 -2
  4. package/dist/element-editor-leaflet.css +1 -0
  5. package/dist/element-editor.cjs +1 -0
  6. package/dist/element-editor.css +1 -0
  7. package/dist/element-editor.es.js +190 -0
  8. package/dist/index.d.cts +4 -0
  9. package/dist/index.d.ts +4 -0
  10. package/dist/leaflet/CompactAttribution.d.cts +23 -0
  11. package/dist/leaflet/CompactAttribution.d.ts +23 -0
  12. package/dist/leaflet/ElementEditor.d.cts +81 -0
  13. package/dist/leaflet/ElementEditor.d.ts +81 -0
  14. package/dist/leaflet/MapView.d.cts +28 -0
  15. package/dist/leaflet/MapView.d.ts +28 -0
  16. package/dist/leaflet/index.d.cts +3 -0
  17. package/dist/leaflet/index.d.ts +3 -0
  18. package/dist/leaflet.cjs +1 -0
  19. package/dist/leaflet.d.cts +2 -0
  20. package/dist/leaflet.d.ts +2 -0
  21. package/dist/leaflet.es.js +181 -0
  22. package/dist/maplibre/ElementEditor.d.cts +68 -0
  23. package/dist/maplibre/ElementEditor.d.ts +68 -0
  24. package/dist/maplibre/MapLibreMapView.d.cts +35 -0
  25. package/dist/maplibre/MapLibreMapView.d.ts +35 -0
  26. package/dist/maplibre/index.d.cts +2 -0
  27. package/dist/maplibre/index.d.ts +2 -0
  28. package/dist/maplibre/workerUrl.d.cts +21 -0
  29. package/dist/maplibre/workerUrl.d.ts +21 -0
  30. package/dist/shared.d.cts +13 -0
  31. package/dist/shared.d.ts +13 -0
  32. package/dist/shell/ElementEditorShell.d.cts +32 -0
  33. package/dist/shell/ElementEditorShell.d.ts +32 -0
  34. package/dist/shell/FileDropBox.d.cts +13 -0
  35. package/dist/shell/FileDropBox.d.ts +13 -0
  36. package/dist/shell/ShellControl.d.cts +19 -0
  37. package/dist/shell/ShellControl.d.ts +19 -0
  38. package/dist/shell/ShellPanels.d.cts +13 -0
  39. package/dist/shell/ShellPanels.d.ts +13 -0
  40. package/dist/shell/savedView.d.cts +49 -0
  41. package/dist/shell/savedView.d.ts +49 -0
  42. package/dist/shell/types.d.cts +253 -0
  43. package/dist/shell/types.d.ts +253 -0
  44. package/dist/shell/useAttributionAutoCollapse.d.cts +17 -0
  45. package/dist/shell/useAttributionAutoCollapse.d.ts +17 -0
  46. package/dist/shell/useBasemapState.d.cts +20 -0
  47. package/dist/shell/useBasemapState.d.ts +20 -0
  48. package/dist/shell/useDevChecks.d.cts +11 -0
  49. package/dist/shell/useDevChecks.d.ts +11 -0
  50. package/dist/shell/useResolvedTheme.d.cts +14 -0
  51. package/dist/shell/useResolvedTheme.d.ts +14 -0
  52. package/dist/shell/useSlotAutoLayout.d.cts +23 -0
  53. package/dist/shell/useSlotAutoLayout.d.ts +23 -0
  54. package/dist/store/StoreContext.d.cts +1 -0
  55. package/dist/store/StoreContext.d.ts +1 -0
  56. package/dist/types/geojson.d.cts +1 -0
  57. package/dist/types/geojson.d.ts +1 -0
  58. package/dist/useBasemapState-8bWJK84f.cjs +1 -0
  59. package/dist/useBasemapState-DChxz3lv.js +682 -0
  60. package/package.json +154 -3
@@ -0,0 +1,181 @@
1
+ "use client";
2
+ import { jsx as c, jsxs as B } from "react/jsx-runtime";
3
+ import { useState as T, useId as H, useEffect as h, memo as q, useMemo as A, useRef as j, forwardRef as G, useCallback as Z } from "react";
4
+ import { useMap as U, MapContainer as D, TileLayer as R } from "react-leaflet";
5
+ import { useUIStore as z, useElementEditorConfig as Y, BasemapPicker as L } from "@element-editor/ui";
6
+ import { DEFAULT_LAYOUT as ke, IconButton as Fe, Tooltip as Ie, withLayout as Ke } from "@element-editor/ui";
7
+ import { u as _, r as $, F as ee, a as k, s as te, p as oe, b as ne, E as ie } from "./useBasemapState-DChxz3lv.js";
8
+ import { ElementEditorControls as re } from "@element-editor/adapter-leaflet";
9
+ import { createPortal as se } from "react-dom";
10
+ import F from "leaflet";
11
+ import { Info as ae } from "@phosphor-icons/react";
12
+ import { writeStorage as le, readStorage as me } from "@element-editor/core";
13
+ import { ACCENT_STEPS as Ue, DEFAULT_ACCENT as Ye, ElementEditorError as Ne, accentPalette as Se } from "@element-editor/core";
14
+ import { warnOnce as de, overrideSource as ue } from "@element-editor/core/internal";
15
+ function ce({ target: e, corner: i }) {
16
+ var g;
17
+ const o = U(), [r, m] = T(!0), f = `elm-attribution${H().replace(/:/g, "")}`, t = (g = o.attributionControl) == null ? void 0 : g.getContainer(), [d] = T(() => t == null ? void 0 : t.parentElement), p = i ?? d;
18
+ h(() => {
19
+ if (!(!t || !d))
20
+ return e ? (t.classList.add("elm-attribution-bar"), e.appendChild(t), () => {
21
+ t.classList.remove("elm-attribution-bar"), d.appendChild(t);
22
+ }) : (t.classList.add("elm-attribution-compact"), t.id = f, i && i.prepend(t), () => {
23
+ t.classList.remove("elm-attribution-compact", "elm-attribution-open"), i && d.appendChild(t);
24
+ });
25
+ }, [t, d, i, e, f]), h(() => {
26
+ if (e || (t == null || t.classList.toggle("elm-attribution-open", r), !r)) return;
27
+ const n = () => m(!1), u = (b) => {
28
+ b.key === "Escape" && n();
29
+ };
30
+ return o.on("dragstart", n), document.addEventListener("keydown", u), () => {
31
+ o.off("dragstart", n), document.removeEventListener("keydown", u);
32
+ };
33
+ }, [r, o, t, e]);
34
+ const a = _(o.getContainer(), () => m(!1), !e && !!t);
35
+ return !t || !p || e ? null : se(
36
+ /* @__PURE__ */ c(
37
+ "button",
38
+ {
39
+ type: "button",
40
+ ref: (n) => {
41
+ n && (F.DomEvent.disableClickPropagation(n), F.DomEvent.disableScrollPropagation(n));
42
+ },
43
+ className: "elm-attribution-toggle",
44
+ "aria-label": r ? "Hide map attribution" : "Show map attribution",
45
+ "aria-expanded": r,
46
+ "aria-controls": f,
47
+ onClick: () => {
48
+ a(), m((n) => !n);
49
+ },
50
+ children: /* @__PURE__ */ c(ae, { size: 16, weight: "bold", "aria-hidden": !0 })
51
+ }
52
+ ),
53
+ p
54
+ );
55
+ }
56
+ function pe() {
57
+ const e = U(), i = Y(), o = j(null);
58
+ return h(() => {
59
+ function r() {
60
+ o.current && clearTimeout(o.current), o.current = setTimeout(() => {
61
+ const m = e.getCenter();
62
+ te(m.lat, m.lng, e.getZoom(), i);
63
+ }, 300);
64
+ }
65
+ return e.on("moveend", r), () => {
66
+ e.off("moveend", r), o.current && clearTimeout(o.current);
67
+ };
68
+ }, [e, i]), h(() => {
69
+ const r = new ResizeObserver(() => e.invalidateSize());
70
+ return r.observe(e.getContainer()), () => r.disconnect();
71
+ }, [e]), h(() => {
72
+ }, [e]), null;
73
+ }
74
+ const fe = q(function({ tileLayer: i, renderer: o, getFeatureStyle: r, attributionTarget: m, attributionCorner: f, setup: t, onReady: d }) {
75
+ const p = z((b) => b.readonly), a = z((b) => b.bounds), g = Y(), [n] = T(() => $(t, g)), u = A(
76
+ () => /* @__PURE__ */ c(re, { readonly: p, bounds: a, renderer: o, getFeatureStyle: r, onReady: d }),
77
+ [p, a, o, r, d]
78
+ );
79
+ return /* @__PURE__ */ B(
80
+ D,
81
+ {
82
+ maxBoundsViscosity: 1,
83
+ ...t.mapOptions,
84
+ ..."bounds" in n ? { bounds: [[n.bounds[1], n.bounds[0]], [n.bounds[3], n.bounds[2]]], boundsOptions: { padding: [k, k], maxZoom: ee } } : { center: [n.center[1], n.center[0]], zoom: n.zoom },
85
+ className: "absolute inset-0 z-0",
86
+ zoomControl: !1,
87
+ children: [
88
+ i,
89
+ u,
90
+ /* @__PURE__ */ c(pe, {}),
91
+ /* @__PURE__ */ c(ce, { target: m, corner: f })
92
+ ]
93
+ }
94
+ );
95
+ }), be = "data:image/webp;base64,UklGRhAYAABXRUJQVlA4IAQYAABQSgCdASrwAHgAPtFcp08oJKMiKFGcwQAaCUxMpr8L/csRyWi2xRmaOyfptNEGWWAPNvyTOT7WqxAFdln0U/2Hdtc8n6gv7Fv2m9TYNJ4s/u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sHLIfl40qWoafUEsLZkDpizYyRXIJgnY8sgz0JFUWT/Sqlv945PjHvEJRPSqJNAvqmsIuHr1pZz7yrgeJ6edCJW0OLsawz/cb20vIDJEW1Qv5ZiYoiJdjCQLxrsVz+3OXefeAVzHTjp21fbXuTIq5beXOY80RIW8QwY3a3vBtjVYMqQiwYSXmkVFSNVv1k2vKU06uILk/sMee+ElGhRLb+h9GQQshEKDloZpgeybMUhQGtWQD/gG8T+5Q89e4F/u4dozofGpIx9Hl/xUYToyREPyhAxBSAnajvCYI/Jt7Y2guKaC9W8SlgW6wp3hv/eDImWkMdZ4xYVZYW5Wn4Tlv9a1Z3Sbmn4Qzlov4YKOtQlWNOscWT+tHAPQfiSE2EimSKt7fpdAWHYHij4JcXpAzUgfVBNp3Rkg7b1Vg6vbuSJ8sukU32x4JdVHJ+ymRDgQaon4aOB+0jYsCzQW2G5p7HC2Ym87XHIGw5w5KaoKhUu8e74T8Bfu7ZZgAA", ge = {
96
+ center: "Use `initialView`.",
97
+ zoom: "Use `initialView`.",
98
+ bounds: "Use `initialView={{ bounds }}`.",
99
+ boundsOptions: "Use `initialView`.",
100
+ maxBounds: "Use the `bounds` prop.",
101
+ zoomControl: "Element has its own zoom control (the 'zoom' layout control).",
102
+ attributionControl: "Element shows the attribution (move it into the status bar with the 'attribution' layout control).",
103
+ crs: "Element's editing tools assume Web Mercator (EPSG:3857).",
104
+ renderer: "Use the `renderer` prop.",
105
+ preferCanvas: "Use the `renderer` prop.",
106
+ dragging: "Element turns dragging on and off while editing.",
107
+ boxZoom: "Element turns boxZoom on and off while editing.",
108
+ doubleClickZoom: "Element turns doubleClickZoom on and off while editing."
109
+ }, I = "elm_basemap_leaflet", K = '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
110
+ function ve(e) {
111
+ var o;
112
+ const i = ue(
113
+ { tiles: ["https://tile.openstreetmap.org/{z}/{x}/{y}.png"], attribution: K },
114
+ e,
115
+ "osmRaster",
116
+ K
117
+ );
118
+ return { id: "osm", label: "OpenStreetMap", thumbnail: be, url: ((o = i.tiles) == null ? void 0 : o[0]) ?? i.url ?? "", attribution: i.attribution ?? "", ...i.maxzoom !== void 0 && { maxZoom: i.maxzoom } };
119
+ }
120
+ const v = (e) => e === "osm" ? "osm" : e.id ?? e.url, Ce = G(({ tileLayer: e, basemaps: i, basemap: o, defaultBasemap: r, onBasemapChange: m, renderer: f, getFeatureStyle: t, mapOptions: d, onMapReady: p, ...a }, g) => {
121
+ var x, M;
122
+ const [n] = T(() => ({
123
+ initialView: a.initialView,
124
+ initialData: a.initialData,
125
+ bounds: a.bounds,
126
+ mapOptions: oe(d, ge, "leaflet")
127
+ })), u = j(p);
128
+ u.current = p;
129
+ const b = Z((s) => {
130
+ var l;
131
+ return (l = u.current) == null ? void 0 : l.call(u, s);
132
+ }, []);
133
+ e && (i || o || r || m) && de("leaflet-tileLayer-basemaps", "<ElementEditor tileLayer> overrides `basemaps`, `basemap`, `defaultBasemap` and `onBasemapChange`: they are ignored (and no basemap picker is shown).");
134
+ const w = (M = (x = a.config) == null ? void 0 : x.network) == null ? void 0 : M.osmRaster, N = A(() => ve(w), [JSON.stringify(w)]), Q = (s) => s === "osm" ? N : s, C = i ?? ["osm"], W = !e && C.length >= 2, { current: O, pick: S, api: V } = ne(
135
+ e ? void 0 : o,
136
+ () => {
137
+ const s = me(I, a.config);
138
+ return C.find((l) => v(l) === s) ?? r ?? C[0];
139
+ },
140
+ m,
141
+ (s) => le(I, v(s), a.config),
142
+ W
143
+ ), { url: E, attribution: J, maxZoom: y } = Q(O), P = A(() => e ?? // No `maxZoom={undefined}`: Leaflet would copy it over the default and the map's max zoom becomes NaN (fitBounds breaks).
144
+ /* @__PURE__ */ c(R, { url: E, attribution: J, ...y !== void 0 && { maxZoom: y } }, E), [e, E, J, y]);
145
+ return /* @__PURE__ */ c(
146
+ ie,
147
+ {
148
+ ...a,
149
+ ref: g,
150
+ extraApi: V,
151
+ engine: "leaflet",
152
+ basemapControl: W && /* @__PURE__ */ c(
153
+ L,
154
+ {
155
+ options: C.map((s) => {
156
+ const l = Q(s);
157
+ return { id: v(s), label: l.label ?? v(s), thumbnail: l.thumbnail };
158
+ }),
159
+ value: v(O),
160
+ onChange: (s) => {
161
+ const l = C.find((X) => v(X) === s);
162
+ l && S(l, !0);
163
+ }
164
+ }
165
+ ),
166
+ renderMap: ({ attributionTarget: s, attributionCorner: l }) => /* @__PURE__ */ c(fe, { tileLayer: P, renderer: f, getFeatureStyle: t, attributionTarget: s, attributionCorner: l, setup: n, onReady: b })
167
+ }
168
+ );
169
+ });
170
+ Ce.displayName = "ElementEditor";
171
+ export {
172
+ Ue as ACCENT_STEPS,
173
+ Ye as DEFAULT_ACCENT,
174
+ ke as DEFAULT_LAYOUT,
175
+ Ce as ElementEditor,
176
+ Ne as ElementEditorError,
177
+ Fe as IconButton,
178
+ Ie as Tooltip,
179
+ Se as accentPalette,
180
+ Ke as withLayout
181
+ };
@@ -0,0 +1,68 @@
1
+ import { Map as MapLibreMap, MapOptions } from 'maplibre-gl';
2
+ import { FeatureStyleFn } from '@element-editor/adapter-maplibre';
3
+ import { BasemapInput } from '@element-editor/adapter-maplibre/basemaps';
4
+ import { ElementEditorRef as ShellRef } from '../shell/ElementEditorShell.cjs';
5
+ import { ElementEditorBaseProps } from '../shell/types.cjs';
6
+ import { BasemapRefAPI } from '../shell/useBasemapState.cjs';
7
+ export type { ImportResult } from '../shell/ElementEditorShell.cjs';
8
+ /**
9
+ * Imperative handle of `<ElementEditor ref>` (MapLibre); `getMap()` returns the `maplibregl.Map`,
10
+ * `getBasemap()` / `setBasemap()` read and switch the basemap.
11
+ */
12
+ export type ElementEditorRef = ShellRef<MapLibreMap> & BasemapRefAPI<BasemapInput>;
13
+ /** `maplibregl.Map` options that Element sets itself; not accepted in `mapOptions`. */
14
+ export type OwnedMapOption = 'container' | 'style' | 'center' | 'zoom' | 'bounds' | 'fitBoundsOptions' | 'maxBounds' | 'attributionControl' | 'interactive' | 'dragPan' | 'boxZoom' | 'doubleClickZoom';
15
+ export interface ElementEditorProps extends ElementEditorBaseProps {
16
+ /**
17
+ * The basemap shown, controlled by your app: a built-in id (`'streets' | 'terrain' | 'light' |
18
+ * 'dark' | 'osm'`), `'auto'` (light/dark follows the editor theme), a raster `{ url }` or a
19
+ * MapLibre style. Update it from `onBasemapChange`, or the picker can't change it. Nothing is
20
+ * remembered in localStorage. It doesn't have to be in `basemaps` (the picker then shows none
21
+ * selected). Give a style object an `id` (or keep it stable): an id-less inline object counts as
22
+ * a new basemap on every render. Leave it out to let Element keep the choice (`defaultBasemap`).
23
+ */
24
+ basemap?: BasemapInput;
25
+ /**
26
+ * Starting basemap when `basemap` isn't set. The user's pick from the picker is remembered
27
+ * (localStorage `elm_basemap`, namespaced by `config.persistKey`) and wins over it on reload.
28
+ * Default `'auto'`.
29
+ */
30
+ defaultBasemap?: BasemapInput;
31
+ /**
32
+ * Called with the newly chosen basemap, as it appears in `basemaps` (`'auto'` stays `'auto'`;
33
+ * resolve it with `resolveBasemap(b, theme)`), when the user picks one or you call
34
+ * `ref.setBasemap()`. Not called when `'auto'` follows a theme change or when `basemap` changes.
35
+ */
36
+ onBasemapChange?: (basemap: BasemapInput) => void;
37
+ /** Choices shown in the picker. Default: `'auto'` + all built-ins. `false` hides the picker. */
38
+ basemaps?: BasemapInput[] | false;
39
+ /**
40
+ * Per-feature style: return a `FeatureStyle` `{ color, fillColor, opacity, fillOpacity, weight }`
41
+ * (any key optional; `fillColor` falls back to `color`) or `undefined`/`null` for the default look.
42
+ * Applies to polygons, lines and points, including features drawn later. Wins over `featureColor`
43
+ * per key; the selected / hovered looks win over both. Called for every feature whenever the
44
+ * features change, so keep it fast, and keep it stable (module-level or `useCallback`): a new
45
+ * function re-sends all features to the map.
46
+ *
47
+ * @example getFeatureStyle={() => ({ color: '#00a2f0', fillColor: '#00a2f0' })}
48
+ */
49
+ getFeatureStyle?: FeatureStyleFn;
50
+ /**
51
+ * Extra `maplibregl.Map` options: `pitch`, `bearing`, `minZoom`, `maxZoom`, `hash`, `locale`,
52
+ * `transformRequest`, … Read once, when the map is created; change them later on the map itself
53
+ * (`onMapReady` / `ref.getMap()`, e.g. `map.setMaxZoom(18)`). Options Element sets itself
54
+ * (`style`, `center`, `zoom`, `bounds`, `maxBounds`, `attributionControl`, the drag / box /
55
+ * double-click zoom handlers, …) are left out; use `basemap`, `initialView` and `bounds`.
56
+ * `hash: true` lets the URL's view win over `initialView`.
57
+ */
58
+ mapOptions?: Partial<Omit<MapOptions, OwnedMapOption>>;
59
+ /**
60
+ * Called once per map, as soon as Element's sources and layers (`elm-*`) are on it: the place to
61
+ * add your own sources and layers (pass an `elm-*` id as `beforeId` to put yours under
62
+ * Element's). Basemap switches keep them. Your own `map.setStyle()` drops them: Element restores
63
+ * its own, and a `style.load` listener added here runs after that. If the editor remounts, it is called again with the
64
+ * new map (the old one is removed).
65
+ */
66
+ onMapReady?: (map: MapLibreMap) => void;
67
+ }
68
+ export declare const ElementEditor: import('react').ForwardRefExoticComponent<ElementEditorProps & import('react').RefAttributes<ElementEditorRef>>;
@@ -0,0 +1,68 @@
1
+ import { Map as MapLibreMap, MapOptions } from 'maplibre-gl';
2
+ import { FeatureStyleFn } from '@element-editor/adapter-maplibre';
3
+ import { BasemapInput } from '@element-editor/adapter-maplibre/basemaps';
4
+ import { ElementEditorRef as ShellRef } from '../shell/ElementEditorShell.js';
5
+ import { ElementEditorBaseProps } from '../shell/types.js';
6
+ import { BasemapRefAPI } from '../shell/useBasemapState.js';
7
+ export type { ImportResult } from '../shell/ElementEditorShell.js';
8
+ /**
9
+ * Imperative handle of `<ElementEditor ref>` (MapLibre); `getMap()` returns the `maplibregl.Map`,
10
+ * `getBasemap()` / `setBasemap()` read and switch the basemap.
11
+ */
12
+ export type ElementEditorRef = ShellRef<MapLibreMap> & BasemapRefAPI<BasemapInput>;
13
+ /** `maplibregl.Map` options that Element sets itself; not accepted in `mapOptions`. */
14
+ export type OwnedMapOption = 'container' | 'style' | 'center' | 'zoom' | 'bounds' | 'fitBoundsOptions' | 'maxBounds' | 'attributionControl' | 'interactive' | 'dragPan' | 'boxZoom' | 'doubleClickZoom';
15
+ export interface ElementEditorProps extends ElementEditorBaseProps {
16
+ /**
17
+ * The basemap shown, controlled by your app: a built-in id (`'streets' | 'terrain' | 'light' |
18
+ * 'dark' | 'osm'`), `'auto'` (light/dark follows the editor theme), a raster `{ url }` or a
19
+ * MapLibre style. Update it from `onBasemapChange`, or the picker can't change it. Nothing is
20
+ * remembered in localStorage. It doesn't have to be in `basemaps` (the picker then shows none
21
+ * selected). Give a style object an `id` (or keep it stable): an id-less inline object counts as
22
+ * a new basemap on every render. Leave it out to let Element keep the choice (`defaultBasemap`).
23
+ */
24
+ basemap?: BasemapInput;
25
+ /**
26
+ * Starting basemap when `basemap` isn't set. The user's pick from the picker is remembered
27
+ * (localStorage `elm_basemap`, namespaced by `config.persistKey`) and wins over it on reload.
28
+ * Default `'auto'`.
29
+ */
30
+ defaultBasemap?: BasemapInput;
31
+ /**
32
+ * Called with the newly chosen basemap, as it appears in `basemaps` (`'auto'` stays `'auto'`;
33
+ * resolve it with `resolveBasemap(b, theme)`), when the user picks one or you call
34
+ * `ref.setBasemap()`. Not called when `'auto'` follows a theme change or when `basemap` changes.
35
+ */
36
+ onBasemapChange?: (basemap: BasemapInput) => void;
37
+ /** Choices shown in the picker. Default: `'auto'` + all built-ins. `false` hides the picker. */
38
+ basemaps?: BasemapInput[] | false;
39
+ /**
40
+ * Per-feature style: return a `FeatureStyle` `{ color, fillColor, opacity, fillOpacity, weight }`
41
+ * (any key optional; `fillColor` falls back to `color`) or `undefined`/`null` for the default look.
42
+ * Applies to polygons, lines and points, including features drawn later. Wins over `featureColor`
43
+ * per key; the selected / hovered looks win over both. Called for every feature whenever the
44
+ * features change, so keep it fast, and keep it stable (module-level or `useCallback`): a new
45
+ * function re-sends all features to the map.
46
+ *
47
+ * @example getFeatureStyle={() => ({ color: '#00a2f0', fillColor: '#00a2f0' })}
48
+ */
49
+ getFeatureStyle?: FeatureStyleFn;
50
+ /**
51
+ * Extra `maplibregl.Map` options: `pitch`, `bearing`, `minZoom`, `maxZoom`, `hash`, `locale`,
52
+ * `transformRequest`, … Read once, when the map is created; change them later on the map itself
53
+ * (`onMapReady` / `ref.getMap()`, e.g. `map.setMaxZoom(18)`). Options Element sets itself
54
+ * (`style`, `center`, `zoom`, `bounds`, `maxBounds`, `attributionControl`, the drag / box /
55
+ * double-click zoom handlers, …) are left out; use `basemap`, `initialView` and `bounds`.
56
+ * `hash: true` lets the URL's view win over `initialView`.
57
+ */
58
+ mapOptions?: Partial<Omit<MapOptions, OwnedMapOption>>;
59
+ /**
60
+ * Called once per map, as soon as Element's sources and layers (`elm-*`) are on it: the place to
61
+ * add your own sources and layers (pass an `elm-*` id as `beforeId` to put yours under
62
+ * Element's). Basemap switches keep them. Your own `map.setStyle()` drops them: Element restores
63
+ * its own, and a `style.load` listener added here runs after that. If the editor remounts, it is called again with the
64
+ * new map (the old one is removed).
65
+ */
66
+ onMapReady?: (map: MapLibreMap) => void;
67
+ }
68
+ export declare const ElementEditor: import('react').ForwardRefExoticComponent<ElementEditorProps & import('react').RefAttributes<ElementEditorRef>>;
@@ -0,0 +1,35 @@
1
+ import { MapOptions } from 'maplibre-gl';
2
+ import { FeatureStyleFn } from '@element-editor/adapter-maplibre';
3
+ import { BasemapInput } from '@element-editor/adapter-maplibre/basemaps';
4
+ import { InitialView } from '../shell/savedView.cjs';
5
+ import { BoundsInput, FeatureCollectionInput, GeoJSONFeatureInput } from '@element-editor/core';
6
+ import * as maplibregl from 'maplibre-gl';
7
+ /** Creation-time inputs of the map, read once (the entry passes the first values). */
8
+ export interface MapSetup {
9
+ initialView?: InitialView;
10
+ initialData?: FeatureCollectionInput | GeoJSONFeatureInput | null;
11
+ bounds?: BoundsInput;
12
+ /** Already filtered of the keys Element owns. */
13
+ mapOptions?: Partial<MapOptions>;
14
+ }
15
+ /**
16
+ * Owns the `maplibregl.Map`. The map is created only after the initial basemap style is loaded and
17
+ * is created WITH it, so the adapter's init (add `elm-*` source/layers) never races a `setStyle`
18
+ * and nothing depends on maplibre's unreliable `isStyleLoaded()` under StrictMode.
19
+ * Also keeps the map on the current `basemap` (and `'auto'` on the theme) even when no picker is mounted.
20
+ */
21
+ declare const _default: import('react').NamedExoticComponent<{
22
+ /** Current basemap choice; the first value is the one the map is created with. */
23
+ basemap: BasemapInput;
24
+ themeMode: "light" | "dark";
25
+ /** Status bar element to move the attribution control into (instead of the compact "i" toggle). */
26
+ attributionTarget?: HTMLElement | null;
27
+ /** Shell element (bottom-right end of the slot row) to move the compact attribution into; else the map's corner. */
28
+ attributionCorner?: HTMLElement | null;
29
+ getFeatureStyle?: FeatureStyleFn;
30
+ /** Start view + extra map options; only the first value is used. */
31
+ setup: MapSetup;
32
+ /** Stable: called once per map once Element's layers are on it. */
33
+ onReady?: (map: maplibregl.Map) => void;
34
+ }>;
35
+ export default _default;
@@ -0,0 +1,35 @@
1
+ import { MapOptions } from 'maplibre-gl';
2
+ import { FeatureStyleFn } from '@element-editor/adapter-maplibre';
3
+ import { BasemapInput } from '@element-editor/adapter-maplibre/basemaps';
4
+ import { InitialView } from '../shell/savedView.js';
5
+ import { BoundsInput, FeatureCollectionInput, GeoJSONFeatureInput } from '@element-editor/core';
6
+ import * as maplibregl from 'maplibre-gl';
7
+ /** Creation-time inputs of the map, read once (the entry passes the first values). */
8
+ export interface MapSetup {
9
+ initialView?: InitialView;
10
+ initialData?: FeatureCollectionInput | GeoJSONFeatureInput | null;
11
+ bounds?: BoundsInput;
12
+ /** Already filtered of the keys Element owns. */
13
+ mapOptions?: Partial<MapOptions>;
14
+ }
15
+ /**
16
+ * Owns the `maplibregl.Map`. The map is created only after the initial basemap style is loaded and
17
+ * is created WITH it, so the adapter's init (add `elm-*` source/layers) never races a `setStyle`
18
+ * and nothing depends on maplibre's unreliable `isStyleLoaded()` under StrictMode.
19
+ * Also keeps the map on the current `basemap` (and `'auto'` on the theme) even when no picker is mounted.
20
+ */
21
+ declare const _default: import('react').NamedExoticComponent<{
22
+ /** Current basemap choice; the first value is the one the map is created with. */
23
+ basemap: BasemapInput;
24
+ themeMode: "light" | "dark";
25
+ /** Status bar element to move the attribution control into (instead of the compact "i" toggle). */
26
+ attributionTarget?: HTMLElement | null;
27
+ /** Shell element (bottom-right end of the slot row) to move the compact attribution into; else the map's corner. */
28
+ attributionCorner?: HTMLElement | null;
29
+ getFeatureStyle?: FeatureStyleFn;
30
+ /** Start view + extra map options; only the first value is used. */
31
+ setup: MapSetup;
32
+ /** Stable: called once per map once Element's layers are on it. */
33
+ onReady?: (map: maplibregl.Map) => void;
34
+ }>;
35
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export { ElementEditor } from './ElementEditor.cjs';
2
+ export type { ElementEditorProps, ElementEditorRef, ImportResult } from './ElementEditor.cjs';
@@ -0,0 +1,2 @@
1
+ export { ElementEditor } from './ElementEditor.js';
2
+ export type { ElementEditorProps, ElementEditorRef, ImportResult } from './ElementEditor.js';
@@ -0,0 +1,21 @@
1
+ import { NetworkConfig } from '@element-editor/core';
2
+ import * as maplibregl from 'maplibre-gl';
3
+ /** Default `config.network.maplibreWorker`: jsDelivr copy of the installed maplibre-gl version. */
4
+ export declare const workerCdnUrl: (version: string) => string;
5
+ type WorkerApi = Pick<typeof maplibregl, 'getVersion' | 'getWorkerUrl' | 'setWorkerUrl'>;
6
+ /**
7
+ * The worker URL the drop-in should pass to `setWorkerUrl`, or `null` to leave MapLibre alone:
8
+ * on 5.x (worker built in), when the app already set one (`current`), or with `setting: false`.
9
+ */
10
+ export declare function resolveWorkerUrl(setting: NetworkConfig['maplibreWorker'], version: string, current: string): string | null;
11
+ /**
12
+ * Makes sure MapLibre can start its worker before the drop-in creates its map.
13
+ *
14
+ * MapLibre GL JS 5 inlines its worker. Version 6 is ESM-only and loads the worker from a separate
15
+ * file (`maplibre-gl-worker.mjs`) that it looks for next to its own module (`import.meta.url`).
16
+ * Bundlers (Vite, webpack, Turbopack) move maplibre-gl into their own chunks, so that lookup misses
17
+ * and the map shows nothing unless someone calls `setWorkerUrl`. The drop-in does, with
18
+ * `config.network.maplibreWorker` (see `resolveWorkerUrl`).
19
+ */
20
+ export declare function ensureWorkerUrl(setting: NetworkConfig['maplibreWorker'], lib?: WorkerApi): void;
21
+ export {};
@@ -0,0 +1,21 @@
1
+ import { NetworkConfig } from '@element-editor/core';
2
+ import * as maplibregl from 'maplibre-gl';
3
+ /** Default `config.network.maplibreWorker`: jsDelivr copy of the installed maplibre-gl version. */
4
+ export declare const workerCdnUrl: (version: string) => string;
5
+ type WorkerApi = Pick<typeof maplibregl, 'getVersion' | 'getWorkerUrl' | 'setWorkerUrl'>;
6
+ /**
7
+ * The worker URL the drop-in should pass to `setWorkerUrl`, or `null` to leave MapLibre alone:
8
+ * on 5.x (worker built in), when the app already set one (`current`), or with `setting: false`.
9
+ */
10
+ export declare function resolveWorkerUrl(setting: NetworkConfig['maplibreWorker'], version: string, current: string): string | null;
11
+ /**
12
+ * Makes sure MapLibre can start its worker before the drop-in creates its map.
13
+ *
14
+ * MapLibre GL JS 5 inlines its worker. Version 6 is ESM-only and loads the worker from a separate
15
+ * file (`maplibre-gl-worker.mjs`) that it looks for next to its own module (`import.meta.url`).
16
+ * Bundlers (Vite, webpack, Turbopack) move maplibre-gl into their own chunks, so that lookup misses
17
+ * and the map shows nothing unless someone calls `setWorkerUrl`. The drop-in does, with
18
+ * `config.network.maplibreWorker` (see `resolveWorkerUrl`).
19
+ */
20
+ export declare function ensureWorkerUrl(setting: NetworkConfig['maplibreWorker'], lib?: WorkerApi): void;
21
+ export {};
@@ -0,0 +1,13 @@
1
+ export type { ElementEditorConfig, DrawTool, LayoutSlot, LayoutControl, LayoutGroup, LayoutEntry, LayoutSlotConfig, LayoutConfig, MapSlot, StatusSlot, MapGroup, StatusGroup, MapEntry, StatusEntry, MapSlotConfig, StatusSlotConfig, LayoutPatch, SlotFor, RasterBasemap } from '@element-editor/ui';
2
+ export { DEFAULT_LAYOUT, withLayout } from '@element-editor/ui';
3
+ export type { FeatureCollection, GeoJSONFeature, FeatureCollectionInput, GeoJSONFeatureInput, GeometryInput, Schema, SchemaField, Group, Geometry, EditingMode } from './types/geojson.cjs';
4
+ export type { ElementEditorEvent, ElementEditorErrorHandler, ErrorCode, ErrorSource } from '@element-editor/ui';
5
+ export type { MutationOptions, SetFeatureCollectionOptions, ValidationReport } from '@element-editor/ui';
6
+ export { ElementEditorError } from '@element-editor/core';
7
+ export { IconButton, Tooltip } from '@element-editor/ui';
8
+ export { accentPalette, DEFAULT_ACCENT, ACCENT_STEPS } from '@element-editor/core';
9
+ export type { AccentShade } from '@element-editor/core';
10
+ export type { FeatureStyle } from '@element-editor/core';
11
+ export type { ElementEditorBaseProps } from './shell/types.cjs';
12
+ export type { InitialView } from './shell/savedView.cjs';
13
+ export type { BBox, BoundsInput, FlyToOptions } from '@element-editor/core';
@@ -0,0 +1,13 @@
1
+ export type { ElementEditorConfig, DrawTool, LayoutSlot, LayoutControl, LayoutGroup, LayoutEntry, LayoutSlotConfig, LayoutConfig, MapSlot, StatusSlot, MapGroup, StatusGroup, MapEntry, StatusEntry, MapSlotConfig, StatusSlotConfig, LayoutPatch, SlotFor, RasterBasemap } from '@element-editor/ui';
2
+ export { DEFAULT_LAYOUT, withLayout } from '@element-editor/ui';
3
+ export type { FeatureCollection, GeoJSONFeature, FeatureCollectionInput, GeoJSONFeatureInput, GeometryInput, Schema, SchemaField, Group, Geometry, EditingMode } from './types/geojson.js';
4
+ export type { ElementEditorEvent, ElementEditorErrorHandler, ErrorCode, ErrorSource } from '@element-editor/ui';
5
+ export type { MutationOptions, SetFeatureCollectionOptions, ValidationReport } from '@element-editor/ui';
6
+ export { ElementEditorError } from '@element-editor/core';
7
+ export { IconButton, Tooltip } from '@element-editor/ui';
8
+ export { accentPalette, DEFAULT_ACCENT, ACCENT_STEPS } from '@element-editor/core';
9
+ export type { AccentShade } from '@element-editor/core';
10
+ export type { FeatureStyle } from '@element-editor/core';
11
+ export type { ElementEditorBaseProps } from './shell/types.js';
12
+ export type { InitialView } from './shell/savedView.js';
13
+ export type { BBox, BoundsInput, FlyToOptions } from '@element-editor/core';
@@ -0,0 +1,32 @@
1
+ import { default as React } from 'react';
2
+ import { ElementEditorBaseProps } from './types.cjs';
3
+ import { ElementEditorImperativeAPI } from '@element-editor/ui';
4
+ export type { ImportResult } from '@element-editor/ui';
5
+ /**
6
+ * Imperative handle for `<ElementEditor ref={...} />`: `ElementEditorImperativeAPI` from
7
+ * `@element-editor/ui`, the same surface as the adapters' `ElementEditorControlsRef`.
8
+ * Engine-neutral here (`getMap()` returns `unknown`); each entry re-exports it with its map type
9
+ * (`maplibre/ElementEditor.tsx`, `leaflet/ElementEditor.tsx`), so neither entry's types reach the
10
+ * other engine's.
11
+ */
12
+ export type ElementEditorRef<TMap = unknown> = ElementEditorImperativeAPI<TMap>;
13
+ export interface ElementEditorShellProps extends ElementEditorBaseProps {
14
+ /**
15
+ * Renders the engine's map. `attributionTarget`: the status-bar element its attribution control
16
+ * moves into (full line), or null. Otherwise `attributionCorner`: the element at the bottom-right
17
+ * end of the bottom slot row its compact attribution moves into, so the row's layout keeps every
18
+ * control off it (null while the row is hidden: the map's own corner).
19
+ */
20
+ renderMap: (args: {
21
+ attributionTarget: HTMLElement | null;
22
+ attributionCorner: HTMLElement | null;
23
+ themeMode: 'light' | 'dark';
24
+ }) => React.ReactNode;
25
+ /** Rendered for the `'basemap'` layout control; the control is hidden when omitted. */
26
+ basemapControl?: React.ReactNode;
27
+ /** Entry-specific ref methods (e.g. `getBasemap` / `setBasemap`) merged into the handle. Keep it stable. */
28
+ extraApi?: object;
29
+ /** Which drop-in renders the shell (for development messages, e.g. which stylesheet to import). */
30
+ engine?: 'maplibre' | 'leaflet';
31
+ }
32
+ export declare const ElementEditorShell: React.ForwardRefExoticComponent<ElementEditorShellProps & React.RefAttributes<ElementEditorRef<unknown>>>;
@@ -0,0 +1,32 @@
1
+ import { default as React } from 'react';
2
+ import { ElementEditorBaseProps } from './types.js';
3
+ import { ElementEditorImperativeAPI } from '@element-editor/ui';
4
+ export type { ImportResult } from '@element-editor/ui';
5
+ /**
6
+ * Imperative handle for `<ElementEditor ref={...} />`: `ElementEditorImperativeAPI` from
7
+ * `@element-editor/ui`, the same surface as the adapters' `ElementEditorControlsRef`.
8
+ * Engine-neutral here (`getMap()` returns `unknown`); each entry re-exports it with its map type
9
+ * (`maplibre/ElementEditor.tsx`, `leaflet/ElementEditor.tsx`), so neither entry's types reach the
10
+ * other engine's.
11
+ */
12
+ export type ElementEditorRef<TMap = unknown> = ElementEditorImperativeAPI<TMap>;
13
+ export interface ElementEditorShellProps extends ElementEditorBaseProps {
14
+ /**
15
+ * Renders the engine's map. `attributionTarget`: the status-bar element its attribution control
16
+ * moves into (full line), or null. Otherwise `attributionCorner`: the element at the bottom-right
17
+ * end of the bottom slot row its compact attribution moves into, so the row's layout keeps every
18
+ * control off it (null while the row is hidden: the map's own corner).
19
+ */
20
+ renderMap: (args: {
21
+ attributionTarget: HTMLElement | null;
22
+ attributionCorner: HTMLElement | null;
23
+ themeMode: 'light' | 'dark';
24
+ }) => React.ReactNode;
25
+ /** Rendered for the `'basemap'` layout control; the control is hidden when omitted. */
26
+ basemapControl?: React.ReactNode;
27
+ /** Entry-specific ref methods (e.g. `getBasemap` / `setBasemap`) merged into the handle. Keep it stable. */
28
+ extraApi?: object;
29
+ /** Which drop-in renders the shell (for development messages, e.g. which stylesheet to import). */
30
+ engine?: 'maplibre' | 'leaflet';
31
+ }
32
+ export declare const ElementEditorShell: React.ForwardRefExoticComponent<ElementEditorShellProps & React.RefAttributes<ElementEditorRef<unknown>>>;
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * The shell's map area (map, panels, slots), plus `footer` (the status bar) below it. Its own
4
+ * component: the import reports through `useEmit`, which needs the shell's EventProvider above it.
5
+ * The drop handlers sit on a `display: contents` wrapper around both, so a file dropped anywhere
6
+ * on the editor (status bar included) is imported here and never reaches a host drop zone or
7
+ * the browser's open-the-file default; the overlay covers the map area.
8
+ */
9
+ export declare function FileDropBox({ enabled, children, footer }: {
10
+ enabled: boolean;
11
+ children: ReactNode;
12
+ footer?: ReactNode;
13
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * The shell's map area (map, panels, slots), plus `footer` (the status bar) below it. Its own
4
+ * component: the import reports through `useEmit`, which needs the shell's EventProvider above it.
5
+ * The drop handlers sit on a `display: contents` wrapper around both, so a file dropped anywhere
6
+ * on the editor (status bar included) is imported here and never reaches a host drop zone or
7
+ * the browser's open-the-file default; the overlay covers the map area.
8
+ */
9
+ export declare function FileDropBox({ enabled, children, footer }: {
10
+ enabled: boolean;
11
+ children: ReactNode;
12
+ footer?: ReactNode;
13
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { default as React } from 'react';
2
+ import { LayoutControl, IconButtonSize, TooltipSide } from '@element-editor/ui';
3
+ export interface ShellControlProps {
4
+ id: LayoutControl;
5
+ size: IconButtonSize;
6
+ side: TooltipSide;
7
+ /** `applyChanges` click handler (the imperative API's `submit`). */
8
+ onSubmit: () => void;
9
+ /** Rendered for `basemap`; built by the engine wrapper. */
10
+ basemapControl?: React.ReactNode;
11
+ /** Receives the status-bar element the engine's map view moves its attribution control into. */
12
+ attributionRef: (el: HTMLElement | null) => void;
13
+ }
14
+ /**
15
+ * One layout control. Each toggle button subscribes to its own store slice,
16
+ * so opening the table / schema / GeoJSON / settings re-renders only that
17
+ * button, not the whole shell.
18
+ */
19
+ export declare function ShellControl({ id, size, side, onSubmit, basemapControl, attributionRef }: ShellControlProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,19 @@
1
+ import { default as React } from 'react';
2
+ import { LayoutControl, IconButtonSize, TooltipSide } from '@element-editor/ui';
3
+ export interface ShellControlProps {
4
+ id: LayoutControl;
5
+ size: IconButtonSize;
6
+ side: TooltipSide;
7
+ /** `applyChanges` click handler (the imperative API's `submit`). */
8
+ onSubmit: () => void;
9
+ /** Rendered for `basemap`; built by the engine wrapper. */
10
+ basemapControl?: React.ReactNode;
11
+ /** Receives the status-bar element the engine's map view moves its attribution control into. */
12
+ attributionRef: (el: HTMLElement | null) => void;
13
+ }
14
+ /**
15
+ * One layout control. Each toggle button subscribes to its own store slice,
16
+ * so opening the table / schema / GeoJSON / settings re-renders only that
17
+ * button, not the whole shell.
18
+ */
19
+ export declare function ShellControl({ id, size, side, onSubmit, basemapControl, attributionRef }: ShellControlProps): import("react/jsx-runtime").JSX.Element | null;