@numueg/theme-sdk 0.5.2 → 0.6.0

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/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { i as Store, e as Product, b as Collection, C as Cart, c as Customer, P as Page, S as SizeChart, g as ProductVariant } from './entities-6MGANln7.mjs';
2
2
  export { A as Address, a as CartItem, O as Order, d as OrderItem, f as ProductImage, j as ProductOption, h as SizeChartMode } from './entities-6MGANln7.mjs';
3
- import { T as ThemeSettingsV3, c as SectionInstance, M as MountResult, B as BlockInstance, b as BlockSchema, a as BlockProps$1, f as SectionSchema, e as SectionProps$1 } from './theme-D0QybTQS.mjs';
4
- export { E as ExternalThemeMetadata, h as MAX_BLOCK_DEPTH, P as PageTemplate, i as PresetBlock, S as SectionGroup, d as SectionPreset, g as SettingDefinition } from './theme-D0QybTQS.mjs';
3
+ import { T as ThemeSettingsV3, c as SectionInstance, M as MountResult, B as BlockInstance, b as BlockSchema, a as BlockProps$1, f as SectionSchema, e as SectionProps$1 } from './theme-D8MOopvi.mjs';
4
+ export { E as ExternalThemeMetadata, h as MAX_BLOCK_DEPTH, P as PageTemplate, i as PresetBlock, S as SectionGroup, d as SectionPreset, g as SettingDefinition } from './theme-D8MOopvi.mjs';
5
5
  export { KNOWN_SETTING_TYPES, KNOWN_TEMPLATES, REQUIRED_TEMPLATES, SDK_VERSION, THEME_CONTRACT_VERSION, ValidationIssue, ValidationResult, mergeResults, validateBuiltManifest, validateManifest, validateSectionSchema, validateSettingsAgainstSchema } from './validation.mjs';
6
- import { L as LocalizationState, T as ThemeMountContext, a as ThemeRenderArgs, M as MenuItemData } from './mount-DH9dz3dq.mjs';
7
- export { C as CartContext, b as CollectionContext, c as CustomerContext, d as LocalizationContext, N as NavigationContext, P as PageContext, e as ProductContext, S as ShopContext, f as ThemeMountPage, g as ThemeSettingsContext, h as buildThemeElement, m as mountTheme } from './mount-DH9dz3dq.mjs';
6
+ import { L as LocalizationState, T as ThemeMountContext, a as ThemeRenderArgs, M as MenuItemData } from './mount-BGumg1JM.mjs';
7
+ export { C as CartContext, b as CollectionContext, c as CustomerContext, d as LocalizationContext, N as NavigationContext, P as PageContext, e as ProductContext, S as ShopContext, f as ThemeMountPage, g as ThemeSettingsContext, h as buildThemeElement, m as mountTheme } from './mount-BGumg1JM.mjs';
8
8
  import * as react from 'react';
9
9
  import { ReactElement, ReactNode, ElementType, CSSProperties, ImgHTMLAttributes, AnchorHTMLAttributes, ButtonHTMLAttributes, HTMLAttributes, FormHTMLAttributes, ComponentType } from 'react';
10
10
  export { resolveThemeSettings } from './normalize.mjs';
@@ -1251,6 +1251,11 @@ interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "
1251
1251
  * "eager" for above-the-fold imagery.
1252
1252
  */
1253
1253
  loading?: "eager" | "lazy";
1254
+ /**
1255
+ * Above-the-fold? When true, forces loading="eager" + fetchPriority="high"
1256
+ * (overrides `loading`). Use on the hero / LCP image. Default false.
1257
+ */
1258
+ priority?: boolean;
1254
1259
  /**
1255
1260
  * Shopify-style frame. When set (e.g. "3/4", "16/9", "1/1") the image is
1256
1261
  * wrapped in a fixed-aspect, overflow-hidden box and the `<img>` fills it.
@@ -1284,7 +1289,67 @@ interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "
1284
1289
  * If `src` is empty/null, renders a placeholder div so the layout
1285
1290
  * doesn't shift while a merchant configures images in the customizer.
1286
1291
  */
1287
- declare function Image({ src, alt, sizes, responsive, loading, aspectRatio, objectFit, objectPosition, transform, className, style, ...rest }: ImageProps): react.JSX.Element;
1292
+ declare function Image({ src, alt, sizes, responsive, loading, priority, aspectRatio, objectFit, objectPosition, transform, className, style, ...rest }: ImageProps): react.JSX.Element;
1293
+
1294
+ interface HeroMediaProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "srcSet" | "alt" | "style"> {
1295
+ /** Desktop (primary) image URL. */
1296
+ src: string | null | undefined;
1297
+ alt: string;
1298
+ /** Desktop focal/zoom/rotation (`asImageTransform(setting)`). */
1299
+ transform?: ImageTransform | null;
1300
+ /** Optional mobile art-direction image. When set → swaps below `breakpoint`. */
1301
+ mobileSrc?: string | null;
1302
+ /** Mobile focal/zoom/rotation. Falls back to the desktop transform's focal. */
1303
+ mobileTransform?: ImageTransform | null;
1304
+ /** Server-crop box aspect for desktop, e.g. "16/9". Match the theme container. */
1305
+ desktopAspect?: string;
1306
+ /** Server-crop box aspect for mobile, e.g. "4/5". */
1307
+ mobileAspect?: string;
1308
+ /** object-fit. Default "cover". Pass "contain" for letterboxed art. */
1309
+ fit?: "cover" | "contain";
1310
+ /** Above-the-fold? Default true → loading=eager + fetchPriority=high. */
1311
+ priority?: boolean;
1312
+ /** sizes attribute. Hero is full-width → default "100vw". */
1313
+ sizes?: string;
1314
+ /** Below this width (px) the mobile image is used. Default 768. */
1315
+ breakpoint?: number;
1316
+ /**
1317
+ * Pre-fetch the alternate (off-breakpoint) image so a Desktop↔Mobile swap is an
1318
+ * instant cache hit instead of a flash-and-fetch. Default true. Set false to save
1319
+ * the one extra background request when smooth resizing isn't worth the bandwidth.
1320
+ */
1321
+ preloadAlternate?: boolean;
1322
+ className?: string;
1323
+ style?: CSSProperties;
1324
+ }
1325
+ /**
1326
+ * <HeroMedia> — above-the-fold hero image for V3 themes.
1327
+ *
1328
+ * - Real responsive srcSet routed through /api/image-transform (resize + AVIF/WebP,
1329
+ * + focal smart-crop when Cloudflare Image Resizing is enabled).
1330
+ * - LCP perf defaults: loading=eager + fetchPriority=high (disable via priority={false}).
1331
+ * - Non-destructive focal/zoom/rotation framing via applyImageTransform.
1332
+ * - Optional MOBILE art-direction image: a different bitmap below `breakpoint`.
1333
+ *
1334
+ * ## Why matchMedia, not <picture><source media>
1335
+ * Art direction is resolved in JS (a `matchMedia` listener) rather than a native
1336
+ * `<picture><source media>`. A native `<picture>` does NOT reliably re-pick its source
1337
+ * when an EMBEDDED preview resizes its iframe — exactly what the theme editor's
1338
+ * Desktop/Mobile toggle does — so the hero would stay stuck on the desktop bitmap at
1339
+ * mobile sizes. CSS media queries DO re-evaluate on that resize (Tailwind flips the
1340
+ * container to portrait), and `matchMedia` shares that engine, so the swap is
1341
+ * deterministic. The state initialises from `matchMedia` so the first client paint is
1342
+ * already correct (V3 themes mount client-side) — no desktop→mobile flash on phones.
1343
+ *
1344
+ * ## Smooth swap
1345
+ * The off-breakpoint image is pre-warmed (low priority, after paint) so toggling the
1346
+ * breakpoint — the editor switch, or a window resize — paints from cache instantly
1347
+ * instead of fetching on demand. See `preloadAlternate`.
1348
+ *
1349
+ * When `mobileSrc` is omitted this is a single responsive <img> filling its parent —
1350
+ * the theme keeps its own wrapper/sizing, identical to a raw <img> plus srcSet + perf.
1351
+ */
1352
+ declare function HeroMedia({ src, alt, transform, mobileSrc, mobileTransform, desktopAspect, mobileAspect, fit, priority, sizes, breakpoint, preloadAlternate, className, style, ...rest }: HeroMediaProps): react.JSX.Element;
1288
1353
 
1289
1354
  interface LogoProps {
1290
1355
  /** Explicit logo URL; falls back to global_settings.logo_url then shop.logo_url. */
@@ -2202,4 +2267,4 @@ declare function pickTranslations(bundle: LocaleBundle, locale: string): LocaleM
2202
2267
  */
2203
2268
  declare function buildLocaleBundle<T extends Record<string, unknown>>(modules: T): LocaleBundle;
2204
2269
 
2205
- export { AddToCartButton, type AddressInput, type AnalyticsApi, type AnalyticsPayload, type AppManifestBlock, type AppPayload, type AppState, Block, BlockInstance, BlockProps$1 as BlockProps, BlockSchema, Cart, type CheckoutAddress, type CheckoutApi, type CheckoutSessionState, type CheckoutStep, Collection, CollectionCard, type CollectionCardProps, type CollectionCardSlots, CollectionProvider, type ComputedStyleTokens, type CurrencyConfig, type CurrencyState, CurrencySwitcher, type CurrencySwitcherProps, Customer, type CustomerAddress, type CustomerAddressesState, type DefineBlockInput, type DefineSectionInput, type DefinedBlock, type DefinedSection, type DynamicResolveContext, type DynamicSourceRef, EditableImage, type EditableImageProps, EditableText, type EditableTextProps, type FocalSrcOptions, Form, type GiftCardBalance, ICON_NAMES, Icon, IconMap, type IconProps, Image, type ImageTransform, LOGO_SHAPE_OPTIONS, LOGO_SIZE_OPTIONS, Link, type LocaleBundle, type LocaleMessages, LocaleSwitcher, type LocaleSwitcherProps, Logo, type LogoProps, type LogoShape, type LogoSize, MenuItemData, Money, MountResult, type NavigationItem, type NavigationState, NuMuProvider, type OrderDetail, type OrderListEntry, type OrderListState, type OrderState, Page, type PlaceOrderResult, Product, ProductCard, type ProductCardProps, type ProductCardSlots, ProductProvider, ProductVariant, type RelatedProductsState, type ReorderResult, type ReorderSkipReason, type ReorderSkippedItem, RichText, type RichTextProps, type SearchResults, type SearchState, Section, SectionContext, SectionInstance, SectionProps$1 as SectionProps, SectionSchema, type ShippingRateOption, type ShopWithHelpers, SizeChart, Store, type ThemeEntry, ThemeMountContext, ThemeRenderArgs, ThemeSettingsV3, type UseGiftCardBalance, type UseReorder, type UseSearchOptions, type UseShippingRatesOptions, type UseShippingRatesState, type UseVariantSelection, type WishlistItem, type WishlistState, applyGlobalStyleTokens, applyImageTransform, asImageTransform, assetUrl, availableValues, buildLocaleBundle, clearSdkSingleton, collectBlocks, collectSections, computeGlobalStyleTokens, defaultVariant, defineBlock, defineSection, defineThemeEntry, dynamicSource, findVariantByOptions, flattenMessages, focalSrc, getReactSingleton, getSdkSingleton, isDefinedBlock, isDefinedSection, isDynamicSource, isSdkAvailable, logoImgStyle, logoStyleTokens, pickTranslations, registerReactSingleton, registerSdkSingleton, resolveDynamicValue, resolveFontStack, resolveSettingsMap, resolveSizeChart, resolveSourcePath, sanitizeHtml, useAnalytics, useApp, useCart, useCheckout, useCollection, useCollectionOptional, useCollections, useCurrency, useCurrentTemplate, useCustomer, useCustomerActions, useCustomerAddresses, useDirection, useFieldTranslation, useGiftCardBalance, useImage, useLocale, useLocalization, useMoney, useNavigation, useNumberFormat, useOrder, useOrders, usePage, useProduct, useProductOptional, useProductSizeChart, useProducts, useRelatedProducts, useReorder, useResolvedSettings, useSearch, useSection, useSectionOptional, useShippingRates, useShop, useThemeSettings, useTranslation, useVariantSelection, useWishlist };
2270
+ export { AddToCartButton, type AddressInput, type AnalyticsApi, type AnalyticsPayload, type AppManifestBlock, type AppPayload, type AppState, Block, BlockInstance, BlockProps$1 as BlockProps, BlockSchema, Cart, type CheckoutAddress, type CheckoutApi, type CheckoutSessionState, type CheckoutStep, Collection, CollectionCard, type CollectionCardProps, type CollectionCardSlots, CollectionProvider, type ComputedStyleTokens, type CurrencyConfig, type CurrencyState, CurrencySwitcher, type CurrencySwitcherProps, Customer, type CustomerAddress, type CustomerAddressesState, type DefineBlockInput, type DefineSectionInput, type DefinedBlock, type DefinedSection, type DynamicResolveContext, type DynamicSourceRef, EditableImage, type EditableImageProps, EditableText, type EditableTextProps, type FocalSrcOptions, Form, type GiftCardBalance, HeroMedia, type HeroMediaProps, ICON_NAMES, Icon, IconMap, type IconProps, Image, type ImageTransform, LOGO_SHAPE_OPTIONS, LOGO_SIZE_OPTIONS, Link, type LocaleBundle, type LocaleMessages, LocaleSwitcher, type LocaleSwitcherProps, Logo, type LogoProps, type LogoShape, type LogoSize, MenuItemData, Money, MountResult, type NavigationItem, type NavigationState, NuMuProvider, type OrderDetail, type OrderListEntry, type OrderListState, type OrderState, Page, type PlaceOrderResult, Product, ProductCard, type ProductCardProps, type ProductCardSlots, ProductProvider, ProductVariant, type RelatedProductsState, type ReorderResult, type ReorderSkipReason, type ReorderSkippedItem, RichText, type RichTextProps, type SearchResults, type SearchState, Section, SectionContext, SectionInstance, SectionProps$1 as SectionProps, SectionSchema, type ShippingRateOption, type ShopWithHelpers, SizeChart, Store, type ThemeEntry, ThemeMountContext, ThemeRenderArgs, ThemeSettingsV3, type UseGiftCardBalance, type UseReorder, type UseSearchOptions, type UseShippingRatesOptions, type UseShippingRatesState, type UseVariantSelection, type WishlistItem, type WishlistState, applyGlobalStyleTokens, applyImageTransform, asImageTransform, assetUrl, availableValues, buildLocaleBundle, clearSdkSingleton, collectBlocks, collectSections, computeGlobalStyleTokens, defaultVariant, defineBlock, defineSection, defineThemeEntry, dynamicSource, findVariantByOptions, flattenMessages, focalSrc, getReactSingleton, getSdkSingleton, isDefinedBlock, isDefinedSection, isDynamicSource, isSdkAvailable, logoImgStyle, logoStyleTokens, pickTranslations, registerReactSingleton, registerSdkSingleton, resolveDynamicValue, resolveFontStack, resolveSettingsMap, resolveSizeChart, resolveSourcePath, sanitizeHtml, useAnalytics, useApp, useCart, useCheckout, useCollection, useCollectionOptional, useCollections, useCurrency, useCurrentTemplate, useCustomer, useCustomerActions, useCustomerAddresses, useDirection, useFieldTranslation, useGiftCardBalance, useImage, useLocale, useLocalization, useMoney, useNavigation, useNumberFormat, useOrder, useOrders, usePage, useProduct, useProductOptional, useProductSizeChart, useProducts, useRelatedProducts, useReorder, useResolvedSettings, useSearch, useSection, useSectionOptional, useShippingRates, useShop, useThemeSettings, useTranslation, useVariantSelection, useWishlist };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { i as Store, e as Product, b as Collection, C as Cart, c as Customer, P as Page, S as SizeChart, g as ProductVariant } from './entities-6MGANln7.js';
2
2
  export { A as Address, a as CartItem, O as Order, d as OrderItem, f as ProductImage, j as ProductOption, h as SizeChartMode } from './entities-6MGANln7.js';
3
- import { T as ThemeSettingsV3, c as SectionInstance, M as MountResult, B as BlockInstance, b as BlockSchema, a as BlockProps$1, f as SectionSchema, e as SectionProps$1 } from './theme-D0QybTQS.js';
4
- export { E as ExternalThemeMetadata, h as MAX_BLOCK_DEPTH, P as PageTemplate, i as PresetBlock, S as SectionGroup, d as SectionPreset, g as SettingDefinition } from './theme-D0QybTQS.js';
3
+ import { T as ThemeSettingsV3, c as SectionInstance, M as MountResult, B as BlockInstance, b as BlockSchema, a as BlockProps$1, f as SectionSchema, e as SectionProps$1 } from './theme-D8MOopvi.js';
4
+ export { E as ExternalThemeMetadata, h as MAX_BLOCK_DEPTH, P as PageTemplate, i as PresetBlock, S as SectionGroup, d as SectionPreset, g as SettingDefinition } from './theme-D8MOopvi.js';
5
5
  export { KNOWN_SETTING_TYPES, KNOWN_TEMPLATES, REQUIRED_TEMPLATES, SDK_VERSION, THEME_CONTRACT_VERSION, ValidationIssue, ValidationResult, mergeResults, validateBuiltManifest, validateManifest, validateSectionSchema, validateSettingsAgainstSchema } from './validation.js';
6
- import { L as LocalizationState, T as ThemeMountContext, a as ThemeRenderArgs, M as MenuItemData } from './mount-BN2mz_wx.js';
7
- export { C as CartContext, b as CollectionContext, c as CustomerContext, d as LocalizationContext, N as NavigationContext, P as PageContext, e as ProductContext, S as ShopContext, f as ThemeMountPage, g as ThemeSettingsContext, h as buildThemeElement, m as mountTheme } from './mount-BN2mz_wx.js';
6
+ import { L as LocalizationState, T as ThemeMountContext, a as ThemeRenderArgs, M as MenuItemData } from './mount-Bt-4ken5.js';
7
+ export { C as CartContext, b as CollectionContext, c as CustomerContext, d as LocalizationContext, N as NavigationContext, P as PageContext, e as ProductContext, S as ShopContext, f as ThemeMountPage, g as ThemeSettingsContext, h as buildThemeElement, m as mountTheme } from './mount-Bt-4ken5.js';
8
8
  import * as react from 'react';
9
9
  import { ReactElement, ReactNode, ElementType, CSSProperties, ImgHTMLAttributes, AnchorHTMLAttributes, ButtonHTMLAttributes, HTMLAttributes, FormHTMLAttributes, ComponentType } from 'react';
10
10
  export { resolveThemeSettings } from './normalize.js';
@@ -1251,6 +1251,11 @@ interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "
1251
1251
  * "eager" for above-the-fold imagery.
1252
1252
  */
1253
1253
  loading?: "eager" | "lazy";
1254
+ /**
1255
+ * Above-the-fold? When true, forces loading="eager" + fetchPriority="high"
1256
+ * (overrides `loading`). Use on the hero / LCP image. Default false.
1257
+ */
1258
+ priority?: boolean;
1254
1259
  /**
1255
1260
  * Shopify-style frame. When set (e.g. "3/4", "16/9", "1/1") the image is
1256
1261
  * wrapped in a fixed-aspect, overflow-hidden box and the `<img>` fills it.
@@ -1284,7 +1289,67 @@ interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "
1284
1289
  * If `src` is empty/null, renders a placeholder div so the layout
1285
1290
  * doesn't shift while a merchant configures images in the customizer.
1286
1291
  */
1287
- declare function Image({ src, alt, sizes, responsive, loading, aspectRatio, objectFit, objectPosition, transform, className, style, ...rest }: ImageProps): react.JSX.Element;
1292
+ declare function Image({ src, alt, sizes, responsive, loading, priority, aspectRatio, objectFit, objectPosition, transform, className, style, ...rest }: ImageProps): react.JSX.Element;
1293
+
1294
+ interface HeroMediaProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "srcSet" | "alt" | "style"> {
1295
+ /** Desktop (primary) image URL. */
1296
+ src: string | null | undefined;
1297
+ alt: string;
1298
+ /** Desktop focal/zoom/rotation (`asImageTransform(setting)`). */
1299
+ transform?: ImageTransform | null;
1300
+ /** Optional mobile art-direction image. When set → swaps below `breakpoint`. */
1301
+ mobileSrc?: string | null;
1302
+ /** Mobile focal/zoom/rotation. Falls back to the desktop transform's focal. */
1303
+ mobileTransform?: ImageTransform | null;
1304
+ /** Server-crop box aspect for desktop, e.g. "16/9". Match the theme container. */
1305
+ desktopAspect?: string;
1306
+ /** Server-crop box aspect for mobile, e.g. "4/5". */
1307
+ mobileAspect?: string;
1308
+ /** object-fit. Default "cover". Pass "contain" for letterboxed art. */
1309
+ fit?: "cover" | "contain";
1310
+ /** Above-the-fold? Default true → loading=eager + fetchPriority=high. */
1311
+ priority?: boolean;
1312
+ /** sizes attribute. Hero is full-width → default "100vw". */
1313
+ sizes?: string;
1314
+ /** Below this width (px) the mobile image is used. Default 768. */
1315
+ breakpoint?: number;
1316
+ /**
1317
+ * Pre-fetch the alternate (off-breakpoint) image so a Desktop↔Mobile swap is an
1318
+ * instant cache hit instead of a flash-and-fetch. Default true. Set false to save
1319
+ * the one extra background request when smooth resizing isn't worth the bandwidth.
1320
+ */
1321
+ preloadAlternate?: boolean;
1322
+ className?: string;
1323
+ style?: CSSProperties;
1324
+ }
1325
+ /**
1326
+ * <HeroMedia> — above-the-fold hero image for V3 themes.
1327
+ *
1328
+ * - Real responsive srcSet routed through /api/image-transform (resize + AVIF/WebP,
1329
+ * + focal smart-crop when Cloudflare Image Resizing is enabled).
1330
+ * - LCP perf defaults: loading=eager + fetchPriority=high (disable via priority={false}).
1331
+ * - Non-destructive focal/zoom/rotation framing via applyImageTransform.
1332
+ * - Optional MOBILE art-direction image: a different bitmap below `breakpoint`.
1333
+ *
1334
+ * ## Why matchMedia, not <picture><source media>
1335
+ * Art direction is resolved in JS (a `matchMedia` listener) rather than a native
1336
+ * `<picture><source media>`. A native `<picture>` does NOT reliably re-pick its source
1337
+ * when an EMBEDDED preview resizes its iframe — exactly what the theme editor's
1338
+ * Desktop/Mobile toggle does — so the hero would stay stuck on the desktop bitmap at
1339
+ * mobile sizes. CSS media queries DO re-evaluate on that resize (Tailwind flips the
1340
+ * container to portrait), and `matchMedia` shares that engine, so the swap is
1341
+ * deterministic. The state initialises from `matchMedia` so the first client paint is
1342
+ * already correct (V3 themes mount client-side) — no desktop→mobile flash on phones.
1343
+ *
1344
+ * ## Smooth swap
1345
+ * The off-breakpoint image is pre-warmed (low priority, after paint) so toggling the
1346
+ * breakpoint — the editor switch, or a window resize — paints from cache instantly
1347
+ * instead of fetching on demand. See `preloadAlternate`.
1348
+ *
1349
+ * When `mobileSrc` is omitted this is a single responsive <img> filling its parent —
1350
+ * the theme keeps its own wrapper/sizing, identical to a raw <img> plus srcSet + perf.
1351
+ */
1352
+ declare function HeroMedia({ src, alt, transform, mobileSrc, mobileTransform, desktopAspect, mobileAspect, fit, priority, sizes, breakpoint, preloadAlternate, className, style, ...rest }: HeroMediaProps): react.JSX.Element;
1288
1353
 
1289
1354
  interface LogoProps {
1290
1355
  /** Explicit logo URL; falls back to global_settings.logo_url then shop.logo_url. */
@@ -2202,4 +2267,4 @@ declare function pickTranslations(bundle: LocaleBundle, locale: string): LocaleM
2202
2267
  */
2203
2268
  declare function buildLocaleBundle<T extends Record<string, unknown>>(modules: T): LocaleBundle;
2204
2269
 
2205
- export { AddToCartButton, type AddressInput, type AnalyticsApi, type AnalyticsPayload, type AppManifestBlock, type AppPayload, type AppState, Block, BlockInstance, BlockProps$1 as BlockProps, BlockSchema, Cart, type CheckoutAddress, type CheckoutApi, type CheckoutSessionState, type CheckoutStep, Collection, CollectionCard, type CollectionCardProps, type CollectionCardSlots, CollectionProvider, type ComputedStyleTokens, type CurrencyConfig, type CurrencyState, CurrencySwitcher, type CurrencySwitcherProps, Customer, type CustomerAddress, type CustomerAddressesState, type DefineBlockInput, type DefineSectionInput, type DefinedBlock, type DefinedSection, type DynamicResolveContext, type DynamicSourceRef, EditableImage, type EditableImageProps, EditableText, type EditableTextProps, type FocalSrcOptions, Form, type GiftCardBalance, ICON_NAMES, Icon, IconMap, type IconProps, Image, type ImageTransform, LOGO_SHAPE_OPTIONS, LOGO_SIZE_OPTIONS, Link, type LocaleBundle, type LocaleMessages, LocaleSwitcher, type LocaleSwitcherProps, Logo, type LogoProps, type LogoShape, type LogoSize, MenuItemData, Money, MountResult, type NavigationItem, type NavigationState, NuMuProvider, type OrderDetail, type OrderListEntry, type OrderListState, type OrderState, Page, type PlaceOrderResult, Product, ProductCard, type ProductCardProps, type ProductCardSlots, ProductProvider, ProductVariant, type RelatedProductsState, type ReorderResult, type ReorderSkipReason, type ReorderSkippedItem, RichText, type RichTextProps, type SearchResults, type SearchState, Section, SectionContext, SectionInstance, SectionProps$1 as SectionProps, SectionSchema, type ShippingRateOption, type ShopWithHelpers, SizeChart, Store, type ThemeEntry, ThemeMountContext, ThemeRenderArgs, ThemeSettingsV3, type UseGiftCardBalance, type UseReorder, type UseSearchOptions, type UseShippingRatesOptions, type UseShippingRatesState, type UseVariantSelection, type WishlistItem, type WishlistState, applyGlobalStyleTokens, applyImageTransform, asImageTransform, assetUrl, availableValues, buildLocaleBundle, clearSdkSingleton, collectBlocks, collectSections, computeGlobalStyleTokens, defaultVariant, defineBlock, defineSection, defineThemeEntry, dynamicSource, findVariantByOptions, flattenMessages, focalSrc, getReactSingleton, getSdkSingleton, isDefinedBlock, isDefinedSection, isDynamicSource, isSdkAvailable, logoImgStyle, logoStyleTokens, pickTranslations, registerReactSingleton, registerSdkSingleton, resolveDynamicValue, resolveFontStack, resolveSettingsMap, resolveSizeChart, resolveSourcePath, sanitizeHtml, useAnalytics, useApp, useCart, useCheckout, useCollection, useCollectionOptional, useCollections, useCurrency, useCurrentTemplate, useCustomer, useCustomerActions, useCustomerAddresses, useDirection, useFieldTranslation, useGiftCardBalance, useImage, useLocale, useLocalization, useMoney, useNavigation, useNumberFormat, useOrder, useOrders, usePage, useProduct, useProductOptional, useProductSizeChart, useProducts, useRelatedProducts, useReorder, useResolvedSettings, useSearch, useSection, useSectionOptional, useShippingRates, useShop, useThemeSettings, useTranslation, useVariantSelection, useWishlist };
2270
+ export { AddToCartButton, type AddressInput, type AnalyticsApi, type AnalyticsPayload, type AppManifestBlock, type AppPayload, type AppState, Block, BlockInstance, BlockProps$1 as BlockProps, BlockSchema, Cart, type CheckoutAddress, type CheckoutApi, type CheckoutSessionState, type CheckoutStep, Collection, CollectionCard, type CollectionCardProps, type CollectionCardSlots, CollectionProvider, type ComputedStyleTokens, type CurrencyConfig, type CurrencyState, CurrencySwitcher, type CurrencySwitcherProps, Customer, type CustomerAddress, type CustomerAddressesState, type DefineBlockInput, type DefineSectionInput, type DefinedBlock, type DefinedSection, type DynamicResolveContext, type DynamicSourceRef, EditableImage, type EditableImageProps, EditableText, type EditableTextProps, type FocalSrcOptions, Form, type GiftCardBalance, HeroMedia, type HeroMediaProps, ICON_NAMES, Icon, IconMap, type IconProps, Image, type ImageTransform, LOGO_SHAPE_OPTIONS, LOGO_SIZE_OPTIONS, Link, type LocaleBundle, type LocaleMessages, LocaleSwitcher, type LocaleSwitcherProps, Logo, type LogoProps, type LogoShape, type LogoSize, MenuItemData, Money, MountResult, type NavigationItem, type NavigationState, NuMuProvider, type OrderDetail, type OrderListEntry, type OrderListState, type OrderState, Page, type PlaceOrderResult, Product, ProductCard, type ProductCardProps, type ProductCardSlots, ProductProvider, ProductVariant, type RelatedProductsState, type ReorderResult, type ReorderSkipReason, type ReorderSkippedItem, RichText, type RichTextProps, type SearchResults, type SearchState, Section, SectionContext, SectionInstance, SectionProps$1 as SectionProps, SectionSchema, type ShippingRateOption, type ShopWithHelpers, SizeChart, Store, type ThemeEntry, ThemeMountContext, ThemeRenderArgs, ThemeSettingsV3, type UseGiftCardBalance, type UseReorder, type UseSearchOptions, type UseShippingRatesOptions, type UseShippingRatesState, type UseVariantSelection, type WishlistItem, type WishlistState, applyGlobalStyleTokens, applyImageTransform, asImageTransform, assetUrl, availableValues, buildLocaleBundle, clearSdkSingleton, collectBlocks, collectSections, computeGlobalStyleTokens, defaultVariant, defineBlock, defineSection, defineThemeEntry, dynamicSource, findVariantByOptions, flattenMessages, focalSrc, getReactSingleton, getSdkSingleton, isDefinedBlock, isDefinedSection, isDynamicSource, isSdkAvailable, logoImgStyle, logoStyleTokens, pickTranslations, registerReactSingleton, registerSdkSingleton, resolveDynamicValue, resolveFontStack, resolveSettingsMap, resolveSizeChart, resolveSourcePath, sanitizeHtml, useAnalytics, useApp, useCart, useCheckout, useCollection, useCollectionOptional, useCollections, useCurrency, useCurrentTemplate, useCustomer, useCustomerActions, useCustomerAddresses, useDirection, useFieldTranslation, useGiftCardBalance, useImage, useLocale, useLocalization, useMoney, useNavigation, useNumberFormat, useOrder, useOrders, usePage, useProduct, useProductOptional, useProductSizeChart, useProducts, useRelatedProducts, useReorder, useResolvedSettings, useSearch, useSection, useSectionOptional, useShippingRates, useShop, useThemeSettings, useTranslation, useVariantSelection, useWishlist };
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ var MAX_BLOCK_DEPTH = 5;
7
7
 
8
8
  // src/validation/index.ts
9
9
  var THEME_CONTRACT_VERSION = 1;
10
- var SDK_VERSION = "0.5.2" ;
10
+ var SDK_VERSION = "0.6.0" ;
11
11
  var REQUIRED_TEMPLATES = [
12
12
  "home",
13
13
  "product",
@@ -2740,6 +2740,7 @@ function Image({
2740
2740
  sizes = "(min-width: 1024px) 25vw, (min-width: 640px) 50vw, 100vw",
2741
2741
  responsive = true,
2742
2742
  loading = "lazy",
2743
+ priority = false,
2743
2744
  aspectRatio,
2744
2745
  objectFit,
2745
2746
  objectPosition,
@@ -2776,6 +2777,7 @@ function Image({
2776
2777
  );
2777
2778
  }
2778
2779
  const srcSet = responsive ? buildSrcSet(src) : void 0;
2780
+ const effLoading = priority ? "eager" : loading;
2779
2781
  const effFit = objectFit ?? (framed ? "cover" : void 0);
2780
2782
  const fitStyle = transform ? applyImageTransform(transform, effFit === "contain" ? "contain" : "cover") : {
2781
2783
  ...effFit ? { objectFit: effFit } : {},
@@ -2788,7 +2790,8 @@ function Image({
2788
2790
  alt,
2789
2791
  srcSet: srcSet || void 0,
2790
2792
  sizes: srcSet ? sizes : void 0,
2791
- loading,
2793
+ loading: effLoading,
2794
+ fetchPriority: priority ? "high" : void 0,
2792
2795
  decoding: "async",
2793
2796
  className: framed ? void 0 : className,
2794
2797
  style: framed ? { width: "100%", height: "100%", display: "block", ...fitStyle } : { ...fitStyle, ...style },
@@ -2812,6 +2815,111 @@ function Image({
2812
2815
  }
2813
2816
  );
2814
2817
  }
2818
+ var HERO_WIDTHS = [640, 768, 1024, 1280, 1920];
2819
+ var DEFAULT_BREAKPOINT = 768;
2820
+ var DESKTOP_BASE_WIDTH = 1920;
2821
+ var MOBILE_BASE_WIDTH = 1280;
2822
+ function heroSrcSet(url, opts) {
2823
+ return HERO_WIDTHS.map((w) => `${focalSrc(url, { width: w, ...opts })} ${w}w`).join(", ");
2824
+ }
2825
+ function HeroMedia({
2826
+ src,
2827
+ alt,
2828
+ transform,
2829
+ mobileSrc,
2830
+ mobileTransform,
2831
+ desktopAspect,
2832
+ mobileAspect,
2833
+ fit = "cover",
2834
+ priority = true,
2835
+ sizes = "100vw",
2836
+ breakpoint = DEFAULT_BREAKPOINT,
2837
+ preloadAlternate = true,
2838
+ className,
2839
+ style,
2840
+ ...rest
2841
+ }) {
2842
+ const hasMobile = !!mobileSrc;
2843
+ const mobileQuery = `(max-width: ${breakpoint - 1}px)`;
2844
+ const [isMobile, setIsMobile] = useState(
2845
+ () => hasMobile && typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(mobileQuery).matches
2846
+ );
2847
+ const [rawFallback, setRawFallback] = useState(false);
2848
+ const { onError: themeOnError, ...imgRest } = rest;
2849
+ const handleError = (e) => {
2850
+ if (!rawFallback) setRawFallback(true);
2851
+ else themeOnError?.(e);
2852
+ };
2853
+ useEffect(() => {
2854
+ if (!hasMobile || typeof window === "undefined" || typeof window.matchMedia !== "function") {
2855
+ return;
2856
+ }
2857
+ const mq = window.matchMedia(mobileQuery);
2858
+ const sync = () => setIsMobile(mq.matches);
2859
+ sync();
2860
+ mq.addEventListener?.("change", sync);
2861
+ return () => mq.removeEventListener?.("change", sync);
2862
+ }, [hasMobile, mobileQuery]);
2863
+ const desktopFocal = transform?.focal;
2864
+ const mobileFocal = mobileTransform?.focal ?? desktopFocal;
2865
+ const desktopCrop = desktopAspect ? { focal: desktopFocal, aspect: desktopAspect, fit } : {};
2866
+ const mobileCrop = {
2867
+ focal: mobileFocal,
2868
+ aspect: mobileAspect,
2869
+ fit
2870
+ };
2871
+ useEffect(() => {
2872
+ if (!preloadAlternate || !hasMobile || !src || !mobileSrc) return;
2873
+ if (typeof window === "undefined" || typeof window.Image !== "function") return;
2874
+ const altUrl = isMobile ? rawFallback ? src : focalSrc(src, { width: DESKTOP_BASE_WIDTH, ...desktopCrop }) : rawFallback ? mobileSrc : focalSrc(mobileSrc, { width: MOBILE_BASE_WIDTH, ...mobileCrop });
2875
+ if (!altUrl) return;
2876
+ const im = new window.Image();
2877
+ im.onerror = () => {
2878
+ };
2879
+ try {
2880
+ im.fetchPriority = "low";
2881
+ } catch {
2882
+ }
2883
+ im.decoding = "async";
2884
+ im.src = altUrl;
2885
+ if (typeof im.decode === "function") im.decode().catch(() => {
2886
+ });
2887
+ }, [preloadAlternate, hasMobile, src, mobileSrc, isMobile, rawFallback]);
2888
+ if (!src) {
2889
+ return /* @__PURE__ */ jsx(
2890
+ "div",
2891
+ {
2892
+ className,
2893
+ role: "img",
2894
+ "aria-label": alt,
2895
+ style: { width: "100%", height: "100%", backgroundColor: "rgba(0,0,0,0.05)", ...style }
2896
+ }
2897
+ );
2898
+ }
2899
+ const useMobile = hasMobile && isMobile;
2900
+ const activeUrl = useMobile ? mobileSrc : src;
2901
+ const activeCrop = useMobile ? mobileCrop : desktopCrop;
2902
+ const activeBase = useMobile ? MOBILE_BASE_WIDTH : DESKTOP_BASE_WIDTH;
2903
+ const activeSrc = rawFallback ? activeUrl : focalSrc(activeUrl, { width: activeBase, ...activeCrop });
2904
+ const activeSrcSet = rawFallback ? void 0 : heroSrcSet(activeUrl, activeCrop);
2905
+ const fitStyle = applyImageTransform(useMobile ? mobileTransform ?? transform : transform, fit);
2906
+ return /* @__PURE__ */ jsx(
2907
+ "img",
2908
+ {
2909
+ src: activeSrc,
2910
+ srcSet: activeSrcSet,
2911
+ sizes: activeSrcSet ? sizes : void 0,
2912
+ alt,
2913
+ loading: priority ? "eager" : "lazy",
2914
+ fetchPriority: priority ? "high" : void 0,
2915
+ decoding: "async",
2916
+ onError: handleError,
2917
+ className,
2918
+ style: { width: "100%", height: "100%", display: "block", ...fitStyle, ...style },
2919
+ ...imgRest
2920
+ }
2921
+ );
2922
+ }
2815
2923
  var str = (v) => typeof v === "string" ? v : "";
2816
2924
  var NONE_HEIGHT = { small: 28, medium: 36, large: 48 };
2817
2925
  function Logo({
@@ -4059,6 +4167,6 @@ function buildLocaleBundle(modules) {
4059
4167
  return bundle;
4060
4168
  }
4061
4169
 
4062
- export { AddToCartButton, Block, CartContext, CollectionCard, CollectionContext, CollectionProvider, CurrencySwitcher, CustomerContext, EditableImage, EditableText, Form, ICON_NAMES, Icon, IconMap, Image, KNOWN_SETTING_TYPES, KNOWN_TEMPLATES, LOGO_SHAPE_OPTIONS, LOGO_SIZE_OPTIONS, Link, LocaleSwitcher, LocalizationContext, Logo, MAX_BLOCK_DEPTH, Money, NavigationContext, NuMuProvider, PageContext, ProductCard, ProductContext, ProductProvider, REQUIRED_TEMPLATES, RichText, SDK_VERSION, Section, SectionContext, ShopContext, THEME_CONTRACT_VERSION, ThemeSettingsContext, applyGlobalStyleTokens, applyImageTransform, asImageTransform, assetUrl, availableValues, buildLocaleBundle, buildThemeElement, clearSdkSingleton, collectBlocks, collectSections, computeGlobalStyleTokens, defaultVariant, defineBlock, defineSection, defineThemeEntry, dynamicSource, findVariantByOptions, flattenMessages, focalSrc, getReactSingleton, getSdkSingleton, isDefinedBlock, isDefinedSection, isDynamicSource, isSdkAvailable, logoImgStyle, logoStyleTokens, mergeResults, mountTheme, pickTranslations, registerReactSingleton, registerSdkSingleton, resolveDynamicValue, resolveFontStack, resolveSettingsMap, resolveSizeChart, resolveSourcePath, resolveThemeSettings, sanitizeHtml, useAnalytics, useApp, useCart, useCheckout, useCollection, useCollectionOptional, useCollections, useCurrency, useCurrentTemplate, useCustomer, useCustomerActions, useCustomerAddresses, useDirection, useFieldTranslation, useGiftCardBalance, useImage, useLocale, useLocalization, useMoney, useNavigation, useNumberFormat, useOrder, useOrders, usePage, useProduct, useProductOptional, useProductSizeChart, useProducts, useRelatedProducts, useReorder, useResolvedSettings, useSearch, useSection, useSectionOptional, useShippingRates, useShop, useThemeSettings, useTranslation, useVariantSelection, useWishlist, validateBuiltManifest, validateManifest, validateSectionSchema, validateSettingsAgainstSchema };
4170
+ export { AddToCartButton, Block, CartContext, CollectionCard, CollectionContext, CollectionProvider, CurrencySwitcher, CustomerContext, EditableImage, EditableText, Form, HeroMedia, ICON_NAMES, Icon, IconMap, Image, KNOWN_SETTING_TYPES, KNOWN_TEMPLATES, LOGO_SHAPE_OPTIONS, LOGO_SIZE_OPTIONS, Link, LocaleSwitcher, LocalizationContext, Logo, MAX_BLOCK_DEPTH, Money, NavigationContext, NuMuProvider, PageContext, ProductCard, ProductContext, ProductProvider, REQUIRED_TEMPLATES, RichText, SDK_VERSION, Section, SectionContext, ShopContext, THEME_CONTRACT_VERSION, ThemeSettingsContext, applyGlobalStyleTokens, applyImageTransform, asImageTransform, assetUrl, availableValues, buildLocaleBundle, buildThemeElement, clearSdkSingleton, collectBlocks, collectSections, computeGlobalStyleTokens, defaultVariant, defineBlock, defineSection, defineThemeEntry, dynamicSource, findVariantByOptions, flattenMessages, focalSrc, getReactSingleton, getSdkSingleton, isDefinedBlock, isDefinedSection, isDynamicSource, isSdkAvailable, logoImgStyle, logoStyleTokens, mergeResults, mountTheme, pickTranslations, registerReactSingleton, registerSdkSingleton, resolveDynamicValue, resolveFontStack, resolveSettingsMap, resolveSizeChart, resolveSourcePath, resolveThemeSettings, sanitizeHtml, useAnalytics, useApp, useCart, useCheckout, useCollection, useCollectionOptional, useCollections, useCurrency, useCurrentTemplate, useCustomer, useCustomerActions, useCustomerAddresses, useDirection, useFieldTranslation, useGiftCardBalance, useImage, useLocale, useLocalization, useMoney, useNavigation, useNumberFormat, useOrder, useOrders, usePage, useProduct, useProductOptional, useProductSizeChart, useProducts, useRelatedProducts, useReorder, useResolvedSettings, useSearch, useSection, useSectionOptional, useShippingRates, useShop, useThemeSettings, useTranslation, useVariantSelection, useWishlist, validateBuiltManifest, validateManifest, validateSectionSchema, validateSettingsAgainstSchema };
4063
4171
  //# sourceMappingURL=index.mjs.map
4064
4172
  //# sourceMappingURL=index.mjs.map