efficient-easel 22.0.0 → 23.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -23
- package/dist/{CanvasDragLayer-B6Yn9S8T.d.ts → CanvasDragLayer-NZpaX6aq.d.ts} +15 -4
- package/dist/{ScreenDocumentContext-BIK3uWtF.d.ts → ScreenDocumentContext-BDLUYzlM.d.ts} +4 -4
- package/dist/blocks/index.d.ts +11 -11
- package/dist/canvas/index.d.ts +21 -9
- package/dist/canvas/index.js +1 -1
- package/dist/{canvas-typing-Be4FO4q7.d.ts → canvas-typing-DOBx8dD3.d.ts} +12 -2
- package/dist/chunk-22I55W37.js +2 -0
- package/dist/chunk-2FYFAAAK.js +2 -0
- package/dist/{chunk-3S5N4HLJ.js → chunk-6NJHYXJM.js} +1 -1
- package/dist/chunk-6QSFJCJT.js +21 -0
- package/dist/{chunk-BTDI7JAA.js → chunk-A6ZP5II4.js} +2 -2
- package/dist/{chunk-IWCKVZHS.js → chunk-AGWKB77Q.js} +1 -1
- package/dist/chunk-AT4DDMJS.js +1 -0
- package/dist/chunk-DSKNJXB4.js +1 -0
- package/dist/{chunk-ZOSEBPAI.js → chunk-GKG3M5QK.js} +1 -1
- package/dist/{chunk-XWKQP6AE.js → chunk-HNV6HUSQ.js} +4 -4
- package/dist/chunk-HZSZT3BE.js +7 -0
- package/dist/{chunk-EB6NI2VK.js → chunk-IYHO4XQX.js} +1 -1
- package/dist/chunk-IZGFJWH4.js +1 -0
- package/dist/{chunk-KN2TIXUT.js → chunk-JPCOBNYW.js} +1 -1
- package/dist/{chunk-YC6KLSW3.js → chunk-JWOBAEBH.js} +1 -1
- package/dist/chunk-KXM6YRG2.js +1 -0
- package/dist/chunk-LN43DP2A.js +18 -0
- package/dist/{chunk-IROEWITG.js → chunk-LSTOOYG7.js} +1 -1
- package/dist/{chunk-TXR7GC5A.js → chunk-NQ7NRYTK.js} +8 -8
- package/dist/chunk-OXZDSOZV.js +1 -0
- package/dist/{chunk-BSHIQIZC.js → chunk-RPMSET77.js} +1 -1
- package/dist/{chunk-TLN5ZT76.js → chunk-T3LAGI43.js} +1 -1
- package/dist/chunk-TGSK5VII.js +5 -0
- package/dist/{chunk-K7BTCBWD.js → chunk-TGZCD6IP.js} +1 -1
- package/dist/chunk-VBOSOH5M.js +16 -0
- package/dist/{chunk-RY5AWQ63.js → chunk-VHFLOHGQ.js} +1 -1
- package/dist/chunk-YCSZAP7T.js +1 -0
- package/dist/chunk-YU3WHLGI.js +1 -0
- package/dist/chunk-Z6V22QRZ.js +64 -0
- package/dist/copy/index.d.ts +20 -6
- package/dist/copy/index.js +29 -29
- package/dist/data/index.d.ts +30 -22
- package/dist/data/index.js +1 -1
- package/dist/drag/drag.css +10 -1
- package/dist/drag/index.d.ts +5 -5
- package/dist/drag/index.js +1 -1
- package/dist/draw/index.d.ts +1 -1
- package/dist/easel/easel.css +24 -14
- package/dist/easel/index.d.ts +90 -53
- package/dist/easel/index.js +1 -1
- package/dist/edit-lock/index.d.ts +5 -5
- package/dist/fields/fields.css +1 -1
- package/dist/fields/index.d.ts +50 -16
- package/dist/fields/index.js +1 -1
- package/dist/node-ops/index.d.ts +3 -3
- package/dist/node-ops/index.js +1 -1
- package/dist/panel/index.d.ts +1 -1
- package/dist/panel/panel.css +6 -1
- package/dist/pick/index.d.ts +5 -5
- package/dist/{plan-CRUh2kVK.d.ts → plan-D0DgSLnY.d.ts} +5 -5
- package/dist/render/index.d.ts +13 -13
- package/dist/render/index.js +1 -1
- package/dist/{resolve-AJ6WF4EL.d.ts → resolve-Bz4mszpL.d.ts} +5 -5
- package/dist/rowMarks-CO5TpfLY.d.ts +44 -0
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.d.ts +2 -2
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +17 -20
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/PreviewDeviceContext.d.ts +1 -1
- package/dist/screen/components/PreviewPartsContext.d.ts +2 -2
- package/dist/screen/components/SaveControls.d.ts +8 -8
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +5 -5
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +9 -9
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +12 -12
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/usePartBridge.d.ts +10 -10
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +8 -8
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +4 -4
- package/dist/screen/lib/document/block-types-in.d.ts +2 -1
- package/dist/screen/lib/document/block-types-in.js +1 -1
- package/dist/screen/lib/document/content-tree.d.ts +8 -8
- package/dist/screen/lib/document/device-fields.d.ts +13 -27
- package/dist/screen/lib/document/device-fields.js +1 -1
- package/dist/screen/lib/document/field-markers.d.ts +4 -4
- package/dist/screen/lib/document/palette-sections.d.ts +5 -5
- package/dist/screen/lib/document/panel-fields.d.ts +5 -5
- package/dist/screen/lib/document/panel-no-control-mark.d.ts +6 -10
- package/dist/screen/lib/document/panel-no-control-mark.js +1 -1
- package/dist/screen/lib/document/part-id.d.ts +1 -1
- package/dist/screen/lib/document/preview-events.d.ts +2 -2
- package/dist/screen/lib/document/preview-selection-context.d.ts +2 -2
- package/dist/screen/lib/document/section-doc.d.ts +5 -5
- package/dist/screen/lib/document/section-doc.js +1 -1
- package/dist/screen/lib/document/slot-child-name.d.ts +1 -1
- package/dist/screen/lib/document/slot-section-spec.d.ts +1 -1
- package/dist/screen/lib/document/style-clipboard.d.ts +8 -8
- package/dist/screen/lib/document/style-clipboard.js +1 -1
- package/dist/screen/lib/document/tree-reveal.d.ts +4 -4
- package/dist/screen/lib/document/use-section-ops.d.ts +6 -6
- package/dist/screen/lib/document/use-section-ops.js +1 -1
- package/dist/screen/lib/document-addressing.d.ts +5 -5
- package/dist/screen/lib/document-hooks.d.ts +4 -4
- package/dist/screen/lib/host.d.ts +5 -5
- package/dist/screen/lib/key-scope.d.ts +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +5 -5
- package/dist/screen/lib/media-picker.d.ts +6 -6
- package/dist/screen/lib/page-lock.d.ts +4 -4
- package/dist/screen/lib/screen-parts.d.ts +22 -10
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-templates.d.ts +4 -4
- package/dist/screen/lib/session-context.d.ts +4 -4
- package/dist/screen/lib/session.d.ts +5 -5
- package/dist/screen/lib/shared-sections.d.ts +4 -4
- package/dist/screen/screen.css +14 -14
- package/dist/screen/words.d.ts +4 -3
- package/dist/screen/words.js +1 -1
- package/dist/{session-CrWwDt7Z.d.ts → session-EsjORLQ0.d.ts} +1 -1
- package/dist/shell/shell.css +2 -2
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +2 -2
- package/dist/style-clipboard/index.d.ts +2 -2
- package/dist/text-styles/index.d.ts +3 -3
- package/dist/text-styles/model.d.ts +1 -1
- package/dist/{types-BFd8FqQw.d.ts → types-BIytwvvH.d.ts} +2 -2
- package/dist/{types-DFxBChE3.d.ts → types-BljCVdzR.d.ts} +17 -17
- package/dist/{types-DlQIM1YO.d.ts → types-Dq180WRV.d.ts} +8 -8
- package/dist/{useNodeOps-C_nisDHh.d.ts → useNodeOps-igxrnEhq.d.ts} +2 -2
- package/dist/{watch-D0bNZRtU.d.ts → watch-Unf6SfUf.d.ts} +3 -3
- package/dist/{words-gIDCeRv3.d.ts → words-B5Gb7KFq.d.ts} +1 -1
- package/dist/{words-BpTjCfqO.d.ts → words-Cf5VT2Ic.d.ts} +2 -2
- package/package.json +2 -2
- package/dist/chunk-4LGROS5L.js +0 -1
- package/dist/chunk-BDSLF5BR.js +0 -1
- package/dist/chunk-CPL43ZLJ.js +0 -1
- package/dist/chunk-CUZQ2HMA.js +0 -18
- package/dist/chunk-GHBK7BKL.js +0 -1
- package/dist/chunk-INRERJU4.js +0 -2
- package/dist/chunk-IYYE7VJN.js +0 -65
- package/dist/chunk-KWLHKKZO.js +0 -2
- package/dist/chunk-L55YIXDC.js +0 -1
- package/dist/chunk-MZ5GSSZ3.js +0 -7
- package/dist/chunk-SJMS247S.js +0 -5
- package/dist/chunk-SWBADIQT.js +0 -1
- package/dist/chunk-WJSEWAWK.js +0 -15
- package/dist/chunk-YHFKWV7H.js +0 -21
package/README.md
CHANGED
|
@@ -425,14 +425,14 @@ unknown pastes only between two components of the same type. An empty
|
|
|
425
425
|
## The document — `efficient-easel/data`
|
|
426
426
|
|
|
427
427
|
`efficient-easel/data` (added in 0.67.0) is the bottom layer of the engine that
|
|
428
|
-
replaces the old
|
|
428
|
+
replaces the old library (the blueprint's step 1.1): the saved document as pure
|
|
429
429
|
functions. It imports nothing and touches no browser global, so the editor's
|
|
430
430
|
store, a Next server component, a Node script and a test all call the same
|
|
431
431
|
code.
|
|
432
432
|
|
|
433
433
|
**The format does not change.** A document is exactly what Puck 0.20 saves —
|
|
434
434
|
`{ root: { props }, content: [...], zones: {} }`, with a block's children
|
|
435
|
-
inline in its slot props — so no campaign or page migrates when the old
|
|
435
|
+
inline in its slot props — so no campaign or page migrates when the old library goes.
|
|
436
436
|
|
|
437
437
|
```ts
|
|
438
438
|
import { normalizeData, find, insert, move, remove, duplicate, setProps, setRoot, createNode, walk, ROOT_LIST } from 'efficient-easel/data';
|
|
@@ -447,15 +447,16 @@ next = setProps(next, config, id, { level: 3 });
|
|
|
447
447
|
|
|
448
448
|
| Export | Notes |
|
|
449
449
|
|---|---|
|
|
450
|
-
| `normalizeData(data, config)` | the old
|
|
450
|
+
| `normalizeData(data, config)` | the old library's load: missing top-level slots become `[]`, `zones` becomes `{}`, the root's `defaultProps` fill what is missing. Older formats (props written on `root`, children parked in `zones`) are converted the way the old library's `migrate()` converts them. **A document already in shape comes back as the same object.** |
|
|
451
451
|
| `find`, `walk`, `slotsOf`, `getList` | Read. `walk` visits parent before children, slots in declaration order; returning a node from the visitor replaces it. |
|
|
452
|
-
| `
|
|
452
|
+
| `isNode`, `isNodeList` | Shape checks. `isNode`: a string `type` and a `props` object. `isNodeList`: a slot's array — non-empty, every item a node; a list field (stats rows) is not one. The one answer for the easel and every host; do not write your own. |
|
|
453
|
+
| `insert`, `move`, `remove`, `duplicate` | Change the tree. `move` within one list takes the index AFTER the move (the old library's rule). |
|
|
453
454
|
| `setProps`, `setRoot` | Merge props. A key keeps its place; a patch that changes nothing returns the same document. |
|
|
454
455
|
| `createNode(config, type, props?)`, `newId(type)` | A new block the way the Add panel makes one: `{ ...defaultProps, id }`, ids `<Type>-<uuid>`. |
|
|
455
|
-
| `zoneKey`, `parseZoneKey`, `ROOT_LIST` | A place is `{ parentId, slot, index }`; the top-level list is `{ parentId: 'root', slot: 'default-zone' }` — the two halves of the old
|
|
456
|
+
| `zoneKey`, `parseZoneKey`, `ROOT_LIST` | A place is `{ parentId, slot, index }`; the top-level list is `{ parentId: 'root', slot: 'default-zone' }` — the two halves of the old library's zone key. |
|
|
456
457
|
|
|
457
458
|
`config` is the app's block config: only `fields` (which props are slots, including
|
|
458
|
-
slots inside `object` / `array` fields) and `defaultProps` are read, so an old
|
|
459
|
+
slots inside `object` / `array` fields) and `defaultProps` are read, so an old library
|
|
459
460
|
`Config` works as it is. A type the config does not know is kept whole.
|
|
460
461
|
|
|
461
462
|
Every edit copies only the path to the change, so an untouched block is the
|
|
@@ -566,11 +567,11 @@ base words under a translation, markers on untranslated rows). Routing and
|
|
|
566
567
|
`efficient-easel/blocks` (added in 0.92.0) holds the types a block is written
|
|
567
568
|
with: Puck 0.20's `Config`, `ComponentConfig`, `Fields`, `Field`,
|
|
568
569
|
`CustomField`, `ComponentData`, `Data`, `Slot` and `SlotComponent`, with the
|
|
569
|
-
same generics. An app that typed its blocks with the old
|
|
570
|
+
same generics. An app that typed its blocks with the old library's imports them from here
|
|
570
571
|
instead, and no block changes. It is types only: nothing in it exists at
|
|
571
572
|
runtime. One key is the engine's own: `translatable` on a field (0.97.0),
|
|
572
573
|
which says whether the prop is written again per language (the translation
|
|
573
|
-
overlay, above). It is optional, so a field written for the old
|
|
574
|
+
overlay, above). It is optional, so a field written for the old library is still a field.
|
|
574
575
|
|
|
575
576
|
```ts
|
|
576
577
|
import type { Config, CustomField, Slot } from 'efficient-easel/blocks';
|
|
@@ -591,9 +592,9 @@ const config: Config<{ Hero: HeroProps }> = {
|
|
|
591
592
|
## The published renderer — `efficient-easel/render`
|
|
592
593
|
|
|
593
594
|
`efficient-easel/render` (added in 0.68.0) draws a saved document the way the
|
|
594
|
-
published site does — the drop-in for the old
|
|
595
|
+
published site does — the drop-in for the old library's `<Render>` (the blueprint's step
|
|
595
596
|
1.2). Same config, same document, **the same HTML**: the specs hold it to
|
|
596
|
-
Puck 0.20.2's markup, recorded from the old
|
|
597
|
+
Puck 0.20.2's markup, recorded from the old library's own `<Render>`, byte for byte.
|
|
597
598
|
|
|
598
599
|
```tsx
|
|
599
600
|
import { Render } from 'efficient-easel/render';
|
|
@@ -603,18 +604,18 @@ import { Render } from 'efficient-easel/render';
|
|
|
603
604
|
|
|
604
605
|
It is a plain function: **no hook, no context, no `'use client'`**. It runs in a
|
|
605
606
|
server component, a client component or a script, and `Render(props)` called
|
|
606
|
-
directly returns the element tree. (The old
|
|
607
|
+
directly returns the element tree. (The old library's reads the document from a context
|
|
607
608
|
and builds props in hooks, so it only runs as a client component.) Whether the
|
|
608
609
|
blocks themselves can run on the server is up to the blocks.
|
|
609
610
|
|
|
610
|
-
The block authoring shape is the old
|
|
611
|
+
The block authoring shape is the old library's, so an app passes the config it has: a
|
|
611
612
|
block's `render` gets its props, `editor`, and each slot as a component —
|
|
612
613
|
`render: ({ content: Content }) => <Content className="grid" />` — which draws
|
|
613
614
|
`<div className style>` around its blocks. The top-level list is wrapped in one
|
|
614
|
-
plain `<div>`, and `editor` carries exactly what the old
|
|
615
|
+
plain `<div>`, and `editor` carries exactly what the old library's client `<Render>` gave
|
|
615
616
|
a block at each level. A type the config does not know draws nothing.
|
|
616
617
|
|
|
617
|
-
**The old
|
|
618
|
+
**The old library's name is gone (22.0.0).** The block prop is `editor`, the
|
|
618
619
|
canvas markup `data-easel-*`, the subpaths `screen/lib/document/*`, the
|
|
619
620
|
inspector mode `{ kind: "selection" }` and the root's id `page-root`. What was
|
|
620
621
|
removed, and what replaces each name, is in the CHANGELOG under 22.0.0.
|
|
@@ -638,7 +639,7 @@ always has it.
|
|
|
638
639
|
|
|
639
640
|
`className` (0.95.0) is an opt-in class for that top-level wrapper, for a host
|
|
640
641
|
whose stylesheet has to reach it: `<Render … className="page" />`. Left out,
|
|
641
|
-
the wrapper is bare and the markup is the old
|
|
642
|
+
the wrapper is bare and the markup is the old library's.
|
|
642
643
|
|
|
643
644
|
## What a block draws with — `efficient-easel/draw`, `efficient-easel/draw/client`
|
|
644
645
|
|
|
@@ -690,7 +691,7 @@ graph to an exact list of files and imports.
|
|
|
690
691
|
|
|
691
692
|
`efficient-easel/canvas` (added in 0.70.0, blueprint step 2.1) is the one way
|
|
692
693
|
into the editor's canvas iframe — `#preview-frame`, the engine's own
|
|
693
|
-
same-origin canvas frame (the old
|
|
694
|
+
same-origin canvas frame (the old library's, until the editors left it). It replaces the
|
|
694
695
|
editors' own polling loops, host-head style injection and hand-written
|
|
695
696
|
coordinate maths.
|
|
696
697
|
|
|
@@ -707,7 +708,7 @@ const tick = useCanvasLayout(canvas); // re-m
|
|
|
707
708
|
|---|---|
|
|
708
709
|
| `useCanvasFrame(rootRef, { selector?, readySelector? })` | `{ frame, document, window }` or `null`. Found by a MutationObserver and the frame's `load` event — never a timer. `readySelector` waits for the canvas to be drawn in a loaded-but-empty document. |
|
|
709
710
|
| `useCanvasEvent(canvas, type, handler, { on?, capture? })` | A listener on the canvas document (or window) that moves to a replacement document and always calls the latest handler, without re-binding on every render. |
|
|
710
|
-
| `useCanvasStyle(canvas, key, css)` | A `<style>` in the canvas document's head only — re-injected into a replacement, put back if something empties the head (the old
|
|
711
|
+
| `useCanvasStyle(canvas, key, css)` | A `<style>` in the canvas document's head only — re-injected into a replacement, put back if something empties the head (the old library's AutoFrame does, once), removed on unmount, never written to the host page. |
|
|
711
712
|
| `useCanvasLayout(canvas)` | A number that changes when the canvas scrolls, resizes, is replaced, or the host scrolls or resizes (plus two settle passes). |
|
|
712
713
|
| `frameRectToHost`, `framePointToHost`, `frameScale` | A box or point measured inside the frame, on the host page — through the frame's SCALE (a phone view drawn small). |
|
|
713
714
|
| `fitCanvas({ available, width, maxScale })` | The canvas width and the scale that fits it into the pane. |
|
|
@@ -787,7 +788,19 @@ A host's PARTS join the chain (W0): through `CanvasPartsContext` (a
|
|
|
787
788
|
host says which part of the innermost block is under the pointer, and
|
|
788
789
|
`clickPickPart` puts it after its block: a container's part is one more rung, a
|
|
789
790
|
block with no lists is picked with its part at once. The hover outline draws
|
|
790
|
-
the part (`is-hover-part`); Escape lets a part go before it climbs.
|
|
791
|
+
the part (`is-hover-part`); Escape lets a part go before it climbs. One box per text (Lewis 2026-10-26): a part gets a box of its own
|
|
792
|
+
(`is-hover-part`; with the host's `selectedPart(doc)`, the selected rectangle
|
|
793
|
+
`is-selected is-selected-part` while the block's selected box stands down),
|
|
794
|
+
unless it is its block's only part (`CanvasPart.whole`, a Text block's words)
|
|
795
|
+
in a block with no lists: then the block and its words are one rung and share
|
|
796
|
+
the block box, where the drag handle's label is. With no `whole`, a block with
|
|
797
|
+
no lists is read as that one rung. Without `selectedPart`, the block box as
|
|
798
|
+
before. The LABEL names what is selected (Lewis 2026-10-26):
|
|
799
|
+
while a part with a box of its own is open, the screen hands the drag layer a
|
|
800
|
+
`tag` (`CanvasPart.label`, the Layers name) drawn on the part's box like the
|
|
801
|
+
handle but with no drag dots, and the block's handle is not drawn; to drag
|
|
802
|
+
the block, select the block first or drag its Layers row (`partHasOwnBox` is
|
|
803
|
+
the one rule for the box and the label).
|
|
791
804
|
|
|
792
805
|
## Autosave — `efficient-easel/autosave`
|
|
793
806
|
|
|
@@ -997,7 +1010,7 @@ const easel = createEasel<EaselConfig>({ config, data, onChange: (doc) => autosa
|
|
|
997
1010
|
- `bindUndoKeys(target, editor, { leaveTyping: true })` (0.106.0) leaves a
|
|
998
1011
|
press where a person types — a text field, a textarea, an editable
|
|
999
1012
|
region — to that field's own undo. Left out, a press there undoes the
|
|
1000
|
-
easel's step, as the old
|
|
1013
|
+
easel's step, as the old library's did; the provider and the canvas bind so.
|
|
1001
1014
|
- **Two tabs since 4.0.0: Design and Animation.** A field's `bucket` is one
|
|
1002
1015
|
of `SETTINGS_BUCKETS`; anything else (the 3.x `Content`, `Style`, `Layout`)
|
|
1003
1016
|
is ignored, so the rows stay in the tab above them. Inside Design the host
|
|
@@ -1022,12 +1035,19 @@ const easel = createEasel<EaselConfig>({ config, data, onChange: (doc) => autosa
|
|
|
1022
1035
|
character but letters, digits, `-` and `_` becomes `-u<hex>-`, so `" text"`
|
|
1023
1036
|
is `<prefix>-fold--u20-text`); the key itself is unchanged for
|
|
1024
1037
|
`closedFolds`, `onFold` and `data-fold`.
|
|
1038
|
+
- **In the phone view `planFields` plans only rows with a phone value.** When
|
|
1039
|
+
`showWhenContext.device` is `"mobile"`, a row that is not a `deviceField("mobile", …)`
|
|
1040
|
+
is not planned or drawn (it would write the desktop value). A heading mark, a
|
|
1041
|
+
slot and a field that draws no control anywhere stay; the `Inspector`'s `lead`
|
|
1042
|
+
is not drawn. `fieldShownInView(field, device)`
|
|
1043
|
+
is the one answer, exported from `efficient-easel/fields`. Desktop, tablet and
|
|
1044
|
+
no device: every row, as before.
|
|
1025
1045
|
- **`planFields().rows` holds `slot` rows.** They draw nothing and are there so
|
|
1026
1046
|
the slot's name has a bucket. Filter `row.field.type !== 'slot'` before
|
|
1027
1047
|
drawing or counting rows of your own.
|
|
1028
1048
|
- **Inserting a block runs no resolver; `easel.resolveNode` does.** The
|
|
1029
|
-
`insert` action puts the block in with its `defaultProps`, as the old
|
|
1030
|
-
did. What ran a new block's `resolveData` in the old
|
|
1049
|
+
`insert` action puts the block in with its `defaultProps`, as the old library's reducer
|
|
1050
|
+
did. What ran a new block's `resolveData` in the old library was its own drop from the
|
|
1031
1051
|
component list, and the engine has no drop of its own: the Add list's click
|
|
1032
1052
|
and the drag's drop are the host's. So follow an insert with it:
|
|
1033
1053
|
|
|
@@ -1212,7 +1232,7 @@ words, its marks and buttons of the layer's own are `blockLook.rowName`,
|
|
|
1212
1232
|
`rowPreview`, `rowMarks` and `rowActions`. A block config's
|
|
1213
1233
|
`permissions.delete` / `duplicate` set to `false` takes the action off the
|
|
1214
1234
|
block's rows and its menu, and the inspector is handed the answer for its
|
|
1215
|
-
head (`nodeActions`). The frame's words (
|
|
1235
|
+
head (`nodeActions`). The frame's words (the pinned labels,
|
|
1216
1236
|
the band's) are `screen` words too.
|
|
1217
1237
|
|
|
1218
1238
|
Its canvas can be a mail preview's (0.105.0). `devices.fit: "shrink"` draws a
|
|
@@ -1330,7 +1350,9 @@ layer, Copy, Copy style). Inside another app's page (`ownsDocument` false) ⌘Z
|
|
|
1330
1350
|
editor's ground (its root takes focus, never a tab stop), and never in a text
|
|
1331
1351
|
field or an editable region, where they are the field's own. A row's
|
|
1332
1352
|
right-click is that row's: a pinned node's row opens its node's menu, a rung's
|
|
1333
|
-
row opens none, and the ground's "
|
|
1353
|
+
row opens none, and the ground's "This page" (`screen.pageStyles`) is the
|
|
1354
|
+
layer's `ScreenBridges.openPageStyles`, drawn only where the layer hands one.
|
|
1355
|
+
The tree has no row for the document's own settings (23.0.0).
|
|
1334
1356
|
And `blockRules.stripCopy(node)` cleans every copy the screen makes — the
|
|
1335
1357
|
menu's Duplicate and Paste, ⌘V, a saved section put in from Add — of what
|
|
1336
1358
|
only its original may hold (the campaign designer's baked picture).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { C as CanvasTarget$1 } from './watch-
|
|
3
|
-
import { S as SlotAddress, P as Place } from './types-
|
|
4
|
-
import { D as DragSession } from './session-
|
|
2
|
+
import { C as CanvasTarget$1 } from './watch-Unf6SfUf.js';
|
|
3
|
+
import { S as SlotAddress, P as Place } from './types-Dq180WRV.js';
|
|
4
|
+
import { D as DragSession } from './session-EsjORLQ0.js';
|
|
5
5
|
import { D as DragWords } from './words-SD4neL0n.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -196,6 +196,17 @@ type CanvasDragLayerProps<I> = {
|
|
|
196
196
|
/** What the outline says the drop does ("Replace image"). */
|
|
197
197
|
label?: (item: I, source: CanvasSource<I>) => string;
|
|
198
198
|
};
|
|
199
|
+
/**
|
|
200
|
+
* The NAME of what is selected when it is a part with a box of its own (a
|
|
201
|
+
* section's scrolling bar; Lewis 2026-10-26: the label says what is
|
|
202
|
+
* selected, on the corner of its box). Drawn as the handle is drawn, on the
|
|
203
|
+
* part's top-left corner, with no drag dots: a part does not drag. The host
|
|
204
|
+
* leaves the block's handle off meanwhile (`choose`). Absent: no tag.
|
|
205
|
+
*/
|
|
206
|
+
tag?: {
|
|
207
|
+
element: Element;
|
|
208
|
+
label: string;
|
|
209
|
+
} | null;
|
|
199
210
|
/** The handle CLICKED, not dragged: select what it names. Absent: a click does nothing. */
|
|
200
211
|
onPick?: (item: I) => void;
|
|
201
212
|
/** "+ Add section" in a seam: open the Add panel at that place. */
|
|
@@ -207,7 +218,7 @@ type CanvasDragLayerProps<I> = {
|
|
|
207
218
|
readOnly?: boolean;
|
|
208
219
|
/** Re-measure when this changes — the document's revision. Layout changes re-measure by themselves. */
|
|
209
220
|
revision?: unknown;
|
|
210
|
-
/** How the canvas is measured. Default: the old
|
|
221
|
+
/** How the canvas is measured. Default: the old library's markers (./measure). */
|
|
211
222
|
measure?: (canvas: CanvasTarget$1, layer: Element) => MeasuredCanvas;
|
|
212
223
|
/**
|
|
213
224
|
* The layer's own words in the host's language:
|
|
@@ -621,15 +621,15 @@ type ScreenDocumentValue = {
|
|
|
621
621
|
* editing right now. Null while loading and between retargets, so it also
|
|
622
622
|
* keys any once-per-document work (e.g. the pinned-chrome seed). */
|
|
623
623
|
docId: string | null;
|
|
624
|
-
/** The document exactly as it was LOADED from the backend: the old
|
|
624
|
+
/** The document exactly as it was LOADED from the backend: the old library's initial
|
|
625
625
|
* state, and the persisted snapshot a load-time seed must measure itself
|
|
626
|
-
* against. Null while loading. Edits live in the old
|
|
626
|
+
* against. Null while loading. Edits live in the old library's own store, so this does
|
|
627
627
|
* NOT track them — it stays the last-loaded layout for the whole session. */
|
|
628
628
|
data: Data | null;
|
|
629
629
|
/** The freshest layout the merchant is actually viewing — the latest edit made
|
|
630
630
|
* since load (tracked on every onChange, even after the autosave settles), else
|
|
631
631
|
* the last-loaded `data`. Lets a feature snapshot the live view (e.g. the
|
|
632
|
-
* read-only origin backdrop in footer focus) without reaching into the old
|
|
632
|
+
* read-only origin backdrop in footer focus) without reaching into the old library's store.
|
|
633
633
|
* Lean accessor (ISP) — never exposes the ref. */
|
|
634
634
|
getLiveData: () => Data | null;
|
|
635
635
|
error: string | null;
|
|
@@ -659,7 +659,7 @@ type ScreenDocumentValue = {
|
|
|
659
659
|
/** "Retry now": a failed save goes again at once instead of waiting out its
|
|
660
660
|
* backoff. */
|
|
661
661
|
retrySave: () => void;
|
|
662
|
-
/** Autosave — hand every the old
|
|
662
|
+
/** Autosave — hand every the old library onChange to this. */
|
|
663
663
|
onChange: (next: Data) => void;
|
|
664
664
|
/** Persist the pending edit immediately; resolves to whether nothing is left
|
|
665
665
|
* unsaved. */
|
package/dist/blocks/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ReactElement, FC, CSSProperties, ReactNode, JSX } from 'react';
|
|
2
|
-
import { P as Permissions, A as AppState } from '../types-
|
|
2
|
+
import { P as Permissions, A as AppState } from '../types-BljCVdzR.js';
|
|
3
3
|
import '../data/index.js';
|
|
4
|
-
import '../types-
|
|
5
|
-
import '../resolve-
|
|
6
|
-
import '../plan-
|
|
4
|
+
import '../types-Dq180WRV.js';
|
|
5
|
+
import '../resolve-Bz4mszpL.js';
|
|
6
|
+
import '../plan-D0DgSLnY.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* efficient-easel/blocks — how a block is WRITTEN: its config, its fields, the
|
|
10
10
|
* props its `render` receives and the document it lands in.
|
|
11
11
|
*
|
|
12
|
-
* Blueprint default #3 keeps the old
|
|
12
|
+
* Blueprint default #3 keeps the old library's block writing, so the ~119 blocks both apps
|
|
13
13
|
* wrote move onto the engine without a line changed. Until 6.1 those blocks were
|
|
14
|
-
* typed by importing the old
|
|
14
|
+
* typed by importing the old library's own types, which kept the old library's package in both apps'
|
|
15
15
|
* dependencies after nothing ran it any more. These are the same shapes, written
|
|
16
16
|
* here — Puck 0.20's `Config`, `ComponentConfig`, `Fields`, `Field`,
|
|
17
17
|
* `CustomField`, `ComponentData`, `Data`, `Slot` and `SlotComponent` — so an app
|
|
@@ -20,7 +20,7 @@ import '../plan-CRUh2kVK.js';
|
|
|
20
20
|
* WHAT IS LEFT OUT, ON PURPOSE:
|
|
21
21
|
* - the `ConfigParams` form of `Config<{ components, root, fields }>` and the
|
|
22
22
|
* user field-type extension it carries (neither app uses it);
|
|
23
|
-
* - everything about the old
|
|
23
|
+
* - everything about the old library's own app — its store, overrides, plugins and
|
|
24
24
|
* history. Those are the engine's now (`efficient-easel/easel`).
|
|
25
25
|
*
|
|
26
26
|
* The `editor` prop is what every block's `render` destructures
|
|
@@ -49,7 +49,7 @@ type BaseField = {
|
|
|
49
49
|
metadata?: Metadata;
|
|
50
50
|
visible?: boolean;
|
|
51
51
|
/**
|
|
52
|
-
* NOT THE OLD
|
|
52
|
+
* NOT THE OLD LIBRARY'S — the engine's (0.97.0). Whether this prop is written again in
|
|
53
53
|
* each language of a multilingual page (`efficient-easel/data`, the
|
|
54
54
|
* translation overlay). Left out, a `text` or `textarea` field is and every
|
|
55
55
|
* other type is not, so a `custom` field that edits words, or a picture with
|
|
@@ -104,7 +104,7 @@ type ObjectField<Props = AnyRecord> = BaseField & {
|
|
|
104
104
|
[SubPropName in keyof Props]: Field<Props[SubPropName]>;
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
|
-
/** A custom field's drawing: called with the old
|
|
107
|
+
/** A custom field's drawing: called with the old library's six props, as both apps wrote them. */
|
|
108
108
|
type CustomFieldRender<Value> = (props: {
|
|
109
109
|
field: CustomField<Value>;
|
|
110
110
|
name: string;
|
|
@@ -124,9 +124,9 @@ type SlotField = BaseField & {
|
|
|
124
124
|
disallow?: string[];
|
|
125
125
|
};
|
|
126
126
|
/**
|
|
127
|
-
* The old
|
|
127
|
+
* The old library's `external` field: a value picked from a list the app fetches. Neither
|
|
128
128
|
* app has one and the Inspector does not draw it — it is in the union only so
|
|
129
|
-
* the union is the old
|
|
129
|
+
* the union is the old library's, and a function that takes `Fields` takes the old library's too.
|
|
130
130
|
*/
|
|
131
131
|
type ExternalField<Props = AnyRecord> = BaseField & {
|
|
132
132
|
type: 'external';
|
package/dist/canvas/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
import { C as CanvasTarget, W as WatchOptions } from '../watch-
|
|
3
|
-
export { B as BLOCK_SELECTOR, a as CANVAS_SELECTOR, L as LIST_SELECTOR, i as isFrameReady, w as watchCanvasFrame } from '../watch-
|
|
2
|
+
import { C as CanvasTarget, W as WatchOptions } from '../watch-Unf6SfUf.js';
|
|
3
|
+
export { B as BLOCK_SELECTOR, a as CANVAS_SELECTOR, L as LIST_SELECTOR, i as isFrameReady, w as watchCanvasFrame } from '../watch-Unf6SfUf.js';
|
|
4
4
|
export { R as REPEAT_ATTRIBUTE, a as REPEAT_INDEX_ATTRIBUTE, i as isRepeatCopy, m as mainCopyOf, q as queryAllCopies, b as queryMainCopy } from '../repeat-D65bJS8d.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -38,10 +38,19 @@ declare function nodeIdAt(target: EventTarget | null, attribute?: string): strin
|
|
|
38
38
|
* the canvas's wrapper, and the wrapper's own box is the answer. A block whose
|
|
39
39
|
* drawing leaves the wrapper's flow (the website's header bar is
|
|
40
40
|
* `position: fixed`) leaves the wrapper with no height; then the union of what
|
|
41
|
-
* it drew
|
|
42
|
-
*
|
|
41
|
+
* it drew is the box: each child element with a box of its own, and inside a
|
|
42
|
+
* child with none (a host's own wrapper divs round the bar), what that child
|
|
43
|
+
* drew, the same way. Never null: a wrapper with nothing drawn is its own empty
|
|
44
|
+
* box.
|
|
43
45
|
*/
|
|
44
46
|
declare function drawnBox(el: Element): Box;
|
|
47
|
+
/** Whether one element holds the other (or is it): the same words, however the host stamps them. */
|
|
48
|
+
declare function related(a: Element, b: Element): boolean;
|
|
49
|
+
/** How far the box round typed or selected words stands clear of them, in px
|
|
50
|
+
* (Lewis 2026-10-14). The one home: the canvas sets `--es-words-clear` from
|
|
51
|
+
* it (`.is-typing`, `.is-selected.is-words` read that, easel.css) and the
|
|
52
|
+
* drag layer measures the handle's corner from it. */
|
|
53
|
+
declare const WORDS_CLEAR = 4;
|
|
45
54
|
interface Box {
|
|
46
55
|
left: number;
|
|
47
56
|
top: number;
|
|
@@ -134,10 +143,10 @@ declare function removeCanvasStyle(doc: Document, key: string): void;
|
|
|
134
143
|
/**
|
|
135
144
|
* efficient-easel/canvas — the one way into the editor's canvas frame.
|
|
136
145
|
*
|
|
137
|
-
* Step 2.1 of the engine that replaces the old
|
|
146
|
+
* Step 2.1 of the engine that replaces the old library (blueprint "From The Ground Up
|
|
138
147
|
* For Efficient Editor", 2026-09-29). Both editors draw their canvas in an
|
|
139
|
-
* iframe — the old
|
|
140
|
-
* CanvasFrame once the editors leave the old
|
|
148
|
+
* iframe — the old library's `#preview-frame` today, the engine's own same-origin
|
|
149
|
+
* CanvasFrame once the editors leave the old library — and each reached into it its own
|
|
141
150
|
* way: eight polling loops with eight intervals, stylesheets pushed into the
|
|
142
151
|
* host `<head>` hoping to be mirrored, key listeners re-bound on a one-second
|
|
143
152
|
* timer, coordinate conversions that forgot the frame's scale. This module is
|
|
@@ -180,10 +189,13 @@ type CanvasTypingEvent = CustomEvent<{
|
|
|
180
189
|
* can and are not being typed, else null. The layer over the canvas says how
|
|
181
190
|
* to start — "Double-click to edit" — on that block (Lewis 2026-10-20: one
|
|
182
191
|
* click on a Text block looked like typing, and nothing said it needs two).
|
|
192
|
+
* `words`: the selected words when they wear the typing box (Lewis 2026-10-26,
|
|
193
|
+
* option B), for the layer's handle and hint to sit on that box's corners.
|
|
183
194
|
*/
|
|
184
195
|
declare const CANVAS_TYPABLE_EVENT = "easel:canvas-typable";
|
|
185
196
|
type CanvasTypableEvent = CustomEvent<{
|
|
186
197
|
id: string | null;
|
|
198
|
+
words?: Element;
|
|
187
199
|
}>;
|
|
188
200
|
type CanvasEventMap = DocumentEventMap & WindowEventMap & {
|
|
189
201
|
[CANVAS_TYPING_EVENT]: CanvasTypingEvent;
|
|
@@ -212,7 +224,7 @@ declare function useCanvasTyping(canvas: CanvasTarget | null): boolean;
|
|
|
212
224
|
* back in a replacement document, and take it out on unmount. An empty string
|
|
213
225
|
* removes it. Nothing is written to the host page.
|
|
214
226
|
*
|
|
215
|
-
* "Keep" means it comes back if something else takes it out. The old
|
|
227
|
+
* "Keep" means it comes back if something else takes it out. The old library's AutoFrame
|
|
216
228
|
* empties the frame's `<head>` once, when the host styles it mirrors have
|
|
217
229
|
* loaded (`doc.head.innerHTML = ""` in CopyHostStyles), and nothing orders that
|
|
218
230
|
* after the canvas is published — so a sheet written first would silently go.
|
|
@@ -234,4 +246,4 @@ declare function useCanvasLayout(canvas: CanvasTarget | null, { settle }?: {
|
|
|
234
246
|
settle?: readonly number[];
|
|
235
247
|
}): number;
|
|
236
248
|
|
|
237
|
-
export { BLOCK_ATTRIBUTE, type Box, CANVAS_TYPABLE_EVENT, CANVAS_TYPING_EVENT, type CanvasFit, CanvasTarget, type CanvasTypableEvent, type CanvasTypingEvent, WatchOptions, clientPointToLayer, drawnBox, elementScale, fitCanvas, framePointToHost, frameRectToHost, frameRectToLayer, frameScale, isTypingTarget, nodeIdAt, removeCanvasStyle, setCanvasNonce, upsertCanvasStyle, useCanvasEvent, useCanvasFrame, useCanvasLayout, useCanvasStyle, useCanvasTyping };
|
|
249
|
+
export { BLOCK_ATTRIBUTE, type Box, CANVAS_TYPABLE_EVENT, CANVAS_TYPING_EVENT, type CanvasFit, CanvasTarget, type CanvasTypableEvent, type CanvasTypingEvent, WORDS_CLEAR, WatchOptions, clientPointToLayer, drawnBox, elementScale, fitCanvas, framePointToHost, frameRectToHost, frameRectToLayer, frameScale, isTypingTarget, nodeIdAt, related, removeCanvasStyle, setCanvasNonce, upsertCanvasStyle, useCanvasEvent, useCanvasFrame, useCanvasLayout, useCanvasStyle, useCanvasTyping };
|
package/dist/canvas/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{BLOCK_ATTRIBUTE,BLOCK_SELECTOR,CANVAS_SELECTOR,CANVAS_TYPABLE_EVENT,CANVAS_TYPING_EVENT,LIST_SELECTOR,clientPointToLayer,drawnBox,elementScale,fitCanvas,framePointToHost,frameRectToHost,frameRectToLayer,frameScale,isFrameReady,isTypingTarget,nodeIdAt,removeCanvasStyle,setCanvasNonce,upsertCanvasStyle,useCanvasEvent,useCanvasFrame,useCanvasLayout,useCanvasStyle,useCanvasTyping,watchCanvasFrame}from"../chunk-
|
|
1
|
+
export{BLOCK_ATTRIBUTE,BLOCK_SELECTOR,CANVAS_SELECTOR,CANVAS_TYPABLE_EVENT,CANVAS_TYPING_EVENT,LIST_SELECTOR,WORDS_CLEAR,clientPointToLayer,drawnBox,elementScale,fitCanvas,framePointToHost,frameRectToHost,frameRectToLayer,frameScale,isFrameReady,isTypingTarget,nodeIdAt,related,removeCanvasStyle,setCanvasNonce,upsertCanvasStyle,useCanvasEvent,useCanvasFrame,useCanvasLayout,useCanvasStyle,useCanvasTyping,watchCanvasFrame}from"../chunk-YU3WHLGI.js";export{REPEAT_ATTRIBUTE,REPEAT_INDEX_ATTRIBUTE,isRepeatCopy,mainCopyOf,queryAllCopies,queryMainCopy}from"../chunk-LF3FUSCQ.js";
|
|
@@ -2,7 +2,7 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { MarkStyle, WrapResult, InlineRule, MarkupTool } from 'efficient-shell/markup';
|
|
4
4
|
import { TextAlign, TextToolbarCase, TextToolbarMark } from 'efficient-shell/ui';
|
|
5
|
-
import { C as CopyWords } from './words-
|
|
5
|
+
import { C as CopyWords } from './words-Cf5VT2Ic.js';
|
|
6
6
|
|
|
7
7
|
type CellWords = NonNullable<CopyWords['cells']>;
|
|
8
8
|
interface CopyCell {
|
|
@@ -53,7 +53,7 @@ interface CopyThemeColor {
|
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* The colour the toolbar's A shows for `current` (a theme colour's name or a
|
|
56
|
-
* hex): the hex itself, or
|
|
56
|
+
* hex): the hex itself, or theme colour's value. One rule for every bar
|
|
57
57
|
* that opens this window — the panel's text box and the canvas typing bar.
|
|
58
58
|
*/
|
|
59
59
|
declare function colorRunOf(current: string | null, colors: readonly CopyThemeColor[] | undefined): string | undefined;
|
|
@@ -381,6 +381,9 @@ interface CanvasTypingSession {
|
|
|
381
381
|
/** The colour the selection wears (a theme colour's name or a hex, a
|
|
382
382
|
* pending one included), or null: the colour window shows it. */
|
|
383
383
|
color: string | null;
|
|
384
|
+
/** Whether the selected words wear a mark or a colour that Clear
|
|
385
|
+
* formatting would take off (a link stays): the button shows only then. */
|
|
386
|
+
clearable: boolean;
|
|
384
387
|
};
|
|
385
388
|
/** A mark button pressed (B, I, U, S, superscript, subscript): on the
|
|
386
389
|
* selected words, or for the words typed next — `markPress`, as the panel
|
|
@@ -424,6 +427,13 @@ interface CanvasTypingSession {
|
|
|
424
427
|
* window stays open, so the focus is not moved.
|
|
425
428
|
*/
|
|
426
429
|
color: (color: string | null) => void;
|
|
430
|
+
/**
|
|
431
|
+
* Clear formatting (Lewis 2026-10-26): every mark and colour off the
|
|
432
|
+
* selected words, back to the text's own style (`clearStyle`, which keeps a
|
|
433
|
+
* link). One edit step; the words stay selected. At a bare caret, the whole
|
|
434
|
+
* text (`clearRangeOf`, the one rule the panel box and the field bar share).
|
|
435
|
+
*/
|
|
436
|
+
clear: () => void;
|
|
427
437
|
}
|
|
428
438
|
/** Start typing in the words `element()` drew, or `null` where they are not the string's. */
|
|
429
439
|
declare function startCanvasTyping(o: CanvasTypingOptions): CanvasTypingSession | null;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{NO_CONTROL_FIELD as r}from"./chunk-YCSZAP7T.js";import{jsx as n}from"react/jsx-runtime";var t="data-sf-no-control";function o(){/* @__PURE__ */
|
|
2
|
+
return n("span",{[t]:"",hidden:!0})}function e(n,t){return{...n,[r]:t}}export{t as NO_CONTROL_ATTR,o as NoControlMark,e as noControlField};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{noControlField as e}from"./chunk-22I55W37.js";import{DEFAULT_SCREEN_WORDS as r}from"./chunk-IYHO4XQX.js";import{deviceMetaOf as n,DEVICE_FIELD_MARKER as t}from"./chunk-YCSZAP7T.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{usePreviewDevice as i}from"./chunk-BSPCSC45.js";import{jsx as c}from"react/jsx-runtime";function u(e){return"mobile"===e?"mobile":"desktop"}var s={desktop:null,tablet:r.deviceNote.tablet,mobile:r.deviceNote.mobile},d="data-sf-device-hidden";function m(){/* @__PURE__ */
|
|
2
|
+
return c("span",{hidden:!0,[d]:""})}function f({tier:e,render:r,...n}){const t=i();return"each"===e?/* @__PURE__ */c(r,{...n,tier:u(t)}):u(t)===e?/* @__PURE__ */c(r,{...n}):/* @__PURE__ */c(m,{})}function l(e){return n(e)?.inner??e}function p(e,r){const n=r.render;return{...r,[t]:{tier:e,inner:r},render:r=>/* @__PURE__ */c(f,{tier:e,render:n,...r})}}function a(){const e=o("screen",r).deviceNote,n=i(),t="desktop"===n?null:e[n];return t?/* @__PURE__ */c("div",{className:"sf-device-scope",children:t}):/* @__PURE__ */c(m,{})}function h(){return e({type:"custom",render:()=>/* @__PURE__ */c(a,{})},"always")}export{d as DEVICE_HIDDEN_ATTR,s as DEVICE_NOTE,p as deviceField,h as deviceNote,u as shownTier,l as withoutDeviceGate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{zoneKey as e}from"./chunk-
|
|
1
|
+
import{zoneKey as e}from"./chunk-TGZCD6IP.js";import{useRef as t,useEffect as n,useState as r,useSyncExternalStore as o,useCallback as i}from"react";var l=56,c=16;function a(e){const t=Math.max(e,0);return t>=l?0:Math.ceil(16*(1-t/l))}function u(e,t,n){if(e<t-l||e>n+l)return 0;const r=e-t,o=n-e;return r<l&&r<=o?-a(r):o<l?a(o):0}function s(e){const t=e?.ownerDocument?.defaultView;for(let n=e?.parentElement??null;n;n=n.parentElement){const e=t?.getComputedStyle(n).overflowY;if(("auto"===e||"scroll"===e)&&n.scrollHeight>n.clientHeight)return n}return null}function f(e){const t=e?.ownerDocument?.defaultView?.getComputedStyle(e).overflowY;return e&&("auto"===t||"scroll"===t)&&e.scrollHeight>e.clientHeight?e:s(e)}function d(e){const t=e.scrollingElement??e.documentElement;return t&&t.scrollHeight>t.clientHeight?t:null}function g(e,t=e){const n=t.ownerDocument,r=n.defaultView;if(!r)return()=>{};let o=null,i=0;const l=e=>{o=e.clientY},c=()=>{if(null!==o){const n=t.getBoundingClientRect(),r=u(o,n.top,n.bottom);r&&(e.scrollTop+=r)}i=r.requestAnimationFrame(c)};return n.addEventListener("dragover",l,!0),i=r.requestAnimationFrame(c),()=>{n.removeEventListener("dragover",l,!0),r.cancelAnimationFrame(i)}}function p(e){return/move|all|uninitialized/i.test(e)?"move":"copy"}function m(){let e=null,t=null;const n=/* @__PURE__ */new Set,r=()=>{if(t!==e){t=e;for(const e of[...n])e()}};return{get:()=>e,shown:()=>t,start(t){e=t,globalThis.setTimeout(r,0)},end(){null===e&&null===t||(e=null,r())},subscribe:e=>(n.add(e),()=>{n.delete(e)})}}function v(e,t,n,r){if(e.into)return{side:"into",to:e.into};return"first"===e.pinned||"last"!==e.pinned&&t>n+r/2?{side:"after",to:{...e.place,index:e.place.index+1}}:{side:"before",to:{...e.place,index:e.place.index}}}var D=(t,n)=>e(t)===e(n);function w(e,t){return D(e,t)&&(t.index===e.index||t.index===e.index+1)}function y(e,t){return D(e,t)&&e.index<t.index?t.index-1:t.index}function x(e,t){return{...e,index:t<0?e.index-1:e.index+2}}function h(e,t){if(!t)return e;const n={...t,...e};for(const[r,o]of Object.entries(e)){const e=t[r];"function"==typeof o&&"function"==typeof e&&(n[r]=t=>{o(t),e(t)})}return n}function T(l){const c=t(l);n(()=>{c.current=l});const[a]=r(()=>m()),u=l.session??a,d=o(u.subscribe,u.shown,u.shown),[D,y]=r(null),x=t(null),T=i(()=>{x.current?.(),x.current=null},[]),b=i(()=>{T(),u.end(),y(null)},[u,T]);n(()=>u.subscribe(()=>{u.get()||(T(),y(null))}),[u,T]),n(()=>T,[T]);const k=i((e,t)=>{y(n=>n&&n.key===e&&n.side===t?n:{key:e,side:t})},[]),E=i(e=>{y(t=>t&&t.key===e?null:t)},[]),A=(e,t,n,r)=>!("into"===n?r===e.key:void 0!==e.from&&w(e.from,t))&&c.current.canDrop(e.item,t);return{dragging:d?.item??null,row:(e,t)=>{const{keyOf:n,readOnly:r}=c.current,o=n(e.item),i=!r&&!e.pinned&&!1!==e.canDrag,l=t=>{const n=t.currentTarget.getBoundingClientRect();return v(e,t.clientY,n.top,n.height)},a={draggable:i||void 0,onDragStart:i?t=>{const n=t.currentTarget;u.start({key:o,item:e.item,from:e.place}),t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",o)}catch{}n.classList.add("is-lifting");const r=n.getBoundingClientRect();t.dataTransfer.setDragImage?.(n,t.clientX-r.left,t.clientY-r.top),n.ownerDocument.defaultView?.setTimeout(()=>n.classList.remove("is-lifting"),0);const i=s(n);T(),x.current=i?g(i):null}:void 0,onDragEnd:i?()=>b():void 0,onDragOver:e=>{const t=u.get();if(!t)return;const n=l(e);A(t,n.to,n.side,o)?(e.preventDefault(),e.dataTransfer.dropEffect=p(e.dataTransfer.effectAllowed),k(o,n.side)):E(o)},onDrop:e=>{const t=u.get();if(!t)return;const n=l(e);A(t,n.to,n.side,o)&&(e.preventDefault(),b(),c.current.onDrop(t.item,n.to))},onKeyDown:t=>{if("ArrowUp"!==t.key&&"ArrowDown"!==t.key)return;if(!t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;if(t.preventDefault(),t.repeat||!i)return;const{onStep:n,canStep:r}=c.current,o="ArrowUp"===t.key?-1:1;n&&!1!==r?.(e.item,o)&&n(e.item,o)}};return{draggable:i,dragging:d?.key===o,drop:D?.key===o?D.side:void 0,rowProps:h(a,t)}},seam:(t,n)=>{const r=(o=t.place,`seam:${e(o)}:${o.index}`);var o;const i={onDragOver:e=>{const n=u.get();n&&(A(n,t.place,"before",r)?(e.preventDefault(),e.dataTransfer.dropEffect=p(e.dataTransfer.effectAllowed),k(r,"before")):E(r))},onDrop:e=>{const n=u.get();n&&A(n,t.place,"before",r)&&(e.preventDefault(),b(),c.current.onDrop(n.item,t.place))}};return{drop:D?.key===r,seamProps:h(i,n)}},rootProps:e=>h({onDragEnter:e=>{if(!u.get()||x.current)return;const t=f(e.currentTarget);x.current=t?g(t):null},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||y(null)}},e)}}export{l as AUTO_SCROLL_EDGE,c as AUTO_SCROLL_MAX_SPEED,u as autoScrollDelta,a as autoScrollSpeed,m as createDragSession,p as dropEffectFor,v as dropOnRow,d as frameScrollBox,y as gapToMoveIndex,w as isNoOpDrop,f as scrollBoxOf,s as scrollParent,g as startAutoScroll,x as stepGap,T as useTreeDrag};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{noControlMetaOf as t,deviceMetaOf as l}from"./chunk-YCSZAP7T.js";import{TreeSeam as r}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as a}from"./chunk-K56YDHYQ.js";import{easelMenuEntries as o}from"./chunk-FIVU2COQ.js";import{SETTINGS_BUCKETS as i,SettingsGroup as s}from"./chunk-FM6JO4WF.js";import{DEFAULT_PANEL_WORDS as c}from"./chunk-KFV7N2DJ.js";import{FieldNumber as d}from"./chunk-Y2T3JX7K.js";import{FieldSelect as u}from"./chunk-KFWNGPW3.js";import{DEFAULT_FIELDS_WORDS as m}from"./chunk-JACEEVVF.js";import{SettingsField as h,SettingsSegmented as p}from"./chunk-S3DUFDQ6.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{useTreeDrag as b,gapToMoveIndex as g}from"./chunk-6NJHYXJM.js";import{withTip as v}from"./chunk-P2VEMZH5.js";import{Textarea as y,Input as k,ItemCount as x,SortableList as w,ListRow as C,ContextMenu as N,tabPanelId as O,Tabs as j,tabButtonId as S}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as $,useState as D,useLayoutEffect as I,useId as F}from"react";import{jsx as P,jsxs as L}from"react/jsx-runtime";import{ChevronIcon as E,LockIcon as M,MoveUpIcon as T,MoveDownIcon as W,DuplicateIcon as z,TrashIcon as A}from"efficient-shell/icons/efficient";function R({id:e,value:n,onChange:t,placeholder:l,multiline:r=!1,rows:a=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return r?/* @__PURE__ */P(y,{id:e,size:"sm",className:"es-fin",value:c,rows:a,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */P(k,{id:e,size:"md",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function H(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function J(e,n,t){const l=e.slice(),[r]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,r),l}function Y(e,n){return e.filter((e,t)=>t!==n)}function K(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var V='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',B={parentId:"list",slot:"items"};function Q({label:e,icon:n,noun:t,items:l,onChange:i,newItem:s,summary:c,itemName:d,thumb:u,min:h=0,max:p,readOnly:y=!1,open:k,onOpen:O,renderItem:j,renderRow:S,canRemove:F,lockedReason:R,fixed:Q=!1,removeOnRow:X=!0,canDuplicate:Z,above:U,head:q=!0}){const G=f("fields",m).list,_=f("tree",a),ee=t??G.item,ne=!y&&!Q&&("number"!=typeof p||l.length<p),te=l.length<=h,le=e=>!!F&&!F(l[e],e),re=e=>!y&&!Q&&X&&!te&&!le(e),ae=e=>ne&&(!Z||Z(l[e],e)),oe=(e,n)=>d?d(e,n):G.itemName({noun:ee,n:n+1}),ie=$([]),se=$(null),[ce,de]=D(null),ue=$(null),[me,he]=D(null),[pe,fe]=D("");I(()=>{const e=se.current;if(!e)return;se.current=null;const n=ie.current[e.index]?.querySelectorAll(V)[e.nth]??ie.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const be=(e,n)=>{if(n<0||n>=l.length||n===e)return;const t=ie.current[e],r=t?.ownerDocument.activeElement;if(t&&r&&t.contains(r)){const e=[...t.querySelectorAll(V)].indexOf(r),l=r;se.current={index:n,nth:e,start:"number"==typeof l.selectionStart?l.selectionStart:null,end:"number"==typeof l.selectionEnd?l.selectionEnd:null}}i(J(l,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}(k,e,n);a!==k&&O(a),fe(G.moved({n:n+1,total:l.length}))},ge=e=>{ne&&(i(H(l,e,s())),S?(se.current={index:e,nth:0,start:null,end:null},null!==k&&k>=e&&O(k+1)):O(e))},ve=e=>{re(e)&&(i(Y(l,e)),k===e?O(null):null!==k&&k>e&&O(k-1))},ye=b({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===B.parentId&&n.slot===B.slot,onDrop:(e,n)=>{const t=g({...B,index:e},n);t!==e&&be(e,t)},onStep:(e,n)=>be(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<l.length,readOnly:y}),ke=e=>{const n=[];return e>0&&n.push({label:G.moveUp,icon:/* @__PURE__ */P(T,{size:14}),shortcut:"⌥↑",onClick:()=>be(e,e-1)}),e<l.length-1&&n.push({label:G.moveDown,icon:/* @__PURE__ */P(W,{size:14}),shortcut:"⌥↓",onClick:()=>be(e,e+1)}),ae(e)&&n.push({label:G.duplicate,icon:/* @__PURE__ */P(z,{size:14}),onClick:()=>(e=>{ae(e)&&(i(H(l,e+1,K(l[e]))),null!==k&&k>e&&O(k+1))})(e)}),re(e)&&n.push({label:G.delete,icon:/* @__PURE__ */P(A,{size:14}),danger:!0,onClick:()=>ve(e)}),n},xe=(e,n,t,l)=>{y||0===ke(e).length||he({index:e,x:n,y:t,owner:l})},we=e=>n=>{const t=l.slice();t[e]=n,i(t)};/* @__PURE__ */
|
|
2
|
+
return L("div",{className:"es-list",children:[q?/* @__PURE__ */L("div",{className:"es-list-head",children:[
|
|
3
|
+
/* @__PURE__ */L("span",{className:"es-list-label",children:[n?/* @__PURE__ */P("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
|
|
4
|
+
/* @__PURE__ */P(x,{count:l.length,label:G.count({noun:ee,n:l.length}),showZero:!0})]}):null,U?/* @__PURE__ */P("div",{className:"es-list-above",children:U}):null,l.length?/* @__PURE__ */L(w,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ye.rootProps(),children:[l.map((e,n)=>{const t=ye.row({item:n,place:{...B,index:n}}),l=t.draggable&&ce!==n,a=!S&&k===n,o=!y&&!Q&&X&&le(n),i=["es-list-row",S?"is-inline":"is-item",a?"is-open":"",l?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */P(r,{...ye.seam({place:{...B,index:n}}),onAdd:ne?()=>ge(n):void 0,label:G.addHere({noun:ee})},`seam-${n}`):null,
|
|
5
|
+
/* @__PURE__ */P(C,{className:i,flat:!!S,active:a,draggable:t.draggable,dragHint:_.dragHint,dragging:t.dragging,drop:"before"===t.drop||"after"===t.drop?t.drop:void 0,onMove:t.draggable?e=>be(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{ie.current[n]=e},rowProps:{...t.rowProps,draggable:l||void 0,onPointerDown:e=>{const l=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),r=!!l&&l===l.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!r,ue.current=l&&!r?l:null,de(r?n:null)},onDragStart:e=>{const n=ue.current;ue.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{y||(e.preventDefault(),e.stopPropagation(),xe(n,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const t=e.currentTarget.ownerDocument,l=e=>e.preventDefault();t.addEventListener("contextmenu",l,{capture:!0,once:!0}),t.defaultView?.setTimeout(()=>t.removeEventListener("contextmenu",l,{capture:!0}),500);const r=e.currentTarget.getBoundingClientRect();return void xe(n,r.left+24,r.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)}},actions:y||Q||!X?void 0:o?v(R?R(e,n):G.locked,/* @__PURE__ */P("span",{className:"es-list-lock",role:"img","aria-label":R?R(e,n):G.locked,children:/* @__PURE__ */P(M,{size:13})})):v(G.deleteItem({noun:ee}),/* @__PURE__ */P("button",{type:"button",className:"es-list-x","aria-label":G.deleteItem({noun:ee}),disabled:!re(n),onClick:()=>ve(n),children:"×"})),below:a?/* @__PURE__ */P("div",{className:"es-list-item",children:j(e,n,we(n))}):void 0,children:S?/* @__PURE__ */P("div",{className:"es-list-row-main",children:S(e,n,we(n))}):/* @__PURE__ */L("button",{type:"button",className:"es-list-open","aria-expanded":a,onClick:()=>O(a?null:n),children:[u?/* @__PURE__ */P("span",{className:"es-list-thumb","aria-hidden":"true",children:u(e,n)}):null,
|
|
6
|
+
/* @__PURE__ */P("span",{className:"es-list-row-name",children:oe(e,n)}),/* @__PURE__ */P("span",c?{className:"es-list-row-summary",children:c(e,n)}:{className:"es-list-row-summary"}),
|
|
7
|
+
/* @__PURE__ */P(E,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},n)]}),
|
|
8
|
+
/* @__PURE__ */P(r,{...ye.seam({place:{...B,index:l.length}})})]}):null,y||Q?null:/* @__PURE__ */P("button",{type:"button",className:"es-list-add",disabled:!ne,onClick:()=>ge(l.length),children:G.add({noun:ee})}),
|
|
9
|
+
/* @__PURE__ */P("span",{className:"es-list-said","aria-live":"polite",children:pe}),me&&me.index<l.length?
|
|
10
|
+
/* @__PURE__ */P(N,{at:{x:me.x,y:me.y},owner:me.owner,onClose:()=>he(null),items:o(ke(me.index))}):null]})}var X=e=>e<6?e+1:6,Z=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function U({field:e,name:t,id:l,value:r,onChange:a,readOnly:o,context:i,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=D(!0),p=r&&"object"==typeof r?r:{};/* @__PURE__ */
|
|
11
|
+
return P(s,{id:`${l}-group`,title:Z(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */P(G,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>a({...p,[e]:n}),readOnly:o,context:i,showWhenContext:c,renderers:d,headingLevel:X(u)},e))})}function q({field:e,name:t,id:l,value:r,onChange:a,readOnly:o,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=D(null),f=u?d??null:h,b=u??p,g=Array.isArray(r)?r:[],v=e.getItemSummary;/* @__PURE__ */
|
|
12
|
+
return P(Q,{label:Z(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:a,newItem:()=>K({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:o,open:f,onOpen:b,renderItem:(r,a,d)=>Object.entries(n(e.arrayFields,{values:r,context:s})).map(([e,n])=>/* @__PURE__ */P(G,{field:n,name:`${t}[${a}].${e}`,id:`${l}-${a}-${e}`,value:r?.[e],onChange:n=>d({...r,[e]:n}),readOnly:o,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function G(e){const{field:n,name:t,id:l,value:r,onChange:a,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:r,onChange:a,readOnly:o});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:r,onChange:a,readOnly:o};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
+
return P(h,{label:Z(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */P(R,{id:l,value:"string"==typeof r?r:null==r?"":String(r),onChange:a,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:o})});case"number":/* @__PURE__ */
|
|
14
|
+
return P(h,{label:Z(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */P(d,{id:l,value:"number"==typeof r?r:void 0,onChange:a,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:o})});case"select":{const e=`${l}-label`;/* @__PURE__ */
|
|
15
|
+
return P(h,{label:Z(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */P(u,{id:l,value:r,options:n.options,onChange:a,readOnly:o,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
16
|
+
return P(h,{label:Z(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */P(p,{ariaLabel:Z(n,t),value:r,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||o})),onChange:e=>{o||a(e)}})});case"object":/* @__PURE__ */
|
|
17
|
+
return P(U,{...e,field:n});case"array":/* @__PURE__ */
|
|
18
|
+
return P(q,{...e,field:n});case"slot":return null}}function _(e,n){if("mobile"!==n)return!0;const r=e;if(!r||r.marker||"slot"===r.type||"always"===t(e))return!0;const a=l(e)?.tier;return"mobile"===a||"each"===a}var ee={},ne=e=>i.includes(e);function te(n,t){let l,r=i[0];const a=[],o=/* @__PURE__ */new Set;for(const[i,s]of Object.entries(n))s&&(ne(s.bucket)&&((s.marker||s.bucket!==r)&&(l=void 0),r=s.bucket),s.marker&&"string"==typeof s.fold?l={key:i,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||t&&!_(s,t.context?.device)||(a.push(l?{name:i,field:s,bucket:r,fold:l}:{name:i,field:s,bucket:r}),"slot"!==s.type&&o.add(r)));return{rows:a,buckets:i.filter(e=>o.has(e))}}function le(e){return new Map(te(e).rows.map(e=>[e.name,e.bucket]))}function re(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 ae({fields:e,values:n,onChange:t,readOnly:l=!1,context:r,showWhenContext:a,tab:o,onTab:i,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:h,ariaLabel:p,lead:b,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const w=f("panel",c),C=F(),N=h??`es-insp${C.replace(/:/g,"")}`,$=te(e,{values:n,context:a}),[I,E]=D(void 0),M=o??I,T=M&&$.buckets.includes(M)?M:$.buckets[0],[W,z]=D(null),A=W&&W.panel===N&&$.rows.some(e=>e.name===W.name)?W:null,R=d&&$.buckets.length>1,H=R&&T?O(N,T):`${N}-rows`,[J,Y]=D(()=>/* @__PURE__ */new Set),K=y??J,V=(e,n)=>{/* @__PURE__ */return P(s,{title:e.title,open:!K.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&Y(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),k?.(e,n)})(e.key,n),id:`${N}-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},B=e=>R&&e!==T,Q=({name:e,field:o,bucket:i,fold:s})=>/* @__PURE__ */P("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!!B(i)||void 0,children:/* @__PURE__ */P(G,{field:o,name:e,id:`${N}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:r,showWhenContext:a,renderers:m,openItem:A&&A.name===e?A.index:null,onOpenItem:n=>z(null===n?null:{panel:N,name:e,index:n}),headingLevel:s?X(x):x})},e);/* @__PURE__ */
|
|
19
|
+
return L("div",{className:"es-insp",children:[R?/* @__PURE__ */P("div",{className:"es-insp-tabs",children:/* @__PURE__ */P(j,{variant:"underline",block:!0,"aria-label":p??w.settings,idPrefix:N,value:T,onChange:e=>{const n=e;void 0===o&&E(n),i?.(n)},items:$.buckets.map(e=>{const n=w.buckets[e],t=u?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */P("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
20
|
+
/* @__PURE__ */L("div",{className:"es-insp-rows",id:H,role:R?"tabpanel":void 0,"aria-labelledby":R&&T?S(N,T):void 0,children:[b&&_(ee,a?.device)?v?/* @__PURE__ */P("div",{className:"es-insp-band","data-fold":v.key,children:V(v,b)}):b:null,re($.rows).map((e,n)=>{if(!e.fold)return e.rows.map(Q);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
21
|
+
return P("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!B(t)&&!l)||void 0,children:V(e.fold,e.rows.map(Q))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{R as FieldText,ae as Inspector,G as InspectorField,Q as ListField,le as bucketsOf,K as copyItem,_ as fieldShownInView,H as insertAt,Z as labelOf,J as moveTo,te as planFields,Y as removeAt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{routeSharedHostMessage as e}from"./chunk-77IWWW6X.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as s,readEaselFailure as i}from"./chunk-CLOS6SSX.js";import{useAdminBridge as l}from"./chunk-BIK3AO2V.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-YM4UEGBV.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-SNF5764Q.js";import{useEaselHost as k}from"./chunk-MQA7OFRA.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-
|
|
2
|
-
return C(N.Provider,{value:{target:G,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>He.current??he,error:Ie,redirecting:sr,saveStatus:rr,saveState:Ze,autoSaveEnabled:!Ze.paused,autoSaveStoppedByConflict:Ze.stopped,hasUnsavedEdits:Ze.pending||
|
|
1
|
+
import{routeSharedHostMessage as e}from"./chunk-77IWWW6X.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as s,readEaselFailure as i}from"./chunk-CLOS6SSX.js";import{useAdminBridge as l}from"./chunk-BIK3AO2V.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-YM4UEGBV.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-SNF5764Q.js";import{useEaselHost as k}from"./chunk-MQA7OFRA.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-IYHO4XQX.js";import{useAutosave as g}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as b,CLAIM_FAIL_OPEN_MS as S,holderOf as I}from"./chunk-THWO5YVZ.js";import{useWords as P}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as B,useMemo as O,useCallback as E,useEffect as H,useRef as A}from"react";import{jsx as C}from"react/jsx-runtime";var M={content:[],root:{},zones:{}};var N=j(null);function T(){const e=R(N);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function F({target:j,addressing:R=o,onHostMessage:T,children:F}){const V=R,{homeSlug:D,entryMayBounce:L,entryBounce:W,onSwitch:Y,tellsHost:X,adapterFor:K,migrateRenamedProps:U,describeMissing:Z,onLoadFailed:x}=V,[G,Q]=B(j),z=k(),_=d(),q=O(()=>f(_),[_]),J=O(()=>t(_),[_]),$="template"===G.kind,ee="template"===G.kind?G.id:null,re="template"===G.kind?G.pageSlug??D??"":"document"===G.kind?G.slug??"":G.slug,ne="page"===G.kind?G.siteId??null:null,te=_.blocks,oe=O(()=>K(G,q,te),[K,q,te,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),ue=oe.capabilities,ae=E(e=>_.documentHooks?.stored?.(e)??e,[_]);H(()=>{m(_,ne)},[_,ne]);const se=A(G);H(()=>{se.current=G},[G]);const{token:ie,tokenRef:le,capabilities:ce}=l({onMessage:r=>{if(T?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Br(e.target)}}}),de=!_.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(q.lock),[ke,ve]=B(null),[ge,pe]=B(null),[he,ye]=B(null),[we,be]=B(null),Se=P("screen",v),Ie=we?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(we,Se):null,[Pe,je]=B(null),Re=A(null),Be=A(null),[Oe,Ee]=B(!1),He=A(null),[Ae,Ce]=B(null),Me=A(null),[Ne,Te]=B(null),[Fe,Ve]=B(!1),De=A(null);H(()=>{De.current=Ne},[Ne]);const[Le,We]=B(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ye=A(Le);H(()=>{Ye.current=Le},[Le]);const Xe=A(()=>Promise.resolve(!1)),Ke=E(e=>{Be.current=e,Ee(!0)},[]),Ue=g({save:async({id:e,data:r})=>{if(p(Ye.current)){if(!await Xe.current(e,r)){if(!p(Ye.current))return void Ke({id:e,data:r});throw new Error("page save did not land")}}else Ke({id:e,data:r})},onFailure:(e,r)=>{0===r&&z.send("storefront-editor:save-failed")}}),{state:Ze,push:xe,flush:Ge,pause:Qe,resume:ze,stop:_e,reset:qe,retryNow:Je,hasPending:$e}=Ue,er=A(Ze);H(()=>{er.current=Ze},[Ze]);const rr=u(Ze),nr=E(()=>{const e=Be.current;e&&(Be.current=null,Ee(!1),xe(e))},[xe]),tr=A("");tr.current||(tr.current=h());const[or,ur]=B(0),ar=A(!1),[sr,ir]=B(L(j)),lr=A(!1);H(()=>{if(lr.current)return;lr.current=!0;const e=z.address.search(),r=W(j,e);r?z.address.load(r):L(j)&&ir(!1)},[j,z]);const cr=z.send;H(()=>{if(!de)return;let e=!1;const t=se.current,o=oe.resolve(re),u=_.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==D&&re!==D?void z.address.load({kind:"page",slug:D,siteId:ne??void 0}):(be({target:t,slug:re,missing:!0,sentence:Z?.(t)??null}),void x?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Re.current=n,je(n),ve(r.id),pe(r.kind??null),Me.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:M,s=U(a),i=u?await u(s):s;e||ye(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),be({target:t,slug:re,missing:!1,sentence:n(o,{slug:re},_),cause:r(o,_)}),x?.(t,o))}),()=>{e=!0}},[de,ie,$,oe,re]);const dr=E(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=le.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),fr=E(async e=>{const r=le.current;if(!r&&_.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,_)){cr("storefront-editor:auth-expired");const n=r?await dr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[cr,dr,_]),mr=E(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=E(async(e,r,n=!1)=>{if(null!==Re.current)return!1;if(!p(Ye.current))return!1;if(De.current)return!1;const t=await fr(()=>oe.saveLayout(e,r,Me.current,tr.current));if(t.ok)return Me.current=t.value.version??Me.current,Ve(!1),!0;const o=J.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ye.current=e,We(e),!1}const u=J.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await fr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return Me.current=n.value,Xe.current(e,r,!0)}_e(),De.current=u,Te(u)}return Ve(i(t.error,_)?.status===c),!1},[oe,fr,_e,_]);H(()=>{Xe.current=kr},[kr]);const vr=E(e=>{if(null!==Re.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);He.current=r,p(Ye.current)?xe({id:ke,data:r}):Ke({id:ke,data:r})},[ke,cr,Ke,xe,ae]),gr=E(async()=>{p(Ye.current)&&nr();return await Ge()&&null==Be.current},[nr,Ge]),pr=A(gr);H(()=>{pr.current=gr},[gr]);const hr=A(fr);H(()=>{hr.current=fr},[fr]);const yr=E(()=>{z.address.reload()},[z]),wr=A(()=>Promise.resolve(!1));H(()=>{wr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:Me.current,stored:async()=>{const r=await hr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Be.current||$e(),reload:yr}):Promise.resolve(!1)}},[oe,ke,$e,yr]);const br=null!==Pe;H(()=>{if(!fe||!ke||!de||br)return;let e=!1,r=null,n=null;const t=tr.current,o={claim:async e=>{const r=await hr.current(()=>fe.claim(ke,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Ye.current,heldWrite:()=>({pending:null!=Be.current||$e(),autoSaveEnabled:!er.current.paused,saveConflict:null!=De.current}),setAccess:e=>{Ye.current=e,We(e)},releaseHeldWrite:()=>{pr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{wr.current()}},u=J.makeClaimBeat(o),a=ar.current;return ar.current=!1,a||(We({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(b)},S)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),fe.release(ke,t).catch(()=>{})}},[ke,fe,de,ie,or,br]);const Sr=E(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Ir=E(()=>{We(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Pr=E(()=>{er.current.paused?(p(Ye.current)&&nr(),ze()):Qe()},[nr,Qe,ze]),jr=E(()=>{Je()},[Je]),Rr=E(e=>{He.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{qe(),Be.current=null,Ee(!1)},setVersion:e=>{Me.current=e},setSaveConflict:Te,setAccess:We}),Y(e),Q(e),Re.current=null,je(null),ve(null),pe(null),ye(null),be(null),z.address.show(e),"document"!==e.kind&&X(e)&&z.send("storefront-editor:navigated",{target:e})},[qe,z,me,Y,X]),Br=E(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,se.current,D))return;const r=null!=Be.current;if(!r&&!$e())return void Rr(e);const n=er.current;r||n.paused||n.failed||n.stopped?Ce(e):Ge().then(r=>{r?Rr(e):Ce(e)})},[Rr,$e,Ge,D]),Or=E(()=>Ce(null),[]),Er=E(()=>{Ce(e=>(e&&Rr(e),null))},[Rr]),Hr=E(async()=>{const e=Ae;if(!e)return;await gr()&&(Ce(null),Rr(e))},[Ae,gr,Rr]),Ar=E(async e=>{if(null!==Re.current)return;if(!ke)return;if(!p(Ye.current)||De.current)return;const r=ae(e);if(!await kr(ke,r))return void(De.current||cr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void cr("storefront-editor:saved");const t=await fr(()=>n(ke,Me.current??void 0));if(!t.ok){const{error:e}=t;return void cr("storefront-editor:publish-failed",{reason:e instanceof Error&&e.message?e.message:null})}Me.current=t.value.version??Me.current,cr("storefront-editor:published")},[ke,oe,ue.canPublish,cr,kr,fr,ae]);/* @__PURE__ */
|
|
2
|
+
return C(N.Provider,{value:{target:G,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>He.current??he,error:Ie,redirecting:sr,saveStatus:rr,saveState:Ze,autoSaveEnabled:!Ze.paused,autoSaveStoppedByConflict:Ze.stopped,hasUnsavedEdits:Ze.pending||Oe,toggleAutoSave:Pr,retrySave:jr,onChange:vr,flushSave:gr,onPublish:Ar,access:Le,readOnly:null!==I(Le)||null!==Pe||null!==Ne,readOnlyReason:Pe,takeOverEditing:Sr,viewReadOnly:Ir,saveConflict:Ne,saveUnreachable:Fe,reloadFromServer:yr,navigate:Br,pendingNav:Ae,cancelPendingNav:Or,discardAndNavigate:Er,saveAndNavigate:Hr},children:F})}export{N as ScreenDocumentContext,F as ScreenDocumentProvider,T as useScreenDocument};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{changedProps as e}from"./chunk-
|
|
1
|
+
import{changedProps as e}from"./chunk-TGZCD6IP.js";import{useState as t,useRef as r,useEffect as n}from"react";function i({id:i,node:l,block:d,parent:o=null,appState:a=null}){const u=d?.fields??{},[s,c]=t(()=>({id:i,fields:u,loading:!1})),p=r(null),f=r(null),g=r({parent:o,appState:a,id:i});return g.current={parent:o,appState:a,id:i},n(()=>{if(!l||!d)return;const t=f.current!==i;f.current=i;let r=s.fields;t&&(r=u,p.current=null,c({id:i,fields:u,loading:!1}));const n=d.resolveFields;if(!n)return void(t||c(e=>({...e,fields:u})));let o=!1;const a=p.current&&(p.current.props?.id??"root")===(l.props?.id??"root")?p.current:null,m=setTimeout(()=>{o||c(e=>e.id===i?{...e,loading:!0}:e)},50);return Promise.resolve(n(l,{changed:e(l,a),fields:u,lastFields:r,lastData:a,appState:g.current.appState,parent:g.current.parent})).then(e=>{clearTimeout(m),o||g.current.id!==i||(p.current=l,c({id:i,fields:e,loading:!1}))}),()=>{o=!0,clearTimeout(m)}},[i,l,d]),s.id===i?{fields:s.fields,loading:s.loading}:{fields:u,loading:!1}}export{i as useResolvedFields};
|