@domphy/ui 0.18.20 → 0.18.21

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/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/patches/buttonGhost.ts","../src/patches/buttonSwitch.ts","../src/patches/card.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/inputPassword.ts","../src/patches/inputOTP.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/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/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/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\";\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 outlines 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),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n outlineOffset: \"-1px\",\n overflow: \"hidden\",\n \"& > details\": {\n borderBottom: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n },\n \"& > details:last-child\": {\n borderBottom: \"none\",\n },\n \"& > details > summary:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n },\n },\n };\n}\n\nexport { accordion };\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 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 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 \"& 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 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),\n minWidth: themeSpacing(6),\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontSize: (l) => themeSize(l, \"decrease-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 },\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 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, \"shift-9\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n \"& > *\": {\n display: \"inline-flex\",\n alignItems: \"center\",\n color: (listener) =>\n themeColor(listener, \"shift-8\", 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\";\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, \"shift-8\", color.get(listener)),\n borderRadius: themeSpacing(1),\n \"&:hover\": {\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", color.get(listener))}`,\n outlineOffset: themeSpacing(0.5),\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\";\n\n/**\n * A themed button control with density-aware padding/radius and hover, focus-visible,\n * `[disabled]`, and `[aria-busy=true]` states. Apply to a `<button>` element.\n *\n * @hostTag button\n * @param props.color - Button color tone. Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @example { button: \"Save\", $: [button({ color: \"primary\" })] }\n */\nfunction button(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"primary\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"button\") {\n console.warn(`\"button\" primitive patch must use button tag`);\n }\n },\n style: {\n appearance: \"none\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n // Single-line bounded control: block/radius = 1D, inline = 3D.\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\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: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"shift-9\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) =>\n `inset 0 0 0 ${themeSpacing(0.5)} ${themeColor(listener, \"shift-6\", 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, \"shift-4\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"shift-8\", \"neutral\"),\n },\n \"&[aria-busy=true]\": {\n opacity: 0.7,\n cursor: \"wait\",\n pointerEvents: \"none\",\n },\n },\n };\n}\n\nexport { button };\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 * 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 * @example { button: \"×\", $: [buttonGhost()] }\n * @example { button: { span: null, $: [icon({ name: \"trash\" })] }, $: [buttonGhost({ color: \"error\" })] }\n */\nfunction buttonGhost(\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(`\"buttonGhost\" primitive patch must use button tag`);\n }\n },\n style: {\n appearance: \"none\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 1),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\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 color: (listener) => themeColor(listener, \"shift-6\", color.get(listener)),\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n color: (listener) =>\n themeColor(listener, \"shift-9\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) =>\n `inset 0 0 0 ${themeSpacing(0.5)} ${themeColor(listener, \"shift-6\", color.get(listener))}`,\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"shift-4\", \"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\";\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, \"shift-3\", color.get(listener))}`,\n minWidth: themeSpacing(12),\n minHeight: themeSpacing(6),\n borderRadius: themeSpacing(999),\n paddingLeft: themeSpacing(7),\n paddingRight: themeSpacing(2),\n transition: \"padding-left 0.3s, padding-right 0.3s\",\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\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, \"shift-9\"),\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\";\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 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, \"shift-4\", color.get(listener))}`,\n outlineOffset: \"-1px\",\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 margin: 0,\n },\n \"& > p\": {\n gridArea: \"desc\",\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n color: (listener) =>\n themeColor(listener, \"shift-9\", 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, \"shift-3\", color.get(listener))}`,\n },\n },\n };\n}\n\nexport { card };\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, \"shift-9\", 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 { createFloating } from \"../utils/floating.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 };\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, \"shift-9\", 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, \"shift-4\", \"neutral\")}`,\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 1),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"shift-9\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n },\n };\n\n merge(anchorPartial, partial);\n return anchorPartial;\n}\n\nexport { combobox };\n","import {\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\n// The SAME reused-node gap described below (in createFloating's own comment)\n// also breaks teardown two OTHER ways, both traced back to the same cause: a\n// factory like popover()/tooltip() called again by a reactive parent creates\n// a brand new createFloating() closure (fresh `cleanup`/`floatingNode`/\n// `openState` locals) on the SAME reused anchor DOM element — but only the\n// FIRST-ever closure's `_onMount` actually fires, so only IT ever registers\n// a BeforeRemove hook, and nothing ever tells an OLDER closure that a NEWER\n// one has taken over.\n//\n// 1. Anchor removed while a LATER generation's panel is the one open: the\n// first closure's BeforeRemove hook (the only one that exists) tears down\n// ITS OWN (possibly never-shown) state, while the real, visible panel has\n// no cleanup wired to it — orphaned in the #domphy-floating portal.\n// 2. Anchor merely RE-RENDERED while a panel is open (no removal at all —\n// e.g. hovering a tooltip, then an unrelated state change re-renders that\n// row): the live event handlers (onMouseLeave etc., rebound to the NEWEST\n// closure on every patch) now only ever reach the NEW closure's own\n// (never-shown) state. The OLD closure's actually-visible panel has no\n// live interaction path to it anymore — nothing can ever close it again,\n// not even moving the mouse away.\n//\n// Fix both by keying \"what to tear down\" off the anchor's live DOM element\n// (stable across reuse) instead of a closure-local variable: every\n// generation that touches this anchor first tears down whatever the\n// PREVIOUS generation left behind (if it's a different generation — a\n// closure never tears down its own current state on repeat interactions),\n// then claims the slot for itself. Case 1 falls out of whichever hook did\n// attach always reading the CURRENT slot instead of its own stale closure;\n// case 2 falls out of \"claiming\" running on every real interaction, not just\n// removal.\n//\n// Slots are keyed per `kind` (one per consumer component: popover, tooltip,\n// selectBox, …), not one per element: two DIFFERENT floating components\n// legitimately share one anchor (a button with a tooltip that opens a\n// popover), and a single element-wide slot made every interaction of one\n// tear down the other's live panel. Generational takeover only ever needs\n// to evict the SAME component's previous generation.\nconst teardownByElement = new WeakMap<Element, Map<string, () => void>>();\n\nfunction claimTeardownSlot(\n element: Element,\n kind: string,\n teardown: () => void,\n): void {\n let slots = teardownByElement.get(element);\n if (!slots) {\n slots = new Map();\n teardownByElement.set(element, slots);\n }\n const previous = slots.get(kind);\n if (previous && previous !== teardown) previous();\n slots.set(kind, teardown);\n}\n\nfunction releaseTeardownSlots(element: Element): void {\n const slots = teardownByElement.get(element);\n if (!slots) return;\n teardownByElement.delete(element);\n slots.forEach((teardown) => teardown());\n}\n\nfunction createFloating(props: {\n kind: string;\n open?: ValueOrState<boolean>;\n placement: State<Placement>;\n content: DomphyElement;\n}) {\n const { kind, open = false, placement } = props;\n\n let timer: ReturnType<typeof setTimeout> | null = null;\n let cleanup: (() => void) | null = null;\n let reference: HTMLElement | null = null;\n let floating: HTMLElement | null = null;\n let floatingNode: ElementNode | null = null;\n let rootNode: ElementNode | null = null;\n let mounted = false;\n const openState = toState(open);\n\n // Teardown must leave the closure RE-MOUNTABLE, not permanently dead: a\n // still-live instance can get its slot evicted (e.g. a stale generation's\n // teardown running via a handler that was never rebound) and later be shown\n // again. Resetting mounted/floatingNode lets ensureMounted re-insert the\n // panel; leaving them stale made show() position a detached node forever.\n const teardown = () => {\n if (timer) clearTimeout(timer);\n timer = null;\n if (cleanup) {\n cleanup();\n cleanup = null;\n }\n if (floatingNode) {\n floatingNode.remove();\n floatingNode = null;\n }\n floating = null;\n mounted = false;\n openState.set(false);\n };\n\n // `reference`/`rootNode` are normally captured once by anchorPartial's\n // _onMount — but ElementNode.patch() deliberately does NOT re-run lifecycle\n // hooks on a reused (already-mounted) DOM node (\"hooks already ran\"). A\n // factory like popover()/tooltip() that gets called AGAIN by a reactive\n // parent (a fresh createFloating() closure, fresh `reference`/`rootNode`\n // locals) never gets a second _onMount — so show()/hide() silently no-op\n // forever after any re-render of the trigger's ancestor. Event handlers,\n // unlike hooks, ARE live-rebound on every patch (see ElementNode._bindEvent)\n // and already receive the current ElementNode as their 2nd argument — so\n // show(node)/hide(node) (called from the trigger's onClick/onMouseEnter/…)\n // re-derive `reference`/`rootNode` from THAT, idempotently, on every call.\n // This makes each createFloating() instance self-sufficient regardless of\n // whether its own _onMount ever fired.\n const ensureReference = (node?: ElementNode) => {\n if (!node) return;\n rootNode = node.getRoot();\n reference = node.domElement as HTMLElement;\n if (reference) claimTeardownSlot(reference, kind, teardown);\n };\n\n const ensureMounted = () => {\n if (mounted || !rootNode) return;\n mounted = true;\n floatingNode = rootNode.children!.insert(props.content) as ElementNode;\n };\n\n const instantShow = () => {\n ensureMounted();\n if (reference && floating) {\n cleanup && 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 const instantHide = () => {\n cleanup && cleanup();\n cleanup = null;\n openState.set(false);\n };\n const show = (node?: ElementNode) => {\n ensureReference(node);\n timer && clearTimeout(timer);\n timer = setTimeout(instantShow, 100);\n };\n const hide = (node?: ElementNode) => {\n ensureReference(node);\n timer && clearTimeout(timer);\n timer = setTimeout(instantHide, 100);\n };\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 _onMount: (node) => {\n floating = node.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 merge(props.content, floatingPartial);\n\n const anchorPartial: PartialElement = {\n onKeyDown: (e) => (e as KeyboardEvent).key === \"Escape\" && hide(),\n _onMount: (node) => {\n rootNode = node.getRoot();\n reference = node.domElement as HTMLElement;\n if (reference) claimTeardownSlot(reference, kind, teardown);\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)) {\n hide();\n }\n };\n node.getRoot().domElement!.addEventListener(\"click\", handleOutside);\n\n // This _onMount only ever fires ONCE per real DOM element (a reused,\n // patched anchor never gets a second one) — so this is the single\n // opportunity to attach the BeforeRemove hook for that element's whole\n // lifetime. It must not tear down THIS closure's own (possibly stale)\n // `cleanup`/`floatingNode` directly — look up teardownByElement instead,\n // which always holds whichever generation last interacted with this\n // anchor (see the WeakMap comment above and ensureReference).\n node.addHook(\"BeforeRemove\", () => {\n // Tear down the @domphy/floating autoUpdate loop (scroll/resize/rAF\n // listeners) and the floating panel itself — for EVERY kind anchored\n // to this element, since the anchor is going away. Without this,\n // removing the anchor while the overlay is open leaks observers that\n // keep positioning a detached node, or leaves the panel orphaned.\n if (reference) releaseTeardownSlots(reference);\n node.getRoot().domElement!.removeEventListener(\"click\", handleOutside);\n });\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\";\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 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 \"&:hover\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-4\", 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: \"0px\",\n borderRadius: themeSpacing(1),\n paddingInlineStart: themeSpacing(2),\n paddingInlineEnd: removable ? themeSpacing(1) : themeSpacing(2),\n gap: themeSpacing(2),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"shift-9\", color.get(listener)),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", 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\";\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, \"shift-3\", 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 \"&:focus-visible\": {\n borderBottomColor: (listener) =>\n themeColor(listener, \"shift-6\", 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 outline. 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 color: (listener) => themeColor(listener, \"shift-9\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener) => themeColor(listener, \"shift-2\", color),\n },\n \"&:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor)}`,\n outlineOffset: `-${themeSpacing(0.5)}`,\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 themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { createFloating } from \"../utils/floating.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: \"600\",\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: \"600\",\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: themeSpacing(2),\n backgroundColor: (listener) => themeColor(listener, \"base\"),\n color: (listener) => themeColor(listener, \"shift-10\"),\n border: (listener) => `1px solid ${themeColor(listener, \"shift-4\")}`,\n boxShadow: \"0 8px 24px rgba(0,0,0,0.18)\",\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, \"shift-2\", accentColor.get(l))\n : \"transparent\",\n color: (l: Listener) =>\n selected\n ? themeColor(l, \"shift-0\", accentColor.get(l))\n : themeColor(l, \"shift-9\"),\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 \"&:focus-visible\": {\n outline: (l: Listener) =>\n `2px solid ${themeColor(l, \"shift-6\", 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: \"600\" } },\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, \"shift-8\", 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, \"shift-3\")}`,\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, \"shift-8\"),\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, \"shift-4\")}`,\n backgroundColor: (l: Listener) => themeColor(l, \"base\"),\n color: (l: Listener) => themeColor(l, \"shift-9\"),\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 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) =>\n themeColor(listener, \"shift-9\", 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\";\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 outline. 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 style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"shift-9\", 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 outlineOffset: `-${themeSpacing(0.5)}`,\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n },\n \"& > :not(summary)\": {\n maxHeight: \"0px\",\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 { 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 dlg.close();\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.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 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 padding: (listener) => themeSpacing(themeDensity(listener) * 3),\n boxShadow: (listener) =>\n `0 ${themeSpacing(9)} ${themeSpacing(16)} ${themeColor(listener, \"shift-4\", \"neutral\")}`,\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, \"shift-9\", color.get(listener)),\n minHeight: \"1lh\",\n \"&::before\": {\n content: `\"\"`,\n flex: 1,\n borderColor: (listener) =>\n themeColor(listener, \"shift-4\", color.get(listener)),\n borderWidth: \"1px\",\n borderBottomStyle: \"solid\",\n },\n \"&::after\": {\n content: `\"\"`,\n flex: 1,\n borderColor: (listener) =>\n themeColor(listener, \"shift-4\", 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 { 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 dlg.close();\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.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 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: (listener) =>\n `0 ${themeSpacing(4)} ${themeSpacing(12)} ${themeColor(listener, \"shift-4\", \"neutral\")}`,\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 color: (listener) => themeColor(listener, \"shift-6\", color.get(listener)),\n // First child (icon area): more muted color to visually recede behind the text\n \"& > :first-child\": {\n color: (listener) =>\n themeColor(listener, \"shift-5\", 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\";\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 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-9\", color.get(listener)),\n color: (listener) => themeColor(listener, \"shift-0\", color.get(listener)),\n boxShadow: (listener) =>\n `0 ${themeSpacing(1)} ${themeSpacing(4)} ${themeColor(listener, \"shift-4\", \"neutral\")}`,\n transition: \"background-color 200ms ease, box-shadow 200ms ease\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n boxShadow: (listener) =>\n `0 ${themeSpacing(2)} ${themeSpacing(6)} ${themeColor(listener, \"shift-5\", \"neutral\")}`,\n },\n \"&:focus-visible\": {\n outline: (listener) =>\n `2px solid ${themeColor(listener, \"shift-6\", color.get(listener))}`,\n outlineOffset: \"2px\",\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, \"shift-9\", 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) =>\n themeColor(listener, \"shift-8\", 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 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 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) =>\n themeColor(listener, \"shift-9\", 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 ? \"0px\" : 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) =>\n themeColor(listener, \"shift-9\", 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 style: {\n border: 0,\n height: \"1px\",\n marginInline: 0,\n marginTop: themeSpacing(3),\n marginBottom: themeSpacing(3),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-4\", 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, \"shift-9\", 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 },\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\";\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 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, \"shift-4\", color.get(listener))}`,\n color: (listener) =>\n themeColor(listener, \"shift-9\", color.get(listener)),\n width: themeSpacing(4),\n height: themeSpacing(4),\n },\n \"&:hover::before\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", 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 outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", 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 {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\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 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 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 \"&::-webkit-color-swatch-wrapper\": {\n margin: 0,\n padding: 0,\n },\n \"&::-webkit-color-swatch\": {\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\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, \"shift-4\", \"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\";\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, \"shift-9\", 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, \"shift-4\", color.get(listener))}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n \"&::-webkit-calendar-picker-indicator\": {\n cursor: \"pointer\",\n opacity: 0.85,\n },\n \"&:hover:not([disabled]):not([aria-busy=true]), &:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"shift-8\", \"neutral\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", \"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\";\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, \"shift-9\", 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, \"shift-4\", color.get(listener))}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 1),\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, \"shift-1\", color.get(listener)),\n },\n \"&:hover:not([disabled]):not([aria-busy=true]), &:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n },\n \"&[disabled]\": {\n opacity: 0.8,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"shift-8\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", \"neutral\")}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-1\", \"neutral\"),\n },\n \"&[disabled]::-webkit-file-upload-button\": {\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"shift-8\", \"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\";\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),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"shift-9\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n \"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button\": {\n opacity: 1,\n },\n \"&:hover:not([disabled]):not([aria-busy=true]), &:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", 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, \"shift-4\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"shift-8\", \"neutral\"),\n },\n },\n };\n}\n\nexport { inputNumber };\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\";\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),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (l) =>\n `1px solid ${themeColor(l, \"shift-4\", colorState.get(l))}`,\n color: (l) => themeColor(l, \"shift-9\", colorState.get(l)),\n backgroundColor: (l) =>\n themeColor(l, \"inherit\", colorState.get(l)),\n fontSize: (l) => themeSize(l, \"inherit\"),\n \"&:focus-within\": {\n outline: (l) =>\n `${themeSpacing(0.5)} solid ${themeColor(l, \"shift-6\", accentState.get(l))}`,\n },\n } as StyleObject,\n };\n}\n\nexport { inputPassword };\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 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 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 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, \"shift-4\", color.get(listener))}`,\n color: (listener) =>\n themeColor(listener, \"shift-9\", color.get(listener)),\n width: themeSpacing(4),\n height: themeSpacing(4),\n },\n \"&:hover::before\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", 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 outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", 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\";\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 \"&:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n outlineOffset: themeSpacing(1),\n borderRadius: themeSpacing(2),\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\";\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, \"shift-9\", 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, \"shift-4\", color.get(listener))}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\n minWidth: themeSpacing(32),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\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]), &:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"shift-8\", \"neutral\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", \"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\";\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 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 \"&: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\";\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),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"shift-9\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\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]), &:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", 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, \"shift-4\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"shift-8\", \"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, \"shift-9\", 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, \"shift-4\", 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, \"shift-9\", 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, \"shift-8\", \"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\";\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 color: (listener) => themeColor(listener, \"shift-9\", color.get(listener)),\n textDecoration: \"none\",\n \"&:visited\": {\n color: (listener) =>\n themeColor(listener, \"shift-9\", accentColor.get(listener)),\n },\n \"&:hover:not([disabled])\": {\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n textDecoration: \"underline\",\n },\n \"&:focus-visible\": {\n borderRadius: themeSpacing(1),\n outlineOffset: themeSpacing(1),\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"shift-8\", \"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\";\n\n/**\n * An `<a>` element styled to look like a button — same visual appearance as\n * `button()` but preserves link semantics (href, middle-click, right-click).\n * Apply to an `<a>` element.\n *\n * @hostTag a\n * @param props.color - Button color tone. Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @example { a: \"Open app\", href: \"/app\", $: [linkButton({ color: \"primary\" })] }\n */\nfunction linkButton(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"primary\", \"color\");\n\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, \"inherit\"),\n textDecoration: \"none\",\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\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 outlineOffset: \"-1px\",\n outlineWidth: \"1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"shift-9\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n \"&:hover\": {\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) =>\n `inset 0 0 0 ${themeSpacing(0.5)} ${themeColor(listener, \"shift-6\", 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, \"shift-4\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"shift-8\", \"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\";\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 },\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, \"shift-9\", color.get(listener)),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\n transition: \"background-color 150ms ease\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-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 outline: (listener) =>\n `2px solid ${themeColor(listener, \"shift-6\", accentColor)}`,\n outlineOffset: \"-2px\",\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, \"shift-9\", 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\";\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.findIndex((ki) => ki === 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 color: (l: Listener) => themeColor(l, \"shift-9\", color),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\", color),\n \"&:hover:not([disabled]):not([aria-current=true])\": {\n backgroundColor: (l: Listener) => themeColor(l, \"shift-2\", color),\n },\n \"&[aria-current=true]\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-3\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-10\"),\n },\n \"&:focus-visible\": {\n outline: (l: Listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(l, \"shift-6\", accentColor)}`,\n outlineOffset: `-${themeSpacing(0.5)}`,\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 },\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 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 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 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, \"shift-9\", 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\";\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),\n border: \"none\",\n cursor: \"pointer\",\n fontSize: (listener: any) => themeSize(listener, \"inherit\"),\n backgroundColor: \"transparent\",\n color: (listener: any) => themeColor(listener, \"shift-9\", color),\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener: any) =>\n themeColor(listener, \"shift-2\", color),\n },\n \"&[disabled]\": {\n opacity: 0.4,\n cursor: \"not-allowed\",\n },\n };\n\n const activeStyle = {\n ...btnBase,\n backgroundColor: (listener: any) =>\n themeColor(listener, \"shift-6\", accentColor),\n color: (listener: any) => themeColor(listener, \"shift-11\", accentColor),\n fontWeight: \"600\",\n cursor: \"default\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener: any) =>\n themeColor(listener, \"shift-6\", accentColor),\n },\n };\n\n return {\n role: \"navigation\",\n ariaLabel: \"Pagination\",\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 { 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, \"shift-9\", 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 merge,\n type Listener,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport type { Placement } from \"@domphy/floating\";\nimport { themeColor } from \"@domphy/theme\";\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 });\n\n const popoverPartial: PartialElement = {\n role: \"dialog\",\n dataTone: \"shift-14\",\n style: {\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\"),\n },\n onMouseEnter: () => openOn === \"hover\" && show(),\n onMouseLeave: () => openOn === \"hover\" && hide(),\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, \"shift-9\", 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\" : \"0px\",\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, \"shift-9\", 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 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, \"shift-3\", color.get(listener)),\n \"&::-webkit-progress-bar\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-3\", 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 { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\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 fontSize: \"1.5rem\",\n cursor: readOnly ? \"default\" : \"pointer\",\n color: (listener) => themeColor(listener, \"shift-8\", 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 padding: 0,\n cursor: \"inherit\",\n color: \"inherit\",\n fontSize: \"inherit\",\n display: \"flex\",\n alignItems: \"center\",\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 // 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, 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 \"&::-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\";\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 as a string. */\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, \"shift-9\", color),\n backgroundColor: \"transparent\",\n transition: \"background-color 300ms ease\",\n \"&:hover:not([disabled]):not([aria-checked=true])\": {\n backgroundColor: (l: Listener) => themeColor(l, \"shift-3\", 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 },\n \"&:focus-visible\": {\n outline: (l: Listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(l, \"shift-6\", accentColor)}`,\n outlineOffset: `-${themeSpacing(0.5)}`,\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: \"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, \"shift-2\", 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\";\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, \"shift-9\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color)}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\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 \"&:not([multiple])\": {\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-5\", accentColor)}`,\n },\n \"&:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", 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, \"shift-8\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", \"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 { createFloating } from \"../utils/floating.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 };\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 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, \"shift-4\", \"neutral\")}`,\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 2),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"shift-9\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\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\";\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, \"shift-9\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n \"&:hover:not([disabled]):not([aria-selected=true])\": {\n backgroundColor: (listener) => themeColor(listener, \"shift-2\", color),\n },\n \"&[aria-selected=true]\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-6\", accentColor),\n color: (listener) => themeColor(listener, \"shift-11\"),\n },\n \"&:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor)}`,\n outlineOffset: `-${themeSpacing(0.5)}`,\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 },\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 pulsing opacity animation. Marked `aria-hidden`, themed\n * background/foreground, fixed height, slight rounding. No host-tag check; typically applied\n * to a block-level element such as a `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 const keyframes = {\n \"0%,100%\": { opacity: 1 },\n \"50%\": { opacity: 0.4 },\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, \"shift-9\", 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 animation: `${animationName} 1.5s 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 color: (listener) => themeColor(listener, \"shift-9\", 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, \"shift-9\", 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, \"shift-4\", 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\";\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 style: {\n flexShrink: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: (listener) => themeColor(listener, \"shift-2\"),\n \"&:hover\": {\n backgroundColor: (listener) => themeColor(listener, \"shift-3\"),\n },\n \"&:focus-visible\": {\n outline: (listener) => `2px solid ${themeColor(listener, \"shift-6\")}`,\n outlineOffset: \"2px\",\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 {\n type DomphyElement,\n type Listener,\n type PartialElement,\n toState,\n type ValueOrState,\n} from \"@domphy/core\";\nimport { type ThemeColor, themeColor, themeSize, themeSpacing } 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 // 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: \"600\",\n flexShrink: \"0\",\n border: (l: Listener) =>\n `2px solid ${themeColor(l, \"shift-4\", color)}`,\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\"),\n color: (l: Listener) => themeColor(l, \"shift-8\"),\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) =>\n themeColor(l, \"shift-3\", color),\n zIndex: \"0\",\n },\n \"&[data-status=active]::before\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-6\", accentColor),\n borderColor: (l: Listener) =>\n themeColor(l, \"shift-6\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-15\", accentColor),\n },\n \"&[data-status=done]::before\": {\n content: '\"✓\"',\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-3\", color),\n borderColor: (l: Listener) => themeColor(l, \"shift-3\", color),\n color: (l: Listener) => themeColor(l, \"shift-9\", color),\n },\n \"&[data-status=done]:not(:first-child)::after\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-3\", color),\n },\n \"&[data-status=active]:not(:first-child)::after\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-6\", accentColor),\n },\n \"&[data-status=pending]\": {\n color: (l: Listener) => themeColor(l, \"shift-7\"),\n },\n \"&[data-status=active]\": {\n color: (l: Listener) => themeColor(l, \"shift-10\"),\n fontWeight: \"600\",\n },\n \"&[data-status=done]\": {\n color: (l: Listener) => themeColor(l, \"shift-8\"),\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: 700,\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, \"shift-9\", 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, \"shift-9\", 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 style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"shift-9\", 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) =>\n themeColor(listener, \"shift-9\", 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 \"& tbody tr:hover\": {\n backgroundColor: (listener) =>\n `${themeColor(listener, \"shift-2\")}!important`,\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\";\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.findIndex((ki) => ki === 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 color: (l: Listener) => themeColor(l, \"shift-9\"),\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 \"&:hover:not([disabled])\": {\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 boxShadow: (l: Listener) =>\n `inset 0 -${themeSpacing(0.5)} 0 0 ${themeColor(l, \"shift-6\", accentColor)}`,\n },\n \"&:focus-visible\": {\n boxShadow: (l: Listener) =>\n `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\";\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, \"shift-9\", color.get(listener)),\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n \"&::placeholder\": {\n color: (listener) => themeColor(listener, \"shift-7\"),\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-5\", accentColor.get(listener))}`,\n },\n \"&:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", 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, \"shift-8\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", \"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: \"0.25em\",\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\";\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, \"shift-9\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n boxShadow: (listener) =>\n `0 ${themeSpacing(2)} ${themeSpacing(9)} ${themeColor(listener, \"shift-4\", \"neutral\")}`,\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\";\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 { items = [], multiple = false, color = \"neutral\", 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),\n color: (l: Listener) => themeColor(l, \"shift-9\", color),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\", color),\n transition: \"background-color 300ms ease\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (l: Listener) => themeColor(l, \"shift-2\", color),\n },\n \"&[aria-pressed=true]\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-3\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-12\", accentColor),\n },\n \"&:focus-visible\": {\n outline: (l: Listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(l, \"shift-6\", accentColor)}`,\n outlineOffset: `-${themeSpacing(0.5)}`,\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 outline: (l: Listener) => `1px solid ${themeColor(l, \"shift-3\", color)}`,\n outlineOffset: \"-1px\",\n },\n };\n}\n\nexport { toggleGroup };\nexport type { ToggleItem };\n","import type { DomphyElement, PartialElement } from \"@domphy/core\";\nimport { themeDensity, themeSpacing } from \"@domphy/theme\";\n\n/**\n * A horizontal flex row with vertically centered items. Useful for headers,\n * toolbars, navigation bars, and action strips.\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 const gap = props.gap ?? 4;\n return {\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: (listener) => themeSpacing(themeDensity(listener) * gap),\n },\n };\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 { 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),\n color: (listener) => themeColor(listener, \"shift-9\"),\n backgroundColor: (listener) => themeColor(listener),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\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) =>\n (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, \"shift-9\", 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":"8bAAA,OAA8B,WAAAA,OAAkC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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,UAAWF,EAAM,IAAIE,CAAQ,CAAC,EACxE,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","accordion","props","_a","_b","type","color","accentColor","node","el","handler","event","summary","item","detail","listener","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","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","button","props","_a","color","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","buttonGhost","props","_a","color","node","listener","toState","themeColor","themeSize","themeSpacing","buttonSwitch","props","_a","_b","checked","check","color","accentColor","node","listener","toState","themeColor","themeDensity","themeSpacing","card","props","_a","color","listener","toState","themeColor","themeSize","themeSpacing","code","props","_a","color","node","listener","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","merge","toState","autoUpdate","computePosition","flip","offset","shift","teardownByElement","claimTeardownSlot","element","kind","teardown","slots","previous","releaseTeardownSlots","createFloating","props","open","placement","timer","cleanup","reference","floating","floatingNode","rootNode","mounted","openState","ensureReference","node","ensureMounted","instantShow","x","y","resolved","instantHide","show","hide","floatingPartial","listener","event","_a","dataTheme","rNode","overlay","overlayEle","e","handleOutside","target","toState","themeColor","themeSize","themeSpacing","xSvg","tag","props","_a","removable","color","node","removeBtn","e","listener","combobox","props","options","placement","color","open","multiple","state","toState","openState","show","hide","anchorPartial","createFloating","popoverPartial","_e","node","merge","inputStyle","themeSpacing","listener","themeSize","themeColor","inputElement","inputPartial","wrap","val","vals","items","opt","tag","_node","cur","filter","v","partial","themeDensity","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","command","_node","element","commandSearch","props","color","accentColor","node","ctx","input","onInput","listener","commandItem","_a","_b","el","text","applyFilter","q","release","merge","toState","themeColor","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","first","month","weeks","week","cells","buildDayCell","disabled","selected","within","outside","isFocused","isToday","l","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","accentColor","node","listener","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","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","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","dim","node","listener","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","accentColor","node","listener","themeColor","themeDensity","themeSize","themeSpacing","inputColor","_props","node","element","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","inputDateTime","props","_a","_b","mode","color","accentColor","node","element","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","inputFile","props","_a","_b","color","accentColor","node","element","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","inputNumber","props","_a","_b","color","accentColor","node","element","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","EYE_SVG","EYE_OFF_SVG","inputPassword","props","_a","_b","colorState","accentState","visibleState","node","field","l","toggle","themeSpacing","inputOTP","node","container","getInputs","onInput","e","inputs","target","idx","onKeydown","onPaste","_a","_b","_c","text","found","startIdx","char","i","lastFilled","toState","themeColor","themeSize","themeSpacing","inputRadio","props","_a","_b","color","accentColor","node","listener","toState","themeColor","themeSpacing","inputRange","props","_a","_b","color","accentColor","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","inputSearch","props","_a","_b","color","accentColor","node","element","listener","toState","themeColor","themeSize","themeSpacing","inputSwitch","props","_a","accentColor","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","inputText","props","_a","_b","color","accentColor","node","element","listener","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","accentColor","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","linkButton","props","_a","color","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","list","_props","listItem","props","dense","listener","listItemButton","_a","_b","color","accentColor","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","ki","next","themeSpacing","themeSize","themeDensity","themeColor","isState","value","toStyles","frame","out","transforms","key","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","_","pages","start","end","i","pagination","props","_a","color","accentColor","state","toState","btnBase","listener","themeSpacing","themeDensity","themeSize","themeColor","activeStyle","__spreadProps","__spreadValues","node","content","page","items","ellipsisIndex","p","isActive","toState","themeColor","themeSize","paragraph","props","_a","color","node","listener","merge","toState","themeColor","popover","props","_a","open","placement","openOn","popoverId","openState","toState","placeState","show","hide","anchorPartial","createFloating","popoverPartial","l","themeColor","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","themeSpacing","STAR_FILLED","STAR_EMPTY","rating","props","_a","_b","max","readOnly","onChange","color","valueState","toState","hoveredState","activeCount","listener","hovered","themeSpacing","themeColor","node","i","index","interactive","next","e","current","target","star","__spreadProps","__spreadValues","toState","themeColor","themeSpacing","ringProgress","props","_a","_b","_c","size","thickness","value","color","trackColor","holePercent","mask","l","node","toState","themeColor","themeSpacing","scrollArea","props","_a","color","l","toState","themeColor","themeSize","themeSpacing","segmented","props","_a","_b","_c","items","color","accentColor","value","node","element","buttons","item","index","key","l","themeColor","themeColorToken","themeDensity","themeSize","themeSpacing","select","props","color","accentColor","node","listener","l","svg","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","selectBox","props","options","placement","color","open","multiple","state","toState","openState","show","hide","anchorPartial","createFloating","popoverPartial","_e","node","merge","wrap","listener","val","vals","opt","tag","_node","cur","filter","v","themeSpacing","partial","themeDensity","themeColor","themeSize","themeColor","themeDensity","themeSize","themeSpacing","selectItem","props","accentColor","color","value","node","select","state","listener","val","v","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","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","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","node","element","id","tablist","item","index","key","l","e","k","keys","it","i","idx","ki","next","panels","toState","themeColor","themeDensity","themeSize","themeSpacing","textarea","props","_a","_b","color","accentColor","autoResize","node","el","resize","listener","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","isTop","isCenter","isRight","overlayEle","rootNode","overlay","listener","node","done","finished","timer","finish","onEnd","e","_a","toState","themeColor","themeSize","themeSpacing","toggleGroup","props","_a","items","multiple","color","accentColor","value","node","element","buttons","item","index","key","l","val","arr","v","themeDensity","themeSpacing","toolbar","props","_a","gap","listener","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","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/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/patches/buttonGhost.ts","../src/patches/buttonSwitch.ts","../src/patches/card.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/inputPassword.ts","../src/patches/inputOTP.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/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/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/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\";\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 outlines 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),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n outlineOffset: \"-1px\",\n overflow: \"hidden\",\n \"& > details\": {\n borderBottom: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n },\n \"& > details:last-child\": {\n borderBottom: \"none\",\n },\n \"& > details > summary:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n },\n },\n };\n}\n\nexport { accordion };\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 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 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 \"& 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 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),\n minWidth: themeSpacing(6),\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontSize: (l) => themeSize(l, \"decrease-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 },\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 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, \"shift-9\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n \"& > *\": {\n display: \"inline-flex\",\n alignItems: \"center\",\n color: (listener) =>\n themeColor(listener, \"shift-8\", 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\";\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, \"shift-8\", color.get(listener)),\n borderRadius: themeSpacing(1),\n \"&:hover\": {\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", color.get(listener))}`,\n outlineOffset: themeSpacing(0.5),\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\";\n\n/**\n * A themed button control with density-aware padding/radius and hover, focus-visible,\n * `[disabled]`, and `[aria-busy=true]` states. Apply to a `<button>` element.\n *\n * @hostTag button\n * @param props.color - Button color tone. Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @example { button: \"Save\", $: [button({ color: \"primary\" })] }\n */\nfunction button(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"primary\", \"color\");\n\n return {\n _onInsert: (node) => {\n if (node.tagName !== \"button\") {\n console.warn(`\"button\" primitive patch must use button tag`);\n }\n },\n style: {\n appearance: \"none\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n // Single-line bounded control: block/radius = 1D, inline = 3D.\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\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: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"shift-9\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) =>\n `inset 0 0 0 ${themeSpacing(0.5)} ${themeColor(listener, \"shift-6\", 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, \"shift-4\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"shift-8\", \"neutral\"),\n },\n \"&[aria-busy=true]\": {\n opacity: 0.7,\n cursor: \"wait\",\n pointerEvents: \"none\",\n },\n },\n };\n}\n\nexport { button };\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 * 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 * @example { button: \"×\", $: [buttonGhost()] }\n * @example { button: { span: null, $: [icon({ name: \"trash\" })] }, $: [buttonGhost({ color: \"error\" })] }\n */\nfunction buttonGhost(\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(`\"buttonGhost\" primitive patch must use button tag`);\n }\n },\n style: {\n appearance: \"none\",\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 1),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\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 color: (listener) => themeColor(listener, \"shift-6\", color.get(listener)),\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n color: (listener) =>\n themeColor(listener, \"shift-9\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) =>\n `inset 0 0 0 ${themeSpacing(0.5)} ${themeColor(listener, \"shift-6\", color.get(listener))}`,\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"shift-4\", \"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\";\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, \"shift-3\", color.get(listener))}`,\n minWidth: themeSpacing(12),\n minHeight: themeSpacing(6),\n borderRadius: themeSpacing(999),\n paddingLeft: themeSpacing(7),\n paddingRight: themeSpacing(2),\n transition: \"padding-left 0.3s, padding-right 0.3s\",\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\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, \"shift-9\"),\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\";\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 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, \"shift-4\", color.get(listener))}`,\n outlineOffset: \"-1px\",\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 margin: 0,\n },\n \"& > p\": {\n gridArea: \"desc\",\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 4),\n color: (listener) =>\n themeColor(listener, \"shift-9\", 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, \"shift-3\", color.get(listener))}`,\n },\n },\n };\n}\n\nexport { card };\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, \"shift-9\", 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 { createFloating } from \"../utils/floating.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 };\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, \"shift-9\", 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, \"shift-4\", \"neutral\")}`,\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 1),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"shift-9\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n },\n };\n\n merge(anchorPartial, partial);\n return anchorPartial;\n}\n\nexport { combobox };\n","import {\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\n// The SAME reused-node gap described below (in createFloating's own comment)\n// also breaks teardown two OTHER ways, both traced back to the same cause: a\n// factory like popover()/tooltip() called again by a reactive parent creates\n// a brand new createFloating() closure (fresh `cleanup`/`floatingNode`/\n// `openState` locals) on the SAME reused anchor DOM element — but only the\n// FIRST-ever closure's `_onMount` actually fires, so only IT ever registers\n// a BeforeRemove hook, and nothing ever tells an OLDER closure that a NEWER\n// one has taken over.\n//\n// 1. Anchor removed while a LATER generation's panel is the one open: the\n// first closure's BeforeRemove hook (the only one that exists) tears down\n// ITS OWN (possibly never-shown) state, while the real, visible panel has\n// no cleanup wired to it — orphaned in the #domphy-floating portal.\n// 2. Anchor merely RE-RENDERED while a panel is open (no removal at all —\n// e.g. hovering a tooltip, then an unrelated state change re-renders that\n// row): the live event handlers (onMouseLeave etc., rebound to the NEWEST\n// closure on every patch) now only ever reach the NEW closure's own\n// (never-shown) state. The OLD closure's actually-visible panel has no\n// live interaction path to it anymore — nothing can ever close it again,\n// not even moving the mouse away.\n//\n// Fix both by keying \"what to tear down\" off the anchor's live DOM element\n// (stable across reuse) instead of a closure-local variable: every\n// generation that touches this anchor first tears down whatever the\n// PREVIOUS generation left behind (if it's a different generation — a\n// closure never tears down its own current state on repeat interactions),\n// then claims the slot for itself. Case 1 falls out of whichever hook did\n// attach always reading the CURRENT slot instead of its own stale closure;\n// case 2 falls out of \"claiming\" running on every real interaction, not just\n// removal.\n//\n// Slots are keyed per `kind` (one per consumer component: popover, tooltip,\n// selectBox, …), not one per element: two DIFFERENT floating components\n// legitimately share one anchor (a button with a tooltip that opens a\n// popover), and a single element-wide slot made every interaction of one\n// tear down the other's live panel. Generational takeover only ever needs\n// to evict the SAME component's previous generation.\nconst teardownByElement = new WeakMap<Element, Map<string, () => void>>();\n\nfunction claimTeardownSlot(\n element: Element,\n kind: string,\n teardown: () => void,\n): void {\n let slots = teardownByElement.get(element);\n if (!slots) {\n slots = new Map();\n teardownByElement.set(element, slots);\n }\n const previous = slots.get(kind);\n if (previous && previous !== teardown) previous();\n slots.set(kind, teardown);\n}\n\nfunction releaseTeardownSlots(element: Element): void {\n const slots = teardownByElement.get(element);\n if (!slots) return;\n teardownByElement.delete(element);\n slots.forEach((teardown) => teardown());\n}\n\nfunction createFloating(props: {\n kind: string;\n open?: ValueOrState<boolean>;\n placement: State<Placement>;\n content: DomphyElement;\n}) {\n const { kind, open = false, placement } = props;\n\n let timer: ReturnType<typeof setTimeout> | null = null;\n let cleanup: (() => void) | null = null;\n let reference: HTMLElement | null = null;\n let floating: HTMLElement | null = null;\n let floatingNode: ElementNode | null = null;\n let rootNode: ElementNode | null = null;\n let mounted = false;\n const openState = toState(open);\n\n // Teardown must leave the closure RE-MOUNTABLE, not permanently dead: a\n // still-live instance can get its slot evicted (e.g. a stale generation's\n // teardown running via a handler that was never rebound) and later be shown\n // again. Resetting mounted/floatingNode lets ensureMounted re-insert the\n // panel; leaving them stale made show() position a detached node forever.\n const teardown = () => {\n if (timer) clearTimeout(timer);\n timer = null;\n if (cleanup) {\n cleanup();\n cleanup = null;\n }\n if (floatingNode) {\n floatingNode.remove();\n floatingNode = null;\n }\n floating = null;\n mounted = false;\n openState.set(false);\n };\n\n // `reference`/`rootNode` are normally captured once by anchorPartial's\n // _onMount — but ElementNode.patch() deliberately does NOT re-run lifecycle\n // hooks on a reused (already-mounted) DOM node (\"hooks already ran\"). A\n // factory like popover()/tooltip() that gets called AGAIN by a reactive\n // parent (a fresh createFloating() closure, fresh `reference`/`rootNode`\n // locals) never gets a second _onMount — so show()/hide() silently no-op\n // forever after any re-render of the trigger's ancestor. Event handlers,\n // unlike hooks, ARE live-rebound on every patch (see ElementNode._bindEvent)\n // and already receive the current ElementNode as their 2nd argument — so\n // show(node)/hide(node) (called from the trigger's onClick/onMouseEnter/…)\n // re-derive `reference`/`rootNode` from THAT, idempotently, on every call.\n // This makes each createFloating() instance self-sufficient regardless of\n // whether its own _onMount ever fired.\n const ensureReference = (node?: ElementNode) => {\n if (!node) return;\n rootNode = node.getRoot();\n reference = node.domElement as HTMLElement;\n if (reference) claimTeardownSlot(reference, kind, teardown);\n };\n\n const ensureMounted = () => {\n if (mounted || !rootNode) return;\n mounted = true;\n floatingNode = rootNode.children!.insert(props.content) as ElementNode;\n };\n\n const instantShow = () => {\n ensureMounted();\n if (reference && floating) {\n cleanup && 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 const instantHide = () => {\n cleanup && cleanup();\n cleanup = null;\n openState.set(false);\n };\n const show = (node?: ElementNode) => {\n ensureReference(node);\n timer && clearTimeout(timer);\n timer = setTimeout(instantShow, 100);\n };\n const hide = (node?: ElementNode) => {\n ensureReference(node);\n timer && clearTimeout(timer);\n timer = setTimeout(instantHide, 100);\n };\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 _onMount: (node) => {\n floating = node.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 merge(props.content, floatingPartial);\n\n const anchorPartial: PartialElement = {\n onKeyDown: (e) => (e as KeyboardEvent).key === \"Escape\" && hide(),\n _onMount: (node) => {\n rootNode = node.getRoot();\n reference = node.domElement as HTMLElement;\n if (reference) claimTeardownSlot(reference, kind, teardown);\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)) {\n hide();\n }\n };\n node.getRoot().domElement!.addEventListener(\"click\", handleOutside);\n\n // This _onMount only ever fires ONCE per real DOM element (a reused,\n // patched anchor never gets a second one) — so this is the single\n // opportunity to attach the BeforeRemove hook for that element's whole\n // lifetime. It must not tear down THIS closure's own (possibly stale)\n // `cleanup`/`floatingNode` directly — look up teardownByElement instead,\n // which always holds whichever generation last interacted with this\n // anchor (see the WeakMap comment above and ensureReference).\n node.addHook(\"BeforeRemove\", () => {\n // Tear down the @domphy/floating autoUpdate loop (scroll/resize/rAF\n // listeners) and the floating panel itself — for EVERY kind anchored\n // to this element, since the anchor is going away. Without this,\n // removing the anchor while the overlay is open leaks observers that\n // keep positioning a detached node, or leaves the panel orphaned.\n if (reference) releaseTeardownSlots(reference);\n node.getRoot().domElement!.removeEventListener(\"click\", handleOutside);\n });\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\";\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 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 \"&:hover\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-4\", 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(1),\n paddingInlineStart: themeSpacing(2),\n paddingInlineEnd: removable ? themeSpacing(1) : themeSpacing(2),\n gap: themeSpacing(2),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n color: (listener) => themeColor(listener, \"shift-9\", color.get(listener)),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", 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\";\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, \"shift-3\", 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 \"&:focus-visible\": {\n borderBottomColor: (listener) =>\n themeColor(listener, \"shift-6\", 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 outline. 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 color: (listener) => themeColor(listener, \"shift-9\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener) => themeColor(listener, \"shift-2\", color),\n },\n \"&:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor)}`,\n outlineOffset: `-${themeSpacing(0.5)}`,\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 themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\nimport { createFloating } from \"../utils/floating.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: \"600\",\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: \"600\",\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: themeSpacing(2),\n backgroundColor: (listener) => themeColor(listener, \"base\"),\n color: (listener) => themeColor(listener, \"shift-10\"),\n border: (listener) => `1px solid ${themeColor(listener, \"shift-4\")}`,\n boxShadow: \"0 8px 24px rgba(0,0,0,0.18)\",\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, \"shift-2\", accentColor.get(l))\n : \"transparent\",\n color: (l: Listener) =>\n selected\n ? themeColor(l, \"shift-0\", accentColor.get(l))\n : themeColor(l, \"shift-9\"),\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 \"&:focus-visible\": {\n outline: (l: Listener) =>\n `2px solid ${themeColor(l, \"shift-6\", 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: \"600\" } },\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, \"shift-8\", 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, \"shift-3\")}`,\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, \"shift-8\"),\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, \"shift-4\")}`,\n backgroundColor: (l: Listener) => themeColor(l, \"base\"),\n color: (l: Listener) => themeColor(l, \"shift-9\"),\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 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) =>\n themeColor(listener, \"shift-9\", 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\";\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 outline. 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 style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"shift-9\", 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 outlineOffset: `-${themeSpacing(0.5)}`,\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", 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 { 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 dlg.close();\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.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 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 padding: (listener) => themeSpacing(themeDensity(listener) * 3),\n boxShadow: (listener) =>\n `0 ${themeSpacing(9)} ${themeSpacing(16)} ${themeColor(listener, \"shift-4\", \"neutral\")}`,\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, \"shift-9\", color.get(listener)),\n minHeight: \"1lh\",\n \"&::before\": {\n content: `\"\"`,\n flex: 1,\n borderColor: (listener) =>\n themeColor(listener, \"shift-4\", color.get(listener)),\n borderWidth: \"1px\",\n borderBottomStyle: \"solid\",\n },\n \"&::after\": {\n content: `\"\"`,\n flex: 1,\n borderColor: (listener) =>\n themeColor(listener, \"shift-4\", 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 { 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 dlg.close();\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.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 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: (listener) =>\n `0 ${themeSpacing(4)} ${themeSpacing(12)} ${themeColor(listener, \"shift-4\", \"neutral\")}`,\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 color: (listener) => themeColor(listener, \"shift-6\", color.get(listener)),\n // First child (icon area): more muted color to visually recede behind the text\n \"& > :first-child\": {\n color: (listener) =>\n themeColor(listener, \"shift-5\", 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\";\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 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-9\", color.get(listener)),\n color: (listener) => themeColor(listener, \"shift-0\", color.get(listener)),\n boxShadow: (listener) =>\n `0 ${themeSpacing(1)} ${themeSpacing(4)} ${themeColor(listener, \"shift-4\", \"neutral\")}`,\n transition: \"background-color 200ms ease, box-shadow 200ms ease\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n boxShadow: (listener) =>\n `0 ${themeSpacing(2)} ${themeSpacing(6)} ${themeColor(listener, \"shift-5\", \"neutral\")}`,\n },\n \"&:focus-visible\": {\n outline: (listener) =>\n `2px solid ${themeColor(listener, \"shift-6\", color.get(listener))}`,\n outlineOffset: \"2px\",\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, \"shift-9\", 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) =>\n themeColor(listener, \"shift-8\", 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 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 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) =>\n themeColor(listener, \"shift-9\", 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) =>\n themeColor(listener, \"shift-9\", 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 style: {\n border: 0,\n height: \"1px\",\n marginInline: 0,\n marginTop: themeSpacing(3),\n marginBottom: themeSpacing(3),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-4\", 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, \"shift-9\", 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 },\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\";\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 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, \"shift-4\", color.get(listener))}`,\n color: (listener) =>\n themeColor(listener, \"shift-9\", color.get(listener)),\n width: themeSpacing(4),\n height: themeSpacing(4),\n },\n \"&:hover::before\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", 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 outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", 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 {\n type ThemeColor,\n themeColor,\n themeDensity,\n themeSize,\n themeSpacing,\n} from \"@domphy/theme\";\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 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 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 \"&::-webkit-color-swatch-wrapper\": {\n margin: 0,\n padding: 0,\n },\n \"&::-webkit-color-swatch\": {\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\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, \"shift-4\", \"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\";\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, \"shift-9\", 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, \"shift-4\", color.get(listener))}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n \"&::-webkit-calendar-picker-indicator\": {\n cursor: \"pointer\",\n opacity: 0.85,\n },\n \"&:hover:not([disabled]):not([aria-busy=true]), &:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"shift-8\", \"neutral\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", \"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\";\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, \"shift-9\", 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, \"shift-4\", color.get(listener))}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 1),\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, \"shift-1\", color.get(listener)),\n },\n \"&:hover:not([disabled]):not([aria-busy=true]), &:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n },\n \"&[disabled]\": {\n opacity: 0.8,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"shift-8\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", \"neutral\")}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-1\", \"neutral\"),\n },\n \"&[disabled]::-webkit-file-upload-button\": {\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"shift-8\", \"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\";\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),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"shift-9\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n \"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button\": {\n opacity: 1,\n },\n \"&:hover:not([disabled]):not([aria-busy=true]), &:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", 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, \"shift-4\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"shift-8\", \"neutral\"),\n },\n },\n };\n}\n\nexport { inputNumber };\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\";\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),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (l) =>\n `1px solid ${themeColor(l, \"shift-4\", colorState.get(l))}`,\n color: (l) => themeColor(l, \"shift-9\", colorState.get(l)),\n backgroundColor: (l) => themeColor(l, \"inherit\", colorState.get(l)),\n fontSize: (l) => themeSize(l, \"inherit\"),\n \"&:focus-within\": {\n outline: (l) =>\n `${themeSpacing(0.5)} solid ${themeColor(l, \"shift-6\", accentState.get(l))}`,\n },\n } as StyleObject,\n };\n}\n\nexport { inputPassword };\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 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 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 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, \"shift-4\", color.get(listener))}`,\n color: (listener) =>\n themeColor(listener, \"shift-9\", color.get(listener)),\n width: themeSpacing(4),\n height: themeSpacing(4),\n },\n \"&:hover::before\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", 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 outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", 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\";\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 \"&:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n outlineOffset: themeSpacing(1),\n borderRadius: themeSpacing(2),\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\";\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, \"shift-9\", 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, \"shift-4\", color.get(listener))}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\n minWidth: themeSpacing(32),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\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]), &:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"shift-8\", \"neutral\"),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", \"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\";\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 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 \"&: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\";\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),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"shift-9\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\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]), &:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", 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, \"shift-4\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"shift-8\", \"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, \"shift-9\", 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, \"shift-4\", 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, \"shift-9\", 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, \"shift-8\", \"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\";\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 color: (listener) => themeColor(listener, \"shift-9\", color.get(listener)),\n textDecoration: \"none\",\n \"&:visited\": {\n color: (listener) =>\n themeColor(listener, \"shift-9\", accentColor.get(listener)),\n },\n \"&:hover:not([disabled])\": {\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n textDecoration: \"underline\",\n },\n \"&:focus-visible\": {\n borderRadius: themeSpacing(1),\n outlineOffset: themeSpacing(1),\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor.get(listener))}`,\n },\n \"&[disabled]\": {\n opacity: 0.7,\n cursor: \"not-allowed\",\n color: (listener) => themeColor(listener, \"shift-8\", \"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\";\n\n/**\n * An `<a>` element styled to look like a button — same visual appearance as\n * `button()` but preserves link semantics (href, middle-click, right-click).\n * Apply to an `<a>` element.\n *\n * @hostTag a\n * @param props.color - Button color tone. Optional `ValueOrState<ThemeColor>`, default \"primary\".\n * @example { a: \"Open app\", href: \"/app\", $: [linkButton({ color: \"primary\" })] }\n */\nfunction linkButton(\n props: { color?: ValueOrState<ThemeColor> } = {},\n): PartialElement {\n const color = toState(props.color ?? \"primary\", \"color\");\n\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, \"inherit\"),\n textDecoration: \"none\",\n paddingBlock: (listener) => themeSpacing(themeDensity(listener) * 1),\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 3),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\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 outlineOffset: \"-1px\",\n outlineWidth: \"1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n color: (listener) => themeColor(listener, \"shift-9\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n \"&:hover\": {\n color: (listener) =>\n themeColor(listener, \"shift-10\", color.get(listener)),\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-2\", color.get(listener)),\n },\n \"&:focus-visible\": {\n boxShadow: (listener) =>\n `inset 0 0 0 ${themeSpacing(0.5)} ${themeColor(listener, \"shift-6\", 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, \"shift-4\", \"neutral\")}`,\n color: (listener) => themeColor(listener, \"shift-8\", \"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\";\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 },\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, \"shift-9\", color.get(listener)),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\n transition: \"background-color 150ms ease\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-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 outline: (listener) =>\n `2px solid ${themeColor(listener, \"shift-6\", accentColor)}`,\n outlineOffset: \"-2px\",\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, \"shift-9\", 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\";\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 color: (l: Listener) => themeColor(l, \"shift-9\", color),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\", color),\n \"&:hover:not([disabled]):not([aria-current=true])\": {\n backgroundColor: (l: Listener) => themeColor(l, \"shift-2\", color),\n },\n \"&[aria-current=true]\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-3\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-10\"),\n },\n \"&:focus-visible\": {\n outline: (l: Listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(l, \"shift-6\", accentColor)}`,\n outlineOffset: `-${themeSpacing(0.5)}`,\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 },\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 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 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 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, \"shift-9\", 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\";\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),\n border: \"none\",\n cursor: \"pointer\",\n fontSize: (listener: any) => themeSize(listener, \"inherit\"),\n backgroundColor: \"transparent\",\n color: (listener: any) => themeColor(listener, \"shift-9\", color),\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener: any) =>\n themeColor(listener, \"shift-2\", color),\n },\n \"&[disabled]\": {\n opacity: 0.4,\n cursor: \"not-allowed\",\n },\n };\n\n const activeStyle = {\n ...btnBase,\n backgroundColor: (listener: any) =>\n themeColor(listener, \"shift-6\", accentColor),\n color: (listener: any) => themeColor(listener, \"shift-11\", accentColor),\n fontWeight: \"600\",\n cursor: \"default\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (listener: any) =>\n themeColor(listener, \"shift-6\", accentColor),\n },\n };\n\n return {\n role: \"navigation\",\n ariaLabel: \"Pagination\",\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 { 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, \"shift-9\", 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 } from \"@domphy/theme\";\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 });\n\n const popoverPartial: PartialElement = {\n role: \"dialog\",\n dataTone: \"shift-14\",\n style: {\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\"),\n },\n onMouseEnter: () => openOn === \"hover\" && show(),\n onMouseLeave: () => openOn === \"hover\" && hide(),\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, \"shift-9\", 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, \"shift-9\", 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 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, \"shift-3\", color.get(listener)),\n \"&::-webkit-progress-bar\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-3\", 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 { type ThemeColor, themeColor, themeSpacing } from \"@domphy/theme\";\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 fontSize: \"1.5rem\",\n cursor: readOnly ? \"default\" : \"pointer\",\n color: (listener) => themeColor(listener, \"shift-8\", 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 padding: 0,\n cursor: \"inherit\",\n color: \"inherit\",\n fontSize: \"inherit\",\n display: \"flex\",\n alignItems: \"center\",\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 // 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, 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 \"&::-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\";\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 as a string. */\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, \"shift-9\", color),\n backgroundColor: \"transparent\",\n transition: \"background-color 300ms ease\",\n \"&:hover:not([disabled]):not([aria-checked=true])\": {\n backgroundColor: (l: Listener) => themeColor(l, \"shift-3\", 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 },\n \"&:focus-visible\": {\n outline: (l: Listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(l, \"shift-6\", accentColor)}`,\n outlineOffset: `-${themeSpacing(0.5)}`,\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: \"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, \"shift-2\", 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\";\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, \"shift-9\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n border: \"none\",\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color)}`,\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\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 \"&:not([multiple])\": {\n height: (listener) => themeSpacing(6 + themeDensity(listener) * 2),\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-5\", accentColor)}`,\n },\n \"&:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", 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, \"shift-8\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", \"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 { createFloating } from \"../utils/floating.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 };\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 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, \"shift-4\", \"neutral\")}`,\n paddingInline: (listener) => themeSpacing(themeDensity(listener) * 2),\n borderRadius: (listener) => themeSpacing(themeDensity(listener) * 1),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"shift-9\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\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\";\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, \"shift-9\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n \"&:hover:not([disabled]):not([aria-selected=true])\": {\n backgroundColor: (listener) => themeColor(listener, \"shift-2\", color),\n },\n \"&[aria-selected=true]\": {\n backgroundColor: (listener) =>\n themeColor(listener, \"shift-6\", accentColor),\n color: (listener) => themeColor(listener, \"shift-11\"),\n },\n \"&:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", accentColor)}`,\n outlineOffset: `-${themeSpacing(0.5)}`,\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 },\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 pulsing opacity animation. Marked `aria-hidden`, themed\n * background/foreground, fixed height, slight rounding. No host-tag check; typically applied\n * to a block-level element such as a `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 const keyframes = {\n \"0%,100%\": { opacity: 1 },\n \"50%\": { opacity: 0.4 },\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, \"shift-9\", 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 animation: `${animationName} 1.5s 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 color: (listener) => themeColor(listener, \"shift-9\", 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, \"shift-9\", 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, \"shift-4\", 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\";\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 style: {\n flexShrink: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: (listener) => themeColor(listener, \"shift-2\"),\n \"&:hover\": {\n backgroundColor: (listener) => themeColor(listener, \"shift-3\"),\n },\n \"&:focus-visible\": {\n outline: (listener) => `2px solid ${themeColor(listener, \"shift-6\")}`,\n outlineOffset: \"2px\",\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 {\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 // 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: \"600\",\n flexShrink: \"0\",\n border: (l: Listener) =>\n `2px solid ${themeColor(l, \"shift-4\", color)}`,\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\"),\n color: (l: Listener) => themeColor(l, \"shift-8\"),\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-6\", accentColor),\n borderColor: (l: Listener) =>\n themeColor(l, \"shift-6\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-15\", accentColor),\n },\n \"&[data-status=done]::before\": {\n content: '\"✓\"',\n backgroundColor: (l: Listener) => themeColor(l, \"shift-3\", color),\n borderColor: (l: Listener) => themeColor(l, \"shift-3\", color),\n color: (l: Listener) => themeColor(l, \"shift-9\", color),\n },\n \"&[data-status=done]:not(:first-child)::after\": {\n backgroundColor: (l: Listener) => themeColor(l, \"shift-3\", color),\n },\n \"&[data-status=active]:not(:first-child)::after\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-6\", accentColor),\n },\n \"&[data-status=pending]\": {\n color: (l: Listener) => themeColor(l, \"shift-7\"),\n },\n \"&[data-status=active]\": {\n color: (l: Listener) => themeColor(l, \"shift-10\"),\n fontWeight: \"600\",\n },\n \"&[data-status=done]\": {\n color: (l: Listener) => themeColor(l, \"shift-8\"),\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: 700,\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, \"shift-9\", 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, \"shift-9\", 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 style: {\n fontSize: (listener) => themeSize(listener, \"inherit\"),\n color: (listener) => themeColor(listener, \"shift-9\", 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) =>\n themeColor(listener, \"shift-9\", 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, \"shift-2\"),\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\";\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 color: (l: Listener) => themeColor(l, \"shift-9\"),\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 \"&:hover:not([disabled])\": {\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 boxShadow: (l: Listener) =>\n `inset 0 -${themeSpacing(0.5)} 0 0 ${themeColor(l, \"shift-6\", accentColor)}`,\n },\n \"&:focus-visible\": {\n boxShadow: (l: Listener) =>\n `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\";\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, \"shift-9\", color.get(listener)),\n outlineOffset: \"-1px\",\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", color.get(listener))}`,\n backgroundColor: (listener) =>\n themeColor(listener, \"inherit\", color.get(listener)),\n \"&::placeholder\": {\n color: (listener) => themeColor(listener, \"shift-7\"),\n },\n \"&:hover:not([disabled]):not([aria-busy=true])\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-5\", accentColor.get(listener))}`,\n },\n \"&:focus-visible\": {\n outline: (listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(listener, \"shift-6\", 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, \"shift-8\", \"neutral\"),\n outline: (listener) =>\n `1px solid ${themeColor(listener, \"shift-4\", \"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: \"0.25em\",\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\";\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, \"shift-9\", color),\n backgroundColor: (listener) => themeColor(listener, \"inherit\", color),\n boxShadow: (listener) =>\n `0 ${themeSpacing(2)} ${themeSpacing(9)} ${themeColor(listener, \"shift-4\", \"neutral\")}`,\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\";\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),\n color: (l: Listener) => themeColor(l, \"shift-9\", color),\n backgroundColor: (l: Listener) => themeColor(l, \"inherit\", color),\n transition: \"background-color 300ms ease\",\n \"&:hover:not([disabled])\": {\n backgroundColor: (l: Listener) => themeColor(l, \"shift-2\", color),\n },\n \"&[aria-pressed=true]\": {\n backgroundColor: (l: Listener) =>\n themeColor(l, \"shift-3\", accentColor),\n color: (l: Listener) => themeColor(l, \"shift-12\", accentColor),\n },\n \"&:focus-visible\": {\n outline: (l: Listener) =>\n `${themeSpacing(0.5)} solid ${themeColor(l, \"shift-6\", accentColor)}`,\n outlineOffset: `-${themeSpacing(0.5)}`,\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 outline: (l: Listener) => `1px solid ${themeColor(l, \"shift-3\", color)}`,\n outlineOffset: \"-1px\",\n },\n };\n}\n\nexport { toggleGroup };\nexport type { ToggleItem };\n","import type { DomphyElement, PartialElement } from \"@domphy/core\";\nimport { themeDensity, themeSpacing } from \"@domphy/theme\";\n\n/**\n * A horizontal flex row with vertically centered items. Useful for headers,\n * toolbars, navigation bars, and action strips.\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 const gap = props.gap ?? 4;\n return {\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: (listener) => themeSpacing(themeDensity(listener) * gap),\n },\n };\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 { 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),\n color: (listener) => themeColor(listener, \"shift-9\"),\n backgroundColor: (listener) => themeColor(listener),\n fontSize: (listener) => themeSize(listener, \"inherit\"),\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, \"shift-9\", 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":"8bAAA,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,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c,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","accordion","props","_a","_b","type","color","accentColor","node","el","handler","event","summary","item","detail","listener","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","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","button","props","_a","color","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","buttonGhost","props","_a","color","node","listener","toState","themeColor","themeSize","themeSpacing","buttonSwitch","props","_a","_b","checked","check","color","accentColor","node","listener","toState","themeColor","themeDensity","themeSpacing","card","props","_a","color","listener","toState","themeColor","themeSize","themeSpacing","code","props","_a","color","node","listener","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","merge","toState","autoUpdate","computePosition","flip","offset","shift","teardownByElement","claimTeardownSlot","element","kind","teardown","slots","previous","releaseTeardownSlots","createFloating","props","open","placement","timer","cleanup","reference","floating","floatingNode","rootNode","mounted","openState","ensureReference","node","ensureMounted","instantShow","x","y","resolved","instantHide","show","hide","floatingPartial","listener","event","_a","dataTheme","rNode","overlay","overlayEle","e","handleOutside","target","toState","themeColor","themeSize","themeSpacing","xSvg","tag","props","_a","removable","color","node","removeBtn","e","listener","combobox","props","options","placement","color","open","multiple","state","toState","openState","show","hide","anchorPartial","createFloating","popoverPartial","_e","node","merge","inputStyle","themeSpacing","listener","themeSize","themeColor","inputElement","inputPartial","wrap","val","vals","items","opt","tag","_node","cur","filter","v","partial","themeDensity","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","command","_node","element","commandSearch","props","color","accentColor","node","ctx","input","onInput","listener","commandItem","_a","_b","el","text","applyFilter","q","release","merge","toState","themeColor","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","first","month","weeks","week","cells","buildDayCell","disabled","selected","within","outside","isFocused","isToday","l","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","accentColor","node","listener","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","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","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","dim","node","listener","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","accentColor","node","listener","themeColor","themeDensity","themeSize","themeSpacing","inputColor","_props","node","element","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","inputDateTime","props","_a","_b","mode","color","accentColor","node","element","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","inputFile","props","_a","_b","color","accentColor","node","element","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","inputNumber","props","_a","_b","color","accentColor","node","element","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","EYE_SVG","EYE_OFF_SVG","inputPassword","props","_a","_b","colorState","accentState","visibleState","node","field","l","toggle","themeSpacing","inputOTP","node","container","getInputs","onInput","e","inputs","target","idx","onKeydown","onPaste","_a","_b","_c","text","found","startIdx","char","i","lastFilled","toState","themeColor","themeSize","themeSpacing","inputRadio","props","_a","_b","color","accentColor","node","listener","toState","themeColor","themeSpacing","inputRange","props","_a","_b","color","accentColor","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","inputSearch","props","_a","_b","color","accentColor","node","element","listener","toState","themeColor","themeSize","themeSpacing","inputSwitch","props","_a","accentColor","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","inputText","props","_a","_b","color","accentColor","node","element","listener","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","accentColor","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","linkButton","props","_a","color","node","listener","toState","themeColor","themeDensity","themeSize","themeSpacing","list","_props","listItem","props","dense","listener","listItemButton","_a","_b","color","accentColor","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","isState","value","toStyles","frame","out","transforms","key","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","_","pages","start","end","i","pagination","props","_a","color","accentColor","state","toState","btnBase","listener","themeSpacing","themeDensity","themeSize","themeColor","activeStyle","__spreadProps","__spreadValues","node","content","page","items","ellipsisIndex","p","isActive","toState","themeColor","themeSize","paragraph","props","_a","color","node","listener","merge","toState","themeColor","popover","props","_a","open","placement","openOn","popoverId","openState","toState","placeState","show","hide","anchorPartial","createFloating","popoverPartial","l","themeColor","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","themeSpacing","STAR_FILLED","STAR_EMPTY","rating","props","_a","_b","max","readOnly","onChange","color","valueState","toState","hoveredState","activeCount","listener","hovered","themeSpacing","themeColor","node","i","index","interactive","next","e","current","target","star","__spreadProps","__spreadValues","toState","themeColor","themeSpacing","ringProgress","props","_a","_b","_c","size","thickness","value","color","trackColor","holePercent","mask","l","node","toState","themeColor","themeSpacing","scrollArea","props","_a","color","l","toState","themeColor","themeSize","themeSpacing","segmented","props","_a","_b","_c","items","color","accentColor","value","node","element","buttons","item","index","key","l","themeColor","themeColorToken","themeDensity","themeSize","themeSpacing","select","props","color","accentColor","node","listener","l","svg","merge","toState","themeColor","themeDensity","themeSize","themeSpacing","selectBox","props","options","placement","color","open","multiple","state","toState","openState","show","hide","anchorPartial","createFloating","popoverPartial","_e","node","merge","wrap","listener","val","vals","opt","tag","_node","cur","filter","v","themeSpacing","partial","themeDensity","themeColor","themeSize","themeColor","themeDensity","themeSize","themeSpacing","selectItem","props","accentColor","color","value","node","select","state","listener","val","v","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","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","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","node","element","id","tablist","item","index","key","l","e","k","keys","it","i","idx","next","panels","toState","themeColor","themeDensity","themeSize","themeSpacing","textarea","props","_a","_b","color","accentColor","autoResize","node","el","resize","listener","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","isTop","isCenter","isRight","overlayEle","rootNode","overlay","listener","node","done","finished","timer","finish","onEnd","e","_a","toState","themeColor","themeSize","themeSpacing","toggleGroup","props","_a","items","multiple","color","accentColor","value","node","element","buttons","item","index","key","l","val","arr","v","themeDensity","themeSpacing","toolbar","props","_a","gap","listener","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","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"]}