@element-editor/react 0.2.2 → 0.3.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/AGENTS.md +6 -1
- package/dist/element-editor-leaflet.css +1 -1
- package/dist/element-editor.cjs +1 -1
- package/dist/element-editor.css +1 -1
- package/dist/element-editor.es.js +1 -1
- package/dist/leaflet.cjs +1 -1
- package/dist/leaflet.es.js +1 -1
- package/dist/shared.d.cts +2 -2
- package/dist/shared.d.ts +2 -2
- package/dist/shell/types.d.cts +44 -1
- package/dist/shell/types.d.ts +44 -1
- package/dist/useBasemapState-8kWJmLD9.cjs +1 -0
- package/dist/useBasemapState-EEM8j7r8.js +690 -0
- package/package.json +8 -8
- package/dist/useBasemapState-8bWJK84f.cjs +0 -1
- package/dist/useBasemapState-DChxz3lv.js +0 -682
|
@@ -7,7 +7,7 @@ import { jsxs as K, Fragment as X, jsx as v } from "react/jsx-runtime";
|
|
|
7
7
|
import { memo as H, useRef as w, useState as F, useEffect as W, forwardRef as Q, useCallback as ee } from "react";
|
|
8
8
|
import { useBasemap as te, ElementEditorControls as oe, BasemapControl as re } from "@element-editor/adapter-maplibre";
|
|
9
9
|
import { loadErrorCode as ne, warnOnce as P, isDevBuild as ie } from "@element-editor/core/internal";
|
|
10
|
-
import { r as se, F as le, a as ae, s as ce, u as ue, b as me, p as de, E as pe } from "./useBasemapState-
|
|
10
|
+
import { r as se, F as le, a as ae, s as ce, u as ue, b as me, p as de, E as pe } from "./useBasemapState-EEM8j7r8.js";
|
|
11
11
|
import * as x from "maplibre-gl";
|
|
12
12
|
import { useServiceAttribution as fe } from "@element-editor/ui/internal";
|
|
13
13
|
import { loadBasemapStyle as Ee, resolveBasemap as be } from "@element-editor/adapter-maplibre/basemaps";
|
package/dist/leaflet.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),i=require("react"),A=require("react-leaflet"),f=require("@element-editor/ui"),b=require("./useBasemapState-8bWJK84f.cjs"),V=require("@element-editor/adapter-leaflet"),X=require("react-dom"),S=require("leaflet"),B=require("@phosphor-icons/react"),v=require("@element-editor/core"),z=require("@element-editor/core/internal");function D({target:e,corner:r}){var y;const o=A.useMap(),[s,l]=i.useState(!0),E=`elm-attribution${i.useId().replace(/:/g,"")}`,t=(y=o.attributionControl)==null?void 0:y.getContainer(),[d]=i.useState(()=>t==null?void 0:t.parentElement),g=r??d;i.useEffect(()=>{if(!(!t||!d))return e?(t.classList.add("elm-attribution-bar"),e.appendChild(t),()=>{t.classList.remove("elm-attribution-bar"),d.appendChild(t)}):(t.classList.add("elm-attribution-compact"),t.id=E,r&&r.prepend(t),()=>{t.classList.remove("elm-attribution-compact","elm-attribution-open"),r&&d.appendChild(t)})},[t,d,r,e,E]),i.useEffect(()=>{if(e||(t==null||t.classList.toggle("elm-attribution-open",s),!s))return;const n=()=>l(!1),p=T=>{T.key==="Escape"&&n()};return o.on("dragstart",n),document.addEventListener("keydown",p),()=>{o.off("dragstart",n),document.removeEventListener("keydown",p)}},[s,o,t,e]);const u=b.useAttributionAutoCollapse(o.getContainer(),()=>l(!1),!e&&!!t);return!t||!g||e?null:X.createPortal(m.jsx("button",{type:"button",ref:n=>{n&&(S.DomEvent.disableClickPropagation(n),S.DomEvent.disableScrollPropagation(n))},className:"elm-attribution-toggle","aria-label":s?"Hide map attribution":"Show map attribution","aria-expanded":s,"aria-controls":E,onClick:()=>{u(),l(n=>!n)},children:m.jsx(B.Info,{size:16,weight:"bold","aria-hidden":!0})}),g)}function H(){const e=A.useMap(),r=f.useElementEditorConfig(),o=i.useRef(null);return i.useEffect(()=>{function s(){o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{const l=e.getCenter();b.saveView(l.lat,l.lng,e.getZoom(),r)},300)}return e.on("moveend",s),()=>{e.off("moveend",s),o.current&&clearTimeout(o.current)}},[e,r]),i.useEffect(()=>{const s=new ResizeObserver(()=>e.invalidateSize());return s.observe(e.getContainer()),()=>s.disconnect()},[e]),i.useEffect(()=>{},[e]),null}const G=i.memo(function({tileLayer:r,renderer:o,getFeatureStyle:s,attributionTarget:l,attributionCorner:E,setup:t,onReady:d}){const g=f.useUIStore(T=>T.readonly),u=f.useUIStore(T=>T.bounds),y=f.useElementEditorConfig(),[n]=i.useState(()=>b.resolveInitialView(t,y)),p=i.useMemo(()=>m.jsx(V.ElementEditorControls,{readonly:g,bounds:u,renderer:o,getFeatureStyle:s,onReady:d}),[g,u,o,s,d]);return m.jsxs(A.MapContainer,{maxBoundsViscosity:1,...t.mapOptions,..."bounds"in n?{bounds:[[n.bounds[1],n.bounds[0]],[n.bounds[3],n.bounds[2]]],boundsOptions:{padding:[b.FIT_PADDING,b.FIT_PADDING],maxZoom:b.FIT_MAX_ZOOM}}:{center:[n.center[1],n.center[0]],zoom:n.zoom},className:"absolute inset-0 z-0",zoomControl:!1,children:[r,p,m.jsx(H,{}),m.jsx(D,{target:l,corner:E})]})}),Z="data:image/webp;base64,UklGRhAYAABXRUJQVlA4IAQYAABQSgCdASrwAHgAPtFcp08oJKMiKFGcwQAaCUxMpr8L/csRyWi2xRmaOyfptNEGWWAPNvyTOT7WqxAFdln0U/2Hdtc8n6gv7Fv2m9TYNJ4s/uH2p8M/2fsFbqf0fgZ2ney3+C8QJ23aBd4PRH7jei/8nrRNAf+c/3T/ke033tv3b1FOlz6QwjlIuxkq065ohY/x8YZH/DFe5yitzlGumnfFLLhhVJBSNAQ4tWgRfZBbX9N7+ldYmYMYP2lpKoFWZ1MWn7QcZ41mKu7VZBNMF1ar+dcJPjTvEJ16SYZ6hRcci6TO13jYa7vQn3/aMTTqaO9Vj2egZjgYJ4x4Y6rEB7MBWeuhlwI46a+KRtwhZT6NXsdlRSuWZlCmLjdPRfZq3Yqctea7sUM8A58fgpS0UQ0DggJOAktwv1UPV/gqLNTHgMCz5ePo6HKajMMm/sFVxI/kHJQJkpJqy1CZNz9qG3KKs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WT+tHAPQfiSE2EimSKt7fpdAWHYHij4JcXpAzUgfVBNp3Rkg7b1Vg6vbuSJ8sukU32x4JdVHJ+ymRDgQaon4aOB+0jYsCzQW2G5p7HC2Ym87XHIGw5w5KaoKhUu8e74T8Bfu7ZZgAA",R={center:"Use `initialView`.",zoom:"Use `initialView`.",bounds:"Use `initialView={{ bounds }}`.",boundsOptions:"Use `initialView`.",maxBounds:"Use the `bounds` prop.",zoomControl:"Element has its own zoom control (the 'zoom' layout control).",attributionControl:"Element shows the attribution (move it into the status bar with the 'attribution' layout control).",crs:"Element's editing tools assume Web Mercator (EPSG:3857).",renderer:"Use the `renderer` prop.",preferCanvas:"Use the `renderer` prop.",dragging:"Element turns dragging on and off while editing.",boxZoom:"Element turns boxZoom on and off while editing.",doubleClickZoom:"Element turns doubleClickZoom on and off while editing."},I="elm_basemap_leaflet",U='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';function L(e){var o;const r=z.overrideSource({tiles:["https://tile.openstreetmap.org/{z}/{x}/{y}.png"],attribution:U},e,"osmRaster",U);return{id:"osm",label:"OpenStreetMap",thumbnail:Z,url:((o=r.tiles)==null?void 0:o[0])??r.url??"",attribution:r.attribution??"",...r.maxzoom!==void 0&&{maxZoom:r.maxzoom}}}const C=e=>e==="osm"?"osm":e.id??e.url,F=i.forwardRef(({tileLayer:e,basemaps:r,basemap:o,defaultBasemap:s,onBasemapChange:l,renderer:E,getFeatureStyle:t,mapOptions:d,onMapReady:g,...u},y)=>{var P,M;const[n]=i.useState(()=>({initialView:u.initialView,initialData:u.initialData,bounds:u.bounds,mapOptions:b.pickMapOptions(d,R,"leaflet")})),p=i.useRef(g);p.current=g;const T=i.useCallback(a=>{var c;return(c=p.current)==null?void 0:c.call(p,a)},[]);e&&(r||o||s||l)&&z.warnOnce("leaflet-tileLayer-basemaps","<ElementEditor tileLayer> overrides `basemaps`, `basemap`, `defaultBasemap` and `onBasemapChange`: they are ignored (and no basemap picker is shown).");const Q=(M=(P=u.config)==null?void 0:P.network)==null?void 0:M.osmRaster,k=i.useMemo(()=>L(Q),[JSON.stringify(Q)]),W=a=>a==="osm"?k:a,h=r??["osm"],j=!e&&h.length>=2,{current:x,pick:q,api:K}=b.useBasemapState(e?void 0:o,()=>{const a=v.readStorage(I,u.config);return h.find(c=>C(c)===a)??s??h[0]},l,a=>v.writeStorage(I,C(a),u.config),j),{url:O,attribution:J,maxZoom:w}=W(x),N=i.useMemo(()=>e??m.jsx(A.TileLayer,{url:O,attribution:J,...w!==void 0&&{maxZoom:w}},O),[e,O,J,w]);return m.jsx(b.ElementEditorShell,{...u,ref:y,extraApi:K,engine:"leaflet",basemapControl:j&&m.jsx(f.BasemapPicker,{options:h.map(a=>{const c=W(a);return{id:C(a),label:c.label??C(a),thumbnail:c.thumbnail}}),value:C(x),onChange:a=>{const c=h.find(Y=>C(Y)===a);c&&q(c,!0)}}),renderMap:({attributionTarget:a,attributionCorner:c})=>m.jsx(G,{tileLayer:N,renderer:E,getFeatureStyle:t,attributionTarget:a,attributionCorner:c,setup:n,onReady:T})})});F.displayName="ElementEditor";Object.defineProperty(exports,"DEFAULT_LAYOUT",{enumerable:!0,get:()=>f.DEFAULT_LAYOUT});Object.defineProperty(exports,"IconButton",{enumerable:!0,get:()=>f.IconButton});Object.defineProperty(exports,"Tooltip",{enumerable:!0,get:()=>f.Tooltip});Object.defineProperty(exports,"withLayout",{enumerable:!0,get:()=>f.withLayout});Object.defineProperty(exports,"ACCENT_STEPS",{enumerable:!0,get:()=>v.ACCENT_STEPS});Object.defineProperty(exports,"DEFAULT_ACCENT",{enumerable:!0,get:()=>v.DEFAULT_ACCENT});Object.defineProperty(exports,"ElementEditorError",{enumerable:!0,get:()=>v.ElementEditorError});Object.defineProperty(exports,"accentPalette",{enumerable:!0,get:()=>v.accentPalette});exports.ElementEditor=F;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),i=require("react"),A=require("react-leaflet"),f=require("@element-editor/ui"),b=require("./useBasemapState-8kWJmLD9.cjs"),V=require("@element-editor/adapter-leaflet"),X=require("react-dom"),S=require("leaflet"),B=require("@phosphor-icons/react"),v=require("@element-editor/core"),z=require("@element-editor/core/internal");function D({target:e,corner:r}){var y;const o=A.useMap(),[s,l]=i.useState(!0),E=`elm-attribution${i.useId().replace(/:/g,"")}`,t=(y=o.attributionControl)==null?void 0:y.getContainer(),[d]=i.useState(()=>t==null?void 0:t.parentElement),g=r??d;i.useEffect(()=>{if(!(!t||!d))return e?(t.classList.add("elm-attribution-bar"),e.appendChild(t),()=>{t.classList.remove("elm-attribution-bar"),d.appendChild(t)}):(t.classList.add("elm-attribution-compact"),t.id=E,r&&r.prepend(t),()=>{t.classList.remove("elm-attribution-compact","elm-attribution-open"),r&&d.appendChild(t)})},[t,d,r,e,E]),i.useEffect(()=>{if(e||(t==null||t.classList.toggle("elm-attribution-open",s),!s))return;const n=()=>l(!1),p=T=>{T.key==="Escape"&&n()};return o.on("dragstart",n),document.addEventListener("keydown",p),()=>{o.off("dragstart",n),document.removeEventListener("keydown",p)}},[s,o,t,e]);const u=b.useAttributionAutoCollapse(o.getContainer(),()=>l(!1),!e&&!!t);return!t||!g||e?null:X.createPortal(m.jsx("button",{type:"button",ref:n=>{n&&(S.DomEvent.disableClickPropagation(n),S.DomEvent.disableScrollPropagation(n))},className:"elm-attribution-toggle","aria-label":s?"Hide map attribution":"Show map attribution","aria-expanded":s,"aria-controls":E,onClick:()=>{u(),l(n=>!n)},children:m.jsx(B.Info,{size:16,weight:"bold","aria-hidden":!0})}),g)}function H(){const e=A.useMap(),r=f.useElementEditorConfig(),o=i.useRef(null);return i.useEffect(()=>{function s(){o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{const l=e.getCenter();b.saveView(l.lat,l.lng,e.getZoom(),r)},300)}return e.on("moveend",s),()=>{e.off("moveend",s),o.current&&clearTimeout(o.current)}},[e,r]),i.useEffect(()=>{const s=new ResizeObserver(()=>e.invalidateSize());return s.observe(e.getContainer()),()=>s.disconnect()},[e]),i.useEffect(()=>{},[e]),null}const G=i.memo(function({tileLayer:r,renderer:o,getFeatureStyle:s,attributionTarget:l,attributionCorner:E,setup:t,onReady:d}){const g=f.useUIStore(T=>T.readonly),u=f.useUIStore(T=>T.bounds),y=f.useElementEditorConfig(),[n]=i.useState(()=>b.resolveInitialView(t,y)),p=i.useMemo(()=>m.jsx(V.ElementEditorControls,{readonly:g,bounds:u,renderer:o,getFeatureStyle:s,onReady:d}),[g,u,o,s,d]);return m.jsxs(A.MapContainer,{maxBoundsViscosity:1,...t.mapOptions,..."bounds"in n?{bounds:[[n.bounds[1],n.bounds[0]],[n.bounds[3],n.bounds[2]]],boundsOptions:{padding:[b.FIT_PADDING,b.FIT_PADDING],maxZoom:b.FIT_MAX_ZOOM}}:{center:[n.center[1],n.center[0]],zoom:n.zoom},className:"absolute inset-0 z-0",zoomControl:!1,children:[r,p,m.jsx(H,{}),m.jsx(D,{target:l,corner:E})]})}),Z="data:image/webp;base64,UklGRhAYAABXRUJQVlA4IAQYAABQSgCdASrwAHgAPtFcp08oJKMiKFGcwQAaCUxMpr8L/csRyWi2xRmaOyfptNEGWWAPNvyTOT7WqxAFdln0U/2Hdtc8n6gv7Fv2m9TYNJ4s/uH2p8M/2fsFbqf0fgZ2ney3+C8QJ23aBd4PRH7jei/8nrRNAf+c/3T/ke033tv3b1FOlz6QwjlIuxkq065ohY/x8YZH/DFe5yitzlGumnfFLLhhVJBSNAQ4tWgRfZBbX9N7+ldYmYMYP2lpKoFWZ1MWn7QcZ41mKu7VZBNMF1ar+dcJPjTvEJ16SYZ6hRcci6TO13jYa7vQn3/aMTTqaO9Vj2egZjgYJ4x4Y6rEB7MBWeuhlwI46a+KRtwhZT6NXsdlRSuWZlCmLjdPRfZq3Yqctea7sUM8A58fgpS0UQ0DggJOAktwv1UPV/gqLNTHgMCz5ePo6HKajMMm/sFVxI/kHJQJkpJqy1CZNz9qG3KKsgvfr9UVd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fiSE2EimSKt7fpdAWHYHij4JcXpAzUgfVBNp3Rkg7b1Vg6vbuSJ8sukU32x4JdVHJ+ymRDgQaon4aOB+0jYsCzQW2G5p7HC2Ym87XHIGw5w5KaoKhUu8e74T8Bfu7ZZgAA",R={center:"Use `initialView`.",zoom:"Use `initialView`.",bounds:"Use `initialView={{ bounds }}`.",boundsOptions:"Use `initialView`.",maxBounds:"Use the `bounds` prop.",zoomControl:"Element has its own zoom control (the 'zoom' layout control).",attributionControl:"Element shows the attribution (move it into the status bar with the 'attribution' layout control).",crs:"Element's editing tools assume Web Mercator (EPSG:3857).",renderer:"Use the `renderer` prop.",preferCanvas:"Use the `renderer` prop.",dragging:"Element turns dragging on and off while editing.",boxZoom:"Element turns boxZoom on and off while editing.",doubleClickZoom:"Element turns doubleClickZoom on and off while editing."},I="elm_basemap_leaflet",U='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';function L(e){var o;const r=z.overrideSource({tiles:["https://tile.openstreetmap.org/{z}/{x}/{y}.png"],attribution:U},e,"osmRaster",U);return{id:"osm",label:"OpenStreetMap",thumbnail:Z,url:((o=r.tiles)==null?void 0:o[0])??r.url??"",attribution:r.attribution??"",...r.maxzoom!==void 0&&{maxZoom:r.maxzoom}}}const C=e=>e==="osm"?"osm":e.id??e.url,F=i.forwardRef(({tileLayer:e,basemaps:r,basemap:o,defaultBasemap:s,onBasemapChange:l,renderer:E,getFeatureStyle:t,mapOptions:d,onMapReady:g,...u},y)=>{var P,M;const[n]=i.useState(()=>({initialView:u.initialView,initialData:u.initialData,bounds:u.bounds,mapOptions:b.pickMapOptions(d,R,"leaflet")})),p=i.useRef(g);p.current=g;const T=i.useCallback(a=>{var c;return(c=p.current)==null?void 0:c.call(p,a)},[]);e&&(r||o||s||l)&&z.warnOnce("leaflet-tileLayer-basemaps","<ElementEditor tileLayer> overrides `basemaps`, `basemap`, `defaultBasemap` and `onBasemapChange`: they are ignored (and no basemap picker is shown).");const Q=(M=(P=u.config)==null?void 0:P.network)==null?void 0:M.osmRaster,k=i.useMemo(()=>L(Q),[JSON.stringify(Q)]),W=a=>a==="osm"?k:a,h=r??["osm"],j=!e&&h.length>=2,{current:x,pick:q,api:K}=b.useBasemapState(e?void 0:o,()=>{const a=v.readStorage(I,u.config);return h.find(c=>C(c)===a)??s??h[0]},l,a=>v.writeStorage(I,C(a),u.config),j),{url:O,attribution:J,maxZoom:w}=W(x),N=i.useMemo(()=>e??m.jsx(A.TileLayer,{url:O,attribution:J,...w!==void 0&&{maxZoom:w}},O),[e,O,J,w]);return m.jsx(b.ElementEditorShell,{...u,ref:y,extraApi:K,engine:"leaflet",basemapControl:j&&m.jsx(f.BasemapPicker,{options:h.map(a=>{const c=W(a);return{id:C(a),label:c.label??C(a),thumbnail:c.thumbnail}}),value:C(x),onChange:a=>{const c=h.find(Y=>C(Y)===a);c&&q(c,!0)}}),renderMap:({attributionTarget:a,attributionCorner:c})=>m.jsx(G,{tileLayer:N,renderer:E,getFeatureStyle:t,attributionTarget:a,attributionCorner:c,setup:n,onReady:T})})});F.displayName="ElementEditor";Object.defineProperty(exports,"DEFAULT_LAYOUT",{enumerable:!0,get:()=>f.DEFAULT_LAYOUT});Object.defineProperty(exports,"IconButton",{enumerable:!0,get:()=>f.IconButton});Object.defineProperty(exports,"Tooltip",{enumerable:!0,get:()=>f.Tooltip});Object.defineProperty(exports,"withLayout",{enumerable:!0,get:()=>f.withLayout});Object.defineProperty(exports,"ACCENT_STEPS",{enumerable:!0,get:()=>v.ACCENT_STEPS});Object.defineProperty(exports,"DEFAULT_ACCENT",{enumerable:!0,get:()=>v.DEFAULT_ACCENT});Object.defineProperty(exports,"ElementEditorError",{enumerable:!0,get:()=>v.ElementEditorError});Object.defineProperty(exports,"accentPalette",{enumerable:!0,get:()=>v.accentPalette});exports.ElementEditor=F;
|
package/dist/leaflet.es.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useState as T, useId as H, useEffect as h, memo as q, useMemo as A, use
|
|
|
4
4
|
import { useMap as U, MapContainer as D, TileLayer as R } from "react-leaflet";
|
|
5
5
|
import { useUIStore as z, useElementEditorConfig as Y, BasemapPicker as L } from "@element-editor/ui";
|
|
6
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-
|
|
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-EEM8j7r8.js";
|
|
8
8
|
import { ElementEditorControls as re } from "@element-editor/adapter-leaflet";
|
|
9
9
|
import { createPortal as se } from "react-dom";
|
|
10
10
|
import F from "leaflet";
|
package/dist/shared.d.cts
CHANGED
|
@@ -6,8 +6,8 @@ export type { MutationOptions, SetFeatureCollectionOptions, ValidationReport } f
|
|
|
6
6
|
export { ElementEditorError } from '@element-editor/core';
|
|
7
7
|
export { IconButton, Tooltip } from '@element-editor/ui';
|
|
8
8
|
export { accentPalette, DEFAULT_ACCENT, ACCENT_STEPS } from '@element-editor/core';
|
|
9
|
-
export type { AccentShade } from '@element-editor/core';
|
|
9
|
+
export type { AccentShade, GeometryType } from '@element-editor/core';
|
|
10
10
|
export type { FeatureStyle } from '@element-editor/core';
|
|
11
11
|
export type { ElementEditorBaseProps } from './shell/types.cjs';
|
|
12
12
|
export type { InitialView } from './shell/savedView.cjs';
|
|
13
|
-
export type { BBox, BoundsInput, FlyToOptions } from '@element-editor/core';
|
|
13
|
+
export type { BBox, BoundsInput, CoordinateOptions, FlyToOptions } from '@element-editor/core';
|
package/dist/shared.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export type { MutationOptions, SetFeatureCollectionOptions, ValidationReport } f
|
|
|
6
6
|
export { ElementEditorError } from '@element-editor/core';
|
|
7
7
|
export { IconButton, Tooltip } from '@element-editor/ui';
|
|
8
8
|
export { accentPalette, DEFAULT_ACCENT, ACCENT_STEPS } from '@element-editor/core';
|
|
9
|
-
export type { AccentShade } from '@element-editor/core';
|
|
9
|
+
export type { AccentShade, GeometryType } from '@element-editor/core';
|
|
10
10
|
export type { FeatureStyle } from '@element-editor/core';
|
|
11
11
|
export type { ElementEditorBaseProps } from './shell/types.js';
|
|
12
12
|
export type { InitialView } from './shell/savedView.js';
|
|
13
|
-
export type { BBox, BoundsInput, FlyToOptions } from '@element-editor/core';
|
|
13
|
+
export type { BBox, BoundsInput, CoordinateOptions, FlyToOptions } from '@element-editor/core';
|
package/dist/shell/types.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { FeatureCollection, FeatureCollectionInput, Schema, GeoJSONFeature, GeoJSONFeatureInput } from '../types/geojson.cjs';
|
|
3
|
-
import { BoundsInput } from '@element-editor/core';
|
|
3
|
+
import { BoundsInput, CoordinateOptions, GeometryType } from '@element-editor/core';
|
|
4
4
|
import { InitialView } from './savedView.cjs';
|
|
5
5
|
import { ElementEditorEvent, ElementEditorErrorHandler, ElementEditorConfig, DrawTool } from '@element-editor/ui';
|
|
6
6
|
export interface ElementEditorBaseProps {
|
|
@@ -64,6 +64,43 @@ export interface ElementEditorBaseProps {
|
|
|
64
64
|
* @default undefined (no limit; imports are still capped at 50,000 features)
|
|
65
65
|
*/
|
|
66
66
|
maxFeatures?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Geometry types the editor accepts, as GeoJSON type names; omit to allow all. Enforced for every
|
|
69
|
+
* way a geometry gets in (drawing, paste, import, `initialData`, merge, break apart, boolean ops,
|
|
70
|
+
* buffer, the ref API, ...): a refusal changes nothing and reports an `error` event, `code:
|
|
71
|
+
* 'geometry-type-not-allowed'`. Drawing tools that can't draw an allowed type are left out, and
|
|
72
|
+
* menu actions whose result would be refused are hidden. Works with `tools` and `maxFeatures`.
|
|
73
|
+
*
|
|
74
|
+
* @default undefined (every type)
|
|
75
|
+
* @example geometryTypes={['Polygon', 'MultiPolygon']}
|
|
76
|
+
*/
|
|
77
|
+
geometryTypes?: GeometryType[];
|
|
78
|
+
/**
|
|
79
|
+
* With `maxFeatures={1}`: a draw tool (point, line, area, rectangle, circle, freehand, route, picker)
|
|
80
|
+
* replaces the only feature's geometry instead of being refused, keeping its `id`, properties, schema
|
|
81
|
+
* and group. One undo step, one `onFeatureUpdate`. Tools stay available at the limit. Paste, duplicate,
|
|
82
|
+
* import merge and the ref's `addFeature` still refuse. Ignored (with a dev warning) for any other
|
|
83
|
+
* `maxFeatures`. For a "pick the location" field: `tools={['point']} maxFeatures={1} replaceAtLimit`.
|
|
84
|
+
*
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
replaceAtLimit?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Opt-in clean-up of every committed coordinate (drawing, vertex edits, transforms, import, paste,
|
|
90
|
+
* undo/redo, `initialData`, ref methods), so the store, `onChange` and undo history hold the same
|
|
91
|
+
* values. Both parts are off unless set:
|
|
92
|
+
* - `wrap: true` shifts a feature as a whole by a multiple of 360 degrees so the centre of its
|
|
93
|
+
* longitude range lies in [-180, 180] (RFC 7946 positions). Vertices stay continuous, so a shape
|
|
94
|
+
* crossing the antimeridian keeps its outline; one side may then lie beyond +-180. Latitudes
|
|
95
|
+
* beyond +-90 are clamped; others are left alone.
|
|
96
|
+
* - `precision: n` rounds x and y to `n` decimals (integer 0 to 15; 6 is about 0.1 m). Altitude is kept
|
|
97
|
+
* untouched. Consecutive duplicate vertices created by rounding are dropped when the shape stays valid.
|
|
98
|
+
*
|
|
99
|
+
* Unrelated to `config.units.precision`, which only formats what is displayed.
|
|
100
|
+
*
|
|
101
|
+
* @default undefined (coordinates are stored as the map reports them)
|
|
102
|
+
*/
|
|
103
|
+
coordinates?: CoordinateOptions;
|
|
67
104
|
/**
|
|
68
105
|
* Restricts panning to this box: the user can't drag the map outside it. The map starts fitted
|
|
69
106
|
* to it only when nothing else gives a start view (see `initialView`). A GeoJSON bbox `[west, south, east, north]`
|
|
@@ -189,6 +226,12 @@ export interface ElementEditorBaseProps {
|
|
|
189
226
|
* changed it.
|
|
190
227
|
*/
|
|
191
228
|
onToolChange?: (tool: DrawTool | null) => void;
|
|
229
|
+
/**
|
|
230
|
+
* Called with the id of the feature that entered point editing (vertex edit, as
|
|
231
|
+
* `ref.getVertexEdit()` reports it), or `null` when point editing ended, whether the user
|
|
232
|
+
* (double-click, Enter, Esc, a click away, delete, undo) or your app (`ref.setVertexEdit`) changed it.
|
|
233
|
+
*/
|
|
234
|
+
onVertexEditChange?: (id: string | null) => void;
|
|
192
235
|
/**
|
|
193
236
|
* Receives every message the editor would show the user (errors, warnings, confirmations,
|
|
194
237
|
* `feature:deleted` with an `undo`, …). With it set, the editor shows no toasts: your app
|
package/dist/shell/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { FeatureCollection, FeatureCollectionInput, Schema, GeoJSONFeature, GeoJSONFeatureInput } from '../types/geojson.js';
|
|
3
|
-
import { BoundsInput } from '@element-editor/core';
|
|
3
|
+
import { BoundsInput, CoordinateOptions, GeometryType } from '@element-editor/core';
|
|
4
4
|
import { InitialView } from './savedView.js';
|
|
5
5
|
import { ElementEditorEvent, ElementEditorErrorHandler, ElementEditorConfig, DrawTool } from '@element-editor/ui';
|
|
6
6
|
export interface ElementEditorBaseProps {
|
|
@@ -64,6 +64,43 @@ export interface ElementEditorBaseProps {
|
|
|
64
64
|
* @default undefined (no limit; imports are still capped at 50,000 features)
|
|
65
65
|
*/
|
|
66
66
|
maxFeatures?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Geometry types the editor accepts, as GeoJSON type names; omit to allow all. Enforced for every
|
|
69
|
+
* way a geometry gets in (drawing, paste, import, `initialData`, merge, break apart, boolean ops,
|
|
70
|
+
* buffer, the ref API, ...): a refusal changes nothing and reports an `error` event, `code:
|
|
71
|
+
* 'geometry-type-not-allowed'`. Drawing tools that can't draw an allowed type are left out, and
|
|
72
|
+
* menu actions whose result would be refused are hidden. Works with `tools` and `maxFeatures`.
|
|
73
|
+
*
|
|
74
|
+
* @default undefined (every type)
|
|
75
|
+
* @example geometryTypes={['Polygon', 'MultiPolygon']}
|
|
76
|
+
*/
|
|
77
|
+
geometryTypes?: GeometryType[];
|
|
78
|
+
/**
|
|
79
|
+
* With `maxFeatures={1}`: a draw tool (point, line, area, rectangle, circle, freehand, route, picker)
|
|
80
|
+
* replaces the only feature's geometry instead of being refused, keeping its `id`, properties, schema
|
|
81
|
+
* and group. One undo step, one `onFeatureUpdate`. Tools stay available at the limit. Paste, duplicate,
|
|
82
|
+
* import merge and the ref's `addFeature` still refuse. Ignored (with a dev warning) for any other
|
|
83
|
+
* `maxFeatures`. For a "pick the location" field: `tools={['point']} maxFeatures={1} replaceAtLimit`.
|
|
84
|
+
*
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
replaceAtLimit?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Opt-in clean-up of every committed coordinate (drawing, vertex edits, transforms, import, paste,
|
|
90
|
+
* undo/redo, `initialData`, ref methods), so the store, `onChange` and undo history hold the same
|
|
91
|
+
* values. Both parts are off unless set:
|
|
92
|
+
* - `wrap: true` shifts a feature as a whole by a multiple of 360 degrees so the centre of its
|
|
93
|
+
* longitude range lies in [-180, 180] (RFC 7946 positions). Vertices stay continuous, so a shape
|
|
94
|
+
* crossing the antimeridian keeps its outline; one side may then lie beyond +-180. Latitudes
|
|
95
|
+
* beyond +-90 are clamped; others are left alone.
|
|
96
|
+
* - `precision: n` rounds x and y to `n` decimals (integer 0 to 15; 6 is about 0.1 m). Altitude is kept
|
|
97
|
+
* untouched. Consecutive duplicate vertices created by rounding are dropped when the shape stays valid.
|
|
98
|
+
*
|
|
99
|
+
* Unrelated to `config.units.precision`, which only formats what is displayed.
|
|
100
|
+
*
|
|
101
|
+
* @default undefined (coordinates are stored as the map reports them)
|
|
102
|
+
*/
|
|
103
|
+
coordinates?: CoordinateOptions;
|
|
67
104
|
/**
|
|
68
105
|
* Restricts panning to this box: the user can't drag the map outside it. The map starts fitted
|
|
69
106
|
* to it only when nothing else gives a start view (see `initialView`). A GeoJSON bbox `[west, south, east, north]`
|
|
@@ -189,6 +226,12 @@ export interface ElementEditorBaseProps {
|
|
|
189
226
|
* changed it.
|
|
190
227
|
*/
|
|
191
228
|
onToolChange?: (tool: DrawTool | null) => void;
|
|
229
|
+
/**
|
|
230
|
+
* Called with the id of the feature that entered point editing (vertex edit, as
|
|
231
|
+
* `ref.getVertexEdit()` reports it), or `null` when point editing ended, whether the user
|
|
232
|
+
* (double-click, Enter, Esc, a click away, delete, undo) or your app (`ref.setVertexEdit`) changed it.
|
|
233
|
+
*/
|
|
234
|
+
onVertexEditChange?: (id: string | null) => void;
|
|
192
235
|
/**
|
|
193
236
|
* Receives every message the editor would show the user (errors, warnings, confirmations,
|
|
194
237
|
* `feature:deleted` with an `undo`, …). With it set, the editor shows no toasts: your app
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),l=require("react"),n=require("@element-editor/ui"),$=require("@element-editor/ui/internal"),W=require("@element-editor/core"),L=require("@element-editor/core/internal"),U=require("@phosphor-icons/react"),Le="elm_mapView",Pe=1,lt={center:[10,48],zoom:5},it=40,ct=16;function Ae(o){try{const r=W.readPersisted(Le,Pe,e=>{if(!e||typeof e!="object")return null;const s=e;return typeof s.lat=="number"&&typeof s.lng=="number"&&typeof s.zoom=="number"?{lat:s.lat,lng:s.lng,zoom:s.zoom}:null},o);if(r)return{center:[r.lng,r.lat],zoom:r.zoom}}catch{}return null}function ut(o,r,e,s){W.writePersisted(Le,Pe,{lat:o,lng:r,zoom:e},s)}const Te=(...o)=>o.every(r=>typeof r=="number"&&Number.isFinite(r));function Ne(o){if(!o)return null;try{const r=o,e=r.type==="Feature"?{type:"FeatureCollection",features:[r]}:r;return W.getFeatureCollectionBBox(e)}catch{return null}}function dt(o,r){if(o==="data")return(e=>e?{bounds:e}:null)(Ne(r));if(o&&typeof o=="object"){if("bounds"in o){const e=o.bounds;if(Array.isArray(e)&&e.length===4&&Te(...e))return{bounds:[e[0],e[1],e[2],e[3]]}}else if("center"in o){const e=o.center;if(Array.isArray(e)&&e.length===2&&Te(e[0],e[1],o.zoom))return{center:[e[0],e[1]],zoom:o.zoom}}}return L.warnOnce("initialView-invalid",`initialView=${JSON.stringify(o)} is not { center: [lng, lat], zoom }, { bounds: [west, south, east, north] } or 'data'; it was ignored.`),null}function ft({initialView:o,initialData:r,bounds:e},s){const a=o===void 0?null:dt(o,r);if(a)return a;const c=Ae(s);if(c)return c;const p=o==="data"?null:Ne(r);if(p)return{bounds:p};const u=L.normalizeBounds(e);return u?{bounds:u}:lt}function mt(o,r,e){if(!o||typeof o!="object")return{};const s={};for(const[a,c]of Object.entries(o))a in r?c!==void 0&&L.warnOnce(`mapOptions-${e}-${a}`,`<ElementEditor mapOptions.${a}> is set by Element and was ignored. ${r[a]}`):s[a]=c;return s}const pt="--elm-row-hover",ht=1500;function gt(o,r){l.useEffect(()=>{if(!L.isDevBuild())return;const e=o.current;if(!e||typeof getComputedStyle!="function")return;const s=r==="leaflet"?"@element-editor/react/leaflet/style.css":"@element-editor/react/style.css",a=requestAnimationFrame(()=>{if(!e.isConnected||e.getClientRects().length===0)return;const{width:p,height:u}=e.getBoundingClientRect();(u===0||p===0)&&L.warnOnce("editor-zero-size",`<ElementEditor> is ${Math.round(p)}×${Math.round(u)} px, so the map is blank. It fills its parent element (width and height 100%): give the parent an explicit size, e.g. <div style={{ height: 600 }}><ElementEditor /></div>, or a flex / grid layout that gives it one (a parent with only \`height: auto\` collapses to 0).`)}),c=setTimeout(()=>{e.isConnected&&getComputedStyle(e).getPropertyValue(pt).trim()===""&&L.warnOnce("editor-css-missing",`Element's stylesheet is not loaded, so the toolbar and panels are unstyled. Import it once, near your app's entry point: import '${s}'`)},ht);return()=>{cancelAnimationFrame(a),clearTimeout(c)}},[o,r])}function xt(o){const r=n.useElementEditorConfig(),{uiStore:e}=n.useGeoStore(),s=n.useUIStore(u=>u.userTheme),a=l.useRef(!1);a.current||(a.current=!0,o===void 0&&r.mode!=="system"&&(W.readStorage("elm_theme",r)||e.setState({userTheme:r.mode}))),l.useLayoutEffect(()=>{o!==void 0&&e.setState({userTheme:o==="auto"?"system":o})},[o,e]);const[c,p]=l.useState(()=>typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches);return l.useEffect(()=>{if(s!=="system")return;const u=window.matchMedia("(prefers-color-scheme: dark)"),x=f=>p(f.matches);return u.addEventListener("change",x),()=>u.removeEventListener("change",x)},[s]),s==="dark"?"dark":s==="light"?"light":c?"dark":"light"}function bt(o,r){const e=l.useRef(null),s=l.useRef(null),a=l.useRef(null),c=l.useRef(null),p=l.useRef(null),u=l.useRef(null),x=l.useRef(null),f=l.useRef(null),d=l.useRef(null),w=l.useRef(null),b=l.useRef(null);return l.useLayoutEffect(()=>{const S=e.current;if(!S||o)return;const R=()=>parseFloat(S.style.getPropertyValue("--elm-panel-offset"))||0,j=i=>i&&i.offsetWidth>0?i.getBoundingClientRect():null,q=i=>i.flatMap(h=>getComputedStyle(h).display==="contents"?q([...h.children]):[h.offsetWidth]),ie=i=>{const h=q([...i.children]).filter(y=>y>0);return h.length?getComputedStyle(i).flexDirection.startsWith("column")?Math.max(...h):h.reduce((y,v)=>y+v,0)+8*(h.length-1):0},J=(i,h,y)=>{var I;if(!i)return!0;const v=(((I=i.parentElement)==null?void 0:I.clientWidth)??0)-32-R(),O=`${Math.max(0,Math.floor(v))}px`;i.style.getPropertyValue("--elm-row-room")!==O&&i.style.setProperty("--elm-row-room",O);const E=[...i.children].reduce((C,_)=>C+ie(_),16)+h>v+.5,g=E&&h?`${h}px`:"";return i.dataset.elmClearance=String(h),i.hasAttribute("data-elm-wrap")===E&&i.style.paddingRight===g?!0:y?!1:(i.toggleAttribute("data-elm-wrap",E),i.style.paddingRight=g,!0)};let D=0;const F=(i=!1)=>{if(!(J(s.current,r,i)&&J(a.current,0,i))){D||(D=requestAnimationFrame(()=>{D=0,F()}));return}const y=j(x.current),v=j(a.current),O=j(c.current),T=j(p.current),E=j(u.current),g=C=>!!(y&&C&&y.left<C.right+8&&C.left<y.right+8);let I=T?T.height+8:0;v&&(g(O)||g(E))&&(I=Math.max(I,v.height+8)),S.style.setProperty("--elm-bottom-row-height",`${I}px`),X(w.current,"--elm-left-center-shift"),X(b.current,"--elm-right-center-shift")},H={},X=(i,h)=>{const y=H[h]??0,v=j(i);let O=0;if(v){const T=v.top-y;let E=-1/0,g=1/0;for(const C of[s.current,a.current])for(const _ of(C==null?void 0:C.children)??[]){const k=j(_);!k||k.height===0||k.right+8<=v.left||v.right+8<=k.left||(C===s.current?E=Math.max(E,k.bottom+8):g=Math.min(g,k.top-8))}O=(T<E?E:T+v.height>g?Math.max(E,g-v.height):T)-T}O!==y&&(H[h]=O,S.style.setProperty(h,`${O}px`))},z=new ResizeObserver(()=>F(!0));for(const i of[s,a,c,p,u,x,f,d,w,b])i.current&&z.observe(i.current);for(const i of[s.current,a.current])for(const h of(i==null?void 0:i.children)??[]){z.observe(h);for(const y of h.querySelectorAll(":scope > *, :scope > .contents > *"))z.observe(y)}const Z=i=>{var h,y;(i.target===S||(y=(h=i.target).matches)!=null&&y.call(h,"[data-elm-slot], [data-elm-edge]"))&&F()};S.addEventListener("transitionend",Z);let Y=R();const Q=new MutationObserver(()=>{R()!==Y&&(Y=R(),F())});return Q.observe(S,{attributes:!0,attributeFilter:["style"]}),F(),()=>{cancelAnimationFrame(D),z.disconnect(),Q.disconnect(),S.removeEventListener("transitionend",Z);for(const i of["--elm-bottom-row-height","--elm-left-center-shift","--elm-right-center-shift"])S.style.setProperty(i,"0px")}},[o,r]),{rootRef:e,topRowRef:s,bottomRowRef:a,bottomLeftRef:c,bottomCenterRef:p,bottomRightRef:u,contextualRef:x,leftEdgeRef:f,rightEdgeRef:d,leftCenterRef:w,rightCenterRef:b}}function yt({size:o,tooltipSide:r}){const e=n.useUIStore(u=>u.shortcutsModalOpen),s=n.useUIStore(u=>u.openShortcutsModal),a=n.useUIStore(u=>u.closeShortcutsModal),{getKey:c}=n.useShortcutConfig(),p=c("show-shortcuts").toUpperCase();return t.jsx(n.IconButton,{label:"Show keyboard shortcuts",shortcutId:"show-shortcuts",tooltipContent:"Keyboard shortcuts",shortcut:t.jsx(n.KbdDark,{children:p}),onClick:e?a:s,active:e,size:o,tooltipSide:r,children:t.jsx(U.Keyboard,{size:24})})}function vt({size:o,side:r}){const e=n.useUIStore(c=>c.tableOpen),s=n.useUIStore(c=>c.toggleTable),{getKey:a}=n.useShortcutConfig();return t.jsx(n.IconButton,{size:o,tooltipSide:r,label:e?"Hide table":"Show table",shortcutId:"toggle-table",shortcut:t.jsx(n.KbdDark,{children:a("toggle-table").toUpperCase()}),onClick:s,active:e,children:t.jsx(U.Table,{size:24})})}function St({size:o,side:r}){const e=n.useUIStore(c=>c.schemaModalOpen),s=n.useUIStore(c=>c.toggleSchemaModal),{getKey:a}=n.useShortcutConfig();return t.jsx(n.IconButton,{size:o,tooltipSide:r,label:"Edit schema",shortcutId:"toggle-schema",shortcut:t.jsx(n.KbdDark,{children:a("toggle-schema").toUpperCase()}),onClick:s,active:e,children:t.jsx(U.TreeStructure,{size:24})})}function jt({size:o,side:r}){const e=n.useUIStore(c=>c.codeModalOpen),s=n.useUIStore(c=>c.toggleCodeModal),{getKey:a}=n.useShortcutConfig();return t.jsx(n.IconButton,{size:o,tooltipSide:r,label:"Show GeoJSON",shortcutId:"toggle-geojson",shortcut:t.jsx(n.KbdDark,{children:a("toggle-geojson").toUpperCase()}),onClick:s,active:e,children:t.jsx(U.Code,{size:24})})}function Ct({size:o,side:r}){const e=n.useUIStore(a=>a.settingsModalOpen),s=n.useUIStore(a=>a.setSettingsModalOpen);return t.jsx(n.IconButton,{size:o,tooltipSide:r,label:"Editor settings",onClick:()=>s(!e),active:e,children:t.jsx(U.SlidersHorizontal,{size:24})})}function wt({id:o,size:r,side:e,onSubmit:s,basemapControl:a,attributionRef:c}){switch(o){case"toolbar":return t.jsx(n.FloatingToolbar,{embedded:!0});case"undo":return t.jsx(n.UndoButton,{size:r,tooltipSide:e});case"redo":return t.jsx(n.RedoButton,{size:r,tooltipSide:e});case"fitBounds":return t.jsx(n.FitBoundsButton,{size:r,tooltipSide:e});case"locate":return t.jsx(n.LocateButton,{size:r,tooltipSide:e});case"zoomIndicator":return t.jsx(n.ZoomIndicator,{size:r,tooltipSide:e});case"table":return t.jsx(vt,{size:r,side:e});case"schema":return t.jsx(St,{size:r,side:e});case"geojson":return t.jsx(jt,{size:r,side:e});case"settings":return t.jsx(Ct,{size:r,side:e});case"keyboard":return t.jsx(yt,{size:r,tooltipSide:e});case"applyChanges":return t.jsxs(n.Button,{variant:"primary",onClick:s,className:r==="group"?"h-8 !rounded-elm-control !px-3 gap-1.5 !text-sm":"h-12 !rounded-elm shadow-elm-control !px-5 gap-2 !text-sm",children:[t.jsx(U.Check,{size:20,weight:"bold"}),"Apply changes"]});case"attribution":return t.jsx("span",{ref:c,"data-elm-attribution":"",onMouseEnter:p=>{var u;p.currentTarget.title=((u=p.currentTarget.textContent)==null?void 0:u.trim())??""}});case"basemap":return l.isValidElement(a)?l.cloneElement(a,{size:r,tooltipSide:e}):null;default:return null}}function Et(){const o=n.useElementEditorConfig();return t.jsxs("div",{className:"absolute bottom-0 left-0 w-full h-1/3 bg-elm-surface border-t border-elm-border z-[400] flex shadow-[0_-8px_12px_-8px_rgb(0_0_0/0.12)]",children:[o.ui.dataTable&&t.jsx("div",{className:"flex-1 h-full relative overflow-hidden border-r border-elm-border",children:t.jsx(l.Suspense,{fallback:null,children:t.jsx(n.DataTablePanel,{embedded:!0})})}),o.ui.layerList&&t.jsx("div",{className:"w-[320px] flex-shrink-0 h-full relative overflow-hidden bg-elm-surface",children:t.jsx(n.LayersPanel,{})})]})}function Rt({layout:o}){const r=n.useElementEditorConfig(),e=n.useUIStore(d=>d.dialogState),s=n.useUIStore(d=>d.schemaModalOpen),a=n.useUIStore(d=>d.toggleSchemaModal),c=n.useUIStore(d=>d.readonly),p=n.useUIStore(d=>d.codeModalOpen),u=n.useUIStore(d=>d.toggleCodeModal),x=n.useUIStore(d=>d.settingsModalOpen),f=n.useUIStore(d=>d.shortcutsModalOpen);return t.jsxs(t.Fragment,{children:[o==="minimal"&&e.type!=="closed"&&t.jsx(l.Suspense,{fallback:null,children:t.jsx(n.FeatureEditModal,{dialogState:e})}),r.ui.dataTable&&o!=="split"&&t.jsx(l.Suspense,{fallback:null,children:t.jsx(n.DataTablePanel,{})}),r.ui.keyboardShortcuts.show&&f&&t.jsx(l.Suspense,{fallback:null,children:t.jsx(n.ShortcutsModal,{})}),r.ui.settings&&x&&t.jsx(l.Suspense,{fallback:null,children:t.jsx(n.SettingsModal,{})}),r.ui.schemaEditor&&s&&!c&&t.jsx(l.Suspense,{fallback:null,children:t.jsx(n.SchemaModal,{onClose:a})}),r.ui.geojsonEditor&&p&&t.jsx(l.Suspense,{fallback:t.jsx(n.GeoJSONDockPlaceholder,{}),children:t.jsx(n.GeoJSONModal,{onClose:u})})]})}const le=o=>{var r,e,s,a;return!((e=(r=o.dataTransfer)==null?void 0:r.types)!=null&&e.includes("Files"))||!!((a=(s=o.target).closest)!=null&&a.call(s,".cm-editor"))};function kt(o){const r=$.useGeoJSONFileImport(),[e,s]=l.useState(!1),a=l.useRef(0),c=l.useCallback(f=>{!o||le(f)||(f.preventDefault(),f.stopPropagation(),a.current+=1,s(!0))},[o]),p=l.useCallback(f=>{!o||le(f)||(f.preventDefault(),f.stopPropagation(),f.dataTransfer.dropEffect="copy")},[o]),u=l.useCallback(f=>{!o||le(f)||(f.stopPropagation(),a.current=Math.max(0,a.current-1),a.current===0&&s(!1))},[o]),x=l.useCallback(f=>{var w;if(a.current=0,s(!1),!o||le(f))return;f.preventDefault(),f.stopPropagation();const d=(w=f.dataTransfer.files)==null?void 0:w[0];d&&r(d)},[o,r]);return{active:o&&e,handlers:{onDragEnter:c,onDragOver:p,onDragLeave:u,onDrop:x}}}function Ot({enabled:o,children:r,footer:e}){const s=kt(o);return t.jsxs("div",{style:{display:"contents"},...s.handlers,children:[t.jsxs("div",{className:"relative flex-1 min-h-0 flex",children:[r,s.active&&t.jsx("div",{"data-elm-file-drop":"",className:"absolute inset-0 z-[1000] flex items-center justify-center pointer-events-none bg-gray-900/10 dark:bg-black/30 border-2 border-dashed border-primary-500 rounded-sm",children:t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm rounded-elm text-sm text-(--elm-text-secondary,var(--color-gray-700)) dark:text-(--elm-text-secondary,var(--color-gray-200)) antialiased select-none",children:[t.jsx(U.FileArrowUp,{size:20,className:"text-elm-text-muted"}),t.jsx("span",{children:"Drop GeoJSON to import"})]})})]}),e]})}const xe="in-data-[elm-wrap]:flex-wrap in-data-[elm-wrap]:max-w-full",be="in-data-[elm-wrap]:flex-wrap-reverse in-data-[elm-wrap]:max-w-full",It={topLeft:[`flex-row items-start ${xe}`,"flex-col items-start"],topCenter:[`flex-row items-start justify-center ${xe}`,"flex-col items-center"],topRight:[`flex-row-reverse items-start ${xe}`,"flex-col items-end"],leftCenter:["flex-row items-center","flex-col items-start"],rightCenter:["flex-row-reverse items-center","flex-col items-end"],bottomLeft:[`flex-row items-end ${be}`,"flex-col-reverse items-start"],bottomCenter:[`flex-row items-end justify-center ${be}`,"flex-col-reverse items-center"],bottomRight:[`flex-row-reverse items-end ${be}`,"flex-col-reverse items-end"]},Mt=l.forwardRef(({initialData:o,initialView:r,schema:e,tools:s,maxFeatures:a,geometryTypes:c,replaceAtLimit:p,coordinates:u,bounds:x,readonly:f=!1,layout:d="panel",className:w="",style:b,theme:S,onChange:R,onSubmit:j,onValidationError:q,onFeatureSelect:ie,onZoomChange:J,onEvent:D,onError:F,onFeatureAdd:H,onFeatureUpdate:X,onFeatureDelete:z,onSelectionChange:Z,onToolChange:Y,onVertexEditChange:Q,slots:i,renderMap:h,basemapControl:y,extraApi:v,fileDrop:O=!0,engine:T="maplibre"},E)=>{const g=n.useElementEditorConfig(),{dataStore:I,uiStore:C}=n.useGeoStore(),_=n.useMapController(),k=s||(g.tools==="all"?null:g.tools),[ye]=l.useState(()=>r==="data"||r===void 0&&!Ae(g)),[ce,ve]=l.useState(null),Fe=l.useCallback((m,B)=>{if(!B||!ye)return;const M=W.getFeatureCollectionBBox({type:"FeatureCollection",metadata:{schemas:[],groups:[]},features:I.getState().features});M&&ve(M)},[ye,I]);l.useEffect(()=>{!ce||!_.fitBounds||(_.fitBounds(ce),ve(null))},[ce,_]);const ee=n.useAdapterControls({initialData:o,schema:e,layout:d,readonly:f,tools:k,maxFeatures:a,geometryTypes:c,replaceAtLimit:p,coordinates:u,onChange:R,onSubmit:j,onValidationError:q,onFeatureAdd:H,onFeatureUpdate:X,onFeatureDelete:z,onSelectionChange:Z,onFeatureSelect:ie,onZoomChange:J,onToolChange:Y,onVertexEditChange:Q,onInitialDataApplied:Fe}),ue=l.useMemo(()=>v?{...ee,...v}:ee,[ee,v]);l.useImperativeHandle(E,()=>ue,[ue]),l.useEffect(()=>{},[I,C,ue]),l.useLayoutEffect(()=>{C.getState().setBounds(x)},[x,C]);const P=n.useUIStore(m=>m.tableFullscreen),_e=n.useUIStore(m=>m.sidebarOpen),de=S!==null&&typeof S=="object";l.useEffect(()=>{de&&L.warnOnce("theme-object","<ElementEditor theme> takes only 'light' | 'dark' | 'auto'; the object is ignored. Set CSS variables with `style` (e.g. style={{ '--elm-accent': '#7c3aed' }}) or the brand colour with `accentColor`.")},[de]);const fe=xt(de?void 0:S),Ue={...g.accentColor?{"--elm-accent":g.accentColor}:{},"--elm-bottom-stack-offset":d==="split"?"calc(33.33% + 16px + var(--elm-bottom-row-height, 0px))":"calc(var(--elm-table-offset, 0px) + var(--elm-bottom-row-height, 0px) + 16px)",...b},Se=b?Object.entries(b).filter(([m,B])=>m.startsWith("--")&&B!=null&&B!==""):[],me=Se.length?JSON.stringify(Se):"",De=l.useMemo(()=>me?Object.fromEntries(JSON.parse(me)):void 0,[me]),ze=m=>$.isControlVisible(m,g.ui,{readonly:f,canSubmit:!!j,hasBasemaps:!!y}),te=m=>$.visibleLayoutEntries(g.ui.layout[m].items,ze),je=g.ui.keyboardShortcuts.enabled,Ve=(k==null?void 0:k.join())??null;l.useEffect(()=>{for(const m of $.layoutGaps(g.ui.layout,{readonly:f,canSubmit:!!j,tools:k,shortcuts:je}))L.warnOnce(`layoutGap:${m}`,`config.ui.layout: ${m}.`)},[g.ui.layout,f,!!j,Ve,je]);const[Ce,Ke]=l.useState(null),[Ge,We]=l.useState(null),we=(m,B,M)=>t.jsx(wt,{id:m,size:B,side:M,onSubmit:ee.submit,basemapControl:y,attributionRef:Ke},m),pe=(m,B)=>{const M=m==="statusLeft"||m==="statusRight",V=g.ui.layout[m].direction==="vertical",se=V?m.endsWith("Right")||m==="rightCenter"?"left":"right":m.startsWith("top")?"bottom":"top",K=A=>t.jsx("div",{"aria-hidden":!0,"data-elm-separator":"",className:`flex-shrink-0 bg-elm-border ${M?"w-px h-4 mx-1":V?"h-px w-5 my-0.5":"w-px h-5 mx-1"}`},A);return B.map((A,G)=>{if(A==="separator")return K(`sep-${G}`);if(typeof A=="string")return we(A,M?"sm":"md",se);const ae=A.group.map((Me,at)=>Me==="separator"?K(`gsep-${at}`):we(Me,M?"sm":"group",se));return M?t.jsx("div",{"data-elm-group":"",className:"flex items-center",children:ae},`group-${G}`):t.jsx(n.ControlGroup,{direction:V?"vertical":"horizontal",children:ae},`group-${G}`)})},Ee=$.LAYOUT_SLOTS.find(m=>te(m).includes("toolbar")),N=(m,B,M,V,se)=>{const K=te(m),A=i==null?void 0:i[m],[G,ae]=It[m];return t.jsxs("div",{ref:V,"data-elm-slot":m,style:M,className:`flex ${g.ui.layout[m].direction==="vertical"?ae:G} gap-2 ${K.length||A?"pointer-events-auto":""} ${B}`,children:[se,A,pe(m,K)]})},oe=(...m)=>Ee&&m.includes(Ee)?"z-[500]":"z-[400]",Re=d==="panel"&&g.ui.layerList&&!_e?56:0,re="var(--elm-panel-offset, 0px)",he=d==="split"?"calc(33.33% + 16px)":"calc(var(--elm-table-offset, 0px) + 16px)",{rootRef:ne,topRowRef:qe,bottomRowRef:Je,bottomLeftRef:He,bottomCenterRef:Xe,bottomRightRef:Ze,contextualRef:Ye,leftEdgeRef:Qe,rightEdgeRef:et,leftCenterRef:tt,rightCenterRef:ot}=bt(P,Re);gt(ne,T);const[rt,nt]=l.useState(null);l.useLayoutEffect(()=>{nt(ne.current)},[ne]);const st=$.useRootTokens(rt),ke=te("statusLeft"),Oe=te("statusRight"),Ie=ke.length+Oe.length>0,ge=Ie&&!!Ce;return t.jsx(n.ThemeContext.Provider,{value:fe,children:t.jsx($.RootCssVarsContext.Provider,{value:De,children:t.jsx($.RootTokensContext.Provider,{value:st,children:t.jsx(n.EventProvider,{onEvent:D,onError:F,toaster:!0,children:t.jsx("div",{ref:ne,"data-elm-theme":fe,className:`relative w-full h-full overflow-clip bg-(--elm-surface-sunken,var(--color-gray-50)) dark:bg-(--elm-surface-sunken,var(--color-gray-950)) flex flex-col ${w}`,style:Ue,children:t.jsxs(Ot,{enabled:O&&!f,footer:Ie&&t.jsxs("div",{"data-elm-status-bar":"",role:"toolbar","aria-label":"Status bar",className:"flex-shrink-0 h-7 px-2 flex items-center justify-between gap-1 bg-elm-surface border-t border-elm-border z-[400]",children:[t.jsx("div",{"data-elm-slot":"statusLeft",className:"flex items-center gap-1 min-w-0",children:pe("statusLeft",ke)}),t.jsx("div",{"data-elm-slot":"statusRight",className:"flex items-center gap-1 min-w-0",children:pe("statusRight",Oe)})]}),children:[h({attributionTarget:ge?Ce:null,attributionCorner:ge?null:Ge,themeMode:fe}),!P&&(i==null?void 0:i.toolbar),!P&&(i==null?void 0:i.mapOverlay)&&t.jsx("div",{className:"absolute inset-0 z-[300] pointer-events-none",children:i.mapOverlay}),!P&&t.jsxs("div",{ref:qe,"data-elm-edge":"top",style:{top:16,left:16,right:`calc(${re} + 16px)`},className:`absolute ${oe("topLeft","topCenter","topRight")} transition-[right] duration-200 grid grid-cols-[1fr_auto_1fr] items-start gap-2 pointer-events-none data-[elm-wrap]:flex data-[elm-wrap]:flex-wrap`,children:[N("topLeft","justify-self-start"),N("topCenter","justify-self-center mx-auto"),N("topRight","justify-self-end ml-auto transition-[margin] duration-200 in-data-[elm-wrap]:mr-0!",{marginRight:Re})]}),!P&&t.jsx("div",{ref:Qe,"data-elm-edge":"left",style:{top:16,bottom:he,left:16},className:`absolute ${oe("leftCenter")} flex flex-col justify-center pointer-events-none`,children:N("leftCenter","relative",{top:"var(--elm-left-center-shift, 0px)"},tt)}),!P&&t.jsx("div",{ref:et,"data-elm-edge":"right",style:{top:16,bottom:he,right:`calc(${re} + 16px)`},className:`absolute ${oe("rightCenter")} flex flex-col justify-center pointer-events-none transition-[right] duration-200`,children:N("rightCenter","relative",{top:"var(--elm-right-center-shift, 0px)"},ot)}),!P&&t.jsxs("div",{ref:Je,"data-elm-edge":"bottom",style:{bottom:he,left:16,right:`calc(${re} + 16px)`},className:`absolute ${oe("bottomLeft","bottomCenter","bottomRight")} transition-[right] duration-200 grid grid-cols-[1fr_auto_1fr] items-end gap-2 pointer-events-none data-[elm-wrap]:flex data-[elm-wrap]:flex-wrap-reverse`,children:[N("bottomLeft","justify-self-start",void 0,He),N("bottomCenter","justify-self-center mx-auto",void 0,Xe),N("bottomRight","justify-self-end ml-auto max-w-full",void 0,Ze,!ge&&t.jsx("div",{ref:We,"data-elm-attribution-corner":"",className:"pointer-events-auto flex items-end justify-end w-max",style:{maxWidth:"var(--elm-row-room, 100%)"}}))]}),!P&&t.jsx("div",{className:"absolute z-[400] flex justify-center pointer-events-none transition-[right] duration-200",style:{bottom:"var(--elm-bottom-stack-offset)",left:16,right:`calc(${re} + 16px)`},children:t.jsxs("div",{ref:Ye,"data-elm-contextual":"",className:"flex flex-wrap justify-center gap-2 max-w-full min-w-0",children:[t.jsx(n.EditingToolbar,{}),t.jsx(n.ActiveDrawingToolbar,{}),t.jsx(n.SimplifyPanel,{}),t.jsx(n.SmoothPanel,{}),t.jsx(n.BufferPanel,{}),t.jsx(n.ReadonlyBanner,{})]})}),!P&&g.ui.layerList&&d==="panel"&&t.jsx(n.LayersPanel,{footer:i==null?void 0:i.panelFooter}),d==="split"&&t.jsx(Et,{}),t.jsx(Rt,{layout:d})]})})})})})})}),$e=l.forwardRef((o,r)=>{var d;const{config:e,accentColor:s,featureColor:a,routingApiKey:c,onError:p}=o;c!==void 0&&L.warnOnce("routingApiKey","The `routingApiKey` prop is deprecated: use `config.network.routing.apiKey`.");const u=(d=e==null?void 0:e.network)==null?void 0:d.routing,x=!!c&&u!==!1&&!(u!=null&&u.apiKey),f=l.useMemo(()=>s||a||x?{...e,...s&&{accentColor:s},...a&&{featureColor:a},...x&&{network:{...e==null?void 0:e.network,routing:{...u||{},apiKey:c}}}}:e,[e,s,a,x,u,c]);return t.jsx(n.ElementEditorErrorBoundary,{onError:p,children:t.jsx(n.ElementEditorConfigProvider,{config:f,children:t.jsx(n.GeoStoreProvider,{children:t.jsx(n.ShortcutConfigProvider,{children:t.jsx(n.MapControllerProvider,{children:t.jsx(Mt,{...o,ref:r})})})})})})});$e.displayName="ElementEditorShell";const Tt=5e3,Bt=".leaflet-control-attribution, .elm-attribution-toggle, .maplibregl-ctrl-attrib";function Lt(o,r,e=!0){const s=l.useRef(r);l.useLayoutEffect(()=>{s.current=r});const a=l.useRef(()=>{});return l.useEffect(()=>{if(!e||!o)return;let c=!1,p;const u=()=>{c=!0,clearTimeout(p),document.removeEventListener("visibilitychange",w);for(const b of Be)o.removeEventListener(b,f,!0)},x=()=>{c||(u(),s.current())},f=b=>{b.target instanceof Element&&b.target.closest(Bt)||x()},d=()=>{p||(p=setTimeout(x,Tt))};function w(){document.visibilityState==="visible"&&d()}for(const b of Be)o.addEventListener(b,f,{capture:!0,passive:!0});return document.visibilityState==="hidden"?document.addEventListener("visibilitychange",w):d(),a.current=u,()=>{u(),a.current=()=>{}}},[o,e]),l.useCallback(()=>a.current(),[])}const Be=["pointerdown","wheel","keydown"];function Pt(o,r,e,s,a){const c=o!==void 0;c&&a&&!e&&L.warnOnce("basemap-controlled","<ElementEditor basemap> is controlled: the picker can't change it without `onBasemapChange`. Pass `onBasemapChange` (and update `basemap` in it), or use `defaultBasemap` for a starting basemap the user can change.");const[p,u]=l.useState(()=>o!==void 0?o:r()),x=c?o:p,f=l.useRef({current:x,controlled:c,onChange:e,remember:s});f.current={current:x,controlled:c,onChange:e,remember:s};const d=l.useCallback((b,S)=>{var j;const R=f.current;R.controlled||(u(b),S&&R.remember(b)),(j=R.onChange)==null||j.call(R,b)},[]),w=l.useMemo(()=>({getBasemap:()=>f.current.current,setBasemap:b=>d(b,!1)}),[d]);return{current:x,pick:d,api:w}}exports.ElementEditorShell=$e;exports.FIT_MAX_ZOOM=ct;exports.FIT_PADDING=it;exports.pickMapOptions=mt;exports.resolveInitialView=ft;exports.saveView=ut;exports.useAttributionAutoCollapse=Lt;exports.useBasemapState=Pt;
|