efficient-easel 23.1.0 → 24.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 +4 -1
- package/dist/{ScreenDocumentContext-BDLUYzlM.d.ts → ScreenDocumentContext-DPW_6gOC.d.ts} +16 -1
- package/dist/autosave/index.d.ts +3 -3
- package/dist/chrome/chrome.css +16 -0
- package/dist/chrome/index.d.ts +9 -3
- package/dist/chrome/index.js +1 -1
- package/dist/{chunk-JWOBAEBH.js → chunk-2AV62DEP.js} +1 -1
- package/dist/{chunk-UNVKPVZW.js → chunk-3FIS2FRS.js} +1 -1
- package/dist/chunk-4RJBW7VC.js +8 -0
- package/dist/{chunk-PY7OOQEZ.js → chunk-55KKGABA.js} +1 -1
- package/dist/chunk-5NHQ452C.js +1 -0
- package/dist/{chunk-SINAM2IT.js → chunk-5PXVT7JY.js} +1 -1
- package/dist/chunk-7BW74Y55.js +1 -0
- package/dist/{chunk-VHFLOHGQ.js → chunk-CMMR6CJS.js} +1 -1
- package/dist/chunk-CZAAGBVL.js +7 -0
- package/dist/{chunk-LSTOOYG7.js → chunk-D5GQEUKM.js} +1 -1
- package/dist/{chunk-GKG3M5QK.js → chunk-FRAIEWRC.js} +1 -1
- package/dist/{chunk-AT4DDMJS.js → chunk-G7ISR6DI.js} +1 -1
- package/dist/{chunk-6QSFJCJT.js → chunk-H4Z2V56N.js} +16 -16
- package/dist/chunk-HHQZB6IE.js +64 -0
- package/dist/{chunk-77IWWW6X.js → chunk-ISS72IKO.js} +1 -1
- package/dist/chunk-K7MMLCTT.js +2 -0
- package/dist/chunk-LX23TCTP.js +2 -0
- package/dist/{chunk-FHCKFOCD.js → chunk-NCXYC7WI.js} +2 -2
- package/dist/{chunk-BIK3AO2V.js → chunk-NQW6XCAY.js} +1 -1
- package/dist/{chunk-T3LAGI43.js → chunk-PDJ5ZALV.js} +1 -1
- package/dist/{chunk-2G6MAXPY.js → chunk-T2RINM7R.js} +1 -1
- package/dist/chunk-TOHOGVAE.js +15 -0
- package/dist/chunk-WYTPBF3Q.js +20 -0
- package/dist/{chunk-C56MPJBH.js → chunk-Y53EKN35.js} +1 -1
- package/dist/chunk-Z5BPY2VG.js +5 -0
- package/dist/{chunk-HNV6HUSQ.js → chunk-ZYHKXEND.js} +4 -4
- package/dist/copy/index.js +10 -10
- package/dist/draw/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.js +1 -15
- package/dist/panel/panel.css +12 -0
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaPopup.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +2 -2
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +2 -2
- package/dist/screen/components/SaveControls.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +3 -3
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +2 -2
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +2 -2
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +3 -3
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.js +1 -1
- package/dist/screen/lib/document/box-fields.d.ts +389 -0
- package/dist/screen/lib/document/box-fields.js +9 -0
- package/dist/screen/lib/document/slot-child-name.js +1 -1
- package/dist/screen/lib/document/style-clipboard.d.ts +2 -2
- package/dist/screen/lib/document/use-section-ops.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +1 -1
- package/dist/screen/lib/host-inbound.js +1 -1
- package/dist/screen/lib/host.d.ts +1 -1
- package/dist/screen/lib/host.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +1 -1
- package/dist/screen/lib/media-panel.js +1 -1
- package/dist/screen/lib/media-picker.d.ts +1 -1
- package/dist/screen/lib/media-picker.js +1 -1
- package/dist/screen/lib/save-status.d.ts +1 -1
- package/dist/screen/lib/screen-parts.d.ts +24 -6
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +32 -0
- package/dist/strings/index.d.ts +2 -2
- package/dist/{types-B3iSHX-w.d.ts → types-SrGNzYeO.d.ts} +6 -0
- package/dist/{words-Cm8PMYn0.d.ts → words-BAx3u2dD.d.ts} +1 -1
- package/package.json +9 -3
- package/dist/chunk-A6ZP5II4.js +0 -2
- package/dist/chunk-JPCOBNYW.js +0 -1
- package/dist/chunk-MQA7OFRA.js +0 -2
- package/dist/chunk-NQ7NRYTK.js +0 -8
- package/dist/chunk-S3DUFDQ6.js +0 -6
- package/dist/chunk-SSRYU3YG.js +0 -1
- package/dist/chunk-TGSK5VII.js +0 -5
- package/dist/chunk-Z6V22QRZ.js +0 -64
- package/dist/chunk-ZG6PVMC3.js +0 -19
package/README.md
CHANGED
|
@@ -1061,7 +1061,10 @@ const easel = createEasel<EaselConfig>({ config, data, onChange: (doc) => autosa
|
|
|
1061
1061
|
changed by hand, or taken out, while its resolver ran is left as it is.
|
|
1062
1062
|
- **`InspectorUpLevel` draws its own `←`** (the one up-level look, Lewis
|
|
1063
1063
|
2026-10-06): a blue text link, the arrow and the parent's name, no box and
|
|
1064
|
-
no hover change. `icon` is ignored. Inside a panel body, pass `inline`.
|
|
1064
|
+
no hover change. `icon` is ignored. Inside a panel body, pass `inline`.
|
|
1065
|
+
Where the inspector head does not name the open level, pass `title`: the
|
|
1066
|
+
level's name is drawn under the link (the shell's Text, an `h3`), 12 under
|
|
1067
|
+
the link and 12 over the first row (Lewis, 2026-10-28). The
|
|
1065
1068
|
icon set has no back arrow, on purpose: nothing needs one now, and a glyph
|
|
1066
1069
|
enters the set by the owner's icon standard, not for a host.
|
|
1067
1070
|
|
|
@@ -329,6 +329,21 @@ interface EaselFieldDescription {
|
|
|
329
329
|
arrayFields?: Record<string, EaselFieldDescription>;
|
|
330
330
|
objectFields?: Record<string, EaselFieldDescription>;
|
|
331
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* Where a custom field says what it is to a host (`EaselFieldDescription`): a
|
|
334
|
+
* custom field's `type` is only `custom`, and a host describing a block's
|
|
335
|
+
* fields — the website's host document bridge — reads the plain kind a builder
|
|
336
|
+
* declared here instead (`number`, `select` with its options). Moved from
|
|
337
|
+
* efficient-web-builder (`lib/host-document-bridge`) with the Box field set,
|
|
338
|
+
* whose builders declare it; the key is unchanged, so a stored config and the
|
|
339
|
+
* bridge read it as before.
|
|
340
|
+
*/
|
|
341
|
+
declare const FIELD_DESCRIPTION_MARKER = "sfDescribedAs";
|
|
342
|
+
/**
|
|
343
|
+
* `field` with its description declared: plain JSON, no functions. A choice
|
|
344
|
+
* declares its options here, or the reader takes them off the field.
|
|
345
|
+
*/
|
|
346
|
+
declare function describedAs<F extends object>(field: F, description: EaselFieldDescription): F;
|
|
332
347
|
/**
|
|
333
348
|
* One change a host asks the editor to make to the open document. Every
|
|
334
349
|
* change is recorded, so the editor's undo takes it back. `set_props` writes
|
|
@@ -747,4 +762,4 @@ declare function ScreenDocumentProvider({ target, addressing: handed, onHostMess
|
|
|
747
762
|
children: ReactNode;
|
|
748
763
|
}): react.JSX.Element;
|
|
749
764
|
|
|
750
|
-
export { type AnyDocumentAddressing as A, DETACHED_EASEL_HOST as D, type EaselBlockType as E, type HostPickedMedia as H, type InboundHostMessage as I, NO_DOCUMENT_ADDRESSING as N, type PageEditOp as P, type SectionScreenTarget as S, type DocumentAddressing as a, type EaselFieldDescription as b, type EaselHost as c, type EaselHostAddress as d, EaselHostContext as e, type EaselHostPanels as f, EaselHostProvider as g, type EaselMessageType as h, type EaselSelection as i, type EaselToHostMessage as j, type HostToEaselMessage as k, type PickedMediaSource as l, type SendToHost as m, createEaselHost as n,
|
|
765
|
+
export { type AnyDocumentAddressing as A, DETACHED_EASEL_HOST as D, type EaselBlockType as E, FIELD_DESCRIPTION_MARKER as F, type HostPickedMedia as H, type InboundHostMessage as I, NO_DOCUMENT_ADDRESSING as N, type PageEditOp as P, type SectionScreenTarget as S, type DocumentAddressing as a, type EaselFieldDescription as b, type EaselHost as c, type EaselHostAddress as d, EaselHostContext as e, type EaselHostPanels as f, EaselHostProvider as g, type EaselMessageType as h, type EaselSelection as i, type EaselToHostMessage as j, type HostToEaselMessage as k, type PickedMediaSource as l, type SendToHost as m, createEaselHost as n, describedAs as o, useHostEscape as p, type AnyScreenTarget as q, type DocumentTarget as r, ScreenDocumentContext as s, ScreenDocumentProvider as t, useEaselHost as u, type ScreenDocumentValue as v, type ScreenTarget as w, useScreenDocument as x };
|
package/dist/autosave/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as Autosave, A as AutosaveSnapshot, b as AutosaveOptions } from '../engine-CvXpFE86.js';
|
|
2
2
|
export { c as AutosaveClock, d as createAutosave } from '../engine-CvXpFE86.js';
|
|
3
|
-
import { S as SaveIndicator } from '../words-
|
|
4
|
-
export { a as SaveWords, s as saveIndicator } from '../words-
|
|
5
|
-
import '../types-
|
|
3
|
+
import { S as SaveIndicator } from '../words-BAx3u2dD.js';
|
|
4
|
+
export { a as SaveWords, s as saveIndicator } from '../words-BAx3u2dD.js';
|
|
5
|
+
import '../types-SrGNzYeO.js';
|
|
6
6
|
import '../types-Cy7rdmXt.js';
|
|
7
7
|
import '../wordFit-7XpmhcaW.js';
|
|
8
8
|
import 'react';
|
package/dist/chrome/chrome.css
CHANGED
|
@@ -357,6 +357,22 @@ span:has(> .es-insp-up-btn) {
|
|
|
357
357
|
text-overflow: ellipsis;
|
|
358
358
|
white-space: nowrap;
|
|
359
359
|
}
|
|
360
|
+
/* The link with the open level's name under it (`title`, Lewis 2026-10-28).
|
|
361
|
+
A column, so the link is a line of its own; 12 between the two, the gap
|
|
362
|
+
inside one setting. The gap to the first row is panel.css's. */
|
|
363
|
+
.es-insp-level {
|
|
364
|
+
display: flex;
|
|
365
|
+
flex-direction: column;
|
|
366
|
+
align-items: flex-start;
|
|
367
|
+
gap: var(--es-rhythm-within);
|
|
368
|
+
min-width: 0;
|
|
369
|
+
}
|
|
370
|
+
/* Size and weight are the shell Text's; an h3 only drops the UA margin. */
|
|
371
|
+
.es-insp-level-title {
|
|
372
|
+
margin: 0;
|
|
373
|
+
max-width: 100%;
|
|
374
|
+
overflow-wrap: anywhere;
|
|
375
|
+
}
|
|
360
376
|
.es-insp-head {
|
|
361
377
|
display: flex;
|
|
362
378
|
flex-wrap: wrap;
|
package/dist/chrome/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { T as TopBarProps, b as TopBarClusterProps, c as TopBarRailProps, E as EaselIconButtonProps, d as DeviceSwitchProps, e as SaveStateProps, f as SaveStateToggleProps, g as SaveIconProps, a as SaveIconState, h as SaveIconTone, P as PanelResizeHandleProps, I as InspectorHeadProps, i as InspectorIconButtonProps, j as InspectorUpLevelProps, k as EditNoticeProps } from '../types-
|
|
3
|
-
export { D as DeviceOption, R as RailWordsShown, S as SaveTone } from '../types-
|
|
2
|
+
import { T as TopBarProps, b as TopBarClusterProps, c as TopBarRailProps, E as EaselIconButtonProps, d as DeviceSwitchProps, e as SaveStateProps, f as SaveStateToggleProps, g as SaveIconProps, a as SaveIconState, h as SaveIconTone, P as PanelResizeHandleProps, I as InspectorHeadProps, i as InspectorIconButtonProps, j as InspectorUpLevelProps, k as EditNoticeProps } from '../types-SrGNzYeO.js';
|
|
3
|
+
export { D as DeviceOption, R as RailWordsShown, S as SaveTone } from '../types-SrGNzYeO.js';
|
|
4
4
|
import { C as ChromeWords, N as NoticeWords } from '../words-DYu4iBrR.js';
|
|
5
5
|
import { LockWords, EditAccess, SaveConflict } from '../edit-lock/index.js';
|
|
6
6
|
export { D as DEFAULT_PANEL_W, M as MAX_PANEL_W, a as MIN_PANEL_W, b as MIN_PANEL_W_BY_SIDE, P as PanelSide, c as PanelWidths, d as clampPanelWidth, p as panelWidthVars, s as setPanelWidthVars } from '../panelWidths-DgQXiPXU.js';
|
|
@@ -181,8 +181,14 @@ declare function InspectorIconButton({ label, title, hasPopup, onClick, disabled
|
|
|
181
181
|
* `inline` drops the panel-top inset, for a level inside the panel body (an
|
|
182
182
|
* open list item, a sub-panel): the link is the same, only where it sits
|
|
183
183
|
* differs.
|
|
184
|
+
*
|
|
185
|
+
* `title` names the open level under the link, where the inspector head does
|
|
186
|
+
* not (Lewis, 2026-10-28: the website's Locations › city › Map drew its own,
|
|
187
|
+
* 7px under the link and 32px over its first row). The shell's Text, 12 under
|
|
188
|
+
* the link (`--es-rhythm-within`) and 12 over the first row
|
|
189
|
+
* (`--es-rhythm-group-first`, panel.css), as a group heading is.
|
|
184
190
|
*/
|
|
185
|
-
declare function InspectorUpLevel({ name, onSelect, label, inline }: InspectorUpLevelProps): react.JSX.Element;
|
|
191
|
+
declare function InspectorUpLevel({ name, onSelect, label, inline, title }: InspectorUpLevelProps): react.JSX.Element;
|
|
186
192
|
|
|
187
193
|
/** Where the selected thing sits: a section, a block, or a part of something. */
|
|
188
194
|
type HeadTier = 'section' | 'block' | 'part';
|
package/dist/chrome/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MIN_PANEL_W_BY_SIDE,PanelResizeHandle,SaveIcon,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,headWords,panelWidthVars,saveIconTone,setPanelWidthVars}from"../chunk-
|
|
1
|
+
export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MIN_PANEL_W_BY_SIDE,PanelResizeHandle,SaveIcon,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,headWords,panelWidthVars,saveIconTone,setPanelWidthVars}from"../chunk-WYTPBF3Q.js";import"../chunk-MJM6SFD3.js";import"../chunk-AJSDWWJW.js";import"../chunk-2OAZYSWJ.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MFIRYGHW.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{blockRuns as e,offeredChoices as s}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as t}from"./chunk-
|
|
1
|
+
import{blockRuns as e,offeredChoices as s}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as t}from"./chunk-Z5BPY2VG.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-IYHO4XQX.js";import{useWords as r}from"./chunk-MFIRYGHW.js";import{ItemCount as n,DropdownMenu as c}from"efficient-shell/ui";import{jsxs as a,jsx as o,Fragment as i}from"react/jsx-runtime";function m({choices:m,onPick:p}){const{Icon:u}=t(),f=r("screen",l),h=e(s(m)).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */a("span",{className:"flex w-full items-center gap-2",children:[
|
|
2
2
|
/* @__PURE__ */o("span",{children:e.group}),
|
|
3
3
|
/* @__PURE__ */o(n,{count:e.items.length,label:f.blockCount({count:e.items.length}),className:"ml-auto"})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(u,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
|
|
4
4
|
return o(c,{align:"start",triggerClassName:"sf-add-card",items:h,trigger:/* @__PURE__ */a(i,{children:[
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mediaPickStoreFor as e}from"./chunk-
|
|
1
|
+
import{mediaPickStoreFor as e}from"./chunk-NCXYC7WI.js";var t=/* @__PURE__ */new Map,n=0;function o(o,i){if(!o.connected)return Promise.resolve(null);const r=(n+=1,`mp-${"undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():String(n)}`),c=e(o);return c?c.request({requestId:r,accept:i.accept,title:i.title,file:i.file??null,...i.options?{options:i.options}:{}}):new Promise(e=>{t.set(r,e),o.send("storefront-editor:open-media-picker",{requestId:r,accept:i.accept,title:i.title,...i.file?{file:i.file}:{}})})}function i(e,n){const o=t.get(e);o&&(t.delete(e),o(n))}export{o as requestMediaPick,i as resolveMediaPick};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-VKPOH6MK.js";import{blockTypesIn as o}from"./chunk-IZGFJWH4.js";import{sectionTemplatesOf as l}from"./chunk-N7E6264U.js";import{sharedSectionsOf as r}from"./chunk-N3MJOHAG.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-5PXVT7JY.js";import{blockRuns as c}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-Z5BPY2VG.js";import{useEaselSession as m}from"./chunk-YM4UEGBV.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-IYHO4XQX.js";import{useEasel as u}from"./chunk-VBOSOH5M.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-LN43DP2A.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-TQ5Y6S2X.js";import{useState as b,useEffect as v,useMemo as j,useRef as O}from"react";import{SharedIcon as w,AddIcon as C}from"efficient-shell/icons/efficient";import{ContextMenu as I,toast as H,Dialog as M,Button as $}from"efficient-shell/ui";import{jsx as x,jsxs as E,Fragment as F}from"react/jsx-runtime";function T({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=O(null);/* @__PURE__ */
|
|
2
|
+
return x(M,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */E(F,{children:[
|
|
3
|
+
/* @__PURE__ */x($,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
|
|
4
|
+
/* @__PURE__ */x($,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var B=e=>`section:${e}`,P=e=>`block:${e}`,S=e=>`template:${e}`,V=e=>`shared:${e}`;function Y({at:O,placeBlocks:M,canTake:$,onPick:Y,itemFor:A,session:G,siteWide:L,onClose:N,onHide:Q,readOnly:W}){const z=u(e=>e.config),D=a(),{labelAtLevel:U,categoryLabel:X,firstSection:J,Icon:R,Thumbnail:K}=D,{blockIsOffered:Z,canAddTo:_}=d(),q=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>Z(e,te);return l(te).list().then(n=>{if(e)return;const l=z.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[z,te]);const le=p().shared,re=h("screen",f).shared,[ie,se]=b([]),[ce,ae]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>Z(e,te);return r(te).list().then(n=>{if(e)return;const l=z.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[z,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(z,D),[z]),ye=e=>U(e,"section",z.components[e]?.label??e),he=e=>({type:B(e.type),label:e.name,cover:/* @__PURE__ */x(K,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:q.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ke=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=ne.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=ie.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}return null},ge=e=>/* @__PURE__ */x("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */x(R,{type:e,size:26})}),be=j(()=>{const e=t(ue,J),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!Z(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=_(t.type)?.choices??[];e.forEach(l),e.forEach(e=>_(e.type,1)?.choices?.forEach(l))}M?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:P(e.type),label:e.label,cover:ge(e.type),title:q.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>o.has(e.type)?{...he(e),cover:ge(e.type)}:he(e),d=[];ie.length>0&&d.push({key:"shared",title:re.group,tiles:ie.map(e=>({type:V(e.id),label:e.title,cover:/* @__PURE__ */x(K,{type:e.node.type}),mark:/* @__PURE__ */x(w,{size:12}),title:re.onPages({count:e.used_on.length}),keywords:[ye(e.node.type),e.node.type]}))}),ne.length>0&&d.push({key:"templates",title:q.templates,tiles:ne.map(e=>({type:S(e.id),label:e.name,cover:/* @__PURE__ */x(K,{type:e.node.type}),keywords:[ye(e.node.type),e.node.type]}))});const p=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(z.categories??{})){const o=ue.filter(e=>e.cat===t);if(0===o.length)continue;const l=e&&o.some(t=>t.type===e.type)?e:null,r=(l?[l,...o.filter(e=>e.type!==l.type)]:o).map(a);l&&!m&&(r.splice(1,0,...p.map(s)),m=!0),d.push({key:`category:${t}`,title:n(z,t,X),tiles:r})}const f=d.find(e=>e.key?.startsWith("category:"));if(!m&&f&&p.length>0&&(f.tiles=[...f.tiles,...p.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{d.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!$)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?$(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[ne,ie,re,ue,z,q,$,M,te]);/* @__PURE__ */
|
|
5
|
+
return E(F,{children:[
|
|
6
|
+
/* @__PURE__ */x(i,{icon:/* @__PURE__ */x(C,{size:15}),title:q.title,context:q.contextAll,actions:/* @__PURE__ */x(s,{label:q.done,description:q.doneDescription,onClick:N}),onHide:Q}),
|
|
7
|
+
/* @__PURE__ */E("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
+
/* @__PURE__ */x(k,{groups:be,session:G,itemFor:e=>A(ke(e)??{kind:"section",type:e}),onInsert:Y?e=>{const t=ke(e);t&&Y(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!W&&(pe({section:n.section,...t}),!0)},at:O,hint:q.hint,searchLabel:q.search,readOnly:W,words:ee}),L??null]}),de?/* @__PURE__ */x(I,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>pe(null),"aria-label":de.section.title,items:y([{label:re.deleteShared,danger:!0,onClick:()=>{fe(de.section),pe(null)}}])}):null,me?/* @__PURE__ */x(T,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void H.error(re.deleteFailed)}fe(null),le?.removed?.(e),se(t=>t.filter(t=>t.id!==e.id)),ae(e=>e+1)})(me),onCancel:()=>fe(null)}):null]})}export{Y as AddSidePanel,P as blockKey,B as sectionKey,V as sharedKey,S as templateKey};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-
|
|
1
|
+
import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-WYTPBF3Q.js";import{SplitButton as l,Kbd as i,CMD_S as n}from"efficient-shell/ui";import{CloudIcon as s,CheckIcon as o}from"efficient-shell/icons/efficient";import{jsx as r,jsxs as d}from"react/jsx-runtime";var c=e=>e.state.failed&&null!=e.state.retryAt||null!=e.state.savedAt;function u({input:l,words:i}){const n=e(c(l)),s=t({...l,now:n},i);/* @__PURE__ */
|
|
2
2
|
return r(a,{state:s.state,label:s.label})}function m({input:a,action:u,readOnly:m,saveSwitch:y,onToggleAutoSave:b,onSaveNow:p,bar:v,words:f}){const k=e(c(a)),h=t({...a,now:k},f),w=h.retry?v.retry:v.saveNow,g=/* @__PURE__ */d("span",{className:"es-savemenu-row",children:[w,
|
|
3
3
|
/* @__PURE__ */r("span",{"aria-hidden":"true",children:/* @__PURE__ */r(i,{keys:n,size:"sm"})})]}),S=[{type:"status",key:"status",label:h.line(u.status)},...(u.goingLive??[]).map((e,t)=>({type:"status",key:`going-live-${t}`,label:e})),{type:"divider",key:"divider"},...y?[{type:"checkbox",key:"auto-save",label:v.autoSave,checked:!a.state.paused,disabled:m,onSelect:b}]:[],{key:"save-now",label:g,icon:/* @__PURE__ */r(s,{}),disabled:m,onSelect:p},...u.menuItems?.length?[{type:"divider",key:"layer-divider"},...u.menuItems.map(e=>({key:`layer-${e.key}`,label:e.label,icon:e.icon,disabled:e.disabled,onSelect:e.onSelect}))]:[]],j=u.quiet??null,x=h.blocked??u.disabledReason??j?.reason??null;/* @__PURE__ */
|
|
4
4
|
return r(l,{variant:j?"secondary":"primary",leftIcon:j?/* @__PURE__ */r(o,{}):void 0,onClick:()=>u.onPress(),disabled:null!==x,disabledReason:x??void 0,tooltip:u.tooltip,loading:!0===u.busy,menuLabel:v.saveOptions,items:S,menuMinWidth:300,children:j?j.label:u.label})}export{m as ScreenMainButton,u as ScreenSaveIcon};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hidableText as n}from"./chunk-6UAEFOJ4.js";import{textFieldIdentifier as r}from"./chunk-ANPOR6EY.js";function t(r,t){const o=n(r.props.name);if(o)return o;const e=n(r.props.altName);if(e)return e;const c=r.props.collection?.name;if(c)return c;const u=r.props.source?.title;if(u)return u;const s=r.props.code;return s?t?.(s)??s:""}function o(n,r,o,e,c){const u=o(t(n,e))||r(n.type);return c?c(n,"block",u):u}function e(n){if(!n)return null;for(const t of["name","altName"])if(r(n[t]))return t;return null}function c(n){const t=n?.name;return void 0===t||r(t)?"name":null}function u(r,t,o){const e=n(r.props?.name).trim()||t;return o?o(r,"section",e):e}export{u as rootRowName,c as sectionRenameProp,t as slotChildName,e as slotChildRenameProp,o as slotChildRowName};
|
|
@@ -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-WYTPBF3Q.js";import{DEFAULT_CHROME_WORDS as i}from"./chunk-AJSDWWJW.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{useSectionOps as o}from"./chunk-D5GQEUKM.js";import{SELECTION_MODE as e}from"./chunk-Z5BPY2VG.js";import{decodePartId as r,encodePartId as t}from"./chunk-R4AUZVA3.js";import{useEasel as n}from"./chunk-VBOSOH5M.js";import{usePreviewParts as p}from"./chunk-467WWV4I.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=n(o=>o),f=o(),{setSelectedPartId:k,setSelectHandler:l}=p(),I=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),a?.(n)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{l(I)},[l,I]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{k(h)},[h,k]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&f.select(r)},[i,u,f]),openPartId:h}}export{m as usePartBridge};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-Z5BPY2VG.js";import{useEaselHost as e}from"./chunk-LX23TCTP.js";import{createEasel as r,EaselProvider as o}from"./chunk-VBOSOH5M.js";import{useState as n,useEffect as s}from"react";import{jsx as a}from"react/jsx-runtime";function i({config:i,data:c,onChange:m,permissions:p,parts:f,children:u}){const[d]=n(()=>r({config:i,data:c,permissions:p}));s(()=>{d.setConfig(i)},[d,i]),s(()=>{if(!m)return;let t=d.getState().appState.data,e=!1;return d.subscribe(()=>{const r=d.getState().appState.data;r!==t&&(t=r,(e||r!==d.loaded)&&(e=!0,m(r)))})},[d,m]),s(()=>{p&&d.setPermissions(p)},[d,p]);const h=e();/* @__PURE__ */
|
|
2
2
|
return a(o,{easel:d,hotkeys:h.ownsDocument,children:/* @__PURE__ */a(t,{parts:f,children:u})})}export{i as ScreenStoreProvider};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{SettingRow as e,Segmented as a,Tooltip as s}from"efficient-shell/ui";import{jsx as i,jsxs as l}from"react/jsx-runtime";function n({label:a,labelId:s,icon:l,value:n,hint:t,changed:c,htmlFor:d,action:r,children:o,className:m}){/* @__PURE__ */
|
|
2
|
+
return i(e,{size:"compact",label:a,labelId:s,icon:l,readout:n,description:t,changed:c,controlId:d,action:r,value:o,className:m})}function t({options:e,value:n,onChange:t,ariaLabel:c,fit:d,disabled:r=!1,className:o}){const m=d&&function(e,a){return{"--es-fit-count":e,"--es-fit-labels":`${a.labelsPx}px`,"--es-fit-widest":`${a.widestLabelPx}px`}}(e.length,d),b=e.findIndex(e=>e.id===n);
|
|
3
|
+
/* @__PURE__ */
|
|
4
|
+
return i("div",{className:"es-segs-fit","data-disabled":r||void 0,style:m,children:/* @__PURE__ */i(a,{size:"sm",label:c,className:`es-segs${m?" is-measured":""}${o?` ${o}`:""}`,value:b<0?"":String(b),onChange:a=>t(e[Number(a)].id),options:e.map((e,a)=>{const n=e.title??("string"==typeof e.label?e.label:void 0),t="string"!=typeof e.label,c=a=>n&&(e.icon||t)?/* @__PURE__ */i(s,{content:n,children:a}):a;return{value:String(a),disabled:r||!0===e.disabled,icon:e.icon?c(
|
|
5
|
+
/* @__PURE__ */i("span",{className:"es-seg-icon","aria-hidden":"true",children:e.icon})):void 0,label:t?/* @__PURE__ */l("span",{className:"es-seg-word es-seg-drawn",children:[c(
|
|
6
|
+
/* @__PURE__ */i("span",{className:"es-seg-mark","aria-hidden":"true",children:e.label})),
|
|
7
|
+
/* @__PURE__ */i("span",{className:"es-vh",children:n})]}):/* @__PURE__ */i("span",{className:"es-seg-word",children:e.label})}})})})}export{n as SettingsField,t as SettingsSegmented};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-Z5BPY2VG.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-TCAAOYQY.js";import{useEasel as o,useEaselApi as r}from"./chunk-VBOSOH5M.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenDocument as n}from"./chunk-
|
|
1
|
+
import{useScreenDocument as n}from"./chunk-K7MMLCTT.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-IYHO4XQX.js";import{EditNotice as r}from"./chunk-WYTPBF3Q.js";import{useWords as e}from"./chunk-MFIRYGHW.js";import{jsx as i}from"react/jsx-runtime";function t(){const{capabilities:t,access:c,takeOverEditing:a,viewReadOnly:s,saveConflict:m,reloadFromServer:u}=n(),{noun:l}=e("screen",o);return t.hasEditGuard?/* @__PURE__ */i(r,{access:c,conflict:m,noun:l,onTakeOver:a,onViewReadOnly:s,onReload:u}):null}export{t as PageEditGuardNotices};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselSession as e}from"./chunk-YM4UEGBV.js";import{useHostEscape as n}from"./chunk-
|
|
1
|
+
import{useEaselSession as e}from"./chunk-YM4UEGBV.js";import{useHostEscape as n}from"./chunk-LX23TCTP.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-IYHO4XQX.js";import{styleMenuItems as o}from"./chunk-V7U33NF2.js";import{ROOT_ZONE as l}from"./chunk-TCAAOYQY.js";import{easelMenuEntries as r,menuLabel as i}from"./chunk-FIVU2COQ.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-P5VYGWYO.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-YU3WHLGI.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as y}from"./chunk-TGZCD6IP.js";import{useState as h,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,StylesIcon as O,LayersIcon as z,CopyIcon as P}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function T(e,n){const t=[],o=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===l)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var Y=c(),j=/* @__PURE__ */new WeakMap;function D(e){if(e.claimsPage)return Y;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=j.get(n);return t||(t=c(),j.set(n,t)),t}function I(){return D(e())}function K(e,n,t){if(n===l){const{floor:n,cap:o}=e.sectionBand();return{parentId:y,slot:m,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function M(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function X(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?K(e,t.zone,t.index+1):null;for(const l of T(e,t)){const t=K(e,l.zone,l.index+1);if(o(n,t))return t}return null}function S(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(u(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function L(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=M(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:X(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function E(e,n){const{zone:t,index:r}=n,i=e.nodeAt(t,r);if(!i)return[];const c=i.props.id,a=e.labelOf(i.type,t),u=Boolean(i.props._hidden),d=e.nodeOps,p=e.isPinned(i,t),f=e.isLocked(i),m=!p&&!f&&!e.duplicateBlocked(i),y=e.permits?.(i)??{duplicate:!0,delete:!0},h=M(e,i,t),k=T(e,n),b=d.held,v=b&&!p?X(e,b,n):null,g=!e.readOnly,w=e.style?o({held:g?e.style.held():null,canCopy:e.style.canCopy(i,t),onCopy:()=>e.style?.copy(i,t),onPaste:()=>e.style?.paste(t,r,i),words:e.words?.styleClipboard}):[];return s({title:a,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},r=n.zone===l?null:e.slotRung?.(n.zone)??null;return r?[o,{label:r.label,checked:!1,onClick:r.select}]:[o]})},actions:{duplicate:g&&m&&y.duplicate?()=>d.duplicate(c):void 0,...U(g&&!p,e=>d.canStep(c,e),e=>d.step(c,e)),copy:h.copy?()=>d.copy(c,a):void 0,cut:g&&h.cut?()=>d.cut(c,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&e.renamePropOf(i,t)?()=>e.beginRename(t,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:g&&m&&y.delete?()=>d.remove(c):void 0},style:w,extras:e.menuRows?.(i,t,r)??void 0,pinnedLine:p?V(e).pinned:void 0})}function U(e,n,t){return e?{moveUp:n(-1)?()=>t(-1):null,moveDown:n(1)?()=>t(1):null}:{}}var V=e=>e.words?.screen??t.menu;function B(e){const n=V(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=K(e,l,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===l)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[...e.openPageStyles?[{label:e.pageStylesLabel??t.pageStyles,icon:/* @__PURE__ */A(O,{}),onClick:e.openPageStyles}]:[],{label:n.collapseAll,icon:/* @__PURE__ */A(z,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function R(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??a,c=V(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function N(e){return e.shiftKey}function F(e,t){const[o,l]=h(null),r=k(()=>l(null),[]);n(null!==o,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=S(e);if(!o)return;const l=t.selected();if(!l)return;const r=L(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(t,"keydown",c);const a=k(n=>{if(N(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(t,"contextmenu",n=>{if(N(n)||!t)return;const o=n.target?.closest?.("[data-easel-block]")??null,r=o?.getAttribute("data-easel-block"),i=r?e.locate(r):null;n.preventDefault();const c=p(t.frame,n.clientX,n.clientY),s=t.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(t,"mousedown",r),d(t,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:o?/* @__PURE__ */A(G,{host:e,target:o,onClose:r}):null,closeMenu:r}}function G({host:e,target:n,onClose:t}){const o="node"===n.kind?E(e,n):"input"===n.kind?R(e,n.el):B(e);return 0===o.length?null:/* @__PURE__ */A(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),items:r(o)})}export{Y as EASEL_NODE_CLIPBOARD,T as ancestorChain,D as nodeClipboardOf,M as nodeClipboardRules,E as nodeMenuItems,S as nodeShortcut,B as pageMenuItems,X as pastePlace,L as runNodeShortcut,R as textMenuItems,I as useNodeClipboard,F as useNodeContextMenu};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{noControlMetaOf as t,deviceMetaOf as l}from"./chunk-YCSZAP7T.js";import{TreeSeam as r}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as a}from"./chunk-K56YDHYQ.js";import{easelMenuEntries as o}from"./chunk-FIVU2COQ.js";import{SETTINGS_BUCKETS as i,SettingsGroup as s}from"./chunk-FM6JO4WF.js";import{DEFAULT_PANEL_WORDS as c}from"./chunk-KFV7N2DJ.js";import{FieldNumber as d}from"./chunk-Y2T3JX7K.js";import{FieldSelect as u}from"./chunk-KFWNGPW3.js";import{DEFAULT_FIELDS_WORDS as m}from"./chunk-JACEEVVF.js";import{SettingsField as h,SettingsSegmented as p}from"./chunk-
|
|
1
|
+
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{noControlMetaOf as t,deviceMetaOf as l}from"./chunk-YCSZAP7T.js";import{TreeSeam as r}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as a}from"./chunk-K56YDHYQ.js";import{easelMenuEntries as o}from"./chunk-FIVU2COQ.js";import{SETTINGS_BUCKETS as i,SettingsGroup as s}from"./chunk-FM6JO4WF.js";import{DEFAULT_PANEL_WORDS as c}from"./chunk-KFV7N2DJ.js";import{FieldNumber as d}from"./chunk-Y2T3JX7K.js";import{FieldSelect as u}from"./chunk-KFWNGPW3.js";import{DEFAULT_FIELDS_WORDS as m}from"./chunk-JACEEVVF.js";import{SettingsField as h,SettingsSegmented as p}from"./chunk-CZAAGBVL.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{useTreeDrag as b,gapToMoveIndex as g}from"./chunk-6NJHYXJM.js";import{withTip as v}from"./chunk-P2VEMZH5.js";import{Textarea as y,Input as k,ItemCount as x,SortableList as w,ListRow as C,ContextMenu as N,tabPanelId as O,Tabs as j,tabButtonId as $}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as S,useState as I,useLayoutEffect as D,useId as F}from"react";import{jsx as P,jsxs as L}from"react/jsx-runtime";import{ChevronIcon as E,LockIcon as M,MoveUpIcon as A,MoveDownIcon as T,DuplicateIcon as W,TrashIcon as z}from"efficient-shell/icons/efficient";function R({id:e,value:n,onChange:t,placeholder:l,multiline:r=!1,rows:a=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return r?/* @__PURE__ */P(y,{id:e,size:"sm",className:"es-fin",value:c,rows:a,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */P(k,{id:e,size:"md",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function H(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function J(e,n,t){const l=e.slice(),[r]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,r),l}function V(e,n){return e.filter((e,t)=>t!==n)}function Y(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var K='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',B={parentId:"list",slot:"items"};function Z({label:e,icon:n,noun:t,items:l,onChange:i,newItem:s,summary:c,itemName:d,thumb:u,min:h=0,max:p,readOnly:y=!1,open:k,onOpen:O,renderItem:j,renderRow:$,canRemove:F,lockedReason:R,fixed:Z=!1,removeOnRow:X=!0,canDuplicate:G,above:Q,head:q=!0}){const U=f("fields",m).list,_=f("tree",a),ee=t??U.item,ne=!y&&!Z&&("number"!=typeof p||l.length<p),te=l.length<=h,le=e=>!!F&&!F(l[e],e),re=e=>!y&&!Z&&X&&!te&&!le(e),ae=e=>ne&&(!G||G(l[e],e)),oe=(e,n)=>d?d(e,n):U.itemName({noun:ee,n:n+1}),ie=S([]),se=S(null),[ce,de]=I(null),ue=S(null),[me,he]=I(null),[pe,fe]=I("");D(()=>{const e=se.current;if(!e)return;se.current=null;const n=ie.current[e.index]?.querySelectorAll(K)[e.nth]??ie.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const be=(e,n)=>{if(n<0||n>=l.length||n===e)return;const t=ie.current[e],r=t?.ownerDocument.activeElement;if(t&&r&&t.contains(r)){const e=[...t.querySelectorAll(K)].indexOf(r),l=r;se.current={index:n,nth:e,start:"number"==typeof l.selectionStart?l.selectionStart:null,end:"number"==typeof l.selectionEnd?l.selectionEnd:null}}i(J(l,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}(k,e,n);a!==k&&O(a),fe(U.moved({n:n+1,total:l.length}))},ge=e=>{ne&&(i(H(l,e,s())),$?(se.current={index:e,nth:0,start:null,end:null},null!==k&&k>=e&&O(k+1)):O(e))},ve=e=>{re(e)&&(i(V(l,e)),k===e?O(null):null!==k&&k>e&&O(k-1))},ye=b({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===B.parentId&&n.slot===B.slot,onDrop:(e,n)=>{const t=g({...B,index:e},n);t!==e&&be(e,t)},onStep:(e,n)=>be(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<l.length,readOnly:y}),ke=e=>{const n=[];return e>0&&n.push({label:U.moveUp,icon:/* @__PURE__ */P(A,{size:14}),shortcut:"⌥↑",onClick:()=>be(e,e-1)}),e<l.length-1&&n.push({label:U.moveDown,icon:/* @__PURE__ */P(T,{size:14}),shortcut:"⌥↓",onClick:()=>be(e,e+1)}),ae(e)&&n.push({label:U.duplicate,icon:/* @__PURE__ */P(W,{size:14}),onClick:()=>(e=>{ae(e)&&(i(H(l,e+1,Y(l[e]))),null!==k&&k>e&&O(k+1))})(e)}),re(e)&&n.push({label:U.delete,icon:/* @__PURE__ */P(z,{size:14}),danger:!0,onClick:()=>ve(e)}),n},xe=(e,n,t,l)=>{y||0===ke(e).length||he({index:e,x:n,y:t,owner:l})},we=e=>n=>{const t=l.slice();t[e]=n,i(t)};/* @__PURE__ */
|
|
2
2
|
return L("div",{className:"es-list",children:[q?/* @__PURE__ */L("div",{className:"es-list-head",children:[
|
|
3
3
|
/* @__PURE__ */L("span",{className:"es-list-label",children:[n?/* @__PURE__ */P("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
|
|
4
|
-
/* @__PURE__ */P(x,{count:l.length,label:
|
|
5
|
-
/* @__PURE__ */P(C,{className:i,flat
|
|
4
|
+
/* @__PURE__ */P(x,{count:l.length,label:U.count({noun:ee,n:l.length}),showZero:!0})]}):null,Q?/* @__PURE__ */P("div",{className:"es-list-above",children:Q}):null,l.length?/* @__PURE__ */L(w,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ye.rootProps(),children:[l.map((e,n)=>{const t=ye.row({item:n,place:{...B,index:n}}),l=t.draggable&&ce!==n,a=!$&&k===n,o=!y&&!Z&&X&&le(n),i=["es-list-row",$?"is-inline":"is-item",a?"is-open":"",l?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */P(r,{...ye.seam({place:{...B,index:n}}),onAdd:ne?()=>ge(n):void 0,label:U.addHere({noun:ee})},`seam-${n}`):null,
|
|
5
|
+
/* @__PURE__ */P(C,{className:i,flat:!!$,active:a,draggable:t.draggable,dragHint:_.dragHint,dragging:t.dragging,drop:"before"===t.drop||"after"===t.drop?t.drop:void 0,onMove:t.draggable?e=>be(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{ie.current[n]=e},rowProps:{...t.rowProps,draggable:l||void 0,onPointerDown:e=>{const l=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),r=!!l&&l===l.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!r,ue.current=l&&!r?l:null,de(r?n:null)},onDragStart:e=>{const n=ue.current;ue.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{y||(e.preventDefault(),e.stopPropagation(),xe(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 r=e.currentTarget.getBoundingClientRect();return void xe(n,r.left+24,r.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)}},actions:y||Z||!X?void 0:o?v(R?R(e,n):U.locked,/* @__PURE__ */P("span",{className:"es-list-lock",role:"img","aria-label":R?R(e,n):U.locked,children:/* @__PURE__ */P(M,{size:13})})):v(U.deleteItem({noun:ee}),/* @__PURE__ */P("button",{type:"button",className:"es-list-x","aria-label":U.deleteItem({noun:ee}),disabled:!re(n),onClick:()=>ve(n),children:"×"})),below:a?/* @__PURE__ */P("div",{className:"es-list-item",children:j(e,n,we(n))}):void 0,children:$?/* @__PURE__ */P("div",{className:"es-list-row-main",children:$(e,n,we(n))}):/* @__PURE__ */L("button",{type:"button",className:"es-list-open","aria-expanded":a,onClick:()=>O(a?null:n),children:[u?/* @__PURE__ */P("span",{className:"es-list-thumb","aria-hidden":"true",children:u(e,n)}):null,
|
|
6
6
|
/* @__PURE__ */P("span",{className:"es-list-row-name",children:oe(e,n)}),/* @__PURE__ */P("span",c?{className:"es-list-row-summary",children:c(e,n)}:{className:"es-list-row-summary"}),
|
|
7
7
|
/* @__PURE__ */P(E,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},n)]}),
|
|
8
|
-
/* @__PURE__ */P(r,{...ye.seam({place:{...B,index:l.length}})})]}):null,y||
|
|
8
|
+
/* @__PURE__ */P(r,{...ye.seam({place:{...B,index:l.length}})})]}):null,y||Z?null:/* @__PURE__ */P("button",{type:"button",className:"es-list-add",disabled:!ne,onClick:()=>ge(l.length),children:U.add({noun:ee})}),
|
|
9
9
|
/* @__PURE__ */P("span",{className:"es-list-said","aria-live":"polite",children:pe}),me&&me.index<l.length?
|
|
10
|
-
/* @__PURE__ */P(N,{at:{x:me.x,y:me.y},owner:me.owner,onClose:()=>he(null),items:o(ke(me.index))}):null]})}var X=e=>e<6?e+1:6,
|
|
11
|
-
return P(s,{id:`${l}-group`,title:
|
|
12
|
-
return P(
|
|
13
|
-
return P(h,{label:
|
|
14
|
-
return P(h,{label:
|
|
15
|
-
return P(h,{label:
|
|
16
|
-
return P(h,{label:
|
|
17
|
-
return P(
|
|
18
|
-
return P(q,{...e,field:n});case"slot":return null}}function _(e,n){if("mobile"!==n)return!0;const r=e;if(!r||r.marker||"slot"===r.type||"always"===t(e))return!0;const a=l(e)?.tier;return"mobile"===a||"each"===a}var ee={},ne=e=>i.includes(e);function te(n,t){let l,r=i[0];const a=[],o=/* @__PURE__ */new Set;for(const[i,s]of Object.entries(n))s&&(ne(s.bucket)&&((s.marker||s.bucket!==r)&&(l=void 0),r=s.bucket),s.marker&&"string"==typeof s.fold?l={key:i,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||t&&!_(s,t.context?.device)||(a.push(l?{name:i,field:s,bucket:r,fold:l}:{name:i,field:s,bucket:r}),"slot"!==s.type&&o.add(r)));return{rows:a,buckets:i.filter(e=>o.has(e))}}function le(e){return new Map(te(e).rows.map(e=>[e.name,e.bucket]))}function re(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 ae({fields:e,values:n,onChange:t,readOnly:l=!1,context:r,showWhenContext:a,tab:o,onTab:i,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:h,ariaLabel:p,lead:b,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const w=f("panel",c),C=F(),N=h??`es-insp${C.replace(/:/g,"")}
|
|
19
|
-
return L("div",{className:"es-insp",children:[R?/* @__PURE__ */P("div",{className:"es-insp-tabs",children:/* @__PURE__ */P(j,{variant:"underline",block:!0,"aria-label":p??w.settings,idPrefix:N,value:
|
|
20
|
-
/* @__PURE__ */L("div",{className:"es-insp-rows",id:H,role:R?"tabpanel":void 0,"aria-labelledby":R&&
|
|
21
|
-
return P("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!B(t)&&!l)||void 0,children:
|
|
10
|
+
/* @__PURE__ */P(N,{at:{x:me.x,y:me.y},owner:me.owner,onClose:()=>he(null),items:o(ke(me.index))}):null]})}var X=e=>e<6?e+1:6,G=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function Q({field:e,name:t,id:l,value:r,onChange:a,readOnly:o,context:i,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=I(!0),p=r&&"object"==typeof r?r:{};/* @__PURE__ */
|
|
11
|
+
return P(s,{id:`${l}-group`,title:G(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */P(U,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>a({...p,[e]:n}),readOnly:o,context:i,showWhenContext:c,renderers:d,headingLevel:X(u)},e))})}function q({field:e,name:t,id:l,value:r,onChange:a,readOnly:o,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=I(null),f=u?d??null:h,b=u??p,g=Array.isArray(r)?r:[],v=e.getItemSummary;/* @__PURE__ */
|
|
12
|
+
return P(Z,{label:G(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:a,newItem:()=>Y({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:o,open:f,onOpen:b,renderItem:(r,a,d)=>Object.entries(n(e.arrayFields,{values:r,context:s})).map(([e,n])=>/* @__PURE__ */P(U,{field:n,name:`${t}[${a}].${e}`,id:`${l}-${a}-${e}`,value:r?.[e],onChange:n=>d({...r,[e]:n}),readOnly:o,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function U(e){const{field:n,name:t,id:l,value:r,onChange:a,readOnly:o,context:i,renderers:s}=e;if(!n||n.marker||!1===n.visible)return null;const c=s?.[n.type];if(c)return c({field:n,name:t,id:l,value:r,onChange:a,readOnly:o});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:r,onChange:a,readOnly:o};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
+
return P(h,{label:G(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */P(R,{id:l,value:"string"==typeof r?r:null==r?"":String(r),onChange:a,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:o})});case"number":/* @__PURE__ */
|
|
14
|
+
return P(h,{label:G(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */P(d,{id:l,value:"number"==typeof r?r:void 0,onChange:a,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:o})});case"select":{const e=`${l}-label`;/* @__PURE__ */
|
|
15
|
+
return P(h,{label:G(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */P(u,{id:l,value:r,options:n.options,onChange:a,readOnly:o,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
16
|
+
return P(h,{label:G(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */P(p,{ariaLabel:G(n,t),value:r,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||o})),onChange:e=>{o||a(e)}})});case"object":/* @__PURE__ */
|
|
17
|
+
return P(Q,{...e,field:n});case"array":/* @__PURE__ */
|
|
18
|
+
return P(q,{...e,field:n});case"slot":return null}}function _(e,n){if("mobile"!==n)return!0;const r=e;if(!r||r.marker||"slot"===r.type||"always"===t(e))return!0;const a=l(e)?.tier;return"mobile"===a||"each"===a}var ee={},ne=e=>i.includes(e);function te(n,t){let l,r=i[0];const a=[],o=/* @__PURE__ */new Set;for(const[i,s]of Object.entries(n))s&&(ne(s.bucket)&&((s.marker||s.bucket!==r)&&(l=void 0),r=s.bucket),s.marker&&"string"==typeof s.fold?l={key:i,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||t&&!_(s,t.context?.device)||(a.push(l?{name:i,field:s,bucket:r,fold:l}:{name:i,field:s,bucket:r}),"slot"!==s.type&&o.add(r)));return{rows:a,buckets:i.filter(e=>o.has(e))}}function le(e){return new Map(te(e).rows.map(e=>[e.name,e.bucket]))}function re(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 ae({fields:e,values:n,onChange:t,readOnly:l=!1,context:r,showWhenContext:a,tab:o,onTab:i,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:h,ariaLabel:p,lead:b,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const w=f("panel",c),C=F(),N=h??`es-insp${C.replace(/:/g,"")}`,S=te(e,{values:n,context:a}),[D,E]=I(void 0),M=o??D,A=M&&S.buckets.includes(M)?M:S.buckets[0],[T,W]=I(null),z=T&&T.panel===N&&S.rows.some(e=>e.name===T.name)?T:null,R=d&&S.buckets.length>1,H=R&&A?O(N,A):`${N}-rows`,[J,V]=I(()=>/* @__PURE__ */new Set),Y=y??J,K=(e,n)=>{/* @__PURE__ */return P(s,{title:e.title,open:!Y.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&V(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),k?.(e,n)})(e.key,n),id:`${N}-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},B=e=>R&&e!==A,Z=({name:e,field:o,bucket:i,fold:s})=>/* @__PURE__ */P("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!!B(i)||void 0,children:/* @__PURE__ */P(U,{field:o,name:e,id:`${N}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:r,showWhenContext:a,renderers:m,openItem:z&&z.name===e?z.index:null,onOpenItem:n=>W(null===n?null:{panel:N,name:e,index:n}),headingLevel:s?X(x):x})},e);/* @__PURE__ */
|
|
19
|
+
return L("div",{className:"es-insp",children:[R?/* @__PURE__ */P("div",{className:"es-insp-tabs",children:/* @__PURE__ */P(j,{variant:"underline",block:!0,"aria-label":p??w.settings,idPrefix:N,value:A,onChange:e=>{const n=e;void 0===o&&E(n),i?.(n)},items:S.buckets.map(e=>{const n=w.buckets[e],t=u?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */P("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
20
|
+
/* @__PURE__ */L("div",{className:"es-insp-rows",id:H,role:R?"tabpanel":void 0,"aria-labelledby":R&&A?$(N,A):void 0,children:[b&&_(ee,a?.device)?v?/* @__PURE__ */P("div",{className:"es-insp-band","data-fold":v.key,children:K(v,b)}):b:null,re(S.rows).map((e,n)=>{if(!e.fold)return e.rows.map(Z);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
21
|
+
return P("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!B(t)&&!l)||void 0,children:K(e.fold,e.rows.map(Z))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{R as FieldText,ae as Inspector,U as InspectorField,Z as ListField,le as bucketsOf,Y as copyItem,_ as fieldShownInView,H as insertAt,G as labelOf,J as moveTo,te as planFields,V as removeAt};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import{cloneNodeWithFreshIds as e}from"./chunk-OXZDSOZV.js";import{dedupeSlotChildren as n}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as t}from"./chunk-DSKNJXB4.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-UMBNBCL4.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s}from"./chunk-DDH2DYQP.js";import{useEaselKeyTarget as d,useEaselUndoKeys as a,useEaselSaveKey as c,editorRootFocus as p}from"./chunk-PDJ5ZALV.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as f,clampPanelWidth as m}from"./chunk-Y53EKN35.js";import{usePartBridge as g}from"./chunk-7BW74Y55.js";import{useSectionOps as y}from"./chunk-D5GQEUKM.js";import{ScreenSaveIcon as v,ScreenMainButton as b}from"./chunk-55KKGABA.js";import{useBrowserOffline as k}from"./chunk-RKTF5XLP.js";import{AddChildRow as S}from"./chunk-5545A3PC.js";import{AddSidePanel as w}from"./chunk-4RJBW7VC.js";import{keepsSharedSections as x,sharedSectionsOf as z}from"./chunk-N3MJOHAG.js";import{PanelHideButton as C,SidePanelHead as N,PanelShowStrip as I}from"./chunk-5PXVT7JY.js";import{offeredChoices as O}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as B,useScreenNodeKeys as P,useScreenPinned as $,useScreenDocumentLabel as M,useScreenCanvasFrame as T,useScreenInspectorPanel as j,useScreenDevices as A,useScreenPickFollowsSelection as L,useScreenLeftView as E,SELECTION_MODE as R,isSelectionMode as F,sameInspectorMode as D,useScreenBridges as V,useScreenBlockRules as W,useScreenBlockLook as H,useScreenStorageNamespace as Y,useScreenNotify as U,useScreenCanvasHead as J,isSlotMode as X,useScreenStyleClipboard as G,useScreenDocumentPass as K,useScreenCanvasDrag as Q,ScreenCanvasTargetProvider as Z,isPinnedFirst as _,isPinnedLast as q,screenSlotsOf as ee,shownChildSlotsOf as ne}from"./chunk-Z5BPY2VG.js";import{MediaPopup as te}from"./chunk-T2RINM7R.js";import{useNodeClipboard as oe,useNodeContextMenu as re}from"./chunk-G7ISR6DI.js";import{PageEditGuardNotices as ie}from"./chunk-FRAIEWRC.js";import{useScreenDocument as le}from"./chunk-K7MMLCTT.js";import{requestMediaPick as se}from"./chunk-3FIS2FRS.js";import{useMediaPanel as de,usePanelPick as ae,useMediaBrowsing as ce,useOpenMediaBrowse as pe,useMediaPlace as ue}from"./chunk-NCXYC7WI.js";import{useEaselSession as he}from"./chunk-YM4UEGBV.js";import{useEaselHost as fe,useHostEscape as me}from"./chunk-LX23TCTP.js";import{LayersIcon as ge,MediaIcon as ye}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-IYHO4XQX.js";import{heldStyle as be,styleShortcut as ke}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{rootRowName as we,slotChildRowName as xe,slotChildRenameProp as ze,sectionRenameProp as Ce}from"./chunk-5NHQ452C.js";import{ROOT_ZONE as Ne,blockNodeActions as Ie,TREE_MAX_DEPTH as Oe,childSlotsOf as Be,slotFieldsOf as Pe,newNodeId as $e,slotChildrenIn as Me,nestsInTree as Te}from"./chunk-TCAAOYQY.js";import{useEasel as je,useEaselApi as Ae,CanvasPartsContext as Le,partHasOwnBox as Ee,CanvasPassThroughContext as Re,CanvasSharedContext as Fe}from"./chunk-VBOSOH5M.js";import{TreeRow as De,Subtree as Ve,LayersTree as We,TreeGroupLabel as He,TreeRowAction as Ye,TreeSeam as Ue}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Je}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Xe}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ge,useNodeOps as Ke,clickPick as Qe}from"./chunk-RPMSET77.js";import{EaselTopBar as Ze,EaselIconButton as _e,TopBarCluster as qe,DeviceSwitch as en,InspectorIconButton as nn,PanelResizeHandle as tn,MAX_PANEL_W as on,MIN_PANEL_W_BY_SIDE as rn,panelWidthVars as ln}from"./chunk-WYTPBF3Q.js";import{DEFAULT_NOTICE_WORDS as sn,DEFAULT_CHROME_WORDS as dn}from"./chunk-AJSDWWJW.js";import{holderOf as an,nameOrSomeone as cn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as pn}from"./chunk-RE4LP46F.js";import{useWords as un}from"./chunk-MFIRYGHW.js";import{insertSeams as hn,CanvasDragLayer as fn,CanvasInsert as mn}from"./chunk-LN43DP2A.js";import{DEFAULT_DRAG_WORDS as gn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as yn,useTreeDrag as vn,gapToMoveIndex as bn}from"./chunk-6NJHYXJM.js";import{useCanvasFrame as kn,LIST_SELECTOR as Sn,BLOCK_SELECTOR as wn,useCanvasTyping as xn,useCanvasEvent as zn,nodeIdAt as Cn,frameRectToHost as Nn,BLOCK_ATTRIBUTE as In,drawnBox as On}from"./chunk-YU3WHLGI.js";import{queryMainCopy as Bn}from"./chunk-LF3FUSCQ.js";import{ROOT_ID as Pn,ROOT_SLOT as $n,zoneKey as Mn,parseZoneKey as Tn,find as jn,DataError as An}from"./chunk-TGZCD6IP.js";import{useRef as Ln,useMemo as En,useState as Rn,useEffect as Fn,useCallback as Dn,useLayoutEffect as Vn,useContext as Wn,Fragment as Hn,useId as Yn}from"react";import{ColoredBadge as Un,Button as Jn,Tabs as Xn,toast as Gn,readMediaFileDrag as Kn,Tooltip as Qn,groupColors as Zn,Dialog as _n,FormField as qn,Input as et,MEDIA_FILE_DRAG_TYPE as nt}from"efficient-shell/ui";import{UndoIcon as tt,RedoIcon as ot,RefreshIcon as rt,AddIcon as it,TrashIcon as lt,EyeOffIcon as st,EyeIcon as dt,SharedIcon as at,DuplicateIcon as ct}from"efficient-shell/icons/efficient";import{jsx as pt,jsxs as ut,Fragment as ht}from"react/jsx-runtime";var ft="media-file";function mt({name:e,onMake:n,onCancel:t}){const o=un("screen",ve).shared,[r,i]=Rn(e),[l,s]=Rn(!1),d=Yn(),a=Ln(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
+
return pt(_n,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */ut(ht,{children:[
|
|
3
|
+
/* @__PURE__ */pt(Jn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
+
/* @__PURE__ */pt(Jn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */pt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */pt(qn,{label:o.name,htmlFor:d,children:/* @__PURE__ */pt(et,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var gt=/* @__PURE__ */new WeakSet;function yt(e,n,t){const o=jn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function vt({canvas:e,tabs:n,onSelect:t}){const o=Ln(null),[r,i]=Rn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Vn(()=>{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=Nn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=Bn(t,`[${In}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?On(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=Nn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */pt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */pt("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:e.reach?
|
|
5
|
+
/* @__PURE__ */pt(Qn,{content:e.reach,children:/* @__PURE__ */ut(Un,{colorClass:Zn("success","solid"),size:"sm",children:[
|
|
6
|
+
/* @__PURE__ */pt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */pt(at,{size:12})}),e.label]})}):/* @__PURE__ */pt(Un,{colorClass:Zn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function bt({expand:e}){/* @__PURE__ */
|
|
7
|
+
return pt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */ut(ht,e?{children:[
|
|
8
|
+
/* @__PURE__ */pt("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
+
/* @__PURE__ */pt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
+
/* @__PURE__ */pt("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
+
/* @__PURE__ */pt("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
+
/* @__PURE__ */pt("path",{d:"M5 12h14"})]})})}var kt=`${Sn}, ${wn}`;function St(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 wt="__rungs";var xt="screen:band",zt={duplicate:!0,delete:!0},Ct=()=>null;function Nt(){const Sn=fe(),Nn=Sn.panels?.Toolbar,In=(Sn.panels?.useRight??Ct)(),{target:On,docId:Yn,capabilities:Qn,currentSlug:Zn,siteId:_n,onPublish:qn,saveState:et,saveConflict:at,retrySave:Nt,toggleAutoSave:It,flushSave:Ot,access:Bt,saveUnreachable:Pt=!1,readOnly:$t,readOnlyReason:Mt=null}=le(),Tt=B(),jt=P(),{mediaEditing:At,hasEditGuard:Lt,hasPinnedChrome:Et}=Qn,{appState:Rt,dispatch:Ft,history:Dt,selectedItem:Vt,getSelectorForId:Wt,config:Ht}=je(e=>e),Yt=$(),{first:Ut,firstGroup:Jt,lastGroup:Xt,isSectionGroup:Gt,sectionGroupZone:Kt,panelOf:Qt}=Yt,Zt=Qt(Ut),_t=e=>_(Yt,e),qt=e=>q(Yt,e),eo="node"===Yt.firstRow,no=Yt.band??null,to=un("screen",ve),oo=un("tree",Je),ro=un("drag",gn),io=un("notice",sn),lo=un("lock",pn),so=un("menu",Xe),ao=un("styleClipboard",Se),co=un("chrome",dn),po=M()??`/${Zn}`,uo=T(),ho=j(),fo=y({readOnly:$t}),mo=y({readOnly:$t,foldIntoHistory:!0}),go=Ln(null),yo=Ae(),vo=En(()=>({...fo,select:e=>{go.current=e,fo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=yo.config;go.current=Ge(e,t,n)}fo.commitDocument(e,n)}}),[fo,yo]),bo=Rt.ui,ko=bo.leftSideBarVisible,So=bo.rightSideBarVisible,{options:wo,widths:xo,initial:zo,fluid:Co,fit:No}=A(),[Io,Oo]=Rn(zo),Bo=de(),Po=At&&null!==Bo;ae(),ce();const $o=pe();L(Vt?.props.id);const{read:Mo,write:To,forSelection:jo}=E(),[Ao,Lo]=Rn(Mo);Fn(()=>{To(Ao)},[Ao]);const[Eo,Ro]=Rn(0),Fo=Ln(null),Do=Ln(null),Vo=kn(Do,{readySelector:kt}),Wo=xn(Vo),Ho=d(Do);a(Do,Vo);const Yo=k(),Uo=an(Bt),Jo={state:et,offline:Yo||et.failed&&Pt,readOnlyReason:Mt,editing:Uo?io.editing({name:cn(Uo.name,lo),noun:to.noun}):null,conflict:null!=at,notSaving:to.bar.notSaving},Xo=()=>{$t||(et.failed?Nt():Ot())};c(Do,Vo,Xo);const[Go,Ko]=Rn(!1),Qo=Ln(!1),[Zo,_o]=Rn(null),[qo,er]=Rn([]),[nr,tr]=Rn(R);F(nr);const or=o(nr,Vt?.props.id),[rr,ir]=Rn(null);Fn(()=>{rr&&(r(),ir(null))},[rr]);const lr=Ln(Wt);lr.current=Wt;const sr=Dn((e,{scroll:n})=>{Lo(n=>jo(e,n)),n&&ir(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=lr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Lr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),dr=Ln(null);Fn(()=>{const e=dr.current;dr.current=null;const n=null==Vt?.props.id?null:String(Vt.props.id);tr(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Qt(Vt?.type)??R);const t=Vt?.props.id,o=go.current;if(go.current=null,!t)return;const r=Wt(t);sr(String(t),{scroll:!i(o,r??null,Ne)})},[Vt?.props.id,sr]);const ar=Dn(e=>{tr(n=>D(n,e)?n:e),Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},[Ft]),cr=Ln(()=>{});cr.current=(e,n)=>{const t=e?$i(e.zone??Ne)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Vt?.props.id?null:String(Vt.props.id);tr(e=>D(e,n)?e:n),o!==r&&(dr.current={id:o,mode:n},vo.select(e))};const pr=Dn((e,n)=>cr.current(e,n),[]),ur={kind:nr.kind,mode:nr,open:ar,show:e=>tr(e),reveal:()=>{So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},select:pr},hr=V(ur,{data:Rt.data,selected:Vt??null,zoneOf:e=>Wt(e)?.zone,readOnly:Boolean($t),select:e=>{tr(R),vo.select({index:e})},replace:(e,n)=>vo.replaceComponent(Ne,e,n),scrollTo:e=>l(e)},{device:Io,refreshes:Eo},{setView:Lo,reveal:()=>{ko||Ft({type:"setUi",ui:{leftSideBarVisible:!0}})}}),fr=hr.resolveLeftView?hr.resolveLeftView(Ao):"sections",mr=W(),{isLockedBlock:gr,duplicateBlocked:yr,nestDepth:vr,newSectionNode:br,canAddTo:kr,blockIsOffered:Sr}=mr,wr=H(),{labelAtLevel:xr,Icon:zr,useProducts:Cr}=wr,Nr=wr.rowName?(e,n,t)=>wr.rowName(e,n,t):void 0,Ir=Dn(e=>{Ft({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),sr(e,{scroll:!0})},[Ft,sr]),{selectNode:Or,openPartId:Br}=g({mode:nr,setMode:tr,onOpenPart:Ir}),[Pr,$r]=Rn(null);me(null!==Pr,()=>$r(null));const Mr=h(Y()),Tr=Mr.collapsed,jr=Mr.panelWidths,[Ar,Lr]=Rn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Tr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
+
return new Set}});Fn(()=>{try{window.localStorage.setItem(Tr,JSON.stringify([...Ar]))}catch{}},[Ar]);const[Er,Rr]=Rn(()=>{if("undefined"==typeof window)return{...f};try{const e=window.localStorage.getItem(jr);if(!e)return{...f};const n=JSON.parse(e);return{left:m(Number(n.left)||f.left,"left"),right:m(Number(n.right)||f.right,"right")}}catch{return{...f}}});Fn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(jr,JSON.stringify(Er))}catch{}},300);return()=>clearTimeout(e)},[Er]);const Fr=Dn((e,n)=>Rr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Dr=Dn(e=>Fr("left",e),[Fr]),Vr=Dn(e=>Fr("right",e),[Fr]),Wr=e=>Ar.has(e),Hr=e=>Lr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Yr=Ln(!1),Ur=Ln(null);Fn(()=>{if(Yr.current&&!Go){const e=Ur.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Do.current?.querySelector(`button[aria-label="${CSS.escape(to.add.title)}"]`))?.focus(),Ur.current=null}Yr.current=Go},[Go]),Fn(()=>{if(!Go||!Ho)return;const e=e=>{"Escape"===e.key&&al()};return Ho.addEventListener("keydown",e),()=>Ho.removeEventListener("keydown",e)},[Go,Ho]),me(Go,()=>al()),Fn(()=>{!ko&&Go&&(Ko(!1),_o(null),Qo.current=!1)},[ko]);const Jr=U(),Xr=(e,n="success",t)=>{if(Jr)return void(t?Jr(e,"error"===n?"error":"info",t):Jr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Gn.error(e,{...o,duration:t?.duration??3200}):Gn.success(e,{...o,duration:t?.duration??1900})},Gr=Ln(null),[Kr,Qr]=Rn(0),[Zr,_r]=Rn(0),qr=J(),ei=Ln(null),ni=e=>Math.max(0,e.clientHeight-(ei.current?.offsetHeight??0));Fn(()=>{const e=Gr.current;if(!e)return;const n=()=>{Qr(e.clientWidth),_r(ni(e))};n();const t=new ResizeObserver(n);return t.observe(e),ei.current&&t.observe(ei.current),()=>t.disconnect()},[]),Vn(()=>{Gr.current&&(Qr(Gr.current.clientWidth),_r(ni(Gr.current)))},[Er,ko,So]);const ti=Io===Co?Kr>0?Kr:xo[Co]:xo[Io],oi=Kr>0?Math.min(Kr/ti,"shrink"===No?1:2):1,ri=ti*oi,ii=Kr>0&&ri>Kr+1,li={width:ri,height:Zr||"100%",flex:"none",position:"relative"},si={width:ti,height:Zr?Zr/oi:"100%",maxHeight:"none",transform:1!==oi?`scale(${oi})`:void 0,transformOrigin:"top left"},di=()=>Ft({type:"setUi",ui:{leftSideBarVisible:!ko}}),ai=()=>Ft({type:"setUi",ui:{rightSideBarVisible:!So}}),ci=e=>{Go&&(Ko(!1),_o(null),Qo.current=!1,ko&&Ao===e)||(Lo(e),ko||Ft({type:"setUi",ui:{leftSideBarVisible:!0}}))},pi=()=>{tr(Zt??R),So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},ui=Rt.data.content??[],hi=()=>{const e=ui.findIndex(_t),n=ui.findIndex(qt);return{floor:e>=0?e+1:0,cap:n>=0?n:ui.length}},fi=Ht,mi=mr.stripCopy,gi=n=>e(n,mi),yi=oe(),vi=Ke({data:Rt.data,config:fi,readOnly:Boolean($t),clipboard:yi,strip:mi?e=>mi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Pn||e.slot!==$n)return{min:0,max:n-1};const{floor:t,cap:o}=hi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&tr(R);const t=void 0===n||"node"===n?.kind?n:null;vo.commitDocument(e,t)}}),bi=he(),[ki,Si]=Rn(null),wi=e=>{const n=ui.find(n=>String(n.props.id)===e),t=Yt.shared;n&&t&&vi.swap(e,t.detach(n))},xi=e=>{const n=jn(Rt.data,Ht,e);if(!n)return!1;const t=Mn(n.place),o=n.node,r=t===Ne?Oi(o):Wi(o),i=t===Ne?Yt.shared?.usedOn(o):null;return!!vi.remove(e)&&(Xr(i?to.shared.removed({count:Math.max(0,i.length-1)}):to.deleted({name:r}),"success",{duration:8e3,action:{label:to.bar.undo,onClick:()=>{vi.restore(n.node,n.place)}}}),!0)},zi={...vi,remove:xi},Ci=e=>xr(e,"block",Ht.components[e]?.label??e),Ni=Dn(e=>Ht.components[e]?.defaultProps??{},[Ht]),Ii=e=>xr(e,"section",Ci(e)),Oi=e=>we({type:e.type,props:e.props??{}},Ii(e.type),Nr),{nodeAddresses:Bi,zoneItems:Pi}=En(()=>{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>=Oe)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Be(Ht,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(ui,Ne,0),{nodeAddresses:e,zoneItems:n}},[ui,Ht]),$i=Dn(e=>Pi.get(e)??[],[Pi]),Mi=e=>{const n=Bi.get(e);return n?$i(n.zone)[n.index]:void 0},Ti=e=>ee(mr,Ht,e),ji=e=>{if(!mr.slotsOf||e===Ne)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Mi(e.slice(0,n));if(!t)return null;const o=Ti(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}},Ai=(()=>{if(!X(nr))return null;const e=`${nr.nodeId}:${nr.slot}`;return ji(e)?.slot.panel===nr.kind?e:null})(),Li=Ln(null);Fn(()=>{const e=Li.current;if(Li.current=null,!Ai||!X(nr))return;const n=nr.nodeId;sr(n,{scroll:e!==Ai}),Lr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[nr]);const Ei=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Bi.get(e);n&&(n.zone===Ne?tl(n.index):Bl(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&&Ai!==i&&(Li.current=i),pr(null,r),So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ri=(e,n,t)=>{const o=`${e}:${n}`;if(Lr(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;Ai!==o&&(Li.current=o);pr(null,{kind:t,nodeId:e,slot:n})},Fi=(e,n,t)=>{if($t||!mr.moveSlot)return;const o=Mi(e),r=o?Ti(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:wt,index:n},s=bn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=mr.moveSlot(e,n,s);"string"==typeof d&&Ri(e,d,i.panel)},Di=Cr(),Vi=En(()=>{const e=/* @__PURE__ */new Map;for(const n of Di??[])e.set(n.slug,n.name);return e},[Di]),Wi=e=>xe(e,Ci,wr.plainText,e=>Vi.get(e),wr.rowName),Hi=(e,n)=>{const t=Ht.components[e.type]?.fields,o=n===Ne||ns(n)?"section":"block",r=n===Ne&&(_t(e)||qt(e)||Gt(e.type)),i="block"===o?ze(t):r?null:Ce(t);return wr.renamePropOf?wr.renamePropOf(e,o,i):i},Yi=(e,n,t,o)=>{if(!(!$t&&Pr?.zone===e&&Pr.index===n))return;const r=(t,o)=>{$r(null),o&&((e,n,t)=>{const o=$i(e)[n];if(!o)return;const r=Hi(o,e);r&&vo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
+
return pt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":to.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)},Ui=t(G(),ao),Ji=Ui.scope({target:On,siteId:_n,docId:Yn}),Xi=Ht,Gi=(e,n)=>n===Ne?Ii(e):Ci(e),Ki=(e,n,t)=>{const o=Ui.plan(Ji,t,Gi(t.type,e),Xi);o&&(o.changed&&vo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Xr(o.message))},Qi=re({nodesIn:$i,nodeAt:(e,n)=>$i(e)[n]??null,labelOf:(e,n)=>n===Ne?Ii(e):Ci(e),renamePropOf:Hi,beginRename:(e,n)=>$r({zone:e,index:n}),history:{hasPast:Dt.hasPast,hasFuture:Dt.hasFuture,back:()=>Dt.back(),forward:()=>Dt.forward()},openPageStyles:hr.openPageStyles,pageStylesLabel:to.pageStyles,words:{menu:so,styleClipboard:ao,screen:to.menu},readOnly:Boolean($t),collapseAll:()=>Lr(new Set($i(Ne).map(e=>String(e.props.id)))),onPasteRefused:e=>Xr(e?to.pasteRefused({name:e.label}):to.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>rs(e,n),menuRows:(e,n,t)=>{const o=hr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Yt.shared;if(!t||n!==Ne)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:to.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return $t||gr(e.type,e)?n:{...n,change:[{label:to.shared.detach,onClick:()=>wi(e.props.id)}],remove:[{label:to.shared.removeFromPage,danger:!0,onClick:()=>{xi(e.props.id)}}]}}return $t||_t(e)||qt(e)||Gt(e.type)?null:x(bi)?{change:[{label:to.shared.makeShared,onClick:()=>Si({id:e.props.id,name:Oi(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>gr(e.type,e),duplicateBlocked:e=>yr(Rt.data,e),permits:e=>{const n=Ie(Ht,e.type);return Yt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:zi,isPinned:(e,n)=>n===Ne&&(_t(e)||qt(e)),sectionBand:hi,locate:e=>Bi.get(e)??null,rowNameOf:(e,n)=>n===Ne?Oi(e):Wi(e),selectAt:(e,n,t,o)=>{e===Ne?tl(n):Bl(e,n,t,o??"")},slotRung:e=>{const n=ji(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ei(n.node,n.slot,!1)}:null},style:{held:()=>be(Ji),canCopy:e=>Ui.rows(Xi,e).some(e=>!1!==e.counted),copy:(e,n)=>Ui.copy(Ji,e,Gi(e.type,n),Xi),paste:(e,n,t)=>Ki(e,n,t)},keys:jt?{target:Ho,selected:()=>{const e=Rt.ui.itemSelector;return e?{zone:e.zone??Ne,index:e.index}:null},held:()=>yi.get(),readOnly:Boolean($t),onDone:({done:e,name:n})=>{"copied"===e&&Xr(to.copied({name:n}))}}:void 0},Vo),Zi=Ln({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Fn(()=>{Zi.current={copy:(e,n)=>Ui.copy(Ji,e,Gi(e.type,n),Xi),paste:Ki,at:()=>{const e=Rt.ui.itemSelector;if(!e)return null;const n=e.zone??Ne,t=$i(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean($t)}});const _i=Dn(e=>{const n=ke(e);if(!n)return;const t=Zi.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))},[]);Fn(()=>{if(!Ho)return;const e=e=>_i(e);return Ho.addEventListener("keydown",e),()=>Ho.removeEventListener("keydown",e)},[_i,Ho]),zn(Vo,"keydown",_i);const qi=ui.map(e=>e.props.id).join("|");Fn(()=>{const e=Vo?.document??null,n=Vo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void er(e=>e.length?[]:e);const n=ui.findIndex(qt),t=n>=0?n:ui.length,o=n=>{const t=ui[n]?.props?.id;return null==t?null:Bn(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(wn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=ui.length>0&&!_t(ui[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=St(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})}er(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()}},[Vo,qi,Io,oi,ko,So,Vt?.props.id]);const el=Vo?.document??null,nl=Vo?.window??null;Fn(()=>{const e=Fo.current;if(!e||!el||!nl)return;const n=[],t=()=>{const n=Bn(el,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&nl.scrollTo({left:nl.scrollX,top:nl.scrollY+t,behavior:"instant"}),!0};return Fo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[el,nl]);const tl=e=>{tr(R),vo.select({index:e}),hr.sectionPressed?.(ui[e]);const n=ui[e]?.props?.id;n&&l(n)},ol=e=>{const{floor:n,cap:t}=hi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Vt&&nr.kind!==Zt?.kind?ui.findIndex(e=>e.props.id===Vt.props.id):-1;return o(r>=0?r+1:t)},rl=(e,n)=>{const{floor:t,cap:o}=hi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(vo.reorderComponent(Ne,e,i),vo.select({index:i}),{moved:!0,dest:i})},il=(e,n,t,o)=>{tr(R),vo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Xr(to.sectionAdded({name:t}))},ll=(e,n)=>{const t=ol(n),o=br(e,{nodeDefaults:Ni,newNodeId:$e,sectionLabel:Ii,blockIsOffered:Sr}),r=o?vo.insertNode(Ne,t,o):vo.insertSection(e,t);return il(t,r,Ii(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:a}of Be(Ht,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=kr(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:a,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},sl=e=>dl(Ne,e),dl=(e,n)=>{Ur.current=document.activeElement??null,_o(null===n?null:{zone:e,index:n}),Ko(!0),ko||(Qo.current=!0,Ft({type:"setUi",ui:{leftSideBarVisible:!0}}))},al=()=>{Ko(!1),_o(null),Qo.current&&Ft({type:"setUi",ui:{leftSideBarVisible:!1}}),Qo.current=!1},cl=(e,n)=>wr.rowName?n?_t(e)?wr.rowName(e,"section",to.header):qt(e)?wr.rowName(e,"section",to.footer):Gt(e.type)?wr.rowName(e,"section",Ci(e.type)):Oi(e):Wi(e):n?Ii(e.type):Ci(e.type),pl=e=>n=>{e()},ul=(e,n,t)=>{if($t)return null;const o=$i(e)[n];return o&&!Ie(Ht,o.type).delete||o&&gr(o.type,o)?null:/* @__PURE__ */pt(Ye,{kind:"delete",label:e===Ne&&o&&Yt.shared?.usedOn(o)?to.shared.removeFromPage:to.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=$i(e)[n]?.props?.id;null!=t&&xi(String(t))})(e,n),children:/* @__PURE__ */pt(lt,{size:15})})},hl=e=>wr.rowPreview?.(e)||void 0,fl=e=>wr.rowMarks?.(e)??void 0,ml=(e,n,t)=>wr.rowActions?.(e,n,t)??null,gl=(e,n,t,o)=>{if($t)return null;if(gr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
+
return pt(Ye,{kind:"eye",label:r?to.showNamed({name:o}):to.hideNamed({name:o}),onClick:()=>vl(e,n,t),children:/* @__PURE__ */pt(r?st:dt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},yl=e=>Ks(Ne,e),vl=(e,n,t)=>{vo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},bl=e=>Pe(Ht,e),kl=e=>Be(Ht,e),Sl=e=>mr.slotsOf?Ti(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Me(e,n.slot)})):[{slot:null,rung:null,kids:ne(Ht,e)}],wl=e=>mr.slotsOf?Sl(e).flatMap(e=>e.kids):ne(Ht,e),xl=e=>Boolean(mr.slotsOf)&&Ti(e).some(e=>e.rung),zl=(e,n,t)=>null===t?void 0===n?kr(e):kr(e,n):kr(e,n,t),Cl=(e,n,t)=>{const o=Te(Ht,e.type,n)&&(t||wl(e).length>0||xl(e));return{collapsible:o,folded:o&&Wr(String(e.props.id))}},Nl=(e,n,t)=>Sl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Cl(e,r,t(e.type)).collapsible?[String(e.props.id),...Nl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Il=e=>wl(e).length>0||xl(e)||Boolean(kr(e.type)),Ol=e=>Boolean(kr(e)),Bl=(e,n,t,o)=>{if(tr(R),kr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),vo.select({index:n,zone:e}),l(t)}else vo.select({index:n,zone:e}),l(t)},Pl=(e,n,t,o,r)=>{const i=`${e}:${n}`;vo.insertComponent(i,t,o),kr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),vo.select({index:o,zone:i})}):vo.select({index:o,zone:i})},$l=Ln(/* @__PURE__ */new Set);Fn(()=>{ui.forEach(e=>{const n=kr(e.type)?.spec;if(!n)return;const t=e.props.id;if($l.current.has(t))return;$l.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(Ni)).forEach((e,t)=>mo.seedChild(o,t,n.childType,e))})},[ui,mo,Ni]);const Ml=Ln(/* @__PURE__ */new Set);Fn(()=>{ui.forEach((e,t)=>{const o=e.props.id;if(Ml.current.has(o))return;const r=n(e,bl(e.type));Ml.current.add(o),r&&mo.replaceComponent(Ne,t,{...e,props:r})})},[ui,mo]),K(mo,Ht);const Tl=ui.findIndex(qt),jl=Tl>=0?ui[Tl]:null,Al=eo?ui.findIndex(_t):-1,Ll=Al>=0?ui[Al]:null,El=Yt.groupTab,Rl=En(()=>El?e=>Gt(e.type):void 0,[El]),Fl=Boolean(Yt.groupBadge),Dl=Yt.sharedReach,Vl=e=>Dl?.(e)??void 0,Wl=En(()=>Dl?new Set(ui.filter(e=>Vl(e)).map(e=>String(e.props.id))):null,[ui,Dl]),Hl=En(()=>Wl?e=>Wl.has(e):void 0,[Wl]),Yl=Yt.first?Dl?.({type:Yt.first,props:{id:""}})??void 0:void 0,Ul=Yt.groupBadge?/* @__PURE__ */pt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */pt(Un,{tone:"info",size:"xs",children:Yt.groupBadge})}):void 0,Jl=ui.find(e=>e.type===Jt)??null,Xl=ui.find(e=>e.type===Xt)??null,Gl=Tl>=0?Tl:ui.length,Kl=[];ui.forEach(e=>{qt(e)||(Il(e)&&Kl.push(String(e.props.id)),Kl.push(...Nl(e,1,Ol)))}),jl&&(Kl.push(String(jl.props.id)),Kl.push(...Nl(jl,1,Ol)));const Ql=Kl.length>0&&Kl.every(e=>Ar.has(e)),Zl=e=>{const n=wr.blockRowName(e,Ci);return wr.rowName?wr.rowName(e,"block",n):n},_l=(e,n,t,o)=>{const r=$i(e)[t];if(!r)return;const i={...Tn(e),index:t},l={...Tn(n),index:Math.min(Math.max(o,0),$i(n).length)},s=bn(i,l);if(e!==n||s!==t)try{vi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof An))throw e}},ql=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of kl(e))n.add(r),t(o)};for(const t of bl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},es=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Bi.get(n);if(!e)return null;if(e.zone===Ne)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ns=e=>{const n=e.slice(0,e.indexOf(":")),t=ui.find(e=>Gt(e.type)&&String(e.props.id)===n);return t&&Kt(n)===e?t:null},ts=(e,n)=>{const t=ns(e);return!t||(!Yt.groupAccepts||Yt.groupAccepts(t.type,n,$i(e).length))},os=(e,n,t)=>{if(e.rung){const t=Mi(e.rung.nodeId),o=t?Ti(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===wt&&n.index>=0&&n.index<=o}if(n.slot===wt)return!1;if(e.add)return ss(e.add,n);const o=Mn(n);if(Gt(e.type))return!1;const r=ns(o),i=ns(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!ts(o,e.type))&&(n.index>=0&&n.index<=$i(o).length));if(e.zone===Ne||o===Ne){if(e.zone!==o)return!1;const{floor:t,cap:r}=hi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>$i(o).length)return!1;if(e.zone===o)return!0;const l=jl&&!Yt.lastIsOpen?String(jl.props.id):null;return(!l||es(e.zone)!==l&&es(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??$i(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Bi.get(i),s=l?$i(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ql(r).has(n))return!1;const d=kr(s.type,vr(Rt?.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?.($i(n),r))})(e.zone,o,e.index,t)},rs=(e,n)=>{const t=Mn(e.from),o=e.node;return t===Mn(n)?ts(t,o.type):os({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},is=e=>{const n=e.slice(0,e.indexOf(":")),t=Bi.get(n),o=t?$i(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=kr(o.type,vr(Rt?.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=O(r.choices??(r.spec?[{type:r.spec.childType,label:Ci(r.spec.childType)}]:[])),l=ji(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:cl(o,t.zone===Ne)}},ls=(e,n)=>{if("section"!==e.kind)return e;const t=Mn(n);return t===Ne||ns(t)?e:is(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},ss=(e,n)=>{const t=ls(e,n),o=Mn(n);if("shared"===t.kind){if(o!==Ne||!Yt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=hi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ns(o)){const e="section"===t.kind?t.type:t.template.node.type;return ts(o,e)&&n.index>=0&&n.index<=$i(o).length}if(o!==Ne)return!1;const{floor:e,cap:r}=hi();return n.index>=e&&n.index<=r}if(o===Ne)return!1;const r=is(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.($i(o))},ds=(e,n)=>{const t=ls(e,n);if("block"!==t.kind&&ns(Mn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&ts(n,o)){if("section"===e.kind)vo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;vo.insertNode(n,t,gi(e.template.node))}tr(R),vo.select({index:t,zone:n})}})(t,Mn(n),n.index);if("section"===t.kind)return void ll(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=ol(t),r=vo.insertNode(Ne,o,n);il(o,r,e)})(t.template.name,gi(t.template.node),n.index);if("shared"===t.kind){const e=Yt.shared?.nodeOf(t.section);if(!e)return;const o=ol(n.index);return void(vi.restore(e,{parentId:Pn,slot:$n,index:o})&&il(o,e.props.id,t.section.title))}const o=Mn(n),r=is(o);r&&(r.target.spec?Pl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{vo.insertComponent(e,n,t),tr(R),vo.select({index:t,zone:e})})(o,t.type,n.index))},as=(e,n)=>{e.media?function(e){const n=Ys();if(!n||!Vs)return;Js(n).then(n=>{n&&function(e,n){if(!Vs)return;const t=Vs.create(e,{nodeDefaults:Ni,newNodeId:$e,sectionLabel:Ii,blockIsOffered:Sr}),o=Mn(n);if(o===Ne){const e=ol(n.index),o=vo.insertNode(Ne,e,t);return void il(e,o,Ii(t.type))}vo.insertNode(o,n.index,t),tr(R),vo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Fi(e.rung.nodeId,e.index,n.index):e.add?ds(e.add,n):e.zone===Ne?rl(e.index,n.index):_l(e.zone,Mn(n),e.index,n.index)},[cs]=Rn(()=>yn()),ps=vn({keyOf:e=>e.id,readOnly:Boolean($t),session:cs,canDrop:os,onDrop:as,onStep:(e,n)=>{e.rung?Fi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Ne?((e,n)=>{const t=Ii(ui[e]?.type??""),o=rl(e,n<0?e-1:e+2);if(!o.moved)return void Xr(n<0?to.sectionFirst({name:t}):to.sectionLast({name:t}));const{floor:r,cap:i}=hi();Xr(to.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):_l(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),us=Dn(e=>{const{floor:n,cap:t}=hi(),o=[];for(const r of e.nodes){const e=Mn(r.place),i=$i(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(_t(i)||qt(i)||gr(i.type,i))continue;if(Gt(i.type))continue;const l=Boolean(ns(e)),s=e===Ne||l;e===Ne&&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?Ii(i.type):Wi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Mn(e.list);if(n===Ne&&0===e.children.length)return[{...e,addLabel:to.addSection,addAlways:!0}];const t=is(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ns(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Mn(e.list),t=n===Ne||ns(n)?null:is(n);return t?.choices.length?hn(e,t.target.spec?.addLabel??to.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Rt.data]),hs=null==Vt?.props.id?null:String(Vt.props.id),fs=Wn(Le),ms=fs?.selected()&&Vo?.document&&hs?fs.selectedPart?.(Vo.document)??null:null,gs=ms&&hs&&Ee(Rt.data,Ht,hs,ms)?ms:null,ys=gs?.label?{element:gs.element,label:gs.label}:null,vs=null!==gs,bs=Dn(e=>{const n=Ht,t=e=>!e.item.rung&&null!==jn(Rt.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(hs);return i?vs?null:i:r(Qe(Rt.data,n,o.item.id,hs,Rl))??o},[Rt.data,Ht,hs,Rl,vs]),[ks,Ss]=Rn(null),ws=Boolean(El||Dl);zn(Vo,"mouseover",e=>{if(!ws)return;const n=Cn(e.target),t=n?yt(Rt.data,Ht,n):null;t!==ks&&Ss(t)}),zn(Vo,"mouseout",e=>{ws&&!e.relatedTarget&&Ss(null)});const xs=e=>_t(e)||qt(e)||Gt(e.type),zs=e=>{const n=Gt(e.type)?Ci(e.type):_t(e)?to.header:qt(e)?to.footer:null;return null===n?Oi(e):wr.rowName?wr.rowName(e,"section",n):n},Cs=[];if(ws){const e=hs?yt(Rt.data,Ht,hs):null;for(const n of/* @__PURE__ */new Set([e,ks])){const e=n?ui.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=_t(e)||e.type===Jt,o=Vl(e);if(o){Cs.push({id:String(e.props.id),label:zs(e),below:t,reach:o});continue}if(!El||!xs(e))continue;const r=El(e);r&&Cs.push({id:String(e.props.id),label:r,below:t})}}const Ns=he(),Is=Ln(null);Fn(()=>{const e=Yt.changeNotice;if(!e)return;const n=JSON.stringify(ui.filter(xs)),t=Is.current;if(Is.current={doc:Yn,bands:n,index:Dt.index},!t||t.doc!==Yn||t.bands===n)return;Dt.hasPast&&Dt.index>=t.index&&!gt.has(Ns)&&(gt.add(Ns),Xr(e,"success",{action:{label:to.bar.undo,onClick:()=>Dt.back()},duration:8e3}))},[ui]);const Os=e=>{tr(R),vo.select(e.zone===Ne?{index:e.index}:{index:e.index,zone:e.zone})},Bs=Q(),Ps=()=>({data:Rt.data,device:Io,ops:vo,inspector:ur}),$s=Bs?.model,Ms=En(()=>$s?e=>$s(e,us(e),Ps()):us,[$s,us,Io]),Ts=Bs?.measure,js=Ts?(e,n)=>Ts(e,n,Ps()):void 0,As=Bs?.canDrop,Ls=As?(e,n)=>As(e,n,os,Ps()):os,Es=Bs?.drop,Rs=Es?(e,n)=>Es(e,n,as,Ps()):as,Fs=Bs?.pick,Ds=Fs?e=>Fs(e,Os,Ps()):Os,Vs=Bs?.media??null,Ws=Ln(null),Hs=En(()=>Vs?{id:ft,zone:"",index:-1,type:Vs.adds.type,add:{kind:Vs.adds.kind,type:Vs.adds.type},media:!0}:null,[Vs]);Fn(()=>{if(!Hs||$t||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(nt))(e)&&(Ws.current=null,cs.start({key:ft,item:Hs}))},n=e=>{cs.get()?.item.media&&(Ws.current=Kn(e.dataTransfer))},t=()=>{cs.get()?.item.media&&cs.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Hs,$t,cs]);const Ys=()=>{const e=Ws.current;return Ws.current=null,e},Us=ue(),Js=async e=>{if(!Us)return e;const n=await Us(e);return n?{...e,id:n.id,url:n.url}:null};const Xs=(e,n)=>{if(!Vs)return;const t=jn(yo.getState().appState.data,fi,n);if(!t)return;const o=t.node;vo.replaceComponent(Mn(t.place),t.place.index,{...o,props:{...Vs.replace(o,e),id:o.props.id}})},Gs=e=>{const n=Mn(e),t=ji(n);t&&Ei(t.node,t.slot,!1),dl(n,e.index)},Ks=(e,n)=>/* @__PURE__ */pt(Ue,{...$t?{}:ps.seam({place:{...Tn(e),index:n}})},`seam:${e}:${n}`),Qs={rowClick:pl,isCollapsed:Wr,toggleCollapse:Hr},Zs=e=>{const n=String(e.props.id),t=ui.findIndex(e=>String(e.props.id)===n),o=Kt(n),r=$i(o),i=Wr(n),l=Ci(e.type),s=wr.rowName?wr.rowName(e,"section",l):l,d=e=>Ks(o,e);/* @__PURE__ */
|
|
16
|
+
return ut(ht,{children:[
|
|
17
|
+
/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:e.type,size:13}),name:s,preview:hl(e),marks:fl(e),onSelect:()=>tl(t),nameSlot:Yi(Ne,t,n,s),selected:or===n,badge:Vl(e)?void 0:Ul,shared:Vl(e),actions:ml(e,Ne,t)??void 0,rowProps:{"data-node-id":n,onClick:pl(()=>tl(t))},fold:{open:!i,label:"section",onToggle:()=>Hr(n)}}),!i&&/* @__PURE__ */ut(Ve,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Oi(n),l=Il(n),s=l&&Wr(r),a=()=>Bl(o,t,r,e.type),{rowProps:c,...p}=ps.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Tn(o),index:t}},{"data-node-id":r,onClick:pl(a)});/* @__PURE__ */
|
|
18
|
+
return ut(Hn,{children:[d(t),
|
|
19
|
+
/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:n.type,size:13}),name:i,preview:hl(n),marks:fl(n),onSelect:a,nameSlot:Yi(o,t,r,i),selected:or===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Hr(r)}:void 0,actions:/* @__PURE__ */ut(ht,{children:[ul(o,t,i),ml(n,o,t),gl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */pt(Ve,{children:ed(n,2)})]},r)}),d(r.length)]})]})},_s=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=ps.dragging,d=!Wr(l)&&s?.rung?.nodeId!==i,a={...Tn(l),index:0},c=s&&!s.rung&&os(s,a)?a:void 0,p=()=>Ei(e,n,!0),{rowProps:u,...h}=ps.row({item:{id:`rung:${l}`,zone:`${i}:${wt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:wt,index:t},into:c,canDrag:Boolean(mr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:pl(p)}),f=$t?null:mr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
+
return ut(Hn,{children:[n.heading,
|
|
21
|
+
/* @__PURE__ */pt(De,{words:oo,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Ai===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Hr(l)},actions:f&&f.length>0?/* @__PURE__ */pt(ht,{children:f.map((t,o)=>/* @__PURE__ */pt(Ye,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if($t||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ri(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__ */pt(lt,{size:15}):/* @__PURE__ */pt(ct,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */pt(Ve,{children:r})]},l)},qs=(e,n)=>{const t=Sl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
+
return pt(ht,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=zl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Ks(e,n),p=/* @__PURE__ */ut(ht,{children:[i.map(({child:n,zone:t,index:o})=>{const r=or===String(n.props.id),{collapsible:i,folded:s}=Cl(n,l,Ol(n.type)),d=String(n.props.id),a=Zl(n),p=()=>Bl(t,o,d,e.type),{rowProps:u,...h}=ps.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Tn(t),index:o}},{"data-node-id":d,onClick:pl(p)});/* @__PURE__ */
|
|
23
|
+
return ut(Hn,{children:[0===o&&c(t,0),
|
|
24
|
+
/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:n.type,size:13}),name:a,preview:hl(n),marks:fl(n),onSelect:p,nameSlot:Yi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...h,fold:i?{open:!s,label:"group",onToggle:()=>Hr(d)}:void 0,actions:/* @__PURE__ */ut(ht,{children:[ul(t,o,a),ml(n,t,o),gl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */pt(Ve,{children:qs(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?_s(e,t.rung,r++,o,p):/* @__PURE__ */pt(Hn,{children:p},t.slot??"")})})},ed=(e,n)=>{const t=vr(Rt?.data,e.type,String(e.props.id)),o=Sl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
+
return pt(ht,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=zl(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),h=a&&!a.fixed?`${u}:${a.slot}`:null,f=p?`${u}:${p.slot}`:null,m=(e,n)=>Ks(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),v=/* @__PURE__ */ut(ht,{children:[l.map(({child:n,zone:t,index:o})=>{const r=or===String(n.props.id),i=Wi(n),l=String(n.props.id),{collapsible:d,folded:a}=Cl(n,s,Ol(n.type)),c=bl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Tn(p),index:$i(p).length}:void 0,h=ps.dragging,f=u&&h&&os(h,u)?u:void 0,g=()=>Bl(t,o,l,e.type),{rowProps:y,...v}=ps.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Tn(t),index:o},into:f,canDrag:!gr(n.type,n)},{"data-node-id":l,onClick:pl(g)});/* @__PURE__ */
|
|
26
|
+
return ut(Hn,{children:[0===o&&m(t,0),
|
|
27
|
+
/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:n.type,size:13}),name:i,preview:hl(n),marks:fl(n),onSelect:g,nameSlot:Yi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Hr(l)}:void 0,actions:gr(n.type,n)?ml(n,t,o)??void 0:/* @__PURE__ */ut(ht,{children:[ul(t,o,i),ml(n,t,o),gl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */pt(Ve,{children:ed(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
+
/* @__PURE__ */pt(S,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Pl(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?f&&!l.some(e=>e.zone===f)?m(f,0):null:0!==l.length||(o.rung?y:g!==f)?null:m(g,0)]});return o.rung?_s(e,o.rung,i++,r,v):/* @__PURE__ */pt(Hn,{children:v},o.slot??"")})})},nd=Go,td=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:ko&&!nd&&fr===e.id,onSelect:()=>ci(e.id)}:e,od=[...(hr.railLead??[]).map(td),{id:"sections",label:to.layers,icon:/* @__PURE__ */pt(ge,{}),active:ko&&!nd&&"sections"===fr,onSelect:()=>ci("sections")},...(hr.railTrail??[]).map(td)],rd=Po?{onPress:$o}:At?{onPress:()=>{se(Sn,{accept:"image/*",title:co.mediaLibrary})}}:null,id={value:od.find(e=>!0===e.active)?.id??"",press:e=>{const n=od.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:od.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */pt("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},ld=[...hr.railLead??[],...hr.railTrail??[]].find(e=>"panel"in e&&e.id===fr),sd=Boolean(no?.foldable),dd=no?.label??(Lt?to.pageSections:to.templateSections),ad=sd&&Wr(xt),cd=/* @__PURE__ */ut(ht,{children:[ui.map((e,n)=>{if(_t(e)||qt(e)||Gt(e.type))return null;const t=or===String(e.props.id),o=Boolean(e.props._hidden);kl(e);const r=String(e.props.id),i=hr.hasOwnRows?.(e)??!1,l=Il(e)||i,s=l&&Wr(r),d=bl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Tn(a),index:$i(a).length}:void 0,p=ps.dragging,u=c&&p&&os(p,c)?c:void 0,{rowProps:h,...f}=ps.row({item:{id:r,zone:Ne,index:n,type:e.type},place:{...Tn(Ne),index:n},into:u,canDrag:!gr(e.type,e)},{"data-node-id":r,onClick:pl(()=>tl(n))});/* @__PURE__ */
|
|
29
|
+
return ut(Hn,{children:[n>0&&yl(n),
|
|
30
|
+
/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:e.type,size:13}),name:Oi(e),preview:hl(e),marks:fl(e),shared:Vl(e),onSelect:()=>tl(n),nameSlot:Yi(Ne,n,r,Oi(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>Hr(r)}:void 0,actions:/* @__PURE__ */ut(ht,{children:[ul(Ne,n,Oi(e)),ml(e,Ne,n),gl(Ne,n,e,Oi(e))]}),rowProps:h}),Il(e)&&!s&&/* @__PURE__ */ut(Ve,{children:[ed(e,1),hr.partRows?.(e,Qs)]}),i&&!s&&/* @__PURE__ */pt(Ve,{children:hr.ownRows?.(e,n,Qs)})]},String(e.props.id??n))}),Gl>0&&yl(Gl)]}),pd=(e,n,t)=>{const o=String(e.props.id),r=wl(e).length>0||xl(e)||Boolean(kr(e.type)),i=r&&Wr(o),l="header"===t?to.header:to.footer,s=wr.rowName?wr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
+
return ut(ht,{children:[
|
|
32
|
+
/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:t,size:13}),name:s,preview:hl(e),marks:fl(e),badge:Vl(e)?void 0:Ul,shared:Vl(e),onSelect:()=>tl(n),nameSlot:Yi(Ne,n,o,s),selected:or===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Hr(o)}:void 0,actions:ml(e,Ne,n)??void 0,rowProps:{"data-node-id":o,onClick:pl(()=>tl(n))}}),r&&!i&&/* @__PURE__ */pt(Ve,{children:qs(e,1)})]})};return(hr.wrap??(e=>e))(
|
|
33
|
+
/* @__PURE__ */pt(Z,{target:Vo,children:/* @__PURE__ */ut("div",{ref:Do,className:"sf-editor es-editor",style:ln(Er),onContextMenu:Qi.onEditorContextMenu,...p(Sn),children:[
|
|
34
|
+
/* @__PURE__ */ut(Ze,{children:[
|
|
35
|
+
/* @__PURE__ */ut("div",{className:"es-cluster es-cluster--left",children:[rd?/* @__PURE__ */pt(Jn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */pt(ye,{}),onClick:rd.onPress,children:to.railMedia}):null,
|
|
36
|
+
/* @__PURE__ */pt(_e,{label:to.bar.undo,disabled:Boolean($t)||!Dt.hasPast,onClick:()=>Dt.back(),children:/* @__PURE__ */pt(tt,{})}),
|
|
37
|
+
/* @__PURE__ */pt(_e,{label:to.bar.redo,disabled:Boolean($t)||!Dt.hasFuture,onClick:()=>Dt.forward(),children:/* @__PURE__ */pt(ot,{})})]}),
|
|
38
|
+
/* @__PURE__ */ut(qe,{children:[
|
|
39
|
+
/* @__PURE__ */pt(en,{devices:wo,value:Io,onChange:Oo}),
|
|
40
|
+
/* @__PURE__ */pt(_e,{label:to.bar.refresh,tip:to.bar.refreshTip,onClick:()=>{Fo.current=(()=>{const e=Vo?.document;if(!e)return null;const n=ui.findIndex(qt),t=n>=0?n:ui.length;let o=null;for(let n=0;n<t;n++){const t=ui[n]?.props?.id;if(null==t)continue;const r=Bn(e,`[data-easel-block="${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=Vt?.props?.id??ui[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Ro(e=>e+1)},children:/* @__PURE__ */pt(rt,{})}),hr.barView?.()]}),
|
|
41
|
+
/* @__PURE__ */ut(qe,{kind:"right",style:{minWidth:300},children:[
|
|
42
|
+
/* @__PURE__ */pt(v,{input:Jo,words:to.saveStatus}),Nn?/* @__PURE__ */pt(Nn,{}):null,hr.barLead?.(),hr.barTrail?.(),hr.mainAction||!hr.barMain?/* @__PURE__ */pt(b,{input:Jo,action:hr.mainAction??{label:to.done,onPress:()=>{qn(Rt.data)}},readOnly:Boolean($t),saveSwitch:Tt,onToggleAutoSave:It,onSaveNow:Xo,bar:to.bar,words:to.saveStatus}):hr.barMain()]})]}),
|
|
43
|
+
/* @__PURE__ */pt(ie,{}),
|
|
44
|
+
/* @__PURE__ */ut("div",{className:"sf-body",children:[ko?/* @__PURE__ */ut(ht,{children:[
|
|
45
|
+
/* @__PURE__ */ut("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":to.leftPanel,children:[
|
|
46
|
+
/* @__PURE__ */ut("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
|
|
47
|
+
/* @__PURE__ */pt(C,{side:"left",onHide:di}),
|
|
48
|
+
/* @__PURE__ */pt("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
|
|
49
|
+
/* @__PURE__ */pt(Xn,{variant:"underline",block:!0,"aria-label":to.bar.views,value:id.value,onChange:id.press,items:id.items})]}),Go?/* @__PURE__ */pt(w,{at:Zo?{label:(e=>{const n=ns(e.zone);if(n)return to.add.addingTo({name:wr.rowName?cl(n,!0):Ci(n.type)});if(e.zone===Ne){const n=ui[e.index];return n&&!qt(n)?to.add.addingBefore({name:cl(n,!0)}):to.add.addingAtEnd}const t=is(e.zone);return t?to.add.addingTo({name:t.parentName}):to.add.addingHere})(Zo),onClear:()=>_o(null)}:void 0,placeBlocks:Zo&&Zo.zone!==Ne?is(Zo.zone)?.choices:void 0,canTake:Zo?e=>{if(!Zo)return null;const n={...Tn(Zo.zone),index:Zo.index};if(ss(e,n))return null;if("shared"===e.kind&&Zo.zone===Ne&&!Yt.shared?.nodeOf(e.section))return to.shared.alreadyHere;const t=ns(Zo.zone);if(t)return to.add.notInside({name:cl(t,!0)});if(Zo.zone===Ne)return to.add.onlySections;const o=is(Zo.zone);return o?to.add.notInside({name:o.parentName}):to.add.onlySections}:void 0,onPick:Zo?e=>{if(!Zo)return;const n={...Tn(Zo.zone),index:Zo.index};ss(e,n)&&(ds(e,n),al())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:cs,siteWide:hr.addPanelRow?.(al),onClose:al,readOnly:Boolean($t)}):ld?ld.panel({onHide:di,notify:Xr}):/* @__PURE__ */ut(ht,{children:[
|
|
50
|
+
/* @__PURE__ */pt(N,{icon:/* @__PURE__ */pt(ge,{}),title:to.layers,context:po,actions:/* @__PURE__ */ut(ht,{children:[!$t&&/* @__PURE__ */pt(nn,{label:to.add.title,onClick:()=>sl(null),children:/* @__PURE__ */pt(it,{size:15})}),
|
|
51
|
+
/* @__PURE__ */pt(nn,{label:Ql?to.expandAll:to.collapseAll,title:0===Kl.length?to.nothingToFold:void 0,disabled:0===Kl.length,onClick:()=>Lr(e=>{const n=new Set(Kl);return Ql?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Kl])}),children:/* @__PURE__ */pt(bt,{expand:Ql})})]})}),
|
|
52
|
+
/* @__PURE__ */ut(We,{className:"sf-tree sf-scroll",words:oo,children:[Jl&&/* @__PURE__ */ut(ht,{children:[!Fl&&/* @__PURE__ */pt(He,{children:to.header}),Zs(Jl)]}),Et&&!(Fl&&Jl)&&/* @__PURE__ */ut(ht,{children:[!Fl&&/* @__PURE__ */pt(He,{children:to.header}),!eo&&/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(zr,{type:"header",size:13}),name:to.header,badge:Yl?void 0:Ul,shared:Yl,onSelect:pi,selected:nr.kind===Zt?.kind,rowProps:{onClick:pl(pi)}})]}),Ll&&!(Fl&&Jl)&&pd(Ll,Al,"header"),!sd&&/* @__PURE__ */pt(He,{children:dd}),sd?/* @__PURE__ */ut(ht,{children:[
|
|
53
|
+
/* @__PURE__ */pt(De,{words:oo,icon:null,name:dd,fold:{open:!ad,label:dd,onToggle:()=>Hr(xt)}}),!ad&&/* @__PURE__ */pt(Ve,{children:cd})]}):cd,Et&&!Fl&&/* @__PURE__ */pt(He,{children:to.footer}),jl&&!(Fl&&Xl)&&pd(jl,Tl,"footer"),Xl&&Zs(Xl),hr.treeFoot?.()]})]})]}),
|
|
54
|
+
/* @__PURE__ */pt(tn,{side:"left",width:Er.left,min:rn.left,max:on,defaultWidth:f.left,label:to.resizeLeftPanel,onResize:Dr})]}):/* @__PURE__ */pt(I,{side:"left",onShow:di}),
|
|
55
|
+
/* @__PURE__ */ut("div",{ref:Gr,className:"sf-center sf-scroll","data-sf-canvas-head":qr?"":void 0,style:{overflowX:ii?"auto":"hidden",overflowY:"hidden"},children:[qr&&/* @__PURE__ */pt("div",{ref:ei,className:"sf-canvas-head",children:/* @__PURE__ */pt(qr,{device:Io})}),
|
|
56
|
+
/* @__PURE__ */ut("div",{className:"sf-frame-scaler",style:li,children:[
|
|
57
|
+
/* @__PURE__ */pt("div",{className:"sf-frame "+(Io===Co?"":`sf-frame--${Io}`),style:si,children:/* @__PURE__ */ut("div",{className:"sf-preview-host",children:[
|
|
58
|
+
/* @__PURE__ */pt(Re.Provider,{value:Rl,children:/* @__PURE__ */pt(Fe.Provider,{value:Hl,children:/* @__PURE__ */pt(uo,{},Eo)})}),
|
|
59
|
+
/* @__PURE__ */pt(fn,{canvas:Vo,session:cs,model:Ms,measure:js,canDrop:Ls,onDrop:Rs,choose:bs,tag:ys,onPick:Ds,dropOn:Vs?{accepts:(e,n)=>{if(!e.media||!Vs||n.item.rung)return!1;const t=jn(Rt.data,fi,n.item.id);return null!==t&&Vs.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Ys();n&&Vs&&Js(n).then(n=>{n&&Xs(n,e.item.id)})})(n),label:()=>to.canvasReplaceImage}:void 0,onZoneAdd:Gs,onSeamAdd:Gs,zoneAddLabel:to.canvasAddBlock,words:ro.canvas,readOnly:Boolean($t),revision:Rt.data}),qo.length>0&&!Wo&&/* @__PURE__ */pt("div",{className:"sf-preview-gaps",children:qo.map(e=>
|
|
60
|
+
/* @__PURE__ */pt(mn,{index:e.index,label:to.addSectionHere,onInsert:()=>sl(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))})]})}),ws?/* @__PURE__ */pt(vt,{canvas:Vo,tabs:Cs,onSelect:e=>{const n=ui.findIndex(n=>String(n.props.id)===e);n>=0&&tl(n)}}):null]})]}),So?/* @__PURE__ */ut(ht,{children:[In?
|
|
61
|
+
/* @__PURE__ */pt("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:In}):/* @__PURE__ */pt(ht,{children:/* @__PURE__ */pt(u,{value:{selectChild:Bl,addChild:Pl,childRowName:Wi,blockRowName:Zl},children:/* @__PURE__ */pt(ho,{mode:nr,onOpenWebsiteSettings:hr.openSettings??(()=>{}),onOpenSiteStyles:hr.openStyles,onOpenPageStyles:hr.openPageStyles,onSelectNode:Or,onNotify:Xr,onHidePanel:ai,nodeActions:Vt?Ie(Ht,Vt.type):zt})})}),
|
|
62
|
+
/* @__PURE__ */pt(tn,{side:"right",width:Er.right,min:rn.right,max:on,defaultWidth:f.right,label:to.resizeSettingsPanel,onResize:Vr})]}):
|
|
63
|
+
/* @__PURE__ */pt(I,{side:"right",onShow:ai})]}),Qi.menu,
|
|
64
|
+
/* @__PURE__ */pt(te,{}),ki?/* @__PURE__ */pt(mt,{name:ki.name,onMake:e=>(async(e,n)=>{const t=ui.find(n=>String(n.props.id)===e),o=Yt.shared;if(!t||!o)return;let r;try{r=await z(bi).create(n,t)}catch{return void Xr(to.shared.makeFailed,"error")}o.adopt(t,r),Si(null)})(ki.id,e),onCancel:()=>Si(null)}):null]})}))}export{Nt as ScreenChrome};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveMediaPick as e}from"./chunk-
|
|
1
|
+
import{resolveMediaPick as e}from"./chunk-3FIS2FRS.js";function t(t){const r=t;switch(r?.type){case"storefront-editor:media-picked":{const r=t;return r.requestId&&e(r.requestId,r.media??null),!0}case"storefront-editor:media-pick-cancelled":{const r=t;return r.requestId&&e(r.requestId,null),!0}default:return!1}}export{t as routeSharedHostMessage};
|