efficient-easel 0.103.0 → 0.105.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 +92 -7
- package/dist/CanvasDragLayer-zgYT1xwY.d.ts +168 -0
- package/dist/chrome/index.js +1 -1
- package/dist/chunk-3P6AMTOS.js +1 -0
- package/dist/chunk-4XQUWGIV.js +65 -0
- package/dist/{chunk-6UJ3Y6FC.js → chunk-53G47SWO.js} +1 -1
- package/dist/{chunk-IWAPPEL4.js → chunk-5ZBBXZPV.js} +1 -1
- package/dist/chunk-7FBDZTUD.js +2 -0
- package/dist/chunk-7V5WZ46F.js +2 -0
- package/dist/chunk-BVN33R76.js +1 -0
- package/dist/chunk-CLOS6SSX.js +1 -0
- package/dist/chunk-ERR437B5.js +1 -0
- package/dist/chunk-GMCZXMOV.js +1 -0
- package/dist/{chunk-OYX47SL7.js → chunk-HNKB2ZYR.js} +1 -1
- package/dist/{chunk-AKFJK65Z.js → chunk-IE4GFYKO.js} +1 -1
- package/dist/{chunk-KDYIMJTZ.js → chunk-KCOBHPN6.js} +1 -1
- package/dist/chunk-KG7RJWOK.js +1 -0
- package/dist/chunk-N7VRF7PR.js +5 -0
- package/dist/chunk-NYKIQJT2.js +4 -0
- package/dist/{chunk-6TZTKAB5.js → chunk-O7Q4DDJT.js} +1 -1
- package/dist/chunk-PA3PNTVV.js +1 -0
- package/dist/chunk-PLVEGYK6.js +1 -0
- package/dist/chunk-PQXIFBDY.js +1 -0
- package/dist/{chunk-66ICOE3I.js → chunk-QH6LCNOX.js} +1 -1
- package/dist/chunk-R6WTQWAC.js +2 -0
- package/dist/{chunk-Z3KBLIEH.js → chunk-RQHC4TD6.js} +3 -3
- package/dist/chunk-RSCMJIWS.js +1 -0
- package/dist/{chunk-7MU3RJ6S.js → chunk-S4AWJX4Q.js} +1 -1
- package/dist/{chunk-MSBF7IW3.js → chunk-SARZN4M7.js} +2 -2
- package/dist/chunk-SQTY6CJD.js +1 -0
- package/dist/chunk-TBF5CVPA.js +1 -0
- package/dist/chunk-THWO5YVZ.js +1 -0
- package/dist/chunk-TLZG2FCF.js +1 -0
- package/dist/chunk-U3JP4VGF.js +2 -0
- package/dist/{chunk-LG436UTD.js → chunk-V4LF7D4F.js} +1 -1
- package/dist/chunk-VSHV6KJQ.js +5 -0
- package/dist/{chunk-OM67AJQC.js → chunk-VSOP4GUM.js} +1 -1
- package/dist/{chunk-6DJHRLCU.js → chunk-YC4TB3CJ.js} +9 -9
- package/dist/{chunk-GXN65JMA.js → chunk-YN4KND5F.js} +1 -1
- package/dist/chunk-ZTTWFAAC.js +1 -0
- package/dist/drag/index.d.ts +4 -164
- package/dist/edit-lock/index.d.ts +55 -1
- package/dist/edit-lock/index.js +1 -1
- package/dist/{host-DJ8Gzsx7.d.ts → host-BQ_b9Qzk.d.ts} +27 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.d.ts +3 -2
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +208 -5
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +2 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +14 -3
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +20 -5
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +20 -5
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +17 -6
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +2 -0
- package/dist/screen/lib/admin-bridge.js +1 -1
- package/dist/screen/lib/backend-error.d.ts +20 -5
- package/dist/screen/lib/backend-error.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +2 -1
- package/dist/screen/lib/document-switch.js +1 -1
- package/dist/screen/lib/failure.d.ts +6 -2
- package/dist/screen/lib/failure.js +1 -1
- package/dist/screen/lib/host-inbound.js +1 -1
- package/dist/screen/lib/host.d.ts +3 -2
- package/dist/screen/lib/host.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/load-error.d.ts +9 -3
- package/dist/screen/lib/load-error.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +81 -17
- package/dist/screen/lib/media-panel.js +1 -1
- package/dist/screen/lib/media-picker.d.ts +14 -2
- package/dist/screen/lib/media-picker.js +1 -1
- package/dist/screen/lib/page-lock.d.ts +45 -1
- package/dist/screen/lib/page-lock.js +1 -1
- package/dist/screen/lib/puck/content-tree.d.ts +27 -1
- package/dist/screen/lib/puck/content-tree.js +1 -1
- package/dist/screen/lib/puck/palette-sections.d.ts +7 -0
- package/dist/screen/lib/puck/palette-sections.js +1 -1
- package/dist/screen/lib/puck/section-doc.js +1 -1
- package/dist/screen/lib/puck/slot-child-name.d.ts +42 -3
- package/dist/screen/lib/puck/slot-child-name.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +53 -1
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.d.ts +6 -0
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +619 -10
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-templates.d.ts +25 -1
- package/dist/screen/lib/section-templates.js +1 -1
- package/dist/screen/lib/session-context.d.ts +5 -1
- package/dist/screen/lib/session-context.js +1 -1
- package/dist/screen/lib/session.d.ts +58 -5
- package/dist/screen/lib/session.js +1 -1
- package/dist/screen/screen.css +18 -0
- package/dist/screen/words.d.ts +96 -2
- package/dist/screen/words.js +1 -1
- package/dist/strings/catalogue.d.ts +4 -2
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/tree/index.d.ts +4 -142
- package/dist/types-DJDBtdB2.d.ts +143 -0
- package/package.json +1 -1
- package/dist/chunk-3M3A3DN2.js +0 -4
- package/dist/chunk-4MXFKJUY.js +0 -1
- package/dist/chunk-6FY3PZS3.js +0 -1
- package/dist/chunk-A7ZJII7O.js +0 -1
- package/dist/chunk-AJBJ74ME.js +0 -1
- package/dist/chunk-AKZWUV5Z.js +0 -1
- package/dist/chunk-F6CCTEIX.js +0 -1
- package/dist/chunk-FUDHI5I4.js +0 -1
- package/dist/chunk-GENAF3P6.js +0 -1
- package/dist/chunk-HDKTR5TZ.js +0 -62
- package/dist/chunk-HMX55DYT.js +0 -1
- package/dist/chunk-HWW4XJOH.js +0 -1
- package/dist/chunk-JUQ6YJCG.js +0 -1
- package/dist/chunk-NBJ2YY6Y.js +0 -4
- package/dist/chunk-OORDMLL4.js +0 -5
- package/dist/chunk-Q2HPBMG5.js +0 -1
- package/dist/chunk-Q3SQBNJB.js +0 -1
- package/dist/chunk-R5ZVNJLJ.js +0 -2
- package/dist/chunk-SERF2FAU.js +0 -1
- package/dist/chunk-VV5ADNBR.js +0 -1
- package/dist/chunk-YJXEHK6I.js +0 -2
- package/dist/chunk-ZWK3CBRU.js +0 -1
- package/dist/chunk-ZZ7VLIHQ.js +0 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes, ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { T as TreeWords } from './words-DgHcY5qB.js';
|
|
3
|
+
|
|
4
|
+
type LayersTreeProps = {
|
|
5
|
+
/** Extra classes — a host's scroll-bar class, for instance. */
|
|
6
|
+
className?: string;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/** Attributes for the tree's root — `efficient-easel/drag`'s `rootProps()`. */
|
|
9
|
+
rootProps?: HTMLAttributes<HTMLDivElement>;
|
|
10
|
+
};
|
|
11
|
+
type TreeGroupLabelProps = {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
type SubtreeProps = {
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
type TreeRowFold = {
|
|
18
|
+
/** Whether the row's subtree is showing. */
|
|
19
|
+
open: boolean;
|
|
20
|
+
/** What folds, in lower case — "section", "column". The caret reads "Collapse section". */
|
|
21
|
+
label: string;
|
|
22
|
+
onToggle: () => void;
|
|
23
|
+
};
|
|
24
|
+
type TreeRowProps = {
|
|
25
|
+
/** A 13px glyph for the row's type. */
|
|
26
|
+
icon: ReactNode;
|
|
27
|
+
/** The row's name — the type's label, or a name the person gave it. */
|
|
28
|
+
name: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* The thing's own first words, drawn quieter after the name — "Text BACK IN
|
|
31
|
+
* STOCK NOW". NEW in 0.42.0: a tree of fifteen rows called "Section" cannot be
|
|
32
|
+
* searched by eye. The host decides the words and shortens them.
|
|
33
|
+
*/
|
|
34
|
+
preview?: ReactNode;
|
|
35
|
+
selected?: boolean;
|
|
36
|
+
/** Hidden from the page: the name is struck through and the eye stays showing. */
|
|
37
|
+
hidden?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The row can be picked up — whole, by `efficient-easel/drag` (0.74.0). It says
|
|
40
|
+
* so four ways: a faint ⋮ at its left on hover, the grab cursor, a hint after
|
|
41
|
+
* 0.7 s ("Drag to move · ⌥↑ ⌥↓"), and the row lifted with a shadow while it
|
|
42
|
+
* moves. A draggable row draws no `handle`: the row IS the handle.
|
|
43
|
+
*/
|
|
44
|
+
draggable?: boolean;
|
|
45
|
+
/** The hint a draggable row shows after 0.7 s. Default `words.dragHint`: "Drag to move · ⌥↑ ⌥↓". */
|
|
46
|
+
dragHint?: string;
|
|
47
|
+
/** This row is being dragged. */
|
|
48
|
+
dragging?: boolean;
|
|
49
|
+
/** Where a drop would land relative to this row, while a drag is over it. */
|
|
50
|
+
drop?: 'before' | 'after' | 'into';
|
|
51
|
+
/** Present when the row folds; the row leads with its caret. Absent: the caret column is held open. */
|
|
52
|
+
fold?: TreeRowFold;
|
|
53
|
+
/**
|
|
54
|
+
* Props for the drag handle button (the host's drag-and-drop wiring). Absent:
|
|
55
|
+
* no handle. The handle is the ONLY drag source, so it is hidden with opacity
|
|
56
|
+
* and never made unreachable.
|
|
57
|
+
*
|
|
58
|
+
* @deprecated since 0.74.0 — a row driven by `efficient-easel/drag` is picked
|
|
59
|
+
* up whole (`draggable`), and a draggable row draws no handle. Kept until both
|
|
60
|
+
* editors have moved (blueprint 3.3 / 3.4).
|
|
61
|
+
*/
|
|
62
|
+
handle?: ButtonHTMLAttributes<HTMLButtonElement>;
|
|
63
|
+
/** `TreeRowAction`s — laid over the END of the name, shown on hover and focus. */
|
|
64
|
+
actions?: ReactNode;
|
|
65
|
+
/** Stands in for the name — a rename box. It must not move the row by a pixel. */
|
|
66
|
+
nameSlot?: ReactNode;
|
|
67
|
+
/**
|
|
68
|
+
* Selects the row. Present: the name box becomes a real <button> — Enter and
|
|
69
|
+
* Space select from the keyboard — and a selected row says `aria-current`.
|
|
70
|
+
* Absent: the row selects through `rowProps.onClick`, as 0.42.0 did.
|
|
71
|
+
*/
|
|
72
|
+
onSelect?: () => void;
|
|
73
|
+
/** Named state glyphs drawn right after the name — "Hidden on phones". */
|
|
74
|
+
marks?: ReadonlyArray<TreeRowMark>;
|
|
75
|
+
/** A count or position pill after the name — "1 of 2". */
|
|
76
|
+
badge?: ReactNode;
|
|
77
|
+
/** A non-interactive mark at the row's end — the Lock on a pinned section. */
|
|
78
|
+
trailing?: {
|
|
79
|
+
label: string;
|
|
80
|
+
icon: ReactNode;
|
|
81
|
+
};
|
|
82
|
+
/** Drawn inside the row after everything else: overlays such as a drop line. */
|
|
83
|
+
children?: ReactNode;
|
|
84
|
+
/** Attributes for the row itself: onClick, drag-over handlers, data-*. */
|
|
85
|
+
rowProps?: HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string | number | undefined>;
|
|
86
|
+
/**
|
|
87
|
+
* The row's own words — the drag hint and the caret's — in the host's
|
|
88
|
+
* language: `useEaselStrings().tree` (0.95.0). Left out, English. `dragHint`
|
|
89
|
+
* above still wins for its one line.
|
|
90
|
+
*/
|
|
91
|
+
words?: TreeWords;
|
|
92
|
+
};
|
|
93
|
+
type TreeRowMark = {
|
|
94
|
+
key: string;
|
|
95
|
+
/** Tooltip and accessible name — the mark is a picture of a state. */
|
|
96
|
+
label: string;
|
|
97
|
+
icon: ReactNode;
|
|
98
|
+
};
|
|
99
|
+
type TreeRowActionProps = {
|
|
100
|
+
/**
|
|
101
|
+
* `delete` is the red trash; `eye` shows or hides; `plain` is any other action
|
|
102
|
+
* (a phone toggle, "Duplicate column") in the neutral colour.
|
|
103
|
+
*/
|
|
104
|
+
kind: 'delete' | 'eye' | 'plain';
|
|
105
|
+
/** For a toggle: whether it is on. Adds aria-pressed and keeps it visible at rest. */
|
|
106
|
+
pressed?: boolean;
|
|
107
|
+
disabled?: boolean;
|
|
108
|
+
/** Tooltip and accessible name — "Delete Text", "Show Section". */
|
|
109
|
+
label: string;
|
|
110
|
+
onClick: () => void;
|
|
111
|
+
children: ReactNode;
|
|
112
|
+
};
|
|
113
|
+
type TreeEmptySlotProps = {
|
|
114
|
+
/** A drag is over the slot and may land in it: it lights up and says "Drop here". */
|
|
115
|
+
drop?: boolean;
|
|
116
|
+
/** Present: the box is a button that adds here (it opens the Add panel at this place). */
|
|
117
|
+
onAdd?: () => void;
|
|
118
|
+
/**
|
|
119
|
+
* What the box says at rest. Default `words.addBlock` ("Add a block") with
|
|
120
|
+
* `onAdd`, `words.emptySlot` ("No blocks yet") without.
|
|
121
|
+
*/
|
|
122
|
+
label?: string;
|
|
123
|
+
/**
|
|
124
|
+
* The drag handlers — `efficient-easel/drag`'s
|
|
125
|
+
* `seam({ place: { ...list, index: 0 } }).seamProps`: an empty list has one
|
|
126
|
+
* place, its start.
|
|
127
|
+
*/
|
|
128
|
+
seamProps?: HTMLAttributes<HTMLDivElement>;
|
|
129
|
+
/** The box's own words in the host's language: `useEaselStrings().tree`. Left out, English. */
|
|
130
|
+
words?: TreeWords;
|
|
131
|
+
};
|
|
132
|
+
type TreeSeamProps = {
|
|
133
|
+
/** A drag is over this gap and may land in it: draw the drop line. */
|
|
134
|
+
drop?: boolean;
|
|
135
|
+
/** Present: the gap offers a "+" that adds here (it opens the Add panel at this place). */
|
|
136
|
+
onAdd?: () => void;
|
|
137
|
+
/** The "+"'s accessible name and tooltip — "Add block here". Required with `onAdd`. */
|
|
138
|
+
label?: string;
|
|
139
|
+
/** The drag handlers — `efficient-easel/drag`'s `seam(…).seamProps`. */
|
|
140
|
+
seamProps?: HTMLAttributes<HTMLDivElement>;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export type { LayersTreeProps as L, SubtreeProps as S, TreeRowMark as T, TreeGroupLabelProps as a, TreeEmptySlotProps as b, TreeRowProps as c, TreeRowActionProps as d, TreeSeamProps as e, TreeRowFold as f };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.105.0",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
package/dist/chunk-3M3A3DN2.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{settlePanelPick as e}from"./chunk-ZZ7VLIHQ.js";import{useScreenOwnerName as n}from"./chunk-NBJ2YY6Y.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-6DJHRLCU.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=n();/* @__PURE__ */
|
|
2
|
-
return o(r,{children:[
|
|
3
|
-
/* @__PURE__ */t(i,{context:p,pick:d?{kind:c(d.accept),field:d.title||void 0}:null,onCancel:()=>d&&e(d.requestId,null),onHide:m}),
|
|
4
|
-
/* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:n=>d&&e(d.requestId,n)})})]})}export{l as MediaSidePanel};
|
package/dist/chunk-4MXFKJUY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{WebsiteBackendError as e}from"./chunk-KDYIMJTZ.js";import{backendOf as s}from"./chunk-AJBJ74ME.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},o=()=>s().sectionTemplates??t,a={list:()=>o().list(),get:e=>o().get(e),ensure:(e,s,r)=>o().ensure(e,s,r),save:(e,s)=>o().save(e,s),update:(e,s)=>o().update(e,s),rename:(e,s)=>o().rename(e,s),remove:e=>o().remove(e)};export{a as sectionTemplates};
|
package/dist/chunk-6FY3PZS3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{hasMediaPanel as e,requestPanelPick as t}from"./chunk-ZZ7VLIHQ.js";var n=/* @__PURE__ */new Map,r=0;function i(i,o){if(!i.connected)return Promise.resolve(null);const c=(r+=1,`mp-${"undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():String(r)}`);return e()?t({requestId:c,accept:o.accept,title:o.title,file:o.file??null}):new Promise(e=>{n.set(c,e),i.send("storefront-editor:open-media-picker",{requestId:c,accept:o.accept,title:o.title,...o.file?{file:o.file}:{}})})}function o(e,t){const r=n.get(e);r&&(n.delete(e),r(t))}export{i as requestMediaPick,o as resolveMediaPick};
|
package/dist/chunk-A7ZJII7O.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{isBackendError as e,readHostFailure as s,STATUS_UNREACHABLE as t,hostUnreachableMessage as n,hostLoadRefusalOf as a}from"./chunk-KDYIMJTZ.js";var i={unauthorized:"the editor's sign-in was refused (unauthorized).","changed-elsewhere":"the page changed while it was being opened (changed-elsewhere).","lock-taken":"somebody else holds this page (lock-taken).","not-found":"this page no longer exists (not-found).",invalid:"the backend refused the request (invalid).",unavailable:"the backend could not be reached (unavailable)."};function o(a){if(e(a))return s(a.cause)?o(a.cause):`${i[a.kind]} ${a.message}`.trim();const r=s(a);return r?r.status===t?`${n()} (no response)`:401===r.status||403===r.status?`the editor's sign-in was refused (${r.status}). Reload the console and open the editor again; if it keeps happening the bridged token is not valid for this site.`:404===r.status?"this page no longer exists (404).":r.status>=500?`the server failed (${r.status}). ${r.message}`:`the server refused the request (${r.status}). ${r.message}`:a instanceof Error?`${a.name}: ${a.message}`:String(a)}function r(e,s){return a(e,s)}export{o as describeLoadFailure,r as hostLoadRefusal};
|
package/dist/chunk-AJBJ74ME.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,o=/* @__PURE__ */new WeakMap;function i(e){r=e}function u(e=k()){if(e.hostBackend)return e.hostBackend;let n=o.get(e);if(!n){if(!r)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=r(e),o.set(e,n)}return n}function d(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/puck/config).");return e.registry}function s(e={}){const t=e.backend??null,r=/* @__PURE__ */new Map,o={documentId:null,bridgedId:null};return{hostBackend:t,usesBridgedToken:null===t||n(t),blocks:e.blocks??null,registry:e.registry??null,chrome:e.chrome??null,documentHooks:e.documentHooks??null,auth:{token:null,brandId:null},site:o,siteId:()=>o.documentId??o.bridgedId,cache:(e,n)=>(r.has(e)||r.set(e,n()),r.get(e)),forget(e){void 0===e?r.clear():r.delete(e)}}}function c(e,n){e.site.documentId=t(n)}function l(e,n){e.site.bridgedId=t(n)}var f=s(),a=null,b=/* @__PURE__ */new Set;function k(){return a??f}function h(e){b.delete(e),a=e}function g(e){b.add(e),queueMicrotask(()=>{b.delete(e)&&a===e&&(a=null)})}function w(){return k().usesBridgedToken}function m(){f=s()}export{e as EFFICIENT_BACKEND,h as activateEaselSession,u as backendOf,s as createEaselSession,k as currentEaselSession,g as deactivateEaselSession,w as efficientClientOpen,n as isEfficientBackend,i as provideDefaultBackend,m as resetAmbientEaselSession,d as sessionRegistry,l as setSessionBridgedSite,c as setSessionDocumentSite};
|
package/dist/chunk-AKZWUV5Z.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{PAGE_CONFLICT_CODE as r,readEaselFailure as o}from"./chunk-HMX55DYT.js";import{createEditLock as c}from"./chunk-JUQ6YJCG.js";var e=c({readFailure:o,conflictCode:r});export{e as pageEditLock};
|
package/dist/chunk-F6CCTEIX.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ROOT_ZONE as e}from"./chunk-FUDHI5I4.js";import{styleMenuItems as n}from"./chunk-57DJOKXT.js";import{EaselContextMenu as t}from"./chunk-KTVH2ZRL.js";import{createNodeClipboard as o,nodeMenuItems as l}from"./chunk-2LK54I4E.js";import{useCanvasEvent as i}from"./chunk-PAELDYYS.js";import{framePointToHost as c}from"./chunk-ZNCEOSXO.js";import{UndoIcon as s,RedoIcon as r,AddIcon as a,PasteIcon as d,SettingsIcon as p,LayersIcon as u,CopyIcon as f}from"./chunk-L5KW4HG5.js";import{zoneKey as h,ROOT_SLOT as m,ROOT_ID as k}from"./chunk-KRXQM65X.js";import{useState as y,useCallback as b}from"react";import{jsx as v}from"react/jsx-runtime";function x(n,t){const o=[],l=/* @__PURE__ */new Set;let i={zone:t.zone,index:t.index};for(;i;){const t=n.nodeAt(i.zone,i.index);if(!t||l.has(t.props.id))break;if(l.add(t.props.id),o.push({zone:i.zone,index:i.index,node:t,parentType:null}),i.zone===e)break;const c=i.zone.lastIndexOf(":");if(c<=0)break;i=n.locate(i.zone.slice(0,c))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var C=o();function g(n,t,o){if(t===e){const{floor:e,cap:t}=n.sectionBand();return{parentId:k,slot:m,index:Math.min(Math.max(o,e),t)}}const l=t.lastIndexOf(":");return{parentId:t.slice(0,l),slot:t.slice(l+1),index:o}}function A(e,t){const{zone:o,index:i}=t,c=e.nodeAt(o,i);if(!c)return[];const s=c.props.id,r=e.labelOf(c.type,o),a=Boolean(c.props._hidden),d=e.nodeOps,p=e.isPinned(c,o),u=e.isLocked(c),f=!p&&!u&&!e.duplicateBlocked(c),m=x(e,t),k=d.held,y=k&&!p&&h(k.from)===o?g(e,o,i+1):null,b=e.style?n({held:e.style.held(),canCopy:e.style.canCopy(c,o),onCopy:()=>e.style?.copy(c,o),onPaste:()=>e.style?.paste(o,i,c)}):[];return l({title:r,layer:{group:"pick",items:m.map((n,t)=>({label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)}))},actions:{addInside:e.canAddTo(c.type)?()=>e.openAddInside(o,i):void 0,duplicate:f?()=>d.duplicate(s):void 0,moveUp:d.canStep(s,-1)?()=>d.step(s,-1):void 0,moveDown:d.canStep(s,1)?()=>d.step(s,1):void 0,copy:p?void 0:()=>d.copy(s,r),cut:f?()=>d.cut(s,r):void 0,paste:k&&y?{label:k.label,run:()=>d.paste(y)}:void 0,rename:e.renamePropOf(c,o)?()=>e.beginRename(o,i):void 0,hide:u||p?void 0:{hidden:a,run:()=>d.setProps(s,{_hidden:!a})},delete:f?()=>d.remove(s):void 0},style:b,pinnedLine:p?"Pinned — can’t be moved or deleted":void 0})}function P(n){const t=[];n.history.hasPast&&t.push({label:"Undo",icon:/* @__PURE__ */v(s,{}),shortcut:"⌘Z",onClick:n.history.back}),n.history.hasFuture&&t.push({label:"Redo",icon:/* @__PURE__ */v(r,{}),shortcut:"⇧⌘Z",onClick:n.history.forward});const o=[{label:"Add section",icon:/* @__PURE__ */v(a,{}),onClick:n.openAddSection}],l=n.nodeOps.held;if(l&&h(l.from)===e){const t=g(n,e,n.sectionBand().cap);o.push({label:`Paste ${l.label}`,icon:/* @__PURE__ */v(d,{}),shortcut:"⌘V",onClick:()=>n.nodeOps.paste(t)})}const i=[t,o,[{label:"Page settings",icon:/* @__PURE__ */v(p,{}),onClick:n.openPageSettings},{label:"Collapse all layers",icon:/* @__PURE__ */v(u,{}),onClick:n.collapseAll}]].filter(e=>e.length>0),c={label:"—",onClick:()=>{}};return i.flatMap((e,n)=>n?[c,...e]:e)}function z(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),i=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},c=[];l&&(c.push({label:"Copy",icon:/* @__PURE__ */v(f,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),c.push({label:"Cut",icon:/* @__PURE__ */v(f,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),i("")}})),c.push({label:"Paste",icon:/* @__PURE__ */v(d,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&i(e)}).catch(()=>e.onPasteRefused())}});const s=[c,n.value?[{label:"Select all",shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),r={label:"—",onClick:()=>{}};return s.flatMap((e,n)=>n?[r,...e]:e)}function I(e){return e.shiftKey}function O(e,n){const[o,l]=y(null),s=b(()=>l(null),[]),r=b(n=>{if(I(n))return;const t=n.target,o=function(e){const n=e?.closest?.("input, textarea");return n?n instanceof HTMLInputElement&&!["text","search","url","email","tel","number",""].includes(n.type)?null:n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o});const i=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),c=i?e.locate(i):null;n.preventDefault(),l(c?{kind:"node",x:n.clientX,y:n.clientY,...c}:{kind:"empty",x:n.clientX,y:n.clientY})},[e]);i(n,"contextmenu",t=>{if(I(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,i=o?.getAttribute("data-puck-component"),s=i?e.locate(i):null;t.preventDefault();const r=c(n.frame,t.clientX,t.clientY);l(s?{kind:"node",...r,...s}:{kind:"empty",...r})}),i(n,"mousedown",s),i(n,"scroll",s,{on:"window"});return{onEditorContextMenu:r,menu:o?/* @__PURE__ */v(t,{x:o.x,y:o.y,items:"node"===o.kind?A(e,o):"input"===o.kind?z(e,o.el):P(e),onClose:s}):null,closeMenu:s}}export{C as EASEL_NODE_CLIPBOARD,x as ancestorChain,A as nodeMenuItems,P as pageMenuItems,z as textMenuItems,O as useNodeContextMenu};
|
package/dist/chunk-FUDHI5I4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function n(n,t){const r=n.components?.[t]?.fields??{};return Object.keys(r).filter(n=>"slot"===r[n]?.type)}function t(t,r){return n(t,r.type).flatMap(n=>(Array.isArray(r.props[n])?r.props[n]:[]).map((t,e)=>({child:t,zone:`${r.props.id}:${n}`,index:e})))}function r(n,r,e){const o=(r,i,u,p)=>{if(!r||"object"!=typeof r||!r.props)return null;if(r.props.id===e)return{item:r,zone:i,index:u};if(p>=12)return null;for(const{child:e,zone:i,index:u}of t(n,r)){const n=o(e,i,u,p+1);if(n)return n}return null};for(let n=0;n<r.length;n+=1){const t=o(r[n],f,n,0);if(t)return t}return null}var e=6;function o(t,r,e){return e<6&&n(t,r).length>0}var i=n=>`${n}-${crypto.randomUUID()}`,u="Header",p="Footer",f="root:default-zone",s=[u,p];function c(n){const t=/* @__PURE__ */new Set,r=[];return n.forEach((n,e)=>{const o=n?.type;void 0!==o&&s.includes(o)&&(t.has(o)?r.push(e):t.add(o))}),r}function l(n){return c(n).map(t=>n[t]?.props?.id).filter(n=>"string"==typeof n)}function d(n,t){const r=(n,t)=>n.some(n=>n?.type===t);return s.filter(e=>!r(n,e)&&!r(t,e))}export{p as FOOTER_TYPE,u as HEADER_TYPE,f as ROOT_ZONE,e as TREE_MAX_DEPTH,t as childSlotsOf,r as locateNode,d as missingPinnedTypes,o as nestsInTree,i as newNodeId,l as pinnedDuplicateIds,c as pinnedDuplicateIndices,n as slotFieldsOf};
|
package/dist/chunk-GENAF3P6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,n){const o=e.categories??{},c=e.components,r=[];for(const[s,i]of Object.entries(o))for(const o of i?.components??[]){const i=c[o];if(!i)continue;const a=i.label??o,l=n.labelAtLevel(o,"section",a);r.push({type:o,cat:s,catLabel:t(e,s,n.categoryLabel),name:l,desc:n.descriptions[o]??"",...l===a?{}:{alias:a}})}return r}function t(e,t,n){return n(t)??e.categories?.[t]?.title??t}function n(e,t){return!t||`${e.name} ${e.alias??""} ${e.desc} ${e.type} ${e.catLabel}`.toLowerCase().includes(t)}function o(e,t){return e.find(e=>e.type===t)??null}function c(e,t){return e.filter(e=>e.type!==t)}export{e as buildPaletteSections,t as categoryLabel,n as matchesQuery,c as paletteWithoutPinned,o as pinnedSection};
|
package/dist/chunk-HDKTR5TZ.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{siteStyleScope as n,copyNodeStyle as t,nodeStyleRows as o,planNodePaste as r}from"./chunk-Q2HPBMG5.js";import{markedTreeNodeId as i,revealSelectedTreeRow as l,sameSelector as s}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as d}from"./chunk-AKFJK65Z.js";import{rootRowName as c,slotChildRowName as a,slotChildRenameProp as p}from"./chunk-HWW4XJOH.js";import{scrollPreviewToSection as u,gotoPreviewSlide as f,scrollPreviewToTop as h}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as m,useEaselUndoKeys as y}from"./chunk-OM67AJQC.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{UiIcon as k}from"./chunk-5MZ3RNQQ.js";import{DEFAULT_PANEL_W as S,PANEL_WIDTHS_KEY as b,clampPanelWidth as x}from"./chunk-SERF2FAU.js";import{usePartBridge as v}from"./chunk-GXN65JMA.js";import{useSectionOps as w}from"./chunk-VV5ADNBR.js";import{EASEL_NODE_CLIPBOARD as z,useNodeContextMenu as C}from"./chunk-F6CCTEIX.js";import{ROOT_ZONE as B,TREE_MAX_DEPTH as N,childSlotsOf as A,slotFieldsOf as O,nestsInTree as T,newNodeId as P}from"./chunk-FUDHI5I4.js";import{PageEditGuardNotices as $}from"./chunk-LG436UTD.js";import{useScreenDocument as j}from"./chunk-YJXEHK6I.js";import{requestMediaPick as R}from"./chunk-6FY3PZS3.js";import{useEaselHost as I}from"./chunk-R5ZVNJLJ.js";import{heldStyle as M,styleShortcut as E}from"./chunk-57DJOKXT.js";import{AddChildRow as L}from"./chunk-3QVB4AG2.js";import{AddSidePanel as D}from"./chunk-OORDMLL4.js";import{SidePanelHead as F,PanelShowStrip as H}from"./chunk-IWAPPEL4.js";import{MediaSidePanel as V}from"./chunk-3M3A3DN2.js";import{useMediaPanel as J,usePanelPick as G,cancelPanelPick as U}from"./chunk-ZZ7VLIHQ.js";import{useScreenSaveSwitch as W,useScreenPinned as Y,useScreenCanvasFrame as Q,useScreenInspectorPanel as X,useScreenDevices as Z,useScreenLeftView as K,SELECTION_MODE as _,sameInspectorMode as q,useScreenBridges as ee,useScreenBlockRules as ne,useScreenBlockLook as te,useScreenDocumentPass as oe}from"./chunk-NBJ2YY6Y.js";import{useEasel as re}from"./chunk-P67FP7PG.js";import{LayersTree as ie,TreeRow as le,TreeGroupLabel as se,Subtree as de,TreeRowAction as ce,TreeSeam as ae}from"./chunk-ZFDCDJNZ.js";import{useNodeOps as pe,toItemSelector as ue}from"./chunk-D2BCHTQR.js";import{saveIndicator as fe}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as he,TopBarRail as me,TopBarCluster as ye,EaselIconButton as ge,TopBarDivider as ke,DeviceSwitch as Se,InspectorIconButton as be,PanelResizeHandle as xe,MAX_PANEL_W as ve,MIN_PANEL_W as we,panelWidthVars as ze,SaveState as Ce,SaveStateToggle as Be}from"./chunk-6DJHRLCU.js";import{CanvasDragLayer as Ne}from"./chunk-TTJ54QGG.js";import{createDragSession as Ae,useTreeDrag as Oe,gapToMoveIndex as Te}from"./chunk-67GNT6PF.js";import{useCanvasFrame as Pe,BLOCK_SELECTOR as $e,useCanvasEvent as je}from"./chunk-PAELDYYS.js";import{LayersIcon as Re,UndoIcon as Ie,RedoIcon as Me,TrashIcon as Ee,MediaIcon as Le}from"./chunk-L5KW4HG5.js";import{ROOT_ID as De,ROOT_SLOT as Fe,zoneKey as He,parseZoneKey as Ve,DataError as Je}from"./chunk-KRXQM65X.js";import{useRef as Ge,useMemo as Ue,useState as We,useEffect as Ye,useCallback as Qe,useLayoutEffect as Xe,Fragment as Ze}from"react";import{jsx as Ke,jsxs as _e,Fragment as qe}from"react/jsx-runtime";function en({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i}){if(null!==t)/* @__PURE__ */return Ke(Ce,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
|
|
2
|
-
return Ke(Ce,{tone:e.pending?"off-unsaved":"off",label:"Not saving — see the notice above",role:"status"});const{tone:l,label:s}=fe(e),d=e.failed&&!e.paused&&/* @__PURE__ */Ke("button",{type:"button",className:"es-btn-ghost",onClick:i,children:"Retry now"});/* @__PURE__ */
|
|
3
|
-
return _e(qe,o?{children:[
|
|
4
|
-
/* @__PURE__ */Ke(Be,{pressed:e.paused,onToggle:r,title:e.paused?"Auto-save is off — click to turn it back on (saves your held edits)":"Auto-save is on — click to pause it",children:/* @__PURE__ */Ke(Ce,{tone:l,label:s})}),d]}:{children:[
|
|
5
|
-
/* @__PURE__ */Ke(Ce,{tone:l,label:s,role:"status"}),d]})}function nn({expand:e}){/* @__PURE__ */
|
|
6
|
-
return Ke("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */_e(qe,e?{children:[
|
|
7
|
-
/* @__PURE__ */Ke("path",{d:"M8 9l4-4 4 4"}),
|
|
8
|
-
/* @__PURE__ */Ke("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
9
|
-
/* @__PURE__ */Ke("path",{d:"M8 4l4 4 4-4"}),
|
|
10
|
-
/* @__PURE__ */Ke("path",{d:"M8 20l4-4 4 4"}),
|
|
11
|
-
/* @__PURE__ */Ke("path",{d:"M5 12h14"})]})})}function tn(){const fe=I(),{capabilities:Ce,currentSlug:Be,siteId:tn,onPublish:on,saveState:rn,saveConflict:ln,retrySave:sn,toggleAutoSave:dn,readOnly:cn,readOnlyReason:an=null}=j(),pn=W(),{canPublish:un,mediaEditing:fn,hasEditGuard:hn,hasPinnedChrome:mn}=Ce,{appState:yn,dispatch:gn,history:kn,selectedItem:Sn,getSelectorForId:bn,config:xn}=re(e=>e),{first:vn,last:wn,firstGroup:zn,lastGroup:Cn,isSectionGroup:Bn,sectionGroupZone:Nn,panelOf:An}=Y(),On=An(vn),Tn=Q(),Pn=X(),$n=w({readOnly:cn}),jn=Ge(null),Rn=Ue(()=>({...$n,select:e=>{jn.current=e,$n.select(e)}}),[$n]),In=yn.ui,Mn=In.leftSideBarVisible,En=In.rightSideBarVisible,{options:Ln,widths:Dn,initial:Fn,fluid:Hn}=Z(),[Vn,Jn]=We(Fn),Gn=J(),Un=fn&&null!==Gn,Wn=G(),{read:Yn,write:Qn,forSelection:Xn}=K(),[Zn,Kn]=We(Yn);Ye(()=>{Qn(Zn)},[Zn]);const[_n,qn]=We(0),et=Ge(null),nt=Ge(null),tt=Pe(nt,{readySelector:$e}),ot=m(nt);y(nt);const[rt,it]=We(!1),lt=Ge(!1),st=Ge(!1),[dt,ct]=We(null),at=dt&&dt.zone===B?dt.index:null,pt=e=>ct(null===e?null:{zone:B,index:e}),[ut,ft]=We([]),[ht,mt]=We(_),yt="puck"===ht.kind,gt=i(ht,Sn?.props.id),[kt,St]=We(null);Ye(()=>{kt&&(l(),St(null))},[kt]);const bt=Ge(bn);bt.current=bn;const xt=Qe((e,{scroll:n})=>{Kn(n=>Xn(e,n)),n&&St(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=bt.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),o=n}0!==t.length&&Jt(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]);Ye(()=>{mt(An(Sn?.type)??_);const e=Sn?.props.id,n=jn.current;if(jn.current=null,!e)return;const t=bn(e);xt(String(e),{scroll:!s(n,t??null,B)})},[Sn?.props.id,xt]);const vt=Qe(e=>{mt(n=>q(n,e)?n:e),gn({type:"setUi",ui:{rightSideBarVisible:!0}})},[gn]),wt=ee({kind:ht.kind,mode:ht,open:vt,show:e=>mt(e),reveal:()=>{En||gn({type:"setUi",ui:{rightSideBarVisible:!0}})}},{data:yn.data,selected:Sn??null,zoneOf:e=>bn(e)?.zone,readOnly:Boolean(cn),select:e=>{mt(_),Rn.select({index:e})},replace:(e,n)=>Rn.replaceComponent(B,e,n),scrollTo:e=>Xo(e)},{device:Vn,refreshes:_n},{setView:Kn,reveal:()=>{Mn||gn({type:"setUi",ui:{leftSideBarVisible:!0}})}}),zt=wt.pinnedSource??!1,Ct=wt.resolveLeftView?wt.resolveLeftView(Zn,Un):"media"===Zn&&Un?Zn:"sections",{isLockedBlock:Bt,duplicateBlocked:Nt,nestDepth:At,newSectionNode:Ot,canAddTo:Tt,blockIsOffered:Pt}=ne(),$t=te(),{labelAtLevel:jt,Icon:Rt,useProducts:It}=$t,Mt=Qe(e=>{gn({type:"setUi",ui:{rightSideBarVisible:!0}}),u(e),xt(e,{scroll:!0})},[gn,xt]),{selectNode:Et,openPartId:Lt}=v({mode:ht,setMode:mt,onOpenPart:Mt}),[Dt,Ft]=We(null),Ht="sf-editor-collapsed-sections",[Vt,Jt]=We(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Ht);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
12
|
-
return new Set}});Ye(()=>{try{window.localStorage.setItem(Ht,JSON.stringify([...Vt]))}catch{}},[Vt]);const[Gt,Ut]=We(()=>{if("undefined"==typeof window)return{...S};try{const e=window.localStorage.getItem(b);if(!e)return{...S};const n=JSON.parse(e);return{left:x(Number(n.left)||S.left),right:x(Number(n.right)||S.right)}}catch{return{...S}}});Ye(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(b,JSON.stringify(Gt))}catch{}},300);return()=>clearTimeout(e)},[Gt]);const Wt=Qe((e,n)=>Ut(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Yt=Qe(e=>Wt("left",e),[Wt]),Qt=Qe(e=>Wt("right",e),[Wt]),Xt=e=>Vt.has(e),Zt=e=>Jt(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Kt=Ge(!1),_t=Ge(null);Ye(()=>{if(Kt.current&&!rt){const e=_t.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??nt.current?.querySelector('button[aria-label="Add"]'))?.focus(),_t.current=null}Kt.current=rt},[rt]),Ye(()=>{if(!rt||!ot)return;const e=e=>{"Escape"===e.key&&rr()};return ot.addEventListener("keydown",e),()=>ot.removeEventListener("keydown",e)},[rt,ot]),Ye(()=>{!Mn&&rt&&(it(!1),ct(null),lt.current=!1)},[Mn]),Ye(()=>{if(!Wn)return st.current&&gn({type:"setUi",ui:{leftSideBarVisible:!1}}),void(st.current=!1);rt&&(it(!1),ct(null),st.current=lt.current,lt.current=!1),Mn||(st.current=!0,gn({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Wn]),Ye(()=>{!Mn&&Wn&&(st.current=!1,U())},[Mn]),Ye(()=>{if(!Wn||!ot)return;const e=e=>{"Escape"===e.key&&U()};return ot.addEventListener("keydown",e),()=>ot.removeEventListener("keydown",e)},[Wn,ot]);const[qt,eo]=We(null),[no,to]=We(0),oo=Ge(null),ro=(e,n="success")=>{eo({msg:e,tone:n}),to(e=>e+1),oo.current&&clearTimeout(oo.current),oo.current=setTimeout(()=>eo(null),"error"===n?3200:1900)};Ye(()=>()=>{oo.current&&clearTimeout(oo.current)},[]);const io=Ge(null),[lo,so]=We(0),[co,ao]=We(0);Ye(()=>{const e=io.current;if(!e)return;const n=()=>{so(e.clientWidth),ao(e.clientHeight)};n();const t=new ResizeObserver(n);return t.observe(e),()=>t.disconnect()},[]),Xe(()=>{io.current&&(so(io.current.clientWidth),ao(io.current.clientHeight))},[Gt,Mn,En]);const po=Vn===Hn?lo>0?lo:Dn[Hn]:Dn[Vn],uo=lo>0?Math.min(lo/po,2):1,fo=po*uo,ho=lo>0&&fo>lo+1,mo={width:fo,height:co||"100%",flex:"none",position:"relative"},yo={width:po,height:co?co/uo:"100%",maxHeight:"none",transform:1!==uo?`scale(${uo})`:void 0,transformOrigin:"top left"},go=()=>gn({type:"setUi",ui:{leftSideBarVisible:!Mn}}),ko=()=>gn({type:"setUi",ui:{rightSideBarVisible:!En}}),So=e=>{rt&&(it(!1),ct(null),lt.current=!1,Mn&&Zn===e)||Wn&&(st.current=!1,U(),Mn&&Zn===e)||(Mn&&Zn===e?go():(Kn(e),Mn||gn({type:"setUi",ui:{leftSideBarVisible:!0}})))},bo=()=>{R(fe,{accept:"image/*",title:"Media library"})},xo=()=>{mt(_),Rn.select(null),h()},vo=()=>{mt(On??_),En||gn({type:"setUi",ui:{rightSideBarVisible:!0}})},wo=yn.data.content??[],zo=()=>{const e=wo.findIndex(e=>e.type===vn),n=wo.findIndex(e=>e.type===wn);return{floor:e>=0?e+1:0,cap:n>=0?n:wo.length}},Co=xn,Bo=pe({data:yn.data,config:Co,readOnly:Boolean(cn),clipboard:z,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==De||e.slot!==Fe)return{min:0,max:n-1};const{floor:t,cap:o}=zo();return{min:t,max:o-1}},commit:(e,{select:n})=>{if(void 0!==n){mt(_);const t="node"===n?.kind?ue(e,Co,n):null;Rn.select(t&&t.zone===B?{index:t.index}:t)}Rn.commitDocument(e)}}),No=e=>xn.components[e]?.label??e,Ao=Qe(e=>xn.components[e]?.defaultProps??{},[xn]),Oo=e=>jt(e,"section",No(e)),To=e=>c({type:e.type,props:e.props??{}},Oo(e.type)),{nodeAddresses:Po,zoneItems:$o}=Ue(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=N)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of A(xn,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(wo,B,0),{nodeAddresses:e,zoneItems:n}},[wo,xn]),jo=Qe(e=>$o.get(e)??[],[$o]),Ro=It(),Io=Ue(()=>{const e=/* @__PURE__ */new Map;for(const n of Ro??[])e.set(n.slug,n.name);return e},[Ro]),Mo=e=>a(e,No,$t.plainText,e=>Io.get(e)),Eo=(e,n)=>n===B?null:p(xn.components[e.type]?.fields),Lo=(e,n,t,o)=>{if(!(Dt?.zone===e&&Dt.index===n))return;const r=(t,o)=>{Ft(null),o&&((e,n,t)=>{const o=jo(e)[n];if(!o)return;const r=Eo(o,e);r&&Rn.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
13
|
-
return Ke("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":"Rename",onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},Do=n(tn),Fo=xn,Ho=(e,n)=>n===B?Oo(e):No(e),Vo=(e,n,t)=>{const o=r(Fo,Do,t,Ho(t.type,e));o&&(o.changed&&Rn.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),ro(o.message))},Jo=C({nodesIn:jo,nodeAt:(e,n)=>jo(e)[n]??null,labelOf:(e,n)=>n===B?Oo(e):No(e),renamePropOf:Eo,beginRename:(e,n)=>Ft({zone:e,index:n}),history:{hasPast:kn.hasPast,hasFuture:kn.hasFuture,back:()=>kn.back(),forward:()=>kn.forward()},openAddSection:()=>{Rn.select(null),tr(null)},openPageSettings:()=>{Rn.select(null),mt(_)},collapseAll:()=>Jt(new Set(jo(B).map(e=>String(e.props.id)))),onPasteRefused:()=>ro("Your browser won’t let us read the clipboard — press ⌘V","error"),isLocked:e=>Bt(e.type),duplicateBlocked:e=>Nt(yn.data,e),canAddTo:Tt,nodeOps:Bo,isPinned:(e,n)=>n===B&&(e.type===vn||e.type===wn),sectionBand:zo,openAddInside:(e,n)=>{e===B?Zo(n):Rn.select({zone:e,index:n}),tr(null)},locate:e=>Po.get(e)??null,rowNameOf:(e,n)=>n===B?To(e):Mo(e),selectAt:(e,n,t,o)=>{e===B?Zo(n):kr(e,n,t,o??"")},style:{held:()=>M(Do),canCopy:e=>o(Fo,e).some(e=>!1!==e.counted),copy:(e,n)=>t(Fo,Do,e,Ho(e.type,n)),paste:(e,n,t)=>Vo(e,n,t)}},tt),Go=Ge({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Ye(()=>{Go.current={copy:(e,n)=>t(Fo,Do,e,Ho(e.type,n)),paste:Vo,at:()=>{const e=yn.ui.itemSelector;if(!e)return null;const n=e.zone??B,t=jo(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(cn)}});const Uo=Qe(e=>{const n=E(e);if(!n)return;const t=Go.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);Ye(()=>{if(!ot)return;const e=e=>Uo(e);return ot.addEventListener("keydown",e),()=>ot.removeEventListener("keydown",e)},[Uo,ot]),je(tt,"keydown",Uo);const Wo=wo.map(e=>e.props.id).join("|");Ye(()=>{const e=tt?.document??null,n=tt?.window??null;let t=0;const o=[],r=()=>{if(!e)return void ft(e=>e.length?[]:e);const n=wo.findIndex(e=>e.type===wn),t=n>=0?n:wo.length,o=n=>{const t=wo[n]?.props?.id;if(null==t)return null;const o=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);return o?o.getBoundingClientRect():null},r=[];for(let e=1;e<=t;e++){const n=o(e),t=o(e-1);(n||t)&&r.push({top:Math.round(n?n.top:t.bottom),index:e})}ft(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index)return!1;return!0}(e,r)?e:r)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[tt,Wo,Vn,uo,Mn,En,Sn?.props.id]);const Yo=tt?.document??null,Qo=tt?.window??null;Ye(()=>{const e=et.current;if(!e||!Yo||!Qo)return;const n=[],t=()=>{const n=Yo.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Qo.scrollTo({left:Qo.scrollX,top:Qo.scrollY+t,behavior:"instant"}),!0};return et.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Yo,Qo]);const Xo=e=>{wt.holdCanvasOn?wt.holdCanvasOn(e):u(e)},Zo=e=>{mt(_),Rn.select({index:e}),wt.sectionPressed?.(wo[e]);const n=wo[e]?.props?.id;n&&Xo(n)},Ko=e=>{const{floor:n,cap:t}=zo(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Sn&&ht.kind!==On?.kind?wo.findIndex(e=>e.props.id===Sn.props.id):-1;return o(r>=0?r+1:t)},_o=(e,n)=>{const{floor:t,cap:o}=zo(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Rn.reorderComponent(B,e,i),Rn.select({index:i}),{moved:!0,dest:i})},qo=(e,n,t)=>{mt(_),Rn.select({index:e}),u(n),ro(`Added “${t}” section`)},er=(e,n)=>{const t=Ko(n),o=Ot(e,{nodeDefaults:Ao,newNodeId:P,sectionLabel:Oo,blockIsOffered:Pt}),r=o?Rn.insertNode(B,t,o):Rn.insertSection(e,t);return qo(t,r,Oo(e)),t},nr=(e,n,t)=>{const o=Ko(t),r=Rn.insertNode(B,o,n);return qo(o,r,e),o},tr=e=>or(B,e),or=(e,n)=>{_t.current=document.activeElement??null,Wn&&(lt.current=st.current,st.current=!1,U()),ct(null===n?null:{zone:e,index:n}),it(!0),Mn||(lt.current=!0,gn({type:"setUi",ui:{leftSideBarVisible:!0}}))},rr=()=>{it(!1),ct(null),lt.current&&gn({type:"setUi",ui:{leftSideBarVisible:!1}}),lt.current=!1},ir=(e,n,t)=>{if("section"===e.kind)Rn.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Rn.insertNode(n,t,d(e.template.node))}mt(_),Rn.select({index:t,zone:n})},lr=e=>n=>{n.target.closest(".es-tree-select")||e()},sr=()=>wt.editPinnedSource?.(),dr=(e,n,t)=>/* @__PURE__ */Ke(ce,{kind:"delete",label:`Delete ${t}`,onClick:()=>((e,n)=>{const t=jo(e)[n]?.props?.id;null!=t&&Bo.remove(String(t))})(e,n),children:/* @__PURE__ */Ke(Ee,{size:15})}),cr=(e,n,t,o)=>{const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
14
|
-
return Ke(ce,{kind:"eye",label:r?`Show ${o}`:`Hide ${o}`,onClick:()=>pr(e,n,t),children:/* @__PURE__ */Ke(k,r?{name:"eye-off",size:14}:{name:"eye",size:14})})},ar=e=>{const n=Oo(wo[e]?.type??"");return Vr(B,e,()=>tr(e),n?`Add section before ${n}`:"Add section here")},pr=(e,n,t)=>{Rn.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},ur=e=>O(xn,e),fr=e=>A(xn,e),hr=(e,n,t)=>{const o=T(xn,e.type,n)&&(t||fr(e).length>0);return{collapsible:o,folded:o&&Xt(String(e.props.id))}},mr=(e,n,t)=>fr(e).flatMap(({child:e})=>hr(e,n,t(e.type)).collapsible?[String(e.props.id),...mr(e,n+1,t)]:[]),yr=e=>fr(e).length>0||Boolean(Tt(e.type)),gr=e=>Boolean(Tt(e)),kr=(e,n,t,o)=>{if(mt(_),Tt(o)?.spec?.slider){const t=e.split(":")[0];f(t,n),Rn.select({index:n,zone:e}),u(t)}else Rn.select({index:n,zone:e}),Xo(t)},Sr=(e,n,t,o,r)=>{const i=`${e}:${n}`;Rn.insertComponent(i,t,o),Tt(r)?.spec?.slider?requestAnimationFrame(()=>{f(e,o),Rn.select({index:o,zone:i})}):Rn.select({index:o,zone:i})},br=(e,n,t)=>{Rn.insertComponent(e,n,t),mt(_),Rn.select({index:t,zone:e})},xr=Ge(/* @__PURE__ */new Set);Ye(()=>{wo.forEach(e=>{const n=Tt(e.type)?.spec;if(!n)return;const t=e.props.id;if(xr.current.has(t))return;xr.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(Ao)).forEach((e,t)=>Rn.seedChild(o,t,n.childType,e))})},[wo,Rn,Ao]);const vr=Ge(/* @__PURE__ */new Set);Ye(()=>{wo.forEach((n,t)=>{const o=n.props.id;if(vr.current.has(o))return;const r=e(n,ur(n.type));vr.current.add(o),r&&Rn.replaceComponent(B,t,{...n,props:r})})},[wo,Rn]),oe(Rn,xn);const wr=wo.findIndex(e=>e.type===wn),zr=wr>=0?wo[wr]:null,Cr=wo.find(e=>e.type===zn)??null,Br=wo.find(e=>e.type===Cn)??null,Nr=wr>=0?wr:wo.length,Ar=[];wo.forEach(e=>{e.type!==wn&&(yr(e)&&Ar.push(String(e.props.id)),Ar.push(...mr(e,1,gr)))}),zr&&(Ar.push(String(zr.props.id)),Ar.push(...mr(zr,1,gr)));const Or=Ar.length>0&&Ar.every(e=>Vt.has(e)),Tr=e=>$t.blockRowName(e,No),Pr=(e,n,t,o)=>{const r=jo(e)[t];if(!r)return;const i={...Ve(e),index:t},l={...Ve(n),index:Math.min(Math.max(o,0),jo(n).length)},s=Te(i,l);if(e!==n||s!==t)try{Bo.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Je))throw e}},$r=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of fr(e))n.add(r),t(o)};for(const t of ur(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},jr=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Po.get(n);if(!e)return null;if(e.zone===B)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Rr=e=>{const n=e.slice(0,e.indexOf(":")),t=wo.find(e=>Bn(e.type)&&String(e.props.id)===n);return t&&Nn(n)===e?t:null},Ir=(e,n)=>{if(e.add)return Er(e.add,n);const t=He(n);if(Bn(e.type))return!1;const o=Rr(t),r=Rr(e.zone);if(o||r)return!(!o||!r)&&(n.index>=0&&n.index<=jo(t).length);if(e.zone===B||t===B){if(e.zone!==t)return!1;const{floor:o,cap:r}=zo();return n.index>=o&&n.index<=r}if(n.index<0||n.index>jo(t).length)return!1;if(e.zone===t)return!0;const i=zr?String(zr.props.id):null;return(!i||jr(e.zone)!==i&&jr(t)!==i)&&((e,n,t)=>{if(e===n)return!0;const o=jo(e)[t];if(!o)return!1;const r=n.split(":")[0],i=Po.get(r),l=i?jo(i.zone)[i.index]:void 0;if(!l)return!1;if($r(o).has(n))return!1;const s=Tt(l.type,At(yn?.data,l.type,r));return!!s&&(!!(s.choices?s.choices.some(e=>e.type===o.type):s.spec?.childType===o.type)&&!s.spec?.addBlocked?.(jo(n),o))})(e.zone,t,e.index)},Mr=e=>{const n=e.slice(0,e.indexOf(":")),t=Po.get(n),o=t?jo(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Tt(o.type,At(yn?.data,o.type,n));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;return{parent:o,parentId:n,target:r,choices:r.choices??(r.spec?[{type:r.spec.childType,label:No(r.spec.childType)}]:[]),parentName:t.zone===B?Oo(o.type):No(o.type)}},Er=(e,n)=>{const t=He(n);if("block"!==e.kind){if(Rr(t))return n.index>=0&&n.index<=jo(t).length;if(t!==B)return!1;const{floor:e,cap:o}=zo();return n.index>=e&&n.index<=o}if(t===B)return!1;const o=Mr(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(jo(t))},Lr=(e,n)=>{e.add?((e,n)=>{if("block"!==e.kind&&Rr(He(n)))return void ir(e,He(n),n.index);if("section"===e.kind)return void er(e.type,n.index);if("template"===e.kind)return void nr(e.template.name,d(e.template.node),n.index);const t=He(n),o=Mr(t);o&&(o.target.spec?Sr(o.parentId,o.target.slot,e.type,n.index,o.parent.type):br(t,e.type,n.index))})(e.add,n):e.zone===B?_o(e.index,n.index):Pr(e.zone,He(n),e.index,n.index)},[Dr]=We(()=>Ae()),Fr=Oe({keyOf:e=>e.id,readOnly:Boolean(cn),session:Dr,canDrop:Ir,onDrop:Lr,onStep:(e,n)=>{e.zone===B?((e,n)=>{const t=Oo(wo[e]?.type??""),o=_o(e,n<0?e-1:e+2);if(!o.moved)return void ro(`“${t}” is already ${n<0?"first":"last"}`);const{floor:r,cap:i}=zo();ro(`Moved “${t}” to position ${o.dest-r+1} of ${i-r}`)})(e.index,n):Pr(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Hr=Qe(e=>{const{floor:n,cap:t}=zo(),o=[];for(const r of e.nodes){const e=He(r.place),i=jo(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(i.type===vn||i.type===wn||Bt(i.type))continue;if(Bn(i.type))continue;const l=Boolean(Rr(e)),s=e===B||l;e===B&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?Oo(i.type):Mo(i),from:r.place})}return{sources:o,zones:e.zones.filter(e=>e.children.length>0||Boolean(Mr(He(e.list))?.choices.length)||Boolean(Rr(He(e.list))))}},[yn.data]),Vr=(e,n,t,o)=>/* @__PURE__ */Ke(ae,{...cn?{}:Fr.seam({place:{...Ve(e),index:n}}),onAdd:cn?void 0:t,label:o},`seam:${e}:${n}`),Jr={rowClick:lr,isCollapsed:Xt,toggleCollapse:Zt},Gr=e=>{const n=String(e.props.id),t=wo.findIndex(e=>String(e.props.id)===n),o=Nn(n),r=jo(o),i=Xt(n),l=No(e.type),s=e=>Vr(o,e,()=>or(o,e),"Add section here");/* @__PURE__ */
|
|
15
|
-
return _e(qe,{children:[
|
|
16
|
-
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:e.type,size:13}),name:l,onSelect:()=>Zo(t),selected:gt===n,rowProps:{"data-node-id":n,onClick:lr(()=>Zo(t))},fold:{open:!i,label:"section",onToggle:()=>Zt(n)}}),!i&&/* @__PURE__ */_e(de,{children:[r.map((n,t)=>{const r=String(n.props.id),i=To(n),l=yr(n),d=l&&Xt(r),c=()=>kr(o,t,r,e.type),{rowProps:a,...p}=Fr.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Ve(o),index:t}},{"data-node-id":r,onClick:lr(c)});/* @__PURE__ */
|
|
17
|
-
return _e(Ze,{children:[s(t),
|
|
18
|
-
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:n.type,size:13}),name:i,onSelect:c,selected:gt===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!d,label:"section",onToggle:()=>Zt(r)}:void 0,actions:/* @__PURE__ */_e(qe,{children:[dr(o,t,i),cr(o,t,n,i)]}),rowProps:a}),l&&!d&&/* @__PURE__ */Ke(de,{children:Wr(n,2)})]},r)}),s(r.length)]})]})},Ur=(e,n)=>{const t=fr(e),o=(e,n)=>Vr(e,n),r=Tt(e.type),i=r?`${e.props.id}:${r.slot}`:null;/* @__PURE__ */
|
|
19
|
-
return _e(qe,{children:[t.map(({child:t,zone:r,index:i})=>{const l=gt===String(t.props.id),{collapsible:s,folded:d}=hr(t,n,gr(t.type)),c=String(t.props.id),a=Tr(t),p=()=>kr(r,i,c,e.type),{rowProps:u,...f}=Fr.row({item:{id:c,zone:r,index:i,type:t.type},place:{...Ve(r),index:i}},{"data-node-id":c,onClick:lr(p)});/* @__PURE__ */
|
|
20
|
-
return _e(Ze,{children:[0===i&&o(r,0),
|
|
21
|
-
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:t.type,size:13}),name:a,onSelect:p,selected:l,hidden:Boolean(t.props._hidden),...f,fold:s?{open:!d,label:"group",onToggle:()=>Zt(c)}:void 0,actions:/* @__PURE__ */_e(qe,{children:[dr(r,i,a),cr(r,i,t,a)]}),rowProps:u}),s&&!d&&/* @__PURE__ */Ke(de,{children:Ur(t,n+1)}),o(r,i+1)]},String(t.props.id??`${r}-${i}`))}),i&&!t.some(e=>e.zone===i)?o(i,0):null]})},Wr=(e,n)=>{const t=fr(e),o=Tt(e.type,At(yn?.data,e.type,String(e.props.id))),r=o?.spec??null,i=r&&Array.isArray(e.props[r.slot])?e.props[r.slot]:[],l=o&&o.choices?{slot:o.slot,choices:o.choices}:null,s=String(e.props.id),d=r&&!r.fixed?`${s}:${r.slot}`:null,c=l?`${s}:${l.slot}`:null,a=(n,t)=>{const o=n===d&&r&&!r.addBlocked?.(i)?()=>Sr(e.props.id,r.slot,r.childType,t,e.type):n===c?()=>or(n,t):void 0;return Vr(n,t,o,n===d&&r?r.addLabel:"Add block here")};/* @__PURE__ */
|
|
22
|
-
return _e(qe,{children:[t.map(({child:t,zone:o,index:r})=>{const i=gt===String(t.props.id),l=Mo(t),s=String(t.props.id),{collapsible:d,folded:c}=hr(t,n,gr(t.type)),p=ur(t.type),u=1===p.length?`${s}:${p[0]}`:null,f=u?{...Ve(u),index:jo(u).length}:void 0,h=Fr.dragging,m=f&&h&&Ir(h,f)?f:void 0,y=()=>kr(o,r,s,e.type),{rowProps:g,...k}=Fr.row({item:{id:s,zone:o,index:r,type:t.type},place:{...Ve(o),index:r},into:m,canDrag:!Bt(t.type)},{"data-node-id":s,onClick:lr(y)});/* @__PURE__ */
|
|
23
|
-
return _e(Ze,{children:[0===r&&a(o,0),
|
|
24
|
-
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:t.type,size:13}),name:l,onSelect:y,nameSlot:Lo(o,r,s,l),selected:i,hidden:Boolean(t.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>Zt(s)}:void 0,actions:Bt(t.type)?void 0:/* @__PURE__ */_e(qe,{children:[dr(o,r,l),cr(o,r,t,l)]}),rowProps:g}),d&&!c&&/* @__PURE__ */Ke(de,{children:Wr(t,n+1)}),a(o,r+1)]},String(t.props.id??`${o}-${r}`))}),r&&!r.fixed&&
|
|
25
|
-
/* @__PURE__ */Ke(L,{small:!0,label:r.addLabel,blocked:r.addBlocked?.(i)??null,onAdd:()=>Sr(e.props.id,r.slot,r.childType,i.length,e.type)}),c&&!t.some(e=>e.zone===c)?a(c,0):null]})},Yr=(()=>{if(!Sn||!yt)return null;const e=String(Sn.type),n=String(Sn.props.id),t=Tt(e,At(yn?.data,e,n));if(!t||"footer"===t.source)return null;const o=wo.some(e=>String(e.props?.id)===n),r=Array.isArray(Sn.props[t.slot])?Sn.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:No(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:o?Oo(e):No(e),choices:i,onPick:o=>{t.spec?Sr(n,t.slot,o,r.length,e):br(`${n}:${t.slot}`,o,r.length)}}})(),Qr=rt||null!==Wn,Xr=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Mn&&!Qr&&Ct===e.id,onSelect:()=>So(e.id)}:e,Zr=[{id:"add",label:"Add",icon:/* @__PURE__ */Ke("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:rt,onSelect:()=>rt?rr():tr(null)},...(wt.railLead??[]).map(Xr),{id:"sections",label:"Layers",icon:/* @__PURE__ */Ke(Re,{}),active:Mn&&!Qr&&"sections"===Ct,onSelect:()=>So("sections")},...(wt.railTrail??[]).map(Xr)];Un?Zr.push({id:"media",label:"Media library",icon:/* @__PURE__ */Ke(Le,{}),active:Mn&&!rt&&(null!==Wn||"media"===Ct),onSelect:()=>So("media")}):fn&&Zr.push({id:"media",label:"Media library",icon:/* @__PURE__ */Ke(Le,{}),onSelect:bo});const Kr=[...wt.railLead??[],...wt.railTrail??[]].find(e=>"panel"in e&&e.id===Ct);return(wt.wrap??(e=>e))(
|
|
26
|
-
/* @__PURE__ */_e("div",{ref:nt,className:"sf-editor es-editor",style:ze(Gt),onContextMenu:Jo.onEditorContextMenu,children:[
|
|
27
|
-
/* @__PURE__ */_e(he,{children:[
|
|
28
|
-
/* @__PURE__ */Ke(me,{items:Zr,ariaLabel:"Left panel views"}),
|
|
29
|
-
/* @__PURE__ */_e(ye,{children:[
|
|
30
|
-
/* @__PURE__ */Ke(ge,{label:"Undo",disabled:!kn.hasPast,onClick:()=>kn.back(),children:/* @__PURE__ */Ke(Ie,{})}),
|
|
31
|
-
/* @__PURE__ */Ke(ge,{label:"Redo",disabled:!kn.hasFuture,onClick:()=>kn.forward(),children:/* @__PURE__ */Ke(Me,{})}),
|
|
32
|
-
/* @__PURE__ */Ke(ke,{}),
|
|
33
|
-
/* @__PURE__ */Ke(Se,{devices:Ln,value:Vn,onChange:Jn})]}),
|
|
34
|
-
/* @__PURE__ */_e(ye,{kind:"right",style:{minWidth:300},children:[
|
|
35
|
-
/* @__PURE__ */Ke(en,{saveState:rn,notSaving:Boolean(cn)||null!=ln,readOnlyReason:an,toggle:pn,onToggle:dn,onRetry:sn}),wt.barLead?.(),
|
|
36
|
-
/* @__PURE__ */Ke("button",{type:"button",className:"es-btn-ghost",title:"Refresh the preview (reloads the canvas, keeps your place)",onClick:()=>{et.current=(()=>{const e=tt?.document;if(!e)return null;const n=wo.findIndex(e=>e.type===wn),t=n>=0?n:wo.length;let o=null;for(let n=0;n<t;n++){const t=wo[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Sn?.props?.id??wo[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),qn(e=>e+1)},children:"Refresh"}),wt.barTrail?.(),wt.barMain?wt.barMain():/* @__PURE__ */Ke("button",{type:"button",className:"es-btn-primary",disabled:null!==an,onClick:()=>{on(yn.data)},children:un?"Publish":"Save"})]})]}),
|
|
37
|
-
/* @__PURE__ */Ke($,{}),
|
|
38
|
-
/* @__PURE__ */_e("div",{className:"sf-body",children:[Mn?/* @__PURE__ */_e(qe,{children:[
|
|
39
|
-
/* @__PURE__ */Ke("div",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:rt?/* @__PURE__ */Ke(D,{blocks:dt&&dt.zone!==B&&!Rr(dt.zone)?Mr(dt.zone):Yr,blocksOnly:Boolean(dt&&dt.zone!==B&&!Rr(dt.zone)),at:dt?{label:(e=>{const n=Rr(e.zone);if(n)return`Adding to ${No(n.type)}`;if(e.zone===B){const n=wo[e.index];return n&&n.type!==wn?`Adding before ${Oo(n.type)}`:"Adding at the end of the page"}const t=Mr(e.zone);return t?`Adding to ${t.parentName}`:"Adding here"})(dt),onClear:()=>ct(null)}:void 0,onAdd:e=>{if(dt&&"block"!==e.kind&&Rr(dt.zone))return ir(e,dt.zone,dt.index),void ct({zone:dt.zone,index:dt.index+1});if("section"===e.kind)return(e=>{if(null===at)return void er(e);const n=er(e,at);pt(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===at)return void nr(e,n);const t=nr(e,n,at);pt(t+1)})(e.template.name,d(e.template.node));if(dt&&dt.zone!==B){const n=Mr(dt.zone);if(!n)return;return n.target.spec?Sr(n.parentId,n.target.slot,e.type,dt.index,n.parent.type):br(dt.zone,e.type,dt.index),void ct({zone:dt.zone,index:dt.index+1})}Yr?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Dr,siteWide:wt.addPanelRow?.(rr),onClose:rr,onHide:go,readOnly:Boolean(cn)}):Wn&&Gn?
|
|
40
|
-
/* @__PURE__ */Ke(V,{panel:Gn,pick:Wn,onHide:go}):Kr?Kr.panel({onHide:go,notify:ro}):"media"===Ct&&Gn?/* @__PURE__ */Ke(V,{panel:Gn,pick:null,onHide:go}):/* @__PURE__ */_e(qe,{children:[
|
|
41
|
-
/* @__PURE__ */Ke(F,{icon:/* @__PURE__ */Ke(Re,{}),title:"Layers",context:`/${Be}`,actions:Ar.length>0?/* @__PURE__ */Ke(be,{label:Or?"Expand all sections":"Collapse all sections",onClick:()=>Jt(e=>{const n=new Set(Ar);return Or?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Ar])}),children:/* @__PURE__ */Ke(nn,{expand:Or})}):void 0,onHide:go}),
|
|
42
|
-
/* @__PURE__ */_e(ie,{className:"sf-tree sf-scroll",children:[
|
|
43
|
-
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:"page",size:13}),name:"Page settings",onSelect:xo,selected:!Sn&&yt,rowProps:{onClick:lr(xo)}}),Cr&&/* @__PURE__ */_e(qe,{children:[
|
|
44
|
-
/* @__PURE__ */Ke(se,{children:"Header"}),Gr(Cr)]}),!zt&&mn&&/* @__PURE__ */_e(qe,{children:[
|
|
45
|
-
/* @__PURE__ */Ke(se,{children:"Header"}),
|
|
46
|
-
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:"header",size:13}),name:"Header",onSelect:vo,selected:ht.kind===On?.kind,rowProps:{onClick:lr(vo)}})]}),!zt&&/* @__PURE__ */_e(se,{children:["Template · ",hn?"Home page":"Template"]}),wo.map((e,n)=>{if(e.type===vn||e.type===wn||Bn(e.type))return null;const t=gt===String(e.props.id),o=Boolean(e.props._hidden);fr(e);const r=String(e.props.id),i=wt.hasOwnRows?.(e)??!1,l=yr(e)||i,s=l&&Xt(r),{rowProps:d,...c}=Fr.row({item:{id:r,zone:B,index:n,type:e.type},place:{...Ve(B),index:n}},{"data-node-id":r,onClick:lr(()=>Zo(n))});/* @__PURE__ */
|
|
47
|
-
return _e(Ze,{children:[n>0&&ar(n),
|
|
48
|
-
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:e.type,size:13}),name:To(e),onSelect:()=>Zo(n),selected:t,hidden:o,...c,fold:l?{open:!s,label:"section",onToggle:()=>Zt(r)}:void 0,actions:/* @__PURE__ */_e(qe,{children:[dr(B,n,To(e)),cr(B,n,e,To(e))]}),rowProps:d}),yr(e)&&!s&&/* @__PURE__ */_e(de,{children:[Wr(e,1),wt.partRows?.(e,Jr)]}),i&&!s&&/* @__PURE__ */Ke(de,{children:wt.ownRows?.(e,n,Jr)})]},String(e.props.id??n))}),!zt&&Nr>0&&ar(Nr),mn&&/* @__PURE__ */Ke(se,{children:"Footer"}),zr&&(()=>{const e=String(zr.props.id),n=fr(zr).length>0||Boolean(Tt(zr.type)),t=n&&Xt(e);/* @__PURE__ */
|
|
49
|
-
return _e(qe,{children:[
|
|
50
|
-
/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:"footer",size:13}),name:"Footer",onSelect:()=>Zo(wr),selected:gt===String(zr.props.id),fold:n?{open:!t,label:"section",onToggle:()=>Zt(e)}:void 0,rowProps:{onClick:lr(()=>Zo(wr))}}),n&&!t&&/* @__PURE__ */Ke(de,{children:Ur(zr,1)})]})})(),!zt&&!zr&&mn&&/* @__PURE__ */Ke(le,{icon:/* @__PURE__ */Ke(Rt,{type:"footer",size:13}),name:"Footer",onSelect:sr,rowProps:{onClick:lr(sr),title:"Edit the site footer"}}),Br&&Gr(Br),wt.treeFoot?.()]})]})}),
|
|
51
|
-
/* @__PURE__ */Ke(xe,{side:"left",width:Gt.left,min:we,max:ve,defaultWidth:S.left,label:"Resize Sections panel",onResize:Yt})]}):/* @__PURE__ */Ke(H,{side:"left",onShow:go}),
|
|
52
|
-
/* @__PURE__ */Ke("div",{ref:io,className:"sf-center sf-scroll",style:{overflowX:ho?"auto":"hidden",overflowY:"hidden"},children:/* @__PURE__ */Ke("div",{className:"sf-frame-scaler",style:mo,children:/* @__PURE__ */Ke("div",{className:"sf-frame "+(Vn===Hn?"":`sf-frame--${Vn}`),style:yo,children:/* @__PURE__ */_e("div",{className:"sf-preview-host",children:[
|
|
53
|
-
/* @__PURE__ */Ke(Tn,{},_n),
|
|
54
|
-
/* @__PURE__ */Ke(Ne,{canvas:tt,session:Dr,model:Hr,canDrop:Ir,onDrop:Lr,onPick:e=>{mt(_),Rn.select(e.zone===B?{index:e.index}:{index:e.index,zone:e.zone})},onZoneAdd:e=>or(He(e),0),readOnly:Boolean(cn),revision:yn.data}),ut.length>0&&/* @__PURE__ */Ke("div",{className:"sf-preview-gaps","aria-hidden":"true",children:ut.map(e=>/* @__PURE__ */_e("button",{type:"button",tabIndex:-1,className:"sf-preview-gap",style:{top:e.top},title:"Add section here",onClick:()=>tr(e.index),children:[
|
|
55
|
-
/* @__PURE__ */Ke("span",{className:"sf-preview-gap-line"}),
|
|
56
|
-
/* @__PURE__ */_e("span",{className:"sf-preview-gap-pill",children:[
|
|
57
|
-
/* @__PURE__ */Ke("span",{className:"sf-preview-gap-plus",children:"+"}),
|
|
58
|
-
/* @__PURE__ */Ke("span",{className:"sf-preview-gap-label",children:"Add section"})]})]},e.index))})]})})})}),En?/* @__PURE__ */_e(qe,{children:[
|
|
59
|
-
/* @__PURE__ */Ke(g,{value:{selectChild:kr,addChild:Sr,childRowName:Mo,blockRowName:Tr},children:/* @__PURE__ */Ke(Pn,{mode:ht,onOpenWebsiteSettings:wt.openSettings??(()=>{}),onOpenSiteStyles:wt.openStyles,onSelectNode:Et,onNotify:ro,onHidePanel:ko})}),
|
|
60
|
-
/* @__PURE__ */Ke(xe,{side:"right",width:Gt.right,min:we,max:ve,defaultWidth:S.right,label:"Resize settings panel",onResize:Qt})]}):
|
|
61
|
-
/* @__PURE__ */Ke(H,{side:"right",onShow:ko})]}),qt&&/* @__PURE__ */_e("div",{className:"sf-toast "+("error"===qt.tone?"sf-toast--error":""),role:"status",children:[
|
|
62
|
-
/* @__PURE__ */Ke("span",{className:"sf-toast-check","aria-hidden":"true",children:"error"===qt.tone?"!":"✓"}),qt.msg]},no),Jo.menu]}))}export{tn as ScreenChrome};
|
package/dist/chunk-HMX55DYT.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{readHostFailure as e,isBackendError as n,STATUS_UNREACHABLE as s}from"./chunk-KDYIMJTZ.js";import{EDIT_LOCK_TAKEN as t}from"./chunk-JUQ6YJCG.js";var a="page_changed_elsewhere",d={unauthorized:401,"changed-elsewhere":409,"lock-taken":409,"not-found":404,invalid:400,unavailable:s};function o(s){const o=e(s);if(o)return{status:o.status,data:o.data};if(!n(s))return null;const c=e(s.cause);if(c)return{status:c.status,data:c.data};const u=d[s.kind];return"changed-elsewhere"===s.kind?{status:u,data:{code:a,saved_by:s.conflict?.savedBy??"",saved_by_you:!0===s.conflict?.savedByYou,seconds_ago:s.conflict?.secondsAgo??0}}:"lock-taken"===s.kind?{status:u,data:{code:t,holder_name:s.holder?.name??"",seconds_since_seen:s.holder?.secondsSinceSeen??0,seconds_since_held:s.holder?.secondsSinceHeld??0}}:{status:u,data:null}}function c(e){return 401===o(e)?.status}export{a as PAGE_CONFLICT_CODE,c as isExpiredSession,o as readEaselFailure};
|
package/dist/chunk-HWW4XJOH.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{textFieldIdentifier as r}from"./chunk-DUVRZ456.js";import{hidableText as n}from"./chunk-6W7WLPZH.js";function t(r,t){const o=n(r.props.name);if(o)return o;const e=n(r.props.altName);if(e)return e;const u=r.props.collection?.name;if(u)return u;const c=r.props.source?.title;if(c)return c;const p=r.props.code;return p?t?.(p)??p:""}function o(r,n,o,e){return o(t(r,e))||n(r.type)}function e(n){if(!n)return null;for(const t of["name","altName"])if(r(n[t]))return t;return null}function u(r,t){return n(r.props?.name).trim()||t}export{u as rootRowName,t as slotChildName,e as slotChildRenameProp,o as slotChildRowName};
|
package/dist/chunk-JUQ6YJCG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_LOCK_WORDS as e}from"./chunk-RE4LP46F.js";var n=e=>"editing"===e.kind;function t(e){return e?{kind:"checking"}:{kind:"editing"}}var r=e=>"blocked"===e.kind||"readonly"===e.kind||"takenover"===e.kind?e.holder:null;function o(e){if(!e||"object"!=typeof e)return null;const n=e;return"string"!=typeof n.holder_name?null:{name:n.holder_name,secondsSinceSeen:"number"==typeof n.seconds_since_seen?n.seconds_since_seen:0,secondsSinceHeld:"number"==typeof n.seconds_since_held?n.seconds_since_held:0}}var a=e=>e?{edit:!0,insert:!0,delete:!0,duplicate:!0,drag:!1}:{edit:!1,insert:!1,delete:!1,duplicate:!1,drag:!1};function s(n,t=e){if(!Number.isFinite(n)||n<45)return t.justNow;const r=Math.round(n/60);if(r<60)return t.minutesAgo({count:r});const o=Math.round(r/60);return t.hoursAgo({count:o})}var c=(n,t=e)=>n.trim()||t.someone;function d(){return`tab-${"undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():Math.random().toString(36).slice(2)}`.slice(0,64)}var i="edit_lock_taken";function u(e,t,r){return!(n(e)||!n(t))&&(r.pending&&r.autoSaveEnabled&&!r.saveConflict)}function l(e,t,o){return!(null===r(e)||!n(t))&&(!o.pending&&!o.saveConflict)}function f(e,n){return e!==n&&Date.parse(e)>=Date.parse(n)}async function k(e){if(!e.ours)return!1;const n=await e.stored().catch(()=>null);return!(!n||!f(n,e.ours)||e.hasPending())&&(e.reload(),!0)}function h(e){const{readFailure:n,conflictCode:t}=e,r=e=>{const t=n(e);return t&&409===t.status?o(t.data):null},a=e=>{const n=r(e);return n?{kind:"blocked",holder:n}:{kind:"editing"}},s=(e,n)=>{const t=r(e);return t?{kind:"blocked",holder:t}:n},c=(e,n)=>{const t=r(e);return t?{kind:"takenover",holder:t}:n},d=e=>{const t=n(e);return null!==t&&(401===t.status||403===t.status)};return{accessAfterClaimFailure:a,accessAfterTakeoverFailure:s,accessAfterHeartbeatFailure:c,isAuthRejection:d,readSaveConflict:e=>{const r=n(e);if(!r||409!==r.status)return null;if(!r.data||"object"!=typeof r.data)return null;const o=r.data;return o.code!==t?null:{savedBy:"string"==typeof o.saved_by?o.saved_by:"",savedByYou:!0===o.saved_by_you,secondsAgo:"number"==typeof o.seconds_ago?o.seconds_ago:0}},readLockTaken:e=>{const t=n(e);return t&&409===t.status&&t.data&&"object"==typeof t.data?t.data.code!==i?null:o(t.data)??{name:"",secondsSinceSeen:0,secondsSinceHeld:0}:null},makeClaimBeat:e=>{let n=!1;return async t=>{let r,o;try{const a=await e.claim(t);if(e.cancelled())return;r=e.currentAccess(),o={kind:"editing"},!n&&a.heartbeat_seconds>0&&(n=!0,e.startHeartbeat(1e3*a.heartbeat_seconds))}catch(n){if(e.cancelled())return;r=e.currentAccess(),o=t?s(n,r):"checking"===r.kind?a(n):c(n,r),d(n)&&e.stopHeartbeat()}e.setAccess(o);const i=e.heldWrite();u(r,o,i)?e.releaseHeldWrite():t&&l(r,o,i)&&e.reloadIfMoved?.()}}}}export{i as EDIT_LOCK_TAKEN,t as accessForNewDocument,n as canWriteDocument,h as createEditLock,s as describeAge,a as documentPermissions,f as documentVersionMoved,r as holderOf,c as nameOrSomeone,d as newEaselClientId,o as readLockHolder,k as reloadIfVersionMoved,u as shouldReleaseHeldWrite,l as shouldReloadAfterTakeover};
|
package/dist/chunk-NBJ2YY6Y.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{EaselCanvas as n,useSelectedFields as e}from"./chunk-P67FP7PG.js";import{Inspector as t}from"./chunk-BXZ6WLHC.js";import{DesktopIcon as r}from"./chunk-L5KW4HG5.js";import{createContext as o,useContext as i}from"react";import{jsx as u}from"react/jsx-runtime";var l={kind:"puck"};function s(n,e){const t=n,r=e,o=Object.keys(t);return o.length===Object.keys(r).length&&o.every(n=>Object.is(t[n],r[n]))}var c={},a=()=>c,d=()=>"",f=()=>{},p={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},k={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},h={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */u(r,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},m={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},v={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function b(){/* @__PURE__ */
|
|
2
|
-
return u(n,{height:"fill"})}function g(){const{id:n,fields:r,values:o,readOnly:i,onChange:l}=e();/* @__PURE__ */
|
|
3
|
-
return u("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */u(t,{fields:r,values:o,onChange:l,readOnly:i,idPrefix:n})})}var O=o({});function j({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return u(O.Provider,{value:n,children:e})}function w(){return i(O)}function y(){return(w().useOwnerName??d)()}function P(n,e,t,r){return(w().useBridges??a)(n,e,t,r)}function G(n){return(w().useStandaloneBridges??a)(n)}function L(n,e){(w().useDocumentPass??f)(n,e)}function S(){return w().blockRules??p}function B(){return w().blockLook??k}function x(){return w().devices??h}function C(){return w().leftView??m}function N(){return w().pinned??v}function D(){return w().saveSwitch??!0}function I(){return w().Canvas??b}function T(){return w().Inspector??g}export{l as SELECTION_MODE,j as ScreenPartsProvider,s as sameInspectorMode,B as useScreenBlockLook,S as useScreenBlockRules,P as useScreenBridges,I as useScreenCanvasFrame,x as useScreenDevices,L as useScreenDocumentPass,T as useScreenInspectorPanel,C as useScreenLeftView,y as useScreenOwnerName,w as useScreenParts,N as useScreenPinned,D as useScreenSaveSwitch,G as useStandaloneScreenBridges};
|
package/dist/chunk-OORDMLL4.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as r}from"./chunk-GENAF3P6.js";import{sectionTemplates as s}from"./chunk-4MXFKJUY.js";import{SidePanelHead as i,PanelModeExit as c}from"./chunk-IWAPPEL4.js";import{useEaselSession as l}from"./chunk-6TZTKAB5.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as d}from"./chunk-NBJ2YY6Y.js";import{useEasel as m}from"./chunk-P67FP7PG.js";import{AddPanel as u}from"./chunk-TTJ54QGG.js";import{AddIcon as f}from"./chunk-L5KW4HG5.js";import{useState as h,useEffect as k,useMemo as y}from"react";import{jsx as b,jsxs as g,Fragment as j}from"react/jsx-runtime";var $=e=>`section:${e}`,A=e=>`block:${e}`,v=e=>`template:${e}`;function I({blocks:I,blocksOnly:L,at:O,onAdd:P,itemFor:Y,session:B,siteWide:F,onClose:G,onHide:S,readOnly:T}){const x=m(e=>e.config),C=p(),{labelAtLevel:H,categoryLabel:K,firstSection:N,Icon:D,Thumbnail:E}=C,{blockIsOffered:J}=d(),W=l(),[w,z]=h([]);k(()=>{let t=!1;const o=e=>J(e,W);return s.list().then(n=>{if(t)return;const r=x.components;z(n.filter(t=>t.node?.type&&r[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[x,W]);const Q=y(()=>t(x,C),[x]),V=e=>({type:$(e.type),label:e.name,cover:/* @__PURE__ */b(E,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:`Add ${e.name}`,keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),Z=y(()=>{const e=[];if(I&&I.choices.length>0&&a(I.choices).forEach((t,o)=>{e.push({title:0===o?`Inside ${I.parentName}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:A(e.type),label:e.label,icon:/* @__PURE__ */b(D,{type:e.type,size:18}),title:`Add ${e.label}`}))})}),L)return e;const t=o(Q,N);t&&e.push({title:"Start blank",tiles:[V(t)]}),w.length>0&&e.push({title:"Your templates",tiles:w.map(e=>{return{type:v(e.id),label:e.name,cover:/* @__PURE__ */b(E,{type:e.node.type}),keywords:[(t=e.node.type,H(t,"section",x.components[t]?.label??t)),e.node.type]};var t})});const s=n(Q,N);for(const t of Object.keys(x.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({title:r(x,t,K),tiles:o.map(V)})}return e},[I,L,w,Q,x]),M=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=w.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
-
return g(j,{children:[
|
|
3
|
-
/* @__PURE__ */b(i,{icon:/* @__PURE__ */b(f,{size:15}),title:"Add",context:L?"Blocks for this place":"Sections and blocks",actions:/* @__PURE__ */b(c,{label:"Done",description:"Close Add and go back",onClick:G}),onHide:S}),
|
|
4
|
-
/* @__PURE__ */g("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */b(u,{groups:Z,session:B,itemFor:e=>Y(M(e)??{kind:"section",type:e}),onInsert:e=>{const t=M(e);t&&P(t)},at:O,hint:L?"Drag into the page, or click to add.":"Drag onto the page, or click to add.",searchLabel:L?"Search blocks":"Search sections",readOnly:T}),F&&!L?F:null]})]})}export{I as AddSidePanel,A as blockKey,$ as sectionKey,v as templateKey};
|
package/dist/chunk-Q2HPBMG5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{panelFieldsOf as t}from"./chunk-ZE7I3PLX.js";import{withoutDeviceGate as o,deviceMetaOf as e}from"./chunk-PWZOS45R.js";import{BUCKET_KEY as n}from"./chunk-R2HLPNQF.js";import{ANCHOR_FIELD_KEYS as r,foldMetaOf as s,MEDIA_FIELD_MARKER as i,TEXT_FIELD_MARKER as c,LINK_FIELD_MARKER as p}from"./chunk-DUVRZ456.js";import{STYLE_KIND as u,fieldKind as f,copyStyle as a,heldStyle as l,planPaste as m,pasteMessage as h}from"./chunk-57DJOKXT.js";var y=/* @__PURE__ */new Set([n.Style,n.Layout]),j=new Set(Object.values(n)),b=new Set(r),S=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[i,c,p];function w(t){return`site:${t??""}`}function g(t){if(!t||"object"!=typeof t)return null;const e=t,n=o(t)??t,r=e[u]??n[u];if("string"==typeof r)return r;const s=e.options??n.options;if(Array.isArray(s)){return`choice:${s.map(t=>String(t?.value)).sort().join("|")}`}return f(n)}function L(t){const e=t,n=o(t);return k.some(t=>t in e||n&&t in n)}function O(o,n){const r=t(o,n)??{},i=[];let c=!1;for(const[t,o]of Object.entries(r))j.has(t)?c=y.has(t):c&&o&&"object"==typeof o&&!t.startsWith("_")&&(s(o)||b.has(t)||S.has(t)||L(o)||"slot"!==o.type&&i.push({path:[t],kind:g(o),counted:"mobile"!==e(o)?.tier}));return i}function v(t,o,e,n){a({scope:o,type:e.type,label:n,rows:O(t,e),props:e.props})}function P(t,o,e,n){const r=l(o);if(!r)return null;const s=m(r,{type:e.type,rows:O(t,e),props:e.props});return{...s,message:h(s,r.sourceLabel,n)}}export{v as copyNodeStyle,O as nodeStyleRows,P as planNodePaste,g as shopFieldKind,w as siteStyleScope};
|
package/dist/chunk-Q3SQBNJB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{applyEaselChromeTheme as e}from"./chunk-3WSPDAK2.js";import{useEaselHost as t}from"./chunk-R5ZVNJLJ.js";import{useEaselSession as n}from"./chunk-6TZTKAB5.js";import{currentEaselSession as r,setSessionBridgedSite as o}from"./chunk-AJBJ74ME.js";import{useState as s,useRef as a,useEffect as c}from"react";var u={canCreatePlatformTemplate:!1};function i(t,n={}){const s=n.session??r();s.auth.token=t.token,s.auth.brandId=t.brandId??null,o(s,t.siteId),(n.stampChromeTheme??!0)&&e(t.theme)}function m(e){const[r,o]=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=t(),h=n();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,o(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:r,tokenRef:m,capabilities:l}}export{u as NO_BRIDGED_CAPABILITIES,i as applyAuthGrant,m as useAdminBridge};
|
package/dist/chunk-R5ZVNJLJ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createContext as e,useContext as r}from"react";import{jsx as n}from"react/jsx-runtime";var o={connected:!1,ownsDocument:!0,send:()=>{},subscribe:()=>()=>{},address:{search:()=>"",show:()=>{},load:()=>{},reload:()=>{}}},s=e(o);function t({host:e,children:r}){/* @__PURE__ */
|
|
2
|
-
return n(s.Provider,{value:e,children:r})}function d(){return r(s)}function c(e){const r=/* @__PURE__ */new Set;return{host:{connected:!0,ownsDocument:!1,send:(r,n)=>{e.onMessage({type:r,...n})},subscribe:e=>(r.add(e),()=>{r.delete(e)}),address:e.address},deliver:e=>{for(const n of[...r])n(e)}}}export{o as DETACHED_EASEL_HOST,s as EaselHostContext,t as EaselHostProvider,c as createEaselHost,d as useEaselHost};
|
package/dist/chunk-SERF2FAU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_PANEL_W as a,clampPanelWidth as r}from"./chunk-6DJHRLCU.js";var s="sf-editor-panel-widths",t={...a},e=a=>r(a);export{t as DEFAULT_PANEL_W,s as PANEL_WIDTHS_KEY,e as clampPanelWidth};
|
package/dist/chunk-VV5ADNBR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{newNodeId as e,ROOT_ZONE as t}from"./chunk-FUDHI5I4.js";import{useEasel as n}from"./chunk-P67FP7PG.js";import{useMemo as o}from"react";function r(r={}){const{dispatch:i}=n(e=>e),p=!0===r.readOnly;return o(()=>{const n=(t,n,o)=>{const r=e(n);return p||i({type:"insert",componentType:n,destinationZone:t,destinationIndex:o,id:r}),r},o=(e,t,n)=>{p||i({type:"replace",destinationZone:e,destinationIndex:t,data:n})};return{insertComponent:n,insertSection:(e,o)=>n(t,e,o),replaceComponent:o,seedChild:(e,t,r,i)=>{const p=n(e,r,t);o(e,t,{type:r,props:{id:p,...i}})},insertNode:(e,t,r)=>{const i=n(e,r.type,t);return o(e,t,{type:r.type,props:{...r.props,id:i}}),i},removeComponent:(e,t)=>{p||i({type:"remove",index:t,zone:e})},reorderComponent:(e,t,n)=>{p||i({type:"reorder",sourceIndex:t,destinationIndex:n,destinationZone:e})},duplicateComponent:(e,t)=>{p||i({type:"duplicate",sourceIndex:t,sourceZone:e})},select:e=>i({type:"setUi",ui:{itemSelector:e}}),setDocument:e=>{p||i({type:"setData",data:e})},commitDocument:e=>{p||i({type:"setData",data:()=>e,recordHistory:!0})}}},[i,p])}export{r as useSectionOps};
|
package/dist/chunk-YJXEHK6I.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{routeSharedHostMessage as e}from"./chunk-7MU3RJ6S.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-A7ZJII7O.js";import{pageEditLock as t}from"./chunk-AKZWUV5Z.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-OYX47SL7.js";import{isExpiredSession as s}from"./chunk-HMX55DYT.js";import{useAdminBridge as i}from"./chunk-Q3SQBNJB.js";import{useEaselHost as c}from"./chunk-R5ZVNJLJ.js";import{useEaselSession as l}from"./chunk-6TZTKAB5.js";import{backendOf as d,setSessionDocumentSite as f}from"./chunk-AJBJ74ME.js";import{DEFAULT_SCREEN_WORDS as g}from"./chunk-ZWK3CBRU.js";import{useAutosave as k}from"./chunk-BDTITTMW.js";import{canWriteDocument as m,newEaselClientId as v,reloadIfVersionMoved as p,holderOf as h}from"./chunk-JUQ6YJCG.js";import{useWords as y}from"./chunk-MFIRYGHW.js";import{createContext as w,useContext as S,useState as b,useMemo as I,useCallback as j,useEffect as P,useRef as B}from"react";import{jsx as A}from"react/jsx-runtime";var R={content:[],root:{},zones:{}};var E=w(null);function T(){const e=S(E);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function C({target:w,addressing:S=o,onHostMessage:T,children:C}){const M=S,{homeSlug:O,entryMayBounce:H,entryBounce:J,onSwitch:D,tellsHost:L,adapterFor:N,migrateRenamedProps:F,describeMissing:U,onLoadFailed:V}=M,[W,Z]=b(w),Y=c(),K=l(),x=I(()=>d(K),[K]),Q="template"===W.kind,X="template"===W.kind?W.id:null,G="template"===W.kind?W.pageSlug??O??"":"document"===W.kind?W.slug??"":W.slug,z="page"===W.kind?W.siteId??null:null,_=K.blocks,q=I(()=>N(W,x,_),[N,x,_,W.kind,"template"===W.kind?W.id:"document"===W.kind?W.record:W.siteId]),$=q.capabilities,ee=j(e=>K.documentHooks?.stored?.(e)??e,[K]),re="page"===W.kind?W.originSlug??null:null;P(()=>{f(K,z)},[K,z]);const ne=B(W);P(()=>{ne.current=W},[W]);const{token:te,tokenRef:oe,capabilities:ue}=i({onMessage:r=>{if(T?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&wr(e.target)}}}),ae=!K.usesBridgedToken||null!==te,se=q.lock,ie=Boolean(x.lock),[ce,le]=b(null),[de,fe]=b(null),[ge,ke]=b(null),[me,ve]=b(null),pe=y("screen",g),he=me?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})}}(me,pe):null,[ye,we]=b(null),Se=B(null),be=B(null),[Ie,je]=b(!1),Pe=B(null),[Be,Ae]=b(null),Re=B(null),[Ee,Te]=b(null),Ce=B(null);P(()=>{Ce.current=Ee},[Ee]);const[Me,Oe]=b($.hasEditLock?{kind:"checking"}:{kind:"editing"}),He=B(Me);P(()=>{He.current=Me},[Me]);const Je=B(()=>Promise.resolve(!1)),De=j(e=>{be.current=e,je(!0)},[]),Le=k({save:async({id:e,data:r})=>{if(m(He.current)){if(!await Je.current(e,r)){if(!m(He.current))return void De({id:e,data:r});throw new Error("page save did not land")}}else De({id:e,data:r})},onFailure:(e,r)=>{0===r&&Y.send("storefront-editor:save-failed")}}),{state:Ne,push:Fe,flush:Ue,pause:Ve,resume:We,stop:Ze,reset:Ye,retryNow:Ke,hasPending:xe}=Le,Qe=B(Ne);P(()=>{Qe.current=Ne},[Ne]);const Xe=u(Ne),Ge=j(()=>{const e=be.current;e&&(be.current=null,je(!1),Fe(e))},[Fe]),ze=B("");ze.current||(ze.current=v());const[_e,qe]=b(0),$e=B(!1),[er,rr]=b(H(w)),nr=B(!1);P(()=>{if(nr.current)return;nr.current=!0;const e=Y.address.search(),r=J(w,e);r?Y.address.load(r):H(w)&&rr(!1)},[w,Y]);const tr=Y.send;P(()=>{if(!ae)return;let e=!1;const t=ne.current,o=q.resolve(G),u=K.documentHooks?.opening?.({slug:G,isTemplate:Q,capabilities:$});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==O&&G!==O?void Y.address.load({kind:"page",slug:O,siteId:z??void 0}):(ve({target:t,slug:G,missing:!0,sentence:U?.(t)??null}),void V?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Se.current=n,we(n),le(r.id),fe(r.kind??null),Re.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:R,s=F(a),i=u?await u(s):s;e||ke(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),ve({target:t,slug:G,missing:!1,sentence:n(o,{slug:G}),cause:r(o)}),V?.(t,o))}),()=>{e=!0}},[ae,te,Q,q,G]);const or=j(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=oe.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),ur=j(async e=>{const r=oe.current;if(!r&&K.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n)){tr("storefront-editor:auth-expired");const n=r?await or(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[tr,or,K]),ar=j(async e=>{const r=oe.current?await ur(e):{ok:!1};return r.ok||tr("storefront-editor:save-failed"),r.ok},[tr,ur]),sr=j(async(e,r,n=!1)=>{if(null!==Se.current)return!1;if(!m(He.current))return!1;if(Ce.current)return!1;const o=await ur(()=>q.saveLayout(e,r,Re.current,ze.current));if(o.ok)return Re.current=o.value.version??Re.current,!0;const u=t.readLockTaken(o.error);if(u){const e={kind:"takenover",holder:u};return He.current=e,Oe(e),!1}const a=t.readSaveConflict(o.error);if(a){if(a.savedByYou&&!n&&q.rereadVersion){const n=await ur(()=>q.rereadVersion(e));if(n.ok&&n.value)return Re.current=n.value,Je.current(e,r,!0)}Ze(),Ce.current=a,Te(a)}return!1},[q,ur,Ze]);P(()=>{Je.current=sr},[sr]);const ir=j(e=>{if(null!==Se.current)return;if(tr("storefront-editor:dirty"),!ce)return;const r=ee(e);Pe.current=r,m(He.current)?Fe({id:ce,data:r}):De({id:ce,data:r})},[ce,tr,De,Fe,ee]),cr=j(async()=>{m(He.current)&&Ge();return await Ue()&&null==be.current},[Ge,Ue]),lr=B(cr);P(()=>{lr.current=cr},[cr]);const dr=B(ur);P(()=>{dr.current=ur},[ur]);const fr=j(()=>{Y.address.reload()},[Y]),gr=B(()=>Promise.resolve(!1));P(()=>{gr.current=()=>{const e=q.rereadVersion;return ce&&e?p({ours:Re.current,stored:async()=>{const r=await dr.current(()=>e(ce));return r.ok?r.value:null},hasPending:()=>null!=be.current||xe(),reload:fr}):Promise.resolve(!1)}},[q,ce,xe,fr]);const kr=null!==ye;P(()=>{if(!se||!ce||!ae||kr)return;let e=!1,r=null;const n=ze.current,o=t.makeClaimBeat({claim:async e=>{const r=await dr.current(()=>se.claim(ce,n,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>He.current,heldWrite:()=>({pending:null!=be.current||xe(),autoSaveEnabled:!Qe.current.paused,saveConflict:null!=Ce.current}),setAccess:e=>{He.current=e,Oe(e)},releaseHeldWrite:()=>{lr.current()},startHeartbeat:e=>{r=setInterval(()=>{o(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{gr.current()}}),u=$e.current;return $e.current=!1,u||Oe({kind:"checking"}),o(u),()=>{e=!0,r&&clearInterval(r),se.release(ce,n).catch(()=>{})}},[ce,se,ae,te,_e,kr]);const mr=j(()=>{se&&ce&&($e.current=!0,qe(e=>e+1))},[ce,se]),vr=j(()=>{Oe(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),pr=j(()=>{Qe.current.paused?(m(He.current)&&Ge(),We()):Ve()},[Ge,Ve,We]),hr=j(()=>{Ke()},[Ke]),yr=j(e=>{Pe.current=null,a("template"!==e.kind&&ie,{resetAutosave:()=>{Ye(),be.current=null,je(!1)},setVersion:e=>{Re.current=e},setSaveConflict:Te,setAccess:Oe}),D(e),Z(e),Se.current=null,we(null),le(null),fe(null),ke(null),ve(null),Y.address.show(e),"document"!==e.kind&&L(e)&&Y.send("storefront-editor:navigated",{target:e})},[Ye,Y,ie,D,L]),wr=j(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,ne.current,O))return;const r=null!=be.current;if(!r&&!xe())return void yr(e);const n=Qe.current;r||n.paused||n.failed||n.stopped?Ae(e):Ue().then(r=>{r?yr(e):Ae(e)})},[yr,xe,Ue,O]),Sr=j(()=>Ae(null),[]),br=j(()=>{Ae(e=>(e&&yr(e),null))},[yr]),Ir=j(async()=>{const e=Be;if(!e)return;await cr()&&(Ae(null),yr(e))},[Be,cr,yr]),jr=j(async e=>{if(null!==Se.current)return;if(!ce)return;if(!m(He.current)||Ce.current)return;const r=ee(e);if(!await sr(ce,r))return void(Ce.current||tr("storefront-editor:save-failed"));const n=q.publish;if(!$.canPublish||!n)return void tr("storefront-editor:saved");const t=await ur(()=>n(ce,Re.current??void 0));t.ok?(Re.current=t.value.version??Re.current,tr("storefront-editor:published")):tr("storefront-editor:save-failed")},[ce,q,$.canPublish,tr,sr,ur,ee]);/* @__PURE__ */
|
|
2
|
-
return A(E.Provider,{value:{target:W,adapter:q,capabilities:$,templateId:X,currentSlug:G,currentKind:de,siteId:z,ready:ae,token:te,tokenRef:oe,notifyParent:tr,bridgeCapabilities:ue,runAuthed:ar,docId:ce,data:ge,getLiveData:()=>Pe.current??ge,footerOriginSlug:re,error:he,redirecting:er,saveStatus:Xe,saveState:Ne,autoSaveEnabled:!Ne.paused,autoSaveStoppedByConflict:Ne.stopped,hasUnsavedEdits:Ne.pending||Ie,toggleAutoSave:pr,retrySave:hr,onChange:ir,flushSave:cr,onPublish:jr,access:Me,readOnly:null!==h(Me)||null!==ye,readOnlyReason:ye,takeOverEditing:mr,viewReadOnly:vr,saveConflict:Ee,reloadFromServer:fr,navigate:wr,pendingNav:Be,cancelPendingNav:Sr,discardAndNavigate:br,saveAndNavigate:Ir},children:C})}export{E as ScreenDocumentContext,C as ScreenDocumentProvider,T as useScreenDocument};
|
package/dist/chunk-ZWK3CBRU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var o={loading:"Loading…",waitingForAuthorization:"Waiting for editor authorization…",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:o})=>`No storefront page with slug "${o}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:o})=>`Could not load the document — ${o}`,noun:"page"};export{o as DEFAULT_SCREEN_WORDS};
|
package/dist/chunk-ZZ7VLIHQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createContext as e,useEffect as n,useContext as r,useSyncExternalStore as u}from"react";import{jsx as t}from"react/jsx-runtime";var l=e(null),o=null;function i({panel:e,children:r}){return o=e,n(()=>(o=e,()=>{o===e&&(o=null,v(f?.request.requestId??"",null))}),[e]),/* @__PURE__ */t(l.Provider,{value:e,children:r})}function s(){return r(l)}function c(){return null!==o}var f=null,d=/* @__PURE__ */new Set,a=()=>{for(const e of[...d])e()};function q(e){return new Promise(n=>{const r=f;f={request:e,resolve:n},a(),r?.resolve(null)})}function v(e,n){if(!f||f.request.requestId!==e)return;const{resolve:r}=f;f=null,a(),r(n)}function m(){f&&v(f.request.requestId,null)}function p(e){return d.add(e),()=>{d.delete(e)}}var I=()=>f?.request??null,h=()=>null;function w(){return u(p,I,h)}export{i as MediaPanelProvider,m as cancelPanelPick,c as hasMediaPanel,q as requestPanelPick,v as settlePanelPick,s as useMediaPanel,w as usePanelPick};
|