efficient-easel 16.1.0 → 17.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 +23 -64
- package/dist/autosave/index.d.ts +4 -4
- package/dist/blocks/index.d.ts +2 -2
- package/dist/chrome/index.d.ts +3 -3
- package/dist/chrome/index.js +1 -1
- package/dist/{chunk-UVQR7W6I.js → chunk-3ERZNZ5S.js} +1 -1
- package/dist/{chunk-2H3W5OLQ.js → chunk-4UBYPRAS.js} +1 -1
- package/dist/{chunk-ATOXCKEE.js → chunk-7TOQCTHV.js} +3 -3
- package/dist/chunk-BU2YSTLJ.js +14 -0
- package/dist/{chunk-VVPZMWJE.js → chunk-EL4F3IN7.js} +1 -1
- package/dist/chunk-EXCIHRAE.js +4 -0
- package/dist/{chunk-HV56SLR2.js → chunk-FJL3MYPA.js} +1 -1
- package/dist/{chunk-IE55HNMA.js → chunk-GWIVPLOX.js} +11 -11
- package/dist/chunk-INIPQLPR.js +1 -0
- package/dist/{chunk-RFSLDGDA.js → chunk-JSH3XKEF.js} +1 -1
- package/dist/chunk-M2Z775ZC.js +1 -0
- package/dist/chunk-MI54XTWD.js +5 -0
- package/dist/chunk-MTNBJPXX.js +2 -0
- package/dist/{chunk-K6EM4F5N.js → chunk-N3LYD2LK.js} +11 -11
- package/dist/{chunk-V6VKM2QX.js → chunk-NFLO4I2N.js} +1 -1
- package/dist/chunk-OLRLHE5K.js +7 -0
- package/dist/chunk-SHS6WCLL.js +1 -0
- package/dist/chunk-SPQOPWCL.js +5 -0
- package/dist/{chunk-TZIIRGVY.js → chunk-U277UX5I.js} +1 -1
- package/dist/{chunk-GPLMNRHR.js → chunk-V63ERBLW.js} +1 -1
- package/dist/chunk-WR3EVON3.js +57 -0
- package/dist/{chunk-62VPYC7F.js → chunk-XDZHKYQX.js} +1 -1
- package/dist/chunk-XLUVTPKK.js +1 -0
- package/dist/{chunk-2L2L7G5L.js → chunk-Z72CYM3L.js} +1 -1
- package/dist/copy/index.js +23 -11
- package/dist/draw/client.js +1 -1
- package/dist/draw/index.js +1 -1
- package/dist/easel/index.d.ts +35 -6
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/gold/gold.css +1 -1
- package/dist/{host-DGmdCaNL.d.ts → host-Cxbhp0zg.d.ts} +0 -4
- package/dist/icons/index.d.ts +0 -2
- package/dist/node-ops/index.d.ts +2 -2
- package/dist/node-ops/index.js +1 -1
- package/dist/panel/index.js +1 -1
- package/dist/{plan-CGREINRO.d.ts → plan-2BLk7pWs.d.ts} +19 -1
- package/dist/rail/index.d.ts +2 -2
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.d.ts +3 -3
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +6 -6
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +5 -5
- package/dist/screen/components/SaveControls.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +3 -3
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +5 -5
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +5 -5
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +5 -5
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +5 -5
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +2 -2
- package/dist/screen/lib/document-addressing.d.ts +3 -3
- package/dist/screen/lib/document-hooks.d.ts +2 -2
- package/dist/screen/lib/host-chrome.d.ts +0 -10
- package/dist/screen/lib/host.d.ts +3 -3
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +3 -3
- package/dist/screen/lib/media-picker.d.ts +3 -3
- package/dist/screen/lib/page-lock.d.ts +2 -2
- package/dist/screen/lib/puck/block-choice.d.ts +13 -1
- package/dist/screen/lib/puck/block-choice.js +1 -1
- package/dist/screen/lib/puck/device-fields.js +1 -1
- package/dist/screen/lib/puck/palette-sections.d.ts +2 -2
- package/dist/screen/lib/puck/section-doc.d.ts +2 -2
- package/dist/screen/lib/puck/style-clipboard.d.ts +5 -5
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.d.ts +2 -2
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/save-status.d.ts +2 -2
- package/dist/screen/lib/screen-parts.d.ts +5 -27
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-templates.d.ts +2 -2
- package/dist/screen/lib/session-context.d.ts +2 -2
- package/dist/screen/lib/session.d.ts +2 -2
- package/dist/screen/words.d.ts +0 -2
- package/dist/screen/words.js +1 -1
- package/dist/shell/shell.css +6 -1
- package/dist/strings/index.d.ts +134 -20
- package/dist/strings/index.js +2 -2
- package/dist/text-styles/index.js +26 -26
- package/dist/{types-CsgMwHHa.d.ts → types-Cy7rdmXt.d.ts} +1 -1
- package/dist/{types-DGyDHiJV.d.ts → types-DT8ywrFQ.d.ts} +1 -1
- package/dist/{types-NQozKWEz.d.ts → types-kR_4wYBw.d.ts} +1 -1
- package/dist/{useNodeOps-BHRkUFfG.d.ts → useNodeOps-B0XZ8Bl8.d.ts} +1 -1
- package/dist/{words-pgIK0I6g.d.ts → words-DkWcK1rh.d.ts} +2 -2
- package/package.json +2 -41
- package/dist/chunk-44COUKXO.js +0 -5
- package/dist/chunk-4BGYVIDQ.js +0 -57
- package/dist/chunk-ECM5F6JJ.js +0 -1
- package/dist/chunk-H4UMY7QF.js +0 -13
- package/dist/chunk-HMXIAMCU.js +0 -1
- package/dist/chunk-HQ4VVRIC.js +0 -1
- package/dist/chunk-IN22IYOM.js +0 -1
- package/dist/chunk-JQOYUH4A.js +0 -7
- package/dist/chunk-L2VGRQ4R.js +0 -4
- package/dist/chunk-L3GSW4XI.js +0 -1
- package/dist/chunk-QX7GVECM.js +0 -13
- package/dist/chunk-U25CP5VX.js +0 -5
- package/dist/chunk-XQGV2XAK.js +0 -1
- package/dist/chunk-ZZ64CEC2.js +0 -2
- package/dist/gold/index.d.ts +0 -283
- package/dist/gold/index.js +0 -1
- package/dist/icons/meanings.d.ts +0 -1
- package/dist/icons/meanings.js +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -1
- package/dist/markup/index.d.ts +0 -1
- package/dist/markup/index.js +0 -1
- package/dist/shell/index.d.ts +0 -195
- package/dist/shell/index.js +0 -1
- package/dist/strings/catalogue.d.ts +0 -139
- package/dist/strings/catalogue.js +0 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{TreeSeam as t}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as l}from"./chunk-K56YDHYQ.js";import{easelMenuEntries as a}from"./chunk-BALFHI3G.js";import{SETTINGS_BUCKETS as r,SettingsGroup as o}from"./chunk-RC25EGHD.js";import{DEFAULT_PANEL_WORDS as i}from"./chunk-KFV7N2DJ.js";import{
|
|
1
|
+
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{TreeSeam as t}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as l}from"./chunk-K56YDHYQ.js";import{easelMenuEntries as a}from"./chunk-BALFHI3G.js";import{SETTINGS_BUCKETS as r,SettingsGroup as o}from"./chunk-RC25EGHD.js";import{DEFAULT_PANEL_WORDS as i}from"./chunk-KFV7N2DJ.js";import{FieldNumber as s}from"./chunk-2XMHLXMA.js";import{FieldSelect as c}from"./chunk-G3GWAP5R.js";import{DEFAULT_FIELDS_WORDS as d}from"./chunk-WRFD4EXD.js";import{SettingsField as u,SettingsSegmented as m}from"./chunk-36LVP5WD.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{useTreeDrag as p,gapToMoveIndex as f}from"./chunk-67GNT6PF.js";import{withTip as b}from"./chunk-P2VEMZH5.js";import{Textarea as g,Input as v,SortableList as y,ListRow as k,ContextMenu as x,tabPanelId as w,Tabs as C,tabButtonId as N}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as O,useState as j,useLayoutEffect as $,useId as D}from"react";import{jsx as S,jsxs as I}from"react/jsx-runtime";import{ChevronIcon as P,LockIcon as L,MoveUpIcon as F,MoveDownIcon as M,DuplicateIcon as R,TrashIcon as E}from"efficient-shell/icons/efficient";function W({id:e,value:n,onChange:t,placeholder:l,multiline:a=!1,rows:r=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */S(g,{id:e,size:"sm",className:"es-fin",value:c,rows:r,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */S(v,{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(),[a]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,a),l}function T(e,n){return e.filter((e,t)=>t!==n)}function z(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var B='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',G={parentId:"list",slot:"items"};function K({label:e,icon:n,noun:r,items:o,onChange:i,newItem:s,summary:c,itemName:u,thumb:m,min:g=0,max:v,readOnly:w=!1,open:C,onOpen:N,renderItem:D,renderRow:W,canRemove:K,lockedReason:V,fixed:X=!1,removeOnRow:J=!0,canDuplicate:Y,above:q,head:Q=!0}){const Z=h("fields",d).list,U=h("tree",l),_=r??Z.item,ee=!w&&!X&&("number"!=typeof v||o.length<v),ne=o.length<=g,te=e=>!!K&&!K(o[e],e),le=e=>!w&&!X&&J&&!ne&&!te(e),ae=e=>ee&&(!Y||Y(o[e],e)),re=(e,n)=>u?u(e,n):Z.itemName({noun:_,n:n+1}),oe=O([]),ie=O(null),[se,ce]=j(null),de=O(null),[ue,me]=j(null),[he,pe]=j("");$(()=>{const e=ie.current;if(!e)return;ie.current=null;const n=oe.current[e.index]?.querySelectorAll(B)[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>=o.length||n===e)return;const t=oe.current[e],l=t?.ownerDocument.activeElement;if(t&&l&&t.contains(l)){const e=[...t.querySelectorAll(B)].indexOf(l),a=l;ie.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}i(H(o,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}(C,e,n);a!==C&&N(a),pe(Z.moved({n:n+1,total:o.length}))},be=e=>{ee&&(i(A(o,e,s())),W?(ie.current={index:e,nth:0,start:null,end:null},null!==C&&C>=e&&N(C+1)):N(e))},ge=e=>{le(e)&&(i(T(o,e)),C===e?N(null):null!==C&&C>e&&N(C-1))},ve=p({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===G.parentId&&n.slot===G.slot,onDrop:(e,n)=>{const t=f({...G,index:e},n);t!==e&&fe(e,t)},onStep:(e,n)=>fe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<o.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:Z.moveUp,icon:/* @__PURE__ */S(F,{size:14}),shortcut:"⌥↑",onClick:()=>fe(e,e-1)}),e<o.length-1&&n.push({label:Z.moveDown,icon:/* @__PURE__ */S(M,{size:14}),shortcut:"⌥↓",onClick:()=>fe(e,e+1)}),ae(e)&&n.push({label:Z.duplicate,icon:/* @__PURE__ */S(R,{size:14}),onClick:()=>(e=>{ae(e)&&(i(A(o,e+1,z(o[e]))),null!==C&&C>e&&N(C+1))})(e)}),le(e)&&n.push({label:Z.delete,icon:/* @__PURE__ */S(E,{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=o.slice();t[e]=n,i(t)};/* @__PURE__ */
|
|
2
2
|
return I("div",{className:"es-list",children:[Q?/* @__PURE__ */I("div",{className:"es-list-head",children:[
|
|
3
3
|
/* @__PURE__ */I("span",{className:"es-list-label",children:[n?/* @__PURE__ */S("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
|
|
4
4
|
/* @__PURE__ */S("span",{className:"es-list-count",children:o.length})]}):null,q?/* @__PURE__ */S("div",{className:"es-list-above",children:q}):null,o.length?/* @__PURE__ */I(y,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[o.map((e,n)=>{const l=ve.row({item:n,place:{...G,index:n}}),a=l.draggable&&se!==n,r=!W&&C===n,o=!w&&!X&&J&&te(n),i=["es-list-row",W?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",l.dragging?"is-dragging":"",l.drop?`is-drop-${l.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */S(t,{...ve.seam({place:{...G,index:n}}),onAdd:ee?()=>be(n):void 0,label:Z.addHere({noun:_})},`seam-${n}`):null,
|
|
5
|
-
/* @__PURE__ */S(k,{className:i,flat:!!W,active:r,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(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{oe.current[n]=e},rowProps:{...l.rowProps,draggable:a||void 0,onPointerDown:e=>{const t=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!t&&t===t.ownerDocument.activeElement;e.currentTarget.draggable=l.draggable&&!a,de.current=t&&!a?t:null,ce(a?n: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(n,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const t=e.currentTarget.ownerDocument,l=e=>e.preventDefault();t.addEventListener("contextmenu",l,{capture:!0,once:!0}),t.defaultView?.setTimeout(()=>t.removeEventListener("contextmenu",l,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void ke(n,a.left+24,a.bottom,e.currentTarget)}l.rowProps.onKeyDown?.(e)}},actions:w||X||!J?void 0:o?
|
|
6
|
-
/* @__PURE__ */S("span",{className:"es-list-row-name",children:re(e,n)}),/* @__PURE__ */S("span",
|
|
5
|
+
/* @__PURE__ */S(k,{className:i,flat:!!W,active:r,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(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{oe.current[n]=e},rowProps:{...l.rowProps,draggable:a||void 0,onPointerDown:e=>{const t=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!t&&t===t.ownerDocument.activeElement;e.currentTarget.draggable=l.draggable&&!a,de.current=t&&!a?t:null,ce(a?n: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(n,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const t=e.currentTarget.ownerDocument,l=e=>e.preventDefault();t.addEventListener("contextmenu",l,{capture:!0,once:!0}),t.defaultView?.setTimeout(()=>t.removeEventListener("contextmenu",l,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void ke(n,a.left+24,a.bottom,e.currentTarget)}l.rowProps.onKeyDown?.(e)}},actions:w||X||!J?void 0:o?b(V?V(e,n):Z.locked,/* @__PURE__ */S("span",{className:"es-list-lock",role:"img","aria-label":V?V(e,n):Z.locked,children:/* @__PURE__ */S(L,{size:13})})):b(Z.deleteItem({noun:_}),/* @__PURE__ */S("button",{type:"button",className:"es-list-x","aria-label":Z.deleteItem({noun:_}),disabled:!le(n),onClick:()=>ge(n),children:"×"})),below:r?/* @__PURE__ */S("div",{className:"es-list-item",children:D(e,n,xe(n))}):void 0,children:W?/* @__PURE__ */S("div",{className:"es-list-row-main",children:W(e,n,xe(n))}):/* @__PURE__ */I("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>N(r?null:n),children:[m?/* @__PURE__ */S("span",{className:"es-list-thumb","aria-hidden":"true",children:m(e,n)}):null,
|
|
6
|
+
/* @__PURE__ */S("span",{className:"es-list-row-name",children:re(e,n)}),/* @__PURE__ */S("span",c?{className:"es-list-row-summary",children:c(e,n)}:{className:"es-list-row-summary"}),
|
|
7
7
|
/* @__PURE__ */S(P,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},n)]}),
|
|
8
8
|
/* @__PURE__ */S(t,{...ve.seam({place:{...G,index:o.length}})})]}):null,w||X?null:/* @__PURE__ */S("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>be(o.length),children:Z.add({noun:_})}),
|
|
9
9
|
/* @__PURE__ */S("span",{className:"es-list-said","aria-live":"polite",children:he}),ue&&ue.index<o.length?
|
|
10
10
|
/* @__PURE__ */S(x,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),items:a(ye(ue.index))}):null]})}var V=e=>e<6?e+1:6,X=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function J({field:e,name:t,id:l,value:a,onChange:r,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=j(!0),p=a&&"object"==typeof a?a:{};/* @__PURE__ */
|
|
11
11
|
return S(o,{id:`${l}-group`,title:X(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */S(q,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>r({...p,[e]:n}),readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:V(u)},e))})}function Y({field:e,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=j(null),f=u?d??null:h,b=u??p,g=Array.isArray(a)?a:[],v=e.getItemSummary;/* @__PURE__ */
|
|
12
|
-
return S(K,{label:X(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:r,newItem:()=>z({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:o,open:f,onOpen:b,renderItem:(a,r,d)=>Object.entries(n(e.arrayFields,{values:a,context:s})).map(([e,n])=>/* @__PURE__ */S(q,{field:n,name:`${t}[${r}].${e}`,id:`${l}-${r}-${e}`,value:a?.[e],onChange:n=>d({...a,[e]:n}),readOnly:o,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function q(e){const{field:n,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,renderers:
|
|
13
|
-
return S(
|
|
14
|
-
return S(
|
|
15
|
-
return S(
|
|
16
|
-
return S(
|
|
12
|
+
return S(K,{label:X(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:r,newItem:()=>z({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:o,open:f,onOpen:b,renderItem:(a,r,d)=>Object.entries(n(e.arrayFields,{values:a,context:s})).map(([e,n])=>/* @__PURE__ */S(q,{field:n,name:`${t}[${r}].${e}`,id:`${l}-${r}-${e}`,value:a?.[e],onChange:n=>d({...a,[e]:n}),readOnly:o,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function q(e){const{field:n,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,renderers:d}=e;if(!n||n.marker||!1===n.visible)return null;const h=d?.[n.type];if(h)return h({field:n,name:t,id:l,value:a,onChange:r,readOnly:o});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:a,onChange:r,readOnly:o};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
+
return S(u,{label:X(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(W,{id:l,value:"string"==typeof a?a:null==a?"":String(a),onChange:r,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:o})});case"number":/* @__PURE__ */
|
|
14
|
+
return S(u,{label:X(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(s,{id:l,value:"number"==typeof a?a:void 0,onChange:r,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:o})});case"select":{const e=`${l}-label`;/* @__PURE__ */
|
|
15
|
+
return S(u,{label:X(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(c,{id:l,value:a,options:n.options,onChange:r,readOnly:o,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
16
|
+
return S(u,{label:X(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(m,{ariaLabel:X(n,t),value:a,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||o})),onChange:e=>{o||r(e)}})});case"object":/* @__PURE__ */
|
|
17
17
|
return S(J,{...e,field:n});case"array":/* @__PURE__ */
|
|
18
|
-
return S(Y,{...e,field:n});case"slot":return null}}var Q=e=>r.includes(e);function Z(n,t){let l,a=r[0];const o=[],i=/* @__PURE__ */new Set;for(const[r,s]of Object.entries(n))s&&(Q(s.bucket)&&((s.marker||s.bucket!==a)&&(l=void 0),a=s.bucket),s.marker&&"string"==typeof s.fold?l={key:r,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||(o.push(l?{name:r,field:s,bucket:a,fold:l}:{name:r,field:s,bucket:a}),"slot"!==s.type&&i.add(a)));return{rows:o,buckets:r.filter(e=>i.has(e))}}function U(e){return new Map(Z(e).rows.map(e=>[e.name,e.bucket]))}function _(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 ee({fields:e,values:n,onChange:t,readOnly:l=!1,context:a,showWhenContext:r,tab:s,onTab:c,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:
|
|
19
|
-
return I("div",{className:"es-insp",children:[T?/* @__PURE__ */S("div",{className:"es-insp-tabs",children:/* @__PURE__ */S(C,{variant:"underline",block:!0,"aria-label":
|
|
20
|
-
/* @__PURE__ */I("div",{className:"es-insp-rows",id:z,role:T?"tabpanel":void 0,"aria-labelledby":T&&E?N(P,E):void 0,children:[
|
|
18
|
+
return S(Y,{...e,field:n});case"slot":return null}}var Q=e=>r.includes(e);function Z(n,t){let l,a=r[0];const o=[],i=/* @__PURE__ */new Set;for(const[r,s]of Object.entries(n))s&&(Q(s.bucket)&&((s.marker||s.bucket!==a)&&(l=void 0),a=s.bucket),s.marker&&"string"==typeof s.fold?l={key:r,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||(o.push(l?{name:r,field:s,bucket:a,fold:l}:{name:r,field:s,bucket:a}),"slot"!==s.type&&i.add(a)));return{rows:o,buckets:r.filter(e=>i.has(e))}}function U(e){return new Map(Z(e).rows.map(e=>[e.name,e.bucket]))}function _(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 ee({fields:e,values:n,onChange:t,readOnly:l=!1,context:a,showWhenContext:r,tab:s,onTab:c,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:p,ariaLabel:f,lead:b,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const O=h("panel",i),$=D(),P=p??`es-insp${$.replace(/:/g,"")}`,L=Z(e,{values:n,context:r}),[F,M]=j(void 0),R=s??F,E=R&&L.buckets.includes(R)?R:L.buckets[0],[W,A]=j(null),H=W&&W.panel===P&&L.rows.some(e=>e.name===W.name)?W:null,T=d&&L.buckets.length>1,z=T&&E?w(P,E):`${P}-rows`,[B,G]=j(()=>/* @__PURE__ */new Set),K=y??B,X=(e,n)=>{/* @__PURE__ */return S(o,{title:e.title,open:!K.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&G(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),k?.(e,n)})(e.key,n),id:`${P}-fold-${t=e.key,[...t].map(e=>/[A-Za-z0-9_-]/.test(e)?e:`-u${e.codePointAt(0).toString(16)}-`).join("")}`,level:x,children:n});var t},J=e=>T&&e!==E,Y=({name:e,field:o,bucket:i,fold:s})=>/* @__PURE__ */S("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!!J(i)||void 0,children:/* @__PURE__ */S(q,{field:o,name:e,id:`${P}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:a,showWhenContext:r,renderers:m,openItem:H&&H.name===e?H.index:null,onOpenItem:n=>A(null===n?null:{panel:P,name:e,index:n}),headingLevel:s?V(x):x})},e);/* @__PURE__ */
|
|
19
|
+
return I("div",{className:"es-insp",children:[T?/* @__PURE__ */S("div",{className:"es-insp-tabs",children:/* @__PURE__ */S(C,{variant:"underline",block:!0,"aria-label":f??O.settings,idPrefix:P,value:E,onChange:e=>{const n=e;void 0===s&&M(n),c?.(n)},items:L.buckets.map(e=>{const n=O.buckets[e],t=u?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */S("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
20
|
+
/* @__PURE__ */I("div",{className:"es-insp-rows",id:z,role:T?"tabpanel":void 0,"aria-labelledby":T&&E?N(P,E):void 0,children:[b?v?/* @__PURE__ */S("div",{className:"es-insp-band","data-fold":v.key,children:X(v,b)}):b:null,_(L.rows).map((e,n)=>{if(!e.fold)return e.rows.map(Y);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
21
21
|
return S("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!J(t)&&!l)||void 0,children:X(e.fold,e.rows.map(Y))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{W as FieldText,ee as Inspector,q as InspectorField,K as ListField,U as bucketsOf,z as copyItem,A as insertAt,X as labelOf,H as moveTo,Z as planFields,T as removeAt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-SPQOPWCL.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-BU2YSTLJ.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-WR3EVON3.js";import{ScreenStoreProvider as e}from"./chunk-Z72CYM3L.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-MTNBJPXX.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-EL4F3IN7.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var N=r(e),k=r(n);function C({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const N=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
|
|
2
|
+
return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
|
|
3
|
+
/* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
|
|
4
|
+
/* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
|
|
5
|
+
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{N()},children:i.save})]}),children:i.body})}function j({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
+
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var y=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function M({config:r,parts:n,wrap:e=y}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:j}=a(),M=t(()=>s(!g),[g]),H=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:H.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
|
|
7
|
+
/* @__PURE__ */u(N,{config:r,data:i,onChange:h,permissions:M,parts:n,children:/* @__PURE__ */u(k,{})}),f&&/* @__PURE__ */u(C,{onCancel:p,onDiscard:v,onSave:j})):/* @__PURE__ */u("div",{className:"sf-msg",children:H.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:H.waitingForAuthorization})}export{M as DocumentScreen,j as ScreenMount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{find as n,remove as t,getList as e,newId as r,duplicate as o,move as l,copyNode as a,insert as c,setProps as i,slotsOf as d}from"./chunk-KRXQM65X.js";import{useRef as s,useSyncExternalStore as u,useCallback as p,useMemo as f}from"react";var m=n=>({kind:"node",id:n});function x(r,o,l,a="none"){const c=n(r,o,l),i=t(r,o,l);if("none"===a||!c)return{data:i,select:null};const d=e(r,o,c.place)??[],s=d[c.place.index+1]??d[c.place.index-1];return s?.props?.id?{data:i,select:m(s.props.id)}:"root"!==c.place.parentId?{data:i,select:m(c.place.parentId)}:{data:i,select:null}}function g(t,e,l,a={}){const c=n(t,e,l)?.node,i=a.id??r(c?.type??"Node");return{data:o(t,e,l,{strip:a.strip,id:i}),select:m(i)}}function I(n,t,e,r){return{data:l(n,t,e,r),select:m(e)}}var h=(n,t)=>({min:0,max:t-1});function v(t,r,o,l,a=h){const c=n(t,r,o);if(!c)return!1;const i=e(t,r,c.place)?.length??0,{min:d,max:s}=a(c.place,i),u=c.place.index+l;return c.place.index>=d&&c.place.index<=s&&u>=d&&u<=s}function b(t,e,r,o,l=h){if(!v(t,e,r,o,l))return null;const a=n(t,e,r);return I(t,e,r,{...a.place,index:a.place.index+o})}function k(n,t,e,r,o={}){const l=a(e,t,{strip:o.strip});return{data:c(n,t,r,l),select:m(l.props.id)}}function y(t,r,o,l){if(n(t,r,o.props.id))return null;const a=e(t,r,l)??[],i={...l,index:Math.max(0,Math.min(l.index,a.length))};return{data:c(t,r,i,o),select:m(o.props.id)}}function M(n,t,e,r){return{data:i(n,t,e,r),select:void 0}}function O(t,e,r,o=()=>!1){if(!r)return null;if("slot"===r.kind)return n(t,e,r.parentId)?m(r.parentId):null;const l=n(t,e,r.id);if(!l||"root"===l.place.parentId)return null;const a=n(t,e,l.place.parentId);return a?o(a.node,l.place.slot)?{kind:"slot",parentId:a.node.props.id,slot:l.place.slot}:m(a.node.props.id):null}function z(t,e,r,o){const l=n(t,e,r);if(!l)return[];const a=l.path.filter(n=>"root"!==n.parentId).map(n=>n.parentId);return o?[...a.filter(r=>{const l=n(t,e,r);return!l||!o(l.node)}),r]:[...a,r]}function R(n,t){if(0===n.length)return null;const e=null===t?-1:n.indexOf(t);return-1===e?n[0]:n[Math.min(e+1,n.length-1)]}function B(t,e,r,o,l){const a=n(t,e,r);return a?0===d(a.node,e).length?r:R(z(t,e,r,l),o):null}function X(t,e,r,o,l,a,c){const i=n(t,e,r);if(!i)return null;if(0===d(i.node,e).length)return{node:r,part:o};const s="\0part:"+o,u=R([...z(t,e,r,c),s],l===r&&a===o?s:l);return u===s?{node:r,part:o}:{node:u??r,part:null}}function $(t,e,r){if(!r||"node"!==r.kind)return null;const o=n(t,e,r.id);return o?{zone:`${o.place.parentId}:${o.place.slot}`,index:o.place.index}:null}function j(n,t,r){if(!r)return null;const[o,l]=(r.zone??"root:default-zone").split(/:(.*)/s),a={parentId:o,slot:l},c=e(n,t,a)?.[r.index];return c?.props?.id?m(c.props.id):null}var K={get:()=>null,set:()=>{},subscribe:()=>()=>{}};function L(t){const e=s(t);e.current=t;const r=t.clipboard??K,o=u(r.subscribe,r.get,r.get),l=p(n=>{const t=e.current;if(t.readOnly)return!1;const r=n(t.data,t.config);return!!r&&((r.data!==t.data||void 0!==r.select)&&(t.commit(r.data,{select:r.select}),e.current={...t,data:r.data},!0))},[]);return f(()=>{const t=()=>e.current,r=(e,r)=>{const o=n(t().data,t().config,e);return o?{node:o.node,label:r,from:{parentId:o.place.parentId,slot:o.place.slot}}:null};return{held:o,remove:n=>l((e,r)=>x(e,r,n,t().afterRemove)),duplicate:n=>l((e,r)=>g(e,r,n,{strip:t().strip})),move:(n,t)=>l((e,r)=>I(e,r,n,t)),step:(n,e)=>l((r,o)=>b(r,o,n,e,t().stepBounds)),canStep:(n,e)=>v(t().data,t().config,n,e,t().stepBounds),setProps:(n,t)=>l((e,r)=>M(e,r,n,t)),copy:(n,e)=>{const o=r(n,e);return o&&(t().clipboard??K).set(o),!!o},cut:(n,e)=>{if(t().readOnly)return!1;const o=r(n,e);return!!o&&((t().clipboard??K).set(o),l((e,r)=>x(e,r,n,t().afterRemove)))},paste:n=>{const e=(t().clipboard??K).get();return!!e&&l((r,o)=>k(r,o,e.node,n,{strip:t().strip}))},restore:(n,t)=>l((e,r)=>y(e,r,n,t)),parentOf:n=>O(t().data,t().config,n,t().slotIsLevel)}},[o,l])}export{v as canStep,B as clickPick,X as clickPickPart,j as fromItemSelector,R as nextInChain,z as nodeChain,O as parentStep,g as planDuplicate,I as planMove,k as planPaste,x as planRemove,y as planRestore,M as planSetProps,b as planStep,$ as toItemSelector,L as useNodeOps};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{usePickFollowsSelection as n}from"./chunk-R6WTQWAC.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-BU2YSTLJ.js";import{Inspector as i}from"./chunk-N3LYD2LK.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},O={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},j={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function S(){/* @__PURE__ */
|
|
2
|
+
return s(t,{height:"fill"})}function C(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
|
+
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var D=o({});function N({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return s(D.Provider,{value:n,children:e})}function P(){return u(D)}function B(){return(P().useOwnerName??v)()}function G(){return(P().useDocumentLabel??g)()}function T(n,e,t,r){return(P().useBridges??h)(n,e,t,r)}function x(n){return(P().useStandaloneBridges??h)(n)}function I(n,e){(P().useDocumentPass??y)(n,e)}function A(){return P().blockRules??b}function F(){return P().blockLook??L}function K(){return P().devices??O}function R(){return P().leftView??j}function Y(){return P().pinned??w}function V(){return P().saveSwitch??!0}function W(e){n(!0===P().pickFollowsSelection,e)}function E(){return P().storageNamespace||void 0}function H(){return P().styleClipboard??null}function J(){return P().nodeKeys??!0}function Q(){return P().notify??null}function U(){return P().Canvas??S}function Z(){return P().CanvasHead??null}function q(){return P().canvasDrag??null}var z=o(null);function M({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return s(z.Provider,{value:n,children:e})}function X(){return u(z)}function $(){return P().Inspector??C}export{c as SELECTION_MODE,M as ScreenCanvasTargetProvider,N as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,F as useScreenBlockLook,A as useScreenBlockRules,T as useScreenBridges,q as useScreenCanvasDrag,U as useScreenCanvasFrame,Z as useScreenCanvasHead,X as useScreenCanvasTarget,K as useScreenDevices,G as useScreenDocumentLabel,I as useScreenDocumentPass,$ as useScreenInspectorPanel,R as useScreenLeftView,J as useScreenNodeKeys,Q as useScreenNotify,B as useScreenOwnerName,P as useScreenParts,W as useScreenPickFollowsSelection,Y as useScreenPinned,V as useScreenSaveSwitch,E as useScreenStorageNamespace,H as useScreenStyleClipboard,x as useStandaloneScreenBridges};
|
|
@@ -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-GWIVPLOX.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useScreenOwnerName as e}from"./chunk-
|
|
1
|
+
import{useScreenOwnerName as e}from"./chunk-SPQOPWCL.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-GWIVPLOX.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
|
|
2
2
|
return o(r,{children:[
|
|
3
3
|
/* @__PURE__ */t(i,{context:p,pick:d?{kind:c(d.accept),field:d.title||void 0}:null,onCancel:()=>d&&n(d.requestId,null),onHide:m}),
|
|
4
4
|
/* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-XLUVTPKK.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as c,useEaselUndoKeys as a,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-JSH3XKEF.js";import{SlotChildActionsProvider as f}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-U277UX5I.js";import{usePartBridge as y}from"./chunk-INIPQLPR.js";import{useSectionOps as S}from"./chunk-NFLO4I2N.js";import{ScreenSaveIcon as k,ScreenMainButton as b}from"./chunk-7TOQCTHV.js";import{useBrowserOffline as v}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-MI54XTWD.js";import{SidePanelHead as z,PanelShowStrip as C}from"./chunk-XDZHKYQX.js";import{offeredChoices as B}from"./chunk-M2Z775ZC.js";import{MediaSidePanel as I}from"./chunk-V63ERBLW.js";import{useScreenSaveSwitch as N,useScreenNodeKeys as O,useScreenPinned as P,useScreenDocumentLabel as $,useScreenCanvasFrame as T,useScreenInspectorPanel as L,useScreenDevices as M,useScreenPickFollowsSelection as j,useScreenLeftView as A,SELECTION_MODE as R,sameInspectorMode as E,useScreenBridges as V,useScreenBlockRules as F,useScreenBlockLook as W,useScreenStorageNamespace as H,useScreenNotify as D,useScreenCanvasHead as U,isSlotMode as X,useScreenStyleClipboard as J,useScreenDocumentPass as G,useScreenCanvasDrag as K,ScreenCanvasTargetProvider as Y,isPinnedFirst as Z,isPinnedLast as q,screenSlotsOf as Q}from"./chunk-SPQOPWCL.js";import{useNodeClipboard as _,useNodeContextMenu as ee}from"./chunk-3ERZNZ5S.js";import{PageEditGuardNotices as ne}from"./chunk-4UBYPRAS.js";import{useScreenDocument as te}from"./chunk-MTNBJPXX.js";import{requestMediaPick as oe}from"./chunk-KG7RJWOK.js";import{useMediaPanel as re,usePanelPick as ie,useCancelPanelPick as le}from"./chunk-R6WTQWAC.js";import{useEaselSession as se}from"./chunk-O7Q4DDJT.js";import{useEaselHost as de,useHostEscape as ce}from"./chunk-U3JP4VGF.js";import{LayersIcon as ae,MediaIcon as pe}from"./chunk-4VJATVVR.js";import{DEFAULT_SCREEN_WORDS as ue}from"./chunk-EL4F3IN7.js";import{heldStyle as fe,styleShortcut as he}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as me}from"./chunk-6WY6ZXJG.js";import{rootRowName as ge,slotChildRowName as ye,slotChildRenameProp as Se,sectionRenameProp as ke}from"./chunk-TBF5CVPA.js";import{ROOT_ZONE as be,blockNodeActions as ve,TREE_MAX_DEPTH as we,childSlotsOf as xe,slotFieldsOf as ze,slotChildrenIn as Ce,nestsInTree as Be,newNodeId as Ie}from"./chunk-PLVEGYK6.js";import{useEasel as Ne,useEaselApi as Oe,CanvasPassThroughContext as Pe}from"./chunk-BU2YSTLJ.js";import{TreeRow as $e,Subtree as Te,LayersTree as Le,TreeGroupLabel as Me,TreeRowAction as je,TreeSeam as Ae}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Re}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ee}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ve,useNodeOps as Fe,clickPick as We}from"./chunk-SHS6WCLL.js";import{EaselTopBar as He,TopBarRail as De,TopBarCluster as Ue,EaselIconButton as Xe,TopBarDivider as Je,DeviceSwitch as Ge,InspectorIconButton as Ke,PanelResizeHandle as Ye,MAX_PANEL_W as Ze,MIN_PANEL_W as qe,panelWidthVars as Qe}from"./chunk-GWIVPLOX.js";import{DEFAULT_NOTICE_WORDS as _e,DEFAULT_CHROME_WORDS as en}from"./chunk-Z6PVRXVY.js";import{holderOf as nn,nameOrSomeone as tn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as on}from"./chunk-RE4LP46F.js";import{useWords as rn}from"./chunk-MFIRYGHW.js";import{insertSeams as ln,CanvasDragLayer as sn,CanvasInsert as dn}from"./chunk-POSLNRTO.js";import{DEFAULT_DRAG_WORDS as cn}from"./chunk-KAML3KQH.js";import{createDragSession as an,useTreeDrag as pn,gapToMoveIndex as un}from"./chunk-67GNT6PF.js";import{useCanvasFrame as fn,LIST_SELECTOR as hn,BLOCK_SELECTOR as mn,useCanvasTyping as gn,useCanvasEvent as yn,nodeIdAt as Sn,frameRectToHost as kn,BLOCK_ATTRIBUTE as bn,drawnBox as vn}from"./chunk-X4T6JT3M.js";import{ROOT_ID as wn,ROOT_SLOT as xn,zoneKey as zn,parseZoneKey as Cn,find as Bn,DataError as In}from"./chunk-KRXQM65X.js";import{useRef as Nn,useMemo as On,useState as Pn,useEffect as $n,useCallback as Tn,useLayoutEffect as Ln,Fragment as Mn}from"react";import{ColoredBadge as jn,toast as An,groupColors as Rn}from"efficient-shell/ui";import{UndoIcon as En,RedoIcon as Vn,RefreshIcon as Fn,AddIcon as Wn,TrashIcon as Hn,EyeOffIcon as Dn,EyeIcon as Un,DuplicateIcon as Xn}from"efficient-shell/icons/efficient";import{jsx as Jn,jsxs as Gn,Fragment as Kn}from"react/jsx-runtime";var Yn=/* @__PURE__ */new WeakSet;function Zn(e,n,t){const o=Bn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function qn({canvas:e,tabs:n,onSelect:t}){const o=Nn(null),[r,i]=Pn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Ln(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=kn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${bn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?vn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=kn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),a=s.top+s.height;if(a<d.top||s.top>d.top+d.height){c[o.id]=null;continue}const p=o.below?a+4:Math.max(s.top,d.top)+6;c[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(c)},c=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",c,!0),r.addEventListener("resize",c);const a=new r.MutationObserver(c);return a.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",c,!0),r.removeEventListener("resize",c),a.disconnect()}},[e,l]),/* @__PURE__ */Jn("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Jn("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:/* @__PURE__ */Jn(jn,{colorClass:Rn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function Qn({expand:e}){/* @__PURE__ */
|
|
2
|
+
return Jn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Gn(Kn,e?{children:[
|
|
3
|
+
/* @__PURE__ */Jn("path",{d:"M8 9l4-4 4 4"}),
|
|
4
|
+
/* @__PURE__ */Jn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
5
|
+
/* @__PURE__ */Jn("path",{d:"M8 4l4 4 4-4"}),
|
|
6
|
+
/* @__PURE__ */Jn("path",{d:"M8 20l4-4 4 4"}),
|
|
7
|
+
/* @__PURE__ */Jn("path",{d:"M5 12h14"})]})})}var _n=`${hn}, ${mn}`;function et(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var nt="__rungs";var tt="screen:band",ot={duplicate:!0,delete:!0};function rt(){const hn=de(),{target:kn,docId:bn,capabilities:vn,currentSlug:Rn,siteId:rt,onPublish:it,saveState:lt,saveConflict:st,retrySave:dt,toggleAutoSave:ct,flushSave:at,access:pt,saveUnreachable:ut=!1,readOnly:ft,readOnlyReason:ht=null}=te(),mt=N(),gt=O(),{mediaEditing:yt,hasEditGuard:St,hasPinnedChrome:kt}=vn,{appState:bt,dispatch:vt,history:wt,selectedItem:xt,getSelectorForId:zt,config:Ct}=Ne(e=>e),Bt=P(),{first:It,firstGroup:Nt,lastGroup:Ot,isSectionGroup:Pt,sectionGroupZone:$t,panelOf:Tt}=Bt,Lt=Tt(It),Mt=e=>Z(Bt,e),jt=e=>q(Bt,e),At="node"===Bt.firstRow,Rt=Bt.band??null,Et=rn("screen",ue),Vt=rn("tree",Re),Ft=rn("drag",cn),Wt=rn("notice",_e),Ht=rn("lock",on),Dt=rn("menu",Ee),Ut=rn("styleClipboard",me),Xt=rn("chrome",en),Jt=$()??`/${Rn}`,Gt=T(),Kt=L(),Yt=S({readOnly:ft}),Zt=S({readOnly:ft,foldIntoHistory:!0}),qt=Nn(null),Qt=Oe(),_t=On(()=>({...Yt,select:e=>{qt.current=e,Yt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Qt.config;qt.current=Ve(e,t,n)}Yt.commitDocument(e,n)}}),[Yt,Qt]),eo=bt.ui,no=eo.leftSideBarVisible,to=eo.rightSideBarVisible,{options:oo,widths:ro,initial:io,fluid:lo,fit:so}=M(),[co,ao]=Pn(io),po=re(),uo=yt&&null!==po,fo=ie(),ho=le();j(xt?.props.id);const{read:mo,write:go,forSelection:yo}=A(),[So,ko]=Pn(mo);$n(()=>{go(So)},[So]);const[bo,vo]=Pn(0),wo=Nn(null),xo=Nn(null),zo=fn(xo,{readySelector:_n}),Co=gn(zo),Bo=c(xo);a(xo,zo);const Io=v(),No=nn(pt),Oo={state:lt,offline:Io||lt.failed&&ut,readOnlyReason:ht,editing:No?Wt.editing({name:tn(No.name,Ht),noun:Et.noun}):null,conflict:null!=st,notSaving:Et.bar.notSaving},Po=()=>{ft||(lt.failed?dt():at())};p(xo,zo,Po);const[$o,To]=Pn(!1),Lo=Nn(!1),Mo=Nn(!1),[jo,Ao]=Pn(null),[Ro,Eo]=Pn([]),[Vo,Fo]=Pn(R),Wo="puck"===Vo.kind,Ho=t(Vo,xt?.props.id),[Do,Uo]=Pn(null);$n(()=>{Do&&(o(),Uo(null))},[Do]);const Xo=Nn(zt);Xo.current=zt;const Jo=Tn((e,{scroll:n})=>{ko(n=>yo(e,n)),n&&Uo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Xo.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&vr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Go=Nn(null);$n(()=>{const e=Go.current;Go.current=null;const n=null==xt?.props.id?null:String(xt.props.id);Fo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Tt(xt?.type)??R);const t=xt?.props.id,o=qt.current;if(qt.current=null,!t)return;const i=zt(t);Jo(String(t),{scroll:!r(o,i??null,be)})},[xt?.props.id,Jo]);const Ko=Tn(e=>{Fo(n=>E(n,e)?n:e),vt({type:"setUi",ui:{rightSideBarVisible:!0}})},[vt]),Yo=Nn(()=>{});Yo.current=(e,n)=>{const t=e?hi(e.zone??be)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==xt?.props.id?null:String(xt.props.id);Fo(e=>E(e,n)?e:n),o!==r&&(Go.current={id:o,mode:n},_t.select(e))};const Zo=Tn((e,n)=>Yo.current(e,n),[]),qo={kind:Vo.kind,mode:Vo,open:Ko,show:e=>Fo(e),reveal:()=>{to||vt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Zo},Qo=V(qo,{data:bt.data,selected:xt??null,zoneOf:e=>zt(e)?.zone,readOnly:Boolean(ft),select:e=>{Fo(R),_t.select({index:e})},replace:(e,n)=>_t.replaceComponent(be,e,n),scrollTo:e=>l(e)},{device:co,refreshes:bo},{setView:ko,reveal:()=>{no||vt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),_o=Qo.resolveLeftView?Qo.resolveLeftView(So,uo):"media"===So&&uo?So:"sections",er=F(),{isLockedBlock:nr,duplicateBlocked:tr,nestDepth:or,newSectionNode:rr,canAddTo:ir,blockIsOffered:lr}=er,sr=W(),{labelAtLevel:dr,Icon:cr,useProducts:ar}=sr,pr=sr.rowName?(e,n,t)=>sr.rowName(e,n,t):void 0,ur=Tn(e=>{vt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),Jo(e,{scroll:!0})},[vt,Jo]),{selectNode:fr,openPartId:hr}=y({mode:Vo,setMode:Fo,onOpenPart:ur}),[mr,gr]=Pn(null);ce(null!==mr,()=>gr(null));const yr=h(H()),Sr=yr.collapsed,kr=yr.panelWidths,[br,vr]=Pn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Sr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
8
|
+
return new Set}});$n(()=>{try{window.localStorage.setItem(Sr,JSON.stringify([...br]))}catch{}},[br]);const[wr,xr]=Pn(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem(kr);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left),right:g(Number(n.right)||m.right)}}catch{return{...m}}});$n(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(kr,JSON.stringify(wr))}catch{}},300);return()=>clearTimeout(e)},[wr]);const zr=Tn((e,n)=>xr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Cr=Tn(e=>zr("left",e),[zr]),Br=Tn(e=>zr("right",e),[zr]),Ir=e=>br.has(e),Nr=e=>vr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Or=Nn(!1),Pr=Nn(null);$n(()=>{if(Or.current&&!$o){const e=Pr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??xo.current?.querySelector(`button[aria-label="${CSS.escape(Et.add.title)}"]`))?.focus(),Pr.current=null}Or.current=$o},[$o]),$n(()=>{if(!$o||!Bo)return;const e=e=>{"Escape"===e.key&&Ji()};return Bo.addEventListener("keydown",e),()=>Bo.removeEventListener("keydown",e)},[$o,Bo]),ce($o,()=>Ji()),$n(()=>{!no&&$o&&(To(!1),Ao(null),Lo.current=!1)},[no]),$n(()=>{if(!fo)return Mo.current&&vt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Mo.current=!1);$o&&(To(!1),Ao(null),Mo.current=Lo.current,Lo.current=!1),no||(Mo.current=!0,vt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[fo]),$n(()=>{!no&&fo&&(Mo.current=!1,ho())},[no]),$n(()=>{if(!fo||!Bo)return;const e=e=>{"Escape"===e.key&&ho()};return Bo.addEventListener("keydown",e),()=>Bo.removeEventListener("keydown",e)},[fo,Bo]),ce(null!==fo,()=>ho());const $r=D(),Tr=(e,n="success",t)=>{if($r)return void(t?$r(e,"error"===n?"error":"info",t):$r(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?An.error(e,{...o,duration:t?.duration??3200}):An.success(e,{...o,duration:t?.duration??1900})},Lr=Nn(null),[Mr,jr]=Pn(0),[Ar,Rr]=Pn(0),Er=U(),Vr=Nn(null),Fr=e=>Math.max(0,e.clientHeight-(Vr.current?.offsetHeight??0));$n(()=>{const e=Lr.current;if(!e)return;const n=()=>{jr(e.clientWidth),Rr(Fr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Vr.current&&t.observe(Vr.current),()=>t.disconnect()},[]),Ln(()=>{Lr.current&&(jr(Lr.current.clientWidth),Rr(Fr(Lr.current)))},[wr,no,to]);const Wr=co===lo?Mr>0?Mr:ro[lo]:ro[co],Hr=Mr>0?Math.min(Mr/Wr,"shrink"===so?1:2):1,Dr=Wr*Hr,Ur=Mr>0&&Dr>Mr+1,Xr={width:Dr,height:Ar||"100%",flex:"none",position:"relative"},Jr={width:Wr,height:Ar?Ar/Hr:"100%",maxHeight:"none",transform:1!==Hr?`scale(${Hr})`:void 0,transformOrigin:"top left"},Gr=()=>vt({type:"setUi",ui:{leftSideBarVisible:!no}}),Kr=()=>vt({type:"setUi",ui:{rightSideBarVisible:!to}}),Yr=e=>{$o&&(To(!1),Ao(null),Lo.current=!1,no&&So===e)||fo&&(Mo.current=!1,ho(),no&&So===e)||(no&&So===e?Gr():(ko(e),no||vt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Zr=()=>{oe(hn,{accept:"image/*",title:Xt.mediaLibrary})},qr=()=>{Fo(R),_t.select(null),d()},Qr=()=>{Fo(Lt??R),to||vt({type:"setUi",ui:{rightSideBarVisible:!0}})},_r=bt.data.content??[],ei=()=>{const e=_r.findIndex(Mt),n=_r.findIndex(jt);return{floor:e>=0?e+1:0,cap:n>=0?n:_r.length}},ni=Ct,ti=er.stripCopy,oi=e=>i(e,ti),ri=_(),ii=Fe({data:bt.data,config:ni,readOnly:Boolean(ft),clipboard:ri,strip:ti?e=>ti(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==wn||e.slot!==xn)return{min:0,max:n-1};const{floor:t,cap:o}=ei();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Fo(R);const t=void 0===n||"node"===n?.kind?n:null;_t.commitDocument(e,t)}}),li=e=>{const n=Bn(bt.data,Ct,e);if(!n)return!1;const t=zn(n.place),o=n.node,r=t===be?pi(o):Ci(o);return!!ii.remove(e)&&(Tr(Et.deleted({name:r}),"success",{duration:8e3,action:{label:Et.bar.undo,onClick:()=>{ii.restore(n.node,n.place)}}}),!0)},si={...ii,remove:li},di=e=>dr(e,"block",Ct.components[e]?.label??e),ci=Tn(e=>Ct.components[e]?.defaultProps??{},[Ct]),ai=e=>dr(e,"section",di(e)),pi=e=>ge({type:e.type,props:e.props??{}},ai(e.type),pr),{nodeAddresses:ui,zoneItems:fi}=On(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=we)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of xe(Ct,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(_r,be,0),{nodeAddresses:e,zoneItems:n}},[_r,Ct]),hi=Tn(e=>fi.get(e)??[],[fi]),mi=e=>{const n=ui.get(e);return n?hi(n.zone)[n.index]:void 0},gi=e=>Q(er,Ct,e),yi=e=>{if(!er.slotsOf||e===be)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=mi(e.slice(0,n));if(!t)return null;const o=gi(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},Si=(()=>{if(!X(Vo))return null;const e=`${Vo.nodeId}:${Vo.slot}`;return yi(e)?.slot.panel===Vo.kind?e:null})(),ki=Nn(null);$n(()=>{const e=ki.current;if(ki.current=null,!Si||!X(Vo))return;const n=Vo.nodeId;Jo(n,{scroll:e!==Si}),vr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Vo]);const bi=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ui.get(e);n&&(n.zone===be?Vi(n.index):ul(n.zone,n.index,e,mi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Si!==i&&(ki.current=i),Zo(null,r),to||vt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},vi=(e,n,t)=>{const o=`${e}:${n}`;if(vr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;Si!==o&&(ki.current=o);Zo(null,{kind:t,nodeId:e,slot:n})},wi=(e,n,t)=>{if(ft||!er.moveSlot)return;const o=mi(e),r=o?gi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:nt,index:n},s=un(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=er.moveSlot(e,n,s);"string"==typeof d&&vi(e,d,i.panel)},xi=ar(),zi=On(()=>{const e=/* @__PURE__ */new Map;for(const n of xi??[])e.set(n.slug,n.name);return e},[xi]),Ci=e=>ye(e,di,sr.plainText,e=>zi.get(e),sr.rowName),Bi=(e,n)=>{const t=Ct.components[e.type]?.fields,o=n===be||Ll(n)?"section":"block",r=n===be&&(Mt(e)||jt(e)||Pt(e.type)),i="block"===o?Se(t):r?null:ke(t);return sr.renamePropOf?sr.renamePropOf(e,o,i):i},Ii=(e,n,t,o)=>{if(!(!ft&&mr?.zone===e&&mr.index===n))return;const r=(t,o)=>{gr(null),o&&((e,n,t)=>{const o=hi(e)[n];if(!o)return;const r=Bi(o,e);r&&_t.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
9
|
+
return Jn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Et.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},Ni=n(J(),Ut),Oi=Ni.scope({target:kn,siteId:rt,docId:bn}),Pi=Ct,$i=(e,n)=>n===be?ai(e):di(e),Ti=(e,n,t)=>{const o=Ni.plan(Oi,t,$i(t.type,e),Pi);o&&(o.changed&&_t.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Tr(o.message))},Li=ee({nodesIn:hi,nodeAt:(e,n)=>hi(e)[n]??null,labelOf:(e,n)=>n===be?ai(e):di(e),renamePropOf:Bi,beginRename:(e,n)=>gr({zone:e,index:n}),history:{hasPast:wt.hasPast,hasFuture:wt.hasFuture,back:()=>wt.back(),forward:()=>wt.forward()},openPageSettings:()=>{_t.select(null),Fo(R)},pageSettingsLabel:Et.pageSettings,words:{menu:Dt,styleClipboard:Ut,screen:Et.menu},readOnly:Boolean(ft),collapseAll:()=>vr(new Set(hi(be).map(e=>String(e.props.id)))),onPasteRefused:e=>Tr(e?Et.pasteRefused({name:e.label}):Et.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Al(e,n),menuRows:Qo.menuRows,isLocked:e=>nr(e.type),duplicateBlocked:e=>tr(bt.data,e),permits:e=>ve(Ct,e.type),nodeOps:si,isPinned:(e,n)=>n===be&&(Mt(e)||jt(e)),sectionBand:ei,locate:e=>ui.get(e)??null,rowNameOf:(e,n)=>n===be?pi(e):Ci(e),selectAt:(e,n,t,o)=>{e===be?Vi(n):ul(e,n,t,o??"")},slotRung:e=>{const n=yi(e);return n?.slot.panel?{label:n.slot.label,select:()=>bi(n.node,n.slot,!1)}:null},style:{held:()=>fe(Oi),canCopy:e=>Ni.rows(Pi,e).some(e=>!1!==e.counted),copy:(e,n)=>Ni.copy(Oi,e,$i(e.type,n),Pi),paste:(e,n,t)=>Ti(e,n,t)},keys:gt?{target:Bo,selected:()=>{const e=bt.ui.itemSelector;return e?{zone:e.zone??be,index:e.index}:null},held:()=>ri.get(),readOnly:Boolean(ft),onDone:({done:e,name:n})=>{"copied"===e&&Tr(Et.copied({name:n}))}}:void 0},zo),Mi=Nn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});$n(()=>{Mi.current={copy:(e,n)=>Ni.copy(Oi,e,$i(e.type,n),Pi),paste:Ti,at:()=>{const e=bt.ui.itemSelector;if(!e)return null;const n=e.zone??be,t=hi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(ft)}});const ji=Tn(e=>{const n=he(e);if(!n)return;const t=Mi.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);$n(()=>{if(!Bo)return;const e=e=>ji(e);return Bo.addEventListener("keydown",e),()=>Bo.removeEventListener("keydown",e)},[ji,Bo]),yn(zo,"keydown",ji);const Ai=_r.map(e=>e.props.id).join("|");$n(()=>{const e=zo?.document??null,n=zo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Eo(e=>e.length?[]:e);const n=_r.findIndex(jt),t=n>=0?n:_r.length,o=n=>{const t=_r[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(mn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=_r.length>0&&!Mt(_r[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=et(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Eo(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[zo,Ai,co,Hr,no,to,xt?.props.id]);const Ri=zo?.document??null,Ei=zo?.window??null;$n(()=>{const e=wo.current;if(!e||!Ri||!Ei)return;const n=[],t=()=>{const n=Ri.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Ei.scrollTo({left:Ei.scrollX,top:Ei.scrollY+t,behavior:"instant"}),!0};return wo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ri,Ei]);const Vi=e=>{Fo(R),_t.select({index:e}),Qo.sectionPressed?.(_r[e]);const n=_r[e]?.props?.id;n&&l(n)},Fi=e=>{const{floor:n,cap:t}=ei(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=xt&&Vo.kind!==Lt?.kind?_r.findIndex(e=>e.props.id===xt.props.id):-1;return o(r>=0?r+1:t)},Wi=(e,n)=>{const{floor:t,cap:o}=ei(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(_t.reorderComponent(be,e,i),_t.select({index:i}),{moved:!0,dest:i})},Hi=(e,n,t,o)=>{Fo(R),_t.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Tr(Et.sectionAdded({name:t}))},Di=(e,n)=>{const t=Fi(n),o=rr(e,{nodeDefaults:ci,newNodeId:Ie,sectionLabel:ai,blockIsOffered:lr}),r=o?_t.insertNode(be,t,o):_t.insertSection(e,t);return Hi(t,r,ai(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of xe(Ct,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=ir(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:c,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Ui=e=>Xi(be,e),Xi=(e,n)=>{Pr.current=document.activeElement??null,fo&&(Lo.current=Mo.current,Mo.current=!1,ho()),Ao(null===n?null:{zone:e,index:n}),To(!0),no||(Lo.current=!0,vt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ji=()=>{To(!1),Ao(null),Lo.current&&vt({type:"setUi",ui:{leftSideBarVisible:!1}}),Lo.current=!1},Gi=(e,n)=>sr.rowName?n?Mt(e)?sr.rowName(e,"section",Et.header):jt(e)?sr.rowName(e,"section",Et.footer):Pt(e.type)?sr.rowName(e,"section",di(e.type)):pi(e):Ci(e):n?ai(e.type):di(e.type),Ki=e=>n=>{e()},Yi=(e,n,t)=>{if(ft)return null;const o=hi(e)[n];return o&&!ve(Ct,o.type).delete?null:/* @__PURE__ */Jn(je,{kind:"delete",label:Et.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=hi(e)[n]?.props?.id;null!=t&&li(String(t))})(e,n),children:/* @__PURE__ */Jn(Hn,{size:15})})},Zi=e=>sr.rowPreview?.(e)||void 0,qi=e=>sr.rowMarks?.(e)??void 0,Qi=(e,n,t)=>sr.rowActions?.(e,n,t)??null,_i=(e,n,t,o)=>{if(ft)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
10
|
+
return Jn(je,{kind:"eye",label:r?Et.showNamed({name:o}):Et.hideNamed({name:o}),onClick:()=>nl(e,n,t),children:/* @__PURE__ */Jn(r?Dn:Un,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},el=e=>fs(be,e),nl=(e,n,t)=>{_t.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},tl=e=>ze(Ct,e),ol=e=>xe(Ct,e),rl=e=>er.slotsOf?gi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Ce(e,n.slot)})):[{slot:null,rung:null,kids:ol(e)}],il=e=>er.slotsOf?rl(e).flatMap(e=>e.kids):ol(e),ll=e=>Boolean(er.slotsOf)&&gi(e).some(e=>e.rung),sl=(e,n,t)=>null===t?void 0===n?ir(e):ir(e,n):ir(e,n,t),dl=(e,n,t)=>{const o=Be(Ct,e.type,n)&&(t||il(e).length>0||ll(e));return{collapsible:o,folded:o&&Ir(String(e.props.id))}},cl=(e,n,t)=>rl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>dl(e,r,t(e.type)).collapsible?[String(e.props.id),...cl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),al=e=>il(e).length>0||ll(e)||Boolean(ir(e.type)),pl=e=>Boolean(ir(e)),ul=(e,n,t,o)=>{if(Fo(R),ir(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),_t.select({index:n,zone:e}),l(t)}else _t.select({index:n,zone:e}),l(t)},fl=(e,n,t,o,r)=>{const i=`${e}:${n}`;_t.insertComponent(i,t,o),ir(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),_t.select({index:o,zone:i})}):_t.select({index:o,zone:i})},hl=Nn(/* @__PURE__ */new Set);$n(()=>{_r.forEach(e=>{const n=ir(e.type)?.spec;if(!n)return;const t=e.props.id;if(hl.current.has(t))return;hl.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(ci)).forEach((e,t)=>Zt.seedChild(o,t,n.childType,e))})},[_r,Zt,ci]);const ml=Nn(/* @__PURE__ */new Set);$n(()=>{_r.forEach((n,t)=>{const o=n.props.id;if(ml.current.has(o))return;const r=e(n,tl(n.type));ml.current.add(o),r&&Zt.replaceComponent(be,t,{...n,props:r})})},[_r,Zt]),G(Zt,Ct);const gl=_r.findIndex(jt),yl=gl>=0?_r[gl]:null,Sl=At?_r.findIndex(Mt):-1,kl=Sl>=0?_r[Sl]:null,bl=Bt.groupTab,vl=On(()=>bl?e=>Pt(e.type):void 0,[bl]),wl=Boolean(Bt.groupBadge),xl=Bt.groupBadge?/* @__PURE__ */Jn("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Jn(jn,{tone:"info",size:"xs",children:Bt.groupBadge})}):void 0,zl=_r.find(e=>e.type===Nt)??null,Cl=_r.find(e=>e.type===Ot)??null,Bl=gl>=0?gl:_r.length,Il=[];_r.forEach(e=>{jt(e)||(al(e)&&Il.push(String(e.props.id)),Il.push(...cl(e,1,pl)))}),yl&&(Il.push(String(yl.props.id)),Il.push(...cl(yl,1,pl)));const Nl=Il.length>0&&Il.every(e=>br.has(e)),Ol=e=>{const n=sr.blockRowName(e,di);return sr.rowName?sr.rowName(e,"block",n):n},Pl=(e,n,t,o)=>{const r=hi(e)[t];if(!r)return;const i={...Cn(e),index:t},l={...Cn(n),index:Math.min(Math.max(o,0),hi(n).length)},s=un(i,l);if(e!==n||s!==t)try{ii.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof In))throw e}},$l=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of ol(e))n.add(r),t(o)};for(const t of tl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Tl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ui.get(n);if(!e)return null;if(e.zone===be)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Ll=e=>{const n=e.slice(0,e.indexOf(":")),t=_r.find(e=>Pt(e.type)&&String(e.props.id)===n);return t&&$t(n)===e?t:null},Ml=(e,n)=>{const t=Ll(e);return!t||(!Bt.groupAccepts||Bt.groupAccepts(t.type,n,hi(e).length))},jl=(e,n,t)=>{if(e.rung){const t=mi(e.rung.nodeId),o=t?gi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===nt&&n.index>=0&&n.index<=o}if(n.slot===nt)return!1;if(e.add)return Vl(e.add,n);const o=zn(n);if(Pt(e.type))return!1;const r=Ll(o),i=Ll(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!Ml(o,e.type))&&(n.index>=0&&n.index<=hi(o).length));if(e.zone===be||o===be){if(e.zone!==o)return!1;const{floor:t,cap:r}=ei();return n.index>=t&&n.index<=r}if(n.index<0||n.index>hi(o).length)return!1;if(e.zone===o)return!0;const l=yl&&!Bt.lastIsOpen?String(yl.props.id):null;return(!l||Tl(e.zone)!==l&&Tl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??hi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ui.get(i),s=l?hi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&$l(r).has(n))return!1;const d=ir(s.type,or(bt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(hi(n),r))})(e.zone,o,e.index,t)},Al=(e,n)=>{const t=zn(e.from),o=e.node;return t===zn(n)?Ml(t,o.type):jl({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Rl=e=>{const n=e.slice(0,e.indexOf(":")),t=ui.get(n),o=t?hi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=ir(o.type,or(bt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=B(r.choices??(r.spec?[{type:r.spec.childType,label:di(r.spec.childType)}]:[])),l=yi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Gi(o,t.zone===be)}},El=(e,n)=>{if("section"!==e.kind)return e;const t=zn(n);return t===be||Ll(t)?e:Rl(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},Vl=(e,n)=>{const t=El(e,n),o=zn(n);if("block"!==t.kind){if(Ll(o)){const e="section"===t.kind?t.type:t.template.node.type;return Ml(o,e)&&n.index>=0&&n.index<=hi(o).length}if(o!==be)return!1;const{floor:e,cap:r}=ei();return n.index>=e&&n.index<=r}if(o===be)return!1;const r=Rl(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(hi(o))},Fl=(e,n)=>{const t=El(e,n);if("block"!==t.kind&&Ll(zn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&Ml(n,o)){if("section"===e.kind)_t.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;_t.insertNode(n,t,oi(e.template.node))}Fo(R),_t.select({index:t,zone:n})}})(t,zn(n),n.index);if("section"===t.kind)return void Di(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=Fi(t),r=_t.insertNode(be,o,n);Hi(o,r,e)})(t.template.name,oi(t.template.node),n.index);const o=zn(n),r=Rl(o);r&&(r.target.spec?fl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{_t.insertComponent(e,n,t),Fo(R),_t.select({index:t,zone:e})})(o,t.type,n.index))},Wl=(e,n)=>{e.rung?wi(e.rung.nodeId,e.index,n.index):e.add?Fl(e.add,n):e.zone===be?Wi(e.index,n.index):Pl(e.zone,zn(n),e.index,n.index)},[Hl]=Pn(()=>an()),Dl=pn({keyOf:e=>e.id,readOnly:Boolean(ft),session:Hl,canDrop:jl,onDrop:Wl,onStep:(e,n)=>{e.rung?wi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===be?((e,n)=>{const t=ai(_r[e]?.type??""),o=Wi(e,n<0?e-1:e+2);if(!o.moved)return void Tr(n<0?Et.sectionFirst({name:t}):Et.sectionLast({name:t}));const{floor:r,cap:i}=ei();Tr(Et.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Pl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Ul=Tn(e=>{const{floor:n,cap:t}=ei(),o=[];for(const r of e.nodes){const e=zn(r.place),i=hi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Mt(i)||jt(i)||nr(i.type))continue;if(Pt(i.type))continue;const l=Boolean(Ll(e)),s=e===be||l;e===be&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?ai(i.type):Ci(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=zn(e.list);if(n===be&&0===e.children.length)return[{...e,addLabel:Et.addSection,addAlways:!0}];const t=Rl(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Ll(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=zn(e.list),t=n===be||Ll(n)?null:Rl(n);return t?.choices.length?ln(e,t.target.spec?.addLabel??Et.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[bt.data]),Xl=null==xt?.props.id?null:String(xt.props.id),Jl=Tn(e=>{const n=Ct,t=e=>!e.item.rung&&null!==Bn(bt.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(Xl);return i||(r(We(bt.data,n,o.item.id,Xl,vl))??o)},[bt.data,Ct,Xl,vl]),[Gl,Kl]=Pn(null);yn(zo,"mouseover",e=>{if(!bl)return;const n=Sn(e.target),t=n?Zn(bt.data,Ct,n):null;t!==Gl&&Kl(t)}),yn(zo,"mouseout",e=>{bl&&!e.relatedTarget&&Kl(null)});const Yl=e=>Mt(e)||jt(e)||Pt(e.type),Zl=[];if(bl){const e=Xl?Zn(bt.data,Ct,Xl):null;for(const n of/* @__PURE__ */new Set([e,Gl])){const e=n?_r.find(e=>String(e.props.id)===n):void 0;if(!e||!Yl(e))continue;const t=bl(e);t&&Zl.push({id:String(e.props.id),label:t,below:Mt(e)||e.type===Nt})}}const ql=se(),Ql=Nn(null);$n(()=>{const e=Bt.changeNotice;if(!e)return;const n=JSON.stringify(_r.filter(Yl)),t=Ql.current;if(Ql.current={doc:bn,bands:n,index:wt.index},!t||t.doc!==bn||t.bands===n)return;wt.hasPast&&wt.index>=t.index&&!Yn.has(ql)&&(Yn.add(ql),Tr(e,"success",{action:{label:Et.bar.undo,onClick:()=>wt.back()},duration:8e3}))},[_r]);const _l=e=>{Fo(R),_t.select(e.zone===be?{index:e.index}:{index:e.index,zone:e.zone})},es=K(),ns=()=>({data:bt.data,device:co,ops:_t,inspector:qo}),ts=es?.model,os=On(()=>ts?e=>ts(e,Ul(e),ns()):Ul,[ts,Ul,co]),rs=es?.measure,is=rs?(e,n)=>rs(e,n,ns()):void 0,ls=es?.canDrop,ss=ls?(e,n)=>ls(e,n,jl,ns()):jl,ds=es?.drop,cs=ds?(e,n)=>ds(e,n,Wl,ns()):Wl,as=es?.pick,ps=as?e=>as(e,_l,ns()):_l,us=e=>{const n=zn(e),t=yi(n);t&&bi(t.node,t.slot,!1),Xi(n,e.index)},fs=(e,n)=>/* @__PURE__ */Jn(Ae,{...ft?{}:Dl.seam({place:{...Cn(e),index:n}})},`seam:${e}:${n}`),hs={rowClick:Ki,isCollapsed:Ir,toggleCollapse:Nr},ms=e=>{const n=String(e.props.id),t=_r.findIndex(e=>String(e.props.id)===n),o=$t(n),r=hi(o),i=Ir(n),l=di(e.type),s=sr.rowName?sr.rowName(e,"section",l):l,d=e=>fs(o,e);/* @__PURE__ */
|
|
11
|
+
return Gn(Kn,{children:[
|
|
12
|
+
/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:e.type,size:13}),name:s,preview:Zi(e),marks:qi(e),onSelect:()=>Vi(t),nameSlot:Ii(be,t,n,s),selected:Ho===n,badge:xl,actions:Qi(e,be,t)??void 0,rowProps:{"data-node-id":n,onClick:Ki(()=>Vi(t))},fold:{open:!i,label:"section",onToggle:()=>Nr(n)}}),!i&&/* @__PURE__ */Gn(Te,{children:[r.map((n,t)=>{const r=String(n.props.id),i=pi(n),l=al(n),s=l&&Ir(r),c=()=>ul(o,t,r,e.type),{rowProps:a,...p}=Dl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Cn(o),index:t}},{"data-node-id":r,onClick:Ki(c)});/* @__PURE__ */
|
|
13
|
+
return Gn(Mn,{children:[d(t),
|
|
14
|
+
/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:n.type,size:13}),name:i,preview:Zi(n),marks:qi(n),onSelect:c,nameSlot:Ii(o,t,r,i),selected:Ho===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Nr(r)}:void 0,actions:/* @__PURE__ */Gn(Kn,{children:[Yi(o,t,i),Qi(n,o,t),_i(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Jn(Te,{children:Ss(n,2)})]},r)}),d(r.length)]})]})},gs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Dl.dragging,d=!Ir(l)&&s?.rung?.nodeId!==i,c={...Cn(l),index:0},a=s&&!s.rung&&jl(s,c)?c:void 0,p=()=>bi(e,n,!0),{rowProps:u,...f}=Dl.row({item:{id:`rung:${l}`,zone:`${i}:${nt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:nt,index:t},into:a,canDrag:Boolean(er.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Ki(p)}),h=ft?null:er.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
15
|
+
return Gn(Mn,{children:[n.heading,
|
|
16
|
+
/* @__PURE__ */Jn($e,{words:Vt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Si===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Nr(l)},actions:h&&h.length>0?/* @__PURE__ */Jn(Kn,{children:h.map((t,o)=>/* @__PURE__ */Jn(je,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(ft||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&vi(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */Jn(Hn,{size:15}):/* @__PURE__ */Jn(Xn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Jn(Te,{children:r})]},l)},ys=(e,n)=>{const t=rl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
17
|
+
return Jn(Kn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=sl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=(e,n)=>fs(e,n),p=/* @__PURE__ */Gn(Kn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Ho===String(n.props.id),{collapsible:i,folded:s}=dl(n,l,pl(n.type)),d=String(n.props.id),c=Ol(n),p=()=>ul(t,o,d,e.type),{rowProps:u,...f}=Dl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Cn(t),index:o}},{"data-node-id":d,onClick:Ki(p)});/* @__PURE__ */
|
|
18
|
+
return Gn(Mn,{children:[0===o&&a(t,0),
|
|
19
|
+
/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:n.type,size:13}),name:c,preview:Zi(n),marks:qi(n),onSelect:p,nameSlot:Ii(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Nr(d)}:void 0,actions:/* @__PURE__ */Gn(Kn,{children:[Yi(t,o,c),Qi(n,t,o),_i(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Jn(Te,{children:ys(n,l+1)}),a(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?a(d,0):null:0!==i.length||!t.rung&&d!==c?null:a(c,0)]});return t.rung?gs(e,t.rung,r++,o,p):/* @__PURE__ */Jn(Mn,{children:p},t.slot??"")})})},Ss=(e,n)=>{const t=or(bt?.data,e.type,String(e.props.id)),o=rl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
20
|
+
return Jn(Kn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=sl(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>fs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),S=/* @__PURE__ */Gn(Kn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Ho===String(n.props.id),i=Ci(n),l=String(n.props.id),{collapsible:d,folded:c}=dl(n,s,pl(n.type)),a=tl(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...Cn(p),index:hi(p).length}:void 0,f=Dl.dragging,h=u&&f&&jl(f,u)?u:void 0,g=()=>ul(t,o,l,e.type),{rowProps:y,...S}=Dl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Cn(t),index:o},into:h,canDrag:!nr(n.type)},{"data-node-id":l,onClick:Ki(g)});/* @__PURE__ */
|
|
21
|
+
return Gn(Mn,{children:[0===o&&m(t,0),
|
|
22
|
+
/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:n.type,size:13}),name:i,preview:Zi(n),marks:qi(n),onSelect:g,nameSlot:Ii(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...S,fold:d?{open:!c,label:"group",onToggle:()=>Nr(l)}:void 0,actions:nr(n.type)?Qi(n,t,o)??void 0:/* @__PURE__ */Gn(Kn,{children:[Yi(t,o,i),Qi(n,t,o),_i(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Jn(Te,{children:Ss(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
23
|
+
/* @__PURE__ */Jn(w,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>fl(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?gs(e,o.rung,i++,r,S):/* @__PURE__ */Jn(Mn,{children:S},o.slot??"")})})},ks=$o||null!==fo,bs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:no&&!ks&&_o===e.id,onSelect:()=>Yr(e.id)}:e,vs=[...(Qo.railLead??[]).map(bs),{id:"sections",label:Et.layers,icon:/* @__PURE__ */Jn(ae,{}),active:no&&!ks&&"sections"===_o,onSelect:()=>Yr("sections")},...(Qo.railTrail??[]).map(bs)];uo?vs.push({id:"media",label:Et.railMedia,icon:/* @__PURE__ */Jn(pe,{}),active:no&&!$o&&(null!==fo||"media"===_o),onSelect:()=>Yr("media")}):yt&&vs.push({id:"media",label:Et.railMedia,icon:/* @__PURE__ */Jn(pe,{}),onSelect:Zr});const ws=[...Qo.railLead??[],...Qo.railTrail??[]].find(e=>"panel"in e&&e.id===_o),xs=Boolean(Rt?.foldable),zs=Rt?.label??(St?Et.pageSections:Et.templateSections),Cs=xs&&Ir(tt),Bs=/* @__PURE__ */Gn(Kn,{children:[_r.map((e,n)=>{if(Mt(e)||jt(e)||Pt(e.type))return null;const t=Ho===String(e.props.id),o=Boolean(e.props._hidden);ol(e);const r=String(e.props.id),i=Qo.hasOwnRows?.(e)??!1,l=al(e)||i,s=l&&Ir(r),d=tl(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...Cn(c),index:hi(c).length}:void 0,p=Dl.dragging,u=a&&p&&jl(p,a)?a:void 0,{rowProps:f,...h}=Dl.row({item:{id:r,zone:be,index:n,type:e.type},place:{...Cn(be),index:n},into:u},{"data-node-id":r,onClick:Ki(()=>Vi(n))});/* @__PURE__ */
|
|
24
|
+
return Gn(Mn,{children:[n>0&&el(n),
|
|
25
|
+
/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:e.type,size:13}),name:pi(e),preview:Zi(e),marks:qi(e),onSelect:()=>Vi(n),nameSlot:Ii(be,n,r,pi(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Nr(r)}:void 0,actions:/* @__PURE__ */Gn(Kn,{children:[Yi(be,n,pi(e)),Qi(e,be,n),_i(be,n,e,pi(e))]}),rowProps:f}),al(e)&&!s&&/* @__PURE__ */Gn(Te,{children:[Ss(e,1),Qo.partRows?.(e,hs)]}),i&&!s&&/* @__PURE__ */Jn(Te,{children:Qo.ownRows?.(e,n,hs)})]},String(e.props.id??n))}),Bl>0&&el(Bl)]}),Is=(e,n,t)=>{const o=String(e.props.id),r=il(e).length>0||ll(e)||Boolean(ir(e.type)),i=r&&Ir(o),l="header"===t?Et.header:Et.footer,s=sr.rowName?sr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
26
|
+
return Gn(Kn,{children:[
|
|
27
|
+
/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:t,size:13}),name:s,preview:Zi(e),marks:qi(e),badge:xl,onSelect:()=>Vi(n),nameSlot:Ii(be,n,o,s),selected:Ho===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Nr(o)}:void 0,actions:Qi(e,be,n)??void 0,rowProps:{"data-node-id":o,onClick:Ki(()=>Vi(n))}}),r&&!i&&/* @__PURE__ */Jn(Te,{children:ys(e,1)})]})};return(Qo.wrap??(e=>e))(
|
|
28
|
+
/* @__PURE__ */Jn(Y,{target:zo,children:/* @__PURE__ */Gn("div",{ref:xo,className:"sf-editor es-editor",style:Qe(wr),onContextMenu:Li.onEditorContextMenu,...u(hn),children:[
|
|
29
|
+
/* @__PURE__ */Gn(He,{children:[
|
|
30
|
+
/* @__PURE__ */Jn(De,{items:vs,ariaLabel:Et.bar.views}),
|
|
31
|
+
/* @__PURE__ */Gn(Ue,{children:[
|
|
32
|
+
/* @__PURE__ */Jn(Xe,{label:Et.bar.undo,disabled:Boolean(ft)||!wt.hasPast,onClick:()=>wt.back(),children:/* @__PURE__ */Jn(En,{})}),
|
|
33
|
+
/* @__PURE__ */Jn(Xe,{label:Et.bar.redo,disabled:Boolean(ft)||!wt.hasFuture,onClick:()=>wt.forward(),children:/* @__PURE__ */Jn(Vn,{})}),
|
|
34
|
+
/* @__PURE__ */Jn(Je,{}),
|
|
35
|
+
/* @__PURE__ */Jn(Ge,{devices:oo,value:co,onChange:ao}),
|
|
36
|
+
/* @__PURE__ */Jn(Xe,{label:Et.bar.refresh,tip:Et.bar.refreshTip,onClick:()=>{wo.current=(()=>{const e=zo?.document;if(!e)return null;const n=_r.findIndex(jt),t=n>=0?n:_r.length;let o=null;for(let n=0;n<t;n++){const t=_r[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=xt?.props?.id??_r[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),vo(e=>e+1)},children:/* @__PURE__ */Jn(Fn,{})})]}),
|
|
37
|
+
/* @__PURE__ */Gn(Ue,{kind:"right",style:{minWidth:300},children:[
|
|
38
|
+
/* @__PURE__ */Jn(k,{input:Oo,words:Et.saveStatus}),Qo.barLead?.(),Qo.barTrail?.(),Qo.mainAction||!Qo.barMain?/* @__PURE__ */Jn(b,{input:Oo,action:Qo.mainAction??{label:Et.done,onPress:()=>{it(bt.data)}},readOnly:Boolean(ft),saveSwitch:mt,onToggleAutoSave:ct,onSaveNow:Po,bar:Et.bar,words:Et.saveStatus}):Qo.barMain()]})]}),
|
|
39
|
+
/* @__PURE__ */Jn(ne,{}),
|
|
40
|
+
/* @__PURE__ */Gn("div",{className:"sf-body",children:[no?/* @__PURE__ */Gn(Kn,{children:[
|
|
41
|
+
/* @__PURE__ */Jn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Et.leftPanel,children:$o?/* @__PURE__ */Jn(x,{at:jo?{label:(e=>{const n=Ll(e.zone);if(n)return Et.add.addingTo({name:sr.rowName?Gi(n,!0):di(n.type)});if(e.zone===be){const n=_r[e.index];return n&&!jt(n)?Et.add.addingBefore({name:Gi(n,!0)}):Et.add.addingAtEnd}const t=Rl(e.zone);return t?Et.add.addingTo({name:t.parentName}):Et.add.addingHere})(jo),onClear:()=>Ao(null)}:void 0,placeBlocks:jo&&jo.zone!==be?Rl(jo.zone)?.choices:void 0,canTake:jo?e=>{if(!jo)return null;const n={...Cn(jo.zone),index:jo.index};if(Vl(e,n))return null;const t=Ll(jo.zone);if(t)return Et.add.notInside({name:Gi(t,!0)});if(jo.zone===be)return Et.add.onlySections;const o=Rl(jo.zone);return o?Et.add.notInside({name:o.parentName}):Et.add.onlySections}:void 0,onPick:jo?e=>{if(!jo)return;const n={...Cn(jo.zone),index:jo.index};Vl(e,n)&&(Fl(e,n),Ji())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Hl,siteWide:Qo.addPanelRow?.(Ji),onClose:Ji,onHide:Gr,readOnly:Boolean(ft)}):fo&&po?
|
|
42
|
+
/* @__PURE__ */Jn(I,{panel:po,pick:fo,onHide:Gr}):ws?ws.panel({onHide:Gr,notify:Tr}):"media"===_o&&po?/* @__PURE__ */Jn(I,{panel:po,pick:null,onHide:Gr}):/* @__PURE__ */Gn(Kn,{children:[
|
|
43
|
+
/* @__PURE__ */Jn(z,{icon:/* @__PURE__ */Jn(ae,{}),title:Et.layers,context:Jt,actions:/* @__PURE__ */Gn(Kn,{children:[!ft&&/* @__PURE__ */Jn(Ke,{label:Et.add.title,onClick:()=>Ui(null),children:/* @__PURE__ */Jn(Wn,{size:15})}),
|
|
44
|
+
/* @__PURE__ */Jn(Ke,{label:Nl?Et.expandAll:Et.collapseAll,title:0===Il.length?Et.nothingToFold:void 0,disabled:0===Il.length,onClick:()=>vr(e=>{const n=new Set(Il);return Nl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Il])}),children:/* @__PURE__ */Jn(Qn,{expand:Nl})})]}),onHide:Gr}),
|
|
45
|
+
/* @__PURE__ */Gn(Le,{className:"sf-tree sf-scroll",words:Vt,children:[
|
|
46
|
+
/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:"page",size:13}),name:Et.pageSettings,onSelect:qr,selected:!xt&&Wo,rowProps:{onClick:Ki(qr)}}),zl&&/* @__PURE__ */Gn(Kn,{children:[!wl&&/* @__PURE__ */Jn(Me,{children:Et.header}),ms(zl)]}),kt&&!(wl&&zl)&&/* @__PURE__ */Gn(Kn,{children:[!wl&&/* @__PURE__ */Jn(Me,{children:Et.header}),!At&&/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:"header",size:13}),name:Et.header,badge:xl,onSelect:Qr,selected:Vo.kind===Lt?.kind,rowProps:{onClick:Ki(Qr)}})]}),kl&&!(wl&&zl)&&Is(kl,Sl,"header"),!xs&&/* @__PURE__ */Jn(Me,{children:zs}),xs?/* @__PURE__ */Gn(Kn,{children:[
|
|
47
|
+
/* @__PURE__ */Jn($e,{words:Vt,icon:null,name:zs,fold:{open:!Cs,label:zs,onToggle:()=>Nr(tt)}}),!Cs&&/* @__PURE__ */Jn(Te,{children:Bs})]}):Bs,kt&&!wl&&/* @__PURE__ */Jn(Me,{children:Et.footer}),yl&&!(wl&&Cl)&&Is(yl,gl,"footer"),Cl&&ms(Cl),Qo.treeFoot?.()]})]})}),
|
|
48
|
+
/* @__PURE__ */Jn(Ye,{side:"left",width:wr.left,min:qe,max:Ze,defaultWidth:m.left,label:Et.resizeLeftPanel,onResize:Cr})]}):/* @__PURE__ */Jn(C,{side:"left",onShow:Gr}),
|
|
49
|
+
/* @__PURE__ */Gn("div",{ref:Lr,className:"sf-center sf-scroll","data-sf-canvas-head":Er?"":void 0,style:{overflowX:Ur?"auto":"hidden",overflowY:"hidden"},children:[Er&&/* @__PURE__ */Jn("div",{ref:Vr,className:"sf-canvas-head",children:/* @__PURE__ */Jn(Er,{device:co})}),
|
|
50
|
+
/* @__PURE__ */Gn("div",{className:"sf-frame-scaler",style:Xr,children:[
|
|
51
|
+
/* @__PURE__ */Jn("div",{className:"sf-frame "+(co===lo?"":`sf-frame--${co}`),style:Jr,children:/* @__PURE__ */Gn("div",{className:"sf-preview-host",children:[
|
|
52
|
+
/* @__PURE__ */Jn(Pe.Provider,{value:vl,children:/* @__PURE__ */Jn(Gt,{},bo)}),
|
|
53
|
+
/* @__PURE__ */Jn(sn,{canvas:zo,session:Hl,model:os,measure:is,canDrop:ss,onDrop:cs,choose:Jl,onPick:ps,onZoneAdd:us,onSeamAdd:us,zoneAddLabel:Et.canvasAddBlock,words:Ft.canvas,readOnly:Boolean(ft),revision:bt.data}),Ro.length>0&&!Co&&/* @__PURE__ */Jn("div",{className:"sf-preview-gaps",children:Ro.map(e=>
|
|
54
|
+
/* @__PURE__ */Jn(dn,{index:e.index,label:Et.addSectionHere,onInsert:()=>Ui(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),bl?/* @__PURE__ */Jn(qn,{canvas:zo,tabs:Zl,onSelect:e=>{const n=_r.findIndex(n=>String(n.props.id)===e);n>=0&&Vi(n)}}):null]})]}),to?/* @__PURE__ */Gn(Kn,{children:[
|
|
55
|
+
/* @__PURE__ */Jn(f,{value:{selectChild:ul,addChild:fl,childRowName:Ci,blockRowName:Ol},children:/* @__PURE__ */Jn(Kt,{mode:Vo,onOpenWebsiteSettings:Qo.openSettings??(()=>{}),onOpenSiteStyles:Qo.openStyles,onSelectNode:fr,onNotify:Tr,onHidePanel:Kr,nodeActions:xt?ve(Ct,xt.type):ot})}),
|
|
56
|
+
/* @__PURE__ */Jn(Ye,{side:"right",width:wr.right,min:qe,max:Ze,defaultWidth:m.right,label:Et.resizeSettingsPanel,onResize:Br})]}):
|
|
57
|
+
/* @__PURE__ */Jn(C,{side:"right",onShow:Kr})]}),Li.menu]})}))}export{rt as ScreenChrome};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{PanelToggleIcon as e}from"./chunk-UMDQ6CLQ.js";import{InspectorHead as n}from"./chunk-
|
|
1
|
+
import{PanelToggleIcon as e}from"./chunk-UMDQ6CLQ.js";import{InspectorHead as n}from"./chunk-GWIVPLOX.js";import{DEFAULT_CHROME_WORDS as i}from"./chunk-Z6PVRXVY.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{Tooltip as s,IconButton as t,Button as c}from"efficient-shell/ui";import{jsx as r,jsxs as l,Fragment as d}from"react/jsx-runtime";function a({icon:e,title:i,context:o,actions:s,side:t="left",onHide:c}){/* @__PURE__ */
|
|
2
2
|
return r(n,{icon:e,name:i,kind:o,actions:s||c?/* @__PURE__ */l(d,{children:[s,c?/* @__PURE__ */r(m,{side:t,onHide:c,divider:Boolean(s)}):null]}):void 0})}function m({side:n,onHide:c,divider:a=!1}){const m=o("chrome",i);/* @__PURE__ */
|
|
3
3
|
return l(d,{children:[a?/* @__PURE__ */r("span",{className:"sf-head-divider","aria-hidden":"true"}):null,
|
|
4
4
|
/* @__PURE__ */r(s,{content:m.hidePanel,side:"bottom",children:/* @__PURE__ */r(t,{className:"es-insp-iconbtn","aria-label":m.hidePanelLabel({side:n}),onClick:c,children:/* @__PURE__ */r(e,{side:n})})})]})}function h({side:n,onShow:c}){const l=o("chrome",i);/* @__PURE__ */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{panelFieldsOf as t}from"./chunk-LER7RKTO.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-FJL3MYPA.js";import{DESIGN_GROUP_KEY as e,BUCKET_KEY as r}from"./chunk-MQNBD6AB.js";import{STYLE_KIND as s,fieldKind as c,copyStyle as i,heldStyle as p,planPaste as u,pasteMessage as a}from"./chunk-V7U33NF2.js";import{ANCHOR_FIELD_KEYS as f,foldMetaOf as l,MEDIA_FIELD_MARKER as m,TEXT_FIELD_MARKER as h,LINK_FIELD_MARKER as y}from"./chunk-DUVRZ456.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(f),g=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[m,h,y];function v(t){return`site:${t??""}`}function A(t){if(!t||"object"!=typeof t)return null;const n=t,e=o(t)??t,r=n[s]??e[s];if("string"==typeof r)return r;const i=n.options??e.options;if(Array.isArray(i)){return`choice:${i.map(t=>String(t?.value)).sort().join("|")}`}return c(e)}function D(t){const n=t,e=o(t);return k.some(t=>t in n||e&&t in e)}function L(o,e){const s=t(o,e)??{},c=[];let i=!0,p=!1;for(const[t,o]of Object.entries(s))b.has(t)?(i=t===r.Design,p=!1):w.has(t)?i&&(p=j.has(t)):p&&o&&"object"==typeof o&&!t.startsWith("_")&&(l(o)||S.has(t)||g.has(t)||D(o)||"slot"!==o.type&&c.push({path:[t],kind:A(o),counted:"mobile"!==n(o)?.tier}));return c}function O(t,o,n,e,r){i({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function d(t,o,n,e,r,s){const c=p(n);if(!c)return null;const i=u(c,{type:e.type,rows:t(o,e),props:e.props});return{...i,message:a(i,c.sourceLabel,r,s)}}function F(t,o,n,e){O(L,t,o,n,e)}function R(t,o,n,e,r){return d(L,t,o,n,e,r)}var B={scope:t=>v(t.siteId),rows:(t,o)=>L(t,o),copy:(t,o,n,e)=>F(e,t,o,n),plan:(t,o,n,e)=>R(e,t,o,n)};function M(t,o){if(!t&&!o)return B;const n=t?.rows,e=n?(t,o)=>n(t,o):L;return{scope:t?.scope??B.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>O(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>d(e,s,t,n,r,o))}}export{F as copyNodeStyle,L as nodeStyleRows,R as planNodePaste,A as shopFieldKind,v as siteStyleScope,M as styleClipboardOf};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-SPQOPWCL.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-BU2YSTLJ.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
|
|
2
2
|
return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
|
package/dist/copy/index.js
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
import{TEXT_STYLE_CASES as e}from"../chunk-YHZSBL2N.js";import{selectionToVisible as t,selectionToSource as n,richLayout as r,createHistory as l,colorRunOf as o,textRange as a,selectionBox as s,placeWindow as c,offsetOrigin as i,visibleArea as u,ColorWindow as d,markPress as p,pasteToMarkup as
|
|
1
|
+
import{TEXT_STYLE_CASES as e}from"../chunk-YHZSBL2N.js";import{selectionToVisible as t,selectionToSource as n,richLayout as r,createHistory as l,colorRunOf as o,textRange as a,selectionBox as s,placeWindow as c,offsetOrigin as i,visibleArea as u,ColorWindow as d,markPress as p,pasteToMarkup as h,richInput as m,editVisible as f,MARKUP_CLIPBOARD_TYPE as g,markupOfRange as y}from"../chunk-23VM4PMV.js";export{ColorWindow,MARKUP_CLIPBOARD_TYPE,TYPING_BURST_MS,colorRunOf,createHistory,editVisible,markupOfRange,newLine,pasteToMarkup,richInput,richLayout,selectionToSource,selectionToVisible,setBullet,startCanvasTyping,textMap,toSource,toSourceStart,toVisible}from"../chunk-23VM4PMV.js";import{DEFAULT_COPY_WORDS as v}from"../chunk-B4JN227A.js";import{FieldNumber as b}from"../chunk-2XMHLXMA.js";import{FieldSelect as k}from"../chunk-G3GWAP5R.js";import"../chunk-WRFD4EXD.js";import{SettingsSwitch as x,SettingsField as S,SettingsSegmented as w}from"../chunk-36LVP5WD.js";import{useWords as E}from"../chunk-MFIRYGHW.js";import{registerModalEscapeInterceptor as C,textToolbarRows as D,TextToolbar as N,LinkPicker as L,Tooltip as T,IconButton as O}from"efficient-shell/ui";export{TextToolbar}from"efficient-shell/ui";import{useRef as R,useState as K,useLayoutEffect as M,useEffect as P,useId as j}from"react";import{RETIRED_MARKS as B,applyMark as V,marksIn as F,STANDARD_MARKUP as H,listIn as W,colorIn as $,spanFor as z,findLink as I,tokenizeInline as q,colorOver as A,setList as U,unlinkAt as Y,removeLink as G,linkOver as _,writeLink as X}from"efficient-shell/markup";import{jsxs as Z,jsx as J,Fragment as Q}from"react/jsx-runtime";import{ParagraphSpacingIcon as ee,LetterSpacingIcon as te,LineSpacingIcon as ne,TextSizeIcon as re,AlignJustifyIcon as le,AlignRightIcon as oe,AlignCenterIcon as ae,AlignLeftIcon as se,StylesIcon as ce,TypeIcon as ie,AlignmentIcon as ue,ListFormatIcon as de,CaseIcon as pe,ItalicIcon as he,NumberedListIcon as me,ListIcon as fe,ListNoneIcon as ge,CaseLowerIcon as ye,CaseCapitalizedIcon as ve,CaseUpperIcon as be,CaseNormalIcon as ke}from"efficient-shell/icons/efficient";function xe(e,t,n,r,l){for(const o of l){if(o.kind!==n)continue;if(!e.startsWith(o.open,t))continue;const l=t+o.open.length;if(e.startsWith(r,l)&&e.startsWith(o.close,l+r.length))return o}return null}function Se({value:e,rules:t=H,className:n,layerRef:r}){const l=function(e,t){const n=[];let r=0;for(const l of q(e,t)){if("text"===l.kind){l.text.length>0&&(n.push({kind:"text",text:e.slice(r,r+l.text.length)}),r+=l.text.length);continue}const o=xe(e,r,l.kind,l.text,t);if(!o)return[{kind:"text",text:e}];const a=r+o.open.length,s=a+l.text.length,c=s+o.close.length;n.push({kind:"delimiter",text:e.slice(r,a)}),n.push({kind:l.kind,text:e.slice(a,s)}),n.push({kind:"delimiter",text:e.slice(s,c)}),r=c}return n.map(e=>e.text).join("")!==e?[{kind:"text",text:e}]:n}(e,t);/* @__PURE__ */
|
|
2
|
+
return J("div",{ref:r,className:["es-gold-layer",n??""].filter(Boolean).join(" "),"aria-hidden":"true",children:l.map((e,t)=>function(e,t){const{kind:n,text:r}=e;switch(n){case"delimiter":/* @__PURE__ */
|
|
3
|
+
return J("span",{className:"es-gold-delim",children:r},t);case"accent":case"highlight":/* @__PURE__ */
|
|
4
|
+
return J("em",{className:"es-gold-mark es-gold-accent",children:r},t);case"bold":/* @__PURE__ */
|
|
5
|
+
return J("strong",{className:"es-gold-mark es-gold-bold",children:r},t);case"italic":/* @__PURE__ */
|
|
6
|
+
return J("em",{className:"es-gold-mark es-gold-italic",children:r},t);case"strike":/* @__PURE__ */
|
|
7
|
+
return J("s",{className:"es-gold-mark es-gold-strike",children:r},t);case"quiet":/* @__PURE__ */
|
|
8
|
+
return J("span",{className:"es-gold-mark es-gold-quiet",children:r},t);default:/* @__PURE__ */
|
|
9
|
+
return J("span",{className:"es-gold-text",children:r},t)}}(e,t))})}function we({value:e,onInput:t,onCommit:n,onCancel:r,multiline:l=!1,placeholder:o,className:a,rules:s=H,ariaLabel:c,disabled:i=!1,inputRef:u}){const d=R(null),p=R(e),h=R(!1);function m(e){h.current&&(h.current=!1,n?.(e))}/* @__PURE__ */
|
|
10
|
+
return Z("div",{className:["es-gold",l?"es-gold-is-multiline":"es-gold-is-single",i?"es-gold-is-off":"",a??""].filter(Boolean).join(" "),children:[
|
|
11
|
+
/* @__PURE__ */J(Se,{value:e,rules:s,layerRef:d}),o&&""===e?
|
|
12
|
+
/* @__PURE__ */J("div",{className:"es-gold-placeholder","aria-hidden":"true",children:o}):null,
|
|
13
|
+
/* @__PURE__ */J("textarea",{ref:u,className:"es-gold-input",disabled:i,value:e,placeholder:o,"aria-label":c,onChange:function(e){h.current=!0,t(e.currentTarget.value)},onFocus:function(){p.current=e,h.current=!1},onBlur:function(){m(e)},onKeyDown:function(t){return"Escape"===t.key?(t.preventDefault(),h.current=!1,void r?.(p.current)):"Enter"!==t.key||l?void 0:(t.preventDefault(),void m(e))},onScroll:function(e){const t=d.current;t&&(t.scrollTop=e.currentTarget.scrollTop,t.scrollLeft=e.currentTarget.scrollLeft)}})]})}function Ee(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function Ce(e,t,n,r=V){const{start:l,end:o}=Ee(e,n);return r(e,l,o,t)}function De(e,t,n){const{start:r,end:l}=Ee(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}function Ne(e,t,n,r){switch(t){case"bold":return e.createElement("strong");case"italic":return e.createElement("em");case"strike":return e.createElement("s");case"underline":return e.createElement("u");case"sup":return e.createElement("sup");case"sub":return e.createElement("sub");case"color":{const t=e.createElement("span");return t.className="es-rich-color",r&&(t.dataset.color=r,t.title=r.startsWith("#")?r.toUpperCase():r,t.style.color=r.startsWith("#")?r:`var(--es-color-${r}, inherit)`),t}case"link":{const t=e.createElement("a");return t.className="es-rich-link",n&&(t.title=n),t}default:{const n=e.createElement("span");return n.className="highlight"===t||"accent"===t?"es-rich-emphasis":`es-rich-${t}`,n}}}function Le(e,t,n,r){const l=e.layout.lines;if(n===t)return r>=e.lines.length?e.layout.text.length:l[r].vis;const o=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===o)return 0;const a=t.ownerDocument.createRange();a.setStart(e.lines[o],0);try{a.setEnd(n,r)}catch{return l[o].vis}return l[o].vis+Math.min(a.toString().length,l[o].text.length)}function Te(e,t){const n=e.layout.lines;let r=n.length-1;for(let e=0;e<n.length;e+=1)if(t<=n[e].vis+n[e].text.length){r=e;break}let l=Math.max(0,t-n[r].vis);const o=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let a=o.nextNode(),s=null;for(;a;){if(l<=a.data.length)return[a,l];l-=a.data.length,s=a,a=o.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function Oe({value:e,rules:l,multiline:o,readOnly:a=!1,placeholder:s,ariaLabel:c,handle:i,onEdit:u,onSelect:d,onHistory:p,onFormat:v,pending:b,onCommit:k,onCancel:x}){const S=R(null),w=R(null),E=R(null),C=R(null),D=R(null),N=R(e),[L,T]=K(0),O=R({value:e,rules:l,multiline:o,readOnly:a,pending:b,onEdit:u,onHistory:p,onFormat:v});O.current={value:e,rules:l,multiline:o,readOnly:a,pending:b,onEdit:u,onHistory:p,onFormat:v};const j=()=>{const e=S.current,t=w.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=Le(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Le(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},B=(e,t)=>{const n=S.current,r=w.current;if(!n||!r)return;const[l,o]=Te(r,e),[a,s]=Te(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};i.current={getSource(){const e=j(),t=w.current;if(!e||!t)return null;const[r,l]=n(t.layout,e[0],e[1]);return{start:r,end:l}},setSource(e,t,n){C.current={text:n,src:[e,t]},T(e=>e+1)},focus(){S.current?.focus()},rangeOf(e,n){const r=S.current,l=w.current;if(!r||!l)return null;const[o,a]=t(l.layout,e,n),[s,c]=Te(l,o),[i,u]=Te(l,a),d=r.ownerDocument.createRange();return d.setStart(s,c),d.setEnd(i,u),d}},M(()=>{const n=S.current;if(!n||D.current)return;const o=C.current?null:j();w.current=function(e,t){const n=e.ownerDocument;e.replaceChildren();const r=t.lines.map(t=>{const r=n.createElement("div");r.className=null!=t.number?"es-rich-line is-numbered":t.bullet?"es-rich-line is-bullet":"es-rich-line",null!=t.number&&(r.dataset.number=t.number);const l=[],o=()=>l.length?l[l.length-1].el:r;let a=null;for(const e of t.chars){let t=0;for(;t<l.length&&t<e.marks.length&&l[t].id===e.marks[t].id;)t+=1;(l.length>t||e.marks.length>t)&&(a=null),l.length=t;for(let r=t;r<e.marks.length;r+=1){const t=Ne(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color);o().appendChild(t),l.push({id:e.marks[r].id,el:t})}a||(a=n.createTextNode(""),o().appendChild(a)),a.data+=e.ch}return 0===t.chars.length&&r.appendChild(n.createElement("br")),e.appendChild(r),r});return{layout:t,lines:r}}(n,r(e,l)),E.current=e;const a=C.current;if(!a||a.text!==e)return void(o&&n.ownerDocument.activeElement===n&&B(o[0],Math.min(o[1],w.current.layout.text.length)));C.current=null;const s=w.current.layout,[c,i]=a.vis??t(s,a.src[0],a.src[1]);n.ownerDocument.activeElement!==n&&n.focus(),B(c,i)},[e,l,L]);const V=(e,t,r)=>{const l=w.current,[o,a]=n(l.layout,t[0],t[1]);C.current={text:e.text,vis:[e.caret,e.caret]},e.text!==O.current.value?O.current.onEdit(e.text,{start:o,end:a},r):T(e=>e+1)};P(()=>{const e=S.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=O.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=w.current,c=j();if(!s||!c)return;const i="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0,u=i&&!i.collapsed?[Le(s,e,i.startContainer,i.startOffset),Le(s,e,i.endContainer,i.endOffset)]:null,d=m({value:n,rules:r,multiline:l,inputType:t.inputType,data:t.data??t.dataTransfer?.getData("text/plain")??"",html:t.dataTransfer?.getData("text/html"),doc:e.ownerDocument,sel:c,target:u,pending:a});d&&("history"!==d.kind?"format"!==d.kind?V(d.edit,d.range,d.kind):O.current.onFormat(d.style):O.current.onHistory(d.dir))},n=()=>{D.current||T(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),P(()=>{const e=S.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=i.current?.getSource();e&&d(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const F=(t,n=!1)=>{const r=j();if(!r||r[0]===r[1])return;t.preventDefault();const o=w.current;t.clipboardData.setData("text/plain",o.layout.text.slice(r[0],r[1])),t.clipboardData.setData(g,y(e,l,r[0],r[1])),n&&!a&&V(f(e,l,r[0],r[1],{text:""}),r,"edit")};/* @__PURE__ */
|
|
2
14
|
return Z("div",{className:"es-rich-wrap",children:[s&&""===e?/* @__PURE__ */J("div",{className:"es-rich-placeholder","aria-hidden":"true",children:s}):null,
|
|
3
|
-
/* @__PURE__ */J("div",{ref:
|
|
15
|
+
/* @__PURE__ */J("div",{ref:S,className:`es-rich${o?" is-multiline":" is-single"}${a?" is-off":""}`,contentEditable:!a,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":o,"aria-label":c,"aria-readonly":a||void 0,"aria-placeholder":s,tabIndex:a?-1:0,spellCheck:!0,onFocus:()=>{N.current=e},onBlur:()=>{e!==N.current&&k?.(e),N.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),x?.(N.current),void(N.current=e);"Enter"!==t.key||o||(t.preventDefault(),e!==N.current&&k?.(e),N.current=e)},onCompositionStart:()=>{const e=j()??[0,0];D.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=D.current;if(D.current=null,!t)return;const{value:n,rules:r,pending:l}=O.current;e.data?V(f(n,r,t.from,t.to,{text:e.data,add:l?.add,drop:l?.drop,color:l?.color}),[t.from,t.to],"type"):T(e=>e+1)},onCopy:e=>F(e),onCut:e=>F(e,!0),onPaste:t=>{if(t.preventDefault(),a)return;const n=j();if(!n)return;const r=t.clipboardData.getData(g),s=r?o?r:r.replace(/\s*\r?\n\s*/g," "):h({html:t.clipboardData.getData("text/html"),text:t.clipboardData.getData("text/plain")},{doc:t.currentTarget.ownerDocument,multiline:o,rules:l});V(f(e,l,n[0],n[1],{markup:s}),n,"edit")}})]})}var Re={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */J(re,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */J(ne,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */J(te,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */J(ee,{}),unit:"px",step:1,shiftStep:10,min:0}};function Ke(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Me({cells:e,words:t,readOnly:n=!1}){const r=t??v.cells,l=j();/* @__PURE__ */
|
|
4
16
|
return J("div",{className:"es-copy-cells-fit",children:/* @__PURE__ */J("div",{className:"es-copy-cells",children:e.map(e=>{const t=e.scale??1,o=e.name??(e.nameKey?r[e.nameKey]:e.key),a=e.unit??"",s=e.step??1,c=`${l}-${e.key}`;/* @__PURE__ */
|
|
5
17
|
return Z("div",{className:"es-copy-cell",children:[
|
|
6
18
|
/* @__PURE__ */J("label",{className:"es-field-label es-copy-cell-name",htmlFor:c,children:o}),
|
|
7
|
-
/* @__PURE__ */J(b,{id:c,value:
|
|
8
|
-
return Z("div",{ref:lt,className:"es-copy"+(y?` ${y}`:""),onFocus:()=>he(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||he(!1)},onKeyDown:e=>{const t=e.target===
|
|
9
|
-
/* @__PURE__ */J(
|
|
19
|
+
/* @__PURE__ */J(b,{id:c,value:Ke(e.value,t),styleValue:Ke(e.styleValue,t),onChange:n=>e.onChange(void 0===n?void 0:Number((n/t).toFixed(6))),min:e.min,max:e.max,step:s,shiftStep:e.shiftStep,icon:e.icon,unit:a||void 0,steppers:"compact",readOnly:n,ariaLabel:o,title:r.tip({name:o,step:s,unit:a})})]},e.key)})})})}function Pe({target:e,onChange:t}){const n=R(null);return M(()=>{const t=n.current,r=e.current;t&&r&&r.value===t.text&&(n.current=null,r.focus(),r.setSelectionRange(t.start,t.end))}),r=>{const l=r(e.current);t(l.text),n.current={start:l.selectionStart,end:l.selectionEnd,text:l.text}}}var je=/* @__PURE__ */new Set([...B,"clear"]);function Be({value:e,onChange:t,onCommit:n,onCancel:r,multiline:m=!1,placeholder:f,ariaLabel:g,className:y,readOnly:b=!1,rules:k,tools:S=[],writeMark:w,align:T,actions:O,toolbar:B,barLabel:q,renderFooter:ee,inputRef:te,barShows:ne="always",richText:re=!0,defaultShowMarks:le=!1,colors:oe,cells:ae,letterCase:se,lastTool:ce}){const ie=E("copy",v),ue=R(null),de=te??ue,[pe,he]=K(!1),[me,fe]=K(null),ge=R(l()).current,ye=R(null);P(()=>{const t=ye.current;t&&e===t.to?ye.current=null:t&&e===t.from||(ye.current=null,ge.reset())},[e,ge]);const ve=n=>{ye.current={from:ye.current?.from??e,to:n},t(n)},be=t=>({text:e,start:t?.selectionStart??me?.start??e.length,end:t?.selectionEnd??me?.end??e.length}),[ke,xe]=K(le),Se=re&&!(m&&ke),Ee=R(null),Ne=j(),[Le,Te]=K(null),[Re,Ke]=K(!1),Be=()=>{if(!Se)return de.current;const e=Ee.current?.getSource()??me;return e?{selectionStart:e.start,selectionEnd:e.end}:null},Ve=Pe({target:de,onChange:ve}),Fe=e=>(fe({start:e.selectionStart,end:e.selectionEnd}),e),He=(t,n)=>{if(!Se)return void Ve(e=>(n&&ge.record(be(e),"edit",Date.now()),Fe(t(e))));const r=Be(),l=Fe(t(r));n&&ge.record(be(r),"edit",Date.now()),Te(null),l.text!==e&&ve(l.text),Ee.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},We=e=>He(e,!0),$e=e=>He(t=>{const n=be(t),r=ge[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),ze=R(null);M(()=>{const t=ze.current;t&&(ze.current=null,Se?Ee.current?.setSource(t.start,t.end,e):(de.current?.focus(),de.current?.setSelectionRange(t.start,t.end),fe(t)))},[Se]);const[Ie,qe]=K(null),Ae=k??H,Ue=("string"==typeof S[0]?S:S.map(e=>e.style)).filter(e=>!je.has(e)),Ye={};if(me){const t=F(e,me.start,me.end,Ae);for(const e of Ue){const n=t.has(e)||"highlight"===e&&t.has("accent");Ye[e]=!!Le?.add.includes(e)||!Le?.drop.includes(e)&&n}Ye.link=t.has("link")}const Ge=()=>{const t=Be(),n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}},_e=t=>{if("link"!==t&&z(0,t)){const{start:n,end:r}=Ge();if(n===r&&!Se)return void We(n=>Ce(e,t,n,(e,t,n,r)=>V(e,t,n,r,Ae,ie.placeholders)));const l=p({value:e,rules:Ae,start:n,end:r,style:t,pending:Le});return void("pending"===l.kind?Te(l.pending):We(()=>l.result))}if("link"!==t){const n=w??((e,t,n,r)=>V(e,t,n,r,H,ie.placeholders));return void We(r=>Ce(e,t,r,n))}const n=Be(),r=n?.selectionStart??e.length,l=n?.selectionEnd??r;Ke(!1),qe({start:r,end:l,link:I(e,r,l)})},Xe=Boolean(me&&me.start!==me.end),Ze=me?W(e,me.start,me.end,Ae):null,Je=me?Le&&void 0!==Le.color&&Le.at===me.start?Le.color:$(e,me.start,me.end,Ae):null,Qe=o(Je,oe),et=t=>{Se?t?Ee.current?.setSource(t.start,t.end,e):Ee.current?.focus():(de.current?.focus(),t&&de.current?.setSelectionRange(t.start,t.end))},tt=()=>{const e=Ie;qe(null),et(e?{start:e.start,end:e.end}:me)},nt=()=>{const e=lt.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Ke(!1),t&&et(me)},rt=R(nt);rt.current=nt,P(()=>{if(Re)return C(e=>{const t=lt.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(rt.current(),!0)},()=>lt.current?.querySelector(".es-copy-colors"))},[Re]);const lt=R(null),ot=Re||null!==Ie;P(()=>{const e=lt.current;if(!ot||!e)return;const t=e.ownerDocument,n=()=>{Ke(!1),qe(null)},r=t=>{e.contains(t.target)||n()};let l;const o=r=>{const o=r.relatedTarget;o?e.contains(o)||n():(clearTimeout(l),l=setTimeout(()=>{const r=t.activeElement;t.hasFocus()&&r&&r!==t.body&&!e.contains(r)&&n()},0))};return t.addEventListener("pointerdown",r,!0),e.addEventListener("focusout",o),()=>{clearTimeout(l),t.removeEventListener("pointerdown",r,!0),e.removeEventListener("focusout",o)}},[ot]);const at=Ie??(Re?me??{start:e.length,end:e.length}:null),st=R(()=>{});st.current=()=>{const e=lt.current,t=e?.querySelector(".rosh-tb-wrap > .es-copy-pop");if(!e||!t||!at)return;const n=Se?null:e.querySelector(".es-gold-layer"),r=Se?Ee.current?.rangeOf(at.start,at.end)??null:n?a(n,at.start,at.end):null,l=r?.endContainer,o=l?1===l.nodeType?l:l.parentElement:null,d=r?s(r,o?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!d)return;const p=c({anchor:d,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:u(e),parent:i(t)});t.style.top=`${p.top}px`,t.style.left=`${p.left}px`,t.style.setProperty("--es-pop-point",`${p.point}px`),t.dataset.side=p.above?"above":"below"},M(()=>{const e=lt.current;if(!ot||!e)return;const t=()=>st.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".rosh-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,o=l&&r?new l(t):null;return o&&r&&o.observe(r),()=>{n?.removeEventListener("resize",t),o?.disconnect()}},[ot,Re,Ie,at?.start,at?.end,Se]);const ct="always"===ne||pe||null!==Ie||Re,it=oe&&oe.length>0?{run:Qe,open:Re,onToggle:()=>{qe(null),Re?nt():Ke(!0)}}:void 0,ut=ct?ce?ce({className:"rosh-tb-btn",disabled:b,selected:Xe,keepCaret:e=>e.preventDefault(),insert:t=>We(n=>De(e,t,n))}):"classic"===B?O:void 0:void 0,dt=new Set(Ue),pt=T?{value:T.value,allow:T.allow,onChange:T.onChange,disabled:T.disabled}:void 0,ht={pressed:Ze,onList:t=>{const{start:n,end:r}=Ge(),l=W(e,n,r,Ae);We(()=>U(e,n,r,l===t?null:t,Ae))}},mt=D({offered:dt,color:it,last:ut,alignment:pt,list:ht,letterCase:se});/* @__PURE__ */
|
|
20
|
+
return Z("div",{ref:lt,className:"es-copy"+(y?` ${y}`:""),onFocus:()=>he(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||he(!1)},onKeyDown:e=>{const t=e.target===de.current||Boolean(e.target.closest?.(".es-rich"));if(b||!t)return;if(e.altKey||e.metaKey===e.ctrlKey)return;const n=e.key.toLowerCase(),r="KeyZ"===e.code||"z"===n,l=("KeyY"===e.code||"y"===n)&&!e.shiftKey;if(r||l)return e.preventDefault(),e.stopPropagation(),void $e(l||e.shiftKey?"redo":"undo");const o={b:"bold",i:"italic",u:"underline",k:"link"}[`${e.shiftKey?"shift+":""}${n}`];o&&Ue.includes(o)&&(e.preventDefault(),e.stopPropagation(),_e(o))},onPaste:t=>{const n=de.current;if(b||!n||t.target!==n)return;t.preventDefault();const r=h({html:t.clipboardData.getData("text/html"),text:t.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:m,rules:Ae});We(t=>De(e,r,t))},style:oe&&oe.length>0?Object.fromEntries(oe.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const t=de.current;t&&t.ownerDocument.activeElement===t&&fe({start:t.selectionStart??e.length,end:t.selectionEnd??e.length})},children:[ct&&(mt.words||mt.paragraph)?
|
|
21
|
+
/* @__PURE__ */J(N,{className:"es-copy-toolbar","aria-label":q??ie.formatting,offered:dt,pressed:Ye,onMark:e=>_e(e),color:it,linkOpen:null!==Ie,last:ut,alignment:pt,list:ht,letterCase:se,disabled:b,windows:/* @__PURE__ */Z(Q,{children:[Re&&oe&&oe.length>0?/* @__PURE__ */J(d,{colors:oe,current:Je,words:ie.colors??v.colors,onPick:t=>{const{start:n,end:r}=Ge();if(n!==r)We(()=>A(e,n,r,t,Ae));else{if(!Se)return;Te({add:Le?.add??[],drop:Le?.drop??[],color:t,at:n})}}}):null,Ie?Ie&&/* @__PURE__ */J(L,{className:"es-copy-link es-copy-pop",value:Ie.link?.href??"",onApply:t=>{const n=Ie;qe(null),We(()=>Se?_(e,n.start,n.end,t,Ae):X(e,n.start,n.end,t))},onRemove:Ie.link?()=>{const t=Ie.link,n=Ie;qe(null),t&&We(()=>Se?Y(e,n.start,n.end,Ae):G(e,t))}:void 0,onCancel:tt}):null]})}):null,ae&&ae.length>0?/* @__PURE__ */J(Me,{cells:ae,words:ie.cells??v.cells,readOnly:b}):null,Se?/* @__PURE__ */J(Oe,{value:e,rules:Ae,multiline:m,readOnly:b,placeholder:f,ariaLabel:g,handle:Ee,pending:Le??void 0,onEdit:(t,n,r)=>{ge.record({text:e,start:n.start,end:n.end},r,Date.now()),Te(null),ve(t)},onSelect:e=>{fe(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Le||e.start===Le.at&&e.end===Le.at||Te(null)},onHistory:$e,onFormat:e=>{Ue.includes(e)&&_e(e)},onCommit:n,onCancel:r}):/* @__PURE__ */J(we,{value:e,onInput:e=>{ge.record(be(null),"type",Date.now()),ve(e)},onCommit:n,onCancel:r,multiline:m,placeholder:f,ariaLabel:g,rules:k,disabled:b,inputRef:de,className:"es-copy-box"}),ee?ee({focused:pe,insert:t=>We(n=>De(e,t,n))}):null,re&&m?
|
|
10
22
|
/* @__PURE__ */Z("div",{className:"es-copy-marks",children:[
|
|
11
|
-
/* @__PURE__ */J(
|
|
12
|
-
/* @__PURE__ */J("span",{id:
|
|
13
|
-
return J(
|
|
23
|
+
/* @__PURE__ */J(x,{checked:ke,onChange:()=>{const e=Be();ze.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:me,Te(null),xe(e=>!e)},ariaLabelledBy:Ne,disabled:b}),
|
|
24
|
+
/* @__PURE__ */J("span",{id:Ne,className:"es-copy-marks-label",children:ie.showMarks??"Show marks"})]}):null]})}var Ve=["left","center","right","justify"],Fe=v.align,He={left:/* @__PURE__ */J(se,{}),center:/* @__PURE__ */J(ae,{}),right:/* @__PURE__ */J(oe,{}),justify:/* @__PURE__ */J(le,{})},We={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function $e(e,t=Fe){return Ve.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:He[e],title:t[e]}))}var ze=["none","bullet","number"],Ie=e,qe={none:/* @__PURE__ */J(ge,{}),bullet:/* @__PURE__ */J(fe,{}),number:/* @__PURE__ */J(me,{})},Ae={none:/* @__PURE__ */J(ke,{}),upper:/* @__PURE__ */J(be,{}),capitalize:/* @__PURE__ */J(ve,{}),lower:/* @__PURE__ */J(ye,{})};function Ue({label:e,icon:t,answers:n,names:r,glyphs:l,row:o,readOnly:a}){const s=o.value||o.styleValue||"";/* @__PURE__ */
|
|
25
|
+
return J(S,{label:e,icon:t,children:/* @__PURE__ */J(w,{ariaLabel:e,value:s,disabled:a,onChange:e=>{a||o.onChange(function(e,t){return t===e.value||""===e.value&&t===e.styleValue?"":t}(o,e))},options:n.map(e=>({id:e,label:l[e],title:r[e]}))})})}function Ye({kept:e,keptHint:t,readOnly:n=!1,style:r,font:l,italic:o,cells:a,align:s,list:c,letterCase:i}){const u=E("copy",v),d={...v.panel,...u.panel},p=r&&!n?[r.onEditStyles&&{label:d.editStyles,onSelect:r.onEditStyles},r.onUpdateStyle&&{label:d.updateStyle,onSelect:r.onUpdateStyle}].filter(e=>!!e):[],h=!!o&&(o.value??o.styleValue??!1),m=o?/* @__PURE__ */J(T,{content:d.italic,children:/* @__PURE__ */J(O,{size:"sm",variant:"ghost","aria-label":d.italic,"aria-pressed":h,disabled:n,onClick:()=>{if(n)return;const e=!h;o.onChange(e===(o.styleValue??!1)?void 0:e)},children:/* @__PURE__ */J(he,{})})}):null;/* @__PURE__ */
|
|
14
26
|
return Z("div",{className:"es-tpp",children:[e?/* @__PURE__ */Z("div",{className:"es-tpp-kept",children:[
|
|
15
|
-
/* @__PURE__ */J(
|
|
16
|
-
/* @__PURE__ */J("div",{className:"es-tpp-font-select",children:/* @__PURE__ */J(
|
|
17
|
-
/* @__PURE__ */J(
|
|
27
|
+
/* @__PURE__ */J(Be,{...e,readOnly:n||e.readOnly}),t?/* @__PURE__ */J("p",{className:"es-field-hint",children:t}):null]}):null,r?/* @__PURE__ */J(S,{label:d.style,icon:/* @__PURE__ */J(ce,{}),children:/* @__PURE__ */J(k,{ariaLabel:d.style,value:r.value,options:r.options,onChange:r.onChange,changed:r.changed,footer:p,readOnly:n})}):null,l?/* @__PURE__ */J(S,{label:d.font,icon:/* @__PURE__ */J(ie,{}),children:/* @__PURE__ */Z("div",{className:"es-tpp-font",children:[
|
|
28
|
+
/* @__PURE__ */J("div",{className:"es-tpp-font-select",children:/* @__PURE__ */J(k,{ariaLabel:d.font,value:l.value||void 0,placeholder:l.styleValue,options:l.options,onChange:l.onChange,searchable:l.searchable,readOnly:n})}),m]})}):m?
|
|
29
|
+
/* @__PURE__ */J(S,{label:d.italic,icon:/* @__PURE__ */J(ie,{}),children:/* @__PURE__ */J("div",{className:"es-tpp-font",children:m})}):null,a?.length?/* @__PURE__ */J(Me,{cells:a,words:u.cells,readOnly:n}):null,s?/* @__PURE__ */J(Ue,{label:u.alignment,icon:/* @__PURE__ */J(ue,{}),answers:Ve.filter(e=>!s.allow||s.allow.includes(e)),names:u.align,glyphs:He,row:s,readOnly:n}):null,c?/* @__PURE__ */J(Ue,{label:d.list,icon:/* @__PURE__ */J(de,{}),answers:ze,names:d.lists,glyphs:qe,row:c,readOnly:n}):null,i?/* @__PURE__ */J(Ue,{label:d.capitalization,icon:/* @__PURE__ */J(pe,{}),answers:Ie,names:d.cases,glyphs:Ae,row:i,readOnly:n}):null]})}export{Ve as COPY_ALIGNS,We as COPY_ALIGN_FIT,He as COPY_ALIGN_GLYPHS,Fe as COPY_ALIGN_LABELS,Re as COPY_CELLS,Be as CopyBox,Me as CopyCells,Oe as RichBox,Ye as TextPartPanel,$e as copyAlignOptions,De as insertSelection,Ce as markSelection,Pe as useCaretEdit};
|
package/dist/draw/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{UiIcon}from"../chunk-OG2SKSSK.js";export{PreviewPartsProvider,usePreviewParts}from"../chunk-I54UCYOU.js";export{createPreviewSelectionContext,useSelectHandler}from"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";
|
|
1
|
+
export{UiIcon}from"../chunk-OG2SKSSK.js";export{PreviewDeviceContext,usePreviewDevice}from"../chunk-BSPCSC45.js";export{PreviewPartsProvider,usePreviewParts}from"../chunk-I54UCYOU.js";export{createPreviewSelectionContext,useSelectHandler}from"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";
|
package/dist/draw/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SCALAR_TEXT_CONTROLS,TEXT_CONTROL_KINDS}from"../chunk-PIND6KE7.js";export{VIEW_DESKTOP_MIN,VIEW_TABLET_MIN,VIEW_TIERS,VIEW_TIER_LABEL,viewTierForWidth}from"../chunk-DWIOHQG7.js";export{
|
|
1
|
+
export{SCALAR_TEXT_CONTROLS,TEXT_CONTROL_KINDS}from"../chunk-PIND6KE7.js";export{VIEW_DESKTOP_MIN,VIEW_TABLET_MIN,VIEW_TIERS,VIEW_TIER_LABEL,viewTierForWidth}from"../chunk-DWIOHQG7.js";export{rootRowName,sectionRenameProp,slotChildName,slotChildRenameProp,slotChildRowName}from"../chunk-TBF5CVPA.js";export{HERO_SLIDER_GOTO_EVENT}from"../chunk-IQ5TA7AM.js";export{ANCHOR_FIELD_KEYS,FOLD_FIELD_MARKER,LINK_FIELD_MARKER,MEDIA_FIELD_MARKER,SCAFFOLD_FIELD_MARKER,TEXT_FIELD_MARKER,foldMetaOf,textFieldIdentifier}from"../chunk-DUVRZ456.js";export{hidableText,readHidable}from"../chunk-6W7WLPZH.js";export{PART_SEP,decodePartId,encodePartId}from"../chunk-IYT6NN2J.js";export{FOOTER_TYPE,HEADER_TYPE,ROOT_ZONE,TREE_MAX_DEPTH,blockNodeActions,childSlotsOf,locateNode,missingPinnedTypes,nestsInTree,newNodeId,pinnedDuplicateIds,pinnedDuplicateIndices,slotChildrenIn,slotFieldsOf}from"../chunk-PLVEGYK6.js";export{TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,isTextStyleCase,textStyleCaseCss,textStyleCaseOfCss}from"../chunk-YHZSBL2N.js";
|