efficient-easel 16.1.0 → 17.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -64
- package/dist/autosave/index.d.ts +4 -4
- package/dist/blocks/index.d.ts +2 -2
- package/dist/chrome/index.d.ts +3 -3
- package/dist/chrome/index.js +1 -1
- package/dist/{chunk-UVQR7W6I.js → chunk-3ERZNZ5S.js} +1 -1
- package/dist/{chunk-2H3W5OLQ.js → chunk-4UBYPRAS.js} +1 -1
- package/dist/{chunk-ATOXCKEE.js → chunk-7TOQCTHV.js} +3 -3
- package/dist/chunk-BU2YSTLJ.js +14 -0
- package/dist/{chunk-VVPZMWJE.js → chunk-EL4F3IN7.js} +1 -1
- package/dist/chunk-EXCIHRAE.js +4 -0
- package/dist/{chunk-HV56SLR2.js → chunk-FJL3MYPA.js} +1 -1
- package/dist/{chunk-IE55HNMA.js → chunk-GWIVPLOX.js} +11 -11
- package/dist/chunk-INIPQLPR.js +1 -0
- package/dist/{chunk-RFSLDGDA.js → chunk-JSH3XKEF.js} +1 -1
- package/dist/chunk-M2Z775ZC.js +1 -0
- package/dist/chunk-MI54XTWD.js +5 -0
- package/dist/chunk-MTNBJPXX.js +2 -0
- package/dist/{chunk-K6EM4F5N.js → chunk-N3LYD2LK.js} +11 -11
- package/dist/{chunk-V6VKM2QX.js → chunk-NFLO4I2N.js} +1 -1
- package/dist/chunk-OLRLHE5K.js +7 -0
- package/dist/chunk-SHS6WCLL.js +1 -0
- package/dist/chunk-SPQOPWCL.js +5 -0
- package/dist/{chunk-TZIIRGVY.js → chunk-U277UX5I.js} +1 -1
- package/dist/{chunk-GPLMNRHR.js → chunk-V63ERBLW.js} +1 -1
- package/dist/chunk-WR3EVON3.js +57 -0
- package/dist/{chunk-62VPYC7F.js → chunk-XDZHKYQX.js} +1 -1
- package/dist/chunk-XLUVTPKK.js +1 -0
- package/dist/{chunk-2L2L7G5L.js → chunk-Z72CYM3L.js} +1 -1
- package/dist/copy/index.js +23 -11
- package/dist/draw/client.js +1 -1
- package/dist/draw/index.js +1 -1
- package/dist/easel/index.d.ts +35 -6
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/gold/gold.css +1 -1
- package/dist/{host-DGmdCaNL.d.ts → host-Cxbhp0zg.d.ts} +0 -4
- package/dist/icons/index.d.ts +0 -2
- package/dist/node-ops/index.d.ts +2 -2
- package/dist/node-ops/index.js +1 -1
- package/dist/panel/index.js +1 -1
- package/dist/{plan-CGREINRO.d.ts → plan-2BLk7pWs.d.ts} +19 -1
- package/dist/rail/index.d.ts +2 -2
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.d.ts +3 -3
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +6 -6
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +5 -5
- package/dist/screen/components/SaveControls.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +3 -3
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +5 -5
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +5 -5
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +5 -5
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +5 -5
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +2 -2
- package/dist/screen/lib/document-addressing.d.ts +3 -3
- package/dist/screen/lib/document-hooks.d.ts +2 -2
- package/dist/screen/lib/host-chrome.d.ts +0 -10
- package/dist/screen/lib/host.d.ts +3 -3
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +3 -3
- package/dist/screen/lib/media-picker.d.ts +3 -3
- package/dist/screen/lib/page-lock.d.ts +2 -2
- package/dist/screen/lib/puck/block-choice.d.ts +13 -1
- package/dist/screen/lib/puck/block-choice.js +1 -1
- package/dist/screen/lib/puck/device-fields.js +1 -1
- package/dist/screen/lib/puck/palette-sections.d.ts +2 -2
- package/dist/screen/lib/puck/section-doc.d.ts +2 -2
- package/dist/screen/lib/puck/style-clipboard.d.ts +5 -5
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.d.ts +2 -2
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/save-status.d.ts +2 -2
- package/dist/screen/lib/screen-parts.d.ts +5 -27
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-templates.d.ts +2 -2
- package/dist/screen/lib/session-context.d.ts +2 -2
- package/dist/screen/lib/session.d.ts +2 -2
- package/dist/screen/words.d.ts +0 -2
- package/dist/screen/words.js +1 -1
- package/dist/shell/shell.css +6 -1
- package/dist/strings/index.d.ts +134 -20
- package/dist/strings/index.js +2 -2
- package/dist/text-styles/index.js +26 -26
- package/dist/{types-CsgMwHHa.d.ts → types-Cy7rdmXt.d.ts} +1 -1
- package/dist/{types-DGyDHiJV.d.ts → types-DT8ywrFQ.d.ts} +1 -1
- package/dist/{types-NQozKWEz.d.ts → types-kR_4wYBw.d.ts} +1 -1
- package/dist/{useNodeOps-BHRkUFfG.d.ts → useNodeOps-B0XZ8Bl8.d.ts} +1 -1
- package/dist/{words-pgIK0I6g.d.ts → words-DkWcK1rh.d.ts} +2 -2
- package/package.json +2 -41
- package/dist/chunk-44COUKXO.js +0 -5
- package/dist/chunk-4BGYVIDQ.js +0 -57
- package/dist/chunk-ECM5F6JJ.js +0 -1
- package/dist/chunk-H4UMY7QF.js +0 -13
- package/dist/chunk-HMXIAMCU.js +0 -1
- package/dist/chunk-HQ4VVRIC.js +0 -1
- package/dist/chunk-IN22IYOM.js +0 -1
- package/dist/chunk-JQOYUH4A.js +0 -7
- package/dist/chunk-L2VGRQ4R.js +0 -4
- package/dist/chunk-L3GSW4XI.js +0 -1
- package/dist/chunk-QX7GVECM.js +0 -13
- package/dist/chunk-U25CP5VX.js +0 -5
- package/dist/chunk-XQGV2XAK.js +0 -1
- package/dist/chunk-ZZ64CEC2.js +0 -2
- package/dist/gold/index.d.ts +0 -283
- package/dist/gold/index.js +0 -1
- package/dist/icons/meanings.d.ts +0 -1
- package/dist/icons/meanings.js +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -1
- package/dist/markup/index.d.ts +0 -1
- package/dist/markup/index.js +0 -1
- package/dist/shell/index.d.ts +0 -195
- package/dist/shell/index.js +0 -1
- package/dist/strings/catalogue.d.ts +0 -139
- package/dist/strings/catalogue.js +0 -1
package/README.md
CHANGED
|
@@ -185,50 +185,12 @@ reuses `--es-rail-pad-y` rotated onto the row's ends and `--es-rail-gap` as-is.
|
|
|
185
185
|
|
|
186
186
|
## The gold layer — type in place
|
|
187
187
|
|
|
188
|
-
`GoldTextInput`
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
It is **controlled and writes nothing** — no document, no sections, no Puck. The
|
|
196
|
-
host owns the string and decides what a finished edit means.
|
|
197
|
-
|
|
198
|
-
```tsx
|
|
199
|
-
'use client';
|
|
200
|
-
import { GoldTextInput } from 'efficient-easel/gold';
|
|
201
|
-
import { STOREFRONT_MARKUP } from 'efficient-shell/markup';
|
|
202
|
-
import 'efficient-easel/gold.css'; // once, from a client/global entry
|
|
203
|
-
|
|
204
|
-
<GoldTextInput
|
|
205
|
-
value={draft}
|
|
206
|
-
rules={STOREFRONT_MARKUP}
|
|
207
|
-
placeholder="Add a heading"
|
|
208
|
-
ariaLabel="Section heading"
|
|
209
|
-
onInput={setDraft}
|
|
210
|
-
onCommit={(value) => save(value)} // blur, or Enter on a single-line field
|
|
211
|
-
onCancel={(restored) => setDraft(restored)}
|
|
212
|
-
/>;
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
| prop | type | default | notes |
|
|
216
|
-
|---|---|---|---|
|
|
217
|
-
| `value` | `string` | — | the authored string, delimiters and all |
|
|
218
|
-
| `onInput` | `(value: string) => void` | — | every keystroke; the layer repaints from what you send back |
|
|
219
|
-
| `onCommit` | `(value: string) => void` | — | blur, or Enter when `multiline` is false. Once per session, never if nothing was typed |
|
|
220
|
-
| `onCancel` | `(restored: string) => void` | — | Escape. The argument is the value held at focus time; the host puts it back |
|
|
221
|
-
| `multiline` | `boolean` | `false` | what Enter means, **not** how the text wraps — both modes wrap |
|
|
222
|
-
| `placeholder` | `string` | — | visible until the first keystroke |
|
|
223
|
-
| `className` | `string` | — | merged onto `.es-gold` |
|
|
224
|
-
| `rules` | `readonly InlineRule[]` | `STANDARD_MARKUP` | pass your product's set — `STOREFRONT_MARKUP` / `CAMPAIGN_MARKUP` |
|
|
225
|
-
| `ariaLabel` | `string` | — | in-place editing has no visible label |
|
|
226
|
-
|
|
227
|
-
**There is one grammar, and it is the shell's.** Runs are parsed by
|
|
228
|
-
`efficient-shell/markup` (decision D1, 2026-10-12). The published page and the
|
|
229
|
-
campaign email render from the same module, so a toolbar button, a page and
|
|
230
|
-
this box can never disagree about what a delimiter means. It is framework-free
|
|
231
|
-
and imports nothing. See [the text grammar](#the-text-grammar--efficient-easelmarkup-deprecated) below.
|
|
188
|
+
`GoldTextInput` is the surface a merchant types INTO on the page, with the
|
|
189
|
+
markup formatting appearing as they type: a textarea whose own text is
|
|
190
|
+
transparent sits on top of a layer holding the same characters, painted. Hosts
|
|
191
|
+
reach it through the copy box (`efficient-easel/copy`). Its own subpath,
|
|
192
|
+
`efficient-easel/gold`, was removed in 17.0.0, with no host importing it; the
|
|
193
|
+
stylesheet `efficient-easel/gold.css` stays, and the copy box needs it.
|
|
232
194
|
|
|
233
195
|
**Two deliberate limits.** The asterisks are FADED, never removed. They go to
|
|
234
196
|
nothing while the box is unfocused, so a merchant who is not typing does not read
|
|
@@ -241,23 +203,14 @@ earlier than the transparent box on top of it and every following line would be
|
|
|
241
203
|
drawn over the wrong text. The real weight and slant appear on the page the
|
|
242
204
|
moment the merchant clicks away.
|
|
243
205
|
|
|
244
|
-
## The text grammar — `efficient-
|
|
245
|
-
|
|
246
|
-
**Import `efficient-shell/markup`.** The one grammar for copy a merchant types,
|
|
247
|
-
in both editors, on the page and in the email, is efficient-shell's
|
|
248
|
-
(decision D1, Lewis 2026-10-12). Its marks, exports and rules are documented
|
|
249
|
-
in efficient-shell's README, "Editorial markup — `efficient-shell/markup`";
|
|
250
|
-
they are not repeated here.
|
|
251
|
-
|
|
252
|
-
`efficient-easel/markup` still resolves, so a host that imports it keeps
|
|
253
|
-
working, but it is only `export * from 'efficient-shell/markup'`: it has no
|
|
254
|
-
code of its own, and it is `@deprecated`. Easel's own copy (1,498 lines, held
|
|
255
|
-
here from 2026-09-28) was deleted on 2026-10-17. Framework-free: no React, no
|
|
256
|
-
DOM, no other import.
|
|
206
|
+
## The text grammar — `efficient-shell/markup`
|
|
257
207
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
208
|
+
The one grammar for copy a merchant types, in both editors, on the page and in
|
|
209
|
+
the email, is efficient-shell's (decision D1, Lewis 2026-10-12). Its marks,
|
|
210
|
+
exports and rules are documented in efficient-shell's README, "Editorial
|
|
211
|
+
markup — `efficient-shell/markup`". Easel keeps no copy: its own (1,498 lines)
|
|
212
|
+
was deleted on 2026-10-17, and the deprecated re-export `efficient-easel/markup`
|
|
213
|
+
in 17.0.0. Import `efficient-shell/markup`.
|
|
261
214
|
|
|
262
215
|
## The edit lock — two operators, one document
|
|
263
216
|
|
|
@@ -777,6 +730,12 @@ top-level block down to a node, by id) and `nextInChain` (what a click on that
|
|
|
777
730
|
chain picks, given the selection), for a host that adds rungs of its own.
|
|
778
731
|
Both take a `passThrough` (8.2.0): nodes a click walks past, no step of the
|
|
779
732
|
chain; the canvas reads it from `CanvasPassThroughContext` or its own prop.
|
|
733
|
+
A host's PARTS join the chain (W0): through `CanvasPartsContext` (a
|
|
734
|
+
`CanvasParts`: `partAt(target, ownerId)`, `selected()`, `select(partId)`) a
|
|
735
|
+
host says which part of the innermost block is under the pointer, and
|
|
736
|
+
`clickPickPart` puts it after its block: a container's part is one more rung, a
|
|
737
|
+
block with no lists is picked with its part at once. The hover outline draws
|
|
738
|
+
the part (`is-hover-part`); Escape lets a part go before it climbs.
|
|
780
739
|
|
|
781
740
|
## Autosave — `efficient-easel/autosave`
|
|
782
741
|
|
|
@@ -1372,10 +1331,10 @@ const german: DeepPartial<EaselStrings> = {
|
|
|
1372
1331
|
- **`useEaselLocale()`** is the provider's `locale` (`'en'` with none), for a
|
|
1373
1332
|
host's own blocks and fields. The engine does not read it.
|
|
1374
1333
|
- **A server file may import it.** Importing the entry runs nothing — the React
|
|
1375
|
-
context is made on first use
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1334
|
+
context is made on first use — so a host's own test imports
|
|
1335
|
+
`DEFAULT_EASEL_STRINGS` from here to check its languages against the engine's
|
|
1336
|
+
keys. (The separate `efficient-easel/strings/catalogue` subpath was removed
|
|
1337
|
+
in 17.0.0, with no host importing it.)
|
|
1379
1338
|
|
|
1380
1339
|
- **The assembled screen hands its own leaves their words** (3.1.0). Under
|
|
1381
1340
|
`EaselStringsProvider`, `efficient-easel/screen` draws every word of its own
|
package/dist/autosave/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as Autosave, A as AutosaveSnapshot, b as AutosaveOptions } from '../engine-CvXpFE86.js';
|
|
2
2
|
export { c as AutosaveClock, d as createAutosave } from '../engine-CvXpFE86.js';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import '../types-
|
|
6
|
-
import '../types-
|
|
3
|
+
import { S as SaveIndicator } from '../words-DkWcK1rh.js';
|
|
4
|
+
export { a as SaveWords, s as saveIndicator } from '../words-DkWcK1rh.js';
|
|
5
|
+
import '../types-DT8ywrFQ.js';
|
|
6
|
+
import '../types-Cy7rdmXt.js';
|
|
7
7
|
import '../wordFit-7XpmhcaW.js';
|
|
8
8
|
import 'react';
|
|
9
9
|
import '../edit-lock/index.js';
|
package/dist/blocks/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactElement, FC, CSSProperties, ReactNode, JSX } from 'react';
|
|
2
|
-
import { P as Permissions, A as AppState } from '../types-
|
|
2
|
+
import { P as Permissions, A as AppState } from '../types-kR_4wYBw.js';
|
|
3
3
|
import '../data/index.js';
|
|
4
4
|
import '../types-41704JE4.js';
|
|
5
5
|
import '../resolve-D68pb3Bx.js';
|
|
6
|
-
import '../plan-
|
|
6
|
+
import '../plan-2BLk7pWs.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* efficient-easel/blocks — how a block is WRITTEN: its config, its fields, the
|
package/dist/chrome/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { T as TopBarProps, b as TopBarClusterProps, c as TopBarRailProps, E as EaselIconButtonProps, d as DeviceSwitchProps, e as SaveStateProps, f as SaveStateToggleProps, g as SaveIconProps, a as SaveIconState, h as SaveIconTone, P as PanelResizeHandleProps, I as InspectorHeadProps, i as InspectorIconButtonProps, j as InspectorUpLevelProps, M as MediaPanelHeadProps, k as MediaPickKind, l as EditNoticeProps } from '../types-
|
|
3
|
-
export { D as DeviceOption, R as RailWordsShown, S as SaveTone } from '../types-
|
|
2
|
+
import { T as TopBarProps, b as TopBarClusterProps, c as TopBarRailProps, E as EaselIconButtonProps, d as DeviceSwitchProps, e as SaveStateProps, f as SaveStateToggleProps, g as SaveIconProps, a as SaveIconState, h as SaveIconTone, P as PanelResizeHandleProps, I as InspectorHeadProps, i as InspectorIconButtonProps, j as InspectorUpLevelProps, M as MediaPanelHeadProps, k as MediaPickKind, l as EditNoticeProps } from '../types-DT8ywrFQ.js';
|
|
3
|
+
export { D as DeviceOption, R as RailWordsShown, S as SaveTone } from '../types-DT8ywrFQ.js';
|
|
4
4
|
import { C as ChromeWords, N as NoticeWords } from '../words-BpiVrsW5.js';
|
|
5
5
|
import { LockWords, EditAccess, SaveConflict } from '../edit-lock/index.js';
|
|
6
6
|
export { D as DEFAULT_PANEL_W, M as MAX_PANEL_W, a as MIN_PANEL_W, P as PanelSide, b as PanelWidths, c as clampPanelWidth, p as panelWidthVars, s as setPanelWidthVars } from '../panelWidths-D9hTLR25.js';
|
|
7
|
-
import '../types-
|
|
7
|
+
import '../types-Cy7rdmXt.js';
|
|
8
8
|
import '../wordFit-7XpmhcaW.js';
|
|
9
9
|
|
|
10
10
|
/**
|
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,SaveIcon,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,headWords,mediaPickKind,panelWidthVars,saveIconTone,setPanelWidthVars}from"../chunk-
|
|
1
|
+
export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MediaPanelHead,PanelResizeHandle,SaveIcon,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,headWords,mediaPickKind,panelWidthVars,saveIconTone,setPanelWidthVars}from"../chunk-GWIVPLOX.js";import"../chunk-MJM6SFD3.js";import"../chunk-Z6PVRXVY.js";import"../chunk-2OAZYSWJ.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MFIRYGHW.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselSession as e}from"./chunk-O7Q4DDJT.js";import{useHostEscape as n}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-
|
|
1
|
+
import{useEaselSession as e}from"./chunk-O7Q4DDJT.js";import{useHostEscape as n}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-EL4F3IN7.js";import{styleMenuItems as o}from"./chunk-V7U33NF2.js";import{ROOT_ZONE as l}from"./chunk-PLVEGYK6.js";import{easelMenuEntries as r,menuLabel as i}from"./chunk-BALFHI3G.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-X4T6JT3M.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-KRXQM65X.js";import{useState as y,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as z,LayersIcon as O,CopyIcon as P}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function D(e,n){const t=[],o=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===l)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var K=c(),j=/* @__PURE__ */new WeakMap;function M(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=j.get(n);return t||(t=c(),j.set(n,t)),t}function S(){return M(e())}function T(e,n,t){if(n===l){const{floor:n,cap:o}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function X(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function L(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?T(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=T(e,l.zone,l.index+1);if(o(n,t))return t}return null}function E(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(u(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function I(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=X(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:L(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function R(e,n){const{zone:t,index:r}=n,i=e.nodeAt(t,r);if(!i)return[];const c=i.props.id,a=e.labelOf(i.type,t),u=Boolean(i.props._hidden),d=e.nodeOps,p=e.isPinned(i,t),f=e.isLocked(i),m=!p&&!f&&!e.duplicateBlocked(i),h=e.permits?.(i)??{duplicate:!0,delete:!0},y=X(e,i,t),k=D(e,n),b=d.held,v=b&&!p?L(e,b,n):null,g=!e.readOnly,w=e.style?o({held:g?e.style.held():null,canCopy:e.style.canCopy(i,t),onCopy:()=>e.style?.copy(i,t),onPaste:()=>e.style?.paste(t,r,i),words:e.words?.styleClipboard}):[];return s({title:a,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},r=n.zone===l?null:e.slotRung?.(n.zone)??null;return r?[o,{label:r.label,checked:!1,onClick:r.select}]:[o]})},actions:{duplicate:g&&m&&h.duplicate?()=>d.duplicate(c):void 0,moveUp:g&&d.canStep(c,-1)?()=>d.step(c,-1):void 0,moveDown:g&&d.canStep(c,1)?()=>d.step(c,1):void 0,copy:y.copy?()=>d.copy(c,a):void 0,cut:g&&y.cut?()=>d.cut(c,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&e.renamePropOf(i,t)?()=>e.beginRename(t,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:e.menuRows?.(i,t,r)??void 0,pinnedLine:p?B(e).pinned:void 0})}var B=e=>e.words?.screen??t.menu;function F(e){const n=B(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=T(e,l,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===l)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??t.pageSettings,icon:/* @__PURE__ */A(z,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */A(O,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function N(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??a,c=B(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function U(e){return e.shiftKey}function V(e,t){const[o,l]=y(null),r=k(()=>l(null),[]);n(null!==o,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=E(e);if(!o)return;const l=t.selected();if(!l)return;const r=I(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(t,"keydown",c);const a=k(n=>{if(U(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(t,"contextmenu",n=>{if(U(n)||!t)return;const o=n.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;n.preventDefault();const c=p(t.frame,n.clientX,n.clientY),s=t.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(t,"mousedown",r),d(t,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:o?/* @__PURE__ */A(Y,{host:e,target:o,onClose:r}):null,closeMenu:r}}function Y({host:e,target:n,onClose:t}){const o="node"===n.kind?R(e,n):"input"===n.kind?N(e,n.el):F(e);return 0===o.length?null:/* @__PURE__ */A(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),items:r(o)})}export{K as EASEL_NODE_CLIPBOARD,D as ancestorChain,M as nodeClipboardOf,X as nodeClipboardRules,R as nodeMenuItems,E as nodeShortcut,F as pageMenuItems,L as pastePlace,I as runNodeShortcut,N as textMenuItems,S as useNodeClipboard,V as useNodeContextMenu};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenDocument as n}from"./chunk-
|
|
1
|
+
import{useScreenDocument as n}from"./chunk-MTNBJPXX.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-EL4F3IN7.js";import{EditNotice as r}from"./chunk-GWIVPLOX.js";import{useWords as e}from"./chunk-MFIRYGHW.js";import{jsx as i}from"react/jsx-runtime";function t(){const{capabilities:t,access:c,takeOverEditing:a,viewReadOnly:s,saveConflict:m,reloadFromServer:u}=n(),{noun:l}=e("screen",o);return t.hasEditGuard?/* @__PURE__ */i(r,{access:c,conflict:m,noun:l,onTakeOver:a,onViewReadOnly:s,onReload:u}):null}export{t as PageEditGuardNotices};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-
|
|
1
|
+
import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-GWIVPLOX.js";import{SplitButton as l,Kbd as i,CMD_S as n}from"efficient-shell/ui";import{CloudIcon as s,CheckIcon as o}from"efficient-shell/icons/efficient";import{jsx as r,jsxs as d}from"react/jsx-runtime";var c=e=>e.state.failed&&null!=e.state.retryAt||null!=e.state.savedAt;function u({input:l,words:i}){const n=e(c(l)),s=t({...l,now:n},i);/* @__PURE__ */
|
|
2
2
|
return r(a,{state:s.state,label:s.label})}function m({input:a,action:u,readOnly:m,saveSwitch:y,onToggleAutoSave:b,onSaveNow:p,bar:v,words:f}){const k=e(c(a)),h=t({...a,now:k},f),w=h.retry?v.retry:v.saveNow,g=/* @__PURE__ */d("span",{className:"es-savemenu-row",children:[w,
|
|
3
|
-
/* @__PURE__ */r("span",{"aria-hidden":"true",children:/* @__PURE__ */r(i,{keys:n,size:"sm"})})]}),S=[{type:"status",key:"status",label:h.line(u.status)},...(u.goingLive??[]).map((e,t)=>({type:"status",key:`going-live-${t}`,label:e})),{type:"divider",key:"divider"},...y?[{type:"checkbox",key:"auto-save",label:v.autoSave,checked:!a.state.paused,disabled:m,onSelect:b}]:[],{key:"save-now",label:g,icon:/* @__PURE__ */r(s,{}),disabled:m,onSelect:p},...u.menuItems?.length?[{type:"divider",key:"layer-divider"},...u.menuItems.map(e=>({key:`layer-${e.key}`,label:e.label,icon:e.icon,disabled:e.disabled,onSelect:e.onSelect}))]:[]],
|
|
4
|
-
return r(l,{variant:
|
|
3
|
+
/* @__PURE__ */r("span",{"aria-hidden":"true",children:/* @__PURE__ */r(i,{keys:n,size:"sm"})})]}),S=[{type:"status",key:"status",label:h.line(u.status)},...(u.goingLive??[]).map((e,t)=>({type:"status",key:`going-live-${t}`,label:e})),{type:"divider",key:"divider"},...y?[{type:"checkbox",key:"auto-save",label:v.autoSave,checked:!a.state.paused,disabled:m,onSelect:b}]:[],{key:"save-now",label:g,icon:/* @__PURE__ */r(s,{}),disabled:m,onSelect:p},...u.menuItems?.length?[{type:"divider",key:"layer-divider"},...u.menuItems.map(e=>({key:`layer-${e.key}`,label:e.label,icon:e.icon,disabled:e.disabled,onSelect:e.onSelect}))]:[]],I=u.quiet??null,L=h.blocked??u.disabledReason??I?.reason??null;/* @__PURE__ */
|
|
4
|
+
return r(l,{variant:I?"secondary":"primary",leftIcon:I?/* @__PURE__ */r(o,{}):void 0,onClick:()=>u.onPress(),disabled:null!==L,disabledReason:L??void 0,tooltip:u.tooltip,loading:!0===u.busy,menuLabel:v.saveOptions,items:S,menuMinWidth:300,children:I?I.label:u.label})}export{m as ScreenMainButton,u as ScreenSaveIcon};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPickPart as l,clickPick as s}from"./chunk-SHS6WCLL.js";import{selectionBox as a,placeWindow as c,offsetOrigin as d,colorRunOf as u,ColorWindow as p,startCanvasTyping as f,textMap as h}from"./chunk-23VM4PMV.js";import{DEFAULT_COPY_WORDS as m}from"./chunk-B4JN227A.js";import{useWords as g}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as v,CANVAS_TYPABLE_EVENT as y,isTypingTarget as w,frameRectToHost as b,CANVAS_TYPING_EVENT as k,drawnBox as S}from"./chunk-X4T6JT3M.js";import{find as C,ROOT_ID as I,getList as E,remove as D,parseZoneKey as x,move as A,duplicate as M,replaceNode as O,createNode as z,insert as R,normalizeData as P,createResolveCache as V,resolveNodeData as B,ROOT_SLOT as L}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as N,fieldsFrom as $,defaultsFrom as K}from"./chunk-NKB3KVAB.js";import{createContext as j,useEffect as Z,useContext as T,useRef as F,useSyncExternalStore as H,useState as W,useMemo as q,useCallback as Y,useLayoutEffect as X}from"react";import{jsx as U,jsxs as J,Fragment as G}from"react/jsx-runtime";import{createPortal as Q}from"react-dom";import{registerModalEscapeInterceptor as _,FloatingBar as ee,TextToolbar as te,LinkPicker as ne}from"efficient-shell/ui";function oe(e){return!["setData","setUi","set"].includes(e.type)}var re=(e,t,n,o)=>{const r=E(e,t,x(n));return r?.[o]??null},ie=(e,t,n,o,r)=>{const i=re(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function le(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function se(e,t,n){return n?"node"===n.kind?C(e,t,n.id)?n:null:n.parentId===I?E(e,t,n)?n:null:C(e,t,n.parentId)&&E(e,t,n)?n:null:null}function ae(e,t,n,r=!1){const{itemSelector:i,selectedSlot:l,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=o(e.data,t,i??null)),"selectedSlot"in n&&(l?a=(c=l)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function ce(e,t,n){const o=de(e,t,n);if(o===e)return e;const r=se(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function de(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return ae(e,n,"function"==typeof t.ui?t.ui(le(e,n)):t.ui);case"set":{const r={data:o,ui:le(e,n)},i="function"==typeof t.state?t.state(r):t.state;let l=i.data?{...e,data:i.data}:e;return i.ui&&(l=ae(l,n,i.ui,!0)),l}case"insert":{const r={...x(t.destinationZone),index:t.destinationIndex},i=z(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:R(o,n,r,i)}}case"replace":{const r=ie(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:O(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=ie(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=M(o,n,r.props.id),l=re(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return de(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=re(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...x(t.destinationZone),index:t.destinationIndex};return{...e,data:A(o,n,r.props.id,i)}}case"remove":{const r=ie(o,n,t.zone,t.index,"remove");return{...e,data:D(o,n,r.props.id)}}default:return e}}var ue={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},pe={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},fe=0,he=()=>`history-${fe+=1}`;function me(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let l=e.permissions??{};const s=P(e.data,t);let a={data:s,selection:null,ui:{...pe}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;a={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...pe,...i}}}let c=[{core:a,at:-1/0,sealed:!0,id:he()}],d=0;const u=e=>{const t=c[d],n=r();!e&&d===c.length-1&&d>0&&!t.sealed&&n-t.at<i?c=[...c.slice(0,d),{...t,core:a,at:n}]:(c=[...c.slice(0,d+1),{core:a,at:n,sealed:e,id:he()}],d=c.length-1)},p=/* @__PURE__ */new Set;let f=null,h=null,m=0,g=null,v=!1;const y=()=>{for(const e of[...p])e()},w=()=>{c=[...c.slice(0,d),{...c[d],core:a},...c.slice(d+1)]},b=(t,n)=>{m>0?v=v||n:(n?u(!1):a!==t&&w(),a.data!==t.data&&e.onChange?.(a.data),a!==t&&y())},k=e=>{const n=a;if(a=ce(a,e,t),a===n)return;const o=e.recordHistory??oe(e);b(n,o&&a.data!==n.data)},S=t=>{0===m&&(g=a,v=!1),m+=1;try{t()}catch(e){throw m-=1,0===m&&g&&(a=g,g=null),e}if(m-=1,m>0||!g)return;const n=g;g=null,v&&a.data!==n.data?u(!0):a!==n&&w(),a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},I=e=>{const n=a,o=se(a.data,t,e);var r,i;(r=o,i=a.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(a={...a,selection:o},b(n,!1))},D=t=>{const n=a;d=t,a=c[d].core,a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},x=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...ue,...l,...n}};let A=x();const M=V(),z={resolveCache:M,async resolveAll({trigger:e="load",metadata:n}={}){const o=a.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[l,...s]=await Promise.all([B(r,t,{cache:M,trigger:e,metadata:n}),...i.map(o=>B(o,t,{cache:M,trigger:e,metadata:n}))]);S(()=>{const e=a;let n=a.data;s.forEach((e,r)=>{if(!e.didChange)return;const l=i[r].props.id,s=C(n,t,l)?.node;s&&s===C(o,t,l)?.node&&(n=O(n,t,l,e.node))}),l.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:l.node.props,readOnly:l.node.readOnly??n.root.readOnly}}),n!==a.data&&(a={...a,data:n,selection:se(n,t,a.selection)},b(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=C(a.data,t,e)?.node;if(!r)return!1;const i=await B(r,t,{cache:M,trigger:n,metadata:o});if(!i.didChange)return!1;let l=!1;return S(()=>{const n=a;if(C(a.data,t,e)?.node!==r)return;const o=O(a.data,t,e,i.node);o!==a.data&&(a={...a,data:o,selection:se(o,t,a.selection)},b(n,!1),l=!0)}),l},get config(){return t},getState(){if(f&&h===a)return f;const e=a,o={data:e.data,ui:le(e,t)},r="node"===e.selection?.kind?C(e.data,t,e.selection.id)?.node??null:null;return f={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:k,history:{back:()=>z.undo(),forward:()=>z.redo(),hasPast:d>0,hasFuture:d<c.length-1,histories:c.map(e=>({id:e.id,state:{data:e.core.data,ui:le(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<c.length&&e!==d&&D(e)}},getPermissions:A,getItemById:n=>C(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return E(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},h=e,f},subscribe:e=>(p.add(e),()=>{p.delete(e)}),dispatch:k,batch:S,group:()=>{const e=d,t=c[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,c[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(c=[...c.slice(0,d),{...c[d],sealed:!0},...c.slice(d+1)]));const o=c[d];c=[...c.slice(0,e+1),{...o,sealed:!0},...c.slice(d+1)],d=e+1}}},select:e=>I(e?{kind:"node",id:e}:null),selectSlot:e=>I(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){S(()=>{const n=a,o=void 0===e.select?a.selection:e.select;a={...a,data:e.data,selection:se(e.data,t,o)},b(n,e.data!==n.data)})},load(e,n={}){const o=a,r=P(e,t);a={...a,data:r,selection:se(r,t,n.selection??a.selection)},n.keepHistory||(c=[{core:a,at:-1/0,sealed:!0,id:he()}],d=0),a!==o&&y()},undo(){d>0&&D(d-1)},redo(){d<c.length-1&&D(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,l)||(l=e,A=x(),f=null,y())},setConfig(e){e!==t&&(t=e,A=x(),f=null,y())}};return z}function ge(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&w(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var ve=j(null),ye=j(!0);function we({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return Z(()=>{n&&e.resolveAll()},[e,n]),Z(()=>{if(t&&"undefined"!=typeof document)return ge(document,e)},[e,t]),/* @__PURE__ */U(ve.Provider,{value:e,children:/* @__PURE__ */U(ye.Provider,{value:t,children:o})})}function be(){const e=T(ve);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function ke(e){const t=be(),n=F({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return H(t.subscribe,o,o)}function Se(){return function(e){return ke(e)}}var Ce="data-puck-component",Ie="data-puck-dropzone",Ee={},De="data-es-mirror",xe="undefined"==typeof window?Z:X;function Ae(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${De}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(De,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function Me({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:l=!0,onDocument:s,height:a="auto",nonce:c}){const d=g("canvas",e),u=F(null),[p,f]=W(null);return xe(()=>{const e=u.current,t=p?.ownerDocument.defaultView;if("auto"!==a||!e||!p||!t)return;const n=()=>{e.style.height=`${Math.ceil(p.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(p),()=>r?.disconnect()},[p,a]),xe(()=>{let e=u.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=u.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),v(e,c),f(t),s?.(e);let n=null;const o=u.current?.ownerDocument;if(l&&o){Ae(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>Ae(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */U("iframe",{ref:u,id:n,title:o??d.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:p?Q(t,p):null})}var Oe=j(null),ze=j(Ee),Re=[];function Pe({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=be(),s=ke(n=>E(n.appState.data,l.config,{parentId:e,slot:t})??Re),a=ke(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==I),c=ke(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=T(Oe),u=["es-zone"];return s.length&&u.push("has-children"),e===I&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==I&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */U("div",{className:u.join(" "),[Ie]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */U(Ze,{node:e},e.props.id))})}function Ve(e,t){return q(()=>{const n={};for(const o of N($(e)))n[o]=function(e={}){/* @__PURE__ */
|
|
2
|
+
return U(Pe,{parentId:t,slot:o,...e})};return n},[e,t])}function Be(e){return q(()=>function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
+
return U(Pe,{parentId:e,slot:t,...n})},[e])}var Le=["top","bottom","zIndex"];function Ne(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function $e(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));Ne(e,"position",t?"sticky":"relative");for(const n of Le)Ne(e,n,t?.[n]??"");return!!t}var Ke="data-es-canvas-relative";function je(e){e.hasAttribute(Ke)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(Ke));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(Ke,"")),!1)}function Ze({node:e}){const t=be().config.components[e.type],n=e.props.id,o=F(null),r=function(e,t){return q(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(Ce),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(Ce,e),n.setAttribute("data-puck-dnd",e),je(n))},[e,t])}(n,o),i=F(null),l=!!t?.inline;!function(e,t){const n=F(!1),o=F(()=>{});o.current=()=>{const o=e(),i=n.current;n.current=!!o&&t(o),i!==n.current&&r.current()};const r=F(()=>{});xe(()=>o.current()),xe(()=>{const t=e(),i=t?.ownerDocument.defaultView;if(!t||!i)return;const l=()=>o.current();i.addEventListener("resize",l);const s=i.ResizeObserver,a=s?new s(l):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&i.MutationObserver&&(c=new i.MutationObserver(l),c.observe(e,{attributes:!0}))},r.current(),()=>{i.removeEventListener("resize",l),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>l?o.current:i.current,e=>l?je(e):$e(e));const s=T(ze),a=Ve(t,n),c=Be(n);if(!t?.render)return null;const d=t.render,u={...K(t),...e.props,...a},p={renderDropZone:c,isEditing:!0,dragRef:t.inline?r:null,metadata:{...s,...t.metadata}};return t.inline?/* @__PURE__ */U(d,{...u,puck:p,editMode:!0}):
|
|
4
|
+
/* @__PURE__ */U("div",{ref:i,[Ce]:n,"data-puck-dnd":n,style:{position:"relative"},children:/* @__PURE__ */U(d,{...u,puck:p,editMode:!0})})}function Te({metadata:e}){const t=ke(e=>e.config),n=ke(e=>e.appState.data.root).props??{},o=t.root?.render,r=Ve(t.root,I),i=Be(I),l=/* @__PURE__ */U(Pe,{parentId:I,slot:L}),s=o?/* @__PURE__ */U(o,{id:"puck-root",...n,...r,puck:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:l}):l;/* @__PURE__ */
|
|
5
|
+
return U(ze.Provider,{value:e??Ee,children:s})}var Fe=j(void 0),He=j(void 0);function We({element:e}){const t=F(null),n=qe(t,e?()=>e:null,e);/* @__PURE__ */
|
|
6
|
+
return U("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-hover is-hover-part",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function qe(e,t,n){const[o,r]=W(null),i=F(t);return i.current=t,xe(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(null);let o=0;const l=()=>{o=0;const n=function(e,t){if(!e||!t)return null;const n=S(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(i.current?i.current(t):null,e.current?.parentElement??null);r(e=>{return(t=e)===(o=n)||t&&o&&t.top===o.top&&t.left===o.left&&t.width===o.width&&t.height===o.height?e:n;var t,o})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(l))};l();const a="MutationObserver"in n?new n.MutationObserver(s):null;a?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function Ye({id:e,kind:t,overlay:n}){const o=F(null),r=qe(o,e?t=>t.querySelector(`[${Ce}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),i=/* @__PURE__ */U("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}`,style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height}:{display:"none"}});return n&&e?/* @__PURE__ */U(n,{componentId:e,kind:t,children:i}):i}function Xe(e,t,n){const o=h(e,n),r=o.text.length,i=e.ownerDocument;if(!t)return[r,r];let l=null;const s=i.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))l=o.at(s.offsetNode,s.offset);else{const n=i.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(l=o.at(n.startContainer,n.startOffset))}if(null===l)return[r,r];const a=o.text;let c=l,d=l;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;d<a.length&&!/\s/.test(a[d]);)d+=1;return[c,d]}function Ue({s:e,element:t,toolbar:n,label:o,keys:r}){const i=g("copy",m),l=e.pressed(),s=new Set(n.offered),f=n.colors&&n.colors.length>0?n.colors:null,h=F(null),[v,y]=W(!1),[w,k]=W(null),S=v||null!==w,C=()=>{e.hold(),y(!1),k({href:e.pressed().href})},I=()=>{y(!1),k(null),e.resume()};X(()=>{r.current={escape:()=>!!S&&(I(),!0),link:()=>!!s.has("link")&&(C(),!0)}}),X(()=>()=>{r.current=null},[r]);const E=F(I);E.current=I,Z(()=>{if(v)return _(e=>{const t=h.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(E.current(),!0)},()=>h.current?.querySelector(".es-copy-colors"))},[v]),Z(()=>{const n=h.current;if(!S||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const i=o=>{const r=o.target;if(r&&n.contains(r))return;y(!1),k(null);const i=t();r&&i&&i.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",i,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",i,!0)}},[S,e,t]),X(()=>{const e=h.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(S&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,i=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,l=(i?a(i,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),s=o.ownerDocument.defaultView?.frameElement,u=s?b(s,{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top}):{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top},p=o.getBoundingClientRect(),f=s?b(s,{left:p.left,top:p.top,width:p.width,height:p.height}):{left:p.left,top:p.top,width:p.width,height:p.height},m=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),g={left:u.left,right:u.left+u.width,top:Math.min(u.top,f.top-6,m.top),bottom:Math.max(u.top+u.height,f.top+f.height+6,m.bottom)},v=e.ownerDocument.documentElement,y=(s??o.closest(".es-canvas")??o).getBoundingClientRect(),w={left:Math.max(0,y.left),top:Math.max(0,y.top),right:Math.min(v.clientWidth||y.right,y.right),bottom:Math.min(v.clientHeight||y.bottom,y.bottom)};if(w.right<=w.left||w.bottom<=w.top||0===n.offsetWidth)return;const k=c({anchor:g,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:y.left,top:y.top,right:y.right,bottom:y.bottom},clip:w,parent:d(n)});n.style.top=`${k.top}px`,n.style.left=`${k.left}px`,n.style.setProperty("--es-pop-point",`${k.point}px`),n.dataset.side=k.above?"above":"below"});const D=f?{run:u(l.color,f),open:v,onToggle:()=>{k(null),v?I():(e.hold(),y(!0))}}:void 0;/* @__PURE__ */
|
|
7
|
+
return U(ee,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?b(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */U("div",{ref:h,children:/* @__PURE__ */U(te,{layout:"row",offered:s,pressed:l.marks,onMark:t=>{"link"===t?C():e.press(t)},color:D,linkOpen:null!==w,list:{pressed:l.list,onList:t=>e.list(t)},alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:l.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */J(G,{children:[v&&f?/* @__PURE__ */U(p,{colors:f,current:l.color,words:i.colors??m.colors,onPick:t=>e.color(t)}):null,w?
|
|
8
|
+
/* @__PURE__ */U(ne,{className:"es-copy-link es-copy-pop",value:w.href??"",onApply:t=>{k(null),e.link(t)},onRemove:null!==w.href?()=>{k(null),e.link(null)}:void 0,onCancel:I}):null]})})})})}function Je({element:e}){const t=F(null),n=qe(t,()=>e(),e);/* @__PURE__ */
|
|
9
|
+
return U("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function Ge({frame:t=!0,className:n,style:o,metadata:r,mirrorStyles:a,onDocument:c,height:d,title:u,nonce:p,hotkeys:h,frameWrapper:m,overlay:v,children:w,typing:b,passThrough:S}){const C=be(),I=T(Fe),E=S??I,D=T(ye),x=g("canvas",e),A=h??D,[M,O]=W(void 0),z=ke(e=>"node"===e.selection?.kind?e.selection.id:null),[R,P]=W(null),[V,B]=W(null),L=T(He),[N,$]=W(null),K=F(null),[,j]=W(0),H=F(b);H.current=b;const q=F(null),Y=F(null),X=ke(e=>e.appState.data);Z(()=>{const e=Y.current?.ownerDocument,t=e?.defaultView?.CustomEvent;if(!e||!t)return;const n=z&&!N&&H.current?.atSelection?.()?z:null;e.dispatchEvent(new t(y,{detail:{id:n}}))},[z,N,X]);const G=e=>{const t=Y.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(k,{detail:{typing:e}}))},Q=(e,t)=>{K.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=C.group(),r=e.element,i=f({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:Xe(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>j(e=>e+1),onEscape:()=>q.current?.escape()??!1,onLinkKey:()=>q.current?.link()??!1,end:e=>{o.close(),K.current?.element===r&&(K.current=null),$(null),G(!1),H.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const l=n.closest?.(`[${Ce}]`)?.getAttribute(Ce);return l&&C.select(l),K.current={s:i,element:r,target:e},$(()=>r),P(null),G(!0),H.current?.onChange?.({typing:!0,element:n}),!0};Z(()=>()=>K.current?.s.stop("stop"),[]);const _=e=>{const t=K.current?.element();return Boolean(t&&t.contains(e))},ee=e=>{const t=e.closest?.(`[${Ce}]`)?.getAttribute(Ce);if(!t)return;const n=C.getState(),o="node"===n.selection?.kind?n.selection.id:null,r=L?.partAt(e,t)??null;if(r){const e=l(n.appState.data,C.config,t,r.id,o,L?.selected()??null,E);if(e)return{node:e.node,part:e.part?r:null}}return{node:s(n.appState.data,C.config,t,o,E)??t,part:null}},te=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(K.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=H.current?.atSelection?.();n&&Q(n,null)&&e.preventDefault()},ne=/* @__PURE__ */J("div",{ref:Y,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),K.current){if(_(t))return;K.current.s.stop("outside")}const n=t.ownerDocument?.getSelection?.();n&&n.rangeCount>0&&n.isCollapsed&&n.removeAllRanges();const o=ee(t);if(void 0!==o)return C.select(o.node),void(L&&(o.part?.id??null)!==L.selected()&&L.select(o.part?.id??null));t.hasAttribute?.(Ie)||(C.select(null),L?.selected()&&L.select(null))},onDoubleClick:e=>{const t=H.current;if(!t||_(e.target))return;const n=t.at(e.target);n&&Q(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>te(e),onMouseOver:e=>{if(K.current)return;const t=ee(e.target),n=t?.part&&t.part.id!==L?.selected()?t.part.element:null,o=t&&!t.part?t.node:null;o!==R&&P(o),n!==V&&B(n)},onMouseLeave:()=>{P(null),B(null)},children:[
|
|
10
|
+
/* @__PURE__ */U(Oe.Provider,{value:R,children:/* @__PURE__ */U(Te,{metadata:r})}),
|
|
11
|
+
/* @__PURE__ */J("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
12
|
+
/* @__PURE__ */U(Ye,{id:!N&&R&&R!==z?R:null,kind:"hover",overlay:v}),L?/* @__PURE__ */U(We,{element:N?null:V}):null,
|
|
13
|
+
/* @__PURE__ */U(Ye,{id:N?null:z,kind:"selected",overlay:v}),N?/* @__PURE__ */U(Je,{element:N}):null]}),w]}),oe=m?/* @__PURE__ */U(m,{document:M,children:ne}):ne;Z(()=>{if(M&&A)return ge(M,C)},[M,A,C]),Z(()=>{if(!M)return;const e=e=>{if("Enter"===e.key)return void te(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=C.getState();if("node"!==n.selection?.kind)return;if(L?.selected())return void L.select(null);const o=i(n.appState.data,C.config,n.selection);"node"===o?.kind&&C.select(o.id)};return M.addEventListener("keydown",e),()=>M.removeEventListener("keydown",e)},[M,C,L]);/* @__PURE__ */
|
|
14
|
+
return J("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":N?"":void 0,children:[N&&K.current?.target.toolbar?/* @__PURE__ */U(Ue,{s:K.current.s,element:K.current.element,toolbar:K.current.target.toolbar,label:x.textTools,keys:q}):null,t?/* @__PURE__ */U(Me,{mirrorStyles:a,onDocument:e=>{O(e??void 0),c?.(e)},height:d,title:u,nonce:p,children:oe}):/* @__PURE__ */U("div",{id:"preview-frame","data-puck-entry":"",children:oe})]})}function Qe(e={}){const t=be(),n=ke(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function _e(){const e=be(),n=ke(e=>e.config),o=e.resolveCache,r=ke(e=>e.selectedItem),i=ke(e=>e.appState.data.root),l=r?r.props.id:"root",s=i.props??{},a=q(()=>r||{type:"root",props:s},[r,s]),c=r?n.components[r.type]:n.root,d=e.getState(),u=r?C(d.appState.data,n,l):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,f=p?d.getItemById(p)??null:null,{fields:h}=t({id:l,node:a,block:c,parent:f,appState:d.appState}),m=ke(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),g=Y(t=>{(async()=>{const r=e.getState();if("root"!==l){const i=r.getItemById(l),s=r.getSelectorForId(l);if(!i||!s)return;const a={...i,props:{...i.props,...t}},{node:c}=await B(a,n,{cache:o,trigger:"replace"}),d=e.getState().getSelectorForId(l);if(!d)return;return void e.dispatch({type:"replace",destinationZone:d.zone??"root:default-zone",destinationIndex:d.index,data:c})}const i=r.appState.data.root.props??{},{node:s}=await B({type:"root",props:{...i,...t}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[e,n,o,l]),v=Y((e,t)=>g({[e]:t}),[g]);return{id:l,node:a,fields:h,values:a.props,readOnly:m,onChange:v,onChangeMany:g}}export{Me as CanvasFrame,He as CanvasPartsContext,Fe as CanvasPassThroughContext,pe as DEFAULT_UI,Ge as EaselCanvas,we as EaselProvider,Te as EditDocument,ge as bindUndoKeys,me as createEasel,Se as createUseEasel,oe as recordsByDefault,ce as reduce,le as uiView,ke as useEasel,be as useEaselApi,Qe as useEaselNodeOps,_e as useSelectedFields,se as validSelection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"};var a={savedAgo:function({seconds:e}){const a=Math.max(0,Math.floor(e));if(a<1)return"Saved just now";if(a<60)return`Saved ${a} second${1===a?"":"s"} ago`;const
|
|
1
|
+
var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"};var a={savedAgo:function({seconds:e}){const a=Math.max(0,Math.floor(e));if(a<1)return"Saved just now";if(a<60)return`Saved ${a} second${1===a?"":"s"} ago`;const n=Math.floor(a/60);if(n<60)return`Saved ${n} minute${1===n?"":"s"} ago`;const o=Math.floor(n/60);return`Saved ${o} hour${1===o?"":"s"} ago`},saved:"All changes saved",saving:"Saving",pending:"Changes not saved yet — saving in a moment",failedIn:({seconds:e})=>`Not saved — trying again in ${e} s`,failedSoon:"Not saved — trying again soon",offline:"You’re offline — we’ll save when you’re back",pausedHeld:"Auto-save is off — changes not saved",paused:"Auto-save is off",locked:({editing:e})=>`Not saving — ${e}`,blockedOffline:"You’re offline. Try again when you’re back online.",blockedFailed:"Your last changes are not saved yet. Try again when they are.",blockedConflict:"Your last save was refused. See the notice below."},n={loading:"Loading",waitingForAuthorization:"Waiting for editor authorization",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageSettings:"Page settings",header:"Header",footer:"Footer",pageSections:"Page",templateSections:"Template",addSection:"Add section",addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,canvasAddBlock:"Add block",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel",leave:{title:"Unsaved changes",body:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them.",cancel:"Cancel",discard:"Discard & leave",save:"Save & leave",saving:"Saving"},bar:{undo:"Undo",redo:"Redo",refresh:"Reload the preview",refreshTip:"Reload the preview (keeps your place)",notSaving:"Not saving — see the notice below",retry:"Retry now",autoSaveOff:"Auto-save is off — click to turn it back on (saves your held edits)",autoSaveOn:"Auto-save is on — click to pause it",views:"Left panel views",saveOptions:"Save options",autoSave:"Auto-save",saveNow:"Save now"},saveStatus:a,menu:{undo:"Undo",redo:"Redo",collapseAll:"Collapse all layers",selectAll:"Select all",pinned:"Pinned — can’t be moved or deleted",clipboardRefused:"Your browser won’t let us read the clipboard — press ⌘V"},layers:"Layers",expandAll:"Expand all sections",collapseAll:"Collapse all sections",nothingToFold:"Nothing to fold on this page",rename:"Rename",deleteNamed:({name:e})=>`Delete ${e}`,hideNamed:({name:e})=>`Hide ${e}`,showNamed:({name:e})=>`Show ${e}`,addBlockHere:"Add block here",sectionFirst:({name:e})=>`“${e}” is already first`,sectionLast:({name:e})=>`“${e}” is already last`,sectionMoved:({name:e,n:a,total:n})=>`Moved “${e}” to position ${a} of ${n}`,sectionAdded:({name:e})=>`Added “${e}” section`,deleted:({name:e})=>`Deleted “${e}”`,resizeSettingsPanel:"Resize settings panel",sectionSettings:({name:e})=>`${e} settings`,headerSettings:"Header settings",addBlockMenu:"Add block",deviceNote:{tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."}};export{e as DEFAULT_SCREEN_ADD_WORDS,a as DEFAULT_SCREEN_SAVE_STATUS_WORDS,n as DEFAULT_SCREEN_WORDS};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{blockRuns as e,offeredChoices as r}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as s}from"./chunk-SPQOPWCL.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-EL4F3IN7.js";import{useWords as n}from"./chunk-MFIRYGHW.js";import{DropdownMenu as c}from"efficient-shell/ui";import{jsxs as i,Fragment as o,jsx as l}from"react/jsx-runtime";function p({choices:p,onPick:a}){const{Icon:m}=s(),u=n("screen",t),f=e(r(p)).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */i(o,{children:[e.group," ",
|
|
2
|
+
/* @__PURE__ */l("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */l("span",{className:"sf-chip",children:/* @__PURE__ */l(m,{type:e.type,size:13})}),onSelect:()=>a(e.type)}))]);/* @__PURE__ */
|
|
3
|
+
return l(c,{align:"start",triggerClassName:"sf-add-card",items:f,trigger:/* @__PURE__ */i(o,{children:[
|
|
4
|
+
/* @__PURE__ */l("span",{className:"sf-plus sf-plus--sm",children:"+"}),u.addBlockMenu]})})}export{p as AddBlockRow};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{noControlField as e}from"./chunk-7F52SZOI.js";import{DEFAULT_SCREEN_WORDS as n}from"./chunk-
|
|
1
|
+
import{noControlField as e}from"./chunk-7F52SZOI.js";import{DEFAULT_SCREEN_WORDS as n}from"./chunk-EL4F3IN7.js";import{useWords as r}from"./chunk-MFIRYGHW.js";import{usePreviewDevice as t}from"./chunk-BSPCSC45.js";import{jsx as o}from"react/jsx-runtime";function i(e){return"mobile"===e?"mobile":"desktop"}var c={desktop:null,tablet:n.deviceNote.tablet,mobile:n.deviceNote.mobile},u="data-sf-device-hidden";function d(){/* @__PURE__ */
|
|
2
2
|
return o("span",{hidden:!0,[u]:""})}function s({tier:e,render:n,...r}){return i(t())===e?/* @__PURE__ */o(n,{...r}):/* @__PURE__ */o(d,{})}var m="__device";function f(e){const n=e?.[m];return n??null}function l(e){return f(e)?.inner??e}function a(e,n){const r=n.render;return{...n,[m]:{tier:e,inner:n},render:n=>/* @__PURE__ */o(s,{tier:e,render:r,...n})}}function p(){const e=r("screen",n).deviceNote,i=t(),c="desktop"===i?null:e[i];return c?/* @__PURE__ */o("div",{className:"sf-device-scope",children:c}):/* @__PURE__ */o(d,{})}function v(){return e({type:"custom",render:()=>/* @__PURE__ */o(p,{})},"always")}export{m as DEVICE_FIELD_MARKER,u as DEVICE_HIDDEN_ATTR,c as DEVICE_NOTE,a as deviceField,f as deviceMetaOf,v as deviceNote,i as shownTier,l as withoutDeviceGate};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{EaselRail as e}from"./chunk-MJM6SFD3.js";import{DEFAULT_NOTICE_WORDS as n,DEFAULT_CHROME_WORDS as i}from"./chunk-Z6PVRXVY.js";import{DEFAULT_RAIL_WORDS as a}from"./chunk-2OAZYSWJ.js";import{holderOf as t,describeAge as s,nameOrSomeone as l}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as r}from"./chunk-RE4LP46F.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{jsx as c,jsxs as d,Fragment as u}from"react/jsx-runtime";import{Tooltip as h,IconButton as m,Segmented as p,Switch as v,SpinnerRing as f,ResizeHandle as k,Button as b,Banner as g}from"efficient-shell/ui";import{useState as y,useEffect as N}from"react";import{LockIcon as w,CloudPauseIcon as O,CloudSlashIcon as C,CloudAlertIcon as x,CloudArrowUpIcon as z,CloudCheckIcon as B,PanelLeftIcon as R,PanelRightIcon as L,MediaIcon as $,ImageIcon as S}from"efficient-shell/icons/efficient";function W({children:e}){/* @__PURE__ */
|
|
2
2
|
return c("div",{className:"es-topbar",children:e})}function j({kind:e,style:n,children:i}){/* @__PURE__ */
|
|
3
3
|
return c("div",{className:e?`es-cluster es-cluster--${e}`:"es-cluster",style:n,children:i})}function M(){/* @__PURE__ */
|
|
4
|
-
return c("div",{className:"es-divider-v","aria-hidden":"true"})}function P({items:
|
|
5
|
-
return c("div",{className:"es-cluster es-cluster--rail es-rail-fit",children:/* @__PURE__ */c(
|
|
6
|
-
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:s,"aria-label":e,"aria-pressed":t?"active"===t:void 0,className:"es-iconbtn",disabled:a,onClick:i,children:l})})}function T({devices:e,value:
|
|
7
|
-
return c(p,{className:"es-devseg",size:"sm",label:t??s.device,value:
|
|
4
|
+
return c("div",{className:"es-divider-v","aria-hidden":"true"})}function P({items:n,ariaLabel:i,onWords:t}){const s=o("rail",a);/* @__PURE__ */
|
|
5
|
+
return c("div",{className:"es-cluster es-cluster--rail es-rail-fit",children:/* @__PURE__ */c(e,{items:n,ariaLabel:i??s.label,orientation:"row",onLabelsShown:t})})}function Y({label:e,tip:n,onClick:i,disabled:a,state:t,buttonRef:s,children:l}){/* @__PURE__ */
|
|
6
|
+
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:s,"aria-label":e,"aria-pressed":t?"active"===t:void 0,className:"es-iconbtn",disabled:a,onClick:i,children:l})})}function T({devices:e,value:n,onChange:a,ariaLabel:t}){const s=o("chrome",i);/* @__PURE__ */
|
|
7
|
+
return c(p,{className:"es-devseg",size:"sm",label:t??s.device,value:n,onChange:e=>{e!==n&&a(e)},options:e.map(e=>({value:e.id,icon:/* @__PURE__ */c(h,{content:e.label,side:"bottom",children:/* @__PURE__ */c("span",{className:"es-devseg-glyph","aria-hidden":"true",children:e.icon})}),label:/* @__PURE__ */c("span",{className:"es-vh",children:e.label})}))})}var F={idle:"is-quiet",saved:"is-quiet is-saved",saving:"is-saving",error:"is-error",off:"is-off","off-unsaved":"is-off is-unsaved"};function H({tone:e,label:n,counting:i,waitMs:a,ringRef:t,role:s}){/* @__PURE__ */
|
|
8
8
|
return d("span",{className:`es-savestate ${F[e]}`,role:s,"aria-live":"polite",children:[/* @__PURE__ */c("span",i?{ref:t,className:"es-savestate-ring is-counting",style:void 0!==a?{"--es-savewait":`${a}ms`}:void 0,"aria-hidden":"true"}:{className:"es-savestate-dot","aria-hidden":"true"}),n]})}function V({pressed:e,title:n,onToggle:i,children:a}){/* @__PURE__ */
|
|
9
9
|
return c("span",{className:"es-savestate-toggle",children:/* @__PURE__ */c(h,{content:n,side:"bottom",children:/* @__PURE__ */c(v,{size:"sm",checked:!e,"aria-label":n,label:a,onChange:()=>i()})})})}var I={saved:{glyph:()=>/* @__PURE__ */c(B,{}),tone:"muted"},saving:{glyph:()=>/* @__PURE__ */c(f,{className:"",ink:"",style:{width:20,height:20}}),tone:"muted"},pending:{glyph:()=>/* @__PURE__ */c(z,{}),tone:"muted"},failed:{glyph:()=>/* @__PURE__ */c(x,{}),tone:"danger"},offline:{glyph:()=>/* @__PURE__ */c(C,{}),tone:"warning"},paused:{glyph:()=>/* @__PURE__ */c(O,{}),tone:"warning"},locked:{glyph:()=>/* @__PURE__ */c(w,{}),tone:"warning"}},Z=e=>I[e].tone;function q({state:e,label:n}){const i=I[e],[a,t]=y(n);return N(()=>t(n),[e]),/* @__PURE__ */d("span",{className:"es-saveicon-wrap",children:[
|
|
10
10
|
/* @__PURE__ */c(h,{content:n,side:"bottom",describe:!1,children:/* @__PURE__ */c("span",{className:"es-saveicon",role:"img","aria-label":n,tabIndex:0,"data-save-state":e,"data-tone":i.tone,children:i.glyph()})}),
|
|
11
|
-
/* @__PURE__ */c("span",{className:"es-vh",role:"status","aria-live":"polite",children:a})]})}function A({side:e,width:
|
|
12
|
-
return c(k,{side:e,width:
|
|
11
|
+
/* @__PURE__ */c("span",{className:"es-vh",role:"status","aria-live":"polite",children:a})]})}function A({side:e,width:n,min:a,max:t,defaultWidth:s,label:l,onResize:r}){const d=o("chrome",i);/* @__PURE__ */
|
|
12
|
+
return c(k,{side:e,width:n,min:a,max:t,defaultWidth:s,label:l,hint:d.resize,onResize:e=>r(e),className:`es-resizer es-resizer--${e}`})}function D({icon:e,name:n,kind:i,actions:a}){/* @__PURE__ */
|
|
13
13
|
return d("div",{className:"es-insp-head",children:[
|
|
14
14
|
/* @__PURE__ */c("span",{className:"es-insp-chip","aria-hidden":"true",children:e}),
|
|
15
15
|
/* @__PURE__ */d("div",{className:"es-insp-titles",children:[
|
|
16
16
|
/* @__PURE__ */c(h,{content:n,describe:!1,side:"bottom",className:"es-insp-name-tip",children:/* @__PURE__ */c("h2",{className:"es-insp-name",children:n})}),
|
|
17
17
|
/* @__PURE__ */c("div",{className:"es-insp-kind",children:i})]}),a?/* @__PURE__ */c("div",{className:"es-insp-actions",children:a}):null]})}function J({label:e,title:n,hasPopup:i,onClick:a,disabled:t,danger:s,expanded:l,buttonRef:r,children:o}){/* @__PURE__ */
|
|
18
|
-
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:r,variant:s?"ghost-danger":"ghost",className:"es-insp-iconbtn","aria-label":e,"aria-haspopup":i,"aria-expanded":l,disabled:t,onClick:a,children:o})})}function K({name:e,onSelect:
|
|
19
|
-
return c(D,{icon:/* @__PURE__ */c($,{}),name:l.mediaLibrary,kind:e,actions:r??void 0});const m=l.mediaKinds[
|
|
20
|
-
return c(D,{icon:/* @__PURE__ */c(S,{size:15}),name:l.mediaChoose({kind:m}),kind:
|
|
18
|
+
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:r,variant:s?"ghost-danger":"ghost",className:"es-insp-iconbtn","aria-label":e,"aria-haspopup":i,"aria-expanded":l,disabled:t,onClick:a,children:o})})}function K({name:e,onSelect:n,label:a,inline:t}){const s=o("chrome",i),l=a??s.upLevel,r=/* @__PURE__ */c(h,{content:l,side:"bottom",children:/* @__PURE__ */c(b,{variant:"link",size:"sm",className:"es-insp-up-btn","aria-label":s.upLevelTo({label:l,name:e}),leftIcon:/* @__PURE__ */c("span",{className:"es-insp-up-arrow","aria-hidden":"true",children:"←"}),onClick:n,children:/* @__PURE__ */c("span",{className:"es-insp-up-name",children:e})})});return t?r:/* @__PURE__ */c("div",{className:"es-insp-up",children:r})}function E({name:e,tier:n,of:a},t){const s={...i,...t};return{name:e,kind:"section"===n?s.tierSection:"block"===n?s.tierBlock:a?s.partOf({name:a}):s.tierBlock}}function G({context:e,pick:n,onCancel:a,onHide:t,side:s="left"}){const l=o("chrome",i),r=t?/* @__PURE__ */c(J,{label:l.hidePanelLabel({side:s}),title:l.hidePanel,onClick:t,children:/* @__PURE__ */c("left"===s?R:L,{size:16})}):null;if(!n)/* @__PURE__ */
|
|
19
|
+
return c(D,{icon:/* @__PURE__ */c($,{}),name:l.mediaLibrary,kind:e,actions:r??void 0});const m=l.mediaKinds[n.kind];/* @__PURE__ */
|
|
20
|
+
return c(D,{icon:/* @__PURE__ */c(S,{size:15}),name:l.mediaChoose({kind:m}),kind:n.field?l.mediaFor({field:n.field}):e,actions:/* @__PURE__ */d(u,{children:[
|
|
21
21
|
/* @__PURE__ */c(h,{content:l.mediaKeep({kind:m}),side:"bottom",children:/* @__PURE__ */c(b,{variant:"secondary",size:"sm",className:"es-insp-textbtn",onClick:a,children:l.mediaCancel})}),r?/* @__PURE__ */d(u,{children:[
|
|
22
|
-
/* @__PURE__ */c("span",{className:"es-insp-divider","aria-hidden":"true"}),r]}):null]})})}function X(e){return/svg/i.test(e)?"svg":e.startsWith("video")?"video":"image"}var Q={notice:
|
|
22
|
+
/* @__PURE__ */c("span",{className:"es-insp-divider","aria-hidden":"true"}),r]}):null]})})}function X(e){return/svg/i.test(e)?"svg":e.startsWith("video")?"video":"image"}var Q={notice:n,lock:r};function U(e,n,i,a=Q){const r=a.notice,o=t(e),c={kind:"reload",label:r.reload};if(n){const e=s(n.secondsAgo,a.lock);return{tone:"warning",urgent:!0,lead:n.savedByYou?r.savedByYou({noun:i,when:e}):r.savedByOther({name:l(n.savedBy,a.lock),noun:i,when:e}),body:r.conflictBody,actions:o?[c,{kind:"take-over",label:r.takeOver,title:r.takeOverWhileDeciding}]:[c]}}if(!o)return null;const d=l(o.name,a.lock),u=s(o.secondsSinceSeen,a.lock);switch(e.kind){case"takenover":return{tone:"warning",urgent:!0,lead:r.tookOver({name:d,noun:i,when:s(o.secondsSinceHeld,a.lock)}),body:r.tookOverBody,actions:[{kind:"take-back",label:r.takeBack},c]};case"readonly":return{tone:"neutral",urgent:!1,lead:r.viewingOnly,body:r.viewingOnlyBody({name:d,noun:i,seen:u}),actions:[{kind:"take-over",label:r.takeOver}]};default:return{tone:"warning",urgent:!1,lead:r.editing({name:d,noun:i}),body:r.editingBody({seen:u}),actions:[{kind:"view-read-only",label:r.viewReadOnly},{kind:"take-over",label:r.takeOver,title:r.takeOverTold}]}}}function _({access:e,conflict:i,noun:a,onTakeOver:t,onViewReadOnly:s,onReload:l}){const d=U(e,i,a,{notice:o("notice",n),lock:o("lock",r)});if(!d)return null;const u={reload:l,"take-over":t,"take-back":t,"view-read-only":s},m=d.actions.map(e=>e.title?/* @__PURE__ */c(h,{content:e.title,side:"bottom",children:/* @__PURE__ */c(b,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label})},e.kind):/* @__PURE__ */c(b,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label},e.kind));/* @__PURE__ */
|
|
23
23
|
return c("div",{className:`es-notice is-${d.tone}`,role:d.urgent?"alert":"status",children:/* @__PURE__ */c(g,{tone:"warning"===d.tone?"warning":"info",title:d.lead,action:/* @__PURE__ */c("span",{className:"es-notice-actions",children:m}),children:d.body})})}var ee={left:288,right:320},ne=220,ie=560;function ae(e){return Math.min(560,Math.max(220,Math.round(e)))}function te(e){return{"--es-left-w":`${e.left}px`,"--es-right-w":`${e.right}px`}}function se(e,n){e.style.setProperty("--es-left-w",`${n.left}px`),e.style.setProperty("--es-right-w",`${n.right}px`)}export{ee as DEFAULT_PANEL_W,T as DeviceSwitch,Y as EaselIconButton,W as EaselTopBar,_ as EditNotice,D as InspectorHead,J as InspectorIconButton,K as InspectorUpLevel,ie as MAX_PANEL_W,ne as MIN_PANEL_W,G as MediaPanelHead,A as PanelResizeHandle,q as SaveIcon,H as SaveState,V as SaveStateToggle,j as TopBarCluster,M as TopBarDivider,P as TopBarRail,ae as clampPanelWidth,U as editNotice,E as headWords,X as mediaPickKind,te as panelWidthVars,Z as saveIconTone,se as setPanelWidthVars};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useSectionOps as o}from"./chunk-NFLO4I2N.js";import{SELECTION_MODE as e}from"./chunk-SPQOPWCL.js";import{decodePartId as r,encodePartId as t}from"./chunk-IYT6NN2J.js";import{useEasel as n}from"./chunk-BU2YSTLJ.js";import{usePreviewParts as p}from"./chunk-I54UCYOU.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=n(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=p(),l=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),I?.(n)):i(o=>"part"===o.kind?e:o)},[i,I]);c(()=>{k(l)},[k,l]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=a(o);r&&u.select(r)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-
|
|
1
|
+
import{useEaselHost as n}from"./chunk-U3JP4VGF.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-BU2YSTLJ.js";import{useState as r,useEffect as o,useRef as u}from"react";function c(e){const t=n(),[u,c]=r(null);return o(()=>c(e.current),[e]),t.ownsDocument?"undefined"==typeof document?null:document:u}function i(r,u){const i=n(),s=e(),f=c(r);o(()=>{if(!i.ownsDocument&&f)return t(f,s,{leaveTyping:!0})},[i,s,f]);const m=u?.document??null;o(()=>{if(!i.ownsDocument&&m)return t(m,s,{leaveTyping:!0})},[i,s,m])}function s(n){return n.ownsDocument?{}:{tabIndex:-1}}function f(n){return!n.altKey&&!n.shiftKey&&(!(!n.metaKey&&!n.ctrlKey)&&("s"===n.key||"S"===n.key||"KeyS"===n.code))}function m(n,e,t){const r=c(n),i=u(t);o(()=>{i.current=t}),o(()=>{if(!r)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return r.addEventListener("keydown",n),()=>r.removeEventListener("keydown",n)},[r]);const s=e?.document??null;o(()=>{if(!s)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return s.addEventListener("keydown",n),()=>s.removeEventListener("keydown",n)},[s])}export{s as editorRootFocus,f as isSaveShortcut,c as useEaselKeyTarget,m as useEaselSaveKey,i as useEaselUndoKeys};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(r){return r.filter(r=>!r.retired)}function t(r){const t=[];for(const o of r){const r=t[t.length-1];r&&r.group===o.group?r.items.push(o):t.push({group:o.group,items:[o]})}return t}export{t as blockRuns,r as offeredChoices};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-XDZHKYQX.js";import{blockRuns as l}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as c,useScreenBlockRules as a}from"./chunk-SPQOPWCL.js";import{useEaselSession as p}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-EL4F3IN7.js";import{useEasel as d}from"./chunk-BU2YSTLJ.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{AddPanel as y}from"./chunk-POSLNRTO.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-KAML3KQH.js";import{useState as u,useEffect as k,useMemo as b}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as j,jsxs as v,Fragment as L}from"react/jsx-runtime";var O=e=>`section:${e}`,T=e=>`block:${e}`,$=e=>`template:${e}`;function w({at:w,placeBlocks:B,canTake:E,onPick:N,itemFor:P,session:x,siteWide:A,onClose:H,onHide:I,readOnly:S}){const C=d(e=>e.config),D=c(),{labelAtLevel:F,categoryLabel:K,firstSection:M,Icon:Q,Thumbnail:R}=D,{blockIsOffered:W,canAddTo:Y}=a(),Z=f("screen",m).add,V=f("drag",h).add,z=p(),[J,X]=u([]);k(()=>{let t=!1;const o=e=>W(e,z);return s(z).list().then(n=>{if(t)return;const s=C.components;X(n.filter(t=>t.node?.type&&s[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[C,z]);const G=b(()=>t(C,D),[C]),U=e=>({type:O(e.type),label:e.name,cover:/* @__PURE__ */j(R,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:Z.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=J.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null},_=e=>/* @__PURE__ */j("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */j(Q,{type:e,size:26})}),ee=b(()=>{const e=o(G,M),t=/* @__PURE__ */new Map,s=e=>{e.retired||t.has(e.type)||!W(e.type,z)||t.set(e.type,e)};for(const t of e?[e]:G){const e=Y(t.type)?.choices??[];e.forEach(s),e.forEach(e=>Y(e.type,1)?.choices?.forEach(s))}B?.forEach(s);const i=new Set(G.map(e=>e.type)),r=[...t.values()].filter(e=>!i.has(e.type)),c=e=>({type:T(e.type),label:e.label,cover:_(e.type),title:Z.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>t.has(e.type)?{...U(e),cover:_(e.type)}:U(e),p=[];J.length>0&&p.push({key:"templates",title:Z.templates,tiles:J.map(e=>{return{type:$(e.id),label:e.name,cover:/* @__PURE__ */j(R,{type:e.node.type}),keywords:[(t=e.node.type,F(t,"section",C.components[t]?.label??t)),e.node.type]};var t})});const m=r.filter(e=>!e.group);let d=!1;for(const t of Object.keys(C.categories??{})){const o=G.filter(e=>e.cat===t);if(0===o.length)continue;const s=e&&o.some(t=>t.type===e.type)?e:null,i=(s?[s,...o.filter(e=>e.type!==s.type)]:o).map(a);s&&!d&&(i.splice(1,0,...m.map(c)),d=!0),p.push({key:`category:${t}`,title:n(C,t,K),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(c)],d=!0),l(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(c)})}),!E)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=q(e.type),o=t?E(t):null;return o?{...e,disabled:!0,disabledReason:o}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...y.filter(h),...y.filter(e=>!h(e))]},[J,G,C,Z,E,B,z]);/* @__PURE__ */
|
|
2
|
+
return v(L,{children:[
|
|
3
|
+
/* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:Z.title,context:Z.contextAll,actions:/* @__PURE__ */j(r,{label:Z.done,description:Z.doneDescription,onClick:H}),onHide:I}),
|
|
4
|
+
/* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
+
/* @__PURE__ */j(y,{groups:ee,session:x,itemFor:e=>P(q(e)??{kind:"section",type:e}),onInsert:N?e=>{const t=q(e);t&&N(t)}:void 0,at:w,hint:Z.hint,searchLabel:Z.search,readOnly:S,words:V}),A??null]})]})}export{w as AddSidePanel,T as blockKey,O as sectionKey,$ as templateKey};
|
|
@@ -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,readEaselFailure as i}from"./chunk-CLOS6SSX.js";import{useAdminBridge as l}from"./chunk-VPFNZ7TB.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-O7Q4DDJT.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-RSCMJIWS.js";import{useEaselHost as k}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-EL4F3IN7.js";import{useAutosave as g}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as S,CLAIM_FAIL_OPEN_MS as b,holderOf as P}from"./chunk-THWO5YVZ.js";import{useWords as I}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as B,useMemo as E,useCallback as C,useEffect as H,useRef as O}from"react";import{jsx as T}from"react/jsx-runtime";var N={content:[],root:{},zones:{}};var A=j(null);function D(){const e=R(A);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function F({target:j,addressing:R=o,onHostMessage:D,children:F}){const M=R,{homeSlug:L,entryMayBounce:V,entryBounce:W,onSwitch:Y,tellsHost:Z,adapterFor:J,migrateRenamedProps:U,describeMissing:X,onLoadFailed:x}=M,[G,K]=B(j),Q=k(),z=d(),_=E(()=>f(z),[z]),q=E(()=>t(z),[z]),$="template"===G.kind,ee="template"===G.kind?G.id:null,re="template"===G.kind?G.pageSlug??L??"":"document"===G.kind?G.slug??"":G.slug,ne="page"===G.kind?G.siteId??null:null,te=z.blocks,oe=E(()=>J(G,_,te),[J,_,te,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),ue=oe.capabilities,ae=C(e=>z.documentHooks?.stored?.(e)??e,[z]);H(()=>{m(z,ne)},[z,ne]);const se=O(G);H(()=>{se.current=G},[G]);const{token:ie,tokenRef:le,capabilities:ce}=l({onMessage:r=>{if(D?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Br(e.target)}}}),de=!z.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(_.lock),[ke,ve]=B(null),[ge,pe]=B(null),[he,ye]=B(null),[we,Se]=B(null),be=I("screen",v),Pe=we?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})}}(we,be):null,[Ie,je]=B(null),Re=O(null),Be=O(null),[Ee,Ce]=B(!1),He=O(null),[Oe,Te]=B(null),Ne=O(null),[Ae,De]=B(null),[Fe,Me]=B(!1),Le=O(null);H(()=>{Le.current=Ae},[Ae]);const[Ve,We]=B(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ye=O(Ve);H(()=>{Ye.current=Ve},[Ve]);const Ze=O(()=>Promise.resolve(!1)),Je=C(e=>{Be.current=e,Ce(!0)},[]),Ue=g({save:async({id:e,data:r})=>{if(p(Ye.current)){if(!await Ze.current(e,r)){if(!p(Ye.current))return void Je({id:e,data:r});throw new Error("page save did not land")}}else Je({id:e,data:r})},onFailure:(e,r)=>{0===r&&Q.send("storefront-editor:save-failed")}}),{state:Xe,push:xe,flush:Ge,pause:Ke,resume:Qe,stop:ze,reset:_e,retryNow:qe,hasPending:$e}=Ue,er=O(Xe);H(()=>{er.current=Xe},[Xe]);const rr=u(Xe),nr=C(()=>{const e=Be.current;e&&(Be.current=null,Ce(!1),xe(e))},[xe]),tr=O("");tr.current||(tr.current=h());const[or,ur]=B(0),ar=O(!1),[sr,ir]=B(V(j)),lr=O(!1);H(()=>{if(lr.current)return;lr.current=!0;const e=Q.address.search(),r=W(j,e);r?Q.address.load(r):V(j)&&ir(!1)},[j,Q]);const cr=Q.send;H(()=>{if(!de)return;let e=!1;const t=se.current,o=oe.resolve(re),u=z.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==L&&re!==L?void Q.address.load({kind:"page",slug:L,siteId:ne??void 0}):(Se({target:t,slug:re,missing:!0,sentence:X?.(t)??null}),void x?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Re.current=n,je(n),ve(r.id),pe(r.kind??null),Ne.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:N,s=U(a),i=u?await u(s):s;e||ye(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),Se({target:t,slug:re,missing:!1,sentence:n(o,{slug:re},z),cause:r(o,z)}),x?.(t,o))}),()=>{e=!0}},[de,ie,$,oe,re]);const dr=C(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=le.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),fr=C(async e=>{const r=le.current;if(!r&&z.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,z)){cr("storefront-editor:auth-expired");const n=r?await dr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[cr,dr,z]),mr=C(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=C(async(e,r,n=!1)=>{if(null!==Re.current)return!1;if(!p(Ye.current))return!1;if(Le.current)return!1;const t=await fr(()=>oe.saveLayout(e,r,Ne.current,tr.current));if(t.ok)return Ne.current=t.value.version??Ne.current,Me(!1),!0;const o=q.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ye.current=e,We(e),!1}const u=q.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await fr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return Ne.current=n.value,Ze.current(e,r,!0)}ze(),Le.current=u,De(u)}return Me(i(t.error,z)?.status===c),!1},[oe,fr,ze,z]);H(()=>{Ze.current=kr},[kr]);const vr=C(e=>{if(null!==Re.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);He.current=r,p(Ye.current)?xe({id:ke,data:r}):Je({id:ke,data:r})},[ke,cr,Je,xe,ae]),gr=C(async()=>{p(Ye.current)&&nr();return await Ge()&&null==Be.current},[nr,Ge]),pr=O(gr);H(()=>{pr.current=gr},[gr]);const hr=O(fr);H(()=>{hr.current=fr},[fr]);const yr=C(()=>{Q.address.reload()},[Q]),wr=O(()=>Promise.resolve(!1));H(()=>{wr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:Ne.current,stored:async()=>{const r=await hr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Be.current||$e(),reload:yr}):Promise.resolve(!1)}},[oe,ke,$e,yr]);const Sr=null!==Ie;H(()=>{if(!fe||!ke||!de||Sr)return;let e=!1,r=null,n=null;const t=tr.current,o={claim:async e=>{const r=await hr.current(()=>fe.claim(ke,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Ye.current,heldWrite:()=>({pending:null!=Be.current||$e(),autoSaveEnabled:!er.current.paused,saveConflict:null!=Le.current}),setAccess:e=>{Ye.current=e,We(e)},releaseHeldWrite:()=>{pr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{wr.current()}},u=q.makeClaimBeat(o),a=ar.current;return ar.current=!1,a||(We({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(S)},b)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),fe.release(ke,t).catch(()=>{})}},[ke,fe,de,ie,or,Sr]);const br=C(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Pr=C(()=>{We(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Ir=C(()=>{er.current.paused?(p(Ye.current)&&nr(),Qe()):Ke()},[nr,Ke,Qe]),jr=C(()=>{qe()},[qe]),Rr=C(e=>{He.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{_e(),Be.current=null,Ce(!1)},setVersion:e=>{Ne.current=e},setSaveConflict:De,setAccess:We}),Y(e),K(e),Re.current=null,je(null),ve(null),pe(null),ye(null),Se(null),Q.address.show(e),"document"!==e.kind&&Z(e)&&Q.send("storefront-editor:navigated",{target:e})},[_e,Q,me,Y,Z]),Br=C(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,se.current,L))return;const r=null!=Be.current;if(!r&&!$e())return void Rr(e);const n=er.current;r||n.paused||n.failed||n.stopped?Te(e):Ge().then(r=>{r?Rr(e):Te(e)})},[Rr,$e,Ge,L]),Er=C(()=>Te(null),[]),Cr=C(()=>{Te(e=>(e&&Rr(e),null))},[Rr]),Hr=C(async()=>{const e=Oe;if(!e)return;await gr()&&(Te(null),Rr(e))},[Oe,gr,Rr]),Or=C(async e=>{if(null!==Re.current)return;if(!ke)return;if(!p(Ye.current)||Le.current)return;const r=ae(e);if(!await kr(ke,r))return void(Le.current||cr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void cr("storefront-editor:saved");const t=await fr(()=>n(ke,Ne.current??void 0));if(!t.ok){const{error:e}=t;return void cr("storefront-editor:publish-failed",{reason:e instanceof Error&&e.message?e.message:null})}Ne.current=t.value.version??Ne.current,cr("storefront-editor:published")},[ke,oe,ue.canPublish,cr,kr,fr,ae]);/* @__PURE__ */
|
|
2
|
+
return T(A.Provider,{value:{target:G,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>He.current??he,error:Pe,redirecting:sr,saveStatus:rr,saveState:Xe,autoSaveEnabled:!Xe.paused,autoSaveStoppedByConflict:Xe.stopped,hasUnsavedEdits:Xe.pending||Ee,toggleAutoSave:Ir,retrySave:jr,onChange:vr,flushSave:gr,onPublish:Or,access:Ve,readOnly:null!==P(Ve)||null!==Ie||null!==Ae,readOnlyReason:Ie,takeOverEditing:br,viewReadOnly:Pr,saveConflict:Ae,saveUnreachable:Fe,reloadFromServer:yr,navigate:Br,pendingNav:Oe,cancelPendingNav:Er,discardAndNavigate:Cr,saveAndNavigate:Hr},children:F})}export{A as ScreenDocumentContext,F as ScreenDocumentProvider,D as useScreenDocument};
|