@snowcone-app/ui 0.12.1 → 0.13.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.cts CHANGED
@@ -22,8 +22,8 @@ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
22
22
  export { UseRealtimeMockupOptions, useRealtimeMockup } from '@snowcone-app/sdk/react';
23
23
  import * as _meilisearch_instant_meilisearch from '@meilisearch/instant-meilisearch';
24
24
  export { F as FontPairing, T as ThemeConfig, a as ThemePreset } from './types-X8YYkINT.cjs';
25
- import { P as PersonalizationField, a as PersonalizationValues } from './types-CNJT8FUd.cjs';
26
- export { b as PersonalizationColorField, c as PersonalizationImageField, d as PersonalizationTextField } from './types-CNJT8FUd.cjs';
25
+ import { P as PersonalizationField, a as PersonalizationValues, b as PersonalizationTextField } from './types-BObPMwP5.cjs';
26
+ export { c as PersonalizationColorField, d as PersonalizationImageField } from './types-BObPMwP5.cjs';
27
27
 
28
28
  /**
29
29
  * Returns brand data for a language. Throws if the language is missing —
@@ -5999,10 +5999,39 @@ declare function usePersonalizationShimmer(containerRef: RefObject<HTMLElement |
5999
5999
 
6000
6000
  /** Normalize any hex color to uppercase 6-digit form (#RGB → #RRGGBB) */
6001
6001
  declare function normalizeHex(color: string): string;
6002
+ /** Has the buyer typed into any TEXT field of the design (any non-blank text)? */
6003
+ declare function anyTyped(fields: readonly PersonalizationField[], values: PersonalizationValues): boolean;
6004
+ /**
6005
+ * What a text field's elements draw: its box's text, or null = the element's own (designed) text. A `sample` field draws
6006
+ * its sample until anything is typed in any field, then exactly its box (empty = nothing). Any other field draws its
6007
+ * box's text ("" until typed into, which the binder leaves alone).
6008
+ */
6009
+ declare function textValueFor(field: PersonalizationTextField, values: PersonalizationValues, typed?: boolean): string | null;
6010
+ /** The font a text element draws with: the canvas's own CSS font shorthand (canvas TextMetrics buildFontString). */
6011
+ interface TextLineStyle {
6012
+ fontSize: number;
6013
+ fontFamily: string;
6014
+ bold?: boolean;
6015
+ italic?: boolean;
6016
+ /** Extra advance after each character, px (canvas letterSpacing). */
6017
+ letterSpacing?: number;
6018
+ }
6019
+ /** The canvas font shorthand for a style at a size, exactly as the canvas builds it ("italic bold 72px Oswald"). */
6020
+ declare function canvasFontString(style: TextLineStyle, fontSize?: number): string;
6021
+ /** A share of the box kept free when fitting: measurement differs by a hair between renderers (browser, server raster). */
6022
+ declare const FIT_MARGIN = 0.03;
6023
+ /**
6024
+ * The font size one line of `text` is drawn at to fit `maxWidth`: `style.fontSize` when it already fits, else the
6025
+ * largest smaller size that does (text width is linear in the font size, plus a fixed letter spacing per character).
6026
+ * Never larger than the style's size; never below 1 px. `measure(text, fontSize)` is the line's width at a size.
6027
+ */
6028
+ declare function shrinkFontSizeToFit(text: string, style: TextLineStyle, maxWidth: number, measure: (text: string, fontSize: number) => number): number;
6029
+ /** One line's width in a browser, with the canvas's own font shorthand (0 where no 2D canvas exists, e.g. on a server). */
6030
+ declare function measureTextLine(text: string, style: TextLineStyle, fontSize?: number): number;
6002
6031
  /**
6003
6032
  * Scroll an input to sit just above the iOS keyboard after it appears.
6004
6033
  * Uses visualViewport.height to determine the visible area above the keyboard.
6005
6034
  */
6006
6035
  declare function scrollInputAboveKeyboard(input: HTMLElement): void;
6007
6036
 
6008
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AddToCart, type AddToCartProps, type AddToCartStatus, ArtAlignment, type ArtAlignmentProps, ArtSelector, type ArtSelectorProps, type Artwork, ArtworkCustomizer, type ArtworkCustomizerProps, Badge, type BadgeProps, BrandLogo, type BrandLogoProps, BrandName, type BrandNameProps, Button, type ButtonProps, CanvasEditor, type CanvasExportServiceConfig, CanvasIsolationBoundary, CanvasIsolationConfigurator, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CarouselImage, type CarouselRenderProps, Checkbox, Chip, type ClipShape, Collapsible, CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, ColorPalette, ColorPicker, type ColorPickerProps, ColorRow, ColorSwatch, type ColorSwatchChoice, type ColorSwatchProps, ColorTokenSwatch, type ContentRenderProps, CurrentRefinements, CurrentSelectionDisplay, type CurrentSelectionDisplayProps, DEFAULT_HERO_ZOOM_CONFIG, DEFAULT_IMAGE_CONFIG, DEFAULT_VISIBILITY_OPTIONS, DesignSystemPage, type DeviceDetectionResult, Disclosure, DisclosureContent, DisclosureTrigger, DragHintAnimation, type DragHintAnimationProps, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EdgeBlurBox, type EdgeBlurBoxProps, EdgeSwipeGuards, type EdgeSwipeGuardsProps, EnhancedImageViewer, FACET_SECTIONS, FIRST_VIEW_MARGIN, FIRST_VIEW_PICTURE_ASPECT, type FacetSection, type FacetType, Fieldset, type FieldsetProps, Filters, FiltersButton, type FiltersButtonProps, FiltersDrawer, type FiltersProps, type FirstView, type FirstViewAnchor, type FirstViewPhoneWindow, type FirstViewProductBox, FloatingActionGroup, type FloatingActionGroupProps, type FloatingActionItem, type FormatCurrencyOptions, GallerySkipProvider, type GallerySkipValue, type GallerySkipVerdict, type GallerySkips, HeroCarousel, type HeroCarouselProps, type HeroImage, type HeroImageRenderProps, HeroProductImage, type HeroProductImageProps, type HeroShrinkConfig, HeroShrinkLayout, type HeroShrinkLayoutProps, type HeroZoomConfig, HeroZoomLayout, type HeroZoomLayoutProps, type HeroZoomScales, HorizontalProgressiveBlur, type HorizontalProgressiveBlurProps, Drawer as IOSDrawer, DrawerClose as IOSDrawerClose, DrawerContent as IOSDrawerContent, DrawerDescription as IOSDrawerDescription, DrawerFooter as IOSDrawerFooter, DrawerHeader as IOSDrawerHeader, DrawerTitle as IOSDrawerTitle, DrawerTrigger as IOSDrawerTrigger, ImageBlurExtension, type ImageBlurExtensionProps, ImageEdgeBlur, type ImageEdgeBlurProps, type ImageLayer, type ImageUpdateRequest, Input, type InputProps, Kbd, type KbdProps, Label, Legend, type LegendProps, Lightbox, type LightboxProps, Link, LinkIcon, type LinkProps, LoadingOverlayPrism, LoadingOverlayPrismCandy, LoadingOverlayPrismCandyInline, type LoadingOverlayPrismCandyProps, type LoadingOverlayPrismProps, MasonryGrid, type MasonryGridProps, MobileProductCarousel, type MobileProductCarouselProps, MockupBackground, type MockupBackgroundProps, type MockupPriorityContextValue, MockupPriorityProvider, type MockupPriorityProviderProps, type MockupResult, NO_GALLERY_SKIPS, PDPLayout, type PDPLayoutProps, PersonalizationField, PersonalizationInputs, PersonalizationProvider, PersonalizationValues, PlacementArt, type PlacementArtMap, type PlacementArtProps, PlacementClipShapeSelector, type PlacementConfig, type PlacementDesign, PlacementTabs, type PlacementTabsProps, Popover, PopoverAnchor, PopoverContent, PopoverRoot, PopoverTrigger, type PriorityLevel, Product, ProductCard, type ProductCardProps, ProductContext, type ProductDataMode, ProductGallery, type ProductGalleryProps, ProductGrid, type ProductGridProps, type ProductHit, ProductHitComponent, ProductImage, type Artwork$1 as ProductImageArtwork, type ProductImageProps, ProductList, type ProductListProps, ProductOptions, type ProductPageContext, ProductPageProvider, ProductPageProviderMinimal, type ProductPageProviderMinimalProps, type ProductPageProviderProps, ProductPrice, type ProductPriceProps, type ProductProviderProps, ProgressiveBlur, type ProgressiveBlurProps, type ProviderStatus, Radio, RadioGroup, RadioGroupItem, RadiusScale, type ReactProductContext, type RealtimeContextValue, RealtimeMockup, type RealtimeMockupProps, RealtimeProvider, type RealtimeProviderProps, type RealtimeState, type RegularArtwork$1 as RegularArtwork, type ResponsiveColumns, type ResponsiveImageCapInfo, type ResponsiveImageCapOptions, ResponsiveZoom, RightToLeftProgressiveBlur, type RightToLeftProgressiveBlurProps, SLIDE_FIRST_VIEW_ATTR, SLIDE_FIRST_VIEW_X_VAR, SLIDE_PHONE_WINDOW_ATTR, SLIDE_PRODUCT_BOX_ATTR, SLIDE_PRODUCT_X0_VAR, SLIDE_PRODUCT_X1_VAR, SafeImg, type SafeImgProps, type ScrollDirection, ScrollFade, type ScrollFadeProps, type ScrollState, type SeamlessPattern$1 as SeamlessPattern, SearchBox, SearchProvider, type SearchProviderProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Shop, ShopContext, type ShopContextValue, type ShopProps, SimpleImageBlur, type SimpleImageBlurProps, type SlideFirstViewProps, Slider, SliderFill, SliderOutput, SliderThumb, SliderTrack, Spinner, type SpinnerProps, Surface, SurfaceContext, type SurfaceProps, Switch, Tabs, TabsContent, TabsList, TabsRoot, TabsTrigger, TextArea, TextField, type TextFieldProps, Textarea, type TextareaProps, ThemeSwitcher, ThemeToggle, type ThemeToggleProps, TileCount, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, TypographyScale, type UiRouter, UiRouterProvider, type UseBrandResult, type UseImagePreloaderOptions, type UseImagePreloaderReturn, type UseImageTransitionOptions, type UseImageTransitionReturn, type UsePersonalizationShimmerReturn, type UseProductGalleryOptions, type UseProductGalleryReturn, VISIBILITY_THRESHOLDS, type ViewportDimensions, type ZoomImage, ZoomOverlay, badgeVariants, blockingSessionError, brandAssets, buttonVariants, canvasExportService, checkComponentStyles, checkTailwindConfig, checkThemeTokens, createScrollDirectionTracker, firstView, firstViewAnchorOfSlide, formatCurrency, formatDate, formatDateTime, gallerySkipVerdict, gallerySkippedStamp, galleryWithoutSkipped, getBrand, getObservedElementCount, getObserverCount, hasEdgeBlur, isObserved, isWideMonitor, kbdVariants, linkVariants, linkedPlacementsLabel, normalizeHex, observe, pictureRenderState, placementArtFor, runConfigChecks, scrollInputAboveKeyboard, searchClient, slideFirstViewFields, slideFirstViewProps, spinnerVariants, surfaceVariants, useArtworkAlignment, useBrand, useCanvasContext, useCanvasContextStatic, useCurrentPlacements, useDesign, useDesignOptional, useDeviceDetection, useFocusTrap, useGallerySkipOptional, useGallerySkipState, useHeroZoomScales, useImagePreloader, useImageTransition, useIsolatedCanvas, useLoadingOverlay, useMediaQuery, useMockupBackgroundOptional, useMockupPriority, useMockupPriorityOptional, usePersonalization, usePersonalizationOptional, usePersonalizationShimmer, usePlacementArtOptional, usePlacementClipShape, usePlacementsProcessor, useProduct, useProductGallery, useProductOptional, useProductPage, useProductPageOptional, useProductSelection, useProviderStatus, useRealtime, useRealtimeOptional, useRenderCount, useRenderGuard, useResponsiveImageCap, useScrollDirection, useSelectedArtwork, useSetArtworkAlignment, useShop, useShopOptional, useSurface, useViewportDimensions, useWideMonitorMode };
6037
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AddToCart, type AddToCartProps, type AddToCartStatus, ArtAlignment, type ArtAlignmentProps, ArtSelector, type ArtSelectorProps, type Artwork, ArtworkCustomizer, type ArtworkCustomizerProps, Badge, type BadgeProps, BrandLogo, type BrandLogoProps, BrandName, type BrandNameProps, Button, type ButtonProps, CanvasEditor, type CanvasExportServiceConfig, CanvasIsolationBoundary, CanvasIsolationConfigurator, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CarouselImage, type CarouselRenderProps, Checkbox, Chip, type ClipShape, Collapsible, CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, ColorPalette, ColorPicker, type ColorPickerProps, ColorRow, ColorSwatch, type ColorSwatchChoice, type ColorSwatchProps, ColorTokenSwatch, type ContentRenderProps, CurrentRefinements, CurrentSelectionDisplay, type CurrentSelectionDisplayProps, DEFAULT_HERO_ZOOM_CONFIG, DEFAULT_IMAGE_CONFIG, DEFAULT_VISIBILITY_OPTIONS, DesignSystemPage, type DeviceDetectionResult, Disclosure, DisclosureContent, DisclosureTrigger, DragHintAnimation, type DragHintAnimationProps, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EdgeBlurBox, type EdgeBlurBoxProps, EdgeSwipeGuards, type EdgeSwipeGuardsProps, EnhancedImageViewer, FACET_SECTIONS, FIRST_VIEW_MARGIN, FIRST_VIEW_PICTURE_ASPECT, FIT_MARGIN, type FacetSection, type FacetType, Fieldset, type FieldsetProps, Filters, FiltersButton, type FiltersButtonProps, FiltersDrawer, type FiltersProps, type FirstView, type FirstViewAnchor, type FirstViewPhoneWindow, type FirstViewProductBox, FloatingActionGroup, type FloatingActionGroupProps, type FloatingActionItem, type FormatCurrencyOptions, GallerySkipProvider, type GallerySkipValue, type GallerySkipVerdict, type GallerySkips, HeroCarousel, type HeroCarouselProps, type HeroImage, type HeroImageRenderProps, HeroProductImage, type HeroProductImageProps, type HeroShrinkConfig, HeroShrinkLayout, type HeroShrinkLayoutProps, type HeroZoomConfig, HeroZoomLayout, type HeroZoomLayoutProps, type HeroZoomScales, HorizontalProgressiveBlur, type HorizontalProgressiveBlurProps, Drawer as IOSDrawer, DrawerClose as IOSDrawerClose, DrawerContent as IOSDrawerContent, DrawerDescription as IOSDrawerDescription, DrawerFooter as IOSDrawerFooter, DrawerHeader as IOSDrawerHeader, DrawerTitle as IOSDrawerTitle, DrawerTrigger as IOSDrawerTrigger, ImageBlurExtension, type ImageBlurExtensionProps, ImageEdgeBlur, type ImageEdgeBlurProps, type ImageLayer, type ImageUpdateRequest, Input, type InputProps, Kbd, type KbdProps, Label, Legend, type LegendProps, Lightbox, type LightboxProps, Link, LinkIcon, type LinkProps, LoadingOverlayPrism, LoadingOverlayPrismCandy, LoadingOverlayPrismCandyInline, type LoadingOverlayPrismCandyProps, type LoadingOverlayPrismProps, MasonryGrid, type MasonryGridProps, MobileProductCarousel, type MobileProductCarouselProps, MockupBackground, type MockupBackgroundProps, type MockupPriorityContextValue, MockupPriorityProvider, type MockupPriorityProviderProps, type MockupResult, NO_GALLERY_SKIPS, PDPLayout, type PDPLayoutProps, PersonalizationField, PersonalizationInputs, PersonalizationProvider, PersonalizationTextField, PersonalizationValues, PlacementArt, type PlacementArtMap, type PlacementArtProps, PlacementClipShapeSelector, type PlacementConfig, type PlacementDesign, PlacementTabs, type PlacementTabsProps, Popover, PopoverAnchor, PopoverContent, PopoverRoot, PopoverTrigger, type PriorityLevel, Product, ProductCard, type ProductCardProps, ProductContext, type ProductDataMode, ProductGallery, type ProductGalleryProps, ProductGrid, type ProductGridProps, type ProductHit, ProductHitComponent, ProductImage, type Artwork$1 as ProductImageArtwork, type ProductImageProps, ProductList, type ProductListProps, ProductOptions, type ProductPageContext, ProductPageProvider, ProductPageProviderMinimal, type ProductPageProviderMinimalProps, type ProductPageProviderProps, ProductPrice, type ProductPriceProps, type ProductProviderProps, ProgressiveBlur, type ProgressiveBlurProps, type ProviderStatus, Radio, RadioGroup, RadioGroupItem, RadiusScale, type ReactProductContext, type RealtimeContextValue, RealtimeMockup, type RealtimeMockupProps, RealtimeProvider, type RealtimeProviderProps, type RealtimeState, type RegularArtwork$1 as RegularArtwork, type ResponsiveColumns, type ResponsiveImageCapInfo, type ResponsiveImageCapOptions, ResponsiveZoom, RightToLeftProgressiveBlur, type RightToLeftProgressiveBlurProps, SLIDE_FIRST_VIEW_ATTR, SLIDE_FIRST_VIEW_X_VAR, SLIDE_PHONE_WINDOW_ATTR, SLIDE_PRODUCT_BOX_ATTR, SLIDE_PRODUCT_X0_VAR, SLIDE_PRODUCT_X1_VAR, SafeImg, type SafeImgProps, type ScrollDirection, ScrollFade, type ScrollFadeProps, type ScrollState, type SeamlessPattern$1 as SeamlessPattern, SearchBox, SearchProvider, type SearchProviderProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Shop, ShopContext, type ShopContextValue, type ShopProps, SimpleImageBlur, type SimpleImageBlurProps, type SlideFirstViewProps, Slider, SliderFill, SliderOutput, SliderThumb, SliderTrack, Spinner, type SpinnerProps, Surface, SurfaceContext, type SurfaceProps, Switch, Tabs, TabsContent, TabsList, TabsRoot, TabsTrigger, TextArea, TextField, type TextFieldProps, type TextLineStyle, Textarea, type TextareaProps, ThemeSwitcher, ThemeToggle, type ThemeToggleProps, TileCount, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, TypographyScale, type UiRouter, UiRouterProvider, type UseBrandResult, type UseImagePreloaderOptions, type UseImagePreloaderReturn, type UseImageTransitionOptions, type UseImageTransitionReturn, type UsePersonalizationShimmerReturn, type UseProductGalleryOptions, type UseProductGalleryReturn, VISIBILITY_THRESHOLDS, type ViewportDimensions, type ZoomImage, ZoomOverlay, anyTyped, badgeVariants, blockingSessionError, brandAssets, buttonVariants, canvasExportService, canvasFontString, checkComponentStyles, checkTailwindConfig, checkThemeTokens, createScrollDirectionTracker, firstView, firstViewAnchorOfSlide, formatCurrency, formatDate, formatDateTime, gallerySkipVerdict, gallerySkippedStamp, galleryWithoutSkipped, getBrand, getObservedElementCount, getObserverCount, hasEdgeBlur, isObserved, isWideMonitor, kbdVariants, linkVariants, linkedPlacementsLabel, measureTextLine, normalizeHex, observe, pictureRenderState, placementArtFor, runConfigChecks, scrollInputAboveKeyboard, searchClient, shrinkFontSizeToFit, slideFirstViewFields, slideFirstViewProps, spinnerVariants, surfaceVariants, textValueFor, useArtworkAlignment, useBrand, useCanvasContext, useCanvasContextStatic, useCurrentPlacements, useDesign, useDesignOptional, useDeviceDetection, useFocusTrap, useGallerySkipOptional, useGallerySkipState, useHeroZoomScales, useImagePreloader, useImageTransition, useIsolatedCanvas, useLoadingOverlay, useMediaQuery, useMockupBackgroundOptional, useMockupPriority, useMockupPriorityOptional, usePersonalization, usePersonalizationOptional, usePersonalizationShimmer, usePlacementArtOptional, usePlacementClipShape, usePlacementsProcessor, useProduct, useProductGallery, useProductOptional, useProductPage, useProductPageOptional, useProductSelection, useProviderStatus, useRealtime, useRealtimeOptional, useRenderCount, useRenderGuard, useResponsiveImageCap, useScrollDirection, useSelectedArtwork, useSetArtworkAlignment, useShop, useShopOptional, useSurface, useViewportDimensions, useWideMonitorMode };
package/dist/index.d.ts CHANGED
@@ -22,8 +22,8 @@ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
22
22
  export { UseRealtimeMockupOptions, useRealtimeMockup } from '@snowcone-app/sdk/react';
23
23
  import * as _meilisearch_instant_meilisearch from '@meilisearch/instant-meilisearch';
24
24
  export { F as FontPairing, T as ThemeConfig, a as ThemePreset } from './types-X8YYkINT.js';
25
- import { P as PersonalizationField, a as PersonalizationValues } from './types-CNJT8FUd.js';
26
- export { b as PersonalizationColorField, c as PersonalizationImageField, d as PersonalizationTextField } from './types-CNJT8FUd.js';
25
+ import { P as PersonalizationField, a as PersonalizationValues, b as PersonalizationTextField } from './types-BObPMwP5.js';
26
+ export { c as PersonalizationColorField, d as PersonalizationImageField } from './types-BObPMwP5.js';
27
27
 
28
28
  /**
29
29
  * Returns brand data for a language. Throws if the language is missing —
@@ -5999,10 +5999,39 @@ declare function usePersonalizationShimmer(containerRef: RefObject<HTMLElement |
5999
5999
 
6000
6000
  /** Normalize any hex color to uppercase 6-digit form (#RGB → #RRGGBB) */
6001
6001
  declare function normalizeHex(color: string): string;
6002
+ /** Has the buyer typed into any TEXT field of the design (any non-blank text)? */
6003
+ declare function anyTyped(fields: readonly PersonalizationField[], values: PersonalizationValues): boolean;
6004
+ /**
6005
+ * What a text field's elements draw: its box's text, or null = the element's own (designed) text. A `sample` field draws
6006
+ * its sample until anything is typed in any field, then exactly its box (empty = nothing). Any other field draws its
6007
+ * box's text ("" until typed into, which the binder leaves alone).
6008
+ */
6009
+ declare function textValueFor(field: PersonalizationTextField, values: PersonalizationValues, typed?: boolean): string | null;
6010
+ /** The font a text element draws with: the canvas's own CSS font shorthand (canvas TextMetrics buildFontString). */
6011
+ interface TextLineStyle {
6012
+ fontSize: number;
6013
+ fontFamily: string;
6014
+ bold?: boolean;
6015
+ italic?: boolean;
6016
+ /** Extra advance after each character, px (canvas letterSpacing). */
6017
+ letterSpacing?: number;
6018
+ }
6019
+ /** The canvas font shorthand for a style at a size, exactly as the canvas builds it ("italic bold 72px Oswald"). */
6020
+ declare function canvasFontString(style: TextLineStyle, fontSize?: number): string;
6021
+ /** A share of the box kept free when fitting: measurement differs by a hair between renderers (browser, server raster). */
6022
+ declare const FIT_MARGIN = 0.03;
6023
+ /**
6024
+ * The font size one line of `text` is drawn at to fit `maxWidth`: `style.fontSize` when it already fits, else the
6025
+ * largest smaller size that does (text width is linear in the font size, plus a fixed letter spacing per character).
6026
+ * Never larger than the style's size; never below 1 px. `measure(text, fontSize)` is the line's width at a size.
6027
+ */
6028
+ declare function shrinkFontSizeToFit(text: string, style: TextLineStyle, maxWidth: number, measure: (text: string, fontSize: number) => number): number;
6029
+ /** One line's width in a browser, with the canvas's own font shorthand (0 where no 2D canvas exists, e.g. on a server). */
6030
+ declare function measureTextLine(text: string, style: TextLineStyle, fontSize?: number): number;
6002
6031
  /**
6003
6032
  * Scroll an input to sit just above the iOS keyboard after it appears.
6004
6033
  * Uses visualViewport.height to determine the visible area above the keyboard.
6005
6034
  */
6006
6035
  declare function scrollInputAboveKeyboard(input: HTMLElement): void;
6007
6036
 
6008
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AddToCart, type AddToCartProps, type AddToCartStatus, ArtAlignment, type ArtAlignmentProps, ArtSelector, type ArtSelectorProps, type Artwork, ArtworkCustomizer, type ArtworkCustomizerProps, Badge, type BadgeProps, BrandLogo, type BrandLogoProps, BrandName, type BrandNameProps, Button, type ButtonProps, CanvasEditor, type CanvasExportServiceConfig, CanvasIsolationBoundary, CanvasIsolationConfigurator, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CarouselImage, type CarouselRenderProps, Checkbox, Chip, type ClipShape, Collapsible, CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, ColorPalette, ColorPicker, type ColorPickerProps, ColorRow, ColorSwatch, type ColorSwatchChoice, type ColorSwatchProps, ColorTokenSwatch, type ContentRenderProps, CurrentRefinements, CurrentSelectionDisplay, type CurrentSelectionDisplayProps, DEFAULT_HERO_ZOOM_CONFIG, DEFAULT_IMAGE_CONFIG, DEFAULT_VISIBILITY_OPTIONS, DesignSystemPage, type DeviceDetectionResult, Disclosure, DisclosureContent, DisclosureTrigger, DragHintAnimation, type DragHintAnimationProps, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EdgeBlurBox, type EdgeBlurBoxProps, EdgeSwipeGuards, type EdgeSwipeGuardsProps, EnhancedImageViewer, FACET_SECTIONS, FIRST_VIEW_MARGIN, FIRST_VIEW_PICTURE_ASPECT, type FacetSection, type FacetType, Fieldset, type FieldsetProps, Filters, FiltersButton, type FiltersButtonProps, FiltersDrawer, type FiltersProps, type FirstView, type FirstViewAnchor, type FirstViewPhoneWindow, type FirstViewProductBox, FloatingActionGroup, type FloatingActionGroupProps, type FloatingActionItem, type FormatCurrencyOptions, GallerySkipProvider, type GallerySkipValue, type GallerySkipVerdict, type GallerySkips, HeroCarousel, type HeroCarouselProps, type HeroImage, type HeroImageRenderProps, HeroProductImage, type HeroProductImageProps, type HeroShrinkConfig, HeroShrinkLayout, type HeroShrinkLayoutProps, type HeroZoomConfig, HeroZoomLayout, type HeroZoomLayoutProps, type HeroZoomScales, HorizontalProgressiveBlur, type HorizontalProgressiveBlurProps, Drawer as IOSDrawer, DrawerClose as IOSDrawerClose, DrawerContent as IOSDrawerContent, DrawerDescription as IOSDrawerDescription, DrawerFooter as IOSDrawerFooter, DrawerHeader as IOSDrawerHeader, DrawerTitle as IOSDrawerTitle, DrawerTrigger as IOSDrawerTrigger, ImageBlurExtension, type ImageBlurExtensionProps, ImageEdgeBlur, type ImageEdgeBlurProps, type ImageLayer, type ImageUpdateRequest, Input, type InputProps, Kbd, type KbdProps, Label, Legend, type LegendProps, Lightbox, type LightboxProps, Link, LinkIcon, type LinkProps, LoadingOverlayPrism, LoadingOverlayPrismCandy, LoadingOverlayPrismCandyInline, type LoadingOverlayPrismCandyProps, type LoadingOverlayPrismProps, MasonryGrid, type MasonryGridProps, MobileProductCarousel, type MobileProductCarouselProps, MockupBackground, type MockupBackgroundProps, type MockupPriorityContextValue, MockupPriorityProvider, type MockupPriorityProviderProps, type MockupResult, NO_GALLERY_SKIPS, PDPLayout, type PDPLayoutProps, PersonalizationField, PersonalizationInputs, PersonalizationProvider, PersonalizationValues, PlacementArt, type PlacementArtMap, type PlacementArtProps, PlacementClipShapeSelector, type PlacementConfig, type PlacementDesign, PlacementTabs, type PlacementTabsProps, Popover, PopoverAnchor, PopoverContent, PopoverRoot, PopoverTrigger, type PriorityLevel, Product, ProductCard, type ProductCardProps, ProductContext, type ProductDataMode, ProductGallery, type ProductGalleryProps, ProductGrid, type ProductGridProps, type ProductHit, ProductHitComponent, ProductImage, type Artwork$1 as ProductImageArtwork, type ProductImageProps, ProductList, type ProductListProps, ProductOptions, type ProductPageContext, ProductPageProvider, ProductPageProviderMinimal, type ProductPageProviderMinimalProps, type ProductPageProviderProps, ProductPrice, type ProductPriceProps, type ProductProviderProps, ProgressiveBlur, type ProgressiveBlurProps, type ProviderStatus, Radio, RadioGroup, RadioGroupItem, RadiusScale, type ReactProductContext, type RealtimeContextValue, RealtimeMockup, type RealtimeMockupProps, RealtimeProvider, type RealtimeProviderProps, type RealtimeState, type RegularArtwork$1 as RegularArtwork, type ResponsiveColumns, type ResponsiveImageCapInfo, type ResponsiveImageCapOptions, ResponsiveZoom, RightToLeftProgressiveBlur, type RightToLeftProgressiveBlurProps, SLIDE_FIRST_VIEW_ATTR, SLIDE_FIRST_VIEW_X_VAR, SLIDE_PHONE_WINDOW_ATTR, SLIDE_PRODUCT_BOX_ATTR, SLIDE_PRODUCT_X0_VAR, SLIDE_PRODUCT_X1_VAR, SafeImg, type SafeImgProps, type ScrollDirection, ScrollFade, type ScrollFadeProps, type ScrollState, type SeamlessPattern$1 as SeamlessPattern, SearchBox, SearchProvider, type SearchProviderProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Shop, ShopContext, type ShopContextValue, type ShopProps, SimpleImageBlur, type SimpleImageBlurProps, type SlideFirstViewProps, Slider, SliderFill, SliderOutput, SliderThumb, SliderTrack, Spinner, type SpinnerProps, Surface, SurfaceContext, type SurfaceProps, Switch, Tabs, TabsContent, TabsList, TabsRoot, TabsTrigger, TextArea, TextField, type TextFieldProps, Textarea, type TextareaProps, ThemeSwitcher, ThemeToggle, type ThemeToggleProps, TileCount, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, TypographyScale, type UiRouter, UiRouterProvider, type UseBrandResult, type UseImagePreloaderOptions, type UseImagePreloaderReturn, type UseImageTransitionOptions, type UseImageTransitionReturn, type UsePersonalizationShimmerReturn, type UseProductGalleryOptions, type UseProductGalleryReturn, VISIBILITY_THRESHOLDS, type ViewportDimensions, type ZoomImage, ZoomOverlay, badgeVariants, blockingSessionError, brandAssets, buttonVariants, canvasExportService, checkComponentStyles, checkTailwindConfig, checkThemeTokens, createScrollDirectionTracker, firstView, firstViewAnchorOfSlide, formatCurrency, formatDate, formatDateTime, gallerySkipVerdict, gallerySkippedStamp, galleryWithoutSkipped, getBrand, getObservedElementCount, getObserverCount, hasEdgeBlur, isObserved, isWideMonitor, kbdVariants, linkVariants, linkedPlacementsLabel, normalizeHex, observe, pictureRenderState, placementArtFor, runConfigChecks, scrollInputAboveKeyboard, searchClient, slideFirstViewFields, slideFirstViewProps, spinnerVariants, surfaceVariants, useArtworkAlignment, useBrand, useCanvasContext, useCanvasContextStatic, useCurrentPlacements, useDesign, useDesignOptional, useDeviceDetection, useFocusTrap, useGallerySkipOptional, useGallerySkipState, useHeroZoomScales, useImagePreloader, useImageTransition, useIsolatedCanvas, useLoadingOverlay, useMediaQuery, useMockupBackgroundOptional, useMockupPriority, useMockupPriorityOptional, usePersonalization, usePersonalizationOptional, usePersonalizationShimmer, usePlacementArtOptional, usePlacementClipShape, usePlacementsProcessor, useProduct, useProductGallery, useProductOptional, useProductPage, useProductPageOptional, useProductSelection, useProviderStatus, useRealtime, useRealtimeOptional, useRenderCount, useRenderGuard, useResponsiveImageCap, useScrollDirection, useSelectedArtwork, useSetArtworkAlignment, useShop, useShopOptional, useSurface, useViewportDimensions, useWideMonitorMode };
6037
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AddToCart, type AddToCartProps, type AddToCartStatus, ArtAlignment, type ArtAlignmentProps, ArtSelector, type ArtSelectorProps, type Artwork, ArtworkCustomizer, type ArtworkCustomizerProps, Badge, type BadgeProps, BrandLogo, type BrandLogoProps, BrandName, type BrandNameProps, Button, type ButtonProps, CanvasEditor, type CanvasExportServiceConfig, CanvasIsolationBoundary, CanvasIsolationConfigurator, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CarouselImage, type CarouselRenderProps, Checkbox, Chip, type ClipShape, Collapsible, CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, ColorPalette, ColorPicker, type ColorPickerProps, ColorRow, ColorSwatch, type ColorSwatchChoice, type ColorSwatchProps, ColorTokenSwatch, type ContentRenderProps, CurrentRefinements, CurrentSelectionDisplay, type CurrentSelectionDisplayProps, DEFAULT_HERO_ZOOM_CONFIG, DEFAULT_IMAGE_CONFIG, DEFAULT_VISIBILITY_OPTIONS, DesignSystemPage, type DeviceDetectionResult, Disclosure, DisclosureContent, DisclosureTrigger, DragHintAnimation, type DragHintAnimationProps, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EdgeBlurBox, type EdgeBlurBoxProps, EdgeSwipeGuards, type EdgeSwipeGuardsProps, EnhancedImageViewer, FACET_SECTIONS, FIRST_VIEW_MARGIN, FIRST_VIEW_PICTURE_ASPECT, FIT_MARGIN, type FacetSection, type FacetType, Fieldset, type FieldsetProps, Filters, FiltersButton, type FiltersButtonProps, FiltersDrawer, type FiltersProps, type FirstView, type FirstViewAnchor, type FirstViewPhoneWindow, type FirstViewProductBox, FloatingActionGroup, type FloatingActionGroupProps, type FloatingActionItem, type FormatCurrencyOptions, GallerySkipProvider, type GallerySkipValue, type GallerySkipVerdict, type GallerySkips, HeroCarousel, type HeroCarouselProps, type HeroImage, type HeroImageRenderProps, HeroProductImage, type HeroProductImageProps, type HeroShrinkConfig, HeroShrinkLayout, type HeroShrinkLayoutProps, type HeroZoomConfig, HeroZoomLayout, type HeroZoomLayoutProps, type HeroZoomScales, HorizontalProgressiveBlur, type HorizontalProgressiveBlurProps, Drawer as IOSDrawer, DrawerClose as IOSDrawerClose, DrawerContent as IOSDrawerContent, DrawerDescription as IOSDrawerDescription, DrawerFooter as IOSDrawerFooter, DrawerHeader as IOSDrawerHeader, DrawerTitle as IOSDrawerTitle, DrawerTrigger as IOSDrawerTrigger, ImageBlurExtension, type ImageBlurExtensionProps, ImageEdgeBlur, type ImageEdgeBlurProps, type ImageLayer, type ImageUpdateRequest, Input, type InputProps, Kbd, type KbdProps, Label, Legend, type LegendProps, Lightbox, type LightboxProps, Link, LinkIcon, type LinkProps, LoadingOverlayPrism, LoadingOverlayPrismCandy, LoadingOverlayPrismCandyInline, type LoadingOverlayPrismCandyProps, type LoadingOverlayPrismProps, MasonryGrid, type MasonryGridProps, MobileProductCarousel, type MobileProductCarouselProps, MockupBackground, type MockupBackgroundProps, type MockupPriorityContextValue, MockupPriorityProvider, type MockupPriorityProviderProps, type MockupResult, NO_GALLERY_SKIPS, PDPLayout, type PDPLayoutProps, PersonalizationField, PersonalizationInputs, PersonalizationProvider, PersonalizationTextField, PersonalizationValues, PlacementArt, type PlacementArtMap, type PlacementArtProps, PlacementClipShapeSelector, type PlacementConfig, type PlacementDesign, PlacementTabs, type PlacementTabsProps, Popover, PopoverAnchor, PopoverContent, PopoverRoot, PopoverTrigger, type PriorityLevel, Product, ProductCard, type ProductCardProps, ProductContext, type ProductDataMode, ProductGallery, type ProductGalleryProps, ProductGrid, type ProductGridProps, type ProductHit, ProductHitComponent, ProductImage, type Artwork$1 as ProductImageArtwork, type ProductImageProps, ProductList, type ProductListProps, ProductOptions, type ProductPageContext, ProductPageProvider, ProductPageProviderMinimal, type ProductPageProviderMinimalProps, type ProductPageProviderProps, ProductPrice, type ProductPriceProps, type ProductProviderProps, ProgressiveBlur, type ProgressiveBlurProps, type ProviderStatus, Radio, RadioGroup, RadioGroupItem, RadiusScale, type ReactProductContext, type RealtimeContextValue, RealtimeMockup, type RealtimeMockupProps, RealtimeProvider, type RealtimeProviderProps, type RealtimeState, type RegularArtwork$1 as RegularArtwork, type ResponsiveColumns, type ResponsiveImageCapInfo, type ResponsiveImageCapOptions, ResponsiveZoom, RightToLeftProgressiveBlur, type RightToLeftProgressiveBlurProps, SLIDE_FIRST_VIEW_ATTR, SLIDE_FIRST_VIEW_X_VAR, SLIDE_PHONE_WINDOW_ATTR, SLIDE_PRODUCT_BOX_ATTR, SLIDE_PRODUCT_X0_VAR, SLIDE_PRODUCT_X1_VAR, SafeImg, type SafeImgProps, type ScrollDirection, ScrollFade, type ScrollFadeProps, type ScrollState, type SeamlessPattern$1 as SeamlessPattern, SearchBox, SearchProvider, type SearchProviderProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Shop, ShopContext, type ShopContextValue, type ShopProps, SimpleImageBlur, type SimpleImageBlurProps, type SlideFirstViewProps, Slider, SliderFill, SliderOutput, SliderThumb, SliderTrack, Spinner, type SpinnerProps, Surface, SurfaceContext, type SurfaceProps, Switch, Tabs, TabsContent, TabsList, TabsRoot, TabsTrigger, TextArea, TextField, type TextFieldProps, type TextLineStyle, Textarea, type TextareaProps, ThemeSwitcher, ThemeToggle, type ThemeToggleProps, TileCount, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, TypographyScale, type UiRouter, UiRouterProvider, type UseBrandResult, type UseImagePreloaderOptions, type UseImagePreloaderReturn, type UseImageTransitionOptions, type UseImageTransitionReturn, type UsePersonalizationShimmerReturn, type UseProductGalleryOptions, type UseProductGalleryReturn, VISIBILITY_THRESHOLDS, type ViewportDimensions, type ZoomImage, ZoomOverlay, anyTyped, badgeVariants, blockingSessionError, brandAssets, buttonVariants, canvasExportService, canvasFontString, checkComponentStyles, checkTailwindConfig, checkThemeTokens, createScrollDirectionTracker, firstView, firstViewAnchorOfSlide, formatCurrency, formatDate, formatDateTime, gallerySkipVerdict, gallerySkippedStamp, galleryWithoutSkipped, getBrand, getObservedElementCount, getObserverCount, hasEdgeBlur, isObserved, isWideMonitor, kbdVariants, linkVariants, linkedPlacementsLabel, measureTextLine, normalizeHex, observe, pictureRenderState, placementArtFor, runConfigChecks, scrollInputAboveKeyboard, searchClient, shrinkFontSizeToFit, slideFirstViewFields, slideFirstViewProps, spinnerVariants, surfaceVariants, textValueFor, useArtworkAlignment, useBrand, useCanvasContext, useCanvasContextStatic, useCurrentPlacements, useDesign, useDesignOptional, useDeviceDetection, useFocusTrap, useGallerySkipOptional, useGallerySkipState, useHeroZoomScales, useImagePreloader, useImageTransition, useIsolatedCanvas, useLoadingOverlay, useMediaQuery, useMockupBackgroundOptional, useMockupPriority, useMockupPriorityOptional, usePersonalization, usePersonalizationOptional, usePersonalizationShimmer, usePlacementArtOptional, usePlacementClipShape, usePlacementsProcessor, useProduct, useProductGallery, useProductOptional, useProductPage, useProductPageOptional, useProductSelection, useProviderStatus, useRealtime, useRealtimeOptional, useRenderCount, useRenderGuard, useResponsiveImageCap, useScrollDirection, useSelectedArtwork, useSetArtworkAlignment, useShop, useShopOptional, useSurface, useViewportDimensions, useWideMonitorMode };
package/dist/index.js CHANGED
@@ -7,11 +7,17 @@ import {
7
7
  getThemeVariant
8
8
  } from "./chunk-YYDBUSLM.js";
9
9
  import {
10
+ FIT_MARGIN,
11
+ anyTyped,
12
+ canvasFontString,
10
13
  isValidImageUrl,
14
+ measureTextLine,
11
15
  normalizeHex,
12
16
  scrollInputAboveKeyboard,
17
+ shrinkFontSizeToFit,
18
+ textValueFor,
13
19
  useDebouncedValue
14
- } from "./chunk-WDOT4BST.js";
20
+ } from "./chunk-GY6TC6M6.js";
15
21
  import {
16
22
  UiRouterProvider,
17
23
  useUiRouter,
@@ -15417,7 +15423,7 @@ function usePersonalizationContext() {
15417
15423
  import { Fragment as Fragment21, jsx as jsx91, jsxs as jsxs62 } from "react/jsx-runtime";
15418
15424
  function createBridgeFromCanvas(canvasModule) {
15419
15425
  const { useEditor, useCommands, useImageBinding } = canvasModule;
15420
- function TextBinder({ name, value }) {
15426
+ function TextBinder({ name, value, fit, sample }) {
15421
15427
  const { elements } = useEditor();
15422
15428
  const { executeElementUpdate } = useCommands();
15423
15429
  const elementsRef = React58.useRef(elements);
@@ -15425,19 +15431,52 @@ function createBridgeFromCanvas(canvasModule) {
15425
15431
  const executeRef = React58.useRef(executeElementUpdate);
15426
15432
  executeRef.current = executeElementUpdate;
15427
15433
  const hasUserInput = React58.useRef(false);
15434
+ const designed = React58.useRef(/* @__PURE__ */ new Map());
15428
15435
  React58.useEffect(() => {
15429
- if (value == null) return;
15430
- if (value === "" && !hasUserInput.current) return;
15436
+ if (value === null && !hasUserInput.current) return;
15437
+ if (value === "" && !hasUserInput.current && !sample) return;
15431
15438
  hasUserInput.current = true;
15432
- const exec = executeRef.current;
15433
- for (const el of elementsRef.current) {
15434
- if (el.name !== name) continue;
15435
- if (!("setText" in el) || typeof el.setText !== "function") continue;
15436
- const cloned = el.clone();
15437
- cloned.setText(value);
15438
- exec(el, cloned);
15439
+ let cancelled = false;
15440
+ const bound = elementsRef.current.filter((el) => el.name === name && typeof el.setText === "function");
15441
+ for (const el of bound) {
15442
+ if (!designed.current.has(el.id)) designed.current.set(el.id, { text: typeof el.getText === "function" ? el.getText() : el.text, fontSize: el.fontSize });
15443
+ }
15444
+ const apply = (sizes) => {
15445
+ if (cancelled) return;
15446
+ const exec = executeRef.current;
15447
+ for (const el of elementsRef.current) {
15448
+ if (el.name !== name) continue;
15449
+ if (!("setText" in el) || typeof el.setText !== "function") continue;
15450
+ const own = designed.current.get(el.id);
15451
+ const cloned = el.clone();
15452
+ cloned.setText(value ?? own?.text ?? "");
15453
+ const size = value === null ? own?.fontSize : sizes.get(el.id);
15454
+ if (size !== void 0) cloned.fontSize = size;
15455
+ exec(el, cloned);
15456
+ }
15457
+ };
15458
+ if (fit !== "shrink" || value === null) {
15459
+ apply(/* @__PURE__ */ new Map());
15460
+ return () => {
15461
+ cancelled = true;
15462
+ };
15439
15463
  }
15440
- }, [value, name, elements.length]);
15464
+ const styled = bound.map((el) => {
15465
+ const style = { fontSize: designed.current.get(el.id).fontSize, fontFamily: el.fontFamily, bold: el.bold, italic: el.italic, letterSpacing: el.letterSpacing };
15466
+ return { id: el.id, style, boxWidth: Number(el.transformData?.width) || 0 };
15467
+ });
15468
+ const fonts = typeof document !== "undefined" && document.fonts ? Promise.all(styled.map((st) => document.fonts.load(canvasFontString(st.style)).catch(() => []))) : Promise.resolve([]);
15469
+ void fonts.then(() => {
15470
+ const sizes = /* @__PURE__ */ new Map();
15471
+ for (const st of styled) {
15472
+ sizes.set(st.id, st.boxWidth > 0 ? shrinkFontSizeToFit(value, st.style, st.boxWidth, (t, size) => measureTextLine(t, st.style, size)) : st.style.fontSize);
15473
+ }
15474
+ apply(sizes);
15475
+ });
15476
+ return () => {
15477
+ cancelled = true;
15478
+ };
15479
+ }, [value, name, fit, sample, elements.length]);
15441
15480
  return null;
15442
15481
  }
15443
15482
  function ColorBinder({ originalColor, newColor }) {
@@ -15502,9 +15541,10 @@ function createBridgeFromCanvas(canvasModule) {
15502
15541
  return null;
15503
15542
  }
15504
15543
  return function PersonalizationBridge({ fields = [], values = {} } = {}) {
15544
+ const typed = anyTyped(fields, values);
15505
15545
  return /* @__PURE__ */ jsx91(Fragment21, { children: fields.map((field) => {
15506
15546
  if (field.type === "text") {
15507
- return /* @__PURE__ */ jsx91(TextBinder, { name: field.name, value: values[field.name] ?? "" }, `text-${field.name}`);
15547
+ return /* @__PURE__ */ jsx91(TextBinder, { name: field.name, value: textValueFor(field, values, typed), fit: field.fit, sample: field.sample }, `text-${field.name}`);
15508
15548
  }
15509
15549
  if (field.type === "color") {
15510
15550
  return /* @__PURE__ */ jsx91(ColorBinder, { originalColor: field.color, newColor: values[field.color] ?? field.color }, `color-${field.color}`);
@@ -15722,7 +15762,9 @@ function PersonalizationInputs({
15722
15762
  "input",
15723
15763
  {
15724
15764
  type: "text",
15765
+ "aria-label": field.label,
15725
15766
  placeholder: field.placeholder || field.label,
15767
+ maxLength: field.maxLength,
15726
15768
  value: personValues[field.name] ?? "",
15727
15769
  onChange: (e) => updateField(field.name, e.target.value),
15728
15770
  onFocus: handleFocus,
@@ -15922,6 +15964,7 @@ export {
15922
15964
  FACET_SECTIONS,
15923
15965
  FIRST_VIEW_MARGIN,
15924
15966
  FIRST_VIEW_PICTURE_ASPECT,
15967
+ FIT_MARGIN,
15925
15968
  Fieldset,
15926
15969
  Filters,
15927
15970
  FiltersButton,
@@ -16043,11 +16086,13 @@ export {
16043
16086
  UiRouterProvider,
16044
16087
  VISIBILITY_THRESHOLDS,
16045
16088
  ZoomOverlay,
16089
+ anyTyped,
16046
16090
  badgeVariants,
16047
16091
  blockingSessionError,
16048
16092
  brandAssets,
16049
16093
  buttonVariants,
16050
16094
  canvasExportService,
16095
+ canvasFontString,
16051
16096
  checkComponentStyles,
16052
16097
  checkTailwindConfig,
16053
16098
  checkThemeTokens,
@@ -16074,6 +16119,7 @@ export {
16074
16119
  linkVariants,
16075
16120
  linkedPlacementsLabel,
16076
16121
  listProducts4 as listProducts,
16122
+ measureTextLine,
16077
16123
  normalizeHex,
16078
16124
  observe,
16079
16125
  pictureRenderState,
@@ -16081,10 +16127,12 @@ export {
16081
16127
  runConfigChecks,
16082
16128
  scrollInputAboveKeyboard,
16083
16129
  searchClient,
16130
+ shrinkFontSizeToFit,
16084
16131
  slideFirstViewFields,
16085
16132
  slideFirstViewProps,
16086
16133
  spinnerVariants,
16087
16134
  surfaceVariants,
16135
+ textValueFor,
16088
16136
  useArtworkAlignment,
16089
16137
  useBrand,
16090
16138
  useCanvasContext,