@atom63/widgets 0.1.0-beta.3 → 0.1.0-beta.5

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.
@@ -1,4 +1,4 @@
1
- import { cn, wuMerge, wu, WIDGET_BODY_INSET, widgetInsetStyle, widgetChromeIconStyle, widgetTypeStyle, widgetClampRelief } from './chunk-F5NV6XJ5.js';
1
+ import { cn, wuMerge, wu, WIDGET_BODY_INSET, widgetInsetStyle, widgetChromeIconStyle, widgetTypeStyle, widgetClampRelief } from './chunk-QCNNU4OV.js';
2
2
  import { Avatar, AvatarImage, AvatarFallback } from '@atom63/ui-react';
3
3
  import { LoaderCircle, RefreshCw } from 'lucide-react';
4
4
  import { memo, createContext, useContext } from 'react';
@@ -218,5 +218,5 @@ function WidgetShell({
218
218
  }
219
219
 
220
220
  export { WIDGET_BODY_INSET_CLASS, WIDGET_CARD_SURFACE_CLASS, WIDGET_RIM_SHELL_CLASS, WidgetAvatar, WidgetBlock, WidgetBlockContent, WidgetBlockFooter, WidgetBlockHeader, WidgetCard, WidgetCardContent, WidgetCardHeader, WidgetCardHeaderLeft, WidgetCardHeaderRight, WidgetCardRow, WidgetCardTextGroup, WidgetCardTitle, WidgetShell, WidgetSurface, WidgetSurfaceSizeProvider, useWidgetSurfaceSize };
221
- //# sourceMappingURL=chunk-US2CE3BV.js.map
222
- //# sourceMappingURL=chunk-US2CE3BV.js.map
221
+ //# sourceMappingURL=chunk-3ND4LGYB.js.map
222
+ //# sourceMappingURL=chunk-3ND4LGYB.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/primitives/widget-avatar.tsx","../src/primitives/widget-surface-classes.ts","../src/primitives/widget-surface.tsx","../src/primitives/widget-card.tsx"],"names":["jsx","jsxs"],"mappings":";;;;;;AAoCO,IAAM,YAAA,GAAe,IAAA;AAAA,EAC1B,CAAC;AAAA,IACC,GAAA,GAAM,EAAA;AAAA,IACN,IAAA,GAAO,KAAA;AAAA,IACP,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AW,eAAA,EAC3B,QAAA,EAAA;AAAA,sBAAAD,GAAAA,CAAC,eAAA,EAAA,EAAgB,IAAA,EAAa,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,MACnC;AAAA,KAAA,EACH,CAAA;AAAA,oBACAA,GAAAA,CAAC,iBAAA,EAAA,EAAkB,SAAA,EAAW,kBAAmB,QAAA,EAAS;AAAA,GAAA,EAC5D,CAAA;AAEJ","file":"chunk-US2CE3BV.js","sourcesContent":["import { Avatar, AvatarFallback, AvatarImage } from '@atom63/ui-react'\nimport { LoaderCircle, RefreshCw } from 'lucide-react'\nimport { memo } from 'react'\nimport { cn } from '../utils'\n\nexport type WidgetAvatarSize = 'sm' | 'md' | 'lg' | 'xl'\n\nexport interface WidgetAvatarProps {\n alt?: string\n /** Loading or shuffling: reveals the overlay and shows a spinner. */\n busy?: boolean\n className?: string\n fallback: string\n /** When provided, the avatar becomes a shuffle affordance (hover/focus reveal). */\n onShuffle?: () => void\n shuffleLabel?: string\n /** Draws the primary accent ring (e.g. the featured card avatar). */\n showOutline?: boolean\n size?: WidgetAvatarSize\n src?: string\n /**\n * Shows the decorative presence dot seated on the circle's lower-right.\n * The status meaning is conveyed textually elsewhere (e.g. a status badge),\n * so the dot itself is aria-hidden.\n */\n status?: boolean\n}\n\n/**\n * Circular avatar primitive with an optional shuffle overlay and a presence dot.\n * Chrome-agnostic and data-agnostic — widgets map their own data onto it.\n *\n * Per-size geometry (the avatar, the presence dot and the shuffle glyph) comes\n * from the stylesheet, keyed on `data-widget-avatar-size`. The status dot is\n * seated on the circle's lower-end arc, not the bounding-box corner.\n */\nexport const WidgetAvatar = memo<WidgetAvatarProps>(\n ({\n alt = '',\n busy = false,\n className,\n fallback,\n onShuffle,\n shuffleLabel = 'Shuffle avatar',\n showOutline = false,\n size = 'md',\n src,\n status = false,\n }) => {\n const canShuffle = Boolean(onShuffle)\n\n return (\n <div\n className={cn('a63-WidgetAvatar', className)}\n data-busy={busy ? '' : undefined}\n data-slot=\"widget-avatar\"\n data-widget-avatar-size={size}\n >\n <Avatar className=\"a63-WidgetAvatar-avatar\" data-outline={showOutline ? '' : undefined}>\n <AvatarImage alt={alt} src={src} />\n <AvatarFallback>{fallback}</AvatarFallback>\n </Avatar>\n\n {busy && <span aria-hidden className=\"a63-WidgetAvatar-busyRing\" />}\n\n {canShuffle && (\n <button\n aria-label={shuffleLabel}\n className=\"a63-WidgetAvatar-shuffle\"\n disabled={busy}\n onClick={onShuffle}\n type=\"button\"\n >\n {busy ? (\n <LoaderCircle aria-hidden className=\"a63-WidgetAvatar-shuffleIcon a63-Widget-spin\" />\n ) : (\n <RefreshCw aria-hidden className=\"a63-WidgetAvatar-shuffleIcon\" />\n )}\n </button>\n )}\n\n {status && (\n // The notch ring matches the card surface the avatar sits on, not the\n // page, so the separator stays visible across themes and hosts.\n <span aria-hidden className=\"a63-WidgetAvatar-status\" data-slot=\"widget-avatar-status\" />\n )}\n </div>\n )\n }\n)\n\nWidgetAvatar.displayName = 'WidgetAvatar'\n","/**\n * Outer shell of the themed widget surface — the rim.\n *\n * The rim is real geometry between the tile edge and the card face, so it can\n * carry a gradient across the whole frame, its own backdrop-filter, and a\n * smaller inner radius; a `box-shadow` inset can do none of those.\n *\n * It is a BORDER, not padding. Both inset the face identically, but only a\n * border follows `border-radius` — it mitres around each corner arc and takes a\n * per-side color. That is what lets a bevel theme light the top and left edges\n * while darkening the bottom and right AT ANY RADIUS. Radius is a\n * personalization axis, so the chrome has to hold up across it, not just at\n * each theme's default.\n *\n * The drop shadow belongs here, on the outermost box, so it casts from the true\n * tile edge. The shell's z-index scopes the face's material pseudo to this\n * surface's own stacking context so it can't bleed behind sibling tiles.\n *\n * The declarations live in `@atom63/widgets/styles.css` (`.a63-WidgetSurface`).\n */\nexport const WIDGET_RIM_SHELL_CLASS = 'a63-WidgetSurface'\n\n/**\n * Inner face of the themed widget surface — the card material.\n *\n * The frosted-glass fill + backdrop blur live on an isolated `::before` layer\n * (behind the content), not on the face element itself. Decoupling the blur\n * from content paint fixes the Chrome backdrop-filter flicker (crbug 41471914)\n * and the border-radius bleed (crbug 41212594 / 41432992).\n *\n * Deliberately NOT `position: relative`: a host can compose this class with its\n * own absolute positioning (a drag placeholder, for instance). `WidgetSurface`\n * adds the positioning itself to anchor the ::before material to the face.\n *\n * The declarations live in `@atom63/widgets/styles.css`\n * (`.a63-WidgetSurface-face`).\n */\nexport const WIDGET_CARD_SURFACE_CLASS = 'a63-WidgetSurface-face'\n","import { createContext, type HTMLAttributes, type ReactNode, useContext } from 'react'\nimport type { WidgetSize } from '../types'\nimport { cn } from '../utils'\nimport { WIDGET_CARD_SURFACE_CLASS, WIDGET_RIM_SHELL_CLASS } from './widget-surface-classes'\n\nconst WidgetSurfaceSizeContext = createContext<WidgetSize | undefined>(undefined)\n\n/**\n * The partition reads Tailwind utility names, because that is what consumer\n * call sites write. The package's own classes stay on the face.\n *\n * Classes that size the widget's OUTER box, so they belong on the shell and must\n * NOT stay on the face. A consumer writing `w-80` means \"this widget is 320px\n * wide\" — left on the face it constrains the material while the shell still\n * stretches to its parent, which shows up as dead space along one edge.\n *\n * Deliberately excludes bare `flex` and `flex-col`/`flex-row`: those set display\n * and direction for the CHILDREN, so they stay on the face.\n */\nconst SHELL_BOX_CLASS_PATTERN = /(^|:)(w|h|size|max-w|max-h|basis|aspect)-\\[?[a-z0-9./%[\\]-]+\\]?$/\n\n/**\n * Classes that must apply to BOTH boxes. `overflow-*` because the shell owns the\n * outer clip, so a view asking for `overflow-visible` has to escape both. Flex\n * item + min-size because each box is a flex item of the one above it, and\n * `min-h-0` on the face is separately load-bearing for internal scrolling.\n */\nconst SHARED_CLASS_PATTERN =\n /(^|:)(overflow(-[xy])?-[a-z]+|min-[wh]-[a-z0-9.[\\]/-]+|flex-(1|auto|initial|none)|grow(-0)?|shrink(-0)?)$/\n\nfunction partitionSurfaceClasses(className: string | undefined) {\n if (!className) return { face: undefined, shell: undefined }\n const face: string[] = []\n const shell: string[] = []\n for (const token of className.split(/\\s+/).filter(Boolean)) {\n if (SHELL_BOX_CLASS_PATTERN.test(token)) {\n shell.push(token)\n continue\n }\n face.push(token)\n if (SHARED_CLASS_PATTERN.test(token)) shell.push(token)\n }\n return {\n face: face.length > 0 ? face.join(' ') : undefined,\n shell: shell.length > 0 ? shell.join(' ') : undefined,\n }\n}\n\n/** Read the size of the nearest enclosing WidgetSurface (undefined outside one). */\nexport function useWidgetSurfaceSize(): WidgetSize | undefined {\n return useContext(WidgetSurfaceSizeContext)\n}\n\n/**\n * Publish a surface size WITHOUT any chrome.\n *\n * Use this inside a widget when an inner region only needs content blocks to\n * read `useWidgetSurfaceSize()` for density. Reaching for `WidgetSurface` and\n * switching its chrome off with `rounded-none border-0 bg-transparent\n * before:hidden` no longer works: `className` lands on the face, so the rim\n * shell still paints padding, background and radius — which renders as a\n * nested card inside the widget.\n */\nexport function WidgetSurfaceSizeProvider({\n children,\n size,\n}: {\n children: ReactNode\n size: WidgetSize\n}) {\n return (\n <WidgetSurfaceSizeContext.Provider value={size}>{children}</WidgetSurfaceSizeContext.Provider>\n )\n}\n\nexport interface WidgetSurfaceProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode\n /** Grid footprint: 1×1, 2×1 or 2×2. Every widget is designed at all three. */\n size: WidgetSize\n}\n\n/**\n * The sized surface primitive: themed chrome + size semantics. `size` is a\n * signal (data attribute + context), not dimensions — the box comes from the\n * consumption context (a grid tile). Content blocks read the size via\n * useWidgetSurfaceSize() to adapt density.\n *\n * It nests two layers: an outer SHELL carrying the rim (real padded geometry,\n * so it can hold a gradient across the whole frame) and an inner FACE carrying\n * today's background, border, and the ::before backdrop.\n * The shell is the surface root — `{...rest}` and the `data-widget-surface*`\n * attributes live there, because measurement tooling queries them and the tile\n * edge is the outer box.\n *\n * Consumer `className` is PARTITIONED between the two boxes, because real call\n * sites mix both concerns in one string (`flex size-full min-h-0 flex-col`):\n *\n * - box classes (`w-80`, `size-full`, `aspect-[2/1]`) size the widget itself, so\n * they move to the shell. Left on the face they constrain the material while\n * the shell still stretches to its parent, leaving dead space along one edge.\n * - flex-item and `overflow-*` classes apply to BOTH, since each box is a flex\n * item of the one above and the shell owns the outer clip.\n * - everything else stays on the face: inner layout (`flex-col`, `gap-3`,\n * `p-4`) and the chrome escape hatches (`before:hidden`, `border-0`) that need\n * to reach the element actually painting the material.\n */\nexport function WidgetSurface({ children, className, size, ...rest }: WidgetSurfaceProps) {\n const partitioned = partitionSurfaceClasses(className)\n\n return (\n <WidgetSurfaceSizeContext.Provider value={size}>\n <div\n {...rest}\n className={cn(WIDGET_RIM_SHELL_CLASS, partitioned.shell)}\n data-widget-surface=\"\"\n data-widget-surface-size={size}\n >\n {/* `a63-WidgetSurface-body` positions the face, which anchors its\n absolutely-positioned ::before material to the face rather than\n letting it escape to the shell. */}\n <div className={cn(WIDGET_CARD_SURFACE_CLASS, 'a63-WidgetSurface-body', partitioned.face)}>\n {children}\n </div>\n </div>\n </WidgetSurfaceSizeContext.Provider>\n )\n}\n","import type React from 'react'\nimport type { CSSProperties } from 'react'\nimport {\n WIDGET_BODY_INSET,\n widgetChromeIconStyle,\n widgetClampRelief,\n widgetInsetStyle,\n widgetTypeStyle,\n wu,\n wuMerge,\n} from '../layout'\nimport type { WidgetSize } from '../types'\nimport { cn } from '../utils'\nimport { useWidgetSurfaceSize, WidgetSurface } from './widget-surface'\n\nexport { WIDGET_CARD_SURFACE_CLASS, WIDGET_RIM_SHELL_CLASS } from './widget-surface-classes'\n\ninterface WidgetCardProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n /** Grid size fed into the surface context for chrome-less content to read. */\n size: WidgetSize\n}\n\n/*\n * Footprint chrome/card rhythm (header height, card gap) lives in the\n * stylesheet, keyed on the surface size. Horizontal padding comes from\n * `widgetInsetStyle`.\n */\n\n/**\n * @deprecated Prefer `widgetInsetStyle(size, 'body')`. Kept as a thin alias so\n * existing call sites can migrate without a flag day.\n */\nexport const WIDGET_BODY_INSET_CLASS: Record<WidgetSize, string> = {\n small: '',\n medium: '',\n large: '',\n}\n\n/**\n * Widget Card - Base container for widgets\n * Uses design system tokens for consistent styling.\n * Direct-child spacing follows the widget footprint: compact for one-row\n * surfaces and comfortable for the large canvas.\n */\nexport function WidgetCard({ children, className, size, ...props }: WidgetCardProps) {\n return (\n <WidgetSurface\n {...props}\n // `group` stays as a marker for consumer `group-hover:` utilities.\n className={cn('a63-WidgetCard', 'group', className)}\n data-slot=\"widget-card\"\n size={size}\n >\n {children}\n </WidgetSurface>\n )\n}\n\ninterface WidgetCardHeaderProps {\n children: React.ReactNode\n className?: string\n style?: CSSProperties\n}\n\n/**\n * Widget Card Header - Title/header section for widgets\n * Composed of left (icon + label) and right (optional badge/button) sections\n */\nexport function WidgetCardHeader({ children, className, style }: WidgetCardHeaderProps) {\n const size = useWidgetSurfaceSize() ?? 'large'\n\n return (\n <div\n className={cn('a63-WidgetCardHeader', className)}\n data-size={size}\n data-slot=\"widget-card-header\"\n style={wuMerge(\n {\n paddingInline: wu(WIDGET_BODY_INSET[size]),\n columnGap: wu(size === 'small' ? 6 : 8),\n },\n style\n )}\n >\n {children}\n </div>\n )\n}\n\ninterface WidgetCardHeaderLeftProps {\n children: React.ReactNode\n className?: string\n}\n\n/**\n * Widget Card Header Left - Left side of header (icon + label)\n */\nexport function WidgetCardHeaderLeft({ children, className }: WidgetCardHeaderLeftProps) {\n return (\n <div\n className={cn('a63-WidgetCardHeader-start', className)}\n data-slot=\"widget-card-header-left\"\n >\n {children}\n </div>\n )\n}\n\ninterface WidgetCardHeaderRightProps {\n children: React.ReactNode\n className?: string\n}\n\n/**\n * Widget Card Header Right - Right side of header (optional badge/button)\n */\nexport function WidgetCardHeaderRight({ children, className }: WidgetCardHeaderRightProps) {\n return (\n <div className={cn('a63-WidgetCardHeader-end', className)} data-slot=\"widget-card-header-right\">\n {children}\n </div>\n )\n}\n\ninterface WidgetCardContentProps {\n children: React.ReactNode\n className?: string\n style?: CSSProperties\n}\n\n/**\n * Widget Card Content - Main content area for widgets.\n * Padding/gap come from `widgetInsetStyle(size, 'body')`.\n */\nexport function WidgetCardContent({ children, className, style }: WidgetCardContentProps) {\n const size = useWidgetSurfaceSize() ?? 'large'\n\n return (\n <div\n className={cn('a63-WidgetCardContent', className)}\n data-slot=\"widget-card-content\"\n style={wuMerge(widgetInsetStyle(size, 'body'), style)}\n >\n {children}\n </div>\n )\n}\n\ninterface WidgetBlockProps {\n children: React.ReactNode\n className?: string\n style?: CSSProperties\n}\n\n/**\n * Widget block — stacks optional header, content, and footer regions.\n * Pass `style={widgetInsetStyle(size, 'body')}` when the block owns padding.\n */\nexport function WidgetBlock({ children, className, style }: WidgetBlockProps) {\n return (\n <div className={cn('a63-WidgetBlock', className)} data-slot=\"widget-block\" style={style}>\n {children}\n </div>\n )\n}\n\ninterface WidgetBlockRegionProps {\n children: React.ReactNode\n className?: string\n}\n\n/** Optional top region inside a widget block (title, metadata, controls). */\nexport function WidgetBlockHeader({ children, className }: WidgetBlockRegionProps) {\n return (\n <header className={cn('a63-WidgetBlock-header', className)} data-slot=\"widget-block-header\">\n {children}\n </header>\n )\n}\n\n/** Primary widget body — grows to fill space between header and footer. */\nexport function WidgetBlockContent({ children, className }: WidgetBlockRegionProps) {\n return (\n <div className={cn('a63-WidgetBlock-content', className)} data-slot=\"widget-block-content\">\n {children}\n </div>\n )\n}\n\n/** Optional bottom region (actions, status, pagination). */\nexport function WidgetBlockFooter({ children, className }: WidgetBlockRegionProps) {\n return (\n <footer className={cn('a63-WidgetBlock-footer', className)} data-slot=\"widget-block-footer\">\n {children}\n </footer>\n )\n}\n\ninterface WidgetCardTitleProps {\n children: React.ReactNode\n className?: string\n icon?: React.ReactNode\n}\n\n/**\n * Widget Card Title - Quiet chrome identity with optional leading icon.\n * Icon slot tracks the chrome type ramp (design 12 → ~10px at OS63) so the\n * pair stays optically matched when the label steps down.\n */\nexport function WidgetCardTitle({ children, icon, className }: WidgetCardTitleProps) {\n return (\n <div className={cn('a63-WidgetCardTitle', className)} data-slot=\"widget-card-title\">\n {icon && (\n <span\n className=\"a63-WidgetCardTitle-icon\"\n data-slot=\"widget-card-title-icon\"\n style={widgetChromeIconStyle()}\n >\n {icon}\n </span>\n )}\n <div\n className=\"a63-WidgetCardTitle-text\"\n data-slot=\"widget-card-title-text\"\n style={wuMerge(widgetTypeStyle('chrome'), widgetClampRelief())}\n >\n {children}\n </div>\n </div>\n )\n}\n\ninterface WidgetCardTextProps {\n children: React.ReactNode\n className?: string\n}\n\n/**\n * Widget Card Text Group - Flex column that clips content instead of wrapping.\n * Use around text blocks that should truncate during widget size transitions.\n */\nexport function WidgetCardTextGroup({ children, className }: WidgetCardTextProps) {\n return (\n <div className={cn('a63-WidgetCardTextGroup', className)} data-slot=\"widget-card-text-group\">\n {children}\n </div>\n )\n}\n\n/**\n * Widget Card Row - Inline row that stays on one line and clips overflow.\n * Use for metadata rows (location, stats, labels) that shouldn't wrap.\n */\nexport function WidgetCardRow({ children, className }: WidgetCardTextProps) {\n return (\n <div className={cn('a63-WidgetCardRow', className)} data-slot=\"widget-card-row\">\n {children}\n </div>\n )\n}\n\ninterface WidgetShellProps extends Omit<WidgetCardProps, 'children' | 'title'> {\n children: React.ReactNode\n contentClassName?: string\n headerClassName?: string\n headerEnd?: React.ReactNode\n icon?: React.ReactNode\n title: React.ReactNode\n}\n\nexport function WidgetShell({\n children,\n className,\n contentClassName,\n headerClassName,\n headerEnd,\n icon,\n title,\n ...props\n}: WidgetShellProps) {\n return (\n <WidgetCard className={className} {...props}>\n <WidgetCardHeader className={headerClassName}>\n <WidgetCardTitle icon={icon}>{title}</WidgetCardTitle>\n {headerEnd}\n </WidgetCardHeader>\n <WidgetCardContent className={contentClassName}>{children}</WidgetCardContent>\n </WidgetCard>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/primitives/widget-avatar.tsx","../src/primitives/widget-surface-classes.ts","../src/primitives/widget-surface.tsx","../src/primitives/widget-card.tsx"],"names":["jsx","jsxs"],"mappings":";;;;;;AAoCO,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EAAA,EAAW,SAAA,EAAuB,GAAG,KAAA,EACpC,QAAA,EAAA;AAAA,oBAAAA,IAAAA,CAAC,gBAAA,EAAA,EAAiB,SAAA,EAAW,eAAA,EAC3B,QAAA,EAAA;AAAA,sBAAAD,GAAAA,CAAC,eAAA,EAAA,EAAgB,IAAA,EAAa,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,MACnC;AAAA,KAAA,EACH,CAAA;AAAA,oBACAA,GAAAA,CAAC,iBAAA,EAAA,EAAkB,SAAA,EAAW,kBAAmB,QAAA,EAAS;AAAA,GAAA,EAC5D,CAAA;AAEJ","file":"chunk-3ND4LGYB.js","sourcesContent":["import { Avatar, AvatarFallback, AvatarImage } from '@atom63/ui-react'\nimport { LoaderCircle, RefreshCw } from 'lucide-react'\nimport { memo } from 'react'\nimport { cn } from '../utils'\n\nexport type WidgetAvatarSize = 'sm' | 'md' | 'lg' | 'xl'\n\nexport interface WidgetAvatarProps {\n alt?: string\n /** Loading or shuffling: reveals the overlay and shows a spinner. */\n busy?: boolean\n className?: string\n fallback: string\n /** When provided, the avatar becomes a shuffle affordance (hover/focus reveal). */\n onShuffle?: () => void\n shuffleLabel?: string\n /** Draws the primary accent ring (e.g. the featured card avatar). */\n showOutline?: boolean\n size?: WidgetAvatarSize\n src?: string\n /**\n * Shows the decorative presence dot seated on the circle's lower-right.\n * The status meaning is conveyed textually elsewhere (e.g. a status badge),\n * so the dot itself is aria-hidden.\n */\n status?: boolean\n}\n\n/**\n * Circular avatar primitive with an optional shuffle overlay and a presence dot.\n * Chrome-agnostic and data-agnostic — widgets map their own data onto it.\n *\n * Per-size geometry (the avatar, the presence dot and the shuffle glyph) comes\n * from the stylesheet, keyed on `data-widget-avatar-size`. The status dot is\n * seated on the circle's lower-end arc, not the bounding-box corner.\n */\nexport const WidgetAvatar = memo<WidgetAvatarProps>(\n ({\n alt = '',\n busy = false,\n className,\n fallback,\n onShuffle,\n shuffleLabel = 'Shuffle avatar',\n showOutline = false,\n size = 'md',\n src,\n status = false,\n }) => {\n const canShuffle = Boolean(onShuffle)\n\n return (\n <div\n className={cn('a63-WidgetAvatar', className)}\n data-busy={busy ? '' : undefined}\n data-slot=\"widget-avatar\"\n data-widget-avatar-size={size}\n >\n <Avatar className=\"a63-WidgetAvatar-avatar\" data-outline={showOutline ? '' : undefined}>\n <AvatarImage alt={alt} src={src} />\n <AvatarFallback>{fallback}</AvatarFallback>\n </Avatar>\n\n {busy && <span aria-hidden className=\"a63-WidgetAvatar-busyRing\" />}\n\n {canShuffle && (\n <button\n aria-label={shuffleLabel}\n className=\"a63-WidgetAvatar-shuffle\"\n disabled={busy}\n onClick={onShuffle}\n type=\"button\"\n >\n {busy ? (\n <LoaderCircle aria-hidden className=\"a63-WidgetAvatar-shuffleIcon a63-Widget-spin\" />\n ) : (\n <RefreshCw aria-hidden className=\"a63-WidgetAvatar-shuffleIcon\" />\n )}\n </button>\n )}\n\n {status && (\n // The notch ring matches the card surface the avatar sits on, not the\n // page, so the separator stays visible across themes and hosts.\n <span aria-hidden className=\"a63-WidgetAvatar-status\" data-slot=\"widget-avatar-status\" />\n )}\n </div>\n )\n }\n)\n\nWidgetAvatar.displayName = 'WidgetAvatar'\n","/**\n * Outer shell of the themed widget surface — the rim.\n *\n * The rim is real geometry between the tile edge and the card face, so it can\n * carry a gradient across the whole frame, its own backdrop-filter, and a\n * smaller inner radius; a `box-shadow` inset can do none of those.\n *\n * It is a BORDER, not padding. Both inset the face identically, but only a\n * border follows `border-radius` — it mitres around each corner arc and takes a\n * per-side color. That is what lets a bevel theme light the top and left edges\n * while darkening the bottom and right AT ANY RADIUS. Radius is a\n * personalization axis, so the chrome has to hold up across it, not just at\n * each theme's default.\n *\n * The drop shadow belongs here, on the outermost box, so it casts from the true\n * tile edge. The shell's z-index scopes the face's material pseudo to this\n * surface's own stacking context so it can't bleed behind sibling tiles.\n *\n * The declarations live in `@atom63/widgets/styles.css` (`.a63-WidgetSurface`).\n */\nexport const WIDGET_RIM_SHELL_CLASS = 'a63-WidgetSurface'\n\n/**\n * Inner face of the themed widget surface — the card material.\n *\n * The frosted-glass fill + backdrop blur live on an isolated `::before` layer\n * (behind the content), not on the face element itself. Decoupling the blur\n * from content paint fixes the Chrome backdrop-filter flicker (crbug 41471914)\n * and the border-radius bleed (crbug 41212594 / 41432992).\n *\n * Deliberately NOT `position: relative`: a host can compose this class with its\n * own absolute positioning (a drag placeholder, for instance). `WidgetSurface`\n * adds the positioning itself to anchor the ::before material to the face.\n *\n * The declarations live in `@atom63/widgets/styles.css`\n * (`.a63-WidgetSurface-face`).\n */\nexport const WIDGET_CARD_SURFACE_CLASS = 'a63-WidgetSurface-face'\n","import { createContext, type HTMLAttributes, type ReactNode, useContext } from 'react'\nimport type { WidgetSize } from '../types'\nimport { cn } from '../utils'\nimport { WIDGET_CARD_SURFACE_CLASS, WIDGET_RIM_SHELL_CLASS } from './widget-surface-classes'\n\nconst WidgetSurfaceSizeContext = createContext<WidgetSize | undefined>(undefined)\n\n/**\n * The partition reads Tailwind utility names, because that is what consumer\n * call sites write. The package's own classes stay on the face.\n *\n * Classes that size the widget's OUTER box, so they belong on the shell and must\n * NOT stay on the face. A consumer writing `w-80` means \"this widget is 320px\n * wide\" — left on the face it constrains the material while the shell still\n * stretches to its parent, which shows up as dead space along one edge.\n *\n * Deliberately excludes bare `flex` and `flex-col`/`flex-row`: those set display\n * and direction for the CHILDREN, so they stay on the face.\n */\nconst SHELL_BOX_CLASS_PATTERN = /(^|:)(w|h|size|max-w|max-h|basis|aspect)-\\[?[a-z0-9./%[\\]-]+\\]?$/\n\n/**\n * Classes that must apply to BOTH boxes. `overflow-*` because the shell owns the\n * outer clip, so a view asking for `overflow-visible` has to escape both. Flex\n * item + min-size because each box is a flex item of the one above it, and\n * `min-h-0` on the face is separately load-bearing for internal scrolling.\n */\nconst SHARED_CLASS_PATTERN =\n /(^|:)(overflow(-[xy])?-[a-z]+|min-[wh]-[a-z0-9.[\\]/-]+|flex-(1|auto|initial|none)|grow(-0)?|shrink(-0)?)$/\n\nfunction partitionSurfaceClasses(className: string | undefined) {\n if (!className) return { face: undefined, shell: undefined }\n const face: string[] = []\n const shell: string[] = []\n for (const token of className.split(/\\s+/).filter(Boolean)) {\n if (SHELL_BOX_CLASS_PATTERN.test(token)) {\n shell.push(token)\n continue\n }\n face.push(token)\n if (SHARED_CLASS_PATTERN.test(token)) shell.push(token)\n }\n return {\n face: face.length > 0 ? face.join(' ') : undefined,\n shell: shell.length > 0 ? shell.join(' ') : undefined,\n }\n}\n\n/** Read the size of the nearest enclosing WidgetSurface (undefined outside one). */\nexport function useWidgetSurfaceSize(): WidgetSize | undefined {\n return useContext(WidgetSurfaceSizeContext)\n}\n\n/**\n * Publish a surface size WITHOUT any chrome.\n *\n * Use this inside a widget when an inner region only needs content blocks to\n * read `useWidgetSurfaceSize()` for density. Reaching for `WidgetSurface` and\n * switching its chrome off with `rounded-none border-0 bg-transparent\n * before:hidden` no longer works: `className` lands on the face, so the rim\n * shell still paints padding, background and radius — which renders as a\n * nested card inside the widget.\n */\nexport function WidgetSurfaceSizeProvider({\n children,\n size,\n}: {\n children: ReactNode\n size: WidgetSize\n}) {\n return (\n <WidgetSurfaceSizeContext.Provider value={size}>{children}</WidgetSurfaceSizeContext.Provider>\n )\n}\n\nexport interface WidgetSurfaceProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode\n /** Grid footprint: 1×1, 2×1 or 2×2. Every widget is designed at all three. */\n size: WidgetSize\n}\n\n/**\n * The sized surface primitive: themed chrome + size semantics. `size` is a\n * signal (data attribute + context), not dimensions — the box comes from the\n * consumption context (a grid tile). Content blocks read the size via\n * useWidgetSurfaceSize() to adapt density.\n *\n * It nests two layers: an outer SHELL carrying the rim (real padded geometry,\n * so it can hold a gradient across the whole frame) and an inner FACE carrying\n * today's background, border, and the ::before backdrop.\n * The shell is the surface root — `{...rest}` and the `data-widget-surface*`\n * attributes live there, because measurement tooling queries them and the tile\n * edge is the outer box.\n *\n * Consumer `className` is PARTITIONED between the two boxes, because real call\n * sites mix both concerns in one string (`flex size-full min-h-0 flex-col`):\n *\n * - box classes (`w-80`, `size-full`, `aspect-[2/1]`) size the widget itself, so\n * they move to the shell. Left on the face they constrain the material while\n * the shell still stretches to its parent, leaving dead space along one edge.\n * - flex-item and `overflow-*` classes apply to BOTH, since each box is a flex\n * item of the one above and the shell owns the outer clip.\n * - everything else stays on the face: inner layout (`flex-col`, `gap-3`,\n * `p-4`) and the chrome escape hatches (`before:hidden`, `border-0`) that need\n * to reach the element actually painting the material.\n */\nexport function WidgetSurface({ children, className, size, ...rest }: WidgetSurfaceProps) {\n const partitioned = partitionSurfaceClasses(className)\n\n return (\n <WidgetSurfaceSizeContext.Provider value={size}>\n <div\n {...rest}\n className={cn(WIDGET_RIM_SHELL_CLASS, partitioned.shell)}\n data-widget-surface=\"\"\n data-widget-surface-size={size}\n >\n {/* `a63-WidgetSurface-body` positions the face, which anchors its\n absolutely-positioned ::before material to the face rather than\n letting it escape to the shell. */}\n <div className={cn(WIDGET_CARD_SURFACE_CLASS, 'a63-WidgetSurface-body', partitioned.face)}>\n {children}\n </div>\n </div>\n </WidgetSurfaceSizeContext.Provider>\n )\n}\n","import type React from 'react'\nimport type { CSSProperties } from 'react'\nimport {\n WIDGET_BODY_INSET,\n widgetChromeIconStyle,\n widgetClampRelief,\n widgetInsetStyle,\n widgetTypeStyle,\n wu,\n wuMerge,\n} from '../layout'\nimport type { WidgetSize } from '../types'\nimport { cn } from '../utils'\nimport { useWidgetSurfaceSize, WidgetSurface } from './widget-surface'\n\nexport { WIDGET_CARD_SURFACE_CLASS, WIDGET_RIM_SHELL_CLASS } from './widget-surface-classes'\n\ninterface WidgetCardProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n /** Grid size fed into the surface context for chrome-less content to read. */\n size: WidgetSize\n}\n\n/*\n * Footprint chrome/card rhythm (header height, card gap) lives in the\n * stylesheet, keyed on the surface size. Horizontal padding comes from\n * `widgetInsetStyle`.\n */\n\n/**\n * @deprecated Prefer `widgetInsetStyle(size, 'body')`. Kept as a thin alias so\n * existing call sites can migrate without a flag day.\n */\nexport const WIDGET_BODY_INSET_CLASS: Record<WidgetSize, string> = {\n small: '',\n medium: '',\n large: '',\n}\n\n/**\n * Widget Card - Base container for widgets\n * Uses design system tokens for consistent styling.\n * Direct-child spacing follows the widget footprint: compact for one-row\n * surfaces and comfortable for the large canvas.\n */\nexport function WidgetCard({ children, className, size, ...props }: WidgetCardProps) {\n return (\n <WidgetSurface\n {...props}\n // `group` stays as a marker for consumer `group-hover:` utilities.\n className={cn('a63-WidgetCard', 'group', className)}\n data-slot=\"widget-card\"\n size={size}\n >\n {children}\n </WidgetSurface>\n )\n}\n\ninterface WidgetCardHeaderProps {\n children: React.ReactNode\n className?: string\n style?: CSSProperties\n}\n\n/**\n * Widget Card Header - Title/header section for widgets\n * Composed of left (icon + label) and right (optional badge/button) sections\n */\nexport function WidgetCardHeader({ children, className, style }: WidgetCardHeaderProps) {\n const size = useWidgetSurfaceSize() ?? 'large'\n\n return (\n <div\n className={cn('a63-WidgetCardHeader', className)}\n data-size={size}\n data-slot=\"widget-card-header\"\n style={wuMerge(\n {\n paddingInline: wu(WIDGET_BODY_INSET[size]),\n columnGap: wu(size === 'small' ? 6 : 8),\n },\n style\n )}\n >\n {children}\n </div>\n )\n}\n\ninterface WidgetCardHeaderLeftProps {\n children: React.ReactNode\n className?: string\n}\n\n/**\n * Widget Card Header Left - Left side of header (icon + label)\n */\nexport function WidgetCardHeaderLeft({ children, className }: WidgetCardHeaderLeftProps) {\n return (\n <div\n className={cn('a63-WidgetCardHeader-start', className)}\n data-slot=\"widget-card-header-left\"\n >\n {children}\n </div>\n )\n}\n\ninterface WidgetCardHeaderRightProps {\n children: React.ReactNode\n className?: string\n}\n\n/**\n * Widget Card Header Right - Right side of header (optional badge/button)\n */\nexport function WidgetCardHeaderRight({ children, className }: WidgetCardHeaderRightProps) {\n return (\n <div className={cn('a63-WidgetCardHeader-end', className)} data-slot=\"widget-card-header-right\">\n {children}\n </div>\n )\n}\n\ninterface WidgetCardContentProps {\n children: React.ReactNode\n className?: string\n style?: CSSProperties\n}\n\n/**\n * Widget Card Content - Main content area for widgets.\n * Padding/gap come from `widgetInsetStyle(size, 'body')`.\n */\nexport function WidgetCardContent({ children, className, style }: WidgetCardContentProps) {\n const size = useWidgetSurfaceSize() ?? 'large'\n\n return (\n <div\n className={cn('a63-WidgetCardContent', className)}\n data-slot=\"widget-card-content\"\n style={wuMerge(widgetInsetStyle(size, 'body'), style)}\n >\n {children}\n </div>\n )\n}\n\ninterface WidgetBlockProps {\n children: React.ReactNode\n className?: string\n style?: CSSProperties\n}\n\n/**\n * Widget block — stacks optional header, content, and footer regions.\n * Pass `style={widgetInsetStyle(size, 'body')}` when the block owns padding.\n */\nexport function WidgetBlock({ children, className, style }: WidgetBlockProps) {\n return (\n <div className={cn('a63-WidgetBlock', className)} data-slot=\"widget-block\" style={style}>\n {children}\n </div>\n )\n}\n\ninterface WidgetBlockRegionProps {\n children: React.ReactNode\n className?: string\n}\n\n/** Optional top region inside a widget block (title, metadata, controls). */\nexport function WidgetBlockHeader({ children, className }: WidgetBlockRegionProps) {\n return (\n <header className={cn('a63-WidgetBlock-header', className)} data-slot=\"widget-block-header\">\n {children}\n </header>\n )\n}\n\n/** Primary widget body — grows to fill space between header and footer. */\nexport function WidgetBlockContent({ children, className }: WidgetBlockRegionProps) {\n return (\n <div className={cn('a63-WidgetBlock-content', className)} data-slot=\"widget-block-content\">\n {children}\n </div>\n )\n}\n\n/** Optional bottom region (actions, status, pagination). */\nexport function WidgetBlockFooter({ children, className }: WidgetBlockRegionProps) {\n return (\n <footer className={cn('a63-WidgetBlock-footer', className)} data-slot=\"widget-block-footer\">\n {children}\n </footer>\n )\n}\n\ninterface WidgetCardTitleProps {\n children: React.ReactNode\n className?: string\n icon?: React.ReactNode\n}\n\n/**\n * Widget Card Title - Quiet chrome identity with optional leading icon.\n * Icon slot tracks the chrome type ramp (design 12 → ~10px at OS63) so the\n * pair stays optically matched when the label steps down.\n */\nexport function WidgetCardTitle({ children, icon, className }: WidgetCardTitleProps) {\n return (\n <div className={cn('a63-WidgetCardTitle', className)} data-slot=\"widget-card-title\">\n {icon && (\n <span\n className=\"a63-WidgetCardTitle-icon\"\n data-slot=\"widget-card-title-icon\"\n style={widgetChromeIconStyle()}\n >\n {icon}\n </span>\n )}\n <div\n className=\"a63-WidgetCardTitle-text\"\n data-slot=\"widget-card-title-text\"\n style={wuMerge(widgetTypeStyle('chrome'), widgetClampRelief())}\n >\n {children}\n </div>\n </div>\n )\n}\n\ninterface WidgetCardTextProps {\n children: React.ReactNode\n className?: string\n}\n\n/**\n * Widget Card Text Group - Flex column that clips content instead of wrapping.\n * Use around text blocks that should truncate during widget size transitions.\n */\nexport function WidgetCardTextGroup({ children, className }: WidgetCardTextProps) {\n return (\n <div className={cn('a63-WidgetCardTextGroup', className)} data-slot=\"widget-card-text-group\">\n {children}\n </div>\n )\n}\n\n/**\n * Widget Card Row - Inline row that stays on one line and clips overflow.\n * Use for metadata rows (location, stats, labels) that shouldn't wrap.\n */\nexport function WidgetCardRow({ children, className }: WidgetCardTextProps) {\n return (\n <div className={cn('a63-WidgetCardRow', className)} data-slot=\"widget-card-row\">\n {children}\n </div>\n )\n}\n\ninterface WidgetShellProps extends Omit<WidgetCardProps, 'children' | 'title'> {\n children: React.ReactNode\n contentClassName?: string\n headerClassName?: string\n headerEnd?: React.ReactNode\n icon?: React.ReactNode\n title: React.ReactNode\n}\n\nexport function WidgetShell({\n children,\n className,\n contentClassName,\n headerClassName,\n headerEnd,\n icon,\n title,\n ...props\n}: WidgetShellProps) {\n return (\n <WidgetCard className={className} {...props}>\n <WidgetCardHeader className={headerClassName}>\n <WidgetCardTitle icon={icon}>{title}</WidgetCardTitle>\n {headerEnd}\n </WidgetCardHeader>\n <WidgetCardContent className={contentClassName}>{children}</WidgetCardContent>\n </WidgetCard>\n )\n}\n"]}
@@ -414,5 +414,5 @@ function withWidgetViewport(Component) {
414
414
  }
415
415
 
416
416
  export { WIDGET_BODY_GAP, WIDGET_BODY_INSET, WIDGET_CANONICAL_CELL_PX, WIDGET_DENSITY_SCALE, WIDGET_MAX_PRESENTATION_SCALE, WIDGET_TYPE_FLOOR, WIDGET_TYPE_RAMP, WIDGET_TYPE_ROLE_FLOOR, WIDGET_UNIT_BASE_PX, WIDGET_UNIT_SPAN, WidgetGrid, WidgetSizeProvider, WidgetViewport, cn, useWidgetSize, widgetChromeIconStyle, widgetClampRelief, widgetInsetPx, widgetInsetStyle, widgetPresentationStyle, widgetSizeStyle, widgetTypeDesignPx, widgetTypeStyle, widgetUnitStyle, withWidgetViewport, wu, wuClamp, wuMerge, wuStyle };
417
- //# sourceMappingURL=chunk-F5NV6XJ5.js.map
418
- //# sourceMappingURL=chunk-F5NV6XJ5.js.map
417
+ //# sourceMappingURL=chunk-QCNNU4OV.js.map
418
+ //# sourceMappingURL=chunk-QCNNU4OV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.ts","../src/layout/widget-units.ts","../src/layout/widget-scale.ts","../src/layout/widget-unit-style.ts","../src/layout/widget-inset.ts","../src/layout/widget-type.ts","../src/layout/widget-grid.tsx","../src/layout/widget-viewport.tsx"],"names":["cellPx","jsx"],"mappings":";;;;AAGA,SAAS,OAAA,CAAQ,OAAmB,GAAA,EAAqB;AACvD,EAAA,IAAI,CAAC,KAAA,EAAO;AACZ,EAAA,IAAI,OAAO,UAAU,QAAA,IAAY,OAAO,UAAU,QAAA,IAAY,OAAO,UAAU,QAAA,EAAU;AACvF,IAAA,GAAA,CAAI,IAAA,CAAK,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA,EACxB,CAAA,MAAA,IAAW,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC/B,IAAA,KAAA,MAAW,IAAA,IAAQ,KAAA,EAAO,OAAA,CAAQ,IAAA,EAAM,GAAG,CAAA;AAAA,EAC7C,CAAA,MAAA,IAAW,O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,EAAgC,IAAG,GAAA,EAAK,SAAA,EAAW,KAAA,EAAO,iBAAA,EAC5D,QAAA,EACH;AAAA;AAAA,GACF,EACF,CAAA;AAEJ;AAoBO,SAAS,mBACd,SAAA,EACkB;AAClB,EAAA,SAAS,uBAAuB,KAAA,EAAU;AACxC,IAAA,uBACEA,GAAAA,CAAC,cAAA,EAAA,EAAe,SAAA,EAAU,yBAAA,EAA0B,IAAA,EAAM,KAAA,CAAM,IAAA,EAC9D,QAAA,kBAAAA,GAAAA,CAAC,SAAA,EAAA,EAAW,GAAG,OAAO,CAAA,EACxB,CAAA;AAAA,EAEJ;AAEA,EAAA,sBAAA,CAAuB,cAAc,CAAA,mBAAA,EAAsB,SAAA,CAAU,WAAA,IAAe,SAAA,CAAU,QAAQ,QAAQ,CAAA,CAAA,CAAA;AAE9G,EAAA,OAAO,sBAAA;AACT","file":"chunk-QCNNU4OV.js","sourcesContent":["export type ClassValue =\n ClassValue[] | Record<string, unknown> | string | number | bigint | boolean | null | undefined\n\nfunction collect(value: ClassValue, out: string[]): void {\n if (!value) return\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'bigint') {\n out.push(String(value))\n } else if (Array.isArray(value)) {\n for (const item of value) collect(item, out)\n } else if (typeof value === 'object') {\n for (const [name, enabled] of Object.entries(value)) if (enabled) out.push(name)\n }\n}\n\n/**\n * Joins class names, skipping empty ones (the `clsx` input shapes).\n *\n * It does not merge utilities: the package's own classes live in the\n * stylesheet's `components` layer, so a consumer's Tailwind utility already\n * wins over them through the cascade.\n */\nexport function cn(...inputs: ClassValue[]): string {\n const out: string[] = []\n for (const input of inputs) collect(input, out)\n return out.join(' ')\n}\n","import type { WidgetSize } from '../types'\n\n/** Span of a widget in widget units (one unit = one cell of the host grid). */\nexport interface WidgetUnitSpan {\n cols: number\n rows: number\n}\n\n/**\n * Single source of truth for widget geometry.\n *\n * Hosts map a widget unit onto their own grid:\n * - os63 desktop: 1 widget unit = 2 desktop cells\n * - atom63.io web: 1 widget unit = 1 CSS grid column\n */\nexport const WIDGET_UNIT_SPAN: Record<WidgetSize, WidgetUnitSpan> = {\n small: { cols: 1, rows: 1 },\n medium: { cols: 2, rows: 1 },\n large: { cols: 2, rows: 2 },\n}\n\n/**\n * Internal authoring coordinate width for one widget unit.\n *\n * Existing widget values are authored on this coordinate system. Presentation\n * scale is measured against WIDGET_CANONICAL_CELL_PX instead.\n */\nexport const WIDGET_UNIT_BASE_PX = 256\n\n/** OS63-sized 100% presentation width of one widget cell, in CSS px. */\nexport const WIDGET_CANONICAL_CELL_PX = 188\n\n/** Largest supported proportional presentation scale above the canonical cell. */\nexport const WIDGET_MAX_PRESENTATION_SCALE = 1.375\n\n/**\n * Minimum font size per floor bucket on the canonical presentation canvas.\n * Whole-canvas presentation scaling preserves these proportions in smaller\n * hosts rather than reflowing around a fixed physical type floor.\n *\n * Intent roles (chrome / label / body / title / …) live in `WIDGET_TYPE_RAMP`\n * and map onto these buckets via `WIDGET_TYPE_ROLE_FLOOR`.\n *\n * `display` is deliberately unfloored: a 40px figure at 24px is still legible,\n * and flooring it would distort the composition it anchors.\n */\nexport const WIDGET_TYPE_FLOOR = {\n label: 11,\n body: 12,\n display: 0,\n} as const\n\n/** Floor buckets used by the type ramp. Prefer `WidgetTypeRampRole` for authoring. */\nexport type WidgetTypeFloorRole = keyof typeof WIDGET_TYPE_FLOOR\n\n/** @deprecated Use `WidgetTypeFloorRole` or `WidgetTypeRampRole`. */\nexport type WidgetTypeRole = WidgetTypeFloorRole\n\n// No accessor function: consumers index `WIDGET_UNIT_SPAN[size]` directly.\n// A one-line wrapper would add public surface that enforces nothing.\n","import type { CSSProperties } from 'react'\nimport type { WidgetSize } from '../types'\nimport {\n WIDGET_CANONICAL_CELL_PX,\n WIDGET_MAX_PRESENTATION_SCALE,\n WIDGET_UNIT_BASE_PX,\n WIDGET_UNIT_SPAN,\n} from './widget-units'\n\n/** Optical density presets — multiply `--widget-scale`. */\nexport const WIDGET_DENSITY_SCALE = {\n compact: 0.9,\n default: 1,\n comfortable: 1.1,\n} as const\n\nexport type WidgetDensity = keyof typeof WIDGET_DENSITY_SCALE\n\nexport interface WidgetSizeStyleOptions {\n /** Extra multiplier on `--widget-u`. @default 1 */\n scale?: number\n /** Named density preset; multiplies `scale`. @default 'default' */\n density?: WidgetDensity\n /**\n * Floor for `--widget-u` in CSS px. Unset by default — legibility is\n * protected by per-role type floors, not by arresting the unit. A unit\n * floor lets content outgrow its own tile and overflow.\n */\n minScale?: number\n}\n\nexport type WidgetSizeStyle = CSSProperties & {\n '--a63-control-min-target': string\n '--a63-control-min-target-lg': string\n '--a63-control-min-target-xl': string\n '--widget-cell': string\n '--widget-raw-u': string\n '--widget-rows': string\n '--widget-scale': string\n '--widget-span': string\n '--widget-u': string\n}\n\n/** The design-unit properties alone — no span, no grid placement. */\nexport type WidgetUnitStyle = CSSProperties & {\n '--a63-control-min-target': string\n '--a63-control-min-target-lg': string\n '--a63-control-min-target-xl': string\n '--widget-cell': string\n '--widget-raw-u': string\n '--widget-scale': string\n '--widget-u': string\n}\n\nexport type WidgetPresentationStyle = CSSProperties & {\n '--a63-control-min-target': string\n '--a63-control-min-target-lg': string\n '--a63-control-min-target-xl': string\n '--widget-interaction-target': string\n '--widget-presentation-scale': string\n '--widget-u': string\n}\n\n/**\n * WCAG 2.2 SC 2.5.8 minimum, in physical px — the floor this repo commits to\n * for widget controls (see IMPLEMENTATION.md §8).\n */\nconst WIDGET_CONTROL_MIN_TARGET_PX = 24\n\n/**\n * Pin the shared control ergonomics floor inside a widget.\n *\n * `@atom63/styles` raises `--a63-control-min-target` to 44px on coarse pointers,\n * and every control recipe floors its RENDERED geometry with it\n * (`--button-height: max(control-height, min-target)`). That lever is right for\n * page chrome and wrong for a widget: the tile is a fixed-proportion canvas, so\n * an inflated control does not gain room, it takes it from the composition —\n * one button would claim a quarter of a 188px cell on any phone.\n *\n * Widgets reach the enhanced 44px target the other way, by expanding the hit\n * area past the visible control with `--widget-interaction-target` (the\n * coarse-pointer rule in widget-layout.css), so the geometry can stay\n * proportional at the documented 24px floor. Expressed\n * against the host's presentation scale where there is one, so the floor is 24\n * PHYSICAL px rather than 24 pre-transform px.\n */\nfunction controlTargetStyle(scaleDivisor?: string) {\n const target = scaleDivisor\n ? `calc(${WIDGET_CONTROL_MIN_TARGET_PX}px / ${scaleDivisor})`\n : `${WIDGET_CONTROL_MIN_TARGET_PX}px`\n\n return {\n '--a63-control-min-target': target,\n '--a63-control-min-target-lg': target,\n '--a63-control-min-target-xl': target,\n }\n}\n\n/**\n * `--widget-u` from a cell width. The OS63 cell is the 100% presentation size,\n * while fluid hosts scale the same composition proportionally in either\n * direction, capped at WIDGET_MAX_PRESENTATION_SCALE when growing.\n */\nfunction unitExpression(minScale: number | undefined): string {\n const raw = `calc(var(--widget-cell) / ${WIDGET_UNIT_BASE_PX} * var(--widget-scale, 1))`\n const maximumUnit =\n (WIDGET_CANONICAL_CELL_PX * WIDGET_MAX_PRESENTATION_SCALE) / WIDGET_UNIT_BASE_PX\n return minScale == null\n ? `min(${raw}, ${maximumUnit}px)`\n : `clamp(${minScale}px, ${raw}, ${maximumUnit}px)`\n}\n\nfunction resolveScale(scale: number, density: WidgetDensity): string {\n /** Rounded to avoid IEEE-754 artifacts leaking into CSS (`3 * 1.1` → `3.3000000000000003`). */\n return String(Math.round(scale * WIDGET_DENSITY_SCALE[density] * 1e6) / 1e6)\n}\n\n/**\n * Design-unit properties for a host whose cell width is **known in px** — the\n * os63 desktop, whose tiles are laid out on a fixed grid rather than inside a\n * `WidgetGrid` container.\n *\n * `widgetSizeStyle()` cannot serve that host: its cell is `100cqi`-derived, so\n * with no `@container` ancestor it silently resolves against the VIEWPORT, and\n * its `gridColumn`/`gridRow` would fight the desktop's own placement. This\n * returns the unit properties only, so content authored in `wuStyle` renders in\n * both hosts instead of collapsing to dropped `calc()` declarations in one.\n */\nexport function widgetUnitStyle(\n cellPx: number,\n { density = 'default', minScale, scale = 1 }: WidgetSizeStyleOptions = {}\n): WidgetUnitStyle {\n const rawUnit = unitExpression(minScale)\n\n return {\n ...controlTargetStyle(),\n '--widget-cell': `${cellPx}px`,\n '--widget-raw-u': rawUnit,\n '--widget-scale': resolveScale(scale, density),\n '--widget-u': 'var(--widget-raw-u)',\n }\n}\n\n/**\n * Normalize a widget back to its canonical 188px composition, then transform\n * the complete canvas to the host cell. This catches fixed rem/Tailwind values\n * as well as design-unit values, preserving the original spacing and type\n * ratios both above and below the canonical size. A transform is used instead\n * of CSS zoom so the presentation contract behaves consistently in Firefox.\n */\nexport function widgetPresentationStyle(\n cellPx = WIDGET_CANONICAL_CELL_PX\n): WidgetPresentationStyle {\n const presentationScale = String(\n Math.min(cellPx / WIDGET_CANONICAL_CELL_PX, WIDGET_MAX_PRESENTATION_SCALE)\n )\n\n return {\n ...controlTargetStyle('var(--widget-presentation-scale)'),\n '--widget-interaction-target': 'calc(44px / var(--widget-presentation-scale))',\n '--widget-presentation-scale': presentationScale,\n '--widget-u': 'calc(var(--widget-raw-u) / var(--widget-presentation-scale))',\n // The canvas is a fixed-size box that the transform below scales — it must\n // never be resized by its parent's layout. A host whose viewport element is\n // a flex container (atom63.io's WidgetChrome adds `flex flex-col`) makes\n // this a flex item, and a canvas laid out ABOVE the host box then shrinks to\n // fit it before the transform shrinks it again: at a 165px mobile cell the\n // 188px canvas collapsed to 165, scaled to 144.8, and a 1×1 tile rendered\n // 165×144.8 instead of square. Invisible above the canonical cell, where the\n // canvas is already smaller than its box and there is nothing to shrink.\n flexShrink: 0,\n height:\n 'calc((var(--widget-rows) * var(--widget-cell) + (var(--widget-rows) - 1) * var(--widget-gap, 0px)) / var(--widget-presentation-scale))',\n minWidth: 0,\n transform: 'scale(var(--widget-presentation-scale))',\n transformOrigin: 'top left',\n width: 'calc(100cqi / var(--widget-presentation-scale))',\n }\n}\n\n/**\n * Width of one widget unit: total inline size minus the gaps *between* the\n * spanned cells, divided by the span. `--widget-gap` is published by WidgetGrid.\n */\nconst CELL_FORMULA =\n 'calc((100cqi - (var(--widget-span) - 1) * var(--widget-gap, 0px)) / var(--widget-span))'\n\n/**\n * Build the geometry and design-unit custom properties for a widget size.\n *\n * The unit divides by the span, so a `medium` tile is twice as wide yet resolves\n * the same `--widget-u` as a `small` — type and padding stay constant across\n * sizes, and only the composition gains room.\n */\nexport function widgetSizeStyle(\n size: WidgetSize,\n { density = 'default', minScale, scale = 1 }: WidgetSizeStyleOptions = {}\n): WidgetSizeStyle {\n const { cols, rows } = WIDGET_UNIT_SPAN[size]\n const rawUnit = unitExpression(minScale)\n\n // `height: 100%` rather than a cqi-derived length: a tile cannot resolve `cqi`\n // against the `@container` it itself establishes. Row height comes from the\n // grid's `grid-auto-rows`; 100% then fills that row whether the chrome is a\n // direct grid item OR nested inside a wrapper (e.g. RecentWriting's tilted\n // stack plate), where `gridRow`/`gridColumn` would otherwise be inert.\n return {\n ...controlTargetStyle(),\n '--widget-cell': CELL_FORMULA,\n '--widget-raw-u': rawUnit,\n '--widget-rows': String(rows),\n '--widget-scale': resolveScale(scale, density),\n '--widget-span': String(cols),\n '--widget-u': 'var(--widget-raw-u)',\n gridColumn: `span ${cols}`,\n gridRow: `span ${rows}`,\n height: '100%',\n }\n}\n","import type { CSSProperties } from 'react'\n\n/**\n * Inline-style helpers for authoring widget content in DESIGN px against\n * `--widget-u`, the design unit `widgetSizeStyle()` publishes on every tile.\n *\n * These live here because the package owns `--widget-u`; a host defining its\n * own readers for a package-owned custom property is the inversion this fixes.\n * Prefer them over Tailwind arbitrary classes: dynamic class strings are never\n * seen by the Tailwind scanner.\n *\n * ## What design px does NOT do\n *\n * It does not make a value \"scale with the tile\" where a fixed rem or px value\n * would not. `WidgetViewport` wraps every widget in a transform-scaled canvas\n * (`widgetPresentationStyle`), and a transform scales the whole composition —\n * fixed rem, fixed px and design-unit lengths alike. A `2.4rem` box measured\n * 38.4px at the canonical cell and 52.7px at a 1.372 host, exactly like a\n * `wu()` length would.\n *\n * So the reason to author in design px is CONSISTENCY, not scaling: the type\n * ramp, the insets and the gaps all live on the same 256 canvas, so one dial\n * moves the whole composition and no value has to be converted by hand. Do not\n * justify a conversion as a rendering fix — it will not change the render, and\n * a changeset that claims it did is wrong.\n */\n\n/**\n * Length from a design-px value.\n * Use in inline `style` (not Tailwind class strings — scanners never see dynamic classes).\n *\n * Falls back to `1px` — design px == CSS px — when no host published a unit.\n * Without the fallback the `calc()` is INVALID and the browser drops the whole\n * declaration, so a widget in an unpublishing host loses every padding, gap and\n * font size at once and renders as unstyled text. That is a silent, total\n * collapse that types, tests and lint cannot see. Degrading to design px keeps\n * the widget legible; hosts that publish a cell-derived unit still override it.\n *\n * @example style={{ padding: wu(16), gap: wu(12) }}\n */\nexport function wu(designPx: number): string {\n return `calc(${designPx} * var(--widget-u, 1px))`\n}\n\n/**\n * Proportional length with optional a11y floor / ceiling in CSS px.\n */\nexport function wuClamp(designPx: number, minPx?: number, maxPx?: number): string {\n const mid = wu(designPx)\n if (minPx != null && maxPx != null) {\n return `clamp(${minPx}px, ${mid}, ${maxPx}px)`\n }\n if (minPx != null) {\n return `max(${minPx}px, ${mid})`\n }\n if (maxPx != null) {\n return `min(${mid}, ${maxPx}px)`\n }\n return mid\n}\n\ntype Style = CSSProperties\n\n/**\n * Inline-style helpers for design-px space / type / size.\n *\n * Prefer these over Tailwind arbitrary classes — dynamic class strings are not\n * detected by the Tailwind scanner.\n */\nexport const wuStyle = {\n p: (n: number): Style => ({ padding: wu(n) }),\n px: (n: number): Style => ({ paddingInline: wu(n) }),\n py: (n: number): Style => ({ paddingBlock: wu(n) }),\n pt: (n: number): Style => ({ paddingTop: wu(n) }),\n pb: (n: number): Style => ({ paddingBottom: wu(n) }),\n gap: (n: number): Style => ({ gap: wu(n) }),\n gapX: (n: number): Style => ({ columnGap: wu(n) }),\n gapY: (n: number): Style => ({ rowGap: wu(n) }),\n m: (n: number): Style => ({ margin: wu(n) }),\n mt: (n: number): Style => ({ marginTop: wu(n) }),\n mb: (n: number): Style => ({ marginBottom: wu(n) }),\n ml: (n: number): Style => ({ marginLeft: wu(n) }),\n mr: (n: number): Style => ({ marginRight: wu(n) }),\n mx: (n: number): Style => ({ marginInline: wu(n) }),\n my: (n: number): Style => ({ marginBlock: wu(n) }),\n size: (n: number): Style => ({ width: wu(n), height: wu(n) }),\n h: (n: number): Style => ({ height: wu(n) }),\n w: (n: number): Style => ({ width: wu(n) }),\n text: (n: number): Style => ({ fontSize: wu(n) }),\n textMin: (n: number, minPx: number): Style => ({\n fontSize: wuClamp(n, minPx),\n }),\n rounded: (n: number): Style => ({ borderRadius: wu(n) }),\n} as const\n\n/** Merge style objects (later wins). */\nexport function wuMerge(...parts: Array<Style | undefined | null | false>): Style {\n const merged: Style = {}\n for (const part of parts) {\n if (part) Object.assign(merged, part)\n }\n return merged\n}\n","import type { CSSProperties } from 'react'\nimport type { WidgetSize } from '../types'\nimport { wu } from './widget-unit-style'\n\n/**\n * Shared body / face inset in design-px (256 authoring canvas).\n *\n * Calibrated so the OS63 188 cell resolves ≈ prior Tailwind `px-3` / `px-4`:\n * - 16 × 188/256 ≈ 11.75px (was `px-3`)\n * - 22 × 188/256 ≈ 16.1px (was `px-4`)\n *\n * Prefer `widgetInsetStyle` over local `wuStyle.p(…)` or `px-3` / `p-3.5`.\n */\nexport const WIDGET_BODY_INSET = {\n small: 16,\n medium: 22,\n large: 22,\n} as const satisfies Record<WidgetSize, number>\n\n/**\n * Shared stack gap in design-px between body children.\n * ≈ Tailwind `gap-2` / `gap-3` at the OS63 cell.\n */\nexport const WIDGET_BODY_GAP = {\n small: 11,\n medium: 11,\n large: 16,\n} as const satisfies Record<WidgetSize, number>\n\nexport type WidgetInsetMode =\n /** Full-face chrome-less body — padding on all sides. */\n | 'face'\n /**\n * Horizontal + bottom only. Used under `WidgetCardHeader`, and for\n * chrome-less faces with intentional top bleed (e.g. Behance ribbons).\n */\n | 'body'\n\nexport interface WidgetInsetStyleOptions {\n /** Include `gap` from `WIDGET_BODY_GAP`. Default true. */\n gap?: boolean\n}\n\n/** Design-px inset for a footprint. */\nexport function widgetInsetPx(size: WidgetSize): number {\n return WIDGET_BODY_INSET[size]\n}\n\n/**\n * Inline padding (+ optional gap) from the shared inset ramp.\n *\n * @example\n * // Chrome-less Behance / Instagram / Location / Weather\n * style={widgetInsetStyle(size, 'face')}\n *\n * // Under WidgetCardHeader (GitHub, Profile, …)\n * style={widgetInsetStyle(size, 'body')}\n */\nexport function widgetInsetStyle(\n size: WidgetSize,\n mode: WidgetInsetMode = 'face',\n options?: WidgetInsetStyleOptions\n): CSSProperties {\n const inset = WIDGET_BODY_INSET[size]\n const includeGap = options?.gap !== false\n const style: CSSProperties = {\n paddingInline: wu(inset),\n paddingBottom: wu(inset),\n }\n\n if (mode === 'face') {\n style.paddingTop = wu(inset)\n }\n\n if (includeGap) {\n style.gap = wu(WIDGET_BODY_GAP[size])\n }\n\n return style\n}\n","import type { CSSProperties } from 'react'\nimport type { WidgetSize } from '../types'\nimport { WIDGET_TYPE_FLOOR, type WidgetTypeFloorRole } from './widget-units'\nimport { wu, wuClamp } from './widget-unit-style'\n\n/**\n * Intent roles for widget content type.\n *\n * Floors live on three buckets (`label` / `body` / `display`). Ramp roles map\n * onto those buckets so authors pick meaning, not raw px.\n *\n * Design-px targets are authored against `--widget-u` (256 design canvas).\n * Footprint steps (`small` / `medium` / `large`) are hand-authored growth for\n * roles that earn more room — they are not automatic scale-with-box.\n */\nexport const WIDGET_TYPE_ROLE_FLOOR = {\n /** Quiet uppercase identity on the chrome header. */\n chrome: 'label',\n /** Smallest supporting labels (stat keys, legends, zone tags). */\n label: 'label',\n /** Default reading copy. */\n body: 'body',\n /** Compact identity (handles, short names). */\n name: 'body',\n /** Content headings that are not the hero figure. */\n title: 'body',\n /** Featured content name (project title, primary listing). */\n headline: 'body',\n /** Mid-weight digital / tabular figures (profile stats). */\n stat: 'body',\n /** Hero figures — temperature, big totals. Unfloored. */\n display: 'display',\n /** Dense hero digits (clock faces beside a second column). Unfloored. */\n displayCompact: 'display',\n} as const satisfies Record<string, WidgetTypeFloorRole>\n\nexport type WidgetTypeRampRole = keyof typeof WIDGET_TYPE_ROLE_FLOOR\n\ntype SteppedDesignPx = Record<WidgetSize, number>\n\ninterface WidgetTypeRecipe {\n designPx: number | SteppedDesignPx\n weight: number\n trackingEm?: number\n transform?: 'uppercase'\n leading?: number\n /**\n * Optional CSS-px floor override. When set, replaces the role's bucket floor\n * (`WIDGET_TYPE_FLOOR[…]`). Use for chrome that should sit quieter than\n * content `label` copy.\n */\n floorPx?: number\n /** Leading chrome icon design-px (WidgetCardTitle). */\n iconDesignPx?: number\n /** Leading chrome icon CSS-px floor. */\n iconFloorPx?: number\n}\n\n/**\n * Derived from the live widget inventory (Location place/temp/clock, Behance\n * stats, Open Source title, Instagram handle, WidgetCardTitle chrome).\n * Prefer `widgetTypeStyle(role, size)` over local SIZE maps or Tailwind\n * `text-*` for content type.\n *\n * ## Read this before changing a design-px value\n *\n * `--widget-u` is ALWAYS `188 / 256` ≈ `0.734`, at every host and every cell\n * size. `widgetPresentationStyle` divides the unit back out of the presentation\n * transform, so one canonical composition is scaled as a whole canvas rather\n * than re-resolved per cell. A design-px value therefore renders at\n * `design × 0.734` — the 256 canvas never renders 1:1.\n *\n * That makes the CSS-px floors (`WIDGET_TYPE_FLOOR`) load-bearing rather than a\n * rare safety net, and the ramp was previously authored as if they were rare:\n * `label` (10), `body` (13), `name` (14) and `title` (16) all resolved BELOW\n * their floor and rendered at a single 11–12px step, so four distinct roles\n * were separated only by weight and colour, and the authored headline-to-body\n * ratio of 1.69 rendered as 1.35. `chrome` even inverted — authored larger than\n * `label`, rendered smaller, because its `floorPx` override let it through.\n *\n * The content roles are now authored so `design × 0.734` clears the floor on\n * its own and lands on a deliberate rendered ladder at the 1×1 footprint:\n *\n * | role | design | renders |\n * | -------- | ------ | ------- |\n * | chrome | 14 | 10.3 |\n * | label | 15 | 11.0 |\n * | body | 17 | 12.5 |\n * | name | 18 | 13.2 |\n * | title | 20 | 14.7 |\n * | stat | 22 | 16.2 |\n * | headline | 26 | 19.1 |\n * | display | 48 | 35.3 |\n *\n * `display` / `displayCompact` are unchanged: they never floored, so their\n * rendered figures were already the calibrated ones.\n *\n * ## The footprint columns are a curve, not three free values\n *\n * `body` is deliberately FLAT at 17 across all three footprints: it is reading\n * copy, and a widget that changes its reading size when the tile grows is\n * harder to scan across a desktop, not easier. A wider tile buys measure and\n * room, not bigger prose.\n *\n * That makes every heading role's footprint column a RATIO against a fixed\n * body, and the previous values let the top of the ramp run away from the\n * bottom exactly where there is most type on screen:\n *\n * | role | small | medium | large | old title:body |\n * | -------- | ----- | ------ | ----- | -------------- |\n * | title | 20 | 23 | 30 | 1.18 → 1.76 |\n * | stat | 22 | 24 | 29 | |\n * | headline | 26 | 26 | 34 | |\n *\n * A 1.18 step at 1×1 and a 1.76 step at 2×2 are not one hierarchy, they are two\n * — and the 2×2 one shouts, which is the whole \"widget type feels too big\"\n * complaint. `headline` was also non-monotonic (26 at both small and medium,\n * then a jump to 34), so doubling the tile width bought the hero name nothing\n * and doubling it again bought it 31%.\n *\n * `name` (18 / 19 / 22) was already the disciplined curve — roughly ×1.06 and\n * ×1.22 off its 1×1 value — so the other heading roles now follow it. The 1×1\n * column is untouched: that ladder is the calibrated one above, and the defect\n * was never there.\n *\n * | role | small | medium | large | title:body |\n * | -------- | ----- | ------ | ----- | ------------ |\n * | title | 20 | 22 | 24 | 1.18 → 1.41 |\n * | stat | 22 | 23 | 26 | |\n * | headline | 26 | 28 | 32 | |\n *\n * When adding a footprint step, move along this curve. A role that needs a\n * bigger jump than the curve gives is usually the wrong role for the job.\n */\nexport const WIDGET_TYPE_RAMP = {\n chrome: {\n // Mid quiet chrome: ~10.3px at OS63 (14×188/256), floored to 10 — between\n // the old text-xs (~12) and the too-quiet 9px experiment.\n designPx: 14,\n weight: 500,\n trackingEm: 0.025,\n transform: 'uppercase',\n leading: 1,\n floorPx: 10,\n // Icon sits just above the cap height.\n iconDesignPx: 14,\n iconFloorPx: 11,\n },\n label: {\n designPx: 15,\n weight: 500,\n },\n body: {\n designPx: 17,\n weight: 400,\n },\n name: {\n designPx: { small: 18, medium: 19, large: 22 },\n weight: 600,\n },\n title: {\n designPx: { small: 20, medium: 22, large: 24 },\n weight: 600,\n },\n headline: {\n designPx: { small: 26, medium: 28, large: 32 },\n weight: 600,\n // Display serif (Hedvig Letters Serif) with tall ascenders — 1.12 read as\n // two lines fighting for the same band once the headline cleared its floor.\n leading: 1.18,\n },\n stat: {\n designPx: { small: 22, medium: 23, large: 26 },\n weight: 600,\n },\n display: {\n designPx: { small: 48, medium: 44, large: 64 },\n weight: 600,\n },\n displayCompact: {\n designPx: { small: 40, medium: 34, large: 52 },\n weight: 600,\n },\n} as const satisfies Record<WidgetTypeRampRole, WidgetTypeRecipe>\n\nexport interface WidgetTypeStyleOptions {\n /** Override design-px when a composition needs a one-off step. Prefer ramp. */\n designPx?: number\n /** Override weight (e.g. weather display uses extralight). */\n weight?: number\n leading?: number\n trackingEm?: number\n}\n\nfunction resolveDesignPx(designPx: number | SteppedDesignPx, size: WidgetSize): number {\n return typeof designPx === 'number' ? designPx : designPx[size]\n}\n\n/** Design-px target for a ramp role at a footprint. */\nexport function widgetTypeDesignPx(role: WidgetTypeRampRole, size: WidgetSize = 'medium'): number {\n return resolveDesignPx(WIDGET_TYPE_RAMP[role].designPx, size)\n}\n\n/**\n * Inline type styles for a ramp role.\n *\n * Returns `fontSize` (wu + floor), `fontWeight`, and chrome extras when present.\n * Pair with Tailwind only for color / truncation / layout — not for size.\n */\nexport function widgetTypeStyle(\n role: WidgetTypeRampRole,\n size: WidgetSize = 'medium',\n options?: WidgetTypeStyleOptions\n): CSSProperties {\n // Narrow `as const` recipes omit optional fields; widen to the recipe shape.\n const recipe: WidgetTypeRecipe = WIDGET_TYPE_RAMP[role]\n const floorRole = WIDGET_TYPE_ROLE_FLOOR[role]\n const floorPx = recipe.floorPx ?? WIDGET_TYPE_FLOOR[floorRole]\n const designPx = options?.designPx ?? resolveDesignPx(recipe.designPx, size)\n const weight = options?.weight ?? recipe.weight\n const trackingEm = options?.trackingEm ?? recipe.trackingEm\n const leading = options?.leading ?? recipe.leading\n\n const style: CSSProperties = {\n fontSize: floorPx > 0 ? wuClamp(designPx, floorPx) : wu(designPx),\n fontWeight: weight,\n }\n\n if (trackingEm != null) {\n style.letterSpacing = `${trackingEm}em`\n }\n if (recipe.transform) {\n style.textTransform = recipe.transform\n }\n if (leading != null) {\n style.lineHeight = leading\n }\n\n return style\n}\n\n/**\n * Leading icon box for `WidgetCardTitle` — sized from the chrome recipe so the\n * glyph tracks the quiet header label.\n */\nexport function widgetChromeIconStyle(): CSSProperties {\n const recipe: WidgetTypeRecipe = WIDGET_TYPE_RAMP.chrome\n const designPx = recipe.iconDesignPx ?? resolveDesignPx(recipe.designPx, 'medium')\n const floorPx = recipe.iconFloorPx ?? recipe.floorPx ?? WIDGET_TYPE_FLOOR.label\n return {\n width: floorPx > 0 ? wuClamp(designPx, floorPx) : wu(designPx),\n height: floorPx > 0 ? wuClamp(designPx, floorPx) : wu(designPx),\n }\n}\n\n/**\n * Descender relief for text that also carries `line-clamp-*`.\n *\n * `line-clamp` implies `overflow: hidden`, and the clip box is exactly\n * `line-height × lines`. Any ramp role authored with tight leading therefore\n * has a line box SHORTER than the font's own box, and the last line's\n * descenders are shaved — silently, at every width, whether or not the clamp\n * actually truncates anything.\n *\n * Measured on the open-source headline (Hedvig Letters Serif 600, leading\n * 1.12): the box ended 1.95px above the ink. `0.24em` covers the font's full\n * declared descent rather than one sample string, so no glyph can reach past\n * it, and the matching negative margin hands the space back to layout — the\n * glyphs become whole without anything moving.\n *\n * `truncate` has the same problem for the same reason — it also sets\n * `overflow: hidden`, and a single line box is just as short.\n *\n * Pass `'emoji'` for a line that can carry one. Emoji ink runs well past the\n * font's declared descent, so the text relief only halves the cut: the profile\n * stat row still shaved 3px off a cat's chin at `leading: 1`.\n *\n * @example\n * <span className=\"line-clamp-4\" style={widgetClampRelief()}>{title}</span>\n * <dt className=\"truncate\" style={widgetClampRelief('emoji')}>{label}</dt>\n */\nexport function widgetClampRelief(content: 'emoji' | 'text' = 'text'): CSSProperties {\n const relief = content === 'emoji' ? '0.55em' : '0.24em'\n return {\n paddingBottom: relief,\n marginBottom: `-${relief}`,\n }\n}\n","import {\n createContext,\n useContext,\n type ComponentPropsWithRef,\n type CSSProperties,\n type ReactNode,\n} from 'react'\nimport type { WidgetSize } from '../types'\n\nconst WidgetSizeContext = createContext<WidgetSize>('small')\n\n/**\n * Reports the size a widget is being rendered at, so a widget supporting more\n * than one size can pick the matching composition.\n */\nexport function useWidgetSize(): WidgetSize {\n return useContext(WidgetSizeContext)\n}\n\nexport interface WidgetSizeProviderProps {\n children: ReactNode\n size: WidgetSize\n}\n\nexport function WidgetSizeProvider({ children, size }: WidgetSizeProviderProps) {\n return <WidgetSizeContext.Provider value={size}>{children}</WidgetSizeContext.Provider>\n}\n\ntype WidgetGridStyle = CSSProperties & {\n '--widget-cols': string\n '--widget-gap': string\n}\n\nexport interface WidgetGridProps extends ComponentPropsWithRef<'div'> {\n /** Track count. Fixed, not responsive — every size keeps its shape at every width. @default 2 */\n columns?: number\n /** Gutter in CSS px. @default 12 */\n gap?: number\n}\n\n/**\n * Widget grid container. Owns track count and gap, and publishes both as custom\n * properties so each tile's cell-derived unit can divide them out.\n *\n * Tracks are explicit rather than `auto-fill`: with intrinsic tracks a narrow\n * container resolves to one column and a `span 2` tile would create an implicit\n * second column and overflow.\n *\n * Rows are sized here rather than on the tile: an element cannot resolve\n * container-query units against the `@container` it establishes itself, so the\n * grid is wrapped in a container and `grid-auto-rows` resolves `100cqi` against\n * that ancestor. Tiles just fill their area, and spanning tiles inherit the\n * inter-row gaps from the grid.\n */\nexport function WidgetGrid({\n children,\n columns = 2,\n gap = 12,\n ref,\n style,\n ...props\n}: WidgetGridProps) {\n const gridStyle: WidgetGridStyle = {\n '--widget-cols': String(columns),\n '--widget-gap': `${gap}px`,\n display: 'grid',\n gap: `${gap}px`,\n gridAutoRows:\n 'calc((100cqi - (var(--widget-cols) - 1) * var(--widget-gap)) / var(--widget-cols))',\n gridTemplateColumns: 'repeat(var(--widget-cols), minmax(0, 1fr))',\n ...style,\n }\n\n return (\n <div ref={ref} style={{ containerType: 'inline-size' }} {...props}>\n <div style={gridStyle}>{children}</div>\n </div>\n )\n}\n","import {\n type ComponentPropsWithRef,\n type ComponentType,\n type ReactNode,\n type Ref,\n useCallback,\n useLayoutEffect,\n useRef,\n} from 'react'\nimport type { WidgetSize } from '../types'\nimport { cn } from '../utils'\nimport { WidgetSizeProvider } from './widget-grid'\nimport { widgetPresentationStyle, widgetSizeStyle } from './widget-scale'\nimport { WIDGET_CANONICAL_CELL_PX, WIDGET_MAX_PRESENTATION_SCALE } from './widget-units'\n\nexport interface WidgetViewportProps extends Omit<ComponentPropsWithRef<'article'>, 'children'> {\n /**\n * The host grid's cell width in CSS px, when the host already knows it.\n *\n * Left unset the viewport derives the cell from its own measured box, which\n * is right at rest and wrong while that box is moving: a host that animates\n * the shell between two sizes re-fires the observer every frame, the cell\n * follows the travelling width, and the composition zooms inside the growing\n * box instead of reflowing in it. The cell a tile lands in is a property of\n * the *grid*, identical for a 1x1 and a 2x1, so a host that measures its own\n * tracks can say so once and the observer never runs.\n *\n * Passing it also frees the canvas height to follow the host box rather than\n * the cell — the two are the same number at rest, and only the first of them\n * is still true mid-flight.\n */\n cellPx?: number\n children: ReactNode\n size: WidgetSize\n}\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref) {\n ref.current = value\n }\n}\n\n/**\n * Fluid host boundary for a canonical widget view.\n *\n * The viewport owns grid placement and publishes the design unit. The widget\n * view inside owns all visible surface, composition, and state styling.\n */\nexport function WidgetViewport({\n cellPx,\n children,\n className,\n ref,\n size,\n style,\n ...props\n}: WidgetViewportProps) {\n const viewportRef = useRef<HTMLElement | null>(null)\n const canvasRef = useRef<HTMLDivElement | null>(null)\n const setViewportRef = useCallback(\n (node: HTMLElement | null) => {\n viewportRef.current = node\n assignRef(ref, node)\n },\n [ref]\n )\n\n useLayoutEffect(() => {\n const viewport = viewportRef.current\n const canvas = canvasRef.current\n if (!viewport || !canvas) return\n // The host told us the cell, so there is nothing to measure and nothing to\n // watch: the scale is already on the canvas, from `widgetPresentationStyle`.\n if (cellPx != null) return\n\n const updatePresentationScale = () => {\n const computedStyle = getComputedStyle(viewport)\n const span = Number.parseFloat(computedStyle.getPropertyValue('--widget-span')) || 1\n const gap = Number.parseFloat(computedStyle.getPropertyValue('--widget-gap')) || 0\n const cellPx = (viewport.getBoundingClientRect().width - (span - 1) * gap) / span\n const scale = Math.min(cellPx / WIDGET_CANONICAL_CELL_PX, WIDGET_MAX_PRESENTATION_SCALE)\n canvas.style.setProperty('--widget-presentation-scale', String(scale))\n }\n\n updatePresentationScale()\n\n if (typeof ResizeObserver === 'undefined') {\n window.addEventListener('resize', updatePresentationScale)\n return () => window.removeEventListener('resize', updatePresentationScale)\n }\n\n const observer = new ResizeObserver(updatePresentationScale)\n observer.observe(viewport)\n return () => observer.disconnect()\n }, [cellPx, size])\n\n const presentationStyle =\n cellPx == null\n ? widgetPresentationStyle()\n : {\n ...widgetPresentationStyle(cellPx),\n // Off the cell, onto the box. The cell-derived height is the row's\n // resting height, which is the same number — until the host animates\n // the shell between two sizes, when the box is the one that is still\n // true. `100%` resolves against the viewport, which is `size-full`.\n height: 'calc(100% / var(--widget-presentation-scale))',\n }\n\n return (\n <WidgetSizeProvider size={size}>\n <article\n className={cn('a63-WidgetViewport', className)}\n data-widget-viewport=\"\"\n data-widget-viewport-size={size}\n ref={setViewportRef}\n style={{\n ...widgetSizeStyle(size),\n // A known cell replaces the `100cqi`-derived one, so `--widget-u`\n // stops tracking a travelling width along with it.\n ...(cellPx == null ? null : { '--widget-cell': `${cellPx}px` }),\n ...style,\n }}\n {...props}\n >\n <div data-widget-presentation-canvas=\"\" ref={canvasRef} style={presentationStyle}>\n {children}\n </div>\n </article>\n </WidgetSizeProvider>\n )\n}\n\n/**\n * Wrap a sized widget component so it carries its own viewport.\n *\n * A widget's composition is authored on a 256 design-px canvas and only\n * resolves against real pixels once a host publishes `--widget-u`. Grid hosts\n * (the OS63 desktop, the atom63.io board) publish it by placing tiles in a\n * `WidgetViewport` themselves. Hosts that render a widget on its own — agent\n * chat renders one per message, in an intrinsically sized frame — have no grid\n * to hang that on, and a widget mounted without it silently renders design px\n * at 1:1: ~36% oversized type, padding and gaps, clipped by the shell wherever\n * the overflow lands.\n *\n * Use this at the registry boundary of such a host so the widget arrives\n * already scaled, rather than re-deriving the unit per call site.\n *\n * @example\n * component: () => import('./weather').then(m => withWidgetViewport(m.Weather))\n */\nexport function withWidgetViewport<P extends { size: WidgetSize }>(\n Component: ComponentType<P>\n): ComponentType<P> {\n function WidgetViewportBoundary(props: P) {\n return (\n <WidgetViewport className=\"a63-WidgetViewport-fill\" size={props.size}>\n <Component {...props} />\n </WidgetViewport>\n )\n }\n\n WidgetViewportBoundary.displayName = `withWidgetViewport(${Component.displayName ?? Component.name ?? 'Widget'})`\n\n return WidgetViewportBoundary\n}\n"]}
@@ -0,0 +1,37 @@
1
+ // src/state/types.ts
2
+ var DEFAULT_WIDGET_ERROR_LABELS = {
3
+ copyDetails: "Copy details",
4
+ detailsDescription: "Technical information you can copy when reporting this problem.",
5
+ detailsTitle: "Error details",
6
+ retry: "Try again",
7
+ viewDetails: "View error details"
8
+ };
9
+ function resolveWidgetFeedbackState({
10
+ error,
11
+ isEmpty,
12
+ isLoading
13
+ }) {
14
+ if (error) {
15
+ return "error";
16
+ }
17
+ if (isLoading) {
18
+ return "loading";
19
+ }
20
+ if (isEmpty) {
21
+ return "empty";
22
+ }
23
+ return null;
24
+ }
25
+ function getWidgetErrorDescription(error) {
26
+ return error instanceof Error ? error.message : void 0;
27
+ }
28
+ function widgetStateCopy(titles) {
29
+ return (state, error) => ({
30
+ description: state === "error" ? getWidgetErrorDescription(error) : void 0,
31
+ title: titles[state]
32
+ });
33
+ }
34
+
35
+ export { DEFAULT_WIDGET_ERROR_LABELS, getWidgetErrorDescription, resolveWidgetFeedbackState, widgetStateCopy };
36
+ //# sourceMappingURL=chunk-TCQFVY3S.js.map
37
+ //# sourceMappingURL=chunk-TCQFVY3S.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/state/types.ts"],"names":[],"mappings":";AAyBO,IAAM,2BAAA,GAAiD;AAAA,EAC5D,WAAA,EAAa,cAAA;AAAA,EACb,kBAAA,EAAoB,iEAAA;AAAA,EACpB,YAAA,EAAc,eAAA;AAAA,EACd,KAAA,EAAO,WAAA;AAAA,EACP,WAAA,EAAa;AACf;AA+BO,SAAS,0BAAA,CAA2B;AAAA,EACzC,KAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAA,EAI+B;AAC7B,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,OAAO,OAAA;AAAA,EACT;AACA,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,OAAO,SAAA;AAAA,EACT;AACA,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,OAAO,OAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAA;AACT;AAGO,SAAS,0BAA0B,KAAA,EAAoC;AAC5E,EAAA,OAAO,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,MAAA;AAClD;AAmBO,SAAS,gBACd,MAAA,EACqE;AACrE,EAAA,OAAO,CAAC,OAAO,KAAA,MAAW;AAAA,IACxB,WAAA,EAAa,KAAA,KAAU,OAAA,GAAU,yBAAA,CAA0B,KAAK,CAAA,GAAI,MAAA;AAAA,IACpE,KAAA,EAAO,OAAO,KAAK;AAAA,GACrB,CAAA;AACF","file":"chunk-TCQFVY3S.js","sourcesContent":["/** Title and optional description for one feedback state. */\nexport interface WidgetFeedbackCopy {\n title: string\n description?: string\n}\n\nexport type WidgetFeedbackState = 'loading' | 'error' | 'empty'\n\n/**\n * The fixed strings of the error state's controls, so a host can translate\n * them. Any field left out keeps its English default.\n */\nexport interface WidgetErrorLabels {\n /** The retry button. Default \"Try again\". */\n retry: string\n /** Accessible name of the icon-only button that opens the details. Default \"View error details\". */\n viewDetails: string\n /** Title of the details popover, also the copy button's label. Default \"Error details\". */\n detailsTitle: string\n /** Description under the details title. */\n detailsDescription: string\n /** Text of the copy button. Default \"Copy details\". */\n copyDetails: string\n}\n\nexport const DEFAULT_WIDGET_ERROR_LABELS: WidgetErrorLabels = {\n copyDetails: 'Copy details',\n detailsDescription: 'Technical information you can copy when reporting this problem.',\n detailsTitle: 'Error details',\n retry: 'Try again',\n viewDetails: 'View error details',\n}\n\n/**\n * The shared async-state contract for widget views.\n *\n * Top-level props on purpose: `listening` and `profile` used to carry these\n * inside their `data` object while every other widget took them as props, so a\n * host had to remember which shape a given widget wanted. One shape, one place.\n */\nexport interface WidgetStateProps {\n /** Truthy renders the error state. Accepts `unknown` so hosts can pass a query error straight through. */\n error?: unknown\n isLoading?: boolean\n /** Background refresh — content stays mounted, controls show activity. */\n isRefreshing?: boolean\n onRetry?: () => void\n}\n\n/** Per-widget wording for the shared feedback surface. */\nexport interface WidgetStateCopy {\n empty?: WidgetFeedbackCopy\n error?: WidgetFeedbackCopy\n loading?: WidgetFeedbackCopy\n}\n\n/**\n * Resolve which feedback state a view should render, if any.\n *\n * `error` wins over `isLoading`: a failed refresh must not sit behind a spinner\n * forever. `isEmpty` is only consulted once the data settles.\n */\nexport function resolveWidgetFeedbackState({\n error,\n isEmpty,\n isLoading,\n}: {\n error?: unknown\n isEmpty?: boolean\n isLoading?: boolean\n}): WidgetFeedbackState | null {\n if (error) {\n return 'error'\n }\n if (isLoading) {\n return 'loading'\n }\n if (isEmpty) {\n return 'empty'\n }\n return null\n}\n\n/** Error message text, when the host passed a real Error. */\nexport function getWidgetErrorDescription(error: unknown): string | undefined {\n return error instanceof Error ? error.message : undefined\n}\n\n/**\n * Build a widget's feedback copy from its three state titles.\n *\n * Every widget needs the same thing: a title per state, plus the error's own\n * message on the error state. Six widgets hand-rolled that in two different\n * shapes — a map of thunks in some, an object plus a `feedbackState === 'error'`\n * ternary at the call site in others. This is the one shape.\n *\n * @example\n * const WEATHER_STATE_COPY = widgetStateCopy({\n * empty: 'No weather data yet',\n * error: 'Unable to load weather',\n * loading: 'Loading weather',\n * })\n *\n * <WidgetStateFeedback copy={WEATHER_STATE_COPY(feedbackState, error)} … />\n */\nexport function widgetStateCopy(\n titles: Record<WidgetFeedbackState, string>\n): (state: WidgetFeedbackState, error?: unknown) => WidgetFeedbackCopy {\n return (state, error) => ({\n description: state === 'error' ? getWidgetErrorDescription(error) : undefined,\n title: titles[state],\n })\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -711,4 +711,5 @@ declare function useWidgetLink(): ComponentType<WidgetLinkProps> | undefined;
711
711
  */
712
712
  declare function useWidgetDestination(href: string | undefined): WidgetDestination | null;
713
713
 
714
- export { type ClassValue, WIDGET_BODY_GAP, WIDGET_BODY_INSET, WIDGET_CANONICAL_CELL_PX, WIDGET_DENSITY_SCALE, WIDGET_MAX_PRESENTATION_SCALE, WIDGET_TYPE_FLOOR, WIDGET_TYPE_RAMP, WIDGET_TYPE_ROLE_FLOOR, WIDGET_UNIT_BASE_PX, WIDGET_UNIT_SPAN, type WidgetDensity, type WidgetDestination, WidgetGrid, type WidgetGridProps, WidgetImage, type WidgetInsetMode, type WidgetInsetStyleOptions, type WidgetLinkProps, WidgetLinkProvider, type WidgetPresentationStyle, WidgetSize, WidgetSizeProvider, type WidgetSizeProviderProps, type WidgetSizeStyle, type WidgetSizeStyleOptions, type WidgetTypeFloorRole, type WidgetTypeRampRole, type WidgetTypeRole, type WidgetTypeStyleOptions, type WidgetUnitSpan, type WidgetUnitStyle, WidgetViewport, type WidgetViewportProps, cn, resolveDestination, resolveDestinationKind, useWidgetDestination, useWidgetLink, useWidgetSize, widgetChromeIconStyle, widgetClampRelief, widgetInsetPx, widgetInsetStyle, widgetPresentationStyle, widgetSizeStyle, widgetTypeDesignPx, widgetTypeStyle, widgetUnitStyle, withWidgetViewport, wu, wuClamp, wuMerge, wuStyle };
714
+ export { WIDGET_BODY_GAP, WIDGET_BODY_INSET, WIDGET_CANONICAL_CELL_PX, WIDGET_DENSITY_SCALE, WIDGET_MAX_PRESENTATION_SCALE, WIDGET_TYPE_FLOOR, WIDGET_TYPE_RAMP, WIDGET_TYPE_ROLE_FLOOR, WIDGET_UNIT_BASE_PX, WIDGET_UNIT_SPAN, WidgetGrid, WidgetImage, WidgetLinkProvider, WidgetSize, WidgetSizeProvider, WidgetViewport, cn, resolveDestination, resolveDestinationKind, useWidgetDestination, useWidgetLink, useWidgetSize, widgetChromeIconStyle, widgetClampRelief, widgetInsetPx, widgetInsetStyle, widgetPresentationStyle, widgetSizeStyle, widgetTypeDesignPx, widgetTypeStyle, widgetUnitStyle, withWidgetViewport, wu, wuClamp, wuMerge, wuStyle };
715
+ export type { ClassValue, WidgetDensity, WidgetDestination, WidgetGridProps, WidgetInsetMode, WidgetInsetStyleOptions, WidgetLinkProps, WidgetPresentationStyle, WidgetSizeProviderProps, WidgetSizeStyle, WidgetSizeStyleOptions, WidgetTypeFloorRole, WidgetTypeRampRole, WidgetTypeRole, WidgetTypeStyleOptions, WidgetUnitSpan, WidgetUnitStyle, WidgetViewportProps };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { cn } from './chunk-F5NV6XJ5.js';
2
- export { WIDGET_BODY_GAP, WIDGET_BODY_INSET, WIDGET_CANONICAL_CELL_PX, WIDGET_DENSITY_SCALE, WIDGET_MAX_PRESENTATION_SCALE, WIDGET_TYPE_FLOOR, WIDGET_TYPE_RAMP, WIDGET_TYPE_ROLE_FLOOR, WIDGET_UNIT_BASE_PX, WIDGET_UNIT_SPAN, WidgetGrid, WidgetSizeProvider, WidgetViewport, cn, useWidgetSize, widgetChromeIconStyle, widgetClampRelief, widgetInsetPx, widgetInsetStyle, widgetPresentationStyle, widgetSizeStyle, widgetTypeDesignPx, widgetTypeStyle, widgetUnitStyle, withWidgetViewport, wu, wuClamp, wuMerge, wuStyle } from './chunk-F5NV6XJ5.js';
1
+ import { cn } from './chunk-QCNNU4OV.js';
2
+ export { WIDGET_BODY_GAP, WIDGET_BODY_INSET, WIDGET_CANONICAL_CELL_PX, WIDGET_DENSITY_SCALE, WIDGET_MAX_PRESENTATION_SCALE, WIDGET_TYPE_FLOOR, WIDGET_TYPE_RAMP, WIDGET_TYPE_ROLE_FLOOR, WIDGET_UNIT_BASE_PX, WIDGET_UNIT_SPAN, WidgetGrid, WidgetSizeProvider, WidgetViewport, cn, useWidgetSize, widgetChromeIconStyle, widgetClampRelief, widgetInsetPx, widgetInsetStyle, widgetPresentationStyle, widgetSizeStyle, widgetTypeDesignPx, widgetTypeStyle, widgetUnitStyle, withWidgetViewport, wu, wuClamp, wuMerge, wuStyle } from './chunk-QCNNU4OV.js';
3
3
  import { Skeleton } from '@atom63/ui-react';
4
4
  import { useReducedMotion } from 'motion/react';
5
5
  import { createContext, useState, useEffect, useMemo, useContext } from 'react';
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { HTMLAttributes, ReactNode } from 'react';
3
3
  export { W as WIDGET_BODY_INSET_CLASS, a as WidgetBlock, b as WidgetBlockContent, c as WidgetBlockFooter, d as WidgetBlockHeader, e as WidgetCard, f as WidgetCardContent, g as WidgetCardHeader, h as WidgetCardHeaderLeft, i as WidgetCardHeaderRight, j as WidgetCardRow, k as WidgetCardTextGroup, l as WidgetCardTitle, m as WidgetShell } from '../widget-card-BckLTmBY.js';
4
- import { W as WidgetSize } from '../types-C0zDKyo1.js';
4
+ import { WidgetSize } from '../index.js';
5
5
 
6
6
  type WidgetAvatarSize = 'sm' | 'md' | 'lg' | 'xl';
7
7
  interface WidgetAvatarProps {
@@ -120,4 +120,5 @@ interface WidgetSurfaceProps extends HTMLAttributes<HTMLDivElement> {
120
120
  */
121
121
  declare function WidgetSurface({ children, className, size, ...rest }: WidgetSurfaceProps): React.JSX.Element;
122
122
 
123
- export { WIDGET_CARD_SURFACE_CLASS, WIDGET_RIM_SHELL_CLASS, WidgetAvatar, type WidgetAvatarProps, type WidgetAvatarSize, WidgetSurface, type WidgetSurfaceProps, WidgetSurfaceSizeProvider, useWidgetSurfaceSize };
123
+ export { WIDGET_CARD_SURFACE_CLASS, WIDGET_RIM_SHELL_CLASS, WidgetAvatar, WidgetSurface, WidgetSurfaceSizeProvider, useWidgetSurfaceSize };
124
+ export type { WidgetAvatarProps, WidgetAvatarSize, WidgetSurfaceProps };
@@ -1,4 +1,4 @@
1
- export { WIDGET_BODY_INSET_CLASS, WIDGET_CARD_SURFACE_CLASS, WIDGET_RIM_SHELL_CLASS, WidgetAvatar, WidgetBlock, WidgetBlockContent, WidgetBlockFooter, WidgetBlockHeader, WidgetCard, WidgetCardContent, WidgetCardHeader, WidgetCardHeaderLeft, WidgetCardHeaderRight, WidgetCardRow, WidgetCardTextGroup, WidgetCardTitle, WidgetShell, WidgetSurface, WidgetSurfaceSizeProvider, useWidgetSurfaceSize } from '../chunk-US2CE3BV.js';
2
- import '../chunk-F5NV6XJ5.js';
1
+ export { WIDGET_BODY_INSET_CLASS, WIDGET_CARD_SURFACE_CLASS, WIDGET_RIM_SHELL_CLASS, WidgetAvatar, WidgetBlock, WidgetBlockContent, WidgetBlockFooter, WidgetBlockHeader, WidgetCard, WidgetCardContent, WidgetCardHeader, WidgetCardHeaderLeft, WidgetCardHeaderRight, WidgetCardRow, WidgetCardTextGroup, WidgetCardTitle, WidgetShell, WidgetSurface, WidgetSurfaceSizeProvider, useWidgetSurfaceSize } from '../chunk-3ND4LGYB.js';
2
+ import '../chunk-QCNNU4OV.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ReactNode, ComponentProps } from 'react';
3
- import { W as WidgetSize } from '../types-C0zDKyo1.js';
4
- import { e as WidgetCard } from '../widget-card-BckLTmBY.js';
3
+ import { WidgetSize } from '../index.js';
4
+ import { WidgetCard } from '../primitives/index.js';
5
5
 
6
6
  /** Shared centered spinner for widget content loading (module defer + data fetch). */
7
7
  declare function WidgetContentFallback(): React.JSX.Element;
@@ -22,9 +22,11 @@ declare function WidgetHostContentTransition({ children, className, contentClass
22
22
  }): React.JSX.Element;
23
23
 
24
24
  /** Widget card shell for runtime error boundaries (lazy load, render crash). */
25
- declare function WidgetHostErrorFallback({ message, onRetry, size, title, }: {
25
+ declare function WidgetHostErrorFallback({ message, onRetry, retryLabel, size, title, }: {
26
26
  message?: string;
27
27
  onRetry?: () => void;
28
+ /** The retry button's text. Defaults to the widget error state's "Try again". */
29
+ retryLabel?: string;
28
30
  size: WidgetSize;
29
31
  title?: string;
30
32
  }): React.JSX.Element;
@@ -1,5 +1,6 @@
1
- import { WidgetCard, WidgetCardHeader, WidgetCardTitle, WidgetCardContent, WidgetBlock, WidgetBlockFooter } from '../chunk-US2CE3BV.js';
2
- import { cn, widgetTypeStyle, widgetInsetStyle } from '../chunk-F5NV6XJ5.js';
1
+ import { DEFAULT_WIDGET_ERROR_LABELS } from '../chunk-TCQFVY3S.js';
2
+ import { WidgetCard, WidgetCardHeader, WidgetCardTitle, WidgetCardContent, WidgetBlock, WidgetBlockFooter } from '../chunk-3ND4LGYB.js';
3
+ import { cn, widgetTypeStyle, widgetInsetStyle } from '../chunk-QCNNU4OV.js';
3
4
  import { LoaderCircle, AlertCircle, RefreshCw } from 'lucide-react';
4
5
  import { jsx, jsxs } from 'react/jsx-runtime';
5
6
  import { useReducedMotion, AnimatePresence, motion } from 'motion/react';
@@ -98,6 +99,7 @@ var WIDGET_FILL_STYLE = { blockSize: "100%", inlineSize: "100%" };
98
99
  function WidgetHostErrorFallback({
99
100
  message,
100
101
  onRetry,
102
+ retryLabel = DEFAULT_WIDGET_ERROR_LABELS.retry,
101
103
  size,
102
104
  title = "Widget failed to load"
103
105
  }) {
@@ -120,7 +122,7 @@ function WidgetHostErrorFallback({
120
122
  ) : null,
121
123
  onRetry ? /* @__PURE__ */ jsxs(Button, { onClick: onRetry, size: "sm", type: "button", variant: "ghost", children: [
122
124
  /* @__PURE__ */ jsx(RefreshCw, { "aria-hidden": true }),
123
- "Retry"
125
+ retryLabel
124
126
  ] }) : null
125
127
  ] })
126
128
  ] }) });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/widget-content-fallback.tsx","../../src/runtime/widget-host-transition-config.ts","../../src/runtime/widget-host-content-transition.tsx","../../src/runtime/widget-fill.ts","../../src/runtime/widget-host-error-fallback.tsx","../../src/runtime/widget-host-loading-shell.tsx","../../src/runtime/widget-host-optional-header.tsx","../../src/runtime/widget-host-title-transition.tsx","../../src/runtime/widget-hosted-shell.tsx"],"names":["jsx","useReducedMotion","AnimatePresence","motion","jsxs"],"mappings":";;;;;;;;AAGO,SAAS,qBAAA,GAAwB;AACtC,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,MAAA;AAAA,MACV,SAAA,EAAU,2BAAA;AAAA,MACV,WAAA,EAAU,yBAAA;AAAA,MAEV,QAAA,kBAAA,GAAA,CAAC,YAAA,EAAA,EAAa,aAAA,EAAW,IAAA,EAAC,WAAU,gDAAA,EAAiD;AAAA;AAAA,GACvF;AAEJ;;;ACZO,IAAM,oCAAA,GAAuC;AAE7C,IAAM,gCAAA,GAAmC,CAAC,GAAA,EAAK,CAAA,EAAG,GAAG,CAAC;AAGtD,IAAM,0BAAA,GAA6B;AAGnC,IAAM,8BAAA,GAAiC;AAAA,EAC5C,QAAA,EAAU,oCAAA;AAAA,EACV,IAAA,EAAM;AACR;AAKO,SAAS,6BAA6B,YAAA,EAAuC;AAClF,EAAA,OAAO,YAAA,KAAiB,IAAA;AAC1B;AAaO,SAAS,4BAAA,CACd,OACA,YAAA,EACA;AACA,EAAA,IAAI,4BAAA,CAA6B,YAAY,CAAA,EAAG;AAC9C,IAAA,OAAO,EAAE,MAAA,EAAQ,MAAA,EAAQ,OAAA,EAAS,CAAA,EAAE;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A,GACH;AAGF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKEI,IAAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,EAAA,CAAG,MAAA,IAAU,gCAAA,EAAkC,SAAS,CAAA;AAAA,QACnE,IAAA;AAAA,QACA,KAAA,EAAO,EAAE,GAAG,iBAAA,EAAmB,GAAG,KAAA,EAAM;AAAA,QACvC,GAAG,SAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAA,MAAA;AAAA,UACA,MAAA,mBACCA,IAAAA,CAAC,WAAA,EAAA,EAAY,KAAA,EAAO,iBAAiB,IAAA,EAAM,MAAA,GAAS,MAAA,GAAS,MAAM,CAAA,EAChE,QAAA,EAAA;AAAA,YAAA,UAAA;AAAA,4BACDJ,GAAAA,CAAC,iBAAA,EAAA,EAAmB,QAAA,EAAA,MAAA,EAAO;AAAA,WAAA,EAC7B,CAAA,GAEA;AAAA;AAAA;AAAA;AAEJ;AAEJ","file":"index.js","sourcesContent":["import { LoaderCircle } from 'lucide-react'\n\n/** Shared centered spinner for widget content loading (module defer + data fetch). */\nexport function WidgetContentFallback() {\n return (\n <output\n aria-busy=\"true\"\n className=\"a63-WidgetContentFallback\"\n data-slot=\"widget-content-fallback\"\n >\n <LoaderCircle aria-hidden className=\"a63-WidgetContentFallback-icon a63-Widget-spin\" />\n </output>\n )\n}\n","/** Shell + content size transition duration (seconds) for widget resize + crossfade. */\nexport const WIDGET_HOST_SIZE_TRANSITION_DURATION = 0.32\n\nexport const WIDGET_HOST_SIZE_TRANSITION_EASE = [0.5, 0, 0, 1] as const\n\n/** Blur amount for hosted content/title crossfades — masks reflow during shell resize. */\nexport const WIDGET_HOST_CROSSFADE_BLUR = '6px'\n\n/** Shared motion transition for desktop shell resize and inner content crossfade. */\nexport const widgetHostSizeMotionTransition = {\n duration: WIDGET_HOST_SIZE_TRANSITION_DURATION,\n ease: WIDGET_HOST_SIZE_TRANSITION_EASE,\n} as const\n\ntype WidgetHostMotionPhase = 'active' | 'enter' | 'exit'\n\n/** Motion returns null when no reduced-motion preference is set — treat that as animated. */\nexport function shouldReduceWidgetHostMotion(reduceMotion: boolean | null): boolean {\n return reduceMotion === true\n}\n\n/**\n * Opacity + blur crossfade for inner widget content and title chrome.\n * Blur is applied on clipped inner layers only — not the widget card shell —\n * so themed backdrop-filter on the shell stays intact.\n *\n * The resting state is `none`, not `blur(0px)`. Any filter value other than\n * `none` establishes a backdrop root, which neutralises `backdrop-filter` on\n * everything below it — so a resting `blur(0px)` silently disables the blur\n * ramp inside widgets that put text over photography. `none` costs nothing at\n * rest and the animated phases still carry the blur.\n */\nexport function getWidgetHostCrossfadeMotion(\n phase: WidgetHostMotionPhase,\n reduceMotion: boolean | null\n) {\n if (shouldReduceWidgetHostMotion(reduceMotion)) {\n return { filter: 'none', opacity: 1 }\n }\n\n if (phase === 'active') {\n return { filter: 'none', opacity: 1 }\n }\n\n return { filter: `blur(${WIDGET_HOST_CROSSFADE_BLUR})`, opacity: 0 }\n}\n\n/**\n * Opacity-only swap for copy inside a locked height box (film title/year).\n * No blur (glyph bounds) and no translate — even a small `y` shifts the\n * visual mass of the line and reads as the text plate changing height.\n */\nexport function getWidgetHostSlideFadeMotion(\n phase: WidgetHostMotionPhase,\n reduceMotion: boolean | null\n) {\n if (shouldReduceWidgetHostMotion(reduceMotion) || phase === 'active') {\n return { opacity: 1 }\n }\n\n return { opacity: 0 }\n}\n","import { AnimatePresence, motion, useReducedMotion } from 'motion/react'\nimport { type ReactNode, useLayoutEffect, useRef } from 'react'\nimport { cn } from '../utils'\nimport {\n getWidgetHostCrossfadeMotion,\n shouldReduceWidgetHostMotion,\n widgetHostSizeMotionTransition,\n} from './widget-host-transition-config'\n\n/**\n * Crossfade inner widget content while the outer card shell stays mounted.\n *\n * Each layer grows from its top-start corner. `originClassName` adds a class\n * to the layer to change that (a consumer utility such as `origin-center`\n * outranks the stylesheet's default).\n */\nexport function WidgetHostContentTransition({\n children,\n className,\n contentClassName,\n contentKey,\n originClassName,\n}: {\n children: ReactNode\n className?: string\n contentClassName?: string\n contentKey: string\n originClassName?: string\n}) {\n const reduceMotion = useReducedMotion()\n const slotRef = useRef<HTMLDivElement>(null)\n const frozenExitWidthRef = useRef<number | null>(null)\n\n // contentKey is an intentional re-measure trigger — it freezes the outgoing slot width right before the content swaps, even though the effect body doesn't read it.\n useLayoutEffect(() => {\n frozenExitWidthRef.current = slotRef.current?.offsetWidth ?? null\n }, [contentKey])\n\n const prefersReducedMotion = shouldReduceWidgetHostMotion(reduceMotion)\n const frozenExitWidth = frozenExitWidthRef.current\n\n return (\n <div\n className={cn('a63-WidgetHostContentTransition', className)}\n data-slot=\"widget-host-content-transition\"\n ref={slotRef}\n >\n <AnimatePresence initial={false} mode=\"sync\">\n <motion.div\n animate={{\n ...getWidgetHostCrossfadeMotion('active', reduceMotion),\n width: '100%',\n }}\n className={cn('a63-WidgetHostContentTransition-layer', originClassName, contentClassName)}\n exit={{\n ...getWidgetHostCrossfadeMotion('exit', reduceMotion),\n width: frozenExitWidth ?? '100%',\n }}\n initial={{\n ...getWidgetHostCrossfadeMotion('enter', reduceMotion),\n width: '100%',\n }}\n key={contentKey}\n style={{\n willChange: prefersReducedMotion ? undefined : 'opacity, filter',\n }}\n transition={prefersReducedMotion ? { duration: 0 } : widgetHostSizeMotionTransition}\n >\n {children}\n </motion.div>\n </AnimatePresence>\n </div>\n )\n}\n","import type { CSSProperties } from 'react'\n\n/**\n * Fills the host box. Passed as `style`, which lands on the surface's outer\n * shell: the runtime shells size the widget itself, not its face.\n */\nexport const WIDGET_FILL_STYLE: CSSProperties = { blockSize: '100%', inlineSize: '100%' }\n","import { Button } from '@atom63/ui-react'\nimport { AlertCircle, RefreshCw } from 'lucide-react'\nimport { widgetTypeStyle } from '../layout'\nimport { WidgetCard, WidgetCardContent, WidgetCardHeader, WidgetCardTitle } from '../primitives'\nimport type { WidgetSize } from '../types'\nimport { WIDGET_FILL_STYLE } from './widget-fill'\n\n/** Widget card shell for runtime error boundaries (lazy load, render crash). */\nexport function WidgetHostErrorFallback({\n message,\n onRetry,\n size,\n title = 'Widget failed to load',\n}: {\n message?: string\n onRetry?: () => void\n size: WidgetSize\n title?: string\n}) {\n return (\n <div className=\"a63-WidgetHostFallback\" data-slot=\"widget-host-error-fallback\">\n <WidgetCard size={size} style={WIDGET_FILL_STYLE}>\n <WidgetCardHeader>\n <WidgetCardTitle\n icon={<AlertCircle aria-hidden className=\"a63-WidgetHostErrorFallback-icon\" />}\n >\n {title}\n </WidgetCardTitle>\n </WidgetCardHeader>\n <WidgetCardContent className=\"a63-WidgetHostErrorFallback-content\">\n {message ? (\n <p\n className=\"a63-WidgetHostErrorFallback-message\"\n style={widgetTypeStyle('body', size)}\n >\n {message}\n </p>\n ) : null}\n {onRetry ? (\n <Button onClick={onRetry} size=\"sm\" type=\"button\" variant=\"ghost\">\n <RefreshCw aria-hidden />\n Retry\n </Button>\n ) : null}\n </WidgetCardContent>\n </WidgetCard>\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { WidgetCard, WidgetCardContent } from '../primitives'\nimport type { WidgetSize } from '../types'\nimport { WidgetContentFallback } from './widget-content-fallback'\nimport { WIDGET_FILL_STYLE } from './widget-fill'\n\n/**\n * Card shell with a centered spinner only — no title (avoids header flash on\n * resolve). Takes the footprint it is standing in for, so the chrome it paints\n * while loading matches the chrome the widget paints once resolved.\n */\nexport function WidgetHostLoadingShell({\n content,\n size,\n}: {\n content?: ReactNode\n size: WidgetSize\n}) {\n return (\n <div className=\"a63-WidgetHostFallback\" data-slot=\"widget-host-loading-shell\">\n <WidgetCard size={size} style={WIDGET_FILL_STYLE}>\n <WidgetCardContent className=\"a63-WidgetHostLoadingShell-content\">\n {content ?? <WidgetContentFallback />}\n </WidgetCardContent>\n </WidgetCard>\n </div>\n )\n}\n","import { AnimatePresence, motion, useReducedMotion } from 'motion/react'\nimport type { ReactNode } from 'react'\nimport {\n shouldReduceWidgetHostMotion,\n widgetHostSizeMotionTransition,\n} from './widget-host-transition-config'\n\n/** Header slot that only exists on some sizes (e.g. profile small). */\nexport function WidgetHostOptionalHeader({\n children,\n visible,\n}: {\n children: ReactNode\n visible: boolean\n}) {\n const reduceMotion = useReducedMotion()\n const prefersReducedMotion = shouldReduceWidgetHostMotion(reduceMotion)\n\n return (\n <AnimatePresence initial={false}>\n {visible ? (\n <motion.div\n animate={\n prefersReducedMotion ? { height: 'auto', opacity: 1 } : { height: 'auto', opacity: 1 }\n }\n className=\"a63-WidgetHostOptionalHeader\"\n data-slot=\"widget-host-optional-header\"\n exit={prefersReducedMotion ? { height: 0, opacity: 0 } : { height: 0, opacity: 0 }}\n initial={\n prefersReducedMotion ? { height: 'auto', opacity: 1 } : { height: 0, opacity: 0 }\n }\n key=\"widget-host-optional-header\"\n transition={prefersReducedMotion ? { duration: 0 } : widgetHostSizeMotionTransition}\n >\n {children}\n </motion.div>\n ) : null}\n </AnimatePresence>\n )\n}\n","import { AnimatePresence, motion, useReducedMotion } from 'motion/react'\nimport type { ReactNode } from 'react'\nimport { cn } from '../utils'\nimport {\n getWidgetHostCrossfadeMotion,\n getWidgetHostSlideFadeMotion,\n shouldReduceWidgetHostMotion,\n widgetHostSizeMotionTransition,\n} from './widget-host-transition-config'\n\nexport type WidgetHostTitleMotion = 'crossfade' | 'slide'\n\n/** Crossfade title or header-end chrome while the header row stays mounted. */\nexport function WidgetHostTitleTransition({\n children,\n className,\n contentKey,\n variant = 'crossfade',\n}: {\n children: ReactNode\n className?: string\n contentKey: string\n variant?: WidgetHostTitleMotion\n}) {\n const reduceMotion = useReducedMotion()\n const prefersReducedMotion = shouldReduceWidgetHostMotion(reduceMotion)\n const slide = variant === 'slide'\n const phaseMotion = slide ? getWidgetHostSlideFadeMotion : getWidgetHostCrossfadeMotion\n\n return (\n <div\n // Crossfade keeps both layers in-flow on one grid cell (max height).\n // Slide never lets animated layers size the shell — parent height only.\n className={cn('a63-WidgetHostTitleTransition', className)}\n data-slot=\"widget-host-title-transition\"\n data-variant={variant}\n >\n <AnimatePresence initial={false} mode=\"sync\">\n <motion.div\n animate={phaseMotion('active', reduceMotion)}\n // Slide layers pin to the reserved box so enter/exit cannot grow it.\n className=\"a63-WidgetHostTitleTransition-layer\"\n exit={phaseMotion('exit', reduceMotion)}\n initial={phaseMotion('enter', reduceMotion)}\n key={contentKey}\n layout={false}\n style={{\n willChange: prefersReducedMotion ? undefined : slide ? 'opacity' : 'opacity, filter',\n }}\n transition={prefersReducedMotion ? { duration: 0 } : widgetHostSizeMotionTransition}\n >\n {children}\n </motion.div>\n </AnimatePresence>\n </div>\n )\n}\n","import type { ComponentProps, ReactNode } from 'react'\nimport { widgetInsetStyle } from '../layout'\nimport { WidgetBlock, WidgetBlockFooter, WidgetCard } from '../primitives'\nimport { cn } from '../utils'\nimport { WIDGET_FILL_STYLE } from './widget-fill'\nimport { WidgetHostContentTransition } from './widget-host-content-transition'\n\n/**\n * Stable widget card shell with optional header and crossfading body content.\n *\n * ⚠ **`children` must supply their own inset** when there is no `footer`. This\n * shell only wraps the body in a padded `WidgetBlock` when a `footer` is given.\n * Pass a raw `<div>` and it sits flush against the face edge — which reads as a\n * misaligned widget, not a missing wrapper, so it is easy to miss.\n *\n * Use one of:\n * - `WidgetCardContent` — footprint-aware `widgetInsetStyle(size, 'body')`\n * - `WidgetBlock` with `style={widgetInsetStyle(size, 'body')}`\n * - chrome-less faces with `style={widgetInsetStyle(size, 'face')}`\n *\n * Give that slot `flex: 1` when the composition anchors anything to the bottom\n * (`justify-content: space-between`, a pinned footer row). The slot otherwise\n * sizes to its content, leaving the children bunched at the top above dead\n * space.\n *\n * The padding is deliberately NOT unconditional: widgets that pad themselves\n * would double up.\n *\n * The shell fills its host box. A `style` passed here lands on the surface's\n * outer shell, after that fill.\n */\nexport function WidgetHostedShell({\n children,\n className,\n contentClassName,\n contentKey,\n contentSlotClassName,\n footer,\n header,\n size,\n style,\n ...cardProps\n}: {\n children: ReactNode\n className?: string\n contentClassName?: string\n contentKey: string\n contentSlotClassName?: string\n /** Pinned below the crossfading body inside the same block gap rhythm. */\n footer?: ReactNode\n header?: ReactNode\n} & Omit<ComponentProps<typeof WidgetCard>, 'children'>) {\n const transition = (\n <WidgetHostContentTransition\n className={contentSlotClassName}\n contentClassName={contentClassName}\n contentKey={contentKey}\n >\n {children}\n </WidgetHostContentTransition>\n )\n\n return (\n // A widget with a header reads as two anchored bands — title at the top,\n // content settling against the bottom — so the slack lands BETWEEN them\n // rather than under the content. A consumer `justify-*` utility in\n // `className` still wins, for the widgets that ask for something else.\n <WidgetCard\n className={cn(header && 'a63-WidgetHostedShell-anchored', className)}\n size={size}\n style={{ ...WIDGET_FILL_STYLE, ...style }}\n {...cardProps}\n >\n {header}\n {footer ? (\n <WidgetBlock style={widgetInsetStyle(size, header ? 'body' : 'face')}>\n {transition}\n <WidgetBlockFooter>{footer}</WidgetBlockFooter>\n </WidgetBlock>\n ) : (\n transition\n )}\n </WidgetCard>\n )\n}\n"]}
1
+ {"version":3,"sources":["../../src/runtime/widget-content-fallback.tsx","../../src/runtime/widget-host-transition-config.ts","../../src/runtime/widget-host-content-transition.tsx","../../src/runtime/widget-fill.ts","../../src/runtime/widget-host-error-fallback.tsx","../../src/runtime/widget-host-loading-shell.tsx","../../src/runtime/widget-host-optional-header.tsx","../../src/runtime/widget-host-title-transition.tsx","../../src/runtime/widget-hosted-shell.tsx"],"names":["jsx","useReducedMotion","AnimatePresence","motion","jsxs"],"mappings":";;;;;;;;;AAGO,SAAS,qBAAA,GAAwB;AACtC,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,MAAA;AAAA,MACV,SAAA,EAAU,2BAAA;AAAA,MACV,WAAA,EAAU,yBAAA;AAAA,MAEV,QAAA,kBAAA,GAAA,CAAC,YAAA,EAAA,EAAa,aAAA,EAAW,IAAA,EAAC,WAAU,gDAAA,EAAiD;AAAA;AAAA,GACvF;AAEJ;;;ACZO,IAAM,oCAAA,G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EAAU,GAAE,GAAI,8BAAA;AAAA,UAEpD;AAAA,SAAA;AAAA,QAPI;AAAA,OAQP,EACF;AAAA;AAAA,GACF;AAEJ;ACzBO,SAAS,iBAAA,CAAkB;AAAA,EAChC,QAAA;AAAA,EACA,SAAA;AAAA,EACA,gBAAA;AAAA,EACA,UAAA;AAAA,EACA,oBAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAG;AACL,CAAA,EASyD;AACvD,EAAA,MAAM,6BACJH,GAAAA;AAAA,IAAC,2BAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,oBAAA;AAAA,MACX,gBAAA;AAAA,MACA,UAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAGF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKEI,IAAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,EAAA,CAAG,MAAA,IAAU,gCAAA,EAAkC,SAAS,CAAA;AAAA,QACnE,IAAA;AAAA,QACA,KAAA,EAAO,EAAE,GAAG,iBAAA,EAAmB,GAAG,KAAA,EAAM;AAAA,QACvC,GAAG,SAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAA,MAAA;AAAA,UACA,MAAA,mBACCA,IAAAA,CAAC,WAAA,EAAA,EAAY,KAAA,EAAO,iBAAiB,IAAA,EAAM,MAAA,GAAS,MAAA,GAAS,MAAM,CAAA,EAChE,QAAA,EAAA;AAAA,YAAA,UAAA;AAAA,4BACDJ,GAAAA,CAAC,iBAAA,EAAA,EAAmB,QAAA,EAAA,MAAA,EAAO;AAAA,WAAA,EAC7B,CAAA,GAEA;AAAA;AAAA;AAAA;AAEJ;AAEJ","file":"index.js","sourcesContent":["import { LoaderCircle } from 'lucide-react'\n\n/** Shared centered spinner for widget content loading (module defer + data fetch). */\nexport function WidgetContentFallback() {\n return (\n <output\n aria-busy=\"true\"\n className=\"a63-WidgetContentFallback\"\n data-slot=\"widget-content-fallback\"\n >\n <LoaderCircle aria-hidden className=\"a63-WidgetContentFallback-icon a63-Widget-spin\" />\n </output>\n )\n}\n","/** Shell + content size transition duration (seconds) for widget resize + crossfade. */\nexport const WIDGET_HOST_SIZE_TRANSITION_DURATION = 0.32\n\nexport const WIDGET_HOST_SIZE_TRANSITION_EASE = [0.5, 0, 0, 1] as const\n\n/** Blur amount for hosted content/title crossfades — masks reflow during shell resize. */\nexport const WIDGET_HOST_CROSSFADE_BLUR = '6px'\n\n/** Shared motion transition for desktop shell resize and inner content crossfade. */\nexport const widgetHostSizeMotionTransition = {\n duration: WIDGET_HOST_SIZE_TRANSITION_DURATION,\n ease: WIDGET_HOST_SIZE_TRANSITION_EASE,\n} as const\n\ntype WidgetHostMotionPhase = 'active' | 'enter' | 'exit'\n\n/** Motion returns null when no reduced-motion preference is set — treat that as animated. */\nexport function shouldReduceWidgetHostMotion(reduceMotion: boolean | null): boolean {\n return reduceMotion === true\n}\n\n/**\n * Opacity + blur crossfade for inner widget content and title chrome.\n * Blur is applied on clipped inner layers only — not the widget card shell —\n * so themed backdrop-filter on the shell stays intact.\n *\n * The resting state is `none`, not `blur(0px)`. Any filter value other than\n * `none` establishes a backdrop root, which neutralises `backdrop-filter` on\n * everything below it — so a resting `blur(0px)` silently disables the blur\n * ramp inside widgets that put text over photography. `none` costs nothing at\n * rest and the animated phases still carry the blur.\n */\nexport function getWidgetHostCrossfadeMotion(\n phase: WidgetHostMotionPhase,\n reduceMotion: boolean | null\n) {\n if (shouldReduceWidgetHostMotion(reduceMotion)) {\n return { filter: 'none', opacity: 1 }\n }\n\n if (phase === 'active') {\n return { filter: 'none', opacity: 1 }\n }\n\n return { filter: `blur(${WIDGET_HOST_CROSSFADE_BLUR})`, opacity: 0 }\n}\n\n/**\n * Opacity-only swap for copy inside a locked height box (film title/year).\n * No blur (glyph bounds) and no translate — even a small `y` shifts the\n * visual mass of the line and reads as the text plate changing height.\n */\nexport function getWidgetHostSlideFadeMotion(\n phase: WidgetHostMotionPhase,\n reduceMotion: boolean | null\n) {\n if (shouldReduceWidgetHostMotion(reduceMotion) || phase === 'active') {\n return { opacity: 1 }\n }\n\n return { opacity: 0 }\n}\n","import { AnimatePresence, motion, useReducedMotion } from 'motion/react'\nimport { type ReactNode, useLayoutEffect, useRef } from 'react'\nimport { cn } from '../utils'\nimport {\n getWidgetHostCrossfadeMotion,\n shouldReduceWidgetHostMotion,\n widgetHostSizeMotionTransition,\n} from './widget-host-transition-config'\n\n/**\n * Crossfade inner widget content while the outer card shell stays mounted.\n *\n * Each layer grows from its top-start corner. `originClassName` adds a class\n * to the layer to change that (a consumer utility such as `origin-center`\n * outranks the stylesheet's default).\n */\nexport function WidgetHostContentTransition({\n children,\n className,\n contentClassName,\n contentKey,\n originClassName,\n}: {\n children: ReactNode\n className?: string\n contentClassName?: string\n contentKey: string\n originClassName?: string\n}) {\n const reduceMotion = useReducedMotion()\n const slotRef = useRef<HTMLDivElement>(null)\n const frozenExitWidthRef = useRef<number | null>(null)\n\n // contentKey is an intentional re-measure trigger — it freezes the outgoing slot width right before the content swaps, even though the effect body doesn't read it.\n useLayoutEffect(() => {\n frozenExitWidthRef.current = slotRef.current?.offsetWidth ?? null\n }, [contentKey])\n\n const prefersReducedMotion = shouldReduceWidgetHostMotion(reduceMotion)\n const frozenExitWidth = frozenExitWidthRef.current\n\n return (\n <div\n className={cn('a63-WidgetHostContentTransition', className)}\n data-slot=\"widget-host-content-transition\"\n ref={slotRef}\n >\n <AnimatePresence initial={false} mode=\"sync\">\n <motion.div\n animate={{\n ...getWidgetHostCrossfadeMotion('active', reduceMotion),\n width: '100%',\n }}\n className={cn('a63-WidgetHostContentTransition-layer', originClassName, contentClassName)}\n exit={{\n ...getWidgetHostCrossfadeMotion('exit', reduceMotion),\n width: frozenExitWidth ?? '100%',\n }}\n initial={{\n ...getWidgetHostCrossfadeMotion('enter', reduceMotion),\n width: '100%',\n }}\n key={contentKey}\n style={{\n willChange: prefersReducedMotion ? undefined : 'opacity, filter',\n }}\n transition={prefersReducedMotion ? { duration: 0 } : widgetHostSizeMotionTransition}\n >\n {children}\n </motion.div>\n </AnimatePresence>\n </div>\n )\n}\n","import type { CSSProperties } from 'react'\n\n/**\n * Fills the host box. Passed as `style`, which lands on the surface's outer\n * shell: the runtime shells size the widget itself, not its face.\n */\nexport const WIDGET_FILL_STYLE: CSSProperties = { blockSize: '100%', inlineSize: '100%' }\n","import { Button } from '@atom63/ui-react'\nimport { AlertCircle, RefreshCw } from 'lucide-react'\nimport { widgetTypeStyle } from '../layout'\nimport { DEFAULT_WIDGET_ERROR_LABELS } from '../state/types'\nimport { WidgetCard, WidgetCardContent, WidgetCardHeader, WidgetCardTitle } from '../primitives'\nimport type { WidgetSize } from '../types'\nimport { WIDGET_FILL_STYLE } from './widget-fill'\n\n/** Widget card shell for runtime error boundaries (lazy load, render crash). */\nexport function WidgetHostErrorFallback({\n message,\n onRetry,\n retryLabel = DEFAULT_WIDGET_ERROR_LABELS.retry,\n size,\n title = 'Widget failed to load',\n}: {\n message?: string\n onRetry?: () => void\n /** The retry button's text. Defaults to the widget error state's \"Try again\". */\n retryLabel?: string\n size: WidgetSize\n title?: string\n}) {\n return (\n <div className=\"a63-WidgetHostFallback\" data-slot=\"widget-host-error-fallback\">\n <WidgetCard size={size} style={WIDGET_FILL_STYLE}>\n <WidgetCardHeader>\n <WidgetCardTitle\n icon={<AlertCircle aria-hidden className=\"a63-WidgetHostErrorFallback-icon\" />}\n >\n {title}\n </WidgetCardTitle>\n </WidgetCardHeader>\n <WidgetCardContent className=\"a63-WidgetHostErrorFallback-content\">\n {message ? (\n <p\n className=\"a63-WidgetHostErrorFallback-message\"\n style={widgetTypeStyle('body', size)}\n >\n {message}\n </p>\n ) : null}\n {onRetry ? (\n <Button onClick={onRetry} size=\"sm\" type=\"button\" variant=\"ghost\">\n <RefreshCw aria-hidden />\n {retryLabel}\n </Button>\n ) : null}\n </WidgetCardContent>\n </WidgetCard>\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { WidgetCard, WidgetCardContent } from '../primitives'\nimport type { WidgetSize } from '../types'\nimport { WidgetContentFallback } from './widget-content-fallback'\nimport { WIDGET_FILL_STYLE } from './widget-fill'\n\n/**\n * Card shell with a centered spinner only — no title (avoids header flash on\n * resolve). Takes the footprint it is standing in for, so the chrome it paints\n * while loading matches the chrome the widget paints once resolved.\n */\nexport function WidgetHostLoadingShell({\n content,\n size,\n}: {\n content?: ReactNode\n size: WidgetSize\n}) {\n return (\n <div className=\"a63-WidgetHostFallback\" data-slot=\"widget-host-loading-shell\">\n <WidgetCard size={size} style={WIDGET_FILL_STYLE}>\n <WidgetCardContent className=\"a63-WidgetHostLoadingShell-content\">\n {content ?? <WidgetContentFallback />}\n </WidgetCardContent>\n </WidgetCard>\n </div>\n )\n}\n","import { AnimatePresence, motion, useReducedMotion } from 'motion/react'\nimport type { ReactNode } from 'react'\nimport {\n shouldReduceWidgetHostMotion,\n widgetHostSizeMotionTransition,\n} from './widget-host-transition-config'\n\n/** Header slot that only exists on some sizes (e.g. profile small). */\nexport function WidgetHostOptionalHeader({\n children,\n visible,\n}: {\n children: ReactNode\n visible: boolean\n}) {\n const reduceMotion = useReducedMotion()\n const prefersReducedMotion = shouldReduceWidgetHostMotion(reduceMotion)\n\n return (\n <AnimatePresence initial={false}>\n {visible ? (\n <motion.div\n animate={\n prefersReducedMotion ? { height: 'auto', opacity: 1 } : { height: 'auto', opacity: 1 }\n }\n className=\"a63-WidgetHostOptionalHeader\"\n data-slot=\"widget-host-optional-header\"\n exit={prefersReducedMotion ? { height: 0, opacity: 0 } : { height: 0, opacity: 0 }}\n initial={\n prefersReducedMotion ? { height: 'auto', opacity: 1 } : { height: 0, opacity: 0 }\n }\n key=\"widget-host-optional-header\"\n transition={prefersReducedMotion ? { duration: 0 } : widgetHostSizeMotionTransition}\n >\n {children}\n </motion.div>\n ) : null}\n </AnimatePresence>\n )\n}\n","import { AnimatePresence, motion, useReducedMotion } from 'motion/react'\nimport type { ReactNode } from 'react'\nimport { cn } from '../utils'\nimport {\n getWidgetHostCrossfadeMotion,\n getWidgetHostSlideFadeMotion,\n shouldReduceWidgetHostMotion,\n widgetHostSizeMotionTransition,\n} from './widget-host-transition-config'\n\nexport type WidgetHostTitleMotion = 'crossfade' | 'slide'\n\n/** Crossfade title or header-end chrome while the header row stays mounted. */\nexport function WidgetHostTitleTransition({\n children,\n className,\n contentKey,\n variant = 'crossfade',\n}: {\n children: ReactNode\n className?: string\n contentKey: string\n variant?: WidgetHostTitleMotion\n}) {\n const reduceMotion = useReducedMotion()\n const prefersReducedMotion = shouldReduceWidgetHostMotion(reduceMotion)\n const slide = variant === 'slide'\n const phaseMotion = slide ? getWidgetHostSlideFadeMotion : getWidgetHostCrossfadeMotion\n\n return (\n <div\n // Crossfade keeps both layers in-flow on one grid cell (max height).\n // Slide never lets animated layers size the shell — parent height only.\n className={cn('a63-WidgetHostTitleTransition', className)}\n data-slot=\"widget-host-title-transition\"\n data-variant={variant}\n >\n <AnimatePresence initial={false} mode=\"sync\">\n <motion.div\n animate={phaseMotion('active', reduceMotion)}\n // Slide layers pin to the reserved box so enter/exit cannot grow it.\n className=\"a63-WidgetHostTitleTransition-layer\"\n exit={phaseMotion('exit', reduceMotion)}\n initial={phaseMotion('enter', reduceMotion)}\n key={contentKey}\n layout={false}\n style={{\n willChange: prefersReducedMotion ? undefined : slide ? 'opacity' : 'opacity, filter',\n }}\n transition={prefersReducedMotion ? { duration: 0 } : widgetHostSizeMotionTransition}\n >\n {children}\n </motion.div>\n </AnimatePresence>\n </div>\n )\n}\n","import type { ComponentProps, ReactNode } from 'react'\nimport { widgetInsetStyle } from '../layout'\nimport { WidgetBlock, WidgetBlockFooter, WidgetCard } from '../primitives'\nimport { cn } from '../utils'\nimport { WIDGET_FILL_STYLE } from './widget-fill'\nimport { WidgetHostContentTransition } from './widget-host-content-transition'\n\n/**\n * Stable widget card shell with optional header and crossfading body content.\n *\n * ⚠ **`children` must supply their own inset** when there is no `footer`. This\n * shell only wraps the body in a padded `WidgetBlock` when a `footer` is given.\n * Pass a raw `<div>` and it sits flush against the face edge — which reads as a\n * misaligned widget, not a missing wrapper, so it is easy to miss.\n *\n * Use one of:\n * - `WidgetCardContent` — footprint-aware `widgetInsetStyle(size, 'body')`\n * - `WidgetBlock` with `style={widgetInsetStyle(size, 'body')}`\n * - chrome-less faces with `style={widgetInsetStyle(size, 'face')}`\n *\n * Give that slot `flex: 1` when the composition anchors anything to the bottom\n * (`justify-content: space-between`, a pinned footer row). The slot otherwise\n * sizes to its content, leaving the children bunched at the top above dead\n * space.\n *\n * The padding is deliberately NOT unconditional: widgets that pad themselves\n * would double up.\n *\n * The shell fills its host box. A `style` passed here lands on the surface's\n * outer shell, after that fill.\n */\nexport function WidgetHostedShell({\n children,\n className,\n contentClassName,\n contentKey,\n contentSlotClassName,\n footer,\n header,\n size,\n style,\n ...cardProps\n}: {\n children: ReactNode\n className?: string\n contentClassName?: string\n contentKey: string\n contentSlotClassName?: string\n /** Pinned below the crossfading body inside the same block gap rhythm. */\n footer?: ReactNode\n header?: ReactNode\n} & Omit<ComponentProps<typeof WidgetCard>, 'children'>) {\n const transition = (\n <WidgetHostContentTransition\n className={contentSlotClassName}\n contentClassName={contentClassName}\n contentKey={contentKey}\n >\n {children}\n </WidgetHostContentTransition>\n )\n\n return (\n // A widget with a header reads as two anchored bands — title at the top,\n // content settling against the bottom — so the slack lands BETWEEN them\n // rather than under the content. A consumer `justify-*` utility in\n // `className` still wins, for the widgets that ask for something else.\n <WidgetCard\n className={cn(header && 'a63-WidgetHostedShell-anchored', className)}\n size={size}\n style={{ ...WIDGET_FILL_STYLE, ...style }}\n {...cardProps}\n >\n {header}\n {footer ? (\n <WidgetBlock style={widgetInsetStyle(size, header ? 'body' : 'face')}>\n {transition}\n <WidgetBlockFooter>{footer}</WidgetBlockFooter>\n </WidgetBlock>\n ) : (\n transition\n )}\n </WidgetCard>\n )\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { W as WidgetSize } from '../types-C0zDKyo1.js';
2
+ import { WidgetSize } from '../index.js';
3
3
 
4
4
  /** Title and optional description for one feedback state. */
5
5
  interface WidgetFeedbackCopy {
@@ -7,6 +7,23 @@ interface WidgetFeedbackCopy {
7
7
  description?: string;
8
8
  }
9
9
  type WidgetFeedbackState = 'loading' | 'error' | 'empty';
10
+ /**
11
+ * The fixed strings of the error state's controls, so a host can translate
12
+ * them. Any field left out keeps its English default.
13
+ */
14
+ interface WidgetErrorLabels {
15
+ /** The retry button. Default "Try again". */
16
+ retry: string;
17
+ /** Accessible name of the icon-only button that opens the details. Default "View error details". */
18
+ viewDetails: string;
19
+ /** Title of the details popover, also the copy button's label. Default "Error details". */
20
+ detailsTitle: string;
21
+ /** Description under the details title. */
22
+ detailsDescription: string;
23
+ /** Text of the copy button. Default "Copy details". */
24
+ copyDetails: string;
25
+ }
26
+ declare const DEFAULT_WIDGET_ERROR_LABELS: WidgetErrorLabels;
10
27
  /**
11
28
  * The shared async-state contract for widget views.
12
29
  *
@@ -63,6 +80,11 @@ declare function widgetStateCopy(titles: Record<WidgetFeedbackState, string>): (
63
80
  interface WidgetStateFeedbackProps {
64
81
  className?: string;
65
82
  copy: WidgetFeedbackCopy;
83
+ /**
84
+ * The error state's control strings, for translation. Fields left out keep
85
+ * their English defaults (`DEFAULT_WIDGET_ERROR_LABELS`).
86
+ */
87
+ labels?: Partial<WidgetErrorLabels>;
66
88
  onRetry?: () => void;
67
89
  /** Falls back to the nearest WidgetSurface size when omitted. */
68
90
  size?: WidgetSize;
@@ -87,4 +109,5 @@ interface WidgetStateFeedbackProps {
87
109
  */
88
110
  declare const WidgetStateFeedback: React.NamedExoticComponent<WidgetStateFeedbackProps>;
89
111
 
90
- export { type WidgetFeedbackCopy, type WidgetFeedbackState, type WidgetStateCopy, WidgetStateFeedback, type WidgetStateFeedbackProps, type WidgetStateProps, getWidgetErrorDescription, resolveWidgetFeedbackState, widgetStateCopy };
112
+ export { DEFAULT_WIDGET_ERROR_LABELS, WidgetStateFeedback, getWidgetErrorDescription, resolveWidgetFeedbackState, widgetStateCopy };
113
+ export type { WidgetErrorLabels, WidgetFeedbackCopy, WidgetFeedbackState, WidgetStateCopy, WidgetStateFeedbackProps, WidgetStateProps };
@@ -1,44 +1,20 @@
1
- import { useWidgetSurfaceSize } from '../chunk-US2CE3BV.js';
2
- import { cn, widgetTypeStyle } from '../chunk-F5NV6XJ5.js';
1
+ import { DEFAULT_WIDGET_ERROR_LABELS } from '../chunk-TCQFVY3S.js';
2
+ export { DEFAULT_WIDGET_ERROR_LABELS, getWidgetErrorDescription, resolveWidgetFeedbackState, widgetStateCopy } from '../chunk-TCQFVY3S.js';
3
+ import { useWidgetSurfaceSize } from '../chunk-3ND4LGYB.js';
4
+ import { cn, widgetTypeStyle } from '../chunk-QCNNU4OV.js';
3
5
  import { Button, Popover, PopoverTrigger, PopoverContent, PopoverTitle, PopoverDescription, CopyButton } from '@atom63/ui-react';
4
6
  import { LoaderCircle, AlertTriangle, Inbox, RefreshCw, Ellipsis } from 'lucide-react';
5
7
  import { memo } from 'react';
6
8
  import { jsxs, jsx } from 'react/jsx-runtime';
7
9
 
8
- // src/state/types.ts
9
- function resolveWidgetFeedbackState({
10
- error,
11
- isEmpty,
12
- isLoading
13
- }) {
14
- if (error) {
15
- return "error";
16
- }
17
- if (isLoading) {
18
- return "loading";
19
- }
20
- if (isEmpty) {
21
- return "empty";
22
- }
23
- return null;
24
- }
25
- function getWidgetErrorDescription(error) {
26
- return error instanceof Error ? error.message : void 0;
27
- }
28
- function widgetStateCopy(titles) {
29
- return (state, error) => ({
30
- description: state === "error" ? getWidgetErrorDescription(error) : void 0,
31
- title: titles[state]
32
- });
33
- }
34
10
  var STATE_ICON = {
35
11
  empty: Inbox,
36
12
  error: AlertTriangle,
37
13
  loading: LoaderCircle
38
14
  };
39
- var RETRY_LABEL = "Try again";
40
15
  function WidgetErrorActions({
41
16
  description,
17
+ labels,
42
18
  onRetry
43
19
  }) {
44
20
  if (!description && !onRetry) {
@@ -60,7 +36,7 @@ function WidgetErrorActions({
60
36
  variant: "outline",
61
37
  children: [
62
38
  /* @__PURE__ */ jsx(RefreshCw, { "aria-hidden": true, className: "a63-WidgetStateFeedback-retryIcon" }),
63
- RETRY_LABEL
39
+ labels.retry
64
40
  ]
65
41
  }
66
42
  ) : null,
@@ -71,7 +47,7 @@ function WidgetErrorActions({
71
47
  render: /* @__PURE__ */ jsx(
72
48
  Button,
73
49
  {
74
- "aria-label": "View error details",
50
+ "aria-label": labels.viewDetails,
75
51
  className: "a63-WidgetStateFeedback-action",
76
52
  size: "icon-sm",
77
53
  type: "button",
@@ -90,11 +66,11 @@ function WidgetErrorActions({
90
66
  sideOffset: 8,
91
67
  children: [
92
68
  /* @__PURE__ */ jsxs("div", { className: "a63-WidgetErrorDetails-header", children: [
93
- /* @__PURE__ */ jsx(PopoverTitle, { children: "Error details" }),
94
- /* @__PURE__ */ jsx(PopoverDescription, { children: "Technical information you can copy when reporting this problem." })
69
+ /* @__PURE__ */ jsx(PopoverTitle, { children: labels.detailsTitle }),
70
+ /* @__PURE__ */ jsx(PopoverDescription, { children: labels.detailsDescription })
95
71
  ] }),
96
72
  /* @__PURE__ */ jsx("p", { className: "a63-WidgetErrorDetails-message", children: description }),
97
- /* @__PURE__ */ jsx(CopyButton, { label: "Error details", size: "sm", value: description, variant: "outline", children: "Copy details" })
73
+ /* @__PURE__ */ jsx(CopyButton, { label: labels.detailsTitle, size: "sm", value: description, variant: "outline", children: labels.copyDetails })
98
74
  ]
99
75
  }
100
76
  )
@@ -104,7 +80,7 @@ function WidgetErrorActions({
104
80
  );
105
81
  }
106
82
  var WidgetStateFeedback = memo(
107
- ({ className, copy, onRetry, size, state }) => {
83
+ ({ className, copy, labels, onRetry, size, state }) => {
108
84
  const surfaceSize = useWidgetSurfaceSize();
109
85
  const resolvedSize = size ?? surfaceSize ?? "small";
110
86
  const density = resolvedSize === "large" ? "large" : "compact";
@@ -145,7 +121,14 @@ var WidgetStateFeedback = memo(
145
121
  }
146
122
  ) : null
147
123
  ] }),
148
- state === "error" ? /* @__PURE__ */ jsx(WidgetErrorActions, { description: copy.description, onRetry }) : null
124
+ state === "error" ? /* @__PURE__ */ jsx(
125
+ WidgetErrorActions,
126
+ {
127
+ description: copy.description,
128
+ labels: { ...DEFAULT_WIDGET_ERROR_LABELS, ...labels },
129
+ onRetry
130
+ }
131
+ ) : null
149
132
  ]
150
133
  }
151
134
  );
@@ -153,6 +136,6 @@ var WidgetStateFeedback = memo(
153
136
  );
154
137
  WidgetStateFeedback.displayName = "WidgetStateFeedback";
155
138
 
156
- export { WidgetStateFeedback, getWidgetErrorDescription, resolveWidgetFeedbackState, widgetStateCopy };
139
+ export { WidgetStateFeedback };
157
140
  //# sourceMappingURL=index.js.map
158
141
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/state/types.ts","../../src/state/widget-state-feedback.tsx"],"names":[],"mappings":";;;;;;;;AAqCO,SAAS,0BAAA,CAA2B;AAAA,EACzC,KAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAA,EAI+B;AAC7B,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,OAAO,OAAA;AAAA,EACT;AACA,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,OAAO,SAAA;AAAA,EACT;AACA,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,OAAO,OAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAA;AACT;AAGO,SAAS,0BAA0B,KAAA,EAAoC;AAC5E,EAAA,OAAO,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,MAAA;AAClD;AAmBO,SAAS,gBACd,MAAA,EACqE;AACrE,EAAA,OAAO,CAAC,OAAO,KAAA,MAAW;AAAA,IACxB,WAAA,EAAa,KAAA,KAAU,OAAA,GAAU,yBAAA,CAA0B,KAAK,CAAA,GAAI,MAAA;AAAA,IACpE,KAAA,EA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Aa,SAAkB,CAAA,GACnE;AAAA;AAAA;AAAA,KACN;AAAA,EAEJ;AACF;AAEA,mBAAA,CAAoB,WAAA,GAAc,qBAAA","file":"index.js","sourcesContent":["/** Title and optional description for one feedback state. */\nexport interface WidgetFeedbackCopy {\n title: string\n description?: string\n}\n\nexport type WidgetFeedbackState = 'loading' | 'error' | 'empty'\n\n/**\n * The shared async-state contract for widget views.\n *\n * Top-level props on purpose: `listening` and `profile` used to carry these\n * inside their `data` object while every other widget took them as props, so a\n * host had to remember which shape a given widget wanted. One shape, one place.\n */\nexport interface WidgetStateProps {\n /** Truthy renders the error state. Accepts `unknown` so hosts can pass a query error straight through. */\n error?: unknown\n isLoading?: boolean\n /** Background refresh — content stays mounted, controls show activity. */\n isRefreshing?: boolean\n onRetry?: () => void\n}\n\n/** Per-widget wording for the shared feedback surface. */\nexport interface WidgetStateCopy {\n empty?: WidgetFeedbackCopy\n error?: WidgetFeedbackCopy\n loading?: WidgetFeedbackCopy\n}\n\n/**\n * Resolve which feedback state a view should render, if any.\n *\n * `error` wins over `isLoading`: a failed refresh must not sit behind a spinner\n * forever. `isEmpty` is only consulted once the data settles.\n */\nexport function resolveWidgetFeedbackState({\n error,\n isEmpty,\n isLoading,\n}: {\n error?: unknown\n isEmpty?: boolean\n isLoading?: boolean\n}): WidgetFeedbackState | null {\n if (error) {\n return 'error'\n }\n if (isLoading) {\n return 'loading'\n }\n if (isEmpty) {\n return 'empty'\n }\n return null\n}\n\n/** Error message text, when the host passed a real Error. */\nexport function getWidgetErrorDescription(error: unknown): string | undefined {\n return error instanceof Error ? error.message : undefined\n}\n\n/**\n * Build a widget's feedback copy from its three state titles.\n *\n * Every widget needs the same thing: a title per state, plus the error's own\n * message on the error state. Six widgets hand-rolled that in two different\n * shapes — a map of thunks in some, an object plus a `feedbackState === 'error'`\n * ternary at the call site in others. This is the one shape.\n *\n * @example\n * const WEATHER_STATE_COPY = widgetStateCopy({\n * empty: 'No weather data yet',\n * error: 'Unable to load weather',\n * loading: 'Loading weather',\n * })\n *\n * <WidgetStateFeedback copy={WEATHER_STATE_COPY(feedbackState, error)} … />\n */\nexport function widgetStateCopy(\n titles: Record<WidgetFeedbackState, string>\n): (state: WidgetFeedbackState, error?: unknown) => WidgetFeedbackCopy {\n return (state, error) => ({\n description: state === 'error' ? getWidgetErrorDescription(error) : undefined,\n title: titles[state],\n })\n}\n","import {\n Button,\n CopyButton,\n Popover,\n PopoverContent,\n PopoverDescription,\n PopoverTitle,\n PopoverTrigger,\n} from '@atom63/ui-react'\nimport { AlertTriangle, Ellipsis, Inbox, LoaderCircle, RefreshCw } from 'lucide-react'\nimport { memo } from 'react'\nimport { widgetTypeStyle } from '../layout'\nimport { useWidgetSurfaceSize } from '../primitives'\nimport type { WidgetSize } from '../types'\nimport { cn } from '../utils'\nimport type { WidgetFeedbackCopy, WidgetFeedbackState } from './types'\n\nconst STATE_ICON = {\n empty: Inbox,\n error: AlertTriangle,\n loading: LoaderCircle,\n} as const\n\nconst RETRY_LABEL = 'Try again'\n\nfunction WidgetErrorActions({\n description,\n onRetry,\n}: {\n description?: string\n onRetry?: () => void\n}) {\n if (!description && !onRetry) {\n return null\n }\n\n return (\n <div\n // The row gap is `--a63-space-2`, which follows the density axis like the\n // a63 controls in it, so the row keeps its proportion under compact\n // density instead of the controls shrinking around a fixed gap.\n className=\"a63-WidgetStateFeedback-actions\"\n data-slot=\"widget-state-actions\"\n >\n {onRetry ? (\n <Button\n className=\"a63-WidgetStateFeedback-action\"\n onClick={onRetry}\n size=\"sm\"\n type=\"button\"\n variant=\"outline\"\n >\n <RefreshCw aria-hidden className=\"a63-WidgetStateFeedback-retryIcon\" />\n {RETRY_LABEL}\n </Button>\n ) : null}\n {description ? (\n <Popover>\n <PopoverTrigger\n render={\n <Button\n aria-label=\"View error details\"\n className=\"a63-WidgetStateFeedback-action\"\n size=\"icon-sm\"\n type=\"button\"\n variant=\"outline\"\n >\n <Ellipsis aria-hidden className=\"a63-WidgetStateFeedback-detailsIcon\" />\n </Button>\n }\n />\n <PopoverContent\n align=\"center\"\n className=\"a63-WidgetErrorDetails\"\n side=\"top\"\n sideOffset={8}\n >\n <div className=\"a63-WidgetErrorDetails-header\">\n <PopoverTitle>Error details</PopoverTitle>\n <PopoverDescription>\n Technical information you can copy when reporting this problem.\n </PopoverDescription>\n </div>\n {/* Fixed type, not the widget ramp, on purpose: this sits inside a\n portalled Popover, which renders at document level where\n `--widget-u` is not inherited. */}\n <p className=\"a63-WidgetErrorDetails-message\">{description}</p>\n <CopyButton label=\"Error details\" size=\"sm\" value={description} variant=\"outline\">\n Copy details\n </CopyButton>\n </PopoverContent>\n </Popover>\n ) : null}\n </div>\n )\n}\n\nexport interface WidgetStateFeedbackProps {\n className?: string\n copy: WidgetFeedbackCopy\n onRetry?: () => void\n /** Falls back to the nearest WidgetSurface size when omitted. */\n size?: WidgetSize\n state: WidgetFeedbackState\n}\n\n/**\n * The one way a widget reports loading, error, or empty.\n *\n * Deliberately owns its own inset and draws no border or fill. A widget-wide\n * failure has no region to mark, and inheriting host padding made the same\n * state render three different ways — flush and clipped where the shell had no\n * padding, full-bleed where the shell passed none, correct only where the shell\n * happened to pad. Self-padding makes the treatment identical wherever it is\n * mounted.\n *\n * The one-row footprints (1x1 and 2x1) differ in width, not height, so they\n * share the compact density. Stepping them apart put a 28px badge beside a 32px\n * one in tiles of identical height. The 2x2 footprint gets the large density.\n *\n * On the error state the description moves into a disclosure next to the retry\n * button, so technical detail never crowds the tile.\n */\nexport const WidgetStateFeedback = memo<WidgetStateFeedbackProps>(\n ({ className, copy, onRetry, size, state }) => {\n const surfaceSize = useWidgetSurfaceSize()\n const resolvedSize = size ?? surfaceSize ?? 'small'\n const density = resolvedSize === 'large' ? 'large' : 'compact'\n const typeSize = density === 'large' ? 'large' : 'medium'\n const Icon = STATE_ICON[state]\n const description = state === 'error' ? undefined : copy.description\n\n return (\n <div\n className={cn('a63-WidgetStateFeedback', className)}\n data-density={density}\n data-slot=\"widget-state-feedback\"\n data-state={state}\n role={state === 'error' ? 'alert' : 'status'}\n >\n <div className=\"a63-WidgetStateFeedback-badge\">\n <Icon\n aria-hidden\n className={cn('a63-WidgetStateFeedback-icon', state === 'loading' && 'a63-Widget-spin')}\n />\n </div>\n <div className=\"a63-WidgetStateFeedback-text\">\n <p\n className=\"a63-WidgetStateFeedback-title\"\n style={widgetTypeStyle('body', typeSize, { weight: 500 })}\n >\n {copy.title}\n </p>\n {description ? (\n <p\n className=\"a63-WidgetStateFeedback-description\"\n style={widgetTypeStyle('body', typeSize)}\n >\n {description}\n </p>\n ) : null}\n </div>\n {state === 'error' ? (\n <WidgetErrorActions description={copy.description} onRetry={onRetry} />\n ) : null}\n </div>\n )\n }\n)\n\nWidgetStateFeedback.displayName = 'WidgetStateFeedback'\n"]}
1
+ {"version":3,"sources":["../../src/state/widget-state-feedback.tsx"],"names":[],"mappings":";;;;;;;;;AAkBA,IAAM,UAAA,GAAa;AAAA,EACjB,KAAA,EAAO,KAAA;AAAA,EACP,KAAA,EAAO,aAAA;AAAA,EACP,OAAA,EAAS;AACX,CAAA;AAEA,SAAS,kBAAA,CAAmB;AAAA,EAC1B,WAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAIG;AACD,EAAA,IAAI,CAAC,WAAA,IAAe,CAAC,OAAA,EAAS;AAC5B,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MAIC,SAAA,EAAU,iCAAA;AAAA,MACV,WAAA,EAAU,sBAAA;AAAA,MAET,QAAA,EAAA;AAAA,QAAA,OAAA,mBACC,IAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAU,gCAAA;AAAA,YACV,OAAA,EAAS,OAAA;AAAA,YACT,IAAA,EAAK,IAAA;AAAA,YACL,IAAA,EAAK,QAAA;AAAA,YACL,OAAA,EAAQ,SAAA;AAAA,YAER,QAAA,EAAA;AAAA,8BAAA,GAA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,KAAA,EAAA,EAAI,SAAA,EAAU,8BAAA,EACb,QAAA,EAAA;AAAA,4BAAA,GAAA;AAAA,cAAC,GAAA;AAAA,cAAA;AAAA,gBACC,SAAA,EAAU,+BAAA;AAAA,gBACV,OAAO,eAAA,CAAgB,MAAA,EAAQ,UAAU,EAAE,MAAA,EAAQ,KAAK,CAAA;AAAA,gBAEvD,QAAA,EAAA,IAAA,CAAK;AAAA;AAAA,aACR;AAAA,YACC,WAAA,mBACC,GAAA;AAAA,cAAC,GAAA;AAAA,cAAA;AAAA,gBACC,SAAA,EAAU,qCAAA;AAAA,gBACV,KAAA,EAAO,eAAA,CAAgB,MAAA,EAAQ,QAAQ,CAAA;AAAA,gBAEtC,QAAA,EAAA;AAAA;AAAA,aACH,GACE;AAAA,WAAA,EACN,CAAA;AAAA,UACC,UAAU,OAAA,mBACT,GAAA;AAAA,YAAC,kBAAA;AAAA,YAAA;AAAA,cACC,aAAa,IAAA,CAAK,WAAA;AAAA,cAClB,MAAA,EAAQ,EAAE,GAAG,2BAAA,EAA6B,GAAG,MAAA,EAAO;AAAA,cACpD;AAAA;AAAA,WACF,GACE;AAAA;AAAA;AAAA,KACN;AAAA,EAEJ;AACF;AAEA,mBAAA,CAAoB,WAAA,GAAc,qBAAA","file":"index.js","sourcesContent":["import {\n Button,\n CopyButton,\n Popover,\n PopoverContent,\n PopoverDescription,\n PopoverTitle,\n PopoverTrigger,\n} from '@atom63/ui-react'\nimport { AlertTriangle, Ellipsis, Inbox, LoaderCircle, RefreshCw } from 'lucide-react'\nimport { memo } from 'react'\nimport { widgetTypeStyle } from '../layout'\nimport { useWidgetSurfaceSize } from '../primitives'\nimport type { WidgetSize } from '../types'\nimport { cn } from '../utils'\nimport { DEFAULT_WIDGET_ERROR_LABELS } from './types'\nimport type { WidgetErrorLabels, WidgetFeedbackCopy, WidgetFeedbackState } from './types'\n\nconst STATE_ICON = {\n empty: Inbox,\n error: AlertTriangle,\n loading: LoaderCircle,\n} as const\n\nfunction WidgetErrorActions({\n description,\n labels,\n onRetry,\n}: {\n description?: string\n labels: WidgetErrorLabels\n onRetry?: () => void\n}) {\n if (!description && !onRetry) {\n return null\n }\n\n return (\n <div\n // The row gap is `--a63-space-2`, which follows the density axis like the\n // a63 controls in it, so the row keeps its proportion under compact\n // density instead of the controls shrinking around a fixed gap.\n className=\"a63-WidgetStateFeedback-actions\"\n data-slot=\"widget-state-actions\"\n >\n {onRetry ? (\n <Button\n className=\"a63-WidgetStateFeedback-action\"\n onClick={onRetry}\n size=\"sm\"\n type=\"button\"\n variant=\"outline\"\n >\n <RefreshCw aria-hidden className=\"a63-WidgetStateFeedback-retryIcon\" />\n {labels.retry}\n </Button>\n ) : null}\n {description ? (\n <Popover>\n <PopoverTrigger\n render={\n <Button\n aria-label={labels.viewDetails}\n className=\"a63-WidgetStateFeedback-action\"\n size=\"icon-sm\"\n type=\"button\"\n variant=\"outline\"\n >\n <Ellipsis aria-hidden className=\"a63-WidgetStateFeedback-detailsIcon\" />\n </Button>\n }\n />\n <PopoverContent\n align=\"center\"\n className=\"a63-WidgetErrorDetails\"\n side=\"top\"\n sideOffset={8}\n >\n <div className=\"a63-WidgetErrorDetails-header\">\n <PopoverTitle>{labels.detailsTitle}</PopoverTitle>\n <PopoverDescription>{labels.detailsDescription}</PopoverDescription>\n </div>\n {/* Fixed type, not the widget ramp, on purpose: this sits inside a\n portalled Popover, which renders at document level where\n `--widget-u` is not inherited. */}\n <p className=\"a63-WidgetErrorDetails-message\">{description}</p>\n <CopyButton label={labels.detailsTitle} size=\"sm\" value={description} variant=\"outline\">\n {labels.copyDetails}\n </CopyButton>\n </PopoverContent>\n </Popover>\n ) : null}\n </div>\n )\n}\n\nexport interface WidgetStateFeedbackProps {\n className?: string\n copy: WidgetFeedbackCopy\n /**\n * The error state's control strings, for translation. Fields left out keep\n * their English defaults (`DEFAULT_WIDGET_ERROR_LABELS`).\n */\n labels?: Partial<WidgetErrorLabels>\n onRetry?: () => void\n /** Falls back to the nearest WidgetSurface size when omitted. */\n size?: WidgetSize\n state: WidgetFeedbackState\n}\n\n/**\n * The one way a widget reports loading, error, or empty.\n *\n * Deliberately owns its own inset and draws no border or fill. A widget-wide\n * failure has no region to mark, and inheriting host padding made the same\n * state render three different ways — flush and clipped where the shell had no\n * padding, full-bleed where the shell passed none, correct only where the shell\n * happened to pad. Self-padding makes the treatment identical wherever it is\n * mounted.\n *\n * The one-row footprints (1x1 and 2x1) differ in width, not height, so they\n * share the compact density. Stepping them apart put a 28px badge beside a 32px\n * one in tiles of identical height. The 2x2 footprint gets the large density.\n *\n * On the error state the description moves into a disclosure next to the retry\n * button, so technical detail never crowds the tile.\n */\nexport const WidgetStateFeedback = memo<WidgetStateFeedbackProps>(\n ({ className, copy, labels, onRetry, size, state }) => {\n const surfaceSize = useWidgetSurfaceSize()\n const resolvedSize = size ?? surfaceSize ?? 'small'\n const density = resolvedSize === 'large' ? 'large' : 'compact'\n const typeSize = density === 'large' ? 'large' : 'medium'\n const Icon = STATE_ICON[state]\n const description = state === 'error' ? undefined : copy.description\n\n return (\n <div\n className={cn('a63-WidgetStateFeedback', className)}\n data-density={density}\n data-slot=\"widget-state-feedback\"\n data-state={state}\n role={state === 'error' ? 'alert' : 'status'}\n >\n <div className=\"a63-WidgetStateFeedback-badge\">\n <Icon\n aria-hidden\n className={cn('a63-WidgetStateFeedback-icon', state === 'loading' && 'a63-Widget-spin')}\n />\n </div>\n <div className=\"a63-WidgetStateFeedback-text\">\n <p\n className=\"a63-WidgetStateFeedback-title\"\n style={widgetTypeStyle('body', typeSize, { weight: 500 })}\n >\n {copy.title}\n </p>\n {description ? (\n <p\n className=\"a63-WidgetStateFeedback-description\"\n style={widgetTypeStyle('body', typeSize)}\n >\n {description}\n </p>\n ) : null}\n </div>\n {state === 'error' ? (\n <WidgetErrorActions\n description={copy.description}\n labels={{ ...DEFAULT_WIDGET_ERROR_LABELS, ...labels }}\n onRetry={onRetry}\n />\n ) : null}\n </div>\n )\n }\n)\n\nWidgetStateFeedback.displayName = 'WidgetStateFeedback'\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atom63/widgets",
3
- "version": "0.1.0-beta.3",
3
+ "version": "0.1.0-beta.5",
4
4
  "description": "The Atom63 widget foundation: widget units and scale, the widget card and surface, loading, empty and error states, and the hosted shell",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -58,8 +58,8 @@
58
58
  ],
59
59
  "dependencies": {
60
60
  "lucide-react": "^1.70.0",
61
- "motion": "^13.1.1",
62
- "@atom63/ui-react": "0.2.0-beta.12"
61
+ "motion": "^14.14.0",
62
+ "@atom63/ui-react": "0.2.0-beta.14"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "react": "^19.1.0",
@@ -76,23 +76,24 @@
76
76
  "@vitejs/plugin-react": "^6.3.0",
77
77
  "axe-core": "^4.14.0",
78
78
  "eslint": "10.14.0",
79
- "jsdom": "29.1.1",
79
+ "jsdom": "31.0.1",
80
80
  "react": "^19.3.1",
81
81
  "react-dom": "^19.3.1",
82
82
  "storybook": "^10.6.6",
83
- "tsup": "^8.3.5",
84
- "typescript": "~5.8.3",
85
- "vitest": "4.1.11",
83
+ "tsup": "^9.0.0",
84
+ "typescript": "~6.0.3",
85
+ "vitest": "5.1.1",
86
86
  "vitest-axe": "^0.1.0",
87
- "@atom63/eslint-config": "0.1.0",
88
- "@atom63/tsconfig": "0.1.0"
87
+ "playwright": "1.65.0",
88
+ "@atom63/tsconfig": "0.1.0",
89
+ "@atom63/eslint-config": "0.1.0"
89
90
  },
90
91
  "scripts": {
91
92
  "build": "tsup",
92
93
  "dev": "tsup --watch",
93
94
  "typecheck": "tsc --noEmit",
94
95
  "lint": "eslint . --cache --max-warnings 0",
95
- "test": "vitest run",
96
+ "test": "vitest run && vitest run --config vitest.cascade.config.ts",
96
97
  "test:watch": "vitest"
97
98
  }
98
99
  }
@@ -16,6 +16,40 @@
16
16
  block-size: 100%;
17
17
  }
18
18
 
19
+ /*
20
+ * Touch targets. A widget pins --a63-control-min-target to 24px so controls
21
+ * keep their proportion in the tile (widget-scale.ts). On a coarse pointer the
22
+ * hit area still reaches 44 physical px: the Button's hit-area pseudo-element
23
+ * grows to --widget-interaction-target (44px over the presentation scale, or
24
+ * 44px where a host sets no scale) without growing the control.
25
+ */
26
+ @media (pointer: coarse) {
27
+ :is(
28
+ .a63-WidgetViewport,
29
+ .a63-WidgetSurface,
30
+ .a63-WidgetCard,
31
+ .a63-WidgetStateFeedback,
32
+ .a63-WidgetHostFallback
33
+ )
34
+ .a63-Button:not([data-size='tile'])::before {
35
+ min-width: max(100%, var(--widget-interaction-target, 44px));
36
+ min-height: max(100%, var(--widget-interaction-target, 44px));
37
+ }
38
+ }
39
+
40
+ :is([data-a63-input='touch'], [data-input='touch'])
41
+ :is(
42
+ .a63-WidgetViewport,
43
+ .a63-WidgetSurface,
44
+ .a63-WidgetCard,
45
+ .a63-WidgetStateFeedback,
46
+ .a63-WidgetHostFallback
47
+ )
48
+ .a63-Button:not([data-size='tile'])::before {
49
+ min-width: max(100%, var(--widget-interaction-target, 44px));
50
+ min-height: max(100%, var(--widget-interaction-target, 44px));
51
+ }
52
+
19
53
  /* ── WidgetImage ───────────────────────────────────────────────────────── */
20
54
  .a63-WidgetImage {
21
55
  position: relative;
@@ -8,11 +8,16 @@
8
8
  --widget-avatar-dot: var(--a63-space-3_5);
9
9
  --widget-avatar-dot-inset: 6%;
10
10
  --widget-avatar-icon: calc(var(--a63-space-1) * 4.5);
11
+ --widget-avatar-ring: 2px;
12
+ /* Busy ring and outline (2px stroke + 2px offset) paint 4px outside the box. */
13
+ --widget-avatar-ring-outer: 4px;
11
14
 
12
15
  position: relative;
13
16
  flex-shrink: 0;
14
17
  inline-size: var(--widget-avatar-size);
15
18
  block-size: var(--widget-avatar-size);
19
+ /* Keep the rings inside overflow:hidden widget hosts (profile md/lg sits flush). */
20
+ margin: var(--widget-avatar-ring-outer);
16
21
  }
17
22
 
18
23
  .a63-WidgetAvatar[data-widget-avatar-size='sm'] {
@@ -36,20 +41,25 @@
36
41
  --widget-avatar-icon: var(--a63-space-6);
37
42
  }
38
43
 
39
- /* The avatar fills the root and rings itself against the page. */
40
- .a63-WidgetAvatar-avatar {
44
+ /* The face fills the token box and rings itself against the page. The
45
+ * selector is more specific than the ui-react `.a63-Avatar` default so a
46
+ * later same-layer recipes injection cannot shrink the face to 32px. */
47
+ .a63-WidgetAvatar .a63-WidgetAvatar-avatar {
41
48
  --avatar-size: 100%;
49
+ inline-size: 100%;
50
+ block-size: 100%;
42
51
 
43
52
  background-color: var(--a63-surface-muted);
44
53
  box-shadow:
45
- 0 0 0 2px var(--a63-surface-page),
54
+ 0 0 0 var(--widget-avatar-ring) var(--a63-surface-page),
46
55
  var(--shadow-sm);
47
56
  transition: outline-color var(--duration-normal) var(--ease-standard);
48
57
  }
49
58
 
50
- .a63-WidgetAvatar-avatar[data-outline] {
51
- outline: 2px solid color-mix(in oklab, var(--a63-action-primary) 70%, transparent);
52
- outline-offset: 2px;
59
+ .a63-WidgetAvatar .a63-WidgetAvatar-avatar[data-outline] {
60
+ outline: var(--widget-avatar-ring) solid
61
+ color-mix(in oklab, var(--a63-action-primary) 70%, transparent);
62
+ outline-offset: var(--widget-avatar-ring);
53
63
  }
54
64
 
55
65
  .a63-WidgetAvatar-busyRing {
@@ -57,8 +67,9 @@
57
67
  inset: 0;
58
68
  border-radius: var(--a63-avatar-radius, var(--radius-pill));
59
69
  box-shadow:
60
- 0 0 0 2px var(--a63-surface-page),
61
- 0 0 0 4px color-mix(in oklab, var(--a63-action-primary) 60%, transparent);
70
+ 0 0 0 var(--widget-avatar-ring) var(--a63-surface-page),
71
+ 0 0 0 var(--widget-avatar-ring-outer)
72
+ color-mix(in oklab, var(--a63-action-primary) 60%, transparent);
62
73
  animation: a63-widget-pulse calc(var(--duration-slower) * 2) var(--ease-inout) infinite;
63
74
  pointer-events: none;
64
75
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/utils.ts","../src/layout/widget-units.ts","../src/layout/widget-scale.ts","../src/layout/widget-unit-style.ts","../src/layout/widget-inset.ts","../src/layout/widget-type.ts","../src/layout/widget-grid.tsx","../src/layout/widget-viewport.tsx"],"names":["cellPx","jsx"],"mappings":";;;;AAGA,SAAS,OAAA,CAAQ,OAAmB,GAAA,EAAqB;AACvD,EAAA,IAAI,CAAC,KAAA,EAAO;AACZ,EAAA,IAAI,OAAO,UAAU,QAAA,IAAY,OAAO,UAAU,QAAA,IAAY,OAAO,UAAU,QAAA,EAAU;AACvF,IAAA,GAAA,CAAI,IAAA,CAAK,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA,EACxB,CAAA,MAAA,IAAW,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC/B,IAAA,KAAA,MAAW,IAAA,IAAQ,KAAA,EAAO,OAAA,CAAQ,IAAA,EAAM,GAAG,CAAA;AAAA,EAC7C,CAAA,MAAA,IAAW,OAAO,KAAA,KAAU,QAAA,EAAU;AACpC,IAAA,KAAA,MAAW,CAAC,IAAA,EAAM,OAAO,CAAA,IAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG,IAAI,OAAA,EAAS,GAAA,CAAI,IAAA,CAAK,IAAI,CAAA;AAAA,EACjF;AACF;AASO,SAAS,MAAM,MAAA,EAA8B;AAClD,EAAA,MAAM,MAAgB,EAAC;AACvB,EAAA,KAAA,MAAW,KAAA,IAAS,MAAA,EAAQ,OAAA,CAAQ,KAAA,EAAO,GAAG,CAAA;AAC9C,EAAA,OAAO,GAAA,CAAI,KAAK,GAAG,CAAA;AACrB;;;ACVO,IAAM,gBAAA,GAAuD;AAAA,EAClE,KAAA,EAAO,EAAE,IAAA,EAAM,CAAA,EAAG,MAAM,CAAA,EAAE;AAAA,EAC1B,MAAA,EAAQ,EAAE,IAAA,EAAM,CAAA,EAAG,MAAM,CAAA,EAAE;AAAA,EAC3B,KAAA,EAAO,EAAE,IAAA,EAAM,CAAA,EAAG,MAAM,CA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EAAQ;AAAA,GACV;AAEN,EAAA,uBACEC,GAAAA,CAAC,kBAAA,EAAA,EAAmB,IAAA,EAClB,QAAA,kBAAAA,GAAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,EAAA,CAAG,oBAAA,EAAsB,SAAS,CAAA;AAAA,MAC7C,sBAAA,EAAqB,EAAA;AAAA,MACrB,2BAAA,EAA2B,IAAA;AAAA,MAC3B,GAAA,EAAK,cAAA;AAAA,MACL,KAAA,EAAO;AAAA,QACL,GAAG,gBAAgB,IAAI,CAAA;AAAA;AAAA;AAAA,QAGvB,GAAI,UAAU,IAAA,GAAO,IAAA,GAAO,EAAE,eAAA,EAAiB,CAAA,EAAG,MAAM,CAAA,EAAA,CAAA,EAAK;AAAA,QAC7D,GAAG;AAAA,OACL;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,QAAA,kBAAAA,IAAC,KAAA,EAAA,EAAI,iCAAA,EAAgC,IAAG,GAAA,EAAK,SAAA,EAAW,KAAA,EAAO,iBAAA,EAC5D,QAAA,EACH;AAAA;AAAA,GACF,EACF,CAAA;AAEJ;AAoBO,SAAS,mBACd,SAAA,EACkB;AAClB,EAAA,SAAS,uBAAuB,KAAA,EAAU;AACxC,IAAA,uBACEA,GAAAA,CAAC,cAAA,EAAA,EAAe,SAAA,EAAU,yBAAA,EAA0B,IAAA,EAAM,KAAA,CAAM,IAAA,EAC9D,QAAA,kBAAAA,GAAAA,CAAC,SAAA,EAAA,EAAW,GAAG,OAAO,CAAA,EACxB,CAAA;AAAA,EAEJ;AAEA,EAAA,sBAAA,CAAuB,cAAc,CAAA,mBAAA,EAAsB,SAAA,CAAU,WAAA,IAAe,SAAA,CAAU,QAAQ,QAAQ,CAAA,CAAA,CAAA;AAE9G,EAAA,OAAO,sBAAA;AACT","file":"chunk-F5NV6XJ5.js","sourcesContent":["export type ClassValue =\n ClassValue[] | Record<string, unknown> | string | number | bigint | boolean | null | undefined\n\nfunction collect(value: ClassValue, out: string[]): void {\n if (!value) return\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'bigint') {\n out.push(String(value))\n } else if (Array.isArray(value)) {\n for (const item of value) collect(item, out)\n } else if (typeof value === 'object') {\n for (const [name, enabled] of Object.entries(value)) if (enabled) out.push(name)\n }\n}\n\n/**\n * Joins class names, skipping empty ones (the `clsx` input shapes).\n *\n * It does not merge utilities: the package's own classes live in the\n * stylesheet's `components` layer, so a consumer's Tailwind utility already\n * wins over them through the cascade.\n */\nexport function cn(...inputs: ClassValue[]): string {\n const out: string[] = []\n for (const input of inputs) collect(input, out)\n return out.join(' ')\n}\n","import type { WidgetSize } from '../types'\n\n/** Span of a widget in widget units (one unit = one cell of the host grid). */\nexport interface WidgetUnitSpan {\n cols: number\n rows: number\n}\n\n/**\n * Single source of truth for widget geometry.\n *\n * Hosts map a widget unit onto their own grid:\n * - os63 desktop: 1 widget unit = 2 desktop cells\n * - atom63.io web: 1 widget unit = 1 CSS grid column\n */\nexport const WIDGET_UNIT_SPAN: Record<WidgetSize, WidgetUnitSpan> = {\n small: { cols: 1, rows: 1 },\n medium: { cols: 2, rows: 1 },\n large: { cols: 2, rows: 2 },\n}\n\n/**\n * Internal authoring coordinate width for one widget unit.\n *\n * Existing widget values are authored on this coordinate system. Presentation\n * scale is measured against WIDGET_CANONICAL_CELL_PX instead.\n */\nexport const WIDGET_UNIT_BASE_PX = 256\n\n/** OS63-sized 100% presentation width of one widget cell, in CSS px. */\nexport const WIDGET_CANONICAL_CELL_PX = 188\n\n/** Largest supported proportional presentation scale above the canonical cell. */\nexport const WIDGET_MAX_PRESENTATION_SCALE = 1.375\n\n/**\n * Minimum font size per floor bucket on the canonical presentation canvas.\n * Whole-canvas presentation scaling preserves these proportions in smaller\n * hosts rather than reflowing around a fixed physical type floor.\n *\n * Intent roles (chrome / label / body / title / …) live in `WIDGET_TYPE_RAMP`\n * and map onto these buckets via `WIDGET_TYPE_ROLE_FLOOR`.\n *\n * `display` is deliberately unfloored: a 40px figure at 24px is still legible,\n * and flooring it would distort the composition it anchors.\n */\nexport const WIDGET_TYPE_FLOOR = {\n label: 11,\n body: 12,\n display: 0,\n} as const\n\n/** Floor buckets used by the type ramp. Prefer `WidgetTypeRampRole` for authoring. */\nexport type WidgetTypeFloorRole = keyof typeof WIDGET_TYPE_FLOOR\n\n/** @deprecated Use `WidgetTypeFloorRole` or `WidgetTypeRampRole`. */\nexport type WidgetTypeRole = WidgetTypeFloorRole\n\n// No accessor function: consumers index `WIDGET_UNIT_SPAN[size]` directly.\n// A one-line wrapper would add public surface that enforces nothing.\n","import type { CSSProperties } from 'react'\nimport type { WidgetSize } from '../types'\nimport {\n WIDGET_CANONICAL_CELL_PX,\n WIDGET_MAX_PRESENTATION_SCALE,\n WIDGET_UNIT_BASE_PX,\n WIDGET_UNIT_SPAN,\n} from './widget-units'\n\n/** Optical density presets — multiply `--widget-scale`. */\nexport const WIDGET_DENSITY_SCALE = {\n compact: 0.9,\n default: 1,\n comfortable: 1.1,\n} as const\n\nexport type WidgetDensity = keyof typeof WIDGET_DENSITY_SCALE\n\nexport interface WidgetSizeStyleOptions {\n /** Extra multiplier on `--widget-u`. @default 1 */\n scale?: number\n /** Named density preset; multiplies `scale`. @default 'default' */\n density?: WidgetDensity\n /**\n * Floor for `--widget-u` in CSS px. Unset by default — legibility is\n * protected by per-role type floors, not by arresting the unit. A unit\n * floor lets content outgrow its own tile and overflow.\n */\n minScale?: number\n}\n\nexport type WidgetSizeStyle = CSSProperties & {\n '--a63-control-min-target': string\n '--a63-control-min-target-lg': string\n '--a63-control-min-target-xl': string\n '--widget-cell': string\n '--widget-raw-u': string\n '--widget-rows': string\n '--widget-scale': string\n '--widget-span': string\n '--widget-u': string\n}\n\n/** The design-unit properties alone — no span, no grid placement. */\nexport type WidgetUnitStyle = CSSProperties & {\n '--a63-control-min-target': string\n '--a63-control-min-target-lg': string\n '--a63-control-min-target-xl': string\n '--widget-cell': string\n '--widget-raw-u': string\n '--widget-scale': string\n '--widget-u': string\n}\n\nexport type WidgetPresentationStyle = CSSProperties & {\n '--a63-control-min-target': string\n '--a63-control-min-target-lg': string\n '--a63-control-min-target-xl': string\n '--widget-interaction-target': string\n '--widget-presentation-scale': string\n '--widget-u': string\n}\n\n/**\n * WCAG 2.2 SC 2.5.8 minimum, in physical px — the floor this repo commits to\n * for widget controls (see IMPLEMENTATION.md §8).\n */\nconst WIDGET_CONTROL_MIN_TARGET_PX = 24\n\n/**\n * Pin the shared control ergonomics floor inside a widget.\n *\n * `@atom63/styles` raises `--a63-control-min-target` to 44px on coarse pointers,\n * and every control recipe floors its RENDERED geometry with it\n * (`--button-height: max(control-height, min-target)`). That lever is right for\n * page chrome and wrong for a widget: the tile is a fixed-proportion canvas, so\n * an inflated control does not gain room, it takes it from the composition —\n * one button would claim a quarter of a 188px cell on any phone.\n *\n * Widgets reach the enhanced 44px target the other way, by expanding the hit\n * area past the visible control with `--widget-interaction-target`, so the\n * geometry can stay proportional at the documented 24px floor. Expressed\n * against the host's presentation scale where there is one, so the floor is 24\n * PHYSICAL px rather than 24 pre-transform px.\n */\nfunction controlTargetStyle(scaleDivisor?: string) {\n const target = scaleDivisor\n ? `calc(${WIDGET_CONTROL_MIN_TARGET_PX}px / ${scaleDivisor})`\n : `${WIDGET_CONTROL_MIN_TARGET_PX}px`\n\n return {\n '--a63-control-min-target': target,\n '--a63-control-min-target-lg': target,\n '--a63-control-min-target-xl': target,\n }\n}\n\n/**\n * `--widget-u` from a cell width. The OS63 cell is the 100% presentation size,\n * while fluid hosts scale the same composition proportionally in either\n * direction, capped at WIDGET_MAX_PRESENTATION_SCALE when growing.\n */\nfunction unitExpression(minScale: number | undefined): string {\n const raw = `calc(var(--widget-cell) / ${WIDGET_UNIT_BASE_PX} * var(--widget-scale, 1))`\n const maximumUnit =\n (WIDGET_CANONICAL_CELL_PX * WIDGET_MAX_PRESENTATION_SCALE) / WIDGET_UNIT_BASE_PX\n return minScale == null\n ? `min(${raw}, ${maximumUnit}px)`\n : `clamp(${minScale}px, ${raw}, ${maximumUnit}px)`\n}\n\nfunction resolveScale(scale: number, density: WidgetDensity): string {\n /** Rounded to avoid IEEE-754 artifacts leaking into CSS (`3 * 1.1` → `3.3000000000000003`). */\n return String(Math.round(scale * WIDGET_DENSITY_SCALE[density] * 1e6) / 1e6)\n}\n\n/**\n * Design-unit properties for a host whose cell width is **known in px** — the\n * os63 desktop, whose tiles are laid out on a fixed grid rather than inside a\n * `WidgetGrid` container.\n *\n * `widgetSizeStyle()` cannot serve that host: its cell is `100cqi`-derived, so\n * with no `@container` ancestor it silently resolves against the VIEWPORT, and\n * its `gridColumn`/`gridRow` would fight the desktop's own placement. This\n * returns the unit properties only, so content authored in `wuStyle` renders in\n * both hosts instead of collapsing to dropped `calc()` declarations in one.\n */\nexport function widgetUnitStyle(\n cellPx: number,\n { density = 'default', minScale, scale = 1 }: WidgetSizeStyleOptions = {}\n): WidgetUnitStyle {\n const rawUnit = unitExpression(minScale)\n\n return {\n ...controlTargetStyle(),\n '--widget-cell': `${cellPx}px`,\n '--widget-raw-u': rawUnit,\n '--widget-scale': resolveScale(scale, density),\n '--widget-u': 'var(--widget-raw-u)',\n }\n}\n\n/**\n * Normalize a widget back to its canonical 188px composition, then transform\n * the complete canvas to the host cell. This catches fixed rem/Tailwind values\n * as well as design-unit values, preserving the original spacing and type\n * ratios both above and below the canonical size. A transform is used instead\n * of CSS zoom so the presentation contract behaves consistently in Firefox.\n */\nexport function widgetPresentationStyle(\n cellPx = WIDGET_CANONICAL_CELL_PX\n): WidgetPresentationStyle {\n const presentationScale = String(\n Math.min(cellPx / WIDGET_CANONICAL_CELL_PX, WIDGET_MAX_PRESENTATION_SCALE)\n )\n\n return {\n ...controlTargetStyle('var(--widget-presentation-scale)'),\n '--widget-interaction-target': 'calc(44px / var(--widget-presentation-scale))',\n '--widget-presentation-scale': presentationScale,\n '--widget-u': 'calc(var(--widget-raw-u) / var(--widget-presentation-scale))',\n // The canvas is a fixed-size box that the transform below scales — it must\n // never be resized by its parent's layout. A host whose viewport element is\n // a flex container (atom63.io's WidgetChrome adds `flex flex-col`) makes\n // this a flex item, and a canvas laid out ABOVE the host box then shrinks to\n // fit it before the transform shrinks it again: at a 165px mobile cell the\n // 188px canvas collapsed to 165, scaled to 144.8, and a 1×1 tile rendered\n // 165×144.8 instead of square. Invisible above the canonical cell, where the\n // canvas is already smaller than its box and there is nothing to shrink.\n flexShrink: 0,\n height:\n 'calc((var(--widget-rows) * var(--widget-cell) + (var(--widget-rows) - 1) * var(--widget-gap, 0px)) / var(--widget-presentation-scale))',\n minWidth: 0,\n transform: 'scale(var(--widget-presentation-scale))',\n transformOrigin: 'top left',\n width: 'calc(100cqi / var(--widget-presentation-scale))',\n }\n}\n\n/**\n * Width of one widget unit: total inline size minus the gaps *between* the\n * spanned cells, divided by the span. `--widget-gap` is published by WidgetGrid.\n */\nconst CELL_FORMULA =\n 'calc((100cqi - (var(--widget-span) - 1) * var(--widget-gap, 0px)) / var(--widget-span))'\n\n/**\n * Build the geometry and design-unit custom properties for a widget size.\n *\n * The unit divides by the span, so a `medium` tile is twice as wide yet resolves\n * the same `--widget-u` as a `small` — type and padding stay constant across\n * sizes, and only the composition gains room.\n */\nexport function widgetSizeStyle(\n size: WidgetSize,\n { density = 'default', minScale, scale = 1 }: WidgetSizeStyleOptions = {}\n): WidgetSizeStyle {\n const { cols, rows } = WIDGET_UNIT_SPAN[size]\n const rawUnit = unitExpression(minScale)\n\n // `height: 100%` rather than a cqi-derived length: a tile cannot resolve `cqi`\n // against the `@container` it itself establishes. Row height comes from the\n // grid's `grid-auto-rows`; 100% then fills that row whether the chrome is a\n // direct grid item OR nested inside a wrapper (e.g. RecentWriting's tilted\n // stack plate), where `gridRow`/`gridColumn` would otherwise be inert.\n return {\n ...controlTargetStyle(),\n '--widget-cell': CELL_FORMULA,\n '--widget-raw-u': rawUnit,\n '--widget-rows': String(rows),\n '--widget-scale': resolveScale(scale, density),\n '--widget-span': String(cols),\n '--widget-u': 'var(--widget-raw-u)',\n gridColumn: `span ${cols}`,\n gridRow: `span ${rows}`,\n height: '100%',\n }\n}\n","import type { CSSProperties } from 'react'\n\n/**\n * Inline-style helpers for authoring widget content in DESIGN px against\n * `--widget-u`, the design unit `widgetSizeStyle()` publishes on every tile.\n *\n * These live here because the package owns `--widget-u`; a host defining its\n * own readers for a package-owned custom property is the inversion this fixes.\n * Prefer them over Tailwind arbitrary classes: dynamic class strings are never\n * seen by the Tailwind scanner.\n *\n * ## What design px does NOT do\n *\n * It does not make a value \"scale with the tile\" where a fixed rem or px value\n * would not. `WidgetViewport` wraps every widget in a transform-scaled canvas\n * (`widgetPresentationStyle`), and a transform scales the whole composition —\n * fixed rem, fixed px and design-unit lengths alike. A `2.4rem` box measured\n * 38.4px at the canonical cell and 52.7px at a 1.372 host, exactly like a\n * `wu()` length would.\n *\n * So the reason to author in design px is CONSISTENCY, not scaling: the type\n * ramp, the insets and the gaps all live on the same 256 canvas, so one dial\n * moves the whole composition and no value has to be converted by hand. Do not\n * justify a conversion as a rendering fix — it will not change the render, and\n * a changeset that claims it did is wrong.\n */\n\n/**\n * Length from a design-px value.\n * Use in inline `style` (not Tailwind class strings — scanners never see dynamic classes).\n *\n * Falls back to `1px` — design px == CSS px — when no host published a unit.\n * Without the fallback the `calc()` is INVALID and the browser drops the whole\n * declaration, so a widget in an unpublishing host loses every padding, gap and\n * font size at once and renders as unstyled text. That is a silent, total\n * collapse that types, tests and lint cannot see. Degrading to design px keeps\n * the widget legible; hosts that publish a cell-derived unit still override it.\n *\n * @example style={{ padding: wu(16), gap: wu(12) }}\n */\nexport function wu(designPx: number): string {\n return `calc(${designPx} * var(--widget-u, 1px))`\n}\n\n/**\n * Proportional length with optional a11y floor / ceiling in CSS px.\n */\nexport function wuClamp(designPx: number, minPx?: number, maxPx?: number): string {\n const mid = wu(designPx)\n if (minPx != null && maxPx != null) {\n return `clamp(${minPx}px, ${mid}, ${maxPx}px)`\n }\n if (minPx != null) {\n return `max(${minPx}px, ${mid})`\n }\n if (maxPx != null) {\n return `min(${mid}, ${maxPx}px)`\n }\n return mid\n}\n\ntype Style = CSSProperties\n\n/**\n * Inline-style helpers for design-px space / type / size.\n *\n * Prefer these over Tailwind arbitrary classes — dynamic class strings are not\n * detected by the Tailwind scanner.\n */\nexport const wuStyle = {\n p: (n: number): Style => ({ padding: wu(n) }),\n px: (n: number): Style => ({ paddingInline: wu(n) }),\n py: (n: number): Style => ({ paddingBlock: wu(n) }),\n pt: (n: number): Style => ({ paddingTop: wu(n) }),\n pb: (n: number): Style => ({ paddingBottom: wu(n) }),\n gap: (n: number): Style => ({ gap: wu(n) }),\n gapX: (n: number): Style => ({ columnGap: wu(n) }),\n gapY: (n: number): Style => ({ rowGap: wu(n) }),\n m: (n: number): Style => ({ margin: wu(n) }),\n mt: (n: number): Style => ({ marginTop: wu(n) }),\n mb: (n: number): Style => ({ marginBottom: wu(n) }),\n ml: (n: number): Style => ({ marginLeft: wu(n) }),\n mr: (n: number): Style => ({ marginRight: wu(n) }),\n mx: (n: number): Style => ({ marginInline: wu(n) }),\n my: (n: number): Style => ({ marginBlock: wu(n) }),\n size: (n: number): Style => ({ width: wu(n), height: wu(n) }),\n h: (n: number): Style => ({ height: wu(n) }),\n w: (n: number): Style => ({ width: wu(n) }),\n text: (n: number): Style => ({ fontSize: wu(n) }),\n textMin: (n: number, minPx: number): Style => ({\n fontSize: wuClamp(n, minPx),\n }),\n rounded: (n: number): Style => ({ borderRadius: wu(n) }),\n} as const\n\n/** Merge style objects (later wins). */\nexport function wuMerge(...parts: Array<Style | undefined | null | false>): Style {\n const merged: Style = {}\n for (const part of parts) {\n if (part) Object.assign(merged, part)\n }\n return merged\n}\n","import type { CSSProperties } from 'react'\nimport type { WidgetSize } from '../types'\nimport { wu } from './widget-unit-style'\n\n/**\n * Shared body / face inset in design-px (256 authoring canvas).\n *\n * Calibrated so the OS63 188 cell resolves ≈ prior Tailwind `px-3` / `px-4`:\n * - 16 × 188/256 ≈ 11.75px (was `px-3`)\n * - 22 × 188/256 ≈ 16.1px (was `px-4`)\n *\n * Prefer `widgetInsetStyle` over local `wuStyle.p(…)` or `px-3` / `p-3.5`.\n */\nexport const WIDGET_BODY_INSET = {\n small: 16,\n medium: 22,\n large: 22,\n} as const satisfies Record<WidgetSize, number>\n\n/**\n * Shared stack gap in design-px between body children.\n * ≈ Tailwind `gap-2` / `gap-3` at the OS63 cell.\n */\nexport const WIDGET_BODY_GAP = {\n small: 11,\n medium: 11,\n large: 16,\n} as const satisfies Record<WidgetSize, number>\n\nexport type WidgetInsetMode =\n /** Full-face chrome-less body — padding on all sides. */\n | 'face'\n /**\n * Horizontal + bottom only. Used under `WidgetCardHeader`, and for\n * chrome-less faces with intentional top bleed (e.g. Behance ribbons).\n */\n | 'body'\n\nexport interface WidgetInsetStyleOptions {\n /** Include `gap` from `WIDGET_BODY_GAP`. Default true. */\n gap?: boolean\n}\n\n/** Design-px inset for a footprint. */\nexport function widgetInsetPx(size: WidgetSize): number {\n return WIDGET_BODY_INSET[size]\n}\n\n/**\n * Inline padding (+ optional gap) from the shared inset ramp.\n *\n * @example\n * // Chrome-less Behance / Instagram / Location / Weather\n * style={widgetInsetStyle(size, 'face')}\n *\n * // Under WidgetCardHeader (GitHub, Profile, …)\n * style={widgetInsetStyle(size, 'body')}\n */\nexport function widgetInsetStyle(\n size: WidgetSize,\n mode: WidgetInsetMode = 'face',\n options?: WidgetInsetStyleOptions\n): CSSProperties {\n const inset = WIDGET_BODY_INSET[size]\n const includeGap = options?.gap !== false\n const style: CSSProperties = {\n paddingInline: wu(inset),\n paddingBottom: wu(inset),\n }\n\n if (mode === 'face') {\n style.paddingTop = wu(inset)\n }\n\n if (includeGap) {\n style.gap = wu(WIDGET_BODY_GAP[size])\n }\n\n return style\n}\n","import type { CSSProperties } from 'react'\nimport type { WidgetSize } from '../types'\nimport { WIDGET_TYPE_FLOOR, type WidgetTypeFloorRole } from './widget-units'\nimport { wu, wuClamp } from './widget-unit-style'\n\n/**\n * Intent roles for widget content type.\n *\n * Floors live on three buckets (`label` / `body` / `display`). Ramp roles map\n * onto those buckets so authors pick meaning, not raw px.\n *\n * Design-px targets are authored against `--widget-u` (256 design canvas).\n * Footprint steps (`small` / `medium` / `large`) are hand-authored growth for\n * roles that earn more room — they are not automatic scale-with-box.\n */\nexport const WIDGET_TYPE_ROLE_FLOOR = {\n /** Quiet uppercase identity on the chrome header. */\n chrome: 'label',\n /** Smallest supporting labels (stat keys, legends, zone tags). */\n label: 'label',\n /** Default reading copy. */\n body: 'body',\n /** Compact identity (handles, short names). */\n name: 'body',\n /** Content headings that are not the hero figure. */\n title: 'body',\n /** Featured content name (project title, primary listing). */\n headline: 'body',\n /** Mid-weight digital / tabular figures (profile stats). */\n stat: 'body',\n /** Hero figures — temperature, big totals. Unfloored. */\n display: 'display',\n /** Dense hero digits (clock faces beside a second column). Unfloored. */\n displayCompact: 'display',\n} as const satisfies Record<string, WidgetTypeFloorRole>\n\nexport type WidgetTypeRampRole = keyof typeof WIDGET_TYPE_ROLE_FLOOR\n\ntype SteppedDesignPx = Record<WidgetSize, number>\n\ninterface WidgetTypeRecipe {\n designPx: number | SteppedDesignPx\n weight: number\n trackingEm?: number\n transform?: 'uppercase'\n leading?: number\n /**\n * Optional CSS-px floor override. When set, replaces the role's bucket floor\n * (`WIDGET_TYPE_FLOOR[…]`). Use for chrome that should sit quieter than\n * content `label` copy.\n */\n floorPx?: number\n /** Leading chrome icon design-px (WidgetCardTitle). */\n iconDesignPx?: number\n /** Leading chrome icon CSS-px floor. */\n iconFloorPx?: number\n}\n\n/**\n * Derived from the live widget inventory (Location place/temp/clock, Behance\n * stats, Open Source title, Instagram handle, WidgetCardTitle chrome).\n * Prefer `widgetTypeStyle(role, size)` over local SIZE maps or Tailwind\n * `text-*` for content type.\n *\n * ## Read this before changing a design-px value\n *\n * `--widget-u` is ALWAYS `188 / 256` ≈ `0.734`, at every host and every cell\n * size. `widgetPresentationStyle` divides the unit back out of the presentation\n * transform, so one canonical composition is scaled as a whole canvas rather\n * than re-resolved per cell. A design-px value therefore renders at\n * `design × 0.734` — the 256 canvas never renders 1:1.\n *\n * That makes the CSS-px floors (`WIDGET_TYPE_FLOOR`) load-bearing rather than a\n * rare safety net, and the ramp was previously authored as if they were rare:\n * `label` (10), `body` (13), `name` (14) and `title` (16) all resolved BELOW\n * their floor and rendered at a single 11–12px step, so four distinct roles\n * were separated only by weight and colour, and the authored headline-to-body\n * ratio of 1.69 rendered as 1.35. `chrome` even inverted — authored larger than\n * `label`, rendered smaller, because its `floorPx` override let it through.\n *\n * The content roles are now authored so `design × 0.734` clears the floor on\n * its own and lands on a deliberate rendered ladder at the 1×1 footprint:\n *\n * | role | design | renders |\n * | -------- | ------ | ------- |\n * | chrome | 14 | 10.3 |\n * | label | 15 | 11.0 |\n * | body | 17 | 12.5 |\n * | name | 18 | 13.2 |\n * | title | 20 | 14.7 |\n * | stat | 22 | 16.2 |\n * | headline | 26 | 19.1 |\n * | display | 48 | 35.3 |\n *\n * `display` / `displayCompact` are unchanged: they never floored, so their\n * rendered figures were already the calibrated ones.\n *\n * ## The footprint columns are a curve, not three free values\n *\n * `body` is deliberately FLAT at 17 across all three footprints: it is reading\n * copy, and a widget that changes its reading size when the tile grows is\n * harder to scan across a desktop, not easier. A wider tile buys measure and\n * room, not bigger prose.\n *\n * That makes every heading role's footprint column a RATIO against a fixed\n * body, and the previous values let the top of the ramp run away from the\n * bottom exactly where there is most type on screen:\n *\n * | role | small | medium | large | old title:body |\n * | -------- | ----- | ------ | ----- | -------------- |\n * | title | 20 | 23 | 30 | 1.18 → 1.76 |\n * | stat | 22 | 24 | 29 | |\n * | headline | 26 | 26 | 34 | |\n *\n * A 1.18 step at 1×1 and a 1.76 step at 2×2 are not one hierarchy, they are two\n * — and the 2×2 one shouts, which is the whole \"widget type feels too big\"\n * complaint. `headline` was also non-monotonic (26 at both small and medium,\n * then a jump to 34), so doubling the tile width bought the hero name nothing\n * and doubling it again bought it 31%.\n *\n * `name` (18 / 19 / 22) was already the disciplined curve — roughly ×1.06 and\n * ×1.22 off its 1×1 value — so the other heading roles now follow it. The 1×1\n * column is untouched: that ladder is the calibrated one above, and the defect\n * was never there.\n *\n * | role | small | medium | large | title:body |\n * | -------- | ----- | ------ | ----- | ------------ |\n * | title | 20 | 22 | 24 | 1.18 → 1.41 |\n * | stat | 22 | 23 | 26 | |\n * | headline | 26 | 28 | 32 | |\n *\n * When adding a footprint step, move along this curve. A role that needs a\n * bigger jump than the curve gives is usually the wrong role for the job.\n */\nexport const WIDGET_TYPE_RAMP = {\n chrome: {\n // Mid quiet chrome: ~10.3px at OS63 (14×188/256), floored to 10 — between\n // the old text-xs (~12) and the too-quiet 9px experiment.\n designPx: 14,\n weight: 500,\n trackingEm: 0.025,\n transform: 'uppercase',\n leading: 1,\n floorPx: 10,\n // Icon sits just above the cap height.\n iconDesignPx: 14,\n iconFloorPx: 11,\n },\n label: {\n designPx: 15,\n weight: 500,\n },\n body: {\n designPx: 17,\n weight: 400,\n },\n name: {\n designPx: { small: 18, medium: 19, large: 22 },\n weight: 600,\n },\n title: {\n designPx: { small: 20, medium: 22, large: 24 },\n weight: 600,\n },\n headline: {\n designPx: { small: 26, medium: 28, large: 32 },\n weight: 600,\n // Display serif (Hedvig Letters Serif) with tall ascenders — 1.12 read as\n // two lines fighting for the same band once the headline cleared its floor.\n leading: 1.18,\n },\n stat: {\n designPx: { small: 22, medium: 23, large: 26 },\n weight: 600,\n },\n display: {\n designPx: { small: 48, medium: 44, large: 64 },\n weight: 600,\n },\n displayCompact: {\n designPx: { small: 40, medium: 34, large: 52 },\n weight: 600,\n },\n} as const satisfies Record<WidgetTypeRampRole, WidgetTypeRecipe>\n\nexport interface WidgetTypeStyleOptions {\n /** Override design-px when a composition needs a one-off step. Prefer ramp. */\n designPx?: number\n /** Override weight (e.g. weather display uses extralight). */\n weight?: number\n leading?: number\n trackingEm?: number\n}\n\nfunction resolveDesignPx(designPx: number | SteppedDesignPx, size: WidgetSize): number {\n return typeof designPx === 'number' ? designPx : designPx[size]\n}\n\n/** Design-px target for a ramp role at a footprint. */\nexport function widgetTypeDesignPx(role: WidgetTypeRampRole, size: WidgetSize = 'medium'): number {\n return resolveDesignPx(WIDGET_TYPE_RAMP[role].designPx, size)\n}\n\n/**\n * Inline type styles for a ramp role.\n *\n * Returns `fontSize` (wu + floor), `fontWeight`, and chrome extras when present.\n * Pair with Tailwind only for color / truncation / layout — not for size.\n */\nexport function widgetTypeStyle(\n role: WidgetTypeRampRole,\n size: WidgetSize = 'medium',\n options?: WidgetTypeStyleOptions\n): CSSProperties {\n // Narrow `as const` recipes omit optional fields; widen to the recipe shape.\n const recipe: WidgetTypeRecipe = WIDGET_TYPE_RAMP[role]\n const floorRole = WIDGET_TYPE_ROLE_FLOOR[role]\n const floorPx = recipe.floorPx ?? WIDGET_TYPE_FLOOR[floorRole]\n const designPx = options?.designPx ?? resolveDesignPx(recipe.designPx, size)\n const weight = options?.weight ?? recipe.weight\n const trackingEm = options?.trackingEm ?? recipe.trackingEm\n const leading = options?.leading ?? recipe.leading\n\n const style: CSSProperties = {\n fontSize: floorPx > 0 ? wuClamp(designPx, floorPx) : wu(designPx),\n fontWeight: weight,\n }\n\n if (trackingEm != null) {\n style.letterSpacing = `${trackingEm}em`\n }\n if (recipe.transform) {\n style.textTransform = recipe.transform\n }\n if (leading != null) {\n style.lineHeight = leading\n }\n\n return style\n}\n\n/**\n * Leading icon box for `WidgetCardTitle` — sized from the chrome recipe so the\n * glyph tracks the quiet header label.\n */\nexport function widgetChromeIconStyle(): CSSProperties {\n const recipe: WidgetTypeRecipe = WIDGET_TYPE_RAMP.chrome\n const designPx = recipe.iconDesignPx ?? resolveDesignPx(recipe.designPx, 'medium')\n const floorPx = recipe.iconFloorPx ?? recipe.floorPx ?? WIDGET_TYPE_FLOOR.label\n return {\n width: floorPx > 0 ? wuClamp(designPx, floorPx) : wu(designPx),\n height: floorPx > 0 ? wuClamp(designPx, floorPx) : wu(designPx),\n }\n}\n\n/**\n * Descender relief for text that also carries `line-clamp-*`.\n *\n * `line-clamp` implies `overflow: hidden`, and the clip box is exactly\n * `line-height × lines`. Any ramp role authored with tight leading therefore\n * has a line box SHORTER than the font's own box, and the last line's\n * descenders are shaved — silently, at every width, whether or not the clamp\n * actually truncates anything.\n *\n * Measured on the open-source headline (Hedvig Letters Serif 600, leading\n * 1.12): the box ended 1.95px above the ink. `0.24em` covers the font's full\n * declared descent rather than one sample string, so no glyph can reach past\n * it, and the matching negative margin hands the space back to layout — the\n * glyphs become whole without anything moving.\n *\n * `truncate` has the same problem for the same reason — it also sets\n * `overflow: hidden`, and a single line box is just as short.\n *\n * Pass `'emoji'` for a line that can carry one. Emoji ink runs well past the\n * font's declared descent, so the text relief only halves the cut: the profile\n * stat row still shaved 3px off a cat's chin at `leading: 1`.\n *\n * @example\n * <span className=\"line-clamp-4\" style={widgetClampRelief()}>{title}</span>\n * <dt className=\"truncate\" style={widgetClampRelief('emoji')}>{label}</dt>\n */\nexport function widgetClampRelief(content: 'emoji' | 'text' = 'text'): CSSProperties {\n const relief = content === 'emoji' ? '0.55em' : '0.24em'\n return {\n paddingBottom: relief,\n marginBottom: `-${relief}`,\n }\n}\n","import {\n createContext,\n useContext,\n type ComponentPropsWithRef,\n type CSSProperties,\n type ReactNode,\n} from 'react'\nimport type { WidgetSize } from '../types'\n\nconst WidgetSizeContext = createContext<WidgetSize>('small')\n\n/**\n * Reports the size a widget is being rendered at, so a widget supporting more\n * than one size can pick the matching composition.\n */\nexport function useWidgetSize(): WidgetSize {\n return useContext(WidgetSizeContext)\n}\n\nexport interface WidgetSizeProviderProps {\n children: ReactNode\n size: WidgetSize\n}\n\nexport function WidgetSizeProvider({ children, size }: WidgetSizeProviderProps) {\n return <WidgetSizeContext.Provider value={size}>{children}</WidgetSizeContext.Provider>\n}\n\ntype WidgetGridStyle = CSSProperties & {\n '--widget-cols': string\n '--widget-gap': string\n}\n\nexport interface WidgetGridProps extends ComponentPropsWithRef<'div'> {\n /** Track count. Fixed, not responsive — every size keeps its shape at every width. @default 2 */\n columns?: number\n /** Gutter in CSS px. @default 12 */\n gap?: number\n}\n\n/**\n * Widget grid container. Owns track count and gap, and publishes both as custom\n * properties so each tile's cell-derived unit can divide them out.\n *\n * Tracks are explicit rather than `auto-fill`: with intrinsic tracks a narrow\n * container resolves to one column and a `span 2` tile would create an implicit\n * second column and overflow.\n *\n * Rows are sized here rather than on the tile: an element cannot resolve\n * container-query units against the `@container` it establishes itself, so the\n * grid is wrapped in a container and `grid-auto-rows` resolves `100cqi` against\n * that ancestor. Tiles just fill their area, and spanning tiles inherit the\n * inter-row gaps from the grid.\n */\nexport function WidgetGrid({\n children,\n columns = 2,\n gap = 12,\n ref,\n style,\n ...props\n}: WidgetGridProps) {\n const gridStyle: WidgetGridStyle = {\n '--widget-cols': String(columns),\n '--widget-gap': `${gap}px`,\n display: 'grid',\n gap: `${gap}px`,\n gridAutoRows:\n 'calc((100cqi - (var(--widget-cols) - 1) * var(--widget-gap)) / var(--widget-cols))',\n gridTemplateColumns: 'repeat(var(--widget-cols), minmax(0, 1fr))',\n ...style,\n }\n\n return (\n <div ref={ref} style={{ containerType: 'inline-size' }} {...props}>\n <div style={gridStyle}>{children}</div>\n </div>\n )\n}\n","import {\n type ComponentPropsWithRef,\n type ComponentType,\n type ReactNode,\n type Ref,\n useCallback,\n useLayoutEffect,\n useRef,\n} from 'react'\nimport type { WidgetSize } from '../types'\nimport { cn } from '../utils'\nimport { WidgetSizeProvider } from './widget-grid'\nimport { widgetPresentationStyle, widgetSizeStyle } from './widget-scale'\nimport { WIDGET_CANONICAL_CELL_PX, WIDGET_MAX_PRESENTATION_SCALE } from './widget-units'\n\nexport interface WidgetViewportProps extends Omit<ComponentPropsWithRef<'article'>, 'children'> {\n /**\n * The host grid's cell width in CSS px, when the host already knows it.\n *\n * Left unset the viewport derives the cell from its own measured box, which\n * is right at rest and wrong while that box is moving: a host that animates\n * the shell between two sizes re-fires the observer every frame, the cell\n * follows the travelling width, and the composition zooms inside the growing\n * box instead of reflowing in it. The cell a tile lands in is a property of\n * the *grid*, identical for a 1x1 and a 2x1, so a host that measures its own\n * tracks can say so once and the observer never runs.\n *\n * Passing it also frees the canvas height to follow the host box rather than\n * the cell — the two are the same number at rest, and only the first of them\n * is still true mid-flight.\n */\n cellPx?: number\n children: ReactNode\n size: WidgetSize\n}\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref) {\n ref.current = value\n }\n}\n\n/**\n * Fluid host boundary for a canonical widget view.\n *\n * The viewport owns grid placement and publishes the design unit. The widget\n * view inside owns all visible surface, composition, and state styling.\n */\nexport function WidgetViewport({\n cellPx,\n children,\n className,\n ref,\n size,\n style,\n ...props\n}: WidgetViewportProps) {\n const viewportRef = useRef<HTMLElement | null>(null)\n const canvasRef = useRef<HTMLDivElement | null>(null)\n const setViewportRef = useCallback(\n (node: HTMLElement | null) => {\n viewportRef.current = node\n assignRef(ref, node)\n },\n [ref]\n )\n\n useLayoutEffect(() => {\n const viewport = viewportRef.current\n const canvas = canvasRef.current\n if (!viewport || !canvas) return\n // The host told us the cell, so there is nothing to measure and nothing to\n // watch: the scale is already on the canvas, from `widgetPresentationStyle`.\n if (cellPx != null) return\n\n const updatePresentationScale = () => {\n const computedStyle = getComputedStyle(viewport)\n const span = Number.parseFloat(computedStyle.getPropertyValue('--widget-span')) || 1\n const gap = Number.parseFloat(computedStyle.getPropertyValue('--widget-gap')) || 0\n const cellPx = (viewport.getBoundingClientRect().width - (span - 1) * gap) / span\n const scale = Math.min(cellPx / WIDGET_CANONICAL_CELL_PX, WIDGET_MAX_PRESENTATION_SCALE)\n canvas.style.setProperty('--widget-presentation-scale', String(scale))\n }\n\n updatePresentationScale()\n\n if (typeof ResizeObserver === 'undefined') {\n window.addEventListener('resize', updatePresentationScale)\n return () => window.removeEventListener('resize', updatePresentationScale)\n }\n\n const observer = new ResizeObserver(updatePresentationScale)\n observer.observe(viewport)\n return () => observer.disconnect()\n }, [cellPx, size])\n\n const presentationStyle =\n cellPx == null\n ? widgetPresentationStyle()\n : {\n ...widgetPresentationStyle(cellPx),\n // Off the cell, onto the box. The cell-derived height is the row's\n // resting height, which is the same number — until the host animates\n // the shell between two sizes, when the box is the one that is still\n // true. `100%` resolves against the viewport, which is `size-full`.\n height: 'calc(100% / var(--widget-presentation-scale))',\n }\n\n return (\n <WidgetSizeProvider size={size}>\n <article\n className={cn('a63-WidgetViewport', className)}\n data-widget-viewport=\"\"\n data-widget-viewport-size={size}\n ref={setViewportRef}\n style={{\n ...widgetSizeStyle(size),\n // A known cell replaces the `100cqi`-derived one, so `--widget-u`\n // stops tracking a travelling width along with it.\n ...(cellPx == null ? null : { '--widget-cell': `${cellPx}px` }),\n ...style,\n }}\n {...props}\n >\n <div data-widget-presentation-canvas=\"\" ref={canvasRef} style={presentationStyle}>\n {children}\n </div>\n </article>\n </WidgetSizeProvider>\n )\n}\n\n/**\n * Wrap a sized widget component so it carries its own viewport.\n *\n * A widget's composition is authored on a 256 design-px canvas and only\n * resolves against real pixels once a host publishes `--widget-u`. Grid hosts\n * (the OS63 desktop, the atom63.io board) publish it by placing tiles in a\n * `WidgetViewport` themselves. Hosts that render a widget on its own — agent\n * chat renders one per message, in an intrinsically sized frame — have no grid\n * to hang that on, and a widget mounted without it silently renders design px\n * at 1:1: ~36% oversized type, padding and gaps, clipped by the shell wherever\n * the overflow lands.\n *\n * Use this at the registry boundary of such a host so the widget arrives\n * already scaled, rather than re-deriving the unit per call site.\n *\n * @example\n * component: () => import('./weather').then(m => withWidgetViewport(m.Weather))\n */\nexport function withWidgetViewport<P extends { size: WidgetSize }>(\n Component: ComponentType<P>\n): ComponentType<P> {\n function WidgetViewportBoundary(props: P) {\n return (\n <WidgetViewport className=\"a63-WidgetViewport-fill\" size={props.size}>\n <Component {...props} />\n </WidgetViewport>\n )\n }\n\n WidgetViewportBoundary.displayName = `withWidgetViewport(${Component.displayName ?? Component.name ?? 'Widget'})`\n\n return WidgetViewportBoundary\n}\n"]}