@tanqory/theme-kit 2.0.0-alpha.17 → 2.0.0-alpha.19
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 +4 -1
- package/dist/abi/canvas-live.d.ts +7 -2
- package/dist/abi/canvas-live.js +8 -3
- package/dist/abi/cart.d.ts +5 -4
- package/dist/abi/cart.js +14 -5
- package/dist/abi/convert.d.ts +18 -2
- package/dist/abi/convert.js +56 -4
- package/dist/abi/data-api.js +4 -0
- package/dist/abi/page-data.d.ts +11 -3
- package/dist/abi/page-data.js +71 -3
- package/dist/abi/wire.d.ts +8 -0
- package/dist/abi/wire.js +32 -2
- package/dist/build.d.ts +7 -2
- package/dist/build.js +96 -5
- package/dist/chunks.d.ts +23 -0
- package/dist/chunks.js +41 -0
- package/dist/client.d.ts +7 -0
- package/dist/client.js +16 -2
- package/dist/headless/hooks.js +5 -1
- package/dist/headless/index.d.ts +8 -1
- package/dist/headless/index.js +11 -1
- package/dist/headless/lazy-component.d.ts +72 -0
- package/dist/headless/lazy-component.js +225 -0
- package/dist/headless/lazy-section.d.ts +38 -0
- package/dist/headless/lazy-section.js +97 -0
- package/dist/headless/model.d.ts +73 -0
- package/dist/headless/model.js +115 -0
- package/dist/headless/money.d.ts +1 -9
- package/dist/headless/money.js +24 -22
- package/dist/headless/page.d.ts +2 -0
- package/dist/headless/primitives/storefront.js +2 -1
- package/dist/headless/strings.js +8 -0
- package/dist/headless/tanqory-money.generated.d.ts +493 -0
- package/dist/headless/tanqory-money.generated.js +507 -0
- package/dist/headless/theme.d.ts +13 -3
- package/dist/headless/theme.js +12 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/runtime/data/StoreProvider.js +10 -3
- package/dist/runtime/data/to-ui.d.ts +12 -7
- package/dist/runtime/data/to-ui.js +48 -16
- package/dist/runtime/kit/cart.d.ts +10 -3
- package/dist/runtime/kit/contract/content.d.ts +14 -0
- package/dist/runtime/kit/contract/content.js +13 -0
- package/dist/runtime/kit/contract/field-types.d.ts +26 -3
- package/dist/runtime/kit/contract/field-types.js +11 -1
- package/dist/runtime/kit/contract/validate.d.ts +2 -0
- package/dist/runtime/kit/contract/validate.js +49 -9
- package/dist/runtime/kit/data.d.ts +12 -0
- package/dist/runtime/kit/data.js +36 -22
- package/dist/runtime/kit/dynamic-source.d.ts +12 -0
- package/dist/runtime/kit/dynamic-source.js +17 -0
- package/dist/runtime/kit/storefront.d.ts +14 -1
- package/dist/runtime/kit/types.d.ts +8 -0
- package/dist/runtime/render/SectionRenderer.js +44 -11
- package/dist/runtime/render/resolved.d.ts +47 -0
- package/dist/runtime/render/resolved.js +80 -0
- package/dist/runtime/render/section-actions.d.ts +2 -1
- package/dist/runtime/render/section-actions.js +4 -1
- package/dist/runtime/render/starter.js +19 -4
- package/dist/runtime/seo/head.d.ts +1 -1
- package/dist/runtime/shell/PageShell.js +6 -1
- package/dist/runtime/shell/RuntimeBridge.d.ts +4 -0
- package/dist/runtime/shell/RuntimeBridge.js +37 -6
- package/dist/runtime/slots.d.ts +1 -1
- package/dist/sdk/font-hooks.d.ts +7 -0
- package/dist/sdk/font-hooks.js +21 -0
- package/dist/sdk/fonts.d.ts +144 -0
- package/dist/sdk/fonts.js +241 -0
- package/dist/sdk/index.d.ts +7 -1
- package/dist/sdk/index.js +11 -1
- package/dist/sdk/motion-hooks.d.ts +23 -0
- package/dist/sdk/motion-hooks.js +46 -0
- package/dist/sdk/motion.d.ts +78 -0
- package/dist/sdk/motion.js +292 -0
- package/dist/sdk/runtime-context.d.ts +32 -4
- package/dist/sdk/schema.d.ts +47 -4
- package/dist/sdk/schema.js +47 -0
- package/dist/sdk/store-lookup.d.ts +5 -0
- package/dist/sdk/store-lookup.js +19 -0
- package/dist/sdk/store.d.ts +15 -0
- package/dist/sdk/sx.d.ts +5 -0
- package/dist/sdk/sx.js +7 -2
- package/dist/sdk/theme.d.ts +21 -0
- package/dist/sdk/theme.js +17 -0
- package/dist/sdk/types.d.ts +36 -4
- package/dist/server.d.ts +5 -4
- package/dist/server.js +76 -20
- package/dist/vite-chunks.d.ts +10 -0
- package/dist/vite-chunks.js +44 -0
- package/docs/headless-api.md +33 -3
- package/package.json +10 -18
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `lazyComponent(() => import('./CartDrawer'), 'CartDrawer', { active: (p) => p.open, enter: (p) => ({ ...p, open: false }) })`
|
|
3
|
+
* — a component that is not a section (a drawer, a modal, a menu: anything the shopper opens) whose code loads as its
|
|
4
|
+
* own client chunk after the page has hydrated, not before (theme-abi-v2.md §2.2.1, a theme with
|
|
5
|
+
* `manifest.client.chunks: "sections"`; in any other build `import()` is inlined or loads directly).
|
|
6
|
+
*
|
|
7
|
+
* Hydration stays byte-identical by construction:
|
|
8
|
+
* - On the server and while React hydrates, it renders `placeholder` (default: nothing), whatever its props say, and
|
|
9
|
+
* loads nothing. So the server HTML and the browser's first render are the same, with or without its chunk.
|
|
10
|
+
* (`useSyncExternalStore` with a server snapshot: React reads `false` on the server and during hydration, `true` on
|
|
11
|
+
* every render after it, and re-renders once hydration has committed.)
|
|
12
|
+
* - Its chunk key is never recorded for the page's `<head>` (ChunkSinkContext is lazySection's), so the boot does not
|
|
13
|
+
* fetch it before hydration: it costs nothing on first load.
|
|
14
|
+
*
|
|
15
|
+
* After hydration:
|
|
16
|
+
* - It loads the first time `active(props)` is true (default: at once, for a component that is only mounted on a user
|
|
17
|
+
* action), or earlier when `preload()` / `preloadOnIdle()` runs. A preload fetches the code only: the page's DOM
|
|
18
|
+
* stays the server's until the shopper opens something (conformance suite 5 compares the two after hydration).
|
|
19
|
+
* - An instance mounts the real component on its first activation, once the code is there: first with `enter(props)`
|
|
20
|
+
* (e.g. closed), then with its own props two frames later, so its opening transition runs. It stays mounted after
|
|
21
|
+
* (a close keeps its exit transition).
|
|
22
|
+
* - A chunk that fails its integrity check never settles (the platform gate): the instance keeps its placeholder. A
|
|
23
|
+
* load that rejects (a theme's own dev build offline) is forgotten, and the next activation tries again.
|
|
24
|
+
*
|
|
25
|
+
* A component that can be open on first paint (open in the server HTML, or from URL state the server reads) must not
|
|
26
|
+
* be lazy: the server cannot render its open state without its code, so it would open only after hydration. Keep it
|
|
27
|
+
* an ordinary import.
|
|
28
|
+
*/
|
|
29
|
+
import { createElement, Fragment, useEffect, useReducer, useRef, useState, useSyncExternalStore } from 'react';
|
|
30
|
+
const subscribeNever = () => () => undefined;
|
|
31
|
+
const afterHydration = () => true;
|
|
32
|
+
const onServerOrHydrating = () => false;
|
|
33
|
+
/** False on the server and while React hydrates; true on every render after. */
|
|
34
|
+
function useHydrated() {
|
|
35
|
+
return useSyncExternalStore(subscribeNever, afterHydration, onServerOrHydrating);
|
|
36
|
+
}
|
|
37
|
+
const swallow = () => undefined;
|
|
38
|
+
export function lazyComponent(load, exportName = 'default', options = {}) {
|
|
39
|
+
let started = null;
|
|
40
|
+
let loaded = null;
|
|
41
|
+
const waiting = new Set();
|
|
42
|
+
const pick = (m) => {
|
|
43
|
+
const C = m[exportName];
|
|
44
|
+
if (typeof C !== 'function' && (typeof C !== 'object' || C === null))
|
|
45
|
+
throw new Error(`lazyComponent: the chunk has no export ${exportName}`);
|
|
46
|
+
return C;
|
|
47
|
+
};
|
|
48
|
+
const start = () => {
|
|
49
|
+
if (!started) {
|
|
50
|
+
// `then` on the server's static chunk (and a test's) calls back synchronously: `loaded` is set before this returns
|
|
51
|
+
started = load().then((m) => {
|
|
52
|
+
loaded = pick(m);
|
|
53
|
+
for (const wake of [...waiting])
|
|
54
|
+
wake();
|
|
55
|
+
waiting.clear();
|
|
56
|
+
}, (e) => {
|
|
57
|
+
started = null;
|
|
58
|
+
throw e;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return started;
|
|
62
|
+
};
|
|
63
|
+
function LazyComponent(props) {
|
|
64
|
+
const hydrated = useHydrated();
|
|
65
|
+
// active once (after hydration): from then on the instance shows the real component
|
|
66
|
+
const once = useRef(false);
|
|
67
|
+
if (hydrated && (options.active ? options.active(props) : true))
|
|
68
|
+
once.current = true;
|
|
69
|
+
const shown = once.current;
|
|
70
|
+
if (shown && !loaded)
|
|
71
|
+
start().then(undefined, swallow);
|
|
72
|
+
const [, wake] = useReducer((n) => n + 1, 0);
|
|
73
|
+
const Comp = loaded;
|
|
74
|
+
// its first frames: `enter` props, so a transition has its start state
|
|
75
|
+
const [entered, setEntered] = useState(false);
|
|
76
|
+
const entering = Comp !== null && shown && !entered && options.enter !== undefined;
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (!shown || Comp)
|
|
79
|
+
return;
|
|
80
|
+
waiting.add(wake);
|
|
81
|
+
// loaded between this render and the effect
|
|
82
|
+
if (loaded)
|
|
83
|
+
wake();
|
|
84
|
+
return () => {
|
|
85
|
+
waiting.delete(wake);
|
|
86
|
+
};
|
|
87
|
+
}, [shown, Comp]);
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (!entering)
|
|
90
|
+
return;
|
|
91
|
+
if (typeof requestAnimationFrame !== 'function') {
|
|
92
|
+
const t = setTimeout(() => setEntered(true), 0);
|
|
93
|
+
return () => clearTimeout(t);
|
|
94
|
+
}
|
|
95
|
+
let second = 0;
|
|
96
|
+
const first = requestAnimationFrame(() => {
|
|
97
|
+
second = requestAnimationFrame(() => setEntered(true));
|
|
98
|
+
});
|
|
99
|
+
return () => {
|
|
100
|
+
cancelAnimationFrame(first);
|
|
101
|
+
cancelAnimationFrame(second);
|
|
102
|
+
};
|
|
103
|
+
}, [entering]);
|
|
104
|
+
if (!shown || !Comp)
|
|
105
|
+
return options.placeholder ? createElement(Fragment, null, options.placeholder(props)) : null;
|
|
106
|
+
return createElement(Comp, entering ? options.enter(props) : props);
|
|
107
|
+
}
|
|
108
|
+
LazyComponent.preload = () => start();
|
|
109
|
+
LazyComponent.loaded = () => loaded !== null;
|
|
110
|
+
return LazyComponent;
|
|
111
|
+
}
|
|
112
|
+
const PRELOAD_EVENTS = ['pointerover', 'pointerdown', 'focusin', 'touchstart', 'keydown'];
|
|
113
|
+
/**
|
|
114
|
+
* Preloads `components` after the page has settled, or at the shopper's first hover, touch, focus or key press,
|
|
115
|
+
* whichever comes first, so a first open finds the code already loaded. Call it after hydration (in an effect).
|
|
116
|
+
* Never throws; returns a stop function.
|
|
117
|
+
*
|
|
118
|
+
* "Settled" keeps the preload out of the page's first load (theme-abi-v2 §2.2.1: what a page fetches before it goes
|
|
119
|
+
* quiet is its first load, and a runner counts it so): the window's `load` event has fired, then no resource request
|
|
120
|
+
* has ended for `quietMs` (default 2000 ms: a conformance runner calls a page quiet after 500 ms with no request, and
|
|
121
|
+
* under load its view of the page's requests lags, so 800 ms was seen landing inside its count once), then the browser is
|
|
122
|
+
* idle (requestIdleCallback with `timeout`, default 1000 ms; a timer of `fallbackMs`, default 0, without it). The quiet
|
|
123
|
+
* is read from resource timing (a PerformanceObserver, or `performance.getEntriesByType` without one), checked every
|
|
124
|
+
* `pollMs` (default 100 ms); once it fires, nothing of it stays scheduled. A first interaction preloads at once.
|
|
125
|
+
*/
|
|
126
|
+
export function preloadOnIdle(components, o = {}) {
|
|
127
|
+
const maybe = o.win ?? (typeof window === 'undefined' ? undefined : window);
|
|
128
|
+
if (!maybe)
|
|
129
|
+
return () => undefined;
|
|
130
|
+
// a const of type Window, so the hoisted functions below see it narrowed
|
|
131
|
+
const win = maybe;
|
|
132
|
+
let done = false;
|
|
133
|
+
const opts = { capture: true, passive: true };
|
|
134
|
+
const w = win;
|
|
135
|
+
const perf = w.performance;
|
|
136
|
+
const viaIdle = typeof w.requestIdleCallback === 'function' && typeof w.cancelIdleCallback === 'function';
|
|
137
|
+
const quietMs = o.quietMs ?? 2000;
|
|
138
|
+
const pollMs = o.pollMs ?? 100;
|
|
139
|
+
// the end of the latest resource request this page made (ms on performance.now()'s clock)
|
|
140
|
+
let lastEnd = 0;
|
|
141
|
+
const note = (list) => {
|
|
142
|
+
for (const e of list)
|
|
143
|
+
if (typeof e.responseEnd === 'number' && e.responseEnd > lastEnd)
|
|
144
|
+
lastEnd = e.responseEnd;
|
|
145
|
+
};
|
|
146
|
+
let observer = null;
|
|
147
|
+
try {
|
|
148
|
+
if (typeof w.PerformanceObserver === 'function') {
|
|
149
|
+
observer = new w.PerformanceObserver((list) => note(list.getEntries()));
|
|
150
|
+
observer.observe({ type: 'resource', buffered: true });
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
observer = null;
|
|
155
|
+
}
|
|
156
|
+
const latestEnd = () => {
|
|
157
|
+
if (!observer && typeof perf?.getEntriesByType === 'function')
|
|
158
|
+
note(perf.getEntriesByType('resource'));
|
|
159
|
+
return lastEnd;
|
|
160
|
+
};
|
|
161
|
+
let poll = 0;
|
|
162
|
+
let idle = 0;
|
|
163
|
+
let idleIsTimer = false;
|
|
164
|
+
const onLoad = () => check();
|
|
165
|
+
const stop = () => {
|
|
166
|
+
for (const e of PRELOAD_EVENTS)
|
|
167
|
+
win.removeEventListener(e, go, opts);
|
|
168
|
+
win.removeEventListener('load', onLoad);
|
|
169
|
+
if (poll)
|
|
170
|
+
win.clearTimeout(poll);
|
|
171
|
+
if (idle) {
|
|
172
|
+
if (idleIsTimer)
|
|
173
|
+
win.clearTimeout(idle);
|
|
174
|
+
else
|
|
175
|
+
w.cancelIdleCallback(idle);
|
|
176
|
+
}
|
|
177
|
+
poll = 0;
|
|
178
|
+
idle = 0;
|
|
179
|
+
observer?.disconnect();
|
|
180
|
+
observer = null;
|
|
181
|
+
};
|
|
182
|
+
function go() {
|
|
183
|
+
if (done)
|
|
184
|
+
return;
|
|
185
|
+
done = true;
|
|
186
|
+
stop();
|
|
187
|
+
for (const c of components) {
|
|
188
|
+
try {
|
|
189
|
+
c.preload().then(undefined, swallow);
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
/* a loader that throws is the next open's to retry */
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function check() {
|
|
197
|
+
poll = 0;
|
|
198
|
+
if (done)
|
|
199
|
+
return;
|
|
200
|
+
const now = typeof perf?.now === 'function' ? perf.now() : 0;
|
|
201
|
+
if (now - latestEnd() < quietMs) {
|
|
202
|
+
poll = win.setTimeout(check, pollMs);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
// settled: the observer and the poll end here; only the idle wait stays, and it ends in `go`
|
|
206
|
+
observer?.disconnect();
|
|
207
|
+
observer = null;
|
|
208
|
+
if (viaIdle)
|
|
209
|
+
idle = w.requestIdleCallback(go, { timeout: o.timeout ?? 1000 });
|
|
210
|
+
else {
|
|
211
|
+
idleIsTimer = true;
|
|
212
|
+
idle = win.setTimeout(go, o.fallbackMs ?? 0);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
for (const e of PRELOAD_EVENTS)
|
|
216
|
+
win.addEventListener(e, go, opts);
|
|
217
|
+
if (win.document?.readyState === 'complete')
|
|
218
|
+
check();
|
|
219
|
+
else
|
|
220
|
+
win.addEventListener('load', onLoad, { once: true });
|
|
221
|
+
return () => {
|
|
222
|
+
done = true;
|
|
223
|
+
stop();
|
|
224
|
+
};
|
|
225
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `lazySection(() => import('./Hero'), 'Hero')` — a section component that loads as its own client chunk (theme-abi-v2.md
|
|
3
|
+
* §2.2.1, a theme with `manifest.client.chunks: "sections"`).
|
|
4
|
+
*
|
|
5
|
+
* - The component renders inside a `<Suspense>` on the server and in the browser alike, so the hydration markup is the
|
|
6
|
+
* same.
|
|
7
|
+
* - The kit's hydrate() loads the page's lazy sections first (preloadLazySections) and hydrates only when all have
|
|
8
|
+
* loaded, so no boundary is still suspended while React hydrates. (React 18 client-renders a dehydrated boundary that
|
|
9
|
+
* receives an update before its code arrived, dropping its server HTML: found by the browser test, 2026-11-21.)
|
|
10
|
+
* When a chunk fails its integrity check, the platform gate's promise never settles, so this copy of the code never
|
|
11
|
+
* hydrates; the boot loads the verified single-bundle fallback, which hydrates the page instead.
|
|
12
|
+
* - A section the editor adds later (not on the page at hydration) suspends normally and appears when its chunk loads.
|
|
13
|
+
* - On the server the bundler made the import static, so the section renders in the same pass. The section records its
|
|
14
|
+
* chunk key (ChunkSinkContext), and the page's `<head>` preloads that chunk (a speed hint; the gate in the
|
|
15
|
+
* browser verifies everything itself).
|
|
16
|
+
* - A theme without `client.chunks` cannot use this: the platform bundler refuses `import()` in its code.
|
|
17
|
+
*/
|
|
18
|
+
import { type ComponentType } from 'react';
|
|
19
|
+
/** The chunk keys a server render's lazy sections came from (server.tsx provides it; the head preloads them). */
|
|
20
|
+
export declare const ChunkSinkContext: import("react").Context<Set<string> | null>;
|
|
21
|
+
type Loaded = Record<string, unknown>;
|
|
22
|
+
/** A lazySection component: `preload()` starts (once) and resolves when its chunk has loaded. */
|
|
23
|
+
export interface LazySectionComponent<P> {
|
|
24
|
+
(props: P): JSX.Element;
|
|
25
|
+
preload(): PromiseLike<unknown>;
|
|
26
|
+
/** True once the chunk has loaded (at once for the server's static form). */
|
|
27
|
+
loaded(): boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare function lazySection<P extends object>(load: () => PromiseLike<Loaded>, exportName?: string): ComponentType<P> & LazySectionComponent<P>;
|
|
30
|
+
/**
|
|
31
|
+
* Before hydration: start every lazy section of `theme` whose id appears as a `type` anywhere in `page` (the content
|
|
32
|
+
* document the server rendered), and resolve when all have loaded. Null when the page has none.
|
|
33
|
+
*/
|
|
34
|
+
export declare function preloadLazySections(sections: readonly {
|
|
35
|
+
id: string;
|
|
36
|
+
component?: unknown;
|
|
37
|
+
}[], page: unknown): PromiseLike<unknown> | null;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* `lazySection(() => import('./Hero'), 'Hero')` — a section component that loads as its own client chunk (theme-abi-v2.md
|
|
4
|
+
* §2.2.1, a theme with `manifest.client.chunks: "sections"`).
|
|
5
|
+
*
|
|
6
|
+
* - The component renders inside a `<Suspense>` on the server and in the browser alike, so the hydration markup is the
|
|
7
|
+
* same.
|
|
8
|
+
* - The kit's hydrate() loads the page's lazy sections first (preloadLazySections) and hydrates only when all have
|
|
9
|
+
* loaded, so no boundary is still suspended while React hydrates. (React 18 client-renders a dehydrated boundary that
|
|
10
|
+
* receives an update before its code arrived, dropping its server HTML: found by the browser test, 2026-11-21.)
|
|
11
|
+
* When a chunk fails its integrity check, the platform gate's promise never settles, so this copy of the code never
|
|
12
|
+
* hydrates; the boot loads the verified single-bundle fallback, which hydrates the page instead.
|
|
13
|
+
* - A section the editor adds later (not on the page at hydration) suspends normally and appears when its chunk loads.
|
|
14
|
+
* - On the server the bundler made the import static, so the section renders in the same pass. The section records its
|
|
15
|
+
* chunk key (ChunkSinkContext), and the page's `<head>` preloads that chunk (a speed hint; the gate in the
|
|
16
|
+
* browser verifies everything itself).
|
|
17
|
+
* - A theme without `client.chunks` cannot use this: the platform bundler refuses `import()` in its code.
|
|
18
|
+
*/
|
|
19
|
+
import { Suspense, createContext, createElement, lazy, useContext } from 'react';
|
|
20
|
+
/** The chunk keys a server render's lazy sections came from (server.tsx provides it; the head preloads them). */
|
|
21
|
+
export const ChunkSinkContext = createContext(null);
|
|
22
|
+
/** `then` that stays synchronous when the source calls back synchronously (the server's static chunk). */
|
|
23
|
+
function mapThen(src, f) {
|
|
24
|
+
let done = false;
|
|
25
|
+
let value;
|
|
26
|
+
const out = src.then((a) => {
|
|
27
|
+
value = f(a);
|
|
28
|
+
done = true;
|
|
29
|
+
return value;
|
|
30
|
+
});
|
|
31
|
+
if (done)
|
|
32
|
+
return { then: (ok) => (ok && ok(value), out) };
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
export function lazySection(load, exportName = 'default') {
|
|
36
|
+
let started = null;
|
|
37
|
+
let key;
|
|
38
|
+
let loaded = null;
|
|
39
|
+
const pick = (m) => {
|
|
40
|
+
const C = m[exportName];
|
|
41
|
+
if (typeof C !== 'function' && (typeof C !== 'object' || C === null))
|
|
42
|
+
throw new Error(`lazySection: the chunk has no export ${exportName}`);
|
|
43
|
+
return C;
|
|
44
|
+
};
|
|
45
|
+
const start = () => {
|
|
46
|
+
if (!started) {
|
|
47
|
+
const raw = load();
|
|
48
|
+
key = raw.key;
|
|
49
|
+
started = mapThen(raw, (m) => ((loaded = pick(m)), m));
|
|
50
|
+
}
|
|
51
|
+
return started;
|
|
52
|
+
};
|
|
53
|
+
const Lazy = lazy(() => mapThen(start(), (m) => ({ default: pick(m) })));
|
|
54
|
+
function LazySection(props) {
|
|
55
|
+
start();
|
|
56
|
+
const sink = useContext(ChunkSinkContext);
|
|
57
|
+
if (sink && key)
|
|
58
|
+
sink.add(key);
|
|
59
|
+
// Already loaded (the server's static chunk, or preloaded before hydration): render it directly, without
|
|
60
|
+
// suspending, so the boundary hydrates in the same pass.
|
|
61
|
+
return _jsx(Suspense, { fallback: null, children: createElement((loaded ?? Lazy), props) });
|
|
62
|
+
}
|
|
63
|
+
LazySection.preload = () => start();
|
|
64
|
+
LazySection.loaded = () => loaded !== null;
|
|
65
|
+
return LazySection;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Before hydration: start every lazy section of `theme` whose id appears as a `type` anywhere in `page` (the content
|
|
69
|
+
* document the server rendered), and resolve when all have loaded. Null when the page has none.
|
|
70
|
+
*/
|
|
71
|
+
export function preloadLazySections(sections, page) {
|
|
72
|
+
const types = new Set();
|
|
73
|
+
const walk = (v) => {
|
|
74
|
+
if (Array.isArray(v))
|
|
75
|
+
v.forEach(walk);
|
|
76
|
+
else if (v && typeof v === 'object') {
|
|
77
|
+
const t = v.type;
|
|
78
|
+
if (typeof t === 'string')
|
|
79
|
+
types.add(t);
|
|
80
|
+
for (const x of Object.values(v))
|
|
81
|
+
walk(x);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
walk(page);
|
|
85
|
+
const waits = [];
|
|
86
|
+
for (const s of sections) {
|
|
87
|
+
const c = s.component;
|
|
88
|
+
if (!types.has(s.id) || !c || typeof c.preload !== 'function')
|
|
89
|
+
continue;
|
|
90
|
+
const p = c.preload();
|
|
91
|
+
// already loaded (a static chunk, or loaded before): nothing to wait for, so hydration stays synchronous
|
|
92
|
+
if (typeof c.loaded === 'function' && c.loaded())
|
|
93
|
+
continue;
|
|
94
|
+
waits.push(p);
|
|
95
|
+
}
|
|
96
|
+
return waits.length ? Promise.all(waits) : null;
|
|
97
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<ModelViewer>` — a product's 3D model on the storefront, through the PLATFORM's viewer (theme-abi-v2 "Host capability:
|
|
3
|
+
* 3D models"). The ready way to show a model: an AI custom theme has no other (theme-standard refuses its own 3D code),
|
|
4
|
+
* and a partner or first-party theme may use it or build its own (Partner-1). This component adds nothing to the theme
|
|
5
|
+
* bundle but a poster and a button; the viewer
|
|
6
|
+
* (@google/model-viewer 4.0.0, served by the storefront at MODEL_VIEWER_SRC from the shop's own origin) is loaded once
|
|
7
|
+
* per page, only after the shopper asks to see the model, with its Subresource Integrity value (W3C SRI §3.3).
|
|
8
|
+
*
|
|
9
|
+
* media a product media item of `type: 'model'` (`Product.media`): `src` is the same-origin `/_tq/model/…` GLB, `iosSrc`
|
|
10
|
+
* the USDZ for iOS Quick Look when the merchant uploaded one, `poster` the preview image.
|
|
11
|
+
* ar offer "View in your space" (Android Scene Viewer, iOS Quick Look, WebXR); on by default.
|
|
12
|
+
*
|
|
13
|
+
* Accessible: a real `<button>` (keyboard, focus), the model's alt text (else `alt`), the poster as the still, and a
|
|
14
|
+
* text message when the viewer cannot run (no WebGL, a model it refuses). The page CSP needs nothing from the theme:
|
|
15
|
+
* the gateway adds what the viewer needs when the render asserted `x-tq-media: model` (theme-kit does that for any
|
|
16
|
+
* product with a model).
|
|
17
|
+
*/
|
|
18
|
+
import { type ReactNode } from 'react';
|
|
19
|
+
/** The platform viewer (storefront-edge core/viewer-route.ts `MODEL_VIEWER_PATH` / `MODEL_VIEWER_INTEGRITY`). */
|
|
20
|
+
export declare const MODEL_VIEWER_SRC = "/_tq/viewer/model-viewer-a6a461d0.js";
|
|
21
|
+
export declare const MODEL_VIEWER_INTEGRITY = "sha384-6U1WsPbbcCmcM+VtFw4f1C1xP+8qeErdfS/9UwVjKxj1j+HkyFgfWE3RZHXqCNh7";
|
|
22
|
+
/** Where the viewer would look for decoders: a same-origin path that answers 404, so a compressed model fails at once. */
|
|
23
|
+
export declare const MODEL_VIEWER_NO_DECODERS = "/_tq/viewer/no-decoders/";
|
|
24
|
+
export interface ModelMedia {
|
|
25
|
+
type?: 'model';
|
|
26
|
+
src: string;
|
|
27
|
+
iosSrc?: string;
|
|
28
|
+
poster?: {
|
|
29
|
+
src?: string;
|
|
30
|
+
url?: string;
|
|
31
|
+
} | null;
|
|
32
|
+
alt?: string;
|
|
33
|
+
}
|
|
34
|
+
declare global {
|
|
35
|
+
namespace JSX {
|
|
36
|
+
interface IntrinsicElements {
|
|
37
|
+
/** Defined by the platform viewer (loadModelViewer). */
|
|
38
|
+
'model-viewer': {
|
|
39
|
+
ref?: unknown;
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
} & Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** Defines `<model-viewer>` once per page (the platform file, SRI-pinned); resolves when the element is ready. */
|
|
46
|
+
export declare function loadModelViewer(doc?: Document): Promise<void>;
|
|
47
|
+
export interface ModelViewerProps {
|
|
48
|
+
media: ModelMedia;
|
|
49
|
+
/** Alternative text when the model has none (e.g. the product title). */
|
|
50
|
+
alt?: string;
|
|
51
|
+
ar?: boolean;
|
|
52
|
+
className?: string;
|
|
53
|
+
/** What shows while the viewer is not running, instead of the poster. */
|
|
54
|
+
fallback?: ReactNode;
|
|
55
|
+
}
|
|
56
|
+
/** The four words `<ModelViewer>` shows (kit keys `media.view3d`, `media.loading3d`, `media.model3dUnavailable`, `media.viewInYourSpace`). */
|
|
57
|
+
export interface ModelViewerLabels {
|
|
58
|
+
view3d: string;
|
|
59
|
+
loading3d: string;
|
|
60
|
+
unavailable: string;
|
|
61
|
+
viewInYourSpace: string;
|
|
62
|
+
}
|
|
63
|
+
export interface ModelViewerBaseProps extends ModelViewerProps {
|
|
64
|
+
labels: ModelViewerLabels;
|
|
65
|
+
}
|
|
66
|
+
/** The model with the kit's words for its labels (`useTranslate`: the merchant's, the theme's, then the kit's). */
|
|
67
|
+
export declare function ModelViewer(props: ModelViewerProps): JSX.Element | null;
|
|
68
|
+
/**
|
|
69
|
+
* `<ModelViewer>` for a theme that has its own words for these four labels (its locale files carry the `media.*` keys).
|
|
70
|
+
* It renders exactly what `<ModelViewer>` renders, but does not use the kit's translations, so the kit's fallback word
|
|
71
|
+
* table (English and Thai) stays out of the theme's client bundle.
|
|
72
|
+
*/
|
|
73
|
+
export declare function ModelViewerBase({ media, alt, ar, className, fallback, labels }: ModelViewerBaseProps): JSX.Element | null;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* `<ModelViewer>` — a product's 3D model on the storefront, through the PLATFORM's viewer (theme-abi-v2 "Host capability:
|
|
4
|
+
* 3D models"). The ready way to show a model: an AI custom theme has no other (theme-standard refuses its own 3D code),
|
|
5
|
+
* and a partner or first-party theme may use it or build its own (Partner-1). This component adds nothing to the theme
|
|
6
|
+
* bundle but a poster and a button; the viewer
|
|
7
|
+
* (@google/model-viewer 4.0.0, served by the storefront at MODEL_VIEWER_SRC from the shop's own origin) is loaded once
|
|
8
|
+
* per page, only after the shopper asks to see the model, with its Subresource Integrity value (W3C SRI §3.3).
|
|
9
|
+
*
|
|
10
|
+
* media a product media item of `type: 'model'` (`Product.media`): `src` is the same-origin `/_tq/model/…` GLB, `iosSrc`
|
|
11
|
+
* the USDZ for iOS Quick Look when the merchant uploaded one, `poster` the preview image.
|
|
12
|
+
* ar offer "View in your space" (Android Scene Viewer, iOS Quick Look, WebXR); on by default.
|
|
13
|
+
*
|
|
14
|
+
* Accessible: a real `<button>` (keyboard, focus), the model's alt text (else `alt`), the poster as the still, and a
|
|
15
|
+
* text message when the viewer cannot run (no WebGL, a model it refuses). The page CSP needs nothing from the theme:
|
|
16
|
+
* the gateway adds what the viewer needs when the render asserted `x-tq-media: model` (theme-kit does that for any
|
|
17
|
+
* product with a model).
|
|
18
|
+
*/
|
|
19
|
+
import { useContext, useEffect, useRef, useState } from 'react';
|
|
20
|
+
import { modelSrc } from '../runtime/data/to-ui.js';
|
|
21
|
+
import { useTranslate } from './i18n.js';
|
|
22
|
+
import { HeadSinkContext } from './page.js';
|
|
23
|
+
/** The platform viewer (storefront-edge core/viewer-route.ts `MODEL_VIEWER_PATH` / `MODEL_VIEWER_INTEGRITY`). */
|
|
24
|
+
export const MODEL_VIEWER_SRC = '/_tq/viewer/model-viewer-a6a461d0.js';
|
|
25
|
+
export const MODEL_VIEWER_INTEGRITY = 'sha384-6U1WsPbbcCmcM+VtFw4f1C1xP+8qeErdfS/9UwVjKxj1j+HkyFgfWE3RZHXqCNh7';
|
|
26
|
+
/** Where the viewer would look for decoders: a same-origin path that answers 404, so a compressed model fails at once. */
|
|
27
|
+
export const MODEL_VIEWER_NO_DECODERS = '/_tq/viewer/no-decoders/';
|
|
28
|
+
let pending = null;
|
|
29
|
+
/** Defines `<model-viewer>` once per page (the platform file, SRI-pinned); resolves when the element is ready. */
|
|
30
|
+
export function loadModelViewer(doc = document) {
|
|
31
|
+
const w = doc.defaultView;
|
|
32
|
+
if (!w)
|
|
33
|
+
return Promise.reject(new Error('browser only'));
|
|
34
|
+
if (w.customElements?.get('model-viewer'))
|
|
35
|
+
return Promise.resolve();
|
|
36
|
+
if (pending)
|
|
37
|
+
return pending;
|
|
38
|
+
// The viewer reads these before it defines the element: no decoder is ever fetched from another origin.
|
|
39
|
+
// meshopt is left unset: set, the viewer inserts a <script> for it on every load; unset, it inserts none.
|
|
40
|
+
w.ModelViewerElement = { ...(w.ModelViewerElement ?? {}), dracoDecoderLocation: MODEL_VIEWER_NO_DECODERS, ktx2TranscoderLocation: MODEL_VIEWER_NO_DECODERS };
|
|
41
|
+
pending = new Promise((resolve, reject) => {
|
|
42
|
+
const s = doc.createElement('script');
|
|
43
|
+
s.type = 'module';
|
|
44
|
+
s.src = MODEL_VIEWER_SRC;
|
|
45
|
+
s.setAttribute('integrity', MODEL_VIEWER_INTEGRITY);
|
|
46
|
+
s.setAttribute('crossorigin', 'anonymous');
|
|
47
|
+
s.onload = () => { w.customElements.whenDefined('model-viewer').then(() => resolve(), reject); };
|
|
48
|
+
s.onerror = () => {
|
|
49
|
+
pending = null;
|
|
50
|
+
s.remove();
|
|
51
|
+
reject(new Error('model-viewer failed to load'));
|
|
52
|
+
};
|
|
53
|
+
doc.head.appendChild(s);
|
|
54
|
+
});
|
|
55
|
+
return pending;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A source as the platform's same-origin model route: a `/_tq/model/…` path as given, or a store-media URL (a `model`
|
|
59
|
+
* setting's value, B.4) mapped onto it (theme-kit `modelSrc`). Anything else is not shown.
|
|
60
|
+
*/
|
|
61
|
+
const routeOf = (u) => (typeof u === 'string' ? modelSrc(u.trim()) : null);
|
|
62
|
+
/** The model with the kit's words for its labels (`useTranslate`: the merchant's, the theme's, then the kit's). */
|
|
63
|
+
export function ModelViewer(props) {
|
|
64
|
+
const t = useTranslate();
|
|
65
|
+
return (_jsx(ModelViewerBase, { ...props, labels: { view3d: t('media.view3d'), loading3d: t('media.loading3d'), unavailable: t('media.model3dUnavailable'), viewInYourSpace: t('media.viewInYourSpace') } }));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* `<ModelViewer>` for a theme that has its own words for these four labels (its locale files carry the `media.*` keys).
|
|
69
|
+
* It renders exactly what `<ModelViewer>` renders, but does not use the kit's translations, so the kit's fallback word
|
|
70
|
+
* table (English and Thai) stays out of the theme's client bundle.
|
|
71
|
+
*/
|
|
72
|
+
export function ModelViewerBase({ media, alt, ar = true, className, fallback, labels }) {
|
|
73
|
+
const [state, setState] = useState('idle');
|
|
74
|
+
const ref = useRef(null);
|
|
75
|
+
const sink = useContext(HeadSinkContext);
|
|
76
|
+
const routed = routeOf(media.src);
|
|
77
|
+
const src = routed && routed.endsWith('.glb') ? routed : null;
|
|
78
|
+
const ios = routeOf(media.iosSrc);
|
|
79
|
+
const iosSrc = ios && ios.endsWith('.usdz') ? ios : null;
|
|
80
|
+
// A model rendered on the server makes the page assert `x-tq-media: model`, so the gateway lets the viewer read
|
|
81
|
+
// its textures (a model from a setting, not only one in Product.media; theme-abi §2.6).
|
|
82
|
+
if (src && sink)
|
|
83
|
+
sink.model = true;
|
|
84
|
+
const poster = media.poster?.src ?? media.poster?.url ?? null;
|
|
85
|
+
const label = media.alt || alt || '';
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
const el = ref.current;
|
|
88
|
+
if (state !== 'ready' || !el)
|
|
89
|
+
return;
|
|
90
|
+
const fail = () => setState('failed');
|
|
91
|
+
el.addEventListener('error', fail);
|
|
92
|
+
return () => el.removeEventListener('error', fail);
|
|
93
|
+
}, [state]);
|
|
94
|
+
if (!src)
|
|
95
|
+
return null;
|
|
96
|
+
if (state === 'ready') {
|
|
97
|
+
const attrs = { src, alt: label, 'camera-controls': '', 'touch-action': 'pan-y', 'interaction-prompt': 'none', 'shadow-intensity': '1' };
|
|
98
|
+
if (poster)
|
|
99
|
+
attrs.poster = poster;
|
|
100
|
+
if (ar) {
|
|
101
|
+
attrs.ar = '';
|
|
102
|
+
attrs['ar-modes'] = 'webxr scene-viewer quick-look';
|
|
103
|
+
if (iosSrc)
|
|
104
|
+
attrs['ios-src'] = iosSrc;
|
|
105
|
+
}
|
|
106
|
+
return (_jsx("div", { className: className, "data-tq-model": "", children: _jsx("model-viewer", { ref: ref, ...attrs, children: ar ? _jsx("button", { slot: "ar-button", type: "button", children: labels.viewInYourSpace }) : null }) }));
|
|
107
|
+
}
|
|
108
|
+
const open = () => {
|
|
109
|
+
if (state === 'loading')
|
|
110
|
+
return;
|
|
111
|
+
setState('loading');
|
|
112
|
+
loadModelViewer().then(() => setState('ready'), () => setState('failed'));
|
|
113
|
+
};
|
|
114
|
+
return (_jsxs("div", { className: className, "data-tq-model": "", "data-state": state, children: [fallback ?? (poster ? _jsx("img", { src: poster, alt: "", loading: "lazy", decoding: "async" }) : null), _jsx("button", { type: "button", onClick: open, disabled: state === 'loading', "aria-label": label ? `${labels.view3d}: ${label}` : labels.view3d, children: state === 'loading' ? labels.loading3d : state === 'failed' ? labels.unavailable : labels.view3d })] }));
|
|
115
|
+
}
|
package/dist/headless/money.d.ts
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Money as a shopper reads it, in the currency's own minor units (JPY 0 decimals, THB 2, KWD 3).
|
|
3
|
-
*
|
|
4
|
-
* Deterministic on purpose: the server render and the hydrating browser must print the same characters, and
|
|
5
|
-
* `Intl.NumberFormat` currency output differs between engines (symbols, spaces, narrow no-break spaces). The
|
|
6
|
-
* digits are grouped by hand; only the number of decimals is read from `Intl` (ISO 4217 data every engine shares)
|
|
7
|
-
* for a currency the kit has no entry for.
|
|
8
|
-
*/
|
|
9
1
|
/** A price: `amount` as the data plane sends it (a decimal string) or as the theme types use it (a number). */
|
|
10
2
|
export interface MoneyLike {
|
|
11
3
|
amount: number | string;
|
|
12
4
|
currencyCode: string;
|
|
13
5
|
}
|
|
14
|
-
/** Minor units of an ISO 4217 currency (0 for JPY, 2 for USD/THB, 3 for KWD). */
|
|
6
|
+
/** Minor units of an ISO 4217 currency, as amounts carry them (0 for JPY, 2 for USD/THB/IDR, 3 for KWD). */
|
|
15
7
|
export declare function currencyDecimals(currencyCode: string): number;
|
|
16
8
|
/** The symbol the kit prints for a currency, or '' when it prints the code instead. */
|
|
17
9
|
export declare function currencySymbol(currencyCode: string): string;
|
package/dist/headless/money.js
CHANGED
|
@@ -3,32 +3,31 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Deterministic on purpose: the server render and the hydrating browser must print the same characters, and
|
|
5
5
|
* `Intl.NumberFormat` currency output differs between engines (symbols, spaces, narrow no-break spaces). The
|
|
6
|
-
* digits are grouped by hand
|
|
7
|
-
*
|
|
6
|
+
* digits are grouped by hand. How many decimals: the platform's one currency table (@tanqory/money, generated copy
|
|
7
|
+
* tanqory-money.generated.ts; docs/STANDARDS.md API-6): ISO 4217's, except HUF, IDR and TWD, which are shown in whole
|
|
8
|
+
* units (CLDR display digits). Never Intl's, which differ by engine and give CLDR's digits for amounts (IQD 0).
|
|
8
9
|
*/
|
|
10
|
+
import { currencyDigits, displayAmount } from './tanqory-money.generated.js';
|
|
9
11
|
const SYMBOLS = {
|
|
10
12
|
USD: '$', THB: '฿', EUR: '€', GBP: '£', JPY: '¥', KRW: '₩', VND: '₫', IDR: 'Rp', SGD: 'S$', HKD: 'HK$', TWD: 'NT$',
|
|
11
13
|
AUD: 'A$', CAD: 'CA$', NZD: 'NZ$', CNY: 'CN¥', INR: '₹', MYR: 'RM', PHP: '₱', CHF: 'CHF ', SEK: 'kr ', NOK: 'kr ',
|
|
12
14
|
DKK: 'kr ', MXN: 'MX$', BRL: 'R$', AED: 'AED ', SAR: 'SAR ', ILS: '₪', TRY: '₺', PLN: 'zł ', ZAR: 'R ',
|
|
13
15
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (!/^[A-Z]{3}$/.test(code))
|
|
24
|
-
return 2;
|
|
25
|
-
try {
|
|
26
|
-
const d = new Intl.NumberFormat('en', { style: 'currency', currency: code }).resolvedOptions().maximumFractionDigits;
|
|
27
|
-
return typeof d === 'number' && d >= 0 && d <= 4 ? d : 2;
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
return 2;
|
|
16
|
+
/** The amount as shown, exact: its text when it is a decimal, else the number's; null when neither is (1e400). */
|
|
17
|
+
function fixedOf(amount, n, code) {
|
|
18
|
+
for (const v of [amount, n]) {
|
|
19
|
+
try {
|
|
20
|
+
return displayAmount(v, code);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// the next form, then none
|
|
24
|
+
}
|
|
31
25
|
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
/** Minor units of an ISO 4217 currency, as amounts carry them (0 for JPY, 2 for USD/THB/IDR, 3 for KWD). */
|
|
29
|
+
export function currencyDecimals(currencyCode) {
|
|
30
|
+
return currencyDigits(currencyCode);
|
|
32
31
|
}
|
|
33
32
|
/** The symbol the kit prints for a currency, or '' when it prints the code instead. */
|
|
34
33
|
export function currencySymbol(currencyCode) {
|
|
@@ -42,11 +41,14 @@ export function formatMoney(money, options = {}) {
|
|
|
42
41
|
const n = typeof money.amount === 'number' ? money.amount : Number(money.amount);
|
|
43
42
|
if (!Number.isFinite(n))
|
|
44
43
|
return `${money.amount} ${code}`.trim();
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
// Exact decimal text (a JS number's toFixed rounds 1.005 to 1.00); the number itself only when the text is not a decimal.
|
|
45
|
+
const fixed = fixedOf(money.amount, n, code);
|
|
46
|
+
if (fixed === null)
|
|
47
|
+
return `${money.amount} ${code}`.trim();
|
|
48
|
+
let [int, frac = ''] = fixed.replace(/^-/, '').split('.');
|
|
47
49
|
if (options.trimZeros && /^0*$/.test(frac))
|
|
48
50
|
frac = '';
|
|
49
|
-
const digits = `${
|
|
51
|
+
const digits = `${fixed.startsWith('-') ? '-' : ''}${int.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}${frac ? `.${frac}` : ''}`;
|
|
50
52
|
const symbol = SYMBOLS[code];
|
|
51
53
|
switch (options.display ?? 'symbol') {
|
|
52
54
|
case 'amount':
|
package/dist/headless/page.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ export interface HeadSink {
|
|
|
37
37
|
image?: string;
|
|
38
38
|
noindex?: boolean;
|
|
39
39
|
jsonLd: Record<string, unknown>[];
|
|
40
|
+
/** A `<ModelViewer>` rendered on this page (theme-abi §2.6): the page asserts `x-tq-media: model`. */
|
|
41
|
+
model?: boolean;
|
|
40
42
|
}
|
|
41
43
|
export declare const HeadSinkContext: import("react").Context<HeadSink | null>;
|
|
42
44
|
/** The page this component renders on (route, params, languages, assets, merchant wording). */
|