efficient-easel 20.2.1 → 21.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 +30 -9
- package/dist/{CanvasDragLayer-ARfaivCu.d.ts → CanvasDragLayer-CFUcBbgc.d.ts} +2 -2
- package/dist/{ScreenDocumentContext-CFJeqqKk.d.ts → ScreenDocumentContext-1RgtGKWR.d.ts} +4 -0
- package/dist/blocks/index.d.ts +5 -3
- package/dist/{buckets-Tj-nkBpg.d.ts → buckets-Sw94ll9I.d.ts} +1 -1
- package/dist/canvas/index.d.ts +8 -6
- package/dist/canvas/index.js +1 -1
- package/dist/chunk-2C7W64S5.js +8 -0
- package/dist/chunk-2L6KWUBC.js +1 -0
- package/dist/chunk-467WWV4I.js +1 -0
- package/dist/chunk-4FD7TAOE.js +1 -0
- package/dist/chunk-67HCYOW4.js +1 -0
- package/dist/chunk-A2VVB4RH.js +0 -0
- package/dist/{chunk-2GVCAIPX.js → chunk-BDSLF5BR.js} +1 -1
- package/dist/{chunk-U66YKDAR.js → chunk-BIK3AO2V.js} +1 -1
- package/dist/chunk-BTDI7JAA.js +2 -0
- package/dist/chunk-DDH2DYQP.js +1 -0
- package/dist/{chunk-I7BROL77.js → chunk-DNQ7AF6K.js} +1 -1
- package/dist/{chunk-HK6I3NVO.js → chunk-E52W3M5I.js} +1 -1
- package/dist/chunk-EB6NI2VK.js +1 -0
- package/dist/chunk-FM6JO4WF.js +2 -0
- package/dist/{chunk-JQXD3TDE.js → chunk-GWYNMSIP.js} +1 -1
- package/dist/{chunk-7YVEYQDE.js → chunk-I67UW5UG.js} +3 -3
- package/dist/chunk-JACEEVVF.js +1 -0
- package/dist/{chunk-QAJAEWCZ.js → chunk-KFWNGPW3.js} +5 -5
- package/dist/{chunk-FGYJ5DJY.js → chunk-KWLHKKZO.js} +1 -1
- package/dist/chunk-MLQKNED6.js +1 -0
- package/dist/chunk-MZ5GSSZ3.js +7 -0
- package/dist/{chunk-43AEUUNQ.js → chunk-N3MJOHAG.js} +1 -1
- package/dist/{chunk-BVN33R76.js → chunk-N7E6264U.js} +1 -1
- package/dist/chunk-OHZHYROJ.js +5 -0
- package/dist/chunk-PFFH7ASD.js +21 -0
- package/dist/chunk-PRHBWA5V.js +0 -0
- package/dist/chunk-S3DUFDQ6.js +6 -0
- package/dist/chunk-SNF5764Q.js +1 -0
- package/dist/chunk-SSRYU3YG.js +1 -0
- package/dist/chunk-SWBADIQT.js +1 -0
- package/dist/{chunk-GOTN2KY4.js → chunk-TIAWIOGD.js} +1 -1
- package/dist/chunk-TQ5Y6S2X.js +1 -0
- package/dist/chunk-TUXLORVR.js +15 -0
- package/dist/{chunk-FGNR22NY.js → chunk-U5DNBT63.js} +1 -1
- package/dist/chunk-U7TFWHST.js +5 -0
- package/dist/chunk-WHS6Y55E.js +10 -0
- package/dist/chunk-WJJ7H42G.js +18 -0
- package/dist/{chunk-ZOBSIXRD.js → chunk-Y2T3JX7K.js} +1 -1
- package/dist/chunk-YIUE4US7.js +0 -0
- package/dist/{chunk-O7Q4DDJT.js → chunk-YM4UEGBV.js} +1 -1
- package/dist/chunk-YVFYWAYU.js +65 -0
- package/dist/{chunk-UJ46J7QW.js → chunk-ZOSEBPAI.js} +1 -1
- package/dist/copy/index.d.ts +2 -2
- package/dist/copy/index.js +13 -13
- package/dist/drag/drag.css +3 -9
- package/dist/drag/index.d.ts +3 -3
- package/dist/drag/index.js +1 -1
- package/dist/draw/client.d.ts +1 -1
- package/dist/draw/client.js +1 -1
- package/dist/draw/index.d.ts +9 -9
- package/dist/draw/index.js +1 -1
- package/dist/easel/easel.css +3 -1
- package/dist/easel/index.d.ts +2 -2
- package/dist/easel/index.js +1 -1
- package/dist/fields/fields.css +2 -2
- package/dist/fields/index.d.ts +5 -5
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.d.ts +39 -140
- package/dist/panel/index.js +15 -15
- package/dist/panel/panel.css +53 -347
- package/dist/render/index.d.ts +2 -2
- package/dist/render/index.js +5 -5
- package/dist/{repeat-Czi-6zPX.d.ts → repeat-BNgSq2Nw.d.ts} +1 -1
- package/dist/screen/components/AddBlockRow.d.ts +1 -1
- 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 +15 -15
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/PreviewPartsContext.d.ts +2 -2
- package/dist/screen/components/PreviewPartsContext.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +9 -9
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +2 -2
- 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 +9 -9
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/SlotChildActionsContext.d.ts +1 -1
- package/dist/screen/components/usePartBridge.d.ts +9 -9
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +10 -10
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +1 -1
- package/dist/screen/lib/admin-bridge.js +1 -1
- package/dist/screen/lib/content/view-tiers.d.ts +15 -3
- package/dist/screen/lib/content/view-tiers.js +1 -1
- package/dist/screen/lib/document/add-target-types.d.ts +55 -0
- package/dist/screen/lib/document/add-target-types.js +1 -0
- package/dist/screen/lib/document/block-choice.d.ts +64 -0
- package/dist/screen/lib/document/block-choice.js +1 -0
- package/dist/screen/lib/document/block-types-in.d.ts +39 -0
- package/dist/screen/lib/document/block-types-in.js +1 -0
- package/dist/screen/lib/document/content-tree.d.ts +222 -0
- package/dist/screen/lib/document/content-tree.js +1 -0
- package/dist/screen/lib/document/device-fields.d.ts +128 -0
- package/dist/screen/lib/document/device-fields.js +1 -0
- package/dist/screen/lib/document/field-buckets.d.ts +36 -0
- package/dist/screen/lib/document/field-buckets.js +1 -0
- package/dist/screen/lib/document/field-markers.d.ts +205 -0
- package/dist/screen/lib/document/field-markers.js +1 -0
- package/dist/screen/lib/document/hidable.d.ts +44 -0
- package/dist/screen/lib/document/hidable.js +1 -0
- package/dist/screen/lib/document/palette-sections.d.ts +103 -0
- package/dist/screen/lib/document/palette-sections.js +1 -0
- package/dist/screen/lib/document/panel-fields.d.ts +47 -0
- package/dist/screen/lib/document/panel-fields.js +1 -0
- package/dist/screen/lib/document/panel-no-control-mark.d.ts +74 -0
- package/dist/screen/lib/document/panel-no-control-mark.js +1 -0
- package/dist/screen/lib/document/part-id.d.ts +23 -0
- package/dist/screen/lib/document/part-id.js +1 -0
- package/dist/screen/lib/document/preview-click.d.ts +49 -0
- package/dist/screen/lib/document/preview-click.js +1 -0
- package/dist/screen/lib/document/preview-dom.d.ts +8 -0
- package/dist/screen/lib/document/preview-dom.js +1 -0
- package/dist/screen/lib/document/preview-events.d.ts +25 -0
- package/dist/screen/lib/document/preview-events.js +1 -0
- package/dist/screen/lib/document/preview-selection-context.d.ts +72 -0
- package/dist/screen/lib/document/preview-selection-context.js +1 -0
- package/dist/screen/lib/document/section-doc.d.ts +24 -0
- package/dist/screen/lib/document/section-doc.js +1 -0
- package/dist/screen/lib/document/slot-child-name.d.ts +225 -0
- package/dist/screen/lib/document/slot-child-name.js +1 -0
- package/dist/screen/lib/document/slot-heal.d.ts +5 -0
- package/dist/screen/lib/document/slot-heal.js +1 -0
- package/dist/screen/lib/document/slot-section-spec.d.ts +96 -0
- package/dist/screen/lib/document/slot-section-spec.js +1 -0
- package/dist/screen/lib/document/style-clipboard.d.ts +144 -0
- package/dist/screen/lib/document/style-clipboard.js +1 -0
- package/dist/screen/lib/document/text-control-kinds.d.ts +71 -0
- package/dist/screen/lib/document/text-control-kinds.js +1 -0
- package/dist/screen/lib/document/tree-reveal.d.ts +62 -0
- package/dist/screen/lib/document/tree-reveal.js +1 -0
- package/dist/screen/lib/document/use-section-ops.d.ts +110 -0
- package/dist/screen/lib/document/use-section-ops.js +1 -0
- package/dist/screen/lib/document-addressing.d.ts +2 -2
- package/dist/screen/lib/document-switch.d.ts +1 -1
- package/dist/screen/lib/host.d.ts +2 -2
- 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 +2 -2
- package/dist/screen/lib/media-picker.d.ts +2 -2
- package/dist/screen/lib/page-lock.d.ts +1 -1
- package/dist/screen/lib/puck/add-target-types.d.ts +3 -55
- package/dist/screen/lib/puck/add-target-types.js +1 -0
- package/dist/screen/lib/puck/block-choice.d.ts +1 -64
- package/dist/screen/lib/puck/block-choice.js +1 -1
- package/dist/screen/lib/puck/block-types-in.d.ts +1 -39
- package/dist/screen/lib/puck/block-types-in.js +1 -1
- package/dist/screen/lib/puck/content-tree.d.ts +1 -222
- package/dist/screen/lib/puck/content-tree.js +1 -1
- package/dist/screen/lib/puck/device-fields.d.ts +3 -127
- package/dist/screen/lib/puck/device-fields.js +1 -1
- package/dist/screen/lib/puck/field-buckets.d.ts +2 -36
- package/dist/screen/lib/puck/field-buckets.js +1 -1
- package/dist/screen/lib/puck/field-markers.d.ts +2 -205
- package/dist/screen/lib/puck/field-markers.js +1 -1
- package/dist/screen/lib/puck/hidable.d.ts +1 -44
- package/dist/screen/lib/puck/hidable.js +1 -1
- package/dist/screen/lib/puck/palette-sections.d.ts +2 -97
- package/dist/screen/lib/puck/palette-sections.js +1 -1
- package/dist/screen/lib/puck/panel-fields.d.ts +1 -47
- package/dist/screen/lib/puck/panel-fields.js +1 -1
- package/dist/screen/lib/puck/panel-no-control-mark.d.ts +2 -74
- package/dist/screen/lib/puck/panel-no-control-mark.js +1 -1
- package/dist/screen/lib/puck/part-id.d.ts +1 -23
- package/dist/screen/lib/puck/part-id.js +1 -1
- package/dist/screen/lib/puck/preview-click.d.ts +1 -49
- package/dist/screen/lib/puck/preview-click.js +1 -1
- package/dist/screen/lib/puck/preview-dom.d.ts +1 -8
- package/dist/screen/lib/puck/preview-dom.js +1 -1
- package/dist/screen/lib/puck/preview-events.d.ts +1 -25
- package/dist/screen/lib/puck/preview-events.js +1 -1
- package/dist/screen/lib/puck/preview-selection-context.d.ts +2 -72
- package/dist/screen/lib/puck/preview-selection-context.js +1 -1
- package/dist/screen/lib/puck/section-doc.d.ts +3 -18
- package/dist/screen/lib/puck/section-doc.js +1 -1
- package/dist/screen/lib/puck/slot-child-name.d.ts +1 -225
- package/dist/screen/lib/puck/slot-child-name.js +1 -1
- package/dist/screen/lib/puck/slot-heal.d.ts +2 -5
- package/dist/screen/lib/puck/slot-heal.js +1 -1
- package/dist/screen/lib/puck/slot-section-spec.d.ts +1 -96
- package/dist/screen/lib/puck/slot-section-spec.js +1 -0
- package/dist/screen/lib/puck/style-clipboard.d.ts +14 -116
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/text-control-kinds.d.ts +1 -71
- package/dist/screen/lib/puck/text-control-kinds.js +1 -1
- package/dist/screen/lib/puck/tree-reveal.d.ts +1 -62
- package/dist/screen/lib/puck/tree-reveal.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.d.ts +4 -105
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +27 -20
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-template-types.d.ts +1 -1
- package/dist/screen/lib/section-templates.d.ts +1 -1
- package/dist/screen/lib/section-templates.js +1 -1
- package/dist/screen/lib/session-context.d.ts +1 -1
- package/dist/screen/lib/session-context.js +1 -1
- package/dist/screen/lib/session.d.ts +3 -3
- package/dist/screen/lib/session.js +1 -1
- package/dist/screen/lib/shared-section-types.d.ts +1 -1
- package/dist/screen/lib/shared-sections.d.ts +1 -1
- package/dist/screen/lib/shared-sections.js +1 -1
- package/dist/screen/screen.css +5 -9
- package/dist/screen/words.d.ts +4 -0
- package/dist/screen/words.js +1 -1
- package/dist/strings/index.d.ts +4 -4
- package/dist/strings/index.js +2 -2
- package/dist/text-styles/index.js +33 -33
- package/dist/tree/index.d.ts +5 -5
- package/dist/tree/index.js +1 -1
- package/dist/{types-CDX6vd6A.d.ts → types-B8NwXKlE.d.ts} +1 -1
- package/dist/{types-Bqq6ya0y.d.ts → types-DBy3L69b.d.ts} +11 -4
- package/dist/{watch-BTYOJpQU.d.ts → watch-D8xZow3y.d.ts} +2 -2
- package/dist/{words-vhnV8sM7.d.ts → words-CFkb8XtN.d.ts} +5 -0
- package/dist/{words-BeX5eGq7.d.ts → words-CmEnDoOe.d.ts} +1 -1
- package/dist/{words-CvwYvkJm.d.ts → words-SD4neL0n.d.ts} +6 -0
- package/package.json +156 -12
- package/dist/chunk-23DYNW6S.js +0 -1
- package/dist/chunk-23VM4PMV.js +0 -7
- package/dist/chunk-276MBG5P.js +0 -2
- package/dist/chunk-6FWAE2RN.js +0 -1
- package/dist/chunk-7LYKFL3Q.js +0 -21
- package/dist/chunk-A6Z4SD3I.js +0 -10
- package/dist/chunk-BHRC3ASL.js +0 -1
- package/dist/chunk-EFHV56BO.js +0 -15
- package/dist/chunk-I54UCYOU.js +0 -1
- package/dist/chunk-JBOSEHIX.js +0 -1
- package/dist/chunk-KAML3KQH.js +0 -1
- package/dist/chunk-L2Y3PF2R.js +0 -4
- package/dist/chunk-LQV5FZTQ.js +0 -18
- package/dist/chunk-MEHLY5Q4.js +0 -1
- package/dist/chunk-PAOZMXEI.js +0 -5
- package/dist/chunk-QIDRJH3S.js +0 -1
- package/dist/chunk-R5KEFI55.js +0 -8
- package/dist/chunk-RC25EGHD.js +0 -5
- package/dist/chunk-RSCMJIWS.js +0 -1
- package/dist/chunk-TNGOL65V.js +0 -1
- package/dist/chunk-VANKQVOW.js +0 -8
- package/dist/chunk-WEIE2FBC.js +0 -1
- package/dist/chunk-WRFD4EXD.js +0 -1
- package/dist/chunk-XJ2WXGFJ.js +0 -65
- /package/dist/{chunk-MQNBD6AB.js → chunk-3QB2ZQXK.js} +0 -0
- /package/dist/{chunk-LER7RKTO.js → chunk-5XL2RXFU.js} +0 -0
- /package/dist/{chunk-6W7WLPZH.js → chunk-6UAEFOJ4.js} +0 -0
- /package/dist/{chunk-26OOWIJJ.js → chunk-7OCEPOEJ.js} +0 -0
- /package/dist/{chunk-IQ5TA7AM.js → chunk-AJ2SUSET.js} +0 -0
- /package/dist/{chunk-DUVRZ456.js → chunk-ANPOR6EY.js} +0 -0
- /package/dist/{chunk-5ZBY24K7.js → chunk-CPL43ZLJ.js} +0 -0
- /package/dist/{chunk-PIND6KE7.js → chunk-I6SK6ZDT.js} +0 -0
- /package/dist/{chunk-7F52SZOI.js → chunk-INRERJU4.js} +0 -0
- /package/dist/{chunk-R5L2E7JX.js → chunk-MGVI67QV.js} +0 -0
- /package/dist/{chunk-IYT6NN2J.js → chunk-R4AUZVA3.js} +0 -0
- /package/dist/{chunk-M2Z775ZC.js → chunk-RUQOIQWI.js} +0 -0
- /package/dist/{chunk-PLVEGYK6.js → chunk-TCAAOYQY.js} +0 -0
- /package/dist/{chunk-PA3PNTVV.js → chunk-VKPOH6MK.js} +0 -0
package/README.md
CHANGED
|
@@ -608,11 +608,23 @@ and builds props in hooks, so it only runs as a client component.) Whether the
|
|
|
608
608
|
blocks themselves can run on the server is up to the blocks.
|
|
609
609
|
|
|
610
610
|
The block authoring shape is Puck's, so an app passes the config it has: a
|
|
611
|
-
block's `render` gets its props, `
|
|
611
|
+
block's `render` gets its props, `editor` (and `puck`, its deprecated twin: the same
|
|
612
|
+
value), 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 `
|
|
615
|
-
each level. A type the config does not know draws nothing.
|
|
615
|
+
plain `<div>`, and `editor` carries exactly what Puck's client `<Render>` gave
|
|
616
|
+
`puck` at each level. A type the config does not know draws nothing.
|
|
617
|
+
|
|
618
|
+
**Retiring the name "Puck" (21.1.0).** The new names ship beside the old ones;
|
|
619
|
+
easel 22 removes the old. Deprecated, with what replaces each:
|
|
620
|
+
|
|
621
|
+
| Deprecated | Use |
|
|
622
|
+
|---|---|
|
|
623
|
+
| block prop `puck` (types: `WithBlockProps`) | `editor` — the same value |
|
|
624
|
+
| `efficient-easel/screen/lib/puck/*` (24 subpaths) | `efficient-easel/screen/lib/document/*` — the old ones re-export the new |
|
|
625
|
+
| `data-puck-component`, `data-puck-dropzone`, `data-puck-entry`, `data-puck-dnd`, `data-puck-preview` | `data-easel-block`, `data-easel-dropzone`, `data-easel-entry`, `data-easel-dnd`, `data-easel-preview` — both are drawn; easel's own reads and `BLOCK_ATTRIBUTE`, `BLOCK_SELECTOR`, `LIST_SELECTOR` use the new (`LEGACY_BLOCK_ATTRIBUTE` names the old) |
|
|
626
|
+
| inspector mode `{ kind: "puck" }` | `SELECTION_MODE`, now `{ kind: "selection" }`; `isSelectionMode(mode)` accepts both spellings |
|
|
627
|
+
| the root's `id: "puck-root"` | `page-root`, in easel 22 (the recorded fixtures hold the old id until then) |
|
|
616
628
|
|
|
617
629
|
**A slot says how many blocks it holds** (Unreleased). Each slot component
|
|
618
630
|
has a read-only `blockCount`: the blocks it draws. A block of a type the
|
|
@@ -1008,7 +1020,10 @@ const easel = createEasel<EaselConfig>({ config, data, onChange: (doc) => autosa
|
|
|
1008
1020
|
which bands are closed. A folded band's rows stay mounted.
|
|
1009
1021
|
- **A band's title is a heading since 7.2.0** (WAI-ARIA accordion pattern):
|
|
1010
1022
|
`SettingsGroup` draws `<h3 class="es-group-title"><button aria-expanded
|
|
1011
|
-
aria-controls>…</button></h3
|
|
1023
|
+
aria-controls>…</button></h3>` — since the B2 plan C move (2026-10-26) through
|
|
1024
|
+
the shell's `Accordion`, which draws the band's look; the panel parts
|
|
1025
|
+
(`SettingsField`, `SettingsDefaultReset`, `SettingsGroup`, `SettingsGroupHead`,
|
|
1026
|
+
`SettingsGroupSub`) all call the shell's parts, same names and props. `headingLevel` (default 3) sets the bands'
|
|
1012
1027
|
level; a group inside a band draws one under it. `SettingsGroup` takes
|
|
1013
1028
|
`level` too. A band's DOM id is built from a safe form of its key (any
|
|
1014
1029
|
character but letters, digits, `-` and `_` becomes `-u<hex>-`, so `" text"`
|
|
@@ -1071,11 +1086,17 @@ runs the same rules (`--axe <axe.min.js>`).
|
|
|
1071
1086
|
(`InspectorField`) the list is `aria-labelledby` the row's own label. A
|
|
1072
1087
|
`FieldSelect` on its own is named by `ariaLabelledBy` or `ariaLabel`, and
|
|
1073
1088
|
with neither the list takes its button's name, so it is never nameless.
|
|
1074
|
-
- **Small grey words can be read.**
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1089
|
+
- **Small grey words can be read.** A menu row's shortcut, a read-only or
|
|
1090
|
+
disabled field's value and an empty slot's note are at least 4.5:1 on their
|
|
1091
|
+
ground (WCAG AA), held by ratio in `tests/contrast-small-text.test.ts`. A
|
|
1092
|
+
host that overrode `--es-menu-shortcut-fg` can drop the override.
|
|
1093
|
+
- **Every count is the shell's `ItemCount`** (Lewis, 2026-10-23): the Add
|
|
1094
|
+
panel's group heads ("3 sections", "2 blocks"), a list field's head (in the
|
|
1095
|
+
field's `noun`: "3 slides") and the "Add block" menu's run headings. A muted
|
|
1096
|
+
box at the end of the row; its words are in the Tooltip and for the screen
|
|
1097
|
+
reader (`drag.add.count`, `fields.list.count`, `screen.blockCount`). The
|
|
1098
|
+
classes `.es-add-group-count`, `.es-list-count` and `.sf-menugroup-count`
|
|
1099
|
+
are gone; a host that styled them can drop the rule.
|
|
1079
1100
|
- **The rail says which words it draws.** The width decides in CSS between
|
|
1080
1101
|
every word, the open panel's word, and glyphs only, so a longer language
|
|
1081
1102
|
folds sooner (German "Zurück", "Ebenen"). `<TopBarRail onWords={…}>` is told
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { C as CanvasTarget$1 } from './watch-
|
|
2
|
+
import { C as CanvasTarget$1 } from './watch-D8xZow3y.js';
|
|
3
3
|
import { S as SlotAddress, P as Place } from './types-41704JE4.js';
|
|
4
4
|
import { D as DragSession } from './session-DSQFmIvx.js';
|
|
5
|
-
import { D as DragWords } from './words-
|
|
5
|
+
import { D as DragWords } from './words-SD4neL0n.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Where a drop on the CANVAS lands — pure functions over measured boxes
|
|
@@ -173,6 +173,10 @@ interface HostPickedMedia {
|
|
|
173
173
|
/** What `id` names. A host that sends none answers as before: a
|
|
174
174
|
* field that keeps ids treats the pick as `url`. */
|
|
175
175
|
source?: PickedMediaSource;
|
|
176
|
+
/** A VIDEO's own still, cut once by the host's backend when the video was
|
|
177
|
+
* stored: what a page shows until the video plays. Absent for an image, a
|
|
178
|
+
* video with no still, and a host that sends none. */
|
|
179
|
+
posterUrl?: string;
|
|
176
180
|
}
|
|
177
181
|
/** The SECTION editor's target (the standalone one-section surface). */
|
|
178
182
|
type SectionScreenTarget = {
|
package/dist/blocks/index.d.ts
CHANGED
|
@@ -240,7 +240,7 @@ type DropZoneProps = {
|
|
|
240
240
|
type SlotComponent = ((props?: Omit<DropZoneProps, 'zone'>) => ReactNode) & {
|
|
241
241
|
readonly blockCount?: number;
|
|
242
242
|
};
|
|
243
|
-
/** The `
|
|
243
|
+
/** The `editor` prop every block's `render` receives; `puck` is the same value under its old name. */
|
|
244
244
|
type BlockContext = {
|
|
245
245
|
renderDropZone: FC<DropZoneProps>;
|
|
246
246
|
metadata: Metadata;
|
|
@@ -248,14 +248,16 @@ type BlockContext = {
|
|
|
248
248
|
dragRef: ((element: Element | null) => void) | null;
|
|
249
249
|
};
|
|
250
250
|
type WithBlockProps<Props> = Props & {
|
|
251
|
+
editor: BlockContext;
|
|
252
|
+
/** @deprecated The same value as `editor`; removed in easel 22. */
|
|
251
253
|
puck: BlockContext;
|
|
252
254
|
editMode?: boolean;
|
|
253
255
|
};
|
|
254
256
|
type WithChildren<Props> = Props & {
|
|
255
257
|
children: ReactNode;
|
|
256
258
|
};
|
|
257
|
-
type AsFieldProps<Props> = Omit<Props, 'children' | 'puck' | 'editMode'>;
|
|
258
|
-
/** A block's `render`: its own props with slots as `SlotComponent`s, its id, and `puck`. */
|
|
259
|
+
type AsFieldProps<Props> = Omit<Props, 'children' | 'editor' | 'puck' | 'editMode'>;
|
|
260
|
+
/** A block's `render`: its own props with slots as `SlotComponent`s, its id, `editor` and the deprecated `puck`. */
|
|
259
261
|
type BlockComponent<Props> = (props: WithId<WithBlockProps<{
|
|
260
262
|
[K in keyof Props]: WithDeepSlots<Props[K], SlotComponent>;
|
|
261
263
|
}>>) => JSX.Element;
|
|
@@ -19,7 +19,7 @@ type SettingsBucket = (typeof SETTINGS_BUCKETS)[number];
|
|
|
19
19
|
*
|
|
20
20
|
* A key, not a word: what each group is CALLED is `PanelWords.designGroups`.
|
|
21
21
|
* The host emits a heading for each group it has (`DESIGN_GROUP_KEY` in
|
|
22
|
-
* `screen/lib/
|
|
22
|
+
* `screen/lib/document/field-buckets`); Content's is a marker that draws nothing.
|
|
23
23
|
* One list for both editors, like `SETTINGS_BUCKETS`.
|
|
24
24
|
*/
|
|
25
25
|
declare const DESIGN_GROUPS: readonly ["Content", "Size", "Design", "Layout", "Position", "Anchor"];
|
package/dist/canvas/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
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-
|
|
2
|
+
import { C as CanvasTarget, W as WatchOptions } from '../watch-D8xZow3y.js';
|
|
3
|
+
export { B as BLOCK_SELECTOR, a as CANVAS_SELECTOR, L as LIST_SELECTOR, i as isFrameReady, w as watchCanvasFrame } from '../watch-D8xZow3y.js';
|
|
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-BNgSq2Nw.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The small facts every canvas surface needs, written once — pure DOM, no
|
|
@@ -25,8 +25,10 @@ export { R as REPEAT_ATTRIBUTE, a as REPEAT_INDEX_ATTRIBUTE, i as isRepeatCopy,
|
|
|
25
25
|
* is not an instance of the host's `HTMLElement`.
|
|
26
26
|
*/
|
|
27
27
|
declare function isTypingTarget(target: EventTarget | null): boolean;
|
|
28
|
-
/** The attribute on every block the canvas draws
|
|
29
|
-
declare const BLOCK_ATTRIBUTE = "data-
|
|
28
|
+
/** The attribute on every block the canvas draws. */
|
|
29
|
+
declare const BLOCK_ATTRIBUTE = "data-easel-block";
|
|
30
|
+
/** @deprecated Puck 0.20's name for {@link BLOCK_ATTRIBUTE}, still drawn beside it; removed in easel 22. */
|
|
31
|
+
declare const LEGACY_BLOCK_ATTRIBUTE = "data-puck-component";
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
34
|
* The id of the block a pointer event landed on: the NEAREST ancestor (or the
|
|
@@ -234,4 +236,4 @@ declare function useCanvasLayout(canvas: CanvasTarget | null, { settle }?: {
|
|
|
234
236
|
settle?: readonly number[];
|
|
235
237
|
}): number;
|
|
236
238
|
|
|
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 };
|
|
239
|
+
export { BLOCK_ATTRIBUTE, type Box, CANVAS_TYPABLE_EVENT, CANVAS_TYPING_EVENT, type CanvasFit, CanvasTarget, type CanvasTypableEvent, type CanvasTypingEvent, LEGACY_BLOCK_ATTRIBUTE, WatchOptions, clientPointToLayer, drawnBox, elementScale, fitCanvas, framePointToHost, frameRectToHost, frameRectToLayer, frameScale, isTypingTarget, nodeIdAt, 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,LEGACY_BLOCK_ATTRIBUTE,LIST_SELECTOR,clientPointToLayer,drawnBox,elementScale,fitCanvas,framePointToHost,frameRectToHost,frameRectToLayer,frameScale,isFrameReady,isTypingTarget,nodeIdAt,removeCanvasStyle,setCanvasNonce,upsertCanvasStyle,useCanvasEvent,useCanvasFrame,useCanvasLayout,useCanvasStyle,useCanvasTyping,watchCanvasFrame}from"../chunk-4FD7TAOE.js";export{REPEAT_ATTRIBUTE,REPEAT_INDEX_ATTRIBUTE,isRepeatCopy,mainCopyOf,queryAllCopies,queryMainCopy}from"../chunk-LF3FUSCQ.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-VKPOH6MK.js";import{blockTypesIn as o}from"./chunk-CPL43ZLJ.js";import{sectionTemplatesOf as l}from"./chunk-N7E6264U.js";import{sharedSectionsOf as r}from"./chunk-N3MJOHAG.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-SINAM2IT.js";import{blockRuns as c}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-OHZHYROJ.js";import{useEaselSession as m}from"./chunk-YM4UEGBV.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-EB6NI2VK.js";import{useEasel as u}from"./chunk-TUXLORVR.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-WJJ7H42G.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-TQ5Y6S2X.js";import{useState as b,useEffect as v,useMemo as j,useRef as O}from"react";import{SharedIcon as w,AddIcon as C}from"efficient-shell/icons/efficient";import{ContextMenu as I,toast as E,Dialog as H,Button as M}from"efficient-shell/ui";import{jsx as T,jsxs as $,Fragment as x}from"react/jsx-runtime";function L({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=O(null);/* @__PURE__ */
|
|
2
|
+
return T(H,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */$(x,{children:[
|
|
3
|
+
/* @__PURE__ */T(M,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
|
|
4
|
+
/* @__PURE__ */T(M,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var F=e=>`section:${e}`,N=e=>`block:${e}`,R=e=>`template:${e}`,S=e=>`shared:${e}`;function A({at:O,placeBlocks:H,canTake:M,onPick:A,itemFor:B,session:J,siteWide:U,onClose:V,onHide:W,readOnly:z}){const G=u(e=>e.config),P=a(),{labelAtLevel:Q,categoryLabel:Y,firstSection:D,Icon:K,Thumbnail:X}=P,{blockIsOffered:Z,canAddTo:_}=d(),q=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>Z(e,te);return l(te).list().then(n=>{if(e)return;const l=G.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[G,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=>Z(e,te);return r(te).list().then(n=>{if(e)return;const l=G.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[G,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(G,P),[G]),ye=e=>Q(e,"section",G.components[e]?.label??e),he=e=>({type:F(e.type),label:e.name,cover:/* @__PURE__ */T(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__ */T("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */T(K,{type:e,size:26})}),be=j(()=>{const e=t(ue,D),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!Z(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=_(t.type)?.choices??[];e.forEach(l),e.forEach(e=>_(e.type,1)?.choices?.forEach(l))}H?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:N(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:S(e.id),label:e.title,cover:/* @__PURE__ */T(X,{type:e.node.type}),mark:/* @__PURE__ */T(w,{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:R(e.id),label:e.name,cover:/* @__PURE__ */T(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(G.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(G,t,Y),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)})}),!M)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?M(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,G,q,M,H,te]);/* @__PURE__ */
|
|
5
|
+
return $(x,{children:[
|
|
6
|
+
/* @__PURE__ */T(i,{icon:/* @__PURE__ */T(C,{size:15}),title:q.title,context:q.contextAll,actions:/* @__PURE__ */T(s,{label:q.done,description:q.doneDescription,onClick:V}),onHide:W}),
|
|
7
|
+
/* @__PURE__ */$("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
+
/* @__PURE__ */T(k,{groups:be,session:J,itemFor:e=>B(ke(e)??{kind:"section",type:e}),onInsert:A?e=>{const t=ke(e);t&&A(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!z&&(pe({section:n.section,...t}),!0)},at:O,hint:q.hint,searchLabel:q.search,readOnly:z,words:ee}),U??null]}),de?/* @__PURE__ */T(I,{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__ */T(L,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void E.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{A as AddSidePanel,N as blockKey,F as sectionKey,S as sharedKey,R as templateKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEaselSession as e}from"./chunk-YM4UEGBV.js";import{useHostEscape as n}from"./chunk-MQA7OFRA.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-EB6NI2VK.js";import{styleMenuItems as o}from"./chunk-V7U33NF2.js";import{ROOT_ZONE as l}from"./chunk-TCAAOYQY.js";import{easelMenuEntries as r,menuLabel as i}from"./chunk-FIVU2COQ.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-P5VYGWYO.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-4FD7TAOE.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-K7BTCBWD.js";import{useState as y,useCallback as k,useRef as b,useEffect as g}from"react";import{ContextMenu as v}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as O,LayersIcon as z,CopyIcon as A}from"efficient-shell/icons/efficient";import{jsx as P}from"react/jsx-runtime";function D(e,n){const t=[],o=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===l)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var K=c(),j=/* @__PURE__ */new WeakMap;function M(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=j.get(n);return t||(t=c(),j.set(n,t)),t}function T(){return M(e())}function Y(e,n,t){if(n===l){const{floor:n,cap:o}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function B(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function E(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?Y(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=Y(e,l.zone,l.index+1);if(o(n,t))return t}return null}function I(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(u(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function S(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=B(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:E(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function V(e,n){const{zone:t,index:r}=n,i=e.nodeAt(t,r);if(!i)return[];const c=i.props.id,a=e.labelOf(i.type,t),u=Boolean(i.props._hidden),d=e.nodeOps,p=e.isPinned(i,t),f=e.isLocked(i),m=!p&&!f&&!e.duplicateBlocked(i),h=e.permits?.(i)??{duplicate:!0,delete:!0},y=B(e,i,t),k=D(e,n),b=d.held,g=b&&!p?E(e,b,n):null,v=!e.readOnly,w=e.style?o({held:v?e.style.held():null,canCopy:e.style.canCopy(i,t),onCopy:()=>e.style?.copy(i,t),onPaste:()=>e.style?.paste(t,r,i),words:e.words?.styleClipboard}):[];return s({title:a,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},r=n.zone===l?null:e.slotRung?.(n.zone)??null;return r?[o,{label:r.label,checked:!1,onClick:r.select}]:[o]})},actions:{duplicate:v&&m&&h.duplicate?()=>d.duplicate(c):void 0,...R(v&&!p,e=>d.canStep(c,e),e=>d.step(c,e)),copy:y.copy?()=>d.copy(c,a):void 0,cut:v&&y.cut?()=>d.cut(c,a):void 0,paste:v&&b&&g?{label:b.label,run:()=>d.paste(g)}:void 0,rename:v&&e.renamePropOf(i,t)?()=>e.beginRename(t,r):void 0,hide:!v||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:v&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:e.menuRows?.(i,t,r)??void 0,pinnedLine:p?X(e).pinned:void 0})}function R(e,n,t){return e?{moveUp:n(-1)?()=>t(-1):null,moveDown:n(1)?()=>t(1):null}:{}}var X=e=>e.words?.screen??t.menu;function F(e){const n=X(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */P(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */P(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=Y(e,l,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===l)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */P(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??t.pageSettings,icon:/* @__PURE__ */P(O,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */P(z,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function L(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??a,c=X(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */P(A,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */P(A,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */P(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function N(e){return e.shiftKey}function U(e,t){const[o,l]=y(null),r=k(()=>l(null),[]);n(null!==o,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=I(e);if(!o)return;const l=t.selected();if(!l)return;const r=S(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;g(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(t,"keydown",c);const a=k(n=>{if(N(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(t,"contextmenu",n=>{if(N(n)||!t)return;const o=n.target?.closest?.("[data-easel-block]")??null,r=o?.getAttribute("data-easel-block"),i=r?e.locate(r):null;n.preventDefault();const c=p(t.frame,n.clientX,n.clientY),s=t.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(t,"mousedown",r),d(t,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:o?/* @__PURE__ */P(W,{host:e,target:o,onClose:r}):null,closeMenu:r}}function W({host:e,target:n,onClose:t}){const o="node"===n.kind?V(e,n):"input"===n.kind?L(e,n.el):F(e);return 0===o.length?null:/* @__PURE__ */P(v,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),items:r(o)})}export{K as EASEL_NODE_CLIPBOARD,D as ancestorChain,M as nodeClipboardOf,B as nodeClipboardRules,V as nodeMenuItems,I as nodeShortcut,F as pageMenuItems,E as pastePlace,S as runNodeShortcut,L as textMenuItems,T as useNodeClipboard,U as useNodeContextMenu};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createPreviewSelectionContext as e}from"./chunk-TIAWIOGD.js";var{Provider:r,useSelection:o}=e("selectedPartId");export{r as PreviewPartsProvider,o as usePreviewParts};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as t,useEffect as e,useRef as n}from"react";var o=/* @__PURE__ */new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function r(t){const e=t;if(!e||"string"!=typeof e.tagName)return!1;const n=e.tagName.toUpperCase();if("TEXTAREA"===n||"SELECT"===n)return!0;if("INPUT"===n)return!o.has(String(e.type??"text").toLowerCase());if(e.isContentEditable)return!0;const r=e.closest?.("[contenteditable]");return!(!r||"false"===r.getAttribute("contenteditable"))||null!=e.closest?.('[role="textbox"]')}var i="data-easel-block",c="data-puck-component";function u(t,e=i){const n=t;return n&&"function"==typeof n.closest?n.closest(`[${e}]`)?.getAttribute(e)??null:null}function l(t){const e=t.getBoundingClientRect();if(e.width>0&&e.height>0)return{left:e.left,top:e.top,width:e.width,height:e.height};let n=1/0,o=1/0,r=-1/0,i=-1/0;for(const e of Array.from(t.children)){const t=e.getBoundingClientRect();t.width<=0||t.height<=0||(n=Math.min(n,t.left),o=Math.min(o,t.top),r=Math.max(r,t.right??t.left+t.width),i=Math.max(i,t.bottom??t.top+t.height))}return n===1/0?{left:e.left,top:e.top,width:e.width,height:e.height}:{left:n,top:o,width:r-n,height:i-o}}function s(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function a(t,e,n){const o=t.getBoundingClientRect(),r=n?.getBoundingClientRect()??{left:0,top:0},i=s(t);return{left:o.left-r.left+e.left*i,top:o.top-r.top+e.top*i,width:e.width*i,height:e.height*i}}function d(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function f(t,e,n){const o=a(t,e,n),r=d(n);return{left:o.left/r,top:o.top/r,width:o.width/r,height:o.height/r}}function h(t,e,n){const o=t.getBoundingClientRect(),r=d(t);return{x:(e-o.left)/r,y:(n-o.top)/r}}function m(t,e,n,o){const{left:r,top:i}=a(t,{left:e,top:n,width:0,height:0},o);return{x:r,y:i}}function w({available:t,width:e,maxScale:n=1}){const o=Math.max(0,t);if(!e||e<=0)return{width:o,scale:1,shownWidth:o};const r=o>0?Math.min(o/e,n):1;return{width:e,scale:r,shownWidth:e*r}}var g="data-es-canvas-style",b=/* @__PURE__ */new WeakMap;function p(t,e){e?b.set(t,e):b.delete(t)}function v(t,e,n){const o=t.head??t.documentElement;let r=E(t,e);if(!r){r=t.createElement("style"),r.setAttribute(g,e);const n=b.get(t);n&&r.setAttribute("nonce",n),o.appendChild(r)}return r.textContent!==n&&(r.textContent=n),r}function y(t,e){E(t,e)?.remove()}function E(t,e){for(const n of Array.from(t.querySelectorAll(`style[${g}]`)))if(n.getAttribute(g)===e)return n;return null}var A="[data-easel-block]",C="[data-easel-dropzone]",L="iframe#preview-frame";function x(t){const e=t.contentDocument;if(!e||!t.contentWindow||"loading"===e.readyState||!e.body)return!1;if(t.hasAttribute("srcdoc"))return"about:srcdoc"===e.URL;const n=t.getAttribute("src");return!n||"about:blank"===n||"about:blank"!==e.URL}function M(t,e,{selector:n=L,readySelector:o}={}){let r=null,i=null,c=!1,u=!1,l=null;const s=()=>{l?.observer.disconnect(),l=null},a=()=>{if(u)return;let t=null;if(r&&x(r)){const e=r.contentDocument;(t=>{if(!o||t.querySelector(o))return s(),!0;if(l?.doc!==t){s();const e=t.defaultView?.MutationObserver;if(e){const n=new e(()=>a());n.observe(t,{childList:!0,subtree:!0}),l={doc:t,observer:n}}}return!1})(e)&&(t={frame:r,document:e,window:r.contentWindow})}else s();(t===i||!!t&&!!i&&t.frame===i.frame&&t.document===i.document)&&c||(c=!0,i=t,e(i))},d=()=>a(),f=()=>{const e=t.querySelector?.(n);e!==r?(r?.removeEventListener("load",d),r=e,r?.addEventListener("load",d),a()):a()},h=t.ownerDocument?.defaultView??t.defaultView,m=h?.MutationObserver,w=m?new m(t=>(t=>null!==r&&!r.isConnected||t.some(t=>[...t.addedNodes,...t.removedNodes].some(t=>"IFRAME"===t.nodeName||!!t.querySelector?.("iframe"))))(t)&&f()):null;return w?.observe(t,{childList:!0,subtree:!0}),f(),()=>{u=!0,w?.disconnect(),s(),r?.removeEventListener("load",d),r=null}}function R(n,{selector:o,readySelector:r}={}){const[i,c]=t(null);return e(()=>{const t=n.current;if(!t)return;const e=M(t,c,{selector:o,readySelector:r});return()=>{e(),c(null)}},[n,o,r]),i}var S="easel:canvas-typing",B="easel:canvas-typable";function k(t,o,r,{on:i="document",capture:c=!1}={}){const u=n(r);u.current=r;const l=t?.document??null,s=t?.window??null;e(()=>{const t="window"===i?s:l;if(!t)return;const e=t=>u.current(t);return t.addEventListener(o,e,c),()=>t.removeEventListener(o,e,c)},[l,s,o,i,c])}function W(e){const[n,o]=t(!1);return k(e,S,t=>o(Boolean(t.detail?.typing))),n}function q(t,n,o){const r=t?.document??null;e(()=>{if(!r)return;if(!o)return void y(r,n);const t=v(r,n,o),e=r.defaultView?.MutationObserver,i=e?new e(()=>{t.isConnected||v(r,n,o)}):null;return i?.observe(r.head??r.documentElement,{childList:!0}),()=>{i?.disconnect(),y(r,n)}},[r,n,o])}function N(n,{settle:o=[150,450]}={}){const[r,i]=t(0),c=n?.frame??null,u=n?.document??null,l=n?.window??null,s=o.join(",");return e(()=>{if(!c||!u||!l)return;const t=c.ownerDocument.defaultView;let e=!1,n=0;const r=()=>{if(e)return;e=!0;const o=()=>{e=!1,i(t=>t+1)};t?.requestAnimationFrame?n=t.requestAnimationFrame(o):o()},s=[],a=(t,e)=>{t.addEventListener(e,r,!0),s.push(()=>t.removeEventListener(e,r,!0))};a(u,"scroll"),a(l,"resize"),t&&(a(t,"scroll"),a(t,"resize"));const d=t?.ResizeObserver;if(d){const t=new d(r);t.observe(c),u.documentElement&&t.observe(u.documentElement),s.push(()=>t.disconnect())}const f=u.defaultView?.MutationObserver,h=u.body??u.documentElement;if(f&&h){const t=new f(r);t.observe(u===c.ownerDocument?c:h,{childList:!0,subtree:!0}),s.push(()=>t.disconnect())}const m=u.fonts;m&&a(m,"loadingdone");const w=o.map(t=>setTimeout(r,t));return r(),()=>{for(const t of s)t();for(const t of w)clearTimeout(t);n&&t?.cancelAnimationFrame&&t.cancelAnimationFrame(n)}},[c,u,l,s]),r}export{i as BLOCK_ATTRIBUTE,A as BLOCK_SELECTOR,L as CANVAS_SELECTOR,B as CANVAS_TYPABLE_EVENT,S as CANVAS_TYPING_EVENT,c as LEGACY_BLOCK_ATTRIBUTE,C as LIST_SELECTOR,h as clientPointToLayer,l as drawnBox,d as elementScale,w as fitCanvas,m as framePointToHost,a as frameRectToHost,f as frameRectToLayer,s as frameScale,x as isFrameReady,r as isTypingTarget,u as nodeIdAt,y as removeCanvasStyle,p as setCanvasNonce,v as upsertCanvasStyle,k as useCanvasEvent,R as useCanvasFrame,N as useCanvasLayout,q as useCanvasStyle,W as useCanvasTyping,M as watchCanvasFrame};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useSectionOps as o}from"./chunk-MLQKNED6.js";import{SELECTION_MODE as e}from"./chunk-OHZHYROJ.js";import{decodePartId as r,encodePartId as t}from"./chunk-R4AUZVA3.js";import{useEasel as n}from"./chunk-TUXLORVR.js";import{usePreviewParts as p}from"./chunk-467WWV4I.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=n(o=>o),f=o(),{setSelectedPartId:k,setSelectHandler:l}=p(),I=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),a?.(n)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{l(I)},[l,I]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{k(h)},[h,k]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&f.select(r)},[i,u,f]),openPartId:h}}export{m as usePartBridge};
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{newNodeId as t}from"./chunk-
|
|
1
|
+
import{newNodeId as t}from"./chunk-TCAAOYQY.js";function o(t){return{root:{props:{}},content:[t],zones:{}}}function r(t){return(t.content??[])[0]??null}function n(t){return Array.isArray(t)&&t.length>0&&t.every(t=>!!t&&"object"==typeof t&&"string"==typeof t.type&&"object"==typeof t.props)}function e(o,r){const p={...o.props,id:t(o.type)};for(const[t,o]of Object.entries(p))n(o)&&(p[t]=o.map(t=>e(t,r)));const s={type:o.type,props:p};if(!r)return s;const c=r(s);return{...c,props:{...c.props,id:p.id}}}export{e as cloneNodeWithFreshIds,r as docToNode,o as nodeToDoc};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{applyEaselChromeTheme as e}from"./chunk-LOMEH6DG.js";import{useEaselSession as t}from"./chunk-
|
|
1
|
+
import{applyEaselChromeTheme as e}from"./chunk-LOMEH6DG.js";import{useEaselSession as t}from"./chunk-YM4UEGBV.js";import{currentEaselSession as n,setSessionBridgedSite as r}from"./chunk-SNF5764Q.js";import{useEaselHost as o}from"./chunk-MQA7OFRA.js";import{useState as s,useRef as a,useEffect as c}from"react";var u={canCreatePlatformTemplate:!1};function i(t,o={}){const s=o.session??n();s.auth.token=t.token,s.auth.brandId=t.brandId??null,r(s,t.siteId),(o.stampChromeTheme??!0)&&e(t.theme)}function m(e){const[n,r]=s(null),m=a(null),[l,f]=s(u),d=a(e?.onAuth),k=a(e?.onMessage);c(()=>{d.current=e?.onAuth,k.current=e?.onMessage});const p=o(),h=t();return c(()=>{const e=p.subscribe(e=>{const t=e;if("storefront-editor:auth"===t.type&&"string"==typeof t.token&&t.token){const e=!!m.current;m.current=t.token,r(t.token),i({...t,token:t.token},{stampChromeTheme:p.ownsDocument,session:h}),f((n=t.can)&&"object"==typeof n?{canCreatePlatformTemplate:!0===n.canCreatePlatformTemplate}:u),d.current?.(e)}else k.current?.(e);var n});if(p.send("storefront-editor:ready"),!h.usesBridgedToken)return e;const t=window.setInterval(()=>{m.current?window.clearInterval(t):p.send("storefront-editor:ready")},500);return()=>{e(),window.clearInterval(t)}},[p,h]),{token:n,tokenRef:m,capabilities:l}}export{u as NO_BRIDGED_CAPABILITIES,i as applyAuthGrant,m as useAdminBridge};
|
|
@@ -0,0 +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-EB6NI2VK.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 B,useState as R,useMemo as E,useCallback as O,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=B(N);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function V({target:j,addressing:B=o,onHostMessage:T,children:V}){const F=B,{homeSlug:D,entryMayBounce:L,entryBounce:W,onSwitch:Y,tellsHost:K,adapterFor:U,migrateRenamedProps:X,describeMissing:Z,onLoadFailed:x}=F,[G,Q]=R(j),z=k(),_=d(),q=E(()=>f(_),[_]),J=E(()=>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=E(()=>U(G,q,te),[U,q,te,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),ue=oe.capabilities,ae=O(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&&Rr(e.target)}}}),de=!_.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(q.lock),[ke,ve]=R(null),[ge,pe]=R(null),[he,ye]=R(null),[we,be]=R(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]=R(null),Be=A(null),Re=A(null),[Ee,Oe]=R(!1),He=A(null),[Ae,Ce]=R(null),Me=A(null),[Ne,Te]=R(null),[Ve,Fe]=R(!1),De=A(null);H(()=>{De.current=Ne},[Ne]);const[Le,We]=R(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ye=A(Le);H(()=>{Ye.current=Le},[Le]);const Ke=A(()=>Promise.resolve(!1)),Ue=O(e=>{Re.current=e,Oe(!0)},[]),Xe=g({save:async({id:e,data:r})=>{if(p(Ye.current)){if(!await Ke.current(e,r)){if(!p(Ye.current))return void Ue({id:e,data:r});throw new Error("page save did not land")}}else Ue({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}=Xe,er=A(Ze);H(()=>{er.current=Ze},[Ze]);const rr=u(Ze),nr=O(()=>{const e=Re.current;e&&(Re.current=null,Oe(!1),xe(e))},[xe]),tr=A("");tr.current||(tr.current=h());const[or,ur]=R(0),ar=A(!1),[sr,ir]=R(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;Be.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=X(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=O(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=O(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=O(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=O(async(e,r,n=!1)=>{if(null!==Be.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,Fe(!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,Ke.current(e,r,!0)}_e(),De.current=u,Te(u)}return Fe(i(t.error,_)?.status===c),!1},[oe,fr,_e,_]);H(()=>{Ke.current=kr},[kr]);const vr=O(e=>{if(null!==Be.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);He.current=r,p(Ye.current)?xe({id:ke,data:r}):Ue({id:ke,data:r})},[ke,cr,Ue,xe,ae]),gr=O(async()=>{p(Ye.current)&&nr();return await Ge()&&null==Re.current},[nr,Ge]),pr=A(gr);H(()=>{pr.current=gr},[gr]);const hr=A(fr);H(()=>{hr.current=fr},[fr]);const yr=O(()=>{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!=Re.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!=Re.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=O(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Ir=O(()=>{We(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Pr=O(()=>{er.current.paused?(p(Ye.current)&&nr(),ze()):Qe()},[nr,Qe,ze]),jr=O(()=>{Je()},[Je]),Br=O(e=>{He.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{qe(),Re.current=null,Oe(!1)},setVersion:e=>{Me.current=e},setSaveConflict:Te,setAccess:We}),Y(e),Q(e),Be.current=null,je(null),ve(null),pe(null),ye(null),be(null),z.address.show(e),"document"!==e.kind&&K(e)&&z.send("storefront-editor:navigated",{target:e})},[qe,z,me,Y,K]),Rr=O(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!=Re.current;if(!r&&!$e())return void Br(e);const n=er.current;r||n.paused||n.failed||n.stopped?Ce(e):Ge().then(r=>{r?Br(e):Ce(e)})},[Br,$e,Ge,D]),Er=O(()=>Ce(null),[]),Or=O(()=>{Ce(e=>(e&&Br(e),null))},[Br]),Hr=O(async()=>{const e=Ae;if(!e)return;await gr()&&(Ce(null),Br(e))},[Ae,gr,Br]),Ar=O(async e=>{if(null!==Be.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||Ee,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:Ve,reloadFromServer:yr,navigate:Rr,pendingNav:Ae,cancelPendingNav:Er,discardAndNavigate:Or,saveAndNavigate:Hr},children:V})}export{N as ScreenDocumentContext,V as ScreenDocumentProvider,T as useScreenDocument};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{HERO_SLIDER_GOTO_EVENT as t}from"./chunk-AJ2SUSET.js";import{queryMainCopy as e}from"./chunk-LF3FUSCQ.js";import{isPreviewClick as n}from"./chunk-MGVI67QV.js";var o=()=>document.querySelector(".sf-editor #preview-frame");function r(t){n()||requestAnimationFrame(()=>{const n=o()?.contentDocument;n&&e(n,`[data-easel-block="${CSS.escape(t)}"]`)?.scrollIntoView({behavior:"smooth",block:"start"})})}function c(e,n){const r=o()?.contentWindow;if(!r)return;const c={id:e,index:n};r.dispatchEvent(new CustomEvent(t,{detail:c}))}function i(){requestAnimationFrame(()=>{o()?.contentWindow?.scrollTo({top:0,behavior:"smooth"})})}function s(t,{passes:e=[150,400],onPinned:n}={}){let r=0,c=!1;const i=[],s=()=>{const r=o(),l=r?.contentWindow,u=r?.contentDocument;if(!l||!u)return!1;const a=t(l,u);if(null==a)return!1;if(l.scrollTo({left:l.scrollX,top:a,behavior:"instant"}),!c){c=!0,n?.();for(const t of e)i.push(setTimeout(s,t))}return!0},l=()=>{!s()&&r++<150&&i.push(setTimeout(l,32))};return l(),()=>i.forEach(clearTimeout)}function l(t){return s((n,o)=>{const r=e(o,`[data-easel-block="${CSS.escape(t)}"]`);return r?n.scrollY+r.getBoundingClientRect().top:null})}function u(t){return s((t,e)=>{if(!e.querySelector("[data-easel-block]"))return null;const n=Math.max(e.documentElement.scrollHeight,e.body?.scrollHeight??0);return n<=e.documentElement.clientHeight?null:n},{passes:[150,400,800,1300,2e3],onPinned:t})}export{c as gotoPreviewSlide,u as pinPreviewToBottom,l as pinPreviewToSection,o as previewFrame,r as scrollPreviewToSection,i as scrollPreviewToTop};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselHost as n}from"./chunk-MQA7OFRA.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-
|
|
1
|
+
import{useEaselHost as n}from"./chunk-MQA7OFRA.js";import{useEaselApi as e,bindUndoKeys as t}from"./chunk-TUXLORVR.js";import{useState as r,useEffect as o,useRef as u}from"react";function c(e){const t=n(),[u,c]=r(null);return o(()=>c(e.current),[e]),t.ownsDocument?"undefined"==typeof document?null:document:u}function i(r,u){const i=n(),s=e(),f=c(r);o(()=>{if(!i.ownsDocument&&f)return t(f,s,{leaveTyping:!0})},[i,s,f]);const m=u?.document??null;o(()=>{if(!i.ownsDocument&&m)return t(m,s,{leaveTyping:!0})},[i,s,m])}function s(n){return n.ownsDocument?{}:{tabIndex:-1}}function f(n){return!n.altKey&&!n.shiftKey&&(!(!n.metaKey&&!n.ctrlKey)&&("s"===n.key||"S"===n.key||"KeyS"===n.code))}function m(n,e,t){const r=c(n),i=u(t);o(()=>{i.current=t}),o(()=>{if(!r)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return r.addEventListener("keydown",n),()=>r.removeEventListener("keydown",n)},[r]);const s=e?.document??null;o(()=>{if(!s)return;const n=n=>{f(n)&&(n.preventDefault(),i.current())};return s.addEventListener("keydown",n),()=>s.removeEventListener("keydown",n)},[s])}export{s as editorRootFocus,f as isSaveShortcut,c as useEaselKeyTarget,m as useEaselSaveKey,i as useEaselUndoKeys};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=["desktop","tablet","mobile"],e={desktop:"Desktop",tablet:"Tablet",mobile:"Mobile"},n=720,o=1100;function a(t){return t>=1100?"desktop":t>=720?"tablet":"mobile"}function r(t){return`${t}Tablet`}function
|
|
1
|
+
var t=["desktop","tablet","mobile"],e={desktop:"Desktop",tablet:"Tablet",mobile:"Mobile"},n=720,o=1100;function a(t){return t>=1100?"desktop":t>=720?"tablet":"mobile"}function r(t){return`${t}Tablet`}function b(t){return`${t}Phone`}function u(t){return null==t}var l=t=>e=>"number"==typeof e?e*t:e,p=t=>t;var h={spacing:{tablet:l(.75),phone:l(2/3),round:function(t){const e=Math.ceil(Math.abs(t)/4-.5);return 4*(t<0?-e:e)+0}},columns:{tablet:t=>"number"==typeof t?Math.min(t,2):t,phone:t=>"number"==typeof t?1:t},stack:{tablet:p,phone:t=>void 0===t?t:"stacked"},textSize:{tablet:l(.85),phone:l(.7/.85),round:Math.round},heightMode:{tablet:p,phone:t=>"px"===t?"fit":t},heightPx:{tablet:l(.75),phone:p,round:Math.round},same:{tablet:p,phone:p}},i=Object.fromEntries(Object.keys(h).map(t=>[t,{tablet:p,phone:p}]));function c(t,e,n,o,a=h){const r=a[t],b=t=>r.round&&"number"==typeof t?r.round(t):t,l=u(n)?r.tablet(e):n,p=u(o)?r.phone(l):o;return{desktop:e,tablet:u(n)?b(l):n,phone:u(o)?b(p):o}}export{h as AUTO_RULES,i as FOLLOW_RULES,o as VIEW_DESKTOP_MIN,n as VIEW_TABLET_MIN,t as VIEW_TIERS,e as VIEW_TIER_LABEL,u as isAuto,b as phoneKey,c as resolveViewValue,r as tabletKey,a as viewTierForWidth};
|
|
@@ -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`,o={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 t={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 o=Math.floor(a/60);if(o<60)return`Saved ${o} minute${1===o?"":"s"} ago`;const t=Math.floor(o/60);return`Saved ${t} hour${1===t?"":"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={blockCount:({count:e})=>`${e} ${1===e?"block":"blocks"}`,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:o,canvasAddBlock:"Add block",canvasReplaceImage:"Replace image",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:t,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:o})=>`Moved “${e}” to position ${a} of ${o}`,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,t as DEFAULT_SCREEN_SAVE_STATUS_WORDS,o as DEFAULT_SCREEN_SHARED_WORDS,n as DEFAULT_SCREEN_WORDS};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Accordion as e}from"efficient-shell/ui";import{jsx as n}from"react/jsx-runtime";function t({title:t,open:o,onToggle:i,count:l,level:r=3,id:s,children:a,className:c}){const d=s??"group";/* @__PURE__ */
|
|
2
|
+
return n(e,{level:r,keepMounted:!0,openIds:o?[d]:[],onOpenChange:e=>i(e.includes(d)),items:[{id:d,headId:s,title:t,count:l,className:c?`es-panel-band ${c}`:"es-panel-band",content:a}]})}var o=Object.freeze(["Design","Animation"]),i=Object.freeze(["Content","Size","Design","Layout","Position","Anchor"]);export{i as DESIGN_GROUPS,o as SETTINGS_BUCKETS,t as SettingsGroup};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-OHZHYROJ.js";import{useEaselHost as e}from"./chunk-MQA7OFRA.js";import{createEasel as r,EaselProvider as o}from"./chunk-TUXLORVR.js";import{useState as n,useEffect as s}from"react";import{jsx as a}from"react/jsx-runtime";function i({config:i,data:c,onChange:m,permissions:p,parts:f,children:u}){const[d]=n(()=>r({config:i,data:c,permissions:p}));s(()=>{d.setConfig(i)},[d,i]),s(()=>{if(!m)return;let t=d.getState().appState.data,e=!1;return d.subscribe(()=>{const r=d.getState().appState.data;r!==t&&(t=r,(e||r!==d.loaded)&&(e=!0,m(r)))})},[d,m]),s(()=>{p&&d.setPermissions(p)},[d,p]);const h=e();/* @__PURE__ */
|
|
2
2
|
return a(o,{easel:d,hotkeys:h.ownsDocument,children:/* @__PURE__ */a(t,{parts:f,children:u})})}export{i as ScreenStoreProvider};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-
|
|
1
|
+
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-YVFYWAYU.js";import{ScreenStoreProvider as e}from"./chunk-GWYNMSIP.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-BTDI7JAA.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-EB6NI2VK.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var k=r(e),N=r(n);function C({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const k=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
|
|
2
2
|
return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
|
|
3
3
|
/* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
|
|
4
4
|
/* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
|
|
5
5
|
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{k()},children:i.save})]}),children:i.body})}function j({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
-
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var y=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function
|
|
7
|
-
/* @__PURE__ */u(k,{config:r,data:i,onChange:h,permissions:
|
|
6
|
+
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var y=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function A({config:r,parts:n,wrap:e=y}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:j}=a(),A=t(()=>s(!g),[g]),Y=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:Y.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
|
|
7
|
+
/* @__PURE__ */u(k,{config:r,data:i,onChange:h,permissions:A,parts:n,children:/* @__PURE__ */u(N,{})}),f&&/* @__PURE__ */u(C,{onCancel:p,onDiscard:v,onSave:j})):/* @__PURE__ */u("div",{className:"sf-msg",children:Y.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:Y.waitingForAuthorization})}export{A as DocumentScreen,j as ScreenMount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={less:"Less",more:"More",choose:"Choose",search:"Search",noMatches:"No matches",list:{item:"item",itemName:({noun:e,n:o})=>{return`${t=e,t?t[0].toUpperCase()+t.slice(1):t} ${o}`;var t},count:({noun:e,n:o})=>`${o} ${1===o?e:(e=>/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:`${e}s`)(e)}`,position:({n:e,total:o})=>`${e} of ${o}`,duplicate:"Duplicate",duplicateItem:({noun:e})=>`Duplicate ${e}`,deleteItem:({noun:e})=>`Delete ${e}`,add:({noun:e})=>`+ Add ${e}`,addHere:({noun:e})=>`Add ${e} here`,moveUp:"Move up",moveDown:"Move down",delete:"Delete",locked:"This one cannot be removed",moved:({n:e,total:o})=>`Moved to ${e} of ${o}`}};export{e as DEFAULT_FIELDS_WORDS};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{DEFAULT_FIELDS_WORDS as e}from"./chunk-
|
|
2
|
-
/* @__PURE__ */s("span",{className:"es-fsel-label",children:b?b(a,{active:l.active??!1,chosen:l.selected}):a.label}),void 0===a.meta||m?null:/* @__PURE__ */s("span",{className:"es-fsel-meta","aria-hidden":"true",children:a.meta})]}):e.label},
|
|
1
|
+
import{DEFAULT_FIELDS_WORDS as e}from"./chunk-JACEEVVF.js";import{useWords as l}from"./chunk-MFIRYGHW.js";import{SearchableSelect as a,Select as n}from"efficient-shell/ui";import{jsx as s,jsxs as i}from"react/jsx-runtime";function r(e,l){return e.find(e=>Object.is(e.value,l))}var o=e=>String(e);function t(r){const{id:t,options:u,placeholder:d,readOnly:c=!1,ariaLabel:v,ariaLabelledBy:h,searchable:m=!1,searchPlaceholder:p,groupCount:f=!1,renderOption:b}=r,g=l("fields",e),O=h?{"aria-labelledby":h}:v?{"aria-label":v}:{},j=u.some(e=>void 0!==e.thumb),x=j||void 0!==b||u.some(e=>void 0!==e.meta),C=e=>""===e?void 0:u[Number(e)],N=(e,l)=>{const a=C(e.value);return a?/* @__PURE__ */i("span",{className:"es-fsel-row",children:[j?/* @__PURE__ */s("span",{className:"es-fsel-thumb","aria-hidden":"true",children:a.thumb?/* @__PURE__ */s("img",{src:a.thumb,alt:"",loading:"lazy"}):null}):null,
|
|
2
|
+
/* @__PURE__ */s("span",{className:"es-fsel-label",children:b?b(a,{active:l.active??!1,chosen:l.selected}):a.label}),void 0===a.meta||m?null:/* @__PURE__ */s("span",{className:"es-fsel-meta","aria-hidden":"true",children:a.meta})]}):e.label},y=[];let V=null;if(u.forEach((e,l)=>{const a={value:o(l),label:e.label,...e.disabled?{disabled:!0}:{},...m&&e.meta?{sublabel:e.meta}:{},...!m&&e.description?{description:e.description}:{}};void 0===e.group?(V=null,y.push(a)):V&&V.label===e.group?V.options.push(a):(V={label:e.group,options:[a]},y.push(V))}),f)for(const e of y)"options"in e&&(e.label=`${e.label} ${e.options.length}`);const T=e=>e.flatMap(e=>{const l=C(e.value);return l?[l]:[]});if(m){const l={id:t,options:y,placeholder:p??d??g.search??e.search,disabled:c,renderOption:x?N:void 0,...O};if(!0===r.multiple){const e=Array.isArray(r.value)?r.value:[],n=r.onChange;/* @__PURE__ */
|
|
3
3
|
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{...l,multiple:!0,value:u.flatMap((l,a)=>e.some(e=>Object.is(e,l.value))?[o(a)]:[]),onChange:e=>n(u.filter((l,a)=>e.includes(o(a))).map(e=>e.value))})})}const n=u.findIndex(e=>Object.is(e.value,r.value)),i=r.onChange;/* @__PURE__ */
|
|
4
|
-
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{...l,value:n>=0?o(n):"",clearable:!1,onChange:e=>{const l=
|
|
5
|
-
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...A,multiple:!0,value:a,renderValue:r.renderValue?e=>r.renderValue(
|
|
6
|
-
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...A,value:M>=0?o(M):"",renderValue:r.renderValue?e=>r.renderValue(
|
|
4
|
+
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{...l,value:n>=0?o(n):"",clearable:!1,onChange:e=>{const l=C(e);l&&!Object.is(l.value,r.value)&&i(l.value)}})})}const A={id:t,size:"md",className:"es-fsel-button",options:y,placeholder:d??g.choose,readOnly:c,renderOption:x?N:void 0,...O};if(!0===r.multiple){const e=Array.isArray(r.value)?r.value:[],l=l=>e.some(e=>Object.is(e,l.value)),a=u.flatMap((e,a)=>l(e)?[o(a)]:[]),i=r.onChange;/* @__PURE__ */
|
|
5
|
+
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...A,multiple:!0,value:a,renderValue:r.renderValue?e=>r.renderValue(T(e)):void 0,valueText:r.valueText?e=>r.valueText(T(e)):void 0,onChange:e=>i(u.filter((l,a)=>e.includes(o(a))).map(e=>e.value))})})}const M=u.findIndex(e=>Object.is(e.value,r.value)),E=r.onChange;/* @__PURE__ */
|
|
6
|
+
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(n,{...A,value:M>=0?o(M):"",renderValue:r.renderValue?e=>r.renderValue(T(e)[0]):void 0,valueText:r.valueText?e=>r.valueText(T(e)[0]):void 0,footer:r.footer?.length?[...r.footer]:void 0,changed:r.changed,onChange:e=>{const l=C(e);l&&!Object.is(l.value,r.value)&&E(l.value)}})})}export{t as FieldSelect,r as optionFor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{noControlField as e}from"./chunk-
|
|
1
|
+
import{noControlField as e}from"./chunk-INRERJU4.js";import{DEFAULT_SCREEN_WORDS as n}from"./chunk-EB6NI2VK.js";import{useWords as r}from"./chunk-MFIRYGHW.js";import{usePreviewDevice as t}from"./chunk-BSPCSC45.js";import{jsx as o}from"react/jsx-runtime";function i(e){return"mobile"===e?"mobile":"desktop"}var c={desktop:null,tablet:n.deviceNote.tablet,mobile:n.deviceNote.mobile},u="data-sf-device-hidden";function d(){/* @__PURE__ */
|
|
2
2
|
return o("span",{hidden:!0,[u]:""})}function s({tier:e,render:n,...r}){return i(t())===e?/* @__PURE__ */o(n,{...r}):/* @__PURE__ */o(d,{})}var m="__device";function f(e){const n=e?.[m];return n??null}function l(e){return f(e)?.inner??e}function a(e,n){const r=n.render;return{...n,[m]:{tier:e,inner:n},render:n=>/* @__PURE__ */o(s,{tier:e,render:r,...n})}}function p(){const e=r("screen",n).deviceNote,i=t(),c="desktop"===i?null:e[i];return c?/* @__PURE__ */o("div",{className:"sf-device-scope",children:c}):/* @__PURE__ */o(d,{})}function v(){return e({type:"custom",render:()=>/* @__PURE__ */o(p,{})},"always")}export{m as DEVICE_FIELD_MARKER,u as DEVICE_HIDDEN_ATTR,c as DEVICE_NOTE,a as deviceField,f as deviceMetaOf,v as deviceNote,i as shownTier,l as withoutDeviceGate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-OHZHYROJ.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-TCAAOYQY.js";import{useEasel as o,useEaselApi as r}from"./chunk-TUXLORVR.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,7 @@
|
|
|
1
|
+
import{STANDARD_MARKUP as t,writeMarkedLines as e,sameMarks as n,markedLines as r,spanFor as l,marksIn as o,toggleMark as i,listIn as a,setList as s,colorOver as c,unlinkAt as u,linkOver as d,colorIn as h,findLink as f,isSafeLinkHref as p}from"efficient-shell/markup";import{Tooltip as m,ColorSwatch as g,ColorPickerPanel as b,Button as k}from"efficient-shell/ui";import{jsxs as v,jsx as y}from"react/jsx-runtime";var x=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),w=/* @__PURE__ */new Set(["p","div","li","ul","ol","dl","dt","dd","h1","h2","h3","h4","h5","h6","blockquote","pre","table","thead","tbody","tfoot","tr","section","article","header","footer","aside","nav","figure","figcaption","address","hr"]);function D(l,o){const i=o.rules??t,a=l.html&&""!==l.html.trim()?function(t,l,o){const i=l.createElement("template");i.innerHTML=t;const a=[[]],s=()=>a[a.length-1],c=()=>{const t=s();for(;t.length>0&&" "===t[t.length-1].ch;)t.pop();t.length>0&&a.push([])},u=(t,e,n,r)=>{if(3===t.nodeType){for(const l of t.textContent??""){const t=/\s/.test(l)?" ":l,o=s();" "===t&&(0===o.length&&a.length>1||" "===o[o.length-1]?.ch)||o.push({ch:t,bold:e,italic:n,href:r})}return}if(1!==t.nodeType&&11!==t.nodeType)return;const l=t,o=1===t.nodeType?l.localName:"";if(x.has(o))return;if("br"===o)return void a.push([]);let i=e,d=n,h=r;if("b"!==o&&"strong"!==o||(i=!0),"i"!==o&&"em"!==o||(d=!0),"a"===o){const t=(l.getAttribute("href")??"").trim();h=p(t)?t:null}const f=1===t.nodeType?l.style:null;if(f){const t=f.fontWeight;"bold"===t||"bolder"===t||Number(t)>=600?i=!0:("normal"===t||"lighter"===t||""!==t&&Number(t)<600)&&(i=!1),"italic"===f.fontStyle||"oblique"===f.fontStyle?d=!0:"normal"===f.fontStyle&&(d=!1)}const m=w.has(o);m&&c();for(const e of[...t.childNodes])u(e,i,d,h);m&&c()};u(i.content,!1,!1,null);for(;a.length>1&&0===a[a.length-1].length;)a.pop();return a.map(t=>function(t,l){const o=e=>t.map((n,r)=>n[e]&&(" "!==n.ch||Boolean(t[r-1]?.[e])&&Boolean(t[r+1]?.[e]))),i=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const a of i){const i=M(t,a.bold?o("bold"):null,a.italic?o("italic"):null,a.links),s=e([i]).text;if(n([i],r(s,l)))return s}return t.map(t=>t.ch).join("")}(t,o))}(l.html,o.doc,i):(l.text??"").replace(/\r\n?/g,"\n").split("\n");return o.multiline?a.join("\n"):1===a.length?a[0]:a.map(t=>t.trim()).filter(t=>""!==t).join(" ")}function M(t,e,n,r){let o=0,i=null,a=null,s=null;return{bullet:!1,chars:t.map((t,c)=>{const u=r?t.href:null;return i=null===u?null:i&&i.href===u?i:l(++o,"link",u),a=e?.[c]?a??l(++o,"bold"):null,s=n?.[c]?s??l(++o,"italic"):null,{ch:t.ch,at:-1,marks:[i,a,s].filter(t=>null!==t)}})}}var N="application/x-efficient-markup",T=/^([0-9]{1,3})\. $/;function C(t,e){const n=t.split("\n"),l=r(t,e);let o=0,i=0;const a=l.map((t,e)=>{const r=!t.bullet&&null==t.number&&"- "===n[e],l=null!=t.number||t.bullet?null:T.exec(n[e]),a=t.bullet||r,s=l?l[1]:t.number??null,c=r||l?[]:t.chars,u=c.map(t=>t.ch).join(""),d=null!=s?s.length+2:a?2:0,h={bullet:a,number:s,chars:c,start:o,src:o+d,vis:i,text:u};return o+=n[e].length+1,i+=u.length+1,h});return{lines:a,text:a.map(t=>t.text).join("\n")}}function A(t,e){const{lines:n}=t;for(let t=0;t<n.length;t+=1){const r=n[t];if(e<=r.vis+r.text.length||t===n.length-1)return[r,Math.max(0,Math.min(e-r.vis,r.text.length)),t]}return[n[0],0,0]}function E(t,e){const[n,r]=A(t,e);if(0===r)return n.src;let l=0;for(const t of n.chars){if(r<=l+t.ch.length)return t.at+(r-l);l+=t.ch.length}return n.src}function S(t,e){const[n,r]=A(t,e);let l=0;for(const t of n.chars){if(r===l)return t.at;l+=t.ch.length}return E(t,e)}function B(t,e){const{lines:n}=t;let r=n[0];for(const t of n)e>=t.start&&(r=t);let l=0;for(const t of r.chars){if(!(e>=t.at+t.ch.length)){e>t.at&&(l+=e-t.at);break}l+=t.ch.length}return r.vis+l}function R(t,e,n){return[B(t,e),B(t,n)]}function L(t,e,n){return e===n?[E(t,e),E(t,e)]:[S(t,e),E(t,n)]}function K(t,e){let n=0;for(let r=0;r<t.chars.length;r+=1){if(n>=e)return r;n+=t.chars[r].ch.length}return t.chars.length}function W(t,o,i,a,s){const c=C(t,o),[u,d,h]=A(c,Math.min(i,a)),[f,p,m]=A(c,Math.max(i,a)),g=K(u,d),b=K(f,p),k=u.chars.slice(0,g),v=f.chars.slice(b),y=i!==a&&u.chars[g]&&(h!==m||g<b)?u.chars[g].marks:function(t,e){const n=t.chars[e-1],r=t.chars[e],l=(t,e)=>{const n=t.findIndex(t=>"link"===t.kind);return-1===n||e?t:t.slice(0,n)};if(n){const t=n.marks.find(t=>"link"===t.kind),e=Boolean(t&&r?.marks.some(e=>e.id===t.id));return l(n.marks,e)}return r?l(r.marks,!1):[]}(u,g);let x=(w=c.lines,Math.max(0,...w.flatMap(t=>t.chars.flatMap(t=>t.marks.map(t=>t.id))))+1);var w;const D=t=>{let e;if(void 0!==s.markup){const t=x;e=r(s.markup,o).map(e=>({bullet:e.bullet,number:e.number??null,chars:e.chars.map(e=>({...e,at:-1,marks:e.marks.map(e=>({...e,id:e.id+t}))}))}))}else{let n=u.number??null;e=(s.text??"").split("\n").map((e,r)=>(r>0&&null!=n&&(n=function(t){return String(Number(t)+1).padStart(t.length,"0")}(n)),{bullet:u.bullet,number:n,chars:[...e].map(e=>({ch:e,at:-1,marks:t??[]}))}))}const n=e.map(t=>t.chars.map(t=>t.ch).join("")).join("\n"),l={bullet:u.bullet,number:u.number??null,chars:[...k,...e[0].chars]},i=e.slice(1);if(i.length>0){const t=i[i.length-1];i[i.length-1]={...t,chars:[...t.chars,...v]}}else l.chars.push(...v);return{lines:[...c.lines.slice(0,h).map(({bullet:t,number:e,chars:n})=>({bullet:t,number:e,chars:n})),l,...i,...c.lines.slice(m+1).map(({bullet:t,number:e,chars:n})=>({bullet:t,number:e,chars:n}))],shown:n}},M=void 0!==s.markup?[null]:[(t=>{let e=t.filter(t=>!s.drop?.some(e=>t.kind===e||"highlight"===e&&"accent"===t.kind));for(const t of s.add??[]){if(e.some(e=>e.kind===t))continue;const n=l(x++,t);n&&(e=[...e,n])}if(void 0!==s.color){e=e.filter(t=>"color"!==t.kind);const t=null===s.color?null:l(x++,"color",s.color);t&&(e=[...e,t])}return e})(y),y,[]];let N="",T="";for(const t of M){const r=D(t),l=e(r.lines).text;if(N=l,T=r.shown,n(r.lines,C(l,o).lines))break}return{text:N,caret:Math.min(i,a)+T.length}}function P(t,e,n,r){const l=C(t,e),[o,,i]=A(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?W(t,e,n,r,{text:"\n"}):j(t,e,i,!1,n)}function j(t,n,r,l,o){const i=C(t,n).lines.map(({bullet:t,number:e,chars:n},o)=>o===r?{bullet:l,number:null,chars:n}:{bullet:t,number:e,chars:n});return{text:e(i).text,caret:o}}function V(t,n,r,l){const o=C(t,n),[i,a,s]=A(o,Math.min(r,l)),[c,u,d]=A(o,Math.max(r,l)),h=o.lines.slice(s,d+1).map(({bullet:t,number:e,chars:n},r)=>{const l=0===r?K(i,a):0,o=r===d-s?K(c,u):n.length;return{bullet:t,number:e,chars:n.slice(l,o)}});return e(h).text}function q(t,e,n){if(n<0){const n=t.charCodeAt(e-1);return e-(n>=56320&&n<=57343&&e>=2?2:1)}const r=t.charCodeAt(e);return e+(r>=55296&&r<=56319?2:1)}function F(t){const{value:e,rules:n,multiline:r,inputType:l,pending:o}=t;let[i,a]=t.sel;t.target&&t.target[0]!==t.target[1]&&l.startsWith("delete")&&([i,a]=t.target);const s=[i,a];if("historyUndo"===l||"historyRedo"===l)return{kind:"history",dir:"historyUndo"===l?"undo":"redo"};if("formatBold"===l||"formatItalic"===l||"formatStrikeThrough"===l)return{kind:"format",style:"formatBold"===l?"bold":"formatItalic"===l?"italic":"strike"};if("insertParagraph"===l||"insertLineBreak"===l)return r?{kind:"edit",edit:P(e,n,i,a),range:s}:null;if(l.startsWith("insert")){if("insertTranspose"===l)return null;let c=t.data??"";if("insertFromDrop"===l||"insertFromPaste"===l){const l=D({html:t.html??void 0,text:c},{doc:t.doc,multiline:r,rules:n});return{kind:"edit",edit:W(e,n,i,a,{markup:l}),range:s}}return r||(c=c.replace(/\s*\r?\n\s*/g," ")),{kind:"type",edit:W(e,n,i,a,{text:c,add:o?.add,drop:o?.drop,color:o?.color}),range:s}}if(l.startsWith("delete")){const t=C(e,n),r=t.text;if(i===a){const o=l.includes("Backward"),c=t.lines.findIndex(t=>i>=t.vis&&i<=t.vis+t.text.length),u=t.lines[c];if(o&&u&&i===u.vis&&(u.bullet||null!=u.number))return{kind:"edit",edit:j(e,n,c,!1,i),range:s};if(o?0===i:i===r.length)return null;o?i=q(r,i,-1):a=q(r,a,1)}return{kind:"type",edit:W(e,n,i,a,{text:""}),range:[i,a]}}return null}var I=1e3;function O(t=200){let e=[],n=[],r=null,l=0;return{record(o,i,a){const s="type"===i&&"type"===r&&a-l<1e3;r=i,l=a,n=[],s||(e.push(o),e.length>t&&e.shift())},undo(t){const l=e.pop();return l?(n.push(t),r=null,l):null},redo(t){const l=n.pop();return l?(e.push(t),r=null,l):null},reset(){e=[],n=[],r=null}}}var z=t=>t.preventDefault();function U(t,e){if(t)return t.startsWith("#")?t:e?.find(e=>e.name===t)?.value}function $({colors:t,current:e,words:n,onPick:r}){const l=null===e?null:e.startsWith("#")?e.toLowerCase():t.find(t=>t.name===e)?.value.toLowerCase()??null;/* @__PURE__ */
|
|
2
|
+
return v("div",{className:"es-copy-pop es-copy-colors",role:"dialog","aria-label":n.title,onMouseDown:t=>{"INPUT"!==t.target.tagName&&t.preventDefault()},children:[
|
|
3
|
+
/* @__PURE__ */y("span",{className:"es-copy-pop-label",children:n.theme}),
|
|
4
|
+
/* @__PURE__ */y("div",{className:"es-copy-theme",role:"group","aria-label":n.theme,children:t.map(t=>/* @__PURE__ */y(m,{content:`${t.label} · ${t.value.toUpperCase()}`,children:/* @__PURE__ */y(g,{color:t.value,size:"sm",className:"es-copy-theme-swatch","data-color":t.name,"aria-label":t.label,selected:e===t.name,onMouseDown:z,onClick:()=>r(t.name)})},t.name))}),
|
|
5
|
+
/* @__PURE__ */y("span",{className:"es-copy-pop-label",children:n.any}),
|
|
6
|
+
/* @__PURE__ */y(b,{className:"es-copy-any",value:l??"",onChange:t=>{t!==e&&r(t)},label:n.title,dragWrites:"end"}),
|
|
7
|
+
/* @__PURE__ */y("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */y(k,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:z,onClick:()=>r(null),children:n.remove})})]})}var H={sup:"sub",sub:"sup"};function X(t){const{value:e,rules:n,start:r,end:l,style:a,pending:s}=t,c=H[a];if(r===l){const t=o(e,r,l,n),i=s&&s.at===r?s:null,u=t.has(a),d=!!i?.add.includes(a)||!i?.drop.includes(a)&&u;let h=(i?.add??[]).filter(t=>t!==a),f=(i?.drop??[]).filter(t=>t!==a);return d&&u?f.push(a):d||u||h.push(a),!d&&c&&(h=h.filter(t=>t!==c),t.has(c)&&(f=[...f.filter(t=>t!==c),c])),{kind:"pending",pending:h.length||f.length||void 0!==i?.color?{add:h,drop:f,color:i?.color,at:r}:null}}let u=e,d=r,h=l;if(c&&!o(u,d,h,n).has(a)&&o(u,d,h,n).has(c)){const t=i(u,d,h,c,n);({text:u,selectionStart:d,selectionEnd:h}=t)}return{kind:"edit",result:i(u,d,h,a,n)}}var Y=/^(block|list-item|flex|grid|table|flow-root)$/;function Z(t){const e=t.ownerDocument.defaultView;return!!e&&Y.test(e.getComputedStyle(t).display)}function G(t,e){const n=[],r=/* @__PURE__ */new Map,l=/* @__PURE__ */new Map;let o="",i=!1;const a=()=>{i&&(o+="\n",i=!1)},s=t=>{for(const c of Array.from(t.childNodes)){if(3===c.nodeType){c.data.length>0&&a(),r.set(c,o.length),n.push({node:c,start:o.length,length:c.data.length}),o+=c.data,l.set(c,o.length);continue}if(1!==c.nodeType)continue;const t=c;if(e&&t.matches(e)){r.set(t,o.length),l.set(t,o.length);continue}if("BR"===t.tagName){a(),r.set(t,o.length),o+="\n",l.set(t,o.length);continue}const u=Z(t);u&&((i||o.length>0&&!o.endsWith("\n"))&&(o+="\n"),i=!1),r.set(t,o.length);const d=o.length;s(t),u&&o.length===d&&!i&&n.push({node:t,start:d,length:0}),l.set(t,o.length),u&&(i=!0)}};r.set(t,0),s(t),l.set(t,o.length);return{text:o,at:(t,e)=>{if(3===t.nodeType)return(r.get(t)??0)+Math.min(e,t.data.length);const n=t.childNodes;return e<n.length?r.get(n[e])??l.get(t)??0:l.get(t)??o.length},dom:e=>{for(let t=0;t<n.length;t+=1){const r=n[t],l=r.start+r.length;if(e<r.start)return[r.node,0];if(e<l||e===l&&(t===n.length-1||n[t+1].start>e))return 3===r.node.nodeType?[r.node,e-r.start]:[r.node,0]}const r=n[n.length-1];return r?3===r.node.nodeType?[r.node,r.length]:[r.node,0]:[t,0]}}}function J(t){const e=t.element();if(!e)return null;let n=t.value;const r=t.rules;if(G(e,t.skip).text!==C(n,r).text)return null;const l=t.now??(()=>Date.now()),i=O();let p=e,m=!1,g=null,b=null,k=[t.caret[0],t.caret[1]],v=null,y=!1,x=!1;const w=()=>{x||t.onSelect?.()},M={contenteditable:e.getAttribute("contenteditable"),spellcheck:e.getAttribute("spellcheck")},T=()=>p.ownerDocument,A=()=>T().defaultView?.getSelection()??null,E=()=>{if(!b)return!0;nt();const e=G(p,t.skip);if(e.text!==C(n,r).text)return!1;const[l,o]=b,[i,a]=e.dom(l),[s,c]=e.dom(o);return y||T().activeElement===p||p.focus({preventScroll:!0}),A()?.setBaseAndExtent(i,a,s,c),k=b,S=b,b=null,w(),!0};let S=null;const B=()=>{if(!S)return!1;const t=A(),e=t?.anchorNode??null;return!(e&&e.isConnected&&p.contains(e))||e===p&&0===t.anchorOffset&&(0!==S[0]||0!==S[1])},K=()=>{b=S,E()},P=()=>{E(),T().activeElement===p&&B()&&K();const e=A();if(!(e&&e.anchorNode&&e.focusNode&&p.contains(e.anchorNode)&&p.contains(e.focusNode)))return k;const n=G(p,t.skip),r=n.at(e.anchorNode,e.anchorOffset),l=n.at(e.focusNode,e.focusOffset);return k=r<=l?[r,l]:[l,r],k},j=t=>{const e=T().defaultView;t<=0||!e?S=null:e.requestAnimationFrame(()=>{m||b||(nt(),T().activeElement===p?(B()&&(K(),w()),j(t-1)):S=null)})},q=(t,e)=>{b=[t,e];const n=t=>{if(m)return;if(E())return void j(3);const e=T().defaultView;t>0&&e&&e.requestAnimationFrame(()=>n(t-1))};n(30)},I=(e,r,o)=>{e.text!==n?(i.record({text:n,start:r[0],end:r[1]},o,l()),n=e.text,t.write(n),q(e.caret,e.caret),w()):q(e.caret,e.caret)},z=t=>L(C(n,r),t[0],t[1]),U=(e,o)=>{if(e.text===n)return;i.record({text:n,start:o[0],end:o[1]},"edit",l()),n=e.text,t.write(n);const[a,s]=R(C(n,r),e.selectionStart,e.selectionEnd);q(a,s),w()},$=t=>{if(m)return;const e=P(),[l,o]=z(e),i=X({value:n,rules:r,start:l,end:o,style:t,pending:v});if("pending"===i.kind)return v=i.pending,void w();U(i.result,e)},H=e=>{n=e.text,t.write(n),q(e.start,e.end)},Y=e=>{if(m)return;m=!0,rt.removeEventListener("selectionchange",lt),et(p);const n=A();n&&n.rangeCount>0&&p.contains(n.anchorNode)&&p.contains(n.focusNode)&&n.removeAllRanges(),t.end(e)},Z=(t,e)=>{const l=P();!m&&l[0]!==l[1]&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",C(n,r).text.slice(l[0],l[1])),t.clipboardData.setData(N,V(n,r,l[0],l[1])),e&&I(W(n,r,l[0],l[1],{text:""}),l,"edit"))},J=t=>t.preventDefault(),Q=()=>{t.remount?.()},_=[["keydown",e=>{if(m||e.isComposing)return;const r=e.metaKey||e.ctrlKey;if("Escape"!==e.key){if(r&&!e.altKey&&!e.shiftKey&&("k"===e.key||"K"===e.key)&&t.onLinkKey?.())return e.preventDefault(),void e.stopPropagation();if(r&&!e.altKey&&!e.shiftKey&&("KeyA"===e.code||"a"===e.key||"A"===e.key))return e.preventDefault(),e.stopPropagation(),q(0,G(p,t.skip).text.length),void w();if("Enter"===e.key&&(!e.shiftKey||r))return e.preventDefault(),e.stopPropagation(),void Y("enter");if(r&&("z"===e.key||"Z"===e.key||"y"===e.key)){e.preventDefault(),e.stopPropagation();const t=P(),r={text:n,start:t[0],end:t[1]},l="y"===e.key||e.shiftKey?i.redo(r):i.undo(r);l&&H(l)}}else{if(e.preventDefault(),e.stopPropagation(),t.onEscape?.())return;Y("escape")}}],["beforeinput",e=>{if(m)return;if("insertCompositionText"===e.inputType)return;e.preventDefault();const l=P(),o=G(p,t.skip),a="function"==typeof e.getTargetRanges?e.getTargetRanges()[0]:void 0,s=a&&!a.collapsed?[o.at(a.startContainer,a.startOffset),o.at(a.endContainer,a.endOffset)]:null,c=F({value:n,rules:r,multiline:t.multiline,inputType:e.inputType,data:e.data??e.dataTransfer?.getData("text/plain")??"",html:e.dataTransfer?.getData("text/html"),doc:T(),sel:l,target:s,pending:v&&v.at===z(l)[0]?v:null});if(c){if("type"!==c.kind&&"edit"!==c.kind||(v=null),"history"===c.kind){const t={text:n,start:l[0],end:l[1]},e="undo"===c.dir?i.undo(t):i.redo(t);return void(e&&H(e))}"format"!==c.kind?I(c.edit,c.range,c.kind):$(c.style)}}],["compositionstart",()=>{g=P()}],["compositionend",e=>{const o=g;if(g=null,!m&&o)if(e.data){const a=W(n,r,o[0],o[1],{text:e.data});i.record({text:n,start:o[0],end:o[1]},"type",l()),n=a.text,t.write(n),Q(),q(a.caret,a.caret)}else Q(),q(o[0],o[0])}],["paste",e=>{if(m)return;e.preventDefault();const l=P(),o=e.clipboardData,i=o?.getData(N)??"",a=i?t.multiline?i:i.replace(/\s*\r?\n\s*/g," "):D({html:o?.getData("text/html")??"",text:o?.getData("text/plain")??""},{doc:T(),multiline:t.multiline,rules:r});I(W(n,r,l[0],l[1],{markup:a}),l,"edit")}],["copy",t=>Z(t,!1)],["cut",t=>Z(t,!0)],["drop",J],["dragstart",J],["blur",e=>{if(m||null!==g||y)return;const n=e.target,r=n.ownerDocument.defaultView,l=()=>{m||(n.isConnected&&n===t.element()?y||n.ownerDocument.activeElement===n||Y("blur"):q(k[0],k[1]))};r?.requestAnimationFrame?r.requestAnimationFrame(l):setTimeout(l,0)}],["focus",()=>{y=!1}]];function tt(t){t.setAttribute("contenteditable","true"),t.setAttribute("spellcheck","false"),t.setAttribute("data-es-typing","");for(const[e,n]of _)t.addEventListener(e,n)}function et(t){for(const[e,n]of _)t.removeEventListener(e,n);null===M.contenteditable?t.removeAttribute("contenteditable"):t.setAttribute("contenteditable",M.contenteditable),null===M.spellcheck?t.removeAttribute("spellcheck"):t.setAttribute("spellcheck",M.spellcheck),t.removeAttribute("data-es-typing")}function nt(){const e=t.element();e&&e!==p&&(et(p),p=e,tt(p))}const rt=p.ownerDocument;function lt(){m||w()}return rt.addEventListener("selectionchange",lt),tt(p),p.focus({preventScroll:!0}),q(t.caret[0],t.caret[1]),{get value(){return n},update(t){if(t===n)return;const e=C(t,r).text.length,[l,o]=P();n=t,i.reset(),q(Math.min(l,e),Math.min(o,e))},stop(t="stop"){Y(t)},pressed(){let t;x=!0;try{t=P()}finally{x=!1}const[e,l]=z(t),i=o(n,e,l,r),s={};for(const t of["bold","italic","underline","strike","sup","sub","link"]){const n=i.has(t),r=v&&v.at===e?v:null;s[t]=!!r?.add.includes(t)||!r?.drop.includes(t)&&n}const c=v&&v.at===e&&void 0!==v.color?v:null;return{marks:s,list:a(n,e,l,r),selected:l>e,href:f(n,e,l)?.href??null,color:c?c.color??null:h(n,e,l,r)}},press:$,insert(t){if(m)return;y=!1;const e=P(),[r,l]=z(e),o=r+t.length;U({text:n.slice(0,r)+t+n.slice(l),selectionStart:o,selectionEnd:o},e),nt(),p.focus({preventScroll:!0})},hold(){m||(P(),y=!0)},release(){y=!1},resume(){m||(y=!1,nt(),p.focus({preventScroll:!0}),q(k[0],k[1]))},link(t){if(m)return;y=!1;const e=P(),[l,o]=z(e),i=null===t?u(n,l,o,r):d(n,l,o,t,r),a=i.text===n;U(i,e),nt(),p.focus({preventScroll:!0}),a&&q(e[0],e[1])},color(t){if(m)return;const e=P(),[l,o]=z(e);if(l===o){const e=v&&v.at===l?v:null;return v={add:e?.add??[],drop:e?.drop??[],color:t,at:l},void w()}U(c(n,l,o,t,r),e)},list(e){if(m||!t.multiline)return;const l=P(),[o,i]=z(l),c=a(n,o,i,r);U(s(n,o,i,c===e?null:e,r),l)}}}var Q=(t,e,n)=>Math.min(Math.max(t,e),Math.max(e,n));function _({anchor:t,size:e,within:n,clip:r,parent:l,gap:o=8}){const i=Math.max(n.left,r.left),a=Math.min(n.right,r.right)-e.width,s=Q(t.left,i,a),c=r.bottom-(t.bottom+o),u=t.top-o-r.top,d=e.height>c&&(e.height<=u||u>c),h=d?t.top-o-e.height:t.bottom+o,f=t.left+Math.min((t.right-t.left)/2,10),p=Q(f-5-s,10,e.width-10-10);return{top:h-l.top,left:s-l.left,above:d,point:p}}var tt=t=>({left:t.left,top:t.top,right:t.right,bottom:t.bottom});function et(t,e){const n=("function"==typeof t.getClientRects?[...t.getClientRects()]:[]).filter(t=>t.height>0);if(n.length>0){const e="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():n[0];return e.height>0?tt(e):tt(n[0])}if(!e)return null;const r=e.getBoundingClientRect();return{left:r.left,top:r.top,right:r.left,bottom:r.bottom}}function nt(t){const e=t.ownerDocument,n=e.documentElement,r={left:0,top:0,right:n.clientWidth,bottom:n.clientHeight},l=e.defaultView?.getComputedStyle.bind(e.defaultView);for(let o=t.parentElement;o&&o!==n&&o!==e.body;o=o.parentElement){const t=l?.(o);if(!t||"visible"===t.overflowX&&"visible"===t.overflowY)continue;const e=o.getBoundingClientRect();if(0===e.width&&0===e.height)continue;const n=e.left+o.clientLeft,i=e.top+o.clientTop;r.left=Math.max(r.left,n),r.top=Math.max(r.top,i),r.right=Math.min(r.right,n+(o.clientWidth||e.width)),r.bottom=Math.min(r.bottom,i+(o.clientHeight||e.height))}return r}function rt(t){const e=t.offsetParent??t.parentElement;if(!e)return{left:0,top:0};const n=e.getBoundingClientRect();return{left:n.left+e.clientLeft-e.scrollLeft,top:n.top+e.clientTop-e.scrollTop}}function lt(t,e,n){const r=t.ownerDocument,l=r.createTreeWalker(t,4),o=t=>{let e=t,n=null;for(let t=l.nextNode();t;t=l.nextNode()){if(e<=t.data.length)return[t,e];e-=t.data.length,n=t}return n?[n,n.data.length]:null},i=o(e);l.currentNode=t;const a=o(n);if(!i||!a)return null;const s=r.createRange();return s.setStart(i[0],i[1]),s.setEnd(a[0],a[1]),s}export{$ as ColorWindow,N as MARKUP_CLIPBOARD_TYPE,I as TYPING_BURST_MS,U as colorRunOf,O as createHistory,W as editVisible,X as markPress,V as markupOfRange,P as newLine,rt as offsetOrigin,D as pasteToMarkup,_ as placeWindow,F as richInput,C as richLayout,et as selectionBox,L as selectionToSource,R as selectionToVisible,j as setBullet,J as startCanvasTyping,G as textMap,lt as textRange,E as toSource,S as toSourceStart,B as toVisible,nt as visibleArea};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{WebsiteBackendError as e}from"./chunk-KCOBHPN6.js";import{backendOf as r}from"./chunk-
|
|
1
|
+
import{WebsiteBackendError as e}from"./chunk-KCOBHPN6.js";import{backendOf as r}from"./chunk-SNF5764Q.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 +1 @@
|
|
|
1
|
-
import{WebsiteBackendError as e}from"./chunk-KCOBHPN6.js";import{backendOf as s}from"./chunk-
|
|
1
|
+
import{WebsiteBackendError as e}from"./chunk-KCOBHPN6.js";import{backendOf as s}from"./chunk-SNF5764Q.js";var r=()=>Promise.reject(new e("unavailable","This editor's backend keeps no section templates.")),t={list:()=>Promise.resolve([]),get:()=>Promise.resolve(null),ensure:r,save:r,update:r,rename:r,remove:r},a=e=>s(e).sectionTemplates??t,n=e=>({list:()=>a(e).list(),get:s=>a(e).get(s),ensure:(s,r,t)=>a(e).ensure(s,r,t),save:(s,r)=>a(e).save(s,r),update:(s,r)=>a(e).update(s,r),rename:(s,r)=>a(e).rename(s,r),remove:s=>a(e).remove(s)}),o=n();function m(e){return e.cache("easel:section-templates",()=>n(e))}export{o as sectionTemplates,m as sectionTemplatesOf};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{usePickFollowsSelection as n}from"./chunk-FHCKFOCD.js";import{slotFieldsOf as e}from"./chunk-TCAAOYQY.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-TUXLORVR.js";import{Inspector as i}from"./chunk-PFFH7ASD.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"selection"};function f(n){return"selection"===n.kind||"puck"===n.kind}function a(n,e){if(f(n)&&f(e))return!0;const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function d(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function p(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function k(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var h={},v=()=>h,g=()=>"",y=()=>null,b=()=>{},O={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},j={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},w={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},C={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},L={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function S(){/* @__PURE__ */
|
|
2
|
+
return s(t,{height:"fill"})}function D(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
|
+
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var F=o({});function P({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return s(F.Provider,{value:n,children:e})}function A(){return u(F)}function N(){return(A().useOwnerName??g)()}function T(){return(A().useDocumentLabel??y)()}function x(n,e,t,r){return(A().useBridges??v)(n,e,t,r)}function B(n){return(A().useStandaloneBridges??v)(n)}function G(n,e){(A().useDocumentPass??b)(n,e)}function I(){return A().blockRules??O}function R(){return A().blockLook??j}function H(){return A().devices??w}function K(){return A().leftView??C}function V(){return A().pinned??L}function Y(){return A().saveSwitch??!0}function Q(e){n(!0===A().pickFollowsSelection,e)}function U(){return A().storageNamespace||void 0}function X(){return A().styleClipboard??null}function Z(){return A().nodeKeys??!0}function q(){return A().notify??null}function z(){return A().Canvas??S}function E(){return A().CanvasHead??null}function J(){return A().canvasDrag??null}var M=o(null);function W({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return s(M.Provider,{value:n,children:e})}function $(){return u(M)}function _(){return A().Inspector??D}export{c as SELECTION_MODE,W as ScreenCanvasTargetProvider,P as ScreenPartsProvider,k as isPinnedFirst,m as isPinnedLast,f as isSelectionMode,d as isSlotMode,a as sameInspectorMode,p as screenSlotsOf,R as useScreenBlockLook,I as useScreenBlockRules,x as useScreenBridges,J as useScreenCanvasDrag,z as useScreenCanvasFrame,E as useScreenCanvasHead,$ as useScreenCanvasTarget,H as useScreenDevices,T as useScreenDocumentLabel,G as useScreenDocumentPass,_ as useScreenInspectorPanel,K as useScreenLeftView,Z as useScreenNodeKeys,q as useScreenNotify,N as useScreenOwnerName,A as useScreenParts,Q as useScreenPickFollowsSelection,V as useScreenPinned,Y as useScreenSaveSwitch,U as useScreenStorageNamespace,X as useScreenStyleClipboard,B as useStandaloneScreenBridges};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{SETTINGS_BUCKETS as t,SettingsGroup as l}from"./chunk-FM6JO4WF.js";import{DEFAULT_PANEL_WORDS as a}from"./chunk-KFV7N2DJ.js";import{TreeSeam as r}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as o}from"./chunk-K56YDHYQ.js";import{easelMenuEntries as i}from"./chunk-FIVU2COQ.js";import{FieldNumber as s}from"./chunk-Y2T3JX7K.js";import{FieldSelect as c}from"./chunk-KFWNGPW3.js";import{SettingsField as d,SettingsSegmented as u}from"./chunk-S3DUFDQ6.js";import{DEFAULT_FIELDS_WORDS as m}from"./chunk-JACEEVVF.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{useTreeDrag as p,gapToMoveIndex as f}from"./chunk-3S5N4HLJ.js";import{withTip as b}from"./chunk-P2VEMZH5.js";import{Textarea as g,Input as v,ItemCount as y,SortableList as k,ListRow as x,ContextMenu as w,tabPanelId as C,Tabs as N,tabButtonId as O}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as j,useState as S,useLayoutEffect as $,useId as D}from"react";import{jsx as I,jsxs as F}from"react/jsx-runtime";import{ChevronIcon as P,LockIcon as L,MoveUpIcon as E,MoveDownIcon as M,DuplicateIcon as W,TrashIcon as T}from"efficient-shell/icons/efficient";function z({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__ */I(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__ */I(v,{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 R(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function A(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 H(e,n){return e.filter((e,t)=>t!==n)}function J(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var K='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',V={parentId:"list",slot:"items"};function Y({label:e,icon:n,noun:t,items:l,onChange:a,newItem:s,summary:c,itemName:d,thumb:u,min:g=0,max:v,readOnly:C=!1,open:N,onOpen:O,renderItem:D,renderRow:z,canRemove:Y,lockedReason:B,fixed:Q=!1,removeOnRow:U=!0,canDuplicate:X,above:Z,head:q=!0}){const G=h("fields",m).list,_=h("tree",o),ee=t??G.item,ne=!C&&!Q&&("number"!=typeof v||l.length<v),te=l.length<=g,le=e=>!!Y&&!Y(l[e],e),ae=e=>!C&&!Q&&U&&!te&&!le(e),re=e=>ne&&(!X||X(l[e],e)),oe=(e,n)=>d?d(e,n):G.itemName({noun:ee,n:n+1}),ie=j([]),se=j(null),[ce,de]=S(null),ue=j(null),[me,he]=S(null),[pe,fe]=S("");$(()=>{const e=se.current;if(!e)return;se.current=null;const n=ie.current[e.index]?.querySelectorAll(K)[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(K)].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}}a(A(l,e,n));const o=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}(N,e,n);o!==N&&O(o),fe(G.moved({n:n+1,total:l.length}))},ge=e=>{ne&&(a(R(l,e,s())),z?(se.current={index:e,nth:0,start:null,end:null},null!==N&&N>=e&&O(N+1)):O(e))},ve=e=>{ae(e)&&(a(H(l,e)),N===e?O(null):null!==N&&N>e&&O(N-1))},ye=p({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===V.parentId&&n.slot===V.slot,onDrop:(e,n)=>{const t=f({...V,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:C}),ke=e=>{const n=[];return e>0&&n.push({label:G.moveUp,icon:/* @__PURE__ */I(E,{size:14}),shortcut:"⌥↑",onClick:()=>be(e,e-1)}),e<l.length-1&&n.push({label:G.moveDown,icon:/* @__PURE__ */I(M,{size:14}),shortcut:"⌥↓",onClick:()=>be(e,e+1)}),re(e)&&n.push({label:G.duplicate,icon:/* @__PURE__ */I(W,{size:14}),onClick:()=>(e=>{re(e)&&(a(R(l,e+1,J(l[e]))),null!==N&&N>e&&O(N+1))})(e)}),ae(e)&&n.push({label:G.delete,icon:/* @__PURE__ */I(T,{size:14}),danger:!0,onClick:()=>ve(e)}),n},xe=(e,n,t,l)=>{C||0===ke(e).length||he({index:e,x:n,y:t,owner:l})},we=e=>n=>{const t=l.slice();t[e]=n,a(t)};/* @__PURE__ */
|
|
2
|
+
return F("div",{className:"es-list",children:[q?/* @__PURE__ */F("div",{className:"es-list-head",children:[
|
|
3
|
+
/* @__PURE__ */F("span",{className:"es-list-label",children:[n?/* @__PURE__ */I("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
|
|
4
|
+
/* @__PURE__ */I(y,{count:l.length,label:G.count({noun:ee,n:l.length}),showZero:!0})]}):null,Z?/* @__PURE__ */I("div",{className:"es-list-above",children:Z}):null,l.length?/* @__PURE__ */F(k,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ye.rootProps(),children:[l.map((e,n)=>{const t=ye.row({item:n,place:{...V,index:n}}),l=t.draggable&&ce!==n,a=!z&&N===n,o=!C&&!Q&&U&&le(n),i=["es-list-row",z?"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__ */I(r,{...ye.seam({place:{...V,index:n}}),onAdd:ne?()=>ge(n):void 0,label:G.addHere({noun:ee})},`seam-${n}`):null,
|
|
5
|
+
/* @__PURE__ */I(x,{className:i,flat:!!z,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"])'),a=!!l&&l===l.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!a,ue.current=l&&!a?l:null,de(a?n:null)},onDragStart:e=>{const n=ue.current;ue.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{C||(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 a=e.currentTarget.getBoundingClientRect();return void xe(n,a.left+24,a.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)}},actions:C||Q||!U?void 0:o?b(B?B(e,n):G.locked,/* @__PURE__ */I("span",{className:"es-list-lock",role:"img","aria-label":B?B(e,n):G.locked,children:/* @__PURE__ */I(L,{size:13})})):b(G.deleteItem({noun:ee}),/* @__PURE__ */I("button",{type:"button",className:"es-list-x","aria-label":G.deleteItem({noun:ee}),disabled:!ae(n),onClick:()=>ve(n),children:"×"})),below:a?/* @__PURE__ */I("div",{className:"es-list-item",children:D(e,n,we(n))}):void 0,children:z?/* @__PURE__ */I("div",{className:"es-list-row-main",children:z(e,n,we(n))}):/* @__PURE__ */F("button",{type:"button",className:"es-list-open","aria-expanded":a,onClick:()=>O(a?null:n),children:[u?/* @__PURE__ */I("span",{className:"es-list-thumb","aria-hidden":"true",children:u(e,n)}):null,
|
|
6
|
+
/* @__PURE__ */I("span",{className:"es-list-row-name",children:oe(e,n)}),/* @__PURE__ */I("span",c?{className:"es-list-row-summary",children:c(e,n)}:{className:"es-list-row-summary"}),
|
|
7
|
+
/* @__PURE__ */I(P,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},n)]}),
|
|
8
|
+
/* @__PURE__ */I(r,{...ye.seam({place:{...V,index:l.length}})})]}):null,C||Q?null:/* @__PURE__ */I("button",{type:"button",className:"es-list-add",disabled:!ne,onClick:()=>ge(l.length),children:G.add({noun:ee})}),
|
|
9
|
+
/* @__PURE__ */I("span",{className:"es-list-said","aria-live":"polite",children:pe}),me&&me.index<l.length?
|
|
10
|
+
/* @__PURE__ */I(w,{at:{x:me.x,y:me.y},owner:me.owner,onClose:()=>he(null),items:i(ke(me.index))}):null]})}var B=e=>e<6?e+1:6,Q=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function U({field:e,name:t,id:a,value:r,onChange:o,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=S(!0),p=r&&"object"==typeof r?r:{};/* @__PURE__ */
|
|
11
|
+
return I(l,{id:`${a}-group`,title:Q(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */I(Z,{field:n,name:`${t}.${e}`,id:`${a}-${e}`,value:p[e],onChange:n=>o({...p,[e]:n}),readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:B(u)},e))})}function X({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]=S(null),f=u?d??null:h,b=u??p,g=Array.isArray(a)?a:[],v=e.getItemSummary;/* @__PURE__ */
|
|
12
|
+
return I(Y,{label:Q(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:r,newItem:()=>J({...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__ */I(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:m}=e;if(!n||n.marker||!1===n.visible)return null;const h=m?.[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 I(d,{label:Q(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */I(z,{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 I(d,{label:Q(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */I(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 I(d,{label:Q(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */I(c,{id:l,value:a,options:n.options,onChange:r,readOnly:o,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
16
|
+
return I(d,{label:Q(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */I(u,{ariaLabel:Q(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 I(U,{...e,field:n});case"array":/* @__PURE__ */
|
|
18
|
+
return I(X,{...e,field:n});case"slot":return null}}var q=e=>t.includes(e);function G(n,l){let a,r=t[0];const o=[],i=/* @__PURE__ */new Set;for(const[t,s]of Object.entries(n))s&&(q(s.bucket)&&((s.marker||s.bucket!==r)&&(a=void 0),r=s.bucket),s.marker&&"string"==typeof s.fold?a={key:t,title:s.fold}:s.marker&&!1===s.fold&&(a=void 0),s.marker||!1===s.visible||l&&!e(s,l)||(o.push(a?{name:t,field:s,bucket:r,fold:a}:{name:t,field:s,bucket:r}),"slot"!==s.type&&i.add(r)));return{rows:o,buckets:t.filter(e=>i.has(e))}}function _(e){return new Map(G(e).rows.map(e=>[e.name,e.bucket]))}function ee(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 ne({fields:e,values:n,onChange:t,readOnly:r=!1,context:o,showWhenContext:i,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 w=h("panel",a),j=D(),$=p??`es-insp${j.replace(/:/g,"")}`,P=G(e,{values:n,context:i}),[L,E]=S(void 0),M=s??L,W=M&&P.buckets.includes(M)?M:P.buckets[0],[T,z]=S(null),R=T&&T.panel===$&&P.rows.some(e=>e.name===T.name)?T:null,A=d&&P.buckets.length>1,H=A&&W?C($,W):`${$}-rows`,[J,K]=S(()=>/* @__PURE__ */new Set),V=y??J,Y=(e,n)=>{/* @__PURE__ */return I(l,{title:e.title,open:!V.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&K(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),k?.(e,n)})(e.key,n),id:`${$}-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},Q=e=>A&&e!==W,U=({name:e,field:l,bucket:a,fold:s})=>/* @__PURE__ */I("div",{className:"es-insp-row","data-field":e,"data-bucket":a,hidden:!!Q(a)||void 0,children:/* @__PURE__ */I(Z,{field:l,name:e,id:`${$}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:r,context:o,showWhenContext:i,renderers:m,openItem:R&&R.name===e?R.index:null,onOpenItem:n=>z(null===n?null:{panel:$,name:e,index:n}),headingLevel:s?B(x):x})},e);/* @__PURE__ */
|
|
19
|
+
return F("div",{className:"es-insp",children:[A?/* @__PURE__ */I("div",{className:"es-insp-tabs",children:/* @__PURE__ */I(N,{variant:"underline",block:!0,"aria-label":f??w.settings,idPrefix:$,value:W,onChange:e=>{const n=e;void 0===s&&E(n),c?.(n)},items:P.buckets.map(e=>{const n=w.buckets[e],t=u?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */I("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
20
|
+
/* @__PURE__ */F("div",{className:"es-insp-rows",id:H,role:A?"tabpanel":void 0,"aria-labelledby":A&&W?O($,W):void 0,children:[b?v?/* @__PURE__ */I("div",{className:"es-insp-band","data-fold":v.key,children:Y(v,b)}):b:null,ee(P.rows).map((e,n)=>{if(!e.fold)return e.rows.map(U);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
21
|
+
return I("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!Q(t)&&!l)||void 0,children:Y(e.fold,e.rows.map(U))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{z as FieldText,ne as Inspector,Z as InspectorField,Y as ListField,_ as bucketsOf,J as copyItem,R as insertAt,Q as labelOf,A as moveTo,G as planFields,H as removeAt};
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{SettingRow as e,Segmented as a,Tooltip as i}from"efficient-shell/ui";import{jsx as s,jsxs as l}from"react/jsx-runtime";function n({label:a,labelId:i,icon:l,value:n,hint:t,changed:c,htmlFor:d,action:o,children:r,className:b}){/* @__PURE__ */
|
|
2
|
+
return s(e,{size:"compact",label:a,labelId:i,icon:l,readout:n,description:t,changed:c,controlId:d,action:o,value:r,className:b})}function t({options:e,value:n,onChange:t,ariaLabel:c,fit:d,disabled:o=!1,className:r}){const b=d&&function(e,a){return{"--es-fit-count":e,"--es-fit-labels":`${a.labelsPx}px`,"--es-fit-widest":`${a.widestLabelPx}px`}}(e.length,d),m=e.findIndex(e=>e.id===n);
|
|
3
|
+
/* @__PURE__ */
|
|
4
|
+
return s("div",{className:"es-segs-fit","data-disabled":o||void 0,style:b,children:/* @__PURE__ */s(a,{size:"sm",label:c,className:`es-segs${b?" is-measured":""}${r?` ${r}`:""}`,value:m<0?"":String(m),onChange:a=>t(e[Number(a)].id),options:e.map((e,a)=>{const n=e.title??("string"==typeof e.label?e.label:void 0),t="string"!=typeof e.label,c=a=>n&&(e.icon||t)?/* @__PURE__ */s(i,{content:n,children:a}):a;return{value:String(a),disabled:o||!0===e.disabled,icon:e.icon?c(
|
|
5
|
+
/* @__PURE__ */s("span",{className:"es-seg-icon","aria-hidden":"true",children:e.icon})):void 0,label:t?/* @__PURE__ */l("span",{className:"es-seg-word",children:[c(/* @__PURE__ */s("span",{"aria-hidden":"true",children:e.label})),
|
|
6
|
+
/* @__PURE__ */s("span",{className:"es-vh",children:n})]}):/* @__PURE__ */s("span",{className:"es-seg-word",children:e.label})}})})})}export{n as SettingsField,t as SettingsSegmented};
|