@tanqory/theme-kit 0.1.0 → 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.
Files changed (233) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -10
  3. package/dist/abi/canvas-live.d.ts +72 -0
  4. package/dist/abi/canvas-live.js +159 -0
  5. package/dist/abi/cart.d.ts +60 -0
  6. package/dist/abi/cart.js +396 -0
  7. package/dist/abi/convert.d.ts +360 -0
  8. package/dist/abi/convert.js +1330 -0
  9. package/dist/abi/data-api.d.ts +15 -0
  10. package/dist/abi/data-api.js +213 -0
  11. package/dist/abi/jcs.d.ts +6 -0
  12. package/dist/abi/jcs.js +28 -0
  13. package/dist/abi/labels.d.ts +3 -0
  14. package/dist/abi/labels.js +34 -0
  15. package/dist/abi/page-data.d.ts +264 -0
  16. package/dist/abi/page-data.js +746 -0
  17. package/dist/abi/page.d.ts +28 -0
  18. package/dist/abi/page.js +57 -0
  19. package/dist/abi/referrals.d.ts +23 -0
  20. package/dist/abi/referrals.js +89 -0
  21. package/dist/abi/rewards.d.ts +27 -0
  22. package/dist/abi/rewards.js +82 -0
  23. package/dist/abi/seo.d.ts +47 -0
  24. package/dist/abi/seo.js +68 -0
  25. package/dist/abi/shell.d.ts +23 -0
  26. package/dist/abi/shell.js +10 -0
  27. package/dist/abi/state-pack.d.ts +17 -0
  28. package/dist/abi/state-pack.js +43 -0
  29. package/dist/abi/wire.d.ts +46 -0
  30. package/dist/abi/wire.js +114 -0
  31. package/dist/build.d.ts +121 -0
  32. package/dist/build.js +401 -0
  33. package/dist/chunks.d.ts +23 -0
  34. package/dist/chunks.js +41 -0
  35. package/dist/client.d.ts +26 -0
  36. package/dist/client.js +101 -0
  37. package/dist/contract.d.ts +6 -0
  38. package/dist/contract.js +6 -0
  39. package/dist/headless/ai.d.ts +132 -0
  40. package/dist/headless/ai.js +99 -0
  41. package/dist/headless/hooks.d.ts +276 -0
  42. package/dist/headless/hooks.js +544 -0
  43. package/dist/headless/i18n.d.ts +13 -0
  44. package/dist/headless/i18n.js +45 -0
  45. package/dist/headless/index.d.ts +44 -0
  46. package/dist/headless/index.js +48 -0
  47. package/dist/headless/lazy-component.d.ts +72 -0
  48. package/dist/headless/lazy-component.js +225 -0
  49. package/dist/headless/lazy-section.d.ts +38 -0
  50. package/dist/headless/lazy-section.js +97 -0
  51. package/dist/headless/model.d.ts +73 -0
  52. package/dist/headless/model.js +115 -0
  53. package/dist/headless/money.d.ts +17 -0
  54. package/dist/headless/money.js +63 -0
  55. package/dist/headless/page.d.ts +45 -0
  56. package/dist/headless/page.js +53 -0
  57. package/dist/headless/platform.d.ts +55 -0
  58. package/dist/headless/platform.js +77 -0
  59. package/dist/headless/primitives/cart.d.ts +90 -0
  60. package/dist/headless/primitives/cart.js +153 -0
  61. package/dist/headless/primitives/collection.d.ts +68 -0
  62. package/dist/headless/primitives/collection.js +80 -0
  63. package/dist/headless/primitives/product.d.ts +101 -0
  64. package/dist/headless/primitives/product.js +117 -0
  65. package/dist/headless/primitives/storefront.d.ts +106 -0
  66. package/dist/headless/primitives/storefront.js +187 -0
  67. package/dist/headless/primitives/util.d.ts +19 -0
  68. package/dist/headless/primitives/util.js +42 -0
  69. package/dist/headless/strings.d.ts +9 -0
  70. package/dist/headless/strings.js +198 -0
  71. package/dist/headless/structured-data.d.ts +31 -0
  72. package/dist/headless/structured-data.js +57 -0
  73. package/dist/headless/tanqory-money.generated.d.ts +493 -0
  74. package/dist/headless/tanqory-money.generated.js +507 -0
  75. package/dist/headless/theme.d.ts +109 -0
  76. package/dist/headless/theme.js +62 -0
  77. package/dist/index.d.ts +21 -0
  78. package/dist/index.js +21 -553
  79. package/dist/runtime/data/StoreProvider.d.ts +84 -0
  80. package/dist/runtime/data/StoreProvider.js +380 -0
  81. package/dist/runtime/data/handle.d.ts +14 -0
  82. package/dist/runtime/data/handle.js +16 -0
  83. package/dist/runtime/data/routes.d.ts +87 -0
  84. package/dist/runtime/data/routes.js +158 -0
  85. package/dist/runtime/data/to-ui.d.ts +286 -0
  86. package/dist/runtime/data/to-ui.js +1009 -0
  87. package/dist/runtime/entries/register.d.ts +9 -0
  88. package/dist/runtime/entries/register.js +9 -0
  89. package/dist/runtime/entries/sections.d.ts +16 -0
  90. package/dist/runtime/entries/sections.js +19 -0
  91. package/dist/{types → runtime/kit}/SectionTree.d.ts +2 -1
  92. package/dist/runtime/kit/SectionTree.js +100 -0
  93. package/dist/runtime/kit/analytics.d.ts +63 -0
  94. package/dist/runtime/kit/analytics.js +250 -0
  95. package/dist/runtime/kit/cart.d.ts +222 -0
  96. package/dist/runtime/kit/cart.js +545 -0
  97. package/dist/{types → runtime/kit}/composition.d.ts +1 -1
  98. package/dist/runtime/kit/composition.js +3 -0
  99. package/dist/{types → runtime/kit}/config.d.ts +2 -2
  100. package/dist/runtime/kit/config.js +6 -0
  101. package/dist/runtime/kit/consent.d.ts +29 -0
  102. package/dist/runtime/kit/consent.js +159 -0
  103. package/dist/runtime/kit/contract/content.d.ts +213 -0
  104. package/dist/runtime/kit/contract/content.js +119 -0
  105. package/dist/runtime/kit/contract/field-types.d.ts +360 -0
  106. package/dist/runtime/kit/contract/field-types.js +216 -0
  107. package/dist/runtime/kit/contract/groups.d.ts +230 -0
  108. package/dist/runtime/kit/contract/groups.js +402 -0
  109. package/dist/runtime/kit/contract/index.d.ts +33 -0
  110. package/dist/runtime/kit/contract/index.js +33 -0
  111. package/dist/runtime/kit/contract/transform.d.ts +82 -0
  112. package/dist/runtime/kit/contract/transform.js +133 -0
  113. package/dist/runtime/kit/contract/validate.d.ts +77 -0
  114. package/dist/runtime/kit/contract/validate.js +520 -0
  115. package/dist/runtime/kit/data.d.ts +732 -0
  116. package/dist/runtime/kit/data.js +1131 -0
  117. package/dist/{types → runtime/kit}/defineSection.d.ts +1 -1
  118. package/dist/runtime/kit/defineSection.js +10 -0
  119. package/dist/runtime/kit/dynamic-source.d.ts +118 -0
  120. package/dist/runtime/kit/dynamic-source.js +311 -0
  121. package/dist/runtime/kit/index.d.ts +24 -0
  122. package/dist/runtime/kit/index.js +24 -0
  123. package/dist/{types → runtime/kit}/jsx-to-json.d.ts +1 -1
  124. package/dist/runtime/kit/jsx-to-json.js +28 -0
  125. package/dist/{types → runtime/kit}/mount.d.ts +25 -4
  126. package/dist/runtime/kit/mount.js +124 -0
  127. package/dist/{types → runtime/kit}/registry.d.ts +1 -1
  128. package/dist/runtime/kit/registry.js +12 -0
  129. package/dist/{types → runtime/kit}/ssg.d.ts +9 -3
  130. package/dist/runtime/kit/ssg.js +56 -0
  131. package/dist/runtime/kit/storefront.d.ts +652 -0
  132. package/dist/runtime/kit/storefront.js +723 -0
  133. package/dist/{types → runtime/kit}/theme-context.d.ts +8 -2
  134. package/dist/runtime/kit/theme-context.js +25 -0
  135. package/dist/runtime/kit/types.d.ts +155 -0
  136. package/dist/runtime/kit/types.js +1 -0
  137. package/dist/runtime/platform/TrackingPixels.d.ts +14 -0
  138. package/dist/runtime/platform/TrackingPixels.js +63 -0
  139. package/dist/runtime/platform/environment.d.ts +68 -0
  140. package/dist/runtime/platform/environment.js +85 -0
  141. package/dist/runtime/platform/locale.d.ts +27 -0
  142. package/dist/runtime/platform/locale.js +42 -0
  143. package/dist/runtime/platform/route-analytics.d.ts +15 -0
  144. package/dist/runtime/platform/route-analytics.js +72 -0
  145. package/dist/runtime/platform/safe-href.d.ts +25 -0
  146. package/dist/runtime/platform/safe-href.js +69 -0
  147. package/dist/runtime/platform/safe-values.d.ts +37 -0
  148. package/dist/runtime/platform/safe-values.js +140 -0
  149. package/dist/runtime/render/SectionRenderer.d.ts +4 -0
  150. package/dist/runtime/render/SectionRenderer.js +199 -0
  151. package/dist/runtime/render/listing-query.d.ts +52 -0
  152. package/dist/runtime/render/listing-query.js +122 -0
  153. package/dist/runtime/render/localized-copy.d.ts +86 -0
  154. package/dist/runtime/render/localized-copy.js +129 -0
  155. package/dist/runtime/render/product-listing.d.ts +11 -0
  156. package/dist/runtime/render/product-listing.js +243 -0
  157. package/dist/runtime/render/resolved.d.ts +47 -0
  158. package/dist/runtime/render/resolved.js +80 -0
  159. package/dist/runtime/render/section-actions.d.ts +67 -0
  160. package/dist/runtime/render/section-actions.js +205 -0
  161. package/dist/runtime/render/starter.d.ts +11 -0
  162. package/dist/runtime/render/starter.js +96 -0
  163. package/dist/runtime/seo/head.d.ts +115 -0
  164. package/dist/runtime/seo/head.js +281 -0
  165. package/dist/runtime/seo/structured-data.d.ts +83 -0
  166. package/dist/runtime/seo/structured-data.js +252 -0
  167. package/dist/runtime/shell/PageShell.d.ts +18 -0
  168. package/dist/runtime/shell/PageShell.js +118 -0
  169. package/dist/runtime/shell/RuntimeBridge.d.ts +18 -0
  170. package/dist/runtime/shell/RuntimeBridge.js +124 -0
  171. package/dist/runtime/shell/overlay-state.d.ts +31 -0
  172. package/dist/runtime/shell/overlay-state.js +59 -0
  173. package/dist/runtime/shell/preview-mode.d.ts +2 -0
  174. package/dist/runtime/shell/preview-mode.js +11 -0
  175. package/dist/runtime/shell/spa-router.d.ts +14 -0
  176. package/dist/runtime/shell/spa-router.js +76 -0
  177. package/dist/runtime/shell/url-redirects.d.ts +6 -0
  178. package/dist/runtime/shell/url-redirects.js +37 -0
  179. package/dist/runtime/slots.d.ts +74 -0
  180. package/dist/runtime/slots.js +16 -0
  181. package/dist/runtime.d.ts +34 -0
  182. package/dist/runtime.js +40 -0
  183. package/dist/sdk/app-block.d.ts +29 -0
  184. package/dist/sdk/app-block.js +22 -0
  185. package/dist/sdk/font-hooks.d.ts +7 -0
  186. package/dist/sdk/font-hooks.js +21 -0
  187. package/dist/sdk/fonts.d.ts +144 -0
  188. package/dist/sdk/fonts.js +241 -0
  189. package/dist/sdk/index.d.ts +32 -0
  190. package/dist/sdk/index.js +36 -0
  191. package/dist/sdk/motion-hooks.d.ts +23 -0
  192. package/dist/sdk/motion-hooks.js +46 -0
  193. package/dist/sdk/motion.d.ts +78 -0
  194. package/dist/sdk/motion.js +292 -0
  195. package/dist/sdk/referrals.d.ts +62 -0
  196. package/dist/sdk/referrals.js +20 -0
  197. package/dist/sdk/rewards.d.ts +85 -0
  198. package/dist/sdk/rewards.js +29 -0
  199. package/dist/sdk/runtime-context.d.ts +230 -0
  200. package/dist/sdk/runtime-context.js +73 -0
  201. package/dist/sdk/schema.d.ts +249 -0
  202. package/dist/sdk/schema.js +168 -0
  203. package/dist/sdk/server-render.d.ts +8 -0
  204. package/dist/sdk/server-render.js +12 -0
  205. package/dist/sdk/store-lookup.d.ts +32 -0
  206. package/dist/sdk/store-lookup.js +48 -0
  207. package/dist/sdk/store.d.ts +164 -0
  208. package/dist/sdk/store.js +5 -0
  209. package/dist/sdk/sx.d.ts +45 -0
  210. package/dist/sdk/sx.js +117 -0
  211. package/dist/sdk/theme.d.ts +212 -0
  212. package/dist/sdk/theme.js +27 -0
  213. package/dist/sdk/types.d.ts +789 -0
  214. package/dist/sdk/types.js +7 -0
  215. package/dist/server.d.ts +112 -0
  216. package/dist/server.js +589 -0
  217. package/dist/vite-chunks.d.ts +10 -0
  218. package/dist/vite-chunks.js +44 -0
  219. package/docs/headless-api.md +250 -0
  220. package/package.json +72 -26
  221. package/dist/index.js.map +0 -1
  222. package/dist/ssg-BZ5FYTw7.js +0 -1802
  223. package/dist/ssg-BZ5FYTw7.js.map +0 -1
  224. package/dist/ssg.js +0 -8
  225. package/dist/ssg.js.map +0 -1
  226. package/dist/types/cart.d.ts +0 -86
  227. package/dist/types/data.d.ts +0 -357
  228. package/dist/types/dynamic-source.d.ts +0 -84
  229. package/dist/types/editor.d.ts +0 -5
  230. package/dist/types/index.d.ts +0 -20
  231. package/dist/types/preview-bridge.d.ts +0 -9
  232. package/dist/types/storefront.d.ts +0 -333
  233. package/dist/types/types.d.ts +0 -44
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The data Nova components receive. Components are presentational: they never
3
+ * fetch. A storefront adapter maps Tanqory API payloads onto these shapes; the
4
+ * lab maps fixtures onto them. Optional means "a real store can lack it" —
5
+ * every component must render (or deliberately render nothing) without it.
6
+ */
7
+ export const SOCIAL_NETWORKS = ['instagram', 'facebook', 'x', 'tiktok', 'youtube'];
@@ -0,0 +1,112 @@
1
+ import type { GiftCardBalance } from './sdk/types.js';
2
+ import type { RenderContext, ThemeManifest } from '@tanqory/theme-abi';
3
+ import { type ThemeBundle } from './runtime/slots.js';
4
+ import type { ContentNode } from './runtime/kit/types.js';
5
+ import type { Shop } from './runtime/kit/storefront.js';
6
+ import type { PagePlanOptions } from './abi/page-data.js';
7
+ type Settings = Record<string, unknown>;
8
+ export interface RenderOptions {
9
+ /** The theme's ABI manifest — the same object the entry exports as `manifest`. */
10
+ manifest: ThemeManifest;
11
+ /** The theme: its definition, starter content and locales (store-independent, module scope). */
12
+ bundle: ThemeBundle;
13
+ /**
14
+ * The global settings the theme renders with, from the manifest defaults merged with the store's
15
+ * saved values. Runs before anything else; the result is also what the browser hydrates with.
16
+ * Default: unchanged.
17
+ */
18
+ effectiveSettings?(settings: Settings): Settings;
19
+ /**
20
+ * The page's section nodes as they render under these settings (e.g. a global setting filling a
21
+ * section's own empty one). Pure; runs on the server and again in the browser (`hydrate`), so both
22
+ * build the same tree. Default: unchanged.
23
+ */
24
+ transformNodes?(nodes: ContentNode[], settings: Settings): ContentNode[];
25
+ /**
26
+ * The settings once the store's shop record is loaded (e.g. the shop's brand colour as the theme
27
+ * colour's fallback). Default: unchanged.
28
+ */
29
+ shopSettings?(settings: Settings, shop: Shop): Settings;
30
+ /**
31
+ * `<link rel="alternate" hreflang>` for every language the store publishes (`<canonical>?locale=<language>`),
32
+ * plus `x-default` (the canonical URL), on a 200 page of a store with two or more languages (abi/seo.ts
33
+ * `hreflangAlternates`). Default true (2.0.0-alpha.2); `false` leaves them out.
34
+ */
35
+ hreflang?: boolean;
36
+ /**
37
+ * NEW-PROD-2 (storefront-query rev 2.52): the CSP style hashes of the 3D viewer the theme ships (e.g. the
38
+ * `<style>` its custom element puts in its shadow root, which no theme `<style>` hash can cover). Announced
39
+ * (`x-tq-csp-style-hash`) only on a page whose product has a 3D model. Default: none.
40
+ */
41
+ modelViewerStyleHashes?: readonly string[];
42
+ /**
43
+ * The storefront extras a theme written against `@tanqory/theme-kit/headless` relies on. Absent (Nova, and every
44
+ * theme built on 2.0.0-alpha.0): the render is exactly the earlier one. Present (`storefront: {}` is enough),
45
+ * every member defaults to on unless it says otherwise.
46
+ */
47
+ storefront?: StorefrontOptions;
48
+ }
49
+ /** `RenderOptions.storefront`. */
50
+ export interface StorefrontOptions {
51
+ /** BreadcrumbList JSON-LD on product, collection, page and article pages, and CollectionPage JSON-LD on a collection. Default true. */
52
+ structuredData?: boolean;
53
+ /**
54
+ * The merchant's dashboard wording for the theme's strings (`ctx.data.localization.strings`), used by `t()`
55
+ * from the headless API. One data call, made beside the page's first round. Default true.
56
+ */
57
+ merchantStrings?: boolean;
58
+ /**
59
+ * Data the page loads whatever its sections are called. Default: none of them, so a page that shows no market
60
+ * selector does not vary on the shopper's country.
61
+ */
62
+ plan?: Omit<PagePlanOptions, 'reservedCalls'>;
63
+ }
64
+ export type RenderFunction = (request: Request, ctx: RenderContext) => Promise<Response>;
65
+ /**
66
+ * NEW-OS-11 "Instant page transitions": under ABI v2 every navigation is a full page load (abi/shell.tsx),
67
+ * so the theme setting `enableSpaNavigation` turns on CROSS-DOCUMENT view transitions instead: the browser
68
+ * cross-fades the next server-rendered page in place of a white flash (Chrome/Edge 126+, Safari 18.2+;
69
+ * others load normally). Live storefront only, never the editor canvas, and none for reduced motion.
70
+ * Inline <style>, so it is announced by hash like every other block (no CSP change).
71
+ */
72
+ export declare const VIEW_TRANSITIONS_ID = "tq-view-transitions";
73
+ export declare const VIEW_TRANSITIONS_CSS: string;
74
+ /**
75
+ * The gift card balance view the `gift-card-balance` form answers (NEW-PROD-12), member by member, or null when the
76
+ * answer is not that shape: the theme never sees a code, a buyer or anything the lookup does not promise.
77
+ */
78
+ export declare function giftCardBalanceOf(v: unknown): GiftCardBalance | null;
79
+ /**
80
+ * The ABI `render(request, ctx)` for one theme. Call it once at module scope: it hands the theme
81
+ * bundle to the runtime and registers the theme's sections (store-independent state only).
82
+ */
83
+ export declare function createRender(options: RenderOptions): RenderFunction;
84
+ /**
85
+ * The hints the storefront gateway acts on (storefront-edge core/platform-hints.ts); it drops every `x-tq-*` before the
86
+ * page leaves, so a browser never sees them. Live only, except `x-tq-media: model`.
87
+ * x-tq-speculation: on NEW-OS-11 part 2 — `enableSpaNavigation` is not off: the gateway adds its
88
+ * `Speculation-Rules` header, so hovering a link prerenders the next page.
89
+ * x-tq-turnstile: on A4 — the store's spam protection asks for the Turnstile widget on a form this theme can show
90
+ * (`shop.spamProtection`, either switch): the gateway allows Cloudflare Turnstile in the CSP.
91
+ * x-tq-media: video, model NEW-PROD-2 — a product on the page has a YouTube / Vimeo video (the gateway frames
92
+ * `www.youtube-nocookie.com` and `player.vimeo.com`) and/or a 3D model (`connect-src blob:`).
93
+ * In the editor canvas / a draft preview only `x-tq-media: model`: the 3D viewer runs there too (the gateway honours
94
+ * `model` on a preview host and ignores the rest, core/platform-hints.ts says why).
95
+ */
96
+ export declare function platformHints(preview: boolean, settings: Record<string, unknown>, shop: Pick<Shop, 'spamProtection'> | null | undefined, products?: readonly {
97
+ media?: readonly {
98
+ type?: string;
99
+ }[] | null;
100
+ }[], modelRendered?: boolean): Record<string, string>;
101
+ /** Which kinds of third-party / 3D media the page's products carry (kit `ProductMedia.type`). */
102
+ export declare function pageMedia(products: readonly {
103
+ media?: readonly {
104
+ type?: string;
105
+ }[] | null;
106
+ }[]): {
107
+ video: boolean;
108
+ model: boolean;
109
+ };
110
+ export type { ThemeBundle } from './runtime/slots.js';
111
+ export type { ContentNode } from './runtime/kit/types.js';
112
+ export type { PageData, NativeFormResult } from './abi/page-data.js';