efficient-easel 0.99.1 → 0.100.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 +281 -36
- package/dist/autosave/index.d.ts +12 -6
- package/dist/blocks/index.d.ts +2 -2
- package/dist/canvas/index.d.ts +3 -3
- package/dist/canvas/index.js +1 -1
- package/dist/chrome/chrome.css +96 -29
- package/dist/chrome/index.d.ts +72 -19
- package/dist/chrome/index.js +17 -21
- package/dist/chunk-3EDSDPIP.js +1 -0
- package/dist/chunk-67GNT6PF.js +1 -0
- package/dist/{chunk-PI26YXYD.js → chunk-6EIVTKZZ.js} +21 -14
- package/dist/chunk-A5UK76FC.js +6 -0
- package/dist/chunk-AZT7V4UM.js +10 -0
- package/dist/chunk-DICUMYMG.js +12 -0
- package/dist/chunk-HDVD27VB.js +1 -0
- package/dist/chunk-JQM3V7XQ.js +1 -0
- package/dist/{chunk-TDA4HH54.js → chunk-JUQ6YJCG.js} +1 -1
- package/dist/chunk-LA54QLP5.js +1 -0
- package/dist/chunk-LGKQXSKO.js +16 -0
- package/dist/chunk-M6F6LS3H.js +1 -0
- package/dist/chunk-MH5GUZFQ.js +9 -0
- package/dist/chunk-P6O363EE.js +6 -0
- package/dist/chunk-PAELDYYS.js +1 -0
- package/dist/{chunk-JYPOOHII.js → chunk-QKVR3K73.js} +3 -3
- package/dist/chunk-SAJUCHOX.js +1 -0
- package/dist/chunk-TRVZ7C23.js +1 -0
- package/dist/chunk-V7GIIXFB.js +16 -0
- package/dist/{chunk-IBOFSS56.js → chunk-WZ7TGAAT.js} +1 -1
- package/dist/chunk-ZJEBF4NB.js +1 -0
- package/dist/copy/copy.css +388 -5
- package/dist/copy/index.d.ts +271 -8
- package/dist/copy/index.js +31 -10
- package/dist/data/index.d.ts +4 -4
- package/dist/drag/drag.css +10 -1
- package/dist/drag/index.d.ts +102 -11
- package/dist/drag/index.js +18 -17
- package/dist/{editor/editor.css → easel/easel.css} +16 -1
- package/dist/{editor → easel}/index.d.ts +146 -51
- package/dist/easel/index.js +9 -0
- package/dist/edit-lock/index.d.ts +3 -3
- package/dist/edit-lock/index.js +1 -1
- package/dist/fields/fields.css +103 -26
- package/dist/fields/index.d.ts +51 -13
- package/dist/fields/index.js +30 -46
- package/dist/gold/index.js +1 -1
- package/dist/icons/index.d.ts +10 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/markup/index.d.ts +94 -10
- package/dist/markup/index.js +1 -1
- package/dist/menu/index.d.ts +61 -6
- package/dist/menu/index.js +15 -15
- package/dist/menu/menu.css +17 -6
- package/dist/node-ops/index.d.ts +9 -9
- package/dist/node-ops/index.js +1 -1
- package/dist/panel/index.d.ts +73 -5
- package/dist/panel/index.js +18 -16
- package/dist/panel/panel.css +56 -1
- package/dist/pick/index.d.ts +42 -4
- package/dist/pick/index.js +7 -14
- package/dist/pick/pick.css +14 -0
- package/dist/rail/index.d.ts +6 -6
- package/dist/rail/index.js +1 -1
- package/dist/rail/rail.css +1 -1
- package/dist/strings/catalogue.d.ts +24 -40
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +25 -23
- package/dist/strings/index.js +2 -2
- package/dist/style-clipboard/index.d.ts +5 -5
- package/dist/style-clipboard/index.js +1 -1
- package/dist/text-styles/index.d.ts +328 -0
- package/dist/text-styles/index.js +38 -0
- package/dist/text-styles/text-styles.css +309 -0
- package/dist/tree/index.d.ts +44 -3
- package/dist/tree/index.js +1 -1
- package/dist/tree/tree.css +71 -0
- package/dist/{types-CnRzp9oc.d.ts → types-DGcCsxs8.d.ts} +79 -12
- package/dist/{types-DNrn_w4V.d.ts → types-DWS-s9z-.d.ts} +10 -10
- package/dist/{types-pGBXevBU.d.ts → types-Djdq6Xkd.d.ts} +15 -8
- package/dist/{types-Dy6oR6Z2.d.ts → types-E3HrTPg2.d.ts} +20 -14
- package/dist/{types-C7HFvdtk.d.ts → types-VqL6t5HH.d.ts} +82 -5
- package/dist/{watch-DmasQA61.d.ts → watch-BTYOJpQU.d.ts} +19 -2
- package/dist/{wordFit-9B9nqyf3.d.ts → wordFit-D4S36PvB.d.ts} +1 -1
- package/dist/{words-DagJdwIA.d.ts → words-AHHfiaRY.d.ts} +31 -2
- package/dist/{words-D9ChvbNC.d.ts → words-BDignMl_.d.ts} +1 -1
- package/dist/{words-Cqmyey0s.d.ts → words-BMzV04b1.d.ts} +2 -2
- package/dist/words-CJjUKcV5.d.ts +37 -0
- package/dist/words-CRYvAiHX.d.ts +105 -0
- package/dist/{words-B2YLaKEr.d.ts → words-CnnHb9jo.d.ts} +1 -1
- package/dist/{words-CD3WADyb.d.ts → words-CzoyDNHm.d.ts} +4 -0
- package/dist/{words-bOMsUJk9.d.ts → words-DBq7vfHy.d.ts} +59 -6
- package/dist/{words-DOhF-4D4.d.ts → words-DMG4dYq2.d.ts} +1 -1
- package/dist/{words-BK-npta-.d.ts → words-DgHcY5qB.d.ts} +10 -4
- package/dist/{words-B87GIFWH.d.ts → words-is_Vy6hn.d.ts} +1 -1
- package/package.json +14 -8
- package/dist/chunk-66CKSTXP.js +0 -14
- package/dist/chunk-67VZRQLG.js +0 -13
- package/dist/chunk-6PS6STGA.js +0 -1
- package/dist/chunk-7A7O2JWQ.js +0 -1
- package/dist/chunk-H4B72XCJ.js +0 -1
- package/dist/chunk-JE63JHKO.js +0 -1
- package/dist/chunk-KDIVA6WD.js +0 -1
- package/dist/chunk-MCLBHENY.js +0 -1
- package/dist/chunk-QB3BZIRA.js +0 -5
- package/dist/chunk-SJQG5ENJ.js +0 -1
- package/dist/chunk-SUO5627P.js +0 -1
- package/dist/chunk-ZT7M24XD.js +0 -1
- package/dist/editor/index.js +0 -9
- /package/dist/{chunk-GGTPNGFJ.js → chunk-AELNNAFM.js} +0 -0
|
@@ -46,12 +46,11 @@ declare const COPY_ALIGNS: readonly ["left", "center", "right", "justify"];
|
|
|
46
46
|
type CopyAlign = (typeof COPY_ALIGNS)[number];
|
|
47
47
|
/** The word each direction is called. American spelling, per the product's own
|
|
48
48
|
* rule (British is for client-facing design work, not the product). The words
|
|
49
|
-
* themselves are ./words' (`
|
|
49
|
+
* themselves are ./words' (`EaselStrings.copy.align`); this is their English. */
|
|
50
50
|
declare const COPY_ALIGN_LABELS: Record<CopyAlign, string>;
|
|
51
|
-
/** The mark each direction draws. `justify` is `align-
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* than being made a second time. */
|
|
51
|
+
/** The mark each direction draws. `justify` is `align-justify` (E5b, design
|
|
52
|
+
* final 2026-10-06): rows run edge to edge. Until then it borrowed
|
|
53
|
+
* `align-separate`, whose own entry says it is NOT justify. */
|
|
55
54
|
declare const COPY_ALIGN_GLYPHS: Record<CopyAlign, ReactNode>;
|
|
56
55
|
/**
|
|
57
56
|
* How wide this strip's WORDS are, for the drop-to-glyphs threshold.
|
|
@@ -84,7 +83,7 @@ declare const COPY_ALIGN_FIT: {
|
|
|
84
83
|
/** The strip's options, for the subset a host can honour. Order is always this
|
|
85
84
|
* module's, never the caller's array order — so two hosts offering the same
|
|
86
85
|
* three directions cannot draw them in two orders. `labels` is the words in
|
|
87
|
-
* the host's language (`
|
|
86
|
+
* the host's language (`useEaselStrings().copy.align`, 0.95.0); left out,
|
|
88
87
|
* English. */
|
|
89
88
|
declare function copyAlignOptions(allow: readonly CopyAlign[], labels?: Record<CopyAlign, string>): {
|
|
90
89
|
id: "left" | "right" | "center" | "justify";
|
|
@@ -123,6 +122,9 @@ type CopyWords = {
|
|
|
123
122
|
/** Why an address was refused. */
|
|
124
123
|
refused: string;
|
|
125
124
|
remove: string;
|
|
125
|
+
/** E5b: the window's Cancel. Optional, so a host's words from before still
|
|
126
|
+
* type; English when left out. */
|
|
127
|
+
cancel?: string;
|
|
126
128
|
apply: string;
|
|
127
129
|
};
|
|
128
130
|
/**
|
|
@@ -137,6 +139,57 @@ type CopyWords = {
|
|
|
137
139
|
}>;
|
|
138
140
|
/** What a mark writes when nothing is selected — typed over at once. */
|
|
139
141
|
placeholders: MarkPlaceholders;
|
|
142
|
+
/** The switch under a many-line box that shows the raw text with its marks
|
|
143
|
+
* (E5a). Optional, so a host's words from before still type; English when
|
|
144
|
+
* left out. */
|
|
145
|
+
showMarks?: string;
|
|
146
|
+
/**
|
|
147
|
+
* The final toolbar's buttons (E5b, design final 2026-10-06): what each is
|
|
148
|
+
* called — its accessible name and tooltip. Undo's tooltip also says how to
|
|
149
|
+
* redo, since there is no Redo button. Optional, like every E5b word, so a
|
|
150
|
+
* host's words from before still type.
|
|
151
|
+
*/
|
|
152
|
+
toolbar?: {
|
|
153
|
+
bold: string;
|
|
154
|
+
italic: string;
|
|
155
|
+
underline: string;
|
|
156
|
+
strike: string;
|
|
157
|
+
color: string;
|
|
158
|
+
link: string;
|
|
159
|
+
sup: string;
|
|
160
|
+
sub: string;
|
|
161
|
+
undo: string;
|
|
162
|
+
undoTitle: string;
|
|
163
|
+
bullet: string;
|
|
164
|
+
number: string;
|
|
165
|
+
letterCase: string;
|
|
166
|
+
caseNone: string;
|
|
167
|
+
caseUpper: string;
|
|
168
|
+
caseLower: string;
|
|
169
|
+
};
|
|
170
|
+
/** The colour window: its name, the theme row's label, and Remove. */
|
|
171
|
+
colors?: {
|
|
172
|
+
title: string;
|
|
173
|
+
theme: string;
|
|
174
|
+
remove: string;
|
|
175
|
+
/** "Any color": the square, the hue bar and the hex box under the theme. */
|
|
176
|
+
any: string;
|
|
177
|
+
square: string;
|
|
178
|
+
hue: string;
|
|
179
|
+
hex: string;
|
|
180
|
+
};
|
|
181
|
+
/** The number cells' names, and the tooltip each one carries. */
|
|
182
|
+
cells?: {
|
|
183
|
+
fontSize: string;
|
|
184
|
+
lineHeight: string;
|
|
185
|
+
letterSpacing: string;
|
|
186
|
+
paragraphSpacing: string;
|
|
187
|
+
tip: (v: {
|
|
188
|
+
name: string;
|
|
189
|
+
step: number;
|
|
190
|
+
unit: string;
|
|
191
|
+
}) => string;
|
|
192
|
+
};
|
|
140
193
|
};
|
|
141
194
|
|
|
142
195
|
export { type CopyWords as C, type CopyAlign as a, COPY_ALIGNS as b, COPY_ALIGN_FIT as c, COPY_ALIGN_GLYPHS as d, COPY_ALIGN_LABELS as e, copyAlignOptions as f };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* A plain module with no import, in node-ops' own folder (its lane:
|
|
7
7
|
* `tests/node-ops-leaf-safety.test.ts`). `nodeMenuItems` is a plain function,
|
|
8
8
|
* so it takes these as `options.words`; a host passes
|
|
9
|
-
* `
|
|
9
|
+
* `useEaselStrings().menu`. A row's `rows` override still wins over them.
|
|
10
10
|
*
|
|
11
11
|
* The shortcuts drawn beside Copy, Cut and Paste (⌘C, ⌘X, ⌘V) are key names,
|
|
12
12
|
* not words, and stay as they are; `rows` changes one.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The Layers tree's own words (`efficient-easel/strings`, 0.95.0): the drag
|
|
3
|
-
* hint
|
|
4
|
-
* host's.
|
|
3
|
+
* hint, the caret's and an empty slot's. A row's name, its marks and its
|
|
4
|
+
* actions are the host's.
|
|
5
5
|
*
|
|
6
6
|
* The tree is hook-free, so it does not read the strings provider: `TreeRow`
|
|
7
|
-
*
|
|
8
|
-
* `
|
|
7
|
+
* and `TreeEmptySlot` take these as their `words` prop and a host passes
|
|
8
|
+
* `useEaselStrings().tree`.
|
|
9
9
|
*/
|
|
10
10
|
type TreeWords = {
|
|
11
11
|
/** What a draggable row says after 0.7 s on it. */
|
|
@@ -22,6 +22,12 @@ type TreeWords = {
|
|
|
22
22
|
expandNamed: (v: {
|
|
23
23
|
label: string;
|
|
24
24
|
}) => string;
|
|
25
|
+
/** What an empty slot says when it offers nothing: a read-only tree. */
|
|
26
|
+
emptySlot?: string;
|
|
27
|
+
/** What an empty slot's button says. */
|
|
28
|
+
addBlock?: string;
|
|
29
|
+
/** What an empty slot says while a drag may land in it. */
|
|
30
|
+
dropHere?: string;
|
|
25
31
|
};
|
|
26
32
|
|
|
27
33
|
export type { TreeWords as T };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* A plain module with no import, in the pickers' own folder: they may reach
|
|
6
6
|
* nothing else (`tests/pick-leaf-safety.test.ts`), so they do NOT read the
|
|
7
7
|
* strings provider. `ColourPicker` and `ImageBox` take their group as `words`,
|
|
8
|
-
* and a host passes `
|
|
8
|
+
* and a host passes `useEaselStrings().pick.colour` / `.pick.image`.
|
|
9
9
|
*/
|
|
10
10
|
type PickWords = {
|
|
11
11
|
colour: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.100.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",
|
|
@@ -97,12 +97,18 @@
|
|
|
97
97
|
"default": "./dist/fields/index.js"
|
|
98
98
|
},
|
|
99
99
|
"./fields.css": "./dist/fields/fields.css",
|
|
100
|
-
"./
|
|
101
|
-
"types": "./dist/
|
|
102
|
-
"import": "./dist/
|
|
103
|
-
"default": "./dist/
|
|
104
|
-
},
|
|
105
|
-
"./
|
|
100
|
+
"./text-styles": {
|
|
101
|
+
"types": "./dist/text-styles/index.d.ts",
|
|
102
|
+
"import": "./dist/text-styles/index.js",
|
|
103
|
+
"default": "./dist/text-styles/index.js"
|
|
104
|
+
},
|
|
105
|
+
"./text-styles.css": "./dist/text-styles/text-styles.css",
|
|
106
|
+
"./easel": {
|
|
107
|
+
"types": "./dist/easel/index.d.ts",
|
|
108
|
+
"import": "./dist/easel/index.js",
|
|
109
|
+
"default": "./dist/easel/index.js"
|
|
110
|
+
},
|
|
111
|
+
"./easel.css": "./dist/easel/easel.css",
|
|
106
112
|
"./autosave": {
|
|
107
113
|
"types": "./dist/autosave/index.d.ts",
|
|
108
114
|
"import": "./dist/autosave/index.js",
|
|
@@ -182,7 +188,7 @@
|
|
|
182
188
|
"typescript": "^5.3.0"
|
|
183
189
|
},
|
|
184
190
|
"scripts": {
|
|
185
|
-
"build": "tsup && cp src/rail/rail.css dist/rail/rail.css && cp src/shell/shell.css dist/shell/shell.css && cp src/gold/gold.css dist/gold/gold.css && cp src/copy/copy.css dist/copy/copy.css && cp src/panel/panel.css dist/panel/panel.css && cp src/menu/menu.css dist/menu/menu.css && cp src/chrome/chrome.css dist/chrome/chrome.css && cp src/tree/tree.css dist/tree/tree.css && cp src/drag/drag.css dist/drag/drag.css && cp src/pick/pick.css dist/pick/pick.css && cp src/fields/fields.css dist/fields/fields.css && cp src/
|
|
191
|
+
"build": "tsup && cp src/rail/rail.css dist/rail/rail.css && cp src/shell/shell.css dist/shell/shell.css && cp src/gold/gold.css dist/gold/gold.css && cp src/copy/copy.css dist/copy/copy.css && cp src/panel/panel.css dist/panel/panel.css && cp src/menu/menu.css dist/menu/menu.css && cp src/chrome/chrome.css dist/chrome/chrome.css && cp src/tree/tree.css dist/tree/tree.css && cp src/drag/drag.css dist/drag/drag.css && cp src/pick/pick.css dist/pick/pick.css && cp src/fields/fields.css dist/fields/fields.css && cp src/text-styles/text-styles.css dist/text-styles/text-styles.css && cp src/easel/easel.css dist/easel/easel.css",
|
|
186
192
|
"dev": "tsup --watch",
|
|
187
193
|
"typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
|
|
188
194
|
"test": "node scripts/test.mjs",
|
package/dist/chunk-66CKSTXP.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_TREE_WORDS as e}from"./chunk-H4B72XCJ.js";import{ChevronIcon as a}from"./chunk-PI26YXYD.js";import{jsx as r,jsxs as l,Fragment as n}from"react/jsx-runtime";function s({className:e,children:a,rootProps:l}){/* @__PURE__ */
|
|
2
|
-
return r("div",{...l,className:e?`es-tree ${e}`:"es-tree",children:a})}function t({children:e}){/* @__PURE__ */
|
|
3
|
-
return r("div",{className:"es-tree-group",children:e})}function i({children:e}){/* @__PURE__ */
|
|
4
|
-
return r("div",{className:"es-subtree",children:e})}var d=e.dragHint;function c({icon:s,name:t,preview:i,selected:d,hidden:c,draggable:o,dragHint:p,dragging:h,drop:m,fold:u,handle:b,actions:g,nameSlot:N,onSelect:k,marks:f,badge:v,trailing:y,children:w,rowProps:x,words:C=e}){const P=["es-tree-row",d?"is-selected":"",c?"is-hidden":"",o?"is-draggable":"",h?"is-dragging":"",m?`is-drop-${m}`:""].filter(Boolean).join(" "),j=/* @__PURE__ */l(n,{children:[
|
|
5
|
-
/* @__PURE__ */l("span",{className:"es-tree-name",children:[t,i?/* @__PURE__ */r("span",{className:"es-tree-preview",children:i}):null]}),f?.map(e=>/* @__PURE__ */r("span",{className:"es-tree-mark",title:e.label,"aria-label":e.label,role:"img",children:e.icon},e.key)),null!=v&&!1!==v?/* @__PURE__ */r("span",{className:"es-tree-badge",children:v}):null]});/* @__PURE__ */
|
|
6
|
-
return l("div",{...x,className:P,children:[o?
|
|
7
|
-
/* @__PURE__ */l(n,{children:[
|
|
8
|
-
/* @__PURE__ */r("span",{className:"es-tree-grip","aria-hidden":"true",children:"⋮"}),
|
|
9
|
-
/* @__PURE__ */r("span",{className:"es-tree-hint","aria-hidden":"true",children:p??C.dragHint})]}):b?/* @__PURE__ */r("button",{type:"button",className:"es-tree-handle",...b,children:"⋮⋮"}):null,u?/* @__PURE__ */r("button",{type:"button",className:"es-tree-caret","aria-label":u.open?C.collapseNamed({label:u.label}):C.expandNamed({label:u.label}),"aria-expanded":u.open,title:u.open?C.collapse:C.expand,onClick:e=>{e.stopPropagation(),u.onToggle()},children:/* @__PURE__ */r(a,{size:11,strokeWidth:2.6,className:u.open?"es-tree-chev is-open":"es-tree-chev"})}):/* @__PURE__ */r("span",{className:"es-tree-caret-spacer","aria-hidden":"true"}),
|
|
10
|
-
/* @__PURE__ */r("span",{className:"es-tree-chip","aria-hidden":"true",children:s}),
|
|
11
|
-
/* @__PURE__ */l("span",{className:"es-tree-name-box",children:[N??(k?
|
|
12
|
-
/* @__PURE__ */r("button",{type:"button",className:"es-tree-select","aria-current":d?"true":void 0,"aria-keyshortcuts":o?"Alt+ArrowUp Alt+ArrowDown":void 0,onClick:k,children:j}):j),g?/* @__PURE__ */r("span",{className:"es-tree-actions",children:g}):null]}),y?/* @__PURE__ */r("span",{className:"es-tree-trailing",title:y.label,"aria-label":y.label,role:"img",children:y.icon}):null,w]})}function o({kind:e,label:a,onClick:l,pressed:n,disabled:s,children:t}){/* @__PURE__ */
|
|
13
|
-
return r("button",{type:"button",className:"delete"===e?"es-tree-del":"eye"===e?"es-tree-eye":"es-tree-act",title:a,"aria-label":a,"aria-pressed":n,disabled:s,onClick:e=>{e.stopPropagation(),l()},children:t})}function p({drop:e,onAdd:a,label:l,seamProps:n}){const s=["es-tree-seam",e?"is-drop":"",a?"has-add":""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
14
|
-
return r("div",{...n,className:s,children:a?/* @__PURE__ */r("button",{type:"button",className:"es-tree-seam-add","aria-label":l,title:l,onClick:a,children:"+"}):null})}export{s as LayersTree,i as Subtree,d as TREE_DRAG_HINT,t as TreeGroupLabel,c as TreeRow,o as TreeRowAction,p as TreeSeam};
|
package/dist/chunk-67VZRQLG.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_PANEL_WORDS as e}from"./chunk-7A7O2JWQ.js";import{jsx as a,jsxs as l,Fragment as i}from"react/jsx-runtime";import{isValidElement as n,cloneElement as s}from"react";function r({items:i,activeId:n,onSelect:s,ariaLabel:r=e.settings,className:t}){
|
|
2
|
-
/* @__PURE__ */
|
|
3
|
-
return a("div",{className:"es-tabs-fit",children:/* @__PURE__ */a("div",{role:"tablist","aria-label":r,"aria-orientation":"horizontal",className:t?`es-tabs ${t}`:"es-tabs",children:i.map(e=>{const i=e.id===n,r=`es-tab${e.icon?" has-icon":""}${i?" is-active":""}`;/* @__PURE__ */
|
|
4
|
-
return l("button",{type:"button",role:"tab",id:e.htmlId,title:e.label,"aria-label":e.label,"aria-selected":i,"aria-controls":e.panelId,className:r,onClick:()=>s(e.id),children:[e.icon?/* @__PURE__ */a("span",{className:"es-tab-icon","aria-hidden":"true",children:e.icon}):null,
|
|
5
|
-
/* @__PURE__ */a("span",{className:"es-tab-word",children:e.label}),"number"==typeof e.badge&&e.badge>0?/* @__PURE__ */a("span",{className:"es-tab-badge",children:e.badge}):null]},e.id)})})})}function t({checked:e,onChange:l,disabled:i,id:n,ariaLabel:s,ariaLabelledBy:r,className:t}){/* @__PURE__ */
|
|
6
|
-
return a("button",{type:"button",role:"switch",id:n,"aria-checked":e,"aria-label":s,"aria-labelledby":r,disabled:i,className:t?`es-switch ${t}`:"es-switch",onClick:()=>l(!e)})}function c(e){return Array.isArray(e)?e.some(c):n(e)}function d(e,a,l){if(!n(e)||e.type!==t)return e;const i=e.props;return i.ariaLabel||i.ariaLabelledBy?e:s(e,l?{ariaLabelledBy:l}:{ariaLabel:a})}function o({label:e,labelId:n,icon:s,value:r,hint:t,changed:o,htmlFor:u,action:h,children:b,className:m}){const p=c(b),N=c(h);if(!p&&!N)return null;const f=["es-field"];p||f.push("is-inline"),o&&f.push("is-changed"),m&&f.push(m);const g=/* @__PURE__ */l(i,{children:[s?/* @__PURE__ */a("span",{className:"es-field-icon","aria-hidden":"true",children:s}):null,
|
|
7
|
-
/* @__PURE__ */a("span",{className:"es-field-label",id:n,children:e})]});/* @__PURE__ */
|
|
8
|
-
return l("div",{className:f.join(" "),children:[
|
|
9
|
-
/* @__PURE__ */l("div",{className:"es-field-head",children:[u?/* @__PURE__ */a("label",{className:"es-field-name",htmlFor:u,children:g}):/* @__PURE__ */a("span",{className:"es-field-name",children:g}),null!=r?/* @__PURE__ */a("span",{className:"es-field-value",children:r}):null,N?d(h,e,n):null]}),p?/* @__PURE__ */a("div",{className:"es-field-ctl",children:b}):null,t?/* @__PURE__ */a("p",{className:"es-field-hint",children:t}):null]})}function u({title:e,open:i,onToggle:n,count:s,id:r,children:t,className:c}){const d=r?`${r}-body`:void 0;/* @__PURE__ */
|
|
10
|
-
return l("div",{className:c?`es-group ${c}`:"es-group",children:[
|
|
11
|
-
/* @__PURE__ */l("button",{type:"button",id:r,"aria-expanded":i,"aria-controls":d,className:"es-group-head",onClick:()=>n(!i),children:[e,"number"==typeof s&&s>0?/* @__PURE__ */a("span",{className:"es-group-count",children:s}):null,
|
|
12
|
-
/* @__PURE__ */a("span",{className:"es-group-sign","aria-hidden":"true"})]}),
|
|
13
|
-
/* @__PURE__ */a("div",{id:d,className:"es-group-body",hidden:!i,children:t})]})}var h=Object.freeze(["Content","Style","Layout","Animation"]);export{h as SETTINGS_BUCKETS,o as SettingsField,u as SettingsGroup,t as SettingsSwitch,r as SettingsTabs};
|
package/dist/chunk-6PS6STGA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{zoneKey as e}from"./chunk-KRXQM65X.js";import{useRef as t,useEffect as n,useState as r,useSyncExternalStore as o,useCallback as i}from"react";var c=56,l=16;function u(e){const t=Math.max(e,0);return t>=c?0:Math.ceil(16*(1-t/c))}function a(e,t,n){if(e<t-c||e>n+c)return 0;const r=e-t,o=n-e;return r<c&&r<=o?-u(r):o<c?u(o):0}function s(e){const t=e?.ownerDocument?.defaultView;for(let n=e?.parentElement??null;n;n=n.parentElement){const e=t?.getComputedStyle(n).overflowY;if(("auto"===e||"scroll"===e)&&n.scrollHeight>n.clientHeight)return n}return null}function f(e){const t=e?.ownerDocument?.defaultView?.getComputedStyle(e).overflowY;return e&&("auto"===t||"scroll"===t)&&e.scrollHeight>e.clientHeight?e:s(e)}function d(e){const t=e.ownerDocument,n=t.defaultView;if(!n)return()=>{};let r=null,o=0;const i=e=>{r=e.clientY},c=()=>{if(null!==r){const t=e.getBoundingClientRect(),n=a(r,t.top,t.bottom);n&&(e.scrollTop+=n)}o=n.requestAnimationFrame(c)};return t.addEventListener("dragover",i,!0),o=n.requestAnimationFrame(c),()=>{t.removeEventListener("dragover",i,!0),n.cancelAnimationFrame(o)}}function g(){let e=null,t=null;const n=/* @__PURE__ */new Set,r=()=>{if(t!==e){t=e;for(const e of[...n])e()}};return{get:()=>e,shown:()=>t,start(t){e=t,globalThis.setTimeout(r,0)},end(){null===e&&null===t||(e=null,r())},subscribe:e=>(n.add(e),()=>{n.delete(e)})}}function p(e,t,n,r){if(e.into)return{side:"into",to:e.into};return"first"===e.pinned||"last"!==e.pinned&&t>n+r/2?{side:"after",to:{...e.place,index:e.place.index+1}}:{side:"before",to:{...e.place,index:e.place.index}}}var m=(t,n)=>e(t)===e(n);function v(e,t){return m(e,t)&&(t.index===e.index||t.index===e.index+1)}function D(e,t){return m(e,t)&&e.index<t.index?t.index-1:t.index}function y(e,t){return{...e,index:t<0?e.index-1:e.index+2}}function w(e,t){if(!t)return e;const n={...t,...e};for(const[r,o]of Object.entries(e)){const e=t[r];"function"==typeof o&&"function"==typeof e&&(n[r]=t=>{o(t),e(t)})}return n}function x(c){const l=t(c);n(()=>{l.current=c});const[u]=r(()=>g()),a=c.session??u,m=o(a.subscribe,a.shown,a.shown),[D,y]=r(null),x=t(null),b=i(()=>{x.current?.(),x.current=null},[]),h=i(()=>{b(),a.end(),y(null)},[a,b]);n(()=>a.subscribe(()=>{a.get()||(b(),y(null))}),[a,b]),n(()=>b,[b]);const T=i((e,t)=>{y(n=>n&&n.key===e&&n.side===t?n:{key:e,side:t})},[]),k=i(e=>{y(t=>t&&t.key===e?null:t)},[]),E=(e,t,n,r)=>!("into"===n?r===e.key:void 0!==e.from&&v(e.from,t))&&l.current.canDrop(e.item,t);return{dragging:m?.item??null,row:(e,t)=>{const{keyOf:n,readOnly:r}=l.current,o=n(e.item),i=!r&&!e.pinned&&!1!==e.canDrag,c=t=>{const n=t.currentTarget.getBoundingClientRect();return p(e,t.clientY,n.top,n.height)},u={draggable:i||void 0,onDragStart:i?t=>{const n=t.currentTarget;a.start({key:o,item:e.item,from:e.place}),t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",o)}catch{}n.classList.add("is-lifting");const r=n.getBoundingClientRect();t.dataTransfer.setDragImage?.(n,t.clientX-r.left,t.clientY-r.top),n.ownerDocument.defaultView?.setTimeout(()=>n.classList.remove("is-lifting"),0);const i=s(n);b(),x.current=i?d(i):null}:void 0,onDragEnd:i?()=>h():void 0,onDragOver:e=>{const t=a.get();if(!t)return;const n=c(e);E(t,n.to,n.side,o)?(e.preventDefault(),e.dataTransfer.dropEffect="move",T(o,n.side)):k(o)},onDrop:e=>{const t=a.get();if(!t)return;const n=c(e);E(t,n.to,n.side,o)&&(e.preventDefault(),h(),l.current.onDrop(t.item,n.to))},onKeyDown:t=>{if("ArrowUp"!==t.key&&"ArrowDown"!==t.key)return;if(!t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;if(t.preventDefault(),t.repeat||!i)return;const{onStep:n,canStep:r}=l.current,o="ArrowUp"===t.key?-1:1;n&&!1!==r?.(e.item,o)&&n(e.item,o)}};return{draggable:i,dragging:m?.key===o,drop:D?.key===o?D.side:void 0,rowProps:w(u,t)}},seam:(t,n)=>{const r=(o=t.place,`seam:${e(o)}:${o.index}`);var o;const i={onDragOver:e=>{const n=a.get();n&&(E(n,t.place,"before",r)?(e.preventDefault(),e.dataTransfer.dropEffect="move",T(r,"before")):k(r))},onDrop:e=>{const n=a.get();n&&E(n,t.place,"before",r)&&(e.preventDefault(),h(),l.current.onDrop(n.item,t.place))}};return{drop:D?.key===r,seamProps:w(i,n)}},rootProps:e=>w({onDragEnter:e=>{if(!a.get()||x.current)return;const t=f(e.currentTarget);x.current=t?d(t):null},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||y(null)}},e)}}export{c as AUTO_SCROLL_EDGE,l as AUTO_SCROLL_MAX_SPEED,a as autoScrollDelta,u as autoScrollSpeed,g as createDragSession,p as dropOnRow,D as gapToMoveIndex,v as isNoOpDrop,f as scrollBoxOf,s as scrollParent,d as startAutoScroll,y as stepGap,x as useTreeDrag};
|
package/dist/chunk-7A7O2JWQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t={settings:"Settings",buckets:{Content:"Content",Style:"Style",Layout:"Layout",Animation:"Animation"}};export{t as DEFAULT_PANEL_WORDS};
|
package/dist/chunk-H4B72XCJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var a={dragHint:"Drag to move · ⌥↑ ⌥↓",collapse:"Collapse",expand:"Expand",collapseNamed:({label:a})=>`Collapse ${a}`,expandNamed:({label:a})=>`Expand ${a}`};export{a as DEFAULT_TREE_WORDS};
|
package/dist/chunk-JE63JHKO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_PICK_WORDS as o}from"./chunk-ZAOM6PFH.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as r}from"./chunk-6WY6ZXJG.js";import{DEFAULT_CANVAS_WORDS as t}from"./chunk-GGTPNGFJ.js";import{DEFAULT_FIELDS_WORDS as m}from"./chunk-SUO5627P.js";import{DEFAULT_TREE_WORDS as n}from"./chunk-H4B72XCJ.js";import{DEFAULT_PANEL_WORDS as c}from"./chunk-7A7O2JWQ.js";import{DEFAULT_NODE_MENU_WORDS as f}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as s,DEFAULT_NOTICE_WORDS as i}from"./chunk-KDIVA6WD.js";import{DEFAULT_LOCK_WORDS as u}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as e}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as k}from"./chunk-ZT7M24XD.js";import{DEFAULT_DRAG_WORDS as j}from"./chunk-O2NLQBFX.js";var h={notice:i,lock:u,save:p,chrome:s,rail:e,tree:n,panel:c,fields:m,pick:o,drag:j,menu:f,styleClipboard:r,copy:k,canvas:t},l=o=>"object"==typeof o&&null!==o;function a(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:l(n)?t[m]=l(c)?a(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function y(o,r){return r?a(o,r):o}export{h as DEFAULT_EDITOR_STRINGS,y as mergeEditorStrings};
|
package/dist/chunk-KDIVA6WD.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={reload:"Reload the saved version",takeOver:"Take over editing",takeBack:"Take it back",viewReadOnly:"View read-only",savedByYou:({noun:e,when:n})=>`You saved this ${e} in another tab or window ${n}.`,savedByOther:({name:e,noun:n,when:o})=>`${e} saved this ${n} ${o}.`,conflictBody:"Your last change was not saved. It is still on screen here, but this copy is out of date — copy anything you need, then reload to carry on from the saved version.",takeOverWhileDeciding:"Nobody else can save while you decide. Nothing on your screen is lost.",tookOver:({name:e,noun:n,when:o})=>`${e} took over this ${n} ${o}.`,tookOverBody:"Your changes since then are still on screen but are no longer being saved.",viewingOnly:"Viewing only.",viewingOnlyBody:({name:e,noun:n,seen:o})=>`${e} is editing this ${n} (last seen ${o}). Nothing you change here is saved.`,editing:({name:e,noun:n})=>`${e} is editing this ${n}`,editingBody:({seen:e})=>`(last seen ${e}). Nothing you change here will be saved while they are in it.`,takeOverTold:"They are told straight away and stop being able to save."},n={device:"Preview device",upLevel:"Go up one level",upLevelTo:({label:e,name:n})=>`${e} to ${n}`,resize:"Drag to resize · double-click to reset"};export{n as DEFAULT_CHROME_WORDS,e as DEFAULT_NOTICE_WORDS};
|
package/dist/chunk-MCLBHENY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{removeCanvasStyle as e,upsertCanvasStyle as n}from"./chunk-ZNCEOSXO.js";import{useState as t,useEffect as o,useRef as r}from"react";var c="[data-puck-component]",u="iframe#preview-frame";function s(e){const n=e.contentDocument;if(!n||!e.contentWindow||"loading"===n.readyState||!n.body)return!1;if(e.hasAttribute("srcdoc"))return"about:srcdoc"===n.URL;const t=e.getAttribute("src");return!t||"about:blank"===t||"about:blank"!==n.URL}function i(e,n,{selector:t=u,readySelector:o}={}){let r=null,c=null,i=!1,l=!1,d=null;const a=()=>{d?.observer.disconnect(),d=null},m=()=>{if(l)return;let e=null;if(r&&s(r)){const n=r.contentDocument;(e=>{if(!o||e.querySelector(o))return a(),!0;if(d?.doc!==e){a();const n=e.defaultView?.MutationObserver;if(n){const t=new n(()=>m());t.observe(e,{childList:!0,subtree:!0}),d={doc:e,observer:t}}}return!1})(n)&&(e={frame:r,document:n,window:r.contentWindow})}else a();(e===c||!!e&&!!c&&e.frame===c.frame&&e.document===c.document)&&i||(i=!0,c=e,n(c))},f=()=>m(),v=()=>{const n=e.querySelector?.(t);n!==r?(r?.removeEventListener("load",f),r=n,r?.addEventListener("load",f),m()):m()},b=e.ownerDocument?.defaultView??e.defaultView,w=b?.MutationObserver,E=w?new w(e=>(e=>null!==r&&!r.isConnected||e.some(e=>[...e.addedNodes,...e.removedNodes].some(e=>"IFRAME"===e.nodeName||!!e.querySelector?.("iframe"))))(e)&&v()):null;return E?.observe(e,{childList:!0,subtree:!0}),v(),()=>{l=!0,E?.disconnect(),a(),r?.removeEventListener("load",f),r=null}}function l(e,{selector:n,readySelector:r}={}){const[c,u]=t(null);return o(()=>{const t=e.current;if(!t)return;const o=i(t,u,{selector:n,readySelector:r});return()=>{o(),u(null)}},[e,n,r]),c}function d(e,n,t,{on:c="document",capture:u=!1}={}){const s=r(t);s.current=t;const i=e?.document??null,l=e?.window??null;o(()=>{const e="window"===c?l:i;if(!e)return;const t=e=>s.current(e);return e.addEventListener(n,t,u),()=>e.removeEventListener(n,t,u)},[i,l,n,c,u])}function a(t,r,c){const u=t?.document??null;o(()=>{if(!u)return;if(!c)return void e(u,r);const t=n(u,r,c),o=u.defaultView?.MutationObserver,s=o?new o(()=>{t.isConnected||n(u,r,c)}):null;return s?.observe(u.head??u.documentElement,{childList:!0}),()=>{s?.disconnect(),e(u,r)}},[u,r,c])}function m(e,{settle:n=[150,450]}={}){const[r,c]=t(0),u=e?.frame??null,s=e?.document??null,i=e?.window??null,l=n.join(",");return o(()=>{if(!u||!s||!i)return;const e=u.ownerDocument.defaultView;let t=!1,o=0;const r=()=>{if(t)return;t=!0;const n=()=>{t=!1,c(e=>e+1)};e?.requestAnimationFrame?o=e.requestAnimationFrame(n):n()},l=[],d=(e,n)=>{e.addEventListener(n,r,!0),l.push(()=>e.removeEventListener(n,r,!0))};d(s,"scroll"),d(i,"resize"),e&&(d(e,"scroll"),d(e,"resize"));const a=e?.ResizeObserver;if(a){const e=new a(r);e.observe(u),s.documentElement&&e.observe(s.documentElement),l.push(()=>e.disconnect())}const m=s.defaultView?.MutationObserver,f=s.body??s.documentElement;if(m&&f){const e=new m(r);e.observe(s===u.ownerDocument?u:f,{childList:!0,subtree:!0}),l.push(()=>e.disconnect())}const v=s.fonts;v&&d(v,"loadingdone");const b=n.map(e=>setTimeout(r,e));return r(),()=>{for(const e of l)e();for(const e of b)clearTimeout(e);o&&e?.cancelAnimationFrame&&e.cancelAnimationFrame(o)}},[u,s,i,l]),r}export{c as BLOCK_SELECTOR,u as CANVAS_SELECTOR,s as isFrameReady,d as useCanvasEvent,l as useCanvasFrame,m as useCanvasLayout,a as useCanvasStyle,i as watchCanvasFrame};
|
package/dist/chunk-QB3BZIRA.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{wordFitVars as e}from"./chunk-BZ5ASXOL.js";import{jsx as a,jsxs as s}from"react/jsx-runtime";function i({options:i,value:l,onChange:n,ariaLabel:t,fit:r,disabled:d=!1,className:o}){const c=r&&e(i.length,r);
|
|
2
|
-
/* @__PURE__ */
|
|
3
|
-
return a("div",{className:"es-segs-fit",children:/* @__PURE__ */a("div",{role:"group","aria-label":t,"data-disabled":d||void 0,className:`es-segs${c?" is-measured":""}${o?` ${o}`:""}`,style:c,children:i.map(e=>{const i=e.id===l,t=e.title??("string"==typeof e.label?e.label:void 0),r=d||!0===e.disabled,o=`es-seg${e.icon?" has-icon":""}${i?" is-active":""}`;/* @__PURE__ */
|
|
4
|
-
return s("button",{type:"button",title:t,"aria-label":t,"aria-pressed":i,disabled:r,className:o,onClick:()=>n(e.id),children:[e.icon?/* @__PURE__ */a("span",{className:"es-seg-icon","aria-hidden":"true",children:e.icon}):null,
|
|
5
|
-
/* @__PURE__ */a("span",{className:"es-seg-word",children:e.label})]},String(e.id))})})})}export{i as SettingsSegmented};
|
package/dist/chunk-SJQG5ENJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};function t(e){return/^[a-z][a-z0-9-]*$/.test(e)}function n(e,t){const n=/^\{(underline|sup|sub|color=([a-z][a-z0-9-]*))\}/.exec(e.slice(t,t+64));return n?void 0===n[2]?{kind:n[1],length:n[0].length}:{kind:"color",color:n[2],length:n[0].length}:null}var l={bold:e.bold.placeholder,italic:e.italic.placeholder,strike:e.strike.placeholder,code:e.code.placeholder,highlight:e.highlight.placeholder,quiet:e.quiet.placeholder,link:"link text",underline:e.underline.placeholder,sup:e.sup.placeholder,sub:e.sub.placeholder,color:"colored text"},o={bullet:()=>"- ",number:e=>`${e+1}. `,quote:()=>"> "};function r(t,n,r,i,c=p,u=l){if("clear"===i)return M(t,n,r,c);const a=t.slice(n,r);if("link"===i){const e=a||u.link,l=`[${e}](https://)`;return{text:t.slice(0,n)+l+t.slice(r),selectionStart:n+e.length+3,selectionEnd:n+l.length-1}}const d=o[i];if(d){const e=t.lastIndexOf("\n",Math.max(n-1,0))+1,l=t.indexOf("\n",r),o=-1===l?t.length:l,i=t.slice(e,o).split("\n"),s=i.every((e,t)=>e.startsWith(d(t))),c=i.map((e,t)=>s?e.slice(d(t).length):d(t)+e).join("\n");return{text:t.slice(0,e)+c+t.slice(o),selectionStart:e,selectionEnd:e+c.length}}const{open:h,close:f}=e[i],k=i,g=u[k]??l[k];if(s(t,n,r,i))return{text:t.slice(0,n-h.length)+a+t.slice(r+f.length),selectionStart:n-h.length,selectionEnd:n-h.length+a.length};const m=a||g;return{text:t.slice(0,n)+h+m+f+t.slice(r),selectionStart:n+h.length,selectionEnd:n+h.length+m.length}}function i(e,o,r,i,s=l){const c={text:e,selectionStart:o,selectionEnd:r};if(null!==i&&!t(i))return c;const u=e.slice(o,r),a=o>=1&&"["===e[o-1]&&"]"===e[r]?n(e,r+1):null;if("color"===a?.kind){const t=o-1,n=e.slice(r+1+a.length);return null===i?{text:e.slice(0,t)+u+n,selectionStart:t,selectionEnd:t+u.length}:{text:`${e.slice(0,r)}]{color=${i}}${n}`,selectionStart:o,selectionEnd:r}}if(null===i)return c;const d=u||(s.color??l.color);return{text:`${e.slice(0,o)}[${d}]{color=${i}}${e.slice(r)}`,selectionStart:o+1,selectionEnd:o+1+d.length}}function s(t,n,l,o){const r=e[o];if(!r)return!1;const{open:i,close:s}=r;return n>=i.length&&t.slice(n-i.length,n)===i&&t.slice(l,l+s.length)===s}function c(e,t,n){const l=0===t?0:e.lastIndexOf("\n",t-1)+1;for(let o=e.lastIndexOf("[",t);o>=l;o=0===o?-1:e.lastIndexOf("[",o-1)){const t=$(e,o);if(t&&n<=t.end)return{start:o,end:t.end,label:t.label,href:t.href}}return null}function u(e,t,n,l){const o=c(e,t,n),r=o?o.start:t,i=o?o.end:n,s=`[${o?o.label:e.slice(t,n)||l}](${l})`,u=r+s.length;return{text:e.slice(0,r)+s+e.slice(i),selectionStart:u,selectionEnd:u}}function a(e,t){return{text:e.slice(0,t.start)+t.label+e.slice(t.end),selectionStart:t.start,selectionEnd:t.start+t.label.length}}var d=[{style:"bold",label:"B",name:"Strong",title:"Strong · **words** · ⌘B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic · _words_ · ⌘I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough · ~~words~~"},{style:"highlight",label:"◆",name:"Emphasis",title:"Emphasis · ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet · ^^words^^"},{style:"code",label:"‹›",name:"Code",title:"Code"},{style:"link",label:"🔗",name:"Link",title:"Link · [words](https://…) · ⌘K",shortcut:"k"},{style:"bullet",label:"•",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"❝",name:"Quote",title:"Quote"},{style:"clear",label:"T×",name:"Clear marks",title:"Clear marks · ⌘⇧X",shortcut:"shift+x"}],h={bold:"Strong",highlight:"Emphasis",quiet:"Quiet"};function f(e){return d.filter(t=>e.includes(t.style))}var p=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold"}],k=d.map(e=>e.style).filter(e=>p.some(t=>t.kind===e)),g=[...p,{open:"*",close:"*",kind:"accent"}],m=[...p,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];function b(e){return!/\s/.test(e)&&!/[!-\/:-@[-`{-~]/.test(e)}function x(e,t){const n=[];let l="",o=0;for(;o<e.length;){const r=S(e,o,t);r?(n.push({kind:"text",text:l}),l="",n.push({kind:r.rule.kind,text:r.inner}),o=r.end):(l+=e[o],o+=1)}return n.push({kind:"text",text:l}),n}function S(e,t,l){for(const o of l){if(!e.startsWith(o.open,t))continue;if(o.wordBoundary&&t>0&&b(e[t-1]))continue;const l=t+o.open.length,r=e.indexOf(o.close,l);if(r<l+1)continue;const i=e.slice(l,r);if(i.includes(o.close[0]))continue;if(i.includes("\n"))continue;const s=r+o.close.length,c=e[s];if((!o.notBefore||void 0===c||!o.notBefore.includes(c))&&!(o.notBeforeBlock&&n(e,s)||o.wordBoundary&&void 0!==c&&b(c)))return{rule:o,inner:i,end:s}}return null}function y(e,t){return x(e,t).map(e=>e.text).join("")}var v=["http","https","mailto","tel"];function E(e){if(""===e||/[\s\u0000-\u001f\u007f]/.test(e))return!1;const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||v.includes(t[1].toLowerCase())}function $(e,t){if("["!==e[t])return null;const n=e.indexOf("]",t+1);if(n<t+2||"("!==e[n+1])return null;const l=e.slice(t+1,n);if(l.includes("["))return null;const o=e.indexOf(")",n+2);if(-1===o)return null;const r=e.slice(n+2,o);return E(r)?{label:l,href:r,end:o+1}:null}function B(e,t){if("["!==e[t])return null;let l=0;for(let o=t;o<e.length;o+=1){const r=e[o];if("\n"===r)return null;if("["===r)l+=1;else if("]"===r){if(l-=1,l>0)continue;if(o===t+1)return null;const r=n(e,o+1);return r?{kind:r.kind,color:r.color,label:e.slice(t+1,o),close:e.slice(o,o+1+r.length),end:o+1+r.length}:null}}return null}var w=4;function q(e,t,n){const l=[];let o="";const r=()=>{o&&l.push({kind:"text",text:o}),o=""},i=e=>n+1<w?q(e,t,n+1):[{kind:"text",text:e}];let s=0;for(;s<e.length;){const n=$(e,s);if(n){r(),l.push({kind:"link",href:n.href,children:i(n.label)}),s=n.end;continue}const c=B(e,s);if(c){r(),l.push({kind:c.kind,open:"[",close:c.close,...void 0===c.color?{}:{color:c.color},children:i(c.label)}),s=c.end;continue}const u=S(e,s,t);u?(r(),l.push({kind:u.rule.kind,open:u.rule.open,close:u.rule.close,children:i(u.inner)}),s=u.end):(o+=e[s],s+=1)}return r(),l}function O(e,t){return e.split("\n").map(e=>{const{bullet:n,number:l,rest:o}=function(e){if(e.startsWith("- ")&&""!==e.slice(2).trim())return{bullet:!0,number:null,rest:e.slice(2)};const t=/^([0-9]{1,3})\. /.exec(e);return t&&""!==e.slice(t[0].length).trim()?{bullet:!1,number:t[1],rest:e.slice(t[0].length)}:{bullet:!1,number:null,rest:e}}(e);return{bullet:n,number:l,children:q(o,t,0)}})}function I(e){return null!=e.number?`${e.number}. `:e.bullet?"- ":""}function z(e){return e.map(e=>"text"===e.kind?e.text:"link"===e.kind?`[${z(e.children)}](${e.href})`:e.open+z(e.children)+e.close).join("")}function _(e){return e.map(e=>I(e)+z(e.children)).join("\n")}function C(n,l,o){if("link"===l)return void 0===o?null:{id:n,kind:"link",open:"[",close:`](${o})`,href:o};if("color"===l)return void 0!==o&&t(o)?{id:n,kind:"color",open:"[",close:`]{color=${o}}`,color:o}:null;const r=e[l];return r&&"code"!==l?{id:n,kind:l,open:r.open,close:r.close}:null}function Q(e,t){let n=0,l=0;return e.split("\n").map(e=>{const[o]=O(e,t);let r=l+I(o).length;l+=e.length+1;const i=[],s=(e,t)=>{for(const l of e){if("text"===l.kind){for(const e of l.text)i.push({ch:e,marks:t,at:r}),r+=e.length;continue}const e="link"===l.kind?C(++n,"link",l.href):{id:++n,kind:l.kind,open:l.open,close:l.close,...void 0===l.color?{}:{color:l.color}};r+=e.open.length,s(l.children,[...t,e]),r+=e.close.length}};return s(o.children,[]),{bullet:o.bullet,number:o.number??null,chars:i}})}function j(e){let t="";const n=[];return e.forEach((e,l)=>{l>0&&(t+="\n"),t+=I(e);const o=[],r=[];for(const n of e.chars){let e=0;for(;e<o.length&&e<n.marks.length&&o[e].id===n.marks[e].id;)e+=1;for(;o.length>e;)t+=o.pop().close;for(let l=e;l<n.marks.length;l+=1)t+=n.marks[l].open,o.push(n.marks[l]);r.push(t.length),t+=n.ch}for(;o.length>0;)t+=o.pop().close;n.push(r)}),{text:t,at:n}}function L(e,t){return e.length===t.length&&e.every((e,n)=>{const l=t[n];return e.bullet===l.bullet&&(e.number??null)===(l.number??null)&&(e.chars.length===l.chars.length&&e.chars.every((e,t)=>{const n=l.chars[t];return e.ch===n.ch&&e.marks.length===n.marks.length&&e.marks.every((e,t)=>e.kind===n.marks[t].kind&&e.href===n.marks[t].href&&e.color===n.marks[t].color)}))})}function M(e,t,n,l=p){const o=Q(e,l),r=o.flatMap(e=>e.chars),i={text:e,selectionStart:t,selectionEnd:n},s=e=>o.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:t.marks.filter(n=>"link"===n.kind||!e(t,n))}))})),c=e=>{const t=j(e);return L(e,Q(t.text,l))?t:null},u=(e,t)=>{let n=r.indexOf(t);for(let t=0;t<e.at.length;t+=1){if(n<e.at[t].length)return e.at[t][n];n-=e.at[t].length}return 0};if(t===n){const e=[...r].reverse().find(e=>e.at<t),n=r.find(e=>e.at>=t),l=new Set([...e?.marks??[],...n?.marks??[]].map(e=>e.id));if(![...l].some(e=>r.some(t=>t.marks.some(t=>t.id===e&&"link"!==t.kind))))return i;const o=c(s((e,t)=>l.has(t.id)));if(!o)return i;const a=n?u(o,n):e?u(o,e)+e.ch.length:0;return{text:o.text,selectionStart:a,selectionEnd:a}}const a=new Set(r.filter(e=>e.at>=t&&e.at<n));if(0===a.size)return i;const d=new Set([...a].flatMap(e=>e.marks.map(e=>e.id))),h=c(s(e=>a.has(e)))??c(s((e,t)=>d.has(t.id)));if(!h)return i;const f=r.find(e=>a.has(e)),k=[...r].reverse().find(e=>a.has(e));return{text:h.text,selectionStart:u(h,f),selectionEnd:u(h,k)+k.ch.length}}export{m as CAMPAIGN_MARKUP,k as COPY_FIELD_TOOLS,d as MARKUP_TOOLS,h as MARK_NAMES,l as MARK_PLACEHOLDERS,p as STANDARD_MARKUP,g as STOREFRONT_MARKUP,i as applyColor,r as applyMark,M as clearMarks,c as findLink,t as isColorName,E as isSafeLinkHref,s as markedAt,Q as markedLines,f as markupTools,O as parseMarkup,a as removeLink,L as sameMarks,_ as serializeMarkup,C as spanFor,y as stripInline,x as tokenizeInline,u as writeLink,j as writeMarkedLines};
|
package/dist/chunk-SUO5627P.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={less:"Less",more:"More",choose:"Choose…",list:{item:"item",itemName:({noun:e,n:t})=>{return`${o=e,o?o[0].toUpperCase()+o.slice(1):o} ${t}`;var o},position:({n:e,total:t})=>`${e} of ${t}`,duplicate:"Duplicate",duplicateItem:({noun:e})=>`Duplicate ${e}`,deleteItem:({noun:e})=>`Delete ${e}`,add:({noun:e})=>`+ Add ${e}`,addHere:({noun:e})=>`Add ${e} here`}};export{e as DEFAULT_FIELDS_WORDS};
|
package/dist/chunk-ZT7M24XD.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"./chunk-SJQG5ENJ.js";var i={formatting:"Formatting",alignment:"Alignment",align:{left:"Left",center:"Center",right:"Right",justify:"Justify"},link:{title:"Link",label:"Link to",placeholder:"https://… or /page",refused:"Use a web address (https://…), a page on this site (/…), mailto: or tel:.",remove:"Remove link",apply:"Apply"},marks:Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),placeholders:t};export{i as DEFAULT_COPY_WORDS};
|
package/dist/editor/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_CANVAS_WORDS as e}from"../chunk-GGTPNGFJ.js";import{useResolvedFields as t}from"../chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r}from"../chunk-D2BCHTQR.js";import{useWords as i}from"../chunk-MFIRYGHW.js";import{setCanvasNonce as a}from"../chunk-ZNCEOSXO.js";import{find as s,ROOT_ID as l,getList as d,remove as c,parseZoneKey as u,move as p,duplicate as h,replaceNode as f,createNode as m,insert as v,normalizeData as y,createResolveCache as g,resolveNodeData as k,ROOT_SLOT as b}from"../chunk-KRXQM65X.js";import{topLevelSlotKeys as w,fieldsFrom as S,defaultsFrom as I}from"../chunk-NKB3KVAB.js";import{createContext as C,useEffect as x,useContext as O,useRef as D,useSyncExternalStore as E,useState as A,useLayoutEffect as z,useMemo as M,useCallback as Z}from"react";import{jsx as $,jsxs as R}from"react/jsx-runtime";import{createPortal as N}from"react-dom";function B(e){return!["setData","setUi","set"].includes(e.type)}var P=(e,t,n,o)=>{const r=d(e,t,u(n));return r?.[o]??null},j=(e,t,n,o,r)=>{const i=P(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function K(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 L(e,t,n){return n?"node"===n.kind?s(e,t,n.id)?n:null:n.parentId===l?d(e,t,n)?n:null:s(e,t,n.parentId)&&d(e,t,n)?n:null:null}function F(e,t,n,r=!1){const{itemSelector:i,selectedSlot:a,...s}=n;let l=e.selection;var d;return"itemSelector"in n&&(l=o(e.data,t,i??null)),"selectedSlot"in n&&(a?l=(d=a)?{kind:"slot",parentId:d.parentId,slot:d.slot}:null:"slot"===l?.kind&&(l=null)),{...e,selection:l,ui:r?s:{...e.ui,...s}}}function H(e,t,n){const o=V(e,t,n);if(o===e)return e;const r=L(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function V(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 F(e,n,"function"==typeof t.ui?t.ui(K(e,n)):t.ui);case"set":{const r={data:o,ui:K(e,n)},i="function"==typeof t.state?t.state(r):t.state;let a=i.data?{...e,data:i.data}:e;return i.ui&&(a=F(a,n,i.ui,!0)),a}case"insert":{const r={...u(t.destinationZone),index:t.destinationIndex},i=m(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:v(o,n,r,i)}}case"replace":{const r=j(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:f(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=j(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=h(o,n,r.props.id),a=P(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:a?{kind:"node",id:a.props.id}:e.selection}}case"reorder":return V(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=P(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...u(t.destinationZone),index:t.destinationIndex};return{...e,data:p(o,n,r.props.id,i)}}case"remove":{const r=j(o,n,t.zone,t.index,"remove");return{...e,data:c(o,n,r.props.id)}}default:return e}}var T={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},q={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},G=0,Y=()=>`history-${G+=1}`;function U(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let a=e.permissions??{};const l=y(e.data,t);let c={data:l,selection:null,ui:{...q}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;c={data:l,selection:r?{kind:"slot",...r}:o(l,t,n??null),ui:{...q,...i}}}let u=[{core:c,at:-1/0,sealed:!0,id:Y()}],p=0;const h=e=>{const t=u[p],n=r();!e&&p===u.length-1&&p>0&&!t.sealed&&n-t.at<i?u=[...u.slice(0,p),{...t,core:c,at:n}]:(u=[...u.slice(0,p+1),{core:c,at:n,sealed:e,id:Y()}],p=u.length-1)},m=/* @__PURE__ */new Set;let v=null,b=null,w=0,S=null,I=!1;const C=()=>{for(const e of[...m])e()},x=()=>{u=[...u.slice(0,p),{...u[p],core:c},...u.slice(p+1)]},O=(t,n)=>{w>0?I=I||n:(n?h(!1):c!==t&&x(),c.data!==t.data&&e.onChange?.(c.data),c!==t&&C())},D=e=>{const n=c;if(c=H(c,e,t),c===n)return;const o=e.recordHistory??B(e);O(n,o&&c.data!==n.data)},E=t=>{0===w&&(S=c,I=!1),w+=1;try{t()}catch(e){throw w-=1,0===w&&S&&(c=S,S=null),e}if(w-=1,w>0||!S)return;const n=S;S=null,I&&c.data!==n.data?h(!0):c!==n&&x(),c.data!==n.data&&e.onChange?.(c.data),c!==n&&C()},A=e=>{const n=c,o=L(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},O(n,!1))},z=t=>{const n=c;p=t,c=u[p].core,c.data!==n.data&&e.onChange?.(c.data),c!==n&&C()},M=(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...T,...a,...n}},Z=g(),$={resolveCache:Z,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()],[a,...l]=await Promise.all([k(r,t,{cache:Z,trigger:e,metadata:n}),...i.map(o=>k(o,t,{cache:Z,trigger:e,metadata:n}))]);E(()=>{const e=c;let n=c.data;l.forEach((e,r)=>{if(!e.didChange)return;const a=i[r].props.id,l=s(n,t,a)?.node;l&&l===s(o,t,a)?.node&&(n=f(n,t,a,e.node))}),a.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:a.node.props,readOnly:a.node.readOnly??n.root.readOnly}}),n!==c.data&&(c={...c,data:n,selection:L(n,t,c.selection)},O(e,!1))})},get config(){return t},getState(){if(v&&b===c)return v;const e=c,o={data:e.data,ui:K(e,t)},r="node"===e.selection?.kind?s(e.data,t,e.selection.id)?.node??null:null;return v={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:D,history:{back:()=>$.undo(),forward:()=>$.redo(),hasPast:p>0,hasFuture:p<u.length-1,histories:u.map(e=>({id:e.id,state:{data:e.core.data,ui:K(e.core,t)}})),index:p,setHistoryIndex:e=>{e>=0&&e<u.length&&e!==p&&z(e)}},getPermissions:M,getItemById:n=>s(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return d(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}},b=e,v},subscribe:e=>(m.add(e),()=>{m.delete(e)}),dispatch:D,batch:E,select:e=>A(e?{kind:"node",id:e}:null),selectSlot:e=>A(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){E(()=>{const n=c,o=void 0===e.select?c.selection:e.select;c={...c,data:e.data,selection:L(e.data,t,o)},O(n,e.data!==n.data)})},load(e,n={}){const o=c,r=y(e,t);c={...c,data:r,selection:L(r,t,n.selection??c.selection)},n.keepHistory||(u=[{core:c,at:-1/0,sealed:!0,id:Y()}],p=0),c!==o&&C()},undo(){p>0&&z(p-1)},redo(){p<u.length-1&&z(p+1)},setPermissions(e){a=e,v=null,C()},setConfig(e){e!==t&&(t=e,v=null,C())}};return $}function W(e,t){const n=e=>{if(e.altKey)return;e.metaKey!==e.ctrlKey&&("KeyZ"===e.code?(e.preventDefault(),e.shiftKey?t.redo():t.undo()):"KeyY"!==e.code||e.shiftKey||(e.preventDefault(),t.redo()))};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)}var X=C(null);function Q({editor:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return x(()=>{n&&e.resolveAll()},[e,n]),x(()=>{if(t&&"undefined"!=typeof document)return W(document,e)},[e,t]),/* @__PURE__ */$(X.Provider,{value:e,children:o})}function J(){const e=O(X);if(!e)throw new Error("useEditor: no <EditorProvider> above this component");return e}function _(e){const t=J(),n=D({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 E(t.subscribe,o,o)}function ee(){return function(e){return _(e)}}var te="data-puck-component",ne="data-puck-dropzone",oe={},re="data-es-mirror";function ie(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${re}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(re,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function ae({children:t,id:n="preview-frame",title:o,className:r,style:s,mirrorStyles:l=!0,onDocument:d,height:c="auto",nonce:u}){const p=i("canvas",e),h=D(null),[f,m]=A(null);return z(()=>{const e=h.current,t=f?.ownerDocument.defaultView;if("auto"!==c||!e||!f||!t)return;const n=()=>{e.style.height=`${Math.ceil(f.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(f),()=>r?.disconnect()},[f,c]),z(()=>{let e=h.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=h.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===c&&t.classList.add("es-frame-fill"),e.body.appendChild(t),a(e,u),m(t),d?.(e);let n=null;const o=h.current?.ownerDocument;if(l&&o){ie(o,e,u);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>ie(o,e,u)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),m(null),d?.(null)}},[]),/* @__PURE__ */$("iframe",{ref:h,id:n,title:o??p.frame,className:r,style:{border:0,width:"100%",display:"block",..."fill"===c?{height:"100%"}:null,...s},children:f?N(t,f):null})}var se=C(null),le=C(oe),de=[];function ce({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128}){const i=J(),a=_(n=>d(n.appState.data,i.config,{parentId:e,slot:t})??de),s=_(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==l),c=_(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),u=O(se),p=["es-zone"];return a.length&&p.push("has-children"),e===l&&p.push("is-root"),(s||c)&&p.push("is-area-selected"),null!==u&&u===e&&e!==l&&p.push("is-hovering-area"),n&&p.push(n),/* @__PURE__ */$("div",{className:p.join(" "),[ne]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`},children:a.map(e=>/* @__PURE__ */$(he,{node:e},e.props.id))})}function ue(e,t,n,o){const r="root"===t?e.root:e.components[t],i={...o};for(const e of w(S(r)))i[e]=function(t={}){/* @__PURE__ */
|
|
2
|
-
return $(ce,{parentId:n,slot:e,...t})};return i}function pe(e){return function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
-
return $(ce,{parentId:e,slot:t,...n})}}function he({node:e}){const t=J().config,n=t.components[e.type],o=e.props.id,r=function(e){const t=D(null);return M(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(te),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(te,e),n.setAttribute("data-puck-dnd",e),n.style.position="relative")},[e])}(o),i=O(le);if(!n?.render)return null;const a=n.render,s=ue(t,e.type,o,{...I(n),...e.props}),l={renderDropZone:pe(o),isEditing:!0,dragRef:n.inline?r:null,metadata:{...i,...n.metadata}};return n.inline?/* @__PURE__ */$(a,{...s,puck:l,editMode:!0}):/* @__PURE__ */$("div",{[te]:o,"data-puck-dnd":o,style:{position:"relative"},children:/* @__PURE__ */$(a,{...s,puck:l,editMode:!0})})}function fe({metadata:e}){const t=_(e=>e.config),n=_(e=>e.appState.data.root).props??{},o=t.root?.render,r=/* @__PURE__ */$(ce,{parentId:l,slot:b}),i=o?/* @__PURE__ */$(o,{id:"puck-root",...ue(t,"root",l,n),puck:{renderDropZone:pe(l),isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:r}):r;/* @__PURE__ */
|
|
4
|
-
return $(le.Provider,{value:e??oe,children:i})}function me({id:e,kind:t,overlay:n}){const o=D(null),[r,i]=A(null);z(()=>{const t=o.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!e)return void i(null);let r=0;const a=()=>{r=0;const a=function(e,t){if(!e||!t)return null;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(t.querySelector(`[${te}="${n.CSS?.escape?n.CSS.escape(e):e}"]`),o.current?.parentElement??null);i(e=>{return(t=e)===(n=a)||t&&n&&t.top===n.top&&t.left===n.left&&t.width===n.width&&t.height===n.height?e:a;var t,n})},s=()=>{r||(r=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(a))};a();const l="MutationObserver"in n?new n.MutationObserver(s):null;l?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const d="ResizeObserver"in n?new n.ResizeObserver(s):null;return d?.observe(t.documentElement),n.addEventListener("resize",s),()=>{l?.disconnect(),d?.disconnect(),n.removeEventListener("resize",s),r&&(n.cancelAnimationFrame??n.clearTimeout)(r)}},[e]);const a=/* @__PURE__ */$("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}`,style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height}:{display:"none"}});return n&&e?/* @__PURE__ */$(n,{componentId:e,kind:t,children:a}):a}function ve({frame:e=!0,className:t,style:n,metadata:o,mirrorStyles:r,onDocument:i,height:a,title:s,nonce:l,frameWrapper:d,overlay:c,children:u}){const p=J(),[h,f]=A(void 0),m=_(e=>"node"===e.selection?.kind?e.selection.id:null),[v,y]=A(null),g=/* @__PURE__ */R("div",{className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;t.closest?.("a[href]")&&e.preventDefault();const n=t.closest?.(`[${te}]`);n?p.select(n.getAttribute(te)):t.hasAttribute?.(ne)||p.select(null)},onMouseOver:e=>{const t=e.target.closest?.(`[${te}]`),n=t?.getAttribute(te)??null;n!==v&&y(n)},onMouseLeave:()=>y(null),children:[
|
|
5
|
-
/* @__PURE__ */$(se.Provider,{value:v,children:/* @__PURE__ */$(fe,{metadata:o})}),
|
|
6
|
-
/* @__PURE__ */R("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
7
|
-
/* @__PURE__ */$(me,{id:v&&v!==m?v:null,kind:"hover",overlay:c}),
|
|
8
|
-
/* @__PURE__ */$(me,{id:m,kind:"selected",overlay:c})]}),u]}),k=d?/* @__PURE__ */$(d,{document:h,children:g}):g,b=D(null);/* @__PURE__ */
|
|
9
|
-
return $("div",{className:"es-canvas"+(t?` ${t}`:""),style:n,"data-puck-preview":"",children:e?/* @__PURE__ */$(ae,{mirrorStyles:r,onDocument:e=>{b.current?.(),b.current=e?W(e,p):null,f(e??void 0),i?.(e)},height:a,title:s,nonce:l,children:k}):/* @__PURE__ */$("div",{id:"preview-frame","data-puck-entry":"",children:k})})}function ye(e={}){const t=J(),n=_(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function ge(){const e=J(),n=_(e=>e.config),o=e.resolveCache,r=_(e=>e.selectedItem),i=_(e=>e.appState.data.root),a=r?r.props.id:"root",l=i.props??{},d=M(()=>r||{type:"root",props:l},[r,l]),c=r?n.components[r.type]:n.root,u=e.getState(),p=r?s(u.appState.data,n,a):null,h=p&&"root"!==p.place.parentId?p.place.parentId:null,f=h?u.getItemById(h)??null:null,{fields:m}=t({id:a,node:d,block:c,parent:f,appState:u.appState}),v=u.getPermissions(r?{item:r}:{root:!0}),y=Z((t,r)=>{(async()=>{const i=e.getState();if("root"!==a){const s=i.getItemById(a),l=i.getSelectorForId(a);if(!s||!l)return;const d={...s,props:{...s.props,[t]:r}},{node:c}=await k(d,n,{cache:o,trigger:"replace"}),u=e.getState().getSelectorForId(a);if(!u)return;return void e.dispatch({type:"replace",destinationZone:u.zone??"root:default-zone",destinationIndex:u.index,data:c})}const s=i.appState.data.root.props??{},{node:l}=await k({type:"root",props:{...s,[t]:r}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:l.props,readOnly:l.readOnly},recordHistory:!0})})()},[e,n,o,a]);return{id:a,node:d,fields:m,values:d.props,readOnly:!1===v.edit,onChange:y}}export{ae as CanvasFrame,q as DEFAULT_UI,fe as EditDocument,ve as EditorCanvas,Q as EditorProvider,W as bindUndoKeys,U as createEditor,ee as createUseEditor,B as recordsByDefault,H as reduce,K as uiView,_ as useEditor,J as useEditorApi,ye as useEditorNodeOps,ge as useSelectedFields,L as validSelection};
|
|
File without changes
|