efficient-easel 16.1.0 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/README.md +28 -65
  2. package/dist/autosave/index.d.ts +4 -4
  3. package/dist/blocks/index.d.ts +2 -2
  4. package/dist/chrome/index.d.ts +3 -3
  5. package/dist/chrome/index.js +1 -1
  6. package/dist/chunk-43AEUUNQ.js +1 -0
  7. package/dist/{chunk-K6EM4F5N.js → chunk-5VD2LGIZ.js} +18 -18
  8. package/dist/{chunk-ATOXCKEE.js → chunk-7TOQCTHV.js} +3 -3
  9. package/dist/chunk-A6Z4SD3I.js +10 -0
  10. package/dist/{chunk-V6VKM2QX.js → chunk-A7FF65FL.js} +1 -1
  11. package/dist/chunk-BHRC3ASL.js +1 -0
  12. package/dist/chunk-BRMYJBMB.js +8 -0
  13. package/dist/chunk-C2RHV42O.js +1 -0
  14. package/dist/chunk-F7FDF6NS.js +4 -0
  15. package/dist/{chunk-IE55HNMA.js → chunk-GWIVPLOX.js} +11 -11
  16. package/dist/{chunk-2H3W5OLQ.js → chunk-HGV3FWOB.js} +1 -1
  17. package/dist/chunk-LLDHIBYG.js +18 -0
  18. package/dist/chunk-M2Z775ZC.js +1 -0
  19. package/dist/{chunk-2L2L7G5L.js → chunk-MPF5QZJ7.js} +1 -1
  20. package/dist/chunk-N3VPBHR6.js +62 -0
  21. package/dist/chunk-QEAUF632.js +14 -0
  22. package/dist/{chunk-UVQR7W6I.js → chunk-RFE7ZG3Y.js} +1 -1
  23. package/dist/chunk-STWSCR25.js +2 -0
  24. package/dist/{chunk-TZIIRGVY.js → chunk-U277UX5I.js} +1 -1
  25. package/dist/chunk-VEZPDGDQ.js +1 -0
  26. package/dist/{chunk-JQOYUH4A.js → chunk-W2GEGVUY.js} +4 -4
  27. package/dist/{chunk-GPLMNRHR.js → chunk-WOETW3H6.js} +1 -1
  28. package/dist/chunk-X3TYRF5V.js +1 -0
  29. package/dist/{chunk-62VPYC7F.js → chunk-XDZHKYQX.js} +1 -1
  30. package/dist/{chunk-HV56SLR2.js → chunk-XHHVMAGM.js} +1 -1
  31. package/dist/chunk-XHSGRH42.js +5 -0
  32. package/dist/{chunk-XQGV2XAK.js → chunk-YI4QXOVJ.js} +1 -1
  33. package/dist/{chunk-RFSLDGDA.js → chunk-YLQYEDUQ.js} +1 -1
  34. package/dist/copy/index.js +23 -11
  35. package/dist/drag/drag.css +8 -0
  36. package/dist/drag/index.d.ts +15 -1
  37. package/dist/drag/index.js +1 -1
  38. package/dist/draw/client.js +1 -1
  39. package/dist/draw/index.js +1 -1
  40. package/dist/easel/easel.css +8 -0
  41. package/dist/easel/index.d.ts +45 -6
  42. package/dist/easel/index.js +1 -1
  43. package/dist/fields/index.js +1 -1
  44. package/dist/gold/gold.css +1 -1
  45. package/dist/{host-DGmdCaNL.d.ts → host-epHo7r8P.d.ts} +12 -5
  46. package/dist/icons/index.d.ts +0 -2
  47. package/dist/node-ops/index.d.ts +2 -2
  48. package/dist/node-ops/index.js +1 -1
  49. package/dist/panel/index.js +1 -1
  50. package/dist/{plan-CGREINRO.d.ts → plan-CZS902DV.d.ts} +27 -1
  51. package/dist/rail/index.d.ts +2 -2
  52. package/dist/screen/components/AddBlockRow.js +1 -1
  53. package/dist/screen/components/AddSidePanel.d.ts +6 -1
  54. package/dist/screen/components/AddSidePanel.js +1 -1
  55. package/dist/screen/components/MediaSidePanel.d.ts +4 -3
  56. package/dist/screen/components/MediaSidePanel.js +1 -1
  57. package/dist/screen/components/NodeContextMenu.d.ts +8 -7
  58. package/dist/screen/components/NodeContextMenu.js +1 -1
  59. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  60. package/dist/screen/components/SaveControls.d.ts +7 -6
  61. package/dist/screen/components/SaveControls.js +1 -1
  62. package/dist/screen/components/ScreenChrome.js +1 -1
  63. package/dist/screen/components/ScreenDocumentContext.d.ts +4 -3
  64. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  65. package/dist/screen/components/ScreenMount.d.ts +7 -6
  66. package/dist/screen/components/ScreenMount.js +1 -1
  67. package/dist/screen/components/ScreenStoreProvider.d.ts +7 -6
  68. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  69. package/dist/screen/components/SectionScreenShell.js +15 -15
  70. package/dist/screen/components/SidePanelHead.js +1 -1
  71. package/dist/screen/components/panel-widths.js +1 -1
  72. package/dist/screen/components/usePartBridge.d.ts +7 -6
  73. package/dist/screen/components/usePartBridge.js +1 -1
  74. package/dist/screen/index.d.ts +8 -7
  75. package/dist/screen/index.js +1 -1
  76. package/dist/screen/lib/admin-bridge.d.ts +3 -2
  77. package/dist/screen/lib/document-addressing.d.ts +4 -3
  78. package/dist/screen/lib/document-hooks.d.ts +2 -2
  79. package/dist/screen/lib/host-chrome.d.ts +0 -10
  80. package/dist/screen/lib/host.d.ts +4 -3
  81. package/dist/screen/lib/key-scope.js +1 -1
  82. package/dist/screen/lib/media-panel.d.ts +4 -3
  83. package/dist/screen/lib/media-picker.d.ts +7 -9
  84. package/dist/screen/lib/page-lock.d.ts +3 -2
  85. package/dist/screen/lib/puck/block-choice.d.ts +13 -1
  86. package/dist/screen/lib/puck/block-choice.js +1 -1
  87. package/dist/screen/lib/puck/device-fields.js +1 -1
  88. package/dist/screen/lib/puck/palette-sections.d.ts +2 -2
  89. package/dist/screen/lib/puck/section-doc.d.ts +2 -2
  90. package/dist/screen/lib/puck/slot-child-name.js +1 -1
  91. package/dist/screen/lib/puck/style-clipboard.d.ts +7 -6
  92. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  93. package/dist/screen/lib/puck/use-section-ops.d.ts +2 -2
  94. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  95. package/dist/screen/lib/save-status.d.ts +2 -2
  96. package/dist/screen/lib/screen-parts.d.ts +71 -29
  97. package/dist/screen/lib/screen-parts.js +1 -1
  98. package/dist/screen/lib/section-templates.d.ts +3 -2
  99. package/dist/screen/lib/session-context.d.ts +3 -2
  100. package/dist/screen/lib/session.d.ts +6 -2
  101. package/dist/screen/lib/shared-section-types.d.ts +71 -0
  102. package/dist/screen/lib/shared-section-types.js +1 -0
  103. package/dist/screen/lib/shared-sections.d.ts +34 -0
  104. package/dist/screen/lib/shared-sections.js +1 -0
  105. package/dist/screen/screen.css +7 -0
  106. package/dist/screen/words.d.ts +49 -3
  107. package/dist/screen/words.js +1 -1
  108. package/dist/shell/shell.css +6 -1
  109. package/dist/strings/index.d.ts +134 -20
  110. package/dist/strings/index.js +2 -2
  111. package/dist/text-styles/index.js +23 -23
  112. package/dist/tree/index.d.ts +3 -3
  113. package/dist/tree/index.js +1 -1
  114. package/dist/tree/tree.css +17 -0
  115. package/dist/{types-D8P9q-BG.d.ts → types-Bqq6ya0y.d.ts} +9 -0
  116. package/dist/{types-NQozKWEz.d.ts → types-Cq53lL8d.d.ts} +1 -1
  117. package/dist/{types-CsgMwHHa.d.ts → types-Cy7rdmXt.d.ts} +1 -1
  118. package/dist/{types-DGyDHiJV.d.ts → types-DT8ywrFQ.d.ts} +1 -1
  119. package/dist/{useNodeOps-BHRkUFfG.d.ts → useNodeOps-fIDWzftn.d.ts} +3 -1
  120. package/dist/{words-pgIK0I6g.d.ts → words-DkWcK1rh.d.ts} +2 -2
  121. package/package.json +16 -43
  122. package/dist/chunk-44COUKXO.js +0 -5
  123. package/dist/chunk-4BGYVIDQ.js +0 -57
  124. package/dist/chunk-4JSBIW5H.js +0 -9
  125. package/dist/chunk-ECM5F6JJ.js +0 -1
  126. package/dist/chunk-H4UMY7QF.js +0 -13
  127. package/dist/chunk-HMXIAMCU.js +0 -1
  128. package/dist/chunk-HQ4VVRIC.js +0 -1
  129. package/dist/chunk-IN22IYOM.js +0 -1
  130. package/dist/chunk-L2VGRQ4R.js +0 -4
  131. package/dist/chunk-L3GSW4XI.js +0 -1
  132. package/dist/chunk-POSLNRTO.js +0 -18
  133. package/dist/chunk-QX7GVECM.js +0 -13
  134. package/dist/chunk-TBF5CVPA.js +0 -1
  135. package/dist/chunk-U25CP5VX.js +0 -5
  136. package/dist/chunk-VVPZMWJE.js +0 -1
  137. package/dist/chunk-ZZ64CEC2.js +0 -2
  138. package/dist/gold/index.d.ts +0 -283
  139. package/dist/gold/index.js +0 -1
  140. package/dist/icons/meanings.d.ts +0 -1
  141. package/dist/icons/meanings.js +0 -1
  142. package/dist/index.d.ts +0 -6
  143. package/dist/index.js +0 -1
  144. package/dist/markup/index.d.ts +0 -1
  145. package/dist/markup/index.js +0 -1
  146. package/dist/shell/index.d.ts +0 -195
  147. package/dist/shell/index.js +0 -1
  148. package/dist/strings/catalogue.d.ts +0 -139
  149. package/dist/strings/catalogue.js +0 -1
package/README.md CHANGED
@@ -185,50 +185,12 @@ reuses `--es-rail-pad-y` rotated onto the row's ends and `--es-rail-gap` as-is.
185
185
 
186
186
  ## The gold layer — type in place
187
187
 
188
- `GoldTextInput` (subpath `efficient-easel/gold`, added in 0.3.0) is the surface a
189
- merchant types INTO on the page, with the markup formatting appearing as they
190
- type. A textarea whose own text is transparent sits on top of a layer holding the
191
- same characters, painted; what you read is the layer, what the caret walks is the
192
- box. Both inherit their type from whatever the host renders them inside, so the
193
- glyphs land on top of each other.
194
-
195
- It is **controlled and writes nothing** — no document, no sections, no Puck. The
196
- host owns the string and decides what a finished edit means.
197
-
198
- ```tsx
199
- 'use client';
200
- import { GoldTextInput } from 'efficient-easel/gold';
201
- import { STOREFRONT_MARKUP } from 'efficient-shell/markup';
202
- import 'efficient-easel/gold.css'; // once, from a client/global entry
203
-
204
- <GoldTextInput
205
- value={draft}
206
- rules={STOREFRONT_MARKUP}
207
- placeholder="Add a heading"
208
- ariaLabel="Section heading"
209
- onInput={setDraft}
210
- onCommit={(value) => save(value)} // blur, or Enter on a single-line field
211
- onCancel={(restored) => setDraft(restored)}
212
- />;
213
- ```
214
-
215
- | prop | type | default | notes |
216
- |---|---|---|---|
217
- | `value` | `string` | — | the authored string, delimiters and all |
218
- | `onInput` | `(value: string) => void` | — | every keystroke; the layer repaints from what you send back |
219
- | `onCommit` | `(value: string) => void` | — | blur, or Enter when `multiline` is false. Once per session, never if nothing was typed |
220
- | `onCancel` | `(restored: string) => void` | — | Escape. The argument is the value held at focus time; the host puts it back |
221
- | `multiline` | `boolean` | `false` | what Enter means, **not** how the text wraps — both modes wrap |
222
- | `placeholder` | `string` | — | visible until the first keystroke |
223
- | `className` | `string` | — | merged onto `.es-gold` |
224
- | `rules` | `readonly InlineRule[]` | `STANDARD_MARKUP` | pass your product's set — `STOREFRONT_MARKUP` / `CAMPAIGN_MARKUP` |
225
- | `ariaLabel` | `string` | — | in-place editing has no visible label |
226
-
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.
188
+ `GoldTextInput` is the surface a merchant types INTO on the page, with the
189
+ markup formatting appearing as they type: a textarea whose own text is
190
+ transparent sits on top of a layer holding the same characters, painted. Hosts
191
+ reach it through the copy box (`efficient-easel/copy`). Its own subpath,
192
+ `efficient-easel/gold`, was removed in 17.0.0, with no host importing it; the
193
+ stylesheet `efficient-easel/gold.css` stays, and the copy box needs it.
232
194
 
233
195
  **Two deliberate limits.** The asterisks are FADED, never removed. They go to
234
196
  nothing while the box is unfocused, so a merchant who is not typing does not read
@@ -241,23 +203,14 @@ earlier than the transparent box on top of it and every following line would be
241
203
  drawn over the wrong text. The real weight and slant appear on the page the
242
204
  moment the merchant clicks away.
243
205
 
244
- ## The text grammar — `efficient-easel/markup` (deprecated)
245
-
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.
251
-
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.
206
+ ## The text grammar — `efficient-shell/markup`
257
207
 
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.
208
+ The one grammar for copy a merchant types, in both editors, on the page and in
209
+ the email, is efficient-shell's (decision D1, Lewis 2026-10-12). Its marks,
210
+ exports and rules are documented in efficient-shell's README, "Editorial
211
+ markup — `efficient-shell/markup`". Easel keeps no copy: its own (1,498 lines)
212
+ was deleted on 2026-10-17, and the deprecated re-export `efficient-easel/markup`
213
+ in 17.0.0. Import `efficient-shell/markup`.
261
214
 
262
215
  ## The edit lock — two operators, one document
263
216
 
@@ -770,13 +723,23 @@ const up = ops.parentOf(selection); // null → render nothing
770
723
  The plain functions (`planRemove`, `planDuplicate`, `planMove`, `planStep`,
771
724
  `planPaste`, `planRestore`, `planSetProps`, `canStep`, `parentStep`) are
772
725
  exported too (`planRestore`, 7.0.0: put back exactly the node a delete took, at
773
- its place — the screen's "Undo"), and
726
+ its place — the screen's "Undo"; `planSwap`: another node in one's place, one
727
+ step — a shared section's Detach), and
774
728
  `efficient-easel/data` gains `copyNode` — a block with fresh ids, what a paste
775
729
  inserts. So are the canvas's click-through rule (3.2.0): `nodeChain` (the
776
730
  top-level block down to a node, by id) and `nextInChain` (what a click on that
777
731
  chain picks, given the selection), for a host that adds rungs of its own.
778
732
  Both take a `passThrough` (8.2.0): nodes a click walks past, no step of the
779
733
  chain; the canvas reads it from `CanvasPassThroughContext` or its own prop.
734
+ A node many pages use live has a green outline: the canvas asks
735
+ `CanvasSharedContext` (`(id) => boolean`) of each node it outlines, and the
736
+ screen provides it from the layer's `pinned.sharedReach`.
737
+ A host's PARTS join the chain (W0): through `CanvasPartsContext` (a
738
+ `CanvasParts`: `partAt(target, ownerId)`, `selected()`, `select(partId)`) a
739
+ host says which part of the innermost block is under the pointer, and
740
+ `clickPickPart` puts it after its block: a container's part is one more rung, a
741
+ block with no lists is picked with its part at once. The hover outline draws
742
+ the part (`is-hover-part`); Escape lets a part go before it climbs.
780
743
 
781
744
  ## Autosave — `efficient-easel/autosave`
782
745
 
@@ -1372,10 +1335,10 @@ const german: DeepPartial<EaselStrings> = {
1372
1335
  - **`useEaselLocale()`** is the provider's `locale` (`'en'` with none), for a
1373
1336
  host's own blocks and fields. The engine does not read it.
1374
1337
  - **A server file may import it.** Importing the entry runs nothing — the React
1375
- context is made on first use. `efficient-easel/strings/catalogue` is the
1376
- catalogue, its types and `mergeEaselStrings` with no React in its graph at
1377
- all: what a host's own test imports to check its languages against the
1378
- engine's keys.
1338
+ context is made on first use — so a host's own test imports
1339
+ `DEFAULT_EASEL_STRINGS` from here to check its languages against the engine's
1340
+ keys. (The separate `efficient-easel/strings/catalogue` subpath was removed
1341
+ in 17.0.0, with no host importing it.)
1379
1342
 
1380
1343
  - **The assembled screen hands its own leaves their words** (3.1.0). Under
1381
1344
  `EaselStringsProvider`, `efficient-easel/screen` draws every word of its own
@@ -1,9 +1,9 @@
1
1
  import { a as Autosave, A as AutosaveSnapshot, b as AutosaveOptions } from '../engine-CvXpFE86.js';
2
2
  export { c as AutosaveClock, d as createAutosave } from '../engine-CvXpFE86.js';
3
- import { a as SaveIndicator } from '../words-pgIK0I6g.js';
4
- export { S as SaveWords, s as saveIndicator } from '../words-pgIK0I6g.js';
5
- import '../types-DGyDHiJV.js';
6
- import '../types-CsgMwHHa.js';
3
+ import { S as SaveIndicator } from '../words-DkWcK1rh.js';
4
+ export { a as SaveWords, s as saveIndicator } from '../words-DkWcK1rh.js';
5
+ import '../types-DT8ywrFQ.js';
6
+ import '../types-Cy7rdmXt.js';
7
7
  import '../wordFit-7XpmhcaW.js';
8
8
  import 'react';
9
9
  import '../edit-lock/index.js';
@@ -1,9 +1,9 @@
1
1
  import { ReactElement, FC, CSSProperties, ReactNode, JSX } from 'react';
2
- import { P as Permissions, A as AppState } from '../types-NQozKWEz.js';
2
+ import { P as Permissions, A as AppState } from '../types-Cq53lL8d.js';
3
3
  import '../data/index.js';
4
4
  import '../types-41704JE4.js';
5
5
  import '../resolve-D68pb3Bx.js';
6
- import '../plan-CGREINRO.js';
6
+ import '../plan-CZS902DV.js';
7
7
 
8
8
  /**
9
9
  * efficient-easel/blocks — how a block is WRITTEN: its config, its fields, the
@@ -1,10 +1,10 @@
1
1
  import * as react from 'react';
2
- import { T as TopBarProps, b as TopBarClusterProps, c as TopBarRailProps, E as EaselIconButtonProps, d as DeviceSwitchProps, e as SaveStateProps, f as SaveStateToggleProps, g as SaveIconProps, a as SaveIconState, h as SaveIconTone, P as PanelResizeHandleProps, I as InspectorHeadProps, i as InspectorIconButtonProps, j as InspectorUpLevelProps, M as MediaPanelHeadProps, k as MediaPickKind, l as EditNoticeProps } from '../types-DGyDHiJV.js';
3
- export { D as DeviceOption, R as RailWordsShown, S as SaveTone } from '../types-DGyDHiJV.js';
2
+ import { T as TopBarProps, b as TopBarClusterProps, c as TopBarRailProps, E as EaselIconButtonProps, d as DeviceSwitchProps, e as SaveStateProps, f as SaveStateToggleProps, g as SaveIconProps, a as SaveIconState, h as SaveIconTone, P as PanelResizeHandleProps, I as InspectorHeadProps, i as InspectorIconButtonProps, j as InspectorUpLevelProps, M as MediaPanelHeadProps, k as MediaPickKind, l as EditNoticeProps } from '../types-DT8ywrFQ.js';
3
+ export { D as DeviceOption, R as RailWordsShown, S as SaveTone } from '../types-DT8ywrFQ.js';
4
4
  import { C as ChromeWords, N as NoticeWords } from '../words-BpiVrsW5.js';
5
5
  import { LockWords, EditAccess, SaveConflict } from '../edit-lock/index.js';
6
6
  export { D as DEFAULT_PANEL_W, M as MAX_PANEL_W, a as MIN_PANEL_W, P as PanelSide, b as PanelWidths, c as clampPanelWidth, p as panelWidthVars, s as setPanelWidthVars } from '../panelWidths-D9hTLR25.js';
7
- import '../types-CsgMwHHa.js';
7
+ import '../types-Cy7rdmXt.js';
8
8
  import '../wordFit-7XpmhcaW.js';
9
9
 
10
10
  /**
@@ -1 +1 @@
1
- export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MediaPanelHead,PanelResizeHandle,SaveIcon,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,headWords,mediaPickKind,panelWidthVars,saveIconTone,setPanelWidthVars}from"../chunk-IE55HNMA.js";import"../chunk-Z6PVRXVY.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-MFIRYGHW.js";
1
+ export{DEFAULT_PANEL_W,DeviceSwitch,EaselIconButton,EaselTopBar,EditNotice,InspectorHead,InspectorIconButton,InspectorUpLevel,MAX_PANEL_W,MIN_PANEL_W,MediaPanelHead,PanelResizeHandle,SaveIcon,SaveState,SaveStateToggle,TopBarCluster,TopBarDivider,TopBarRail,clampPanelWidth,editNotice,headWords,mediaPickKind,panelWidthVars,saveIconTone,setPanelWidthVars}from"../chunk-GWIVPLOX.js";import"../chunk-MJM6SFD3.js";import"../chunk-Z6PVRXVY.js";import"../chunk-2OAZYSWJ.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MFIRYGHW.js";
@@ -0,0 +1 @@
1
+ import{WebsiteBackendError as e}from"./chunk-KCOBHPN6.js";import{backendOf as r}from"./chunk-RSCMJIWS.js";var s=()=>Promise.reject(new e("unavailable","This editor's backend keeps no shared sections.")),o={list:()=>Promise.resolve([]),create:s,remove:s};function t(e){return Boolean(r(e).sharedSections)}var n=e=>r(e).sharedSections??o;function a(e){return e.cache("easel:shared-sections",()=>({list:()=>n(e).list(),create:(r,s)=>n(e).create(r,s),remove:r=>n(e).remove(r)}))}export{t as keepsSharedSections,a as sharedSectionsOf};
@@ -1,21 +1,21 @@
1
- import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{TreeSeam as t}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as l}from"./chunk-K56YDHYQ.js";import{easelMenuEntries as a}from"./chunk-BALFHI3G.js";import{SETTINGS_BUCKETS as r,SettingsGroup as o}from"./chunk-RC25EGHD.js";import{DEFAULT_PANEL_WORDS as i}from"./chunk-KFV7N2DJ.js";import{useTreeDrag as s,gapToMoveIndex as c}from"./chunk-67GNT6PF.js";import{withTip as d}from"./chunk-P2VEMZH5.js";import{FieldNumber as u}from"./chunk-2XMHLXMA.js";import{FieldSelect as m}from"./chunk-G3GWAP5R.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-WRFD4EXD.js";import{SettingsField as p,SettingsSegmented as f}from"./chunk-36LVP5WD.js";import{useWords as b}from"./chunk-MFIRYGHW.js";import{Textarea as g,Input as v,SortableList as y,ListRow as k,ContextMenu as x,tabPanelId as w,Tabs as C,tabButtonId as N}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as O,useState as j,useLayoutEffect as $,useId as D}from"react";import{jsx as S,jsxs as I}from"react/jsx-runtime";import{ChevronIcon as P,LockIcon as L,MoveUpIcon as F,MoveDownIcon as M,DuplicateIcon as R,TrashIcon as E}from"efficient-shell/icons/efficient";function W({id:e,value:n,onChange:t,placeholder:l,multiline:a=!1,rows:r=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */S(g,{id:e,size:"sm",className:"es-fin",value:c,rows:r,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */S(v,{id:e,size:"sm",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function A(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function H(e,n,t){const l=e.slice(),[a]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,a),l}function T(e,n){return e.filter((e,t)=>t!==n)}function z(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var B='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',G={parentId:"list",slot:"items"};function K({label:e,icon:n,noun:r,items:o,onChange:i,newItem:u,summary:m,itemName:p,thumb:f,min:g=0,max:v,readOnly:w=!1,open:C,onOpen:N,renderItem:D,renderRow:W,canRemove:K,lockedReason:V,fixed:X=!1,removeOnRow:J=!0,canDuplicate:Y,above:q,head:Q=!0}){const Z=b("fields",h).list,U=b("tree",l),_=r??Z.item,ee=!w&&!X&&("number"!=typeof v||o.length<v),ne=o.length<=g,te=e=>!!K&&!K(o[e],e),le=e=>!w&&!X&&J&&!ne&&!te(e),ae=e=>ee&&(!Y||Y(o[e],e)),re=(e,n)=>p?p(e,n):Z.itemName({noun:_,n:n+1}),oe=O([]),ie=O(null),[se,ce]=j(null),de=O(null),[ue,me]=j(null),[he,pe]=j("");$(()=>{const e=ie.current;if(!e)return;ie.current=null;const n=oe.current[e.index]?.querySelectorAll(B)[e.nth]??oe.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const fe=(e,n)=>{if(n<0||n>=o.length||n===e)return;const t=oe.current[e],l=t?.ownerDocument.activeElement;if(t&&l&&t.contains(l)){const e=[...t.querySelectorAll(B)].indexOf(l),a=l;ie.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}i(H(o,e,n));const a=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}(C,e,n);a!==C&&N(a),pe(Z.moved({n:n+1,total:o.length}))},be=e=>{ee&&(i(A(o,e,u())),W?(ie.current={index:e,nth:0,start:null,end:null},null!==C&&C>=e&&N(C+1)):N(e))},ge=e=>{le(e)&&(i(T(o,e)),C===e?N(null):null!==C&&C>e&&N(C-1))},ve=s({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===G.parentId&&n.slot===G.slot,onDrop:(e,n)=>{const t=c({...G,index:e},n);t!==e&&fe(e,t)},onStep:(e,n)=>fe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<o.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:Z.moveUp,icon:/* @__PURE__ */S(F,{size:14}),shortcut:"⌥↑",onClick:()=>fe(e,e-1)}),e<o.length-1&&n.push({label:Z.moveDown,icon:/* @__PURE__ */S(M,{size:14}),shortcut:"⌥↓",onClick:()=>fe(e,e+1)}),ae(e)&&n.push({label:Z.duplicate,icon:/* @__PURE__ */S(R,{size:14}),onClick:()=>(e=>{ae(e)&&(i(A(o,e+1,z(o[e]))),null!==C&&C>e&&N(C+1))})(e)}),le(e)&&n.push({label:Z.delete,icon:/* @__PURE__ */S(E,{size:14}),danger:!0,onClick:()=>ge(e)}),n},ke=(e,n,t,l)=>{w||0===ye(e).length||me({index:e,x:n,y:t,owner:l})},xe=e=>n=>{const t=o.slice();t[e]=n,i(t)};/* @__PURE__ */
2
- return I("div",{className:"es-list",children:[Q?/* @__PURE__ */I("div",{className:"es-list-head",children:[
1
+ import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{TreeSeam as t}from"./chunk-A6Z4SD3I.js";import{easelMenuEntries as l}from"./chunk-BALFHI3G.js";import{DEFAULT_TREE_WORDS as a}from"./chunk-K56YDHYQ.js";import{SETTINGS_BUCKETS as r,SettingsGroup as o}from"./chunk-RC25EGHD.js";import{DEFAULT_PANEL_WORDS as i}from"./chunk-KFV7N2DJ.js";import{FieldNumber as s}from"./chunk-2XMHLXMA.js";import{FieldSelect as c}from"./chunk-G3GWAP5R.js";import{DEFAULT_FIELDS_WORDS as d}from"./chunk-WRFD4EXD.js";import{SettingsField as u,SettingsSegmented as m}from"./chunk-36LVP5WD.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{useTreeDrag as p,gapToMoveIndex as f}from"./chunk-67GNT6PF.js";import{withTip as b}from"./chunk-P2VEMZH5.js";import{Textarea as g,Input as v,SortableList as y,ListRow as k,ContextMenu as x,tabPanelId as w,Tabs as C,tabButtonId as N}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as O,useState as j,useLayoutEffect as D,useId as $}from"react";import{jsx as S,jsxs as I}from"react/jsx-runtime";import{ChevronIcon as P,LockIcon as L,MoveUpIcon as F,MoveDownIcon as M,DuplicateIcon as R,TrashIcon as A}from"efficient-shell/icons/efficient";function E({id:e,value:n,onChange:t,placeholder:l,multiline:a=!1,rows:r=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */S(g,{id:e,size:"sm",className:"es-fin",value:c,rows:r,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */S(v,{id:e,size:"sm",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function T(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function W(e,n,t){const l=e.slice(),[a]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,a),l}function z(e,n){return e.filter((e,t)=>t!==n)}function H(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var B='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',G={parentId:"list",slot:"items"};function K({label:e,icon:n,noun:r,items:o,onChange:i,newItem:s,summary:c,itemName:u,thumb:m,min:g=0,max:v,readOnly:w=!1,open:C,onOpen:N,renderItem:$,renderRow:E,canRemove:K,lockedReason:V,fixed:X=!1,removeOnRow:Y=!0,canDuplicate:J,above:Z,head:q=!0}){const Q=h("fields",d).list,U=h("tree",a),_=r??Q.item,ee=!w&&!X&&("number"!=typeof v||o.length<v),ne=o.length<=g,te=e=>!!K&&!K(o[e],e),le=e=>!w&&!X&&Y&&!ne&&!te(e),ae=e=>ee&&(!J||J(o[e],e)),re=(e,n)=>u?u(e,n):Q.itemName({noun:_,n:n+1}),oe=O([]),ie=O(null),[se,ce]=j(null),de=O(null),[ue,me]=j(null),[he,pe]=j("");D(()=>{const e=ie.current;if(!e)return;ie.current=null;const n=oe.current[e.index]?.querySelectorAll(B)[e.nth]??oe.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const fe=(e,n)=>{if(n<0||n>=o.length||n===e)return;const t=oe.current[e],l=t?.ownerDocument.activeElement;if(t&&l&&t.contains(l)){const e=[...t.querySelectorAll(B)].indexOf(l),a=l;ie.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}i(W(o,e,n));const a=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}(C,e,n);a!==C&&N(a),pe(Q.moved({n:n+1,total:o.length}))},be=e=>{ee&&(i(T(o,e,s())),E?(ie.current={index:e,nth:0,start:null,end:null},null!==C&&C>=e&&N(C+1)):N(e))},ge=e=>{le(e)&&(i(z(o,e)),C===e?N(null):null!==C&&C>e&&N(C-1))},ve=p({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===G.parentId&&n.slot===G.slot,onDrop:(e,n)=>{const t=f({...G,index:e},n);t!==e&&fe(e,t)},onStep:(e,n)=>fe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<o.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:Q.moveUp,icon:/* @__PURE__ */S(F,{size:14}),shortcut:"⌥↑",onClick:()=>fe(e,e-1)}),e<o.length-1&&n.push({label:Q.moveDown,icon:/* @__PURE__ */S(M,{size:14}),shortcut:"⌥↓",onClick:()=>fe(e,e+1)}),ae(e)&&n.push({label:Q.duplicate,icon:/* @__PURE__ */S(R,{size:14}),onClick:()=>(e=>{ae(e)&&(i(T(o,e+1,H(o[e]))),null!==C&&C>e&&N(C+1))})(e)}),le(e)&&n.push({label:Q.delete,icon:/* @__PURE__ */S(A,{size:14}),danger:!0,onClick:()=>ge(e)}),n},ke=(e,n,t,l)=>{w||0===ye(e).length||me({index:e,x:n,y:t,owner:l})},xe=e=>n=>{const t=o.slice();t[e]=n,i(t)};/* @__PURE__ */
2
+ return I("div",{className:"es-list",children:[q?/* @__PURE__ */I("div",{className:"es-list-head",children:[
3
3
  /* @__PURE__ */I("span",{className:"es-list-label",children:[n?/* @__PURE__ */S("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
4
- /* @__PURE__ */S("span",{className:"es-list-count",children:o.length})]}):null,q?/* @__PURE__ */S("div",{className:"es-list-above",children:q}):null,o.length?/* @__PURE__ */I(y,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[o.map((e,n)=>{const l=ve.row({item:n,place:{...G,index:n}}),a=l.draggable&&se!==n,r=!W&&C===n,o=!w&&!X&&J&&te(n),i=["es-list-row",W?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",l.dragging?"is-dragging":"",l.drop?`is-drop-${l.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */S(t,{...ve.seam({place:{...G,index:n}}),onAdd:ee?()=>be(n):void 0,label:Z.addHere({noun:_})},`seam-${n}`):null,
5
- /* @__PURE__ */S(k,{className:i,flat:!!W,active:r,draggable:l.draggable,dragHint:U.dragHint,dragging:l.dragging,drop:"before"===l.drop||"after"===l.drop?l.drop:void 0,onMove:l.draggable?e=>fe(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{oe.current[n]=e},rowProps:{...l.rowProps,draggable:a||void 0,onPointerDown:e=>{const t=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!t&&t===t.ownerDocument.activeElement;e.currentTarget.draggable=l.draggable&&!a,de.current=t&&!a?t:null,ce(a?n:null)},onDragStart:e=>{const n=de.current;de.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),l.rowProps.onDragStart?.(e)},onContextMenu:e=>{w||(e.preventDefault(),e.stopPropagation(),ke(n,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const t=e.currentTarget.ownerDocument,l=e=>e.preventDefault();t.addEventListener("contextmenu",l,{capture:!0,once:!0}),t.defaultView?.setTimeout(()=>t.removeEventListener("contextmenu",l,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void ke(n,a.left+24,a.bottom,e.currentTarget)}l.rowProps.onKeyDown?.(e)}},actions:w||X||!J?void 0:o?d(V?V(e,n):Z.locked,/* @__PURE__ */S("span",{className:"es-list-lock",role:"img","aria-label":V?V(e,n):Z.locked,children:/* @__PURE__ */S(L,{size:13})})):d(Z.deleteItem({noun:_}),/* @__PURE__ */S("button",{type:"button",className:"es-list-x","aria-label":Z.deleteItem({noun:_}),disabled:!le(n),onClick:()=>ge(n),children:"×"})),below:r?/* @__PURE__ */S("div",{className:"es-list-item",children:D(e,n,xe(n))}):void 0,children:W?/* @__PURE__ */S("div",{className:"es-list-row-main",children:W(e,n,xe(n))}):/* @__PURE__ */I("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>N(r?null:n),children:[f?/* @__PURE__ */S("span",{className:"es-list-thumb","aria-hidden":"true",children:f(e,n)}):null,
6
- /* @__PURE__ */S("span",{className:"es-list-row-name",children:re(e,n)}),/* @__PURE__ */S("span",m?{className:"es-list-row-summary",children:m(e,n)}:{className:"es-list-row-summary"}),
4
+ /* @__PURE__ */S("span",{className:"es-list-count",children:o.length})]}):null,Z?/* @__PURE__ */S("div",{className:"es-list-above",children:Z}):null,o.length?/* @__PURE__ */I(y,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[o.map((e,n)=>{const l=ve.row({item:n,place:{...G,index:n}}),a=l.draggable&&se!==n,r=!E&&C===n,o=!w&&!X&&Y&&te(n),i=["es-list-row",E?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",l.dragging?"is-dragging":"",l.drop?`is-drop-${l.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */S(t,{...ve.seam({place:{...G,index:n}}),onAdd:ee?()=>be(n):void 0,label:Q.addHere({noun:_})},`seam-${n}`):null,
5
+ /* @__PURE__ */S(k,{className:i,flat:!!E,active:r,draggable:l.draggable,dragHint:U.dragHint,dragging:l.dragging,drop:"before"===l.drop||"after"===l.drop?l.drop:void 0,onMove:l.draggable?e=>fe(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{oe.current[n]=e},rowProps:{...l.rowProps,draggable:a||void 0,onPointerDown:e=>{const t=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!t&&t===t.ownerDocument.activeElement;e.currentTarget.draggable=l.draggable&&!a,de.current=t&&!a?t:null,ce(a?n:null)},onDragStart:e=>{const n=de.current;de.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),l.rowProps.onDragStart?.(e)},onContextMenu:e=>{w||(e.preventDefault(),e.stopPropagation(),ke(n,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const t=e.currentTarget.ownerDocument,l=e=>e.preventDefault();t.addEventListener("contextmenu",l,{capture:!0,once:!0}),t.defaultView?.setTimeout(()=>t.removeEventListener("contextmenu",l,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void ke(n,a.left+24,a.bottom,e.currentTarget)}l.rowProps.onKeyDown?.(e)}},actions:w||X||!Y?void 0:o?b(V?V(e,n):Q.locked,/* @__PURE__ */S("span",{className:"es-list-lock",role:"img","aria-label":V?V(e,n):Q.locked,children:/* @__PURE__ */S(L,{size:13})})):b(Q.deleteItem({noun:_}),/* @__PURE__ */S("button",{type:"button",className:"es-list-x","aria-label":Q.deleteItem({noun:_}),disabled:!le(n),onClick:()=>ge(n),children:"×"})),below:r?/* @__PURE__ */S("div",{className:"es-list-item",children:$(e,n,xe(n))}):void 0,children:E?/* @__PURE__ */S("div",{className:"es-list-row-main",children:E(e,n,xe(n))}):/* @__PURE__ */I("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>N(r?null:n),children:[m?/* @__PURE__ */S("span",{className:"es-list-thumb","aria-hidden":"true",children:m(e,n)}):null,
6
+ /* @__PURE__ */S("span",{className:"es-list-row-name",children:re(e,n)}),/* @__PURE__ */S("span",c?{className:"es-list-row-summary",children:c(e,n)}:{className:"es-list-row-summary"}),
7
7
  /* @__PURE__ */S(P,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},n)]}),
8
- /* @__PURE__ */S(t,{...ve.seam({place:{...G,index:o.length}})})]}):null,w||X?null:/* @__PURE__ */S("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>be(o.length),children:Z.add({noun:_})}),
8
+ /* @__PURE__ */S(t,{...ve.seam({place:{...G,index:o.length}})})]}):null,w||X?null:/* @__PURE__ */S("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>be(o.length),children:Q.add({noun:_})}),
9
9
  /* @__PURE__ */S("span",{className:"es-list-said","aria-live":"polite",children:he}),ue&&ue.index<o.length?
10
- /* @__PURE__ */S(x,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),items:a(ye(ue.index))}):null]})}var V=e=>e<6?e+1:6,X=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function J({field:e,name:t,id:l,value:a,onChange:r,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=j(!0),p=a&&"object"==typeof a?a:{};/* @__PURE__ */
11
- return S(o,{id:`${l}-group`,title:X(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */S(q,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>r({...p,[e]:n}),readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:V(u)},e))})}function Y({field:e,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=j(null),f=u?d??null:h,b=u??p,g=Array.isArray(a)?a:[],v=e.getItemSummary;/* @__PURE__ */
12
- return S(K,{label:X(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:r,newItem:()=>z({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:o,open:f,onOpen:b,renderItem:(a,r,d)=>Object.entries(n(e.arrayFields,{values:a,context:s})).map(([e,n])=>/* @__PURE__ */S(q,{field:n,name:`${t}[${r}].${e}`,id:`${l}-${r}-${e}`,value:a?.[e],onChange:n=>d({...a,[e]:n}),readOnly:o,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function q(e){const{field:n,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,renderers:s}=e;if(!n||n.marker||!1===n.visible)return null;const c=s?.[n.type];if(c)return c({field:n,name:t,id:l,value:a,onChange:r,readOnly:o});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:a,onChange:r,readOnly:o};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
13
- return S(p,{label:X(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(W,{id:l,value:"string"==typeof a?a:null==a?"":String(a),onChange:r,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:o})});case"number":/* @__PURE__ */
14
- return S(p,{label:X(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(u,{id:l,value:"number"==typeof a?a:void 0,onChange:r,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:o})});case"select":{const e=`${l}-label`;/* @__PURE__ */
15
- return S(p,{label:X(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(m,{id:l,value:a,options:n.options,onChange:r,readOnly:o,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
16
- return S(p,{label:X(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(f,{ariaLabel:X(n,t),value:a,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||o})),onChange:e=>{o||r(e)}})});case"object":/* @__PURE__ */
17
- return S(J,{...e,field:n});case"array":/* @__PURE__ */
18
- return S(Y,{...e,field:n});case"slot":return null}}var Q=e=>r.includes(e);function Z(n,t){let l,a=r[0];const o=[],i=/* @__PURE__ */new Set;for(const[r,s]of Object.entries(n))s&&(Q(s.bucket)&&((s.marker||s.bucket!==a)&&(l=void 0),a=s.bucket),s.marker&&"string"==typeof s.fold?l={key:r,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||(o.push(l?{name:r,field:s,bucket:a,fold:l}:{name:r,field:s,bucket:a}),"slot"!==s.type&&i.add(a)));return{rows:o,buckets:r.filter(e=>i.has(e))}}function U(e){return new Map(Z(e).rows.map(e=>[e.name,e.bucket]))}function _(e){const n=[];for(const t of e){const e=n[n.length-1];e&&e.fold?.key===t.fold?.key?e.rows.push(t):n.push({fold:t.fold,rows:[t]})}return n}function ee({fields:e,values:n,onChange:t,readOnly:l=!1,context:a,showWhenContext:r,tab:s,onTab:c,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:h,ariaLabel:p,lead:f,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const O=b("panel",i),$=D(),P=h??`es-insp${$.replace(/:/g,"")}`,L=Z(e,{values:n,context:r}),[F,M]=j(void 0),R=s??F,E=R&&L.buckets.includes(R)?R:L.buckets[0],[W,A]=j(null),H=W&&W.panel===P&&L.rows.some(e=>e.name===W.name)?W:null,T=d&&L.buckets.length>1,z=T&&E?w(P,E):`${P}-rows`,[B,G]=j(()=>/* @__PURE__ */new Set),K=y??B,X=(e,n)=>{/* @__PURE__ */return S(o,{title:e.title,open:!K.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&G(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),k?.(e,n)})(e.key,n),id:`${P}-fold-${t=e.key,[...t].map(e=>/[A-Za-z0-9_-]/.test(e)?e:`-u${e.codePointAt(0).toString(16)}-`).join("")}`,level:x,children:n});var t},J=e=>T&&e!==E,Y=({name:e,field:o,bucket:i,fold:s})=>/* @__PURE__ */S("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!!J(i)||void 0,children:/* @__PURE__ */S(q,{field:o,name:e,id:`${P}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:a,showWhenContext:r,renderers:m,openItem:H&&H.name===e?H.index:null,onOpenItem:n=>A(null===n?null:{panel:P,name:e,index:n}),headingLevel:s?V(x):x})},e);/* @__PURE__ */
19
- return I("div",{className:"es-insp",children:[T?/* @__PURE__ */S("div",{className:"es-insp-tabs",children:/* @__PURE__ */S(C,{variant:"underline",block:!0,"aria-label":p??O.settings,idPrefix:P,value:E,onChange:e=>{const n=e;void 0===s&&M(n),c?.(n)},items:L.buckets.map(e=>{const n=O.buckets[e],t=u?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */S("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
20
- /* @__PURE__ */I("div",{className:"es-insp-rows",id:z,role:T?"tabpanel":void 0,"aria-labelledby":T&&E?N(P,E):void 0,children:[f?v?/* @__PURE__ */S("div",{className:"es-insp-band","data-fold":v.key,children:X(v,f)}):f:null,_(L.rows).map((e,n)=>{if(!e.fold)return e.rows.map(Y);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
21
- return S("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!J(t)&&!l)||void 0,children:X(e.fold,e.rows.map(Y))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{W as FieldText,ee as Inspector,q as InspectorField,K as ListField,U as bucketsOf,z as copyItem,A as insertAt,X as labelOf,H as moveTo,Z as planFields,T as removeAt};
10
+ /* @__PURE__ */S(x,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),items:l(ye(ue.index))}):null]})}var V=e=>e<6?e+1:6,X=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function Y({field:e,name:t,id:l,value:a,onChange:r,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=j(!0),p=a&&"object"==typeof a?a:{};/* @__PURE__ */
11
+ return S(o,{id:`${l}-group`,title:X(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */S(Z,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>r({...p,[e]:n}),readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:V(u)},e))})}function J({field:e,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=j(null),f=u?d??null:h,b=u??p,g=Array.isArray(a)?a:[],v=e.getItemSummary;/* @__PURE__ */
12
+ return S(K,{label:X(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:r,newItem:()=>H({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:o,open:f,onOpen:b,renderItem:(a,r,d)=>Object.entries(n(e.arrayFields,{values:a,context:s})).map(([e,n])=>/* @__PURE__ */S(Z,{field:n,name:`${t}[${r}].${e}`,id:`${l}-${r}-${e}`,value:a?.[e],onChange:n=>d({...a,[e]:n}),readOnly:o,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function Z(e){const{field:n,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,renderers:d}=e;if(!n||n.marker||!1===n.visible)return null;const h=d?.[n.type];if(h)return h({field:n,name:t,id:l,value:a,onChange:r,readOnly:o});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:a,onChange:r,readOnly:o};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
13
+ return S(u,{label:X(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(E,{id:l,value:"string"==typeof a?a:null==a?"":String(a),onChange:r,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:o})});case"number":/* @__PURE__ */
14
+ return S(u,{label:X(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(s,{id:l,value:"number"==typeof a?a:void 0,onChange:r,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:o})});case"select":{const e=`${l}-label`;/* @__PURE__ */
15
+ return S(u,{label:X(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(c,{id:l,value:a,options:n.options,onChange:r,readOnly:o,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
16
+ return S(u,{label:X(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(m,{ariaLabel:X(n,t),value:a,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||o})),onChange:e=>{o||r(e)}})});case"object":/* @__PURE__ */
17
+ return S(Y,{...e,field:n});case"array":/* @__PURE__ */
18
+ return S(J,{...e,field:n});case"slot":return null}}var q=e=>r.includes(e);function Q(n,t){let l,a=r[0];const o=[],i=/* @__PURE__ */new Set;for(const[r,s]of Object.entries(n))s&&(q(s.bucket)&&((s.marker||s.bucket!==a)&&(l=void 0),a=s.bucket),s.marker&&"string"==typeof s.fold?l={key:r,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||(o.push(l?{name:r,field:s,bucket:a,fold:l}:{name:r,field:s,bucket:a}),"slot"!==s.type&&i.add(a)));return{rows:o,buckets:r.filter(e=>i.has(e))}}function U(e){return new Map(Q(e).rows.map(e=>[e.name,e.bucket]))}function _(e){const n=[];for(const t of e){const e=n[n.length-1];e&&e.fold?.key===t.fold?.key?e.rows.push(t):n.push({fold:t.fold,rows:[t]})}return n}function ee({fields:e,values:n,onChange:t,readOnly:l=!1,context:a,showWhenContext:r,tab:s,onTab:c,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:p,ariaLabel:f,lead:b,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const O=h("panel",i),D=$(),P=p??`es-insp${D.replace(/:/g,"")}`,L=Q(e,{values:n,context:r}),[F,M]=j(void 0),R=s??F,A=R&&L.buckets.includes(R)?R:L.buckets[0],[E,T]=j(null),W=E&&E.panel===P&&L.rows.some(e=>e.name===E.name)?E:null,z=d&&L.buckets.length>1,H=z&&A?w(P,A):`${P}-rows`,[B,G]=j(()=>/* @__PURE__ */new Set),K=y??B,X=(e,n)=>{/* @__PURE__ */return S(o,{title:e.title,open:!K.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&G(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),k?.(e,n)})(e.key,n),id:`${P}-fold-${t=e.key,[...t].map(e=>/[A-Za-z0-9_-]/.test(e)?e:`-u${e.codePointAt(0).toString(16)}-`).join("")}`,level:x,children:n});var t},Y=e=>z&&e!==A,J=({name:e,field:o,bucket:i,fold:s})=>/* @__PURE__ */S("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!!Y(i)||void 0,children:/* @__PURE__ */S(Z,{field:o,name:e,id:`${P}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:a,showWhenContext:r,renderers:m,openItem:W&&W.name===e?W.index:null,onOpenItem:n=>T(null===n?null:{panel:P,name:e,index:n}),headingLevel:s?V(x):x})},e);/* @__PURE__ */
19
+ return I("div",{className:"es-insp",children:[z?/* @__PURE__ */S("div",{className:"es-insp-tabs",children:/* @__PURE__ */S(C,{variant:"underline",block:!0,"aria-label":f??O.settings,idPrefix:P,value:A,onChange:e=>{const n=e;void 0===s&&M(n),c?.(n)},items:L.buckets.map(e=>{const n=O.buckets[e],t=u?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */S("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
20
+ /* @__PURE__ */I("div",{className:"es-insp-rows",id:H,role:z?"tabpanel":void 0,"aria-labelledby":z&&A?N(P,A):void 0,children:[b?v?/* @__PURE__ */S("div",{className:"es-insp-band","data-fold":v.key,children:X(v,b)}):b:null,_(L.rows).map((e,n)=>{if(!e.fold)return e.rows.map(J);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
21
+ return S("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!Y(t)&&!l)||void 0,children:X(e.fold,e.rows.map(J))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{E as FieldText,ee as Inspector,Z as InspectorField,K as ListField,U as bucketsOf,H as copyItem,T as insertAt,X as labelOf,W as moveTo,Q as planFields,z as removeAt};
@@ -1,4 +1,4 @@
1
- import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-IE55HNMA.js";import{SplitButton as l,Kbd as i,CMD_S as n}from"efficient-shell/ui";import{CloudIcon as s,CheckIcon as o}from"efficient-shell/icons/efficient";import{jsx as r,jsxs as d}from"react/jsx-runtime";var c=e=>e.state.failed&&null!=e.state.retryAt||null!=e.state.savedAt;function u({input:l,words:i}){const n=e(c(l)),s=t({...l,now:n},i);/* @__PURE__ */
1
+ import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-GWIVPLOX.js";import{SplitButton as l,Kbd as i,CMD_S as n}from"efficient-shell/ui";import{CloudIcon as s,CheckIcon as o}from"efficient-shell/icons/efficient";import{jsx as r,jsxs as d}from"react/jsx-runtime";var c=e=>e.state.failed&&null!=e.state.retryAt||null!=e.state.savedAt;function u({input:l,words:i}){const n=e(c(l)),s=t({...l,now:n},i);/* @__PURE__ */
2
2
  return r(a,{state:s.state,label:s.label})}function m({input:a,action:u,readOnly:m,saveSwitch:y,onToggleAutoSave:b,onSaveNow:p,bar:v,words:f}){const k=e(c(a)),h=t({...a,now:k},f),w=h.retry?v.retry:v.saveNow,g=/* @__PURE__ */d("span",{className:"es-savemenu-row",children:[w,
3
- /* @__PURE__ */r("span",{"aria-hidden":"true",children:/* @__PURE__ */r(i,{keys:n,size:"sm"})})]}),S=[{type:"status",key:"status",label:h.line(u.status)},...(u.goingLive??[]).map((e,t)=>({type:"status",key:`going-live-${t}`,label:e})),{type:"divider",key:"divider"},...y?[{type:"checkbox",key:"auto-save",label:v.autoSave,checked:!a.state.paused,disabled:m,onSelect:b}]:[],{key:"save-now",label:g,icon:/* @__PURE__ */r(s,{}),disabled:m,onSelect:p},...u.menuItems?.length?[{type:"divider",key:"layer-divider"},...u.menuItems.map(e=>({key:`layer-${e.key}`,label:e.label,icon:e.icon,disabled:e.disabled,onSelect:e.onSelect}))]:[]],A=u.quiet??null,I=h.blocked??u.disabledReason??A?.reason??null;/* @__PURE__ */
4
- return r(l,{variant:A?"secondary":"primary",leftIcon:A?/* @__PURE__ */r(o,{}):void 0,onClick:()=>u.onPress(),disabled:null!==I,disabledReason:I??void 0,tooltip:u.tooltip,loading:!0===u.busy,menuLabel:v.saveOptions,items:S,menuMinWidth:300,children:A?A.label:u.label})}export{m as ScreenMainButton,u as ScreenSaveIcon};
3
+ /* @__PURE__ */r("span",{"aria-hidden":"true",children:/* @__PURE__ */r(i,{keys:n,size:"sm"})})]}),S=[{type:"status",key:"status",label:h.line(u.status)},...(u.goingLive??[]).map((e,t)=>({type:"status",key:`going-live-${t}`,label:e})),{type:"divider",key:"divider"},...y?[{type:"checkbox",key:"auto-save",label:v.autoSave,checked:!a.state.paused,disabled:m,onSelect:b}]:[],{key:"save-now",label:g,icon:/* @__PURE__ */r(s,{}),disabled:m,onSelect:p},...u.menuItems?.length?[{type:"divider",key:"layer-divider"},...u.menuItems.map(e=>({key:`layer-${e.key}`,label:e.label,icon:e.icon,disabled:e.disabled,onSelect:e.onSelect}))]:[]],I=u.quiet??null,L=h.blocked??u.disabledReason??I?.reason??null;/* @__PURE__ */
4
+ return r(l,{variant:I?"secondary":"primary",leftIcon:I?/* @__PURE__ */r(o,{}):void 0,onClick:()=>u.onPress(),disabled:null!==L,disabledReason:L??void 0,tooltip:u.tooltip,loading:!0===u.busy,menuLabel:v.saveOptions,items:S,menuMinWidth:300,children:I?I.label:u.label})}export{m as ScreenMainButton,u as ScreenSaveIcon};
@@ -0,0 +1,10 @@
1
+ import{DEFAULT_TREE_WORDS as e}from"./chunk-K56YDHYQ.js";import{useContext as r,createContext as a,isValidElement as l}from"react";import{Tree as n,TreeGroupLabel as o,TreeGroup as s,Tooltip as i,TreeRow as t,IconButton as d,TreeSeam as c,TreeEmptySlot as m}from"efficient-shell/ui";import{jsx as p,jsxs as g,Fragment as h}from"react/jsx-runtime";import{SharedIcon as u}from"efficient-shell/icons/efficient";var b,f=()=>b??=a(1),k=()=>r(f());function v({className:r,children:a,rootProps:l,ariaLabel:o,words:s=e}){/* @__PURE__ */
2
+ return p(n,{"aria-label":o??s.name??e.name,className:r?`es-tree ${r}`:"es-tree",rootProps:l,children:a})}function N({children:e,count:r,expanded:a,onToggle:l}){/* @__PURE__ */
3
+ return p(o,{count:r,expanded:a,onToggle:l,children:e})}function w({children:e}){const r=k(),a=f();/* @__PURE__ */
4
+ return p(a.Provider,{value:r+1,children:/* @__PURE__ */p(s,{children:e})})}var P=e.dragHint,y=e=>[e].flat(1/0).some(e=>l(e)&&!0===e.props.pressed);function T({icon:r,name:a,preview:l,selected:n,hidden:o,draggable:s,dragHint:d,dragging:c,drop:m,fold:b,actions:f,nameSlot:v,onSelect:N,marks:w,badge:P,trailing:T,shared:A,children:S,rowProps:x,level:H,words:j=e}){const B=k(),C=["es-tree-row",n?"is-selected":"",o?"is-hidden":"",s?"is-draggable":"",c?"is-dragging":"",m?`is-drop-${m}`:""].filter(Boolean).join(" "),$=/* @__PURE__ */g(h,{children:[
5
+ /* @__PURE__ */p("span",{className:"es-tree-name",children:a}),w?.map(e=>/* @__PURE__ */p(i,{content:e.label,children:/* @__PURE__ */p("span",{className:"es-tree-mark","aria-label":e.label,role:"img",children:e.icon})},e.key)),T?/* @__PURE__ */p(i,{content:T.label,children:/* @__PURE__ */p("span",{className:"es-tree-trailing","aria-label":T.label,role:"img",children:T.icon})}):null,S]}),z=A?/* @__PURE__ */g(h,{children:[null!=f?/* @__PURE__ */p("span",{className:"es-tree-shared-acts",children:f}):null,
6
+ /* @__PURE__ */p(i,{content:A,children:/* @__PURE__ */p("span",{className:"es-tree-shared-mark","aria-label":A,role:"img",children:/* @__PURE__ */p(u,{size:14})})})]}):null,D=x?.onClick,L={click:!1},Y=D?e=>{D(e),L.click=!0,queueMicrotask(()=>{L.click=!1})}:void 0,q=N?()=>{L.click||N()}:void 0;/* @__PURE__ */
7
+ return p(t,{label:$,level:H??B,icon:r,tone:A?"shared":void 0,preview:l,selected:!!n,expanded:b?b.open:void 0,onToggle:b?.onToggle,onSelect:q,muted:!!o,badge:P,actions:z??f,actionsPinned:!!A||y(f),actionsOverlay:!A,rename:v,drop:m,dragging:!!c,draggable:!!s,dragHint:d??j.dragHint,className:C,rowProps:{...x,onClick:Y,...s?{"aria-keyshortcuts":"Alt+ArrowUp Alt+ArrowDown"}:{}}})}function A({kind:e,label:r,onClick:a,pressed:l,disabled:n,children:o}){/* @__PURE__ */
8
+ return p(i,{content:r,children:/* @__PURE__ */p(d,{"aria-label":r,"aria-pressed":l,"aria-disabled":n||void 0,variant:"delete"===e?"ghost-danger":"ghost",size:"sm","data-kind":e,className:n?"es-tree-act-off":void 0,onClick:e=>{e.stopPropagation(),a()},children:o})})}function S({drop:e,onAdd:r,label:a,seamProps:l}){const n=["es-tree-seam",e?"is-drop":"",r?"has-add":"",l?.className??""].filter(Boolean).join(" "),o={...l,className:n};/* @__PURE__ */
9
+ return p(c,{drop:!!e,onInsert:r,label:a,seamProps:o})}function x({drop:r,onAdd:a,label:l,seamProps:n,words:o=e}){const s=l??(a?o.addBlock??e.addBlock:o.emptySlot??e.emptySlot),i={...n,className:n?.className?`es-tree-empty ${n.className}`:"es-tree-empty"};/* @__PURE__ */
10
+ return p(m,{drop:!!r,onAdd:a,label:s,slotProps:i})}export{v as LayersTree,w as Subtree,P as TREE_DRAG_HINT,x as TreeEmptySlot,N as TreeGroupLabel,T as TreeRow,A as TreeRowAction,S as TreeSeam};
@@ -1 +1 @@
1
- import{useScreenBlockRules as e}from"./chunk-U25CP5VX.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-QX7GVECM.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-XHSGRH42.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-QEAUF632.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};
@@ -0,0 +1 @@
1
+ import{hidableText as n}from"./chunk-6W7WLPZH.js";import{textFieldIdentifier as r}from"./chunk-DUVRZ456.js";function t(r,t){const o=n(r.props.name);if(o)return o;const e=n(r.props.altName);if(e)return e;const c=r.props.collection?.name;if(c)return c;const u=r.props.source?.title;if(u)return u;const s=r.props.code;return s?t?.(s)??s:""}function o(n,r,o,e,c){const u=o(t(n,e))||r(n.type);return c?c(n,"block",u):u}function e(n){if(!n)return null;for(const t of["name","altName"])if(r(n[t]))return t;return null}function c(n){const t=n?.name;return void 0===t||r(t)?"name":null}function u(r,t,o){const e=n(r.props?.name).trim()||t;return o?o(r,"section",e):e}export{u as rootRowName,c as sectionRenameProp,t as slotChildName,e as slotChildRenameProp,o as slotChildRowName};
@@ -0,0 +1,8 @@
1
+ import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as o}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as l}from"./chunk-BVN33R76.js";import{sharedSectionsOf as r}from"./chunk-43AEUUNQ.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-XDZHKYQX.js";import{blockRuns as c}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-XHSGRH42.js";import{useEaselSession as m}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-C2RHV42O.js";import{useEasel as u}from"./chunk-QEAUF632.js";import{easelMenuEntries as y}from"./chunk-BALFHI3G.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-LLDHIBYG.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-KAML3KQH.js";import{useState as b,useEffect as v,useMemo as j,useRef as w}from"react";import{SharedIcon as C,AddIcon as H}from"efficient-shell/icons/efficient";import{ContextMenu as A,toast as L,Dialog as $,Button as x}from"efficient-shell/ui";import{jsx as B,jsxs as D,Fragment as E}from"react/jsx-runtime";function F({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=w(null);/* @__PURE__ */
2
+ return B($,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */D(E,{children:[
3
+ /* @__PURE__ */B(x,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
4
+ /* @__PURE__ */B(x,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var O=e=>`section:${e}`,T=e=>`block:${e}`,I=e=>`template:${e}`,M=e=>`shared:${e}`;function N({at:w,placeBlocks:$,canTake:x,onPick:N,itemFor:Q,session:R,siteWide:S,onClose:z,onHide:G,readOnly:K}){const P=u(e=>e.config),V=a(),{labelAtLevel:Y,categoryLabel:Z,firstSection:U,Icon:W,Thumbnail:X}=V,{blockIsOffered:_,canAddTo:J}=d(),q=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>_(e,te);return l(te).list().then(n=>{if(e)return;const l=P.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[P,te]);const le=p().shared,re=h("screen",f).shared,[ie,se]=b([]),[ce,ae]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>_(e,te);return r(te).list().then(n=>{if(e)return;const l=P.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[P,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(P,V),[P]),ye=e=>Y(e,"section",P.components[e]?.label??e),he=e=>({type:O(e.type),label:e.name,cover:/* @__PURE__ */B(X,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:q.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ke=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=ne.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=ie.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}return null},ge=e=>/* @__PURE__ */B("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */B(W,{type:e,size:26})}),be=j(()=>{const e=t(ue,U),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!_(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=J(t.type)?.choices??[];e.forEach(l),e.forEach(e=>J(e.type,1)?.choices?.forEach(l))}$?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:T(e.type),label:e.label,cover:ge(e.type),title:q.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>o.has(e.type)?{...he(e),cover:ge(e.type)}:he(e),d=[];ie.length>0&&d.push({key:"shared",title:re.group,tiles:ie.map(e=>({type:M(e.id),label:e.title,cover:/* @__PURE__ */B(X,{type:e.node.type}),mark:/* @__PURE__ */B(C,{size:12}),title:re.onPages({count:e.used_on.length}),keywords:[ye(e.node.type),e.node.type]}))}),ne.length>0&&d.push({key:"templates",title:q.templates,tiles:ne.map(e=>({type:I(e.id),label:e.name,cover:/* @__PURE__ */B(X,{type:e.node.type}),keywords:[ye(e.node.type),e.node.type]}))});const p=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(P.categories??{})){const o=ue.filter(e=>e.cat===t);if(0===o.length)continue;const l=e&&o.some(t=>t.type===e.type)?e:null,r=(l?[l,...o.filter(e=>e.type!==l.type)]:o).map(a);l&&!m&&(r.splice(1,0,...p.map(s)),m=!0),d.push({key:`category:${t}`,title:n(P,t,Z),tiles:r})}const f=d.find(e=>e.key?.startsWith("category:"));if(!m&&f&&p.length>0&&(f.tiles=[...f.tiles,...p.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{d.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!x)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?x(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[ne,ie,re,ue,P,q,x,$,te]);/* @__PURE__ */
5
+ return D(E,{children:[
6
+ /* @__PURE__ */B(i,{icon:/* @__PURE__ */B(H,{size:15}),title:q.title,context:q.contextAll,actions:/* @__PURE__ */B(s,{label:q.done,description:q.doneDescription,onClick:z}),onHide:G}),
7
+ /* @__PURE__ */D("div",{className:"sf-addside sf-scroll",children:[
8
+ /* @__PURE__ */B(k,{groups:be,session:R,itemFor:e=>Q(ke(e)??{kind:"section",type:e}),onInsert:N?e=>{const t=ke(e);t&&N(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!K&&(pe({section:n.section,...t}),!0)},at:w,hint:q.hint,searchLabel:q.search,readOnly:K,words:ee}),S??null]}),de?/* @__PURE__ */B(A,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>pe(null),"aria-label":de.section.title,items:y([{label:re.deleteShared,danger:!0,onClick:()=>{fe(de.section),pe(null)}}])}):null,me?/* @__PURE__ */B(F,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void L.error(re.deleteFailed)}fe(null),le?.removed?.(e),se(t=>t.filter(t=>t.id!==e.id)),ae(e=>e+1)})(me),onCancel:()=>fe(null)}):null]})}export{N as AddSidePanel,T as blockKey,O as sectionKey,M as sharedKey,I as templateKey};
@@ -0,0 +1 @@
1
+ var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"},a=e=>1===e?"1 page":`${e} pages`,t={group:"Shared sections",onPages:({count:e})=>`On ${a(e)}`,makeShared:"Make shared",makeSharedHint:"Use this section on other pages from Add. Change it once, and every page changes.",name:"Name",cancel:"Cancel",makeFailed:"Could not make it shared. Try again.",detach:"Detach from shared",removeFromPage:"Remove from this page",removed:({count:e})=>e>0?`Removed from this page · still on ${a(e)}`:"Removed from this page",deleteShared:"Delete shared section",deleteTitle:({name:e})=>`Delete “${e}”?`,deleteMessage:({count:e})=>0===e?"No page uses it. Nothing on the website changes.":1===e?"The page that uses it keeps its own copy. Nothing disappears from the website.":`The ${e} pages that use it each keep their own copy. Nothing disappears from the website.`,deleteFailed:"Could not delete it. Try again.",alreadyHere:"Already on this page"};var o={savedAgo:function({seconds:e}){const a=Math.max(0,Math.floor(e));if(a<1)return"Saved just now";if(a<60)return`Saved ${a} second${1===a?"":"s"} ago`;const t=Math.floor(a/60);if(t<60)return`Saved ${t} minute${1===t?"":"s"} ago`;const o=Math.floor(t/60);return`Saved ${o} hour${1===o?"":"s"} ago`},saved:"All changes saved",saving:"Saving",pending:"Changes not saved yet — saving in a moment",failedIn:({seconds:e})=>`Not saved — trying again in ${e} s`,failedSoon:"Not saved — trying again soon",offline:"You’re offline — we’ll save when you’re back",pausedHeld:"Auto-save is off — changes not saved",paused:"Auto-save is off",locked:({editing:e})=>`Not saving — ${e}`,blockedOffline:"You’re offline. Try again when you’re back online.",blockedFailed:"Your last changes are not saved yet. Try again when they are.",blockedConflict:"Your last save was refused. See the notice below."},n={loading:"Loading",waitingForAuthorization:"Waiting for editor authorization",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageSettings:"Page settings",header:"Header",footer:"Footer",pageSections:"Page",templateSections:"Template",addSection:"Add section",addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,shared:t,canvasAddBlock:"Add block",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel",leave:{title:"Unsaved changes",body:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them.",cancel:"Cancel",discard:"Discard & leave",save:"Save & leave",saving:"Saving"},bar:{undo:"Undo",redo:"Redo",refresh:"Reload the preview",refreshTip:"Reload the preview (keeps your place)",notSaving:"Not saving — see the notice below",retry:"Retry now",autoSaveOff:"Auto-save is off — click to turn it back on (saves your held edits)",autoSaveOn:"Auto-save is on — click to pause it",views:"Left panel views",saveOptions:"Save options",autoSave:"Auto-save",saveNow:"Save now"},saveStatus:o,menu:{undo:"Undo",redo:"Redo",collapseAll:"Collapse all layers",selectAll:"Select all",pinned:"Pinned — can’t be moved or deleted",clipboardRefused:"Your browser won’t let us read the clipboard — press ⌘V"},layers:"Layers",expandAll:"Expand all sections",collapseAll:"Collapse all sections",nothingToFold:"Nothing to fold on this page",rename:"Rename",deleteNamed:({name:e})=>`Delete ${e}`,hideNamed:({name:e})=>`Hide ${e}`,showNamed:({name:e})=>`Show ${e}`,addBlockHere:"Add block here",sectionFirst:({name:e})=>`“${e}” is already first`,sectionLast:({name:e})=>`“${e}” is already last`,sectionMoved:({name:e,n:a,total:t})=>`Moved “${e}” to position ${a} of ${t}`,sectionAdded:({name:e})=>`Added “${e}” section`,deleted:({name:e})=>`Deleted “${e}”`,resizeSettingsPanel:"Resize settings panel",sectionSettings:({name:e})=>`${e} settings`,headerSettings:"Header settings",addBlockMenu:"Add block",deviceNote:{tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."}};export{e as DEFAULT_SCREEN_ADD_WORDS,o as DEFAULT_SCREEN_SAVE_STATUS_WORDS,t as DEFAULT_SCREEN_SHARED_WORDS,n as DEFAULT_SCREEN_WORDS};
@@ -0,0 +1,4 @@
1
+ import{blockRuns as e,offeredChoices as r}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as s}from"./chunk-XHSGRH42.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-C2RHV42O.js";import{useWords as n}from"./chunk-MFIRYGHW.js";import{DropdownMenu as c}from"efficient-shell/ui";import{jsxs as i,Fragment as o,jsx as l}from"react/jsx-runtime";function p({choices:p,onPick:a}){const{Icon:m}=s(),u=n("screen",t),f=e(r(p)).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */i(o,{children:[e.group," ",
2
+ /* @__PURE__ */l("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */l("span",{className:"sf-chip",children:/* @__PURE__ */l(m,{type:e.type,size:13})}),onSelect:()=>a(e.type)}))]);/* @__PURE__ */
3
+ return l(c,{align:"start",triggerClassName:"sf-add-card",items:f,trigger:/* @__PURE__ */i(o,{children:[
4
+ /* @__PURE__ */l("span",{className:"sf-plus sf-plus--sm",children:"+"}),u.addBlockMenu]})})}export{p as AddBlockRow};
@@ -1,23 +1,23 @@
1
- import{DEFAULT_NOTICE_WORDS as e,DEFAULT_CHROME_WORDS as n}from"./chunk-Z6PVRXVY.js";import{holderOf as i,describeAge as a,nameOrSomeone as t}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as s}from"./chunk-RE4LP46F.js";import{EaselRail as l}from"./chunk-MJM6SFD3.js";import{DEFAULT_RAIL_WORDS as r}from"./chunk-2OAZYSWJ.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{jsx as c,jsxs as d,Fragment as u}from"react/jsx-runtime";import{Tooltip as h,IconButton as m,Segmented as p,Switch as v,SpinnerRing as f,ResizeHandle as k,Button as b,Banner as g}from"efficient-shell/ui";import{useState as y,useEffect as N}from"react";import{LockIcon as w,CloudPauseIcon as O,CloudSlashIcon as C,CloudAlertIcon as x,CloudArrowUpIcon as z,CloudCheckIcon as B,PanelLeftIcon as R,PanelRightIcon as L,MediaIcon as $,ImageIcon as S}from"efficient-shell/icons/efficient";function W({children:e}){/* @__PURE__ */
1
+ import{EaselRail as e}from"./chunk-MJM6SFD3.js";import{DEFAULT_NOTICE_WORDS as n,DEFAULT_CHROME_WORDS as i}from"./chunk-Z6PVRXVY.js";import{DEFAULT_RAIL_WORDS as a}from"./chunk-2OAZYSWJ.js";import{holderOf as t,describeAge as s,nameOrSomeone as l}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as r}from"./chunk-RE4LP46F.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{jsx as c,jsxs as d,Fragment as u}from"react/jsx-runtime";import{Tooltip as h,IconButton as m,Segmented as p,Switch as v,SpinnerRing as f,ResizeHandle as k,Button as b,Banner as g}from"efficient-shell/ui";import{useState as y,useEffect as N}from"react";import{LockIcon as w,CloudPauseIcon as O,CloudSlashIcon as C,CloudAlertIcon as x,CloudArrowUpIcon as z,CloudCheckIcon as B,PanelLeftIcon as R,PanelRightIcon as L,MediaIcon as $,ImageIcon as S}from"efficient-shell/icons/efficient";function W({children:e}){/* @__PURE__ */
2
2
  return c("div",{className:"es-topbar",children:e})}function j({kind:e,style:n,children:i}){/* @__PURE__ */
3
3
  return c("div",{className:e?`es-cluster es-cluster--${e}`:"es-cluster",style:n,children:i})}function M(){/* @__PURE__ */
4
- return c("div",{className:"es-divider-v","aria-hidden":"true"})}function P({items:e,ariaLabel:n,onWords:i}){const a=o("rail",r);/* @__PURE__ */
5
- return c("div",{className:"es-cluster es-cluster--rail es-rail-fit",children:/* @__PURE__ */c(l,{items:e,ariaLabel:n??a.label,orientation:"row",onLabelsShown:i})})}function Y({label:e,tip:n,onClick:i,disabled:a,state:t,buttonRef:s,children:l}){/* @__PURE__ */
6
- return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:s,"aria-label":e,"aria-pressed":t?"active"===t:void 0,className:"es-iconbtn",disabled:a,onClick:i,children:l})})}function T({devices:e,value:i,onChange:a,ariaLabel:t}){const s=o("chrome",n);/* @__PURE__ */
7
- return c(p,{className:"es-devseg",size:"sm",label:t??s.device,value:i,onChange:e=>{e!==i&&a(e)},options:e.map(e=>({value:e.id,icon:/* @__PURE__ */c(h,{content:e.label,side:"bottom",children:/* @__PURE__ */c("span",{className:"es-devseg-glyph","aria-hidden":"true",children:e.icon})}),label:/* @__PURE__ */c("span",{className:"es-vh",children:e.label})}))})}var F={idle:"is-quiet",saved:"is-quiet is-saved",saving:"is-saving",error:"is-error",off:"is-off","off-unsaved":"is-off is-unsaved"};function H({tone:e,label:n,counting:i,waitMs:a,ringRef:t,role:s}){/* @__PURE__ */
4
+ return c("div",{className:"es-divider-v","aria-hidden":"true"})}function P({items:n,ariaLabel:i,onWords:t}){const s=o("rail",a);/* @__PURE__ */
5
+ return c("div",{className:"es-cluster es-cluster--rail es-rail-fit",children:/* @__PURE__ */c(e,{items:n,ariaLabel:i??s.label,orientation:"row",onLabelsShown:t})})}function Y({label:e,tip:n,onClick:i,disabled:a,state:t,buttonRef:s,children:l}){/* @__PURE__ */
6
+ return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:s,"aria-label":e,"aria-pressed":t?"active"===t:void 0,className:"es-iconbtn",disabled:a,onClick:i,children:l})})}function T({devices:e,value:n,onChange:a,ariaLabel:t}){const s=o("chrome",i);/* @__PURE__ */
7
+ return c(p,{className:"es-devseg",size:"sm",label:t??s.device,value:n,onChange:e=>{e!==n&&a(e)},options:e.map(e=>({value:e.id,icon:/* @__PURE__ */c(h,{content:e.label,side:"bottom",children:/* @__PURE__ */c("span",{className:"es-devseg-glyph","aria-hidden":"true",children:e.icon})}),label:/* @__PURE__ */c("span",{className:"es-vh",children:e.label})}))})}var F={idle:"is-quiet",saved:"is-quiet is-saved",saving:"is-saving",error:"is-error",off:"is-off","off-unsaved":"is-off is-unsaved"};function H({tone:e,label:n,counting:i,waitMs:a,ringRef:t,role:s}){/* @__PURE__ */
8
8
  return d("span",{className:`es-savestate ${F[e]}`,role:s,"aria-live":"polite",children:[/* @__PURE__ */c("span",i?{ref:t,className:"es-savestate-ring is-counting",style:void 0!==a?{"--es-savewait":`${a}ms`}:void 0,"aria-hidden":"true"}:{className:"es-savestate-dot","aria-hidden":"true"}),n]})}function V({pressed:e,title:n,onToggle:i,children:a}){/* @__PURE__ */
9
9
  return c("span",{className:"es-savestate-toggle",children:/* @__PURE__ */c(h,{content:n,side:"bottom",children:/* @__PURE__ */c(v,{size:"sm",checked:!e,"aria-label":n,label:a,onChange:()=>i()})})})}var I={saved:{glyph:()=>/* @__PURE__ */c(B,{}),tone:"muted"},saving:{glyph:()=>/* @__PURE__ */c(f,{className:"",ink:"",style:{width:20,height:20}}),tone:"muted"},pending:{glyph:()=>/* @__PURE__ */c(z,{}),tone:"muted"},failed:{glyph:()=>/* @__PURE__ */c(x,{}),tone:"danger"},offline:{glyph:()=>/* @__PURE__ */c(C,{}),tone:"warning"},paused:{glyph:()=>/* @__PURE__ */c(O,{}),tone:"warning"},locked:{glyph:()=>/* @__PURE__ */c(w,{}),tone:"warning"}},Z=e=>I[e].tone;function q({state:e,label:n}){const i=I[e],[a,t]=y(n);return N(()=>t(n),[e]),/* @__PURE__ */d("span",{className:"es-saveicon-wrap",children:[
10
10
  /* @__PURE__ */c(h,{content:n,side:"bottom",describe:!1,children:/* @__PURE__ */c("span",{className:"es-saveicon",role:"img","aria-label":n,tabIndex:0,"data-save-state":e,"data-tone":i.tone,children:i.glyph()})}),
11
- /* @__PURE__ */c("span",{className:"es-vh",role:"status","aria-live":"polite",children:a})]})}function A({side:e,width:i,min:a,max:t,defaultWidth:s,label:l,onResize:r}){const d=o("chrome",n);/* @__PURE__ */
12
- return c(k,{side:e,width:i,min:a,max:t,defaultWidth:s,label:l,hint:d.resize,onResize:e=>r(e),className:`es-resizer es-resizer--${e}`})}function D({icon:e,name:n,kind:i,actions:a}){/* @__PURE__ */
11
+ /* @__PURE__ */c("span",{className:"es-vh",role:"status","aria-live":"polite",children:a})]})}function A({side:e,width:n,min:a,max:t,defaultWidth:s,label:l,onResize:r}){const d=o("chrome",i);/* @__PURE__ */
12
+ return c(k,{side:e,width:n,min:a,max:t,defaultWidth:s,label:l,hint:d.resize,onResize:e=>r(e),className:`es-resizer es-resizer--${e}`})}function D({icon:e,name:n,kind:i,actions:a}){/* @__PURE__ */
13
13
  return d("div",{className:"es-insp-head",children:[
14
14
  /* @__PURE__ */c("span",{className:"es-insp-chip","aria-hidden":"true",children:e}),
15
15
  /* @__PURE__ */d("div",{className:"es-insp-titles",children:[
16
16
  /* @__PURE__ */c(h,{content:n,describe:!1,side:"bottom",className:"es-insp-name-tip",children:/* @__PURE__ */c("h2",{className:"es-insp-name",children:n})}),
17
17
  /* @__PURE__ */c("div",{className:"es-insp-kind",children:i})]}),a?/* @__PURE__ */c("div",{className:"es-insp-actions",children:a}):null]})}function J({label:e,title:n,hasPopup:i,onClick:a,disabled:t,danger:s,expanded:l,buttonRef:r,children:o}){/* @__PURE__ */
18
- return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:r,variant:s?"ghost-danger":"ghost",className:"es-insp-iconbtn","aria-label":e,"aria-haspopup":i,"aria-expanded":l,disabled:t,onClick:a,children:o})})}function K({name:e,onSelect:i,label:a,inline:t}){const s=o("chrome",n),l=a??s.upLevel,r=/* @__PURE__ */c(h,{content:l,side:"bottom",children:/* @__PURE__ */c(b,{variant:"link",size:"sm",className:"es-insp-up-btn","aria-label":s.upLevelTo({label:l,name:e}),leftIcon:/* @__PURE__ */c("span",{className:"es-insp-up-arrow","aria-hidden":"true",children:"←"}),onClick:i,children:/* @__PURE__ */c("span",{className:"es-insp-up-name",children:e})})});return t?r:/* @__PURE__ */c("div",{className:"es-insp-up",children:r})}function E({name:e,tier:i,of:a},t){const s={...n,...t};return{name:e,kind:"section"===i?s.tierSection:"block"===i?s.tierBlock:a?s.partOf({name:a}):s.tierBlock}}function G({context:e,pick:i,onCancel:a,onHide:t,side:s="left"}){const l=o("chrome",n),r=t?/* @__PURE__ */c(J,{label:l.hidePanelLabel({side:s}),title:l.hidePanel,onClick:t,children:/* @__PURE__ */c("left"===s?R:L,{size:16})}):null;if(!i)/* @__PURE__ */
19
- return c(D,{icon:/* @__PURE__ */c($,{}),name:l.mediaLibrary,kind:e,actions:r??void 0});const m=l.mediaKinds[i.kind];/* @__PURE__ */
20
- return c(D,{icon:/* @__PURE__ */c(S,{size:15}),name:l.mediaChoose({kind:m}),kind:i.field?l.mediaFor({field:i.field}):e,actions:/* @__PURE__ */d(u,{children:[
18
+ return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:r,variant:s?"ghost-danger":"ghost",className:"es-insp-iconbtn","aria-label":e,"aria-haspopup":i,"aria-expanded":l,disabled:t,onClick:a,children:o})})}function K({name:e,onSelect:n,label:a,inline:t}){const s=o("chrome",i),l=a??s.upLevel,r=/* @__PURE__ */c(h,{content:l,side:"bottom",children:/* @__PURE__ */c(b,{variant:"link",size:"sm",className:"es-insp-up-btn","aria-label":s.upLevelTo({label:l,name:e}),leftIcon:/* @__PURE__ */c("span",{className:"es-insp-up-arrow","aria-hidden":"true",children:"←"}),onClick:n,children:/* @__PURE__ */c("span",{className:"es-insp-up-name",children:e})})});return t?r:/* @__PURE__ */c("div",{className:"es-insp-up",children:r})}function E({name:e,tier:n,of:a},t){const s={...i,...t};return{name:e,kind:"section"===n?s.tierSection:"block"===n?s.tierBlock:a?s.partOf({name:a}):s.tierBlock}}function G({context:e,pick:n,onCancel:a,onHide:t,side:s="left"}){const l=o("chrome",i),r=t?/* @__PURE__ */c(J,{label:l.hidePanelLabel({side:s}),title:l.hidePanel,onClick:t,children:/* @__PURE__ */c("left"===s?R:L,{size:16})}):null;if(!n)/* @__PURE__ */
19
+ return c(D,{icon:/* @__PURE__ */c($,{}),name:l.mediaLibrary,kind:e,actions:r??void 0});const m=l.mediaKinds[n.kind];/* @__PURE__ */
20
+ return c(D,{icon:/* @__PURE__ */c(S,{size:15}),name:l.mediaChoose({kind:m}),kind:n.field?l.mediaFor({field:n.field}):e,actions:/* @__PURE__ */d(u,{children:[
21
21
  /* @__PURE__ */c(h,{content:l.mediaKeep({kind:m}),side:"bottom",children:/* @__PURE__ */c(b,{variant:"secondary",size:"sm",className:"es-insp-textbtn",onClick:a,children:l.mediaCancel})}),r?/* @__PURE__ */d(u,{children:[
22
- /* @__PURE__ */c("span",{className:"es-insp-divider","aria-hidden":"true"}),r]}):null]})})}function X(e){return/svg/i.test(e)?"svg":e.startsWith("video")?"video":"image"}var Q={notice:e,lock:s};function U(e,n,s,l=Q){const r=l.notice,o=i(e),c={kind:"reload",label:r.reload};if(n){const e=a(n.secondsAgo,l.lock);return{tone:"warning",urgent:!0,lead:n.savedByYou?r.savedByYou({noun:s,when:e}):r.savedByOther({name:t(n.savedBy,l.lock),noun:s,when:e}),body:r.conflictBody,actions:o?[c,{kind:"take-over",label:r.takeOver,title:r.takeOverWhileDeciding}]:[c]}}if(!o)return null;const d=t(o.name,l.lock),u=a(o.secondsSinceSeen,l.lock);switch(e.kind){case"takenover":return{tone:"warning",urgent:!0,lead:r.tookOver({name:d,noun:s,when:a(o.secondsSinceHeld,l.lock)}),body:r.tookOverBody,actions:[{kind:"take-back",label:r.takeBack},c]};case"readonly":return{tone:"neutral",urgent:!1,lead:r.viewingOnly,body:r.viewingOnlyBody({name:d,noun:s,seen:u}),actions:[{kind:"take-over",label:r.takeOver}]};default:return{tone:"warning",urgent:!1,lead:r.editing({name:d,noun:s}),body:r.editingBody({seen:u}),actions:[{kind:"view-read-only",label:r.viewReadOnly},{kind:"take-over",label:r.takeOver,title:r.takeOverTold}]}}}function _({access:n,conflict:i,noun:a,onTakeOver:t,onViewReadOnly:l,onReload:r}){const d=U(n,i,a,{notice:o("notice",e),lock:o("lock",s)});if(!d)return null;const u={reload:r,"take-over":t,"take-back":t,"view-read-only":l},m=d.actions.map(e=>e.title?/* @__PURE__ */c(h,{content:e.title,side:"bottom",children:/* @__PURE__ */c(b,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label})},e.kind):/* @__PURE__ */c(b,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label},e.kind));/* @__PURE__ */
22
+ /* @__PURE__ */c("span",{className:"es-insp-divider","aria-hidden":"true"}),r]}):null]})})}function X(e){return/svg/i.test(e)?"svg":e.startsWith("video")?"video":"image"}var Q={notice:n,lock:r};function U(e,n,i,a=Q){const r=a.notice,o=t(e),c={kind:"reload",label:r.reload};if(n){const e=s(n.secondsAgo,a.lock);return{tone:"warning",urgent:!0,lead:n.savedByYou?r.savedByYou({noun:i,when:e}):r.savedByOther({name:l(n.savedBy,a.lock),noun:i,when:e}),body:r.conflictBody,actions:o?[c,{kind:"take-over",label:r.takeOver,title:r.takeOverWhileDeciding}]:[c]}}if(!o)return null;const d=l(o.name,a.lock),u=s(o.secondsSinceSeen,a.lock);switch(e.kind){case"takenover":return{tone:"warning",urgent:!0,lead:r.tookOver({name:d,noun:i,when:s(o.secondsSinceHeld,a.lock)}),body:r.tookOverBody,actions:[{kind:"take-back",label:r.takeBack},c]};case"readonly":return{tone:"neutral",urgent:!1,lead:r.viewingOnly,body:r.viewingOnlyBody({name:d,noun:i,seen:u}),actions:[{kind:"take-over",label:r.takeOver}]};default:return{tone:"warning",urgent:!1,lead:r.editing({name:d,noun:i}),body:r.editingBody({seen:u}),actions:[{kind:"view-read-only",label:r.viewReadOnly},{kind:"take-over",label:r.takeOver,title:r.takeOverTold}]}}}function _({access:e,conflict:i,noun:a,onTakeOver:t,onViewReadOnly:s,onReload:l}){const d=U(e,i,a,{notice:o("notice",n),lock:o("lock",r)});if(!d)return null;const u={reload:l,"take-over":t,"take-back":t,"view-read-only":s},m=d.actions.map(e=>e.title?/* @__PURE__ */c(h,{content:e.title,side:"bottom",children:/* @__PURE__ */c(b,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label})},e.kind):/* @__PURE__ */c(b,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label},e.kind));/* @__PURE__ */
23
23
  return c("div",{className:`es-notice is-${d.tone}`,role:d.urgent?"alert":"status",children:/* @__PURE__ */c(g,{tone:"warning"===d.tone?"warning":"info",title:d.lead,action:/* @__PURE__ */c("span",{className:"es-notice-actions",children:m}),children:d.body})})}var ee={left:288,right:320},ne=220,ie=560;function ae(e){return Math.min(560,Math.max(220,Math.round(e)))}function te(e){return{"--es-left-w":`${e.left}px`,"--es-right-w":`${e.right}px`}}function se(e,n){e.style.setProperty("--es-left-w",`${n.left}px`),e.style.setProperty("--es-right-w",`${n.right}px`)}export{ee as DEFAULT_PANEL_W,T as DeviceSwitch,Y as EaselIconButton,W as EaselTopBar,_ as EditNotice,D as InspectorHead,J as InspectorIconButton,K as InspectorUpLevel,ie as MAX_PANEL_W,ne as MIN_PANEL_W,G as MediaPanelHead,A as PanelResizeHandle,q as SaveIcon,H as SaveState,V as SaveStateToggle,j as TopBarCluster,M as TopBarDivider,P as TopBarRail,ae as clampPanelWidth,U as editNotice,E as headWords,X as mediaPickKind,te as panelWidthVars,Z as saveIconTone,se as setPanelWidthVars};
@@ -1 +1 @@
1
- import{useScreenDocument as n}from"./chunk-ZZ64CEC2.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
+ import{useScreenDocument as n}from"./chunk-STWSCR25.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-C2RHV42O.js";import{EditNotice as r}from"./chunk-GWIVPLOX.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};
@@ -0,0 +1,18 @@
1
+ import{DEFAULT_DRAG_WORDS as e}from"./chunk-KAML3KQH.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as a,isNoOpDrop as r}from"./chunk-67GNT6PF.js";import{withTip as i}from"./chunk-P2VEMZH5.js";import{useCanvasLayout as s,useCanvasTyping as o,useCanvasEvent as c,CANVAS_TYPABLE_EVENT as d,framePointToHost as u,elementScale as h,frameRectToLayer as f,clientPointToLayer as p}from"./chunk-X4T6JT3M.js";import{parseZoneKey as m}from"./chunk-KRXQM65X.js";import{useRef as g,useEffect as x,useState as b,useCallback as y,useMemo as v,useSyncExternalStore as w,useId as k,useLayoutEffect as N}from"react";import{Tooltip as A,IconButton as z,solidSurfaceStyle as D,Input as T}from"efficient-shell/ui";import{AddIcon as M,CloseIcon as $,SearchIcon as C}from"efficient-shell/icons/efficient";import{jsxs as S,jsx as E}from"react/jsx-runtime";function j({label:e,onInsert:t,style:n,axis:l="y",className:a,index:r}){const i=["es-canvas-insert","x"===l?"is-x":"",a??""].filter(Boolean).join(" ");/* @__PURE__ */
2
+ return S("div",{className:i,style:n,"data-index":r,children:[
3
+ /* @__PURE__ */E("span",{className:"es-canvas-insert-line","aria-hidden":"true"}),
4
+ /* @__PURE__ */E("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */E(A,{content:e,children:/* @__PURE__ */E(z,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */E(M,{})})})})]})}var L=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,K=e=>e.width*e.height;function B(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>L(e.box,t,n)).sort((e,t)=>K(t.s.box)-K(e.s.box)||e.at-t.at).map(({s:e})=>e)}function X(e,t,n){return B(e,t,n).at(-1)??null}function q(e,t,n){const l="x"===e.axis?t:n;let a=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(a+=1)}return a}function I(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],a=n[t],r=l&&a?(l.left+l.width+a.left)/2:l?l.left+l.width:a?a.left:e.box.left,i=a??l??e.box;return{left:r-1,top:i.top,width:2,height:i.height}}const l=n[t-1],a=n[t],r=l&&a?(l.top+l.height+a.top)/2:l?l.top+l.height:a?a.top:e.box.top;return{left:e.box.left,top:r-1,width:e.box.width,height:2}}function O(e,t,n,l,a=()=>!1,r=()=>!0){const i=e.filter(e=>L(e.box,t,n)).sort((e,t)=>K(e.box)-K(t.box));for(const e of i){const i=q(e,t,n),s={...e.list,index:i};if(a(s))return null;if(l(s))return{zone:e,to:s,line:I(e,i)};if(!r(s))return null}return null}function P(e,t,n=12){const l=e.children;if(0===l.length)return[];const a=e.box,r="x"===e.axis,i=r?a.left:a.top,s=i+(r?a.width:a.height),o=e=>r?e.left:e.top,c=e=>r?e.left+e.width:e.top+e.height,d=[];for(let u=0;u<=l.length;u++){const h=l[u-1],f=l[u];let p,m;if(h&&f)p=c(h),m=Math.max(o(f)-p,0);else{const e=h?(c(h)+s)/2:(i+o(f))/2;p=Math.min(Math.max(e,i+n),s-n),m=0}const g=r?{left:p,top:a.top,width:m,height:a.height}:{left:a.left,top:p,width:a.width,height:m};d.push({key:`${e.key}:+${u}`,place:{...e.list,index:u},box:g,axis:e.axis,label:t})}return d}function H(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const a=e.children[l-1],r=e.children[l],i=a.top+a.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:i,width:e.box.width,height:Math.max(r.top-i,0)}})}return n}var R={nodes:[],zones:[]},Y="data-puck-dropzone",Z="data-puck-component";function F(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function Q(e,t){const{frame:n,document:l}=e,a=e=>f(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),r=[],i=[];for(const e of l.querySelectorAll(`[${Y}]`)){const t=e.getAttribute(Y)??"";let n;try{n=m(t)}catch{continue}const l=[...e.querySelectorAll(`[${Z}]`)].filter(t=>t.parentElement?.closest(`[${Y}]`)===e),s=l.map(a);i.push({key:t,list:n,box:a(e),axis:F(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(Z);l&&r.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:r,zones:i}}var V="data-es-empty-cell",G="data-puck-dropzone",J=140;var W=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function U(i){const{canvas:f,session:m,readOnly:k,words:z=e.canvas}=i,T=g(i);x(()=>{T.current=i});const M=g(null),$=s(f),[C,L]=b(0),K=y(()=>L(e=>e+1),[]),[X,q]=b(R);x(()=>{const e=M.current;f&&e&&q((T.current.measure??Q)(f,e))},[f,$,i.revision,C]);const I=i.model,P=v(()=>I(X),[I,X]),H=w(m.subscribe,m.shown,m.shown),Y=i.choose,Z=(e,t)=>{const n=B(P.sources,e,t);return 0===n.length?null:Y?Y(n):n[n.length-1]},[F,J]=b(null),[U,_]=b(null),ee=g(null),te=()=>{ee.current&&clearTimeout(ee.current),ee.current=null},ne=()=>{te(),ee.current=setTimeout(()=>{m.get()||J(null)},140)};x(()=>te,[]);const le=g(null),ae=o(f),re=g(!1);re.current=ae,x(()=>{ae&&(te(),J(null))},[ae]);const[ie,se]=b(null);c(f,d,e=>se(e.detail?.id??null));const oe=!ie||ae||k||H?null:X.nodes.find(e=>e.id===ie)?.box??null;c(f,"mousemove",e=>{const t=M.current;if(!f||!t)return;const n=u(f.frame,e.clientX,e.clientY,t),l=h(t),a={x:n.x/l,y:n.y/l};if(le.current=a,T.current.readOnly||m.get()||re.current)return;te();const r=Z(a.x,a.y);J(e=>e?.key===r?.key&&e?.box===r?.box?e:r)}),c(f,"mouseout",e=>{e.relatedTarget||(le.current=null,ne())}),c(f,"mouseover",e=>{e.relatedTarget||K()});const ce=g(null),de=y(()=>{ce.current?.(),ce.current=null,_(null)},[]);x(()=>m.subscribe(()=>{m.get()?K():de()}),[m,de,K]),x(()=>de,[de]),("undefined"==typeof document?x:N)(()=>{if(m.get())return;const e=le.current;J(t=>k||re.current?null:e?Z(e.x,e.y):t?P.sources.find(e=>e.key===t.key)??null:null)},[P,H,m,k,Y]);const ue=e=>{const t=m.get(),n=M.current;if(!t||!n)return null;const l=p(n,e.clientX,e.clientY);le.current=l;const a=O(P.zones,l.x,l.y,e=>T.current.canDrop(t.item,e),e=>!!t.from&&r(t.from,e),e=>T.current.fallThrough?.(t.item,e,t.from)??!0);return a?{h:t,t:a}:null},he={onDragEnter:e=>{if(ce.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),r=f?l(f.document):null,i=[];t&&i.push(a(t)),r&&f&&i.push(a(r,f.frame)),ce.current=i.length?()=>i.forEach(e=>e()):null},onDragOver:e=>{const n=ue(e);if(!n)return void _(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};_(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(le.current=null,_(null))},onDrop:e=>{const t=ue(e);t&&(e.preventDefault(),m.end(),de(),T.current.onDrop(t.h.item,t.t.to))}},fe={draggable:!k&&!!F,onMouseEnter:te,onMouseLeave:()=>!m.get()&&ne(),onDragStart:e=>{if(F&&!k){m.start({key:F.key,item:F.item,from:F.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",F.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{m.end(),de()},onClick:()=>{F&&!k&&T.current.onPick?.(F.item)}},{seams:pe=[]}=P,me=P.zones.filter(e=>0===e.children.length),ge=!i.onZoneAdd||k||ae?[]:me,xe=ge.map(e=>e.key).join("\n");return x(()=>{const e=f?.document;if(!e)return;const t=new Set(xe?xe.split("\n"):[]);for(const n of e.querySelectorAll(`[${G}]`))n.toggleAttribute(V,t.has(n.getAttribute(G)??""));return()=>{for(const t of e.querySelectorAll(`[${V}]`))t.removeAttribute(V)}},[f,xe,X,$,C]),/* @__PURE__ */S("div",{ref:M,className:"es-canvas-layer",children:[H||!i.onSeamAdd||k||ae?null:pe.map(e=>
5
+ /* @__PURE__ */E(j,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??i.seamLabel??z.addSection,onInsert:()=>i.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),ge.length?ge.map(e=>/* @__PURE__ */E("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",U?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:W(e.box),onClick:()=>i.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */E("span",{className:"es-canvas-empty-add",children:z.addButton({label:e.addLabel??i.zoneAddLabel??z.addBlock})})},e.key)):null,H?/* @__PURE__ */E("div",{className:"es-canvas-catch",...he}):null,U&&!me.some(e=>e.key===U.zoneKey)?/* @__PURE__ */E("div",{className:`es-canvas-line is-${U.axis}`,style:W(U.line)}):null,oe?/* @__PURE__ */E("span",{className:"es-canvas-hint"+(oe.width<200?" is-below":""),style:{...D(),left:oe.left+oe.width,top:oe.width<200?oe.top+oe.height:oe.top},children:z.typeHint}):null,
6
+ /* @__PURE__ */E("div",{className:"es-canvas-handle-spot",style:F?{"--es-handle-x":`${F.box.left+2}px`,"--es-handle-y":`${Math.max(F.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */E(A,{className:"es-canvas-handle-tip",side:"top",content:!F||k||H?null:F.title??z.handle({label:F.label}),children:/* @__PURE__ */S("div",{className:["es-canvas-handle",F&&!k?"is-shown":"",H?"is-dragging":""].filter(Boolean).join(" "),...fe,children:[
7
+ /* @__PURE__ */E("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),F?.label]})})})]})}var _=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function ee({groups:t,session:n,itemFor:l,onInsert:a,onTileMenu:r,at:s,hint:o,searchLabel:c,readOnly:d,words:u=e.add}){const h=o??u.hint,f=c??u.search,[p,m]=b(""),g=k(),x=p.trim().toLowerCase(),y=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),v=t.map((e,t)=>({...e,key:y[t],tiles:x?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,x)):e.tiles})).filter(e=>e.tiles.length>0),w=(e,t)=>a=>{if(t)a.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),a.dataTransfer.effectAllowed="copy";try{a.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
8
+ return S("div",{className:"es-add",children:[s?/* @__PURE__ */S("div",{className:"es-add-at",role:"status",children:[
9
+ /* @__PURE__ */E("span",{children:s.label}),i(u.stop,/* @__PURE__ */E("button",{type:"button",className:"es-add-at-clear","aria-label":u.stop,onClick:s.onClear,children:/* @__PURE__ */E($,{size:12,"aria-hidden":"true"})}))]}):null,
10
+ /* @__PURE__ */E("p",{className:"es-add-hint",children:h}),
11
+ /* @__PURE__ */E("div",{className:"es-add-find",children:/* @__PURE__ */E(T,{id:g,type:"search","aria-label":f,placeholder:u.searchPlaceholder({label:f}),value:p,onChange:e=>m(e.target.value),leftIcon:/* @__PURE__ */E(C,{size:16,"aria-hidden":"true"}),rightAdornment:p?/* @__PURE__ */E(z,{size:"sm","aria-label":u.clearSearch,onClick:()=>m(""),children:/* @__PURE__ */E($,{size:12,"aria-hidden":"true"})}):void 0})}),0===v.length?/* @__PURE__ */S("div",{className:"es-add-empty",role:"status",children:[
12
+ /* @__PURE__ */E("div",{className:"es-add-empty-title",children:u.nothing({query:p.trim()})}),
13
+ /* @__PURE__ */E("div",{className:"es-add-empty-sub",children:u.tryAnother})]}):v.map(e=>/* @__PURE__ */S("section",{className:"es-add-group","aria-label":e.title,children:[
14
+ /* @__PURE__ */S("div",{className:"es-add-group-head",children:[
15
+ /* @__PURE__ */E("span",{className:"es-add-group-title",children:e.title}),
16
+ /* @__PURE__ */E("span",{className:"es-add-group-count",children:e.tiles.length})]}),
17
+ /* @__PURE__ */E("div",{className:_(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(d||e.disabled),l=d?void 0:e.disabled?e.disabledReason:e.title??u.tile({label:e.label});return i(l,/* @__PURE__ */S("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":u.tile({label:e.label}),onDragStart:w(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&a?.(e.type),onContextMenu:r?t=>{r(e.type,{x:t.clientX,y:t.clientY,owner:t.currentTarget})&&t.preventDefault()}:void 0,children:[null!=e.cover?/* @__PURE__ */E("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */E("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
18
+ /* @__PURE__ */S("span",{className:"es-add-tile-label",children:[e.label,null!=e.mark?/* @__PURE__ */E("span",{className:"es-add-tile-mark","aria-hidden":"true",children:e.mark}):null]})]},e.type))})})]},e.key))]})}export{ee as AddPanel,U as CanvasDragLayer,j as CanvasInsert,R as EMPTY_MEASURE,J as HANDLE_GRACE_MS,O as canvasTarget,L as contains,q as gapInZone,I as gapLine,P as insertSeams,Q as measureCanvas,X as pickSource,H as seamsBetween,B as sourcesAt};
@@ -0,0 +1 @@
1
+ function r(r){return r.filter(r=>!r.retired)}function t(r){const t=[];for(const o of r){const r=t[t.length-1];r&&r.group===o.group?r.items.push(o):t.push({group:o.group,items:[o]})}return t}export{t as blockRuns,r as offeredChoices};
@@ -1,2 +1,2 @@
1
- import{ScreenPartsProvider as t}from"./chunk-U25CP5VX.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-QX7GVECM.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-XHSGRH42.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-QEAUF632.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};