@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.
- package/LICENSE +21 -0
- package/README.md +128 -10
- package/dist/abi/canvas-live.d.ts +72 -0
- package/dist/abi/canvas-live.js +159 -0
- package/dist/abi/cart.d.ts +60 -0
- package/dist/abi/cart.js +396 -0
- package/dist/abi/convert.d.ts +360 -0
- package/dist/abi/convert.js +1330 -0
- package/dist/abi/data-api.d.ts +15 -0
- package/dist/abi/data-api.js +213 -0
- package/dist/abi/jcs.d.ts +6 -0
- package/dist/abi/jcs.js +28 -0
- package/dist/abi/labels.d.ts +3 -0
- package/dist/abi/labels.js +34 -0
- package/dist/abi/page-data.d.ts +264 -0
- package/dist/abi/page-data.js +746 -0
- package/dist/abi/page.d.ts +28 -0
- package/dist/abi/page.js +57 -0
- package/dist/abi/referrals.d.ts +23 -0
- package/dist/abi/referrals.js +89 -0
- package/dist/abi/rewards.d.ts +27 -0
- package/dist/abi/rewards.js +82 -0
- package/dist/abi/seo.d.ts +47 -0
- package/dist/abi/seo.js +68 -0
- package/dist/abi/shell.d.ts +23 -0
- package/dist/abi/shell.js +10 -0
- package/dist/abi/state-pack.d.ts +17 -0
- package/dist/abi/state-pack.js +43 -0
- package/dist/abi/wire.d.ts +46 -0
- package/dist/abi/wire.js +114 -0
- package/dist/build.d.ts +121 -0
- package/dist/build.js +401 -0
- package/dist/chunks.d.ts +23 -0
- package/dist/chunks.js +41 -0
- package/dist/client.d.ts +26 -0
- package/dist/client.js +101 -0
- package/dist/contract.d.ts +6 -0
- package/dist/contract.js +6 -0
- package/dist/headless/ai.d.ts +132 -0
- package/dist/headless/ai.js +99 -0
- package/dist/headless/hooks.d.ts +276 -0
- package/dist/headless/hooks.js +544 -0
- package/dist/headless/i18n.d.ts +13 -0
- package/dist/headless/i18n.js +45 -0
- package/dist/headless/index.d.ts +44 -0
- package/dist/headless/index.js +48 -0
- 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 +17 -0
- package/dist/headless/money.js +63 -0
- package/dist/headless/page.d.ts +45 -0
- package/dist/headless/page.js +53 -0
- package/dist/headless/platform.d.ts +55 -0
- package/dist/headless/platform.js +77 -0
- package/dist/headless/primitives/cart.d.ts +90 -0
- package/dist/headless/primitives/cart.js +153 -0
- package/dist/headless/primitives/collection.d.ts +68 -0
- package/dist/headless/primitives/collection.js +80 -0
- package/dist/headless/primitives/product.d.ts +101 -0
- package/dist/headless/primitives/product.js +117 -0
- package/dist/headless/primitives/storefront.d.ts +106 -0
- package/dist/headless/primitives/storefront.js +187 -0
- package/dist/headless/primitives/util.d.ts +19 -0
- package/dist/headless/primitives/util.js +42 -0
- package/dist/headless/strings.d.ts +9 -0
- package/dist/headless/strings.js +198 -0
- package/dist/headless/structured-data.d.ts +31 -0
- package/dist/headless/structured-data.js +57 -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 +109 -0
- package/dist/headless/theme.js +62 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +21 -553
- package/dist/runtime/data/StoreProvider.d.ts +84 -0
- package/dist/runtime/data/StoreProvider.js +380 -0
- package/dist/runtime/data/handle.d.ts +14 -0
- package/dist/runtime/data/handle.js +16 -0
- package/dist/runtime/data/routes.d.ts +87 -0
- package/dist/runtime/data/routes.js +158 -0
- package/dist/runtime/data/to-ui.d.ts +286 -0
- package/dist/runtime/data/to-ui.js +1009 -0
- package/dist/runtime/entries/register.d.ts +9 -0
- package/dist/runtime/entries/register.js +9 -0
- package/dist/runtime/entries/sections.d.ts +16 -0
- package/dist/runtime/entries/sections.js +19 -0
- package/dist/{types → runtime/kit}/SectionTree.d.ts +2 -1
- package/dist/runtime/kit/SectionTree.js +100 -0
- package/dist/runtime/kit/analytics.d.ts +63 -0
- package/dist/runtime/kit/analytics.js +250 -0
- package/dist/runtime/kit/cart.d.ts +222 -0
- package/dist/runtime/kit/cart.js +545 -0
- package/dist/{types → runtime/kit}/composition.d.ts +1 -1
- package/dist/runtime/kit/composition.js +3 -0
- package/dist/{types → runtime/kit}/config.d.ts +2 -2
- package/dist/runtime/kit/config.js +6 -0
- package/dist/runtime/kit/consent.d.ts +29 -0
- package/dist/runtime/kit/consent.js +159 -0
- package/dist/runtime/kit/contract/content.d.ts +213 -0
- package/dist/runtime/kit/contract/content.js +119 -0
- package/dist/runtime/kit/contract/field-types.d.ts +360 -0
- package/dist/runtime/kit/contract/field-types.js +216 -0
- package/dist/runtime/kit/contract/groups.d.ts +230 -0
- package/dist/runtime/kit/contract/groups.js +402 -0
- package/dist/runtime/kit/contract/index.d.ts +33 -0
- package/dist/runtime/kit/contract/index.js +33 -0
- package/dist/runtime/kit/contract/transform.d.ts +82 -0
- package/dist/runtime/kit/contract/transform.js +133 -0
- package/dist/runtime/kit/contract/validate.d.ts +77 -0
- package/dist/runtime/kit/contract/validate.js +520 -0
- package/dist/runtime/kit/data.d.ts +732 -0
- package/dist/runtime/kit/data.js +1131 -0
- package/dist/{types → runtime/kit}/defineSection.d.ts +1 -1
- package/dist/runtime/kit/defineSection.js +10 -0
- package/dist/runtime/kit/dynamic-source.d.ts +118 -0
- package/dist/runtime/kit/dynamic-source.js +311 -0
- package/dist/runtime/kit/index.d.ts +24 -0
- package/dist/runtime/kit/index.js +24 -0
- package/dist/{types → runtime/kit}/jsx-to-json.d.ts +1 -1
- package/dist/runtime/kit/jsx-to-json.js +28 -0
- package/dist/{types → runtime/kit}/mount.d.ts +25 -4
- package/dist/runtime/kit/mount.js +124 -0
- package/dist/{types → runtime/kit}/registry.d.ts +1 -1
- package/dist/runtime/kit/registry.js +12 -0
- package/dist/{types → runtime/kit}/ssg.d.ts +9 -3
- package/dist/runtime/kit/ssg.js +56 -0
- package/dist/runtime/kit/storefront.d.ts +652 -0
- package/dist/runtime/kit/storefront.js +723 -0
- package/dist/{types → runtime/kit}/theme-context.d.ts +8 -2
- package/dist/runtime/kit/theme-context.js +25 -0
- package/dist/runtime/kit/types.d.ts +155 -0
- package/dist/runtime/kit/types.js +1 -0
- package/dist/runtime/platform/TrackingPixels.d.ts +14 -0
- package/dist/runtime/platform/TrackingPixels.js +63 -0
- package/dist/runtime/platform/environment.d.ts +68 -0
- package/dist/runtime/platform/environment.js +85 -0
- package/dist/runtime/platform/locale.d.ts +27 -0
- package/dist/runtime/platform/locale.js +42 -0
- package/dist/runtime/platform/route-analytics.d.ts +15 -0
- package/dist/runtime/platform/route-analytics.js +72 -0
- package/dist/runtime/platform/safe-href.d.ts +25 -0
- package/dist/runtime/platform/safe-href.js +69 -0
- package/dist/runtime/platform/safe-values.d.ts +37 -0
- package/dist/runtime/platform/safe-values.js +140 -0
- package/dist/runtime/render/SectionRenderer.d.ts +4 -0
- package/dist/runtime/render/SectionRenderer.js +199 -0
- package/dist/runtime/render/listing-query.d.ts +52 -0
- package/dist/runtime/render/listing-query.js +122 -0
- package/dist/runtime/render/localized-copy.d.ts +86 -0
- package/dist/runtime/render/localized-copy.js +129 -0
- package/dist/runtime/render/product-listing.d.ts +11 -0
- package/dist/runtime/render/product-listing.js +243 -0
- 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 +67 -0
- package/dist/runtime/render/section-actions.js +205 -0
- package/dist/runtime/render/starter.d.ts +11 -0
- package/dist/runtime/render/starter.js +96 -0
- package/dist/runtime/seo/head.d.ts +115 -0
- package/dist/runtime/seo/head.js +281 -0
- package/dist/runtime/seo/structured-data.d.ts +83 -0
- package/dist/runtime/seo/structured-data.js +252 -0
- package/dist/runtime/shell/PageShell.d.ts +18 -0
- package/dist/runtime/shell/PageShell.js +118 -0
- package/dist/runtime/shell/RuntimeBridge.d.ts +18 -0
- package/dist/runtime/shell/RuntimeBridge.js +124 -0
- package/dist/runtime/shell/overlay-state.d.ts +31 -0
- package/dist/runtime/shell/overlay-state.js +59 -0
- package/dist/runtime/shell/preview-mode.d.ts +2 -0
- package/dist/runtime/shell/preview-mode.js +11 -0
- package/dist/runtime/shell/spa-router.d.ts +14 -0
- package/dist/runtime/shell/spa-router.js +76 -0
- package/dist/runtime/shell/url-redirects.d.ts +6 -0
- package/dist/runtime/shell/url-redirects.js +37 -0
- package/dist/runtime/slots.d.ts +74 -0
- package/dist/runtime/slots.js +16 -0
- package/dist/runtime.d.ts +34 -0
- package/dist/runtime.js +40 -0
- package/dist/sdk/app-block.d.ts +29 -0
- package/dist/sdk/app-block.js +22 -0
- 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 +32 -0
- package/dist/sdk/index.js +36 -0
- 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/referrals.d.ts +62 -0
- package/dist/sdk/referrals.js +20 -0
- package/dist/sdk/rewards.d.ts +85 -0
- package/dist/sdk/rewards.js +29 -0
- package/dist/sdk/runtime-context.d.ts +230 -0
- package/dist/sdk/runtime-context.js +73 -0
- package/dist/sdk/schema.d.ts +249 -0
- package/dist/sdk/schema.js +168 -0
- package/dist/sdk/server-render.d.ts +8 -0
- package/dist/sdk/server-render.js +12 -0
- package/dist/sdk/store-lookup.d.ts +32 -0
- package/dist/sdk/store-lookup.js +48 -0
- package/dist/sdk/store.d.ts +164 -0
- package/dist/sdk/store.js +5 -0
- package/dist/sdk/sx.d.ts +45 -0
- package/dist/sdk/sx.js +117 -0
- package/dist/sdk/theme.d.ts +212 -0
- package/dist/sdk/theme.js +27 -0
- package/dist/sdk/types.d.ts +789 -0
- package/dist/sdk/types.js +7 -0
- package/dist/server.d.ts +112 -0
- package/dist/server.js +589 -0
- package/dist/vite-chunks.d.ts +10 -0
- package/dist/vite-chunks.js +44 -0
- package/docs/headless-api.md +250 -0
- package/package.json +72 -26
- package/dist/index.js.map +0 -1
- package/dist/ssg-BZ5FYTw7.js +0 -1802
- package/dist/ssg-BZ5FYTw7.js.map +0 -1
- package/dist/ssg.js +0 -8
- package/dist/ssg.js.map +0 -1
- package/dist/types/cart.d.ts +0 -86
- package/dist/types/data.d.ts +0 -357
- package/dist/types/dynamic-source.d.ts +0 -84
- package/dist/types/editor.d.ts +0 -5
- package/dist/types/index.d.ts +0 -20
- package/dist/types/preview-bridge.d.ts +0 -9
- package/dist/types/storefront.d.ts +0 -333
- package/dist/types/types.d.ts +0 -44
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a theme describes itself to the platform: its sections and its shell.
|
|
3
|
+
*
|
|
4
|
+
* export default defineTheme({ name, sections, Provider, Layout, labels })
|
|
5
|
+
*
|
|
6
|
+
* The theme compiler reads this to build the editor's catalog; the theme
|
|
7
|
+
* runtime reads it to render pages. Neither needs anything else from the theme.
|
|
8
|
+
*/
|
|
9
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
10
|
+
import type { Field, Schema } from './schema.js';
|
|
11
|
+
import type { SavedSection, StoreContext } from './store.js';
|
|
12
|
+
import type { ThemeActions, ThemeContextValue, ThemeMode } from './runtime-context.js';
|
|
13
|
+
export type SectionZone = 'header' | 'main' | 'footer';
|
|
14
|
+
export interface SectionPreset {
|
|
15
|
+
name: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
settings: Record<string, unknown>;
|
|
18
|
+
blocks?: {
|
|
19
|
+
type: string;
|
|
20
|
+
settings?: Record<string, unknown>;
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
/** What a section's data binding receives besides the saved node and the store. */
|
|
24
|
+
import { type ResolvedNode } from '../runtime/render/resolved.js';
|
|
25
|
+
/**
|
|
26
|
+
* The key a block's resolution is filed under in `binding.resolved.blocks`: the block's id, else `#<its position in its
|
|
27
|
+
* parent as saved>`. Pass the saved block `data()` received and its index in that list: the kit keeps the block's
|
|
28
|
+
* saved position on it, so an id-less block finds its resolution on the server (which hands `data()` the list without
|
|
29
|
+
* starter blocks) and in the browser (which hands it the list as saved) alike.
|
|
30
|
+
*/
|
|
31
|
+
export { blockKey as resolvedBlockKey } from '../runtime/render/resolved.js';
|
|
32
|
+
export interface SectionBindingContext {
|
|
33
|
+
/** The platform actions (for callback props: add to cart, search …). */
|
|
34
|
+
actions: ThemeActions;
|
|
35
|
+
/** Page state (cart line status, mode, locale). */
|
|
36
|
+
context: ThemeContextValue;
|
|
37
|
+
/** The page this section is on. */
|
|
38
|
+
page: {
|
|
39
|
+
/** The first section of the page body (a header over a hero goes transparent). */
|
|
40
|
+
firstBodySection: SavedSection | null;
|
|
41
|
+
/** This section is that first body section. */
|
|
42
|
+
isFirstBodySection: boolean;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* This node's settings as `resolveSettings` returns them (with the section's schema and its block schemas), and its
|
|
46
|
+
* blocks' by block id (or `#<index>`). theme-abi-v2 §2.2.2: the server resolves; in the browser the kit takes the
|
|
47
|
+
* page state's copy, so `data()` can read `resolved` instead of resolving with an imported schema, and a section
|
|
48
|
+
* defined with `defineClientSection` ships no schema to shoppers.
|
|
49
|
+
*/
|
|
50
|
+
resolved?: ResolvedNode;
|
|
51
|
+
}
|
|
52
|
+
export interface ThemeSection<P = any> {
|
|
53
|
+
/** The persisted section type — never changes once stores have saved it. */
|
|
54
|
+
id: string;
|
|
55
|
+
/** Settings (persisted ids, controls, defaults, legacy values). */
|
|
56
|
+
schema: Schema;
|
|
57
|
+
/**
|
|
58
|
+
* The block schemas this section accepts — one per name in `schema.blocks`
|
|
59
|
+
* and `schema.legacyBlocks`. The section owns its block contracts: the
|
|
60
|
+
* compiler reads blocks from here, never from a separate registry.
|
|
61
|
+
*/
|
|
62
|
+
blocks?: readonly Schema[];
|
|
63
|
+
component: ComponentType<P>;
|
|
64
|
+
/** Picker group. */
|
|
65
|
+
category: string;
|
|
66
|
+
/** Where the page places it: header zone, page body, footer zone. */
|
|
67
|
+
zone: SectionZone;
|
|
68
|
+
/** How the editor names it in "Add section". */
|
|
69
|
+
title?: string;
|
|
70
|
+
/** One line for the editor's picker: what it shows and when to use it. */
|
|
71
|
+
description?: string;
|
|
72
|
+
icon?: string;
|
|
73
|
+
/** Route context it needs (`product`, `collection`, `cart` …): offered only on templates that have it. */
|
|
74
|
+
requiresContext?: readonly string[];
|
|
75
|
+
/** Starting points "Add section" offers. */
|
|
76
|
+
presets?: readonly SectionPreset[];
|
|
77
|
+
/** Pages through a collection: the runtime adds paging (load more) to its props. */
|
|
78
|
+
listing?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Saved node + store data → the component's props. Absent: the resolved
|
|
81
|
+
* settings are the props.
|
|
82
|
+
*/
|
|
83
|
+
data?: (node: SavedSection, store: StoreContext, binding: SectionBindingContext) => P | null;
|
|
84
|
+
}
|
|
85
|
+
export interface ThemeProviderProps {
|
|
86
|
+
mode: ThemeMode;
|
|
87
|
+
locale: string;
|
|
88
|
+
/** The language the page's content is in (the request's), when the host knows it; `lang` follows it. */
|
|
89
|
+
contentLanguage?: string;
|
|
90
|
+
settings: Readonly<Record<string, unknown>>;
|
|
91
|
+
/**
|
|
92
|
+
* The merchant's words for the theme's own strings in the page's language (Settings > Languages > Translate, the
|
|
93
|
+
* theme's "Default theme content"; abi/labels.ts): string key -> text. A theme lays them over its locale file, so a
|
|
94
|
+
* language it ships no file for still reads in the shopper's language. Absent or empty: the theme's own words.
|
|
95
|
+
*/
|
|
96
|
+
labels?: Readonly<Record<string, string>>;
|
|
97
|
+
children: ReactNode;
|
|
98
|
+
}
|
|
99
|
+
export interface ThemeDefinition {
|
|
100
|
+
name: string;
|
|
101
|
+
/** Every section, in the editor picker's order. */
|
|
102
|
+
sections: readonly ThemeSection[];
|
|
103
|
+
/** Wraps every page and the editor's single-section preview: tokens, theme settings, strings. */
|
|
104
|
+
Provider: ComponentType<ThemeProviderProps>;
|
|
105
|
+
/** The page layout around the page's sections — and where page-level overlays render. */
|
|
106
|
+
Layout: ComponentType<{
|
|
107
|
+
children: ReactNode;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* Interface words the runtime needs for the breadcrumb trail, in a locale. Each key is also the key of the same word
|
|
111
|
+
* in the theme's locale files: the merchant's translation of that key (`ThemeProviderProps.labels`) wins over it.
|
|
112
|
+
*/
|
|
113
|
+
labels(locale: string): {
|
|
114
|
+
home: string;
|
|
115
|
+
collections?: string;
|
|
116
|
+
search?: string;
|
|
117
|
+
cart?: string;
|
|
118
|
+
account?: string;
|
|
119
|
+
};
|
|
120
|
+
/** External stylesheets every page loads in <head> (web fonts). */
|
|
121
|
+
stylesheets?: readonly string[];
|
|
122
|
+
/**
|
|
123
|
+
* Starter text: words that only tell the merchant what to write ("Describe
|
|
124
|
+
* your returns window.", "Customer name"). The editor shows them as they are;
|
|
125
|
+
* on the live storefront a section whose own settings still hold one is not
|
|
126
|
+
* rendered, and a block that holds one is left out — a shopper never reads an
|
|
127
|
+
* instruction, or a review nobody wrote. Exact strings, compared trimmed.
|
|
128
|
+
*/
|
|
129
|
+
starterText?: readonly string[];
|
|
130
|
+
/**
|
|
131
|
+
* Shipped copy: the English words this theme ships in setting defaults,
|
|
132
|
+
* starter templates and presets, as `<prefix>*` keys of its English locale
|
|
133
|
+
* map. A copy field whose value is exactly one of them (unset → its default)
|
|
134
|
+
* renders as that key in the page's locale; any other value is the
|
|
135
|
+
* merchant's and renders verbatim (runtime/render/localized-copy.ts).
|
|
136
|
+
*/
|
|
137
|
+
shippedCopy?: {
|
|
138
|
+
english: Readonly<Record<string, string>>;
|
|
139
|
+
prefix: string;
|
|
140
|
+
/** Fields whose renderer tests the value against the shipped English: never localized (`block:footer-brand.title`). */
|
|
141
|
+
keep?: readonly string[];
|
|
142
|
+
/** Fields whose unset value is derived from data: their default is never filled in (`block:footer-menu.heading`). */
|
|
143
|
+
derivedWhenUnset?: readonly string[];
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* The settings every section shares (width, spacing, background …), with the
|
|
147
|
+
* editor group of each — published so a custom section can fold them in.
|
|
148
|
+
*/
|
|
149
|
+
sharedSettings?: {
|
|
150
|
+
fields: Readonly<Record<string, Field>>;
|
|
151
|
+
groups?: Readonly<Record<string, string>>;
|
|
152
|
+
contentSlots?: readonly string[];
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/** One theme setting (config/settings.schema.ts): the control the editor's Theme panel shows. */
|
|
156
|
+
export interface SettingSpec {
|
|
157
|
+
type: 'text' | 'textarea' | 'richtext' | 'url' | 'color' | 'image' | 'select' | 'radio' | 'boolean' | 'range' | 'number' | 'menu' | 'list' | 'color_palette';
|
|
158
|
+
/**
|
|
159
|
+
* A `list` setting's element. A theme's colour palette is `color_palette` (field-type registry 3): named
|
|
160
|
+
* colours `{ name, color }`, at most 20; the editor offers them in every colour picker.
|
|
161
|
+
*/
|
|
162
|
+
items?: {
|
|
163
|
+
type: 'color';
|
|
164
|
+
};
|
|
165
|
+
label?: string;
|
|
166
|
+
/** Theme panel group. */
|
|
167
|
+
group?: string;
|
|
168
|
+
info?: string;
|
|
169
|
+
default?: unknown;
|
|
170
|
+
/**
|
|
171
|
+
* `group`: the option's heading in the editor's list (the font picker's System / Library).
|
|
172
|
+
* `scripts`: the writing systems a font option covers (`'latin'`, `'thai'`), shown as a tag in the font picker.
|
|
173
|
+
* Both are editor-only: the ABI manifest keeps `{ value, label }`.
|
|
174
|
+
*/
|
|
175
|
+
options?: {
|
|
176
|
+
value: string;
|
|
177
|
+
label: string;
|
|
178
|
+
group?: string;
|
|
179
|
+
scripts?: readonly string[];
|
|
180
|
+
}[];
|
|
181
|
+
/**
|
|
182
|
+
* How the editor draws a select: `font` = the font picker (search, system fonts, the hosted library);
|
|
183
|
+
* `color_scheme` = the scheme picker, each option shown with its colours (`swatches`). Editor-only.
|
|
184
|
+
*/
|
|
185
|
+
control?: 'font' | 'color_scheme';
|
|
186
|
+
/** A font setting's weight: the id of the select setting that holds it (the font picker's Weight). Editor-only. */
|
|
187
|
+
weight_setting?: string;
|
|
188
|
+
/** A `color_scheme` select's colours per option (`setting` = this setting's id). Editor-only. */
|
|
189
|
+
swatches?: {
|
|
190
|
+
setting: string;
|
|
191
|
+
colours: {
|
|
192
|
+
label: string;
|
|
193
|
+
values: Record<string, string>;
|
|
194
|
+
}[];
|
|
195
|
+
};
|
|
196
|
+
min?: number;
|
|
197
|
+
/** `range` / `number`: the largest value. `list` / `color_palette`: the most entries. */
|
|
198
|
+
max?: number;
|
|
199
|
+
step?: number;
|
|
200
|
+
unit?: string;
|
|
201
|
+
placeholder?: string;
|
|
202
|
+
}
|
|
203
|
+
/** Declare the theme's settings (the Theme panel). */
|
|
204
|
+
export declare function defineSettings<T extends Record<string, SettingSpec>>(settings: T): T;
|
|
205
|
+
export declare function defineTheme(theme: ThemeDefinition): ThemeDefinition;
|
|
206
|
+
export declare function defineSection<P>(section: ThemeSection<P>): ThemeSection<P>;
|
|
207
|
+
/**
|
|
208
|
+
* A section for the shopper bundle (theme-abi-v2 §2.2.2): its id, component and `data()` only, with no schema, presets
|
|
209
|
+
* or block metadata. Its `data()` reads `binding.resolved` (the server's resolution, from the page state). The full
|
|
210
|
+
* definition (`defineSection`) stays the theme's source of truth for the server, the editor and the manifest.
|
|
211
|
+
*/
|
|
212
|
+
export declare function defineClientSection<P>(section: Pick<ThemeSection<P>, 'id' | 'component' | 'data'> & Partial<Pick<ThemeSection<P>, 'category' | 'zone' | 'listing'>>): ThemeSection<P>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** What a section's data binding receives besides the saved node and the store. */
|
|
2
|
+
import { CLIENT_ONLY_SCHEMA } from '../runtime/render/resolved.js';
|
|
3
|
+
/**
|
|
4
|
+
* The key a block's resolution is filed under in `binding.resolved.blocks`: the block's id, else `#<its position in its
|
|
5
|
+
* parent as saved>`. Pass the saved block `data()` received and its index in that list: the kit keeps the block's
|
|
6
|
+
* saved position on it, so an id-less block finds its resolution on the server (which hands `data()` the list without
|
|
7
|
+
* starter blocks) and in the browser (which hands it the list as saved) alike.
|
|
8
|
+
*/
|
|
9
|
+
export { blockKey as resolvedBlockKey } from '../runtime/render/resolved.js';
|
|
10
|
+
/** Declare the theme's settings (the Theme panel). */
|
|
11
|
+
export function defineSettings(settings) {
|
|
12
|
+
return settings;
|
|
13
|
+
}
|
|
14
|
+
export function defineTheme(theme) {
|
|
15
|
+
return theme;
|
|
16
|
+
}
|
|
17
|
+
export function defineSection(section) {
|
|
18
|
+
return section;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A section for the shopper bundle (theme-abi-v2 §2.2.2): its id, component and `data()` only, with no schema, presets
|
|
22
|
+
* or block metadata. Its `data()` reads `binding.resolved` (the server's resolution, from the page state). The full
|
|
23
|
+
* definition (`defineSection`) stays the theme's source of truth for the server, the editor and the manifest.
|
|
24
|
+
*/
|
|
25
|
+
export function defineClientSection(section) {
|
|
26
|
+
return { ...section, schema: CLIENT_ONLY_SCHEMA };
|
|
27
|
+
}
|