@eldrajs/theme-core 0.3.6 → 0.4.1

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/CHANGELOG.md CHANGED
@@ -5,8 +5,55 @@ Release-please writes the generated notes from commit messages and does not repl
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ - A price in a rich-text field edited on the canvas is a chip (`contenteditable=false`, styled like a plain-text field's) rather than editable page text. A click on it, once the field has focus, posts `theme:price-clicked` with the `price` node's `pos` and an empty `token` (WS-1474).
9
+ - `isBlockFieldLocalized` follows a data path into a `list` row (`items.0.answer`), as `isBlockFieldSelect` already did, so `EldraRichText` with `api-id` reports a list row's localized rich text with its locale. Before, it reported `locale: null`, Studio refused it, and typing on the canvas did nothing (WS-1474).
10
+ - **Priced text edited on the canvas (WS-1474).** New capability `price-tokens-inline`, new messages `theme:price-clicked` and `editor:insert-price`. A field whose stega carries `StegaMeta.parts` (its stored text, each price token with its label) is editable in place once both sides advertise it: focusing it shows each price as a non-editable chip (amber when missing), every edit is posted as stored text with its tokens intact, a chip click posts `theme:price-clicked` (the first click on a written-out price only focuses the field), and `editor:insert-price` inserts a price at the caret. The renderer's writes are held while the field is being edited; a price's new amounts update its chip in place. `OverlayRuntime` gains `setPriceTokensEnabled` and `insertPriceToken`; `StegaPricePart` is exported.
11
+ - The preview overlay no longer copies a draft's raw text over a field marked `inline: false` on `editor:content-update`: a field whose price tokens the theme wrote out showed the raw `⟦price#…⟧` in the builder after every edit (WS-1474).
12
+ - **Price tokens (WS-1474).** `buildRichTextTree` takes `resolvePrice`: a `price` node renders its written price as a leaf (one position, like a hard break), and a paragraph holding one that cannot be written stays in the tree, `hidden`, so the builder's positions still count it. `StegaMeta.inline: false` marks a field whose page text is not its stored text: the overlay keeps it selectable (`theme:field-clicked`) but never makes it editable in place.
13
+ - **`resolveLink` resolves cards (WS-1326).** A child or section link whose `display` is `card` (its
14
+ own, else its section's) carries `card: { image, title, price? }`: the image is the link's own
15
+ `imageUrl`, else the target's (`LinkTargetInfo.image`: a product's thumbnail, a collection's
16
+ image), `price` a product's `LinkTargetInfo.price`. A card with no picture or title resolves as a
17
+ plain link (`display: 'link'`, no `card`); heading, see-all and top-level links carry neither
18
+ `display` nor `card`. `card.price` is in major units, no currency. New type `ResolvedCard`.
19
+
20
+ - **`resolveLink` resolves `sections` (WS-1321).** A link a theme that declares `tree.sections` is
21
+ served carries `sections: ResolvedSection[]` (`heading`, `headingLink`, `links`, `seeAll`, `display`),
22
+ each link resolved like a child (a section with only a heading link takes its label as the heading); `children` is `[]` then. `linkTargetKeys` walks a link's sections,
23
+ their heading links and see-all links, so their targets are read with the rest. A card's `display`
24
+ and `imageUrl` are carried through on `ResolvedLink`. New types `ResolvedSection` and
25
+ `LinkSectionValue`.
26
+
8
27
  - **`defaultCurrencyOf(commerce)` (WS-1399).** The currency pages are built in: `defaultCurrency` (contract 6.22.0), else the first of a `currencies` list without the store's own currency, else `currency`. `resolveVisitorCurrency` and `offeredCurrencies` take that default as `base`.
9
28
  - **Currencies (WS-1391).** `SELLING_CURRENCIES`, `currencyForCountry(country)` (one table, country code to selling currency), `countryFromHeader(value)`, `VISITOR_COUNTRY_PATH`, `resolveVisitorCurrency({ base, offered, remembered, country })` (the remembered choice, then the visitor's country, then the store's own currency, each only when offered) and `offeredCurrencies(base, listed)`.
29
+ - **`expandReusableLayout(layout, projection, { routeTemplate? })` (WS-1358).** A layout with
30
+ reusable placements in the shape Core's public read serves it: each placement replaced by its
31
+ component, the root taking the placement id and every node inside it the `r` + SHA-256 render id,
32
+ no projection left. Throws what the render would refuse. A draft preview session renders this.
33
+ - **`getSiteSetting(path)` reads one of the site's own settings (WS-1394)**:
34
+ `/site/v1/design-tokens` or `/site/v1/theme-messages`, parsed JSON. Outside a session an ordinary
35
+ gateway read; in a draft preview session (`enableSessionPreview`) through the router's proxy like
36
+ the CMS reads, but a setting is not a draft: no `Eldra-Preview: draft` is asked for, the answer is
37
+ not reshaped, and a failure is thrown to the caller only, never reported to `onRequestError`'s
38
+ listeners. Optional on `EldraClient`, so a hand-written client still satisfies it.
39
+
40
+ - **A draft preview session's answers arrive in the public read's shape (WS-1358).** The
41
+ session client (`enableSessionPreview`) reshapes every CMS answer with the new `asPublicRead`:
42
+ wherever a `reusableComponentProjection` appears (the answer, a list item, a resolved reference
43
+ at any depth), the placements are expanded the way Core's public read expands them, `blocks` put
44
+ in layout order and a node naming a block that does not resolve dropped, and every entry's
45
+ `status` (which the public read does not carry) is dropped. New exports:
46
+ `asPublicRead(value)` and `expandReusableLayout(layout, projection, { routeTemplate? })` (the
47
+ expansion alone, throwing what the render would refuse). A client outside a session is unchanged.
48
+
49
+ - **`enableSessionPreview({ proxyBase })` (WS-1303).** For a draft preview session on the preview
50
+ router's host: the CMS reads go same-origin to `proxyBase` (the router's `/__eldra/gateway`) with
51
+ `cache: 'no-store'`, `credentials: 'same-origin'` and no credential header, and a CMS answer without
52
+ `Eldra-Preview: draft` is refused (502, `PREVIEW_UPSTREAM_NOT_PREVIEW`). Catalog reads are
53
+ unchanged, and no request carries `X-Preview-Token` once it is on. `EldraClientError` gains
54
+ `errorId` (read from a session read's refusal) and `sessionPreview`. A client that never calls it
55
+ behaves exactly as before.
56
+
10
57
  - **`getTypeScriptDefinitions({ sdkAugmentation })` (WS-434, contract 6.1.0).** `true` sends
11
58
  `sdkAugmentation=true`, asking the gateway to append the `declare module '@eldrajs/sdk'` block that
12
59
  fills `EldraProductExtensions`, so product extensions are typed. Off by default: without it the
@@ -54,16 +101,16 @@ Release-please writes the generated notes from commit messages and does not repl
54
101
  `catalog:product` and another theme's `starter:hero` pass through) and
55
102
  `themeSchemaApiId(blockApiId, themeId)` (the reverse, idempotent), plus `THEME_ID_PATTERN`,
56
103
  `RESERVED_THEME_IDS`, `registerThemeId`/`getRegisteredThemeId`. **Breaking:** `registerBlockFields(fields,
57
- themeId)` now requires the theme's own id and registers it, so `isBlockFieldLocalized`,
104
+ themeId)` now requires the theme's own id and registers it, so `isBlockFieldLocalized`,
58
105
  `isBlockFieldSelect` (and the select unwrap and stega skip that use it) and a template block's
59
106
  entry/placement match resolve a block entry whose `schemaApiId` is `<themeId>:<apiId>`. Bare ids
60
107
  keep working. The bridge's `theme:ready` reports `manifestVersion: 2`.
61
108
 
62
109
  - New subpath, `@eldrajs/theme-core/i18n`, framework-free: `flattenMessages`/`unflattenMessages`
63
110
  (nested vue-i18n JSON ↔ the manifest's own flat dotted keys), `mergeMessageCatalogues(themeDefaults,
64
- platform)` (the platform's theme-message overrides win per key; a locale the theme never shipped
111
+ platform)` (the platform's theme-message overrides win per key; a locale the theme never shipped
65
112
  is added whole), and `resolveMessageCatalogue(themeDefaults, platform, orgLocales,
66
- orgDefaultLocale)`, implementing the contract's five-tier per-key fallback to the letter — tier 5
113
+ orgDefaultLocale)`, implementing the contract's five-tier per-key fallback to the letter — tier 5
67
114
  (`theme(themeDefault)`) always reads the theme's own unmerged default-locale text, never an
68
115
  override of it, which is why `themeDefaults` and `platform` are taken separately rather than only
69
116
  a pre-merged catalogue — so a build with **no** gateway still produces a full key set for every
@@ -79,7 +126,7 @@ Release-please writes the generated notes from commit messages and does not repl
79
126
 
80
127
  - **A `link` field's untranslated sub-fields fall back to the default locale's node, field by
81
128
  field.** A `link` field's value is a per-locale record (`{ "en-US": {kind,label,group,children…},
82
- "is-IS": {…} }`), and `createEldraClient` used to take the active locale's node whole (exact
129
+ "is-IS": {…} }`), and `createEldraClient` used to take the active locale's node whole (exact
83
130
  locale, then language, then the first key) — a column heading set only on the English node
84
131
  rendered as no heading at all on every other locale. `createEldraClient` now takes
85
132
  `defaultLocale?: string | null` (the organisation's default content locale); when set and the
@@ -117,7 +164,7 @@ Release-please writes the generated notes from commit messages and does not repl
117
164
  - **A route template's trailing parameter may be a catch-all: `/categories/:path*`.** It must be the
118
165
  last segment, it matches **one or more** segments, and the parameter's value is the remainder
119
166
  joined with `/` and no leading slash (`/categories/billinn/bilstolar` → `path:
120
- "billinn/bilstolar"`). `parseDynamicRoutePattern` reports it as `catchAll: true` and keeps the star
167
+ "billinn/bilstolar"`). `parseDynamicRoutePattern` reports it as `catchAll: true` and keeps the star
121
168
  out of `paramName`, so a template's own `slugField` is still compared against `path`;
122
169
  `matchDynamicRoutePattern`/`resolveRoute` match it, and `buildDynamicRoutePath` encodes each
123
170
  segment of such a value while keeping the separators (and refuses an empty one — a leading,
@@ -161,7 +208,7 @@ Release-please writes the generated notes from commit messages and does not repl
161
208
  - Inline canvas editing no longer depends on when the overlay's own `input` handler runs relative
162
209
  to the MutationObserver that sees the keystroke land, nor on how long the editor's round trip
163
210
  takes. `restoreEditingFocus` answers every characterData mutation in the document, so it can run
164
- *before* `onInput` — a single `input` listener anywhere on the page registered ahead of the
211
+ _before_ `onInput` — a single `input` listener anywhere on the page registered ahead of the
165
212
  overlay's own puts a microtask checkpoint between the two, and a checkpoint is where queued
166
213
  observer records are delivered. It used to re-place the caret from the remembered offset on every
167
214
  such pass, which put the caret back in front of the character just typed and, because the next
@@ -239,7 +286,7 @@ Release-please writes the generated notes from commit messages and does not repl
239
286
  - Feat: a new theme → editor bridge message, `theme:block-hovered`, reports the block the pointer
240
287
  is over — `{ entryId, rect, layoutNodeId?, reusablePlacementId? }`, or `null` once it leaves — so
241
288
  the editor can anchor an affordance (an "add block" control on the block's bottom edge) to the
242
- same geometry the theme already outlines. It is posted when the hovered *block* changes, not on
289
+ same geometry the theme already outlines. It is posted when the hovered _block_ changes, not on
243
290
  every pointer move inside it, and re-posted whenever the theme's geometry may have moved, so a
244
291
  re-post can repeat the rect it last sent. Edit mode only, and gated on the new `block-hover`
245
292
  capability: an editor that does not advertise it receives nothing. The theme's own hover outline
@@ -32,6 +32,7 @@ const KNOWN_MESSAGE_TYPES = /* @__PURE__ */ new Set([
32
32
  "editor:design-tokens",
33
33
  "editor:theme-messages",
34
34
  "editor:select-block",
35
+ "editor:insert-price",
35
36
  "editor:navigate",
36
37
  "editor:set-mode",
37
38
  "editor:set-viewport",
@@ -49,6 +50,7 @@ const KNOWN_MESSAGE_TYPES = /* @__PURE__ */ new Set([
49
50
  "theme:block-clicked",
50
51
  "theme:field-clicked",
51
52
  "theme:text-edited",
53
+ "theme:price-clicked",
52
54
  "theme:blocks-rendered",
53
55
  "theme:block-hovered",
54
56
  "theme:slots-rendered",
@@ -74,7 +76,8 @@ const EDITOR_CAPABILITIES = [
74
76
  "block-slots",
75
77
  "block-hover",
76
78
  "image-framing",
77
- "rich-text-inline"
79
+ "rich-text-inline",
80
+ "price-tokens-inline"
78
81
  ];
79
82
  /** Capabilities the theme advertises in theme:ready. `block-slots` gates the
80
83
  * editor-only slot markers and their theme:slots-rendered geometry reports.
@@ -83,13 +86,16 @@ const EDITOR_CAPABILITIES = [
83
86
  * §18 v3 messages that let the operator edit rich text natively in the
84
87
  * theme's own rendered DOM while Studio owns the document, the editor and
85
88
  * the toolbar; a side that does not advertise it never sends, and must
86
- * ignore, those messages. */
89
+ * ignore, those messages. `price-tokens-inline` gates editing a plain-text field that holds price
90
+ * tokens on the canvas: the field shows each price as a chip, `theme:price-clicked` and
91
+ * `editor:insert-price`. Without it such a field stays selectable but not editable in place. */
87
92
  const THEME_CAPABILITIES = [
88
93
  "design-tokens",
89
94
  "block-slots",
90
95
  "block-hover",
91
96
  "image-framing",
92
- "rich-text-inline"
97
+ "rich-text-inline",
98
+ "price-tokens-inline"
93
99
  ];
94
100
  // src/bridge/envelope.ts
95
101
  function makeEnvelope(type, payload) {
package/dist/bridge.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { C as RichTextDoc, D as ThemeRichTextCommandMessage, E as THEME_CAPABILITIES, O as ThemeRichTextInputMessage, S as RichTextCommandName, T as StructuralDragPayload, _ as EditorRichTextLocateMessage, a as BRIDGE_PROTOCOL, b as ResolvedDesignTokensPayload, c as BridgeHandler, d as DOMRectLike, f as DraftEntryPayload, g as EditorRichTextEditingMessage, h as EditorRichTextAppliedMessage, i as parseEnvelope, k as ThemeRichTextSelectionMessage, l as BridgeMessageType, m as EditorMode, n as createEditorBridge, o as BRIDGE_VERSION, p as EDITOR_CAPABILITIES, r as makeEnvelope, s as BridgeEnvelope, t as createThemeBridge, u as BridgePayloads, v as KNOWN_MESSAGE_TYPES, w as RichTextIdentity, x as ResolvedThemeMessagesPayload, y as RICH_TEXT_COMMAND_NAMES } from "./index-C3tgQ-hG.js";
1
+ import { C as RichTextDoc, D as ThemeRichTextCommandMessage, E as THEME_CAPABILITIES, O as ThemeRichTextInputMessage, S as RichTextCommandName, T as StructuralDragPayload, _ as EditorRichTextLocateMessage, a as BRIDGE_PROTOCOL, b as ResolvedDesignTokensPayload, c as BridgeHandler, d as DOMRectLike, f as DraftEntryPayload, g as EditorRichTextEditingMessage, h as EditorRichTextAppliedMessage, i as parseEnvelope, k as ThemeRichTextSelectionMessage, l as BridgeMessageType, m as EditorMode, n as createEditorBridge, o as BRIDGE_VERSION, p as EDITOR_CAPABILITIES, r as makeEnvelope, s as BridgeEnvelope, t as createThemeBridge, u as BridgePayloads, v as KNOWN_MESSAGE_TYPES, w as RichTextIdentity, x as ResolvedThemeMessagesPayload, y as RICH_TEXT_COMMAND_NAMES } from "./index-C_Kx7Vq9.js";
2
2
  export { BRIDGE_PROTOCOL, BRIDGE_VERSION, type BridgeEnvelope, type BridgeHandler, type BridgeMessageType, type BridgePayloads, type DOMRectLike, type DraftEntryPayload, EDITOR_CAPABILITIES, type EditorMode, type EditorRichTextAppliedMessage, type EditorRichTextEditingMessage, type EditorRichTextLocateMessage, KNOWN_MESSAGE_TYPES, RICH_TEXT_COMMAND_NAMES, type ResolvedDesignTokensPayload, type ResolvedThemeMessagesPayload, type RichTextCommandName, type RichTextDoc, type RichTextIdentity, type StructuralDragPayload, THEME_CAPABILITIES, type ThemeRichTextCommandMessage, type ThemeRichTextInputMessage, type ThemeRichTextSelectionMessage, createEditorBridge, createThemeBridge, makeEnvelope, parseEnvelope };
package/dist/bridge.js CHANGED
@@ -1 +1 @@
1
- export { a as BRIDGE_PROTOCOL, o as BRIDGE_VERSION, s as EDITOR_CAPABILITIES, c as KNOWN_MESSAGE_TYPES, l as RICH_TEXT_COMMAND_NAMES, u as THEME_CAPABILITIES, n as createEditorBridge, t as createThemeBridge, r as makeEnvelope, i as parseEnvelope } from "./bridge-DSH4N82G.js";
1
+ export { a as BRIDGE_PROTOCOL, o as BRIDGE_VERSION, s as EDITOR_CAPABILITIES, c as KNOWN_MESSAGE_TYPES, l as RICH_TEXT_COMMAND_NAMES, u as THEME_CAPABILITIES, n as createEditorBridge, t as createThemeBridge, r as makeEnvelope, i as parseEnvelope } from "./bridge-CCF1LxsP.js";
@@ -216,6 +216,20 @@ interface BridgePayloads {
216
216
  layoutNodeId?: string;
217
217
  reusablePlacementId?: string;
218
218
  };
219
+ /**
220
+ * `price-tokens-inline`: put a price token into a plain-text field at the operator's caret on
221
+ * the canvas (at the end when the field is not being edited there), as a chip reading `label`.
222
+ * The theme answers with `theme:text-edited` carrying the field's new stored text.
223
+ */
224
+ 'editor:insert-price': {
225
+ entryId: string;
226
+ fieldPath: string;
227
+ locale: string | null;
228
+ token: string;
229
+ label: string;
230
+ layoutNodeId?: string;
231
+ reusablePlacementId?: string;
232
+ };
219
233
  'editor:navigate': {
220
234
  path: string;
221
235
  };
@@ -307,6 +321,23 @@ interface BridgePayloads {
307
321
  layoutNodeId?: string;
308
322
  reusablePlacementId?: string;
309
323
  };
324
+ /**
325
+ * `price-tokens-inline`: the operator clicked a price chip in a field being edited on the
326
+ * canvas. `token` is the token's stored text (`⟦price#a3f EUR=10000⟧`, `⟦store
327
+ * freeShippingThreshold⟧`); Studio opens its price editor for it and writes the field's draft.
328
+ * In a rich-text field `token` is empty and `pos` is the `price` node's document position, which
329
+ * Studio reads from its own editor.
330
+ */
331
+ 'theme:price-clicked': {
332
+ entryId: string;
333
+ fieldPath: string;
334
+ locale: string | null;
335
+ token: string;
336
+ pos?: number;
337
+ rect: DOMRectLike;
338
+ layoutNodeId?: string;
339
+ reusablePlacementId?: string;
340
+ };
310
341
  'theme:blocks-rendered': {
311
342
  blocks: Array<{
312
343
  entryId: string;
@@ -439,7 +470,7 @@ declare const KNOWN_MESSAGE_TYPES: ReadonlySet<string>;
439
470
  * Capabilities advertised in editor:hello. Single source of truth is contracts §8b.1/§8b.13:
440
471
  * the list below, matched verbatim by Studio's vendored app/types/bridge.ts.
441
472
  */
442
- declare const EDITOR_CAPABILITIES: readonly ["content-update", "select-block", "inline-text", "block-slots", "block-hover", "image-framing", "rich-text-inline"];
473
+ declare const EDITOR_CAPABILITIES: readonly ["content-update", "select-block", "inline-text", "block-slots", "block-hover", "image-framing", "rich-text-inline", "price-tokens-inline"];
443
474
  /** Capabilities the theme advertises in theme:ready. `block-slots` gates the
444
475
  * editor-only slot markers and their theme:slots-rendered geometry reports.
445
476
  * `block-hover` gates theme:block-hovered, the hovered block's identity and
@@ -447,8 +478,10 @@ declare const EDITOR_CAPABILITIES: readonly ["content-update", "select-block", "
447
478
  * §18 v3 messages that let the operator edit rich text natively in the
448
479
  * theme's own rendered DOM while Studio owns the document, the editor and
449
480
  * the toolbar; a side that does not advertise it never sends, and must
450
- * ignore, those messages. */
451
- declare const THEME_CAPABILITIES: readonly ["design-tokens", "block-slots", "block-hover", "image-framing", "rich-text-inline"];
481
+ * ignore, those messages. `price-tokens-inline` gates editing a plain-text field that holds price
482
+ * tokens on the canvas: the field shows each price as a chip, `theme:price-clicked` and
483
+ * `editor:insert-price`. Without it such a field stays selectable but not editable in place. */
484
+ declare const THEME_CAPABILITIES: readonly ["design-tokens", "block-slots", "block-hover", "image-framing", "rich-text-inline", "price-tokens-inline"];
452
485
  declare function makeEnvelope<T extends BridgeMessageType>(type: T, payload: BridgePayloads[T]): BridgeEnvelope<T>;
453
486
  /** Returns null for anything that must be ignored; logs per contracts §1.4. */
454
487
  declare function parseEnvelope(data: unknown): BridgeEnvelope | null;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { StegaMeta, decodeStega, encodeStega, stripStega } from "./stega.js";
2
- import { C as ResolveEntryListBody, S as PageMeta, _ as EldraClientOptions, a as TemplateLayoutDocument, b as EntryList, c as TemplateLayoutRenderNode, d as CatalogDoc, f as CatalogList, g as EldraClientError, h as EldraClient, i as TemplateLayoutContext, l as buildTemplateBlockRenames, m as EldraCatalogReader, n as TemplateBlockFieldDefinition, o as TemplateLayoutNode, p as CatalogQuery, r as TemplateBlockNode, s as TemplateLayoutRenderModel, t as TemplateBlockDefinition, u as createTemplateLayoutRenderModel, v as EldraRetryOptions, x as EntryQuery, y as EntryDoc } from "./templateLayout-Dp3KYV2b.js";
1
+ import { StegaMeta, StegaPricePart, decodeStega, encodeStega, stripStega } from "./stega.js";
2
+ import { C as EntryQuery, S as EntryList, T as ResolveEntryListBody, _ as EldraClientOptions, a as TemplateLayoutDocument, b as EldraSiteReadPath, c as TemplateLayoutRenderNode, d as CatalogDoc, f as CatalogList, g as EldraClientError, h as EldraClient, i as TemplateLayoutContext, l as buildTemplateBlockRenames, m as EldraCatalogReader, n as TemplateBlockFieldDefinition, o as TemplateLayoutNode, p as CatalogQuery, r as TemplateBlockNode, s as TemplateLayoutRenderModel, t as TemplateBlockDefinition, u as createTemplateLayoutRenderModel, v as EldraRetryOptions, w as PageMeta, x as EntryDoc, y as EldraSessionPreviewOptions } from "./templateLayout-BWNs1ZYt.js";
3
3
  import { a as buildDynamicRoutePath, c as parseDynamicRoutePattern, d as resolvePagePath, i as RouteTemplateLike, l as resolveRoute, n as MAX_DYNAMIC_ROUTE_PATTERN_BYTES, o as catalogRouteTarget, r as ParsedDynamicRoutePattern, s as matchDynamicRoutePattern, t as DynamicRouteResolution, u as PageLike } from "./dynamicRoute-DzSNn4tV.js";
4
- import { a as RichTextRenderStateChange, c as NegotiatedEditorCapabilities, d as PreviewRouterMessageType, f as createPreviewMessageRouter, i as RichTextFieldIdentity, l as PREVIEW_ROUTER_MESSAGE_TYPES, n as OverlayRuntime, o as classifyBeforeInput, r as OverlayRuntimeOptions, s as createOverlayRuntime, t as BeforeInputClassification, u as PreviewMessageRouter } from "./overlay-mKeZLljc.js";
4
+ import { a as RichTextRenderStateChange, c as NegotiatedEditorCapabilities, d as PreviewRouterMessageType, f as createPreviewMessageRouter, i as RichTextFieldIdentity, l as PREVIEW_ROUTER_MESSAGE_TYPES, n as OverlayRuntime, o as classifyBeforeInput, r as OverlayRuntimeOptions, s as createOverlayRuntime, t as BeforeInputClassification, u as PreviewMessageRouter } from "./overlay-D7gS7OY1.js";
5
5
  import { A as generateLayoutCss, C as Responsive, D as WidthLength, E as Spacing, F as resolveLayoutBreakpoints, I as resolveLayoutDocument, L as validateLayoutDocument, M as layoutNodeClass, N as layoutRenderNodeId, O as activeLayoutBreakpoint, P as normalizeLayoutDocument, S as ResolvedLayoutStyle, T as SlotValidationContext, _ as LayoutValidationError, a as LAYOUT_BREAKPOINTS, b as ResolvedLayoutDocument, c as LayoutBreakpoints, d as LayoutNode, f as LayoutRenderBlockNode, g as LayoutValidationCode, h as LayoutStyle, i as EDIT_MODE_HIDDEN_OPACITY, j as hiddenLayoutBreakpoints, k as createLayoutRenderModel, l as LayoutContainerNode, m as LayoutRenderNode, n as CssLength, o as LayoutBlockNode, p as LayoutRenderModel, r as DEFAULT_LAYOUT_BREAKPOINTS, s as LayoutBreakpoint, t as BlockSlotDefinition, u as LayoutDocument, v as LayoutValidationIssue, w as SizingLength, x as ResolvedLayoutNode, y as NormalizedLayoutResult } from "./layout-CkPOfiOM.js";
6
- import { PageLayoutDocument, PageLayoutNode, ReusableComponentSnapshotCache, ReusableLayoutOptions, ReusableLayoutRenderModel, ReusableLayoutRenderNode, ReusablePerspective, createReusableLayoutRenderModel } from "./reusable.js";
6
+ import { PageLayoutDocument, PageLayoutNode, ReusableComponentSnapshotCache, ReusableLayoutOptions, ReusableLayoutRenderModel, ReusableLayoutRenderNode, ReusablePerspective, asPublicRead, createReusableLayoutRenderModel, expandReusableLayout } from "./reusable.js";
7
7
  import { ColorLiteral, ColorSelection, ContainerOverride, ContainerPreset, CssTokenLength, DesignTokenCatalog, DesignTokenId, DesignTokenValidationCode, DesignTokenValidationError, ResponsiveTokenValue, SiteDesignTokenOverrides, ThemeColorToken, ThemeDesignTokens, applyDesignTokenOverrides, designTokenRevisionHash, generateDesignTokenCss, generateTailwindThemeCss, normalizeColorSelection, normalizeSiteDesignTokenOverrides, normalizeThemeDesignTokens, resolveColorSelection, resolveDesignTokenCatalog, responsiveValue } from "./design-tokens.js";
8
8
  import { a as ReusableComponentRevision, i as ReusableComponentResolver, n as ReusableComponentPlacement, o as ReusableRenderIdentity, r as ReusableComponentProjection, s as createProjectionResolver, t as ReusableComponentBinding } from "./reusableExpansion-CqrqpK4A.js";
9
9
  import { a as ImageFraming, c as focalBand, d as imageFramingAttrs, f as imageFramingStyle, h as unscaledFrameRect, i as IMAGE_FRAMING_MIN_ZOOM, l as framingDrag, m as parseImageFramingValueAttr, n as FrameRect, o as clampFocal, p as normalizeImageFraming, r as IMAGE_FRAMING_MAX_ZOOM, s as clampImageFraming, t as DEFAULT_IMAGE_FRAMING, u as framingZoom } from "./imageFraming-BgKBJiTB.js";
@@ -219,6 +219,18 @@ interface BuildRichTextTreeOptions {
219
219
  * an `<h0>`/`<h7>` whatever a caller passes.
220
220
  */
221
221
  minHeadingLevel?: number;
222
+ /**
223
+ * Writes a `price` node (a price token in rich text, WS-1474) in the shopper's currency, or
224
+ * answers `null` when it cannot be: no amount in that currency, an unknown store setting,
225
+ * malformed attributes. The theme supplies it (`@eldrajs/sdk/tokens`' `resolvePriceNode`, bound to
226
+ * its currency, regional locale and formatter); without one no price resolves.
227
+ *
228
+ * A paragraph or heading holding a price that does not resolve is rendered `hidden` rather than
229
+ * left out, so it still occupies its positions and native editing maps exactly as before: a
230
+ * missing amount reads as a shorter text, never as a sentence with a hole in it, and never as
231
+ * another currency's amount.
232
+ */
233
+ resolvePrice?: (attrs: unknown) => string | null;
222
234
  }
223
235
  /**
224
236
  * Build a TipTap JSON document's content as a render tree. Non-doc input
@@ -247,7 +259,7 @@ export declare function buildRichTextTree(doc: unknown, options: BuildRichTextTr
247
259
  * it **closes** (+1) after them;
248
260
  * - a text node occupies `text.length` — UTF-16 code units, which is what
249
261
  * ProseMirror counts, so an astral-plane character (an emoji) is 2;
250
- * - a leaf node (`image`, `hardBreak`, `horizontalRule`, `embed`) occupies 1.
262
+ * - a leaf node (`image`, `hardBreak`, `horizontalRule`, `embed`, `price`) occupies 1.
251
263
  *
252
264
  * `packages/theme-core/test/fixtures/rich-text-positions.fixture.json` pins
253
265
  * the numbering for a set of documents and is copied byte-for-byte into
@@ -432,7 +444,8 @@ type BlockFieldsMap = Record<string, BlockFieldDefinition[]>;
432
444
  */
433
445
  export declare function registerBlockFields(fields: BlockFieldsMap, themeId: string): void;
434
446
  /**
435
- * Whether the manifest marks this block field `localized`. A rich-text
447
+ * Whether the manifest marks this block field `localized`: a top-level field id, or a data path
448
+ * into a `list`'s item (`items.0.answer`, see `resolveBlockField`). A rich-text
436
449
  * renderer uses it to default an omitted `locale` to the preview's active
437
450
  * content locale — a localized field's draft is keyed per locale, so the
438
451
  * marking attributes (and therefore every §18 v3 rich-text report) must carry
@@ -860,4 +873,4 @@ export declare function offeredCurrencies(base: string, listed: readonly unknown
860
873
  export declare const VISITOR_COUNTRY_PATH = "/_eldra/visitor";
861
874
  /** A two-letter country from `CF-IPCountry`, or `null` for none, unknown (`XX`) or Tor (`T1`). */
862
875
  export declare function countryFromHeader(value: string | null | undefined): string | null;
863
- export { type BeforeInputClassification, type BlockFieldDefinition, type BlockFieldsMap, BlockSlotDefinition, type BuildRichTextTreeOptions, CatalogDoc, CatalogList, CatalogQuery, ColorLiteral, ColorSelection, ContainerOverride, ContainerPreset, CssLength, CssTokenLength, DEFAULT_IMAGE_FRAMING, DEFAULT_LAYOUT_BREAKPOINTS, DesignTokenCatalog, DesignTokenId, DesignTokenValidationCode, DesignTokenValidationError, DynamicRouteResolution, EDIT_MODE_HIDDEN_OPACITY, EldraCatalogReader, EldraClient, EldraClientError, EldraClientOptions, EldraRetryOptions, EntryDoc, EntryList, EntryQuery, FrameRect, IMAGE_FRAMING_MAX_ZOOM, IMAGE_FRAMING_MIN_ZOOM, ImageFraming, LAYOUT_BREAKPOINTS, LayoutBlockNode, LayoutBreakpoint, LayoutBreakpoints, LayoutContainerNode, LayoutDocument, LayoutNode, LayoutRenderBlockNode, LayoutRenderModel, LayoutRenderNode, LayoutStyle, LayoutValidationCode, LayoutValidationError, LayoutValidationIssue, MAX_DYNAMIC_ROUTE_PATTERN_BYTES, type NegotiatedEditorCapabilities, NormalizedLayoutResult, type OverlayRuntime, type OverlayRuntimeOptions, PREVIEW_ROUTER_MESSAGE_TYPES, PageLayoutDocument, PageLayoutNode, type PageLike, PageMeta, ParsedDynamicRoutePattern, type PreviewMessageRouter, type PreviewRouterMessageType, ResolveEntryListBody, ResolvedLayoutDocument, ResolvedLayoutNode, ResolvedLayoutStyle, Responsive, ResponsiveTokenValue, type ReusableComponentBinding, type ReusableComponentPlacement, type ReusableComponentProjection, type ReusableComponentResolver, type ReusableComponentRevision, ReusableComponentSnapshotCache, ReusableLayoutOptions, ReusableLayoutRenderModel, ReusableLayoutRenderNode, ReusablePerspective, type ReusableRenderIdentity, type RichTextDomPoint, type RichTextFieldIdentity, type RichTextMark, type RichTextNode, type RichTextPositionNode, type RichTextPositions, type RichTextRenderChild, type RichTextRenderNode, type RichTextRenderStateChange, type RichTextSelectionContext, type RichTextToolbarControl, RouteTemplateLike, SiteDesignTokenOverrides, SizingLength, SlotValidationContext, Spacing, type StegaMeta, TemplateBlockDefinition, TemplateBlockFieldDefinition, TemplateBlockNode, TemplateLayoutContext, TemplateLayoutDocument, TemplateLayoutNode, TemplateLayoutRenderModel, TemplateLayoutRenderNode, ThemeColorToken, ThemeDesignTokens, WidthLength, activeLayoutBreakpoint, applyDesignTokenOverrides, buildDynamicRoutePath, buildTemplateBlockRenames, catalogRouteTarget, clampFocal, clampImageFraming, classifyBeforeInput, createLayoutRenderModel, createOverlayRuntime, createPreviewMessageRouter, createProjectionResolver, createReusableLayoutRenderModel, createTemplateLayoutRenderModel, decodeStega, designTokenRevisionHash, encodeStega, focalBand, framingDrag, framingZoom, generateDesignTokenCss, generateLayoutCss, generateTailwindThemeCss, hiddenLayoutBreakpoints, imageFramingAttrs, imageFramingStyle, layoutNodeClass, layoutRenderNodeId, matchDynamicRoutePattern, normalizeColorSelection, normalizeImageFraming, normalizeLayoutDocument, normalizeSiteDesignTokenOverrides, normalizeThemeDesignTokens, parseDynamicRoutePattern, parseImageFramingValueAttr, resolveColorSelection, resolveDesignTokenCatalog, resolveLayoutBreakpoints, resolveLayoutDocument, resolvePagePath, resolveRoute, responsiveValue, stripStega, unscaledFrameRect, validateLayoutDocument };
876
+ export { type BeforeInputClassification, type BlockFieldDefinition, type BlockFieldsMap, BlockSlotDefinition, type BuildRichTextTreeOptions, CatalogDoc, CatalogList, CatalogQuery, ColorLiteral, ColorSelection, ContainerOverride, ContainerPreset, CssLength, CssTokenLength, DEFAULT_IMAGE_FRAMING, DEFAULT_LAYOUT_BREAKPOINTS, DesignTokenCatalog, DesignTokenId, DesignTokenValidationCode, DesignTokenValidationError, DynamicRouteResolution, EDIT_MODE_HIDDEN_OPACITY, EldraCatalogReader, EldraClient, EldraClientError, EldraClientOptions, EldraRetryOptions, EldraSessionPreviewOptions, EldraSiteReadPath, EntryDoc, EntryList, EntryQuery, FrameRect, IMAGE_FRAMING_MAX_ZOOM, IMAGE_FRAMING_MIN_ZOOM, ImageFraming, LAYOUT_BREAKPOINTS, LayoutBlockNode, LayoutBreakpoint, LayoutBreakpoints, LayoutContainerNode, LayoutDocument, LayoutNode, LayoutRenderBlockNode, LayoutRenderModel, LayoutRenderNode, LayoutStyle, LayoutValidationCode, LayoutValidationError, LayoutValidationIssue, MAX_DYNAMIC_ROUTE_PATTERN_BYTES, type NegotiatedEditorCapabilities, NormalizedLayoutResult, type OverlayRuntime, type OverlayRuntimeOptions, PREVIEW_ROUTER_MESSAGE_TYPES, PageLayoutDocument, PageLayoutNode, type PageLike, PageMeta, ParsedDynamicRoutePattern, type PreviewMessageRouter, type PreviewRouterMessageType, ResolveEntryListBody, ResolvedLayoutDocument, ResolvedLayoutNode, ResolvedLayoutStyle, Responsive, ResponsiveTokenValue, type ReusableComponentBinding, type ReusableComponentPlacement, type ReusableComponentProjection, type ReusableComponentResolver, type ReusableComponentRevision, ReusableComponentSnapshotCache, ReusableLayoutOptions, ReusableLayoutRenderModel, ReusableLayoutRenderNode, ReusablePerspective, type ReusableRenderIdentity, type RichTextDomPoint, type RichTextFieldIdentity, type RichTextMark, type RichTextNode, type RichTextPositionNode, type RichTextPositions, type RichTextRenderChild, type RichTextRenderNode, type RichTextRenderStateChange, type RichTextSelectionContext, type RichTextToolbarControl, RouteTemplateLike, SiteDesignTokenOverrides, SizingLength, SlotValidationContext, Spacing, type StegaMeta, type StegaPricePart, TemplateBlockDefinition, TemplateBlockFieldDefinition, TemplateBlockNode, TemplateLayoutContext, TemplateLayoutDocument, TemplateLayoutNode, TemplateLayoutRenderModel, TemplateLayoutRenderNode, ThemeColorToken, ThemeDesignTokens, WidthLength, activeLayoutBreakpoint, applyDesignTokenOverrides, asPublicRead, buildDynamicRoutePath, buildTemplateBlockRenames, catalogRouteTarget, clampFocal, clampImageFraming, classifyBeforeInput, createLayoutRenderModel, createOverlayRuntime, createPreviewMessageRouter, createProjectionResolver, createReusableLayoutRenderModel, createTemplateLayoutRenderModel, decodeStega, designTokenRevisionHash, encodeStega, expandReusableLayout, focalBand, framingDrag, framingZoom, generateDesignTokenCss, generateLayoutCss, generateTailwindThemeCss, hiddenLayoutBreakpoints, imageFramingAttrs, imageFramingStyle, layoutNodeClass, layoutRenderNodeId, matchDynamicRoutePattern, normalizeColorSelection, normalizeImageFraming, normalizeLayoutDocument, normalizeSiteDesignTokenOverrides, normalizeThemeDesignTokens, parseDynamicRoutePattern, parseImageFramingValueAttr, resolveColorSelection, resolveDesignTokenCatalog, resolveLayoutBreakpoints, resolveLayoutDocument, resolvePagePath, resolveRoute, responsiveValue, stripStega, unscaledFrameRect, validateLayoutDocument };