@asteby/storefront-react 0.0.0-stage → 0.1.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.
@@ -0,0 +1,484 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, ComponentPropsWithoutRef, ElementType, ComponentType } from 'react';
3
+ import { StorefrontClient, Shop, StorefrontClientOptions, Cart, CartLineInput, CartLineMerchandise, CartLineUpdateInput, CartBuyerInput, AddressInput, DeliveryInput, DeliveryOptions, Image as Image$1, FormatMoneyOptions, Money as Money$1, Product, ProductVariant, Collection, Section, Theme } from '@asteby/storefront';
4
+
5
+ type StorefrontContextValue = {
6
+ /** Client for browser-side calls (use a public `pk_` token). */
7
+ client: StorefrontClient | null;
8
+ shop: Shop | null;
9
+ /** BCP 47 locale used for formatting (defaults to `shop.locale`, then `es-MX`). */
10
+ locale: string;
11
+ /** ISO 4217 currency (defaults to `shop.currency_code`, then `MXN`). */
12
+ currency: string;
13
+ };
14
+ type StorefrontProviderProps = {
15
+ /** A ready client. Takes precedence over `config`. */
16
+ client?: StorefrontClient;
17
+ /** Options to create the browser client (use a `pk_` token). */
18
+ config?: StorefrontClientOptions;
19
+ /** Shop info loaded on the server (root loader). */
20
+ shop?: Shop | null;
21
+ locale?: string;
22
+ currency?: string;
23
+ children?: ReactNode;
24
+ };
25
+ /**
26
+ * Makes the storefront client, shop, locale and currency available to the
27
+ * tree. SSR-safe: creating the client does not touch `window`.
28
+ */
29
+ declare function StorefrontProvider({ client, config, shop, locale, currency, children }: StorefrontProviderProps): react.JSX.Element;
30
+ /** Storefront context. Throws outside `<StorefrontProvider>`. */
31
+ declare function useStorefront(): StorefrontContextValue;
32
+ /** Storefront context or `null` outside a provider (for components that work standalone). */
33
+ declare function useOptionalStorefront(): StorefrontContextValue | null;
34
+ /** The client from context; throws when the provider has none. */
35
+ declare function useStorefrontClient(): StorefrontClient;
36
+
37
+ /** Default name of the cookie that holds the cart id. */
38
+ declare const CART_COOKIE_NAME = "sf_cart";
39
+ type CartCookieOptions = {
40
+ /** Cookie name (default `sf_cart`). */
41
+ name?: string;
42
+ /** Lifetime in days (default 30). */
43
+ maxAgeDays?: number;
44
+ path?: string;
45
+ domain?: string;
46
+ sameSite?: 'Lax' | 'Strict' | 'None';
47
+ /** Defaults to true on https pages / when `sameSite` is `None`. */
48
+ secure?: boolean;
49
+ };
50
+ /**
51
+ * Reads the cart id from a `Cookie` header. Use it in SSR loaders:
52
+ * `getCartIdFromCookie(request.headers.get('Cookie'))`.
53
+ */
54
+ declare function getCartIdFromCookie(cookieHeader: string | null | undefined, name?: string): string | null;
55
+ /**
56
+ * Serializes the cart cookie for a `Set-Cookie` header (SSR actions) or for
57
+ * `document.cookie`. Pass `null` to clear it.
58
+ */
59
+ declare function serializeCartCookie(cartId: string | null, options?: CartCookieOptions): string;
60
+ /** Browser-only: writes the cart cookie. No-op on the server. */
61
+ declare function writeCartCookie(cartId: string | null, options?: CartCookieOptions): void;
62
+ /** Browser-only: reads the cart cookie. `null` on the server. */
63
+ declare function readCartCookie(name?: string): string | null;
64
+
65
+ type CartLineAddInput = CartLineInput & {
66
+ /** Variant data for an instant optimistic line (otherwise only the count updates until the server answers). */
67
+ merchandise?: CartLineMerchandise;
68
+ };
69
+ type CartStatus = 'idle' | 'loading' | 'updating';
70
+ type CartContextValue = {
71
+ cart: Cart | null;
72
+ cartId: string | null;
73
+ status: CartStatus;
74
+ /** Last mutation error (cleared on the next successful mutation). */
75
+ error: Error | null;
76
+ totalQuantity: number;
77
+ /** Adds lines, creating the cart on first use. Optimistic. */
78
+ addLines: (lines: CartLineAddInput[]) => Promise<Cart | null>;
79
+ /** Sets line quantities (`0` removes). Optimistic. */
80
+ updateLines: (lines: CartLineUpdateInput[]) => Promise<Cart | null>;
81
+ /** Removes lines. Optimistic. */
82
+ removeLines: (lineIds: string[]) => Promise<Cart | null>;
83
+ setDiscountCodes: (codes: string[]) => Promise<Cart | null>;
84
+ setBuyer: (buyer: CartBuyerInput) => Promise<Cart | null>;
85
+ setShippingAddress: (address: AddressInput) => Promise<Cart | null>;
86
+ setDelivery: (delivery: DeliveryInput) => Promise<Cart | null>;
87
+ deliveryOptions: () => Promise<DeliveryOptions | null>;
88
+ /** Reloads the cart from the API. */
89
+ refresh: () => Promise<Cart | null>;
90
+ /** Forgets the cart (clears state and cookie), e.g. after checkout. */
91
+ clear: () => void;
92
+ };
93
+ type CartProviderProps = {
94
+ /** Cart loaded in the SSR loader (hydrates without a client fetch). */
95
+ initialCart?: Cart | null;
96
+ /** Cart id known on the server when `initialCart` is not loaded. */
97
+ cartId?: string | null;
98
+ /** Client override (defaults to the `StorefrontProvider` client). */
99
+ client?: StorefrontClient;
100
+ /** Cookie settings for the persisted cart id (`sf_cart`). Pass `false` to disable the cookie. */
101
+ cookie?: CartCookieOptions | false;
102
+ /** Currency for the optimistic placeholder cart (defaults to the provider currency). */
103
+ currency?: string;
104
+ onError?: (error: Error) => void;
105
+ onCartChange?: (cart: Cart | null) => void;
106
+ children?: ReactNode;
107
+ };
108
+ /** Pure optimistic reducers (exported for tests and custom carts). */
109
+ declare const optimisticCart: {
110
+ add(cart: Cart | null, input: CartLineAddInput[], currency: string): Cart;
111
+ update(cart: Cart | null, input: CartLineUpdateInput[]): Cart | null;
112
+ remove(cart: Cart | null, lineIds: string[]): Cart | null;
113
+ };
114
+ /**
115
+ * Holds the cart and exposes optimistic mutations. Mutations run one at a
116
+ * time in order; a failed one is rolled back without discarding the others.
117
+ * The cart id is persisted in the `sf_cart` cookie (read it in loaders with
118
+ * `getCartIdFromCookie`). No `window`/`document` access during render.
119
+ */
120
+ declare function CartProvider({ initialCart, cartId: initialCartId, client: clientProp, cookie, currency: currencyProp, onError, onCartChange, children, }: CartProviderProps): react.JSX.Element;
121
+ /** Cart state and actions. Throws outside `<CartProvider>`. */
122
+ declare function useCart(): CartContextValue;
123
+ /** Cart context or `null` outside a provider. */
124
+ declare function useOptionalCart(): CartContextValue | null;
125
+
126
+ type MoneyProps<As extends ElementType = 'span'> = FormatMoneyOptions & {
127
+ data: Money$1;
128
+ /** Element to render (default `span`). */
129
+ as?: As;
130
+ /** Overrides the provider locale. */
131
+ locale?: string;
132
+ } & Omit<ComponentPropsWithoutRef<As>, 'children' | 'as'>;
133
+ /** Formats `Money` with the provider locale (or `locale`). */
134
+ declare function Money<As extends ElementType = 'span'>({ data, as, locale, withoutTrailingZeros, withoutCurrency, currencyDisplay, ...rest }: MoneyProps<As>): react.ReactElement<any, string | react.JSXElementConstructor<any>>;
135
+ declare const DEFAULT_IMAGE_WIDTHS: readonly [320, 480, 640, 768, 1024, 1280, 1600];
136
+ /** Builds the URL for one srcset width. */
137
+ type ImageLoader = (src: string, width: number, height?: number) => string;
138
+ /**
139
+ * Default loader: adds `?width=<w>` (the convention of most image CDNs and of
140
+ * the OPS image proxy). URLs that cannot be parsed are returned unchanged.
141
+ */
142
+ declare const defaultImageLoader: ImageLoader;
143
+ type ImageProps = Omit<ComponentPropsWithoutRef<'img'>, 'src' | 'srcSet' | 'width' | 'height'> & {
144
+ data: Image$1;
145
+ /** `sizes` attribute (default `100vw`). */
146
+ sizes?: string;
147
+ /** Candidate widths for `srcset` (capped at the intrinsic width when known). */
148
+ widths?: readonly number[];
149
+ /** URL builder per width (default adds `?width=`). Pass `null` to disable srcset. */
150
+ loader?: ImageLoader | null;
151
+ /** Above-the-fold image: eager loading and `fetchpriority="high"`. */
152
+ priority?: boolean;
153
+ /** Forces an aspect ratio, e.g. `1/1` or `4/3`, used for width/height and srcset heights. */
154
+ aspectRatio?: string;
155
+ };
156
+ /** Responsive `<img>` with `srcset`, lazy by default, intrinsic size to avoid layout shift. */
157
+ declare function Image({ data, sizes, widths, loader, priority, aspectRatio, alt, loading, decoding, ...rest }: ImageProps): react.JSX.Element;
158
+ type ProductPriceProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'> & {
159
+ product?: Pick<Product, 'price_range' | 'compare_at_price_range'> | null;
160
+ variant?: Pick<ProductVariant, 'price' | 'compare_at_price'> | null;
161
+ /** Prefix shown when the product has a price range and no variant is selected (default `Desde`). */
162
+ fromLabel?: ReactNode;
163
+ /** Accessible label for the compare-at price (default `Precio anterior`). */
164
+ compareAtLabel?: string;
165
+ locale?: string;
166
+ withoutTrailingZeros?: boolean;
167
+ };
168
+ /**
169
+ * Price with optional compare-at (strikethrough). With a `variant` it shows
170
+ * that variant; otherwise the product's minimum price (prefixed with
171
+ * `fromLabel` when prices vary).
172
+ */
173
+ declare function ProductPrice({ product, variant, fromLabel, compareAtLabel, locale, withoutTrailingZeros, ...rest }: ProductPriceProps): react.JSX.Element | null;
174
+
175
+ type ProductOptionValueState = {
176
+ value: string;
177
+ /** Part of the current selection. */
178
+ selected: boolean;
179
+ /** A variant with this value (and the other selected options) exists. */
180
+ exists: boolean;
181
+ /** That variant is available for sale. */
182
+ available: boolean;
183
+ /** The variant this value would select, if it exists. */
184
+ variant: ProductVariant | null;
185
+ /** Query string (`?Talla=M&Color=Rojo`) selecting this value, preserving other params. */
186
+ search: string;
187
+ };
188
+ type ProductOptionState = {
189
+ name: string;
190
+ values: ProductOptionValueState[];
191
+ };
192
+ type ProductOptionsState = {
193
+ options: ProductOptionState[];
194
+ selectedOptions: Record<string, string>;
195
+ /** Variant matching every selected option, or `null` while incomplete. */
196
+ selectedVariant: ProductVariant | null;
197
+ setOption: (name: string, value: string) => void;
198
+ };
199
+ type UseProductOptionsConfig = {
200
+ /** Current URL search params; option names are read as keys (`?Talla=M`), plus `variant=<id>`. */
201
+ searchParams?: URLSearchParams | string | null;
202
+ /** Select the first available variant when nothing is in the URL (default true). */
203
+ defaultToFirstAvailable?: boolean;
204
+ onChange?: (variant: ProductVariant | null, selectedOptions: Record<string, string>) => void;
205
+ };
206
+ type ProductLike = Pick<Product, 'options' | 'variants'> & {
207
+ id?: string;
208
+ };
209
+ /**
210
+ * Option → values matrix with availability, the selected variant (from the
211
+ * URL or local state) and links for each value. Pure React: works in SSR.
212
+ */
213
+ declare function useProductOptions(product: ProductLike, config?: UseProductOptionsConfig): ProductOptionsState;
214
+ type VariantSelectorRenderProps = {
215
+ option: ProductOptionState;
216
+ selectedVariant: ProductVariant | null;
217
+ selectedOptions: Record<string, string>;
218
+ setOption: (name: string, value: string) => void;
219
+ };
220
+ type VariantSelectorProps = UseProductOptionsConfig & {
221
+ product: ProductLike;
222
+ /** Called once per option; render the buttons/links for `option.values`. */
223
+ children: (props: VariantSelectorRenderProps) => ReactNode;
224
+ };
225
+ /**
226
+ * Render-prop variant picker. Example:
227
+ *
228
+ * <VariantSelector product={product} searchParams={searchParams}>
229
+ * {({ option }) => (
230
+ * <fieldset>
231
+ * <legend>{option.name}</legend>
232
+ * {option.values.map((v) => (
233
+ * <Link key={v.value} to={v.search} replace preventScrollReset aria-current={v.selected}
234
+ * aria-disabled={!v.available}>{v.value}</Link>
235
+ * ))}
236
+ * </fieldset>
237
+ * )}
238
+ * </VariantSelector>
239
+ */
240
+ declare function VariantSelector({ product, children, ...config }: VariantSelectorProps): react.JSX.Element;
241
+ /** Builds the optimistic cart-line merchandise for a product variant. */
242
+ declare function toMerchandise(product: Pick<Product, 'handle' | 'title' | 'featured_image'>, variant: ProductVariant): CartLineMerchandise;
243
+ type AddToCartButtonProps = Omit<ComponentPropsWithoutRef<'button'>, 'onClick'> & {
244
+ variantId: string | null | undefined;
245
+ quantity?: number;
246
+ /** Variant data for an instant optimistic cart line. */
247
+ merchandise?: CartLineMerchandise;
248
+ onAdded?: () => void;
249
+ onClick?: ComponentPropsWithoutRef<'button'>['onClick'];
250
+ };
251
+ /** Adds a variant to the cart via `useCart().addLines`. Disabled without a variant or while adding. */
252
+ declare function AddToCartButton({ variantId, quantity, merchandise, onAdded, onClick, disabled, children, type, ...rest }: AddToCartButtonProps): react.JSX.Element;
253
+
254
+ /**
255
+ * SEO helpers: pure functions returning meta descriptors (React Router v7
256
+ * `meta` export shape) and schema.org JSON-LD objects (`<JsonLd>` renders them).
257
+ * Nothing here touches the DOM, so it is safe in loaders and SSR.
258
+ */
259
+
260
+ /** Same shape as React Router's `MetaDescriptor`. */
261
+ type MetaDescriptor = {
262
+ title: string;
263
+ } | {
264
+ name: string;
265
+ content: string;
266
+ } | {
267
+ property: string;
268
+ content: string;
269
+ } | {
270
+ tagName: 'link';
271
+ rel: string;
272
+ href: string;
273
+ [attr: string]: string;
274
+ } | {
275
+ 'script:ld+json': JsonLdObject | JsonLdObject[];
276
+ };
277
+ type JsonLdObject = {
278
+ '@context'?: string;
279
+ '@type': string | string[];
280
+ [key: string]: unknown;
281
+ };
282
+ type SeoMetaInput = {
283
+ title?: string | null;
284
+ description?: string | null;
285
+ /** Canonical absolute URL. */
286
+ url?: string | null;
287
+ image?: Image$1 | string | null;
288
+ /** `og:type` (default `website`). */
289
+ type?: string;
290
+ siteName?: string | null;
291
+ locale?: string | null;
292
+ noindex?: boolean;
293
+ /** Appended to the title as `Title | Suffix` unless already present. */
294
+ titleSuffix?: string | null;
295
+ };
296
+ /** Generic title/description/canonical/Open Graph/Twitter descriptors. */
297
+ declare function seoMeta(input: SeoMetaInput): MetaDescriptor[];
298
+ /** Product page descriptors (`og:type=product` and price tags). */
299
+ declare function productMeta(product: Product, shop: Pick<Shop, 'name' | 'locale'> | null, url: string): MetaDescriptor[];
300
+ /** Collection page descriptors. */
301
+ declare function collectionMeta(collection: Collection, shop: Pick<Shop, 'name' | 'locale'> | null, url: string): MetaDescriptor[];
302
+ /** schema.org `Product` with one `Offer` per variant. */
303
+ declare function productJsonLd(product: Product, shop: Pick<Shop, 'name' | 'domain'> | null, url: string): JsonLdObject;
304
+ /** schema.org `Organization` for the shop (logo, contact, url). */
305
+ declare function organizationJsonLd(shop: Shop, url?: string): JsonLdObject;
306
+ type LocalBusinessOptions = {
307
+ /** schema.org type (default `Store`), e.g. `AutoPartsStore`, `ClothingStore`. */
308
+ type?: string;
309
+ /** Shop URL fallback when `shop.domain` is empty. */
310
+ url?: string;
311
+ priceRange?: string;
312
+ };
313
+ /** One schema.org `LocalBusiness` (default `Store`) per shop branch. */
314
+ declare function localBusinessJsonLd(shop: Shop, options?: LocalBusinessOptions): JsonLdObject[];
315
+ type BreadcrumbItem = {
316
+ name: string;
317
+ url: string;
318
+ };
319
+ declare function breadcrumbJsonLd(items: BreadcrumbItem[]): JsonLdObject;
320
+ type FaqItem = {
321
+ question: string;
322
+ answer: string;
323
+ };
324
+ declare function faqJsonLd(items: FaqItem[]): JsonLdObject;
325
+ /** schema.org `CollectionPage` with an `ItemList` of the products shown. */
326
+ declare function collectionJsonLd(collection: Collection, products: Pick<Product, 'handle' | 'title' | 'featured_image'>[], url: string, options?: {
327
+ productUrl?: (handle: string) => string;
328
+ }): JsonLdObject;
329
+ /**
330
+ * Serializes JSON-LD for a `<script>` tag, escaping `<`, `>`, `&` and line
331
+ * separators so the payload cannot close the tag or inject markup.
332
+ */
333
+ declare function serializeJsonLd(data: unknown): string;
334
+
335
+ type JsonLdProps = {
336
+ data: JsonLdObject | JsonLdObject[] | null | undefined;
337
+ nonce?: string;
338
+ };
339
+ /** Renders `<script type="application/ld+json">` safely (works in SSR). */
340
+ declare function JsonLd({ data, nonce }: JsonLdProps): react.JSX.Element | null;
341
+
342
+ type SectionPropKind = 'text' | 'textarea' | 'richtext' | 'number' | 'boolean' | 'url' | 'image' | 'color' | 'select' | 'collection' | 'product' | 'products' | 'list';
343
+ type SectionPropSchema = {
344
+ label: string;
345
+ kind: SectionPropKind;
346
+ description?: string;
347
+ default?: unknown;
348
+ required?: boolean;
349
+ /** `select` choices. */
350
+ options?: readonly {
351
+ value: string;
352
+ label: string;
353
+ }[];
354
+ /** `number` bounds. */
355
+ min?: number;
356
+ max?: number;
357
+ /** `list` item schema. */
358
+ items?: SectionSchema;
359
+ };
360
+ type SectionSchema = {
361
+ readonly [prop: string]: SectionPropSchema;
362
+ };
363
+ type KindType<P extends SectionPropSchema> = P['kind'] extends 'number' ? number : P['kind'] extends 'boolean' ? boolean : P['kind'] extends 'products' ? string[] : P['kind'] extends 'list' ? P['items'] extends SectionSchema ? InferSectionProps<P['items']>[] : Record<string, unknown>[] : P['kind'] extends 'select' ? P['options'] extends readonly {
364
+ value: infer V;
365
+ }[] ? V : string : string;
366
+ type RequiredKeys<S extends SectionSchema> = {
367
+ [K in keyof S]: S[K]['required'] extends true ? K : 'default' extends keyof S[K] ? K : never;
368
+ }[keyof S];
369
+ /** Props type derived from a section schema (props with `default` or `required` are non-optional). */
370
+ type InferSectionProps<S extends SectionSchema> = {
371
+ [K in RequiredKeys<S>]: KindType<S[K]>;
372
+ } & {
373
+ [K in Exclude<keyof S, RequiredKeys<S>>]?: KindType<S[K]>;
374
+ };
375
+ type SectionComponentProps<P, C = unknown> = P & {
376
+ section: {
377
+ id: string;
378
+ type: string;
379
+ };
380
+ /** Arbitrary data passed to `<Sections context>` (e.g. loader data). */
381
+ context: C;
382
+ };
383
+ type SectionDefinition<P = Record<string, unknown>, C = any> = {
384
+ type: string;
385
+ label?: string;
386
+ description?: string;
387
+ schema: SectionSchema;
388
+ component: ComponentType<SectionComponentProps<P, C>>;
389
+ };
390
+ /**
391
+ * Declares a section. Prop types are inferred from the schema:
392
+ *
393
+ * export const hero = defineSection({
394
+ * type: 'hero',
395
+ * label: 'Hero',
396
+ * schema: {
397
+ * title: { label: 'Título', kind: 'text', required: true },
398
+ * cta_url: { label: 'Enlace', kind: 'url', default: '/' },
399
+ * },
400
+ * component: ({ title, cta_url }) => <section><h1>{title}</h1><a href={cta_url}>Ver</a></section>,
401
+ * })
402
+ */
403
+ declare function defineSection<const S extends SectionSchema, C = any>(definition: {
404
+ type: string;
405
+ label?: string;
406
+ description?: string;
407
+ schema: S;
408
+ component: ComponentType<SectionComponentProps<InferSectionProps<S>, C>>;
409
+ }): SectionDefinition<InferSectionProps<S>, C>;
410
+ type SectionPropError = {
411
+ prop: string;
412
+ message: string;
413
+ };
414
+ /**
415
+ * Validates raw props against a schema: merges defaults, coerces numeric
416
+ * strings, drops unknown props and replaces invalid values with the default.
417
+ */
418
+ declare function resolveSectionProps(schema: SectionSchema, raw: Record<string, unknown> | null | undefined, path?: string): {
419
+ props: Record<string, unknown>;
420
+ errors: SectionPropError[];
421
+ };
422
+ /** JSON Schema (draft 2020-12) of a section, for the OPS editor (`section.schema.json`). */
423
+ declare function sectionJsonSchema(definition: Pick<SectionDefinition, 'type' | 'label' | 'description' | 'schema'>): Record<string, unknown>;
424
+ /** Map of section `type` → definition. */
425
+ declare class SectionRegistry {
426
+ private readonly defs;
427
+ constructor(definitions?: readonly SectionDefinition<any, any>[]);
428
+ register(definition: SectionDefinition<any, any>): this;
429
+ get(type: string): SectionDefinition<any, any> | undefined;
430
+ has(type: string): boolean;
431
+ types(): string[];
432
+ definitions(): SectionDefinition<any, any>[];
433
+ /** JSON Schemas of every registered section, keyed by type. */
434
+ toJSONSchema(): Record<string, Record<string, unknown>>;
435
+ }
436
+ declare function createSectionRegistry(definitions?: readonly SectionDefinition<any, any>[]): SectionRegistry;
437
+ type SectionsProps<C = unknown> = {
438
+ sections: readonly Section[] | null | undefined;
439
+ registry: SectionRegistry;
440
+ /** Passed to every section component as `context`. */
441
+ context?: C;
442
+ /** Rendered for unknown types (default: nothing). */
443
+ renderUnknown?: (section: Section) => ReactNode;
444
+ /** Called with validation problems (default: `console.warn` outside production). */
445
+ onInvalid?: (section: Section, errors: SectionPropError[]) => void;
446
+ };
447
+ /**
448
+ * Renders sections in order. Unknown types are skipped (with a dev warning),
449
+ * props are validated against the schema and defaults are merged; a section
450
+ * missing a required prop is skipped.
451
+ */
452
+ declare function Sections<C = unknown>({ sections, registry, context, renderUnknown, onInvalid }: SectionsProps<C>): react.JSX.Element | null;
453
+
454
+ type ThemeCssOptions = {
455
+ /** Selector that receives the variables (default `:root`). */
456
+ selector?: string;
457
+ /**
458
+ * Variable names for color tokens:
459
+ * `both` (default) → `--color-<name>` and `--<name>`;
460
+ * `color` → only `--color-<name>` (Tailwind 4); `metacore` → only `--<name>`.
461
+ */
462
+ naming?: 'both' | 'color' | 'metacore';
463
+ /** Fallback stack appended to every font (default system sans-serif). */
464
+ fontFallback?: string;
465
+ };
466
+ /** `primaryForeground`, `primary_foreground`, `--color-primary-foreground` → `primary-foreground`. */
467
+ declare function tokenName(key: string): string;
468
+ /** Rejects values that could escape the declaration or the `<style>` element. */
469
+ declare function isSafeCssValue(value: string): boolean;
470
+ /** CSS declarations (`--x:value`) for a theme, without selector. */
471
+ declare function themeToCssVariables(theme: Partial<Theme> | null | undefined, options?: ThemeCssOptions): Record<string, string>;
472
+ /** `:root{--color-primary:#0f766e;--primary:#0f766e;...}` from a content theme. */
473
+ declare function themeToCss(theme: Partial<Theme> | null | undefined, options?: ThemeCssOptions): string;
474
+ /** Google Fonts stylesheet URL for the theme fonts (or `null` when there are none). */
475
+ declare function themeFontsHref(theme: Partial<Theme> | null | undefined, weights?: number[]): string | null;
476
+ type ThemeStyleProps = ThemeCssOptions & {
477
+ theme: Partial<Theme> | null | undefined;
478
+ nonce?: string;
479
+ id?: string;
480
+ };
481
+ /** Emits the theme variables as a `<style>` (render it in `<head>` from the root route). */
482
+ declare function ThemeStyle({ theme, nonce, id, ...options }: ThemeStyleProps): react.JSX.Element | null;
483
+
484
+ export { AddToCartButton, type AddToCartButtonProps, type BreadcrumbItem, CART_COOKIE_NAME, type CartContextValue, type CartCookieOptions, type CartLineAddInput, CartProvider, type CartProviderProps, type CartStatus, DEFAULT_IMAGE_WIDTHS, type FaqItem, Image, type ImageLoader, type ImageProps, type InferSectionProps, JsonLd, type JsonLdObject, type JsonLdProps, type LocalBusinessOptions, type MetaDescriptor, Money, type MoneyProps, type ProductOptionState, type ProductOptionValueState, type ProductOptionsState, ProductPrice, type ProductPriceProps, type SectionComponentProps, type SectionDefinition, type SectionPropError, type SectionPropKind, type SectionPropSchema, SectionRegistry, type SectionSchema, Sections, type SectionsProps, type SeoMetaInput, type StorefrontContextValue, StorefrontProvider, type StorefrontProviderProps, type ThemeCssOptions, ThemeStyle, type ThemeStyleProps, type UseProductOptionsConfig, VariantSelector, type VariantSelectorProps, type VariantSelectorRenderProps, breadcrumbJsonLd, collectionJsonLd, collectionMeta, createSectionRegistry, defaultImageLoader, defineSection, faqJsonLd, getCartIdFromCookie, isSafeCssValue, localBusinessJsonLd, optimisticCart, organizationJsonLd, productJsonLd, productMeta, readCartCookie, resolveSectionProps, sectionJsonSchema, seoMeta, serializeCartCookie, serializeJsonLd, themeFontsHref, themeToCss, themeToCssVariables, toMerchandise, tokenName, useCart, useOptionalCart, useOptionalStorefront, useProductOptions, useStorefront, useStorefrontClient, writeCartCookie };