@element-editor/ui 0.2.0 → 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 (35) hide show
  1. package/dist/{BooleanOperations-oF0WybQP.js → BooleanOperations-BRO7NHUY.js} +2 -2
  2. package/dist/{BooleanOperations-WXcmW9Vy.cjs → BooleanOperations-C2uOHRu3.cjs} +1 -1
  3. package/dist/{DataTable-CNfB01y2.cjs → DataTable-B-2VjBEz.cjs} +1 -1
  4. package/dist/{DataTable-DNmjUwka.js → DataTable-CS-3dIqY.js} +3 -3
  5. package/dist/{DataTablePanel-BknCxC1K.cjs → DataTablePanel-58LwzXQR.cjs} +1 -1
  6. package/dist/{DataTablePanel-rWdaQubk.js → DataTablePanel-DDFUmMaM.js} +2 -2
  7. package/dist/EditToolbarBtn-Ch9HCLHq.cjs +3 -0
  8. package/dist/{EditToolbarBtn-SZIsnIn3.js → EditToolbarBtn-SR4xHd8G.js} +39 -39
  9. package/dist/{FeatureEditModal-CM6BObUO.cjs → FeatureEditModal-Cc8N6vei.cjs} +1 -1
  10. package/dist/{FeatureEditModal-BF-fGhVD.js → FeatureEditModal-Dr10p3nE.js} +2 -2
  11. package/dist/{FeatureList-CQb2kTrV.js → FeatureList-Bo9w9nre.js} +2 -2
  12. package/dist/{FeatureList-Csr-anLA.cjs → FeatureList-VRYesXCq.cjs} +1 -1
  13. package/dist/{FeatureRowContextMenu-Gwq3OMEA.cjs → FeatureRowContextMenu-CtBqdC1j.cjs} +1 -1
  14. package/dist/{FeatureRowContextMenu-BLt7VlUU.js → FeatureRowContextMenu-DCUIiDwc.js} +2 -2
  15. package/dist/{GeoJSONModal-BPFWeaLZ.js → GeoJSONModal-BV9Tamf4.js} +3 -3
  16. package/dist/{GeoJSONModal-iwUcvrg7.cjs → GeoJSONModal-Dd-nBufy.cjs} +1 -1
  17. package/dist/{SchemaEditor-qkoYMg0C.cjs → SchemaEditor-B4L17K1e.cjs} +1 -1
  18. package/dist/{SchemaEditor-BEsKUe2p.js → SchemaEditor-ryoTgaLb.js} +1 -1
  19. package/dist/{SchemaModal-9nNrgorr.js → SchemaModal-DvMbWskS.js} +3 -3
  20. package/dist/{SchemaModal-GrtgA7cH.cjs → SchemaModal-gAuDkd-L.cjs} +1 -1
  21. package/dist/{SettingsModal-DTP0Xx_Z.js → SettingsModal-BScVTjpn.js} +2 -2
  22. package/dist/{SettingsModal-6_qmRyCi.cjs → SettingsModal-CqaSFxxR.cjs} +1 -1
  23. package/dist/{ShortcutsModal-CdyQlrqK.cjs → ShortcutsModal-D1Y2bGT8.cjs} +1 -1
  24. package/dist/{ShortcutsModal-DwxZu71W.js → ShortcutsModal-ozuS2Ysb.js} +3 -3
  25. package/dist/element-editor-ui.cjs +1 -1
  26. package/dist/element-editor-ui.es.js +2 -2
  27. package/dist/{index-CtZterPc.js → index-CILw1Du5.js} +273 -273
  28. package/dist/index-DG4wEjGj.cjs +1 -0
  29. package/dist/primitives.cjs +1 -1
  30. package/dist/primitives.es.js +1 -1
  31. package/dist/{useWindowFocus-DGAWA1au.js → useWindowFocus-DuQVjnHE.js} +1 -1
  32. package/dist/{useWindowFocus-D-_yEm_V.cjs → useWindowFocus-EemgNOuz.cjs} +1 -1
  33. package/package.json +2 -2
  34. package/dist/EditToolbarBtn-dpCmKnzk.cjs +0 -3
  35. package/dist/index-BKdDZ4Y9.cjs +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";var Jt=Object.defineProperty;var Wt=(e,n,t)=>n in e?Jt(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var ot=(e,n,t)=>Wt(e,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react/jsx-runtime"),k=require("react"),oe=require("./useAdapterControls-BBObhzVX.cjs"),ee=require("./index-BKdDZ4Y9.cjs"),Je=require("./useAccentStyle-hsGvyHZc.cjs"),We=require("@element-editor/core"),zt=require("react-dom"),le=require("@phosphor-icons/react"),Fe=require("./useWindowFocus-D-_yEm_V.cjs"),te=require("@codemirror/view"),D=require("@codemirror/state"),Ht=require("@codemirror/lang-json"),Bt=require("@codemirror/theme-one-dark"),Gt=require("codemirror"),rt=require("@codemirror/lint"),Ut=require("./useFocusTrap-BBjPCfDR.cjs"),Vt=require("./useJumpToFeature-LwjxGzfy.cjs"),we=require("./EditToolbarBtn-dpCmKnzk.cjs");function $t(e){const{_validation:n,...t}=e,o=JSON.stringify(t,null,2).split(`
1
+ "use strict";var Jt=Object.defineProperty;var Wt=(e,n,t)=>n in e?Jt(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var ot=(e,n,t)=>Wt(e,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react/jsx-runtime"),k=require("react"),oe=require("./useAdapterControls-BBObhzVX.cjs"),ee=require("./index-DG4wEjGj.cjs"),Je=require("./useAccentStyle-hsGvyHZc.cjs"),We=require("@element-editor/core"),zt=require("react-dom"),le=require("@phosphor-icons/react"),Fe=require("./useWindowFocus-EemgNOuz.cjs"),te=require("@codemirror/view"),D=require("@codemirror/state"),Ht=require("@codemirror/lang-json"),Bt=require("@codemirror/theme-one-dark"),Gt=require("codemirror"),rt=require("@codemirror/lint"),Ut=require("./useFocusTrap-BBjPCfDR.cjs"),Vt=require("./useJumpToFeature-LwjxGzfy.cjs"),we=require("./EditToolbarBtn-Ch9HCLHq.cjs");function $t(e){const{_validation:n,...t}=e,o=JSON.stringify(t,null,2).split(`
2
2
  `);for(let r=0;r<o.length;r++)o[r]=" "+o[r];return o}function Le(e,n,t){const o=JSON.stringify({type:"FeatureCollection",metadata:{schemas:e,groups:n},features:[]},null,2);return(t?o:o.slice(0,-3)).split(`
3
3
  `)}const Ct=[" ]","}"];function je(e,n,t=[]){for(let o=0;o<e.length;o++){const r=n(e[o]);for(let s=0;s<r.length;s++)t.push(r[s]);o<e.length-1&&(t[t.length-1]+=",")}return t}function st(e,n,t,o){const r=Le(n,t,e.length===0),s={features:e,counts:e.map(h=>o(h).length),headerLines:r.length,schemas:n,groups:t};if(!e.length)return{text:D.Text.of(r),map:s};const l=je(e,o,r);return l.push(...Ct),{text:D.Text.of(l),map:s}}function*Yt(e,n,t,o){if(yield Le(n,t,e.length===0),!!e.length){for(let r=0;r<e.length;r++){const s=o(e[r]);if(r===e.length-1){yield s;break}const l=s.slice();l[l.length-1]+=",",yield l}yield Ct}}function Kt(e,n,t,o){return{features:e,counts:e.map(r=>o(r).length),headerLines:Le(n,t,e.length===0).length,schemas:n,groups:t}}const Xt=(e,n)=>e===n||e.length===n.length&&e.every((t,o)=>t===n[o]);function pe(e){const n=new Array(e.counts.length);let t=e.headerLines+1;for(let o=0;o<e.counts.length;o++)n[o]=t,t+=e.counts[o];return n}function Zt(e,n){let t=e.headerLines+1;for(let o=0;o<e.counts.length;o++){if(n<t)return-1;if(n<t+e.counts[o])return o;t+=e.counts[o]}return-1}function Qt(e,n,t,o,r,s){const l=n.features;if(!l.length||!t.length)return null;const h=pe(n),v=c=>c===l.length-1,j=c=>e.line(h[c]).from,i=c=>e.line(h[c]+n.counts[c]-1).to-(v(c)?0:1),p=[];let T=n.headerLines;if(o!==n.schemas||r!==n.groups){const c=Le(o,r,!1);p.push({from:0,to:e.line(n.headerLines).to,insert:D.Text.of(c)}),T=c.length}let S=0;const B=Math.min(l.length,t.length);for(;S<B&&l[S]===t[S];)S++;let A=0;for(;A<B-S&&l[l.length-1-A]===t[t.length-1-A];)A++;const m=l.length-A,I=t.length-A,J=n.counts.slice(0,S);if(m-S===I-S)for(let c=S;c<m;c++){if(l[c]===t[c]||Xt(s(l[c]),s(t[c]))){J.push(n.counts[c]);continue}p.push({from:j(c),to:i(c),insert:D.Text.of(s(t[c]))}),J.push(s(t[c]).length)}else{const c=t.slice(S,I);for(const b of c)J.push(s(b).length);if(m>S&&c.length)p.push({from:j(S),to:i(m-1),insert:D.Text.of(je(c,s))});else if(m>S)S>0?p.push({from:i(S-1),to:i(m-1)}):p.push({from:j(0),to:j(m)});else{const b=je(c,s);S>0?p.push({from:i(S-1),insert:D.Text.of([",",...b])}):(b[b.length-1]+=",",b.push(""),p.push({from:j(0),insert:D.Text.of(b)}))}}for(let c=m;c<l.length;c++)J.push(n.counts[c]);return{changes:p,map:{features:t,counts:J,headerLines:T,schemas:o,groups:r}}}const en=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","GeometryCollection"],kt=e=>{const n=e;return!n||typeof n!="object"||!en.includes(n.type)?!1:n.type==="GeometryCollection"?Array.isArray(n.geometries)&&n.geometries.every(kt):Array.isArray(n.coordinates)};function Ce(e){return!!e&&typeof e=="object"&&e.type==="Feature"&&kt(e.geometry)}function ct(e){return!e||typeof e!="object"||Array.isArray(e)?'Expected a feature: { "type": "Feature", … }':e.type!=="Feature"?'A feature needs "type": "Feature"':'A feature needs a geometry with a valid "type" and "coordinates"'}function it(e){const n=e.length;let t=0;const o=(i,p=t)=>{throw new lt(p,i)},r=()=>{for(;t<n;t++){const i=e.charCodeAt(t);if(i!==32&&i!==10&&i!==13&&i!==9)break}},s=/-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/y,l='"\\/bfnrt',h=()=>{const i=t++;for(;;){t>=n&&o("Missing a closing quote",i);const p=e.charCodeAt(t);if(p===34){t++;return}if(p===92){const T=e[t+1];T==="u"&&/^[0-9a-fA-F]{4}$/.test(e.slice(t+2,t+6))?t+=6:T!==void 0&&l.includes(T)?t+=2:o("Invalid escape in a string (a backslash must be doubled)")}else p<32?o(p===10?"Missing a closing quote":"Control character in a string",p===10?i:t):t++}},v=(i,p)=>{t++;for(let T=0;;T++){r();let S=0;for(;e[t]===",";)t++,S++,r();if(t>=n&&o(`Missing a closing ${i}`),e[t]===i){t++;return}T&&!S&&o(`Expected a comma or a closing ${i}`),p()}},j=()=>{r();const i=e[t];if(i===void 0)o("Expected a value, the text ends here");else if(i==="{")v("}",()=>{e[t]!=='"'&&o("Expected a property name in double quotes"),h(),r(),e[t]!==":"&&o("Expected a colon after the property name"),t++,j()});else if(i==="[")v("]",j);else if(i==='"')h();else if(i==="-"||i>="0"&&i<="9"){s.lastIndex=t;const p=s.exec(e);p||o("Invalid number"),t+=p[0].length}else{const p=["true","false","null"].find(T=>e.startsWith(T,t));p||o("Expected a value (text needs double quotes)"),t+=p.length}};try{if(!e.trim())return null;for(j(),r();e[t]===",";)t++,r();return t<n&&o("Unexpected text after the end"),null}catch(i){return i instanceof lt?{pos:i.pos,message:i.message}:null}}class lt{constructor(n,t){this.pos=n,this.message=t}}function tn(e,n,t,o){const r=n.features.length;if(!r)return{kind:"full"};const s=pe(n),l=c=>e.line(s[c]).from,h=c=>e.line(s[c]+n.counts[c]-1).to,v=c=>h(c)-(c===r-1?0:1),j=c=>{const b=e.lineAt(c).number;let w=0,L=r-1;for(;w<L;){const g=w+L+1>>1;s[g]<=b?w=g:L=g-1}return w},i=[];let p=!1;if(t.iterChangedRanges((c,b)=>{if(p)return;if(c<l(0)||b>h(r-1)){p=!0;return}let w=j(c),L=Math.max(w,j(b));c>v(w)&&(L===w?L=w+1:w++),b>v(L)&&L<r-1&&L++;const g=i[i.length-1];g&&w<=g[1]?g[1]=Math.max(g[1],L):i.push([w,L])}),p||!i.length)return{kind:"full"};const T=n.features.slice(),S=n.counts.slice(),B=[];let A=!1,m=null;for(let c=i.length-1;c>=0;c--){const[b,w]=i[c],L=t.mapPos(l(b),-1),g=t.mapPos(v(w),1),R=ze("["+o.sliceString(L,g)+"]");if(!Array.isArray(R)||!R.every(Ce)){m={from:L,to:g};continue}m||(T.splice(b,w-b+1,...R),R.length===1?S.splice(b,w-b+1,o.lineAt(g).number-o.lineAt(L).number+1):R.length?A=!0:S.splice(b,w-b+1),B[c]=R.length)}if(m)return{kind:"invalid",...m};const I=[];let J=0;return i.forEach(([c,b],w)=>{const L=c+J;for(let g=L-1;g<=L+B[w];g++)I.push(g);J+=B[w]-(b-c+1)}),{kind:"ok",features:T,counts:A?null:S,around:I,runs:i.map(([c,b],w)=>({i:c,j:b,length:B[w]}))}}function Et(e,n,t=0){if(e===n)return null;const o=Math.min(e.length,n.length);let r=0;for(;r<o&&e.charCodeAt(r)===n.charCodeAt(r);)r++;let s=0;for(;s<o-r&&e.charCodeAt(e.length-1-s)===n.charCodeAt(n.length-1-s);)s++;return{from:t+r,to:t+e.length-s,insert:n.slice(r,n.length-s)}}function nn(e,n,t,o,r,s,l){const h=n.features.length,v=pe(n),j=m=>e.line(v[m]).from,i=m=>e.line(v[m]+n.counts[m]-1).to,p=[];let T=0;for(const m of r){const I=p[p.length-1];I&&m.i===I.j+1?(I.j=m.j,I.length+=m.length):p.push({...m,at:m.i+T}),T+=m.length-(m.j-m.i+1)}const S=[],B=[];let A=0;for(const{i:m,j:I,at:J,length:c}of p){for(;A<m;A++)B.push(n.counts[A]);A=I+1;const b=s.slice(J,J+c);for(const P of b)B.push(l(P).length);const w=m>0,L=I<h-1,g=t.mapPos(w?i(m-1)-1:j(0)-1,-1),R=t.mapPos(L?j(I+1):i(h-1)+1,1),ae=c?(w?",":"")+`
4
4
  `+je(b,l).join(`
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),c=require("react"),B=require("clsx"),b=require("@phosphor-icons/react"),v=require("./useAdapterControls-BBObhzVX.cjs"),K=require("zustand/react/shallow"),S=require("@element-editor/core/internal"),h=require("./EditToolbarBtn-dpCmKnzk.cjs");function M({field:l,existingKeys:o,onUpdate:i,onDelete:k,isProtected:d}){const[u,g]=c.useState(!1),[n,j]=c.useState(""),[x,p]=c.useState(l.label);c.useEffect(()=>p(l.label),[l.label]);function y(){if(x===l.label)return;const t=d?l.key:S.uniqueKey(x,o);i({label:x,key:t})}function w(){const t=n.trim();if(!t)return;const a=l.options??[];a.includes(t)||(i({options:[...a,t]}),j(""))}function N(t){i({options:(l.options??[]).filter(a=>a!==t)})}return r.jsxs("div",{className:"bg-elm-surface-raised border border-elm-border rounded-elm-card p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("p",{className:"text-xs text-elm-text-subtle",children:["key: ",r.jsx("code",{className:"font-elm-mono text-elm-text-muted",children:l.key})]}),r.jsx(h.Tooltip,{content:d?"Required field — cannot be removed":"Remove field",children:r.jsx("button",{onClick:k,disabled:d,className:"flex-shrink-0 text-elm-text disabled:opacity-25 disabled:cursor-not-allowed transition-colors p-1 rounded-elm-chip hover:bg-(--elm-surface-hover,var(--color-gray-100)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700))","aria-label":d?"Cannot remove required field":"Remove field",children:r.jsx(b.X,{size:14})})})]}),r.jsx(h.Input,{value:x,onChange:t=>p(t.target.value),onBlur:y,onKeyDown:t=>t.key==="Enter"&&t.target.blur(),placeholder:"Field label",className:"w-full text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-200))"}),r.jsx(h.SelectInput,{value:l.type,onChange:t=>{const a=t.target.value;i({type:a,options:a==="select"?l.options??[]:void 0}),g(a==="select")},className:"w-full text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-200))",children:S.FIELD_TYPES.map(t=>r.jsx("option",{value:t.value,children:t.label},t.value))}),r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-elm-text-muted cursor-pointer select-none w-fit",children:[r.jsx("input",{type:"checkbox",checked:l.required,onChange:t=>i({required:t.target.checked}),className:"elm-checkbox"}),"Required"]}),l.type==="number"&&r.jsxs("div",{className:"flex items-center gap-2 pt-1 border-t border-(--elm-border-subtle,var(--color-gray-100)) dark:border-(--elm-border-subtle,var(--color-gray-700))",children:[r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-elm-text-muted w-1/2",children:["Min",r.jsx(h.Input,{type:"number",value:l.min??"",onChange:t=>i({min:t.target.value?parseFloat(t.target.value):void 0}),className:"flex-1 w-full min-w-0",placeholder:"Any"})]}),r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-elm-text-muted w-1/2",children:["Max",r.jsx(h.Input,{type:"number",value:l.max??"",onChange:t=>i({max:t.target.value?parseFloat(t.target.value):void 0}),className:"flex-1 w-full min-w-0",placeholder:"Any"})]})]}),l.type==="select"&&r.jsxs("div",{className:"space-y-1.5 pt-1 border-t border-(--elm-border-subtle,var(--color-gray-100)) dark:border-(--elm-border-subtle,var(--color-gray-700))",children:[r.jsxs("button",{onClick:()=>g(t=>!t),className:"text-xs text-primary-500 hover:text-primary-700 hover:bg-(--elm-surface-hover,var(--color-gray-100)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700)) rounded-elm-chip px-1 -mx-1 py-0.5 flex items-center gap-1 transition-colors",children:[u?r.jsx(b.CaretUp,{size:11}):r.jsx(b.CaretDown,{size:11}),u?"Hide options":`Options (${(l.options??[]).length})`]}),u&&r.jsxs("div",{className:"space-y-1",children:[(l.options??[]).map(t=>r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"flex-1 text-xs text-elm-text-secondary bg-(--elm-surface-sunken,var(--color-gray-50)) dark:bg-(--elm-surface-sunken,var(--color-gray-700)) border border-(--elm-border,var(--color-gray-200)) dark:border-(--elm-border,var(--color-gray-600)) rounded-elm-chip px-2 py-1 truncate",children:t}),r.jsx("button",{onClick:()=>N(t),className:"text-elm-text hover:bg-(--elm-surface-hover,var(--color-gray-100)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700)) transition-colors p-0.5 rounded-elm-chip","aria-label":`Remove "${t}" option`,children:r.jsx(b.X,{size:12})})]},t)),r.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[r.jsx(h.Input,{value:n,onChange:t=>j(t.target.value),onKeyDown:t=>t.key==="Enter"&&w(),placeholder:"New option…",className:"flex-1 min-w-0 text-xs text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-200))"}),r.jsx(h.Button,{variant:"secondary",size:"sm",onClick:w,children:"Add"})]})]})]})]})}const z=c.forwardRef(function({schema:o,onRename:i},k){const[d,u]=c.useState(o.name);c.useEffect(()=>u(o.name),[o.name]);function g(){const n=d.trim();if(!n){u(o.name);return}n!==o.name&&i(n)}return r.jsx("input",{ref:k,type:"text",value:d,onChange:n=>u(n.target.value),onBlur:g,onKeyDown:n=>n.key==="Enter"&&n.target.blur(),className:"w-full text-sm font-semibold text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-100)) bg-transparent border-b border-transparent hover:border-(--elm-border-strong,var(--color-gray-300)) dark:hover:border-(--elm-border-strong,var(--color-gray-600)) focus:border-primary-400 focus:outline-none px-0 py-0 leading-snug"})});function O({containerRef:l}){var C,q,D;const o=v.useDataStore(K.useShallow(e=>e.getVisibleSchemas())),i=v.useDataStore(e=>e.addSchema),k=v.useDataStore(e=>e.updateSchema),d=v.useDataStore(e=>e.deleteSchema),u=v.useDataStore(e=>e.addSchemaField),g=v.useDataStore(e=>e.updateSchemaField),n=v.useDataStore(e=>e.removeSchemaField),[j,x]=c.useState(((C=o[0])==null?void 0:C.id)??null),[p,y]=c.useState(null),w=c.useRef(new Map),N=c.useRef(null),t=c.useRef(null),a=o.find(e=>e.id===j)??o[0]??null;c.useEffect(()=>{if(!a||t.current!==a.id)return;t.current=null;const e=N.current;e&&(e.focus(),e.select())},[a==null?void 0:a.id]);function F(e){const m=new Set(e.fields.map(f=>f.key)),s=S.uniqueKey("field",m);u(e.id,{key:s,label:"",type:"text",required:!1})}function I(){const e=i("New schema",[{key:S.uniqueKey("field",new Set),label:"",type:"text",required:!1}]);t.current=e,x(e)}function A(e,m){var f;e.preventDefault();const s=((f=l==null?void 0:l.current)==null?void 0:f.getBoundingClientRect())??{left:0,top:0};y({schemaId:m,offsetX:e.clientX-s.left,offsetY:e.clientY-s.top})}function E(e){var s;if(o.length<=1)return;d(e);const m=o.filter(f=>f.id!==e);x(((s=m[0])==null?void 0:s.id)??null),y(null)}return r.jsxs("div",{className:"flex h-full min-h-0",onClick:()=>y(null),children:[r.jsx("div",{className:"w-44 flex-shrink-0 flex flex-col border-r border-elm-border min-h-0",children:r.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 py-1",children:[o.map(e=>{const m=((a==null?void 0:a.id)??j)===e.id;return r.jsx("button",{ref:s=>{s?w.current.set(e.id,s):w.current.delete(e.id)},onClick:()=>x(e.id),onContextMenu:s=>A(s,e.id),className:B.clsx("w-full text-left px-3 py-2 text-sm transition-colors flex items-center gap-1.5",m?"bg-primary-50 dark:bg-white/10 hover:bg-primary-100 dark:hover:bg-white/15 text-primary-700 dark:text-primary-300 font-medium border-r-2 border-primary-500":"text-elm-text-muted hover:bg-(--elm-surface-hover,var(--color-gray-50)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-800)) hover:text-(--elm-text,var(--color-gray-800)) dark:hover:text-(--elm-text,var(--color-gray-200)) border-r-2 border-transparent"),children:r.jsx("span",{className:"flex-1 truncate leading-snug",children:e.name})},e.id)}),r.jsxs("button",{onClick:I,className:"w-full flex items-center gap-1.5 px-3 py-2 text-xs text-elm-text-subtle hover:text-(--elm-text-secondary,var(--color-gray-700)) dark:hover:text-(--elm-text-secondary,var(--color-gray-200)) hover:bg-(--elm-surface-hover,var(--color-gray-50)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-800)) transition-colors border-r-2 border-transparent",children:[r.jsx(b.Plus,{size:11}),"Add schema"]})]})}),a?r.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 bg-(--elm-surface-sunken,color-mix(in_oklab,var(--color-gray-50)_60%,transparent)) dark:bg-(--elm-surface-sunken,color-mix(in_oklab,var(--color-gray-800)_30%,transparent))",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-elm-border-subtle flex-shrink-0",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx(z,{ref:N,schema:a,onRename:e=>k(a.id,{name:e})},a.id)}),r.jsxs("button",{onClick:()=>F(a),className:"flex-shrink-0 flex items-center gap-1 text-xs text-elm-text-subtle hover:text-primary-500 dark:hover:text-primary-400 transition-colors px-1.5 py-1 rounded-elm-chip hover:bg-primary-50 dark:hover:bg-white/5",children:[r.jsx(b.Plus,{size:11}),"Add field"]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 p-3 space-y-2",children:a.fields.map(e=>{const m=new Set(a.fields.map(s=>s.key).filter(s=>s!==e.key));return r.jsx(M,{field:e,existingKeys:m,onUpdate:s=>g(a.id,e.key,s),onDelete:()=>n(a.id,e.key),isProtected:e.key==="name"},e.key)})})]}):r.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-elm-text-disabled",children:"Select a schema"}),p&&r.jsx(h.ContextMenu,{x:(((q=l==null?void 0:l.current)==null?void 0:q.getBoundingClientRect().left)??0)+p.offsetX,y:(((D=l==null?void 0:l.current)==null?void 0:D.getBoundingClientRect().top)??0)+p.offsetY,onClose:()=>y(null),items:[{label:o.length<=1?"Cannot delete last":"Delete schema",icon:r.jsx(b.Trash,{size:16}),disabled:o.length<=1,onClick:()=>E(p.schemaId)}]})]})}exports.default=O;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),c=require("react"),B=require("clsx"),b=require("@phosphor-icons/react"),v=require("./useAdapterControls-BBObhzVX.cjs"),K=require("zustand/react/shallow"),S=require("@element-editor/core/internal"),h=require("./EditToolbarBtn-Ch9HCLHq.cjs");function M({field:l,existingKeys:o,onUpdate:i,onDelete:k,isProtected:d}){const[u,g]=c.useState(!1),[n,j]=c.useState(""),[x,p]=c.useState(l.label);c.useEffect(()=>p(l.label),[l.label]);function y(){if(x===l.label)return;const t=d?l.key:S.uniqueKey(x,o);i({label:x,key:t})}function w(){const t=n.trim();if(!t)return;const a=l.options??[];a.includes(t)||(i({options:[...a,t]}),j(""))}function N(t){i({options:(l.options??[]).filter(a=>a!==t)})}return r.jsxs("div",{className:"bg-elm-surface-raised border border-elm-border rounded-elm-card p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("p",{className:"text-xs text-elm-text-subtle",children:["key: ",r.jsx("code",{className:"font-elm-mono text-elm-text-muted",children:l.key})]}),r.jsx(h.Tooltip,{content:d?"Required field — cannot be removed":"Remove field",children:r.jsx("button",{onClick:k,disabled:d,className:"flex-shrink-0 text-elm-text disabled:opacity-25 disabled:cursor-not-allowed transition-colors p-1 rounded-elm-chip hover:bg-(--elm-surface-hover,var(--color-gray-100)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700))","aria-label":d?"Cannot remove required field":"Remove field",children:r.jsx(b.X,{size:14})})})]}),r.jsx(h.Input,{value:x,onChange:t=>p(t.target.value),onBlur:y,onKeyDown:t=>t.key==="Enter"&&t.target.blur(),placeholder:"Field label",className:"w-full text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-200))"}),r.jsx(h.SelectInput,{value:l.type,onChange:t=>{const a=t.target.value;i({type:a,options:a==="select"?l.options??[]:void 0}),g(a==="select")},className:"w-full text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-200))",children:S.FIELD_TYPES.map(t=>r.jsx("option",{value:t.value,children:t.label},t.value))}),r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-elm-text-muted cursor-pointer select-none w-fit",children:[r.jsx("input",{type:"checkbox",checked:l.required,onChange:t=>i({required:t.target.checked}),className:"elm-checkbox"}),"Required"]}),l.type==="number"&&r.jsxs("div",{className:"flex items-center gap-2 pt-1 border-t border-(--elm-border-subtle,var(--color-gray-100)) dark:border-(--elm-border-subtle,var(--color-gray-700))",children:[r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-elm-text-muted w-1/2",children:["Min",r.jsx(h.Input,{type:"number",value:l.min??"",onChange:t=>i({min:t.target.value?parseFloat(t.target.value):void 0}),className:"flex-1 w-full min-w-0",placeholder:"Any"})]}),r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-elm-text-muted w-1/2",children:["Max",r.jsx(h.Input,{type:"number",value:l.max??"",onChange:t=>i({max:t.target.value?parseFloat(t.target.value):void 0}),className:"flex-1 w-full min-w-0",placeholder:"Any"})]})]}),l.type==="select"&&r.jsxs("div",{className:"space-y-1.5 pt-1 border-t border-(--elm-border-subtle,var(--color-gray-100)) dark:border-(--elm-border-subtle,var(--color-gray-700))",children:[r.jsxs("button",{onClick:()=>g(t=>!t),className:"text-xs text-primary-500 hover:text-primary-700 hover:bg-(--elm-surface-hover,var(--color-gray-100)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700)) rounded-elm-chip px-1 -mx-1 py-0.5 flex items-center gap-1 transition-colors",children:[u?r.jsx(b.CaretUp,{size:11}):r.jsx(b.CaretDown,{size:11}),u?"Hide options":`Options (${(l.options??[]).length})`]}),u&&r.jsxs("div",{className:"space-y-1",children:[(l.options??[]).map(t=>r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"flex-1 text-xs text-elm-text-secondary bg-(--elm-surface-sunken,var(--color-gray-50)) dark:bg-(--elm-surface-sunken,var(--color-gray-700)) border border-(--elm-border,var(--color-gray-200)) dark:border-(--elm-border,var(--color-gray-600)) rounded-elm-chip px-2 py-1 truncate",children:t}),r.jsx("button",{onClick:()=>N(t),className:"text-elm-text hover:bg-(--elm-surface-hover,var(--color-gray-100)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700)) transition-colors p-0.5 rounded-elm-chip","aria-label":`Remove "${t}" option`,children:r.jsx(b.X,{size:12})})]},t)),r.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[r.jsx(h.Input,{value:n,onChange:t=>j(t.target.value),onKeyDown:t=>t.key==="Enter"&&w(),placeholder:"New option…",className:"flex-1 min-w-0 text-xs text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-200))"}),r.jsx(h.Button,{variant:"secondary",size:"sm",onClick:w,children:"Add"})]})]})]})]})}const z=c.forwardRef(function({schema:o,onRename:i},k){const[d,u]=c.useState(o.name);c.useEffect(()=>u(o.name),[o.name]);function g(){const n=d.trim();if(!n){u(o.name);return}n!==o.name&&i(n)}return r.jsx("input",{ref:k,type:"text",value:d,onChange:n=>u(n.target.value),onBlur:g,onKeyDown:n=>n.key==="Enter"&&n.target.blur(),className:"w-full text-sm font-semibold text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-100)) bg-transparent border-b border-transparent hover:border-(--elm-border-strong,var(--color-gray-300)) dark:hover:border-(--elm-border-strong,var(--color-gray-600)) focus:border-primary-400 focus:outline-none px-0 py-0 leading-snug"})});function O({containerRef:l}){var C,q,D;const o=v.useDataStore(K.useShallow(e=>e.getVisibleSchemas())),i=v.useDataStore(e=>e.addSchema),k=v.useDataStore(e=>e.updateSchema),d=v.useDataStore(e=>e.deleteSchema),u=v.useDataStore(e=>e.addSchemaField),g=v.useDataStore(e=>e.updateSchemaField),n=v.useDataStore(e=>e.removeSchemaField),[j,x]=c.useState(((C=o[0])==null?void 0:C.id)??null),[p,y]=c.useState(null),w=c.useRef(new Map),N=c.useRef(null),t=c.useRef(null),a=o.find(e=>e.id===j)??o[0]??null;c.useEffect(()=>{if(!a||t.current!==a.id)return;t.current=null;const e=N.current;e&&(e.focus(),e.select())},[a==null?void 0:a.id]);function F(e){const m=new Set(e.fields.map(f=>f.key)),s=S.uniqueKey("field",m);u(e.id,{key:s,label:"",type:"text",required:!1})}function I(){const e=i("New schema",[{key:S.uniqueKey("field",new Set),label:"",type:"text",required:!1}]);t.current=e,x(e)}function A(e,m){var f;e.preventDefault();const s=((f=l==null?void 0:l.current)==null?void 0:f.getBoundingClientRect())??{left:0,top:0};y({schemaId:m,offsetX:e.clientX-s.left,offsetY:e.clientY-s.top})}function E(e){var s;if(o.length<=1)return;d(e);const m=o.filter(f=>f.id!==e);x(((s=m[0])==null?void 0:s.id)??null),y(null)}return r.jsxs("div",{className:"flex h-full min-h-0",onClick:()=>y(null),children:[r.jsx("div",{className:"w-44 flex-shrink-0 flex flex-col border-r border-elm-border min-h-0",children:r.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 py-1",children:[o.map(e=>{const m=((a==null?void 0:a.id)??j)===e.id;return r.jsx("button",{ref:s=>{s?w.current.set(e.id,s):w.current.delete(e.id)},onClick:()=>x(e.id),onContextMenu:s=>A(s,e.id),className:B.clsx("w-full text-left px-3 py-2 text-sm transition-colors flex items-center gap-1.5",m?"bg-primary-50 dark:bg-white/10 hover:bg-primary-100 dark:hover:bg-white/15 text-primary-700 dark:text-primary-300 font-medium border-r-2 border-primary-500":"text-elm-text-muted hover:bg-(--elm-surface-hover,var(--color-gray-50)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-800)) hover:text-(--elm-text,var(--color-gray-800)) dark:hover:text-(--elm-text,var(--color-gray-200)) border-r-2 border-transparent"),children:r.jsx("span",{className:"flex-1 truncate leading-snug",children:e.name})},e.id)}),r.jsxs("button",{onClick:I,className:"w-full flex items-center gap-1.5 px-3 py-2 text-xs text-elm-text-subtle hover:text-(--elm-text-secondary,var(--color-gray-700)) dark:hover:text-(--elm-text-secondary,var(--color-gray-200)) hover:bg-(--elm-surface-hover,var(--color-gray-50)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-800)) transition-colors border-r-2 border-transparent",children:[r.jsx(b.Plus,{size:11}),"Add schema"]})]})}),a?r.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 bg-(--elm-surface-sunken,color-mix(in_oklab,var(--color-gray-50)_60%,transparent)) dark:bg-(--elm-surface-sunken,color-mix(in_oklab,var(--color-gray-800)_30%,transparent))",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-elm-border-subtle flex-shrink-0",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx(z,{ref:N,schema:a,onRename:e=>k(a.id,{name:e})},a.id)}),r.jsxs("button",{onClick:()=>F(a),className:"flex-shrink-0 flex items-center gap-1 text-xs text-elm-text-subtle hover:text-primary-500 dark:hover:text-primary-400 transition-colors px-1.5 py-1 rounded-elm-chip hover:bg-primary-50 dark:hover:bg-white/5",children:[r.jsx(b.Plus,{size:11}),"Add field"]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 p-3 space-y-2",children:a.fields.map(e=>{const m=new Set(a.fields.map(s=>s.key).filter(s=>s!==e.key));return r.jsx(M,{field:e,existingKeys:m,onUpdate:s=>g(a.id,e.key,s),onDelete:()=>n(a.id,e.key),isProtected:e.key==="name"},e.key)})})]}):r.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-elm-text-disabled",children:"Select a schema"}),p&&r.jsx(h.ContextMenu,{x:(((q=l==null?void 0:l.current)==null?void 0:q.getBoundingClientRect().left)??0)+p.offsetX,y:(((D=l==null?void 0:l.current)==null?void 0:D.getBoundingClientRect().top)??0)+p.offsetY,onClose:()=>y(null),items:[{label:o.length<=1?"Cannot delete last":"Delete schema",icon:r.jsx(b.Trash,{size:16}),disabled:o.length<=1,onClick:()=>E(p.schemaId)}]})]})}exports.default=O;
@@ -5,7 +5,7 @@ import { Plus as q, Trash as L, X as z, CaretUp as X, CaretDown as Y } from "@ph
5
5
  import { f as p } from "./useAdapterControls-DVjkwRZ_.js";
6
6
  import { useShallow as T } from "zustand/react/shallow";
7
7
  import { uniqueKey as F, FIELD_TYPES as $ } from "@element-editor/core/internal";
8
- import { C as H, f as R, I as C, c as V, B as G } from "./EditToolbarBtn-SZIsnIn3.js";
8
+ import { C as H, f as R, I as C, c as V, B as G } from "./EditToolbarBtn-SR4xHd8G.js";
9
9
  function J({
10
10
  field: l,
11
11
  existingKeys: s,
@@ -1,12 +1,12 @@
1
1
  import { jsx as t, jsxs as h } from "react/jsx-runtime";
2
2
  import { useRef as _, useState as k, useCallback as H, useEffect as C } from "react";
3
- import { u as I, W as L, s as R } from "./index-CtZterPc.js";
3
+ import { u as I, W as L, s as R } from "./index-CILw1Du5.js";
4
4
  import { u as $, e as T } from "./useAccentStyle-CPo2XqAn.js";
5
5
  import { readStorage as Y, writeStorage as j } from "@element-editor/core";
6
6
  import { createPortal as O } from "react-dom";
7
- import { u as X, a as A, C as B } from "./useWindowFocus-DGAWA1au.js";
7
+ import { u as X, a as A, C as B } from "./useWindowFocus-DuQVjnHE.js";
8
8
  import { u as F } from "./useFocusTrap-CKxKT8De.js";
9
- import J from "./SchemaEditor-BEsKUe2p.js";
9
+ import J from "./SchemaEditor-ryoTgaLb.js";
10
10
  import { d as P } from "./useAdapterControls-DVjkwRZ_.js";
11
11
  const f = "elm_schema_win_size", r = 450, p = 200;
12
12
  function ne({ onClose: c }) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),l=require("./index-BKdDZ4Y9.cjs"),f=require("./useAccentStyle-hsGvyHZc.cjs"),p=require("@element-editor/core"),H=require("react-dom"),d=require("./useWindowFocus-D-_yEm_V.cjs"),C=require("./useFocusTrap-BBjPCfDR.cjs"),I=require("./SchemaEditor-qkoYMg0C.cjs"),L=require("./useAdapterControls-BBObhzVX.cjs"),v="elm_schema_win_size",i=450,b=200;function R({onClose:u}){const{pos:m,onHandleMouseDown:g}=d.useDragWindow("elm_schema_win",{x:80,y:120}),c=f.useElementEditorConfig(),{zIndex:h,focus:S}=d.useWindowFocus(),y=L.useTheme(),M=f.useAccentStyle(),o=r.useRef(null),[n,W]=r.useState(()=>{try{const e=p.readStorage(v,c);return e?JSON.parse(e):{w:i,h:520}}catch{return{w:i,h:520}}}),j=r.useCallback((e,a)=>{p.writeStorage(v,JSON.stringify({w:e,h:a}),c)},[c]);function E(e){e.preventDefault(),e.stopPropagation();const a=e.clientX,N=e.clientY,q=n.w,D=n.h,z=l.startDragShield("se-resize");function x(s){const _=Math.max(i,Math.min(window.innerWidth*.9,q+s.clientX-a)),k=Math.max(b,Math.min(window.innerHeight*.85,D+s.clientY-N));W({w:_,h:k})}function w(){z(),document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",w);const s=o.current;s&&j(s.offsetWidth,s.offsetHeight)}document.addEventListener("mousemove",x),document.addEventListener("mouseup",w)}return C.useFocusTrap(o),l.useWindowEscape(o,!0,u,h),r.useEffect(()=>{var e;(e=o.current)==null||e.focus()},[]),H.createPortal(t.jsx("div",{"data-elm-theme":y,style:M,children:t.jsxs("div",{ref:o,[l.WINDOW_ATTR]:"",onMouseDownCapture:S,role:"dialog","aria-label":"Schema editor",tabIndex:-1,className:"fixed flex flex-col bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm-raised rounded-elm-window overflow-hidden outline-none",style:{left:`clamp(8px, ${m.x}px, calc(100vw - min(${n.w}px, 90vw) - 8px))`,top:`clamp(8px, ${m.y}px, calc(100vh - min(${n.h}px, 85vh) - 8px))`,zIndex:h,minWidth:`min(${i}px, 90vw)`,minHeight:b,width:n.w,height:n.h,maxWidth:"90vw",maxHeight:"85vh"},children:[t.jsxs("div",{onMouseDown:g,className:"flex items-center justify-between px-4 py-3 border-b border-elm-border flex-shrink-0 select-none",style:{cursor:"grab"},children:[t.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-900)) dark:text-(--elm-text,var(--color-gray-100))",children:"Schema"}),t.jsx(d.CloseButton,{onClick:u,label:"Close schema editor"})]}),t.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:t.jsx(I.default,{containerRef:o})}),t.jsx("div",{onMouseDown:E,className:"absolute bottom-0 right-0 w-4 h-4 cursor-se-resize select-none",style:{zIndex:10},"aria-hidden":!0,children:t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"absolute bottom-1 right-1 text-elm-text-disabled",children:t.jsx("path",{d:"M9 1L1 9M9 5L5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})}),document.body)}exports.default=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),l=require("./index-DG4wEjGj.cjs"),f=require("./useAccentStyle-hsGvyHZc.cjs"),p=require("@element-editor/core"),H=require("react-dom"),d=require("./useWindowFocus-EemgNOuz.cjs"),C=require("./useFocusTrap-BBjPCfDR.cjs"),I=require("./SchemaEditor-B4L17K1e.cjs"),L=require("./useAdapterControls-BBObhzVX.cjs"),v="elm_schema_win_size",i=450,b=200;function R({onClose:u}){const{pos:m,onHandleMouseDown:g}=d.useDragWindow("elm_schema_win",{x:80,y:120}),c=f.useElementEditorConfig(),{zIndex:h,focus:S}=d.useWindowFocus(),y=L.useTheme(),M=f.useAccentStyle(),o=r.useRef(null),[n,W]=r.useState(()=>{try{const e=p.readStorage(v,c);return e?JSON.parse(e):{w:i,h:520}}catch{return{w:i,h:520}}}),j=r.useCallback((e,a)=>{p.writeStorage(v,JSON.stringify({w:e,h:a}),c)},[c]);function E(e){e.preventDefault(),e.stopPropagation();const a=e.clientX,N=e.clientY,q=n.w,D=n.h,z=l.startDragShield("se-resize");function x(s){const _=Math.max(i,Math.min(window.innerWidth*.9,q+s.clientX-a)),k=Math.max(b,Math.min(window.innerHeight*.85,D+s.clientY-N));W({w:_,h:k})}function w(){z(),document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",w);const s=o.current;s&&j(s.offsetWidth,s.offsetHeight)}document.addEventListener("mousemove",x),document.addEventListener("mouseup",w)}return C.useFocusTrap(o),l.useWindowEscape(o,!0,u,h),r.useEffect(()=>{var e;(e=o.current)==null||e.focus()},[]),H.createPortal(t.jsx("div",{"data-elm-theme":y,style:M,children:t.jsxs("div",{ref:o,[l.WINDOW_ATTR]:"",onMouseDownCapture:S,role:"dialog","aria-label":"Schema editor",tabIndex:-1,className:"fixed flex flex-col bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm-raised rounded-elm-window overflow-hidden outline-none",style:{left:`clamp(8px, ${m.x}px, calc(100vw - min(${n.w}px, 90vw) - 8px))`,top:`clamp(8px, ${m.y}px, calc(100vh - min(${n.h}px, 85vh) - 8px))`,zIndex:h,minWidth:`min(${i}px, 90vw)`,minHeight:b,width:n.w,height:n.h,maxWidth:"90vw",maxHeight:"85vh"},children:[t.jsxs("div",{onMouseDown:g,className:"flex items-center justify-between px-4 py-3 border-b border-elm-border flex-shrink-0 select-none",style:{cursor:"grab"},children:[t.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-900)) dark:text-(--elm-text,var(--color-gray-100))",children:"Schema"}),t.jsx(d.CloseButton,{onClick:u,label:"Close schema editor"})]}),t.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:t.jsx(I.default,{containerRef:o})}),t.jsx("div",{onMouseDown:E,className:"absolute bottom-0 right-0 w-4 h-4 cursor-se-resize select-none",style:{zIndex:10},"aria-hidden":!0,children:t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"absolute bottom-1 right-1 text-elm-text-disabled",children:t.jsx("path",{d:"M9 1L1 9M9 5L5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})}),document.body)}exports.default=R;
@@ -1,11 +1,11 @@
1
1
  import { jsxs as t, jsx as r } from "react/jsx-runtime";
2
2
  import { useRef as G, useState as X, useCallback as J } from "react";
3
- import { u as P, i as S, W as Z, s as K } from "./index-CtZterPc.js";
3
+ import { u as P, i as S, W as Z, s as K } from "./index-CILw1Du5.js";
4
4
  import { u as V } from "./useAccentStyle-CPo2XqAn.js";
5
5
  import { readStorage as q, writeStorage as Q } from "@element-editor/core";
6
6
  import { Sun as ee, Moon as re, Desktop as te, Monitor as se, GlobeHemisphereWest as ae } from "@phosphor-icons/react";
7
7
  import { u as s, f as M, d as oe } from "./useAdapterControls-DVjkwRZ_.js";
8
- import { u as le, a as ne, C as ie } from "./useWindowFocus-DGAWA1au.js";
8
+ import { u as le, a as ne, C as ie } from "./useWindowFocus-DuQVjnHE.js";
9
9
  const E = "elm_settings_win_size", D = 320, C = 320, $ = { w: 384, h: 560 };
10
10
  function xe() {
11
11
  const i = s((e) => e.settingsModalOpen), x = s((e) => e.setSettingsModalOpen), a = M((e) => e.geometryMode), p = M((e) => e.setGeometryMode), W = s((e) => e.setShowMeasurements), c = s((e) => e.showMeasurements), d = s((e) => e.showFeatureNameOnHover), H = s((e) => e.setShowFeatureNameOnHover), m = s((e) => e.topoEditEnabled), _ = s((e) => e.setTopoEditEnabled), h = s((e) => e.autoExitAfterDraw), z = s((e) => e.setAutoExitAfterDraw), u = s((e) => e.snapEnabled), T = s((e) => e.setSnapEnabled), v = s((e) => e.userTheme), I = s((e) => e.setUserTheme), A = oe(), { pos: y, onHandleMouseDown: O } = le("elm_settings_win", { x: 80, y: 80 }), g = V(), { zIndex: w, focus: j } = ne(i), b = G(null);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),l=require("./index-BKdDZ4Y9.cjs"),G=require("./useAccentStyle-hsGvyHZc.cjs"),E=require("@element-editor/core"),n=require("@phosphor-icons/react"),s=require("./useAdapterControls-BBObhzVX.cjs"),v=require("./useWindowFocus-D-_yEm_V.cjs"),I="elm_settings_win_size",D=320,C=320,U={w:384,h:560};function X(){const c=s.useUIStore(r=>r.settingsModalOpen),y=s.useUIStore(r=>r.setSettingsModalOpen),t=s.useDataStore(r=>r.geometryMode),w=s.useDataStore(r=>r.setGeometryMode),$=s.useUIStore(r=>r.setShowMeasurements),d=s.useUIStore(r=>r.showMeasurements),m=s.useUIStore(r=>r.showFeatureNameOnHover),W=s.useUIStore(r=>r.setShowFeatureNameOnHover),x=s.useUIStore(r=>r.topoEditEnabled),H=s.useUIStore(r=>r.setTopoEditEnabled),u=s.useUIStore(r=>r.autoExitAfterDraw),_=s.useUIStore(r=>r.setAutoExitAfterDraw),h=s.useUIStore(r=>r.snapEnabled),z=s.useUIStore(r=>r.setSnapEnabled),j=s.useUIStore(r=>r.userTheme),T=s.useUIStore(r=>r.setUserTheme),A=s.useTheme(),{pos:k,onHandleMouseDown:O}=v.useDragWindow("elm_settings_win",{x:80,y:80}),g=G.useElementEditorConfig(),{zIndex:N,focus:L}=v.useWindowFocus(c),b=p.useRef(null);l.useWindowEscape(b,c,()=>y(!1),N);const[i,q]=p.useState(()=>{try{const r=E.readStorage(I,g);return r?JSON.parse(r):U}catch{return U}}),F=p.useCallback((r,a)=>{E.writeStorage(I,JSON.stringify({w:r,h:a}),g)},[g]);function R(r){r.preventDefault(),r.stopPropagation();const a=r.clientX,f=r.clientY,B=i.w,P=i.h,Y=l.startDragShield("se-resize");function S(o){q({w:Math.max(D,Math.min(window.innerWidth*.9,B+o.clientX-a)),h:Math.max(C,Math.min(window.innerHeight*.85,P+o.clientY-f))})}function M(){Y(),document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",M);const o=b.current;o&&F(o.offsetWidth,o.offsetHeight)}document.addEventListener("mousemove",S),document.addEventListener("mouseup",M)}return c?e.jsxs("div",{ref:b,[l.WINDOW_ATTR]:"",role:"dialog","aria-label":"Settings",onMouseDownCapture:L,className:"fixed flex flex-col bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm-raised rounded-elm-window overflow-hidden","data-elm-theme":A,style:{left:k.x,top:k.y,zIndex:N,minWidth:D,minHeight:C,width:i.w,height:i.h,maxWidth:"90vw",maxHeight:"85vh"},children:[e.jsxs("div",{onMouseDown:O,className:"flex items-center justify-between px-4 py-3 border-b border-elm-border flex-shrink-0 select-none",style:{cursor:"grab"},children:[e.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-900)) dark:text-(--elm-text,var(--color-gray-100))",children:"Settings"}),e.jsx(v.CloseButton,{onClick:()=>y(!1),label:"Close settings"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-6 min-h-0",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-elm-text-secondary",children:"Appearance"}),e.jsx("div",{className:"flex rounded-elm border border-elm-border overflow-hidden",children:[{value:"light",label:"Light",Icon:n.Sun},{value:"dark",label:"Dark",Icon:n.Moon},{value:"system",label:"Auto",Icon:n.Desktop}].map(({value:r,label:a,Icon:f})=>e.jsxs("button",{onClick:()=>T(r),className:`flex-1 flex items-center justify-center gap-1.5 py-2 text-xs font-medium transition-colors ${j===r?"bg-primary-500 hover:bg-primary-600 text-white":"text-elm-text-muted hover:bg-elm-surface-hover hover:text-(--elm-text-secondary,var(--color-gray-700)) dark:hover:text-(--elm-text-secondary,var(--color-gray-200))"}`,children:[e.jsx(f,{size:14,weight:j===r?"fill":"regular"}),a]},r))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium text-elm-text-secondary",children:"Drawing mode"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("button",{onClick:()=>w("visual"),className:`p-3 text-center rounded-elm border text-sm transition-colors ${t==="visual"?"border-primary-500 bg-primary-50 dark:bg-white/5 hover:bg-primary-100 dark:hover:bg-white/10 ring-1 ring-primary-500/20":"border-(--elm-border,var(--color-gray-200)) dark:border-(--elm-border,var(--color-gray-600)) bg-elm-surface-raised hover:border-(--elm-border-strong,var(--color-gray-300)) dark:hover:border-(--elm-border-strong,var(--color-gray-500)) hover:bg-(--elm-surface-hover,var(--color-gray-50)) dark:hover:bg-(--elm-surface-hover,color-mix(in_oklab,var(--color-gray-700)_50%,transparent))"}`,children:[e.jsx(n.Monitor,{size:32,weight:t==="visual"?"fill":"regular",className:`mx-auto mb-2 ${t==="visual"?"text-primary-600":"text-elm-text-muted"}`}),e.jsx("span",{className:`block mb-1 font-semibold ${t==="visual"?"text-primary-800 dark:text-primary-300":"text-(--elm-text-secondary,var(--color-gray-700)) dark:text-(--elm-text-secondary,var(--color-gray-200))"}`,children:"Visual"}),e.jsx("p",{className:"text-xs leading-relaxed text-elm-text-muted",children:"Shapes keep their proportions on screen. Best for sketching and layouts."})]}),e.jsxs("button",{onClick:()=>w("spatial"),className:`p-3 text-center rounded-elm border text-sm transition-colors ${t==="spatial"?"border-primary-500 bg-primary-50 dark:bg-white/5 hover:bg-primary-100 dark:hover:bg-white/10 ring-1 ring-primary-500/20":"border-(--elm-border,var(--color-gray-200)) dark:border-(--elm-border,var(--color-gray-600)) bg-elm-surface-raised hover:border-(--elm-border-strong,var(--color-gray-300)) dark:hover:border-(--elm-border-strong,var(--color-gray-500)) hover:bg-(--elm-surface-hover,var(--color-gray-50)) dark:hover:bg-(--elm-surface-hover,color-mix(in_oklab,var(--color-gray-700)_50%,transparent))"}`,children:[e.jsx(n.GlobeHemisphereWest,{size:32,weight:t==="spatial"?"fill":"regular",className:`mx-auto mb-2 ${t==="spatial"?"text-primary-600":"text-elm-text-muted"}`}),e.jsx("span",{className:`block mb-1 font-semibold ${t==="spatial"?"text-primary-800 dark:text-primary-300":"text-(--elm-text-secondary,var(--color-gray-700)) dark:text-(--elm-text-secondary,var(--color-gray-200))"}`,children:"Spatial"}),e.jsx("p",{className:"text-xs leading-relaxed text-elm-text-muted",children:"Shapes keep their true size on the ground. Best for exact areas and distances."})]})]})]}),e.jsx("div",{className:"pt-4 border-t border-elm-border-subtle",children:e.jsxs("label",{className:"flex items-center justify-between cursor-pointer group",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 pr-4",children:[e.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-100))",children:"Show measurements"}),e.jsx("span",{className:"text-xs text-elm-text-muted",children:"Display live dimensions and coordinates at the cursor while drawing shapes."})]}),e.jsxs("div",{className:`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-elm-focus-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-elm-surface ${d?"bg-primary-500":"bg-(--elm-border-strong,var(--color-gray-200)) dark:bg-(--elm-border-strong,var(--color-gray-600))"}`,children:[e.jsx("span",{className:`${d?"translate-x-6":"translate-x-1"} inline-block h-4 w-4 transform rounded-full bg-white transition-transform`}),e.jsx("input",{type:"checkbox",className:"sr-only",checked:d,onChange:r=>$(r.target.checked)})]})]})}),e.jsx("div",{className:"pt-4 border-t border-elm-border-subtle",children:e.jsxs("label",{className:"flex items-center justify-between cursor-pointer group",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 pr-4",children:[e.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-100))",children:"Show name on hover"}),e.jsx("span",{className:"text-xs text-elm-text-muted",children:"Display the feature name when hovering over shapes on the map."})]}),e.jsxs("div",{className:`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-elm-focus-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-elm-surface ${m?"bg-primary-500":"bg-(--elm-border-strong,var(--color-gray-200)) dark:bg-(--elm-border-strong,var(--color-gray-600))"}`,children:[e.jsx("span",{className:`${m?"translate-x-6":"translate-x-1"} inline-block h-4 w-4 transform rounded-full bg-white transition-transform`}),e.jsx("input",{type:"checkbox",className:"sr-only",checked:m,onChange:r=>W(r.target.checked)})]})]})}),e.jsx("div",{className:"pt-4 border-t border-elm-border-subtle",children:e.jsxs("label",{className:"flex items-center justify-between cursor-pointer group",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 pr-4",children:[e.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-100))",children:"Topological editing"}),e.jsxs("span",{className:"text-xs text-elm-text-muted",children:["When editing points, shared borders between areas update together. Hold ",l.isMacPlatform()?"⌘ Cmd":"Ctrl"," to temporarily disable."]})]}),e.jsxs("div",{className:`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-elm-focus-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-elm-surface ${x?"bg-primary-500":"bg-(--elm-border-strong,var(--color-gray-200)) dark:bg-(--elm-border-strong,var(--color-gray-600))"}`,children:[e.jsx("span",{className:`${x?"translate-x-6":"translate-x-1"} inline-block h-4 w-4 transform rounded-full bg-white transition-transform`}),e.jsx("input",{type:"checkbox",className:"sr-only",checked:x,onChange:r=>H(r.target.checked)})]})]})}),e.jsx("div",{className:"pt-4 border-t border-elm-border-subtle",children:e.jsxs("label",{className:"flex items-center justify-between cursor-pointer group",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 pr-4",children:[e.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-100))",children:"Snapping"}),e.jsxs("span",{className:"text-xs text-elm-text-muted",children:["Snap to nearby points and edges while drawing. Hold ",l.isMacPlatform()?"⌘ Cmd":"Ctrl"," to temporarily disable."]})]}),e.jsxs("div",{className:`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-elm-focus-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-elm-surface ${h?"bg-primary-500":"bg-(--elm-border-strong,var(--color-gray-200)) dark:bg-(--elm-border-strong,var(--color-gray-600))"}`,children:[e.jsx("span",{className:`${h?"translate-x-6":"translate-x-1"} inline-block h-4 w-4 transform rounded-full bg-white transition-transform`}),e.jsx("input",{type:"checkbox",className:"sr-only",checked:h,onChange:r=>z(r.target.checked)})]})]})}),e.jsx("div",{className:"pt-4 border-t border-elm-border-subtle",children:e.jsxs("label",{className:"flex items-center justify-between cursor-pointer group",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 pr-4",children:[e.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-100))",children:"Return to select after each shape"}),e.jsx("span",{className:"text-xs text-elm-text-muted",children:"Drawing tools deactivate after every shape, so you go back to selection. Turn off to keep the tool active and draw multiple shapes in a row."})]}),e.jsxs("div",{className:`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-elm-focus-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-elm-surface ${u?"bg-primary-500":"bg-(--elm-border-strong,var(--color-gray-200)) dark:bg-(--elm-border-strong,var(--color-gray-600))"}`,children:[e.jsx("span",{className:`${u?"translate-x-6":"translate-x-1"} inline-block h-4 w-4 transform rounded-full bg-white transition-transform`}),e.jsx("input",{type:"checkbox",className:"sr-only",checked:u,onChange:r=>_(r.target.checked)})]})]})})]}),e.jsx("div",{onMouseDown:R,className:"absolute bottom-0 right-0 w-4 h-4 cursor-se-resize select-none",style:{zIndex:10},"aria-hidden":!0,children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"absolute bottom-1 right-1 text-elm-text-disabled",children:e.jsx("path",{d:"M9 1L1 9M9 5L5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null}exports.default=X;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),l=require("./index-DG4wEjGj.cjs"),G=require("./useAccentStyle-hsGvyHZc.cjs"),E=require("@element-editor/core"),n=require("@phosphor-icons/react"),s=require("./useAdapterControls-BBObhzVX.cjs"),v=require("./useWindowFocus-EemgNOuz.cjs"),I="elm_settings_win_size",D=320,C=320,U={w:384,h:560};function X(){const c=s.useUIStore(r=>r.settingsModalOpen),y=s.useUIStore(r=>r.setSettingsModalOpen),t=s.useDataStore(r=>r.geometryMode),w=s.useDataStore(r=>r.setGeometryMode),$=s.useUIStore(r=>r.setShowMeasurements),d=s.useUIStore(r=>r.showMeasurements),m=s.useUIStore(r=>r.showFeatureNameOnHover),W=s.useUIStore(r=>r.setShowFeatureNameOnHover),x=s.useUIStore(r=>r.topoEditEnabled),H=s.useUIStore(r=>r.setTopoEditEnabled),u=s.useUIStore(r=>r.autoExitAfterDraw),_=s.useUIStore(r=>r.setAutoExitAfterDraw),h=s.useUIStore(r=>r.snapEnabled),z=s.useUIStore(r=>r.setSnapEnabled),j=s.useUIStore(r=>r.userTheme),T=s.useUIStore(r=>r.setUserTheme),A=s.useTheme(),{pos:k,onHandleMouseDown:O}=v.useDragWindow("elm_settings_win",{x:80,y:80}),g=G.useElementEditorConfig(),{zIndex:N,focus:L}=v.useWindowFocus(c),b=p.useRef(null);l.useWindowEscape(b,c,()=>y(!1),N);const[i,q]=p.useState(()=>{try{const r=E.readStorage(I,g);return r?JSON.parse(r):U}catch{return U}}),F=p.useCallback((r,a)=>{E.writeStorage(I,JSON.stringify({w:r,h:a}),g)},[g]);function R(r){r.preventDefault(),r.stopPropagation();const a=r.clientX,f=r.clientY,B=i.w,P=i.h,Y=l.startDragShield("se-resize");function S(o){q({w:Math.max(D,Math.min(window.innerWidth*.9,B+o.clientX-a)),h:Math.max(C,Math.min(window.innerHeight*.85,P+o.clientY-f))})}function M(){Y(),document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",M);const o=b.current;o&&F(o.offsetWidth,o.offsetHeight)}document.addEventListener("mousemove",S),document.addEventListener("mouseup",M)}return c?e.jsxs("div",{ref:b,[l.WINDOW_ATTR]:"",role:"dialog","aria-label":"Settings",onMouseDownCapture:L,className:"fixed flex flex-col bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm-raised rounded-elm-window overflow-hidden","data-elm-theme":A,style:{left:k.x,top:k.y,zIndex:N,minWidth:D,minHeight:C,width:i.w,height:i.h,maxWidth:"90vw",maxHeight:"85vh"},children:[e.jsxs("div",{onMouseDown:O,className:"flex items-center justify-between px-4 py-3 border-b border-elm-border flex-shrink-0 select-none",style:{cursor:"grab"},children:[e.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-900)) dark:text-(--elm-text,var(--color-gray-100))",children:"Settings"}),e.jsx(v.CloseButton,{onClick:()=>y(!1),label:"Close settings"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-6 min-h-0",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-elm-text-secondary",children:"Appearance"}),e.jsx("div",{className:"flex rounded-elm border border-elm-border overflow-hidden",children:[{value:"light",label:"Light",Icon:n.Sun},{value:"dark",label:"Dark",Icon:n.Moon},{value:"system",label:"Auto",Icon:n.Desktop}].map(({value:r,label:a,Icon:f})=>e.jsxs("button",{onClick:()=>T(r),className:`flex-1 flex items-center justify-center gap-1.5 py-2 text-xs font-medium transition-colors ${j===r?"bg-primary-500 hover:bg-primary-600 text-white":"text-elm-text-muted hover:bg-elm-surface-hover hover:text-(--elm-text-secondary,var(--color-gray-700)) dark:hover:text-(--elm-text-secondary,var(--color-gray-200))"}`,children:[e.jsx(f,{size:14,weight:j===r?"fill":"regular"}),a]},r))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium text-elm-text-secondary",children:"Drawing mode"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("button",{onClick:()=>w("visual"),className:`p-3 text-center rounded-elm border text-sm transition-colors ${t==="visual"?"border-primary-500 bg-primary-50 dark:bg-white/5 hover:bg-primary-100 dark:hover:bg-white/10 ring-1 ring-primary-500/20":"border-(--elm-border,var(--color-gray-200)) dark:border-(--elm-border,var(--color-gray-600)) bg-elm-surface-raised hover:border-(--elm-border-strong,var(--color-gray-300)) dark:hover:border-(--elm-border-strong,var(--color-gray-500)) hover:bg-(--elm-surface-hover,var(--color-gray-50)) dark:hover:bg-(--elm-surface-hover,color-mix(in_oklab,var(--color-gray-700)_50%,transparent))"}`,children:[e.jsx(n.Monitor,{size:32,weight:t==="visual"?"fill":"regular",className:`mx-auto mb-2 ${t==="visual"?"text-primary-600":"text-elm-text-muted"}`}),e.jsx("span",{className:`block mb-1 font-semibold ${t==="visual"?"text-primary-800 dark:text-primary-300":"text-(--elm-text-secondary,var(--color-gray-700)) dark:text-(--elm-text-secondary,var(--color-gray-200))"}`,children:"Visual"}),e.jsx("p",{className:"text-xs leading-relaxed text-elm-text-muted",children:"Shapes keep their proportions on screen. Best for sketching and layouts."})]}),e.jsxs("button",{onClick:()=>w("spatial"),className:`p-3 text-center rounded-elm border text-sm transition-colors ${t==="spatial"?"border-primary-500 bg-primary-50 dark:bg-white/5 hover:bg-primary-100 dark:hover:bg-white/10 ring-1 ring-primary-500/20":"border-(--elm-border,var(--color-gray-200)) dark:border-(--elm-border,var(--color-gray-600)) bg-elm-surface-raised hover:border-(--elm-border-strong,var(--color-gray-300)) dark:hover:border-(--elm-border-strong,var(--color-gray-500)) hover:bg-(--elm-surface-hover,var(--color-gray-50)) dark:hover:bg-(--elm-surface-hover,color-mix(in_oklab,var(--color-gray-700)_50%,transparent))"}`,children:[e.jsx(n.GlobeHemisphereWest,{size:32,weight:t==="spatial"?"fill":"regular",className:`mx-auto mb-2 ${t==="spatial"?"text-primary-600":"text-elm-text-muted"}`}),e.jsx("span",{className:`block mb-1 font-semibold ${t==="spatial"?"text-primary-800 dark:text-primary-300":"text-(--elm-text-secondary,var(--color-gray-700)) dark:text-(--elm-text-secondary,var(--color-gray-200))"}`,children:"Spatial"}),e.jsx("p",{className:"text-xs leading-relaxed text-elm-text-muted",children:"Shapes keep their true size on the ground. Best for exact areas and distances."})]})]})]}),e.jsx("div",{className:"pt-4 border-t border-elm-border-subtle",children:e.jsxs("label",{className:"flex items-center justify-between cursor-pointer group",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 pr-4",children:[e.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-100))",children:"Show measurements"}),e.jsx("span",{className:"text-xs text-elm-text-muted",children:"Display live dimensions and coordinates at the cursor while drawing shapes."})]}),e.jsxs("div",{className:`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-elm-focus-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-elm-surface ${d?"bg-primary-500":"bg-(--elm-border-strong,var(--color-gray-200)) dark:bg-(--elm-border-strong,var(--color-gray-600))"}`,children:[e.jsx("span",{className:`${d?"translate-x-6":"translate-x-1"} inline-block h-4 w-4 transform rounded-full bg-white transition-transform`}),e.jsx("input",{type:"checkbox",className:"sr-only",checked:d,onChange:r=>$(r.target.checked)})]})]})}),e.jsx("div",{className:"pt-4 border-t border-elm-border-subtle",children:e.jsxs("label",{className:"flex items-center justify-between cursor-pointer group",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 pr-4",children:[e.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-100))",children:"Show name on hover"}),e.jsx("span",{className:"text-xs text-elm-text-muted",children:"Display the feature name when hovering over shapes on the map."})]}),e.jsxs("div",{className:`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-elm-focus-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-elm-surface ${m?"bg-primary-500":"bg-(--elm-border-strong,var(--color-gray-200)) dark:bg-(--elm-border-strong,var(--color-gray-600))"}`,children:[e.jsx("span",{className:`${m?"translate-x-6":"translate-x-1"} inline-block h-4 w-4 transform rounded-full bg-white transition-transform`}),e.jsx("input",{type:"checkbox",className:"sr-only",checked:m,onChange:r=>W(r.target.checked)})]})]})}),e.jsx("div",{className:"pt-4 border-t border-elm-border-subtle",children:e.jsxs("label",{className:"flex items-center justify-between cursor-pointer group",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 pr-4",children:[e.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-100))",children:"Topological editing"}),e.jsxs("span",{className:"text-xs text-elm-text-muted",children:["When editing points, shared borders between areas update together. Hold ",l.isMacPlatform()?"⌘ Cmd":"Ctrl"," to temporarily disable."]})]}),e.jsxs("div",{className:`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-elm-focus-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-elm-surface ${x?"bg-primary-500":"bg-(--elm-border-strong,var(--color-gray-200)) dark:bg-(--elm-border-strong,var(--color-gray-600))"}`,children:[e.jsx("span",{className:`${x?"translate-x-6":"translate-x-1"} inline-block h-4 w-4 transform rounded-full bg-white transition-transform`}),e.jsx("input",{type:"checkbox",className:"sr-only",checked:x,onChange:r=>H(r.target.checked)})]})]})}),e.jsx("div",{className:"pt-4 border-t border-elm-border-subtle",children:e.jsxs("label",{className:"flex items-center justify-between cursor-pointer group",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 pr-4",children:[e.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-100))",children:"Snapping"}),e.jsxs("span",{className:"text-xs text-elm-text-muted",children:["Snap to nearby points and edges while drawing. Hold ",l.isMacPlatform()?"⌘ Cmd":"Ctrl"," to temporarily disable."]})]}),e.jsxs("div",{className:`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-elm-focus-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-elm-surface ${h?"bg-primary-500":"bg-(--elm-border-strong,var(--color-gray-200)) dark:bg-(--elm-border-strong,var(--color-gray-600))"}`,children:[e.jsx("span",{className:`${h?"translate-x-6":"translate-x-1"} inline-block h-4 w-4 transform rounded-full bg-white transition-transform`}),e.jsx("input",{type:"checkbox",className:"sr-only",checked:h,onChange:r=>z(r.target.checked)})]})]})}),e.jsx("div",{className:"pt-4 border-t border-elm-border-subtle",children:e.jsxs("label",{className:"flex items-center justify-between cursor-pointer group",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 pr-4",children:[e.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-100))",children:"Return to select after each shape"}),e.jsx("span",{className:"text-xs text-elm-text-muted",children:"Drawing tools deactivate after every shape, so you go back to selection. Turn off to keep the tool active and draw multiple shapes in a row."})]}),e.jsxs("div",{className:`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-elm-focus-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-elm-surface ${u?"bg-primary-500":"bg-(--elm-border-strong,var(--color-gray-200)) dark:bg-(--elm-border-strong,var(--color-gray-600))"}`,children:[e.jsx("span",{className:`${u?"translate-x-6":"translate-x-1"} inline-block h-4 w-4 transform rounded-full bg-white transition-transform`}),e.jsx("input",{type:"checkbox",className:"sr-only",checked:u,onChange:r=>_(r.target.checked)})]})]})})]}),e.jsx("div",{onMouseDown:R,className:"absolute bottom-0 right-0 w-4 h-4 cursor-se-resize select-none",style:{zIndex:10},"aria-hidden":!0,children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"absolute bottom-1 right-1 text-elm-text-disabled",children:e.jsx("path",{d:"M9 1L1 9M9 5L5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null}exports.default=X;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("react"),v=require("./index-BKdDZ4Y9.cjs"),$=require("@phosphor-icons/react"),S=require("./useAdapterControls-BBObhzVX.cjs"),J=require("./useAccentStyle-hsGvyHZc.cjs"),b=require("@element-editor/core"),m=require("@element-editor/core/internal"),de=require("./EditToolbarBtn-dpCmKnzk.cjs"),D=require("./useWindowFocus-D-_yEm_V.cjs"),ue={"place-point":"point","draw-line":"line","draw-polygon":"polygon","draw-route":"route","draw-circle":"circle","draw-rect":"rectangle","draw-freehand":"freehand",picker:"picker"};function me({current:n,onCapture:s,onCancel:i}){const a=d.useRef(null);return d.useEffect(()=>{var r,l;(r=a.current)==null||r.focus(),(l=a.current)==null||l.select()},[]),t.jsx("input",{ref:a,readOnly:!0,value:n.toUpperCase(),size:1,onFocus:r=>r.currentTarget.select(),onKeyDown:r=>{if(r.preventDefault(),r.stopPropagation(),r.key==="Escape"){i();return}r.key.length===1&&!r.metaKey&&!r.ctrlKey&&!r.altKey&&r.key!==" "&&s(r.key.toLowerCase())},onBlur:i,"aria-label":"Press a key to rebind",className:"inline-block w-6 h-5 text-[11px] font-medium font-elm rounded-elm-chip border border-primary-400 bg-primary-50 text-primary-700 text-center p-0 outline-none caret-transparent selection:bg-primary-500 selection:text-white"})}function he(){const n=S.useUIStore(e=>e.shortcutsModalOpen),s=S.useUIStore(e=>e.closeShortcutsModal),i=S.useUIStore(e=>e.readonly),a=S.useUIStore(e=>e.unavailableTools),{tools:r,ui:l,toolbar:j}=J.useElementEditorConfig(),k=j.direction==="vertical",x=r==="all"?null:new Set(r);function p(e){if(e==="toggle-table")return l.dataTable;if(e==="toggle-geojson")return l.geojsonEditor;if(e==="toggle-schema")return l.schemaEditor;if(e==="toggle-sidebar")return l.layerList;if(e==="set-zoom")return l.zoomIndicator;const o=ue[e];return o&&a.includes(o)?!1:o&&x?x.has(o):!0}const{custom:g,getKey:G,setKey:Q,resetKey:ee,resetAll:te}=v.useShortcutConfig(),[E,T]=d.useState(null),[c,u]=d.useState(null),{pos:L,onHandleMouseDown:re}=D.useDragWindow("elm_shortcuts_win",{x:24,y:120}),N=J.useElementEditorConfig(),{zIndex:z,focus:oe}=D.useWindowFocus(n),H="elm_shortcuts_win_size",K=250,F=260,M=d.useRef(null);v.useWindowEscape(M,n,s,z);const[y,ne]=d.useState(()=>{try{const e=b.readStorage(H,N);return e?JSON.parse(e):{w:440,h:560}}catch{return{w:440,h:560}}}),se=d.useCallback((e,o)=>{b.writeStorage(H,JSON.stringify({w:e,h:o}),N)},[N]);function le(e){e.preventDefault(),e.stopPropagation();const o=e.clientX,f=e.clientY,w=y.w,O=y.h,R=v.startDragShield("se-resize");function V(h){ne({w:Math.max(K,Math.min(window.innerWidth*.9,w+h.clientX-o)),h:Math.max(F,Math.min(window.innerHeight*.85,O+h.clientY-f))})}function Y(){R(),document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",Y);const h=M.current;h&&se(h.offsetWidth,h.offsetHeight)}document.addEventListener("mousemove",V),document.addEventListener("mouseup",Y)}if(d.useEffect(()=>{if(!n||E===null)return;function e(o){o.key==="Escape"&&(W(),o.stopPropagation())}return window.addEventListener("keydown",e,{capture:!0}),()=>window.removeEventListener("keydown",e,{capture:!0})},[n,E]),!n)return null;function ie(e,o){var w;const f=Q(e,o);if(f){const O=((w=m.CUSTOMIZABLE_SHORTCUTS.find(R=>R.id===f))==null?void 0:w.label)??f;u({id:e,msg:`"${o.toUpperCase()}" is already used by "${O}"`,attemptedKey:o});return}u(null),T(null)}function W(){T(null),u(null)}function ae(e){T(e),u(null)}function _(e){return{label:e.label,isChanged:g[e.id]!==void 0,isCapturing:E===e.id,keyDisplay:G(e.id),onStartCapture:()=>ae(e.id),onCapture:o=>ie(e.id,o),onCancelCapture:W,onReset:()=>{ee(e.id),u(null)},conflictMsg:(c==null?void 0:c.id)===e.id?c.msg:void 0,onDismissConflict:()=>u(null),captureDisplay:(c==null?void 0:c.id)===e.id?c.attemptedKey:void 0}}const A=m.CUSTOMIZABLE_SHORTCUTS.filter(e=>e.category==="drawing"&&!i&&p(e.id)),q=m.CUSTOMIZABLE_SHORTCUTS.filter(e=>e.category==="view"&&p(e.id)),B=m.CUSTOMIZABLE_SHORTCUTS.filter(e=>e.category==="editing"&&!i&&p(e.id)),P=m.FIXED_SHORTCUTS.filter(e=>e.category==="view"&&!(k&&e.label==="Search places")),X=i?[]:m.FIXED_SHORTCUTS.filter(e=>e.category==="editing"),Z=i?[]:m.FIXED_SHORTCUTS.filter(e=>e.category==="drawing"),ce=Object.keys(g).length>0;return t.jsxs("div",{ref:M,[v.WINDOW_ATTR]:"",role:"dialog","aria-label":"Keyboard shortcuts",onMouseDownCapture:oe,className:"fixed flex flex-col bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm-raised rounded-elm-window overflow-hidden",style:{left:L.x,top:L.y,zIndex:z,minWidth:K,minHeight:F,width:y.w,height:y.h,maxWidth:"90vw",maxHeight:"85vh"},children:[t.jsxs("div",{onMouseDown:re,className:"flex items-center justify-between px-4 py-3 border-b border-elm-border flex-shrink-0 select-none",style:{cursor:"grab"},children:[t.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-900)) dark:text-(--elm-text,var(--color-gray-100))",children:"Keyboard shortcuts"}),t.jsx(D.CloseButton,{onClick:s,label:"Close keyboard shortcuts"})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pt-3 pb-2 space-y-4 min-h-0",children:[A.length>0&&t.jsx(C,{title:"Drawing tools",children:A.map(e=>t.jsx(U,{..._(e)},e.id))}),(q.length>0||P.length>0)&&t.jsxs(C,{title:"View",children:[q.map(e=>t.jsx(U,{..._(e)},e.id)),P.map(e=>t.jsx(I,{label:e.label,display:b.getFixedShortcutFullDisplay(e.id)},e.id))]}),(B.length>0||X.length>0)&&t.jsxs(C,{title:"Editing",children:[B.map(e=>t.jsx(U,{..._(e)},e.id)),X.map(e=>t.jsx(I,{label:e.label,display:b.getFixedShortcutFullDisplay(e.id)},e.id))]}),Z.length>0&&t.jsx(C,{title:"While drawing",children:Z.map(e=>t.jsx(I,{label:e.label,display:b.getFixedShortcutFullDisplay(e.id)},e.id))})]}),t.jsxs("div",{className:"flex-shrink-0 border-t border-elm-border-subtle px-6 py-2.5 flex items-center justify-between gap-3",children:[t.jsx("p",{className:"text-xs text-elm-text-subtle flex-1",children:"Click a key badge to rebind it"}),ce&&t.jsxs("button",{onClick:()=>{te(),u(null)},className:"flex items-center gap-1 text-xs text-elm-text-subtle hover:text-(--elm-text-secondary,var(--color-gray-700)) dark:hover:text-(--elm-text-secondary,var(--color-gray-300)) hover:bg-elm-surface-hover rounded-elm-chip px-1.5 py-0.5 -mr-1.5 transition-colors flex-shrink-0",children:[t.jsx($.ArrowCounterClockwise,{size:11}),"Reset all"]})]}),t.jsx("div",{onMouseDown:le,className:"absolute bottom-0 right-0 w-4 h-4 cursor-se-resize select-none",style:{zIndex:10},"aria-hidden":!0,children:t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"absolute bottom-1 right-1 text-elm-text-disabled",children:t.jsx("path",{d:"M9 1L1 9M9 5L5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})}function C({title:n,children:s}){return t.jsxs("section",{children:[t.jsx("h3",{className:"text-[10px] font-semibold text-elm-text-subtle uppercase tracking-wider mb-1.5 px-2",children:n}),t.jsx("div",{className:"space-y-0.5",children:s})]})}function U({label:n,isChanged:s,isCapturing:i,keyDisplay:a,onStartCapture:r,onCapture:l,onCancelCapture:j,onReset:k,conflictMsg:x,onDismissConflict:p,captureDisplay:g}){return t.jsxs("div",{className:"flex items-center justify-between py-1 px-2 rounded-elm-card hover:bg-(--elm-surface-hover,var(--color-gray-50)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-800)) group",children:[t.jsx("span",{className:"text-sm text-elm-text-secondary",children:n}),t.jsxs("div",{className:"flex items-center gap-1.5 relative",children:[x&&t.jsxs("button",{type:"button",onClick:p,className:"absolute right-full mr-2 top-1/2 -translate-y-1/2 whitespace-nowrap bg-rose-500/95 text-white text-xs px-2.5 py-1.5 rounded-elm-card shadow-elm backdrop-blur-sm hover:bg-rose-600/95 transition-colors","aria-label":"Dismiss conflict message",children:[x,t.jsx("span",{"aria-hidden":!0,className:"absolute left-full top-1/2 -translate-y-1/2 border-4 border-transparent border-l-rose-500/95"})]}),s&&t.jsx("button",{onClick:k,className:"p-0.5 rounded-elm-chip text-elm-text hover:bg-(--elm-surface-hover,var(--color-gray-200)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700)) transition-colors","aria-label":"Reset to default",title:"Reset to default",children:t.jsx($.ArrowCounterClockwise,{size:14,weight:"bold"})}),i?t.jsx(me,{current:g??a,onCapture:l,onCancel:j},g??a):t.jsx("button",{onClick:r,title:"Click to rebind",className:"inline-flex items-center justify-center min-w-[1.5rem] h-5 px-1.5 text-[11px] font-medium font-elm rounded-elm-chip transition-colors border border-elm-border-strong bg-(--elm-surface-hover,var(--color-gray-100)) dark:bg-(--elm-surface-hover,var(--color-gray-700)) text-elm-text-muted shadow-[0_1px_0_0_rgba(0,0,0,0.15)] hover:bg-(--elm-control-hover,var(--color-gray-200)) dark:hover:bg-(--elm-control-hover,var(--color-gray-600)) hover:border-(--elm-border-strong,var(--color-gray-400)) dark:hover:border-(--elm-border-strong,var(--color-gray-500))",children:a.toUpperCase()})]})]})}function I({label:n,display:s}){return t.jsxs("div",{className:"flex items-center justify-between py-1 px-2 rounded-elm-card",children:[t.jsx("span",{className:"text-sm text-elm-text-secondary",children:n}),t.jsx(de.Kbd,{children:s})]})}exports.ShortcutsModal=he;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("react"),v=require("./index-DG4wEjGj.cjs"),$=require("@phosphor-icons/react"),S=require("./useAdapterControls-BBObhzVX.cjs"),J=require("./useAccentStyle-hsGvyHZc.cjs"),b=require("@element-editor/core"),m=require("@element-editor/core/internal"),de=require("./EditToolbarBtn-Ch9HCLHq.cjs"),D=require("./useWindowFocus-EemgNOuz.cjs"),ue={"place-point":"point","draw-line":"line","draw-polygon":"polygon","draw-route":"route","draw-circle":"circle","draw-rect":"rectangle","draw-freehand":"freehand",picker:"picker"};function me({current:n,onCapture:s,onCancel:i}){const a=d.useRef(null);return d.useEffect(()=>{var r,l;(r=a.current)==null||r.focus(),(l=a.current)==null||l.select()},[]),t.jsx("input",{ref:a,readOnly:!0,value:n.toUpperCase(),size:1,onFocus:r=>r.currentTarget.select(),onKeyDown:r=>{if(r.preventDefault(),r.stopPropagation(),r.key==="Escape"){i();return}r.key.length===1&&!r.metaKey&&!r.ctrlKey&&!r.altKey&&r.key!==" "&&s(r.key.toLowerCase())},onBlur:i,"aria-label":"Press a key to rebind",className:"inline-block w-6 h-5 text-[11px] font-medium font-elm rounded-elm-chip border border-primary-400 bg-primary-50 text-primary-700 text-center p-0 outline-none caret-transparent selection:bg-primary-500 selection:text-white"})}function he(){const n=S.useUIStore(e=>e.shortcutsModalOpen),s=S.useUIStore(e=>e.closeShortcutsModal),i=S.useUIStore(e=>e.readonly),a=S.useUIStore(e=>e.unavailableTools),{tools:r,ui:l,toolbar:j}=J.useElementEditorConfig(),k=j.direction==="vertical",x=r==="all"?null:new Set(r);function p(e){if(e==="toggle-table")return l.dataTable;if(e==="toggle-geojson")return l.geojsonEditor;if(e==="toggle-schema")return l.schemaEditor;if(e==="toggle-sidebar")return l.layerList;if(e==="set-zoom")return l.zoomIndicator;const o=ue[e];return o&&a.includes(o)?!1:o&&x?x.has(o):!0}const{custom:g,getKey:G,setKey:Q,resetKey:ee,resetAll:te}=v.useShortcutConfig(),[E,T]=d.useState(null),[c,u]=d.useState(null),{pos:L,onHandleMouseDown:re}=D.useDragWindow("elm_shortcuts_win",{x:24,y:120}),N=J.useElementEditorConfig(),{zIndex:z,focus:oe}=D.useWindowFocus(n),H="elm_shortcuts_win_size",K=250,F=260,M=d.useRef(null);v.useWindowEscape(M,n,s,z);const[y,ne]=d.useState(()=>{try{const e=b.readStorage(H,N);return e?JSON.parse(e):{w:440,h:560}}catch{return{w:440,h:560}}}),se=d.useCallback((e,o)=>{b.writeStorage(H,JSON.stringify({w:e,h:o}),N)},[N]);function le(e){e.preventDefault(),e.stopPropagation();const o=e.clientX,f=e.clientY,w=y.w,O=y.h,R=v.startDragShield("se-resize");function V(h){ne({w:Math.max(K,Math.min(window.innerWidth*.9,w+h.clientX-o)),h:Math.max(F,Math.min(window.innerHeight*.85,O+h.clientY-f))})}function Y(){R(),document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",Y);const h=M.current;h&&se(h.offsetWidth,h.offsetHeight)}document.addEventListener("mousemove",V),document.addEventListener("mouseup",Y)}if(d.useEffect(()=>{if(!n||E===null)return;function e(o){o.key==="Escape"&&(W(),o.stopPropagation())}return window.addEventListener("keydown",e,{capture:!0}),()=>window.removeEventListener("keydown",e,{capture:!0})},[n,E]),!n)return null;function ie(e,o){var w;const f=Q(e,o);if(f){const O=((w=m.CUSTOMIZABLE_SHORTCUTS.find(R=>R.id===f))==null?void 0:w.label)??f;u({id:e,msg:`"${o.toUpperCase()}" is already used by "${O}"`,attemptedKey:o});return}u(null),T(null)}function W(){T(null),u(null)}function ae(e){T(e),u(null)}function _(e){return{label:e.label,isChanged:g[e.id]!==void 0,isCapturing:E===e.id,keyDisplay:G(e.id),onStartCapture:()=>ae(e.id),onCapture:o=>ie(e.id,o),onCancelCapture:W,onReset:()=>{ee(e.id),u(null)},conflictMsg:(c==null?void 0:c.id)===e.id?c.msg:void 0,onDismissConflict:()=>u(null),captureDisplay:(c==null?void 0:c.id)===e.id?c.attemptedKey:void 0}}const A=m.CUSTOMIZABLE_SHORTCUTS.filter(e=>e.category==="drawing"&&!i&&p(e.id)),q=m.CUSTOMIZABLE_SHORTCUTS.filter(e=>e.category==="view"&&p(e.id)),B=m.CUSTOMIZABLE_SHORTCUTS.filter(e=>e.category==="editing"&&!i&&p(e.id)),P=m.FIXED_SHORTCUTS.filter(e=>e.category==="view"&&!(k&&e.label==="Search places")),X=i?[]:m.FIXED_SHORTCUTS.filter(e=>e.category==="editing"),Z=i?[]:m.FIXED_SHORTCUTS.filter(e=>e.category==="drawing"),ce=Object.keys(g).length>0;return t.jsxs("div",{ref:M,[v.WINDOW_ATTR]:"",role:"dialog","aria-label":"Keyboard shortcuts",onMouseDownCapture:oe,className:"fixed flex flex-col bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm-raised rounded-elm-window overflow-hidden",style:{left:L.x,top:L.y,zIndex:z,minWidth:K,minHeight:F,width:y.w,height:y.h,maxWidth:"90vw",maxHeight:"85vh"},children:[t.jsxs("div",{onMouseDown:re,className:"flex items-center justify-between px-4 py-3 border-b border-elm-border flex-shrink-0 select-none",style:{cursor:"grab"},children:[t.jsx("span",{className:"text-sm font-semibold text-(--elm-text,var(--color-gray-900)) dark:text-(--elm-text,var(--color-gray-100))",children:"Keyboard shortcuts"}),t.jsx(D.CloseButton,{onClick:s,label:"Close keyboard shortcuts"})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pt-3 pb-2 space-y-4 min-h-0",children:[A.length>0&&t.jsx(C,{title:"Drawing tools",children:A.map(e=>t.jsx(U,{..._(e)},e.id))}),(q.length>0||P.length>0)&&t.jsxs(C,{title:"View",children:[q.map(e=>t.jsx(U,{..._(e)},e.id)),P.map(e=>t.jsx(I,{label:e.label,display:b.getFixedShortcutFullDisplay(e.id)},e.id))]}),(B.length>0||X.length>0)&&t.jsxs(C,{title:"Editing",children:[B.map(e=>t.jsx(U,{..._(e)},e.id)),X.map(e=>t.jsx(I,{label:e.label,display:b.getFixedShortcutFullDisplay(e.id)},e.id))]}),Z.length>0&&t.jsx(C,{title:"While drawing",children:Z.map(e=>t.jsx(I,{label:e.label,display:b.getFixedShortcutFullDisplay(e.id)},e.id))})]}),t.jsxs("div",{className:"flex-shrink-0 border-t border-elm-border-subtle px-6 py-2.5 flex items-center justify-between gap-3",children:[t.jsx("p",{className:"text-xs text-elm-text-subtle flex-1",children:"Click a key badge to rebind it"}),ce&&t.jsxs("button",{onClick:()=>{te(),u(null)},className:"flex items-center gap-1 text-xs text-elm-text-subtle hover:text-(--elm-text-secondary,var(--color-gray-700)) dark:hover:text-(--elm-text-secondary,var(--color-gray-300)) hover:bg-elm-surface-hover rounded-elm-chip px-1.5 py-0.5 -mr-1.5 transition-colors flex-shrink-0",children:[t.jsx($.ArrowCounterClockwise,{size:11}),"Reset all"]})]}),t.jsx("div",{onMouseDown:le,className:"absolute bottom-0 right-0 w-4 h-4 cursor-se-resize select-none",style:{zIndex:10},"aria-hidden":!0,children:t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"absolute bottom-1 right-1 text-elm-text-disabled",children:t.jsx("path",{d:"M9 1L1 9M9 5L5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})}function C({title:n,children:s}){return t.jsxs("section",{children:[t.jsx("h3",{className:"text-[10px] font-semibold text-elm-text-subtle uppercase tracking-wider mb-1.5 px-2",children:n}),t.jsx("div",{className:"space-y-0.5",children:s})]})}function U({label:n,isChanged:s,isCapturing:i,keyDisplay:a,onStartCapture:r,onCapture:l,onCancelCapture:j,onReset:k,conflictMsg:x,onDismissConflict:p,captureDisplay:g}){return t.jsxs("div",{className:"flex items-center justify-between py-1 px-2 rounded-elm-card hover:bg-(--elm-surface-hover,var(--color-gray-50)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-800)) group",children:[t.jsx("span",{className:"text-sm text-elm-text-secondary",children:n}),t.jsxs("div",{className:"flex items-center gap-1.5 relative",children:[x&&t.jsxs("button",{type:"button",onClick:p,className:"absolute right-full mr-2 top-1/2 -translate-y-1/2 whitespace-nowrap bg-rose-500/95 text-white text-xs px-2.5 py-1.5 rounded-elm-card shadow-elm backdrop-blur-sm hover:bg-rose-600/95 transition-colors","aria-label":"Dismiss conflict message",children:[x,t.jsx("span",{"aria-hidden":!0,className:"absolute left-full top-1/2 -translate-y-1/2 border-4 border-transparent border-l-rose-500/95"})]}),s&&t.jsx("button",{onClick:k,className:"p-0.5 rounded-elm-chip text-elm-text hover:bg-(--elm-surface-hover,var(--color-gray-200)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700)) transition-colors","aria-label":"Reset to default",title:"Reset to default",children:t.jsx($.ArrowCounterClockwise,{size:14,weight:"bold"})}),i?t.jsx(me,{current:g??a,onCapture:l,onCancel:j},g??a):t.jsx("button",{onClick:r,title:"Click to rebind",className:"inline-flex items-center justify-center min-w-[1.5rem] h-5 px-1.5 text-[11px] font-medium font-elm rounded-elm-chip transition-colors border border-elm-border-strong bg-(--elm-surface-hover,var(--color-gray-100)) dark:bg-(--elm-surface-hover,var(--color-gray-700)) text-elm-text-muted shadow-[0_1px_0_0_rgba(0,0,0,0.15)] hover:bg-(--elm-control-hover,var(--color-gray-200)) dark:hover:bg-(--elm-control-hover,var(--color-gray-600)) hover:border-(--elm-border-strong,var(--color-gray-400)) dark:hover:border-(--elm-border-strong,var(--color-gray-500))",children:a.toUpperCase()})]})]})}function I({label:n,display:s}){return t.jsxs("div",{className:"flex items-center justify-between py-1 px-2 rounded-elm-card",children:[t.jsx("span",{className:"text-sm text-elm-text-secondary",children:n}),t.jsx(de.Kbd,{children:s})]})}exports.ShortcutsModal=he;
@@ -1,13 +1,13 @@
1
1
  import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
2
  import { useState as z, useRef as q, useCallback as me, useEffect as G } from "react";
3
- import { b as he, u as pe, W as fe, s as ge } from "./index-CtZterPc.js";
3
+ import { b as he, u as pe, W as fe, s as ge } from "./index-CILw1Du5.js";
4
4
  import { ArrowCounterClockwise as Q } from "@phosphor-icons/react";
5
5
  import { u as y } from "./useAdapterControls-DVjkwRZ_.js";
6
6
  import { u as $ } from "./useAccentStyle-CPo2XqAn.js";
7
7
  import { readStorage as be, writeStorage as xe, getFixedShortcutFullDisplay as T } from "@element-editor/core";
8
8
  import { CUSTOMIZABLE_SHORTCUTS as w, FIXED_SHORTCUTS as W } from "@element-editor/core/internal";
9
- import { K as ye } from "./EditToolbarBtn-SZIsnIn3.js";
10
- import { u as we, a as ve, C as Ce } from "./useWindowFocus-DGAWA1au.js";
9
+ import { K as ye } from "./EditToolbarBtn-SR4xHd8G.js";
10
+ import { u as we, a as ve, C as Ce } from "./useWindowFocus-DuQVjnHE.js";
11
11
  const ke = {
12
12
  "place-point": "point",
13
13
  "draw-line": "line",
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BKdDZ4Y9.cjs"),o=require("./useAdapterControls-BBObhzVX.cjs"),r=require("./useAccentStyle-hsGvyHZc.cjs"),n=require("@element-editor/core"),t=require("./EditToolbarBtn-dpCmKnzk.cjs");exports.ActiveDrawingToolbar=e.ActiveDrawingToolbar;exports.BasemapPicker=e.BasemapPicker;exports.BooleanOperations=e.BooleanOperations;exports.BufferPanel=e.BufferPanel;exports.ControlGroup=e.ControlGroup;exports.DataTable=e.DataTable;exports.DataTablePanel=e.DataTablePanel;exports.EditingToolbar=e.EditingToolbar;exports.ElementEditorErrorBoundary=e.ElementEditorErrorBoundary;exports.ElementEditorUIProvider=e.ElementEditorUIProvider;exports.FeatureEditModal=e.FeatureEditModal;exports.FeatureList=e.FeatureList;exports.FeatureMapContextMenu=e.FeatureMapContextMenu;exports.FeatureRow=e.FeatureRow;exports.FeatureSidePanel=e.FeatureSidePanel;exports.FitBoundsButton=e.FitBoundsButton;exports.FloatingToolbar=e.FloatingToolbar;exports.GeoJSONDockPlaceholder=e.GeoJSONDockPlaceholder;exports.GeoJSONModal=e.GeoJSONModal;exports.GroupRow=e.GroupRow;exports.IconButton=e.IconButton;exports.LayersPanel=e.LayersPanel;exports.LocateButton=e.LocateButton;exports.PartSubRow=e.PartSubRow;exports.ReadonlyBanner=e.ReadonlyBanner;exports.RedoButton=e.RedoButton;exports.SchemaEditor=e.SchemaEditor;exports.SchemaModal=e.SchemaModal;exports.SettingsModal=e.SettingsModal;exports.ShortcutConfigProvider=e.ShortcutConfigProvider;exports.ShortcutsModal=e.ShortcutsModal;exports.SimplifyPanel=e.SimplifyPanel;exports.SmoothPanel=e.SmoothPanel;exports.UndoButton=e.UndoButton;exports.UndoRedoToolbar=e.UndoRedoToolbar;exports.VertexSelectionBar=e.VertexSelectionBar;exports.ZoomIndicator=e.ZoomIndicator;exports.disposeGeometryWorker=e.disposeGeometryWorker;exports.featureLabel=e.featureLabel;exports.preloadEditorPanelsWhenIdle=e.preloadEditorPanelsWhenIdle;exports.runGeometryWorkerOperation=e.runGeometryWorkerOperation;exports.useAccentPalette=e.useAccentPalette;exports.useDataChangeSubscription=e.useDataChangeSubscription;exports.useGeoJSONDrop=e.useGeoJSONDrop;exports.useGeoJSONExport=e.useGeoJSONExport;exports.useIsEventForEditor=e.useIsEventForEditor;exports.useKeyboardShortcuts=e.useKeyboardShortcuts;exports.useShortcutConfig=e.useShortcutConfig;exports.ElementToaster=o.ElementToaster;exports.EventProvider=o.EventProvider;exports.GeoStoreProvider=o.GeoStoreProvider;exports.MapControllerProvider=o.MapControllerProvider;exports.StoreContext=o.StoreContext;exports.ThemeContext=o.ThemeContext;exports.ThemeReportingProvider=o.ThemeReportingProvider;exports.saveGeoJSONFile=o.saveGeoJSONFile;exports.triggerGeoJSONDownload=o.triggerGeoJSONDownload;exports.useAdapterControls=o.useAdapterControls;exports.useDataStore=o.useDataStore;exports.useEmit=o.useEmit;exports.useGeoStore=o.useGeoStore;exports.useIsManaged=o.useIsManaged;exports.useMapController=o.useMapController;exports.useNominatim=o.useNominatim;exports.useReportThemeFromRoot=o.useReportThemeFromRoot;exports.useSetMapController=o.useSetMapController;exports.useTheme=o.useTheme;exports.useToasterId=o.useToasterId;exports.useUIStore=o.useUIStore;exports.DEFAULT_LAYOUT=r.DEFAULT_LAYOUT;exports.ElementEditorConfigProvider=r.ElementEditorConfigProvider;exports.accentStyle=r.accentStyle;exports.resolveConfig=r.resolveConfig;exports.useAccentStyle=r.useAccentStyle;exports.useApplyAccentToRoot=r.useApplyAccentToRoot;exports.useElementEditorConfig=r.useElementEditorConfig;exports.useUnitsOverride=r.useUnitsOverride;exports.withLayout=r.withLayout;Object.defineProperty(exports,"ElementEditorError",{enumerable:!0,get:()=>n.ElementEditorError});exports.Button=t.Button;exports.CONTEXT_MENU_MARKER_ATTR=t.CONTEXT_MENU_MARKER_ATTR;exports.ContextMenu=t.ContextMenu;exports.EditToolbarBtn=t.EditToolbarBtn;exports.Input=t.Input;exports.Kbd=t.Kbd;exports.KbdDark=t.KbdDark;exports.KbdInvert=t.KbdInvert;exports.SearchDropdown=t.SearchDropdown;exports.SelectInput=t.SelectInput;exports.Textarea=t.Textarea;exports.ToolButton=t.ToolButton;exports.ToolbarDivider=t.ToolbarDivider;exports.Tooltip=t.Tooltip;exports.isContextMenuOpen=t.isContextMenuOpen;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DG4wEjGj.cjs"),o=require("./useAdapterControls-BBObhzVX.cjs"),r=require("./useAccentStyle-hsGvyHZc.cjs"),n=require("@element-editor/core"),t=require("./EditToolbarBtn-Ch9HCLHq.cjs");exports.ActiveDrawingToolbar=e.ActiveDrawingToolbar;exports.BasemapPicker=e.BasemapPicker;exports.BooleanOperations=e.BooleanOperations;exports.BufferPanel=e.BufferPanel;exports.ControlGroup=e.ControlGroup;exports.DataTable=e.DataTable;exports.DataTablePanel=e.DataTablePanel;exports.EditingToolbar=e.EditingToolbar;exports.ElementEditorErrorBoundary=e.ElementEditorErrorBoundary;exports.ElementEditorUIProvider=e.ElementEditorUIProvider;exports.FeatureEditModal=e.FeatureEditModal;exports.FeatureList=e.FeatureList;exports.FeatureMapContextMenu=e.FeatureMapContextMenu;exports.FeatureRow=e.FeatureRow;exports.FeatureSidePanel=e.FeatureSidePanel;exports.FitBoundsButton=e.FitBoundsButton;exports.FloatingToolbar=e.FloatingToolbar;exports.GeoJSONDockPlaceholder=e.GeoJSONDockPlaceholder;exports.GeoJSONModal=e.GeoJSONModal;exports.GroupRow=e.GroupRow;exports.IconButton=e.IconButton;exports.LayersPanel=e.LayersPanel;exports.LocateButton=e.LocateButton;exports.PartSubRow=e.PartSubRow;exports.ReadonlyBanner=e.ReadonlyBanner;exports.RedoButton=e.RedoButton;exports.SchemaEditor=e.SchemaEditor;exports.SchemaModal=e.SchemaModal;exports.SettingsModal=e.SettingsModal;exports.ShortcutConfigProvider=e.ShortcutConfigProvider;exports.ShortcutsModal=e.ShortcutsModal;exports.SimplifyPanel=e.SimplifyPanel;exports.SmoothPanel=e.SmoothPanel;exports.UndoButton=e.UndoButton;exports.UndoRedoToolbar=e.UndoRedoToolbar;exports.VertexSelectionBar=e.VertexSelectionBar;exports.ZoomIndicator=e.ZoomIndicator;exports.disposeGeometryWorker=e.disposeGeometryWorker;exports.featureLabel=e.featureLabel;exports.preloadEditorPanelsWhenIdle=e.preloadEditorPanelsWhenIdle;exports.runGeometryWorkerOperation=e.runGeometryWorkerOperation;exports.useAccentPalette=e.useAccentPalette;exports.useDataChangeSubscription=e.useDataChangeSubscription;exports.useGeoJSONDrop=e.useGeoJSONDrop;exports.useGeoJSONExport=e.useGeoJSONExport;exports.useIsEventForEditor=e.useIsEventForEditor;exports.useKeyboardShortcuts=e.useKeyboardShortcuts;exports.useShortcutConfig=e.useShortcutConfig;exports.ElementToaster=o.ElementToaster;exports.EventProvider=o.EventProvider;exports.GeoStoreProvider=o.GeoStoreProvider;exports.MapControllerProvider=o.MapControllerProvider;exports.StoreContext=o.StoreContext;exports.ThemeContext=o.ThemeContext;exports.ThemeReportingProvider=o.ThemeReportingProvider;exports.saveGeoJSONFile=o.saveGeoJSONFile;exports.triggerGeoJSONDownload=o.triggerGeoJSONDownload;exports.useAdapterControls=o.useAdapterControls;exports.useDataStore=o.useDataStore;exports.useEmit=o.useEmit;exports.useGeoStore=o.useGeoStore;exports.useIsManaged=o.useIsManaged;exports.useMapController=o.useMapController;exports.useNominatim=o.useNominatim;exports.useReportThemeFromRoot=o.useReportThemeFromRoot;exports.useSetMapController=o.useSetMapController;exports.useTheme=o.useTheme;exports.useToasterId=o.useToasterId;exports.useUIStore=o.useUIStore;exports.DEFAULT_LAYOUT=r.DEFAULT_LAYOUT;exports.ElementEditorConfigProvider=r.ElementEditorConfigProvider;exports.accentStyle=r.accentStyle;exports.resolveConfig=r.resolveConfig;exports.useAccentStyle=r.useAccentStyle;exports.useApplyAccentToRoot=r.useApplyAccentToRoot;exports.useElementEditorConfig=r.useElementEditorConfig;exports.useUnitsOverride=r.useUnitsOverride;exports.withLayout=r.withLayout;Object.defineProperty(exports,"ElementEditorError",{enumerable:!0,get:()=>n.ElementEditorError});exports.Button=t.Button;exports.CONTEXT_MENU_MARKER_ATTR=t.CONTEXT_MENU_MARKER_ATTR;exports.ContextMenu=t.ContextMenu;exports.EditToolbarBtn=t.EditToolbarBtn;exports.Input=t.Input;exports.Kbd=t.Kbd;exports.KbdDark=t.KbdDark;exports.KbdInvert=t.KbdInvert;exports.SearchDropdown=t.SearchDropdown;exports.SelectInput=t.SelectInput;exports.Textarea=t.Textarea;exports.ToolButton=t.ToolButton;exports.ToolbarDivider=t.ToolbarDivider;exports.Tooltip=t.Tooltip;exports.isContextMenuOpen=t.isContextMenuOpen;
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { A as o, B as s, v as t, w as r, x as n, D as i, y as l, E as u, z as d, H as S, I as p, J as E, K as c, e as m, F as T, L as h, M as P, O as b, Q as C, G as v, R as B, S as M, T as f, P as g, U as x, V as D, X as G, Y as R, Z as I, _ as O, $ as y, a0 as F, a1 as A, a2 as N, a3 as U, a4 as w, a5 as L, a6 as J, l as K, a7 as k, c as _, a8 as W, a9 as j, aa as V, ab as X, ac as Y, ad as Z, b as q } from "./index-CtZterPc.js";
2
+ import { A as o, B as s, v as t, w as r, x as n, D as i, y as l, E as u, z as d, H as S, I as p, J as E, K as c, e as m, F as T, L as h, M as P, O as b, Q as C, G as v, R as B, S as M, T as f, P as g, U as x, V as D, X as G, Y as R, Z as I, _ as O, $ as y, a0 as F, a1 as A, a2 as N, a3 as U, a4 as w, a5 as L, a6 as J, l as K, a7 as k, c as _, a8 as W, a9 as j, aa as V, ab as X, ac as Y, ad as Z, b as q } from "./index-CILw1Du5.js";
3
3
  import { o as H, m as Q, G as $, M as aa, S as ea, p as oa, T as sa, s as ta, t as ra, q as na, f as ia, h as la, e as ua, i as da, g as Sa, l as pa, r as Ea, v as ca, d as ma, j as Ta, u as ha } from "./useAdapterControls-DVjkwRZ_.js";
4
4
  import { D as ba, E as Ca, g as va, h as Ba, e as Ma, j as fa, u as ga, k as xa, m as Da } from "./useAccentStyle-CPo2XqAn.js";
5
5
  import { ElementEditorError as Ra } from "@element-editor/core";
6
- import { B as Oa, h as ya, C as Fa, E as Aa, I as Na, K as Ua, a as wa, b as La, S as Ja, c as Ka, T as ka, d as _a, e as Wa, f as ja, i as Va } from "./EditToolbarBtn-SZIsnIn3.js";
6
+ import { B as Oa, h as ya, C as Fa, E as Aa, I as Na, K as Ua, a as wa, b as La, S as Ja, c as Ka, T as ka, d as _a, e as Wa, f as ja, i as Va } from "./EditToolbarBtn-SR4xHd8G.js";
7
7
  export {
8
8
  o as ActiveDrawingToolbar,
9
9
  s as BasemapPicker,