efficient-easel 0.106.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -29
- package/dist/{LinkPicker-W2Rtxetz.d.ts → LinkPicker-hPEr1MJx.d.ts} +6 -4
- package/dist/autosave/index.d.ts +5 -5
- package/dist/chrome/chrome.css +50 -273
- package/dist/chrome/index.d.ts +61 -56
- package/dist/chrome/index.js +1 -1
- package/dist/chunk-4SWZAYKI.js +5 -0
- package/dist/chunk-5545A3PC.js +4 -0
- package/dist/chunk-7SQF6LZL.js +1 -0
- package/dist/chunk-BXMXTO36.js +1 -0
- package/dist/chunk-EA2HTX37.js +5 -0
- package/dist/{chunk-VINYARYJ.js → chunk-FER7FCAG.js} +1 -1
- package/dist/chunk-FPAVNX3Y.js +6 -0
- package/dist/{chunk-LY4K2ECT.js → chunk-GXFAQ7JN.js} +1 -1
- package/dist/chunk-HMJS344F.js +1 -0
- package/dist/{chunk-JWMNPRTT.js → chunk-I64QM6DU.js} +1 -1
- package/dist/chunk-JLTZQ4US.js +1 -0
- package/dist/chunk-K56YDHYQ.js +1 -0
- package/dist/chunk-LOMEH6DG.js +1 -0
- package/dist/{chunk-FS5BLARH.js → chunk-MAEXP3KE.js} +1 -1
- package/dist/chunk-MJM6SFD3.js +3 -0
- package/dist/chunk-NLRW4BGG.js +8 -0
- package/dist/chunk-O5F46JWM.js +64 -0
- package/dist/chunk-ONRYLR2D.js +2 -0
- package/dist/{chunk-WTMHT7BI.js → chunk-ORR3Q4WV.js} +1 -1
- package/dist/chunk-P2VEMZH5.js +1 -0
- package/dist/{chunk-MHKBLPQ2.js → chunk-PT6V53OO.js} +1 -1
- package/dist/{chunk-6WH7FA2M.js → chunk-PYCLHOSA.js} +2 -2
- package/dist/chunk-Q27BB5ZC.js +14 -0
- package/dist/chunk-QFMJBBKM.js +5 -0
- package/dist/chunk-QLD57GBB.js +6 -0
- package/dist/chunk-QR4DLZ3P.js +5 -0
- package/dist/chunk-QRKKQGUO.js +4 -0
- package/dist/chunk-QTPJMJOJ.js +1 -0
- package/dist/chunk-RG7PFKCA.js +7 -0
- package/dist/chunk-TJ7YIRWQ.js +21 -0
- package/dist/{chunk-3P6AMTOS.js → chunk-VPFNZ7TB.js} +1 -1
- package/dist/chunk-W3XX2CNW.js +16 -0
- package/dist/chunk-WDXPWSP7.js +24 -0
- package/dist/chunk-X6DQWK2C.js +1 -0
- package/dist/chunk-XWR5YVA7.js +9 -0
- package/dist/chunk-ZNNATBDC.js +1 -0
- package/dist/copy/copy.css +66 -177
- package/dist/copy/index.d.ts +0 -2
- package/dist/copy/index.js +31 -32
- package/dist/drag/drag.css +31 -11
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.js +1 -1
- package/dist/fields/fields.css +35 -304
- package/dist/fields/index.d.ts +87 -95
- package/dist/fields/index.js +1 -1
- package/dist/gold/gold.css +3 -3
- package/dist/gold/index.d.ts +6 -5
- package/dist/gold/index.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/menu/index.d.ts +49 -93
- package/dist/menu/index.js +1 -1
- package/dist/menu/menu.css +37 -246
- package/dist/node-ops/index.d.ts +1 -1
- package/dist/panel/index.d.ts +46 -72
- package/dist/panel/index.js +17 -18
- package/dist/panel/panel.css +143 -372
- package/dist/pick/index.d.ts +52 -33
- package/dist/pick/index.js +7 -7
- package/dist/pick/pick.css +19 -150
- package/dist/rail/index.d.ts +48 -90
- package/dist/rail/index.js +1 -1
- package/dist/rail/rail.css +21 -108
- package/dist/screen/components/AddBlockRow.d.ts +8 -2
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddChildRow.d.ts +4 -3
- package/dist/screen/components/AddChildRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.d.ts +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +12 -8
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +7 -7
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +7 -7
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/SidePanelHead.d.ts +4 -2
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/UiIcon.d.ts +10 -26
- package/dist/screen/components/UiIcon.js +2 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +7 -7
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +7 -7
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +1 -1
- package/dist/screen/lib/admin-bridge.js +1 -1
- package/dist/screen/lib/chrome-theme.d.ts +20 -12
- package/dist/screen/lib/chrome-theme.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +1 -1
- package/dist/screen/lib/host-chrome.d.ts +1 -1
- package/dist/screen/lib/host.d.ts +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/links/link-filters.d.ts +1 -1
- package/dist/screen/lib/media-panel.d.ts +1 -1
- package/dist/screen/lib/media-picker.d.ts +1 -1
- package/dist/screen/lib/page-lock.d.ts +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +7 -7
- package/dist/screen/lib/puck/use-section-ops.d.ts +16 -0
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +14 -8
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-templates.d.ts +1 -1
- package/dist/screen/lib/session-context.d.ts +1 -1
- package/dist/screen/lib/session.d.ts +1 -1
- package/dist/screen/screen.css +33 -206
- package/dist/shell/index.d.ts +134 -118
- package/dist/shell/index.js +1 -1
- package/dist/shell/shell.css +130 -88
- package/dist/strings/catalogue.d.ts +5 -5
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +5 -5
- package/dist/strings/index.js +1 -1
- package/dist/style-clipboard/index.d.ts +1 -1
- package/dist/text-styles/index.d.ts +12 -3
- package/dist/text-styles/index.js +33 -38
- package/dist/text-styles/text-styles.css +39 -71
- package/dist/tree/index.d.ts +49 -44
- package/dist/tree/index.js +1 -1
- package/dist/tree/tree.css +31 -653
- package/dist/{types-DJDBtdB2.d.ts → types-BqGnUVX5.d.ts} +32 -32
- package/dist/types-BsyPh6EW.d.ts +99 -0
- package/dist/{types-DWS-s9z-.d.ts → types-CsgMwHHa.d.ts} +14 -11
- package/dist/{types-CqY85foL.d.ts → types-Dt1CFR1S.d.ts} +4 -2
- package/dist/{wordFit-D4S36PvB.d.ts → wordFit-7XpmhcaW.d.ts} +3 -5
- package/dist/words-Cl9xMUYY.d.ts +41 -0
- package/dist/{words-D_Lnw1Gr.d.ts → words-CvFnwGSr.d.ts} +1 -1
- package/package.json +5 -1
- package/dist/chunk-2UX75JDP.js +0 -1
- package/dist/chunk-37OCQYNX.js +0 -65
- package/dist/chunk-3EDSDPIP.js +0 -1
- package/dist/chunk-3QVB4AG2.js +0 -3
- package/dist/chunk-3WSPDAK2.js +0 -1
- package/dist/chunk-5MZ3RNQQ.js +0 -13
- package/dist/chunk-5ZBBXZPV.js +0 -6
- package/dist/chunk-BZ5ASXOL.js +0 -1
- package/dist/chunk-C6BJB5AC.js +0 -2
- package/dist/chunk-DX4XELD6.js +0 -18
- package/dist/chunk-EOJNJCMJ.js +0 -16
- package/dist/chunk-EWVJSRRY.js +0 -6
- package/dist/chunk-H24N5TMZ.js +0 -11
- package/dist/chunk-I6T4TZ5Q.js +0 -8
- package/dist/chunk-KTVH2ZRL.js +0 -15
- package/dist/chunk-M7N2V4TG.js +0 -2
- package/dist/chunk-MS4QRBJ6.js +0 -5
- package/dist/chunk-ND55LTCA.js +0 -5
- package/dist/chunk-OWBO4WKA.js +0 -0
- package/dist/chunk-P6O363EE.js +0 -6
- package/dist/chunk-PBSEUZD6.js +0 -1
- package/dist/chunk-RW4XBUUW.js +0 -1
- package/dist/chunk-UEVTQBM7.js +0 -10
- package/dist/chunk-VCQVNPTG.js +0 -22
- package/dist/chunk-WZ7TGAAT.js +0 -3
- package/dist/chunk-YC4TB3CJ.js +0 -25
- package/dist/chunk-Z6SOLDWV.js +0 -1
- package/dist/chunk-ZFDCDJNZ.js +0 -16
- package/dist/chunk-ZNS7727Y.js +0 -12
- package/dist/types-Djdq6Xkd.d.ts +0 -138
- package/dist/words-DgHcY5qB.d.ts +0 -33
package/dist/chrome/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { T as TopBarProps, a as TopBarClusterProps, b as TopBarRailProps, E as EaselIconButtonProps, c as DeviceSwitchProps, d as SaveStateProps, e as SaveStateToggleProps, P as PanelResizeHandleProps, I as InspectorHeadProps, f as InspectorIconButtonProps, g as InspectorUpLevelProps, M as MediaPanelHeadProps, h as MediaPickKind, i as EditNoticeProps } from '../types-
|
|
3
|
-
export { D as DeviceOption, R as RailWordsShown, S as SaveTone } from '../types-
|
|
2
|
+
import { T as TopBarProps, a as TopBarClusterProps, b as TopBarRailProps, E as EaselIconButtonProps, c as DeviceSwitchProps, d as SaveStateProps, e as SaveStateToggleProps, P as PanelResizeHandleProps, I as InspectorHeadProps, f as InspectorIconButtonProps, g as InspectorUpLevelProps, M as MediaPanelHeadProps, h as MediaPickKind, i as EditNoticeProps } from '../types-Dt1CFR1S.js';
|
|
3
|
+
export { D as DeviceOption, R as RailWordsShown, S as SaveTone } from '../types-Dt1CFR1S.js';
|
|
4
4
|
import { LockWords, EditAccess, SaveConflict } from '../edit-lock/index.js';
|
|
5
5
|
import { N as NoticeWords } from '../words-AHHfiaRY.js';
|
|
6
6
|
export { C as ChromeWords } from '../words-AHHfiaRY.js';
|
|
7
7
|
export { D as DEFAULT_PANEL_W, M as MAX_PANEL_W, a as MIN_PANEL_W, P as PanelSide, b as PanelWidths, c as clampPanelWidth, p as panelWidthVars, s as setPanelWidthVars } from '../panelWidths-D9hTLR25.js';
|
|
8
|
-
import '../types-
|
|
9
|
-
import '../wordFit-
|
|
8
|
+
import '../types-CsgMwHHa.js';
|
|
9
|
+
import '../wordFit-7XpmhcaW.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* The editor's top bar — 52px, white, a soft shadow, three clusters.
|
|
@@ -41,52 +41,46 @@ declare function TopBarDivider(): react.JSX.Element;
|
|
|
41
41
|
* chosen word otherwise the glyphs plus the open panel's word;
|
|
42
42
|
* glyphs only when even that does not fit.
|
|
43
43
|
*
|
|
44
|
-
* THE
|
|
45
|
-
* (
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
44
|
+
* THE SHELL'S, SINCE efficient-shell 4.165.0. The rail is the shell's worded
|
|
45
|
+
* `IconRail` (`labels="beside"`, `labelsFit`), which measures its buttons
|
|
46
|
+
* against this column — the rail's parent — and keeps the words that fit, as
|
|
47
|
+
* the column is dragged, as the labels change and once the web fonts load. This
|
|
48
|
+
* component used to measure the words on a canvas and hand a stylesheet rule
|
|
49
|
+
* their widths; none of that is left here. On a server, and before the first
|
|
50
|
+
* measurement, the rail is icon-only, which always fits.
|
|
50
51
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* measurement and the rail is icon-only, which always fits.
|
|
56
|
-
*
|
|
57
|
-
* AND A HOST MAY ASK WHICH STATE IT IS IN (`onWords`; second host, 2026-10-07).
|
|
58
|
-
* A longer language drops its words sooner — German "Zurück" and "Ebenen"
|
|
59
|
-
* where English has "Back" and "Layers" — and because the choosing is CSS's, a
|
|
60
|
-
* host had no way to see that it had happened. The answer is READ BACK from
|
|
61
|
-
* what the stylesheet drew (a clipped word is 0 wide), never worked out a
|
|
62
|
-
* second time here, so there is still one rule. Only a host that asks pays for
|
|
63
|
-
* it: one ResizeObserver on the column.
|
|
52
|
+
* A HOST MAY ASK WHICH STATE IT IS IN (`onWords`; second host, 2026-10-07): a
|
|
53
|
+
* longer language drops its words sooner — German "Zurück" and "Ebenen" where
|
|
54
|
+
* English has "Back" and "Layers". The answer is the shell's own
|
|
55
|
+
* (`onLabelsShown`), told once measured and again when it changes.
|
|
64
56
|
*/
|
|
65
57
|
declare function TopBarRail({ items, ariaLabel, onWords }: TopBarRailProps): react.JSX.Element;
|
|
66
58
|
|
|
67
59
|
/**
|
|
68
|
-
* A
|
|
60
|
+
* A glyph button in the top bar — undo, redo, the panel toggles.
|
|
69
61
|
*
|
|
70
|
-
* The
|
|
71
|
-
*
|
|
72
|
-
*
|
|
62
|
+
* The shell's `IconButton` in the shell's `Tooltip` (harness UI-24, UI-17;
|
|
63
|
+
* efficient-easel#199 step 4): this name stays because both editors' hosts
|
|
64
|
+
* import it, but nothing here draws a button any more. The label is the
|
|
65
|
+
* tooltip AND the accessible name, and it is required: an icon-only button has
|
|
66
|
+
* no other name. `state` is for a toggle: it is `aria-pressed`, which the
|
|
67
|
+
* chrome's sheet reads for the glyph's ink (the shell's IconButton has no
|
|
68
|
+
* pressed look yet — a gap named for the shell); a plain action leaves it off.
|
|
73
69
|
*/
|
|
74
70
|
declare function EaselIconButton({ label, onClick, disabled, state, buttonRef, children }: EaselIconButtonProps): react.JSX.Element;
|
|
75
71
|
|
|
76
72
|
/**
|
|
77
|
-
* Which device the canvas previews — icon-only, one
|
|
78
|
-
*
|
|
79
|
-
* Lifted from `efficient-storefront/components/DeviceSwitch.tsx`. It takes its devices
|
|
80
|
-
* as a list because the two editors do not preview the same set: the website
|
|
81
|
-
* has Desktop / Tablet / Mobile, an email has Desktop / Phone. The drawing, the
|
|
82
|
-
* size and the pressed state are what must match, and those live here.
|
|
73
|
+
* Which device the canvas previews — icon-only, one held down.
|
|
83
74
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* the
|
|
75
|
+
* The shell's `Segmented` (a button group: no `name`, so nothing submits it),
|
|
76
|
+
* harness UI-24 / efficient-easel#199 step 4. It takes its devices as a list
|
|
77
|
+
* because the two editors do not preview the same set: the website has
|
|
78
|
+
* Desktop / Tablet / Mobile, an email has Desktop / Phone.
|
|
87
79
|
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
80
|
+
* Each option is its glyph with its name beside it, visually hidden
|
|
81
|
+
* (`.es-vh`), so the button is named by words and the strip draws only the
|
|
82
|
+
* glyph; the name is also the glyph's `Tooltip` (UI-17 — never a `title`).
|
|
83
|
+
* `aria-pressed` carries the current device (the shell's button group).
|
|
90
84
|
*/
|
|
91
85
|
declare function DeviceSwitch<Id extends string>({ devices, value, onChange, ariaLabel, }: DeviceSwitchProps<Id>): react.JSX.Element;
|
|
92
86
|
|
|
@@ -105,27 +99,28 @@ declare function DeviceSwitch<Id extends string>({ devices, value, onChange, ari
|
|
|
105
99
|
*/
|
|
106
100
|
declare function SaveState({ tone, label, counting, waitMs, ringRef, role }: SaveStateProps): react.JSX.Element;
|
|
107
101
|
/**
|
|
108
|
-
* The
|
|
109
|
-
*
|
|
110
|
-
* `
|
|
102
|
+
* The autosave on / off switch, with the pill beside it.
|
|
103
|
+
*
|
|
104
|
+
* The shell's `Switch` (UI-24, efficient-easel#199 step 4): ON while autosave
|
|
105
|
+
* is on, so `pressed` (autosave paused) is its `checked` turned over. The
|
|
106
|
+
* pill (`children`, a `SaveState`) is the switch's label, so a click on it
|
|
107
|
+
* still flips autosave; `title` — what a flip will do — is the switch's
|
|
108
|
+
* accessible name and its `Tooltip` (UI-17, never a `title` attribute).
|
|
111
109
|
*/
|
|
112
110
|
declare function SaveStateToggle({ pressed, title, onToggle, children }: SaveStateToggleProps): react.JSX.Element;
|
|
113
111
|
|
|
114
112
|
/**
|
|
115
|
-
* A drag grip on a side panel's inner edge
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* `onResize`. The host renders it as an absolute child of the panel row, pinned
|
|
121
|
-
* over the panel↔canvas seam, so the panels' `overflow: hidden` never clips it.
|
|
113
|
+
* A drag grip on a side panel's inner edge: the shell's `ResizeHandle`
|
|
114
|
+
* (harness UI-24; since 1.0.0, efficient-easel#199). The splitter role, the
|
|
115
|
+
* keys (arrows by 16px, Home and End to the bounds, Enter back to the default),
|
|
116
|
+
* the 3px drag threshold, the double-click reset and the `Tooltip` (never
|
|
117
|
+
* `title=`) are the shell's.
|
|
122
118
|
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* the module and must render it inside the host's client boundary.
|
|
119
|
+
* It owns NO width: the editor holds and persists it. What stays here is where
|
|
120
|
+
* the grip sits — `chrome.css`'s `.es-resizer--left|right`, pinned over the
|
|
121
|
+
* panel↔canvas seam from `--es-left-w` / `--es-right-w`, because the editors
|
|
122
|
+
* render it as a child of the panel ROW, not of the panel — and the hint in
|
|
123
|
+
* the host's language (`ChromeWords.resize`).
|
|
129
124
|
*/
|
|
130
125
|
declare function PanelResizeHandle({ side, width, min, max, defaultWidth, label, onResize }: PanelResizeHandleProps): react.JSX.Element;
|
|
131
126
|
|
|
@@ -139,7 +134,12 @@ declare function PanelResizeHandle({ side, width, min, max, defaultWidth, label,
|
|
|
139
134
|
* margin, size and weight, so being an h2 moves nothing on screen.
|
|
140
135
|
*/
|
|
141
136
|
declare function InspectorHead({ icon, name, kind, actions }: InspectorHeadProps): react.JSX.Element;
|
|
142
|
-
/**
|
|
137
|
+
/**
|
|
138
|
+
* A glyph button in the inspector head: the shell's `IconButton` (ghost, or
|
|
139
|
+
* ghost-danger for Delete and the like) in the shell's `Tooltip` (UI-24,
|
|
140
|
+
* UI-17). Named, like every icon-only button; the tooltip says `title` where
|
|
141
|
+
* it differs from the name (why a disabled button is disabled).
|
|
142
|
+
*/
|
|
143
143
|
declare function InspectorIconButton({ label, title, hasPopup, onClick, disabled, danger, expanded, buttonRef, children, }: InspectorIconButtonProps): react.JSX.Element;
|
|
144
144
|
/**
|
|
145
145
|
* ← GO UP ONE LEVEL — a blue text link naming the level above what is open,
|
|
@@ -155,7 +155,8 @@ declare function InspectorIconButton({ label, title, hasPopup, onClick, disabled
|
|
|
155
155
|
* drawn here, so a host passes no glyph, and the words are always WHERE IT
|
|
156
156
|
* GOES — the parent's name, never "Back".
|
|
157
157
|
*
|
|
158
|
-
* The
|
|
158
|
+
* The shell's `Button` in its `link` variant, in the shell's `Tooltip`
|
|
159
|
+
* (UI-24): the whole link is the button, arrow and name. The host renders nothing when
|
|
159
160
|
* there is no level above (efficient-easel/node-ops `parentStep` says so) — a
|
|
160
161
|
* dead control would be permanent furniture on the level selected most.
|
|
161
162
|
*
|
|
@@ -204,6 +205,10 @@ declare function mediaPickKind(accept: string): MediaPickKind;
|
|
|
204
205
|
* document, or a save was refused. Never a dialog (blueprint 2.5): the operator
|
|
205
206
|
* has to be able to read and copy from the screen it is warning them about.
|
|
206
207
|
*
|
|
208
|
+
* The shell's `Banner` (warning, or info for a neutral notice) with the
|
|
209
|
+
* shell's `Button`s as its action, their explanations in its `Tooltip`
|
|
210
|
+
* (UI-24, UI-17). The wrapper is the bar's place and its live role only.
|
|
211
|
+
*
|
|
207
212
|
* The host places it (under the top bar, above the canvas) and owns the
|
|
208
213
|
* handlers; the words are `editNotice`'s. Renders nothing when there is nothing
|
|
209
214
|
* to say, so a host can mount it unconditionally.
|
package/dist/chrome/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MediaPanelHead,PanelResizeHandle,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,mediaPickKind,panelWidthVars,setPanelWidthVars}from"../chunk-
|
|
1
|
+
export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MediaPanelHead,PanelResizeHandle,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,mediaPickKind,panelWidthVars,setPanelWidthVars}from"../chunk-TJ7YIRWQ.js";import"../chunk-ZJEBF4NB.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-MFIRYGHW.js";import"../chunk-L5KW4HG5.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as s}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as i}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-QR4DLZ3P.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-QFMJBBKM.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-E2O2MRZR.js";import{useEasel as u}from"./chunk-PYCLHOSA.js";import{useWords as k}from"./chunk-MFIRYGHW.js";import{AddPanel as f}from"./chunk-W3XX2CNW.js";import{AddIcon as h}from"./chunk-L5KW4HG5.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{jsx as g,jsxs as $,Fragment as B}from"react/jsx-runtime";var O=e=>`section:${e}`,v=e=>`block:${e}`,L=e=>`template:${e}`;function x({blocks:x,blocksOnly:H,at:R,onAdd:A,itemFor:C,session:I,siteWide:N,onClose:V,onHide:W,readOnly:D}){const F=u(e=>e.config),M=p(),{labelAtLevel:P,categoryLabel:Q,firstSection:K,Icon:S,Thumbnail:T}=M,{blockIsOffered:Y}=m(),Z=k("screen",d).add,w=l(),[z,E]=y([]);b(()=>{let t=!1;const o=e=>Y(e,w);return i(w).list().then(n=>{if(t)return;const s=F.components;E(n.filter(t=>t.node?.type&&s[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[F,w]);const G=j(()=>t(F,M),[F]),J=e=>({type:O(e.type),label:e.name,cover:/* @__PURE__ */g(T,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:Z.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),X=j(()=>{const e=[];if(x&&x.choices.length>0&&a(x.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${Z.inside({name:x.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:v(e.type),label:e.label,icon:/* @__PURE__ */g(S,{type:e.type,size:18}),title:Z.tile({name:e.label})}))})}),H)return e;const t=o(G,K);t&&e.push({key:"start",title:Z.startBlank,tiles:[J(t)]}),z.length>0&&e.push({key:"templates",title:Z.templates,tiles:z.map(e=>{return{type:L(e.id),label:e.name,cover:/* @__PURE__ */g(T,{type:e.node.type}),keywords:[(t=e.node.type,P(t,"section",F.components[t]?.label??t)),e.node.type]};var t})});const i=n(G,K);for(const t of Object.keys(F.categories??{})){const o=i.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:s(F,t,Q),tiles:o.map(J)})}return e},[x,H,z,G,F,Z]),q=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=z.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
+
return $(B,{children:[
|
|
3
|
+
/* @__PURE__ */g(r,{icon:/* @__PURE__ */g(h,{size:15}),title:Z.title,context:H?Z.contextBlocks:Z.contextAll,actions:/* @__PURE__ */g(c,{label:Z.done,description:Z.doneDescription,onClick:V}),onHide:W}),
|
|
4
|
+
/* @__PURE__ */$("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
+
/* @__PURE__ */g(f,{groups:X,session:I,itemFor:e=>C(q(e)??{kind:"section",type:e}),onInsert:e=>{const t=q(e);t&&A(t)},at:R,hint:H?Z.hintBlocks:Z.hint,searchLabel:H?Z.searchBlocks:Z.searchSections,readOnly:D}),N&&!H?N:null]})]})}export{x as AddSidePanel,v as blockKey,O as sectionKey,L as templateKey};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{Tooltip as e}from"efficient-shell/ui";import{useId as s}from"react";import{jsxs as i,Fragment as l,jsx as r}from"react/jsx-runtime";function n({label:n,blocked:a,onAdd:d,small:c=!1}){const o=null!==a,t=s(),m=/* @__PURE__ */i("button",{type:"button",className:"sf-add-card","aria-disabled":o||void 0,"aria-describedby":o?t:void 0,onClick:o?void 0:d,children:[
|
|
2
|
+
/* @__PURE__ */r("span",{className:c?"sf-plus sf-plus--sm":"sf-plus",children:"+"}),n]});return o?/* @__PURE__ */i(l,{children:[
|
|
3
|
+
/* @__PURE__ */r(e,{content:a,children:m}),
|
|
4
|
+
/* @__PURE__ */r("span",{id:t,className:"es-vh",children:a})]}):m}export{n as AddChildRow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_FIELDS_WORDS as e}from"./chunk-FPOKPNO4.js";import{useWords as i}from"./chunk-MFIRYGHW.js";import{ShellStringsProvider as n,InputNumber as s,Tooltip as a}from"efficient-shell/ui";import{jsx as l}from"react/jsx-runtime";function r({id:r,value:t,onChange:m,min:o,max:c,step:u=1,shiftStep:d,styleValue:p,icon:f,unit:h,steppers:b=!1,placeholder:v,readOnly:x=!1,ariaLabel:y,ariaLabelledBy:N,title:O}){const g=i("fields",e),j="number"==typeof t&&Number.isFinite(t)?t:null,F=/* @__PURE__ */l("div",{className:`es-fnum${f?" es-fnum--icon":""}${null===j&&void 0!==p?" is-style":""}`,children:/* @__PURE__ */l(n,{value:{number:{increase:g.more,decrease:g.less}},children:/* @__PURE__ */l(s,{id:r,size:"sm",className:"es-fnum-box",value:j,onChange:e=>m(e??void 0),min:o,max:c,step:u,shiftStep:d,readOnly:x,steppers:b,snap:!0,placeholder:void 0!==p?String(p):v,prefix:f?/* @__PURE__ */l("span",{className:"es-fnum-icon",children:f}):void 0,suffix:h?/* @__PURE__ */l("span",{className:"es-fnum-unit",children:h}):void 0,"aria-label":y,"aria-labelledby":N})})});return O?/* @__PURE__ */l(a,{content:O,children:F}):F}export{r as FieldNumber};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{EaselMenuItems as o,menuLabel as e}from"./chunk-EA2HTX37.js";import{ContextMenu as r}from"efficient-shell/ui";import{jsx as n}from"react/jsx-runtime";function l({x:l,y:t,items:i,onClose:m,owner:s,portalTo:u}){return 0===i.length?null:/* @__PURE__ */n(r,{at:{x:l,y:t},owner:s??u??null,onClose:m,"aria-label":e(i),children:/* @__PURE__ */n(o,{items:i,onClose:m})})}export{l as EaselContextMenu};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{PopupMenuDivider as e,PopupMenuLabel as n,PopupSubmenu as l,PopupMenuItem as r}from"efficient-shell/ui";import{jsx as i,Fragment as c,jsxs as a}from"react/jsx-runtime";function t({items:a,onClose:t}){/* @__PURE__ */
|
|
2
|
+
return i(c,{children:a.map((c,a)=>{if("—"===c.label)/* @__PURE__ */return i(e,{},a);if(c.header)/* @__PURE__ */return i(n,{children:c.label},a);if(c.children?.length){const e=c.children.some(e=>void 0!==e.checked);/* @__PURE__ */
|
|
3
|
+
return i(l,{label:c.label,icon:u(c),children:c.children.map((n,l)=>/* @__PURE__ */i(r,{danger:n.danger,onClick:n.onClick,...e?{role:"menuitemradio",checked:Boolean(n.checked)}:{},children:d(n)},l))},a)}/* @__PURE__ */
|
|
4
|
+
return i(r,{danger:c.danger,onClick:()=>{c.onClick(),t()},children:d(c)},a)})})}function o(e){return e.find(e=>e.header)?.label}function u(e){return null==e.icon?null:/* @__PURE__ */i("span",{className:"es-menu-icon","aria-hidden":"true",children:e.icon})}function d(e){return null==e.icon&&null==e.shortcut?e.label:/* @__PURE__ */a(c,{children:[u(e),
|
|
5
|
+
/* @__PURE__ */i("span",{className:"es-menu-label",children:e.label}),null==e.shortcut?null:/* @__PURE__ */i("span",{className:"es-menu-shortcut","aria-hidden":"true",children:e.shortcut})]})}export{t as EaselMenuItems,o as menuLabel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-QFMJBBKM.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-PYCLHOSA.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
|
|
2
2
|
return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{DEFAULT_PICK_WORDS as e}from"./chunk-ZAOM6PFH.js";import{parseHexColor as t,Popover as n,colorSwatchClasses as r,colorFill as l,ColorPickerPanel as i}from"efficient-shell/ui";export{hexToHsv,hsvToHex}from"efficient-shell/ui";import{useRef as a,useState as s,useLayoutEffect as o,useEffect as c}from"react";import{jsx as u,jsxs as p}from"react/jsx-runtime";var d=t,h=7,m=e=>e.toUpperCase(),g=(e,t,n)=>Math.min(n,Math.max(t,e));function f(e,t,n){return{s:n.width>0?g((e-n.left)/n.width,0,1):0,v:n.height>0?1-g((t-n.top)/n.height,0,1):0}}function v(e,t){return t.width>0?360*g((e-t.left)/t.width,0,1):0}function w(e){if(/^(data|blob):/i.test(e))return"";const t=(e.split(/[?#]/)[0]??"").split("/").filter(Boolean).pop()??"";try{return decodeURIComponent(t)}catch{return t}}function k({value:t,onChange:i,label:h,theme:g,caption:f,inherited:v,after:w,id:k,readOnly:x,words:y=e.colour}){const E=a(null),L=a(null),N=()=>{const e=E.current?.parentElement;return e?.classList.contains("es-field-head")?e.querySelector(":scope > .es-field-name .es-field-label"):e?.classList.contains("es-pick-line")?e.querySelector(":scope > .es-pick-line-label"):null},B=()=>L.current?.querySelector(".es-pick-hexwrap > *")??null,O=e=>e.scrollWidth>e.clientWidth+1,R=e=>{e&&(O(e)?e.dataset.clipped="true":delete e.dataset.clipped)},D=a(()=>{});D.current=()=>{R(N()),P||R(B())};const[T,M]=s(null),[P,S]=s(null);o(()=>D.current()),c(()=>{const e=E.current?.parentElement,t=e?.ownerDocument.defaultView;if(!e||!t?.ResizeObserver)return;const n=new t.ResizeObserver(()=>D.current());return n.observe(e),()=>n.disconnect()},[]),c(()=>{const e=E.current?.parentElement;if(!e)return;const t=e=>{const t=e;if(!t)return null;const n=N(),r=B();return n&&(t===n||n.contains(t))?n:r&&t===r?r:null},n=e=>{const n=t(e.target),r=U();if(!n||!r||n.ownerDocument.activeElement===n||!O(n))return;const l=n.getBoundingClientRect(),i=r.getBoundingClientRect(),a="INPUT"===n.tagName?n.value:n.textContent??"";M({text:a,left:l.left-i.left,top:l.top-i.top})},r=e=>{t(e.target)&&M(null)};return e.addEventListener("pointerover",n),e.addEventListener("pointerout",r),()=>{e.removeEventListener("pointerover",n),e.removeEventListener("pointerout",r)}},[]);const U=()=>{const e=E.current?.parentElement;return e&&(e.classList.contains("es-field-head")||e.classList.contains("es-pick-line"))?e:L.current},W=t?null:d(v??""),q=void 0===f||t&&d(f)===d(t)?null:f,F=q??(t?m(t):W?m(W):y.notSet);/* @__PURE__ */
|
|
2
|
+
return u("div",{ref:E,className:"es-pick-colour",children:/* @__PURE__ */p("div",{ref:L,className:"es-pick-colour-row","data-editing":P??void 0,onFocus:e=>{const t=e.target,n=U();if(!n||!t.classList.contains("es-pick-hex"))return;M(null),t.style.setProperty("--es-pick-edit-room",n.getBoundingClientRect().right-t.getBoundingClientRect().left+"px");const r=t.parentElement?.nextElementSibling,l=!!r&&t.getBoundingClientRect().right>r.getBoundingClientRect().left-2;S(l?"over":"room")},onBlur:e=>{const t=e.target;t.classList.contains("es-pick-hex")&&(t.style.removeProperty("--es-pick-edit-room"),S(null))},children:[
|
|
3
|
+
/* @__PURE__ */u(n,{id:k,className:"es-pick-swatch-wrap",trigger:/* @__PURE__ */u("span",{"aria-hidden":"true",style:{position:"absolute",inset:0,...l(t||W)}}),triggerLabel:y.swatch({label:h,shown:F}),triggerClassName:r({className:t?"es-pick-swatch":W?"es-pick-swatch is-inherited":"es-pick-swatch is-unset"}),"aria-label":y.dialog({label:h}),disabled:x,children:/* @__PURE__ */u(b,{value:t,onChange:i,label:h,theme:g,inherited:v,readOnly:x})}),
|
|
4
|
+
/* @__PURE__ */u("span",{className:"es-pick-hexwrap",children:null===q?/* @__PURE__ */u(C,{value:t,follows:W?m(W):void 0,onChange:e=>{x||e===t||i(e)},name:y.hex({label:h}),readOnly:x}):/* @__PURE__ */u("span",{className:"es-pick-caption",children:q})}),w,T?/* @__PURE__ */u("span",{className:"es-pick-tag","aria-hidden":"true",style:{left:T.left,top:T.top},children:T.text}):null]})})}function b({value:e,onChange:t,label:n,theme:r,onClose:l,id:a,inherited:s,readOnly:o,words:c,swatch:p,dragWrites:d="live"}){/* @__PURE__ */
|
|
5
|
+
return u(i,{id:a,className:"es-pick-window",value:e,onChange:t,label:n,presets:r?.map(e=>({value:e.value,label:e.name})),fallback:s,dragWrites:d,disabled:o,onClose:l})}function C({value:e,follows:t,onChange:n,name:r,readOnly:l}){const[i,o]=s(null),c=a(!1);/* @__PURE__ */
|
|
6
|
+
return u("input",{type:"text",className:!e&&t?"es-pick-hex is-inherited":"es-pick-hex",value:i??(e?m(e):t??""),"aria-label":r,maxLength:7,spellCheck:!1,autoComplete:"off",readOnly:l,onChange:t=>{o(t.target.value);const r=d(t.target.value);null!==r&&r!==e&&n(r)},onFocus:e=>e.currentTarget.select(),onMouseDown:e=>{c.current=e.currentTarget.ownerDocument.activeElement!==e.currentTarget},onMouseUp:e=>{c.current&&e.preventDefault(),c.current=!1},onKeyDown:e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),e.stopPropagation(),o(null),e.currentTarget.blur())},onBlur:()=>o(null)})}export{k as ColourPicker,b as ColourWindow,h as HEX_MAX_LENGTH,m as hexReadout,v as hueFromPoint,w as mediaName,f as svFromPoint,d as typedHex};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-
|
|
1
|
+
import{useSectionOps as o}from"./chunk-QTPJMJOJ.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-QFMJBBKM.js";import{useEasel as p}from"./chunk-PYCLHOSA.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=p(o=>o),I=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}),a?.(t)):i(o=>"part"===o.kind?n:o)},[i,a]);c(()=>{k(l)},[k,l]);const h=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>n);const e=u(o);e&&I.select(e)},[i,u,I]),openPartId:h}}export{m as usePartBridge};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={accent:"var(--accent-600, var(--submit-bg))",accentTint:"color-mix(in srgb, var(--es-accent) 10%, var(--surface))",accentTintStrong:"color-mix(in srgb, var(--es-accent) 18%, var(--surface))",accentLine:"color-mix(in srgb, var(--es-accent) 32%, var(--surface))",accentText:"color-mix(in srgb, var(--es-accent) 65%, var(--ink-strongest))",accentRing:"var(--rosh-focus-ring)",accentShadow:"color-mix(in srgb, var(--es-accent) 35%, transparent)",onAccent:"var(--status-on-solid)",appBg:"var(--surface-sunken)",previewBg:"var(--surface-raised)",panel:"var(--surface)",raised:"var(--surface)",topbarBg:"var(--surface)",frameBg:"#ffffff",hover:"var(--surface-raised)",hatch:"color-mix(in srgb, var(--ink-strongest) 2%, transparent)",addcardVeil:"color-mix(in srgb, var(--surface-sunken) 66%, transparent)",fieldBg:"var(--surface)",trackBg:"var(--surface-raised)",inputBorder:"var(--line-strong)",fieldText:"var(--ink-strong)",fieldPlaceholder:"var(--ink-faintest)",knob:"var(--surface)",text:"var(--ink-strongest)",textStrong:"var(--ink-strongest)",textSecondary:"var(--ink)",muted:"var(--ink-faint)",icon:"var(--ink-faint)",disabled:"var(--ink-faintest)",divider:"var(--line)",line:"var(--line)",btnBorder:"var(--line-strong)",btnText:"var(--ink)",chipBg:"var(--surface-raised)",chipFg:"var(--ink-faint)",brandSquare:"var(--ink-strongest)",deviceBorder:"var(--line)",toastBg:"var(--status-draft-solid)",toggleOff:"var(--line-strong)",scrollbar:"var(--line-strong)",scrollbarHover:"var(--ink-faintest)",danger:"var(--status-danger-soft-ink)",dangerStrong:"var(--status-danger-soft-ink)",dangerTint:"var(--status-danger-soft)",warning:"var(--status-pending-soft-ink)",previewTint:"var(--status-pending-soft)",success:"var(--status-success-soft-ink)",panelRadius:"var(--radius-xl)",rowRadius:"var(--radius-lg)",fieldRadius:"var(--radius-md)",panelGap:12,space2:2,space4:4,space8:8,space12:12,space16:16,space32:32,panelShadow:"0 1px 2px rgba(0, 0, 0, 0.05), 0 10px 30px rgba(0, 0, 0, 0.06)",topbarShadow:"0 1px 3px rgba(0, 0, 0, 0.06)",raisedShadow:"0 1px 2px rgba(16, 24, 40, 0.1)",font:"var(--font-sans)"},a={previewBg:"var(--surface)",trackBg:"var(--surface)",chipBg:"var(--surface)"},r=[e.space2,e.space4,e.space8,e.space12,e.space16,e.space32],s={accent:"--es-accent",accentTint:"--es-accent-tint",accentTintStrong:"--es-accent-tint-strong",accentLine:"--es-accent-line",accentText:"--es-accent-text",accentRing:"--es-accent-ring",accentShadow:"--es-accent-shadow",onAccent:"--es-on-accent",appBg:"--es-app-bg",previewBg:"--es-preview-bg",panel:"--es-panel",raised:"--es-raised",topbarBg:"--es-topbar-bg",frameBg:"--es-frame-bg",hover:"--es-hover",hatch:"--es-hatch",addcardVeil:"--es-addcard-veil",fieldBg:"--es-field-bg",trackBg:"--es-track-bg",inputBorder:"--es-input-border",fieldText:"--es-field-text",fieldPlaceholder:"--es-field-placeholder",knob:"--es-knob",text:"--es-text",textStrong:"--es-text-strong",textSecondary:"--es-text-secondary",muted:"--es-muted",icon:"--es-icon",disabled:"--es-disabled",divider:"--es-divider",line:"--es-line",btnBorder:"--es-btn-border",btnText:"--es-btn-text",chipBg:"--es-chip-bg",chipFg:"--es-chip-fg",brandSquare:"--es-brand-square",deviceBorder:"--es-device-border",toastBg:"--es-toast-bg",toggleOff:"--es-toggle-off",scrollbar:"--es-scrollbar",scrollbarHover:"--es-scrollbar-hover",danger:"--es-danger",dangerStrong:"--es-danger-strong",dangerTint:"--es-danger-tint",warning:"--es-warning",previewTint:"--es-preview-tint",success:"--es-success",panelRadius:"--es-panel-radius",rowRadius:"--es-row-radius",fieldRadius:"--es-field-radius",panelGap:"--es-panel-gap",space2:"--es-space-2",space4:"--es-space-4",space8:"--es-space-8",space12:"--es-space-12",space16:"--es-space-16",space32:"--es-space-32",panelShadow:"--es-panel-shadow",topbarShadow:"--es-topbar-shadow",raisedShadow:"--es-raised-shadow",font:"--es-font"};export{r as SPACING_SCALE,s as shellCssVars,a as shellDarkTokens,e as shellTokens};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useScreenOwnerName as e}from"./chunk-
|
|
1
|
+
import{useScreenOwnerName as e}from"./chunk-QFMJBBKM.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-TJ7YIRWQ.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
|
|
2
2
|
return o(r,{children:[
|
|
3
3
|
/* @__PURE__ */t(i,{context:p,pick:d?{kind:c(d.accept),field:d.title||void 0}:null,onCancel:()=>d&&n(d.requestId,null),onHide:m}),
|
|
4
4
|
/* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{styleMenuItems as e}from"./chunk-57DJOKXT.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as t}from"./chunk-PLVEGYK6.js";import{useHostEscape as o}from"./chunk-U3JP4VGF.js";import{EaselMenuItems as l,menuLabel as r}from"./chunk-EA2HTX37.js";import{createNodeClipboard as i,nodeMenuItems as c}from"./chunk-2LK54I4E.js";import{useCanvasEvent as s}from"./chunk-PAELDYYS.js";import{isTypingTarget as a,framePointToHost as u}from"./chunk-ZNCEOSXO.js";import{UndoIcon as d,RedoIcon as p,AddIcon as f,PasteIcon as m,SettingsIcon as h,LayersIcon as y,CopyIcon as k}from"./chunk-L5KW4HG5.js";import{zoneKey as b,ROOT_SLOT as v,ROOT_ID as g}from"./chunk-KRXQM65X.js";import{useState as x,useCallback as C,useRef as w,useEffect as P}from"react";import{ContextMenu as z}from"efficient-shell/ui";import{jsx as O}from"react/jsx-runtime";function A(e,n){const o=[],l=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||l.has(n.props.id))break;if(l.add(n.props.id),o.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===t)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var K=i(),D=/* @__PURE__ */new WeakMap;function E(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",i);let t=D.get(n);return t||(t=i(),D.set(n,t)),t}function S(){return E(n())}function T(e,n,o){if(n===t){const{floor:n,cap:t}=e.sectionBand();return{parentId:g,slot:v,index:Math.min(Math.max(o,n),t)}}const l=n.lastIndexOf(":");return{parentId:n.slice(0,l),slot:n.slice(l+1),index:o}}function j(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete}}function L(e,n,t){const o=e.canPasteAt;if(!o)return b(n.from)===t.zone?T(e,t.zone,t.index+1):null;for(const l of A(e,t)){const t=T(e,l.zone,l.index+1);if(o(n,t))return t}return null}function M(e){if(e.defaultPrevented||e.altKey||e.shiftKey||!e.metaKey&&!e.ctrlKey)return null;if(a(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function X(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=j(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:L(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function I(n,o){const{zone:l,index:r}=o,i=n.nodeAt(l,r);if(!i)return[];const s=i.props.id,a=n.labelOf(i.type,l),u=Boolean(i.props._hidden),d=n.nodeOps,p=n.isPinned(i,l),f=n.isLocked(i),m=!p&&!f&&!n.duplicateBlocked(i),h=n.permits?.(i)??{duplicate:!0,delete:!0},y=j(n,i,l),k=A(n,o),b=d.held,v=b&&!p?L(n,b,o):null,g=!n.readOnly,x=n.style?e({held:g?n.style.held():null,canCopy:n.style.canCopy(i,l),onCopy:()=>n.style?.copy(i,l),onPaste:()=>n.style?.paste(l,r,i)}):[];return c({title:a,layer:{group:"pick",items:k.flatMap((e,o)=>{const l={label:n.rowNameOf(e.node,e.zone),checked:0===o,onClick:()=>n.selectAt(e.zone,e.index,e.node.props.id,e.parentType)},r=e.zone===t?null:n.slotRung?.(e.zone)??null;return r?[l,{label:r.label,checked:!1,onClick:r.select}]:[l]})},actions:{addInside:g&&n.canAddTo(i.type)?()=>n.openAddInside(l,r):void 0,duplicate:g&&m&&h.duplicate?()=>d.duplicate(s):void 0,moveUp:g&&d.canStep(s,-1)?()=>d.step(s,-1):void 0,moveDown:g&&d.canStep(s,1)?()=>d.step(s,1):void 0,copy:y.copy?()=>d.copy(s,a):void 0,cut:g&&y.cut?()=>d.cut(s,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&n.renamePropOf(i,l)?()=>n.beginRename(l,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(s,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(s):void 0},style:x,extras:n.menuRows?.(i,l,r)??void 0,pinnedLine:p?"Pinned — can’t be moved or deleted":void 0})}function R(e){const n=!e.readOnly,o=[];n&&e.history.hasPast&&o.push({label:"Undo",icon:/* @__PURE__ */O(d,{}),shortcut:"⌘Z",onClick:e.history.back}),n&&e.history.hasFuture&&o.push({label:"Redo",icon:/* @__PURE__ */O(p,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const l=n?[{label:"Add section",icon:/* @__PURE__ */O(f,{}),onClick:e.openAddSection}]:[],r=e.nodeOps.held,i=T(e,t,e.sectionBand().cap);if(n&&r&&(e.canPasteAt?e.canPasteAt(r,i):b(r.from)===t)){const n=i;l.push({label:`Paste ${r.label}`,icon:/* @__PURE__ */O(m,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const c=[o,l,[{label:e.pageSettingsLabel??"Page settings",icon:/* @__PURE__ */O(h,{}),onClick:e.openPageSettings},{label:"Collapse all layers",icon:/* @__PURE__ */O(y,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),s={label:"—",onClick:()=>{}};return c.flatMap((e,n)=>n?[s,...e]:e)}function Y(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=[];l&&(i.push({label:"Copy",icon:/* @__PURE__ */O(k,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),i.push({label:"Cut",icon:/* @__PURE__ */O(k,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),i.push({label:"Paste",icon:/* @__PURE__ */O(m,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const c=[i,n.value?[{label:"Select all",shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),s={label:"—",onClick:()=>{}};return c.flatMap((e,n)=>n?[s,...e]:e)}function B(e){return e.shiftKey}function V(e,n){const[t,l]=x(null),r=C(()=>l(null),[]);o(null!==t,r);const i=w(e);i.current=e;const c=C(e=>{const n=i.current,t=n.keys;if(!t)return;const o=M(e);if(!o)return;const l=t.selected();if(!l)return;const r=X(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),a=e.keys?.target??null;P(()=>{if(!a)return;const e=e=>c(e);return a.addEventListener("keydown",e),()=>a.removeEventListener("keydown",e)},[a,c]),s(n,"keydown",c);const d=C(n=>{if(B(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n?n instanceof HTMLInputElement&&!["text","search","url","email","tel","number",""].includes(n.type)?null:n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);s(n,"contextmenu",t=>{if(B(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;t.preventDefault();const c=u(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),s(n,"mousedown",r),s(n,"scroll",r,{on:"window"});return{onEditorContextMenu:d,menu:t?/* @__PURE__ */O(U,{host:e,target:t,onClose:r}):null,closeMenu:r}}function U({host:e,target:n,onClose:t}){const o="node"===n.kind?I(e,n):"input"===n.kind?Y(e,n.el):R(e);return 0===o.length?null:/* @__PURE__ */O(z,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":r(o),children:/* @__PURE__ */O(l,{items:o,onClose:t})})}export{K as EASEL_NODE_CLIPBOARD,A as ancestorChain,E as nodeClipboardOf,j as nodeClipboardRules,I as nodeMenuItems,M as nodeShortcut,R as pageMenuItems,L as pastePlace,X as runNodeShortcut,Y as textMenuItems,S as useNodeClipboard,V as useNodeContextMenu};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={name:"Layers",dragHint:"Drag to move · ⌥↑ ⌥↓",collapse:"Collapse",expand:"Expand",collapseNamed:({label:e})=>`Collapse ${e}`,expandNamed:({label:e})=>`Expand ${e}`,emptySlot:"No blocks yet",addBlock:"Add a block",dropHere:"Drop here"};export{e as DEFAULT_TREE_WORDS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t){if("undefined"==typeof document)return;const e=document.documentElement;e.removeAttribute("data-editor-theme");const n="string"==typeof t?t.trim():"";n&&e.setAttribute("data-theme",n)}export{t as applyEaselChromeTheme};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenDocument as n}from"./chunk-
|
|
1
|
+
import{useScreenDocument as n}from"./chunk-ONRYLR2D.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-E2O2MRZR.js";import{EditNotice as r}from"./chunk-TJ7YIRWQ.js";import{useWords as e}from"./chunk-MFIRYGHW.js";import{jsx as i}from"react/jsx-runtime";function t(){const{capabilities:t,access:c,takeOverEditing:a,viewReadOnly:s,saveConflict:m,reloadFromServer:u}=n(),{noun:l}=e("screen",o);return t.hasEditGuard?/* @__PURE__ */i(r,{access:c,conflict:m,noun:l,onTakeOver:a,onViewReadOnly:s,onReload:u}):null}export{t as PageEditGuardNotices};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{DEFAULT_RAIL_WORDS as e}from"./chunk-2OAZYSWJ.js";import{IconRailButton as i,IconRail as o}from"efficient-shell/ui";import{jsx as l}from"react/jsx-runtime";function a({label:e,icon:o,active:a,disabled:t,onSelect:n,className:r,tooltipSide:c}){const s=["es-rail-btn",a?"is-active":"",r??""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
2
|
+
return l(i,{label:e,icon:o,active:a,disabled:t,onClick:n,tooltipSide:c,className:s})}function t({items:i,ariaLabel:t=e.label,className:n,orientation:r="column",onLabelsShown:c}){const s="row"===r;/* @__PURE__ */
|
|
3
|
+
return l(o,{"aria-label":t,orientation:s?"horizontal":"vertical",labels:s?"beside":"none",labelsFit:s,onLabelsShown:s?c:void 0,className:["es-rail",s?"es-rail-row":"",n??""].filter(Boolean).join(" "),children:i.map(e=>/* @__PURE__ */l(a,{label:e.label,icon:e.icon,active:e.active,disabled:e.disabled,onSelect:e.onSelect,tooltipSide:s?"bottom":"right"},e.id))})}export{t as EaselRail,a as EaselRailButton};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{DEFAULT_FIELDS_WORDS as e}from"./chunk-FPOKPNO4.js";import{useWords as l}from"./chunk-MFIRYGHW.js";import{SearchableSelect as a,Select as i,Slider as n}from"efficient-shell/ui";import{jsx as s,jsxs as o}from"react/jsx-runtime";import{useId as r,useRef as t}from"react";function u(e,l){return e.find(e=>Object.is(e.value,l))}var d=e=>String(e);function c(n){const{id:r,options:t,placeholder:u,readOnly:c=!1,ariaLabel:m,ariaLabelledBy:v,searchable:b=!1,searchPlaceholder:h,groupCount:p=!1,renderOption:f}=n,g=l("fields",e),N=v?{"aria-labelledby":v}:m?{"aria-label":m}:{},O=t.some(e=>void 0!==e.thumb),y=O||void 0!==f||t.some(e=>void 0!==e.meta),C=e=>""===e?void 0:t[Number(e)],x=(e,l)=>{const a=C(e.value);return a?/* @__PURE__ */o("span",{className:"es-fsel-row",children:[O?/* @__PURE__ */s("span",{className:"es-fsel-thumb","aria-hidden":"true",children:a.thumb?/* @__PURE__ */s("img",{src:a.thumb,alt:"",loading:"lazy"}):null}):null,
|
|
2
|
+
/* @__PURE__ */s("span",{className:"es-fsel-label",children:f?f(a,{active:l.active??!1,chosen:l.selected}):a.label}),void 0===a.meta||b?null:/* @__PURE__ */s("span",{className:"es-fsel-meta","aria-hidden":"true",children:a.meta})]}):e.label};if(b&&!0!==n.multiple){const l=t.findIndex(e=>Object.is(e.value,n.value)),i=[];t.forEach((e,l)=>{if(e.disabled)return;const a=e.meta??e.group;i.push({value:d(l),label:e.label,...a?{sublabel:a}:{}})});const o=n.onChange;/* @__PURE__ */
|
|
3
|
+
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{id:r,value:l>=0?d(l):"",options:i,placeholder:h??u??g.search??e.search,disabled:c,renderOption:y?x:void 0,onChange:e=>{const l=C(e);l&&!Object.is(l.value,n.value)&&o(l.value)},...N})})}const j=[];let I=null;if(t.forEach((e,l)=>{const a={value:d(l),label:e.label,...e.disabled?{disabled:!0}:{}};void 0===e.group?(I=null,j.push(a)):I&&I.label===e.group?I.options.push(a):(I={label:e.group,options:[a]},j.push(I))}),p)for(const e of j)"options"in e&&(e.label=`${e.label} ${e.options.length}`);const F={id:r,size:"sm",className:"es-fsel-button",options:j,placeholder:u??g.choose,disabled:c,renderOption:y?x:void 0,...N};if(!0===n.multiple){const e=Array.isArray(n.value)?n.value:[],l=l=>e.some(e=>Object.is(e,l.value)),a=t.flatMap((e,a)=>l(e)?[d(a)]:[]),o=n.onChange;/* @__PURE__ */
|
|
4
|
+
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(i,{...F,multiple:!0,value:a,onChange:e=>o(t.filter((l,a)=>e.includes(d(a))).map(e=>e.value))})})}const M=t.findIndex(e=>Object.is(e.value,n.value)),P=n.onChange;/* @__PURE__ */
|
|
5
|
+
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(i,{...F,value:M>=0?d(M):"",onChange:e=>{const l=C(e);l&&!Object.is(l.value,n.value)&&P(l.value)}})})}function m({id:e,label:l,value:a,onChange:i,min:u,max:d,step:c=1,styleValue:m,unit:v,sliderMin:b,sliderMax:h,auto:p,readOnly:f=!1}){const g=r(),N=e??g,O="number"==typeof a&&Number.isFinite(a)?a:void 0,y=void 0!==p&&void 0===O,C=!y&&void 0===O&&void 0!==m,x=Number((b-c).toFixed(6)),j=t(!1),I=e=>{f||e===O||i(e)};/* @__PURE__ */
|
|
6
|
+
return o("div",{className:"es-fslider"+(C||y?" is-style":""),onChangeCapture:e=>{j.current="range"===e.target.type},children:[
|
|
7
|
+
/* @__PURE__ */s("label",{className:"es-fslider-name",htmlFor:N,children:l}),
|
|
8
|
+
/* @__PURE__ */s(n,{id:N,label:l,value:O??null,onChange:e=>{if(null===e)return I(void 0);I(void 0!==p&&j.current&&e<b?void 0:e)},min:void 0!==p?x:b,max:h,inputMin:u??-1e9,inputMax:d??Number.POSITIVE_INFINITY,step:c,suffix:v&&!y?v:void 0,emptyLabel:p??(void 0!==m?String(m):""),disabled:f,size:"sm"})]})}export{c as FieldSelect,m as FieldSlider,u as optionFor};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-SQTY6CJD.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,editorRootFocus as m}from"./chunk-PT6V53OO.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-ORR3Q4WV.js";import{usePartBridge as v}from"./chunk-GXFAQ7JN.js";import{useSectionOps as x}from"./chunk-QTPJMJOJ.js";import{useNodeClipboard as b,useNodeContextMenu as w}from"./chunk-JLTZQ4US.js";import{PageEditGuardNotices as z}from"./chunk-MAEXP3KE.js";import{useScreenDocument as B}from"./chunk-ONRYLR2D.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{heldStyle as O,styleShortcut as $}from"./chunk-57DJOKXT.js";import{AddChildRow as I}from"./chunk-5545A3PC.js";import{AddSidePanel as N}from"./chunk-4SWZAYKI.js";import{SidePanelHead as P,PanelShowStrip as T}from"./chunk-QR4DLZ3P.js";import{MediaSidePanel as A}from"./chunk-I64QM6DU.js";import{useScreenSaveSwitch as R,useScreenNodeKeys as M,useScreenPinned as j,useScreenDocumentLabel as E,useScreenCanvasFrame as L,useScreenInspectorPanel as D,useScreenDevices as V,useScreenPickFollowsSelection as W,useScreenLeftView as H,useScreenAdd as F,SELECTION_MODE as J,sameInspectorMode as U,useScreenBridges as G,useScreenBlockRules as Y,useScreenBlockLook as Q,useScreenStorageNamespace as X,useScreenNotify as K,useScreenCanvasHead as _,isSlotMode as q,useScreenStyleClipboard as Z,useScreenDocumentPass as ee,useScreenCanvasDrag as ne,ScreenCanvasTargetProvider as te,isPinnedFirst as oe,isPinnedLast as re,screenSlotsOf as ie}from"./chunk-QFMJBBKM.js";import{ROOT_ZONE as le,blockNodeActions as se,TREE_MAX_DEPTH as de,childSlotsOf as ce,slotFieldsOf as ae,slotChildrenIn as pe,nestsInTree as ue,newNodeId as fe}from"./chunk-PLVEGYK6.js";import{useMediaPanel as he,usePanelPick as me,useCancelPanelPick as ge}from"./chunk-R6WTQWAC.js";import{useEaselHost as ye,useHostEscape as ke}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as Se}from"./chunk-E2O2MRZR.js";import{useEasel as ve,useEaselApi as xe}from"./chunk-PYCLHOSA.js";import{TreeRow as be,Subtree as we,LayersTree as ze,TreeGroupLabel as Be,TreeRowAction as Ce,TreeSeam as Oe}from"./chunk-XWR5YVA7.js";import{toItemSelector as $e,useNodeOps as Ie}from"./chunk-D2BCHTQR.js";import{saveIndicator as Ne}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Pe,TopBarRail as Te,TopBarCluster as Ae,EaselIconButton as Re,TopBarDivider as Me,DeviceSwitch as je,InspectorIconButton as Ee,PanelResizeHandle as Le,MAX_PANEL_W as De,MIN_PANEL_W as Ve,panelWidthVars as We,SaveState as He,SaveStateToggle as Fe}from"./chunk-TJ7YIRWQ.js";import{useWords as Je}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as Ue}from"./chunk-W3XX2CNW.js";import{createDragSession as Ge,useTreeDrag as Ye,gapToMoveIndex as Qe}from"./chunk-67GNT6PF.js";import{useCanvasFrame as Xe,BLOCK_SELECTOR as Ke,useCanvasEvent as _e}from"./chunk-PAELDYYS.js";import{LayersIcon as qe,MediaIcon as Ze,UndoIcon as en,RedoIcon as nn,TrashIcon as tn,EyeOffIcon as on,EyeIcon as rn,DuplicateIcon as ln}from"./chunk-L5KW4HG5.js";import{zoneKey as sn,ROOT_ID as dn,ROOT_SLOT as cn,parseZoneKey as an,DataError as pn}from"./chunk-KRXQM65X.js";import{useRef as un,useMemo as fn,useState as hn,useEffect as mn,useCallback as gn,useLayoutEffect as yn,Fragment as kn}from"react";import{Tooltip as Sn,Button as vn,toast as xn}from"efficient-shell/ui";import{jsx as bn,jsxs as wn,Fragment as zn}from"react/jsx-runtime";function Bn({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i}){if(null!==t)/* @__PURE__ */return bn(He,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
|
|
2
|
+
return bn(He,{tone:e.pending?"off-unsaved":"off",label:"Not saving — see the notice above",role:"status"});const{tone:l,label:s}=Ne(e),d=e.failed&&!e.paused&&/* @__PURE__ */bn(vn,{variant:"secondary",size:"sm",onClick:i,children:"Retry now"});/* @__PURE__ */
|
|
3
|
+
return wn(zn,o?{children:[
|
|
4
|
+
/* @__PURE__ */bn(Fe,{pressed:e.paused,onToggle:r,title:e.paused?"Auto-save is off — click to turn it back on (saves your held edits)":"Auto-save is on — click to pause it",children:/* @__PURE__ */bn(He,{tone:l,label:s})}),d]}:{children:[
|
|
5
|
+
/* @__PURE__ */bn(He,{tone:l,label:s,role:"status"}),d]})}function Cn({expand:e}){/* @__PURE__ */
|
|
6
|
+
return bn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */wn(zn,e?{children:[
|
|
7
|
+
/* @__PURE__ */bn("path",{d:"M8 9l4-4 4 4"}),
|
|
8
|
+
/* @__PURE__ */bn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
9
|
+
/* @__PURE__ */bn("path",{d:"M8 4l4 4 4-4"}),
|
|
10
|
+
/* @__PURE__ */bn("path",{d:"M8 20l4-4 4 4"}),
|
|
11
|
+
/* @__PURE__ */bn("path",{d:"M5 12h14"})]})})}function On(e,n,t){const o=t-n;if(o<6)return null;if(o<26)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+13),t-13))}}var $n="__rungs";var In="screen:band",Nn={duplicate:!0,delete:!0};function Pn(){const Ne=ye(),{target:He,docId:Fe,capabilities:Pn,currentSlug:Tn,siteId:An,onPublish:Rn,saveState:Mn,saveConflict:jn,retrySave:En,toggleAutoSave:Ln,readOnly:Dn,readOnlyReason:Vn=null}=B(),Wn=R(),Hn=M(),{mediaEditing:Fn,hasEditGuard:Jn,hasPinnedChrome:Un}=Pn,{appState:Gn,dispatch:Yn,history:Qn,selectedItem:Xn,getSelectorForId:Kn,config:_n}=ve(e=>e),qn=j(),{first:Zn,firstGroup:et,lastGroup:nt,isSectionGroup:tt,sectionGroupZone:ot,panelOf:rt}=qn,it=rt(Zn),lt=e=>oe(qn,e),st=e=>re(qn,e),dt="node"===qn.firstRow,ct=qn.band??null,at=Je("screen",Se),pt=E()??`/${Tn}`,ut=L(),ft=D(),ht=x({readOnly:Dn}),mt=x({readOnly:Dn,foldIntoHistory:!0}),gt=un(null),yt=xe(),kt=fn(()=>({...ht,select:e=>{gt.current=e,ht.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=yt.config;gt.current=$e(e,t,n)}ht.commitDocument(e,n)}}),[ht,yt]),St=Gn.ui,vt=St.leftSideBarVisible,xt=St.rightSideBarVisible,{options:bt,widths:wt,initial:zt,fluid:Bt,fit:Ct}=V(),[Ot,$t]=hn(zt),It=he(),Nt=Fn&&null!==It,Pt=me(),Tt=ge();W(Xn?.props.id);const{read:At,write:Rt,forSelection:Mt}=H(),[jt,Et]=hn(At);mn(()=>{Rt(jt)},[jt]);const[Lt,Dt]=hn(0),Vt=un(null),Wt=un(null),Ht=Xe(Wt,{readySelector:Ke}),Ft=f(Wt);h(Wt,Ht);const[Jt,Ut]=hn(!1),Gt=un(!1),Yt=un(!1),[Qt,Xt]=hn(null),Kt=F(),_t=e=>Xt(null===e?null:{zone:le,index:e}),[qt,Zt]=hn([]),[eo,no]=hn(J),to="puck"===eo.kind,oo=Jt&&!Qt&&Kt.railTarget?Kt.railTarget(Gn.data,{node:Xn??null,mode:eo}):null,ro=oo?{zone:sn(oo),index:oo.index}:null,io=Qt??ro,lo=io&&io.zone===le?io.index:null,so=t(eo,Xn?.props.id),[co,ao]=hn(null);mn(()=>{co&&(o(),ao(null))},[co]);const po=un(Kn);po.current=Kn;const uo=gn((e,{scroll:n})=>{Et(n=>Mt(e,n)),n&&ao(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=po.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Ho(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),fo=un(null);mn(()=>{const e=fo.current;fo.current=null;const n=null==Xn?.props.id?null:String(Xn.props.id);no(e&&e.id===n?e.mode:rt(Xn?.type)??J);const t=Xn?.props.id,o=gt.current;if(gt.current=null,!t)return;const i=Kn(t);uo(String(t),{scroll:!r(o,i??null,le)})},[Xn?.props.id,uo]);const ho=gn(e=>{no(n=>U(n,e)?n:e),Yn({type:"setUi",ui:{rightSideBarVisible:!0}})},[Yn]),mo=un(()=>{});mo.current=(e,n)=>{const t=e?Ar(e.zone??le)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Xn?.props.id?null:String(Xn.props.id);no(e=>U(e,n)?e:n),o!==r&&(fo.current={id:o,mode:n},kt.select(e))};const go=gn((e,n)=>mo.current(e,n),[]),yo={kind:eo.kind,mode:eo,open:ho,show:e=>no(e),reveal:()=>{xt||Yn({type:"setUi",ui:{rightSideBarVisible:!0}})},select:go},ko=G(yo,{data:Gn.data,selected:Xn??null,zoneOf:e=>Kn(e)?.zone,readOnly:Boolean(Dn),select:e=>{no(J),kt.select({index:e})},replace:(e,n)=>kt.replaceComponent(le,e,n),scrollTo:e=>ri(e)},{device:Ot,refreshes:Lt},{setView:Et,reveal:()=>{vt||Yn({type:"setUi",ui:{leftSideBarVisible:!0}})}}),So=ko.pinnedSource??!1,vo=ko.resolveLeftView?ko.resolveLeftView(jt,Nt):"media"===jt&&Nt?jt:"sections",xo=Y(),{isLockedBlock:bo,duplicateBlocked:wo,nestDepth:zo,newSectionNode:Bo,canAddTo:Co,blockIsOffered:Oo}=xo,$o=Q(),{labelAtLevel:Io,Icon:No,useProducts:Po}=$o,To=$o.rowName?(e,n,t)=>$o.rowName(e,n,t):void 0,Ao=gn(e=>{Yn({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),uo(e,{scroll:!0})},[Yn,uo]),{selectNode:Ro,openPartId:Mo}=v({mode:eo,setMode:no,onOpenPart:Ao}),[jo,Eo]=hn(null);ke(null!==jo,()=>Eo(null));const Lo=y(X()),Do=Lo.collapsed,Vo=Lo.panelWidths,[Wo,Ho]=hn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Do);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
12
|
+
return new Set}});mn(()=>{try{window.localStorage.setItem(Do,JSON.stringify([...Wo]))}catch{}},[Wo]);const[Fo,Jo]=hn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(Vo);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});mn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Vo,JSON.stringify(Fo))}catch{}},300);return()=>clearTimeout(e)},[Fo]);const Uo=gn((e,n)=>Jo(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Go=gn(e=>Uo("left",e),[Uo]),Yo=gn(e=>Uo("right",e),[Uo]),Qo=e=>Wo.has(e),Xo=e=>Ho(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Ko=un(!1),_o=un(null);mn(()=>{if(Ko.current&&!Jt){const e=_o.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Wt.current?.querySelector(`button[aria-label="${CSS.escape(at.add.title)}"]`))?.focus(),_o.current=null}Ko.current=Jt},[Jt]),mn(()=>{if(!Jt||!Ft)return;const e=e=>{"Escape"===e.key&&fi()};return Ft.addEventListener("keydown",e),()=>Ft.removeEventListener("keydown",e)},[Jt,Ft]),ke(Jt,()=>fi()),mn(()=>{!vt&&Jt&&(Ut(!1),Xt(null),Gt.current=!1)},[vt]),mn(()=>{if(!Pt)return Yt.current&&Yn({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Yt.current=!1);Jt&&(Ut(!1),Xt(null),Yt.current=Gt.current,Gt.current=!1),vt||(Yt.current=!0,Yn({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Pt]),mn(()=>{!vt&&Pt&&(Yt.current=!1,Tt())},[vt]),mn(()=>{if(!Pt||!Ft)return;const e=e=>{"Escape"===e.key&&Tt()};return Ft.addEventListener("keydown",e),()=>Ft.removeEventListener("keydown",e)},[Pt,Ft]),ke(null!==Pt,()=>Tt());const qo=K(),Zo=(e,n="success")=>{qo?qo(e,"error"===n?"error":"info"):"error"===n?xn.error(e,{duration:3200,sound:!1}):xn.success(e,{duration:1900,sound:!1})},er=un(null),[nr,tr]=hn(0),[or,rr]=hn(0),ir=_(),lr=un(null),sr=e=>Math.max(0,e.clientHeight-(lr.current?.offsetHeight??0));mn(()=>{const e=er.current;if(!e)return;const n=()=>{tr(e.clientWidth),rr(sr(e))};n();const t=new ResizeObserver(n);return t.observe(e),lr.current&&t.observe(lr.current),()=>t.disconnect()},[]),yn(()=>{er.current&&(tr(er.current.clientWidth),rr(sr(er.current)))},[Fo,vt,xt]);const dr=Ot===Bt?nr>0?nr:wt[Bt]:wt[Ot],cr=nr>0?Math.min(nr/dr,"shrink"===Ct?1:2):1,ar=dr*cr,pr=nr>0&&ar>nr+1,ur={width:ar,height:or||"100%",flex:"none",position:"relative"},fr={width:dr,height:or?or/cr:"100%",maxHeight:"none",transform:1!==cr?`scale(${cr})`:void 0,transformOrigin:"top left"},hr=()=>Yn({type:"setUi",ui:{leftSideBarVisible:!vt}}),mr=()=>Yn({type:"setUi",ui:{rightSideBarVisible:!xt}}),gr=e=>{Jt&&(Ut(!1),Xt(null),Gt.current=!1,vt&&jt===e)||Pt&&(Yt.current=!1,Tt(),vt&&jt===e)||(vt&&jt===e?hr():(Et(e),vt||Yn({type:"setUi",ui:{leftSideBarVisible:!0}})))},yr=()=>{C(Ne,{accept:"image/*",title:"Media library"})},kr=()=>{no(J),kt.select(null),u()},Sr=()=>{no(it??J),xt||Yn({type:"setUi",ui:{rightSideBarVisible:!0}})},vr=Gn.data.content??[],xr=()=>{const e=vr.findIndex(lt),n=vr.findIndex(st);return{floor:e>=0?e+1:0,cap:n>=0?n:vr.length}},br=_n,wr=xo.stripCopy,zr=e=>i(e,wr),Br=b(),Cr=Ie({data:Gn.data,config:br,readOnly:Boolean(Dn),clipboard:Br,strip:wr?e=>wr(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==dn||e.slot!==cn)return{min:0,max:n-1};const{floor:t,cap:o}=xr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&no(J);const t=void 0===n||"node"===n?.kind?n:null;kt.commitDocument(e,t)}}),Or=e=>_n.components[e]?.label??e,$r=gn(e=>_n.components[e]?.defaultProps??{},[_n]),Ir=e=>Io(e,"section",Or(e)),Nr=e=>l({type:e.type,props:e.props??{}},Ir(e.type),To),{nodeAddresses:Pr,zoneItems:Tr}=fn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=de)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of ce(_n,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(vr,le,0),{nodeAddresses:e,zoneItems:n}},[vr,_n]),Ar=gn(e=>Tr.get(e)??[],[Tr]),Rr=e=>{const n=Pr.get(e);return n?Ar(n.zone)[n.index]:void 0},Mr=e=>ie(xo,_n,e),jr=e=>{if(!xo.slotsOf||e===le)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Rr(e.slice(0,n));if(!t)return null;const o=Mr(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}},Er=(()=>{if(!q(eo))return null;const e=`${eo.nodeId}:${eo.slot}`;return jr(e)?.slot.panel===eo.kind?e:null})(),Lr=un(null);mn(()=>{const e=Lr.current;if(Lr.current=null,!Er||!q(eo))return;const n=eo.nodeId;uo(n,{scroll:e!==Er}),Ho(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[eo]);const Dr=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Pr.get(e);n&&(n.zone===le?ii(n.index):Mi(n.zone,n.index,e,Rr(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Er!==i&&(Lr.current=i),go(null,r),xt||Yn({type:"setUi",ui:{rightSideBarVisible:!0}}),ri(o)},Vr=(e,n,t)=>{const o=`${e}:${n}`;if(Ho(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;Er!==o&&(Lr.current=o);go(null,{kind:t,nodeId:e,slot:n})},Wr=(e,n,t)=>{if(Dn||!xo.moveSlot)return;const o=Rr(e),r=o?Mr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:$n,index:n},s=Qe(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=xo.moveSlot(e,n,s);"string"==typeof d&&Vr(e,d,i.panel)},Hr=Po(),Fr=fn(()=>{const e=/* @__PURE__ */new Map;for(const n of Hr??[])e.set(n.slug,n.name);return e},[Hr]),Jr=e=>s(e,Or,$o.plainText,e=>Fr.get(e),$o.rowName),Ur=(e,n)=>{const t=_n.components[e.type]?.fields,o=n===le||Zi(n)?"section":"block",r=n===le&&(lt(e)||st(e)||tt(e.type)),i="block"===o?d(t):r?null:c(t);return $o.renamePropOf?$o.renamePropOf(e,o,i):i},Gr=(e,n,t,o)=>{if(!(!Dn&&jo?.zone===e&&jo.index===n))return;const r=(t,o)=>{Eo(null),o&&((e,n,t)=>{const o=Ar(e)[n];if(!o)return;const r=Ur(o,e);r&&kt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
13
|
+
return bn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":"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)},Yr=n(Z()),Qr=Yr.scope({target:He,siteId:An,docId:Fe}),Xr=_n,Kr=(e,n)=>n===le?Ir(e):Or(e),_r=(e,n,t)=>{const o=Yr.plan(Qr,t,Kr(t.type,e),Xr);o&&(o.changed&&kt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Zo(o.message))},qr=w({nodesIn:Ar,nodeAt:(e,n)=>Ar(e)[n]??null,labelOf:(e,n)=>n===le?Ir(e):Or(e),renamePropOf:Ur,beginRename:(e,n)=>Eo({zone:e,index:n}),history:{hasPast:Qn.hasPast,hasFuture:Qn.hasFuture,back:()=>Qn.back(),forward:()=>Qn.forward()},openAddSection:()=>{kt.select(null),pi(null)},openPageSettings:()=>{kt.select(null),no(J)},pageSettingsLabel:at.pageSettings,readOnly:Boolean(Dn),collapseAll:()=>Ho(new Set(Ar(le).map(e=>String(e.props.id)))),onPasteRefused:e=>Zo(e?at.pasteRefused({name:e.label}):"Your browser won’t let us read the clipboard — press ⌘V","error"),canPasteAt:(e,n)=>nl(e,n),menuRows:ko.menuRows,isLocked:e=>bo(e.type),duplicateBlocked:e=>wo(Gn.data,e),permits:e=>se(_n,e.type),canAddTo:Co,nodeOps:Cr,isPinned:(e,n)=>n===le&&(lt(e)||st(e)),sectionBand:xr,openAddInside:(e,n)=>{e===le?ii(n):kt.select({zone:e,index:n}),pi(null)},locate:e=>Pr.get(e)??null,rowNameOf:(e,n)=>n===le?Nr(e):Jr(e),selectAt:(e,n,t,o)=>{e===le?ii(n):Mi(e,n,t,o??"")},slotRung:e=>{const n=jr(e);return n?.slot.panel?{label:n.slot.label,select:()=>Dr(n.node,n.slot,!1)}:null},style:{held:()=>O(Qr),canCopy:e=>Yr.rows(Xr,e).some(e=>!1!==e.counted),copy:(e,n)=>Yr.copy(Qr,e,Kr(e.type,n),Xr),paste:(e,n,t)=>_r(e,n,t)},keys:Hn?{target:Ft,selected:()=>{const e=Gn.ui.itemSelector;return e?{zone:e.zone??le,index:e.index}:null},held:()=>Br.get(),readOnly:Boolean(Dn),onDone:({done:e,name:n})=>{"copied"===e&&Zo(at.copied({name:n}))}}:void 0},Ht),Zr=un({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});mn(()=>{Zr.current={copy:(e,n)=>Yr.copy(Qr,e,Kr(e.type,n),Xr),paste:_r,at:()=>{const e=Gn.ui.itemSelector;if(!e)return null;const n=e.zone??le,t=Ar(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Dn)}});const ei=gn(e=>{const n=$(e);if(!n)return;const t=Zr.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))},[]);mn(()=>{if(!Ft)return;const e=e=>ei(e);return Ft.addEventListener("keydown",e),()=>Ft.removeEventListener("keydown",e)},[ei,Ft]),_e(Ht,"keydown",ei);const ni=vr.map(e=>e.props.id).join("|");mn(()=>{const e=Ht?.document??null,n=Ht?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Zt(e=>e.length?[]:e);const n=vr.findIndex(st),t=n>=0?n:vr.length,o=n=>{const t=vr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Ke)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=On(l&&s?(s.bottom+l.top)/2:l?l.top:s.bottom,Math.max(-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Zt(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()}},[Ht,ni,Ot,cr,vt,xt,Xn?.props.id]);const ti=Ht?.document??null,oi=Ht?.window??null;mn(()=>{const e=Vt.current;if(!e||!ti||!oi)return;const n=[],t=()=>{const n=ti.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&oi.scrollTo({left:oi.scrollX,top:oi.scrollY+t,behavior:"instant"}),!0};return Vt.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[ti,oi]);const ri=e=>{ko.holdCanvasOn?ko.holdCanvasOn(e):a(e)},ii=e=>{no(J),kt.select({index:e}),ko.sectionPressed?.(vr[e]);const n=vr[e]?.props?.id;n&&ri(n)},li=e=>{const{floor:n,cap:t}=xr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Xn&&eo.kind!==it?.kind?vr.findIndex(e=>e.props.id===Xn.props.id):-1;return o(r>=0?r+1:t)},si=(e,n)=>{const{floor:t,cap:o}=xr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(kt.reorderComponent(le,e,i),kt.select({index:i}),{moved:!0,dest:i})},di=(e,n,t,o)=>{no(J),kt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),Zo(`Added “${t}” section`)},ci=(e,n)=>{const t=li(n),o=Bo(e,{nodeDefaults:$r,newNodeId:fe,sectionLabel:Ir,blockIsOffered:Oo}),r=o?kt.insertNode(le,t,o):kt.insertSection(e,t);return di(t,r,Ir(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of ce(_n,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Co(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},ai=(e,n,t)=>{const o=li(t),r=kt.insertNode(le,o,n);return di(o,r,e),o},pi=e=>ui(le,e),ui=(e,n)=>{_o.current=document.activeElement??null,Pt&&(Gt.current=Yt.current,Yt.current=!1,Tt()),Xt(null===n?null:{zone:e,index:n}),Ut(!0),vt||(Gt.current=!0,Yn({type:"setUi",ui:{leftSideBarVisible:!0}}))},fi=()=>{Ut(!1),Xt(null),Gt.current&&Yn({type:"setUi",ui:{leftSideBarVisible:!1}}),Gt.current=!1},hi=(e,n,t)=>{if("section"===e.kind)kt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;kt.insertNode(n,t,zr(e.template.node))}no(J),kt.select({index:t,zone:n})},mi=(e,n)=>$o.rowName?n?lt(e)?$o.rowName(e,"section",at.header):st(e)?$o.rowName(e,"section",at.footer):tt(e.type)?$o.rowName(e,"section",Or(e.type)):Nr(e):Jr(e):n?Ir(e.type):Or(e.type),gi=e=>n=>{e()},yi=()=>ko.editPinnedSource?.(),ki=(e,n,t)=>{if(Dn)return null;const o=Ar(e)[n];return o&&!se(_n,o.type).delete?null:/* @__PURE__ */bn(Ce,{kind:"delete",label:`Delete ${t}`,onClick:()=>((e,n)=>{const t=Ar(e)[n]?.props?.id;null!=t&&Cr.remove(String(t))})(e,n),children:/* @__PURE__ */bn(tn,{size:15})})},Si=e=>$o.rowPreview?.(e)||void 0,vi=e=>$o.rowMarks?.(e)??void 0,xi=(e,n,t)=>$o.rowActions?.(e,n,t)??null,bi=(e,n,t,o)=>{if(Dn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
14
|
+
return bn(Ce,{kind:"eye",label:r?`Show ${o}`:`Hide ${o}`,onClick:()=>zi(e,n,t),children:/* @__PURE__ */bn(r?on:rn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},wi=e=>{const n=Ir(vr[e]?.type??""),t=n?at.addSectionBefore({name:n}):at.addSectionHere;return xl(le,e,()=>pi(e),t)},zi=(e,n,t)=>{kt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Bi=e=>ae(_n,e),Ci=e=>ce(_n,e),Oi=e=>xo.slotsOf?Mr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:pe(e,n.slot)})):[{slot:null,rung:null,kids:Ci(e)}],$i=e=>xo.slotsOf?Oi(e).flatMap(e=>e.kids):Ci(e),Ii=e=>Boolean(xo.slotsOf)&&Mr(e).some(e=>e.rung),Ni=(e,n,t)=>null===t?void 0===n?Co(e):Co(e,n):Co(e,n,t),Pi=(e,n,t)=>{const o=ue(_n,e.type,n)&&(t||$i(e).length>0||Ii(e));return{collapsible:o,folded:o&&Qo(String(e.props.id))}},Ti=(e,n,t)=>Oi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Pi(e,r,t(e.type)).collapsible?[String(e.props.id),...Ti(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ai=e=>$i(e).length>0||Ii(e)||Boolean(Co(e.type)),Ri=e=>Boolean(Co(e)),Mi=(e,n,t,o)=>{if(no(J),Co(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),kt.select({index:n,zone:e}),a(t)}else kt.select({index:n,zone:e}),ri(t)},ji=(e,n,t,o,r)=>{const i=`${e}:${n}`;kt.insertComponent(i,t,o),Co(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),kt.select({index:o,zone:i})}):kt.select({index:o,zone:i})},Ei=(e,n,t)=>{kt.insertComponent(e,n,t),no(J),kt.select({index:t,zone:e})},Li=un(/* @__PURE__ */new Set);mn(()=>{vr.forEach(e=>{const n=Co(e.type)?.spec;if(!n)return;const t=e.props.id;if(Li.current.has(t))return;Li.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($r)).forEach((e,t)=>mt.seedChild(o,t,n.childType,e))})},[vr,mt,$r]);const Di=un(/* @__PURE__ */new Set);mn(()=>{vr.forEach((n,t)=>{const o=n.props.id;if(Di.current.has(o))return;const r=e(n,Bi(n.type));Di.current.add(o),r&&mt.replaceComponent(le,t,{...n,props:r})})},[vr,mt]),ee(mt,_n);const Vi=vr.findIndex(st),Wi=Vi>=0?vr[Vi]:null,Hi=dt?vr.findIndex(lt):-1,Fi=Hi>=0?vr[Hi]:null,Ji=vr.find(e=>e.type===et)??null,Ui=vr.find(e=>e.type===nt)??null,Gi=Vi>=0?Vi:vr.length,Yi=[];vr.forEach(e=>{st(e)||(Ai(e)&&Yi.push(String(e.props.id)),Yi.push(...Ti(e,1,Ri)))}),Wi&&(Yi.push(String(Wi.props.id)),Yi.push(...Ti(Wi,1,Ri)));const Qi=Yi.length>0&&Yi.every(e=>Wo.has(e)),Xi=e=>{const n=$o.blockRowName(e,Or);return $o.rowName?$o.rowName(e,"block",n):n},Ki=(e,n,t,o)=>{const r=Ar(e)[t];if(!r)return;const i={...an(e),index:t},l={...an(n),index:Math.min(Math.max(o,0),Ar(n).length)},s=Qe(i,l);if(e!==n||s!==t)try{Cr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof pn))throw e}},_i=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Ci(e))n.add(r),t(o)};for(const t of Bi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},qi=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Pr.get(n);if(!e)return null;if(e.zone===le)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Zi=e=>{const n=e.slice(0,e.indexOf(":")),t=vr.find(e=>tt(e.type)&&String(e.props.id)===n);return t&&ot(n)===e?t:null},el=(e,n,t)=>{if(e.rung){const t=Rr(e.rung.nodeId),o=t?Mr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===$n&&n.index>=0&&n.index<=o}if(n.slot===$n)return!1;if(e.add)return ol(e.add,n);const o=sn(n);if(tt(e.type))return!1;const r=Zi(o),i=Zi(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Ar(o).length);if(e.zone===le||o===le){if(e.zone!==o)return!1;const{floor:t,cap:r}=xr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Ar(o).length)return!1;if(e.zone===o)return!0;const l=Wi&&!qn.lastIsOpen?String(Wi.props.id):null;return(!l||qi(e.zone)!==l&&qi(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Ar(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Pr.get(i),s=l?Ar(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&_i(r).has(n))return!1;const d=Co(s.type,zo(Gn?.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?.(Ar(n),r))})(e.zone,o,e.index,t)},nl=(e,n)=>{const t=sn(e.from);if(t===sn(n))return!0;const o=e.node;return el({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},tl=e=>{const n=e.slice(0,e.indexOf(":")),t=Pr.get(n),o=t?Ar(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Co(o.type,zo(Gn?.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:Or(r.spec.childType)}]:[]),l=jr(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:mi(o,t.zone===le)}},ol=(e,n)=>{const t=sn(n);if("block"!==e.kind){if(Zi(t))return n.index>=0&&n.index<=Ar(t).length;if(t!==le)return!1;const{floor:e,cap:o}=xr();return n.index>=e&&n.index<=o}if(t===le)return!1;const o=tl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Ar(t))},rl=(e,n)=>{e.rung?Wr(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&Zi(sn(n)))return void hi(e,sn(n),n.index);if("section"===e.kind)return void ci(e.type,n.index);if("template"===e.kind)return void ai(e.template.name,zr(e.template.node),n.index);const t=sn(n),o=tl(t);o&&(o.target.spec?ji(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Ei(t,e.type,n.index))})(e.add,n):e.zone===le?si(e.index,n.index):Ki(e.zone,sn(n),e.index,n.index)},[il]=hn(()=>Ge()),ll=Ye({keyOf:e=>e.id,readOnly:Boolean(Dn),session:il,canDrop:el,onDrop:rl,onStep:(e,n)=>{e.rung?Wr(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===le?((e,n)=>{const t=Ir(vr[e]?.type??""),o=si(e,n<0?e-1:e+2);if(!o.moved)return void Zo(`“${t}” is already ${n<0?"first":"last"}`);const{floor:r,cap:i}=xr();Zo(`Moved “${t}” to position ${o.dest-r+1} of ${i-r}`)})(e.index,n):Ki(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),sl=gn(e=>{const{floor:n,cap:t}=xr(),o=[];for(const r of e.nodes){const e=sn(r.place),i=Ar(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(lt(i)||st(i)||bo(i.type))continue;if(tt(i.type))continue;const l=Boolean(Zi(e)),s=e===le||l;e===le&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?Ir(i.type):Jr(i),from:r.place})}return{sources:o,zones:e.zones.filter(e=>e.children.length>0||Boolean(tl(sn(e.list))?.choices.length)||Boolean(Zi(sn(e.list))))}},[Gn.data]),dl=e=>{no(J),kt.select(e.zone===le?{index:e.index}:{index:e.index,zone:e.zone})},cl=ne(),al=()=>({data:Gn.data,device:Ot,ops:kt,inspector:yo}),pl=cl?.model,ul=fn(()=>pl?e=>pl(e,sl(e),al()):sl,[pl,sl,Ot]),fl=cl?.measure,hl=fl?(e,n)=>fl(e,n,al()):void 0,ml=cl?.canDrop,gl=ml?(e,n)=>ml(e,n,el,al()):el,yl=cl?.drop,kl=yl?(e,n)=>yl(e,n,rl,al()):rl,Sl=cl?.pick,vl=Sl?e=>Sl(e,dl,al()):dl,xl=(e,n,t,o)=>/* @__PURE__ */bn(Oe,{...Dn?{}:ll.seam({place:{...an(e),index:n}}),onAdd:Dn?void 0:t,label:o},`seam:${e}:${n}`),bl={rowClick:gi,isCollapsed:Qo,toggleCollapse:Xo},wl=e=>{const n=String(e.props.id),t=vr.findIndex(e=>String(e.props.id)===n),o=ot(n),r=Ar(o),i=Qo(n),l=Or(e.type),s=$o.rowName?$o.rowName(e,"section",l):l,d=e=>xl(o,e,()=>ui(o,e),at.addSectionHere);/* @__PURE__ */
|
|
15
|
+
return wn(zn,{children:[
|
|
16
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:e.type,size:13}),name:s,preview:Si(e),marks:vi(e),onSelect:()=>ii(t),nameSlot:Gr(le,t,n,s),selected:so===n,actions:xi(e,le,t)??void 0,rowProps:{"data-node-id":n,onClick:gi(()=>ii(t))},fold:{open:!i,label:"section",onToggle:()=>Xo(n)}}),!i&&/* @__PURE__ */wn(we,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Nr(n),l=Ai(n),s=l&&Qo(r),c=()=>Mi(o,t,r,e.type),{rowProps:a,...p}=ll.row({item:{id:r,zone:o,index:t,type:n.type},place:{...an(o),index:t}},{"data-node-id":r,onClick:gi(c)});/* @__PURE__ */
|
|
17
|
+
return wn(kn,{children:[d(t),
|
|
18
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:n.type,size:13}),name:i,preview:Si(n),marks:vi(n),onSelect:c,nameSlot:Gr(o,t,r,i),selected:so===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Xo(r)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[ki(o,t,i),xi(n,o,t),bi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */bn(we,{children:Cl(n,2)})]},r)}),d(r.length)]})]})},zl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=ll.dragging,d=!Qo(l)&&s?.rung?.nodeId!==i,c={...an(l),index:0},a=s&&!s.rung&&el(s,c)?c:void 0,p=()=>Dr(e,n,!0),{rowProps:u,...f}=ll.row({item:{id:`rung:${l}`,zone:`${i}:${$n}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:$n,index:t},into:a,canDrag:Boolean(xo.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:gi(p)}),h=Dn?null:xo.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
19
|
+
return wn(kn,{children:[n.heading,
|
|
20
|
+
/* @__PURE__ */bn(be,{icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Er===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Xo(l)},actions:h&&h.length>0?/* @__PURE__ */bn(zn,{children:h.map((t,o)=>/* @__PURE__ */bn(Ce,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Dn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Vr(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__ */bn(tn,{size:15}):/* @__PURE__ */bn(ln,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */bn(we,{children:r})]},l)},Bl=(e,n)=>{const t=Oi(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
21
|
+
return bn(zn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Ni(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(tl(c)?.choices.length),p=(e,n)=>a?xl(e,n,()=>ui(e,n),"Add block here"):xl(e,n),u=/* @__PURE__ */wn(zn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=so===String(n.props.id),{collapsible:i,folded:s}=Pi(n,l,Ri(n.type)),d=String(n.props.id),c=Xi(n),a=()=>Mi(t,o,d,e.type),{rowProps:u,...f}=ll.row({item:{id:d,zone:t,index:o,type:n.type},place:{...an(t),index:o}},{"data-node-id":d,onClick:gi(a)});/* @__PURE__ */
|
|
22
|
+
return wn(kn,{children:[0===o&&p(t,0),
|
|
23
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:n.type,size:13}),name:c,preview:Si(n),marks:vi(n),onSelect:a,nameSlot:Gr(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Xo(d)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[ki(t,o,c),xi(n,t,o),bi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */bn(we,{children:Bl(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?zl(e,t.rung,r++,o,u):/* @__PURE__ */bn(kn,{children:u},t.slot??"")})})},Cl=(e,n)=>{const t=zo(Gn?.data,e.type,String(e.props.id)),o=Oi(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
24
|
+
return bn(zn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Ni(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(n,t)=>{const o=n===f&&c&&!c.addBlocked?.(a)?()=>ji(e.props.id,c.slot,c.childType,t,e.type):n===h?()=>ui(n,t):void 0;return xl(n,t,o,n===f&&c?c.addLabel:"Add block here")},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),k=/* @__PURE__ */wn(zn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=so===String(n.props.id),i=Jr(n),l=String(n.props.id),{collapsible:d,folded:c}=Pi(n,s,Ri(n.type)),a=Bi(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...an(p),index:Ar(p).length}:void 0,f=ll.dragging,h=u&&f&&el(f,u)?u:void 0,g=()=>Mi(t,o,l,e.type),{rowProps:y,...k}=ll.row({item:{id:l,zone:t,index:o,type:n.type},place:{...an(t),index:o},into:h,canDrag:!bo(n.type)},{"data-node-id":l,onClick:gi(g)});/* @__PURE__ */
|
|
25
|
+
return wn(kn,{children:[0===o&&m(t,0),
|
|
26
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:n.type,size:13}),name:i,preview:Si(n),marks:vi(n),onSelect:g,nameSlot:Gr(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>Xo(l)}:void 0,actions:bo(n.type)?xi(n,t,o)??void 0:/* @__PURE__ */wn(zn,{children:[ki(t,o,i),xi(n,t,o),bi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */bn(we,{children:Cl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
27
|
+
/* @__PURE__ */bn(I,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>ji(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?zl(e,o.rung,i++,r,k):/* @__PURE__ */bn(kn,{children:k},o.slot??"")})})},Ol=(()=>{if(!Xn||!to)return null;const e=String(Xn.type),n=String(Xn.props.id),t=Co(e,zo(Gn?.data,e,n));if(!t||"footer"===t.source)return null;const o=vr.some(e=>String(e.props?.id)===n),r=Array.isArray(Xn.props[t.slot])?Xn.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Or(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:mi(Xn,o),choices:i,onPick:o=>{t.spec?ji(n,t.slot,o,r.length,e):Ei(`${n}:${t.slot}`,o,r.length)}}})(),$l=io&&io.zone!==le&&!Zi(io.zone)?io.zone:null,Il=!0===Kt.blocksFirst,Nl=$l?tl($l):Il&&io?null:Ol,Pl=Boolean(Qt&&$l)||Il&&Boolean(Nl&&Nl.choices.length>0),Tl=Jt||null!==Pt,Al=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:vt&&!Tl&&vo===e.id,onSelect:()=>gr(e.id)}:e,Rl=[{id:"add",label:at.add.title,icon:/* @__PURE__ */bn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:Jt,onSelect:()=>Jt?fi():pi(null)},...(ko.railLead??[]).map(Al),{id:"sections",label:"Layers",icon:/* @__PURE__ */bn(qe,{}),active:vt&&!Tl&&"sections"===vo,onSelect:()=>gr("sections")},...(ko.railTrail??[]).map(Al)];Nt?Rl.push({id:"media",label:at.railMedia,icon:/* @__PURE__ */bn(Ze,{}),active:vt&&!Jt&&(null!==Pt||"media"===vo),onSelect:()=>gr("media")}):Fn&&Rl.push({id:"media",label:at.railMedia,icon:/* @__PURE__ */bn(Ze,{}),onSelect:yr});const Ml=[...ko.railLead??[],...ko.railTrail??[]].find(e=>"panel"in e&&e.id===vo),jl=Boolean(ct?.foldable)&&!So,El=ct?.label??(Jn?at.pageSections:at.templateSections),Ll=jl&&Qo(In),Dl=/* @__PURE__ */wn(zn,{children:[vr.map((e,n)=>{if(lt(e)||st(e)||tt(e.type))return null;const t=so===String(e.props.id),o=Boolean(e.props._hidden);Ci(e);const r=String(e.props.id),i=ko.hasOwnRows?.(e)??!1,l=Ai(e)||i,s=l&&Qo(r),{rowProps:d,...c}=ll.row({item:{id:r,zone:le,index:n,type:e.type},place:{...an(le),index:n}},{"data-node-id":r,onClick:gi(()=>ii(n))});/* @__PURE__ */
|
|
28
|
+
return wn(kn,{children:[n>0&&wi(n),
|
|
29
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:e.type,size:13}),name:Nr(e),preview:Si(e),marks:vi(e),onSelect:()=>ii(n),nameSlot:Gr(le,n,r,Nr(e)),selected:t,hidden:o,...c,fold:l?{open:!s,label:"section",onToggle:()=>Xo(r)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[ki(le,n,Nr(e)),xi(e,le,n),bi(le,n,e,Nr(e))]}),rowProps:d}),Ai(e)&&!s&&/* @__PURE__ */wn(we,{children:[Cl(e,1),ko.partRows?.(e,bl)]}),i&&!s&&/* @__PURE__ */bn(we,{children:ko.ownRows?.(e,n,bl)})]},String(e.props.id??n))}),!So&&Gi>0&&wi(Gi),ct?.addAtEnd&&!So&&!Dn&&/* @__PURE__ */bn(I,{small:!0,label:at.addSection,blocked:null,onAdd:()=>pi(Gi)})]}),Vl=(e,n,t)=>{const o=String(e.props.id),r=$i(e).length>0||Ii(e)||Boolean(Co(e.type)),i=r&&Qo(o),l="header"===t?at.header:at.footer,s=$o.rowName?$o.rowName(e,"section",l):l;/* @__PURE__ */
|
|
30
|
+
return wn(zn,{children:[
|
|
31
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:t,size:13}),name:s,preview:Si(e),marks:vi(e),onSelect:()=>ii(n),nameSlot:Gr(le,n,o,s),selected:so===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Xo(o)}:void 0,actions:xi(e,le,n)??void 0,rowProps:{"data-node-id":o,onClick:gi(()=>ii(n))}}),r&&!i&&/* @__PURE__ */bn(we,{children:Bl(e,1)})]})};return(ko.wrap??(e=>e))(
|
|
32
|
+
/* @__PURE__ */bn(te,{target:Ht,children:/* @__PURE__ */wn("div",{ref:Wt,className:"sf-editor es-editor",style:We(Fo),onContextMenu:qr.onEditorContextMenu,...m(Ne),children:[
|
|
33
|
+
/* @__PURE__ */wn(Pe,{children:[
|
|
34
|
+
/* @__PURE__ */bn(Te,{items:Rl,ariaLabel:"Left panel views"}),
|
|
35
|
+
/* @__PURE__ */wn(Ae,{children:[
|
|
36
|
+
/* @__PURE__ */bn(Re,{label:"Undo",disabled:Boolean(Dn)||!Qn.hasPast,onClick:()=>Qn.back(),children:/* @__PURE__ */bn(en,{})}),
|
|
37
|
+
/* @__PURE__ */bn(Re,{label:"Redo",disabled:Boolean(Dn)||!Qn.hasFuture,onClick:()=>Qn.forward(),children:/* @__PURE__ */bn(nn,{})}),
|
|
38
|
+
/* @__PURE__ */bn(Me,{}),
|
|
39
|
+
/* @__PURE__ */bn(je,{devices:bt,value:Ot,onChange:$t})]}),
|
|
40
|
+
/* @__PURE__ */wn(Ae,{kind:"right",style:{minWidth:300},children:[
|
|
41
|
+
/* @__PURE__ */bn(Bn,{saveState:Mn,notSaving:Boolean(Dn)||null!=jn,readOnlyReason:Vn,toggle:Wn,onToggle:Ln,onRetry:En}),ko.barLead?.(),
|
|
42
|
+
/* @__PURE__ */bn(Sn,{content:"Refresh the preview (reloads the canvas, keeps your place)",side:"bottom",children:/* @__PURE__ */bn(vn,{variant:"secondary",onClick:()=>{Vt.current=(()=>{const e=Ht?.document;if(!e)return null;const n=vr.findIndex(st),t=n>=0?n:vr.length;let o=null;for(let n=0;n<t;n++){const t=vr[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=Xn?.props?.id??vr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Dt(e=>e+1)},children:"Refresh"})}),ko.barTrail?.(),ko.barMain?ko.barMain():/* @__PURE__ */bn(vn,{variant:"primary",disabled:null!==Vn,onClick:()=>{Rn(Gn.data)},children:at.done})]})]}),
|
|
43
|
+
/* @__PURE__ */bn(z,{}),
|
|
44
|
+
/* @__PURE__ */wn("div",{className:"sf-body",children:[vt?/* @__PURE__ */wn(zn,{children:[
|
|
45
|
+
/* @__PURE__ */bn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":at.leftPanel,children:Jt?/* @__PURE__ */bn(N,{blocks:Nl,blocksOnly:Pl,at:Qt?{label:(e=>{const n=Zi(e.zone);if(n)return at.add.addingTo({name:$o.rowName?mi(n,!0):Or(n.type)});if(e.zone===le){const n=vr[e.index];return n&&!st(n)?at.add.addingBefore({name:mi(n,!0)}):at.add.addingAtEnd}const t=tl(e.zone);return t?at.add.addingTo({name:t.parentName}):at.add.addingHere})(Qt),onClear:()=>Xt(null)}:void 0,onAdd:e=>{const n=io,t=(e,n)=>{Qt&&Xt({zone:e,index:n})};if(n&&"block"!==e.kind&&Zi(n.zone))return hi(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===lo)return void ci(e);const n=ci(e,lo);Qt&&_t(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===lo)return void ai(e,n);const t=ai(e,n,lo);Qt&&_t(t+1)})(e.template.name,zr(e.template.node));if(n&&n.zone!==le){const o=tl(n.zone);if(!o)return;return o.target.spec?ji(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Ei(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Ol?.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:il,siteWide:ko.addPanelRow?.(fi),onClose:fi,onHide:hr,readOnly:Boolean(Dn)}):Pt&&It?
|
|
46
|
+
/* @__PURE__ */bn(A,{panel:It,pick:Pt,onHide:hr}):Ml?Ml.panel({onHide:hr,notify:Zo}):"media"===vo&&It?/* @__PURE__ */bn(A,{panel:It,pick:null,onHide:hr}):/* @__PURE__ */wn(zn,{children:[
|
|
47
|
+
/* @__PURE__ */bn(P,{icon:/* @__PURE__ */bn(qe,{}),title:"Layers",context:pt,actions:Yi.length>0?/* @__PURE__ */bn(Ee,{label:Qi?"Expand all sections":"Collapse all sections",onClick:()=>Ho(e=>{const n=new Set(Yi);return Qi?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Yi])}),children:/* @__PURE__ */bn(Cn,{expand:Qi})}):void 0,onHide:hr}),
|
|
48
|
+
/* @__PURE__ */wn(ze,{className:"sf-tree sf-scroll",children:[
|
|
49
|
+
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:"page",size:13}),name:at.pageSettings,onSelect:kr,selected:!Xn&&to,rowProps:{onClick:gi(kr)}}),Ji&&/* @__PURE__ */wn(zn,{children:[
|
|
50
|
+
/* @__PURE__ */bn(Be,{children:at.header}),wl(Ji)]}),!So&&Un&&/* @__PURE__ */wn(zn,{children:[
|
|
51
|
+
/* @__PURE__ */bn(Be,{children:at.header}),!dt&&/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:"header",size:13}),name:at.header,onSelect:Sr,selected:eo.kind===it?.kind,rowProps:{onClick:gi(Sr)}})]}),!So&&Fi&&Vl(Fi,Hi,"header"),!So&&!jl&&/* @__PURE__ */bn(Be,{children:El}),jl?/* @__PURE__ */wn(zn,{children:[
|
|
52
|
+
/* @__PURE__ */bn(be,{icon:null,name:El,fold:{open:!Ll,label:El,onToggle:()=>Xo(In)}}),!Ll&&/* @__PURE__ */bn(we,{children:Dl})]}):Dl,Un&&/* @__PURE__ */bn(Be,{children:at.footer}),Wi&&Vl(Wi,Vi,"footer"),!So&&!Wi&&Un&&/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(No,{type:"footer",size:13}),name:at.footer,onSelect:yi,rowProps:{onClick:gi(yi),title:"Edit the site footer"}}),Ui&&wl(Ui),ko.treeFoot?.()]})]})}),
|
|
53
|
+
/* @__PURE__ */bn(Le,{side:"left",width:Fo.left,min:Ve,max:De,defaultWidth:k.left,label:at.resizeLeftPanel,onResize:Go})]}):/* @__PURE__ */bn(T,{side:"left",onShow:hr}),
|
|
54
|
+
/* @__PURE__ */wn("div",{ref:er,className:"sf-center sf-scroll","data-sf-canvas-head":ir?"":void 0,style:{overflowX:pr?"auto":"hidden",overflowY:"hidden"},children:[ir&&/* @__PURE__ */bn("div",{ref:lr,className:"sf-canvas-head",children:/* @__PURE__ */bn(ir,{device:Ot})}),
|
|
55
|
+
/* @__PURE__ */bn("div",{className:"sf-frame-scaler",style:ur,children:/* @__PURE__ */bn("div",{className:"sf-frame "+(Ot===Bt?"":`sf-frame--${Ot}`),style:fr,children:/* @__PURE__ */wn("div",{className:"sf-preview-host",children:[
|
|
56
|
+
/* @__PURE__ */bn(ut,{},Lt),
|
|
57
|
+
/* @__PURE__ */bn(Ue,{canvas:Ht,session:il,model:ul,measure:hl,canDrop:gl,onDrop:kl,onPick:vl,onZoneAdd:e=>{const n=sn(e),t=jr(n);t&&Dr(t.node,t.slot,!1),ui(n,0)},zoneAddLabel:at.canvasAddBlock,readOnly:Boolean(Dn),revision:Gn.data}),qt.length>0&&/* @__PURE__ */bn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:qt.map(e=>/* @__PURE__ */wn("button",{type:"button",tabIndex:-1,className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height},onClick:()=>pi(e.index),children:[
|
|
58
|
+
/* @__PURE__ */bn("span",{className:"sf-preview-gap-line"}),
|
|
59
|
+
/* @__PURE__ */wn("span",{className:"sf-preview-gap-pill",children:[
|
|
60
|
+
/* @__PURE__ */bn("span",{className:"sf-preview-gap-plus",children:"+"}),
|
|
61
|
+
/* @__PURE__ */bn("span",{className:"sf-preview-gap-label",children:"Add section"})]})]},e.index))})]})})})]}),xt?/* @__PURE__ */wn(zn,{children:[
|
|
62
|
+
/* @__PURE__ */bn(g,{value:{selectChild:Mi,addChild:ji,childRowName:Jr,blockRowName:Xi},children:/* @__PURE__ */bn(ft,{mode:eo,onOpenWebsiteSettings:ko.openSettings??(()=>{}),onOpenSiteStyles:ko.openStyles,onSelectNode:Ro,onNotify:Zo,onHidePanel:mr,nodeActions:Xn?se(_n,Xn.type):Nn})}),
|
|
63
|
+
/* @__PURE__ */bn(Le,{side:"right",width:Fo.right,min:Ve,max:De,defaultWidth:k.right,label:"Resize settings panel",onResize:Yo})]}):
|
|
64
|
+
/* @__PURE__ */bn(T,{side:"right",onShow:mr})]}),qr.menu]})}))}export{Pn as ScreenChrome};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{routeSharedHostMessage as e}from"./chunk-S4AWJX4Q.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as s}from"./chunk-CLOS6SSX.js";import{useAdminBridge as i}from"./chunk-VPFNZ7TB.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{backendOf as c,setSessionDocumentSite as d}from"./chunk-RSCMJIWS.js";import{useEaselHost as f}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-E2O2MRZR.js";import{useAutosave as g}from"./chunk-BDTITTMW.js";import{canWriteDocument as k,newEaselClientId as v,reloadIfVersionMoved as p,openUnansweredClaim as h,FAIL_OPEN_RETRY_MS as y,CLAIM_FAIL_OPEN_MS as w,holderOf as S}from"./chunk-THWO5YVZ.js";import{useWords as b}from"./chunk-MFIRYGHW.js";import{createContext as I,useContext as P,useState as j,useMemo as R,useCallback as T,useEffect as B,useRef as O}from"react";import{jsx as E}from"react/jsx-runtime";var C={content:[],root:{},zones:{}};var H=I(null);function M(){const e=P(H);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function A({target:I,addressing:P=o,onHostMessage:M,children:A}){const D=P,{homeSlug:F,entryMayBounce:V,entryBounce:L,onSwitch:N,tellsHost:W,adapterFor:Z,migrateRenamedProps:J,describeMissing:X,onLoadFailed:Y}=D,[x,G]=j(I),U=f(),K=l(),Q=R(()=>c(K),[K]),z=R(()=>t(K),[K]),_="template"===x.kind,q="template"===x.kind?x.id:null,$="template"===x.kind?x.pageSlug??F??"":"document"===x.kind?x.slug??"":x.slug,ee="page"===x.kind?x.siteId??null:null,re=K.blocks,ne=R(()=>Z(x,Q,re),[Z,Q,re,x.kind,"template"===x.kind?x.id:"document"===x.kind?x.record:x.siteId]),te=ne.capabilities,oe=T(e=>K.documentHooks?.stored?.(e)??e,[K]),ue="page"===x.kind?x.originSlug??null:null;B(()=>{d(K,ee)},[K,ee]);const ae=O(x);B(()=>{ae.current=x},[x]);const{token:se,tokenRef:ie,capabilities:le}=i({onMessage:r=>{if(M?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Pr(e.target)}}}),ce=!K.usesBridgedToken||null!==se,de=ne.lock,fe=Boolean(Q.lock),[me,ge]=j(null),[ke,ve]=j(null),[pe,he]=j(null),[ye,we]=j(null),Se=b("screen",m),be=ye?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(ye,Se):null,[Ie,Pe]=j(null),je=O(null),Re=O(null),[Te,Be]=j(!1),Oe=O(null),[Ee,Ce]=j(null),He=O(null),[Me,Ae]=j(null),De=O(null);B(()=>{De.current=Me},[Me]);const[Fe,Ve]=j(te.hasEditLock?{kind:"checking"}:{kind:"editing"}),Le=O(Fe);B(()=>{Le.current=Fe},[Fe]);const Ne=O(()=>Promise.resolve(!1)),We=T(e=>{Re.current=e,Be(!0)},[]),Ze=g({save:async({id:e,data:r})=>{if(k(Le.current)){if(!await Ne.current(e,r)){if(!k(Le.current))return void We({id:e,data:r});throw new Error("page save did not land")}}else We({id:e,data:r})},onFailure:(e,r)=>{0===r&&U.send("storefront-editor:save-failed")}}),{state:Je,push:Xe,flush:Ye,pause:xe,resume:Ge,stop:Ue,reset:Ke,retryNow:Qe,hasPending:ze}=Ze,_e=O(Je);B(()=>{_e.current=Je},[Je]);const qe=u(Je),$e=T(()=>{const e=Re.current;e&&(Re.current=null,Be(!1),Xe(e))},[Xe]),er=O("");er.current||(er.current=v());const[rr,nr]=j(0),tr=O(!1),[or,ur]=j(V(I)),ar=O(!1);B(()=>{if(ar.current)return;ar.current=!0;const e=U.address.search(),r=L(I,e);r?U.address.load(r):V(I)&&ur(!1)},[I,U]);const sr=U.send;B(()=>{if(!ce)return;let e=!1;const t=ae.current,o=ne.resolve($),u=K.documentHooks?.opening?.({slug:$,isTemplate:_,capabilities:te});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==F&&$!==F?void U.address.load({kind:"page",slug:F,siteId:ee??void 0}):(we({target:t,slug:$,missing:!0,sentence:X?.(t)??null}),void Y?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;je.current=n,Pe(n),ge(r.id),ve(r.kind??null),He.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:C,s=J(a),i=u?await u(s):s;e||he(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),we({target:t,slug:$,missing:!1,sentence:n(o,{slug:$},K),cause:r(o,K)}),Y?.(t,o))}),()=>{e=!0}},[ce,se,_,ne,$]);const ir=T(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=ie.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),lr=T(async e=>{const r=ie.current;if(!r&&K.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,K)){sr("storefront-editor:auth-expired");const n=r?await ir(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[sr,ir,K]),cr=T(async e=>{const r=ie.current?await lr(e):{ok:!1};return r.ok||sr("storefront-editor:save-failed"),r.ok},[sr,lr]),dr=T(async(e,r,n=!1)=>{if(null!==je.current)return!1;if(!k(Le.current))return!1;if(De.current)return!1;const t=await lr(()=>ne.saveLayout(e,r,He.current,er.current));if(t.ok)return He.current=t.value.version??He.current,!0;const o=z.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Le.current=e,Ve(e),!1}const u=z.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&ne.rereadVersion){const n=await lr(()=>ne.rereadVersion(e));if(n.ok&&n.value)return He.current=n.value,Ne.current(e,r,!0)}Ue(),De.current=u,Ae(u)}return!1},[ne,lr,Ue]);B(()=>{Ne.current=dr},[dr]);const fr=T(e=>{if(null!==je.current)return;if(sr("storefront-editor:dirty"),!me)return;const r=oe(e);Oe.current=r,k(Le.current)?Xe({id:me,data:r}):We({id:me,data:r})},[me,sr,We,Xe,oe]),mr=T(async()=>{k(Le.current)&&$e();return await Ye()&&null==Re.current},[$e,Ye]),gr=O(mr);B(()=>{gr.current=mr},[mr]);const kr=O(lr);B(()=>{kr.current=lr},[lr]);const vr=T(()=>{U.address.reload()},[U]),pr=O(()=>Promise.resolve(!1));B(()=>{pr.current=()=>{const e=ne.rereadVersion;return me&&e?p({ours:He.current,stored:async()=>{const r=await kr.current(()=>e(me));return r.ok?r.value:null},hasPending:()=>null!=Re.current||ze(),reload:vr}):Promise.resolve(!1)}},[ne,me,ze,vr]);const hr=null!==Ie;B(()=>{if(!de||!me||!ce||hr)return;let e=!1,r=null,n=null;const t=er.current,o={claim:async e=>{const r=await kr.current(()=>de.claim(me,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Le.current,heldWrite:()=>({pending:null!=Re.current||ze(),autoSaveEnabled:!_e.current.paused,saveConflict:null!=De.current}),setAccess:e=>{Le.current=e,Ve(e)},releaseHeldWrite:()=>{gr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{pr.current()}},u=z.makeClaimBeat(o),a=tr.current;return tr.current=!1,a||(Ve({kind:"checking"}),n=setTimeout(()=>{n=null,h(o)&&o.startHeartbeat(y)},w)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),de.release(me,t).catch(()=>{})}},[me,de,ce,se,rr,hr]);const yr=T(()=>{de&&me&&(tr.current=!0,nr(e=>e+1))},[me,de]),wr=T(()=>{Ve(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Sr=T(()=>{_e.current.paused?(k(Le.current)&&$e(),Ge()):xe()},[$e,xe,Ge]),br=T(()=>{Qe()},[Qe]),Ir=T(e=>{Oe.current=null,a("template"!==e.kind&&fe,{resetAutosave:()=>{Ke(),Re.current=null,Be(!1)},setVersion:e=>{He.current=e},setSaveConflict:Ae,setAccess:Ve}),N(e),G(e),je.current=null,Pe(null),ge(null),ve(null),he(null),we(null),U.address.show(e),"document"!==e.kind&&W(e)&&U.send("storefront-editor:navigated",{target:e})},[Ke,U,fe,N,W]),Pr=T(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,ae.current,F))return;const r=null!=Re.current;if(!r&&!ze())return void Ir(e);const n=_e.current;r||n.paused||n.failed||n.stopped?Ce(e):Ye().then(r=>{r?Ir(e):Ce(e)})},[Ir,ze,Ye,F]),jr=T(()=>Ce(null),[]),Rr=T(()=>{Ce(e=>(e&&Ir(e),null))},[Ir]),Tr=T(async()=>{const e=Ee;if(!e)return;await mr()&&(Ce(null),Ir(e))},[Ee,mr,Ir]),Br=T(async e=>{if(null!==je.current)return;if(!me)return;if(!k(Le.current)||De.current)return;const r=oe(e);if(!await dr(me,r))return void(De.current||sr("storefront-editor:save-failed"));const n=ne.publish;if(!te.canPublish||!n)return void sr("storefront-editor:saved");const t=await lr(()=>n(me,He.current??void 0));t.ok?(He.current=t.value.version??He.current,sr("storefront-editor:published")):sr("storefront-editor:save-failed")},[me,ne,te.canPublish,sr,dr,lr,oe]);/* @__PURE__ */
|
|
2
|
+
return E(H.Provider,{value:{target:x,adapter:ne,capabilities:te,templateId:q,currentSlug:$,currentKind:ke,siteId:ee,ready:ce,token:se,tokenRef:ie,notifyParent:sr,bridgeCapabilities:le,runAuthed:cr,docId:me,data:pe,getLiveData:()=>Oe.current??pe,footerOriginSlug:ue,error:be,redirecting:or,saveStatus:qe,saveState:Je,autoSaveEnabled:!Je.paused,autoSaveStoppedByConflict:Je.stopped,hasUnsavedEdits:Je.pending||Te,toggleAutoSave:Sr,retrySave:br,onChange:fr,flushSave:mr,onPublish:Br,access:Fe,readOnly:null!==S(Fe)||null!==Ie||null!==Me,readOnlyReason:Ie,takeOverEditing:yr,viewReadOnly:wr,saveConflict:Me,reloadFromServer:vr,navigate:Pr,pendingNav:Ee,cancelPendingNav:jr,discardAndNavigate:Rr,saveAndNavigate:Tr},children:A})}export{H as ScreenDocumentContext,A as ScreenDocumentProvider,M as useScreenDocument};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_PANEL_W as s,clampPanelWidth as e}from"./chunk-
|
|
1
|
+
import{DEFAULT_PANEL_W as s,clampPanelWidth as e}from"./chunk-TJ7YIRWQ.js";var a="sf-editor-panel-widths",l="sf-editor-collapsed-sections";function t(s){return s?{panelWidths:`${s}-panel-widths`,collapsed:`${s}-collapsed-sections`}:{panelWidths:a,collapsed:l}}var o={...s},d=s=>e(s);export{l as COLLAPSED_SECTIONS_KEY,o as DEFAULT_PANEL_W,a as PANEL_WIDTHS_KEY,d as clampPanelWidth,t as screenStorageKeys};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Tooltip as e}from"efficient-shell/ui";import{jsx as i}from"react/jsx-runtime";function r(r,t,n){return null==r||!1===r||""===r?t:/* @__PURE__ */i(e,{content:r,side:n,children:t},t.key??void 0)}export{r as withTip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as o,bindUndoKeys as t}from"./chunk-
|
|
1
|
+
import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as o,bindUndoKeys as t}from"./chunk-PYCLHOSA.js";import{useState as e,useEffect as u}from"react";function r(o){const t=n(),[r,c]=e(null);return u(()=>c(o.current),[o]),t.ownsDocument?"undefined"==typeof document?null:document:r}function c(e,c){const m=n(),i=o(),f=r(e);u(()=>{if(!m.ownsDocument&&f)return t(f,i,{leaveTyping:!0})},[m,i,f]);const s=c?.document??null;u(()=>{if(!m.ownsDocument&&s)return t(s,i,{leaveTyping:!0})},[m,i,s])}function m(n){return n.ownsDocument?{}:{tabIndex:-1}}export{m as editorRootFocus,r as useEaselKeyTarget,c as useEaselUndoKeys};
|