efficient-easel 21.0.0 → 21.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -3
- package/dist/{CanvasDragLayer-Cd1o0HQf.d.ts → CanvasDragLayer-CFUcBbgc.d.ts} +1 -1
- package/dist/{ScreenDocumentContext-CFJeqqKk.d.ts → ScreenDocumentContext-1RgtGKWR.d.ts} +4 -0
- package/dist/blocks/index.d.ts +5 -3
- package/dist/{buckets-Tj-nkBpg.d.ts → buckets-Sw94ll9I.d.ts} +1 -1
- package/dist/canvas/index.d.ts +8 -6
- package/dist/canvas/index.js +1 -1
- package/dist/chunk-2C7W64S5.js +8 -0
- package/dist/chunk-2L6KWUBC.js +1 -0
- package/dist/chunk-467WWV4I.js +1 -0
- package/dist/chunk-4FD7TAOE.js +1 -0
- package/dist/chunk-67HCYOW4.js +1 -0
- package/dist/chunk-A2VVB4RH.js +0 -0
- package/dist/{chunk-2GVCAIPX.js → chunk-BDSLF5BR.js} +1 -1
- package/dist/{chunk-U66YKDAR.js → chunk-BIK3AO2V.js} +1 -1
- package/dist/chunk-BTDI7JAA.js +2 -0
- package/dist/chunk-DDH2DYQP.js +1 -0
- package/dist/{chunk-HGCGIRVA.js → chunk-DNQ7AF6K.js} +1 -1
- package/dist/{chunk-66JNVRQM.js → chunk-GWYNMSIP.js} +1 -1
- package/dist/{chunk-V2ULLALL.js → chunk-I67UW5UG.js} +3 -3
- package/dist/{chunk-MSGZ56QL.js → chunk-KWLHKKZO.js} +1 -1
- package/dist/{chunk-FOHHXSOL.js → chunk-MLQKNED6.js} +1 -1
- package/dist/{chunk-43AEUUNQ.js → chunk-N3MJOHAG.js} +1 -1
- package/dist/{chunk-BVN33R76.js → chunk-N7E6264U.js} +1 -1
- package/dist/chunk-OHZHYROJ.js +5 -0
- package/dist/{chunk-YHFKWV7H.js → chunk-PFFH7ASD.js} +13 -13
- package/dist/chunk-PRHBWA5V.js +0 -0
- package/dist/chunk-SNF5764Q.js +1 -0
- package/dist/chunk-SSRYU3YG.js +1 -0
- package/dist/{chunk-R4QJ6DC5.js → chunk-SWBADIQT.js} +1 -1
- package/dist/{chunk-GOTN2KY4.js → chunk-TIAWIOGD.js} +1 -1
- package/dist/chunk-TUXLORVR.js +15 -0
- package/dist/{chunk-FGNR22NY.js → chunk-U5DNBT63.js} +1 -1
- package/dist/{chunk-EZTP6E2M.js → chunk-U7TFWHST.js} +1 -1
- package/dist/{chunk-2M4T27BI.js → chunk-WJJ7H42G.js} +7 -7
- package/dist/chunk-YIUE4US7.js +0 -0
- package/dist/{chunk-O7Q4DDJT.js → chunk-YM4UEGBV.js} +1 -1
- package/dist/chunk-YVFYWAYU.js +65 -0
- package/dist/{chunk-N2RISV46.js → chunk-ZOSEBPAI.js} +1 -1
- package/dist/copy/index.d.ts +2 -2
- package/dist/copy/index.js +11 -11
- package/dist/drag/index.d.ts +2 -2
- package/dist/drag/index.js +1 -1
- package/dist/draw/client.d.ts +1 -1
- package/dist/draw/client.js +1 -1
- package/dist/draw/index.d.ts +8 -8
- package/dist/draw/index.js +1 -1
- package/dist/easel/easel.css +3 -1
- package/dist/easel/index.d.ts +2 -2
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.d.ts +4 -4
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.d.ts +2 -2
- package/dist/render/index.d.ts +2 -2
- package/dist/render/index.js +5 -5
- package/dist/{repeat-Czi-6zPX.d.ts → repeat-BNgSq2Nw.d.ts} +1 -1
- package/dist/screen/components/AddBlockRow.d.ts +1 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.d.ts +2 -2
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +13 -13
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/PreviewPartsContext.d.ts +2 -2
- package/dist/screen/components/PreviewPartsContext.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +7 -7
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +2 -2
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +7 -7
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +7 -7
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/SlotChildActionsContext.d.ts +1 -1
- package/dist/screen/components/usePartBridge.d.ts +7 -7
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +8 -8
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +1 -1
- package/dist/screen/lib/admin-bridge.js +1 -1
- package/dist/screen/lib/content/view-tiers.d.ts +1 -1
- package/dist/screen/lib/document/add-target-types.d.ts +55 -0
- package/dist/screen/lib/document/add-target-types.js +1 -0
- package/dist/screen/lib/document/block-choice.d.ts +64 -0
- package/dist/screen/lib/document/block-choice.js +1 -0
- package/dist/screen/lib/document/block-types-in.d.ts +39 -0
- package/dist/screen/lib/document/block-types-in.js +1 -0
- package/dist/screen/lib/document/content-tree.d.ts +222 -0
- package/dist/screen/lib/document/content-tree.js +1 -0
- package/dist/screen/lib/document/device-fields.d.ts +128 -0
- package/dist/screen/lib/document/device-fields.js +1 -0
- package/dist/screen/lib/document/field-buckets.d.ts +36 -0
- package/dist/screen/lib/document/field-buckets.js +1 -0
- package/dist/screen/lib/document/field-markers.d.ts +205 -0
- package/dist/screen/lib/document/field-markers.js +1 -0
- package/dist/screen/lib/document/hidable.d.ts +44 -0
- package/dist/screen/lib/document/hidable.js +1 -0
- package/dist/screen/lib/document/palette-sections.d.ts +103 -0
- package/dist/screen/lib/document/palette-sections.js +1 -0
- package/dist/screen/lib/document/panel-fields.d.ts +47 -0
- package/dist/screen/lib/document/panel-fields.js +1 -0
- package/dist/screen/lib/document/panel-no-control-mark.d.ts +74 -0
- package/dist/screen/lib/document/panel-no-control-mark.js +1 -0
- package/dist/screen/lib/document/part-id.d.ts +23 -0
- package/dist/screen/lib/document/part-id.js +1 -0
- package/dist/screen/lib/document/preview-click.d.ts +49 -0
- package/dist/screen/lib/document/preview-click.js +1 -0
- package/dist/screen/lib/document/preview-dom.d.ts +8 -0
- package/dist/screen/lib/document/preview-dom.js +1 -0
- package/dist/screen/lib/document/preview-events.d.ts +25 -0
- package/dist/screen/lib/document/preview-events.js +1 -0
- package/dist/screen/lib/document/preview-selection-context.d.ts +72 -0
- package/dist/screen/lib/document/preview-selection-context.js +1 -0
- package/dist/screen/lib/document/section-doc.d.ts +24 -0
- package/dist/screen/lib/document/section-doc.js +1 -0
- package/dist/screen/lib/document/slot-child-name.d.ts +225 -0
- package/dist/screen/lib/document/slot-child-name.js +1 -0
- package/dist/screen/lib/document/slot-heal.d.ts +5 -0
- package/dist/screen/lib/document/slot-heal.js +1 -0
- package/dist/screen/lib/document/slot-section-spec.d.ts +96 -0
- package/dist/screen/lib/document/slot-section-spec.js +1 -0
- package/dist/screen/lib/document/style-clipboard.d.ts +144 -0
- package/dist/screen/lib/document/style-clipboard.js +1 -0
- package/dist/screen/lib/document/text-control-kinds.d.ts +71 -0
- package/dist/screen/lib/document/text-control-kinds.js +1 -0
- package/dist/screen/lib/document/tree-reveal.d.ts +62 -0
- package/dist/screen/lib/document/tree-reveal.js +1 -0
- package/dist/screen/lib/document/use-section-ops.d.ts +110 -0
- package/dist/screen/lib/document/use-section-ops.js +1 -0
- package/dist/screen/lib/document-addressing.d.ts +2 -2
- package/dist/screen/lib/document-switch.d.ts +1 -1
- package/dist/screen/lib/host.d.ts +2 -2
- package/dist/screen/lib/key-scope.d.ts +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +2 -2
- package/dist/screen/lib/media-picker.d.ts +2 -2
- package/dist/screen/lib/page-lock.d.ts +1 -1
- package/dist/screen/lib/puck/add-target-types.d.ts +3 -55
- package/dist/screen/lib/puck/add-target-types.js +1 -0
- package/dist/screen/lib/puck/block-choice.d.ts +1 -64
- package/dist/screen/lib/puck/block-choice.js +1 -1
- package/dist/screen/lib/puck/block-types-in.d.ts +1 -39
- package/dist/screen/lib/puck/block-types-in.js +1 -1
- package/dist/screen/lib/puck/content-tree.d.ts +1 -222
- package/dist/screen/lib/puck/content-tree.js +1 -1
- package/dist/screen/lib/puck/device-fields.d.ts +3 -127
- package/dist/screen/lib/puck/device-fields.js +1 -1
- package/dist/screen/lib/puck/field-buckets.d.ts +2 -36
- package/dist/screen/lib/puck/field-buckets.js +1 -1
- package/dist/screen/lib/puck/field-markers.d.ts +2 -205
- package/dist/screen/lib/puck/field-markers.js +1 -1
- package/dist/screen/lib/puck/hidable.d.ts +1 -44
- package/dist/screen/lib/puck/hidable.js +1 -1
- package/dist/screen/lib/puck/palette-sections.d.ts +2 -97
- package/dist/screen/lib/puck/palette-sections.js +1 -1
- package/dist/screen/lib/puck/panel-fields.d.ts +1 -47
- package/dist/screen/lib/puck/panel-fields.js +1 -1
- package/dist/screen/lib/puck/panel-no-control-mark.d.ts +2 -74
- package/dist/screen/lib/puck/panel-no-control-mark.js +1 -1
- package/dist/screen/lib/puck/part-id.d.ts +1 -23
- package/dist/screen/lib/puck/part-id.js +1 -1
- package/dist/screen/lib/puck/preview-click.d.ts +1 -49
- package/dist/screen/lib/puck/preview-click.js +1 -1
- package/dist/screen/lib/puck/preview-dom.d.ts +1 -8
- package/dist/screen/lib/puck/preview-dom.js +1 -1
- package/dist/screen/lib/puck/preview-events.d.ts +1 -25
- package/dist/screen/lib/puck/preview-events.js +1 -1
- package/dist/screen/lib/puck/preview-selection-context.d.ts +2 -72
- package/dist/screen/lib/puck/preview-selection-context.js +1 -1
- package/dist/screen/lib/puck/section-doc.d.ts +3 -18
- package/dist/screen/lib/puck/section-doc.js +1 -1
- package/dist/screen/lib/puck/slot-child-name.d.ts +1 -225
- package/dist/screen/lib/puck/slot-child-name.js +1 -1
- package/dist/screen/lib/puck/slot-heal.d.ts +2 -5
- package/dist/screen/lib/puck/slot-heal.js +1 -1
- package/dist/screen/lib/puck/slot-section-spec.d.ts +1 -96
- package/dist/screen/lib/puck/slot-section-spec.js +1 -0
- package/dist/screen/lib/puck/style-clipboard.d.ts +12 -114
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/text-control-kinds.d.ts +1 -71
- package/dist/screen/lib/puck/text-control-kinds.js +1 -1
- package/dist/screen/lib/puck/tree-reveal.d.ts +1 -62
- package/dist/screen/lib/puck/tree-reveal.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.d.ts +4 -105
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +25 -18
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-template-types.d.ts +1 -1
- package/dist/screen/lib/section-templates.d.ts +1 -1
- package/dist/screen/lib/section-templates.js +1 -1
- package/dist/screen/lib/session-context.d.ts +1 -1
- package/dist/screen/lib/session-context.js +1 -1
- package/dist/screen/lib/session.d.ts +3 -3
- package/dist/screen/lib/session.js +1 -1
- package/dist/screen/lib/shared-section-types.d.ts +1 -1
- package/dist/screen/lib/shared-sections.d.ts +1 -1
- package/dist/screen/lib/shared-sections.js +1 -1
- package/dist/screen/screen.css +2 -2
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.js +21 -21
- package/dist/tree/index.d.ts +1 -1
- package/dist/{types-CDX6vd6A.d.ts → types-B8NwXKlE.d.ts} +1 -1
- package/dist/{watch-BTYOJpQU.d.ts → watch-D8xZow3y.d.ts} +2 -2
- package/dist/{words-BeX5eGq7.d.ts → words-CmEnDoOe.d.ts} +1 -1
- package/package.json +154 -10
- package/dist/chunk-2E2SXDYQ.js +0 -1
- package/dist/chunk-4IJVV7DA.js +0 -1
- package/dist/chunk-7L3NKHEC.js +0 -15
- package/dist/chunk-APVUYICP.js +0 -65
- package/dist/chunk-BHRC3ASL.js +0 -1
- package/dist/chunk-I54UCYOU.js +0 -1
- package/dist/chunk-LXTM2OLQ.js +0 -2
- package/dist/chunk-NA3GMA43.js +0 -5
- package/dist/chunk-OBWDHKLI.js +0 -8
- package/dist/chunk-Q2A7RHG2.js +0 -1
- package/dist/chunk-QIDRJH3S.js +0 -1
- package/dist/chunk-RSCMJIWS.js +0 -1
- /package/dist/{chunk-MQNBD6AB.js → chunk-3QB2ZQXK.js} +0 -0
- /package/dist/{chunk-LER7RKTO.js → chunk-5XL2RXFU.js} +0 -0
- /package/dist/{chunk-6W7WLPZH.js → chunk-6UAEFOJ4.js} +0 -0
- /package/dist/{chunk-26OOWIJJ.js → chunk-7OCEPOEJ.js} +0 -0
- /package/dist/{chunk-IQ5TA7AM.js → chunk-AJ2SUSET.js} +0 -0
- /package/dist/{chunk-DUVRZ456.js → chunk-ANPOR6EY.js} +0 -0
- /package/dist/{chunk-5ZBY24K7.js → chunk-CPL43ZLJ.js} +0 -0
- /package/dist/{chunk-PIND6KE7.js → chunk-I6SK6ZDT.js} +0 -0
- /package/dist/{chunk-7F52SZOI.js → chunk-INRERJU4.js} +0 -0
- /package/dist/{chunk-R5L2E7JX.js → chunk-MGVI67QV.js} +0 -0
- /package/dist/{chunk-IYT6NN2J.js → chunk-R4AUZVA3.js} +0 -0
- /package/dist/{chunk-M2Z775ZC.js → chunk-RUQOIQWI.js} +0 -0
- /package/dist/{chunk-PLVEGYK6.js → chunk-TCAAOYQY.js} +0 -0
- /package/dist/{chunk-PA3PNTVV.js → chunk-VKPOH6MK.js} +0 -0
package/README.md
CHANGED
|
@@ -608,11 +608,23 @@ and builds props in hooks, so it only runs as a client component.) Whether the
|
|
|
608
608
|
blocks themselves can run on the server is up to the blocks.
|
|
609
609
|
|
|
610
610
|
The block authoring shape is Puck's, so an app passes the config it has: a
|
|
611
|
-
block's `render` gets its props, `
|
|
611
|
+
block's `render` gets its props, `editor` (and `puck`, its deprecated twin: the same
|
|
612
|
+
value), and each slot as a component —
|
|
612
613
|
`render: ({ content: Content }) => <Content className="grid" />` — which draws
|
|
613
614
|
`<div className style>` around its blocks. The top-level list is wrapped in one
|
|
614
|
-
plain `<div>`, and `
|
|
615
|
-
each level. A type the config does not know draws nothing.
|
|
615
|
+
plain `<div>`, and `editor` carries exactly what Puck's client `<Render>` gave
|
|
616
|
+
`puck` at each level. A type the config does not know draws nothing.
|
|
617
|
+
|
|
618
|
+
**Retiring the name "Puck" (21.1.0).** The new names ship beside the old ones;
|
|
619
|
+
easel 22 removes the old. Deprecated, with what replaces each:
|
|
620
|
+
|
|
621
|
+
| Deprecated | Use |
|
|
622
|
+
|---|---|
|
|
623
|
+
| block prop `puck` (types: `WithBlockProps`) | `editor` — the same value |
|
|
624
|
+
| `efficient-easel/screen/lib/puck/*` (24 subpaths) | `efficient-easel/screen/lib/document/*` — the old ones re-export the new |
|
|
625
|
+
| `data-puck-component`, `data-puck-dropzone`, `data-puck-entry`, `data-puck-dnd`, `data-puck-preview` | `data-easel-block`, `data-easel-dropzone`, `data-easel-entry`, `data-easel-dnd`, `data-easel-preview` — both are drawn; easel's own reads and `BLOCK_ATTRIBUTE`, `BLOCK_SELECTOR`, `LIST_SELECTOR` use the new (`LEGACY_BLOCK_ATTRIBUTE` names the old) |
|
|
626
|
+
| inspector mode `{ kind: "puck" }` | `SELECTION_MODE`, now `{ kind: "selection" }`; `isSelectionMode(mode)` accepts both spellings |
|
|
627
|
+
| the root's `id: "puck-root"` | `page-root`, in easel 22 (the recorded fixtures hold the old id until then) |
|
|
616
628
|
|
|
617
629
|
**A slot says how many blocks it holds** (Unreleased). Each slot component
|
|
618
630
|
has a read-only `blockCount`: the blocks it draws. A block of a type the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { C as CanvasTarget$1 } from './watch-
|
|
2
|
+
import { C as CanvasTarget$1 } from './watch-D8xZow3y.js';
|
|
3
3
|
import { S as SlotAddress, P as Place } from './types-41704JE4.js';
|
|
4
4
|
import { D as DragSession } from './session-DSQFmIvx.js';
|
|
5
5
|
import { D as DragWords } from './words-SD4neL0n.js';
|
|
@@ -173,6 +173,10 @@ interface HostPickedMedia {
|
|
|
173
173
|
/** What `id` names. A host that sends none answers as before: a
|
|
174
174
|
* field that keeps ids treats the pick as `url`. */
|
|
175
175
|
source?: PickedMediaSource;
|
|
176
|
+
/** A VIDEO's own still, cut once by the host's backend when the video was
|
|
177
|
+
* stored: what a page shows until the video plays. Absent for an image, a
|
|
178
|
+
* video with no still, and a host that sends none. */
|
|
179
|
+
posterUrl?: string;
|
|
176
180
|
}
|
|
177
181
|
/** The SECTION editor's target (the standalone one-section surface). */
|
|
178
182
|
type SectionScreenTarget = {
|
package/dist/blocks/index.d.ts
CHANGED
|
@@ -240,7 +240,7 @@ type DropZoneProps = {
|
|
|
240
240
|
type SlotComponent = ((props?: Omit<DropZoneProps, 'zone'>) => ReactNode) & {
|
|
241
241
|
readonly blockCount?: number;
|
|
242
242
|
};
|
|
243
|
-
/** The `
|
|
243
|
+
/** The `editor` prop every block's `render` receives; `puck` is the same value under its old name. */
|
|
244
244
|
type BlockContext = {
|
|
245
245
|
renderDropZone: FC<DropZoneProps>;
|
|
246
246
|
metadata: Metadata;
|
|
@@ -248,14 +248,16 @@ type BlockContext = {
|
|
|
248
248
|
dragRef: ((element: Element | null) => void) | null;
|
|
249
249
|
};
|
|
250
250
|
type WithBlockProps<Props> = Props & {
|
|
251
|
+
editor: BlockContext;
|
|
252
|
+
/** @deprecated The same value as `editor`; removed in easel 22. */
|
|
251
253
|
puck: BlockContext;
|
|
252
254
|
editMode?: boolean;
|
|
253
255
|
};
|
|
254
256
|
type WithChildren<Props> = Props & {
|
|
255
257
|
children: ReactNode;
|
|
256
258
|
};
|
|
257
|
-
type AsFieldProps<Props> = Omit<Props, 'children' | 'puck' | 'editMode'>;
|
|
258
|
-
/** A block's `render`: its own props with slots as `SlotComponent`s, its id, and `puck`. */
|
|
259
|
+
type AsFieldProps<Props> = Omit<Props, 'children' | 'editor' | 'puck' | 'editMode'>;
|
|
260
|
+
/** A block's `render`: its own props with slots as `SlotComponent`s, its id, `editor` and the deprecated `puck`. */
|
|
259
261
|
type BlockComponent<Props> = (props: WithId<WithBlockProps<{
|
|
260
262
|
[K in keyof Props]: WithDeepSlots<Props[K], SlotComponent>;
|
|
261
263
|
}>>) => JSX.Element;
|
|
@@ -19,7 +19,7 @@ type SettingsBucket = (typeof SETTINGS_BUCKETS)[number];
|
|
|
19
19
|
*
|
|
20
20
|
* A key, not a word: what each group is CALLED is `PanelWords.designGroups`.
|
|
21
21
|
* The host emits a heading for each group it has (`DESIGN_GROUP_KEY` in
|
|
22
|
-
* `screen/lib/
|
|
22
|
+
* `screen/lib/document/field-buckets`); Content's is a marker that draws nothing.
|
|
23
23
|
* One list for both editors, like `SETTINGS_BUCKETS`.
|
|
24
24
|
*/
|
|
25
25
|
declare const DESIGN_GROUPS: readonly ["Content", "Size", "Design", "Layout", "Position", "Anchor"];
|
package/dist/canvas/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
import { C as CanvasTarget, W as WatchOptions } from '../watch-
|
|
3
|
-
export { B as BLOCK_SELECTOR, a as CANVAS_SELECTOR, L as LIST_SELECTOR, i as isFrameReady, w as watchCanvasFrame } from '../watch-
|
|
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-
|
|
2
|
+
import { C as CanvasTarget, W as WatchOptions } from '../watch-D8xZow3y.js';
|
|
3
|
+
export { B as BLOCK_SELECTOR, a as CANVAS_SELECTOR, L as LIST_SELECTOR, i as isFrameReady, w as watchCanvasFrame } from '../watch-D8xZow3y.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-BNgSq2Nw.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The small facts every canvas surface needs, written once — pure DOM, no
|
|
@@ -25,8 +25,10 @@ export { R as REPEAT_ATTRIBUTE, a as REPEAT_INDEX_ATTRIBUTE, i as isRepeatCopy,
|
|
|
25
25
|
* is not an instance of the host's `HTMLElement`.
|
|
26
26
|
*/
|
|
27
27
|
declare function isTypingTarget(target: EventTarget | null): boolean;
|
|
28
|
-
/** The attribute on every block the canvas draws
|
|
29
|
-
declare const BLOCK_ATTRIBUTE = "data-
|
|
28
|
+
/** The attribute on every block the canvas draws. */
|
|
29
|
+
declare const BLOCK_ATTRIBUTE = "data-easel-block";
|
|
30
|
+
/** @deprecated Puck 0.20's name for {@link BLOCK_ATTRIBUTE}, still drawn beside it; removed in easel 22. */
|
|
31
|
+
declare const LEGACY_BLOCK_ATTRIBUTE = "data-puck-component";
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
34
|
* The id of the block a pointer event landed on: the NEAREST ancestor (or the
|
|
@@ -234,4 +236,4 @@ declare function useCanvasLayout(canvas: CanvasTarget | null, { settle }?: {
|
|
|
234
236
|
settle?: readonly number[];
|
|
235
237
|
}): number;
|
|
236
238
|
|
|
237
|
-
export { BLOCK_ATTRIBUTE, type Box, CANVAS_TYPABLE_EVENT, CANVAS_TYPING_EVENT, type CanvasFit, CanvasTarget, type CanvasTypableEvent, type CanvasTypingEvent, WatchOptions, clientPointToLayer, drawnBox, elementScale, fitCanvas, framePointToHost, frameRectToHost, frameRectToLayer, frameScale, isTypingTarget, nodeIdAt, removeCanvasStyle, setCanvasNonce, upsertCanvasStyle, useCanvasEvent, useCanvasFrame, useCanvasLayout, useCanvasStyle, useCanvasTyping };
|
|
239
|
+
export { BLOCK_ATTRIBUTE, type Box, CANVAS_TYPABLE_EVENT, CANVAS_TYPING_EVENT, type CanvasFit, CanvasTarget, type CanvasTypableEvent, type CanvasTypingEvent, LEGACY_BLOCK_ATTRIBUTE, WatchOptions, clientPointToLayer, drawnBox, elementScale, fitCanvas, framePointToHost, frameRectToHost, frameRectToLayer, frameScale, isTypingTarget, nodeIdAt, removeCanvasStyle, setCanvasNonce, upsertCanvasStyle, useCanvasEvent, useCanvasFrame, useCanvasLayout, useCanvasStyle, useCanvasTyping };
|
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,LEGACY_BLOCK_ATTRIBUTE,LIST_SELECTOR,clientPointToLayer,drawnBox,elementScale,fitCanvas,framePointToHost,frameRectToHost,frameRectToLayer,frameScale,isFrameReady,isTypingTarget,nodeIdAt,removeCanvasStyle,setCanvasNonce,upsertCanvasStyle,useCanvasEvent,useCanvasFrame,useCanvasLayout,useCanvasStyle,useCanvasTyping,watchCanvasFrame}from"../chunk-4FD7TAOE.js";export{REPEAT_ATTRIBUTE,REPEAT_INDEX_ATTRIBUTE,isRepeatCopy,mainCopyOf,queryAllCopies,queryMainCopy}from"../chunk-LF3FUSCQ.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-VKPOH6MK.js";import{blockTypesIn as o}from"./chunk-CPL43ZLJ.js";import{sectionTemplatesOf as l}from"./chunk-N7E6264U.js";import{sharedSectionsOf as r}from"./chunk-N3MJOHAG.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-SINAM2IT.js";import{blockRuns as c}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-OHZHYROJ.js";import{useEaselSession as m}from"./chunk-YM4UEGBV.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-EB6NI2VK.js";import{useEasel as u}from"./chunk-TUXLORVR.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-WJJ7H42G.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-TQ5Y6S2X.js";import{useState as b,useEffect as v,useMemo as j,useRef as O}from"react";import{SharedIcon as w,AddIcon as C}from"efficient-shell/icons/efficient";import{ContextMenu as I,toast as E,Dialog as H,Button as M}from"efficient-shell/ui";import{jsx as T,jsxs as $,Fragment as x}from"react/jsx-runtime";function L({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=O(null);/* @__PURE__ */
|
|
2
|
+
return T(H,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */$(x,{children:[
|
|
3
|
+
/* @__PURE__ */T(M,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
|
|
4
|
+
/* @__PURE__ */T(M,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var F=e=>`section:${e}`,N=e=>`block:${e}`,R=e=>`template:${e}`,S=e=>`shared:${e}`;function A({at:O,placeBlocks:H,canTake:M,onPick:A,itemFor:B,session:J,siteWide:U,onClose:V,onHide:W,readOnly:z}){const G=u(e=>e.config),P=a(),{labelAtLevel:Q,categoryLabel:Y,firstSection:D,Icon:K,Thumbnail:X}=P,{blockIsOffered:Z,canAddTo:_}=d(),q=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>Z(e,te);return l(te).list().then(n=>{if(e)return;const l=G.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[G,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=>Z(e,te);return r(te).list().then(n=>{if(e)return;const l=G.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[G,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(G,P),[G]),ye=e=>Q(e,"section",G.components[e]?.label??e),he=e=>({type:F(e.type),label:e.name,cover:/* @__PURE__ */T(X,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:q.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__ */T("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */T(K,{type:e,size:26})}),be=j(()=>{const e=t(ue,D),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!Z(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=_(t.type)?.choices??[];e.forEach(l),e.forEach(e=>_(e.type,1)?.choices?.forEach(l))}H?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:N(e.type),label:e.label,cover:ge(e.type),title:q.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:S(e.id),label:e.title,cover:/* @__PURE__ */T(X,{type:e.node.type}),mark:/* @__PURE__ */T(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:q.templates,tiles:ne.map(e=>({type:R(e.id),label:e.name,cover:/* @__PURE__ */T(X,{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(G.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(G,t,Y),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)})}),!M)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?M(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,G,q,M,H,te]);/* @__PURE__ */
|
|
5
|
+
return $(x,{children:[
|
|
6
|
+
/* @__PURE__ */T(i,{icon:/* @__PURE__ */T(C,{size:15}),title:q.title,context:q.contextAll,actions:/* @__PURE__ */T(s,{label:q.done,description:q.doneDescription,onClick:V}),onHide:W}),
|
|
7
|
+
/* @__PURE__ */$("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
+
/* @__PURE__ */T(k,{groups:be,session:J,itemFor:e=>B(ke(e)??{kind:"section",type:e}),onInsert:A?e=>{const t=ke(e);t&&A(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!z&&(pe({section:n.section,...t}),!0)},at:O,hint:q.hint,searchLabel:q.search,readOnly:z,words:ee}),U??null]}),de?/* @__PURE__ */T(I,{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__ */T(L,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void E.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{A as AddSidePanel,N as blockKey,F as sectionKey,S as sharedKey,R as templateKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEaselSession as e}from"./chunk-YM4UEGBV.js";import{useHostEscape as n}from"./chunk-MQA7OFRA.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-EB6NI2VK.js";import{styleMenuItems as o}from"./chunk-V7U33NF2.js";import{ROOT_ZONE as l}from"./chunk-TCAAOYQY.js";import{easelMenuEntries as r,menuLabel as i}from"./chunk-FIVU2COQ.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-P5VYGWYO.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-4FD7TAOE.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-K7BTCBWD.js";import{useState as y,useCallback as k,useRef as b,useEffect as g}from"react";import{ContextMenu as v}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as O,LayersIcon as z,CopyIcon as A}from"efficient-shell/icons/efficient";import{jsx as P}from"react/jsx-runtime";function D(e,n){const t=[],o=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===l)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var K=c(),j=/* @__PURE__ */new WeakMap;function M(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=j.get(n);return t||(t=c(),j.set(n,t)),t}function T(){return M(e())}function Y(e,n,t){if(n===l){const{floor:n,cap:o}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function B(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function E(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?Y(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=Y(e,l.zone,l.index+1);if(o(n,t))return t}return null}function I(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(u(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function S(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=B(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:E(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function V(e,n){const{zone:t,index:r}=n,i=e.nodeAt(t,r);if(!i)return[];const c=i.props.id,a=e.labelOf(i.type,t),u=Boolean(i.props._hidden),d=e.nodeOps,p=e.isPinned(i,t),f=e.isLocked(i),m=!p&&!f&&!e.duplicateBlocked(i),h=e.permits?.(i)??{duplicate:!0,delete:!0},y=B(e,i,t),k=D(e,n),b=d.held,g=b&&!p?E(e,b,n):null,v=!e.readOnly,w=e.style?o({held:v?e.style.held():null,canCopy:e.style.canCopy(i,t),onCopy:()=>e.style?.copy(i,t),onPaste:()=>e.style?.paste(t,r,i),words:e.words?.styleClipboard}):[];return s({title:a,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},r=n.zone===l?null:e.slotRung?.(n.zone)??null;return r?[o,{label:r.label,checked:!1,onClick:r.select}]:[o]})},actions:{duplicate:v&&m&&h.duplicate?()=>d.duplicate(c):void 0,...R(v&&!p,e=>d.canStep(c,e),e=>d.step(c,e)),copy:y.copy?()=>d.copy(c,a):void 0,cut:v&&y.cut?()=>d.cut(c,a):void 0,paste:v&&b&&g?{label:b.label,run:()=>d.paste(g)}:void 0,rename:v&&e.renamePropOf(i,t)?()=>e.beginRename(t,r):void 0,hide:!v||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:v&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:e.menuRows?.(i,t,r)??void 0,pinnedLine:p?X(e).pinned:void 0})}function R(e,n,t){return e?{moveUp:n(-1)?()=>t(-1):null,moveDown:n(1)?()=>t(1):null}:{}}var X=e=>e.words?.screen??t.menu;function F(e){const n=X(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */P(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */P(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=Y(e,l,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===l)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */P(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??t.pageSettings,icon:/* @__PURE__ */P(O,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */P(z,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function L(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??a,c=X(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */P(A,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */P(A,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */P(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function N(e){return e.shiftKey}function U(e,t){const[o,l]=y(null),r=k(()=>l(null),[]);n(null!==o,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=I(e);if(!o)return;const l=t.selected();if(!l)return;const r=S(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;g(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(t,"keydown",c);const a=k(n=>{if(N(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(t,"contextmenu",n=>{if(N(n)||!t)return;const o=n.target?.closest?.("[data-easel-block]")??null,r=o?.getAttribute("data-easel-block"),i=r?e.locate(r):null;n.preventDefault();const c=p(t.frame,n.clientX,n.clientY),s=t.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(t,"mousedown",r),d(t,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:o?/* @__PURE__ */P(W,{host:e,target:o,onClose:r}):null,closeMenu:r}}function W({host:e,target:n,onClose:t}){const o="node"===n.kind?V(e,n):"input"===n.kind?L(e,n.el):F(e);return 0===o.length?null:/* @__PURE__ */P(v,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),items:r(o)})}export{K as EASEL_NODE_CLIPBOARD,D as ancestorChain,M as nodeClipboardOf,B as nodeClipboardRules,V as nodeMenuItems,I as nodeShortcut,F as pageMenuItems,E as pastePlace,S as runNodeShortcut,L as textMenuItems,T as useNodeClipboard,U as useNodeContextMenu};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createPreviewSelectionContext as e}from"./chunk-TIAWIOGD.js";var{Provider:r,useSelection:o}=e("selectedPartId");export{r as PreviewPartsProvider,o as usePreviewParts};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as t,useEffect as e,useRef as n}from"react";var o=/* @__PURE__ */new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function r(t){const e=t;if(!e||"string"!=typeof e.tagName)return!1;const n=e.tagName.toUpperCase();if("TEXTAREA"===n||"SELECT"===n)return!0;if("INPUT"===n)return!o.has(String(e.type??"text").toLowerCase());if(e.isContentEditable)return!0;const r=e.closest?.("[contenteditable]");return!(!r||"false"===r.getAttribute("contenteditable"))||null!=e.closest?.('[role="textbox"]')}var i="data-easel-block",c="data-puck-component";function u(t,e=i){const n=t;return n&&"function"==typeof n.closest?n.closest(`[${e}]`)?.getAttribute(e)??null:null}function l(t){const e=t.getBoundingClientRect();if(e.width>0&&e.height>0)return{left:e.left,top:e.top,width:e.width,height:e.height};let n=1/0,o=1/0,r=-1/0,i=-1/0;for(const e of Array.from(t.children)){const t=e.getBoundingClientRect();t.width<=0||t.height<=0||(n=Math.min(n,t.left),o=Math.min(o,t.top),r=Math.max(r,t.right??t.left+t.width),i=Math.max(i,t.bottom??t.top+t.height))}return n===1/0?{left:e.left,top:e.top,width:e.width,height:e.height}:{left:n,top:o,width:r-n,height:i-o}}function s(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function a(t,e,n){const o=t.getBoundingClientRect(),r=n?.getBoundingClientRect()??{left:0,top:0},i=s(t);return{left:o.left-r.left+e.left*i,top:o.top-r.top+e.top*i,width:e.width*i,height:e.height*i}}function d(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function f(t,e,n){const o=a(t,e,n),r=d(n);return{left:o.left/r,top:o.top/r,width:o.width/r,height:o.height/r}}function h(t,e,n){const o=t.getBoundingClientRect(),r=d(t);return{x:(e-o.left)/r,y:(n-o.top)/r}}function m(t,e,n,o){const{left:r,top:i}=a(t,{left:e,top:n,width:0,height:0},o);return{x:r,y:i}}function w({available:t,width:e,maxScale:n=1}){const o=Math.max(0,t);if(!e||e<=0)return{width:o,scale:1,shownWidth:o};const r=o>0?Math.min(o/e,n):1;return{width:e,scale:r,shownWidth:e*r}}var g="data-es-canvas-style",b=/* @__PURE__ */new WeakMap;function p(t,e){e?b.set(t,e):b.delete(t)}function v(t,e,n){const o=t.head??t.documentElement;let r=E(t,e);if(!r){r=t.createElement("style"),r.setAttribute(g,e);const n=b.get(t);n&&r.setAttribute("nonce",n),o.appendChild(r)}return r.textContent!==n&&(r.textContent=n),r}function y(t,e){E(t,e)?.remove()}function E(t,e){for(const n of Array.from(t.querySelectorAll(`style[${g}]`)))if(n.getAttribute(g)===e)return n;return null}var A="[data-easel-block]",C="[data-easel-dropzone]",L="iframe#preview-frame";function x(t){const e=t.contentDocument;if(!e||!t.contentWindow||"loading"===e.readyState||!e.body)return!1;if(t.hasAttribute("srcdoc"))return"about:srcdoc"===e.URL;const n=t.getAttribute("src");return!n||"about:blank"===n||"about:blank"!==e.URL}function M(t,e,{selector:n=L,readySelector:o}={}){let r=null,i=null,c=!1,u=!1,l=null;const s=()=>{l?.observer.disconnect(),l=null},a=()=>{if(u)return;let t=null;if(r&&x(r)){const e=r.contentDocument;(t=>{if(!o||t.querySelector(o))return s(),!0;if(l?.doc!==t){s();const e=t.defaultView?.MutationObserver;if(e){const n=new e(()=>a());n.observe(t,{childList:!0,subtree:!0}),l={doc:t,observer:n}}}return!1})(e)&&(t={frame:r,document:e,window:r.contentWindow})}else s();(t===i||!!t&&!!i&&t.frame===i.frame&&t.document===i.document)&&c||(c=!0,i=t,e(i))},d=()=>a(),f=()=>{const e=t.querySelector?.(n);e!==r?(r?.removeEventListener("load",d),r=e,r?.addEventListener("load",d),a()):a()},h=t.ownerDocument?.defaultView??t.defaultView,m=h?.MutationObserver,w=m?new m(t=>(t=>null!==r&&!r.isConnected||t.some(t=>[...t.addedNodes,...t.removedNodes].some(t=>"IFRAME"===t.nodeName||!!t.querySelector?.("iframe"))))(t)&&f()):null;return w?.observe(t,{childList:!0,subtree:!0}),f(),()=>{u=!0,w?.disconnect(),s(),r?.removeEventListener("load",d),r=null}}function R(n,{selector:o,readySelector:r}={}){const[i,c]=t(null);return e(()=>{const t=n.current;if(!t)return;const e=M(t,c,{selector:o,readySelector:r});return()=>{e(),c(null)}},[n,o,r]),i}var S="easel:canvas-typing",B="easel:canvas-typable";function k(t,o,r,{on:i="document",capture:c=!1}={}){const u=n(r);u.current=r;const l=t?.document??null,s=t?.window??null;e(()=>{const t="window"===i?s:l;if(!t)return;const e=t=>u.current(t);return t.addEventListener(o,e,c),()=>t.removeEventListener(o,e,c)},[l,s,o,i,c])}function W(e){const[n,o]=t(!1);return k(e,S,t=>o(Boolean(t.detail?.typing))),n}function q(t,n,o){const r=t?.document??null;e(()=>{if(!r)return;if(!o)return void y(r,n);const t=v(r,n,o),e=r.defaultView?.MutationObserver,i=e?new e(()=>{t.isConnected||v(r,n,o)}):null;return i?.observe(r.head??r.documentElement,{childList:!0}),()=>{i?.disconnect(),y(r,n)}},[r,n,o])}function N(n,{settle:o=[150,450]}={}){const[r,i]=t(0),c=n?.frame??null,u=n?.document??null,l=n?.window??null,s=o.join(",");return e(()=>{if(!c||!u||!l)return;const t=c.ownerDocument.defaultView;let e=!1,n=0;const r=()=>{if(e)return;e=!0;const o=()=>{e=!1,i(t=>t+1)};t?.requestAnimationFrame?n=t.requestAnimationFrame(o):o()},s=[],a=(t,e)=>{t.addEventListener(e,r,!0),s.push(()=>t.removeEventListener(e,r,!0))};a(u,"scroll"),a(l,"resize"),t&&(a(t,"scroll"),a(t,"resize"));const d=t?.ResizeObserver;if(d){const t=new d(r);t.observe(c),u.documentElement&&t.observe(u.documentElement),s.push(()=>t.disconnect())}const f=u.defaultView?.MutationObserver,h=u.body??u.documentElement;if(f&&h){const t=new f(r);t.observe(u===c.ownerDocument?c:h,{childList:!0,subtree:!0}),s.push(()=>t.disconnect())}const m=u.fonts;m&&a(m,"loadingdone");const w=o.map(t=>setTimeout(r,t));return r(),()=>{for(const t of s)t();for(const t of w)clearTimeout(t);n&&t?.cancelAnimationFrame&&t.cancelAnimationFrame(n)}},[c,u,l,s]),r}export{i as BLOCK_ATTRIBUTE,A as BLOCK_SELECTOR,L as CANVAS_SELECTOR,B as CANVAS_TYPABLE_EVENT,S as CANVAS_TYPING_EVENT,c as LEGACY_BLOCK_ATTRIBUTE,C as LIST_SELECTOR,h as clientPointToLayer,l as drawnBox,d as elementScale,w as fitCanvas,m as framePointToHost,a as frameRectToHost,f as frameRectToLayer,s as frameScale,x as isFrameReady,r as isTypingTarget,u as nodeIdAt,y as removeCanvasStyle,p as setCanvasNonce,v as upsertCanvasStyle,k as useCanvasEvent,R as useCanvasFrame,N as useCanvasLayout,q as useCanvasStyle,W as useCanvasTyping,M as watchCanvasFrame};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useSectionOps as o}from"./chunk-MLQKNED6.js";import{SELECTION_MODE as e}from"./chunk-OHZHYROJ.js";import{decodePartId as r,encodePartId as t}from"./chunk-R4AUZVA3.js";import{useEasel as n}from"./chunk-TUXLORVR.js";import{usePreviewParts as p}from"./chunk-467WWV4I.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=n(o=>o),f=o(),{setSelectedPartId:k,setSelectHandler:l}=p(),I=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}),a?.(n)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{l(I)},[l,I]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{k(h)},[h,k]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&f.select(r)},[i,u,f]),openPartId:h}}export{m as usePartBridge};
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{newNodeId as t}from"./chunk-
|
|
1
|
+
import{newNodeId as t}from"./chunk-TCAAOYQY.js";function o(t){return{root:{props:{}},content:[t],zones:{}}}function r(t){return(t.content??[])[0]??null}function n(t){return Array.isArray(t)&&t.length>0&&t.every(t=>!!t&&"object"==typeof t&&"string"==typeof t.type&&"object"==typeof t.props)}function e(o,r){const p={...o.props,id:t(o.type)};for(const[t,o]of Object.entries(p))n(o)&&(p[t]=o.map(t=>e(t,r)));const s={type:o.type,props:p};if(!r)return s;const c=r(s);return{...c,props:{...c.props,id:p.id}}}export{e as cloneNodeWithFreshIds,r as docToNode,o as nodeToDoc};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{applyEaselChromeTheme as e}from"./chunk-LOMEH6DG.js";import{useEaselSession as t}from"./chunk-
|
|
1
|
+
import{applyEaselChromeTheme as e}from"./chunk-LOMEH6DG.js";import{useEaselSession as t}from"./chunk-YM4UEGBV.js";import{currentEaselSession as n,setSessionBridgedSite as r}from"./chunk-SNF5764Q.js";import{useEaselHost as o}from"./chunk-MQA7OFRA.js";import{useState as s,useRef as a,useEffect as c}from"react";var u={canCreatePlatformTemplate:!1};function i(t,o={}){const s=o.session??n();s.auth.token=t.token,s.auth.brandId=t.brandId??null,r(s,t.siteId),(o.stampChromeTheme??!0)&&e(t.theme)}function m(e){const[n,r]=s(null),m=a(null),[l,f]=s(u),d=a(e?.onAuth),k=a(e?.onMessage);c(()=>{d.current=e?.onAuth,k.current=e?.onMessage});const p=o(),h=t();return c(()=>{const e=p.subscribe(e=>{const t=e;if("storefront-editor:auth"===t.type&&"string"==typeof t.token&&t.token){const e=!!m.current;m.current=t.token,r(t.token),i({...t,token:t.token},{stampChromeTheme:p.ownsDocument,session:h}),f((n=t.can)&&"object"==typeof n?{canCreatePlatformTemplate:!0===n.canCreatePlatformTemplate}:u),d.current?.(e)}else k.current?.(e);var n});if(p.send("storefront-editor:ready"),!h.usesBridgedToken)return e;const t=window.setInterval(()=>{m.current?window.clearInterval(t):p.send("storefront-editor:ready")},500);return()=>{e(),window.clearInterval(t)}},[p,h]),{token:n,tokenRef:m,capabilities:l}}export{u as NO_BRIDGED_CAPABILITIES,i as applyAuthGrant,m as useAdminBridge};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{routeSharedHostMessage as e}from"./chunk-77IWWW6X.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as s,readEaselFailure as i}from"./chunk-CLOS6SSX.js";import{useAdminBridge as l}from"./chunk-BIK3AO2V.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-YM4UEGBV.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-SNF5764Q.js";import{useEaselHost as k}from"./chunk-MQA7OFRA.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-EB6NI2VK.js";import{useAutosave as g}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as b,CLAIM_FAIL_OPEN_MS as S,holderOf as I}from"./chunk-THWO5YVZ.js";import{useWords as P}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as B,useState as R,useMemo as E,useCallback as O,useEffect as H,useRef as A}from"react";import{jsx as C}from"react/jsx-runtime";var M={content:[],root:{},zones:{}};var N=j(null);function T(){const e=B(N);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function V({target:j,addressing:B=o,onHostMessage:T,children:V}){const F=B,{homeSlug:D,entryMayBounce:L,entryBounce:W,onSwitch:Y,tellsHost:K,adapterFor:U,migrateRenamedProps:X,describeMissing:Z,onLoadFailed:x}=F,[G,Q]=R(j),z=k(),_=d(),q=E(()=>f(_),[_]),J=E(()=>t(_),[_]),$="template"===G.kind,ee="template"===G.kind?G.id:null,re="template"===G.kind?G.pageSlug??D??"":"document"===G.kind?G.slug??"":G.slug,ne="page"===G.kind?G.siteId??null:null,te=_.blocks,oe=E(()=>U(G,q,te),[U,q,te,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),ue=oe.capabilities,ae=O(e=>_.documentHooks?.stored?.(e)??e,[_]);H(()=>{m(_,ne)},[_,ne]);const se=A(G);H(()=>{se.current=G},[G]);const{token:ie,tokenRef:le,capabilities:ce}=l({onMessage:r=>{if(T?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Rr(e.target)}}}),de=!_.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(q.lock),[ke,ve]=R(null),[ge,pe]=R(null),[he,ye]=R(null),[we,be]=R(null),Se=P("screen",v),Ie=we?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(we,Se):null,[Pe,je]=R(null),Be=A(null),Re=A(null),[Ee,Oe]=R(!1),He=A(null),[Ae,Ce]=R(null),Me=A(null),[Ne,Te]=R(null),[Ve,Fe]=R(!1),De=A(null);H(()=>{De.current=Ne},[Ne]);const[Le,We]=R(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ye=A(Le);H(()=>{Ye.current=Le},[Le]);const Ke=A(()=>Promise.resolve(!1)),Ue=O(e=>{Re.current=e,Oe(!0)},[]),Xe=g({save:async({id:e,data:r})=>{if(p(Ye.current)){if(!await Ke.current(e,r)){if(!p(Ye.current))return void Ue({id:e,data:r});throw new Error("page save did not land")}}else Ue({id:e,data:r})},onFailure:(e,r)=>{0===r&&z.send("storefront-editor:save-failed")}}),{state:Ze,push:xe,flush:Ge,pause:Qe,resume:ze,stop:_e,reset:qe,retryNow:Je,hasPending:$e}=Xe,er=A(Ze);H(()=>{er.current=Ze},[Ze]);const rr=u(Ze),nr=O(()=>{const e=Re.current;e&&(Re.current=null,Oe(!1),xe(e))},[xe]),tr=A("");tr.current||(tr.current=h());const[or,ur]=R(0),ar=A(!1),[sr,ir]=R(L(j)),lr=A(!1);H(()=>{if(lr.current)return;lr.current=!0;const e=z.address.search(),r=W(j,e);r?z.address.load(r):L(j)&&ir(!1)},[j,z]);const cr=z.send;H(()=>{if(!de)return;let e=!1;const t=se.current,o=oe.resolve(re),u=_.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==D&&re!==D?void z.address.load({kind:"page",slug:D,siteId:ne??void 0}):(be({target:t,slug:re,missing:!0,sentence:Z?.(t)??null}),void x?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Be.current=n,je(n),ve(r.id),pe(r.kind??null),Me.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:M,s=X(a),i=u?await u(s):s;e||ye(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),be({target:t,slug:re,missing:!1,sentence:n(o,{slug:re},_),cause:r(o,_)}),x?.(t,o))}),()=>{e=!0}},[de,ie,$,oe,re]);const dr=O(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=le.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),fr=O(async e=>{const r=le.current;if(!r&&_.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,_)){cr("storefront-editor:auth-expired");const n=r?await dr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[cr,dr,_]),mr=O(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=O(async(e,r,n=!1)=>{if(null!==Be.current)return!1;if(!p(Ye.current))return!1;if(De.current)return!1;const t=await fr(()=>oe.saveLayout(e,r,Me.current,tr.current));if(t.ok)return Me.current=t.value.version??Me.current,Fe(!1),!0;const o=J.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ye.current=e,We(e),!1}const u=J.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await fr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return Me.current=n.value,Ke.current(e,r,!0)}_e(),De.current=u,Te(u)}return Fe(i(t.error,_)?.status===c),!1},[oe,fr,_e,_]);H(()=>{Ke.current=kr},[kr]);const vr=O(e=>{if(null!==Be.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);He.current=r,p(Ye.current)?xe({id:ke,data:r}):Ue({id:ke,data:r})},[ke,cr,Ue,xe,ae]),gr=O(async()=>{p(Ye.current)&&nr();return await Ge()&&null==Re.current},[nr,Ge]),pr=A(gr);H(()=>{pr.current=gr},[gr]);const hr=A(fr);H(()=>{hr.current=fr},[fr]);const yr=O(()=>{z.address.reload()},[z]),wr=A(()=>Promise.resolve(!1));H(()=>{wr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:Me.current,stored:async()=>{const r=await hr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Re.current||$e(),reload:yr}):Promise.resolve(!1)}},[oe,ke,$e,yr]);const br=null!==Pe;H(()=>{if(!fe||!ke||!de||br)return;let e=!1,r=null,n=null;const t=tr.current,o={claim:async e=>{const r=await hr.current(()=>fe.claim(ke,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Ye.current,heldWrite:()=>({pending:null!=Re.current||$e(),autoSaveEnabled:!er.current.paused,saveConflict:null!=De.current}),setAccess:e=>{Ye.current=e,We(e)},releaseHeldWrite:()=>{pr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{wr.current()}},u=J.makeClaimBeat(o),a=ar.current;return ar.current=!1,a||(We({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(b)},S)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),fe.release(ke,t).catch(()=>{})}},[ke,fe,de,ie,or,br]);const Sr=O(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Ir=O(()=>{We(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Pr=O(()=>{er.current.paused?(p(Ye.current)&&nr(),ze()):Qe()},[nr,Qe,ze]),jr=O(()=>{Je()},[Je]),Br=O(e=>{He.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{qe(),Re.current=null,Oe(!1)},setVersion:e=>{Me.current=e},setSaveConflict:Te,setAccess:We}),Y(e),Q(e),Be.current=null,je(null),ve(null),pe(null),ye(null),be(null),z.address.show(e),"document"!==e.kind&&K(e)&&z.send("storefront-editor:navigated",{target:e})},[qe,z,me,Y,K]),Rr=O(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,se.current,D))return;const r=null!=Re.current;if(!r&&!$e())return void Br(e);const n=er.current;r||n.paused||n.failed||n.stopped?Ce(e):Ge().then(r=>{r?Br(e):Ce(e)})},[Br,$e,Ge,D]),Er=O(()=>Ce(null),[]),Or=O(()=>{Ce(e=>(e&&Br(e),null))},[Br]),Hr=O(async()=>{const e=Ae;if(!e)return;await gr()&&(Ce(null),Br(e))},[Ae,gr,Br]),Ar=O(async e=>{if(null!==Be.current)return;if(!ke)return;if(!p(Ye.current)||De.current)return;const r=ae(e);if(!await kr(ke,r))return void(De.current||cr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void cr("storefront-editor:saved");const t=await fr(()=>n(ke,Me.current??void 0));if(!t.ok){const{error:e}=t;return void cr("storefront-editor:publish-failed",{reason:e instanceof Error&&e.message?e.message:null})}Me.current=t.value.version??Me.current,cr("storefront-editor:published")},[ke,oe,ue.canPublish,cr,kr,fr,ae]);/* @__PURE__ */
|
|
2
|
+
return C(N.Provider,{value:{target:G,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>He.current??he,error:Ie,redirecting:sr,saveStatus:rr,saveState:Ze,autoSaveEnabled:!Ze.paused,autoSaveStoppedByConflict:Ze.stopped,hasUnsavedEdits:Ze.pending||Ee,toggleAutoSave:Pr,retrySave:jr,onChange:vr,flushSave:gr,onPublish:Ar,access:Le,readOnly:null!==I(Le)||null!==Pe||null!==Ne,readOnlyReason:Pe,takeOverEditing:Sr,viewReadOnly:Ir,saveConflict:Ne,saveUnreachable:Ve,reloadFromServer:yr,navigate:Rr,pendingNav:Ae,cancelPendingNav:Er,discardAndNavigate:Or,saveAndNavigate:Hr},children:V})}export{N as ScreenDocumentContext,V as ScreenDocumentProvider,T as useScreenDocument};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{HERO_SLIDER_GOTO_EVENT as t}from"./chunk-AJ2SUSET.js";import{queryMainCopy as e}from"./chunk-LF3FUSCQ.js";import{isPreviewClick as n}from"./chunk-MGVI67QV.js";var o=()=>document.querySelector(".sf-editor #preview-frame");function r(t){n()||requestAnimationFrame(()=>{const n=o()?.contentDocument;n&&e(n,`[data-easel-block="${CSS.escape(t)}"]`)?.scrollIntoView({behavior:"smooth",block:"start"})})}function c(e,n){const r=o()?.contentWindow;if(!r)return;const c={id:e,index:n};r.dispatchEvent(new CustomEvent(t,{detail:c}))}function i(){requestAnimationFrame(()=>{o()?.contentWindow?.scrollTo({top:0,behavior:"smooth"})})}function s(t,{passes:e=[150,400],onPinned:n}={}){let r=0,c=!1;const i=[],s=()=>{const r=o(),l=r?.contentWindow,u=r?.contentDocument;if(!l||!u)return!1;const a=t(l,u);if(null==a)return!1;if(l.scrollTo({left:l.scrollX,top:a,behavior:"instant"}),!c){c=!0,n?.();for(const t of e)i.push(setTimeout(s,t))}return!0},l=()=>{!s()&&r++<150&&i.push(setTimeout(l,32))};return l(),()=>i.forEach(clearTimeout)}function l(t){return s((n,o)=>{const r=e(o,`[data-easel-block="${CSS.escape(t)}"]`);return r?n.scrollY+r.getBoundingClientRect().top:null})}function u(t){return s((t,e)=>{if(!e.querySelector("[data-easel-block]"))return null;const n=Math.max(e.documentElement.scrollHeight,e.body?.scrollHeight??0);return n<=e.documentElement.clientHeight?null:n},{passes:[150,400,800,1300,2e3],onPinned:t})}export{c as gotoPreviewSlide,u as pinPreviewToBottom,l as pinPreviewToSection,o as previewFrame,r as scrollPreviewToSection,i as scrollPreviewToTop};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselHost as n}from"./chunk-MQA7OFRA.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-
|
|
1
|
+
import{useEaselHost as n}from"./chunk-MQA7OFRA.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-TUXLORVR.js";import{useState as r,useEffect as o,useRef as u}from"react";function c(e){const t=n(),[u,c]=r(null);return o(()=>c(e.current),[e]),t.ownsDocument?"undefined"==typeof document?null:document:u}function i(r,u){const i=n(),s=e(),f=c(r);o(()=>{if(!i.ownsDocument&&f)return t(f,s,{leaveTyping:!0})},[i,s,f]);const m=u?.document??null;o(()=>{if(!i.ownsDocument&&m)return t(m,s,{leaveTyping:!0})},[i,s,m])}function s(n){return n.ownsDocument?{}:{tabIndex:-1}}function f(n){return!n.altKey&&!n.shiftKey&&(!(!n.metaKey&&!n.ctrlKey)&&("s"===n.key||"S"===n.key||"KeyS"===n.code))}function m(n,e,t){const r=c(n),i=u(t);o(()=>{i.current=t}),o(()=>{if(!r)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return r.addEventListener("keydown",n),()=>r.removeEventListener("keydown",n)},[r]);const s=e?.document??null;o(()=>{if(!s)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return s.addEventListener("keydown",n),()=>s.removeEventListener("keydown",n)},[s])}export{s as editorRootFocus,f as isSaveShortcut,c as useEaselKeyTarget,m as useEaselSaveKey,i as useEaselUndoKeys};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-OHZHYROJ.js";import{useEaselHost as e}from"./chunk-MQA7OFRA.js";import{createEasel as r,EaselProvider as o}from"./chunk-TUXLORVR.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};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-
|
|
1
|
+
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-YVFYWAYU.js";import{ScreenStoreProvider as e}from"./chunk-GWYNMSIP.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-BTDI7JAA.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-EB6NI2VK.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var k=r(e),N=r(n);function C({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const k=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
|
|
2
2
|
return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
|
|
3
3
|
/* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
|
|
4
4
|
/* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
|
|
5
5
|
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{k()},children:i.save})]}),children:i.body})}function j({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
-
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var y=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function
|
|
7
|
-
/* @__PURE__ */u(k,{config:r,data:i,onChange:h,permissions:
|
|
6
|
+
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var y=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function A({config:r,parts:n,wrap:e=y}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:j}=a(),A=t(()=>s(!g),[g]),Y=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:Y.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
|
|
7
|
+
/* @__PURE__ */u(k,{config:r,data:i,onChange:h,permissions:A,parts:n,children:/* @__PURE__ */u(N,{})}),f&&/* @__PURE__ */u(C,{onCancel:p,onDiscard:v,onSave:j})):/* @__PURE__ */u("div",{className:"sf-msg",children:Y.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:Y.waitingForAuthorization})}export{A as DocumentScreen,j as ScreenMount};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{noControlField as e}from"./chunk-
|
|
1
|
+
import{noControlField as e}from"./chunk-INRERJU4.js";import{DEFAULT_SCREEN_WORDS as n}from"./chunk-EB6NI2VK.js";import{useWords as r}from"./chunk-MFIRYGHW.js";import{usePreviewDevice as t}from"./chunk-BSPCSC45.js";import{jsx as o}from"react/jsx-runtime";function i(e){return"mobile"===e?"mobile":"desktop"}var c={desktop:null,tablet:n.deviceNote.tablet,mobile:n.deviceNote.mobile},u="data-sf-device-hidden";function d(){/* @__PURE__ */
|
|
2
2
|
return o("span",{hidden:!0,[u]:""})}function s({tier:e,render:n,...r}){return i(t())===e?/* @__PURE__ */o(n,{...r}):/* @__PURE__ */o(d,{})}var m="__device";function f(e){const n=e?.[m];return n??null}function l(e){return f(e)?.inner??e}function a(e,n){const r=n.render;return{...n,[m]:{tier:e,inner:n},render:n=>/* @__PURE__ */o(s,{tier:e,render:r,...n})}}function p(){const e=r("screen",n).deviceNote,i=t(),c="desktop"===i?null:e[i];return c?/* @__PURE__ */o("div",{className:"sf-device-scope",children:c}):/* @__PURE__ */o(d,{})}function v(){return e({type:"custom",render:()=>/* @__PURE__ */o(p,{})},"always")}export{m as DEVICE_FIELD_MARKER,u as DEVICE_HIDDEN_ATTR,c as DEVICE_NOTE,a as deviceField,f as deviceMetaOf,v as deviceNote,i as shownTier,l as withoutDeviceGate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-OHZHYROJ.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-TCAAOYQY.js";import{useEasel as o,useEaselApi as r}from"./chunk-TUXLORVR.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{WebsiteBackendError as e}from"./chunk-KCOBHPN6.js";import{backendOf as r}from"./chunk-
|
|
1
|
+
import{WebsiteBackendError as e}from"./chunk-KCOBHPN6.js";import{backendOf as r}from"./chunk-SNF5764Q.js";var s=()=>Promise.reject(new e("unavailable","This editor's backend keeps no shared sections.")),o={list:()=>Promise.resolve([]),create:s,remove:s};function t(e){return Boolean(r(e).sharedSections)}var n=e=>r(e).sharedSections??o;function a(e){return e.cache("easel:shared-sections",()=>({list:()=>n(e).list(),create:(r,s)=>n(e).create(r,s),remove:r=>n(e).remove(r)}))}export{t as keepsSharedSections,a as sharedSectionsOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{WebsiteBackendError as e}from"./chunk-KCOBHPN6.js";import{backendOf as s}from"./chunk-
|
|
1
|
+
import{WebsiteBackendError as e}from"./chunk-KCOBHPN6.js";import{backendOf as s}from"./chunk-SNF5764Q.js";var r=()=>Promise.reject(new e("unavailable","This editor's backend keeps no section templates.")),t={list:()=>Promise.resolve([]),get:()=>Promise.resolve(null),ensure:r,save:r,update:r,rename:r,remove:r},a=e=>s(e).sectionTemplates??t,n=e=>({list:()=>a(e).list(),get:s=>a(e).get(s),ensure:(s,r,t)=>a(e).ensure(s,r,t),save:(s,r)=>a(e).save(s,r),update:(s,r)=>a(e).update(s,r),rename:(s,r)=>a(e).rename(s,r),remove:s=>a(e).remove(s)}),o=n();function m(e){return e.cache("easel:section-templates",()=>n(e))}export{o as sectionTemplates,m as sectionTemplatesOf};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{usePickFollowsSelection as n}from"./chunk-FHCKFOCD.js";import{slotFieldsOf as e}from"./chunk-TCAAOYQY.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-TUXLORVR.js";import{Inspector as i}from"./chunk-PFFH7ASD.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:"selection"};function f(n){return"selection"===n.kind||"puck"===n.kind}function a(n,e){if(f(n)&&f(e))return!0;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 d(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function p(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function k(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 h={},v=()=>h,g=()=>"",y=()=>null,b=()=>{},O={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},j={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},w={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},C={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},L={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function S(){/* @__PURE__ */
|
|
2
|
+
return s(t,{height:"fill"})}function D(){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 F=o({});function P({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return s(F.Provider,{value:n,children:e})}function A(){return u(F)}function N(){return(A().useOwnerName??g)()}function T(){return(A().useDocumentLabel??y)()}function x(n,e,t,r){return(A().useBridges??v)(n,e,t,r)}function B(n){return(A().useStandaloneBridges??v)(n)}function G(n,e){(A().useDocumentPass??b)(n,e)}function I(){return A().blockRules??O}function R(){return A().blockLook??j}function H(){return A().devices??w}function K(){return A().leftView??C}function V(){return A().pinned??L}function Y(){return A().saveSwitch??!0}function Q(e){n(!0===A().pickFollowsSelection,e)}function U(){return A().storageNamespace||void 0}function X(){return A().styleClipboard??null}function Z(){return A().nodeKeys??!0}function q(){return A().notify??null}function z(){return A().Canvas??S}function E(){return A().CanvasHead??null}function J(){return A().canvasDrag??null}var M=o(null);function W({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return s(M.Provider,{value:n,children:e})}function $(){return u(M)}function _(){return A().Inspector??D}export{c as SELECTION_MODE,W as ScreenCanvasTargetProvider,P as ScreenPartsProvider,k as isPinnedFirst,m as isPinnedLast,f as isSelectionMode,d as isSlotMode,a as sameInspectorMode,p as screenSlotsOf,R as useScreenBlockLook,I as useScreenBlockRules,x as useScreenBridges,J as useScreenCanvasDrag,z as useScreenCanvasFrame,E as useScreenCanvasHead,$ as useScreenCanvasTarget,H as useScreenDevices,T as useScreenDocumentLabel,G as useScreenDocumentPass,_ as useScreenInspectorPanel,K as useScreenLeftView,Z as useScreenNodeKeys,q as useScreenNotify,N as useScreenOwnerName,A as useScreenParts,Q as useScreenPickFollowsSelection,V as useScreenPinned,Y as useScreenSaveSwitch,U as useScreenStorageNamespace,X as useScreenStyleClipboard,B as useStandaloneScreenBridges};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{
|
|
1
|
+
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{SETTINGS_BUCKETS as t,SettingsGroup as l}from"./chunk-FM6JO4WF.js";import{DEFAULT_PANEL_WORDS as a}from"./chunk-KFV7N2DJ.js";import{TreeSeam as r}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as o}from"./chunk-K56YDHYQ.js";import{easelMenuEntries as i}from"./chunk-FIVU2COQ.js";import{FieldNumber as s}from"./chunk-Y2T3JX7K.js";import{FieldSelect as c}from"./chunk-KFWNGPW3.js";import{SettingsField as d,SettingsSegmented as u}from"./chunk-S3DUFDQ6.js";import{DEFAULT_FIELDS_WORDS as m}from"./chunk-JACEEVVF.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{useTreeDrag as p,gapToMoveIndex as f}from"./chunk-3S5N4HLJ.js";import{withTip as b}from"./chunk-P2VEMZH5.js";import{Textarea as g,Input as v,ItemCount as y,SortableList as k,ListRow as x,ContextMenu as w,tabPanelId as C,Tabs as N,tabButtonId as O}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as j,useState as S,useLayoutEffect as $,useId as D}from"react";import{jsx as I,jsxs as F}from"react/jsx-runtime";import{ChevronIcon as P,LockIcon as L,MoveUpIcon as E,MoveDownIcon as M,DuplicateIcon as W,TrashIcon as T}from"efficient-shell/icons/efficient";function z({id:e,value:n,onChange:t,placeholder:l,multiline:a=!1,rows:r=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */I(g,{id:e,size:"sm",className:"es-fin",value:c,rows:r,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */I(v,{id:e,size:"md",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function R(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function A(e,n,t){const l=e.slice(),[a]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,a),l}function H(e,n){return e.filter((e,t)=>t!==n)}function J(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var K='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',V={parentId:"list",slot:"items"};function Y({label:e,icon:n,noun:t,items:l,onChange:a,newItem:s,summary:c,itemName:d,thumb:u,min:g=0,max:v,readOnly:C=!1,open:N,onOpen:O,renderItem:D,renderRow:z,canRemove:Y,lockedReason:B,fixed:Q=!1,removeOnRow:U=!0,canDuplicate:X,above:Z,head:q=!0}){const G=h("fields",m).list,_=h("tree",o),ee=t??G.item,ne=!C&&!Q&&("number"!=typeof v||l.length<v),te=l.length<=g,le=e=>!!Y&&!Y(l[e],e),ae=e=>!C&&!Q&&U&&!te&&!le(e),re=e=>ne&&(!X||X(l[e],e)),oe=(e,n)=>d?d(e,n):G.itemName({noun:ee,n:n+1}),ie=j([]),se=j(null),[ce,de]=S(null),ue=j(null),[me,he]=S(null),[pe,fe]=S("");$(()=>{const e=se.current;if(!e)return;se.current=null;const n=ie.current[e.index]?.querySelectorAll(K)[e.nth]??ie.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const be=(e,n)=>{if(n<0||n>=l.length||n===e)return;const t=ie.current[e],r=t?.ownerDocument.activeElement;if(t&&r&&t.contains(r)){const e=[...t.querySelectorAll(K)].indexOf(r),l=r;se.current={index:n,nth:e,start:"number"==typeof l.selectionStart?l.selectionStart:null,end:"number"==typeof l.selectionEnd?l.selectionEnd:null}}a(A(l,e,n));const o=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}(N,e,n);o!==N&&O(o),fe(G.moved({n:n+1,total:l.length}))},ge=e=>{ne&&(a(R(l,e,s())),z?(se.current={index:e,nth:0,start:null,end:null},null!==N&&N>=e&&O(N+1)):O(e))},ve=e=>{ae(e)&&(a(H(l,e)),N===e?O(null):null!==N&&N>e&&O(N-1))},ye=p({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===V.parentId&&n.slot===V.slot,onDrop:(e,n)=>{const t=f({...V,index:e},n);t!==e&&be(e,t)},onStep:(e,n)=>be(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<l.length,readOnly:C}),ke=e=>{const n=[];return e>0&&n.push({label:G.moveUp,icon:/* @__PURE__ */I(E,{size:14}),shortcut:"⌥↑",onClick:()=>be(e,e-1)}),e<l.length-1&&n.push({label:G.moveDown,icon:/* @__PURE__ */I(M,{size:14}),shortcut:"⌥↓",onClick:()=>be(e,e+1)}),re(e)&&n.push({label:G.duplicate,icon:/* @__PURE__ */I(W,{size:14}),onClick:()=>(e=>{re(e)&&(a(R(l,e+1,J(l[e]))),null!==N&&N>e&&O(N+1))})(e)}),ae(e)&&n.push({label:G.delete,icon:/* @__PURE__ */I(T,{size:14}),danger:!0,onClick:()=>ve(e)}),n},xe=(e,n,t,l)=>{C||0===ke(e).length||he({index:e,x:n,y:t,owner:l})},we=e=>n=>{const t=l.slice();t[e]=n,a(t)};/* @__PURE__ */
|
|
2
2
|
return F("div",{className:"es-list",children:[q?/* @__PURE__ */F("div",{className:"es-list-head",children:[
|
|
3
3
|
/* @__PURE__ */F("span",{className:"es-list-label",children:[n?/* @__PURE__ */I("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
|
|
4
|
-
/* @__PURE__ */I(y,{count:
|
|
5
|
-
/* @__PURE__ */I(x,{className:i,flat:!!z,active:
|
|
4
|
+
/* @__PURE__ */I(y,{count:l.length,label:G.count({noun:ee,n:l.length}),showZero:!0})]}):null,Z?/* @__PURE__ */I("div",{className:"es-list-above",children:Z}):null,l.length?/* @__PURE__ */F(k,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ye.rootProps(),children:[l.map((e,n)=>{const t=ye.row({item:n,place:{...V,index:n}}),l=t.draggable&&ce!==n,a=!z&&N===n,o=!C&&!Q&&U&&le(n),i=["es-list-row",z?"is-inline":"is-item",a?"is-open":"",l?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */I(r,{...ye.seam({place:{...V,index:n}}),onAdd:ne?()=>ge(n):void 0,label:G.addHere({noun:ee})},`seam-${n}`):null,
|
|
5
|
+
/* @__PURE__ */I(x,{className:i,flat:!!z,active:a,draggable:t.draggable,dragHint:_.dragHint,dragging:t.dragging,drop:"before"===t.drop||"after"===t.drop?t.drop:void 0,onMove:t.draggable?e=>be(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{ie.current[n]=e},rowProps:{...t.rowProps,draggable:l||void 0,onPointerDown:e=>{const l=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!l&&l===l.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!a,ue.current=l&&!a?l:null,de(a?n:null)},onDragStart:e=>{const n=ue.current;ue.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{C||(e.preventDefault(),e.stopPropagation(),xe(n,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const t=e.currentTarget.ownerDocument,l=e=>e.preventDefault();t.addEventListener("contextmenu",l,{capture:!0,once:!0}),t.defaultView?.setTimeout(()=>t.removeEventListener("contextmenu",l,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void xe(n,a.left+24,a.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)}},actions:C||Q||!U?void 0:o?b(B?B(e,n):G.locked,/* @__PURE__ */I("span",{className:"es-list-lock",role:"img","aria-label":B?B(e,n):G.locked,children:/* @__PURE__ */I(L,{size:13})})):b(G.deleteItem({noun:ee}),/* @__PURE__ */I("button",{type:"button",className:"es-list-x","aria-label":G.deleteItem({noun:ee}),disabled:!ae(n),onClick:()=>ve(n),children:"×"})),below:a?/* @__PURE__ */I("div",{className:"es-list-item",children:D(e,n,we(n))}):void 0,children:z?/* @__PURE__ */I("div",{className:"es-list-row-main",children:z(e,n,we(n))}):/* @__PURE__ */F("button",{type:"button",className:"es-list-open","aria-expanded":a,onClick:()=>O(a?null:n),children:[u?/* @__PURE__ */I("span",{className:"es-list-thumb","aria-hidden":"true",children:u(e,n)}):null,
|
|
6
6
|
/* @__PURE__ */I("span",{className:"es-list-row-name",children:oe(e,n)}),/* @__PURE__ */I("span",c?{className:"es-list-row-summary",children:c(e,n)}:{className:"es-list-row-summary"}),
|
|
7
7
|
/* @__PURE__ */I(P,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},n)]}),
|
|
8
|
-
/* @__PURE__ */I(
|
|
9
|
-
/* @__PURE__ */I("span",{className:"es-list-said","aria-live":"polite",children:pe}),me&&me.index<
|
|
10
|
-
/* @__PURE__ */I(w,{at:{x:me.x,y:me.y},owner:me.owner,onClose:()=>he(null),items:
|
|
11
|
-
return I(
|
|
12
|
-
return I(Y,{label:Q(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:r,newItem:()=>J({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:o,open:f,onOpen:b,renderItem:(a,r,d)=>Object.entries(n(e.arrayFields,{values:a,context:s})).map(([e,n])=>/* @__PURE__ */I(Z,{field:n,name:`${t}[${r}].${e}`,id:`${l}-${r}-${e}`,value:a?.[e],onChange:n=>d({...a,[e]:n}),readOnly:o,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function Z(e){const{field:n,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,renderers:
|
|
13
|
-
return I(
|
|
14
|
-
return I(
|
|
15
|
-
return I(
|
|
16
|
-
return I(
|
|
8
|
+
/* @__PURE__ */I(r,{...ye.seam({place:{...V,index:l.length}})})]}):null,C||Q?null:/* @__PURE__ */I("button",{type:"button",className:"es-list-add",disabled:!ne,onClick:()=>ge(l.length),children:G.add({noun:ee})}),
|
|
9
|
+
/* @__PURE__ */I("span",{className:"es-list-said","aria-live":"polite",children:pe}),me&&me.index<l.length?
|
|
10
|
+
/* @__PURE__ */I(w,{at:{x:me.x,y:me.y},owner:me.owner,onClose:()=>he(null),items:i(ke(me.index))}):null]})}var B=e=>e<6?e+1:6,Q=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function U({field:e,name:t,id:a,value:r,onChange:o,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=S(!0),p=r&&"object"==typeof r?r:{};/* @__PURE__ */
|
|
11
|
+
return I(l,{id:`${a}-group`,title:Q(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */I(Z,{field:n,name:`${t}.${e}`,id:`${a}-${e}`,value:p[e],onChange:n=>o({...p,[e]:n}),readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:B(u)},e))})}function X({field:e,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=S(null),f=u?d??null:h,b=u??p,g=Array.isArray(a)?a:[],v=e.getItemSummary;/* @__PURE__ */
|
|
12
|
+
return I(Y,{label:Q(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:r,newItem:()=>J({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:o,open:f,onOpen:b,renderItem:(a,r,d)=>Object.entries(n(e.arrayFields,{values:a,context:s})).map(([e,n])=>/* @__PURE__ */I(Z,{field:n,name:`${t}[${r}].${e}`,id:`${l}-${r}-${e}`,value:a?.[e],onChange:n=>d({...a,[e]:n}),readOnly:o,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function Z(e){const{field:n,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,renderers:m}=e;if(!n||n.marker||!1===n.visible)return null;const h=m?.[n.type];if(h)return h({field:n,name:t,id:l,value:a,onChange:r,readOnly:o});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:a,onChange:r,readOnly:o};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
+
return I(d,{label:Q(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */I(z,{id:l,value:"string"==typeof a?a:null==a?"":String(a),onChange:r,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:o})});case"number":/* @__PURE__ */
|
|
14
|
+
return I(d,{label:Q(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */I(s,{id:l,value:"number"==typeof a?a:void 0,onChange:r,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:o})});case"select":{const e=`${l}-label`;/* @__PURE__ */
|
|
15
|
+
return I(d,{label:Q(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */I(c,{id:l,value:a,options:n.options,onChange:r,readOnly:o,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
16
|
+
return I(d,{label:Q(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */I(u,{ariaLabel:Q(n,t),value:a,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||o})),onChange:e=>{o||r(e)}})});case"object":/* @__PURE__ */
|
|
17
17
|
return I(U,{...e,field:n});case"array":/* @__PURE__ */
|
|
18
|
-
return I(X,{...e,field:n});case"slot":return null}}var q=e=>
|
|
18
|
+
return I(X,{...e,field:n});case"slot":return null}}var q=e=>t.includes(e);function G(n,l){let a,r=t[0];const o=[],i=/* @__PURE__ */new Set;for(const[t,s]of Object.entries(n))s&&(q(s.bucket)&&((s.marker||s.bucket!==r)&&(a=void 0),r=s.bucket),s.marker&&"string"==typeof s.fold?a={key:t,title:s.fold}:s.marker&&!1===s.fold&&(a=void 0),s.marker||!1===s.visible||l&&!e(s,l)||(o.push(a?{name:t,field:s,bucket:r,fold:a}:{name:t,field:s,bucket:r}),"slot"!==s.type&&i.add(r)));return{rows:o,buckets:t.filter(e=>i.has(e))}}function _(e){return new Map(G(e).rows.map(e=>[e.name,e.bucket]))}function ee(e){const n=[];for(const t of e){const e=n[n.length-1];e&&e.fold?.key===t.fold?.key?e.rows.push(t):n.push({fold:t.fold,rows:[t]})}return n}function ne({fields:e,values:n,onChange:t,readOnly:r=!1,context:o,showWhenContext:i,tab:s,onTab:c,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:p,ariaLabel:f,lead:b,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const w=h("panel",a),j=D(),$=p??`es-insp${j.replace(/:/g,"")}`,P=G(e,{values:n,context:i}),[L,E]=S(void 0),M=s??L,W=M&&P.buckets.includes(M)?M:P.buckets[0],[T,z]=S(null),R=T&&T.panel===$&&P.rows.some(e=>e.name===T.name)?T:null,A=d&&P.buckets.length>1,H=A&&W?C($,W):`${$}-rows`,[J,K]=S(()=>/* @__PURE__ */new Set),V=y??J,Y=(e,n)=>{/* @__PURE__ */return I(l,{title:e.title,open:!V.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&K(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),k?.(e,n)})(e.key,n),id:`${$}-fold-${t=e.key,[...t].map(e=>/[A-Za-z0-9_-]/.test(e)?e:`-u${e.codePointAt(0).toString(16)}-`).join("")}`,level:x,children:n});var t},Q=e=>A&&e!==W,U=({name:e,field:l,bucket:a,fold:s})=>/* @__PURE__ */I("div",{className:"es-insp-row","data-field":e,"data-bucket":a,hidden:!!Q(a)||void 0,children:/* @__PURE__ */I(Z,{field:l,name:e,id:`${$}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:r,context:o,showWhenContext:i,renderers:m,openItem:R&&R.name===e?R.index:null,onOpenItem:n=>z(null===n?null:{panel:$,name:e,index:n}),headingLevel:s?B(x):x})},e);/* @__PURE__ */
|
|
19
19
|
return F("div",{className:"es-insp",children:[A?/* @__PURE__ */I("div",{className:"es-insp-tabs",children:/* @__PURE__ */I(N,{variant:"underline",block:!0,"aria-label":f??w.settings,idPrefix:$,value:W,onChange:e=>{const n=e;void 0===s&&E(n),c?.(n)},items:P.buckets.map(e=>{const n=w.buckets[e],t=u?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */I("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
20
20
|
/* @__PURE__ */F("div",{className:"es-insp-rows",id:H,role:A?"tabpanel":void 0,"aria-labelledby":A&&W?O($,W):void 0,children:[b?v?/* @__PURE__ */I("div",{className:"es-insp-band","data-fold":v.key,children:Y(v,b)}):b:null,ee(P.rows).map((e,n)=>{if(!e.fold)return e.rows.map(U);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
21
21
|
return I("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!Q(t)&&!l)||void 0,children:Y(e.fold,e.rows.map(U))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{z as FieldText,ne as Inspector,Z as InspectorField,Y as ListField,_ as bucketsOf,J as copyItem,R as insertAt,Q as labelOf,A as moveTo,G as planFields,H as removeAt};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=/* @__PURE__ */Symbol.for("efficient-web.efficient-backend");function n(n){return!!n&&!0===n[e]}function t(e){return e?.trim()||null}var r=null,i=/* @__PURE__ */new WeakMap,o=/* @__PURE__ */new WeakMap;function l(e){r=e}function u(e=k()){if(e.hostBackend)return e.hostBackend;let n=i.get(e);if(!n){const t=o.get(e)??r;if(!t)throw new Error("efficient-web-builder: this editor was given no backend, and its host named no default one. Pass `backend`, or load the host's default backend first (the storefront's is lib/efficient-backend).");n=t(e),i.set(e,n)}return n}function s(e){if(!e.registry)throw new Error("efficient-web-builder: this editor was mounted with no block registry. Pass `registry` to createEditorSession (the storefront's is lib/document/config).");return e.registry}function d(e={}){const t=e.backend??null,r=null===t?e.defaultBackend??null:null,i=/* @__PURE__ */new Map,l={documentId:null,bridgedId:null},s={hostBackend:t,usesBridgedToken:null===t||n(t),blocks:e.blocks??null,registry:e.registry??null,chrome:e.chrome??null,documentHooks:e.documentHooks??null,claimsPage:e.claimsPage??!0,hostFailures:e.hostFailures??null,auth:{token:null,brandId:null},site:l,siteId:()=>l.documentId??l.bridgedId,cache:(e,n)=>(i.has(e)||i.set(e,n()),i.get(e)),forget(e){void 0===e?i.clear():i.delete(e)}};return r&&(o.set(s,r),Object.defineProperty(s,"usesBridgedToken",{get:()=>n(u(s)),enumerable:!0})),s}function c(e,n){e.site.documentId=t(n)}function a(e,n){e.site.bridgedId=t(n)}var f=d(),b=null,g=/* @__PURE__ */new Set;function k(){return b??f}function h(e){e.claimsPage&&(g.delete(e),b=e)}function m(e){e.claimsPage&&(g.add(e),queueMicrotask(()=>{g.delete(e)&&b===e&&(b=null)}))}function w(){return k().usesBridgedToken}function y(){f=d()}export{e as EFFICIENT_BACKEND,h as activateEaselSession,u as backendOf,d as createEaselSession,k as currentEaselSession,m as deactivateEaselSession,w as efficientClientOpen,n as isEfficientBackend,l as provideDefaultBackend,y as resetAmbientEaselSession,s as sessionRegistry,a as setSessionBridgedSite,c as setSessionDocumentSite};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{textFieldIdentifier as n}from"./chunk-ANPOR6EY.js";import{hidableText as r}from"./chunk-6UAEFOJ4.js";function t(n,t){const o=r(n.props.name);if(o)return o;const e=r(n.props.altName);if(e)return e;const c=n.props.collection?.name;if(c)return c;const u=n.props.source?.title;if(u)return u;const s=n.props.code;return s?t?.(s)??s:""}function o(n,r,o,e,c){const u=o(t(n,e))||r(n.type);return c?c(n,"block",u):u}function e(r){if(!r)return null;for(const t of["name","altName"])if(n(r[t]))return t;return null}function c(r){const t=r?.name;return void 0===t||n(t)?"name":null}function u(n,t,o){const e=r(n.props?.name).trim()||t;return o?o(n,"section",e):e}export{u as rootRowName,c as sectionRenameProp,t as slotChildName,e as slotChildRenameProp,o as slotChildRowName};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{panelFieldsOf as t}from"./chunk-
|
|
1
|
+
import{panelFieldsOf as t}from"./chunk-5XL2RXFU.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-KWLHKKZO.js";import{DESIGN_GROUP_KEY as e,BUCKET_KEY as r}from"./chunk-3QB2ZQXK.js";import{STYLE_KIND as s,fieldKind as c,copyStyle as i,heldStyle as p,planPaste as u,pasteMessage as a}from"./chunk-V7U33NF2.js";import{ANCHOR_FIELD_KEYS as f,foldMetaOf as l,MEDIA_FIELD_MARKER as m,TEXT_FIELD_MARKER as h,LINK_FIELD_MARKER as y}from"./chunk-ANPOR6EY.js";var j=/* @__PURE__ */new Set([e.Size,e.Design,e.Layout,e.Position]),w=new Set(Object.values(e)),b=new Set(Object.values(r)),S=new Set(f),g=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[m,h,y];function v(t){return`site:${t??""}`}function O(t){if(!t||"object"!=typeof t)return null;const n=t,e=o(t)??t,r=n[s]??e[s];if("string"==typeof r)return r;const i=n.options??e.options;if(Array.isArray(i)){return`choice:${i.map(t=>String(t?.value)).sort().join("|")}`}return c(e)}function K(t){const n=t,e=o(t);return k.some(t=>t in n||e&&t in e)}function L(o,e){const s=t(o,e)??{},c=[];let i=!0,p=!1;for(const[t,o]of Object.entries(s))b.has(t)?(i=t===r.Design,p=!1):w.has(t)?i&&(p=j.has(t)):p&&o&&"object"==typeof o&&!t.startsWith("_")&&(l(o)||S.has(t)||g.has(t)||K(o)||"slot"!==o.type&&c.push({path:[t],kind:O(o),counted:"mobile"!==n(o)?.tier}));return c}function d(t,o,n,e,r){i({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function A(t,o,n,e,r,s){const c=p(n);if(!c)return null;const i=u(c,{type:e.type,rows:t(o,e),props:e.props});return{...i,message:a(i,c.sourceLabel,r,s)}}function F(t,o,n,e){d(L,t,o,n,e)}function X(t,o,n,e,r){return A(L,t,o,n,e,r)}var D={scope:t=>v(t.siteId),rows:(t,o)=>L(t,o),copy:(t,o,n,e)=>F(e,t,o,n),plan:(t,o,n,e)=>X(e,t,o,n)};function N(t,o){if(!t&&!o)return D;const n=t?.rows,e=n?(t,o)=>n(t,o):L;return{scope:t?.scope??D.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>d(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>A(e,s,t,n,r,o))}}export{F as copyNodeStyle,L as nodeStyleRows,X as planNodePaste,O as shopFieldKind,v as siteStyleScope,N as styleClipboardOf};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{runAsPreviewClick as e}from"./chunk-
|
|
1
|
+
import{runAsPreviewClick as e}from"./chunk-MGVI67QV.js";import{useRef as r,useCallback as t,createContext as n,useState as c,useContext as l}from"react";import{jsx as o}from"react/jsx-runtime";function s(){const n=r(()=>{});return{select:t((...r)=>e(()=>n.current(...r)),[]),setSelectHandler:t(e=>{n.current=e},[])}}function u(e){const r=`set${e.charAt(0).toUpperCase()}${e.slice(1)}`,t=(t,n,c,l)=>({[e]:t,[r]:n,select:c,setSelectHandler:l}),u=n(t(null,()=>{},()=>{},()=>{}));return{Provider:function({children:e}){const[r,n]=c(null),{select:l,setSelectHandler:i}=s();/* @__PURE__ */
|
|
2
2
|
return o(u.Provider,{value:t(r,n,l,i),children:e})},useSelection:()=>l(u)}}export{u as createPreviewSelectionContext,s as useSelectHandler};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{useResolvedFields as t}from"./chunk-IWCKVZHS.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPickPart as l,clickPick as s}from"./chunk-BSHIQIZC.js";import{selectionBox as a,placeWindow as c,offsetOrigin as d,colorRunOf as u,ColorWindow as p,startCanvasTyping as f,textMap as h}from"./chunk-MZ5GSSZ3.js";import{DEFAULT_COPY_WORDS as m}from"./chunk-KRL3IUV3.js";import{useWords as g}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as v,CANVAS_TYPABLE_EVENT as y,isTypingTarget as w,frameRectToHost as b,CANVAS_TYPING_EVENT as k,drawnBox as S}from"./chunk-4FD7TAOE.js";import{queryAllCopies as C}from"./chunk-LF3FUSCQ.js";import{find as I,ROOT_ID as D,getList as E,remove as x,parseZoneKey as A,move as O,duplicate as M,replaceNode as z,createNode as R,insert as $,normalizeData as B,createResolveCache as L,resolveNodeData as V,ROOT_SLOT as j}from"./chunk-K7BTCBWD.js";import{topLevelSlotKeys as N,fieldsFrom as P,drawnBlockCount as Z,defaultsFrom as K}from"./chunk-L55YIXDC.js";import{createContext as F,useEffect as T,useContext as H,useRef as W,useSyncExternalStore as Y,useState as q,useMemo as U,useCallback as G,useLayoutEffect as Q}from"react";import{jsx as X,jsxs as J,Fragment as _}from"react/jsx-runtime";import{createPortal as ee}from"react-dom";import{registerModalEscapeInterceptor as te,FloatingBar as ne,TextToolbar as oe,LinkPicker as re}from"efficient-shell/ui";function ie(e){return!["setData","setUi","set"].includes(e.type)}var le=(e,t,n,o)=>{const r=E(e,t,A(n));return r?.[o]??null},se=(e,t,n,o,r)=>{const i=le(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function ae(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function ce(e,t,n){return n?"node"===n.kind?I(e,t,n.id)?n:null:n.parentId===D?E(e,t,n)?n:null:I(e,t,n.parentId)&&E(e,t,n)?n:null:null}function de(e,t,n,r=!1){const{itemSelector:i,selectedSlot:l,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=o(e.data,t,i??null)),"selectedSlot"in n&&(l?a=(c=l)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function ue(e,t,n){const o=pe(e,t,n);if(o===e)return e;const r=ce(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function pe(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return de(e,n,"function"==typeof t.ui?t.ui(ae(e,n)):t.ui);case"set":{const r={data:o,ui:ae(e,n)},i="function"==typeof t.state?t.state(r):t.state;let l=i.data?{...e,data:i.data}:e;return i.ui&&(l=de(l,n,i.ui,!0)),l}case"insert":{const r={...A(t.destinationZone),index:t.destinationIndex},i=R(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:$(o,n,r,i)}}case"replace":{const r=se(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:z(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=se(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=M(o,n,r.props.id),l=le(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return pe(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=le(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...A(t.destinationZone),index:t.destinationIndex};return{...e,data:O(o,n,r.props.id,i)}}case"remove":{const r=se(o,n,t.zone,t.index,"remove");return{...e,data:x(o,n,r.props.id)}}default:return e}}var fe={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},he={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},me=0,ge=()=>`history-${me+=1}`;function ve(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let l=e.permissions??{};const s=B(e.data,t);let a=s,c={data:s,selection:null,ui:{...he}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;c={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...he,...i}}}let d=[{core:c,at:-1/0,sealed:!0,id:ge()}],u=0;const p=e=>{const t=d[u],n=r();!e&&u===d.length-1&&u>0&&!t.sealed&&n-t.at<i?d=[...d.slice(0,u),{...t,core:c,at:n}]:(d=[...d.slice(0,u+1),{core:c,at:n,sealed:e,id:ge()}],u=d.length-1)},f=/* @__PURE__ */new Set;let h=null,m=null,g=0,v=null,y=!1;const w=()=>{for(const e of[...f])e()},b=()=>{d=[...d.slice(0,u),{...d[u],core:c},...d.slice(u+1)]},k=(t,n)=>{g>0?y=y||n:(n?p(!1):c!==t&&b(),c.data!==t.data&&e.onChange?.(c.data),c!==t&&w())},S=e=>{const n=c;if(c=ue(c,e,t),c===n)return;const o=e.recordHistory??ie(e);k(n,o&&c.data!==n.data)},C=t=>{0===g&&(v=c,y=!1),g+=1;try{t()}catch(e){throw g-=1,0===g&&v&&(c=v,v=null),e}if(g-=1,g>0||!v)return;const n=v;v=null,y&&c.data!==n.data?p(!0):c!==n&&b(),c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},D=e=>{const n=c,o=ce(c.data,t,e);var r,i;(r=o,i=c.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(c={...c,selection:o},k(n,!1))},x=t=>{const n=c;u=t,c=d[u].core,c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},A=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...fe,...l,...n}};let O=A();const M=L(),R={resolveCache:M,async resolveAll({trigger:e="load",metadata:n}={}){const o=c.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[l,...s]=await Promise.all([V(r,t,{cache:M,trigger:e,metadata:n}),...i.map(o=>V(o,t,{cache:M,trigger:e,metadata:n}))]);C(()=>{const n=c;let r=c.data;s.forEach((e,n)=>{if(!e.didChange)return;const l=i[n].props.id,s=I(r,t,l)?.node;s&&s===I(o,t,l)?.node&&(r=z(r,t,l,e.node))}),l.didChange&&r.root===o.root&&(r={...r,root:{...r.root,props:l.node.props,readOnly:l.node.readOnly??r.root.readOnly}}),r!==c.data&&("load"===e&&c.data===a&&(a=r),c={...c,data:r,selection:ce(r,t,c.selection)},k(n,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=I(c.data,t,e)?.node;if(!r)return!1;const i=await V(r,t,{cache:M,trigger:n,metadata:o});if(!i.didChange)return!1;let l=!1;return C(()=>{const n=c;if(I(c.data,t,e)?.node!==r)return;const o=z(c.data,t,e,i.node);o!==c.data&&(c={...c,data:o,selection:ce(o,t,c.selection)},k(n,!1),l=!0)}),l},get config(){return t},get loaded(){return a},getState(){if(h&&m===c)return h;const e=c,o={data:e.data,ui:ae(e,t)},r="node"===e.selection?.kind?I(e.data,t,e.selection.id)?.node??null:null;return h={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:S,history:{back:()=>R.undo(),forward:()=>R.redo(),hasPast:u>0,hasFuture:u<d.length-1,histories:d.map(e=>({id:e.id,state:{data:e.core.data,ui:ae(e.core,t)}})),index:u,setHistoryIndex:e=>{e>=0&&e<d.length&&e!==u&&x(e)}},getPermissions:O,getItemById:n=>I(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return E(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},m=e,h},subscribe:e=>(f.add(e),()=>{f.delete(e)}),dispatch:S,batch:C,group:()=>{const e=u,t=d[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,d[e]?.id!==t)return;if(u<=e+1)return void(u===e+1&&(d=[...d.slice(0,u),{...d[u],sealed:!0},...d.slice(u+1)]));const o=d[u];d=[...d.slice(0,e+1),{...o,sealed:!0},...d.slice(u+1)],u=e+1}}},select:e=>D(e?{kind:"node",id:e}:null),selectSlot:e=>D(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){C(()=>{const n=c,o=void 0===e.select?c.selection:e.select;c={...c,data:e.data,selection:ce(e.data,t,o)},k(n,e.data!==n.data)})},load(e,n={}){const o=c,r=B(e,t);c={...c,data:r,selection:ce(r,t,n.selection??c.selection)},a=r,n.keepHistory||(d=[{core:c,at:-1/0,sealed:!0,id:ge()}],u=0),c!==o&&w()},undo(){u>0&&x(u-1)},redo(){u<d.length-1&&x(u+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,l)||(l=e,O=A(),h=null,w())},setConfig(e){e!==t&&(t=e,O=A(),h=null,w())}};return R}function ye(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&w(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var we=F(null),be=F(!0);function ke({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return T(()=>{n&&e.resolveAll()},[e,n]),T(()=>{if(t&&"undefined"!=typeof document)return ye(document,e)},[e,t]),/* @__PURE__ */X(we.Provider,{value:e,children:/* @__PURE__ */X(be.Provider,{value:t,children:o})})}function Se(){const e=H(we);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function Ce(e){const t=Se(),n=W({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return Y(t.subscribe,o,o)}function Ie(){return function(e){return Ce(e)}}var De="data-easel-block",Ee="data-easel-dropzone",xe="data-puck-component",Ae="data-puck-dropzone",Oe={},Me="data-es-mirror",ze="undefined"==typeof window?T:Q;function Re(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Me}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Me,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function $e({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:l=!0,onDocument:s,height:a="auto",nonce:c}){const d=g("canvas",e),u=W(null),[p,f]=q(null);return ze(()=>{const e=u.current,t=p?.ownerDocument.defaultView;if("auto"!==a||!e||!p||!t)return;const n=()=>{e.style.height=`${Math.ceil(p.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(p),()=>r?.disconnect()},[p,a]),ze(()=>{let e=u.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=u.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-easel-entry",""),t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),v(e,c),f(t),s?.(e);let n=null;const o=u.current?.ownerDocument;if(l&&o){Re(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>Re(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */X("iframe",{ref:u,id:n,title:o??d.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:p?ee(t,p):null})}var Be=F(null),Le=F(Oe),Ve=[];function je({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=Se(),s=Ce(n=>E(n.appState.data,l.config,{parentId:e,slot:t})??Ve),a=Ce(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==D),c=Ce(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=H(Be),u=["es-zone"];return s.length&&u.push("has-children"),e===D&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==D&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */X("div",{className:u.join(" "),[Ee]:`${e}:${t}`,[Ae]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */X(We,{node:e},e.props.id))})}function Ne(e,t,n,o){const r=U(()=>{const n={};for(const o of N(P(e)))n[o]=Object.assign(function(e={}){/* @__PURE__ */
|
|
2
|
+
return X(je,{parentId:t,slot:o,...e})},{blockCount:0});return n},[e,t]);for(const e of Object.keys(r))r[e].blockCount=Z(n[e],o);return r}function Pe(e){return U(()=>function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
+
return X(je,{parentId:e,slot:t,...n})},[e])}var Ze=["top","bottom","zIndex"];function Ke(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function Fe(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));Ke(e,"position",t?"sticky":"relative");for(const n of Ze)Ke(e,n,t?.[n]??"");return!!t}var Te="data-es-canvas-relative";function He(e){e.hasAttribute(Te)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(Te));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(Te,"")),!1)}function We({node:e}){const t=Se().config,n=t.components[e.type],o=e.props.id,r=W(null),i=function(e,t){return U(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(De),o.removeAttribute(xe),o.removeAttribute("data-easel-dnd"),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(De,e),n.setAttribute(xe,e),n.setAttribute("data-easel-dnd",e),n.setAttribute("data-puck-dnd",e),He(n))},[e,t])}(o,r),l=W(null),s=!!n?.inline;!function(e,t){const n=W(!1),o=W(()=>{});o.current=()=>{const o=e(),i=n.current;n.current=!!o&&t(o),i!==n.current&&r.current()};const r=W(()=>{});ze(()=>o.current()),ze(()=>{const t=e(),i=t?.ownerDocument.defaultView;if(!t||!i)return;const l=()=>o.current();i.addEventListener("resize",l);const s=i.ResizeObserver,a=s?new s(l):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&i.MutationObserver&&(c=new i.MutationObserver(l),c.observe(e,{attributes:!0}))},r.current(),()=>{i.removeEventListener("resize",l),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>s?r.current:l.current,e=>s?He(e):Fe(e));const a=H(Le),c=Ne(n,o,e.props,t.components),d=Pe(o);if(!n?.render)return null;const u=n.render,p={...K(n),...e.props,...c},f={renderDropZone:d,isEditing:!0,dragRef:n.inline?i:null,metadata:{...a,...n.metadata}};return n.inline?/* @__PURE__ */X(u,{...p,editor:f,puck:f,editMode:!0}):
|
|
4
|
+
/* @__PURE__ */X("div",{ref:l,[De]:o,[xe]:o,"data-easel-dnd":o,"data-puck-dnd":o,style:{position:"relative"},children:/* @__PURE__ */X(u,{...p,editor:f,puck:f,editMode:!0})})}function Ye({metadata:e}){const t=Ce(e=>e.config),n=Ce(e=>e.appState.data.root).props??{},o=t.root?.render,r=Ne(t.root,D,n,t.components),i=Pe(D),l=/* @__PURE__ */X(je,{parentId:D,slot:j}),s=o?/* @__PURE__ */X(o,{id:"puck-root",...n,...r,puck:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:l}):l;/* @__PURE__ */
|
|
5
|
+
return X(Le.Provider,{value:e??Oe,children:s})}var qe=F(void 0),Ue=F(void 0),Ge=F(void 0);function Qe({element:e}){const t=W(null),n=Xe(t,e?()=>e:null,e);/* @__PURE__ */
|
|
6
|
+
return X("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-hover is-hover-part",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function Xe(e,t,n){return _e(e,t?e=>{const n=t(e);return n?[n]:[]}:null,n)[0]??null}var Je=[];function _e(e,t,n){const[o,r]=q(Je),i=W(t);return i.current=t,ze(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(Je);let o=0;const l=()=>{o=0;const n=e.current?.parentElement??null,l=(i.current?i.current(t):[]).map(e=>function(e,t){if(!e||!t)return null;const n=S(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(e,n)).filter(e=>null!==e);r(e=>{return(t=e)===(n=l)||t.length===n.length&&t.every((e,t)=>function(e,t){return e===t||!!e&&!!t&&e.top===t.top&&e.left===t.left&&e.width===t.width&&e.height===t.height}(e,n[t]))?e:l.length?l:Je;var t,n})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(l))};l();const a="MutationObserver"in n?new n.MutationObserver(s):null;a?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function et({id:e,kind:t,overlay:n}){const o=W(null),r=H(Ue),i=null!==e&&!0===r?.(e),l=_e(o,e?t=>C(t,`[${De}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),[s,...a]=l,c=`es-canvas-outline is-${t}${i?" is-shared":""}`,d=e=>({position:"absolute",top:e.top,left:e.left,width:e.width,height:e.height}),u=/* @__PURE__ */J(_,{children:[
|
|
7
|
+
/* @__PURE__ */X("div",{ref:o,"aria-hidden":"true",className:c,style:s?d(s):{display:"none"}}),a.map((e,t)=>/* @__PURE__ */X("div",{"aria-hidden":"true",className:c,style:d(e)},t))]});return n&&e?/* @__PURE__ */X(n,{componentId:e,kind:t,children:u}):u}function tt(e,t,n){const o=h(e,n),r=o.text.length,i=e.ownerDocument;if(!t)return[r,r];let l=null;const s=i.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))l=o.at(s.offsetNode,s.offset);else{const n=i.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(l=o.at(n.startContainer,n.startOffset))}if(null===l)return[r,r];const a=o.text;let c=l,d=l;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;d<a.length&&!/\s/.test(a[d]);)d+=1;return[c,d]}function nt({s:e,element:t,toolbar:n,label:o,keys:r}){const i=g("copy",m),l=e.pressed(),s=new Set(n.offered),f=n.colors&&n.colors.length>0?n.colors:null,h=W(null),[v,y]=q(!1),[w,k]=q(null),S=v||null!==w,C=()=>{e.hold(),y(!1),k({href:e.pressed().href})},I=()=>{y(!1),k(null),e.resume()};Q(()=>{r.current={escape:()=>!!S&&(I(),!0),link:()=>!!s.has("link")&&(C(),!0)}}),Q(()=>()=>{r.current=null},[r]);const D=W(I);D.current=I,T(()=>{if(v)return te(e=>{const t=h.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(D.current(),!0)},()=>h.current?.querySelector(".es-copy-colors"))},[v]),T(()=>{const n=h.current;if(!S||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const i=o=>{const r=o.target;if(r&&n.contains(r))return;y(!1),k(null);const i=t();r&&i&&i.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",i,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",i,!0)}},[S,e,t]),Q(()=>{const e=h.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(S&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,i=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,l=(i?a(i,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),s=o.ownerDocument.defaultView?.frameElement,u=s?b(s,{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top}):{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top},p=o.getBoundingClientRect(),f=s?b(s,{left:p.left,top:p.top,width:p.width,height:p.height}):{left:p.left,top:p.top,width:p.width,height:p.height},m=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),g={left:u.left,right:u.left+u.width,top:Math.min(u.top,f.top-6,m.top),bottom:Math.max(u.top+u.height,f.top+f.height+6,m.bottom)},v=e.ownerDocument.documentElement,y=(s??o.closest(".es-canvas")??o).getBoundingClientRect(),w={left:Math.max(0,y.left),top:Math.max(0,y.top),right:Math.min(v.clientWidth||y.right,y.right),bottom:Math.min(v.clientHeight||y.bottom,y.bottom)};if(w.right<=w.left||w.bottom<=w.top||0===n.offsetWidth)return;const k=c({anchor:g,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:y.left,top:y.top,right:y.right,bottom:y.bottom},clip:w,parent:d(n)});n.style.top=`${k.top}px`,n.style.left=`${k.left}px`,n.style.setProperty("--es-pop-point",`${k.point}px`),n.dataset.side=k.above?"above":"below"});const E=f?{run:u(l.color,f),open:v,onToggle:()=>{k(null),v?I():(e.hold(),y(!0))}}:void 0;/* @__PURE__ */
|
|
8
|
+
return X(ne,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?b(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */X("div",{ref:h,children:/* @__PURE__ */X(oe,{layout:"row",offered:s,pressed:l.marks,onMark:t=>{"link"===t?C():e.press(t)},color:E,linkOpen:null!==w,list:{pressed:l.list,onList:t=>e.list(t)},alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:l.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */J(_,{children:[v&&f?/* @__PURE__ */X(p,{colors:f,current:l.color,words:i.colors??m.colors,onPick:t=>e.color(t)}):null,w?
|
|
9
|
+
/* @__PURE__ */X(re,{className:"es-copy-link es-copy-pop",value:w.href??"",onApply:t=>{k(null),e.link(t)},onRemove:null!==w.href?()=>{k(null),e.link(null)}:void 0,onCancel:I}):null]})})})})}function ot({element:e}){const t=W(null),n=Xe(t,()=>e(),e);/* @__PURE__ */
|
|
10
|
+
return X("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function rt({frame:t=!0,className:n,style:o,metadata:r,mirrorStyles:a,onDocument:c,height:d,title:u,nonce:p,hotkeys:h,frameWrapper:m,overlay:v,children:w,typing:b,passThrough:S}){const C=Se(),I=H(qe),D=S??I,E=H(be),x=g("canvas",e),A=h??E,[O,M]=q(void 0),z=Ce(e=>"node"===e.selection?.kind?e.selection.id:null),[R,$]=q(null),[B,L]=q(null),V=H(Ge),[j,N]=q(null),P=W(null),[,Z]=q(0),K=W(b);K.current=b;const F=W(null),Y=W(null),U=Ce(e=>e.appState.data);T(()=>{const e=Y.current?.ownerDocument,t=e?.defaultView?.CustomEvent;if(!e||!t)return;const n=z&&!j&&K.current?.atSelection?.()?z:null;e.dispatchEvent(new t(y,{detail:{id:n}}))},[z,j,U]);const G=e=>{const t=Y.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(k,{detail:{typing:e}}))},Q=(e,t)=>{P.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=C.group(),r=e.element,i=f({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:tt(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>Z(e=>e+1),onEscape:()=>F.current?.escape()??!1,onLinkKey:()=>F.current?.link()??!1,end:e=>{o.close(),P.current?.element===r&&(P.current=null),N(null),G(!1),K.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const l=n.closest?.(`[${De}]`)?.getAttribute(De);return l&&C.select(l),P.current={s:i,element:r,target:e},N(()=>r),$(null),G(!0),K.current?.onChange?.({typing:!0,element:n}),!0};T(()=>()=>P.current?.s.stop("stop"),[]);const _=e=>{const t=P.current?.element();return Boolean(t&&t.contains(e))},ee=e=>{const t=e.closest?.(`[${De}]`)?.getAttribute(De);if(!t)return;const n=C.getState(),o="node"===n.selection?.kind?n.selection.id:null,r=V?.partAt(e,t)??null;if(r){const e=l(n.appState.data,C.config,t,r.id,o,V?.selected()??null,D);if(e)return{node:e.node,part:e.part?r:null}}return{node:s(n.appState.data,C.config,t,o,D)??t,part:null}},te=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(P.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=K.current?.atSelection?.();n&&Q(n,null)&&e.preventDefault()},ne=/* @__PURE__ */J("div",{ref:Y,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),P.current){if(_(t))return;P.current.s.stop("outside")}const n=t.ownerDocument?.getSelection?.();n&&n.rangeCount>0&&n.isCollapsed&&n.removeAllRanges();const o=ee(t);if(void 0!==o)return C.select(o.node),void(V&&(o.part?.id??null)!==V.selected()&&V.select(o.part?.id??null));t.hasAttribute?.(Ee)||(C.select(null),V?.selected()&&V.select(null))},onDoubleClick:e=>{const t=K.current;if(!t||_(e.target))return;const n=t.at(e.target);n&&Q(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>te(e),onMouseOver:e=>{if(P.current)return;const t=ee(e.target),n=t?.part&&t.part.id!==V?.selected()?t.part.element:null,o=t&&!t.part?t.node:null;o!==R&&$(o),n!==B&&L(n)},onMouseLeave:()=>{$(null),L(null)},children:[
|
|
11
|
+
/* @__PURE__ */X(Be.Provider,{value:R,children:/* @__PURE__ */X(Ye,{metadata:r})}),
|
|
12
|
+
/* @__PURE__ */J("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
13
|
+
/* @__PURE__ */X(et,{id:!j&&R&&R!==z?R:null,kind:"hover",overlay:v}),V?/* @__PURE__ */X(Qe,{element:j?null:B}):null,
|
|
14
|
+
/* @__PURE__ */X(et,{id:j?null:z,kind:"selected",overlay:v}),j?/* @__PURE__ */X(ot,{element:j}):null]}),w]}),oe=m?/* @__PURE__ */X(m,{document:O,children:ne}):ne;T(()=>{if(O&&A)return ye(O,C)},[O,A,C]),T(()=>{if(!O)return;const e=e=>{if("Enter"===e.key)return void te(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=C.getState();if("node"!==n.selection?.kind)return;if(V?.selected())return void V.select(null);const o=i(n.appState.data,C.config,n.selection);"node"===o?.kind&&C.select(o.id)};return O.addEventListener("keydown",e),()=>O.removeEventListener("keydown",e)},[O,C,V]);/* @__PURE__ */
|
|
15
|
+
return J("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-easel-preview":"","data-puck-preview":"","data-es-typing":j?"":void 0,children:[j&&P.current?.target.toolbar?/* @__PURE__ */X(nt,{s:P.current.s,element:P.current.element,toolbar:P.current.target.toolbar,label:x.textTools,keys:F}):null,t?/* @__PURE__ */X($e,{mirrorStyles:a,onDocument:e=>{M(e??void 0),c?.(e)},height:d,title:u,nonce:p,children:oe}):/* @__PURE__ */X("div",{id:"preview-frame","data-easel-entry":"","data-puck-entry":"",children:oe})]})}function it(e={}){const t=Se(),n=Ce(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function lt(){const e=Se(),n=Ce(e=>e.config),o=e.resolveCache,r=Ce(e=>e.selectedItem),i=Ce(e=>e.appState.data.root),l=r?r.props.id:"root",s=i.props??{},a=U(()=>r||{type:"root",props:s},[r,s]),c=r?n.components[r.type]:n.root,d=e.getState(),u=r?I(d.appState.data,n,l):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,f=p?d.getItemById(p)??null:null,{fields:h}=t({id:l,node:a,block:c,parent:f,appState:d.appState}),m=Ce(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),g=G(t=>{(async()=>{const r=e.getState();if("root"!==l){const i=r.getItemById(l),s=r.getSelectorForId(l);if(!i||!s)return;const a={...i,props:{...i.props,...t}},{node:c}=await V(a,n,{cache:o,trigger:"replace"}),d=e.getState().getSelectorForId(l);if(!d)return;return void e.dispatch({type:"replace",destinationZone:d.zone??"root:default-zone",destinationIndex:d.index,data:c})}const i=r.appState.data.root.props??{},{node:s}=await V({type:"root",props:{...i,...t}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[e,n,o,l]),v=G((e,t)=>g({[e]:t}),[g]);return{id:l,node:a,fields:h,values:a.props,readOnly:m,onChange:v,onChangeMany:g}}export{$e as CanvasFrame,Ge as CanvasPartsContext,qe as CanvasPassThroughContext,Ue as CanvasSharedContext,he as DEFAULT_UI,rt as EaselCanvas,ke as EaselProvider,Ye as EditDocument,ye as bindUndoKeys,ve as createEasel,Ie as createUseEasel,ie as recordsByDefault,ue as reduce,ae as uiView,Ce as useEasel,Se as useEaselApi,it as useEaselNodeOps,lt as useSelectedFields,ce as validSelection};
|