efficient-easel 8.1.0 → 8.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/blocks/index.d.ts +2 -2
- package/dist/canvas/index.d.ts +10 -1
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-3QK5R7RR.js → chunk-35TOFLH6.js} +1 -1
- package/dist/{chunk-R2G64ZNC.js → chunk-D6N77AOS.js} +1 -1
- package/dist/chunk-ECM5F6JJ.js +1 -0
- package/dist/{chunk-BSZ54Q2T.js → chunk-EJZ4RIRW.js} +1 -1
- package/dist/{chunk-SSORUDHE.js → chunk-FCLW4LEN.js} +7 -7
- package/dist/{chunk-E3PD66A3.js → chunk-FJRAYUCX.js} +5 -5
- package/dist/chunk-ILXP5VX5.js +1 -0
- package/dist/chunk-K5744MTM.js +11 -0
- package/dist/chunk-KSKKRGNQ.js +57 -0
- package/dist/{chunk-2QUWI67X.js → chunk-NMUS2VVD.js} +1 -1
- package/dist/{chunk-3NB2IEXA.js → chunk-OWW44DVK.js} +1 -1
- package/dist/chunk-RMB2VGNY.js +5 -0
- package/dist/chunk-VNN6VB4V.js +1 -0
- package/dist/{chunk-JO6FBCVR.js → chunk-X5SPTRG3.js} +1 -1
- package/dist/{chunk-CVUMGA2T.js → chunk-ZVEJ25YG.js} +1 -1
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.d.ts +18 -7
- package/dist/easel/index.js +1 -1
- package/dist/node-ops/index.d.ts +2 -2
- package/dist/node-ops/index.js +1 -1
- package/dist/{plan-xc48tt77.d.ts → plan-CGREINRO.d.ts} +6 -4
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.d.ts +2 -2
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +3 -3
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +2 -2
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +2 -2
- package/dist/screen/components/ScreenMount.d.ts +2 -2
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +2 -2
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/usePartBridge.d.ts +2 -2
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +2 -2
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +2 -2
- package/dist/screen/lib/document-addressing.d.ts +2 -2
- package/dist/screen/lib/document-hooks.d.ts +2 -2
- package/dist/screen/lib/host.d.ts +2 -2
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +2 -2
- package/dist/screen/lib/media-picker.d.ts +2 -2
- package/dist/screen/lib/page-lock.d.ts +2 -2
- package/dist/screen/lib/puck/palette-sections.d.ts +2 -2
- package/dist/screen/lib/puck/section-doc.d.ts +2 -2
- package/dist/screen/lib/puck/style-clipboard.d.ts +2 -2
- 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 +31 -2
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-templates.d.ts +2 -2
- package/dist/screen/lib/session-context.d.ts +2 -2
- package/dist/screen/lib/session.d.ts +2 -2
- package/dist/screen/screen.css +28 -0
- package/dist/{types-BbkxBdG9.d.ts → types-NQozKWEz.d.ts} +1 -1
- package/dist/{useNodeOps-CTQN3wky.d.ts → useNodeOps-BHRkUFfG.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-246ONJJH.js +0 -58
- package/dist/chunk-2LBXIYF7.js +0 -1
- package/dist/chunk-AWJUYMX7.js +0 -1
- package/dist/chunk-KYG35KKJ.js +0 -11
- package/dist/chunk-SOZUYCQZ.js +0 -1
- package/dist/chunk-ZPXKNO5L.js +0 -5
|
@@ -2,11 +2,11 @@ import { EditLock } from '../../edit-lock/index.js';
|
|
|
2
2
|
import { EaselSession } from './session.js';
|
|
3
3
|
import '../../blocks/index.js';
|
|
4
4
|
import 'react';
|
|
5
|
-
import '../../types-
|
|
5
|
+
import '../../types-NQozKWEz.js';
|
|
6
6
|
import '../../data/index.js';
|
|
7
7
|
import '../../types-41704JE4.js';
|
|
8
8
|
import '../../resolve-D68pb3Bx.js';
|
|
9
|
-
import '../../plan-
|
|
9
|
+
import '../../plan-CGREINRO.js';
|
|
10
10
|
import './backend-error.js';
|
|
11
11
|
import './host-chrome.js';
|
|
12
12
|
import './links/link-filters.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Config } from '../../../blocks/index.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../../../types-
|
|
3
|
+
import '../../../types-NQozKWEz.js';
|
|
4
4
|
import '../../../data/index.js';
|
|
5
5
|
import '../../../types-41704JE4.js';
|
|
6
6
|
import '../../../resolve-D68pb3Bx.js';
|
|
7
|
-
import '../../../plan-
|
|
7
|
+
import '../../../plan-CGREINRO.js';
|
|
8
8
|
|
|
9
9
|
/** One offerable section, with the category it is grouped under. */
|
|
10
10
|
type PaletteSection = {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Data } from '../../../blocks/index.js';
|
|
2
2
|
import { TreeItem } from './content-tree.js';
|
|
3
3
|
import 'react';
|
|
4
|
-
import '../../../types-
|
|
4
|
+
import '../../../types-NQozKWEz.js';
|
|
5
5
|
import '../../../data/index.js';
|
|
6
6
|
import '../../../types-41704JE4.js';
|
|
7
7
|
import '../../../resolve-D68pb3Bx.js';
|
|
8
|
-
import '../../../plan-
|
|
8
|
+
import '../../../plan-CGREINRO.js';
|
|
9
9
|
|
|
10
10
|
declare function nodeToDoc(node: TreeItem): Data;
|
|
11
11
|
declare function docToNode(data: Data): TreeItem | null;
|
|
@@ -5,11 +5,11 @@ import { panelFieldsOf } from './panel-fields.js';
|
|
|
5
5
|
import '../../../types-BsyPh6EW.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '../../../blocks/index.js';
|
|
8
|
-
import '../../../types-
|
|
8
|
+
import '../../../types-NQozKWEz.js';
|
|
9
9
|
import '../../../data/index.js';
|
|
10
10
|
import '../../../types-41704JE4.js';
|
|
11
11
|
import '../../../resolve-D68pb3Bx.js';
|
|
12
|
-
import '../../../plan-
|
|
12
|
+
import '../../../plan-CGREINRO.js';
|
|
13
13
|
import '../../../watch-BTYOJpQU.js';
|
|
14
14
|
import '../../../types-DGyDHiJV.js';
|
|
15
15
|
import '../../../types-CsgMwHHa.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { N as NodeSelection } from '../../../plan-
|
|
1
|
+
import { N as NodeSelection } from '../../../plan-CGREINRO.js';
|
|
2
2
|
import { Data } from '../../../blocks/index.js';
|
|
3
3
|
import { TreeItem } from './content-tree.js';
|
|
4
4
|
import '../../../types-41704JE4.js';
|
|
5
5
|
import 'react';
|
|
6
|
-
import '../../../types-
|
|
6
|
+
import '../../../types-NQozKWEz.js';
|
|
7
7
|
import '../../../data/index.js';
|
|
8
8
|
import '../../../resolve-D68pb3Bx.js';
|
|
9
9
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{useSectionOps}from"../../../chunk-
|
|
1
|
+
export{useSectionOps}from"../../../chunk-NMUS2VVD.js";import"../../../chunk-FJRAYUCX.js";import"../../../chunk-PLVEGYK6.js";import"../../../chunk-R6WTQWAC.js";import"../../../chunk-U3JP4VGF.js";import"../../../chunk-K5744MTM.js";import"../../../chunk-TBY3DFKS.js";import"../../../chunk-PEDDDWSG.js";import"../../../chunk-OZ72A6MY.js";import"../../../chunk-4JSBIW5H.js";import"../../../chunk-GZH4UVDH.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-KFV7N2DJ.js";import"../../../chunk-YRLPFZW3.js";import"../../../chunk-EA2HTX37.js";import"../../../chunk-ECM5F6JJ.js";import"../../../chunk-WQASXLXS.js";import"../../../chunk-66LWADFP.js";import"../../../chunk-QLD57GBB.js";import"../../../chunk-FFYXVAAL.js";import"../../../chunk-546BBOPE.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-67GNT6PF.js";import"../../../chunk-ILXP5VX5.js";import"../../../chunk-P2VEMZH5.js";import"../../../chunk-KRXQM65X.js";import"../../../chunk-NKB3KVAB.js";
|
|
@@ -15,10 +15,10 @@ import { HostProduct } from './host-chrome.js';
|
|
|
15
15
|
import { EaselSession } from './session.js';
|
|
16
16
|
import { AddTarget } from './puck/add-target-types.js';
|
|
17
17
|
import { SlotConfigView } from './puck/content-tree.js';
|
|
18
|
-
import '../../types-
|
|
18
|
+
import '../../types-NQozKWEz.js';
|
|
19
19
|
import '../../data/index.js';
|
|
20
20
|
import '../../resolve-D68pb3Bx.js';
|
|
21
|
-
import '../../plan-
|
|
21
|
+
import '../../plan-CGREINRO.js';
|
|
22
22
|
import '../../edit-lock/index.js';
|
|
23
23
|
import '../../panelWidths-D9hTLR25.js';
|
|
24
24
|
import '../../session-DSQFmIvx.js';
|
|
@@ -1055,6 +1055,35 @@ interface ScreenPinnedNodes {
|
|
|
1055
1055
|
* (0.103.0). Absent: a group label in the screen's words, the sections at
|
|
1056
1056
|
* the tree's own depth, and no row after them. */
|
|
1057
1057
|
band?: ScreenPinnedBand;
|
|
1058
|
+
/**
|
|
1059
|
+
* HEADER AND FOOTER EDITED IN PLACE (8.2.0, owner 2026-10-15). The words of
|
|
1060
|
+
* the canvas TAB on a pinned node — "Header · on every page" — or null for
|
|
1061
|
+
* a node that has none. Asked of each node pinned first or last and of each
|
|
1062
|
+
* group of sections. The screen draws the tab on the band's top edge while
|
|
1063
|
+
* the pointer is anywhere in it or anything in it is selected, at its true
|
|
1064
|
+
* size whatever the device is scaled by, kept inside the canvas when the
|
|
1065
|
+
* band starts above it; a click on the tab selects the band. Handing it
|
|
1066
|
+
* also makes a group of sections NO STEP of the canvas's click-through
|
|
1067
|
+
* chain: a click inside walks from the group's sections in, as on the page.
|
|
1068
|
+
* Absent: no tab, and the click chain as it was.
|
|
1069
|
+
*/
|
|
1070
|
+
groupTab?: (node: ScreenNode) => string | null;
|
|
1071
|
+
/**
|
|
1072
|
+
* …the badge on the Layers row of each pinned node and group ("Every
|
|
1073
|
+
* page"). Handing it draws the in-place tree: the header and footer are
|
|
1074
|
+
* their own rows, with no "Header" / "Footer" group labels over them, and
|
|
1075
|
+
* no row that opens the footer somewhere else. Hidden while the left panel
|
|
1076
|
+
* is narrower than 240px, where the name needs the room. Absent: the tree
|
|
1077
|
+
* as it was.
|
|
1078
|
+
*/
|
|
1079
|
+
groupBadge?: string;
|
|
1080
|
+
/**
|
|
1081
|
+
* …what the screen says ONCE per editing session (the easel session), the
|
|
1082
|
+
* first time an edit changes a pinned node or a group of sections: the
|
|
1083
|
+
* shell's toast, with Undo ("Changed on every page"). A seed, a load or an
|
|
1084
|
+
* undo says nothing. Absent: nothing is said.
|
|
1085
|
+
*/
|
|
1086
|
+
changeNotice?: string;
|
|
1058
1087
|
/** The type of the group of sections pinned first, ahead of everything. */
|
|
1059
1088
|
firstGroup: string | null;
|
|
1060
1089
|
/** …and of the one pinned last. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-
|
|
1
|
+
export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenAdd,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-FJRAYUCX.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-K5744MTM.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-PEDDDWSG.js";import"../../chunk-OZ72A6MY.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-GZH4UVDH.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-WQASXLXS.js";import"../../chunk-66LWADFP.js";import"../../chunk-QLD57GBB.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -3,11 +3,11 @@ import { EaselSession } from './session.js';
|
|
|
3
3
|
import './puck/content-tree.js';
|
|
4
4
|
import '../../blocks/index.js';
|
|
5
5
|
import 'react';
|
|
6
|
-
import '../../types-
|
|
6
|
+
import '../../types-NQozKWEz.js';
|
|
7
7
|
import '../../data/index.js';
|
|
8
8
|
import '../../types-41704JE4.js';
|
|
9
9
|
import '../../resolve-D68pb3Bx.js';
|
|
10
|
-
import '../../plan-
|
|
10
|
+
import '../../plan-CGREINRO.js';
|
|
11
11
|
import './backend-error.js';
|
|
12
12
|
import '../../edit-lock/index.js';
|
|
13
13
|
import './host-chrome.js';
|
|
@@ -2,11 +2,11 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { EaselSession } from './session.js';
|
|
4
4
|
import '../../blocks/index.js';
|
|
5
|
-
import '../../types-
|
|
5
|
+
import '../../types-NQozKWEz.js';
|
|
6
6
|
import '../../data/index.js';
|
|
7
7
|
import '../../types-41704JE4.js';
|
|
8
8
|
import '../../resolve-D68pb3Bx.js';
|
|
9
|
-
import '../../plan-
|
|
9
|
+
import '../../plan-CGREINRO.js';
|
|
10
10
|
import './backend-error.js';
|
|
11
11
|
import '../../edit-lock/index.js';
|
|
12
12
|
import './host-chrome.js';
|
|
@@ -5,11 +5,11 @@ import { WebsiteEditLock } from './document-contract.js';
|
|
|
5
5
|
import { EaselDocumentHooks } from './document-hooks.js';
|
|
6
6
|
import { SectionTemplateStore } from './section-template-types.js';
|
|
7
7
|
import 'react';
|
|
8
|
-
import '../../types-
|
|
8
|
+
import '../../types-NQozKWEz.js';
|
|
9
9
|
import '../../data/index.js';
|
|
10
10
|
import '../../types-41704JE4.js';
|
|
11
11
|
import '../../resolve-D68pb3Bx.js';
|
|
12
|
-
import '../../plan-
|
|
12
|
+
import '../../plan-CGREINRO.js';
|
|
13
13
|
import '../../edit-lock/index.js';
|
|
14
14
|
import './links/link-filters.js';
|
|
15
15
|
import 'efficient-shell/ui';
|
package/dist/screen/screen.css
CHANGED
|
@@ -820,3 +820,31 @@
|
|
|
820
820
|
align-items: center;
|
|
821
821
|
gap: 12px;
|
|
822
822
|
}
|
|
823
|
+
|
|
824
|
+
/* ── Header and footer edited in place (8.2.0, owner 2026-10-15) ───────────
|
|
825
|
+
THE BAND TABS: "Header · on every page" on a pinned band's edge, drawn in
|
|
826
|
+
the device sizer beside the frame (ScreenChrome `PinnedBandTabs`), so the
|
|
827
|
+
device's scale never reaches them. The layer ignores the pointer; only a
|
|
828
|
+
tab takes it (a click selects the band). The look is the shell's solid
|
|
829
|
+
badge; nothing here colours it. */
|
|
830
|
+
.es-band-tabs {
|
|
831
|
+
position: absolute;
|
|
832
|
+
inset: 0;
|
|
833
|
+
overflow: hidden;
|
|
834
|
+
pointer-events: none;
|
|
835
|
+
z-index: 6;
|
|
836
|
+
}
|
|
837
|
+
.es-band-tab {
|
|
838
|
+
position: absolute;
|
|
839
|
+
display: inline-flex;
|
|
840
|
+
pointer-events: auto;
|
|
841
|
+
cursor: pointer;
|
|
842
|
+
}
|
|
843
|
+
/* THE LAYERS BADGE ("Every page") gives way below a 240px panel: the row's
|
|
844
|
+
name needs the room (owner 2026-10-15). The side panel is the size
|
|
845
|
+
container (chrome.css). */
|
|
846
|
+
@container (width < 240px) {
|
|
847
|
+
.es-tree-group-badge {
|
|
848
|
+
display: none;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
@@ -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-CGREINRO.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-CGREINRO.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The node clipboard — what Copy and Cut hold, and Paste reads.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "8.1
|
|
3
|
+
"version": "8.2.1",
|
|
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",
|
package/dist/chunk-246ONJJH.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-BRDCD4LK.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-BHRC3ASL.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as m,useEaselSaveKey as h,editorRootFocus as g}from"./chunk-3NB2IEXA.js";import{SlotChildActionsProvider as y}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as k,DEFAULT_PANEL_W as S,clampPanelWidth as x}from"./chunk-DPKWJTNX.js";import{usePartBridge as v}from"./chunk-2LBXIYF7.js";import{useSectionOps as w}from"./chunk-2QUWI67X.js";import{useNodeClipboard as b,useNodeContextMenu as z}from"./chunk-R2G64ZNC.js";import{PageEditGuardNotices as B}from"./chunk-NCQSBU3O.js";import{ScreenSaveIcon as C,ScreenMainButton as O}from"./chunk-HDUAODXJ.js";import{useBrowserOffline as I}from"./chunk-RKTF5XLP.js";import{useScreenDocument as N}from"./chunk-THZ46DC5.js";import{requestMediaPick as $}from"./chunk-KG7RJWOK.js";import{heldStyle as A,styleShortcut as P}from"./chunk-V7U33NF2.js";import{AddChildRow as T}from"./chunk-5545A3PC.js";import{AddSidePanel as j}from"./chunk-ZPXKNO5L.js";import{SidePanelHead as M,PanelShowStrip as R}from"./chunk-XTJCKV6Z.js";import{MediaSidePanel as L}from"./chunk-CVUMGA2T.js";import{useScreenSaveSwitch as E,useScreenNodeKeys as V,useScreenPinned as D,useScreenDocumentLabel as H,useScreenCanvasFrame as U,useScreenInspectorPanel as F,useScreenDevices as W,useScreenPickFollowsSelection as G,useScreenLeftView as J,useScreenAdd as X,SELECTION_MODE as K,sameInspectorMode as Y,useScreenBridges as Z,useScreenBlockRules as _,useScreenBlockLook as Q,useScreenStorageNamespace as q,useScreenNotify as ee,useScreenCanvasHead as ne,isSlotMode as te,useScreenStyleClipboard as oe,useScreenDocumentPass as re,useScreenCanvasDrag as ie,ScreenCanvasTargetProvider as le,isPinnedFirst as se,isPinnedLast as de,screenSlotsOf as ce}from"./chunk-E3PD66A3.js";import{ROOT_ZONE as ae,blockNodeActions as pe,TREE_MAX_DEPTH as ue,childSlotsOf as fe,slotFieldsOf as me,slotChildrenIn as he,nestsInTree as ge,newNodeId as ye}from"./chunk-PLVEGYK6.js";import{useMediaPanel as ke,usePanelPick as Se,useCancelPanelPick as xe}from"./chunk-R6WTQWAC.js";import{useEaselHost as ve,useHostEscape as we}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as be}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as ze}from"./chunk-JTUUIVBZ.js";import{useEasel as Be,useEaselApi as Ce}from"./chunk-KYG35KKJ.js";import{TreeRow as Oe,Subtree as Ie,LayersTree as Ne,TreeGroupLabel as $e,TreeRowAction as Ae,TreeSeam as Pe}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Te}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as je}from"./chunk-WK3AFPXY.js";import{toItemSelector as Me,useNodeOps as Re,clickPick as Le}from"./chunk-SOZUYCQZ.js";import{LayersIcon as Ee,MediaIcon as Ve}from"./chunk-4VJATVVR.js";import{EaselTopBar as De,TopBarRail as He,TopBarCluster as Ue,EaselIconButton as Fe,TopBarDivider as We,DeviceSwitch as Ge,InspectorIconButton as Je,PanelResizeHandle as Xe,MAX_PANEL_W as Ke,MIN_PANEL_W as Ye,panelWidthVars as Ze}from"./chunk-QVUVDBGA.js";import{DEFAULT_NOTICE_WORDS as _e,DEFAULT_CHROME_WORDS as Qe}from"./chunk-Y2G7CU6A.js";import{holderOf as qe,nameOrSomeone as en}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as nn}from"./chunk-RE4LP46F.js";import{useWords as tn}from"./chunk-MFIRYGHW.js";import{insertSeams as on,CanvasDragLayer as rn,CanvasInsert as ln}from"./chunk-SSORUDHE.js";import{DEFAULT_DRAG_WORDS as sn}from"./chunk-O2NLQBFX.js";import{createDragSession as dn,useTreeDrag as cn,gapToMoveIndex as an}from"./chunk-67GNT6PF.js";import{useCanvasFrame as pn,LIST_SELECTOR as un,BLOCK_SELECTOR as fn,useCanvasEvent as mn}from"./chunk-AWJUYMX7.js";import{zoneKey as hn,ROOT_ID as gn,ROOT_SLOT as yn,parseZoneKey as kn,find as Sn,DataError as xn}from"./chunk-KRXQM65X.js";import{useRef as vn,useMemo as wn,useState as bn,useEffect as zn,useCallback as Bn,useLayoutEffect as Cn,Fragment as On}from"react";import{toast as In}from"efficient-shell/ui";import{UndoIcon as Nn,RedoIcon as $n,RefreshIcon as An,TrashIcon as Pn,EyeOffIcon as Tn,EyeIcon as jn,DuplicateIcon as Mn}from"efficient-shell/icons/efficient";import{jsx as Rn,jsxs as Ln,Fragment as En}from"react/jsx-runtime";function Vn({expand:e}){/* @__PURE__ */
|
|
2
|
-
return Rn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Ln(En,e?{children:[
|
|
3
|
-
/* @__PURE__ */Rn("path",{d:"M8 9l4-4 4 4"}),
|
|
4
|
-
/* @__PURE__ */Rn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
5
|
-
/* @__PURE__ */Rn("path",{d:"M8 4l4 4 4-4"}),
|
|
6
|
-
/* @__PURE__ */Rn("path",{d:"M8 20l4-4 4 4"}),
|
|
7
|
-
/* @__PURE__ */Rn("path",{d:"M5 12h14"})]})})}var Dn=`${un}, ${fn}`;function Hn(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 Un="__rungs";var Fn="screen:band",Wn={duplicate:!0,delete:!0};function Gn(){const un=ve(),{target:Gn,docId:Jn,capabilities:Xn,currentSlug:Kn,siteId:Yn,onPublish:Zn,saveState:_n,saveConflict:Qn,retrySave:qn,toggleAutoSave:et,flushSave:nt,access:tt,saveUnreachable:ot=!1,readOnly:rt,readOnlyReason:it=null}=N(),lt=E(),st=V(),{mediaEditing:dt,hasEditGuard:ct,hasPinnedChrome:at}=Xn,{appState:pt,dispatch:ut,history:ft,selectedItem:mt,getSelectorForId:ht,config:gt}=Be(e=>e),yt=D(),{first:kt,firstGroup:St,lastGroup:xt,isSectionGroup:vt,sectionGroupZone:wt,panelOf:bt}=yt,zt=bt(kt),Bt=e=>se(yt,e),Ct=e=>de(yt,e),Ot="node"===yt.firstRow,It=yt.band??null,Nt=tn("screen",ze),$t=tn("tree",Te),At=tn("drag",sn),Pt=tn("notice",_e),Tt=tn("lock",nn),jt=tn("menu",je),Mt=tn("styleClipboard",be),Rt=tn("chrome",Qe),Lt=H()??`/${Kn}`,Et=U(),Vt=F(),Dt=w({readOnly:rt}),Ht=w({readOnly:rt,foldIntoHistory:!0}),Ut=vn(null),Ft=Ce(),Wt=wn(()=>({...Dt,select:e=>{Ut.current=e,Dt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Ft.config;Ut.current=Me(e,t,n)}Dt.commitDocument(e,n)}}),[Dt,Ft]),Gt=pt.ui,Jt=Gt.leftSideBarVisible,Xt=Gt.rightSideBarVisible,{options:Kt,widths:Yt,initial:Zt,fluid:_t,fit:Qt}=W(),[qt,eo]=bn(Zt),no=ke(),to=dt&&null!==no,oo=Se(),ro=xe();G(mt?.props.id);const{read:io,write:lo,forSelection:so}=J(),[co,ao]=bn(io);zn(()=>{lo(co)},[co]);const[po,uo]=bn(0),fo=vn(null),mo=vn(null),ho=pn(mo,{readySelector:Dn}),go=f(mo);m(mo,ho);const yo=I(),ko=qe(tt),So={state:_n,offline:yo||_n.failed&&ot,readOnlyReason:it,editing:ko?Pt.editing({name:en(ko.name,Tt),noun:Nt.noun}):null,conflict:null!=Qn,notSaving:Nt.bar.notSaving},xo=()=>{rt||(_n.failed?qn():nt())};h(mo,ho,xo);const[vo,wo]=bn(!1),bo=vn(!1),zo=vn(!1),[Bo,Co]=bn(null),Oo=X(),Io=e=>Co(null===e?null:{zone:ae,index:e}),[No,$o]=bn([]),[Ao,Po]=bn(K),To="puck"===Ao.kind,jo=vo&&!Bo&&Oo.railTarget?Oo.railTarget(pt.data,{node:mt??null,mode:Ao}):null,Mo=jo?{zone:hn(jo),index:jo.index}:null,Ro=Bo??Mo,Lo=Ro&&Ro.zone===ae?Ro.index:null,Eo=o(Ao,mt?.props.id),[Vo,Do]=bn(null);zn(()=>{Vo&&(r(),Do(null))},[Vo]);const Ho=vn(ht);Ho.current=ht;const Uo=Bn((e,{scroll:n})=>{ao(n=>so(e,n)),n&&Do(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Ho.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&kr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Fo=vn(null);zn(()=>{const e=Fo.current;Fo.current=null;const n=null==mt?.props.id?null:String(mt.props.id);Po(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:bt(mt?.type)??K);const t=mt?.props.id,o=Ut.current;if(Ut.current=null,!t)return;const r=ht(t);Uo(String(t),{scroll:!i(o,r??null,ae)})},[mt?.props.id,Uo]);const Wo=Bn(e=>{Po(n=>Y(n,e)?n:e),ut({type:"setUi",ui:{rightSideBarVisible:!0}})},[ut]),Go=vn(()=>{});Go.current=(e,n)=>{const t=e?pi(e.zone??ae)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==mt?.props.id?null:String(mt.props.id);Po(e=>Y(e,n)?e:n),o!==r&&(Fo.current={id:o,mode:n},Wt.select(e))};const Jo=Bn((e,n)=>Go.current(e,n),[]),Xo={kind:Ao.kind,mode:Ao,open:Wo,show:e=>Po(e),reveal:()=>{Xt||ut({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Jo},Ko=Z(Xo,{data:pt.data,selected:mt??null,zoneOf:e=>ht(e)?.zone,readOnly:Boolean(rt),select:e=>{Po(K),Wt.select({index:e})},replace:(e,n)=>Wt.replaceComponent(ae,e,n),scrollTo:e=>Ri(e)},{device:qt,refreshes:po},{setView:ao,reveal:()=>{Jt||ut({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Yo=Ko.pinnedSource??!1,Zo=Ko.resolveLeftView?Ko.resolveLeftView(co,to):"media"===co&&to?co:"sections",_o=_(),{isLockedBlock:Qo,duplicateBlocked:qo,nestDepth:er,newSectionNode:nr,canAddTo:tr,blockIsOffered:or}=_o,rr=Q(),{labelAtLevel:ir,Icon:lr,useProducts:sr}=rr,dr=rr.rowName?(e,n,t)=>rr.rowName(e,n,t):void 0,cr=Bn(e=>{ut({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),Uo(e,{scroll:!0})},[ut,Uo]),{selectNode:ar,openPartId:pr}=v({mode:Ao,setMode:Po,onOpenPart:cr}),[ur,fr]=bn(null);we(null!==ur,()=>fr(null));const mr=k(q()),hr=mr.collapsed,gr=mr.panelWidths,[yr,kr]=bn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(hr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
8
|
-
return new Set}});zn(()=>{try{window.localStorage.setItem(hr,JSON.stringify([...yr]))}catch{}},[yr]);const[Sr,xr]=bn(()=>{if("undefined"==typeof window)return{...S};try{const e=window.localStorage.getItem(gr);if(!e)return{...S};const n=JSON.parse(e);return{left:x(Number(n.left)||S.left),right:x(Number(n.right)||S.right)}}catch{return{...S}}});zn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(gr,JSON.stringify(Sr))}catch{}},300);return()=>clearTimeout(e)},[Sr]);const vr=Bn((e,n)=>xr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),wr=Bn(e=>vr("left",e),[vr]),br=Bn(e=>vr("right",e),[vr]),zr=e=>yr.has(e),Br=e=>kr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Cr=vn(!1),Or=vn(null);zn(()=>{if(Cr.current&&!vo){const e=Or.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??mo.current?.querySelector(`button[aria-label="${CSS.escape(Nt.add.title)}"]`))?.focus(),Or.current=null}Cr.current=vo},[vo]),zn(()=>{if(!vo||!go)return;const e=e=>{"Escape"===e.key&&Gi()};return go.addEventListener("keydown",e),()=>go.removeEventListener("keydown",e)},[vo,go]),we(vo,()=>Gi()),zn(()=>{!Jt&&vo&&(wo(!1),Co(null),bo.current=!1)},[Jt]),zn(()=>{if(!oo)return zo.current&&ut({type:"setUi",ui:{leftSideBarVisible:!1}}),void(zo.current=!1);vo&&(wo(!1),Co(null),zo.current=bo.current,bo.current=!1),Jt||(zo.current=!0,ut({type:"setUi",ui:{leftSideBarVisible:!0}}))},[oo]),zn(()=>{!Jt&&oo&&(zo.current=!1,ro())},[Jt]),zn(()=>{if(!oo||!go)return;const e=e=>{"Escape"===e.key&&ro()};return go.addEventListener("keydown",e),()=>go.removeEventListener("keydown",e)},[oo,go]),we(null!==oo,()=>ro());const Ir=ee(),Nr=(e,n="success",t)=>{if(Ir)return void(t?Ir(e,"error"===n?"error":"info",t):Ir(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?In.error(e,{...o,duration:t?.duration??3200}):In.success(e,{...o,duration:t?.duration??1900})},$r=vn(null),[Ar,Pr]=bn(0),[Tr,jr]=bn(0),Mr=ne(),Rr=vn(null),Lr=e=>Math.max(0,e.clientHeight-(Rr.current?.offsetHeight??0));zn(()=>{const e=$r.current;if(!e)return;const n=()=>{Pr(e.clientWidth),jr(Lr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Rr.current&&t.observe(Rr.current),()=>t.disconnect()},[]),Cn(()=>{$r.current&&(Pr($r.current.clientWidth),jr(Lr($r.current)))},[Sr,Jt,Xt]);const Er=qt===_t?Ar>0?Ar:Yt[_t]:Yt[qt],Vr=Ar>0?Math.min(Ar/Er,"shrink"===Qt?1:2):1,Dr=Er*Vr,Hr=Ar>0&&Dr>Ar+1,Ur={width:Dr,height:Tr||"100%",flex:"none",position:"relative"},Fr={width:Er,height:Tr?Tr/Vr:"100%",maxHeight:"none",transform:1!==Vr?`scale(${Vr})`:void 0,transformOrigin:"top left"},Wr=()=>ut({type:"setUi",ui:{leftSideBarVisible:!Jt}}),Gr=()=>ut({type:"setUi",ui:{rightSideBarVisible:!Xt}}),Jr=e=>{vo&&(wo(!1),Co(null),bo.current=!1,Jt&&co===e)||oo&&(zo.current=!1,ro(),Jt&&co===e)||(Jt&&co===e?Wr():(ao(e),Jt||ut({type:"setUi",ui:{leftSideBarVisible:!0}})))},Xr=()=>{$(un,{accept:"image/*",title:Rt.mediaLibrary})},Kr=()=>{Po(K),Wt.select(null),u()},Yr=()=>{Po(zt??K),Xt||ut({type:"setUi",ui:{rightSideBarVisible:!0}})},Zr=pt.data.content??[],_r=()=>{const e=Zr.findIndex(Bt),n=Zr.findIndex(Ct);return{floor:e>=0?e+1:0,cap:n>=0?n:Zr.length}},Qr=gt,qr=_o.stripCopy,ei=n=>e(n,qr),ni=b(),ti=Re({data:pt.data,config:Qr,readOnly:Boolean(rt),clipboard:ni,strip:qr?e=>qr(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==gn||e.slot!==yn)return{min:0,max:n-1};const{floor:t,cap:o}=_r();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Po(K);const t=void 0===n||"node"===n?.kind?n:null;Wt.commitDocument(e,t)}}),oi=e=>{const n=Sn(pt.data,gt,e);if(!n)return!1;const t=hn(n.place),o=n.node,r=t===ae?di(o):wi(o);return!!ti.remove(e)&&(Nr(Nt.deleted({name:r}),"success",{duration:8e3,action:{label:Nt.bar.undo,onClick:()=>{ti.restore(n.node,n.place)}}}),!0)},ri={...ti,remove:oi},ii=e=>ir(e,"block",gt.components[e]?.label??e),li=Bn(e=>gt.components[e]?.defaultProps??{},[gt]),si=e=>ir(e,"section",ii(e)),di=e=>l({type:e.type,props:e.props??{}},si(e.type),dr),{nodeAddresses:ci,zoneItems:ai}=wn(()=>{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>=ue)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of fe(gt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(Zr,ae,0),{nodeAddresses:e,zoneItems:n}},[Zr,gt]),pi=Bn(e=>ai.get(e)??[],[ai]),ui=e=>{const n=ci.get(e);return n?pi(n.zone)[n.index]:void 0},fi=e=>ce(_o,gt,e),mi=e=>{if(!_o.slotsOf||e===ae)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=ui(e.slice(0,n));if(!t)return null;const o=fi(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}},hi=(()=>{if(!te(Ao))return null;const e=`${Ao.nodeId}:${Ao.slot}`;return mi(e)?.slot.panel===Ao.kind?e:null})(),gi=vn(null);zn(()=>{const e=gi.current;if(gi.current=null,!hi||!te(Ao))return;const n=Ao.nodeId;Uo(n,{scroll:e!==hi}),kr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Ao]);const yi=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ci.get(e);n&&(n.zone===ae?Li(n.index):fl(n.zone,n.index,e,ui(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&hi!==i&&(gi.current=i),Jo(null,r),Xt||ut({type:"setUi",ui:{rightSideBarVisible:!0}}),Ri(o)},ki=(e,n,t)=>{const o=`${e}:${n}`;if(kr(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;hi!==o&&(gi.current=o);Jo(null,{kind:t,nodeId:e,slot:n})},Si=(e,n,t)=>{if(rt||!_o.moveSlot)return;const o=ui(e),r=o?fi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Un,index:n},s=an(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=_o.moveSlot(e,n,s);"string"==typeof d&&ki(e,d,i.panel)},xi=sr(),vi=wn(()=>{const e=/* @__PURE__ */new Map;for(const n of xi??[])e.set(n.slug,n.name);return e},[xi]),wi=e=>s(e,ii,rr.plainText,e=>vi.get(e),rr.rowName),bi=(e,n)=>{const t=gt.components[e.type]?.fields,o=n===ae||Al(n)?"section":"block",r=n===ae&&(Bt(e)||Ct(e)||vt(e.type)),i="block"===o?d(t):r?null:c(t);return rr.renamePropOf?rr.renamePropOf(e,o,i):i},zi=(e,n,t,o)=>{if(!(!rt&&ur?.zone===e&&ur.index===n))return;const r=(t,o)=>{fr(null),o&&((e,n,t)=>{const o=pi(e)[n];if(!o)return;const r=bi(o,e);r&&Wt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
9
|
-
return Rn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Nt.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)},Bi=t(oe(),Mt),Ci=Bi.scope({target:Gn,siteId:Yn,docId:Jn}),Oi=gt,Ii=(e,n)=>n===ae?si(e):ii(e),Ni=(e,n,t)=>{const o=Bi.plan(Ci,t,Ii(t.type,e),Oi);o&&(o.changed&&Wt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Nr(o.message))},$i=z({nodesIn:pi,nodeAt:(e,n)=>pi(e)[n]??null,labelOf:(e,n)=>n===ae?si(e):ii(e),renamePropOf:bi,beginRename:(e,n)=>fr({zone:e,index:n}),history:{hasPast:ft.hasPast,hasFuture:ft.hasFuture,back:()=>ft.back(),forward:()=>ft.forward()},openAddSection:()=>{Wt.select(null),Fi(null)},openPageSettings:()=>{Wt.select(null),Po(K)},pageSettingsLabel:Nt.pageSettings,words:{menu:jt,styleClipboard:Mt,screen:Nt.menu},readOnly:Boolean(rt),collapseAll:()=>kr(new Set(pi(ae).map(e=>String(e.props.id)))),onPasteRefused:e=>Nr(e?Nt.pasteRefused({name:e.label}):Nt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Tl(e,n),menuRows:Ko.menuRows,isLocked:e=>Qo(e.type),duplicateBlocked:e=>qo(pt.data,e),permits:e=>pe(gt,e.type),canAddTo:tr,nodeOps:ri,isPinned:(e,n)=>n===ae&&(Bt(e)||Ct(e)),sectionBand:_r,openAddInside:(e,n)=>{e===ae?Li(n):Wt.select({zone:e,index:n}),Fi(null)},locate:e=>ci.get(e)??null,rowNameOf:(e,n)=>n===ae?di(e):wi(e),selectAt:(e,n,t,o)=>{e===ae?Li(n):fl(e,n,t,o??"")},slotRung:e=>{const n=mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>yi(n.node,n.slot,!1)}:null},style:{held:()=>A(Ci),canCopy:e=>Bi.rows(Oi,e).some(e=>!1!==e.counted),copy:(e,n)=>Bi.copy(Ci,e,Ii(e.type,n),Oi),paste:(e,n,t)=>Ni(e,n,t)},keys:st?{target:go,selected:()=>{const e=pt.ui.itemSelector;return e?{zone:e.zone??ae,index:e.index}:null},held:()=>ni.get(),readOnly:Boolean(rt),onDone:({done:e,name:n})=>{"copied"===e&&Nr(Nt.copied({name:n}))}}:void 0},ho),Ai=vn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});zn(()=>{Ai.current={copy:(e,n)=>Bi.copy(Ci,e,Ii(e.type,n),Oi),paste:Ni,at:()=>{const e=pt.ui.itemSelector;if(!e)return null;const n=e.zone??ae,t=pi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(rt)}});const Pi=Bn(e=>{const n=P(e);if(!n)return;const t=Ai.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))},[]);zn(()=>{if(!go)return;const e=e=>Pi(e);return go.addEventListener("keydown",e),()=>go.removeEventListener("keydown",e)},[Pi,go]),mn(ho,"keydown",Pi);const Ti=Zr.map(e=>e.props.id).join("|");zn(()=>{const e=ho?.document??null,n=ho?.window??null;let t=0;const o=[],r=()=>{if(!e)return void $o(e=>e.length?[]:e);const n=Zr.findIndex(Ct),t=n>=0?n:Zr.length,o=n=>{const t=Zr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(fn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=Zr.length>0&&!Bt(Zr[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=Hn(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})}$o(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()}},[ho,Ti,qt,Vr,Jt,Xt,mt?.props.id]);const ji=ho?.document??null,Mi=ho?.window??null;zn(()=>{const e=fo.current;if(!e||!ji||!Mi)return;const n=[],t=()=>{const n=ji.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Mi.scrollTo({left:Mi.scrollX,top:Mi.scrollY+t,behavior:"instant"}),!0};return fo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[ji,Mi]);const Ri=e=>{Ko.holdCanvasOn?Ko.holdCanvasOn(e):a(e)},Li=e=>{Po(K),Wt.select({index:e}),Ko.sectionPressed?.(Zr[e]);const n=Zr[e]?.props?.id;n&&Ri(n)},Ei=e=>{const{floor:n,cap:t}=_r(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=mt&&Ao.kind!==zt?.kind?Zr.findIndex(e=>e.props.id===mt.props.id):-1;return o(r>=0?r+1:t)},Vi=(e,n)=>{const{floor:t,cap:o}=_r(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Wt.reorderComponent(ae,e,i),Wt.select({index:i}),{moved:!0,dest:i})},Di=(e,n,t,o)=>{Po(K),Wt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),Nr(Nt.sectionAdded({name:t}))},Hi=(e,n)=>{const t=Ei(n),o=nr(e,{nodeDefaults:li,newNodeId:ye,sectionLabel:si,blockIsOffered:or}),r=o?Wt.insertNode(ae,t,o):Wt.insertSection(e,t);return Di(t,r,si(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 fe(gt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=tr(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,n,t)=>{const o=Ei(t),r=Wt.insertNode(ae,o,n);return Di(o,r,e),o},Fi=e=>Wi(ae,e),Wi=(e,n)=>{Or.current=document.activeElement??null,oo&&(bo.current=zo.current,zo.current=!1,ro()),Co(null===n?null:{zone:e,index:n}),wo(!0),Jt||(bo.current=!0,ut({type:"setUi",ui:{leftSideBarVisible:!0}}))},Gi=()=>{wo(!1),Co(null),bo.current&&ut({type:"setUi",ui:{leftSideBarVisible:!1}}),bo.current=!1},Ji=(e,n,t)=>{if("section"===e.kind)Wt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Wt.insertNode(n,t,ei(e.template.node))}Po(K),Wt.select({index:t,zone:n})},Xi=(e,n)=>rr.rowName?n?Bt(e)?rr.rowName(e,"section",Nt.header):Ct(e)?rr.rowName(e,"section",Nt.footer):vt(e.type)?rr.rowName(e,"section",ii(e.type)):di(e):wi(e):n?si(e.type):ii(e.type),Ki=e=>n=>{e()},Yi=()=>Ko.editPinnedSource?.(),Zi=(e,n,t)=>{if(rt)return null;const o=pi(e)[n];return o&&!pe(gt,o.type).delete?null:/* @__PURE__ */Rn(Ae,{kind:"delete",label:Nt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=pi(e)[n]?.props?.id;null!=t&&oi(String(t))})(e,n),children:/* @__PURE__ */Rn(Pn,{size:15})})},_i=e=>rr.rowPreview?.(e)||void 0,Qi=e=>rr.rowMarks?.(e)??void 0,qi=(e,n,t)=>rr.rowActions?.(e,n,t)??null,el=(e,n,t,o)=>{if(rt)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
10
|
-
return Rn(Ae,{kind:"eye",label:r?Nt.showNamed({name:o}):Nt.hideNamed({name:o}),onClick:()=>tl(e,n,t),children:/* @__PURE__ */Rn(r?Tn:jn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},nl=e=>{const n=si(Zr[e]?.type??""),t=n?Nt.addSectionBefore({name:n}):Nt.addSectionHere;return ts(ae,e,()=>Fi(e),t)},tl=(e,n,t)=>{Wt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},ol=e=>me(gt,e),rl=e=>fe(gt,e),il=e=>_o.slotsOf?fi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:he(e,n.slot)})):[{slot:null,rung:null,kids:rl(e)}],ll=e=>_o.slotsOf?il(e).flatMap(e=>e.kids):rl(e),sl=e=>Boolean(_o.slotsOf)&&fi(e).some(e=>e.rung),dl=(e,n,t)=>null===t?void 0===n?tr(e):tr(e,n):tr(e,n,t),cl=(e,n,t)=>{const o=ge(gt,e.type,n)&&(t||ll(e).length>0||sl(e));return{collapsible:o,folded:o&&zr(String(e.props.id))}},al=(e,n,t)=>il(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>cl(e,r,t(e.type)).collapsible?[String(e.props.id),...al(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),pl=e=>ll(e).length>0||sl(e)||Boolean(tr(e.type)),ul=e=>Boolean(tr(e)),fl=(e,n,t,o)=>{if(Po(K),tr(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),Wt.select({index:n,zone:e}),a(t)}else Wt.select({index:n,zone:e}),Ri(t)},ml=(e,n,t,o,r)=>{const i=`${e}:${n}`;Wt.insertComponent(i,t,o),tr(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),Wt.select({index:o,zone:i})}):Wt.select({index:o,zone:i})},hl=(e,n,t)=>{Wt.insertComponent(e,n,t),Po(K),Wt.select({index:t,zone:e})},gl=vn(/* @__PURE__ */new Set);zn(()=>{Zr.forEach(e=>{const n=tr(e.type)?.spec;if(!n)return;const t=e.props.id;if(gl.current.has(t))return;gl.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(li)).forEach((e,t)=>Ht.seedChild(o,t,n.childType,e))})},[Zr,Ht,li]);const yl=vn(/* @__PURE__ */new Set);zn(()=>{Zr.forEach((e,t)=>{const o=e.props.id;if(yl.current.has(o))return;const r=n(e,ol(e.type));yl.current.add(o),r&&Ht.replaceComponent(ae,t,{...e,props:r})})},[Zr,Ht]),re(Ht,gt);const kl=Zr.findIndex(Ct),Sl=kl>=0?Zr[kl]:null,xl=Ot?Zr.findIndex(Bt):-1,vl=xl>=0?Zr[xl]:null,wl=Zr.find(e=>e.type===St)??null,bl=Zr.find(e=>e.type===xt)??null,zl=kl>=0?kl:Zr.length,Bl=[];Zr.forEach(e=>{Ct(e)||(pl(e)&&Bl.push(String(e.props.id)),Bl.push(...al(e,1,ul)))}),Sl&&(Bl.push(String(Sl.props.id)),Bl.push(...al(Sl,1,ul)));const Cl=Bl.length>0&&Bl.every(e=>yr.has(e)),Ol=e=>{const n=rr.blockRowName(e,ii);return rr.rowName?rr.rowName(e,"block",n):n},Il=(e,n,t,o)=>{const r=pi(e)[t];if(!r)return;const i={...kn(e),index:t},l={...kn(n),index:Math.min(Math.max(o,0),pi(n).length)},s=an(i,l);if(e!==n||s!==t)try{ti.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof xn))throw e}},Nl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of rl(e))n.add(r),t(o)};for(const t of ol(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},$l=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ci.get(n);if(!e)return null;if(e.zone===ae)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Al=e=>{const n=e.slice(0,e.indexOf(":")),t=Zr.find(e=>vt(e.type)&&String(e.props.id)===n);return t&&wt(n)===e?t:null},Pl=(e,n,t)=>{if(e.rung){const t=ui(e.rung.nodeId),o=t?fi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Un&&n.index>=0&&n.index<=o}if(n.slot===Un)return!1;if(e.add)return Ml(e.add,n);const o=hn(n);if(vt(e.type))return!1;const r=Al(o),i=Al(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=pi(o).length);if(e.zone===ae||o===ae){if(e.zone!==o)return!1;const{floor:t,cap:r}=_r();return n.index>=t&&n.index<=r}if(n.index<0||n.index>pi(o).length)return!1;if(e.zone===o)return!0;const l=Sl&&!yt.lastIsOpen?String(Sl.props.id):null;return(!l||$l(e.zone)!==l&&$l(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??pi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ci.get(i),s=l?pi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Nl(r).has(n))return!1;const d=tr(s.type,er(pt?.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?.(pi(n),r))})(e.zone,o,e.index,t)},Tl=(e,n)=>{const t=hn(e.from);if(t===hn(n))return!0;const o=e.node;return Pl({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},jl=e=>{const n=e.slice(0,e.indexOf(":")),t=ci.get(n),o=t?pi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=tr(o.type,er(pt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=r.choices??(r.spec?[{type:r.spec.childType,label:ii(r.spec.childType)}]:[]),l=mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Xi(o,t.zone===ae)}},Ml=(e,n)=>{const t=hn(n);if("block"!==e.kind){if(Al(t))return n.index>=0&&n.index<=pi(t).length;if(t!==ae)return!1;const{floor:e,cap:o}=_r();return n.index>=e&&n.index<=o}if(t===ae)return!1;const o=jl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(pi(t))},Rl=(e,n)=>{e.rung?Si(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&Al(hn(n)))return void Ji(e,hn(n),n.index);if("section"===e.kind)return void Hi(e.type,n.index);if("template"===e.kind)return void Ui(e.template.name,ei(e.template.node),n.index);const t=hn(n),o=jl(t);o&&(o.target.spec?ml(o.parentId,o.target.slot,e.type,n.index,o.parent.type):hl(t,e.type,n.index))})(e.add,n):e.zone===ae?Vi(e.index,n.index):Il(e.zone,hn(n),e.index,n.index)},[Ll]=bn(()=>dn()),El=cn({keyOf:e=>e.id,readOnly:Boolean(rt),session:Ll,canDrop:Pl,onDrop:Rl,onStep:(e,n)=>{e.rung?Si(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ae?((e,n)=>{const t=si(Zr[e]?.type??""),o=Vi(e,n<0?e-1:e+2);if(!o.moved)return void Nr(n<0?Nt.sectionFirst({name:t}):Nt.sectionLast({name:t}));const{floor:r,cap:i}=_r();Nr(Nt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Il(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Vl=Bn(e=>{const{floor:n,cap:t}=_r(),o=[];for(const r of e.nodes){const e=hn(r.place),i=pi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Bt(i)||Ct(i)||Qo(i.type))continue;if(vt(i.type))continue;const l=Boolean(Al(e)),s=e===ae||l;e===ae&&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?si(i.type):wi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=hn(e.list);return n===ae&&0===e.children.length?[{...e,addLabel:Nt.addSection,addAlways:!0}]:e.children.length>0||Boolean(jl(n)?.choices.length)||Boolean(Al(n))?[e]:[]}),i=r.flatMap(e=>{const n=hn(e.list);return n===ae||Al(n)||!jl(n)?.choices.length?[]:on(e,Nt.addBlockHere)});return{sources:o,zones:r,seams:i}},[pt.data]),Dl=null==mt?.props.id?null:String(mt.props.id),Hl=Bn(e=>{const n=gt,t=e=>!e.item.rung&&null!==Sn(pt.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(Dl);return i||(r(Le(pt.data,n,o.item.id,Dl))??o)},[pt.data,gt,Dl]),Ul=e=>{Po(K),Wt.select(e.zone===ae?{index:e.index}:{index:e.index,zone:e.zone})},Fl=ie(),Wl=()=>({data:pt.data,device:qt,ops:Wt,inspector:Xo}),Gl=Fl?.model,Jl=wn(()=>Gl?e=>Gl(e,Vl(e),Wl()):Vl,[Gl,Vl,qt]),Xl=Fl?.measure,Kl=Xl?(e,n)=>Xl(e,n,Wl()):void 0,Yl=Fl?.canDrop,Zl=Yl?(e,n)=>Yl(e,n,Pl,Wl()):Pl,_l=Fl?.drop,Ql=_l?(e,n)=>_l(e,n,Rl,Wl()):Rl,ql=Fl?.pick,es=ql?e=>ql(e,Ul,Wl()):Ul,ns=e=>{const n=hn(e),t=mi(n);t&&yi(t.node,t.slot,!1),Wi(n,e.index)},ts=(e,n,t,o)=>/* @__PURE__ */Rn(Pe,{...rt?{}:El.seam({place:{...kn(e),index:n}}),onAdd:rt?void 0:t,label:o},`seam:${e}:${n}`),os={rowClick:Ki,isCollapsed:zr,toggleCollapse:Br},rs=e=>{const n=String(e.props.id),t=Zr.findIndex(e=>String(e.props.id)===n),o=wt(n),r=pi(o),i=zr(n),l=ii(e.type),s=rr.rowName?rr.rowName(e,"section",l):l,d=e=>ts(o,e,()=>Wi(o,e),Nt.addSectionHere);/* @__PURE__ */
|
|
11
|
-
return Ln(En,{children:[
|
|
12
|
-
/* @__PURE__ */Rn(Oe,{words:$t,icon:/* @__PURE__ */Rn(lr,{type:e.type,size:13}),name:s,preview:_i(e),marks:Qi(e),onSelect:()=>Li(t),nameSlot:zi(ae,t,n,s),selected:Eo===n,actions:qi(e,ae,t)??void 0,rowProps:{"data-node-id":n,onClick:Ki(()=>Li(t))},fold:{open:!i,label:"section",onToggle:()=>Br(n)}}),!i&&/* @__PURE__ */Ln(Ie,{children:[r.map((n,t)=>{const r=String(n.props.id),i=di(n),l=pl(n),s=l&&zr(r),c=()=>fl(o,t,r,e.type),{rowProps:a,...p}=El.row({item:{id:r,zone:o,index:t,type:n.type},place:{...kn(o),index:t}},{"data-node-id":r,onClick:Ki(c)});/* @__PURE__ */
|
|
13
|
-
return Ln(On,{children:[d(t),
|
|
14
|
-
/* @__PURE__ */Rn(Oe,{words:$t,icon:/* @__PURE__ */Rn(lr,{type:n.type,size:13}),name:i,preview:_i(n),marks:Qi(n),onSelect:c,nameSlot:zi(o,t,r,i),selected:Eo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Br(r)}:void 0,actions:/* @__PURE__ */Ln(En,{children:[Zi(o,t,i),qi(n,o,t),el(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Rn(Ie,{children:ss(n,2)})]},r)}),d(r.length)]})]})},is=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=El.dragging,d=!zr(l)&&s?.rung?.nodeId!==i,c={...kn(l),index:0},a=s&&!s.rung&&Pl(s,c)?c:void 0,p=()=>yi(e,n,!0),{rowProps:u,...f}=El.row({item:{id:`rung:${l}`,zone:`${i}:${Un}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Un,index:t},into:a,canDrag:Boolean(_o.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Ki(p)}),m=rt?null:_o.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
15
|
-
return Ln(On,{children:[n.heading,
|
|
16
|
-
/* @__PURE__ */Rn(Oe,{words:$t,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:hi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Br(l)},actions:m&&m.length>0?/* @__PURE__ */Rn(En,{children:m.map((t,o)=>/* @__PURE__ */Rn(Ae,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(rt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ki(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__ */Rn(Pn,{size:15}):/* @__PURE__ */Rn(Mn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Rn(Ie,{children:r})]},l)},ls=(e,n)=>{const t=il(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
17
|
-
return Rn(En,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=dl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=null!==c&&Boolean(jl(c)?.choices.length),p=(e,n)=>a?ts(e,n,()=>Wi(e,n),Nt.addBlockHere):ts(e,n),u=/* @__PURE__ */Ln(En,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Eo===String(n.props.id),{collapsible:i,folded:s}=cl(n,l,ul(n.type)),d=String(n.props.id),c=Ol(n),a=()=>fl(t,o,d,e.type),{rowProps:u,...f}=El.row({item:{id:d,zone:t,index:o,type:n.type},place:{...kn(t),index:o}},{"data-node-id":d,onClick:Ki(a)});/* @__PURE__ */
|
|
18
|
-
return Ln(On,{children:[0===o&&p(t,0),
|
|
19
|
-
/* @__PURE__ */Rn(Oe,{words:$t,icon:/* @__PURE__ */Rn(lr,{type:n.type,size:13}),name:c,preview:_i(n),marks:Qi(n),onSelect:a,nameSlot:zi(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Br(d)}:void 0,actions:/* @__PURE__ */Ln(En,{children:[Zi(t,o,c),qi(n,t,o),el(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Rn(Ie,{children:ls(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==c?null:p(c,0)]});return t.rung?is(e,t.rung,r++,o,u):/* @__PURE__ */Rn(On,{children:u},t.slot??"")})})},ss=(e,n)=>{const t=er(pt?.data,e.type,String(e.props.id)),o=il(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
20
|
-
return Rn(En,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=dl(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,m=p?`${u}:${p.slot}`:null,h=(n,t)=>{const o=n===f&&c&&!c.addBlocked?.(a)?()=>ml(e.props.id,c.slot,c.childType,t,e.type):n===m?()=>Wi(n,t):void 0;return ts(n,t,o,n===f&&c?c.addLabel:Nt.addBlockHere)},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),k=/* @__PURE__ */Ln(En,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Eo===String(n.props.id),i=wi(n),l=String(n.props.id),{collapsible:d,folded:c}=cl(n,s,ul(n.type)),a=ol(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...kn(p),index:pi(p).length}:void 0,f=El.dragging,m=u&&f&&Pl(f,u)?u:void 0,g=()=>fl(t,o,l,e.type),{rowProps:y,...k}=El.row({item:{id:l,zone:t,index:o,type:n.type},place:{...kn(t),index:o},into:m,canDrag:!Qo(n.type)},{"data-node-id":l,onClick:Ki(g)});/* @__PURE__ */
|
|
21
|
-
return Ln(On,{children:[0===o&&h(t,0),
|
|
22
|
-
/* @__PURE__ */Rn(Oe,{words:$t,icon:/* @__PURE__ */Rn(lr,{type:n.type,size:13}),name:i,preview:_i(n),marks:Qi(n),onSelect:g,nameSlot:zi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>Br(l)}:void 0,actions:Qo(n.type)?qi(n,t,o)??void 0:/* @__PURE__ */Ln(En,{children:[Zi(t,o,i),qi(n,t,o),el(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Rn(Ie,{children:ss(n,s+1)}),h(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
23
|
-
/* @__PURE__ */Rn(T,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>ml(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?m&&!l.some(e=>e.zone===m)?h(m,0):null:0!==l.length||(o.rung?y:g!==m)?null:h(g,0)]});return o.rung?is(e,o.rung,i++,r,k):/* @__PURE__ */Rn(On,{children:k},o.slot??"")})})},ds=(()=>{if(!mt||!To)return null;const e=String(mt.type),n=String(mt.props.id),t=tr(e,er(pt?.data,e,n));if(!t||"footer"===t.source)return null;const o=Zr.some(e=>String(e.props?.id)===n),r=Array.isArray(mt.props[t.slot])?mt.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:ii(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:Xi(mt,o),choices:i,onPick:o=>{t.spec?ml(n,t.slot,o,r.length,e):hl(`${n}:${t.slot}`,o,r.length)}}})(),cs=Ro&&Ro.zone!==ae&&!Al(Ro.zone)?Ro.zone:null,as=!0===Oo.blocksFirst,ps=cs?jl(cs):as&&Ro?null:ds,us=Boolean(Bo&&cs)||as&&Boolean(ps&&ps.choices.length>0),fs=vo||null!==oo,ms=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Jt&&!fs&&Zo===e.id,onSelect:()=>Jr(e.id)}:e,hs=[{id:"add",label:Nt.add.title,icon:/* @__PURE__ */Rn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:vo,onSelect:()=>vo?Gi():Fi(null)},...(Ko.railLead??[]).map(ms),{id:"sections",label:Nt.layers,icon:/* @__PURE__ */Rn(Ee,{}),active:Jt&&!fs&&"sections"===Zo,onSelect:()=>Jr("sections")},...(Ko.railTrail??[]).map(ms)];to?hs.push({id:"media",label:Nt.railMedia,icon:/* @__PURE__ */Rn(Ve,{}),active:Jt&&!vo&&(null!==oo||"media"===Zo),onSelect:()=>Jr("media")}):dt&&hs.push({id:"media",label:Nt.railMedia,icon:/* @__PURE__ */Rn(Ve,{}),onSelect:Xr});const gs=[...Ko.railLead??[],...Ko.railTrail??[]].find(e=>"panel"in e&&e.id===Zo),ys=Boolean(It?.foldable)&&!Yo,ks=It?.label??(ct?Nt.pageSections:Nt.templateSections),Ss=ys&&zr(Fn),xs=/* @__PURE__ */Ln(En,{children:[Zr.map((e,n)=>{if(Bt(e)||Ct(e)||vt(e.type))return null;const t=Eo===String(e.props.id),o=Boolean(e.props._hidden);rl(e);const r=String(e.props.id),i=Ko.hasOwnRows?.(e)??!1,l=pl(e)||i,s=l&&zr(r),d=ol(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...kn(c),index:pi(c).length}:void 0,p=El.dragging,u=a&&p&&Pl(p,a)?a:void 0,{rowProps:f,...m}=El.row({item:{id:r,zone:ae,index:n,type:e.type},place:{...kn(ae),index:n},into:u},{"data-node-id":r,onClick:Ki(()=>Li(n))});/* @__PURE__ */
|
|
24
|
-
return Ln(On,{children:[n>0&&nl(n),
|
|
25
|
-
/* @__PURE__ */Rn(Oe,{words:$t,icon:/* @__PURE__ */Rn(lr,{type:e.type,size:13}),name:di(e),preview:_i(e),marks:Qi(e),onSelect:()=>Li(n),nameSlot:zi(ae,n,r,di(e)),selected:t,hidden:o,...m,fold:l?{open:!s,label:"section",onToggle:()=>Br(r)}:void 0,actions:/* @__PURE__ */Ln(En,{children:[Zi(ae,n,di(e)),qi(e,ae,n),el(ae,n,e,di(e))]}),rowProps:f}),pl(e)&&!s&&/* @__PURE__ */Ln(Ie,{children:[ss(e,1),Ko.partRows?.(e,os)]}),i&&!s&&/* @__PURE__ */Rn(Ie,{children:Ko.ownRows?.(e,n,os)})]},String(e.props.id??n))}),!Yo&&zl>0&&nl(zl),It?.addAtEnd&&!Yo&&!rt&&/* @__PURE__ */Rn(T,{small:!0,label:Nt.addSection,blocked:null,onAdd:()=>Fi(zl)})]}),vs=(e,n,t)=>{const o=String(e.props.id),r=ll(e).length>0||sl(e)||Boolean(tr(e.type)),i=r&&zr(o),l="header"===t?Nt.header:Nt.footer,s=rr.rowName?rr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
26
|
-
return Ln(En,{children:[
|
|
27
|
-
/* @__PURE__ */Rn(Oe,{words:$t,icon:/* @__PURE__ */Rn(lr,{type:t,size:13}),name:s,preview:_i(e),marks:Qi(e),onSelect:()=>Li(n),nameSlot:zi(ae,n,o,s),selected:Eo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Br(o)}:void 0,actions:qi(e,ae,n)??void 0,rowProps:{"data-node-id":o,onClick:Ki(()=>Li(n))}}),r&&!i&&/* @__PURE__ */Rn(Ie,{children:ls(e,1)})]})};return(Ko.wrap??(e=>e))(
|
|
28
|
-
/* @__PURE__ */Rn(le,{target:ho,children:/* @__PURE__ */Ln("div",{ref:mo,className:"sf-editor es-editor",style:Ze(Sr),onContextMenu:$i.onEditorContextMenu,...g(un),children:[
|
|
29
|
-
/* @__PURE__ */Ln(De,{children:[
|
|
30
|
-
/* @__PURE__ */Rn(He,{items:hs,ariaLabel:Nt.bar.views}),
|
|
31
|
-
/* @__PURE__ */Ln(Ue,{children:[
|
|
32
|
-
/* @__PURE__ */Rn(Fe,{label:Nt.bar.undo,disabled:Boolean(rt)||!ft.hasPast,onClick:()=>ft.back(),children:/* @__PURE__ */Rn(Nn,{})}),
|
|
33
|
-
/* @__PURE__ */Rn(Fe,{label:Nt.bar.redo,disabled:Boolean(rt)||!ft.hasFuture,onClick:()=>ft.forward(),children:/* @__PURE__ */Rn($n,{})}),
|
|
34
|
-
/* @__PURE__ */Rn(We,{}),
|
|
35
|
-
/* @__PURE__ */Rn(Ge,{devices:Kt,value:qt,onChange:eo}),
|
|
36
|
-
/* @__PURE__ */Rn(Fe,{label:Nt.bar.refresh,tip:Nt.bar.refreshTip,onClick:()=>{fo.current=(()=>{const e=ho?.document;if(!e)return null;const n=Zr.findIndex(Ct),t=n>=0?n:Zr.length;let o=null;for(let n=0;n<t;n++){const t=Zr[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=mt?.props?.id??Zr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),uo(e=>e+1)},children:/* @__PURE__ */Rn(An,{})})]}),
|
|
37
|
-
/* @__PURE__ */Ln(Ue,{kind:"right",style:{minWidth:300},children:[
|
|
38
|
-
/* @__PURE__ */Rn(C,{input:So,words:Nt.saveStatus}),Ko.barLead?.(),Ko.barTrail?.(),Ko.mainAction||!Ko.barMain?/* @__PURE__ */Rn(O,{input:So,action:Ko.mainAction??{label:Nt.done,onPress:()=>{Zn(pt.data)}},readOnly:Boolean(rt),saveSwitch:lt,onToggleAutoSave:et,onSaveNow:xo,bar:Nt.bar,words:Nt.saveStatus}):Ko.barMain()]})]}),
|
|
39
|
-
/* @__PURE__ */Rn(B,{}),
|
|
40
|
-
/* @__PURE__ */Ln("div",{className:"sf-body",children:[Jt?/* @__PURE__ */Ln(En,{children:[
|
|
41
|
-
/* @__PURE__ */Rn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Nt.leftPanel,children:vo?/* @__PURE__ */Rn(j,{blocks:ps,blocksOnly:us,at:Bo?{label:(e=>{const n=Al(e.zone);if(n)return Nt.add.addingTo({name:rr.rowName?Xi(n,!0):ii(n.type)});if(e.zone===ae){const n=Zr[e.index];return n&&!Ct(n)?Nt.add.addingBefore({name:Xi(n,!0)}):Nt.add.addingAtEnd}const t=jl(e.zone);return t?Nt.add.addingTo({name:t.parentName}):Nt.add.addingHere})(Bo),onClear:()=>Co(null)}:void 0,onAdd:e=>{const n=Ro,t=(e,n)=>{Bo&&Co({zone:e,index:n})};if(n&&"block"!==e.kind&&Al(n.zone))return Ji(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===Lo)return void Hi(e);const n=Hi(e,Lo);Bo&&Io(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===Lo)return void Ui(e,n);const t=Ui(e,n,Lo);Bo&&Io(t+1)})(e.template.name,ei(e.template.node));if(n&&n.zone!==ae){const o=jl(n.zone);if(!o)return;return o.target.spec?ml(o.parentId,o.target.slot,e.type,n.index,o.parent.type):hl(n.zone,e.type,n.index),void t(n.zone,n.index+1)}ds?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Ll,siteWide:Ko.addPanelRow?.(Gi),onClose:Gi,onHide:Wr,readOnly:Boolean(rt)}):oo&&no?
|
|
42
|
-
/* @__PURE__ */Rn(L,{panel:no,pick:oo,onHide:Wr}):gs?gs.panel({onHide:Wr,notify:Nr}):"media"===Zo&&no?/* @__PURE__ */Rn(L,{panel:no,pick:null,onHide:Wr}):/* @__PURE__ */Ln(En,{children:[
|
|
43
|
-
/* @__PURE__ */Rn(M,{icon:/* @__PURE__ */Rn(Ee,{}),title:Nt.layers,context:Lt,actions:
|
|
44
|
-
/* @__PURE__ */Rn(Je,{label:Cl?Nt.expandAll:Nt.collapseAll,title:0===Bl.length?Nt.nothingToFold:void 0,disabled:0===Bl.length,onClick:()=>kr(e=>{const n=new Set(Bl);return Cl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Bl])}),children:/* @__PURE__ */Rn(Vn,{expand:Cl})}),onHide:Wr}),
|
|
45
|
-
/* @__PURE__ */Ln(Ne,{className:"sf-tree sf-scroll",words:$t,children:[
|
|
46
|
-
/* @__PURE__ */Rn(Oe,{words:$t,icon:/* @__PURE__ */Rn(lr,{type:"page",size:13}),name:Nt.pageSettings,onSelect:Kr,selected:!mt&&To,rowProps:{onClick:Ki(Kr)}}),wl&&/* @__PURE__ */Ln(En,{children:[
|
|
47
|
-
/* @__PURE__ */Rn($e,{children:Nt.header}),rs(wl)]}),!Yo&&at&&/* @__PURE__ */Ln(En,{children:[
|
|
48
|
-
/* @__PURE__ */Rn($e,{children:Nt.header}),!Ot&&/* @__PURE__ */Rn(Oe,{words:$t,icon:/* @__PURE__ */Rn(lr,{type:"header",size:13}),name:Nt.header,onSelect:Yr,selected:Ao.kind===zt?.kind,rowProps:{onClick:Ki(Yr)}})]}),!Yo&&vl&&vs(vl,xl,"header"),!Yo&&!ys&&/* @__PURE__ */Rn($e,{children:ks}),ys?/* @__PURE__ */Ln(En,{children:[
|
|
49
|
-
/* @__PURE__ */Rn(Oe,{words:$t,icon:null,name:ks,fold:{open:!Ss,label:ks,onToggle:()=>Br(Fn)}}),!Ss&&/* @__PURE__ */Rn(Ie,{children:xs})]}):xs,at&&/* @__PURE__ */Rn($e,{children:Nt.footer}),Sl&&vs(Sl,kl,"footer"),!Yo&&!Sl&&at&&/* @__PURE__ */Rn(Oe,{words:$t,icon:/* @__PURE__ */Rn(lr,{type:"footer",size:13}),name:Nt.footer,onSelect:Yi,rowProps:{onClick:Ki(Yi),title:Nt.editFooter}}),bl&&rs(bl),Ko.treeFoot?.()]})]})}),
|
|
50
|
-
/* @__PURE__ */Rn(Xe,{side:"left",width:Sr.left,min:Ye,max:Ke,defaultWidth:S.left,label:Nt.resizeLeftPanel,onResize:wr})]}):/* @__PURE__ */Rn(R,{side:"left",onShow:Wr}),
|
|
51
|
-
/* @__PURE__ */Ln("div",{ref:$r,className:"sf-center sf-scroll","data-sf-canvas-head":Mr?"":void 0,style:{overflowX:Hr?"auto":"hidden",overflowY:"hidden"},children:[Mr&&/* @__PURE__ */Rn("div",{ref:Rr,className:"sf-canvas-head",children:/* @__PURE__ */Rn(Mr,{device:qt})}),
|
|
52
|
-
/* @__PURE__ */Rn("div",{className:"sf-frame-scaler",style:Ur,children:/* @__PURE__ */Rn("div",{className:"sf-frame "+(qt===_t?"":`sf-frame--${qt}`),style:Fr,children:/* @__PURE__ */Ln("div",{className:"sf-preview-host",children:[
|
|
53
|
-
/* @__PURE__ */Rn(Et,{},po),
|
|
54
|
-
/* @__PURE__ */Rn(rn,{canvas:ho,session:Ll,model:Jl,measure:Kl,canDrop:Zl,onDrop:Ql,choose:Hl,onPick:es,onZoneAdd:ns,onSeamAdd:ns,zoneAddLabel:Nt.canvasAddBlock,words:At.canvas,readOnly:Boolean(rt),revision:pt.data}),No.length>0&&/* @__PURE__ */Rn("div",{className:"sf-preview-gaps",children:No.map(e=>
|
|
55
|
-
/* @__PURE__ */Rn(ln,{index:e.index,label:Nt.addSectionHere,onInsert:()=>Fi(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))})]})})})]}),Xt?/* @__PURE__ */Ln(En,{children:[
|
|
56
|
-
/* @__PURE__ */Rn(y,{value:{selectChild:fl,addChild:ml,childRowName:wi,blockRowName:Ol},children:/* @__PURE__ */Rn(Vt,{mode:Ao,onOpenWebsiteSettings:Ko.openSettings??(()=>{}),onOpenSiteStyles:Ko.openStyles,onSelectNode:ar,onNotify:Nr,onHidePanel:Gr,nodeActions:mt?pe(gt,mt.type):Wn})}),
|
|
57
|
-
/* @__PURE__ */Rn(Xe,{side:"right",width:Sr.right,min:Ye,max:Ke,defaultWidth:S.right,label:Nt.resizeSettingsPanel,onResize:br})]}):
|
|
58
|
-
/* @__PURE__ */Rn(R,{side:"right",onShow:Gr})]}),$i.menu]})}))}export{Gn as ScreenChrome};
|
package/dist/chunk-2LBXIYF7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-2QUWI67X.js";import{decodePartId as e,encodePartId as r}from"./chunk-IYT6NN2J.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{SELECTION_MODE as n}from"./chunk-E3PD66A3.js";import{useEasel as p}from"./chunk-KYG35KKJ.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}=p(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=t(),l=d(o=>{const r=e(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),I?.(t)):i(o=>"part"===o.kind?n:o)},[i,I]);c(()=>{k(l)},[k,l]);const K=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(K)},[K,f]);return{selectNode:d(o=>{i(()=>n);const e=a(o);e&&u.select(e)},[i,a,u]),openPartId:K}}export{m as usePartBridge};
|
package/dist/chunk-AWJUYMX7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useState as e,useEffect as t,useRef as n}from"react";var o=/* @__PURE__ */new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function r(e){const t=e;if(!t||"string"!=typeof t.tagName)return!1;const n=t.tagName.toUpperCase();if("TEXTAREA"===n||"SELECT"===n)return!0;if("INPUT"===n)return!o.has(String(t.type??"text").toLowerCase());if(t.isContentEditable)return!0;const r=t.closest?.("[contenteditable]");return!(!r||"false"===r.getAttribute("contenteditable"))||null!=t.closest?.('[role="textbox"]')}var c="data-puck-component";function i(e,t=c){const n=e;return n&&"function"==typeof n.closest?n.closest(`[${t}]`)?.getAttribute(t)??null:null}function u(e){const t=e.offsetWidth;if(!t)return 1;const n=e.getBoundingClientRect().width;return n>0?n/t:1}function s(e,t,n){const o=e.getBoundingClientRect(),r=n?.getBoundingClientRect()??{left:0,top:0},c=u(e);return{left:o.left-r.left+t.left*c,top:o.top-r.top+t.top*c,width:t.width*c,height:t.height*c}}function l(e){const t=e.offsetWidth;if(!t)return 1;const n=e.getBoundingClientRect().width;return n>0?n/t:1}function a(e,t,n){const o=s(e,t,n),r=l(n);return{left:o.left/r,top:o.top/r,width:o.width/r,height:o.height/r}}function d(e,t,n){const o=e.getBoundingClientRect(),r=l(e);return{x:(t-o.left)/r,y:(n-o.top)/r}}function f(e,t,n,o){const{left:r,top:c}=s(e,{left:t,top:n,width:0,height:0},o);return{x:r,y:c}}function m({available:e,width:t,maxScale:n=1}){const o=Math.max(0,e);if(!t||t<=0)return{width:o,scale:1,shownWidth:o};const r=o>0?Math.min(o/t,n):1;return{width:t,scale:r,shownWidth:t*r}}var h="data-es-canvas-style",w=/* @__PURE__ */new WeakMap;function b(e,t){t?w.set(e,t):w.delete(e)}function v(e,t,n){const o=e.head??e.documentElement;let r=g(e,t);if(!r){r=e.createElement("style"),r.setAttribute(h,t);const n=w.get(e);n&&r.setAttribute("nonce",n),o.appendChild(r)}return r.textContent!==n&&(r.textContent=n),r}function p(e,t){g(e,t)?.remove()}function g(e,t){for(const n of Array.from(e.querySelectorAll(`style[${h}]`)))if(n.getAttribute(h)===t)return n;return null}var y="[data-puck-component]",E="[data-puck-dropzone]",A="iframe#preview-frame";function L(e){const t=e.contentDocument;if(!t||!e.contentWindow||"loading"===t.readyState||!t.body)return!1;if(e.hasAttribute("srcdoc"))return"about:srcdoc"===t.URL;const n=e.getAttribute("src");return!n||"about:blank"===n||"about:blank"!==t.URL}function C(e,t,{selector:n=A,readySelector:o}={}){let r=null,c=null,i=!1,u=!1,s=null;const l=()=>{s?.observer.disconnect(),s=null},a=()=>{if(u)return;let e=null;if(r&&L(r)){const t=r.contentDocument;(e=>{if(!o||e.querySelector(o))return l(),!0;if(s?.doc!==e){l();const t=e.defaultView?.MutationObserver;if(t){const n=new t(()=>a());n.observe(e,{childList:!0,subtree:!0}),s={doc:e,observer:n}}}return!1})(t)&&(e={frame:r,document:t,window:r.contentWindow})}else l();(e===c||!!e&&!!c&&e.frame===c.frame&&e.document===c.document)&&i||(i=!0,c=e,t(c))},d=()=>a(),f=()=>{const t=e.querySelector?.(n);t!==r?(r?.removeEventListener("load",d),r=t,r?.addEventListener("load",d),a()):a()},m=e.ownerDocument?.defaultView??e.defaultView,h=m?.MutationObserver,w=h?new h(e=>(e=>null!==r&&!r.isConnected||e.some(e=>[...e.addedNodes,...e.removedNodes].some(e=>"IFRAME"===e.nodeName||!!e.querySelector?.("iframe"))))(e)&&f()):null;return w?.observe(e,{childList:!0,subtree:!0}),f(),()=>{u=!0,w?.disconnect(),l(),r?.removeEventListener("load",d),r=null}}function S(n,{selector:o,readySelector:r}={}){const[c,i]=e(null);return t(()=>{const e=n.current;if(!e)return;const t=C(e,i,{selector:o,readySelector:r});return()=>{t(),i(null)}},[n,o,r]),c}var x="easel:canvas-typing";function R(e,o,r,{on:c="document",capture:i=!1}={}){const u=n(r);u.current=r;const s=e?.document??null,l=e?.window??null;t(()=>{const e="window"===c?l:s;if(!e)return;const t=e=>u.current(e);return e.addEventListener(o,t,i),()=>e.removeEventListener(o,t,i)},[s,l,o,c,i])}function M(e,n,o){const r=e?.document??null;t(()=>{if(!r)return;if(!o)return void p(r,n);const e=v(r,n,o),t=r.defaultView?.MutationObserver,c=t?new t(()=>{e.isConnected||v(r,n,o)}):null;return c?.observe(r.head??r.documentElement,{childList:!0}),()=>{c?.disconnect(),p(r,n)}},[r,n,o])}function k(n,{settle:o=[150,450]}={}){const[r,c]=e(0),i=n?.frame??null,u=n?.document??null,s=n?.window??null,l=o.join(",");return t(()=>{if(!i||!u||!s)return;const e=i.ownerDocument.defaultView;let t=!1,n=0;const r=()=>{if(t)return;t=!0;const o=()=>{t=!1,c(e=>e+1)};e?.requestAnimationFrame?n=e.requestAnimationFrame(o):o()},l=[],a=(e,t)=>{e.addEventListener(t,r,!0),l.push(()=>e.removeEventListener(t,r,!0))};a(u,"scroll"),a(s,"resize"),e&&(a(e,"scroll"),a(e,"resize"));const d=e?.ResizeObserver;if(d){const e=new d(r);e.observe(i),u.documentElement&&e.observe(u.documentElement),l.push(()=>e.disconnect())}const f=u.defaultView?.MutationObserver,m=u.body??u.documentElement;if(f&&m){const e=new f(r);e.observe(u===i.ownerDocument?i:m,{childList:!0,subtree:!0}),l.push(()=>e.disconnect())}const h=u.fonts;h&&a(h,"loadingdone");const w=o.map(e=>setTimeout(r,e));return r(),()=>{for(const e of l)e();for(const e of w)clearTimeout(e);n&&e?.cancelAnimationFrame&&e.cancelAnimationFrame(n)}},[i,u,s,l]),r}export{c as BLOCK_ATTRIBUTE,y as BLOCK_SELECTOR,A as CANVAS_SELECTOR,x as CANVAS_TYPING_EVENT,E as LIST_SELECTOR,d as clientPointToLayer,l as elementScale,m as fitCanvas,f as framePointToHost,s as frameRectToHost,a as frameRectToLayer,u as frameScale,L as isFrameReady,r as isTypingTarget,i as nodeIdAt,p as removeCanvasStyle,b as setCanvasNonce,v as upsertCanvasStyle,R as useCanvasEvent,S as useCanvasFrame,k as useCanvasLayout,M as useCanvasStyle,C as watchCanvasFrame};
|
package/dist/chunk-KYG35KKJ.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPick as a}from"./chunk-SOZUYCQZ.js";import{startCanvasTyping as s,textMap as l}from"./chunk-WQASXLXS.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as d,isTypingTarget as u,frameRectToHost as p,CANVAS_TYPING_EVENT as f}from"./chunk-AWJUYMX7.js";import{find as h,ROOT_ID as m,getList as g,remove as v,parseZoneKey as y,move as w,duplicate as k,replaceNode as b,createNode as S,insert as I,normalizeData as C,createResolveCache as E,resolveNodeData as x,ROOT_SLOT as D}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as O,fieldsFrom as A,defaultsFrom as M}from"./chunk-NKB3KVAB.js";import{createContext as P,useEffect as z,useContext as Z,useRef as B,useSyncExternalStore as K,useState as R,useMemo as $,useCallback as j,useLayoutEffect as N}from"react";import{jsx as L,jsxs as V}from"react/jsx-runtime";import{createPortal as F}from"react-dom";import{FloatingBar as Y,TextToolbar as H}from"efficient-shell/ui";function T(e){return!["setData","setUi","set"].includes(e.type)}var W=(e,t,n,o)=>{const r=g(e,t,y(n));return r?.[o]??null},X=(e,t,n,o,r)=>{const i=W(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function U(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function q(e,t,n){return n?"node"===n.kind?h(e,t,n.id)?n:null:n.parentId===m?g(e,t,n)?n:null:h(e,t,n.parentId)&&g(e,t,n)?n:null:null}function Q(e,t,n,r=!1){const{itemSelector:i,selectedSlot:a,...s}=n;let l=e.selection;var c;return"itemSelector"in n&&(l=o(e.data,t,i??null)),"selectedSlot"in n&&(a?l=(c=a)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===l?.kind&&(l=null)),{...e,selection:l,ui:r?s:{...e.ui,...s}}}function G(e,t,n){const o=J(e,t,n);if(o===e)return e;const r=q(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function J(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return Q(e,n,"function"==typeof t.ui?t.ui(U(e,n)):t.ui);case"set":{const r={data:o,ui:U(e,n)},i="function"==typeof t.state?t.state(r):t.state;let a=i.data?{...e,data:i.data}:e;return i.ui&&(a=Q(a,n,i.ui,!0)),a}case"insert":{const r={...y(t.destinationZone),index:t.destinationIndex},i=S(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:I(o,n,r,i)}}case"replace":{const r=X(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:b(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=X(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=k(o,n,r.props.id),a=W(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:a?{kind:"node",id:a.props.id}:e.selection}}case"reorder":return J(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=W(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...y(t.destinationZone),index:t.destinationIndex};return{...e,data:w(o,n,r.props.id,i)}}case"remove":{const r=X(o,n,t.zone,t.index,"remove");return{...e,data:v(o,n,r.props.id)}}default:return e}}var _={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},ee={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},te=0,ne=()=>`history-${te+=1}`;function oe(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let a=e.permissions??{};const s=C(e.data,t);let l={data:s,selection:null,ui:{...ee}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;l={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...ee,...i}}}let c=[{core:l,at:-1/0,sealed:!0,id:ne()}],d=0;const u=e=>{const t=c[d],n=r();!e&&d===c.length-1&&d>0&&!t.sealed&&n-t.at<i?c=[...c.slice(0,d),{...t,core:l,at:n}]:(c=[...c.slice(0,d+1),{core:l,at:n,sealed:e,id:ne()}],d=c.length-1)},p=/* @__PURE__ */new Set;let f=null,m=null,v=0,y=null,w=!1;const k=()=>{for(const e of[...p])e()},S=()=>{c=[...c.slice(0,d),{...c[d],core:l},...c.slice(d+1)]},I=(t,n)=>{v>0?w=w||n:(n?u(!1):l!==t&&S(),l.data!==t.data&&e.onChange?.(l.data),l!==t&&k())},D=e=>{const n=l;if(l=G(l,e,t),l===n)return;const o=e.recordHistory??T(e);I(n,o&&l.data!==n.data)},O=t=>{0===v&&(y=l,w=!1),v+=1;try{t()}catch(e){throw v-=1,0===v&&y&&(l=y,y=null),e}if(v-=1,v>0||!y)return;const n=y;y=null,w&&l.data!==n.data?u(!0):l!==n&&S(),l.data!==n.data&&e.onChange?.(l.data),l!==n&&k()},A=e=>{const n=l,o=q(l.data,t,e);var r,i;(r=o,i=l.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(l={...l,selection:o},I(n,!1))},M=t=>{const n=l;d=t,l=c[d].core,l.data!==n.data&&e.onChange?.(l.data),l!==n&&k()},P=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{..._,...a,...n}};let z=P();const Z=E(),B={resolveCache:Z,async resolveAll({trigger:e="load",metadata:n}={}){const o=l.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[a,...s]=await Promise.all([x(r,t,{cache:Z,trigger:e,metadata:n}),...i.map(o=>x(o,t,{cache:Z,trigger:e,metadata:n}))]);O(()=>{const e=l;let n=l.data;s.forEach((e,r)=>{if(!e.didChange)return;const a=i[r].props.id,s=h(n,t,a)?.node;s&&s===h(o,t,a)?.node&&(n=b(n,t,a,e.node))}),a.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:a.node.props,readOnly:a.node.readOnly??n.root.readOnly}}),n!==l.data&&(l={...l,data:n,selection:q(n,t,l.selection)},I(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=h(l.data,t,e)?.node;if(!r)return!1;const i=await x(r,t,{cache:Z,trigger:n,metadata:o});if(!i.didChange)return!1;let a=!1;return O(()=>{const n=l;if(h(l.data,t,e)?.node!==r)return;const o=b(l.data,t,e,i.node);o!==l.data&&(l={...l,data:o,selection:q(o,t,l.selection)},I(n,!1),a=!0)}),a},get config(){return t},getState(){if(f&&m===l)return f;const e=l,o={data:e.data,ui:U(e,t)},r="node"===e.selection?.kind?h(e.data,t,e.selection.id)?.node??null:null;return f={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:D,history:{back:()=>B.undo(),forward:()=>B.redo(),hasPast:d>0,hasFuture:d<c.length-1,histories:c.map(e=>({id:e.id,state:{data:e.core.data,ui:U(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<c.length&&e!==d&&M(e)}},getPermissions:z,getItemById:n=>h(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return g(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},m=e,f},subscribe:e=>(p.add(e),()=>{p.delete(e)}),dispatch:D,batch:O,group:()=>{const e=d,t=c[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,c[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(c=[...c.slice(0,d),{...c[d],sealed:!0},...c.slice(d+1)]));const o=c[d];c=[...c.slice(0,e+1),{...o,sealed:!0},...c.slice(d+1)],d=e+1}}},select:e=>A(e?{kind:"node",id:e}:null),selectSlot:e=>A(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){O(()=>{const n=l,o=void 0===e.select?l.selection:e.select;l={...l,data:e.data,selection:q(e.data,t,o)},I(n,e.data!==n.data)})},load(e,n={}){const o=l,r=C(e,t);l={...l,data:r,selection:q(r,t,n.selection??l.selection)},n.keepHistory||(c=[{core:l,at:-1/0,sealed:!0,id:ne()}],d=0),l!==o&&k()},undo(){d>0&&M(d-1)},redo(){d<c.length-1&&M(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,a)||(a=e,z=P(),f=null,k())},setConfig(e){e!==t&&(t=e,z=P(),f=null,k())}};return B}function re(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&u(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var ie=P(null),ae=P(!0);function se({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return z(()=>{n&&e.resolveAll()},[e,n]),z(()=>{if(t&&"undefined"!=typeof document)return re(document,e)},[e,t]),/* @__PURE__ */L(ie.Provider,{value:e,children:/* @__PURE__ */L(ae.Provider,{value:t,children:o})})}function le(){const e=Z(ie);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function ce(e){const t=le(),n=B({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return K(t.subscribe,o,o)}function de(){return function(e){return ce(e)}}var ue="data-puck-component",pe="data-puck-dropzone",fe={},he="data-es-mirror",me="undefined"==typeof window?z:N;function ge(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${he}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(he,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function ve({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:a=!0,onDocument:s,height:l="auto",nonce:u}){const p=c("canvas",e),f=B(null),[h,m]=R(null);return me(()=>{const e=f.current,t=h?.ownerDocument.defaultView;if("auto"!==l||!e||!h||!t)return;const n=()=>{e.style.height=`${Math.ceil(h.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(h),()=>r?.disconnect()},[h,l]),me(()=>{let e=f.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=f.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===l&&t.classList.add("es-frame-fill"),e.body.appendChild(t),d(e,u),m(t),s?.(e);let n=null;const o=f.current?.ownerDocument;if(a&&o){ge(o,e,u);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>ge(o,e,u)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),m(null),s?.(null)}},[]),/* @__PURE__ */L("iframe",{ref:f,id:n,title:o??p.frame,className:["es-canvas-frame","fill"===l?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:h?F(t,h):null})}var ye=P(null),we=P(fe),ke=[];function be({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const a=le(),s=ce(n=>g(n.appState.data,a.config,{parentId:e,slot:t})??ke),l=ce(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==m),c=ce(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=Z(ye),u=["es-zone"];return s.length&&u.push("has-children"),e===m&&u.push("is-root"),(l||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==m&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */L("div",{className:u.join(" "),[pe]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */L(Ce,{node:e},e.props.id))})}function Se(e,t){return $(()=>{const n={};for(const o of O(A(e)))n[o]=function(e={}){/* @__PURE__ */
|
|
2
|
-
return L(be,{parentId:t,slot:o,...e})};return n},[e,t])}function Ie(e){return $(()=>function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
-
return L(be,{parentId:e,slot:t,...n})},[e])}function Ce({node:e}){const t=le().config.components[e.type],n=e.props.id,o=function(e){const t=B(null);return $(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(ue),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(ue,e),n.setAttribute("data-puck-dnd",e),n.style.position="relative")},[e])}(n),r=Z(we),i=Se(t,n),a=Ie(n);if(!t?.render)return null;const s=t.render,l={...M(t),...e.props,...i},c={renderDropZone:a,isEditing:!0,dragRef:t.inline?o:null,metadata:{...r,...t.metadata}};return t.inline?/* @__PURE__ */L(s,{...l,puck:c,editMode:!0}):/* @__PURE__ */L("div",{[ue]:n,"data-puck-dnd":n,style:{position:"relative"},children:/* @__PURE__ */L(s,{...l,puck:c,editMode:!0})})}function Ee({metadata:e}){const t=ce(e=>e.config),n=ce(e=>e.appState.data.root).props??{},o=t.root?.render,r=Se(t.root,m),i=Ie(m),a=/* @__PURE__ */L(be,{parentId:m,slot:D}),s=o?/* @__PURE__ */L(o,{id:"puck-root",...n,...r,puck:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:a}):a;/* @__PURE__ */
|
|
4
|
-
return L(we.Provider,{value:e??fe,children:s})}function xe(e,t,n){const[o,r]=R(null),i=B(t);return i.current=t,me(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(null);let o=0;const a=()=>{o=0;const n=function(e,t){if(!e||!t)return null;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(i.current?i.current(t):null,e.current?.parentElement??null);r(e=>{return(t=e)===(o=n)||t&&o&&t.top===o.top&&t.left===o.left&&t.width===o.width&&t.height===o.height?e:n;var t,o})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(a))};a();const l="MutationObserver"in n?new n.MutationObserver(s):null;l?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),()=>{l?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function De({id:e,kind:t,overlay:n}){const o=B(null),r=xe(o,e?t=>t.querySelector(`[${ue}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),i=/* @__PURE__ */L("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}`,style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height}:{display:"none"}});return n&&e?/* @__PURE__ */L(n,{componentId:e,kind:t,children:i}):i}function Oe(e,t,n){const o=l(e,n),r=o.text.length,i=e.ownerDocument;if(!t)return[r,r];let a=null;const s=i.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))a=o.at(s.offsetNode,s.offset);else{const n=i.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(a=o.at(n.startContainer,n.startOffset))}if(null===a)return[r,r];const c=o.text;let d=a,u=a;for(;d>0&&!/\s/.test(c[d-1]);)d-=1;for(;u<c.length&&!/\s/.test(c[u]);)u+=1;return[d,u]}function Ae({s:e,element:t,toolbar:n,label:o}){const r=e.pressed(),i=new Set(n.offered.filter(e=>"link"!==e));/* @__PURE__ */
|
|
5
|
-
return L(Y,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?p(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */L("div",{style:{width:"18rem"},children:/* @__PURE__ */L(H,{offered:i,pressed:r.marks,onMark:t=>{"link"!==t&&e.press(t)},list:{pressed:r.list,onList:t=>e.list(t)},alignment:n.alignment,letterCase:n.letterCase})})})}function Me({element:e}){const t=B(null),n=xe(t,()=>e(),e);/* @__PURE__ */
|
|
6
|
-
return L("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function Pe({frame:t=!0,className:n,style:o,metadata:r,mirrorStyles:l,onDocument:d,height:u,title:p,nonce:h,hotkeys:m,frameWrapper:g,overlay:v,children:y,typing:w}){const k=le(),b=Z(ae),S=c("canvas",e),I=m??b,[C,E]=R(void 0),x=ce(e=>"node"===e.selection?.kind?e.selection.id:null),[D,O]=R(null),[A,M]=R(null),P=B(null),[,K]=R(0),$=B(w);$.current=w;const j=B(null),N=e=>{const t=j.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(f,{detail:{typing:e}}))},F=(e,t)=>{P.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=k.group(),r=e.element,i=s({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:Oe(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>K(e=>e+1),end:e=>{o.close(),P.current?.element===r&&(P.current=null),M(null),N(!1),$.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const a=n.closest?.(`[${ue}]`)?.getAttribute(ue);return a&&k.select(a),P.current={s:i,element:r,target:e},M(()=>r),O(null),N(!0),$.current?.onChange?.({typing:!0,element:n}),!0};z(()=>()=>P.current?.s.stop("stop"),[]);const Y=e=>{const t=P.current?.element();return Boolean(t&&t.contains(e))},H=e=>{const t=e.closest?.(`[${ue}]`)?.getAttribute(ue);if(!t)return;const n=k.getState(),o="node"===n.selection?.kind?n.selection.id:null;return a(n.appState.data,k.config,t,o)??t},T=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(P.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=$.current?.atSelection?.();n&&F(n,null)&&e.preventDefault()},W=/* @__PURE__ */V("div",{ref:j,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),P.current){if(Y(t))return;P.current.s.stop("outside")}const n=H(t);void 0===n?t.hasAttribute?.(pe)||k.select(null):k.select(n)},onDoubleClick:e=>{const t=$.current;if(!t||Y(e.target))return;const n=t.at(e.target);n&&F(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>T(e),onMouseOver:e=>{if(P.current)return;const t=H(e.target)??null;t!==D&&O(t)},onMouseLeave:()=>O(null),children:[
|
|
7
|
-
/* @__PURE__ */L(ye.Provider,{value:D,children:/* @__PURE__ */L(Ee,{metadata:r})}),
|
|
8
|
-
/* @__PURE__ */V("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
9
|
-
/* @__PURE__ */L(De,{id:!A&&D&&D!==x?D:null,kind:"hover",overlay:v}),
|
|
10
|
-
/* @__PURE__ */L(De,{id:A?null:x,kind:"selected",overlay:v}),A?/* @__PURE__ */L(Me,{element:A}):null]}),y]}),X=g?/* @__PURE__ */L(g,{document:C,children:W}):W;z(()=>{if(C&&I)return re(C,k)},[C,I,k]),z(()=>{if(!C)return;const e=e=>{if("Enter"===e.key)return void T(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=k.getState();if("node"!==n.selection?.kind)return;const o=i(n.appState.data,k.config,n.selection);"node"===o?.kind&&k.select(o.id)};return C.addEventListener("keydown",e),()=>C.removeEventListener("keydown",e)},[C,k]);/* @__PURE__ */
|
|
11
|
-
return V("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":A?"":void 0,children:[A&&P.current?.target.toolbar?/* @__PURE__ */L(Ae,{s:P.current.s,element:P.current.element,toolbar:P.current.target.toolbar,label:S.textTools}):null,t?/* @__PURE__ */L(ve,{mirrorStyles:l,onDocument:e=>{E(e??void 0),d?.(e)},height:u,title:p,nonce:h,children:X}):/* @__PURE__ */L("div",{id:"preview-frame","data-puck-entry":"",children:X})]})}function ze(e={}){const t=le(),n=ce(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Ze(){const e=le(),n=ce(e=>e.config),o=e.resolveCache,r=ce(e=>e.selectedItem),i=ce(e=>e.appState.data.root),a=r?r.props.id:"root",s=i.props??{},l=$(()=>r||{type:"root",props:s},[r,s]),c=r?n.components[r.type]:n.root,d=e.getState(),u=r?h(d.appState.data,n,a):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,f=p?d.getItemById(p)??null:null,{fields:m}=t({id:a,node:l,block:c,parent:f,appState:d.appState}),g=ce(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),v=j((t,r)=>{(async()=>{const i=e.getState();if("root"!==a){const s=i.getItemById(a),l=i.getSelectorForId(a);if(!s||!l)return;const c={...s,props:{...s.props,[t]:r}},{node:d}=await x(c,n,{cache:o,trigger:"replace"}),u=e.getState().getSelectorForId(a);if(!u)return;return void e.dispatch({type:"replace",destinationZone:u.zone??"root:default-zone",destinationIndex:u.index,data:d})}const s=i.appState.data.root.props??{},{node:l}=await x({type:"root",props:{...s,[t]:r}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:l.props,readOnly:l.readOnly},recordHistory:!0})})()},[e,n,o,a]);return{id:a,node:l,fields:m,values:l.props,readOnly:g,onChange:v}}export{ve as CanvasFrame,ee as DEFAULT_UI,Pe as EaselCanvas,se as EaselProvider,Ee as EditDocument,re as bindUndoKeys,oe as createEasel,de as createUseEasel,T as recordsByDefault,G as reduce,U as uiView,ce as useEasel,le as useEaselApi,ze as useEaselNodeOps,Ze as useSelectedFields,q as validSelection};
|
package/dist/chunk-SOZUYCQZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{find as t,remove as n,getList as e,newId as r,duplicate as o,move as a,copyNode as l,insert as c,setProps as i,slotsOf as d}from"./chunk-KRXQM65X.js";import{useRef as s,useSyncExternalStore as p,useCallback as u,useMemo as f}from"react";var m=t=>({kind:"node",id:t});function x(r,o,a,l="none"){const c=t(r,o,a),i=n(r,o,a);if("none"===l||!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 I(n,e,a,l={}){const c=t(n,e,a)?.node,i=l.id??r(c?.type??"Node");return{data:o(n,e,a,{strip:l.strip,id:i}),select:m(i)}}function g(t,n,e,r){return{data:a(t,n,e,r),select:m(e)}}var h=(t,n)=>({min:0,max:n-1});function v(n,r,o,a,l=h){const c=t(n,r,o);if(!c)return!1;const i=e(n,r,c.place)?.length??0,{min:d,max:s}=l(c.place,i),p=c.place.index+a;return c.place.index>=d&&c.place.index<=s&&p>=d&&p<=s}function b(n,e,r,o,a=h){if(!v(n,e,r,o,a))return null;const l=t(n,e,r);return g(n,e,r,{...l.place,index:l.place.index+o})}function k(t,n,e,r,o={}){const a=l(e,n,{strip:o.strip});return{data:c(t,n,r,a),select:m(a.props.id)}}function y(n,r,o,a){if(t(n,r,o.props.id))return null;const l=e(n,r,a)??[],i={...a,index:Math.max(0,Math.min(a.index,l.length))};return{data:c(n,r,i,o),select:m(o.props.id)}}function M(t,n,e,r){return{data:i(t,n,e,r),select:void 0}}function O(n,e,r,o=()=>!1){if(!r)return null;if("slot"===r.kind)return t(n,e,r.parentId)?m(r.parentId):null;const a=t(n,e,r.id);if(!a||"root"===a.place.parentId)return null;const l=t(n,e,a.place.parentId);return l?o(l.node,a.place.slot)?{kind:"slot",parentId:l.node.props.id,slot:a.place.slot}:m(l.node.props.id):null}function z(n,e,r){const o=t(n,e,r);return o?[...o.path.filter(t=>"root"!==t.parentId).map(t=>t.parentId),r]:[]}function R(t,n){if(0===t.length)return null;const e=null===n?-1:t.indexOf(n);return-1===e?t[0]:t[Math.min(e+1,t.length-1)]}function B(n,e,r,o){const a=t(n,e,r);return a?0===d(a.node,e).length?r:R(z(n,e,r),o):null}function X(n,e,r){if(!r||"node"!==r.kind)return null;const o=t(n,e,r.id);return o?{zone:`${o.place.parentId}:${o.place.slot}`,index:o.place.index}:null}function $(t,n,r){if(!r)return null;const[o,a]=(r.zone??"root:default-zone").split(/:(.*)/s),l={parentId:o,slot:a},c=e(t,n,l)?.[r.index];return c?.props?.id?m(c.props.id):null}var j={get:()=>null,set:()=>{},subscribe:()=>()=>{}};function K(n){const e=s(n);e.current=n;const r=n.clipboard??j,o=p(r.subscribe,r.get,r.get),a=u(t=>{const n=e.current;if(n.readOnly)return!1;const r=t(n.data,n.config);return!!r&&((r.data!==n.data||void 0!==r.select)&&(n.commit(r.data,{select:r.select}),e.current={...n,data:r.data},!0))},[]);return f(()=>{const n=()=>e.current,r=(e,r)=>{const o=t(n().data,n().config,e);return o?{node:o.node,label:r,from:{parentId:o.place.parentId,slot:o.place.slot}}:null};return{held:o,remove:t=>a((e,r)=>x(e,r,t,n().afterRemove)),duplicate:t=>a((e,r)=>I(e,r,t,{strip:n().strip})),move:(t,n)=>a((e,r)=>g(e,r,t,n)),step:(t,e)=>a((r,o)=>b(r,o,t,e,n().stepBounds)),canStep:(t,e)=>v(n().data,n().config,t,e,n().stepBounds),setProps:(t,n)=>a((e,r)=>M(e,r,t,n)),copy:(t,e)=>{const o=r(t,e);return o&&(n().clipboard??j).set(o),!!o},cut:(t,e)=>{if(n().readOnly)return!1;const o=r(t,e);return!!o&&((n().clipboard??j).set(o),a((e,r)=>x(e,r,t,n().afterRemove)))},paste:t=>{const e=(n().clipboard??j).get();return!!e&&a((r,o)=>k(r,o,e.node,t,{strip:n().strip}))},restore:(t,n)=>a((e,r)=>y(e,r,t,n)),parentOf:t=>O(n().data,n().config,t,n().slotIsLevel)}},[o,a])}export{v as canStep,B as clickPick,$ as fromItemSelector,R as nextInChain,z as nodeChain,O as parentStep,I as planDuplicate,g as planMove,k as planPaste,x as planRemove,y as planRestore,M as planSetProps,b as planStep,X as toItemSelector,K as useNodeOps};
|
package/dist/chunk-ZPXKNO5L.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{buildPaletteSections as e,pinnedSection as t,paletteWithoutPinned as o,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as i}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-XTJCKV6Z.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-E3PD66A3.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-JTUUIVBZ.js";import{useEasel as f}from"./chunk-KYG35KKJ.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-SSORUDHE.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-O2NLQBFX.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as $,jsxs as B,Fragment as O}from"react/jsx-runtime";var v=e=>`section:${e}`,V=e=>`block:${e}`,x=e=>`template:${e}`;function I({blocks:I,blocksOnly:A,at:D,onAdd:H,itemFor:K,session:L,siteWide:N,onClose:T,onHide:C,readOnly:F}){const J=f(e=>e.config),R=p(),{labelAtLevel:S,categoryLabel:w,firstSection:E,Icon:P,Thumbnail:Q}=R,{blockIsOffered:U}=m(),Y=u("screen",d).add,Z=u("drag",h).add,z=l(),[G,W]=y([]);b(()=>{let e=!1;const t=e=>U(e,z);return s(z).list().then(o=>{if(e)return;const n=J.components;W(o.filter(e=>e.node?.type&&n[e.node.type]&&i(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[J,z]);const X=j(()=>e(J,R),[J]),M=e=>({type:v(e.type),label:e.name,cover:/* @__PURE__ */$(Q,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:Y.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=j(()=>{const e=[];if(I&&I.choices.length>0&&a(I.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${Y.inside({name:I.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:V(e.type),label:e.label,icon:/* @__PURE__ */$(P,{type:e.type,size:18}),title:Y.tile({name:e.label})}))})}),A)return e;const i=t(X,E);i&&e.push({key:"start",title:Y.startBlank,tiles:[M(i)]}),G.length>0&&e.push({key:"templates",title:Y.templates,tiles:G.map(e=>{return{type:x(e.id),label:e.name,cover:/* @__PURE__ */$(Q,{type:e.node.type}),keywords:[(t=e.node.type,S(t,"section",J.components[t]?.label??t)),e.node.type]};var t})});const s=o(X,E);for(const t of Object.keys(J.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:n(J,t,w),tiles:o.map(M)})}return e},[I,A,G,X,J,Y]),_=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=G.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
-
return B(O,{children:[
|
|
3
|
-
/* @__PURE__ */$(r,{icon:/* @__PURE__ */$(g,{size:15}),title:Y.title,context:A?Y.contextBlocks:Y.contextAll,actions:/* @__PURE__ */$(c,{label:Y.done,description:Y.doneDescription,onClick:T}),onHide:C}),
|
|
4
|
-
/* @__PURE__ */B("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */$(k,{groups:q,session:L,itemFor:e=>K(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&H(t)},at:D,hint:A?Y.hintBlocks:Y.hint,searchLabel:A?Y.searchBlocks:Y.searchSections,readOnly:F,words:Z}),N&&!A?N:null]})]})}export{I as AddSidePanel,V as blockKey,v as sectionKey,x as templateKey};
|