efficient-easel 19.3.0 → 20.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 +40 -3
- package/dist/{ScreenDocumentContext-D55vIrG3.d.ts → ScreenDocumentContext-RxVWWWHq.d.ts} +104 -1
- package/dist/blocks/index.d.ts +13 -2
- package/dist/canvas/index.d.ts +2 -0
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-FMZGR7EG.js → chunk-2A7HLAI5.js} +1 -1
- package/dist/chunk-2E2SXDYQ.js +1 -0
- package/dist/{chunk-67GNT6PF.js → chunk-3S5N4HLJ.js} +1 -1
- package/dist/chunk-A42LPWNM.js +1 -0
- package/dist/chunk-BC5KJNHN.js +63 -0
- package/dist/{chunk-X3TYRF5V.js → chunk-BSHIQIZC.js} +1 -1
- package/dist/{chunk-KWE5U6CE.js → chunk-BW5COX42.js} +1 -1
- package/dist/chunk-CBICQ4J3.js +5 -0
- package/dist/chunk-EW6XAMDZ.js +8 -0
- package/dist/chunk-HK6I3NVO.js +1 -0
- package/dist/{chunk-YRLPFZW3.js → chunk-IWCKVZHS.js} +1 -1
- package/dist/{chunk-KRXQM65X.js → chunk-K7BTCBWD.js} +1 -1
- package/dist/{chunk-A6CY3TQ5.js → chunk-KC24D76S.js} +1 -1
- package/dist/chunk-L55YIXDC.js +1 -0
- package/dist/chunk-LDEEFLE3.js +18 -0
- package/dist/chunk-LF3FUSCQ.js +1 -0
- package/dist/{chunk-7OKL7HDV.js → chunk-NHY5L3SE.js} +1 -1
- package/dist/chunk-OECWLNKJ.js +2 -0
- package/dist/{chunk-YOXKBOZX.js → chunk-QALW2ECZ.js} +1 -1
- package/dist/chunk-ROPYFLNZ.js +15 -0
- package/dist/{chunk-ME4V6PML.js → chunk-RR4VIAHP.js} +3 -3
- package/dist/chunk-SK3P56FS.js +21 -0
- package/dist/chunk-VANKQVOW.js +8 -0
- package/dist/chunk-XFYFKITX.js +1 -0
- package/dist/{chunk-XWFH2NHZ.js → chunk-ZEH6QLBH.js} +2 -2
- package/dist/copy/copy.css +1 -1
- package/dist/copy/index.js +13 -13
- package/dist/data/index.js +1 -1
- package/dist/drag/index.js +1 -1
- package/dist/draw/index.d.ts +2 -1
- package/dist/draw/index.js +1 -1
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/gold/gold.css +4 -1
- package/dist/node-ops/index.js +1 -1
- package/dist/panel/index.d.ts +7 -8
- package/dist/panel/index.js +9 -9
- package/dist/rail/index.d.ts +2 -2
- package/dist/rail/index.js +1 -1
- package/dist/rail/rail.css +1 -1
- package/dist/render/index.d.ts +12 -3
- package/dist/render/index.js +5 -5
- package/dist/repeat-Czi-6zPX.d.ts +49 -0
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
- package/dist/screen/components/ScreenMount.d.ts +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/usePartBridge.d.ts +1 -1
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/content/view-tiers.d.ts +81 -1
- package/dist/screen/lib/content/view-tiers.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +1 -1
- package/dist/screen/lib/document-contract.d.ts +12 -5
- package/dist/screen/lib/host.d.ts +1 -1
- package/dist/screen/lib/key-scope.js +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/puck/preview-dom.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/shell/shell.css +4 -2
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.js +36 -36
- package/dist/text-styles/model.d.ts +8 -0
- package/package.json +3 -3
- package/dist/chunk-36LVP5WD.js +0 -9
- package/dist/chunk-4ES5JGGX.js +0 -1
- package/dist/chunk-4VJATVVR.js +0 -1
- package/dist/chunk-CNKVVHDA.js +0 -63
- package/dist/chunk-DWIOHQG7.js +0 -1
- package/dist/chunk-H5YLVKGA.js +0 -1
- package/dist/chunk-KOVJODTY.js +0 -14
- package/dist/chunk-NKB3KVAB.js +0 -1
- package/dist/chunk-OGBYHQE6.js +0 -5
- package/dist/chunk-U6LF5YVK.js +0 -8
- package/dist/chunk-VULUDKA3.js +0 -21
- package/dist/chunk-ZO3UUK45.js +0 -18
- /package/dist/{chunk-X4T6JT3M.js → chunk-QIDRJH3S.js} +0 -0
package/README.md
CHANGED
|
@@ -614,6 +614,23 @@ block's `render` gets its props, `puck`, and each slot as a component —
|
|
|
614
614
|
plain `<div>`, and `puck` carries exactly what Puck's client `<Render>` gives at
|
|
615
615
|
each level. A type the config does not know draws nothing.
|
|
616
616
|
|
|
617
|
+
**A slot says how many blocks it holds** (Unreleased). Each slot component
|
|
618
|
+
has a read-only `blockCount`: the blocks it draws. A block of a type the
|
|
619
|
+
config does not know draws nothing, so it is not counted. The editor's canvas
|
|
620
|
+
(`efficient-easel/easel`) puts the same number on its slots, for the same
|
|
621
|
+
document, and writes it again when the slot's list changes (the slot stays
|
|
622
|
+
the same component). So a block can choose what to draw without calling the
|
|
623
|
+
slot or reading the editor's store:
|
|
624
|
+
|
|
625
|
+
```tsx
|
|
626
|
+
render: ({ template: Template }) =>
|
|
627
|
+
Template.blockCount ? <Template /> : <PlainList />,
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
The `SlotComponent` type in `efficient-easel/blocks` has it as optional, so a
|
|
631
|
+
slot written by hand in a test still types; `render`'s own `SlotComponent`
|
|
632
|
+
always has it.
|
|
633
|
+
|
|
617
634
|
`className` (0.95.0) is an opt-in class for that top-level wrapper, for a host
|
|
618
635
|
whose stylesheet has to reach it: `<Render … className="page" />`. Left out,
|
|
619
636
|
the wrapper is bare and the markup is Puck's.
|
|
@@ -632,15 +649,34 @@ allow a published page to take easel through `render`, `draw` and
|
|
|
632
649
|
`readHidable`, the part ids (`encodePartId`, `decodePartId`), the field
|
|
633
650
|
markers (`TEXT_FIELD_MARKER`, `textFieldIdentifier`, …), the text control
|
|
634
651
|
kinds, the slot-child names, the content-tree walkers (`childSlotsOf`,
|
|
635
|
-
`locateNode`, `pinnedDuplicateIndices`, …), the view tiers
|
|
652
|
+
`locateNode`, `pinnedDuplicateIndices`, …), the view tiers and the
|
|
653
|
+
per-view value engine (below), the preview
|
|
636
654
|
event names, and the one letter-case code (`TEXT_STYLE_CASES`,
|
|
637
655
|
`TEXT_STYLE_CASE_CSS`, `isTextStyleCase`, `textStyleCaseCss`,
|
|
638
|
-
`textStyleCaseOfCss`, the same functions as `text-styles/model`)
|
|
639
|
-
|
|
656
|
+
`textStyleCaseOfCss`, the same functions as `text-styles/model`), and the
|
|
657
|
+
names of the wrapper round each drawn copy of a template
|
|
658
|
+
(`REPEAT_ATTRIBUTE` = `data-sf-repeat`, `REPEAT_INDEX_ATTRIBUTE` =
|
|
659
|
+
`data-sf-repeat-index`; see `canvas` below). No React and no import: a
|
|
660
|
+
server component may use it.
|
|
640
661
|
- `efficient-easel/draw/client` — the React pieces: `PreviewDeviceContext` /
|
|
641
662
|
`usePreviewDevice`, `PreviewPartsProvider` / `usePreviewParts`,
|
|
642
663
|
`createPreviewSelectionContext`, and `UiIcon`.
|
|
643
664
|
|
|
665
|
+
**Each view owns its values** (three views, the plan approved 2026-10-23).
|
|
666
|
+
A setting keeps its desktop value. Tablet and Phone MAY store their own, under
|
|
667
|
+
`tabletKey(key)` (`<key>Tablet`) and `phoneKey(key)` (`<key>Phone`, the key
|
|
668
|
+
web-builder already stores). A view with nothing stored is auto (`isAuto`):
|
|
669
|
+
`resolveViewValue(kind, desktop, tablet?, phone?)` gives what each view draws,
|
|
670
|
+
by `AUTO_RULES[kind]`; Phone's parent is Tablet, Tablet's is Desktop. The kinds:
|
|
671
|
+
`spacing` (Tablet x0.75, Phone x0.5 of Desktop, on the 4px scale: 80 → 60 →
|
|
672
|
+
40), `columns` (at most 2, then 1), `stack` (Phone stacked), `textSize`
|
|
673
|
+
(x0.85 and x0.7, to 1px), `heightMode` (Phone: px → fit, Screen % stays),
|
|
674
|
+
`heightPx` (x0.75) and `same`. The breakpoints are `VIEW_TABLET_MIN` 720 and
|
|
675
|
+
`VIEW_DESKTOP_MIN` 1100. A text style's `sizeTablet` (absent = auto) sits
|
|
676
|
+
beside `sizePhone`. Nothing draws with the engine yet: the rendering and the
|
|
677
|
+
panel come in later releases. Never store what `resolveViewValue` returns for
|
|
678
|
+
an auto view.
|
|
679
|
+
|
|
644
680
|
Nothing moved: each name is re-exported from the module that defines it, and
|
|
645
681
|
the `screen/…` paths still work. `tests/draw-leaf-safety.test.ts` holds each
|
|
646
682
|
graph to an exact list of files and imports.
|
|
@@ -672,6 +708,7 @@ const tick = useCanvasLayout(canvas); // re-m
|
|
|
672
708
|
| `fitCanvas({ available, width, maxScale })` | The canvas width and the scale that fits it into the pane. |
|
|
673
709
|
| `isTypingTarget(target)` | Is this key pressed somewhere a person types (text inputs, textarea, select, editable regions)? A shortcut must stay out. |
|
|
674
710
|
| `nodeIdAt(target, attribute?)` | The block a pointer event landed on. |
|
|
711
|
+
| `REPEAT_ATTRIBUTE`, `REPEAT_INDEX_ATTRIBUTE`, `isRepeatCopy`, `mainCopyOf`, `queryMainCopy`, `queryAllCopies` | A template drawn once per data row: each copy is in `<div data-sf-repeat="<ownerId>:template" data-sf-repeat-index={i}>`, index 0 the main copy. The outline goes on every copy (`queryAllCopies`), a lookup by id reads the main one (`queryMainCopy`), and only the main copy's lists take drops. With no `data-sf-repeat` each answers what `querySelector` answers. |
|
|
675
712
|
| `watchCanvasFrame(root, onChange, options)` | The watcher the hook wraps, for code outside React. |
|
|
676
713
|
| `setCanvasNonce(document, nonce)` | The CSP nonce every `<style>` created in that canvas document carries (0.95.0). `CanvasFrame`'s `nonce` prop sets it; a host that builds its own frame calls it. |
|
|
677
714
|
|
|
@@ -272,6 +272,85 @@ type EaselToHostMessage =
|
|
|
272
272
|
type: "storefront-editor:save-as-template";
|
|
273
273
|
siteId: string;
|
|
274
274
|
slug: string;
|
|
275
|
+
}
|
|
276
|
+
/** The selection changed: what is selected, as the host may name it to a
|
|
277
|
+
* person or an assistant, or null when nothing is. Sent on every change. */
|
|
278
|
+
| {
|
|
279
|
+
type: "storefront-editor:selection";
|
|
280
|
+
selection: EaselSelection | null;
|
|
281
|
+
}
|
|
282
|
+
/** The answer to `request-document`, with its id: the open document as the
|
|
283
|
+
* editor has it now (unsaved edits included) and the block types it knows. */
|
|
284
|
+
| {
|
|
285
|
+
type: "storefront-editor:document";
|
|
286
|
+
requestId: string;
|
|
287
|
+
document: unknown;
|
|
288
|
+
blocks: Record<string, EaselBlockType>;
|
|
289
|
+
}
|
|
290
|
+
/** The answer to `apply-page-edits` or `undo-page-edits`, with its id. */
|
|
291
|
+
| {
|
|
292
|
+
type: "storefront-editor:page-edits-result";
|
|
293
|
+
requestId: string;
|
|
294
|
+
applied: boolean;
|
|
295
|
+
reason: string | null;
|
|
296
|
+
};
|
|
297
|
+
/**
|
|
298
|
+
* What is selected, as the editor names it. `label` is for a person
|
|
299
|
+
* ("Hero slider · slide 1"); `blockId` is the block's own id, and `path`,
|
|
300
|
+
* when a part of the block is open (one slide), says where in its props
|
|
301
|
+
* ("slides[0]"), else "".
|
|
302
|
+
*/
|
|
303
|
+
interface EaselSelection {
|
|
304
|
+
blockId: string;
|
|
305
|
+
type: string;
|
|
306
|
+
label: string;
|
|
307
|
+
path: string;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* A block type as the editor describes it to a host: its label and its fields,
|
|
311
|
+
* the plain part of each (no render, no custom field's component), so the
|
|
312
|
+
* description is JSON.
|
|
313
|
+
*/
|
|
314
|
+
interface EaselBlockType {
|
|
315
|
+
label: string;
|
|
316
|
+
fields: Record<string, EaselFieldDescription>;
|
|
317
|
+
}
|
|
318
|
+
interface EaselFieldDescription {
|
|
319
|
+
type: string;
|
|
320
|
+
label?: string;
|
|
321
|
+
options?: {
|
|
322
|
+
value: unknown;
|
|
323
|
+
label?: string;
|
|
324
|
+
}[];
|
|
325
|
+
arrayFields?: Record<string, EaselFieldDescription>;
|
|
326
|
+
objectFields?: Record<string, EaselFieldDescription>;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* One change a host asks the editor to make to the open document. Every
|
|
330
|
+
* change is recorded, so the editor's undo takes it back. `set_props` writes
|
|
331
|
+
* fields of a block, at `path` inside it when given ("slides[0]");
|
|
332
|
+
* `insert_block`, `remove_block` and `move_block` work among the document's
|
|
333
|
+
* top-level blocks, `after` or `before` naming the block it goes next to.
|
|
334
|
+
*/
|
|
335
|
+
type PageEditOp = {
|
|
336
|
+
op: "set_props";
|
|
337
|
+
block_id: string;
|
|
338
|
+
path: string;
|
|
339
|
+
props: Record<string, unknown>;
|
|
340
|
+
} | {
|
|
341
|
+
op: "insert_block";
|
|
342
|
+
type: string;
|
|
343
|
+
props: Record<string, unknown>;
|
|
344
|
+
after: string;
|
|
345
|
+
before: string;
|
|
346
|
+
} | {
|
|
347
|
+
op: "remove_block";
|
|
348
|
+
block_id: string;
|
|
349
|
+
} | {
|
|
350
|
+
op: "move_block";
|
|
351
|
+
block_id: string;
|
|
352
|
+
after: string;
|
|
353
|
+
before: string;
|
|
275
354
|
};
|
|
276
355
|
/** Every message a host sends the editor, by name. */
|
|
277
356
|
type HostToEaselMessage = {
|
|
@@ -308,6 +387,30 @@ type HostToEaselMessage = {
|
|
|
308
387
|
} | {
|
|
309
388
|
type: "storefront-editor:media-pick-cancelled";
|
|
310
389
|
requestId: string;
|
|
390
|
+
}
|
|
391
|
+
/** Ask for the open document; answered by `document` with the same id. */
|
|
392
|
+
| {
|
|
393
|
+
type: "storefront-editor:request-document";
|
|
394
|
+
requestId: string;
|
|
395
|
+
}
|
|
396
|
+
/** Apply these changes to the open document, as one step of its history, or
|
|
397
|
+
* none of them; answered by `page-edits-result` with the same id. */
|
|
398
|
+
| {
|
|
399
|
+
type: "storefront-editor:apply-page-edits";
|
|
400
|
+
requestId: string;
|
|
401
|
+
ops: PageEditOp[];
|
|
402
|
+
}
|
|
403
|
+
/** Take back the step `apply-page-edits` with this id made, when it is still
|
|
404
|
+
* the last one; answered by `page-edits-result` with the same id. */
|
|
405
|
+
| {
|
|
406
|
+
type: "storefront-editor:undo-page-edits";
|
|
407
|
+
requestId: string;
|
|
408
|
+
}
|
|
409
|
+
/** Show or hide the editor's right-hand panel (the host puts something of
|
|
410
|
+
* its own there, an assistant). */
|
|
411
|
+
| {
|
|
412
|
+
type: "storefront-editor:set-right-panel";
|
|
413
|
+
shown: boolean;
|
|
311
414
|
};
|
|
312
415
|
type EaselMessageType = EaselToHostMessage["type"];
|
|
313
416
|
type PayloadOf<T extends EaselMessageType> = Omit<Extract<EaselToHostMessage, {
|
|
@@ -615,4 +718,4 @@ declare function ScreenDocumentProvider({ target, addressing: handed, onHostMess
|
|
|
615
718
|
children: ReactNode;
|
|
616
719
|
}): react.JSX.Element;
|
|
617
720
|
|
|
618
|
-
export { type AnyDocumentAddressing as A, DETACHED_EASEL_HOST as D, type
|
|
721
|
+
export { type AnyDocumentAddressing as A, DETACHED_EASEL_HOST as D, type EaselBlockType as E, type HostPickedMedia as H, type InboundHostMessage as I, NO_DOCUMENT_ADDRESSING as N, type PageEditOp as P, type SectionScreenTarget as S, type DocumentAddressing as a, type EaselFieldDescription as b, type EaselHost as c, type EaselHostAddress as d, EaselHostContext as e, EaselHostProvider as f, type EaselMessageType as g, type EaselSelection as h, type EaselToHostMessage as i, type HostToEaselMessage as j, type PickedMediaSource as k, type SendToHost as l, createEaselHost as m, useHostEscape as n, type AnyScreenTarget as o, type DocumentTarget as p, ScreenDocumentContext as q, ScreenDocumentProvider as r, type ScreenDocumentValue as s, type ScreenTarget as t, useEaselHost as u, useScreenDocument as v };
|
package/dist/blocks/index.d.ts
CHANGED
|
@@ -227,8 +227,19 @@ type DropZoneProps = {
|
|
|
227
227
|
className?: string;
|
|
228
228
|
collisionAxis?: DragAxis;
|
|
229
229
|
};
|
|
230
|
-
/**
|
|
231
|
-
|
|
230
|
+
/**
|
|
231
|
+
* A slot, as a block's `render` receives it: draw it with `<Content />`.
|
|
232
|
+
*
|
|
233
|
+
* `blockCount` is how many blocks the slot draws — a block of a type nobody
|
|
234
|
+
* registered is not counted. It is the same number on the published page
|
|
235
|
+
* (`efficient-easel/render`) and in the editor's canvas, so a block can choose
|
|
236
|
+
* what to draw (`Content.blockCount ? <Content /> : fallback`) without
|
|
237
|
+
* calling the slot or reading the editor's store. Both always set it; it is
|
|
238
|
+
* optional here only so a slot written by hand (a test, a story) still types.
|
|
239
|
+
*/
|
|
240
|
+
type SlotComponent = ((props?: Omit<DropZoneProps, 'zone'>) => ReactNode) & {
|
|
241
|
+
readonly blockCount?: number;
|
|
242
|
+
};
|
|
232
243
|
/** The `puck` prop every block's `render` receives. */
|
|
233
244
|
type BlockContext = {
|
|
234
245
|
renderDropZone: FC<DropZoneProps>;
|
package/dist/canvas/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { C as CanvasTarget, W as WatchOptions } from '../watch-BTYOJpQU.js';
|
|
3
3
|
export { B as BLOCK_SELECTOR, a as CANVAS_SELECTOR, L as LIST_SELECTOR, i as isFrameReady, w as watchCanvasFrame } from '../watch-BTYOJpQU.js';
|
|
4
|
+
export { R as REPEAT_ATTRIBUTE, a as REPEAT_INDEX_ATTRIBUTE, i as isRepeatCopy, m as mainCopyOf, q as queryAllCopies, b as queryMainCopy } from '../repeat-Czi-6zPX.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The small facts every canvas surface needs, written once — pure DOM, no
|
|
@@ -26,6 +27,7 @@ export { B as BLOCK_SELECTOR, a as CANVAS_SELECTOR, L as LIST_SELECTOR, i as isF
|
|
|
26
27
|
declare function isTypingTarget(target: EventTarget | null): boolean;
|
|
27
28
|
/** The attribute on every block the canvas draws (Puck 0.20's name, kept). */
|
|
28
29
|
declare const BLOCK_ATTRIBUTE = "data-puck-component";
|
|
30
|
+
|
|
29
31
|
/**
|
|
30
32
|
* The id of the block a pointer event landed on: the NEAREST ancestor (or the
|
|
31
33
|
* target itself) carrying `attribute`. `null` on bare canvas.
|
package/dist/canvas/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{BLOCK_ATTRIBUTE,BLOCK_SELECTOR,CANVAS_SELECTOR,CANVAS_TYPABLE_EVENT,CANVAS_TYPING_EVENT,LIST_SELECTOR,clientPointToLayer,drawnBox,elementScale,fitCanvas,framePointToHost,frameRectToHost,frameRectToLayer,frameScale,isFrameReady,isTypingTarget,nodeIdAt,removeCanvasStyle,setCanvasNonce,upsertCanvasStyle,useCanvasEvent,useCanvasFrame,useCanvasLayout,useCanvasStyle,useCanvasTyping,watchCanvasFrame}from"../chunk-
|
|
1
|
+
export{BLOCK_ATTRIBUTE,BLOCK_SELECTOR,CANVAS_SELECTOR,CANVAS_TYPABLE_EVENT,CANVAS_TYPING_EVENT,LIST_SELECTOR,clientPointToLayer,drawnBox,elementScale,fitCanvas,framePointToHost,frameRectToHost,frameRectToLayer,frameScale,isFrameReady,isTypingTarget,nodeIdAt,removeCanvasStyle,setCanvasNonce,upsertCanvasStyle,useCanvasEvent,useCanvasFrame,useCanvasLayout,useCanvasStyle,useCanvasTyping,watchCanvasFrame}from"../chunk-QIDRJH3S.js";export{REPEAT_ATTRIBUTE,REPEAT_INDEX_ATTRIBUTE,isRepeatCopy,mainCopyOf,queryAllCopies,queryMainCopy}from"../chunk-LF3FUSCQ.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{blockRuns as e,offeredChoices as r}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as s}from"./chunk-
|
|
1
|
+
import{blockRuns as e,offeredChoices as r}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as s}from"./chunk-CBICQ4J3.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-23DYNW6S.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
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
3
|
return l(c,{align:"start",triggerClassName:"sf-add-card",items:f,trigger:/* @__PURE__ */i(o,{children:[
|
|
4
4
|
/* @__PURE__ */l("span",{className:"sf-plus sf-plus--sm",children:"+"}),u.addBlockMenu]})})}export{p as AddBlockRow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{HERO_SLIDER_GOTO_EVENT as t}from"./chunk-IQ5TA7AM.js";import{queryMainCopy as n}from"./chunk-LF3FUSCQ.js";import{isPreviewClick as o}from"./chunk-R5L2E7JX.js";var e=()=>document.querySelector(".sf-editor #preview-frame");function r(t){o()||requestAnimationFrame(()=>{const o=e()?.contentDocument;o&&n(o,`[data-puck-component="${CSS.escape(t)}"]`)?.scrollIntoView({behavior:"smooth",block:"start"})})}function c(n,o){const r=e()?.contentWindow;if(!r)return;const c={id:n,index:o};r.dispatchEvent(new CustomEvent(t,{detail:c}))}function i(){requestAnimationFrame(()=>{e()?.contentWindow?.scrollTo({top:0,behavior:"smooth"})})}function u(t,{passes:n=[150,400],onPinned:o}={}){let r=0,c=!1;const i=[],u=()=>{const r=e(),s=r?.contentWindow,l=r?.contentDocument;if(!s||!l)return!1;const m=t(s,l);if(null==m)return!1;if(s.scrollTo({left:s.scrollX,top:m,behavior:"instant"}),!c){c=!0,o?.();for(const t of n)i.push(setTimeout(u,t))}return!0},s=()=>{!u()&&r++<150&&i.push(setTimeout(s,32))};return s(),()=>i.forEach(clearTimeout)}function s(t){return u((o,e)=>{const r=n(e,`[data-puck-component="${CSS.escape(t)}"]`);return r?o.scrollY+r.getBoundingClientRect().top:null})}function l(t){return u((t,n)=>{if(!n.querySelector("[data-puck-component]"))return null;const o=Math.max(n.documentElement.scrollHeight,n.body?.scrollHeight??0);return o<=n.documentElement.clientHeight?null:o},{passes:[150,400,800,1300,2e3],onPinned:t})}export{c as gotoPreviewSlide,l as pinPreviewToBottom,s as pinPreviewToSection,e as previewFrame,r as scrollPreviewToSection,i as scrollPreviewToTop};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{zoneKey as e}from"./chunk-
|
|
1
|
+
import{zoneKey as e}from"./chunk-K7BTCBWD.js";import{useRef as t,useEffect as n,useState as r,useSyncExternalStore as o,useCallback as i}from"react";var l=56,c=16;function a(e){const t=Math.max(e,0);return t>=l?0:Math.ceil(16*(1-t/l))}function u(e,t,n){if(e<t-l||e>n+l)return 0;const r=e-t,o=n-e;return r<l&&r<=o?-a(r):o<l?a(o):0}function s(e){const t=e?.ownerDocument?.defaultView;for(let n=e?.parentElement??null;n;n=n.parentElement){const e=t?.getComputedStyle(n).overflowY;if(("auto"===e||"scroll"===e)&&n.scrollHeight>n.clientHeight)return n}return null}function f(e){const t=e?.ownerDocument?.defaultView?.getComputedStyle(e).overflowY;return e&&("auto"===t||"scroll"===t)&&e.scrollHeight>e.clientHeight?e:s(e)}function d(e){const t=e.scrollingElement??e.documentElement;return t&&t.scrollHeight>t.clientHeight?t:null}function g(e,t=e){const n=t.ownerDocument,r=n.defaultView;if(!r)return()=>{};let o=null,i=0;const l=e=>{o=e.clientY},c=()=>{if(null!==o){const n=t.getBoundingClientRect(),r=u(o,n.top,n.bottom);r&&(e.scrollTop+=r)}i=r.requestAnimationFrame(c)};return n.addEventListener("dragover",l,!0),i=r.requestAnimationFrame(c),()=>{n.removeEventListener("dragover",l,!0),r.cancelAnimationFrame(i)}}function p(e){return/move|all|uninitialized/i.test(e)?"move":"copy"}function m(){let e=null,t=null;const n=/* @__PURE__ */new Set,r=()=>{if(t!==e){t=e;for(const e of[...n])e()}};return{get:()=>e,shown:()=>t,start(t){e=t,globalThis.setTimeout(r,0)},end(){null===e&&null===t||(e=null,r())},subscribe:e=>(n.add(e),()=>{n.delete(e)})}}function v(e,t,n,r){if(e.into)return{side:"into",to:e.into};return"first"===e.pinned||"last"!==e.pinned&&t>n+r/2?{side:"after",to:{...e.place,index:e.place.index+1}}:{side:"before",to:{...e.place,index:e.place.index}}}var D=(t,n)=>e(t)===e(n);function w(e,t){return D(e,t)&&(t.index===e.index||t.index===e.index+1)}function y(e,t){return D(e,t)&&e.index<t.index?t.index-1:t.index}function x(e,t){return{...e,index:t<0?e.index-1:e.index+2}}function h(e,t){if(!t)return e;const n={...t,...e};for(const[r,o]of Object.entries(e)){const e=t[r];"function"==typeof o&&"function"==typeof e&&(n[r]=t=>{o(t),e(t)})}return n}function T(l){const c=t(l);n(()=>{c.current=l});const[a]=r(()=>m()),u=l.session??a,d=o(u.subscribe,u.shown,u.shown),[D,y]=r(null),x=t(null),T=i(()=>{x.current?.(),x.current=null},[]),b=i(()=>{T(),u.end(),y(null)},[u,T]);n(()=>u.subscribe(()=>{u.get()||(T(),y(null))}),[u,T]),n(()=>T,[T]);const k=i((e,t)=>{y(n=>n&&n.key===e&&n.side===t?n:{key:e,side:t})},[]),E=i(e=>{y(t=>t&&t.key===e?null:t)},[]),A=(e,t,n,r)=>!("into"===n?r===e.key:void 0!==e.from&&w(e.from,t))&&c.current.canDrop(e.item,t);return{dragging:d?.item??null,row:(e,t)=>{const{keyOf:n,readOnly:r}=c.current,o=n(e.item),i=!r&&!e.pinned&&!1!==e.canDrag,l=t=>{const n=t.currentTarget.getBoundingClientRect();return v(e,t.clientY,n.top,n.height)},a={draggable:i||void 0,onDragStart:i?t=>{const n=t.currentTarget;u.start({key:o,item:e.item,from:e.place}),t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",o)}catch{}n.classList.add("is-lifting");const r=n.getBoundingClientRect();t.dataTransfer.setDragImage?.(n,t.clientX-r.left,t.clientY-r.top),n.ownerDocument.defaultView?.setTimeout(()=>n.classList.remove("is-lifting"),0);const i=s(n);T(),x.current=i?g(i):null}:void 0,onDragEnd:i?()=>b():void 0,onDragOver:e=>{const t=u.get();if(!t)return;const n=l(e);A(t,n.to,n.side,o)?(e.preventDefault(),e.dataTransfer.dropEffect=p(e.dataTransfer.effectAllowed),k(o,n.side)):E(o)},onDrop:e=>{const t=u.get();if(!t)return;const n=l(e);A(t,n.to,n.side,o)&&(e.preventDefault(),b(),c.current.onDrop(t.item,n.to))},onKeyDown:t=>{if("ArrowUp"!==t.key&&"ArrowDown"!==t.key)return;if(!t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;if(t.preventDefault(),t.repeat||!i)return;const{onStep:n,canStep:r}=c.current,o="ArrowUp"===t.key?-1:1;n&&!1!==r?.(e.item,o)&&n(e.item,o)}};return{draggable:i,dragging:d?.key===o,drop:D?.key===o?D.side:void 0,rowProps:h(a,t)}},seam:(t,n)=>{const r=(o=t.place,`seam:${e(o)}:${o.index}`);var o;const i={onDragOver:e=>{const n=u.get();n&&(A(n,t.place,"before",r)?(e.preventDefault(),e.dataTransfer.dropEffect=p(e.dataTransfer.effectAllowed),k(r,"before")):E(r))},onDrop:e=>{const n=u.get();n&&A(n,t.place,"before",r)&&(e.preventDefault(),b(),c.current.onDrop(n.item,t.place))}};return{drop:D?.key===r,seamProps:h(i,n)}},rootProps:e=>h({onDragEnter:e=>{if(!u.get()||x.current)return;const t=f(e.currentTarget);x.current=t?g(t):null},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||y(null)}},e)}}export{l as AUTO_SCROLL_EDGE,c as AUTO_SCROLL_MAX_SPEED,u as autoScrollDelta,a as autoScrollSpeed,m as createDragSession,p as dropEffectFor,v as dropOnRow,d as frameScrollBox,y as gapToMoveIndex,w as isNoOpDrop,f as scrollBoxOf,s as scrollParent,g as startAutoScroll,x as stepGap,T as useTreeDrag};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useSectionOps as o}from"./chunk-NHY5L3SE.js";import{SELECTION_MODE as e}from"./chunk-CBICQ4J3.js";import{decodePartId as r,encodePartId as t}from"./chunk-IYT6NN2J.js";import{useEasel as n}from"./chunk-ROPYFLNZ.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};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-JBOSEHIX.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-2E2SXDYQ.js";import{useEaselKeyTarget as a,useEaselUndoKeys as c,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-KC24D76S.js";import{SlotChildActionsProvider as f}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-C56MPJBH.js";import{usePartBridge as y}from"./chunk-A42LPWNM.js";import{useSectionOps as v}from"./chunk-NHY5L3SE.js";import{ScreenSaveIcon as k,ScreenMainButton as b}from"./chunk-PY7OOQEZ.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-EW6XAMDZ.js";import{keepsSharedSections as z,sharedSectionsOf as C}from"./chunk-43AEUUNQ.js";import{SidePanelHead as N,PanelShowStrip as I}from"./chunk-SINAM2IT.js";import{offeredChoices as B}from"./chunk-M2Z775ZC.js";import{useScreenSaveSwitch as O,useScreenNodeKeys as P,useScreenPinned as $,useScreenDocumentLabel as M,useScreenCanvasFrame as L,useScreenInspectorPanel as j,useScreenDevices as A,useScreenPickFollowsSelection as E,useScreenLeftView as T,SELECTION_MODE as R,sameInspectorMode as D,useScreenBridges as F,useScreenBlockRules as H,useScreenBlockLook as W,useScreenStorageNamespace as V,useScreenNotify as U,useScreenCanvasHead as J,isSlotMode as Y,useScreenStyleClipboard as K,useScreenDocumentPass as G,useScreenCanvasDrag as Z,ScreenCanvasTargetProvider as Q,isPinnedFirst as X,isPinnedLast as _,screenSlotsOf as q}from"./chunk-CBICQ4J3.js";import{MediaPopup as ee}from"./chunk-MS2U6MV5.js";import{useNodeClipboard as ne,useNodeContextMenu as te}from"./chunk-QALW2ECZ.js";import{PageEditGuardNotices as oe}from"./chunk-5DPIGWUL.js";import{useScreenDocument as re}from"./chunk-M62P4IQK.js";import{requestMediaPick as ie}from"./chunk-RYNBSKE7.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-LNHT2KPX.js";import{useEaselSession as pe}from"./chunk-O7Q4DDJT.js";import{useEaselHost as ue,useHostEscape as fe}from"./chunk-U3JP4VGF.js";import{LayersIcon as he,MediaIcon as me}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ge}from"./chunk-23DYNW6S.js";import{heldStyle as ye,styleShortcut as ve}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ke}from"./chunk-6WY6ZXJG.js";import{rootRowName as be,slotChildRowName as Se,slotChildRenameProp as we,sectionRenameProp as xe}from"./chunk-BHRC3ASL.js";import{ROOT_ZONE as ze,blockNodeActions as Ce,TREE_MAX_DEPTH as Ne,childSlotsOf as Ie,slotFieldsOf as Be,newNodeId as Oe,slotChildrenIn as Pe,nestsInTree as $e}from"./chunk-PLVEGYK6.js";import{useEasel as Me,useEaselApi as Le,CanvasPassThroughContext as je,CanvasSharedContext as Ae}from"./chunk-ROPYFLNZ.js";import{TreeRow as Ee,Subtree as Te,LayersTree as Re,TreeGroupLabel as De,TreeRowAction as Fe,TreeSeam as He}from"./chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as We}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ve}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ue,useNodeOps as Je,clickPick as Ye}from"./chunk-BSHIQIZC.js";import{EaselTopBar as Ke,TopBarCluster as Ge,EaselIconButton as Ze,TopBarDivider as Qe,DeviceSwitch as Xe,InspectorIconButton as _e,PanelResizeHandle as qe,MAX_PANEL_W as en,MIN_PANEL_W_BY_SIDE as nn,panelWidthVars as tn}from"./chunk-ZG6PVMC3.js";import{DEFAULT_NOTICE_WORDS as on,DEFAULT_CHROME_WORDS as rn}from"./chunk-AJSDWWJW.js";import{holderOf as ln,nameOrSomeone as sn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as dn}from"./chunk-RE4LP46F.js";import{useWords as an}from"./chunk-MFIRYGHW.js";import{insertSeams as cn,CanvasDragLayer as pn,CanvasInsert as un}from"./chunk-LDEEFLE3.js";import{DEFAULT_DRAG_WORDS as fn}from"./chunk-KAML3KQH.js";import{createDragSession as hn,useTreeDrag as mn,gapToMoveIndex as gn}from"./chunk-3S5N4HLJ.js";import{useCanvasFrame as yn,LIST_SELECTOR as vn,BLOCK_SELECTOR as kn,useCanvasTyping as bn,useCanvasEvent as Sn,nodeIdAt as wn,frameRectToHost as xn,BLOCK_ATTRIBUTE as zn,drawnBox as Cn}from"./chunk-QIDRJH3S.js";import{queryMainCopy as Nn}from"./chunk-LF3FUSCQ.js";import{ROOT_ID as In,ROOT_SLOT as Bn,zoneKey as On,parseZoneKey as Pn,find as $n,DataError as Mn}from"./chunk-K7BTCBWD.js";import{useRef as Ln,useMemo as jn,useState as An,useEffect as En,useCallback as Tn,useLayoutEffect as Rn,Fragment as Dn,useId as Fn}from"react";import{ColoredBadge as Hn,Tabs as Wn,toast as Vn,readMediaFileDrag as Un,Tooltip as Jn,groupColors as Yn,Dialog as Kn,FormField as Gn,Input as Zn,Button as Qn,MEDIA_FILE_DRAG_TYPE as Xn}from"efficient-shell/ui";import{UndoIcon as _n,RedoIcon as qn,RefreshIcon as et,AddIcon as nt,TrashIcon as tt,EyeOffIcon as ot,EyeIcon as rt,SharedIcon as it,DuplicateIcon as lt}from"efficient-shell/icons/efficient";import{jsx as st,jsxs as dt,Fragment as at}from"react/jsx-runtime";var ct="media-file";function pt({name:e,onMake:n,onCancel:t}){const o=an("screen",ge).shared,[r,i]=An(e),[l,s]=An(!1),d=Fn(),a=Ln(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
+
return st(Kn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */dt(at,{children:[
|
|
3
|
+
/* @__PURE__ */st(Qn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
+
/* @__PURE__ */st(Qn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */st("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */st(Gn,{label:o.name,htmlFor:d,children:/* @__PURE__ */st(Zn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var ut=/* @__PURE__ */new WeakSet;function ft(e,n,t){const o=$n(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function ht({canvas:e,tabs:n,onSelect:t}){const o=Ln(null),[r,i]=An({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Rn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=xn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=Nn(t,`[${zn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?Cn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=xn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */st("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */st("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
|
|
5
|
+
/* @__PURE__ */st(Jn,{content:e.reach,children:/* @__PURE__ */dt(Hn,{colorClass:Yn("success","solid"),size:"sm",children:[
|
|
6
|
+
/* @__PURE__ */st("span",{className:"es-band-tab-mark",children:/* @__PURE__ */st(it,{size:12})}),e.label]})}):/* @__PURE__ */st(Hn,{colorClass:Yn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function mt({expand:e}){/* @__PURE__ */
|
|
7
|
+
return st("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */dt(at,e?{children:[
|
|
8
|
+
/* @__PURE__ */st("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
+
/* @__PURE__ */st("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
+
/* @__PURE__ */st("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
+
/* @__PURE__ */st("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
+
/* @__PURE__ */st("path",{d:"M5 12h14"})]})})}var gt=`${vn}, ${kn}`;function yt(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var vt="__rungs";var kt="screen:band",bt={duplicate:!0,delete:!0};function St(){const vn=ue(),{target:xn,docId:zn,capabilities:Cn,currentSlug:Fn,siteId:Jn,onPublish:Yn,saveState:Kn,saveConflict:Gn,retrySave:Zn,toggleAutoSave:Qn,flushSave:it,access:St,saveUnreachable:wt=!1,readOnly:xt,readOnlyReason:zt=null}=re(),Ct=O(),Nt=P(),{mediaEditing:It,hasEditGuard:Bt,hasPinnedChrome:Ot}=Cn,{appState:Pt,dispatch:$t,history:Mt,selectedItem:Lt,getSelectorForId:jt,config:At}=Me(e=>e),Et=$(),{first:Tt,firstGroup:Rt,lastGroup:Dt,isSectionGroup:Ft,sectionGroupZone:Ht,panelOf:Wt}=Et,Vt=Wt(Tt),Ut=e=>X(Et,e),Jt=e=>_(Et,e),Yt="node"===Et.firstRow,Kt=Et.band??null,Gt=an("screen",ge),Zt=an("tree",We),Qt=an("drag",fn),Xt=an("notice",on),_t=an("lock",dn),qt=an("menu",Ve),eo=an("styleClipboard",ke),no=an("chrome",rn),to=M()??`/${Fn}`,oo=L(),ro=j(),io=v({readOnly:xt}),lo=v({readOnly:xt,foldIntoHistory:!0}),so=Ln(null),ao=Le(),co=jn(()=>({...io,select:e=>{so.current=e,io.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=ao.config;so.current=Ue(e,t,n)}io.commitDocument(e,n)}}),[io,ao]),po=Pt.ui,uo=po.leftSideBarVisible,fo=po.rightSideBarVisible,{options:ho,widths:mo,initial:go,fluid:yo,fit:vo}=A(),[ko,bo]=An(go),So=le(),wo=It&&null!==So,xo=se(),zo=de(),Co=null!==xo||zo,No=ae();E(Lt?.props.id);const{read:Io,write:Bo,forSelection:Oo}=T(),[Po,$o]=An(Io);En(()=>{Bo(Po)},[Po]);const[Mo,Lo]=An(0),jo=Ln(null),Ao=Ln(null),Eo=yn(Ao,{readySelector:gt}),To=bn(Eo),Ro=a(Ao);c(Ao,Eo);const Do=S(),Fo=ln(St),Ho={state:Kn,offline:Do||Kn.failed&&wt,readOnlyReason:zt,editing:Fo?Xt.editing({name:sn(Fo.name,_t),noun:Gt.noun}):null,conflict:null!=Gn,notSaving:Gt.bar.notSaving},Wo=()=>{xt||(Kn.failed?Zn():it())};p(Ao,Eo,Wo);const[Vo,Uo]=An(!1),Jo=Ln(!1),[Yo,Ko]=An(null),[Go,Zo]=An([]),[Qo,Xo]=An(R),_o="puck"===Qo.kind,qo=o(Qo,Lt?.props.id),[er,nr]=An(null);En(()=>{er&&(r(),nr(null))},[er]);const tr=Ln(jt);tr.current=jt;const or=Tn((e,{scroll:n})=>{$o(n=>Oo(e,n)),n&&nr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=tr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Mr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),rr=Ln(null);En(()=>{const e=rr.current;rr.current=null;const n=null==Lt?.props.id?null:String(Lt.props.id);Xo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Wt(Lt?.type)??R);const t=Lt?.props.id,o=so.current;if(so.current=null,!t)return;const r=jt(t);or(String(t),{scroll:!i(o,r??null,ze)})},[Lt?.props.id,or]);const ir=Tn(e=>{Xo(n=>D(n,e)?n:e),$t({type:"setUi",ui:{rightSideBarVisible:!0}})},[$t]),lr=Ln(()=>{});lr.current=(e,n)=>{const t=e?Oi(e.zone??ze)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Lt?.props.id?null:String(Lt.props.id);Xo(e=>D(e,n)?e:n),o!==r&&(rr.current={id:o,mode:n},co.select(e))};const sr=Tn((e,n)=>lr.current(e,n),[]),dr={kind:Qo.kind,mode:Qo,open:ir,show:e=>Xo(e),reveal:()=>{fo||$t({type:"setUi",ui:{rightSideBarVisible:!0}})},select:sr},ar=F(dr,{data:Pt.data,selected:Lt??null,zoneOf:e=>jt(e)?.zone,readOnly:Boolean(xt),select:e=>{Xo(R),co.select({index:e})},replace:(e,n)=>co.replaceComponent(ze,e,n),scrollTo:e=>l(e)},{device:ko,refreshes:Mo},{setView:$o,reveal:()=>{uo||$t({type:"setUi",ui:{leftSideBarVisible:!0}})}}),cr=ar.resolveLeftView?ar.resolveLeftView(Po):"sections",pr=H(),{isLockedBlock:ur,duplicateBlocked:fr,nestDepth:hr,newSectionNode:mr,canAddTo:gr,blockIsOffered:yr}=pr,vr=W(),{labelAtLevel:kr,Icon:br,useProducts:Sr}=vr,wr=vr.rowName?(e,n,t)=>vr.rowName(e,n,t):void 0,xr=Tn(e=>{$t({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),or(e,{scroll:!0})},[$t,or]),{selectNode:zr,openPartId:Cr}=y({mode:Qo,setMode:Xo,onOpenPart:xr}),[Nr,Ir]=An(null);fe(null!==Nr,()=>Ir(null));const Br=h(V()),Or=Br.collapsed,Pr=Br.panelWidths,[$r,Mr]=An(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Or);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
+
return new Set}});En(()=>{try{window.localStorage.setItem(Or,JSON.stringify([...$r]))}catch{}},[$r]);const[Lr,jr]=An(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem(Pr);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left,"left"),right:g(Number(n.right)||m.right,"right")}}catch{return{...m}}});En(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Pr,JSON.stringify(Lr))}catch{}},300);return()=>clearTimeout(e)},[Lr]);const Ar=Tn((e,n)=>jr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Er=Tn(e=>Ar("left",e),[Ar]),Tr=Tn(e=>Ar("right",e),[Ar]),Rr=e=>$r.has(e),Dr=e=>Mr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Fr=Ln(!1),Hr=Ln(null);En(()=>{if(Fr.current&&!Vo){const e=Hr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Ao.current?.querySelector(`button[aria-label="${CSS.escape(Gt.add.title)}"]`))?.focus(),Hr.current=null}Fr.current=Vo},[Vo]),En(()=>{if(!Vo||!Ro)return;const e=e=>{"Escape"===e.key&&sl()};return Ro.addEventListener("keydown",e),()=>Ro.removeEventListener("keydown",e)},[Vo,Ro]),fe(Vo,()=>sl()),En(()=>{!uo&&Vo&&(Uo(!1),Ko(null),Jo.current=!1)},[uo]);const Wr=U(),Vr=(e,n="success",t)=>{if(Wr)return void(t?Wr(e,"error"===n?"error":"info",t):Wr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Vn.error(e,{...o,duration:t?.duration??3200}):Vn.success(e,{...o,duration:t?.duration??1900})},Ur=Ln(null),[Jr,Yr]=An(0),[Kr,Gr]=An(0),Zr=J(),Qr=Ln(null),Xr=e=>Math.max(0,e.clientHeight-(Qr.current?.offsetHeight??0));En(()=>{const e=Ur.current;if(!e)return;const n=()=>{Yr(e.clientWidth),Gr(Xr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Qr.current&&t.observe(Qr.current),()=>t.disconnect()},[]),Rn(()=>{Ur.current&&(Yr(Ur.current.clientWidth),Gr(Xr(Ur.current)))},[Lr,uo,fo]);const _r=ko===yo?Jr>0?Jr:mo[yo]:mo[ko],qr=Jr>0?Math.min(Jr/_r,"shrink"===vo?1:2):1,ei=_r*qr,ni=Jr>0&&ei>Jr+1,ti={width:ei,height:Kr||"100%",flex:"none",position:"relative"},oi={width:_r,height:Kr?Kr/qr:"100%",maxHeight:"none",transform:1!==qr?`scale(${qr})`:void 0,transformOrigin:"top left"},ri=()=>$t({type:"setUi",ui:{leftSideBarVisible:!uo}}),ii=()=>$t({type:"setUi",ui:{rightSideBarVisible:!fo}}),li=e=>{Vo&&(Uo(!1),Ko(null),Jo.current=!1,uo&&Po===e)||($o(e),uo||$t({type:"setUi",ui:{leftSideBarVisible:!0}}))},si=()=>{ie(vn,{accept:"image/*",title:no.mediaLibrary})},di=()=>{Xo(R),co.select(null),d()},ai=()=>{Xo(Vt??R),fo||$t({type:"setUi",ui:{rightSideBarVisible:!0}})},ci=Pt.data.content??[],pi=()=>{const e=ci.findIndex(Ut),n=ci.findIndex(Jt);return{floor:e>=0?e+1:0,cap:n>=0?n:ci.length}},ui=At,fi=pr.stripCopy,hi=n=>e(n,fi),mi=ne(),gi=Je({data:Pt.data,config:ui,readOnly:Boolean(xt),clipboard:mi,strip:fi?e=>fi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==In||e.slot!==Bn)return{min:0,max:n-1};const{floor:t,cap:o}=pi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Xo(R);const t=void 0===n||"node"===n?.kind?n:null;co.commitDocument(e,t)}}),yi=pe(),[vi,ki]=An(null),bi=e=>{const n=ci.find(n=>String(n.props.id)===e),t=Et.shared;n&&t&&gi.swap(e,t.detach(n))},Si=e=>{const n=$n(Pt.data,At,e);if(!n)return!1;const t=On(n.place),o=n.node,r=t===ze?Ni(o):Fi(o),i=t===ze?Et.shared?.usedOn(o):null;return!!gi.remove(e)&&(Vr(i?Gt.shared.removed({count:Math.max(0,i.length-1)}):Gt.deleted({name:r}),"success",{duration:8e3,action:{label:Gt.bar.undo,onClick:()=>{gi.restore(n.node,n.place)}}}),!0)},wi={...gi,remove:Si},xi=e=>kr(e,"block",At.components[e]?.label??e),zi=Tn(e=>At.components[e]?.defaultProps??{},[At]),Ci=e=>kr(e,"section",xi(e)),Ni=e=>be({type:e.type,props:e.props??{}},Ci(e.type),wr),{nodeAddresses:Ii,zoneItems:Bi}=jn(()=>{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>=Ne)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Ie(At,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(ci,ze,0),{nodeAddresses:e,zoneItems:n}},[ci,At]),Oi=Tn(e=>Bi.get(e)??[],[Bi]),Pi=e=>{const n=Ii.get(e);return n?Oi(n.zone)[n.index]:void 0},$i=e=>q(pr,At,e),Mi=e=>{if(!pr.slotsOf||e===ze)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Pi(e.slice(0,n));if(!t)return null;const o=$i(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}},Li=(()=>{if(!Y(Qo))return null;const e=`${Qo.nodeId}:${Qo.slot}`;return Mi(e)?.slot.panel===Qo.kind?e:null})(),ji=Ln(null);En(()=>{const e=ji.current;if(ji.current=null,!Li||!Y(Qo))return;const n=Qo.nodeId;or(n,{scroll:e!==Li}),Mr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Qo]);const Ai=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Ii.get(e);n&&(n.zone===ze?el(n.index):Il(n.zone,n.index,e,Pi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Li!==i&&(ji.current=i),sr(null,r),fo||$t({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ei=(e,n,t)=>{const o=`${e}:${n}`;if(Mr(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;Li!==o&&(ji.current=o);sr(null,{kind:t,nodeId:e,slot:n})},Ti=(e,n,t)=>{if(xt||!pr.moveSlot)return;const o=Pi(e),r=o?$i(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:vt,index:n},s=gn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=pr.moveSlot(e,n,s);"string"==typeof d&&Ei(e,d,i.panel)},Ri=Sr(),Di=jn(()=>{const e=/* @__PURE__ */new Map;for(const n of Ri??[])e.set(n.slug,n.name);return e},[Ri]),Fi=e=>Se(e,xi,vr.plainText,e=>Di.get(e),vr.rowName),Hi=(e,n)=>{const t=At.components[e.type]?.fields,o=n===ze||ql(n)?"section":"block",r=n===ze&&(Ut(e)||Jt(e)||Ft(e.type)),i="block"===o?we(t):r?null:xe(t);return vr.renamePropOf?vr.renamePropOf(e,o,i):i},Wi=(e,n,t,o)=>{if(!(!xt&&Nr?.zone===e&&Nr.index===n))return;const r=(t,o)=>{Ir(null),o&&((e,n,t)=>{const o=Oi(e)[n];if(!o)return;const r=Hi(o,e);r&&co.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
+
return st("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Gt.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)},Vi=t(K(),eo),Ui=Vi.scope({target:xn,siteId:Jn,docId:zn}),Ji=At,Yi=(e,n)=>n===ze?Ci(e):xi(e),Ki=(e,n,t)=>{const o=Vi.plan(Ui,t,Yi(t.type,e),Ji);o&&(o.changed&&co.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Vr(o.message))},Gi=te({nodesIn:Oi,nodeAt:(e,n)=>Oi(e)[n]??null,labelOf:(e,n)=>n===ze?Ci(e):xi(e),renamePropOf:Hi,beginRename:(e,n)=>Ir({zone:e,index:n}),history:{hasPast:Mt.hasPast,hasFuture:Mt.hasFuture,back:()=>Mt.back(),forward:()=>Mt.forward()},openPageSettings:()=>{co.select(null),Xo(R)},pageSettingsLabel:Gt.pageSettings,words:{menu:qt,styleClipboard:eo,screen:Gt.menu},readOnly:Boolean(xt),collapseAll:()=>Mr(new Set(Oi(ze).map(e=>String(e.props.id)))),onPasteRefused:e=>Vr(e?Gt.pasteRefused({name:e.label}):Gt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ts(e,n),menuRows:(e,n,t)=>{const o=ar.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Et.shared;if(!t||n!==ze)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:Gt.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return xt||ur(e.type,e)?n:{...n,change:[{label:Gt.shared.detach,onClick:()=>bi(e.props.id)}],remove:[{label:Gt.shared.removeFromPage,danger:!0,onClick:()=>{Si(e.props.id)}}]}}return xt||Ut(e)||Jt(e)||Ft(e.type)?null:z(yi)?{change:[{label:Gt.shared.makeShared,onClick:()=>ki({id:e.props.id,name:Ni(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>ur(e.type,e),duplicateBlocked:e=>fr(Pt.data,e),permits:e=>{const n=Ce(At,e.type);return Et.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:wi,isPinned:(e,n)=>n===ze&&(Ut(e)||Jt(e)),sectionBand:pi,locate:e=>Ii.get(e)??null,rowNameOf:(e,n)=>n===ze?Ni(e):Fi(e),selectAt:(e,n,t,o)=>{e===ze?el(n):Il(e,n,t,o??"")},slotRung:e=>{const n=Mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ai(n.node,n.slot,!1)}:null},style:{held:()=>ye(Ui),canCopy:e=>Vi.rows(Ji,e).some(e=>!1!==e.counted),copy:(e,n)=>Vi.copy(Ui,e,Yi(e.type,n),Ji),paste:(e,n,t)=>Ki(e,n,t)},keys:Nt?{target:Ro,selected:()=>{const e=Pt.ui.itemSelector;return e?{zone:e.zone??ze,index:e.index}:null},held:()=>mi.get(),readOnly:Boolean(xt),onDone:({done:e,name:n})=>{"copied"===e&&Vr(Gt.copied({name:n}))}}:void 0},Eo),Zi=Ln({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});En(()=>{Zi.current={copy:(e,n)=>Vi.copy(Ui,e,Yi(e.type,n),Ji),paste:Ki,at:()=>{const e=Pt.ui.itemSelector;if(!e)return null;const n=e.zone??ze,t=Oi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(xt)}});const Qi=Tn(e=>{const n=ve(e);if(!n)return;const t=Zi.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))},[]);En(()=>{if(!Ro)return;const e=e=>Qi(e);return Ro.addEventListener("keydown",e),()=>Ro.removeEventListener("keydown",e)},[Qi,Ro]),Sn(Eo,"keydown",Qi);const Xi=ci.map(e=>e.props.id).join("|");En(()=>{const e=Eo?.document??null,n=Eo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Zo(e=>e.length?[]:e);const n=ci.findIndex(Jt),t=n>=0?n:ci.length,o=n=>{const t=ci[n]?.props?.id;return null==t?null:Nn(e,`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(kn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=ci.length>0&&!Ut(ci[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=yt(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Zo(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()}},[Eo,Xi,ko,qr,uo,fo,Lt?.props.id]);const _i=Eo?.document??null,qi=Eo?.window??null;En(()=>{const e=jo.current;if(!e||!_i||!qi)return;const n=[],t=()=>{const n=Nn(_i,`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&qi.scrollTo({left:qi.scrollX,top:qi.scrollY+t,behavior:"instant"}),!0};return jo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[_i,qi]);const el=e=>{Xo(R),co.select({index:e}),ar.sectionPressed?.(ci[e]);const n=ci[e]?.props?.id;n&&l(n)},nl=e=>{const{floor:n,cap:t}=pi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Lt&&Qo.kind!==Vt?.kind?ci.findIndex(e=>e.props.id===Lt.props.id):-1;return o(r>=0?r+1:t)},tl=(e,n)=>{const{floor:t,cap:o}=pi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(co.reorderComponent(ze,e,i),co.select({index:i}),{moved:!0,dest:i})},ol=(e,n,t,o)=>{Xo(R),co.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Vr(Gt.sectionAdded({name:t}))},rl=(e,n)=>{const t=nl(n),o=mr(e,{nodeDefaults:zi,newNodeId:Oe,sectionLabel:Ci,blockIsOffered:yr}),r=o?co.insertNode(ze,t,o):co.insertSection(e,t);return ol(t,r,Ci(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:a}of Ie(At,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=gr(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:a,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},il=e=>ll(ze,e),ll=(e,n)=>{Hr.current=document.activeElement??null,Ko(null===n?null:{zone:e,index:n}),Uo(!0),uo||(Jo.current=!0,$t({type:"setUi",ui:{leftSideBarVisible:!0}}))},sl=()=>{Uo(!1),Ko(null),Jo.current&&$t({type:"setUi",ui:{leftSideBarVisible:!1}}),Jo.current=!1},dl=(e,n)=>vr.rowName?n?Ut(e)?vr.rowName(e,"section",Gt.header):Jt(e)?vr.rowName(e,"section",Gt.footer):Ft(e.type)?vr.rowName(e,"section",xi(e.type)):Ni(e):Fi(e):n?Ci(e.type):xi(e.type),al=e=>n=>{e()},cl=(e,n,t)=>{if(xt)return null;const o=Oi(e)[n];return o&&!Ce(At,o.type).delete||o&&ur(o.type,o)?null:/* @__PURE__ */st(Fe,{kind:"delete",label:e===ze&&o&&Et.shared?.usedOn(o)?Gt.shared.removeFromPage:Gt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Oi(e)[n]?.props?.id;null!=t&&Si(String(t))})(e,n),children:/* @__PURE__ */st(tt,{size:15})})},pl=e=>vr.rowPreview?.(e)||void 0,ul=e=>vr.rowMarks?.(e)??void 0,fl=(e,n,t)=>vr.rowActions?.(e,n,t)??null,hl=(e,n,t,o)=>{if(xt)return null;if(ur(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
+
return st(Fe,{kind:"eye",label:r?Gt.showNamed({name:o}):Gt.hideNamed({name:o}),onClick:()=>gl(e,n,t),children:/* @__PURE__ */st(r?ot:rt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},ml=e=>Ws(ze,e),gl=(e,n,t)=>{co.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},yl=e=>Be(At,e),vl=e=>Ie(At,e),kl=e=>pr.slotsOf?$i(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Pe(e,n.slot)})):[{slot:null,rung:null,kids:vl(e)}],bl=e=>pr.slotsOf?kl(e).flatMap(e=>e.kids):vl(e),Sl=e=>Boolean(pr.slotsOf)&&$i(e).some(e=>e.rung),wl=(e,n,t)=>null===t?void 0===n?gr(e):gr(e,n):gr(e,n,t),xl=(e,n,t)=>{const o=$e(At,e.type,n)&&(t||bl(e).length>0||Sl(e));return{collapsible:o,folded:o&&Rr(String(e.props.id))}},zl=(e,n,t)=>kl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>xl(e,r,t(e.type)).collapsible?[String(e.props.id),...zl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Cl=e=>bl(e).length>0||Sl(e)||Boolean(gr(e.type)),Nl=e=>Boolean(gr(e)),Il=(e,n,t,o)=>{if(Xo(R),gr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),co.select({index:n,zone:e}),l(t)}else co.select({index:n,zone:e}),l(t)},Bl=(e,n,t,o,r)=>{const i=`${e}:${n}`;co.insertComponent(i,t,o),gr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),co.select({index:o,zone:i})}):co.select({index:o,zone:i})},Ol=Ln(/* @__PURE__ */new Set);En(()=>{ci.forEach(e=>{const n=gr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Ol.current.has(t))return;Ol.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(zi)).forEach((e,t)=>lo.seedChild(o,t,n.childType,e))})},[ci,lo,zi]);const Pl=Ln(/* @__PURE__ */new Set);En(()=>{ci.forEach((e,t)=>{const o=e.props.id;if(Pl.current.has(o))return;const r=n(e,yl(e.type));Pl.current.add(o),r&&lo.replaceComponent(ze,t,{...e,props:r})})},[ci,lo]),G(lo,At);const $l=ci.findIndex(Jt),Ml=$l>=0?ci[$l]:null,Ll=Yt?ci.findIndex(Ut):-1,jl=Ll>=0?ci[Ll]:null,Al=Et.groupTab,El=jn(()=>Al?e=>Ft(e.type):void 0,[Al]),Tl=Boolean(Et.groupBadge),Rl=Et.sharedReach,Dl=e=>Rl?.(e)??void 0,Fl=jn(()=>Rl?new Set(ci.filter(e=>Dl(e)).map(e=>String(e.props.id))):null,[ci,Rl]),Hl=jn(()=>Fl?e=>Fl.has(e):void 0,[Fl]),Wl=Et.first?Rl?.({type:Et.first,props:{id:""}})??void 0:void 0,Vl=Et.groupBadge?/* @__PURE__ */st("span",{className:"es-tree-group-badge",children:/* @__PURE__ */st(Hn,{tone:"info",size:"xs",children:Et.groupBadge})}):void 0,Ul=ci.find(e=>e.type===Rt)??null,Jl=ci.find(e=>e.type===Dt)??null,Yl=$l>=0?$l:ci.length,Kl=[];ci.forEach(e=>{Jt(e)||(Cl(e)&&Kl.push(String(e.props.id)),Kl.push(...zl(e,1,Nl)))}),Ml&&(Kl.push(String(Ml.props.id)),Kl.push(...zl(Ml,1,Nl)));const Gl=Kl.length>0&&Kl.every(e=>$r.has(e)),Zl=e=>{const n=vr.blockRowName(e,xi);return vr.rowName?vr.rowName(e,"block",n):n},Ql=(e,n,t,o)=>{const r=Oi(e)[t];if(!r)return;const i={...Pn(e),index:t},l={...Pn(n),index:Math.min(Math.max(o,0),Oi(n).length)},s=gn(i,l);if(e!==n||s!==t)try{gi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Mn))throw e}},Xl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of vl(e))n.add(r),t(o)};for(const t of yl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},_l=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Ii.get(n);if(!e)return null;if(e.zone===ze)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ql=e=>{const n=e.slice(0,e.indexOf(":")),t=ci.find(e=>Ft(e.type)&&String(e.props.id)===n);return t&&Ht(n)===e?t:null},es=(e,n)=>{const t=ql(e);return!t||(!Et.groupAccepts||Et.groupAccepts(t.type,n,Oi(e).length))},ns=(e,n,t)=>{if(e.rung){const t=Pi(e.rung.nodeId),o=t?$i(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===vt&&n.index>=0&&n.index<=o}if(n.slot===vt)return!1;if(e.add)return is(e.add,n);const o=On(n);if(Ft(e.type))return!1;const r=ql(o),i=ql(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!es(o,e.type))&&(n.index>=0&&n.index<=Oi(o).length));if(e.zone===ze||o===ze){if(e.zone!==o)return!1;const{floor:t,cap:r}=pi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Oi(o).length)return!1;if(e.zone===o)return!0;const l=Ml&&!Et.lastIsOpen?String(Ml.props.id):null;return(!l||_l(e.zone)!==l&&_l(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Oi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Ii.get(i),s=l?Oi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Xl(r).has(n))return!1;const d=gr(s.type,hr(Pt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Oi(n),r))})(e.zone,o,e.index,t)},ts=(e,n)=>{const t=On(e.from),o=e.node;return t===On(n)?es(t,o.type):ns({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},os=e=>{const n=e.slice(0,e.indexOf(":")),t=Ii.get(n),o=t?Oi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=gr(o.type,hr(Pt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=B(r.choices??(r.spec?[{type:r.spec.childType,label:xi(r.spec.childType)}]:[])),l=Mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:dl(o,t.zone===ze)}},rs=(e,n)=>{if("section"!==e.kind)return e;const t=On(n);return t===ze||ql(t)?e:os(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},is=(e,n)=>{const t=rs(e,n),o=On(n);if("shared"===t.kind){if(o!==ze||!Et.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=pi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ql(o)){const e="section"===t.kind?t.type:t.template.node.type;return es(o,e)&&n.index>=0&&n.index<=Oi(o).length}if(o!==ze)return!1;const{floor:e,cap:r}=pi();return n.index>=e&&n.index<=r}if(o===ze)return!1;const r=os(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Oi(o))},ls=(e,n)=>{const t=rs(e,n);if("block"!==t.kind&&ql(On(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&es(n,o)){if("section"===e.kind)co.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;co.insertNode(n,t,hi(e.template.node))}Xo(R),co.select({index:t,zone:n})}})(t,On(n),n.index);if("section"===t.kind)return void rl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=nl(t),r=co.insertNode(ze,o,n);ol(o,r,e)})(t.template.name,hi(t.template.node),n.index);if("shared"===t.kind){const e=Et.shared?.nodeOf(t.section);if(!e)return;const o=nl(n.index);return void(gi.restore(e,{parentId:In,slot:Bn,index:o})&&ol(o,e.props.id,t.section.title))}const o=On(n),r=os(o);r&&(r.target.spec?Bl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{co.insertComponent(e,n,t),Xo(R),co.select({index:t,zone:e})})(o,t.type,n.index))},ss=(e,n)=>{e.media?function(e){const n=Ts();if(!n||!js)return;Ds(n).then(n=>{n&&function(e,n){if(!js)return;const t=js.create(e,{nodeDefaults:zi,newNodeId:Oe,sectionLabel:Ci,blockIsOffered:yr}),o=On(n);if(o===ze){const e=nl(n.index),o=co.insertNode(ze,e,t);return void ol(e,o,Ci(t.type))}co.insertNode(o,n.index,t),Xo(R),co.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Ti(e.rung.nodeId,e.index,n.index):e.add?ls(e.add,n):e.zone===ze?tl(e.index,n.index):Ql(e.zone,On(n),e.index,n.index)},[ds]=An(()=>hn()),as=mn({keyOf:e=>e.id,readOnly:Boolean(xt),session:ds,canDrop:ns,onDrop:ss,onStep:(e,n)=>{e.rung?Ti(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ze?((e,n)=>{const t=Ci(ci[e]?.type??""),o=tl(e,n<0?e-1:e+2);if(!o.moved)return void Vr(n<0?Gt.sectionFirst({name:t}):Gt.sectionLast({name:t}));const{floor:r,cap:i}=pi();Vr(Gt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Ql(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),cs=Tn(e=>{const{floor:n,cap:t}=pi(),o=[];for(const r of e.nodes){const e=On(r.place),i=Oi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Ut(i)||Jt(i)||ur(i.type,i))continue;if(Ft(i.type))continue;const l=Boolean(ql(e)),s=e===ze||l;e===ze&&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?Ci(i.type):Fi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=On(e.list);if(n===ze&&0===e.children.length)return[{...e,addLabel:Gt.addSection,addAlways:!0}];const t=os(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ql(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=On(e.list),t=n===ze||ql(n)?null:os(n);return t?.choices.length?cn(e,t.target.spec?.addLabel??Gt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Pt.data]),ps=null==Lt?.props.id?null:String(Lt.props.id),us=Tn(e=>{const n=At,t=e=>!e.item.rung&&null!==$n(Pt.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(ps);return i||(r(Ye(Pt.data,n,o.item.id,ps,El))??o)},[Pt.data,At,ps,El]),[fs,hs]=An(null),ms=Boolean(Al||Rl);Sn(Eo,"mouseover",e=>{if(!ms)return;const n=wn(e.target),t=n?ft(Pt.data,At,n):null;t!==fs&&hs(t)}),Sn(Eo,"mouseout",e=>{ms&&!e.relatedTarget&&hs(null)});const gs=e=>Ut(e)||Jt(e)||Ft(e.type),ys=e=>{const n=Ft(e.type)?xi(e.type):Ut(e)?Gt.header:Jt(e)?Gt.footer:null;return null===n?Ni(e):vr.rowName?vr.rowName(e,"section",n):n},vs=[];if(ms){const e=ps?ft(Pt.data,At,ps):null;for(const n of/* @__PURE__ */new Set([e,fs])){const e=n?ci.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Ut(e)||e.type===Rt,o=Dl(e);if(o){vs.push({id:String(e.props.id),label:ys(e),below:t,reach:o});continue}if(!Al||!gs(e))continue;const r=Al(e);r&&vs.push({id:String(e.props.id),label:r,below:t})}}const ks=pe(),bs=Ln(null);En(()=>{const e=Et.changeNotice;if(!e)return;const n=JSON.stringify(ci.filter(gs)),t=bs.current;if(bs.current={doc:zn,bands:n,index:Mt.index},!t||t.doc!==zn||t.bands===n)return;Mt.hasPast&&Mt.index>=t.index&&!ut.has(ks)&&(ut.add(ks),Vr(e,"success",{action:{label:Gt.bar.undo,onClick:()=>Mt.back()},duration:8e3}))},[ci]);const Ss=e=>{Xo(R),co.select(e.zone===ze?{index:e.index}:{index:e.index,zone:e.zone})},ws=Z(),xs=()=>({data:Pt.data,device:ko,ops:co,inspector:dr}),zs=ws?.model,Cs=jn(()=>zs?e=>zs(e,cs(e),xs()):cs,[zs,cs,ko]),Ns=ws?.measure,Is=Ns?(e,n)=>Ns(e,n,xs()):void 0,Bs=ws?.canDrop,Os=Bs?(e,n)=>Bs(e,n,ns,xs()):ns,Ps=ws?.drop,$s=Ps?(e,n)=>Ps(e,n,ss,xs()):ss,Ms=ws?.pick,Ls=Ms?e=>Ms(e,Ss,xs()):Ss,js=ws?.media??null,As=Ln(null),Es=jn(()=>js?{id:ct,zone:"",index:-1,type:js.adds.type,add:{kind:js.adds.kind,type:js.adds.type},media:!0}:null,[js]);En(()=>{if(!Es||xt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(Xn))(e)&&(As.current=null,ds.start({key:ct,item:Es}))},n=e=>{ds.get()?.item.media&&(As.current=Un(e.dataTransfer))},t=()=>{ds.get()?.item.media&&ds.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Es,xt,ds]);const Ts=()=>{const e=As.current;return As.current=null,e},Rs=ce(),Ds=async e=>{if(!Rs)return e;const n=await Rs(e);return n?{...e,id:n.id,url:n.url}:null};const Fs=(e,n)=>{if(!js)return;const t=$n(ao.getState().appState.data,ui,n);if(!t)return;const o=t.node;co.replaceComponent(On(t.place),t.place.index,{...o,props:{...js.replace(o,e),id:o.props.id}})},Hs=e=>{const n=On(e),t=Mi(n);t&&Ai(t.node,t.slot,!1),ll(n,e.index)},Ws=(e,n)=>/* @__PURE__ */st(He,{...xt?{}:as.seam({place:{...Pn(e),index:n}})},`seam:${e}:${n}`),Vs={rowClick:al,isCollapsed:Rr,toggleCollapse:Dr},Us=e=>{const n=String(e.props.id),t=ci.findIndex(e=>String(e.props.id)===n),o=Ht(n),r=Oi(o),i=Rr(n),l=xi(e.type),s=vr.rowName?vr.rowName(e,"section",l):l,d=e=>Ws(o,e);/* @__PURE__ */
|
|
16
|
+
return dt(at,{children:[
|
|
17
|
+
/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:e.type,size:13}),name:s,preview:pl(e),marks:ul(e),onSelect:()=>el(t),nameSlot:Wi(ze,t,n,s),selected:qo===n,badge:Dl(e)?void 0:Vl,shared:Dl(e),actions:fl(e,ze,t)??void 0,rowProps:{"data-node-id":n,onClick:al(()=>el(t))},fold:{open:!i,label:"section",onToggle:()=>Dr(n)}}),!i&&/* @__PURE__ */dt(Te,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ni(n),l=Cl(n),s=l&&Rr(r),a=()=>Il(o,t,r,e.type),{rowProps:c,...p}=as.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Pn(o),index:t}},{"data-node-id":r,onClick:al(a)});/* @__PURE__ */
|
|
18
|
+
return dt(Dn,{children:[d(t),
|
|
19
|
+
/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:n.type,size:13}),name:i,preview:pl(n),marks:ul(n),onSelect:a,nameSlot:Wi(o,t,r,i),selected:qo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Dr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(o,t,i),fl(n,o,t),hl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */st(Te,{children:Ks(n,2)})]},r)}),d(r.length)]})]})},Js=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=as.dragging,d=!Rr(l)&&s?.rung?.nodeId!==i,a={...Pn(l),index:0},c=s&&!s.rung&&ns(s,a)?a:void 0,p=()=>Ai(e,n,!0),{rowProps:u,...f}=as.row({item:{id:`rung:${l}`,zone:`${i}:${vt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:vt,index:t},into:c,canDrag:Boolean(pr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:al(p)}),h=xt?null:pr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
+
return dt(Dn,{children:[n.heading,
|
|
21
|
+
/* @__PURE__ */st(Ee,{words:Zt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Li===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Dr(l)},actions:h&&h.length>0?/* @__PURE__ */st(at,{children:h.map((t,o)=>/* @__PURE__ */st(Fe,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(xt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ei(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */st(tt,{size:15}):/* @__PURE__ */st(lt,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */st(Te,{children:r})]},l)},Ys=(e,n)=>{const t=kl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
+
return st(at,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=wl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Ws(e,n),p=/* @__PURE__ */dt(at,{children:[i.map(({child:n,zone:t,index:o})=>{const r=qo===String(n.props.id),{collapsible:i,folded:s}=xl(n,l,Nl(n.type)),d=String(n.props.id),a=Zl(n),p=()=>Il(t,o,d,e.type),{rowProps:u,...f}=as.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Pn(t),index:o}},{"data-node-id":d,onClick:al(p)});/* @__PURE__ */
|
|
23
|
+
return dt(Dn,{children:[0===o&&c(t,0),
|
|
24
|
+
/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:n.type,size:13}),name:a,preview:pl(n),marks:ul(n),onSelect:p,nameSlot:Wi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Dr(d)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(t,o,a),fl(n,t,o),hl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */st(Te,{children:Ys(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?Js(e,t.rung,r++,o,p):/* @__PURE__ */st(Dn,{children:p},t.slot??"")})})},Ks=(e,n)=>{const t=hr(Pt?.data,e.type,String(e.props.id)),o=kl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
+
return st(at,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=wl(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>Ws(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),v=/* @__PURE__ */dt(at,{children:[l.map(({child:n,zone:t,index:o})=>{const r=qo===String(n.props.id),i=Fi(n),l=String(n.props.id),{collapsible:d,folded:a}=xl(n,s,Nl(n.type)),c=yl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Pn(p),index:Oi(p).length}:void 0,f=as.dragging,h=u&&f&&ns(f,u)?u:void 0,g=()=>Il(t,o,l,e.type),{rowProps:y,...v}=as.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Pn(t),index:o},into:h,canDrag:!ur(n.type,n)},{"data-node-id":l,onClick:al(g)});/* @__PURE__ */
|
|
26
|
+
return dt(Dn,{children:[0===o&&m(t,0),
|
|
27
|
+
/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:n.type,size:13}),name:i,preview:pl(n),marks:ul(n),onSelect:g,nameSlot:Wi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Dr(l)}:void 0,actions:ur(n.type,n)?fl(n,t,o)??void 0:/* @__PURE__ */dt(at,{children:[cl(t,o,i),fl(n,t,o),hl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */st(Te,{children:Ks(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
+
/* @__PURE__ */st(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Bl(e.props.id,a.slot,a.childType,c.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?Js(e,o.rung,i++,r,v):/* @__PURE__ */st(Dn,{children:v},o.slot??"")})})},Gs=Vo,Zs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:uo&&!Gs&&cr===e.id,onSelect:()=>li(e.id)}:e,Qs=[...(ar.railLead??[]).map(Zs),{id:"sections",label:Gt.layers,icon:/* @__PURE__ */st(he,{}),active:uo&&!Gs&&"sections"===cr,onSelect:()=>li("sections")},...(ar.railTrail??[]).map(Zs)];wo?Qs.push({id:"media",label:Gt.railMedia,icon:/* @__PURE__ */st(me,{}),active:Co,onSelect:No}):It&&Qs.push({id:"media",label:Gt.railMedia,icon:/* @__PURE__ */st(me,{}),onSelect:si});const Xs={value:Qs.find(e=>!0===e.active)?.id??"",press:e=>{const n=Qs.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:Qs.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */st("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},_s=[...ar.railLead??[],...ar.railTrail??[]].find(e=>"panel"in e&&e.id===cr),qs=Boolean(Kt?.foldable),ed=Kt?.label??(Bt?Gt.pageSections:Gt.templateSections),nd=qs&&Rr(kt),td=/* @__PURE__ */dt(at,{children:[ci.map((e,n)=>{if(Ut(e)||Jt(e)||Ft(e.type))return null;const t=qo===String(e.props.id),o=Boolean(e.props._hidden);vl(e);const r=String(e.props.id),i=ar.hasOwnRows?.(e)??!1,l=Cl(e)||i,s=l&&Rr(r),d=yl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Pn(a),index:Oi(a).length}:void 0,p=as.dragging,u=c&&p&&ns(p,c)?c:void 0,{rowProps:f,...h}=as.row({item:{id:r,zone:ze,index:n,type:e.type},place:{...Pn(ze),index:n},into:u,canDrag:!ur(e.type,e)},{"data-node-id":r,onClick:al(()=>el(n))});/* @__PURE__ */
|
|
29
|
+
return dt(Dn,{children:[n>0&&ml(n),
|
|
30
|
+
/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:e.type,size:13}),name:Ni(e),preview:pl(e),marks:ul(e),shared:Dl(e),onSelect:()=>el(n),nameSlot:Wi(ze,n,r,Ni(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Dr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(ze,n,Ni(e)),fl(e,ze,n),hl(ze,n,e,Ni(e))]}),rowProps:f}),Cl(e)&&!s&&/* @__PURE__ */dt(Te,{children:[Ks(e,1),ar.partRows?.(e,Vs)]}),i&&!s&&/* @__PURE__ */st(Te,{children:ar.ownRows?.(e,n,Vs)})]},String(e.props.id??n))}),Yl>0&&ml(Yl)]}),od=(e,n,t)=>{const o=String(e.props.id),r=bl(e).length>0||Sl(e)||Boolean(gr(e.type)),i=r&&Rr(o),l="header"===t?Gt.header:Gt.footer,s=vr.rowName?vr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
+
return dt(at,{children:[
|
|
32
|
+
/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:t,size:13}),name:s,preview:pl(e),marks:ul(e),badge:Dl(e)?void 0:Vl,shared:Dl(e),onSelect:()=>el(n),nameSlot:Wi(ze,n,o,s),selected:qo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Dr(o)}:void 0,actions:fl(e,ze,n)??void 0,rowProps:{"data-node-id":o,onClick:al(()=>el(n))}}),r&&!i&&/* @__PURE__ */st(Te,{children:Ys(e,1)})]})};return(ar.wrap??(e=>e))(
|
|
33
|
+
/* @__PURE__ */st(Q,{target:Eo,children:/* @__PURE__ */dt("div",{ref:Ao,className:"sf-editor es-editor",style:tn(Lr),onContextMenu:Gi.onEditorContextMenu,...u(vn),children:[
|
|
34
|
+
/* @__PURE__ */dt(Ke,{children:[
|
|
35
|
+
/* @__PURE__ */st("div",{className:"es-cluster es-cluster--left","aria-hidden":"true"}),
|
|
36
|
+
/* @__PURE__ */dt(Ge,{children:[
|
|
37
|
+
/* @__PURE__ */st(Ze,{label:Gt.bar.undo,disabled:Boolean(xt)||!Mt.hasPast,onClick:()=>Mt.back(),children:/* @__PURE__ */st(_n,{})}),
|
|
38
|
+
/* @__PURE__ */st(Ze,{label:Gt.bar.redo,disabled:Boolean(xt)||!Mt.hasFuture,onClick:()=>Mt.forward(),children:/* @__PURE__ */st(qn,{})}),
|
|
39
|
+
/* @__PURE__ */st(Qe,{}),
|
|
40
|
+
/* @__PURE__ */st(Xe,{devices:ho,value:ko,onChange:bo}),
|
|
41
|
+
/* @__PURE__ */st(Ze,{label:Gt.bar.refresh,tip:Gt.bar.refreshTip,onClick:()=>{jo.current=(()=>{const e=Eo?.document;if(!e)return null;const n=ci.findIndex(Jt),t=n>=0?n:ci.length;let o=null;for(let n=0;n<t;n++){const t=ci[n]?.props?.id;if(null==t)continue;const r=Nn(e,`[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=Lt?.props?.id??ci[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Lo(e=>e+1)},children:/* @__PURE__ */st(et,{})})]}),
|
|
42
|
+
/* @__PURE__ */dt(Ge,{kind:"right",style:{minWidth:300},children:[
|
|
43
|
+
/* @__PURE__ */st(k,{input:Ho,words:Gt.saveStatus}),ar.barLead?.(),ar.barTrail?.(),ar.mainAction||!ar.barMain?/* @__PURE__ */st(b,{input:Ho,action:ar.mainAction??{label:Gt.done,onPress:()=>{Yn(Pt.data)}},readOnly:Boolean(xt),saveSwitch:Ct,onToggleAutoSave:Qn,onSaveNow:Wo,bar:Gt.bar,words:Gt.saveStatus}):ar.barMain()]})]}),
|
|
44
|
+
/* @__PURE__ */st(oe,{}),
|
|
45
|
+
/* @__PURE__ */dt("div",{className:"sf-body",children:[uo?/* @__PURE__ */dt(at,{children:[
|
|
46
|
+
/* @__PURE__ */dt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Gt.leftPanel,children:[
|
|
47
|
+
/* @__PURE__ */st("div",{className:"es-paneltabs",children:/* @__PURE__ */st(Wn,{variant:"underline",block:!0,"aria-label":Gt.bar.views,value:Xs.value,onChange:Xs.press,items:Xs.items})}),Vo?/* @__PURE__ */st(x,{at:Yo?{label:(e=>{const n=ql(e.zone);if(n)return Gt.add.addingTo({name:vr.rowName?dl(n,!0):xi(n.type)});if(e.zone===ze){const n=ci[e.index];return n&&!Jt(n)?Gt.add.addingBefore({name:dl(n,!0)}):Gt.add.addingAtEnd}const t=os(e.zone);return t?Gt.add.addingTo({name:t.parentName}):Gt.add.addingHere})(Yo),onClear:()=>Ko(null)}:void 0,placeBlocks:Yo&&Yo.zone!==ze?os(Yo.zone)?.choices:void 0,canTake:Yo?e=>{if(!Yo)return null;const n={...Pn(Yo.zone),index:Yo.index};if(is(e,n))return null;if("shared"===e.kind&&Yo.zone===ze&&!Et.shared?.nodeOf(e.section))return Gt.shared.alreadyHere;const t=ql(Yo.zone);if(t)return Gt.add.notInside({name:dl(t,!0)});if(Yo.zone===ze)return Gt.add.onlySections;const o=os(Yo.zone);return o?Gt.add.notInside({name:o.parentName}):Gt.add.onlySections}:void 0,onPick:Yo?e=>{if(!Yo)return;const n={...Pn(Yo.zone),index:Yo.index};is(e,n)&&(ls(e,n),sl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:ds,siteWide:ar.addPanelRow?.(sl),onClose:sl,onHide:ri,readOnly:Boolean(xt)}):_s?_s.panel({onHide:ri,notify:Vr}):/* @__PURE__ */dt(at,{children:[
|
|
48
|
+
/* @__PURE__ */st(N,{icon:/* @__PURE__ */st(he,{}),title:Gt.layers,context:to,actions:/* @__PURE__ */dt(at,{children:[!xt&&/* @__PURE__ */st(_e,{label:Gt.add.title,onClick:()=>il(null),children:/* @__PURE__ */st(nt,{size:15})}),
|
|
49
|
+
/* @__PURE__ */st(_e,{label:Gl?Gt.expandAll:Gt.collapseAll,title:0===Kl.length?Gt.nothingToFold:void 0,disabled:0===Kl.length,onClick:()=>Mr(e=>{const n=new Set(Kl);return Gl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Kl])}),children:/* @__PURE__ */st(mt,{expand:Gl})})]}),onHide:ri}),
|
|
50
|
+
/* @__PURE__ */dt(Re,{className:"sf-tree sf-scroll",words:Zt,children:[
|
|
51
|
+
/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:"page",size:13}),name:Gt.pageSettings,onSelect:di,selected:!Lt&&_o,rowProps:{onClick:al(di)}}),Ul&&/* @__PURE__ */dt(at,{children:[!Tl&&/* @__PURE__ */st(De,{children:Gt.header}),Us(Ul)]}),Ot&&!(Tl&&Ul)&&/* @__PURE__ */dt(at,{children:[!Tl&&/* @__PURE__ */st(De,{children:Gt.header}),!Yt&&/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:"header",size:13}),name:Gt.header,badge:Wl?void 0:Vl,shared:Wl,onSelect:ai,selected:Qo.kind===Vt?.kind,rowProps:{onClick:al(ai)}})]}),jl&&!(Tl&&Ul)&&od(jl,Ll,"header"),!qs&&/* @__PURE__ */st(De,{children:ed}),qs?/* @__PURE__ */dt(at,{children:[
|
|
52
|
+
/* @__PURE__ */st(Ee,{words:Zt,icon:null,name:ed,fold:{open:!nd,label:ed,onToggle:()=>Dr(kt)}}),!nd&&/* @__PURE__ */st(Te,{children:td})]}):td,Ot&&!Tl&&/* @__PURE__ */st(De,{children:Gt.footer}),Ml&&!(Tl&&Jl)&&od(Ml,$l,"footer"),Jl&&Us(Jl),ar.treeFoot?.()]})]})]}),
|
|
53
|
+
/* @__PURE__ */st(qe,{side:"left",width:Lr.left,min:nn.left,max:en,defaultWidth:m.left,label:Gt.resizeLeftPanel,onResize:Er})]}):/* @__PURE__ */st(I,{side:"left",onShow:ri}),
|
|
54
|
+
/* @__PURE__ */dt("div",{ref:Ur,className:"sf-center sf-scroll","data-sf-canvas-head":Zr?"":void 0,style:{overflowX:ni?"auto":"hidden",overflowY:"hidden"},children:[Zr&&/* @__PURE__ */st("div",{ref:Qr,className:"sf-canvas-head",children:/* @__PURE__ */st(Zr,{device:ko})}),
|
|
55
|
+
/* @__PURE__ */dt("div",{className:"sf-frame-scaler",style:ti,children:[
|
|
56
|
+
/* @__PURE__ */st("div",{className:"sf-frame "+(ko===yo?"":`sf-frame--${ko}`),style:oi,children:/* @__PURE__ */dt("div",{className:"sf-preview-host",children:[
|
|
57
|
+
/* @__PURE__ */st(je.Provider,{value:El,children:/* @__PURE__ */st(Ae.Provider,{value:Hl,children:/* @__PURE__ */st(oo,{},Mo)})}),
|
|
58
|
+
/* @__PURE__ */st(pn,{canvas:Eo,session:ds,model:Cs,measure:Is,canDrop:Os,onDrop:$s,choose:us,onPick:Ls,dropOn:js?{accepts:(e,n)=>{if(!e.media||!js||n.item.rung)return!1;const t=$n(Pt.data,ui,n.item.id);return null!==t&&js.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Ts();n&&js&&Ds(n).then(n=>{n&&Fs(n,e.item.id)})})(n),label:()=>Gt.canvasReplaceImage}:void 0,onZoneAdd:Hs,onSeamAdd:Hs,zoneAddLabel:Gt.canvasAddBlock,words:Qt.canvas,readOnly:Boolean(xt),revision:Pt.data}),Go.length>0&&!To&&/* @__PURE__ */st("div",{className:"sf-preview-gaps",children:Go.map(e=>
|
|
59
|
+
/* @__PURE__ */st(un,{index:e.index,label:Gt.addSectionHere,onInsert:()=>il(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),ms?/* @__PURE__ */st(ht,{canvas:Eo,tabs:vs,onSelect:e=>{const n=ci.findIndex(n=>String(n.props.id)===e);n>=0&&el(n)}}):null]})]}),fo?/* @__PURE__ */dt(at,{children:[
|
|
60
|
+
/* @__PURE__ */st(f,{value:{selectChild:Il,addChild:Bl,childRowName:Fi,blockRowName:Zl},children:/* @__PURE__ */st(ro,{mode:Qo,onOpenWebsiteSettings:ar.openSettings??(()=>{}),onOpenSiteStyles:ar.openStyles,onSelectNode:zr,onNotify:Vr,onHidePanel:ii,nodeActions:Lt?Ce(At,Lt.type):bt})}),
|
|
61
|
+
/* @__PURE__ */st(qe,{side:"right",width:Lr.right,min:nn.right,max:en,defaultWidth:m.right,label:Gt.resizeSettingsPanel,onResize:Tr})]}):
|
|
62
|
+
/* @__PURE__ */st(I,{side:"right",onShow:ii})]}),Gi.menu,
|
|
63
|
+
/* @__PURE__ */st(ee,{}),vi?/* @__PURE__ */st(pt,{name:vi.name,onMake:e=>(async(e,n)=>{const t=ci.find(n=>String(n.props.id)===e),o=Et.shared;if(!t||!o)return;let r;try{r=await C(yi).create(n,t)}catch{return void Vr(Gt.shared.makeFailed,"error")}o.adopt(t,r),ki(null)})(vi.id,e),onCancel:()=>ki(null)}):null]})}))}export{St as ScreenChrome};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{find as n,remove as t,getList as e,newId as r,duplicate as o,move as l,copyNode as a,insert as c,setProps as i,slotsOf as d}from"./chunk-
|
|
1
|
+
import{find as n,remove as t,getList as e,newId as r,duplicate as o,move as l,copyNode as a,insert as c,setProps as i,slotsOf as d}from"./chunk-K7BTCBWD.js";import{useRef as s,useSyncExternalStore as p,useCallback as u,useMemo as f}from"react";var m=n=>({kind:"node",id:n});function x(r,o,l,a="none"){const c=n(r,o,l),i=t(r,o,l);if("none"===a||!c)return{data:i,select:null};const d=e(r,o,c.place)??[],s=d[c.place.index+1]??d[c.place.index-1];return s?.props?.id?{data:i,select:m(s.props.id)}:"root"!==c.place.parentId?{data:i,select:m(c.place.parentId)}:{data:i,select:null}}function g(t,e,l,a={}){const c=n(t,e,l)?.node,i=a.id??r(c?.type??"Node");return{data:o(t,e,l,{strip:a.strip,id:i}),select:m(i)}}function I(n,t,e,r){return{data:l(n,t,e,r),select:m(e)}}var h=(n,t)=>({min:0,max:t-1});function v(t,r,o,l,a=h){const c=n(t,r,o);if(!c)return!1;const i=e(t,r,c.place)?.length??0,{min:d,max:s}=a(c.place,i),p=c.place.index+l;return c.place.index>=d&&c.place.index<=s&&p>=d&&p<=s}function b(t,e,r,o,l=h){if(!v(t,e,r,o,l))return null;const a=n(t,e,r);return I(t,e,r,{...a.place,index:a.place.index+o})}function k(n,t,e,r,o={}){const l=a(e,t,{strip:o.strip});return{data:c(n,t,r,l),select:m(l.props.id)}}function y(t,r,o,l){if(n(t,r,o.props.id))return null;const a=e(t,r,l)??[],i={...l,index:Math.max(0,Math.min(l.index,a.length))};return{data:c(t,r,i,o),select:m(o.props.id)}}function B(e,r,o,l){const a=n(e,r,o);return a?l.props.id!==o&&n(e,r,l.props.id)?null:{data:c(t(e,r,o),r,a.place,l),select:m(l.props.id)}:null}function O(n,t,e,r){return{data:i(n,t,e,r),select:void 0}}function z(t,e,r,o=()=>!1){if(!r)return null;if("slot"===r.kind)return n(t,e,r.parentId)?m(r.parentId):null;const l=n(t,e,r.id);if(!l||"root"===l.place.parentId)return null;const a=n(t,e,l.place.parentId);return a?o(a.node,l.place.slot)?{kind:"slot",parentId:a.node.props.id,slot:l.place.slot}:m(a.node.props.id):null}function M(t,e,r,o){const l=n(t,e,r);if(!l)return[];const a=l.path.filter(n=>"root"!==n.parentId).map(n=>n.parentId);return o?[...a.filter(r=>{const l=n(t,e,r);return!l||!o(l.node)}),r]:[...a,r]}function R(n,t){if(0===n.length)return null;const e=null===t?-1:n.indexOf(t);return-1===e?n[0]:n[Math.min(e+1,n.length-1)]}function $(t,e,r,o,l){const a=n(t,e,r);return a?0===d(a.node,e).length?r:R(M(t,e,r,l),o):null}function j(t,e,r,o,l,a,c){const i=n(t,e,r);if(!i)return null;if(0===d(i.node,e).length)return{node:r,part:o};const s="\0part:"+o,p=R([...M(t,e,r,c),s],l===r&&a===o?s:l);return p===s?{node:r,part:o}:{node:p??r,part:null}}function w(t,e,r){if(!r||"node"!==r.kind)return null;const o=n(t,e,r.id);return o?{zone:`${o.place.parentId}:${o.place.slot}`,index:o.place.index}:null}function C(n,t,r){if(!r)return null;const[o,l]=(r.zone??"root:default-zone").split(/:(.*)/s),a={parentId:o,slot:l},c=e(n,t,a)?.[r.index];return c?.props?.id?m(c.props.id):null}var D={get:()=>null,set:()=>{},subscribe:()=>()=>{}};function K(t){const e=s(t);e.current=t;const r=t.clipboard??D,o=p(r.subscribe,r.get,r.get),l=u(n=>{const t=e.current;if(t.readOnly)return!1;const r=n(t.data,t.config);return!!r&&((r.data!==t.data||void 0!==r.select)&&(t.commit(r.data,{select:r.select}),e.current={...t,data:r.data},!0))},[]);return f(()=>{const t=()=>e.current,r=(e,r)=>{const o=n(t().data,t().config,e);return o?{node:o.node,label:r,from:{parentId:o.place.parentId,slot:o.place.slot}}:null};return{held:o,remove:n=>l((e,r)=>x(e,r,n,t().afterRemove)),duplicate:n=>l((e,r)=>g(e,r,n,{strip:t().strip})),move:(n,t)=>l((e,r)=>I(e,r,n,t)),step:(n,e)=>l((r,o)=>b(r,o,n,e,t().stepBounds)),canStep:(n,e)=>v(t().data,t().config,n,e,t().stepBounds),setProps:(n,t)=>l((e,r)=>O(e,r,n,t)),copy:(n,e)=>{const o=r(n,e);return o&&(t().clipboard??D).set(o),!!o},cut:(n,e)=>{if(t().readOnly)return!1;const o=r(n,e);return!!o&&((t().clipboard??D).set(o),l((e,r)=>x(e,r,n,t().afterRemove)))},paste:n=>{const e=(t().clipboard??D).get();return!!e&&l((r,o)=>k(r,o,e.node,n,{strip:t().strip}))},restore:(n,t)=>l((e,r)=>y(e,r,n,t)),swap:(n,t)=>l((e,r)=>B(e,r,n,t)),parentOf:n=>z(t().data,t().config,n,t().slotIsLevel)}},[o,l])}export{v as canStep,$ as clickPick,j as clickPickPart,C as fromItemSelector,R as nextInChain,M as nodeChain,z as parentStep,g as planDuplicate,I as planMove,k as planPaste,x as planRemove,y as planRestore,O as planSetProps,b as planStep,B as planSwap,w as toItemSelector,K as useNodeOps};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-CBICQ4J3.js";import{useEaselHost as e}from"./chunk-U3JP4VGF.js";import{createEasel as r,EaselProvider as o}from"./chunk-ROPYFLNZ.js";import{useState as n,useEffect as s}from"react";import{jsx as a}from"react/jsx-runtime";function i({config:i,data:c,onChange:m,permissions:p,parts:f,children:u}){const[d]=n(()=>r({config:i,data:c,permissions:p}));s(()=>{d.setConfig(i)},[d,i]),s(()=>{if(!m)return;let t=d.getState().appState.data,e=!1;return d.subscribe(()=>{const r=d.getState().appState.data;r!==t&&(t=r,(e||r!==d.loaded)&&(e=!0,m(r)))})},[d,m]),s(()=>{p&&d.setPermissions(p)},[d,p]);const h=e();/* @__PURE__ */
|
|
2
2
|
return a(o,{easel:d,hotkeys:h.ownsDocument,children:/* @__PURE__ */a(t,{parts:f,children:u})})}export{i as ScreenStoreProvider};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{usePickFollowsSelection as n}from"./chunk-LNHT2KPX.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-ROPYFLNZ.js";import{Inspector as i}from"./chunk-SK3P56FS.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},O={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},P={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},S={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function j(){/* @__PURE__ */
|
|
2
|
+
return s(t,{height:"fill"})}function w(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
|
+
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var N=o({});function C({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return s(N.Provider,{value:n,children:e})}function D(){return u(N)}function F(){return(D().useOwnerName??v)()}function G(){return(D().useDocumentLabel??g)()}function x(n,e,t,r){return(D().useBridges??h)(n,e,t,r)}function B(n){return(D().useStandaloneBridges??h)(n)}function I(n,e){(D().useDocumentPass??y)(n,e)}function K(){return D().blockRules??b}function T(){return D().blockLook??L}function R(){return D().devices??O}function A(){return D().leftView??P}function H(){return D().pinned??S}function V(){return D().saveSwitch??!0}function Y(e){n(!0===D().pickFollowsSelection,e)}function Z(){return D().storageNamespace||void 0}function E(){return D().styleClipboard??null}function X(){return D().nodeKeys??!0}function q(){return D().notify??null}function z(){return D().Canvas??j}function J(){return D().CanvasHead??null}function M(){return D().canvasDrag??null}var Q=o(null);function U({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return s(Q.Provider,{value:n,children:e})}function W(){return u(Q)}function $(){return D().Inspector??w}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,C as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,T as useScreenBlockLook,K as useScreenBlockRules,x as useScreenBridges,M as useScreenCanvasDrag,z as useScreenCanvasFrame,J as useScreenCanvasHead,W as useScreenCanvasTarget,R as useScreenDevices,G as useScreenDocumentLabel,I as useScreenDocumentPass,$ as useScreenInspectorPanel,A as useScreenLeftView,X as useScreenNodeKeys,q as useScreenNotify,F as useScreenOwnerName,D as useScreenParts,Y as useScreenPickFollowsSelection,H as useScreenPinned,V as useScreenSaveSwitch,Z as useScreenStorageNamespace,E as useScreenStyleClipboard,B as useStandaloneScreenBridges};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as o}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as l}from"./chunk-BVN33R76.js";import{sharedSectionsOf as r}from"./chunk-43AEUUNQ.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-SINAM2IT.js";import{blockRuns as c}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-CBICQ4J3.js";import{useEaselSession as m}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-23DYNW6S.js";import{useEasel as u}from"./chunk-ROPYFLNZ.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-LDEEFLE3.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-KAML3KQH.js";import{useState as b,useEffect as v,useMemo as j,useRef as C}from"react";import{SharedIcon as w,AddIcon as E}from"efficient-shell/icons/efficient";import{ContextMenu as F,toast as I,Dialog as L,Button as N}from"efficient-shell/ui";import{jsx as O,jsxs as T,Fragment as $}from"react/jsx-runtime";function x({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=C(null);/* @__PURE__ */
|
|
2
|
+
return O(L,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */T($,{children:[
|
|
3
|
+
/* @__PURE__ */O(N,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
|
|
4
|
+
/* @__PURE__ */O(N,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var A=e=>`section:${e}`,D=e=>`block:${e}`,M=e=>`template:${e}`,B=e=>`shared:${e}`;function S({at:C,placeBlocks:L,canTake:N,onPick:S,itemFor:P,session:Q,siteWide:z,onClose:H,onHide:R,readOnly:V}){const W=u(e=>e.config),Y=a(),{labelAtLevel:Z,categoryLabel:K,firstSection:U,Icon:J,Thumbnail:_}=Y,{blockIsOffered:G,canAddTo:q}=d(),X=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>G(e,te);return l(te).list().then(n=>{if(e)return;const l=W.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[W,te]);const le=p().shared,re=h("screen",f).shared,[ie,se]=b([]),[ce,ae]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>G(e,te);return r(te).list().then(n=>{if(e)return;const l=W.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[W,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(W,Y),[W]),ye=e=>Z(e,"section",W.components[e]?.label??e),he=e=>({type:A(e.type),label:e.name,cover:/* @__PURE__ */O(_,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:X.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ke=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=ne.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=ie.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}return null},ge=e=>/* @__PURE__ */O("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */O(J,{type:e,size:26})}),be=j(()=>{const e=t(ue,U),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!G(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=q(t.type)?.choices??[];e.forEach(l),e.forEach(e=>q(e.type,1)?.choices?.forEach(l))}L?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:D(e.type),label:e.label,cover:ge(e.type),title:X.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>o.has(e.type)?{...he(e),cover:ge(e.type)}:he(e),d=[];ie.length>0&&d.push({key:"shared",title:re.group,tiles:ie.map(e=>({type:B(e.id),label:e.title,cover:/* @__PURE__ */O(_,{type:e.node.type}),mark:/* @__PURE__ */O(w,{size:12}),title:re.onPages({count:e.used_on.length}),keywords:[ye(e.node.type),e.node.type]}))}),ne.length>0&&d.push({key:"templates",title:X.templates,tiles:ne.map(e=>({type:M(e.id),label:e.name,cover:/* @__PURE__ */O(_,{type:e.node.type}),keywords:[ye(e.node.type),e.node.type]}))});const p=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(W.categories??{})){const o=ue.filter(e=>e.cat===t);if(0===o.length)continue;const l=e&&o.some(t=>t.type===e.type)?e:null,r=(l?[l,...o.filter(e=>e.type!==l.type)]:o).map(a);l&&!m&&(r.splice(1,0,...p.map(s)),m=!0),d.push({key:`category:${t}`,title:n(W,t,K),tiles:r})}const f=d.find(e=>e.key?.startsWith("category:"));if(!m&&f&&p.length>0&&(f.tiles=[...f.tiles,...p.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{d.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!N)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?N(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[ne,ie,re,ue,W,X,N,L,te]);/* @__PURE__ */
|
|
5
|
+
return T($,{children:[
|
|
6
|
+
/* @__PURE__ */O(i,{icon:/* @__PURE__ */O(E,{size:15}),title:X.title,context:X.contextAll,actions:/* @__PURE__ */O(s,{label:X.done,description:X.doneDescription,onClick:H}),onHide:R}),
|
|
7
|
+
/* @__PURE__ */T("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
+
/* @__PURE__ */O(k,{groups:be,session:Q,itemFor:e=>P(ke(e)??{kind:"section",type:e}),onInsert:S?e=>{const t=ke(e);t&&S(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!V&&(pe({section:n.section,...t}),!0)},at:C,hint:X.hint,searchLabel:X.search,readOnly:V,words:ee}),z??null]}),de?/* @__PURE__ */O(F,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>pe(null),"aria-label":de.section.title,items:y([{label:re.deleteShared,danger:!0,onClick:()=>{fe(de.section),pe(null)}}])}):null,me?/* @__PURE__ */O(x,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void I.error(re.deleteFailed)}fe(null),le?.removed?.(e),se(t=>t.filter(t=>t.id!==e.id)),ae(e=>e+1)})(me),onCancel:()=>fe(null)}):null]})}export{S as AddSidePanel,D as blockKey,A as sectionKey,B as sharedKey,M as templateKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=["desktop","tablet","mobile"],e={desktop:"Desktop",tablet:"Tablet",mobile:"Mobile"},n=720,o=1100;function a(t){return t>=1100?"desktop":t>=720?"tablet":"mobile"}function r(t){return`${t}Tablet`}function u(t){return`${t}Phone`}function b(t){return null==t}var l=t=>e=>"number"==typeof e?e*t:e,p=t=>t;var h={spacing:{tablet:l(.75),phone:l(2/3),round:function(t){const e=Math.ceil(Math.abs(t)/4-.5);return 4*(t<0?-e:e)+0}},columns:{tablet:t=>"number"==typeof t?Math.min(t,2):t,phone:t=>"number"==typeof t?1:t},stack:{tablet:p,phone:t=>void 0===t?t:"stacked"},textSize:{tablet:l(.85),phone:l(.7/.85),round:Math.round},heightMode:{tablet:p,phone:t=>"px"===t?"fit":t},heightPx:{tablet:l(.75),phone:p,round:Math.round},same:{tablet:p,phone:p}};function i(t,e,n,o){const a=h[t],r=t=>a.round&&"number"==typeof t?a.round(t):t,u=b(n)?a.tablet(e):n,l=b(o)?a.phone(u):o;return{desktop:e,tablet:b(n)?r(u):n,phone:b(o)?r(l):o}}export{h as AUTO_RULES,o as VIEW_DESKTOP_MIN,n as VIEW_TABLET_MIN,t as VIEW_TIERS,e as VIEW_TIER_LABEL,b as isAuto,u as phoneKey,i as resolveViewValue,r as tabletKey,a as viewTierForWidth};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{changedProps as e}from"./chunk-
|
|
1
|
+
import{changedProps as e}from"./chunk-K7BTCBWD.js";import{useState as t,useRef as r,useEffect as n}from"react";function i({id:i,node:l,block:d,parent:o=null,appState:a=null}){const u=d?.fields??{},[s,c]=t(()=>({id:i,fields:u,loading:!1})),p=r(null),f=r(null),g=r({parent:o,appState:a,id:i});return g.current={parent:o,appState:a,id:i},n(()=>{if(!l||!d)return;const t=f.current!==i;f.current=i;let r=s.fields;t&&(r=u,p.current=null,c({id:i,fields:u,loading:!1}));const n=d.resolveFields;if(!n)return void(t||c(e=>({...e,fields:u})));let o=!1;const a=p.current&&(p.current.props?.id??"root")===(l.props?.id??"root")?p.current:null,m=setTimeout(()=>{o||c(e=>e.id===i?{...e,loading:!0}:e)},50);return Promise.resolve(n(l,{changed:e(l,a),fields:u,lastFields:r,lastData:a,appState:g.current.appState,parent:g.current.parent})).then(e=>{clearTimeout(m),o||g.current.id!==i||(p.current=l,c({id:i,fields:e,loading:!1}))}),()=>{o=!0,clearTimeout(m)}},[i,l,d]),s.id===i?{fields:s.fields,loading:s.loading}:{fields:u,loading:!1}}export{i as useResolvedFields};
|