efficient-easel 3.7.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/buckets-Tj-nkBpg.d.ts +28 -0
- package/dist/chrome/chrome.css +30 -2
- package/dist/chrome/index.js +1 -1
- package/dist/chunk-37DMJPHL.js +14 -0
- package/dist/chunk-3GX7XBAF.js +5 -0
- package/dist/chunk-3ZJSLHHI.js +8 -0
- package/dist/chunk-4JSBIW5H.js +9 -0
- package/dist/{chunk-42TMLDSQ.js → chunk-6TOYXESC.js} +1 -1
- package/dist/chunk-BXQBCW3P.js +1 -0
- package/dist/{chunk-CRG625FM.js → chunk-C7ERK4DF.js} +3 -3
- package/dist/chunk-CRWFB7MU.js +21 -0
- package/dist/{chunk-RKSKUGWC.js → chunk-ETDRAF3O.js} +65 -65
- package/dist/{chunk-LZ6EGT4Y.js → chunk-G5JILVHG.js} +1 -1
- package/dist/{chunk-2I7MAA2U.js → chunk-HQWQLDCB.js} +1 -1
- package/dist/{chunk-XBNOEQMR.js → chunk-I7ER3P4U.js} +1 -1
- package/dist/chunk-KFV7N2DJ.js +1 -0
- package/dist/{chunk-SCPCXNTB.js → chunk-KJ2RODGT.js} +1 -1
- package/dist/chunk-KSTX646X.js +5 -0
- package/dist/chunk-MQNBD6AB.js +1 -0
- package/dist/{chunk-5SOSVTVI.js → chunk-PFNIVZPN.js} +1 -1
- package/dist/{chunk-6N64PNWF.js → chunk-RQWJOPRB.js} +1 -1
- package/dist/{chunk-GTDLBUOC.js → chunk-UB4TLWVJ.js} +6 -6
- package/dist/{chunk-MUZNA23W.js → chunk-UQ6CD3K2.js} +1 -1
- package/dist/{chunk-WSNVBUPL.js → chunk-Y324X4U4.js} +1 -1
- package/dist/drag/drag.css +5 -56
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.d.ts +2 -2
- package/dist/fields/fields.css +4 -0
- package/dist/fields/index.d.ts +103 -51
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.d.ts +8 -2
- package/dist/panel/index.js +19 -12
- package/dist/panel/panel.css +19 -0
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +15 -15
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +1 -1
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/puck/field-buckets.d.ts +20 -6
- package/dist/screen/lib/puck/field-buckets.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +15 -6
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +9 -42
- package/dist/strings/catalogue.d.ts +2 -2
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +1 -1
- package/dist/tree/index.d.ts +8 -4
- package/dist/tree/index.js +1 -1
- package/dist/tree/tree.css +6 -3
- package/dist/{types-BqGnUVX5.d.ts → types-BLRK6_JO.d.ts} +7 -0
- package/dist/{types-CWxUxPGO.d.ts → types-OUl0mK1k.d.ts} +5 -2
- package/dist/{words-BGrHZAJJ.d.ts → words-zH1H0WFw.d.ts} +8 -3
- package/package.json +3 -3
- package/dist/buckets-CuLM47h9.d.ts +0 -13
- package/dist/chunk-2GLQRNYT.js +0 -16
- package/dist/chunk-7P6IFCR4.js +0 -1
- package/dist/chunk-CRPJGCSO.js +0 -20
- package/dist/chunk-LUSM3QTY.js +0 -5
- package/dist/chunk-QTLAVDJE.js +0 -1
- package/dist/chunk-R2HLPNQF.js +0 -1
- package/dist/chunk-UFY6RNMT.js +0 -9
- package/dist/chunk-YIKMVF24.js +0 -5
- package/dist/chunk-YNOZ5NXW.js +0 -14
package/README.md
CHANGED
|
@@ -915,6 +915,19 @@ const easel = createEasel<EaselConfig>({ config, data, onChange: (doc) => autosa
|
|
|
915
915
|
press where a person types — a text field, a textarea, an editable
|
|
916
916
|
region — to that field's own undo. Left out, a press there undoes the
|
|
917
917
|
easel's step, as Puck's did; the provider and the canvas bind so.
|
|
918
|
+
- **Two tabs since 4.0.0: Design and Animation.** A field's `bucket` is one
|
|
919
|
+
of `SETTINGS_BUCKETS`; anything else (the 3.x `Content`, `Style`, `Layout`)
|
|
920
|
+
is ignored, so the rows stay in the tab above them. Inside Design the host
|
|
921
|
+
emits its group headings in `DESIGN_GROUPS` order under `DESIGN_GROUP_KEY`
|
|
922
|
+
and passes its text box to `Inspector` as `lead` (drawn before the first
|
|
923
|
+
row; `children` stay after the last). The strip is the shell's `Tabs`
|
|
924
|
+
(`underline`, `block`); a tab with an icon in `tabIcons` is icon-only, its
|
|
925
|
+
word kept as its name and its Tooltip.
|
|
926
|
+
- **Folding bands since 4.0.0, one level.** A marker with `fold: '<title>'`
|
|
927
|
+
starts a band: the rows after it, up to the next fold marker or tab marker,
|
|
928
|
+
are drawn inside one `SettingsGroup` (− / +, open by default). `leadFold`
|
|
929
|
+
puts `lead` in a band of its own; `closedFolds` + `onFold` let the host hold
|
|
930
|
+
which bands are closed. A folded band's rows stay mounted.
|
|
918
931
|
- **`planFields().rows` holds `slot` rows.** They draw nothing and are there so
|
|
919
932
|
the slot's name has a bucket. Filter `row.field.type !== 'slot'` before
|
|
920
933
|
drawing or counting rows of your own.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The settings tab words, in the owner's order: Design, Animation (owner
|
|
3
|
+
* 2026-10-08, final 2026-10-10). It replaces the four buckets of 2026-09-11
|
|
4
|
+
* (Content, Style, Layout, Animation): what was in Content now sits at the TOP
|
|
5
|
+
* of Design, and Style and Layout merge into Design. A panel shows only the
|
|
6
|
+
* tabs that hold a setting — an empty tab is hidden, never drawn.
|
|
7
|
+
*
|
|
8
|
+
* ONE list for both editors. The website editor wrote the first one in
|
|
9
|
+
* `efficient-storefront/lib/puck/field-groups.ts` (`BUCKETS`); from 0.43.0 it
|
|
10
|
+
* lives here, so the campaign editor spells its panel with the same words in
|
|
11
|
+
* the same order instead of keeping a second list.
|
|
12
|
+
*/
|
|
13
|
+
declare const SETTINGS_BUCKETS: readonly ["Design", "Animation"];
|
|
14
|
+
type SettingsBucket = (typeof SETTINGS_BUCKETS)[number];
|
|
15
|
+
/**
|
|
16
|
+
* The groups INSIDE the Design tab, in the owner's order (2026-10-10): the
|
|
17
|
+
* Content part first, with no heading of its own (the text box and the rows
|
|
18
|
+
* that were the Content tab), then Size, Design, Layout, Position and Anchor.
|
|
19
|
+
*
|
|
20
|
+
* A key, not a word: what each group is CALLED is `PanelWords.designGroups`.
|
|
21
|
+
* The host emits a heading for each group it has (`DESIGN_GROUP_KEY` in
|
|
22
|
+
* `screen/lib/puck/field-buckets`); Content's is a marker that draws nothing.
|
|
23
|
+
* One list for both editors, like `SETTINGS_BUCKETS`.
|
|
24
|
+
*/
|
|
25
|
+
declare const DESIGN_GROUPS: readonly ["Content", "Size", "Design", "Layout", "Position", "Anchor"];
|
|
26
|
+
type DesignGroup = (typeof DESIGN_GROUPS)[number];
|
|
27
|
+
|
|
28
|
+
export { type DesignGroup as D, type SettingsBucket as S, DESIGN_GROUPS as a, SETTINGS_BUCKETS as b };
|
package/dist/chrome/chrome.css
CHANGED
|
@@ -297,8 +297,9 @@ span:has(> .es-insp-up-btn) {
|
|
|
297
297
|
}
|
|
298
298
|
.es-insp-head {
|
|
299
299
|
display: flex;
|
|
300
|
+
flex-wrap: wrap;
|
|
300
301
|
align-items: center;
|
|
301
|
-
gap: 12px;
|
|
302
|
+
gap: 8px 12px;
|
|
302
303
|
padding: 12px 16px;
|
|
303
304
|
flex: none;
|
|
304
305
|
}
|
|
@@ -368,8 +369,34 @@ span:has(> .es-insp-up-btn) {
|
|
|
368
369
|
width: 15px;
|
|
369
370
|
height: 15px;
|
|
370
371
|
}
|
|
372
|
+
/* AT A NARROW PANEL THE TITLE WINS (Lewis/GG, 2026-10-14). At 220px the chip
|
|
373
|
+
and the buttons left the name 33px ("Hero Slideshow" read "He…"), and
|
|
374
|
+
the registry's longest names ("Photo Submission Form", 150px) were cut even
|
|
375
|
+
at 320. The titles now ask for their whole name (`flex: 1 0 auto` over a
|
|
376
|
+
one-line name is its full width) and never shrink below it, so when the row
|
|
377
|
+
cannot hold name and buttons the BUTTONS wrap to a second row, at its right
|
|
378
|
+
end, where Hide panel already sits:
|
|
379
|
+
row 1 [chip] Photo Submission Form
|
|
380
|
+
Section
|
|
381
|
+
row 2 [dup] [del] | [hide]
|
|
382
|
+
A wide panel, or a short name, keeps one row. Only a name wider than the
|
|
383
|
+
whole row (none in the registry) is still cut, with its words in the
|
|
384
|
+
Tooltip: `max-width` is the row less the chip (26) and the gap (12).
|
|
385
|
+
Not an overflow menu: three buttons fit a 196px row, so folding them would
|
|
386
|
+
hide Duplicate and Remove behind a click and buy the name nothing. */
|
|
371
387
|
.es-insp-titles {
|
|
372
|
-
flex: 1;
|
|
388
|
+
flex: 1 0 auto;
|
|
389
|
+
min-width: 0;
|
|
390
|
+
max-width: calc(100% - 38px);
|
|
391
|
+
}
|
|
392
|
+
/* The shell Tooltip's wrapper round the name: a block that may shrink, so the
|
|
393
|
+
name's ellipsis still applies inside it. */
|
|
394
|
+
.es-insp-name-tip {
|
|
395
|
+
position: relative;
|
|
396
|
+
display: flex;
|
|
397
|
+
min-width: 0;
|
|
398
|
+
}
|
|
399
|
+
.es-insp-name-tip > .es-insp-name {
|
|
373
400
|
min-width: 0;
|
|
374
401
|
}
|
|
375
402
|
/* An h2 carries `0.83em 0` from the UA sheet; `margin: 0` keeps the head closed. */
|
|
@@ -391,6 +418,7 @@ span:has(> .es-insp-up-btn) {
|
|
|
391
418
|
align-items: center;
|
|
392
419
|
gap: 2px;
|
|
393
420
|
flex: none;
|
|
421
|
+
margin-left: auto;
|
|
394
422
|
}
|
|
395
423
|
/* A side panel's head has two pieces besides its glyph buttons (MediaPanelHead,
|
|
396
424
|
card [MERGE] One Media Panel Head, 2026-10-06; until then each editor's own
|
package/dist/chrome/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MediaPanelHead,PanelResizeHandle,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,mediaPickKind,panelWidthVars,setPanelWidthVars}from"../chunk-
|
|
1
|
+
export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MediaPanelHead,PanelResizeHandle,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,mediaPickKind,panelWidthVars,setPanelWidthVars}from"../chunk-UB4TLWVJ.js";import"../chunk-Y2G7CU6A.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-MFIRYGHW.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{DEFAULT_DRAG_WORDS as e}from"./chunk-O2NLQBFX.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as r,isNoOpDrop as a}from"./chunk-67GNT6PF.js";import{useCanvasLayout as o,useCanvasEvent as s}from"./chunk-PAELDYYS.js";import{framePointToHost as i,elementScale as c,frameRectToLayer as d,clientPointToLayer as u}from"./chunk-ZNCEOSXO.js";import{withTip as h}from"./chunk-P2VEMZH5.js";import{parseZoneKey as f}from"./chunk-KRXQM65X.js";import{useRef as p,useEffect as m,useState as g,useCallback as b,useMemo as y,useSyncExternalStore as v,useId as x,useLayoutEffect as k}from"react";import{Tooltip as w,Input as N,IconButton as A}from"efficient-shell/ui";import{jsxs as z,jsx as D}from"react/jsx-runtime";import{CloseIcon as T,SearchIcon as C}from"efficient-shell/icons/efficient";var S=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,E=e=>e.width*e.height;function $(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>S(e.box,t,n)).sort((e,t)=>E(t.s.box)-E(e.s.box)||e.at-t.at).map(({s:e})=>e)}function L(e,t,n){return $(e,t,n).at(-1)??null}function j(e,t,n){const l="x"===e.axis?t:n;let r=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(r+=1)}return r}function M(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],r=n[t],a=l&&r?(l.left+l.width+r.left)/2:l?l.left+l.width:r?r.left:e.box.left,o=r??l??e.box;return{left:a-1,top:o.top,width:2,height:o.height}}const l=n[t-1],r=n[t],a=l&&r?(l.top+l.height+r.top)/2:l?l.top+l.height:r?r.top:e.box.top;return{left:e.box.left,top:a-1,width:e.box.width,height:2}}function B(e,t,n,l,r=()=>!1,a=()=>!0){const o=e.filter(e=>S(e.box,t,n)).sort((e,t)=>E(e.box)-E(t.box));for(const e of o){const o=j(e,t,n),s={...e.list,index:o};if(r(s))return null;if(l(s))return{zone:e,to:s,line:M(e,o)};if(!a(s))return null}return null}function O(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const r=e.children[l-1],a=e.children[l],o=r.top+r.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(a.top-o,0)}})}return n}var K={nodes:[],zones:[]},X="data-puck-dropzone",q="data-puck-component";function P(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function Y(e,t){const{frame:n,document:l}=e,r=e=>d(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),a=[],o=[];for(const e of l.querySelectorAll(`[${X}]`)){const t=e.getAttribute(X)??"";let n;try{n=f(t)}catch{continue}const l=[...e.querySelectorAll(`[${q}]`)].filter(t=>t.parentElement?.closest(`[${X}]`)===e),s=l.map(r);o.push({key:t,list:n,box:r(e),axis:P(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(q);l&&a.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:a,zones:o}}var Z="data-es-empty-cell",F="data-puck-dropzone",R=140;var I=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function Q(d){const{canvas:h,session:f,readOnly:x,words:N=e.canvas}=d,A=p(d);m(()=>{A.current=d});const T=p(null),C=o(h),[S,E]=g(0),L=b(()=>E(e=>e+1),[]),[j,M]=g(K);m(()=>{const e=T.current;h&&e&&M((A.current.measure??Y)(h,e))},[h,C,d.revision,S]);const O=d.model,X=y(()=>O(j),[O,j]),q=v(f.subscribe,f.shown,f.shown),P=d.choose,R=(e,t)=>{const n=$(X.sources,e,t);return 0===n.length?null:P?P(n):n[n.length-1]},[Q,V]=g(null),[G,H]=g(null),W=p(null),J=()=>{W.current&&clearTimeout(W.current),W.current=null},U=()=>{J(),W.current=setTimeout(()=>{f.get()||V(null)},140)};m(()=>J,[]);const _=p(null);s(h,"mousemove",e=>{const t=T.current;if(!h||!t)return;const n=i(h.frame,e.clientX,e.clientY,t),l=c(t),r={x:n.x/l,y:n.y/l};if(_.current=r,A.current.readOnly||f.get())return;J();const a=R(r.x,r.y);V(e=>e?.key===a?.key&&e?.box===a?.box?e:a)}),s(h,"mouseout",e=>{e.relatedTarget||(_.current=null,U())}),s(h,"mouseover",e=>{e.relatedTarget||L()});const ee=p(null),te=b(()=>{ee.current?.(),ee.current=null,H(null)},[]);m(()=>f.subscribe(()=>{f.get()?L():te()}),[f,te,L]),m(()=>te,[te]),("undefined"==typeof document?m:k)(()=>{if(f.get())return;const e=_.current;V(t=>x?null:e?R(e.x,e.y):t?X.sources.find(e=>e.key===t.key)??null:null)},[X,q,f,x,P]);const ne=e=>{const t=f.get(),n=T.current;if(!t||!n)return null;const l=u(n,e.clientX,e.clientY);_.current=l;const r=B(X.zones,l.x,l.y,e=>A.current.canDrop(t.item,e),e=>!!t.from&&a(t.from,e),e=>A.current.fallThrough?.(t.item,e,t.from)??!0);return r?{h:t,t:r}:null},le={onDragEnter:e=>{if(ee.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),a=h?l(h.document):null,o=[];t&&o.push(r(t)),a&&h&&o.push(r(a,h.frame)),ee.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=ne(e);if(!n)return void H(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};H(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(_.current=null,H(null))},onDrop:e=>{const t=ne(e);t&&(e.preventDefault(),f.end(),te(),A.current.onDrop(t.h.item,t.t.to))}},re={draggable:!x&&!!Q,onMouseEnter:J,onMouseLeave:()=>!f.get()&&U(),onDragStart:e=>{if(Q&&!x){f.start({key:Q.key,item:Q.item,from:Q.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",Q.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{f.end(),te()},onClick:()=>{Q&&!x&&A.current.onPick?.(Q.item)}},{seams:ae=[]}=X,oe=X.zones.filter(e=>0===e.children.length),se=d.onZoneAdd&&!x?oe:[],ie=se.map(e=>e.key).join("\n");return m(()=>{const e=h?.document;if(!e)return;const t=new Set(ie?ie.split("\n"):[]);for(const n of e.querySelectorAll(`[${F}]`))n.toggleAttribute(Z,t.has(n.getAttribute(F)??""));return()=>{for(const t of e.querySelectorAll(`[${Z}]`))t.removeAttribute(Z)}},[h,ie,j,C,S]),/* @__PURE__ */z("div",{ref:T,className:"es-canvas-layer",children:[q||!d.onSeamAdd||x?null:ae.map(e=>/* @__PURE__ */D("div",{className:"es-canvas-seam",style:{left:e.box.left,top:e.box.top+e.box.height/2-8,width:e.box.width,height:16},children:/* @__PURE__ */D("button",{type:"button",className:"es-canvas-seam-add",onClick:()=>d.onSeamAdd?.(e.place),children:N.addButton({label:d.seamLabel??N.addSection})})},e.key)),se.length?se.map(e=>/* @__PURE__ */D("button",{type:"button",className:G?.zoneKey===e.key?"es-canvas-empty is-over":"es-canvas-empty",style:I(e.box),onClick:()=>d.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */D("span",{className:"es-canvas-empty-add",children:N.addButton({label:d.zoneAddLabel??N.addBlock})})},e.key)):null,q?/* @__PURE__ */D("div",{className:"es-canvas-catch",...le}):null,G&&!oe.some(e=>e.key===G.zoneKey)?/* @__PURE__ */D("div",{className:`es-canvas-line is-${G.axis}`,style:I(G.line)}):null,
|
|
2
|
+
/* @__PURE__ */D("div",{className:"es-canvas-handle-spot",style:Q?{"--es-handle-x":`${Q.box.left+2}px`,"--es-handle-y":`${Math.max(Q.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */D(w,{className:"es-canvas-handle-tip",side:"top",content:!Q||x||q?null:Q.title??N.handle({label:Q.label}),children:/* @__PURE__ */z("div",{className:["es-canvas-handle",Q&&!x?"is-shown":"",q?"is-dragging":""].filter(Boolean).join(" "),...re,children:[
|
|
3
|
+
/* @__PURE__ */D("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),Q?.label]})})})]})}var V=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function G({groups:t,session:n,itemFor:l,onInsert:r,at:a,hint:o,searchLabel:s,readOnly:i,words:c=e.add}){const d=o??c.hint,u=s??c.search,[f,p]=g(""),m=x(),b=f.trim().toLowerCase(),y=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),v=t.map((e,t)=>({...e,key:y[t],tiles:b?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,b)):e.tiles})).filter(e=>e.tiles.length>0),k=(e,t)=>r=>{if(t)r.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),r.dataTransfer.effectAllowed="copy";try{r.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
|
|
4
|
+
return z("div",{className:"es-add",children:[a?/* @__PURE__ */z("div",{className:"es-add-at",role:"status",children:[
|
|
5
|
+
/* @__PURE__ */D("span",{children:a.label}),h(c.stop,/* @__PURE__ */D("button",{type:"button",className:"es-add-at-clear","aria-label":c.stop,onClick:a.onClear,children:/* @__PURE__ */D(T,{size:12,"aria-hidden":"true"})}))]}):null,
|
|
6
|
+
/* @__PURE__ */D("p",{className:"es-add-hint",children:d}),
|
|
7
|
+
/* @__PURE__ */D("div",{className:"es-add-find",children:/* @__PURE__ */D(N,{id:m,type:"search","aria-label":u,placeholder:c.searchPlaceholder({label:u}),value:f,onChange:e=>p(e.target.value),leftIcon:/* @__PURE__ */D(C,{size:16,"aria-hidden":"true"}),rightAdornment:f?/* @__PURE__ */D(A,{size:"sm","aria-label":c.clearSearch,onClick:()=>p(""),children:/* @__PURE__ */D(T,{size:12,"aria-hidden":"true"})}):void 0})}),0===v.length?/* @__PURE__ */z("div",{className:"es-add-empty",role:"status",children:[
|
|
8
|
+
/* @__PURE__ */D("div",{className:"es-add-empty-title",children:c.nothing({query:f.trim()})}),
|
|
9
|
+
/* @__PURE__ */D("div",{className:"es-add-empty-sub",children:c.tryAnother})]}):v.map(e=>/* @__PURE__ */z("section",{className:"es-add-group","aria-label":e.title,children:[
|
|
10
|
+
/* @__PURE__ */z("div",{className:"es-add-group-head",children:[
|
|
11
|
+
/* @__PURE__ */D("span",{className:"es-add-group-title",children:e.title}),
|
|
12
|
+
/* @__PURE__ */D("span",{className:"es-add-group-count",children:e.tiles.length})]}),
|
|
13
|
+
/* @__PURE__ */D("div",{className:V(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(i||e.disabled),l=i?void 0:e.disabled?e.disabledReason:e.title??c.tile({label:e.label});return h(l,/* @__PURE__ */z("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":c.tile({label:e.label}),onDragStart:k(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&r(e.type),children:[null!=e.cover?/* @__PURE__ */D("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */D("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
|
|
14
|
+
/* @__PURE__ */D("span",{className:"es-add-tile-label",children:e.label})]},e.type))})})]},e.key))]})}export{G as AddPanel,Q as CanvasDragLayer,K as EMPTY_MEASURE,R as HANDLE_GRACE_MS,B as canvasTarget,S as contains,j as gapInZone,M as gapLine,Y as measureCanvas,L as pickSource,O as seamsBetween,$ as sourcesAt};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-PFNIVZPN.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-KSTX646X.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-MCHMF32I.js";import{useEasel as f}from"./chunk-XW4AV5N4.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-37DMJPHL.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-O2NLQBFX.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as $,jsxs as B,Fragment as N}from"react/jsx-runtime";var O=e=>`section:${e}`,v=e=>`block:${e}`,I=e=>`template:${e}`;function V({blocks:V,blocksOnly:x,at:F,onAdd:H,itemFor:L,session:A,siteWide:P,onClose:C,onHide:D,readOnly:M}){const T=f(e=>e.config),X=p(),{labelAtLevel:w,categoryLabel:Q,firstSection:R,Icon:S,Thumbnail:W}=X,{blockIsOffered:z}=m(),J=u("screen",d).add,K=u("drag",h).add,Y=l(),[Z,E]=y([]);b(()=>{let t=!1;const o=e=>z(e,Y);return s(Y).list().then(n=>{if(t)return;const i=T.components;E(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[T,Y]);const G=j(()=>t(T,X),[T]),q=e=>({type:O(e.type),label:e.name,cover:/* @__PURE__ */$(W,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:J.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),U=j(()=>{const e=[];if(V&&V.choices.length>0&&a(V.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${J.inside({name:V.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:v(e.type),label:e.label,icon:/* @__PURE__ */$(S,{type:e.type,size:18}),title:J.tile({name:e.label})}))})}),x)return e;const t=o(G,R);t&&e.push({key:"start",title:J.startBlank,tiles:[q(t)]}),Z.length>0&&e.push({key:"templates",title:J.templates,tiles:Z.map(e=>{return{type:I(e.id),label:e.name,cover:/* @__PURE__ */$(W,{type:e.node.type}),keywords:[(t=e.node.type,w(t,"section",T.components[t]?.label??t)),e.node.type]};var t})});const s=n(G,R);for(const t of Object.keys(T.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(T,t,Q),tiles:o.map(q)})}return e},[V,x,Z,G,T,J]),_=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=Z.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
+
return B(N,{children:[
|
|
3
|
+
/* @__PURE__ */$(r,{icon:/* @__PURE__ */$(g,{size:15}),title:J.title,context:x?J.contextBlocks:J.contextAll,actions:/* @__PURE__ */$(c,{label:J.done,description:J.doneDescription,onClick:C}),onHide:D}),
|
|
4
|
+
/* @__PURE__ */B("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
+
/* @__PURE__ */$(k,{groups:U,session:A,itemFor:e=>L(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&H(t)},at:F,hint:x?J.hintBlocks:J.hint,searchLabel:x?J.searchBlocks:J.searchSections,readOnly:M,words:K}),P&&!x?P:null]})]})}export{V as AddSidePanel,v as blockKey,O as sectionKey,I as templateKey};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{SettingsSwitch as e}from"./chunk-QLD57GBB.js";import{jsxs as n,jsx as l,Fragment as a}from"react/jsx-runtime";import{isValidElement as i,cloneElement as s}from"react";function r({title:e,open:a,onToggle:i,count:s,id:r,children:c,className:d}){const o=r?`${r}-body`:void 0;/* @__PURE__ */
|
|
2
|
+
return n("div",{className:d?`es-group ${d}`:"es-group",children:[
|
|
3
|
+
/* @__PURE__ */n("button",{type:"button",id:r,"aria-expanded":a,"aria-controls":o,className:"es-group-head",onClick:()=>i(!a),children:[e,"number"==typeof s&&s>0?/* @__PURE__ */l("span",{className:"es-group-count",children:s}):null,
|
|
4
|
+
/* @__PURE__ */l("span",{className:"es-group-sign","aria-hidden":"true"})]}),
|
|
5
|
+
/* @__PURE__ */l("div",{id:o,className:"es-group-body",hidden:!a,children:c})]})}function c(e){return Array.isArray(e)?e.some(c):i(e)}function d(n,l,a){if(!i(n)||n.type!==e)return n;const r=n.props;return r.ariaLabel||r.ariaLabelledBy?n:s(n,a?{ariaLabelledBy:a}:{ariaLabel:l})}function o({label:e,labelId:i,icon:s,value:r,hint:o,changed:t,htmlFor:u,action:h,children:m,className:p}){const f=c(m),N=c(h);if(!f&&!N)return null;const b=["es-field"];f||b.push("is-inline"),t&&b.push("is-changed"),p&&b.push(p);const g=/* @__PURE__ */n(a,{children:[s?/* @__PURE__ */l("span",{className:"es-field-icon","aria-hidden":"true",children:s}):null,
|
|
6
|
+
/* @__PURE__ */l("span",{className:"es-field-label",id:i,children:e})]});/* @__PURE__ */
|
|
7
|
+
return n("div",{className:b.join(" "),children:[
|
|
8
|
+
/* @__PURE__ */n("div",{className:"es-field-head",children:[u?/* @__PURE__ */l("label",{className:"es-field-name",htmlFor:u,children:g}):/* @__PURE__ */l("span",{className:"es-field-name",children:g}),null!=r?/* @__PURE__ */l("span",{className:"es-field-value",children:r}):null,N?d(h,e,i):null]}),f?/* @__PURE__ */l("div",{className:"es-field-ctl",children:m}):null,o?/* @__PURE__ */l("p",{className:"es-field-hint",children:o}):null]})}var t=Object.freeze(["Design","Animation"]),u=Object.freeze(["Content","Size","Design","Layout","Position","Anchor"]);export{u as DESIGN_GROUPS,t as SETTINGS_BUCKETS,o as SettingsField,r as SettingsGroup};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{DEFAULT_TREE_WORDS as e}from"./chunk-K56YDHYQ.js";import{useContext as r,createContext as a,isValidElement as o}from"react";import{Tree as n,TreeGroupLabel as l,TreeGroup as i,Tooltip as s,TreeRow as t,IconButton as d,TreeSeam as c,TreeEmptySlot as m}from"efficient-shell/ui";import{jsx as p,jsxs as g,Fragment as u}from"react/jsx-runtime";var h,b=()=>h??=a(1),f=()=>r(b());function k({className:r,children:a,rootProps:o,ariaLabel:l,words:i=e}){/* @__PURE__ */
|
|
2
|
+
return p(n,{"aria-label":l??i.name??e.name,className:r?`es-tree ${r}`:"es-tree",rootProps:o,children:a})}function v({children:e,count:r,expanded:a,onToggle:o}){/* @__PURE__ */
|
|
3
|
+
return p(l,{count:r,expanded:a,onToggle:o,children:e})}function w({children:e}){const r=f(),a=b();/* @__PURE__ */
|
|
4
|
+
return p(a.Provider,{value:r+1,children:/* @__PURE__ */p(i,{children:e})})}var N=e.dragHint,P=e=>[e].flat(1/0).some(e=>o(e)&&!0===e.props.pressed);function T({icon:r,name:a,preview:o,selected:n,hidden:l,draggable:i,dragHint:d,dragging:c,drop:m,fold:h,actions:b,nameSlot:k,onSelect:v,marks:w,badge:N,trailing:T,children:y,rowProps:A,level:S,words:x=e}){const H=f(),j=["es-tree-row",n?"is-selected":"",l?"is-hidden":"",i?"is-draggable":"",c?"is-dragging":"",m?`is-drop-${m}`:""].filter(Boolean).join(" "),B=/* @__PURE__ */g(u,{children:[
|
|
5
|
+
/* @__PURE__ */p("span",{className:"es-tree-name",children:a}),w?.map(e=>/* @__PURE__ */p(s,{content:e.label,children:/* @__PURE__ */p("span",{className:"es-tree-mark","aria-label":e.label,role:"img",children:e.icon})},e.key)),T?/* @__PURE__ */p(s,{content:T.label,children:/* @__PURE__ */p("span",{className:"es-tree-trailing","aria-label":T.label,role:"img",children:T.icon})}):null,y]}),C=A?.onClick,$={click:!1},D=C?e=>{C(e),$.click=!0,queueMicrotask(()=>{$.click=!1})}:void 0,L=v?()=>{$.click||v()}:void 0;/* @__PURE__ */
|
|
6
|
+
return p(t,{label:B,level:S??H,icon:r,preview:o,selected:!!n,expanded:h?h.open:void 0,onToggle:h?.onToggle,onSelect:L,muted:!!l,badge:N,actions:b,actionsPinned:P(b),rename:k,drop:m,dragging:!!c,draggable:!!i,dragHint:d??x.dragHint,className:j,rowProps:{...A,onClick:D,...i?{"aria-keyshortcuts":"Alt+ArrowUp Alt+ArrowDown"}:{}}})}function y({kind:e,label:r,onClick:a,pressed:o,disabled:n,children:l}){/* @__PURE__ */
|
|
7
|
+
return p(s,{content:r,children:/* @__PURE__ */p(d,{"aria-label":r,"aria-pressed":o,"aria-disabled":n||void 0,variant:"delete"===e?"ghost-danger":"ghost",size:"sm","data-kind":e,className:n?"es-tree-act-off":void 0,onClick:e=>{e.stopPropagation(),a()},children:l})})}function A({drop:e,onAdd:r,label:a,seamProps:o}){const n=["es-tree-seam",e?"is-drop":"",r?"has-add":"",o?.className??""].filter(Boolean).join(" "),l={...o,className:n};/* @__PURE__ */
|
|
8
|
+
return p(c,{drop:!!e,onInsert:r,label:a,seamProps:l})}function S({drop:r,onAdd:a,label:o,seamProps:n,words:l=e}){const i=o??(a?l.addBlock??e.addBlock:l.emptySlot??e.emptySlot),s={...n,className:n?.className?`es-tree-empty ${n.className}`:"es-tree-empty"};/* @__PURE__ */
|
|
9
|
+
return p(m,{drop:!!r,onAdd:a,label:i,slotProps:s})}export{k as LayersTree,w as Subtree,N as TREE_DRAG_HINT,S as TreeEmptySlot,v as TreeGroupLabel,T as TreeRow,y as TreeRowAction,A as TreeSeam};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_PANEL_W as s,clampPanelWidth as e}from"./chunk-
|
|
1
|
+
import{DEFAULT_PANEL_W as s,clampPanelWidth as e}from"./chunk-UB4TLWVJ.js";var a="sf-editor-panel-widths",l="sf-editor-collapsed-sections";function t(s){return s?{panelWidths:`${s}-panel-widths`,collapsed:`${s}-collapsed-sections`}:{panelWidths:a,collapsed:l}}var o={...s},d=s=>e(s);export{l as COLLAPSED_SECTIONS_KEY,o as DEFAULT_PANEL_W,a as PANEL_WIDTHS_KEY,d as clampPanelWidth,t as screenStorageKeys};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{panelFieldsOf as t}from"./chunk-ZE7I3PLX.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-PAM3NLFL.js";import{DESIGN_GROUP_KEY as e,BUCKET_KEY as r}from"./chunk-MQNBD6AB.js";import{ANCHOR_FIELD_KEYS as s,foldMetaOf as c,MEDIA_FIELD_MARKER as i,TEXT_FIELD_MARKER as p,LINK_FIELD_MARKER as u}from"./chunk-DUVRZ456.js";import{STYLE_KIND as a,fieldKind as f,copyStyle as l,heldStyle as m,planPaste as h,pasteMessage as y}from"./chunk-V7U33NF2.js";var j=/* @__PURE__ */new Set([e.Size,e.Design,e.Layout,e.Position]),w=new Set(Object.values(e)),b=new Set(Object.values(r)),S=new Set(s),g=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[i,p,u];function v(t){return`site:${t??""}`}function L(t){if(!t||"object"!=typeof t)return null;const n=t,e=o(t)??t,r=n[a]??e[a];if("string"==typeof r)return r;const s=n.options??e.options;if(Array.isArray(s)){return`choice:${s.map(t=>String(t?.value)).sort().join("|")}`}return f(e)}function A(t){const n=t,e=o(t);return k.some(t=>t in n||e&&t in e)}function D(o,e){const s=t(o,e)??{},i=[];let p=!0,u=!1;for(const[t,o]of Object.entries(s))b.has(t)?(p=t===r.Design,u=!1):w.has(t)?p&&(u=j.has(t)):u&&o&&"object"==typeof o&&!t.startsWith("_")&&(c(o)||S.has(t)||g.has(t)||A(o)||"slot"!==o.type&&i.push({path:[t],kind:L(o),counted:"mobile"!==n(o)?.tier}));return i}function d(t,o,n,e,r){l({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function F(t,o,n,e,r,s){const c=m(n);if(!c)return null;const i=h(c,{type:e.type,rows:t(o,e),props:e.props});return{...i,message:y(i,c.sourceLabel,r,s)}}function N(t,o,n,e){d(D,t,o,n,e)}function O(t,o,n,e,r){return F(D,t,o,n,e,r)}var P={scope:t=>v(t.siteId),rows:(t,o)=>D(t,o),copy:(t,o,n,e)=>N(e,t,o,n),plan:(t,o,n,e)=>O(e,t,o,n)};function B(t,o){if(!t&&!o)return P;const n=t?.rows,e=n?(t,o)=>n(t,o):D;return{scope:t?.scope??P.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>d(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>F(e,s,t,n,r,o))}}export{N as copyNodeStyle,D as nodeStyleRows,O as planNodePaste,L as shopFieldKind,v as siteStyleScope,B as styleClipboardOf};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as r}from"./chunk-
|
|
1
|
+
import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as r}from"./chunk-G5JILVHG.js";import{ScreenChrome as e}from"./chunk-ETDRAF3O.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-WZMU646D.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.js";import{documentPermissions as o}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t}from"react";import{Dialog as d,Button as l}from"efficient-shell/ui";import{jsx as m,jsxs as g,Fragment as h}from"react/jsx-runtime";var f=n(r),v=n(e);function p({saving:n,onCancel:r,onDiscard:e,onSave:i}){const a=c("screen",s).leave;/* @__PURE__ */
|
|
2
2
|
return m(d,{open:!0,role:"alertdialog",size:"sm",title:a.title,onClose:r,footer:/* @__PURE__ */g(h,{children:[
|
|
3
3
|
/* @__PURE__ */m(l,{variant:"secondary",onClick:r,children:a.cancel}),
|
|
4
4
|
/* @__PURE__ */m(l,{variant:"ghost-danger",onClick:e,children:a.discard}),
|
|
5
5
|
/* @__PURE__ */m(l,{variant:"primary",loading:n,onClick:i,children:n?a.saving:a.save})]}),children:a.body})}function u({target:n,addressing:r,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
-
return m(i,{target:n,addressing:r,onHostMessage:e,children:a})}var
|
|
7
|
-
/* @__PURE__ */m(f,{config:n,data:i,onChange:
|
|
6
|
+
return m(i,{target:n,addressing:r,onHostMessage:e,children:a})}var k=(n,r)=>/* @__PURE__ */g(h,{children:[n,r]});function C({config:n,parts:r,wrap:e=k}){const{data:i,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:C,pendingNav:j,cancelPendingNav:N,discardAndNavigate:H,saveAndNavigate:M}=a(),y=t(()=>o(!u),[u]),A=c("screen",s);return l?/* @__PURE__ */m("div",{className:"sf-msg",children:A.loading}):d?/* @__PURE__ */m("div",{className:"sf-msg sf-msg--error",children:d}):g?i?e(
|
|
7
|
+
/* @__PURE__ */m(f,{config:n,data:i,onChange:C,permissions:y,parts:r,children:/* @__PURE__ */m(v,{})}),j&&/* @__PURE__ */m(p,{saving:"saving"===h,onCancel:N,onDiscard:H,onSave:()=>{M()}})):/* @__PURE__ */m("div",{className:"sf-msg",children:A.loading}):/* @__PURE__ */m("div",{className:"sf-msg",children:A.waitingForAuthorization})}export{C as DocumentScreen,u as ScreenMount};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{FieldSelect as e}from"./chunk-OZ72A6MY.js";import{TreeSeam as n}from"./chunk-4JSBIW5H.js";import{SettingsField as t,SETTINGS_BUCKETS as l,SettingsGroup as r}from"./chunk-3ZJSLHHI.js";import{DEFAULT_TREE_WORDS as a}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as o}from"./chunk-KFV7N2DJ.js";import{EaselMenuItems as i}from"./chunk-EA2HTX37.js";import{FieldNumber as s}from"./chunk-66LWADFP.js";import{SettingsSegmented as c}from"./chunk-QLD57GBB.js";import{DEFAULT_FIELDS_WORDS as d}from"./chunk-FFYXVAAL.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{useTreeDrag as m,gapToMoveIndex as p}from"./chunk-67GNT6PF.js";import{withTip as h}from"./chunk-P2VEMZH5.js";import{Textarea as f,Input as b,SortableList as g,ListRow as v,ContextMenu as y,tabPanelId as k,Tabs as x,tabButtonId as w}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as N,useState as C,useLayoutEffect as O,useId as $}from"react";import{jsx as j,jsxs as D}from"react/jsx-runtime";import{ChevronIcon as I,LockIcon as S,MoveUpIcon as F,MoveDownIcon as P,DuplicateIcon as L,TrashIcon as M}from"efficient-shell/icons/efficient";function T({id:e,value:n,onChange:t,placeholder:l,multiline:r=!1,rows:a=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return r?/* @__PURE__ */j(f,{id:e,size:"sm",className:"es-fin",value:c,rows:a,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */j(b,{id:e,size:"sm",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function A(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function H(e,n,t){const l=e.slice(),[r]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,r),l}function E(e,n){return e.filter((e,t)=>t!==n)}function R(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var z='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',B={parentId:"list",slot:"items"};function Y({label:e,icon:t,noun:l,items:r,onChange:o,newItem:s,summary:c,itemName:f,thumb:b,min:k=0,max:x,readOnly:w=!1,open:$,onOpen:T,renderItem:Y,renderRow:J,canRemove:K,lockedReason:V,fixed:G=!1,removeOnRow:W=!0,canDuplicate:X,above:Z,head:q=!0}){const Q=u("fields",d).list,U=u("tree",a),_=l??Q.item,ee=!w&&!G&&("number"!=typeof x||r.length<x),ne=r.length<=k,te=e=>!!K&&!K(r[e],e),le=e=>!w&&!G&&W&&!ne&&!te(e),re=e=>ee&&(!X||X(r[e],e)),ae=(e,n)=>f?f(e,n):Q.itemName({noun:_,n:n+1}),oe=N([]),ie=N(null),[se,ce]=C(null),de=N(null),[ue,me]=C(null),[pe,he]=C("");O(()=>{const e=ie.current;if(!e)return;ie.current=null;const n=oe.current[e.index]?.querySelectorAll(z)[e.nth]??oe.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const fe=(e,n)=>{if(n<0||n>=r.length||n===e)return;const t=oe.current[e],l=t?.ownerDocument.activeElement;if(t&&l&&t.contains(l)){const e=[...t.querySelectorAll(z)].indexOf(l),r=l;ie.current={index:n,nth:e,start:"number"==typeof r.selectionStart?r.selectionStart:null,end:"number"==typeof r.selectionEnd?r.selectionEnd:null}}o(H(r,e,n));const a=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}($,e,n);a!==$&&T(a),he(Q.moved({n:n+1,total:r.length}))},be=e=>{ee&&(o(A(r,e,s())),J?(ie.current={index:e,nth:0,start:null,end:null},null!==$&&$>=e&&T($+1)):T(e))},ge=e=>{le(e)&&(o(E(r,e)),$===e?T(null):null!==$&&$>e&&T($-1))},ve=m({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===B.parentId&&n.slot===B.slot,onDrop:(e,n)=>{const t=p({...B,index:e},n);t!==e&&fe(e,t)},onStep:(e,n)=>fe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<r.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:Q.moveUp,icon:/* @__PURE__ */j(F,{size:14}),shortcut:"⌥↑",onClick:()=>fe(e,e-1)}),e<r.length-1&&n.push({label:Q.moveDown,icon:/* @__PURE__ */j(P,{size:14}),shortcut:"⌥↓",onClick:()=>fe(e,e+1)}),re(e)&&n.push({label:Q.duplicate,icon:/* @__PURE__ */j(L,{size:14}),onClick:()=>(e=>{re(e)&&(o(A(r,e+1,R(r[e]))),null!==$&&$>e&&T($+1))})(e)}),le(e)&&n.push({label:Q.delete,icon:/* @__PURE__ */j(M,{size:14}),danger:!0,onClick:()=>ge(e)}),n},ke=(e,n,t,l)=>{w||0===ye(e).length||me({index:e,x:n,y:t,owner:l})},xe=e=>n=>{const t=r.slice();t[e]=n,o(t)};/* @__PURE__ */
|
|
2
|
+
return D("div",{className:"es-list",children:[q?/* @__PURE__ */D("div",{className:"es-list-head",children:[
|
|
3
|
+
/* @__PURE__ */D("span",{className:"es-list-label",children:[t?/* @__PURE__ */j("span",{className:"es-field-icon","aria-hidden":"true",children:t}):null,e]}),
|
|
4
|
+
/* @__PURE__ */j("span",{className:"es-list-count",children:r.length})]}):null,Z?/* @__PURE__ */j("div",{className:"es-list-above",children:Z}):null,r.length?/* @__PURE__ */D(g,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[r.map((e,t)=>{const l=ve.row({item:t,place:{...B,index:t}}),r=l.draggable&&se!==t,a=!J&&$===t,o=!w&&!G&&W&&te(t),i=["es-list-row",J?"is-inline":"is-item",a?"is-open":"",r?"is-draggable":"",l.dragging?"is-dragging":"",l.drop?`is-drop-${l.drop}`:""].filter(Boolean).join(" ");return[t>0?/* @__PURE__ */j(n,{...ve.seam({place:{...B,index:t}}),onAdd:ee?()=>be(t):void 0,label:Q.addHere({noun:_})},`seam-${t}`):null,
|
|
5
|
+
/* @__PURE__ */j(v,{className:i,flat:!!J,active:a,draggable:l.draggable,dragHint:U.dragHint,dragging:l.dragging,drop:"before"===l.drop||"after"===l.drop?l.drop:void 0,onMove:l.draggable?e=>fe(t,"up"===e?t-1:t+1):void 0,rowRef:e=>{oe.current[t]=e},rowProps:{...l.rowProps,draggable:r||void 0,onPointerDown:e=>{const n=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),r=!!n&&n===n.ownerDocument.activeElement;e.currentTarget.draggable=l.draggable&&!r,de.current=n&&!r?n:null,ce(r?t:null)},onDragStart:e=>{const n=de.current;de.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),l.rowProps.onDragStart?.(e)},onContextMenu:e=>{w||(e.preventDefault(),e.stopPropagation(),ke(t,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const n=e.currentTarget.ownerDocument,l=e=>e.preventDefault();n.addEventListener("contextmenu",l,{capture:!0,once:!0}),n.defaultView?.setTimeout(()=>n.removeEventListener("contextmenu",l,{capture:!0}),500);const r=e.currentTarget.getBoundingClientRect();return void ke(t,r.left+24,r.bottom,e.currentTarget)}l.rowProps.onKeyDown?.(e)}},actions:w||G||!W?void 0:o?h(V?V(e,t):Q.locked,/* @__PURE__ */j("span",{className:"es-list-lock",role:"img","aria-label":V?V(e,t):Q.locked,children:/* @__PURE__ */j(S,{size:13})})):h(Q.deleteItem({noun:_}),/* @__PURE__ */j("button",{type:"button",className:"es-list-x","aria-label":Q.deleteItem({noun:_}),disabled:!le(t),onClick:()=>ge(t),children:"×"})),below:a?/* @__PURE__ */j("div",{className:"es-list-item",children:Y(e,t,xe(t))}):void 0,children:J?/* @__PURE__ */j("div",{className:"es-list-row-main",children:J(e,t,xe(t))}):/* @__PURE__ */D("button",{type:"button",className:"es-list-open","aria-expanded":a,onClick:()=>T(a?null:t),children:[b?/* @__PURE__ */j("span",{className:"es-list-thumb","aria-hidden":"true",children:b(e,t)}):null,
|
|
6
|
+
/* @__PURE__ */j("span",{className:"es-list-row-name",children:ae(e,t)}),/* @__PURE__ */j("span",c?{className:"es-list-row-summary",children:c(e,t)}:{className:"es-list-row-summary"}),
|
|
7
|
+
/* @__PURE__ */j(I,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},t)]}),
|
|
8
|
+
/* @__PURE__ */j(n,{...ve.seam({place:{...B,index:r.length}})})]}):null,w||G?null:/* @__PURE__ */j("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>be(r.length),children:Q.add({noun:_})}),
|
|
9
|
+
/* @__PURE__ */j("span",{className:"es-list-said","aria-live":"polite",children:pe}),ue&&ue.index<r.length?
|
|
10
|
+
/* @__PURE__ */j(y,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),children:/* @__PURE__ */j(i,{items:ye(ue.index),onClose:()=>me(null)})}):null]})}var J=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function K({field:e,name:n,id:t,value:l,onChange:a,readOnly:o,context:i,renderers:s}){const[c,d]=C(!0),u=l&&"object"==typeof l?l:{};/* @__PURE__ */
|
|
11
|
+
return j(r,{id:`${t}-group`,title:J(e,n),open:c,onToggle:d,children:Object.entries(e.objectFields).map(([e,l])=>/* @__PURE__ */j(G,{field:l,name:`${n}.${e}`,id:`${t}-${e}`,value:u[e],onChange:n=>a({...u,[e]:n}),readOnly:o,context:i,renderers:s},e))})}function V({field:e,name:n,id:t,value:l,onChange:r,readOnly:a,context:o,renderers:i,openItem:s,onOpenItem:c}){const[d,u]=C(null),m=c?s??null:d,p=c??u,h=Array.isArray(l)?l:[],f=e.getItemSummary;/* @__PURE__ */
|
|
12
|
+
return j(Y,{label:J(e,n),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:h,onChange:r,newItem:()=>R({...e.defaultItemProps??{}}),summary:f?(e,n)=>f(e,n):void 0,min:e.min,max:e.max,readOnly:a,open:m,onOpen:p,renderItem:(l,r,s)=>Object.entries(e.arrayFields).map(([e,c])=>/* @__PURE__ */j(G,{field:c,name:`${n}[${r}].${e}`,id:`${t}-${r}-${e}`,value:l?.[e],onChange:n=>s({...l,[e]:n}),readOnly:a,context:o,renderers:i},e))})}function G(n){const{field:l,name:r,id:a,value:o,onChange:i,readOnly:d,context:u,renderers:m}=n;if(!l||l.marker||!1===l.visible)return null;const p=m?.[l.type];if(p)return p({field:l,name:r,id:a,value:o,onChange:i,readOnly:d});switch(l.type){case"custom":{const e={...u,field:l,name:r,id:a,value:o,onChange:i,readOnly:d};return l.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
+
return j(t,{label:J(l,r),htmlFor:a,icon:l.icon,hint:l.hint,children:/* @__PURE__ */j(T,{id:a,value:"string"==typeof o?o:null==o?"":String(o),onChange:i,placeholder:l.placeholder,multiline:"textarea"===l.type,readOnly:d})});case"number":/* @__PURE__ */
|
|
14
|
+
return j(t,{label:J(l,r),htmlFor:a,icon:l.icon,hint:l.hint,children:/* @__PURE__ */j(s,{id:a,value:"number"==typeof o?o:void 0,onChange:i,min:l.min,max:l.max,step:l.step,placeholder:l.placeholder,readOnly:d})});case"select":{const n=`${a}-label`;/* @__PURE__ */
|
|
15
|
+
return j(t,{label:J(l,r),labelId:n,htmlFor:a,icon:l.icon,hint:l.hint,children:/* @__PURE__ */j(e,{id:a,value:o,options:l.options,onChange:i,readOnly:d,ariaLabelledBy:n})})}case"radio":/* @__PURE__ */
|
|
16
|
+
return j(t,{label:J(l,r),icon:l.icon,hint:l.hint,children:/* @__PURE__ */j(c,{ariaLabel:J(l,r),value:o,options:l.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||d})),onChange:e=>{d||i(e)}})});case"object":/* @__PURE__ */
|
|
17
|
+
return j(K,{...n,field:l});case"array":/* @__PURE__ */
|
|
18
|
+
return j(V,{...n,field:l});case"slot":return null}}var W=e=>l.includes(e);function X(e){let n,t=l[0];const r=[],a=/* @__PURE__ */new Set;for(const[l,o]of Object.entries(e))o&&(W(o.bucket)&&((o.marker||o.bucket!==t)&&(n=void 0),t=o.bucket),o.marker&&"string"==typeof o.fold?n={key:l,title:o.fold}:o.marker&&!1===o.fold&&(n=void 0),o.marker||!1===o.visible||(r.push(n?{name:l,field:o,bucket:t,fold:n}:{name:l,field:o,bucket:t}),"slot"!==o.type&&a.add(t)));return{rows:r,buckets:l.filter(e=>a.has(e))}}function Z(e){return new Map(X(e).rows.map(e=>[e.name,e.bucket]))}function q(e){const n=[];for(const t of e){const e=n[n.length-1];e&&e.fold?.key===t.fold?.key?e.rows.push(t):n.push({fold:t.fold,rows:[t]})}return n}function Q({fields:e,values:n,onChange:t,readOnly:l=!1,context:a,tab:i,onTab:s,tabs:c=!0,tabIcons:d,renderers:m,idPrefix:p,ariaLabel:h,lead:f,children:b,leadFold:g,closedFolds:v,onFold:y}){const N=u("panel",o),O=$(),I=p??`es-insp${O.replace(/:/g,"")}`,S=X(e),[F,P]=C(void 0),L=i??F,M=L&&S.buckets.includes(L)?L:S.buckets[0],[T,A]=C(null),H=T&&T.panel===I&&S.rows.some(e=>e.name===T.name)?T:null,E=c&&S.buckets.length>1,R=E&&M?k(I,M):`${I}-rows`,[z,B]=C(()=>/* @__PURE__ */new Set),Y=v??z,J=(e,n)=>/* @__PURE__ */j(r,{title:e.title,open:!Y.has(e.key),onToggle:n=>((e,n)=>{void 0===v&&B(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),y?.(e,n)})(e.key,n),id:`${I}-fold-${e.key}`,children:n}),K=e=>E&&e!==M,V=({name:e,field:r,bucket:o})=>/* @__PURE__ */j("div",{className:"es-insp-row","data-field":e,"data-bucket":o,hidden:!!K(o)||void 0,children:/* @__PURE__ */j(G,{field:r,name:e,id:`${I}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:a,renderers:m,openItem:H&&H.name===e?H.index:null,onOpenItem:n=>A(null===n?null:{panel:I,name:e,index:n})})},e);/* @__PURE__ */
|
|
19
|
+
return D("div",{className:"es-insp",children:[E?/* @__PURE__ */j("div",{className:"es-insp-tabs",children:/* @__PURE__ */j(x,{variant:"underline",block:!0,"aria-label":h??N.settings,idPrefix:I,value:M,onChange:e=>{const n=e;void 0===i&&P(n),s?.(n)},items:S.buckets.map(e=>{const n=N.buckets[e],t=d?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */j("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
20
|
+
/* @__PURE__ */D("div",{className:"es-insp-rows",id:R,role:E?"tabpanel":void 0,"aria-labelledby":E&&M?w(I,M):void 0,children:[f?g?/* @__PURE__ */j("div",{className:"es-insp-band","data-fold":g.key,children:J(g,f)}):f:null,q(S.rows).map((e,n)=>{if(!e.fold)return e.rows.map(V);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
21
|
+
return j("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!K(t)&&!l)||void 0,children:J(e.fold,e.rows.map(V))},`fold-${e.fold.key}-${n}`)}),b]})]})}export{T as FieldText,Q as Inspector,G as InspectorField,Y as ListField,Z as bucketsOf,R as copyItem,A as insertAt,J as labelOf,H as moveTo,X as planFields,E as removeAt};
|