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,74 @@
|
|
|
1
|
+
import { A as AutosaveSnapshot } from '../../engine-DBxp_v6B.js';
|
|
2
|
+
import { EditAccess } from '../../edit-lock/index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* lib/document-switch.ts — WHERE THE AUTOSAVE STANDS for the open
|
|
6
|
+
* document, and what a switch to another document clears.
|
|
7
|
+
*
|
|
8
|
+
* Any editor that saves by itself and holds an edit lock has both: a status
|
|
9
|
+
* read off the autosave's state, and a set of per-document facts (the pending
|
|
10
|
+
* edit, the version token, a refused save, the lock) that are true of the
|
|
11
|
+
* document being left and of no other. They were written beside the website's
|
|
12
|
+
* pinned-chrome seed, which defers on that status (lib/puck/pinned-seed-gate —
|
|
13
|
+
* the account of why the two must not drift is there, and that module still
|
|
14
|
+
* hands these on), and are here because the document provider reads them and
|
|
15
|
+
* holds no website.
|
|
16
|
+
*
|
|
17
|
+
* All of it is pure: the switch takes its setters as an argument, so a test
|
|
18
|
+
* can RUN it and read back what it drove.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** Where the editor's autosave currently stands for the OPEN document. */
|
|
22
|
+
type SaveStatus = "idle" | "saving" | "saved" | "error";
|
|
23
|
+
/**
|
|
24
|
+
* The status, read off the autosave's state. "saving" covers an edit waiting
|
|
25
|
+
* its second as well as one being written: either way the store is ahead of the
|
|
26
|
+
* server, which is what the seed must not race (#321).
|
|
27
|
+
*/
|
|
28
|
+
declare function saveStatusOf(state: AutosaveSnapshot): SaveStatus;
|
|
29
|
+
/**
|
|
30
|
+
* The save status a freshly opened document starts from, given the one the
|
|
31
|
+
* editor was carrying for the document it just left.
|
|
32
|
+
*
|
|
33
|
+
* Always "idle": the switch has already dropped that document's pending edit
|
|
34
|
+
* (the autosave's `reset`), so no status belonging to it is true of the new one
|
|
35
|
+
* — `saveStatusOf` a reset autosave is exactly this. This mirrors the version token, the save conflict and the edit lock,
|
|
36
|
+
* which the same switch resets for the same reason.
|
|
37
|
+
*/
|
|
38
|
+
declare function saveStatusForNewDocument(_previous: SaveStatus): SaveStatus;
|
|
39
|
+
/**
|
|
40
|
+
* The setters a document switch drives. Passed in rather than imported so the
|
|
41
|
+
* switch itself can be executed in a test — there is no jsdom here, so a rule
|
|
42
|
+
* that only lives inside a React callback is a rule nothing can check.
|
|
43
|
+
*/
|
|
44
|
+
type DocumentSwitchSetters = {
|
|
45
|
+
/** Drop the old document's pending edit, failure and refusal — the autosave's
|
|
46
|
+
* `reset`, plus any edit the provider held for the lock. What leaves the
|
|
47
|
+
* status "idle" and nothing unsaved. */
|
|
48
|
+
resetAutosave: () => void;
|
|
49
|
+
setVersion: (version: string | null) => void;
|
|
50
|
+
setSaveConflict: (conflict: null) => void;
|
|
51
|
+
setAccess: (access: EditAccess) => void;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Clear every piece of editor state that belonged to the document being LEFT.
|
|
55
|
+
*
|
|
56
|
+
* All of it is per-document and none of it is true of the one being opened: a
|
|
57
|
+
* stale version token would refuse every save on the new page, a stale conflict
|
|
58
|
+
* would hold the banner up over a page nobody touched, a stale edit lock would
|
|
59
|
+
* claim a document this editor has not claimed — and a stale "saving" would
|
|
60
|
+
* wedge the header seed for good (card 1092).
|
|
61
|
+
*
|
|
62
|
+
* The caller has already saved or discarded the outgoing document's edit; this
|
|
63
|
+
* drops what is left of it, kept together so the next person to add a
|
|
64
|
+
* per-document field has one obvious place to clear it.
|
|
65
|
+
*
|
|
66
|
+
* `hasEditLock` is the NEW document's, not the old one's — see
|
|
67
|
+
* `accessForNewDocument`. This used to be hardcoded to `checking`, which is the
|
|
68
|
+
* right answer for a page and a terminal one for a template: nothing claims a
|
|
69
|
+
* template, so `checking` there refused every write for the rest of the session,
|
|
70
|
+
* the Header AND Footer seed of the branch above first (card 1096).
|
|
71
|
+
*/
|
|
72
|
+
declare function resetForDocumentSwitch(hasEditLock: boolean, apply: DocumentSwitchSetters): void;
|
|
73
|
+
|
|
74
|
+
export { type DocumentSwitchSetters, type SaveStatus, resetForDocumentSwitch, saveStatusForNewDocument, saveStatusOf };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{resetForDocumentSwitch,saveStatusForNewDocument,saveStatusOf}from"../../chunk-OYX47SL7.js";import"../../chunk-JUQ6YJCG.js";import"../../chunk-RE4LP46F.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { EditLockFailure } from '../../edit-lock/index.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What a failed editor call WAS, as `{ status, data }` — the shape the shared
|
|
5
|
+
* edit-lock rules (efficient-easel/edit-lock) read, and the one place a
|
|
6
|
+
* failure from either source is put into it.
|
|
7
|
+
*
|
|
8
|
+
* A call fails in one of two voices:
|
|
9
|
+
*
|
|
10
|
+
* • the HOST'S OWN HTTP client rejects with its own error — EFFICIENT's
|
|
11
|
+
* `ApiError`: a status and the response body, as it always has. The host
|
|
12
|
+
* says how to read one (lib/backend-error `provideHostFailures`); this module
|
|
13
|
+
* imports no host's error class;
|
|
14
|
+
* • the editor's BACKEND (lib/backend-error) rejects with a
|
|
15
|
+
* `WebsiteBackendError` — a KIND, never a body (doc/adr/0002).
|
|
16
|
+
*
|
|
17
|
+
* The shared rules were written for the first, so a kind is translated here:
|
|
18
|
+
*
|
|
19
|
+
* • `changed-elsewhere` → the refused-save body (409, this page's conflict
|
|
20
|
+
* code, who saved);
|
|
21
|
+
* • `lock-taken` → the `edit-lock` body (409, the holder), with the
|
|
22
|
+
* taken-from-this-tab code a refused SAVE is recognised by. A refused CLAIM
|
|
23
|
+
* reads only the holder, so the one body answers both;
|
|
24
|
+
* • `unauthorized` → 401, which is what stops a heartbeat that can only
|
|
25
|
+
* be refused.
|
|
26
|
+
*
|
|
27
|
+
* An error a backend made out of its client's own error carries that error as
|
|
28
|
+
* its `cause` and is read from it — the original status and body, nothing
|
|
29
|
+
* reconstructed.
|
|
30
|
+
*
|
|
31
|
+
* `null` for anything that is not a server answer (a dropped socket, a
|
|
32
|
+
* programming error): every "fails open" branch of the lock leans on that.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The `code` a refused PAGE save carries in the terms the shared edit-lock
|
|
37
|
+
* rules read (`createEditLock({ conflictCode })`, lib/page-lock). A
|
|
38
|
+
* `changed-elsewhere` rejection is given it below; EFFICIENT's backend puts the
|
|
39
|
+
* same word in its 409 body and names this constant for it
|
|
40
|
+
* (lib/efficient-backend), so a raw body and a translated kind read alike.
|
|
41
|
+
*/
|
|
42
|
+
declare const PAGE_CONFLICT_CODE = "page_changed_elsewhere";
|
|
43
|
+
declare function readEaselFailure(err: unknown): EditLockFailure | null;
|
|
44
|
+
/**
|
|
45
|
+
* A call was refused because the SESSION is no longer authorised — the one
|
|
46
|
+
* failure the editor answers by asking its host for a fresh sign-in.
|
|
47
|
+
*
|
|
48
|
+
* A 401, as it always was — and ONLY a 401: the EFFICIENT backend names its 403
|
|
49
|
+
* `unauthorized` too, and a 403 has never been a reason to re-authenticate. A
|
|
50
|
+
* backend that speaks only in kinds says `unauthorized`.
|
|
51
|
+
*/
|
|
52
|
+
declare function isExpiredSession(err: unknown): boolean;
|
|
53
|
+
|
|
54
|
+
export { PAGE_CONFLICT_CODE, isExpiredSession, readEaselFailure };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PAGE_CONFLICT_CODE,isExpiredSession,readEaselFailure}from"../../chunk-HMX55DYT.js";import"../../chunk-KDYIMJTZ.js";import"../../chunk-JUQ6YJCG.js";import"../../chunk-RE4LP46F.js";
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentType, ReactNode, RefObject } from 'react';
|
|
3
|
+
import { LinkPickerPage, LinkFilters } from './links/link-filters.js';
|
|
4
|
+
import '../../LinkPicker-W2Rtxetz.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WHAT A HOST STANDS ROUND THE EDITOR — its own furniture, handed over as
|
|
8
|
+
* components (doc/adr/0004).
|
|
9
|
+
*
|
|
10
|
+
* The editor is the builder's; a host's providers, primers and panels are the
|
|
11
|
+
* host's. The storefront's are the site's currency, its pinned header and
|
|
12
|
+
* footer, its menus, its cart and checkout previews — and until this module
|
|
13
|
+
* the editor imported and mounted every one of them, so the builder loaded the
|
|
14
|
+
* shop. A host fills a SLOT instead, the way it already fills `mediaPanel`,
|
|
15
|
+
* and the editor mounts what it was handed in the place it has always mounted
|
|
16
|
+
* such things.
|
|
17
|
+
*
|
|
18
|
+
* Read once, with the backend and the registry: the slots ride on the editor's
|
|
19
|
+
* session (lib/session `chrome`) and are fixed for the life of the mount.
|
|
20
|
+
*
|
|
21
|
+
* The slots: the wrapper, the host's panels (its header's settings, and what
|
|
22
|
+
* it adds to the chrome page's), the Pages panel's rows, and what the host adds
|
|
23
|
+
* to the Link field — its products as link targets, and its product listing's
|
|
24
|
+
* filters (ADR 0004).
|
|
25
|
+
*/
|
|
26
|
+
/** Which of the two editors a host's furniture is standing in: the page editor
|
|
27
|
+
* (a website's pages, a template's) or the standalone one-section editor. */
|
|
28
|
+
type EaselSurface = "page" | "section";
|
|
29
|
+
/**
|
|
30
|
+
* What the editor hands a host's settings panel: what its own site-level panels
|
|
31
|
+
* are handed, and nothing of the editor's internals.
|
|
32
|
+
*/
|
|
33
|
+
interface HostPanelProps {
|
|
34
|
+
/** The open document has no website of its own (a template): draw the
|
|
35
|
+
* panel's placeholder state. */
|
|
36
|
+
placeholderMode: boolean;
|
|
37
|
+
/** The console's token, where a token is how the host's calls are authorised. */
|
|
38
|
+
tokenRef: RefObject<string | null>;
|
|
39
|
+
/** The website being edited, or null (a template, the one-section editor). */
|
|
40
|
+
siteId: string | null;
|
|
41
|
+
websiteName: string | null;
|
|
42
|
+
/** Open the editor's own Appearance panel. */
|
|
43
|
+
onOpenWebsiteSettings?: () => void;
|
|
44
|
+
/** Tell the editor's host that its sign-in was refused. */
|
|
45
|
+
onAuthExpired: () => void;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A surface the host serves that is NOT a page of the website — the
|
|
49
|
+
* storefront's cart, its checkout — offered as a row of the Pages panel.
|
|
50
|
+
* Pressing the row frames the surface in the canvas (the host's own preview
|
|
51
|
+
* reads which one off `PreviewSurfaceContext`); the row's link opens it live.
|
|
52
|
+
*/
|
|
53
|
+
interface HostPageRow {
|
|
54
|
+
/** The surface's name to the host; what the canvas preview is told. */
|
|
55
|
+
key: string;
|
|
56
|
+
label: string;
|
|
57
|
+
/** Where the live surface is, for the row's "open in a new tab". */
|
|
58
|
+
href: string;
|
|
59
|
+
icon: ReactNode;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* One of the host's products, as the editor names it in the two places it
|
|
63
|
+
* holds only a product's handle: the Link field's "Product" targets, and a
|
|
64
|
+
* tree row whose block carries just the handle.
|
|
65
|
+
*/
|
|
66
|
+
interface HostProduct {
|
|
67
|
+
/** The product's handle, as a block stores it. */
|
|
68
|
+
slug: string;
|
|
69
|
+
name: string;
|
|
70
|
+
/** Where the product lives on the website — what a link to it is. */
|
|
71
|
+
href: string;
|
|
72
|
+
}
|
|
73
|
+
/** What the editor hands the host's row under a Link field
|
|
74
|
+
* (`linkRow`, deprecated). */
|
|
75
|
+
interface HostLinkRowProps {
|
|
76
|
+
/** The link as it stands. */
|
|
77
|
+
value: string;
|
|
78
|
+
onChange: (url: string) => void;
|
|
79
|
+
/** The website's pages with their layouts, as the Link field listed them —
|
|
80
|
+
* so the host can tell what the linked page holds. */
|
|
81
|
+
pages: readonly {
|
|
82
|
+
slug: string;
|
|
83
|
+
layout?: unknown;
|
|
84
|
+
}[];
|
|
85
|
+
}
|
|
86
|
+
interface EaselChrome {
|
|
87
|
+
/**
|
|
88
|
+
* One component mounted round the canvas and the panels, inside the editor's
|
|
89
|
+
* document context — so it reads the website being edited and the
|
|
90
|
+
* capabilities like anything else in the editor (`useScreenDocument`) —
|
|
91
|
+
* and inside the editor's appearance and footer bridges, which a host's
|
|
92
|
+
* primer may write into. It must render its `children`.
|
|
93
|
+
*
|
|
94
|
+
* It is told which editor it stands in (`surface`): the one-section editor
|
|
95
|
+
* has no website's page open, and a host stands less round it.
|
|
96
|
+
*
|
|
97
|
+
* ONE component, not one per provider: the order among a host's providers is
|
|
98
|
+
* the host's to keep, and the editor holds no list of them.
|
|
99
|
+
*/
|
|
100
|
+
wrap?: ComponentType<{
|
|
101
|
+
surface: EaselSurface;
|
|
102
|
+
children: ReactNode;
|
|
103
|
+
}>;
|
|
104
|
+
/**
|
|
105
|
+
* Settings panels of the host's own, drawn in the editor's inspector — inside
|
|
106
|
+
* the editor's panel frame, under the editor's own head — where the editor
|
|
107
|
+
* has always drawn them. One so far:
|
|
108
|
+
*
|
|
109
|
+
* header the settings of the host's pinned header, opened by selecting
|
|
110
|
+
* the header in the canvas or its row in the tree. Without it the
|
|
111
|
+
* inspector has no such panel.
|
|
112
|
+
*
|
|
113
|
+
* …and one the host adds to a panel of the editor's:
|
|
114
|
+
*
|
|
115
|
+
* chromePage drawn under the page settings of the page that STORES the
|
|
116
|
+
* site's chrome (its footer page), on a document with a website
|
|
117
|
+
* behind it. The storefront's is "Switch to Box header", which
|
|
118
|
+
* builds the header group there from the shop's header row. It
|
|
119
|
+
* takes no props: it reads the open document like any other part
|
|
120
|
+
* of the editor (`useScreenDocument`, `useEasel`).
|
|
121
|
+
*/
|
|
122
|
+
panels?: {
|
|
123
|
+
header?: ComponentType<HostPanelProps>;
|
|
124
|
+
chromePage?: ComponentType;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* A group of the host's own rows in the Pages panel, under the host's own
|
|
128
|
+
* heading (the storefront: "Shop" — Cart, Checkout). Drawn by the editor,
|
|
129
|
+
* with its own row and group, between the website's pages and its system
|
|
130
|
+
* pages, and only for a document with a website behind it.
|
|
131
|
+
*/
|
|
132
|
+
pageRows?: {
|
|
133
|
+
title: string;
|
|
134
|
+
rows: readonly HostPageRow[];
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* The host's products, for the website being edited. Asked for once per
|
|
138
|
+
* mount of whatever names them; best effort — it must resolve (to an empty
|
|
139
|
+
* list when the host's read failed). Without it the Link field's "Product"
|
|
140
|
+
* kind has nothing to pick and a product's tree row reads its handle.
|
|
141
|
+
*/
|
|
142
|
+
products?: {
|
|
143
|
+
list(): Promise<readonly HostProduct[]>;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* The host's product listing, for the Link field's Filter and Value boxes
|
|
147
|
+
* ([MERGE] One Link Picker For Both Editors, 2026-10-08). Asked per mount of
|
|
148
|
+
* a Link field and per site, where the host's commerce blocks are offered, so
|
|
149
|
+
* the host caches; best effort — it should resolve (to null when the host's
|
|
150
|
+
* read failed, which draws no Filter; a rejection is read the same). It
|
|
151
|
+
* resolves to a function of the pages the Link field listed, so the host
|
|
152
|
+
* reads which of them hold its listing off their documents
|
|
153
|
+
* (lib/links/link-filters `LinkFilters`).
|
|
154
|
+
*
|
|
155
|
+
* Without it the field offers no Filter and a page link is a plain page.
|
|
156
|
+
* With it, `linkRow` is not drawn: the Filter is what that row was.
|
|
157
|
+
*/
|
|
158
|
+
linkFilters?: {
|
|
159
|
+
load(siteId: string | null): Promise<((pages: readonly LinkPickerPage[]) => LinkFilters) | null>;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* @deprecated Replaced by `linkFilters`, and IGNORED when a host hands both.
|
|
163
|
+
* Still drawn for a host that hands only this; removing it is a change to the
|
|
164
|
+
* builder's host contract and waits for its owner's word.
|
|
165
|
+
*
|
|
166
|
+
* A row of the host's own under a Link field whose link is a PAGE link, where
|
|
167
|
+
* the host's commerce blocks are offered. The host decides whether it applies
|
|
168
|
+
* to this link and renders nothing when it does not. The storefront's was
|
|
169
|
+
* "which product type the listing opens on", shown when the linked page holds
|
|
170
|
+
* its listing.
|
|
171
|
+
*/
|
|
172
|
+
linkRow?: ComponentType<HostLinkRowProps>;
|
|
173
|
+
}
|
|
174
|
+
/** The host's wrapper round `children`, or `children` bare when it handed none. */
|
|
175
|
+
declare function ChromeWrap({ wrap: Wrap, surface, children, }: {
|
|
176
|
+
wrap: EaselChrome["wrap"] | undefined;
|
|
177
|
+
surface: EaselSurface;
|
|
178
|
+
children: ReactNode;
|
|
179
|
+
}): react.JSX.Element;
|
|
180
|
+
|
|
181
|
+
export { ChromeWrap, type EaselChrome, type EaselSurface, type HostLinkRowProps, type HostPageRow, type HostPanelProps, type HostProduct };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r,Fragment as e}from"react/jsx-runtime";function c({wrap:c,surface:n,children:i}){return c?/* @__PURE__ */r(c,{surface:n,children:i}):/* @__PURE__ */r(e,{children:i})}export{c as ChromeWrap};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host messages EVERY editor surface answers the same way: the replies to a
|
|
3
|
+
* request the editor made (a media pick). The website's own broadcasts — a
|
|
4
|
+
* category, a menu or a form changed elsewhere — are lib/website-host-inbound's,
|
|
5
|
+
* and the website hands them to the screen's mount (`onHostMessage`), so this
|
|
6
|
+
* module, which moves into efficient-easel with the screen, names none of them
|
|
7
|
+
* (doc/adr/0004). Returns true when the message was one of
|
|
8
|
+
* them, so the surface goes on to handle its own kinds (a retarget) only when it
|
|
9
|
+
* was not.
|
|
10
|
+
*
|
|
11
|
+
* One router rather than one per surface: the standalone section editor used to
|
|
12
|
+
* route only its retarget, so a media pick or a new form started there never
|
|
13
|
+
* settled — the picker waited on a reply that arrived and was dropped.
|
|
14
|
+
*
|
|
15
|
+
* Fields are read defensively: over the iframe transport this is a postMessage
|
|
16
|
+
* payload, i.e. untrusted data.
|
|
17
|
+
*/
|
|
18
|
+
declare function routeSharedHostMessage(raw: unknown): boolean;
|
|
19
|
+
|
|
20
|
+
export { routeSharedHostMessage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{routeSharedHostMessage}from"../../chunk-7MU3RJ6S.js";import"../../chunk-6FY3PZS3.js";import"../../chunk-ZZ7VLIHQ.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
export { D as DETACHED_EASEL_HOST, E as EaselHost, b as EaselHostAddress, c as EaselHostContext, d as EaselHostProvider, e as EaselMessageType, f as EaselToHostMessage, H as HostPickedMedia, g as HostToEaselMessage, I as InboundHostMessage, S as SectionScreenTarget, h as SendToHost, i as createEaselHost, u as useEaselHost } from '../../host-DJ8Gzsx7.js';
|
|
3
|
+
import '../../blocks/index.js';
|
|
4
|
+
import '../../types-E3HrTPg2.js';
|
|
5
|
+
import '../../data/index.js';
|
|
6
|
+
import '../../types-41704JE4.js';
|
|
7
|
+
import '../../resolve-D68pb3Bx.js';
|
|
8
|
+
import '../../plan-DChbUXdS.js';
|
|
9
|
+
import './document-contract.js';
|
|
10
|
+
import './session.js';
|
|
11
|
+
import './host-chrome.js';
|
|
12
|
+
import './links/link-filters.js';
|
|
13
|
+
import '../../LinkPicker-W2Rtxetz.js';
|
|
14
|
+
import './document-hooks.js';
|
|
15
|
+
import './section-template-types.js';
|
|
16
|
+
import './puck/content-tree.js';
|
|
17
|
+
import './document-switch.js';
|
|
18
|
+
import '../../engine-DBxp_v6B.js';
|
|
19
|
+
import '../../edit-lock/index.js';
|
|
20
|
+
import './admin-bridge.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{DETACHED_EASEL_HOST,EaselHostContext,EaselHostProvider,createEaselHost,useEaselHost}from"../../chunk-R5ZVNJLJ.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Where the editor listens for its page-wide shortcuts — undo / redo, copy and
|
|
5
|
+
* paste a style, Escape out of Add.
|
|
6
|
+
*
|
|
7
|
+
* On the shop's own `/edit` routes the editor IS the page (`host.ownsDocument`),
|
|
8
|
+
* so they listen on `document`, as they always have. Mounted inside another
|
|
9
|
+
* app — the admin portal's native editor window — `document` is the app's: a
|
|
10
|
+
* ⌘Z typed into a product form in another window would rewind the website, and
|
|
11
|
+
* the paste would land in a document the merchant is not looking at. There the
|
|
12
|
+
* editor's own root is the target, so a key reaches it only while focus is
|
|
13
|
+
* inside the editor. (The canvas frame is its own document and binds its own.)
|
|
14
|
+
*/
|
|
15
|
+
declare function useEaselKeyTarget(rootRef: RefObject<HTMLElement | null>): EventTarget | null;
|
|
16
|
+
/**
|
|
17
|
+
* Undo / redo on the editor's own root when the editor does not own the page —
|
|
18
|
+
* the engine's `EaselProvider` binds them to `document`, and is told not to
|
|
19
|
+
* (`hotkeys={host.ownsDocument}` in ScreenStoreProvider) in exactly this case.
|
|
20
|
+
*/
|
|
21
|
+
declare function useEaselUndoKeys(rootRef: RefObject<HTMLElement | null>): void;
|
|
22
|
+
|
|
23
|
+
export { useEaselKeyTarget, useEaselUndoKeys };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{useEaselKeyTarget,useEaselUndoKeys}from"../../chunk-OM67AJQC.js";import"../../chunk-R5ZVNJLJ.js";import"../../chunk-P67FP7PG.js";import"../../chunk-AELNNAFM.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-D2BCHTQR.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-ZNCEOSXO.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { L as LinkOption, a as LinkFilterField, b as LinkFilter } from '../../../LinkPicker-W2Rtxetz.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* WHAT A HOST HANDS THE LINK FIELD of its own: the pages a link may point at,
|
|
6
|
+
* as the field lists them, and the host's product listing as the picker needs
|
|
7
|
+
* it (lib/host-chrome `linkFilters`). Types only.
|
|
8
|
+
*
|
|
9
|
+
* They are the host contract's, which is the screen's and moves into
|
|
10
|
+
* efficient-easel with it (doc/adr/0004), so they are not declared beside the
|
|
11
|
+
* builder's own half of the picker (lib/links/link-picker-setup, which hands
|
|
12
|
+
* them on): that module builds a website's kinds out of its pages, posts and
|
|
13
|
+
* products, and the screen imports none of it.
|
|
14
|
+
*/
|
|
15
|
+
/** One page a link may point at. `docs` = the published document, then the
|
|
16
|
+
* draft: anchors (and a host's listing) are read off them in that order. */
|
|
17
|
+
type LinkPickerPage = {
|
|
18
|
+
slug: string;
|
|
19
|
+
title: string;
|
|
20
|
+
docs: readonly unknown[];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A host's product listing, as the picker needs it: which page paths open a
|
|
24
|
+
* listing, the filters a link onto one may carry, and how a filter is read off
|
|
25
|
+
* and written onto a link. The storefront's are built from its catalogue and
|
|
26
|
+
* its Product Types answers (lib/links/link-rules `storefrontLinkFilters`).
|
|
27
|
+
*/
|
|
28
|
+
type LinkFilters = {
|
|
29
|
+
/** Every path that opens a listing — a page holding one, or a built-in route. */
|
|
30
|
+
listingPaths: readonly string[];
|
|
31
|
+
/** The Page list as the host wants it shown: a listing page's own name, a
|
|
32
|
+
* built-in listing route added. Handed the builder's list; returns the list. */
|
|
33
|
+
pageOptions?: (options: readonly LinkOption[]) => LinkOption[];
|
|
34
|
+
/** The filters a link onto this listing path may carry, or null. */
|
|
35
|
+
filtersFor: (target: string) => readonly LinkFilterField[] | null;
|
|
36
|
+
readFilter: (url: string) => LinkFilter;
|
|
37
|
+
/** Write (or, with null, clear) the filter on a link. */
|
|
38
|
+
withFilter: (url: string, filter: LinkFilter) => string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type { LinkFilters, LinkPickerPage };
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Say what stopped the editor loading a document, in words an operator can
|
|
2
|
+
* hand to a developer.
|
|
3
|
+
*
|
|
4
|
+
* The status code is the part that matters: it is what tells a refused token
|
|
5
|
+
* (401) apart from a deleted page (404), a broken backend (5xx) and a backend
|
|
6
|
+
* that never answered at all — four different jobs for four different people.
|
|
7
|
+
* Always carry the number, even inside the friendlier sentences, because the
|
|
8
|
+
* screenshot an operator sends is usually all anyone gets.
|
|
9
|
+
*
|
|
10
|
+
* This exists because it did NOT (11131). The editor screen said "Could not
|
|
11
|
+
* load the document." for every one of those causes alike, so the storefront
|
|
12
|
+
* editor could be down on every site — on a 401, from a portal-audience
|
|
13
|
+
* mismatch — and the one thing anybody could report was the one thing that
|
|
14
|
+
* narrowed nothing down. It lives in its own module, apart from the React
|
|
15
|
+
* provider that shows it, so the wording is pinned by a test rather than
|
|
16
|
+
* re-derived by whoever next reads the catch block. */
|
|
17
|
+
declare function describeLoadFailure(e: unknown): string;
|
|
18
|
+
/**
|
|
19
|
+
* The host's own sentence for a load it REFUSED, or null when this failure is
|
|
20
|
+
* not one of those. EFFICIENT has one: a slug that more than one website owns,
|
|
21
|
+
* opened without saying which — refusing to guess between websites is a correct
|
|
22
|
+
* outcome, not a crash, and it is said whole rather than behind "Could not load
|
|
23
|
+
* the document". The host says so (lib/backend-error `provideHostFailures`).
|
|
24
|
+
*/
|
|
25
|
+
declare function hostLoadRefusal(e: unknown, document: {
|
|
26
|
+
slug: string;
|
|
27
|
+
}): string | null;
|
|
28
|
+
|
|
29
|
+
export { describeLoadFailure, hostLoadRefusal };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{describeLoadFailure,hostLoadRefusal}from"../../chunk-A7ZJII7O.js";import"../../chunk-KDYIMJTZ.js";
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentType, ReactNode } from 'react';
|
|
3
|
+
import { H as HostPickedMedia } from '../../host-DJ8Gzsx7.js';
|
|
4
|
+
import '../../blocks/index.js';
|
|
5
|
+
import '../../types-E3HrTPg2.js';
|
|
6
|
+
import '../../data/index.js';
|
|
7
|
+
import '../../types-41704JE4.js';
|
|
8
|
+
import '../../resolve-D68pb3Bx.js';
|
|
9
|
+
import '../../plan-DChbUXdS.js';
|
|
10
|
+
import './document-contract.js';
|
|
11
|
+
import './session.js';
|
|
12
|
+
import './host-chrome.js';
|
|
13
|
+
import './links/link-filters.js';
|
|
14
|
+
import '../../LinkPicker-W2Rtxetz.js';
|
|
15
|
+
import './document-hooks.js';
|
|
16
|
+
import './section-template-types.js';
|
|
17
|
+
import './puck/content-tree.js';
|
|
18
|
+
import './document-switch.js';
|
|
19
|
+
import '../../engine-DBxp_v6B.js';
|
|
20
|
+
import '../../edit-lock/index.js';
|
|
21
|
+
import './admin-bridge.js';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The editor's MEDIA PANEL — the host's media library, drawn in the editor's own
|
|
25
|
+
* left panel beside Pages, Layers and Site styles.
|
|
26
|
+
*
|
|
27
|
+
* The editor owns no media library and never will: the library is the host's
|
|
28
|
+
* (the admin portal's Media Library, one component wherever it is shown). What
|
|
29
|
+
* the editor owns is the PLACE it shows — a left-panel view its rail opens — and
|
|
30
|
+
* the request that turns that view into a chooser for one field.
|
|
31
|
+
*
|
|
32
|
+
* It replaces a window. The rail button and every image field used to ask the
|
|
33
|
+
* host to open a separate "Media library" picker window over the editor
|
|
34
|
+
* (`storefront-editor:open-media-picker`), which floated beside the host's own
|
|
35
|
+
* Media Library window under the same name, built from different code, and could
|
|
36
|
+
* be sent behind the editor while the field that asked waited on it (harness
|
|
37
|
+
* UI-20, UI-21). A host that supplies a panel gets this instead; a host that
|
|
38
|
+
* does not keeps the message, so nothing it relies on changes underneath it.
|
|
39
|
+
*
|
|
40
|
+
* • BROWSING — the rail opens the "media" left view. The host's panel shows
|
|
41
|
+
* the library to look through, upload to, tidy. `pick` is null.
|
|
42
|
+
* • PICKING — a field calls `requestMediaPick` (lib/media-picker). With
|
|
43
|
+
* a panel here, that becomes {@link requestPanelPick}: the chrome lays the
|
|
44
|
+
* panel over the left panel in pick mode, the host's panel calls `onPick`,
|
|
45
|
+
* and the field gets the media. Leaving pick mode any other way (the
|
|
46
|
+
* panel's Cancel, a rail button, closing the panel) settles it `null`.
|
|
47
|
+
*
|
|
48
|
+
* Module state for the same reason as lib/media-picker: the fields that
|
|
49
|
+
* ask are Puck custom fields, which no prop reaches.
|
|
50
|
+
*/
|
|
51
|
+
/** What a field asked the panel for. `file` is a file dropped straight on the
|
|
52
|
+
* field: the host uploads it and picks it without waiting for a click. */
|
|
53
|
+
interface MediaPickRequest {
|
|
54
|
+
requestId: string;
|
|
55
|
+
/** `image/*`, `video/*` or `image/svg+xml` — what the field can hold. */
|
|
56
|
+
accept: string;
|
|
57
|
+
/** The field's label, e.g. "Background image". */
|
|
58
|
+
title: string;
|
|
59
|
+
file?: File | null;
|
|
60
|
+
}
|
|
61
|
+
/** The props the host's panel component is drawn with. */
|
|
62
|
+
interface MediaPanelProps {
|
|
63
|
+
/** The field choosing right now, or null while the merchant is browsing. */
|
|
64
|
+
pick: MediaPickRequest | null;
|
|
65
|
+
/** Answer the field. Ignored while browsing. */
|
|
66
|
+
onPick: (media: HostPickedMedia) => void;
|
|
67
|
+
}
|
|
68
|
+
/** The host's media library, as a component the editor draws in its panel. */
|
|
69
|
+
type MediaPanelComponent = ComponentType<MediaPanelProps>;
|
|
70
|
+
/** Supply the host's panel to the editor below. `panel` null keeps the old
|
|
71
|
+
* window: fields ask the host with `open-media-picker`. */
|
|
72
|
+
declare function MediaPanelProvider({ panel, children }: {
|
|
73
|
+
panel: MediaPanelComponent | null;
|
|
74
|
+
children: ReactNode;
|
|
75
|
+
}): react.JSX.Element;
|
|
76
|
+
/** The host's panel for the editor this renders in, or null. */
|
|
77
|
+
declare function useMediaPanel(): MediaPanelComponent | null;
|
|
78
|
+
/** Whether a field's request goes to the panel rather than to the host. */
|
|
79
|
+
declare function hasMediaPanel(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Open the panel in pick mode for one field; resolves with the media chosen, or
|
|
82
|
+
* null. A second field asking before the first is answered takes the panel over,
|
|
83
|
+
* and the first resolves null — one panel answers one field.
|
|
84
|
+
*/
|
|
85
|
+
declare function requestPanelPick(request: MediaPickRequest): Promise<HostPickedMedia | null>;
|
|
86
|
+
/** Answer the field the panel is choosing for (`media` null: no choice). A
|
|
87
|
+
* stale id — an answer for a request already superseded — does nothing. */
|
|
88
|
+
declare function settlePanelPick(requestId: string, media: HostPickedMedia | null): void;
|
|
89
|
+
/** Leave pick mode without a choice, whatever is being chosen. */
|
|
90
|
+
declare function cancelPanelPick(): void;
|
|
91
|
+
/** The field the panel is choosing for, or null while nothing is. */
|
|
92
|
+
declare function usePanelPick(): MediaPickRequest | null;
|
|
93
|
+
|
|
94
|
+
export { type MediaPanelComponent, type MediaPanelProps, MediaPanelProvider, type MediaPickRequest, cancelPanelPick, hasMediaPanel, requestPanelPick, settlePanelPick, useMediaPanel, usePanelPick };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MediaPanelProvider,cancelPanelPick,hasMediaPanel,requestPanelPick,settlePanelPick,useMediaPanel,usePanelPick}from"../../chunk-ZZ7VLIHQ.js";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { E as EaselHost } from '../../host-DJ8Gzsx7.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '../../blocks/index.js';
|
|
4
|
+
import '../../types-E3HrTPg2.js';
|
|
5
|
+
import '../../data/index.js';
|
|
6
|
+
import '../../types-41704JE4.js';
|
|
7
|
+
import '../../resolve-D68pb3Bx.js';
|
|
8
|
+
import '../../plan-DChbUXdS.js';
|
|
9
|
+
import './document-contract.js';
|
|
10
|
+
import './session.js';
|
|
11
|
+
import './host-chrome.js';
|
|
12
|
+
import './links/link-filters.js';
|
|
13
|
+
import '../../LinkPicker-W2Rtxetz.js';
|
|
14
|
+
import './document-hooks.js';
|
|
15
|
+
import './section-template-types.js';
|
|
16
|
+
import './puck/content-tree.js';
|
|
17
|
+
import './document-switch.js';
|
|
18
|
+
import '../../engine-DBxp_v6B.js';
|
|
19
|
+
import '../../edit-lock/index.js';
|
|
20
|
+
import './admin-bridge.js';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Editor media-picker bridge — the one call every media slot makes to choose an
|
|
24
|
+
* image or a video, resolving with the chosen media.
|
|
25
|
+
*
|
|
26
|
+
* Where the choosing happens depends on the host:
|
|
27
|
+
*
|
|
28
|
+
* • A host that supplies a MEDIA PANEL (lib/media-panel — the admin
|
|
29
|
+
* portal, from efficient-web 0.2.0) answers in the editor's own left panel:
|
|
30
|
+
* the request opens that panel in pick mode, and nothing leaves the editor.
|
|
31
|
+
* • Any other host is asked to open its picker window, over the
|
|
32
|
+
* request/response protocol below. The picker UI lives in the host, so
|
|
33
|
+
* this module owns the EDITOR half:
|
|
34
|
+
*
|
|
35
|
+
* requestMediaPick({ accept, title, file? })
|
|
36
|
+
* → posts `storefront-editor:open-media-picker` { requestId, accept, title, file }
|
|
37
|
+
* to the host (lib/host — over postMessage when framed).
|
|
38
|
+
* The admin (PageBlockEditor) relays the window's result back down:
|
|
39
|
+
* `storefront-editor:media-picked` { requestId, media:{id,url,kind} } → resolve(media)
|
|
40
|
+
* `storefront-editor:media-pick-cancelled`{ requestId } → resolve(null)
|
|
41
|
+
* resolveMediaPick(requestId, …) is called by the central message listener
|
|
42
|
+
* (ScreenDocumentContext) to settle the pending promise, correlated by id.
|
|
43
|
+
*
|
|
44
|
+
* Same module-singleton reason as lib/editor-auth / lib/editor-events: Puck
|
|
45
|
+
* custom fields (the media slots) can't receive the listener as a prop.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
interface PickedMedia {
|
|
49
|
+
id: string;
|
|
50
|
+
url: string;
|
|
51
|
+
kind: "image" | "video";
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Choose media for a slot; resolves with the chosen media, or null if the user
|
|
55
|
+
* cancelled (or there's no host to ask). `file` is a file dropped straight on
|
|
56
|
+
* the slot — the host uploads it and picks it immediately.
|
|
57
|
+
*/
|
|
58
|
+
declare function requestMediaPick(host: EaselHost, opts: {
|
|
59
|
+
accept: string;
|
|
60
|
+
title: string;
|
|
61
|
+
file?: File | null;
|
|
62
|
+
}): Promise<PickedMedia | null>;
|
|
63
|
+
/** Settle a pending pick (called by the central message listener on the admin's
|
|
64
|
+
* reply). Unknown ids — a stale reply, or a pick meant for another editor
|
|
65
|
+
* iframe — no-op. */
|
|
66
|
+
declare function resolveMediaPick(requestId: string, media: PickedMedia | null): void;
|
|
67
|
+
|
|
68
|
+
export { type PickedMedia, requestMediaPick, resolveMediaPick };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{requestMediaPick,resolveMediaPick}from"../../chunk-6FY3PZS3.js";import"../../chunk-ZZ7VLIHQ.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{pageEditLock}from"../../chunk-AKZWUV5Z.js";import"../../chunk-HMX55DYT.js";import"../../chunk-KDYIMJTZ.js";import"../../chunk-JUQ6YJCG.js";import"../../chunk-RE4LP46F.js";
|