@domphy/ui 0.20.8 → 0.20.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/patches/abbreviation.ts","../src/patches/accordion.ts","../src/utils/focusRing.ts","../src/patches/alert.ts","../src/patches/avatar.ts","../src/patches/badge.ts","../src/patches/blockquote.ts","../src/patches/breadcrumb.ts","../src/patches/breadcrumbEllipsis.ts","../src/patches/button.ts","../src/utils/buttonSize.ts","../src/patches/buttonGhost.ts","../src/patches/buttonSwitch.ts","../src/patches/card.ts","../src/utils/elevation.ts","../src/patches/code.ts","../src/patches/combobox.ts","../src/utils/floating.ts","../src/patches/tag.ts","../src/patches/command.ts","../src/patches/datePicker.ts","../src/patches/descriptionList.ts","../src/patches/details.ts","../src/patches/dialog.ts","../src/utils/scrollLock.ts","../src/patches/divider.ts","../src/patches/drawer.ts","../src/patches/emphasis.ts","../src/patches/empty.ts","../src/patches/errorBoundary.ts","../src/patches/fab.ts","../src/patches/figure.ts","../src/patches/formGroup.ts","../src/patches/heading.ts","../src/patches/horizontalRule.ts","../src/patches/icon.ts","../src/patches/image.ts","../src/patches/inputCheckbox.ts","../src/patches/inputColor.ts","../src/patches/inputDateTime.ts","../src/patches/inputFile.ts","../src/patches/inputNumber.ts","../src/patches/inputOTP.ts","../src/patches/inputPassword.ts","../src/patches/inputRadio.ts","../src/patches/inputRange.ts","../src/patches/inputSearch.ts","../src/patches/inputSwitch.ts","../src/patches/inputText.ts","../src/patches/keyboard.ts","../src/patches/label.ts","../src/patches/link.ts","../src/patches/linkButton.ts","../src/patches/list.ts","../src/patches/mark.ts","../src/patches/menu.ts","../src/patches/motion.ts","../src/patches/orderedList.ts","../src/patches/pagination.ts","../src/patches/panelSection.ts","../src/patches/paragraph.ts","../src/patches/popover.ts","../src/patches/popoverArrow.ts","../src/patches/preformated.ts","../src/patches/progress.ts","../src/patches/rating.ts","../src/patches/ringProgress.ts","../src/patches/row.ts","../src/patches/scrollArea.ts","../src/patches/segmented.ts","../src/patches/select.ts","../src/patches/selectBox.ts","../src/patches/selectItem.ts","../src/patches/selectList.ts","../src/patches/skeleton.ts","../src/patches/small.ts","../src/patches/spinner.ts","../src/patches/splitter.ts","../src/patches/stack.ts","../src/patches/steps.ts","../src/patches/strong.ts","../src/patches/subscript.ts","../src/patches/superscript.ts","../src/patches/table.ts","../src/patches/tabs.ts","../src/patches/textarea.ts","../src/patches/timeline.ts","../src/patches/toast.ts","../src/patches/toggleGroup.ts","../src/patches/toolbar.ts","../src/patches/tooltip.ts","../src/patches/transitionGroup.ts","../src/patches/unorderedList.ts"],"sourcesContent":["import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles an abbreviation/acronym with a dotted underline and a \"help\" cursor,\n * shifting to the accent color on hover. Apply to an `<abbr>` element.\n *\n * @hostTag abbr\n * @param props.color - Base text/decoration color tone. Optional `ValueOrState<ThemeColor>`, default \"neutral\".\n * @param props.accentColor - Hover color tone. Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @example { abbr: \"HTML\", title: \"HyperText Markup Language\", $: [abbreviation({ accentColor: \"primary\" })] }\n */\nfunction abbreviation(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"abbr\") {\n console.warn(`\"abbreviation\" primitive patch must use abbr tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener),\n backgroundColor: (listener) => themeColor(listener),\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n textDecorationLine: \"underline\",\n textDecorationStyle: \"dotted\",\n textDecorationColor: (listener) =>\n themeColor(listener, \"shift-7\", color.get(listener)),\n textUnderlineOffset: themeSpacing(0.72),\n cursor: \"help\",\n \"&:hover\": {\n color: (listener) =>\n themeColor(listener, \"shift-11\", accentColor.get(listener)),\n textDecorationColor: (listener) =>\n themeColor(listener, \"shift-9\", accentColor.get(listener)),\n },\n },\n };\n}\n\nexport { abbreviation };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Container patch that groups `<details>` elements into a bordered accordion.\n * In `type: \"single\"` mode (default), opening one item closes all siblings.\n *\n * @param props.type - `\"single\"` (default) or `\"multiple\"`. Single mode auto-closes siblings.\n * @param props.color - Theme color tone for borders and backgrounds. Defaults to `\"neutral\"`.\n * @param props.accentColor - Accent color for focus rings on summary. Defaults to `\"primary\"`.\n * @example\n * { div: [\n * { details: [{ summary: \"Section A\" }, { p: \"Content A\" }], $: [details()] },\n * { details: [{ summary: \"Section B\" }, { p: \"Content B\" }], $: [details()] },\n * ], $: [accordion()] }\n */\nfunction accordion(\n props: {\n type?: \"single\" | \"multiple\";\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const { type = \"single\" } = props;\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n _onMount: (node) => {\n if (type !== \"single\") return;\n\n const el = node.domElement;\n if (!el) return;\n const handler = (event: Event) => {\n const summary = (event.target as Element).closest(\"summary\");\n if (!summary) return;\n const item = summary.closest(\"details\") as HTMLDetailsElement | null;\n if (!item || item.parentElement !== el) return;\n if (!item.open) {\n Array.from(el.querySelectorAll(\":scope > details\")).forEach(\n (detail) => {\n if (detail !== item) (detail as HTMLDetailsElement).open = false;\n },\n );\n }\n };\n el.addEventListener(\"click\", handler);\n node.addHook(\"Remove\", () => el.removeEventListener(\"click\", handler));\n },\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n outlineOffset: \"-1px\",\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n overflow: \"hidden\",\n \"& > details\": {\n borderBottom: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n },\n \"& > details:last-child\": {\n borderBottom: \"none\",\n },\n \"& > details > summary:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n },\n };\n}\n\nexport { accordion };\n","import type { Listener } from \"@domphy/core\";\nimport { type ThemeColor, themeColor } from \"@domphy/theme\";\n\n/**\n * Shared `:focus-visible` ring — ring-offset pattern used by Radix / shadcn /\n * Vercel / Linear:\n *\n * 1. 2px \"gap\" in the surface tone (reads as space between control + ring)\n * 2. 2px accent halo outside that gap\n *\n * Implemented as a layered `box-shadow` so it composes with a control's own\n * resting outline / elevation instead of replacing them. Prefer this over a\n * flush `0 0 0 2px` ring (looks like a thick pastel border glued to the edge)\n * and over the browser default outline.\n *\n * Accent at `shift-9` stays legible on both light and dark surfaces; the\n * washed `shift-6` flush ring is what made focus look broken in product UIs.\n */\nfunction focusRing(listener: Listener, color: ThemeColor = \"primary\"): string {\n const gap = themeColor(listener, \"surface\");\n const ring = themeColor(listener, \"shift-9\", color);\n return `0 0 0 2px ${gap}, 0 0 0 4px ${ring}`;\n}\n\nexport { focusRing };\n","import type { PartialElement } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * A semantic alert surface block with a colored inset bar, padding, and\n * `role=\"alert\"`. Typically applied to a `<div>` (any block container).\n *\n * @param props.color - Surface/accent color tone. Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @example { div: \"Saved successfully\", $: [alert({ color: \"success\" })] }\n */\nfunction alert(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"primary\", \"color\");\n\n return {\n role: \"alert\",\n // Alert is a semantic surface block, so it should shift the local surface context.\n dataTone: \"shift-2\",\n style: {\n display: \"flex\",\n alignItems: \"flex-start\",\n gap: themeSpacing(3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n boxShadow: (listener) =>\n `inset ${themeSpacing(1)} 0 0 0 ${themeColor(listener, \"shift-8\", color.get(listener))}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n },\n };\n}\n\nexport { alert };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * A circular avatar container that centers initials/text and cover-fits any\n * child `<img>`. Typically applied to an inline-flex container such as a `<span>`.\n *\n * @param props.color - Background/foreground color tone. Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @example { span: \"JD\", $: [avatar({ color: \"primary\" })] }\n */\nfunction avatar(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"primary\", \"color\");\n\n return {\n dataTone: \"shift-2\",\n // Design-system initials weight (not app chrome) — consumers use avatar().\n _doctorDisable: \"inline-typography\",\n style: {\n position: \"relative\",\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n overflow: \"hidden\",\n borderRadius: \"50%\",\n flexShrink: 0,\n width: themeSpacing(9),\n height: themeSpacing(9),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n fontWeight: \"600\",\n userSelect: \"none\",\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) =>\n themeColor(listener, \"shift-11\", color.get(listener)),\n // Hairline so the circle separates from same-tone surfaces.\n boxShadow: (listener) =>\n `0 0 0 1px ${themeColor(listener, \"border\", color.get(listener))}`,\n \"& img\": {\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n },\n },\n };\n}\n\nexport { avatar };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Renders a small count/label bubble pinned to the top-right corner of its host\n * (via a `::after` pseudo-element). Typically applied to an inline container such\n * as a `<span>` wrapping an icon or element.\n *\n * @param props.color - Badge color tone. Optional `ValueOrState<ThemeColor>`, default \"danger\".\n * @param props.label - Text/number shown in the badge. Optional `ValueOrState<string | number>`, default 999.\n * @example { span: \"🔔\", $: [badge({ label: 3, color: \"danger\" })] }\n */\nfunction badge(\n props: {\n color?: ValueOrState<ThemeColor>;\n label?: ValueOrState<string | number>;\n } = {},\n): PartialElement {\n const { label = 999 } = props;\n const state = toState(label);\n const color = toState(props.color ?? \"danger\", \"color\");\n return {\n // Badge ::after uses a fixed size scale for the pill chrome.\n _doctorDisable: \"inline-typography\",\n style: {\n position: \"relative\",\n \"&::after\": {\n content: (l) => `\"${state.get(l)}\"`,\n position: \"absolute\",\n top: 0,\n right: 0,\n transform: \"translate(50%,-50%)\",\n paddingInline: themeSpacing(1.5),\n minWidth: themeSpacing(5),\n height: themeSpacing(5),\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontSize: (l) => themeSize(l, \"decrease-2\"),\n fontWeight: \"600\",\n lineHeight: 1,\n borderRadius: themeSpacing(999),\n backgroundColor: (l) => themeColor(l, \"shift-9\", color.get(l)),\n color: (l) => themeColor(l, \"shift-0\", color.get(l)),\n // Hairline ring so the pill pops on same-hue surfaces.\n boxShadow: (l) => `0 0 0 1px ${themeColor(l, \"shift-0\", color.get(l))}`,\n },\n },\n };\n}\n\nexport { badge };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles a quotation block with a colored inset side bar, padded surface, and\n * shifted tone. Apply to a `<blockquote>` element.\n *\n * @hostTag blockquote\n * @param props.color - Surface/bar color tone. Optional `ValueOrState<ThemeColor>`, default \"neutral\".\n * @example { blockquote: \"Design is how it works.\", $: [blockquote({ color: \"primary\" })] }\n */\nfunction blockquote(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"blockquote\") {\n console.warn(`\"blockquote\" primitive patch must use blockquote tag`);\n }\n },\n dataTone: \"shift-2\",\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n boxShadow: (listener) =>\n `inset ${themeSpacing(1)} 0 0 0 ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n border: \"none\",\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n margin: 0,\n },\n };\n}\n\nexport { blockquote };\n","import type { PartialElement } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * A horizontal breadcrumb navigation that lays out its children with a\n * separator between items and highlights the `[aria-current=page]` item.\n * Apply to a `<nav>` element.\n *\n * @hostTag nav\n * @param props.color - Color tone for links/separators. Optional `ValueOrState<ThemeColor>`, default \"neutral\".\n * @param props.separator - String inserted between items via `::after`. Optional `string`, default \"/\".\n * @example { nav: null, $: [breadcrumb({ separator: \"›\" })] }\n */\nfunction breadcrumb(\n props: { color?: ValueOrState<ThemeColor>; separator?: string } = {},\n): PartialElement {\n const { separator = \"/\" } = props;\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"nav\")\n console.warn('\"breadcrumb\" patch must use nav tag');\n },\n ariaLabel: \"breadcrumb\",\n style: {\n display: \"flex\",\n alignItems: \"center\",\n flexWrap: \"wrap\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n gap: themeSpacing(1),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n \"& > *\": {\n display: \"inline-flex\",\n alignItems: \"center\",\n color: (listener) => themeColor(listener, \"muted\", color.get(listener)),\n },\n \"& > *:not(:last-child)::after\": {\n content: `\"${separator}\"`,\n color: (listener) =>\n themeColor(listener, \"shift-4\", color.get(listener)),\n paddingInlineStart: themeSpacing(1),\n },\n \"& > [aria-current=page]\": {\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n pointerEvents: \"none\",\n },\n },\n };\n}\n\nexport { breadcrumb };\n","import type { PartialElement } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * An ellipsis trigger button for collapsed breadcrumb items, with hover and\n * focus-visible states. Apply to a `<button>` element.\n *\n * @hostTag button\n * @param props.color - Color tone for the trigger. Optional `ValueOrState<ThemeColor>`, default \"neutral\".\n * @example { button: \"…\", $: [breadcrumbEllipsis({ color: \"neutral\" })] }\n */\nfunction breadcrumbEllipsis(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"button\") {\n console.warn('\"breadcrumbEllipsis\" patch must use button tag');\n }\n },\n ariaLabel: \"More breadcrumb items\",\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n paddingInline: themeSpacing(1),\n border: \"none\",\n background: \"none\",\n cursor: \"pointer\",\n color: (listener) => themeColor(listener, \"muted\", color.get(listener)),\n borderRadius: themeSpacing(1),\n transition:\n \"color 140ms ease, background-color 140ms ease, box-shadow 140ms ease\",\n \"&:hover\": {\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"hover\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color.get(listener)),\n },\n },\n };\n}\n\nexport { breadcrumbEllipsis };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { BUTTON_SIZE_FONT, type ButtonSize } from \"../utils/buttonSize.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\nimport { buttonGhost } from \"./buttonGhost.js\";\n\ntype ButtonVariant = \"solid\" | \"outline\" | \"ghost\";\n\nconst PADDING_STEPS: Record<ButtonSize, { block: number; inline: number }> = {\n small: { block: 0.5, inline: 2 },\n medium: { block: 1, inline: 3 },\n large: { block: 1.5, inline: 4 },\n};\n\n/**\n * A themed button control with density-aware padding/radius and hover, pressed\n * (`:active` ±2), focus-visible, `[disabled]`, and `[aria-busy=true]` states.\n * Apply to a `<button>` element.\n *\n * @hostTag button\n * @param props.color - Button color tone. Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @param props.variant - Visual style: `\"outline\"` (tinted background + outline, default,\n * backward compatible), `\"solid\"` (filled background, readable contrast text), or `\"ghost\"`\n * (no background/border — delegates to `buttonGhost()` so the two stay visually identical).\n * @param props.size - Button size preset. Optional `\"small\" | \"medium\" | \"large\"`, defaults to `\"medium\"`.\n * @example { button: \"Save\", $: [button({ color: \"primary\" })] }\n * @example { button: \"Delete\", $: [button({ color: \"error\", variant: \"solid\" })] }\n */\nfunction button(\n props: {\n color?: ValueOrState<ThemeColor>;\n variant?: ButtonVariant;\n size?: ButtonSize;\n } = {},\n): PartialElement {\n const variant = props.variant ?? \"outline\";\n if (variant === \"ghost\") {\n return buttonGhost({ color: props.color, size: props.size });\n }\n\n const color = toState(props.color ?? \"primary\", \"color\");\n const isSolid = variant === \"solid\";\n const padding = PADDING_STEPS[props.size ?? \"medium\"];\n const fontSize = BUTTON_SIZE_FONT[props.size ?? \"medium\"];\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"button\") {\n console.warn(`\"button\" primitive patch must use button tag`);\n }\n },\n // Solid: deep brand fill (shift-13) + light-end neutral text (shift-0).\n // Mid-ramp shift-8 failed WCAG (~2.2:1 white-on-medium). NOT dataTone-17\n // (that collapsed every color into a near-black pill). Outline text:\n // shift-13 for ≥4.5:1 on light surfaces (shift-9 failed at ~2.57).\n ...(isSolid\n ? {\n _doctorDisable: [\n \"low-contrast\",\n \"color-shift-minimum\",\n \"tone-background-inherit\",\n ] as const,\n }\n : {}),\n style: {\n appearance: \"none\",\n fontSize: (listener) => themeSize(listener, fontSize),\n // Single-line bounded control: block/radius = 1D, inline = 3D.\n paddingBlock: (listener) =>\n themeSpacing(themeDensity(listener) * padding.block),\n paddingInline: (listener) =>\n themeSpacing(themeDensity(listener) * padding.inline),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n width: \"fit-content\",\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gap: (listener) => themeSpacing(themeDensity(listener) * 1),\n userSelect: \"none\",\n cursor: \"pointer\",\n fontFamily: \"inherit\",\n lineHeight: \"inherit\",\n border: \"none\",\n outlineOffset: \"-1px\",\n outlineWidth: \"1px\",\n outline: isSolid\n ? \"none\"\n : (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n color: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-0\", \"neutral\")\n : themeColor(listener, \"shift-13\", color.get(listener)),\n backgroundColor: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-13\", color.get(listener))\n : themeColor(listener, \"inherit\", color.get(listener)),\n transition:\n \"background-color 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease\",\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n color: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-0\", \"neutral\")\n : themeColor(listener, \"shift-14\", color.get(listener)),\n backgroundColor: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-14\", color.get(listener))\n : themeColor(listener, \"hover\", color.get(listener)),\n },\n // Pressed: solid steps deeper on the brand ramp; outline uses +2 surface.\n \"&:active:not([disabled]):not([aria-busy=true])\": {\n backgroundColor: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-15\", color.get(listener))\n : themeColor(listener, \"increase-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n },\n \"&[aria-busy=true]\": {\n opacity: 0.7,\n cursor: \"wait\",\n pointerEvents: \"none\",\n },\n },\n };\n}\n\nexport { button };\nexport type { ButtonVariant };\n","/**\n * The `fontSize` step for `button()`/`buttonGhost()`'s `size` prop. Padding stays\n * per-component (button and buttonGhost start from different base paddings) so\n * only the part that's genuinely identical — the font-size step — lives here.\n */\nconst BUTTON_SIZE_FONT = {\n small: \"decrease-1\",\n medium: \"inherit\",\n large: \"increase-1\",\n} as const;\n\ntype ButtonSize = keyof typeof BUTTON_SIZE_FONT;\n\nexport { BUTTON_SIZE_FONT };\nexport type { ButtonSize };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { BUTTON_SIZE_FONT, type ButtonSize } from \"../utils/buttonSize.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\nconst PADDING_STEPS: Record<ButtonSize, number> = {\n small: 0.5,\n medium: 1,\n large: 1.5,\n};\n\n/**\n * A transparent button with no border or background — suitable for icon\n * actions, inline controls, and delete/close triggers. Apply to a `<button>`\n * element.\n *\n * @hostTag button\n * @param props.color - Text color tone. Optional `ValueOrState<ThemeColor>`, defaults to `\"neutral\"`.\n * @param props.size - Button size preset. Optional `\"small\" | \"medium\" | \"large\"`, defaults to `\"medium\"`.\n * @example { button: \"×\", $: [buttonGhost()] }\n * @example { button: { span: null, $: [icon({ name: \"trash\" })] }, $: [buttonGhost({ color: \"error\" })] }\n */\nfunction buttonGhost(\n props: { color?: ValueOrState<ThemeColor>; size?: ButtonSize } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const padding = PADDING_STEPS[props.size ?? \"medium\"];\n const fontSize = BUTTON_SIZE_FONT[props.size ?? \"medium\"];\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"button\") {\n console.warn(`\"buttonGhost\" primitive patch must use button tag`);\n }\n },\n style: {\n appearance: \"none\",\n fontSize: (listener) => themeSize(listener, fontSize),\n paddingBlock: (listener) =>\n themeSpacing(themeDensity(listener) * padding),\n paddingInline: (listener) =>\n themeSpacing(themeDensity(listener) * padding),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n display: \"inline-flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gap: (listener) => themeSpacing(themeDensity(listener) * 1),\n userSelect: \"none\",\n cursor: \"pointer\",\n fontFamily: \"inherit\",\n lineHeight: \"inherit\",\n border: \"none\",\n background: \"none\",\n outline: \"none\",\n transition:\n \"background-color 140ms ease, color 140ms ease, box-shadow 140ms ease\",\n color: (listener) => themeColor(listener, \"shift-6\", color.get(listener)),\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"hover\", color.get(listener)),\n },\n \"&:active:not([disabled]):not([aria-busy=true])\": {\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"increase-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"border-strong\", \"neutral\"),\n },\n \"&[aria-busy=true]\": {\n opacity: 0.7,\n cursor: \"wait\",\n pointerEvents: \"none\",\n },\n },\n };\n}\n\nexport { buttonGhost };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * A pill-shaped toggle switch with `role=\"switch\"`; clicking flips the bound\n * `checked` state and slides the thumb. Apply to a `<button>` element.\n *\n * @hostTag button\n * @param props.checked - Toggle state. Optional `ValueOrState<boolean>`, default false.\n * @param props.accentColor - Color tone when checked (on). Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @param props.color - Color tone when unchecked (off track). Optional `ValueOrState<ThemeColor>`, default \"neutral\".\n * @example { button: { span: null }, $: [buttonSwitch({ checked: true })] }\n */\nfunction buttonSwitch(\n props: {\n checked?: ValueOrState<boolean>;\n accentColor?: ValueOrState<ThemeColor>;\n color?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const { checked = false } = props;\n\n const check = toState(checked);\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n _onSchedule: (node) => {\n if (node.tagName !== \"button\") {\n console.warn(`\"buttonSwitch\" primitive patch must use button tag`);\n }\n },\n role: \"switch\",\n ariaChecked: (listener) => check.get(listener),\n dataTone: \"shift-2\",\n onClick: () => check.set(!check.get()),\n style: {\n position: \"relative\",\n display: \"inline-flex\",\n alignItems: \"center\",\n fontSize: (listener) => themeSize(listener),\n border: \"none\",\n outlineWidth: \"1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border\", color.get(listener))}`,\n minWidth: themeSpacing(12),\n minHeight: themeSpacing(6),\n borderRadius: themeSpacing(999),\n paddingLeft: themeSpacing(7),\n paddingRight: themeSpacing(2),\n cursor: \"pointer\",\n transition:\n \"padding-left 0.3s, padding-right 0.3s, background-color 140ms ease, box-shadow 140ms ease\",\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"& > :first-child\": {\n content: '\"\"',\n position: \"absolute\",\n display: \"inline-flex\",\n alignItems: \"center\",\n left: themeSpacing(0.5),\n top: \"50%\",\n transform: \"translateY(-50%)\",\n transition: \"left 0.3s\",\n width: themeSpacing(5),\n height: themeSpacing(5),\n borderRadius: themeSpacing(999),\n color: (listener) => themeColor(listener, \"text\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"decrease-2\", color.get(listener)),\n },\n \"&[aria-checked=true]\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"increase-3\", accentColor.get(listener)),\n outline: \"none\",\n color: (listener) => themeColor(listener, \"decrease-2\"),\n paddingLeft: themeSpacing(2),\n paddingRight: themeSpacing(7),\n },\n \"&[aria-checked=true] > :first-child\": {\n left: `calc(100% - ${themeSpacing(5.5)})`,\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n },\n },\n };\n}\n\nexport { buttonSwitch };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\n\n/**\n * A grid-based card surface that auto-places known child elements into named\n * regions: `<img>` (image), headings (title), `<p>` (description), `<aside>`\n * (aside), `<div>` (content), and `<footer>` (footer). Typically applied to a\n * `<div>` (any block container).\n *\n * @param props.color - Surface/border color tone. Optional `ValueOrState<ThemeColor>`, default \"neutral\".\n * @example { div: { h3: \"Title\", p: \"Body\" }, $: [card({ color: \"neutral\" })] }\n */\nfunction card(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n return {\n // Title weight is design-system chrome for the card region layout.\n _doctorDisable: \"inline-typography\",\n style: {\n display: \"grid\",\n gridTemplateColumns: \"1fr auto\",\n gridTemplateAreas:\n '\"image image\" \"title aside\" \"desc aside\" \"content content\" \"footer footer\"',\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n outlineOffset: \"-1px\",\n // Soft lift so cards separate from the page without looking like dialogs.\n boxShadow: elevation(\"low\"),\n overflow: \"hidden\",\n \"& > img\": {\n gridArea: \"image\",\n width: \"100%\",\n height: \"auto\",\n display: \"block\",\n },\n \"& > :is(h1,h2,h3,h4,h5,h6)\": {\n gridArea: \"title\",\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n fontWeight: \"600\",\n color: (listener) =>\n themeColor(listener, \"shift-11\", color.get(listener)),\n margin: 0,\n },\n \"& > p\": {\n gridArea: \"desc\",\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n paddingBottom: (listener) => themeSpacing(themeDensity(listener) * 2),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n margin: 0,\n },\n \"& > aside\": {\n gridArea: \"aside\",\n alignSelf: \"center\",\n padding: (listener) => themeSpacing(themeDensity(listener) * 2),\n height: \"auto\",\n },\n \"& > div\": {\n gridArea: \"content\",\n padding: (listener) => themeSpacing(themeDensity(listener) * 4),\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n },\n \"& > footer\": {\n gridArea: \"footer\",\n display: \"flex\",\n gap: themeSpacing(2),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n borderTop: (listener) =>\n `1px solid ${themeColor(listener, \"border\", color.get(listener))}`,\n },\n },\n };\n}\n\nexport { card };\n","/** Named elevation levels for floating/raised surfaces. */\ntype ElevationLevel = \"low\" | \"medium\" | \"high\";\n\n// Layered soft shadows (a tight contact shadow + a broad ambient one), black at\n// low alpha so the same value reads correctly on both light and dark surfaces\n// without a theme/context lookup.\nconst SHADOWS: Record<ElevationLevel, string> = {\n low: \"0 1px 2px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.10)\",\n medium: \"0 2px 4px rgba(0,0,0,0.10), 0 10px 24px rgba(0,0,0,0.14)\",\n high: \"0 6px 12px rgba(0,0,0,0.14), 0 24px 48px rgba(0,0,0,0.20)\",\n};\n\n/**\n * Shared box-shadow value for a named elevation level. Used by floating/raised\n * surface patches (popover, menu, dialog, drawer, toast, tooltip, combobox/\n * selectBox dropdown, datePicker popup, fab) so elevation reads consistently\n * across the library instead of each patch picking its own shadow.\n */\nfunction elevation(level: ElevationLevel): string {\n return SHADOWS[level];\n}\n\nexport { elevation };\nexport type { ElevationLevel };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles an inline code snippet with a subtle surface background, rounded corners,\n * and shifted tone. Apply to a `<code>` element.\n *\n * @hostTag code\n * @param props.color - Surface/text color tone. Optional `ValueOrState<ThemeColor>`, default \"neutral\".\n * @example { code: \"npm install\", $: [code({ color: \"neutral\" })] }\n */\nfunction code(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n dataTone: \"shift-2\",\n _onInsert: (node) => {\n if (node.tagName !== \"code\") {\n console.warn(`\"code\" primitive patch must use code tag`);\n }\n },\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n whiteSpace: \"nowrap\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n height: themeSpacing(6),\n paddingInline: themeSpacing(1.5),\n borderRadius: themeSpacing(1),\n },\n };\n}\n\nexport { code };\n","import {\n type DomphyElement,\n merge,\n type PartialElement,\n type StyleObject,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport type { Placement } from \"@domphy/floating\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { createFloating } from \"../utils/floating.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\nimport { tag } from \"./tag.js\";\n\n/**\n * A combobox/multi-select control: renders selected options as removable tags\n * plus an input, and shows a floating popover (`content`) anchored to the host.\n * Apply to a `<div>` element.\n *\n * @hostTag div\n * @param props.multiple - Allow selecting multiple values (popover stays open on click). Optional `boolean`, default false.\n * @param props.value - Selected value(s). Optional `ValueOrState<Array<number | string | null | undefined> | number | string | null | undefined>`, no default.\n * @param props.options - Available `{ label, value }` options used to render selected tags. Optional `Array<{ label: string; value: string }>`, default `[]`.\n * @param props.placement - Floating popover placement. Optional `ValueOrState<Placement>`, default \"bottom\".\n * @param props.content - The floating popover content element. Required `DomphyElement`.\n * @param props.color - Color tone for the control. Optional `ThemeColor`, default \"neutral\".\n * @param props.open - Whether the popover is open. Optional `ValueOrState<boolean>`, default false.\n * @param props.input - Custom input element; when omitted a default `<input>` is created. Optional `DomphyElement`.\n * @example { div: null, $: [combobox({ options: [{ label: \"A\", value: \"a\" }], content: { div: null } })] }\n */\nfunction combobox(props: {\n multiple?: boolean;\n value?: ValueOrState<\n | Array<number | string | null | undefined>\n | number\n | string\n | null\n | undefined\n >;\n options?: Array<{ label: string; value: string }>;\n placement?: ValueOrState<Placement>;\n content: DomphyElement;\n color?: ThemeColor;\n open?: ValueOrState<boolean>;\n input?: DomphyElement;\n}): PartialElement {\n const {\n options = [],\n placement = \"bottom\",\n color = \"neutral\",\n open = false,\n multiple = false,\n } = props;\n\n const state = toState(props.value);\n const openState = toState(open);\n const { show, hide, anchorPartial } = createFloating({\n kind: \"combobox\",\n open: openState,\n placement: toState(placement),\n content: props.content,\n });\n\n const popoverPartial: PartialElement = {\n onClick: (_e, node) => !multiple && hide(node),\n dataTone: \"shift-14\",\n style: {\n backgroundColor: (listener) => themeColor(listener, \"inherit\"),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\")}`,\n outlineOffset: \"-1px\",\n boxShadow: elevation(\"medium\"),\n },\n };\n\n merge(props.content, popoverPartial);\n\n const inputStyle: StyleObject = {\n border: \"none\",\n outline: \"none\",\n padding: 0,\n margin: 0,\n flex: 1,\n height: themeSpacing(6),\n marginInlineStart: themeSpacing(2),\n fontSize: (listener: any) => themeSize(listener, \"inherit\"),\n color: (listener: any) => themeColor(listener, \"text\", color),\n backgroundColor: (listener: any) => themeColor(listener, \"inherit\", color),\n };\n\n let inputElement: DomphyElement;\n if (props.input) {\n const inputPartial: PartialElement = {\n onFocus: (_e, node) => show(node),\n style: inputStyle,\n _key: \"combobox-input\",\n };\n merge(props.input, inputPartial);\n inputElement = props.input;\n } else {\n inputElement = {\n input: null,\n onFocus: (_e, node) => show(node),\n value: (listener: any) => {\n state.get(listener);\n return \"\";\n },\n style: inputStyle,\n _key: \"combobox-input\",\n };\n }\n\n const wrap: DomphyElement<\"div\"> = {\n div: (listener) => {\n const val = state.get(listener);\n const vals = Array.isArray(val) ? val : [val];\n const opts = options.filter((opt) => vals.includes(opt.value));\n const items: DomphyElement[] = opts.map((opt) => {\n return {\n span: opt.label,\n $: [tag({ color, removable: true })],\n _key: opt.value,\n _onRemove: (_node) => {\n const cur = state.get();\n const curVals = Array.isArray(cur) ? cur : [cur];\n const filter = curVals.filter((v) => v !== opt.value);\n multiple ? state.set(filter as any) : state.set(filter[0] as any);\n },\n };\n });\n items.push(inputElement);\n return items;\n },\n style: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: themeSpacing(1),\n },\n };\n\n const partial: PartialElement = {\n _onInsert: (node) => {\n if (node.tagName !== \"div\") {\n console.warn(`\"combobox\" primitive patch must use div tag`);\n }\n },\n _onInit: (node) => node.children.insert(wrap),\n style: {\n minWidth: themeSpacing(32),\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 1),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n transition:\n \"background-color 140ms ease, outline-color 140ms ease, box-shadow 140ms ease\",\n \"&:focus-within\": {\n boxShadow: (listener) => focusRing(listener, color),\n },\n },\n };\n\n merge(anchorPartial, partial);\n return anchorPartial;\n}\n\nexport { combobox };\n","import {\n type BehaviorInstance,\n behavior,\n type DomphyElement,\n type ElementNode,\n merge,\n type PartialElement,\n type State,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n autoUpdate,\n computePosition,\n flip,\n offset,\n type Placement,\n shift,\n} from \"@domphy/floating\";\n\ntype FloatingProps = {\n openState: State<boolean>;\n placement: State<Placement>;\n content: DomphyElement;\n // popover's openOn === \"hover\" case: hovering the floating PANEL itself\n // (not just the anchor) must keep it open, so the pointer can travel from\n // trigger to panel without the debounced hide() firing first.\n keepOpenOnContentHover: boolean;\n};\n\ntype FloatingInstance = BehaviorInstance<FloatingProps> & {\n show: () => void;\n hide: () => void;\n};\n\n// The per-anchor persistent state a floating component needs (position\n// cleanup, the inserted panel node, debounce timer) used to live in\n// createFloating()'s own closure — but that closure is recreated fresh every\n// time a reactive ancestor re-renders the anchor (popover()/tooltip() called\n// again on the SAME reused DOM element). Only the FIRST-ever generation's\n// _onMount ever fires (ElementNode hooks run once per node), so imperative,\n// document-level listeners (outside-click, Escape-inside-panel) that closed\n// over that generation's `openState`/`reference`/`floating` kept acting on an\n// orphaned copy forever, while live-rebound trigger events (onClick etc.)\n// moved on to whatever generation was actually current — the trigger opened\n// the panel, but nothing could ever close it again from outside.\n//\n// Fixed by moving all of this into ONE `behavior()` instance per (anchor,\n// kind): `attach` runs once, and every later generation's `show`/`hide`\n// calls and `_behaviors` re-declaration route into that SAME instance via\n// `getBehavior`/`update()` — so there is exactly one canonical `openState`/\n// `reference`/`floating` for the anchor's whole lifetime, not one per\n// generation.\nfunction attachFloating(\n node: ElementNode,\n initialProps: FloatingProps,\n): FloatingInstance {\n let { openState, placement, content, keepOpenOnContentHover } = initialProps;\n\n let timer: ReturnType<typeof setTimeout> | null = null;\n let cleanup: (() => void) | null = null;\n let floating: HTMLElement | null = null;\n let floatingNode: ElementNode | null = null;\n let mounted = false;\n\n const reference = node.domElement as HTMLElement;\n const rootNode = node.getRoot();\n\n const floatingPartial: PartialElement = {\n style: {\n position: \"fixed\",\n pointerEvents: \"auto\",\n visibility: (listener) =>\n openState.get(listener) ? \"visible\" : \"hidden\",\n },\n // Escape must dismiss the panel from INSIDE it too: the content is\n // portaled as a DOM sibling of the anchor, so a keydown on a focused\n // element within the panel (menu item, calendar cell, footer button)\n // never bubbles to the anchor's own Escape handler.\n onKeyDown: (event) => {\n if ((event as KeyboardEvent).key === \"Escape\") hide();\n },\n onMouseEnter: () => keepOpenOnContentHover && show(),\n onMouseLeave: () => keepOpenOnContentHover && hide(),\n _onMount: (mountedNode) => {\n floating = mountedNode.domElement as HTMLElement;\n // Propagate data-theme from the trigger's ancestor so floating content\n // inherits CSS variable scope. Stamped on the PANEL, not the shared\n // overlay: the one overlay serves every floating component under the\n // root, so an overlay-level stamp would let whichever anchor opened\n // FIRST permanently impose its theme on later panels anchored under a\n // different [data-theme] scope. Skipped when the content declares its\n // own data-theme.\n if (reference && floating && !floating.hasAttribute(\"data-theme\")) {\n const dataTheme = reference\n .closest(\"[data-theme]\")\n ?.getAttribute(\"data-theme\");\n if (dataTheme) floating.setAttribute(\"data-theme\", dataTheme);\n }\n },\n _portal: (rNode) => {\n let overlay = rNode.domElement!.querySelector(`#domphy-floating`);\n if (!overlay) {\n const overlayEle: DomphyElement<\"div\"> = {\n div: [],\n id: `domphy-floating`,\n style: {\n position: \"fixed\",\n inset: 0,\n zIndex: 20,\n pointerEvents: \"none\",\n },\n };\n const overlayNode = rNode.children!.insert(overlayEle) as ElementNode;\n overlay = overlayNode.domElement!;\n }\n return overlay;\n },\n };\n\n // Later generations declare their OWN fresh `content` object (a new object\n // literal at the popover()/tooltip() call site) — wire it every time, not\n // just at attach, so the panel wiring (theming, portal, dismiss handlers)\n // is present regardless of which generation's content ends up mounted.\n const wireContent = (target: DomphyElement) => merge(target, floatingPartial);\n wireContent(content);\n\n const ensureMounted = () => {\n if (mounted) return;\n mounted = true;\n floatingNode = rootNode.children!.insert(content) as ElementNode;\n };\n\n const instantShow = () => {\n ensureMounted();\n if (reference && floating) {\n cleanup?.();\n cleanup = autoUpdate(reference, floating, () => {\n computePosition(reference as HTMLElement, floating as HTMLElement, {\n placement: placement.get() as Placement,\n middleware: [offset(12), flip(), shift()],\n strategy: \"fixed\",\n }).then(({ x, y, placement: resolved }) => {\n // Teardown can run while computePosition's async work is in\n // flight (it nulls `floating` and removes the panel) — skip the\n // late positioning instead of dereferencing null.\n if (!floating) return;\n Object.assign(floating.style, {\n left: `${x}px`,\n top: `${y}px`,\n });\n placement.set(resolved);\n });\n });\n openState.set(true);\n }\n };\n // Fully unmounts (not just CSS-hides) the panel — mirrors show()'s own\n // insert-on-demand: a closed floating component holds no DOM/listeners.\n // ensureMounted() re-inserts a fresh panel node next time show() runs.\n const instantHide = () => {\n cleanup?.();\n cleanup = null;\n if (floatingNode) {\n floatingNode.remove();\n floatingNode = null;\n }\n floating = null;\n mounted = false;\n openState.set(false);\n };\n const show = () => {\n timer && clearTimeout(timer);\n timer = setTimeout(instantShow, 100);\n };\n const hide = () => {\n timer && clearTimeout(timer);\n timer = setTimeout(instantHide, 100);\n };\n\n const handleOutside = (event: MouseEvent) => {\n if (!openState.get() || !reference || !floating) return;\n const target = event.target as Node;\n if (!reference.contains(target) && !floating.contains(target)) hide();\n };\n rootNode.domElement?.addEventListener(\"click\", handleOutside);\n\n return {\n show,\n hide,\n update(props) {\n openState = props.openState;\n placement = props.placement;\n content = props.content;\n keepOpenOnContentHover = props.keepOpenOnContentHover;\n wireContent(content);\n // Reflect the new generation's declared content into the already-\n // mounted panel in place (same DOM node, no flicker/teardown) — the\n // ordinary reused-node \"patch, don't recreate\" contract, applied to\n // the imperatively-inserted panel too.\n if (floatingNode) floatingNode.patch(content);\n },\n destroy() {\n if (timer) clearTimeout(timer);\n cleanup?.();\n floatingNode?.remove();\n rootNode.domElement?.removeEventListener(\"click\", handleOutside);\n },\n };\n}\n\nfunction createFloating(props: {\n kind: string;\n open?: ValueOrState<boolean>;\n placement: State<Placement>;\n content: DomphyElement;\n keepOpenOnContentHover?: boolean;\n}) {\n const { kind, open = false, placement } = props;\n const openState = toState(open);\n const behaviorKey = `floating:${kind}`;\n\n // Trigger event handlers ARE live-rebound on every patch and already\n // receive the current ElementNode as their 2nd argument (unlike lifecycle\n // hooks) — so show(node)/hide(node) just forward to whatever instance is\n // attached there, regardless of which generation's closure is calling.\n const show = (node?: ElementNode) =>\n node?.getBehavior<FloatingInstance>(behaviorKey)?.show();\n const hide = (node?: ElementNode) =>\n node?.getBehavior<FloatingInstance>(behaviorKey)?.hide();\n\n // Plain spread, NOT merge(): merge() defensively deep-clones its `target`\n // argument, which would snapshot `props.content` right now — but the\n // caller (popover()/tooltip()) hasn't finished mutating it yet (it pushes\n // its OWN partial onto `content.$` right after this call returns). A\n // premature clone silently drops that later mutation, so the panel loses\n // its role/style/dismiss wiring. Spread keeps the `_behaviors` record's\n // `props.content` a live reference to the SAME object the caller mutates.\n const anchorPartial: PartialElement = {\n onKeyDown: (e: Event, node: ElementNode) =>\n (e as KeyboardEvent).key === \"Escape\" && hide(node),\n ...behavior<FloatingProps>(behaviorKey, attachFloating, {\n openState,\n placement,\n content: props.content,\n keepOpenOnContentHover: !!props.keepOpenOnContentHover,\n }),\n };\n\n return { show, hide, anchorPartial };\n}\n\nexport { createFloating };\n","import type { DomphyElement, PartialElement } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\nconst xSvg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M6.707 5.293l5.293 5.292l5.293 -5.292a1 1 0 0 1 1.414 1.414l-5.292 5.293l5.292 5.293a1 1 0 0 1 -1.414 1.414l-5.293 -5.292l-5.293 5.292a1 1 0 1 1 -1.414 -1.414l5.292 -5.293l-5.292 -5.293a1 1 0 0 1 1.414 -1.414\" /></svg>`;\n\n/**\n * Styles an inline chip/tag (rounded, bordered, optional remove button).\n * No host tag check; typically applied to a `<span>`. When `removable` is true,\n * a close button is inserted that removes the host node on click.\n *\n * @hostTag span\n * @param props.color - Theme color for the chip background/border/text. Optional, accepts a value or state. Defaults to `\"neutral\"`.\n * @param props.removable - When true, renders a remove (x) button that removes the tag on click. Optional. Defaults to `false`.\n * @example { span: \"Label\", $: [tag({ removable: true })] }\n */\nfunction tag(\n props: { color?: ValueOrState<ThemeColor>; removable?: boolean } = {},\n): PartialElement {\n const { removable = false } = props;\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n dataTone: \"shift-2\",\n _onInit: (node) => {\n const removeBtn: DomphyElement<\"span\"> = {\n span: xSvg,\n onClick: (e) => {\n (e as Event).stopPropagation();\n node.remove();\n },\n tabindex: 0,\n role: \"button\",\n ariaLabel: \"Remove\",\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n cursor: \"pointer\",\n borderRadius: themeSpacing(1),\n width: themeSpacing(4),\n height: themeSpacing(4),\n flexShrink: 0,\n transition: \"background-color 140ms ease, box-shadow 140ms ease\",\n \"&:hover\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-4\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color.get(listener)),\n },\n },\n };\n\n removable && node.children.insert(removeBtn);\n },\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n whiteSpace: \"nowrap\",\n userSelect: \"none\",\n height: themeSpacing(6),\n paddingBlock: 0,\n borderRadius: themeSpacing(999),\n paddingInlineStart: themeSpacing(2.5),\n paddingInlineEnd: removable ? themeSpacing(1) : themeSpacing(2.5),\n gap: themeSpacing(1.5),\n fontSize: (listener) => themeSize(listener, \"decrease-1\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n },\n };\n}\n\nexport { tag };\n","import { merge, type PartialElement, toState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Command-palette container patch. Sets up a vertical flex column and provides a\n * shared `command` context (a query State) consumed by `commandSearch` and\n * `commandItem` descendants to filter the list. Typically applied to a `<div>`.\n *\n * @example { div: [...], $: [command()] }\n */\nfunction command(): PartialElement {\n return {\n _onSchedule: (_node, element) => {\n merge(element, {\n _context: {\n command: {\n query: toState(\"\"),\n },\n },\n });\n },\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n overflow: \"hidden\",\n },\n };\n}\n\n/**\n * Search input for a command palette. Wires the input's value into the parent\n * `command` context's query State so descendant `commandItem`s filter live.\n * Apply to an `<input>` element used inside a `command()`.\n *\n * @hostTag input\n * @param props.color - Base theme color tone. Defaults to \"neutral\".\n * @param props.accentColor - Accent color used for the focus border. Defaults to \"primary\".\n * @example { input: \"\", $: [commandSearch({ accentColor: \"primary\" })] }\n */\nfunction commandSearch(\n props: { color?: ThemeColor; accentColor?: ThemeColor } = {},\n): PartialElement {\n const { color = \"neutral\", accentColor = \"primary\" } = props;\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"commandSearch\" patch must use input tag`);\n }\n },\n _onMount: (node) => {\n const ctx = node.getContext(\"command\");\n if (!ctx) {\n console.warn(`\"commandSearch\" patch must be used inside a \"command\"`);\n return;\n }\n const input = node.domElement as HTMLInputElement;\n const onInput = () => ctx.query.set(input.value);\n input.addEventListener(\"input\", onInput);\n node.addHook(\"Remove\", () => input.removeEventListener(\"input\", onInput));\n },\n style: {\n fontFamily: \"inherit\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n border: \"none\",\n borderBottom: (listener) =>\n `1px solid ${themeColor(listener, \"border\", color)}`,\n outline: \"none\",\n color: (listener) => themeColor(listener, \"shift-10\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n \"&::placeholder\": {\n color: (listener) => themeColor(listener, \"shift-7\"),\n },\n transition: \"border-bottom-color 140ms ease, box-shadow 140ms ease\",\n \"&:focus-visible\": {\n borderBottomColor: (listener) =>\n themeColor(listener, \"shift-6\", accentColor),\n boxShadow: (listener) => focusRing(listener, accentColor),\n },\n },\n };\n}\n\n/**\n * Selectable item (`role=\"option\"`) in a command palette. On mount, immediately\n * hides itself if the current query doesn't match its text content, and subscribes\n * to future query changes — so items added dynamically after a search is typed are\n * correctly filtered. Typically applied to a `<button>` (or any clickable element)\n * used inside a `command()`.\n *\n * @param props.color - Base theme color tone. Defaults to \"neutral\".\n * @param props.accentColor - Accent color used for the focus ring. Defaults to \"primary\".\n * @example { button: \"Open file\", $: [commandItem({ color: \"neutral\" })] }\n */\nfunction commandItem(\n props: { color?: ThemeColor; accentColor?: ThemeColor } = {},\n): PartialElement {\n const { color = \"neutral\", accentColor = \"primary\" } = props;\n return {\n role: \"option\",\n _onMount: (node) => {\n const ctx = node.getContext(\"command\");\n if (!ctx) {\n console.warn(`\"commandItem\" patch must be used inside a \"command\"`);\n return;\n }\n const el = node.domElement as HTMLElement;\n const text = el.textContent?.toLowerCase() ?? \"\";\n const applyFilter = (q: string) => {\n el.hidden = q.length > 0 && !text.includes(q.toLowerCase());\n };\n applyFilter(ctx.query.get());\n const release = ctx.query.addListener(applyFilter);\n node.addHook(\"Remove\", release);\n },\n style: {\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n width: \"100%\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n border: \"none\",\n outline: \"none\",\n // shift-13: menu-row labels need ≥4.5:1 on light surface (visual catalog).\n color: (listener) => themeColor(listener, \"shift-13\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n transition: \"background-color 140ms ease, box-shadow 140ms ease\",\n \"&:hover:not([disabled])\": {\n color: (listener) => themeColor(listener, \"shift-13\", color),\n backgroundColor: (listener) => themeColor(listener, \"hover\", color),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor),\n },\n },\n };\n}\n\nexport { command, commandSearch, commandItem };\n","import {\n type DomphyElement,\n type ElementNode,\n type Listener,\n merge,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport type { Placement } from \"@domphy/floating\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { createFloating } from \"../utils/floating.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/** A single date selection, or a `[start, end]` tuple in range mode. */\nexport type DatePickerValue = Date | null | [Date | null, Date | null];\n\nexport interface DatePickerProps {\n /** Controlled value: a `Date` in single mode, a `[start, end]` tuple in range mode. */\n value?: ValueOrState<DatePickerValue>;\n /** Selection mode. */\n mode?: \"single\" | \"range\";\n /** Also pick hour + minute. The chosen time applies to the selected date(s). */\n time?: boolean;\n /** Earliest selectable day (inclusive). */\n min?: Date;\n /** Latest selectable day (inclusive). */\n max?: Date;\n /** Disable arbitrary days. */\n disabledDate?: (date: Date) => boolean;\n /** BCP-47 locale for month/weekday names, first-day-of-week, and formatting. */\n locale?: string;\n /** Override the first day of the week (0 = Sunday … 6 = Saturday). */\n weekStartsOn?: number;\n /** Override the input display string. */\n format?: (value: DatePickerValue) => string;\n /** Called whenever the selection changes. */\n onChange?: (value: DatePickerValue) => void;\n /** Accent color for the selected/active days. */\n accentColor?: ValueOrState<ThemeColor>;\n /** Popover placement relative to the input. */\n placement?: ValueOrState<Placement>;\n}\n\n// --- date helpers (no third-party library) -----------------------------------\n\nconst atMidnight = (date: Date): Date =>\n new Date(date.getFullYear(), date.getMonth(), date.getDate());\nconst addDays = (date: Date, count: number): Date =>\n new Date(date.getFullYear(), date.getMonth(), date.getDate() + count);\nconst addMonths = (date: Date, count: number): Date =>\n new Date(date.getFullYear(), date.getMonth() + count, date.getDate());\nconst sameDay = (a: Date | null, b: Date | null): boolean =>\n !!a &&\n !!b &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate();\nconst isoOf = (date: Date): string =>\n `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, \"0\")}-${String(\n date.getDate(),\n ).padStart(2, \"0\")}`;\nconst startOfWeek = (date: Date, weekStart: number): Date =>\n addDays(date, -((date.getDay() - weekStart + 7) % 7));\n\n/** Resolves the locale's first day of week, falling back to Sunday. */\nfunction localeWeekStart(locale: string): number {\n try {\n const localeObject = new Intl.Locale(locale) as Intl.Locale & {\n weekInfo?: { firstDay: number };\n getWeekInfo?: () => { firstDay: number };\n };\n const info = localeObject.getWeekInfo?.() ?? localeObject.weekInfo;\n if (info?.firstDay) return info.firstDay % 7; // Intl uses 1=Mon … 7=Sun\n } catch {\n // unsupported locale or engine — fall through to Sunday\n }\n return 0;\n}\n\n/**\n * A native, themeable date picker patch for an `<input>`. Opens a calendar\n * popover (rendered with Domphy elements, positioned via `@domphy/floating`)\n * supporting single/range selection, optional time, min/max + disabled days,\n * localized names, and keyboard navigation. The input is read-only and shows the\n * formatted selection; compose with `inputText()` for the input's look.\n *\n * @hostTag input\n * @param props.value - Controlled value (`ValueOrState<DatePickerValue>`): a `Date`/`null` in single mode, a `[start, end]` tuple in range mode.\n * @param props.mode - Selection mode, \"single\" | \"range\". Defaults to \"single\".\n * @param props.time - When true, also pick hour + minute (applied to the selected date(s)). Defaults to false.\n * @param props.min - Earliest selectable day (inclusive), a `Date`.\n * @param props.max - Latest selectable day (inclusive), a `Date`.\n * @param props.disabledDate - Predicate `(date: Date) => boolean` to disable arbitrary days.\n * @param props.locale - BCP-47 locale for names/first-day-of-week/formatting. Defaults to `navigator.language` (or \"en-US\" in non-browser).\n * @param props.weekStartsOn - Override first day of week (0 = Sunday … 6 = Saturday). Defaults to the locale's first day.\n * @param props.format - Override the input display string, `(value: DatePickerValue) => string`.\n * @param props.onChange - Called with the new value whenever the selection changes, `(value: DatePickerValue) => void`.\n * @param props.accentColor - Accent color (`ValueOrState<ThemeColor>`) for selected/active days. Defaults to \"primary\".\n * @param props.placement - Popover placement (`ValueOrState<Placement>`) relative to the input. Defaults to \"bottom-start\".\n * @example { input: \"\", $: [inputText(), datePicker({ mode: \"range\" })] }\n */\nfunction datePicker(props: DatePickerProps = {}): PartialElement {\n const {\n mode = \"single\",\n time = false,\n min,\n max,\n disabledDate,\n locale = typeof navigator !== \"undefined\" ? navigator.language : \"en-US\",\n format,\n onChange,\n } = props;\n\n const weekStart = props.weekStartsOn ?? localeWeekStart(locale);\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n const placeState = toState(props.placement ?? \"bottom-start\");\n\n const selection = toState<DatePickerValue>(\n props.value ?? (mode === \"range\" ? [null, null] : null),\n );\n const releaseOnChange = onChange\n ? selection.addListener((value) => onChange(value))\n : null;\n\n const primaryDate = ((): Date => {\n const current = selection.get();\n const base =\n mode === \"range\" ? (current as [Date | null, Date | null])?.[0] : current;\n return base instanceof Date ? base : new Date();\n })();\n\n const viewYear = toState(primaryDate.getFullYear(), \"viewYear\");\n const viewMonth = toState(primaryDate.getMonth(), \"viewMonth\");\n const focused = toState<Date>(atMidnight(primaryDate), \"focused\");\n const hovered = toState<Date | null>(null, \"hovered\");\n const hour = toState(primaryDate.getHours(), \"hour\");\n const minute = toState(primaryDate.getMinutes(), \"minute\");\n\n let contentElement: HTMLElement | null = null;\n\n // --- formatting -----------------------------------------------------------\n const dateFormatter = new Intl.DateTimeFormat(locale, {\n dateStyle: \"medium\",\n ...(time ? { timeStyle: \"short\" as const } : {}),\n });\n const monthFormatter = new Intl.DateTimeFormat(locale, {\n month: \"long\",\n year: \"numeric\",\n });\n const weekdayFormatter = new Intl.DateTimeFormat(locale, {\n weekday: \"short\",\n });\n const fullDateFormatter = new Intl.DateTimeFormat(locale, {\n dateStyle: \"full\",\n });\n\n const formatOne = (date: Date | null): string =>\n date ? dateFormatter.format(date) : \"\";\n const formatDisplay = (value: DatePickerValue): string => {\n if (format) return format(value);\n if (mode === \"range\") {\n const [start, end] = (value as [Date | null, Date | null]) ?? [\n null,\n null,\n ];\n return start ? `${formatOne(start)} – ${formatOne(end)}` : \"\";\n }\n return formatOne(value as Date | null);\n };\n\n // 2023-01-01 is a Sunday, so index 0 maps to Sunday before the week-start shift.\n const weekdayNames = Array.from({ length: 7 }, (_unused, index) =>\n weekdayFormatter.format(new Date(2023, 0, 1 + ((index + weekStart) % 7))),\n );\n\n // --- selection logic ------------------------------------------------------\n const isDisabled = (date: Date): boolean =>\n (!!min && atMidnight(date) < atMidnight(min)) ||\n (!!max && atMidnight(date) > atMidnight(max)) ||\n (!!disabledDate && disabledDate(date));\n\n const withTime = (date: Date): Date => {\n if (!time) return atMidnight(date);\n const result = atMidnight(date);\n result.setHours(hour.get(), minute.get(), 0, 0);\n return result;\n };\n\n const selectDate = (date: Date): void => {\n if (isDisabled(date)) return;\n if (mode === \"single\") {\n selection.set(withTime(date));\n if (!time) instantHideRef();\n return;\n }\n const [start, end] = (selection.get() as [Date | null, Date | null]) ?? [\n null,\n null,\n ];\n if (!start || (start && end)) {\n selection.set([withTime(date), null]);\n } else if (atMidnight(date) < atMidnight(start)) {\n selection.set([withTime(date), withTime(start)]);\n if (!time) instantHideRef();\n } else {\n selection.set([start, withTime(date)]);\n if (!time) instantHideRef();\n }\n };\n\n const reapplyTime = (): void => {\n if (!time) return;\n if (mode === \"single\") {\n const current = selection.get() as Date | null;\n if (current) selection.set(withTime(current));\n } else {\n const [start, end] = (selection.get() as [Date | null, Date | null]) ?? [\n null,\n null,\n ];\n selection.set([\n start ? withTime(start) : start,\n end ? withTime(end) : end,\n ]);\n }\n };\n\n const inSelectedRange = (date: Date, listener?: Listener): boolean => {\n if (mode !== \"range\") return false;\n const [start, end] = (selection.get(listener) as [\n Date | null,\n Date | null,\n ]) ?? [null, null];\n const tail = end ?? hovered.get(listener);\n if (!start || !tail) return false;\n const low = atMidnight(start) <= atMidnight(tail) ? start : tail;\n const high = atMidnight(start) <= atMidnight(tail) ? tail : start;\n const day = atMidnight(date);\n return day >= atMidnight(low) && day <= atMidnight(high);\n };\n\n const isSelectedEnd = (date: Date, listener?: Listener): boolean => {\n const current = selection.get(listener);\n if (mode === \"range\") {\n const [start, end] = (current as [Date | null, Date | null]) ?? [\n null,\n null,\n ];\n return sameDay(date, start) || sameDay(date, end);\n }\n return sameDay(date, current as Date | null);\n };\n\n // --- view navigation ------------------------------------------------------\n const goToDate = (date: Date): void => {\n viewYear.set(date.getFullYear());\n viewMonth.set(date.getMonth());\n };\n const shiftMonth = (delta: number): void => {\n const next = addMonths(new Date(viewYear.get(), viewMonth.get(), 1), delta);\n goToDate(next);\n };\n const shiftYear = (delta: number): void =>\n viewYear.set(viewYear.get() + delta);\n\n const focusActiveCell = (): void => {\n setTimeout(() => {\n contentElement\n ?.querySelector<HTMLElement>(`[data-date=\"${isoOf(focused.get())}\"]`)\n ?.focus();\n }, 0);\n };\n\n // --- floating popover ------------------------------------------------------\n const calendar = buildCalendar();\n const { show, hide, anchorPartial } = createFloating({\n kind: \"datePicker\",\n open: false,\n placement: placeState,\n content: calendar,\n });\n // selectDate calls this before `createFloating` returns `hide`, so route through a ref.\n function instantHideRef(): void {\n hide();\n }\n\n // Move focus into the grid when the popover opens.\n anchorPartial.onClick = () => {};\n const triggerPartial: PartialElement = {\n type: \"text\",\n readonly: true,\n value: (listener) => formatDisplay(selection.get(listener)),\n ariaHaspopup: \"dialog\",\n ariaLabel: \"Choose date\",\n style: { cursor: \"pointer\" },\n onClick: (_e, node) => {\n openAndFocus(node);\n },\n onFocus: (_e, node) => {\n openAndFocus(node);\n },\n onKeyDown: (event, node) => {\n const key = (event as KeyboardEvent).key;\n if (key === \"ArrowDown\" || key === \"Enter\") {\n event.preventDefault();\n openAndFocus(node);\n }\n },\n _onMount: (node) =>\n releaseOnChange &&\n node.addHook(\"Remove\", () => {\n releaseOnChange();\n }),\n };\n function openAndFocus(node?: ElementNode): void {\n const current = isSelectedPrimary() ?? new Date();\n focused.set(atMidnight(current));\n goToDate(current);\n show(node);\n focusActiveCell();\n }\n function isSelectedPrimary(): Date | null {\n const current = selection.get();\n if (mode === \"range\")\n return (current as [Date | null, Date | null])?.[0] ?? null;\n return (current as Date | null) ?? null;\n }\n merge(anchorPartial, triggerPartial);\n return anchorPartial;\n\n // --- calendar builder -----------------------------------------------------\n function buildCalendar(): DomphyElement<\"div\"> {\n const navButton = (label: string, ariaLabel: string, onClick: () => void) =>\n ({\n button: label,\n type: \"button\",\n ariaLabel,\n onClick,\n style: navButtonStyle(),\n }) as DomphyElement;\n\n const header: DomphyElement<\"div\"> = {\n div: [\n navButton(\"«\", \"Previous year\", () => shiftYear(-1)),\n navButton(\"‹\", \"Previous month\", () => shiftMonth(-1)),\n {\n div: (listener) =>\n monthFormatter.format(\n new Date(viewYear.get(listener), viewMonth.get(listener), 1),\n ),\n ariaLive: \"polite\",\n style: {\n flex: \"1\",\n textAlign: \"center\",\n fontWeight: \"bold\",\n fontSize: (listener) => themeSize(listener),\n },\n },\n navButton(\"›\", \"Next month\", () => shiftMonth(1)),\n navButton(\"»\", \"Next year\", () => shiftYear(1)),\n ],\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: themeSpacing(1),\n marginBottom: themeSpacing(2),\n },\n };\n\n const weekdayHeader: DomphyElement<\"div\"> = {\n div: weekdayNames.map((name, index) => ({\n div: name,\n style: {\n textAlign: \"center\",\n fontSize: (listener) => themeSize(listener, \"decrease-1\"),\n fontWeight: \"bold\",\n color: (listener) => themeColor(listener, \"shift-7\"),\n paddingBlock: themeSpacing(1),\n },\n _key: index,\n })),\n role: \"row\",\n style: gridRowStyle(),\n };\n\n const grid: DomphyElement<\"div\"> = {\n div: (listener) => buildWeeks(listener),\n role: \"grid\",\n ariaLabel: \"Calendar\",\n onKeyDown: onGridKey,\n onMouseLeave: () => mode === \"range\" && hovered.set(null),\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: themeSpacing(0.5),\n },\n };\n\n const children: DomphyElement[] = [header, weekdayHeader, grid];\n if (time) children.push(buildTimeRow());\n children.push(buildFooter());\n\n return {\n div: children,\n role: \"dialog\",\n ariaModal: \"false\",\n _onMount: (node) => {\n contentElement = node.domElement as HTMLElement;\n },\n style: {\n minWidth: themeSpacing(70),\n padding: themeSpacing(3),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n backgroundColor: (listener) => themeColor(listener, \"base\"),\n color: (listener) => themeColor(listener, \"shift-10\"),\n border: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\")}`,\n boxShadow: elevation(\"medium\"),\n },\n };\n }\n\n function buildWeeks(listener: Listener): DomphyElement[] {\n const first = new Date(viewYear.get(listener), viewMonth.get(listener), 1);\n const month = viewMonth.get(listener);\n const start = startOfWeek(first, weekStart);\n const weeks: DomphyElement[] = [];\n for (let week = 0; week < 6; week++) {\n const cells: DomphyElement[] = [];\n for (let day = 0; day < 7; day++) {\n const date = addDays(start, week * 7 + day);\n cells.push(buildDayCell(date, month, listener));\n }\n weeks.push({\n div: cells,\n role: \"row\",\n style: gridRowStyle(),\n _key: week,\n });\n }\n return weeks;\n }\n\n function buildDayCell(\n date: Date,\n month: number,\n listener: Listener,\n ): DomphyElement {\n const disabled = isDisabled(date);\n const selected = isSelectedEnd(date, listener);\n const within = inSelectedRange(date, listener);\n const outside = date.getMonth() !== month;\n const isFocused = sameDay(date, focused.get(listener));\n const isToday = sameDay(date, new Date());\n\n return {\n button: String(date.getDate()),\n type: \"button\",\n role: \"gridcell\",\n tabIndex: isFocused ? 0 : -1,\n ariaSelected: selected,\n ariaDisabled: disabled,\n disabled,\n ariaLabel: fullDateFormatter.format(date),\n dataDate: isoOf(date),\n onClick: () => selectDate(date),\n onMouseEnter: () => mode === \"range\" && hovered.set(date),\n style: {\n appearance: \"none\",\n border: \"none\",\n cursor: disabled ? \"not-allowed\" : \"pointer\",\n aspectRatio: \"1\",\n borderRadius: themeSpacing(1),\n fontSize: (l: Listener) => themeSize(l),\n fontFamily: \"inherit\",\n opacity: disabled ? 0.35 : outside ? 0.5 : 1,\n backgroundColor: (l: Listener) =>\n selected\n ? themeColor(l, \"shift-7\", accentColor.get(l))\n : within\n ? themeColor(l, \"hover\", accentColor.get(l))\n : \"transparent\",\n color: (l: Listener) =>\n selected\n ? themeColor(l, \"shift-0\", accentColor.get(l))\n : themeColor(l, \"text\"),\n outline: isToday\n ? (l: Listener) =>\n `1px solid ${themeColor(l, \"shift-6\", accentColor.get(l))}`\n : \"none\",\n outlineOffset: \"-2px\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (l: Listener) =>\n selected\n ? themeColor(l, \"shift-7\", accentColor.get(l))\n : themeColor(l, \"shift-3\", accentColor.get(l)),\n },\n transition: \"background-color 140ms ease, box-shadow 140ms ease\",\n \"&:focus-visible\": {\n boxShadow: (l: Listener) => focusRing(l, accentColor.get(l)),\n },\n },\n _key: isoOf(date),\n } as DomphyElement;\n }\n\n function buildTimeRow(): DomphyElement<\"div\"> {\n const numberSelect = (\n count: number,\n state: ReturnType<typeof toState<number>>,\n ariaLabel: string,\n ): DomphyElement => ({\n select: Array.from({ length: count }, (_unused, value) => ({\n option: String(value).padStart(2, \"0\"),\n value: String(value),\n selected: (listener) => state.get(listener) === value,\n _key: value,\n })) as DomphyElement[],\n ariaLabel,\n onChange: (event) => {\n state.set(Number((event.target as HTMLSelectElement).value));\n reapplyTime();\n },\n style: timeSelectStyle(),\n });\n\n return {\n div: [\n numberSelect(24, hour, \"Hour\"),\n { span: \":\", style: { fontWeight: \"bold\" } },\n numberSelect(60, minute, \"Minute\"),\n ],\n style: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: themeSpacing(1),\n marginTop: themeSpacing(3),\n },\n };\n }\n\n function buildFooter(): DomphyElement<\"div\"> {\n const action = (label: string, onClick: () => void): DomphyElement => ({\n button: label,\n type: \"button\",\n onClick,\n style: {\n appearance: \"none\",\n border: \"none\",\n background: \"transparent\",\n cursor: \"pointer\",\n fontFamily: \"inherit\",\n fontSize: (l: Listener) => themeSize(l, \"decrease-1\"),\n color: (l: Listener) => themeColor(l, \"muted\", accentColor.get(l)),\n padding: themeSpacing(1),\n },\n });\n return {\n div: [\n action(\"Today\", () => {\n const today = new Date();\n focused.set(atMidnight(today));\n goToDate(today);\n focusActiveCell();\n }),\n action(\"Clear\", () => {\n selection.set(mode === \"range\" ? [null, null] : null);\n hovered.set(null);\n }),\n ],\n style: {\n display: \"flex\",\n justifyContent: \"space-between\",\n marginTop: themeSpacing(2),\n paddingTop: themeSpacing(2),\n borderTop: (l: Listener) => `1px solid ${themeColor(l, \"border\")}`,\n },\n };\n }\n\n function onGridKey(event: Event): void {\n const keyboard = event as KeyboardEvent;\n const current = focused.get();\n let next: Date | null = null;\n switch (keyboard.key) {\n case \"ArrowLeft\":\n next = addDays(current, -1);\n break;\n case \"ArrowRight\":\n next = addDays(current, 1);\n break;\n case \"ArrowUp\":\n next = addDays(current, -7);\n break;\n case \"ArrowDown\":\n next = addDays(current, 7);\n break;\n case \"Home\":\n next = startOfWeek(current, weekStart);\n break;\n case \"End\":\n next = addDays(startOfWeek(current, weekStart), 6);\n break;\n case \"PageUp\":\n next = addMonths(current, keyboard.shiftKey ? -12 : -1);\n break;\n case \"PageDown\":\n next = addMonths(current, keyboard.shiftKey ? 12 : 1);\n break;\n case \"Enter\":\n case \" \":\n keyboard.preventDefault();\n selectDate(current);\n return;\n default:\n return;\n }\n keyboard.preventDefault();\n focused.set(next);\n goToDate(next);\n focusActiveCell();\n }\n}\n\n// --- shared style fragments --------------------------------------------------\n\nfunction gridRowStyle() {\n return {\n display: \"grid\",\n gridTemplateColumns: \"repeat(7, 1fr)\",\n gap: themeSpacing(0.5),\n };\n}\n\nfunction navButtonStyle() {\n return {\n appearance: \"none\" as const,\n border: \"none\",\n background: \"transparent\",\n cursor: \"pointer\",\n fontFamily: \"inherit\",\n fontSize: (l: Listener) => themeSize(l),\n color: (l: Listener) => themeColor(l, \"muted\"),\n width: themeSpacing(7),\n height: themeSpacing(7),\n borderRadius: themeSpacing(1),\n \"&:hover\": {\n backgroundColor: (l: Listener) => themeColor(l, \"shift-3\"),\n },\n };\n}\n\nfunction timeSelectStyle() {\n return {\n fontFamily: \"inherit\",\n fontSize: (l: Listener) => themeSize(l),\n padding: themeSpacing(1),\n borderRadius: themeSpacing(1),\n border: (l: Listener) => `1px solid ${themeColor(l, \"border-strong\")}`,\n backgroundColor: (l: Listener) => themeColor(l, \"base\"),\n color: (l: Listener) => themeColor(l, \"text\"),\n };\n}\n\nexport { datePicker };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles a description list as a two-column grid (terms in the first column,\n * descriptions in the second), theming the nested `<dt>`/`<dd>` elements.\n * Apply to a `<dl>` element.\n *\n * @hostTag dl\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for the term/description text. Defaults to \"neutral\".\n * @example { dl: [{ dt: \"Name\" }, { dd: \"Domphy\" }], $: [descriptionList()] }\n */\nfunction descriptionList(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"dl\") {\n console.warn(`\"descriptionList\" primitive patch must use dl tag`);\n }\n },\n // Term weight is design-system chrome for description lists.\n _doctorDisable: \"inline-typography\",\n style: {\n display: \"grid\",\n gridTemplateColumns: `minmax(${themeSpacing(24)}, max-content) 1fr`,\n columnGap: themeSpacing(4),\n margin: 0,\n \"& dt\": {\n margin: 0,\n fontWeight: 600,\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n },\n \"& dd\": {\n margin: 0,\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n },\n };\n}\n\nexport { descriptionList };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a native disclosure widget: a themed `<summary>` header with an\n * animated rotating chevron and an expand/collapse transition on the body\n * content. Apply to a `<details>` element.\n *\n * @hostTag details\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for the body/summary. Defaults to \"neutral\".\n * @param props.accentColor - Accent color (`ValueOrState<ThemeColor>`) for the summary's focus ring. Defaults to \"primary\".\n * @param props.duration - Open/close transition duration in milliseconds. Defaults to 240.\n * @example { details: [{ summary: \"More\" }, { div: \"Body\" }], $: [details()] }\n */\nfunction details(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n duration?: number;\n } = {},\n): PartialElement {\n const { duration = 240 } = props;\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"details\") {\n console.warn(`\"details\" primitive patch must use details tag`);\n }\n },\n // Summary weight is design-system chrome for disclosure headers.\n _doctorDisable: \"inline-typography\",\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n\n overflow: \"hidden\",\n \"& > summary\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", color.get(listener)),\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n listStyle: \"none\",\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n gap: themeSpacing(2),\n cursor: \"pointer\",\n userSelect: \"none\",\n fontWeight: 500,\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n height: themeSpacing(10),\n },\n \"& > summary::-webkit-details-marker\": {\n display: \"none\",\n },\n \"& > summary::marker\": {\n content: `\"\"`,\n },\n \"& > summary::after\": {\n content: `\"\"`,\n width: themeSpacing(2),\n height: themeSpacing(2),\n flexShrink: 0,\n marginTop: `-${themeSpacing(0.5)}`,\n borderInlineEnd: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-9\", color.get(listener))}`,\n borderBottom: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-9\", color.get(listener))}`,\n transform: \"rotate(45deg)\",\n transition: `transform ${duration}ms ease`,\n },\n \"&[open] > summary::after\": {\n transform: \"rotate(-135deg)\",\n },\n \"& > summary:hover\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-3\", color.get(listener)),\n },\n \"& > summary:focus-visible\": {\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"& > :not(summary)\": {\n maxHeight: 0,\n opacity: 0,\n overflow: \"hidden\",\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingTop: 0,\n paddingBottom: 0,\n transition: `max-height ${duration}ms ease, opacity ${duration}ms ease, padding ${duration}ms ease`,\n },\n \"&[open] > :not(summary)\": {\n maxHeight: themeSpacing(250),\n opacity: 1,\n paddingTop: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingBottom: (listener) => themeSpacing(themeDensity(listener) * 3),\n },\n },\n };\n}\n\nexport { details };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { lockScroll, unlockScroll } from \"../utils/scrollLock.js\";\n\nconst FOCUSABLE =\n 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), details, [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * Modal dialog patch driven by an `open` State. Calls `showModal()`/`close()`,\n * fades via opacity, locks page scroll while open, traps Tab focus within the\n * dialog, restores focus to the previously focused element on close, sets\n * `aria-modal`, and closes on outside (backdrop) click. Apply to a `<dialog>`.\n *\n * @hostTag dialog\n * @param props.color - Theme color tone for the dialog surface. Defaults to \"neutral\".\n * @param props.open - Open state (`ValueOrState<boolean>`); set it to true/false to show/hide. Defaults to false.\n * @example { dialog: [...], $: [dialog({ open })] }\n */\nfunction dialog(\n props: { color?: ThemeColor; open?: ValueOrState<boolean> } = {},\n): PartialElement {\n const { color = \"neutral\", open = false } = props;\n const state = toState(open);\n let previousFocus: HTMLElement | null = null;\n let closing = false;\n let scrollLocked = false;\n\n const finalizeClose = (dlg: HTMLDialogElement) => {\n closing = false;\n // Guard for environments with HTMLDialogElement but no close()\n // implementation (e.g. jsdom in tests).\n if (typeof dlg.close === \"function\") dlg.close();\n // visibility/pointer-events (not just opacity) must reflect the closed\n // state: opacity alone leaves a closed dialog's content fully reachable\n // by Tab and exposed to the accessibility tree (opacity, unlike\n // visibility, never removes an element from either) — and a consumer\n // that sets its own `style: { display: ... }` on the dialog (a common\n // pattern for centering content) overrides the UA stylesheet's\n // `dialog:not([open]) { display: none }`, so `dlg.close()` alone doesn't\n // reliably hide it either. Set INLINE so it always wins regardless of\n // what the consumer's own style object declares.\n dlg.style.visibility = \"hidden\";\n dlg.style.pointerEvents = \"none\";\n if (scrollLocked) {\n unlockScroll();\n scrollLocked = false;\n }\n previousFocus?.focus();\n previousFocus = null;\n };\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"dialog\") {\n console.warn(`\"dialog\" primitive patch must use dialog tag`);\n }\n },\n onClick: (e: MouseEvent, node) => {\n if (e.target !== node.domElement) return;\n const r = node.domElement!.getBoundingClientRect();\n const inside =\n e.clientX >= r.left &&\n e.clientX <= r.right &&\n e.clientY >= r.top &&\n e.clientY <= r.bottom;\n if (!inside) state.set(false);\n },\n onTransitionEnd: (e, node) => {\n if (!closing) return;\n // Guard against bubbled transitionend from nested content (e.g. an\n // accordion/details transition inside the dialog) prematurely\n // triggering close-finalization.\n if (e.target !== node.domElement) return;\n if (e.propertyName !== \"opacity\") return;\n finalizeClose(node.domElement as HTMLDialogElement);\n },\n _onMount: (node) => {\n const dlg = node.domElement as HTMLDialogElement;\n dlg.setAttribute(\"aria-modal\", \"true\");\n let closeTimer: ReturnType<typeof setTimeout> | null = null;\n\n const trapFocus = (e: KeyboardEvent) => {\n if (e.key !== \"Tab\") return;\n const focusables = Array.from(\n dlg.querySelectorAll<HTMLElement>(FOCUSABLE),\n ).filter(\n (el) =>\n !el.closest(\"[aria-hidden='true']\") && el.offsetParent !== null,\n );\n if (!focusables.length) {\n e.preventDefault();\n return;\n }\n const first = focusables[0];\n const last = focusables[focusables.length - 1];\n if (e.shiftKey) {\n if (\n document.activeElement === first ||\n document.activeElement === dlg\n ) {\n e.preventDefault();\n last.focus();\n }\n } else {\n if (document.activeElement === last) {\n e.preventDefault();\n first.focus();\n }\n }\n };\n\n const onCancel = (e: Event) => {\n e.preventDefault();\n state.set(false);\n };\n dlg.addEventListener(\"cancel\", onCancel);\n\n const update = (val: boolean) => {\n if (val) {\n previousFocus = document.activeElement as HTMLElement;\n dlg.style.visibility = \"visible\";\n dlg.style.pointerEvents = \"auto\";\n // Guard for environments with HTMLDialogElement but no showModal()\n // implementation (e.g. jsdom in tests).\n if (typeof dlg.showModal === \"function\") dlg.showModal();\n if (!scrollLocked) {\n lockScroll();\n scrollLocked = true;\n }\n dlg.addEventListener(\"keydown\", trapFocus);\n requestAnimationFrame(() => {\n dlg.style.opacity = \"1\";\n const focusable = dlg.querySelector<HTMLElement>(FOCUSABLE);\n focusable?.focus();\n });\n } else {\n closing = true;\n dlg.style.opacity = \"0\";\n dlg.removeEventListener(\"keydown\", trapFocus);\n // Fallback: if transitionend never fires (reduced-motion, display:none),\n // unblock close after the transition duration + buffer.\n closeTimer = setTimeout(() => {\n closeTimer = null;\n if (!closing) return;\n finalizeClose(dlg);\n }, 350);\n }\n };\n update(state.get());\n const release = state.addListener(update);\n node.addHook(\"Remove\", () => {\n if (closeTimer) {\n clearTimeout(closeTimer);\n closeTimer = null;\n }\n release();\n dlg.removeEventListener(\"cancel\", onCancel);\n if (scrollLocked) {\n unlockScroll();\n scrollLocked = false;\n }\n dlg.removeEventListener(\"keydown\", trapFocus);\n previousFocus?.focus();\n previousFocus = null;\n });\n },\n style: {\n opacity: \"0\",\n // Matches finalizeClose's inline defaults — a dialog that mounts\n // already-closed (the common case: `open` defaults to false) must\n // start out of the tab order/accessibility tree from first paint, not\n // just after its first open->close cycle runs finalizeClose.\n visibility: \"hidden\",\n pointerEvents: \"none\",\n transition: \"opacity 200ms ease\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"shift-10\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n border: \"none\",\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n padding: (listener) => themeSpacing(themeDensity(listener) * 3),\n boxShadow: elevation(\"high\"),\n \"&::backdrop\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n opacity: 0.75,\n },\n },\n };\n}\n\nexport { dialog };\n","// Shared page-scroll lock for modal-like patches (dialog, drawer). A\n// module-level counter (not a plain boolean) is required because two\n// overlays can be open at once (e.g. a dialog opened from within a drawer);\n// without a counter, closing the inner one would clear `overflow` while the\n// outer one is still open.\nlet lockCount = 0;\n\nfunction lockScroll(): void {\n lockCount++;\n if (lockCount === 1) document.body.style.overflow = \"hidden\";\n}\n\nfunction unlockScroll(): void {\n lockCount = Math.max(0, lockCount - 1);\n if (lockCount === 0) document.body.style.overflow = \"\";\n}\n\n// Test-only: reset the module-level counter so a test that unmounts its tree\n// via `document.body.innerHTML = \"\"` (skipping the Remove hook / unlockScroll\n// call) doesn't leak a locked count into the next test.\nfunction _resetScrollLock(): void {\n lockCount = 0;\n}\n\nexport { lockScroll, unlockScroll, _resetScrollLock };\n","import type { PartialElement } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * A horizontal separator (`role=\"separator\"`) with a line on each side of its\n * content, suitable for labelled dividers (\"or\"). Apply to a `<div>` element.\n *\n * @hostTag div\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for the label text and rules. Defaults to \"neutral\".\n * @example { div: \"or\", $: [divider()] }\n */\nfunction divider(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n role: \"separator\",\n _onInsert: (node) => {\n if (node.tagName !== \"div\") {\n console.warn(`\"divider\" patch should be used with <div>`);\n }\n },\n style: {\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"baseline\",\n gap: themeSpacing(2),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) => themeColor(listener),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n minHeight: \"1lh\",\n \"&::before\": {\n content: `\"\"`,\n flex: 1,\n borderColor: (listener) =>\n themeColor(listener, \"border-strong\", color.get(listener)),\n borderWidth: \"1px\",\n borderBottomStyle: \"solid\",\n },\n \"&::after\": {\n content: `\"\"`,\n flex: 1,\n borderColor: (listener) =>\n themeColor(listener, \"border-strong\", color.get(listener)),\n borderWidth: \"1px\",\n borderBottomStyle: \"solid\",\n },\n },\n };\n}\n\nexport { divider };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { lockScroll, unlockScroll } from \"../utils/scrollLock.js\";\n\ntype PhysicalPlacement = \"left\" | \"right\" | \"top\" | \"bottom\";\ntype Placement = PhysicalPlacement | \"start\" | \"end\";\n\nconst translateOut: Record<PhysicalPlacement, string> = {\n left: \"translateX(-100%)\",\n right: \"translateX(100%)\",\n top: \"translateY(-100%)\",\n bottom: \"translateY(100%)\",\n};\n\nconst marginMap: Record<PhysicalPlacement, string> = {\n left: \"0 auto 0 0\",\n right: \"0 0 0 auto\",\n top: \"0 0 auto 0\",\n bottom: \"auto 0 0 0\",\n};\n\nconst isVertical = (p: PhysicalPlacement) => p === \"left\" || p === \"right\";\n\nfunction resolvePhysical(\n placement: Placement,\n isRTL: boolean,\n): PhysicalPlacement {\n if (placement === \"start\") return isRTL ? \"right\" : \"left\";\n if (placement === \"end\") return isRTL ? \"left\" : \"right\";\n return placement;\n}\n\n/**\n * Edge-anchored modal drawer driven by an `open` State. Slides in/out from a\n * chosen edge via a 250 ms transform transition, calls `showModal()`/`close()`,\n * locks page scroll while open, and closes on backdrop click. A 350 ms fallback\n * ensures `close()` is always called even when `transitionend` doesn't fire\n * (reduced-motion, `display:none`, detached element). Apply to a `<dialog>`.\n *\n * Because the patch uses the native `<dialog>` `showModal()` API, the browser\n * traps focus inside the drawer while it is open and restores focus to the\n * previously focused element when `close()` is called. Sets `aria-modal=\"true\"`.\n * Escape key closes the drawer via the animated state path (not immediate close).\n *\n * `\"start\"` and `\"end\"` placements resolve to left/right based on the\n * document's `dir` attribute at mount time, enabling RTL-aware drawers:\n * `\"start\"` → left (LTR) / right (RTL); `\"end\"` → right (LTR) / left (RTL).\n *\n * @hostTag dialog\n * @param props.color - Theme color tone for the drawer surface. Defaults to \"neutral\".\n * @param props.open - Open state (`ValueOrState<boolean>`); set true/false to show/hide. Defaults to false.\n * @param props.placement - Edge to anchor to. \"left\" | \"right\" | \"top\" | \"bottom\" | \"start\" | \"end\". Defaults to \"end\".\n * @param props.size - CSS length for the drawer's width (left/right/start/end) or height (top/bottom). Defaults to themeSpacing(80) for left/right, themeSpacing(64) for top/bottom.\n * @example { dialog: [...], $: [drawer({ open, placement: \"start\" })] }\n */\nfunction drawer(\n props: {\n color?: ThemeColor;\n open?: ValueOrState<boolean>;\n placement?: Placement;\n size?: string;\n } = {},\n): PartialElement {\n const { color = \"neutral\", open = false, placement = \"end\", size } = props;\n const state = toState(open);\n const isLogical = placement === \"start\" || placement === \"end\";\n\n // For static rendering / SSR assume LTR as fallback; corrected at mount time.\n const physicalFallback = resolvePhysical(placement, false);\n const defaultSize = isVertical(physicalFallback)\n ? themeSpacing(80)\n : themeSpacing(64);\n const drawerSize = size ?? defaultSize;\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"dialog\") {\n console.warn(`\"drawer\" patch must use dialog tag`);\n }\n },\n onClick: (e: MouseEvent, node) => {\n if (e.target !== node.domElement) return;\n state.set(false);\n },\n _onMount: (node) => {\n const dlg = node.domElement as HTMLDialogElement;\n dlg.setAttribute(\"aria-modal\", \"true\");\n\n const onCancel = (e: Event) => {\n e.preventDefault();\n state.set(false);\n };\n dlg.addEventListener(\"cancel\", onCancel);\n\n // Resolve logical placements at mount time using document direction.\n const isRTL =\n isLogical &&\n (dlg.ownerDocument.documentElement.dir === \"rtl\" ||\n dlg.ownerDocument.dir === \"rtl\");\n const physical = resolvePhysical(placement, isRTL);\n\n // Correct initial styles for logical placements whose physical direction\n // may differ from the LTR fallback used in the static style block.\n if (isLogical) {\n dlg.style.transform = translateOut[physical];\n dlg.style.margin = marginMap[physical];\n dlg.style.width = isVertical(physical) ? drawerSize : \"100dvw\";\n dlg.style.height = isVertical(physical) ? \"100dvh\" : drawerSize;\n }\n\n let closing = false;\n let scrollLocked = false;\n let closeTimer: ReturnType<typeof setTimeout> | null = null;\n const finishClose = () => {\n closeTimer = null;\n if (!closing) return;\n closing = false;\n // Guard for environments with HTMLDialogElement but no close()\n // implementation (e.g. jsdom in tests).\n if (typeof dlg.close === \"function\") dlg.close();\n // Same fix as dialog.ts: the closed state was only ever represented\n // by an off-screen `transform`, never visibility/pointer-events — a\n // closed drawer stayed fully reachable by Tab and exposed to the\n // accessibility tree (a CSS transform, like opacity, does neither),\n // and a consumer's own `style: { display: ... }` overrides the UA\n // stylesheet's `dialog:not([open])` rule anyway. Set INLINE so it\n // always wins.\n dlg.style.visibility = \"hidden\";\n dlg.style.pointerEvents = \"none\";\n if (scrollLocked) {\n unlockScroll();\n scrollLocked = false;\n }\n };\n\n const onTransitionEnd = (e: Event) => {\n if (e.target !== dlg) return;\n if ((e as TransitionEvent).propertyName !== \"transform\") return;\n finishClose();\n };\n dlg.addEventListener(\"transitionend\", onTransitionEnd);\n\n const update = (val: boolean) => {\n if (val) {\n closing = false;\n dlg.style.visibility = \"visible\";\n dlg.style.pointerEvents = \"auto\";\n // Guard for environments with HTMLDialogElement but no showModal()\n // implementation (e.g. jsdom in tests).\n if (typeof dlg.showModal === \"function\") dlg.showModal();\n if (!scrollLocked) {\n lockScroll();\n scrollLocked = true;\n }\n requestAnimationFrame(() => {\n dlg.style.transform = \"translate(0, 0)\";\n });\n } else {\n closing = true;\n dlg.style.transform = translateOut[physical];\n closeTimer = setTimeout(finishClose, 350);\n }\n };\n update(state.get());\n const release = state.addListener(update);\n node.addHook(\"Remove\", () => {\n if (closeTimer) {\n clearTimeout(closeTimer);\n closeTimer = null;\n }\n release();\n dlg.removeEventListener(\"cancel\", onCancel);\n dlg.removeEventListener(\"transitionend\", onTransitionEnd);\n if (scrollLocked) {\n unlockScroll();\n scrollLocked = false;\n }\n });\n },\n style: {\n transform: translateOut[physicalFallback],\n // Matches finishClose's inline defaults — a drawer that mounts\n // already-closed (the common case) must start out of the tab\n // order/accessibility tree from first paint, not just after its first\n // open->close cycle runs finishClose.\n visibility: \"hidden\",\n pointerEvents: \"none\",\n transition: \"transform 0.25s ease\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"shift-10\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n border: \"none\",\n padding: (listener) => themeSpacing(themeDensity(listener) * 3),\n margin: marginMap[physicalFallback],\n width: isVertical(physicalFallback) ? drawerSize : \"100dvw\",\n height: isVertical(physicalFallback) ? \"100dvh\" : drawerSize,\n maxWidth: \"100dvw\",\n maxHeight: \"100dvh\",\n boxShadow: elevation(\"high\"),\n \"&::backdrop\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n opacity: 0.75,\n },\n },\n };\n}\n\nexport { drawer };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSize } from \"@domphy/theme\";\n\n/**\n * Italic emphasized inline text. Apply to an `<em>` element.\n *\n * @hostTag em\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for the text. Defaults to \"neutral\".\n * @example { em: \"important\", $: [emphasis()] }\n */\nfunction emphasis(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"em\") {\n console.warn(`\"emphasis\" primitive patch must use em tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n fontStyle: \"italic\",\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n },\n };\n}\n\nexport { emphasis };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\n\n/**\n * Styles a container as an empty-state placeholder: centered flex column with\n * muted coloring and comfortable padding. Provide the icon, title, and\n * description as child elements.\n *\n * @param props.color - Theme color tone for the muted text/icon. Defaults to `\"neutral\"`.\n * @example\n * { div: [\n * { span: \"📭\" },\n * { p: \"No items yet\", $: [paragraph()] },\n * { span: \"Add your first item to get started\", $: [small()] },\n * ], $: [empty()] }\n */\nfunction empty(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: themeSpacing(3),\n paddingBlock: themeSpacing(12),\n paddingInline: themeSpacing(6),\n textAlign: \"center\",\n // Body / description text sits in the muted zone.\n color: (listener) => themeColor(listener, \"muted\", color.get(listener)),\n // Icon area: slightly softer so it recedes behind the title.\n \"& > :first-child\": {\n color: (listener) =>\n themeColor(listener, \"shift-5\", color.get(listener)),\n opacity: 0.9,\n },\n // Title (typically second child): stronger body text for hierarchy.\n \"& > :nth-child(2)\": {\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n },\n };\n}\n\nexport { empty };\n","import type { DomphyElement, PartialElement } from \"@domphy/core\";\n\n/**\n * Catches errors thrown inside reactive child expressions and renders a\n * fallback element instead of crashing the whole tree. Apply to any container.\n *\n * Only errors in *reactive* children (functions returning element arrays) are\n * caught. Errors during static construction propagate normally — those are\n * programming errors, not runtime data errors.\n *\n * @hostTag any\n * @param props.fallback - Fallback element or factory `(error, reset) => element`. Defaults to a plain error message div.\n * @param props.onError - Optional callback for logging/telemetry.\n * @example { div: (l) => renderUserContent(l), $: [errorBoundary({ fallback: { p: \"Something went wrong.\" } })] }\n */\nfunction errorBoundary(\n props: {\n fallback?:\n | DomphyElement\n | ((error: unknown, reset: () => void) => DomphyElement);\n onError?: (error: unknown) => void;\n } = {},\n): PartialElement {\n return {\n _onError: (node, error, reset) => {\n props.onError?.(error);\n const fallbackEl =\n typeof props.fallback === \"function\"\n ? props.fallback(error, reset)\n : (props.fallback ??\n ({ div: \"An error occurred.\" } as DomphyElement));\n node.children.update([fallbackEl]);\n },\n };\n}\n\nexport { errorBoundary };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\nconst SIZE_MAP = { small: 8, medium: 10, large: 14 } as const;\n\n/**\n * Floating Action Button — a circular elevated button typically used for the\n * primary action on a screen. Apply to a `<button>` element.\n *\n * @hostTag button\n * @param props.color - Button color tone. Optional `ValueOrState<ThemeColor>`, defaults to `\"primary\"`.\n * @param props.size - Button size preset. Optional `\"small\" | \"medium\" | \"large\"`, defaults to `\"medium\"`.\n * @example { button: \"+\", $: [fab()] }\n * @example { button: \"+\", $: [fab({ size: \"small\", color: \"neutral\" })] }\n */\nfunction fab(\n props: {\n color?: ValueOrState<ThemeColor>;\n size?: \"small\" | \"medium\" | \"large\";\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"primary\", \"color\");\n const dim = themeSpacing(SIZE_MAP[props.size ?? \"medium\"]);\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"button\") {\n console.warn('\"fab\" patch must use button tag');\n }\n },\n // Deep brand disc (shift-13) + light icon — mid-ramp shift-8 failed WCAG\n // (~2.2:1). tone-background-inherit wants inherit+dataTone; explicit fill\n // silences it the same way as button solid.\n _doctorDisable: [\n \"low-contrast\",\n \"color-shift-minimum\",\n \"tone-background-inherit\",\n ],\n style: {\n appearance: \"none\",\n border: \"none\",\n cursor: \"pointer\",\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n flexShrink: 0,\n width: dim,\n height: dim,\n borderRadius: \"50%\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-13\", color.get(listener)),\n color: (listener) => themeColor(listener, \"shift-0\", \"neutral\"),\n boxShadow: elevation(\"low\"),\n transition: \"background-color 200ms ease, box-shadow 200ms ease\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-14\", color.get(listener)),\n boxShadow: elevation(\"medium\"),\n },\n \"&:active:not([disabled])\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-15\", color.get(listener)),\n boxShadow: elevation(\"low\"),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) =>\n `${elevation(\"medium\")}, ${focusRing(listener, color.get(listener))}`,\n },\n \"&[disabled]\": { opacity: 0.5, cursor: \"not-allowed\" },\n },\n };\n}\n\nexport { fab };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Lays out a figure as a column with block-level media (img/svg/video/canvas)\n * and a themed `<figcaption>`. Apply to a `<figure>` element.\n *\n * @hostTag figure\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for the figure/caption text. Defaults to \"neutral\".\n * @example { figure: [{ img: \"\", src }, { figcaption: \"A caption\" }], $: [figure()] }\n */\nfunction figure(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"figure\") {\n console.warn(`\"figure\" primitive patch must use figure tag`);\n }\n },\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: themeSpacing(2),\n marginInline: 0,\n marginTop: themeSpacing(3),\n marginBottom: themeSpacing(3),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n \"& img, & svg, & video, & canvas\": {\n display: \"block\",\n maxWidth: \"100%\",\n borderRadius: themeSpacing(2),\n },\n \"& figcaption\": {\n fontSize: (listener) => themeSize(listener, \"decrease-1\"),\n color: (listener) => themeColor(listener, \"muted\", color.get(listener)),\n lineHeight: 1.45,\n },\n },\n };\n}\n\nexport { figure };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Layout patch for a group of form fields. Arranges a `<legend>`, `<label>`s,\n * controls, and helper `<p>`s in a grid — labels beside controls (horizontal)\n * or stacked above them (vertical). Apply to a `<fieldset>` element.\n *\n * @hostTag fieldset\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for legend/text/surface. Defaults to \"neutral\".\n * @param props.layout - Field arrangement, \"horizontal\" (label beside control) | \"vertical\" (label above). Defaults to \"horizontal\".\n * @example { fieldset: [{ legend: \"Profile\" }, { label: \"Name\" }, { input: \"\" }], $: [formGroup({ layout: \"vertical\" })] }\n */\nfunction formGroup(\n props: {\n color?: ValueOrState<ThemeColor>;\n layout?: \"horizontal\" | \"vertical\";\n } = {},\n): PartialElement {\n const { layout = \"horizontal\" } = props;\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n const isVertical = layout === \"vertical\";\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"fieldset\") {\n console.warn(`\"formGroup\" patch must use fieldset tag`);\n }\n },\n // Legend weight is design-system chrome for field groups.\n _doctorDisable: \"inline-typography\",\n style: {\n margin: 0,\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 3),\n border: \"none\",\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n display: \"grid\",\n gridTemplateColumns: isVertical\n ? `minmax(0, 1fr)`\n : `max-content minmax(0, 1fr)`,\n columnGap: themeSpacing(4),\n rowGap: themeSpacing(3),\n alignItems: \"start\",\n \"& > legend\": {\n gridColumn: \"1 / -1\",\n margin: 0,\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n fontWeight: 600,\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n },\n \"& > label\": {\n gridColumn: \"1\",\n alignSelf: \"start\",\n margin: 0,\n paddingBlock: (listener) =>\n isVertical ? 0 : themeSpacing(themeDensity(listener) * 1),\n },\n \"& > label:has(+ :not(legend, label, p) + p)\": {\n gridRow: isVertical ? \"auto\" : \"span 2\",\n },\n \"& > :not(legend, label, p)\": {\n gridColumn: isVertical ? \"1\" : \"2\",\n minWidth: 0,\n width: \"100%\",\n boxSizing: \"border-box\",\n },\n \"& > p\": {\n gridColumn: isVertical ? \"1\" : \"2\",\n minWidth: 0,\n margin: 0,\n marginBlockStart: `calc(${themeSpacing(2)} * -1)`,\n fontSize: (listener) => themeSize(listener, \"decrease-1\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n },\n };\n}\n\nexport { formGroup };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\nconst HeadingShift: Record<string, string> = {\n h6: \"decrease-1\",\n h5: \"inherit\",\n h4: \"increase-1\",\n h3: \"increase-2\",\n h2: \"increase-3\",\n h1: \"increase-4\",\n};\n\n/**\n * Styles a heading, scaling its font size by level (h1 largest … h6 smallest)\n * relative to the theme base size. Apply to a heading element `<h1>`–`<h6>`.\n *\n * @hostTag h1\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for the heading text. Defaults to \"neutral\".\n * @example { h2: \"Section title\", $: [heading()] }\n */\nfunction heading(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (![\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"].includes(node.tagName)) {\n console.warn(\n `\"heading\" primitive patch must use heading tags [h1...h6]`,\n );\n }\n },\n style: {\n color: (listener) =>\n themeColor(listener, \"shift-11\", color.get(listener)),\n marginTop: 0,\n marginBottom: themeSpacing(2),\n fontSize: (listener) => {\n const offset = HeadingShift[listener.elementNode.tagName] || \"inherit\";\n return themeSize(listener, offset);\n },\n },\n };\n}\n\nexport { heading };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\n\n/**\n * A thematic break rendered as a thin 1px themed line with vertical margin.\n * Apply to an `<hr>` element.\n *\n * @hostTag hr\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for the rule. Defaults to \"neutral\".\n * @example { hr: \"\", $: [horizontalRule()] }\n */\nfunction horizontalRule(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"hr\") {\n console.warn(`\"horizontalRule\" primitive patch must use hr tag`);\n }\n },\n // Soft rule surface — edge anchor (shift-3 = border) + inherit paint.\n dataTone: \"shift-3\",\n style: {\n border: 0,\n height: \"1px\",\n marginInline: 0,\n marginTop: themeSpacing(3),\n marginBottom: themeSpacing(3),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n };\n}\n\nexport { horizontalRule };\n","import type { PartialElement } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles an inline icon container: square box that centers its content and\n * applies the themed icon color. Apply to a `<span>` element.\n *\n * @hostTag span\n * @param props.color - Optional theme color tone for the icon (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @example { span: null, $: [icon()] }\n */\nfunction icon(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"span\") {\n console.warn(`\"icon\" primitive patch should use span tag`);\n }\n },\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n alignSelf: \"center\",\n justifySelf: \"center\",\n verticalAlign: \"middle\",\n width: themeSpacing(4),\n height: themeSpacing(4),\n flexShrink: \"0\",\n fontSize: (listener) => themeSize(listener),\n backgroundColor: \"transparent\",\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n };\n}\n\nexport { icon };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\n\n/**\n * Styles a responsive image: full-width, cover-fit, rounded corners with a\n * themed placeholder background. Apply to an `<img>` element.\n *\n * @hostTag img\n * @param props.color - Optional theme color tone for the placeholder background (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @example { img: null, src: \"photo.jpg\", alt: \"Photo\", $: [image()] }\n */\nfunction image(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n dataTone: \"shift-2\",\n _onInsert: (node) => {\n if (node.tagName !== \"img\") {\n console.warn(`\"image\" primitive patch must use img tag`);\n }\n },\n style: {\n display: \"block\",\n width: \"100%\",\n maxWidth: \"100%\",\n height: \"auto\",\n objectFit: \"cover\",\n borderRadius: themeSpacing(2),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n };\n}\n\nexport { image };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a custom checkbox with themed box, check mark, indeterminate state,\n * hover, focus and disabled styling. Apply to an `<input>` element of\n * type `checkbox` (the patch sets `type: \"checkbox\"`).\n *\n * @hostTag input\n * @param props.color - Optional theme color tone for the box/border (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone for the checked/indeterminate fill and focus ring (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"checkbox\", $: [inputCheckbox()] }\n */\nfunction inputCheckbox(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: \"checkbox\",\n _onInsert: (node) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputCheckbox\" primitive patch must use input tag`);\n }\n },\n style: {\n appearance: \"none\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n display: \"inline-flex\",\n position: \"relative\",\n width: themeSpacing(6),\n height: themeSpacing(6),\n justifyContent: \"center\",\n alignItems: \"center\",\n transition: \"background-color 300ms, outline-color 300ms\",\n margin: 0,\n padding: 0,\n \"&::before\": {\n content: `\"\"`,\n display: \"block\",\n borderRadius: themeSpacing(1),\n lineHeight: 1,\n cursor: \"pointer\",\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n width: themeSpacing(4),\n height: themeSpacing(4),\n },\n \"&:hover::before\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"hover\", color.get(listener)),\n },\n \"&:checked::before\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-8\", accentColor.get(listener)),\n },\n \"&:checked:hover:not([disabled])::before\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-7\", accentColor.get(listener)),\n },\n \"&:checked::after\": {\n content: `\"\"`,\n display: \"block\",\n position: \"absolute\",\n top: \"25%\",\n insetInlineStart: \"37%\",\n width: \"20%\",\n height: \"30%\",\n border: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"inherit\", accentColor.get(listener))}`,\n borderTop: 0,\n borderInlineStart: 0,\n transform: \"rotate(45deg)\",\n },\n \"&:indeterminate::before\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-3\", accentColor.get(listener)),\n },\n \"&:indeterminate::after\": {\n content: `\"\"`,\n position: \"absolute\",\n inset: \"30%\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-8\", accentColor.get(listener)),\n },\n \"&:indeterminate:hover:not([disabled])::after\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-7\", accentColor.get(listener)),\n },\n \"&:focus-visible\": {\n borderRadius: themeSpacing(1.5),\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n cursor: \"not-allowed\",\n },\n \"&[disabled]::before, &[disabled]::after\": {\n outline: \"none\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-4\", \"neutral\"),\n pointerEvents: \"none\",\n },\n },\n };\n}\n\nexport { inputCheckbox };\n","import type { PartialElement, ValueOrState } from \"@domphy/core\";\nimport { toState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a native color picker swatch with themed padding, rounded swatch and\n * disabled styling. Apply to an `<input>` element of type `color` (the patch\n * sets `type: \"color\"`).\n *\n * @hostTag input\n * @param props.color - Optional theme color tone used for the disabled state (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"color\", $: [inputColor()] }\n */\nfunction inputColor(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n return {\n type: \"color\",\n _onSchedule: (node, element) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputColor\" primitive patch must use input tag`);\n }\n (element as any).type = \"color\";\n },\n style: {\n appearance: \"none\",\n border: \"none\",\n cursor: \"pointer\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 1),\n blockSize: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n inlineSize: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n backgroundColor: \"transparent\",\n transition: \"box-shadow 140ms ease\",\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color.get(listener)),\n },\n \"&::-webkit-color-swatch-wrapper\": {\n margin: 0,\n padding: 0,\n },\n \"&::-webkit-color-swatch\": {\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n },\n },\n };\n}\n\nexport { inputColor };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\ntype InputDateTimeMode = \"date\" | \"time\" | \"week\" | \"month\" | \"datetime-local\";\n\n/**\n * Styles a native date/time input with themed border, padding, hover, focus,\n * invalid and disabled states. The `mode` selects the input `type`. Apply to\n * an `<input>` element (the patch sets `type` to the chosen `mode`).\n *\n * @hostTag input\n * @param props.mode - Input mode selecting the host `type`: `\"date\" | \"time\" | \"week\" | \"month\" | \"datetime-local\"`. Defaults to `\"datetime-local\"`.\n * @param props.color - Optional theme color tone for text/border (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone for the hover/focus ring (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"datetime-local\", $: [inputDateTime()] }\n */\nfunction inputDateTime(\n props: {\n mode?: InputDateTimeMode;\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const { mode = \"datetime-local\" } = props;\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: mode,\n _onSchedule: (node, element) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputDateTime\" primitive patch must use input tag`);\n }\n (element as any).type = mode;\n },\n style: {\n fontFamily: \"inherit\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n lineHeight: \"inherit\",\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&::-webkit-calendar-picker-indicator\": {\n cursor: \"pointer\",\n opacity: 0.85,\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-5\", accentColor.get(listener))}`,\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n },\n \"&:invalid\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", \"error\")}`,\n },\n },\n };\n}\n\nexport { inputDateTime };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a native file input with a themed upload button, border, hover, focus\n * and disabled states. Apply to an `<input>` element of type `file` (the patch\n * sets `type: \"file\"`).\n *\n * @hostTag input\n * @param props.color - Optional theme color tone for text/border and the upload button (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone for the hover/focus ring (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"file\", $: [inputFile()] }\n */\nfunction inputFile(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: \"file\",\n _onSchedule: (node, element) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputFile\" primitive patch must use input tag`);\n }\n (element as any).type = \"file\";\n },\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n fontFamily: \"inherit\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n lineHeight: \"inherit\",\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 1),\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&::-webkit-file-upload-button\": {\n marginTop: (listener) => themeSpacing(themeDensity(listener)),\n fontFamily: \"inherit\",\n fontSize: \"inherit\",\n border: \"none\",\n borderRadius: themeSpacing(1),\n height: themeSpacing(6),\n paddingInline: themeSpacing(2),\n cursor: \"pointer\",\n color: (listener) =>\n themeColor(listener, \"shift-11\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"surface\", color.get(listener)),\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-5\", accentColor.get(listener))}`,\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.8,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"surface\", \"neutral\"),\n },\n \"&[disabled]::-webkit-file-upload-button\": {\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-3\", \"neutral\"),\n },\n },\n };\n}\n\nexport { inputFile };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a native number input with themed border, padding, visible spin\n * buttons, hover, focus and disabled states. Apply to an `<input>` element of\n * type `number` (the patch sets `type: \"number\"`).\n *\n * @hostTag input\n * @param props.color - Optional theme color tone for text/border (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone for the hover/focus ring (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"number\", $: [inputNumber()] }\n */\nfunction inputNumber(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: \"number\",\n _onSchedule: (node, element) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputNumber\" primitive patch must use input tag`);\n }\n (element as any).type = \"number\";\n },\n style: {\n fontFamily: \"inherit\",\n lineHeight: \"inherit\",\n minWidth: themeSpacing(10),\n paddingInlineStart: (listener) =>\n themeSpacing(themeDensity(listener) * 3),\n paddingInlineEnd: (listener) =>\n themeSpacing(themeDensity(listener) * 1.5),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button\": {\n opacity: 1,\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-5\", accentColor.get(listener))}`,\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n },\n },\n };\n}\n\nexport { inputNumber };\n","import type { PartialElement } from \"@domphy/core\";\nimport { themeSpacing } from \"@domphy/theme\";\n\n/**\n * Lays out a one-time-password container as a horizontal row of inputs and\n * wires keyboard navigation: auto-advance on input, backspace/arrow movement,\n * and paste distribution across the child inputs. Apply to a container element\n * (e.g. `<div>`) whose direct children are the OTP `<input>` boxes. Takes no\n * props.\n *\n * @example { div: null, $: [inputOTP()], children: [{ input: null }, { input: null }] }\n */\nfunction inputOTP(): PartialElement {\n return {\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: themeSpacing(2),\n \"& > *\": {\n minWidth: `${themeSpacing(9)}!important`,\n },\n },\n _onMount: (node) => {\n const container = node.domElement as HTMLElement;\n const getInputs = () =>\n Array.from(container.querySelectorAll(\"input\")) as HTMLInputElement[];\n\n const onInput = (e: Event) => {\n const inputs = getInputs();\n const target = e.target as HTMLInputElement;\n const idx = inputs.indexOf(target);\n if (target.value && idx < inputs.length - 1) {\n inputs[idx + 1].focus();\n }\n };\n\n const onKeydown = (e: KeyboardEvent) => {\n const inputs = getInputs();\n const target = e.target as HTMLInputElement;\n const idx = inputs.indexOf(target);\n if (e.key === \"Backspace\" && !target.value && idx > 0) {\n inputs[idx - 1].focus();\n }\n if (e.key === \"ArrowLeft\" && idx > 0) inputs[idx - 1].focus();\n if (e.key === \"ArrowRight\" && idx < inputs.length - 1)\n inputs[idx + 1].focus();\n };\n\n const onPaste = (e: ClipboardEvent) => {\n e.preventDefault();\n const text = e.clipboardData?.getData(\"text\") ?? \"\";\n const inputs = getInputs();\n const found = inputs.indexOf(e.target as HTMLInputElement);\n const startIdx = found === -1 ? 0 : found;\n [...text].forEach((char, i) => {\n if (inputs[startIdx + i]) inputs[startIdx + i].value = char;\n });\n const lastFilled = Math.min(\n startIdx + text.length - 1,\n inputs.length - 1,\n );\n inputs[lastFilled]?.focus();\n };\n\n container.addEventListener(\"input\", onInput);\n container.addEventListener(\"keydown\", onKeydown as EventListener);\n container.addEventListener(\"paste\", onPaste as EventListener);\n\n node.addHook(\"Remove\", () => {\n container.removeEventListener(\"input\", onInput);\n container.removeEventListener(\"keydown\", onKeydown as EventListener);\n container.removeEventListener(\"paste\", onPaste as EventListener);\n });\n },\n };\n}\n\nexport { inputOTP };\n","import type { DomphyElement, PartialElement, StyleObject } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n// Tabler Icons (MIT) — eye and eye-off outlines.\nconst EYE_SVG =\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" ` +\n `stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" ` +\n `width=\"1em\" height=\"1em\">` +\n `<path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>` +\n `<path d=\"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0\"/>` +\n `<path d=\"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6\"/>` +\n `</svg>`;\n\nconst EYE_OFF_SVG =\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" ` +\n `stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" ` +\n `width=\"1em\" height=\"1em\">` +\n `<path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>` +\n `<path d=\"M10.585 10.587a2 2 0 0 0 2.829 2.828\"/>` +\n `<path d=\"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6` +\n `c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18` +\n `c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87\"/>` +\n `<path d=\"M3 3l18 18\"/>` +\n `</svg>`;\n\n/**\n * Password input wrapper: a styled `<div>` that inserts an `<input type=\"password\">`\n * and a show/hide toggle button. The outer div carries the focus-ring outline via\n * `:focus-within`. Apply to an empty `<div>`.\n *\n * @hostTag div\n * @param props.color - Base color tone for border/background/text. Defaults to `\"neutral\"`.\n * @param props.accentColor - Accent outline color on focus-within. Defaults to `\"primary\"`.\n * @example { div: null, $: [inputPassword()] }\n */\nfunction inputPassword(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const colorState = toState(props.color ?? \"neutral\", \"color\");\n const accentState = toState(props.accentColor ?? \"primary\", \"accentColor\");\n const visibleState = toState(false);\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"div\") {\n console.warn('\"inputPassword\" patch must use div tag');\n }\n },\n // Build the input/toggle as real child elements (not imperative DOM\n // mutation in _onMount) so generateHTML()/SSR emits the actual markup.\n _onInit: (node) => {\n const field: DomphyElement<\"input\"> = {\n input: null,\n type: (l) => (visibleState.get(l) ? \"text\" : \"password\"),\n style: {\n flex: 1,\n minWidth: 0,\n border: \"none\",\n outline: \"none\",\n backgroundColor: \"transparent\",\n padding: 0,\n margin: 0,\n font: \"inherit\",\n color: \"inherit\",\n },\n };\n\n const toggle: DomphyElement<\"button\"> = {\n button: (l) => (visibleState.get(l) ? EYE_OFF_SVG : EYE_SVG),\n type: \"button\",\n ariaLabel: (l) =>\n visibleState.get(l) ? \"Hide password\" : \"Show password\",\n onClick: () => visibleState.set(!visibleState.get()),\n style: {\n background: \"none\",\n border: \"none\",\n padding: 0,\n margin: 0,\n cursor: \"pointer\",\n color: \"inherit\",\n display: \"flex\",\n alignItems: \"center\",\n flexShrink: 0,\n opacity: 0.6,\n },\n };\n\n node.children.insert(field);\n node.children.insert(toggle);\n },\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: (l) => themeSpacing(themeDensity(l) * 1),\n paddingBlock: (l) => themeSpacing(themeDensity(l) * 1),\n paddingInline: (l) => themeSpacing(themeDensity(l) * 3),\n borderRadius: (l) => themeSpacing(themeDensity(l) * 1.5),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (l) =>\n `1px solid ${themeColor(l, \"border-strong\", colorState.get(l))}`,\n color: (l) => themeColor(l, \"text\", colorState.get(l)),\n backgroundColor: (l) => themeColor(l, \"inherit\", colorState.get(l)),\n fontSize: (l) => themeSize(l, \"inherit\"),\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&:hover:not(:has([disabled])):not(:focus-within)\": {\n outline: (l) =>\n `1px solid ${themeColor(l, \"shift-5\", accentState.get(l))}`,\n },\n \"&:focus-within\": {\n boxShadow: (l) => focusRing(l, accentState.get(l)),\n },\n } as StyleObject,\n };\n}\n\nexport { inputPassword };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a custom radio button with a themed circular box, checked dot, hover,\n * focus and disabled states. Apply to an `<input>` element of type `radio`\n * (the patch sets `type: \"radio\"`).\n *\n * @hostTag input\n * @param props.color - Optional theme color tone for the box/border (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone for the checked dot and focus ring (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"radio\", $: [inputRadio()] }\n */\nfunction inputRadio(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: \"radio\",\n _onInsert: (node) => {\n if (node.tagName !== \"input\") {\n console.warn(\n `\"inputRadio\" primitive patch must use input tag and radio type`,\n );\n return;\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n appearance: \"none\",\n display: \"inline-flex\",\n position: \"relative\",\n width: themeSpacing(6),\n height: themeSpacing(6),\n justifyContent: \"center\",\n alignItems: \"center\",\n transition: \"background-color 300ms, outline-color 300ms\",\n margin: 0,\n padding: 0,\n \"&::before\": {\n content: `\"\"`,\n display: \"block\",\n borderRadius: \"50%\",\n lineHeight: 1,\n cursor: \"pointer\",\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n width: themeSpacing(4),\n height: themeSpacing(4),\n },\n \"&:hover::before\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"hover\", color.get(listener)),\n },\n \"&:checked::before\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n },\n \"&:checked::after\": {\n content: `\"\"`,\n position: \"absolute\",\n inset: \"30%\",\n borderRadius: \"50%\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-8\", accentColor.get(listener)),\n },\n \"&:checked:hover:not([disabled])::before\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-7\", accentColor.get(listener)),\n },\n \"&:focus-visible\": {\n borderRadius: \"50%\",\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n cursor: \"not-allowed\",\n },\n \"&[disabled]::before, &[disabled]::after\": {\n outline: \"none\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-4\", \"neutral\"),\n pointerEvents: \"none\",\n },\n },\n };\n}\n\nexport { inputRadio };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a range slider with a themed track and thumb, hover, focus and\n * disabled states. Apply to an `<input>` element of type `range` (the patch\n * sets `type: \"range\"`).\n *\n * @hostTag input\n * @param props.color - Optional theme color tone for the slider track (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone for the thumb and focus ring (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"range\", $: [inputRange()] }\n */\nfunction inputRange(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: \"range\",\n _onInsert: (node) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputRange\" primitive patch must use input tag`);\n }\n },\n style: {\n appearance: \"none\",\n width: \"100%\",\n margin: 0,\n padding: 0,\n height: themeSpacing(4),\n background: \"transparent\",\n cursor: \"pointer\",\n \"&::-webkit-slider-runnable-track\": {\n height: themeSpacing(1.5),\n borderRadius: themeSpacing(999),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-3\", color.get(listener)),\n },\n \"&::-webkit-slider-thumb\": {\n appearance: \"none\",\n width: themeSpacing(4),\n height: themeSpacing(4),\n borderRadius: themeSpacing(999),\n border: \"none\",\n marginTop: `calc((${themeSpacing(1.5)} - ${themeSpacing(4)}) / 2)`,\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-9\", accentColor.get(listener)),\n },\n \"&:hover:not([disabled])::-webkit-slider-thumb\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-10\", accentColor.get(listener)),\n },\n borderRadius: themeSpacing(2),\n transition: \"box-shadow 140ms ease\",\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n },\n },\n };\n}\n\nexport { inputRange };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a search input with themed border, padding, placeholder color, native\n * search decorations, hover, focus and disabled states. Apply to an `<input>`\n * element of type `search` (the patch sets `type: \"search\"`).\n *\n * @hostTag input\n * @param props.color - Optional theme color tone for text/border/placeholder (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone for the hover/focus ring (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"search\", $: [inputSearch()] }\n */\nfunction inputSearch(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: \"search\",\n _onSchedule: (node, element) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputSearch\" primitive patch must use input tag`);\n }\n (element as any).type = \"search\";\n },\n style: {\n fontFamily: \"inherit\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n lineHeight: \"inherit\",\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n minWidth: themeSpacing(32),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&::placeholder\": {\n color: (listener) =>\n themeColor(listener, \"shift-7\", color.get(listener)),\n },\n \"&::-webkit-search-decoration\": {\n display: \"none\",\n },\n \"&::-webkit-search-cancel-button\": {\n cursor: \"pointer\",\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-5\", accentColor.get(listener))}`,\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n },\n },\n };\n}\n\nexport { inputSearch };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a checkbox as a toggle switch: themed track and sliding knob that\n * animates and recolors on checked, plus a disabled state. Apply to an\n * `<input>` element of type `checkbox` (the patch sets `type: \"checkbox\"`).\n *\n * @hostTag input\n * @param props.accentColor - Optional theme color tone for the checked track (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"checkbox\", $: [inputSwitch()] }\n */\nfunction inputSwitch(\n props: { accentColor?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n role: \"switch\",\n dataTone: \"shift-2\",\n type: \"checkbox\",\n _onSchedule: (node) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputSwitch\" primitive patch must use input tag`);\n return;\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n // Surface contract: dataTone is set; paint track via inherit + text color.\n backgroundColor: (listener) => themeColor(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\"),\n appearance: \"none\",\n position: \"relative\",\n display: \"inline-flex\",\n width: themeSpacing(9),\n height: themeSpacing(6),\n cursor: \"pointer\",\n margin: `0`,\n paddingBlock: themeSpacing(1),\n transition: \"box-shadow 140ms ease\",\n borderRadius: themeSpacing(999),\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&:checked\": {\n \"&::before\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"increase-3\", accentColor.get(listener)),\n },\n \"&::after\": {\n left: `calc(100% - ${themeSpacing(3.5)})`,\n },\n },\n \"&::after\": {\n content: `\"\"`,\n aspectRatio: `1/1`,\n position: \"absolute\",\n width: themeSpacing(3),\n height: themeSpacing(3),\n borderRadius: themeSpacing(999),\n left: themeSpacing(0.5),\n top: \"50%\",\n transform: \"translateY(-50%)\",\n transition: \"left 0.3s\",\n backgroundColor: (listener) => themeColor(listener, \"decrease-3\"),\n },\n \"&::before\": {\n content: '\"\"',\n width: \"100%\",\n borderRadius: themeSpacing(999),\n display: \"inline-block\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n lineHeight: 1,\n backgroundColor: (listener) => themeColor(listener),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n },\n },\n };\n}\n\nexport { inputSwitch };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Themed single-line text input primitive. Sets `type=\"text\"` and styles the\n * field with themed border, focus ring, placeholder, disabled and validation\n * (`data-status`) states. Apply to an `<input>` element.\n *\n * @hostTag input\n * @param props - Optional configuration.\n * @param props.color - Base color tone for text/border/background. Defaults to `\"neutral\"`.\n * @param props.accentColor - Accent color tone for the hover/focus outline. Defaults to `\"primary\"`.\n * @example { input: \"\", type: \"text\", placeholder: \"Name\", $: [inputText()] }\n */\nfunction inputText(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: \"text\",\n _onSchedule: (node, element) => {\n if (node.tagName !== \"input\") {\n console.warn(\n `\"inputText\" primitive patch must use input tag and text type`,\n );\n }\n (element as any).type = \"text\";\n },\n style: {\n fontFamily: \"inherit\",\n lineHeight: \"inherit\",\n minWidth: themeSpacing(10),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&::placeholder\": {\n color: (listener) => themeColor(listener, \"shift-7\"),\n },\n \"&:not(:placeholder-shown)\": {\n color: (listener) => themeColor(listener, \"shift-10\"),\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-5\", accentColor.get(listener))}`,\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n },\n \"&:invalid:not(:placeholder-shown)\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", \"error\")}`,\n },\n \"&[data-status=error]\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", \"error\")}`,\n },\n \"&[data-status=warning]\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", \"warning\")}`,\n },\n },\n };\n}\n\nexport { inputText };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Renders keyboard-key styling (themed background, border and padding) for a\n * keystroke hint. Apply to a `<kbd>` element.\n *\n * @hostTag kbd\n * @param props - Optional configuration.\n * @param props.color - Color tone for text/background/border. Defaults to `\"neutral\"`.\n * @example { kbd: \"Ctrl\", $: [keyboard()] }\n */\nfunction keyboard(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"kbd\") {\n console.warn(`\"keyboard\" primitive patch must use kbd tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n paddingBlock: themeSpacing(0.5),\n paddingInline: themeSpacing(1.5),\n borderRadius: themeSpacing(1),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n },\n };\n}\n\nexport { keyboard };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Themed form-label primitive: inline-flex layout with gap, themed text color,\n * focus-within highlighting and a disabled (`aria-disabled`) state. Apply to a\n * `<label>` element.\n *\n * @hostTag label\n * @param props - Optional configuration.\n * @param props.color - Base color tone for the label text. Defaults to `\"neutral\"`.\n * @param props.accentColor - Accent color tone applied on focus-within. Defaults to `\"primary\"`.\n * @example { label: \"Email\", htmlFor: \"email\", $: [label()] }\n */\nfunction label(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"label\") {\n console.warn(`\"label\" primitive patch must use label tag`);\n }\n },\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: themeSpacing(2),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n cursor: \"pointer\",\n \"&:focus-within\": {\n color: (listener) =>\n themeColor(listener, \"shift-10\", accentColor.get(listener)),\n },\n \"&[aria-disabled=true]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n },\n },\n };\n}\n\nexport { label };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Themed hyperlink primitive: styles text color, hover underline, visited,\n * focus ring and a disabled state. Apply to an `<a>` element.\n *\n * @hostTag a\n * @param props - Optional configuration.\n * @param props.color - Base color tone for the link text. Defaults to `\"primary\"`.\n * @param props.accentColor - Accent color tone for visited/focus states. Defaults to `\"secondary\"`.\n * @example { a: \"Home\", href: \"/\", $: [link()] }\n */\nfunction link(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"primary\", \"color\");\n const accentColor = toState(props.accentColor ?? \"secondary\", \"accentColor\");\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"a\") {\n console.warn(`\"link\" primitive patch must use a tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) => themeColor(listener),\n // shift-13 (not \"text\"/shift-9): brand hues need extra depth for ≥4.5:1\n // on a light surface (primary orange failed at 2.57 with shift-9).\n color: (listener) => themeColor(listener, \"shift-13\", color.get(listener)),\n textDecoration: \"none\",\n \"&:visited\": {\n color: (listener) =>\n themeColor(listener, \"shift-13\", accentColor.get(listener)),\n },\n \"&:hover:not([disabled])\": {\n color: (listener) =>\n themeColor(listener, \"shift-14\", color.get(listener)),\n textDecoration: \"underline\",\n },\n borderRadius: themeSpacing(1),\n // Kill the browser default outline so only the shared focusRing shows.\n outline: \"none\",\n transition: \"color 140ms ease, box-shadow 140ms ease\",\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n },\n },\n };\n}\n\nexport { link };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { BUTTON_SIZE_FONT, type ButtonSize } from \"../utils/buttonSize.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\nimport type { ButtonVariant } from \"./button.js\";\n\nconst PADDING_STEPS: Record<ButtonSize, { block: number; inline: number }> = {\n small: { block: 0.5, inline: 2 },\n medium: { block: 1, inline: 3 },\n large: { block: 1.5, inline: 4 },\n};\n\nconst GHOST_PADDING: Record<ButtonSize, number> = {\n small: 0.5,\n medium: 1,\n large: 1.5,\n};\n\n/**\n * An `<a>` element styled to look like a button — same visual system as\n * `button()` (`variant` / `size` / color) while preserving link semantics\n * (href, middle-click, right-click). Apply to an `<a>` element.\n *\n * @hostTag a\n * @param props.color - Button color tone. Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @param props.variant - `\"outline\"` (default) | `\"solid\"` | `\"ghost\"` — matches `button()`.\n * @param props.size - `\"small\" | \"medium\" | \"large\"`, defaults to `\"medium\"`.\n * @example { a: \"Open app\", href: \"/app\", $: [linkButton({ color: \"primary\" })] }\n * @example { a: \"Get started\", href: \"/start\", $: [linkButton({ variant: \"solid\" })] }\n */\nfunction linkButton(\n props: {\n color?: ValueOrState<ThemeColor>;\n variant?: ButtonVariant;\n size?: ButtonSize;\n } = {},\n): PartialElement {\n const variant = props.variant ?? \"outline\";\n const color = toState(\n props.color ?? (variant === \"ghost\" ? \"neutral\" : \"primary\"),\n \"color\",\n );\n const size = props.size ?? \"medium\";\n const fontSize = BUTTON_SIZE_FONT[size];\n\n if (variant === \"ghost\") {\n const padding = GHOST_PADDING[size];\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"a\") {\n console.warn(`\"linkButton\" primitive patch must use a tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, fontSize),\n textDecoration: \"none\",\n paddingBlock: (listener) =>\n themeSpacing(themeDensity(listener) * padding),\n paddingInline: (listener) =>\n themeSpacing(themeDensity(listener) * padding),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n display: \"inline-flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gap: (listener) => themeSpacing(themeDensity(listener) * 1),\n userSelect: \"none\",\n cursor: \"pointer\",\n fontFamily: \"inherit\",\n lineHeight: \"inherit\",\n border: \"none\",\n background: \"none\",\n outline: \"none\",\n transition:\n \"background-color 140ms ease, color 140ms ease, box-shadow 140ms ease\",\n color: (listener) =>\n themeColor(listener, \"shift-6\", color.get(listener)),\n \"&:hover:not([aria-disabled=true])\": {\n color: (listener) =>\n themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"hover\", color.get(listener)),\n textDecoration: \"none\",\n },\n \"&:active:not([aria-disabled=true])\": {\n color: (listener) =>\n themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"increase-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color.get(listener)),\n },\n \"&[aria-disabled=true]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n pointerEvents: \"none\",\n color: (listener) => themeColor(listener, \"border-strong\", \"neutral\"),\n },\n },\n };\n }\n\n const isSolid = variant === \"solid\";\n const padding = PADDING_STEPS[size];\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"a\") {\n console.warn(`\"linkButton\" primitive patch must use a tag`);\n }\n },\n ...(isSolid\n ? {\n _doctorDisable: [\n \"low-contrast\",\n \"color-shift-minimum\",\n \"tone-background-inherit\",\n ] as const,\n }\n : {}),\n style: {\n fontSize: (listener) => themeSize(listener, fontSize),\n textDecoration: \"none\",\n paddingBlock: (listener) =>\n themeSpacing(themeDensity(listener) * padding.block),\n paddingInline: (listener) =>\n themeSpacing(themeDensity(listener) * padding.inline),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n width: \"fit-content\",\n display: \"inline-flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gap: (listener) => themeSpacing(themeDensity(listener) * 1),\n userSelect: \"none\",\n cursor: \"pointer\",\n fontFamily: \"inherit\",\n lineHeight: \"inherit\",\n border: \"none\",\n outlineOffset: \"-1px\",\n outlineWidth: \"1px\",\n outline: isSolid\n ? \"none\"\n : (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n // Solid: deep brand (shift-13) + light-end text (not mid-ramp ~2.2:1).\n // Outline: shift-13 for ≥4.5:1 on light bg.\n color: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-0\", \"neutral\")\n : themeColor(listener, \"shift-13\", color.get(listener)),\n backgroundColor: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-13\", color.get(listener))\n : themeColor(listener, \"inherit\", color.get(listener)),\n transition:\n \"background-color 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease\",\n \"&:hover:not([aria-disabled=true])\": {\n textDecoration: \"none\",\n color: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-0\", \"neutral\")\n : themeColor(listener, \"shift-14\", color.get(listener)),\n backgroundColor: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-14\", color.get(listener))\n : themeColor(listener, \"hover\", color.get(listener)),\n },\n \"&:active:not([aria-disabled=true])\": {\n backgroundColor: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-15\", color.get(listener))\n : themeColor(listener, \"increase-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color.get(listener)),\n },\n \"&[aria-disabled=true]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n pointerEvents: \"none\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n },\n },\n };\n}\n\nexport { linkButton };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a navigation/display list container. Sets `list-style: none` and\n * zero padding; pairs with `listItem` and `listItemButton`. Apply to `<ul>`.\n *\n * @hostTag ul\n * @param props.color - Surface color tone. Optional `ThemeColor`, defaults to `\"neutral\"`.\n * @example { ul: [...], $: [list()] }\n */\nfunction list(_props: { color?: ThemeColor } = {}): PartialElement {\n return {\n style: {\n listStyle: \"none\",\n margin: 0,\n padding: 0,\n display: \"flex\",\n flexDirection: \"column\",\n },\n };\n}\n\n/**\n * A non-interactive list row. Typically wraps an icon + text. Apply to `<li>`.\n *\n * @hostTag li\n * @param props.dense - Reduce vertical padding. Optional `boolean`, defaults to `false`.\n * @example { li: \"Item\", $: [listItem()] }\n */\nfunction listItem(props: { dense?: boolean } = {}): PartialElement {\n const { dense = false } = props;\n return {\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingBlock: (listener) =>\n themeSpacing(dense ? 1 : themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\"),\n },\n };\n}\n\n/**\n * An interactive (clickable) list row with hover/focus-visible states. Apply\n * to `<button>` or `<a>` inside an `<li>`.\n *\n * @param props.color - Color tone. Optional `ValueOrState<ThemeColor>`, defaults to `\"neutral\"`.\n * @param props.accentColor - Focus/active accent. Optional `ThemeColor`, defaults to `\"primary\"`.\n * @param props.dense - Reduce vertical padding. Optional `boolean`, defaults to `false`.\n * @example { button: \"Action\", $: [listItemButton()] }\n */\nfunction listItemButton(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ThemeColor;\n dense?: boolean;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = props.accentColor ?? \"primary\";\n const { dense = false } = props;\n\n return {\n style: {\n cursor: \"pointer\",\n appearance: \"none\",\n border: \"none\",\n background: \"transparent\",\n textDecoration: \"none\",\n textAlign: \"left\",\n display: \"flex\",\n alignItems: \"center\",\n width: \"100%\",\n gap: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingBlock: (listener) =>\n themeSpacing(dense ? 1 : themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n transition: \"background-color 150ms ease, box-shadow 140ms ease\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"hover\", color.get(listener)),\n },\n \"&:active:not([disabled])\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"increase-2\", color.get(listener)),\n },\n \"&[aria-current=page], &[aria-selected=true]\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-3\", accentColor),\n color: (listener) => themeColor(listener, \"shift-12\", accentColor),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor),\n },\n \"&[disabled]\": { opacity: 0.5, cursor: \"not-allowed\" },\n },\n };\n}\n\nexport { list, listItem, listItemButton };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Themed highlight primitive: gives marked/highlighted inline text a tinted\n * background, rounded corners and padding. Apply to a `<mark>` element.\n *\n * @hostTag mark\n * @param props - Optional configuration.\n * @param props.accentColor - Accent color tone for the highlight fill and text. Defaults to `\"highlight\"`.\n * @example { mark: \"important\", $: [mark()] }\n */\nfunction mark(\n props: { accentColor?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const accentColor = toState(props.accentColor ?? \"highlight\", \"accentColor\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"mark\") {\n console.warn(`\"mark\" primitive patch must use mark tag`);\n }\n },\n dataTone: \"shift-2\",\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) =>\n themeColor(listener, \"text\", accentColor.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", accentColor.get(listener)),\n height: themeSpacing(6),\n borderRadius: themeSpacing(1),\n paddingInline: themeSpacing(1.5),\n },\n };\n}\n\nexport { mark };\n","import {\n type DomphyElement,\n type Listener,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/** One item inside a menu. */\ntype MenuItem = {\n /** Button label — plain string (auto-wrapped) or any DomphyElement (e.g. icon + text). */\n label: string | DomphyElement;\n /** Stable key. Defaults to the item's zero-based index. */\n key?: string | number;\n /** Called when the item is clicked. */\n onClick?: () => void;\n};\n\n/**\n * All-in-one vertical menu. Generates `<button>` `[role=menuitem]` elements\n * from the `items` array with keyboard navigation (Arrow/Home/End/Enter/Space).\n * Apply to any wrapper element (`div`, `ul`, …).\n *\n * @param props.items - Item definitions `{ label, key?, onClick? }`. Pass `[]`\n * to keep the wrapper's own children (escape hatch for fully custom rows —\n * only the menu container styling and `role=\"menu\"` semantics apply then).\n * @param props.activeKey - Currently selected key (value or State). Defaults to `null`.\n * @param props.selectable - Whether items track and update the active selection. Defaults to `true`.\n * @param props.color - Background color tone for the menu. Defaults to `\"neutral\"`.\n * @param props.accentColor - Accent color for the active/focus item. Defaults to `\"primary\"`.\n * @example\n * { div: null, $: [menu({ items: [\n * { label: \"Profile\", key: \"profile\", onClick: () => navigate(\"/profile\") },\n * { label: \"Settings\", key: \"settings\", onClick: () => navigate(\"/settings\") },\n * ] })] }\n */\nfunction menu(\n props: {\n items: MenuItem[];\n activeKey?: ValueOrState<number | string | null>;\n selectable?: boolean;\n color?: ThemeColor;\n accentColor?: ThemeColor;\n } = { items: [] },\n): PartialElement {\n const {\n items = [],\n selectable = true,\n color = \"neutral\",\n accentColor = \"primary\",\n } = props;\n const activeKey = toState(props.activeKey ?? null);\n\n return {\n role: \"menu\",\n dataTone: \"shift-17\",\n _onSchedule: (node, element) => {\n // Empty items = the caller renders its own rows; leave children alone.\n if (items.length === 0) return;\n const id = node.nodeId;\n\n const buttons: DomphyElement<\"button\">[] = items.map((item, index) => {\n const key = item.key ?? index;\n\n return {\n button:\n typeof item.label === \"string\"\n ? [{ span: item.label } as DomphyElement<\"span\">]\n : [item.label],\n _key: key,\n type: \"button\",\n id: `menuitem${id}${key}`,\n role: \"menuitem\",\n ...(selectable\n ? {\n ariaCurrent: (l: Listener) =>\n activeKey.get(l) === key || undefined,\n }\n : {}),\n onClick: () => {\n if (selectable) activeKey.set(key);\n item.onClick?.();\n },\n onKeyDown: (e: Event) => {\n const k = (e as KeyboardEvent).key;\n if (k === \"Enter\" || k === \" \") {\n e.preventDefault();\n (e.target as HTMLElement).click();\n return;\n }\n if (![\"ArrowDown\", \"ArrowUp\", \"Home\", \"End\"].includes(k)) return;\n e.preventDefault();\n const keys = items.map((it, i) => it.key ?? i);\n const idx = keys.indexOf(key);\n let next = idx;\n if (k === \"ArrowDown\") next = (idx + 1) % keys.length;\n else if (k === \"ArrowUp\")\n next = (idx - 1 + keys.length) % keys.length;\n else if (k === \"Home\") next = 0;\n else if (k === \"End\") next = keys.length - 1;\n (\n document.getElementById(\n `menuitem${id}${keys[next]}`,\n ) as HTMLElement\n )?.focus();\n },\n style: {\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n gap: themeSpacing(2),\n width: \"100%\",\n fontSize: (l: Listener) => themeSize(l, \"inherit\"),\n height: (l: Listener) => themeSpacing(6 + themeDensity(l) * 2),\n paddingInline: (l: Listener) => themeSpacing(themeDensity(l) * 3),\n border: \"none\",\n outline: \"none\",\n // Menu panel is dataTone shift-17: shift-17 text = opposite ramp end\n // (readable on dark light-theme panels and light dark-theme panels).\n color: (l: Listener) => themeColor(l, \"shift-17\", color),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\", color),\n transition: \"background-color 140ms ease, box-shadow 140ms ease, color 140ms ease\",\n \"&:hover:not([disabled]):not([aria-current=true])\": {\n backgroundColor: (l: Listener) => themeColor(l, \"hover\", color),\n },\n \"&[aria-current=true]\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-3\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-13\", accentColor),\n },\n \"&:focus-visible\": {\n boxShadow: (l: Listener) => focusRing(l, accentColor),\n },\n },\n } as DomphyElement<\"button\">;\n });\n\n (element as any)[node.tagName] = buttons;\n },\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n paddingBlock: (l: Listener) => themeSpacing(themeDensity(l) * 2),\n paddingInline: (l: Listener) => themeSpacing(themeDensity(l) * 2),\n fontSize: (l: Listener) => themeSize(l, \"inherit\"),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\", color),\n color: (l: Listener) => themeColor(l, \"text\", color),\n borderRadius: (l: Listener) => themeSpacing(themeDensity(l) * 2),\n outline: (l: Listener) =>\n `1px solid ${themeColor(l, \"border-strong\", color)}`,\n outlineOffset: \"-1px\",\n boxShadow: elevation(\"medium\"),\n },\n };\n}\n\nexport { menu };\nexport type { MenuItem };\n","import type { PartialElement, State } from \"@domphy/core\";\n\n/**\n * One keyframe. Shorthands `x`/`y` (px), `scale`, `rotate` (deg) compose into a\n * single `transform`; any other key is a raw CSS property (e.g. `opacity`,\n * `backgroundColor`).\n */\nexport type MotionKeyframe = {\n x?: number | string;\n y?: number | string;\n scale?: number | string;\n rotate?: number | string;\n} & Record<string, string | number>;\n\nexport interface MotionProps {\n /** Starting keyframe applied before the enter animation. */\n initial?: MotionKeyframe;\n /** Target keyframe. Pass a `State` to re-animate whenever it changes. */\n animate?: MotionKeyframe | State<MotionKeyframe>;\n /** Keyframe animated to before the element is removed. */\n exit?: MotionKeyframe;\n transition?: {\n /** ms, default 300. */\n duration?: number;\n /** ms, default 0. */\n delay?: number;\n /** CSS easing, default \"ease\". */\n easing?: string;\n iterations?: number;\n };\n}\n\nconst isState = (value: unknown): value is State<MotionKeyframe> =>\n !!value &&\n typeof (value as State<MotionKeyframe>).get === \"function\" &&\n (value as { _isState?: boolean })._isState === true;\n\nconst toStyles = (frame: MotionKeyframe): Keyframe => {\n const out: Record<string, string | number> = {};\n const transforms: string[] = [];\n for (const key in frame) {\n const value = frame[key];\n if (key === \"x\") {\n transforms.push(\n `translateX(${typeof value === \"number\" ? `${value}px` : value})`,\n );\n } else if (key === \"y\") {\n transforms.push(\n `translateY(${typeof value === \"number\" ? `${value}px` : value})`,\n );\n } else if (key === \"scale\") {\n transforms.push(`scale(${value})`);\n } else if (key === \"rotate\") {\n transforms.push(\n `rotate(${typeof value === \"number\" ? `${value}deg` : value})`,\n );\n } else {\n out[key] = value;\n }\n }\n if (transforms.length) out.transform = transforms.join(\" \");\n return out as Keyframe;\n};\n\n/**\n * Animation primitive driven by the Web Animations API. Runs an enter\n * animation on mount (`initial` -> `animate`), re-animates whenever `animate`\n * is a `State` that changes, and plays the `exit` keyframe before removal.\n * Has no host-tag restriction; apply to any element you want to animate.\n *\n * @param props - Optional configuration (see {@link MotionProps}).\n * @param props.initial - Starting keyframe applied before the enter animation.\n * @param props.animate - Target keyframe, or a `State` to re-animate on change.\n * @param props.exit - Keyframe animated to before the element is removed.\n * @param props.transition - Timing options.\n * @param props.transition.duration - Duration in ms. Defaults to `300`.\n * @param props.transition.delay - Delay in ms. Defaults to `0`.\n * @param props.transition.easing - CSS easing. Defaults to `\"ease\"`.\n * @param props.transition.iterations - Number of iterations. Defaults to `1`.\n * @example { div: \"Hello\", $: [motion({ initial: { opacity: 0 }, animate: { opacity: 1 } })] }\n */\nfunction prefersReducedMotion(): boolean {\n if (typeof matchMedia !== \"function\") return false;\n try {\n return matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n } catch {\n return false;\n }\n}\n\nfunction motion(props: MotionProps = {}): PartialElement {\n const { initial, animate, exit, transition = {} } = props;\n const options: KeyframeAnimationOptions = {\n duration: transition.duration ?? 300,\n delay: transition.delay ?? 0,\n easing: transition.easing ?? \"ease\",\n iterations: transition.iterations ?? 1,\n fill: \"both\",\n };\n\n return {\n _onMount: (node) => {\n const el = node.domElement as HTMLElement | null;\n if (!el || typeof el.animate !== \"function\") return;\n const target = isState(animate) ? animate.get() : animate;\n // WCAG 2.3.3 / Front-End Checklist: respect prefers-reduced-motion.\n if (prefersReducedMotion()) {\n if (target) Object.assign(el.style, toStyles(target));\n else if (initial) Object.assign(el.style, toStyles(initial));\n if (isState(animate)) {\n const release = animate.addListener((next: MotionKeyframe) => {\n Object.assign(el.style, toStyles(next));\n });\n node.setMetadata(\"motionRelease\", release);\n }\n return;\n }\n if (target) {\n el.animate(\n initial ? [toStyles(initial), toStyles(target)] : [toStyles(target)],\n options,\n );\n } else if (initial) {\n Object.assign(el.style, toStyles(initial));\n }\n if (isState(animate)) {\n const release = animate.addListener((next: MotionKeyframe) => {\n el.animate([toStyles(next)], options);\n });\n node.setMetadata(\"motionRelease\", release);\n }\n },\n _onBeforeRemove: (node, done) => {\n const el = node.domElement as HTMLElement | null;\n if (!el || !exit || typeof el.animate !== \"function\") return done();\n if (prefersReducedMotion()) {\n Object.assign(el.style, toStyles(exit));\n return done();\n }\n el.animate([toStyles(exit)], options).finished.then(done, done);\n },\n _onRemove: (node) => {\n const release = node.getMetadata(\"motionRelease\") as\n | (() => void)\n | undefined;\n release?.();\n },\n };\n}\n\nexport { motion };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Themed ordered-list primitive: decimal markers positioned outside, reset\n * margins and themed text color. Apply to an `<ol>` element.\n *\n * @hostTag ol\n * @param props - Optional configuration.\n * @param props.color - Color tone for the list text. Defaults to `\"neutral\"`.\n * @example { ol: \"\", $: [orderedList()], children: [{ li: \"First\" }] }\n */\nfunction orderedList(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"ol\") {\n console.warn(`\"orderedList\" primitive patch must use ol tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) => themeColor(listener),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n marginTop: 0,\n marginBottom: 0,\n paddingLeft: themeSpacing(3),\n listStyleType: \"decimal\",\n listStylePosition: \"outside\",\n },\n };\n}\n\nexport { orderedList };\n","import {\n type DomphyElement,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\nfunction getPages(current: number, total: number): (number | \"...\")[] {\n if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);\n const pages: (number | \"...\")[] = [1];\n if (current > 3) pages.push(\"...\");\n const start = Math.max(2, current - 1);\n const end = Math.min(total - 1, current + 1);\n for (let i = start; i <= end; i++) pages.push(i);\n if (current < total - 2) pages.push(\"...\");\n pages.push(total);\n return pages;\n}\n\n/**\n * Themed pagination control. Renders previous/next buttons plus truncated page\n * numbers (with ellipses), tracks the current page in a `State`, and updates it\n * on click. Apply to a `<div>` element.\n *\n * @hostTag div\n * @param props - Configuration.\n * @param props.total - Required. Total number of pages.\n * @param props.value - Current page, accepts a value or `State`. Defaults to `1`.\n * @param props.color - Base color tone for the page buttons. Defaults to `\"neutral\"`.\n * @param props.accentColor - Accent color tone for the active page. Defaults to `\"primary\"`.\n * @example { div: \"\", $: [pagination({ total: 10, value: 1 })] }\n */\nfunction pagination(props: {\n value?: ValueOrState<number>;\n total: number;\n color?: ThemeColor;\n accentColor?: ThemeColor;\n}): PartialElement {\n const { total, color = \"neutral\", accentColor = \"primary\" } = props;\n const state = toState(props.value ?? 1);\n\n const btnBase = {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n minWidth: (listener: any) => themeSpacing(6 + themeDensity(listener) * 2),\n height: (listener: any) => themeSpacing(6 + themeDensity(listener) * 2),\n paddingInline: (listener: any) => themeSpacing(themeDensity(listener) * 2),\n borderRadius: (listener: any) => themeSpacing(themeDensity(listener) * 1.5),\n border: \"none\",\n cursor: \"pointer\",\n fontSize: (listener: any) => themeSize(listener, \"inherit\"),\n backgroundColor: \"transparent\",\n // Page numbers: shift-13 for readable inactive digits (catalog contrast).\n color: (listener: any) => themeColor(listener, \"shift-13\", color),\n transition: \"background-color 140ms ease, box-shadow 140ms ease, color 140ms ease\",\n \"&:hover:not([disabled])\": {\n color: (listener: any) => themeColor(listener, \"shift-13\", color),\n backgroundColor: (listener: any) => themeColor(listener, \"hover\", color),\n },\n \"&:focus-visible\": {\n boxShadow: (listener: any) => focusRing(listener, accentColor),\n },\n \"&[disabled]\": {\n opacity: 0.4,\n cursor: \"not-allowed\",\n },\n };\n\n const activeStyle = {\n ...btnBase,\n // Deep accent fill + light text (mid-ramp + mid text failed catalog).\n backgroundColor: (listener: any) =>\n themeColor(listener, \"shift-13\", accentColor),\n color: (listener: any) => themeColor(listener, \"shift-0\", \"neutral\"),\n fontWeight: \"bold\",\n cursor: \"default\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener: any) =>\n themeColor(listener, \"shift-13\", accentColor),\n },\n };\n\n return {\n role: \"navigation\",\n ariaLabel: \"Pagination\",\n // Active page weight is design-system chrome for the control.\n _doctorDisable: \"inline-typography\",\n _onInsert: (node) => {\n if (node.tagName !== \"div\")\n console.warn('\"pagination\" patch must use div tag');\n },\n _onInit: (node) => {\n const content: DomphyElement<\"div\"> = {\n div: (listener) => {\n const page = state.get(listener);\n const items: DomphyElement[] = [];\n\n // Prev button\n items.push({\n button: \"‹\",\n _key: \"prev\",\n type: \"button\",\n ariaLabel: \"Previous page\",\n disabled: page <= 1,\n onClick: () => page > 1 && state.set(page - 1),\n style: btnBase,\n });\n\n // Page buttons. Keyed by page number (or a running ellipsis index —\n // there can be up to two \"...\" spans) so the list survives length\n // changes across pages without the unkeyed-reuse footgun.\n let ellipsisIndex = 0;\n for (const p of getPages(page, total)) {\n if (p === \"...\") {\n items.push({\n span: \"…\",\n _key: `ellipsis-${ellipsisIndex++}`,\n ariaHidden: \"true\",\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n paddingInline: (listener: any) =>\n themeSpacing(themeDensity(listener) * 2),\n color: (listener: any) =>\n themeColor(listener, \"shift-7\", color),\n },\n });\n } else {\n const isActive = p === page;\n items.push({\n button: String(p),\n _key: `page-${p}`,\n type: \"button\",\n ariaLabel: `Page ${p}`,\n ariaCurrent: isActive ? \"page\" : undefined,\n disabled: isActive,\n onClick: () => state.set(p),\n style: isActive ? activeStyle : btnBase,\n });\n }\n }\n\n // Next button\n items.push({\n button: \"›\",\n _key: \"next\",\n type: \"button\",\n ariaLabel: \"Next page\",\n disabled: page >= total,\n onClick: () => page < total && state.set(page + 1),\n style: btnBase,\n });\n\n return items;\n },\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: themeSpacing(1),\n },\n };\n node.children.insert(content);\n },\n style: {\n display: \"inline-flex\",\n },\n };\n}\n\nexport { pagination };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * A padded section for side-panel/inspector UIs — density-aware padding on\n * all sides, with an optional bottom divider for sections stacked one after\n * another. A thin wrapper: it does not impose flex layout on its children —\n * pair it with `stack()` or `row()` for that. No host-tag check; apply to\n * any block element.\n *\n * @param props.padding - Spacing multiplier for padding on all sides (default 4 = 1em at density 1).\n * @param props.divider - Adds a bottom border, for sections stacked one after another. Defaults to `false`.\n * @param props.color - Theme color tone for the divider border. Defaults to `\"neutral\"`.\n * @example { div: [{ h3: \"Parameters\" }, { p: \"...\" }], $: [panelSection()] }\n * @example\n * { div: [\n * { div: \"Section A\", $: [panelSection({ divider: true })] },\n * { div: \"Section B\", $: [panelSection()] },\n * ], $: [stack({ gap: 0 })] }\n */\nfunction panelSection(\n props: {\n padding?: number;\n divider?: boolean;\n color?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const { padding = 4, divider = false } = props;\n const color = toState(props.color ?? \"neutral\", \"color\");\n return {\n style: {\n padding: (listener) => themeSpacing(themeDensity(listener) * padding),\n ...(divider\n ? {\n borderBottom: (listener) =>\n `1px solid ${themeColor(listener, \"border\", color.get(listener))}`,\n }\n : {}),\n },\n };\n}\n\nexport { panelSection };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSize } from \"@domphy/theme\";\n\n/**\n * Themed paragraph primitive: comfortable line-height, reset margins and themed\n * text color. Apply to a `<p>` element.\n *\n * @hostTag p\n * @param props - Optional configuration.\n * @param props.color - Color tone for the paragraph text. Defaults to `\"neutral\"`.\n * @example { p: \"Hello world\", $: [paragraph()] }\n */\nfunction paragraph(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"p\") {\n console.warn(`\"paragraph\" primitive patch must use p tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n lineHeight: 1.5,\n marginTop: 0,\n marginBottom: 0,\n },\n };\n}\n\nexport { paragraph };\n","import {\n type DomphyElement,\n type Listener,\n merge,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport type { Placement } from \"@domphy/floating\";\nimport { themeColor, themeDensity, themeSpacing } from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { createFloating } from \"../utils/floating.js\";\n\n/**\n * Floating popover primitive. Attaches to its host as the anchor/trigger and\n * shows a floating `content` element (with `role=\"dialog\"`) on click or hover,\n * positioned via `@domphy/floating`. Returns the anchor partial, which merges\n * trigger wiring (haspopup/expanded, focus/blur dismissal). Apply to the\n * trigger element you want the popover anchored to.\n *\n * @param props - Configuration.\n * @param props.openOn - Interaction that opens the popover: `\"click\"` or `\"hover\"`. Defaults to `\"click\"`.\n * @param props.open - Open state, accepts a value or `State`. Defaults to `false`.\n * @param props.placement - Floating placement (e.g. `\"bottom\"`, `\"top-start\"`), value or `State`. Defaults to `\"bottom\"`.\n * @param props.content - The floating content element to display.\n * @example { button: \"Open\", $: [popover({ openOn: \"click\", content: { div: \"Hi\" } })] }\n */\nfunction popover(props: {\n openOn?: \"click\" | \"hover\";\n open?: ValueOrState<boolean>;\n placement?: ValueOrState<Placement>;\n content: DomphyElement;\n}): PartialElement {\n const { open = false, placement = \"bottom\", openOn = \"click\" } = props;\n\n let popoverId: string | null = null;\n const openState = toState(open);\n const placeState = toState(placement);\n\n const { show, hide, anchorPartial } = createFloating({\n kind: \"popover\",\n open: openState,\n placement: placeState,\n content: props.content,\n // Hovering the panel itself (not just the trigger) must keep it open —\n // handled generically inside floating.ts's behavior instance.\n keepOpenOnContentHover: openOn === \"hover\",\n });\n\n const popoverPartial: PartialElement = {\n role: \"dialog\",\n dataTone: \"shift-14\",\n style: {\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\"),\n borderRadius: (l: Listener) => themeSpacing(themeDensity(l) * 2),\n outline: (l: Listener) => `1px solid ${themeColor(l, \"border-strong\")}`,\n outlineOffset: \"-1px\",\n boxShadow: elevation(\"medium\"),\n },\n _onInsert: (node) => {\n const id = node.attributes.get(\"id\");\n popoverId = id || node.nodeId;\n !id && node.attributes.set(\"id\", popoverId);\n },\n };\n\n props.content.$ ||= [];\n props.content.$.push(popoverPartial);\n\n const triggerPartial: PartialElement = {\n ariaHaspopup: \"dialog\",\n ariaExpanded: (listener) => openState.get(listener),\n onMouseEnter: (_e, node) => openOn === \"hover\" && show(node),\n onMouseLeave: (_e, node) => openOn === \"hover\" && hide(node),\n onClick: (_e, node) => {\n if (openOn === \"click\") {\n if (openState.get()) {\n hide(node);\n } else {\n show(node);\n }\n }\n },\n onKeyDown: (e, node) => {\n if ((e as KeyboardEvent).key === \"Escape\" && openState.get()) hide(node);\n },\n onFocus: (_e, node) => openOn === \"hover\" && show(node),\n onBlur: (e, node) => {\n const related = (e as FocusEvent).relatedTarget as Node | null;\n const root = node.getRoot().domElement as Element;\n const floatingEl = popoverId\n ? root.querySelector(`#${CSS.escape(popoverId)}`)\n : null;\n if (related && floatingEl?.contains(related)) return;\n hide(node);\n },\n _onMount: (node) =>\n popoverId && node.attributes.set(\"ariaControls\", popoverId),\n };\n merge(anchorPartial, triggerPartial);\n\n return anchorPartial;\n}\n\nexport { popover };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport type { Placement } from \"@domphy/floating\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Renders a small rotated arrow (via a `::after` pseudo-element) that points from a\n * popover/tooltip toward its anchor, positioned and oriented based on the floating placement.\n * The arrow direction is computed by flipping the given placement. No host-tag check is\n * performed; apply it to the popover container element.\n *\n * @param props.placement - Floating placement the popover sits at; the arrow is drawn on the\n * opposite (flipped) side. Accepts a value or reactive state. Defaults to `\"bottom-end\"`.\n * One of: `top` | `bottom` | `left` | `right` | `top-start` | `top-end` | `bottom-start` |\n * `bottom-end` | `left-start` | `left-end` | `right-start` | `right-end`.\n * @param props.sideOffset - CSS length used to offset the arrow toward the start/end edge.\n * Defaults to `themeSpacing(6)`.\n * @param props.color - Theme color tone for the arrow fill and border. Defaults to `\"neutral\"`.\n * @param props.bordered - Whether the arrow draws a 1px border (set to `0px` when false).\n * Defaults to `true`.\n * @example { div: [...], $: [popoverArrow({ placement: \"top\" })] }\n */\nfunction popoverArrow(\n props: {\n placement?: ValueOrState<Placement>;\n sideOffset?: string;\n color?: ThemeColor;\n bordered?: boolean;\n } = {},\n): PartialElement {\n const {\n placement = \"bottom-end\",\n color = \"neutral\",\n sideOffset = themeSpacing(6),\n bordered = true,\n } = props;\n\n const place = toState(placement);\n\n const flipMap: Record<Placement, Placement> = {\n top: \"bottom\",\n bottom: \"top\",\n left: \"right\",\n right: \"left\",\n \"top-start\": \"bottom-end\",\n \"top-end\": \"bottom-start\",\n \"bottom-start\": \"top-end\",\n \"bottom-end\": \"top-start\",\n \"left-start\": \"right-end\",\n \"left-end\": \"right-start\",\n \"right-start\": \"left-end\",\n \"right-end\": \"left-start\",\n };\n\n const getFlipped = (listener: any) =>\n flipMap[place.get(listener)] ?? flipMap[\"bottom-end\"];\n const start = (pos: string) =>\n pos.includes(\"start\") ? sideOffset : pos.includes(\"end\") ? \"auto\" : \"50%\";\n const end = (pos: string) =>\n pos.includes(\"end\") ? sideOffset : pos.includes(\"start\") ? \"auto\" : \"50%\";\n\n return {\n style: {\n fontSize: (listener) => themeSize(listener),\n backgroundColor: (listener) => themeColor(listener),\n color: (listener) => themeColor(listener, \"text\", color),\n position: \"relative\",\n \"&::after\": {\n content: `\"\"`,\n position: \"absolute\",\n width: themeSpacing(1.5),\n height: themeSpacing(1.5),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n borderWidth: bordered ? \"1px\" : 0,\n borderColor: (listener) => themeColor(listener, \"inherit\", color),\n borderTopStyle: (listener) => {\n const pos = getFlipped(listener);\n\n return pos.includes(\"top\") || pos.includes(\"right\")\n ? `solid`\n : \"none\";\n },\n borderBottomStyle: (listener) => {\n const pos = getFlipped(listener);\n\n return pos.includes(\"bottom\") || pos.includes(\"left\")\n ? `solid`\n : \"none\";\n },\n borderLeftStyle: (listener) => {\n const pos = getFlipped(listener);\n return pos.includes(\"top\") || pos.includes(\"left\") ? `solid` : \"none\";\n },\n borderRightStyle: (listener) => {\n const pos = getFlipped(listener);\n return pos.includes(\"bottom\") || pos.includes(\"right\")\n ? `solid`\n : \"none\";\n },\n top: (listener) => {\n const pos = getFlipped(listener);\n return pos.includes(\"top\")\n ? 0\n : pos.includes(\"bottom\")\n ? \"auto\"\n : start(pos);\n },\n right: (listener) => {\n const pos = getFlipped(listener);\n return pos.includes(\"right\")\n ? 0\n : pos.includes(\"left\")\n ? \"auto\"\n : end(pos);\n },\n bottom: (listener) => {\n const pos = getFlipped(listener);\n return pos.includes(\"bottom\")\n ? 0\n : pos.includes(\"top\")\n ? \"auto\"\n : end(pos);\n },\n left: (listener) => {\n const pos = getFlipped(listener);\n return pos.includes(\"left\")\n ? 0\n : pos.includes(\"right\")\n ? \"auto\"\n : start(pos);\n },\n transform: (listener) => {\n const pos = getFlipped(listener);\n const x =\n pos.includes(\"right\") ||\n (pos.includes(\"end\") && !pos.includes(\"left\"))\n ? \"50%\"\n : \"-50%\";\n const y =\n pos.includes(\"bottom\") ||\n (pos.includes(\"end\") && !pos.includes(\"top\"))\n ? \"50%\"\n : \"-50%\";\n return `translate(${x},${y}) rotate(45deg)`;\n },\n },\n },\n };\n}\n\nexport { popoverArrow };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles a preformatted text block: inherited font size, themed foreground/background,\n * no border, density-scaled padding and rounded corners.\n *\n * @hostTag pre\n * @param props.color - Theme color tone for text and background. Accepts a value or reactive\n * state. Defaults to `\"neutral\"`.\n * @example { pre: \"const x = 1\", $: [preformated()] }\n */\nfunction preformated(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n dataTone: \"shift-2\",\n _onInsert: (node) => {\n if (node.tagName !== \"pre\") {\n console.warn(`\"preformated\" primitive patch must use pre tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n border: \"none\",\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n },\n };\n}\n\nexport { preformated };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\n\n/**\n * Styles a native progress bar: full-width, pill-shaped track with a themed fill,\n * including the WebKit progress-bar/value pseudo-elements and a width transition.\n *\n * @hostTag progress\n * @param props.color - Theme color tone for the track/background. Accepts a value or reactive\n * state. Defaults to `\"neutral\"`.\n * @param props.accentColor - Theme color tone for the filled value. Accepts a value or reactive\n * state. Defaults to `\"primary\"`.\n * @example { progress: null, value: 40, max: 100, $: [progress()] }\n */\nfunction progress(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"progress\") {\n console.warn(`\"progress\" primitive patch must use progress tag`);\n }\n },\n // Track surface — shift via dataTone, paint with inherit.\n dataTone: \"shift-3\",\n style: {\n appearance: \"none\",\n width: \"100%\",\n height: themeSpacing(2),\n border: 0,\n borderRadius: themeSpacing(999),\n overflow: \"hidden\",\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n \"&::-webkit-progress-bar\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n borderRadius: themeSpacing(999),\n },\n \"&::-webkit-progress-value\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-9\", accentColor.get(listener)),\n borderRadius: themeSpacing(999),\n transition: \"width 220ms ease\",\n },\n },\n };\n}\n\nexport { progress };\n","import {\n type DomphyElement,\n type Listener,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\nconst STAR_FILLED =\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\" width=\"1em\" height=\"1em\">` +\n `<path d=\"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z\"/>` +\n `</svg>`;\nconst STAR_EMPTY =\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\" width=\"1em\" height=\"1em\">` +\n `<path d=\"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z\"/>` +\n `</svg>`;\n\n/**\n * Interactive star rating applied to a container `<div>`. Manages its own star\n * children: click to set, Arrow keys to adjust, hover to preview. In `readOnly`\n * mode stars are non-interactive. Apply to a `<div>` element.\n *\n * @hostTag div\n * @param props.value - Current rating (0 – max). `ValueOrState<number>`, defaults to `0`.\n * @param props.max - Total number of stars. Optional `number`, defaults to `5`.\n * @param props.onChange - Called with the new value when the user picks a star.\n * @param props.readOnly - Disable interaction. Optional `boolean`, defaults to `false`.\n * @param props.color - Star color tone. Optional `ThemeColor`, defaults to `\"warning\"`.\n * @example { div: null, $: [rating({ value: ratingState, onChange: (v) => ratingState.set(v) })] }\n */\nfunction rating(\n props: {\n value?: ValueOrState<number>;\n max?: number;\n onChange?: (value: number) => void;\n readOnly?: boolean;\n color?: ThemeColor;\n } = {},\n): PartialElement {\n const { max = 5, readOnly = false, onChange } = props;\n const color = props.color ?? \"warning\";\n const valueState = toState(props.value ?? 0);\n // Hover preview only — never reported via onChange, only affects display.\n const hoveredState = toState(0);\n\n const activeCount = (listener: Listener) => {\n const hovered = hoveredState.get(listener);\n return hovered > 0 ? hovered : valueState.get(listener);\n };\n\n return {\n role: \"group\",\n ariaLabel: \"Rating\",\n style: {\n display: \"inline-flex\",\n gap: themeSpacing(0.5),\n // 1.5× inherited control size (theme-owned type scale, not a px/rem literal).\n fontSize: (listener) => themeSize(listener, \"increase-1\"),\n cursor: readOnly ? \"default\" : \"pointer\",\n color: (listener) => themeColor(listener, \"muted\", color),\n },\n // Build stars as real child elements (not imperative DOM mutation in\n // _onMount) so generateHTML()/SSR emits the actual star markup.\n _onInit: (node) => {\n for (let i = 1; i <= max; i++) {\n const index = i;\n const interactive = readOnly\n ? {}\n : {\n onClick: () => {\n const next = index === valueState.get() ? 0 : index;\n valueState.set(next);\n onChange?.(next);\n hoveredState.set(0);\n },\n onMouseEnter: () => hoveredState.set(index),\n onMouseLeave: () => hoveredState.set(0),\n onKeyDown: (e: KeyboardEvent) => {\n const current = valueState.get();\n let next = current;\n if (e.key === \"ArrowRight\" || e.key === \"ArrowUp\") {\n next = Math.min(max, current + 1);\n e.preventDefault();\n } else if (e.key === \"ArrowLeft\" || e.key === \"ArrowDown\") {\n next = Math.max(0, current - 1);\n e.preventDefault();\n } else {\n return;\n }\n valueState.set(next);\n onChange?.(next);\n const target = next > 0 ? next - 1 : 0;\n (node.domElement?.children[target] as HTMLElement)?.focus();\n },\n };\n\n const star: DomphyElement<\"button\"> = {\n button: (listener) =>\n index <= activeCount(listener) ? STAR_FILLED : STAR_EMPTY,\n _key: index,\n type: \"button\",\n ariaLabel: `${index} star${index > 1 ? \"s\" : \"\"}`,\n ...interactive,\n style: {\n background: \"none\",\n border: \"none\",\n outline: \"none\",\n borderRadius: themeSpacing(1),\n padding: 0,\n cursor: \"inherit\",\n color: \"inherit\",\n fontSize: \"inherit\",\n display: \"flex\",\n alignItems: \"center\",\n transition: \"box-shadow 140ms ease\",\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color),\n },\n },\n };\n node.children.insert(star);\n }\n },\n };\n}\n\nexport { rating };\n","import type { PartialElement, StyleObject } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\n\n/**\n * Circular ring progress indicator rendered via CSS `conic-gradient` and a\n * circular `mask`. Progress starts at 12 o'clock and advances clockwise.\n * Exposes `role=\"progressbar\"` with `aria-valuenow/min/max`. Apply to a `<div>`.\n *\n * @hostTag div\n * @param props.value - Progress percentage 0–100. Accepts a value or reactive state. Defaults to `0`.\n * @param props.color - Theme color for the filled arc. Accepts a value or reactive state. Defaults to `\"primary\"`.\n * @param props.trackColor - Theme color for the background track. Accepts a value or reactive state. Defaults to `\"neutral\"`.\n * @param props.size - Diameter in `themeSpacing` units. Defaults to `16` (= `4em`).\n * @param props.thickness - Ring stroke as a fraction of the radius (0–0.5). Defaults to `0.25`.\n * @example { div: null, $: [ringProgress({ value: 65 })] }\n * @example { div: null, $: [ringProgress({ value: loadingState, color: \"success\", size: 20 })] }\n */\nfunction ringProgress(\n props: {\n value?: ValueOrState<number>;\n color?: ValueOrState<ThemeColor>;\n trackColor?: ValueOrState<ThemeColor>;\n size?: number;\n thickness?: number;\n } = {},\n): PartialElement {\n const { size = 16, thickness = 0.25 } = props;\n const value = toState(props.value ?? 0, \"value\");\n const color = toState(props.color ?? \"primary\", \"color\");\n const trackColor = toState(props.trackColor ?? \"neutral\", \"trackColor\");\n\n // Mask cuts the center to create a donut shape.\n // Uses `closest-side` so the gradient circle matches the visible element circle\n // exactly, making `holePercent` directly represent the fraction of outer radius.\n const holePercent = Math.round((1 - thickness) * 100);\n const mask = `radial-gradient(circle closest-side, transparent ${holePercent}%, black ${holePercent}%)`;\n\n return {\n role: \"progressbar\",\n ariaValuenow: (l) => String(Math.round(value.get(l))),\n ariaValuemin: \"0\",\n ariaValuemax: \"100\",\n _onInsert: (node) => {\n if (node.tagName !== \"div\") {\n console.warn('\"ringProgress\" patch must use div tag');\n }\n },\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: themeSpacing(size),\n height: themeSpacing(size),\n borderRadius: \"50%\",\n // Text color tracks the filled arc so any overlay label inherits it.\n color: (l) => themeColor(l, \"shift-9\", color.get(l)),\n // Fill arc from 12 o'clock clockwise; `from -90deg` rotates the start point.\n background: (l) =>\n `conic-gradient(from -90deg, ${themeColor(l, \"shift-9\", color.get(l))} ${value.get(l)}%, ${themeColor(l, \"shift-3\", trackColor.get(l))} 0%)`,\n WebkitMask: mask,\n mask,\n } as StyleObject,\n };\n}\n\nexport { ringProgress };\n","import type { PartialElement } from \"@domphy/core\";\nimport { themeDensity, themeSpacing } from \"@domphy/theme\";\nimport type { FlexAlign } from \"./stack.js\";\n\ntype FlexJustify =\n | \"flex-start\"\n | \"center\"\n | \"flex-end\"\n | \"space-between\"\n | \"space-around\"\n | \"space-evenly\";\n\n/**\n * A horizontal flex row with spacing between children, vertically centered by\n * default. The general-purpose primitive for icon+label rows, field rows,\n * and button groups — instead of hand-rolling `display: flex; alignItems:\n * center; gap: ...`. `toolbar()` is a semantic alias of this same shape for\n * headers/nav bars. Styles the host only; apply to any block element.\n *\n * @param props.gap - Spacing multiplier for gap between items (default 4 = 1em at density 1).\n * @param props.align - Cross-axis alignment (`alignItems`). Defaults to `\"center\"`.\n * @param props.justify - Main-axis distribution (`justifyContent`). Unset by default (flex-start).\n * @param props.wrap - Allow items to wrap onto multiple lines. Defaults to `false`.\n * @example { div: [{ span: \"Icon\" }, { span: \"Label\" }], $: [row()] }\n * @example { div: [...], $: [row({ justify: \"space-between\", wrap: true })] }\n */\nfunction row(\n props: {\n gap?: number;\n align?: FlexAlign;\n justify?: FlexJustify;\n wrap?: boolean;\n } = {},\n): PartialElement {\n const { gap = 4, align = \"center\", justify, wrap = false } = props;\n return {\n style: {\n display: \"flex\",\n alignItems: align,\n gap: (listener) => themeSpacing(themeDensity(listener) * gap),\n ...(justify ? { justifyContent: justify } : {}),\n ...(wrap ? { flexWrap: \"wrap\" } : {}),\n },\n };\n}\n\nexport { row };\nexport type { FlexJustify };\n","import type { PartialElement, StyleObject } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\n\n/**\n * Applies thin, themed overlay scrollbars to any scrollable container.\n * Covers WebKit (Chrome/Safari/Edge) via `::-webkit-scrollbar` pseudo-elements\n * and Firefox via `scrollbar-width`/`scrollbar-color`. Sets `overflow: auto`.\n * No host-tag check; apply to any block element.\n *\n * @param props.color - Theme color for the scrollbar thumb. Accepts a value or\n * reactive state. Defaults to `\"neutral\"`.\n * @example { div: [...], style: { maxHeight: \"300px\" }, $: [scrollArea()] }\n */\nfunction scrollArea(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n style: {\n overflow: \"auto\",\n // Container text color so theme token usage also carries a reactive `color`.\n color: (l) => themeColor(l, \"text\", color.get(l)),\n \"&::-webkit-scrollbar\": {\n width: themeSpacing(2),\n height: themeSpacing(2),\n },\n \"&::-webkit-scrollbar-track\": {\n background: \"transparent\",\n },\n \"&::-webkit-scrollbar-thumb\": {\n backgroundColor: (l) => themeColor(l, \"shift-5\", color.get(l)),\n borderRadius: themeSpacing(999),\n // Transparent border creates visual padding around the thumb.\n border: `${themeSpacing(0.5)} solid transparent`,\n backgroundClip: \"content-box\",\n },\n \"&::-webkit-scrollbar-thumb:hover\": {\n backgroundColor: (l) => themeColor(l, \"shift-7\", color.get(l)),\n },\n // Firefox thin scrollbar with matching thumb/track colors.\n scrollbarWidth: \"thin\",\n scrollbarColor: (l) =>\n `${themeColor(l, \"shift-5\", color.get(l))} transparent`,\n } as StyleObject,\n };\n}\n\nexport { scrollArea };\n","import {\n type DomphyElement,\n type Listener,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/** One item inside a segmented control. */\ntype SegmentedItem = {\n /** Button label — plain string (auto-wrapped) or any DomphyElement. */\n label: string | DomphyElement;\n /** Stable key. Defaults to the item's zero-based index. */\n key?: string;\n};\n\n/**\n * All-in-one single-select segmented control. Generates `<button>` option\n * elements from the `items` array. Apply to any wrapper element.\n *\n * @param props.items - Item definitions `{ label, key? }`.\n * @param props.value - Initially selected key (value or State). Defaults to the first item's key.\n * @param props.color - Theme color for the control background. Defaults to `\"neutral\"`.\n * @param props.accentColor - Theme color for the selected item. Defaults to `\"primary\"`.\n * @example\n * { div: null, $: [segmented({ items: [\n * { label: \"Day\", key: \"day\" },\n * { label: \"Month\", key: \"month\" },\n * { label: \"Year\", key: \"year\" },\n * ] })] }\n */\nfunction segmented(\n props: {\n items: SegmentedItem[];\n value?: ValueOrState<string>;\n color?: ThemeColor;\n accentColor?: ThemeColor;\n } = { items: [] },\n): PartialElement {\n const { items = [], color = \"neutral\", accentColor = \"primary\" } = props;\n const value = toState(props.value ?? items[0]?.key ?? \"\");\n\n return {\n role: \"radiogroup\",\n // Expose value in context so segmentedItem() escape-hatch still works.\n _context: { segmented: { value } },\n _onSchedule: (node, element) => {\n const buttons: DomphyElement<\"button\">[] = items.map((item, index) => {\n const key = item.key ?? String(index);\n const labelEl: DomphyElement =\n typeof item.label === \"string\"\n ? ({ span: item.label } as DomphyElement<\"span\">)\n : item.label;\n\n return {\n button: [labelEl],\n _key: key,\n type: \"button\",\n role: \"radio\",\n ariaChecked: (l: Listener) => value.get(l) === key,\n onClick: () => value.set(key),\n style: {\n cursor: \"pointer\",\n fontSize: (l: Listener) => themeSize(l, \"inherit\"),\n height: themeSpacing(6),\n paddingBlock: themeSpacing(1),\n paddingInline: themeSpacing(3),\n border: \"none\",\n borderRadius: themeSpacing(10),\n color: (l: Listener) => themeColor(l, \"text\", color),\n backgroundColor: \"transparent\",\n transition:\n \"background-color 140ms ease, color 140ms ease, box-shadow 140ms ease\",\n \"&:hover:not([disabled]):not([aria-checked=true])\": {\n backgroundColor: (l: Listener) => themeColor(l, \"shift-3\", color),\n },\n \"&:active:not([disabled]):not([aria-checked=true])\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"increase-2\", color),\n },\n \"&[aria-checked=true]\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-0\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-10\", accentColor),\n // Selected segment sits slightly above the track.\n boxShadow: elevation(\"low\"),\n },\n \"&:focus-visible\": {\n boxShadow: (l: Listener) => focusRing(l, accentColor),\n },\n \"&[aria-checked=true]:focus-visible\": {\n boxShadow: (l: Listener) =>\n `${elevation(\"low\")}, ${focusRing(l, accentColor)}`,\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n },\n },\n } as DomphyElement<\"button\">;\n });\n\n (element as any)[node.tagName] = buttons;\n },\n // Track is a soft surface anchor — shift via dataTone, paint with inherit.\n dataTone: \"shift-2\",\n style: {\n display: \"inline-flex\",\n paddingBlock: themeSpacing(1),\n paddingInline: themeSpacing(1),\n gap: themeSpacing(0.5),\n borderRadius: themeSpacing(10),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\", color),\n color: (l: Listener) => themeColor(l, \"text\", color),\n },\n };\n}\n\nexport { segmented };\nexport type { SegmentedItem };\n","import type { Listener, PartialElement } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeColorToken,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a native `<select>` control: removes the default appearance, applies themed\n * colors, outline, density-scaled padding/radius, a custom chevron background icon, and\n * hover/focus/disabled/optgroup/option states.\n *\n * @hostTag select\n * @param props.color - Theme color tone for text, background and outline. Defaults to `\"neutral\"`.\n * @param props.accentColor - Theme color tone for hover/focus outlines. Defaults to `\"primary\"`.\n * @example { select: [{ option: \"A\" }], $: [select()] }\n */\nfunction select(\n props: { color?: ThemeColor; accentColor?: ThemeColor } = {},\n): PartialElement {\n const { color = \"neutral\", accentColor = \"primary\" } = props;\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"select\") {\n console.warn(`\"select\" primitive patch must use select tag`);\n }\n },\n style: {\n appearance: \"none\",\n fontFamily: \"inherit\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n lineHeight: \"inherit\",\n color: (listener) => themeColor(listener, \"text\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color)}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingLeft: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingRight: (listener) => themeSpacing(themeDensity(listener) * 5),\n backgroundImage: (l: Listener) => {\n const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 10 6\"><path d=\"M1 1l4 4 4-4\" stroke=\"${themeColorToken(l, \"shift-7\")}\" stroke-width=\"1.5\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>`;\n return `url(\"data:image/svg+xml,${encodeURIComponent(svg)}\")`;\n },\n backgroundRepeat: \"no-repeat\",\n backgroundPosition: `right ${themeSpacing(2)} center`,\n backgroundSize: `${themeSpacing(2.5)} ${themeSpacing(1.5)}`,\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&:not([multiple])\": {\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-5\", accentColor)}`,\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor),\n },\n \"& optgroup\": {\n color: (listener) => themeColor(listener, \"shift-11\", color),\n },\n \"& option[disabled]\": {\n color: (listener) => themeColor(listener, \"shift-7\", \"neutral\"),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n },\n },\n };\n}\n\nexport { select };\n","import {\n type DomphyElement,\n merge,\n type PartialElement,\n type StyleObject,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport type { Placement } from \"@domphy/floating\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { createFloating } from \"../utils/floating.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\nimport { tag } from \"./tag.js\";\n\n/**\n * A clickable select trigger box that renders the currently selected option(s) as removable\n * tags and toggles a floating popover (the dropdown content) anchored to itself. Selected\n * labels are derived from `options` matching the bound `value`; removing a tag updates the value.\n *\n * @hostTag div\n * @param props.multiple - Whether multiple selection is allowed (renders removable tags and\n * keeps the popover open on click). Defaults to `false`.\n * @param props.value - Bound selection value(s). Accepts a value or reactive state of an array of\n * `number | string | null | undefined`, or a single `number | string | null | undefined`.\n * @param props.options - List of `{ label, value }` options used to resolve selected labels.\n * Defaults to `[]`.\n * @param props.placement - Floating placement of the dropdown popover. Accepts a value or\n * reactive state. Defaults to `\"bottom\"`.\n * @param props.content - Required. The popover/dropdown content element shown when open.\n * @param props.color - Theme color tone for the box text/background. Defaults to `\"neutral\"`.\n * @param props.open - Whether the popover is open. Accepts a value or reactive state. Defaults to `false`.\n * @example { div: null, $: [selectBox({ content: { div: [...] }, options: [{ label: \"A\", value: \"a\" }] })] }\n */\nfunction selectBox(props: {\n multiple?: boolean;\n value?: ValueOrState<\n | Array<number | string | null | undefined>\n | number\n | string\n | null\n | undefined\n >;\n options?: Array<{ label: string; value: string }>;\n placement?: ValueOrState<Placement>;\n content: DomphyElement;\n color?: ThemeColor;\n open?: ValueOrState<boolean>;\n}): PartialElement {\n const {\n options = [],\n placement = \"bottom\",\n color = \"neutral\",\n open = false,\n multiple = false,\n } = props;\n\n const state = toState(props.value);\n const openState = toState(open);\n const { show, hide, anchorPartial } = createFloating({\n kind: \"selectBox\",\n open: openState,\n placement: toState(placement),\n content: props.content,\n });\n\n const popoverPartial: PartialElement = {\n onClick: (_e, node) => !multiple && hide(node),\n dataTone: \"shift-14\",\n style: {\n backgroundColor: (listener) => themeColor(listener, \"inherit\"),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\")}`,\n outlineOffset: \"-1px\",\n boxShadow: elevation(\"medium\"),\n },\n };\n\n merge(props.content, popoverPartial);\n\n const wrap: DomphyElement<\"div\"> = {\n div: (listener) => {\n const val = state.get(listener);\n const vals = Array.isArray(val) ? val : [val];\n const opts = options.filter((opt) => vals.includes(opt.value));\n return opts.map((opt) => ({\n span: opt.label,\n $: [tag({ color, removable: multiple })],\n _key: opt.value,\n _onRemove: (_node) => {\n const cur = state.get();\n const curVals = Array.isArray(cur) ? cur : [cur];\n const filter = curVals.filter((v) => v !== opt.value);\n multiple ? state.set(filter as any) : state.set(filter[0] as any);\n },\n })) as DomphyElement<\"span\">[];\n },\n style: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: themeSpacing(1),\n flex: 1,\n } as StyleObject,\n };\n\n const partial: PartialElement = {\n _onInsert: (node) => {\n if (node.tagName !== \"div\") {\n console.warn(`\"selectBox\" patch must use div tag`);\n }\n },\n _onInit: (node) => node.children.insert(wrap),\n onClick: (_e, node) => (openState.get() ? hide(node) : show(node)),\n // Focusable trigger for keyboard users (click already toggles open).\n tabindex: 0,\n style: {\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n minHeight: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n minWidth: themeSpacing(32),\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 2),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n transition:\n \"background-color 140ms ease, outline-color 140ms ease, box-shadow 140ms ease\",\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color),\n },\n },\n };\n\n merge(anchorPartial, partial);\n return anchorPartial;\n}\n\nexport { selectBox };\n","import type { PartialElement } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * A single selectable option row (`role=\"option\"`) for use inside a `selectList`. Reads the\n * `select` context to reflect/toggle selection: it sets `aria-selected` from the bound value and\n * toggles the value (single or multiple) on click. Styles hover/selected/focus states.\n *\n * @hostTag div\n * @param props.accentColor - Theme color tone for the selected/focus state. Defaults to `\"primary\"`.\n * @param props.color - Theme color tone for text/background. Defaults to `\"neutral\"`.\n * @param props.value - The option value compared against and written to the select state.\n * Defaults to `null`.\n * @example { div: \"Option A\", $: [selectItem({ value: \"a\" })] }\n */\nfunction selectItem(\n props: {\n accentColor?: ThemeColor;\n color?: ThemeColor;\n value?: number | string;\n } = {},\n): PartialElement {\n const { accentColor = \"primary\", color = \"neutral\", value = null } = props;\n\n const partial: PartialElement = {\n role: \"option\",\n _onInit: (node) => {\n if (node.tagName !== \"div\") {\n console.warn(`\"selectItem\" patch must use div tag`);\n }\n const select = node.getContext(\"select\");\n if (select) {\n const state = select.value;\n node.attributes.set(\"ariaSelected\", (listener) => {\n const val = state.get(listener);\n return select.multiple ? val.includes(value) : val === value;\n });\n node.addEvent(\"click\", () => {\n const val = state.get();\n if (select.multiple) {\n val.includes(value)\n ? state.set(val.filter((v: number | string) => v !== value))\n : state.set(val.concat([value]));\n } else {\n val !== value && state.set(value);\n }\n });\n }\n },\n style: {\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n border: \"none\",\n outline: \"none\",\n color: (listener) => themeColor(listener, \"text\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n \"&:hover:not([disabled]):not([aria-selected=true])\": {\n backgroundColor: (listener) => themeColor(listener, \"hover\", color),\n },\n \"&[aria-selected=true]\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-6\", accentColor),\n color: (listener) => themeColor(listener, \"shift-11\"),\n },\n transition: \"background-color 140ms ease, box-shadow 140ms ease\",\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor),\n },\n },\n };\n return partial;\n}\n\nexport { selectItem };\n","import {\n type DomphyElement,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Container for a list of `selectItem`s that owns the selection state. It exposes a `select`\n * context (`{ value, multiple }`) consumed by child items, and injects hidden `<input>`(s)\n * carrying the selected value(s) under `name` for form submission.\n *\n * @hostTag div\n * @param props.multiple - Whether multiple selection is allowed; also sets the default empty\n * value (`[]` vs `null`). Defaults to `false`.\n * @param props.value - Bound selection value(s). Accepts a value or reactive state of an array of\n * `number | string | null`, or a single `number | string | null`. Defaults to `[]` when\n * `multiple`, otherwise `null`.\n * @param props.color - Theme color tone for the background. Defaults to `\"neutral\"`.\n * @param props.name - Name attribute for the hidden inputs (form field name).\n * @example { div: [{ div: \"A\", $: [selectItem({ value: \"a\" })] }], $: [selectList({ name: \"pick\" })] }\n */\nfunction selectList(\n props: {\n multiple?: boolean;\n value?: ValueOrState<\n Array<number | string | null> | number | string | null\n >;\n color?: ThemeColor;\n name?: string;\n } = {},\n): PartialElement {\n const { color = \"neutral\", multiple = false } = props;\n const state = toState(props.value ?? (multiple ? [] : null));\n\n const inputs: DomphyElement<\"div\"> = {\n div: (listener) => {\n const val = state.get(listener);\n const vals = Array.isArray(val) ? val : [val];\n return vals.map((v) => ({\n input: null,\n name: props.name,\n // Preserve a legitimate numeric 0 (and other falsy-but-valid values);\n // `v || \"\"` would drop them.\n value: v == null ? \"\" : String(v),\n }));\n },\n hidden: true,\n };\n\n const partial: PartialElement = {\n dataTone: \"shift-17\",\n _context: {\n select: {\n value: state,\n multiple,\n },\n },\n _onInit: (node) => {\n if (node.tagName !== \"div\") {\n console.warn(`\"selectList\" patch must use a div tag`);\n }\n node.children.insert(inputs);\n },\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 2),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n color: (listener) => themeColor(listener, \"text\", color),\n },\n };\n return partial;\n}\n\nexport { selectList };\n","import {\n hashString,\n type PartialElement,\n type StyleObject,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * A loading placeholder block with a left-to-right shimmer gradient. Marked\n * `aria-hidden`, themed background/foreground, fixed height, slight rounding.\n * No host-tag check; typically applied to a block-level element such as a\n * `div` or `span`.\n *\n * @param props.color - Theme color tone for the placeholder. Accepts a value or reactive state.\n * Defaults to `\"neutral\"`.\n * @example { div: null, $: [skeleton()] }\n */\nfunction skeleton(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n // Shimmer sweeps left→right over a mid-ramp base (reads as loading, not\n // a flat opacity blink). Base + highlight are both theme tokens so the\n // effect adapts to light/dark surfaces.\n const keyframes = {\n \"0%\": { backgroundPosition: \"200% 0\" },\n \"100%\": { backgroundPosition: \"-200% 0\" },\n };\n const animationName = hashString(JSON.stringify(keyframes));\n return {\n ariaHidden: \"true\",\n dataTone: \"shift-2\",\n style: {\n fontSize: (listener) => themeSize(listener),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n height: themeSpacing(6),\n display: \"block\",\n borderRadius: themeSpacing(1),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n backgroundImage: (listener) =>\n `linear-gradient(90deg, ${themeColor(listener, \"inherit\", color.get(listener))} 0%, ${themeColor(listener, \"shift-4\", color.get(listener))} 50%, ${themeColor(listener, \"inherit\", color.get(listener))} 100%)`,\n backgroundSize: \"200% 100%\",\n animation: `${animationName} 1.6s ease-in-out infinite`,\n [`@keyframes ${animationName}`]: keyframes,\n } as StyleObject,\n };\n}\n\nexport { skeleton };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSize } from \"@domphy/theme\";\n\n/**\n * Styles small/secondary text: one step smaller font size (`data-size=\"decrease-1\"`) with a\n * themed foreground color.\n *\n * @hostTag small\n * @param props.color - Theme color tone for the text. Accepts a value or reactive state.\n * Defaults to `\"neutral\"`.\n * @example { small: \"fine print\", $: [small()] }\n */\nfunction small(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"small\") {\n console.warn('\"small\" patch must use small tag');\n }\n },\n dataSize: \"decrease-1\",\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n // shift-10 (not muted/shift-8) keeps WCAG AA ≥4.5:1 on light surfaces for small type.\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n },\n };\n}\n\nexport { small };\n","import type { PartialElement, StyleObject } from \"@domphy/core\";\nimport { hashString, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\nconst keyframes = { to: { transform: \"rotate(360deg)\" } };\nconst animationName = hashString(JSON.stringify(keyframes));\n\n/**\n * A circular loading spinner: a themed ring with a contrasting top border that rotates\n * continuously. Marked `role=\"status\"` with `aria-label=\"loading\"`.\n *\n * @hostTag span\n * @param props.color - Theme color tone for the ring/highlight. Accepts a value or reactive\n * state. Defaults to `\"neutral\"`.\n * @example { span: null, $: [spinner()] }\n */\nfunction spinner(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n role: \"status\",\n ariaLabel: \"loading\",\n _onInsert: (node) => {\n if (node.tagName !== \"span\") {\n console.warn(`\"spinner\" patch must use span tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener),\n backgroundColor: (listener) => themeColor(listener),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n display: \"inline-block\",\n margin: 0,\n flexShrink: 0,\n width: themeSpacing(6),\n height: themeSpacing(6),\n borderRadius: \"50%\",\n border: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n borderTopColor: (listener) =>\n themeColor(listener, \"shift-9\", color.get(listener)),\n boxSizing: \"border-box\",\n padding: 0,\n animation: `${animationName} 0.7s linear infinite`,\n [`@keyframes ${animationName}`]: keyframes,\n } as StyleObject,\n };\n}\n\nexport { spinner };\n","import { merge, type PartialElement, toState } from \"@domphy/core\";\nimport { themeColor, themeSpacing } from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Root of a resizable split layout. Lays out children as a flex row (horizontal) or column\n * (vertical) and provides a `splitter` context (`{ direction, size, min, max }`) consumed by\n * `splitterPanel` and `splitterHandle`. `size` is a reactive state holding the first panel's\n * percentage. No host-tag check; typically applied to a `div`.\n *\n * @param props.direction - Split orientation, `\"horizontal\"` | `\"vertical\"`. Defaults to `\"horizontal\"`.\n * @param props.defaultSize - Initial size (percentage) of the resizable panel. Defaults to `50`.\n * @param props.min - Minimum panel size (percentage). Defaults to `10`.\n * @param props.max - Maximum panel size (percentage). Defaults to `90`.\n * @example { div: [...], $: [splitter({ direction: \"vertical\" })] }\n */\nfunction splitter(\n props: {\n direction?: \"horizontal\" | \"vertical\";\n defaultSize?: number;\n min?: number;\n max?: number;\n } = {},\n): PartialElement {\n const {\n direction = \"horizontal\",\n defaultSize = 50,\n min = 10,\n max = 90,\n } = props;\n return {\n _onSchedule: (_node, element) => {\n merge(element, {\n _context: {\n splitter: {\n direction,\n size: toState(defaultSize),\n min,\n max,\n // Mutable bookkeeping (not reactive state) so splitterPanel can\n // tell the first panel from later ones — see its own comment.\n panelCount: 0,\n },\n },\n });\n },\n style: {\n display: \"flex\",\n flexDirection: direction === \"horizontal\" ? \"row\" : \"column\",\n overflow: \"hidden\",\n },\n };\n}\n\n/**\n * The resizable panel inside a `splitter`. Reads the `splitter` context and binds its\n * width (horizontal) or height (vertical) to the context `size` state, updating reactively as\n * the handle is dragged. Intended for exactly two panels either side of one `splitterHandle`:\n * the first `splitterPanel` mounted takes `size`%, and the second takes the complementary\n * `100 - size`% — so the pair always sums to the full width/height instead of both tracking\n * the same number (which would make them grow and shrink together instead of trading space).\n * Warns if used outside a `splitter`. Takes no props.\n *\n * @example { div: [...], $: [splitterPanel()] }\n */\nfunction splitterPanel(): PartialElement {\n return {\n _onMount: (node) => {\n const ctx = node.getContext(\"splitter\");\n if (!ctx) {\n console.warn(`\"splitterPanel\" patch must be used inside a \"splitter\"`);\n return;\n }\n const el = node.domElement as HTMLElement;\n const prop = ctx.direction === \"horizontal\" ? \"width\" : \"height\";\n const isFirst = ctx.panelCount++ === 0;\n\n const apply = (size: number) => {\n el.style[prop] = `${isFirst ? size : 100 - size}%`;\n };\n apply(ctx.size.get());\n el.style.flexShrink = \"0\";\n el.style.overflow = \"auto\";\n\n const release = ctx.size.addListener(apply);\n node.addHook(\"Remove\", release);\n },\n };\n}\n\n/**\n * The draggable divider inside a `splitter`. Reads the `splitter` context, shows the\n * appropriate resize cursor, and updates the context `size` state (clamped to `min`/`max`)\n * via mouse drag or keyboard: Arrow keys move by 1%, Home/End jump to min/max, hold Shift\n * for 10× step. Sets `role=\"separator\"`, `tabindex=\"0\"`, and `aria-value*` attributes.\n * Warns if used outside a `splitter`. Takes no props.\n *\n * @example { div: null, $: [splitterHandle()] }\n */\nfunction splitterHandle(): PartialElement {\n return {\n role: \"separator\",\n tabindex: 0,\n _onMount: (node) => {\n const ctx = node.getContext(\"splitter\");\n if (!ctx) {\n console.warn(`\"splitterHandle\" patch must be used inside a \"splitter\"`);\n return;\n }\n const handle = node.domElement as HTMLElement;\n const isHorizontal = ctx.direction === \"horizontal\";\n\n handle.style.cursor = isHorizontal ? \"col-resize\" : \"row-resize\";\n handle.setAttribute(\n \"aria-orientation\",\n isHorizontal ? \"vertical\" : \"horizontal\",\n );\n handle.setAttribute(\"aria-valuemin\", String(ctx.min));\n handle.setAttribute(\"aria-valuemax\", String(ctx.max));\n handle.setAttribute(\"aria-valuenow\", String(Math.round(ctx.size.get())));\n\n const releaseAriaValue = ctx.size.addListener((size: number) => {\n handle.setAttribute(\"aria-valuenow\", String(Math.round(size)));\n });\n\n const onKeydown = (e: KeyboardEvent) => {\n const step = e.shiftKey ? 10 : 1;\n let next: number | null = null;\n if (isHorizontal) {\n if (e.key === \"ArrowRight\")\n next = Math.min(ctx.size.get() + step, ctx.max);\n else if (e.key === \"ArrowLeft\")\n next = Math.max(ctx.size.get() - step, ctx.min);\n } else {\n if (e.key === \"ArrowDown\")\n next = Math.min(ctx.size.get() + step, ctx.max);\n else if (e.key === \"ArrowUp\")\n next = Math.max(ctx.size.get() - step, ctx.min);\n }\n if (e.key === \"Home\") next = ctx.min;\n else if (e.key === \"End\") next = ctx.max;\n if (next !== null) {\n e.preventDefault();\n ctx.size.set(next);\n }\n };\n\n let cancelDrag: (() => void) | null = null;\n\n const onMousedown = (e: MouseEvent) => {\n e.preventDefault();\n const container = handle.parentElement!;\n\n const onMousemove = (e: MouseEvent) => {\n const rect = container.getBoundingClientRect();\n const raw = isHorizontal\n ? ((e.clientX - rect.left) / rect.width) * 100\n : ((e.clientY - rect.top) / rect.height) * 100;\n ctx.size.set(Math.min(Math.max(raw, ctx.min), ctx.max));\n };\n\n const onMouseup = () => {\n document.removeEventListener(\"mousemove\", onMousemove);\n document.removeEventListener(\"mouseup\", onMouseup);\n cancelDrag = null;\n };\n\n cancelDrag = () => {\n document.removeEventListener(\"mousemove\", onMousemove);\n document.removeEventListener(\"mouseup\", onMouseup);\n cancelDrag = null;\n };\n\n document.addEventListener(\"mousemove\", onMousemove);\n document.addEventListener(\"mouseup\", onMouseup);\n };\n\n handle.addEventListener(\"keydown\", onKeydown);\n handle.addEventListener(\"mousedown\", onMousedown);\n node.addHook(\"Remove\", () => {\n cancelDrag?.();\n releaseAriaValue();\n handle.removeEventListener(\"keydown\", onKeydown);\n handle.removeEventListener(\"mousedown\", onMousedown);\n });\n },\n // Soft divider surface — shift via dataTone, paint with inherit.\n dataTone: \"shift-2\",\n style: {\n flexShrink: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: (listener) => themeColor(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\"),\n \"&:hover\": {\n backgroundColor: (listener) => themeColor(listener, \"increase-1\"),\n },\n transition: \"background-color 140ms ease, box-shadow 140ms ease\",\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, \"primary\"),\n },\n \"&::after\": {\n content: '\"\"',\n // A small grip dot so the handle is visibly draggable. Without an\n // explicit size the pseudo-element collapses to 0x0 and is invisible.\n width: themeSpacing(1),\n height: themeSpacing(1),\n borderRadius: themeSpacing(999),\n backgroundColor: (listener) => themeColor(listener, \"shift-4\"),\n },\n },\n };\n}\n\nexport { splitter, splitterPanel, splitterHandle };\n","import type { PartialElement } from \"@domphy/core\";\nimport { themeDensity, themeSpacing } from \"@domphy/theme\";\n\ntype FlexAlign = \"flex-start\" | \"center\" | \"flex-end\" | \"stretch\" | \"baseline\";\n\n/**\n * A vertical flex column with spacing between children. The general-purpose\n * primitive for stacking blocks — form sections, panel content, card bodies —\n * instead of hand-rolling `display: flex; flexDirection: column; gap: ...`.\n * Styles the host only; apply to any block element.\n *\n * @param props.gap - Spacing multiplier for gap between children (default 3 = 0.75em at density 1).\n * @param props.align - Cross-axis alignment (`alignItems`). Unset by default (flex default, stretch).\n * @example { div: [{ h3: \"Title\" }, { p: \"Body\" }], $: [stack()] }\n * @example { div: [...], $: [stack({ gap: 2, align: \"center\" })] }\n */\nfunction stack(\n props: { gap?: number; align?: FlexAlign } = {},\n): PartialElement {\n const { gap = 3, align } = props;\n return {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: (listener) => themeSpacing(themeDensity(listener) * gap),\n ...(align ? { alignItems: align } : {}),\n },\n };\n}\n\nexport { stack };\nexport type { FlexAlign };\n","import {\n type DomphyElement,\n type Listener,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/** One step entry. */\ntype StepItem = {\n /** Step label — plain string (auto-wrapped) or any DomphyElement. */\n label: string | DomphyElement;\n /** Stable key. Defaults to the item's zero-based index. */\n key?: string | number;\n};\n\n/**\n * All-in-one step-progress indicator. Generates `<li>` step elements from the\n * `items` array. Apply to an `<ol>` or `<ul>` element.\n *\n * @param props.items - Step definitions `{ label, key? }`.\n * @param props.current - Zero-based index of the active step (value or State). Defaults to `0`.\n * @param props.direction - `\"horizontal\"` (default) or `\"vertical\"` layout.\n * @param props.color - Theme color for pending/track elements. Defaults to `\"neutral\"`.\n * @param props.accentColor - Theme color for active/completed elements. Defaults to `\"primary\"`.\n * @example\n * { ol: null, $: [steps({ current: 1, items: [\n * { label: \"Cart\" },\n * { label: \"Shipping\" },\n * { label: \"Payment\" },\n * ] })] }\n */\nfunction steps(\n props: {\n items: StepItem[];\n current?: ValueOrState<number>;\n direction?: \"horizontal\" | \"vertical\";\n color?: ThemeColor;\n accentColor?: ThemeColor;\n } = { items: [] },\n): PartialElement {\n const {\n items = [],\n direction = \"horizontal\",\n color = \"neutral\",\n accentColor = \"primary\",\n } = props;\n const current = toState(props.current ?? 0);\n\n return {\n // Step badge weight is design-system chrome for the progress control.\n _doctorDisable: \"inline-typography\",\n // Expose state in context so stepItem() escape-hatch still works.\n _context: { steps: { current, direction, color, accentColor } },\n _onSchedule: (node, element) => {\n const stepEls: DomphyElement<\"li\">[] = items.map((item, index) => {\n const labelEl: DomphyElement =\n typeof item.label === \"string\"\n ? ({ span: item.label } as DomphyElement<\"span\">)\n : item.label;\n\n return {\n li: [labelEl],\n _key: item.key ?? index,\n dataStep: String(index + 1),\n dataStatus: (l: Listener) => {\n const cur = current.get(l);\n if (index < cur) return \"done\";\n if (index === cur) return \"active\";\n return \"pending\";\n },\n ariaCurrent: (l: Listener) =>\n current.get(l) === index ? \"step\" : undefined,\n style: {\n position: \"relative\",\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: themeSpacing(1),\n flex: \"1\",\n fontSize: (l: Listener) => themeSize(l, \"decrease-1\"),\n textAlign: \"center\",\n \"&::before\": {\n content: \"attr(data-step)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: themeSpacing(6),\n height: themeSpacing(6),\n borderRadius: themeSpacing(999),\n fontSize: (l: Listener) => themeSize(l, \"decrease-1\"),\n fontWeight: \"bold\",\n flexShrink: \"0\",\n border: (l: Listener) =>\n `2px solid ${themeColor(l, \"border-strong\", color)}`,\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\"),\n color: (l: Listener) => themeColor(l, \"muted\"),\n transition:\n \"background-color 200ms ease, color 200ms ease, border-color 200ms ease\",\n zIndex: \"1\",\n },\n \"&:not(:first-child)::after\": {\n content: '\"\"',\n position: \"absolute\",\n top: themeSpacing(3),\n right: `calc(50% + ${themeSpacing(3)})`,\n left: `calc(-50% + ${themeSpacing(3)})`,\n height: \"2px\",\n backgroundColor: (l: Listener) => themeColor(l, \"shift-3\", color),\n zIndex: \"0\",\n },\n \"&[data-status=active]::before\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-9\", accentColor),\n borderColor: (l: Listener) =>\n themeColor(l, \"shift-9\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-0\", accentColor),\n boxShadow: (l: Listener) =>\n `0 0 0 3px ${themeColor(l, \"shift-3\", accentColor)}`,\n },\n // Completed steps: filled accent + check, matching active track.\n \"&[data-status=done]::before\": {\n content: '\"✓\"',\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-9\", accentColor),\n borderColor: (l: Listener) =>\n themeColor(l, \"shift-9\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-0\", accentColor),\n },\n \"&[data-status=done]:not(:first-child)::after\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-9\", accentColor),\n },\n \"&[data-status=active]:not(:first-child)::after\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-9\", accentColor),\n },\n \"&[data-status=pending]\": {\n color: (l: Listener) => themeColor(l, \"muted\"),\n },\n \"&[data-status=active]\": {\n color: (l: Listener) => themeColor(l, \"shift-11\", accentColor),\n fontWeight: \"bold\",\n },\n \"&[data-status=done]\": {\n color: (l: Listener) => themeColor(l, \"text\", color),\n },\n },\n } as DomphyElement<\"li\">;\n });\n\n (element as any)[node.tagName] = stepEls;\n },\n style: {\n display: \"flex\",\n flexDirection: direction === \"vertical\" ? \"column\" : \"row\",\n alignItems: direction === \"vertical\" ? \"flex-start\" : \"center\",\n gap: themeSpacing(2),\n listStyle: \"none\",\n margin: \"0\",\n padding: \"0\",\n },\n };\n}\n\nexport { steps };\nexport type { StepItem };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSize } from \"@domphy/theme\";\n\n/**\n * Styles strongly emphasized (bold) text: inherited font size, `font-weight: 700`, and a\n * themed foreground color.\n *\n * @hostTag strong\n * @param props.color - Theme color tone for the text. Accepts a value or reactive state.\n * Defaults to `\"neutral\"`.\n * @example { strong: \"important\", $: [strong()] }\n */\nfunction strong(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"strong\") {\n console.warn(`\"strong\" primitive patch must use strong tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n fontWeight: \"bold\",\n color: (listener) =>\n themeColor(listener, \"shift-11\", color.get(listener)),\n backgroundColor: (listener) => themeColor(listener),\n },\n };\n}\n\nexport { strong };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSize } from \"@domphy/theme\";\n\n/**\n * Renders subscript text (shrunk, baseline-lowered) for the host `<sub>` element.\n *\n * @hostTag sub\n * @param props.color - Theme color for the text. Optional, accepts a value or state. Defaults to `\"neutral\"`.\n * @example { sub: \"2\", $: [subscript()] }\n */\nfunction subscript(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"sub\") {\n console.warn(`\"subscript\" primitive patch must use sub tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"decrease-1\"),\n verticalAlign: \"sub\",\n lineHeight: 0,\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n };\n}\n\nexport { subscript };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSize } from \"@domphy/theme\";\n\n/**\n * Renders superscript text (shrunk, baseline-raised) for the host `<sup>` element.\n *\n * @hostTag sup\n * @param props.color - Theme color for the text. Optional, accepts a value or state. Defaults to `\"neutral\"`.\n * @example { sup: \"2\", $: [superscript()] }\n */\nfunction superscript(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"sup\") {\n console.warn(`\"superscript\" primitive patch must use sup tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"decrease-1\"),\n verticalAlign: \"super\",\n lineHeight: 0,\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n };\n}\n\nexport { superscript };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles a data table (header/body/footer cells, caption, row hover, borders)\n * on the host `<table>` element.\n *\n * @hostTag table\n * @param props.color - Theme color applied across cells and text. Optional, accepts a value or state. Defaults to `\"neutral\"`.\n * @example { table: null, $: [table()] }\n */\nfunction table(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"table\") {\n console.warn(`\"table\" primitive patch must use table tag`);\n }\n },\n // Header/footer weights are design-system table chrome.\n _doctorDisable: \"inline-typography\",\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n width: \"100%\",\n borderCollapse: \"collapse\",\n \"& caption\": {\n captionSide: \"bottom\",\n },\n \"& th, & thead td\": {\n textAlign: \"left\",\n fontWeight: 500,\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n backgroundColor: (listener) => themeColor(listener, \"inherit\"),\n },\n \"& td\": {\n textAlign: \"left\",\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n boxShadow: (listener) =>\n `inset 0 1px 0 ${themeColor(listener, \"shift-3\", color.get(listener))}`,\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n },\n \"& tfoot th, & tfoot td\": {\n textAlign: \"left\",\n fontWeight: 500,\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n color: (l) => themeColor(l, \"shift-10\", color.get(l)),\n backgroundColor: (l) => themeColor(l, \"inherit\"),\n boxShadow: (l) =>\n `inset 0 -1px 0 ${themeColor(l, \"shift-4\", color.get(l))}`,\n },\n \"& tr\": {\n backgroundColor: (listener) => themeColor(listener, \"inherit\"),\n },\n\n // No !important needed: \".scope tbody tr:hover\" (two classes + two\n // elements) already out-specifies any row's own auto-scope class rule.\n \"& tbody tr:hover\": {\n backgroundColor: (listener) => themeColor(listener, \"hover\"),\n },\n },\n };\n}\n\nexport { table };\n","import {\n type DomphyElement,\n type Listener,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/** One tab entry: a trigger label and its panel content. */\ntype TabItem = {\n /** Tab button label — a plain string (auto-wrapped in span) or any DomphyElement. */\n label: string | DomphyElement;\n /** Panel content rendered when this tab is active. */\n content: DomphyElement;\n /** Stable identity key. Defaults to the item's zero-based index. */\n key?: string | number;\n};\n\n/**\n * All-in-one tabs patch. Generates a `[role=tablist]` button row and\n * `[role=tabpanel]` panels from the `items` array. Apply to any wrapper\n * element (`div`, `section`, …). No companion `tab()` / `tabPanel()` needed.\n *\n * To control the active tab programmatically, pass an external `State` as\n * `activeKey` and call `.set()` on it from outside.\n *\n * @param props.items - Tab definitions `{ label, content, key? }`.\n * @param props.activeKey - Initially active key (value or State). Defaults to the first item's key.\n * @param props.accentColor - Theme color for the active underline indicator. Defaults to `\"primary\"`.\n * @param props.color - Theme color for the resting underline. Defaults to `\"neutral\"`.\n * @example\n * { div: null, $: [tabs({ items: [\n * { label: \"Overview\", content: { p: \"Overview content\" } },\n * { label: \"API\", content: { p: \"API content\" } },\n * ] })] }\n */\nfunction tabs(\n props: {\n items: TabItem[];\n activeKey?: ValueOrState<string | number>;\n accentColor?: ThemeColor;\n color?: ThemeColor;\n } = { items: [] },\n): PartialElement {\n const { items = [], accentColor = \"primary\", color = \"neutral\" } = props;\n const activeKey = toState(props.activeKey ?? items[0]?.key ?? 0);\n\n return {\n _onSchedule: (node, element) => {\n const id = node.nodeId;\n\n const buttons: DomphyElement<\"button\">[] = items.map((item, index) => {\n const key = item.key ?? index;\n const labelEl: DomphyElement =\n typeof item.label === \"string\"\n ? ({ span: item.label } as DomphyElement<\"span\">)\n : item.label;\n\n return {\n button: [labelEl],\n _key: key,\n type: \"button\",\n role: \"tab\",\n id: `tab${id}${key}`,\n ariaControls: `panel${id}${key}`,\n ariaSelected: (l: Listener) => activeKey.get(l) === key,\n onClick: () => activeKey.set(key),\n onKeyDown: (e: Event) => {\n const k = (e as KeyboardEvent).key;\n if (![\"ArrowLeft\", \"ArrowRight\", \"Home\", \"End\"].includes(k)) return;\n e.preventDefault();\n const keys = items.map((it, i) => it.key ?? i);\n const idx = keys.indexOf(key);\n let next = idx;\n if (k === \"ArrowRight\") next = (idx + 1) % keys.length;\n else if (k === \"ArrowLeft\")\n next = (idx - 1 + keys.length) % keys.length;\n else if (k === \"Home\") next = 0;\n else if (k === \"End\") next = keys.length - 1;\n activeKey.set(keys[next]);\n },\n style: {\n cursor: \"pointer\",\n fontSize: (l: Listener) => themeSize(l, \"inherit\"),\n height: (l: Listener) => themeSpacing(6 + themeDensity(l) * 2),\n paddingInline: (l: Listener) => themeSpacing(themeDensity(l) * 4),\n border: \"none\",\n outline: \"none\",\n // Resting tabs: shift-13 for ≥4.5:1 on surface (catalog low-contrast).\n color: (l: Listener) => themeColor(l, \"shift-13\"),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\"),\n boxShadow: (l: Listener) =>\n `inset 0 -${themeSpacing(0.5)} 0 0 ${themeColor(l, \"shift-1\", color)}`,\n transition: \"box-shadow 140ms ease, color 140ms ease\",\n \"&:hover:not([disabled]):not([aria-selected=true])\": {\n color: (l: Listener) => themeColor(l, \"shift-13\"),\n boxShadow: (l: Listener) =>\n `inset 0 -${themeSpacing(0.5)} 0 0 ${themeColor(l, \"shift-2\", color)}`,\n },\n \"&[aria-selected=true]:not([disabled])\": {\n color: (l: Listener) => themeColor(l, \"shift-13\", accentColor),\n boxShadow: (l: Listener) =>\n `inset 0 -${themeSpacing(0.5)} 0 0 ${themeColor(l, \"shift-8\", accentColor)}`,\n },\n // Focus ring must compose with the selected underline (both use\n // box-shadow) so keyboard focus doesn't erase the active indicator.\n \"&:focus-visible\": {\n boxShadow: (l: Listener) => focusRing(l, accentColor),\n },\n \"&[aria-selected=true]:focus-visible\": {\n boxShadow: (l: Listener) =>\n `${focusRing(l, accentColor)}, inset 0 -${themeSpacing(0.5)} 0 0 ${themeColor(l, \"shift-6\", accentColor)}`,\n },\n },\n } as DomphyElement<\"button\">;\n });\n\n const tablist: DomphyElement<\"div\"> = {\n div: buttons,\n role: \"tablist\",\n ariaOrientation: \"horizontal\",\n style: { display: \"flex\" },\n } as DomphyElement<\"div\">;\n\n const panels: DomphyElement<\"div\">[] = items.map((item, index) => {\n const key = item.key ?? index;\n return {\n div: [item.content],\n _key: key,\n role: \"tabpanel\",\n id: `panel${id}${key}`,\n ariaLabelledby: `tab${id}${key}`,\n hidden: (l: Listener) => activeKey.get(l) !== key,\n style: {\n paddingBlock: (l: Listener) => themeSpacing(themeDensity(l) * 2),\n paddingInline: (l: Listener) => themeSpacing(themeDensity(l) * 2),\n },\n } as DomphyElement<\"div\">;\n });\n\n // Inject generated structure into the host element's children slot.\n (element as any)[node.tagName] = [tablist, ...panels];\n },\n };\n}\n\nexport { tabs };\nexport type { TabItem };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a multi-line text input (border, focus/hover/invalid/disabled states)\n * on the host `<textarea>` element, with optional auto-resize to content.\n *\n * @hostTag textarea\n * @param props.color - Theme color for the border and text. Optional, accepts a value or state. Defaults to `\"neutral\"`.\n * @param props.accentColor - Theme color for hover/focus outline. Optional, accepts a value or state. Defaults to `\"primary\"`.\n * @param props.autoResize - When true, grows the textarea height to fit its content on input. Optional. Defaults to `false`.\n * @example { textarea: null, $: [textarea({ autoResize: true })] }\n */\nfunction textarea(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n autoResize?: boolean;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n const { autoResize = false } = props;\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"textarea\") {\n console.warn(`\"textarea\" primitive patch must use textarea tag`);\n }\n },\n _onMount: (node) => {\n if (autoResize) {\n const el = node.domElement as HTMLTextAreaElement;\n el.style.overflow = \"hidden\";\n const resize = () => {\n el.style.height = \"auto\";\n el.style.height = `${el.scrollHeight}px`;\n };\n el.addEventListener(\"input\", resize);\n resize();\n node.addHook(\"Remove\", () => el.removeEventListener(\"input\", resize));\n }\n },\n style: {\n fontFamily: \"inherit\",\n lineHeight: \"inherit\",\n resize: \"vertical\",\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n border: \"none\",\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&::placeholder\": {\n color: (listener) => themeColor(listener, \"shift-7\"),\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-5\", accentColor.get(listener))}`,\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&:invalid\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-5\", \"error\")}`,\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n },\n },\n };\n}\n\nexport { textarea };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Container for a vertical timeline. Sets list reset styles. Apply to `<ol>` or `<ul>`.\n *\n * @example { ol: [...], $: [timeline()] }\n */\nfunction timeline(): PartialElement {\n return {\n style: {\n listStyle: \"none\",\n margin: 0,\n padding: 0,\n display: \"flex\",\n flexDirection: \"column\",\n },\n };\n}\n\n/**\n * A single event row in a `timeline`. Uses a 2-column grid: the left column holds\n * a dot (`::before`) and optional connector line (`::after`); the right column holds\n * the user's content. Apply to `<li>`.\n *\n * @param props.active - Full-opacity dot (accent color). `ValueOrState<boolean>`, defaults to `false`.\n * @param props.last - Suppress the vertical connector below this item. `boolean`, defaults to `false`.\n * @param props.color - Dot/connector color tone. `ThemeColor`, defaults to `\"neutral\"`.\n * @param props.accentColor - Active dot color tone. `ThemeColor`, defaults to `\"primary\"`.\n * @example { li: [{ b: \"2024\" }, { p: \"Event\" }], $: [timelineItem({ active: true })] }\n */\nfunction timelineItem(\n props: {\n active?: ValueOrState<boolean>;\n last?: boolean;\n color?: ThemeColor;\n accentColor?: ThemeColor;\n } = {},\n): PartialElement {\n const { last = false } = props;\n const color = props.color ?? \"neutral\";\n const accentColor = props.accentColor ?? \"primary\";\n const activeState = toState(props.active ?? false);\n\n return {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"2rem 1fr\",\n columnGap: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingBottom: (listener) =>\n last ? \"0\" : themeSpacing(themeDensity(listener) * 4),\n position: \"relative\",\n\n // Dot\n \"&::before\": {\n content: '\"\"',\n display: \"block\",\n width: \"0.75rem\",\n height: \"0.75rem\",\n borderRadius: \"50%\",\n justifySelf: \"center\",\n marginTop: themeSpacing(1),\n transition: \"background-color 200ms ease, opacity 200ms ease\",\n backgroundColor: (listener) =>\n themeColor(\n listener,\n \"shift-8\",\n activeState.get(listener) ? accentColor : color,\n ),\n opacity: (listener) => (activeState.get(listener) ? \"1\" : \"0.4\"),\n },\n\n // Vertical connector to the next item\n ...(last\n ? {}\n : {\n \"&::after\": {\n content: '\"\"',\n position: \"absolute\",\n left: \"calc(1rem - 1px)\",\n top: \"1.25rem\",\n bottom: (listener) =>\n `-${themeSpacing(themeDensity(listener) * 4)}`,\n width: \"2px\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-3\", color),\n },\n }),\n },\n };\n}\n\nexport { timeline, timelineItem };\n","import type { DomphyElement, ElementNode, PartialElement } from \"@domphy/core\";\nimport { toState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\n\ntype ToastPosition =\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\";\n\n/**\n * Renders a transient notification surface as a fixed-position overlay (portaled\n * into a corner stack), animating in on mount and out before removal. No host\n * tag check; typically applied to a `<div>`.\n *\n * @param props.position - Corner of the screen for the toast stack. Optional, one of `\"top-left\" | \"top-center\" | \"top-right\" | \"bottom-left\" | \"bottom-center\" | \"bottom-right\"`. Defaults to `\"top-center\"`.\n * @param props.color - Theme color for the toast surface. Optional. Defaults to `\"neutral\"`.\n * @example { div: \"Saved!\", $: [toast({ position: \"top-right\" })] }\n */\nfunction toast(\n props: { position?: ToastPosition; color?: ThemeColor } = {},\n): PartialElement {\n const { position = \"top-center\", color = \"neutral\" } = props;\n const state = toState(false);\n\n const isTop = position.startsWith(\"top\");\n const isCenter = position.endsWith(\"center\");\n const isRight = position.endsWith(\"right\");\n\n const overlayEle: DomphyElement<\"div\"> = {\n div: [],\n id: `domphy-toast-${position}`,\n style: {\n position: \"fixed\",\n display: \"flex\",\n flexDirection: isTop ? \"column\" : \"column-reverse\",\n alignItems: isCenter ? \"center\" : isRight ? \"end\" : \"start\",\n inset: 0,\n gap: themeSpacing(4),\n zIndex: 30,\n padding: themeSpacing(6),\n pointerEvents: \"none\",\n },\n };\n\n return {\n _portal: (rootNode) => {\n let overlay = rootNode.domElement!.querySelector(\n `#domphy-toast-${position}`,\n );\n if (!overlay) {\n const overlayNode = rootNode.children!.insert(\n overlayEle,\n ) as ElementNode;\n overlay = overlayNode.domElement!;\n }\n return overlay;\n },\n role: \"status\",\n ariaAtomic: \"true\",\n // Toast is rendered as an overlay surface, so it uses the inverted branch.\n dataTone: \"shift-17\",\n style: {\n minWidth: themeSpacing(32),\n pointerEvents: \"auto\",\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n boxShadow: elevation(\"medium\"),\n opacity: (listener) => Number(state.get(listener)),\n transform: (listener) =>\n state.get(listener)\n ? \"translateY(0)\"\n : isTop\n ? \"translateY(-100%)\"\n : \"translateY(100%)\",\n transition: \"opacity 300ms ease, transform 300ms ease\",\n },\n _onMount: () => requestAnimationFrame(() => state.set(true)),\n _onBeforeRemove: (node, done) => {\n let finished = false;\n let timer: ReturnType<typeof setTimeout> | null = null;\n const finish = () => {\n if (finished) return;\n finished = true;\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n node.domElement!.removeEventListener(\"transitionend\", onEnd);\n done();\n };\n const onEnd = (e: Event) => {\n if ((e as TransitionEvent).propertyName === \"transform\") finish();\n };\n node.domElement!.addEventListener(\"transitionend\", onEnd);\n // Fallback: if transitionend never fires (reduced-motion, display:none,\n // early detach), unblock removal after the transition duration + buffer.\n timer = setTimeout(finish, 350);\n // If the node is detached before the exit animation settles, clear the\n // pending fallback timer and the transitionend listener so they cannot\n // fire on a removed node.\n node.addHook(\"Remove\", () => {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n node.domElement?.removeEventListener(\"transitionend\", onEnd);\n });\n state.set(false);\n },\n };\n}\n\nexport { toast };\n","import {\n type DomphyElement,\n type Listener,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/** One item inside a toggle group. */\ntype ToggleItem = {\n /** Button label — plain string (auto-wrapped) or any DomphyElement. */\n label: string | DomphyElement;\n /** Stable key. Defaults to the item's zero-based index as a string. */\n key?: string;\n};\n\n/**\n * All-in-one toggle group — single or multi-select button group. Generates\n * `<button>` toggle elements from the `items` array. Apply to any wrapper element.\n *\n * @param props.items - Item definitions `{ label, key? }`.\n * @param props.value - Selected key(s) (value or State). Defaults to `[]` (multiple) or `\"\"` (single).\n * @param props.multiple - Allow multiple items selected at once. Defaults to `false`.\n * @param props.color - Theme color for the group background/border. Defaults to `\"neutral\"`.\n * @param props.accentColor - Theme color for the pressed state. Defaults to `\"primary\"`.\n * @example\n * { div: null, $: [toggleGroup({ multiple: true, items: [\n * { label: \"Bold\", key: \"bold\" },\n * { label: \"Italic\", key: \"italic\" },\n * ] })] }\n */\nfunction toggleGroup(\n props: {\n items: ToggleItem[];\n value?: ValueOrState<string | string[]>;\n multiple?: boolean;\n color?: ThemeColor;\n accentColor?: ThemeColor;\n } = { items: [] },\n): PartialElement {\n const {\n items = [],\n multiple = false,\n color = \"neutral\",\n accentColor = \"primary\",\n } = props;\n const value = toState(props.value ?? (multiple ? [] : \"\"));\n\n return {\n role: \"group\",\n // Expose value + multiple in context so toggle() escape-hatch still works.\n _context: { toggleGroup: { value, multiple } },\n _onSchedule: (node, element) => {\n const buttons: DomphyElement<\"button\">[] = items.map((item, index) => {\n const key = item.key ?? String(index);\n const labelEl: DomphyElement =\n typeof item.label === \"string\"\n ? ({ span: item.label } as DomphyElement<\"span\">)\n : item.label;\n\n return {\n button: [labelEl],\n _key: key,\n type: \"button\",\n role: \"button\",\n ariaPressed: (l: Listener) => {\n const val = value.get(l);\n return Array.isArray(val) ? val.includes(key) : val === key;\n },\n onClick: () => {\n const val = value.get();\n if (multiple) {\n const arr = Array.isArray(val) ? [...val] : [];\n value.set(\n arr.includes(key)\n ? arr.filter((v) => v !== key)\n : [...arr, key],\n );\n } else {\n value.set(val === key ? \"\" : key);\n }\n },\n style: {\n cursor: \"pointer\",\n fontSize: (l: Listener) => themeSize(l, \"inherit\"),\n height: themeSpacing(6),\n paddingBlock: themeSpacing(1),\n paddingInline: themeSpacing(2),\n border: \"none\",\n borderRadius: themeSpacing(1.5),\n // Unpressed: shift-13 for readable resting labels (catalog contrast).\n color: (l: Listener) => themeColor(l, \"shift-13\", color),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\", color),\n transition:\n \"background-color 140ms ease, color 140ms ease, box-shadow 140ms ease\",\n \"&:hover:not([disabled]):not([aria-pressed=true])\": {\n color: (l: Listener) => themeColor(l, \"shift-13\", color),\n backgroundColor: (l: Listener) => themeColor(l, \"hover\", color),\n },\n \"&:active:not([disabled])\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"increase-2\", color),\n },\n \"&[aria-pressed=true]\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-3\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-13\", accentColor),\n },\n \"&:focus-visible\": {\n boxShadow: (l: Listener) => focusRing(l, accentColor),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n },\n },\n } as DomphyElement<\"button\">;\n });\n\n (element as any)[node.tagName] = buttons;\n },\n style: {\n display: \"flex\",\n paddingBlock: themeSpacing(1),\n paddingInline: themeSpacing(1),\n gap: themeSpacing(1),\n borderRadius: themeSpacing(2),\n fontSize: (l: Listener) => themeSize(l, \"inherit\"),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\", color),\n color: (l: Listener) => themeColor(l, \"text\", color),\n outline: (l: Listener) => `1px solid ${themeColor(l, \"border\", color)}`,\n outlineOffset: \"-1px\",\n },\n };\n}\n\nexport { toggleGroup };\nexport type { ToggleItem };\n","import type { DomphyElement, PartialElement } from \"@domphy/core\";\nimport { row } from \"./row.js\";\n\n/**\n * A horizontal flex row with vertically centered items. Useful for headers,\n * toolbars, navigation bars, and action strips. A semantic alias of `row()`\n * at its default alignment — reach for `row()` directly for `justify`/`wrap`/\n * `align` beyond this shape.\n *\n * @param props.gap - Spacing multiplier for gap between items (default 4 = 1em).\n * @example { header: [...], $: [toolbar()] }\n * @example { nav: [...], $: [toolbar({ gap: 3 })] }\n */\nfunction toolbar(props: { gap?: number } = {}): PartialElement {\n return row({ gap: props.gap });\n}\n\n/**\n * A flex spacer that expands to fill available space in a toolbar, pushing\n * subsequent items to the far end.\n *\n * @example { header: [logo, toolbarSpacer(), nav, actions], $: [toolbar()] }\n */\nfunction toolbarSpacer(): DomphyElement {\n return { div: null, style: { flex: \"1 1 0\" } };\n}\n\nexport { toolbar, toolbarSpacer };\n","import {\n type DomphyElement,\n merge,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport type { Placement } from \"@domphy/floating\";\nimport {\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { createFloating } from \"../utils/floating.js\";\nimport { popoverArrow } from \"./popoverArrow.js\";\n\n/**\n * Attaches a floating tooltip to the host element, shown on hover/focus and\n * hidden on leave/blur/Escape. Returns the anchor (trigger) partial; the tooltip\n * surface is positioned via the floating utility and linked with\n * `aria-describedby`. No host tag check; applied to the trigger element.\n *\n * @param props.open - Controlled open state. Optional, accepts a value or state. Defaults to `false`.\n * @param props.placement - Floating placement relative to the trigger. Optional, accepts a value or state (`Placement`). Defaults to `\"top\"`.\n * @param props.content - Tooltip text content. Optional, accepts a value or state (string only). Defaults to `\"Tooltip Content\"`.\n * @example { button: \"Hover me\", $: [tooltip({ content: \"Help text\" })] }\n */\nfunction tooltip(\n props: {\n open?: ValueOrState<boolean>;\n placement?: ValueOrState<Placement>;\n content?: ValueOrState<string>;\n } = {},\n): PartialElement {\n const {\n open = false,\n placement = \"top\",\n content = \"Tooltip Content\",\n } = props;\n\n const placeState = toState(placement);\n const contentState = toState(content);\n\n // Pre-generate ID so the trigger can reference it via aria-describedby\n // before the tooltip content element is first inserted into the DOM.\n const tooltipId = `domphy-tt-${Math.random().toString(36).slice(2, 9)}`;\n\n const contentElement: DomphyElement<\"span\"> = {\n span: (listener) => contentState.get(listener),\n id: tooltipId,\n };\n\n const { show, hide, anchorPartial } = createFloating({\n kind: \"tooltip\",\n open,\n placement: placeState,\n content: contentElement,\n });\n\n const tooltipPartial: PartialElement = {\n role: \"tooltip\",\n dataSize: \"decrease-1\",\n dataTone: \"shift-17\",\n style: {\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n color: (listener) => themeColor(listener, \"text\"),\n backgroundColor: (listener) => themeColor(listener),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n boxShadow: elevation(\"low\"),\n },\n $: [popoverArrow({ placement: placeState, bordered: false })],\n };\n contentElement.$ ||= [];\n contentElement.$.push(tooltipPartial);\n\n const triggerPartial: PartialElement = {\n ariaDescribedby: tooltipId,\n onMouseEnter: (_e, node) => show(node),\n onMouseLeave: (_e, node) => hide(node),\n onFocus: (_e, node) => show(node),\n onBlur: (_e, node) => hide(node),\n onKeyDown: (e, node) => (e as KeyboardEvent).key === \"Escape\" && hide(node),\n };\n\n merge(anchorPartial, triggerPartial);\n\n return anchorPartial;\n}\n\nexport { tooltip };\n","import { ElementNode, type PartialElement } from \"@domphy/core\";\n\ntype RectMap = Map<string, DOMRect>;\n\nfunction getItemId(node: ElementNode, index: number): string {\n if (node.key !== undefined && node.key !== null) {\n return String(node.key);\n }\n return `index-${index}`;\n}\n\n/**\n * Animates child reordering using the FLIP technique: records each child's\n * position before an update and smoothly transitions it from its old to new\n * position afterward. No host tag check; applied to the list container.\n *\n * @param props.duration - Transition duration in milliseconds. Optional. Defaults to `300`.\n * @param props.delay - Transition delay in milliseconds. Optional. Defaults to `0`.\n * @example { ul: null, $: [transitionGroup({ duration: 300 })] }\n */\nfunction transitionGroup(\n props: { duration?: number; delay?: number } = {},\n): PartialElement {\n const { duration = 300, delay = 0 } = props;\n\n let previousRects: RectMap = new Map();\n // Cancels any in-flight animation for a given DOM element before starting a new one.\n const cancelMap = new Map<HTMLElement, () => void>();\n // Pending fallback timers and queued rAF callbacks, tracked so a removal of\n // the container mid-animation can clear them instead of firing on a detached node.\n const pendingTimers = new Set<ReturnType<typeof setTimeout>>();\n const pendingFrames = new Set<number>();\n\n return {\n _onMount: (node) => {\n node.addHook(\"Remove\", () => {\n // Stop every in-flight animation: removes transitionend listeners.\n for (const cancel of Array.from(cancelMap.values())) cancel();\n cancelMap.clear();\n // Clear queued fallback timers.\n for (const timer of pendingTimers) clearTimeout(timer);\n pendingTimers.clear();\n // Cancel queued animation frames.\n for (const frame of pendingFrames) cancelAnimationFrame(frame);\n pendingFrames.clear();\n });\n },\n _onBeforeUpdate: (node) => {\n previousRects = new Map();\n node.children.items.forEach((item, index) => {\n if (!(item instanceof ElementNode)) return;\n const dom = item.domElement as HTMLElement | undefined;\n if (!dom) return;\n previousRects.set(getItemId(item, index), dom.getBoundingClientRect());\n });\n },\n _onUpdate: (node) => {\n node.children.items.forEach((item, index) => {\n if (!(item instanceof ElementNode)) return;\n const dom = item.domElement as HTMLElement | undefined;\n if (!dom) return;\n\n const key = getItemId(item, index);\n const prev = previousRects.get(key);\n if (!prev) return;\n\n const next = dom.getBoundingClientRect();\n const deltaX = prev.left - next.left;\n const deltaY = prev.top - next.top;\n if (Math.abs(deltaX) < 0.5 && Math.abs(deltaY) < 0.5) return;\n\n // Cancel any in-flight animation on this element before starting a new one.\n cancelMap.get(dom)?.();\n\n dom.style.transition = \"none\";\n dom.style.transform = `translate(${deltaX}px, ${deltaY}px)`;\n dom.getBoundingClientRect();\n\n const frame = requestAnimationFrame(() => {\n pendingFrames.delete(frame);\n dom.style.transition = `transform ${duration}ms ease ${delay}ms`;\n dom.style.transform = \"translate(0px, 0px)\";\n });\n pendingFrames.add(frame);\n\n let cancelled = false;\n let timer: ReturnType<typeof setTimeout> | null = null;\n const finish = () => {\n if (cancelled) return;\n cancelled = true;\n if (timer) {\n pendingTimers.delete(timer);\n timer = null;\n }\n cancelMap.delete(dom);\n dom.removeEventListener(\"transitionend\", onEnd);\n dom.style.transition = \"\";\n dom.style.transform = \"\";\n };\n\n const onEnd = (event: Event) => {\n if ((event as TransitionEvent).propertyName === \"transform\") finish();\n };\n\n cancelMap.set(dom, () => {\n cancelled = true;\n if (timer) {\n clearTimeout(timer);\n pendingTimers.delete(timer);\n timer = null;\n }\n cancelMap.delete(dom);\n dom.removeEventListener(\"transitionend\", onEnd);\n });\n\n dom.addEventListener(\"transitionend\", onEnd);\n timer = setTimeout(finish, duration + delay + 34);\n pendingTimers.add(timer);\n });\n previousRects.clear();\n },\n };\n}\n\nexport { transitionGroup };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles a bulleted list (disc markers, reset margins, themed text) on the host\n * `<ul>` element.\n *\n * @hostTag ul\n * @param props.color - Theme color for the list text. Optional, accepts a value or state. Defaults to `\"neutral\"`.\n * @example { ul: null, $: [unorderedList()] }\n */\nfunction unorderedList(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"ul\") {\n console.warn(`\"unorderedList\" primitive patch must use ul tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) => themeColor(listener),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n marginTop: 0,\n marginBottom: 0,\n paddingLeft: themeSpacing(3),\n listStyleType: \"disc\",\n listStylePosition: \"outside\",\n },\n };\n}\n\nexport { unorderedList };\n"],"mappings":"6bAAA,OAA8B,WAAAA,OAAkC,eAChE,OAEE,cAAAC,GACA,aAAAC,GACA,gBAAAC,OACK,gBAWP,SAASC,GACPC,EAGI,CAAC,EACW,CAtBlB,IAAAC,EAAAC,EAuBE,IAAMC,EAAQR,IAAQM,EAAAD,EAAM,QAAN,KAAAC,EAAe,UAAW,OAAO,EACjDG,EAAcT,IAAQO,EAAAF,EAAM,cAAN,KAAAE,EAAqB,UAAW,aAAa,EAEzE,MAAO,CACL,UAAYG,GAAS,CACfA,EAAK,UAAY,QACnB,QAAQ,KAAK,kDAAkD,CAEnE,EACA,MAAO,CACL,SAAWC,GAAaT,GAAUS,CAAQ,EAC1C,gBAAkBA,GAAaV,GAAWU,CAAQ,EAClD,MAAQA,GACNV,GAAWU,EAAU,WAAYH,EAAM,IAAIG,CAAQ,CAAC,EACtD,mBAAoB,YACpB,oBAAqB,SACrB,oBAAsBA,GACpBV,GAAWU,EAAU,UAAWH,EAAM,IAAIG,CAAQ,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,CAAK,EAC1BA,EAAQ,MAEVJ,EAAU,OAAOO,CAAG,EACpBA,EAAI,oBAAoB,gBAAiBS,CAAK,CAChD,CAAC,EAEDT,EAAI,iBAAiB,gBAAiBS,CAAK,EAC3CZ,EAAQ,WAAWW,EAAQlB,EAAWC,EAAQ,EAAE,EAChDG,EAAc,IAAIG,CAAK,CACzB,CAAC,EACDL,EAAc,MAAM,CACtB,CACF,CACF,CC1HA,OAA8B,WAAAmB,OAAkC,eAChE,OAEE,cAAAC,GACA,aAAAC,GACA,gBAAAC,OACK,gBAUP,SAASC,GACPC,EAA8C,CAAC,EAC/B,CAlBlB,IAAAC,EAmBE,IAAMC,EAAQP,IAAQM,EAAAD,EAAM,QAAN,KAAAC,EAAe,UAAW,OAAO,EAEvD,MAAO,CACL,UAAYE,GAAS,CACfA,EAAK,UAAY,MACnB,QAAQ,KAAK,iDAAiD,CAElE,EACA,MAAO,CACL,SAAWC,GAAaP,GAAUO,EAAU,SAAS,EACrD,gBAAkBA,GAAaR,GAAWQ,CAAQ,EAClD,MAAQA,GAAaR,GAAWQ,EAAU,OAAQF,EAAM,IAAIE,CAAQ,CAAC,EACrE,UAAW,EACX,aAAc,EACd,YAAaN,GAAa,CAAC,EAC3B,cAAe,OACf,kBAAmB,SACrB,CACF,CACF","names":["toState","themeColor","themeSize","themeSpacing","abbreviation","props","_a","_b","color","accentColor","node","listener","toState","themeColor","themeDensity","themeSpacing","themeColor","focusRing","listener","color","gap","ring","accordion","props","_a","_b","type","color","toState","accentColor","node","el","handler","event","summary","item","detail","listener","themeSpacing","themeDensity","themeColor","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","alert","props","_a","color","listener","toState","themeColor","themeSize","themeSpacing","avatar","props","_a","color","listener","toState","themeColor","themeSize","themeSpacing","badge","props","_a","label","state","color","l","toState","themeColor","themeDensity","themeSize","themeSpacing","blockquote","props","_a","color","node","listener","toState","themeColor","themeSize","themeSpacing","breadcrumb","props","_a","separator","color","node","listener","toState","themeColor","themeSize","themeSpacing","breadcrumbEllipsis","props","_a","color","toState","node","listener","themeSize","themeSpacing","themeColor","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","BUTTON_SIZE_FONT","toState","themeColor","themeDensity","themeSize","themeSpacing","PADDING_STEPS","buttonGhost","props","_a","_b","_c","color","toState","padding","fontSize","BUTTON_SIZE_FONT","node","listener","themeSize","themeSpacing","themeDensity","themeColor","focusRing","PADDING_STEPS","button","props","_a","_b","_c","_d","variant","buttonGhost","color","toState","isSolid","padding","fontSize","BUTTON_SIZE_FONT","__spreadProps","__spreadValues","node","listener","themeSize","themeSpacing","themeDensity","themeColor","focusRing","toState","themeColor","themeSize","themeSpacing","buttonSwitch","props","_a","_b","checked","check","toState","color","accentColor","node","listener","themeSize","themeColor","themeSpacing","focusRing","toState","themeColor","themeDensity","themeSpacing","SHADOWS","elevation","level","card","props","_a","color","toState","listener","themeSpacing","themeDensity","themeColor","elevation","toState","themeColor","themeSize","themeSpacing","code","props","_a","color","node","listener","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","behavior","merge","toState","autoUpdate","computePosition","flip","offset","shift","attachFloating","node","initialProps","_a","openState","placement","content","keepOpenOnContentHover","timer","cleanup","floating","floatingNode","mounted","reference","rootNode","floatingPartial","listener","event","hide","show","mountedNode","dataTheme","rNode","overlay","overlayEle","wireContent","target","merge","ensureMounted","instantShow","autoUpdate","computePosition","offset","flip","shift","x","y","resolved","instantHide","handleOutside","props","createFloating","kind","open","toState","behaviorKey","anchorPartial","__spreadValues","e","behavior","toState","themeColor","themeSize","themeSpacing","xSvg","tag","props","_a","removable","color","toState","node","removeBtn","e","themeSpacing","listener","themeColor","focusRing","themeSize","combobox","props","options","placement","color","open","multiple","state","toState","openState","show","hide","anchorPartial","createFloating","popoverPartial","_e","node","listener","themeColor","themeSpacing","themeDensity","elevation","merge","inputStyle","themeSize","inputElement","inputPartial","wrap","val","vals","items","opt","tag","_node","cur","filter","v","partial","focusRing","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","command","_node","element","merge","toState","commandSearch","props","color","accentColor","node","ctx","input","onInput","listener","themeSize","themeSpacing","themeDensity","themeColor","focusRing","commandItem","_a","_b","el","text","applyFilter","q","release","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","atMidnight","date","addDays","count","addMonths","sameDay","a","b","isoOf","startOfWeek","weekStart","localeWeekStart","locale","_a","_b","localeObject","info","datePicker","props","_c","_d","mode","time","min","max","disabledDate","format","onChange","accentColor","toState","placeState","selection","releaseOnChange","value","primaryDate","current","base","viewYear","viewMonth","focused","hovered","hour","minute","contentElement","dateFormatter","__spreadValues","monthFormatter","weekdayFormatter","fullDateFormatter","formatOne","formatDisplay","start","end","weekdayNames","_unused","index","isDisabled","withTime","result","selectDate","instantHideRef","reapplyTime","inSelectedRange","listener","tail","low","high","day","isSelectedEnd","goToDate","shiftMonth","delta","next","shiftYear","focusActiveCell","calendar","buildCalendar","show","hide","anchorPartial","createFloating","triggerPartial","_e","node","openAndFocus","event","key","isSelectedPrimary","merge","navButton","label","ariaLabel","onClick","navButtonStyle","header","themeSize","themeSpacing","weekdayHeader","name","themeColor","gridRowStyle","grid","buildWeeks","onGridKey","children","buildTimeRow","buildFooter","themeDensity","elevation","first","month","weeks","week","cells","buildDayCell","disabled","selected","within","outside","isFocused","isToday","l","focusRing","numberSelect","state","timeSelectStyle","action","today","keyboard","toState","themeColor","themeSize","themeSpacing","descriptionList","props","_a","color","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","details","props","_a","_b","duration","color","toState","accentColor","node","listener","themeSize","themeColor","themeSpacing","themeDensity","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","lockCount","lockScroll","unlockScroll","FOCUSABLE","dialog","props","color","open","state","toState","previousFocus","closing","scrollLocked","finalizeClose","dlg","unlockScroll","node","e","r","closeTimer","trapFocus","focusables","el","first","last","onCancel","update","val","lockScroll","focusable","release","listener","themeSize","themeColor","themeSpacing","themeDensity","elevation","toState","themeColor","themeSize","themeSpacing","divider","props","_a","color","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","translateOut","marginMap","isVertical","p","resolvePhysical","placement","isRTL","drawer","props","color","open","size","state","toState","isLogical","physicalFallback","defaultSize","themeSpacing","drawerSize","node","e","dlg","onCancel","physical","closing","scrollLocked","closeTimer","finishClose","unlockScroll","onTransitionEnd","update","val","lockScroll","release","listener","themeSize","themeColor","themeDensity","elevation","toState","themeColor","themeSize","emphasis","props","_a","color","node","listener","toState","themeColor","themeSpacing","empty","props","_a","color","listener","errorBoundary","props","node","error","reset","_a","_b","fallbackEl","toState","themeColor","themeSize","themeSpacing","SIZE_MAP","fab","props","_a","_b","color","toState","dim","themeSpacing","node","listener","themeSize","themeColor","elevation","focusRing","toState","themeColor","themeSize","themeSpacing","figure","props","_a","color","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","formGroup","props","_a","layout","color","isVertical","node","listener","toState","themeColor","themeSize","themeSpacing","HeadingShift","heading","props","_a","color","node","listener","offset","toState","themeColor","themeSpacing","horizontalRule","props","_a","color","node","listener","toState","themeColor","themeSize","themeSpacing","icon","props","_a","color","node","listener","toState","themeColor","themeSpacing","image","props","_a","color","node","listener","toState","themeColor","themeSize","themeSpacing","inputCheckbox","props","_a","_b","color","toState","accentColor","node","listener","themeSize","themeColor","themeSpacing","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","inputColor","props","_a","color","toState","node","element","listener","themeSize","themeColor","themeSpacing","themeDensity","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","inputDateTime","props","_a","_b","mode","color","toState","accentColor","node","element","listener","themeSize","themeColor","themeSpacing","themeDensity","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","inputFile","props","_a","_b","color","toState","accentColor","node","element","listener","themeSize","themeColor","themeSpacing","themeDensity","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","inputNumber","props","_a","_b","color","toState","accentColor","node","element","themeSpacing","listener","themeDensity","themeSize","themeColor","focusRing","themeSpacing","inputOTP","node","container","getInputs","onInput","e","inputs","target","idx","onKeydown","onPaste","_a","_b","_c","text","found","startIdx","char","i","lastFilled","toState","themeColor","themeDensity","themeSize","themeSpacing","EYE_SVG","EYE_OFF_SVG","inputPassword","props","_a","_b","colorState","toState","accentState","visibleState","node","field","l","toggle","themeSpacing","themeDensity","themeColor","themeSize","focusRing","toState","themeColor","themeSize","themeSpacing","inputRadio","props","_a","_b","color","toState","accentColor","node","listener","themeSize","themeColor","themeSpacing","focusRing","toState","themeColor","themeSpacing","inputRange","props","_a","_b","color","toState","accentColor","node","themeSpacing","listener","themeColor","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","inputSearch","props","_a","_b","color","toState","accentColor","node","element","listener","themeSize","themeColor","themeSpacing","themeDensity","focusRing","toState","themeColor","themeSize","themeSpacing","inputSwitch","props","_a","accentColor","toState","node","listener","themeSize","themeColor","themeSpacing","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","inputText","props","_a","_b","color","toState","accentColor","node","element","themeSpacing","listener","themeDensity","themeSize","themeColor","focusRing","toState","themeColor","themeSize","themeSpacing","keyboard","props","_a","color","node","listener","toState","themeColor","themeSize","themeSpacing","label","props","_a","_b","color","accentColor","node","listener","toState","themeColor","themeSize","themeSpacing","link","props","_a","_b","color","toState","accentColor","node","listener","themeSize","themeColor","themeSpacing","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","PADDING_STEPS","GHOST_PADDING","linkButton","props","_a","_b","_c","variant","color","toState","size","fontSize","BUTTON_SIZE_FONT","padding","node","listener","themeSize","themeSpacing","themeDensity","themeColor","focusRing","isSolid","__spreadProps","__spreadValues","toState","themeColor","themeDensity","themeSize","themeSpacing","list","_props","listItem","props","dense","listener","themeSpacing","themeDensity","themeSize","themeColor","listItemButton","_a","_b","color","toState","accentColor","focusRing","toState","themeColor","themeSize","themeSpacing","mark","props","_a","accentColor","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","menu","props","_a","items","selectable","color","accentColor","activeKey","toState","node","element","id","buttons","item","index","key","__spreadProps","__spreadValues","l","e","k","keys","it","i","idx","next","themeSpacing","themeSize","themeDensity","themeColor","focusRing","elevation","isState","value","toStyles","frame","out","transforms","key","prefersReducedMotion","e","motion","props","_a","_b","_c","_d","initial","animate","exit","transition","options","node","el","target","release","next","done","toState","themeColor","themeSize","themeSpacing","orderedList","props","_a","color","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","getPages","current","total","_","i","pages","start","end","pagination","props","_a","color","accentColor","state","toState","btnBase","listener","themeSpacing","themeDensity","themeSize","themeColor","focusRing","activeStyle","__spreadProps","__spreadValues","node","content","page","items","ellipsisIndex","p","isActive","toState","themeColor","themeDensity","themeSpacing","panelSection","props","_a","padding","divider","color","toState","__spreadValues","listener","themeSpacing","themeDensity","themeColor","toState","themeColor","themeSize","paragraph","props","_a","color","node","listener","merge","toState","themeColor","themeDensity","themeSpacing","popover","props","_a","open","placement","openOn","popoverId","openState","toState","placeState","show","hide","anchorPartial","createFloating","popoverPartial","l","themeColor","themeSpacing","themeDensity","elevation","node","id","merge","listener","_e","e","related","root","floatingEl","toState","themeColor","themeSize","themeSpacing","popoverArrow","props","placement","color","sideOffset","bordered","place","flipMap","getFlipped","listener","_a","start","pos","end","x","y","toState","themeColor","themeDensity","themeSize","themeSpacing","preformated","props","_a","color","node","listener","toState","themeColor","themeSpacing","progress","props","_a","_b","color","accentColor","node","listener","toState","themeColor","themeSize","themeSpacing","STAR_FILLED","STAR_EMPTY","rating","props","_a","_b","max","readOnly","onChange","color","valueState","toState","hoveredState","activeCount","listener","hovered","themeSpacing","themeSize","themeColor","node","i","index","interactive","next","e","current","target","star","__spreadProps","__spreadValues","focusRing","toState","themeColor","themeSpacing","ringProgress","props","_a","_b","_c","size","thickness","value","color","trackColor","holePercent","mask","l","node","themeDensity","themeSpacing","row","props","gap","align","justify","wrap","__spreadValues","listener","themeSpacing","themeDensity","toState","themeColor","themeSpacing","scrollArea","props","_a","color","l","toState","themeColor","themeSize","themeSpacing","segmented","props","_a","_b","_c","items","color","accentColor","value","toState","node","element","buttons","item","index","key","l","themeSize","themeSpacing","themeColor","elevation","focusRing","themeColor","themeColorToken","themeDensity","themeSize","themeSpacing","select","props","color","accentColor","node","listener","themeSize","themeColor","themeSpacing","themeDensity","l","svg","themeColorToken","focusRing","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","selectBox","props","options","placement","color","open","multiple","state","toState","openState","show","hide","anchorPartial","createFloating","popoverPartial","_e","node","listener","themeColor","themeSpacing","themeDensity","elevation","merge","wrap","val","vals","opt","tag","_node","cur","filter","v","partial","themeSize","focusRing","themeColor","themeDensity","themeSize","themeSpacing","selectItem","props","accentColor","color","value","node","select","state","listener","val","v","themeSize","themeSpacing","themeDensity","themeColor","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","selectList","props","_a","color","multiple","state","inputs","listener","val","v","node","hashString","toState","themeColor","themeSize","themeSpacing","skeleton","props","_a","color","keyframes","animationName","listener","toState","themeColor","themeSize","small","props","_a","color","node","listener","hashString","toState","themeColor","themeSize","themeSpacing","keyframes","animationName","spinner","props","_a","color","node","listener","merge","toState","themeColor","themeSpacing","splitter","props","direction","defaultSize","min","max","_node","element","merge","toState","splitterPanel","node","ctx","el","prop","isFirst","apply","size","release","splitterHandle","handle","isHorizontal","releaseAriaValue","onKeydown","e","step","next","cancelDrag","onMousedown","container","onMousemove","rect","raw","onMouseup","listener","themeColor","focusRing","themeSpacing","themeDensity","themeSpacing","stack","props","gap","align","__spreadValues","listener","themeSpacing","themeDensity","toState","themeColor","themeSize","themeSpacing","steps","props","_a","items","direction","color","accentColor","current","node","element","stepEls","item","index","l","cur","toState","themeColor","themeSize","strong","props","_a","color","node","listener","toState","themeColor","themeSize","subscript","props","_a","color","node","listener","toState","themeColor","themeSize","superscript","props","_a","color","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","table","props","_a","color","node","listener","l","toState","themeColor","themeDensity","themeSize","themeSpacing","tabs","props","_a","_b","_c","items","accentColor","color","activeKey","toState","node","element","id","tablist","item","index","key","l","e","k","keys","it","i","idx","next","themeSize","themeSpacing","themeDensity","themeColor","focusRing","panels","toState","themeColor","themeDensity","themeSize","themeSpacing","textarea","props","_a","_b","color","toState","accentColor","autoResize","node","el","resize","listener","themeSpacing","themeDensity","themeSize","themeColor","focusRing","toState","themeColor","themeDensity","themeSpacing","timeline","timelineItem","props","_a","_b","_c","last","color","accentColor","activeState","toState","__spreadValues","listener","themeSpacing","themeDensity","themeColor","toState","themeColor","themeDensity","themeSize","themeSpacing","toast","props","position","color","state","toState","isTop","isCenter","isRight","overlayEle","themeSpacing","rootNode","overlay","listener","themeDensity","themeSize","themeColor","elevation","node","done","finished","timer","finish","onEnd","e","_a","toState","themeColor","themeSize","themeSpacing","toggleGroup","props","_a","items","multiple","color","accentColor","value","toState","node","element","buttons","item","index","key","l","val","arr","v","themeSize","themeSpacing","themeColor","focusRing","toolbar","props","row","toolbarSpacer","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","tooltip","props","open","placement","content","placeState","toState","contentState","tooltipId","contentElement","listener","show","hide","anchorPartial","createFloating","tooltipPartial","themeSpacing","themeDensity","themeColor","themeSize","elevation","popoverArrow","merge","_e","node","e","ElementNode","getItemId","node","index","transitionGroup","props","duration","delay","previousRects","cancelMap","pendingTimers","pendingFrames","cancel","timer","frame","item","dom","_a","key","prev","next","deltaX","deltaY","cancelled","finish","onEnd","event","toState","themeColor","themeSize","themeSpacing","unorderedList","props","_a","color","node","listener"]}
1
+ {"version":3,"sources":["../src/patches/abbreviation.ts","../src/patches/accordion.ts","../src/utils/focusRing.ts","../src/patches/alert.ts","../src/patches/avatar.ts","../src/patches/badge.ts","../src/patches/blockquote.ts","../src/patches/breadcrumb.ts","../src/patches/breadcrumbEllipsis.ts","../src/patches/button.ts","../src/utils/buttonSize.ts","../src/patches/buttonGhost.ts","../src/patches/buttonSwitch.ts","../src/patches/card.ts","../src/utils/elevation.ts","../src/patches/code.ts","../src/patches/combobox.ts","../src/utils/floating.ts","../src/patches/tag.ts","../src/patches/command.ts","../src/patches/datePicker.ts","../src/patches/descriptionList.ts","../src/patches/details.ts","../src/patches/dialog.ts","../src/utils/scrollLock.ts","../src/patches/divider.ts","../src/patches/drawer.ts","../src/patches/emphasis.ts","../src/patches/empty.ts","../src/patches/errorBoundary.ts","../src/patches/fab.ts","../src/patches/figure.ts","../src/patches/formGroup.ts","../src/patches/heading.ts","../src/patches/horizontalRule.ts","../src/patches/icon.ts","../src/patches/image.ts","../src/patches/inputCheckbox.ts","../src/patches/inputColor.ts","../src/patches/inputDateTime.ts","../src/patches/inputFile.ts","../src/patches/inputNumber.ts","../src/patches/inputOTP.ts","../src/patches/inputPassword.ts","../src/patches/inputRadio.ts","../src/patches/inputRange.ts","../src/patches/inputSearch.ts","../src/patches/inputSwitch.ts","../src/patches/inputText.ts","../src/patches/keyboard.ts","../src/patches/label.ts","../src/patches/link.ts","../src/patches/linkButton.ts","../src/patches/list.ts","../src/patches/mark.ts","../src/patches/menu.ts","../src/patches/motion.ts","../src/patches/orderedList.ts","../src/patches/pagination.ts","../src/patches/panelSection.ts","../src/patches/paragraph.ts","../src/patches/popover.ts","../src/patches/popoverArrow.ts","../src/patches/preformated.ts","../src/patches/progress.ts","../src/patches/rating.ts","../src/patches/ringProgress.ts","../src/patches/row.ts","../src/patches/scrollArea.ts","../src/patches/segmented.ts","../src/patches/select.ts","../src/patches/selectBox.ts","../src/patches/selectItem.ts","../src/patches/selectList.ts","../src/patches/skeleton.ts","../src/patches/small.ts","../src/patches/spinner.ts","../src/patches/splitter.ts","../src/patches/stack.ts","../src/patches/steps.ts","../src/patches/strong.ts","../src/patches/subscript.ts","../src/patches/superscript.ts","../src/patches/table.ts","../src/patches/tabs.ts","../src/patches/textarea.ts","../src/patches/timeline.ts","../src/patches/toast.ts","../src/patches/toggleGroup.ts","../src/patches/toolbar.ts","../src/patches/tooltip.ts","../src/patches/transitionGroup.ts","../src/patches/unorderedList.ts"],"sourcesContent":["import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles an abbreviation/acronym with a dotted underline and a \"help\" cursor,\n * shifting to the accent color on hover. Apply to an `<abbr>` element.\n *\n * @hostTag abbr\n * @param props.color - Base text/decoration color tone. Optional `ValueOrState<ThemeColor>`, default \"neutral\".\n * @param props.accentColor - Hover color tone. Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @example { abbr: \"HTML\", title: \"HyperText Markup Language\", $: [abbreviation({ accentColor: \"primary\" })] }\n */\nfunction abbreviation(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"abbr\") {\n console.warn(`\"abbreviation\" primitive patch must use abbr tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener),\n backgroundColor: (listener) => themeColor(listener),\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n textDecorationLine: \"underline\",\n textDecorationStyle: \"dotted\",\n textDecorationColor: (listener) =>\n themeColor(listener, \"shift-7\", color.get(listener)),\n textUnderlineOffset: themeSpacing(0.72),\n cursor: \"help\",\n \"&:hover\": {\n color: (listener) =>\n themeColor(listener, \"shift-11\", accentColor.get(listener)),\n textDecorationColor: (listener) =>\n themeColor(listener, \"shift-9\", accentColor.get(listener)),\n },\n },\n };\n}\n\nexport { abbreviation };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Container patch that groups `<details>` elements into a bordered accordion.\n * In `type: \"single\"` mode (default), opening one item closes all siblings.\n *\n * @param props.type - `\"single\"` (default) or `\"multiple\"`. Single mode auto-closes siblings.\n * @param props.color - Theme color tone for borders and backgrounds. Defaults to `\"neutral\"`.\n * @param props.accentColor - Accent color for focus rings on summary. Defaults to `\"primary\"`.\n * @example\n * { div: [\n * { details: [{ summary: \"Section A\" }, { p: \"Content A\" }], $: [details()] },\n * { details: [{ summary: \"Section B\" }, { p: \"Content B\" }], $: [details()] },\n * ], $: [accordion()] }\n */\nfunction accordion(\n props: {\n type?: \"single\" | \"multiple\";\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const { type = \"single\" } = props;\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n _onMount: (node) => {\n if (type !== \"single\") return;\n\n const el = node.domElement;\n if (!el) return;\n const handler = (event: Event) => {\n const summary = (event.target as Element).closest(\"summary\");\n if (!summary) return;\n const item = summary.closest(\"details\") as HTMLDetailsElement | null;\n if (!item || item.parentElement !== el) return;\n if (!item.open) {\n Array.from(el.querySelectorAll(\":scope > details\")).forEach(\n (detail) => {\n if (detail !== item) (detail as HTMLDetailsElement).open = false;\n },\n );\n }\n };\n el.addEventListener(\"click\", handler);\n node.addHook(\"Remove\", () => el.removeEventListener(\"click\", handler));\n },\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n outlineOffset: \"-1px\",\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n overflow: \"hidden\",\n \"& > details\": {\n borderBottom: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n },\n \"& > details:last-child\": {\n borderBottom: \"none\",\n },\n \"& > details > summary:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n },\n };\n}\n\nexport { accordion };\n","import type { Listener } from \"@domphy/core\";\nimport { type ThemeColor, themeColor } from \"@domphy/theme\";\n\n/**\n * Shared `:focus-visible` ring — ring-offset pattern used by Radix / shadcn /\n * Vercel / Linear:\n *\n * 1. 2px \"gap\" in the surface tone (reads as space between control + ring)\n * 2. 2px accent halo outside that gap\n *\n * Implemented as a layered `box-shadow` so it composes with a control's own\n * resting outline / elevation instead of replacing them. Prefer this over a\n * flush `0 0 0 2px` ring (looks like a thick pastel border glued to the edge)\n * and over the browser default outline.\n *\n * Accent at `shift-9` stays legible on both light and dark surfaces; the\n * washed `shift-6` flush ring is what made focus look broken in product UIs.\n */\nfunction focusRing(listener: Listener, color: ThemeColor = \"primary\"): string {\n const gap = themeColor(listener, \"surface\");\n const ring = themeColor(listener, \"shift-9\", color);\n return `0 0 0 2px ${gap}, 0 0 0 4px ${ring}`;\n}\n\nexport { focusRing };\n","import type { PartialElement } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * A semantic alert surface block with a colored inset bar, padding, and\n * `role=\"alert\"`. Typically applied to a `<div>` (any block container).\n *\n * @param props.color - Surface/accent color tone. Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @example { div: \"Saved successfully\", $: [alert({ color: \"success\" })] }\n */\nfunction alert(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"primary\", \"color\");\n\n return {\n role: \"alert\",\n // Alert is a semantic surface block, so it should shift the local surface context.\n dataTone: \"shift-2\",\n style: {\n display: \"flex\",\n alignItems: \"flex-start\",\n gap: themeSpacing(3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n boxShadow: (listener) =>\n `inset ${themeSpacing(1)} 0 0 0 ${themeColor(listener, \"shift-8\", color.get(listener))}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n },\n };\n}\n\nexport { alert };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * A circular avatar container that centers initials/text and cover-fits any\n * child `<img>`. Typically applied to an inline-flex container such as a `<span>`.\n *\n * @param props.color - Background/foreground color tone. Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @example { span: \"JD\", $: [avatar({ color: \"primary\" })] }\n */\nfunction avatar(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"primary\", \"color\");\n\n return {\n dataTone: \"shift-2\",\n // Design-system initials weight (not app chrome) — consumers use avatar().\n _doctorDisable: \"inline-typography\",\n style: {\n position: \"relative\",\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n overflow: \"hidden\",\n borderRadius: \"50%\",\n flexShrink: 0,\n width: themeSpacing(9),\n height: themeSpacing(9),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n fontWeight: \"600\",\n userSelect: \"none\",\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) =>\n themeColor(listener, \"shift-11\", color.get(listener)),\n // Hairline so the circle separates from same-tone surfaces.\n boxShadow: (listener) =>\n `0 0 0 1px ${themeColor(listener, \"border\", color.get(listener))}`,\n \"& img\": {\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n },\n },\n };\n}\n\nexport { avatar };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Renders a small count/label bubble pinned to the top-right corner of its host\n * (via a `::after` pseudo-element). Typically applied to an inline container such\n * as a `<span>` wrapping an icon or element.\n *\n * @param props.color - Badge color tone. Optional `ValueOrState<ThemeColor>`, default \"danger\".\n * @param props.label - Text/number shown in the badge. Optional `ValueOrState<string | number>`, default 999.\n * @example { span: \"🔔\", $: [badge({ label: 3, color: \"danger\" })] }\n */\nfunction badge(\n props: {\n color?: ValueOrState<ThemeColor>;\n label?: ValueOrState<string | number>;\n } = {},\n): PartialElement {\n const { label = 999 } = props;\n const state = toState(label);\n const color = toState(props.color ?? \"danger\", \"color\");\n return {\n // Badge ::after uses a fixed size scale for the pill chrome.\n _doctorDisable: \"inline-typography\",\n style: {\n position: \"relative\",\n \"&::after\": {\n content: (l) => `\"${state.get(l)}\"`,\n position: \"absolute\",\n top: 0,\n right: 0,\n transform: \"translate(50%,-50%)\",\n paddingInline: themeSpacing(1.5),\n minWidth: themeSpacing(5),\n height: themeSpacing(5),\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontSize: (l) => themeSize(l, \"decrease-2\"),\n fontWeight: \"600\",\n lineHeight: 1,\n borderRadius: themeSpacing(999),\n backgroundColor: (l) => themeColor(l, \"shift-9\", color.get(l)),\n color: (l) => themeColor(l, \"shift-0\", color.get(l)),\n // Hairline ring so the pill pops on same-hue surfaces.\n boxShadow: (l) => `0 0 0 1px ${themeColor(l, \"shift-0\", color.get(l))}`,\n },\n },\n };\n}\n\nexport { badge };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles a quotation block with a colored inset side bar, padded surface, and\n * shifted tone. Apply to a `<blockquote>` element.\n *\n * @hostTag blockquote\n * @param props.color - Surface/bar color tone. Optional `ValueOrState<ThemeColor>`, default \"neutral\".\n * @example { blockquote: \"Design is how it works.\", $: [blockquote({ color: \"primary\" })] }\n */\nfunction blockquote(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"blockquote\") {\n console.warn(`\"blockquote\" primitive patch must use blockquote tag`);\n }\n },\n dataTone: \"shift-2\",\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n boxShadow: (listener) =>\n `inset ${themeSpacing(1)} 0 0 0 ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n border: \"none\",\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n margin: 0,\n },\n };\n}\n\nexport { blockquote };\n","import type { PartialElement } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * A horizontal breadcrumb navigation that lays out its children with a\n * separator between items and highlights the `[aria-current=page]` item.\n * Apply to a `<nav>` element.\n *\n * @hostTag nav\n * @param props.color - Color tone for links/separators. Optional `ValueOrState<ThemeColor>`, default \"neutral\".\n * @param props.separator - String inserted between items via `::after`. Optional `string`, default \"/\".\n * @example { nav: null, $: [breadcrumb({ separator: \"›\" })] }\n */\nfunction breadcrumb(\n props: { color?: ValueOrState<ThemeColor>; separator?: string } = {},\n): PartialElement {\n const { separator = \"/\" } = props;\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"nav\")\n console.warn('\"breadcrumb\" patch must use nav tag');\n },\n ariaLabel: \"breadcrumb\",\n style: {\n display: \"flex\",\n alignItems: \"center\",\n flexWrap: \"wrap\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n gap: themeSpacing(1),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n \"& > *\": {\n display: \"inline-flex\",\n alignItems: \"center\",\n color: (listener) => themeColor(listener, \"muted\", color.get(listener)),\n },\n \"& > *:not(:last-child)::after\": {\n content: `\"${separator}\"`,\n color: (listener) =>\n themeColor(listener, \"shift-4\", color.get(listener)),\n paddingInlineStart: themeSpacing(1),\n },\n \"& > [aria-current=page]\": {\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n pointerEvents: \"none\",\n },\n },\n };\n}\n\nexport { breadcrumb };\n","import type { PartialElement } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * An ellipsis trigger button for collapsed breadcrumb items, with hover and\n * focus-visible states. Apply to a `<button>` element.\n *\n * @hostTag button\n * @param props.color - Color tone for the trigger. Optional `ValueOrState<ThemeColor>`, default \"neutral\".\n * @example { button: \"…\", $: [breadcrumbEllipsis({ color: \"neutral\" })] }\n */\nfunction breadcrumbEllipsis(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"button\") {\n console.warn('\"breadcrumbEllipsis\" patch must use button tag');\n }\n },\n ariaLabel: \"More breadcrumb items\",\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n paddingInline: themeSpacing(1),\n border: \"none\",\n background: \"none\",\n cursor: \"pointer\",\n color: (listener) => themeColor(listener, \"muted\", color.get(listener)),\n borderRadius: themeSpacing(1),\n transition:\n \"color 140ms ease, background-color 140ms ease, box-shadow 140ms ease\",\n \"&:hover\": {\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"hover\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color.get(listener)),\n },\n },\n };\n}\n\nexport { breadcrumbEllipsis };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { BUTTON_SIZE_FONT, type ButtonSize } from \"../utils/buttonSize.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\nimport { buttonGhost } from \"./buttonGhost.js\";\n\ntype ButtonVariant = \"solid\" | \"outline\" | \"ghost\";\n\nconst PADDING_STEPS: Record<ButtonSize, { block: number; inline: number }> = {\n small: { block: 0.5, inline: 2 },\n medium: { block: 1, inline: 3 },\n large: { block: 1.5, inline: 4 },\n};\n\n/**\n * A themed button control with density-aware padding/radius and hover, pressed\n * (`:active` ±2), focus-visible, `[disabled]`, and `[aria-busy=true]` states.\n * Apply to a `<button>` element.\n *\n * @hostTag button\n * @param props.color - Button color tone. Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @param props.variant - Visual style: `\"outline\"` (tinted background + outline, default,\n * backward compatible), `\"solid\"` (filled background, readable contrast text), or `\"ghost\"`\n * (no background/border — delegates to `buttonGhost()` so the two stay visually identical).\n * @param props.size - Button size preset. Optional `\"small\" | \"medium\" | \"large\"`, defaults to `\"medium\"`.\n * @example { button: \"Save\", $: [button({ color: \"primary\" })] }\n * @example { button: \"Delete\", $: [button({ color: \"error\", variant: \"solid\" })] }\n */\nfunction button(\n props: {\n color?: ValueOrState<ThemeColor>;\n variant?: ButtonVariant;\n size?: ButtonSize;\n } = {},\n): PartialElement {\n const variant = props.variant ?? \"outline\";\n if (variant === \"ghost\") {\n return buttonGhost({ color: props.color, size: props.size });\n }\n\n const color = toState(props.color ?? \"primary\", \"color\");\n const isSolid = variant === \"solid\";\n const padding = PADDING_STEPS[props.size ?? \"medium\"];\n const fontSize = BUTTON_SIZE_FONT[props.size ?? \"medium\"];\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"button\") {\n console.warn(`\"button\" primitive patch must use button tag`);\n }\n },\n // Solid: deep brand fill (shift-13) + light-end neutral text (shift-0).\n // Mid-ramp shift-8 failed WCAG (~2.2:1 white-on-medium). NOT dataTone-17\n // (that collapsed every color into a near-black pill). Outline text:\n // shift-13 for ≥4.5:1 on light surfaces (shift-9 failed at ~2.57).\n ...(isSolid\n ? {\n _doctorDisable: [\n \"low-contrast\",\n \"color-shift-minimum\",\n \"tone-background-inherit\",\n ] as const,\n }\n : {}),\n style: {\n appearance: \"none\",\n fontSize: (listener) => themeSize(listener, fontSize),\n // Single-line bounded control: block/radius = 1D, inline = 3D.\n paddingBlock: (listener) =>\n themeSpacing(themeDensity(listener) * padding.block),\n paddingInline: (listener) =>\n themeSpacing(themeDensity(listener) * padding.inline),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n width: \"fit-content\",\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gap: (listener) => themeSpacing(themeDensity(listener) * 1),\n userSelect: \"none\",\n cursor: \"pointer\",\n fontFamily: \"inherit\",\n lineHeight: \"inherit\",\n border: \"none\",\n outlineOffset: \"-1px\",\n outlineWidth: \"1px\",\n outline: isSolid\n ? \"none\"\n : (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n color: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-0\", \"neutral\")\n : themeColor(listener, \"shift-13\", color.get(listener)),\n backgroundColor: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-13\", color.get(listener))\n : themeColor(listener, \"inherit\", color.get(listener)),\n transition:\n \"background-color 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease\",\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n color: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-0\", \"neutral\")\n : themeColor(listener, \"shift-14\", color.get(listener)),\n backgroundColor: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-14\", color.get(listener))\n : themeColor(listener, \"hover\", color.get(listener)),\n },\n // Pressed: solid steps deeper on the brand ramp; outline uses +2 surface.\n \"&:active:not([disabled]):not([aria-busy=true])\": {\n backgroundColor: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-15\", color.get(listener))\n : themeColor(listener, \"increase-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n },\n \"&[aria-busy=true]\": {\n opacity: 0.7,\n cursor: \"wait\",\n pointerEvents: \"none\",\n },\n },\n };\n}\n\nexport { button };\nexport type { ButtonVariant };\n","/**\n * The `fontSize` step for `button()`/`buttonGhost()`'s `size` prop. Padding stays\n * per-component (button and buttonGhost start from different base paddings) so\n * only the part that's genuinely identical — the font-size step — lives here.\n */\nconst BUTTON_SIZE_FONT = {\n small: \"decrease-1\",\n medium: \"inherit\",\n large: \"increase-1\",\n} as const;\n\ntype ButtonSize = keyof typeof BUTTON_SIZE_FONT;\n\nexport { BUTTON_SIZE_FONT };\nexport type { ButtonSize };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { BUTTON_SIZE_FONT, type ButtonSize } from \"../utils/buttonSize.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\nconst PADDING_STEPS: Record<ButtonSize, number> = {\n small: 0.5,\n medium: 1,\n large: 1.5,\n};\n\n/**\n * A transparent button with no border or background — suitable for icon\n * actions, inline controls, and delete/close triggers. Apply to a `<button>`\n * element.\n *\n * @hostTag button\n * @param props.color - Text color tone. Optional `ValueOrState<ThemeColor>`, defaults to `\"neutral\"`.\n * @param props.size - Button size preset. Optional `\"small\" | \"medium\" | \"large\"`, defaults to `\"medium\"`.\n * @example { button: \"×\", $: [buttonGhost()] }\n * @example { button: { span: null, $: [icon({ name: \"trash\" })] }, $: [buttonGhost({ color: \"error\" })] }\n */\nfunction buttonGhost(\n props: { color?: ValueOrState<ThemeColor>; size?: ButtonSize } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const padding = PADDING_STEPS[props.size ?? \"medium\"];\n const fontSize = BUTTON_SIZE_FONT[props.size ?? \"medium\"];\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"button\") {\n console.warn(`\"buttonGhost\" primitive patch must use button tag`);\n }\n },\n style: {\n appearance: \"none\",\n fontSize: (listener) => themeSize(listener, fontSize),\n paddingBlock: (listener) =>\n themeSpacing(themeDensity(listener) * padding),\n paddingInline: (listener) =>\n themeSpacing(themeDensity(listener) * padding),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n display: \"inline-flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gap: (listener) => themeSpacing(themeDensity(listener) * 1),\n userSelect: \"none\",\n cursor: \"pointer\",\n fontFamily: \"inherit\",\n lineHeight: \"inherit\",\n border: \"none\",\n background: \"none\",\n outline: \"none\",\n transition:\n \"background-color 140ms ease, color 140ms ease, box-shadow 140ms ease\",\n color: (listener) => themeColor(listener, \"shift-6\", color.get(listener)),\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"hover\", color.get(listener)),\n },\n \"&:active:not([disabled]):not([aria-busy=true])\": {\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"increase-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"border-strong\", \"neutral\"),\n },\n \"&[aria-busy=true]\": {\n opacity: 0.7,\n cursor: \"wait\",\n pointerEvents: \"none\",\n },\n },\n };\n}\n\nexport { buttonGhost };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * A pill-shaped toggle switch with `role=\"switch\"`; clicking flips the bound\n * `checked` state and slides the thumb. Apply to a `<button>` element.\n *\n * @hostTag button\n * @param props.checked - Toggle state. Optional `ValueOrState<boolean>`, default false.\n * @param props.accentColor - Color tone when checked (on). Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @param props.color - Color tone when unchecked (off track). Optional `ValueOrState<ThemeColor>`, default \"neutral\".\n * @example { button: { span: null }, $: [buttonSwitch({ checked: true })] }\n */\nfunction buttonSwitch(\n props: {\n checked?: ValueOrState<boolean>;\n accentColor?: ValueOrState<ThemeColor>;\n color?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const { checked = false } = props;\n\n const check = toState(checked);\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n _onSchedule: (node) => {\n if (node.tagName !== \"button\") {\n console.warn(`\"buttonSwitch\" primitive patch must use button tag`);\n }\n },\n role: \"switch\",\n ariaChecked: (listener) => check.get(listener),\n dataTone: \"shift-2\",\n onClick: () => check.set(!check.get()),\n style: {\n position: \"relative\",\n display: \"inline-flex\",\n alignItems: \"center\",\n fontSize: (listener) => themeSize(listener),\n border: \"none\",\n outlineWidth: \"1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border\", color.get(listener))}`,\n minWidth: themeSpacing(12),\n minHeight: themeSpacing(6),\n borderRadius: themeSpacing(999),\n paddingLeft: themeSpacing(7),\n paddingRight: themeSpacing(2),\n cursor: \"pointer\",\n transition:\n \"padding-left 0.3s, padding-right 0.3s, background-color 140ms ease, box-shadow 140ms ease\",\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"& > :first-child\": {\n content: '\"\"',\n position: \"absolute\",\n display: \"inline-flex\",\n alignItems: \"center\",\n left: themeSpacing(0.5),\n top: \"50%\",\n transform: \"translateY(-50%)\",\n transition: \"left 0.3s\",\n width: themeSpacing(5),\n height: themeSpacing(5),\n borderRadius: themeSpacing(999),\n color: (listener) => themeColor(listener, \"text\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"decrease-2\", color.get(listener)),\n },\n \"&[aria-checked=true]\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"increase-3\", accentColor.get(listener)),\n outline: \"none\",\n color: (listener) => themeColor(listener, \"decrease-2\"),\n paddingLeft: themeSpacing(2),\n paddingRight: themeSpacing(7),\n },\n \"&[aria-checked=true] > :first-child\": {\n left: `calc(100% - ${themeSpacing(5.5)})`,\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n },\n },\n };\n}\n\nexport { buttonSwitch };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\n\n/**\n * A grid-based card surface that auto-places known child elements into named\n * regions: `<img>` (image), headings (title), `<p>` (description), `<aside>`\n * (aside), `<div>` (content), and `<footer>` (footer). Typically applied to a\n * `<div>` (any block container).\n *\n * @param props.color - Surface/border color tone. Optional `ValueOrState<ThemeColor>`, default \"neutral\".\n * @example { div: { h3: \"Title\", p: \"Body\" }, $: [card({ color: \"neutral\" })] }\n */\nfunction card(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n return {\n // Title weight is design-system chrome for the card region layout.\n _doctorDisable: \"inline-typography\",\n style: {\n display: \"grid\",\n gridTemplateColumns: \"1fr auto\",\n gridTemplateAreas:\n '\"image image\" \"title aside\" \"desc aside\" \"content content\" \"footer footer\"',\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n outlineOffset: \"-1px\",\n // Soft lift so cards separate from the page without looking like dialogs.\n boxShadow: elevation(\"low\"),\n overflow: \"hidden\",\n \"& > img\": {\n gridArea: \"image\",\n width: \"100%\",\n height: \"auto\",\n display: \"block\",\n },\n \"& > :is(h1,h2,h3,h4,h5,h6)\": {\n gridArea: \"title\",\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n fontWeight: \"600\",\n color: (listener) =>\n themeColor(listener, \"shift-11\", color.get(listener)),\n margin: 0,\n },\n \"& > p\": {\n gridArea: \"desc\",\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n paddingBottom: (listener) => themeSpacing(themeDensity(listener) * 2),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n margin: 0,\n },\n \"& > aside\": {\n gridArea: \"aside\",\n alignSelf: \"center\",\n padding: (listener) => themeSpacing(themeDensity(listener) * 2),\n height: \"auto\",\n },\n \"& > div\": {\n gridArea: \"content\",\n padding: (listener) => themeSpacing(themeDensity(listener) * 4),\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n },\n \"& > footer\": {\n gridArea: \"footer\",\n display: \"flex\",\n gap: themeSpacing(2),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n borderTop: (listener) =>\n `1px solid ${themeColor(listener, \"border\", color.get(listener))}`,\n },\n },\n };\n}\n\nexport { card };\n","/** Named elevation levels for floating/raised surfaces. */\ntype ElevationLevel = \"low\" | \"medium\" | \"high\";\n\n// Layered soft shadows (a tight contact shadow + a broad ambient one), black at\n// low alpha so the same value reads correctly on both light and dark surfaces\n// without a theme/context lookup.\nconst SHADOWS: Record<ElevationLevel, string> = {\n low: \"0 1px 2px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.10)\",\n medium: \"0 2px 4px rgba(0,0,0,0.10), 0 10px 24px rgba(0,0,0,0.14)\",\n high: \"0 6px 12px rgba(0,0,0,0.14), 0 24px 48px rgba(0,0,0,0.20)\",\n};\n\n/**\n * Shared box-shadow value for a named elevation level. Used by floating/raised\n * surface patches (popover, menu, dialog, drawer, toast, tooltip, combobox/\n * selectBox dropdown, datePicker popup, fab) so elevation reads consistently\n * across the library instead of each patch picking its own shadow.\n */\nfunction elevation(level: ElevationLevel): string {\n return SHADOWS[level];\n}\n\nexport { elevation };\nexport type { ElevationLevel };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles an inline code snippet with a subtle surface background, rounded corners,\n * and shifted tone. Apply to a `<code>` element.\n *\n * @hostTag code\n * @param props.color - Surface/text color tone. Optional `ValueOrState<ThemeColor>`, default \"neutral\".\n * @example { code: \"npm install\", $: [code({ color: \"neutral\" })] }\n */\nfunction code(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n dataTone: \"shift-2\",\n _onInsert: (node) => {\n if (node.tagName !== \"code\") {\n console.warn(`\"code\" primitive patch must use code tag`);\n }\n },\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n whiteSpace: \"nowrap\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n height: themeSpacing(6),\n paddingInline: themeSpacing(1.5),\n borderRadius: themeSpacing(1),\n },\n };\n}\n\nexport { code };\n","import {\n type DomphyElement,\n merge,\n type PartialElement,\n type StyleObject,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport type { Placement } from \"@domphy/floating\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { createFloating } from \"../utils/floating.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\nimport { tag } from \"./tag.js\";\n\n/**\n * A combobox/multi-select control: renders selected options as removable tags\n * plus an input, and shows a floating popover (`content`) anchored to the host.\n * Apply to a `<div>` element.\n *\n * @hostTag div\n * @param props.multiple - Allow selecting multiple values (popover stays open on click). Optional `boolean`, default false.\n * @param props.value - Selected value(s). Optional `ValueOrState<Array<number | string | null | undefined> | number | string | null | undefined>`, no default.\n * @param props.options - Available `{ label, value }` options used to render selected tags. Optional `Array<{ label: string; value: string }>`, default `[]`.\n * @param props.placement - Floating popover placement. Optional `ValueOrState<Placement>`, default \"bottom\".\n * @param props.content - The floating popover content element. Required `DomphyElement`.\n * @param props.color - Color tone for the control. Optional `ThemeColor`, default \"neutral\".\n * @param props.open - Whether the popover is open. Optional `ValueOrState<boolean>`, default false.\n * @param props.input - Custom input element; when omitted a default `<input>` is created. Optional `DomphyElement`.\n * @example { div: null, $: [combobox({ options: [{ label: \"A\", value: \"a\" }], content: { div: null } })] }\n */\nfunction combobox(props: {\n multiple?: boolean;\n value?: ValueOrState<\n | Array<number | string | null | undefined>\n | number\n | string\n | null\n | undefined\n >;\n options?: Array<{ label: string; value: string }>;\n placement?: ValueOrState<Placement>;\n content: DomphyElement;\n color?: ThemeColor;\n open?: ValueOrState<boolean>;\n input?: DomphyElement;\n}): PartialElement {\n const {\n options = [],\n placement = \"bottom\",\n color = \"neutral\",\n open = false,\n multiple = false,\n } = props;\n\n const state = toState(props.value);\n const openState = toState(open);\n const { show, hide, anchorPartial } = createFloating({\n kind: \"combobox\",\n open: openState,\n placement: toState(placement),\n content: props.content,\n });\n\n const popoverPartial: PartialElement = {\n onClick: (_e, node) => !multiple && hide(node),\n dataTone: \"shift-14\",\n style: {\n backgroundColor: (listener) => themeColor(listener, \"inherit\"),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\")}`,\n outlineOffset: \"-1px\",\n boxShadow: elevation(\"medium\"),\n },\n };\n\n merge(props.content, popoverPartial);\n\n const inputStyle: StyleObject = {\n border: \"none\",\n outline: \"none\",\n padding: 0,\n margin: 0,\n flex: 1,\n height: themeSpacing(6),\n marginInlineStart: themeSpacing(2),\n fontSize: (listener: any) => themeSize(listener, \"inherit\"),\n color: (listener: any) => themeColor(listener, \"text\", color),\n backgroundColor: (listener: any) => themeColor(listener, \"inherit\", color),\n };\n\n let inputElement: DomphyElement;\n if (props.input) {\n const inputPartial: PartialElement = {\n onFocus: (_e, node) => show(node),\n style: inputStyle,\n _key: \"combobox-input\",\n };\n merge(props.input, inputPartial);\n inputElement = props.input;\n } else {\n inputElement = {\n input: null,\n onFocus: (_e, node) => show(node),\n value: (listener: any) => {\n state.get(listener);\n return \"\";\n },\n style: inputStyle,\n _key: \"combobox-input\",\n };\n }\n\n const wrap: DomphyElement<\"div\"> = {\n div: (listener) => {\n const val = state.get(listener);\n const vals = Array.isArray(val) ? val : [val];\n const opts = options.filter((opt) => vals.includes(opt.value));\n const items: DomphyElement[] = opts.map((opt) => {\n return {\n span: opt.label,\n $: [tag({ color, removable: true })],\n _key: opt.value,\n _onRemove: (_node) => {\n const cur = state.get();\n const curVals = Array.isArray(cur) ? cur : [cur];\n const filter = curVals.filter((v) => v !== opt.value);\n multiple ? state.set(filter as any) : state.set(filter[0] as any);\n },\n };\n });\n items.push(inputElement);\n return items;\n },\n style: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: themeSpacing(1),\n },\n };\n\n const partial: PartialElement = {\n _onInsert: (node) => {\n if (node.tagName !== \"div\") {\n console.warn(`\"combobox\" primitive patch must use div tag`);\n }\n },\n _onInit: (node) => node.children.insert(wrap),\n style: {\n minWidth: themeSpacing(32),\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 1),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n transition:\n \"background-color 140ms ease, outline-color 140ms ease, box-shadow 140ms ease\",\n \"&:focus-within\": {\n boxShadow: (listener) => focusRing(listener, color),\n },\n },\n };\n\n merge(anchorPartial, partial);\n return anchorPartial;\n}\n\nexport { combobox };\n","import {\n type BehaviorInstance,\n behavior,\n type DomphyElement,\n type ElementNode,\n merge,\n type PartialElement,\n type State,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n autoUpdate,\n computePosition,\n flip,\n offset,\n type Placement,\n shift,\n} from \"@domphy/floating\";\n\ntype FloatingProps = {\n openState: State<boolean>;\n placement: State<Placement>;\n content: DomphyElement;\n // popover's openOn === \"hover\" case: hovering the floating PANEL itself\n // (not just the anchor) must keep it open, so the pointer can travel from\n // trigger to panel without the debounced hide() firing first.\n keepOpenOnContentHover: boolean;\n};\n\ntype FloatingInstance = BehaviorInstance<FloatingProps> & {\n show: () => void;\n hide: () => void;\n};\n\n// The per-anchor persistent state a floating component needs (position\n// cleanup, the inserted panel node, debounce timer) used to live in\n// createFloating()'s own closure — but that closure is recreated fresh every\n// time a reactive ancestor re-renders the anchor (popover()/tooltip() called\n// again on the SAME reused DOM element). Only the FIRST-ever generation's\n// _onMount ever fires (ElementNode hooks run once per node), so imperative,\n// document-level listeners (outside-click, Escape-inside-panel) that closed\n// over that generation's `openState`/`reference`/`floating` kept acting on an\n// orphaned copy forever, while live-rebound trigger events (onClick etc.)\n// moved on to whatever generation was actually current — the trigger opened\n// the panel, but nothing could ever close it again from outside.\n//\n// Fixed by moving all of this into ONE `behavior()` instance per (anchor,\n// kind): `attach` runs once, and every later generation's `show`/`hide`\n// calls and `_behaviors` re-declaration route into that SAME instance via\n// `getBehavior`/`update()` — so there is exactly one canonical `openState`/\n// `reference`/`floating` for the anchor's whole lifetime, not one per\n// generation.\nfunction attachFloating(\n node: ElementNode,\n initialProps: FloatingProps,\n): FloatingInstance {\n let { openState, placement, content, keepOpenOnContentHover } = initialProps;\n\n let timer: ReturnType<typeof setTimeout> | null = null;\n let cleanup: (() => void) | null = null;\n let floating: HTMLElement | null = null;\n let floatingNode: ElementNode | null = null;\n let mounted = false;\n\n const reference = node.domElement as HTMLElement;\n const rootNode = node.getRoot();\n\n const floatingPartial: PartialElement = {\n style: {\n position: \"fixed\",\n pointerEvents: \"auto\",\n visibility: (listener) =>\n openState.get(listener) ? \"visible\" : \"hidden\",\n },\n // Escape must dismiss the panel from INSIDE it too: the content is\n // portaled as a DOM sibling of the anchor, so a keydown on a focused\n // element within the panel (menu item, calendar cell, footer button)\n // never bubbles to the anchor's own Escape handler.\n onKeyDown: (event) => {\n if ((event as KeyboardEvent).key === \"Escape\") hide();\n },\n onMouseEnter: () => keepOpenOnContentHover && show(),\n onMouseLeave: () => keepOpenOnContentHover && hide(),\n _onMount: (mountedNode) => {\n floating = mountedNode.domElement as HTMLElement;\n // Propagate data-theme from the trigger's ancestor so floating content\n // inherits CSS variable scope. Stamped on the PANEL, not the shared\n // overlay: the one overlay serves every floating component under the\n // root, so an overlay-level stamp would let whichever anchor opened\n // FIRST permanently impose its theme on later panels anchored under a\n // different [data-theme] scope. Skipped when the content declares its\n // own data-theme.\n if (reference && floating && !floating.hasAttribute(\"data-theme\")) {\n const dataTheme = reference\n .closest(\"[data-theme]\")\n ?.getAttribute(\"data-theme\");\n if (dataTheme) floating.setAttribute(\"data-theme\", dataTheme);\n }\n },\n _portal: (rNode) => {\n let overlay = rNode.domElement!.querySelector(`#domphy-floating`);\n if (!overlay) {\n const overlayEle: DomphyElement<\"div\"> = {\n div: [],\n id: `domphy-floating`,\n style: {\n position: \"fixed\",\n inset: 0,\n zIndex: 20,\n pointerEvents: \"none\",\n },\n };\n const overlayNode = rNode.children!.insert(overlayEle) as ElementNode;\n overlay = overlayNode.domElement!;\n }\n return overlay;\n },\n };\n\n // Later generations declare their OWN fresh `content` object (a new object\n // literal at the popover()/tooltip() call site) — wire it every time, not\n // just at attach, so the panel wiring (theming, portal, dismiss handlers)\n // is present regardless of which generation's content ends up mounted.\n const wireContent = (target: DomphyElement) => merge(target, floatingPartial);\n wireContent(content);\n\n const ensureMounted = () => {\n if (mounted) return;\n mounted = true;\n floatingNode = rootNode.children!.insert(content) as ElementNode;\n };\n\n const instantShow = () => {\n ensureMounted();\n if (reference && floating) {\n cleanup?.();\n cleanup = autoUpdate(reference, floating, () => {\n computePosition(reference as HTMLElement, floating as HTMLElement, {\n placement: placement.get() as Placement,\n middleware: [offset(12), flip(), shift()],\n strategy: \"fixed\",\n }).then(({ x, y, placement: resolved }) => {\n // Teardown can run while computePosition's async work is in\n // flight (it nulls `floating` and removes the panel) — skip the\n // late positioning instead of dereferencing null.\n if (!floating) return;\n Object.assign(floating.style, {\n left: `${x}px`,\n top: `${y}px`,\n });\n placement.set(resolved);\n });\n });\n openState.set(true);\n }\n };\n // Fully unmounts (not just CSS-hides) the panel — mirrors show()'s own\n // insert-on-demand: a closed floating component holds no DOM/listeners.\n // ensureMounted() re-inserts a fresh panel node next time show() runs.\n const instantHide = () => {\n cleanup?.();\n cleanup = null;\n if (floatingNode) {\n floatingNode.remove();\n floatingNode = null;\n }\n floating = null;\n mounted = false;\n openState.set(false);\n };\n const show = () => {\n timer && clearTimeout(timer);\n timer = setTimeout(instantShow, 100);\n };\n const hide = () => {\n timer && clearTimeout(timer);\n timer = setTimeout(instantHide, 100);\n };\n\n const handleOutside = (event: MouseEvent) => {\n if (!openState.get() || !reference || !floating) return;\n const target = event.target as Node;\n if (!reference.contains(target) && !floating.contains(target)) hide();\n };\n rootNode.domElement?.addEventListener(\"click\", handleOutside);\n\n return {\n show,\n hide,\n update(props) {\n openState = props.openState;\n placement = props.placement;\n content = props.content;\n keepOpenOnContentHover = props.keepOpenOnContentHover;\n wireContent(content);\n // Reflect the new generation's declared content into the already-\n // mounted panel in place (same DOM node, no flicker/teardown) — the\n // ordinary reused-node \"patch, don't recreate\" contract, applied to\n // the imperatively-inserted panel too.\n if (floatingNode) floatingNode.patch(content);\n },\n destroy() {\n if (timer) clearTimeout(timer);\n cleanup?.();\n floatingNode?.remove();\n rootNode.domElement?.removeEventListener(\"click\", handleOutside);\n },\n };\n}\n\nfunction createFloating(props: {\n kind: string;\n open?: ValueOrState<boolean>;\n placement: State<Placement>;\n content: DomphyElement;\n keepOpenOnContentHover?: boolean;\n}) {\n const { kind, open = false, placement } = props;\n const openState = toState(open);\n const behaviorKey = `floating:${kind}`;\n\n // Trigger event handlers ARE live-rebound on every patch and already\n // receive the current ElementNode as their 2nd argument (unlike lifecycle\n // hooks) — so show(node)/hide(node) just forward to whatever instance is\n // attached there, regardless of which generation's closure is calling.\n const show = (node?: ElementNode) =>\n node?.getBehavior<FloatingInstance>(behaviorKey)?.show();\n const hide = (node?: ElementNode) =>\n node?.getBehavior<FloatingInstance>(behaviorKey)?.hide();\n\n // Plain spread, NOT merge(): merge() defensively deep-clones its `target`\n // argument, which would snapshot `props.content` right now — but the\n // caller (popover()/tooltip()) hasn't finished mutating it yet (it pushes\n // its OWN partial onto `content.$` right after this call returns). A\n // premature clone silently drops that later mutation, so the panel loses\n // its role/style/dismiss wiring. Spread keeps the `_behaviors` record's\n // `props.content` a live reference to the SAME object the caller mutates.\n const anchorPartial: PartialElement = {\n onKeyDown: (e: Event, node: ElementNode) =>\n (e as KeyboardEvent).key === \"Escape\" && hide(node),\n ...behavior<FloatingProps>(behaviorKey, attachFloating, {\n openState,\n placement,\n content: props.content,\n keepOpenOnContentHover: !!props.keepOpenOnContentHover,\n }),\n };\n\n return { show, hide, anchorPartial };\n}\n\nexport { createFloating };\n","import type { DomphyElement, PartialElement } from \"@domphy/core\";\nimport { rawHtml, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\nconst xSvg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M6.707 5.293l5.293 5.292l5.293 -5.292a1 1 0 0 1 1.414 1.414l-5.292 5.293l5.292 5.293a1 1 0 0 1 -1.414 1.414l-5.293 -5.292l-5.293 5.292a1 1 0 1 1 -1.414 -1.414l5.292 -5.293l-5.292 -5.293a1 1 0 0 1 1.414 -1.414\" /></svg>`;\n\n/**\n * Styles an inline chip/tag (rounded, bordered, optional remove button).\n * No host tag check; typically applied to a `<span>`. When `removable` is true,\n * a close button is inserted that removes the host node on click.\n *\n * @hostTag span\n * @param props.color - Theme color for the chip background/border/text. Optional, accepts a value or state. Defaults to `\"neutral\"`.\n * @param props.removable - When true, renders a remove (x) button that removes the tag on click. Optional. Defaults to `false`.\n * @example { span: \"Label\", $: [tag({ removable: true })] }\n */\nfunction tag(\n props: { color?: ValueOrState<ThemeColor>; removable?: boolean } = {},\n): PartialElement {\n const { removable = false } = props;\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n dataTone: \"shift-2\",\n _onInit: (node) => {\n const removeBtn: DomphyElement<\"span\"> = {\n span: rawHtml(xSvg),\n onClick: (e) => {\n (e as Event).stopPropagation();\n node.remove();\n },\n tabindex: 0,\n role: \"button\",\n ariaLabel: \"Remove\",\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n cursor: \"pointer\",\n borderRadius: themeSpacing(1),\n width: themeSpacing(4),\n height: themeSpacing(4),\n flexShrink: 0,\n transition: \"background-color 140ms ease, box-shadow 140ms ease\",\n \"&:hover\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-4\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color.get(listener)),\n },\n },\n };\n\n removable && node.children.insert(removeBtn);\n },\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n whiteSpace: \"nowrap\",\n userSelect: \"none\",\n height: themeSpacing(6),\n paddingBlock: 0,\n borderRadius: themeSpacing(999),\n paddingInlineStart: themeSpacing(2.5),\n paddingInlineEnd: removable ? themeSpacing(1) : themeSpacing(2.5),\n gap: themeSpacing(1.5),\n fontSize: (listener) => themeSize(listener, \"decrease-1\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n },\n };\n}\n\nexport { tag };\n","import { merge, type PartialElement, toState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Command-palette container patch. Sets up a vertical flex column and provides a\n * shared `command` context (a query State) consumed by `commandSearch` and\n * `commandItem` descendants to filter the list. Typically applied to a `<div>`.\n *\n * @example { div: [...], $: [command()] }\n */\nfunction command(): PartialElement {\n return {\n _onSchedule: (_node, element) => {\n merge(element, {\n _context: {\n command: {\n query: toState(\"\"),\n },\n },\n });\n },\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n overflow: \"hidden\",\n },\n };\n}\n\n/**\n * Search input for a command palette. Wires the input's value into the parent\n * `command` context's query State so descendant `commandItem`s filter live.\n * Apply to an `<input>` element used inside a `command()`.\n *\n * @hostTag input\n * @param props.color - Base theme color tone. Defaults to \"neutral\".\n * @param props.accentColor - Accent color used for the focus border. Defaults to \"primary\".\n * @example { input: \"\", $: [commandSearch({ accentColor: \"primary\" })] }\n */\nfunction commandSearch(\n props: { color?: ThemeColor; accentColor?: ThemeColor } = {},\n): PartialElement {\n const { color = \"neutral\", accentColor = \"primary\" } = props;\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"commandSearch\" patch must use input tag`);\n }\n },\n _onMount: (node) => {\n const ctx = node.getContext(\"command\");\n if (!ctx) {\n console.warn(`\"commandSearch\" patch must be used inside a \"command\"`);\n return;\n }\n const input = node.domElement as HTMLInputElement;\n const onInput = () => ctx.query.set(input.value);\n input.addEventListener(\"input\", onInput);\n node.addHook(\"Remove\", () => input.removeEventListener(\"input\", onInput));\n },\n style: {\n fontFamily: \"inherit\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n border: \"none\",\n borderBottom: (listener) =>\n `1px solid ${themeColor(listener, \"border\", color)}`,\n outline: \"none\",\n color: (listener) => themeColor(listener, \"shift-10\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n \"&::placeholder\": {\n color: (listener) => themeColor(listener, \"shift-7\"),\n },\n transition: \"border-bottom-color 140ms ease, box-shadow 140ms ease\",\n \"&:focus-visible\": {\n borderBottomColor: (listener) =>\n themeColor(listener, \"shift-6\", accentColor),\n boxShadow: (listener) => focusRing(listener, accentColor),\n },\n },\n };\n}\n\n/**\n * Selectable item (`role=\"option\"`) in a command palette. On mount, immediately\n * hides itself if the current query doesn't match its text content, and subscribes\n * to future query changes — so items added dynamically after a search is typed are\n * correctly filtered. Typically applied to a `<button>` (or any clickable element)\n * used inside a `command()`.\n *\n * @param props.color - Base theme color tone. Defaults to \"neutral\".\n * @param props.accentColor - Accent color used for the focus ring. Defaults to \"primary\".\n * @example { button: \"Open file\", $: [commandItem({ color: \"neutral\" })] }\n */\nfunction commandItem(\n props: { color?: ThemeColor; accentColor?: ThemeColor } = {},\n): PartialElement {\n const { color = \"neutral\", accentColor = \"primary\" } = props;\n return {\n role: \"option\",\n _onMount: (node) => {\n const ctx = node.getContext(\"command\");\n if (!ctx) {\n console.warn(`\"commandItem\" patch must be used inside a \"command\"`);\n return;\n }\n const el = node.domElement as HTMLElement;\n const text = el.textContent?.toLowerCase() ?? \"\";\n const applyFilter = (q: string) => {\n el.hidden = q.length > 0 && !text.includes(q.toLowerCase());\n };\n applyFilter(ctx.query.get());\n const release = ctx.query.addListener(applyFilter);\n node.addHook(\"Remove\", release);\n },\n style: {\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n width: \"100%\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n border: \"none\",\n outline: \"none\",\n // shift-13: menu-row labels need ≥4.5:1 on light surface (visual catalog).\n color: (listener) => themeColor(listener, \"shift-13\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n transition: \"background-color 140ms ease, box-shadow 140ms ease\",\n \"&:hover:not([disabled])\": {\n color: (listener) => themeColor(listener, \"shift-13\", color),\n backgroundColor: (listener) => themeColor(listener, \"hover\", color),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor),\n },\n },\n };\n}\n\nexport { command, commandSearch, commandItem };\n","import {\n type DomphyElement,\n type ElementNode,\n type Listener,\n merge,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport type { Placement } from \"@domphy/floating\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { createFloating } from \"../utils/floating.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/** A single date selection, or a `[start, end]` tuple in range mode. */\nexport type DatePickerValue = Date | null | [Date | null, Date | null];\n\nexport interface DatePickerProps {\n /** Controlled value: a `Date` in single mode, a `[start, end]` tuple in range mode. */\n value?: ValueOrState<DatePickerValue>;\n /** Selection mode. */\n mode?: \"single\" | \"range\";\n /** Also pick hour + minute. The chosen time applies to the selected date(s). */\n time?: boolean;\n /** Earliest selectable day (inclusive). */\n min?: Date;\n /** Latest selectable day (inclusive). */\n max?: Date;\n /** Disable arbitrary days. */\n disabledDate?: (date: Date) => boolean;\n /** BCP-47 locale for month/weekday names, first-day-of-week, and formatting. */\n locale?: string;\n /** Override the first day of the week (0 = Sunday … 6 = Saturday). */\n weekStartsOn?: number;\n /** Override the input display string. */\n format?: (value: DatePickerValue) => string;\n /** Called whenever the selection changes. */\n onChange?: (value: DatePickerValue) => void;\n /** Accent color for the selected/active days. */\n accentColor?: ValueOrState<ThemeColor>;\n /** Popover placement relative to the input. */\n placement?: ValueOrState<Placement>;\n}\n\n// --- date helpers (no third-party library) -----------------------------------\n\nconst atMidnight = (date: Date): Date =>\n new Date(date.getFullYear(), date.getMonth(), date.getDate());\nconst addDays = (date: Date, count: number): Date =>\n new Date(date.getFullYear(), date.getMonth(), date.getDate() + count);\nconst addMonths = (date: Date, count: number): Date =>\n new Date(date.getFullYear(), date.getMonth() + count, date.getDate());\nconst sameDay = (a: Date | null, b: Date | null): boolean =>\n !!a &&\n !!b &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate();\nconst isoOf = (date: Date): string =>\n `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, \"0\")}-${String(\n date.getDate(),\n ).padStart(2, \"0\")}`;\nconst startOfWeek = (date: Date, weekStart: number): Date =>\n addDays(date, -((date.getDay() - weekStart + 7) % 7));\n\n/** Resolves the locale's first day of week, falling back to Sunday. */\nfunction localeWeekStart(locale: string): number {\n try {\n const localeObject = new Intl.Locale(locale) as Intl.Locale & {\n weekInfo?: { firstDay: number };\n getWeekInfo?: () => { firstDay: number };\n };\n const info = localeObject.getWeekInfo?.() ?? localeObject.weekInfo;\n if (info?.firstDay) return info.firstDay % 7; // Intl uses 1=Mon … 7=Sun\n } catch {\n // unsupported locale or engine — fall through to Sunday\n }\n return 0;\n}\n\n/**\n * A native, themeable date picker patch for an `<input>`. Opens a calendar\n * popover (rendered with Domphy elements, positioned via `@domphy/floating`)\n * supporting single/range selection, optional time, min/max + disabled days,\n * localized names, and keyboard navigation. The input is read-only and shows the\n * formatted selection; compose with `inputText()` for the input's look.\n *\n * @hostTag input\n * @param props.value - Controlled value (`ValueOrState<DatePickerValue>`): a `Date`/`null` in single mode, a `[start, end]` tuple in range mode.\n * @param props.mode - Selection mode, \"single\" | \"range\". Defaults to \"single\".\n * @param props.time - When true, also pick hour + minute (applied to the selected date(s)). Defaults to false.\n * @param props.min - Earliest selectable day (inclusive), a `Date`.\n * @param props.max - Latest selectable day (inclusive), a `Date`.\n * @param props.disabledDate - Predicate `(date: Date) => boolean` to disable arbitrary days.\n * @param props.locale - BCP-47 locale for names/first-day-of-week/formatting. Defaults to `navigator.language` (or \"en-US\" in non-browser).\n * @param props.weekStartsOn - Override first day of week (0 = Sunday … 6 = Saturday). Defaults to the locale's first day.\n * @param props.format - Override the input display string, `(value: DatePickerValue) => string`.\n * @param props.onChange - Called with the new value whenever the selection changes, `(value: DatePickerValue) => void`.\n * @param props.accentColor - Accent color (`ValueOrState<ThemeColor>`) for selected/active days. Defaults to \"primary\".\n * @param props.placement - Popover placement (`ValueOrState<Placement>`) relative to the input. Defaults to \"bottom-start\".\n * @example { input: \"\", $: [inputText(), datePicker({ mode: \"range\" })] }\n */\nfunction datePicker(props: DatePickerProps = {}): PartialElement {\n const {\n mode = \"single\",\n time = false,\n min,\n max,\n disabledDate,\n locale = typeof navigator !== \"undefined\" ? navigator.language : \"en-US\",\n format,\n onChange,\n } = props;\n\n const weekStart = props.weekStartsOn ?? localeWeekStart(locale);\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n const placeState = toState(props.placement ?? \"bottom-start\");\n\n const selection = toState<DatePickerValue>(\n props.value ?? (mode === \"range\" ? [null, null] : null),\n );\n const releaseOnChange = onChange\n ? selection.addListener((value) => onChange(value))\n : null;\n\n const primaryDate = ((): Date => {\n const current = selection.get();\n const base =\n mode === \"range\" ? (current as [Date | null, Date | null])?.[0] : current;\n return base instanceof Date ? base : new Date();\n })();\n\n const viewYear = toState(primaryDate.getFullYear(), \"viewYear\");\n const viewMonth = toState(primaryDate.getMonth(), \"viewMonth\");\n const focused = toState<Date>(atMidnight(primaryDate), \"focused\");\n const hovered = toState<Date | null>(null, \"hovered\");\n const hour = toState(primaryDate.getHours(), \"hour\");\n const minute = toState(primaryDate.getMinutes(), \"minute\");\n\n let contentElement: HTMLElement | null = null;\n\n // --- formatting -----------------------------------------------------------\n const dateFormatter = new Intl.DateTimeFormat(locale, {\n dateStyle: \"medium\",\n ...(time ? { timeStyle: \"short\" as const } : {}),\n });\n const monthFormatter = new Intl.DateTimeFormat(locale, {\n month: \"long\",\n year: \"numeric\",\n });\n const weekdayFormatter = new Intl.DateTimeFormat(locale, {\n weekday: \"short\",\n });\n const fullDateFormatter = new Intl.DateTimeFormat(locale, {\n dateStyle: \"full\",\n });\n\n const formatOne = (date: Date | null): string =>\n date ? dateFormatter.format(date) : \"\";\n const formatDisplay = (value: DatePickerValue): string => {\n if (format) return format(value);\n if (mode === \"range\") {\n const [start, end] = (value as [Date | null, Date | null]) ?? [\n null,\n null,\n ];\n return start ? `${formatOne(start)} – ${formatOne(end)}` : \"\";\n }\n return formatOne(value as Date | null);\n };\n\n // 2023-01-01 is a Sunday, so index 0 maps to Sunday before the week-start shift.\n const weekdayNames = Array.from({ length: 7 }, (_unused, index) =>\n weekdayFormatter.format(new Date(2023, 0, 1 + ((index + weekStart) % 7))),\n );\n\n // --- selection logic ------------------------------------------------------\n const isDisabled = (date: Date): boolean =>\n (!!min && atMidnight(date) < atMidnight(min)) ||\n (!!max && atMidnight(date) > atMidnight(max)) ||\n (!!disabledDate && disabledDate(date));\n\n const withTime = (date: Date): Date => {\n if (!time) return atMidnight(date);\n const result = atMidnight(date);\n result.setHours(hour.get(), minute.get(), 0, 0);\n return result;\n };\n\n const selectDate = (date: Date): void => {\n if (isDisabled(date)) return;\n if (mode === \"single\") {\n selection.set(withTime(date));\n if (!time) instantHideRef();\n return;\n }\n const [start, end] = (selection.get() as [Date | null, Date | null]) ?? [\n null,\n null,\n ];\n if (!start || (start && end)) {\n selection.set([withTime(date), null]);\n } else if (atMidnight(date) < atMidnight(start)) {\n selection.set([withTime(date), withTime(start)]);\n if (!time) instantHideRef();\n } else {\n selection.set([start, withTime(date)]);\n if (!time) instantHideRef();\n }\n };\n\n const reapplyTime = (): void => {\n if (!time) return;\n if (mode === \"single\") {\n const current = selection.get() as Date | null;\n if (current) selection.set(withTime(current));\n } else {\n const [start, end] = (selection.get() as [Date | null, Date | null]) ?? [\n null,\n null,\n ];\n selection.set([\n start ? withTime(start) : start,\n end ? withTime(end) : end,\n ]);\n }\n };\n\n const inSelectedRange = (date: Date, listener?: Listener): boolean => {\n if (mode !== \"range\") return false;\n const [start, end] = (selection.get(listener) as [\n Date | null,\n Date | null,\n ]) ?? [null, null];\n const tail = end ?? hovered.get(listener);\n if (!start || !tail) return false;\n const low = atMidnight(start) <= atMidnight(tail) ? start : tail;\n const high = atMidnight(start) <= atMidnight(tail) ? tail : start;\n const day = atMidnight(date);\n return day >= atMidnight(low) && day <= atMidnight(high);\n };\n\n const isSelectedEnd = (date: Date, listener?: Listener): boolean => {\n const current = selection.get(listener);\n if (mode === \"range\") {\n const [start, end] = (current as [Date | null, Date | null]) ?? [\n null,\n null,\n ];\n return sameDay(date, start) || sameDay(date, end);\n }\n return sameDay(date, current as Date | null);\n };\n\n // --- view navigation ------------------------------------------------------\n const goToDate = (date: Date): void => {\n viewYear.set(date.getFullYear());\n viewMonth.set(date.getMonth());\n };\n const shiftMonth = (delta: number): void => {\n const next = addMonths(new Date(viewYear.get(), viewMonth.get(), 1), delta);\n goToDate(next);\n };\n const shiftYear = (delta: number): void =>\n viewYear.set(viewYear.get() + delta);\n\n const focusActiveCell = (): void => {\n setTimeout(() => {\n contentElement\n ?.querySelector<HTMLElement>(`[data-date=\"${isoOf(focused.get())}\"]`)\n ?.focus();\n }, 0);\n };\n\n // --- floating popover ------------------------------------------------------\n const calendar = buildCalendar();\n const { show, hide, anchorPartial } = createFloating({\n kind: \"datePicker\",\n open: false,\n placement: placeState,\n content: calendar,\n });\n // selectDate calls this before `createFloating` returns `hide`, so route through a ref.\n function instantHideRef(): void {\n hide();\n }\n\n // Move focus into the grid when the popover opens.\n anchorPartial.onClick = () => {};\n const triggerPartial: PartialElement = {\n type: \"text\",\n readonly: true,\n value: (listener) => formatDisplay(selection.get(listener)),\n ariaHaspopup: \"dialog\",\n ariaLabel: \"Choose date\",\n style: { cursor: \"pointer\" },\n onClick: (_e, node) => {\n openAndFocus(node);\n },\n onFocus: (_e, node) => {\n openAndFocus(node);\n },\n onKeyDown: (event, node) => {\n const key = (event as KeyboardEvent).key;\n if (key === \"ArrowDown\" || key === \"Enter\") {\n event.preventDefault();\n openAndFocus(node);\n }\n },\n _onMount: (node) =>\n releaseOnChange &&\n node.addHook(\"Remove\", () => {\n releaseOnChange();\n }),\n };\n function openAndFocus(node?: ElementNode): void {\n const current = isSelectedPrimary() ?? new Date();\n focused.set(atMidnight(current));\n goToDate(current);\n show(node);\n focusActiveCell();\n }\n function isSelectedPrimary(): Date | null {\n const current = selection.get();\n if (mode === \"range\")\n return (current as [Date | null, Date | null])?.[0] ?? null;\n return (current as Date | null) ?? null;\n }\n merge(anchorPartial, triggerPartial);\n return anchorPartial;\n\n // --- calendar builder -----------------------------------------------------\n function buildCalendar(): DomphyElement<\"div\"> {\n const navButton = (label: string, ariaLabel: string, onClick: () => void) =>\n ({\n button: label,\n type: \"button\",\n ariaLabel,\n onClick,\n style: navButtonStyle(),\n }) as DomphyElement;\n\n const header: DomphyElement<\"div\"> = {\n div: [\n navButton(\"«\", \"Previous year\", () => shiftYear(-1)),\n navButton(\"‹\", \"Previous month\", () => shiftMonth(-1)),\n {\n div: (listener) =>\n monthFormatter.format(\n new Date(viewYear.get(listener), viewMonth.get(listener), 1),\n ),\n ariaLive: \"polite\",\n style: {\n flex: \"1\",\n textAlign: \"center\",\n fontWeight: \"bold\",\n fontSize: (listener) => themeSize(listener),\n },\n },\n navButton(\"›\", \"Next month\", () => shiftMonth(1)),\n navButton(\"»\", \"Next year\", () => shiftYear(1)),\n ],\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: themeSpacing(1),\n marginBottom: themeSpacing(2),\n },\n };\n\n const weekdayHeader: DomphyElement<\"div\"> = {\n div: weekdayNames.map((name, index) => ({\n div: name,\n style: {\n textAlign: \"center\",\n fontSize: (listener) => themeSize(listener, \"decrease-1\"),\n fontWeight: \"bold\",\n color: (listener) => themeColor(listener, \"shift-7\"),\n paddingBlock: themeSpacing(1),\n },\n _key: index,\n })),\n role: \"row\",\n style: gridRowStyle(),\n };\n\n const grid: DomphyElement<\"div\"> = {\n div: (listener) => buildWeeks(listener),\n role: \"grid\",\n ariaLabel: \"Calendar\",\n onKeyDown: onGridKey,\n onMouseLeave: () => mode === \"range\" && hovered.set(null),\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: themeSpacing(0.5),\n },\n };\n\n const children: DomphyElement[] = [header, weekdayHeader, grid];\n if (time) children.push(buildTimeRow());\n children.push(buildFooter());\n\n return {\n div: children,\n role: \"dialog\",\n ariaModal: \"false\",\n _onMount: (node) => {\n contentElement = node.domElement as HTMLElement;\n },\n style: {\n minWidth: themeSpacing(70),\n padding: themeSpacing(3),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n backgroundColor: (listener) => themeColor(listener, \"base\"),\n color: (listener) => themeColor(listener, \"shift-10\"),\n border: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\")}`,\n boxShadow: elevation(\"medium\"),\n },\n };\n }\n\n function buildWeeks(listener: Listener): DomphyElement[] {\n const first = new Date(viewYear.get(listener), viewMonth.get(listener), 1);\n const month = viewMonth.get(listener);\n const start = startOfWeek(first, weekStart);\n const weeks: DomphyElement[] = [];\n for (let week = 0; week < 6; week++) {\n const cells: DomphyElement[] = [];\n for (let day = 0; day < 7; day++) {\n const date = addDays(start, week * 7 + day);\n cells.push(buildDayCell(date, month, listener));\n }\n weeks.push({\n div: cells,\n role: \"row\",\n style: gridRowStyle(),\n _key: week,\n });\n }\n return weeks;\n }\n\n function buildDayCell(\n date: Date,\n month: number,\n listener: Listener,\n ): DomphyElement {\n const disabled = isDisabled(date);\n const selected = isSelectedEnd(date, listener);\n const within = inSelectedRange(date, listener);\n const outside = date.getMonth() !== month;\n const isFocused = sameDay(date, focused.get(listener));\n const isToday = sameDay(date, new Date());\n\n return {\n button: String(date.getDate()),\n type: \"button\",\n role: \"gridcell\",\n tabIndex: isFocused ? 0 : -1,\n ariaSelected: selected,\n ariaDisabled: disabled,\n disabled,\n ariaLabel: fullDateFormatter.format(date),\n dataDate: isoOf(date),\n onClick: () => selectDate(date),\n onMouseEnter: () => mode === \"range\" && hovered.set(date),\n style: {\n appearance: \"none\",\n border: \"none\",\n cursor: disabled ? \"not-allowed\" : \"pointer\",\n aspectRatio: \"1\",\n borderRadius: themeSpacing(1),\n fontSize: (l: Listener) => themeSize(l),\n fontFamily: \"inherit\",\n opacity: disabled ? 0.35 : outside ? 0.5 : 1,\n backgroundColor: (l: Listener) =>\n selected\n ? themeColor(l, \"shift-7\", accentColor.get(l))\n : within\n ? themeColor(l, \"hover\", accentColor.get(l))\n : \"transparent\",\n color: (l: Listener) =>\n selected\n ? themeColor(l, \"shift-0\", accentColor.get(l))\n : themeColor(l, \"text\"),\n outline: isToday\n ? (l: Listener) =>\n `1px solid ${themeColor(l, \"shift-6\", accentColor.get(l))}`\n : \"none\",\n outlineOffset: \"-2px\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (l: Listener) =>\n selected\n ? themeColor(l, \"shift-7\", accentColor.get(l))\n : themeColor(l, \"shift-3\", accentColor.get(l)),\n },\n transition: \"background-color 140ms ease, box-shadow 140ms ease\",\n \"&:focus-visible\": {\n boxShadow: (l: Listener) => focusRing(l, accentColor.get(l)),\n },\n },\n _key: isoOf(date),\n } as DomphyElement;\n }\n\n function buildTimeRow(): DomphyElement<\"div\"> {\n const numberSelect = (\n count: number,\n state: ReturnType<typeof toState<number>>,\n ariaLabel: string,\n ): DomphyElement => ({\n select: Array.from({ length: count }, (_unused, value) => ({\n option: String(value).padStart(2, \"0\"),\n value: String(value),\n selected: (listener) => state.get(listener) === value,\n _key: value,\n })) as DomphyElement[],\n ariaLabel,\n onChange: (event) => {\n state.set(Number((event.target as HTMLSelectElement).value));\n reapplyTime();\n },\n style: timeSelectStyle(),\n });\n\n return {\n div: [\n numberSelect(24, hour, \"Hour\"),\n { span: \":\", style: { fontWeight: \"bold\" } },\n numberSelect(60, minute, \"Minute\"),\n ],\n style: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: themeSpacing(1),\n marginTop: themeSpacing(3),\n },\n };\n }\n\n function buildFooter(): DomphyElement<\"div\"> {\n const action = (label: string, onClick: () => void): DomphyElement => ({\n button: label,\n type: \"button\",\n onClick,\n style: {\n appearance: \"none\",\n border: \"none\",\n background: \"transparent\",\n cursor: \"pointer\",\n fontFamily: \"inherit\",\n fontSize: (l: Listener) => themeSize(l, \"decrease-1\"),\n color: (l: Listener) => themeColor(l, \"muted\", accentColor.get(l)),\n padding: themeSpacing(1),\n },\n });\n return {\n div: [\n action(\"Today\", () => {\n const today = new Date();\n focused.set(atMidnight(today));\n goToDate(today);\n focusActiveCell();\n }),\n action(\"Clear\", () => {\n selection.set(mode === \"range\" ? [null, null] : null);\n hovered.set(null);\n }),\n ],\n style: {\n display: \"flex\",\n justifyContent: \"space-between\",\n marginTop: themeSpacing(2),\n paddingTop: themeSpacing(2),\n borderTop: (l: Listener) => `1px solid ${themeColor(l, \"border\")}`,\n },\n };\n }\n\n function onGridKey(event: Event): void {\n const keyboard = event as KeyboardEvent;\n const current = focused.get();\n let next: Date | null = null;\n switch (keyboard.key) {\n case \"ArrowLeft\":\n next = addDays(current, -1);\n break;\n case \"ArrowRight\":\n next = addDays(current, 1);\n break;\n case \"ArrowUp\":\n next = addDays(current, -7);\n break;\n case \"ArrowDown\":\n next = addDays(current, 7);\n break;\n case \"Home\":\n next = startOfWeek(current, weekStart);\n break;\n case \"End\":\n next = addDays(startOfWeek(current, weekStart), 6);\n break;\n case \"PageUp\":\n next = addMonths(current, keyboard.shiftKey ? -12 : -1);\n break;\n case \"PageDown\":\n next = addMonths(current, keyboard.shiftKey ? 12 : 1);\n break;\n case \"Enter\":\n case \" \":\n keyboard.preventDefault();\n selectDate(current);\n return;\n default:\n return;\n }\n keyboard.preventDefault();\n focused.set(next);\n goToDate(next);\n focusActiveCell();\n }\n}\n\n// --- shared style fragments --------------------------------------------------\n\nfunction gridRowStyle() {\n return {\n display: \"grid\",\n gridTemplateColumns: \"repeat(7, 1fr)\",\n gap: themeSpacing(0.5),\n };\n}\n\nfunction navButtonStyle() {\n return {\n appearance: \"none\" as const,\n border: \"none\",\n background: \"transparent\",\n cursor: \"pointer\",\n fontFamily: \"inherit\",\n fontSize: (l: Listener) => themeSize(l),\n color: (l: Listener) => themeColor(l, \"muted\"),\n width: themeSpacing(7),\n height: themeSpacing(7),\n borderRadius: themeSpacing(1),\n \"&:hover\": {\n backgroundColor: (l: Listener) => themeColor(l, \"shift-3\"),\n },\n };\n}\n\nfunction timeSelectStyle() {\n return {\n fontFamily: \"inherit\",\n fontSize: (l: Listener) => themeSize(l),\n padding: themeSpacing(1),\n borderRadius: themeSpacing(1),\n border: (l: Listener) => `1px solid ${themeColor(l, \"border-strong\")}`,\n backgroundColor: (l: Listener) => themeColor(l, \"base\"),\n color: (l: Listener) => themeColor(l, \"text\"),\n };\n}\n\nexport { datePicker };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles a description list as a two-column grid (terms in the first column,\n * descriptions in the second), theming the nested `<dt>`/`<dd>` elements.\n * Apply to a `<dl>` element.\n *\n * @hostTag dl\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for the term/description text. Defaults to \"neutral\".\n * @example { dl: [{ dt: \"Name\" }, { dd: \"Domphy\" }], $: [descriptionList()] }\n */\nfunction descriptionList(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"dl\") {\n console.warn(`\"descriptionList\" primitive patch must use dl tag`);\n }\n },\n // Term weight is design-system chrome for description lists.\n _doctorDisable: \"inline-typography\",\n style: {\n display: \"grid\",\n gridTemplateColumns: `minmax(${themeSpacing(24)}, max-content) 1fr`,\n columnGap: themeSpacing(4),\n margin: 0,\n \"& dt\": {\n margin: 0,\n fontWeight: 600,\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n },\n \"& dd\": {\n margin: 0,\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n },\n };\n}\n\nexport { descriptionList };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a native disclosure widget: a themed `<summary>` header with an\n * animated rotating chevron and an expand/collapse transition on the body\n * content. Apply to a `<details>` element.\n *\n * @hostTag details\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for the body/summary. Defaults to \"neutral\".\n * @param props.accentColor - Accent color (`ValueOrState<ThemeColor>`) for the summary's focus ring. Defaults to \"primary\".\n * @param props.duration - Open/close transition duration in milliseconds. Defaults to 240.\n * @example { details: [{ summary: \"More\" }, { div: \"Body\" }], $: [details()] }\n */\nfunction details(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n duration?: number;\n } = {},\n): PartialElement {\n const { duration = 240 } = props;\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"details\") {\n console.warn(`\"details\" primitive patch must use details tag`);\n }\n },\n // Summary weight is design-system chrome for disclosure headers.\n _doctorDisable: \"inline-typography\",\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n\n overflow: \"hidden\",\n \"& > summary\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", color.get(listener)),\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n listStyle: \"none\",\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n gap: themeSpacing(2),\n cursor: \"pointer\",\n userSelect: \"none\",\n fontWeight: 500,\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n height: themeSpacing(10),\n },\n \"& > summary::-webkit-details-marker\": {\n display: \"none\",\n },\n \"& > summary::marker\": {\n content: `\"\"`,\n },\n \"& > summary::after\": {\n content: `\"\"`,\n width: themeSpacing(2),\n height: themeSpacing(2),\n flexShrink: 0,\n marginTop: themeSpacing(-0.5),\n borderInlineEnd: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-9\", color.get(listener))}`,\n borderBottom: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-9\", color.get(listener))}`,\n transform: \"rotate(45deg)\",\n transition: `transform ${duration}ms ease`,\n },\n \"&[open] > summary::after\": {\n transform: \"rotate(-135deg)\",\n },\n \"& > summary:hover\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-3\", color.get(listener)),\n },\n \"& > summary:focus-visible\": {\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"& > :not(summary)\": {\n maxHeight: 0,\n opacity: 0,\n overflow: \"hidden\",\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingTop: 0,\n paddingBottom: 0,\n transition: `max-height ${duration}ms ease, opacity ${duration}ms ease, padding ${duration}ms ease`,\n },\n \"&[open] > :not(summary)\": {\n maxHeight: themeSpacing(250),\n opacity: 1,\n paddingTop: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingBottom: (listener) => themeSpacing(themeDensity(listener) * 3),\n },\n },\n };\n}\n\nexport { details };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { lockScroll, unlockScroll } from \"../utils/scrollLock.js\";\n\nconst FOCUSABLE =\n 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), details, [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * Modal dialog patch driven by an `open` State. Calls `showModal()`/`close()`,\n * fades via opacity, locks page scroll while open, traps Tab focus within the\n * dialog, restores focus to the previously focused element on close, sets\n * `aria-modal`, and closes on outside (backdrop) click. Apply to a `<dialog>`.\n *\n * @hostTag dialog\n * @param props.color - Theme color tone for the dialog surface. Defaults to \"neutral\".\n * @param props.open - Open state (`ValueOrState<boolean>`); set it to true/false to show/hide. Defaults to false.\n * @example { dialog: [...], $: [dialog({ open })] }\n */\nfunction dialog(\n props: { color?: ThemeColor; open?: ValueOrState<boolean> } = {},\n): PartialElement {\n const { color = \"neutral\", open = false } = props;\n const state = toState(open);\n let previousFocus: HTMLElement | null = null;\n let closing = false;\n let scrollLocked = false;\n\n const finalizeClose = (dlg: HTMLDialogElement) => {\n closing = false;\n // Guard for environments with HTMLDialogElement but no close()\n // implementation (e.g. jsdom in tests).\n if (typeof dlg.close === \"function\") dlg.close();\n // visibility/pointer-events (not just opacity) must reflect the closed\n // state: opacity alone leaves a closed dialog's content fully reachable\n // by Tab and exposed to the accessibility tree (opacity, unlike\n // visibility, never removes an element from either) — and a consumer\n // that sets its own `style: { display: ... }` on the dialog (a common\n // pattern for centering content) overrides the UA stylesheet's\n // `dialog:not([open]) { display: none }`, so `dlg.close()` alone doesn't\n // reliably hide it either. Set INLINE so it always wins regardless of\n // what the consumer's own style object declares.\n dlg.style.visibility = \"hidden\";\n dlg.style.pointerEvents = \"none\";\n if (scrollLocked) {\n unlockScroll();\n scrollLocked = false;\n }\n previousFocus?.focus();\n previousFocus = null;\n };\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"dialog\") {\n console.warn(`\"dialog\" primitive patch must use dialog tag`);\n }\n },\n onClick: (e: MouseEvent, node) => {\n if (e.target !== node.domElement) return;\n const r = node.domElement!.getBoundingClientRect();\n const inside =\n e.clientX >= r.left &&\n e.clientX <= r.right &&\n e.clientY >= r.top &&\n e.clientY <= r.bottom;\n if (!inside) state.set(false);\n },\n onTransitionEnd: (e, node) => {\n if (!closing) return;\n // Guard against bubbled transitionend from nested content (e.g. an\n // accordion/details transition inside the dialog) prematurely\n // triggering close-finalization.\n if (e.target !== node.domElement) return;\n if (e.propertyName !== \"opacity\") return;\n finalizeClose(node.domElement as HTMLDialogElement);\n },\n _onMount: (node) => {\n const dlg = node.domElement as HTMLDialogElement;\n dlg.setAttribute(\"aria-modal\", \"true\");\n let closeTimer: ReturnType<typeof setTimeout> | null = null;\n\n const trapFocus = (e: KeyboardEvent) => {\n if (e.key !== \"Tab\") return;\n const focusables = Array.from(\n dlg.querySelectorAll<HTMLElement>(FOCUSABLE),\n ).filter(\n (el) =>\n !el.closest(\"[aria-hidden='true']\") && el.offsetParent !== null,\n );\n if (!focusables.length) {\n e.preventDefault();\n return;\n }\n const first = focusables[0];\n const last = focusables[focusables.length - 1];\n if (e.shiftKey) {\n if (\n document.activeElement === first ||\n document.activeElement === dlg\n ) {\n e.preventDefault();\n last.focus();\n }\n } else {\n if (document.activeElement === last) {\n e.preventDefault();\n first.focus();\n }\n }\n };\n\n const onCancel = (e: Event) => {\n e.preventDefault();\n state.set(false);\n };\n dlg.addEventListener(\"cancel\", onCancel);\n\n const update = (val: boolean) => {\n if (val) {\n previousFocus = document.activeElement as HTMLElement;\n dlg.style.visibility = \"visible\";\n dlg.style.pointerEvents = \"auto\";\n // Guard for environments with HTMLDialogElement but no showModal()\n // implementation (e.g. jsdom in tests).\n if (typeof dlg.showModal === \"function\") dlg.showModal();\n if (!scrollLocked) {\n lockScroll();\n scrollLocked = true;\n }\n dlg.addEventListener(\"keydown\", trapFocus);\n requestAnimationFrame(() => {\n dlg.style.opacity = \"1\";\n const focusable = dlg.querySelector<HTMLElement>(FOCUSABLE);\n focusable?.focus();\n });\n } else {\n closing = true;\n dlg.style.opacity = \"0\";\n dlg.removeEventListener(\"keydown\", trapFocus);\n // Fallback: if transitionend never fires (reduced-motion, display:none),\n // unblock close after the transition duration + buffer.\n closeTimer = setTimeout(() => {\n closeTimer = null;\n if (!closing) return;\n finalizeClose(dlg);\n }, 350);\n }\n };\n update(state.get());\n const release = state.addListener(update);\n node.addHook(\"Remove\", () => {\n if (closeTimer) {\n clearTimeout(closeTimer);\n closeTimer = null;\n }\n release();\n dlg.removeEventListener(\"cancel\", onCancel);\n if (scrollLocked) {\n unlockScroll();\n scrollLocked = false;\n }\n dlg.removeEventListener(\"keydown\", trapFocus);\n previousFocus?.focus();\n previousFocus = null;\n });\n },\n style: {\n opacity: \"0\",\n // Matches finalizeClose's inline defaults — a dialog that mounts\n // already-closed (the common case: `open` defaults to false) must\n // start out of the tab order/accessibility tree from first paint, not\n // just after its first open->close cycle runs finalizeClose.\n visibility: \"hidden\",\n pointerEvents: \"none\",\n transition: \"opacity 200ms ease\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"shift-10\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n border: \"none\",\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n padding: (listener) => themeSpacing(themeDensity(listener) * 3),\n boxShadow: elevation(\"high\"),\n \"&::backdrop\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n opacity: 0.75,\n },\n },\n };\n}\n\nexport { dialog };\n","// Shared page-scroll lock for modal-like patches (dialog, drawer). A\n// module-level counter (not a plain boolean) is required because two\n// overlays can be open at once (e.g. a dialog opened from within a drawer);\n// without a counter, closing the inner one would clear `overflow` while the\n// outer one is still open.\nlet lockCount = 0;\n\nfunction lockScroll(): void {\n lockCount++;\n if (lockCount === 1) document.body.style.overflow = \"hidden\";\n}\n\nfunction unlockScroll(): void {\n lockCount = Math.max(0, lockCount - 1);\n if (lockCount === 0) document.body.style.overflow = \"\";\n}\n\n// Test-only: reset the module-level counter so a test that unmounts its tree\n// via `document.body.innerHTML = \"\"` (skipping the Remove hook / unlockScroll\n// call) doesn't leak a locked count into the next test.\nfunction _resetScrollLock(): void {\n lockCount = 0;\n}\n\nexport { lockScroll, unlockScroll, _resetScrollLock };\n","import type { PartialElement } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * A horizontal separator (`role=\"separator\"`) with a line on each side of its\n * content, suitable for labelled dividers (\"or\"). Apply to a `<div>` element.\n *\n * @hostTag div\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for the label text and rules. Defaults to \"neutral\".\n * @example { div: \"or\", $: [divider()] }\n */\nfunction divider(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n role: \"separator\",\n _onInsert: (node) => {\n if (node.tagName !== \"div\") {\n console.warn(`\"divider\" patch should be used with <div>`);\n }\n },\n style: {\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"baseline\",\n gap: themeSpacing(2),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) => themeColor(listener),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n minHeight: \"1lh\",\n \"&::before\": {\n content: `\"\"`,\n flex: 1,\n borderColor: (listener) =>\n themeColor(listener, \"border-strong\", color.get(listener)),\n borderWidth: \"1px\",\n borderBottomStyle: \"solid\",\n },\n \"&::after\": {\n content: `\"\"`,\n flex: 1,\n borderColor: (listener) =>\n themeColor(listener, \"border-strong\", color.get(listener)),\n borderWidth: \"1px\",\n borderBottomStyle: \"solid\",\n },\n },\n };\n}\n\nexport { divider };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { lockScroll, unlockScroll } from \"../utils/scrollLock.js\";\n\ntype PhysicalPlacement = \"left\" | \"right\" | \"top\" | \"bottom\";\ntype Placement = PhysicalPlacement | \"start\" | \"end\";\n\nconst translateOut: Record<PhysicalPlacement, string> = {\n left: \"translateX(-100%)\",\n right: \"translateX(100%)\",\n top: \"translateY(-100%)\",\n bottom: \"translateY(100%)\",\n};\n\nconst marginMap: Record<PhysicalPlacement, string> = {\n left: \"0 auto 0 0\",\n right: \"0 0 0 auto\",\n top: \"0 0 auto 0\",\n bottom: \"auto 0 0 0\",\n};\n\nconst isVertical = (p: PhysicalPlacement) => p === \"left\" || p === \"right\";\n\nfunction resolvePhysical(\n placement: Placement,\n isRTL: boolean,\n): PhysicalPlacement {\n if (placement === \"start\") return isRTL ? \"right\" : \"left\";\n if (placement === \"end\") return isRTL ? \"left\" : \"right\";\n return placement;\n}\n\n/**\n * Edge-anchored modal drawer driven by an `open` State. Slides in/out from a\n * chosen edge via a 250 ms transform transition, calls `showModal()`/`close()`,\n * locks page scroll while open, and closes on backdrop click. A 350 ms fallback\n * ensures `close()` is always called even when `transitionend` doesn't fire\n * (reduced-motion, `display:none`, detached element). Apply to a `<dialog>`.\n *\n * Because the patch uses the native `<dialog>` `showModal()` API, the browser\n * traps focus inside the drawer while it is open and restores focus to the\n * previously focused element when `close()` is called. Sets `aria-modal=\"true\"`.\n * Escape key closes the drawer via the animated state path (not immediate close).\n *\n * `\"start\"` and `\"end\"` placements resolve to left/right based on the\n * document's `dir` attribute at mount time, enabling RTL-aware drawers:\n * `\"start\"` → left (LTR) / right (RTL); `\"end\"` → right (LTR) / left (RTL).\n *\n * @hostTag dialog\n * @param props.color - Theme color tone for the drawer surface. Defaults to \"neutral\".\n * @param props.open - Open state (`ValueOrState<boolean>`); set true/false to show/hide. Defaults to false.\n * @param props.placement - Edge to anchor to. \"left\" | \"right\" | \"top\" | \"bottom\" | \"start\" | \"end\". Defaults to \"end\".\n * @param props.size - CSS length for the drawer's width (left/right/start/end) or height (top/bottom). Defaults to themeSpacing(80) for left/right, themeSpacing(64) for top/bottom.\n * @example { dialog: [...], $: [drawer({ open, placement: \"start\" })] }\n */\nfunction drawer(\n props: {\n color?: ThemeColor;\n open?: ValueOrState<boolean>;\n placement?: Placement;\n size?: string;\n } = {},\n): PartialElement {\n const { color = \"neutral\", open = false, placement = \"end\", size } = props;\n const state = toState(open);\n const isLogical = placement === \"start\" || placement === \"end\";\n\n // For static rendering / SSR assume LTR as fallback; corrected at mount time.\n const physicalFallback = resolvePhysical(placement, false);\n const defaultSize = isVertical(physicalFallback)\n ? themeSpacing(80)\n : themeSpacing(64);\n const drawerSize = size ?? defaultSize;\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"dialog\") {\n console.warn(`\"drawer\" patch must use dialog tag`);\n }\n },\n onClick: (e: MouseEvent, node) => {\n if (e.target !== node.domElement) return;\n state.set(false);\n },\n _onMount: (node) => {\n const dlg = node.domElement as HTMLDialogElement;\n dlg.setAttribute(\"aria-modal\", \"true\");\n\n const onCancel = (e: Event) => {\n e.preventDefault();\n state.set(false);\n };\n dlg.addEventListener(\"cancel\", onCancel);\n\n // Resolve logical placements at mount time using document direction.\n const isRTL =\n isLogical &&\n (dlg.ownerDocument.documentElement.dir === \"rtl\" ||\n dlg.ownerDocument.dir === \"rtl\");\n const physical = resolvePhysical(placement, isRTL);\n\n // Correct initial styles for logical placements whose physical direction\n // may differ from the LTR fallback used in the static style block.\n if (isLogical) {\n dlg.style.transform = translateOut[physical];\n dlg.style.margin = marginMap[physical];\n dlg.style.width = isVertical(physical) ? drawerSize : \"100dvw\";\n dlg.style.height = isVertical(physical) ? \"100dvh\" : drawerSize;\n }\n\n let closing = false;\n let scrollLocked = false;\n let closeTimer: ReturnType<typeof setTimeout> | null = null;\n const finishClose = () => {\n closeTimer = null;\n if (!closing) return;\n closing = false;\n // Guard for environments with HTMLDialogElement but no close()\n // implementation (e.g. jsdom in tests).\n if (typeof dlg.close === \"function\") dlg.close();\n // Same fix as dialog.ts: the closed state was only ever represented\n // by an off-screen `transform`, never visibility/pointer-events — a\n // closed drawer stayed fully reachable by Tab and exposed to the\n // accessibility tree (a CSS transform, like opacity, does neither),\n // and a consumer's own `style: { display: ... }` overrides the UA\n // stylesheet's `dialog:not([open])` rule anyway. Set INLINE so it\n // always wins.\n dlg.style.visibility = \"hidden\";\n dlg.style.pointerEvents = \"none\";\n if (scrollLocked) {\n unlockScroll();\n scrollLocked = false;\n }\n };\n\n const onTransitionEnd = (e: Event) => {\n if (e.target !== dlg) return;\n if ((e as TransitionEvent).propertyName !== \"transform\") return;\n finishClose();\n };\n dlg.addEventListener(\"transitionend\", onTransitionEnd);\n\n const update = (val: boolean) => {\n if (val) {\n closing = false;\n dlg.style.visibility = \"visible\";\n dlg.style.pointerEvents = \"auto\";\n // Guard for environments with HTMLDialogElement but no showModal()\n // implementation (e.g. jsdom in tests).\n if (typeof dlg.showModal === \"function\") dlg.showModal();\n if (!scrollLocked) {\n lockScroll();\n scrollLocked = true;\n }\n requestAnimationFrame(() => {\n dlg.style.transform = \"translate(0, 0)\";\n });\n } else {\n closing = true;\n dlg.style.transform = translateOut[physical];\n closeTimer = setTimeout(finishClose, 350);\n }\n };\n update(state.get());\n const release = state.addListener(update);\n node.addHook(\"Remove\", () => {\n if (closeTimer) {\n clearTimeout(closeTimer);\n closeTimer = null;\n }\n release();\n dlg.removeEventListener(\"cancel\", onCancel);\n dlg.removeEventListener(\"transitionend\", onTransitionEnd);\n if (scrollLocked) {\n unlockScroll();\n scrollLocked = false;\n }\n });\n },\n style: {\n transform: translateOut[physicalFallback],\n // Matches finishClose's inline defaults — a drawer that mounts\n // already-closed (the common case) must start out of the tab\n // order/accessibility tree from first paint, not just after its first\n // open->close cycle runs finishClose.\n visibility: \"hidden\",\n pointerEvents: \"none\",\n transition: \"transform 0.25s ease\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"shift-10\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n border: \"none\",\n padding: (listener) => themeSpacing(themeDensity(listener) * 3),\n margin: marginMap[physicalFallback],\n width: isVertical(physicalFallback) ? drawerSize : \"100dvw\",\n height: isVertical(physicalFallback) ? \"100dvh\" : drawerSize,\n maxWidth: \"100dvw\",\n maxHeight: \"100dvh\",\n boxShadow: elevation(\"high\"),\n \"&::backdrop\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n opacity: 0.75,\n },\n },\n };\n}\n\nexport { drawer };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSize } from \"@domphy/theme\";\n\n/**\n * Italic emphasized inline text. Apply to an `<em>` element.\n *\n * @hostTag em\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for the text. Defaults to \"neutral\".\n * @example { em: \"important\", $: [emphasis()] }\n */\nfunction emphasis(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"em\") {\n console.warn(`\"emphasis\" primitive patch must use em tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n fontStyle: \"italic\",\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n },\n };\n}\n\nexport { emphasis };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\n\n/**\n * Styles a container as an empty-state placeholder: centered flex column with\n * muted coloring and comfortable padding. Provide the icon, title, and\n * description as child elements.\n *\n * @param props.color - Theme color tone for the muted text/icon. Defaults to `\"neutral\"`.\n * @example\n * { div: [\n * { span: \"📭\" },\n * { p: \"No items yet\", $: [paragraph()] },\n * { span: \"Add your first item to get started\", $: [small()] },\n * ], $: [empty()] }\n */\nfunction empty(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: themeSpacing(3),\n paddingBlock: themeSpacing(12),\n paddingInline: themeSpacing(6),\n textAlign: \"center\",\n // Body / description text sits in the muted zone.\n color: (listener) => themeColor(listener, \"muted\", color.get(listener)),\n // Icon area: slightly softer so it recedes behind the title.\n \"& > :first-child\": {\n color: (listener) =>\n themeColor(listener, \"shift-5\", color.get(listener)),\n opacity: 0.9,\n },\n // Title (typically second child): stronger body text for hierarchy.\n \"& > :nth-child(2)\": {\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n },\n };\n}\n\nexport { empty };\n","import type { DomphyElement, PartialElement } from \"@domphy/core\";\n\n/**\n * Catches errors thrown inside reactive child expressions and renders a\n * fallback element instead of crashing the whole tree. Apply to any container.\n *\n * Only errors in *reactive* children (functions returning element arrays) are\n * caught. Errors during static construction propagate normally — those are\n * programming errors, not runtime data errors.\n *\n * @hostTag any\n * @param props.fallback - Fallback element or factory `(error, reset) => element`. Defaults to a plain error message div.\n * @param props.onError - Optional callback for logging/telemetry.\n * @example { div: (l) => renderUserContent(l), $: [errorBoundary({ fallback: { p: \"Something went wrong.\" } })] }\n */\nfunction errorBoundary(\n props: {\n fallback?:\n | DomphyElement\n | ((error: unknown, reset: () => void) => DomphyElement);\n onError?: (error: unknown) => void;\n } = {},\n): PartialElement {\n return {\n _onError: (node, error, reset) => {\n props.onError?.(error);\n const fallbackEl =\n typeof props.fallback === \"function\"\n ? props.fallback(error, reset)\n : (props.fallback ??\n ({ div: \"An error occurred.\" } as DomphyElement));\n node.children.update([fallbackEl]);\n },\n };\n}\n\nexport { errorBoundary };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\nconst SIZE_MAP = { small: 8, medium: 10, large: 14 } as const;\n\n/**\n * Floating Action Button — a circular elevated button typically used for the\n * primary action on a screen. Apply to a `<button>` element.\n *\n * @hostTag button\n * @param props.color - Button color tone. Optional `ValueOrState<ThemeColor>`, defaults to `\"primary\"`.\n * @param props.size - Button size preset. Optional `\"small\" | \"medium\" | \"large\"`, defaults to `\"medium\"`.\n * @example { button: \"+\", $: [fab()] }\n * @example { button: \"+\", $: [fab({ size: \"small\", color: \"neutral\" })] }\n */\nfunction fab(\n props: {\n color?: ValueOrState<ThemeColor>;\n size?: \"small\" | \"medium\" | \"large\";\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"primary\", \"color\");\n const dim = themeSpacing(SIZE_MAP[props.size ?? \"medium\"]);\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"button\") {\n console.warn('\"fab\" patch must use button tag');\n }\n },\n // Deep brand disc (shift-13) + light icon — mid-ramp shift-8 failed WCAG\n // (~2.2:1). tone-background-inherit wants inherit+dataTone; explicit fill\n // silences it the same way as button solid.\n _doctorDisable: [\n \"low-contrast\",\n \"color-shift-minimum\",\n \"tone-background-inherit\",\n ],\n style: {\n appearance: \"none\",\n border: \"none\",\n cursor: \"pointer\",\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n flexShrink: 0,\n width: dim,\n height: dim,\n borderRadius: \"50%\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-13\", color.get(listener)),\n color: (listener) => themeColor(listener, \"shift-0\", \"neutral\"),\n boxShadow: elevation(\"low\"),\n transition: \"background-color 200ms ease, box-shadow 200ms ease\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-14\", color.get(listener)),\n boxShadow: elevation(\"medium\"),\n },\n \"&:active:not([disabled])\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-15\", color.get(listener)),\n boxShadow: elevation(\"low\"),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) =>\n `${elevation(\"medium\")}, ${focusRing(listener, color.get(listener))}`,\n },\n \"&[disabled]\": { opacity: 0.5, cursor: \"not-allowed\" },\n },\n };\n}\n\nexport { fab };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Lays out a figure as a column with block-level media (img/svg/video/canvas)\n * and a themed `<figcaption>`. Apply to a `<figure>` element.\n *\n * @hostTag figure\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for the figure/caption text. Defaults to \"neutral\".\n * @example { figure: [{ img: \"\", src }, { figcaption: \"A caption\" }], $: [figure()] }\n */\nfunction figure(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"figure\") {\n console.warn(`\"figure\" primitive patch must use figure tag`);\n }\n },\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: themeSpacing(2),\n marginInline: 0,\n marginTop: themeSpacing(3),\n marginBottom: themeSpacing(3),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n \"& img, & svg, & video, & canvas\": {\n display: \"block\",\n maxWidth: \"100%\",\n borderRadius: themeSpacing(2),\n },\n \"& figcaption\": {\n fontSize: (listener) => themeSize(listener, \"decrease-1\"),\n color: (listener) => themeColor(listener, \"muted\", color.get(listener)),\n lineHeight: 1.45,\n },\n },\n };\n}\n\nexport { figure };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Layout patch for a group of form fields. Arranges a `<legend>`, `<label>`s,\n * controls, and helper `<p>`s in a grid — labels beside controls (horizontal)\n * or stacked above them (vertical). Apply to a `<fieldset>` element.\n *\n * @hostTag fieldset\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for legend/text/surface. Defaults to \"neutral\".\n * @param props.layout - Field arrangement, \"horizontal\" (label beside control) | \"vertical\" (label above). Defaults to \"horizontal\".\n * @example { fieldset: [{ legend: \"Profile\" }, { label: \"Name\" }, { input: \"\" }], $: [formGroup({ layout: \"vertical\" })] }\n */\nfunction formGroup(\n props: {\n color?: ValueOrState<ThemeColor>;\n layout?: \"horizontal\" | \"vertical\";\n } = {},\n): PartialElement {\n const { layout = \"horizontal\" } = props;\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n const isVertical = layout === \"vertical\";\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"fieldset\") {\n console.warn(`\"formGroup\" patch must use fieldset tag`);\n }\n },\n // Legend weight is design-system chrome for field groups.\n _doctorDisable: \"inline-typography\",\n style: {\n margin: 0,\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 3),\n border: \"none\",\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n display: \"grid\",\n gridTemplateColumns: isVertical\n ? `minmax(0, 1fr)`\n : `max-content minmax(0, 1fr)`,\n columnGap: themeSpacing(4),\n rowGap: themeSpacing(3),\n alignItems: \"start\",\n \"& > legend\": {\n gridColumn: \"1 / -1\",\n margin: 0,\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n fontWeight: 600,\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n },\n \"& > label\": {\n gridColumn: \"1\",\n alignSelf: \"start\",\n margin: 0,\n paddingBlock: (listener) =>\n isVertical ? 0 : themeSpacing(themeDensity(listener) * 1),\n },\n \"& > label:has(+ :not(legend, label, p) + p)\": {\n gridRow: isVertical ? \"auto\" : \"span 2\",\n },\n \"& > :not(legend, label, p)\": {\n gridColumn: isVertical ? \"1\" : \"2\",\n minWidth: 0,\n width: \"100%\",\n boxSizing: \"border-box\",\n },\n \"& > p\": {\n gridColumn: isVertical ? \"1\" : \"2\",\n minWidth: 0,\n margin: 0,\n marginBlockStart: `calc(${themeSpacing(2)} * -1)`,\n fontSize: (listener) => themeSize(listener, \"decrease-1\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n },\n };\n}\n\nexport { formGroup };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\nconst HeadingShift: Record<string, string> = {\n h6: \"decrease-1\",\n h5: \"inherit\",\n h4: \"increase-1\",\n h3: \"increase-2\",\n h2: \"increase-3\",\n h1: \"increase-4\",\n};\n\n/**\n * Styles a heading, scaling its font size by level (h1 largest … h6 smallest)\n * relative to the theme base size. Apply to a heading element `<h1>`–`<h6>`.\n *\n * @hostTag h1\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for the heading text. Defaults to \"neutral\".\n * @example { h2: \"Section title\", $: [heading()] }\n */\nfunction heading(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (![\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"].includes(node.tagName)) {\n console.warn(\n `\"heading\" primitive patch must use heading tags [h1...h6]`,\n );\n }\n },\n style: {\n color: (listener) =>\n themeColor(listener, \"shift-11\", color.get(listener)),\n marginTop: 0,\n marginBottom: themeSpacing(2),\n fontSize: (listener) => {\n const offset = HeadingShift[listener.elementNode.tagName] || \"inherit\";\n return themeSize(listener, offset);\n },\n },\n };\n}\n\nexport { heading };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\n\n/**\n * A thematic break rendered as a thin 1px themed line with vertical margin.\n * Apply to an `<hr>` element.\n *\n * @hostTag hr\n * @param props.color - Theme color tone (`ValueOrState<ThemeColor>`) for the rule. Defaults to \"neutral\".\n * @example { hr: \"\", $: [horizontalRule()] }\n */\nfunction horizontalRule(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"hr\") {\n console.warn(`\"horizontalRule\" primitive patch must use hr tag`);\n }\n },\n // Soft rule surface — edge anchor (shift-3 = border) + inherit paint.\n dataTone: \"shift-3\",\n style: {\n border: 0,\n height: \"1px\",\n marginInline: 0,\n marginTop: themeSpacing(3),\n marginBottom: themeSpacing(3),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n };\n}\n\nexport { horizontalRule };\n","import type { PartialElement } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles an inline icon container: square box that centers its content and\n * applies the themed icon color. Apply to a `<span>` element.\n *\n * @hostTag span\n * @param props.color - Optional theme color tone for the icon (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @example { span: null, $: [icon()] }\n */\nfunction icon(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"span\") {\n console.warn(`\"icon\" primitive patch should use span tag`);\n }\n },\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n alignSelf: \"center\",\n justifySelf: \"center\",\n verticalAlign: \"middle\",\n width: themeSpacing(4),\n height: themeSpacing(4),\n flexShrink: \"0\",\n fontSize: (listener) => themeSize(listener),\n backgroundColor: \"transparent\",\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n };\n}\n\nexport { icon };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\n\n/**\n * Styles a responsive image: full-width, cover-fit, rounded corners with a\n * themed placeholder background. Apply to an `<img>` element.\n *\n * @hostTag img\n * @param props.color - Optional theme color tone for the placeholder background (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @example { img: null, src: \"photo.jpg\", alt: \"Photo\", $: [image()] }\n */\nfunction image(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n dataTone: \"shift-2\",\n _onInsert: (node) => {\n if (node.tagName !== \"img\") {\n console.warn(`\"image\" primitive patch must use img tag`);\n }\n },\n style: {\n display: \"block\",\n width: \"100%\",\n maxWidth: \"100%\",\n height: \"auto\",\n objectFit: \"cover\",\n borderRadius: themeSpacing(2),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n };\n}\n\nexport { image };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a custom checkbox with themed box, check mark, indeterminate state,\n * hover, focus and disabled styling. Apply to an `<input>` element of\n * type `checkbox` (the patch sets `type: \"checkbox\"`).\n *\n * @hostTag input\n * @param props.color - Optional theme color tone for the box/border (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone for the checked/indeterminate fill and focus ring (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"checkbox\", $: [inputCheckbox()] }\n */\nfunction inputCheckbox(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: \"checkbox\",\n _onInsert: (node) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputCheckbox\" primitive patch must use input tag`);\n }\n },\n style: {\n appearance: \"none\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n display: \"inline-flex\",\n position: \"relative\",\n width: themeSpacing(6),\n height: themeSpacing(6),\n justifyContent: \"center\",\n alignItems: \"center\",\n transition: \"background-color 300ms, outline-color 300ms\",\n margin: 0,\n padding: 0,\n \"&::before\": {\n content: `\"\"`,\n display: \"block\",\n borderRadius: themeSpacing(1),\n lineHeight: 1,\n cursor: \"pointer\",\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n width: themeSpacing(4),\n height: themeSpacing(4),\n },\n \"&:hover::before\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"hover\", color.get(listener)),\n },\n \"&:checked::before\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-8\", accentColor.get(listener)),\n },\n \"&:checked:hover:not([disabled])::before\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-7\", accentColor.get(listener)),\n },\n \"&:checked::after\": {\n content: `\"\"`,\n display: \"block\",\n position: \"absolute\",\n top: \"25%\",\n insetInlineStart: \"37%\",\n width: \"20%\",\n height: \"30%\",\n border: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"inherit\", accentColor.get(listener))}`,\n borderTop: 0,\n borderInlineStart: 0,\n transform: \"rotate(45deg)\",\n },\n \"&:indeterminate::before\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-3\", accentColor.get(listener)),\n },\n \"&:indeterminate::after\": {\n content: `\"\"`,\n position: \"absolute\",\n inset: \"30%\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-8\", accentColor.get(listener)),\n },\n \"&:indeterminate:hover:not([disabled])::after\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-7\", accentColor.get(listener)),\n },\n \"&:focus-visible\": {\n borderRadius: themeSpacing(1.5),\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n cursor: \"not-allowed\",\n },\n \"&[disabled]::before, &[disabled]::after\": {\n outline: \"none\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-4\", \"neutral\"),\n pointerEvents: \"none\",\n },\n },\n };\n}\n\nexport { inputCheckbox };\n","import type { PartialElement, ValueOrState } from \"@domphy/core\";\nimport { toState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a native color picker swatch with themed padding, rounded swatch and\n * disabled styling. Apply to an `<input>` element of type `color` (the patch\n * sets `type: \"color\"`).\n *\n * @hostTag input\n * @param props.color - Optional theme color tone used for the disabled state (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"color\", $: [inputColor()] }\n */\nfunction inputColor(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n return {\n type: \"color\",\n _onSchedule: (node, element) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputColor\" primitive patch must use input tag`);\n }\n (element as any).type = \"color\";\n },\n style: {\n appearance: \"none\",\n border: \"none\",\n cursor: \"pointer\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 1),\n blockSize: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n inlineSize: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n backgroundColor: \"transparent\",\n transition: \"box-shadow 140ms ease\",\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color.get(listener)),\n },\n \"&::-webkit-color-swatch-wrapper\": {\n margin: 0,\n padding: 0,\n },\n \"&::-webkit-color-swatch\": {\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n },\n },\n };\n}\n\nexport { inputColor };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\ntype InputDateTimeMode = \"date\" | \"time\" | \"week\" | \"month\" | \"datetime-local\";\n\n/**\n * Styles a native date/time input with themed border, padding, hover, focus,\n * invalid and disabled states. The `mode` selects the input `type`. Apply to\n * an `<input>` element (the patch sets `type` to the chosen `mode`).\n *\n * @hostTag input\n * @param props.mode - Input mode selecting the host `type`: `\"date\" | \"time\" | \"week\" | \"month\" | \"datetime-local\"`. Defaults to `\"datetime-local\"`.\n * @param props.color - Optional theme color tone for text/border (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone for the hover/focus ring (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"datetime-local\", $: [inputDateTime()] }\n */\nfunction inputDateTime(\n props: {\n mode?: InputDateTimeMode;\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const { mode = \"datetime-local\" } = props;\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: mode,\n _onSchedule: (node, element) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputDateTime\" primitive patch must use input tag`);\n }\n (element as any).type = mode;\n },\n style: {\n fontFamily: \"inherit\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n lineHeight: \"inherit\",\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&::-webkit-calendar-picker-indicator\": {\n cursor: \"pointer\",\n opacity: 0.85,\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-5\", accentColor.get(listener))}`,\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n },\n \"&:invalid\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", \"error\")}`,\n },\n },\n };\n}\n\nexport { inputDateTime };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a native file input with a themed upload button, border, hover, focus\n * and disabled states. Apply to an `<input>` element of type `file` (the patch\n * sets `type: \"file\"`).\n *\n * @hostTag input\n * @param props.color - Optional theme color tone for text/border and the upload button (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone for the hover/focus ring (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"file\", $: [inputFile()] }\n */\nfunction inputFile(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: \"file\",\n _onSchedule: (node, element) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputFile\" primitive patch must use input tag`);\n }\n (element as any).type = \"file\";\n },\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n fontFamily: \"inherit\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n lineHeight: \"inherit\",\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 1),\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&::-webkit-file-upload-button\": {\n marginTop: (listener) => themeSpacing(themeDensity(listener)),\n fontFamily: \"inherit\",\n fontSize: \"inherit\",\n border: \"none\",\n borderRadius: themeSpacing(1),\n height: themeSpacing(6),\n paddingInline: themeSpacing(2),\n cursor: \"pointer\",\n color: (listener) =>\n themeColor(listener, \"shift-11\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"surface\", color.get(listener)),\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-5\", accentColor.get(listener))}`,\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.8,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"surface\", \"neutral\"),\n },\n \"&[disabled]::-webkit-file-upload-button\": {\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-3\", \"neutral\"),\n },\n },\n };\n}\n\nexport { inputFile };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a native number input with themed border, padding, visible spin\n * buttons, hover, focus and disabled states. Apply to an `<input>` element of\n * type `number` (the patch sets `type: \"number\"`).\n *\n * @hostTag input\n * @param props.color - Optional theme color tone for text/border (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone for the hover/focus ring (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"number\", $: [inputNumber()] }\n */\nfunction inputNumber(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: \"number\",\n _onSchedule: (node, element) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputNumber\" primitive patch must use input tag`);\n }\n (element as any).type = \"number\";\n },\n style: {\n fontFamily: \"inherit\",\n lineHeight: \"inherit\",\n minWidth: themeSpacing(10),\n paddingInlineStart: (listener) =>\n themeSpacing(themeDensity(listener) * 3),\n paddingInlineEnd: (listener) =>\n themeSpacing(themeDensity(listener) * 1.5),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button\": {\n opacity: 1,\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-5\", accentColor.get(listener))}`,\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n },\n },\n };\n}\n\nexport { inputNumber };\n","import type { PartialElement } from \"@domphy/core\";\nimport { themeSpacing } from \"@domphy/theme\";\n\n/**\n * Lays out a one-time-password container as a horizontal row of inputs and\n * wires keyboard navigation: auto-advance on input, backspace/arrow movement,\n * and paste distribution across the child inputs. Apply to a container element\n * (e.g. `<div>`) whose direct children are the OTP `<input>` boxes. Takes no\n * props.\n *\n * @example { div: null, $: [inputOTP()], children: [{ input: null }, { input: null }] }\n */\nfunction inputOTP(): PartialElement {\n return {\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: themeSpacing(2),\n \"& > *\": {\n minWidth: `${themeSpacing(9)}!important`,\n },\n },\n _onMount: (node) => {\n const container = node.domElement as HTMLElement;\n const getInputs = () =>\n Array.from(container.querySelectorAll(\"input\")) as HTMLInputElement[];\n\n const onInput = (e: Event) => {\n const inputs = getInputs();\n const target = e.target as HTMLInputElement;\n const idx = inputs.indexOf(target);\n if (target.value && idx < inputs.length - 1) {\n inputs[idx + 1].focus();\n }\n };\n\n const onKeydown = (e: KeyboardEvent) => {\n const inputs = getInputs();\n const target = e.target as HTMLInputElement;\n const idx = inputs.indexOf(target);\n if (e.key === \"Backspace\" && !target.value && idx > 0) {\n inputs[idx - 1].focus();\n }\n if (e.key === \"ArrowLeft\" && idx > 0) inputs[idx - 1].focus();\n if (e.key === \"ArrowRight\" && idx < inputs.length - 1)\n inputs[idx + 1].focus();\n };\n\n const onPaste = (e: ClipboardEvent) => {\n e.preventDefault();\n const text = e.clipboardData?.getData(\"text\") ?? \"\";\n const inputs = getInputs();\n const found = inputs.indexOf(e.target as HTMLInputElement);\n const startIdx = found === -1 ? 0 : found;\n [...text].forEach((char, i) => {\n if (inputs[startIdx + i]) inputs[startIdx + i].value = char;\n });\n const lastFilled = Math.min(\n startIdx + text.length - 1,\n inputs.length - 1,\n );\n inputs[lastFilled]?.focus();\n };\n\n container.addEventListener(\"input\", onInput);\n container.addEventListener(\"keydown\", onKeydown as EventListener);\n container.addEventListener(\"paste\", onPaste as EventListener);\n\n node.addHook(\"Remove\", () => {\n container.removeEventListener(\"input\", onInput);\n container.removeEventListener(\"keydown\", onKeydown as EventListener);\n container.removeEventListener(\"paste\", onPaste as EventListener);\n });\n },\n };\n}\n\nexport { inputOTP };\n","import type { DomphyElement, PartialElement, StyleObject } from \"@domphy/core\";\nimport { rawHtml, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n// Tabler Icons (MIT) — eye and eye-off outlines.\nconst EYE_SVG =\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" ` +\n `stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" ` +\n `width=\"1em\" height=\"1em\">` +\n `<path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>` +\n `<path d=\"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0\"/>` +\n `<path d=\"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6\"/>` +\n `</svg>`;\n\nconst EYE_OFF_SVG =\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" ` +\n `stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" ` +\n `width=\"1em\" height=\"1em\">` +\n `<path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>` +\n `<path d=\"M10.585 10.587a2 2 0 0 0 2.829 2.828\"/>` +\n `<path d=\"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6` +\n `c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18` +\n `c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87\"/>` +\n `<path d=\"M3 3l18 18\"/>` +\n `</svg>`;\n\n/**\n * Password input wrapper: a styled `<div>` that inserts an `<input type=\"password\">`\n * and a show/hide toggle button. The outer div carries the focus-ring outline via\n * `:focus-within`. Apply to an empty `<div>`.\n *\n * @hostTag div\n * @param props.color - Base color tone for border/background/text. Defaults to `\"neutral\"`.\n * @param props.accentColor - Accent outline color on focus-within. Defaults to `\"primary\"`.\n * @example { div: null, $: [inputPassword()] }\n */\nfunction inputPassword(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const colorState = toState(props.color ?? \"neutral\", \"color\");\n const accentState = toState(props.accentColor ?? \"primary\", \"accentColor\");\n const visibleState = toState(false);\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"div\") {\n console.warn('\"inputPassword\" patch must use div tag');\n }\n },\n // Build the input/toggle as real child elements (not imperative DOM\n // mutation in _onMount) so generateHTML()/SSR emits the actual markup.\n _onInit: (node) => {\n const field: DomphyElement<\"input\"> = {\n input: null,\n type: (l) => (visibleState.get(l) ? \"text\" : \"password\"),\n style: {\n flex: 1,\n minWidth: 0,\n border: \"none\",\n outline: \"none\",\n backgroundColor: \"transparent\",\n padding: 0,\n margin: 0,\n font: \"inherit\",\n color: \"inherit\",\n },\n };\n\n const toggle: DomphyElement<\"button\"> = {\n button: (l) => rawHtml(visibleState.get(l) ? EYE_OFF_SVG : EYE_SVG),\n type: \"button\",\n ariaLabel: (l) =>\n visibleState.get(l) ? \"Hide password\" : \"Show password\",\n onClick: () => visibleState.set(!visibleState.get()),\n style: {\n background: \"none\",\n border: \"none\",\n padding: 0,\n margin: 0,\n cursor: \"pointer\",\n color: \"inherit\",\n display: \"flex\",\n alignItems: \"center\",\n flexShrink: 0,\n opacity: 0.6,\n },\n };\n\n node.children.insert(field);\n node.children.insert(toggle);\n },\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: (l) => themeSpacing(themeDensity(l) * 1),\n paddingBlock: (l) => themeSpacing(themeDensity(l) * 1),\n paddingInline: (l) => themeSpacing(themeDensity(l) * 3),\n borderRadius: (l) => themeSpacing(themeDensity(l) * 1.5),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (l) =>\n `1px solid ${themeColor(l, \"border-strong\", colorState.get(l))}`,\n color: (l) => themeColor(l, \"text\", colorState.get(l)),\n backgroundColor: (l) => themeColor(l, \"inherit\", colorState.get(l)),\n fontSize: (l) => themeSize(l, \"inherit\"),\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&:hover:not(:has([disabled])):not(:focus-within)\": {\n outline: (l) =>\n `1px solid ${themeColor(l, \"shift-5\", accentState.get(l))}`,\n },\n \"&:focus-within\": {\n boxShadow: (l) => focusRing(l, accentState.get(l)),\n },\n } as StyleObject,\n };\n}\n\nexport { inputPassword };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a custom radio button with a themed circular box, checked dot, hover,\n * focus and disabled states. Apply to an `<input>` element of type `radio`\n * (the patch sets `type: \"radio\"`).\n *\n * @hostTag input\n * @param props.color - Optional theme color tone for the box/border (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone for the checked dot and focus ring (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"radio\", $: [inputRadio()] }\n */\nfunction inputRadio(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: \"radio\",\n _onInsert: (node) => {\n if (node.tagName !== \"input\") {\n console.warn(\n `\"inputRadio\" primitive patch must use input tag and radio type`,\n );\n return;\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n appearance: \"none\",\n display: \"inline-flex\",\n position: \"relative\",\n width: themeSpacing(6),\n height: themeSpacing(6),\n justifyContent: \"center\",\n alignItems: \"center\",\n transition: \"background-color 300ms, outline-color 300ms\",\n margin: 0,\n padding: 0,\n \"&::before\": {\n content: `\"\"`,\n display: \"block\",\n borderRadius: \"50%\",\n lineHeight: 1,\n cursor: \"pointer\",\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n width: themeSpacing(4),\n height: themeSpacing(4),\n },\n \"&:hover::before\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"hover\", color.get(listener)),\n },\n \"&:checked::before\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n },\n \"&:checked::after\": {\n content: `\"\"`,\n position: \"absolute\",\n inset: \"30%\",\n borderRadius: \"50%\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-8\", accentColor.get(listener)),\n },\n \"&:checked:hover:not([disabled])::before\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-7\", accentColor.get(listener)),\n },\n \"&:focus-visible\": {\n borderRadius: \"50%\",\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n cursor: \"not-allowed\",\n },\n \"&[disabled]::before, &[disabled]::after\": {\n outline: \"none\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-4\", \"neutral\"),\n pointerEvents: \"none\",\n },\n },\n };\n}\n\nexport { inputRadio };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a range slider with a themed track and thumb, hover, focus and\n * disabled states. Apply to an `<input>` element of type `range` (the patch\n * sets `type: \"range\"`).\n *\n * @hostTag input\n * @param props.color - Optional theme color tone for the slider track (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone for the thumb and focus ring (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"range\", $: [inputRange()] }\n */\nfunction inputRange(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: \"range\",\n _onInsert: (node) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputRange\" primitive patch must use input tag`);\n }\n },\n style: {\n appearance: \"none\",\n width: \"100%\",\n margin: 0,\n padding: 0,\n height: themeSpacing(4),\n background: \"transparent\",\n cursor: \"pointer\",\n \"&::-webkit-slider-runnable-track\": {\n height: themeSpacing(1.5),\n borderRadius: themeSpacing(999),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-3\", color.get(listener)),\n },\n \"&::-webkit-slider-thumb\": {\n appearance: \"none\",\n width: themeSpacing(4),\n height: themeSpacing(4),\n borderRadius: themeSpacing(999),\n border: \"none\",\n marginTop: `calc((${themeSpacing(1.5)} - ${themeSpacing(4)}) / 2)`,\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-9\", accentColor.get(listener)),\n },\n \"&:hover:not([disabled])::-webkit-slider-thumb\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-10\", accentColor.get(listener)),\n },\n borderRadius: themeSpacing(2),\n transition: \"box-shadow 140ms ease\",\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n },\n },\n };\n}\n\nexport { inputRange };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a search input with themed border, padding, placeholder color, native\n * search decorations, hover, focus and disabled states. Apply to an `<input>`\n * element of type `search` (the patch sets `type: \"search\"`).\n *\n * @hostTag input\n * @param props.color - Optional theme color tone for text/border/placeholder (`ValueOrState<ThemeColor>`). Defaults to `\"neutral\"`.\n * @param props.accentColor - Optional theme color tone for the hover/focus ring (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"search\", $: [inputSearch()] }\n */\nfunction inputSearch(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: \"search\",\n _onSchedule: (node, element) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputSearch\" primitive patch must use input tag`);\n }\n (element as any).type = \"search\";\n },\n style: {\n fontFamily: \"inherit\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n lineHeight: \"inherit\",\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n minWidth: themeSpacing(32),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&::placeholder\": {\n color: (listener) =>\n themeColor(listener, \"shift-7\", color.get(listener)),\n },\n \"&::-webkit-search-decoration\": {\n display: \"none\",\n },\n \"&::-webkit-search-cancel-button\": {\n cursor: \"pointer\",\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-5\", accentColor.get(listener))}`,\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n },\n },\n };\n}\n\nexport { inputSearch };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a checkbox as a toggle switch: themed track and sliding knob that\n * animates and recolors on checked, plus a disabled state. Apply to an\n * `<input>` element of type `checkbox` (the patch sets `type: \"checkbox\"`).\n *\n * @hostTag input\n * @param props.accentColor - Optional theme color tone for the checked track (`ValueOrState<ThemeColor>`). Defaults to `\"primary\"`.\n * @example { input: null, type: \"checkbox\", $: [inputSwitch()] }\n */\nfunction inputSwitch(\n props: { accentColor?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n role: \"switch\",\n dataTone: \"shift-2\",\n type: \"checkbox\",\n _onSchedule: (node) => {\n if (node.tagName !== \"input\") {\n console.warn(`\"inputSwitch\" primitive patch must use input tag`);\n return;\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n // Surface contract: dataTone is set; paint track via inherit + text color.\n backgroundColor: (listener) => themeColor(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\"),\n appearance: \"none\",\n position: \"relative\",\n display: \"inline-flex\",\n width: themeSpacing(9),\n height: themeSpacing(6),\n cursor: \"pointer\",\n margin: `0`,\n paddingBlock: themeSpacing(1),\n transition: \"box-shadow 140ms ease\",\n borderRadius: themeSpacing(999),\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&:checked\": {\n \"&::before\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"increase-3\", accentColor.get(listener)),\n },\n \"&::after\": {\n left: `calc(100% - ${themeSpacing(3.5)})`,\n },\n },\n \"&::after\": {\n content: `\"\"`,\n aspectRatio: `1/1`,\n position: \"absolute\",\n width: themeSpacing(3),\n height: themeSpacing(3),\n borderRadius: themeSpacing(999),\n left: themeSpacing(0.5),\n top: \"50%\",\n transform: \"translateY(-50%)\",\n transition: \"left 0.3s\",\n backgroundColor: (listener) => themeColor(listener, \"decrease-3\"),\n },\n \"&::before\": {\n content: '\"\"',\n width: \"100%\",\n borderRadius: themeSpacing(999),\n display: \"inline-block\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n lineHeight: 1,\n backgroundColor: (listener) => themeColor(listener),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n },\n },\n };\n}\n\nexport { inputSwitch };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Themed single-line text input primitive. Sets `type=\"text\"` and styles the\n * field with themed border, focus ring, placeholder, disabled and validation\n * (`data-status`) states. Apply to an `<input>` element.\n *\n * @hostTag input\n * @param props - Optional configuration.\n * @param props.color - Base color tone for text/border/background. Defaults to `\"neutral\"`.\n * @param props.accentColor - Accent color tone for the hover/focus outline. Defaults to `\"primary\"`.\n * @example { input: \"\", type: \"text\", placeholder: \"Name\", $: [inputText()] }\n */\nfunction inputText(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n type: \"text\",\n _onSchedule: (node, element) => {\n if (node.tagName !== \"input\") {\n console.warn(\n `\"inputText\" primitive patch must use input tag and text type`,\n );\n }\n (element as any).type = \"text\";\n },\n style: {\n fontFamily: \"inherit\",\n lineHeight: \"inherit\",\n minWidth: themeSpacing(10),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&::placeholder\": {\n color: (listener) => themeColor(listener, \"shift-7\"),\n },\n \"&:not(:placeholder-shown)\": {\n color: (listener) => themeColor(listener, \"shift-10\"),\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-5\", accentColor.get(listener))}`,\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n },\n \"&:invalid:not(:placeholder-shown)\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", \"error\")}`,\n },\n \"&[data-status=error]\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", \"error\")}`,\n },\n \"&[data-status=warning]\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", \"warning\")}`,\n },\n },\n };\n}\n\nexport { inputText };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Renders keyboard-key styling (themed background, border and padding) for a\n * keystroke hint. Apply to a `<kbd>` element.\n *\n * @hostTag kbd\n * @param props - Optional configuration.\n * @param props.color - Color tone for text/background/border. Defaults to `\"neutral\"`.\n * @example { kbd: \"Ctrl\", $: [keyboard()] }\n */\nfunction keyboard(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"kbd\") {\n console.warn(`\"keyboard\" primitive patch must use kbd tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n paddingBlock: themeSpacing(0.5),\n paddingInline: themeSpacing(1.5),\n borderRadius: themeSpacing(1),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n },\n };\n}\n\nexport { keyboard };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Themed form-label primitive: inline-flex layout with gap, themed text color,\n * focus-within highlighting and a disabled (`aria-disabled`) state. Apply to a\n * `<label>` element.\n *\n * @hostTag label\n * @param props - Optional configuration.\n * @param props.color - Base color tone for the label text. Defaults to `\"neutral\"`.\n * @param props.accentColor - Accent color tone applied on focus-within. Defaults to `\"primary\"`.\n * @example { label: \"Email\", htmlFor: \"email\", $: [label()] }\n */\nfunction label(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"label\") {\n console.warn(`\"label\" primitive patch must use label tag`);\n }\n },\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: themeSpacing(2),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n cursor: \"pointer\",\n \"&:focus-within\": {\n color: (listener) =>\n themeColor(listener, \"shift-10\", accentColor.get(listener)),\n },\n \"&[aria-disabled=true]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n },\n },\n };\n}\n\nexport { label };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Themed hyperlink primitive: styles text color, hover underline, visited,\n * focus ring and a disabled state. Apply to an `<a>` element.\n *\n * @hostTag a\n * @param props - Optional configuration.\n * @param props.color - Base color tone for the link text. Defaults to `\"primary\"`.\n * @param props.accentColor - Accent color tone for visited/focus states. Defaults to `\"secondary\"`.\n * @example { a: \"Home\", href: \"/\", $: [link()] }\n */\nfunction link(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"primary\", \"color\");\n const accentColor = toState(props.accentColor ?? \"secondary\", \"accentColor\");\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"a\") {\n console.warn(`\"link\" primitive patch must use a tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) => themeColor(listener),\n // shift-13 (not \"text\"/shift-9): brand hues need extra depth for ≥4.5:1\n // on a light surface (primary orange failed at 2.57 with shift-9).\n color: (listener) =>\n themeColor(listener, \"shift-13\", color.get(listener)),\n textDecoration: \"none\",\n \"&:visited\": {\n color: (listener) =>\n themeColor(listener, \"shift-13\", accentColor.get(listener)),\n },\n \"&:hover:not([disabled])\": {\n color: (listener) =>\n themeColor(listener, \"shift-14\", color.get(listener)),\n textDecoration: \"underline\",\n },\n borderRadius: themeSpacing(1),\n // Kill the browser default outline so only the shared focusRing shows.\n outline: \"none\",\n transition: \"color 140ms ease, box-shadow 140ms ease\",\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n },\n },\n };\n}\n\nexport { link };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { BUTTON_SIZE_FONT, type ButtonSize } from \"../utils/buttonSize.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\nimport type { ButtonVariant } from \"./button.js\";\n\nconst PADDING_STEPS: Record<ButtonSize, { block: number; inline: number }> = {\n small: { block: 0.5, inline: 2 },\n medium: { block: 1, inline: 3 },\n large: { block: 1.5, inline: 4 },\n};\n\nconst GHOST_PADDING: Record<ButtonSize, number> = {\n small: 0.5,\n medium: 1,\n large: 1.5,\n};\n\n/**\n * An `<a>` element styled to look like a button — same visual system as\n * `button()` (`variant` / `size` / color) while preserving link semantics\n * (href, middle-click, right-click). Apply to an `<a>` element.\n *\n * @hostTag a\n * @param props.color - Button color tone. Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @param props.variant - `\"outline\"` (default) | `\"solid\"` | `\"ghost\"` — matches `button()`.\n * @param props.size - `\"small\" | \"medium\" | \"large\"`, defaults to `\"medium\"`.\n * @example { a: \"Open app\", href: \"/app\", $: [linkButton({ color: \"primary\" })] }\n * @example { a: \"Get started\", href: \"/start\", $: [linkButton({ variant: \"solid\" })] }\n */\nfunction linkButton(\n props: {\n color?: ValueOrState<ThemeColor>;\n variant?: ButtonVariant;\n size?: ButtonSize;\n } = {},\n): PartialElement {\n const variant = props.variant ?? \"outline\";\n const color = toState(\n props.color ?? (variant === \"ghost\" ? \"neutral\" : \"primary\"),\n \"color\",\n );\n const size = props.size ?? \"medium\";\n const fontSize = BUTTON_SIZE_FONT[size];\n\n if (variant === \"ghost\") {\n const padding = GHOST_PADDING[size];\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"a\") {\n console.warn(`\"linkButton\" primitive patch must use a tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, fontSize),\n textDecoration: \"none\",\n paddingBlock: (listener) =>\n themeSpacing(themeDensity(listener) * padding),\n paddingInline: (listener) =>\n themeSpacing(themeDensity(listener) * padding),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n display: \"inline-flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gap: (listener) => themeSpacing(themeDensity(listener) * 1),\n userSelect: \"none\",\n cursor: \"pointer\",\n fontFamily: \"inherit\",\n lineHeight: \"inherit\",\n border: \"none\",\n background: \"none\",\n outline: \"none\",\n transition:\n \"background-color 140ms ease, color 140ms ease, box-shadow 140ms ease\",\n color: (listener) =>\n themeColor(listener, \"shift-6\", color.get(listener)),\n \"&:hover:not([aria-disabled=true])\": {\n color: (listener) =>\n themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"hover\", color.get(listener)),\n textDecoration: \"none\",\n },\n \"&:active:not([aria-disabled=true])\": {\n color: (listener) =>\n themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"increase-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color.get(listener)),\n },\n \"&[aria-disabled=true]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n pointerEvents: \"none\",\n color: (listener) => themeColor(listener, \"border-strong\", \"neutral\"),\n },\n },\n };\n }\n\n const isSolid = variant === \"solid\";\n const padding = PADDING_STEPS[size];\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"a\") {\n console.warn(`\"linkButton\" primitive patch must use a tag`);\n }\n },\n ...(isSolid\n ? {\n _doctorDisable: [\n \"low-contrast\",\n \"color-shift-minimum\",\n \"tone-background-inherit\",\n ] as const,\n }\n : {}),\n style: {\n fontSize: (listener) => themeSize(listener, fontSize),\n textDecoration: \"none\",\n paddingBlock: (listener) =>\n themeSpacing(themeDensity(listener) * padding.block),\n paddingInline: (listener) =>\n themeSpacing(themeDensity(listener) * padding.inline),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n width: \"fit-content\",\n display: \"inline-flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gap: (listener) => themeSpacing(themeDensity(listener) * 1),\n userSelect: \"none\",\n cursor: \"pointer\",\n fontFamily: \"inherit\",\n lineHeight: \"inherit\",\n border: \"none\",\n outlineOffset: \"-1px\",\n outlineWidth: \"1px\",\n outline: isSolid\n ? \"none\"\n : (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n // Solid: deep brand (shift-13) + light-end text (not mid-ramp ~2.2:1).\n // Outline: shift-13 for ≥4.5:1 on light bg.\n color: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-0\", \"neutral\")\n : themeColor(listener, \"shift-13\", color.get(listener)),\n backgroundColor: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-13\", color.get(listener))\n : themeColor(listener, \"inherit\", color.get(listener)),\n transition:\n \"background-color 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease\",\n \"&:hover:not([aria-disabled=true])\": {\n textDecoration: \"none\",\n color: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-0\", \"neutral\")\n : themeColor(listener, \"shift-14\", color.get(listener)),\n backgroundColor: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-14\", color.get(listener))\n : themeColor(listener, \"hover\", color.get(listener)),\n },\n \"&:active:not([aria-disabled=true])\": {\n backgroundColor: (listener) =>\n isSolid\n ? themeColor(listener, \"shift-15\", color.get(listener))\n : themeColor(listener, \"increase-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color.get(listener)),\n },\n \"&[aria-disabled=true]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n pointerEvents: \"none\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n },\n },\n };\n}\n\nexport { linkButton };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a navigation/display list container. Sets `list-style: none` and\n * zero padding; pairs with `listItem` and `listItemButton`. Apply to `<ul>`.\n *\n * @hostTag ul\n * @param props.color - Surface color tone. Optional `ThemeColor`, defaults to `\"neutral\"`.\n * @example { ul: [...], $: [list()] }\n */\nfunction list(_props: { color?: ThemeColor } = {}): PartialElement {\n return {\n style: {\n listStyle: \"none\",\n margin: 0,\n padding: 0,\n display: \"flex\",\n flexDirection: \"column\",\n },\n };\n}\n\n/**\n * A non-interactive list row. Typically wraps an icon + text. Apply to `<li>`.\n *\n * @hostTag li\n * @param props.dense - Reduce vertical padding. Optional `boolean`, defaults to `false`.\n * @example { li: \"Item\", $: [listItem()] }\n */\nfunction listItem(props: { dense?: boolean } = {}): PartialElement {\n const { dense = false } = props;\n return {\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingBlock: (listener) =>\n themeSpacing(dense ? 1 : themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\"),\n },\n };\n}\n\n/**\n * An interactive (clickable) list row with hover/focus-visible states. Apply\n * to `<button>` or `<a>` inside an `<li>`.\n *\n * @param props.color - Color tone. Optional `ValueOrState<ThemeColor>`, defaults to `\"neutral\"`.\n * @param props.accentColor - Focus/active accent. Optional `ThemeColor`, defaults to `\"primary\"`.\n * @param props.dense - Reduce vertical padding. Optional `boolean`, defaults to `false`.\n * @example { button: \"Action\", $: [listItemButton()] }\n */\nfunction listItemButton(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ThemeColor;\n dense?: boolean;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = props.accentColor ?? \"primary\";\n const { dense = false } = props;\n\n return {\n style: {\n cursor: \"pointer\",\n appearance: \"none\",\n border: \"none\",\n background: \"transparent\",\n textDecoration: \"none\",\n textAlign: \"left\",\n display: \"flex\",\n alignItems: \"center\",\n width: \"100%\",\n gap: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingBlock: (listener) =>\n themeSpacing(dense ? 1 : themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n transition: \"background-color 150ms ease, box-shadow 140ms ease\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"hover\", color.get(listener)),\n },\n \"&:active:not([disabled])\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"increase-2\", color.get(listener)),\n },\n \"&[aria-current=page], &[aria-selected=true]\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-3\", accentColor),\n color: (listener) => themeColor(listener, \"shift-12\", accentColor),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor),\n },\n \"&[disabled]\": { opacity: 0.5, cursor: \"not-allowed\" },\n },\n };\n}\n\nexport { list, listItem, listItemButton };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Themed highlight primitive: gives marked/highlighted inline text a tinted\n * background, rounded corners and padding. Apply to a `<mark>` element.\n *\n * @hostTag mark\n * @param props - Optional configuration.\n * @param props.accentColor - Accent color tone for the highlight fill and text. Defaults to `\"highlight\"`.\n * @example { mark: \"important\", $: [mark()] }\n */\nfunction mark(\n props: { accentColor?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const accentColor = toState(props.accentColor ?? \"highlight\", \"accentColor\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"mark\") {\n console.warn(`\"mark\" primitive patch must use mark tag`);\n }\n },\n dataTone: \"shift-2\",\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) =>\n themeColor(listener, \"text\", accentColor.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", accentColor.get(listener)),\n height: themeSpacing(6),\n borderRadius: themeSpacing(1),\n paddingInline: themeSpacing(1.5),\n },\n };\n}\n\nexport { mark };\n","import {\n type DomphyElement,\n type Listener,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/** One item inside a menu. */\ntype MenuItem = {\n /** Button label — plain string (auto-wrapped) or any DomphyElement (e.g. icon + text). */\n label: string | DomphyElement;\n /** Stable key. Defaults to the item's zero-based index. */\n key?: string | number;\n /** Called when the item is clicked. */\n onClick?: () => void;\n};\n\n/**\n * All-in-one vertical menu. Generates `<button>` `[role=menuitem]` elements\n * from the `items` array with keyboard navigation (Arrow/Home/End/Enter/Space).\n * Apply to any wrapper element (`div`, `ul`, …).\n *\n * @param props.items - Item definitions `{ label, key?, onClick? }`. Pass `[]`\n * to keep the wrapper's own children (escape hatch for fully custom rows —\n * only the menu container styling and `role=\"menu\"` semantics apply then).\n * @param props.activeKey - Currently selected key (value or State). Defaults to `null`.\n * @param props.selectable - Whether items track and update the active selection. Defaults to `true`.\n * @param props.color - Background color tone for the menu. Defaults to `\"neutral\"`.\n * @param props.accentColor - Accent color for the active/focus item. Defaults to `\"primary\"`.\n * @example\n * { div: null, $: [menu({ items: [\n * { label: \"Profile\", key: \"profile\", onClick: () => navigate(\"/profile\") },\n * { label: \"Settings\", key: \"settings\", onClick: () => navigate(\"/settings\") },\n * ] })] }\n */\nfunction menu(\n props: {\n items: MenuItem[];\n activeKey?: ValueOrState<number | string | null>;\n selectable?: boolean;\n color?: ThemeColor;\n accentColor?: ThemeColor;\n } = { items: [] },\n): PartialElement {\n const {\n items = [],\n selectable = true,\n color = \"neutral\",\n accentColor = \"primary\",\n } = props;\n const activeKey = toState(props.activeKey ?? null);\n\n return {\n role: \"menu\",\n dataTone: \"shift-0\",\n _onSchedule: (node, element) => {\n // Empty items = the caller renders its own rows; leave children alone.\n if (items.length === 0) return;\n const id = node.nodeId;\n\n const buttons: DomphyElement<\"button\">[] = items.map((item, index) => {\n const key = item.key ?? index;\n\n return {\n button:\n typeof item.label === \"string\"\n ? [{ span: item.label } as DomphyElement<\"span\">]\n : [item.label],\n _key: key,\n type: \"button\",\n id: `menuitem${id}${key}`,\n role: \"menuitem\",\n ...(selectable\n ? {\n ariaCurrent: (l: Listener) =>\n activeKey.get(l) === key || undefined,\n }\n : {}),\n onClick: () => {\n if (selectable) activeKey.set(key);\n item.onClick?.();\n },\n onKeyDown: (e: Event) => {\n const k = (e as KeyboardEvent).key;\n if (k === \"Enter\" || k === \" \") {\n e.preventDefault();\n (e.target as HTMLElement).click();\n return;\n }\n if (![\"ArrowDown\", \"ArrowUp\", \"Home\", \"End\"].includes(k)) return;\n e.preventDefault();\n const keys = items.map((it, i) => it.key ?? i);\n const idx = keys.indexOf(key);\n let next = idx;\n if (k === \"ArrowDown\") next = (idx + 1) % keys.length;\n else if (k === \"ArrowUp\")\n next = (idx - 1 + keys.length) % keys.length;\n else if (k === \"Home\") next = 0;\n else if (k === \"End\") next = keys.length - 1;\n (\n document.getElementById(\n `menuitem${id}${keys[next]}`,\n ) as HTMLElement\n )?.focus();\n },\n style: {\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n gap: themeSpacing(2),\n width: \"100%\",\n fontSize: (l: Listener) => themeSize(l, \"inherit\"),\n height: (l: Listener) => themeSpacing(6 + themeDensity(l) * 2),\n paddingInline: (l: Listener) => themeSpacing(themeDensity(l) * 3),\n border: \"none\",\n outline: \"none\",\n // Menu panel is a light (shift-0) surface: \"text\" resolves to a\n // dark-on-light reading tone in both light and dark themes.\n color: (l: Listener) => themeColor(l, \"text\", color),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\", color),\n transition:\n \"background-color 140ms ease, box-shadow 140ms ease, color 140ms ease\",\n \"&:hover:not([disabled]):not([aria-current=true])\": {\n backgroundColor: (l: Listener) => themeColor(l, \"hover\", color),\n },\n \"&[aria-current=true]\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-3\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-13\", accentColor),\n },\n \"&:focus-visible\": {\n boxShadow: (l: Listener) => focusRing(l, accentColor),\n },\n },\n } as DomphyElement<\"button\">;\n });\n\n (element as any)[node.tagName] = buttons;\n },\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n paddingBlock: (l: Listener) => themeSpacing(themeDensity(l) * 2),\n paddingInline: (l: Listener) => themeSpacing(themeDensity(l) * 2),\n fontSize: (l: Listener) => themeSize(l, \"inherit\"),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\", color),\n color: (l: Listener) => themeColor(l, \"text\", color),\n borderRadius: (l: Listener) => themeSpacing(themeDensity(l) * 2),\n outline: (l: Listener) =>\n `1px solid ${themeColor(l, \"border-strong\", color)}`,\n outlineOffset: \"-1px\",\n boxShadow: elevation(\"medium\"),\n },\n };\n}\n\nexport { menu };\nexport type { MenuItem };\n","import type { PartialElement, State } from \"@domphy/core\";\n\n/**\n * One keyframe. Shorthands `x`/`y` (px), `scale`, `rotate` (deg) compose into a\n * single `transform`; any other key is a raw CSS property (e.g. `opacity`,\n * `backgroundColor`).\n */\nexport type MotionKeyframe = {\n x?: number | string;\n y?: number | string;\n scale?: number | string;\n rotate?: number | string;\n} & Record<string, string | number>;\n\nexport interface MotionProps {\n /** Starting keyframe applied before the enter animation. */\n initial?: MotionKeyframe;\n /** Target keyframe. Pass a `State` to re-animate whenever it changes. */\n animate?: MotionKeyframe | State<MotionKeyframe>;\n /** Keyframe animated to before the element is removed. */\n exit?: MotionKeyframe;\n transition?: {\n /** ms, default 300. */\n duration?: number;\n /** ms, default 0. */\n delay?: number;\n /** CSS easing, default \"ease\". */\n easing?: string;\n iterations?: number;\n };\n}\n\nconst isState = (value: unknown): value is State<MotionKeyframe> =>\n !!value &&\n typeof (value as State<MotionKeyframe>).get === \"function\" &&\n (value as { _isState?: boolean })._isState === true;\n\nconst toStyles = (frame: MotionKeyframe): Keyframe => {\n const out: Record<string, string | number> = {};\n const transforms: string[] = [];\n for (const key in frame) {\n const value = frame[key];\n if (key === \"x\") {\n transforms.push(\n `translateX(${typeof value === \"number\" ? `${value}px` : value})`,\n );\n } else if (key === \"y\") {\n transforms.push(\n `translateY(${typeof value === \"number\" ? `${value}px` : value})`,\n );\n } else if (key === \"scale\") {\n transforms.push(`scale(${value})`);\n } else if (key === \"rotate\") {\n transforms.push(\n `rotate(${typeof value === \"number\" ? `${value}deg` : value})`,\n );\n } else {\n out[key] = value;\n }\n }\n if (transforms.length) out.transform = transforms.join(\" \");\n return out as Keyframe;\n};\n\n/**\n * Animation primitive driven by the Web Animations API. Runs an enter\n * animation on mount (`initial` -> `animate`), re-animates whenever `animate`\n * is a `State` that changes, and plays the `exit` keyframe before removal.\n * Has no host-tag restriction; apply to any element you want to animate.\n *\n * @param props - Optional configuration (see {@link MotionProps}).\n * @param props.initial - Starting keyframe applied before the enter animation.\n * @param props.animate - Target keyframe, or a `State` to re-animate on change.\n * @param props.exit - Keyframe animated to before the element is removed.\n * @param props.transition - Timing options.\n * @param props.transition.duration - Duration in ms. Defaults to `300`.\n * @param props.transition.delay - Delay in ms. Defaults to `0`.\n * @param props.transition.easing - CSS easing. Defaults to `\"ease\"`.\n * @param props.transition.iterations - Number of iterations. Defaults to `1`.\n * @example { div: \"Hello\", $: [motion({ initial: { opacity: 0 }, animate: { opacity: 1 } })] }\n */\nfunction prefersReducedMotion(): boolean {\n if (typeof matchMedia !== \"function\") return false;\n try {\n return matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n } catch {\n return false;\n }\n}\n\nfunction motion(props: MotionProps = {}): PartialElement {\n const { initial, animate, exit, transition = {} } = props;\n const options: KeyframeAnimationOptions = {\n duration: transition.duration ?? 300,\n delay: transition.delay ?? 0,\n easing: transition.easing ?? \"ease\",\n iterations: transition.iterations ?? 1,\n fill: \"both\",\n };\n\n return {\n _onMount: (node) => {\n const el = node.domElement as HTMLElement | null;\n if (!el || typeof el.animate !== \"function\") return;\n const target = isState(animate) ? animate.get() : animate;\n // WCAG 2.3.3 / Front-End Checklist: respect prefers-reduced-motion.\n if (prefersReducedMotion()) {\n if (target) Object.assign(el.style, toStyles(target));\n else if (initial) Object.assign(el.style, toStyles(initial));\n if (isState(animate)) {\n const release = animate.addListener((next: MotionKeyframe) => {\n Object.assign(el.style, toStyles(next));\n });\n node.setMetadata(\"motionRelease\", release);\n }\n return;\n }\n if (target) {\n el.animate(\n initial ? [toStyles(initial), toStyles(target)] : [toStyles(target)],\n options,\n );\n } else if (initial) {\n Object.assign(el.style, toStyles(initial));\n }\n if (isState(animate)) {\n const release = animate.addListener((next: MotionKeyframe) => {\n el.animate([toStyles(next)], options);\n });\n node.setMetadata(\"motionRelease\", release);\n }\n },\n _onBeforeRemove: (node, done) => {\n const el = node.domElement as HTMLElement | null;\n if (!el || !exit || typeof el.animate !== \"function\") return done();\n if (prefersReducedMotion()) {\n Object.assign(el.style, toStyles(exit));\n return done();\n }\n el.animate([toStyles(exit)], options).finished.then(done, done);\n },\n _onRemove: (node) => {\n const release = node.getMetadata(\"motionRelease\") as\n | (() => void)\n | undefined;\n release?.();\n },\n };\n}\n\nexport { motion };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Themed ordered-list primitive: decimal markers positioned outside, reset\n * margins and themed text color. Apply to an `<ol>` element.\n *\n * @hostTag ol\n * @param props - Optional configuration.\n * @param props.color - Color tone for the list text. Defaults to `\"neutral\"`.\n * @example { ol: \"\", $: [orderedList()], children: [{ li: \"First\" }] }\n */\nfunction orderedList(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"ol\") {\n console.warn(`\"orderedList\" primitive patch must use ol tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) => themeColor(listener),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n marginTop: 0,\n marginBottom: 0,\n paddingLeft: themeSpacing(3),\n listStyleType: \"decimal\",\n listStylePosition: \"outside\",\n },\n };\n}\n\nexport { orderedList };\n","import {\n type DomphyElement,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\nfunction getPages(current: number, total: number): (number | \"...\")[] {\n if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);\n const pages: (number | \"...\")[] = [1];\n if (current > 3) pages.push(\"...\");\n const start = Math.max(2, current - 1);\n const end = Math.min(total - 1, current + 1);\n for (let i = start; i <= end; i++) pages.push(i);\n if (current < total - 2) pages.push(\"...\");\n pages.push(total);\n return pages;\n}\n\n/**\n * Themed pagination control. Renders previous/next buttons plus truncated page\n * numbers (with ellipses), tracks the current page in a `State`, and updates it\n * on click. Apply to a `<div>` element.\n *\n * @hostTag div\n * @param props - Configuration.\n * @param props.total - Required. Total number of pages.\n * @param props.value - Current page, accepts a value or `State`. Defaults to `1`.\n * @param props.color - Base color tone for the page buttons. Defaults to `\"neutral\"`.\n * @param props.accentColor - Accent color tone for the active page. Defaults to `\"primary\"`.\n * @example { div: \"\", $: [pagination({ total: 10, value: 1 })] }\n */\nfunction pagination(props: {\n value?: ValueOrState<number>;\n total: number;\n color?: ThemeColor;\n accentColor?: ThemeColor;\n}): PartialElement {\n const { total, color = \"neutral\", accentColor = \"primary\" } = props;\n const state = toState(props.value ?? 1);\n\n const btnBase = {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n minWidth: (listener: any) => themeSpacing(6 + themeDensity(listener) * 2),\n height: (listener: any) => themeSpacing(6 + themeDensity(listener) * 2),\n paddingInline: (listener: any) => themeSpacing(themeDensity(listener) * 2),\n borderRadius: (listener: any) => themeSpacing(themeDensity(listener) * 1.5),\n border: \"none\",\n cursor: \"pointer\",\n fontSize: (listener: any) => themeSize(listener, \"inherit\"),\n backgroundColor: \"transparent\",\n // Page numbers: shift-13 for readable inactive digits (catalog contrast).\n color: (listener: any) => themeColor(listener, \"shift-13\", color),\n transition:\n \"background-color 140ms ease, box-shadow 140ms ease, color 140ms ease\",\n \"&:hover:not([disabled])\": {\n color: (listener: any) => themeColor(listener, \"shift-13\", color),\n backgroundColor: (listener: any) => themeColor(listener, \"hover\", color),\n },\n \"&:focus-visible\": {\n boxShadow: (listener: any) => focusRing(listener, accentColor),\n },\n \"&[disabled]\": {\n opacity: 0.4,\n cursor: \"not-allowed\",\n },\n };\n\n const activeStyle = {\n ...btnBase,\n // Deep accent fill + light text (mid-ramp + mid text failed catalog).\n backgroundColor: (listener: any) =>\n themeColor(listener, \"shift-13\", accentColor),\n color: (listener: any) => themeColor(listener, \"shift-0\", \"neutral\"),\n fontWeight: \"bold\",\n cursor: \"default\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener: any) =>\n themeColor(listener, \"shift-13\", accentColor),\n },\n };\n\n return {\n role: \"navigation\",\n ariaLabel: \"Pagination\",\n // Active page weight is design-system chrome for the control.\n _doctorDisable: \"inline-typography\",\n _onInsert: (node) => {\n if (node.tagName !== \"div\")\n console.warn('\"pagination\" patch must use div tag');\n },\n _onInit: (node) => {\n const content: DomphyElement<\"div\"> = {\n div: (listener) => {\n const page = state.get(listener);\n const items: DomphyElement[] = [];\n\n // Prev button\n items.push({\n button: \"‹\",\n _key: \"prev\",\n type: \"button\",\n ariaLabel: \"Previous page\",\n disabled: page <= 1,\n onClick: () => page > 1 && state.set(page - 1),\n style: btnBase,\n });\n\n // Page buttons. Keyed by page number (or a running ellipsis index —\n // there can be up to two \"...\" spans) so the list survives length\n // changes across pages without the unkeyed-reuse footgun.\n let ellipsisIndex = 0;\n for (const p of getPages(page, total)) {\n if (p === \"...\") {\n items.push({\n span: \"…\",\n _key: `ellipsis-${ellipsisIndex++}`,\n ariaHidden: \"true\",\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n paddingInline: (listener: any) =>\n themeSpacing(themeDensity(listener) * 2),\n color: (listener: any) =>\n themeColor(listener, \"shift-7\", color),\n },\n });\n } else {\n const isActive = p === page;\n items.push({\n button: String(p),\n _key: `page-${p}`,\n type: \"button\",\n ariaLabel: `Page ${p}`,\n ariaCurrent: isActive ? \"page\" : undefined,\n disabled: isActive,\n onClick: () => state.set(p),\n style: isActive ? activeStyle : btnBase,\n });\n }\n }\n\n // Next button\n items.push({\n button: \"›\",\n _key: \"next\",\n type: \"button\",\n ariaLabel: \"Next page\",\n disabled: page >= total,\n onClick: () => page < total && state.set(page + 1),\n style: btnBase,\n });\n\n return items;\n },\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: themeSpacing(1),\n },\n };\n node.children.insert(content);\n },\n style: {\n display: \"inline-flex\",\n },\n };\n}\n\nexport { pagination };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * A padded section for side-panel/inspector UIs — density-aware padding on\n * all sides, with an optional bottom divider for sections stacked one after\n * another. A thin wrapper: it does not impose flex layout on its children —\n * pair it with `stack()` or `row()` for that. No host-tag check; apply to\n * any block element.\n *\n * @param props.padding - Spacing multiplier for padding on all sides (default 4 = 1em at density 1).\n * @param props.divider - Adds a bottom border, for sections stacked one after another. Defaults to `false`.\n * @param props.color - Theme color tone for the divider border. Defaults to `\"neutral\"`.\n * @example { div: [{ h3: \"Parameters\" }, { p: \"...\" }], $: [panelSection()] }\n * @example\n * { div: [\n * { div: \"Section A\", $: [panelSection({ divider: true })] },\n * { div: \"Section B\", $: [panelSection()] },\n * ], $: [stack({ gap: 0 })] }\n */\nfunction panelSection(\n props: {\n padding?: number;\n divider?: boolean;\n color?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const { padding = 4, divider = false } = props;\n const color = toState(props.color ?? \"neutral\", \"color\");\n return {\n style: {\n padding: (listener) => themeSpacing(themeDensity(listener) * padding),\n ...(divider\n ? {\n borderBottom: (listener) =>\n `1px solid ${themeColor(listener, \"border\", color.get(listener))}`,\n }\n : {}),\n },\n };\n}\n\nexport { panelSection };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSize } from \"@domphy/theme\";\n\n/**\n * Themed paragraph primitive: comfortable line-height, reset margins and themed\n * text color. Apply to a `<p>` element.\n *\n * @hostTag p\n * @param props - Optional configuration.\n * @param props.color - Color tone for the paragraph text. Defaults to `\"neutral\"`.\n * @example { p: \"Hello world\", $: [paragraph()] }\n */\nfunction paragraph(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"p\") {\n console.warn(`\"paragraph\" primitive patch must use p tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n lineHeight: 1.5,\n marginTop: 0,\n marginBottom: 0,\n },\n };\n}\n\nexport { paragraph };\n","import {\n type DomphyElement,\n type Listener,\n merge,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport type { Placement } from \"@domphy/floating\";\nimport { themeColor, themeDensity, themeSpacing } from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { createFloating } from \"../utils/floating.js\";\n\n/**\n * Floating popover primitive. Attaches to its host as the anchor/trigger and\n * shows a floating `content` element (with `role=\"dialog\"`) on click or hover,\n * positioned via `@domphy/floating`. Returns the anchor partial, which merges\n * trigger wiring (haspopup/expanded, focus/blur dismissal). Apply to the\n * trigger element you want the popover anchored to.\n *\n * @param props - Configuration.\n * @param props.openOn - Interaction that opens the popover: `\"click\"` or `\"hover\"`. Defaults to `\"click\"`.\n * @param props.open - Open state, accepts a value or `State`. Defaults to `false`.\n * @param props.placement - Floating placement (e.g. `\"bottom\"`, `\"top-start\"`), value or `State`. Defaults to `\"bottom\"`.\n * @param props.content - The floating content element to display.\n * @example { button: \"Open\", $: [popover({ openOn: \"click\", content: { div: \"Hi\" } })] }\n */\nfunction popover(props: {\n openOn?: \"click\" | \"hover\";\n open?: ValueOrState<boolean>;\n placement?: ValueOrState<Placement>;\n content: DomphyElement;\n}): PartialElement {\n const { open = false, placement = \"bottom\", openOn = \"click\" } = props;\n\n let popoverId: string | null = null;\n const openState = toState(open);\n const placeState = toState(placement);\n\n const { show, hide, anchorPartial } = createFloating({\n kind: \"popover\",\n open: openState,\n placement: placeState,\n content: props.content,\n // Hovering the panel itself (not just the trigger) must keep it open —\n // handled generically inside floating.ts's behavior instance.\n keepOpenOnContentHover: openOn === \"hover\",\n });\n\n const popoverPartial: PartialElement = {\n role: \"dialog\",\n dataTone: \"shift-14\",\n style: {\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\"),\n borderRadius: (l: Listener) => themeSpacing(themeDensity(l) * 2),\n outline: (l: Listener) => `1px solid ${themeColor(l, \"border-strong\")}`,\n outlineOffset: \"-1px\",\n boxShadow: elevation(\"medium\"),\n },\n _onInsert: (node) => {\n const id = node.attributes.get(\"id\");\n popoverId = id || node.nodeId;\n !id && node.attributes.set(\"id\", popoverId);\n },\n };\n\n props.content.$ ||= [];\n props.content.$.push(popoverPartial);\n\n const triggerPartial: PartialElement = {\n ariaHaspopup: \"dialog\",\n ariaExpanded: (listener) => openState.get(listener),\n onMouseEnter: (_e, node) => openOn === \"hover\" && show(node),\n onMouseLeave: (_e, node) => openOn === \"hover\" && hide(node),\n onClick: (_e, node) => {\n if (openOn === \"click\") {\n if (openState.get()) {\n hide(node);\n } else {\n show(node);\n }\n }\n },\n onKeyDown: (e, node) => {\n if ((e as KeyboardEvent).key === \"Escape\" && openState.get()) hide(node);\n },\n onFocus: (_e, node) => openOn === \"hover\" && show(node),\n onBlur: (e, node) => {\n const related = (e as FocusEvent).relatedTarget as Node | null;\n const root = node.getRoot().domElement as Element;\n const floatingEl = popoverId\n ? root.querySelector(`#${CSS.escape(popoverId)}`)\n : null;\n if (related && floatingEl?.contains(related)) return;\n hide(node);\n },\n _onMount: (node) =>\n popoverId && node.attributes.set(\"ariaControls\", popoverId),\n };\n merge(anchorPartial, triggerPartial);\n\n return anchorPartial;\n}\n\nexport { popover };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport type { Placement } from \"@domphy/floating\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Renders a small rotated arrow (via a `::after` pseudo-element) that points from a\n * popover/tooltip toward its anchor, positioned and oriented based on the floating placement.\n * The arrow direction is computed by flipping the given placement. No host-tag check is\n * performed; apply it to the popover container element.\n *\n * @param props.placement - Floating placement the popover sits at; the arrow is drawn on the\n * opposite (flipped) side. Accepts a value or reactive state. Defaults to `\"bottom-end\"`.\n * One of: `top` | `bottom` | `left` | `right` | `top-start` | `top-end` | `bottom-start` |\n * `bottom-end` | `left-start` | `left-end` | `right-start` | `right-end`.\n * @param props.sideOffset - CSS length used to offset the arrow toward the start/end edge.\n * Defaults to `themeSpacing(6)`.\n * @param props.color - Theme color tone for the arrow fill and border. Defaults to `\"neutral\"`.\n * @param props.bordered - Whether the arrow draws a 1px border (set to `0px` when false).\n * Defaults to `true`.\n * @example { div: [...], $: [popoverArrow({ placement: \"top\" })] }\n */\nfunction popoverArrow(\n props: {\n placement?: ValueOrState<Placement>;\n sideOffset?: string;\n color?: ThemeColor;\n bordered?: boolean;\n } = {},\n): PartialElement {\n const {\n placement = \"bottom-end\",\n color = \"neutral\",\n sideOffset = themeSpacing(6),\n bordered = true,\n } = props;\n\n const place = toState(placement);\n\n const flipMap: Record<Placement, Placement> = {\n top: \"bottom\",\n bottom: \"top\",\n left: \"right\",\n right: \"left\",\n \"top-start\": \"bottom-end\",\n \"top-end\": \"bottom-start\",\n \"bottom-start\": \"top-end\",\n \"bottom-end\": \"top-start\",\n \"left-start\": \"right-end\",\n \"left-end\": \"right-start\",\n \"right-start\": \"left-end\",\n \"right-end\": \"left-start\",\n };\n\n const getFlipped = (listener: any) =>\n flipMap[place.get(listener)] ?? flipMap[\"bottom-end\"];\n const start = (pos: string) =>\n pos.includes(\"start\") ? sideOffset : pos.includes(\"end\") ? \"auto\" : \"50%\";\n const end = (pos: string) =>\n pos.includes(\"end\") ? sideOffset : pos.includes(\"start\") ? \"auto\" : \"50%\";\n\n return {\n style: {\n fontSize: (listener) => themeSize(listener),\n backgroundColor: (listener) => themeColor(listener),\n color: (listener) => themeColor(listener, \"text\", color),\n position: \"relative\",\n \"&::after\": {\n content: `\"\"`,\n position: \"absolute\",\n width: themeSpacing(1.5),\n height: themeSpacing(1.5),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n borderWidth: bordered ? \"1px\" : 0,\n borderColor: (listener) => themeColor(listener, \"border-strong\", color),\n borderTopStyle: (listener) => {\n const pos = getFlipped(listener);\n\n return pos.includes(\"top\") || pos.includes(\"right\")\n ? `solid`\n : \"none\";\n },\n borderBottomStyle: (listener) => {\n const pos = getFlipped(listener);\n\n return pos.includes(\"bottom\") || pos.includes(\"left\")\n ? `solid`\n : \"none\";\n },\n borderLeftStyle: (listener) => {\n const pos = getFlipped(listener);\n return pos.includes(\"top\") || pos.includes(\"left\") ? `solid` : \"none\";\n },\n borderRightStyle: (listener) => {\n const pos = getFlipped(listener);\n return pos.includes(\"bottom\") || pos.includes(\"right\")\n ? `solid`\n : \"none\";\n },\n top: (listener) => {\n const pos = getFlipped(listener);\n return pos.includes(\"top\")\n ? 0\n : pos.includes(\"bottom\")\n ? \"auto\"\n : start(pos);\n },\n right: (listener) => {\n const pos = getFlipped(listener);\n return pos.includes(\"right\")\n ? 0\n : pos.includes(\"left\")\n ? \"auto\"\n : end(pos);\n },\n bottom: (listener) => {\n const pos = getFlipped(listener);\n return pos.includes(\"bottom\")\n ? 0\n : pos.includes(\"top\")\n ? \"auto\"\n : end(pos);\n },\n left: (listener) => {\n const pos = getFlipped(listener);\n return pos.includes(\"left\")\n ? 0\n : pos.includes(\"right\")\n ? \"auto\"\n : start(pos);\n },\n transform: (listener) => {\n const pos = getFlipped(listener);\n const x =\n pos.includes(\"right\") ||\n (pos.includes(\"end\") && !pos.includes(\"left\"))\n ? \"50%\"\n : \"-50%\";\n const y =\n pos.includes(\"bottom\") ||\n (pos.includes(\"end\") && !pos.includes(\"top\"))\n ? \"50%\"\n : \"-50%\";\n return `translate(${x},${y}) rotate(45deg)`;\n },\n },\n },\n };\n}\n\nexport { popoverArrow };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles a preformatted text block: inherited font size, themed foreground/background,\n * no border, density-scaled padding and rounded corners.\n *\n * @hostTag pre\n * @param props.color - Theme color tone for text and background. Accepts a value or reactive\n * state. Defaults to `\"neutral\"`.\n * @example { pre: \"const x = 1\", $: [preformated()] }\n */\nfunction preformated(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n dataTone: \"shift-2\",\n _onInsert: (node) => {\n if (node.tagName !== \"pre\") {\n console.warn(`\"preformated\" primitive patch must use pre tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n border: \"none\",\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n },\n };\n}\n\nexport { preformated };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\n\n/**\n * Styles a native progress bar: full-width, pill-shaped track with a themed fill,\n * including the WebKit progress-bar/value pseudo-elements and a width transition.\n *\n * @hostTag progress\n * @param props.color - Theme color tone for the track/background. Accepts a value or reactive\n * state. Defaults to `\"neutral\"`.\n * @param props.accentColor - Theme color tone for the filled value. Accepts a value or reactive\n * state. Defaults to `\"primary\"`.\n * @example { progress: null, value: 40, max: 100, $: [progress()] }\n */\nfunction progress(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"progress\") {\n console.warn(`\"progress\" primitive patch must use progress tag`);\n }\n },\n // Track surface — shift via dataTone, paint with inherit.\n dataTone: \"shift-3\",\n style: {\n appearance: \"none\",\n width: \"100%\",\n height: themeSpacing(2),\n border: 0,\n borderRadius: themeSpacing(999),\n overflow: \"hidden\",\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n \"&::-webkit-progress-bar\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n borderRadius: themeSpacing(999),\n },\n \"&::-webkit-progress-value\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-9\", accentColor.get(listener)),\n borderRadius: themeSpacing(999),\n transition: \"width 220ms ease\",\n },\n },\n };\n}\n\nexport { progress };\n","import {\n type DomphyElement,\n type Listener,\n type PartialElement,\n rawHtml,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\nconst STAR_FILLED =\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\" width=\"1em\" height=\"1em\">` +\n `<path d=\"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z\"/>` +\n `</svg>`;\nconst STAR_EMPTY =\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\" width=\"1em\" height=\"1em\">` +\n `<path d=\"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z\"/>` +\n `</svg>`;\n\n/**\n * Interactive star rating applied to a container `<div>`. Manages its own star\n * children: click to set, Arrow keys to adjust, hover to preview. In `readOnly`\n * mode stars are non-interactive. Apply to a `<div>` element.\n *\n * @hostTag div\n * @param props.value - Current rating (0 – max). `ValueOrState<number>`, defaults to `0`.\n * @param props.max - Total number of stars. Optional `number`, defaults to `5`.\n * @param props.onChange - Called with the new value when the user picks a star.\n * @param props.readOnly - Disable interaction. Optional `boolean`, defaults to `false`.\n * @param props.color - Star color tone. Optional `ThemeColor`, defaults to `\"warning\"`.\n * @example { div: null, $: [rating({ value: ratingState, onChange: (v) => ratingState.set(v) })] }\n */\nfunction rating(\n props: {\n value?: ValueOrState<number>;\n max?: number;\n onChange?: (value: number) => void;\n readOnly?: boolean;\n color?: ThemeColor;\n } = {},\n): PartialElement {\n const { max = 5, readOnly = false, onChange } = props;\n const color = props.color ?? \"warning\";\n const valueState = toState(props.value ?? 0);\n // Hover preview only — never reported via onChange, only affects display.\n const hoveredState = toState(0);\n\n const activeCount = (listener: Listener) => {\n const hovered = hoveredState.get(listener);\n return hovered > 0 ? hovered : valueState.get(listener);\n };\n\n return {\n role: \"group\",\n ariaLabel: \"Rating\",\n style: {\n display: \"inline-flex\",\n gap: themeSpacing(0.5),\n // 1.5× inherited control size (theme-owned type scale, not a px/rem literal).\n fontSize: (listener) => themeSize(listener, \"increase-1\"),\n cursor: readOnly ? \"default\" : \"pointer\",\n color: (listener) => themeColor(listener, \"muted\", color),\n },\n // Build stars as real child elements (not imperative DOM mutation in\n // _onMount) so generateHTML()/SSR emits the actual star markup.\n _onInit: (node) => {\n for (let i = 1; i <= max; i++) {\n const index = i;\n const interactive = readOnly\n ? {}\n : {\n onClick: () => {\n const next = index === valueState.get() ? 0 : index;\n valueState.set(next);\n onChange?.(next);\n hoveredState.set(0);\n },\n onMouseEnter: () => hoveredState.set(index),\n onMouseLeave: () => hoveredState.set(0),\n onKeyDown: (e: KeyboardEvent) => {\n const current = valueState.get();\n let next = current;\n if (e.key === \"ArrowRight\" || e.key === \"ArrowUp\") {\n next = Math.min(max, current + 1);\n e.preventDefault();\n } else if (e.key === \"ArrowLeft\" || e.key === \"ArrowDown\") {\n next = Math.max(0, current - 1);\n e.preventDefault();\n } else {\n return;\n }\n valueState.set(next);\n onChange?.(next);\n const target = next > 0 ? next - 1 : 0;\n (node.domElement?.children[target] as HTMLElement)?.focus();\n },\n };\n\n const star: DomphyElement<\"button\"> = {\n button: (listener) =>\n rawHtml(\n index <= activeCount(listener) ? STAR_FILLED : STAR_EMPTY,\n ),\n _key: index,\n type: \"button\",\n ariaLabel: `${index} star${index > 1 ? \"s\" : \"\"}`,\n ...interactive,\n style: {\n background: \"none\",\n border: \"none\",\n outline: \"none\",\n borderRadius: themeSpacing(1),\n padding: 0,\n cursor: \"inherit\",\n color: \"inherit\",\n fontSize: \"inherit\",\n display: \"flex\",\n alignItems: \"center\",\n transition: \"box-shadow 140ms ease\",\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color),\n },\n },\n };\n node.children.insert(star);\n }\n },\n };\n}\n\nexport { rating };\n","import type { PartialElement, StyleObject } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\n\n/**\n * Circular ring progress indicator rendered via CSS `conic-gradient` and a\n * circular `mask`. Progress starts at 12 o'clock and advances clockwise.\n * Exposes `role=\"progressbar\"` with `aria-valuenow/min/max`. Apply to a `<div>`.\n *\n * @hostTag div\n * @param props.value - Progress percentage 0–100. Accepts a value or reactive state. Defaults to `0`.\n * @param props.color - Theme color for the filled arc. Accepts a value or reactive state. Defaults to `\"primary\"`.\n * @param props.trackColor - Theme color for the background track. Accepts a value or reactive state. Defaults to `\"neutral\"`.\n * @param props.size - Diameter in `themeSpacing` units. Defaults to `16` (= `4em`).\n * @param props.thickness - Ring stroke as a fraction of the radius (0–0.5). Defaults to `0.25`.\n * @example { div: null, $: [ringProgress({ value: 65 })] }\n * @example { div: null, $: [ringProgress({ value: loadingState, color: \"success\", size: 20 })] }\n */\nfunction ringProgress(\n props: {\n value?: ValueOrState<number>;\n color?: ValueOrState<ThemeColor>;\n trackColor?: ValueOrState<ThemeColor>;\n size?: number;\n thickness?: number;\n } = {},\n): PartialElement {\n const { size = 16, thickness = 0.25 } = props;\n const value = toState(props.value ?? 0, \"value\");\n const color = toState(props.color ?? \"primary\", \"color\");\n const trackColor = toState(props.trackColor ?? \"neutral\", \"trackColor\");\n\n // Mask cuts the center to create a donut shape.\n // Uses `closest-side` so the gradient circle matches the visible element circle\n // exactly, making `holePercent` directly represent the fraction of outer radius.\n const holePercent = Math.round((1 - thickness) * 100);\n const mask = `radial-gradient(circle closest-side, transparent ${holePercent}%, black ${holePercent}%)`;\n\n return {\n role: \"progressbar\",\n ariaValuenow: (l) => String(Math.round(value.get(l))),\n ariaValuemin: \"0\",\n ariaValuemax: \"100\",\n _onInsert: (node) => {\n if (node.tagName !== \"div\") {\n console.warn('\"ringProgress\" patch must use div tag');\n }\n },\n style: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: themeSpacing(size),\n height: themeSpacing(size),\n borderRadius: \"50%\",\n // Text color tracks the filled arc so any overlay label inherits it.\n color: (l) => themeColor(l, \"shift-9\", color.get(l)),\n // Fill arc from 12 o'clock clockwise; `from -90deg` rotates the start point.\n background: (l) =>\n `conic-gradient(from -90deg, ${themeColor(l, \"shift-9\", color.get(l))} ${value.get(l)}%, ${themeColor(l, \"shift-3\", trackColor.get(l))} 0%)`,\n WebkitMask: mask,\n mask,\n } as StyleObject,\n };\n}\n\nexport { ringProgress };\n","import type { PartialElement } from \"@domphy/core\";\nimport { themeDensity, themeSpacing } from \"@domphy/theme\";\nimport type { FlexAlign } from \"./stack.js\";\n\ntype FlexJustify =\n | \"flex-start\"\n | \"center\"\n | \"flex-end\"\n | \"space-between\"\n | \"space-around\"\n | \"space-evenly\";\n\n/**\n * A horizontal flex row with spacing between children, vertically centered by\n * default. The general-purpose primitive for icon+label rows, field rows,\n * and button groups — instead of hand-rolling `display: flex; alignItems:\n * center; gap: ...`. `toolbar()` is a semantic alias of this same shape for\n * headers/nav bars. Styles the host only; apply to any block element.\n *\n * @param props.gap - Spacing multiplier for gap between items (default 4 = 1em at density 1).\n * @param props.align - Cross-axis alignment (`alignItems`). Defaults to `\"center\"`.\n * @param props.justify - Main-axis distribution (`justifyContent`). Unset by default (flex-start).\n * @param props.wrap - Allow items to wrap onto multiple lines. Defaults to `false`.\n * @example { div: [{ span: \"Icon\" }, { span: \"Label\" }], $: [row()] }\n * @example { div: [...], $: [row({ justify: \"space-between\", wrap: true })] }\n */\nfunction row(\n props: {\n gap?: number;\n align?: FlexAlign;\n justify?: FlexJustify;\n wrap?: boolean;\n } = {},\n): PartialElement {\n const { gap = 4, align = \"center\", justify, wrap = false } = props;\n return {\n style: {\n display: \"flex\",\n alignItems: align,\n gap: (listener) => themeSpacing(themeDensity(listener) * gap),\n ...(justify ? { justifyContent: justify } : {}),\n ...(wrap ? { flexWrap: \"wrap\" } : {}),\n },\n };\n}\n\nexport { row };\nexport type { FlexJustify };\n","import type { PartialElement, StyleObject } from \"@domphy/core\";\nimport { toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\n\n/**\n * Applies thin, themed overlay scrollbars to any scrollable container.\n * Covers WebKit (Chrome/Safari/Edge) via `::-webkit-scrollbar` pseudo-elements\n * and Firefox via `scrollbar-width`/`scrollbar-color`. Sets `overflow: auto`.\n * No host-tag check; apply to any block element.\n *\n * @param props.color - Theme color for the scrollbar thumb. Accepts a value or\n * reactive state. Defaults to `\"neutral\"`.\n * @example { div: [...], style: { maxHeight: \"300px\" }, $: [scrollArea()] }\n */\nfunction scrollArea(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n style: {\n overflow: \"auto\",\n // Container text color so theme token usage also carries a reactive `color`.\n color: (l) => themeColor(l, \"text\", color.get(l)),\n \"&::-webkit-scrollbar\": {\n width: themeSpacing(2),\n height: themeSpacing(2),\n },\n \"&::-webkit-scrollbar-track\": {\n background: \"transparent\",\n },\n \"&::-webkit-scrollbar-thumb\": {\n backgroundColor: (l) => themeColor(l, \"shift-5\", color.get(l)),\n borderRadius: themeSpacing(999),\n // Transparent border creates visual padding around the thumb.\n border: `${themeSpacing(0.5)} solid transparent`,\n backgroundClip: \"content-box\",\n },\n \"&::-webkit-scrollbar-thumb:hover\": {\n backgroundColor: (l) => themeColor(l, \"shift-7\", color.get(l)),\n },\n // Firefox thin scrollbar with matching thumb/track colors.\n scrollbarWidth: \"thin\",\n scrollbarColor: (l) =>\n `${themeColor(l, \"shift-5\", color.get(l))} transparent`,\n } as StyleObject,\n };\n}\n\nexport { scrollArea };\n","import {\n type DomphyElement,\n type Listener,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/** One item inside a segmented control. */\ntype SegmentedItem = {\n /** Button label — plain string (auto-wrapped) or any DomphyElement. */\n label: string | DomphyElement;\n /** Stable key. Defaults to the item's zero-based index. */\n key?: string;\n};\n\n/**\n * All-in-one single-select segmented control. Generates `<button>` option\n * elements from the `items` array. Apply to any wrapper element.\n *\n * @param props.items - Item definitions `{ label, key? }`.\n * @param props.value - Initially selected key (value or State). Defaults to the first item's key.\n * @param props.color - Theme color for the control background. Defaults to `\"neutral\"`.\n * @param props.accentColor - Theme color for the selected item. Defaults to `\"primary\"`.\n * @example\n * { div: null, $: [segmented({ items: [\n * { label: \"Day\", key: \"day\" },\n * { label: \"Month\", key: \"month\" },\n * { label: \"Year\", key: \"year\" },\n * ] })] }\n */\nfunction segmented(\n props: {\n items: SegmentedItem[];\n value?: ValueOrState<string>;\n color?: ThemeColor;\n accentColor?: ThemeColor;\n } = { items: [] },\n): PartialElement {\n const { items = [], color = \"neutral\", accentColor = \"primary\" } = props;\n const value = toState(props.value ?? items[0]?.key ?? \"\");\n\n return {\n role: \"radiogroup\",\n // Expose value in context so segmentedItem() escape-hatch still works.\n _context: { segmented: { value } },\n _onSchedule: (node, element) => {\n const buttons: DomphyElement<\"button\">[] = items.map((item, index) => {\n const key = item.key ?? String(index);\n const labelEl: DomphyElement =\n typeof item.label === \"string\"\n ? ({ span: item.label } as DomphyElement<\"span\">)\n : item.label;\n\n return {\n button: [labelEl],\n _key: key,\n type: \"button\",\n role: \"radio\",\n ariaChecked: (l: Listener) => value.get(l) === key,\n onClick: () => value.set(key),\n style: {\n cursor: \"pointer\",\n fontSize: (l: Listener) => themeSize(l, \"inherit\"),\n height: themeSpacing(6),\n paddingBlock: themeSpacing(1),\n paddingInline: themeSpacing(3),\n border: \"none\",\n borderRadius: themeSpacing(10),\n color: (l: Listener) => themeColor(l, \"text\", color),\n backgroundColor: \"transparent\",\n transition:\n \"background-color 140ms ease, color 140ms ease, box-shadow 140ms ease\",\n \"&:hover:not([disabled]):not([aria-checked=true])\": {\n backgroundColor: (l: Listener) => themeColor(l, \"shift-3\", color),\n },\n \"&:active:not([disabled]):not([aria-checked=true])\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"increase-2\", color),\n },\n \"&[aria-checked=true]\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-0\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-10\", accentColor),\n // Selected segment sits slightly above the track.\n boxShadow: elevation(\"low\"),\n },\n \"&:focus-visible\": {\n boxShadow: (l: Listener) => focusRing(l, accentColor),\n },\n \"&[aria-checked=true]:focus-visible\": {\n boxShadow: (l: Listener) =>\n `${elevation(\"low\")}, ${focusRing(l, accentColor)}`,\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n },\n },\n } as DomphyElement<\"button\">;\n });\n\n (element as any)[node.tagName] = buttons;\n },\n // Track is a soft surface anchor — shift via dataTone, paint with inherit.\n dataTone: \"shift-2\",\n style: {\n display: \"inline-flex\",\n paddingBlock: themeSpacing(1),\n paddingInline: themeSpacing(1),\n gap: themeSpacing(0.5),\n borderRadius: themeSpacing(10),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\", color),\n color: (l: Listener) => themeColor(l, \"text\", color),\n },\n };\n}\n\nexport { segmented };\nexport type { SegmentedItem };\n","import type { Listener, PartialElement } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeColorToken,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a native `<select>` control: removes the default appearance, applies themed\n * colors, outline, density-scaled padding/radius, a custom chevron background icon, and\n * hover/focus/disabled/optgroup/option states.\n *\n * @hostTag select\n * @param props.color - Theme color tone for text, background and outline. Defaults to `\"neutral\"`.\n * @param props.accentColor - Theme color tone for hover/focus outlines. Defaults to `\"primary\"`.\n * @example { select: [{ option: \"A\" }], $: [select()] }\n */\nfunction select(\n props: { color?: ThemeColor; accentColor?: ThemeColor } = {},\n): PartialElement {\n const { color = \"neutral\", accentColor = \"primary\" } = props;\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"select\") {\n console.warn(`\"select\" primitive patch must use select tag`);\n }\n },\n style: {\n appearance: \"none\",\n fontFamily: \"inherit\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n lineHeight: \"inherit\",\n color: (listener) => themeColor(listener, \"text\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color)}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingLeft: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingRight: (listener) => themeSpacing(themeDensity(listener) * 5),\n backgroundImage: (l: Listener) => {\n const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 10 6\"><path d=\"M1 1l4 4 4-4\" stroke=\"${themeColorToken(l, \"shift-7\")}\" stroke-width=\"1.5\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>`;\n return `url(\"data:image/svg+xml,${encodeURIComponent(svg)}\")`;\n },\n backgroundRepeat: \"no-repeat\",\n backgroundPosition: `right ${themeSpacing(2)} center`,\n backgroundSize: `${themeSpacing(2.5)} ${themeSpacing(1.5)}`,\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&:not([multiple])\": {\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-5\", accentColor)}`,\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor),\n },\n \"& optgroup\": {\n color: (listener) => themeColor(listener, \"shift-11\", color),\n },\n \"& option[disabled]\": {\n color: (listener) => themeColor(listener, \"shift-7\", \"neutral\"),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n },\n },\n };\n}\n\nexport { select };\n","import {\n type DomphyElement,\n merge,\n type PartialElement,\n type StyleObject,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport type { Placement } from \"@domphy/floating\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { createFloating } from \"../utils/floating.js\";\nimport { focusRing } from \"../utils/focusRing.js\";\nimport { tag } from \"./tag.js\";\n\n/**\n * A clickable select trigger box that renders the currently selected option(s) as removable\n * tags and toggles a floating popover (the dropdown content) anchored to itself. Selected\n * labels are derived from `options` matching the bound `value`; removing a tag updates the value.\n *\n * @hostTag div\n * @param props.multiple - Whether multiple selection is allowed (renders removable tags and\n * keeps the popover open on click). Defaults to `false`.\n * @param props.value - Bound selection value(s). Accepts a value or reactive state of an array of\n * `number | string | null | undefined`, or a single `number | string | null | undefined`.\n * @param props.options - List of `{ label, value }` options used to resolve selected labels.\n * Defaults to `[]`.\n * @param props.placement - Floating placement of the dropdown popover. Accepts a value or\n * reactive state. Defaults to `\"bottom\"`.\n * @param props.content - Required. The popover/dropdown content element shown when open.\n * @param props.color - Theme color tone for the box text/background. Defaults to `\"neutral\"`.\n * @param props.open - Whether the popover is open. Accepts a value or reactive state. Defaults to `false`.\n * @example { div: null, $: [selectBox({ content: { div: [...] }, options: [{ label: \"A\", value: \"a\" }] })] }\n */\nfunction selectBox(props: {\n multiple?: boolean;\n value?: ValueOrState<\n | Array<number | string | null | undefined>\n | number\n | string\n | null\n | undefined\n >;\n options?: Array<{ label: string; value: string }>;\n placement?: ValueOrState<Placement>;\n content: DomphyElement;\n color?: ThemeColor;\n open?: ValueOrState<boolean>;\n}): PartialElement {\n const {\n options = [],\n placement = \"bottom\",\n color = \"neutral\",\n open = false,\n multiple = false,\n } = props;\n\n const state = toState(props.value);\n const openState = toState(open);\n const { show, hide, anchorPartial } = createFloating({\n kind: \"selectBox\",\n open: openState,\n placement: toState(placement),\n content: props.content,\n });\n\n const popoverPartial: PartialElement = {\n onClick: (_e, node) => !multiple && hide(node),\n dataTone: \"shift-14\",\n style: {\n backgroundColor: (listener) => themeColor(listener, \"inherit\"),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\")}`,\n outlineOffset: \"-1px\",\n boxShadow: elevation(\"medium\"),\n },\n };\n\n merge(props.content, popoverPartial);\n\n const wrap: DomphyElement<\"div\"> = {\n div: (listener) => {\n const val = state.get(listener);\n const vals = Array.isArray(val) ? val : [val];\n const opts = options.filter((opt) => vals.includes(opt.value));\n return opts.map((opt) => ({\n span: opt.label,\n $: [tag({ color, removable: multiple })],\n _key: opt.value,\n _onRemove: (_node) => {\n const cur = state.get();\n const curVals = Array.isArray(cur) ? cur : [cur];\n const filter = curVals.filter((v) => v !== opt.value);\n multiple ? state.set(filter as any) : state.set(filter[0] as any);\n },\n })) as DomphyElement<\"span\">[];\n },\n style: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: themeSpacing(1),\n flex: 1,\n } as StyleObject,\n };\n\n const partial: PartialElement = {\n _onInsert: (node) => {\n if (node.tagName !== \"div\") {\n console.warn(`\"selectBox\" patch must use div tag`);\n }\n },\n _onInit: (node) => node.children.insert(wrap),\n onClick: (_e, node) => (openState.get() ? hide(node) : show(node)),\n // Focusable trigger for keyboard users (click already toggles open).\n tabindex: 0,\n style: {\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n minHeight: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n minWidth: themeSpacing(32),\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 2),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n transition:\n \"background-color 140ms ease, outline-color 140ms ease, box-shadow 140ms ease\",\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, color),\n },\n },\n };\n\n merge(anchorPartial, partial);\n return anchorPartial;\n}\n\nexport { selectBox };\n","import type { PartialElement } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * A single selectable option row (`role=\"option\"`) for use inside a `selectList`. Reads the\n * `select` context to reflect/toggle selection: it sets `aria-selected` from the bound value and\n * toggles the value (single or multiple) on click. Styles hover/selected/focus states.\n *\n * @hostTag div\n * @param props.accentColor - Theme color tone for the selected/focus state. Defaults to `\"primary\"`.\n * @param props.color - Theme color tone for text/background. Defaults to `\"neutral\"`.\n * @param props.value - The option value compared against and written to the select state.\n * Defaults to `null`.\n * @example { div: \"Option A\", $: [selectItem({ value: \"a\" })] }\n */\nfunction selectItem(\n props: {\n accentColor?: ThemeColor;\n color?: ThemeColor;\n value?: number | string;\n } = {},\n): PartialElement {\n const { accentColor = \"primary\", color = \"neutral\", value = null } = props;\n\n const partial: PartialElement = {\n role: \"option\",\n _onInit: (node) => {\n if (node.tagName !== \"div\") {\n console.warn(`\"selectItem\" patch must use div tag`);\n }\n const select = node.getContext(\"select\");\n if (select) {\n const state = select.value;\n node.attributes.set(\"ariaSelected\", (listener) => {\n const val = state.get(listener);\n return select.multiple ? val.includes(value) : val === value;\n });\n node.addEvent(\"click\", () => {\n const val = state.get();\n if (select.multiple) {\n val.includes(value)\n ? state.set(val.filter((v: number | string) => v !== value))\n : state.set(val.concat([value]));\n } else {\n val !== value && state.set(value);\n }\n });\n }\n },\n style: {\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n border: \"none\",\n outline: \"none\",\n color: (listener) => themeColor(listener, \"text\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n \"&:hover:not([disabled]):not([aria-selected=true])\": {\n backgroundColor: (listener) => themeColor(listener, \"hover\", color),\n },\n \"&[aria-selected=true]\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-6\", accentColor),\n color: (listener) => themeColor(listener, \"shift-11\"),\n },\n transition: \"background-color 140ms ease, box-shadow 140ms ease\",\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor),\n },\n },\n };\n return partial;\n}\n\nexport { selectItem };\n","import {\n type DomphyElement,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Container for a list of `selectItem`s that owns the selection state. It exposes a `select`\n * context (`{ value, multiple }`) consumed by child items, and injects hidden `<input>`(s)\n * carrying the selected value(s) under `name` for form submission.\n *\n * @hostTag div\n * @param props.multiple - Whether multiple selection is allowed; also sets the default empty\n * value (`[]` vs `null`). Defaults to `false`.\n * @param props.value - Bound selection value(s). Accepts a value or reactive state of an array of\n * `number | string | null`, or a single `number | string | null`. Defaults to `[]` when\n * `multiple`, otherwise `null`.\n * @param props.color - Theme color tone for the background. Defaults to `\"neutral\"`.\n * @param props.name - Name attribute for the hidden inputs (form field name).\n * @example { div: [{ div: \"A\", $: [selectItem({ value: \"a\" })] }], $: [selectList({ name: \"pick\" })] }\n */\nfunction selectList(\n props: {\n multiple?: boolean;\n value?: ValueOrState<\n Array<number | string | null> | number | string | null\n >;\n color?: ThemeColor;\n name?: string;\n } = {},\n): PartialElement {\n const { color = \"neutral\", multiple = false } = props;\n const state = toState(props.value ?? (multiple ? [] : null));\n\n const inputs: DomphyElement<\"div\"> = {\n div: (listener) => {\n const val = state.get(listener);\n const vals = Array.isArray(val) ? val : [val];\n return vals.map((v) => ({\n input: null,\n name: props.name,\n // Preserve a legitimate numeric 0 (and other falsy-but-valid values);\n // `v || \"\"` would drop them.\n value: v == null ? \"\" : String(v),\n }));\n },\n hidden: true,\n };\n\n const partial: PartialElement = {\n dataTone: \"shift-0\",\n _context: {\n select: {\n value: state,\n multiple,\n },\n },\n _onInit: (node) => {\n if (node.tagName !== \"div\") {\n console.warn(`\"selectList\" patch must use a div tag`);\n }\n node.children.insert(inputs);\n },\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 2),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n color: (listener) => themeColor(listener, \"text\", color),\n },\n };\n return partial;\n}\n\nexport { selectList };\n","import {\n hashString,\n type PartialElement,\n type StyleObject,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * A loading placeholder block with a left-to-right shimmer gradient. Marked\n * `aria-hidden`, themed background/foreground, fixed height, slight rounding.\n * No host-tag check; typically applied to a block-level element such as a\n * `div` or `span`.\n *\n * @param props.color - Theme color tone for the placeholder. Accepts a value or reactive state.\n * Defaults to `\"neutral\"`.\n * @example { div: null, $: [skeleton()] }\n */\nfunction skeleton(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n // Shimmer sweeps left→right over a near-white base (reads as loading, not\n // a flat opacity blink). Base + highlight are both theme tokens so the\n // effect adapts to light/dark surfaces. Highlight stays close to the base\n // (shift-2) — a deeper step reads as dirty banding on light themes.\n const keyframes = {\n \"0%\": { backgroundPosition: \"200% 0\" },\n \"100%\": { backgroundPosition: \"-200% 0\" },\n };\n const animationName = hashString(JSON.stringify(keyframes));\n return {\n ariaHidden: \"true\",\n dataTone: \"shift-1\",\n style: {\n fontSize: (listener) => themeSize(listener),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n height: themeSpacing(6),\n display: \"block\",\n borderRadius: themeSpacing(1),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n backgroundImage: (listener) =>\n `linear-gradient(90deg, ${themeColor(listener, \"inherit\", color.get(listener))} 0%, ${themeColor(listener, \"shift-2\", color.get(listener))} 50%, ${themeColor(listener, \"inherit\", color.get(listener))} 100%)`,\n backgroundSize: \"200% 100%\",\n animation: `${animationName} 1.6s ease-in-out infinite`,\n [`@keyframes ${animationName}`]: keyframes,\n } as StyleObject,\n };\n}\n\nexport { skeleton };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSize } from \"@domphy/theme\";\n\n/**\n * Styles small/secondary text: one step smaller font size (`data-size=\"decrease-1\"`) with a\n * themed foreground color.\n *\n * @hostTag small\n * @param props.color - Theme color tone for the text. Accepts a value or reactive state.\n * Defaults to `\"neutral\"`.\n * @example { small: \"fine print\", $: [small()] }\n */\nfunction small(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"small\") {\n console.warn('\"small\" patch must use small tag');\n }\n },\n dataSize: \"decrease-1\",\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n // shift-10 (not muted/shift-8) keeps WCAG AA ≥4.5:1 on light surfaces for small type.\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n },\n };\n}\n\nexport { small };\n","import type { PartialElement, StyleObject } from \"@domphy/core\";\nimport { hashString, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\nconst keyframes = { to: { transform: \"rotate(360deg)\" } };\nconst animationName = hashString(JSON.stringify(keyframes));\n\n/**\n * A circular loading spinner: a themed ring with a contrasting top border that rotates\n * continuously. Marked `role=\"status\"` with `aria-label=\"loading\"`.\n *\n * @hostTag span\n * @param props.color - Theme color tone for the ring/highlight. Accepts a value or reactive\n * state. Defaults to `\"neutral\"`.\n * @example { span: null, $: [spinner()] }\n */\nfunction spinner(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n role: \"status\",\n ariaLabel: \"loading\",\n _onInsert: (node) => {\n if (node.tagName !== \"span\") {\n console.warn(`\"spinner\" patch must use span tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener),\n backgroundColor: (listener) => themeColor(listener),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n display: \"inline-block\",\n margin: 0,\n flexShrink: 0,\n width: themeSpacing(6),\n height: themeSpacing(6),\n borderRadius: \"50%\",\n border: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n borderTopColor: (listener) =>\n themeColor(listener, \"shift-9\", color.get(listener)),\n boxSizing: \"border-box\",\n padding: 0,\n animation: `${animationName} 0.7s linear infinite`,\n [`@keyframes ${animationName}`]: keyframes,\n } as StyleObject,\n };\n}\n\nexport { spinner };\n","import { merge, type PartialElement, toState } from \"@domphy/core\";\nimport { themeColor, themeSpacing } from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Root of a resizable split layout. Lays out children as a flex row (horizontal) or column\n * (vertical) and provides a `splitter` context (`{ direction, size, min, max }`) consumed by\n * `splitterPanel` and `splitterHandle`. `size` is a reactive state holding the first panel's\n * percentage. No host-tag check; typically applied to a `div`.\n *\n * @param props.direction - Split orientation, `\"horizontal\"` | `\"vertical\"`. Defaults to `\"horizontal\"`.\n * @param props.defaultSize - Initial size (percentage) of the resizable panel. Defaults to `50`.\n * @param props.min - Minimum panel size (percentage). Defaults to `10`.\n * @param props.max - Maximum panel size (percentage). Defaults to `90`.\n * @example { div: [...], $: [splitter({ direction: \"vertical\" })] }\n */\nfunction splitter(\n props: {\n direction?: \"horizontal\" | \"vertical\";\n defaultSize?: number;\n min?: number;\n max?: number;\n } = {},\n): PartialElement {\n const {\n direction = \"horizontal\",\n defaultSize = 50,\n min = 10,\n max = 90,\n } = props;\n return {\n _onSchedule: (_node, element) => {\n merge(element, {\n _context: {\n splitter: {\n direction,\n size: toState(defaultSize),\n min,\n max,\n // Mutable bookkeeping (not reactive state) so splitterPanel can\n // tell the first panel from later ones — see its own comment.\n panelCount: 0,\n },\n },\n });\n },\n style: {\n display: \"flex\",\n flexDirection: direction === \"horizontal\" ? \"row\" : \"column\",\n overflow: \"hidden\",\n },\n };\n}\n\n/**\n * The resizable panel inside a `splitter`. Reads the `splitter` context and binds its\n * width (horizontal) or height (vertical) to the context `size` state, updating reactively as\n * the handle is dragged. Intended for exactly two panels either side of one `splitterHandle`:\n * the first `splitterPanel` mounted takes `size`%, and the second takes the complementary\n * `100 - size`% — so the pair always sums to the full width/height instead of both tracking\n * the same number (which would make them grow and shrink together instead of trading space).\n * Warns if used outside a `splitter`. Takes no props.\n *\n * @example { div: [...], $: [splitterPanel()] }\n */\nfunction splitterPanel(): PartialElement {\n return {\n _onMount: (node) => {\n const ctx = node.getContext(\"splitter\");\n if (!ctx) {\n console.warn(`\"splitterPanel\" patch must be used inside a \"splitter\"`);\n return;\n }\n const el = node.domElement as HTMLElement;\n const prop = ctx.direction === \"horizontal\" ? \"width\" : \"height\";\n const isFirst = ctx.panelCount++ === 0;\n\n const apply = (size: number) => {\n el.style[prop] = `${isFirst ? size : 100 - size}%`;\n };\n apply(ctx.size.get());\n el.style.flexShrink = \"0\";\n el.style.overflow = \"auto\";\n\n const release = ctx.size.addListener(apply);\n node.addHook(\"Remove\", release);\n },\n };\n}\n\n/**\n * The draggable divider inside a `splitter`. Reads the `splitter` context, shows the\n * appropriate resize cursor, and updates the context `size` state (clamped to `min`/`max`)\n * via mouse drag or keyboard: Arrow keys move by 1%, Home/End jump to min/max, hold Shift\n * for 10× step. Sets `role=\"separator\"`, `tabindex=\"0\"`, and `aria-value*` attributes.\n * Warns if used outside a `splitter`. Takes no props.\n *\n * @example { div: null, $: [splitterHandle()] }\n */\nfunction splitterHandle(): PartialElement {\n return {\n role: \"separator\",\n tabindex: 0,\n _onMount: (node) => {\n const ctx = node.getContext(\"splitter\");\n if (!ctx) {\n console.warn(`\"splitterHandle\" patch must be used inside a \"splitter\"`);\n return;\n }\n const handle = node.domElement as HTMLElement;\n const isHorizontal = ctx.direction === \"horizontal\";\n\n handle.style.cursor = isHorizontal ? \"col-resize\" : \"row-resize\";\n handle.setAttribute(\n \"aria-orientation\",\n isHorizontal ? \"vertical\" : \"horizontal\",\n );\n handle.setAttribute(\"aria-valuemin\", String(ctx.min));\n handle.setAttribute(\"aria-valuemax\", String(ctx.max));\n handle.setAttribute(\"aria-valuenow\", String(Math.round(ctx.size.get())));\n\n const releaseAriaValue = ctx.size.addListener((size: number) => {\n handle.setAttribute(\"aria-valuenow\", String(Math.round(size)));\n });\n\n const onKeydown = (e: KeyboardEvent) => {\n const step = e.shiftKey ? 10 : 1;\n let next: number | null = null;\n if (isHorizontal) {\n if (e.key === \"ArrowRight\")\n next = Math.min(ctx.size.get() + step, ctx.max);\n else if (e.key === \"ArrowLeft\")\n next = Math.max(ctx.size.get() - step, ctx.min);\n } else {\n if (e.key === \"ArrowDown\")\n next = Math.min(ctx.size.get() + step, ctx.max);\n else if (e.key === \"ArrowUp\")\n next = Math.max(ctx.size.get() - step, ctx.min);\n }\n if (e.key === \"Home\") next = ctx.min;\n else if (e.key === \"End\") next = ctx.max;\n if (next !== null) {\n e.preventDefault();\n ctx.size.set(next);\n }\n };\n\n let cancelDrag: (() => void) | null = null;\n\n const onMousedown = (e: MouseEvent) => {\n e.preventDefault();\n const container = handle.parentElement!;\n\n const onMousemove = (e: MouseEvent) => {\n const rect = container.getBoundingClientRect();\n const raw = isHorizontal\n ? ((e.clientX - rect.left) / rect.width) * 100\n : ((e.clientY - rect.top) / rect.height) * 100;\n ctx.size.set(Math.min(Math.max(raw, ctx.min), ctx.max));\n };\n\n const onMouseup = () => {\n document.removeEventListener(\"mousemove\", onMousemove);\n document.removeEventListener(\"mouseup\", onMouseup);\n cancelDrag = null;\n };\n\n cancelDrag = () => {\n document.removeEventListener(\"mousemove\", onMousemove);\n document.removeEventListener(\"mouseup\", onMouseup);\n cancelDrag = null;\n };\n\n document.addEventListener(\"mousemove\", onMousemove);\n document.addEventListener(\"mouseup\", onMouseup);\n };\n\n handle.addEventListener(\"keydown\", onKeydown);\n handle.addEventListener(\"mousedown\", onMousedown);\n node.addHook(\"Remove\", () => {\n cancelDrag?.();\n releaseAriaValue();\n handle.removeEventListener(\"keydown\", onKeydown);\n handle.removeEventListener(\"mousedown\", onMousedown);\n });\n },\n // Soft divider surface — shift via dataTone, paint with inherit.\n dataTone: \"shift-2\",\n style: {\n flexShrink: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: (listener) => themeColor(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\"),\n \"&:hover\": {\n backgroundColor: (listener) => themeColor(listener, \"increase-1\"),\n },\n transition: \"background-color 140ms ease, box-shadow 140ms ease\",\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, \"primary\"),\n },\n \"&::after\": {\n content: '\"\"',\n // A small grip dot so the handle is visibly draggable. Without an\n // explicit size the pseudo-element collapses to 0x0 and is invisible.\n width: themeSpacing(1),\n height: themeSpacing(1),\n borderRadius: themeSpacing(999),\n backgroundColor: (listener) => themeColor(listener, \"shift-4\"),\n },\n },\n };\n}\n\nexport { splitter, splitterPanel, splitterHandle };\n","import type { PartialElement } from \"@domphy/core\";\nimport { themeDensity, themeSpacing } from \"@domphy/theme\";\n\ntype FlexAlign = \"flex-start\" | \"center\" | \"flex-end\" | \"stretch\" | \"baseline\";\n\n/**\n * A vertical flex column with spacing between children. The general-purpose\n * primitive for stacking blocks — form sections, panel content, card bodies —\n * instead of hand-rolling `display: flex; flexDirection: column; gap: ...`.\n * Styles the host only; apply to any block element.\n *\n * @param props.gap - Spacing multiplier for gap between children (default 3 = 0.75em at density 1).\n * @param props.align - Cross-axis alignment (`alignItems`). Unset by default (flex default, stretch).\n * @example { div: [{ h3: \"Title\" }, { p: \"Body\" }], $: [stack()] }\n * @example { div: [...], $: [stack({ gap: 2, align: \"center\" })] }\n */\nfunction stack(\n props: { gap?: number; align?: FlexAlign } = {},\n): PartialElement {\n const { gap = 3, align } = props;\n return {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: (listener) => themeSpacing(themeDensity(listener) * gap),\n ...(align ? { alignItems: align } : {}),\n },\n };\n}\n\nexport { stack };\nexport type { FlexAlign };\n","import {\n type DomphyElement,\n type Listener,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/** One step entry. */\ntype StepItem = {\n /** Step label — plain string (auto-wrapped) or any DomphyElement. */\n label: string | DomphyElement;\n /** Stable key. Defaults to the item's zero-based index. */\n key?: string | number;\n};\n\n/**\n * All-in-one step-progress indicator. Generates `<li>` step elements from the\n * `items` array. Apply to an `<ol>` or `<ul>` element.\n *\n * @param props.items - Step definitions `{ label, key? }`.\n * @param props.current - Zero-based index of the active step (value or State). Defaults to `0`.\n * @param props.direction - `\"horizontal\"` (default) or `\"vertical\"` layout.\n * @param props.color - Theme color for pending/track elements. Defaults to `\"neutral\"`.\n * @param props.accentColor - Theme color for active/completed elements. Defaults to `\"primary\"`.\n * @example\n * { ol: null, $: [steps({ current: 1, items: [\n * { label: \"Cart\" },\n * { label: \"Shipping\" },\n * { label: \"Payment\" },\n * ] })] }\n */\nfunction steps(\n props: {\n items: StepItem[];\n current?: ValueOrState<number>;\n direction?: \"horizontal\" | \"vertical\";\n color?: ThemeColor;\n accentColor?: ThemeColor;\n } = { items: [] },\n): PartialElement {\n const {\n items = [],\n direction = \"horizontal\",\n color = \"neutral\",\n accentColor = \"primary\",\n } = props;\n const current = toState(props.current ?? 0);\n\n return {\n // Step badge weight is design-system chrome for the progress control.\n _doctorDisable: \"inline-typography\",\n // Expose state in context so stepItem() escape-hatch still works.\n _context: { steps: { current, direction, color, accentColor } },\n _onSchedule: (node, element) => {\n const stepEls: DomphyElement<\"li\">[] = items.map((item, index) => {\n const labelEl: DomphyElement =\n typeof item.label === \"string\"\n ? ({ span: item.label } as DomphyElement<\"span\">)\n : item.label;\n\n return {\n li: [labelEl],\n _key: item.key ?? index,\n dataStep: String(index + 1),\n dataStatus: (l: Listener) => {\n const cur = current.get(l);\n if (index < cur) return \"done\";\n if (index === cur) return \"active\";\n return \"pending\";\n },\n ariaCurrent: (l: Listener) =>\n current.get(l) === index ? \"step\" : undefined,\n style: {\n position: \"relative\",\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: themeSpacing(1),\n flex: \"1\",\n fontSize: (l: Listener) => themeSize(l, \"decrease-1\"),\n textAlign: \"center\",\n \"&::before\": {\n content: \"attr(data-step)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: themeSpacing(6),\n height: themeSpacing(6),\n borderRadius: themeSpacing(999),\n fontSize: (l: Listener) => themeSize(l, \"decrease-1\"),\n fontWeight: \"bold\",\n flexShrink: \"0\",\n border: (l: Listener) =>\n `2px solid ${themeColor(l, \"border-strong\", color)}`,\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\"),\n color: (l: Listener) => themeColor(l, \"muted\"),\n transition:\n \"background-color 200ms ease, color 200ms ease, border-color 200ms ease\",\n zIndex: \"1\",\n },\n \"&:not(:first-child)::after\": {\n content: '\"\"',\n position: \"absolute\",\n top: themeSpacing(3),\n right: `calc(50% + ${themeSpacing(3)})`,\n left: `calc(-50% + ${themeSpacing(3)})`,\n height: \"2px\",\n backgroundColor: (l: Listener) => themeColor(l, \"shift-3\", color),\n zIndex: \"0\",\n },\n \"&[data-status=active]::before\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-9\", accentColor),\n borderColor: (l: Listener) =>\n themeColor(l, \"shift-9\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-0\", accentColor),\n boxShadow: (l: Listener) =>\n `0 0 0 3px ${themeColor(l, \"shift-3\", accentColor)}`,\n },\n // Completed steps: filled accent + check, matching active track.\n \"&[data-status=done]::before\": {\n content: '\"✓\"',\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-9\", accentColor),\n borderColor: (l: Listener) =>\n themeColor(l, \"shift-9\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-0\", accentColor),\n },\n \"&[data-status=done]:not(:first-child)::after\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-9\", accentColor),\n },\n \"&[data-status=active]:not(:first-child)::after\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-9\", accentColor),\n },\n \"&[data-status=pending]\": {\n color: (l: Listener) => themeColor(l, \"muted\"),\n },\n \"&[data-status=active]\": {\n color: (l: Listener) => themeColor(l, \"shift-11\", accentColor),\n fontWeight: \"bold\",\n },\n \"&[data-status=done]\": {\n color: (l: Listener) => themeColor(l, \"text\", color),\n },\n },\n } as DomphyElement<\"li\">;\n });\n\n (element as any)[node.tagName] = stepEls;\n },\n style: {\n display: \"flex\",\n flexDirection: direction === \"vertical\" ? \"column\" : \"row\",\n alignItems: direction === \"vertical\" ? \"flex-start\" : \"center\",\n gap: themeSpacing(2),\n listStyle: \"none\",\n margin: \"0\",\n padding: \"0\",\n },\n };\n}\n\nexport { steps };\nexport type { StepItem };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSize } from \"@domphy/theme\";\n\n/**\n * Styles strongly emphasized (bold) text: inherited font size, `font-weight: 700`, and a\n * themed foreground color.\n *\n * @hostTag strong\n * @param props.color - Theme color tone for the text. Accepts a value or reactive state.\n * Defaults to `\"neutral\"`.\n * @example { strong: \"important\", $: [strong()] }\n */\nfunction strong(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"strong\") {\n console.warn(`\"strong\" primitive patch must use strong tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n fontWeight: \"bold\",\n color: (listener) =>\n themeColor(listener, \"shift-11\", color.get(listener)),\n backgroundColor: (listener) => themeColor(listener),\n },\n };\n}\n\nexport { strong };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSize } from \"@domphy/theme\";\n\n/**\n * Renders subscript text (shrunk, baseline-lowered) for the host `<sub>` element.\n *\n * @hostTag sub\n * @param props.color - Theme color for the text. Optional, accepts a value or state. Defaults to `\"neutral\"`.\n * @example { sub: \"2\", $: [subscript()] }\n */\nfunction subscript(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"sub\") {\n console.warn(`\"subscript\" primitive patch must use sub tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"decrease-1\"),\n verticalAlign: \"sub\",\n lineHeight: 0,\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n };\n}\n\nexport { subscript };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSize } from \"@domphy/theme\";\n\n/**\n * Renders superscript text (shrunk, baseline-raised) for the host `<sup>` element.\n *\n * @hostTag sup\n * @param props.color - Theme color for the text. Optional, accepts a value or state. Defaults to `\"neutral\"`.\n * @example { sup: \"2\", $: [superscript()] }\n */\nfunction superscript(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"sup\") {\n console.warn(`\"superscript\" primitive patch must use sup tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"decrease-1\"),\n verticalAlign: \"super\",\n lineHeight: 0,\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n },\n };\n}\n\nexport { superscript };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles a data table (header/body/footer cells, caption, row hover, borders)\n * on the host `<table>` element.\n *\n * @hostTag table\n * @param props.color - Theme color applied across cells and text. Optional, accepts a value or state. Defaults to `\"neutral\"`.\n * @example { table: null, $: [table()] }\n */\nfunction table(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"table\") {\n console.warn(`\"table\" primitive patch must use table tag`);\n }\n },\n // Header/footer weights are design-system table chrome.\n _doctorDisable: \"inline-typography\",\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n width: \"100%\",\n borderCollapse: \"collapse\",\n \"& caption\": {\n captionSide: \"bottom\",\n },\n \"& th, & thead td\": {\n textAlign: \"left\",\n fontWeight: 500,\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n backgroundColor: (listener) => themeColor(listener, \"inherit\"),\n },\n \"& td\": {\n textAlign: \"left\",\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n boxShadow: (listener) =>\n `inset 0 1px 0 ${themeColor(listener, \"shift-3\", color.get(listener))}`,\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n },\n \"& tfoot th, & tfoot td\": {\n textAlign: \"left\",\n fontWeight: 500,\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n color: (l) => themeColor(l, \"shift-10\", color.get(l)),\n backgroundColor: (l) => themeColor(l, \"inherit\"),\n boxShadow: (l) =>\n `inset 0 -1px 0 ${themeColor(l, \"shift-4\", color.get(l))}`,\n },\n \"& tr\": {\n backgroundColor: (listener) => themeColor(listener, \"inherit\"),\n },\n\n // No !important needed: \".scope tbody tr:hover\" (two classes + two\n // elements) already out-specifies any row's own auto-scope class rule.\n \"& tbody tr:hover\": {\n backgroundColor: (listener) => themeColor(listener, \"hover\"),\n },\n },\n };\n}\n\nexport { table };\n","import {\n type DomphyElement,\n type Listener,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/** One tab entry: a trigger label and its panel content. */\ntype TabItem = {\n /** Tab button label — a plain string (auto-wrapped in span) or any DomphyElement. */\n label: string | DomphyElement;\n /** Panel content rendered when this tab is active. */\n content: DomphyElement;\n /** Stable identity key. Defaults to the item's zero-based index. */\n key?: string | number;\n};\n\n/**\n * All-in-one tabs patch. Generates a `[role=tablist]` button row and\n * `[role=tabpanel]` panels from the `items` array. Apply to any wrapper\n * element (`div`, `section`, …). No companion `tab()` / `tabPanel()` needed.\n *\n * To control the active tab programmatically, pass an external `State` as\n * `activeKey` and call `.set()` on it from outside.\n *\n * @param props.items - Tab definitions `{ label, content, key? }`.\n * @param props.activeKey - Initially active key (value or State). Defaults to the first item's key.\n * @param props.accentColor - Theme color for the active underline indicator. Defaults to `\"primary\"`.\n * @param props.color - Theme color for the resting underline. Defaults to `\"neutral\"`.\n * @example\n * { div: null, $: [tabs({ items: [\n * { label: \"Overview\", content: { p: \"Overview content\" } },\n * { label: \"API\", content: { p: \"API content\" } },\n * ] })] }\n */\nfunction tabs(\n props: {\n items: TabItem[];\n activeKey?: ValueOrState<string | number>;\n accentColor?: ThemeColor;\n color?: ThemeColor;\n } = { items: [] },\n): PartialElement {\n const { items = [], accentColor = \"primary\", color = \"neutral\" } = props;\n const activeKey = toState(props.activeKey ?? items[0]?.key ?? 0);\n\n return {\n _onSchedule: (node, element) => {\n const id = node.nodeId;\n\n const buttons: DomphyElement<\"button\">[] = items.map((item, index) => {\n const key = item.key ?? index;\n const labelEl: DomphyElement =\n typeof item.label === \"string\"\n ? ({ span: item.label } as DomphyElement<\"span\">)\n : item.label;\n\n return {\n button: [labelEl],\n _key: key,\n type: \"button\",\n role: \"tab\",\n id: `tab${id}${key}`,\n ariaControls: `panel${id}${key}`,\n ariaSelected: (l: Listener) => activeKey.get(l) === key,\n onClick: () => activeKey.set(key),\n onKeyDown: (e: Event) => {\n const k = (e as KeyboardEvent).key;\n if (![\"ArrowLeft\", \"ArrowRight\", \"Home\", \"End\"].includes(k)) return;\n e.preventDefault();\n const keys = items.map((it, i) => it.key ?? i);\n const idx = keys.indexOf(key);\n let next = idx;\n if (k === \"ArrowRight\") next = (idx + 1) % keys.length;\n else if (k === \"ArrowLeft\")\n next = (idx - 1 + keys.length) % keys.length;\n else if (k === \"Home\") next = 0;\n else if (k === \"End\") next = keys.length - 1;\n activeKey.set(keys[next]);\n },\n style: {\n cursor: \"pointer\",\n fontSize: (l: Listener) => themeSize(l, \"inherit\"),\n height: (l: Listener) => themeSpacing(6 + themeDensity(l) * 2),\n paddingInline: (l: Listener) => themeSpacing(themeDensity(l) * 4),\n border: \"none\",\n outline: \"none\",\n // Resting tabs: shift-13 for ≥4.5:1 on surface (catalog low-contrast).\n color: (l: Listener) => themeColor(l, \"shift-13\"),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\"),\n boxShadow: (l: Listener) =>\n `inset 0 ${themeSpacing(-0.5)} 0 0 ${themeColor(l, \"shift-1\", color)}`,\n transition: \"box-shadow 140ms ease, color 140ms ease\",\n \"&:hover:not([disabled]):not([aria-selected=true])\": {\n color: (l: Listener) => themeColor(l, \"shift-13\"),\n boxShadow: (l: Listener) =>\n `inset 0 ${themeSpacing(-0.5)} 0 0 ${themeColor(l, \"shift-2\", color)}`,\n },\n \"&[aria-selected=true]:not([disabled])\": {\n color: (l: Listener) => themeColor(l, \"shift-13\", accentColor),\n boxShadow: (l: Listener) =>\n `inset 0 ${themeSpacing(-0.5)} 0 0 ${themeColor(l, \"shift-8\", accentColor)}`,\n },\n // Focus ring must compose with the selected underline (both use\n // box-shadow) so keyboard focus doesn't erase the active indicator.\n \"&:focus-visible\": {\n boxShadow: (l: Listener) => focusRing(l, accentColor),\n },\n \"&[aria-selected=true]:focus-visible\": {\n boxShadow: (l: Listener) =>\n `${focusRing(l, accentColor)}, inset 0 ${themeSpacing(-0.5)} 0 0 ${themeColor(l, \"shift-6\", accentColor)}`,\n },\n },\n } as DomphyElement<\"button\">;\n });\n\n const tablist: DomphyElement<\"div\"> = {\n div: buttons,\n role: \"tablist\",\n ariaOrientation: \"horizontal\",\n style: { display: \"flex\" },\n } as DomphyElement<\"div\">;\n\n const panels: DomphyElement<\"div\">[] = items.map((item, index) => {\n const key = item.key ?? index;\n return {\n div: [item.content],\n _key: key,\n role: \"tabpanel\",\n id: `panel${id}${key}`,\n ariaLabelledby: `tab${id}${key}`,\n hidden: (l: Listener) => activeKey.get(l) !== key,\n style: {\n paddingBlock: (l: Listener) => themeSpacing(themeDensity(l) * 2),\n paddingInline: (l: Listener) => themeSpacing(themeDensity(l) * 2),\n },\n } as DomphyElement<\"div\">;\n });\n\n // Inject generated structure into the host element's children slot.\n (element as any)[node.tagName] = [tablist, ...panels];\n },\n };\n}\n\nexport { tabs };\nexport type { TabItem };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/**\n * Styles a multi-line text input (border, focus/hover/invalid/disabled states)\n * on the host `<textarea>` element, with optional auto-resize to content.\n *\n * @hostTag textarea\n * @param props.color - Theme color for the border and text. Optional, accepts a value or state. Defaults to `\"neutral\"`.\n * @param props.accentColor - Theme color for hover/focus outline. Optional, accepts a value or state. Defaults to `\"primary\"`.\n * @param props.autoResize - When true, grows the textarea height to fit its content on input. Optional. Defaults to `false`.\n * @example { textarea: null, $: [textarea({ autoResize: true })] }\n */\nfunction textarea(\n props: {\n color?: ValueOrState<ThemeColor>;\n accentColor?: ValueOrState<ThemeColor>;\n autoResize?: boolean;\n } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n const accentColor = toState(props.accentColor ?? \"primary\", \"accentColor\");\n const { autoResize = false } = props;\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"textarea\") {\n console.warn(`\"textarea\" primitive patch must use textarea tag`);\n }\n },\n _onMount: (node) => {\n if (autoResize) {\n const el = node.domElement as HTMLTextAreaElement;\n el.style.overflow = \"hidden\";\n const resize = () => {\n el.style.height = \"auto\";\n el.style.height = `${el.scrollHeight}px`;\n };\n el.addEventListener(\"input\", resize);\n resize();\n node.addHook(\"Remove\", () => el.removeEventListener(\"input\", resize));\n }\n },\n style: {\n fontFamily: \"inherit\",\n lineHeight: \"inherit\",\n resize: \"vertical\",\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n border: \"none\",\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", color.get(listener))}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n transition: \"outline-color 140ms ease, box-shadow 140ms ease\",\n \"&::placeholder\": {\n color: (listener) => themeColor(listener, \"shift-7\"),\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-5\", accentColor.get(listener))}`,\n },\n \"&:focus-visible\": {\n boxShadow: (listener) => focusRing(listener, accentColor.get(listener)),\n },\n \"&:invalid\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-5\", \"error\")}`,\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"muted\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"border-strong\", \"neutral\")}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n },\n },\n };\n}\n\nexport { textarea };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Container for a vertical timeline. Sets list reset styles. Apply to `<ol>` or `<ul>`.\n *\n * @example { ol: [...], $: [timeline()] }\n */\nfunction timeline(): PartialElement {\n return {\n style: {\n listStyle: \"none\",\n margin: 0,\n padding: 0,\n display: \"flex\",\n flexDirection: \"column\",\n },\n };\n}\n\n/**\n * A single event row in a `timeline`. Uses a 2-column grid: the left column holds\n * a dot (`::before`) and optional connector line (`::after`); the right column holds\n * the user's content. Apply to `<li>`.\n *\n * @param props.active - Full-opacity dot (accent color). `ValueOrState<boolean>`, defaults to `false`.\n * @param props.last - Suppress the vertical connector below this item. `boolean`, defaults to `false`.\n * @param props.color - Dot/connector color tone. `ThemeColor`, defaults to `\"neutral\"`.\n * @param props.accentColor - Active dot color tone. `ThemeColor`, defaults to `\"primary\"`.\n * @example { li: [{ b: \"2024\" }, { p: \"Event\" }], $: [timelineItem({ active: true })] }\n */\nfunction timelineItem(\n props: {\n active?: ValueOrState<boolean>;\n last?: boolean;\n color?: ThemeColor;\n accentColor?: ThemeColor;\n } = {},\n): PartialElement {\n const { last = false } = props;\n const color = props.color ?? \"neutral\";\n const accentColor = props.accentColor ?? \"primary\";\n const activeState = toState(props.active ?? false);\n\n return {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"2rem 1fr\",\n columnGap: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingBottom: (listener) =>\n last ? \"0\" : themeSpacing(themeDensity(listener) * 4),\n position: \"relative\",\n\n // Dot\n \"&::before\": {\n content: '\"\"',\n display: \"block\",\n width: \"0.75rem\",\n height: \"0.75rem\",\n borderRadius: \"50%\",\n justifySelf: \"center\",\n marginTop: themeSpacing(1),\n transition: \"background-color 200ms ease, opacity 200ms ease\",\n backgroundColor: (listener) =>\n themeColor(\n listener,\n \"shift-8\",\n activeState.get(listener) ? accentColor : color,\n ),\n opacity: (listener) => (activeState.get(listener) ? \"1\" : \"0.4\"),\n },\n\n // Vertical connector to the next item\n ...(last\n ? {}\n : {\n \"&::after\": {\n content: '\"\"',\n position: \"absolute\",\n left: \"calc(1rem - 1px)\",\n top: \"1.25rem\",\n bottom: (listener) =>\n themeSpacing(themeDensity(listener) * -4),\n width: \"2px\",\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-3\", color),\n },\n }),\n },\n };\n}\n\nexport { timeline, timelineItem };\n","import type { DomphyElement, ElementNode, PartialElement } from \"@domphy/core\";\nimport { toState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\n\ntype ToastPosition =\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\";\n\n/**\n * Renders a transient notification surface as a fixed-position overlay (portaled\n * into a corner stack), animating in on mount and out before removal. No host\n * tag check; typically applied to a `<div>`.\n *\n * @param props.position - Corner of the screen for the toast stack. Optional, one of `\"top-left\" | \"top-center\" | \"top-right\" | \"bottom-left\" | \"bottom-center\" | \"bottom-right\"`. Defaults to `\"top-center\"`.\n * @param props.color - Theme color for the toast surface. Optional. Defaults to `\"neutral\"`.\n * @example { div: \"Saved!\", $: [toast({ position: \"top-right\" })] }\n */\nfunction toast(\n props: { position?: ToastPosition; color?: ThemeColor } = {},\n): PartialElement {\n const { position = \"top-center\", color = \"neutral\" } = props;\n const state = toState(false);\n\n const isTop = position.startsWith(\"top\");\n const isCenter = position.endsWith(\"center\");\n const isRight = position.endsWith(\"right\");\n\n const overlayEle: DomphyElement<\"div\"> = {\n div: [],\n id: `domphy-toast-${position}`,\n style: {\n position: \"fixed\",\n display: \"flex\",\n flexDirection: isTop ? \"column\" : \"column-reverse\",\n alignItems: isCenter ? \"center\" : isRight ? \"end\" : \"start\",\n inset: 0,\n gap: themeSpacing(4),\n zIndex: 30,\n padding: themeSpacing(6),\n pointerEvents: \"none\",\n },\n };\n\n return {\n _portal: (rootNode) => {\n let overlay = rootNode.domElement!.querySelector(\n `#domphy-toast-${position}`,\n );\n if (!overlay) {\n const overlayNode = rootNode.children!.insert(\n overlayEle,\n ) as ElementNode;\n overlay = overlayNode.domElement!;\n }\n return overlay;\n },\n role: \"status\",\n ariaAtomic: \"true\",\n // Toast is rendered as an overlay surface, so it uses the inverted branch.\n dataTone: \"shift-17\",\n style: {\n minWidth: themeSpacing(32),\n pointerEvents: \"auto\",\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 2),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"text\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n boxShadow: elevation(\"medium\"),\n opacity: (listener) => Number(state.get(listener)),\n transform: (listener) =>\n state.get(listener)\n ? \"translateY(0)\"\n : isTop\n ? \"translateY(-100%)\"\n : \"translateY(100%)\",\n transition: \"opacity 300ms ease, transform 300ms ease\",\n },\n _onMount: () => requestAnimationFrame(() => state.set(true)),\n _onBeforeRemove: (node, done) => {\n let finished = false;\n let timer: ReturnType<typeof setTimeout> | null = null;\n const finish = () => {\n if (finished) return;\n finished = true;\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n node.domElement!.removeEventListener(\"transitionend\", onEnd);\n done();\n };\n const onEnd = (e: Event) => {\n if ((e as TransitionEvent).propertyName === \"transform\") finish();\n };\n node.domElement!.addEventListener(\"transitionend\", onEnd);\n // Fallback: if transitionend never fires (reduced-motion, display:none,\n // early detach), unblock removal after the transition duration + buffer.\n timer = setTimeout(finish, 350);\n // If the node is detached before the exit animation settles, clear the\n // pending fallback timer and the transitionend listener so they cannot\n // fire on a removed node.\n node.addHook(\"Remove\", () => {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n node.domElement?.removeEventListener(\"transitionend\", onEnd);\n });\n state.set(false);\n },\n };\n}\n\nexport { toast };\n","import {\n type DomphyElement,\n type Listener,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { focusRing } from \"../utils/focusRing.js\";\n\n/** One item inside a toggle group. */\ntype ToggleItem = {\n /** Button label — plain string (auto-wrapped) or any DomphyElement. */\n label: string | DomphyElement;\n /** Stable key. Defaults to the item's zero-based index as a string. */\n key?: string;\n};\n\n/**\n * All-in-one toggle group — single or multi-select button group. Generates\n * `<button>` toggle elements from the `items` array. Apply to any wrapper element.\n *\n * @param props.items - Item definitions `{ label, key? }`.\n * @param props.value - Selected key(s) (value or State). Defaults to `[]` (multiple) or `\"\"` (single).\n * @param props.multiple - Allow multiple items selected at once. Defaults to `false`.\n * @param props.color - Theme color for the group background/border. Defaults to `\"neutral\"`.\n * @param props.accentColor - Theme color for the pressed state. Defaults to `\"primary\"`.\n * @example\n * { div: null, $: [toggleGroup({ multiple: true, items: [\n * { label: \"Bold\", key: \"bold\" },\n * { label: \"Italic\", key: \"italic\" },\n * ] })] }\n */\nfunction toggleGroup(\n props: {\n items: ToggleItem[];\n value?: ValueOrState<string | string[]>;\n multiple?: boolean;\n color?: ThemeColor;\n accentColor?: ThemeColor;\n } = { items: [] },\n): PartialElement {\n const {\n items = [],\n multiple = false,\n color = \"neutral\",\n accentColor = \"primary\",\n } = props;\n const value = toState(props.value ?? (multiple ? [] : \"\"));\n\n return {\n role: \"group\",\n // Expose value + multiple in context so toggle() escape-hatch still works.\n _context: { toggleGroup: { value, multiple } },\n _onSchedule: (node, element) => {\n const buttons: DomphyElement<\"button\">[] = items.map((item, index) => {\n const key = item.key ?? String(index);\n const labelEl: DomphyElement =\n typeof item.label === \"string\"\n ? ({ span: item.label } as DomphyElement<\"span\">)\n : item.label;\n\n return {\n button: [labelEl],\n _key: key,\n type: \"button\",\n role: \"button\",\n ariaPressed: (l: Listener) => {\n const val = value.get(l);\n return Array.isArray(val) ? val.includes(key) : val === key;\n },\n onClick: () => {\n const val = value.get();\n if (multiple) {\n const arr = Array.isArray(val) ? [...val] : [];\n value.set(\n arr.includes(key)\n ? arr.filter((v) => v !== key)\n : [...arr, key],\n );\n } else {\n value.set(val === key ? \"\" : key);\n }\n },\n style: {\n cursor: \"pointer\",\n fontSize: (l: Listener) => themeSize(l, \"inherit\"),\n height: themeSpacing(6),\n paddingBlock: themeSpacing(1),\n paddingInline: themeSpacing(2),\n border: \"none\",\n borderRadius: themeSpacing(1.5),\n // Unpressed: shift-13 for readable resting labels (catalog contrast).\n color: (l: Listener) => themeColor(l, \"shift-13\", color),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\", color),\n transition:\n \"background-color 140ms ease, color 140ms ease, box-shadow 140ms ease\",\n \"&:hover:not([disabled]):not([aria-pressed=true])\": {\n color: (l: Listener) => themeColor(l, \"shift-13\", color),\n backgroundColor: (l: Listener) => themeColor(l, \"hover\", color),\n },\n \"&:active:not([disabled])\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"increase-2\", color),\n },\n \"&[aria-pressed=true]\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-3\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-13\", accentColor),\n },\n \"&:focus-visible\": {\n boxShadow: (l: Listener) => focusRing(l, accentColor),\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n },\n },\n } as DomphyElement<\"button\">;\n });\n\n (element as any)[node.tagName] = buttons;\n },\n style: {\n display: \"flex\",\n paddingBlock: themeSpacing(1),\n paddingInline: themeSpacing(1),\n gap: themeSpacing(1),\n borderRadius: themeSpacing(2),\n fontSize: (l: Listener) => themeSize(l, \"inherit\"),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\", color),\n color: (l: Listener) => themeColor(l, \"text\", color),\n outline: (l: Listener) => `1px solid ${themeColor(l, \"border\", color)}`,\n outlineOffset: \"-1px\",\n },\n };\n}\n\nexport { toggleGroup };\nexport type { ToggleItem };\n","import type { DomphyElement, PartialElement } from \"@domphy/core\";\nimport { row } from \"./row.js\";\n\n/**\n * A horizontal flex row with vertically centered items. Useful for headers,\n * toolbars, navigation bars, and action strips. A semantic alias of `row()`\n * at its default alignment — reach for `row()` directly for `justify`/`wrap`/\n * `align` beyond this shape.\n *\n * @param props.gap - Spacing multiplier for gap between items (default 4 = 1em).\n * @example { header: [...], $: [toolbar()] }\n * @example { nav: [...], $: [toolbar({ gap: 3 })] }\n */\nfunction toolbar(props: { gap?: number } = {}): PartialElement {\n return row({ gap: props.gap });\n}\n\n/**\n * A flex spacer that expands to fill available space in a toolbar, pushing\n * subsequent items to the far end.\n *\n * @example { header: [logo, toolbarSpacer(), nav, actions], $: [toolbar()] }\n */\nfunction toolbarSpacer(): DomphyElement {\n return { div: null, style: { flex: \"1 1 0\" } };\n}\n\nexport { toolbar, toolbarSpacer };\n","import {\n type DomphyElement,\n merge,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport type { Placement } from \"@domphy/floating\";\nimport {\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { elevation } from \"../utils/elevation.js\";\nimport { createFloating } from \"../utils/floating.js\";\nimport { popoverArrow } from \"./popoverArrow.js\";\n\n/**\n * Attaches a floating tooltip to the host element, shown on hover/focus and\n * hidden on leave/blur/Escape. Returns the anchor (trigger) partial; the tooltip\n * surface is positioned via the floating utility and linked with\n * `aria-describedby`. No host tag check; applied to the trigger element.\n *\n * @param props.open - Controlled open state. Optional, accepts a value or state. Defaults to `false`.\n * @param props.placement - Floating placement relative to the trigger. Optional, accepts a value or state (`Placement`). Defaults to `\"top\"`.\n * @param props.content - Tooltip text content. Optional, accepts a value or state (string only). Defaults to `\"Tooltip Content\"`.\n * @example { button: \"Hover me\", $: [tooltip({ content: \"Help text\" })] }\n */\nfunction tooltip(\n props: {\n open?: ValueOrState<boolean>;\n placement?: ValueOrState<Placement>;\n content?: ValueOrState<string>;\n } = {},\n): PartialElement {\n const {\n open = false,\n placement = \"top\",\n content = \"Tooltip Content\",\n } = props;\n\n const placeState = toState(placement);\n const contentState = toState(content);\n\n // Pre-generate ID so the trigger can reference it via aria-describedby\n // before the tooltip content element is first inserted into the DOM.\n const tooltipId = `domphy-tt-${Math.random().toString(36).slice(2, 9)}`;\n\n const contentElement: DomphyElement<\"span\"> = {\n span: (listener) => contentState.get(listener),\n id: tooltipId,\n };\n\n const { show, hide, anchorPartial } = createFloating({\n kind: \"tooltip\",\n open,\n placement: placeState,\n content: contentElement,\n });\n\n const tooltipPartial: PartialElement = {\n role: \"tooltip\",\n dataSize: \"decrease-1\",\n dataTone: \"shift-17\",\n style: {\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1.5),\n color: (listener) => themeColor(listener, \"text\"),\n backgroundColor: (listener) => themeColor(listener),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n boxShadow: elevation(\"low\"),\n },\n $: [popoverArrow({ placement: placeState, bordered: false })],\n };\n contentElement.$ ||= [];\n contentElement.$.push(tooltipPartial);\n\n const triggerPartial: PartialElement = {\n ariaDescribedby: tooltipId,\n onMouseEnter: (_e, node) => show(node),\n onMouseLeave: (_e, node) => hide(node),\n onFocus: (_e, node) => show(node),\n onBlur: (_e, node) => hide(node),\n onKeyDown: (e, node) => (e as KeyboardEvent).key === \"Escape\" && hide(node),\n };\n\n merge(anchorPartial, triggerPartial);\n\n return anchorPartial;\n}\n\nexport { tooltip };\n","import { ElementNode, type PartialElement } from \"@domphy/core\";\n\ntype RectMap = Map<string, DOMRect>;\n\nfunction getItemId(node: ElementNode, index: number): string {\n if (node.key !== undefined && node.key !== null) {\n return String(node.key);\n }\n return `index-${index}`;\n}\n\n/**\n * Animates child reordering using the FLIP technique: records each child's\n * position before an update and smoothly transitions it from its old to new\n * position afterward. No host tag check; applied to the list container.\n *\n * @param props.duration - Transition duration in milliseconds. Optional. Defaults to `300`.\n * @param props.delay - Transition delay in milliseconds. Optional. Defaults to `0`.\n * @example { ul: null, $: [transitionGroup({ duration: 300 })] }\n */\nfunction transitionGroup(\n props: { duration?: number; delay?: number } = {},\n): PartialElement {\n const { duration = 300, delay = 0 } = props;\n\n let previousRects: RectMap = new Map();\n // Cancels any in-flight animation for a given DOM element before starting a new one.\n const cancelMap = new Map<HTMLElement, () => void>();\n // Pending fallback timers and queued rAF callbacks, tracked so a removal of\n // the container mid-animation can clear them instead of firing on a detached node.\n const pendingTimers = new Set<ReturnType<typeof setTimeout>>();\n const pendingFrames = new Set<number>();\n\n return {\n _onMount: (node) => {\n node.addHook(\"Remove\", () => {\n // Stop every in-flight animation: removes transitionend listeners.\n for (const cancel of Array.from(cancelMap.values())) cancel();\n cancelMap.clear();\n // Clear queued fallback timers.\n for (const timer of pendingTimers) clearTimeout(timer);\n pendingTimers.clear();\n // Cancel queued animation frames.\n for (const frame of pendingFrames) cancelAnimationFrame(frame);\n pendingFrames.clear();\n });\n },\n _onBeforeUpdate: (node) => {\n previousRects = new Map();\n node.children.items.forEach((item, index) => {\n if (!(item instanceof ElementNode)) return;\n const dom = item.domElement as HTMLElement | undefined;\n if (!dom) return;\n previousRects.set(getItemId(item, index), dom.getBoundingClientRect());\n });\n },\n _onUpdate: (node) => {\n node.children.items.forEach((item, index) => {\n if (!(item instanceof ElementNode)) return;\n const dom = item.domElement as HTMLElement | undefined;\n if (!dom) return;\n\n const key = getItemId(item, index);\n const prev = previousRects.get(key);\n if (!prev) return;\n\n const next = dom.getBoundingClientRect();\n const deltaX = prev.left - next.left;\n const deltaY = prev.top - next.top;\n if (Math.abs(deltaX) < 0.5 && Math.abs(deltaY) < 0.5) return;\n\n // Cancel any in-flight animation on this element before starting a new one.\n cancelMap.get(dom)?.();\n\n dom.style.transition = \"none\";\n dom.style.transform = `translate(${deltaX}px, ${deltaY}px)`;\n dom.getBoundingClientRect();\n\n const frame = requestAnimationFrame(() => {\n pendingFrames.delete(frame);\n dom.style.transition = `transform ${duration}ms ease ${delay}ms`;\n dom.style.transform = \"translate(0px, 0px)\";\n });\n pendingFrames.add(frame);\n\n let cancelled = false;\n let timer: ReturnType<typeof setTimeout> | null = null;\n const finish = () => {\n if (cancelled) return;\n cancelled = true;\n if (timer) {\n pendingTimers.delete(timer);\n timer = null;\n }\n cancelMap.delete(dom);\n dom.removeEventListener(\"transitionend\", onEnd);\n dom.style.transition = \"\";\n dom.style.transform = \"\";\n };\n\n const onEnd = (event: Event) => {\n if ((event as TransitionEvent).propertyName === \"transform\") finish();\n };\n\n cancelMap.set(dom, () => {\n cancelled = true;\n if (timer) {\n clearTimeout(timer);\n pendingTimers.delete(timer);\n timer = null;\n }\n cancelMap.delete(dom);\n dom.removeEventListener(\"transitionend\", onEnd);\n });\n\n dom.addEventListener(\"transitionend\", onEnd);\n timer = setTimeout(finish, duration + delay + 34);\n pendingTimers.add(timer);\n });\n previousRects.clear();\n },\n };\n}\n\nexport { transitionGroup };\n","import { type PartialElement, toState, type ValueOrState } from \"@domphy/core\";\nimport {\n type ThemeColor,\n themeColor,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\n\n/**\n * Styles a bulleted list (disc markers, reset margins, themed text) on the host\n * `<ul>` element.\n *\n * @hostTag ul\n * @param props.color - Theme color for the list text. Optional, accepts a value or state. Defaults to `\"neutral\"`.\n * @example { ul: null, $: [unorderedList()] }\n */\nfunction unorderedList(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"neutral\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"ul\") {\n console.warn(`\"unorderedList\" primitive patch must use ul tag`);\n }\n },\n style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) => themeColor(listener),\n color: (listener) => themeColor(listener, \"text\", color.get(listener)),\n marginTop: 0,\n marginBottom: 0,\n paddingLeft: themeSpacing(3),\n listStyleType: \"disc\",\n listStylePosition: \"outside\",\n },\n };\n}\n\nexport { unorderedList };\n"],"mappings":"6bAAA,OAA8B,WAAAA,OAAkC,eAChE,OAEE,cAAAC,GACA,aAAAC,GACA,gBAAAC,OACK,gBAWP,SAASC,GACPC,EAGI,CAAC,EACW,CAtBlB,IAAAC,EAAAC,EAuBE,IAAMC,EAAQR,IAAQM,EAAAD,EAAM,QAAN,KAAAC,EAAe,UAAW,OAAO,EACjDG,EAAcT,IAAQO,EAAAF,EAAM,cAAN,KAAAE,EAAqB,UAAW,aAAa,EAEzE,MAAO,CACL,UAAYG,GAAS,CACfA,EAAK,UAAY,QACnB,QAAQ,KAAK,kDAAkD,CAEnE,EACA,MAAO,CACL,SAAWC,GAAaT,GAAUS,CAAQ,EAC1C,gBAAkBA,GAAaV,GAAWU,CAAQ,EAClD,MAAQA,GACNV,GAAWU,EAAU,WAAYH,EAAM,IAAIG,CAAQ,CAAC,EACtD,mBAAoB,YACpB,oBAAqB,SACrB,oBAAsBA,GACpBV,GAAWU,EAAU,UAAWH,EAAM,IAAIG,CAAQ,CAAC,EACrD,oBAAqBR,GAAa,GAAI,EACtC,OAAQ,OACR,UAAW,CACT,MAAQQ,GACNV,GAAWU,EAAU,WAAYF,EAAY,IAAIE,CAAQ,CAAC,EAC5D,oBAAsBA,GACpBV,GAAWU,EAAU,UAAWF,EAAY,IAAIE,CAAQ,CAAC,CAC7D,CACF,CACF,CACF,CCnDA,OAA8B,WAAAC,OAAkC,eAChE,OAEE,cAAAC,GACA,gBAAAC,GACA,gBAAAC,OACK,gBCLP,OAA0B,cAAAC,OAAkB,gBAiB5C,SAASC,EAAUC,EAAoBC,EAAoB,U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,GACA,aAAAC,GACA,gBAAAC,OACK,gBAUP,SAASC,GACPC,EAA8C,CAAC,EAC/B,CAlBlB,IAAAC,EAmBE,IAAMC,EAAQP,IAAQM,EAAAD,EAAM,QAAN,KAAAC,EAAe,UAAW,OAAO,EAEvD,MAAO,CACL,UAAYE,GAAS,CACfA,EAAK,UAAY,MACnB,QAAQ,KAAK,iDAAiD,CAElE,EACA,MAAO,CACL,SAAWC,GAAaP,GAAUO,EAAU,SAAS,EACrD,gBAAkBA,GAAaR,GAAWQ,CAAQ,EAClD,MAAQA,GAAaR,GAAWQ,EAAU,OAAQF,EAAM,IAAIE,CAAQ,CAAC,EACrE,UAAW,EACX,aAAc,EACd,YAAaN,GAAa,CAAC,EAC3B,cAAe,OACf,kBAAmB,SACrB,CACF,CACF","names":["toState","themeColor","themeSize","themeSpacing","abbreviation","props","_a","_b","color","accentColor","node","listener","toState","themeColor","themeDensity","themeSpacing","themeColor","focusRing","listener","color","gap","ring","accordion","props","_a","_b","type","color","toState","accentColor","node","el","handler","event","summary","item","detail","listener","themeSpacing","themeDensity","themeColor","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","alert","props","_a","color","listener","toState","themeColor","themeSize","themeSpacing","avatar","props","_a","color","listener","toState","themeColor","themeSize","themeSpacing","badge","props","_a","label","state","color","l","toState","themeColor","themeDensity","themeSize","themeSpacing","blockquote","props","_a","color","node","listener","toState","themeColor","themeSize","themeSpacing","breadcrumb","props","_a","separator","color","node","listener","toState","themeColor","themeSize","themeSpacing","breadcrumbEllipsis","props","_a","color","toState","node","listener","themeSize","themeSpacing","themeColor","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","BUTTON_SIZE_FONT","toState","themeColor","themeDensity","themeSize","themeSpacing","PADDING_STEPS","buttonGhost","props","_a","_b","_c","color","toState","padding","fontSize","BUTTON_SIZE_FONT","node","listener","themeSize","themeSpacing","themeDensity","themeColor","focusRing","PADDING_STEPS","button","props","_a","_b","_c","_d","variant","buttonGhost","color","toState","isSolid","padding","fontSize","BUTTON_SIZE_FONT","__spreadProps","__spreadValues","node","listener","themeSize","themeSpacing","themeDensity","themeColor","focusRing","toState","themeColor","themeSize","themeSpacing","buttonSwitch","props","_a","_b","checked","check","toState","color","accentColor","node","listener","themeSize","themeColor","themeSpacing","focusRing","toState","themeColor","themeDensity","themeSpacing","SHADOWS","elevation","level","card","props","_a","color","toState","listener","themeSpacing","themeDensity","themeColor","elevation","toState","themeColor","themeSize","themeSpacing","code","props","_a","color","node","listener","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","behavior","merge","toState","autoUpdate","computePosition","flip","offset","shift","attachFloating","node","initialProps","_a","openState","placement","content","keepOpenOnContentHover","timer","cleanup","floating","floatingNode","mounted","reference","rootNode","floatingPartial","listener","event","hide","show","mountedNode","dataTheme","rNode","overlay","overlayEle","wireContent","target","merge","ensureMounted","instantShow","autoUpdate","computePosition","offset","flip","shift","x","y","resolved","instantHide","handleOutside","props","createFloating","kind","open","toState","behaviorKey","anchorPartial","__spreadValues","e","behavior","rawHtml","toState","themeColor","themeSize","themeSpacing","xSvg","tag","props","_a","removable","color","toState","node","removeBtn","rawHtml","e","themeSpacing","listener","themeColor","focusRing","themeSize","combobox","props","options","placement","color","open","multiple","state","toState","openState","show","hide","anchorPartial","createFloating","popoverPartial","_e","node","listener","themeColor","themeSpacing","themeDensity","elevation","merge","inputStyle","themeSize","inputElement","inputPartial","wrap","val","vals","items","opt","tag","_node","cur","filter","v","partial","focusRing","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","command","_node","element","merge","toState","commandSearch","props","color","accentColor","node","ctx","input","onInput","listener","themeSize","themeSpacing","themeDensity","themeColor","focusRing","commandItem","_a","_b","el","text","applyFilter","q","release","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","atMidnight","date","addDays","count","addMonths","sameDay","a","b","isoOf","startOfWeek","weekStart","localeWeekStart","locale","_a","_b","localeObject","info","datePicker","props","_c","_d","mode","time","min","max","disabledDate","format","onChange","accentColor","toState","placeState","selection","releaseOnChange","value","primaryDate","current","base","viewYear","viewMonth","focused","hovered","hour","minute","contentElement","dateFormatter","__spreadValues","monthFormatter","weekdayFormatter","fullDateFormatter","formatOne","formatDisplay","start","end","weekdayNames","_unused","index","isDisabled","withTime","result","selectDate","instantHideRef","reapplyTime","inSelectedRange","listener","tail","low","high","day","isSelectedEnd","goToDate","shiftMonth","delta","next","shiftYear","focusActiveCell","calendar","buildCalendar","show","hide","anchorPartial","createFloating","triggerPartial","_e","node","openAndFocus","event","key","isSelectedPrimary","merge","navButton","label","ariaLabel","onClick","navButtonStyle","header","themeSize","themeSpacing","weekdayHeader","name","themeColor","gridRowStyle","grid","buildWeeks","onGridKey","children","buildTimeRow","buildFooter","themeDensity","elevation","first","month","weeks","week","cells","buildDayCell","disabled","selected","within","outside","isFocused","isToday","l","focusRing","numberSelect","state","timeSelectStyle","action","today","keyboard","toState","themeColor","themeSize","themeSpacing","descriptionList","props","_a","color","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","details","props","_a","_b","duration","color","toState","accentColor","node","listener","themeSize","themeColor","themeSpacing","themeDensity","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","lockCount","lockScroll","unlockScroll","FOCUSABLE","dialog","props","color","open","state","toState","previousFocus","closing","scrollLocked","finalizeClose","dlg","unlockScroll","node","e","r","closeTimer","trapFocus","focusables","el","first","last","onCancel","update","val","lockScroll","focusable","release","listener","themeSize","themeColor","themeSpacing","themeDensity","elevation","toState","themeColor","themeSize","themeSpacing","divider","props","_a","color","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","translateOut","marginMap","isVertical","p","resolvePhysical","placement","isRTL","drawer","props","color","open","size","state","toState","isLogical","physicalFallback","defaultSize","themeSpacing","drawerSize","node","e","dlg","onCancel","physical","closing","scrollLocked","closeTimer","finishClose","unlockScroll","onTransitionEnd","update","val","lockScroll","release","listener","themeSize","themeColor","themeDensity","elevation","toState","themeColor","themeSize","emphasis","props","_a","color","node","listener","toState","themeColor","themeSpacing","empty","props","_a","color","listener","errorBoundary","props","node","error","reset","_a","_b","fallbackEl","toState","themeColor","themeSize","themeSpacing","SIZE_MAP","fab","props","_a","_b","color","toState","dim","themeSpacing","node","listener","themeSize","themeColor","elevation","focusRing","toState","themeColor","themeSize","themeSpacing","figure","props","_a","color","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","formGroup","props","_a","layout","color","isVertical","node","listener","toState","themeColor","themeSize","themeSpacing","HeadingShift","heading","props","_a","color","node","listener","offset","toState","themeColor","themeSpacing","horizontalRule","props","_a","color","node","listener","toState","themeColor","themeSize","themeSpacing","icon","props","_a","color","node","listener","toState","themeColor","themeSpacing","image","props","_a","color","node","listener","toState","themeColor","themeSize","themeSpacing","inputCheckbox","props","_a","_b","color","toState","accentColor","node","listener","themeSize","themeColor","themeSpacing","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","inputColor","props","_a","color","toState","node","element","listener","themeSize","themeColor","themeSpacing","themeDensity","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","inputDateTime","props","_a","_b","mode","color","toState","accentColor","node","element","listener","themeSize","themeColor","themeSpacing","themeDensity","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","inputFile","props","_a","_b","color","toState","accentColor","node","element","listener","themeSize","themeColor","themeSpacing","themeDensity","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","inputNumber","props","_a","_b","color","toState","accentColor","node","element","themeSpacing","listener","themeDensity","themeSize","themeColor","focusRing","themeSpacing","inputOTP","node","container","getInputs","onInput","e","inputs","target","idx","onKeydown","onPaste","_a","_b","_c","text","found","startIdx","char","i","lastFilled","rawHtml","toState","themeColor","themeDensity","themeSize","themeSpacing","EYE_SVG","EYE_OFF_SVG","inputPassword","props","_a","_b","colorState","toState","accentState","visibleState","node","field","l","toggle","rawHtml","themeSpacing","themeDensity","themeColor","themeSize","focusRing","toState","themeColor","themeSize","themeSpacing","inputRadio","props","_a","_b","color","toState","accentColor","node","listener","themeSize","themeColor","themeSpacing","focusRing","toState","themeColor","themeSpacing","inputRange","props","_a","_b","color","toState","accentColor","node","themeSpacing","listener","themeColor","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","inputSearch","props","_a","_b","color","toState","accentColor","node","element","listener","themeSize","themeColor","themeSpacing","themeDensity","focusRing","toState","themeColor","themeSize","themeSpacing","inputSwitch","props","_a","accentColor","toState","node","listener","themeSize","themeColor","themeSpacing","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","inputText","props","_a","_b","color","toState","accentColor","node","element","themeSpacing","listener","themeDensity","themeSize","themeColor","focusRing","toState","themeColor","themeSize","themeSpacing","keyboard","props","_a","color","node","listener","toState","themeColor","themeSize","themeSpacing","label","props","_a","_b","color","accentColor","node","listener","toState","themeColor","themeSize","themeSpacing","link","props","_a","_b","color","toState","accentColor","node","listener","themeSize","themeColor","themeSpacing","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","PADDING_STEPS","GHOST_PADDING","linkButton","props","_a","_b","_c","variant","color","toState","size","fontSize","BUTTON_SIZE_FONT","padding","node","listener","themeSize","themeSpacing","themeDensity","themeColor","focusRing","isSolid","__spreadProps","__spreadValues","toState","themeColor","themeDensity","themeSize","themeSpacing","list","_props","listItem","props","dense","listener","themeSpacing","themeDensity","themeSize","themeColor","listItemButton","_a","_b","color","toState","accentColor","focusRing","toState","themeColor","themeSize","themeSpacing","mark","props","_a","accentColor","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","menu","props","_a","items","selectable","color","accentColor","activeKey","toState","node","element","id","buttons","item","index","key","__spreadProps","__spreadValues","l","e","k","keys","it","i","idx","next","themeSpacing","themeSize","themeDensity","themeColor","focusRing","elevation","isState","value","toStyles","frame","out","transforms","key","prefersReducedMotion","e","motion","props","_a","_b","_c","_d","initial","animate","exit","transition","options","node","el","target","release","next","done","toState","themeColor","themeSize","themeSpacing","orderedList","props","_a","color","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","getPages","current","total","_","i","pages","start","end","pagination","props","_a","color","accentColor","state","toState","btnBase","listener","themeSpacing","themeDensity","themeSize","themeColor","focusRing","activeStyle","__spreadProps","__spreadValues","node","content","page","items","ellipsisIndex","p","isActive","toState","themeColor","themeDensity","themeSpacing","panelSection","props","_a","padding","divider","color","toState","__spreadValues","listener","themeSpacing","themeDensity","themeColor","toState","themeColor","themeSize","paragraph","props","_a","color","node","listener","merge","toState","themeColor","themeDensity","themeSpacing","popover","props","_a","open","placement","openOn","popoverId","openState","toState","placeState","show","hide","anchorPartial","createFloating","popoverPartial","l","themeColor","themeSpacing","themeDensity","elevation","node","id","merge","listener","_e","e","related","root","floatingEl","toState","themeColor","themeSize","themeSpacing","popoverArrow","props","placement","color","sideOffset","bordered","place","flipMap","getFlipped","listener","_a","start","pos","end","x","y","toState","themeColor","themeDensity","themeSize","themeSpacing","preformated","props","_a","color","node","listener","toState","themeColor","themeSpacing","progress","props","_a","_b","color","accentColor","node","listener","rawHtml","toState","themeColor","themeSize","themeSpacing","STAR_FILLED","STAR_EMPTY","rating","props","_a","_b","max","readOnly","onChange","color","valueState","toState","hoveredState","activeCount","listener","hovered","themeSpacing","themeSize","themeColor","node","i","index","interactive","next","e","current","target","star","__spreadProps","__spreadValues","rawHtml","focusRing","toState","themeColor","themeSpacing","ringProgress","props","_a","_b","_c","size","thickness","value","color","trackColor","holePercent","mask","l","node","themeDensity","themeSpacing","row","props","gap","align","justify","wrap","__spreadValues","listener","themeSpacing","themeDensity","toState","themeColor","themeSpacing","scrollArea","props","_a","color","l","toState","themeColor","themeSize","themeSpacing","segmented","props","_a","_b","_c","items","color","accentColor","value","toState","node","element","buttons","item","index","key","l","themeSize","themeSpacing","themeColor","elevation","focusRing","themeColor","themeColorToken","themeDensity","themeSize","themeSpacing","select","props","color","accentColor","node","listener","themeSize","themeColor","themeSpacing","themeDensity","l","svg","themeColorToken","focusRing","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","selectBox","props","options","placement","color","open","multiple","state","toState","openState","show","hide","anchorPartial","createFloating","popoverPartial","_e","node","listener","themeColor","themeSpacing","themeDensity","elevation","merge","wrap","val","vals","opt","tag","_node","cur","filter","v","partial","themeSize","focusRing","themeColor","themeDensity","themeSize","themeSpacing","selectItem","props","accentColor","color","value","node","select","state","listener","val","v","themeSize","themeSpacing","themeDensity","themeColor","focusRing","toState","themeColor","themeDensity","themeSize","themeSpacing","selectList","props","_a","color","multiple","state","inputs","listener","val","v","node","hashString","toState","themeColor","themeSize","themeSpacing","skeleton","props","_a","color","keyframes","animationName","listener","toState","themeColor","themeSize","small","props","_a","color","node","listener","hashString","toState","themeColor","themeSize","themeSpacing","keyframes","animationName","spinner","props","_a","color","node","listener","merge","toState","themeColor","themeSpacing","splitter","props","direction","defaultSize","min","max","_node","element","merge","toState","splitterPanel","node","ctx","el","prop","isFirst","apply","size","release","splitterHandle","handle","isHorizontal","releaseAriaValue","onKeydown","e","step","next","cancelDrag","onMousedown","container","onMousemove","rect","raw","onMouseup","listener","themeColor","focusRing","themeSpacing","themeDensity","themeSpacing","stack","props","gap","align","__spreadValues","listener","themeSpacing","themeDensity","toState","themeColor","themeSize","themeSpacing","steps","props","_a","items","direction","color","accentColor","current","node","element","stepEls","item","index","l","cur","toState","themeColor","themeSize","strong","props","_a","color","node","listener","toState","themeColor","themeSize","subscript","props","_a","color","node","listener","toState","themeColor","themeSize","superscript","props","_a","color","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","table","props","_a","color","node","listener","l","toState","themeColor","themeDensity","themeSize","themeSpacing","tabs","props","_a","_b","_c","items","accentColor","color","activeKey","toState","node","element","id","tablist","item","index","key","l","e","k","keys","it","i","idx","next","themeSize","themeSpacing","themeDensity","themeColor","focusRing","panels","toState","themeColor","themeDensity","themeSize","themeSpacing","textarea","props","_a","_b","color","toState","accentColor","autoResize","node","el","resize","listener","themeSpacing","themeDensity","themeSize","themeColor","focusRing","toState","themeColor","themeDensity","themeSpacing","timeline","timelineItem","props","_a","_b","_c","last","color","accentColor","activeState","toState","__spreadValues","listener","themeSpacing","themeDensity","themeColor","toState","themeColor","themeDensity","themeSize","themeSpacing","toast","props","position","color","state","toState","isTop","isCenter","isRight","overlayEle","themeSpacing","rootNode","overlay","listener","themeDensity","themeSize","themeColor","elevation","node","done","finished","timer","finish","onEnd","e","_a","toState","themeColor","themeSize","themeSpacing","toggleGroup","props","_a","items","multiple","color","accentColor","value","toState","node","element","buttons","item","index","key","l","val","arr","v","themeSize","themeSpacing","themeColor","focusRing","toolbar","props","row","toolbarSpacer","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","tooltip","props","open","placement","content","placeState","toState","contentState","tooltipId","contentElement","listener","show","hide","anchorPartial","createFloating","tooltipPartial","themeSpacing","themeDensity","themeColor","themeSize","elevation","popoverArrow","merge","_e","node","e","ElementNode","getItemId","node","index","transitionGroup","props","duration","delay","previousRects","cancelMap","pendingTimers","pendingFrames","cancel","timer","frame","item","dom","_a","key","prev","next","deltaX","deltaY","cancelled","finish","onEnd","event","toState","themeColor","themeSize","themeSpacing","unorderedList","props","_a","color","node","listener"]}