efficient-easel 4.0.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/buckets-Tj-nkBpg.d.ts +28 -0
- package/dist/chrome/chrome.css +33 -5
- package/dist/chrome/index.js +1 -1
- package/dist/chunk-3FZAGTQE.js +5 -0
- package/dist/chunk-3ZJSLHHI.js +8 -0
- package/dist/chunk-5QSFLWAJ.js +65 -0
- package/dist/{chunk-42TMLDSQ.js → chunk-6TOYXESC.js} +1 -1
- package/dist/chunk-7EWFXVDJ.js +21 -0
- package/dist/chunk-7YMO6R3V.js +1 -0
- package/dist/chunk-BXQBCW3P.js +1 -0
- package/dist/{chunk-ZHTQCAQ2.js → chunk-F7BYSWRR.js} +1 -1
- package/dist/{chunk-TJOUAFJE.js → chunk-G4OCSMYY.js} +1 -1
- package/dist/{chunk-D4BUPPPV.js → chunk-H6NYEMLS.js} +3 -3
- package/dist/{chunk-2I7MAA2U.js → chunk-HQWQLDCB.js} +1 -1
- package/dist/{chunk-XJPNW26S.js → chunk-ITAQX3HT.js} +1 -1
- package/dist/{chunk-7GVPKRW2.js → chunk-KEHLCWTG.js} +4 -4
- package/dist/chunk-KFV7N2DJ.js +1 -0
- package/dist/chunk-MQNBD6AB.js +1 -0
- package/dist/chunk-PCMGFPFU.js +5 -0
- package/dist/{chunk-5SOSVTVI.js → chunk-PFNIVZPN.js} +1 -1
- package/dist/{chunk-QBJJVMVB.js → chunk-R5GKLOIP.js} +1 -1
- package/dist/chunk-SF4DL63U.js +1 -0
- package/dist/{chunk-GTDLBUOC.js → chunk-UB4TLWVJ.js} +6 -6
- package/dist/{chunk-SNMCF2ZD.js → chunk-XHHS6SDM.js} +1 -1
- package/dist/copy/copy.css +7 -7
- package/dist/copy/index.js +5 -5
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.d.ts +2 -2
- package/dist/fields/fields.css +4 -0
- package/dist/fields/index.d.ts +103 -51
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.d.ts +8 -2
- package/dist/panel/index.js +19 -12
- package/dist/panel/panel.css +23 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +14 -14
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/puck/field-buckets.d.ts +20 -6
- package/dist/screen/lib/puck/field-buckets.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +14 -5
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +4 -4
- package/dist/strings/catalogue.d.ts +2 -2
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.js +11 -11
- package/dist/text-styles/text-styles.css +2 -2
- package/dist/{types-CWxUxPGO.d.ts → types-OUl0mK1k.d.ts} +5 -2
- package/dist/{words-BGrHZAJJ.d.ts → words-zH1H0WFw.d.ts} +8 -3
- package/package.json +2 -2
- package/dist/buckets-CuLM47h9.d.ts +0 -13
- package/dist/chunk-4YBMSUPL.js +0 -1
- package/dist/chunk-7P6IFCR4.js +0 -1
- package/dist/chunk-KFMJ4IM4.js +0 -5
- package/dist/chunk-LJOYIXO4.js +0 -65
- package/dist/chunk-NJOPEWYN.js +0 -20
- package/dist/chunk-QEWRHH6R.js +0 -5
- package/dist/chunk-QTLAVDJE.js +0 -1
- package/dist/chunk-R2HLPNQF.js +0 -1
- package/dist/chunk-WSNVBUPL.js +0 -1
- package/dist/chunk-YNOZ5NXW.js +0 -14
package/README.md
CHANGED
|
@@ -915,6 +915,19 @@ const easel = createEasel<EaselConfig>({ config, data, onChange: (doc) => autosa
|
|
|
915
915
|
press where a person types — a text field, a textarea, an editable
|
|
916
916
|
region — to that field's own undo. Left out, a press there undoes the
|
|
917
917
|
easel's step, as Puck's did; the provider and the canvas bind so.
|
|
918
|
+
- **Two tabs since 4.0.0: Design and Animation.** A field's `bucket` is one
|
|
919
|
+
of `SETTINGS_BUCKETS`; anything else (the 3.x `Content`, `Style`, `Layout`)
|
|
920
|
+
is ignored, so the rows stay in the tab above them. Inside Design the host
|
|
921
|
+
emits its group headings in `DESIGN_GROUPS` order under `DESIGN_GROUP_KEY`
|
|
922
|
+
and passes its text box to `Inspector` as `lead` (drawn before the first
|
|
923
|
+
row; `children` stay after the last). The strip is the shell's `Tabs`
|
|
924
|
+
(`underline`, `block`); a tab with an icon in `tabIcons` is icon-only, its
|
|
925
|
+
word kept as its name and its Tooltip.
|
|
926
|
+
- **Folding bands since 4.0.0, one level.** A marker with `fold: '<title>'`
|
|
927
|
+
starts a band: the rows after it, up to the next fold marker or tab marker,
|
|
928
|
+
are drawn inside one `SettingsGroup` (− / +, open by default). `leadFold`
|
|
929
|
+
puts `lead` in a band of its own; `closedFolds` + `onFold` let the host hold
|
|
930
|
+
which bands are closed. A folded band's rows stay mounted.
|
|
918
931
|
- **`planFields().rows` holds `slot` rows.** They draw nothing and are there so
|
|
919
932
|
the slot's name has a bucket. Filter `row.field.type !== 'slot'` before
|
|
920
933
|
drawing or counting rows of your own.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The settings tab words, in the owner's order: Design, Animation (owner
|
|
3
|
+
* 2026-10-08, final 2026-10-10). It replaces the four buckets of 2026-09-11
|
|
4
|
+
* (Content, Style, Layout, Animation): what was in Content now sits at the TOP
|
|
5
|
+
* of Design, and Style and Layout merge into Design. A panel shows only the
|
|
6
|
+
* tabs that hold a setting — an empty tab is hidden, never drawn.
|
|
7
|
+
*
|
|
8
|
+
* ONE list for both editors. The website editor wrote the first one in
|
|
9
|
+
* `efficient-storefront/lib/puck/field-groups.ts` (`BUCKETS`); from 0.43.0 it
|
|
10
|
+
* lives here, so the campaign editor spells its panel with the same words in
|
|
11
|
+
* the same order instead of keeping a second list.
|
|
12
|
+
*/
|
|
13
|
+
declare const SETTINGS_BUCKETS: readonly ["Design", "Animation"];
|
|
14
|
+
type SettingsBucket = (typeof SETTINGS_BUCKETS)[number];
|
|
15
|
+
/**
|
|
16
|
+
* The groups INSIDE the Design tab, in the owner's order (2026-10-10): the
|
|
17
|
+
* Content part first, with no heading of its own (the text box and the rows
|
|
18
|
+
* that were the Content tab), then Size, Design, Layout, Position and Anchor.
|
|
19
|
+
*
|
|
20
|
+
* A key, not a word: what each group is CALLED is `PanelWords.designGroups`.
|
|
21
|
+
* The host emits a heading for each group it has (`DESIGN_GROUP_KEY` in
|
|
22
|
+
* `screen/lib/puck/field-buckets`); Content's is a marker that draws nothing.
|
|
23
|
+
* One list for both editors, like `SETTINGS_BUCKETS`.
|
|
24
|
+
*/
|
|
25
|
+
declare const DESIGN_GROUPS: readonly ["Content", "Size", "Design", "Layout", "Position", "Anchor"];
|
|
26
|
+
type DesignGroup = (typeof DESIGN_GROUPS)[number];
|
|
27
|
+
|
|
28
|
+
export { type DesignGroup as D, type SettingsBucket as S, DESIGN_GROUPS as a, SETTINGS_BUCKETS as b };
|
package/dist/chrome/chrome.css
CHANGED
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
}
|
|
236
236
|
/* A panel's own name. States the margin an h2 would otherwise bring. */
|
|
237
237
|
.es-panel-title {
|
|
238
|
-
font-size:
|
|
238
|
+
font-size: 14px;
|
|
239
239
|
font-weight: 600;
|
|
240
240
|
color: var(--es-text);
|
|
241
241
|
margin: 0;
|
|
@@ -297,8 +297,9 @@ span:has(> .es-insp-up-btn) {
|
|
|
297
297
|
}
|
|
298
298
|
.es-insp-head {
|
|
299
299
|
display: flex;
|
|
300
|
+
flex-wrap: wrap;
|
|
300
301
|
align-items: center;
|
|
301
|
-
gap: 12px;
|
|
302
|
+
gap: 8px 12px;
|
|
302
303
|
padding: 12px 16px;
|
|
303
304
|
flex: none;
|
|
304
305
|
}
|
|
@@ -359,7 +360,7 @@ span:has(> .es-insp-up-btn) {
|
|
|
359
360
|
display: flex;
|
|
360
361
|
align-items: center;
|
|
361
362
|
justify-content: center;
|
|
362
|
-
font-size:
|
|
363
|
+
font-size: 14px;
|
|
363
364
|
flex: none;
|
|
364
365
|
background: var(--es-chip-bg);
|
|
365
366
|
color: var(--es-icon);
|
|
@@ -368,13 +369,39 @@ span:has(> .es-insp-up-btn) {
|
|
|
368
369
|
width: 15px;
|
|
369
370
|
height: 15px;
|
|
370
371
|
}
|
|
372
|
+
/* AT A NARROW PANEL THE TITLE WINS (Lewis/GG, 2026-10-14). At 220px the chip
|
|
373
|
+
and the buttons left the name 33px ("Hero Slideshow" read "He…"), and
|
|
374
|
+
the registry's longest names ("Photo Submission Form", 150px) were cut even
|
|
375
|
+
at 320. The titles now ask for their whole name (`flex: 1 0 auto` over a
|
|
376
|
+
one-line name is its full width) and never shrink below it, so when the row
|
|
377
|
+
cannot hold name and buttons the BUTTONS wrap to a second row, at its right
|
|
378
|
+
end, where Hide panel already sits:
|
|
379
|
+
row 1 [chip] Photo Submission Form
|
|
380
|
+
Section
|
|
381
|
+
row 2 [dup] [del] | [hide]
|
|
382
|
+
A wide panel, or a short name, keeps one row. Only a name wider than the
|
|
383
|
+
whole row (none in the registry) is still cut, with its words in the
|
|
384
|
+
Tooltip: `max-width` is the row less the chip (26) and the gap (12).
|
|
385
|
+
Not an overflow menu: three buttons fit a 196px row, so folding them would
|
|
386
|
+
hide Duplicate and Remove behind a click and buy the name nothing. */
|
|
371
387
|
.es-insp-titles {
|
|
372
|
-
flex: 1;
|
|
388
|
+
flex: 1 0 auto;
|
|
389
|
+
min-width: 0;
|
|
390
|
+
max-width: calc(100% - 38px);
|
|
391
|
+
}
|
|
392
|
+
/* The shell Tooltip's wrapper round the name: a block that may shrink, so the
|
|
393
|
+
name's ellipsis still applies inside it. */
|
|
394
|
+
.es-insp-name-tip {
|
|
395
|
+
position: relative;
|
|
396
|
+
display: flex;
|
|
397
|
+
min-width: 0;
|
|
398
|
+
}
|
|
399
|
+
.es-insp-name-tip > .es-insp-name {
|
|
373
400
|
min-width: 0;
|
|
374
401
|
}
|
|
375
402
|
/* An h2 carries `0.83em 0` from the UA sheet; `margin: 0` keeps the head closed. */
|
|
376
403
|
.es-insp-name {
|
|
377
|
-
font-size:
|
|
404
|
+
font-size: 14px;
|
|
378
405
|
font-weight: 600;
|
|
379
406
|
color: var(--es-text);
|
|
380
407
|
margin: 0;
|
|
@@ -391,6 +418,7 @@ span:has(> .es-insp-up-btn) {
|
|
|
391
418
|
align-items: center;
|
|
392
419
|
gap: 2px;
|
|
393
420
|
flex: none;
|
|
421
|
+
margin-left: auto;
|
|
394
422
|
}
|
|
395
423
|
/* A side panel's head has two pieces besides its glyph buttons (MediaPanelHead,
|
|
396
424
|
card [MERGE] One Media Panel Head, 2026-10-06; until then each editor's own
|
package/dist/chrome/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MediaPanelHead,PanelResizeHandle,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,mediaPickKind,panelWidthVars,setPanelWidthVars}from"../chunk-
|
|
1
|
+
export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MediaPanelHead,PanelResizeHandle,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,mediaPickKind,panelWidthVars,setPanelWidthVars}from"../chunk-UB4TLWVJ.js";import"../chunk-Y2G7CU6A.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-MFIRYGHW.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{slotFieldsOf as n}from"./chunk-PLVEGYK6.js";import{usePickFollowsSelection as e}from"./chunk-R6WTQWAC.js";import{Inspector as t}from"./chunk-7EWFXVDJ.js";import{EaselCanvas as r,useSelectedFields as i}from"./chunk-FUOZKV7A.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(e,t,r){const i=e.slotsOf?.(r);return i||n(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h={},v=()=>k,g=()=>"",y=()=>null,b=()=>{},O={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},j={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},w={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},L={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},S={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function C(){/* @__PURE__ */
|
|
2
|
+
return s(r,{height:"fill"})}function D(){const{id:n,fields:e,values:r,readOnly:o,onChange:u}=i();/* @__PURE__ */
|
|
3
|
+
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(t,{fields:e,values:r,onChange:u,readOnly:o,idPrefix:n})})}var P=o({});function F({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return s(P.Provider,{value:n,children:e})}function G(){return u(P)}function N(){return(G().useOwnerName??g)()}function x(){return(G().useDocumentLabel??y)()}function A(n,e,t,r){return(G().useBridges??v)(n,e,t,r)}function B(n){return(G().useStandaloneBridges??v)(n)}function I(n,e){(G().useDocumentPass??b)(n,e)}function T(){return G().blockRules??O}function V(){return G().blockLook??j}function K(){return G().devices??w}function R(){return G().leftView??L}function W(){return G().pinned??S}function E(){return G().saveSwitch??!0}function Z(n){e(!0===G().pickFollowsSelection,n)}function H(){return G().add??h}function J(){return G().storageNamespace||void 0}function Q(){return G().styleClipboard??null}function U(){return G().nodeKeys??!0}function X(){return G().notify??null}function Y(){return G().Canvas??C}function q(){return G().CanvasHead??null}function z(){return G().canvasDrag??null}var M=o(null);function $({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return s(M.Provider,{value:n,children:e})}function _(){return u(M)}function nn(){return G().Inspector??D}export{c as SELECTION_MODE,$ as ScreenCanvasTargetProvider,F as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,H as useScreenAdd,V as useScreenBlockLook,T as useScreenBlockRules,A as useScreenBridges,z as useScreenCanvasDrag,Y as useScreenCanvasFrame,q as useScreenCanvasHead,_ as useScreenCanvasTarget,K as useScreenDevices,x as useScreenDocumentLabel,I as useScreenDocumentPass,nn as useScreenInspectorPanel,R as useScreenLeftView,U as useScreenNodeKeys,X as useScreenNotify,N as useScreenOwnerName,G as useScreenParts,Z as useScreenPickFollowsSelection,W as useScreenPinned,E as useScreenSaveSwitch,J as useScreenStorageNamespace,Q as useScreenStyleClipboard,B as useStandaloneScreenBridges};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{SettingsSwitch as e}from"./chunk-QLD57GBB.js";import{jsxs as n,jsx as l,Fragment as a}from"react/jsx-runtime";import{isValidElement as i,cloneElement as s}from"react";function r({title:e,open:a,onToggle:i,count:s,id:r,children:c,className:d}){const o=r?`${r}-body`:void 0;/* @__PURE__ */
|
|
2
|
+
return n("div",{className:d?`es-group ${d}`:"es-group",children:[
|
|
3
|
+
/* @__PURE__ */n("button",{type:"button",id:r,"aria-expanded":a,"aria-controls":o,className:"es-group-head",onClick:()=>i(!a),children:[e,"number"==typeof s&&s>0?/* @__PURE__ */l("span",{className:"es-group-count",children:s}):null,
|
|
4
|
+
/* @__PURE__ */l("span",{className:"es-group-sign","aria-hidden":"true"})]}),
|
|
5
|
+
/* @__PURE__ */l("div",{id:o,className:"es-group-body",hidden:!a,children:c})]})}function c(e){return Array.isArray(e)?e.some(c):i(e)}function d(n,l,a){if(!i(n)||n.type!==e)return n;const r=n.props;return r.ariaLabel||r.ariaLabelledBy?n:s(n,a?{ariaLabelledBy:a}:{ariaLabel:l})}function o({label:e,labelId:i,icon:s,value:r,hint:o,changed:t,htmlFor:u,action:h,children:m,className:p}){const f=c(m),N=c(h);if(!f&&!N)return null;const b=["es-field"];f||b.push("is-inline"),t&&b.push("is-changed"),p&&b.push(p);const g=/* @__PURE__ */n(a,{children:[s?/* @__PURE__ */l("span",{className:"es-field-icon","aria-hidden":"true",children:s}):null,
|
|
6
|
+
/* @__PURE__ */l("span",{className:"es-field-label",id:i,children:e})]});/* @__PURE__ */
|
|
7
|
+
return n("div",{className:b.join(" "),children:[
|
|
8
|
+
/* @__PURE__ */n("div",{className:"es-field-head",children:[u?/* @__PURE__ */l("label",{className:"es-field-name",htmlFor:u,children:g}):/* @__PURE__ */l("span",{className:"es-field-name",children:g}),null!=r?/* @__PURE__ */l("span",{className:"es-field-value",children:r}):null,N?d(h,e,i):null]}),f?/* @__PURE__ */l("div",{className:"es-field-ctl",children:m}):null,o?/* @__PURE__ */l("p",{className:"es-field-hint",children:o}):null]})}var t=Object.freeze(["Design","Animation"]),u=Object.freeze(["Content","Size","Design","Layout","Position","Anchor"]);export{u as DESIGN_GROUPS,t as SETTINGS_BUCKETS,o as SettingsField,r as SettingsGroup};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-BXQBCW3P.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,editorRootFocus as m}from"./chunk-X2GNFJRC.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-6TOYXESC.js";import{usePartBridge as v}from"./chunk-SF4DL63U.js";import{useSectionOps as w}from"./chunk-XHHS6SDM.js";import{useNodeClipboard as x,useNodeContextMenu as b}from"./chunk-F7BYSWRR.js";import{PageEditGuardNotices as z}from"./chunk-HQWQLDCB.js";import{useScreenDocument as B}from"./chunk-WZMU646D.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{heldStyle as O,styleShortcut as N}from"./chunk-V7U33NF2.js";import{AddChildRow as I}from"./chunk-5545A3PC.js";import{AddSidePanel as P}from"./chunk-PCMGFPFU.js";import{SidePanelHead as T,PanelShowStrip as $}from"./chunk-PFNIVZPN.js";import{MediaSidePanel as A}from"./chunk-G4OCSMYY.js";import{useScreenSaveSwitch as M,useScreenNodeKeys as j,useScreenPinned as R,useScreenDocumentLabel as L,useScreenCanvasFrame as E,useScreenInspectorPanel as F,useScreenDevices as V,useScreenPickFollowsSelection as H,useScreenLeftView as W,useScreenAdd as D,SELECTION_MODE as U,sameInspectorMode as G,useScreenBridges as Y,useScreenBlockRules as J,useScreenBlockLook as X,useScreenStorageNamespace as K,useScreenNotify as Q,useScreenCanvasHead as _,isSlotMode as q,useScreenStyleClipboard as Z,useScreenDocumentPass as ee,useScreenCanvasDrag as ne,ScreenCanvasTargetProvider as te,isPinnedFirst as oe,isPinnedLast as re,screenSlotsOf as ie}from"./chunk-3FZAGTQE.js";import{ROOT_ZONE as le,blockNodeActions as se,TREE_MAX_DEPTH as de,childSlotsOf as ce,slotFieldsOf as ae,slotChildrenIn as pe,nestsInTree as ue,newNodeId as fe}from"./chunk-PLVEGYK6.js";import{useMediaPanel as he,usePanelPick as me,useCancelPanelPick as ge}from"./chunk-R6WTQWAC.js";import{useEaselHost as ye,useHostEscape as ke}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-MCHMF32I.js";import{TreeRow as we,Subtree as xe,LayersTree as be,TreeGroupLabel as ze,TreeRowAction as Be,TreeSeam as Ce}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Oe}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ne}from"./chunk-WK3AFPXY.js";import{LayersIcon as Ie,MediaIcon as Pe}from"./chunk-4VJATVVR.js";import{DEFAULT_SAVE_WORDS as Te,saveIndicator as $e}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Ae,TopBarRail as Me,TopBarCluster as je,EaselIconButton as Re,TopBarDivider as Le,DeviceSwitch as Ee,InspectorIconButton as Fe,PanelResizeHandle as Ve,MAX_PANEL_W as He,MIN_PANEL_W as We,panelWidthVars as De,SaveState as Ue,SaveStateToggle as Ge}from"./chunk-UB4TLWVJ.js";import{DEFAULT_CHROME_WORDS as Ye}from"./chunk-Y2G7CU6A.js";import{CanvasDragLayer as Je}from"./chunk-KEHLCWTG.js";import{DEFAULT_DRAG_WORDS as Xe}from"./chunk-O2NLQBFX.js";import{createDragSession as Ke,useTreeDrag as Qe,gapToMoveIndex as _e}from"./chunk-67GNT6PF.js";import{useCanvasFrame as qe,BLOCK_SELECTOR as Ze,useCanvasEvent as en}from"./chunk-PAELDYYS.js";import{useEasel as nn,useEaselApi as tn}from"./chunk-FUOZKV7A.js";import{toItemSelector as on,useNodeOps as rn,clickPick as ln}from"./chunk-UK2FQOUT.js";import{useWords as sn}from"./chunk-MFIRYGHW.js";import{zoneKey as dn,ROOT_ID as cn,ROOT_SLOT as an,parseZoneKey as pn,DataError as un,find as fn}from"./chunk-KRXQM65X.js";import{useRef as hn,useMemo as mn,useState as gn,useEffect as yn,useCallback as kn,useLayoutEffect as Sn,Fragment as vn}from"react";import{Tooltip as wn,Button as xn,toast as bn}from"efficient-shell/ui";import{UndoIcon as zn,RedoIcon as Bn,TrashIcon as Cn,EyeOffIcon as On,EyeIcon as Nn,DuplicateIcon as In}from"efficient-shell/icons/efficient";import{jsx as Pn,jsxs as Tn,Fragment as $n}from"react/jsx-runtime";function An({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i,words:l,saveWords:s}){if(null!==t)/* @__PURE__ */return Pn(Ue,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
|
|
2
|
+
return Pn(Ue,{tone:e.pending?"off-unsaved":"off",label:l.notSaving,role:"status"});const{tone:d,label:c}=$e(e,s),a=e.failed&&!e.paused&&/* @__PURE__ */Pn(xn,{variant:"secondary",size:"sm",onClick:i,children:l.retry});/* @__PURE__ */
|
|
3
|
+
return Tn($n,o?{children:[
|
|
4
|
+
/* @__PURE__ */Pn(Ge,{pressed:e.paused,onToggle:r,title:e.paused?l.autoSaveOff:l.autoSaveOn,children:/* @__PURE__ */Pn(Ue,{tone:d,label:c})}),a]}:{children:[
|
|
5
|
+
/* @__PURE__ */Pn(Ue,{tone:d,label:c,role:"status"}),a]})}function Mn({expand:e}){/* @__PURE__ */
|
|
6
|
+
return Pn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Tn($n,e?{children:[
|
|
7
|
+
/* @__PURE__ */Pn("path",{d:"M8 9l4-4 4 4"}),
|
|
8
|
+
/* @__PURE__ */Pn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
9
|
+
/* @__PURE__ */Pn("path",{d:"M8 4l4 4 4-4"}),
|
|
10
|
+
/* @__PURE__ */Pn("path",{d:"M8 20l4-4 4 4"}),
|
|
11
|
+
/* @__PURE__ */Pn("path",{d:"M5 12h14"})]})})}function jn(e,n,t){const o=t-n;if(o<6)return null;if(o<26)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+13),t-13))}}var Rn="__rungs";var Ln="screen:band",En={duplicate:!0,delete:!0};function Fn(){const $e=ye(),{target:Ue,docId:Ge,capabilities:Fn,currentSlug:Vn,siteId:Hn,onPublish:Wn,saveState:Dn,saveConflict:Un,retrySave:Gn,toggleAutoSave:Yn,readOnly:Jn,readOnlyReason:Xn=null}=B(),Kn=M(),Qn=j(),{mediaEditing:_n,hasEditGuard:qn,hasPinnedChrome:Zn}=Fn,{appState:et,dispatch:nt,history:tt,selectedItem:ot,getSelectorForId:rt,config:it}=nn(e=>e),lt=R(),{first:st,firstGroup:dt,lastGroup:ct,isSectionGroup:at,sectionGroupZone:pt,panelOf:ut}=lt,ft=ut(st),ht=e=>oe(lt,e),mt=e=>re(lt,e),gt="node"===lt.firstRow,yt=lt.band??null,kt=sn("screen",ve),St=sn("tree",Oe),vt=sn("drag",Xe),wt=sn("save",Te),xt=sn("menu",Ne),bt=sn("styleClipboard",Se),zt=sn("chrome",Ye),Bt=L()??`/${Vn}`,Ct=E(),Ot=F(),Nt=w({readOnly:Jn}),It=w({readOnly:Jn,foldIntoHistory:!0}),Pt=hn(null),Tt=tn(),$t=mn(()=>({...Nt,select:e=>{Pt.current=e,Nt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Tt.config;Pt.current=on(e,t,n)}Nt.commitDocument(e,n)}}),[Nt,Tt]),At=et.ui,Mt=At.leftSideBarVisible,jt=At.rightSideBarVisible,{options:Rt,widths:Lt,initial:Et,fluid:Ft,fit:Vt}=V(),[Ht,Wt]=gn(Et),Dt=he(),Ut=_n&&null!==Dt,Gt=me(),Yt=ge();H(ot?.props.id);const{read:Jt,write:Xt,forSelection:Kt}=W(),[Qt,_t]=gn(Jt);yn(()=>{Xt(Qt)},[Qt]);const[qt,Zt]=gn(0),eo=hn(null),no=hn(null),to=qe(no,{readySelector:Ze}),oo=f(no);h(no,to);const[ro,io]=gn(!1),lo=hn(!1),so=hn(!1),[co,ao]=gn(null),po=D(),uo=e=>ao(null===e?null:{zone:le,index:e}),[fo,ho]=gn([]),[mo,go]=gn(U),yo="puck"===mo.kind,ko=ro&&!co&&po.railTarget?po.railTarget(et.data,{node:ot??null,mode:mo}):null,So=ko?{zone:dn(ko),index:ko.index}:null,vo=co??So,wo=vo&&vo.zone===le?vo.index:null,xo=t(mo,ot?.props.id),[bo,zo]=gn(null);yn(()=>{bo&&(o(),zo(null))},[bo]);const Bo=hn(rt);Bo.current=rt;const Co=kn((e,{scroll:n})=>{_t(n=>Kt(e,n)),n&&zo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Bo.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&tr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Oo=hn(null);yn(()=>{const e=Oo.current;Oo.current=null;const n=null==ot?.props.id?null:String(ot.props.id);go(e&&e.id===n?e.mode:ut(ot?.type)??U);const t=ot?.props.id,o=Pt.current;if(Pt.current=null,!t)return;const i=rt(t);Co(String(t),{scroll:!r(o,i??null,le)})},[ot?.props.id,Co]);const No=kn(e=>{go(n=>G(n,e)?n:e),nt({type:"setUi",ui:{rightSideBarVisible:!0}})},[nt]),Io=hn(()=>{});Io.current=(e,n)=>{const t=e?Jr(e.zone??le)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==ot?.props.id?null:String(ot.props.id);go(e=>G(e,n)?e:n),o!==r&&(Oo.current={id:o,mode:n},$t.select(e))};const Po=kn((e,n)=>Io.current(e,n),[]),To={kind:mo.kind,mode:mo,open:No,show:e=>go(e),reveal:()=>{jt||nt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Po},$o=Y(To,{data:et.data,selected:ot??null,zoneOf:e=>rt(e)?.zone,readOnly:Boolean(Jn),select:e=>{go(U),$t.select({index:e})},replace:(e,n)=>$t.replaceComponent(le,e,n),scrollTo:e=>ki(e)},{device:Ht,refreshes:qt},{setView:_t,reveal:()=>{Mt||nt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Ao=$o.pinnedSource??!1,Mo=$o.resolveLeftView?$o.resolveLeftView(Qt,Ut):"media"===Qt&&Ut?Qt:"sections",jo=J(),{isLockedBlock:Ro,duplicateBlocked:Lo,nestDepth:Eo,newSectionNode:Fo,canAddTo:Vo,blockIsOffered:Ho}=jo,Wo=X(),{labelAtLevel:Do,Icon:Uo,useProducts:Go}=Wo,Yo=Wo.rowName?(e,n,t)=>Wo.rowName(e,n,t):void 0,Jo=kn(e=>{nt({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),Co(e,{scroll:!0})},[nt,Co]),{selectNode:Xo,openPartId:Ko}=v({mode:mo,setMode:go,onOpenPart:Jo}),[Qo,_o]=gn(null);ke(null!==Qo,()=>_o(null));const qo=y(K()),Zo=qo.collapsed,er=qo.panelWidths,[nr,tr]=gn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Zo);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
12
|
+
return new Set}});yn(()=>{try{window.localStorage.setItem(Zo,JSON.stringify([...nr]))}catch{}},[nr]);const[or,rr]=gn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(er);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});yn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(er,JSON.stringify(or))}catch{}},300);return()=>clearTimeout(e)},[or]);const ir=kn((e,n)=>rr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),lr=kn(e=>ir("left",e),[ir]),sr=kn(e=>ir("right",e),[ir]),dr=e=>nr.has(e),cr=e=>tr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),ar=hn(!1),pr=hn(null);yn(()=>{if(ar.current&&!ro){const e=pr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??no.current?.querySelector(`button[aria-label="${CSS.escape(kt.add.title)}"]`))?.focus(),pr.current=null}ar.current=ro},[ro]),yn(()=>{if(!ro||!oo)return;const e=e=>{"Escape"===e.key&&Oi()};return oo.addEventListener("keydown",e),()=>oo.removeEventListener("keydown",e)},[ro,oo]),ke(ro,()=>Oi()),yn(()=>{!Mt&&ro&&(io(!1),ao(null),lo.current=!1)},[Mt]),yn(()=>{if(!Gt)return so.current&&nt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(so.current=!1);ro&&(io(!1),ao(null),so.current=lo.current,lo.current=!1),Mt||(so.current=!0,nt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Gt]),yn(()=>{!Mt&&Gt&&(so.current=!1,Yt())},[Mt]),yn(()=>{if(!Gt||!oo)return;const e=e=>{"Escape"===e.key&&Yt()};return oo.addEventListener("keydown",e),()=>oo.removeEventListener("keydown",e)},[Gt,oo]),ke(null!==Gt,()=>Yt());const ur=Q(),fr=(e,n="success")=>{ur?ur(e,"error"===n?"error":"info"):"error"===n?bn.error(e,{duration:3200,sound:!1}):bn.success(e,{duration:1900,sound:!1})},hr=hn(null),[mr,gr]=gn(0),[yr,kr]=gn(0),Sr=_(),vr=hn(null),wr=e=>Math.max(0,e.clientHeight-(vr.current?.offsetHeight??0));yn(()=>{const e=hr.current;if(!e)return;const n=()=>{gr(e.clientWidth),kr(wr(e))};n();const t=new ResizeObserver(n);return t.observe(e),vr.current&&t.observe(vr.current),()=>t.disconnect()},[]),Sn(()=>{hr.current&&(gr(hr.current.clientWidth),kr(wr(hr.current)))},[or,Mt,jt]);const xr=Ht===Ft?mr>0?mr:Lt[Ft]:Lt[Ht],br=mr>0?Math.min(mr/xr,"shrink"===Vt?1:2):1,zr=xr*br,Br=mr>0&&zr>mr+1,Cr={width:zr,height:yr||"100%",flex:"none",position:"relative"},Or={width:xr,height:yr?yr/br:"100%",maxHeight:"none",transform:1!==br?`scale(${br})`:void 0,transformOrigin:"top left"},Nr=()=>nt({type:"setUi",ui:{leftSideBarVisible:!Mt}}),Ir=()=>nt({type:"setUi",ui:{rightSideBarVisible:!jt}}),Pr=e=>{ro&&(io(!1),ao(null),lo.current=!1,Mt&&Qt===e)||Gt&&(so.current=!1,Yt(),Mt&&Qt===e)||(Mt&&Qt===e?Nr():(_t(e),Mt||nt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Tr=()=>{C($e,{accept:"image/*",title:zt.mediaLibrary})},$r=()=>{go(U),$t.select(null),u()},Ar=()=>{go(ft??U),jt||nt({type:"setUi",ui:{rightSideBarVisible:!0}})},Mr=et.data.content??[],jr=()=>{const e=Mr.findIndex(ht),n=Mr.findIndex(mt);return{floor:e>=0?e+1:0,cap:n>=0?n:Mr.length}},Rr=it,Lr=jo.stripCopy,Er=e=>i(e,Lr),Fr=x(),Vr=rn({data:et.data,config:Rr,readOnly:Boolean(Jn),clipboard:Fr,strip:Lr?e=>Lr(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==cn||e.slot!==an)return{min:0,max:n-1};const{floor:t,cap:o}=jr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&go(U);const t=void 0===n||"node"===n?.kind?n:null;$t.commitDocument(e,t)}}),Hr=e=>Do(e,"block",it.components[e]?.label??e),Wr=kn(e=>it.components[e]?.defaultProps??{},[it]),Dr=e=>Do(e,"section",Hr(e)),Ur=e=>l({type:e.type,props:e.props??{}},Dr(e.type),Yo),{nodeAddresses:Gr,zoneItems:Yr}=mn(()=>{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>=de)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of ce(it,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(Mr,le,0),{nodeAddresses:e,zoneItems:n}},[Mr,it]),Jr=kn(e=>Yr.get(e)??[],[Yr]),Xr=e=>{const n=Gr.get(e);return n?Jr(n.zone)[n.index]:void 0},Kr=e=>ie(jo,it,e),Qr=e=>{if(!jo.slotsOf||e===le)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Xr(e.slice(0,n));if(!t)return null;const o=Kr(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}},_r=(()=>{if(!q(mo))return null;const e=`${mo.nodeId}:${mo.slot}`;return Qr(e)?.slot.panel===mo.kind?e:null})(),qr=hn(null);yn(()=>{const e=qr.current;if(qr.current=null,!_r||!q(mo))return;const n=mo.nodeId;Co(n,{scroll:e!==_r}),tr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[mo]);const Zr=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Gr.get(e);n&&(n.zone===le?Si(n.index):Ki(n.zone,n.index,e,Xr(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&_r!==i&&(qr.current=i),Po(null,r),jt||nt({type:"setUi",ui:{rightSideBarVisible:!0}}),ki(o)},ei=(e,n,t)=>{const o=`${e}:${n}`;if(tr(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;_r!==o&&(qr.current=o);Po(null,{kind:t,nodeId:e,slot:n})},ni=(e,n,t)=>{if(Jn||!jo.moveSlot)return;const o=Xr(e),r=o?Kr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Rn,index:n},s=_e(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=jo.moveSlot(e,n,s);"string"==typeof d&&ei(e,d,i.panel)},ti=Go(),oi=mn(()=>{const e=/* @__PURE__ */new Map;for(const n of ti??[])e.set(n.slug,n.name);return e},[ti]),ri=e=>s(e,Hr,Wo.plainText,e=>oi.get(e),Wo.rowName),ii=(e,n)=>{const t=it.components[e.type]?.fields,o=n===le||fl(n)?"section":"block",r=n===le&&(ht(e)||mt(e)||at(e.type)),i="block"===o?d(t):r?null:c(t);return Wo.renamePropOf?Wo.renamePropOf(e,o,i):i},li=(e,n,t,o)=>{if(!(!Jn&&Qo?.zone===e&&Qo.index===n))return;const r=(t,o)=>{_o(null),o&&((e,n,t)=>{const o=Jr(e)[n];if(!o)return;const r=ii(o,e);r&&$t.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
13
|
+
return Pn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":kt.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)},si=n(Z(),bt),di=si.scope({target:Ue,siteId:Hn,docId:Ge}),ci=it,ai=(e,n)=>n===le?Dr(e):Hr(e),pi=(e,n,t)=>{const o=si.plan(di,t,ai(t.type,e),ci);o&&(o.changed&&$t.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),fr(o.message))},ui=b({nodesIn:Jr,nodeAt:(e,n)=>Jr(e)[n]??null,labelOf:(e,n)=>n===le?Dr(e):Hr(e),renamePropOf:ii,beginRename:(e,n)=>_o({zone:e,index:n}),history:{hasPast:tt.hasPast,hasFuture:tt.hasFuture,back:()=>tt.back(),forward:()=>tt.forward()},openAddSection:()=>{$t.select(null),Bi(null)},openPageSettings:()=>{$t.select(null),go(U)},pageSettingsLabel:kt.pageSettings,words:{menu:xt,styleClipboard:bt,screen:kt.menu},readOnly:Boolean(Jn),collapseAll:()=>tr(new Set(Jr(le).map(e=>String(e.props.id)))),onPasteRefused:e=>fr(e?kt.pasteRefused({name:e.label}):kt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ml(e,n),menuRows:$o.menuRows,isLocked:e=>Ro(e.type),duplicateBlocked:e=>Lo(et.data,e),permits:e=>se(it,e.type),canAddTo:Vo,nodeOps:Vr,isPinned:(e,n)=>n===le&&(ht(e)||mt(e)),sectionBand:jr,openAddInside:(e,n)=>{e===le?Si(n):$t.select({zone:e,index:n}),Bi(null)},locate:e=>Gr.get(e)??null,rowNameOf:(e,n)=>n===le?Ur(e):ri(e),selectAt:(e,n,t,o)=>{e===le?Si(n):Ki(e,n,t,o??"")},slotRung:e=>{const n=Qr(e);return n?.slot.panel?{label:n.slot.label,select:()=>Zr(n.node,n.slot,!1)}:null},style:{held:()=>O(di),canCopy:e=>si.rows(ci,e).some(e=>!1!==e.counted),copy:(e,n)=>si.copy(di,e,ai(e.type,n),ci),paste:(e,n,t)=>pi(e,n,t)},keys:Qn?{target:oo,selected:()=>{const e=et.ui.itemSelector;return e?{zone:e.zone??le,index:e.index}:null},held:()=>Fr.get(),readOnly:Boolean(Jn),onDone:({done:e,name:n})=>{"copied"===e&&fr(kt.copied({name:n}))}}:void 0},to),fi=hn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});yn(()=>{fi.current={copy:(e,n)=>si.copy(di,e,ai(e.type,n),ci),paste:pi,at:()=>{const e=et.ui.itemSelector;if(!e)return null;const n=e.zone??le,t=Jr(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Jn)}});const hi=kn(e=>{const n=N(e);if(!n)return;const t=fi.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))},[]);yn(()=>{if(!oo)return;const e=e=>hi(e);return oo.addEventListener("keydown",e),()=>oo.removeEventListener("keydown",e)},[hi,oo]),en(to,"keydown",hi);const mi=Mr.map(e=>e.props.id).join("|");yn(()=>{const e=to?.document??null,n=to?.window??null;let t=0;const o=[],r=()=>{if(!e)return void ho(e=>e.length?[]:e);const n=Mr.findIndex(mt),t=n>=0?n:Mr.length,o=n=>{const t=Mr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Ze)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=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=jn(l&&s?(s.bottom+l.top)/2:l?l.top:s.bottom,Math.max(-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}ho(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()}},[to,mi,Ht,br,Mt,jt,ot?.props.id]);const gi=to?.document??null,yi=to?.window??null;yn(()=>{const e=eo.current;if(!e||!gi||!yi)return;const n=[],t=()=>{const n=gi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&yi.scrollTo({left:yi.scrollX,top:yi.scrollY+t,behavior:"instant"}),!0};return eo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[gi,yi]);const ki=e=>{$o.holdCanvasOn?$o.holdCanvasOn(e):a(e)},Si=e=>{go(U),$t.select({index:e}),$o.sectionPressed?.(Mr[e]);const n=Mr[e]?.props?.id;n&&ki(n)},vi=e=>{const{floor:n,cap:t}=jr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=ot&&mo.kind!==ft?.kind?Mr.findIndex(e=>e.props.id===ot.props.id):-1;return o(r>=0?r+1:t)},wi=(e,n)=>{const{floor:t,cap:o}=jr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:($t.reorderComponent(le,e,i),$t.select({index:i}),{moved:!0,dest:i})},xi=(e,n,t,o)=>{go(U),$t.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),fr(kt.sectionAdded({name:t}))},bi=(e,n)=>{const t=vi(n),o=Fo(e,{nodeDefaults:Wr,newNodeId:fe,sectionLabel:Dr,blockIsOffered:Ho}),r=o?$t.insertNode(le,t,o):$t.insertSection(e,t);return xi(t,r,Dr(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of ce(it,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Vo(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:c,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},zi=(e,n,t)=>{const o=vi(t),r=$t.insertNode(le,o,n);return xi(o,r,e),o},Bi=e=>Ci(le,e),Ci=(e,n)=>{pr.current=document.activeElement??null,Gt&&(lo.current=so.current,so.current=!1,Yt()),ao(null===n?null:{zone:e,index:n}),io(!0),Mt||(lo.current=!0,nt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Oi=()=>{io(!1),ao(null),lo.current&&nt({type:"setUi",ui:{leftSideBarVisible:!1}}),lo.current=!1},Ni=(e,n,t)=>{if("section"===e.kind)$t.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;$t.insertNode(n,t,Er(e.template.node))}go(U),$t.select({index:t,zone:n})},Ii=(e,n)=>Wo.rowName?n?ht(e)?Wo.rowName(e,"section",kt.header):mt(e)?Wo.rowName(e,"section",kt.footer):at(e.type)?Wo.rowName(e,"section",Hr(e.type)):Ur(e):ri(e):n?Dr(e.type):Hr(e.type),Pi=e=>n=>{e()},Ti=()=>$o.editPinnedSource?.(),$i=(e,n,t)=>{if(Jn)return null;const o=Jr(e)[n];return o&&!se(it,o.type).delete?null:/* @__PURE__ */Pn(Be,{kind:"delete",label:kt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Jr(e)[n]?.props?.id;null!=t&&Vr.remove(String(t))})(e,n),children:/* @__PURE__ */Pn(Cn,{size:15})})},Ai=e=>Wo.rowPreview?.(e)||void 0,Mi=e=>Wo.rowMarks?.(e)??void 0,ji=(e,n,t)=>Wo.rowActions?.(e,n,t)??null,Ri=(e,n,t,o)=>{if(Jn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
14
|
+
return Pn(Be,{kind:"eye",label:r?kt.showNamed({name:o}):kt.hideNamed({name:o}),onClick:()=>Ei(e,n,t),children:/* @__PURE__ */Pn(r?On:Nn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},Li=e=>{const n=Dr(Mr[e]?.type??""),t=n?kt.addSectionBefore({name:n}):kt.addSectionHere;return Ll(le,e,()=>Bi(e),t)},Ei=(e,n,t)=>{$t.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Fi=e=>ae(it,e),Vi=e=>ce(it,e),Hi=e=>jo.slotsOf?Kr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:pe(e,n.slot)})):[{slot:null,rung:null,kids:Vi(e)}],Wi=e=>jo.slotsOf?Hi(e).flatMap(e=>e.kids):Vi(e),Di=e=>Boolean(jo.slotsOf)&&Kr(e).some(e=>e.rung),Ui=(e,n,t)=>null===t?void 0===n?Vo(e):Vo(e,n):Vo(e,n,t),Gi=(e,n,t)=>{const o=ue(it,e.type,n)&&(t||Wi(e).length>0||Di(e));return{collapsible:o,folded:o&&dr(String(e.props.id))}},Yi=(e,n,t)=>Hi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Gi(e,r,t(e.type)).collapsible?[String(e.props.id),...Yi(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ji=e=>Wi(e).length>0||Di(e)||Boolean(Vo(e.type)),Xi=e=>Boolean(Vo(e)),Ki=(e,n,t,o)=>{if(go(U),Vo(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),$t.select({index:n,zone:e}),a(t)}else $t.select({index:n,zone:e}),ki(t)},Qi=(e,n,t,o,r)=>{const i=`${e}:${n}`;$t.insertComponent(i,t,o),Vo(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),$t.select({index:o,zone:i})}):$t.select({index:o,zone:i})},_i=(e,n,t)=>{$t.insertComponent(e,n,t),go(U),$t.select({index:t,zone:e})},qi=hn(/* @__PURE__ */new Set);yn(()=>{Mr.forEach(e=>{const n=Vo(e.type)?.spec;if(!n)return;const t=e.props.id;if(qi.current.has(t))return;qi.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(Wr)).forEach((e,t)=>It.seedChild(o,t,n.childType,e))})},[Mr,It,Wr]);const Zi=hn(/* @__PURE__ */new Set);yn(()=>{Mr.forEach((n,t)=>{const o=n.props.id;if(Zi.current.has(o))return;const r=e(n,Fi(n.type));Zi.current.add(o),r&&It.replaceComponent(le,t,{...n,props:r})})},[Mr,It]),ee(It,it);const el=Mr.findIndex(mt),nl=el>=0?Mr[el]:null,tl=gt?Mr.findIndex(ht):-1,ol=tl>=0?Mr[tl]:null,rl=Mr.find(e=>e.type===dt)??null,il=Mr.find(e=>e.type===ct)??null,ll=el>=0?el:Mr.length,sl=[];Mr.forEach(e=>{mt(e)||(Ji(e)&&sl.push(String(e.props.id)),sl.push(...Yi(e,1,Xi)))}),nl&&(sl.push(String(nl.props.id)),sl.push(...Yi(nl,1,Xi)));const dl=sl.length>0&&sl.every(e=>nr.has(e)),cl=e=>{const n=Wo.blockRowName(e,Hr);return Wo.rowName?Wo.rowName(e,"block",n):n},al=(e,n,t,o)=>{const r=Jr(e)[t];if(!r)return;const i={...pn(e),index:t},l={...pn(n),index:Math.min(Math.max(o,0),Jr(n).length)},s=_e(i,l);if(e!==n||s!==t)try{Vr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof un))throw e}},pl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Vi(e))n.add(r),t(o)};for(const t of Fi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},ul=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Gr.get(n);if(!e)return null;if(e.zone===le)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},fl=e=>{const n=e.slice(0,e.indexOf(":")),t=Mr.find(e=>at(e.type)&&String(e.props.id)===n);return t&&pt(n)===e?t:null},hl=(e,n,t)=>{if(e.rung){const t=Xr(e.rung.nodeId),o=t?Kr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Rn&&n.index>=0&&n.index<=o}if(n.slot===Rn)return!1;if(e.add)return yl(e.add,n);const o=dn(n);if(at(e.type))return!1;const r=fl(o),i=fl(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Jr(o).length);if(e.zone===le||o===le){if(e.zone!==o)return!1;const{floor:t,cap:r}=jr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Jr(o).length)return!1;if(e.zone===o)return!0;const l=nl&&!lt.lastIsOpen?String(nl.props.id):null;return(!l||ul(e.zone)!==l&&ul(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Jr(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Gr.get(i),s=l?Jr(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&pl(r).has(n))return!1;const d=Vo(s.type,Eo(et?.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?.(Jr(n),r))})(e.zone,o,e.index,t)},ml=(e,n)=>{const t=dn(e.from);if(t===dn(n))return!0;const o=e.node;return hl({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},gl=e=>{const n=e.slice(0,e.indexOf(":")),t=Gr.get(n),o=t?Jr(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Vo(o.type,Eo(et?.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=r.choices??(r.spec?[{type:r.spec.childType,label:Hr(r.spec.childType)}]:[]),l=Qr(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Ii(o,t.zone===le)}},yl=(e,n)=>{const t=dn(n);if("block"!==e.kind){if(fl(t))return n.index>=0&&n.index<=Jr(t).length;if(t!==le)return!1;const{floor:e,cap:o}=jr();return n.index>=e&&n.index<=o}if(t===le)return!1;const o=gl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Jr(t))},kl=(e,n)=>{e.rung?ni(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&fl(dn(n)))return void Ni(e,dn(n),n.index);if("section"===e.kind)return void bi(e.type,n.index);if("template"===e.kind)return void zi(e.template.name,Er(e.template.node),n.index);const t=dn(n),o=gl(t);o&&(o.target.spec?Qi(o.parentId,o.target.slot,e.type,n.index,o.parent.type):_i(t,e.type,n.index))})(e.add,n):e.zone===le?wi(e.index,n.index):al(e.zone,dn(n),e.index,n.index)},[Sl]=gn(()=>Ke()),vl=Qe({keyOf:e=>e.id,readOnly:Boolean(Jn),session:Sl,canDrop:hl,onDrop:kl,onStep:(e,n)=>{e.rung?ni(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===le?((e,n)=>{const t=Dr(Mr[e]?.type??""),o=wi(e,n<0?e-1:e+2);if(!o.moved)return void fr(n<0?kt.sectionFirst({name:t}):kt.sectionLast({name:t}));const{floor:r,cap:i}=jr();fr(kt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):al(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),wl=kn(e=>{const{floor:n,cap:t}=jr(),o=[];for(const r of e.nodes){const e=dn(r.place),i=Jr(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(ht(i)||mt(i)||Ro(i.type))continue;if(at(i.type))continue;const l=Boolean(fl(e)),s=e===le||l;e===le&&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?Dr(i.type):ri(i),from:r.place})}return{sources:o,zones:e.zones.filter(e=>e.children.length>0||Boolean(gl(dn(e.list))?.choices.length)||Boolean(fl(dn(e.list))))}},[et.data]),xl=null==ot?.props.id?null:String(ot.props.id),bl=kn(e=>{const n=it,t=e=>!e.item.rung&&null!==fn(et.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(xl);return i||(r(ln(et.data,n,o.item.id,xl))??o)},[et.data,it,xl]),zl=e=>{go(U),$t.select(e.zone===le?{index:e.index}:{index:e.index,zone:e.zone})},Bl=ne(),Cl=()=>({data:et.data,device:Ht,ops:$t,inspector:To}),Ol=Bl?.model,Nl=mn(()=>Ol?e=>Ol(e,wl(e),Cl()):wl,[Ol,wl,Ht]),Il=Bl?.measure,Pl=Il?(e,n)=>Il(e,n,Cl()):void 0,Tl=Bl?.canDrop,$l=Tl?(e,n)=>Tl(e,n,hl,Cl()):hl,Al=Bl?.drop,Ml=Al?(e,n)=>Al(e,n,kl,Cl()):kl,jl=Bl?.pick,Rl=jl?e=>jl(e,zl,Cl()):zl,Ll=(e,n,t,o)=>/* @__PURE__ */Pn(Ce,{...Jn?{}:vl.seam({place:{...pn(e),index:n}}),onAdd:Jn?void 0:t,label:o},`seam:${e}:${n}`),El={rowClick:Pi,isCollapsed:dr,toggleCollapse:cr},Fl=e=>{const n=String(e.props.id),t=Mr.findIndex(e=>String(e.props.id)===n),o=pt(n),r=Jr(o),i=dr(n),l=Hr(e.type),s=Wo.rowName?Wo.rowName(e,"section",l):l,d=e=>Ll(o,e,()=>Ci(o,e),kt.addSectionHere);/* @__PURE__ */
|
|
15
|
+
return Tn($n,{children:[
|
|
16
|
+
/* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:e.type,size:13}),name:s,preview:Ai(e),marks:Mi(e),onSelect:()=>Si(t),nameSlot:li(le,t,n,s),selected:xo===n,actions:ji(e,le,t)??void 0,rowProps:{"data-node-id":n,onClick:Pi(()=>Si(t))},fold:{open:!i,label:"section",onToggle:()=>cr(n)}}),!i&&/* @__PURE__ */Tn(xe,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ur(n),l=Ji(n),s=l&&dr(r),c=()=>Ki(o,t,r,e.type),{rowProps:a,...p}=vl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...pn(o),index:t}},{"data-node-id":r,onClick:Pi(c)});/* @__PURE__ */
|
|
17
|
+
return Tn(vn,{children:[d(t),
|
|
18
|
+
/* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:n.type,size:13}),name:i,preview:Ai(n),marks:Mi(n),onSelect:c,nameSlot:li(o,t,r,i),selected:xo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn($n,{children:[$i(o,t,i),ji(n,o,t),Ri(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Pn(xe,{children:Wl(n,2)})]},r)}),d(r.length)]})]})},Vl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=vl.dragging,d=!dr(l)&&s?.rung?.nodeId!==i,c={...pn(l),index:0},a=s&&!s.rung&&hl(s,c)?c:void 0,p=()=>Zr(e,n,!0),{rowProps:u,...f}=vl.row({item:{id:`rung:${l}`,zone:`${i}:${Rn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Rn,index:t},into:a,canDrag:Boolean(jo.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Pi(p)}),h=Jn?null:jo.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
19
|
+
return Tn(vn,{children:[n.heading,
|
|
20
|
+
/* @__PURE__ */Pn(we,{words:St,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:_r===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>cr(l)},actions:h&&h.length>0?/* @__PURE__ */Pn($n,{children:h.map((t,o)=>/* @__PURE__ */Pn(Be,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Jn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ei(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__ */Pn(Cn,{size:15}):/* @__PURE__ */Pn(In,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Pn(xe,{children:r})]},l)},Hl=(e,n)=>{const t=Hi(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
21
|
+
return Pn($n,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Ui(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=null!==c&&Boolean(gl(c)?.choices.length),p=(e,n)=>a?Ll(e,n,()=>Ci(e,n),kt.addBlockHere):Ll(e,n),u=/* @__PURE__ */Tn($n,{children:[i.map(({child:n,zone:t,index:o})=>{const r=xo===String(n.props.id),{collapsible:i,folded:s}=Gi(n,l,Xi(n.type)),d=String(n.props.id),c=cl(n),a=()=>Ki(t,o,d,e.type),{rowProps:u,...f}=vl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...pn(t),index:o}},{"data-node-id":d,onClick:Pi(a)});/* @__PURE__ */
|
|
22
|
+
return Tn(vn,{children:[0===o&&p(t,0),
|
|
23
|
+
/* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:n.type,size:13}),name:c,preview:Ai(n),marks:Mi(n),onSelect:a,nameSlot:li(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>cr(d)}:void 0,actions:/* @__PURE__ */Tn($n,{children:[$i(t,o,c),ji(n,t,o),Ri(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Pn(xe,{children:Hl(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==c?null:p(c,0)]});return t.rung?Vl(e,t.rung,r++,o,u):/* @__PURE__ */Pn(vn,{children:u},t.slot??"")})})},Wl=(e,n)=>{const t=Eo(et?.data,e.type,String(e.props.id)),o=Hi(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
24
|
+
return Pn($n,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Ui(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(n,t)=>{const o=n===f&&c&&!c.addBlocked?.(a)?()=>Qi(e.props.id,c.slot,c.childType,t,e.type):n===h?()=>Ci(n,t):void 0;return Ll(n,t,o,n===f&&c?c.addLabel:kt.addBlockHere)},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),k=/* @__PURE__ */Tn($n,{children:[l.map(({child:n,zone:t,index:o})=>{const r=xo===String(n.props.id),i=ri(n),l=String(n.props.id),{collapsible:d,folded:c}=Gi(n,s,Xi(n.type)),a=Fi(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...pn(p),index:Jr(p).length}:void 0,f=vl.dragging,h=u&&f&&hl(f,u)?u:void 0,g=()=>Ki(t,o,l,e.type),{rowProps:y,...k}=vl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...pn(t),index:o},into:h,canDrag:!Ro(n.type)},{"data-node-id":l,onClick:Pi(g)});/* @__PURE__ */
|
|
25
|
+
return Tn(vn,{children:[0===o&&m(t,0),
|
|
26
|
+
/* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:n.type,size:13}),name:i,preview:Ai(n),marks:Mi(n),onSelect:g,nameSlot:li(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>cr(l)}:void 0,actions:Ro(n.type)?ji(n,t,o)??void 0:/* @__PURE__ */Tn($n,{children:[$i(t,o,i),ji(n,t,o),Ri(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Pn(xe,{children:Wl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
27
|
+
/* @__PURE__ */Pn(I,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>Qi(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?Vl(e,o.rung,i++,r,k):/* @__PURE__ */Pn(vn,{children:k},o.slot??"")})})},Dl=(()=>{if(!ot||!yo)return null;const e=String(ot.type),n=String(ot.props.id),t=Vo(e,Eo(et?.data,e,n));if(!t||"footer"===t.source)return null;const o=Mr.some(e=>String(e.props?.id)===n),r=Array.isArray(ot.props[t.slot])?ot.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Hr(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:Ii(ot,o),choices:i,onPick:o=>{t.spec?Qi(n,t.slot,o,r.length,e):_i(`${n}:${t.slot}`,o,r.length)}}})(),Ul=vo&&vo.zone!==le&&!fl(vo.zone)?vo.zone:null,Gl=!0===po.blocksFirst,Yl=Ul?gl(Ul):Gl&&vo?null:Dl,Jl=Boolean(co&&Ul)||Gl&&Boolean(Yl&&Yl.choices.length>0),Xl=ro||null!==Gt,Kl=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Mt&&!Xl&&Mo===e.id,onSelect:()=>Pr(e.id)}:e,Ql=[{id:"add",label:kt.add.title,icon:/* @__PURE__ */Pn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:ro,onSelect:()=>ro?Oi():Bi(null)},...($o.railLead??[]).map(Kl),{id:"sections",label:kt.layers,icon:/* @__PURE__ */Pn(Ie,{}),active:Mt&&!Xl&&"sections"===Mo,onSelect:()=>Pr("sections")},...($o.railTrail??[]).map(Kl)];Ut?Ql.push({id:"media",label:kt.railMedia,icon:/* @__PURE__ */Pn(Pe,{}),active:Mt&&!ro&&(null!==Gt||"media"===Mo),onSelect:()=>Pr("media")}):_n&&Ql.push({id:"media",label:kt.railMedia,icon:/* @__PURE__ */Pn(Pe,{}),onSelect:Tr});const _l=[...$o.railLead??[],...$o.railTrail??[]].find(e=>"panel"in e&&e.id===Mo),ql=Boolean(yt?.foldable)&&!Ao,Zl=yt?.label??(qn?kt.pageSections:kt.templateSections),es=ql&&dr(Ln),ns=/* @__PURE__ */Tn($n,{children:[Mr.map((e,n)=>{if(ht(e)||mt(e)||at(e.type))return null;const t=xo===String(e.props.id),o=Boolean(e.props._hidden);Vi(e);const r=String(e.props.id),i=$o.hasOwnRows?.(e)??!1,l=Ji(e)||i,s=l&&dr(r),{rowProps:d,...c}=vl.row({item:{id:r,zone:le,index:n,type:e.type},place:{...pn(le),index:n}},{"data-node-id":r,onClick:Pi(()=>Si(n))});/* @__PURE__ */
|
|
28
|
+
return Tn(vn,{children:[n>0&&Li(n),
|
|
29
|
+
/* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:e.type,size:13}),name:Ur(e),preview:Ai(e),marks:Mi(e),onSelect:()=>Si(n),nameSlot:li(le,n,r,Ur(e)),selected:t,hidden:o,...c,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn($n,{children:[$i(le,n,Ur(e)),ji(e,le,n),Ri(le,n,e,Ur(e))]}),rowProps:d}),Ji(e)&&!s&&/* @__PURE__ */Tn(xe,{children:[Wl(e,1),$o.partRows?.(e,El)]}),i&&!s&&/* @__PURE__ */Pn(xe,{children:$o.ownRows?.(e,n,El)})]},String(e.props.id??n))}),!Ao&&ll>0&&Li(ll),yt?.addAtEnd&&!Ao&&!Jn&&/* @__PURE__ */Pn(I,{small:!0,label:kt.addSection,blocked:null,onAdd:()=>Bi(ll)})]}),ts=(e,n,t)=>{const o=String(e.props.id),r=Wi(e).length>0||Di(e)||Boolean(Vo(e.type)),i=r&&dr(o),l="header"===t?kt.header:kt.footer,s=Wo.rowName?Wo.rowName(e,"section",l):l;/* @__PURE__ */
|
|
30
|
+
return Tn($n,{children:[
|
|
31
|
+
/* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:t,size:13}),name:s,preview:Ai(e),marks:Mi(e),onSelect:()=>Si(n),nameSlot:li(le,n,o,s),selected:xo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>cr(o)}:void 0,actions:ji(e,le,n)??void 0,rowProps:{"data-node-id":o,onClick:Pi(()=>Si(n))}}),r&&!i&&/* @__PURE__ */Pn(xe,{children:Hl(e,1)})]})};return($o.wrap??(e=>e))(
|
|
32
|
+
/* @__PURE__ */Pn(te,{target:to,children:/* @__PURE__ */Tn("div",{ref:no,className:"sf-editor es-editor",style:De(or),onContextMenu:ui.onEditorContextMenu,...m($e),children:[
|
|
33
|
+
/* @__PURE__ */Tn(Ae,{children:[
|
|
34
|
+
/* @__PURE__ */Pn(Me,{items:Ql,ariaLabel:kt.bar.views}),
|
|
35
|
+
/* @__PURE__ */Tn(je,{children:[
|
|
36
|
+
/* @__PURE__ */Pn(Re,{label:kt.bar.undo,disabled:Boolean(Jn)||!tt.hasPast,onClick:()=>tt.back(),children:/* @__PURE__ */Pn(zn,{})}),
|
|
37
|
+
/* @__PURE__ */Pn(Re,{label:kt.bar.redo,disabled:Boolean(Jn)||!tt.hasFuture,onClick:()=>tt.forward(),children:/* @__PURE__ */Pn(Bn,{})}),
|
|
38
|
+
/* @__PURE__ */Pn(Le,{}),
|
|
39
|
+
/* @__PURE__ */Pn(Ee,{devices:Rt,value:Ht,onChange:Wt})]}),
|
|
40
|
+
/* @__PURE__ */Tn(je,{kind:"right",style:{minWidth:300},children:[
|
|
41
|
+
/* @__PURE__ */Pn(An,{saveState:Dn,notSaving:Boolean(Jn)||null!=Un,readOnlyReason:Xn,toggle:Kn,onToggle:Yn,onRetry:Gn,words:kt.bar,saveWords:wt}),$o.barLead?.(),
|
|
42
|
+
/* @__PURE__ */Pn(wn,{content:kt.bar.refreshTip,side:"bottom",children:/* @__PURE__ */Pn(xn,{variant:"secondary",onClick:()=>{eo.current=(()=>{const e=to?.document;if(!e)return null;const n=Mr.findIndex(mt),t=n>=0?n:Mr.length;let o=null;for(let n=0;n<t;n++){const t=Mr[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=ot?.props?.id??Mr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Zt(e=>e+1)},children:kt.bar.refresh})}),$o.barTrail?.(),$o.barMain?$o.barMain():/* @__PURE__ */Pn(xn,{variant:"primary",disabled:null!==Xn,onClick:()=>{Wn(et.data)},children:kt.done})]})]}),
|
|
43
|
+
/* @__PURE__ */Pn(z,{}),
|
|
44
|
+
/* @__PURE__ */Tn("div",{className:"sf-body",children:[Mt?/* @__PURE__ */Tn($n,{children:[
|
|
45
|
+
/* @__PURE__ */Pn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":kt.leftPanel,children:ro?/* @__PURE__ */Pn(P,{blocks:Yl,blocksOnly:Jl,at:co?{label:(e=>{const n=fl(e.zone);if(n)return kt.add.addingTo({name:Wo.rowName?Ii(n,!0):Hr(n.type)});if(e.zone===le){const n=Mr[e.index];return n&&!mt(n)?kt.add.addingBefore({name:Ii(n,!0)}):kt.add.addingAtEnd}const t=gl(e.zone);return t?kt.add.addingTo({name:t.parentName}):kt.add.addingHere})(co),onClear:()=>ao(null)}:void 0,onAdd:e=>{const n=vo,t=(e,n)=>{co&&ao({zone:e,index:n})};if(n&&"block"!==e.kind&&fl(n.zone))return Ni(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===wo)return void bi(e);const n=bi(e,wo);co&&uo(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===wo)return void zi(e,n);const t=zi(e,n,wo);co&&uo(t+1)})(e.template.name,Er(e.template.node));if(n&&n.zone!==le){const o=gl(n.zone);if(!o)return;return o.target.spec?Qi(o.parentId,o.target.slot,e.type,n.index,o.parent.type):_i(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Dl?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Sl,siteWide:$o.addPanelRow?.(Oi),onClose:Oi,onHide:Nr,readOnly:Boolean(Jn)}):Gt&&Dt?
|
|
46
|
+
/* @__PURE__ */Pn(A,{panel:Dt,pick:Gt,onHide:Nr}):_l?_l.panel({onHide:Nr,notify:fr}):"media"===Mo&&Dt?/* @__PURE__ */Pn(A,{panel:Dt,pick:null,onHide:Nr}):/* @__PURE__ */Tn($n,{children:[
|
|
47
|
+
/* @__PURE__ */Pn(T,{icon:/* @__PURE__ */Pn(Ie,{}),title:kt.layers,context:Bt,actions:
|
|
48
|
+
/* @__PURE__ */Pn(Fe,{label:dl?kt.expandAll:kt.collapseAll,title:0===sl.length?kt.nothingToFold:void 0,disabled:0===sl.length,onClick:()=>tr(e=>{const n=new Set(sl);return dl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...sl])}),children:/* @__PURE__ */Pn(Mn,{expand:dl})}),onHide:Nr}),
|
|
49
|
+
/* @__PURE__ */Tn(be,{className:"sf-tree sf-scroll",words:St,children:[
|
|
50
|
+
/* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:"page",size:13}),name:kt.pageSettings,onSelect:$r,selected:!ot&&yo,rowProps:{onClick:Pi($r)}}),rl&&/* @__PURE__ */Tn($n,{children:[
|
|
51
|
+
/* @__PURE__ */Pn(ze,{children:kt.header}),Fl(rl)]}),!Ao&&Zn&&/* @__PURE__ */Tn($n,{children:[
|
|
52
|
+
/* @__PURE__ */Pn(ze,{children:kt.header}),!gt&&/* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:"header",size:13}),name:kt.header,onSelect:Ar,selected:mo.kind===ft?.kind,rowProps:{onClick:Pi(Ar)}})]}),!Ao&&ol&&ts(ol,tl,"header"),!Ao&&!ql&&/* @__PURE__ */Pn(ze,{children:Zl}),ql?/* @__PURE__ */Tn($n,{children:[
|
|
53
|
+
/* @__PURE__ */Pn(we,{words:St,icon:null,name:Zl,fold:{open:!es,label:Zl,onToggle:()=>cr(Ln)}}),!es&&/* @__PURE__ */Pn(xe,{children:ns})]}):ns,Zn&&/* @__PURE__ */Pn(ze,{children:kt.footer}),nl&&ts(nl,el,"footer"),!Ao&&!nl&&Zn&&/* @__PURE__ */Pn(we,{words:St,icon:/* @__PURE__ */Pn(Uo,{type:"footer",size:13}),name:kt.footer,onSelect:Ti,rowProps:{onClick:Pi(Ti),title:kt.editFooter}}),il&&Fl(il),$o.treeFoot?.()]})]})}),
|
|
54
|
+
/* @__PURE__ */Pn(Ve,{side:"left",width:or.left,min:We,max:He,defaultWidth:k.left,label:kt.resizeLeftPanel,onResize:lr})]}):/* @__PURE__ */Pn($,{side:"left",onShow:Nr}),
|
|
55
|
+
/* @__PURE__ */Tn("div",{ref:hr,className:"sf-center sf-scroll","data-sf-canvas-head":Sr?"":void 0,style:{overflowX:Br?"auto":"hidden",overflowY:"hidden"},children:[Sr&&/* @__PURE__ */Pn("div",{ref:vr,className:"sf-canvas-head",children:/* @__PURE__ */Pn(Sr,{device:Ht})}),
|
|
56
|
+
/* @__PURE__ */Pn("div",{className:"sf-frame-scaler",style:Cr,children:/* @__PURE__ */Pn("div",{className:"sf-frame "+(Ht===Ft?"":`sf-frame--${Ht}`),style:Or,children:/* @__PURE__ */Tn("div",{className:"sf-preview-host",children:[
|
|
57
|
+
/* @__PURE__ */Pn(Ct,{},qt),
|
|
58
|
+
/* @__PURE__ */Pn(Je,{canvas:to,session:Sl,model:Nl,measure:Pl,canDrop:$l,onDrop:Ml,choose:bl,onPick:Rl,onZoneAdd:e=>{const n=dn(e),t=Qr(n);t&&Zr(t.node,t.slot,!1),Ci(n,0)},zoneAddLabel:kt.canvasAddBlock,words:vt.canvas,readOnly:Boolean(Jn),revision:et.data}),fo.length>0&&/* @__PURE__ */Pn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:fo.map(e=>/* @__PURE__ */Tn("button",{type:"button",tabIndex:-1,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},onClick:()=>Bi(e.index),children:[
|
|
59
|
+
/* @__PURE__ */Pn("span",{className:"sf-preview-gap-line"}),
|
|
60
|
+
/* @__PURE__ */Tn("span",{className:"sf-preview-gap-pill",children:[
|
|
61
|
+
/* @__PURE__ */Pn("span",{className:"sf-preview-gap-plus",children:"+"}),
|
|
62
|
+
/* @__PURE__ */Pn("span",{className:"sf-preview-gap-label",children:kt.addSection})]})]},e.index))})]})})})]}),jt?/* @__PURE__ */Tn($n,{children:[
|
|
63
|
+
/* @__PURE__ */Pn(g,{value:{selectChild:Ki,addChild:Qi,childRowName:ri,blockRowName:cl},children:/* @__PURE__ */Pn(Ot,{mode:mo,onOpenWebsiteSettings:$o.openSettings??(()=>{}),onOpenSiteStyles:$o.openStyles,onSelectNode:Xo,onNotify:fr,onHidePanel:Ir,nodeActions:ot?se(it,ot.type):En})}),
|
|
64
|
+
/* @__PURE__ */Pn(Ve,{side:"right",width:or.right,min:We,max:He,defaultWidth:k.right,label:kt.resizeSettingsPanel,onResize:sr})]}):
|
|
65
|
+
/* @__PURE__ */Pn($,{side:"right",onShow:Ir})]}),ui.menu]})}))}export{Fn as ScreenChrome};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_PANEL_W as s,clampPanelWidth as e}from"./chunk-
|
|
1
|
+
import{DEFAULT_PANEL_W as s,clampPanelWidth as e}from"./chunk-UB4TLWVJ.js";var a="sf-editor-panel-widths",l="sf-editor-collapsed-sections";function t(s){return s?{panelWidths:`${s}-panel-widths`,collapsed:`${s}-collapsed-sections`}:{panelWidths:a,collapsed:l}}var o={...s},d=s=>e(s);export{l as COLLAPSED_SECTIONS_KEY,o as DEFAULT_PANEL_W,a as PANEL_WIDTHS_KEY,d as clampPanelWidth,t as screenStorageKeys};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{FieldSelect as e}from"./chunk-OZ72A6MY.js";import{TreeSeam as n}from"./chunk-4JSBIW5H.js";import{SettingsField as t,SETTINGS_BUCKETS as l,SettingsGroup as r}from"./chunk-3ZJSLHHI.js";import{DEFAULT_TREE_WORDS as a}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as o}from"./chunk-KFV7N2DJ.js";import{EaselMenuItems as i}from"./chunk-EA2HTX37.js";import{FieldNumber as s}from"./chunk-66LWADFP.js";import{SettingsSegmented as c}from"./chunk-QLD57GBB.js";import{DEFAULT_FIELDS_WORDS as d}from"./chunk-FFYXVAAL.js";import{useTreeDrag as u,gapToMoveIndex as m}from"./chunk-67GNT6PF.js";import{withTip as p}from"./chunk-P2VEMZH5.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{Textarea as f,Input as b,SortableList as g,ListRow as v,ContextMenu as y,tabPanelId as k,Tabs as x,tabButtonId as w}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as N,useState as C,useLayoutEffect as O,useId as $}from"react";import{jsx as j,jsxs as D}from"react/jsx-runtime";import{ChevronIcon as I,LockIcon as S,MoveUpIcon as F,MoveDownIcon as P,DuplicateIcon as L,TrashIcon as M}from"efficient-shell/icons/efficient";function T({id:e,value:n,onChange:t,placeholder:l,multiline:r=!1,rows:a=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return r?/* @__PURE__ */j(f,{id:e,size:"sm",className:"es-fin",value:c,rows:a,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */j(b,{id:e,size:"sm",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function A(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function H(e,n,t){const l=e.slice(),[r]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,r),l}function E(e,n){return e.filter((e,t)=>t!==n)}function R(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var z='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',B={parentId:"list",slot:"items"};function Y({label:e,icon:t,noun:l,items:r,onChange:o,newItem:s,summary:c,itemName:f,thumb:b,min:k=0,max:x,readOnly:w=!1,open:$,onOpen:T,renderItem:Y,renderRow:J,canRemove:K,lockedReason:V,fixed:G=!1,removeOnRow:W=!0,canDuplicate:X,above:Z,head:q=!0}){const Q=h("fields",d).list,U=h("tree",a),_=l??Q.item,ee=!w&&!G&&("number"!=typeof x||r.length<x),ne=r.length<=k,te=e=>!!K&&!K(r[e],e),le=e=>!w&&!G&&W&&!ne&&!te(e),re=e=>ee&&(!X||X(r[e],e)),ae=(e,n)=>f?f(e,n):Q.itemName({noun:_,n:n+1}),oe=N([]),ie=N(null),[se,ce]=C(null),de=N(null),[ue,me]=C(null),[pe,he]=C("");O(()=>{const e=ie.current;if(!e)return;ie.current=null;const n=oe.current[e.index]?.querySelectorAll(z)[e.nth]??oe.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const fe=(e,n)=>{if(n<0||n>=r.length||n===e)return;const t=oe.current[e],l=t?.ownerDocument.activeElement;if(t&&l&&t.contains(l)){const e=[...t.querySelectorAll(z)].indexOf(l),r=l;ie.current={index:n,nth:e,start:"number"==typeof r.selectionStart?r.selectionStart:null,end:"number"==typeof r.selectionEnd?r.selectionEnd:null}}o(H(r,e,n));const a=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}($,e,n);a!==$&&T(a),he(Q.moved({n:n+1,total:r.length}))},be=e=>{ee&&(o(A(r,e,s())),J?(ie.current={index:e,nth:0,start:null,end:null},null!==$&&$>=e&&T($+1)):T(e))},ge=e=>{le(e)&&(o(E(r,e)),$===e?T(null):null!==$&&$>e&&T($-1))},ve=u({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===B.parentId&&n.slot===B.slot,onDrop:(e,n)=>{const t=m({...B,index:e},n);t!==e&&fe(e,t)},onStep:(e,n)=>fe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<r.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:Q.moveUp,icon:/* @__PURE__ */j(F,{size:14}),shortcut:"⌥↑",onClick:()=>fe(e,e-1)}),e<r.length-1&&n.push({label:Q.moveDown,icon:/* @__PURE__ */j(P,{size:14}),shortcut:"⌥↓",onClick:()=>fe(e,e+1)}),re(e)&&n.push({label:Q.duplicate,icon:/* @__PURE__ */j(L,{size:14}),onClick:()=>(e=>{re(e)&&(o(A(r,e+1,R(r[e]))),null!==$&&$>e&&T($+1))})(e)}),le(e)&&n.push({label:Q.delete,icon:/* @__PURE__ */j(M,{size:14}),danger:!0,onClick:()=>ge(e)}),n},ke=(e,n,t,l)=>{w||0===ye(e).length||me({index:e,x:n,y:t,owner:l})},xe=e=>n=>{const t=r.slice();t[e]=n,o(t)};/* @__PURE__ */
|
|
2
|
+
return D("div",{className:"es-list",children:[q?/* @__PURE__ */D("div",{className:"es-list-head",children:[
|
|
3
|
+
/* @__PURE__ */D("span",{className:"es-list-label",children:[t?/* @__PURE__ */j("span",{className:"es-field-icon","aria-hidden":"true",children:t}):null,e]}),
|
|
4
|
+
/* @__PURE__ */j("span",{className:"es-list-count",children:r.length})]}):null,Z?/* @__PURE__ */j("div",{className:"es-list-above",children:Z}):null,r.length?/* @__PURE__ */D(g,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[r.map((e,t)=>{const l=ve.row({item:t,place:{...B,index:t}}),r=l.draggable&&se!==t,a=!J&&$===t,o=!w&&!G&&W&&te(t),i=["es-list-row",J?"is-inline":"is-item",a?"is-open":"",r?"is-draggable":"",l.dragging?"is-dragging":"",l.drop?`is-drop-${l.drop}`:""].filter(Boolean).join(" ");return[t>0?/* @__PURE__ */j(n,{...ve.seam({place:{...B,index:t}}),onAdd:ee?()=>be(t):void 0,label:Q.addHere({noun:_})},`seam-${t}`):null,
|
|
5
|
+
/* @__PURE__ */j(v,{className:i,flat:!!J,active:a,draggable:l.draggable,dragHint:U.dragHint,dragging:l.dragging,drop:"before"===l.drop||"after"===l.drop?l.drop:void 0,onMove:l.draggable?e=>fe(t,"up"===e?t-1:t+1):void 0,rowRef:e=>{oe.current[t]=e},rowProps:{...l.rowProps,draggable:r||void 0,onPointerDown:e=>{const n=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),r=!!n&&n===n.ownerDocument.activeElement;e.currentTarget.draggable=l.draggable&&!r,de.current=n&&!r?n:null,ce(r?t:null)},onDragStart:e=>{const n=de.current;de.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),l.rowProps.onDragStart?.(e)},onContextMenu:e=>{w||(e.preventDefault(),e.stopPropagation(),ke(t,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const n=e.currentTarget.ownerDocument,l=e=>e.preventDefault();n.addEventListener("contextmenu",l,{capture:!0,once:!0}),n.defaultView?.setTimeout(()=>n.removeEventListener("contextmenu",l,{capture:!0}),500);const r=e.currentTarget.getBoundingClientRect();return void ke(t,r.left+24,r.bottom,e.currentTarget)}l.rowProps.onKeyDown?.(e)}},actions:w||G||!W?void 0:o?p(V?V(e,t):Q.locked,/* @__PURE__ */j("span",{className:"es-list-lock",role:"img","aria-label":V?V(e,t):Q.locked,children:/* @__PURE__ */j(S,{size:13})})):p(Q.deleteItem({noun:_}),/* @__PURE__ */j("button",{type:"button",className:"es-list-x","aria-label":Q.deleteItem({noun:_}),disabled:!le(t),onClick:()=>ge(t),children:"×"})),below:a?/* @__PURE__ */j("div",{className:"es-list-item",children:Y(e,t,xe(t))}):void 0,children:J?/* @__PURE__ */j("div",{className:"es-list-row-main",children:J(e,t,xe(t))}):/* @__PURE__ */D("button",{type:"button",className:"es-list-open","aria-expanded":a,onClick:()=>T(a?null:t),children:[b?/* @__PURE__ */j("span",{className:"es-list-thumb","aria-hidden":"true",children:b(e,t)}):null,
|
|
6
|
+
/* @__PURE__ */j("span",{className:"es-list-row-name",children:ae(e,t)}),/* @__PURE__ */j("span",c?{className:"es-list-row-summary",children:c(e,t)}:{className:"es-list-row-summary"}),
|
|
7
|
+
/* @__PURE__ */j(I,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},t)]}),
|
|
8
|
+
/* @__PURE__ */j(n,{...ve.seam({place:{...B,index:r.length}})})]}):null,w||G?null:/* @__PURE__ */j("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>be(r.length),children:Q.add({noun:_})}),
|
|
9
|
+
/* @__PURE__ */j("span",{className:"es-list-said","aria-live":"polite",children:pe}),ue&&ue.index<r.length?
|
|
10
|
+
/* @__PURE__ */j(y,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),children:/* @__PURE__ */j(i,{items:ye(ue.index),onClose:()=>me(null)})}):null]})}var J=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function K({field:e,name:n,id:t,value:l,onChange:a,readOnly:o,context:i,renderers:s}){const[c,d]=C(!0),u=l&&"object"==typeof l?l:{};/* @__PURE__ */
|
|
11
|
+
return j(r,{id:`${t}-group`,title:J(e,n),open:c,onToggle:d,children:Object.entries(e.objectFields).map(([e,l])=>/* @__PURE__ */j(G,{field:l,name:`${n}.${e}`,id:`${t}-${e}`,value:u[e],onChange:n=>a({...u,[e]:n}),readOnly:o,context:i,renderers:s},e))})}function V({field:e,name:n,id:t,value:l,onChange:r,readOnly:a,context:o,renderers:i,openItem:s,onOpenItem:c}){const[d,u]=C(null),m=c?s??null:d,p=c??u,h=Array.isArray(l)?l:[],f=e.getItemSummary;/* @__PURE__ */
|
|
12
|
+
return j(Y,{label:J(e,n),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:h,onChange:r,newItem:()=>R({...e.defaultItemProps??{}}),summary:f?(e,n)=>f(e,n):void 0,min:e.min,max:e.max,readOnly:a,open:m,onOpen:p,renderItem:(l,r,s)=>Object.entries(e.arrayFields).map(([e,c])=>/* @__PURE__ */j(G,{field:c,name:`${n}[${r}].${e}`,id:`${t}-${r}-${e}`,value:l?.[e],onChange:n=>s({...l,[e]:n}),readOnly:a,context:o,renderers:i},e))})}function G(n){const{field:l,name:r,id:a,value:o,onChange:i,readOnly:d,context:u,renderers:m}=n;if(!l||l.marker||!1===l.visible)return null;const p=m?.[l.type];if(p)return p({field:l,name:r,id:a,value:o,onChange:i,readOnly:d});switch(l.type){case"custom":{const e={...u,field:l,name:r,id:a,value:o,onChange:i,readOnly:d};return l.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
+
return j(t,{label:J(l,r),htmlFor:a,icon:l.icon,hint:l.hint,children:/* @__PURE__ */j(T,{id:a,value:"string"==typeof o?o:null==o?"":String(o),onChange:i,placeholder:l.placeholder,multiline:"textarea"===l.type,readOnly:d})});case"number":/* @__PURE__ */
|
|
14
|
+
return j(t,{label:J(l,r),htmlFor:a,icon:l.icon,hint:l.hint,children:/* @__PURE__ */j(s,{id:a,value:"number"==typeof o?o:void 0,onChange:i,min:l.min,max:l.max,step:l.step,placeholder:l.placeholder,readOnly:d})});case"select":{const n=`${a}-label`;/* @__PURE__ */
|
|
15
|
+
return j(t,{label:J(l,r),labelId:n,htmlFor:a,icon:l.icon,hint:l.hint,children:/* @__PURE__ */j(e,{id:a,value:o,options:l.options,onChange:i,readOnly:d,ariaLabelledBy:n})})}case"radio":/* @__PURE__ */
|
|
16
|
+
return j(t,{label:J(l,r),icon:l.icon,hint:l.hint,children:/* @__PURE__ */j(c,{ariaLabel:J(l,r),value:o,options:l.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||d})),onChange:e=>{d||i(e)}})});case"object":/* @__PURE__ */
|
|
17
|
+
return j(K,{...n,field:l});case"array":/* @__PURE__ */
|
|
18
|
+
return j(V,{...n,field:l});case"slot":return null}}var W=e=>l.includes(e);function X(e){let n,t=l[0];const r=[],a=/* @__PURE__ */new Set;for(const[l,o]of Object.entries(e))o&&(W(o.bucket)&&((o.marker||o.bucket!==t)&&(n=void 0),t=o.bucket),o.marker&&"string"==typeof o.fold?n={key:l,title:o.fold}:o.marker&&!1===o.fold&&(n=void 0),o.marker||!1===o.visible||(r.push(n?{name:l,field:o,bucket:t,fold:n}:{name:l,field:o,bucket:t}),"slot"!==o.type&&a.add(t)));return{rows:r,buckets:l.filter(e=>a.has(e))}}function Z(e){return new Map(X(e).rows.map(e=>[e.name,e.bucket]))}function q(e){const n=[];for(const t of e){const e=n[n.length-1];e&&e.fold?.key===t.fold?.key?e.rows.push(t):n.push({fold:t.fold,rows:[t]})}return n}function Q({fields:e,values:n,onChange:t,readOnly:l=!1,context:a,tab:i,onTab:s,tabs:c=!0,tabIcons:d,renderers:u,idPrefix:m,ariaLabel:p,lead:f,children:b,leadFold:g,closedFolds:v,onFold:y}){const N=h("panel",o),O=$(),I=m??`es-insp${O.replace(/:/g,"")}`,S=X(e),[F,P]=C(void 0),L=i??F,M=L&&S.buckets.includes(L)?L:S.buckets[0],[T,A]=C(null),H=T&&T.panel===I&&S.rows.some(e=>e.name===T.name)?T:null,E=c&&S.buckets.length>1,R=E&&M?k(I,M):`${I}-rows`,[z,B]=C(()=>/* @__PURE__ */new Set),Y=v??z,J=(e,n)=>/* @__PURE__ */j(r,{title:e.title,open:!Y.has(e.key),onToggle:n=>((e,n)=>{void 0===v&&B(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),y?.(e,n)})(e.key,n),id:`${I}-fold-${e.key}`,children:n}),K=e=>E&&e!==M,V=({name:e,field:r,bucket:o})=>/* @__PURE__ */j("div",{className:"es-insp-row","data-field":e,"data-bucket":o,hidden:!!K(o)||void 0,children:/* @__PURE__ */j(G,{field:r,name:e,id:`${I}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:a,renderers:u,openItem:H&&H.name===e?H.index:null,onOpenItem:n=>A(null===n?null:{panel:I,name:e,index:n})})},e);/* @__PURE__ */
|
|
19
|
+
return D("div",{className:"es-insp",children:[E?/* @__PURE__ */j("div",{className:"es-insp-tabs",children:/* @__PURE__ */j(x,{variant:"underline",block:!0,"aria-label":p??N.settings,idPrefix:I,value:M,onChange:e=>{const n=e;void 0===i&&P(n),s?.(n)},items:S.buckets.map(e=>{const n=N.buckets[e],t=d?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */j("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
20
|
+
/* @__PURE__ */D("div",{className:"es-insp-rows",id:R,role:E?"tabpanel":void 0,"aria-labelledby":E&&M?w(I,M):void 0,children:[f?g?/* @__PURE__ */j("div",{className:"es-insp-band","data-fold":g.key,children:J(g,f)}):f:null,q(S.rows).map((e,n)=>{if(!e.fold)return e.rows.map(V);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
21
|
+
return j("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!K(t)&&!l)||void 0,children:J(e.fold,e.rows.map(V))},`fold-${e.fold.key}-${n}`)}),b]})]})}export{T as FieldText,Q as Inspector,G as InspectorField,Y as ListField,Z as bucketsOf,R as copyItem,A as insertAt,J as labelOf,H as moveTo,X as planFields,E as removeAt};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-M6F6LS3H.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-ZAOM6PFH.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-MCHMF32I.js";import{DEFAULT_TREE_WORDS as n}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as c}from"./chunk-KFV7N2DJ.js";import{DEFAULT_NODE_MENU_WORDS as s}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as f}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as p,DEFAULT_NOTICE_WORDS as e}from"./chunk-Y2G7CU6A.js";import{DEFAULT_LOCK_WORDS as i}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as u}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as k}from"./chunk-JZDEIRH4.js";import{DEFAULT_FIELDS_WORDS as j}from"./chunk-FFYXVAAL.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-O2NLQBFX.js";import{DEFAULT_CANVAS_WORDS as l}from"./chunk-AELNNAFM.js";var F={notice:e,lock:i,save:f,chrome:p,rail:u,tree:n,panel:c,fields:j,pick:r,drag:h,menu:s,styleClipboard:t,copy:k,canvas:l,textStyles:o,screen:m},a=o=>"object"==typeof o&&null!==o;function A(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:a(n)?t[m]=a(c)?A(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function y(o,r){return r?A(o,r):o}export{F as DEFAULT_EASEL_STRINGS,y as mergeEaselStrings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{panelFieldsOf as t}from"./chunk-ZE7I3PLX.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-PAM3NLFL.js";import{DESIGN_GROUP_KEY as e,BUCKET_KEY as r}from"./chunk-MQNBD6AB.js";import{ANCHOR_FIELD_KEYS as s,foldMetaOf as c,MEDIA_FIELD_MARKER as i,TEXT_FIELD_MARKER as p,LINK_FIELD_MARKER as u}from"./chunk-DUVRZ456.js";import{STYLE_KIND as a,fieldKind as f,copyStyle as l,heldStyle as m,planPaste as h,pasteMessage as y}from"./chunk-V7U33NF2.js";var j=/* @__PURE__ */new Set([e.Size,e.Design,e.Layout,e.Position]),w=new Set(Object.values(e)),b=new Set(Object.values(r)),S=new Set(s),g=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[i,p,u];function v(t){return`site:${t??""}`}function L(t){if(!t||"object"!=typeof t)return null;const n=t,e=o(t)??t,r=n[a]??e[a];if("string"==typeof r)return r;const s=n.options??e.options;if(Array.isArray(s)){return`choice:${s.map(t=>String(t?.value)).sort().join("|")}`}return f(e)}function A(t){const n=t,e=o(t);return k.some(t=>t in n||e&&t in e)}function D(o,e){const s=t(o,e)??{},i=[];let p=!0,u=!1;for(const[t,o]of Object.entries(s))b.has(t)?(p=t===r.Design,u=!1):w.has(t)?p&&(u=j.has(t)):u&&o&&"object"==typeof o&&!t.startsWith("_")&&(c(o)||S.has(t)||g.has(t)||A(o)||"slot"!==o.type&&i.push({path:[t],kind:L(o),counted:"mobile"!==n(o)?.tier}));return i}function d(t,o,n,e,r){l({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function F(t,o,n,e,r,s){const c=m(n);if(!c)return null;const i=h(c,{type:e.type,rows:t(o,e),props:e.props});return{...i,message:y(i,c.sourceLabel,r,s)}}function N(t,o,n,e){d(D,t,o,n,e)}function O(t,o,n,e,r){return F(D,t,o,n,e,r)}var P={scope:t=>v(t.siteId),rows:(t,o)=>D(t,o),copy:(t,o,n,e)=>N(e,t,o,n),plan:(t,o,n,e)=>O(e,t,o,n)};function B(t,o){if(!t&&!o)return P;const n=t?.rows,e=n?(t,o)=>n(t,o):D;return{scope:t?.scope??P.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>d(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>F(e,s,t,n,r,o))}}export{N as copyNodeStyle,D as nodeStyleRows,O as planNodePaste,L as shopFieldKind,v as siteStyleScope,B as styleClipboardOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{styleMenuItems as e}from"./chunk-V7U33NF2.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as t}from"./chunk-PLVEGYK6.js";import{useHostEscape as o}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-MCHMF32I.js";import{EaselMenuItems as r,menuLabel as i}from"./chunk-EA2HTX37.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{
|
|
1
|
+
import{styleMenuItems as e}from"./chunk-V7U33NF2.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as t}from"./chunk-PLVEGYK6.js";import{useHostEscape as o}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-MCHMF32I.js";import{EaselMenuItems as r,menuLabel as i}from"./chunk-EA2HTX37.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{useCanvasEvent as u}from"./chunk-PAELDYYS.js";import{zoneKey as d,ROOT_SLOT as p,ROOT_ID as f}from"./chunk-KRXQM65X.js";import{isTypingTarget as m,framePointToHost as h}from"./chunk-ZNCEOSXO.js";import{useState as y,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,AddIcon as C,PasteIcon as z,SettingsIcon as O,LayersIcon as P,CopyIcon as A}from"efficient-shell/icons/efficient";import{jsx as S}from"react/jsx-runtime";function j(e,n){const o=[],l=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||l.has(n.props.id))break;if(l.add(n.props.id),o.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===t)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var D=c(),K=/* @__PURE__ */new WeakMap;function M(e){if(e.claimsPage)return D;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=K.get(n);return t||(t=c(),K.set(n,t)),t}function T(){return M(n())}function X(e,n,o){if(n===t){const{floor:n,cap:t}=e.sectionBand();return{parentId:f,slot:p,index:Math.min(Math.max(o,n),t)}}const l=n.lastIndexOf(":");return{parentId:n.slice(0,l),slot:n.slice(l+1),index:o}}function E(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}}function I(e,n,t){const o=e.canPasteAt;if(!o)return d(n.from)===t.zone?X(e,t.zone,t.index+1):null;for(const l of j(e,t)){const t=X(e,l.zone,l.index+1);if(o(n,t))return t}return null}function L(e){if(e.defaultPrevented||e.altKey||e.shiftKey||!e.metaKey&&!e.ctrlKey)return null;if(m(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;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function Y(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=E(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;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:I(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function R(n,o){const{zone:l,index:r}=o,i=n.nodeAt(l,r);if(!i)return[];const c=i.props.id,a=n.labelOf(i.type,l),u=Boolean(i.props._hidden),d=n.nodeOps,p=n.isPinned(i,l),f=n.isLocked(i),m=!p&&!f&&!n.duplicateBlocked(i),h=n.permits?.(i)??{duplicate:!0,delete:!0},y=E(n,i,l),k=j(n,o),b=d.held,v=b&&!p?I(n,b,o):null,g=!n.readOnly,w=n.style?e({held:g?n.style.held():null,canCopy:n.style.canCopy(i,l),onCopy:()=>n.style?.copy(i,l),onPaste:()=>n.style?.paste(l,r,i),words:n.words?.styleClipboard}):[];return s({title:a,words:n.words?.menu,layer:{group:"pick",items:k.flatMap((e,o)=>{const l={label:n.rowNameOf(e.node,e.zone),checked:0===o,onClick:()=>n.selectAt(e.zone,e.index,e.node.props.id,e.parentType)},r=e.zone===t?null:n.slotRung?.(e.zone)??null;return r?[l,{label:r.label,checked:!1,onClick:r.select}]:[l]})},actions:{addInside:g&&n.canAddTo(i.type)?()=>n.openAddInside(l,r):void 0,duplicate:g&&m&&h.duplicate?()=>d.duplicate(c):void 0,moveUp:g&&d.canStep(c,-1)?()=>d.step(c,-1):void 0,moveDown:g&&d.canStep(c,1)?()=>d.step(c,1):void 0,copy:y.copy?()=>d.copy(c,a):void 0,cut:g&&y.cut?()=>d.cut(c,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&n.renamePropOf(i,l)?()=>n.beginRename(l,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:n.menuRows?.(i,l,r)??void 0,pinnedLine:p?N(n).pinned:void 0})}var N=e=>e.words?.screen??l.menu;function U(e){const n=N(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */S(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */S(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=o?[{label:n.addSection,icon:/* @__PURE__ */S(C,{}),onClick:e.openAddSection}]:[],c=e.nodeOps.held,s=X(e,t,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):d(c.from)===t)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */S(z,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??l.pageSettings,icon:/* @__PURE__ */S(O,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */S(P,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),p={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[p,...e]:e)}function V(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=N(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */S(A,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */S(A,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */S(z,{}),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 B(e){return e.shiftKey}function F(e,n){const[t,l]=y(null),r=k(()=>l(null),[]);o(null!==t,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=L(e);if(!o)return;const l=t.selected();if(!l)return;const r=Y(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]),u(n,"keydown",c);const a=k(n=>{if(B(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]);u(n,"contextmenu",t=>{if(B(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;t.preventDefault();const c=h(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),u(n,"mousedown",r),u(n,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:t?/* @__PURE__ */S(G,{host:e,target:t,onClose:r}):null,closeMenu:r}}function G({host:e,target:n,onClose:t}){const o="node"===n.kind?R(e,n):"input"===n.kind?V(e,n.el):U(e);return 0===o.length?null:/* @__PURE__ */S(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),children:/* @__PURE__ */S(r,{items:o,onClose:t})})}export{D as EASEL_NODE_CLIPBOARD,j as ancestorChain,M as nodeClipboardOf,E as nodeClipboardRules,R as nodeMenuItems,L as nodeShortcut,U as pageMenuItems,I as pastePlace,Y as runNodeShortcut,V as textMenuItems,T as useNodeClipboard,F as useNodeContextMenu};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useScreenOwnerName as e}from"./chunk-
|
|
1
|
+
import{useScreenOwnerName as e}from"./chunk-3FZAGTQE.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-UB4TLWVJ.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
|
|
2
2
|
return o(r,{children:[
|
|
3
3
|
/* @__PURE__ */t(i,{context:p,pick:d?{kind:c(d.accept),field:d.title||void 0}:null,onCancel:()=>d&&n(d.requestId,null),onHide:m}),
|
|
4
4
|
/* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as r}from"./chunk-
|
|
1
|
+
import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as r}from"./chunk-ITAQX3HT.js";import{ScreenChrome as e}from"./chunk-5QSFLWAJ.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-WZMU646D.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.js";import{documentPermissions as o}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t}from"react";import{Dialog as d,Button as l}from"efficient-shell/ui";import{jsx as m,jsxs as g,Fragment as h}from"react/jsx-runtime";var f=n(r),v=n(e);function p({saving:n,onCancel:r,onDiscard:e,onSave:i}){const a=c("screen",s).leave;/* @__PURE__ */
|
|
2
2
|
return m(d,{open:!0,role:"alertdialog",size:"sm",title:a.title,onClose:r,footer:/* @__PURE__ */g(h,{children:[
|
|
3
3
|
/* @__PURE__ */m(l,{variant:"secondary",onClick:r,children:a.cancel}),
|
|
4
4
|
/* @__PURE__ */m(l,{variant:"ghost-danger",onClick:e,children:a.discard}),
|
|
5
5
|
/* @__PURE__ */m(l,{variant:"primary",loading:n,onClick:i,children:n?a.saving:a.save})]}),children:a.body})}function u({target:n,addressing:r,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
-
return m(i,{target:n,addressing:r,onHostMessage:e,children:a})}var k=(n,r)=>/* @__PURE__ */g(h,{children:[n,r]});function C({config:n,parts:r,wrap:e=k}){const{data:i,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:C,pendingNav:
|
|
7
|
-
/* @__PURE__ */m(f,{config:n,data:i,onChange:C,permissions:
|
|
6
|
+
return m(i,{target:n,addressing:r,onHostMessage:e,children:a})}var k=(n,r)=>/* @__PURE__ */g(h,{children:[n,r]});function C({config:n,parts:r,wrap:e=k}){const{data:i,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:C,pendingNav:j,cancelPendingNav:N,discardAndNavigate:H,saveAndNavigate:M}=a(),y=t(()=>o(!u),[u]),A=c("screen",s);return l?/* @__PURE__ */m("div",{className:"sf-msg",children:A.loading}):d?/* @__PURE__ */m("div",{className:"sf-msg sf-msg--error",children:d}):g?i?e(
|
|
7
|
+
/* @__PURE__ */m(f,{config:n,data:i,onChange:C,permissions:y,parts:r,children:/* @__PURE__ */m(v,{})}),j&&/* @__PURE__ */m(p,{saving:"saving"===h,onCancel:N,onDiscard:H,onSave:()=>{M()}})):/* @__PURE__ */m("div",{className:"sf-msg",children:A.loading}):/* @__PURE__ */m("div",{className:"sf-msg",children:A.waitingForAuthorization})}export{C as DocumentScreen,u as ScreenMount};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenDocument as n}from"./chunk-WZMU646D.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-MCHMF32I.js";import{EditNotice as r}from"./chunk-
|
|
1
|
+
import{useScreenDocument as n}from"./chunk-WZMU646D.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-MCHMF32I.js";import{EditNotice as r}from"./chunk-UB4TLWVJ.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,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-3FZAGTQE.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-FUOZKV7A.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
|
|
2
2
|
return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{DEFAULT_DRAG_WORDS as e}from"./chunk-O2NLQBFX.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as r,isNoOpDrop as a}from"./chunk-67GNT6PF.js";import{
|
|
1
|
+
import{DEFAULT_DRAG_WORDS as e}from"./chunk-O2NLQBFX.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as r,isNoOpDrop as a}from"./chunk-67GNT6PF.js";import{useCanvasLayout as o,useCanvasEvent as s}from"./chunk-PAELDYYS.js";import{withTip as i}from"./chunk-P2VEMZH5.js";import{parseZoneKey as c}from"./chunk-KRXQM65X.js";import{framePointToHost as d,elementScale as u,frameRectToLayer as h,clientPointToLayer as f}from"./chunk-ZNCEOSXO.js";import{useRef as p,useEffect as m,useState as g,useCallback as b,useMemo as y,useSyncExternalStore as v,useId as x,useLayoutEffect as k}from"react";import{Tooltip as w,Input as N,IconButton as A}from"efficient-shell/ui";import{jsxs as z,jsx as D}from"react/jsx-runtime";import{CloseIcon as T,SearchIcon as C}from"efficient-shell/icons/efficient";var S=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,E=e=>e.width*e.height;function $(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>S(e.box,t,n)).sort((e,t)=>E(t.s.box)-E(e.s.box)||e.at-t.at).map(({s:e})=>e)}function L(e,t,n){return $(e,t,n).at(-1)??null}function j(e,t,n){const l="x"===e.axis?t:n;let r=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(r+=1)}return r}function M(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],r=n[t],a=l&&r?(l.left+l.width+r.left)/2:l?l.left+l.width:r?r.left:e.box.left,o=r??l??e.box;return{left:a-1,top:o.top,width:2,height:o.height}}const l=n[t-1],r=n[t],a=l&&r?(l.top+l.height+r.top)/2:l?l.top+l.height:r?r.top:e.box.top;return{left:e.box.left,top:a-1,width:e.box.width,height:2}}function B(e,t,n,l,r=()=>!1,a=()=>!0){const o=e.filter(e=>S(e.box,t,n)).sort((e,t)=>E(e.box)-E(t.box));for(const e of o){const o=j(e,t,n),s={...e.list,index:o};if(r(s))return null;if(l(s))return{zone:e,to:s,line:M(e,o)};if(!a(s))return null}return null}function O(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const r=e.children[l-1],a=e.children[l],o=r.top+r.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(a.top-o,0)}})}return n}var K={nodes:[],zones:[]},X="data-puck-dropzone",q="data-puck-component";function P(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function Y(e,t){const{frame:n,document:l}=e,r=e=>h(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),a=[],o=[];for(const e of l.querySelectorAll(`[${X}]`)){const t=e.getAttribute(X)??"";let n;try{n=c(t)}catch{continue}const l=[...e.querySelectorAll(`[${q}]`)].filter(t=>t.parentElement?.closest(`[${X}]`)===e),s=l.map(r);o.push({key:t,list:n,box:r(e),axis:P(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(q);l&&a.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:a,zones:o}}var Z="data-es-empty-cell",F="data-puck-dropzone",R=140;var I=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function Q(i){const{canvas:c,session:h,readOnly:x,words:N=e.canvas}=i,A=p(i);m(()=>{A.current=i});const T=p(null),C=o(c),[S,E]=g(0),L=b(()=>E(e=>e+1),[]),[j,M]=g(K);m(()=>{const e=T.current;c&&e&&M((A.current.measure??Y)(c,e))},[c,C,i.revision,S]);const O=i.model,X=y(()=>O(j),[O,j]),q=v(h.subscribe,h.shown,h.shown),P=i.choose,R=(e,t)=>{const n=$(X.sources,e,t);return 0===n.length?null:P?P(n):n[n.length-1]},[Q,V]=g(null),[G,H]=g(null),W=p(null),J=()=>{W.current&&clearTimeout(W.current),W.current=null},U=()=>{J(),W.current=setTimeout(()=>{h.get()||V(null)},140)};m(()=>J,[]);const _=p(null);s(c,"mousemove",e=>{const t=T.current;if(!c||!t)return;const n=d(c.frame,e.clientX,e.clientY,t),l=u(t),r={x:n.x/l,y:n.y/l};if(_.current=r,A.current.readOnly||h.get())return;J();const a=R(r.x,r.y);V(e=>e?.key===a?.key&&e?.box===a?.box?e:a)}),s(c,"mouseout",e=>{e.relatedTarget||(_.current=null,U())}),s(c,"mouseover",e=>{e.relatedTarget||L()});const ee=p(null),te=b(()=>{ee.current?.(),ee.current=null,H(null)},[]);m(()=>h.subscribe(()=>{h.get()?L():te()}),[h,te,L]),m(()=>te,[te]),("undefined"==typeof document?m:k)(()=>{if(h.get())return;const e=_.current;V(t=>x?null:e?R(e.x,e.y):t?X.sources.find(e=>e.key===t.key)??null:null)},[X,q,h,x,P]);const ne=e=>{const t=h.get(),n=T.current;if(!t||!n)return null;const l=f(n,e.clientX,e.clientY);_.current=l;const r=B(X.zones,l.x,l.y,e=>A.current.canDrop(t.item,e),e=>!!t.from&&a(t.from,e),e=>A.current.fallThrough?.(t.item,e,t.from)??!0);return r?{h:t,t:r}:null},le={onDragEnter:e=>{if(ee.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),a=c?l(c.document):null,o=[];t&&o.push(r(t)),a&&c&&o.push(r(a,c.frame)),ee.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=ne(e);if(!n)return void H(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};H(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(_.current=null,H(null))},onDrop:e=>{const t=ne(e);t&&(e.preventDefault(),h.end(),te(),A.current.onDrop(t.h.item,t.t.to))}},re={draggable:!x&&!!Q,onMouseEnter:J,onMouseLeave:()=>!h.get()&&U(),onDragStart:e=>{if(Q&&!x){h.start({key:Q.key,item:Q.item,from:Q.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",Q.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{h.end(),te()},onClick:()=>{Q&&!x&&A.current.onPick?.(Q.item)}},{seams:ae=[]}=X,oe=X.zones.filter(e=>0===e.children.length),se=i.onZoneAdd&&!x?oe:[],ie=se.map(e=>e.key).join("\n");return m(()=>{const e=c?.document;if(!e)return;const t=new Set(ie?ie.split("\n"):[]);for(const n of e.querySelectorAll(`[${F}]`))n.toggleAttribute(Z,t.has(n.getAttribute(F)??""));return()=>{for(const t of e.querySelectorAll(`[${Z}]`))t.removeAttribute(Z)}},[c,ie,j,C,S]),/* @__PURE__ */z("div",{ref:T,className:"es-canvas-layer",children:[q||!i.onSeamAdd||x?null:ae.map(e=>/* @__PURE__ */D("div",{className:"es-canvas-seam",style:{left:e.box.left,top:e.box.top+e.box.height/2-8,width:e.box.width,height:16},children:/* @__PURE__ */D("button",{type:"button",className:"es-canvas-seam-add",onClick:()=>i.onSeamAdd?.(e.place),children:N.addButton({label:i.seamLabel??N.addSection})})},e.key)),se.length?se.map(e=>/* @__PURE__ */D("button",{type:"button",className:G?.zoneKey===e.key?"es-canvas-empty is-over":"es-canvas-empty",style:I(e.box),onClick:()=>i.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */D("span",{className:"es-canvas-empty-add",children:N.addButton({label:i.zoneAddLabel??N.addBlock})})},e.key)):null,q?/* @__PURE__ */D("div",{className:"es-canvas-catch",...le}):null,G&&!oe.some(e=>e.key===G.zoneKey)?/* @__PURE__ */D("div",{className:`es-canvas-line is-${G.axis}`,style:I(G.line)}):null,
|
|
2
2
|
/* @__PURE__ */D("div",{className:"es-canvas-handle-spot",style:Q?{"--es-handle-x":`${Q.box.left+2}px`,"--es-handle-y":`${Math.max(Q.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */D(w,{className:"es-canvas-handle-tip",side:"top",content:!Q||x||q?null:Q.title??N.handle({label:Q.label}),children:/* @__PURE__ */z("div",{className:["es-canvas-handle",Q&&!x?"is-shown":"",q?"is-dragging":""].filter(Boolean).join(" "),...re,children:[
|
|
3
|
-
/* @__PURE__ */D("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),Q?.label]})})})]})}var V=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function G({groups:t,session:n,itemFor:l,onInsert:r,at:a,hint:
|
|
3
|
+
/* @__PURE__ */D("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),Q?.label]})})})]})}var V=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function G({groups:t,session:n,itemFor:l,onInsert:r,at:a,hint:o,searchLabel:s,readOnly:c,words:d=e.add}){const u=o??d.hint,h=s??d.search,[f,p]=g(""),m=x(),b=f.trim().toLowerCase(),y=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),v=t.map((e,t)=>({...e,key:y[t],tiles:b?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,b)):e.tiles})).filter(e=>e.tiles.length>0),k=(e,t)=>r=>{if(t)r.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),r.dataTransfer.effectAllowed="copy";try{r.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
|
|
4
4
|
return z("div",{className:"es-add",children:[a?/* @__PURE__ */z("div",{className:"es-add-at",role:"status",children:[
|
|
5
|
-
/* @__PURE__ */D("span",{children:a.label}),
|
|
5
|
+
/* @__PURE__ */D("span",{children:a.label}),i(d.stop,/* @__PURE__ */D("button",{type:"button",className:"es-add-at-clear","aria-label":d.stop,onClick:a.onClear,children:/* @__PURE__ */D(T,{size:12,"aria-hidden":"true"})}))]}):null,
|
|
6
6
|
/* @__PURE__ */D("p",{className:"es-add-hint",children:u}),
|
|
7
7
|
/* @__PURE__ */D("div",{className:"es-add-find",children:/* @__PURE__ */D(N,{id:m,type:"search","aria-label":h,placeholder:d.searchPlaceholder({label:h}),value:f,onChange:e=>p(e.target.value),leftIcon:/* @__PURE__ */D(C,{size:16,"aria-hidden":"true"}),rightAdornment:f?/* @__PURE__ */D(A,{size:"sm","aria-label":d.clearSearch,onClick:()=>p(""),children:/* @__PURE__ */D(T,{size:12,"aria-hidden":"true"})}):void 0})}),0===v.length?/* @__PURE__ */z("div",{className:"es-add-empty",role:"status",children:[
|
|
8
8
|
/* @__PURE__ */D("div",{className:"es-add-empty-title",children:d.nothing({query:f.trim()})}),
|
|
@@ -10,5 +10,5 @@ return z("div",{className:"es-add",children:[a?/* @__PURE__ */z("div",{className
|
|
|
10
10
|
/* @__PURE__ */z("div",{className:"es-add-group-head",children:[
|
|
11
11
|
/* @__PURE__ */D("span",{className:"es-add-group-title",children:e.title}),
|
|
12
12
|
/* @__PURE__ */D("span",{className:"es-add-group-count",children:e.tiles.length})]}),
|
|
13
|
-
/* @__PURE__ */D("div",{className:V(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(c||e.disabled),l=c?void 0:e.disabled?e.disabledReason:e.title??d.tile({label:e.label});return
|
|
13
|
+
/* @__PURE__ */D("div",{className:V(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(c||e.disabled),l=c?void 0:e.disabled?e.disabledReason:e.title??d.tile({label:e.label});return i(l,/* @__PURE__ */z("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":d.tile({label:e.label}),onDragStart:k(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&r(e.type),children:[null!=e.cover?/* @__PURE__ */D("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */D("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
|
|
14
14
|
/* @__PURE__ */D("span",{className:"es-add-tile-label",children:e.label})]},e.type))})})]},e.key))]})}export{G as AddPanel,Q as CanvasDragLayer,K as EMPTY_MEASURE,R as HANDLE_GRACE_MS,B as canvasTarget,S as contains,j as gapInZone,M as gapLine,Y as measureCanvas,L as pickSource,O as seamsBetween,$ as sourcesAt};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={settings:"Settings",buckets:{Design:"Design",Animation:"Animation"},designGroups:{Content:"Content",Size:"Size",Design:"Design",Layout:"Layout",Position:"Position",Anchor:"Anchor"},followsDefault:"Default",reset:"Reset",resetName:({label:e})=>`Reset ${e}`,backToDefault:({detail:e})=>`Back to default: ${e}`,resetTitle:({label:e,detail:t})=>`Reset ${e} (back to ${t})`};export{e as DEFAULT_PANEL_WORDS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n={Design:"_sDesign",Animation:"_sAnimation"},i={Content:"_dContent",Size:"_dSize",Design:"_dDesign",Layout:"_dLayout",Position:"_dPosition",Anchor:"_dAnchor"};export{n as BUCKET_KEY,i as DESIGN_GROUP_KEY};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-PFNIVZPN.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-3FZAGTQE.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-MCHMF32I.js";import{AddPanel as f}from"./chunk-KEHLCWTG.js";import{DEFAULT_DRAG_WORDS as u}from"./chunk-O2NLQBFX.js";import{useEasel as k}from"./chunk-FUOZKV7A.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as $,jsxs as O,Fragment as B}from"react/jsx-runtime";var F=e=>`section:${e}`,v=e=>`block:${e}`,I=e=>`template:${e}`;function N({blocks:N,blocksOnly:V,at:x,onAdd:A,itemFor:H,session:L,siteWide:C,onClose:T,onHide:P,readOnly:Q}){const Z=k(e=>e.config),w=p(),{labelAtLevel:D,categoryLabel:E,firstSection:G,Icon:K,Thumbnail:M}=w,{blockIsOffered:R}=m(),W=h("screen",d).add,z=h("drag",u).add,S=l(),[Y,J]=y([]);b(()=>{let t=!1;const o=e=>R(e,S);return s(S).list().then(n=>{if(t)return;const i=Z.components;J(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[Z,S]);const U=j(()=>t(Z,w),[Z]),X=e=>({type:F(e.type),label:e.name,cover:/* @__PURE__ */$(M,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:W.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=j(()=>{const e=[];if(N&&N.choices.length>0&&a(N.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${W.inside({name:N.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:v(e.type),label:e.label,icon:/* @__PURE__ */$(K,{type:e.type,size:18}),title:W.tile({name:e.label})}))})}),V)return e;const t=o(U,G);t&&e.push({key:"start",title:W.startBlank,tiles:[X(t)]}),Y.length>0&&e.push({key:"templates",title:W.templates,tiles:Y.map(e=>{return{type:I(e.id),label:e.name,cover:/* @__PURE__ */$(M,{type:e.node.type}),keywords:[(t=e.node.type,D(t,"section",Z.components[t]?.label??t)),e.node.type]};var t})});const s=n(U,G);for(const t of Object.keys(Z.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(Z,t,E),tiles:o.map(X)})}return e},[N,V,Y,U,Z,W]),_=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=Y.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
+
return O(B,{children:[
|
|
3
|
+
/* @__PURE__ */$(r,{icon:/* @__PURE__ */$(g,{size:15}),title:W.title,context:V?W.contextBlocks:W.contextAll,actions:/* @__PURE__ */$(c,{label:W.done,description:W.doneDescription,onClick:T}),onHide:P}),
|
|
4
|
+
/* @__PURE__ */O("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
+
/* @__PURE__ */$(f,{groups:q,session:L,itemFor:e=>H(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&A(t)},at:x,hint:V?W.hintBlocks:W.hint,searchLabel:V?W.searchBlocks:W.searchSections,readOnly:Q,words:z}),C&&!V?C:null]})]})}export{N as AddSidePanel,v as blockKey,F as sectionKey,I as templateKey};
|