efficient-easel 0.101.1 → 0.103.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 +51 -0
- package/dist/LinkPicker-W2Rtxetz.d.ts +111 -0
- package/dist/autosave/index.d.ts +6 -3
- package/dist/autosave/index.js +1 -1
- package/dist/chrome/index.d.ts +3 -2
- package/dist/chrome/index.js +1 -25
- package/dist/chunk-26OOWIJJ.js +1 -0
- package/dist/chunk-2LK54I4E.js +1 -0
- package/dist/chunk-3M3A3DN2.js +4 -0
- package/dist/chunk-3QVB4AG2.js +3 -0
- package/dist/chunk-3WSPDAK2.js +1 -0
- package/dist/chunk-4ES5JGGX.js +1 -0
- package/dist/chunk-4MXFKJUY.js +1 -0
- package/dist/chunk-57DJOKXT.js +1 -0
- package/dist/chunk-5MZ3RNQQ.js +13 -0
- package/dist/chunk-5ZBY24K7.js +1 -0
- package/dist/chunk-66ICOE3I.js +8 -0
- package/dist/chunk-6DJHRLCU.js +25 -0
- package/dist/chunk-6FY3PZS3.js +1 -0
- package/dist/chunk-6TZTKAB5.js +1 -0
- package/dist/chunk-6UJ3Y6FC.js +1 -0
- package/dist/chunk-6W7WLPZH.js +1 -0
- package/dist/chunk-7F52SZOI.js +2 -0
- package/dist/chunk-7MU3RJ6S.js +1 -0
- package/dist/chunk-A7ZJII7O.js +1 -0
- package/dist/chunk-AJBJ74ME.js +1 -0
- package/dist/chunk-AKFJK65Z.js +1 -0
- package/dist/chunk-AKZWUV5Z.js +1 -0
- package/dist/chunk-BDTITTMW.js +1 -0
- package/dist/chunk-BSPCSC45.js +1 -0
- package/dist/chunk-BXZ6WLHC.js +22 -0
- package/dist/chunk-DUVRZ456.js +1 -0
- package/dist/chunk-F6CCTEIX.js +1 -0
- package/dist/chunk-FGNR22NY.js +1 -0
- package/dist/chunk-FUDHI5I4.js +1 -0
- package/dist/chunk-GENAF3P6.js +1 -0
- package/dist/chunk-GOTN2KY4.js +2 -0
- package/dist/chunk-GXN65JMA.js +1 -0
- package/dist/chunk-GXQCZJOP.js +1 -0
- package/dist/chunk-GZO72N3Q.js +0 -0
- package/dist/chunk-HDKTR5TZ.js +62 -0
- package/dist/chunk-HMX55DYT.js +1 -0
- package/dist/chunk-HQ4VVRIC.js +1 -0
- package/dist/chunk-HWW4XJOH.js +1 -0
- package/dist/chunk-I54UCYOU.js +1 -0
- package/dist/chunk-IQ5TA7AM.js +1 -0
- package/dist/chunk-IWAPPEL4.js +6 -0
- package/dist/chunk-IYT6NN2J.js +1 -0
- package/dist/chunk-KCBEE2MC.js +2 -0
- package/dist/chunk-KDYIMJTZ.js +1 -0
- package/dist/chunk-KQMML6JM.js +4 -0
- package/dist/chunk-LG436UTD.js +1 -0
- package/dist/chunk-MSBF7IW3.js +2 -0
- package/dist/chunk-NBJ2YY6Y.js +4 -0
- package/dist/chunk-OM67AJQC.js +1 -0
- package/dist/chunk-OORDMLL4.js +5 -0
- package/dist/chunk-OYX47SL7.js +1 -0
- package/dist/chunk-P67FP7PG.js +9 -0
- package/dist/chunk-PWZOS45R.js +2 -0
- package/dist/chunk-Q2HPBMG5.js +1 -0
- package/dist/chunk-Q3SQBNJB.js +1 -0
- package/dist/chunk-R2HLPNQF.js +1 -0
- package/dist/chunk-R5L2E7JX.js +1 -0
- package/dist/chunk-R5ZVNJLJ.js +2 -0
- package/dist/chunk-RLBXE4EU.js +1 -0
- package/dist/chunk-RW4XBUUW.js +1 -0
- package/dist/chunk-SERF2FAU.js +1 -0
- package/dist/chunk-TTJ54QGG.js +18 -0
- package/dist/chunk-VV5ADNBR.js +1 -0
- package/dist/chunk-YJXEHK6I.js +2 -0
- package/dist/chunk-Z3KBLIEH.js +10 -0
- package/dist/chunk-ZE7I3PLX.js +1 -0
- package/dist/chunk-ZWK3CBRU.js +1 -0
- package/dist/chunk-ZZ7VLIHQ.js +1 -0
- package/dist/drag/index.d.ts +3 -41
- package/dist/drag/index.js +1 -18
- package/dist/easel/index.js +1 -9
- package/dist/{words-BMzV04b1.d.ts → engine-DBxp_v6B.d.ts} +1 -58
- package/dist/fields/index.d.ts +2 -109
- package/dist/fields/index.js +1 -22
- package/dist/gold/index.d.ts +4 -2
- package/dist/host-DJ8Gzsx7.d.ts +552 -0
- package/dist/menu/index.js +1 -1
- package/dist/node-ops/index.js +1 -1
- package/dist/panelWidths-D9hTLR25.d.ts +66 -0
- package/dist/screen/components/AddBlockRow.d.ts +14 -0
- package/dist/screen/components/AddBlockRow.js +1 -0
- package/dist/screen/components/AddChildRow.d.ts +39 -0
- package/dist/screen/components/AddChildRow.js +1 -0
- package/dist/screen/components/AddSidePanel.d.ts +54 -0
- package/dist/screen/components/AddSidePanel.js +1 -0
- package/dist/screen/components/MediaSidePanel.d.ts +47 -0
- package/dist/screen/components/MediaSidePanel.js +1 -0
- package/dist/screen/components/NodeContextMenu.d.ts +364 -0
- package/dist/screen/components/NodeContextMenu.js +1 -0
- package/dist/screen/components/PageEditGuardNotices.d.ts +5 -0
- package/dist/screen/components/PageEditGuardNotices.js +1 -0
- package/dist/screen/components/PanelToggleIcon.d.ts +14 -0
- package/dist/screen/components/PanelToggleIcon.js +1 -0
- package/dist/screen/components/PreviewDeviceContext.d.ts +28 -0
- package/dist/screen/components/PreviewDeviceContext.js +1 -0
- package/dist/screen/components/PreviewPartsContext.d.ts +33 -0
- package/dist/screen/components/PreviewPartsContext.js +1 -0
- package/dist/screen/components/ScreenChrome.d.ts +5 -0
- package/dist/screen/components/ScreenChrome.js +1 -0
- package/dist/screen/components/ScreenDocumentContext.d.ts +20 -0
- package/dist/screen/components/ScreenDocumentContext.js +1 -0
- package/dist/screen/components/ScreenMount.d.ts +76 -0
- package/dist/screen/components/ScreenMount.js +1 -0
- package/dist/screen/components/ScreenStoreProvider.d.ts +63 -0
- package/dist/screen/components/ScreenStoreProvider.js +1 -0
- package/dist/screen/components/SectionScreenShell.d.ts +5 -0
- package/dist/screen/components/SectionScreenShell.js +16 -0
- package/dist/screen/components/SidePanelHead.d.ts +81 -0
- package/dist/screen/components/SidePanelHead.js +1 -0
- package/dist/screen/components/SlotChildActionsContext.d.ts +41 -0
- package/dist/screen/components/SlotChildActionsContext.js +1 -0
- package/dist/screen/components/UiIcon.d.ts +52 -0
- package/dist/screen/components/UiIcon.js +1 -0
- package/dist/screen/components/panel-widths.d.ts +37 -0
- package/dist/screen/components/panel-widths.js +1 -0
- package/dist/screen/components/usePartBridge.d.ts +66 -0
- package/dist/screen/components/usePartBridge.js +1 -0
- package/dist/screen/index.d.ts +31 -0
- package/dist/screen/index.js +1 -0
- package/dist/screen/lib/admin-bridge.d.ts +105 -0
- package/dist/screen/lib/admin-bridge.js +1 -0
- package/dist/screen/lib/backend-error.d.ts +106 -0
- package/dist/screen/lib/backend-error.js +1 -0
- package/dist/screen/lib/chrome-theme.d.ts +21 -0
- package/dist/screen/lib/chrome-theme.js +1 -0
- package/dist/screen/lib/client-only.d.ts +24 -0
- package/dist/screen/lib/client-only.js +1 -0
- package/dist/screen/lib/content/view-tiers.d.ts +25 -0
- package/dist/screen/lib/content/view-tiers.js +1 -0
- package/dist/screen/lib/document-addressing.d.ts +20 -0
- package/dist/screen/lib/document-addressing.js +1 -0
- package/dist/screen/lib/document-contract.d.ts +237 -0
- package/dist/screen/lib/document-contract.js +1 -0
- package/dist/screen/lib/document-hooks.d.ts +71 -0
- package/dist/screen/lib/document-hooks.js +0 -0
- package/dist/screen/lib/document-switch.d.ts +74 -0
- package/dist/screen/lib/document-switch.js +1 -0
- package/dist/screen/lib/failure.d.ts +54 -0
- package/dist/screen/lib/failure.js +1 -0
- package/dist/screen/lib/host-chrome.d.ts +181 -0
- package/dist/screen/lib/host-chrome.js +1 -0
- package/dist/screen/lib/host-inbound.d.ts +20 -0
- package/dist/screen/lib/host-inbound.js +1 -0
- package/dist/screen/lib/host.d.ts +20 -0
- package/dist/screen/lib/host.js +1 -0
- package/dist/screen/lib/key-scope.d.ts +23 -0
- package/dist/screen/lib/key-scope.js +1 -0
- package/dist/screen/lib/links/link-filters.d.ts +41 -0
- package/dist/screen/lib/links/link-filters.js +0 -0
- package/dist/screen/lib/load-error.d.ts +29 -0
- package/dist/screen/lib/load-error.js +1 -0
- package/dist/screen/lib/media-panel.d.ts +94 -0
- package/dist/screen/lib/media-panel.js +1 -0
- package/dist/screen/lib/media-picker.d.ts +68 -0
- package/dist/screen/lib/media-picker.js +1 -0
- package/dist/screen/lib/page-lock.d.ts +5 -0
- package/dist/screen/lib/page-lock.js +1 -0
- package/dist/screen/lib/puck/add-target-types.d.ts +55 -0
- package/dist/screen/lib/puck/add-target-types.js +0 -0
- package/dist/screen/lib/puck/block-choice.d.ts +52 -0
- package/dist/screen/lib/puck/block-choice.js +1 -0
- package/dist/screen/lib/puck/block-types-in.d.ts +39 -0
- package/dist/screen/lib/puck/block-types-in.js +1 -0
- package/dist/screen/lib/puck/content-tree.d.ts +196 -0
- package/dist/screen/lib/puck/content-tree.js +1 -0
- package/dist/screen/lib/puck/device-fields.d.ts +128 -0
- package/dist/screen/lib/puck/device-fields.js +1 -0
- package/dist/screen/lib/puck/field-buckets.d.ts +22 -0
- package/dist/screen/lib/puck/field-buckets.js +1 -0
- package/dist/screen/lib/puck/field-markers.d.ts +205 -0
- package/dist/screen/lib/puck/field-markers.js +1 -0
- package/dist/screen/lib/puck/hidable.d.ts +44 -0
- package/dist/screen/lib/puck/hidable.js +1 -0
- package/dist/screen/lib/puck/palette-sections.d.ts +96 -0
- package/dist/screen/lib/puck/palette-sections.js +1 -0
- package/dist/screen/lib/puck/panel-fields.d.ts +47 -0
- package/dist/screen/lib/puck/panel-fields.js +1 -0
- package/dist/screen/lib/puck/panel-no-control-mark.d.ts +74 -0
- package/dist/screen/lib/puck/panel-no-control-mark.js +1 -0
- package/dist/screen/lib/puck/part-id.d.ts +23 -0
- package/dist/screen/lib/puck/part-id.js +1 -0
- package/dist/screen/lib/puck/preview-click.d.ts +49 -0
- package/dist/screen/lib/puck/preview-click.js +1 -0
- package/dist/screen/lib/puck/preview-dom.d.ts +8 -0
- package/dist/screen/lib/puck/preview-dom.js +1 -0
- package/dist/screen/lib/puck/preview-events.d.ts +25 -0
- package/dist/screen/lib/puck/preview-events.js +1 -0
- package/dist/screen/lib/puck/preview-selection-context.d.ts +72 -0
- package/dist/screen/lib/puck/preview-selection-context.js +1 -0
- package/dist/screen/lib/puck/section-doc.d.ts +20 -0
- package/dist/screen/lib/puck/section-doc.js +1 -0
- package/dist/screen/lib/puck/slot-child-name.d.ts +186 -0
- package/dist/screen/lib/puck/slot-child-name.js +1 -0
- package/dist/screen/lib/puck/slot-heal.d.ts +5 -0
- package/dist/screen/lib/puck/slot-heal.js +1 -0
- package/dist/screen/lib/puck/slot-section-spec.d.ts +96 -0
- package/dist/screen/lib/puck/slot-section-spec.js +0 -0
- package/dist/screen/lib/puck/style-clipboard.d.ts +78 -0
- package/dist/screen/lib/puck/style-clipboard.js +1 -0
- package/dist/screen/lib/puck/text-control-kinds.d.ts +71 -0
- package/dist/screen/lib/puck/text-control-kinds.js +1 -0
- package/dist/screen/lib/puck/tree-reveal.d.ts +62 -0
- package/dist/screen/lib/puck/tree-reveal.js +1 -0
- package/dist/screen/lib/puck/use-section-ops.d.ts +86 -0
- package/dist/screen/lib/puck/use-section-ops.js +1 -0
- package/dist/screen/lib/screen-parts.d.ts +748 -0
- package/dist/screen/lib/screen-parts.js +1 -0
- package/dist/screen/lib/section-template-types.d.ts +49 -0
- package/dist/screen/lib/section-template-types.js +0 -0
- package/dist/screen/lib/section-templates.d.ts +23 -0
- package/dist/screen/lib/section-templates.js +1 -0
- package/dist/screen/lib/session-context.d.ts +30 -0
- package/dist/screen/lib/session-context.js +1 -0
- package/dist/screen/lib/session.d.ts +255 -0
- package/dist/screen/lib/session.js +1 -0
- package/dist/screen/screen.css +1102 -0
- package/dist/screen/words.d.ts +42 -0
- package/dist/screen/words.js +1 -0
- package/dist/session-DSQFmIvx.d.ts +43 -0
- package/dist/strings/catalogue.d.ts +13 -4
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +5 -2
- package/dist/strings/index.js +1 -1
- package/dist/style-clipboard/index.js +1 -1
- package/dist/{types-DGcCsxs8.d.ts → types-CqY85foL.d.ts} +3 -65
- package/dist/words-D_Lnw1Gr.d.ts +59 -0
- package/package.json +348 -2
- package/dist/chunk-IG3U5NWJ.js +0 -1
|
@@ -0,0 +1,748 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, MouseEvent, ComponentType } from 'react';
|
|
3
|
+
import { Data } from '../../blocks/index.js';
|
|
4
|
+
import { D as DeviceOption } from '../../types-CqY85foL.js';
|
|
5
|
+
import { a as EaselRailItem } from '../../types-DWS-s9z-.js';
|
|
6
|
+
import { HostProduct } from './host-chrome.js';
|
|
7
|
+
import { EaselSession } from './session.js';
|
|
8
|
+
import { AddTarget } from './puck/add-target-types.js';
|
|
9
|
+
import '../../types-E3HrTPg2.js';
|
|
10
|
+
import '../../data/index.js';
|
|
11
|
+
import '../../types-41704JE4.js';
|
|
12
|
+
import '../../resolve-D68pb3Bx.js';
|
|
13
|
+
import '../../plan-DChbUXdS.js';
|
|
14
|
+
import '../../edit-lock/index.js';
|
|
15
|
+
import '../../panelWidths-D9hTLR25.js';
|
|
16
|
+
import '../../wordFit-D4S36PvB.js';
|
|
17
|
+
import './links/link-filters.js';
|
|
18
|
+
import '../../LinkPicker-W2Rtxetz.js';
|
|
19
|
+
import './document-contract.js';
|
|
20
|
+
import './document-hooks.js';
|
|
21
|
+
import './section-template-types.js';
|
|
22
|
+
import './puck/content-tree.js';
|
|
23
|
+
import './puck/block-choice.js';
|
|
24
|
+
import './puck/slot-section-spec.js';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* WHAT THE WEBSITE HANDS THE EDITOR'S SCREEN — the parts of the screen that
|
|
28
|
+
* know there is a website, given to it instead of imported by it
|
|
29
|
+
* (doc/adr/0003).
|
|
30
|
+
*
|
|
31
|
+
* The screen — the frame, the panels, the tree, the add panel, the inspector —
|
|
32
|
+
* is being made to hold nothing a website has that an email does not: no page,
|
|
33
|
+
* no site theme, no pinned header, no chat bubble. What it used to import and
|
|
34
|
+
* wire itself, the website layer now wires and hands over here, and a screen
|
|
35
|
+
* mounted with no layer above it draws none of it.
|
|
36
|
+
*
|
|
37
|
+
* This is NOT `EaselChrome` (lib/host-chrome): that is what a HOST stands
|
|
38
|
+
* round the editor — the storefront's cart, its header's settings — built in
|
|
39
|
+
* the host and absent on the ambient session. These parts are the builder's
|
|
40
|
+
* own website layer, the same for every host, and present on every mount of
|
|
41
|
+
* the screen (`ScreenStoreProvider` supplies them, from whoever mounts it).
|
|
42
|
+
*
|
|
43
|
+
* Fixed for the life of a mount, like the session: `useBridges`,
|
|
44
|
+
* `useStandaloneBridges`, `useDocumentPass` and `blockLook.useProducts` are
|
|
45
|
+
* called as hooks, and `Canvas` and `Inspector` are rendered as element types,
|
|
46
|
+
* so the provider's value must not change while the screen is mounted.
|
|
47
|
+
*/
|
|
48
|
+
/** A node of the document as the screen hands it to a layer: its type and its
|
|
49
|
+
* props, its id among them. */
|
|
50
|
+
interface ScreenNode {
|
|
51
|
+
type: string;
|
|
52
|
+
props: {
|
|
53
|
+
id: string;
|
|
54
|
+
[key: string]: unknown;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A panel of the layer's own, as the screen holds it: a kind, and whatever
|
|
59
|
+
* else the layer put beside it to say WHICH one (the node a panel is about).
|
|
60
|
+
* The screen stores it and hands it back, and reads no further into it than
|
|
61
|
+
* `kind`.
|
|
62
|
+
*/
|
|
63
|
+
type ScreenInspectorMode = {
|
|
64
|
+
kind: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* THE SELECTION'S OWN PANEL — the one mode the screen names for itself. In it
|
|
68
|
+
* the inspector follows the selection: a node's settings, or the document's
|
|
69
|
+
* with nothing selected. Every other mode is a panel of a layer's, which the
|
|
70
|
+
* screen stores and hands back; this is the one it puts the inspector back to
|
|
71
|
+
* when the selection changes, and on every press of a row of its own.
|
|
72
|
+
*
|
|
73
|
+
* ONE object for the module's life, so setting it while it is the mode already
|
|
74
|
+
* bails out of the state update. A layer whose inspector names this mode names
|
|
75
|
+
* THIS object (the website's `PUCK_MODE`, components/SectionEditor, is it), so
|
|
76
|
+
* "is the panel showing the selection's own?" has one answer on both sides.
|
|
77
|
+
* The kind keeps the spelling the website's inspector has always tested for.
|
|
78
|
+
*/
|
|
79
|
+
declare const SELECTION_MODE: {
|
|
80
|
+
readonly kind: "puck";
|
|
81
|
+
};
|
|
82
|
+
/** The inspector drilled into one PART of a node (lib/puck/part-id): the mode
|
|
83
|
+
* the screen's part bridge (components/usePartBridge) opens and closes. The
|
|
84
|
+
* website's inspector modes include it (components/SectionEditor
|
|
85
|
+
* `InspectorMode`). */
|
|
86
|
+
type ScreenPartMode = {
|
|
87
|
+
kind: "part";
|
|
88
|
+
nodeId: string;
|
|
89
|
+
propKey: string;
|
|
90
|
+
};
|
|
91
|
+
/** Are two panels the same panel: the same kind, about the same thing? Asked
|
|
92
|
+
* member by member, so the screen can answer without knowing what a layer
|
|
93
|
+
* keeps beside the kind. */
|
|
94
|
+
declare function sameInspectorMode(a: ScreenInspectorMode, b: ScreenInspectorMode): boolean;
|
|
95
|
+
/** The inspector, as far as a layer needs it: which panel it shows, and how to
|
|
96
|
+
* show one of the layer's own. */
|
|
97
|
+
interface ScreenInspector {
|
|
98
|
+
/** The kind of panel showing now. */
|
|
99
|
+
kind: string;
|
|
100
|
+
/** The panel showing now, whole: what `open` was handed, given back. */
|
|
101
|
+
mode: ScreenInspectorMode;
|
|
102
|
+
/** Show a panel of the layer's own and reveal the inspector, leaving the
|
|
103
|
+
* selection where it is. The same panel already showing stays, as the
|
|
104
|
+
* object it was (`sameInspectorMode`). */
|
|
105
|
+
open: (mode: ScreenInspectorMode) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Put a panel of the layer's own in the inspector and leave the inspector as
|
|
108
|
+
* it stands, in view or hidden: with `reveal` after it, what a press on one
|
|
109
|
+
* of the screen's own rows does. `open` is for a handler registered once: it
|
|
110
|
+
* never changes identity, so it cannot ask whether the inspector is hidden
|
|
111
|
+
* and brings it out every time.
|
|
112
|
+
*/
|
|
113
|
+
show: (mode: ScreenInspectorMode) => void;
|
|
114
|
+
/** Bring the inspector into view if it is hidden. What it shows stays. */
|
|
115
|
+
reveal: () => void;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* What the screen hands THE INSPECTOR it mounts in its right panel
|
|
119
|
+
* (`ScreenParts.Inspector`): the panel to show, the ways out of a panel,
|
|
120
|
+
* and what the screen's own furniture offers one. The names are the ones the
|
|
121
|
+
* screen has always passed, two of them in a website's words: they are the
|
|
122
|
+
* doors the bridges hand back (`openSettings`, `openStyles`).
|
|
123
|
+
*/
|
|
124
|
+
interface ScreenInspectorPanelProps {
|
|
125
|
+
/** The panel to show: the selection's own (`SELECTION_MODE`), or one of the
|
|
126
|
+
* layer's, handed back as the screen was handed it. */
|
|
127
|
+
mode: ScreenInspectorMode;
|
|
128
|
+
/** The way to the settings of the whole document, from a panel that edits
|
|
129
|
+
* one part of it (`ScreenBridges.openSettings`). */
|
|
130
|
+
onOpenWebsiteSettings: () => void;
|
|
131
|
+
/** The way to the styles a part of a block can follow, from that part's own
|
|
132
|
+
* panel (`ScreenBridges.openStyles`). Omitted where there is nowhere to
|
|
133
|
+
* keep them, and the panel draws no door. */
|
|
134
|
+
onOpenSiteStyles?: () => void;
|
|
135
|
+
/** Select a node and show ITS OWN settings: the way out of a panel that was
|
|
136
|
+
* scoped down to part of that node. */
|
|
137
|
+
onSelectNode: (nodeId: string) => void;
|
|
138
|
+
/** Withhold the head's duplicate and remove. Set by the screen whose
|
|
139
|
+
* document is ONE node, which a second node or none would break. */
|
|
140
|
+
hideNodeActions?: boolean;
|
|
141
|
+
/** Say one line through the screen's toast. Omitted by a screen with none. */
|
|
142
|
+
onNotify?: (msg: string, tone?: "success" | "error") => void;
|
|
143
|
+
/** Hide the panel: the last button of its head. Omitted by a screen whose
|
|
144
|
+
* inspector is always in view. */
|
|
145
|
+
onHidePanel?: () => void;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The document and its tree of rows, as far as a layer needs them to wire and
|
|
149
|
+
* draw the parts of ONE block that are not nodes of their own: what is
|
|
150
|
+
* selected, where a node sits, and the three things a press on such a part's
|
|
151
|
+
* row does to the node it belongs to. Handed to the bridges on every render,
|
|
152
|
+
* so each member is that render's.
|
|
153
|
+
*/
|
|
154
|
+
interface ScreenTree {
|
|
155
|
+
/** The document, as the rules are handed it. */
|
|
156
|
+
data: unknown;
|
|
157
|
+
/** The node selected now, or null. */
|
|
158
|
+
selected: ScreenNode | null;
|
|
159
|
+
/** The key of the list a node sits in, by the node's id. */
|
|
160
|
+
zoneOf: (id: string) => string | undefined;
|
|
161
|
+
/** Somebody else holds the document: nothing may be moved. */
|
|
162
|
+
readOnly: boolean;
|
|
163
|
+
/** Select the top-level node at `index` the way a press on its row does: the
|
|
164
|
+
* inspector goes back to the selection's own panel, then the selection
|
|
165
|
+
* moves. */
|
|
166
|
+
select: (index: number) => void;
|
|
167
|
+
/** Write the top-level node at `index` back, whole. */
|
|
168
|
+
replace: (index: number, node: ScreenNode) => void;
|
|
169
|
+
/** Bring the canvas to a node, as selecting its row does. */
|
|
170
|
+
scrollTo: (id: string) => void;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The canvas, as far as a layer needs it: which device it is being looked at
|
|
174
|
+
* on, and how often its frame has been rebuilt. The switch, its state and the
|
|
175
|
+
* Refresh are the screen's; a layer whose own fields or preview ask "which
|
|
176
|
+
* view is this?", or which puts the canvas somewhere of its own accord, is
|
|
177
|
+
* told here. Handed to the bridges on every render.
|
|
178
|
+
*/
|
|
179
|
+
interface ScreenCanvas {
|
|
180
|
+
/** The id of the device the switch is on: one of the layer's own
|
|
181
|
+
* (`ScreenDevices.options`). */
|
|
182
|
+
device: string;
|
|
183
|
+
/** How many times the screen has rebuilt the canvas's frame (its Refresh).
|
|
184
|
+
* It changes with each one and with nothing else: a layer that put the
|
|
185
|
+
* canvas somewhere as the document opened lists it as a dependency, and
|
|
186
|
+
* puts it there again in the fresh frame. */
|
|
187
|
+
refreshes: number;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* The left panel, as far as a layer needs it: to put it on a view and to bring
|
|
191
|
+
* it out. Which view it is on, whether it is open and what a press on the rail
|
|
192
|
+
* does to either are the screen's. Handed to the bridges on every render.
|
|
193
|
+
*/
|
|
194
|
+
interface ScreenLeftPanel {
|
|
195
|
+
/** Put the panel on a view, by its id: one of the layer's own
|
|
196
|
+
* (`ScreenLeftView`) or one of the screen's. Whether the panel is in view
|
|
197
|
+
* stays, and the screen keeps the choice as it keeps any other. */
|
|
198
|
+
setView: (view: string) => void;
|
|
199
|
+
/** Bring the panel into view if it is hidden. What it shows stays. */
|
|
200
|
+
reveal: () => void;
|
|
201
|
+
}
|
|
202
|
+
/** What a view of the layer's is handed when the left panel draws it: what the
|
|
203
|
+
* screen hands the heads of its own views. */
|
|
204
|
+
interface ScreenLeftViewFrame {
|
|
205
|
+
/** Hide the whole left panel: the last button of every view's head. */
|
|
206
|
+
onHide: () => void;
|
|
207
|
+
/** Say one line through the screen's toast. */
|
|
208
|
+
notify: (msg: string, tone?: "success" | "error") => void;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* A VIEW of the left panel that is the layer's own: a button in the rail, and
|
|
212
|
+
* what the panel shows while the view is the one it is on. The screen lights
|
|
213
|
+
* the button and switches to the view exactly as it does for its own Layers,
|
|
214
|
+
* and draws no frame round what `panel` returns: a view draws its own head.
|
|
215
|
+
*/
|
|
216
|
+
interface ScreenLeftView {
|
|
217
|
+
/** The view's id: what the screen holds as the view the panel is on, and
|
|
218
|
+
* what is kept between mounts (`ScreenLeftViewRules`), so one in use is
|
|
219
|
+
* never renamed. The rail button's id as well. */
|
|
220
|
+
id: string;
|
|
221
|
+
/** The rail button's name. */
|
|
222
|
+
label: string;
|
|
223
|
+
/** …and its glyph. */
|
|
224
|
+
icon: ReactNode;
|
|
225
|
+
/** The view, for the screen to place in the left panel as it comes back. A
|
|
226
|
+
* function called where the panel is drawn and not a component of its own:
|
|
227
|
+
* what it returns is mounted in the screen's place, with nothing between. */
|
|
228
|
+
panel: (frame: ScreenLeftViewFrame) => ReactNode;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* What a layer stands in the rail: a view of its own, or a button that is NOT
|
|
232
|
+
* a view of the left panel — one that opens something of the layer's
|
|
233
|
+
* elsewhere. That one is the engine's own rail item (efficient-easel/rail),
|
|
234
|
+
* drawn as it is handed: the layer says whether it is lit and what a press
|
|
235
|
+
* does.
|
|
236
|
+
*/
|
|
237
|
+
type ScreenRailItem = ScreenLeftView | EaselRailItem;
|
|
238
|
+
/**
|
|
239
|
+
* The screen's own writes of the document, as far as a layer's pass over a
|
|
240
|
+
* document needs them. They are the writes every surface of the screen makes
|
|
241
|
+
* (lib/puck/use-section-ops), refused the same way while somebody else holds
|
|
242
|
+
* the document, and ONE object from render to render until that changes — so a
|
|
243
|
+
* pass may list it as a dependency and run no oftener for it.
|
|
244
|
+
*/
|
|
245
|
+
interface ScreenDocumentOps {
|
|
246
|
+
/** Replace the whole working document, unrecorded. */
|
|
247
|
+
setDocument: (data: Data) => void;
|
|
248
|
+
/** Insert a node of `type`, as its own defaults, into the top-level list;
|
|
249
|
+
* returns the id it was given. */
|
|
250
|
+
insertSection: (type: string, index: number) => string;
|
|
251
|
+
/** Insert a FULL node — its type and its props, slot children inline — into
|
|
252
|
+
* the list `zone` names; returns the id it was given. */
|
|
253
|
+
insertNode: (zone: string, index: number, node: ScreenNode) => string;
|
|
254
|
+
/** Write the node at a place back, whole. */
|
|
255
|
+
replaceComponent: (zone: string, index: number, node: ScreenNode) => void;
|
|
256
|
+
}
|
|
257
|
+
/** What the tree lends a layer that draws a row in it: the row's own click,
|
|
258
|
+
* for a pointer landing outside its name. */
|
|
259
|
+
interface ScreenTreeRows {
|
|
260
|
+
rowClick: (select: () => void) => (e: MouseEvent<HTMLElement>) => void;
|
|
261
|
+
}
|
|
262
|
+
/** …and, for a layer that draws rows which fold, the tree's own fold state.
|
|
263
|
+
* The ids are the layer's to make; the tree keeps them with its own. */
|
|
264
|
+
interface ScreenTreeFolds extends ScreenTreeRows {
|
|
265
|
+
isCollapsed: (id: string) => boolean;
|
|
266
|
+
toggleCollapse: (id: string) => void;
|
|
267
|
+
}
|
|
268
|
+
/** What a layer's bridges give back for the screen to place. */
|
|
269
|
+
interface ScreenBridges {
|
|
270
|
+
/** A row under the Add panel's tiles, for something that is not a block.
|
|
271
|
+
* Handed the way to leave Add, for a row that opens a panel. */
|
|
272
|
+
addPanelRow?: (leaveAdd: () => void) => ReactNode;
|
|
273
|
+
/**
|
|
274
|
+
* Rows at the END of a top-level node's own children, for a part of that
|
|
275
|
+
* block which is not a node: "layer, do you draw anything under this row?".
|
|
276
|
+
* Asked only where the node's child rows are drawn, and what comes back is
|
|
277
|
+
* placed as it is — the layer draws with the tree's own row.
|
|
278
|
+
*/
|
|
279
|
+
partRows?: (node: ScreenNode, rows: ScreenTreeRows) => ReactNode;
|
|
280
|
+
/**
|
|
281
|
+
* Does the layer draw a subtree of its OWN under this top-level node — rows
|
|
282
|
+
* for things the block keeps in its props and not in a slot? Such a row
|
|
283
|
+
* folds like any other, so the screen asks before it draws the caret.
|
|
284
|
+
*/
|
|
285
|
+
hasOwnRows?: (node: ScreenNode) => boolean;
|
|
286
|
+
/** That subtree's rows, for the node at `index`. Asked only when
|
|
287
|
+
* `hasOwnRows` said yes and the row is unfolded. */
|
|
288
|
+
ownRows?: (node: ScreenNode, index: number, rows: ScreenTreeFolds) => ReactNode;
|
|
289
|
+
/**
|
|
290
|
+
* The row of a top-level node was pressed, and the screen has selected it:
|
|
291
|
+
* a layer that keeps a focus of its own INSIDE one block puts it back to the
|
|
292
|
+
* block. Called between the selection and the canvas's scroll. The node is
|
|
293
|
+
* the one at the pressed index, if there is one.
|
|
294
|
+
*/
|
|
295
|
+
sectionPressed?: (node: ScreenNode | undefined) => void;
|
|
296
|
+
/**
|
|
297
|
+
* The layer's own controls in the top bar's right cluster. The screen draws
|
|
298
|
+
* that cluster as the save state, Refresh and the main button; a layer has
|
|
299
|
+
* two places in it. `barLead` stands FIRST among the actions, between the
|
|
300
|
+
* save state and Refresh: something done with the whole document that only
|
|
301
|
+
* the layer has. What comes back is placed as it is, and a layer with
|
|
302
|
+
* nothing to offer just now returns nothing.
|
|
303
|
+
*/
|
|
304
|
+
barLead?: () => ReactNode;
|
|
305
|
+
/** …and `barTrail` stands between Refresh and the main button: a way out to
|
|
306
|
+
* where the document is read. */
|
|
307
|
+
barTrail?: () => ReactNode;
|
|
308
|
+
/**
|
|
309
|
+
* …and `barMain` IS the main button, in its place at the end of the cluster
|
|
310
|
+
* (0.103.0): the layer's own way to finish with the document — the campaign
|
|
311
|
+
* designer's Done — where the screen draws Publish (a document that
|
|
312
|
+
* publishes) or Save. What comes back is placed as it is, nothing round it,
|
|
313
|
+
* and returning nothing leaves the place empty. Absent, the screen draws its
|
|
314
|
+
* own button, as it always has.
|
|
315
|
+
*/
|
|
316
|
+
barMain?: () => ReactNode;
|
|
317
|
+
/**
|
|
318
|
+
* The layer's own buttons in the rail. The screen draws the rail as Add, its
|
|
319
|
+
* own Layers and the host's Media library; a layer has two places in it.
|
|
320
|
+
* `railLead` stands between Add and Layers. Each list is the buttons THIS
|
|
321
|
+
* document has, in the order they are drawn: one it does not have is left
|
|
322
|
+
* out, and a view left out is a view the panel cannot be on.
|
|
323
|
+
*/
|
|
324
|
+
railLead?: ReadonlyArray<ScreenRailItem>;
|
|
325
|
+
/** …and `railTrail` stands between Layers and Media. */
|
|
326
|
+
railTrail?: ReadonlyArray<ScreenRailItem>;
|
|
327
|
+
/**
|
|
328
|
+
* Which view the left panel ACTUALLY shows, given the one it is set to: the
|
|
329
|
+
* view kept from another document may be one this document does not have,
|
|
330
|
+
* and the panel then shows the screen's Layers. The layer answers, because
|
|
331
|
+
* some of the views are its own and which of them a document has is its to
|
|
332
|
+
* know; the screen says whether its Media view is there to show
|
|
333
|
+
* (`hasMedia`), so there is ONE fallback and not one on each side.
|
|
334
|
+
*/
|
|
335
|
+
resolveLeftView?: (view: string, hasMedia: boolean) => string;
|
|
336
|
+
/**
|
|
337
|
+
* A tool of the layer's own at the foot of the Layers tree, under the last
|
|
338
|
+
* row: something that reads the whole document and is not a row of it.
|
|
339
|
+
* Placed as it comes back.
|
|
340
|
+
*/
|
|
341
|
+
treeFoot?: () => ReactNode;
|
|
342
|
+
/**
|
|
343
|
+
* Two doors out of the inspector's panels, onto wherever the layer keeps what
|
|
344
|
+
* they lead to: a view of its own in the left panel, a panel of its own in
|
|
345
|
+
* the inspector. The screen hands them to the inspector it mounts and does
|
|
346
|
+
* not know where they go. `openSettings` is the way to the settings of the
|
|
347
|
+
* whole document, from a panel that edits one part of it. The inspector
|
|
348
|
+
* cannot do without it, so with no layer it is handed one that leads nowhere.
|
|
349
|
+
*/
|
|
350
|
+
openSettings?: () => void;
|
|
351
|
+
/** …and `openStyles` the way to the styles a part of a block can follow,
|
|
352
|
+
* from that part's own panel. A layer with nowhere to keep them hands none,
|
|
353
|
+
* and the panel draws no door. */
|
|
354
|
+
openStyles?: () => void;
|
|
355
|
+
/**
|
|
356
|
+
* The open document is the one that STORES what the layer pins: the node
|
|
357
|
+
* every other document shows pinned and does not hold (the website's: the
|
|
358
|
+
* page that keeps the site's one footer). It is edited there in place, so
|
|
359
|
+
* the screen draws that document's tree without the rows an ordinary one has
|
|
360
|
+
* round its own sections, and without the row that leads to it. Absent, the
|
|
361
|
+
* document is an ordinary one.
|
|
362
|
+
*/
|
|
363
|
+
pinnedSource?: boolean;
|
|
364
|
+
/** …and the way to edit what is pinned from a document that only shows it:
|
|
365
|
+
* what a press on its row in the tree does. Where it leads is the layer's
|
|
366
|
+
* (the website opens its footer's editor over the page). */
|
|
367
|
+
editPinnedSource?: () => void;
|
|
368
|
+
/**
|
|
369
|
+
* The layer's own way to bring the canvas to a node the screen has selected,
|
|
370
|
+
* for a document where the screen's plain scroll does not hold: one the
|
|
371
|
+
* layer draws something above, which reflows and takes the scroll back (the
|
|
372
|
+
* website's footer, edited under the page it was opened from). Handed back
|
|
373
|
+
* only for such a document, and the screen then calls it in place of its
|
|
374
|
+
* scroll; absent, the screen scrolls.
|
|
375
|
+
*/
|
|
376
|
+
holdCanvasOn?: (id: string) => void;
|
|
377
|
+
/** The layer's own context, stood round the whole screen. What it is handed
|
|
378
|
+
* is the screen; what it returns is rendered in the screen's place. */
|
|
379
|
+
wrap?: (screen: ReactNode) => ReactNode;
|
|
380
|
+
}
|
|
381
|
+
/** A block type's own default props, read off the config the screen holds.
|
|
382
|
+
* The screen's to look up and a layer's to be lent: a layer that reached into
|
|
383
|
+
* the config for itself would be holding a second copy of it. */
|
|
384
|
+
type NodeDefaults = (type: string) => Record<string, unknown>;
|
|
385
|
+
/** What the screen lends a rule that builds a node. All four are the screen's
|
|
386
|
+
* own and none is a block's: the rule states the node, the screen says what a
|
|
387
|
+
* type defaults to, what its next id is, what it is called and whether the
|
|
388
|
+
* host offers it. */
|
|
389
|
+
interface ScreenNodeMaker {
|
|
390
|
+
/** A type's default props, from the config. */
|
|
391
|
+
nodeDefaults: NodeDefaults;
|
|
392
|
+
/** A fresh id for one node of a type. Called once per node, in the order the
|
|
393
|
+
* nodes are written. */
|
|
394
|
+
newNodeId: (type: string) => string;
|
|
395
|
+
/** What a top-level node of a type is called, as the tree and the toast say
|
|
396
|
+
* it. */
|
|
397
|
+
sectionLabel: (type: string) => string;
|
|
398
|
+
/** Does this editor's host offer the type? A rule that would lay down a block
|
|
399
|
+
* the host left out asks first. */
|
|
400
|
+
blockIsOffered: (type: string) => boolean;
|
|
401
|
+
}
|
|
402
|
+
/** A node as a rule hands it back: a type and its props, slot children inline
|
|
403
|
+
* in them. The screen inserts it whole. */
|
|
404
|
+
interface ScreenNewNode {
|
|
405
|
+
type: string;
|
|
406
|
+
props: Record<string, unknown>;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* The rules of particular blocks, asked by the screen and never stated in it:
|
|
410
|
+
* the screen is handed nodes and is not told which blocks exist. Plain
|
|
411
|
+
* functions of what they are passed, and the same object for the life of a
|
|
412
|
+
* mount, so the screen may call them anywhere without listing them as a
|
|
413
|
+
* dependency.
|
|
414
|
+
*/
|
|
415
|
+
interface ScreenBlockRules {
|
|
416
|
+
/** A block that is what its section IS: it may be selected and edited, and
|
|
417
|
+
* never removed, hidden, duplicated or dragged. */
|
|
418
|
+
isLockedBlock: (type: string | undefined) => boolean;
|
|
419
|
+
/** Why a second one of this node cannot be made in this document, or null —
|
|
420
|
+
* a rule of the block's own. */
|
|
421
|
+
duplicateBlocked: (data: unknown, node: unknown) => string | null;
|
|
422
|
+
/**
|
|
423
|
+
* How many nodes of its own kind the node with `id` already sits inside, for
|
|
424
|
+
* a block that limits its own nesting; 0 for every other. It is the depth the
|
|
425
|
+
* add lookup is asked at, so every surface that adds into one node offers the
|
|
426
|
+
* same list.
|
|
427
|
+
*/
|
|
428
|
+
nestDepth: (data: unknown, type: string, id: string) => number;
|
|
429
|
+
/**
|
|
430
|
+
* What a new top-level section of `type` STARTS AS, when that is more than
|
|
431
|
+
* its own defaults — an arrangement of several blocks, or a prop no default
|
|
432
|
+
* carries — as ONE node for the screen to insert in one step; or null, and
|
|
433
|
+
* the screen inserts the type by itself. Where it goes, selecting it and
|
|
434
|
+
* announcing it stay the screen's.
|
|
435
|
+
*/
|
|
436
|
+
newSectionNode: (type: string, make: ScreenNodeMaker) => ScreenNewNode | null;
|
|
437
|
+
/**
|
|
438
|
+
* What can go in a node of `nodeType`, sitting `nestDepth` nodes of its own
|
|
439
|
+
* kind deep (0 when not said): the slot its children are kept on, and the
|
|
440
|
+
* menu's rows or the one child type a button adds — or null for a node that
|
|
441
|
+
* takes no children. THE ONE ANSWER every add surface of the screen asks (the
|
|
442
|
+
* tree, the panel, the menu, the Add panel), so no two of them can come to
|
|
443
|
+
* offer one node different lists; what each of the layer's blocks takes is
|
|
444
|
+
* the layer's catalogue, and the screen is not told it.
|
|
445
|
+
*/
|
|
446
|
+
canAddTo: (nodeType: string, nestDepth?: number) => AddTarget | null;
|
|
447
|
+
/**
|
|
448
|
+
* Does the host of this editor offer the type? Asked of the editor's own
|
|
449
|
+
* session where the screen holds it, else of the editor on the page. Where
|
|
450
|
+
* no host chose its blocks, every type is.
|
|
451
|
+
*/
|
|
452
|
+
blockIsOffered: (type: string, session?: EaselSession) => boolean;
|
|
453
|
+
}
|
|
454
|
+
/** The tier a node is NAMED at: a node at the top of the document is a section,
|
|
455
|
+
* a node inside another is a block. */
|
|
456
|
+
type ScreenNodeLevel = "section" | "block";
|
|
457
|
+
/**
|
|
458
|
+
* How the layer's blocks are NAMED AND DRAWN in the screen: the tree's rows and
|
|
459
|
+
* the Add panel's tiles put a word, a glyph and a cover on a block, and which
|
|
460
|
+
* word and which drawing is known only to the layer that knows every block it
|
|
461
|
+
* has. The screen is handed a type and asks.
|
|
462
|
+
*
|
|
463
|
+
* The same object for the life of a mount, and its two components the same two
|
|
464
|
+
* functions throughout: the screen renders them as element types, and a type
|
|
465
|
+
* that changed identity would remount every row and tile that wears one.
|
|
466
|
+
*/
|
|
467
|
+
interface ScreenBlockLook {
|
|
468
|
+
/**
|
|
469
|
+
* What a node of `type` is called at a level, given `base` — the label the
|
|
470
|
+
* config holds for the type, which is the name of every node the layer does
|
|
471
|
+
* not name by where it sits.
|
|
472
|
+
*/
|
|
473
|
+
labelAtLevel: (type: string, level: ScreenNodeLevel, base: string) => string;
|
|
474
|
+
/** The Add panel's one-line blurb for a section, by type. A type with none
|
|
475
|
+
* has no entry. */
|
|
476
|
+
descriptions: Record<string, string>;
|
|
477
|
+
/** The Add panel's short heading for a group of sections, by the group's
|
|
478
|
+
* key, where the layer has one; undefined, and the registry's own title for
|
|
479
|
+
* the group is its heading. */
|
|
480
|
+
categoryLabel: (id: string) => string | undefined;
|
|
481
|
+
/** The section the Add panel offers FIRST, by itself, ahead of every group
|
|
482
|
+
* and taken out of its own; null, and every section stands in its group. */
|
|
483
|
+
firstSection: string | null;
|
|
484
|
+
/**
|
|
485
|
+
* What the row of a block says when the block is named by its own content
|
|
486
|
+
* and not by the slot-child rule (lib/puck/slot-child-name): the layer reads
|
|
487
|
+
* the content, and `compLabel` — the config's label for a type, lent by the
|
|
488
|
+
* screen — is the word for a block it has no rule for.
|
|
489
|
+
*/
|
|
490
|
+
blockRowName: (child: {
|
|
491
|
+
type: string;
|
|
492
|
+
props: Record<string, unknown>;
|
|
493
|
+
}, compLabel: (type: string) => string) => string;
|
|
494
|
+
/**
|
|
495
|
+
* The plain words of a block's stored copy, every mark of the layer's markup
|
|
496
|
+
* unwrapped: what a tree row prints of a name the author typed, where no mark
|
|
497
|
+
* can be drawn (lib/puck/slot-child-name `slotChildRowName`). Which marks
|
|
498
|
+
* there are is the layer's grammar — a website's is not an email's.
|
|
499
|
+
*/
|
|
500
|
+
plainText: (copy: string) => string;
|
|
501
|
+
/** The glyph of a block or section type, as a tree row and a block tile wear
|
|
502
|
+
* it. */
|
|
503
|
+
Icon: ComponentType<{
|
|
504
|
+
type: string;
|
|
505
|
+
size?: number;
|
|
506
|
+
className?: string;
|
|
507
|
+
}>;
|
|
508
|
+
/** The cover picture of a section type, filling the Add panel's card. */
|
|
509
|
+
Thumbnail: ComponentType<{
|
|
510
|
+
type: string;
|
|
511
|
+
}>;
|
|
512
|
+
/**
|
|
513
|
+
* The products a row may be named after when its block holds only a
|
|
514
|
+
* product's handle: null until they arrive, and for good when there are
|
|
515
|
+
* none. A HOOK — the one member here that is — called once per render where
|
|
516
|
+
* the screen read the products itself, so its effect keeps its place.
|
|
517
|
+
*/
|
|
518
|
+
useProducts: () => readonly HostProduct[] | null;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* THE DEVICES the canvas can be looked at on. That the top bar has a switch,
|
|
522
|
+
* and that the canvas is fitted to the pane and framed, is the screen's: any
|
|
523
|
+
* editor's canvas is looked at on more than one. WHICH devices there are, what
|
|
524
|
+
* each is called and how wide it is drawn is the layer's — a website has three
|
|
525
|
+
* view tiers where an email has two.
|
|
526
|
+
*
|
|
527
|
+
* The same object for the life of a mount: the screen reads the device it
|
|
528
|
+
* starts on from it once, and draws the switch from it on every render.
|
|
529
|
+
*/
|
|
530
|
+
interface ScreenDevices {
|
|
531
|
+
/** What the switch offers, in the order it draws them: an id, a name and a
|
|
532
|
+
* glyph each (efficient-easel/chrome `DeviceSwitch`). */
|
|
533
|
+
options: ReadonlyArray<DeviceOption>;
|
|
534
|
+
/** The device a mount starts on. */
|
|
535
|
+
initial: string;
|
|
536
|
+
/**
|
|
537
|
+
* The ONE device with no width of its own: the canvas draws it at the
|
|
538
|
+
* pane's width, so it reflows as the pane is dragged, where every other is
|
|
539
|
+
* a fixed width scaled to fit the pane. Its frame is the plain one; every
|
|
540
|
+
* other device's wears a class named for its id.
|
|
541
|
+
*/
|
|
542
|
+
fluid: string;
|
|
543
|
+
/** The width each device is drawn at, in CSS px, by id. For `fluid` it is
|
|
544
|
+
* only the width of the frame before the pane has been measured. */
|
|
545
|
+
widths: Readonly<Record<string, number>>;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* WHAT IS PINNED in the document's top-level list. That the list has a BAND
|
|
549
|
+
* its sections keep to — one node pinned ahead of it at most, and one behind —
|
|
550
|
+
* is the screen's: where a new section lands, where a dragged one may be put
|
|
551
|
+
* down, which nodes the canvas offers a handle on and what the menu withholds
|
|
552
|
+
* are all read off that band, and the arithmetic of it is written once, in the
|
|
553
|
+
* screen. WHICH types are pinned is the layer's: a website pins its Header
|
|
554
|
+
* first and its Footer last, where an email pins nothing.
|
|
555
|
+
*
|
|
556
|
+
* And the layer's GROUPS OF SECTIONS, if it has them: a pinned top-level node
|
|
557
|
+
* whose one list holds ordinary sections, which move among the groups' lists
|
|
558
|
+
* and nowhere else. The screen draws a group's row and keeps its sections to
|
|
559
|
+
* those lists; which types are groups, and what a group's list is keyed by,
|
|
560
|
+
* it asks.
|
|
561
|
+
*
|
|
562
|
+
* And THE PANEL A PINNED NODE IS EDITED IN, where that is not the selection's
|
|
563
|
+
* own: a node the layer pins may carry no fields, the layer keeping its
|
|
564
|
+
* settings and showing them in a panel of the layer's. Which node, and which
|
|
565
|
+
* panel, is the layer's to say; the screen asks by type where a node is
|
|
566
|
+
* selected and where a pinned node's row is pressed, and shows what it is
|
|
567
|
+
* handed.
|
|
568
|
+
*
|
|
569
|
+
* The same object for the life of a mount, its three functions plain functions
|
|
570
|
+
* of what they are passed: the screen reads it anywhere, inside the callbacks
|
|
571
|
+
* and effects it does not rebuild for it.
|
|
572
|
+
*/
|
|
573
|
+
interface ScreenPinnedNodes {
|
|
574
|
+
/** The type of the node pinned FIRST: the band starts after it. Null when
|
|
575
|
+
* the layer pins none. */
|
|
576
|
+
first: string | null;
|
|
577
|
+
/** The type of the node pinned LAST: the band ends at it. */
|
|
578
|
+
last: string | null;
|
|
579
|
+
/** The type of the group of sections pinned first, ahead of everything. */
|
|
580
|
+
firstGroup: string | null;
|
|
581
|
+
/** …and of the one pinned last. */
|
|
582
|
+
lastGroup: string | null;
|
|
583
|
+
/** Is a node of this type a group of sections? */
|
|
584
|
+
isSectionGroup: (type: string | undefined) => boolean;
|
|
585
|
+
/** The key of the list a group keeps its sections in, by the group's id. */
|
|
586
|
+
sectionGroupZone: (groupId: string) => string;
|
|
587
|
+
/**
|
|
588
|
+
* The panel of the layer's own that a node of this type is edited in, or
|
|
589
|
+
* null: the node is edited by its own fields, in the selection's own panel
|
|
590
|
+
* (`SELECTION_MODE`). What comes back is what the screen stores, so it is
|
|
591
|
+
* the SAME object every time the same type is asked about. Asked with no
|
|
592
|
+
* type where nothing is selected, and answered null.
|
|
593
|
+
*/
|
|
594
|
+
panelOf: (type: string | null | undefined) => ScreenInspectorMode | null;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* THE VIEW THE LEFT PANEL IS ON, from one mount to the next. That the panel
|
|
598
|
+
* has views, that one of them is current and that the choice is kept is the
|
|
599
|
+
* screen's: it holds the view in state and mirrors it from ONE effect, the
|
|
600
|
+
* only writer. WHERE it is kept, which view a first mount opens on and what a
|
|
601
|
+
* selection does to it are the layer's — a website opens on its page list,
|
|
602
|
+
* and keeps the choice under a key of its own.
|
|
603
|
+
*
|
|
604
|
+
* The same object for the life of a mount: the screen seeds its state from
|
|
605
|
+
* `read` once, and calls the other two from an effect and a callback it does
|
|
606
|
+
* not rebuild for them.
|
|
607
|
+
*/
|
|
608
|
+
interface ScreenLeftViewRules {
|
|
609
|
+
/** The view a mount opens on: the one kept, or the layer's first. */
|
|
610
|
+
read: () => string;
|
|
611
|
+
/** Keep the view for the next mount. */
|
|
612
|
+
write: (view: string) => void;
|
|
613
|
+
/** What a change of the selection does to the view: handed the id of the
|
|
614
|
+
* node selected, if one is, and the view the panel is on, it answers the
|
|
615
|
+
* view to be on. */
|
|
616
|
+
forSelection: (selectedId: string | null | undefined, current: string) => string;
|
|
617
|
+
}
|
|
618
|
+
interface ScreenParts {
|
|
619
|
+
/**
|
|
620
|
+
* The name a panel's head gives what is being edited — the website's name,
|
|
621
|
+
* a campaign's — as the hook the head calls. The media panel's context line
|
|
622
|
+
* reads it (components/MediaSidePanel), through `useScreenOwnerName`.
|
|
623
|
+
*/
|
|
624
|
+
useOwnerName?: () => string;
|
|
625
|
+
/**
|
|
626
|
+
* The layer's wiring between the inspector and what the layer draws in the
|
|
627
|
+
* canvas, as ONE hook the screen calls where it used to hold that wiring: a
|
|
628
|
+
* click on the layer's furniture in the canvas opens its panel, and the open
|
|
629
|
+
* panel outlines the furniture. And its wiring for the parts of one block
|
|
630
|
+
* that are not nodes: what selecting one does, and the rows it has in the
|
|
631
|
+
* tree. And its own controls in the top bar, with whatever they run on. And
|
|
632
|
+
* its buttons in the rail, with the views of the left panel they open.
|
|
633
|
+
*/
|
|
634
|
+
useBridges?: (inspector: ScreenInspector, tree: ScreenTree, canvas: ScreenCanvas, left: ScreenLeftPanel) => ScreenBridges;
|
|
635
|
+
/**
|
|
636
|
+
* The same, for the screen that holds ONE node as its whole document
|
|
637
|
+
* (SectionScreenShell). A hook of its own and not `useBridges` with less
|
|
638
|
+
* handed in: that screen wired less — no site-wide furniture, no tree of
|
|
639
|
+
* sections — and a hook cannot leave out half of itself by what it is
|
|
640
|
+
* passed.
|
|
641
|
+
*/
|
|
642
|
+
useStandaloneBridges?: (inspector: ScreenInspector) => ScreenBridges;
|
|
643
|
+
/**
|
|
644
|
+
* The layer's own pass over a document as it opens: what it lays down in one
|
|
645
|
+
* that lacks it, and takes out of one that holds it twice. A hook of its own
|
|
646
|
+
* and not one more thing the bridges run, because of WHERE it must run: the
|
|
647
|
+
* bridges stand early among the screen's hooks, and this pass writes the
|
|
648
|
+
* document, so it is called LAST of the screen's own passes over it — after
|
|
649
|
+
* the slot seeding and the duplicate-id heal, which address top-level nodes
|
|
650
|
+
* by index and would be thrown out by a node laid down ahead of them. Lent
|
|
651
|
+
* the screen's writes and the config it holds, for the engine's node maker.
|
|
652
|
+
*/
|
|
653
|
+
useDocumentPass?: (ops: ScreenDocumentOps, config: unknown) => void;
|
|
654
|
+
/**
|
|
655
|
+
* The layer's block rules. Handed here and NOT registered at import: what a
|
|
656
|
+
* registry holds depends on which modules have loaded, and that order is not
|
|
657
|
+
* the same in the app and in a script that loads one file, so a rule could
|
|
658
|
+
* answer in one and be absent in the other.
|
|
659
|
+
*/
|
|
660
|
+
blockRules?: ScreenBlockRules;
|
|
661
|
+
/** How the layer's blocks are named and drawn. Handed here for the reason
|
|
662
|
+
* the rules are. */
|
|
663
|
+
blockLook?: ScreenBlockLook;
|
|
664
|
+
/** The devices the layer's canvas is looked at on. Data, and handed here
|
|
665
|
+
* for the reason the rules are. */
|
|
666
|
+
devices?: ScreenDevices;
|
|
667
|
+
/** Where the left panel's view is kept, and which one a mount opens on.
|
|
668
|
+
* Plain functions, and handed here for the reason the rules are. */
|
|
669
|
+
leftView?: ScreenLeftViewRules;
|
|
670
|
+
/** Which node types are pinned in the top-level list, which are groups of
|
|
671
|
+
* sections, and which are edited in a panel of the layer's. Data and three
|
|
672
|
+
* plain functions, and handed here for the reason the rules are. */
|
|
673
|
+
pinned?: ScreenPinnedNodes;
|
|
674
|
+
/**
|
|
675
|
+
* Is the save pill also the autosave's on / off switch (0.103.0)? The screen
|
|
676
|
+
* draws the pill as a button that pauses the autosave and resumes it; a
|
|
677
|
+
* layer whose editor always saves (the campaign designer) says false, and the
|
|
678
|
+
* pill is the same words and the same dot with nothing to press. "Retry now"
|
|
679
|
+
* stays beside a failed save either way. Absent, true: the switch, as the
|
|
680
|
+
* website has it.
|
|
681
|
+
*/
|
|
682
|
+
saveSwitch?: boolean;
|
|
683
|
+
/**
|
|
684
|
+
* THE CANVAS the screen frames: the engine's, as the layer dresses it — the
|
|
685
|
+
* layer's own sheet and theme in the frame, its own say over the outline
|
|
686
|
+
* round a block. The screen places it in the pane it has measured, hands it
|
|
687
|
+
* nothing, and remounts it by key to rebuild the frame; where the frame
|
|
688
|
+
* stands, how it is fitted and what is laid over it are the screen's.
|
|
689
|
+
*
|
|
690
|
+
* ONE function for the life of a mount: the screen renders it as an element
|
|
691
|
+
* type, and a type that changed identity would remount the whole canvas.
|
|
692
|
+
*/
|
|
693
|
+
Canvas?: ComponentType;
|
|
694
|
+
/**
|
|
695
|
+
* THE INSPECTOR the screen mounts in its right panel: the panel of whatever
|
|
696
|
+
* is selected and, in its place, each panel of the layer's own — frame, head
|
|
697
|
+
* and body, since the screen draws nothing round it. The screen holds WHICH
|
|
698
|
+
* panel is showing and hands it over (`mode`), with the ways out of a panel
|
|
699
|
+
* and its own toast and Hide button; what a mode draws is the layer's.
|
|
700
|
+
*
|
|
701
|
+
* ONE function for the life of a mount: the screen renders it as an element
|
|
702
|
+
* type, and a type that changed identity would remount the panel and drop
|
|
703
|
+
* what a merchant has open in it.
|
|
704
|
+
*/
|
|
705
|
+
Inspector?: ComponentType<ScreenInspectorPanelProps>;
|
|
706
|
+
}
|
|
707
|
+
declare function ScreenPartsProvider({ parts, children }: {
|
|
708
|
+
parts: ScreenParts;
|
|
709
|
+
children?: ReactNode;
|
|
710
|
+
}): react.JSX.Element;
|
|
711
|
+
/** The layer's parts; none when the screen stands by itself. */
|
|
712
|
+
declare function useScreenParts(): ScreenParts;
|
|
713
|
+
/** The layer's bridges, run in the screen. With no layer, nothing runs. */
|
|
714
|
+
/** The name a panel's head gives what is being edited (`useOwnerName`). */
|
|
715
|
+
declare function useScreenOwnerName(): string;
|
|
716
|
+
declare function useScreenBridges(inspector: ScreenInspector, tree: ScreenTree, canvas: ScreenCanvas, left: ScreenLeftPanel): ScreenBridges;
|
|
717
|
+
/** The layer's bridges for the screen that holds one node by itself. With no
|
|
718
|
+
* layer, nothing runs. */
|
|
719
|
+
declare function useStandaloneScreenBridges(inspector: ScreenInspector): ScreenBridges;
|
|
720
|
+
/** The layer's pass over a document as it opens, run in the screen. With no
|
|
721
|
+
* layer, nothing runs. */
|
|
722
|
+
declare function useScreenDocumentPass(ops: ScreenDocumentOps, config: unknown): void;
|
|
723
|
+
/** The layer's block rules. With no layer, the rules of an editor that has no
|
|
724
|
+
* blocks of its own. */
|
|
725
|
+
declare function useScreenBlockRules(): ScreenBlockRules;
|
|
726
|
+
/** How the layer's blocks are named and drawn. With no layer, by what the
|
|
727
|
+
* config says of them and with no drawing. */
|
|
728
|
+
declare function useScreenBlockLook(): ScreenBlockLook;
|
|
729
|
+
/** The devices the layer's canvas is looked at on. With no layer, the one that
|
|
730
|
+
* fills the pane. */
|
|
731
|
+
declare function useScreenDevices(): ScreenDevices;
|
|
732
|
+
/** Where the layer keeps the left panel's view. With no layer, nowhere: every
|
|
733
|
+
* mount opens on the Layers tree. */
|
|
734
|
+
declare function useScreenLeftView(): ScreenLeftViewRules;
|
|
735
|
+
/** Which node types the layer pins in the top-level list, and which are its
|
|
736
|
+
* groups of sections. With no layer, none. */
|
|
737
|
+
declare function useScreenPinned(): ScreenPinnedNodes;
|
|
738
|
+
/** Whether the save pill is the autosave's switch. With no layer, it is, as
|
|
739
|
+
* the screen has always drawn it. */
|
|
740
|
+
declare function useScreenSaveSwitch(): boolean;
|
|
741
|
+
/** The canvas the layer dresses for the screen to frame. With no layer, the
|
|
742
|
+
* engine's plain one. */
|
|
743
|
+
declare function useScreenCanvasFrame(): ComponentType;
|
|
744
|
+
/** The inspector the layer draws for the screen to mount. With no layer, the
|
|
745
|
+
* engine's plain rows for the selection. */
|
|
746
|
+
declare function useScreenInspectorPanel(): ComponentType<ScreenInspectorPanelProps>;
|
|
747
|
+
|
|
748
|
+
export { type NodeDefaults, SELECTION_MODE, type ScreenBlockLook, type ScreenBlockRules, type ScreenBridges, type ScreenCanvas, type ScreenDevices, type ScreenDocumentOps, type ScreenInspector, type ScreenInspectorMode, type ScreenInspectorPanelProps, type ScreenLeftPanel, type ScreenLeftView, type ScreenLeftViewFrame, type ScreenLeftViewRules, type ScreenNewNode, type ScreenNode, type ScreenNodeLevel, type ScreenNodeMaker, type ScreenPartMode, type ScreenParts, ScreenPartsProvider, type ScreenPinnedNodes, type ScreenRailItem, type ScreenTree, type ScreenTreeFolds, type ScreenTreeRows, sameInspectorMode, useScreenBlockLook, useScreenBlockRules, useScreenBridges, useScreenCanvasFrame, useScreenDevices, useScreenDocumentPass, useScreenInspectorPanel, useScreenLeftView, useScreenOwnerName, useScreenParts, useScreenPinned, useScreenSaveSwitch, useStandaloneScreenBridges };
|