@eldrajs/theme-core 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +301 -0
  2. package/LICENSE +21 -0
  3. package/README.md +68 -1
  4. package/dist/bridge-DfNINXLL.js +314 -0
  5. package/dist/bridge.d.ts +2 -0
  6. package/dist/bridge.js +2 -0
  7. package/dist/design-tokens.d.ts +68 -0
  8. package/dist/design-tokens.js +486 -0
  9. package/dist/dynamic-route.d.ts +2 -0
  10. package/dist/dynamic-route.js +3 -0
  11. package/dist/dynamicRoute-CxXY-Y_8.js +126 -0
  12. package/dist/dynamicRoute-pRTBoYT6.d.ts +55 -0
  13. package/dist/i18n.d.ts +107 -0
  14. package/dist/i18n.js +192 -0
  15. package/dist/image-framing.d.ts +2 -0
  16. package/dist/image-framing.js +109 -0
  17. package/dist/imageFraming-BUZ-yqho.d.ts +51 -0
  18. package/dist/index-DxrkKyG4.d.ts +488 -0
  19. package/dist/index.d.ts +407 -0
  20. package/dist/index.js +1136 -0
  21. package/dist/layout-CWq_v6ws.d.ts +244 -0
  22. package/dist/layout.d.ts +2 -0
  23. package/dist/layout.js +930 -0
  24. package/dist/links.d.ts +113 -0
  25. package/dist/links.js +184 -0
  26. package/dist/overlay-Bgi0tIbN.d.ts +201 -0
  27. package/dist/overlay-BvkEOiMB.js +2908 -0
  28. package/dist/overlay.d.ts +2 -0
  29. package/dist/overlay.js +6 -0
  30. package/dist/preview-router.d.ts +2 -0
  31. package/dist/preview-router.js +130 -0
  32. package/dist/reusable.d.ts +66 -0
  33. package/dist/reusable.js +92 -0
  34. package/dist/reusableExpansion-Bqm83nCJ.js +229 -0
  35. package/dist/reusableExpansion-CXvs_ckx.d.ts +42 -0
  36. package/dist/stega.d.ts +17 -0
  37. package/dist/stega.js +69 -0
  38. package/dist/template-layout.d.ts +3 -0
  39. package/dist/template-layout.js +328 -0
  40. package/dist/templateLayout-MjNs0gbF.d.ts +254 -0
  41. package/package.json +89 -2
@@ -0,0 +1,113 @@
1
+ import { i as RouteTemplateLike, u as PageLike } from "./dynamicRoute-pRTBoYT6.js";
2
+ //#region src/links.d.ts
3
+ /** What a `link` field's value points at. Six are destinations; `none` is a
4
+ * heading — a row that groups the links under it and goes nowhere itself, which
5
+ * is the only shape a mega-menu or footer column heading has. */
6
+ export type LinkKind = 'product' | 'collection' | 'category' | 'entry' | 'page' | 'url' | 'none';
7
+ /** The reference encoding the platform already uses everywhere else: the exact
8
+ * pair a reference picker writes and a reference parser reads. `_type` mirrors
9
+ * the kind — an entry target carries `"entry"`. */
10
+ export interface LinkTarget {
11
+ _type: string;
12
+ id: string;
13
+ }
14
+ export interface LinkValue {
15
+ kind: LinkKind;
16
+ /** Set for every kind but `url` and `none`. */
17
+ target?: LinkTarget;
18
+ /** Set for `kind: "url"` only. */
19
+ url?: string;
20
+ /** Overrides the target's own title. */
21
+ label?: string;
22
+ openInNewTab?: boolean;
23
+ /** A column heading; meaningful on a child of a mega-menu item. */
24
+ group?: string;
25
+ /** One level deep, never two. */
26
+ children?: LinkValue[];
27
+ }
28
+ /** What a site knows about one link target, keyed by `${_type}:${id}`. The
29
+ * slug builds the path, the title fills in a label the author left empty,
30
+ * `schemaApiId` says which route template serves an entry, and `path` is the
31
+ * multi-segment destination a **catch-all** template needs (see below). */
32
+ export interface LinkTargetInfo {
33
+ slug?: string;
34
+ title?: string;
35
+ schemaApiId?: string;
36
+ /**
37
+ * The target's canonical path **inside** the route template's prefix, without
38
+ * a leading slash — `billinn/bilstolar` for a category under
39
+ * `/categories/:path*`.
40
+ *
41
+ * Only a catch-all template needs it, and only a filler that can see the
42
+ * whole tree can produce it, so it is optional: a target with no `path` under
43
+ * a catch-all pattern resolves to **no href** rather than to the single-slug
44
+ * path, which on a canonical-only route is a 404 dressed as a link.
45
+ */
46
+ path?: string;
47
+ }
48
+ export interface LinkRouteContext {
49
+ pages: readonly PageLike[];
50
+ templates: readonly RouteTemplateLike[];
51
+ /** Keyed `${_type}:${id}` — see `linkTargetKeys`. */
52
+ targets: ReadonlyMap<string, LinkTargetInfo>;
53
+ }
54
+ export interface ResolvedLink {
55
+ /** Null whenever nothing addressable was found: the target is unknown, has
56
+ * no slug, or no route template serves its kind. A theme renders the label
57
+ * as plain text then, never a dead anchor. */
58
+ href: string | null;
59
+ label: string | null;
60
+ newTab: boolean;
61
+ group: string | null;
62
+ children: ResolvedLink[];
63
+ }
64
+ /**
65
+ * An href a theme may render, or null.
66
+ *
67
+ * Allows ordinary site links — a rooted path that is not protocol-relative, an
68
+ * in-page hash, and the four schemes a storefront legitimately links out with —
69
+ * and rejects executable and opaque ones. This is the kit's single
70
+ * implementation: a theme re-exports it rather than keeping a copy that can
71
+ * drift.
72
+ *
73
+ * It is the same allowlist the platform's write side applies, rule for rule, so
74
+ * a value a theme renders is a value that can be stored and a value that is
75
+ * stored is a value that renders. In order: trimmed and non-empty; at most 2048
76
+ * bytes; no backslash anywhere (several browsers normalize `/\host` toward a
77
+ * protocol-relative URL, so a value that looks site-relative here would leave
78
+ * the site there); no control character; then an `http://`/`https://` prefix
79
+ * (case-insensitive) that parses **with a host**, a `/` path that is not `//`,
80
+ * or a `#`, `mailto:` or `tel:` that carries something after the prefix.
81
+ * Nothing else.
82
+ *
83
+ * `new URL(href).protocol` is deliberately not the scheme test: it accepts
84
+ * `https:example.com` and `http:/example.com`, neither of which addresses the
85
+ * host they appear to.
86
+ */
87
+ export declare function safeLinkHref(value: unknown): string | null;
88
+ /**
89
+ * Every target key one link value names, children included, deduplicated and in
90
+ * the order they appear. `${_type}:${id}`, so a product and a collection that
91
+ * happen to share an id stay two separate lookups.
92
+ *
93
+ * A site reads these in one batch per `_type` before rendering, which is what
94
+ * lets a prerendered page resolve every href with no client request.
95
+ */
96
+ export declare function linkTargetKeys(value: unknown): string[];
97
+ /**
98
+ * One link value resolved against the site's own routes.
99
+ *
100
+ * Null only when the value is not a link at all — a value whose target is
101
+ * missing still resolves, with `href: null`, because the label is worth
102
+ * rendering as plain text and a theme decides for itself whether to show it.
103
+ * A `kind: "none"` heading resolves the same way, deliberately: it has a label
104
+ * and children and never an href.
105
+ * That is the rule a block storing a collection reference already follows:
106
+ * there is no other key a collection page can be addressed by, so the heading
107
+ * simply is not a link until the page is published.
108
+ *
109
+ * Children resolve one level; a child's own `children` are ignored, matching
110
+ * the depth the grammar allows.
111
+ */
112
+ export declare function resolveLink(value: unknown, context: LinkRouteContext): ResolvedLink | null;
113
+ //#endregion
package/dist/links.js ADDED
@@ -0,0 +1,184 @@
1
+ import { stripStega } from "./stega.js";
2
+ import { a as parseDynamicRoutePattern, n as buildDynamicRoutePath, s as resolvePagePath } from "./dynamicRoute-CxXY-Y_8.js";
3
+ //#region src/links.ts
4
+ /** The route template `schemaApiId` that serves each catalog kind. The three
5
+ * differ by this constant and nothing else. */
6
+ const CATALOG_ROUTE_TARGETS = {
7
+ product: "catalog:product",
8
+ collection: "catalog:collection",
9
+ category: "catalog:category"
10
+ };
11
+ const LINK_KINDS = /* @__PURE__ */ new Set([
12
+ "product",
13
+ "collection",
14
+ "category",
15
+ "entry",
16
+ "page",
17
+ "url",
18
+ "none"
19
+ ]);
20
+ /** The cap is on **bytes**, not UTF-16 units, because the write side counts
21
+ * bytes: a string of 2048 units can be several times that once encoded, and a
22
+ * renderer that accepted it would render what storage refuses. */
23
+ const MAX_HREF_BYTES = 2048;
24
+ const HREF_ENCODER = new TextEncoder();
25
+ /** The whole Cc category — C0 (U+0000–U+001F), DEL, and C1 (U+0080–U+009F).
26
+ * C1 matters: several of those code points are ignored or re-interpreted
27
+ * during URL parsing, so a value carrying one is not the value it looks like. */
28
+ function isControlCodePoint(codePoint) {
29
+ return codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
30
+ }
31
+ /**
32
+ * An href a theme may render, or null.
33
+ *
34
+ * Allows ordinary site links — a rooted path that is not protocol-relative, an
35
+ * in-page hash, and the four schemes a storefront legitimately links out with —
36
+ * and rejects executable and opaque ones. This is the kit's single
37
+ * implementation: a theme re-exports it rather than keeping a copy that can
38
+ * drift.
39
+ *
40
+ * It is the same allowlist the platform's write side applies, rule for rule, so
41
+ * a value a theme renders is a value that can be stored and a value that is
42
+ * stored is a value that renders. In order: trimmed and non-empty; at most 2048
43
+ * bytes; no backslash anywhere (several browsers normalize `/\host` toward a
44
+ * protocol-relative URL, so a value that looks site-relative here would leave
45
+ * the site there); no control character; then an `http://`/`https://` prefix
46
+ * (case-insensitive) that parses **with a host**, a `/` path that is not `//`,
47
+ * or a `#`, `mailto:` or `tel:` that carries something after the prefix.
48
+ * Nothing else.
49
+ *
50
+ * `new URL(href).protocol` is deliberately not the scheme test: it accepts
51
+ * `https:example.com` and `http:/example.com`, neither of which addresses the
52
+ * host they appear to.
53
+ */
54
+ function safeLinkHref(value) {
55
+ if (typeof value !== "string") return null;
56
+ const href = stripStega(value).trim();
57
+ if (href.length === 0 || HREF_ENCODER.encode(href).length > MAX_HREF_BYTES) return null;
58
+ if (href.includes("\\")) return null;
59
+ for (const character of href) if (isControlCodePoint(character.codePointAt(0) ?? 0)) return null;
60
+ const lower = href.toLowerCase();
61
+ if (lower.startsWith("http://") || lower.startsWith("https://")) try {
62
+ return new URL(href).host === "" ? null : href;
63
+ } catch {
64
+ return null;
65
+ }
66
+ if (href.startsWith("//")) return null;
67
+ if (href.startsWith("/")) return href;
68
+ if (href.startsWith("#")) return href.length > 1 ? href : null;
69
+ if (lower.startsWith("mailto:")) return href.length > 7 ? href : null;
70
+ if (lower.startsWith("tel:")) return href.length > 4 ? href : null;
71
+ return null;
72
+ }
73
+ /**
74
+ * Every target key one link value names, children included, deduplicated and in
75
+ * the order they appear. `${_type}:${id}`, so a product and a collection that
76
+ * happen to share an id stay two separate lookups.
77
+ *
78
+ * A site reads these in one batch per `_type` before rendering, which is what
79
+ * lets a prerendered page resolve every href with no client request.
80
+ */
81
+ function linkTargetKeys(value) {
82
+ const keys = [];
83
+ collectTargetKeys(value, keys, /* @__PURE__ */ new Set(), 0);
84
+ return keys;
85
+ }
86
+ function collectTargetKeys(value, keys, seen, depth) {
87
+ const link = asLinkValue(value);
88
+ if (link === null) return;
89
+ const key = targetKey(link.target);
90
+ if (key !== null && !seen.has(key)) {
91
+ seen.add(key);
92
+ keys.push(key);
93
+ }
94
+ if (depth > 0 || !Array.isArray(link.children)) return;
95
+ for (const child of link.children) collectTargetKeys(child, keys, seen, depth + 1);
96
+ }
97
+ function targetKey(target) {
98
+ if (typeof target !== "object" || target === null || Array.isArray(target)) return null;
99
+ const record = target;
100
+ const type = plain(record._type);
101
+ const id = plain(record.id);
102
+ return type === "" || id === "" ? null : `${type}:${id}`;
103
+ }
104
+ /**
105
+ * One link value resolved against the site's own routes.
106
+ *
107
+ * Null only when the value is not a link at all — a value whose target is
108
+ * missing still resolves, with `href: null`, because the label is worth
109
+ * rendering as plain text and a theme decides for itself whether to show it.
110
+ * A `kind: "none"` heading resolves the same way, deliberately: it has a label
111
+ * and children and never an href.
112
+ * That is the rule a block storing a collection reference already follows:
113
+ * there is no other key a collection page can be addressed by, so the heading
114
+ * simply is not a link until the page is published.
115
+ *
116
+ * Children resolve one level; a child's own `children` are ignored, matching
117
+ * the depth the grammar allows.
118
+ */
119
+ function resolveLink(value, context) {
120
+ return resolveOne(value, context, 0);
121
+ }
122
+ function resolveOne(value, context, depth) {
123
+ const link = asLinkValue(value);
124
+ if (link === null) return null;
125
+ const info = targetInfo(link.target, context);
126
+ const ownLabel = typeof link.label === "string" ? link.label : "";
127
+ const targetTitle = typeof info?.title === "string" ? info.title : "";
128
+ const group = typeof link.group === "string" ? link.group : "";
129
+ return {
130
+ href: resolveHref(plain(link.kind), link, info, context),
131
+ label: plain(ownLabel) !== "" ? ownLabel : plain(targetTitle) !== "" ? targetTitle : null,
132
+ newTab: link.openInNewTab === true,
133
+ group: plain(group) === "" ? null : group,
134
+ children: depth > 0 || !Array.isArray(link.children) ? [] : link.children.map((child) => resolveOne(child, context, depth + 1)).filter((child) => child !== null)
135
+ };
136
+ }
137
+ function resolveHref(kind, link, info, context) {
138
+ if (kind === "none") return null;
139
+ if (kind === "url") return safeLinkHref(link.url);
140
+ if (kind === "page") return pagePath(link.target, context);
141
+ if (info === void 0) return null;
142
+ const schemaApiId = kind === "entry" ? plain(info.schemaApiId) : CATALOG_ROUTE_TARGETS[kind] ?? "";
143
+ if (schemaApiId === "") return null;
144
+ const pattern = routePatternFor(schemaApiId, context.templates);
145
+ if (pattern === null) return null;
146
+ const value = parseDynamicRoutePattern(pattern)?.catchAll === true ? info.path : info.slug;
147
+ return buildDynamicRoutePath(pattern, value);
148
+ }
149
+ /** The pattern of the published route template serving a schema, or null when
150
+ * the site has none — a theme that ships no category page, for instance. */
151
+ function routePatternFor(schemaApiId, templates) {
152
+ for (const template of templates) {
153
+ if (plain(template.data.schemaApiId) !== schemaApiId) continue;
154
+ const parsed = parseDynamicRoutePattern(plain(template.data.routePattern));
155
+ if (parsed !== null) return parsed.value;
156
+ }
157
+ return null;
158
+ }
159
+ function pagePath(target, context) {
160
+ const key = targetKey(target);
161
+ if (key === null) return null;
162
+ const id = key.slice(key.indexOf(":") + 1);
163
+ const page = context.pages.find((candidate) => candidate.id === id);
164
+ if (page === void 0) return null;
165
+ try {
166
+ return resolvePagePath(page, [...context.pages]);
167
+ } catch {
168
+ return null;
169
+ }
170
+ }
171
+ function targetInfo(target, context) {
172
+ const key = targetKey(target);
173
+ return key === null ? void 0 : context.targets.get(key);
174
+ }
175
+ function asLinkValue(value) {
176
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
177
+ const record = value;
178
+ return LINK_KINDS.has(plain(record.kind)) ? record : null;
179
+ }
180
+ function plain(value) {
181
+ return typeof value === "string" ? stripStega(value).trim() : "";
182
+ }
183
+ //#endregion
184
+ export { linkTargetKeys, resolveLink, safeLinkHref };
@@ -0,0 +1,201 @@
1
+ import { S as RichTextCommandName, T as StructuralDragPayload, u as BridgePayloads } from "./index-DxrkKyG4.js";
2
+ import { n as FrameRect } from "./imageFraming-BUZ-yqho.js";
3
+ import { c as LayoutBreakpoints } from "./layout-CWq_v6ws.js";
4
+ //#region src/previewRouter.d.ts
5
+ /**
6
+ * The `editor:*` messages whose whole effect is a call on the overlay
7
+ * runtime. They carry no framework state, so they belong here rather than in
8
+ * each framework binding: `@eldrajs/theme-vue` (and any future
9
+ * `theme-react`/`theme-svelte`) delegate to this router and keep only the
10
+ * messages that touch their own reactive context (`editor:init`,
11
+ * `editor:content-update`, `editor:design-tokens`, `editor:set-mode` — which
12
+ * mirrors the mode into the theme's own context before calling the overlay —
13
+ * `editor:navigate` and `editor:refresh`).
14
+ */
15
+ declare const PREVIEW_ROUTER_MESSAGE_TYPES: readonly ["editor:select-block", "editor:drag-start", "editor:drag-end", "editor:framing-mode", "editor:rich-text-editing", "editor:rich-text-applied", "editor:rich-text-locate"];
16
+ type PreviewRouterMessageType = (typeof PREVIEW_ROUTER_MESSAGE_TYPES)[number];
17
+ /** Capabilities negotiated from `editor:hello`, as flags an adapter can
18
+ * surface to its own components. `slots` is not acted on here — the
19
+ * editor-only slot markers are rendered by the framework binding — but it is
20
+ * negotiated in one place with the rest. */
21
+ interface NegotiatedEditorCapabilities {
22
+ slots: boolean;
23
+ framing: boolean;
24
+ richText: boolean;
25
+ blockHover: boolean;
26
+ }
27
+ interface PreviewMessageRouter {
28
+ /** Re-negotiate from an `editor:hello` capability list (Studio re-sends it
29
+ * on every reconnect) and forward the gates to the overlay. */
30
+ negotiate(capabilities: readonly string[]): NegotiatedEditorCapabilities;
31
+ /** Handle `type` if it is one of this router's; returns false otherwise so
32
+ * the caller can fall through to its own branches. */
33
+ route(type: string, payload: unknown): boolean;
34
+ /** The last negotiated flags. */
35
+ readonly capabilities: NegotiatedEditorCapabilities;
36
+ /** Close every gate (bridge teardown). Forwarded to the overlay, which
37
+ * exits framing and clears any rich-text editing mark. */
38
+ reset(): void;
39
+ }
40
+ /**
41
+ * @param overlay resolved lazily, because adapters create the bridge (whose
42
+ * `onMessage` routes here) before the overlay runtime it posts through.
43
+ */
44
+ declare function createPreviewMessageRouter(overlay: OverlayRuntime | (() => OverlayRuntime)): PreviewMessageRouter;
45
+ //#endregion
46
+ //#region src/overlay.d.ts
47
+ /**
48
+ * §18 v3: which rendered rich-text field something is about. The optional pair
49
+ * is what tells two renders of the same entry apart — a layout node and a
50
+ * reusable placement can both hold it, and each is its own editing surface, so
51
+ * it is part of the identity rather than decoration on it.
52
+ */
53
+ interface RichTextFieldIdentity {
54
+ entryId: string;
55
+ fieldPath: string;
56
+ locale: string | null;
57
+ layoutNodeId?: string;
58
+ reusablePlacementId?: string;
59
+ }
60
+ /** One field's deferral state, as reported to `onRichTextRenderState`. */
61
+ interface RichTextRenderStateChange extends RichTextFieldIdentity {
62
+ deferred: boolean;
63
+ }
64
+ interface BeforeInputClassification {
65
+ /**
66
+ * `native`: let the browser do it and report it afterwards. `command`:
67
+ * `preventDefault()` and hand the intent to Studio. `ignore`: neither side
68
+ * can place it, so the runtime prevents it and reports nothing — an
69
+ * unnameable edit is a visible no-op, never something the browser is left
70
+ * free to perform behind the document's back.
71
+ */
72
+ kind: 'native' | 'command' | 'ignore';
73
+ from: number;
74
+ to: number;
75
+ name?: RichTextCommandName;
76
+ }
77
+ /**
78
+ * §18 v3 (spec §4.1): decide what a `beforeinput` inside a rich-text root
79
+ * is. Exported so the Playwright stub theme and Studio's tests classify by
80
+ * the same rules the runtime does, rather than a second copy of them.
81
+ *
82
+ * `getTargetRanges()` is the authority — it is the range the browser is about
83
+ * to change, which for a backspace at the start of a paragraph already spans
84
+ * the block boundary and therefore classifies as a command without the
85
+ * runtime having to reason about intent. The current selection is only a
86
+ * fallback for engines (and jsdom) that do not implement it.
87
+ */
88
+ declare function classifyBeforeInput(event: InputEvent, root: Element): BeforeInputClassification;
89
+ interface OverlayRuntimeOptions {
90
+ /** Post a theme-to-editor bridge message. */
91
+ post: <T extends 'theme:block-clicked' | 'theme:field-clicked' | 'theme:text-edited' | 'theme:blocks-rendered' | 'theme:block-hovered' | 'theme:drop-candidate' | 'theme:node-dropped' | 'theme:framing-target' | 'theme:framing-changed' | 'theme:rich-text-selection' | 'theme:rich-text-input' | 'theme:rich-text-command'>(type: T, payload: BridgePayloads[T]) => void;
92
+ root?: ParentNode;
93
+ /**
94
+ * The theme's own layout breakpoints, so `hiddenAtBreakpoint` can say which
95
+ * of the three ranges the viewport is in — the same numbers the generated
96
+ * layout CSS wrote its `@media` blocks with, and the same ones the bridge
97
+ * advertises in `theme:ready`. Omitted, the kit defaults are used.
98
+ */
99
+ breakpoints?: LayoutBreakpoints;
100
+ }
101
+ interface OverlayRuntime {
102
+ start(): void;
103
+ stop(): void;
104
+ setMode(mode: 'preview' | 'edit'): void;
105
+ setSelected(entryId: string | null, layoutNodeId?: string, reusablePlacementId?: string): void;
106
+ acceptExternalUpdate(entryIds: readonly string[]): void;
107
+ reconcileExternalDrafts(drafts: Readonly<Record<string, Record<string, unknown>>>, entryIds: readonly string[]): void;
108
+ rescan(): void;
109
+ setDragPayload(payload: StructuralDragPayload | null): void;
110
+ /** §17: enter canvas framing for a marked image, or leave framing (null). */
111
+ setFramingMode(target: {
112
+ entryId: string;
113
+ fieldPath: string;
114
+ } | null): void;
115
+ /**
116
+ * Contract §17: "A side that does not advertise `image-framing` never
117
+ * sends, and must ignore, the messages below." Gates every framing entry
118
+ * point (click-to-enter and setFramingMode) on the editor's negotiated
119
+ * capability; defaults to false so framing stays off until onEditorHello
120
+ * turns it on. Disabling mid-session exits any live framing silently (no
121
+ * theme:framing-target / theme:framing-changed post) since a side that
122
+ * doesn't advertise the capability can't receive them either.
123
+ */
124
+ setFramingEnabled(enabled: boolean): void;
125
+ /**
126
+ * Mirroring setFramingEnabled: the `block-hover` capability negotiated
127
+ * from editor:hello gates `theme:block-hovered`.
128
+ * Defaults closed, so a theme never reports the hovered block to an editor
129
+ * that did not ask for it. Disabling mid-session forgets the reported
130
+ * hover silently — the other side cannot receive the leave post either.
131
+ * The theme's own hover outline is unaffected either way.
132
+ */
133
+ setBlockHoverEnabled(enabled: boolean): void;
134
+ /**
135
+ * §18 v3: Studio's headless rich-text editor became active (`active: true`)
136
+ * for this field, or closed. The theme marks the root with
137
+ * `data-eldra-rich-text-editing` and does nothing else: it keeps rendering
138
+ * and showing its own content, because that content *is* the editing
139
+ * surface. Nothing is hidden and nothing is laid over it.
140
+ */
141
+ setRichTextEditing(target: RichTextFieldIdentity, active: boolean): void;
142
+ /**
143
+ * §18 v3: the acknowledgement that follows an `editor:content-update` for
144
+ * the active field. When it acks a native text op the theme already
145
+ * performed and asks for no re-render, the DOM is already right and is left
146
+ * strictly alone — touching it would take the caret with it. Otherwise the
147
+ * content update has re-rendered the root and the selection is restored at
148
+ * `anchor`/`head`.
149
+ */
150
+ acceptRichTextApplied(message: RichTextFieldIdentity & {
151
+ revision: number;
152
+ anchor: number;
153
+ head: number;
154
+ rerender: boolean;
155
+ }): void;
156
+ /**
157
+ * §18 v3: is this field's re-render deferred right now? True from the
158
+ * moment the theme posts a native text op until Studio releases it (see
159
+ * `onRichTextRenderState`). A framework binding consults this before
160
+ * applying a new document: while it is true the browser owns that subtree
161
+ * and replacing it would take the caret with it.
162
+ */
163
+ isRichTextRenderDeferred(identity: RichTextFieldIdentity): boolean;
164
+ /**
165
+ * Subscribe to every change of that state — both when a field starts
166
+ * deferring and when it stops. Returns an unsubscribe. Deliberately a plain
167
+ * callback rather than anything reactive: the decision is core's, and each
168
+ * binding only has to turn the notification into whatever its framework
169
+ * counts as a change.
170
+ */
171
+ onRichTextRenderState(listener: (change: RichTextRenderStateChange) => void): () => void;
172
+ /** §18 v3: scroll a rich-text field into view, focus it and put the caret
173
+ * at the end, so Studio's sidebar "Edit on canvas" lands in the theme. */
174
+ locateRichText(target: RichTextFieldIdentity): void;
175
+ /**
176
+ * §18 v3, mirroring setFramingEnabled: the `rich-text-inline` capability
177
+ * negotiated from editor:hello. Defaults closed, so a theme never reports
178
+ * to an editor that cannot receive it. Disabling mid-session clears any
179
+ * editing mark (silently — the other side cannot receive a post either).
180
+ */
181
+ setRichTextEnabled(enabled: boolean): void;
182
+ /** Test-only accessor: the overlay's style text (the shadow root is closed). */
183
+ chromeStyles(): string;
184
+ /** Test-only accessor: hover/selected box visibility (the shadow root is closed). */
185
+ chromeState(): {
186
+ /** The hover box re-anchors on every scroll/resize (see reposition()),
187
+ * so its rect is exposed alongside display for drift assertions. */
188
+ hover: {
189
+ display: 'none' | 'block';
190
+ rect: FrameRect;
191
+ };
192
+ selected: 'none' | 'block';
193
+ framing: 'none' | 'block';
194
+ /** The framing outline's unscaled frame rect (parsed from its inline
195
+ * left/top/width/height). */
196
+ frameRect: FrameRect;
197
+ };
198
+ }
199
+ declare function createOverlayRuntime(opts: OverlayRuntimeOptions): OverlayRuntime;
200
+ //#endregion
201
+ export { RichTextRenderStateChange as a, NegotiatedEditorCapabilities as c, PreviewRouterMessageType as d, createPreviewMessageRouter as f, RichTextFieldIdentity as i, PREVIEW_ROUTER_MESSAGE_TYPES as l, OverlayRuntime as n, classifyBeforeInput as o, OverlayRuntimeOptions as r, createOverlayRuntime as s, BeforeInputClassification as t, PreviewMessageRouter as u };