efficient-easel 17.0.0 → 18.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/blocks/index.d.ts +2 -2
- package/dist/chunk-2ZWA6ARJ.js +8 -0
- package/dist/chunk-43AEUUNQ.js +1 -0
- package/dist/{chunk-OLRLHE5K.js → chunk-4QWTHRMD.js} +4 -4
- package/dist/{chunk-N3LYD2LK.js → chunk-5ZBV5RA6.js} +14 -14
- package/dist/chunk-A6Z4SD3I.js +10 -0
- package/dist/chunk-BHRC3ASL.js +1 -0
- package/dist/chunk-C2RHV42O.js +1 -0
- package/dist/{chunk-Z72CYM3L.js → chunk-DXROGLB5.js} +1 -1
- package/dist/{chunk-4UBYPRAS.js → chunk-HGV3FWOB.js} +1 -1
- package/dist/chunk-LLDHIBYG.js +18 -0
- package/dist/{chunk-EXCIHRAE.js → chunk-N5AN2RF2.js} +1 -1
- package/dist/{chunk-V63ERBLW.js → chunk-OBIL7BZO.js} +1 -1
- package/dist/{chunk-BU2YSTLJ.js → chunk-QEAUF632.js} +12 -12
- package/dist/chunk-QNAPTJRM.js +62 -0
- package/dist/{chunk-3ERZNZ5S.js → chunk-RFE7ZG3Y.js} +1 -1
- package/dist/{chunk-NFLO4I2N.js → chunk-SNB4LQMK.js} +1 -1
- package/dist/{chunk-MTNBJPXX.js → chunk-STWSCR25.js} +2 -2
- package/dist/{chunk-XLUVTPKK.js → chunk-VEZPDGDQ.js} +1 -1
- package/dist/chunk-W6SDWCOL.js +5 -0
- package/dist/chunk-X3TYRF5V.js +1 -0
- package/dist/chunk-X52NFKUS.js +1 -0
- package/dist/{chunk-FJL3MYPA.js → chunk-XHHVMAGM.js} +1 -1
- package/dist/{chunk-JSH3XKEF.js → chunk-YLQYEDUQ.js} +1 -1
- package/dist/drag/drag.css +8 -0
- package/dist/drag/index.d.ts +15 -1
- package/dist/drag/index.js +1 -1
- package/dist/draw/index.js +1 -1
- package/dist/easel/easel.css +8 -0
- package/dist/easel/index.d.ts +16 -6
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/{host-Cxbhp0zg.d.ts → host-epHo7r8P.d.ts} +12 -1
- package/dist/node-ops/index.d.ts +2 -2
- package/dist/node-ops/index.js +1 -1
- package/dist/{plan-2BLk7pWs.d.ts → plan-CZS902DV.d.ts} +9 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.d.ts +6 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.d.ts +4 -3
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +6 -5
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +5 -4
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +4 -3
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +5 -4
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +5 -4
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/usePartBridge.d.ts +5 -4
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +6 -5
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +3 -2
- package/dist/screen/lib/document-addressing.d.ts +4 -3
- package/dist/screen/lib/document-hooks.d.ts +2 -2
- package/dist/screen/lib/host.d.ts +4 -3
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +4 -3
- package/dist/screen/lib/media-picker.d.ts +7 -9
- package/dist/screen/lib/page-lock.d.ts +3 -2
- package/dist/screen/lib/puck/device-fields.js +1 -1
- package/dist/screen/lib/puck/palette-sections.d.ts +2 -2
- package/dist/screen/lib/puck/section-doc.d.ts +2 -2
- package/dist/screen/lib/puck/slot-child-name.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +5 -4
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.d.ts +2 -2
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +75 -7
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-templates.d.ts +3 -2
- package/dist/screen/lib/session-context.d.ts +3 -2
- package/dist/screen/lib/session.d.ts +6 -2
- package/dist/screen/lib/shared-section-types.d.ts +71 -0
- package/dist/screen/lib/shared-section-types.js +1 -0
- package/dist/screen/lib/shared-sections.d.ts +34 -0
- package/dist/screen/lib/shared-sections.js +1 -0
- package/dist/screen/screen.css +7 -0
- package/dist/screen/words.d.ts +49 -1
- package/dist/screen/words.js +1 -1
- package/dist/strings/index.d.ts +1 -1
- package/dist/strings/index.js +2 -2
- package/dist/tree/index.d.ts +3 -3
- package/dist/tree/index.js +1 -1
- package/dist/tree/tree.css +17 -0
- package/dist/{types-D8P9q-BG.d.ts → types-Bqq6ya0y.d.ts} +9 -0
- package/dist/{types-kR_4wYBw.d.ts → types-Cq53lL8d.d.ts} +1 -1
- package/dist/{useNodeOps-B0XZ8Bl8.d.ts → useNodeOps-fIDWzftn.d.ts} +3 -1
- package/package.json +15 -3
- package/dist/chunk-4JSBIW5H.js +0 -9
- package/dist/chunk-EL4F3IN7.js +0 -1
- package/dist/chunk-INIPQLPR.js +0 -1
- package/dist/chunk-MI54XTWD.js +0 -5
- package/dist/chunk-POSLNRTO.js +0 -18
- package/dist/chunk-SHS6WCLL.js +0 -1
- package/dist/chunk-SPQOPWCL.js +0 -5
- package/dist/chunk-TBF5CVPA.js +0 -1
- package/dist/chunk-WR3EVON3.js +0 -57
package/dist/screen/words.d.ts
CHANGED
|
@@ -72,6 +72,52 @@ type ScreenAddWords = {
|
|
|
72
72
|
addingHere: string;
|
|
73
73
|
};
|
|
74
74
|
declare const DEFAULT_SCREEN_ADD_WORDS: ScreenAddWords;
|
|
75
|
+
/**
|
|
76
|
+
* A SHARED SECTION'S WORDS (Shared section design v4, Lewis 2026-10-21): one
|
|
77
|
+
* section that many pages use live. Lewis's words for the menu are "Make
|
|
78
|
+
* shared", "On 3 pages", "Detach from shared" and "Remove from this page" — not
|
|
79
|
+
* "Delete" on a page, so nobody thinks it went from every page.
|
|
80
|
+
*/
|
|
81
|
+
type ScreenSharedWords = {
|
|
82
|
+
/** Add's group of them, above the saved sections. */
|
|
83
|
+
group: string;
|
|
84
|
+
/** How far one reaches: a card's Tooltip, and the menu's row that lists
|
|
85
|
+
* the pages. */
|
|
86
|
+
onPages: (v: {
|
|
87
|
+
count: number;
|
|
88
|
+
}) => string;
|
|
89
|
+
/** The menu row on a page's own section, and the dialog's title and button. */
|
|
90
|
+
makeShared: string;
|
|
91
|
+
/** The dialog's line under its title. */
|
|
92
|
+
makeSharedHint: string;
|
|
93
|
+
/** The name box's label. */
|
|
94
|
+
name: string;
|
|
95
|
+
/** The dialog's way out. */
|
|
96
|
+
cancel: string;
|
|
97
|
+
/** The store refused to make it. */
|
|
98
|
+
makeFailed: string;
|
|
99
|
+
/** The menu row that gives this page its own copy. */
|
|
100
|
+
detach: string;
|
|
101
|
+
/** The menu row, and the Layers trash, that take it off this page only. */
|
|
102
|
+
removeFromPage: string;
|
|
103
|
+
/** …and what is said then, with how many pages still use it. */
|
|
104
|
+
removed: (v: {
|
|
105
|
+
count: number;
|
|
106
|
+
}) => string;
|
|
107
|
+
/** A card's menu row, and the dialog's title and button. */
|
|
108
|
+
deleteShared: string;
|
|
109
|
+
deleteTitle: (v: {
|
|
110
|
+
name: string;
|
|
111
|
+
}) => string;
|
|
112
|
+
deleteMessage: (v: {
|
|
113
|
+
count: number;
|
|
114
|
+
}) => string;
|
|
115
|
+
/** The store refused to delete it. */
|
|
116
|
+
deleteFailed: string;
|
|
117
|
+
/** Why a card is dimmed: it is on this page already (once per page). */
|
|
118
|
+
alreadyHere: string;
|
|
119
|
+
};
|
|
120
|
+
declare const DEFAULT_SCREEN_SHARED_WORDS: ScreenSharedWords;
|
|
75
121
|
/**
|
|
76
122
|
* THE PROMPT BEFORE A SWITCH OF DOCUMENT WOULD LOSE AN EDIT (3.1.0). It was
|
|
77
123
|
* written into components/ScreenMount; the words are its English, word for
|
|
@@ -245,6 +291,8 @@ type ScreenWords = {
|
|
|
245
291
|
}) => string;
|
|
246
292
|
/** The Add panel's words (0.105.0). */
|
|
247
293
|
add: ScreenAddWords;
|
|
294
|
+
/** A shared section's words: Add's group, the menu rows and the dialogs. */
|
|
295
|
+
shared: ScreenSharedWords;
|
|
248
296
|
/** The cell over an EMPTY slot on the canvas, after its "+" (0.106.0): the
|
|
249
297
|
* campaign designer's "Add a block". */
|
|
250
298
|
canvasAddBlock: string;
|
|
@@ -331,4 +379,4 @@ type ScreenWords = {
|
|
|
331
379
|
};
|
|
332
380
|
declare const DEFAULT_SCREEN_WORDS: ScreenWords;
|
|
333
381
|
|
|
334
|
-
export { DEFAULT_SCREEN_ADD_WORDS, DEFAULT_SCREEN_SAVE_STATUS_WORDS, DEFAULT_SCREEN_WORDS, type ScreenAddWords, type ScreenBarWords, type ScreenLeaveWords, type ScreenMenuWords, type ScreenSaveStatusWords, type ScreenWords };
|
|
382
|
+
export { DEFAULT_SCREEN_ADD_WORDS, DEFAULT_SCREEN_SAVE_STATUS_WORDS, DEFAULT_SCREEN_SHARED_WORDS, DEFAULT_SCREEN_WORDS, type ScreenAddWords, type ScreenBarWords, type ScreenLeaveWords, type ScreenMenuWords, type ScreenSaveStatusWords, type ScreenSharedWords, type ScreenWords };
|
package/dist/screen/words.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DEFAULT_SCREEN_ADD_WORDS,DEFAULT_SCREEN_SAVE_STATUS_WORDS,DEFAULT_SCREEN_WORDS}from"../chunk-
|
|
1
|
+
export{DEFAULT_SCREEN_ADD_WORDS,DEFAULT_SCREEN_SAVE_STATUS_WORDS,DEFAULT_SCREEN_SHARED_WORDS,DEFAULT_SCREEN_WORDS}from"../chunk-C2RHV42O.js";
|
package/dist/strings/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { N as NodeMenuWords } from '../words-DMG4dYq2.js';
|
|
|
8
8
|
import { P as PanelWords } from '../words-zH1H0WFw.js';
|
|
9
9
|
import { P as PickWords } from '../words-DWvCJXwR.js';
|
|
10
10
|
import { ScreenWords } from '../screen/words.js';
|
|
11
|
-
export { ScreenAddWords } from '../screen/words.js';
|
|
11
|
+
export { ScreenAddWords, ScreenSharedWords } from '../screen/words.js';
|
|
12
12
|
import { S as StyleClipboardWords } from '../words-CnnHb9jo.js';
|
|
13
13
|
import { T as TextStylesWords } from '../words-gIDCeRv3.js';
|
|
14
14
|
import { T as TreeWords } from '../words-Cl9xMUYY.js';
|
package/dist/strings/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{DEFAULT_SCREEN_WORDS as r}from"../chunk-
|
|
2
|
-
return
|
|
1
|
+
import{DEFAULT_SCREEN_WORDS as r}from"../chunk-C2RHV42O.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as o}from"../chunk-6WY6ZXJG.js";import{DEFAULT_TEXT_STYLES_WORDS as n}from"../chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as t}from"../chunk-OFBZOI6W.js";import{DEFAULT_CANVAS_WORDS as c}from"../chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as e}from"../chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as m}from"../chunk-WK3AFPXY.js";import{DEFAULT_PANEL_WORDS as i}from"../chunk-KFV7N2DJ.js";import{DEFAULT_SAVE_WORDS as s}from"../chunk-H6DDIBQ4.js";import{DEFAULT_COPY_WORDS as u}from"../chunk-B4JN227A.js";import{DEFAULT_FIELDS_WORDS as f}from"../chunk-WRFD4EXD.js";import{DEFAULT_CHROME_WORDS as p,DEFAULT_NOTICE_WORDS as l}from"../chunk-Z6PVRXVY.js";import{DEFAULT_RAIL_WORDS as h}from"../chunk-2OAZYSWJ.js";import{DEFAULT_LOCK_WORDS as j}from"../chunk-RE4LP46F.js";import{stringsContext as k}from"../chunk-MFIRYGHW.js";import{DEFAULT_DRAG_WORDS as a}from"../chunk-KAML3KQH.js";import{useContext as Y,useMemo as y}from"react";import{jsx as D}from"react/jsx-runtime";var F={notice:l,lock:j,save:s,chrome:p,rail:h,tree:e,panel:i,fields:f,pick:t,drag:a,menu:m,styleClipboard:o,copy:u,canvas:c,textStyles:n,screen:r},d=r=>"object"==typeof r&&null!==r;function v(r,o){const n={};for(const t of Object.keys(r)){const c=r[t],e=o[t];null==e?n[t]=c:d(c)?n[t]=d(e)?v(c,e):c:n[t]=typeof e==typeof c?e:c}return n}function H(r,o){return o?v(r,o):r}function K({value:r,locale:o,children:n}){const t=k(),c=Y(t),e=c?.strings??F,m=o??c?.locale??"en",i=y(()=>({strings:H(e,r),locale:m}),[e,r,m]);/* @__PURE__ */
|
|
2
|
+
return D(t.Provider,{value:i,children:n})}function O(){return Y(k())?.strings??F}function W(){return Y(k())?.locale??"en"}export{F as DEFAULT_EASEL_STRINGS,K as EaselStringsProvider,H as mergeEaselStrings,W as useEaselLocale,O as useEaselStrings};
|
package/dist/tree/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { L as LayersTreeProps, S as SubtreeProps, a as TreeGroupLabelProps, b as TreeEmptySlotProps, c as TreeRowProps, d as TreeRowActionProps, e as TreeSeamProps } from '../types-
|
|
3
|
-
export { f as TreeRowFold, T as TreeRowMark } from '../types-
|
|
2
|
+
import { L as LayersTreeProps, S as SubtreeProps, a as TreeGroupLabelProps, b as TreeEmptySlotProps, c as TreeRowProps, d as TreeRowActionProps, e as TreeSeamProps } from '../types-Bqq6ya0y.js';
|
|
3
|
+
export { f as TreeRowFold, T as TreeRowMark } from '../types-Bqq6ya0y.js';
|
|
4
4
|
export { T as TreeWords } from '../words-Cl9xMUYY.js';
|
|
5
5
|
import 'efficient-shell/ui';
|
|
6
6
|
|
|
@@ -53,7 +53,7 @@ declare const TREE_DRAG_HINT: string;
|
|
|
53
53
|
* selected wherever the old name button did not) is selected by that onClick
|
|
54
54
|
* alone on a click, and by `onSelect` from the keyboard (Enter, Space).
|
|
55
55
|
*/
|
|
56
|
-
declare function TreeRow({ icon, name, preview, selected, hidden, draggable, dragHint, dragging, drop, fold, actions, nameSlot, onSelect, marks, badge, trailing, children, rowProps, level, words, }: TreeRowProps): react.JSX.Element;
|
|
56
|
+
declare function TreeRow({ icon, name, preview, selected, hidden, draggable, dragHint, dragging, drop, fold, actions, nameSlot, onSelect, marks, badge, trailing, shared, children, rowProps, level, words, }: TreeRowProps): react.JSX.Element;
|
|
57
57
|
/**
|
|
58
58
|
* An action over the end of a row's name — delete (the danger tone) or show /
|
|
59
59
|
* hide, or any other: the shell's `IconButton` with its `Tooltip`. Pressing it
|
package/dist/tree/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{LayersTree,Subtree,TREE_DRAG_HINT,TreeEmptySlot,TreeGroupLabel,TreeRow,TreeRowAction,TreeSeam}from"../chunk-
|
|
1
|
+
export{LayersTree,Subtree,TREE_DRAG_HINT,TreeEmptySlot,TreeGroupLabel,TreeRow,TreeRowAction,TreeSeam}from"../chunk-A6Z4SD3I.js";import"../chunk-K56YDHYQ.js";
|
package/dist/tree/tree.css
CHANGED
|
@@ -55,6 +55,23 @@
|
|
|
55
55
|
height: 13px;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/* ── A shared row (Shared section design v4, Lewis 2026-10-21) ──────────────
|
|
59
|
+
Its mark holds the row's end; the row's own actions show before it only on
|
|
60
|
+
hover, focus or a hidden row — at rest, selected or not, the mark alone (the
|
|
61
|
+
design's selected row; at 220px they would cut the name to a letter). The
|
|
62
|
+
tone and the mark are the shell's (TreeRow `tone`, `SharedIcon`). */
|
|
63
|
+
.es-tree-row:not(:hover):not(:focus-within):not(.is-hidden) .es-tree-shared-acts {
|
|
64
|
+
display: none;
|
|
65
|
+
}
|
|
66
|
+
.es-tree-shared-acts,
|
|
67
|
+
.es-tree-shared-mark {
|
|
68
|
+
display: inline-flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
}
|
|
71
|
+
.es-tree-shared-mark {
|
|
72
|
+
padding: 0 4px;
|
|
73
|
+
}
|
|
74
|
+
|
|
58
75
|
/* A rename box stands in for the name. It must not move the row by a pixel:
|
|
59
76
|
the name's own font, no border, no padding of its own. */
|
|
60
77
|
.es-tree-rename {
|
|
@@ -88,6 +88,15 @@ type TreeRowProps = {
|
|
|
88
88
|
label: string;
|
|
89
89
|
icon: ReactNode;
|
|
90
90
|
};
|
|
91
|
+
/**
|
|
92
|
+
* SHARED (Shared section design v4, Lewis 2026-10-21): the row's thing is
|
|
93
|
+
* used live on many pages, and these are the words for how far — "On every
|
|
94
|
+
* page", "On 3 pages". The row is drawn in the shell's shared tone (green),
|
|
95
|
+
* with the shell's `shared` mark held at its end, these words its Tooltip and
|
|
96
|
+
* accessible name. The row's `actions` stay, shown before the mark on hover
|
|
97
|
+
* or focus. Absent: the row is drawn as before.
|
|
98
|
+
*/
|
|
99
|
+
shared?: string;
|
|
91
100
|
/** Drawn after the name, the marks and `trailing` — a count, say. The drop line is the row's own (`drop`). */
|
|
92
101
|
children?: ReactNode;
|
|
93
102
|
/** The depth, from 1 (`aria-level`). Left out: the nearest `Subtree`'s, counted. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataInput } from './data/index.js';
|
|
2
|
-
import { I as ItemSelector, N as NodeSelection } from './plan-
|
|
2
|
+
import { I as ItemSelector, N as NodeSelection } from './plan-CZS902DV.js';
|
|
3
3
|
import { D as Data, S as SlotAddress, a as DataConfig, N as Node } from './types-41704JE4.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { N as Node, S as SlotAddress, D as Data, a as DataConfig, P as Place } from './types-41704JE4.js';
|
|
2
|
-
import { N as NodeSelection, A as AfterRemove, S as StepBounds } from './plan-
|
|
2
|
+
import { N as NodeSelection, A as AfterRemove, S as StepBounds } from './plan-CZS902DV.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The node clipboard — what Copy and Cut hold, and Paste reads.
|
|
@@ -62,6 +62,8 @@ declare function useNodeOps(host: NodeOpsHost): {
|
|
|
62
62
|
paste: (at: Place) => boolean;
|
|
63
63
|
/** Put back exactly what a delete took, at its place, selected (`planRestore`). */
|
|
64
64
|
restore: (node: Node, at: Place) => boolean;
|
|
65
|
+
/** Put `node` where `id` stands, selected, in one step (`planSwap`). */
|
|
66
|
+
swap: (id: string, node: Node) => boolean;
|
|
65
67
|
/** Where "up one level" goes from `selection`, or null when there is nothing above. */
|
|
66
68
|
parentOf: (selection: NodeSelection) => NodeSelection;
|
|
67
69
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.1.0",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
@@ -117,6 +117,8 @@
|
|
|
117
117
|
"./screen/lib/section-template-types",
|
|
118
118
|
"./screen/lib/section-templates",
|
|
119
119
|
"./screen/lib/session-context",
|
|
120
|
+
"./screen/lib/shared-section-types",
|
|
121
|
+
"./screen/lib/shared-sections",
|
|
120
122
|
"./screen/words"
|
|
121
123
|
]
|
|
122
124
|
},
|
|
@@ -605,6 +607,16 @@
|
|
|
605
607
|
"import": "./dist/screen/lib/session-context.js",
|
|
606
608
|
"default": "./dist/screen/lib/session-context.js"
|
|
607
609
|
},
|
|
610
|
+
"./screen/lib/shared-section-types": {
|
|
611
|
+
"types": "./dist/screen/lib/shared-section-types.d.ts",
|
|
612
|
+
"import": "./dist/screen/lib/shared-section-types.js",
|
|
613
|
+
"default": "./dist/screen/lib/shared-section-types.js"
|
|
614
|
+
},
|
|
615
|
+
"./screen/lib/shared-sections": {
|
|
616
|
+
"types": "./dist/screen/lib/shared-sections.d.ts",
|
|
617
|
+
"import": "./dist/screen/lib/shared-sections.js",
|
|
618
|
+
"default": "./dist/screen/lib/shared-sections.js"
|
|
619
|
+
},
|
|
608
620
|
"./screen/words": {
|
|
609
621
|
"types": "./dist/screen/words.d.ts",
|
|
610
622
|
"import": "./dist/screen/words.js",
|
|
@@ -615,7 +627,7 @@
|
|
|
615
627
|
"dist"
|
|
616
628
|
],
|
|
617
629
|
"peerDependencies": {
|
|
618
|
-
"efficient-shell": "^8.
|
|
630
|
+
"efficient-shell": "^8.20.0",
|
|
619
631
|
"react": ">=18",
|
|
620
632
|
"react-dom": ">=18"
|
|
621
633
|
},
|
|
@@ -625,7 +637,7 @@
|
|
|
625
637
|
"@types/node": "^22.0.0",
|
|
626
638
|
"@types/react": "^18.2.0",
|
|
627
639
|
"@types/react-dom": "^18.2.0",
|
|
628
|
-
"efficient-shell": "^8.
|
|
640
|
+
"efficient-shell": "^8.20.0",
|
|
629
641
|
"esbuild": "^0.27.0",
|
|
630
642
|
"jsdom": "^26.1.0",
|
|
631
643
|
"react": "^18.2.0",
|
package/dist/chunk-4JSBIW5H.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_TREE_WORDS as e}from"./chunk-K56YDHYQ.js";import{useContext as r,createContext as a,isValidElement as o}from"react";import{Tree as n,TreeGroupLabel as l,TreeGroup as i,Tooltip as s,TreeRow as t,IconButton as d,TreeSeam as c,TreeEmptySlot as m}from"efficient-shell/ui";import{jsx as p,jsxs as g,Fragment as u}from"react/jsx-runtime";var h,b=()=>h??=a(1),f=()=>r(b());function k({className:r,children:a,rootProps:o,ariaLabel:l,words:i=e}){/* @__PURE__ */
|
|
2
|
-
return p(n,{"aria-label":l??i.name??e.name,className:r?`es-tree ${r}`:"es-tree",rootProps:o,children:a})}function v({children:e,count:r,expanded:a,onToggle:o}){/* @__PURE__ */
|
|
3
|
-
return p(l,{count:r,expanded:a,onToggle:o,children:e})}function w({children:e}){const r=f(),a=b();/* @__PURE__ */
|
|
4
|
-
return p(a.Provider,{value:r+1,children:/* @__PURE__ */p(i,{children:e})})}var N=e.dragHint,P=e=>[e].flat(1/0).some(e=>o(e)&&!0===e.props.pressed);function T({icon:r,name:a,preview:o,selected:n,hidden:l,draggable:i,dragHint:d,dragging:c,drop:m,fold:h,actions:b,nameSlot:k,onSelect:v,marks:w,badge:N,trailing:T,children:y,rowProps:A,level:S,words:x=e}){const H=f(),j=["es-tree-row",n?"is-selected":"",l?"is-hidden":"",i?"is-draggable":"",c?"is-dragging":"",m?`is-drop-${m}`:""].filter(Boolean).join(" "),B=/* @__PURE__ */g(u,{children:[
|
|
5
|
-
/* @__PURE__ */p("span",{className:"es-tree-name",children:a}),w?.map(e=>/* @__PURE__ */p(s,{content:e.label,children:/* @__PURE__ */p("span",{className:"es-tree-mark","aria-label":e.label,role:"img",children:e.icon})},e.key)),T?/* @__PURE__ */p(s,{content:T.label,children:/* @__PURE__ */p("span",{className:"es-tree-trailing","aria-label":T.label,role:"img",children:T.icon})}):null,y]}),C=A?.onClick,$={click:!1},D=C?e=>{C(e),$.click=!0,queueMicrotask(()=>{$.click=!1})}:void 0,L=v?()=>{$.click||v()}:void 0;/* @__PURE__ */
|
|
6
|
-
return p(t,{label:B,level:S??H,icon:r,preview:o,selected:!!n,expanded:h?h.open:void 0,onToggle:h?.onToggle,onSelect:L,muted:!!l,badge:N,actions:b,actionsPinned:P(b),rename:k,drop:m,dragging:!!c,draggable:!!i,dragHint:d??x.dragHint,className:j,rowProps:{...A,onClick:D,...i?{"aria-keyshortcuts":"Alt+ArrowUp Alt+ArrowDown"}:{}}})}function y({kind:e,label:r,onClick:a,pressed:o,disabled:n,children:l}){/* @__PURE__ */
|
|
7
|
-
return p(s,{content:r,children:/* @__PURE__ */p(d,{"aria-label":r,"aria-pressed":o,"aria-disabled":n||void 0,variant:"delete"===e?"ghost-danger":"ghost",size:"sm","data-kind":e,className:n?"es-tree-act-off":void 0,onClick:e=>{e.stopPropagation(),a()},children:l})})}function A({drop:e,onAdd:r,label:a,seamProps:o}){const n=["es-tree-seam",e?"is-drop":"",r?"has-add":"",o?.className??""].filter(Boolean).join(" "),l={...o,className:n};/* @__PURE__ */
|
|
8
|
-
return p(c,{drop:!!e,onInsert:r,label:a,seamProps:l})}function S({drop:r,onAdd:a,label:o,seamProps:n,words:l=e}){const i=o??(a?l.addBlock??e.addBlock:l.emptySlot??e.emptySlot),s={...n,className:n?.className?`es-tree-empty ${n.className}`:"es-tree-empty"};/* @__PURE__ */
|
|
9
|
-
return p(m,{drop:!!r,onAdd:a,label:i,slotProps:s})}export{k as LayersTree,w as Subtree,N as TREE_DRAG_HINT,S as TreeEmptySlot,v as TreeGroupLabel,T as TreeRow,y as TreeRowAction,A as TreeSeam};
|
package/dist/chunk-EL4F3IN7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"};var a={savedAgo:function({seconds:e}){const a=Math.max(0,Math.floor(e));if(a<1)return"Saved just now";if(a<60)return`Saved ${a} second${1===a?"":"s"} ago`;const n=Math.floor(a/60);if(n<60)return`Saved ${n} minute${1===n?"":"s"} ago`;const o=Math.floor(n/60);return`Saved ${o} hour${1===o?"":"s"} ago`},saved:"All changes saved",saving:"Saving",pending:"Changes not saved yet — saving in a moment",failedIn:({seconds:e})=>`Not saved — trying again in ${e} s`,failedSoon:"Not saved — trying again soon",offline:"You’re offline — we’ll save when you’re back",pausedHeld:"Auto-save is off — changes not saved",paused:"Auto-save is off",locked:({editing:e})=>`Not saving — ${e}`,blockedOffline:"You’re offline. Try again when you’re back online.",blockedFailed:"Your last changes are not saved yet. Try again when they are.",blockedConflict:"Your last save was refused. See the notice below."},n={loading:"Loading",waitingForAuthorization:"Waiting for editor authorization",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageSettings:"Page settings",header:"Header",footer:"Footer",pageSections:"Page",templateSections:"Template",addSection:"Add section",addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,canvasAddBlock:"Add block",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel",leave:{title:"Unsaved changes",body:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them.",cancel:"Cancel",discard:"Discard & leave",save:"Save & leave",saving:"Saving"},bar:{undo:"Undo",redo:"Redo",refresh:"Reload the preview",refreshTip:"Reload the preview (keeps your place)",notSaving:"Not saving — see the notice below",retry:"Retry now",autoSaveOff:"Auto-save is off — click to turn it back on (saves your held edits)",autoSaveOn:"Auto-save is on — click to pause it",views:"Left panel views",saveOptions:"Save options",autoSave:"Auto-save",saveNow:"Save now"},saveStatus:a,menu:{undo:"Undo",redo:"Redo",collapseAll:"Collapse all layers",selectAll:"Select all",pinned:"Pinned — can’t be moved or deleted",clipboardRefused:"Your browser won’t let us read the clipboard — press ⌘V"},layers:"Layers",expandAll:"Expand all sections",collapseAll:"Collapse all sections",nothingToFold:"Nothing to fold on this page",rename:"Rename",deleteNamed:({name:e})=>`Delete ${e}`,hideNamed:({name:e})=>`Hide ${e}`,showNamed:({name:e})=>`Show ${e}`,addBlockHere:"Add block here",sectionFirst:({name:e})=>`“${e}” is already first`,sectionLast:({name:e})=>`“${e}” is already last`,sectionMoved:({name:e,n:a,total:n})=>`Moved “${e}” to position ${a} of ${n}`,sectionAdded:({name:e})=>`Added “${e}” section`,deleted:({name:e})=>`Deleted “${e}”`,resizeSettingsPanel:"Resize settings panel",sectionSettings:({name:e})=>`${e} settings`,headerSettings:"Header settings",addBlockMenu:"Add block",deviceNote:{tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."}};export{e as DEFAULT_SCREEN_ADD_WORDS,a as DEFAULT_SCREEN_SAVE_STATUS_WORDS,n as DEFAULT_SCREEN_WORDS};
|
package/dist/chunk-INIPQLPR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-NFLO4I2N.js";import{SELECTION_MODE as e}from"./chunk-SPQOPWCL.js";import{decodePartId as r,encodePartId as t}from"./chunk-IYT6NN2J.js";import{useEasel as n}from"./chunk-BU2YSTLJ.js";import{usePreviewParts as p}from"./chunk-I54UCYOU.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=n(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=p(),l=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),I?.(n)):i(o=>"part"===o.kind?e:o)},[i,I]);c(()=>{k(l)},[k,l]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=a(o);r&&u.select(r)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
|
package/dist/chunk-MI54XTWD.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-XDZHKYQX.js";import{blockRuns as l}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as c,useScreenBlockRules as a}from"./chunk-SPQOPWCL.js";import{useEaselSession as p}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-EL4F3IN7.js";import{useEasel as d}from"./chunk-BU2YSTLJ.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{AddPanel as y}from"./chunk-POSLNRTO.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-KAML3KQH.js";import{useState as u,useEffect as k,useMemo as b}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as j,jsxs as v,Fragment as L}from"react/jsx-runtime";var O=e=>`section:${e}`,T=e=>`block:${e}`,$=e=>`template:${e}`;function w({at:w,placeBlocks:B,canTake:E,onPick:N,itemFor:P,session:x,siteWide:A,onClose:H,onHide:I,readOnly:S}){const C=d(e=>e.config),D=c(),{labelAtLevel:F,categoryLabel:K,firstSection:M,Icon:Q,Thumbnail:R}=D,{blockIsOffered:W,canAddTo:Y}=a(),Z=f("screen",m).add,V=f("drag",h).add,z=p(),[J,X]=u([]);k(()=>{let t=!1;const o=e=>W(e,z);return s(z).list().then(n=>{if(t)return;const s=C.components;X(n.filter(t=>t.node?.type&&s[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[C,z]);const G=b(()=>t(C,D),[C]),U=e=>({type:O(e.type),label:e.name,cover:/* @__PURE__ */j(R,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:Z.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=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=J.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null},_=e=>/* @__PURE__ */j("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */j(Q,{type:e,size:26})}),ee=b(()=>{const e=o(G,M),t=/* @__PURE__ */new Map,s=e=>{e.retired||t.has(e.type)||!W(e.type,z)||t.set(e.type,e)};for(const t of e?[e]:G){const e=Y(t.type)?.choices??[];e.forEach(s),e.forEach(e=>Y(e.type,1)?.choices?.forEach(s))}B?.forEach(s);const i=new Set(G.map(e=>e.type)),r=[...t.values()].filter(e=>!i.has(e.type)),c=e=>({type:T(e.type),label:e.label,cover:_(e.type),title:Z.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>t.has(e.type)?{...U(e),cover:_(e.type)}:U(e),p=[];J.length>0&&p.push({key:"templates",title:Z.templates,tiles:J.map(e=>{return{type:$(e.id),label:e.name,cover:/* @__PURE__ */j(R,{type:e.node.type}),keywords:[(t=e.node.type,F(t,"section",C.components[t]?.label??t)),e.node.type]};var t})});const m=r.filter(e=>!e.group);let d=!1;for(const t of Object.keys(C.categories??{})){const o=G.filter(e=>e.cat===t);if(0===o.length)continue;const s=e&&o.some(t=>t.type===e.type)?e:null,i=(s?[s,...o.filter(e=>e.type!==s.type)]:o).map(a);s&&!d&&(i.splice(1,0,...m.map(c)),d=!0),p.push({key:`category:${t}`,title:n(C,t,K),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(c)],d=!0),l(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(c)})}),!E)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=q(e.type),o=t?E(t):null;return o?{...e,disabled:!0,disabledReason:o}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...y.filter(h),...y.filter(e=>!h(e))]},[J,G,C,Z,E,B,z]);/* @__PURE__ */
|
|
2
|
-
return v(L,{children:[
|
|
3
|
-
/* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:Z.title,context:Z.contextAll,actions:/* @__PURE__ */j(r,{label:Z.done,description:Z.doneDescription,onClick:H}),onHide:I}),
|
|
4
|
-
/* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */j(y,{groups:ee,session:x,itemFor:e=>P(q(e)??{kind:"section",type:e}),onInsert:N?e=>{const t=q(e);t&&N(t)}:void 0,at:w,hint:Z.hint,searchLabel:Z.search,readOnly:S,words:V}),A??null]})]})}export{w as AddSidePanel,T as blockKey,O as sectionKey,$ as templateKey};
|
package/dist/chunk-POSLNRTO.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_DRAG_WORDS as e}from"./chunk-KAML3KQH.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as a,isNoOpDrop as r}from"./chunk-67GNT6PF.js";import{withTip as s}from"./chunk-P2VEMZH5.js";import{useCanvasLayout as o,useCanvasTyping as i,useCanvasEvent as c,CANVAS_TYPABLE_EVENT as d,framePointToHost as h,elementScale as u,frameRectToLayer as f,clientPointToLayer as p}from"./chunk-X4T6JT3M.js";import{parseZoneKey as m}from"./chunk-KRXQM65X.js";import{useRef as g,useEffect as b,useState as x,useCallback as y,useMemo as v,useSyncExternalStore as w,useId as k,useLayoutEffect as N}from"react";import{Tooltip as A,IconButton as z,solidSurfaceStyle as D,Input as T}from"efficient-shell/ui";import{AddIcon as $,CloseIcon as M,SearchIcon as C}from"efficient-shell/icons/efficient";import{jsxs as S,jsx as E}from"react/jsx-runtime";function j({label:e,onInsert:t,style:n,axis:l="y",className:a,index:r}){const s=["es-canvas-insert","x"===l?"is-x":"",a??""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
2
|
-
return S("div",{className:s,style:n,"data-index":r,children:[
|
|
3
|
-
/* @__PURE__ */E("span",{className:"es-canvas-insert-line","aria-hidden":"true"}),
|
|
4
|
-
/* @__PURE__ */E("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */E(A,{content:e,children:/* @__PURE__ */E(z,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */E($,{})})})})]})}var L=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,K=e=>e.width*e.height;function B(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>L(e.box,t,n)).sort((e,t)=>K(t.s.box)-K(e.s.box)||e.at-t.at).map(({s:e})=>e)}function q(e,t,n){return B(e,t,n).at(-1)??null}function X(e,t,n){const l="x"===e.axis?t:n;let a=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(a+=1)}return a}function I(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],a=n[t],r=l&&a?(l.left+l.width+a.left)/2:l?l.left+l.width:a?a.left:e.box.left,s=a??l??e.box;return{left:r-1,top:s.top,width:2,height:s.height}}const l=n[t-1],a=n[t],r=l&&a?(l.top+l.height+a.top)/2:l?l.top+l.height:a?a.top:e.box.top;return{left:e.box.left,top:r-1,width:e.box.width,height:2}}function O(e,t,n,l,a=()=>!1,r=()=>!0){const s=e.filter(e=>L(e.box,t,n)).sort((e,t)=>K(e.box)-K(t.box));for(const e of s){const s=X(e,t,n),o={...e.list,index:s};if(a(o))return null;if(l(o))return{zone:e,to:o,line:I(e,s)};if(!r(o))return null}return null}function P(e,t,n=12){const l=e.children;if(0===l.length)return[];const a=e.box,r="x"===e.axis,s=r?a.left:a.top,o=s+(r?a.width:a.height),i=e=>r?e.left:e.top,c=e=>r?e.left+e.width:e.top+e.height,d=[];for(let h=0;h<=l.length;h++){const u=l[h-1],f=l[h];let p,m;if(u&&f)p=c(u),m=Math.max(i(f)-p,0);else{const e=u?(c(u)+o)/2:(s+i(f))/2;p=Math.min(Math.max(e,s+n),o-n),m=0}const g=r?{left:p,top:a.top,width:m,height:a.height}:{left:a.left,top:p,width:a.width,height:m};d.push({key:`${e.key}:+${h}`,place:{...e.list,index:h},box:g,axis:e.axis,label:t})}return d}function H(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const a=e.children[l-1],r=e.children[l],s=a.top+a.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:s,width:e.box.width,height:Math.max(r.top-s,0)}})}return n}var R={nodes:[],zones:[]},Z="data-puck-dropzone",F="data-puck-component";function Q(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 V(e,t){const{frame:n,document:l}=e,a=e=>f(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),r=[],s=[];for(const e of l.querySelectorAll(`[${Z}]`)){const t=e.getAttribute(Z)??"";let n;try{n=m(t)}catch{continue}const l=[...e.querySelectorAll(`[${F}]`)].filter(t=>t.parentElement?.closest(`[${Z}]`)===e),o=l.map(a);s.push({key:t,list:n,box:a(e),axis:Q(o,e),children:o}),l.forEach((e,t)=>{const l=e.getAttribute(F);l&&r.push({id:l,place:{...n,index:t},box:o[t]})})}return{nodes:r,zones:s}}var Y="data-es-empty-cell",G="data-puck-dropzone",J=140;var W=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function U(s){const{canvas:f,session:m,readOnly:k,words:z=e.canvas}=s,T=g(s);b(()=>{T.current=s});const $=g(null),M=o(f),[C,L]=x(0),K=y(()=>L(e=>e+1),[]),[q,X]=x(R);b(()=>{const e=$.current;f&&e&&X((T.current.measure??V)(f,e))},[f,M,s.revision,C]);const I=s.model,P=v(()=>I(q),[I,q]),H=w(m.subscribe,m.shown,m.shown),Z=s.choose,F=(e,t)=>{const n=B(P.sources,e,t);return 0===n.length?null:Z?Z(n):n[n.length-1]},[Q,J]=x(null),[U,_]=x(null),ee=g(null),te=()=>{ee.current&&clearTimeout(ee.current),ee.current=null},ne=()=>{te(),ee.current=setTimeout(()=>{m.get()||J(null)},140)};b(()=>te,[]);const le=g(null),ae=i(f),re=g(!1);re.current=ae,b(()=>{ae&&(te(),J(null))},[ae]);const[se,oe]=x(null);c(f,d,e=>oe(e.detail?.id??null));const ie=!se||ae||k||H?null:q.nodes.find(e=>e.id===se)?.box??null;c(f,"mousemove",e=>{const t=$.current;if(!f||!t)return;const n=h(f.frame,e.clientX,e.clientY,t),l=u(t),a={x:n.x/l,y:n.y/l};if(le.current=a,T.current.readOnly||m.get()||re.current)return;te();const r=F(a.x,a.y);J(e=>e?.key===r?.key&&e?.box===r?.box?e:r)}),c(f,"mouseout",e=>{e.relatedTarget||(le.current=null,ne())}),c(f,"mouseover",e=>{e.relatedTarget||K()});const ce=g(null),de=y(()=>{ce.current?.(),ce.current=null,_(null)},[]);b(()=>m.subscribe(()=>{m.get()?K():de()}),[m,de,K]),b(()=>de,[de]),("undefined"==typeof document?b:N)(()=>{if(m.get())return;const e=le.current;J(t=>k||re.current?null:e?F(e.x,e.y):t?P.sources.find(e=>e.key===t.key)??null:null)},[P,H,m,k,Z]);const he=e=>{const t=m.get(),n=$.current;if(!t||!n)return null;const l=p(n,e.clientX,e.clientY);le.current=l;const a=O(P.zones,l.x,l.y,e=>T.current.canDrop(t.item,e),e=>!!t.from&&r(t.from,e),e=>T.current.fallThrough?.(t.item,e,t.from)??!0);return a?{h:t,t:a}:null},ue={onDragEnter:e=>{if(ce.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),r=f?l(f.document):null,s=[];t&&s.push(a(t)),r&&f&&s.push(a(r,f.frame)),ce.current=s.length?()=>s.forEach(e=>e()):null},onDragOver:e=>{const n=he(e);if(!n)return void _(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};_(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)||(le.current=null,_(null))},onDrop:e=>{const t=he(e);t&&(e.preventDefault(),m.end(),de(),T.current.onDrop(t.h.item,t.t.to))}},fe={draggable:!k&&!!Q,onMouseEnter:te,onMouseLeave:()=>!m.get()&&ne(),onDragStart:e=>{if(Q&&!k){m.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:()=>{m.end(),de()},onClick:()=>{Q&&!k&&T.current.onPick?.(Q.item)}},{seams:pe=[]}=P,me=P.zones.filter(e=>0===e.children.length),ge=!s.onZoneAdd||k||ae?[]:me,be=ge.map(e=>e.key).join("\n");return b(()=>{const e=f?.document;if(!e)return;const t=new Set(be?be.split("\n"):[]);for(const n of e.querySelectorAll(`[${G}]`))n.toggleAttribute(Y,t.has(n.getAttribute(G)??""));return()=>{for(const t of e.querySelectorAll(`[${Y}]`))t.removeAttribute(Y)}},[f,be,q,M,C]),/* @__PURE__ */S("div",{ref:$,className:"es-canvas-layer",children:[H||!s.onSeamAdd||k||ae?null:pe.map(e=>
|
|
5
|
-
/* @__PURE__ */E(j,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??s.seamLabel??z.addSection,onInsert:()=>s.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),ge.length?ge.map(e=>/* @__PURE__ */E("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",U?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:W(e.box),onClick:()=>s.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */E("span",{className:"es-canvas-empty-add",children:z.addButton({label:e.addLabel??s.zoneAddLabel??z.addBlock})})},e.key)):null,H?/* @__PURE__ */E("div",{className:"es-canvas-catch",...ue}):null,U&&!me.some(e=>e.key===U.zoneKey)?/* @__PURE__ */E("div",{className:`es-canvas-line is-${U.axis}`,style:W(U.line)}):null,ie?/* @__PURE__ */E("span",{className:"es-canvas-hint"+(ie.width<200?" is-below":""),style:{...D(),left:ie.left+ie.width,top:ie.width<200?ie.top+ie.height:ie.top},children:z.typeHint}):null,
|
|
6
|
-
/* @__PURE__ */E("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__ */E(A,{className:"es-canvas-handle-tip",side:"top",content:!Q||k||H?null:Q.title??z.handle({label:Q.label}),children:/* @__PURE__ */S("div",{className:["es-canvas-handle",Q&&!k?"is-shown":"",H?"is-dragging":""].filter(Boolean).join(" "),...fe,children:[
|
|
7
|
-
/* @__PURE__ */E("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),Q?.label]})})})]})}var _=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function ee({groups:t,session:n,itemFor:l,onInsert:a,at:r,hint:o,searchLabel:i,readOnly:c,words:d=e.add}){const h=o??d.hint,u=i??d.search,[f,p]=x(""),m=k(),g=f.trim().toLowerCase(),b=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),y=t.map((e,t)=>({...e,key:b[t],tiles:g?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,g)):e.tiles})).filter(e=>e.tiles.length>0),v=(e,t)=>a=>{if(t)a.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),a.dataTransfer.effectAllowed="copy";try{a.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
|
|
8
|
-
return S("div",{className:"es-add",children:[r?/* @__PURE__ */S("div",{className:"es-add-at",role:"status",children:[
|
|
9
|
-
/* @__PURE__ */E("span",{children:r.label}),s(d.stop,/* @__PURE__ */E("button",{type:"button",className:"es-add-at-clear","aria-label":d.stop,onClick:r.onClear,children:/* @__PURE__ */E(M,{size:12,"aria-hidden":"true"})}))]}):null,
|
|
10
|
-
/* @__PURE__ */E("p",{className:"es-add-hint",children:h}),
|
|
11
|
-
/* @__PURE__ */E("div",{className:"es-add-find",children:/* @__PURE__ */E(T,{id:m,type:"search","aria-label":u,placeholder:d.searchPlaceholder({label:u}),value:f,onChange:e=>p(e.target.value),leftIcon:/* @__PURE__ */E(C,{size:16,"aria-hidden":"true"}),rightAdornment:f?/* @__PURE__ */E(z,{size:"sm","aria-label":d.clearSearch,onClick:()=>p(""),children:/* @__PURE__ */E(M,{size:12,"aria-hidden":"true"})}):void 0})}),0===y.length?/* @__PURE__ */S("div",{className:"es-add-empty",role:"status",children:[
|
|
12
|
-
/* @__PURE__ */E("div",{className:"es-add-empty-title",children:d.nothing({query:f.trim()})}),
|
|
13
|
-
/* @__PURE__ */E("div",{className:"es-add-empty-sub",children:d.tryAnother})]}):y.map(e=>/* @__PURE__ */S("section",{className:"es-add-group","aria-label":e.title,children:[
|
|
14
|
-
/* @__PURE__ */S("div",{className:"es-add-group-head",children:[
|
|
15
|
-
/* @__PURE__ */E("span",{className:"es-add-group-title",children:e.title}),
|
|
16
|
-
/* @__PURE__ */E("span",{className:"es-add-group-count",children:e.tiles.length})]}),
|
|
17
|
-
/* @__PURE__ */E("div",{className:_(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 s(l,/* @__PURE__ */S("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:v(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&a?.(e.type),children:[null!=e.cover?/* @__PURE__ */E("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */E("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
|
|
18
|
-
/* @__PURE__ */E("span",{className:"es-add-tile-label",children:e.label})]},e.type))})})]},e.key))]})}export{ee as AddPanel,U as CanvasDragLayer,j as CanvasInsert,R as EMPTY_MEASURE,J as HANDLE_GRACE_MS,O as canvasTarget,L as contains,X as gapInZone,I as gapLine,P as insertSeams,V as measureCanvas,q as pickSource,H as seamsBetween,B as sourcesAt};
|
package/dist/chunk-SHS6WCLL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{find as n,remove as t,getList as e,newId as r,duplicate as o,move as l,copyNode as a,insert as c,setProps as i,slotsOf as d}from"./chunk-KRXQM65X.js";import{useRef as s,useSyncExternalStore as u,useCallback as p,useMemo as f}from"react";var m=n=>({kind:"node",id:n});function x(r,o,l,a="none"){const c=n(r,o,l),i=t(r,o,l);if("none"===a||!c)return{data:i,select:null};const d=e(r,o,c.place)??[],s=d[c.place.index+1]??d[c.place.index-1];return s?.props?.id?{data:i,select:m(s.props.id)}:"root"!==c.place.parentId?{data:i,select:m(c.place.parentId)}:{data:i,select:null}}function g(t,e,l,a={}){const c=n(t,e,l)?.node,i=a.id??r(c?.type??"Node");return{data:o(t,e,l,{strip:a.strip,id:i}),select:m(i)}}function I(n,t,e,r){return{data:l(n,t,e,r),select:m(e)}}var h=(n,t)=>({min:0,max:t-1});function v(t,r,o,l,a=h){const c=n(t,r,o);if(!c)return!1;const i=e(t,r,c.place)?.length??0,{min:d,max:s}=a(c.place,i),u=c.place.index+l;return c.place.index>=d&&c.place.index<=s&&u>=d&&u<=s}function b(t,e,r,o,l=h){if(!v(t,e,r,o,l))return null;const a=n(t,e,r);return I(t,e,r,{...a.place,index:a.place.index+o})}function k(n,t,e,r,o={}){const l=a(e,t,{strip:o.strip});return{data:c(n,t,r,l),select:m(l.props.id)}}function y(t,r,o,l){if(n(t,r,o.props.id))return null;const a=e(t,r,l)??[],i={...l,index:Math.max(0,Math.min(l.index,a.length))};return{data:c(t,r,i,o),select:m(o.props.id)}}function M(n,t,e,r){return{data:i(n,t,e,r),select:void 0}}function O(t,e,r,o=()=>!1){if(!r)return null;if("slot"===r.kind)return n(t,e,r.parentId)?m(r.parentId):null;const l=n(t,e,r.id);if(!l||"root"===l.place.parentId)return null;const a=n(t,e,l.place.parentId);return a?o(a.node,l.place.slot)?{kind:"slot",parentId:a.node.props.id,slot:l.place.slot}:m(a.node.props.id):null}function z(t,e,r,o){const l=n(t,e,r);if(!l)return[];const a=l.path.filter(n=>"root"!==n.parentId).map(n=>n.parentId);return o?[...a.filter(r=>{const l=n(t,e,r);return!l||!o(l.node)}),r]:[...a,r]}function R(n,t){if(0===n.length)return null;const e=null===t?-1:n.indexOf(t);return-1===e?n[0]:n[Math.min(e+1,n.length-1)]}function B(t,e,r,o,l){const a=n(t,e,r);return a?0===d(a.node,e).length?r:R(z(t,e,r,l),o):null}function X(t,e,r,o,l,a,c){const i=n(t,e,r);if(!i)return null;if(0===d(i.node,e).length)return{node:r,part:o};const s="\0part:"+o,u=R([...z(t,e,r,c),s],l===r&&a===o?s:l);return u===s?{node:r,part:o}:{node:u??r,part:null}}function $(t,e,r){if(!r||"node"!==r.kind)return null;const o=n(t,e,r.id);return o?{zone:`${o.place.parentId}:${o.place.slot}`,index:o.place.index}:null}function j(n,t,r){if(!r)return null;const[o,l]=(r.zone??"root:default-zone").split(/:(.*)/s),a={parentId:o,slot:l},c=e(n,t,a)?.[r.index];return c?.props?.id?m(c.props.id):null}var K={get:()=>null,set:()=>{},subscribe:()=>()=>{}};function L(t){const e=s(t);e.current=t;const r=t.clipboard??K,o=u(r.subscribe,r.get,r.get),l=p(n=>{const t=e.current;if(t.readOnly)return!1;const r=n(t.data,t.config);return!!r&&((r.data!==t.data||void 0!==r.select)&&(t.commit(r.data,{select:r.select}),e.current={...t,data:r.data},!0))},[]);return f(()=>{const t=()=>e.current,r=(e,r)=>{const o=n(t().data,t().config,e);return o?{node:o.node,label:r,from:{parentId:o.place.parentId,slot:o.place.slot}}:null};return{held:o,remove:n=>l((e,r)=>x(e,r,n,t().afterRemove)),duplicate:n=>l((e,r)=>g(e,r,n,{strip:t().strip})),move:(n,t)=>l((e,r)=>I(e,r,n,t)),step:(n,e)=>l((r,o)=>b(r,o,n,e,t().stepBounds)),canStep:(n,e)=>v(t().data,t().config,n,e,t().stepBounds),setProps:(n,t)=>l((e,r)=>M(e,r,n,t)),copy:(n,e)=>{const o=r(n,e);return o&&(t().clipboard??K).set(o),!!o},cut:(n,e)=>{if(t().readOnly)return!1;const o=r(n,e);return!!o&&((t().clipboard??K).set(o),l((e,r)=>x(e,r,n,t().afterRemove)))},paste:n=>{const e=(t().clipboard??K).get();return!!e&&l((r,o)=>k(r,o,e.node,n,{strip:t().strip}))},restore:(n,t)=>l((e,r)=>y(e,r,n,t)),parentOf:n=>O(t().data,t().config,n,t().slotIsLevel)}},[o,l])}export{v as canStep,B as clickPick,X as clickPickPart,j as fromItemSelector,R as nextInChain,z as nodeChain,O as parentStep,g as planDuplicate,I as planMove,k as planPaste,x as planRemove,y as planRestore,M as planSetProps,b as planStep,$ as toItemSelector,L as useNodeOps};
|
package/dist/chunk-SPQOPWCL.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{usePickFollowsSelection as n}from"./chunk-R6WTQWAC.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-BU2YSTLJ.js";import{Inspector as i}from"./chunk-N3LYD2LK.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},O={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},j={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function S(){/* @__PURE__ */
|
|
2
|
-
return s(t,{height:"fill"})}function C(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var D=o({});function N({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(D.Provider,{value:n,children:e})}function P(){return u(D)}function B(){return(P().useOwnerName??v)()}function G(){return(P().useDocumentLabel??g)()}function T(n,e,t,r){return(P().useBridges??h)(n,e,t,r)}function x(n){return(P().useStandaloneBridges??h)(n)}function I(n,e){(P().useDocumentPass??y)(n,e)}function A(){return P().blockRules??b}function F(){return P().blockLook??L}function K(){return P().devices??O}function R(){return P().leftView??j}function Y(){return P().pinned??w}function V(){return P().saveSwitch??!0}function W(e){n(!0===P().pickFollowsSelection,e)}function E(){return P().storageNamespace||void 0}function H(){return P().styleClipboard??null}function J(){return P().nodeKeys??!0}function Q(){return P().notify??null}function U(){return P().Canvas??S}function Z(){return P().CanvasHead??null}function q(){return P().canvasDrag??null}var z=o(null);function M({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return s(z.Provider,{value:n,children:e})}function X(){return u(z)}function $(){return P().Inspector??C}export{c as SELECTION_MODE,M as ScreenCanvasTargetProvider,N as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,F as useScreenBlockLook,A as useScreenBlockRules,T as useScreenBridges,q as useScreenCanvasDrag,U as useScreenCanvasFrame,Z as useScreenCanvasHead,X as useScreenCanvasTarget,K as useScreenDevices,G as useScreenDocumentLabel,I as useScreenDocumentPass,$ as useScreenInspectorPanel,R as useScreenLeftView,J as useScreenNodeKeys,Q as useScreenNotify,B as useScreenOwnerName,P as useScreenParts,W as useScreenPickFollowsSelection,Y as useScreenPinned,V as useScreenSaveSwitch,E as useScreenStorageNamespace,H as useScreenStyleClipboard,x as useStandaloneScreenBridges};
|
package/dist/chunk-TBF5CVPA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{textFieldIdentifier as n}from"./chunk-DUVRZ456.js";import{hidableText as r}from"./chunk-6W7WLPZH.js";function t(n,t){const o=r(n.props.name);if(o)return o;const e=r(n.props.altName);if(e)return e;const c=n.props.collection?.name;if(c)return c;const u=n.props.source?.title;if(u)return u;const s=n.props.code;return s?t?.(s)??s:""}function o(n,r,o,e,c){const u=o(t(n,e))||r(n.type);return c?c(n,"block",u):u}function e(r){if(!r)return null;for(const t of["name","altName"])if(n(r[t]))return t;return null}function c(r){const t=r?.name;return void 0===t||n(t)?"name":null}function u(n,t,o){const e=r(n.props?.name).trim()||t;return o?o(n,"section",e):e}export{u as rootRowName,c as sectionRenameProp,t as slotChildName,e as slotChildRenameProp,o as slotChildRowName};
|
package/dist/chunk-WR3EVON3.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-XLUVTPKK.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as c,useEaselUndoKeys as a,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-JSH3XKEF.js";import{SlotChildActionsProvider as f}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-U277UX5I.js";import{usePartBridge as y}from"./chunk-INIPQLPR.js";import{useSectionOps as S}from"./chunk-NFLO4I2N.js";import{ScreenSaveIcon as k,ScreenMainButton as b}from"./chunk-7TOQCTHV.js";import{useBrowserOffline as v}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-MI54XTWD.js";import{SidePanelHead as z,PanelShowStrip as C}from"./chunk-XDZHKYQX.js";import{offeredChoices as B}from"./chunk-M2Z775ZC.js";import{MediaSidePanel as I}from"./chunk-V63ERBLW.js";import{useScreenSaveSwitch as N,useScreenNodeKeys as O,useScreenPinned as P,useScreenDocumentLabel as $,useScreenCanvasFrame as T,useScreenInspectorPanel as L,useScreenDevices as M,useScreenPickFollowsSelection as j,useScreenLeftView as A,SELECTION_MODE as R,sameInspectorMode as E,useScreenBridges as V,useScreenBlockRules as F,useScreenBlockLook as W,useScreenStorageNamespace as H,useScreenNotify as D,useScreenCanvasHead as U,isSlotMode as X,useScreenStyleClipboard as J,useScreenDocumentPass as G,useScreenCanvasDrag as K,ScreenCanvasTargetProvider as Y,isPinnedFirst as Z,isPinnedLast as q,screenSlotsOf as Q}from"./chunk-SPQOPWCL.js";import{useNodeClipboard as _,useNodeContextMenu as ee}from"./chunk-3ERZNZ5S.js";import{PageEditGuardNotices as ne}from"./chunk-4UBYPRAS.js";import{useScreenDocument as te}from"./chunk-MTNBJPXX.js";import{requestMediaPick as oe}from"./chunk-KG7RJWOK.js";import{useMediaPanel as re,usePanelPick as ie,useCancelPanelPick as le}from"./chunk-R6WTQWAC.js";import{useEaselSession as se}from"./chunk-O7Q4DDJT.js";import{useEaselHost as de,useHostEscape as ce}from"./chunk-U3JP4VGF.js";import{LayersIcon as ae,MediaIcon as pe}from"./chunk-4VJATVVR.js";import{DEFAULT_SCREEN_WORDS as ue}from"./chunk-EL4F3IN7.js";import{heldStyle as fe,styleShortcut as he}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as me}from"./chunk-6WY6ZXJG.js";import{rootRowName as ge,slotChildRowName as ye,slotChildRenameProp as Se,sectionRenameProp as ke}from"./chunk-TBF5CVPA.js";import{ROOT_ZONE as be,blockNodeActions as ve,TREE_MAX_DEPTH as we,childSlotsOf as xe,slotFieldsOf as ze,slotChildrenIn as Ce,nestsInTree as Be,newNodeId as Ie}from"./chunk-PLVEGYK6.js";import{useEasel as Ne,useEaselApi as Oe,CanvasPassThroughContext as Pe}from"./chunk-BU2YSTLJ.js";import{TreeRow as $e,Subtree as Te,LayersTree as Le,TreeGroupLabel as Me,TreeRowAction as je,TreeSeam as Ae}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Re}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ee}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ve,useNodeOps as Fe,clickPick as We}from"./chunk-SHS6WCLL.js";import{EaselTopBar as He,TopBarRail as De,TopBarCluster as Ue,EaselIconButton as Xe,TopBarDivider as Je,DeviceSwitch as Ge,InspectorIconButton as Ke,PanelResizeHandle as Ye,MAX_PANEL_W as Ze,MIN_PANEL_W as qe,panelWidthVars as Qe}from"./chunk-GWIVPLOX.js";import{DEFAULT_NOTICE_WORDS as _e,DEFAULT_CHROME_WORDS as en}from"./chunk-Z6PVRXVY.js";import{holderOf as nn,nameOrSomeone as tn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as on}from"./chunk-RE4LP46F.js";import{useWords as rn}from"./chunk-MFIRYGHW.js";import{insertSeams as ln,CanvasDragLayer as sn,CanvasInsert as dn}from"./chunk-POSLNRTO.js";import{DEFAULT_DRAG_WORDS as cn}from"./chunk-KAML3KQH.js";import{createDragSession as an,useTreeDrag as pn,gapToMoveIndex as un}from"./chunk-67GNT6PF.js";import{useCanvasFrame as fn,LIST_SELECTOR as hn,BLOCK_SELECTOR as mn,useCanvasTyping as gn,useCanvasEvent as yn,nodeIdAt as Sn,frameRectToHost as kn,BLOCK_ATTRIBUTE as bn,drawnBox as vn}from"./chunk-X4T6JT3M.js";import{ROOT_ID as wn,ROOT_SLOT as xn,zoneKey as zn,parseZoneKey as Cn,find as Bn,DataError as In}from"./chunk-KRXQM65X.js";import{useRef as Nn,useMemo as On,useState as Pn,useEffect as $n,useCallback as Tn,useLayoutEffect as Ln,Fragment as Mn}from"react";import{ColoredBadge as jn,toast as An,groupColors as Rn}from"efficient-shell/ui";import{UndoIcon as En,RedoIcon as Vn,RefreshIcon as Fn,AddIcon as Wn,TrashIcon as Hn,EyeOffIcon as Dn,EyeIcon as Un,DuplicateIcon as Xn}from"efficient-shell/icons/efficient";import{jsx as Jn,jsxs as Gn,Fragment as Kn}from"react/jsx-runtime";var Yn=/* @__PURE__ */new WeakSet;function Zn(e,n,t){const o=Bn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function qn({canvas:e,tabs:n,onSelect:t}){const o=Nn(null),[r,i]=Pn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Ln(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=kn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${bn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?vn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=kn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),a=s.top+s.height;if(a<d.top||s.top>d.top+d.height){c[o.id]=null;continue}const p=o.below?a+4:Math.max(s.top,d.top)+6;c[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(c)},c=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",c,!0),r.addEventListener("resize",c);const a=new r.MutationObserver(c);return a.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",c,!0),r.removeEventListener("resize",c),a.disconnect()}},[e,l]),/* @__PURE__ */Jn("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Jn("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:/* @__PURE__ */Jn(jn,{colorClass:Rn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function Qn({expand:e}){/* @__PURE__ */
|
|
2
|
-
return Jn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Gn(Kn,e?{children:[
|
|
3
|
-
/* @__PURE__ */Jn("path",{d:"M8 9l4-4 4 4"}),
|
|
4
|
-
/* @__PURE__ */Jn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
5
|
-
/* @__PURE__ */Jn("path",{d:"M8 4l4 4 4-4"}),
|
|
6
|
-
/* @__PURE__ */Jn("path",{d:"M8 20l4-4 4 4"}),
|
|
7
|
-
/* @__PURE__ */Jn("path",{d:"M5 12h14"})]})})}var _n=`${hn}, ${mn}`;function et(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var nt="__rungs";var tt="screen:band",ot={duplicate:!0,delete:!0};function rt(){const hn=de(),{target:kn,docId:bn,capabilities:vn,currentSlug:Rn,siteId:rt,onPublish:it,saveState:lt,saveConflict:st,retrySave:dt,toggleAutoSave:ct,flushSave:at,access:pt,saveUnreachable:ut=!1,readOnly:ft,readOnlyReason:ht=null}=te(),mt=N(),gt=O(),{mediaEditing:yt,hasEditGuard:St,hasPinnedChrome:kt}=vn,{appState:bt,dispatch:vt,history:wt,selectedItem:xt,getSelectorForId:zt,config:Ct}=Ne(e=>e),Bt=P(),{first:It,firstGroup:Nt,lastGroup:Ot,isSectionGroup:Pt,sectionGroupZone:$t,panelOf:Tt}=Bt,Lt=Tt(It),Mt=e=>Z(Bt,e),jt=e=>q(Bt,e),At="node"===Bt.firstRow,Rt=Bt.band??null,Et=rn("screen",ue),Vt=rn("tree",Re),Ft=rn("drag",cn),Wt=rn("notice",_e),Ht=rn("lock",on),Dt=rn("menu",Ee),Ut=rn("styleClipboard",me),Xt=rn("chrome",en),Jt=$()??`/${Rn}`,Gt=T(),Kt=L(),Yt=S({readOnly:ft}),Zt=S({readOnly:ft,foldIntoHistory:!0}),qt=Nn(null),Qt=Oe(),_t=On(()=>({...Yt,select:e=>{qt.current=e,Yt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Qt.config;qt.current=Ve(e,t,n)}Yt.commitDocument(e,n)}}),[Yt,Qt]),eo=bt.ui,no=eo.leftSideBarVisible,to=eo.rightSideBarVisible,{options:oo,widths:ro,initial:io,fluid:lo,fit:so}=M(),[co,ao]=Pn(io),po=re(),uo=yt&&null!==po,fo=ie(),ho=le();j(xt?.props.id);const{read:mo,write:go,forSelection:yo}=A(),[So,ko]=Pn(mo);$n(()=>{go(So)},[So]);const[bo,vo]=Pn(0),wo=Nn(null),xo=Nn(null),zo=fn(xo,{readySelector:_n}),Co=gn(zo),Bo=c(xo);a(xo,zo);const Io=v(),No=nn(pt),Oo={state:lt,offline:Io||lt.failed&&ut,readOnlyReason:ht,editing:No?Wt.editing({name:tn(No.name,Ht),noun:Et.noun}):null,conflict:null!=st,notSaving:Et.bar.notSaving},Po=()=>{ft||(lt.failed?dt():at())};p(xo,zo,Po);const[$o,To]=Pn(!1),Lo=Nn(!1),Mo=Nn(!1),[jo,Ao]=Pn(null),[Ro,Eo]=Pn([]),[Vo,Fo]=Pn(R),Wo="puck"===Vo.kind,Ho=t(Vo,xt?.props.id),[Do,Uo]=Pn(null);$n(()=>{Do&&(o(),Uo(null))},[Do]);const Xo=Nn(zt);Xo.current=zt;const Jo=Tn((e,{scroll:n})=>{ko(n=>yo(e,n)),n&&Uo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Xo.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&vr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Go=Nn(null);$n(()=>{const e=Go.current;Go.current=null;const n=null==xt?.props.id?null:String(xt.props.id);Fo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Tt(xt?.type)??R);const t=xt?.props.id,o=qt.current;if(qt.current=null,!t)return;const i=zt(t);Jo(String(t),{scroll:!r(o,i??null,be)})},[xt?.props.id,Jo]);const Ko=Tn(e=>{Fo(n=>E(n,e)?n:e),vt({type:"setUi",ui:{rightSideBarVisible:!0}})},[vt]),Yo=Nn(()=>{});Yo.current=(e,n)=>{const t=e?hi(e.zone??be)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==xt?.props.id?null:String(xt.props.id);Fo(e=>E(e,n)?e:n),o!==r&&(Go.current={id:o,mode:n},_t.select(e))};const Zo=Tn((e,n)=>Yo.current(e,n),[]),qo={kind:Vo.kind,mode:Vo,open:Ko,show:e=>Fo(e),reveal:()=>{to||vt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Zo},Qo=V(qo,{data:bt.data,selected:xt??null,zoneOf:e=>zt(e)?.zone,readOnly:Boolean(ft),select:e=>{Fo(R),_t.select({index:e})},replace:(e,n)=>_t.replaceComponent(be,e,n),scrollTo:e=>l(e)},{device:co,refreshes:bo},{setView:ko,reveal:()=>{no||vt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),_o=Qo.resolveLeftView?Qo.resolveLeftView(So,uo):"media"===So&&uo?So:"sections",er=F(),{isLockedBlock:nr,duplicateBlocked:tr,nestDepth:or,newSectionNode:rr,canAddTo:ir,blockIsOffered:lr}=er,sr=W(),{labelAtLevel:dr,Icon:cr,useProducts:ar}=sr,pr=sr.rowName?(e,n,t)=>sr.rowName(e,n,t):void 0,ur=Tn(e=>{vt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),Jo(e,{scroll:!0})},[vt,Jo]),{selectNode:fr,openPartId:hr}=y({mode:Vo,setMode:Fo,onOpenPart:ur}),[mr,gr]=Pn(null);ce(null!==mr,()=>gr(null));const yr=h(H()),Sr=yr.collapsed,kr=yr.panelWidths,[br,vr]=Pn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Sr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
8
|
-
return new Set}});$n(()=>{try{window.localStorage.setItem(Sr,JSON.stringify([...br]))}catch{}},[br]);const[wr,xr]=Pn(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem(kr);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left),right:g(Number(n.right)||m.right)}}catch{return{...m}}});$n(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(kr,JSON.stringify(wr))}catch{}},300);return()=>clearTimeout(e)},[wr]);const zr=Tn((e,n)=>xr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Cr=Tn(e=>zr("left",e),[zr]),Br=Tn(e=>zr("right",e),[zr]),Ir=e=>br.has(e),Nr=e=>vr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Or=Nn(!1),Pr=Nn(null);$n(()=>{if(Or.current&&!$o){const e=Pr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??xo.current?.querySelector(`button[aria-label="${CSS.escape(Et.add.title)}"]`))?.focus(),Pr.current=null}Or.current=$o},[$o]),$n(()=>{if(!$o||!Bo)return;const e=e=>{"Escape"===e.key&&Ji()};return Bo.addEventListener("keydown",e),()=>Bo.removeEventListener("keydown",e)},[$o,Bo]),ce($o,()=>Ji()),$n(()=>{!no&&$o&&(To(!1),Ao(null),Lo.current=!1)},[no]),$n(()=>{if(!fo)return Mo.current&&vt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Mo.current=!1);$o&&(To(!1),Ao(null),Mo.current=Lo.current,Lo.current=!1),no||(Mo.current=!0,vt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[fo]),$n(()=>{!no&&fo&&(Mo.current=!1,ho())},[no]),$n(()=>{if(!fo||!Bo)return;const e=e=>{"Escape"===e.key&&ho()};return Bo.addEventListener("keydown",e),()=>Bo.removeEventListener("keydown",e)},[fo,Bo]),ce(null!==fo,()=>ho());const $r=D(),Tr=(e,n="success",t)=>{if($r)return void(t?$r(e,"error"===n?"error":"info",t):$r(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?An.error(e,{...o,duration:t?.duration??3200}):An.success(e,{...o,duration:t?.duration??1900})},Lr=Nn(null),[Mr,jr]=Pn(0),[Ar,Rr]=Pn(0),Er=U(),Vr=Nn(null),Fr=e=>Math.max(0,e.clientHeight-(Vr.current?.offsetHeight??0));$n(()=>{const e=Lr.current;if(!e)return;const n=()=>{jr(e.clientWidth),Rr(Fr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Vr.current&&t.observe(Vr.current),()=>t.disconnect()},[]),Ln(()=>{Lr.current&&(jr(Lr.current.clientWidth),Rr(Fr(Lr.current)))},[wr,no,to]);const Wr=co===lo?Mr>0?Mr:ro[lo]:ro[co],Hr=Mr>0?Math.min(Mr/Wr,"shrink"===so?1:2):1,Dr=Wr*Hr,Ur=Mr>0&&Dr>Mr+1,Xr={width:Dr,height:Ar||"100%",flex:"none",position:"relative"},Jr={width:Wr,height:Ar?Ar/Hr:"100%",maxHeight:"none",transform:1!==Hr?`scale(${Hr})`:void 0,transformOrigin:"top left"},Gr=()=>vt({type:"setUi",ui:{leftSideBarVisible:!no}}),Kr=()=>vt({type:"setUi",ui:{rightSideBarVisible:!to}}),Yr=e=>{$o&&(To(!1),Ao(null),Lo.current=!1,no&&So===e)||fo&&(Mo.current=!1,ho(),no&&So===e)||(no&&So===e?Gr():(ko(e),no||vt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Zr=()=>{oe(hn,{accept:"image/*",title:Xt.mediaLibrary})},qr=()=>{Fo(R),_t.select(null),d()},Qr=()=>{Fo(Lt??R),to||vt({type:"setUi",ui:{rightSideBarVisible:!0}})},_r=bt.data.content??[],ei=()=>{const e=_r.findIndex(Mt),n=_r.findIndex(jt);return{floor:e>=0?e+1:0,cap:n>=0?n:_r.length}},ni=Ct,ti=er.stripCopy,oi=e=>i(e,ti),ri=_(),ii=Fe({data:bt.data,config:ni,readOnly:Boolean(ft),clipboard:ri,strip:ti?e=>ti(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==wn||e.slot!==xn)return{min:0,max:n-1};const{floor:t,cap:o}=ei();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Fo(R);const t=void 0===n||"node"===n?.kind?n:null;_t.commitDocument(e,t)}}),li=e=>{const n=Bn(bt.data,Ct,e);if(!n)return!1;const t=zn(n.place),o=n.node,r=t===be?pi(o):Ci(o);return!!ii.remove(e)&&(Tr(Et.deleted({name:r}),"success",{duration:8e3,action:{label:Et.bar.undo,onClick:()=>{ii.restore(n.node,n.place)}}}),!0)},si={...ii,remove:li},di=e=>dr(e,"block",Ct.components[e]?.label??e),ci=Tn(e=>Ct.components[e]?.defaultProps??{},[Ct]),ai=e=>dr(e,"section",di(e)),pi=e=>ge({type:e.type,props:e.props??{}},ai(e.type),pr),{nodeAddresses:ui,zoneItems:fi}=On(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=we)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of xe(Ct,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(_r,be,0),{nodeAddresses:e,zoneItems:n}},[_r,Ct]),hi=Tn(e=>fi.get(e)??[],[fi]),mi=e=>{const n=ui.get(e);return n?hi(n.zone)[n.index]:void 0},gi=e=>Q(er,Ct,e),yi=e=>{if(!er.slotsOf||e===be)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=mi(e.slice(0,n));if(!t)return null;const o=gi(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},Si=(()=>{if(!X(Vo))return null;const e=`${Vo.nodeId}:${Vo.slot}`;return yi(e)?.slot.panel===Vo.kind?e:null})(),ki=Nn(null);$n(()=>{const e=ki.current;if(ki.current=null,!Si||!X(Vo))return;const n=Vo.nodeId;Jo(n,{scroll:e!==Si}),vr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Vo]);const bi=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ui.get(e);n&&(n.zone===be?Vi(n.index):ul(n.zone,n.index,e,mi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Si!==i&&(ki.current=i),Zo(null,r),to||vt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},vi=(e,n,t)=>{const o=`${e}:${n}`;if(vr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;Si!==o&&(ki.current=o);Zo(null,{kind:t,nodeId:e,slot:n})},wi=(e,n,t)=>{if(ft||!er.moveSlot)return;const o=mi(e),r=o?gi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:nt,index:n},s=un(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=er.moveSlot(e,n,s);"string"==typeof d&&vi(e,d,i.panel)},xi=ar(),zi=On(()=>{const e=/* @__PURE__ */new Map;for(const n of xi??[])e.set(n.slug,n.name);return e},[xi]),Ci=e=>ye(e,di,sr.plainText,e=>zi.get(e),sr.rowName),Bi=(e,n)=>{const t=Ct.components[e.type]?.fields,o=n===be||Ll(n)?"section":"block",r=n===be&&(Mt(e)||jt(e)||Pt(e.type)),i="block"===o?Se(t):r?null:ke(t);return sr.renamePropOf?sr.renamePropOf(e,o,i):i},Ii=(e,n,t,o)=>{if(!(!ft&&mr?.zone===e&&mr.index===n))return;const r=(t,o)=>{gr(null),o&&((e,n,t)=>{const o=hi(e)[n];if(!o)return;const r=Bi(o,e);r&&_t.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
9
|
-
return Jn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Et.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},Ni=n(J(),Ut),Oi=Ni.scope({target:kn,siteId:rt,docId:bn}),Pi=Ct,$i=(e,n)=>n===be?ai(e):di(e),Ti=(e,n,t)=>{const o=Ni.plan(Oi,t,$i(t.type,e),Pi);o&&(o.changed&&_t.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Tr(o.message))},Li=ee({nodesIn:hi,nodeAt:(e,n)=>hi(e)[n]??null,labelOf:(e,n)=>n===be?ai(e):di(e),renamePropOf:Bi,beginRename:(e,n)=>gr({zone:e,index:n}),history:{hasPast:wt.hasPast,hasFuture:wt.hasFuture,back:()=>wt.back(),forward:()=>wt.forward()},openPageSettings:()=>{_t.select(null),Fo(R)},pageSettingsLabel:Et.pageSettings,words:{menu:Dt,styleClipboard:Ut,screen:Et.menu},readOnly:Boolean(ft),collapseAll:()=>vr(new Set(hi(be).map(e=>String(e.props.id)))),onPasteRefused:e=>Tr(e?Et.pasteRefused({name:e.label}):Et.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Al(e,n),menuRows:Qo.menuRows,isLocked:e=>nr(e.type),duplicateBlocked:e=>tr(bt.data,e),permits:e=>ve(Ct,e.type),nodeOps:si,isPinned:(e,n)=>n===be&&(Mt(e)||jt(e)),sectionBand:ei,locate:e=>ui.get(e)??null,rowNameOf:(e,n)=>n===be?pi(e):Ci(e),selectAt:(e,n,t,o)=>{e===be?Vi(n):ul(e,n,t,o??"")},slotRung:e=>{const n=yi(e);return n?.slot.panel?{label:n.slot.label,select:()=>bi(n.node,n.slot,!1)}:null},style:{held:()=>fe(Oi),canCopy:e=>Ni.rows(Pi,e).some(e=>!1!==e.counted),copy:(e,n)=>Ni.copy(Oi,e,$i(e.type,n),Pi),paste:(e,n,t)=>Ti(e,n,t)},keys:gt?{target:Bo,selected:()=>{const e=bt.ui.itemSelector;return e?{zone:e.zone??be,index:e.index}:null},held:()=>ri.get(),readOnly:Boolean(ft),onDone:({done:e,name:n})=>{"copied"===e&&Tr(Et.copied({name:n}))}}:void 0},zo),Mi=Nn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});$n(()=>{Mi.current={copy:(e,n)=>Ni.copy(Oi,e,$i(e.type,n),Pi),paste:Ti,at:()=>{const e=bt.ui.itemSelector;if(!e)return null;const n=e.zone??be,t=hi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(ft)}});const ji=Tn(e=>{const n=he(e);if(!n)return;const t=Mi.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);$n(()=>{if(!Bo)return;const e=e=>ji(e);return Bo.addEventListener("keydown",e),()=>Bo.removeEventListener("keydown",e)},[ji,Bo]),yn(zo,"keydown",ji);const Ai=_r.map(e=>e.props.id).join("|");$n(()=>{const e=zo?.document??null,n=zo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Eo(e=>e.length?[]:e);const n=_r.findIndex(jt),t=n>=0?n:_r.length,o=n=>{const t=_r[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(mn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=_r.length>0&&!Mt(_r[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=et(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Eo(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[zo,Ai,co,Hr,no,to,xt?.props.id]);const Ri=zo?.document??null,Ei=zo?.window??null;$n(()=>{const e=wo.current;if(!e||!Ri||!Ei)return;const n=[],t=()=>{const n=Ri.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Ei.scrollTo({left:Ei.scrollX,top:Ei.scrollY+t,behavior:"instant"}),!0};return wo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ri,Ei]);const Vi=e=>{Fo(R),_t.select({index:e}),Qo.sectionPressed?.(_r[e]);const n=_r[e]?.props?.id;n&&l(n)},Fi=e=>{const{floor:n,cap:t}=ei(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=xt&&Vo.kind!==Lt?.kind?_r.findIndex(e=>e.props.id===xt.props.id):-1;return o(r>=0?r+1:t)},Wi=(e,n)=>{const{floor:t,cap:o}=ei(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(_t.reorderComponent(be,e,i),_t.select({index:i}),{moved:!0,dest:i})},Hi=(e,n,t,o)=>{Fo(R),_t.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Tr(Et.sectionAdded({name:t}))},Di=(e,n)=>{const t=Fi(n),o=rr(e,{nodeDefaults:ci,newNodeId:Ie,sectionLabel:ai,blockIsOffered:lr}),r=o?_t.insertNode(be,t,o):_t.insertSection(e,t);return Hi(t,r,ai(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of xe(Ct,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=ir(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:c,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Ui=e=>Xi(be,e),Xi=(e,n)=>{Pr.current=document.activeElement??null,fo&&(Lo.current=Mo.current,Mo.current=!1,ho()),Ao(null===n?null:{zone:e,index:n}),To(!0),no||(Lo.current=!0,vt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ji=()=>{To(!1),Ao(null),Lo.current&&vt({type:"setUi",ui:{leftSideBarVisible:!1}}),Lo.current=!1},Gi=(e,n)=>sr.rowName?n?Mt(e)?sr.rowName(e,"section",Et.header):jt(e)?sr.rowName(e,"section",Et.footer):Pt(e.type)?sr.rowName(e,"section",di(e.type)):pi(e):Ci(e):n?ai(e.type):di(e.type),Ki=e=>n=>{e()},Yi=(e,n,t)=>{if(ft)return null;const o=hi(e)[n];return o&&!ve(Ct,o.type).delete?null:/* @__PURE__ */Jn(je,{kind:"delete",label:Et.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=hi(e)[n]?.props?.id;null!=t&&li(String(t))})(e,n),children:/* @__PURE__ */Jn(Hn,{size:15})})},Zi=e=>sr.rowPreview?.(e)||void 0,qi=e=>sr.rowMarks?.(e)??void 0,Qi=(e,n,t)=>sr.rowActions?.(e,n,t)??null,_i=(e,n,t,o)=>{if(ft)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
10
|
-
return Jn(je,{kind:"eye",label:r?Et.showNamed({name:o}):Et.hideNamed({name:o}),onClick:()=>nl(e,n,t),children:/* @__PURE__ */Jn(r?Dn:Un,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},el=e=>fs(be,e),nl=(e,n,t)=>{_t.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},tl=e=>ze(Ct,e),ol=e=>xe(Ct,e),rl=e=>er.slotsOf?gi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Ce(e,n.slot)})):[{slot:null,rung:null,kids:ol(e)}],il=e=>er.slotsOf?rl(e).flatMap(e=>e.kids):ol(e),ll=e=>Boolean(er.slotsOf)&&gi(e).some(e=>e.rung),sl=(e,n,t)=>null===t?void 0===n?ir(e):ir(e,n):ir(e,n,t),dl=(e,n,t)=>{const o=Be(Ct,e.type,n)&&(t||il(e).length>0||ll(e));return{collapsible:o,folded:o&&Ir(String(e.props.id))}},cl=(e,n,t)=>rl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>dl(e,r,t(e.type)).collapsible?[String(e.props.id),...cl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),al=e=>il(e).length>0||ll(e)||Boolean(ir(e.type)),pl=e=>Boolean(ir(e)),ul=(e,n,t,o)=>{if(Fo(R),ir(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),_t.select({index:n,zone:e}),l(t)}else _t.select({index:n,zone:e}),l(t)},fl=(e,n,t,o,r)=>{const i=`${e}:${n}`;_t.insertComponent(i,t,o),ir(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),_t.select({index:o,zone:i})}):_t.select({index:o,zone:i})},hl=Nn(/* @__PURE__ */new Set);$n(()=>{_r.forEach(e=>{const n=ir(e.type)?.spec;if(!n)return;const t=e.props.id;if(hl.current.has(t))return;hl.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(ci)).forEach((e,t)=>Zt.seedChild(o,t,n.childType,e))})},[_r,Zt,ci]);const ml=Nn(/* @__PURE__ */new Set);$n(()=>{_r.forEach((n,t)=>{const o=n.props.id;if(ml.current.has(o))return;const r=e(n,tl(n.type));ml.current.add(o),r&&Zt.replaceComponent(be,t,{...n,props:r})})},[_r,Zt]),G(Zt,Ct);const gl=_r.findIndex(jt),yl=gl>=0?_r[gl]:null,Sl=At?_r.findIndex(Mt):-1,kl=Sl>=0?_r[Sl]:null,bl=Bt.groupTab,vl=On(()=>bl?e=>Pt(e.type):void 0,[bl]),wl=Boolean(Bt.groupBadge),xl=Bt.groupBadge?/* @__PURE__ */Jn("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Jn(jn,{tone:"info",size:"xs",children:Bt.groupBadge})}):void 0,zl=_r.find(e=>e.type===Nt)??null,Cl=_r.find(e=>e.type===Ot)??null,Bl=gl>=0?gl:_r.length,Il=[];_r.forEach(e=>{jt(e)||(al(e)&&Il.push(String(e.props.id)),Il.push(...cl(e,1,pl)))}),yl&&(Il.push(String(yl.props.id)),Il.push(...cl(yl,1,pl)));const Nl=Il.length>0&&Il.every(e=>br.has(e)),Ol=e=>{const n=sr.blockRowName(e,di);return sr.rowName?sr.rowName(e,"block",n):n},Pl=(e,n,t,o)=>{const r=hi(e)[t];if(!r)return;const i={...Cn(e),index:t},l={...Cn(n),index:Math.min(Math.max(o,0),hi(n).length)},s=un(i,l);if(e!==n||s!==t)try{ii.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof In))throw e}},$l=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of ol(e))n.add(r),t(o)};for(const t of tl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Tl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ui.get(n);if(!e)return null;if(e.zone===be)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Ll=e=>{const n=e.slice(0,e.indexOf(":")),t=_r.find(e=>Pt(e.type)&&String(e.props.id)===n);return t&&$t(n)===e?t:null},Ml=(e,n)=>{const t=Ll(e);return!t||(!Bt.groupAccepts||Bt.groupAccepts(t.type,n,hi(e).length))},jl=(e,n,t)=>{if(e.rung){const t=mi(e.rung.nodeId),o=t?gi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===nt&&n.index>=0&&n.index<=o}if(n.slot===nt)return!1;if(e.add)return Vl(e.add,n);const o=zn(n);if(Pt(e.type))return!1;const r=Ll(o),i=Ll(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!Ml(o,e.type))&&(n.index>=0&&n.index<=hi(o).length));if(e.zone===be||o===be){if(e.zone!==o)return!1;const{floor:t,cap:r}=ei();return n.index>=t&&n.index<=r}if(n.index<0||n.index>hi(o).length)return!1;if(e.zone===o)return!0;const l=yl&&!Bt.lastIsOpen?String(yl.props.id):null;return(!l||Tl(e.zone)!==l&&Tl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??hi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ui.get(i),s=l?hi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&$l(r).has(n))return!1;const d=ir(s.type,or(bt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(hi(n),r))})(e.zone,o,e.index,t)},Al=(e,n)=>{const t=zn(e.from),o=e.node;return t===zn(n)?Ml(t,o.type):jl({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Rl=e=>{const n=e.slice(0,e.indexOf(":")),t=ui.get(n),o=t?hi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=ir(o.type,or(bt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=B(r.choices??(r.spec?[{type:r.spec.childType,label:di(r.spec.childType)}]:[])),l=yi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Gi(o,t.zone===be)}},El=(e,n)=>{if("section"!==e.kind)return e;const t=zn(n);return t===be||Ll(t)?e:Rl(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},Vl=(e,n)=>{const t=El(e,n),o=zn(n);if("block"!==t.kind){if(Ll(o)){const e="section"===t.kind?t.type:t.template.node.type;return Ml(o,e)&&n.index>=0&&n.index<=hi(o).length}if(o!==be)return!1;const{floor:e,cap:r}=ei();return n.index>=e&&n.index<=r}if(o===be)return!1;const r=Rl(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(hi(o))},Fl=(e,n)=>{const t=El(e,n);if("block"!==t.kind&&Ll(zn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&Ml(n,o)){if("section"===e.kind)_t.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;_t.insertNode(n,t,oi(e.template.node))}Fo(R),_t.select({index:t,zone:n})}})(t,zn(n),n.index);if("section"===t.kind)return void Di(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=Fi(t),r=_t.insertNode(be,o,n);Hi(o,r,e)})(t.template.name,oi(t.template.node),n.index);const o=zn(n),r=Rl(o);r&&(r.target.spec?fl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{_t.insertComponent(e,n,t),Fo(R),_t.select({index:t,zone:e})})(o,t.type,n.index))},Wl=(e,n)=>{e.rung?wi(e.rung.nodeId,e.index,n.index):e.add?Fl(e.add,n):e.zone===be?Wi(e.index,n.index):Pl(e.zone,zn(n),e.index,n.index)},[Hl]=Pn(()=>an()),Dl=pn({keyOf:e=>e.id,readOnly:Boolean(ft),session:Hl,canDrop:jl,onDrop:Wl,onStep:(e,n)=>{e.rung?wi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===be?((e,n)=>{const t=ai(_r[e]?.type??""),o=Wi(e,n<0?e-1:e+2);if(!o.moved)return void Tr(n<0?Et.sectionFirst({name:t}):Et.sectionLast({name:t}));const{floor:r,cap:i}=ei();Tr(Et.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Pl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Ul=Tn(e=>{const{floor:n,cap:t}=ei(),o=[];for(const r of e.nodes){const e=zn(r.place),i=hi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Mt(i)||jt(i)||nr(i.type))continue;if(Pt(i.type))continue;const l=Boolean(Ll(e)),s=e===be||l;e===be&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?ai(i.type):Ci(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=zn(e.list);if(n===be&&0===e.children.length)return[{...e,addLabel:Et.addSection,addAlways:!0}];const t=Rl(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Ll(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=zn(e.list),t=n===be||Ll(n)?null:Rl(n);return t?.choices.length?ln(e,t.target.spec?.addLabel??Et.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[bt.data]),Xl=null==xt?.props.id?null:String(xt.props.id),Jl=Tn(e=>{const n=Ct,t=e=>!e.item.rung&&null!==Bn(bt.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(Xl);return i||(r(We(bt.data,n,o.item.id,Xl,vl))??o)},[bt.data,Ct,Xl,vl]),[Gl,Kl]=Pn(null);yn(zo,"mouseover",e=>{if(!bl)return;const n=Sn(e.target),t=n?Zn(bt.data,Ct,n):null;t!==Gl&&Kl(t)}),yn(zo,"mouseout",e=>{bl&&!e.relatedTarget&&Kl(null)});const Yl=e=>Mt(e)||jt(e)||Pt(e.type),Zl=[];if(bl){const e=Xl?Zn(bt.data,Ct,Xl):null;for(const n of/* @__PURE__ */new Set([e,Gl])){const e=n?_r.find(e=>String(e.props.id)===n):void 0;if(!e||!Yl(e))continue;const t=bl(e);t&&Zl.push({id:String(e.props.id),label:t,below:Mt(e)||e.type===Nt})}}const ql=se(),Ql=Nn(null);$n(()=>{const e=Bt.changeNotice;if(!e)return;const n=JSON.stringify(_r.filter(Yl)),t=Ql.current;if(Ql.current={doc:bn,bands:n,index:wt.index},!t||t.doc!==bn||t.bands===n)return;wt.hasPast&&wt.index>=t.index&&!Yn.has(ql)&&(Yn.add(ql),Tr(e,"success",{action:{label:Et.bar.undo,onClick:()=>wt.back()},duration:8e3}))},[_r]);const _l=e=>{Fo(R),_t.select(e.zone===be?{index:e.index}:{index:e.index,zone:e.zone})},es=K(),ns=()=>({data:bt.data,device:co,ops:_t,inspector:qo}),ts=es?.model,os=On(()=>ts?e=>ts(e,Ul(e),ns()):Ul,[ts,Ul,co]),rs=es?.measure,is=rs?(e,n)=>rs(e,n,ns()):void 0,ls=es?.canDrop,ss=ls?(e,n)=>ls(e,n,jl,ns()):jl,ds=es?.drop,cs=ds?(e,n)=>ds(e,n,Wl,ns()):Wl,as=es?.pick,ps=as?e=>as(e,_l,ns()):_l,us=e=>{const n=zn(e),t=yi(n);t&&bi(t.node,t.slot,!1),Xi(n,e.index)},fs=(e,n)=>/* @__PURE__ */Jn(Ae,{...ft?{}:Dl.seam({place:{...Cn(e),index:n}})},`seam:${e}:${n}`),hs={rowClick:Ki,isCollapsed:Ir,toggleCollapse:Nr},ms=e=>{const n=String(e.props.id),t=_r.findIndex(e=>String(e.props.id)===n),o=$t(n),r=hi(o),i=Ir(n),l=di(e.type),s=sr.rowName?sr.rowName(e,"section",l):l,d=e=>fs(o,e);/* @__PURE__ */
|
|
11
|
-
return Gn(Kn,{children:[
|
|
12
|
-
/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:e.type,size:13}),name:s,preview:Zi(e),marks:qi(e),onSelect:()=>Vi(t),nameSlot:Ii(be,t,n,s),selected:Ho===n,badge:xl,actions:Qi(e,be,t)??void 0,rowProps:{"data-node-id":n,onClick:Ki(()=>Vi(t))},fold:{open:!i,label:"section",onToggle:()=>Nr(n)}}),!i&&/* @__PURE__ */Gn(Te,{children:[r.map((n,t)=>{const r=String(n.props.id),i=pi(n),l=al(n),s=l&&Ir(r),c=()=>ul(o,t,r,e.type),{rowProps:a,...p}=Dl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Cn(o),index:t}},{"data-node-id":r,onClick:Ki(c)});/* @__PURE__ */
|
|
13
|
-
return Gn(Mn,{children:[d(t),
|
|
14
|
-
/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:n.type,size:13}),name:i,preview:Zi(n),marks:qi(n),onSelect:c,nameSlot:Ii(o,t,r,i),selected:Ho===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Nr(r)}:void 0,actions:/* @__PURE__ */Gn(Kn,{children:[Yi(o,t,i),Qi(n,o,t),_i(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Jn(Te,{children:Ss(n,2)})]},r)}),d(r.length)]})]})},gs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Dl.dragging,d=!Ir(l)&&s?.rung?.nodeId!==i,c={...Cn(l),index:0},a=s&&!s.rung&&jl(s,c)?c:void 0,p=()=>bi(e,n,!0),{rowProps:u,...f}=Dl.row({item:{id:`rung:${l}`,zone:`${i}:${nt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:nt,index:t},into:a,canDrag:Boolean(er.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Ki(p)}),h=ft?null:er.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
15
|
-
return Gn(Mn,{children:[n.heading,
|
|
16
|
-
/* @__PURE__ */Jn($e,{words:Vt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Si===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Nr(l)},actions:h&&h.length>0?/* @__PURE__ */Jn(Kn,{children:h.map((t,o)=>/* @__PURE__ */Jn(je,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(ft||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&vi(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */Jn(Hn,{size:15}):/* @__PURE__ */Jn(Xn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Jn(Te,{children:r})]},l)},ys=(e,n)=>{const t=rl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
17
|
-
return Jn(Kn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=sl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=(e,n)=>fs(e,n),p=/* @__PURE__ */Gn(Kn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Ho===String(n.props.id),{collapsible:i,folded:s}=dl(n,l,pl(n.type)),d=String(n.props.id),c=Ol(n),p=()=>ul(t,o,d,e.type),{rowProps:u,...f}=Dl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Cn(t),index:o}},{"data-node-id":d,onClick:Ki(p)});/* @__PURE__ */
|
|
18
|
-
return Gn(Mn,{children:[0===o&&a(t,0),
|
|
19
|
-
/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:n.type,size:13}),name:c,preview:Zi(n),marks:qi(n),onSelect:p,nameSlot:Ii(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Nr(d)}:void 0,actions:/* @__PURE__ */Gn(Kn,{children:[Yi(t,o,c),Qi(n,t,o),_i(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Jn(Te,{children:ys(n,l+1)}),a(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?a(d,0):null:0!==i.length||!t.rung&&d!==c?null:a(c,0)]});return t.rung?gs(e,t.rung,r++,o,p):/* @__PURE__ */Jn(Mn,{children:p},t.slot??"")})})},Ss=(e,n)=>{const t=or(bt?.data,e.type,String(e.props.id)),o=rl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
20
|
-
return Jn(Kn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=sl(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>fs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),S=/* @__PURE__ */Gn(Kn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Ho===String(n.props.id),i=Ci(n),l=String(n.props.id),{collapsible:d,folded:c}=dl(n,s,pl(n.type)),a=tl(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...Cn(p),index:hi(p).length}:void 0,f=Dl.dragging,h=u&&f&&jl(f,u)?u:void 0,g=()=>ul(t,o,l,e.type),{rowProps:y,...S}=Dl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Cn(t),index:o},into:h,canDrag:!nr(n.type)},{"data-node-id":l,onClick:Ki(g)});/* @__PURE__ */
|
|
21
|
-
return Gn(Mn,{children:[0===o&&m(t,0),
|
|
22
|
-
/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:n.type,size:13}),name:i,preview:Zi(n),marks:qi(n),onSelect:g,nameSlot:Ii(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...S,fold:d?{open:!c,label:"group",onToggle:()=>Nr(l)}:void 0,actions:nr(n.type)?Qi(n,t,o)??void 0:/* @__PURE__ */Gn(Kn,{children:[Yi(t,o,i),Qi(n,t,o),_i(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Jn(Te,{children:Ss(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
23
|
-
/* @__PURE__ */Jn(w,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>fl(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?gs(e,o.rung,i++,r,S):/* @__PURE__ */Jn(Mn,{children:S},o.slot??"")})})},ks=$o||null!==fo,bs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:no&&!ks&&_o===e.id,onSelect:()=>Yr(e.id)}:e,vs=[...(Qo.railLead??[]).map(bs),{id:"sections",label:Et.layers,icon:/* @__PURE__ */Jn(ae,{}),active:no&&!ks&&"sections"===_o,onSelect:()=>Yr("sections")},...(Qo.railTrail??[]).map(bs)];uo?vs.push({id:"media",label:Et.railMedia,icon:/* @__PURE__ */Jn(pe,{}),active:no&&!$o&&(null!==fo||"media"===_o),onSelect:()=>Yr("media")}):yt&&vs.push({id:"media",label:Et.railMedia,icon:/* @__PURE__ */Jn(pe,{}),onSelect:Zr});const ws=[...Qo.railLead??[],...Qo.railTrail??[]].find(e=>"panel"in e&&e.id===_o),xs=Boolean(Rt?.foldable),zs=Rt?.label??(St?Et.pageSections:Et.templateSections),Cs=xs&&Ir(tt),Bs=/* @__PURE__ */Gn(Kn,{children:[_r.map((e,n)=>{if(Mt(e)||jt(e)||Pt(e.type))return null;const t=Ho===String(e.props.id),o=Boolean(e.props._hidden);ol(e);const r=String(e.props.id),i=Qo.hasOwnRows?.(e)??!1,l=al(e)||i,s=l&&Ir(r),d=tl(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...Cn(c),index:hi(c).length}:void 0,p=Dl.dragging,u=a&&p&&jl(p,a)?a:void 0,{rowProps:f,...h}=Dl.row({item:{id:r,zone:be,index:n,type:e.type},place:{...Cn(be),index:n},into:u},{"data-node-id":r,onClick:Ki(()=>Vi(n))});/* @__PURE__ */
|
|
24
|
-
return Gn(Mn,{children:[n>0&&el(n),
|
|
25
|
-
/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:e.type,size:13}),name:pi(e),preview:Zi(e),marks:qi(e),onSelect:()=>Vi(n),nameSlot:Ii(be,n,r,pi(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Nr(r)}:void 0,actions:/* @__PURE__ */Gn(Kn,{children:[Yi(be,n,pi(e)),Qi(e,be,n),_i(be,n,e,pi(e))]}),rowProps:f}),al(e)&&!s&&/* @__PURE__ */Gn(Te,{children:[Ss(e,1),Qo.partRows?.(e,hs)]}),i&&!s&&/* @__PURE__ */Jn(Te,{children:Qo.ownRows?.(e,n,hs)})]},String(e.props.id??n))}),Bl>0&&el(Bl)]}),Is=(e,n,t)=>{const o=String(e.props.id),r=il(e).length>0||ll(e)||Boolean(ir(e.type)),i=r&&Ir(o),l="header"===t?Et.header:Et.footer,s=sr.rowName?sr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
26
|
-
return Gn(Kn,{children:[
|
|
27
|
-
/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:t,size:13}),name:s,preview:Zi(e),marks:qi(e),badge:xl,onSelect:()=>Vi(n),nameSlot:Ii(be,n,o,s),selected:Ho===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Nr(o)}:void 0,actions:Qi(e,be,n)??void 0,rowProps:{"data-node-id":o,onClick:Ki(()=>Vi(n))}}),r&&!i&&/* @__PURE__ */Jn(Te,{children:ys(e,1)})]})};return(Qo.wrap??(e=>e))(
|
|
28
|
-
/* @__PURE__ */Jn(Y,{target:zo,children:/* @__PURE__ */Gn("div",{ref:xo,className:"sf-editor es-editor",style:Qe(wr),onContextMenu:Li.onEditorContextMenu,...u(hn),children:[
|
|
29
|
-
/* @__PURE__ */Gn(He,{children:[
|
|
30
|
-
/* @__PURE__ */Jn(De,{items:vs,ariaLabel:Et.bar.views}),
|
|
31
|
-
/* @__PURE__ */Gn(Ue,{children:[
|
|
32
|
-
/* @__PURE__ */Jn(Xe,{label:Et.bar.undo,disabled:Boolean(ft)||!wt.hasPast,onClick:()=>wt.back(),children:/* @__PURE__ */Jn(En,{})}),
|
|
33
|
-
/* @__PURE__ */Jn(Xe,{label:Et.bar.redo,disabled:Boolean(ft)||!wt.hasFuture,onClick:()=>wt.forward(),children:/* @__PURE__ */Jn(Vn,{})}),
|
|
34
|
-
/* @__PURE__ */Jn(Je,{}),
|
|
35
|
-
/* @__PURE__ */Jn(Ge,{devices:oo,value:co,onChange:ao}),
|
|
36
|
-
/* @__PURE__ */Jn(Xe,{label:Et.bar.refresh,tip:Et.bar.refreshTip,onClick:()=>{wo.current=(()=>{const e=zo?.document;if(!e)return null;const n=_r.findIndex(jt),t=n>=0?n:_r.length;let o=null;for(let n=0;n<t;n++){const t=_r[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=xt?.props?.id??_r[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),vo(e=>e+1)},children:/* @__PURE__ */Jn(Fn,{})})]}),
|
|
37
|
-
/* @__PURE__ */Gn(Ue,{kind:"right",style:{minWidth:300},children:[
|
|
38
|
-
/* @__PURE__ */Jn(k,{input:Oo,words:Et.saveStatus}),Qo.barLead?.(),Qo.barTrail?.(),Qo.mainAction||!Qo.barMain?/* @__PURE__ */Jn(b,{input:Oo,action:Qo.mainAction??{label:Et.done,onPress:()=>{it(bt.data)}},readOnly:Boolean(ft),saveSwitch:mt,onToggleAutoSave:ct,onSaveNow:Po,bar:Et.bar,words:Et.saveStatus}):Qo.barMain()]})]}),
|
|
39
|
-
/* @__PURE__ */Jn(ne,{}),
|
|
40
|
-
/* @__PURE__ */Gn("div",{className:"sf-body",children:[no?/* @__PURE__ */Gn(Kn,{children:[
|
|
41
|
-
/* @__PURE__ */Jn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Et.leftPanel,children:$o?/* @__PURE__ */Jn(x,{at:jo?{label:(e=>{const n=Ll(e.zone);if(n)return Et.add.addingTo({name:sr.rowName?Gi(n,!0):di(n.type)});if(e.zone===be){const n=_r[e.index];return n&&!jt(n)?Et.add.addingBefore({name:Gi(n,!0)}):Et.add.addingAtEnd}const t=Rl(e.zone);return t?Et.add.addingTo({name:t.parentName}):Et.add.addingHere})(jo),onClear:()=>Ao(null)}:void 0,placeBlocks:jo&&jo.zone!==be?Rl(jo.zone)?.choices:void 0,canTake:jo?e=>{if(!jo)return null;const n={...Cn(jo.zone),index:jo.index};if(Vl(e,n))return null;const t=Ll(jo.zone);if(t)return Et.add.notInside({name:Gi(t,!0)});if(jo.zone===be)return Et.add.onlySections;const o=Rl(jo.zone);return o?Et.add.notInside({name:o.parentName}):Et.add.onlySections}:void 0,onPick:jo?e=>{if(!jo)return;const n={...Cn(jo.zone),index:jo.index};Vl(e,n)&&(Fl(e,n),Ji())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Hl,siteWide:Qo.addPanelRow?.(Ji),onClose:Ji,onHide:Gr,readOnly:Boolean(ft)}):fo&&po?
|
|
42
|
-
/* @__PURE__ */Jn(I,{panel:po,pick:fo,onHide:Gr}):ws?ws.panel({onHide:Gr,notify:Tr}):"media"===_o&&po?/* @__PURE__ */Jn(I,{panel:po,pick:null,onHide:Gr}):/* @__PURE__ */Gn(Kn,{children:[
|
|
43
|
-
/* @__PURE__ */Jn(z,{icon:/* @__PURE__ */Jn(ae,{}),title:Et.layers,context:Jt,actions:/* @__PURE__ */Gn(Kn,{children:[!ft&&/* @__PURE__ */Jn(Ke,{label:Et.add.title,onClick:()=>Ui(null),children:/* @__PURE__ */Jn(Wn,{size:15})}),
|
|
44
|
-
/* @__PURE__ */Jn(Ke,{label:Nl?Et.expandAll:Et.collapseAll,title:0===Il.length?Et.nothingToFold:void 0,disabled:0===Il.length,onClick:()=>vr(e=>{const n=new Set(Il);return Nl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Il])}),children:/* @__PURE__ */Jn(Qn,{expand:Nl})})]}),onHide:Gr}),
|
|
45
|
-
/* @__PURE__ */Gn(Le,{className:"sf-tree sf-scroll",words:Vt,children:[
|
|
46
|
-
/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:"page",size:13}),name:Et.pageSettings,onSelect:qr,selected:!xt&&Wo,rowProps:{onClick:Ki(qr)}}),zl&&/* @__PURE__ */Gn(Kn,{children:[!wl&&/* @__PURE__ */Jn(Me,{children:Et.header}),ms(zl)]}),kt&&!(wl&&zl)&&/* @__PURE__ */Gn(Kn,{children:[!wl&&/* @__PURE__ */Jn(Me,{children:Et.header}),!At&&/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:"header",size:13}),name:Et.header,badge:xl,onSelect:Qr,selected:Vo.kind===Lt?.kind,rowProps:{onClick:Ki(Qr)}})]}),kl&&!(wl&&zl)&&Is(kl,Sl,"header"),!xs&&/* @__PURE__ */Jn(Me,{children:zs}),xs?/* @__PURE__ */Gn(Kn,{children:[
|
|
47
|
-
/* @__PURE__ */Jn($e,{words:Vt,icon:null,name:zs,fold:{open:!Cs,label:zs,onToggle:()=>Nr(tt)}}),!Cs&&/* @__PURE__ */Jn(Te,{children:Bs})]}):Bs,kt&&!wl&&/* @__PURE__ */Jn(Me,{children:Et.footer}),yl&&!(wl&&Cl)&&Is(yl,gl,"footer"),Cl&&ms(Cl),Qo.treeFoot?.()]})]})}),
|
|
48
|
-
/* @__PURE__ */Jn(Ye,{side:"left",width:wr.left,min:qe,max:Ze,defaultWidth:m.left,label:Et.resizeLeftPanel,onResize:Cr})]}):/* @__PURE__ */Jn(C,{side:"left",onShow:Gr}),
|
|
49
|
-
/* @__PURE__ */Gn("div",{ref:Lr,className:"sf-center sf-scroll","data-sf-canvas-head":Er?"":void 0,style:{overflowX:Ur?"auto":"hidden",overflowY:"hidden"},children:[Er&&/* @__PURE__ */Jn("div",{ref:Vr,className:"sf-canvas-head",children:/* @__PURE__ */Jn(Er,{device:co})}),
|
|
50
|
-
/* @__PURE__ */Gn("div",{className:"sf-frame-scaler",style:Xr,children:[
|
|
51
|
-
/* @__PURE__ */Jn("div",{className:"sf-frame "+(co===lo?"":`sf-frame--${co}`),style:Jr,children:/* @__PURE__ */Gn("div",{className:"sf-preview-host",children:[
|
|
52
|
-
/* @__PURE__ */Jn(Pe.Provider,{value:vl,children:/* @__PURE__ */Jn(Gt,{},bo)}),
|
|
53
|
-
/* @__PURE__ */Jn(sn,{canvas:zo,session:Hl,model:os,measure:is,canDrop:ss,onDrop:cs,choose:Jl,onPick:ps,onZoneAdd:us,onSeamAdd:us,zoneAddLabel:Et.canvasAddBlock,words:Ft.canvas,readOnly:Boolean(ft),revision:bt.data}),Ro.length>0&&!Co&&/* @__PURE__ */Jn("div",{className:"sf-preview-gaps",children:Ro.map(e=>
|
|
54
|
-
/* @__PURE__ */Jn(dn,{index:e.index,label:Et.addSectionHere,onInsert:()=>Ui(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),bl?/* @__PURE__ */Jn(qn,{canvas:zo,tabs:Zl,onSelect:e=>{const n=_r.findIndex(n=>String(n.props.id)===e);n>=0&&Vi(n)}}):null]})]}),to?/* @__PURE__ */Gn(Kn,{children:[
|
|
55
|
-
/* @__PURE__ */Jn(f,{value:{selectChild:ul,addChild:fl,childRowName:Ci,blockRowName:Ol},children:/* @__PURE__ */Jn(Kt,{mode:Vo,onOpenWebsiteSettings:Qo.openSettings??(()=>{}),onOpenSiteStyles:Qo.openStyles,onSelectNode:fr,onNotify:Tr,onHidePanel:Kr,nodeActions:xt?ve(Ct,xt.type):ot})}),
|
|
56
|
-
/* @__PURE__ */Jn(Ye,{side:"right",width:wr.right,min:qe,max:Ze,defaultWidth:m.right,label:Et.resizeSettingsPanel,onResize:Br})]}):
|
|
57
|
-
/* @__PURE__ */Jn(C,{side:"right",onShow:Kr})]}),Li.menu]})}))}export{rt as ScreenChrome};
|