efficient-easel 11.2.0 → 11.8.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.
Files changed (121) hide show
  1. package/README.md +20 -41
  2. package/dist/{canvas-typing-DvoqQINU.d.ts → canvas-typing-CC0wA-ys.d.ts} +16 -105
  3. package/dist/chrome/chrome.css +5 -5
  4. package/dist/{chunk-66LWADFP.js → chunk-2XMHLXMA.js} +1 -1
  5. package/dist/chunk-33C6ALT5.js +1 -0
  6. package/dist/{chunk-XJCMEEBH.js → chunk-36LVP5WD.js} +7 -7
  7. package/dist/{chunk-SJPKSE5G.js → chunk-5IUS6PM6.js} +12 -12
  8. package/dist/{chunk-FPAVNX3Y.js → chunk-5XUMLKQF.js} +3 -3
  9. package/dist/{chunk-PPL7GB7D.js → chunk-62VPYC7F.js} +1 -1
  10. package/dist/chunk-643PVCEG.js +1 -0
  11. package/dist/{chunk-TWFM6GNK.js → chunk-6IT5H37Y.js} +1 -1
  12. package/dist/{chunk-AFSSKGTD.js → chunk-6TJ2CIMY.js} +1 -1
  13. package/dist/{chunk-4ACVXF5V.js → chunk-7BRKNQF7.js} +1 -1
  14. package/dist/chunk-A6PY6C3C.js +1 -0
  15. package/dist/{chunk-XWK7WZQS.js → chunk-ATF2T5CI.js} +1 -1
  16. package/dist/chunk-AYWN5NRH.js +1 -0
  17. package/dist/chunk-DE35IQ4T.js +57 -0
  18. package/dist/{chunk-PPHUWGLZ.js → chunk-EC2I7SIY.js} +1 -1
  19. package/dist/{chunk-DGAXQTDW.js → chunk-FHLYUIJJ.js} +1 -1
  20. package/dist/{chunk-65Z5FSAW.js → chunk-G3GWAP5R.js} +5 -5
  21. package/dist/{chunk-2FZJWH24.js → chunk-H4UMY7QF.js} +1 -1
  22. package/dist/chunk-H6IXH4A3.js +1 -0
  23. package/dist/{chunk-EXKKLTXH.js → chunk-HRUMNRYI.js} +1 -1
  24. package/dist/chunk-JHYKRGRA.js +5 -0
  25. package/dist/chunk-JRRYFSCY.js +5 -0
  26. package/dist/chunk-KEWQZYUF.js +7 -0
  27. package/dist/{chunk-IFS5P7CO.js → chunk-LZS7JZK5.js} +1 -1
  28. package/dist/{chunk-FGJSCWUN.js → chunk-NY7HHUGB.js} +2 -2
  29. package/dist/chunk-PS5BWS4I.js +2 -0
  30. package/dist/{chunk-47RGVCPH.js → chunk-QFVRMARS.js} +12 -12
  31. package/dist/chunk-TBF5CVPA.js +1 -0
  32. package/dist/{chunk-26GHWMNN.js → chunk-UBAYMWCX.js} +19 -19
  33. package/dist/chunk-UMDQ6CLQ.js +2 -0
  34. package/dist/{chunk-ZXGQT75B.js → chunk-URC5Y5G2.js} +1 -1
  35. package/dist/chunk-VVPZMWJE.js +1 -0
  36. package/dist/chunk-WRFD4EXD.js +1 -0
  37. package/dist/chunk-YHZSBL2N.js +1 -0
  38. package/dist/copy/copy.css +8 -108
  39. package/dist/copy/index.d.ts +39 -9
  40. package/dist/copy/index.js +18 -19
  41. package/dist/drag/drag.css +8 -8
  42. package/dist/drag/index.js +1 -1
  43. package/dist/easel/index.d.ts +3 -3
  44. package/dist/easel/index.js +1 -1
  45. package/dist/fields/fields.css +8 -8
  46. package/dist/fields/index.js +1 -1
  47. package/dist/gold/index.d.ts +3 -3
  48. package/dist/gold/index.js +1 -1
  49. package/dist/{host-Ud6rLpph.d.ts → host-GOlVK3LX.d.ts} +9 -0
  50. package/dist/icons/index.d.ts +1 -0
  51. package/dist/markup/index.d.ts +1 -629
  52. package/dist/markup/index.js +1 -1
  53. package/dist/menu/menu.css +1 -1
  54. package/dist/panel/index.js +1 -1
  55. package/dist/panel/panel.css +12 -12
  56. package/dist/pick/index.js +1 -1
  57. package/dist/pick/pick.css +7 -7
  58. package/dist/screen/components/AddBlockRow.js +1 -1
  59. package/dist/screen/components/AddSidePanel.js +1 -1
  60. package/dist/screen/components/MediaSidePanel.d.ts +1 -1
  61. package/dist/screen/components/MediaSidePanel.js +1 -1
  62. package/dist/screen/components/NodeContextMenu.d.ts +1 -1
  63. package/dist/screen/components/NodeContextMenu.js +1 -1
  64. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  65. package/dist/screen/components/PanelToggleIcon.d.ts +6 -5
  66. package/dist/screen/components/PanelToggleIcon.js +1 -1
  67. package/dist/screen/components/SaveControls.d.ts +1 -1
  68. package/dist/screen/components/ScreenChrome.js +1 -1
  69. package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
  70. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  71. package/dist/screen/components/ScreenMount.d.ts +1 -1
  72. package/dist/screen/components/ScreenMount.js +1 -1
  73. package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
  74. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  75. package/dist/screen/components/SectionScreenShell.js +16 -16
  76. package/dist/screen/components/SidePanelHead.js +1 -1
  77. package/dist/screen/components/usePartBridge.d.ts +1 -1
  78. package/dist/screen/components/usePartBridge.js +1 -1
  79. package/dist/screen/index.d.ts +1 -1
  80. package/dist/screen/index.js +1 -1
  81. package/dist/screen/lib/document-addressing.d.ts +1 -1
  82. package/dist/screen/lib/host.d.ts +1 -1
  83. package/dist/screen/lib/key-scope.js +1 -1
  84. package/dist/screen/lib/media-panel.d.ts +1 -1
  85. package/dist/screen/lib/media-picker.d.ts +1 -1
  86. package/dist/screen/lib/puck/device-fields.js +1 -1
  87. package/dist/screen/lib/puck/slot-child-name.js +1 -1
  88. package/dist/screen/lib/puck/style-clipboard.d.ts +1 -1
  89. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  90. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  91. package/dist/screen/lib/screen-parts.d.ts +1 -1
  92. package/dist/screen/lib/screen-parts.js +1 -1
  93. package/dist/screen/screen.css +16 -16
  94. package/dist/screen/words.js +1 -1
  95. package/dist/shell/shell.css +10 -8
  96. package/dist/strings/catalogue.d.ts +2 -2
  97. package/dist/strings/catalogue.js +1 -1
  98. package/dist/strings/index.d.ts +2 -2
  99. package/dist/strings/index.js +1 -1
  100. package/dist/text-styles/index.d.ts +4 -231
  101. package/dist/text-styles/index.js +35 -35
  102. package/dist/text-styles/model.d.ts +259 -0
  103. package/dist/text-styles/model.js +1 -0
  104. package/dist/text-styles/text-styles.css +6 -6
  105. package/dist/{words-dsex49Jh.d.ts → words-CiuKuiy0.d.ts} +12 -6
  106. package/package.json +6 -1
  107. package/dist/chunk-546BBOPE.js +0 -1
  108. package/dist/chunk-AZOCY74V.js +0 -57
  109. package/dist/chunk-BHRC3ASL.js +0 -1
  110. package/dist/chunk-BPFPM3L4.js +0 -7
  111. package/dist/chunk-DD7A6RRL.js +0 -5
  112. package/dist/chunk-EQFBUNEB.js +0 -1
  113. package/dist/chunk-FAAZZXIS.js +0 -1
  114. package/dist/chunk-FFYXVAAL.js +0 -1
  115. package/dist/chunk-GCCBEY2W.js +0 -2
  116. package/dist/chunk-GG4FGBFR.js +0 -1
  117. package/dist/chunk-KQMML6JM.js +0 -4
  118. package/dist/chunk-Q6AM43CA.js +0 -1
  119. package/dist/chunk-U7KFFC7N.js +0 -5
  120. package/dist/chunk-VWXUMVCD.js +0 -1
  121. package/dist/chunk-ZAOM6PFH.js +0 -1
package/README.md CHANGED
@@ -198,7 +198,7 @@ host owns the string and decides what a finished edit means.
198
198
  ```tsx
199
199
  'use client';
200
200
  import { GoldTextInput } from 'efficient-easel/gold';
201
- import { STOREFRONT_MARKUP } from 'efficient-easel/markup';
201
+ import { STOREFRONT_MARKUP } from 'efficient-shell/markup';
202
202
  import 'efficient-easel/gold.css'; // once, from a client/global entry
203
203
 
204
204
  <GoldTextInput
@@ -224,12 +224,11 @@ import 'efficient-easel/gold.css'; // once, from a client/global entry
224
224
  | `rules` | `readonly InlineRule[]` | `STANDARD_MARKUP` | pass your product's set — `STOREFRONT_MARKUP` / `CAMPAIGN_MARKUP` |
225
225
  | `ariaLabel` | `string` | — | in-place editing has no visible label |
226
226
 
227
- **The grammar is ours, and there is one.** Runs are parsed by
228
- `efficient-easel/markup`, which this package owns since 2026-09-28 (it started as
229
- `efficient-shell/markup`). The published page and the campaign email render from
230
- the same module, so a toolbar button, a page and this box can never disagree
231
- about what a delimiter means. It is framework-free and imports nothing. See
232
- [the text grammar](#the-text-grammar--efficient-easelmarkup) below.
227
+ **There is one grammar, and it is the shell's.** Runs are parsed by
228
+ `efficient-shell/markup` (decision D1, 2026-10-12). The published page and the
229
+ campaign email render from the same module, so a toolbar button, a page and
230
+ this box can never disagree about what a delimiter means. It is framework-free
231
+ and imports nothing. See [the text grammar](#the-text-grammar--efficient-easelmarkup-deprecated) below.
233
232
 
234
233
  **Two deliberate limits.** The asterisks are FADED, never removed. They go to
235
234
  nothing while the box is unfocused, so a merchant who is not typing does not read
@@ -242,43 +241,23 @@ earlier than the transparent box on top of it and every following line would be
242
241
  drawn over the wrong text. The real weight and slant appear on the page the
243
242
  moment the merchant clicks away.
244
243
 
245
- ## The text grammar — `efficient-easel/markup`
244
+ ## The text grammar — `efficient-easel/markup` (deprecated)
246
245
 
247
- The ONE rule for copy a merchant types, in both editors, on the page and in the
248
- email. Framework-free: no React, no DOM, no imports.
246
+ **Import `efficient-shell/markup`.** The one grammar for copy a merchant types,
247
+ in both editors, on the page and in the email, is efficient-shell's
248
+ (decision D1, Lewis 2026-10-12). Its marks, exports and rules are documented
249
+ in efficient-shell's README, "Editorial markup — `efficient-shell/markup`";
250
+ they are not repeated here.
249
251
 
250
- | Mark | Means | Written by a button |
251
- |---|---|---|
252
- | `**x**` | **Strong** (bold) | yes, ⌘B |
253
- | `==x==` | **Emphasis** (the brand accent) | yes |
254
- | `^^x^^` | **Quiet** | yes |
255
- | `_x_` | italic, only at a word edge | yes |
256
- | `~~x~~` | strikethrough | yes |
257
- | `[words](href)` | a link — `http`, `https`, `mailto`, `tel` or no scheme only | yes |
258
- | `- ` at the start of a line | a bullet line, one level | yes |
259
- | `1. ` at the start of a line | a numbered line, one level: 1-3 digits, `. `, words; the number is kept as typed | yes |
260
- | `[x]{underline}`, `[x]{sup}`, `[x]{sub}` | underline, superscript, subscript (tree only) | not yet — `applyMark` writes them; the buttons come with the final text box |
261
- | `[x]{color=name}` / `[x]{color=#rrggbb}` | a theme colour by name (`isColorName`), or any colour as exactly six hex digits (`isColorValue`; saved lowercase) (tree only) | not yet — `applyColor` writes it |
262
- | `@@x@@`, `++x++` | Emphasis, Strong (the storefront's old word styles) | no — read only |
263
- | `*x*`, `#x#`, `[x]` | legacy accent, bold, italic (per product set) | no — read only |
264
-
265
- The three names a merchant sees are in `MARK_NAMES`. A run never crosses a line
266
- break, and runs, spans and links nest up to four levels
267
- (`[**_[x]{sup}_**]{color=accent}`); a fifth stays as typed. Any block after `]`
268
- that is not exactly one of the four (`[x]{foo}`, `[x]{color=#f00}`,
269
- `[x]{{first_name}}`) is plain text. The spans and the numbered line are read by
270
- `parseMarkup` only: `tokenizeInline` keeps them as text, so a renderer that has
271
- not learned them prints the delimiters.
252
+ `efficient-easel/markup` still resolves, so a host that imports it keeps
253
+ working, but it is only `export * from 'efficient-shell/markup'`: it has no
254
+ code of its own, and it is `@deprecated`. Easel's own copy (1,498 lines, held
255
+ here from 2026-09-28) was deleted on 2026-10-17. Framework-free: no React, no
256
+ DOM, no other import.
272
257
 
273
- | Export | Notes |
274
- |---|---|
275
- | `parseMarkup(value, rules)` → `MarkupLine[]` | The whole grammar as a tree. Each run keeps the delimiters that were saved. |
276
- | `serializeMarkup(lines)` | The inverse: `serializeMarkup(parseMarkup(s, rules)) === s`, for every string. Pinned by `tests/markup-round-trip.test.ts` (made-up strings in the shape of saved copy). All 917 saved production strings were checked off-repo on 2026-09-29 (editor-shell #89), and again for the spans and numbered lines on 2026-10-06 (E1). |
277
- | `isSafeLinkHref(href)` | The link rule. Call it before writing any `href`. |
278
- | `tokenizeInline(value, rules)`, `stripInline` | The flat reading older renderers use: runs only, no links, no nesting. |
279
- | `applyMark(text, start, end, style)`, `MARKUP_TOOLS`, `markupTools`, `COPY_FIELD_TOOLS` | The writer behind a toolbar button, and the button descriptors. |
280
- | `applyColor(text, start, end, name)`, `isColorName`, `isColorValue`, `spanFor` | A colour carries a value, so it has its own writer: it writes, changes and (`null`) takes off `[x]{color=name}` — a theme name or a 6-digit hex, saved lowercase — and changes nothing for a value `isColorValue` refuses (`#f00`, `rgb()`, a typo). |
281
- | `STANDARD_MARKUP`, `STOREFRONT_MARKUP`, `CAMPAIGN_MARKUP` | The rule sets. The last two add each product's legacy runs. |
258
+ One behaviour came with the move: the read-only `++phrase++` Strong opens only
259
+ at a word start, so `A++ rated tyres, A++ service` is plain text, while
260
+ `Save ++20%++ today` is still Strong.
282
261
 
283
262
  ## The edit lock — two operators, one document
284
263
 
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { MarkStyle, MarkupTool, WrapResult, InlineRule } from './markup/index.js';
4
- import { C as CopyWords, a as CopyAlign } from './words-dsex49Jh.js';
3
+ import { MarkStyle, WrapResult, InlineRule, MarkupTool } from 'efficient-shell/markup';
4
+ import { C as CopyWords, a as CopyAlign } from './words-CiuKuiy0.js';
5
5
  import { TextToolbarCase, TextToolbarMark } from 'efficient-shell/ui';
6
6
 
7
7
  type CellWords = NonNullable<CopyWords['cells']>;
@@ -66,88 +66,6 @@ declare function ColorWindow({ colors, current, words, onPick, }: {
66
66
  onPick: (color: string | null) => void;
67
67
  }): react.JSX.Element;
68
68
 
69
- /** `'b'` → `Meta+B`, `'shift+x'` → `Meta+Shift+X` — the ARIA spelling of a
70
- * shortcut. Meta is what the tooltips promise (⌘); Ctrl works too. */
71
- declare function ariaShortcut(shortcut: string | undefined): string | undefined;
72
- interface MarkBarProps {
73
- /**
74
- * Which buttons to show.
75
- *
76
- * TWO FORMS, and the second is not a convenience — it is the only way a
77
- * product with marks of its OWN can use this bar at all.
78
- *
79
- * `MarkStyle[]` resolved against the shared grammar's `MARKUP_TOOLS`, in
80
- * that order. What the campaign designer passes.
81
- * `MarkupTool[]` used verbatim. What `efficient-storefront` passes.
82
- *
83
- * ⚠️ WHY VERBATIM DESCRIPTORS HAD TO EXIST. The storefront offered SEVEN
84
- * marks: the grammar's four, plus its three word styles (`@@`, `++`, `^^`),
85
- * which then lived only in the shop because the grammar was
86
- * `efficient-shell/markup`. Resolving through `markupTools` can only ever
87
- * return marks the grammar knows, so it silently DROPPED all three — the bar
88
- * rendered four buttons where the panel had seven, and nothing failed to
89
- * compile. Since 2026-09-28 the grammar is ours and holds Quiet (`^^`) and
90
- * reads `@@` / `++` as Emphasis and Strong, but a host may still hand in
91
- * marks of its own.
92
- *
93
- * So a host that has its own marks builds its own descriptors (the shop
94
- * already did: `shopMarkupTools()`) and hands them over whole. The bar's job
95
- * is the ROW — the buttons, the focus guard, the naming, the group — and that
96
- * job does not depend on who defined the mark.
97
- */
98
- tools: readonly MarkStyle[] | readonly MarkupTool[];
99
- onApply: (style: MarkStyle) => void;
100
- disabled?: boolean;
101
- /** Buttons that write no mark, after a divider — see `CopyBoxProps.actions`. */
102
- actions?: ReactNode;
103
- /** The alignment strip, already built by the control. */
104
- align?: ReactNode;
105
- /**
106
- * WHAT A BUTTON IS DRAWN AS, per style. Default: the grammar's own letter —
107
- * `B`, `I`, `S`, `◆` — which is what the campaign designer has always shown.
108
- *
109
- * ⚠️ THIS IS NOT A THEME KNOB, AND IT IS NOT OPTIONAL POLISH. This package
110
- * already says that WHICH buttons and WHAT they write are the grammar's, while
111
- * how they LOOK is the host's, "because this bar has to belong to the
112
- * storefront inspector's chrome and the campaign designer's bar has to belong
113
- * to the portal's". Colour was delegated by tokens on day one; the DRAWING was
114
- * not, and a letter is a drawing. `efficient-storefront` renders each mark as a 14px
115
- * stroked SVG at the weight of its other inspector glyphs, on the stated
116
- * ground that the row should read "as part of the field rather than as
117
- * pasted-in icons" — so without this it could not adopt the bar without losing
118
- * that, which is a regression dressed as a refactor.
119
- *
120
- * The set now HAS a glyph for every mark (0.94.0: bold, italic, strike,
121
- * emphasis, quiet, clear-marks — the owner's call, made 2026-10-02), and they
122
- * are the default. This map stays so a host can still draw its own.
123
- *
124
- * A style the map does not name falls back to the icon set's glyph for it
125
- * (`SET_GLYPH`, 0.94.0, when the owner added the mark glyphs to the set) and
126
- * then to the letter, so a host may override one button and leave the rest.
127
- */
128
- glyphs?: Partial<Record<MarkStyle, ReactNode>>;
129
- /**
130
- * What the group is CALLED. Defaults to "Formatting" (`EaselStrings.copy.formatting`).
131
- *
132
- * A bar bound to one box needs nothing more. A bar SHARED by several rows has
133
- * to say which row it is aimed at, because the visible cue — the marked row —
134
- * is not readable. `efficient-storefront` has that case today.
135
- */
136
- ariaLabel?: string;
137
- /**
138
- * The marks the selection already wears — a button drawn pressed is one
139
- * whose press takes the mark OFF (`markedAt`, the same test `applyMark`
140
- * unwraps by), so the two cannot disagree. A style not named is not pressed;
141
- * with no map at all no button says either way (`aria-pressed` is left off),
142
- * which is what every host that does not track the selection still gets.
143
- */
144
- pressed?: Partial<Record<MarkStyle, boolean>>;
145
- /** The style whose own window is open — the link button while its "Link
146
- * to" window is showing. Drawn pressed, and named as expanded. */
147
- open?: MarkStyle | null;
148
- }
149
- declare function MarkBar({ tools, onApply, disabled, actions, align, glyphs, ariaLabel, pressed, open, }: MarkBarProps): react.JSX.Element | null;
150
-
151
69
  /**
152
70
  * Just enough of a text control to read a selection off it. Narrowed to these
153
71
  * two fields so a caller may hand in a plain object in a test.
@@ -300,7 +218,7 @@ interface CopyBoxProps {
300
218
  readOnly?: boolean;
301
219
  /**
302
220
  * The grammar's rule set — `CAMPAIGN_MARKUP` in the designer,
303
- * `STOREFRONT_MARKUP` in the shop, both from `efficient-easel/markup`. It
221
+ * `STOREFRONT_MARKUP` in the shop, both from `efficient-shell/markup`. It
304
222
  * decides what the LAYER paints; {@link tools} decides what the BAR offers,
305
223
  * and a host that lets those two disagree gets a button whose mark draws as
306
224
  * plain text.
@@ -308,29 +226,27 @@ interface CopyBoxProps {
308
226
  rules?: readonly InlineRule[];
309
227
  /**
310
228
  * Which mark buttons to show — styles resolved against the shared grammar, or
311
- * the host's own descriptors used verbatim. See `MarkBarProps.tools`. Empty
312
- * draws no bar.
229
+ * the host's own descriptors (only their `style` is read). Empty draws no
230
+ * mark buttons.
313
231
  */
314
- tools?: MarkBarProps['tools'];
232
+ tools?: readonly MarkStyle[] | readonly MarkupTool[];
315
233
  /**
316
234
  * How a mark is written. Defaults to the shared grammar's `applyMark`; the
317
235
  * storefront passes its own so its three word styles reach the same bar.
318
236
  */
319
237
  writeMark?: MarkWriter;
320
238
  /**
321
- * Buttons that are NOT marks, drawn after a divider at the end of the bar.
322
- *
323
- * The storefront's "Clear formatting" is the one that exists: it writes no
324
- * mark at all, so it is not in the grammar's tool list and must not be added
325
- * to it. Drawing it here keeps `MARKUP_TOOLS` meaning "what a mark MEANS".
239
+ * @deprecated Only read with `toolbar: 'classic'`, where it is drawn in the
240
+ * toolbar's row 1 last cell (`lastTool` wins). Removed in 12.0.0.
326
241
  */
327
242
  actions?: ReactNode;
328
243
  /** The alignment strip. Omitted = no strip. */
329
244
  align?: CopyBoxAlign<CopyAlign>;
330
- /** What each mark button is DRAWN as — see `MarkBarProps.glyphs`. Default is
331
- * the grammar's own letter. */
332
- glyphs?: MarkBarProps['glyphs'];
333
- /** What the formatting group is CALLED — see `MarkBarProps.ariaLabel`. */
245
+ /** @deprecated Not drawn: the toolbar's drawings are the shell set's.
246
+ * Removed in 12.0.0. */
247
+ glyphs?: Partial<Record<MarkStyle, ReactNode>>;
248
+ /** What the toolbar is CALLED. Defaults to "Formatting"
249
+ * (`EaselStrings.copy.formatting`). */
334
250
  barLabel?: string;
335
251
  /** What goes under the box — see {@link CopyBoxFooter}. */
336
252
  renderFooter?: (ctx: CopyBoxFooter) => ReactNode;
@@ -354,13 +270,8 @@ interface CopyBoxProps {
354
270
  /** A many-line box opens with its marks shown. Default false. */
355
271
  defaultShowMarks?: boolean;
356
272
  /**
357
- * Which toolbar (E5b). `'final'` — the default — is the design made final
358
- * on 2026-10-06: two rows on one 9-column grid, B · I · U · S · Color ·
359
- * Link · Superscript · Subscript · the host's {@link lastTool} (Undo until
360
- * 2026-10-07) over Left · Center · Right · Justify
361
- * · Bulleted · Numbered · Aa · AA · aa, with the number {@link cells}
362
- * between it and the box. `'classic'` is the bar before it (`MarkBar` and
363
- * the alignment strip), for a host not moved over yet.
273
+ * @deprecated Every copy box draws the shell's `TextToolbar`; `'classic'`
274
+ * only draws {@link actions} in its last cell. Removed in 12.0.0.
364
275
  */
365
276
  toolbar?: 'final' | 'classic';
366
277
  /**
@@ -517,4 +428,4 @@ interface CanvasTypingSession {
517
428
  /** Start typing in the words `element()` drew, or `null` where they are not the string's. */
518
429
  declare function startCanvasTyping(o: CanvasTypingOptions): CanvasTypingSession | null;
519
430
 
520
- export { type CopyBoxLastTool as C, MarkBar as M, type SelectionSource as S, type TextBoxHandle as T, type CopyThemeColor as a, type CanvasTypingEnd as b, type CopyBoxProps as c, type CopyCell as d, COPY_CELLS as e, type CanvasTypingOptions as f, type CanvasTypingSession as g, ColorWindow as h, type CopyBoxAlign as i, type CopyBoxFooter as j, type CopyCase as k, type CopyCellPreset as l, CopyCells as m, type MarkBarProps as n, type MarkWriter as o, type TextAreaHandle as p, type TextMap as q, type ToolbarMark as r, ariaShortcut as s, colorRunOf as t, insertSelection as u, markSelection as v, startCanvasTyping as w, textMap as x };
431
+ export { type CopyBoxLastTool as C, type MarkWriter as M, type SelectionSource as S, type TextBoxHandle as T, type CopyThemeColor as a, type CanvasTypingEnd as b, type CopyBoxProps as c, type CopyCell as d, COPY_CELLS as e, type CanvasTypingOptions as f, type CanvasTypingSession as g, ColorWindow as h, type CopyBoxAlign as i, type CopyBoxFooter as j, type CopyCase as k, type CopyCellPreset as l, CopyCells as m, type TextAreaHandle as n, type TextMap as o, type ToolbarMark as p, colorRunOf as q, insertSelection as r, markSelection as s, startCanvasTyping as t, textMap as u };
@@ -154,7 +154,7 @@
154
154
  gap: 8px;
155
155
  padding: 4px 12px;
156
156
  border-radius: var(--radius-lg);
157
- font-size: 12px;
157
+ font-size: var(--text-xs, 12px);
158
158
  font-weight: 500;
159
159
  white-space: nowrap;
160
160
  user-select: none;
@@ -269,7 +269,7 @@
269
269
  }
270
270
  /* A panel's own name. States the margin an h2 would otherwise bring. */
271
271
  .es-panel-title {
272
- font-size: 14px;
272
+ font-size: var(--text-sm, 14px);
273
273
  font-weight: 600;
274
274
  color: var(--es-text);
275
275
  margin: 0;
@@ -412,7 +412,7 @@ span:has(> .es-insp-up-btn) {
412
412
  display: flex;
413
413
  align-items: center;
414
414
  justify-content: center;
415
- font-size: 14px;
415
+ font-size: var(--text-sm, 14px);
416
416
  flex: none;
417
417
  background: var(--es-chip-bg);
418
418
  color: var(--es-icon);
@@ -453,7 +453,7 @@ span:has(> .es-insp-up-btn) {
453
453
  }
454
454
  /* An h2 carries `0.83em 0` from the UA sheet; `margin: 0` keeps the head closed. */
455
455
  .es-insp-name {
456
- font-size: 14px;
456
+ font-size: var(--text-sm, 14px);
457
457
  font-weight: 600;
458
458
  color: var(--es-text);
459
459
  margin: 0;
@@ -462,7 +462,7 @@ span:has(> .es-insp-up-btn) {
462
462
  text-overflow: ellipsis;
463
463
  }
464
464
  .es-insp-kind {
465
- font-size: 11px;
465
+ font-size: var(--text-2xs, 11px);
466
466
  color: var(--es-muted);
467
467
  }
468
468
  .es-insp-actions {
@@ -1 +1 @@
1
- import{DEFAULT_FIELDS_WORDS as e}from"./chunk-FFYXVAAL.js";import{useWords as i}from"./chunk-MFIRYGHW.js";import{ShellStringsProvider as n,InputNumber as s,Tooltip as a}from"efficient-shell/ui";import{jsx as l}from"react/jsx-runtime";function r({id:r,value:t,onChange:m,min:o,max:c,step:u=1,shiftStep:d,styleValue:p,icon:f,unit:h,steppers:b=!1,placeholder:v,readOnly:x=!1,ariaLabel:y,ariaLabelledBy:N,title:F}){const g=i("fields",e),j="number"==typeof t&&Number.isFinite(t)?t:null,L=/* @__PURE__ */l("div",{className:`es-fnum${f?" es-fnum--icon":""}${null===j&&void 0!==p?" is-style":""}`,children:/* @__PURE__ */l(n,{value:{number:{increase:g.more,decrease:g.less}},children:/* @__PURE__ */l(s,{id:r,size:"sm",className:"es-fnum-box",value:j,onChange:e=>m(e??void 0),min:o,max:c,step:u,shiftStep:d,readOnly:x,steppers:b,snap:!0,placeholder:void 0!==p?String(p):v,prefix:f?/* @__PURE__ */l("span",{className:"es-fnum-icon",children:f}):void 0,suffix:h?/* @__PURE__ */l("span",{className:"es-fnum-unit",children:h}):void 0,"aria-label":y,"aria-labelledby":N})})});return F?/* @__PURE__ */l(a,{content:F,children:L}):L}export{r as FieldNumber};
1
+ import{DEFAULT_FIELDS_WORDS as e}from"./chunk-WRFD4EXD.js";import{useWords as i}from"./chunk-MFIRYGHW.js";import{ShellStringsProvider as n,InputNumber as s,Tooltip as a}from"efficient-shell/ui";import{jsx as l}from"react/jsx-runtime";function r({id:r,value:t,onChange:m,min:o,max:c,step:u=1,shiftStep:d,styleValue:p,icon:f,unit:h,steppers:b=!1,placeholder:v,readOnly:x=!1,ariaLabel:y,ariaLabelledBy:N,title:g}){const j=i("fields",e),F="number"==typeof t&&Number.isFinite(t)?t:null,S=/* @__PURE__ */l("div",{className:`es-fnum${f?" es-fnum--icon":""}${null===F&&void 0!==p?" is-style":""}`,children:/* @__PURE__ */l(n,{value:{number:{increase:j.more,decrease:j.less}},children:/* @__PURE__ */l(s,{id:r,size:"sm",className:"es-fnum-box",value:F,onChange:e=>m(e??void 0),min:o,max:c,step:u,shiftStep:d,readOnly:x,steppers:b,snap:!0,placeholder:void 0!==p?String(p):v,prefix:f?/* @__PURE__ */l("span",{className:"es-fnum-icon",children:f}):void 0,suffix:h?/* @__PURE__ */l("span",{className:"es-fnum-unit",children:h}):void 0,"aria-label":y,"aria-labelledby":N})})});return g?/* @__PURE__ */l(a,{content:g,children:S}):S}export{r as FieldNumber};
@@ -0,0 +1 @@
1
+ import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"efficient-shell/markup";var i={formatting:"Formatting",alignment:"Alignment",align:{left:"Left",center:"Center",right:"Right",justify:"Justify"},marks:{...Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),underline:{name:"Underline",title:"Underline · [words]{underline}"},sup:{name:"Superscript",title:"Superscript · [words]{sup}"},sub:{name:"Subscript",title:"Subscript · [words]{sub}"}},placeholders:t,showMarks:"Show marks",clearStyle:"Clear changes",clearStyleEmpty:"Select words first",colors:{title:"Color",theme:"Theme colors",remove:"Remove",any:"Any color",square:"Saturation and brightness",hue:"Hue",hex:"Hex color"},panel:{style:"Style",editStyles:"Edit styles",updateStyle:"Update style",font:"Font",italic:"Italic",list:"List",lists:{none:"No list",bullet:"Bulleted",number:"Numbered"},capitalization:"Capitalization",cases:{none:"As typed",upper:"Uppercase",capitalize:"Capitalized",lower:"Lowercase"}},cells:{fontSize:"Font size",lineHeight:"Line spacing",letterSpacing:"Letter spacing",paragraphSpacing:"Paragraph spacing",tip:({name:e,step:t,unit:i})=>`${e} · step ${t} ${i} · Shift ×10`}};export{i as DEFAULT_COPY_WORDS};
@@ -1,9 +1,9 @@
1
- import{Segmented as e,Switch as a,Tooltip as l}from"efficient-shell/ui";import{jsx as s,jsxs as i,Fragment as n}from"react/jsx-runtime";import{isValidElement as r,cloneElement as d}from"react";function c({options:a,value:n,onChange:r,ariaLabel:d,fit:c,disabled:t=!1,className:o}){const h=c&&function(e,a){return{"--es-fit-count":e,"--es-fit-labels":`${a.labelsPx}px`,"--es-fit-widest":`${a.widestLabelPx}px`}}(a.length,c),u=a.findIndex(e=>e.id===n);
2
- /* @__PURE__ */
3
- return s("div",{className:"es-segs-fit","data-disabled":t||void 0,style:h,children:/* @__PURE__ */s(e,{size:"sm",label:d,className:`es-segs${h?" is-measured":""}${o?` ${o}`:""}`,value:u<0?"":String(u),onChange:e=>r(a[Number(e)].id),options:a.map((e,a)=>{const n=e.title??("string"==typeof e.label?e.label:void 0),r="string"!=typeof e.label,d=a=>n&&(e.icon||r)?/* @__PURE__ */s(l,{content:n,children:a}):a;return{value:String(a),disabled:t||!0===e.disabled,icon:e.icon?d(
4
- /* @__PURE__ */s("span",{className:"es-seg-icon","aria-hidden":"true",children:e.icon})):void 0,label:r?/* @__PURE__ */i("span",{className:"es-seg-word",children:[d(/* @__PURE__ */s("span",{"aria-hidden":"true",children:e.label})),
5
- /* @__PURE__ */s("span",{className:"es-vh",children:n})]}):/* @__PURE__ */s("span",{className:"es-seg-word",children:e.label})}})})})}function t({checked:e,onChange:l,disabled:i,id:n,ariaLabel:r,ariaLabelledBy:d,className:c}){/* @__PURE__ */
6
- return s(a,{size:"sm",id:n,checked:e,"aria-label":r,"aria-labelledby":d,disabled:i,className:c?`es-switch ${c}`:"es-switch",onChange:l})}function o(e){return Array.isArray(e)?e.some(o):r(e)}function h(e,a,l){if(!r(e)||e.type!==t)return e;const s=e.props;return s.ariaLabel||s.ariaLabelledBy?e:d(e,l?{ariaLabelledBy:l}:{ariaLabel:a})}function u({label:e,labelId:a,icon:l,value:r,hint:d,changed:c,htmlFor:t,action:u,children:m,className:b}){const f=o(m),p=o(u);if(!f&&!p)return null;const N=["es-field"];f||N.push("is-inline"),c&&N.push("is-changed"),b&&N.push(b);const g=/* @__PURE__ */i(n,{children:[l?/* @__PURE__ */s("span",{className:"es-field-icon","aria-hidden":"true",children:l}):null,
1
+ import{Switch as e,Segmented as a,Tooltip as l}from"efficient-shell/ui";import{jsx as s,jsxs as i,Fragment as n}from"react/jsx-runtime";import{isValidElement as r,cloneElement as d}from"react";function c({checked:a,onChange:l,disabled:i,id:n,ariaLabel:r,ariaLabelledBy:d,className:c}){/* @__PURE__ */
2
+ return s(e,{size:"sm",id:n,checked:a,"aria-label":r,"aria-labelledby":d,disabled:i,className:c?`es-switch ${c}`:"es-switch",onChange:l})}function t(e){return Array.isArray(e)?e.some(t):r(e)}function o(e,a,l){if(!r(e)||e.type!==c)return e;const s=e.props;return s.ariaLabel||s.ariaLabelledBy?e:d(e,l?{ariaLabelledBy:l}:{ariaLabel:a})}function h({label:e,labelId:a,icon:l,value:r,hint:d,changed:c,htmlFor:h,action:u,children:m,className:b}){const f=t(m),p=t(u);if(!f&&!p)return null;const N=["es-field"];f||N.push("is-inline"),c&&N.push("is-changed"),b&&N.push(b);const g=/* @__PURE__ */i(n,{children:[l?/* @__PURE__ */s("span",{className:"es-field-icon","aria-hidden":"true",children:l}):null,
7
3
  /* @__PURE__ */s("span",{className:"es-field-label",id:a,children:e})]});/* @__PURE__ */
8
4
  return i("div",{className:N.join(" "),children:[
9
- /* @__PURE__ */i("div",{className:"es-field-head",children:[t?/* @__PURE__ */s("label",{className:"es-field-name",htmlFor:t,children:g}):/* @__PURE__ */s("span",{className:"es-field-name",children:g}),null!=r?/* @__PURE__ */s("span",{className:"es-field-value",children:r}):null,p?h(u,e,a):null]}),f?/* @__PURE__ */s("div",{className:"es-field-ctl",children:m}):null,d?/* @__PURE__ */s("p",{className:"es-field-hint",children:d}):null]})}export{u as SettingsField,c as SettingsSegmented,t as SettingsSwitch};
5
+ /* @__PURE__ */i("div",{className:"es-field-head",children:[h?/* @__PURE__ */s("label",{className:"es-field-name",htmlFor:h,children:g}):/* @__PURE__ */s("span",{className:"es-field-name",children:g}),null!=r?/* @__PURE__ */s("span",{className:"es-field-value",children:r}):null,p?o(u,e,a):null]}),f?/* @__PURE__ */s("div",{className:"es-field-ctl",children:m}):null,d?/* @__PURE__ */s("p",{className:"es-field-hint",children:d}):null]})}function u({options:e,value:n,onChange:r,ariaLabel:d,fit:c,disabled:t=!1,className:o}){const h=c&&function(e,a){return{"--es-fit-count":e,"--es-fit-labels":`${a.labelsPx}px`,"--es-fit-widest":`${a.widestLabelPx}px`}}(e.length,c),u=e.findIndex(e=>e.id===n);
6
+ /* @__PURE__ */
7
+ return s("div",{className:"es-segs-fit","data-disabled":t||void 0,style:h,children:/* @__PURE__ */s(a,{size:"sm",label:d,className:`es-segs${h?" is-measured":""}${o?` ${o}`:""}`,value:u<0?"":String(u),onChange:a=>r(e[Number(a)].id),options:e.map((e,a)=>{const n=e.title??("string"==typeof e.label?e.label:void 0),r="string"!=typeof e.label,d=a=>n&&(e.icon||r)?/* @__PURE__ */s(l,{content:n,children:a}):a;return{value:String(a),disabled:t||!0===e.disabled,icon:e.icon?d(
8
+ /* @__PURE__ */s("span",{className:"es-seg-icon","aria-hidden":"true",children:e.icon})):void 0,label:r?/* @__PURE__ */i("span",{className:"es-seg-word",children:[d(/* @__PURE__ */s("span",{"aria-hidden":"true",children:e.label})),
9
+ /* @__PURE__ */s("span",{className:"es-vh",children:n})]}):/* @__PURE__ */s("span",{className:"es-seg-word",children:e.label})}})})})}export{h as SettingsField,u as SettingsSegmented,c as SettingsSwitch};
@@ -1,13 +1,13 @@
1
- import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPick as l}from"./chunk-ECM5F6JJ.js";import{selectionBox as s,placeWindow as a,offsetOrigin as c,colorRunOf as d,ColorWindow as u,startCanvasTyping as p,textMap as f}from"./chunk-FGJSCWUN.js";import{DEFAULT_COPY_WORDS as h}from"./chunk-Q6AM43CA.js";import{useWords as m}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as g,isTypingTarget as v,frameRectToHost as y,CANVAS_TYPING_EVENT as w,drawnBox as b}from"./chunk-ILXP5VX5.js";import{find as k,ROOT_ID as S,getList as C,remove as I,parseZoneKey as E,move as x,duplicate as D,replaceNode as A,createNode as M,insert as O,normalizeData as z,createResolveCache as R,resolveNodeData as P,ROOT_SLOT as B}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as L,fieldsFrom as N,defaultsFrom as V}from"./chunk-NKB3KVAB.js";import{createContext as $,useEffect as K,useContext as j,useRef as Z,useSyncExternalStore as F,useState as T,useMemo as H,useCallback as W,useLayoutEffect as q}from"react";import{jsx as Y,jsxs as X,Fragment as U}from"react/jsx-runtime";import{createPortal as J}from"react-dom";import{registerModalEscapeInterceptor as G,FloatingBar as Q,TextToolbar as _,LinkPicker as ee}from"efficient-shell/ui";function te(e){return!["setData","setUi","set"].includes(e.type)}var ne=(e,t,n,o)=>{const r=C(e,t,E(n));return r?.[o]??null},oe=(e,t,n,o,r)=>{const i=ne(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function re(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 ie(e,t,n){return n?"node"===n.kind?k(e,t,n.id)?n:null:n.parentId===S?C(e,t,n)?n:null:k(e,t,n.parentId)&&C(e,t,n)?n:null:null}function le(e,t,n,r=!1){const{itemSelector:i,selectedSlot:l,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=o(e.data,t,i??null)),"selectedSlot"in n&&(l?a=(c=l)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function se(e,t,n){const o=ae(e,t,n);if(o===e)return e;const r=ie(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function ae(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 le(e,n,"function"==typeof t.ui?t.ui(re(e,n)):t.ui);case"set":{const r={data:o,ui:re(e,n)},i="function"==typeof t.state?t.state(r):t.state;let l=i.data?{...e,data:i.data}:e;return i.ui&&(l=le(l,n,i.ui,!0)),l}case"insert":{const r={...E(t.destinationZone),index:t.destinationIndex},i=M(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:O(o,n,r,i)}}case"replace":{const r=oe(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:A(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=oe(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=D(o,n,r.props.id),l=ne(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return ae(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=ne(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...E(t.destinationZone),index:t.destinationIndex};return{...e,data:x(o,n,r.props.id,i)}}case"remove":{const r=oe(o,n,t.zone,t.index,"remove");return{...e,data:I(o,n,r.props.id)}}default:return e}}var ce={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},de={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},ue=0,pe=()=>`history-${ue+=1}`;function fe(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let l=e.permissions??{};const s=z(e.data,t);let a={data:s,selection:null,ui:{...de}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;a={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...de,...i}}}let c=[{core:a,at:-1/0,sealed:!0,id:pe()}],d=0;const u=e=>{const t=c[d],n=r();!e&&d===c.length-1&&d>0&&!t.sealed&&n-t.at<i?c=[...c.slice(0,d),{...t,core:a,at:n}]:(c=[...c.slice(0,d+1),{core:a,at:n,sealed:e,id:pe()}],d=c.length-1)},p=/* @__PURE__ */new Set;let f=null,h=null,m=0,g=null,v=!1;const y=()=>{for(const e of[...p])e()},w=()=>{c=[...c.slice(0,d),{...c[d],core:a},...c.slice(d+1)]},b=(t,n)=>{m>0?v=v||n:(n?u(!1):a!==t&&w(),a.data!==t.data&&e.onChange?.(a.data),a!==t&&y())},S=e=>{const n=a;if(a=se(a,e,t),a===n)return;const o=e.recordHistory??te(e);b(n,o&&a.data!==n.data)},I=t=>{0===m&&(g=a,v=!1),m+=1;try{t()}catch(e){throw m-=1,0===m&&g&&(a=g,g=null),e}if(m-=1,m>0||!g)return;const n=g;g=null,v&&a.data!==n.data?u(!0):a!==n&&w(),a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},E=e=>{const n=a,o=ie(a.data,t,e);var r,i;(r=o,i=a.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(a={...a,selection:o},b(n,!1))},x=t=>{const n=a;d=t,a=c[d].core,a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},D=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...ce,...l,...n}};let M=D();const O=R(),B={resolveCache:O,async resolveAll({trigger:e="load",metadata:n}={}){const o=a.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[l,...s]=await Promise.all([P(r,t,{cache:O,trigger:e,metadata:n}),...i.map(o=>P(o,t,{cache:O,trigger:e,metadata:n}))]);I(()=>{const e=a;let n=a.data;s.forEach((e,r)=>{if(!e.didChange)return;const l=i[r].props.id,s=k(n,t,l)?.node;s&&s===k(o,t,l)?.node&&(n=A(n,t,l,e.node))}),l.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:l.node.props,readOnly:l.node.readOnly??n.root.readOnly}}),n!==a.data&&(a={...a,data:n,selection:ie(n,t,a.selection)},b(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=k(a.data,t,e)?.node;if(!r)return!1;const i=await P(r,t,{cache:O,trigger:n,metadata:o});if(!i.didChange)return!1;let l=!1;return I(()=>{const n=a;if(k(a.data,t,e)?.node!==r)return;const o=A(a.data,t,e,i.node);o!==a.data&&(a={...a,data:o,selection:ie(o,t,a.selection)},b(n,!1),l=!0)}),l},get config(){return t},getState(){if(f&&h===a)return f;const e=a,o={data:e.data,ui:re(e,t)},r="node"===e.selection?.kind?k(e.data,t,e.selection.id)?.node??null:null;return f={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:S,history:{back:()=>B.undo(),forward:()=>B.redo(),hasPast:d>0,hasFuture:d<c.length-1,histories:c.map(e=>({id:e.id,state:{data:e.core.data,ui:re(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<c.length&&e!==d&&x(e)}},getPermissions:M,getItemById:n=>k(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return C(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},h=e,f},subscribe:e=>(p.add(e),()=>{p.delete(e)}),dispatch:S,batch:I,group:()=>{const e=d,t=c[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,c[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(c=[...c.slice(0,d),{...c[d],sealed:!0},...c.slice(d+1)]));const o=c[d];c=[...c.slice(0,e+1),{...o,sealed:!0},...c.slice(d+1)],d=e+1}}},select:e=>E(e?{kind:"node",id:e}:null),selectSlot:e=>E(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){I(()=>{const n=a,o=void 0===e.select?a.selection:e.select;a={...a,data:e.data,selection:ie(e.data,t,o)},b(n,e.data!==n.data)})},load(e,n={}){const o=a,r=z(e,t);a={...a,data:r,selection:ie(r,t,n.selection??a.selection)},n.keepHistory||(c=[{core:a,at:-1/0,sealed:!0,id:pe()}],d=0),a!==o&&y()},undo(){d>0&&x(d-1)},redo(){d<c.length-1&&x(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,l)||(l=e,M=D(),f=null,y())},setConfig(e){e!==t&&(t=e,M=D(),f=null,y())}};return B}function he(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&v(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var me=$(null),ge=$(!0);function ve({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return K(()=>{n&&e.resolveAll()},[e,n]),K(()=>{if(t&&"undefined"!=typeof document)return he(document,e)},[e,t]),/* @__PURE__ */Y(me.Provider,{value:e,children:/* @__PURE__ */Y(ge.Provider,{value:t,children:o})})}function ye(){const e=j(me);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function we(e){const t=ye(),n=Z({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 F(t.subscribe,o,o)}function be(){return function(e){return we(e)}}var ke="data-puck-component",Se="data-puck-dropzone",Ce={},Ie="data-es-mirror",Ee="undefined"==typeof window?K:q;function xe(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Ie}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Ie,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function De({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:l=!0,onDocument:s,height:a="auto",nonce:c}){const d=m("canvas",e),u=Z(null),[p,f]=T(null);return Ee(()=>{const e=u.current,t=p?.ownerDocument.defaultView;if("auto"!==a||!e||!p||!t)return;const n=()=>{e.style.height=`${Math.ceil(p.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(p),()=>r?.disconnect()},[p,a]),Ee(()=>{let e=u.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=u.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),g(e,c),f(t),s?.(e);let n=null;const o=u.current?.ownerDocument;if(l&&o){xe(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>xe(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */Y("iframe",{ref:u,id:n,title:o??d.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:p?J(t,p):null})}var Ae=$(null),Me=$(Ce),Oe=[];function ze({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=ye(),s=we(n=>C(n.appState.data,l.config,{parentId:e,slot:t})??Oe),a=we(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==S),c=we(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=j(Ae),u=["es-zone"];return s.length&&u.push("has-children"),e===S&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==S&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */Y("div",{className:u.join(" "),[Se]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */Y(Ke,{node:e},e.props.id))})}function Re(e,t){return H(()=>{const n={};for(const o of L(N(e)))n[o]=function(e={}){/* @__PURE__ */
2
- return Y(ze,{parentId:t,slot:o,...e})};return n},[e,t])}function Pe(e){return H(()=>function({zone:t,...n}){/* @__PURE__ */
3
- return Y(ze,{parentId:e,slot:t,...n})},[e])}var Be=["top","bottom","zIndex"];function Le(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function Ne(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));Le(e,"position",t?"sticky":"relative");for(const n of Be)Le(e,n,t?.[n]??"");return!!t}var Ve="data-es-canvas-relative";function $e(e){e.hasAttribute(Ve)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(Ve));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(Ve,"")),!1)}function Ke({node:e}){const t=ye().config.components[e.type],n=e.props.id,o=Z(null),r=function(e,t){return H(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(ke),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(ke,e),n.setAttribute("data-puck-dnd",e),$e(n))},[e,t])}(n,o),i=Z(null),l=!!t?.inline;!function(e,t){const n=Z(!1),o=Z(()=>{});o.current=()=>{const o=e(),i=n.current;n.current=!!o&&t(o),i!==n.current&&r.current()};const r=Z(()=>{});Ee(()=>o.current()),Ee(()=>{const t=e(),i=t?.ownerDocument.defaultView;if(!t||!i)return;const l=()=>o.current();i.addEventListener("resize",l);const s=i.ResizeObserver,a=s?new s(l):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&i.MutationObserver&&(c=new i.MutationObserver(l),c.observe(e,{attributes:!0}))},r.current(),()=>{i.removeEventListener("resize",l),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>l?o.current:i.current,e=>l?$e(e):Ne(e));const s=j(Me),a=Re(t,n),c=Pe(n);if(!t?.render)return null;const d=t.render,u={...V(t),...e.props,...a},p={renderDropZone:c,isEditing:!0,dragRef:t.inline?r:null,metadata:{...s,...t.metadata}};return t.inline?/* @__PURE__ */Y(d,{...u,puck:p,editMode:!0}):
4
- /* @__PURE__ */Y("div",{ref:i,[ke]:n,"data-puck-dnd":n,style:{position:"relative"},children:/* @__PURE__ */Y(d,{...u,puck:p,editMode:!0})})}function je({metadata:e}){const t=we(e=>e.config),n=we(e=>e.appState.data.root).props??{},o=t.root?.render,r=Re(t.root,S),i=Pe(S),l=/* @__PURE__ */Y(ze,{parentId:S,slot:B}),s=o?/* @__PURE__ */Y(o,{id:"puck-root",...n,...r,puck:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:l}):l;/* @__PURE__ */
5
- return Y(Me.Provider,{value:e??Ce,children:s})}var Ze=$(void 0);function Fe(e,t,n){const[o,r]=T(null),i=Z(t);return i.current=t,Ee(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(null);let o=0;const l=()=>{o=0;const n=function(e,t){if(!e||!t)return null;const n=b(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(i.current?i.current(t):null,e.current?.parentElement??null);r(e=>{return(t=e)===(o=n)||t&&o&&t.top===o.top&&t.left===o.left&&t.width===o.width&&t.height===o.height?e:n;var t,o})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(l))};l();const a="MutationObserver"in n?new n.MutationObserver(s):null;a?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function Te({id:e,kind:t,overlay:n}){const o=Z(null),r=Fe(o,e?t=>t.querySelector(`[${ke}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),i=/* @__PURE__ */Y("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__ */Y(n,{componentId:e,kind:t,children:i}):i}function He(e,t,n){const o=f(e,n),r=o.text.length,i=e.ownerDocument;if(!t)return[r,r];let l=null;const s=i.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))l=o.at(s.offsetNode,s.offset);else{const n=i.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(l=o.at(n.startContainer,n.startOffset))}if(null===l)return[r,r];const a=o.text;let c=l,d=l;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;d<a.length&&!/\s/.test(a[d]);)d+=1;return[c,d]}function We({s:e,element:t,toolbar:n,label:o,keys:r}){const i=m("copy",h),l=e.pressed(),p=new Set(n.offered),f=n.colors&&n.colors.length>0?n.colors:null,g=Z(null),[v,w]=T(!1),[b,k]=T(null),S=v||null!==b,C=()=>{e.hold(),w(!1),k({href:e.pressed().href})},I=()=>{w(!1),k(null),e.resume()};q(()=>{r.current={escape:()=>!!S&&(I(),!0),link:()=>!!p.has("link")&&(C(),!0)}}),q(()=>()=>{r.current=null},[r]);const E=Z(I);E.current=I,K(()=>{if(v)return G(e=>{const t=g.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(E.current(),!0)},()=>g.current?.querySelector(".es-copy-colors"))},[v]),K(()=>{const n=g.current;if(!S||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const i=o=>{const r=o.target;if(r&&n.contains(r))return;w(!1),k(null);const i=t();r&&i&&i.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",i,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",i,!0)}},[S,e,t]),q(()=>{const e=g.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(S&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,i=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,l=(i?s(i,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),d=o.ownerDocument.defaultView?.frameElement,u=d?y(d,{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top}):{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top},p=o.getBoundingClientRect(),f=d?y(d,{left:p.left,top:p.top,width:p.width,height:p.height}):{left:p.left,top:p.top,width:p.width,height:p.height},h=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),m={left:u.left,right:u.left+u.width,top:Math.min(u.top,f.top-6,h.top),bottom:Math.max(u.top+u.height,f.top+f.height+6,h.bottom)},v=e.ownerDocument.documentElement,w=(d??o.closest(".es-canvas")??o).getBoundingClientRect(),b={left:Math.max(0,w.left),top:Math.max(0,w.top),right:Math.min(v.clientWidth||w.right,w.right),bottom:Math.min(v.clientHeight||w.bottom,w.bottom)};if(b.right<=b.left||b.bottom<=b.top||0===n.offsetWidth)return;const k=a({anchor:m,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:w.left,top:w.top,right:w.right,bottom:w.bottom},clip:b,parent:c(n)});n.style.top=`${k.top}px`,n.style.left=`${k.left}px`,n.style.setProperty("--es-pop-point",`${k.point}px`),n.dataset.side=k.above?"above":"below"});const x=f?{run:d(l.color,f),open:v,onToggle:()=>{k(null),v?I():(e.hold(),w(!0))}}:void 0;/* @__PURE__ */
6
- return Y(Q,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?y(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */Y("div",{ref:g,style:{width:"18rem"},children:/* @__PURE__ */Y(_,{offered:p,pressed:l.marks,onMark:t=>{"link"===t?C():e.press(t)},color:x,linkOpen:null!==b,list:{pressed:l.list,onList:t=>e.list(t)},alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:l.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */X(U,{children:[v&&f?/* @__PURE__ */Y(u,{colors:f,current:l.color,words:i.colors??h.colors,onPick:t=>e.color(t)}):null,b?
7
- /* @__PURE__ */Y(ee,{className:"es-copy-link es-copy-pop",value:b.href??"",onApply:t=>{k(null),e.link(t)},onRemove:null!==b.href?()=>{k(null),e.link(null)}:void 0,onCancel:I}):null]})})})})}function qe({element:e}){const t=Z(null),n=Fe(t,()=>e(),e);/* @__PURE__ */
8
- return Y("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function Ye({frame:t=!0,className:n,style:o,metadata:r,mirrorStyles:s,onDocument:a,height:c,title:d,nonce:u,hotkeys:f,frameWrapper:h,overlay:g,children:v,typing:y,passThrough:b}){const k=ye(),S=j(Ze),C=b??S,I=j(ge),E=m("canvas",e),x=f??I,[D,A]=T(void 0),M=we(e=>"node"===e.selection?.kind?e.selection.id:null),[O,z]=T(null),[R,P]=T(null),B=Z(null),[,L]=T(0),N=Z(y);N.current=y;const V=Z(null),$=Z(null),F=e=>{const t=$.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(w,{detail:{typing:e}}))},H=(e,t)=>{B.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=k.group(),r=e.element,i=p({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:He(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>L(e=>e+1),onEscape:()=>V.current?.escape()??!1,onLinkKey:()=>V.current?.link()??!1,end:e=>{o.close(),B.current?.element===r&&(B.current=null),P(null),F(!1),N.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const l=n.closest?.(`[${ke}]`)?.getAttribute(ke);return l&&k.select(l),B.current={s:i,element:r,target:e},P(()=>r),z(null),F(!0),N.current?.onChange?.({typing:!0,element:n}),!0};K(()=>()=>B.current?.s.stop("stop"),[]);const W=e=>{const t=B.current?.element();return Boolean(t&&t.contains(e))},q=e=>{const t=e.closest?.(`[${ke}]`)?.getAttribute(ke);if(!t)return;const n=k.getState(),o="node"===n.selection?.kind?n.selection.id:null;return l(n.appState.data,k.config,t,o,C)??t},U=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(B.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=N.current?.atSelection?.();n&&H(n,null)&&e.preventDefault()},J=/* @__PURE__ */X("div",{ref:$,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),B.current){if(W(t))return;B.current.s.stop("outside")}const n=q(t);void 0===n?t.hasAttribute?.(Se)||k.select(null):k.select(n)},onDoubleClick:e=>{const t=N.current;if(!t||W(e.target))return;const n=t.at(e.target);n&&H(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>U(e),onMouseOver:e=>{if(B.current)return;const t=q(e.target)??null;t!==O&&z(t)},onMouseLeave:()=>z(null),children:[
9
- /* @__PURE__ */Y(Ae.Provider,{value:O,children:/* @__PURE__ */Y(je,{metadata:r})}),
1
+ import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPick as l}from"./chunk-ECM5F6JJ.js";import{selectionBox as s,placeWindow as a,offsetOrigin as c,colorRunOf as d,ColorWindow as u,startCanvasTyping as p,textMap as f}from"./chunk-NY7HHUGB.js";import{DEFAULT_COPY_WORDS as h}from"./chunk-33C6ALT5.js";import{useWords as m}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as g,isTypingTarget as v,frameRectToHost as y,CANVAS_TYPING_EVENT as w,drawnBox as b}from"./chunk-ILXP5VX5.js";import{find as k,ROOT_ID as S,getList as C,remove as I,parseZoneKey as E,move as x,duplicate as D,replaceNode as A,createNode as M,insert as O,normalizeData as z,createResolveCache as R,resolveNodeData as P,ROOT_SLOT as B}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as L,fieldsFrom as N,defaultsFrom as V}from"./chunk-NKB3KVAB.js";import{createContext as $,useEffect as K,useContext as j,useRef as Z,useSyncExternalStore as F,useState as H,useMemo as T,useCallback as W,useLayoutEffect as Y}from"react";import{jsx as q,jsxs as X,Fragment as U}from"react/jsx-runtime";import{createPortal as G}from"react-dom";import{registerModalEscapeInterceptor as J,FloatingBar as Q,TextToolbar as _,LinkPicker as ee}from"efficient-shell/ui";function te(e){return!["setData","setUi","set"].includes(e.type)}var ne=(e,t,n,o)=>{const r=C(e,t,E(n));return r?.[o]??null},oe=(e,t,n,o,r)=>{const i=ne(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function re(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 ie(e,t,n){return n?"node"===n.kind?k(e,t,n.id)?n:null:n.parentId===S?C(e,t,n)?n:null:k(e,t,n.parentId)&&C(e,t,n)?n:null:null}function le(e,t,n,r=!1){const{itemSelector:i,selectedSlot:l,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=o(e.data,t,i??null)),"selectedSlot"in n&&(l?a=(c=l)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function se(e,t,n){const o=ae(e,t,n);if(o===e)return e;const r=ie(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function ae(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 le(e,n,"function"==typeof t.ui?t.ui(re(e,n)):t.ui);case"set":{const r={data:o,ui:re(e,n)},i="function"==typeof t.state?t.state(r):t.state;let l=i.data?{...e,data:i.data}:e;return i.ui&&(l=le(l,n,i.ui,!0)),l}case"insert":{const r={...E(t.destinationZone),index:t.destinationIndex},i=M(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:O(o,n,r,i)}}case"replace":{const r=oe(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:A(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=oe(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=D(o,n,r.props.id),l=ne(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return ae(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=ne(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...E(t.destinationZone),index:t.destinationIndex};return{...e,data:x(o,n,r.props.id,i)}}case"remove":{const r=oe(o,n,t.zone,t.index,"remove");return{...e,data:I(o,n,r.props.id)}}default:return e}}var ce={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},de={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},ue=0,pe=()=>`history-${ue+=1}`;function fe(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let l=e.permissions??{};const s=z(e.data,t);let a={data:s,selection:null,ui:{...de}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;a={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...de,...i}}}let c=[{core:a,at:-1/0,sealed:!0,id:pe()}],d=0;const u=e=>{const t=c[d],n=r();!e&&d===c.length-1&&d>0&&!t.sealed&&n-t.at<i?c=[...c.slice(0,d),{...t,core:a,at:n}]:(c=[...c.slice(0,d+1),{core:a,at:n,sealed:e,id:pe()}],d=c.length-1)},p=/* @__PURE__ */new Set;let f=null,h=null,m=0,g=null,v=!1;const y=()=>{for(const e of[...p])e()},w=()=>{c=[...c.slice(0,d),{...c[d],core:a},...c.slice(d+1)]},b=(t,n)=>{m>0?v=v||n:(n?u(!1):a!==t&&w(),a.data!==t.data&&e.onChange?.(a.data),a!==t&&y())},S=e=>{const n=a;if(a=se(a,e,t),a===n)return;const o=e.recordHistory??te(e);b(n,o&&a.data!==n.data)},I=t=>{0===m&&(g=a,v=!1),m+=1;try{t()}catch(e){throw m-=1,0===m&&g&&(a=g,g=null),e}if(m-=1,m>0||!g)return;const n=g;g=null,v&&a.data!==n.data?u(!0):a!==n&&w(),a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},E=e=>{const n=a,o=ie(a.data,t,e);var r,i;(r=o,i=a.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(a={...a,selection:o},b(n,!1))},x=t=>{const n=a;d=t,a=c[d].core,a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},D=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...ce,...l,...n}};let M=D();const O=R(),B={resolveCache:O,async resolveAll({trigger:e="load",metadata:n}={}){const o=a.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[l,...s]=await Promise.all([P(r,t,{cache:O,trigger:e,metadata:n}),...i.map(o=>P(o,t,{cache:O,trigger:e,metadata:n}))]);I(()=>{const e=a;let n=a.data;s.forEach((e,r)=>{if(!e.didChange)return;const l=i[r].props.id,s=k(n,t,l)?.node;s&&s===k(o,t,l)?.node&&(n=A(n,t,l,e.node))}),l.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:l.node.props,readOnly:l.node.readOnly??n.root.readOnly}}),n!==a.data&&(a={...a,data:n,selection:ie(n,t,a.selection)},b(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=k(a.data,t,e)?.node;if(!r)return!1;const i=await P(r,t,{cache:O,trigger:n,metadata:o});if(!i.didChange)return!1;let l=!1;return I(()=>{const n=a;if(k(a.data,t,e)?.node!==r)return;const o=A(a.data,t,e,i.node);o!==a.data&&(a={...a,data:o,selection:ie(o,t,a.selection)},b(n,!1),l=!0)}),l},get config(){return t},getState(){if(f&&h===a)return f;const e=a,o={data:e.data,ui:re(e,t)},r="node"===e.selection?.kind?k(e.data,t,e.selection.id)?.node??null:null;return f={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:S,history:{back:()=>B.undo(),forward:()=>B.redo(),hasPast:d>0,hasFuture:d<c.length-1,histories:c.map(e=>({id:e.id,state:{data:e.core.data,ui:re(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<c.length&&e!==d&&x(e)}},getPermissions:M,getItemById:n=>k(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return C(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},h=e,f},subscribe:e=>(p.add(e),()=>{p.delete(e)}),dispatch:S,batch:I,group:()=>{const e=d,t=c[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,c[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(c=[...c.slice(0,d),{...c[d],sealed:!0},...c.slice(d+1)]));const o=c[d];c=[...c.slice(0,e+1),{...o,sealed:!0},...c.slice(d+1)],d=e+1}}},select:e=>E(e?{kind:"node",id:e}:null),selectSlot:e=>E(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){I(()=>{const n=a,o=void 0===e.select?a.selection:e.select;a={...a,data:e.data,selection:ie(e.data,t,o)},b(n,e.data!==n.data)})},load(e,n={}){const o=a,r=z(e,t);a={...a,data:r,selection:ie(r,t,n.selection??a.selection)},n.keepHistory||(c=[{core:a,at:-1/0,sealed:!0,id:pe()}],d=0),a!==o&&y()},undo(){d>0&&x(d-1)},redo(){d<c.length-1&&x(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,l)||(l=e,M=D(),f=null,y())},setConfig(e){e!==t&&(t=e,M=D(),f=null,y())}};return B}function he(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&v(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var me=$(null),ge=$(!0);function ve({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return K(()=>{n&&e.resolveAll()},[e,n]),K(()=>{if(t&&"undefined"!=typeof document)return he(document,e)},[e,t]),/* @__PURE__ */q(me.Provider,{value:e,children:/* @__PURE__ */q(ge.Provider,{value:t,children:o})})}function ye(){const e=j(me);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function we(e){const t=ye(),n=Z({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 F(t.subscribe,o,o)}function be(){return function(e){return we(e)}}var ke="data-puck-component",Se="data-puck-dropzone",Ce={},Ie="data-es-mirror",Ee="undefined"==typeof window?K:Y;function xe(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Ie}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Ie,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function De({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:l=!0,onDocument:s,height:a="auto",nonce:c}){const d=m("canvas",e),u=Z(null),[p,f]=H(null);return Ee(()=>{const e=u.current,t=p?.ownerDocument.defaultView;if("auto"!==a||!e||!p||!t)return;const n=()=>{e.style.height=`${Math.ceil(p.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(p),()=>r?.disconnect()},[p,a]),Ee(()=>{let e=u.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=u.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),g(e,c),f(t),s?.(e);let n=null;const o=u.current?.ownerDocument;if(l&&o){xe(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>xe(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */q("iframe",{ref:u,id:n,title:o??d.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:p?G(t,p):null})}var Ae=$(null),Me=$(Ce),Oe=[];function ze({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=ye(),s=we(n=>C(n.appState.data,l.config,{parentId:e,slot:t})??Oe),a=we(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==S),c=we(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=j(Ae),u=["es-zone"];return s.length&&u.push("has-children"),e===S&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==S&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */q("div",{className:u.join(" "),[Se]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */q(Ke,{node:e},e.props.id))})}function Re(e,t){return T(()=>{const n={};for(const o of L(N(e)))n[o]=function(e={}){/* @__PURE__ */
2
+ return q(ze,{parentId:t,slot:o,...e})};return n},[e,t])}function Pe(e){return T(()=>function({zone:t,...n}){/* @__PURE__ */
3
+ return q(ze,{parentId:e,slot:t,...n})},[e])}var Be=["top","bottom","zIndex"];function Le(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function Ne(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));Le(e,"position",t?"sticky":"relative");for(const n of Be)Le(e,n,t?.[n]??"");return!!t}var Ve="data-es-canvas-relative";function $e(e){e.hasAttribute(Ve)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(Ve));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(Ve,"")),!1)}function Ke({node:e}){const t=ye().config.components[e.type],n=e.props.id,o=Z(null),r=function(e,t){return T(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(ke),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(ke,e),n.setAttribute("data-puck-dnd",e),$e(n))},[e,t])}(n,o),i=Z(null),l=!!t?.inline;!function(e,t){const n=Z(!1),o=Z(()=>{});o.current=()=>{const o=e(),i=n.current;n.current=!!o&&t(o),i!==n.current&&r.current()};const r=Z(()=>{});Ee(()=>o.current()),Ee(()=>{const t=e(),i=t?.ownerDocument.defaultView;if(!t||!i)return;const l=()=>o.current();i.addEventListener("resize",l);const s=i.ResizeObserver,a=s?new s(l):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&i.MutationObserver&&(c=new i.MutationObserver(l),c.observe(e,{attributes:!0}))},r.current(),()=>{i.removeEventListener("resize",l),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>l?o.current:i.current,e=>l?$e(e):Ne(e));const s=j(Me),a=Re(t,n),c=Pe(n);if(!t?.render)return null;const d=t.render,u={...V(t),...e.props,...a},p={renderDropZone:c,isEditing:!0,dragRef:t.inline?r:null,metadata:{...s,...t.metadata}};return t.inline?/* @__PURE__ */q(d,{...u,puck:p,editMode:!0}):
4
+ /* @__PURE__ */q("div",{ref:i,[ke]:n,"data-puck-dnd":n,style:{position:"relative"},children:/* @__PURE__ */q(d,{...u,puck:p,editMode:!0})})}function je({metadata:e}){const t=we(e=>e.config),n=we(e=>e.appState.data.root).props??{},o=t.root?.render,r=Re(t.root,S),i=Pe(S),l=/* @__PURE__ */q(ze,{parentId:S,slot:B}),s=o?/* @__PURE__ */q(o,{id:"puck-root",...n,...r,puck:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:l}):l;/* @__PURE__ */
5
+ return q(Me.Provider,{value:e??Ce,children:s})}var Ze=$(void 0);function Fe(e,t,n){const[o,r]=H(null),i=Z(t);return i.current=t,Ee(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(null);let o=0;const l=()=>{o=0;const n=function(e,t){if(!e||!t)return null;const n=b(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(i.current?i.current(t):null,e.current?.parentElement??null);r(e=>{return(t=e)===(o=n)||t&&o&&t.top===o.top&&t.left===o.left&&t.width===o.width&&t.height===o.height?e:n;var t,o})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(l))};l();const a="MutationObserver"in n?new n.MutationObserver(s):null;a?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function He({id:e,kind:t,overlay:n}){const o=Z(null),r=Fe(o,e?t=>t.querySelector(`[${ke}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),i=/* @__PURE__ */q("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__ */q(n,{componentId:e,kind:t,children:i}):i}function Te(e,t,n){const o=f(e,n),r=o.text.length,i=e.ownerDocument;if(!t)return[r,r];let l=null;const s=i.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))l=o.at(s.offsetNode,s.offset);else{const n=i.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(l=o.at(n.startContainer,n.startOffset))}if(null===l)return[r,r];const a=o.text;let c=l,d=l;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;d<a.length&&!/\s/.test(a[d]);)d+=1;return[c,d]}function We({s:e,element:t,toolbar:n,label:o,keys:r}){const i=m("copy",h),l=e.pressed(),p=new Set(n.offered),f=n.colors&&n.colors.length>0?n.colors:null,g=Z(null),[v,w]=H(!1),[b,k]=H(null),S=v||null!==b,C=()=>{e.hold(),w(!1),k({href:e.pressed().href})},I=()=>{w(!1),k(null),e.resume()};Y(()=>{r.current={escape:()=>!!S&&(I(),!0),link:()=>!!p.has("link")&&(C(),!0)}}),Y(()=>()=>{r.current=null},[r]);const E=Z(I);E.current=I,K(()=>{if(v)return J(e=>{const t=g.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(E.current(),!0)},()=>g.current?.querySelector(".es-copy-colors"))},[v]),K(()=>{const n=g.current;if(!S||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const i=o=>{const r=o.target;if(r&&n.contains(r))return;w(!1),k(null);const i=t();r&&i&&i.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",i,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",i,!0)}},[S,e,t]),Y(()=>{const e=g.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(S&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,i=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,l=(i?s(i,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),d=o.ownerDocument.defaultView?.frameElement,u=d?y(d,{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top}):{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top},p=o.getBoundingClientRect(),f=d?y(d,{left:p.left,top:p.top,width:p.width,height:p.height}):{left:p.left,top:p.top,width:p.width,height:p.height},h=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),m={left:u.left,right:u.left+u.width,top:Math.min(u.top,f.top-6,h.top),bottom:Math.max(u.top+u.height,f.top+f.height+6,h.bottom)},v=e.ownerDocument.documentElement,w=(d??o.closest(".es-canvas")??o).getBoundingClientRect(),b={left:Math.max(0,w.left),top:Math.max(0,w.top),right:Math.min(v.clientWidth||w.right,w.right),bottom:Math.min(v.clientHeight||w.bottom,w.bottom)};if(b.right<=b.left||b.bottom<=b.top||0===n.offsetWidth)return;const k=a({anchor:m,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:w.left,top:w.top,right:w.right,bottom:w.bottom},clip:b,parent:c(n)});n.style.top=`${k.top}px`,n.style.left=`${k.left}px`,n.style.setProperty("--es-pop-point",`${k.point}px`),n.dataset.side=k.above?"above":"below"});const x=f?{run:d(l.color,f),open:v,onToggle:()=>{k(null),v?I():(e.hold(),w(!0))}}:void 0;/* @__PURE__ */
6
+ return q(Q,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?y(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */q("div",{ref:g,style:{width:"18rem"},children:/* @__PURE__ */q(_,{offered:p,pressed:l.marks,onMark:t=>{"link"===t?C():e.press(t)},color:x,linkOpen:null!==b,list:{pressed:l.list,onList:t=>e.list(t)},alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:l.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */X(U,{children:[v&&f?/* @__PURE__ */q(u,{colors:f,current:l.color,words:i.colors??h.colors,onPick:t=>e.color(t)}):null,b?
7
+ /* @__PURE__ */q(ee,{className:"es-copy-link es-copy-pop",value:b.href??"",onApply:t=>{k(null),e.link(t)},onRemove:null!==b.href?()=>{k(null),e.link(null)}:void 0,onCancel:I}):null]})})})})}function Ye({element:e}){const t=Z(null),n=Fe(t,()=>e(),e);/* @__PURE__ */
8
+ return q("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function qe({frame:t=!0,className:n,style:o,metadata:r,mirrorStyles:s,onDocument:a,height:c,title:d,nonce:u,hotkeys:f,frameWrapper:h,overlay:g,children:v,typing:y,passThrough:b}){const k=ye(),S=j(Ze),C=b??S,I=j(ge),E=m("canvas",e),x=f??I,[D,A]=H(void 0),M=we(e=>"node"===e.selection?.kind?e.selection.id:null),[O,z]=H(null),[R,P]=H(null),B=Z(null),[,L]=H(0),N=Z(y);N.current=y;const V=Z(null),$=Z(null),F=e=>{const t=$.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(w,{detail:{typing:e}}))},T=(e,t)=>{B.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=k.group(),r=e.element,i=p({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:Te(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>L(e=>e+1),onEscape:()=>V.current?.escape()??!1,onLinkKey:()=>V.current?.link()??!1,end:e=>{o.close(),B.current?.element===r&&(B.current=null),P(null),F(!1),N.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const l=n.closest?.(`[${ke}]`)?.getAttribute(ke);return l&&k.select(l),B.current={s:i,element:r,target:e},P(()=>r),z(null),F(!0),N.current?.onChange?.({typing:!0,element:n}),!0};K(()=>()=>B.current?.s.stop("stop"),[]);const W=e=>{const t=B.current?.element();return Boolean(t&&t.contains(e))},Y=e=>{const t=e.closest?.(`[${ke}]`)?.getAttribute(ke);if(!t)return;const n=k.getState(),o="node"===n.selection?.kind?n.selection.id:null;return l(n.appState.data,k.config,t,o,C)??t},U=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(B.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=N.current?.atSelection?.();n&&T(n,null)&&e.preventDefault()},G=/* @__PURE__ */X("div",{ref:$,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),B.current){if(W(t))return;B.current.s.stop("outside")}const n=Y(t);void 0===n?t.hasAttribute?.(Se)||k.select(null):k.select(n)},onDoubleClick:e=>{const t=N.current;if(!t||W(e.target))return;const n=t.at(e.target);n&&T(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>U(e),onMouseOver:e=>{if(B.current)return;const t=Y(e.target)??null;t!==O&&z(t)},onMouseLeave:()=>z(null),children:[
9
+ /* @__PURE__ */q(Ae.Provider,{value:O,children:/* @__PURE__ */q(je,{metadata:r})}),
10
10
  /* @__PURE__ */X("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
11
- /* @__PURE__ */Y(Te,{id:!R&&O&&O!==M?O:null,kind:"hover",overlay:g}),
12
- /* @__PURE__ */Y(Te,{id:R?null:M,kind:"selected",overlay:g}),R?/* @__PURE__ */Y(qe,{element:R}):null]}),v]}),G=h?/* @__PURE__ */Y(h,{document:D,children:J}):J;K(()=>{if(D&&x)return he(D,k)},[D,x,k]),K(()=>{if(!D)return;const e=e=>{if("Enter"===e.key)return void U(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=k.getState();if("node"!==n.selection?.kind)return;const o=i(n.appState.data,k.config,n.selection);"node"===o?.kind&&k.select(o.id)};return D.addEventListener("keydown",e),()=>D.removeEventListener("keydown",e)},[D,k]);/* @__PURE__ */
13
- return X("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":R?"":void 0,children:[R&&B.current?.target.toolbar?/* @__PURE__ */Y(We,{s:B.current.s,element:B.current.element,toolbar:B.current.target.toolbar,label:E.textTools,keys:V}):null,t?/* @__PURE__ */Y(De,{mirrorStyles:s,onDocument:e=>{A(e??void 0),a?.(e)},height:c,title:d,nonce:u,children:G}):/* @__PURE__ */Y("div",{id:"preview-frame","data-puck-entry":"",children:G})]})}function Xe(e={}){const t=ye(),n=we(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Ue(){const e=ye(),n=we(e=>e.config),o=e.resolveCache,r=we(e=>e.selectedItem),i=we(e=>e.appState.data.root),l=r?r.props.id:"root",s=i.props??{},a=H(()=>r||{type:"root",props:s},[r,s]),c=r?n.components[r.type]:n.root,d=e.getState(),u=r?k(d.appState.data,n,l):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,f=p?d.getItemById(p)??null:null,{fields:h}=t({id:l,node:a,block:c,parent:f,appState:d.appState}),m=we(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),g=W(t=>{(async()=>{const r=e.getState();if("root"!==l){const i=r.getItemById(l),s=r.getSelectorForId(l);if(!i||!s)return;const a={...i,props:{...i.props,...t}},{node:c}=await P(a,n,{cache:o,trigger:"replace"}),d=e.getState().getSelectorForId(l);if(!d)return;return void e.dispatch({type:"replace",destinationZone:d.zone??"root:default-zone",destinationIndex:d.index,data:c})}const i=r.appState.data.root.props??{},{node:s}=await P({type:"root",props:{...i,...t}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[e,n,o,l]),v=W((e,t)=>g({[e]:t}),[g]);return{id:l,node:a,fields:h,values:a.props,readOnly:m,onChange:v,onChangeMany:g}}export{De as CanvasFrame,Ze as CanvasPassThroughContext,de as DEFAULT_UI,Ye as EaselCanvas,ve as EaselProvider,je as EditDocument,he as bindUndoKeys,fe as createEasel,be as createUseEasel,te as recordsByDefault,se as reduce,re as uiView,we as useEasel,ye as useEaselApi,Xe as useEaselNodeOps,Ue as useSelectedFields,ie as validSelection};
11
+ /* @__PURE__ */q(He,{id:!R&&O&&O!==M?O:null,kind:"hover",overlay:g}),
12
+ /* @__PURE__ */q(He,{id:R?null:M,kind:"selected",overlay:g}),R?/* @__PURE__ */q(Ye,{element:R}):null]}),v]}),J=h?/* @__PURE__ */q(h,{document:D,children:G}):G;K(()=>{if(D&&x)return he(D,k)},[D,x,k]),K(()=>{if(!D)return;const e=e=>{if("Enter"===e.key)return void U(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=k.getState();if("node"!==n.selection?.kind)return;const o=i(n.appState.data,k.config,n.selection);"node"===o?.kind&&k.select(o.id)};return D.addEventListener("keydown",e),()=>D.removeEventListener("keydown",e)},[D,k]);/* @__PURE__ */
13
+ return X("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":R?"":void 0,children:[R&&B.current?.target.toolbar?/* @__PURE__ */q(We,{s:B.current.s,element:B.current.element,toolbar:B.current.target.toolbar,label:E.textTools,keys:V}):null,t?/* @__PURE__ */q(De,{mirrorStyles:s,onDocument:e=>{A(e??void 0),a?.(e)},height:c,title:d,nonce:u,children:J}):/* @__PURE__ */q("div",{id:"preview-frame","data-puck-entry":"",children:J})]})}function Xe(e={}){const t=ye(),n=we(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function Ue(){const e=ye(),n=we(e=>e.config),o=e.resolveCache,r=we(e=>e.selectedItem),i=we(e=>e.appState.data.root),l=r?r.props.id:"root",s=i.props??{},a=T(()=>r||{type:"root",props:s},[r,s]),c=r?n.components[r.type]:n.root,d=e.getState(),u=r?k(d.appState.data,n,l):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,f=p?d.getItemById(p)??null:null,{fields:h}=t({id:l,node:a,block:c,parent:f,appState:d.appState}),m=we(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),g=W(t=>{(async()=>{const r=e.getState();if("root"!==l){const i=r.getItemById(l),s=r.getSelectorForId(l);if(!i||!s)return;const a={...i,props:{...i.props,...t}},{node:c}=await P(a,n,{cache:o,trigger:"replace"}),d=e.getState().getSelectorForId(l);if(!d)return;return void e.dispatch({type:"replace",destinationZone:d.zone??"root:default-zone",destinationIndex:d.index,data:c})}const i=r.appState.data.root.props??{},{node:s}=await P({type:"root",props:{...i,...t}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[e,n,o,l]),v=W((e,t)=>g({[e]:t}),[g]);return{id:l,node:a,fields:h,values:a.props,readOnly:m,onChange:v,onChangeMany:g}}export{De as CanvasFrame,Ze as CanvasPassThroughContext,de as DEFAULT_UI,qe as EaselCanvas,ve as EaselProvider,je as EditDocument,he as bindUndoKeys,fe as createEasel,be as createUseEasel,te as recordsByDefault,se as reduce,re as uiView,we as useEasel,ye as useEaselApi,Xe as useEaselNodeOps,Ue as useSelectedFields,ie as validSelection};
@@ -1,6 +1,6 @@
1
- import{DEFAULT_PICK_WORDS as e}from"./chunk-ZAOM6PFH.js";import{parseHexColor as t,Popover as n,colorSwatchClasses as r,colorFill as l,ColorPickerPanel as i}from"efficient-shell/ui";export{hexToHsv,hsvToHex}from"efficient-shell/ui";import{useRef as a,useState as s,useLayoutEffect as o,useEffect as c}from"react";import{jsx as u,jsxs as p}from"react/jsx-runtime";var d=t,h=7,m=e=>e.toUpperCase(),g=(e,t,n)=>Math.min(n,Math.max(t,e));function f(e,t,n){return{s:n.width>0?g((e-n.left)/n.width,0,1):0,v:n.height>0?1-g((t-n.top)/n.height,0,1):0}}function v(e,t){return t.width>0?360*g((e-t.left)/t.width,0,1):0}function w(e){if(/^(data|blob):/i.test(e))return"";const t=(e.split(/[?#]/)[0]??"").split("/").filter(Boolean).pop()??"";try{return decodeURIComponent(t)}catch{return t}}function k({value:t,onChange:i,label:h,theme:g,caption:f,inherited:v,after:w,id:k,readOnly:x,words:y=e.colour}){const E=a(null),L=a(null),N=()=>{const e=E.current?.parentElement;return e?.classList.contains("es-field-head")?e.querySelector(":scope > .es-field-name .es-field-label"):e?.classList.contains("es-pick-line")?e.querySelector(":scope > .es-pick-line-label"):null},B=()=>L.current?.querySelector(".es-pick-hexwrap > *")??null,O=e=>e.scrollWidth>e.clientWidth+1,R=e=>{e&&(O(e)?e.dataset.clipped="true":delete e.dataset.clipped)},D=a(()=>{});D.current=()=>{R(N()),P||R(B())};const[T,M]=s(null),[P,S]=s(null);o(()=>D.current()),c(()=>{const e=E.current?.parentElement,t=e?.ownerDocument.defaultView;if(!e||!t?.ResizeObserver)return;const n=new t.ResizeObserver(()=>D.current());return n.observe(e),()=>n.disconnect()},[]),c(()=>{const e=E.current?.parentElement;if(!e)return;const t=e=>{const t=e;if(!t)return null;const n=N(),r=B();return n&&(t===n||n.contains(t))?n:r&&t===r?r:null},n=e=>{const n=t(e.target),r=U();if(!n||!r||n.ownerDocument.activeElement===n||!O(n))return;const l=n.getBoundingClientRect(),i=r.getBoundingClientRect(),a="INPUT"===n.tagName?n.value:n.textContent??"";M({text:a,left:l.left-i.left,top:l.top-i.top})},r=e=>{t(e.target)&&M(null)};return e.addEventListener("pointerover",n),e.addEventListener("pointerout",r),()=>{e.removeEventListener("pointerover",n),e.removeEventListener("pointerout",r)}},[]);const U=()=>{const e=E.current?.parentElement;return e&&(e.classList.contains("es-field-head")||e.classList.contains("es-pick-line"))?e:L.current},W=t?null:d(v??""),q=void 0===f||t&&d(f)===d(t)?null:f,F=q??(t?m(t):W?m(W):y.notSet);/* @__PURE__ */
2
- return u("div",{ref:E,className:"es-pick-colour",children:/* @__PURE__ */p("div",{ref:L,className:"es-pick-colour-row","data-editing":P??void 0,onFocus:e=>{const t=e.target,n=U();if(!n||!t.classList.contains("es-pick-hex"))return;M(null),t.style.setProperty("--es-pick-edit-room",n.getBoundingClientRect().right-t.getBoundingClientRect().left+"px");const r=t.parentElement?.nextElementSibling,l=!!r&&t.getBoundingClientRect().right>r.getBoundingClientRect().left-2;S(l?"over":"room")},onBlur:e=>{const t=e.target;t.classList.contains("es-pick-hex")&&(t.style.removeProperty("--es-pick-edit-room"),S(null))},children:[
3
- /* @__PURE__ */u(n,{id:k,className:"es-pick-swatch-wrap",trigger:/* @__PURE__ */u("span",{"aria-hidden":"true",style:{position:"absolute",inset:0,...l(t||W)}}),triggerLabel:y.swatch({label:h,shown:F}),triggerClassName:r({className:t?"es-pick-swatch":W?"es-pick-swatch is-inherited":"es-pick-swatch is-unset"}),"aria-label":y.dialog({label:h}),disabled:x,children:/* @__PURE__ */u(b,{value:t,onChange:i,label:h,theme:g,inherited:v,readOnly:x})}),
1
+ import{DEFAULT_PICK_WORDS as e}from"./chunk-643PVCEG.js";import{parseHexColor as t,Popover as n,colorSwatchClasses as r,colorFill as l,ColorPickerPanel as i}from"efficient-shell/ui";export{hexToHsv,hsvToHex}from"efficient-shell/ui";import{useRef as a,useState as s,useLayoutEffect as o,useEffect as c}from"react";import{jsx as u,jsxs as p}from"react/jsx-runtime";var d=t,h=7,m=e=>e.toUpperCase(),g=(e,t,n)=>Math.min(n,Math.max(t,e));function f(e,t,n){return{s:n.width>0?g((e-n.left)/n.width,0,1):0,v:n.height>0?1-g((t-n.top)/n.height,0,1):0}}function v(e,t){return t.width>0?360*g((e-t.left)/t.width,0,1):0}function w(e){if(/^(data|blob):/i.test(e))return"";const t=(e.split(/[?#]/)[0]??"").split("/").filter(Boolean).pop()??"";try{return decodeURIComponent(t)}catch{return t}}function k({value:t,onChange:i,label:h,theme:g,caption:f,inherited:v,after:w,id:k,readOnly:x,words:y=e.colour}){const E=a(null),L=a(null),N=()=>{const e=E.current?.parentElement;return e?.classList.contains("es-field-head")?e.querySelector(":scope > .es-field-name .es-field-label"):e?.classList.contains("es-pick-line")?e.querySelector(":scope > .es-pick-line-label"):null},B=()=>L.current?.querySelector(".es-pick-hexwrap > *")??null,R=e=>e.scrollWidth>e.clientWidth+1,O=e=>{e&&(R(e)?e.dataset.clipped="true":delete e.dataset.clipped)},D=a(()=>{});D.current=()=>{O(N()),S||O(B())};const[T,P]=s(null),[S,M]=s(null);o(()=>D.current()),c(()=>{const e=E.current?.parentElement,t=e?.ownerDocument.defaultView;if(!e||!t?.ResizeObserver)return;const n=new t.ResizeObserver(()=>D.current());return n.observe(e),()=>n.disconnect()},[]),c(()=>{const e=E.current?.parentElement;if(!e)return;const t=e=>{const t=e;if(!t)return null;const n=N(),r=B();return n&&(t===n||n.contains(t))?n:r&&t===r?r:null},n=e=>{const n=t(e.target),r=U();if(!n||!r||n.ownerDocument.activeElement===n||!R(n))return;const l=n.getBoundingClientRect(),i=r.getBoundingClientRect(),a="INPUT"===n.tagName?n.value:n.textContent??"";P({text:a,left:l.left-i.left,top:l.top-i.top})},r=e=>{t(e.target)&&P(null)};return e.addEventListener("pointerover",n),e.addEventListener("pointerout",r),()=>{e.removeEventListener("pointerover",n),e.removeEventListener("pointerout",r)}},[]);const U=()=>{const e=E.current?.parentElement;return e&&(e.classList.contains("es-field-head")||e.classList.contains("es-pick-line"))?e:L.current},W=t?null:d(v??""),q=void 0===f||t&&d(f)===d(t)?null:f,j=q??(t?m(t):W?m(W):y.notSet);/* @__PURE__ */
2
+ return u("div",{ref:E,className:"es-pick-colour",children:/* @__PURE__ */p("div",{ref:L,className:"es-pick-colour-row","data-editing":S??void 0,onFocus:e=>{const t=e.target,n=U();if(!n||!t.classList.contains("es-pick-hex"))return;P(null),t.style.setProperty("--es-pick-edit-room",n.getBoundingClientRect().right-t.getBoundingClientRect().left+"px");const r=t.parentElement?.nextElementSibling,l=!!r&&t.getBoundingClientRect().right>r.getBoundingClientRect().left-2;M(l?"over":"room")},onBlur:e=>{const t=e.target;t.classList.contains("es-pick-hex")&&(t.style.removeProperty("--es-pick-edit-room"),M(null))},children:[
3
+ /* @__PURE__ */u(n,{id:k,className:"es-pick-swatch-wrap",trigger:/* @__PURE__ */u("span",{"aria-hidden":"true",style:{position:"absolute",inset:0,...l(t||W)}}),triggerLabel:y.swatch({label:h,shown:j}),triggerClassName:r({className:t?"es-pick-swatch":W?"es-pick-swatch is-inherited":"es-pick-swatch is-unset"}),"aria-label":y.dialog({label:h}),disabled:x,children:/* @__PURE__ */u(b,{value:t,onChange:i,label:h,theme:g,inherited:v,readOnly:x})}),
4
4
  /* @__PURE__ */u("span",{className:"es-pick-hexwrap",children:null===q?/* @__PURE__ */u(C,{value:t,follows:W?m(W):void 0,onChange:e=>{x||e===t||i(e)},name:y.hex({label:h}),readOnly:x}):/* @__PURE__ */u("span",{className:"es-pick-caption",children:q})}),w,T?/* @__PURE__ */u("span",{className:"es-pick-tag","aria-hidden":"true",style:{left:T.left,top:T.top},children:T.text}):null]})})}function b({value:e,onChange:t,label:n,theme:r,onClose:l,id:a,inherited:s,readOnly:o,words:c,swatch:p,dragWrites:d="live"}){/* @__PURE__ */
5
5
  return u(i,{id:a,className:"es-pick-window",value:e,onChange:t,label:n,presets:r?.map(e=>({value:e.value,label:e.name})),fallback:s,dragWrites:d,disabled:o,onClose:l})}function C({value:e,follows:t,onChange:n,name:r,readOnly:l}){const[i,o]=s(null),c=a(!1);/* @__PURE__ */
6
6
  return u("input",{type:"text",className:!e&&t?"es-pick-hex is-inherited":"es-pick-hex",value:i??(e?m(e):t??""),"aria-label":r,maxLength:7,spellCheck:!1,autoComplete:"off",readOnly:l,onChange:t=>{o(t.target.value);const r=d(t.target.value);null!==r&&r!==e&&n(r)},onFocus:e=>e.currentTarget.select(),onMouseDown:e=>{c.current=e.currentTarget.ownerDocument.activeElement!==e.currentTarget},onMouseUp:e=>{c.current&&e.preventDefault(),c.current=!1},onKeyDown:e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),e.stopPropagation(),o(null),e.currentTarget.blur())},onBlur:()=>o(null)})}export{k as ColourPicker,b as ColourWindow,h as HEX_MAX_LENGTH,m as hexReadout,v as hueFromPoint,w as mediaName,f as svFromPoint,d as typedHex};
@@ -1,4 +1,4 @@
1
- import{PanelToggleIcon as e}from"./chunk-KQMML6JM.js";import{InspectorHead as n}from"./chunk-IE55HNMA.js";import{DEFAULT_CHROME_WORDS as i}from"./chunk-Z6PVRXVY.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{Tooltip as s,IconButton as t,Button as c}from"efficient-shell/ui";import{jsx as r,jsxs as l,Fragment as d}from"react/jsx-runtime";function a({icon:e,title:i,context:o,actions:s,side:t="left",onHide:c}){/* @__PURE__ */
1
+ import{PanelToggleIcon as e}from"./chunk-UMDQ6CLQ.js";import{InspectorHead as n}from"./chunk-IE55HNMA.js";import{DEFAULT_CHROME_WORDS as i}from"./chunk-Z6PVRXVY.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{Tooltip as s,IconButton as t,Button as c}from"efficient-shell/ui";import{jsx as r,jsxs as l,Fragment as d}from"react/jsx-runtime";function a({icon:e,title:i,context:o,actions:s,side:t="left",onHide:c}){/* @__PURE__ */
2
2
  return r(n,{icon:e,name:i,kind:o,actions:s||c?/* @__PURE__ */l(d,{children:[s,c?/* @__PURE__ */r(m,{side:t,onHide:c,divider:Boolean(s)}):null]}):void 0})}function m({side:n,onHide:c,divider:a=!1}){const m=o("chrome",i);/* @__PURE__ */
3
3
  return l(d,{children:[a?/* @__PURE__ */r("span",{className:"sf-head-divider","aria-hidden":"true"}):null,
4
4
  /* @__PURE__ */r(s,{content:m.hidePanel,side:"bottom",children:/* @__PURE__ */r(t,{className:"es-insp-iconbtn","aria-label":m.hidePanelLabel({side:n}),onClick:c,children:/* @__PURE__ */r(e,{side:n})})})]})}function h({side:n,onShow:c}){const l=o("chrome",i);/* @__PURE__ */
@@ -0,0 +1 @@
1
+ var e={colour:{notSet:"Not set",swatch:({label:e,shown:a})=>`${e}: ${a}`,dialog:({label:e})=>`${e} colour`,theme:"Theme colours",themeSwatchTitle:({name:e,hex:a})=>`${e} · ${a}`,themeSwatch:({name:e,hex:a})=>`${e} ${a}`,square:"Saturation and brightness",squareValue:({saturation:e,brightness:a})=>`Saturation ${e}, brightness ${a}`,hue:"Hue",hex:({label:e})=>`${e} hex code`},image:{choosing:"Choosing",failed:"The library could not be opened. Try again.",chooseImage:"Choose an image",chooseVideo:"Choose a video",empty:({label:e,kind:a,placeholder:o})=>`${e}: ${o??"choose "+("video"===a?"a video":"an image")}`,hint:"From the library, or upload one",named:({label:e,name:a})=>`${e}: ${a}`,replace:"Replace",replaceNamed:({label:e})=>`Replace ${e.toLowerCase()}`,remove:"Remove",removeNamed:({label:e})=>`Remove ${e.toLowerCase()}`}};export{e as DEFAULT_PICK_WORDS};
@@ -1,4 +1,4 @@
1
- import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-U7KFFC7N.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-VWXUMVCD.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{DropdownMenu as n}from"efficient-shell/ui";import{jsxs as c,Fragment as i,jsx as o}from"react/jsx-runtime";function l({choices:l,onPick:p}){const{Icon:a}=r(),m=t("screen",s),u=e(l).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */c(i,{children:[e.group," ",
1
+ import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-JRRYFSCY.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-VVPZMWJE.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{DropdownMenu as n}from"efficient-shell/ui";import{jsxs as c,Fragment as i,jsx as o}from"react/jsx-runtime";function l({choices:l,onPick:p}){const{Icon:a}=r(),m=t("screen",s),u=e(l).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */c(i,{children:[e.group," ",
2
2
  /* @__PURE__ */o("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(a,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
3
3
  return o(n,{align:"start",triggerClassName:"sf-add-card",items:u,trigger:/* @__PURE__ */c(i,{children:[
4
4
  /* @__PURE__ */o("span",{className:"sf-plus sf-plus--sm",children:"+"}),m.addBlockMenu]})})}export{l as AddBlockRow};
@@ -1 +1 @@
1
- import{useScreenDocument as n}from"./chunk-GCCBEY2W.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VWXUMVCD.js";import{EditNotice as r}from"./chunk-IE55HNMA.js";import{useWords as e}from"./chunk-MFIRYGHW.js";import{jsx as i}from"react/jsx-runtime";function t(){const{capabilities:t,access:c,takeOverEditing:a,viewReadOnly:s,saveConflict:m,reloadFromServer:u}=n(),{noun:l}=e("screen",o);return t.hasEditGuard?/* @__PURE__ */i(r,{access:c,conflict:m,noun:l,onTakeOver:a,onViewReadOnly:s,onReload:u}):null}export{t as PageEditGuardNotices};
1
+ import{useScreenDocument as n}from"./chunk-PS5BWS4I.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VVPZMWJE.js";import{EditNotice as r}from"./chunk-IE55HNMA.js";import{useWords as e}from"./chunk-MFIRYGHW.js";import{jsx as i}from"react/jsx-runtime";function t(){const{capabilities:t,access:c,takeOverEditing:a,viewReadOnly:s,saveConflict:m,reloadFromServer:u}=n(),{noun:l}=e("screen",o);return t.hasEditGuard?/* @__PURE__ */i(r,{access:c,conflict:m,noun:l,onTakeOver:a,onViewReadOnly:s,onReload:u}):null}export{t as PageEditGuardNotices};
@@ -1,2 +1,2 @@
1
- import{ScreenPartsProvider as t}from"./chunk-U7KFFC7N.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-SJPKSE5G.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
1
+ import{ScreenPartsProvider as t}from"./chunk-JRRYFSCY.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-5IUS6PM6.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
2
2
  return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
@@ -0,0 +1 @@
1
+ import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-643PVCEG.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VVPZMWJE.js";import{DEFAULT_CANVAS_WORDS as n}from"./chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as c}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as s}from"./chunk-KFV7N2DJ.js";import{DEFAULT_NODE_MENU_WORDS as f}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_COPY_WORDS as e}from"./chunk-33C6ALT5.js";import{DEFAULT_FIELDS_WORDS as i}from"./chunk-WRFD4EXD.js";import{DEFAULT_CHROME_WORDS as u,DEFAULT_NOTICE_WORDS as k}from"./chunk-Z6PVRXVY.js";import{DEFAULT_LOCK_WORDS as j}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as h}from"./chunk-2OAZYSWJ.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-AYWN5NRH.js";var a={notice:k,lock:j,save:p,chrome:u,rail:h,tree:c,panel:s,fields:i,pick:r,drag:l,menu:f,styleClipboard:t,copy:e,canvas:n,textStyles:o,screen:m},Y=o=>"object"==typeof o&&null!==o;function y(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:Y(n)?t[m]=Y(c)?y(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function D(o,r){return r?y(o,r):o}export{a as DEFAULT_EASEL_STRINGS,D as mergeEaselStrings};
@@ -1 +1 @@
1
- import{useScreenBlockRules as e}from"./chunk-U7KFFC7N.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-SJPKSE5G.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
1
+ import{useScreenBlockRules as e}from"./chunk-JRRYFSCY.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-5IUS6PM6.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};