@proyecto-viviana/solid-stately 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +226 -504
- package/dist/index.jsx +6407 -0
- package/package.json +3 -5
- package/dist/index.js.map +0 -1
- package/src/autocomplete/createAutocompleteState.d.ts +0 -46
- package/src/autocomplete/createAutocompleteState.d.ts.map +0 -1
- package/src/autocomplete/createAutocompleteState.ts +0 -90
- package/src/autocomplete/index.d.ts +0 -2
- package/src/autocomplete/index.d.ts.map +0 -1
- package/src/autocomplete/index.ts +0 -5
- package/src/calendar/createCalendarState.d.ts +0 -130
- package/src/calendar/createCalendarState.d.ts.map +0 -1
- package/src/calendar/createCalendarState.ts +0 -461
- package/src/calendar/createDateFieldState.d.ts +0 -110
- package/src/calendar/createDateFieldState.d.ts.map +0 -1
- package/src/calendar/createDateFieldState.ts +0 -562
- package/src/calendar/createRangeCalendarState.d.ts +0 -146
- package/src/calendar/createRangeCalendarState.d.ts.map +0 -1
- package/src/calendar/createRangeCalendarState.ts +0 -535
- package/src/calendar/createTimeFieldState.d.ts +0 -95
- package/src/calendar/createTimeFieldState.d.ts.map +0 -1
- package/src/calendar/createTimeFieldState.ts +0 -483
- package/src/calendar/index.d.ts +0 -7
- package/src/calendar/index.d.ts.map +0 -1
- package/src/calendar/index.ts +0 -81
- package/src/checkbox/createCheckboxGroupState.d.ts +0 -71
- package/src/checkbox/createCheckboxGroupState.d.ts.map +0 -1
- package/src/checkbox/createCheckboxGroupState.ts +0 -193
- package/src/checkbox/index.d.ts +0 -2
- package/src/checkbox/index.d.ts.map +0 -1
- package/src/checkbox/index.ts +0 -5
- package/src/collections/ListCollection.d.ts +0 -37
- package/src/collections/ListCollection.d.ts.map +0 -1
- package/src/collections/ListCollection.ts +0 -146
- package/src/collections/createListState.d.ts +0 -79
- package/src/collections/createListState.d.ts.map +0 -1
- package/src/collections/createListState.ts +0 -264
- package/src/collections/createMenuState.d.ts +0 -50
- package/src/collections/createMenuState.d.ts.map +0 -1
- package/src/collections/createMenuState.ts +0 -106
- package/src/collections/createSelectionState.d.ts +0 -76
- package/src/collections/createSelectionState.d.ts.map +0 -1
- package/src/collections/createSelectionState.ts +0 -336
- package/src/collections/index.d.ts +0 -6
- package/src/collections/index.d.ts.map +0 -1
- package/src/collections/index.ts +0 -46
- package/src/collections/types.d.ts +0 -147
- package/src/collections/types.d.ts.map +0 -1
- package/src/collections/types.ts +0 -169
- package/src/color/Color.d.ts +0 -28
- package/src/color/Color.d.ts.map +0 -1
- package/src/color/Color.ts +0 -951
- package/src/color/createColorAreaState.d.ts +0 -76
- package/src/color/createColorAreaState.d.ts.map +0 -1
- package/src/color/createColorAreaState.ts +0 -293
- package/src/color/createColorFieldState.d.ts +0 -55
- package/src/color/createColorFieldState.d.ts.map +0 -1
- package/src/color/createColorFieldState.ts +0 -292
- package/src/color/createColorSliderState.d.ts +0 -67
- package/src/color/createColorSliderState.d.ts.map +0 -1
- package/src/color/createColorSliderState.ts +0 -241
- package/src/color/createColorWheelState.d.ts +0 -51
- package/src/color/createColorWheelState.d.ts.map +0 -1
- package/src/color/createColorWheelState.ts +0 -211
- package/src/color/index.d.ts +0 -10
- package/src/color/index.d.ts.map +0 -1
- package/src/color/index.ts +0 -47
- package/src/color/types.d.ts +0 -106
- package/src/color/types.d.ts.map +0 -1
- package/src/color/types.ts +0 -127
- package/src/combobox/createComboBoxState.d.ts +0 -125
- package/src/combobox/createComboBoxState.d.ts.map +0 -1
- package/src/combobox/createComboBoxState.ts +0 -703
- package/src/combobox/index.d.ts +0 -5
- package/src/combobox/index.d.ts.map +0 -1
- package/src/combobox/index.ts +0 -13
- package/src/disclosure/createDisclosureState.d.ts +0 -64
- package/src/disclosure/createDisclosureState.d.ts.map +0 -1
- package/src/disclosure/createDisclosureState.ts +0 -193
- package/src/disclosure/index.d.ts +0 -2
- package/src/disclosure/index.d.ts.map +0 -1
- package/src/disclosure/index.ts +0 -9
- package/src/dnd/createDragState.d.ts +0 -59
- package/src/dnd/createDragState.d.ts.map +0 -1
- package/src/dnd/createDragState.ts +0 -153
- package/src/dnd/createDraggableCollectionState.d.ts +0 -57
- package/src/dnd/createDraggableCollectionState.d.ts.map +0 -1
- package/src/dnd/createDraggableCollectionState.ts +0 -165
- package/src/dnd/createDropState.d.ts +0 -61
- package/src/dnd/createDropState.d.ts.map +0 -1
- package/src/dnd/createDropState.ts +0 -212
- package/src/dnd/createDroppableCollectionState.d.ts +0 -78
- package/src/dnd/createDroppableCollectionState.d.ts.map +0 -1
- package/src/dnd/createDroppableCollectionState.ts +0 -357
- package/src/dnd/index.d.ts +0 -11
- package/src/dnd/index.d.ts.map +0 -1
- package/src/dnd/index.ts +0 -76
- package/src/dnd/types.d.ts +0 -264
- package/src/dnd/types.d.ts.map +0 -1
- package/src/dnd/types.ts +0 -317
- package/src/form/createFormValidationState.d.ts +0 -100
- package/src/form/createFormValidationState.d.ts.map +0 -1
- package/src/form/createFormValidationState.ts +0 -389
- package/src/form/index.d.ts +0 -2
- package/src/form/index.d.ts.map +0 -1
- package/src/form/index.ts +0 -15
- package/src/grid/createGridState.d.ts +0 -12
- package/src/grid/createGridState.d.ts.map +0 -1
- package/src/grid/createGridState.ts +0 -327
- package/src/grid/index.d.ts +0 -7
- package/src/grid/index.d.ts.map +0 -1
- package/src/grid/index.ts +0 -13
- package/src/grid/types.d.ts +0 -156
- package/src/grid/types.d.ts.map +0 -1
- package/src/grid/types.ts +0 -179
- package/src/index.d.ts +0 -26
- package/src/index.d.ts.map +0 -1
- package/src/index.ts +0 -383
- package/src/numberfield/createNumberFieldState.d.ts +0 -65
- package/src/numberfield/createNumberFieldState.d.ts.map +0 -1
- package/src/numberfield/createNumberFieldState.ts +0 -383
- package/src/numberfield/index.d.ts +0 -2
- package/src/numberfield/index.d.ts.map +0 -1
- package/src/numberfield/index.ts +0 -5
- package/src/overlays/createOverlayTriggerState.d.ts +0 -32
- package/src/overlays/createOverlayTriggerState.d.ts.map +0 -1
- package/src/overlays/createOverlayTriggerState.ts +0 -67
- package/src/overlays/index.d.ts +0 -2
- package/src/overlays/index.d.ts.map +0 -1
- package/src/overlays/index.ts +0 -5
- package/src/radio/createRadioGroupState.d.ts +0 -77
- package/src/radio/createRadioGroupState.d.ts.map +0 -1
- package/src/radio/createRadioGroupState.ts +0 -201
- package/src/radio/index.d.ts +0 -2
- package/src/radio/index.d.ts.map +0 -1
- package/src/radio/index.ts +0 -6
- package/src/searchfield/createSearchFieldState.d.ts +0 -25
- package/src/searchfield/createSearchFieldState.d.ts.map +0 -1
- package/src/searchfield/createSearchFieldState.ts +0 -62
- package/src/searchfield/index.d.ts +0 -3
- package/src/searchfield/index.d.ts.map +0 -1
- package/src/searchfield/index.ts +0 -5
- package/src/select/createSelectState.d.ts +0 -73
- package/src/select/createSelectState.d.ts.map +0 -1
- package/src/select/createSelectState.ts +0 -181
- package/src/select/index.d.ts +0 -2
- package/src/select/index.d.ts.map +0 -1
- package/src/select/index.ts +0 -5
- package/src/slider/createSliderState.d.ts +0 -72
- package/src/slider/createSliderState.d.ts.map +0 -1
- package/src/slider/createSliderState.ts +0 -211
- package/src/slider/index.d.ts +0 -3
- package/src/slider/index.d.ts.map +0 -1
- package/src/slider/index.ts +0 -6
- package/src/ssr/index.d.ts +0 -28
- package/src/ssr/index.d.ts.map +0 -1
- package/src/ssr/index.ts +0 -41
- package/src/table/TableCollection.d.ts +0 -52
- package/src/table/TableCollection.d.ts.map +0 -1
- package/src/table/TableCollection.ts +0 -388
- package/src/table/createTableState.d.ts +0 -12
- package/src/table/createTableState.d.ts.map +0 -1
- package/src/table/createTableState.ts +0 -127
- package/src/table/index.d.ts +0 -8
- package/src/table/index.d.ts.map +0 -1
- package/src/table/index.ts +0 -18
- package/src/table/types.d.ts +0 -139
- package/src/table/types.d.ts.map +0 -1
- package/src/table/types.ts +0 -150
- package/src/tabs/createTabListState.d.ts +0 -68
- package/src/tabs/createTabListState.d.ts.map +0 -1
- package/src/tabs/createTabListState.ts +0 -240
- package/src/tabs/index.d.ts +0 -2
- package/src/tabs/index.d.ts.map +0 -1
- package/src/tabs/index.ts +0 -7
- package/src/textfield/createTextFieldState.d.ts +0 -30
- package/src/textfield/createTextFieldState.d.ts.map +0 -1
- package/src/textfield/createTextFieldState.ts +0 -75
- package/src/textfield/index.d.ts +0 -2
- package/src/textfield/index.d.ts.map +0 -1
- package/src/textfield/index.ts +0 -5
- package/src/toast/createToastState.d.ts +0 -118
- package/src/toast/createToastState.d.ts.map +0 -1
- package/src/toast/createToastState.ts +0 -316
- package/src/toast/index.d.ts +0 -2
- package/src/toast/index.d.ts.map +0 -1
- package/src/toast/index.ts +0 -11
- package/src/toggle/createToggleState.d.ts +0 -34
- package/src/toggle/createToggleState.d.ts.map +0 -1
- package/src/toggle/createToggleState.ts +0 -94
- package/src/toggle/index.d.ts +0 -2
- package/src/toggle/index.d.ts.map +0 -1
- package/src/toggle/index.ts +0 -5
- package/src/tooltip/createTooltipTriggerState.d.ts +0 -39
- package/src/tooltip/createTooltipTriggerState.d.ts.map +0 -1
- package/src/tooltip/createTooltipTriggerState.ts +0 -183
- package/src/tooltip/index.d.ts +0 -2
- package/src/tooltip/index.d.ts.map +0 -1
- package/src/tooltip/index.ts +0 -6
- package/src/tree/TreeCollection.d.ts +0 -40
- package/src/tree/TreeCollection.d.ts.map +0 -1
- package/src/tree/TreeCollection.ts +0 -175
- package/src/tree/createTreeState.d.ts +0 -14
- package/src/tree/createTreeState.d.ts.map +0 -1
- package/src/tree/createTreeState.ts +0 -392
- package/src/tree/index.d.ts +0 -7
- package/src/tree/index.d.ts.map +0 -1
- package/src/tree/index.ts +0 -13
- package/src/tree/types.d.ts +0 -157
- package/src/tree/types.d.ts.map +0 -1
- package/src/tree/types.ts +0 -174
- package/src/utils/index.d.ts +0 -2
- package/src/utils/index.d.ts.map +0 -1
- package/src/utils/index.ts +0 -1
- package/src/utils/reactivity.d.ts +0 -28
- package/src/utils/reactivity.d.ts.map +0 -1
- package/src/utils/reactivity.ts +0 -36
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/toggle/createToggleState.ts","../src/utils/reactivity.ts","../src/autocomplete/createAutocompleteState.ts","../src/textfield/createTextFieldState.ts","../src/checkbox/createCheckboxGroupState.ts","../src/radio/createRadioGroupState.ts","../src/ssr/index.ts","../src/overlays/createOverlayTriggerState.ts","../src/collections/ListCollection.ts","../src/collections/createSelectionState.ts","../src/collections/createListState.ts","../src/collections/createMenuState.ts","../src/select/createSelectState.ts","../src/combobox/createComboBoxState.ts","../src/tabs/createTabListState.ts","../src/numberfield/createNumberFieldState.ts","../src/searchfield/createSearchFieldState.ts","../src/slider/createSliderState.ts","../src/tooltip/createTooltipTriggerState.ts","../src/toast/createToastState.ts","../src/disclosure/createDisclosureState.ts","../src/calendar/createCalendarState.ts","../src/calendar/createRangeCalendarState.ts","../src/calendar/createDateFieldState.ts","../src/calendar/createTimeFieldState.ts","../src/calendar/index.ts","../src/grid/createGridState.ts","../src/table/createTableState.ts","../src/table/TableCollection.ts","../src/tree/createTreeState.ts","../src/tree/TreeCollection.ts","../src/color/Color.ts","../src/color/createColorSliderState.ts","../src/color/createColorAreaState.ts","../src/color/createColorWheelState.ts","../src/color/createColorFieldState.ts","../src/dnd/createDragState.ts","../src/dnd/createDropState.ts","../src/dnd/createDraggableCollectionState.ts","../src/dnd/createDroppableCollectionState.ts","../src/form/createFormValidationState.ts"],"sourcesContent":["/**\n * Toggle state for Solid Stately\n *\n * Provides state management for toggle components like checkboxes and switches.\n *\n * This is a 1:1 port of @react-stately/toggle's useToggleState.\n */\n\nimport { createSignal, Accessor } from 'solid-js';\nimport { type MaybeAccessor, access } from '../utils';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface ToggleStateOptions {\n /** Whether the element should be selected (controlled). */\n isSelected?: boolean;\n /** Whether the element should be selected by default (uncontrolled). */\n defaultSelected?: boolean;\n /** Handler that is called when the element's selection state changes. */\n onChange?: (isSelected: boolean) => void;\n /** Whether the element is read only. */\n isReadOnly?: boolean;\n}\n\nexport interface ToggleState {\n /** Whether the toggle is selected. */\n readonly isSelected: Accessor<boolean>;\n /** Whether the toggle is selected by default. */\n readonly defaultSelected: boolean;\n /** Updates selection state. */\n setSelected(isSelected: boolean): void;\n /** Toggle the selection state. */\n toggle(): void;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides state management for toggle components like checkboxes and switches.\n */\nexport function createToggleState(props: MaybeAccessor<ToggleStateOptions> = {}): ToggleState {\n const getProps = () => access(props);\n\n // Get initial values\n const initialProps = getProps();\n const initialSelected = initialProps.isSelected ?? initialProps.defaultSelected ?? false;\n\n // Create internal signal for uncontrolled mode\n const [internalSelected, setInternalSelected] = createSignal(initialSelected);\n\n // Determine if controlled\n const isControlled = () => getProps().isSelected !== undefined;\n\n // Get current selection state\n const isSelected: Accessor<boolean> = () => {\n const p = getProps();\n return isControlled() ? (p.isSelected ?? false) : internalSelected();\n };\n\n // Update selection state\n function setSelected(value: boolean): void {\n const p = getProps();\n if (p.isReadOnly) {\n return;\n }\n\n if (!isControlled()) {\n setInternalSelected(value);\n }\n\n p.onChange?.(value);\n }\n\n // Toggle selection state\n function toggle(): void {\n const p = getProps();\n if (p.isReadOnly) {\n return;\n }\n\n setSelected(!isSelected());\n }\n\n return {\n isSelected,\n defaultSelected: initialProps.defaultSelected ?? initialSelected,\n setSelected,\n toggle,\n };\n}\n","/**\n * Reactivity utilities for Solid Stately\n *\n * Provides type-safe utilities for working with SolidJS reactivity patterns.\n */\n\nimport { Accessor } from 'solid-js';\n\n/**\n * A value that may be either a raw value or an accessor function.\n * This is a common pattern in SolidJS for props that may be reactive.\n */\nexport type MaybeAccessor<T> = T | Accessor<T>;\n\n/**\n * Unwraps a MaybeAccessor to get the underlying value.\n * If the input is a function, it calls it to get the value.\n * Otherwise, it returns the value directly.\n *\n * @param value - The value or accessor to unwrap.\n */\nexport function access<T>(value: MaybeAccessor<T>): T {\n return typeof value === 'function' ? (value as Accessor<T>)() : value;\n}\n\n/**\n * A value that may be undefined or an accessor that returns the value or undefined.\n */\nexport type MaybeAccessorValue<T> = T | undefined | Accessor<T | undefined>;\n\n/**\n * Checks if a value is an accessor function.\n */\nexport function isAccessor<T>(value: MaybeAccessor<T>): value is Accessor<T> {\n return typeof value === 'function';\n}\n","/**\n * createAutocompleteState - State management for autocomplete components\n *\n * Based on @react-stately/autocomplete useAutocompleteState.\n */\n\nimport { createSignal, type Accessor } from 'solid-js'\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AutocompleteState {\n /** The current value of the autocomplete input. */\n inputValue: Accessor<string>\n /** Sets the value of the autocomplete input. */\n setInputValue(value: string): void\n /** The id of the current aria-activedescendant of the autocomplete input. */\n focusedNodeId: Accessor<string | null>\n /** Sets the id of the current aria-activedescendant of the autocomplete input. */\n setFocusedNodeId(value: string | null): void\n}\n\nexport interface AutocompleteStateOptions {\n /** The value of the autocomplete input (controlled). */\n inputValue?: string\n /** The default value of the autocomplete input (uncontrolled). */\n defaultInputValue?: string\n /** Handler that is called when the autocomplete input value changes. */\n onInputChange?: (value: string) => void\n}\n\n// ============================================\n// CREATE AUTOCOMPLETE STATE\n// ============================================\n\n/**\n * Provides state management for an autocomplete component.\n *\n * @example\n * ```tsx\n * const state = createAutocompleteState({\n * defaultInputValue: '',\n * onInputChange: (value) => console.log('Input changed:', value),\n * });\n *\n * // Access current input value\n * console.log(state.inputValue());\n *\n * // Update input value\n * state.setInputValue('new value');\n *\n * // Track focused node for aria-activedescendant\n * state.setFocusedNodeId('item-1');\n * ```\n */\nexport function createAutocompleteState(\n props: AutocompleteStateOptions = {}\n): AutocompleteState {\n const {\n inputValue: controlledInputValue,\n defaultInputValue = '',\n onInputChange,\n } = props\n\n // Track focused node ID for aria-activedescendant\n const [focusedNodeId, setFocusedNodeId] = createSignal<string | null>(null)\n\n // Handle controlled vs uncontrolled input value\n const isControlled = controlledInputValue !== undefined\n const [uncontrolledValue, setUncontrolledValue] = createSignal(defaultInputValue)\n\n const inputValue: Accessor<string> = () => {\n return isControlled ? controlledInputValue : uncontrolledValue()\n }\n\n const setInputValue = (value: string) => {\n if (!isControlled) {\n setUncontrolledValue(value)\n }\n onInputChange?.(value)\n }\n\n return {\n inputValue,\n setInputValue,\n focusedNodeId,\n setFocusedNodeId,\n }\n}\n","/**\n * TextField state for Solid Stately\n *\n * Provides state management for text input components.\n *\n * This is a port of @react-stately/utils's useControlledState pattern\n * as used by @react-aria/textfield.\n */\n\nimport { createSignal, Accessor } from 'solid-js';\nimport { type MaybeAccessor, access } from '../utils';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface TextFieldStateOptions {\n /** The current value (controlled). */\n value?: string;\n /** The default value (uncontrolled). */\n defaultValue?: string;\n /** Handler that is called when the value changes. */\n onChange?: (value: string) => void;\n}\n\nexport interface TextFieldState {\n /** The current value of the text field. */\n readonly value: Accessor<string>;\n /** Sets the value of the text field. */\n setValue(value: string): void;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides state management for text input components.\n * Supports both controlled and uncontrolled modes.\n */\nexport function createTextFieldState(props: MaybeAccessor<TextFieldStateOptions> = {}): TextFieldState {\n const getProps = () => access(props);\n\n // Get initial value\n const initialProps = getProps();\n const initialValue = initialProps.value ?? initialProps.defaultValue ?? '';\n\n // Create internal signal for uncontrolled mode\n const [internalValue, setInternalValue] = createSignal(initialValue);\n\n // Determine if controlled\n const isControlled = () => getProps().value !== undefined;\n\n // Get current value\n const value: Accessor<string> = () => {\n const p = getProps();\n return isControlled() ? (p.value ?? '') : internalValue();\n };\n\n // Update value\n function setValue(newValue: string): void {\n const p = getProps();\n\n if (!isControlled()) {\n setInternalValue(newValue);\n }\n\n p.onChange?.(newValue);\n }\n\n return {\n value,\n setValue,\n };\n}\n","/**\n * Checkbox group state for Solid Stately\n *\n * Provides state management for a checkbox group component.\n * Provides a name for the group, and manages selection and focus state.\n *\n * This is a 1:1 port of @react-stately/checkbox's useCheckboxGroupState.\n */\n\nimport { createSignal, Accessor } from 'solid-js';\nimport { type MaybeAccessor, access } from '../utils';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface CheckboxGroupProps {\n /** The current selected values (controlled). */\n value?: string[];\n /** The default selected values (uncontrolled). */\n defaultValue?: string[];\n /** Handler that is called when the value changes. */\n onChange?: (value: string[]) => void;\n /** Whether the checkbox group is disabled. */\n isDisabled?: boolean;\n /** Whether the checkbox group is read only. */\n isReadOnly?: boolean;\n /** Whether the checkbox group is required. */\n isRequired?: boolean;\n /** Whether the checkbox group is invalid. */\n isInvalid?: boolean;\n /** The name of the checkbox group, used when submitting an HTML form. */\n name?: string;\n /** The form to associate the checkbox group with. */\n form?: string;\n /** The label for the checkbox group. */\n label?: string;\n /** Handler that is called when the checkbox group receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the checkbox group loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the checkbox group's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n}\n\nexport interface CheckboxGroupState {\n /** Current selected values. */\n readonly value: Accessor<readonly string[]>;\n /** Default selected values. */\n readonly defaultValue: readonly string[];\n /** Whether the checkbox group is disabled. */\n readonly isDisabled: boolean;\n /** Whether the checkbox group is read only. */\n readonly isReadOnly: boolean;\n /** Whether the checkbox group is invalid. */\n readonly isInvalid: boolean;\n /**\n * Whether the checkboxes in the group are required.\n * This changes to false once at least one item is selected.\n */\n readonly isRequired: Accessor<boolean>;\n /** Returns whether the given value is selected. */\n isSelected(value: string): boolean;\n /** Sets the selected values. */\n setValue(value: string[]): void;\n /** Adds a value to the set of selected values. */\n addValue(value: string): void;\n /** Removes a value from the set of selected values. */\n removeValue(value: string): void;\n /** Toggles a value in the set of selected values. */\n toggleValue(value: string): void;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides state management for a checkbox group component.\n * Provides a name for the group, and manages selection and focus state.\n */\nexport function createCheckboxGroupState(\n props: MaybeAccessor<CheckboxGroupProps> = {}\n): CheckboxGroupState {\n const getProps = () => access(props);\n\n // Get initial values\n const initialProps = getProps();\n const initialValue = initialProps.value ?? initialProps.defaultValue ?? [];\n\n // Create internal signal for uncontrolled mode\n const [internalValue, setInternalValue] = createSignal<readonly string[]>(initialValue);\n\n // Determine if controlled\n const isControlled = () => getProps().value !== undefined;\n\n // Get current value\n const value: Accessor<readonly string[]> = () => {\n const p = getProps();\n return isControlled() ? (p.value ?? []) : internalValue();\n };\n\n // Check if required (true if isRequired and no items selected)\n const isRequired: Accessor<boolean> = () => {\n const p = getProps();\n return !!p.isRequired && value().length === 0;\n };\n\n // Check if invalid\n const isInvalid = () => {\n return getProps().isInvalid ?? false;\n };\n\n // Set value\n function setValue(newValue: string[]): void {\n const p = getProps();\n if (p.isReadOnly || p.isDisabled) {\n return;\n }\n\n if (!isControlled()) {\n setInternalValue(newValue);\n }\n\n p.onChange?.(newValue);\n }\n\n // Check if value is selected\n function isSelected(checkValue: string): boolean {\n return value().includes(checkValue);\n }\n\n // Add value\n function addValue(addVal: string): void {\n const p = getProps();\n if (p.isReadOnly || p.isDisabled) {\n return;\n }\n\n const current = value();\n if (!current.includes(addVal)) {\n setValue([...current, addVal]);\n }\n }\n\n // Remove value\n function removeValue(removeVal: string): void {\n const p = getProps();\n if (p.isReadOnly || p.isDisabled) {\n return;\n }\n\n const current = value();\n if (current.includes(removeVal)) {\n setValue(current.filter((v) => v !== removeVal));\n }\n }\n\n // Toggle value\n function toggleValue(toggleVal: string): void {\n const p = getProps();\n if (p.isReadOnly || p.isDisabled) {\n return;\n }\n\n const current = value();\n if (current.includes(toggleVal)) {\n setValue(current.filter((v) => v !== toggleVal));\n } else {\n setValue([...current, toggleVal]);\n }\n }\n\n return {\n value,\n defaultValue: initialProps.defaultValue ?? initialValue,\n get isDisabled() {\n return getProps().isDisabled ?? false;\n },\n get isReadOnly() {\n return getProps().isReadOnly ?? false;\n },\n get isInvalid() {\n return isInvalid();\n },\n isRequired,\n isSelected,\n setValue,\n addValue,\n removeValue,\n toggleValue,\n };\n}\n","/**\n * Radio group state for Solid Stately\n *\n * Provides state management for a radio group component.\n * Provides a name for the group, and manages selection and focus state.\n *\n * This is a 1:1 port of @react-stately/radio's useRadioGroupState.\n */\n\nimport { createSignal, Accessor, untrack } from 'solid-js';\nimport { type MaybeAccessor, access } from '../utils';\nimport { createId } from '../ssr';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface RadioGroupProps {\n /** The current selected value (controlled). */\n value?: string | null;\n /** The default selected value (uncontrolled). */\n defaultValue?: string | null;\n /** Handler that is called when the value changes. */\n onChange?: (value: string) => void;\n /** Whether the radio group is disabled. */\n isDisabled?: boolean;\n /** Whether the radio group is read only. */\n isReadOnly?: boolean;\n /** Whether the radio group is required. */\n isRequired?: boolean;\n /** Whether the radio group is invalid. */\n isInvalid?: boolean;\n /** The name of the radio group, used when submitting an HTML form. */\n name?: string;\n /** The form to associate the radio group with. */\n form?: string;\n /** The label for the radio group. */\n label?: string;\n /** Orientation of the radio group. */\n orientation?: 'horizontal' | 'vertical';\n /** Handler that is called when the radio group receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the radio group loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the radio group's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n}\n\nexport interface RadioGroupState {\n /** The name for the group, used for native form submission. */\n readonly name: string;\n\n /** Whether the radio group is disabled. */\n readonly isDisabled: boolean;\n\n /** Whether the radio group is read only. */\n readonly isReadOnly: boolean;\n\n /** Whether the radio group is required. */\n readonly isRequired: boolean;\n\n /** Whether the radio group is invalid. */\n readonly isInvalid: boolean;\n\n /** The currently selected value. */\n readonly selectedValue: Accessor<string | null>;\n\n /** The default selected value. */\n readonly defaultSelectedValue: string | null;\n\n /** Sets the selected value. */\n setSelectedValue(value: string | null): void;\n\n /** The value of the last focused radio. */\n readonly lastFocusedValue: Accessor<string | null>;\n\n /** Sets the last focused value. */\n setLastFocusedValue(value: string | null): void;\n}\n\n// ============================================\n// INTERNAL: SolidJS-specific sync mechanism\n// ============================================\n\n/**\n * Internal WeakMap to store sync version accessors for each radio group state.\n * This is used by createRadio to trigger DOM sync when native radio behavior\n * causes the DOM checked state to desync from our reactive state.\n *\n * This is kept separate from RadioGroupState to maintain API parity with React-Stately.\n * @internal\n */\nexport const radioGroupSyncVersion: WeakMap<RadioGroupState, Accessor<number>> = new WeakMap();\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides state management for a radio group component.\n * Provides a name for the group, and manages selection and focus state.\n */\nexport function createRadioGroupState(\n props: MaybeAccessor<RadioGroupProps> = {}\n): RadioGroupState {\n const getProps = () => access(props);\n\n // Get initial props using untrack to avoid setting up dependencies\n // This ensures we capture the initial defaultValue without reactivity issues\n const initialProps = untrack(() => getProps());\n\n // Generate name - preserved for backward compatibility\n // React Aria now generates the name instead of stately\n const name = initialProps.name || `radio-group-${createId()}`;\n\n // Create internal signal for uncontrolled mode\n // Initialize with defaultValue only (not value, which is for controlled mode)\n const [internalValue, setInternalValue] = createSignal<string | null>(\n initialProps.defaultValue ?? null\n );\n const [lastFocusedValue, setLastFocusedValueInternal] = createSignal<string | null>(null);\n\n // SolidJS-specific: Version counter for triggering DOM sync across all radios\n // This handles the case where native radio behavior causes DOM state to desync\n // from our reactive state (e.g., clicking a radio unchecks siblings in the DOM)\n const [syncVersion, setSyncVersion] = createSignal(0);\n\n // Determine if controlled - must be reactive to handle dynamic props\n const isControlled = () => getProps().value !== undefined;\n\n // Get current value - reactive for both controlled and uncontrolled modes\n const selectedValue: Accessor<string | null> = () => {\n const p = getProps();\n // In controlled mode, always read from props.value reactively\n // In uncontrolled mode, read from internal signal\n if (p.value !== undefined) {\n return p.value ?? null;\n }\n return internalValue();\n };\n\n // Check if invalid\n const isInvalid = () => {\n return getProps().isInvalid ?? false;\n };\n\n // Set value\n function setSelectedValue(value: string | null): void {\n const p = getProps();\n if (p.isReadOnly || p.isDisabled) {\n return;\n }\n\n // Always increment syncVersion to trigger DOM sync across all radios\n // This is crucial for SolidJS because:\n // 1. Native radio behavior unchecks siblings when one is checked\n // 2. In controlled mode, isSelected() may not change even though DOM changed\n // 3. We need ALL radios to re-sync their checked state after any click\n setSyncVersion((v) => v + 1);\n\n if (!isControlled()) {\n setInternalValue(value);\n }\n\n if (value != null) {\n p.onChange?.(value);\n }\n }\n\n // Set last focused value\n function setLastFocusedValue(value: string | null): void {\n setLastFocusedValueInternal(value);\n }\n\n const state: RadioGroupState = {\n name,\n selectedValue,\n defaultSelectedValue: initialProps.defaultValue ?? null,\n setSelectedValue,\n lastFocusedValue,\n setLastFocusedValue,\n get isDisabled() {\n return getProps().isDisabled ?? false;\n },\n get isReadOnly() {\n return getProps().isReadOnly ?? false;\n },\n get isRequired() {\n return getProps().isRequired ?? false;\n },\n get isInvalid() {\n return isInvalid();\n },\n };\n\n // Store syncVersion in internal WeakMap (not part of public API)\n // This maintains API parity with React-Stately while supporting SolidJS's reactivity needs\n radioGroupSyncVersion.set(state, syncVersion);\n\n return state;\n}\n","/**\n * SSR utilities for Solid Stately\n *\n * SolidJS has built-in SSR support with `isServer` and `createUniqueId()`.\n * These utilities provide a consistent API matching React-Stately's patterns.\n */\n\nimport { createUniqueId } from 'solid-js';\nimport { isServer as _isServer } from 'solid-js/web';\n\n/**\n * Re-export isServer from solid-js/web for convenience.\n */\nexport const isServer = _isServer;\n\n/**\n * Returns whether the component is currently being server side rendered.\n * Can be used to delay browser-specific rendering until after hydration.\n */\nexport function createIsSSR(): boolean {\n return isServer;\n}\n\n/**\n * Generate a unique ID that is stable across server and client.\n * Uses SolidJS's built-in createUniqueId which handles SSR correctly.\n *\n * @param defaultId - Optional default ID to use instead of generating one.\n */\nexport function createId(defaultId?: string): string {\n if (defaultId) {\n return defaultId;\n }\n return `solid-stately-${createUniqueId()}`;\n}\n\n/**\n * Check if we can use DOM APIs.\n * This is useful for code that needs to run only in the browser.\n */\nexport const canUseDOM = !isServer;\n","/**\n * Manages state for an overlay trigger.\n * Based on @react-stately/overlays useOverlayTriggerState.\n */\n\nimport { createSignal, type Accessor } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils';\n\nexport interface OverlayTriggerProps {\n /** Whether the overlay is open by default (uncontrolled). */\n defaultOpen?: boolean;\n /** Whether the overlay is open (controlled). */\n isOpen?: boolean;\n /** Handler that is called when the overlay's open state changes. */\n onOpenChange?: (isOpen: boolean) => void;\n}\n\nexport interface OverlayTriggerState {\n /** Whether the overlay is currently open. */\n readonly isOpen: Accessor<boolean>;\n /** Sets whether the overlay is open. */\n setOpen(isOpen: boolean): void;\n /** Opens the overlay. */\n open(): void;\n /** Closes the overlay. */\n close(): void;\n /** Toggles the overlay's visibility. */\n toggle(): void;\n}\n\n/**\n * Manages state for an overlay trigger. Tracks whether the overlay is open, and provides\n * methods to toggle this state.\n */\nexport function createOverlayTriggerState(\n props: MaybeAccessor<OverlayTriggerProps> = {}\n): OverlayTriggerState {\n const propsAccessor = () => access(props);\n\n // Use controlled state if isOpen is provided, otherwise use internal state\n const [internalOpen, setInternalOpen] = createSignal(propsAccessor().defaultOpen ?? false);\n\n const isOpen: Accessor<boolean> = () => {\n const p = propsAccessor();\n return p.isOpen !== undefined ? p.isOpen : internalOpen();\n };\n\n const setOpen = (open: boolean) => {\n const p = propsAccessor();\n if (p.isOpen === undefined) {\n setInternalOpen(open);\n }\n p.onOpenChange?.(open);\n };\n\n const open = () => setOpen(true);\n const close = () => setOpen(false);\n const toggle = () => setOpen(!isOpen());\n\n return {\n isOpen,\n setOpen,\n open,\n close,\n toggle,\n };\n}\n","/**\n * A simple list collection implementation.\n * Provides a Collection interface over an array of nodes.\n */\n\nimport type { Collection, CollectionNode, Key } from './types';\n\n/**\n * A basic implementation of Collection for list-based components.\n */\nexport class ListCollection<T = unknown> implements Collection<T> {\n private nodes: CollectionNode<T>[];\n private keyMap: Map<Key, CollectionNode<T>>;\n\n constructor(nodes: CollectionNode<T>[]) {\n this.nodes = nodes;\n this.keyMap = new Map();\n\n // Build key map for O(1) lookups\n const addToMap = (node: CollectionNode<T>) => {\n this.keyMap.set(node.key, node);\n if (node.childNodes) {\n for (const child of node.childNodes) {\n addToMap(child);\n }\n }\n };\n\n for (const node of nodes) {\n addToMap(node);\n }\n }\n\n get size(): number {\n return this.keyMap.size;\n }\n\n *[Symbol.iterator](): Iterator<CollectionNode<T>> {\n yield* this.nodes;\n }\n\n *getKeys(): Iterable<Key> {\n for (const node of this.keyMap.values()) {\n yield node.key;\n }\n }\n\n getItem(key: Key): CollectionNode<T> | null {\n return this.keyMap.get(key) ?? null;\n }\n\n at(index: number): CollectionNode<T> | null {\n // Flatten all items for indexing\n const items = this.getAllItems();\n return items[index] ?? null;\n }\n\n getKeyBefore(key: Key): Key | null {\n const items = this.getAllItems();\n const index = items.findIndex((item) => item.key === key);\n if (index <= 0) return null;\n return items[index - 1].key;\n }\n\n getKeyAfter(key: Key): Key | null {\n const items = this.getAllItems();\n const index = items.findIndex((item) => item.key === key);\n if (index < 0 || index >= items.length - 1) return null;\n return items[index + 1].key;\n }\n\n getFirstKey(): Key | null {\n const items = this.getAllItems();\n return items[0]?.key ?? null;\n }\n\n getLastKey(): Key | null {\n const items = this.getAllItems();\n return items[items.length - 1]?.key ?? null;\n }\n\n *getChildren(key: Key): Iterable<CollectionNode<T>> {\n const node = this.getItem(key);\n if (node?.childNodes) {\n yield* node.childNodes;\n }\n }\n\n getTextValue(key: Key): string {\n return this.getItem(key)?.textValue ?? '';\n }\n\n /**\n * Get all items (excluding sections, including items within sections).\n */\n private getAllItems(): CollectionNode<T>[] {\n const items: CollectionNode<T>[] = [];\n\n const addItems = (nodes: CollectionNode<T>[]) => {\n for (const node of nodes) {\n if (node.type === 'item') {\n items.push(node);\n } else if (node.type === 'section' && node.childNodes) {\n addItems(node.childNodes);\n }\n }\n };\n\n addItems(this.nodes);\n return items;\n }\n}\n\n/**\n * Create a collection from an array of items.\n */\nexport function createListCollection<T>(\n items: T[],\n options: {\n getKey?: (item: T, index: number) => Key;\n getTextValue?: (item: T) => string;\n getDisabled?: (item: T) => boolean;\n } = {}\n): ListCollection<T> {\n const {\n getKey = (item: T, index: number) => (item as any).key ?? (item as any).id ?? index,\n getTextValue = (item: T) => (item as any).textValue ?? (item as any).label ?? String(item),\n getDisabled = (item: T) => (item as any).isDisabled ?? false,\n } = options;\n\n const nodes: CollectionNode<T>[] = items.map((item, index) => ({\n type: 'item' as const,\n key: getKey(item, index),\n value: item,\n textValue: getTextValue(item),\n rendered: null as any, // Will be set by component\n level: 0,\n index,\n parentKey: null,\n hasChildNodes: false,\n childNodes: [],\n isDisabled: getDisabled(item),\n }));\n\n return new ListCollection(nodes);\n}\n","/**\n * Selection state management for collections.\n * Based on @react-stately/selection.\n */\n\nimport { createSignal, type Accessor } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils';\nimport type {\n Collection,\n DisabledBehavior,\n FocusStrategy,\n Key,\n Selection,\n SelectionBehavior,\n SelectionMode,\n} from './types';\n\nexport interface SelectionStateProps {\n /** The selection mode. */\n selectionMode?: SelectionMode;\n /** How selection behaves on interaction. */\n selectionBehavior?: SelectionBehavior;\n /** Whether empty selection is disallowed. */\n disallowEmptySelection?: boolean;\n /** Currently selected keys (controlled). */\n selectedKeys?: 'all' | Iterable<Key>;\n /** Default selected keys (uncontrolled). */\n defaultSelectedKeys?: 'all' | Iterable<Key>;\n /** Handler for selection changes. */\n onSelectionChange?: (keys: Selection) => void;\n /** Keys of disabled items. */\n disabledKeys?: Iterable<Key>;\n /** How disabled keys behave. */\n disabledBehavior?: DisabledBehavior;\n /** Whether to allow duplicate selection events. */\n allowDuplicateSelectionEvents?: boolean;\n}\n\nexport interface SelectionState {\n /** The selection mode. */\n readonly selectionMode: Accessor<SelectionMode>;\n /** The selection behavior. */\n readonly selectionBehavior: Accessor<SelectionBehavior>;\n /** Whether empty selection is disallowed. */\n readonly disallowEmptySelection: Accessor<boolean>;\n /** The currently selected keys. */\n readonly selectedKeys: Accessor<Selection>;\n /** Set of disabled keys. */\n readonly disabledKeys: Accessor<Set<Key>>;\n /** How disabled keys behave. */\n readonly disabledBehavior: Accessor<DisabledBehavior>;\n /** Whether the selection is empty. */\n readonly isEmpty: Accessor<boolean>;\n /** Whether all items are selected. */\n readonly isSelectAll: Accessor<boolean>;\n /** Check if a key is selected. */\n isSelected(key: Key): boolean;\n /** Check if a key is disabled. */\n isDisabled(key: Key): boolean;\n /** Set the selection behavior. */\n setSelectionBehavior(behavior: SelectionBehavior): void;\n /** Toggle selection for a key. */\n toggleSelection(key: Key): void;\n /** Replace selection with a single key. */\n replaceSelection(key: Key): void;\n /** Set multiple selected keys. */\n setSelectedKeys(keys: Iterable<Key>): void;\n /** Select all items. */\n selectAll(): void;\n /** Clear all selection. */\n clearSelection(): void;\n /** Toggle between select all and clear. */\n toggleSelectAll(): void;\n /** Extend selection to a key (for shift-click). */\n extendSelection(toKey: Key, collection: Collection): void;\n /** Select a key based on interaction. */\n select(key: Key, e?: { shiftKey?: boolean; ctrlKey?: boolean; metaKey?: boolean }, collection?: Collection): void;\n}\n\n/**\n * Creates selection state for a collection.\n */\nexport function createSelectionState(\n props: MaybeAccessor<SelectionStateProps> = {}\n): SelectionState {\n const getProps = () => access(props);\n\n // Selection behavior state\n const [internalBehavior, setInternalBehavior] = createSignal<SelectionBehavior>('toggle');\n\n // Internal selection state\n const [internalSelectedKeys, setInternalSelectedKeys] = createSignal<Selection>(\n getInitialSelection(getProps().defaultSelectedKeys)\n );\n\n // Track anchor for range selection\n const [anchorKey, setAnchorKey] = createSignal<Key | null>(null);\n\n // Computed values\n const selectionMode: Accessor<SelectionMode> = () => getProps().selectionMode ?? 'none';\n\n const selectionBehavior: Accessor<SelectionBehavior> = () => {\n return getProps().selectionBehavior ?? internalBehavior();\n };\n\n const disallowEmptySelection: Accessor<boolean> = () => {\n return getProps().disallowEmptySelection ?? false;\n };\n\n const selectedKeys: Accessor<Selection> = () => {\n const p = getProps();\n if (p.selectedKeys !== undefined) {\n return normalizeSelection(p.selectedKeys);\n }\n return internalSelectedKeys();\n };\n\n const disabledKeys: Accessor<Set<Key>> = () => {\n const keys = getProps().disabledKeys;\n return keys ? new Set(keys) : new Set();\n };\n\n const disabledBehavior: Accessor<DisabledBehavior> = () => {\n return getProps().disabledBehavior ?? 'all';\n };\n\n const isEmpty: Accessor<boolean> = () => {\n const keys = selectedKeys();\n return keys !== 'all' && keys.size === 0;\n };\n\n const isSelectAll: Accessor<boolean> = () => {\n return selectedKeys() === 'all';\n };\n\n // Methods\n const isSelected = (key: Key): boolean => {\n const keys = selectedKeys();\n if (keys === 'all') return true;\n return keys.has(key);\n };\n\n const isDisabled = (key: Key): boolean => {\n return disabledKeys().has(key);\n };\n\n const updateSelection = (newSelection: Selection) => {\n const p = getProps();\n\n // Controlled mode\n if (p.selectedKeys !== undefined) {\n p.onSelectionChange?.(newSelection);\n return;\n }\n\n // Uncontrolled mode\n const current = internalSelectedKeys();\n const isDifferent =\n current === 'all' ||\n newSelection === 'all' ||\n current.size !== (newSelection as Set<Key>).size ||\n ![...current].every((k) => (newSelection as Set<Key>).has(k));\n\n if (isDifferent || p.allowDuplicateSelectionEvents) {\n setInternalSelectedKeys(newSelection);\n p.onSelectionChange?.(newSelection);\n }\n };\n\n const toggleSelection = (key: Key) => {\n if (isDisabled(key)) return;\n if (selectionMode() === 'none') return;\n\n const current = selectedKeys();\n\n if (selectionMode() === 'single') {\n if (isSelected(key) && !disallowEmptySelection()) {\n updateSelection(new Set());\n } else {\n updateSelection(new Set([key]));\n }\n return;\n }\n\n // Multiple selection\n if (current === 'all') {\n // Can't toggle when all selected without collection\n return;\n }\n\n const newSelection = new Set(current);\n if (newSelection.has(key)) {\n if (newSelection.size > 1 || !disallowEmptySelection()) {\n newSelection.delete(key);\n }\n } else {\n newSelection.add(key);\n }\n\n updateSelection(newSelection);\n setAnchorKey(key);\n };\n\n const replaceSelection = (key: Key) => {\n if (isDisabled(key)) return;\n if (selectionMode() === 'none') return;\n\n updateSelection(new Set([key]));\n setAnchorKey(key);\n };\n\n const setSelectedKeys = (keys: Iterable<Key>) => {\n const filtered = [...keys].filter((k) => !isDisabled(k));\n updateSelection(new Set(filtered));\n };\n\n const selectAll = () => {\n if (selectionMode() !== 'multiple') return;\n updateSelection('all');\n };\n\n const clearSelection = () => {\n if (disallowEmptySelection()) return;\n updateSelection(new Set());\n };\n\n const toggleSelectAll = () => {\n if (selectionMode() !== 'multiple') return;\n\n if (isSelectAll()) {\n clearSelection();\n } else {\n selectAll();\n }\n };\n\n const extendSelection = (toKey: Key, collection: Collection) => {\n if (isDisabled(toKey)) return;\n if (selectionMode() !== 'multiple') {\n replaceSelection(toKey);\n return;\n }\n\n const anchor = anchorKey();\n if (!anchor) {\n replaceSelection(toKey);\n return;\n }\n\n // Get keys between anchor and toKey\n const keys = [...collection.getKeys()];\n const anchorIndex = keys.indexOf(anchor);\n const toIndex = keys.indexOf(toKey);\n\n if (anchorIndex === -1 || toIndex === -1) {\n replaceSelection(toKey);\n return;\n }\n\n const start = Math.min(anchorIndex, toIndex);\n const end = Math.max(anchorIndex, toIndex);\n const rangeKeys = keys.slice(start, end + 1).filter((k) => !isDisabled(k));\n\n updateSelection(new Set(rangeKeys));\n };\n\n const select = (\n key: Key,\n e?: { shiftKey?: boolean; ctrlKey?: boolean; metaKey?: boolean },\n collection?: Collection\n ) => {\n if (isDisabled(key)) return;\n if (selectionMode() === 'none') return;\n\n const mode = selectionMode();\n const behavior = selectionBehavior();\n\n if (mode === 'single') {\n if (behavior === 'replace' || !isSelected(key)) {\n replaceSelection(key);\n } else if (!disallowEmptySelection()) {\n clearSelection();\n }\n return;\n }\n\n // Multiple selection\n if (e?.shiftKey && collection) {\n extendSelection(key, collection);\n return;\n }\n\n if (e?.ctrlKey || e?.metaKey || behavior === 'toggle') {\n toggleSelection(key);\n } else {\n replaceSelection(key);\n }\n };\n\n const setSelectionBehavior = (behavior: SelectionBehavior) => {\n setInternalBehavior(behavior);\n };\n\n return {\n selectionMode,\n selectionBehavior,\n disallowEmptySelection,\n selectedKeys,\n disabledKeys,\n disabledBehavior,\n isEmpty,\n isSelectAll,\n isSelected,\n isDisabled,\n setSelectionBehavior,\n toggleSelection,\n replaceSelection,\n setSelectedKeys,\n selectAll,\n clearSelection,\n toggleSelectAll,\n extendSelection,\n select,\n };\n}\n\n// Helper functions\nfunction getInitialSelection(defaultKeys?: 'all' | Iterable<Key>): Selection {\n if (defaultKeys === undefined) return new Set();\n return normalizeSelection(defaultKeys);\n}\n\nfunction normalizeSelection(keys: 'all' | Iterable<Key>): Selection {\n if (keys === 'all') return 'all';\n return new Set(keys);\n}\n","/**\n * State management for list-like components.\n * Combines collection and selection state.\n * Based on @react-stately/list.\n */\n\nimport { createSignal, type Accessor } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils';\nimport { ListCollection } from './ListCollection';\nimport { createSelectionState, type SelectionState } from './createSelectionState';\nimport type {\n Collection,\n CollectionNode,\n DisabledBehavior,\n FocusStrategy,\n Key,\n SelectionBehavior,\n SelectionMode,\n} from './types';\n\nexport interface ListStateProps<T = unknown> {\n /** The items in the list (for dynamic rendering). */\n items?: T[];\n /** Function to get a key from an item. */\n getKey?: (item: T) => Key;\n /** Function to get text value from an item. */\n getTextValue?: (item: T) => string;\n /** Function to check if an item is disabled. */\n getDisabled?: (item: T) => boolean;\n /** Keys of disabled items. */\n disabledKeys?: Iterable<Key>;\n /** How disabled keys behave. */\n disabledBehavior?: DisabledBehavior;\n /** The selection mode. */\n selectionMode?: SelectionMode;\n /** How selection behaves on interaction. */\n selectionBehavior?: SelectionBehavior;\n /** Whether empty selection is disallowed. */\n disallowEmptySelection?: boolean;\n /** Currently selected keys (controlled). */\n selectedKeys?: 'all' | Iterable<Key>;\n /** Default selected keys (uncontrolled). */\n defaultSelectedKeys?: 'all' | Iterable<Key>;\n /** Handler for selection changes. */\n onSelectionChange?: (keys: 'all' | Set<Key>) => void;\n /** Whether to allow duplicate selection events. */\n allowDuplicateSelectionEvents?: boolean;\n}\n\nexport interface ListState<T = unknown> extends SelectionState {\n /** The collection of items. */\n readonly collection: Accessor<Collection<T>>;\n /** Whether the collection is focused. */\n readonly isFocused: Accessor<boolean>;\n /** Set the focused state. */\n setFocused(isFocused: boolean): void;\n /** The currently focused key. */\n readonly focusedKey: Accessor<Key | null>;\n /** Set the focused key. */\n setFocusedKey(key: Key | null, childStrategy?: FocusStrategy): void;\n /** The child focus strategy. */\n readonly childFocusStrategy: Accessor<FocusStrategy | null>;\n}\n\n/**\n * Creates state for a list component with selection.\n */\nexport function createListState<T = unknown>(\n props: MaybeAccessor<ListStateProps<T>>\n): ListState<T> {\n const getProps = () => access(props);\n\n // Build collection from items\n const collection: Accessor<Collection<T>> = () => {\n const p = getProps();\n const items = p.items ?? [];\n\n const nodes: CollectionNode<T>[] = items.map((item, index) => {\n const key = p.getKey?.(item) ?? (item as any).key ?? (item as any).id ?? index;\n const textValue =\n p.getTextValue?.(item) ?? (item as any).textValue ?? (item as any).label ?? String(item);\n const isDisabled = p.getDisabled?.(item) ?? (item as any).isDisabled ?? false;\n\n return {\n type: 'item' as const,\n key,\n value: item,\n textValue,\n rendered: null as any,\n level: 0,\n index,\n parentKey: null,\n hasChildNodes: false,\n childNodes: [],\n isDisabled,\n };\n });\n\n return new ListCollection(nodes);\n };\n\n // Combine disabled keys from props and items\n const combinedDisabledKeys = (): Iterable<Key> => {\n const p = getProps();\n const propsDisabled = p.disabledKeys ? [...p.disabledKeys] : [];\n const itemDisabled: Key[] = [];\n\n const coll = collection();\n for (const node of coll) {\n if (node.isDisabled) {\n itemDisabled.push(node.key);\n }\n }\n\n return [...new Set([...propsDisabled, ...itemDisabled])];\n };\n\n // Create selection state\n const selectionState = createSelectionState({\n get selectionMode() {\n return getProps().selectionMode;\n },\n get selectionBehavior() {\n return getProps().selectionBehavior;\n },\n get disallowEmptySelection() {\n return getProps().disallowEmptySelection;\n },\n get selectedKeys() {\n return getProps().selectedKeys;\n },\n get defaultSelectedKeys() {\n return getProps().defaultSelectedKeys;\n },\n get onSelectionChange() {\n return getProps().onSelectionChange;\n },\n get disabledKeys() {\n return combinedDisabledKeys();\n },\n get disabledBehavior() {\n return getProps().disabledBehavior;\n },\n get allowDuplicateSelectionEvents() {\n return getProps().allowDuplicateSelectionEvents;\n },\n });\n\n // Focus state\n const [isFocused, setIsFocused] = createSignal(false);\n const [focusedKey, setFocusedKeyInternal] = createSignal<Key | null>(null);\n const [childFocusStrategy, setChildFocusStrategy] = createSignal<FocusStrategy | null>(null);\n\n const setFocusedKey = (key: Key | null, childStrategy?: FocusStrategy) => {\n setFocusedKeyInternal(key);\n setChildFocusStrategy(childStrategy ?? null);\n };\n\n return {\n collection,\n isFocused,\n setFocused: setIsFocused,\n focusedKey,\n setFocusedKey,\n childFocusStrategy,\n ...selectionState,\n };\n}\n\n/**\n * Props for single selection list state.\n */\nexport interface SingleSelectListStateProps<T = unknown>\n extends Omit<ListStateProps<T>, 'selectionMode' | 'selectedKeys' | 'defaultSelectedKeys' | 'onSelectionChange'> {\n /** The currently selected key (controlled). */\n selectedKey?: Key | null;\n /** The default selected key (uncontrolled). */\n defaultSelectedKey?: Key;\n /** Handler for selection changes. */\n onSelectionChange?: (key: Key | null) => void;\n}\n\nexport interface SingleSelectListState<T = unknown> extends ListState<T> {\n /** The currently selected key. */\n readonly selectedKey: Accessor<Key | null>;\n /** Set the selected key. */\n setSelectedKey(key: Key | null): void;\n /** The currently selected item. */\n readonly selectedItem: Accessor<CollectionNode<T> | null>;\n}\n\n/**\n * Creates state for a single-select list component.\n */\nexport function createSingleSelectListState<T = unknown>(\n props: MaybeAccessor<SingleSelectListStateProps<T>>\n): SingleSelectListState<T> {\n const getProps = () => access(props);\n\n // Convert single selection props to multiple selection props\n const listState = createListState<T>({\n get items() {\n return getProps().items;\n },\n get getKey() {\n return getProps().getKey;\n },\n get getTextValue() {\n return getProps().getTextValue;\n },\n get getDisabled() {\n return getProps().getDisabled;\n },\n get disabledKeys() {\n return getProps().disabledKeys;\n },\n get disabledBehavior() {\n return getProps().disabledBehavior;\n },\n selectionMode: 'single',\n disallowEmptySelection: true,\n allowDuplicateSelectionEvents: true,\n get selectedKeys() {\n const key = getProps().selectedKey;\n return key != null ? [key] : [];\n },\n get defaultSelectedKeys() {\n const key = getProps().defaultSelectedKey;\n return key != null ? [key] : undefined;\n },\n onSelectionChange(keys) {\n if (keys === 'all') return;\n const key = keys.values().next().value ?? null;\n getProps().onSelectionChange?.(key);\n },\n });\n\n const selectedKey: Accessor<Key | null> = () => {\n const keys = listState.selectedKeys();\n if (keys === 'all') return null;\n return keys.values().next().value ?? null;\n };\n\n const setSelectedKey = (key: Key | null) => {\n if (key === null) {\n listState.clearSelection();\n } else {\n listState.replaceSelection(key);\n }\n };\n\n const selectedItem: Accessor<CollectionNode<T> | null> = () => {\n const key = selectedKey();\n if (key === null) return null;\n return listState.collection().getItem(key);\n };\n\n return {\n ...listState,\n selectedKey,\n setSelectedKey,\n selectedItem,\n };\n}\n","/**\n * State management for menu components.\n * Based on @react-stately/menu.\n */\n\nimport { access, type MaybeAccessor } from '../utils';\nimport { createListState, type ListState, type ListStateProps } from './createListState';\nimport type { Key } from './types';\n\nexport interface MenuStateProps<T = unknown>\n extends Omit<ListStateProps<T>, 'selectionMode' | 'disallowEmptySelection'> {\n /** Handler called when an item is activated (pressed). */\n onAction?: (key: Key) => void;\n /** Handler called when the menu should close. */\n onClose?: () => void;\n}\n\nexport interface MenuState<T = unknown> extends ListState<T> {\n /** Close the menu. */\n close(): void;\n}\n\n/**\n * Creates state for a menu component.\n * Menus are single-select lists that support actions.\n */\nexport function createMenuState<T = unknown>(\n props: MaybeAccessor<MenuStateProps<T>>\n): MenuState<T> {\n const getProps = () => access(props);\n\n // Create list state with single selection\n const listState = createListState<T>({\n get items() {\n return getProps().items;\n },\n get getKey() {\n return getProps().getKey;\n },\n get getTextValue() {\n return getProps().getTextValue;\n },\n get getDisabled() {\n return getProps().getDisabled;\n },\n get disabledKeys() {\n return getProps().disabledKeys;\n },\n get disabledBehavior() {\n return getProps().disabledBehavior;\n },\n selectionMode: 'none', // Menus typically use onAction, not selection\n disallowEmptySelection: true,\n get selectedKeys() {\n return getProps().selectedKeys;\n },\n get defaultSelectedKeys() {\n return getProps().defaultSelectedKeys;\n },\n get onSelectionChange() {\n return getProps().onSelectionChange;\n },\n get selectionBehavior() {\n return getProps().selectionBehavior;\n },\n });\n\n const close = () => {\n getProps().onClose?.();\n };\n\n return {\n ...listState,\n close,\n };\n}\n\nexport interface MenuTriggerStateProps {\n /** Whether the menu is open (controlled). */\n isOpen?: boolean;\n /** Default open state (uncontrolled). */\n defaultOpen?: boolean;\n /** Handler called when the open state changes. */\n onOpenChange?: (isOpen: boolean) => void;\n}\n\nexport interface MenuTriggerState {\n /** Whether the menu is open. */\n readonly isOpen: () => boolean;\n /** Open the menu. */\n open(): void;\n /** Close the menu. */\n close(): void;\n /** Toggle the menu. */\n toggle(): void;\n /** Focus strategy for when the menu opens. */\n readonly focusStrategy: () => 'first' | 'last' | null;\n /** Set the focus strategy. */\n setFocusStrategy(strategy: 'first' | 'last' | null): void;\n}\n\n/**\n * Creates state for a menu trigger (button that opens a menu).\n * This is essentially the same as overlay trigger state but with focus strategy.\n */\nexport { createOverlayTriggerState as createMenuTriggerState } from '../overlays';\n","/**\n * State management for select components.\n * Based on @react-stately/select useSelectState.\n */\n\nimport { createSignal, type Accessor } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils';\nimport { createListState } from '../collections/createListState';\nimport { createOverlayTriggerState } from '../overlays';\nimport type { Key, CollectionNode, Collection } from '../collections/types';\n\nexport interface SelectStateProps<T = unknown> {\n /** The items to display in the select. */\n items: T[];\n /** Function to get the key for an item. */\n getKey?: (item: T) => Key;\n /** Function to get the text value for an item. */\n getTextValue?: (item: T) => string;\n /** Function to check if an item is disabled. */\n getDisabled?: (item: T) => boolean;\n /** Keys of disabled items. */\n disabledKeys?: Iterable<Key>;\n /** The currently selected key (controlled). */\n selectedKey?: Key | null;\n /** The default selected key (uncontrolled). */\n defaultSelectedKey?: Key | null;\n /** Handler called when the selection changes. */\n onSelectionChange?: (key: Key | null) => void;\n /** Whether the select is open (controlled). */\n isOpen?: boolean;\n /** Whether the select is open by default (uncontrolled). */\n defaultOpen?: boolean;\n /** Handler called when the open state changes. */\n onOpenChange?: (isOpen: boolean) => void;\n /** Whether the select is disabled. */\n isDisabled?: boolean;\n /** Whether the select is required. */\n isRequired?: boolean;\n}\n\nexport interface SelectState<T = unknown> {\n /** The collection of items. */\n readonly collection: Accessor<Collection<T>>;\n /** Whether the select dropdown is open. */\n readonly isOpen: Accessor<boolean>;\n /** Open the select dropdown. */\n open(): void;\n /** Close the select dropdown. */\n close(): void;\n /** Toggle the select dropdown. */\n toggle(): void;\n /** The currently selected key. */\n readonly selectedKey: Accessor<Key | null>;\n /** The currently selected item. */\n readonly selectedItem: Accessor<CollectionNode<T> | null>;\n /** Set the selected key. */\n setSelectedKey(key: Key | null): void;\n /** The currently focused key. */\n readonly focusedKey: Accessor<Key | null>;\n /** Set the focused key. */\n setFocusedKey(key: Key | null): void;\n /** Whether the select has focus. */\n readonly isFocused: Accessor<boolean>;\n /** Set whether the select has focus. */\n setFocused(isFocused: boolean): void;\n /** Whether a specific key is disabled. */\n isKeyDisabled(key: Key): boolean;\n /** Whether the select is disabled. */\n readonly isDisabled: boolean;\n /** Whether the select is required. */\n readonly isRequired: boolean;\n}\n\n/**\n * Creates state for a select component.\n * Combines list state with overlay trigger state for dropdown behavior.\n */\nexport function createSelectState<T = unknown>(\n props: MaybeAccessor<SelectStateProps<T>>\n): SelectState<T> {\n const getProps = () => access(props);\n\n // Overlay trigger state for open/close\n const overlayState = createOverlayTriggerState({\n get isOpen() {\n return getProps().isOpen;\n },\n get defaultOpen() {\n return getProps().defaultOpen;\n },\n get onOpenChange() {\n return getProps().onOpenChange;\n },\n });\n\n // Track selected key\n const isControlled = () => getProps().selectedKey !== undefined;\n const [internalSelectedKey, setInternalSelectedKey] = createSignal<Key | null>(\n getProps().defaultSelectedKey ?? null\n );\n\n const selectedKey: Accessor<Key | null> = () => {\n return isControlled() ? (getProps().selectedKey ?? null) : internalSelectedKey();\n };\n\n const setSelectedKey = (key: Key | null) => {\n if (!isControlled()) {\n setInternalSelectedKey(key);\n }\n getProps().onSelectionChange?.(key);\n };\n\n // Create list state with single selection\n const listState = createListState<T>({\n get items() {\n return getProps().items;\n },\n get getKey() {\n return getProps().getKey;\n },\n get getTextValue() {\n return getProps().getTextValue;\n },\n get getDisabled() {\n return getProps().getDisabled;\n },\n get disabledKeys() {\n return getProps().disabledKeys;\n },\n selectionMode: 'single',\n disallowEmptySelection: true,\n get selectedKeys() {\n const key = selectedKey();\n return key != null ? [key] : [];\n },\n onSelectionChange(keys) {\n // Get the first (and only) selected key\n if (keys === 'all') return; // Not applicable for single select\n const key = keys.size > 0 ? Array.from(keys)[0] : null;\n setSelectedKey(key);\n // Close the dropdown after selection\n overlayState.close();\n },\n });\n\n // Get the selected item from the collection\n const selectedItem: Accessor<CollectionNode<T> | null> = () => {\n const key = selectedKey();\n if (key == null) return null;\n return listState.collection().getItem(key);\n };\n\n return {\n // Collection\n collection: listState.collection,\n\n // Focus management\n focusedKey: listState.focusedKey,\n setFocusedKey: listState.setFocusedKey,\n isFocused: listState.isFocused,\n setFocused: listState.setFocused,\n\n // Overlay state\n isOpen: overlayState.isOpen,\n open: overlayState.open,\n close: overlayState.close,\n toggle: overlayState.toggle,\n\n // Select-specific\n selectedKey,\n selectedItem,\n setSelectedKey,\n isKeyDisabled: (key: Key) => listState.isDisabled(key),\n get isDisabled() {\n return getProps().isDisabled ?? false;\n },\n get isRequired() {\n return getProps().isRequired ?? false;\n },\n };\n}\n","/**\n * State management for ComboBox components.\n * Based on @react-stately/combobox useComboBoxState.\n *\n * ComboBox combines a text input with a dropdown list, allowing users to\n * either type to filter options or select from a list.\n */\n\nimport { createSignal, createMemo, createEffect, type Accessor } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils';\nimport { createListState } from '../collections/createListState';\nimport { createOverlayTriggerState } from '../overlays';\nimport type { Key, CollectionNode, Collection, FocusStrategy } from '../collections/types';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport type MenuTriggerAction = 'focus' | 'input' | 'manual';\n\n// Re-export FocusStrategy for convenience\nexport type { FocusStrategy } from '../collections/types';\n\nexport type FilterFn = (textValue: string, inputValue: string) => boolean;\n\nexport interface ComboBoxStateProps<T = unknown> {\n /** The items to display in the combobox dropdown. */\n items: T[];\n /** Default items when uncontrolled. */\n defaultItems?: T[];\n /** Function to get the key for an item. */\n getKey?: (item: T) => Key;\n /** Function to get the text value for an item. */\n getTextValue?: (item: T) => string;\n /** Function to check if an item is disabled. */\n getDisabled?: (item: T) => boolean;\n /** Keys of disabled items. */\n disabledKeys?: Iterable<Key>;\n /** The currently selected key (controlled). */\n selectedKey?: Key | null;\n /** The default selected key (uncontrolled). */\n defaultSelectedKey?: Key | null;\n /** Handler called when the selection changes. */\n onSelectionChange?: (key: Key | null) => void;\n /** The current input value (controlled). */\n inputValue?: string;\n /** The default input value (uncontrolled). */\n defaultInputValue?: string;\n /** Handler called when the input value changes. */\n onInputChange?: (value: string) => void;\n /** Whether the combobox is open (controlled). */\n isOpen?: boolean;\n /** Whether the combobox is open by default (uncontrolled). */\n defaultOpen?: boolean;\n /** Handler called when the open state changes. */\n onOpenChange?: (isOpen: boolean, trigger?: MenuTriggerAction) => void;\n /** Whether the combobox is disabled. */\n isDisabled?: boolean;\n /** Whether the combobox is read-only. */\n isReadOnly?: boolean;\n /** Whether the combobox is required. */\n isRequired?: boolean;\n /** The filter function to use when filtering items. */\n defaultFilter?: FilterFn;\n /** Whether to allow the menu to open when there are no items. */\n allowsEmptyCollection?: boolean;\n /** Whether to allow custom values that don't match any option. */\n allowsCustomValue?: boolean;\n /** What triggers the menu to open. */\n menuTrigger?: MenuTriggerAction;\n /** Whether to close the menu on blur. */\n shouldCloseOnBlur?: boolean;\n}\n\nexport interface ComboBoxState<T = unknown> {\n /** The collection of items (may be filtered). */\n readonly collection: Accessor<Collection<T>>;\n /** Whether the combobox dropdown is open. */\n readonly isOpen: Accessor<boolean>;\n /** Open the combobox dropdown. */\n open(focusStrategy?: FocusStrategy | null, trigger?: MenuTriggerAction): void;\n /** Close the combobox dropdown. */\n close(): void;\n /** Toggle the combobox dropdown. */\n toggle(focusStrategy?: FocusStrategy | null, trigger?: MenuTriggerAction): void;\n /** The currently selected key. */\n readonly selectedKey: Accessor<Key | null>;\n /** The default selected key. */\n readonly defaultSelectedKey: Key | null;\n /** The currently selected item. */\n readonly selectedItem: Accessor<CollectionNode<T> | null>;\n /** Set the selected key. */\n setSelectedKey(key: Key | null): void;\n /** The current input value. */\n readonly inputValue: Accessor<string>;\n /** The default input value. */\n readonly defaultInputValue: string;\n /** Set the input value. */\n setInputValue(value: string): void;\n /** The currently focused key in the list. */\n readonly focusedKey: Accessor<Key | null>;\n /** Set the focused key. */\n setFocusedKey(key: Key | null): void;\n /** Whether the combobox input has focus. */\n readonly isFocused: Accessor<boolean>;\n /** Set whether the combobox has focus. */\n setFocused(isFocused: boolean): void;\n /** The focus strategy to use when opening. */\n readonly focusStrategy: Accessor<FocusStrategy | null>;\n /** Commit the current selection (select focused item or custom value). */\n commit(): void;\n /** Revert input to the selected item's text and close menu. */\n revert(): void;\n /** Whether a specific key is disabled. */\n isKeyDisabled(key: Key): boolean;\n /** Select a key and close the menu (for ListState compatibility). */\n select(key: Key): void;\n /** The selection mode (always 'single' for combobox). */\n readonly selectionMode: Accessor<'single'>;\n /** Check if a key is selected. */\n isSelected(key: Key): boolean;\n /** Whether the combobox is disabled. */\n readonly isDisabled: boolean;\n /** Whether the combobox is read-only. */\n readonly isReadOnly: boolean;\n /** Whether the combobox is required. */\n readonly isRequired: boolean;\n}\n\n// ============================================\n// DEFAULT FILTER\n// ============================================\n\n/**\n * Default filter function that does case-insensitive \"contains\" matching.\n */\nexport const defaultContainsFilter: FilterFn = (textValue, inputValue) => {\n return textValue.toLowerCase().includes(inputValue.toLowerCase());\n};\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Creates state for a combobox component.\n * Combines list state with input value management and filtering.\n */\nexport function createComboBoxState<T = unknown>(\n props: MaybeAccessor<ComboBoxStateProps<T>>\n): ComboBoxState<T> {\n const getProps = () => access(props);\n\n // Extract options with defaults\n const menuTrigger = () => getProps().menuTrigger ?? 'input';\n const allowsEmptyCollection = () => getProps().allowsEmptyCollection ?? false;\n const allowsCustomValue = () => getProps().allowsCustomValue ?? false;\n const shouldCloseOnBlur = () => getProps().shouldCloseOnBlur ?? true;\n\n // Track focus strategy for list navigation\n const [focusStrategy, setFocusStrategy] = createSignal<FocusStrategy | null>(null);\n\n // Track whether we're showing all items (vs filtered)\n const [showAllItems, setShowAllItems] = createSignal(false);\n\n // Track the menu open trigger\n let menuOpenTrigger: MenuTriggerAction = 'focus';\n\n // ---- Selection State ----\n // Note: Selection state is initialized first because input value may depend on it\n const isSelectionControlled = () => getProps().selectedKey !== undefined;\n const [internalSelectedKey, setInternalSelectedKey] = createSignal<Key | null>(\n getProps().defaultSelectedKey ?? null\n );\n\n // ---- Input Value State ----\n // Initialized after selection so we can derive from selected item if needed\n const isInputControlled = () => getProps().inputValue !== undefined;\n\n // We'll set the proper initial value after collection is created\n const [internalInputValue, setInternalInputValue] = createSignal(\n getProps().defaultInputValue ?? ''\n );\n // Track if we've initialized input from selection\n let inputInitialized = false;\n\n const inputValue: Accessor<string> = () => {\n return isInputControlled() ? (getProps().inputValue ?? '') : internalInputValue();\n };\n\n const setInputValue = (value: string) => {\n if (!isInputControlled()) {\n setInternalInputValue(value);\n }\n getProps().onInputChange?.(value);\n };\n\n // Track last committed input value\n const [lastValue, setLastValue] = createSignal(inputValue());\n\n const selectedKey: Accessor<Key | null> = () => {\n return isSelectionControlled() ? (getProps().selectedKey ?? null) : internalSelectedKey();\n };\n\n const setSelectedKey = (key: Key | null) => {\n if (!isSelectionControlled()) {\n setInternalSelectedKey(key);\n }\n getProps().onSelectionChange?.(key);\n };\n\n // ---- Overlay State ----\n const overlayState = createOverlayTriggerState({\n get isOpen() {\n return getProps().isOpen;\n },\n get defaultOpen() {\n return getProps().defaultOpen;\n },\n onOpenChange(isOpen: boolean) {\n getProps().onOpenChange?.(isOpen, isOpen ? menuOpenTrigger : undefined);\n },\n });\n\n // ---- List State (unfiltered collection) ----\n const listState = createListState<T>({\n get items() {\n // Use items or defaultItems\n return getProps().items ?? getProps().defaultItems ?? [];\n },\n get getKey() {\n return getProps().getKey;\n },\n get getTextValue() {\n return getProps().getTextValue;\n },\n get getDisabled() {\n return getProps().getDisabled;\n },\n get disabledKeys() {\n return getProps().disabledKeys;\n },\n selectionMode: 'single',\n disallowEmptySelection: false,\n get selectedKeys() {\n const key = selectedKey();\n return key != null ? [key] : [];\n },\n onSelectionChange(keys) {\n if (keys === 'all') return;\n const key = keys.size > 0 ? Array.from(keys)[0] : null;\n\n // If same key selected, just reset input and close\n if (key === selectedKey()) {\n resetInputValue();\n closeMenu();\n return;\n }\n\n setSelectedKey(key);\n },\n });\n\n // ---- Filtered Collection ----\n const originalCollection = listState.collection;\n\n const filteredCollection = createMemo<Collection<T>>(() => {\n const collection = originalCollection();\n const input = inputValue();\n const filter = getProps().defaultFilter;\n\n // If no filter function provided, return original collection\n if (!filter) {\n return collection;\n }\n\n // Filter the collection based on input value\n return filterCollection(collection, input, filter);\n });\n\n // The displayed collection depends on showAllItems flag\n // Always show filtered collection (or all items if showAllItems is true)\n const displayedCollection = createMemo<Collection<T>>(() => {\n return showAllItems() ? originalCollection() : filteredCollection();\n });\n\n // ---- Selected Item ----\n const selectedItem: Accessor<CollectionNode<T> | null> = () => {\n const key = selectedKey();\n if (key == null) return null;\n return originalCollection().getItem(key);\n };\n\n // Initialize input value from selected item if not already set\n // This runs once on creation\n if (!inputInitialized && !isInputControlled()) {\n const defaultKey = getProps().defaultSelectedKey;\n if (defaultKey != null && !getProps().defaultInputValue) {\n // Get the text value from the collection for the default selected key\n const item = originalCollection().getItem(defaultKey);\n if (item) {\n setInternalInputValue(item.textValue);\n setLastValue(item.textValue);\n }\n }\n inputInitialized = true;\n }\n\n // ---- Helper Functions ----\n const resetInputValue = () => {\n const item = selectedItem();\n const textValue = item?.textValue ?? '';\n setLastValue(textValue);\n setInputValue(textValue);\n };\n\n const closeMenu = () => {\n if (overlayState.isOpen()) {\n overlayState.close();\n }\n };\n\n // ---- Open/Toggle Logic ----\n const open = (strategy: FocusStrategy | null = null, trigger?: MenuTriggerAction) => {\n const displayAll = trigger === 'manual' || (trigger === 'focus' && menuTrigger() === 'focus');\n\n // Check if we should open\n const filtered = filteredCollection();\n const original = originalCollection();\n const canOpen = allowsEmptyCollection() ||\n filtered.size > 0 ||\n (displayAll && original.size > 0);\n\n if (!canOpen) return;\n\n if (displayAll && !overlayState.isOpen()) {\n setShowAllItems(true);\n }\n\n menuOpenTrigger = trigger ?? 'focus';\n setFocusStrategy(strategy);\n overlayState.open();\n };\n\n const toggle = (strategy: FocusStrategy | null = null, trigger?: MenuTriggerAction) => {\n const displayAll = trigger === 'manual' || (trigger === 'focus' && menuTrigger() === 'focus');\n\n // Check if we can open (if closed)\n const filtered = filteredCollection();\n const original = originalCollection();\n const canOpen = allowsEmptyCollection() ||\n filtered.size > 0 ||\n (displayAll && original.size > 0);\n\n if (!canOpen && !overlayState.isOpen()) return;\n\n if (displayAll && !overlayState.isOpen()) {\n setShowAllItems(true);\n }\n\n if (!overlayState.isOpen()) {\n menuOpenTrigger = trigger ?? 'focus';\n }\n\n setFocusStrategy(strategy);\n overlayState.toggle();\n };\n\n // ---- Commit/Revert Logic ----\n const commitCustomValue = () => {\n setSelectedKey(null);\n closeMenu();\n };\n\n const commitSelection = () => {\n // If both are controlled, just call onSelectionChange\n if (isSelectionControlled() && isInputControlled()) {\n getProps().onSelectionChange?.(selectedKey());\n const item = selectedItem();\n setLastValue(item?.textValue ?? '');\n closeMenu();\n } else {\n // Reset input to selected item's text\n resetInputValue();\n closeMenu();\n }\n };\n\n const commitValue = () => {\n if (allowsCustomValue()) {\n const item = selectedItem();\n const itemText = item?.textValue ?? '';\n if (inputValue() === itemText) {\n commitSelection();\n } else {\n commitCustomValue();\n }\n } else {\n commitSelection();\n }\n };\n\n const commit = () => {\n const focusedKey = listState.focusedKey();\n\n if (overlayState.isOpen() && focusedKey != null) {\n // If focused key is already selected, just commit\n if (selectedKey() === focusedKey) {\n commitSelection();\n } else {\n // Select the focused item\n setSelectedKey(focusedKey);\n }\n } else {\n commitValue();\n }\n };\n\n const revert = () => {\n if (allowsCustomValue() && selectedKey() == null) {\n commitCustomValue();\n } else {\n commitSelection();\n }\n };\n\n // ---- Focus Handling ----\n const [isFocused, setIsFocused] = createSignal(false);\n let valueOnFocus = '';\n\n const setFocused = (focused: boolean) => {\n if (focused) {\n valueOnFocus = inputValue();\n if (menuTrigger() === 'focus' && !getProps().isReadOnly) {\n open(null, 'focus');\n }\n } else {\n if (shouldCloseOnBlur()) {\n commitValue();\n }\n }\n setIsFocused(focused);\n };\n\n // ---- Effects for Auto Open/Close ----\n createEffect(() => {\n const input = inputValue();\n const filtered = filteredCollection();\n const isOpen = overlayState.isOpen();\n const last = lastValue();\n const focused = isFocused();\n\n // Auto-open when typing\n if (\n focused &&\n (filtered.size > 0 || allowsEmptyCollection()) &&\n !isOpen &&\n input !== last &&\n menuTrigger() !== 'manual'\n ) {\n open(null, 'input');\n }\n\n // Auto-close when empty (unless showing all)\n if (\n !showAllItems() &&\n !allowsEmptyCollection() &&\n isOpen &&\n filtered.size === 0\n ) {\n closeMenu();\n }\n\n // Clear focused key when input changes\n if (input !== last) {\n listState.setFocusedKey(null);\n setShowAllItems(false);\n\n // Clear selection when input is cleared (if not fully controlled)\n if (input === '' && (!isInputControlled() || !isSelectionControlled())) {\n setSelectedKey(null);\n }\n\n setLastValue(input);\n }\n });\n\n // Update input when selection changes\n createEffect(() => {\n const key = selectedKey();\n const item = key != null ? originalCollection().getItem(key) : null;\n const textValue = item?.textValue ?? '';\n\n // Only update if selection changed and not fully controlled\n if (!isInputControlled() || !isSelectionControlled()) {\n if (key != null && textValue !== inputValue()) {\n setInputValue(textValue);\n setLastValue(textValue);\n }\n }\n });\n\n // Close when selection changes\n createEffect((prevKey: Key | null | undefined) => {\n const key = selectedKey();\n if (key != null && key !== prevKey) {\n closeMenu();\n }\n return key;\n }, undefined);\n\n // ---- Selection Methods for ListState compatibility ----\n // These methods allow createOption to work with ComboBoxState\n const select = (key: Key) => {\n setSelectedKey(key);\n closeMenu();\n };\n\n const selectionMode: Accessor<'single'> = () => 'single';\n const isSelected = (key: Key) => selectedKey() === key;\n\n // ---- Return State ----\n return {\n collection: displayedCollection,\n isOpen: overlayState.isOpen,\n open,\n close: commitValue,\n toggle,\n selectedKey,\n defaultSelectedKey: getProps().defaultSelectedKey ?? null,\n selectedItem,\n setSelectedKey,\n inputValue,\n defaultInputValue: getProps().defaultInputValue ?? '',\n setInputValue,\n focusedKey: listState.focusedKey,\n setFocusedKey: listState.setFocusedKey,\n isFocused,\n setFocused,\n focusStrategy,\n commit,\n revert,\n // Selection state methods for ListState compatibility\n select,\n selectionMode,\n isSelected,\n isKeyDisabled: (key: Key) => listState.isDisabled(key),\n get isDisabled() {\n return getProps().isDisabled ?? false;\n },\n get isReadOnly() {\n return getProps().isReadOnly ?? false;\n },\n get isRequired() {\n return getProps().isRequired ?? false;\n },\n };\n}\n\n// ============================================\n// COLLECTION FILTERING\n// ============================================\n\n/**\n * Filter a collection based on input value.\n */\nfunction filterCollection<T>(\n collection: Collection<T>,\n inputValue: string,\n filter: FilterFn\n): Collection<T> {\n if (!inputValue) {\n return collection;\n }\n\n const filteredItems: CollectionNode<T>[] = [];\n\n for (const item of collection) {\n if (item.type === 'section') {\n // Filter section children\n const filteredChildren: CollectionNode<T>[] = [];\n if (item.childNodes) {\n for (const child of item.childNodes) {\n if (child.type === 'item' && filter(child.textValue, inputValue)) {\n filteredChildren.push(child);\n }\n }\n }\n // Only include section if it has matching children\n if (filteredChildren.length > 0) {\n filteredItems.push({\n ...item,\n childNodes: filteredChildren,\n });\n }\n } else if (item.type === 'item') {\n if (filter(item.textValue, inputValue)) {\n filteredItems.push(item);\n }\n }\n }\n\n // Create a new collection from filtered items\n return createFilteredCollection(filteredItems, collection);\n}\n\n/**\n * Create a filtered collection wrapper.\n */\nfunction createFilteredCollection<T>(\n items: CollectionNode<T>[],\n original: Collection<T>\n): Collection<T> {\n const itemMap = new Map<Key, CollectionNode<T>>();\n\n for (const item of items) {\n itemMap.set(item.key, item);\n if (item.childNodes) {\n for (const child of item.childNodes) {\n itemMap.set(child.key, child);\n }\n }\n }\n\n return {\n get size() {\n let count = 0;\n for (const item of items) {\n if (item.type === 'item') {\n count++;\n } else if (item.childNodes) {\n count += Array.from(item.childNodes).filter(c => c.type === 'item').length;\n }\n }\n return count;\n },\n getItem(key: Key) {\n return itemMap.get(key) ?? null;\n },\n getKeys() {\n return itemMap.keys();\n },\n getFirstKey() {\n for (const item of items) {\n if (item.type === 'item') return item.key;\n if (item.childNodes) {\n for (const child of item.childNodes) {\n if (child.type === 'item') return child.key;\n }\n }\n }\n return null;\n },\n getLastKey() {\n for (let i = items.length - 1; i >= 0; i--) {\n const item = items[i];\n if (item.type === 'item') return item.key;\n if (item.childNodes) {\n const children = Array.from(item.childNodes);\n for (let j = children.length - 1; j >= 0; j--) {\n if (children[j].type === 'item') return children[j].key;\n }\n }\n }\n return null;\n },\n getKeyBefore(key: Key) {\n return original.getKeyBefore(key);\n },\n getKeyAfter(key: Key) {\n return original.getKeyAfter(key);\n },\n at(index: number) {\n // Flatten items for indexing\n let currentIndex = 0;\n for (const item of items) {\n if (item.type === 'item') {\n if (currentIndex === index) return item;\n currentIndex++;\n } else if (item.childNodes) {\n for (const child of item.childNodes) {\n if (child.type === 'item') {\n if (currentIndex === index) return child;\n currentIndex++;\n }\n }\n }\n }\n return null;\n },\n getChildren(key: Key) {\n const item = itemMap.get(key);\n return item?.childNodes ?? [];\n },\n getTextValue(key: Key) {\n const item = itemMap.get(key);\n return item?.textValue ?? '';\n },\n [Symbol.iterator]() {\n return items[Symbol.iterator]();\n },\n };\n}\n","/**\n * State management for tab components.\n * Based on @react-stately/tabs.\n */\n\nimport { createSignal, type Accessor } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils';\nimport { ListCollection } from '../collections/ListCollection';\nimport type {\n Collection,\n CollectionNode,\n Key,\n FocusStrategy,\n} from '../collections/types';\n\nexport type KeyboardActivation = 'automatic' | 'manual';\nexport type TabOrientation = 'horizontal' | 'vertical';\n\nexport interface TabListStateProps<T = unknown> {\n /** The items in the tab list. */\n items?: T[];\n /** Function to get a key from an item. */\n getKey?: (item: T) => Key;\n /** Function to get text value from an item. */\n getTextValue?: (item: T) => string;\n /** Function to check if an item is disabled. */\n getDisabled?: (item: T) => boolean;\n /** Keys of disabled tabs. */\n disabledKeys?: Iterable<Key>;\n /** The currently selected tab key (controlled). */\n selectedKey?: Key | null;\n /** The default selected tab key (uncontrolled). */\n defaultSelectedKey?: Key;\n /** Handler for tab selection changes. */\n onSelectionChange?: (key: Key) => void;\n /** Whether the entire tab list is disabled. */\n isDisabled?: boolean;\n /** Whether tabs are activated automatically on focus or manually. */\n keyboardActivation?: KeyboardActivation;\n /** The orientation of the tab list. */\n orientation?: TabOrientation;\n}\n\nexport interface TabListState<T = unknown> {\n /** The collection of tabs. */\n readonly collection: Accessor<Collection<T>>;\n /** The currently selected tab key. */\n readonly selectedKey: Accessor<Key | null>;\n /** Set the selected tab key. */\n setSelectedKey(key: Key): void;\n /** The currently selected tab item. */\n readonly selectedItem: Accessor<CollectionNode<T> | null>;\n /** Whether the tab list is disabled. */\n readonly isDisabled: Accessor<boolean>;\n /** The keyboard activation mode. */\n readonly keyboardActivation: Accessor<KeyboardActivation>;\n /** The orientation of the tab list. */\n readonly orientation: Accessor<TabOrientation>;\n /** Whether a tab key is disabled. */\n isKeyDisabled(key: Key): boolean;\n /** The set of disabled keys. */\n readonly disabledKeys: Accessor<Set<Key>>;\n /** Whether the collection is focused. */\n readonly isFocused: Accessor<boolean>;\n /** Set the focused state. */\n setFocused(isFocused: boolean): void;\n /** The currently focused tab key. */\n readonly focusedKey: Accessor<Key | null>;\n /** Set the focused tab key. */\n setFocusedKey(key: Key | null, childStrategy?: FocusStrategy): void;\n /** The child focus strategy. */\n readonly childFocusStrategy: Accessor<FocusStrategy | null>;\n}\n\n/**\n * Creates state for a tab list component.\n */\nexport function createTabListState<T = unknown>(\n props: MaybeAccessor<TabListStateProps<T>>\n): TabListState<T> {\n const getProps = () => access(props);\n\n // Build collection from items\n const collection: Accessor<Collection<T>> = () => {\n const p = getProps();\n const items = p.items ?? [];\n\n const nodes: CollectionNode<T>[] = items.map((item, index) => {\n const key = p.getKey?.(item) ?? (item as any).key ?? (item as any).id ?? index;\n const textValue =\n p.getTextValue?.(item) ?? (item as any).textValue ?? (item as any).label ?? String(item);\n const isDisabled = p.getDisabled?.(item) ?? (item as any).isDisabled ?? false;\n\n return {\n type: 'item' as const,\n key,\n value: item,\n textValue,\n rendered: null as any,\n level: 0,\n index,\n parentKey: null,\n hasChildNodes: false,\n childNodes: [],\n isDisabled,\n };\n });\n\n return new ListCollection(nodes);\n };\n\n // Compute disabled keys\n const disabledKeys: Accessor<Set<Key>> = () => {\n const p = getProps();\n const result = new Set<Key>(p.disabledKeys ?? []);\n\n const coll = collection();\n for (const node of coll) {\n if (node.isDisabled) {\n result.add(node.key);\n }\n }\n\n return result;\n };\n\n // Check if a key is disabled\n const isKeyDisabled = (key: Key): boolean => {\n const p = getProps();\n if (p.isDisabled) return true;\n return disabledKeys().has(key);\n };\n\n // Find the first non-disabled key\n const findFirstNonDisabledKey = (): Key | null => {\n const coll = collection();\n for (const node of coll) {\n if (!isKeyDisabled(node.key)) {\n return node.key;\n }\n }\n return null;\n };\n\n // Get initial selected key\n const getInitialSelectedKey = (): Key | null => {\n const p = getProps();\n\n // If controlled, use that value\n if (p.selectedKey !== undefined) {\n return p.selectedKey;\n }\n\n // If default provided and not disabled, use it\n if (p.defaultSelectedKey !== undefined && !isKeyDisabled(p.defaultSelectedKey)) {\n return p.defaultSelectedKey;\n }\n\n // Otherwise, select first non-disabled\n return findFirstNonDisabledKey();\n };\n\n // Selection state\n const [selectedKeyInternal, setSelectedKeyInternal] = createSignal<Key | null>(\n getInitialSelectedKey()\n );\n\n // Compute actual selected key (controlled vs uncontrolled)\n const selectedKey: Accessor<Key | null> = () => {\n const p = getProps();\n if (p.selectedKey !== undefined) {\n return p.selectedKey;\n }\n return selectedKeyInternal();\n };\n\n const setSelectedKey = (key: Key) => {\n // Don't select disabled keys\n if (isKeyDisabled(key)) return;\n\n const p = getProps();\n // For uncontrolled mode, update internal state\n if (p.selectedKey === undefined) {\n setSelectedKeyInternal(key);\n }\n\n // Always call onChange\n p.onSelectionChange?.(key);\n };\n\n // Get selected item\n const selectedItem: Accessor<CollectionNode<T> | null> = () => {\n const key = selectedKey();\n if (key === null) return null;\n return collection().getItem(key);\n };\n\n // Is disabled accessor\n const isDisabled: Accessor<boolean> = () => getProps().isDisabled ?? false;\n\n // Keyboard activation accessor\n const keyboardActivation: Accessor<KeyboardActivation> = () =>\n getProps().keyboardActivation ?? 'automatic';\n\n // Orientation accessor\n const orientation: Accessor<TabOrientation> = () =>\n getProps().orientation ?? 'horizontal';\n\n // Focus state\n const [isFocused, setIsFocused] = createSignal(false);\n const [focusedKey, setFocusedKeyInternal] = createSignal<Key | null>(null);\n const [childFocusStrategy, setChildFocusStrategy] = createSignal<FocusStrategy | null>(null);\n\n const setFocusedKey = (key: Key | null, childStrategy?: FocusStrategy) => {\n setFocusedKeyInternal(key);\n setChildFocusStrategy(childStrategy ?? null);\n\n // In automatic mode, selecting follows focus\n if (keyboardActivation() === 'automatic' && key !== null && !isKeyDisabled(key)) {\n setSelectedKey(key);\n }\n };\n\n return {\n collection,\n selectedKey,\n setSelectedKey,\n selectedItem,\n isDisabled,\n keyboardActivation,\n orientation,\n isKeyDisabled,\n disabledKeys,\n isFocused,\n setFocused: setIsFocused,\n focusedKey,\n setFocusedKey,\n childFocusStrategy,\n };\n}\n","/**\n * State management for NumberField.\n * Based on @react-stately/numberfield useNumberFieldState.\n */\n\nimport { createSignal, createMemo, type Accessor } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils';\n\nexport interface NumberFieldStateProps {\n /** The current value (controlled). */\n value?: number;\n /** The default value (uncontrolled). */\n defaultValue?: number;\n /** Handler called when the value changes. */\n onChange?: (value: number) => void;\n /** The minimum value. */\n minValue?: number;\n /** The maximum value. */\n maxValue?: number;\n /** The step value for increment/decrement. */\n step?: number;\n /** Whether the field is disabled. */\n isDisabled?: boolean;\n /** Whether the field is read-only. */\n isReadOnly?: boolean;\n /** The locale for number formatting. */\n locale?: string;\n /** Number format options. */\n formatOptions?: Intl.NumberFormatOptions;\n}\n\nexport interface NumberFieldState {\n /** The current input value as a string. */\n inputValue: Accessor<string>;\n /** The current numeric value. */\n numberValue: Accessor<number>;\n /** Whether the value can be incremented. */\n canIncrement: Accessor<boolean>;\n /** Whether the value can be decremented. */\n canDecrement: Accessor<boolean>;\n /** Whether the field is disabled. */\n isDisabled: Accessor<boolean>;\n /** Whether the field is read-only. */\n isReadOnly: Accessor<boolean>;\n /** The minimum value. */\n minValue: Accessor<number | undefined>;\n /** The maximum value. */\n maxValue: Accessor<number | undefined>;\n /** Set the input value. */\n setInputValue: (value: string) => void;\n /** Validate a partial input value. */\n validate: (value: string) => boolean;\n /** Commit the current input value. */\n commit: () => void;\n /** Increment the value by step. */\n increment: () => void;\n /** Decrement the value by step. */\n decrement: () => void;\n /** Set to maximum value. */\n incrementToMax: () => void;\n /** Set to minimum value. */\n decrementToMin: () => void;\n}\n\n/**\n * Handles decimal operations to avoid floating point errors.\n */\nfunction handleDecimalOperation(\n operator: '+' | '-',\n value1: number,\n value2: number\n): number {\n // Find the number of decimal places\n const getDecimals = (n: number) => {\n const str = String(n);\n const idx = str.indexOf('.');\n return idx === -1 ? 0 : str.length - idx - 1;\n };\n\n const decimals = Math.max(getDecimals(value1), getDecimals(value2));\n const multiplier = Math.pow(10, decimals);\n\n const int1 = Math.round(value1 * multiplier);\n const int2 = Math.round(value2 * multiplier);\n\n const result = operator === '+' ? int1 + int2 : int1 - int2;\n return result / multiplier;\n}\n\n/**\n * Clamps a value between min and max.\n */\nfunction clamp(value: number, min?: number, max?: number): number {\n let result = value;\n if (min != null && result < min) result = min;\n if (max != null && result > max) result = max;\n return result;\n}\n\n/**\n * Snaps a value to the nearest step.\n */\nfunction snapToStep(value: number, step: number, min?: number): number {\n const base = min ?? 0;\n const diff = value - base;\n const steps = Math.round(diff / step);\n return handleDecimalOperation('+', base, steps * step);\n}\n\n/**\n * Creates state for a number field.\n */\nexport function createNumberFieldState(\n props: MaybeAccessor<NumberFieldStateProps>\n): NumberFieldState {\n const getProps = () => access(props);\n\n // Get locale and formatter\n const locale = () => getProps().locale ?? 'en-US';\n const formatOptions = () => getProps().formatOptions ?? {};\n\n // Create number formatter\n const formatter = createMemo(() => {\n return new Intl.NumberFormat(locale(), formatOptions());\n });\n\n // Create number parser (simplified - real implementation would be more robust)\n const parseNumber = (value: string): number => {\n if (!value || value === '' || value === '-') return NaN;\n\n // Handle locale-specific decimal separators\n const opts = formatOptions();\n const testNumber = formatter().format(1.1);\n const decimalSeparator = testNumber.charAt(1);\n\n // Normalize the input\n let normalized = value;\n if (decimalSeparator !== '.') {\n normalized = normalized.replace(decimalSeparator, '.');\n }\n\n // Remove grouping separators and currency symbols\n normalized = normalized.replace(/[^\\d.\\-]/g, '');\n\n const parsed = parseFloat(normalized);\n return parsed;\n };\n\n // Format a number to string\n const formatNumber = (value: number): string => {\n if (isNaN(value)) return '';\n return formatter().format(value);\n };\n\n // Determine step value\n const step = createMemo(() => {\n const p = getProps();\n if (p.step != null) return p.step;\n // Default step for percent is 0.01\n if (p.formatOptions?.style === 'percent') return 0.01;\n return 1;\n });\n\n // Internal signals\n const [inputValue, setInputValueInternal] = createSignal<string>('');\n const [numberValue, setNumberValue] = createSignal<number>(NaN);\n\n // Initialize from props\n const initValue = () => {\n const p = getProps();\n const initial = p.value ?? p.defaultValue;\n if (initial != null) {\n setNumberValue(initial);\n setInputValueInternal(formatNumber(initial));\n }\n };\n\n // Call init on first access\n let initialized = false;\n const ensureInitialized = () => {\n if (!initialized) {\n initialized = true;\n initValue();\n }\n };\n\n // Controlled mode: sync with props.value\n const actualNumberValue = createMemo(() => {\n ensureInitialized();\n const p = getProps();\n if (p.value !== undefined) {\n return p.value;\n }\n return numberValue();\n });\n\n // Validate partial input\n const validate = (value: string): boolean => {\n if (value === '' || value === '-') return true;\n\n // Allow partial decimal input like \"1.\"\n const opts = formatOptions();\n const testNumber = formatter().format(1.1);\n const decimalSeparator = testNumber.charAt(1);\n\n // Check if it's a valid partial number\n const pattern = new RegExp(\n `^-?\\\\d*${decimalSeparator === '.' ? '\\\\.' : decimalSeparator}?\\\\d*$`\n );\n return pattern.test(value);\n };\n\n // Set input value with validation\n const setInputValue = (value: string) => {\n ensureInitialized();\n setInputValueInternal(value);\n };\n\n // Commit the current input value\n const commit = () => {\n ensureInitialized();\n const p = getProps();\n const input = inputValue();\n\n if (input === '' || input === '-') {\n // Clear value\n setNumberValue(NaN);\n setInputValueInternal('');\n return;\n }\n\n let parsed = parseNumber(input);\n\n if (isNaN(parsed)) {\n // Invalid input - revert to current value\n setInputValueInternal(formatNumber(actualNumberValue()));\n return;\n }\n\n // Clamp and snap\n parsed = clamp(parsed, p.minValue, p.maxValue);\n parsed = snapToStep(parsed, step(), p.minValue);\n\n // Update state\n setNumberValue(parsed);\n setInputValueInternal(formatNumber(parsed));\n\n // Notify change\n if (p.value === undefined) {\n p.onChange?.(parsed);\n } else {\n p.onChange?.(parsed);\n }\n };\n\n // Check if can increment\n const canIncrement = createMemo(() => {\n ensureInitialized();\n const p = getProps();\n if (p.isDisabled || p.isReadOnly) return false;\n\n const current = actualNumberValue();\n if (isNaN(current)) return true; // Can start from min\n\n if (p.maxValue == null) return true;\n return handleDecimalOperation('+', current, step()) <= p.maxValue;\n });\n\n // Check if can decrement\n const canDecrement = createMemo(() => {\n ensureInitialized();\n const p = getProps();\n if (p.isDisabled || p.isReadOnly) return false;\n\n const current = actualNumberValue();\n if (isNaN(current)) return true; // Can start from max\n\n if (p.minValue == null) return true;\n return handleDecimalOperation('-', current, step()) >= p.minValue;\n });\n\n // Increment by step\n const increment = () => {\n ensureInitialized();\n const p = getProps();\n if (p.isDisabled || p.isReadOnly) return;\n\n let current = actualNumberValue();\n\n if (isNaN(current)) {\n // Start from min or 0\n current = p.minValue ?? 0;\n } else {\n // Snap and increment\n current = snapToStep(current, step(), p.minValue);\n current = handleDecimalOperation('+', current, step());\n }\n\n // Clamp\n current = clamp(current, p.minValue, p.maxValue);\n\n // Update\n setNumberValue(current);\n setInputValueInternal(formatNumber(current));\n p.onChange?.(current);\n };\n\n // Decrement by step\n const decrement = () => {\n ensureInitialized();\n const p = getProps();\n if (p.isDisabled || p.isReadOnly) return;\n\n let current = actualNumberValue();\n\n if (isNaN(current)) {\n // Start from max or 0\n current = p.maxValue ?? 0;\n } else {\n // Snap and decrement\n current = snapToStep(current, step(), p.minValue);\n current = handleDecimalOperation('-', current, step());\n }\n\n // Clamp\n current = clamp(current, p.minValue, p.maxValue);\n\n // Update\n setNumberValue(current);\n setInputValueInternal(formatNumber(current));\n p.onChange?.(current);\n };\n\n // Set to max\n const incrementToMax = () => {\n ensureInitialized();\n const p = getProps();\n if (p.isDisabled || p.isReadOnly) return;\n\n if (p.maxValue == null) return;\n\n const snapped = snapToStep(p.maxValue, step(), p.minValue);\n setNumberValue(snapped);\n setInputValueInternal(formatNumber(snapped));\n p.onChange?.(snapped);\n };\n\n // Set to min\n const decrementToMin = () => {\n ensureInitialized();\n const p = getProps();\n if (p.isDisabled || p.isReadOnly) return;\n\n if (p.minValue == null) return;\n\n setNumberValue(p.minValue);\n setInputValueInternal(formatNumber(p.minValue));\n p.onChange?.(p.minValue);\n };\n\n return {\n get inputValue() {\n ensureInitialized();\n return inputValue;\n },\n get numberValue() {\n return actualNumberValue;\n },\n canIncrement,\n canDecrement,\n isDisabled: () => getProps().isDisabled ?? false,\n isReadOnly: () => getProps().isReadOnly ?? false,\n minValue: () => getProps().minValue,\n maxValue: () => getProps().maxValue,\n setInputValue,\n validate,\n commit,\n increment,\n decrement,\n incrementToMax,\n decrementToMin,\n };\n}\n","/**\n * Creates state for a search field component.\n * Based on @react-stately/searchfield useSearchFieldState.\n */\n\nimport { type Accessor, createSignal, createMemo } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils';\n\nexport interface SearchFieldStateProps {\n /** The current value (controlled). */\n value?: string;\n /** The default value (uncontrolled). */\n defaultValue?: string;\n /** Handler that is called when the value changes. */\n onChange?: (value: string) => void;\n}\n\nexport interface SearchFieldState {\n /** The current value of the search field. */\n value: Accessor<string>;\n /** Sets the value of the search field. */\n setValue: (value: string) => void;\n}\n\n/**\n * Provides state management for a search field.\n */\nexport function createSearchFieldState(\n props: MaybeAccessor<SearchFieldStateProps>\n): SearchFieldState {\n const getProps = () => access(props);\n\n // Controlled vs uncontrolled\n const isControlled = () => getProps().value !== undefined;\n\n // Internal signal for uncontrolled mode\n const [internalValue, setInternalValue] = createSignal(\n getProps().defaultValue ?? ''\n );\n\n // Current value accessor\n const value = createMemo(() => {\n const p = getProps();\n return isControlled() ? (p.value ?? '') : internalValue();\n });\n\n // Set value function\n const setValue = (newValue: string) => {\n const p = getProps();\n\n if (!isControlled()) {\n setInternalValue(newValue);\n }\n\n p.onChange?.(newValue);\n };\n\n return {\n value,\n setValue,\n };\n}\n","/**\n * Creates state for a slider component.\n * Based on @react-stately/slider useSliderState.\n */\n\nimport { type Accessor, createSignal, createMemo } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils';\n\nexport type SliderOrientation = 'horizontal' | 'vertical';\n\nexport interface SliderStateProps {\n /** The current value (controlled). */\n value?: number;\n /** The default value (uncontrolled). */\n defaultValue?: number;\n /** Handler called when the value changes. */\n onChange?: (value: number) => void;\n /** Handler called when the user stops dragging. */\n onChangeEnd?: (value: number) => void;\n /** The minimum value. */\n minValue?: number;\n /** The maximum value. */\n maxValue?: number;\n /** The step value. */\n step?: number;\n /** The orientation of the slider. */\n orientation?: SliderOrientation;\n /** Whether the slider is disabled. */\n isDisabled?: boolean;\n /** The locale for number formatting. */\n locale?: string;\n /** Number format options. */\n formatOptions?: Intl.NumberFormatOptions;\n}\n\nexport interface SliderState {\n /** The current value. */\n value: Accessor<number>;\n /** Sets the value. */\n setValue: (value: number) => void;\n /** Sets the value by percent (0-1). */\n setValuePercent: (percent: number) => void;\n /** Gets the value as a percent (0-1). */\n getValuePercent: Accessor<number>;\n /** Gets the formatted value string. */\n getFormattedValue: Accessor<string>;\n /** Whether the thumb is being dragged. */\n isDragging: Accessor<boolean>;\n /** Sets the dragging state. */\n setDragging: (dragging: boolean) => void;\n /** Whether the slider is focused. */\n isFocused: Accessor<boolean>;\n /** Sets the focused state. */\n setFocused: (focused: boolean) => void;\n /** Increments the value by step. */\n increment: (stepMultiplier?: number) => void;\n /** Decrements the value by step. */\n decrement: (stepMultiplier?: number) => void;\n /** The minimum value. */\n minValue: number;\n /** The maximum value. */\n maxValue: number;\n /** The step value. */\n step: number;\n /** The page step (larger step for Page Up/Down). */\n pageStep: number;\n /** The orientation. */\n orientation: SliderOrientation;\n /** Whether the slider is disabled. */\n isDisabled: boolean;\n}\n\nconst DEFAULT_MIN = 0;\nconst DEFAULT_MAX = 100;\nconst DEFAULT_STEP = 1;\n\n/**\n * Clamps a value between min and max.\n */\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Snaps a value to the nearest step.\n */\nfunction snapToStep(value: number, min: number, max: number, step: number): number {\n const snapped = Math.round((value - min) / step) * step + min;\n // Handle floating point precision issues\n const decimalPlaces = (step.toString().split('.')[1] || '').length;\n const rounded = parseFloat(snapped.toFixed(decimalPlaces));\n return clamp(rounded, min, max);\n}\n\n/**\n * Provides state management for a slider component.\n */\nexport function createSliderState(\n props: MaybeAccessor<SliderStateProps>\n): SliderState {\n const getProps = () => access(props);\n\n // Get static values with defaults\n const minValue = getProps().minValue ?? DEFAULT_MIN;\n const maxValue = getProps().maxValue ?? DEFAULT_MAX;\n const step = getProps().step ?? DEFAULT_STEP;\n const orientation = getProps().orientation ?? 'horizontal';\n const isDisabled = getProps().isDisabled ?? false;\n\n // Calculate page step (10% of range, snapped to step)\n const pageStep = Math.max(step, snapToStep((maxValue - minValue) / 10, 0, maxValue - minValue, step));\n\n // Controlled vs uncontrolled\n const isControlled = () => getProps().value !== undefined;\n\n // Internal signal for uncontrolled mode\n const [internalValue, setInternalValue] = createSignal(\n snapToStep(getProps().defaultValue ?? minValue, minValue, maxValue, step)\n );\n\n // Dragging and focus state\n const [isDragging, setIsDragging] = createSignal(false);\n const [isFocused, setIsFocused] = createSignal(false);\n\n // Current value accessor\n const value = createMemo(() => {\n const p = getProps();\n const rawValue = isControlled() ? (p.value ?? minValue) : internalValue();\n return snapToStep(rawValue, minValue, maxValue, step);\n });\n\n // Value as percent (0-1)\n const getValuePercent = createMemo(() => {\n return (value() - minValue) / (maxValue - minValue);\n });\n\n // Formatted value\n const getFormattedValue = createMemo(() => {\n const p = getProps();\n const formatter = new Intl.NumberFormat(p.locale, p.formatOptions);\n return formatter.format(value());\n });\n\n // Set value function\n const setValue = (newValue: number) => {\n if (isDisabled) return;\n\n const p = getProps();\n const snappedValue = snapToStep(newValue, minValue, maxValue, step);\n\n if (!isControlled()) {\n setInternalValue(snappedValue);\n }\n\n p.onChange?.(snappedValue);\n };\n\n // Set value by percent\n const setValuePercent = (percent: number) => {\n const clampedPercent = clamp(percent, 0, 1);\n const newValue = clampedPercent * (maxValue - minValue) + minValue;\n setValue(newValue);\n };\n\n // Dragging state management\n const setDragging = (dragging: boolean) => {\n const wasDragging = isDragging();\n setIsDragging(dragging);\n\n // Call onChangeEnd when dragging stops\n if (wasDragging && !dragging) {\n getProps().onChangeEnd?.(value());\n }\n };\n\n // Increment/decrement\n const increment = (stepMultiplier = 1) => {\n if (isDisabled) return;\n setValue(value() + step * stepMultiplier);\n };\n\n const decrement = (stepMultiplier = 1) => {\n if (isDisabled) return;\n setValue(value() - step * stepMultiplier);\n };\n\n // Set focused state\n const setFocused = (focused: boolean) => {\n setIsFocused(focused);\n };\n\n return {\n value,\n setValue,\n setValuePercent,\n getValuePercent,\n getFormattedValue,\n isDragging,\n setDragging,\n isFocused,\n setFocused,\n increment,\n decrement,\n minValue,\n maxValue,\n step,\n pageStep,\n orientation,\n isDisabled,\n };\n}\n","/**\n * Manages state for a tooltip trigger.\n * Based on @react-stately/tooltip useTooltipTriggerState.\n *\n * Tracks whether the tooltip is open, and provides methods to toggle this state.\n * Ensures only one tooltip is open at a time and controls the delay for showing a tooltip.\n */\n\nimport { createSignal, onCleanup, type Accessor } from 'solid-js';\nimport { createOverlayTriggerState, type OverlayTriggerProps } from '../overlays';\nimport { isServer } from '../ssr';\n\n// Default delays (in ms)\nconst TOOLTIP_DELAY = 1500;\nconst TOOLTIP_COOLDOWN = 500;\n\nexport interface TooltipTriggerProps extends OverlayTriggerProps {\n /** The delay time in milliseconds for the tooltip to show up. */\n delay?: number;\n /** The delay time in milliseconds for the tooltip to close. */\n closeDelay?: number;\n}\n\nexport interface TooltipTriggerState {\n /** Whether the tooltip is currently showing. */\n readonly isOpen: Accessor<boolean>;\n /**\n * Shows the tooltip. By default, the tooltip becomes visible after a delay\n * depending on a global warmup timer. The `immediate` option shows the\n * tooltip immediately instead.\n */\n open(immediate?: boolean): void;\n /** Hides the tooltip. */\n close(immediate?: boolean): void;\n}\n\n// Global state for coordinating tooltips\nlet tooltips: Record<string, (immediate?: boolean) => void> = {};\nlet tooltipId = 0;\nlet globalWarmedUp = false;\nlet globalWarmUpTimeout: ReturnType<typeof setTimeout> | null = null;\nlet globalCooldownTimeout: ReturnType<typeof setTimeout> | null = null;\n\n/**\n * Resets the global tooltip state. Useful for testing.\n * @internal\n */\nexport function resetTooltipState(): void {\n tooltips = {};\n tooltipId = 0;\n globalWarmedUp = false;\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n globalCooldownTimeout = null;\n }\n}\n\n/**\n * Manages state for a tooltip trigger. Tracks whether the tooltip is open, and provides\n * methods to toggle this state. Ensures only one tooltip is open at a time and controls\n * the delay for showing a tooltip.\n */\nexport function createTooltipTriggerState(\n props: TooltipTriggerProps = {}\n): TooltipTriggerState {\n const delay = () => props.delay ?? TOOLTIP_DELAY;\n const closeDelay = () => props.closeDelay ?? TOOLTIP_COOLDOWN;\n\n const overlayState = createOverlayTriggerState(props);\n const id = `tooltip-${++tooltipId}`;\n\n let closeTimeout: ReturnType<typeof setTimeout> | null = null;\n const [closeCallback, setCloseCallback] = createSignal<() => void>(() => overlayState.close());\n\n const ensureTooltipEntry = () => {\n tooltips[id] = hideTooltip;\n };\n\n const closeOpenTooltips = () => {\n for (const hideTooltipId in tooltips) {\n if (hideTooltipId !== id) {\n tooltips[hideTooltipId](true);\n delete tooltips[hideTooltipId];\n }\n }\n };\n\n const showTooltip = () => {\n if (closeTimeout) {\n clearTimeout(closeTimeout);\n closeTimeout = null;\n }\n closeOpenTooltips();\n ensureTooltipEntry();\n globalWarmedUp = true;\n overlayState.open();\n\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n globalCooldownTimeout = null;\n }\n };\n\n const hideTooltip = (immediate?: boolean) => {\n if (immediate || closeDelay() <= 0) {\n if (closeTimeout) {\n clearTimeout(closeTimeout);\n closeTimeout = null;\n }\n closeCallback()();\n } else if (!closeTimeout) {\n closeTimeout = setTimeout(() => {\n closeTimeout = null;\n closeCallback()();\n }, closeDelay());\n }\n\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n\n if (globalWarmedUp) {\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n }\n globalCooldownTimeout = setTimeout(() => {\n delete tooltips[id];\n globalCooldownTimeout = null;\n globalWarmedUp = false;\n }, Math.max(TOOLTIP_COOLDOWN, closeDelay()));\n }\n };\n\n const warmupTooltip = () => {\n closeOpenTooltips();\n ensureTooltipEntry();\n\n if (!overlayState.isOpen() && !globalWarmUpTimeout && !globalWarmedUp) {\n globalWarmUpTimeout = setTimeout(() => {\n globalWarmUpTimeout = null;\n globalWarmedUp = true;\n showTooltip();\n }, delay());\n } else if (!overlayState.isOpen()) {\n showTooltip();\n }\n };\n\n // Update close callback when overlayState.close changes\n setCloseCallback(() => overlayState.close);\n\n // Cleanup on unmount\n onCleanup(() => {\n if (closeTimeout) {\n clearTimeout(closeTimeout);\n }\n if (tooltips[id]) {\n delete tooltips[id];\n }\n });\n\n return {\n isOpen: overlayState.isOpen,\n open: (immediate?: boolean) => {\n if (isServer) return;\n if (!immediate && delay() > 0 && !closeTimeout) {\n warmupTooltip();\n } else {\n showTooltip();\n }\n },\n close: hideTooltip,\n };\n}\n","/**\n * Toast state management for SolidJS\n * Based on @react-stately/toast useToastState\n */\n\nimport { createSignal, onCleanup, type Accessor } from 'solid-js';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface ToastOptions {\n /** A timeout to automatically close the toast, in milliseconds. */\n timeout?: number;\n /** The priority of the toast relative to other toasts. */\n priority?: number;\n /** Handler called when the toast is closed. */\n onClose?: () => void;\n}\n\nexport interface QueuedToast<T> {\n /** The content of the toast. */\n content: T;\n /** A unique key for the toast. */\n key: string;\n /** The timer for the toast. */\n timer: Timer | null;\n /** Whether the toast should be animated. */\n animation?: 'entering' | 'exiting' | 'queued';\n /** The priority of the toast. */\n priority: number;\n /** Handler called when the toast is closed. */\n onClose?: () => void;\n /** The timeout for the toast. */\n timeout?: number;\n}\n\nexport interface ToastQueueOptions {\n /** The maximum number of toasts to display at once. */\n maxVisibleToasts?: number;\n /** Whether toasts should stack (true) or queue (false). */\n hasExitAnimation?: boolean;\n}\n\nexport interface ToastStateProps<T> {\n /** The toast queue to use. */\n queue: ToastQueue<T>;\n}\n\nexport interface ToastState<T> {\n /** The currently visible toasts. */\n visibleToasts: Accessor<QueuedToast<T>[]>;\n /** Adds a toast to the queue. */\n add: (content: T, options?: ToastOptions) => string;\n /** Closes a toast by key. */\n close: (key: string) => void;\n /** Pauses all toast timers. */\n pauseAll: () => void;\n /** Resumes all toast timers. */\n resumeAll: () => void;\n}\n\n// ============================================\n// TIMER CLASS\n// ============================================\n\n/**\n * A Timer that supports pause and resume.\n */\nexport class Timer {\n private timerId: number | null = null;\n private startTime: number = 0;\n private remaining: number;\n private callback: () => void;\n\n constructor(callback: () => void, delay: number) {\n this.callback = callback;\n this.remaining = delay;\n this.resume();\n }\n\n pause() {\n if (this.timerId === null) {\n return;\n }\n clearTimeout(this.timerId);\n this.timerId = null;\n this.remaining -= Date.now() - this.startTime;\n }\n\n resume() {\n if (this.timerId !== null) {\n return;\n }\n this.startTime = Date.now();\n this.timerId = window.setTimeout(() => {\n this.timerId = null;\n this.callback();\n }, this.remaining);\n }\n\n reset(delay: number) {\n this.pause();\n this.remaining = delay;\n this.resume();\n }\n\n cancel() {\n if (this.timerId !== null) {\n clearTimeout(this.timerId);\n this.timerId = null;\n }\n }\n}\n\n// ============================================\n// TOAST QUEUE CLASS\n// ============================================\n\ntype SubscribeCallback<T> = (toasts: QueuedToast<T>[]) => void;\n\n/**\n * A queue that manages toast notifications.\n * Can be created once and shared across the app (singleton pattern).\n */\nexport class ToastQueue<T> {\n private queue: QueuedToast<T>[] = [];\n private subscriptions = new Set<SubscribeCallback<T>>();\n private maxVisibleToasts: number;\n private hasExitAnimation: boolean;\n private keyCounter = 0;\n\n constructor(options: ToastQueueOptions = {}) {\n this.maxVisibleToasts = options.maxVisibleToasts ?? 5;\n this.hasExitAnimation = options.hasExitAnimation ?? false;\n }\n\n /**\n * Subscribe to queue changes.\n */\n subscribe(callback: SubscribeCallback<T>): () => void {\n this.subscriptions.add(callback);\n return () => {\n this.subscriptions.delete(callback);\n };\n }\n\n /**\n * Add a toast to the queue.\n */\n add(content: T, options: ToastOptions = {}): string {\n const key = String(this.keyCounter++);\n\n const toast: QueuedToast<T> = {\n content,\n key,\n timer: null,\n priority: options.priority ?? 0,\n onClose: options.onClose,\n timeout: options.timeout,\n animation: 'entering',\n };\n\n // Find insertion point based on priority\n let low = 0;\n let high = this.queue.length;\n while (low < high) {\n const mid = Math.floor((low + high) / 2);\n if (toast.priority > this.queue[mid].priority) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n // Insert at the correct position\n this.queue = [\n ...this.queue.slice(0, low),\n toast,\n ...this.queue.slice(low),\n ];\n\n // Start timer for visible toasts\n this.updateVisibility();\n\n return key;\n }\n\n /**\n * Close a toast by key.\n */\n close(key: string): void {\n const toast = this.queue.find((t) => t.key === key);\n if (!toast) return;\n\n // Cancel any existing timer\n toast.timer?.cancel();\n toast.timer = null;\n\n if (this.hasExitAnimation && toast.animation !== 'queued') {\n // Mark as exiting for animation\n toast.animation = 'exiting';\n this.notify();\n } else {\n // Remove immediately\n this.remove(key);\n }\n }\n\n /**\n * Remove a toast after exit animation completes.\n */\n remove(key: string): void {\n const toast = this.queue.find((t) => t.key === key);\n if (toast) {\n toast.onClose?.();\n toast.timer?.cancel();\n }\n\n this.queue = this.queue.filter((t) => t.key !== key);\n this.updateVisibility();\n }\n\n /**\n * Pause all toast timers.\n */\n pauseAll(): void {\n for (const toast of this.queue) {\n toast.timer?.pause();\n }\n }\n\n /**\n * Resume all toast timers.\n */\n resumeAll(): void {\n for (const toast of this.queue) {\n toast.timer?.resume();\n }\n }\n\n private updateVisibility(): void {\n // Mark toasts as visible or queued based on maxVisibleToasts\n const visibleCount = this.queue.filter(\n (t) => t.animation !== 'queued' && t.animation !== 'exiting'\n ).length;\n\n let promoted = 0;\n for (const toast of this.queue) {\n if (toast.animation === 'queued' && visibleCount + promoted < this.maxVisibleToasts) {\n toast.animation = 'entering';\n promoted++;\n }\n if (toast.animation === 'queued') continue;\n\n // Start timer for visible toasts\n if (toast.timeout != null && toast.timer === null && toast.animation !== 'exiting') {\n toast.timer = new Timer(() => {\n this.close(toast.key);\n }, toast.timeout);\n }\n }\n\n this.notify();\n }\n\n private notify(): void {\n const toasts = [...this.queue];\n for (const callback of this.subscriptions) {\n callback(toasts);\n }\n }\n}\n\n// ============================================\n// HOOK\n// ============================================\n\n/**\n * Creates reactive toast state from a ToastQueue.\n * Use this hook to subscribe to toast changes in your component.\n */\nexport function createToastState<T>(props: ToastStateProps<T>): ToastState<T> {\n const [visibleToasts, setVisibleToasts] = createSignal<QueuedToast<T>[]>([]);\n\n // Subscribe to queue changes\n const unsubscribe = props.queue.subscribe((toasts) => {\n setVisibleToasts(toasts);\n });\n\n onCleanup(() => {\n unsubscribe();\n });\n\n return {\n visibleToasts,\n add: (content, options) => props.queue.add(content, options),\n close: (key) => props.queue.close(key),\n pauseAll: () => props.queue.pauseAll(),\n resumeAll: () => props.queue.resumeAll(),\n };\n}\n\n// ============================================\n// CONVENIENCE HOOKS\n// ============================================\n\n/**\n * Creates a new ToastQueue and returns reactive state.\n * Use this if you don't need a global queue.\n */\nexport function createToastQueue<T>(options?: ToastQueueOptions): ToastState<T> & { queue: ToastQueue<T> } {\n const queue = new ToastQueue<T>(options);\n const state = createToastState({ queue });\n return { ...state, queue };\n}\n","/**\n * Disclosure state management for SolidJS\n * Based on @react-stately/disclosure useDisclosureState and useDisclosureGroupState\n */\n\nimport { createSignal, createEffect, type Accessor } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils';\n\n// ============================================\n// SINGLE DISCLOSURE STATE\n// ============================================\n\nexport interface DisclosureStateProps {\n /** Whether the disclosure is expanded (controlled). */\n isExpanded?: boolean;\n /** Whether the disclosure is expanded by default (uncontrolled). */\n defaultExpanded?: boolean;\n /** Handler that is called when the disclosure expanded state changes. */\n onExpandedChange?: (isExpanded: boolean) => void;\n}\n\nexport interface DisclosureState {\n /** Whether the disclosure is currently expanded. */\n readonly isExpanded: Accessor<boolean>;\n /** Sets whether the disclosure is expanded. */\n setExpanded(isExpanded: boolean): void;\n /** Expand the disclosure. */\n expand(): void;\n /** Collapse the disclosure. */\n collapse(): void;\n /** Toggles the disclosure's visibility. */\n toggle(): void;\n}\n\n/**\n * Manages state for a disclosure widget. Tracks whether the disclosure is expanded,\n * and provides methods to toggle this state.\n */\nexport function createDisclosureState(\n props: MaybeAccessor<DisclosureStateProps> = {}\n): DisclosureState {\n const propsAccessor = () => access(props);\n\n // Internal state for uncontrolled mode\n const [internalExpanded, setInternalExpanded] = createSignal(\n propsAccessor().defaultExpanded ?? false\n );\n\n // Determine if expanded (controlled vs uncontrolled)\n const isExpanded: Accessor<boolean> = () => {\n const p = propsAccessor();\n return p.isExpanded !== undefined ? p.isExpanded : internalExpanded();\n };\n\n const setExpanded = (expanded: boolean) => {\n const p = propsAccessor();\n if (p.isExpanded === undefined) {\n setInternalExpanded(expanded);\n }\n p.onExpandedChange?.(expanded);\n };\n\n const expand = () => setExpanded(true);\n const collapse = () => setExpanded(false);\n const toggle = () => setExpanded(!isExpanded());\n\n return {\n isExpanded,\n setExpanded,\n expand,\n collapse,\n toggle,\n };\n}\n\n// ============================================\n// DISCLOSURE GROUP STATE (Accordion)\n// ============================================\n\nexport type Key = string | number;\n\nexport interface DisclosureGroupStateProps {\n /** Whether multiple items can be expanded at the same time. */\n allowsMultipleExpanded?: boolean;\n /** Whether all items are disabled. */\n isDisabled?: boolean;\n /** The currently expanded keys in the group (controlled). */\n expandedKeys?: Iterable<Key>;\n /** The initial expanded keys in the group (uncontrolled). */\n defaultExpandedKeys?: Iterable<Key>;\n /** Handler that is called when items are expanded or collapsed. */\n onExpandedChange?: (keys: Set<Key>) => void;\n}\n\nexport interface DisclosureGroupState {\n /** Whether multiple items can be expanded at the same time. */\n readonly allowsMultipleExpanded: boolean;\n /** Whether all items are disabled. */\n readonly isDisabled: boolean;\n /** A set of keys for items that are expanded. */\n readonly expandedKeys: Accessor<Set<Key>>;\n /** Toggles the expanded state for an item by its key. */\n toggleKey(key: Key): void;\n /** Replaces the set of expanded keys. */\n setExpandedKeys(keys: Set<Key>): void;\n /** Check if a specific key is expanded. */\n isExpanded(key: Key): boolean;\n}\n\n/**\n * Manages state for a group of disclosures, e.g. an accordion.\n * It supports both single and multiple expanded items.\n */\nexport function createDisclosureGroupState(\n props: MaybeAccessor<DisclosureGroupStateProps> = {}\n): DisclosureGroupState {\n const propsAccessor = () => access(props);\n\n // Internal state for uncontrolled mode\n const [internalKeys, setInternalKeys] = createSignal<Set<Key>>(\n new Set(propsAccessor().defaultExpandedKeys ?? [])\n );\n\n // Determine expanded keys (controlled vs uncontrolled)\n const expandedKeys: Accessor<Set<Key>> = () => {\n const p = propsAccessor();\n return p.expandedKeys !== undefined ? new Set(p.expandedKeys) : internalKeys();\n };\n\n const setExpandedKeys = (keys: Set<Key>) => {\n const p = propsAccessor();\n if (p.expandedKeys === undefined) {\n setInternalKeys(keys);\n }\n p.onExpandedChange?.(keys);\n };\n\n // Ensure only one item is expanded if allowsMultipleExpanded is false\n // Note: We use untrack to prevent infinite loops when calling setExpandedKeys\n createEffect(() => {\n const p = propsAccessor();\n const allowsMultiple = p.allowsMultipleExpanded ?? false;\n const keys = expandedKeys();\n\n if (!allowsMultiple && keys.size > 1) {\n // Use queueMicrotask to defer the update and avoid infinite effect loop\n const firstKey = keys.values().next().value;\n if (firstKey != null) {\n queueMicrotask(() => {\n setExpandedKeys(new Set([firstKey]));\n });\n }\n }\n });\n\n const toggleKey = (key: Key) => {\n const p = propsAccessor();\n const allowsMultiple = p.allowsMultipleExpanded ?? false;\n const currentKeys = expandedKeys();\n\n let newKeys: Set<Key>;\n if (allowsMultiple) {\n newKeys = new Set(currentKeys);\n if (newKeys.has(key)) {\n newKeys.delete(key);\n } else {\n newKeys.add(key);\n }\n } else {\n // Single selection: toggle off if already expanded, otherwise select only this one\n newKeys = new Set(currentKeys.has(key) ? [] : [key]);\n }\n\n setExpandedKeys(newKeys);\n };\n\n const isExpanded = (key: Key): boolean => {\n return expandedKeys().has(key);\n };\n\n return {\n get allowsMultipleExpanded() {\n return propsAccessor().allowsMultipleExpanded ?? false;\n },\n get isDisabled() {\n return propsAccessor().isDisabled ?? false;\n },\n expandedKeys,\n toggleKey,\n setExpandedKeys,\n isExpanded,\n };\n}\n","/**\n * CalendarState for Solid-Stately\n *\n * Provides state management for calendar components.\n * Based on @react-stately/calendar useCalendarState\n */\n\nimport { createSignal, createMemo, type Accessor } from 'solid-js';\nimport {\n type CalendarDate,\n type DateValue,\n today,\n getLocalTimeZone,\n isSameDay,\n isSameMonth,\n startOfMonth,\n endOfMonth,\n startOfWeek,\n getWeeksInMonth,\n getDayOfWeek,\n DateFormatter,\n toCalendarDate as intlToCalendarDate,\n} from '@internationalized/date';\nimport { access, type MaybeAccessor } from '../utils';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport type ValidationState = 'valid' | 'invalid';\n\nexport interface CalendarStateProps<T extends DateValue = DateValue> {\n /** The current value (controlled). */\n value?: MaybeAccessor<T | null>;\n /** The default value (uncontrolled). */\n defaultValue?: T | null;\n /** Handler called when the value changes. */\n onChange?: (value: T) => void;\n /** The minimum allowed date. */\n minValue?: MaybeAccessor<DateValue | undefined>;\n /** The maximum allowed date. */\n maxValue?: MaybeAccessor<DateValue | undefined>;\n /** Whether the calendar is disabled. */\n isDisabled?: MaybeAccessor<boolean>;\n /** Whether the calendar is read-only. */\n isReadOnly?: MaybeAccessor<boolean>;\n /** Whether dates outside the visible range are automatically focused. */\n autoFocus?: boolean;\n /** The date that is focused when the calendar first mounts. */\n focusedValue?: MaybeAccessor<DateValue | undefined>;\n /** The default focused date (uncontrolled). */\n defaultFocusedValue?: DateValue;\n /** Handler called when the focused date changes. */\n onFocusChange?: (date: CalendarDate) => void;\n /** The locale to use for formatting. */\n locale?: string;\n /** Callback that is called for each date in the calendar to determine if it is unavailable. */\n isDateUnavailable?: (date: DateValue) => boolean;\n /** The number of months to display at once. */\n visibleMonths?: number;\n /** Whether to automatically focus the calendar when it is mounted. */\n autoFocusOnMount?: boolean;\n /** Controls which days are disabled. */\n isDateDisabled?: (date: DateValue) => boolean;\n /** Validation state. */\n validationState?: MaybeAccessor<ValidationState | undefined>;\n /** Error message. */\n errorMessage?: string;\n /** The first day of the week (0 = Sunday, 1 = Monday, etc.). */\n firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n}\n\nexport interface CalendarState<T extends DateValue = DateValue> {\n /** The currently selected date. */\n value: Accessor<T | null>;\n /** Sets the selected date. */\n setValue: (value: T | null) => void;\n /** The currently focused date. */\n focusedDate: Accessor<CalendarDate>;\n /** Sets the focused date. */\n setFocusedDate: (date: CalendarDate) => void;\n /** Whether the calendar is disabled. */\n isDisabled: Accessor<boolean>;\n /** Whether the calendar is read-only. */\n isReadOnly: Accessor<boolean>;\n /** The visible date range (first and last day of visible month(s)). */\n visibleRange: Accessor<{ start: CalendarDate; end: CalendarDate }>;\n /** The timezone used for date calculations. */\n timeZone: string;\n /** The validation state. */\n validationState: Accessor<ValidationState | undefined>;\n /** Whether a date is selected. */\n isSelected: (date: DateValue) => boolean;\n /** Whether a date is focused. */\n isCellFocused: (date: DateValue) => boolean;\n /** Whether a date is unavailable. */\n isCellUnavailable: (date: DateValue) => boolean;\n /** Whether a date is disabled. */\n isCellDisabled: (date: DateValue) => boolean;\n /** Whether a date is outside the visible range. */\n isOutsideVisibleRange: (date: DateValue) => boolean;\n /** Whether a date is invalid. */\n isInvalid: (date: DateValue) => boolean;\n /** Moves focus to the previous page (month). */\n focusPreviousPage: () => void;\n /** Moves focus to the next page (month). */\n focusNextPage: () => void;\n /** Moves focus to the previous section (year). */\n focusPreviousSection: () => void;\n /** Moves focus to the next section (year). */\n focusNextSection: () => void;\n /** Moves focus to the previous day. */\n focusPreviousDay: () => void;\n /** Moves focus to the next day. */\n focusNextDay: () => void;\n /** Moves focus to the previous week. */\n focusPreviousWeek: () => void;\n /** Moves focus to the next week. */\n focusNextWeek: () => void;\n /** Moves focus to the start of the month. */\n focusPageStart: () => void;\n /** Moves focus to the end of the month. */\n focusPageEnd: () => void;\n /** Selects the focused date. */\n selectFocusedDate: () => void;\n /** Selects a specific date. */\n selectDate: (date: CalendarDate) => void;\n /** Whether focus is currently within the calendar. */\n isFocused: Accessor<boolean>;\n /** Sets whether focus is within the calendar. */\n setFocused: (focused: boolean) => void;\n /** Gets the dates for a week in the visible range. */\n getDatesInWeek: (weekIndex: number, monthStartDate?: CalendarDate) => (CalendarDate | null)[];\n /** Gets the number of weeks in a month. */\n getWeeksInMonth: (date?: CalendarDate) => number;\n /** The week day headers. */\n weekDays: Accessor<string[]>;\n /** The title for the calendar (formatted month and year). */\n title: Accessor<string>;\n /** The number of visible months. */\n visibleMonths: number;\n /** Whether the calendar is paginating (for animations). */\n isPaginating: Accessor<boolean>;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides state management for a calendar component.\n */\nexport function createCalendarState<T extends DateValue = CalendarDate>(\n props: CalendarStateProps<T> = {}\n): CalendarState<T> {\n const timeZone = getLocalTimeZone();\n const locale = props.locale ?? 'en-US';\n const visibleMonths = props.visibleMonths ?? 1;\n\n // Determine the initially focused date\n const getInitialFocusedDate = (): CalendarDate => {\n const controlledFocused = access(props.focusedValue);\n if (controlledFocused) {\n return toCalendarDate(controlledFocused);\n }\n if (props.defaultFocusedValue) {\n return toCalendarDate(props.defaultFocusedValue);\n }\n const controlledValue = access(props.value);\n if (controlledValue) {\n return toCalendarDate(controlledValue);\n }\n if (props.defaultValue) {\n return toCalendarDate(props.defaultValue);\n }\n return today(timeZone);\n };\n\n // State signals\n const [internalValue, setInternalValue] = createSignal<T | null>(\n props.defaultValue ?? null\n );\n const [focusedDate, setFocusedDateInternal] = createSignal<CalendarDate>(\n getInitialFocusedDate()\n );\n const [isFocused, setFocused] = createSignal(false);\n const [isPaginating, setIsPaginating] = createSignal(false);\n\n // Controlled vs uncontrolled value\n const value = createMemo<T | null>(() => {\n const controlled = access(props.value);\n return controlled !== undefined ? controlled : internalValue();\n });\n\n // Derived states\n const isDisabled = createMemo(() => access(props.isDisabled) ?? false);\n const isReadOnly = createMemo(() => access(props.isReadOnly) ?? false);\n const validationState = createMemo(() => access(props.validationState));\n\n // Visible range based on focused date\n const visibleRange = createMemo(() => {\n const focused = focusedDate();\n const start = startOfMonth(focused);\n let end = endOfMonth(focused);\n\n // Extend for multiple visible months\n for (let i = 1; i < visibleMonths; i++) {\n end = endOfMonth(end.add({ months: 1 }));\n }\n\n return { start, end };\n });\n\n // Format week days for headers\n const weekDays = createMemo(() => {\n const formatter = new DateFormatter(locale, { weekday: 'short' });\n const startDay = props.firstDayOfWeek ?? 0;\n const days: string[] = [];\n const base = today(timeZone);\n\n // Find the start of the week\n const dayOfWeek = getDayOfWeek(base, locale);\n const weekStart = base.subtract({ days: (dayOfWeek - startDay + 7) % 7 });\n\n for (let i = 0; i < 7; i++) {\n const day = weekStart.add({ days: i });\n days.push(formatter.format(day.toDate(timeZone)));\n }\n\n return days;\n });\n\n // Title (formatted month/year)\n const title = createMemo(() => {\n const formatter = new DateFormatter(locale, {\n month: 'long',\n year: 'numeric',\n });\n return formatter.format(focusedDate().toDate(timeZone));\n });\n\n // Set value with onChange callback\n const setValue = (newValue: T | null) => {\n if (isDisabled() || isReadOnly()) return;\n\n const controlled = access(props.value);\n if (controlled === undefined) {\n setInternalValue(() => newValue);\n }\n\n if (newValue && props.onChange) {\n props.onChange(newValue);\n }\n };\n\n // Set focused date with constraints\n const setFocusedDate = (date: CalendarDate) => {\n const minValue = access(props.minValue);\n const maxValue = access(props.maxValue);\n\n let constrained = date;\n\n if (minValue && date.compare(toCalendarDate(minValue)) < 0) {\n constrained = toCalendarDate(minValue);\n }\n if (maxValue && date.compare(toCalendarDate(maxValue)) > 0) {\n constrained = toCalendarDate(maxValue);\n }\n\n setFocusedDateInternal(constrained);\n props.onFocusChange?.(constrained);\n };\n\n // Check if a date is selected\n const isSelected = (date: DateValue): boolean => {\n const v = value();\n if (!v) return false;\n return isSameDay(toCalendarDate(date), toCalendarDate(v));\n };\n\n // Check if a date is focused\n const isCellFocused = (date: DateValue): boolean => {\n return isSameDay(toCalendarDate(date), focusedDate());\n };\n\n // Check if a date is unavailable\n const isCellUnavailable = (date: DateValue): boolean => {\n return props.isDateUnavailable?.(date) ?? false;\n };\n\n // Check if a date is disabled\n const isCellDisabled = (date: DateValue): boolean => {\n if (isDisabled()) return true;\n if (props.isDateDisabled?.(date)) return true;\n\n const minValue = access(props.minValue);\n const maxValue = access(props.maxValue);\n const calDate = toCalendarDate(date);\n\n if (minValue && calDate.compare(toCalendarDate(minValue)) < 0) return true;\n if (maxValue && calDate.compare(toCalendarDate(maxValue)) > 0) return true;\n\n return false;\n };\n\n // Check if a date is outside the visible range\n const isOutsideVisibleRange = (date: DateValue): boolean => {\n const range = visibleRange();\n const calDate = toCalendarDate(date);\n return !isSameMonth(calDate, range.start) && !isSameMonth(calDate, range.end);\n };\n\n // Check if a date is invalid\n const isInvalid = (date: DateValue): boolean => {\n return isCellDisabled(date) || isCellUnavailable(date);\n };\n\n // Navigation methods\n const focusPreviousPage = () => {\n setIsPaginating(true);\n setFocusedDate(focusedDate().subtract({ months: 1 }));\n setIsPaginating(false);\n };\n\n const focusNextPage = () => {\n setIsPaginating(true);\n setFocusedDate(focusedDate().add({ months: 1 }));\n setIsPaginating(false);\n };\n\n const focusPreviousSection = () => {\n setFocusedDate(focusedDate().subtract({ years: 1 }));\n };\n\n const focusNextSection = () => {\n setFocusedDate(focusedDate().add({ years: 1 }));\n };\n\n const focusPreviousDay = () => {\n setFocusedDate(focusedDate().subtract({ days: 1 }));\n };\n\n const focusNextDay = () => {\n setFocusedDate(focusedDate().add({ days: 1 }));\n };\n\n const focusPreviousWeek = () => {\n setFocusedDate(focusedDate().subtract({ weeks: 1 }));\n };\n\n const focusNextWeek = () => {\n setFocusedDate(focusedDate().add({ weeks: 1 }));\n };\n\n const focusPageStart = () => {\n setFocusedDate(startOfMonth(focusedDate()));\n };\n\n const focusPageEnd = () => {\n setFocusedDate(endOfMonth(focusedDate()));\n };\n\n // Selection methods\n const selectFocusedDate = () => {\n if (isReadOnly() || isDisabled()) return;\n const date = focusedDate();\n if (!isCellDisabled(date) && !isCellUnavailable(date)) {\n setValue(date as unknown as T);\n }\n };\n\n const selectDate = (date: CalendarDate) => {\n if (isReadOnly() || isDisabled()) return;\n if (!isCellDisabled(date) && !isCellUnavailable(date)) {\n setValue(date as unknown as T);\n setFocusedDate(date);\n }\n };\n\n // Get dates in a specific week\n const getDatesInWeek = (\n weekIndex: number,\n monthStartDate?: CalendarDate\n ): (CalendarDate | null)[] => {\n const startDate = monthStartDate ?? visibleRange().start;\n\n const monthStart = startOfMonth(startDate);\n const weekStart = startOfWeek(monthStart, locale);\n\n const week: (CalendarDate | null)[] = [];\n const firstDayOfWeek = weekStart.add({ weeks: weekIndex });\n\n for (let i = 0; i < 7; i++) {\n const date = firstDayOfWeek.add({ days: i });\n // Only include dates that are in the same month\n if (isSameMonth(date, startDate)) {\n week.push(date);\n } else {\n week.push(date); // Still include for proper grid alignment\n }\n }\n\n return week;\n };\n\n // Get number of weeks in a month\n const getWeeksInMonthFn = (date?: CalendarDate): number => {\n const monthDate = date ?? focusedDate();\n return getWeeksInMonth(monthDate, locale);\n };\n\n return {\n value,\n setValue,\n focusedDate,\n setFocusedDate,\n isDisabled,\n isReadOnly,\n visibleRange,\n timeZone,\n validationState,\n isSelected,\n isCellFocused,\n isCellUnavailable,\n isCellDisabled,\n isOutsideVisibleRange,\n isInvalid,\n focusPreviousPage,\n focusNextPage,\n focusPreviousSection,\n focusNextSection,\n focusPreviousDay,\n focusNextDay,\n focusPreviousWeek,\n focusNextWeek,\n focusPageStart,\n focusPageEnd,\n selectFocusedDate,\n selectDate,\n isFocused,\n setFocused,\n getDatesInWeek,\n getWeeksInMonth: getWeeksInMonthFn,\n weekDays,\n title,\n visibleMonths,\n isPaginating,\n };\n}\n\n// ============================================\n// HELPER FUNCTIONS\n// ============================================\n\n/**\n * Converts a DateValue to a CalendarDate.\n */\nfunction toCalendarDate(date: DateValue): CalendarDate {\n // Use the library function to convert\n return intlToCalendarDate(date);\n}\n","/**\n * RangeCalendarState for Solid-Stately\n *\n * Provides state management for range calendar components.\n * Based on @react-stately/calendar useRangeCalendarState\n */\n\nimport { createSignal, createMemo, type Accessor } from 'solid-js';\nimport {\n type CalendarDate,\n type DateValue,\n today,\n getLocalTimeZone,\n isSameDay,\n isSameMonth,\n startOfMonth,\n endOfMonth,\n startOfWeek,\n getWeeksInMonth,\n getDayOfWeek,\n DateFormatter,\n toCalendarDate as intlToCalendarDate,\n} from '@internationalized/date';\nimport { access, type MaybeAccessor } from '../utils';\nimport type { ValidationState } from './createCalendarState';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface DateRange {\n start: CalendarDate;\n end: CalendarDate;\n}\n\nexport interface RangeValue<T> {\n start: T;\n end: T;\n}\n\nexport interface RangeCalendarStateProps<T extends DateValue = DateValue> {\n /** The current value (controlled). */\n value?: MaybeAccessor<RangeValue<T> | null>;\n /** The default value (uncontrolled). */\n defaultValue?: RangeValue<T> | null;\n /** Handler called when the value changes. */\n onChange?: (value: RangeValue<T>) => void;\n /** The minimum allowed date. */\n minValue?: MaybeAccessor<DateValue | undefined>;\n /** The maximum allowed date. */\n maxValue?: MaybeAccessor<DateValue | undefined>;\n /** Whether the calendar is disabled. */\n isDisabled?: MaybeAccessor<boolean>;\n /** Whether the calendar is read-only. */\n isReadOnly?: MaybeAccessor<boolean>;\n /** The date that is focused when the calendar first mounts. */\n focusedValue?: MaybeAccessor<DateValue | undefined>;\n /** The default focused date (uncontrolled). */\n defaultFocusedValue?: DateValue;\n /** Handler called when the focused date changes. */\n onFocusChange?: (date: CalendarDate) => void;\n /** The locale to use for formatting. */\n locale?: string;\n /** Callback to determine if a date is unavailable. */\n isDateUnavailable?: (date: DateValue) => boolean;\n /** The number of months to display at once. */\n visibleMonths?: number;\n /** Controls which days are disabled. */\n isDateDisabled?: (date: DateValue) => boolean;\n /** Validation state. */\n validationState?: MaybeAccessor<ValidationState | undefined>;\n /** Whether to allow selecting the same date for start and end. */\n allowsNonContiguousRanges?: boolean;\n /** The first day of the week (0 = Sunday, 1 = Monday, etc.). */\n firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n}\n\nexport interface RangeCalendarState<T extends DateValue = DateValue> {\n /** The currently selected date range. */\n value: Accessor<RangeValue<T> | null>;\n /** Sets the selected date range. */\n setValue: (value: RangeValue<T> | null) => void;\n /** The currently focused date. */\n focusedDate: Accessor<CalendarDate>;\n /** Sets the focused date. */\n setFocusedDate: (date: CalendarDate) => void;\n /** The anchor date when selecting a range (first click). */\n anchorDate: Accessor<CalendarDate | null>;\n /** Sets the anchor date. */\n setAnchorDate: (date: CalendarDate | null) => void;\n /** The highlighted range during selection. */\n highlightedRange: Accessor<RangeValue<CalendarDate> | null>;\n /** Whether the calendar is disabled. */\n isDisabled: Accessor<boolean>;\n /** Whether the calendar is read-only. */\n isReadOnly: Accessor<boolean>;\n /** The visible date range (first and last day of visible month(s)). */\n visibleRange: Accessor<{ start: CalendarDate; end: CalendarDate }>;\n /** The timezone used for date calculations. */\n timeZone: string;\n /** The validation state. */\n validationState: Accessor<ValidationState | undefined>;\n /** Whether a date is within the selected range. */\n isSelected: (date: DateValue) => boolean;\n /** Whether a date is the start of the selection. */\n isSelectionStart: (date: DateValue) => boolean;\n /** Whether a date is the end of the selection. */\n isSelectionEnd: (date: DateValue) => boolean;\n /** Whether a date is focused. */\n isCellFocused: (date: DateValue) => boolean;\n /** Whether a date is unavailable. */\n isCellUnavailable: (date: DateValue) => boolean;\n /** Whether a date is disabled. */\n isCellDisabled: (date: DateValue) => boolean;\n /** Whether a date is outside the visible range. */\n isOutsideVisibleRange: (date: DateValue) => boolean;\n /** Whether a date is invalid. */\n isInvalid: (date: DateValue) => boolean;\n /** Moves focus to the previous page (month). */\n focusPreviousPage: () => void;\n /** Moves focus to the next page (month). */\n focusNextPage: () => void;\n /** Moves focus to the previous section (year). */\n focusPreviousSection: () => void;\n /** Moves focus to the next section (year). */\n focusNextSection: () => void;\n /** Moves focus to the previous day. */\n focusPreviousDay: () => void;\n /** Moves focus to the next day. */\n focusNextDay: () => void;\n /** Moves focus to the previous week. */\n focusPreviousWeek: () => void;\n /** Moves focus to the next week. */\n focusNextWeek: () => void;\n /** Moves focus to the start of the month. */\n focusPageStart: () => void;\n /** Moves focus to the end of the month. */\n focusPageEnd: () => void;\n /** Selects the focused date. */\n selectFocusedDate: () => void;\n /** Selects a specific date. */\n selectDate: (date: CalendarDate) => void;\n /** Whether focus is currently within the calendar. */\n isFocused: Accessor<boolean>;\n /** Sets whether focus is within the calendar. */\n setFocused: (focused: boolean) => void;\n /** Gets the dates for a week in the visible range. */\n getDatesInWeek: (weekIndex: number, monthStartDate?: CalendarDate) => (CalendarDate | null)[];\n /** Gets the number of weeks in a month. */\n getWeeksInMonth: (date?: CalendarDate) => number;\n /** The week day headers. */\n weekDays: Accessor<string[]>;\n /** The title for the calendar (formatted month and year). */\n title: Accessor<string>;\n /** The number of visible months. */\n visibleMonths: number;\n /** Whether the user is currently selecting a range. */\n isDragging: Accessor<boolean>;\n /** Sets whether the user is dragging to select. */\n setDragging: (dragging: boolean) => void;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides state management for a range calendar component.\n */\nexport function createRangeCalendarState<T extends DateValue = CalendarDate>(\n props: RangeCalendarStateProps<T> = {}\n): RangeCalendarState<T> {\n const timeZone = getLocalTimeZone();\n const locale = props.locale ?? 'en-US';\n const visibleMonths = props.visibleMonths ?? 1;\n\n // Determine the initially focused date\n const getInitialFocusedDate = (): CalendarDate => {\n const controlledFocused = access(props.focusedValue);\n if (controlledFocused) {\n return toCalendarDate(controlledFocused);\n }\n if (props.defaultFocusedValue) {\n return toCalendarDate(props.defaultFocusedValue);\n }\n const controlledValue = access(props.value);\n if (controlledValue?.start) {\n return toCalendarDate(controlledValue.start);\n }\n if (props.defaultValue?.start) {\n return toCalendarDate(props.defaultValue.start);\n }\n return today(timeZone);\n };\n\n // State signals\n const [internalValue, setInternalValue] = createSignal<RangeValue<T> | null>(\n props.defaultValue ?? null\n );\n const [focusedDate, setFocusedDateInternal] = createSignal<CalendarDate>(\n getInitialFocusedDate()\n );\n const [anchorDate, setAnchorDate] = createSignal<CalendarDate | null>(null);\n const [isFocused, setFocused] = createSignal(false);\n const [isDragging, setDragging] = createSignal(false);\n\n // Controlled vs uncontrolled value\n const value = createMemo<RangeValue<T> | null>(() => {\n const controlled = access(props.value);\n return controlled !== undefined ? controlled : internalValue();\n });\n\n // Derived states\n const isDisabled = createMemo(() => access(props.isDisabled) ?? false);\n const isReadOnly = createMemo(() => access(props.isReadOnly) ?? false);\n const validationState = createMemo(() => access(props.validationState));\n\n // Highlighted range during selection\n const highlightedRange = createMemo<RangeValue<CalendarDate> | null>(() => {\n const anchor = anchorDate();\n if (!anchor) {\n const v = value();\n if (v) {\n return {\n start: toCalendarDate(v.start),\n end: toCalendarDate(v.end),\n };\n }\n return null;\n }\n\n const focused = focusedDate();\n if (anchor.compare(focused) <= 0) {\n return { start: anchor, end: focused };\n }\n return { start: focused, end: anchor };\n });\n\n // Visible range based on focused date\n const visibleRange = createMemo(() => {\n const focused = focusedDate();\n const start = startOfMonth(focused);\n let end = endOfMonth(focused);\n\n for (let i = 1; i < visibleMonths; i++) {\n end = endOfMonth(end.add({ months: 1 }));\n }\n\n return { start, end };\n });\n\n // Format week days for headers\n const weekDays = createMemo(() => {\n const formatter = new DateFormatter(locale, { weekday: 'short' });\n const startDay = props.firstDayOfWeek ?? 0;\n const days: string[] = [];\n const base = today(timeZone);\n\n const dayOfWeek = getDayOfWeek(base, locale);\n const weekStart = base.subtract({ days: (dayOfWeek - startDay + 7) % 7 });\n\n for (let i = 0; i < 7; i++) {\n const day = weekStart.add({ days: i });\n days.push(formatter.format(day.toDate(timeZone)));\n }\n\n return days;\n });\n\n // Title (formatted month/year)\n const title = createMemo(() => {\n const formatter = new DateFormatter(locale, {\n month: 'long',\n year: 'numeric',\n });\n return formatter.format(focusedDate().toDate(timeZone));\n });\n\n // Set value with onChange callback\n const setValue = (newValue: RangeValue<T> | null) => {\n if (isDisabled() || isReadOnly()) return;\n\n const controlled = access(props.value);\n if (controlled === undefined) {\n setInternalValue(() => newValue);\n }\n\n if (newValue && props.onChange) {\n props.onChange(newValue);\n }\n };\n\n // Set focused date with constraints\n const setFocusedDate = (date: CalendarDate) => {\n const minValue = access(props.minValue);\n const maxValue = access(props.maxValue);\n\n let constrained = date;\n\n if (minValue && date.compare(toCalendarDate(minValue)) < 0) {\n constrained = toCalendarDate(minValue);\n }\n if (maxValue && date.compare(toCalendarDate(maxValue)) > 0) {\n constrained = toCalendarDate(maxValue);\n }\n\n setFocusedDateInternal(constrained);\n props.onFocusChange?.(constrained);\n };\n\n // Check if a date is within the selected range\n const isSelected = (date: DateValue): boolean => {\n const range = highlightedRange();\n if (!range) return false;\n\n const calDate = toCalendarDate(date);\n return (\n calDate.compare(range.start) >= 0 && calDate.compare(range.end) <= 0\n );\n };\n\n // Check if a date is the start of the selection\n const isSelectionStart = (date: DateValue): boolean => {\n const range = highlightedRange();\n if (!range) return false;\n return isSameDay(toCalendarDate(date), range.start);\n };\n\n // Check if a date is the end of the selection\n const isSelectionEnd = (date: DateValue): boolean => {\n const range = highlightedRange();\n if (!range) return false;\n return isSameDay(toCalendarDate(date), range.end);\n };\n\n // Check if a date is focused\n const isCellFocused = (date: DateValue): boolean => {\n return isSameDay(toCalendarDate(date), focusedDate());\n };\n\n // Check if a date is unavailable\n const isCellUnavailable = (date: DateValue): boolean => {\n return props.isDateUnavailable?.(date) ?? false;\n };\n\n // Check if a date is disabled\n const isCellDisabled = (date: DateValue): boolean => {\n if (isDisabled()) return true;\n if (props.isDateDisabled?.(date)) return true;\n\n const minValue = access(props.minValue);\n const maxValue = access(props.maxValue);\n const calDate = toCalendarDate(date);\n\n if (minValue && calDate.compare(toCalendarDate(minValue)) < 0) return true;\n if (maxValue && calDate.compare(toCalendarDate(maxValue)) > 0) return true;\n\n return false;\n };\n\n // Check if a date is outside the visible range\n const isOutsideVisibleRange = (date: DateValue): boolean => {\n const range = visibleRange();\n const calDate = toCalendarDate(date);\n return !isSameMonth(calDate, range.start) && !isSameMonth(calDate, range.end);\n };\n\n // Check if a date is invalid\n const isInvalid = (date: DateValue): boolean => {\n return isCellDisabled(date) || isCellUnavailable(date);\n };\n\n // Navigation methods\n const focusPreviousPage = () => {\n setFocusedDate(focusedDate().subtract({ months: 1 }));\n };\n\n const focusNextPage = () => {\n setFocusedDate(focusedDate().add({ months: 1 }));\n };\n\n const focusPreviousSection = () => {\n setFocusedDate(focusedDate().subtract({ years: 1 }));\n };\n\n const focusNextSection = () => {\n setFocusedDate(focusedDate().add({ years: 1 }));\n };\n\n const focusPreviousDay = () => {\n setFocusedDate(focusedDate().subtract({ days: 1 }));\n };\n\n const focusNextDay = () => {\n setFocusedDate(focusedDate().add({ days: 1 }));\n };\n\n const focusPreviousWeek = () => {\n setFocusedDate(focusedDate().subtract({ weeks: 1 }));\n };\n\n const focusNextWeek = () => {\n setFocusedDate(focusedDate().add({ weeks: 1 }));\n };\n\n const focusPageStart = () => {\n setFocusedDate(startOfMonth(focusedDate()));\n };\n\n const focusPageEnd = () => {\n setFocusedDate(endOfMonth(focusedDate()));\n };\n\n // Selection methods\n const selectFocusedDate = () => {\n if (isReadOnly() || isDisabled()) return;\n selectDate(focusedDate());\n };\n\n const selectDate = (date: CalendarDate) => {\n if (isReadOnly() || isDisabled()) return;\n if (isCellDisabled(date) || isCellUnavailable(date)) return;\n\n const anchor = anchorDate();\n\n if (!anchor) {\n // First click - set anchor\n setAnchorDate(date);\n setDragging(true);\n } else {\n // Second click - complete selection\n let start: CalendarDate;\n let end: CalendarDate;\n\n if (date.compare(anchor) < 0) {\n start = date;\n end = anchor;\n } else {\n start = anchor;\n end = date;\n }\n\n setValue({\n start: start as unknown as T,\n end: end as unknown as T,\n });\n setAnchorDate(null);\n setDragging(false);\n }\n\n setFocusedDate(date);\n };\n\n // Get dates in a specific week\n const getDatesInWeek = (\n weekIndex: number,\n monthStartDate?: CalendarDate\n ): (CalendarDate | null)[] => {\n const startDate = monthStartDate ?? visibleRange().start;\n\n const monthStart = startOfMonth(startDate);\n const weekStart = startOfWeek(monthStart, locale);\n\n const week: (CalendarDate | null)[] = [];\n const firstDayOfWeek = weekStart.add({ weeks: weekIndex });\n\n for (let i = 0; i < 7; i++) {\n const date = firstDayOfWeek.add({ days: i });\n week.push(date);\n }\n\n return week;\n };\n\n // Get number of weeks in a month\n const getWeeksInMonthFn = (date?: CalendarDate): number => {\n const monthDate = date ?? focusedDate();\n return getWeeksInMonth(monthDate, locale);\n };\n\n return {\n value,\n setValue,\n focusedDate,\n setFocusedDate,\n anchorDate,\n setAnchorDate,\n highlightedRange,\n isDisabled,\n isReadOnly,\n visibleRange,\n timeZone,\n validationState,\n isSelected,\n isSelectionStart,\n isSelectionEnd,\n isCellFocused,\n isCellUnavailable,\n isCellDisabled,\n isOutsideVisibleRange,\n isInvalid,\n focusPreviousPage,\n focusNextPage,\n focusPreviousSection,\n focusNextSection,\n focusPreviousDay,\n focusNextDay,\n focusPreviousWeek,\n focusNextWeek,\n focusPageStart,\n focusPageEnd,\n selectFocusedDate,\n selectDate,\n isFocused,\n setFocused,\n getDatesInWeek,\n getWeeksInMonth: getWeeksInMonthFn,\n weekDays,\n title,\n visibleMonths,\n isDragging,\n setDragging,\n };\n}\n\n// ============================================\n// HELPER FUNCTIONS\n// ============================================\n\n/**\n * Converts a DateValue to a CalendarDate.\n */\nfunction toCalendarDate(date: DateValue): CalendarDate {\n return intlToCalendarDate(date);\n}\n","/**\n * DateFieldState for Solid-Stately\n *\n * Provides state management for date field components with segment-based editing.\n * Based on @react-stately/datepicker useDateFieldState\n */\n\nimport { createSignal, createMemo, type Accessor } from 'solid-js';\nimport {\n type CalendarDate,\n type CalendarDateTime,\n type ZonedDateTime,\n type DateValue,\n today,\n getLocalTimeZone,\n DateFormatter,\n toCalendarDate as intlToCalendarDate,\n toCalendarDateTime,\n} from '@internationalized/date';\nimport { access, type MaybeAccessor } from '../utils';\nimport type { ValidationState } from './createCalendarState';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport type DateSegmentType =\n | 'year'\n | 'month'\n | 'day'\n | 'hour'\n | 'minute'\n | 'second'\n | 'dayPeriod'\n | 'era'\n | 'timeZoneName'\n | 'literal';\n\nexport interface DateSegment {\n /** The type of segment. */\n type: DateSegmentType;\n /** The text content of the segment. */\n text: string;\n /** The numeric value of the segment (if applicable). */\n value?: number;\n /** The minimum value for the segment. */\n minValue?: number;\n /** The maximum value for the segment. */\n maxValue?: number;\n /** Whether this segment is editable. */\n isEditable: boolean;\n /** Whether this segment is a placeholder. */\n isPlaceholder: boolean;\n /** A placeholder string for the segment. */\n placeholder: string;\n}\n\nexport interface DateFieldStateProps<T extends DateValue = DateValue> {\n /** The current value (controlled). */\n value?: MaybeAccessor<T | null>;\n /** The default value (uncontrolled). */\n defaultValue?: T | null;\n /** Handler called when the value changes. */\n onChange?: (value: T | null) => void;\n /** The minimum allowed date. */\n minValue?: MaybeAccessor<DateValue | undefined>;\n /** The maximum allowed date. */\n maxValue?: MaybeAccessor<DateValue | undefined>;\n /** Whether the field is disabled. */\n isDisabled?: MaybeAccessor<boolean>;\n /** Whether the field is read-only. */\n isReadOnly?: MaybeAccessor<boolean>;\n /** Whether the field is required. */\n isRequired?: MaybeAccessor<boolean>;\n /** The locale to use for formatting. */\n locale?: string;\n /** The granularity of the date/time (day, hour, minute, second). */\n granularity?: 'day' | 'hour' | 'minute' | 'second';\n /** Whether to show the hour in 12 or 24 hour format. */\n hourCycle?: 12 | 24;\n /** Whether to hide the time zone. */\n hideTimeZone?: boolean;\n /** The placeholder date (determines segment structure). */\n placeholderValue?: DateValue;\n /** Validation state. */\n validationState?: MaybeAccessor<ValidationState | undefined>;\n /** Description text. */\n description?: string;\n /** Error message. */\n errorMessage?: string;\n /** Whether dates outside the min/max range are allowed. */\n allowsNonContiguousRanges?: boolean;\n /** Whether to create a date or datetime. */\n createCalendar?: (name: string) => unknown;\n}\n\nexport interface DateFieldState<T extends DateValue = DateValue> {\n /** The current value. */\n value: Accessor<T | null>;\n /** The date value (may be partial during editing). */\n dateValue: Accessor<DateValue | null>;\n /** Sets the date value. */\n setValue: (value: T | null) => void;\n /** The segments that make up the date. */\n segments: Accessor<DateSegment[]>;\n /** The format string. */\n formatValue: (fieldOptions?: Intl.DateTimeFormatOptions) => string;\n /** Sets a segment value. */\n setSegment: (type: DateSegmentType, value: number) => void;\n /** Increments a segment. */\n incrementSegment: (type: DateSegmentType) => void;\n /** Decrements a segment. */\n decrementSegment: (type: DateSegmentType) => void;\n /** Clears a segment. */\n clearSegment: (type: DateSegmentType) => void;\n /** Confirms the value (after typing). */\n confirmPlaceholder: () => void;\n /** Whether the field is disabled. */\n isDisabled: Accessor<boolean>;\n /** Whether the field is read-only. */\n isReadOnly: Accessor<boolean>;\n /** Whether the field is required. */\n isRequired: Accessor<boolean>;\n /** The validation state. */\n validationState: Accessor<ValidationState | undefined>;\n /** The granularity. */\n granularity: 'day' | 'hour' | 'minute' | 'second';\n /** Whether the value is invalid. */\n isInvalid: Accessor<boolean>;\n /** The locale. */\n locale: string;\n /** The time zone. */\n timeZone: string;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides state management for a date field component.\n */\nexport function createDateFieldState<T extends DateValue = CalendarDate>(\n props: DateFieldStateProps<T> = {}\n): DateFieldState<T> {\n const timeZone = getLocalTimeZone();\n const locale = props.locale ?? 'en-US';\n const granularity = props.granularity ?? 'day';\n\n // State signals\n const [internalValue, setInternalValue] = createSignal<T | null>(\n props.defaultValue ?? null\n );\n\n // Track partial values during editing\n const [placeholderDate, setPlaceholderDate] = createSignal<Partial<DateParts>>({});\n\n // Controlled vs uncontrolled value\n const value = createMemo<T | null>(() => {\n const controlled = access(props.value);\n return controlled !== undefined ? controlled : internalValue();\n });\n\n // The effective date value\n const dateValue = createMemo<DateValue | null>(() => {\n const v = value();\n if (v) return v;\n\n // Build from placeholder parts\n const parts = placeholderDate();\n const placeholder = props.placeholderValue ?? today(timeZone);\n\n if (Object.keys(parts).length === 0) return null;\n\n // Create a date from the parts\n const year = parts.year ?? placeholder.year;\n const month = parts.month ?? placeholder.month;\n const day = parts.day ?? placeholder.day;\n\n if (granularity === 'day') {\n return intlToCalendarDate(placeholder).set({ year, month, day });\n }\n\n // For time granularities\n const hour = parts.hour ?? 0;\n const minute = parts.minute ?? 0;\n const second = parts.second ?? 0;\n\n return toCalendarDateTime(placeholder).set({\n year,\n month,\n day,\n hour,\n minute,\n second,\n }) as unknown as T;\n });\n\n // Derived states\n const isDisabled = createMemo(() => access(props.isDisabled) ?? false);\n const isReadOnly = createMemo(() => access(props.isReadOnly) ?? false);\n const isRequired = createMemo(() => access(props.isRequired) ?? false);\n const validationState = createMemo(() => access(props.validationState));\n\n // Check if value is invalid\n const isInvalid = createMemo(() => {\n const v = value();\n if (!v) return false;\n\n const minValue = access(props.minValue);\n const maxValue = access(props.maxValue);\n\n if (minValue && v.compare(minValue) < 0) return true;\n if (maxValue && v.compare(maxValue) > 0) return true;\n\n return validationState() === 'invalid';\n });\n\n // Generate segments based on granularity and locale\n const segments = createMemo<DateSegment[]>(() => {\n const v = value();\n const placeholder = props.placeholderValue ?? today(timeZone);\n const parts = placeholderDate();\n\n const segs: DateSegment[] = [];\n\n // Determine format options based on granularity\n const formatOptions: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n };\n\n if (granularity !== 'day') {\n formatOptions.hour = '2-digit';\n formatOptions.minute = '2-digit';\n if (granularity === 'second') {\n formatOptions.second = '2-digit';\n }\n if (props.hourCycle) {\n formatOptions.hourCycle = props.hourCycle === 12 ? 'h12' : 'h23';\n }\n }\n\n const formatter = new DateFormatter(locale, formatOptions);\n const dateToFormat = v ?? placeholder;\n const formattedParts = formatter.formatToParts(dateToFormat.toDate(timeZone));\n\n for (const part of formattedParts) {\n const type = mapPartType(part.type);\n\n if (type === 'literal') {\n segs.push({\n type: 'literal',\n text: part.value,\n isEditable: false,\n isPlaceholder: false,\n placeholder: part.value,\n });\n } else if (type) {\n const segValue = getSegmentValue(v, type);\n const placeholderValue = getSegmentValue(placeholder, type);\n const partValue = parts[type as keyof DateParts];\n const hasValue = v !== null || partValue !== undefined;\n\n segs.push({\n type,\n text: hasValue ? part.value : getPlaceholderText(type),\n value: segValue ?? partValue,\n minValue: getMinValue(type),\n maxValue: getMaxValue(type, v ?? placeholder),\n isEditable: !isDisabled() && !isReadOnly(),\n isPlaceholder: !hasValue,\n placeholder: getPlaceholderText(type),\n });\n }\n }\n\n return segs;\n });\n\n // Set value with onChange callback\n const setValue = (newValue: T | null) => {\n if (isDisabled() || isReadOnly()) return;\n\n const controlled = access(props.value);\n if (controlled === undefined) {\n setInternalValue(() => newValue);\n }\n\n if (props.onChange) {\n props.onChange(newValue);\n }\n\n // Clear placeholder parts\n setPlaceholderDate({});\n };\n\n // Set a specific segment value\n const setSegment = (type: DateSegmentType, newValue: number) => {\n if (isDisabled() || isReadOnly()) return;\n\n const v = value();\n\n if (v) {\n // Update existing value\n const updated = updateDatePart(v, type, newValue);\n setValue(updated as T);\n } else {\n // Update placeholder parts\n setPlaceholderDate((prev) => ({\n ...prev,\n [type]: newValue,\n }));\n }\n };\n\n // Increment a segment\n const incrementSegment = (type: DateSegmentType) => {\n if (isDisabled() || isReadOnly()) return;\n\n const v = value();\n const current = v\n ? getSegmentValue(v, type)\n : placeholderDate()[type as keyof DateParts];\n const max = getMaxValue(type, v ?? props.placeholderValue ?? today(timeZone));\n const min = getMinValue(type);\n\n const newValue = current !== undefined ? current + 1 : min;\n setSegment(type, newValue > max ? min : newValue);\n };\n\n // Decrement a segment\n const decrementSegment = (type: DateSegmentType) => {\n if (isDisabled() || isReadOnly()) return;\n\n const v = value();\n const current = v\n ? getSegmentValue(v, type)\n : placeholderDate()[type as keyof DateParts];\n const max = getMaxValue(type, v ?? props.placeholderValue ?? today(timeZone));\n const min = getMinValue(type);\n\n const newValue = current !== undefined ? current - 1 : max;\n setSegment(type, newValue < min ? max : newValue);\n };\n\n // Clear a segment\n const clearSegment = (type: DateSegmentType) => {\n if (isDisabled() || isReadOnly()) return;\n\n const v = value();\n if (v) {\n // Clear entire value if any segment is cleared\n setValue(null);\n } else {\n setPlaceholderDate((prev) => {\n const next = { ...prev };\n delete next[type as keyof DateParts];\n return next;\n });\n }\n };\n\n // Confirm placeholder value\n const confirmPlaceholder = () => {\n const parts = placeholderDate();\n if (Object.keys(parts).length > 0) {\n const dv = dateValue();\n if (dv) {\n setValue(dv as T);\n }\n }\n };\n\n // Format the current value\n const formatValue = (fieldOptions?: Intl.DateTimeFormatOptions): string => {\n const v = value();\n if (!v) return '';\n\n const options: Intl.DateTimeFormatOptions = fieldOptions ?? {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n };\n\n if (granularity !== 'day') {\n options.hour = '2-digit';\n options.minute = '2-digit';\n if (granularity === 'second') {\n options.second = '2-digit';\n }\n }\n\n const formatter = new DateFormatter(locale, options);\n return formatter.format(v.toDate(timeZone));\n };\n\n return {\n value,\n dateValue,\n setValue,\n segments,\n formatValue,\n setSegment,\n incrementSegment,\n decrementSegment,\n clearSegment,\n confirmPlaceholder,\n isDisabled,\n isReadOnly,\n isRequired,\n validationState,\n granularity,\n isInvalid,\n locale,\n timeZone,\n };\n}\n\n// ============================================\n// HELPER TYPES & FUNCTIONS\n// ============================================\n\ninterface DateParts {\n year?: number;\n month?: number;\n day?: number;\n hour?: number;\n minute?: number;\n second?: number;\n}\n\nfunction mapPartType(type: Intl.DateTimeFormatPartTypes): DateSegmentType | null {\n switch (type) {\n case 'year':\n return 'year';\n case 'month':\n return 'month';\n case 'day':\n return 'day';\n case 'hour':\n return 'hour';\n case 'minute':\n return 'minute';\n case 'second':\n return 'second';\n case 'dayPeriod':\n return 'dayPeriod';\n case 'era':\n return 'era';\n case 'timeZoneName':\n return 'timeZoneName';\n case 'literal':\n return 'literal';\n default:\n return null;\n }\n}\n\nfunction getSegmentValue(\n date: DateValue | null,\n type: DateSegmentType\n): number | undefined {\n if (!date) return undefined;\n\n switch (type) {\n case 'year':\n return date.year;\n case 'month':\n return date.month;\n case 'day':\n return date.day;\n case 'hour':\n return 'hour' in date ? (date as CalendarDateTime).hour : undefined;\n case 'minute':\n return 'minute' in date ? (date as CalendarDateTime).minute : undefined;\n case 'second':\n return 'second' in date ? (date as CalendarDateTime).second : undefined;\n default:\n return undefined;\n }\n}\n\nfunction getMinValue(type: DateSegmentType): number {\n switch (type) {\n case 'year':\n return 1;\n case 'month':\n return 1;\n case 'day':\n return 1;\n case 'hour':\n return 0;\n case 'minute':\n return 0;\n case 'second':\n return 0;\n default:\n return 0;\n }\n}\n\nfunction getMaxValue(type: DateSegmentType, date: DateValue): number {\n switch (type) {\n case 'year':\n return 9999;\n case 'month':\n return 12;\n case 'day':\n // Get days in month\n return date.calendar.getDaysInMonth?.(date) ?? 31;\n case 'hour':\n return 23;\n case 'minute':\n return 59;\n case 'second':\n return 59;\n default:\n return 0;\n }\n}\n\nfunction getPlaceholderText(type: DateSegmentType): string {\n switch (type) {\n case 'year':\n return 'yyyy';\n case 'month':\n return 'mm';\n case 'day':\n return 'dd';\n case 'hour':\n return '––';\n case 'minute':\n return '––';\n case 'second':\n return '––';\n case 'dayPeriod':\n return 'AM';\n default:\n return '';\n }\n}\n\nfunction updateDatePart(date: DateValue, type: DateSegmentType, value: number): DateValue {\n switch (type) {\n case 'year':\n return (date as CalendarDate).set({ year: value });\n case 'month':\n return (date as CalendarDate).set({ month: value });\n case 'day':\n return (date as CalendarDate).set({ day: value });\n case 'hour':\n return (date as CalendarDateTime).set({ hour: value });\n case 'minute':\n return (date as CalendarDateTime).set({ minute: value });\n case 'second':\n return (date as CalendarDateTime).set({ second: value });\n default:\n return date;\n }\n}\n","/**\n * TimeFieldState for Solid-Stately\n *\n * Provides state management for time field components with segment-based editing.\n * Based on @react-stately/datepicker useTimeFieldState\n */\n\nimport { createSignal, createMemo, type Accessor } from 'solid-js';\nimport {\n type Time,\n type CalendarDateTime,\n type ZonedDateTime,\n getLocalTimeZone,\n DateFormatter,\n} from '@internationalized/date';\nimport { access, type MaybeAccessor } from '../utils';\nimport type { ValidationState } from './createCalendarState';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport type TimeValue = Time | CalendarDateTime | ZonedDateTime;\n\nexport type TimeSegmentType =\n | 'hour'\n | 'minute'\n | 'second'\n | 'dayPeriod'\n | 'literal';\n\nexport interface TimeSegment {\n /** The type of segment. */\n type: TimeSegmentType;\n /** The text content of the segment. */\n text: string;\n /** The numeric value of the segment (if applicable). */\n value?: number;\n /** The minimum value for the segment. */\n minValue?: number;\n /** The maximum value for the segment. */\n maxValue?: number;\n /** Whether this segment is editable. */\n isEditable: boolean;\n /** Whether this segment is a placeholder. */\n isPlaceholder: boolean;\n /** A placeholder string for the segment. */\n placeholder: string;\n}\n\nexport interface TimeFieldStateProps<T extends TimeValue = Time> {\n /** The current value (controlled). */\n value?: MaybeAccessor<T | null>;\n /** The default value (uncontrolled). */\n defaultValue?: T | null;\n /** Handler called when the value changes. */\n onChange?: (value: T | null) => void;\n /** The minimum allowed time. */\n minValue?: MaybeAccessor<TimeValue | undefined>;\n /** The maximum allowed time. */\n maxValue?: MaybeAccessor<TimeValue | undefined>;\n /** Whether the field is disabled. */\n isDisabled?: MaybeAccessor<boolean>;\n /** Whether the field is read-only. */\n isReadOnly?: MaybeAccessor<boolean>;\n /** Whether the field is required. */\n isRequired?: MaybeAccessor<boolean>;\n /** The locale to use for formatting. */\n locale?: string;\n /** The granularity (hour, minute, second). */\n granularity?: 'hour' | 'minute' | 'second';\n /** Whether to show 12 or 24 hour format. */\n hourCycle?: 12 | 24;\n /** Validation state. */\n validationState?: MaybeAccessor<ValidationState | undefined>;\n /** The placeholder value. */\n placeholderValue?: T;\n}\n\nexport interface TimeFieldState<T extends TimeValue = Time> {\n /** The current value. */\n value: Accessor<T | null>;\n /** Sets the value. */\n setValue: (value: T | null) => void;\n /** The segments that make up the time. */\n segments: Accessor<TimeSegment[]>;\n /** Sets a segment value. */\n setSegment: (type: TimeSegmentType, value: number) => void;\n /** Increments a segment. */\n incrementSegment: (type: TimeSegmentType) => void;\n /** Decrements a segment. */\n decrementSegment: (type: TimeSegmentType) => void;\n /** Clears a segment. */\n clearSegment: (type: TimeSegmentType) => void;\n /** Whether the field is disabled. */\n isDisabled: Accessor<boolean>;\n /** Whether the field is read-only. */\n isReadOnly: Accessor<boolean>;\n /** Whether the field is required. */\n isRequired: Accessor<boolean>;\n /** The validation state. */\n validationState: Accessor<ValidationState | undefined>;\n /** The granularity. */\n granularity: 'hour' | 'minute' | 'second';\n /** Whether the value is invalid. */\n isInvalid: Accessor<boolean>;\n /** The locale. */\n locale: string;\n /** The hour cycle. */\n hourCycle: 12 | 24;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides state management for a time field component.\n */\nexport function createTimeFieldState<T extends TimeValue = Time>(\n props: TimeFieldStateProps<T> = {}\n): TimeFieldState<T> {\n const timeZone = getLocalTimeZone();\n const locale = props.locale ?? 'en-US';\n const granularity = props.granularity ?? 'minute';\n const hourCycle = props.hourCycle ?? 12;\n\n // State signals\n const [internalValue, setInternalValue] = createSignal<T | null>(\n props.defaultValue ?? null\n );\n\n // Track partial values during editing\n const [placeholderParts, setPlaceholderParts] = createSignal<Partial<TimeParts>>({});\n\n // Controlled vs uncontrolled value\n const value = createMemo<T | null>(() => {\n const controlled = access(props.value);\n return controlled !== undefined ? controlled : internalValue();\n });\n\n // Derived states\n const isDisabled = createMemo(() => access(props.isDisabled) ?? false);\n const isReadOnly = createMemo(() => access(props.isReadOnly) ?? false);\n const isRequired = createMemo(() => access(props.isRequired) ?? false);\n const validationState = createMemo(() => access(props.validationState));\n\n // Check if value is invalid\n const isInvalid = createMemo(() => {\n const v = value();\n if (!v) return false;\n\n const minValue = access(props.minValue);\n const maxValue = access(props.maxValue);\n\n if (minValue && compareTime(v, minValue) < 0) return true;\n if (maxValue && compareTime(v, maxValue) > 0) return true;\n\n return validationState() === 'invalid';\n });\n\n // Generate segments based on granularity\n const segments = createMemo<TimeSegment[]>(() => {\n const v = value();\n const parts = placeholderParts();\n const segs: TimeSegment[] = [];\n\n // Determine format options\n const formatOptions: Intl.DateTimeFormatOptions = {\n hour: '2-digit',\n minute: '2-digit',\n hourCycle: hourCycle === 12 ? 'h12' : 'h23',\n };\n\n if (granularity === 'second') {\n formatOptions.second = '2-digit';\n }\n\n // Use a base date for formatting\n const baseDate = new Date();\n if (v) {\n baseDate.setHours(getHour(v), getMinute(v), getSecond(v));\n }\n\n const formatter = new DateFormatter(locale, formatOptions);\n const formattedParts = formatter.formatToParts(baseDate);\n\n for (const part of formattedParts) {\n const type = mapTimePartType(part.type);\n\n if (type === 'literal') {\n segs.push({\n type: 'literal',\n text: part.value,\n isEditable: false,\n isPlaceholder: false,\n placeholder: part.value,\n });\n } else if (type) {\n const segValue = getTimeSegmentValue(v, type);\n const partValue = parts[type as keyof TimeParts];\n const hasValue = v !== null || partValue !== undefined;\n\n segs.push({\n type,\n text: hasValue ? part.value : getTimePlaceholderText(type),\n value: segValue ?? partValue,\n minValue: getTimeMinValue(type, hourCycle),\n maxValue: getTimeMaxValue(type, hourCycle),\n isEditable: !isDisabled() && !isReadOnly(),\n isPlaceholder: !hasValue,\n placeholder: getTimePlaceholderText(type),\n });\n }\n }\n\n return segs;\n });\n\n // Set value with onChange callback\n const setValue = (newValue: T | null) => {\n if (isDisabled() || isReadOnly()) return;\n\n const controlled = access(props.value);\n if (controlled === undefined) {\n setInternalValue(() => newValue);\n }\n\n if (props.onChange) {\n props.onChange(newValue);\n }\n\n setPlaceholderParts({});\n };\n\n // Set a specific segment value\n const setSegment = (type: TimeSegmentType, newValue: number) => {\n if (isDisabled() || isReadOnly()) return;\n if (type === 'literal') return;\n\n const v = value();\n\n if (v) {\n const updated = updateTimePart(v, type, newValue, hourCycle);\n setValue(updated as T);\n } else {\n setPlaceholderParts((prev) => ({\n ...prev,\n [type]: newValue,\n }));\n }\n };\n\n // Increment a segment\n const incrementSegment = (type: TimeSegmentType) => {\n if (isDisabled() || isReadOnly()) return;\n if (type === 'literal') return;\n\n const v = value();\n const current = v\n ? getTimeSegmentValue(v, type)\n : placeholderParts()[type as keyof TimeParts];\n const max = getTimeMaxValue(type, hourCycle);\n const min = getTimeMinValue(type, hourCycle);\n\n if (type === 'dayPeriod') {\n // Toggle AM/PM\n const currentHour = v ? getHour(v) : (placeholderParts().hour ?? 0);\n const newHour = currentHour >= 12 ? currentHour - 12 : currentHour + 12;\n setSegment('hour', newHour);\n return;\n }\n\n const newValue = current !== undefined ? current + 1 : min;\n setSegment(type, newValue > max ? min : newValue);\n };\n\n // Decrement a segment\n const decrementSegment = (type: TimeSegmentType) => {\n if (isDisabled() || isReadOnly()) return;\n if (type === 'literal') return;\n\n const v = value();\n const current = v\n ? getTimeSegmentValue(v, type)\n : placeholderParts()[type as keyof TimeParts];\n const max = getTimeMaxValue(type, hourCycle);\n const min = getTimeMinValue(type, hourCycle);\n\n if (type === 'dayPeriod') {\n // Toggle AM/PM\n const currentHour = v ? getHour(v) : (placeholderParts().hour ?? 0);\n const newHour = currentHour >= 12 ? currentHour - 12 : currentHour + 12;\n setSegment('hour', newHour);\n return;\n }\n\n const newValue = current !== undefined ? current - 1 : max;\n setSegment(type, newValue < min ? max : newValue);\n };\n\n // Clear a segment\n const clearSegment = (type: TimeSegmentType) => {\n if (isDisabled() || isReadOnly()) return;\n\n const v = value();\n if (v) {\n setValue(null);\n } else {\n setPlaceholderParts((prev) => {\n const next = { ...prev };\n delete next[type as keyof TimeParts];\n return next;\n });\n }\n };\n\n return {\n value,\n setValue,\n segments,\n setSegment,\n incrementSegment,\n decrementSegment,\n clearSegment,\n isDisabled,\n isReadOnly,\n isRequired,\n validationState,\n granularity,\n isInvalid,\n locale,\n hourCycle,\n };\n}\n\n// ============================================\n// HELPER TYPES & FUNCTIONS\n// ============================================\n\ninterface TimeParts {\n hour?: number;\n minute?: number;\n second?: number;\n}\n\nfunction mapTimePartType(type: Intl.DateTimeFormatPartTypes): TimeSegmentType | null {\n switch (type) {\n case 'hour':\n return 'hour';\n case 'minute':\n return 'minute';\n case 'second':\n return 'second';\n case 'dayPeriod':\n return 'dayPeriod';\n case 'literal':\n return 'literal';\n default:\n return null;\n }\n}\n\nfunction getHour(time: TimeValue): number {\n if ('hour' in time) {\n return time.hour;\n }\n return 0;\n}\n\nfunction getMinute(time: TimeValue): number {\n if ('minute' in time) {\n return time.minute;\n }\n return 0;\n}\n\nfunction getSecond(time: TimeValue): number {\n if ('second' in time) {\n return time.second;\n }\n return 0;\n}\n\nfunction getTimeSegmentValue(\n time: TimeValue | null,\n type: TimeSegmentType\n): number | undefined {\n if (!time) return undefined;\n\n switch (type) {\n case 'hour':\n return getHour(time);\n case 'minute':\n return getMinute(time);\n case 'second':\n return getSecond(time);\n case 'dayPeriod':\n return getHour(time) >= 12 ? 1 : 0;\n default:\n return undefined;\n }\n}\n\nfunction getTimeMinValue(type: TimeSegmentType, hourCycle: number): number {\n switch (type) {\n case 'hour':\n return hourCycle === 12 ? 1 : 0;\n case 'minute':\n return 0;\n case 'second':\n return 0;\n case 'dayPeriod':\n return 0;\n default:\n return 0;\n }\n}\n\nfunction getTimeMaxValue(type: TimeSegmentType, hourCycle: number): number {\n switch (type) {\n case 'hour':\n return hourCycle === 12 ? 12 : 23;\n case 'minute':\n return 59;\n case 'second':\n return 59;\n case 'dayPeriod':\n return 1;\n default:\n return 0;\n }\n}\n\nfunction getTimePlaceholderText(type: TimeSegmentType): string {\n switch (type) {\n case 'hour':\n return '––';\n case 'minute':\n return '––';\n case 'second':\n return '––';\n case 'dayPeriod':\n return 'AM';\n default:\n return '';\n }\n}\n\nfunction updateTimePart(\n time: TimeValue,\n type: TimeSegmentType,\n value: number,\n hourCycle: number\n): TimeValue {\n if ('set' in time) {\n switch (type) {\n case 'hour':\n return time.set({ hour: value });\n case 'minute':\n return time.set({ minute: value });\n case 'second':\n return time.set({ second: value });\n default:\n return time;\n }\n }\n return time;\n}\n\nfunction compareTime(a: TimeValue, b: TimeValue): number {\n const aHour = getHour(a);\n const bHour = getHour(b);\n if (aHour !== bHour) return aHour - bHour;\n\n const aMinute = getMinute(a);\n const bMinute = getMinute(b);\n if (aMinute !== bMinute) return aMinute - bMinute;\n\n const aSecond = getSecond(a);\n const bSecond = getSecond(b);\n return aSecond - bSecond;\n}\n","// Calendar State\nexport {\n createCalendarState,\n type CalendarStateProps,\n type CalendarState,\n type ValidationState,\n} from './createCalendarState';\n\n// Range Calendar State\nexport {\n createRangeCalendarState,\n type RangeCalendarStateProps,\n type RangeCalendarState,\n type DateRange,\n type RangeValue,\n} from './createRangeCalendarState';\n\n// Date Field State\nexport {\n createDateFieldState,\n type DateFieldStateProps,\n type DateFieldState,\n type DateSegment,\n type DateSegmentType,\n} from './createDateFieldState';\n\n// Time Field State\nexport {\n createTimeFieldState,\n type TimeFieldStateProps,\n type TimeFieldState,\n type TimeSegment,\n type TimeSegmentType,\n type TimeValue,\n} from './createTimeFieldState';\n\n// Re-export date types from @internationalized/date\nexport type {\n CalendarDate,\n CalendarDateTime,\n ZonedDateTime,\n DateValue,\n Time,\n} from '@internationalized/date';\n\n// Re-export commonly used date utilities\nexport {\n today,\n now,\n getLocalTimeZone,\n parseDate,\n parseDateTime,\n parseTime,\n parseAbsolute,\n parseAbsoluteToLocal,\n parseZonedDateTime,\n toCalendarDate,\n toCalendarDateTime,\n toZoned,\n toTime,\n CalendarDate as CalendarDateClass,\n CalendarDateTime as CalendarDateTimeClass,\n ZonedDateTime as ZonedDateTimeClass,\n Time as TimeClass,\n DateFormatter,\n isSameDay,\n isSameMonth,\n isSameYear,\n isToday,\n isWeekend,\n startOfMonth,\n endOfMonth,\n startOfWeek,\n endOfWeek,\n startOfYear,\n endOfYear,\n getWeeksInMonth,\n getDayOfWeek,\n minDate,\n maxDate,\n} from '@internationalized/date';\n","/**\n * Grid state management for Table and GridList components.\n * Based on @react-stately/grid/useGridState.\n */\n\nimport { createSignal, createEffect, createMemo, on, type Accessor } from 'solid-js';\nimport type {\n GridState,\n GridStateOptions,\n GridCollection,\n GridNode,\n} from './types';\nimport type { Key, FocusStrategy } from '../collections/types';\n\n/**\n * Creates state management for a grid component.\n * Handles row selection, focus management, and keyboard navigation state.\n */\nexport function createGridState<T extends object, C extends GridCollection<T> = GridCollection<T>>(\n options: Accessor<GridStateOptions<T, C>>\n): GridState<T, C> {\n const getOptions = () => options();\n\n // Disabled keys as a Set\n const disabledKeys = createMemo(() => {\n const keys = getOptions().disabledKeys;\n return keys ? new Set(keys) : new Set<Key>();\n });\n\n // Focus state\n const [isFocused, setIsFocused] = createSignal(false);\n const [focusedKey, setFocusedKeyInternal] = createSignal<Key | null>(null);\n const [childFocusStrategy, setChildFocusStrategy] = createSignal<FocusStrategy | null>(null);\n const [isKeyboardNavigationDisabled, setKeyboardNavigationDisabled] = createSignal(false);\n\n // Selection state\n const [internalSelectedKeys, setInternalSelectedKeys] = createSignal<'all' | Set<Key>>(\n getInitialSelection(getOptions().defaultSelectedKeys)\n );\n const [anchorKey, setAnchorKey] = createSignal<Key | null>(null);\n\n // Computed selection\n const selectedKeys = createMemo(() => {\n const opts = getOptions();\n if (opts.selectedKeys !== undefined) {\n return normalizeSelection(opts.selectedKeys);\n }\n return internalSelectedKeys();\n });\n\n const selectionMode = createMemo(() => getOptions().selectionMode ?? 'none');\n const selectionBehavior = createMemo(() => getOptions().selectionBehavior ?? 'toggle');\n const disallowEmptySelection = createMemo(() => getOptions().disallowEmptySelection ?? false);\n\n // Focus mode handling\n const focusMode = createMemo(() => getOptions().focusMode ?? 'row');\n\n // Set focused key with focus mode awareness\n const setFocusedKey = (key: Key | null, strategy: FocusStrategy = 'first') => {\n const opts = getOptions();\n const collection = opts.collection;\n\n // If focusMode is cell and an item is focused, focus a child cell instead\n if (focusMode() === 'cell' && key != null) {\n const item = collection.getItem(key);\n if (item?.type === 'item') {\n const children = [...collection.getChildren(key)];\n if (strategy === 'last') {\n key = children[children.length - 1]?.key ?? key;\n } else {\n key = children[0]?.key ?? key;\n }\n }\n }\n\n setFocusedKeyInternal(key);\n setChildFocusStrategy(strategy);\n };\n\n // Reset focused key if the item is deleted from the collection\n let cachedCollection: C | null = null;\n\n createEffect(\n on(\n () => getOptions().collection,\n (collection) => {\n const currentFocusedKey = focusedKey();\n\n if (currentFocusedKey != null && cachedCollection && !collection.getItem(currentFocusedKey)) {\n // The focused item was deleted, find a new one to focus\n const node = cachedCollection.getItem(currentFocusedKey);\n const parentNode =\n node?.parentKey != null &&\n (node.type === 'cell' || node.type === 'rowheader' || node.type === 'column')\n ? cachedCollection.getItem(node.parentKey)\n : node;\n\n if (!parentNode) {\n setFocusedKeyInternal(null);\n cachedCollection = collection;\n return;\n }\n\n const cachedRows = cachedCollection.rows;\n const rows = collection.rows;\n const diff = cachedRows.length - rows.length;\n\n let index = Math.min(\n diff > 1 ? Math.max(parentNode.index - diff + 1, 0) : parentNode.index,\n rows.length - 1\n );\n\n let newRow: GridNode<T> | null = null;\n while (index >= 0) {\n const row = rows[index];\n if (!disabledKeys().has(row.key) && row.type !== 'headerrow') {\n newRow = row;\n break;\n }\n // Find next, not disabled row\n if (index < rows.length - 1) {\n index++;\n } else {\n // Otherwise, find previous, not disabled row\n if (index > parentNode.index) {\n index = parentNode.index;\n }\n index--;\n }\n }\n\n if (newRow) {\n const childNodes = newRow.hasChildNodes ? [...collection.getChildren(newRow.key)] : [];\n const keyToFocus =\n newRow.hasChildNodes &&\n parentNode !== node &&\n node &&\n node.index < childNodes.length\n ? childNodes[node.index].key\n : newRow.key;\n setFocusedKeyInternal(keyToFocus);\n } else {\n setFocusedKeyInternal(null);\n }\n }\n\n cachedCollection = collection;\n }\n )\n );\n\n // Selection methods\n const isSelected = (key: Key): boolean => {\n const keys = selectedKeys();\n if (keys === 'all') return true;\n return keys.has(key);\n };\n\n const isDisabled = (key: Key): boolean => {\n return disabledKeys().has(key);\n };\n\n const updateSelection = (newSelection: 'all' | Set<Key>) => {\n const opts = getOptions();\n\n // Controlled mode\n if (opts.selectedKeys !== undefined) {\n opts.onSelectionChange?.(newSelection);\n return;\n }\n\n // Uncontrolled mode\n const current = internalSelectedKeys();\n const isDifferent =\n current === 'all' ||\n newSelection === 'all' ||\n current.size !== (newSelection as Set<Key>).size ||\n ![...current].every((k) => (newSelection as Set<Key>).has(k));\n\n if (isDifferent) {\n setInternalSelectedKeys(newSelection);\n opts.onSelectionChange?.(newSelection);\n }\n };\n\n const toggleSelection = (key: Key) => {\n if (isDisabled(key)) return;\n if (selectionMode() === 'none') return;\n\n const current = selectedKeys();\n\n if (selectionMode() === 'single') {\n if (isSelected(key) && !disallowEmptySelection()) {\n updateSelection(new Set());\n } else {\n updateSelection(new Set([key]));\n }\n return;\n }\n\n // Multiple selection\n if (current === 'all') {\n // Can't toggle when all selected without knowing all keys\n return;\n }\n\n const newSelection = new Set(current);\n if (newSelection.has(key)) {\n if (newSelection.size > 1 || !disallowEmptySelection()) {\n newSelection.delete(key);\n }\n } else {\n newSelection.add(key);\n }\n\n updateSelection(newSelection);\n setAnchorKey(key);\n };\n\n const replaceSelection = (key: Key) => {\n if (isDisabled(key)) return;\n if (selectionMode() === 'none') return;\n\n updateSelection(new Set([key]));\n setAnchorKey(key);\n };\n\n const extendSelection = (toKey: Key) => {\n if (isDisabled(toKey)) return;\n if (selectionMode() !== 'multiple') {\n replaceSelection(toKey);\n return;\n }\n\n const anchor = anchorKey();\n if (!anchor) {\n replaceSelection(toKey);\n return;\n }\n\n const collection = getOptions().collection;\n const rows = collection.rows.filter((r) => r.type === 'item');\n const keys = rows.map((r) => r.key);\n const anchorIndex = keys.indexOf(anchor);\n const toIndex = keys.indexOf(toKey);\n\n if (anchorIndex === -1 || toIndex === -1) {\n replaceSelection(toKey);\n return;\n }\n\n const start = Math.min(anchorIndex, toIndex);\n const end = Math.max(anchorIndex, toIndex);\n const rangeKeys = keys.slice(start, end + 1).filter((k) => !isDisabled(k));\n\n updateSelection(new Set(rangeKeys));\n };\n\n const selectAll = () => {\n if (selectionMode() !== 'multiple') return;\n updateSelection('all');\n };\n\n const clearSelection = () => {\n if (disallowEmptySelection()) return;\n updateSelection(new Set());\n };\n\n const toggleSelectAll = () => {\n if (selectionMode() !== 'multiple') return;\n\n if (selectedKeys() === 'all') {\n clearSelection();\n } else {\n selectAll();\n }\n };\n\n return {\n get collection() {\n return getOptions().collection;\n },\n get disabledKeys() {\n return disabledKeys();\n },\n get isKeyboardNavigationDisabled() {\n return isKeyboardNavigationDisabled();\n },\n get focusedKey() {\n return focusedKey();\n },\n get childFocusStrategy() {\n return childFocusStrategy();\n },\n get isFocused() {\n return isFocused();\n },\n get selectionMode() {\n return selectionMode();\n },\n get selectedKeys() {\n return selectedKeys();\n },\n isSelected,\n isDisabled,\n setFocusedKey,\n setFocused: setIsFocused,\n toggleSelection,\n replaceSelection,\n extendSelection,\n selectAll,\n clearSelection,\n toggleSelectAll,\n setKeyboardNavigationDisabled,\n };\n}\n\n// Helper functions\nfunction getInitialSelection(defaultKeys?: 'all' | Iterable<Key>): 'all' | Set<Key> {\n if (defaultKeys === undefined) return new Set();\n return normalizeSelection(defaultKeys);\n}\n\nfunction normalizeSelection(keys: 'all' | Iterable<Key>): 'all' | Set<Key> {\n if (keys === 'all') return 'all';\n return new Set(keys);\n}\n","/**\n * Table state management for Table components.\n * Based on @react-stately/table/useTableState.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport { createGridState } from '../grid/createGridState';\nimport type { Key } from '../collections/types';\nimport type {\n TableState,\n TableStateOptions,\n TableCollection,\n SortDescriptor,\n SortDirection,\n} from './types';\n\nconst OPPOSITE_SORT_DIRECTION: Record<SortDirection, SortDirection> = {\n ascending: 'descending',\n descending: 'ascending',\n};\n\n/**\n * Creates state management for a table component.\n * Extends grid state with sorting and table-specific features.\n */\nexport function createTableState<\n T extends object,\n C extends TableCollection<T> = TableCollection<T>,\n>(options: Accessor<TableStateOptions<T, C>>): TableState<T, C> {\n const getOptions = () => options();\n\n // Create the underlying grid state\n const gridState = createGridState<T, C>(() => ({\n collection: getOptions().collection,\n disabledKeys: getOptions().disabledKeys,\n focusMode: getOptions().focusMode,\n selectionMode: getOptions().selectionMode,\n selectionBehavior: getOptions().selectionBehavior,\n disallowEmptySelection: getOptions().disallowEmptySelection,\n selectedKeys: getOptions().selectedKeys,\n defaultSelectedKeys: getOptions().defaultSelectedKeys,\n onSelectionChange: getOptions().onSelectionChange,\n }));\n\n // Memoized sort descriptor\n const sortDescriptor = createMemo<SortDescriptor | null>(() => {\n return getOptions().sortDescriptor ?? null;\n });\n\n // Show selection checkboxes\n const showSelectionCheckboxes = createMemo(() => {\n return getOptions().showSelectionCheckboxes ?? false;\n });\n\n // Sort function\n const sort = (columnKey: Key, direction?: SortDirection) => {\n const opts = getOptions();\n const currentSort = opts.sortDescriptor;\n\n // Determine direction\n let newDirection: SortDirection;\n if (direction) {\n newDirection = direction;\n } else if (currentSort?.column === columnKey) {\n // Toggle direction if sorting same column\n newDirection = OPPOSITE_SORT_DIRECTION[currentSort.direction];\n } else {\n // Default to ascending for new column\n newDirection = 'ascending';\n }\n\n opts.onSortChange?.({\n column: columnKey,\n direction: newDirection,\n });\n };\n\n return {\n // Forward grid state properties\n get collection() {\n return getOptions().collection;\n },\n get disabledKeys() {\n return gridState.disabledKeys;\n },\n get isKeyboardNavigationDisabled() {\n return gridState.isKeyboardNavigationDisabled;\n },\n get focusedKey() {\n return gridState.focusedKey;\n },\n get childFocusStrategy() {\n return gridState.childFocusStrategy;\n },\n get isFocused() {\n return gridState.isFocused;\n },\n get selectionMode() {\n return gridState.selectionMode;\n },\n get selectedKeys() {\n return gridState.selectedKeys;\n },\n\n // Grid state methods\n isSelected: gridState.isSelected,\n isDisabled: gridState.isDisabled,\n setFocusedKey: gridState.setFocusedKey,\n setFocused: gridState.setFocused,\n toggleSelection: gridState.toggleSelection,\n replaceSelection: gridState.replaceSelection,\n extendSelection: gridState.extendSelection,\n selectAll: gridState.selectAll,\n clearSelection: gridState.clearSelection,\n toggleSelectAll: gridState.toggleSelectAll,\n setKeyboardNavigationDisabled: gridState.setKeyboardNavigationDisabled,\n\n // Table-specific properties\n get showSelectionCheckboxes() {\n return showSelectionCheckboxes();\n },\n get sortDescriptor() {\n return sortDescriptor();\n },\n sort,\n };\n}\n","/**\n * TableCollection - A collection class for table data.\n * Based on @react-stately/table/TableCollection.\n */\n\nimport type { Key } from '../collections/types';\nimport type { GridNode, GridNodeType } from '../grid/types';\nimport type {\n TableCollection as ITableCollection,\n TableCollectionOptions,\n ColumnDefinition,\n RowDefinition,\n} from './types';\n\n/**\n * Creates a table collection from column and row definitions.\n */\nexport class TableCollection<T = unknown> implements ITableCollection<T> {\n private _columns: GridNode<T>[] = [];\n private _rows: GridNode<T>[] = [];\n private _headerRows: GridNode<T>[] = [];\n private _body: GridNode<T>;\n private _head: GridNode<T> | undefined;\n private _keyMap: Map<Key, GridNode<T>> = new Map();\n private _rowHeaderColumnKeys: Set<Key>;\n private _size: number = 0;\n\n constructor(options: TableCollectionOptions<T>) {\n const {\n columns,\n rows,\n getKey,\n getTextValue,\n showSelectionCheckboxes = false,\n rowHeaderColumnKeys,\n } = options;\n\n // Build columns\n this._columns = this.buildColumns(columns, showSelectionCheckboxes);\n\n // Determine row header column keys\n this._rowHeaderColumnKeys = rowHeaderColumnKeys ?? this.getDefaultRowHeaderColumnKeys();\n\n // Build header rows\n this._headerRows = this.buildHeaderRows();\n\n // Build head node\n if (this._headerRows.length > 0) {\n this._head = {\n type: 'headerrow' as GridNodeType,\n key: 'header',\n index: 0,\n level: 0,\n hasChildNodes: true,\n childNodes: this._headerRows,\n value: null,\n textValue: '',\n };\n this._keyMap.set('header', this._head);\n }\n\n // Build body rows\n const bodyRows = this.buildRows(rows, getKey, getTextValue);\n this._size = bodyRows.length;\n\n // Build body node\n this._body = {\n type: 'item' as GridNodeType,\n key: 'body',\n index: this._headerRows.length,\n level: 0,\n hasChildNodes: true,\n childNodes: bodyRows,\n value: null,\n textValue: '',\n };\n this._keyMap.set('body', this._body);\n\n // Combine all rows\n this._rows = [...this._headerRows, ...bodyRows];\n }\n\n private buildColumns(\n columns: ColumnDefinition<T>[],\n showSelectionCheckboxes: boolean\n ): GridNode<T>[] {\n const result: GridNode<T>[] = [];\n let colIndex = 0;\n\n // Add selection column if needed\n if (showSelectionCheckboxes) {\n const selectionColumn: GridNode<T> = {\n type: 'column' as GridNodeType,\n key: '__selection__',\n index: colIndex,\n column: 0,\n level: 0,\n hasChildNodes: false,\n childNodes: [],\n value: null,\n textValue: 'Selection',\n };\n result.push(selectionColumn);\n this._keyMap.set(selectionColumn.key, selectionColumn);\n colIndex++;\n }\n\n // Build user columns\n for (const col of columns) {\n const node = this.buildColumnNode(col, colIndex);\n result.push(node);\n colIndex++;\n }\n\n return result;\n }\n\n private buildColumnNode(col: ColumnDefinition<T>, index: number): GridNode<T> {\n const node: GridNode<T> = {\n type: 'column' as GridNodeType,\n key: col.key,\n index,\n column: index,\n level: 0,\n hasChildNodes: (col.children?.length ?? 0) > 0,\n childNodes: [],\n value: null,\n textValue: col.textValue ?? col.name ?? String(col.key),\n };\n\n // Build child columns if present (for column groups)\n if (col.children && col.children.length > 0) {\n let childIndex = 0;\n for (const child of col.children) {\n const childNode = this.buildColumnNode(child, childIndex);\n childNode.parentKey = col.key;\n childNode.level = 1;\n node.childNodes.push(childNode);\n childIndex++;\n }\n }\n\n this._keyMap.set(node.key, node);\n return node;\n }\n\n private getDefaultRowHeaderColumnKeys(): Set<Key> {\n // Default to first non-selection column as row header\n for (const col of this._columns) {\n if (col.key !== '__selection__') {\n return new Set([col.key]);\n }\n }\n return new Set();\n }\n\n private buildHeaderRows(): GridNode<T>[] {\n if (this._columns.length === 0) {\n return [];\n }\n\n // Build a single header row containing all columns\n const headerCells: GridNode<T>[] = this._columns.map((col, index) => ({\n type: 'column' as GridNodeType,\n key: `header-${col.key}`,\n index,\n column: index,\n level: 1,\n hasChildNodes: false,\n childNodes: [],\n value: null,\n textValue: col.textValue,\n parentKey: 'headerrow-0',\n }));\n\n const headerRow: GridNode<T> = {\n type: 'headerrow' as GridNodeType,\n key: 'headerrow-0',\n index: 0,\n rowIndex: 0,\n level: 0,\n hasChildNodes: true,\n childNodes: headerCells,\n value: null,\n textValue: '',\n };\n\n this._keyMap.set(headerRow.key, headerRow);\n headerCells.forEach((cell) => this._keyMap.set(cell.key, cell));\n\n return [headerRow];\n }\n\n private buildRows(\n rows: RowDefinition<T>[] | T[],\n getKey?: (item: T) => Key,\n getTextValue?: (item: T, column: ColumnDefinition<T>) => string\n ): GridNode<T>[] {\n const result: GridNode<T>[] = [];\n const rowIndexOffset = this._headerRows.length;\n\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n const isRowDef = this.isRowDefinition(row);\n\n const key = isRowDef ? row.key : getKey?.(row as T) ?? i;\n const value = isRowDef ? row.value : (row as T);\n const textValue = isRowDef ? row.textValue : undefined;\n\n // Build cells for this row\n const cells: GridNode<T>[] = this._columns.map((col, colIndex) => {\n const cellKey = `${key}-${col.key}`;\n const cellTextValue =\n col.key === '__selection__'\n ? 'Selection'\n : getTextValue\n ? getTextValue(value, { key: col.key } as ColumnDefinition<T>)\n : String((value as Record<string, unknown>)?.[String(col.key)] ?? '');\n\n const cell: GridNode<T> = {\n type: this._rowHeaderColumnKeys.has(col.key)\n ? ('rowheader' as GridNodeType)\n : ('cell' as GridNodeType),\n key: cellKey,\n index: colIndex,\n column: colIndex,\n level: 1,\n hasChildNodes: false,\n childNodes: [],\n value,\n textValue: cellTextValue,\n parentKey: key,\n };\n\n this._keyMap.set(cellKey, cell);\n return cell;\n });\n\n const rowNode: GridNode<T> = {\n type: 'item' as GridNodeType,\n key,\n index: i,\n rowIndex: rowIndexOffset + i,\n level: 0,\n hasChildNodes: true,\n childNodes: cells,\n value,\n textValue: textValue ?? cells.map((c) => c.textValue).join(' '),\n };\n\n this._keyMap.set(key, rowNode);\n result.push(rowNode);\n }\n\n return result;\n }\n\n private isRowDefinition(row: unknown): row is RowDefinition<T> {\n return (\n typeof row === 'object' &&\n row !== null &&\n 'key' in row &&\n 'value' in row\n );\n }\n\n // Collection interface implementation\n get size(): number {\n return this._size;\n }\n\n get rows(): GridNode<T>[] {\n return this._rows;\n }\n\n get columns(): GridNode<T>[] {\n return this._columns;\n }\n\n get headerRows(): GridNode<T>[] {\n return this._headerRows;\n }\n\n get head(): GridNode<T> | undefined {\n return this._head;\n }\n\n get body(): GridNode<T> {\n return this._body;\n }\n\n get rowCount(): number {\n return this._rows.length;\n }\n\n get columnCount(): number {\n return this._columns.length;\n }\n\n get rowHeaderColumnKeys(): Set<Key> {\n return this._rowHeaderColumnKeys;\n }\n\n getKeys(): Iterable<Key> {\n return this._keyMap.keys();\n }\n\n getItem(key: Key): GridNode<T> | null {\n return this._keyMap.get(key) ?? null;\n }\n\n at(index: number): GridNode<T> | null {\n const bodyRows = this._body.childNodes;\n if (index < 0 || index >= bodyRows.length) {\n return null;\n }\n return bodyRows[index];\n }\n\n getChildren(key: Key): Iterable<GridNode<T>> {\n const node = this._keyMap.get(key);\n return node?.childNodes ?? [];\n }\n\n getTextValue(key: Key): string {\n const node = this._keyMap.get(key);\n return node?.textValue ?? '';\n }\n\n getCell(rowKey: Key, columnKey: Key): GridNode<T> | null {\n const cellKey = `${rowKey}-${columnKey}`;\n return this._keyMap.get(cellKey) ?? null;\n }\n\n getFirstKey(): Key | null {\n // Return first body row key\n const bodyRows = this._body.childNodes;\n return bodyRows.length > 0 ? bodyRows[0].key : null;\n }\n\n getLastKey(): Key | null {\n // Return last body row key\n const bodyRows = this._body.childNodes;\n return bodyRows.length > 0 ? bodyRows[bodyRows.length - 1].key : null;\n }\n\n getKeyBefore(key: Key): Key | null {\n const node = this._keyMap.get(key);\n if (!node) return null;\n\n // Find in body rows\n const bodyRows = this._body.childNodes;\n const index = bodyRows.findIndex((r) => r.key === key);\n if (index > 0) {\n return bodyRows[index - 1].key;\n }\n return null;\n }\n\n getKeyAfter(key: Key): Key | null {\n const node = this._keyMap.get(key);\n if (!node) return null;\n\n // Find in body rows\n const bodyRows = this._body.childNodes;\n const index = bodyRows.findIndex((r) => r.key === key);\n if (index >= 0 && index < bodyRows.length - 1) {\n return bodyRows[index + 1].key;\n }\n return null;\n }\n\n *[Symbol.iterator](): Iterator<GridNode<T>> {\n // Only iterate body rows, not header rows\n for (const row of this._body.childNodes) {\n yield row;\n }\n }\n}\n\n/**\n * Creates a table collection from options.\n */\nexport function createTableCollection<T>(\n options: TableCollectionOptions<T>\n): TableCollection<T> {\n return new TableCollection(options);\n}\n","/**\n * Tree state management for Tree components.\n * Based on @react-stately/tree/useTreeState.\n *\n * Manages expansion state, selection, and focus for hierarchical tree data.\n */\n\nimport { createSignal, createEffect, createMemo, on, type Accessor } from 'solid-js';\nimport type {\n TreeState,\n TreeStateOptions,\n TreeCollection,\n TreeNode,\n} from './types';\nimport type { Key, FocusStrategy } from '../collections/types';\n\n/**\n * Creates state management for a tree component.\n * Handles expansion, selection, focus management, and keyboard navigation state.\n */\nexport function createTreeState<T extends object, C extends TreeCollection<T> = TreeCollection<T>>(\n options: Accessor<TreeStateOptions<T, C>>\n): TreeState<T, C> {\n const getOptions = () => options();\n\n // Disabled keys as a Set\n const disabledKeys = createMemo(() => {\n const keys = getOptions().disabledKeys;\n return keys ? new Set(keys) : new Set<Key>();\n });\n\n // Expansion state (uncontrolled)\n const [internalExpandedKeys, setInternalExpandedKeys] = createSignal<Set<Key>>(\n getInitialExpandedKeys(getOptions().defaultExpandedKeys)\n );\n\n // Computed expanded keys (controlled or uncontrolled)\n const expandedKeys = createMemo(() => {\n const opts = getOptions();\n if (opts.expandedKeys !== undefined) {\n return new Set(opts.expandedKeys);\n }\n return internalExpandedKeys();\n });\n\n // Collection - rebuilt when expanded keys change\n const collection = createMemo(() => {\n const opts = getOptions();\n return opts.collectionFactory(expandedKeys());\n });\n\n // Focus state\n const [isFocused, setIsFocused] = createSignal(false);\n const [focusedKey, setFocusedKeyInternal] = createSignal<Key | null>(null);\n const [childFocusStrategy, setChildFocusStrategy] = createSignal<FocusStrategy | null>(null);\n const [isKeyboardNavigationDisabled, setKeyboardNavigationDisabled] = createSignal(false);\n\n // Selection state\n const [internalSelectedKeys, setInternalSelectedKeys] = createSignal<'all' | Set<Key>>(\n getInitialSelection(getOptions().defaultSelectedKeys)\n );\n const [anchorKey, setAnchorKey] = createSignal<Key | null>(null);\n\n // Computed selection\n const selectedKeys = createMemo(() => {\n const opts = getOptions();\n if (opts.selectedKeys !== undefined) {\n return normalizeSelection(opts.selectedKeys);\n }\n return internalSelectedKeys();\n });\n\n const selectionMode = createMemo(() => getOptions().selectionMode ?? 'none');\n const selectionBehavior = createMemo(() => getOptions().selectionBehavior ?? 'toggle');\n const disallowEmptySelection = createMemo(() => getOptions().disallowEmptySelection ?? false);\n const disabledBehavior = createMemo(() => getOptions().disabledBehavior ?? 'all');\n\n // Set focused key\n const setFocusedKey = (key: Key | null, strategy: FocusStrategy = 'first') => {\n setFocusedKeyInternal(key);\n setChildFocusStrategy(strategy);\n };\n\n // Reset focused key if the item is removed from visible collection\n let cachedCollection: C | null = null;\n\n createEffect(\n on(collection, (coll) => {\n const currentFocusedKey = focusedKey();\n\n if (currentFocusedKey != null && cachedCollection) {\n // Check if the focused item is still visible\n const visibleKeys = [...coll.getKeys()];\n if (!visibleKeys.includes(currentFocusedKey)) {\n // The focused item was collapsed or removed, find a new one to focus\n // Try to find the parent and focus it\n const node = cachedCollection.getItem(currentFocusedKey);\n if (node?.parentKey != null) {\n const parent = coll.getItem(node.parentKey);\n if (parent && visibleKeys.includes(parent.key)) {\n setFocusedKeyInternal(parent.key);\n cachedCollection = coll;\n return;\n }\n }\n\n // Otherwise, find the nearest visible sibling or previous item\n const rows = coll.rows;\n if (rows.length > 0) {\n // Find the closest item to where the focused item was\n const cachedNode = cachedCollection.getItem(currentFocusedKey);\n if (cachedNode?.rowIndex !== undefined) {\n const newIndex = Math.min(cachedNode.rowIndex, rows.length - 1);\n const newNode = rows[newIndex];\n if (newNode && !disabledKeys().has(newNode.key)) {\n setFocusedKeyInternal(newNode.key);\n cachedCollection = coll;\n return;\n }\n }\n // Fall back to first non-disabled item\n for (const row of rows) {\n if (!disabledKeys().has(row.key)) {\n setFocusedKeyInternal(row.key);\n break;\n }\n }\n } else {\n setFocusedKeyInternal(null);\n }\n }\n }\n\n cachedCollection = coll;\n })\n );\n\n // Selection methods\n const isSelected = (key: Key): boolean => {\n const keys = selectedKeys();\n if (keys === 'all') return true;\n return keys.has(key);\n };\n\n const isDisabled = (key: Key): boolean => {\n return disabledKeys().has(key);\n };\n\n const isExpanded = (key: Key): boolean => {\n return expandedKeys().has(key);\n };\n\n const updateSelection = (newSelection: 'all' | Set<Key>) => {\n const opts = getOptions();\n\n // Controlled mode\n if (opts.selectedKeys !== undefined) {\n opts.onSelectionChange?.(newSelection);\n return;\n }\n\n // Uncontrolled mode\n const current = internalSelectedKeys();\n const isDifferent =\n current === 'all' ||\n newSelection === 'all' ||\n current.size !== (newSelection as Set<Key>).size ||\n ![...current].every((k) => (newSelection as Set<Key>).has(k));\n\n if (isDifferent) {\n setInternalSelectedKeys(newSelection);\n opts.onSelectionChange?.(newSelection);\n }\n };\n\n const toggleSelection = (key: Key) => {\n if (isDisabled(key) && disabledBehavior() === 'all') return;\n if (selectionMode() === 'none') return;\n\n const current = selectedKeys();\n\n if (selectionMode() === 'single') {\n if (isSelected(key) && !disallowEmptySelection()) {\n updateSelection(new Set());\n } else {\n updateSelection(new Set([key]));\n }\n return;\n }\n\n // Multiple selection\n if (current === 'all') {\n // Can't toggle when all selected without knowing all keys\n return;\n }\n\n const newSelection = new Set(current);\n if (newSelection.has(key)) {\n if (newSelection.size > 1 || !disallowEmptySelection()) {\n newSelection.delete(key);\n }\n } else {\n newSelection.add(key);\n }\n\n updateSelection(newSelection);\n setAnchorKey(key);\n };\n\n const replaceSelection = (key: Key) => {\n if (isDisabled(key) && disabledBehavior() === 'all') return;\n if (selectionMode() === 'none') return;\n\n updateSelection(new Set([key]));\n setAnchorKey(key);\n };\n\n const extendSelection = (toKey: Key) => {\n if (isDisabled(toKey) && disabledBehavior() === 'all') return;\n if (selectionMode() !== 'multiple') {\n replaceSelection(toKey);\n return;\n }\n\n const anchor = anchorKey();\n if (!anchor) {\n replaceSelection(toKey);\n return;\n }\n\n const coll = collection();\n const rows = coll.rows.filter((r) => r.type === 'item');\n const keys = rows.map((r) => r.key);\n const anchorIndex = keys.indexOf(anchor);\n const toIndex = keys.indexOf(toKey);\n\n if (anchorIndex === -1 || toIndex === -1) {\n replaceSelection(toKey);\n return;\n }\n\n const start = Math.min(anchorIndex, toIndex);\n const end = Math.max(anchorIndex, toIndex);\n const rangeKeys = keys.slice(start, end + 1).filter((k) => !isDisabled(k));\n\n updateSelection(new Set(rangeKeys));\n };\n\n const selectAll = () => {\n if (selectionMode() !== 'multiple') return;\n updateSelection('all');\n };\n\n const clearSelection = () => {\n if (disallowEmptySelection()) return;\n updateSelection(new Set());\n };\n\n const toggleSelectAll = () => {\n if (selectionMode() !== 'multiple') return;\n\n if (selectedKeys() === 'all') {\n clearSelection();\n } else {\n selectAll();\n }\n };\n\n // Expansion methods\n const updateExpandedKeys = (newKeys: Set<Key>) => {\n const opts = getOptions();\n\n // Controlled mode\n if (opts.expandedKeys !== undefined) {\n opts.onExpandedChange?.(newKeys);\n return;\n }\n\n // Uncontrolled mode\n setInternalExpandedKeys(newKeys);\n opts.onExpandedChange?.(newKeys);\n };\n\n const toggleKey = (key: Key) => {\n const node = collection().getItem(key);\n if (!node || !node.isExpandable) return;\n if (isDisabled(key) && disabledBehavior() === 'all') return;\n\n const current = expandedKeys();\n const newKeys = new Set(current);\n\n if (newKeys.has(key)) {\n newKeys.delete(key);\n } else {\n newKeys.add(key);\n }\n\n updateExpandedKeys(newKeys);\n };\n\n const expandKey = (key: Key) => {\n const node = collection().getItem(key);\n if (!node || !node.isExpandable) return;\n if (isDisabled(key) && disabledBehavior() === 'all') return;\n\n const current = expandedKeys();\n if (current.has(key)) return;\n\n const newKeys = new Set(current);\n newKeys.add(key);\n updateExpandedKeys(newKeys);\n };\n\n const collapseKey = (key: Key) => {\n const node = collection().getItem(key);\n if (!node || !node.isExpandable) return;\n if (isDisabled(key) && disabledBehavior() === 'all') return;\n\n const current = expandedKeys();\n if (!current.has(key)) return;\n\n const newKeys = new Set(current);\n newKeys.delete(key);\n updateExpandedKeys(newKeys);\n };\n\n const setExpandedKeys = (keys: Set<Key>) => {\n updateExpandedKeys(keys);\n };\n\n return {\n get collection() {\n return collection();\n },\n get disabledKeys() {\n return disabledKeys();\n },\n get expandedKeys() {\n return expandedKeys();\n },\n get isKeyboardNavigationDisabled() {\n return isKeyboardNavigationDisabled();\n },\n get focusedKey() {\n return focusedKey();\n },\n get childFocusStrategy() {\n return childFocusStrategy();\n },\n get isFocused() {\n return isFocused();\n },\n get selectionMode() {\n return selectionMode();\n },\n get selectedKeys() {\n return selectedKeys();\n },\n isSelected,\n isDisabled,\n isExpanded,\n setFocusedKey,\n setFocused: setIsFocused,\n toggleSelection,\n replaceSelection,\n extendSelection,\n selectAll,\n clearSelection,\n toggleSelectAll,\n toggleKey,\n expandKey,\n collapseKey,\n setExpandedKeys,\n setKeyboardNavigationDisabled,\n };\n}\n\n// Helper functions\nfunction getInitialSelection(defaultKeys?: 'all' | Iterable<Key>): 'all' | Set<Key> {\n if (defaultKeys === undefined) return new Set();\n return normalizeSelection(defaultKeys);\n}\n\nfunction normalizeSelection(keys: 'all' | Iterable<Key>): 'all' | Set<Key> {\n if (keys === 'all') return 'all';\n return new Set(keys);\n}\n\nfunction getInitialExpandedKeys(defaultKeys?: Iterable<Key>): Set<Key> {\n if (defaultKeys === undefined) return new Set();\n return new Set(defaultKeys);\n}\n","/**\n * TreeCollection implementation.\n * Based on @react-stately/tree/TreeCollection.\n *\n * A flattened view of tree nodes that respects expanded state.\n * Only visible nodes (root + expanded children) are included in iteration.\n */\n\nimport type { Key } from '../collections/types';\nimport type { TreeCollection as ITreeCollection, TreeNode, TreeItemData } from './types';\n\n/**\n * Creates a TreeCollection from hierarchical data.\n * The collection is flattened based on expanded keys.\n */\nexport class TreeCollection<T> implements ITreeCollection<T> {\n private keyMap: Map<Key, TreeNode<T>> = new Map();\n private visibleKeys: Key[] = [];\n private _rows: TreeNode<T>[] = [];\n\n constructor(\n items: TreeItemData<T>[],\n expandedKeys: Set<Key>\n ) {\n this.buildCollection(items, expandedKeys);\n }\n\n private buildCollection(items: TreeItemData<T>[], expandedKeys: Set<Key>): void {\n let globalIndex = 0;\n\n const visit = (\n item: TreeItemData<T>,\n level: number,\n parentKey: Key | null,\n indexInParent: number\n ): TreeNode<T> => {\n const hasChildren = item.children && item.children.length > 0;\n const isExpanded = hasChildren && expandedKeys.has(item.key);\n\n // Build child nodes first (even if not visible, for the map)\n const childNodes: TreeNode<T>[] = [];\n if (hasChildren && item.children) {\n for (let i = 0; i < item.children.length; i++) {\n const childNode = visit(item.children[i], level + 1, item.key, i);\n childNodes.push(childNode);\n }\n }\n\n const node: TreeNode<T> = {\n type: 'item',\n key: item.key,\n value: item.value,\n textValue: item.textValue || String(item.key),\n level,\n index: indexInParent,\n parentKey,\n hasChildNodes: hasChildren || false,\n childNodes,\n isDisabled: item.isDisabled,\n isExpandable: hasChildren,\n isExpanded,\n };\n\n // Always add to keyMap (for getItem lookups)\n this.keyMap.set(item.key, node);\n\n return node;\n };\n\n // First pass: build all nodes\n const rootNodes: TreeNode<T>[] = [];\n for (let i = 0; i < items.length; i++) {\n const node = visit(items[i], 0, null, i);\n rootNodes.push(node);\n }\n\n // Second pass: build visible rows list\n const addVisibleNodes = (nodes: TreeNode<T>[]): void => {\n for (const node of nodes) {\n // Update the row index for visible nodes\n node.rowIndex = globalIndex++;\n this._rows.push(node);\n this.visibleKeys.push(node.key);\n\n // Add children if expanded\n if (node.isExpanded && node.childNodes.length > 0) {\n addVisibleNodes(node.childNodes);\n }\n }\n };\n\n addVisibleNodes(rootNodes);\n }\n\n // Collection properties\n\n get size(): number {\n return this.visibleKeys.length;\n }\n\n get rows(): TreeNode<T>[] {\n return this._rows;\n }\n\n get rowCount(): number {\n return this._rows.length;\n }\n\n // Collection methods\n\n getKeys(): Iterable<Key> {\n return this.visibleKeys;\n }\n\n getItem(key: Key): TreeNode<T> | null {\n return this.keyMap.get(key) ?? null;\n }\n\n at(index: number): TreeNode<T> | null {\n if (index < 0 || index >= this._rows.length) {\n return null;\n }\n return this._rows[index];\n }\n\n getKeyBefore(key: Key): Key | null {\n const index = this.visibleKeys.indexOf(key);\n if (index <= 0) return null;\n return this.visibleKeys[index - 1];\n }\n\n getKeyAfter(key: Key): Key | null {\n const index = this.visibleKeys.indexOf(key);\n if (index < 0 || index >= this.visibleKeys.length - 1) return null;\n return this.visibleKeys[index + 1];\n }\n\n getFirstKey(): Key | null {\n return this.visibleKeys[0] ?? null;\n }\n\n getLastKey(): Key | null {\n return this.visibleKeys[this.visibleKeys.length - 1] ?? null;\n }\n\n getChildren(key: Key): Iterable<TreeNode<T>> {\n const node = this.keyMap.get(key);\n return node?.childNodes ?? [];\n }\n\n getTextValue(key: Key): string {\n const node = this.keyMap.get(key);\n return node?.textValue ?? '';\n }\n\n getParentKey(key: Key): Key | null {\n const node = this.keyMap.get(key);\n return node?.parentKey ?? null;\n }\n\n [Symbol.iterator](): Iterator<TreeNode<T>> {\n return this._rows[Symbol.iterator]();\n }\n}\n\n/**\n * Factory function to create a TreeCollection.\n * Useful for the collectionFactory pattern in TreeStateOptions.\n */\nexport function createTreeCollection<T>(\n items: TreeItemData<T>[],\n expandedKeys: Set<Key>\n): TreeCollection<T> {\n return new TreeCollection(items, expandedKeys);\n}\n","/**\n * Color class implementation.\n * Based on @react-stately/color.\n *\n * Provides color manipulation, conversion, and formatting.\n */\n\nimport type {\n Color,\n ColorFormat,\n ColorSpace,\n ColorChannel,\n ColorChannelRange,\n ColorAxes,\n RGBColor,\n HSLColor,\n HSBColor,\n} from './types';\n\n// Channel ranges\nconst RGB_CHANNEL_RANGE: ColorChannelRange = {\n minValue: 0,\n maxValue: 255,\n step: 1,\n pageSize: 17,\n};\n\nconst ALPHA_CHANNEL_RANGE: ColorChannelRange = {\n minValue: 0,\n maxValue: 1,\n step: 0.01,\n pageSize: 0.1,\n};\n\nconst HUE_CHANNEL_RANGE: ColorChannelRange = {\n minValue: 0,\n maxValue: 360,\n step: 1,\n pageSize: 15,\n};\n\nconst PERCENT_CHANNEL_RANGE: ColorChannelRange = {\n minValue: 0,\n maxValue: 100,\n step: 1,\n pageSize: 10,\n};\n\n// Channel names (English only for now)\nconst CHANNEL_NAMES: Record<ColorChannel, string> = {\n hue: 'Hue',\n saturation: 'Saturation',\n brightness: 'Brightness',\n lightness: 'Lightness',\n red: 'Red',\n green: 'Green',\n blue: 'Blue',\n alpha: 'Alpha',\n};\n\n// Hue names for color naming\nconst HUE_NAMES: Array<{ max: number; name: string }> = [\n { max: 15, name: 'pink' },\n { max: 48, name: 'red' },\n { max: 94, name: 'orange' },\n { max: 135, name: 'yellow' },\n { max: 175, name: 'green' },\n { max: 264, name: 'cyan' },\n { max: 284, name: 'blue' },\n { max: 320, name: 'purple' },\n { max: 349, name: 'magenta' },\n { max: 360, name: 'pink' },\n];\n\n/**\n * Clamp a value to a range.\n */\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Round to fixed decimal places.\n */\nfunction toFixed(value: number, decimals: number): number {\n return Math.round(value * Math.pow(10, decimals)) / Math.pow(10, decimals);\n}\n\n/**\n * Convert RGB to HSL.\n */\nfunction rgbToHsl(r: number, g: number, b: number): { h: number; s: number; l: number } {\n r /= 255;\n g /= 255;\n b /= 255;\n\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let h = 0;\n let s = 0;\n const l = (max + min) / 2;\n\n if (max !== min) {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\n switch (max) {\n case r:\n h = ((g - b) / d + (g < b ? 6 : 0)) / 6;\n break;\n case g:\n h = ((b - r) / d + 2) / 6;\n break;\n case b:\n h = ((r - g) / d + 4) / 6;\n break;\n }\n }\n\n return {\n h: Math.round(h * 360),\n s: Math.round(s * 100),\n l: Math.round(l * 100),\n };\n}\n\n/**\n * Convert HSL to RGB.\n */\nfunction hslToRgb(h: number, s: number, l: number): { r: number; g: number; b: number } {\n h /= 360;\n s /= 100;\n l /= 100;\n\n let r: number, g: number, b: number;\n\n if (s === 0) {\n r = g = b = l;\n } else {\n const hue2rgb = (p: number, q: number, t: number) => {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n };\n\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n\n return {\n r: Math.round(r * 255),\n g: Math.round(g * 255),\n b: Math.round(b * 255),\n };\n}\n\n/**\n * Convert RGB to HSB.\n */\nfunction rgbToHsb(r: number, g: number, b: number): { h: number; s: number; b: number } {\n r /= 255;\n g /= 255;\n b /= 255;\n\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let h = 0;\n const v = max;\n const d = max - min;\n const s = max === 0 ? 0 : d / max;\n\n if (max !== min) {\n switch (max) {\n case r:\n h = ((g - b) / d + (g < b ? 6 : 0)) / 6;\n break;\n case g:\n h = ((b - r) / d + 2) / 6;\n break;\n case b:\n h = ((r - g) / d + 4) / 6;\n break;\n }\n }\n\n return {\n h: Math.round(h * 360),\n s: Math.round(s * 100),\n b: Math.round(v * 100),\n };\n}\n\n/**\n * Convert HSB to RGB.\n */\nfunction hsbToRgb(h: number, s: number, b: number): { r: number; g: number; b: number } {\n h /= 360;\n s /= 100;\n b /= 100;\n\n let r: number, g: number, bl: number;\n\n const i = Math.floor(h * 6);\n const f = h * 6 - i;\n const p = b * (1 - s);\n const q = b * (1 - f * s);\n const t = b * (1 - (1 - f) * s);\n\n switch (i % 6) {\n case 0:\n r = b;\n g = t;\n bl = p;\n break;\n case 1:\n r = q;\n g = b;\n bl = p;\n break;\n case 2:\n r = p;\n g = b;\n bl = t;\n break;\n case 3:\n r = p;\n g = q;\n bl = b;\n break;\n case 4:\n r = t;\n g = p;\n bl = b;\n break;\n default:\n r = b;\n g = p;\n bl = q;\n break;\n }\n\n return {\n r: Math.round(r * 255),\n g: Math.round(g * 255),\n b: Math.round(bl * 255),\n };\n}\n\n/**\n * Get hue name from hue angle.\n */\nfunction getHueNameFromAngle(hue: number): string {\n for (const { max, name } of HUE_NAMES) {\n if (hue <= max) {\n return name;\n }\n }\n return 'pink';\n}\n\n/**\n * Get a human-readable color name based on RGB values.\n */\nfunction getColorNameFromRgb(r: number, g: number, b: number, alpha: number): string {\n // Convert to HSL for analysis\n const { h, s, l } = rgbToHsl(r, g, b);\n\n // Handle edge cases\n if (l >= 100) {\n return alpha < 1 ? `white ${Math.round(alpha * 100)}% transparent` : 'white';\n }\n if (l <= 0) {\n return alpha < 1 ? `black ${Math.round(alpha * 100)}% transparent` : 'black';\n }\n\n // Build color name\n const parts: string[] = [];\n\n // Lightness descriptor\n if (l < 30) {\n parts.push('very dark');\n } else if (l < 55) {\n parts.push('dark');\n } else if (l > 85) {\n parts.push('very light');\n } else if (l > 70) {\n parts.push('light');\n }\n\n // Saturation/chroma descriptor\n if (s < 10) {\n parts.push('gray');\n } else if (s < 30) {\n parts.push('grayish');\n } else if (s > 80) {\n parts.push('vibrant');\n }\n\n // Hue name (skip if gray)\n if (s >= 10) {\n let hueName = getHueNameFromAngle(h);\n\n // Special cases\n if (hueName === 'orange' && l < 68) {\n hueName = 'brown';\n }\n if (hueName === 'yellow' && l < 85 && s > 50) {\n hueName = 'yellow green';\n }\n\n parts.push(hueName);\n }\n\n let name = parts.join(' ');\n\n // Add transparency\n if (alpha < 1) {\n name += ` ${Math.round(alpha * 100)}% transparent`;\n }\n\n return name || 'color';\n}\n\n/**\n * RGB Color implementation.\n */\nclass RGBColorImpl implements Color {\n private red: number;\n private green: number;\n private blue: number;\n private alpha: number;\n\n constructor(red: number, green: number, blue: number, alpha: number = 1) {\n this.red = clamp(Math.round(red), 0, 255);\n this.green = clamp(Math.round(green), 0, 255);\n this.blue = clamp(Math.round(blue), 0, 255);\n this.alpha = clamp(toFixed(alpha, 2), 0, 1);\n }\n\n toFormat(format: ColorFormat): Color {\n switch (format) {\n case 'hex':\n case 'hexa':\n case 'rgb':\n case 'rgba':\n return this.clone();\n case 'hsl':\n case 'hsla': {\n const { h, s, l } = rgbToHsl(this.red, this.green, this.blue);\n return new HSLColorImpl(h, s, l, this.alpha);\n }\n case 'hsb':\n case 'hsba': {\n const { h, s, b } = rgbToHsb(this.red, this.green, this.blue);\n return new HSBColorImpl(h, s, b, this.alpha);\n }\n default:\n throw new Error(`Unsupported format: ${format}`);\n }\n }\n\n toString(format?: ColorFormat | 'css'): string {\n const f = format ?? 'css';\n\n switch (f) {\n case 'hex':\n return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue.toString(16).padStart(2, '0')}`;\n case 'hexa':\n return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue.toString(16).padStart(2, '0')}${Math.round(this.alpha * 255).toString(16).padStart(2, '0')}`;\n case 'rgb':\n return `rgb(${this.red}, ${this.green}, ${this.blue})`;\n case 'rgba':\n case 'css':\n return this.alpha === 1\n ? `rgb(${this.red}, ${this.green}, ${this.blue})`\n : `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;\n default:\n return this.toFormat(f as ColorFormat).toString(f);\n }\n }\n\n clone(): Color {\n return new RGBColorImpl(this.red, this.green, this.blue, this.alpha);\n }\n\n toHexInt(): number {\n return (this.red << 16) | (this.green << 8) | this.blue;\n }\n\n getChannelValue(channel: ColorChannel): number {\n switch (channel) {\n case 'red':\n return this.red;\n case 'green':\n return this.green;\n case 'blue':\n return this.blue;\n case 'alpha':\n return this.alpha;\n // Cross-color-space channels - convert to HSB\n case 'hue':\n case 'saturation':\n case 'brightness':\n return this.toFormat('hsb').getChannelValue(channel);\n case 'lightness':\n return this.toFormat('hsl').getChannelValue(channel);\n default:\n throw new Error(`Invalid channel: ${channel}`);\n }\n }\n\n withChannelValue(channel: ColorChannel, value: number): Color {\n switch (channel) {\n case 'red':\n return new RGBColorImpl(value, this.green, this.blue, this.alpha);\n case 'green':\n return new RGBColorImpl(this.red, value, this.blue, this.alpha);\n case 'blue':\n return new RGBColorImpl(this.red, this.green, value, this.alpha);\n case 'alpha':\n return new RGBColorImpl(this.red, this.green, this.blue, value);\n // Cross-color-space channels - convert, update, convert back\n case 'hue':\n case 'saturation':\n case 'brightness':\n return this.toFormat('hsb').withChannelValue(channel, value).toFormat('rgb');\n case 'lightness':\n return this.toFormat('hsl').withChannelValue(channel, value).toFormat('rgb');\n default:\n throw new Error(`Invalid channel: ${channel}`);\n }\n }\n\n getChannelRange(channel: ColorChannel): ColorChannelRange {\n switch (channel) {\n case 'red':\n case 'green':\n case 'blue':\n return RGB_CHANNEL_RANGE;\n case 'alpha':\n return ALPHA_CHANNEL_RANGE;\n case 'hue':\n return HUE_CHANNEL_RANGE;\n case 'saturation':\n case 'brightness':\n case 'lightness':\n return PERCENT_CHANNEL_RANGE;\n default:\n throw new Error(`Invalid channel: ${channel}`);\n }\n }\n\n getChannelName(channel: ColorChannel, _locale: string): string {\n return CHANNEL_NAMES[channel] || channel;\n }\n\n getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions {\n if (channel === 'alpha') {\n return { style: 'percent' };\n }\n return { maximumFractionDigits: 0 };\n }\n\n formatChannelValue(channel: ColorChannel, locale: string): string {\n const value = this.getChannelValue(channel);\n const options = this.getChannelFormatOptions(channel);\n return new Intl.NumberFormat(locale, options).format(value);\n }\n\n getColorSpace(): ColorSpace {\n return 'rgb';\n }\n\n getColorSpaceAxes(xyChannels?: { xChannel?: ColorChannel; yChannel?: ColorChannel }): ColorAxes {\n const xChannel = xyChannels?.xChannel ?? 'red';\n const yChannel = xyChannels?.yChannel ?? 'green';\n const channels: ColorChannel[] = ['red', 'green', 'blue'];\n const zChannel = channels.find((c) => c !== xChannel && c !== yChannel) ?? 'blue';\n return { xChannel, yChannel, zChannel };\n }\n\n getColorChannels(): [ColorChannel, ColorChannel, ColorChannel] {\n return ['red', 'green', 'blue'];\n }\n\n getColorName(locale: string): string {\n return getColorNameFromRgb(this.red, this.green, this.blue, this.alpha);\n }\n\n getHueName(_locale: string): string {\n const { h } = rgbToHsl(this.red, this.green, this.blue);\n return getHueNameFromAngle(h);\n }\n}\n\n/**\n * HSL Color implementation.\n */\nclass HSLColorImpl implements Color {\n private hue: number;\n private saturation: number;\n private lightness: number;\n private alpha: number;\n\n constructor(hue: number, saturation: number, lightness: number, alpha: number = 1) {\n this.hue = clamp(Math.round(hue) % 360, 0, 360);\n this.saturation = clamp(Math.round(saturation), 0, 100);\n this.lightness = clamp(Math.round(lightness), 0, 100);\n this.alpha = clamp(toFixed(alpha, 2), 0, 1);\n }\n\n toFormat(format: ColorFormat): Color {\n switch (format) {\n case 'hsl':\n case 'hsla':\n return this.clone();\n case 'hex':\n case 'hexa':\n case 'rgb':\n case 'rgba': {\n const { r, g, b } = hslToRgb(this.hue, this.saturation, this.lightness);\n return new RGBColorImpl(r, g, b, this.alpha);\n }\n case 'hsb':\n case 'hsba': {\n const { r, g, b } = hslToRgb(this.hue, this.saturation, this.lightness);\n const hsb = rgbToHsb(r, g, b);\n return new HSBColorImpl(hsb.h, hsb.s, hsb.b, this.alpha);\n }\n default:\n throw new Error(`Unsupported format: ${format}`);\n }\n }\n\n toString(format?: ColorFormat | 'css'): string {\n const f = format ?? 'css';\n\n switch (f) {\n case 'hsl':\n return `hsl(${this.hue}, ${this.saturation}%, ${this.lightness}%)`;\n case 'hsla':\n case 'css':\n return this.alpha === 1\n ? `hsl(${this.hue}, ${this.saturation}%, ${this.lightness}%)`\n : `hsla(${this.hue}, ${this.saturation}%, ${this.lightness}%, ${this.alpha})`;\n default:\n return this.toFormat(f as ColorFormat).toString(f);\n }\n }\n\n clone(): Color {\n return new HSLColorImpl(this.hue, this.saturation, this.lightness, this.alpha);\n }\n\n toHexInt(): number {\n return this.toFormat('rgb').toHexInt();\n }\n\n getChannelValue(channel: ColorChannel): number {\n switch (channel) {\n case 'hue':\n return this.hue;\n case 'saturation':\n return this.saturation;\n case 'lightness':\n return this.lightness;\n case 'alpha':\n return this.alpha;\n // Cross-color-space channels\n case 'red':\n case 'green':\n case 'blue':\n return this.toFormat('rgb').getChannelValue(channel);\n case 'brightness':\n return this.toFormat('hsb').getChannelValue(channel);\n default:\n throw new Error(`Invalid channel: ${channel}`);\n }\n }\n\n withChannelValue(channel: ColorChannel, value: number): Color {\n switch (channel) {\n case 'hue':\n return new HSLColorImpl(value, this.saturation, this.lightness, this.alpha);\n case 'saturation':\n return new HSLColorImpl(this.hue, value, this.lightness, this.alpha);\n case 'lightness':\n return new HSLColorImpl(this.hue, this.saturation, value, this.alpha);\n case 'alpha':\n return new HSLColorImpl(this.hue, this.saturation, this.lightness, value);\n // Cross-color-space channels\n case 'red':\n case 'green':\n case 'blue':\n return this.toFormat('rgb').withChannelValue(channel, value).toFormat('hsl');\n case 'brightness':\n return this.toFormat('hsb').withChannelValue(channel, value).toFormat('hsl');\n default:\n throw new Error(`Invalid channel: ${channel}`);\n }\n }\n\n getChannelRange(channel: ColorChannel): ColorChannelRange {\n switch (channel) {\n case 'hue':\n return HUE_CHANNEL_RANGE;\n case 'saturation':\n case 'lightness':\n case 'brightness':\n return PERCENT_CHANNEL_RANGE;\n case 'alpha':\n return ALPHA_CHANNEL_RANGE;\n case 'red':\n case 'green':\n case 'blue':\n return RGB_CHANNEL_RANGE;\n default:\n throw new Error(`Invalid channel: ${channel}`);\n }\n }\n\n getChannelName(channel: ColorChannel, _locale: string): string {\n return CHANNEL_NAMES[channel] || channel;\n }\n\n getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions {\n if (channel === 'alpha') {\n return { style: 'percent' };\n }\n if (channel === 'hue') {\n return { maximumFractionDigits: 0 };\n }\n return { style: 'percent', maximumFractionDigits: 0 };\n }\n\n formatChannelValue(channel: ColorChannel, locale: string): string {\n const value = this.getChannelValue(channel);\n const options = this.getChannelFormatOptions(channel);\n if (channel === 'saturation' || channel === 'lightness') {\n return new Intl.NumberFormat(locale, options).format(value / 100);\n }\n return new Intl.NumberFormat(locale, options).format(value);\n }\n\n getColorSpace(): ColorSpace {\n return 'hsl';\n }\n\n getColorSpaceAxes(xyChannels?: { xChannel?: ColorChannel; yChannel?: ColorChannel }): ColorAxes {\n const xChannel = xyChannels?.xChannel ?? 'saturation';\n const yChannel = xyChannels?.yChannel ?? 'lightness';\n const channels: ColorChannel[] = ['hue', 'saturation', 'lightness'];\n const zChannel = channels.find((c) => c !== xChannel && c !== yChannel) ?? 'hue';\n return { xChannel, yChannel, zChannel };\n }\n\n getColorChannels(): [ColorChannel, ColorChannel, ColorChannel] {\n return ['hue', 'saturation', 'lightness'];\n }\n\n getColorName(_locale: string): string {\n const { r, g, b } = hslToRgb(this.hue, this.saturation, this.lightness);\n return getColorNameFromRgb(r, g, b, this.alpha);\n }\n\n getHueName(_locale: string): string {\n return getHueNameFromAngle(this.hue);\n }\n}\n\n/**\n * HSB Color implementation.\n */\nclass HSBColorImpl implements Color {\n private hue: number;\n private saturation: number;\n private brightness: number;\n private alpha: number;\n\n constructor(hue: number, saturation: number, brightness: number, alpha: number = 1) {\n this.hue = clamp(Math.round(hue) % 360, 0, 360);\n this.saturation = clamp(Math.round(saturation), 0, 100);\n this.brightness = clamp(Math.round(brightness), 0, 100);\n this.alpha = clamp(toFixed(alpha, 2), 0, 1);\n }\n\n toFormat(format: ColorFormat): Color {\n switch (format) {\n case 'hsb':\n case 'hsba':\n return this.clone();\n case 'hex':\n case 'hexa':\n case 'rgb':\n case 'rgba': {\n const { r, g, b } = hsbToRgb(this.hue, this.saturation, this.brightness);\n return new RGBColorImpl(r, g, b, this.alpha);\n }\n case 'hsl':\n case 'hsla': {\n const { r, g, b } = hsbToRgb(this.hue, this.saturation, this.brightness);\n const hsl = rgbToHsl(r, g, b);\n return new HSLColorImpl(hsl.h, hsl.s, hsl.l, this.alpha);\n }\n default:\n throw new Error(`Unsupported format: ${format}`);\n }\n }\n\n toString(format?: ColorFormat | 'css'): string {\n const f = format ?? 'css';\n\n switch (f) {\n case 'hsb':\n return `hsb(${this.hue}, ${this.saturation}%, ${this.brightness}%)`;\n case 'hsba':\n case 'css':\n // HSB is not a standard CSS format, convert to RGB\n return this.toFormat('rgba').toString('css');\n default:\n return this.toFormat(f as ColorFormat).toString(f);\n }\n }\n\n clone(): Color {\n return new HSBColorImpl(this.hue, this.saturation, this.brightness, this.alpha);\n }\n\n toHexInt(): number {\n return this.toFormat('rgb').toHexInt();\n }\n\n getChannelValue(channel: ColorChannel): number {\n switch (channel) {\n case 'hue':\n return this.hue;\n case 'saturation':\n return this.saturation;\n case 'brightness':\n return this.brightness;\n case 'alpha':\n return this.alpha;\n // Cross-color-space channels\n case 'red':\n case 'green':\n case 'blue':\n return this.toFormat('rgb').getChannelValue(channel);\n case 'lightness':\n return this.toFormat('hsl').getChannelValue(channel);\n default:\n throw new Error(`Invalid channel: ${channel}`);\n }\n }\n\n withChannelValue(channel: ColorChannel, value: number): Color {\n switch (channel) {\n case 'hue':\n return new HSBColorImpl(value, this.saturation, this.brightness, this.alpha);\n case 'saturation':\n return new HSBColorImpl(this.hue, value, this.brightness, this.alpha);\n case 'brightness':\n return new HSBColorImpl(this.hue, this.saturation, value, this.alpha);\n case 'alpha':\n return new HSBColorImpl(this.hue, this.saturation, this.brightness, value);\n // Cross-color-space channels\n case 'red':\n case 'green':\n case 'blue':\n return this.toFormat('rgb').withChannelValue(channel, value).toFormat('hsb');\n case 'lightness':\n return this.toFormat('hsl').withChannelValue(channel, value).toFormat('hsb');\n default:\n throw new Error(`Invalid channel: ${channel}`);\n }\n }\n\n getChannelRange(channel: ColorChannel): ColorChannelRange {\n switch (channel) {\n case 'hue':\n return HUE_CHANNEL_RANGE;\n case 'saturation':\n case 'brightness':\n case 'lightness':\n return PERCENT_CHANNEL_RANGE;\n case 'alpha':\n return ALPHA_CHANNEL_RANGE;\n case 'red':\n case 'green':\n case 'blue':\n return RGB_CHANNEL_RANGE;\n default:\n throw new Error(`Invalid channel: ${channel}`);\n }\n }\n\n getChannelName(channel: ColorChannel, _locale: string): string {\n return CHANNEL_NAMES[channel] || channel;\n }\n\n getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions {\n if (channel === 'alpha') {\n return { style: 'percent' };\n }\n if (channel === 'hue') {\n return { maximumFractionDigits: 0 };\n }\n return { style: 'percent', maximumFractionDigits: 0 };\n }\n\n formatChannelValue(channel: ColorChannel, locale: string): string {\n const value = this.getChannelValue(channel);\n const options = this.getChannelFormatOptions(channel);\n if (channel === 'saturation' || channel === 'brightness') {\n return new Intl.NumberFormat(locale, options).format(value / 100);\n }\n return new Intl.NumberFormat(locale, options).format(value);\n }\n\n getColorSpace(): ColorSpace {\n return 'hsb';\n }\n\n getColorSpaceAxes(xyChannels?: { xChannel?: ColorChannel; yChannel?: ColorChannel }): ColorAxes {\n const xChannel = xyChannels?.xChannel ?? 'saturation';\n const yChannel = xyChannels?.yChannel ?? 'brightness';\n const channels: ColorChannel[] = ['hue', 'saturation', 'brightness'];\n const zChannel = channels.find((c) => c !== xChannel && c !== yChannel) ?? 'hue';\n return { xChannel, yChannel, zChannel };\n }\n\n getColorChannels(): [ColorChannel, ColorChannel, ColorChannel] {\n return ['hue', 'saturation', 'brightness'];\n }\n\n getColorName(_locale: string): string {\n const { r, g, b } = hsbToRgb(this.hue, this.saturation, this.brightness);\n return getColorNameFromRgb(r, g, b, this.alpha);\n }\n\n getHueName(_locale: string): string {\n return getHueNameFromAngle(this.hue);\n }\n}\n\n/**\n * Parse a color string into a Color object.\n */\nexport function parseColor(value: string): Color {\n const trimmed = value.trim().toLowerCase();\n\n // Hex format\n if (trimmed.startsWith('#')) {\n const hex = trimmed.slice(1);\n if (hex.length === 3) {\n const r = parseInt(hex[0] + hex[0], 16);\n const g = parseInt(hex[1] + hex[1], 16);\n const b = parseInt(hex[2] + hex[2], 16);\n return new RGBColorImpl(r, g, b);\n }\n if (hex.length === 4) {\n const r = parseInt(hex[0] + hex[0], 16);\n const g = parseInt(hex[1] + hex[1], 16);\n const b = parseInt(hex[2] + hex[2], 16);\n const a = parseInt(hex[3] + hex[3], 16) / 255;\n return new RGBColorImpl(r, g, b, a);\n }\n if (hex.length === 6) {\n const r = parseInt(hex.slice(0, 2), 16);\n const g = parseInt(hex.slice(2, 4), 16);\n const b = parseInt(hex.slice(4, 6), 16);\n return new RGBColorImpl(r, g, b);\n }\n if (hex.length === 8) {\n const r = parseInt(hex.slice(0, 2), 16);\n const g = parseInt(hex.slice(2, 4), 16);\n const b = parseInt(hex.slice(4, 6), 16);\n const a = parseInt(hex.slice(6, 8), 16) / 255;\n return new RGBColorImpl(r, g, b, a);\n }\n throw new Error(`Invalid hex color: ${value}`);\n }\n\n // RGB/RGBA format\n const rgbMatch = trimmed.match(/^rgba?\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*([\\d.]+))?\\s*\\)$/);\n if (rgbMatch) {\n const r = parseInt(rgbMatch[1], 10);\n const g = parseInt(rgbMatch[2], 10);\n const b = parseInt(rgbMatch[3], 10);\n const a = rgbMatch[4] !== undefined ? parseFloat(rgbMatch[4]) : 1;\n return new RGBColorImpl(r, g, b, a);\n }\n\n // HSL/HSLA format\n const hslMatch = trimmed.match(/^hsla?\\(\\s*(\\d+)\\s*,\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*(?:,\\s*([\\d.]+))?\\s*\\)$/);\n if (hslMatch) {\n const h = parseInt(hslMatch[1], 10);\n const s = parseInt(hslMatch[2], 10);\n const l = parseInt(hslMatch[3], 10);\n const a = hslMatch[4] !== undefined ? parseFloat(hslMatch[4]) : 1;\n return new HSLColorImpl(h, s, l, a);\n }\n\n // HSB/HSBA format\n const hsbMatch = trimmed.match(/^hsba?\\(\\s*(\\d+)\\s*,\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*(?:,\\s*([\\d.]+))?\\s*\\)$/);\n if (hsbMatch) {\n const h = parseInt(hsbMatch[1], 10);\n const s = parseInt(hsbMatch[2], 10);\n const b = parseInt(hsbMatch[3], 10);\n const a = hsbMatch[4] !== undefined ? parseFloat(hsbMatch[4]) : 1;\n return new HSBColorImpl(h, s, b, a);\n }\n\n throw new Error(`Invalid color format: ${value}`);\n}\n\n/**\n * Create an RGB color.\n */\nexport function createRGBColor(red: number, green: number, blue: number, alpha: number = 1): Color {\n return new RGBColorImpl(red, green, blue, alpha);\n}\n\n/**\n * Create an HSL color.\n */\nexport function createHSLColor(hue: number, saturation: number, lightness: number, alpha: number = 1): Color {\n return new HSLColorImpl(hue, saturation, lightness, alpha);\n}\n\n/**\n * Create an HSB color.\n */\nexport function createHSBColor(hue: number, saturation: number, brightness: number, alpha: number = 1): Color {\n return new HSBColorImpl(hue, saturation, brightness, alpha);\n}\n\n/**\n * Normalize a color value (string or Color) to a Color object.\n */\nexport function normalizeColor(value: string | Color): Color {\n if (typeof value === 'string') {\n return parseColor(value);\n }\n return value;\n}\n","/**\n * ColorSlider state management.\n * Based on @react-stately/color useColorSliderState.\n */\n\nimport { createSignal, createMemo, type Accessor } from 'solid-js';\nimport type { Color, ColorChannel } from './types';\nimport { normalizeColor } from './Color';\n\nexport interface ColorSliderStateOptions {\n /** The current color value (controlled). */\n value?: Color | string;\n /** The default color value (uncontrolled). */\n defaultValue?: Color | string;\n /** Handler called when the color changes. */\n onChange?: (color: Color) => void;\n /** Handler called when dragging ends. */\n onChangeEnd?: (color: Color) => void;\n /** The color channel this slider controls. */\n channel: ColorChannel;\n /** Whether the slider is disabled. */\n isDisabled?: boolean;\n /** The locale for formatting. */\n locale?: string;\n}\n\nexport interface ColorSliderState {\n /** The current color value. */\n readonly value: Color;\n /** Whether the slider is being dragged. */\n readonly isDragging: boolean;\n /** The color channel being controlled. */\n readonly channel: ColorChannel;\n /** The step value for the channel. */\n readonly step: number;\n /** The page step value for the channel. */\n readonly pageSize: number;\n /** The minimum value for the channel. */\n readonly minValue: number;\n /** The maximum value for the channel. */\n readonly maxValue: number;\n /** Whether the slider is disabled. */\n readonly isDisabled: boolean;\n\n /** Get the current channel value. */\n getThumbValue(): number;\n /** Get the minimum percent. */\n getThumbMinValue(): number;\n /** Get the maximum percent. */\n getThumbMaxValue(): number;\n /** Get the thumb value as a percentage. */\n getThumbPercent(): number;\n /** Set the channel value. */\n setThumbValue(value: number): void;\n /** Set the thumb value from a percentage (0-1). */\n setThumbPercent(percent: number): void;\n /** Increment the channel value. */\n incrementThumb(stepSize?: number): void;\n /** Decrement the channel value. */\n decrementThumb(stepSize?: number): void;\n /** Set the dragging state. */\n setDragging(isDragging: boolean): void;\n /** Get the display color (with alpha = 1). */\n getDisplayColor(): Color;\n /** Get the formatted value label. */\n getThumbValueLabel(): string;\n}\n\n/**\n * Creates state for a color slider.\n */\nexport function createColorSliderState(\n options: Accessor<ColorSliderStateOptions>\n): ColorSliderState {\n const getOptions = () => options();\n\n // Internal value state\n const [internalValue, setInternalValue] = createSignal<Color | null>(null);\n const [isDragging, setIsDragging] = createSignal(false);\n\n // Initialize internal value\n const initValue = () => {\n const opts = getOptions();\n if (opts.defaultValue) {\n return normalizeColor(opts.defaultValue);\n }\n return null;\n };\n\n // Set initial value\n if (internalValue() === null) {\n const init = initValue();\n if (init) {\n setInternalValue(init);\n }\n }\n\n // Controlled vs uncontrolled value\n const value = createMemo(() => {\n const opts = getOptions();\n if (opts.value !== undefined) {\n return normalizeColor(opts.value);\n }\n return internalValue() ?? normalizeColor('#ff0000');\n });\n\n const channel = createMemo(() => getOptions().channel);\n const isDisabled = createMemo(() => getOptions().isDisabled ?? false);\n const locale = createMemo(() => getOptions().locale ?? 'en-US');\n\n // Get channel range\n const channelRange = createMemo(() => value().getChannelRange(channel()));\n\n const step = createMemo(() => channelRange().step);\n const pageSize = createMemo(() => channelRange().pageSize);\n const minValue = createMemo(() => channelRange().minValue);\n const maxValue = createMemo(() => channelRange().maxValue);\n\n // Update value\n const updateValue = (newColor: Color) => {\n const opts = getOptions();\n\n // Controlled mode\n if (opts.value !== undefined) {\n opts.onChange?.(newColor);\n return;\n }\n\n // Uncontrolled mode\n setInternalValue(newColor);\n opts.onChange?.(newColor);\n };\n\n // Get thumb value\n const getThumbValue = () => {\n return value().getChannelValue(channel());\n };\n\n // Get min/max values\n const getThumbMinValue = () => minValue();\n const getThumbMaxValue = () => maxValue();\n\n // Get thumb percent\n const getThumbPercent = () => {\n const val = getThumbValue();\n const min = minValue();\n const max = maxValue();\n return (val - min) / (max - min);\n };\n\n // Set thumb value\n const setThumbValue = (newValue: number) => {\n const clamped = Math.max(minValue(), Math.min(maxValue(), newValue));\n const rounded = Math.round(clamped / step()) * step();\n const newColor = value().withChannelValue(channel(), rounded);\n updateValue(newColor);\n };\n\n // Set thumb from percent\n const setThumbPercent = (percent: number) => {\n const min = minValue();\n const max = maxValue();\n const val = min + (max - min) * percent;\n setThumbValue(val);\n };\n\n // Increment\n const incrementThumb = (stepSize?: number) => {\n const s = stepSize ?? step();\n setThumbValue(getThumbValue() + s);\n };\n\n // Decrement\n const decrementThumb = (stepSize?: number) => {\n const s = stepSize ?? step();\n setThumbValue(getThumbValue() - s);\n };\n\n // Set dragging\n const setDraggingState = (dragging: boolean) => {\n const wasDragging = isDragging();\n setIsDragging(dragging);\n\n // Call onChangeEnd when dragging ends\n if (wasDragging && !dragging) {\n getOptions().onChangeEnd?.(value());\n }\n };\n\n // Get display color (alpha = 1)\n const getDisplayColor = () => {\n const v = value();\n return v.withChannelValue('alpha', 1);\n };\n\n // Get formatted value label\n const getThumbValueLabel = () => {\n const v = value();\n const ch = channel();\n const loc = locale();\n return v.formatChannelValue(ch, loc);\n };\n\n return {\n get value() {\n return value();\n },\n get isDragging() {\n return isDragging();\n },\n get channel() {\n return channel();\n },\n get step() {\n return step();\n },\n get pageSize() {\n return pageSize();\n },\n get minValue() {\n return minValue();\n },\n get maxValue() {\n return maxValue();\n },\n get isDisabled() {\n return isDisabled();\n },\n getThumbValue,\n getThumbMinValue,\n getThumbMaxValue,\n getThumbPercent,\n setThumbValue,\n setThumbPercent,\n incrementThumb,\n decrementThumb,\n setDragging: setDraggingState,\n getDisplayColor,\n getThumbValueLabel,\n };\n}\n","/**\n * ColorArea state management.\n * Based on @react-stately/color useColorAreaState.\n */\n\nimport { createSignal, createMemo, type Accessor } from 'solid-js';\nimport type { Color, ColorChannel, ColorAxes } from './types';\nimport { normalizeColor } from './Color';\n\nexport interface ColorAreaStateOptions {\n /** The current color value (controlled). */\n value?: Color | string;\n /** The default color value (uncontrolled). */\n defaultValue?: Color | string;\n /** Handler called when the color changes. */\n onChange?: (color: Color) => void;\n /** Handler called when dragging ends. */\n onChangeEnd?: (color: Color) => void;\n /** The color channel for the X axis. */\n xChannel?: ColorChannel;\n /** The color channel for the Y axis. */\n yChannel?: ColorChannel;\n /** Whether the area is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface ColorAreaState {\n /** The current color value. */\n readonly value: Color;\n /** The X axis channel. */\n readonly xChannel: ColorChannel;\n /** The Y axis channel. */\n readonly yChannel: ColorChannel;\n /** The Z axis channel (the third channel). */\n readonly zChannel: ColorChannel;\n /** Whether the area is being dragged. */\n readonly isDragging: boolean;\n /** Whether the area is disabled. */\n readonly isDisabled: boolean;\n /** Step for X channel. */\n readonly xChannelStep: number;\n /** Step for Y channel. */\n readonly yChannelStep: number;\n /** Page step for X channel. */\n readonly xChannelPageStep: number;\n /** Page step for Y channel. */\n readonly yChannelPageStep: number;\n\n /** Get the X channel value. */\n getXValue(): number;\n /** Get the Y channel value. */\n getYValue(): number;\n /** Set the X channel value. */\n setXValue(value: number): void;\n /** Set the Y channel value. */\n setYValue(value: number): void;\n /** Set color from a point (0-1, 0-1). */\n setColorFromPoint(x: number, y: number): void;\n /** Get the thumb position as percentages. */\n getThumbPosition(): { x: number; y: number };\n /** Increment X value. */\n incrementX(stepSize?: number): void;\n /** Decrement X value. */\n decrementX(stepSize?: number): void;\n /** Increment Y value. */\n incrementY(stepSize?: number): void;\n /** Decrement Y value. */\n decrementY(stepSize?: number): void;\n /** Set the dragging state. */\n setDragging(isDragging: boolean): void;\n /** Get the display color (with alpha = 1). */\n getDisplayColor(): Color;\n}\n\n/**\n * Creates state for a color area (2D color picker).\n */\nexport function createColorAreaState(\n options: Accessor<ColorAreaStateOptions>\n): ColorAreaState {\n const getOptions = () => options();\n\n // Internal value state\n const [internalValue, setInternalValue] = createSignal<Color | null>(null);\n const [isDragging, setIsDragging] = createSignal(false);\n\n // Initialize internal value\n const initValue = () => {\n const opts = getOptions();\n if (opts.defaultValue) {\n return normalizeColor(opts.defaultValue);\n }\n return null;\n };\n\n // Set initial value\n if (internalValue() === null) {\n const init = initValue();\n if (init) {\n setInternalValue(init);\n }\n }\n\n // Controlled vs uncontrolled value\n const value = createMemo(() => {\n const opts = getOptions();\n if (opts.value !== undefined) {\n return normalizeColor(opts.value);\n }\n return internalValue() ?? normalizeColor('#ff0000');\n });\n\n const isDisabled = createMemo(() => getOptions().isDisabled ?? false);\n\n // Get color axes\n const axes = createMemo<ColorAxes>(() => {\n const opts = getOptions();\n return value().getColorSpaceAxes({\n xChannel: opts.xChannel,\n yChannel: opts.yChannel,\n });\n });\n\n const xChannel = createMemo(() => axes().xChannel);\n const yChannel = createMemo(() => axes().yChannel);\n const zChannel = createMemo(() => axes().zChannel);\n\n // Get channel ranges\n const xRange = createMemo(() => value().getChannelRange(xChannel()));\n const yRange = createMemo(() => value().getChannelRange(yChannel()));\n\n const xChannelStep = createMemo(() => xRange().step);\n const yChannelStep = createMemo(() => yRange().step);\n const xChannelPageStep = createMemo(() => xRange().pageSize);\n const yChannelPageStep = createMemo(() => yRange().pageSize);\n\n // Update value\n const updateValue = (newColor: Color) => {\n const opts = getOptions();\n\n // Controlled mode\n if (opts.value !== undefined) {\n opts.onChange?.(newColor);\n return;\n }\n\n // Uncontrolled mode\n setInternalValue(newColor);\n opts.onChange?.(newColor);\n };\n\n // Get X value\n const getXValue = () => value().getChannelValue(xChannel());\n\n // Get Y value\n const getYValue = () => value().getChannelValue(yChannel());\n\n // Set X value\n const setXValue = (newValue: number) => {\n const range = xRange();\n const clamped = Math.max(range.minValue, Math.min(range.maxValue, newValue));\n const rounded = Math.round(clamped / range.step) * range.step;\n const newColor = value().withChannelValue(xChannel(), rounded);\n updateValue(newColor);\n };\n\n // Set Y value\n const setYValue = (newValue: number) => {\n const range = yRange();\n const clamped = Math.max(range.minValue, Math.min(range.maxValue, newValue));\n const rounded = Math.round(clamped / range.step) * range.step;\n const newColor = value().withChannelValue(yChannel(), rounded);\n updateValue(newColor);\n };\n\n // Set color from point (x: 0-1, y: 0-1)\n const setColorFromPoint = (x: number, y: number) => {\n const xR = xRange();\n const yR = yRange();\n\n const xVal = xR.minValue + (xR.maxValue - xR.minValue) * x;\n const yVal = yR.minValue + (yR.maxValue - yR.minValue) * (1 - y); // Y is inverted\n\n const xClamped = Math.max(xR.minValue, Math.min(xR.maxValue, xVal));\n const yClamped = Math.max(yR.minValue, Math.min(yR.maxValue, yVal));\n\n const xRounded = Math.round(xClamped / xR.step) * xR.step;\n const yRounded = Math.round(yClamped / yR.step) * yR.step;\n\n const newColor = value()\n .withChannelValue(xChannel(), xRounded)\n .withChannelValue(yChannel(), yRounded);\n updateValue(newColor);\n };\n\n // Get thumb position as percentages\n const getThumbPosition = () => {\n const xR = xRange();\n const yR = yRange();\n const xVal = getXValue();\n const yVal = getYValue();\n\n return {\n x: (xVal - xR.minValue) / (xR.maxValue - xR.minValue),\n y: 1 - (yVal - yR.minValue) / (yR.maxValue - yR.minValue), // Y is inverted\n };\n };\n\n // Increment X\n const incrementX = (stepSize?: number) => {\n const s = stepSize ?? xChannelStep();\n setXValue(getXValue() + s);\n };\n\n // Decrement X\n const decrementX = (stepSize?: number) => {\n const s = stepSize ?? xChannelStep();\n setXValue(getXValue() - s);\n };\n\n // Increment Y\n const incrementY = (stepSize?: number) => {\n const s = stepSize ?? yChannelStep();\n setYValue(getYValue() + s);\n };\n\n // Decrement Y\n const decrementY = (stepSize?: number) => {\n const s = stepSize ?? yChannelStep();\n setYValue(getYValue() - s);\n };\n\n // Set dragging\n const setDraggingState = (dragging: boolean) => {\n const wasDragging = isDragging();\n setIsDragging(dragging);\n\n // Call onChangeEnd when dragging ends\n if (wasDragging && !dragging) {\n getOptions().onChangeEnd?.(value());\n }\n };\n\n // Get display color (alpha = 1)\n const getDisplayColor = () => {\n return value().withChannelValue('alpha', 1);\n };\n\n return {\n get value() {\n return value();\n },\n get xChannel() {\n return xChannel();\n },\n get yChannel() {\n return yChannel();\n },\n get zChannel() {\n return zChannel();\n },\n get isDragging() {\n return isDragging();\n },\n get isDisabled() {\n return isDisabled();\n },\n get xChannelStep() {\n return xChannelStep();\n },\n get yChannelStep() {\n return yChannelStep();\n },\n get xChannelPageStep() {\n return xChannelPageStep();\n },\n get yChannelPageStep() {\n return yChannelPageStep();\n },\n getXValue,\n getYValue,\n setXValue,\n setYValue,\n setColorFromPoint,\n getThumbPosition,\n incrementX,\n decrementX,\n incrementY,\n decrementY,\n setDragging: setDraggingState,\n getDisplayColor,\n };\n}\n","/**\n * ColorWheel state management.\n * Based on @react-stately/color useColorWheelState.\n */\n\nimport { createSignal, createMemo, type Accessor } from 'solid-js';\nimport type { Color, ColorChannel } from './types';\nimport { normalizeColor } from './Color';\n\nexport interface ColorWheelStateOptions {\n /** The current color value (controlled). */\n value?: Color | string;\n /** The default color value (uncontrolled). */\n defaultValue?: Color | string;\n /** Handler called when the color changes. */\n onChange?: (color: Color) => void;\n /** Handler called when dragging ends. */\n onChangeEnd?: (color: Color) => void;\n /** Whether the wheel is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface ColorWheelState {\n /** The current color value. */\n readonly value: Color;\n /** Whether the wheel is being dragged. */\n readonly isDragging: boolean;\n /** Whether the wheel is disabled. */\n readonly isDisabled: boolean;\n /** Step value for hue changes. */\n readonly step: number;\n /** Page step value for hue changes. */\n readonly pageStep: number;\n\n /** Get the current hue value (0-360). */\n getHue(): number;\n /** Set the hue value. */\n setHue(value: number): void;\n /** Set hue from an angle in radians. */\n setHueFromAngle(angle: number): void;\n /** Get the thumb angle in radians (0 = right, increases counterclockwise). */\n getThumbAngle(): number;\n /** Increment hue value. */\n increment(stepSize?: number): void;\n /** Decrement hue value. */\n decrement(stepSize?: number): void;\n /** Set the dragging state. */\n setDragging(isDragging: boolean): void;\n /** Get the display color (with full saturation/brightness for wheel). */\n getDisplayColor(): Color;\n}\n\n/**\n * Creates state for a color wheel (circular hue picker).\n */\nexport function createColorWheelState(\n options: Accessor<ColorWheelStateOptions>\n): ColorWheelState {\n const getOptions = () => options();\n\n // Internal value state\n const [internalValue, setInternalValue] = createSignal<Color | null>(null);\n const [isDragging, setIsDragging] = createSignal(false);\n\n // Initialize internal value\n const initValue = () => {\n const opts = getOptions();\n if (opts.defaultValue) {\n return normalizeColor(opts.defaultValue);\n }\n return null;\n };\n\n // Set initial value\n if (internalValue() === null) {\n const init = initValue();\n if (init) {\n setInternalValue(init);\n }\n }\n\n // Controlled vs uncontrolled value\n const value = createMemo(() => {\n const opts = getOptions();\n if (opts.value !== undefined) {\n return normalizeColor(opts.value);\n }\n return internalValue() ?? normalizeColor('#ff0000');\n });\n\n const isDisabled = createMemo(() => getOptions().isDisabled ?? false);\n\n // Hue step and page step\n const hueRange = createMemo(() => value().getChannelRange('hue'));\n const step = createMemo(() => hueRange().step);\n const pageStep = createMemo(() => hueRange().pageSize);\n\n // Update value\n const updateValue = (newColor: Color) => {\n const opts = getOptions();\n\n // Controlled mode\n if (opts.value !== undefined) {\n opts.onChange?.(newColor);\n return;\n }\n\n // Uncontrolled mode\n setInternalValue(newColor);\n opts.onChange?.(newColor);\n };\n\n // Get hue value (0-360)\n const getHue = () => value().getChannelValue('hue');\n\n // Set hue value\n const setHue = (newValue: number) => {\n // Wrap hue to 0-360 range\n let hue = newValue % 360;\n if (hue < 0) hue += 360;\n\n // Round to step\n const range = hueRange();\n const rounded = Math.round(hue / range.step) * range.step;\n\n const newColor = value().withChannelValue('hue', rounded);\n updateValue(newColor);\n };\n\n // Set hue from angle (radians, 0 = right, counterclockwise)\n const setHueFromAngle = (angle: number) => {\n // Convert angle to degrees (0-360)\n // angle 0 = right (3 o'clock) = hue 0\n // angle increases counterclockwise\n let degrees = (angle * 180) / Math.PI;\n degrees = 360 - degrees; // Convert to clockwise\n if (degrees < 0) degrees += 360;\n if (degrees >= 360) degrees -= 360;\n\n setHue(degrees);\n };\n\n // Get thumb angle in radians\n const getThumbAngle = () => {\n const hue = getHue();\n // Convert hue to angle (radians)\n // hue 0 = angle 0 (right)\n // hue increases clockwise, angle increases counterclockwise\n const degrees = 360 - hue;\n return (degrees * Math.PI) / 180;\n };\n\n // Increment hue\n const increment = (stepSize?: number) => {\n const s = stepSize ?? step();\n setHue(getHue() + s);\n };\n\n // Decrement hue\n const decrement = (stepSize?: number) => {\n const s = stepSize ?? step();\n setHue(getHue() - s);\n };\n\n // Set dragging state\n const setDraggingState = (dragging: boolean) => {\n const wasDragging = isDragging();\n setIsDragging(dragging);\n\n // Call onChangeEnd when dragging ends\n if (wasDragging && !dragging) {\n getOptions().onChangeEnd?.(value());\n }\n };\n\n // Get display color (full saturation and brightness for wheel preview)\n const getDisplayColor = () => {\n // For display, we want the color at full saturation and brightness\n // to show the pure hue on the wheel\n return value()\n .withChannelValue('saturation', 100)\n .withChannelValue('brightness', 100)\n .withChannelValue('alpha', 1);\n };\n\n return {\n get value() {\n return value();\n },\n get isDragging() {\n return isDragging();\n },\n get isDisabled() {\n return isDisabled();\n },\n get step() {\n return step();\n },\n get pageStep() {\n return pageStep();\n },\n getHue,\n setHue,\n setHueFromAngle,\n getThumbAngle,\n increment,\n decrement,\n setDragging: setDraggingState,\n getDisplayColor,\n };\n}\n","/**\n * ColorField state management.\n * Based on @react-stately/color useColorFieldState.\n */\n\nimport { createSignal, createMemo, type Accessor } from 'solid-js';\nimport type { Color, ColorChannel, ColorFormat } from './types';\nimport { normalizeColor, parseColor } from './Color';\n\nexport interface ColorFieldStateOptions {\n /** The current color value (controlled). */\n value?: Color | string | null;\n /** The default color value (uncontrolled). */\n defaultValue?: Color | string;\n /** Handler called when the color changes. */\n onChange?: (color: Color | null) => void;\n /** The color channel to edit (for single channel mode). */\n channel?: ColorChannel;\n /** The color format for parsing/displaying. */\n colorFormat?: ColorFormat;\n /** Whether the field is disabled. */\n isDisabled?: boolean;\n /** Whether the field is read-only. */\n isReadOnly?: boolean;\n}\n\nexport interface ColorFieldState {\n /** The current color value (null if invalid). */\n readonly value: Color | null;\n /** The current input text. */\n readonly inputValue: string;\n /** Whether the input is invalid. */\n readonly isInvalid: boolean;\n /** Whether the field is disabled. */\n readonly isDisabled: boolean;\n /** Whether the field is read-only. */\n readonly isReadOnly: boolean;\n /** The color channel being edited (if single channel mode). */\n readonly channel: ColorChannel | undefined;\n\n /** Set the input text value. */\n setInputValue(value: string): void;\n /** Commit the current input value. */\n commit(): void;\n /** Increment the color channel value. */\n increment(): void;\n /** Decrement the color channel value. */\n decrement(): void;\n /** Increment by page size. */\n incrementToMax(): void;\n /** Decrement to minimum. */\n decrementToMin(): void;\n /** Validate the current input. */\n validate(): boolean;\n}\n\n/**\n * Creates state for a color field (text input for color values).\n */\nexport function createColorFieldState(\n options: Accessor<ColorFieldStateOptions>\n): ColorFieldState {\n const getOptions = () => options();\n\n // Internal value state\n const [internalValue, setInternalValue] = createSignal<Color | null>(null);\n const [inputValue, setInputValueInternal] = createSignal('');\n const [isInvalid, setIsInvalid] = createSignal(false);\n\n // Initialize internal value\n const initValue = () => {\n const opts = getOptions();\n if (opts.defaultValue) {\n const color = normalizeColor(opts.defaultValue);\n return color;\n }\n return null;\n };\n\n // Set initial value\n if (internalValue() === null) {\n const init = initValue();\n if (init) {\n setInternalValue(init);\n setInputValueInternal(formatColorValue(init, getOptions().channel, getOptions().colorFormat));\n }\n }\n\n // Controlled vs uncontrolled value\n const value = createMemo(() => {\n const opts = getOptions();\n if (opts.value !== undefined) {\n if (opts.value === null) return null;\n return normalizeColor(opts.value);\n }\n return internalValue();\n });\n\n const channel = createMemo(() => getOptions().channel);\n const isDisabled = createMemo(() => getOptions().isDisabled ?? false);\n const isReadOnly = createMemo(() => getOptions().isReadOnly ?? false);\n\n // Format color value for display\n function formatColorValue(\n color: Color | null,\n chan?: ColorChannel,\n format?: ColorFormat\n ): string {\n if (!color) return '';\n\n // Single channel mode\n if (chan) {\n return String(color.getChannelValue(chan));\n }\n\n // Full color mode\n return color.toString(format ?? 'hex');\n }\n\n // Update value\n const updateValue = (newColor: Color | null) => {\n const opts = getOptions();\n\n // Controlled mode\n if (opts.value !== undefined) {\n opts.onChange?.(newColor);\n return;\n }\n\n // Uncontrolled mode\n setInternalValue(newColor);\n opts.onChange?.(newColor);\n };\n\n // Set input value\n const setInputValue = (text: string) => {\n setInputValueInternal(text);\n setIsInvalid(false);\n };\n\n // Commit the input value\n const commit = () => {\n const text = inputValue().trim();\n const opts = getOptions();\n const chan = channel();\n\n if (!text) {\n updateValue(null);\n setIsInvalid(false);\n return;\n }\n\n try {\n let newColor: Color;\n\n if (chan) {\n // Single channel mode - parse as number and update channel\n const numValue = parseFloat(text);\n if (isNaN(numValue)) {\n setIsInvalid(true);\n return;\n }\n\n const currentColor = value();\n if (!currentColor) {\n setIsInvalid(true);\n return;\n }\n\n const range = currentColor.getChannelRange(chan);\n const clamped = Math.max(range.minValue, Math.min(range.maxValue, numValue));\n newColor = currentColor.withChannelValue(chan, clamped);\n } else {\n // Full color mode - parse the color string\n newColor = parseColor(text);\n if (opts.colorFormat) {\n newColor = newColor.toFormat(opts.colorFormat);\n }\n }\n\n updateValue(newColor);\n setInputValueInternal(formatColorValue(newColor, chan, opts.colorFormat));\n setIsInvalid(false);\n } catch {\n setIsInvalid(true);\n }\n };\n\n // Increment channel value\n const increment = () => {\n const chan = channel();\n const currentColor = value();\n if (!currentColor || !chan) return;\n\n const currentVal = currentColor.getChannelValue(chan);\n const range = currentColor.getChannelRange(chan);\n const newVal = Math.min(range.maxValue, currentVal + range.step);\n const newColor = currentColor.withChannelValue(chan, newVal);\n\n updateValue(newColor);\n setInputValueInternal(formatColorValue(newColor, chan, getOptions().colorFormat));\n };\n\n // Decrement channel value\n const decrement = () => {\n const chan = channel();\n const currentColor = value();\n if (!currentColor || !chan) return;\n\n const currentVal = currentColor.getChannelValue(chan);\n const range = currentColor.getChannelRange(chan);\n const newVal = Math.max(range.minValue, currentVal - range.step);\n const newColor = currentColor.withChannelValue(chan, newVal);\n\n updateValue(newColor);\n setInputValueInternal(formatColorValue(newColor, chan, getOptions().colorFormat));\n };\n\n // Increment to max\n const incrementToMax = () => {\n const chan = channel();\n const currentColor = value();\n if (!currentColor || !chan) return;\n\n const range = currentColor.getChannelRange(chan);\n const newColor = currentColor.withChannelValue(chan, range.maxValue);\n\n updateValue(newColor);\n setInputValueInternal(formatColorValue(newColor, chan, getOptions().colorFormat));\n };\n\n // Decrement to min\n const decrementToMin = () => {\n const chan = channel();\n const currentColor = value();\n if (!currentColor || !chan) return;\n\n const range = currentColor.getChannelRange(chan);\n const newColor = currentColor.withChannelValue(chan, range.minValue);\n\n updateValue(newColor);\n setInputValueInternal(formatColorValue(newColor, chan, getOptions().colorFormat));\n };\n\n // Validate input\n const validate = () => {\n const text = inputValue().trim();\n const chan = channel();\n\n if (!text) return true;\n\n try {\n if (chan) {\n const numValue = parseFloat(text);\n return !isNaN(numValue);\n } else {\n parseColor(text);\n return true;\n }\n } catch {\n return false;\n }\n };\n\n return {\n get value() {\n return value();\n },\n get inputValue() {\n return inputValue();\n },\n get isInvalid() {\n return isInvalid();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isReadOnly() {\n return isReadOnly();\n },\n get channel() {\n return channel();\n },\n setInputValue,\n commit,\n increment,\n decrement,\n incrementToMax,\n decrementToMin,\n validate,\n };\n}\n","/**\n * Drag state management for solid-stately.\n *\n * Provides reactive state for drag operations.\n */\n\nimport { createSignal, createMemo, type Accessor } from 'solid-js';\nimport type {\n DragItem,\n DragStartEvent,\n DragMoveEvent,\n DragEndEvent,\n DropOperation,\n DragPreviewRenderer,\n} from './types';\n\nexport interface DragStateOptions {\n /** A function that returns the items being dragged. */\n getItems: () => DragItem[];\n /** Function that returns the allowed drop operations. */\n getAllowedDropOperations?: () => DropOperation[];\n /** Handler that is called when a drag operation is started. */\n onDragStart?: (e: DragStartEvent) => void;\n /** Handler that is called when the drag is moved. */\n onDragMove?: (e: DragMoveEvent) => void;\n /** Handler that is called when the drag operation ends. */\n onDragEnd?: (e: DragEndEvent) => void;\n /** Whether the drag operation is disabled. */\n isDisabled?: boolean;\n /** Whether there is a separate drag button affordance. */\n hasDragButton?: boolean;\n /** Preview renderer function ref. */\n preview?: { current: DragPreviewRenderer | null };\n}\n\nexport interface DragState {\n /** Whether an element is currently being dragged. */\n readonly isDragging: boolean;\n /** Whether drag is disabled. */\n readonly isDisabled: boolean;\n /** Start a drag operation. */\n startDrag(x: number, y: number): void;\n /** Update drag position. */\n moveDrag(x: number, y: number): void;\n /** End a drag operation. */\n endDrag(x: number, y: number, dropOperation: DropOperation): void;\n /** Cancel a drag operation. */\n cancelDrag(): void;\n /** Get the items being dragged. */\n getItems(): DragItem[];\n /** Get allowed drop operations. */\n getAllowedDropOperations(): DropOperation[];\n /** Whether there is a drag button. */\n readonly hasDragButton: boolean;\n /** Preview renderer. */\n readonly preview: { current: DragPreviewRenderer | null } | undefined;\n}\n\n/**\n * Creates drag state for managing drag operations.\n *\n * @param props - Accessor returning drag state options\n * @returns Drag state object\n */\nexport function createDragState(\n props: Accessor<DragStateOptions>\n): DragState {\n const getProps = createMemo(() => props());\n\n const [isDragging, setIsDragging] = createSignal(false);\n\n const startDrag = (x: number, y: number) => {\n const p = getProps();\n if (p.isDisabled) return;\n\n setIsDragging(true);\n\n if (typeof p.onDragStart === 'function') {\n p.onDragStart({\n type: 'dragstart',\n x,\n y,\n });\n }\n };\n\n const moveDrag = (x: number, y: number) => {\n const p = getProps();\n if (!isDragging() || p.isDisabled) return;\n\n if (typeof p.onDragMove === 'function') {\n p.onDragMove({\n type: 'dragmove',\n x,\n y,\n });\n }\n };\n\n const endDrag = (x: number, y: number, dropOperation: DropOperation) => {\n const p = getProps();\n if (!isDragging()) return;\n\n setIsDragging(false);\n\n if (typeof p.onDragEnd === 'function') {\n p.onDragEnd({\n type: 'dragend',\n x,\n y,\n dropOperation,\n });\n }\n };\n\n const cancelDrag = () => {\n endDrag(0, 0, 'cancel');\n };\n\n const getItems = () => {\n const p = getProps();\n return p.getItems();\n };\n\n const getAllowedDropOperations = (): DropOperation[] => {\n const p = getProps();\n if (typeof p.getAllowedDropOperations === 'function') {\n return p.getAllowedDropOperations();\n }\n return ['move', 'copy', 'link'];\n };\n\n return {\n get isDragging() {\n return isDragging();\n },\n get isDisabled() {\n return getProps().isDisabled ?? false;\n },\n get hasDragButton() {\n return getProps().hasDragButton ?? false;\n },\n get preview() {\n return getProps().preview;\n },\n startDrag,\n moveDrag,\n endDrag,\n cancelDrag,\n getItems,\n getAllowedDropOperations,\n };\n}\n","/**\n * Drop state management for solid-stately.\n *\n * Provides reactive state for drop target operations.\n */\n\nimport { createSignal, createMemo, type Accessor } from 'solid-js';\nimport type {\n DropItem,\n DropEnterEvent,\n DropMoveEvent,\n DropExitEvent,\n DropActivateEvent,\n DropEvent,\n DropOperation,\n DragTypes,\n} from './types';\n\nexport interface DropStateOptions {\n /**\n * A function returning the drop operation to be performed.\n */\n getDropOperation?: (\n types: DragTypes,\n allowedOperations: DropOperation[]\n ) => DropOperation;\n /**\n * A function returning the drop operation for a specific point.\n */\n getDropOperationForPoint?: (\n types: DragTypes,\n allowedOperations: DropOperation[],\n x: number,\n y: number\n ) => DropOperation;\n /** Handler that is called when a valid drag enters the drop target. */\n onDropEnter?: (e: DropEnterEvent) => void;\n /** Handler that is called when a valid drag is moved within the drop target. */\n onDropMove?: (e: DropMoveEvent) => void;\n /** Handler that is called after a valid drag is held over the drop target. */\n onDropActivate?: (e: DropActivateEvent) => void;\n /** Handler that is called when a valid drag exits the drop target. */\n onDropExit?: (e: DropExitEvent) => void;\n /** Handler that is called when a valid drag is dropped on the drop target. */\n onDrop?: (e: DropEvent) => void;\n /** Whether there is a separate drop button affordance. */\n hasDropButton?: boolean;\n /** Whether the drop target is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface DropState {\n /** Whether the drop target is currently being hovered or focused. */\n readonly isDropTarget: boolean;\n /** Whether the drop target is disabled. */\n readonly isDisabled: boolean;\n /** Whether there is a drop button. */\n readonly hasDropButton: boolean;\n /** Enter the drop target. */\n enterTarget(x: number, y: number): void;\n /** Move within the drop target. */\n moveInTarget(x: number, y: number): void;\n /** Exit the drop target. */\n exitTarget(x: number, y: number): void;\n /** Activate the drop target (after holding). */\n activateTarget(x: number, y: number): void;\n /** Perform a drop on the target. */\n drop(x: number, y: number, items: DropItem[], dropOperation: DropOperation): void;\n /** Get the drop operation for given types. */\n getDropOperation(types: DragTypes, allowedOperations: DropOperation[]): DropOperation;\n /** Get the drop operation for a specific point. */\n getDropOperationForPoint(\n types: DragTypes,\n allowedOperations: DropOperation[],\n x: number,\n y: number\n ): DropOperation;\n}\n\n/**\n * Creates drop state for managing drop target operations.\n *\n * @param props - Accessor returning drop state options\n * @returns Drop state object\n */\nexport function createDropState(\n props: Accessor<DropStateOptions>\n): DropState {\n const getProps = createMemo(() => props());\n\n const [isDropTarget, setIsDropTarget] = createSignal(false);\n\n const enterTarget = (x: number, y: number) => {\n const p = getProps();\n if (p.isDisabled) return;\n\n setIsDropTarget(true);\n\n if (typeof p.onDropEnter === 'function') {\n p.onDropEnter({\n type: 'dropenter',\n x,\n y,\n });\n }\n };\n\n const moveInTarget = (x: number, y: number) => {\n const p = getProps();\n if (!isDropTarget() || p.isDisabled) return;\n\n if (typeof p.onDropMove === 'function') {\n p.onDropMove({\n type: 'dropmove',\n x,\n y,\n });\n }\n };\n\n const exitTarget = (x: number, y: number) => {\n const p = getProps();\n\n setIsDropTarget(false);\n\n if (typeof p.onDropExit === 'function') {\n p.onDropExit({\n type: 'dropexit',\n x,\n y,\n });\n }\n };\n\n const activateTarget = (x: number, y: number) => {\n const p = getProps();\n if (p.isDisabled) return;\n\n if (typeof p.onDropActivate === 'function') {\n p.onDropActivate({\n type: 'dropactivate',\n x,\n y,\n });\n }\n };\n\n const drop = (\n x: number,\n y: number,\n items: DropItem[],\n dropOperation: DropOperation\n ) => {\n const p = getProps();\n if (p.isDisabled) return;\n\n setIsDropTarget(false);\n\n if (typeof p.onDrop === 'function') {\n p.onDrop({\n type: 'drop',\n x,\n y,\n items,\n dropOperation,\n });\n }\n };\n\n const getDropOperation = (\n types: DragTypes,\n allowedOperations: DropOperation[]\n ): DropOperation => {\n const p = getProps();\n if (typeof p.getDropOperation === 'function') {\n return p.getDropOperation(types, allowedOperations);\n }\n return allowedOperations[0] ?? 'cancel';\n };\n\n const getDropOperationForPoint = (\n types: DragTypes,\n allowedOperations: DropOperation[],\n x: number,\n y: number\n ): DropOperation => {\n const p = getProps();\n if (typeof p.getDropOperationForPoint === 'function') {\n return p.getDropOperationForPoint(types, allowedOperations, x, y);\n }\n return getDropOperation(types, allowedOperations);\n };\n\n return {\n get isDropTarget() {\n return isDropTarget();\n },\n get isDisabled() {\n return getProps().isDisabled ?? false;\n },\n get hasDropButton() {\n return getProps().hasDropButton ?? false;\n },\n enterTarget,\n moveInTarget,\n exitTarget,\n activateTarget,\n drop,\n getDropOperation,\n getDropOperationForPoint,\n };\n}\n","/**\n * Draggable collection state management for solid-stately.\n *\n * Provides reactive state for dragging items from a collection.\n */\n\nimport { createSignal, createMemo, type Accessor } from 'solid-js';\nimport type {\n DragItem,\n DraggableCollectionStartEvent,\n DraggableCollectionMoveEvent,\n DraggableCollectionEndEvent,\n DropOperation,\n DragPreviewRenderer,\n} from './types';\n\nexport interface DraggableCollectionStateOptions<T = object> {\n /** A function that returns the items being dragged. */\n getItems: (keys: Set<string | number>) => DragItem[];\n /** Function that returns the allowed drop operations. */\n getAllowedDropOperations?: () => DropOperation[];\n /** Handler that is called when a drag operation is started. */\n onDragStart?: (e: DraggableCollectionStartEvent) => void;\n /** Handler that is called when the drag is moved. */\n onDragMove?: (e: DraggableCollectionMoveEvent) => void;\n /** Handler that is called when the drag operation ends. */\n onDragEnd?: (e: DraggableCollectionEndEvent) => void;\n /** Whether the drag operation is disabled. */\n isDisabled?: boolean;\n /** Preview renderer function ref. */\n preview?: { current: DragPreviewRenderer | null };\n}\n\nexport interface DraggableCollectionState {\n /** Whether items are currently being dragged. */\n readonly isDragging: boolean;\n /** The keys of the items being dragged. */\n readonly draggingKeys: Set<string | number>;\n /** Whether dragging is disabled. */\n readonly isDisabled: boolean;\n /** Start a drag operation with the given keys. */\n startDrag(keys: Set<string | number>, x: number, y: number): void;\n /** Update drag position. */\n moveDrag(x: number, y: number): void;\n /** End a drag operation. */\n endDrag(x: number, y: number, dropOperation: DropOperation, isInternal: boolean): void;\n /** Cancel a drag operation. */\n cancelDrag(): void;\n /** Get the items being dragged for the given keys. */\n getItems(keys: Set<string | number>): DragItem[];\n /** Get allowed drop operations. */\n getAllowedDropOperations(): DropOperation[];\n /** Preview renderer. */\n readonly preview: { current: DragPreviewRenderer | null } | undefined;\n}\n\n/**\n * Creates state for dragging items from a collection.\n *\n * @param props - Accessor returning draggable collection options\n * @returns Draggable collection state object\n */\nexport function createDraggableCollectionState<T = object>(\n props: Accessor<DraggableCollectionStateOptions<T>>\n): DraggableCollectionState {\n const getProps = createMemo(() => props());\n\n const [isDragging, setIsDragging] = createSignal(false);\n const [draggingKeys, setDraggingKeys] = createSignal<Set<string | number>>(\n new Set()\n );\n\n const startDrag = (keys: Set<string | number>, x: number, y: number) => {\n const p = getProps();\n if (p.isDisabled) return;\n\n setIsDragging(true);\n setDraggingKeys(keys);\n\n if (typeof p.onDragStart === 'function') {\n p.onDragStart({\n type: 'dragstart',\n x,\n y,\n keys,\n });\n }\n };\n\n const moveDrag = (x: number, y: number) => {\n const p = getProps();\n if (!isDragging() || p.isDisabled) return;\n\n if (typeof p.onDragMove === 'function') {\n p.onDragMove({\n type: 'dragmove',\n x,\n y,\n keys: draggingKeys(),\n });\n }\n };\n\n const endDrag = (\n x: number,\n y: number,\n dropOperation: DropOperation,\n isInternal: boolean\n ) => {\n const p = getProps();\n const keys = draggingKeys();\n\n setIsDragging(false);\n setDraggingKeys(new Set<string | number>());\n\n if (typeof p.onDragEnd === 'function') {\n p.onDragEnd({\n type: 'dragend',\n x,\n y,\n dropOperation,\n keys,\n isInternal,\n });\n }\n };\n\n const cancelDrag = () => {\n endDrag(0, 0, 'cancel', false);\n };\n\n const getItems = (keys: Set<string | number>) => {\n const p = getProps();\n return p.getItems(keys);\n };\n\n const getAllowedDropOperations = (): DropOperation[] => {\n const p = getProps();\n if (typeof p.getAllowedDropOperations === 'function') {\n return p.getAllowedDropOperations();\n }\n return ['move', 'copy', 'link'];\n };\n\n return {\n get isDragging() {\n return isDragging();\n },\n get draggingKeys() {\n return draggingKeys();\n },\n get isDisabled() {\n return getProps().isDisabled ?? false;\n },\n get preview() {\n return getProps().preview;\n },\n startDrag,\n moveDrag,\n endDrag,\n cancelDrag,\n getItems,\n getAllowedDropOperations,\n };\n}\n","/**\n * Droppable collection state management for solid-stately.\n *\n * Provides reactive state for accepting drops onto a collection.\n */\n\nimport { createSignal, createMemo, type Accessor } from 'solid-js';\nimport type {\n DropItem,\n DropTarget,\n DropOperation,\n DragTypes,\n DroppableCollectionEnterEvent,\n DroppableCollectionMoveEvent,\n DroppableCollectionActivateEvent,\n DroppableCollectionExitEvent,\n DroppableCollectionDropEvent,\n DroppableCollectionInsertDropEvent,\n DroppableCollectionRootDropEvent,\n DroppableCollectionOnItemDropEvent,\n DroppableCollectionReorderEvent,\n ItemDropTarget,\n} from './types';\n\nexport interface DroppableCollectionStateOptions {\n /**\n * The drag types that the droppable collection accepts.\n * @default 'all'\n */\n acceptedDragTypes?: 'all' | Array<string | symbol>;\n /**\n * A function returning the drop operation to be performed.\n */\n getDropOperation?: (\n target: DropTarget,\n types: DragTypes,\n allowedOperations: DropOperation[]\n ) => DropOperation;\n /** Handler that is called when a valid drag enters a drop target. */\n onDropEnter?: (e: DroppableCollectionEnterEvent) => void;\n /** Handler that is called after a valid drag is held over a drop target. */\n onDropActivate?: (e: DroppableCollectionActivateEvent) => void;\n /** Handler that is called when a valid drag exits a drop target. */\n onDropExit?: (e: DroppableCollectionExitEvent) => void;\n /** Handler that is called when a valid drag is dropped. */\n onDrop?: (e: DroppableCollectionDropEvent) => void;\n /** Handler that is called when external items are dropped \"between\" items. */\n onInsert?: (e: DroppableCollectionInsertDropEvent) => void;\n /** Handler that is called when external items are dropped on the collection's root. */\n onRootDrop?: (e: DroppableCollectionRootDropEvent) => void;\n /** Handler that is called when items are dropped \"on\" an item. */\n onItemDrop?: (e: DroppableCollectionOnItemDropEvent) => void;\n /** Handler that is called when items are reordered within the collection. */\n onReorder?: (e: DroppableCollectionReorderEvent) => void;\n /** Handler that is called when items are moved within the source collection. */\n onMove?: (e: DroppableCollectionReorderEvent) => void;\n /** A function returning whether a given target is a valid \"on\" drop target. */\n shouldAcceptItemDrop?: (target: ItemDropTarget, types: DragTypes) => boolean;\n /** Whether the droppable collection is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface DroppableCollectionState {\n /** Whether a drag is currently over the collection. */\n readonly isDropTarget: boolean;\n /** The current drop target within the collection. */\n readonly target: DropTarget | null;\n /** Whether the collection is disabled for drops. */\n readonly isDisabled: boolean;\n /** Set the current drop target. */\n setTarget(target: DropTarget | null): void;\n /** Check if a drag type is accepted. */\n isAccepted(types: DragTypes): boolean;\n /** Enter the collection with a drop target. */\n enterTarget(target: DropTarget, x: number, y: number): void;\n /** Move to a new target within the collection. */\n moveToTarget(target: DropTarget, x: number, y: number): void;\n /** Exit the collection. */\n exitTarget(x: number, y: number): void;\n /** Activate the current target. */\n activateTarget(x: number, y: number): void;\n /** Perform a drop on the collection. */\n drop(\n items: DropItem[],\n dropOperation: DropOperation,\n isInternal: boolean,\n draggingKeys?: Set<string | number>\n ): void;\n /** Get the drop operation for a target. */\n getDropOperation(\n target: DropTarget,\n types: DragTypes,\n allowedOperations: DropOperation[]\n ): DropOperation;\n /** Check if an item drop should be accepted. */\n shouldAcceptItemDrop(target: ItemDropTarget, types: DragTypes): boolean;\n}\n\n/**\n * Symbol for directory drag type.\n */\nexport const DIRECTORY_DRAG_TYPE: symbol = Symbol('directory');\n\n/**\n * Creates state for accepting drops onto a collection.\n *\n * @param props - Accessor returning droppable collection options\n * @returns Droppable collection state object\n */\nexport function createDroppableCollectionState(\n props: Accessor<DroppableCollectionStateOptions>\n): DroppableCollectionState {\n const getProps = createMemo(() => props());\n\n const [isDropTarget, setIsDropTarget] = createSignal(false);\n const [target, setTarget] = createSignal<DropTarget | null>(null);\n\n const isAccepted = (types: DragTypes): boolean => {\n const p = getProps();\n const acceptedTypes = p.acceptedDragTypes ?? 'all';\n\n if (acceptedTypes === 'all') {\n return true;\n }\n\n for (const type of acceptedTypes) {\n if (types.has(type)) {\n return true;\n }\n }\n\n return false;\n };\n\n const enterTarget = (dropTarget: DropTarget, x: number, y: number) => {\n const p = getProps();\n if (p.isDisabled) return;\n\n setIsDropTarget(true);\n setTarget(dropTarget);\n\n if (typeof p.onDropEnter === 'function') {\n p.onDropEnter({\n type: 'dropenter',\n x,\n y,\n target: dropTarget,\n });\n }\n };\n\n const moveToTarget = (dropTarget: DropTarget, x: number, y: number) => {\n const p = getProps();\n if (p.isDisabled) return;\n\n const prevTarget = target();\n setTarget(dropTarget);\n\n // Fire exit/enter events if target changed\n if (prevTarget && !targetsEqual(prevTarget, dropTarget)) {\n if (typeof p.onDropExit === 'function') {\n p.onDropExit({\n type: 'dropexit',\n x,\n y,\n target: prevTarget,\n });\n }\n\n if (typeof p.onDropEnter === 'function') {\n p.onDropEnter({\n type: 'dropenter',\n x,\n y,\n target: dropTarget,\n });\n }\n }\n };\n\n const exitTarget = (x: number, y: number) => {\n const p = getProps();\n const currentTarget = target();\n\n setIsDropTarget(false);\n setTarget(null);\n\n if (currentTarget && typeof p.onDropExit === 'function') {\n p.onDropExit({\n type: 'dropexit',\n x,\n y,\n target: currentTarget,\n });\n }\n };\n\n const activateTarget = (x: number, y: number) => {\n const p = getProps();\n const currentTarget = target();\n if (p.isDisabled || !currentTarget) return;\n\n if (typeof p.onDropActivate === 'function') {\n p.onDropActivate({\n type: 'dropactivate',\n x,\n y,\n target: currentTarget,\n });\n }\n };\n\n const drop = (\n items: DropItem[],\n dropOperation: DropOperation,\n isInternal: boolean,\n draggingKeys?: Set<string | number>\n ) => {\n const p = getProps();\n const currentTarget = target();\n if (p.isDisabled || !currentTarget) return;\n\n setIsDropTarget(false);\n setTarget(null);\n\n // Call the generic onDrop handler\n if (typeof p.onDrop === 'function') {\n p.onDrop({\n type: 'drop',\n x: 0,\n y: 0,\n items,\n dropOperation,\n target: currentTarget,\n });\n }\n\n // Call specific handlers based on the drop type\n if (currentTarget.type === 'root') {\n if (typeof p.onRootDrop === 'function') {\n p.onRootDrop({\n items,\n dropOperation,\n });\n }\n } else if (currentTarget.type === 'item') {\n if (isInternal && draggingKeys) {\n // Reorder or move within the same collection\n if (currentTarget.dropPosition === 'on') {\n if (typeof p.onMove === 'function') {\n p.onMove({\n keys: draggingKeys,\n dropOperation,\n target: currentTarget,\n });\n }\n } else {\n if (typeof p.onReorder === 'function') {\n p.onReorder({\n keys: draggingKeys,\n dropOperation,\n target: currentTarget,\n });\n }\n }\n } else {\n // External drop\n if (currentTarget.dropPosition === 'on') {\n if (typeof p.onItemDrop === 'function') {\n p.onItemDrop({\n items,\n dropOperation,\n isInternal,\n target: currentTarget,\n });\n }\n } else {\n if (typeof p.onInsert === 'function') {\n p.onInsert({\n items,\n dropOperation,\n target: currentTarget,\n });\n }\n }\n }\n }\n };\n\n const getDropOperation = (\n dropTarget: DropTarget,\n types: DragTypes,\n allowedOperations: DropOperation[]\n ): DropOperation => {\n const p = getProps();\n\n if (!isAccepted(types)) {\n return 'cancel';\n }\n\n if (typeof p.getDropOperation === 'function') {\n return p.getDropOperation(dropTarget, types, allowedOperations);\n }\n\n return allowedOperations[0] ?? 'cancel';\n };\n\n const shouldAcceptItemDrop = (\n dropTarget: ItemDropTarget,\n types: DragTypes\n ): boolean => {\n const p = getProps();\n\n if (!isAccepted(types)) {\n return false;\n }\n\n if (typeof p.shouldAcceptItemDrop === 'function') {\n return p.shouldAcceptItemDrop(dropTarget, types);\n }\n\n return true;\n };\n\n return {\n get isDropTarget() {\n return isDropTarget();\n },\n get target() {\n return target();\n },\n get isDisabled() {\n return getProps().isDisabled ?? false;\n },\n setTarget,\n isAccepted,\n enterTarget,\n moveToTarget,\n exitTarget,\n activateTarget,\n drop,\n getDropOperation,\n shouldAcceptItemDrop,\n };\n}\n\n/**\n * Check if two drop targets are equal.\n */\nfunction targetsEqual(a: DropTarget, b: DropTarget): boolean {\n if (a.type !== b.type) return false;\n if (a.type === 'root' && b.type === 'root') return true;\n if (a.type === 'item' && b.type === 'item') {\n return a.key === b.key && a.dropPosition === b.dropPosition;\n }\n return false;\n}\n","/**\n * createFormValidationState for solid-stately\n *\n * Manages form validation state including realtime and displayed validation results.\n * Supports both ARIA (live) and native (on submit) validation behaviors.\n *\n * Port of react-stately's useFormValidationState.\n */\n\nimport {\n type Accessor,\n createContext,\n createEffect,\n createMemo,\n createSignal,\n useContext,\n} from 'solid-js';\n\n// ============================================\n// TYPES\n// ============================================\n\n/** Standard HTML ValidityState interface. */\nexport interface ValidityState {\n badInput: boolean;\n customError: boolean;\n patternMismatch: boolean;\n rangeOverflow: boolean;\n rangeUnderflow: boolean;\n stepMismatch: boolean;\n tooLong: boolean;\n tooShort: boolean;\n typeMismatch: boolean;\n valueMissing: boolean;\n valid: boolean;\n}\n\n/** Result of validation. */\nexport interface ValidationResult {\n /** Whether the value is invalid. */\n isInvalid: boolean;\n /** Details about which validation constraints failed. */\n validationDetails: ValidityState;\n /** Error messages to display. */\n validationErrors: string[];\n}\n\n/** Map of field names to their validation errors. */\nexport type ValidationErrors = Record<string, string | string[]>;\n\n/** Validation function that returns error messages or true/false. */\nexport type ValidationFunction<T> = (value: T) => boolean | string | string[] | null | undefined;\n\n/** Validation behavior mode. */\nexport type ValidationBehavior = 'aria' | 'native';\n\nexport interface FormValidationProps<T> {\n /** Whether the value is invalid (controlled). */\n isInvalid?: boolean;\n /** @deprecated Use isInvalid instead. */\n validationState?: 'valid' | 'invalid';\n /** Custom validation function. */\n validate?: ValidationFunction<T>;\n /** Validation behavior: 'aria' for realtime, 'native' for on submit. */\n validationBehavior?: ValidationBehavior;\n /** Built-in validation result from native input. */\n builtinValidation?: ValidationResult;\n /** Field name(s) for server error lookup. */\n name?: string | string[];\n /** Current field value. */\n value: T | null;\n}\n\nexport interface FormValidationState {\n /** Realtime validation results, updated as the user edits the value. */\n realtimeValidation: Accessor<ValidationResult>;\n /** Currently displayed validation results, updated when the user commits their changes. */\n displayValidation: Accessor<ValidationResult>;\n /** Updates the current validation result. Not displayed to the user until `commitValidation` is called. */\n updateValidation(result: ValidationResult): void;\n /** Resets the displayed validation state to valid when the user resets the form. */\n resetValidation(): void;\n /** Commits the realtime validation so it is displayed to the user. */\n commitValidation(): void;\n}\n\n// ============================================\n// CONSTANTS\n// ============================================\n\n/** A valid validity state. */\nexport const VALID_VALIDITY_STATE: ValidityState = {\n badInput: false,\n customError: false,\n patternMismatch: false,\n rangeOverflow: false,\n rangeUnderflow: false,\n stepMismatch: false,\n tooLong: false,\n tooShort: false,\n typeMismatch: false,\n valueMissing: false,\n valid: true,\n};\n\n/** A custom error validity state. */\nconst CUSTOM_VALIDITY_STATE: ValidityState = {\n ...VALID_VALIDITY_STATE,\n customError: true,\n valid: false,\n};\n\n/** Default validation result (valid). */\nexport const DEFAULT_VALIDATION_RESULT: ValidationResult = {\n isInvalid: false,\n validationDetails: VALID_VALIDITY_STATE,\n validationErrors: [],\n};\n\n// ============================================\n// CONTEXT\n// ============================================\n\n/** Context for server-side validation errors. */\nexport const FormValidationContext = createContext<ValidationErrors>({});\n\n/** Private prop key for passing validation state to children. */\nexport const privateValidationStateProp = '__formValidationState' + Date.now();\n\n// ============================================\n// HELPERS\n// ============================================\n\nfunction asArray<T>(v: T | T[] | undefined): T[] {\n if (!v) {\n return [];\n }\n return Array.isArray(v) ? v : [v];\n}\n\nfunction runValidate<T>(validate: ValidationFunction<T>, value: T): string[] {\n if (typeof validate === 'function') {\n const e = validate(value);\n if (e && typeof e !== 'boolean') {\n return asArray(e);\n }\n }\n return [];\n}\n\nfunction getValidationResult(errors: string[]): ValidationResult | null {\n return errors.length\n ? {\n isInvalid: true,\n validationErrors: errors,\n validationDetails: CUSTOM_VALIDITY_STATE,\n }\n : null;\n}\n\nfunction isEqualValidation(\n a: ValidationResult | null,\n b: ValidationResult | null\n): boolean {\n if (a === b) {\n return true;\n }\n return (\n !!a &&\n !!b &&\n a.isInvalid === b.isInvalid &&\n a.validationErrors.length === b.validationErrors.length &&\n a.validationErrors.every((ae, i) => ae === b.validationErrors[i]) &&\n Object.entries(a.validationDetails).every(\n ([k, v]) => b.validationDetails[k as keyof ValidityState] === v\n )\n );\n}\n\n// ============================================\n// HOOK\n// ============================================\n\n/**\n * Creates form validation state for a field.\n *\n * @example\n * ```tsx\n * const validationState = createFormValidationState({\n * value: inputValue(),\n * validate: (value) => {\n * if (!value) return 'This field is required';\n * if (value.length < 3) return 'Must be at least 3 characters';\n * return null;\n * },\n * validationBehavior: 'aria',\n * });\n *\n * // Access validation state\n * const isInvalid = () => validationState.displayValidation().isInvalid;\n * const errors = () => validationState.displayValidation().validationErrors;\n * ```\n */\nexport function createFormValidationState<T>(\n props: FormValidationProps<T>\n): FormValidationState {\n const {\n isInvalid,\n validationState,\n name,\n builtinValidation: builtinValidationProp,\n validate,\n validationBehavior = 'aria',\n } = props;\n\n // Backward compatibility\n const isInvalidProp = createMemo(\n () => isInvalid ?? (validationState === 'invalid' ? true : undefined)\n );\n\n // Controlled error from isInvalid prop\n const controlledError = createMemo<ValidationResult | null>(() =>\n isInvalidProp() !== undefined\n ? {\n isInvalid: isInvalidProp()!,\n validationErrors: [],\n validationDetails: CUSTOM_VALIDITY_STATE,\n }\n : null\n );\n\n // Client-side validation\n const clientError = createMemo<ValidationResult | null>(() => {\n if (!validate || props.value == null) {\n return null;\n }\n const validateErrors = runValidate(validate, props.value);\n return getValidationResult(validateErrors);\n });\n\n // Built-in validation (skip if valid)\n const builtinValidation = createMemo<ValidationResult | undefined>(() => {\n if (builtinValidationProp?.validationDetails.valid) {\n return undefined;\n }\n return builtinValidationProp;\n });\n\n // Server errors from context\n const serverErrors = useContext(FormValidationContext);\n const serverErrorMessages = createMemo(() => {\n if (name) {\n return Array.isArray(name)\n ? name.flatMap((n) => asArray(serverErrors[n]))\n : asArray(serverErrors[name]);\n }\n return [];\n });\n\n // Track server errors clearing\n const [lastServerErrors, setLastServerErrors] = createSignal(serverErrors);\n const [isServerErrorCleared, setServerErrorCleared] = createSignal(false);\n\n createEffect(() => {\n if (serverErrors !== lastServerErrors()) {\n setLastServerErrors(serverErrors);\n setServerErrorCleared(false);\n }\n });\n\n const serverError = createMemo<ValidationResult | null>(() =>\n getValidationResult(isServerErrorCleared() ? [] : serverErrorMessages())\n );\n\n // Track validation state\n const [currentValidity, setCurrentValidity] = createSignal(\n DEFAULT_VALIDATION_RESULT\n );\n const [commitQueued, setCommitQueued] = createSignal(false);\n\n let nextValidation = DEFAULT_VALIDATION_RESULT;\n let lastError = DEFAULT_VALIDATION_RESULT;\n\n // Commit validation effect\n createEffect(() => {\n if (!commitQueued()) {\n return;\n }\n setCommitQueued(false);\n const error = clientError() || builtinValidation() || nextValidation;\n if (!isEqualValidation(error, lastError)) {\n lastError = error;\n setCurrentValidity(error);\n }\n });\n\n // Realtime validation (for native input state)\n const realtimeValidation = createMemo<ValidationResult>(\n () =>\n controlledError() ||\n serverError() ||\n clientError() ||\n builtinValidation() ||\n DEFAULT_VALIDATION_RESULT\n );\n\n // Display validation (what the user sees)\n const displayValidation = createMemo<ValidationResult>(() => {\n if (validationBehavior === 'native') {\n return (\n controlledError() || serverError() || currentValidity()\n );\n }\n return (\n controlledError() ||\n serverError() ||\n clientError() ||\n builtinValidation() ||\n currentValidity()\n );\n });\n\n return {\n realtimeValidation,\n displayValidation,\n updateValidation(value: ValidationResult) {\n // If validationBehavior is 'aria', update in realtime. Otherwise, store until commit.\n if (\n validationBehavior === 'aria' &&\n !isEqualValidation(currentValidity(), value)\n ) {\n setCurrentValidity(value);\n } else {\n nextValidation = value;\n }\n },\n resetValidation() {\n // Update the currently displayed validation state to valid on form reset.\n const error = DEFAULT_VALIDATION_RESULT;\n if (!isEqualValidation(error, lastError)) {\n lastError = error;\n setCurrentValidity(error);\n }\n // Do not commit validation after the next render for native behavior.\n if (validationBehavior === 'native') {\n setCommitQueued(false);\n }\n setServerErrorCleared(true);\n },\n commitValidation() {\n // Commit validation state so the user sees it on blur/change/submit.\n if (validationBehavior === 'native') {\n setCommitQueued(true);\n }\n setServerErrorCleared(true);\n },\n };\n}\n\n/**\n * Merges multiple validation results into one.\n */\nexport function mergeValidation(\n ...results: ValidationResult[]\n): ValidationResult {\n const errors = new Set<string>();\n let isInvalid = false;\n const validationDetails: ValidityState = { ...VALID_VALIDITY_STATE };\n\n for (const v of results) {\n for (const e of v.validationErrors) {\n errors.add(e);\n }\n isInvalid = isInvalid || v.isInvalid;\n for (const key in validationDetails) {\n const k = key as keyof ValidityState;\n (validationDetails as unknown as Record<string, boolean>)[k] =\n (validationDetails as unknown as Record<string, boolean>)[k] ||\n (v.validationDetails as unknown as Record<string, boolean>)[k];\n }\n }\n\n validationDetails.valid = !isInvalid;\n return {\n isInvalid,\n validationErrors: [...errors],\n validationDetails,\n };\n}\n"],"mappings":";AAQA,SAAS,oBAA8B;;;ACahC,SAAS,OAAU,OAA4B;AACpD,SAAO,OAAO,UAAU,aAAc,MAAsB,IAAI;AAClE;AAUO,SAAS,WAAc,OAA+C;AAC3E,SAAO,OAAO,UAAU;AAC1B;;;ADSO,SAAS,kBAAkB,QAA2C,CAAC,GAAgB;AAC5F,QAAM,WAAW,MAAM,OAAO,KAAK;AAGnC,QAAM,eAAe,SAAS;AAC9B,QAAM,kBAAkB,aAAa,cAAc,aAAa,mBAAmB;AAGnF,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,aAAa,eAAe;AAG5E,QAAM,eAAe,MAAM,SAAS,EAAE,eAAe;AAGrD,QAAM,aAAgC,MAAM;AAC1C,UAAM,IAAI,SAAS;AACnB,WAAO,aAAa,IAAK,EAAE,cAAc,QAAS,iBAAiB;AAAA,EACrE;AAGA,WAAS,YAAY,OAAsB;AACzC,UAAM,IAAI,SAAS;AACnB,QAAI,EAAE,YAAY;AAChB;AAAA,IACF;AAEA,QAAI,CAAC,aAAa,GAAG;AACnB,0BAAoB,KAAK;AAAA,IAC3B;AAEA,MAAE,WAAW,KAAK;AAAA,EACpB;AAGA,WAAS,SAAe;AACtB,UAAM,IAAI,SAAS;AACnB,QAAI,EAAE,YAAY;AAChB;AAAA,IACF;AAEA,gBAAY,CAAC,WAAW,CAAC;AAAA,EAC3B;AAEA,SAAO;AAAA,IACL;AAAA,IACA,iBAAiB,aAAa,mBAAmB;AAAA,IACjD;AAAA,IACA;AAAA,EACF;AACF;;;AEvFA,SAAS,gBAAAA,qBAAmC;AAkDrC,SAAS,wBACd,QAAkC,CAAC,GAChB;AACnB,QAAM;AAAA,IACJ,YAAY;AAAA,IACZ,oBAAoB;AAAA,I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;AAEnE,aAAW,KAAK,SAAS;AACvB,eAAW,KAAK,EAAE,kBAAkB;AAClC,aAAO,IAAI,CAAC;AAAA,IACd;AACA,gBAAY,aAAa,EAAE;AAC3B,eAAW,OAAO,mBAAmB;AACnC,YAAM,IAAI;AACV,MAAC,kBAAyD,CAAC,IACxD,kBAAyD,CAAC,KAC1D,EAAE,kBAAyD,CAAC;AAAA,IACjE;AAAA,EACF;AAEA,oBAAkB,QAAQ,CAAC;AAC3B,SAAO;AAAA,IACL;AAAA,IACA,kBAAkB,CAAC,GAAG,MAAM;AAAA,IAC5B;AAAA,EACF;AACF;","names":["createSignal","createSignal","createSignal","createSignal","createSignal","createSignal","createSignal","createSignal","createSignal","open","createSignal","createSignal","createSignal","createSignal","createSignal","createSignal","createSignal","createSignal","createSignal","isDisabled","createSignal","createSignal","createMemo","createMemo","createSignal","createSignal","createMemo","createSignal","createMemo","createSignal","createMemo","clamp","snapToStep","createSignal","createMemo","createSignal","createSignal","createSignal","onCleanup","createSignal","createEffect","createSignal","createEffect","createSignal","createMemo","createSignal","createMemo","createSignal","createMemo","today","getLocalTimeZone","isSameDay","isSameMonth","startOfMonth","endOfMonth","startOfWeek","getWeeksInMonth","getDayOfWeek","DateFormatter","intlToCalendarDate","getLocalTimeZone","toCalendarDate","today","createSignal","createMemo","startOfMonth","endOfMonth","DateFormatter","getDayOfWeek","isSameDay","isSameMonth","startOfWeek","getWeeksInMonth","intlToCalendarDate","createSignal","createMemo","today","getLocalTimeZone","DateFormatter","intlToCalendarDate","getLocalTimeZone","createSignal","createMemo","today","intlToCalendarDate","DateFormatter","createSignal","createMemo","getLocalTimeZone","DateFormatter","getLocalTimeZone","createSignal","createMemo","DateFormatter","today","getLocalTimeZone","toCalendarDate","toCalendarDateTime","DateFormatter","isSameDay","isSameMonth","startOfMonth","endOfMonth","startOfWeek","getWeeksInMonth","getDayOfWeek","createSignal","createEffect","createMemo","getInitialSelection","normalizeSelection","createMemo","createMemo","createSignal","createEffect","createMemo","on","getInitialSelection","normalizeSelection","clamp","p","q","createSignal","createMemo","createSignal","createMemo","createSignal","createMemo","createSignal","createMemo","createSignal","createMemo","createSignal","createMemo","createSignal","createMemo","createSignal","createMemo","createSignal","createMemo","createSignal","createMemo","createSignal","createMemo","createSignal","createMemo","createEffect","createMemo","createSignal"]}
|