@proyecto-viviana/solidaria-components 0.4.0 → 0.4.1

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.
Files changed (192) hide show
  1. package/dist/ActionBar.d.ts.map +1 -1
  2. package/dist/ActionBar.js +2 -11
  3. package/dist/ActionBar.js.map +1 -1
  4. package/dist/ActionBar.jsx +2 -11
  5. package/dist/ActionBar.jsx.map +1 -1
  6. package/dist/ActionGroup.d.ts.map +1 -1
  7. package/dist/ActionGroup.js +1 -1
  8. package/dist/ActionGroup.js.map +1 -1
  9. package/dist/ActionGroup.jsx +1 -1
  10. package/dist/ActionGroup.jsx.map +1 -1
  11. package/dist/Autocomplete.d.ts +2 -2
  12. package/dist/Autocomplete.d.ts.map +1 -1
  13. package/dist/Autocomplete.js +7 -7
  14. package/dist/Autocomplete.js.map +1 -1
  15. package/dist/Autocomplete.jsx +7 -7
  16. package/dist/Autocomplete.jsx.map +1 -1
  17. package/dist/Breadcrumbs.d.ts.map +1 -1
  18. package/dist/Breadcrumbs.js +15 -16
  19. package/dist/Breadcrumbs.js.map +1 -1
  20. package/dist/Breadcrumbs.jsx +19 -24
  21. package/dist/Breadcrumbs.jsx.map +1 -1
  22. package/dist/Calendar.d.ts.map +1 -1
  23. package/dist/Calendar.js +100 -65
  24. package/dist/Calendar.js.map +1 -1
  25. package/dist/Calendar.jsx +10 -1
  26. package/dist/Calendar.jsx.map +1 -1
  27. package/dist/Color.d.ts.map +1 -1
  28. package/dist/Color.js +15 -18
  29. package/dist/Color.js.map +1 -1
  30. package/dist/Color.jsx +15 -19
  31. package/dist/Color.jsx.map +1 -1
  32. package/dist/ComboBox.d.ts +4 -0
  33. package/dist/ComboBox.d.ts.map +1 -1
  34. package/dist/ComboBox.js +21 -13
  35. package/dist/ComboBox.js.map +1 -1
  36. package/dist/ComboBox.jsx +23 -13
  37. package/dist/ComboBox.jsx.map +1 -1
  38. package/dist/DateField.d.ts +11 -2
  39. package/dist/DateField.d.ts.map +1 -1
  40. package/dist/DateField2.js +237 -234
  41. package/dist/DateField2.js.map +1 -1
  42. package/dist/DateField2.jsx +134 -97
  43. package/dist/DateField2.jsx.map +1 -1
  44. package/dist/DatePicker.d.ts +42 -3
  45. package/dist/DatePicker.d.ts.map +1 -1
  46. package/dist/DatePicker.js +6 -990
  47. package/dist/DatePicker.jsx +6 -681
  48. package/dist/DatePicker2.js +1171 -0
  49. package/dist/DatePicker2.js.map +1 -0
  50. package/dist/DatePicker2.jsx +820 -0
  51. package/dist/DatePicker2.jsx.map +1 -0
  52. package/dist/DateRangePickerContext.d.ts +2 -0
  53. package/dist/DateRangePickerContext.d.ts.map +1 -1
  54. package/dist/Disclosure.d.ts.map +1 -1
  55. package/dist/Disclosure.js +3 -0
  56. package/dist/Disclosure.js.map +1 -1
  57. package/dist/Disclosure.jsx +1 -1
  58. package/dist/Disclosure.jsx.map +1 -1
  59. package/dist/GridList.d.ts.map +1 -1
  60. package/dist/GridList.js +2 -2
  61. package/dist/GridList.js.map +1 -1
  62. package/dist/GridList.jsx +2 -2
  63. package/dist/GridList.jsx.map +1 -1
  64. package/dist/ListBox.d.ts +2 -2
  65. package/dist/ListBox.d.ts.map +1 -1
  66. package/dist/ListBox.js +327 -166
  67. package/dist/ListBox.js.map +1 -1
  68. package/dist/ListBox.jsx +161 -25
  69. package/dist/ListBox.jsx.map +1 -1
  70. package/dist/Modal.d.ts.map +1 -1
  71. package/dist/Modal.js +7 -5
  72. package/dist/Modal.js.map +1 -1
  73. package/dist/Modal.jsx +5 -5
  74. package/dist/Modal.jsx.map +1 -1
  75. package/dist/Popover.d.ts.map +1 -1
  76. package/dist/Popover.js +16 -9
  77. package/dist/Popover.js.map +1 -1
  78. package/dist/Popover.jsx +25 -4
  79. package/dist/Popover.jsx.map +1 -1
  80. package/dist/RangeCalendar.d.ts.map +1 -1
  81. package/dist/RangeCalendar.js +182 -46
  82. package/dist/RangeCalendar.js.map +1 -1
  83. package/dist/RangeCalendar.jsx +72 -2
  84. package/dist/RangeCalendar.jsx.map +1 -1
  85. package/dist/SearchField.d.ts.map +1 -1
  86. package/dist/SearchField.js +26 -2
  87. package/dist/SearchField.js.map +1 -1
  88. package/dist/SearchField.jsx +26 -2
  89. package/dist/SearchField.jsx.map +1 -1
  90. package/dist/Select.d.ts +7 -0
  91. package/dist/Select.d.ts.map +1 -1
  92. package/dist/Select.js +62 -49
  93. package/dist/Select.js.map +1 -1
  94. package/dist/Select.jsx +33 -18
  95. package/dist/Select.jsx.map +1 -1
  96. package/dist/SharedElementTransition.d.ts.map +1 -1
  97. package/dist/SharedElementTransition.js +35 -33
  98. package/dist/SharedElementTransition.js.map +1 -1
  99. package/dist/SharedElementTransition.jsx +35 -33
  100. package/dist/SharedElementTransition.jsx.map +1 -1
  101. package/dist/StepList.d.ts.map +1 -1
  102. package/dist/StepList.js +2 -9
  103. package/dist/StepList.js.map +1 -1
  104. package/dist/StepList.jsx +1 -6
  105. package/dist/StepList.jsx.map +1 -1
  106. package/dist/Table.d.ts +2 -0
  107. package/dist/Table.d.ts.map +1 -1
  108. package/dist/Table.js +10 -3
  109. package/dist/Table.js.map +1 -1
  110. package/dist/Table.jsx +10 -3
  111. package/dist/Table.jsx.map +1 -1
  112. package/dist/Tabs.d.ts.map +1 -1
  113. package/dist/Tabs.js +3 -0
  114. package/dist/Tabs.js.map +1 -1
  115. package/dist/Tabs.jsx +1 -1
  116. package/dist/Tabs.jsx.map +1 -1
  117. package/dist/TagGroup.d.ts +3 -1
  118. package/dist/TagGroup.d.ts.map +1 -1
  119. package/dist/TagGroup.js +12 -8
  120. package/dist/TagGroup.js.map +1 -1
  121. package/dist/TagGroup.jsx +11 -8
  122. package/dist/TagGroup.jsx.map +1 -1
  123. package/dist/TextField.js +4 -1
  124. package/dist/TextField.js.map +1 -1
  125. package/dist/TextField.jsx +4 -1
  126. package/dist/TextField.jsx.map +1 -1
  127. package/dist/TimeField.d.ts +14 -50
  128. package/dist/TimeField.d.ts.map +1 -1
  129. package/dist/TimeField.js +111 -205
  130. package/dist/TimeField.js.map +1 -1
  131. package/dist/TimeField.jsx +76 -82
  132. package/dist/TimeField.jsx.map +1 -1
  133. package/dist/Tree.d.ts.map +1 -1
  134. package/dist/Tree.js +3 -3
  135. package/dist/Tree.js.map +1 -1
  136. package/dist/Tree.jsx +3 -3
  137. package/dist/Tree.jsx.map +1 -1
  138. package/dist/index.d.ts +2 -3
  139. package/dist/index.d.ts.map +1 -1
  140. package/dist/index.js +5 -6
  141. package/dist/index.jsx +5 -6
  142. package/dist/useDragAndDrop.d.ts +0 -8
  143. package/dist/useDragAndDrop.d.ts.map +1 -1
  144. package/dist/useDragAndDrop2.js +6 -2
  145. package/dist/useDragAndDrop2.js.map +1 -1
  146. package/dist/useDragAndDrop2.jsx +6 -2
  147. package/dist/useDragAndDrop2.jsx.map +1 -1
  148. package/dist/utils.d.ts +1 -0
  149. package/dist/utils.d.ts.map +1 -1
  150. package/dist/utils.js +2 -2
  151. package/dist/utils.js.map +1 -1
  152. package/dist/utils.jsx +2 -2
  153. package/dist/utils.jsx.map +1 -1
  154. package/package.json +3 -9
  155. package/src/ActionBar.tsx +10 -12
  156. package/src/ActionGroup.tsx +5 -3
  157. package/src/Autocomplete.tsx +14 -9
  158. package/src/Breadcrumbs.tsx +55 -38
  159. package/src/Calendar.tsx +30 -1
  160. package/src/Color.tsx +42 -27
  161. package/src/ComboBox.tsx +49 -17
  162. package/src/DateField.tsx +285 -52
  163. package/src/DatePicker.tsx +345 -57
  164. package/src/DateRangePickerContext.tsx +2 -0
  165. package/src/Disclosure.tsx +4 -0
  166. package/src/GridList.tsx +8 -2
  167. package/src/ListBox.tsx +323 -21
  168. package/src/Modal.tsx +21 -5
  169. package/src/Popover.tsx +28 -7
  170. package/src/RangeCalendar.tsx +120 -1
  171. package/src/SearchField.tsx +53 -1
  172. package/src/Select.tsx +101 -20
  173. package/src/SharedElementTransition.tsx +92 -36
  174. package/src/StepList.tsx +0 -7
  175. package/src/Table.tsx +19 -4
  176. package/src/Tabs.tsx +1 -0
  177. package/src/TagGroup.tsx +26 -6
  178. package/src/TextField.tsx +1 -1
  179. package/src/TimeField.tsx +113 -196
  180. package/src/Tree.tsx +14 -4
  181. package/src/index.ts +1 -8
  182. package/src/useDragAndDrop.ts +8 -10
  183. package/src/utils.tsx +3 -3
  184. package/dist/DatePicker.js.map +0 -1
  185. package/dist/DatePicker.jsx.map +0 -1
  186. package/dist/HiddenTimeInput.d.ts +0 -25
  187. package/dist/HiddenTimeInput.d.ts.map +0 -1
  188. package/dist/HiddenTimeInput.js +0 -104
  189. package/dist/HiddenTimeInput.js.map +0 -1
  190. package/dist/HiddenTimeInput.jsx +0 -69
  191. package/dist/HiddenTimeInput.jsx.map +0 -1
  192. package/src/HiddenTimeInput.tsx +0 -133
@@ -1 +1 @@
1
- {"version":3,"file":"useDragAndDrop2.jsx","names":[],"sources":["../src/DragPreview.tsx","../src/ListDropTargetDelegate.ts","../src/useDragAndDrop.ts"],"sourcesContent":["import { onCleanup, type JSX } from \"solid-js\";\nimport type { DragItem, DragPreviewRenderer } from \"@proyecto-viviana/solid-stately\";\n\nexport interface DragPreviewProps {\n ref?: { current: DragPreviewRenderer | null };\n children: (\n items: DragItem[],\n ) => JSX.Element | { element: JSX.Element; x?: number; y?: number } | null | undefined;\n}\n\nexport function DragPreview(props: DragPreviewProps): JSX.Element {\n const hasDom = typeof HTMLElement !== \"undefined\";\n const isElementNode = (value: unknown): value is HTMLElement => {\n if (!value) return false;\n if (hasDom && value instanceof HTMLElement) return true;\n return typeof value === \"object\" && (value as { nodeType?: number }).nodeType === 1;\n };\n\n if (props.ref) {\n const renderer: DragPreviewRenderer = (items, callback) => {\n const rendered = props.children(items);\n if (!rendered) {\n callback(null);\n return;\n }\n if (typeof rendered === \"object\" && rendered !== null && \"element\" in rendered) {\n const previewValue = rendered as { element: unknown; x?: number; y?: number };\n callback(\n isElementNode(previewValue.element) ? previewValue.element : null,\n previewValue.x,\n previewValue.y,\n );\n return;\n }\n callback(isElementNode(rendered) ? rendered : null);\n };\n\n props.ref.current = renderer;\n onCleanup(() => {\n if (props.ref?.current === renderer) {\n props.ref.current = null;\n }\n });\n }\n\n return null as unknown as JSX.Element;\n}\n","import type { Accessor } from \"solid-js\";\nimport type { DropTarget } from \"@proyecto-viviana/solid-stately\";\n\ntype Direction = \"ltr\" | \"rtl\";\ntype Orientation = \"horizontal\" | \"vertical\";\ntype Layout = \"stack\" | \"grid\";\n\ninterface CollectionNodeLike {\n key: string | number;\n type?: string;\n}\n\nexport interface ListDropTargetDelegateOptions {\n layout?: Layout;\n orientation?: Orientation;\n direction?: Direction;\n}\n\nconst cssEscape = (value: string): string => {\n const css = (globalThis as { CSS?: { escape?: (input: string) => string } }).CSS;\n return css?.escape ? css.escape(value) : value.replace(/[^a-zA-Z0-9_-]/g, \"\\\\$&\");\n};\n\nexport class ListDropTargetDelegate {\n private collection: Iterable<CollectionNodeLike> | (() => Iterable<CollectionNodeLike>);\n private ref: Accessor<HTMLElement | null>;\n private layout: Layout;\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(\n collection: Iterable<CollectionNodeLike> | (() => Iterable<CollectionNodeLike>),\n ref: Accessor<HTMLElement | null>,\n options?: ListDropTargetDelegateOptions,\n ) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout ?? \"stack\";\n this.orientation = options?.orientation ?? \"vertical\";\n this.direction = options?.direction ?? \"ltr\";\n }\n\n private getCollection(): Iterable<CollectionNodeLike> {\n return typeof this.collection === \"function\"\n ? (this.collection as () => Iterable<CollectionNodeLike>)()\n : this.collection;\n }\n\n private getPrimaryStart(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect): number {\n return this.layout === \"stack\" ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect): number {\n return this.layout === \"stack\" ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect): number {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n private getItemKeys(): Array<string | number> {\n return [...this.getCollection()].filter((item) => item.type === \"item\").map((item) => item.key);\n }\n\n private resolveBoundaryTarget(\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n const keys = this.getItemKeys();\n if (keys.length === 0) return null;\n const key = direction === \"next\" ? keys[0] : keys[keys.length - 1];\n const order: Array<\"before\" | \"on\" | \"after\"> =\n direction === \"next\" ? [\"before\", \"on\", \"after\"] : [\"after\", \"on\", \"before\"];\n for (const dropPosition of order) {\n const target: DropTarget = { type: \"item\", key, dropPosition };\n if (isValidDropTarget(target)) return target;\n }\n return null;\n }\n\n private resolveTransitionTarget(\n target: DropTarget,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (target.type !== \"item\") return null;\n const tryPosition = (dropPosition: \"before\" | \"on\" | \"after\"): DropTarget | null => {\n if (target.dropPosition === dropPosition) return null;\n const nextTarget: DropTarget = {\n type: \"item\",\n key: target.key,\n dropPosition,\n };\n return isValidDropTarget(nextTarget) ? nextTarget : null;\n };\n\n if (direction === \"next\") {\n if (target.dropPosition === \"before\") {\n return tryPosition(\"on\") ?? tryPosition(\"after\");\n }\n if (target.dropPosition === \"on\") {\n return tryPosition(\"after\");\n }\n } else {\n if (target.dropPosition === \"after\") {\n return tryPosition(\"on\") ?? tryPosition(\"before\");\n }\n if (target.dropPosition === \"on\") {\n return tryPosition(\"before\");\n }\n }\n\n return null;\n }\n\n private resolveNeighborTarget(\n target: DropTarget,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (target.type !== \"item\") return null;\n const keys = this.getItemKeys();\n const index = keys.findIndex((key) => key === target.key);\n if (index < 0) return this.resolveBoundaryTarget(direction, isValidDropTarget);\n const nextIndex = direction === \"next\" ? index + 1 : index - 1;\n if (nextIndex < 0 || nextIndex >= keys.length) {\n const rootTarget: DropTarget = { type: \"root\" };\n return isValidDropTarget(rootTarget) ? rootTarget : null;\n }\n const key = keys[nextIndex];\n const order: Array<\"on\" | \"before\" | \"after\"> =\n direction === \"next\" ? [\"on\", \"before\", \"after\"] : [\"on\", \"after\", \"before\"];\n for (const dropPosition of order) {\n const nextTarget: DropTarget = { type: \"item\", key, dropPosition };\n if (isValidDropTarget(nextTarget)) return nextTarget;\n }\n return null;\n }\n\n getKeyboardNavigationTarget(\n target: DropTarget | null,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (!target || target.type === \"root\") {\n return this.resolveBoundaryTarget(direction, isValidDropTarget);\n }\n const transition = this.resolveTransitionTarget(target, direction, isValidDropTarget);\n if (transition) return transition;\n return this.resolveNeighborTarget(target, direction, isValidDropTarget);\n }\n\n getDropTargetFromPoint(\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget {\n const root = this.ref();\n if (!root) {\n return { type: \"root\" };\n }\n\n const allItems = [...this.getCollection()].filter((item) => item.type === \"item\");\n if (allItems.length === 0) {\n return { type: \"root\" };\n }\n\n const collectionId = root.dataset.collection;\n const selector = collectionId ? `[data-collection=\"${cssEscape(collectionId)}\"]` : \"[data-key]\";\n const elements = root.querySelectorAll(selector);\n const elementMap = new Map<string, HTMLElement>();\n for (const node of elements) {\n if (node instanceof HTMLElement && node.dataset.key != null) {\n elementMap.set(node.dataset.key, node);\n }\n }\n\n let low = 0;\n let high = allItems.length;\n const rootRect = root.getBoundingClientRect();\n let primary = this.orientation === \"horizontal\" ? x : y;\n let secondary = this.orientation === \"horizontal\" ? y : x;\n primary += this.getPrimaryStart(rootRect);\n secondary += this.getSecondaryStart(rootRect);\n\n const flow = this.layout === \"stack\" ? primary : secondary;\n const isPrimaryRtl = this.orientation === \"horizontal\" && this.direction === \"rtl\";\n const isSecondaryRtl =\n this.layout === \"grid\" && this.orientation === \"vertical\" && this.direction === \"rtl\";\n const isFlowRtl = this.layout === \"stack\" ? isPrimaryRtl : isSecondaryRtl;\n\n while (low < high) {\n const mid = Math.floor((low + high) / 2);\n const item = allItems[mid];\n const element = elementMap.get(String(item.key));\n if (!element) break;\n const rect = element.getBoundingClientRect();\n const update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRtl);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRtl);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRtl);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRtl);\n } else {\n const target: DropTarget = {\n type: \"item\",\n key: item.key,\n dropPosition: \"on\",\n };\n\n if (isValidDropTarget(target)) {\n if (\n flow <= this.getFlowStart(rect) + 5 &&\n isValidDropTarget({ ...target, dropPosition: \"before\" })\n ) {\n target.dropPosition = isFlowRtl ? \"after\" : \"before\";\n } else if (\n flow >= this.getFlowEnd(rect) - 5 &&\n isValidDropTarget({ ...target, dropPosition: \"after\" })\n ) {\n target.dropPosition = isFlowRtl ? \"before\" : \"after\";\n }\n } else {\n const midpoint = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= midpoint && isValidDropTarget({ ...target, dropPosition: \"before\" })) {\n target.dropPosition = isFlowRtl ? \"after\" : \"before\";\n } else if (flow >= midpoint && isValidDropTarget({ ...target, dropPosition: \"after\" })) {\n target.dropPosition = isFlowRtl ? \"before\" : \"after\";\n }\n }\n\n return target;\n }\n }\n\n const item = allItems[Math.min(low, allItems.length - 1)];\n const element = elementMap.get(String(item.key));\n const rect = element?.getBoundingClientRect();\n if (\n rect &&\n (primary < this.getPrimaryStart(rect) ||\n Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))\n ) {\n return {\n type: \"item\",\n key: item.key,\n dropPosition: isFlowRtl ? \"after\" : \"before\",\n };\n }\n\n return {\n type: \"item\",\n key: item.key,\n dropPosition: isFlowRtl ? \"before\" : \"after\",\n };\n }\n}\n","/**\n * Drag and drop compatibility hook for collection components.\n *\n * Mirrors RAC's `useDragAndDrop` shape while delegating to Solid\n * state and aria primitives.\n */\n\nimport type { Accessor, JSX } from \"solid-js\";\nimport { DragPreview } from \"./DragPreview\";\nimport { ListDropTargetDelegate } from \"./ListDropTargetDelegate\";\nimport {\n createDraggableCollection,\n createDraggableItem,\n createDroppableCollection,\n createDroppableItem,\n getGlobalDraggingCollectionRef,\n getGlobalDraggingKeys,\n type DraggableCollectionOptions,\n type DraggableCollectionAria,\n type DraggableItemOptions,\n type DraggableItemAria,\n type DroppableCollectionOptions,\n type DroppableCollectionAria,\n type DroppableItemOptions,\n type DroppableItemAria,\n type DropTargetDelegate as AriaDropTargetDelegate,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createDraggableCollectionState,\n createDroppableCollectionState,\n type DragItem,\n type DragPreviewRenderer,\n type DraggableCollectionProps,\n type DraggableCollectionState,\n type DraggableCollectionStateOptions,\n type DropTarget,\n type DroppableCollectionProps,\n type DroppableCollectionState,\n type DroppableCollectionStateOptions,\n} from \"@proyecto-viviana/solid-stately\";\n\ninterface DraggableCollectionStateOpts<T = object> extends Omit<\n DraggableCollectionStateOptions<T>,\n \"getItems\"\n> {\n items?: T[];\n}\n\ninterface DragHooks<T = object> {\n useDraggableCollectionState?: (\n props: DraggableCollectionStateOpts<T>,\n ) => DraggableCollectionState;\n useDraggableCollection?: (\n props: Omit<DraggableCollectionOptions, \"ref\">,\n state: DraggableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DraggableCollectionAria;\n useDraggableItem?: (\n props: DraggableItemOptions,\n state: DraggableCollectionState,\n ) => DraggableItemAria;\n DragPreview?: typeof DragPreview;\n renderDragPreview?: DragAndDropOptions<T>[\"renderDragPreview\"];\n isVirtualDragging?: () => boolean;\n}\n\ninterface DropHooks {\n useDroppableCollectionState?: (\n props: DroppableCollectionStateOptions,\n ) => DroppableCollectionState;\n useDroppableCollection?: (\n props: Omit<DroppableCollectionOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DroppableCollectionAria;\n useDroppableItem?: (\n options: Omit<DroppableItemOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DroppableItemAria;\n useDropIndicator?: (\n props: { target: DropTarget },\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => {\n dropIndicatorProps: JSX.HTMLAttributes<HTMLElement>;\n isDropTarget: boolean;\n isHidden: boolean;\n };\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n dropTargetDelegate?: AriaDropTargetDelegate;\n ListDropTargetDelegate?: typeof ListDropTargetDelegate;\n}\n\nexport type DragAndDropHooks<T = object> = DragHooks<T> & DropHooks;\n\nexport interface DragAndDrop<T = object> {\n /** Drag and drop hooks for the collection element. */\n dragAndDropHooks: DragAndDropHooks<T>;\n}\n\nexport interface DragAndDropOptions<T = object>\n extends Partial<Omit<DraggableCollectionProps<T>, \"preview\">>, Partial<DroppableCollectionProps> {\n /**\n * Optional keyboard delegate forwarded to the collection droppable hook.\n */\n keyboardDelegate?: DroppableCollectionOptions[\"keyboardDelegate\"];\n /**\n * Optional keydown handler composed with collection droppable keyboard behavior.\n */\n onKeyDown?: DroppableCollectionOptions[\"onKeyDown\"];\n /**\n * A function that returns the items being dragged.\n * If omitted, draggable hooks are not added.\n */\n getItems?: (keys: Set<string | number>, items: T[]) => DragItem[];\n /**\n * Optional custom drag preview renderer.\n */\n renderDragPreview?: (\n items: DragItem[],\n ) => JSX.Element | { element: JSX.Element; x: number; y: number };\n /**\n * Optional drop indicator renderer for collection components.\n */\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n /**\n * Optional custom drop target delegate.\n */\n dropTargetDelegate?: AriaDropTargetDelegate;\n /**\n * Optional drag preview ref.\n */\n preview?: { current: DragPreviewRenderer | null };\n /**\n * Optional item snapshot used by draggable state `getItems`.\n */\n items?: T[];\n /**\n * Disable both drag and drop behavior.\n */\n isDisabled?: boolean;\n}\n\n/**\n * Provides hooks to enable drag-and-drop behavior for collection components.\n */\nexport function useDragAndDrop<T = object>(options: DragAndDropOptions<T> = {}): DragAndDrop<T> {\n const {\n getItems,\n onDrop,\n onInsert,\n onItemDrop,\n onReorder,\n onMove,\n onRootDrop,\n renderDragPreview,\n renderDropIndicator,\n dropTargetDelegate,\n } = options;\n\n const isDraggable = typeof getItems === \"function\";\n const isDroppable = Boolean(\n onDrop || onInsert || onItemDrop || onReorder || onMove || onRootDrop,\n );\n\n const hooks: DragAndDropHooks<T> = {};\n const hasDom = typeof HTMLElement !== \"undefined\";\n const isElementNode = (value: unknown): value is HTMLElement => {\n if (!value) return false;\n if (hasDom && value instanceof HTMLElement) return true;\n return typeof value === \"object\" && (value as { nodeType?: number }).nodeType === 1;\n };\n const resolvedPreview =\n options.preview ??\n (renderDragPreview\n ? {\n current: (\n items: DragItem[],\n callback: (node: HTMLElement | null, x?: number, y?: number) => void,\n ) => {\n const rendered = renderDragPreview(items);\n if (!rendered) {\n callback(null);\n return;\n }\n if (typeof rendered === \"object\" && rendered !== null && \"element\" in rendered) {\n const previewValue = rendered as { element: unknown; x?: number; y?: number };\n callback(\n isElementNode(previewValue.element) ? previewValue.element : null,\n previewValue.x,\n previewValue.y,\n );\n return;\n }\n callback(isElementNode(rendered) ? rendered : null);\n },\n }\n : undefined);\n\n if (isDraggable && getItems) {\n hooks.useDraggableCollectionState = (props: DraggableCollectionStateOpts<T>) => {\n return createDraggableCollectionState<T>(() => ({\n onDragStart: options.onDragStart ?? props.onDragStart,\n onDragMove: options.onDragMove ?? props.onDragMove,\n onDragEnd: options.onDragEnd ?? props.onDragEnd,\n getAllowedDropOperations:\n options.getAllowedDropOperations ?? props.getAllowedDropOperations,\n isDisabled: options.isDisabled ?? props.isDisabled,\n preview: resolvedPreview ?? props.preview,\n getItems: (keys) => {\n const sourceItems = props.items ?? options.items ?? [];\n return getItems(keys, sourceItems);\n },\n }));\n };\n hooks.useDraggableCollection = (\n props: Omit<DraggableCollectionOptions, \"ref\">,\n state: DraggableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => createDraggableCollection({ ...props, ref }, state);\n hooks.useDraggableItem = (props, state) => createDraggableItem(() => props, state);\n hooks.DragPreview = DragPreview;\n hooks.renderDragPreview = renderDragPreview;\n hooks.isVirtualDragging = () =>\n getGlobalDraggingCollectionRef() != null || getGlobalDraggingKeys().size > 0;\n }\n\n if (isDroppable) {\n hooks.useDroppableCollectionState = (props: DroppableCollectionStateOptions) => {\n return createDroppableCollectionState(() => ({\n acceptedDragTypes: options.acceptedDragTypes ?? props.acceptedDragTypes,\n getDropOperation: options.getDropOperation ?? props.getDropOperation,\n onDropEnter: options.onDropEnter ?? props.onDropEnter,\n onDropActivate: options.onDropActivate ?? props.onDropActivate,\n onDropExit: options.onDropExit ?? props.onDropExit,\n onDrop: options.onDrop ?? props.onDrop,\n onInsert: options.onInsert ?? props.onInsert,\n onRootDrop: options.onRootDrop ?? props.onRootDrop,\n onItemDrop: options.onItemDrop ?? props.onItemDrop,\n onReorder: options.onReorder ?? props.onReorder,\n onMove: options.onMove ?? props.onMove,\n shouldAcceptItemDrop: options.shouldAcceptItemDrop ?? props.shouldAcceptItemDrop,\n isDisabled: options.isDisabled ?? props.isDisabled,\n }));\n };\n hooks.useDroppableCollection = (\n props: Omit<DroppableCollectionOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => {\n const acceptedDragTypes = options.acceptedDragTypes ?? props.acceptedDragTypes;\n const normalizedAcceptedDragTypes =\n acceptedDragTypes === \"all\"\n ? \"all\"\n : acceptedDragTypes?.filter(\n (type): type is string | symbol =>\n typeof type === \"string\" || typeof type === \"symbol\",\n );\n return createDroppableCollection(\n () => ({\n ref,\n dropTargetDelegate: options.dropTargetDelegate ?? props.dropTargetDelegate,\n keyboardDelegate: options.keyboardDelegate ?? props.keyboardDelegate,\n onKeyDown: options.onKeyDown ?? props.onKeyDown,\n acceptedDragTypes: normalizedAcceptedDragTypes,\n isDisabled: options.isDisabled ?? props.isDisabled,\n onDropActivate: (e) => {\n (options.onDropActivate ?? props.onDropActivate)?.({\n type: \"dropactivate\",\n target: e.target,\n x: e.x,\n y: e.y,\n });\n },\n onDrop: (e) => {\n (options.onDrop ?? props.onDrop)?.({\n type: \"drop\",\n target: e.target,\n x: e.x,\n y: e.y,\n items: e.items,\n dropOperation: e.dropOperation,\n });\n },\n onRootDrop: options.onRootDrop ?? props.onRootDrop,\n onItemDrop: (e) => {\n if (e.target.type === \"item\") {\n (options.onItemDrop ?? props.onItemDrop)?.({\n items: e.items,\n target: e.target,\n dropOperation: e.dropOperation,\n isInternal: e.isInternal,\n });\n }\n },\n onInsert: (e) => {\n if (e.target.type === \"item\") {\n (options.onInsert ?? props.onInsert)?.({\n items: e.items,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n onReorder: (e) => {\n if (e.target.type === \"item\") {\n (options.onReorder ?? props.onReorder)?.({\n keys: e.keys,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n onMove: (e) => {\n if (e.target.type === \"item\") {\n (options.onMove ?? props.onMove)?.({\n keys: e.keys,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n }),\n state,\n );\n };\n hooks.useDroppableItem = (\n props: Omit<DroppableItemOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => createDroppableItem(() => ({ ...props, ref }), state);\n hooks.useDropIndicator = (\n props: { target: DropTarget },\n state: DroppableCollectionState,\n _ref: Accessor<HTMLElement | null>,\n ) => {\n const target = props.target;\n const activeTarget = state.target;\n const isDropTarget =\n activeTarget?.type === target.type &&\n (target.type === \"root\" ||\n (activeTarget.type === \"item\" &&\n target.type === \"item\" &&\n activeTarget.key === target.key &&\n activeTarget.dropPosition === target.dropPosition));\n return {\n dropIndicatorProps: {\n role: \"option\",\n \"aria-disabled\": true,\n \"aria-hidden\": isDropTarget ? undefined : \"true\",\n tabIndex: -1,\n \"data-drop-target\": isDropTarget ? \"\" : undefined,\n },\n isDropTarget,\n isHidden: !isDropTarget,\n };\n };\n hooks.renderDropIndicator = renderDropIndicator;\n hooks.dropTargetDelegate = dropTargetDelegate;\n hooks.ListDropTargetDelegate = ListDropTargetDelegate;\n }\n\n return {\n dragAndDropHooks: hooks,\n };\n}\n"],"mappings":";;;;AAUA,SAAgB,YAAY,OAAsC;CAChE,MAAM,SAAS,OAAO,gBAAgB;CACtC,MAAM,iBAAiB,UAAyC;EAC9D,IAAI,CAAC,OAAO,OAAO;EACnB,IAAI,UAAU,iBAAiB,aAAa,OAAO;EACnD,OAAO,OAAO,UAAU,YAAa,MAAgC,aAAa;CACpF;CAEA,IAAI,MAAM,KAAK;EACb,MAAM,YAAiC,OAAO,aAAa;GACzD,MAAM,WAAW,MAAM,SAAS,KAAK;GACrC,IAAI,CAAC,UAAU;IACb,SAAS,IAAI;IACb;GACF;GACA,IAAI,OAAO,aAAa,YAAY,aAAa,QAAQ,aAAa,UAAU;IAC9E,MAAM,eAAe;IACrB,SACE,cAAc,aAAa,OAAO,IAAI,aAAa,UAAU,MAC7D,aAAa,GACb,aAAa,CACf;IACA;GACF;GACA,SAAS,cAAc,QAAQ,IAAI,WAAW,IAAI;EACpD;EAEA,MAAM,IAAI,UAAU;EACpB,gBAAgB;GACd,IAAI,MAAM,KAAK,YAAY,UACzB,MAAM,IAAI,UAAU;EAExB,CAAC;CACH;CAEA,OAAO;AACT;;;AC5BA,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AE;KACnB,CAAC;IAEL;IACA,SAAS,MAAM;KACb,IAAI,EAAE,OAAO,SAAS,QACpB,CAAC,QAAQ,UAAU,MAAM,OAAA,GAAU;MACjC,MAAM,EAAE;MACR,QAAQ,EAAE;MACV,eAAe,EAAE;KACnB,CAAC;IAEL;GACF,IACA,KACF;EACF;EACA,MAAM,oBACJ,OACA,OACA,QACG,2BAA2B;GAAE,GAAG;GAAO;EAAI,IAAI,KAAK;EACzD,MAAM,oBACJ,OACA,OACA,SACG;GACH,MAAM,SAAS,MAAM;GACrB,MAAM,eAAe,MAAM;GAC3B,MAAM,eACJ,cAAc,SAAS,OAAO,SAC7B,OAAO,SAAS,UACd,aAAa,SAAS,UACrB,OAAO,SAAS,UAChB,aAAa,QAAQ,OAAO,OAC5B,aAAa,iBAAiB,OAAO;GAC3C,OAAO;IACL,oBAAoB;KAClB,MAAM;KACN,iBAAiB;KACjB,eAAe,eAAe,KAAA,IAAY;KAC1C,UAAU;KACV,oBAAoB,eAAe,KAAK,KAAA;IAC1C;IACA;IACA,UAAU,CAAC;GACb;EACF;EACA,MAAM,sBAAsB;EAC5B,MAAM,qBAAqB;EAC3B,MAAM,yBAAyB;CACjC;CAEA,OAAO,EACL,kBAAkB,MACpB;AACF"}
1
+ {"version":3,"file":"useDragAndDrop2.jsx","names":[],"sources":["../src/DragPreview.tsx","../src/ListDropTargetDelegate.ts","../src/useDragAndDrop.ts"],"sourcesContent":["import { onCleanup, type JSX } from \"solid-js\";\nimport type { DragItem, DragPreviewRenderer } from \"@proyecto-viviana/solid-stately\";\n\nexport interface DragPreviewProps {\n ref?: { current: DragPreviewRenderer | null };\n children: (\n items: DragItem[],\n ) => JSX.Element | { element: JSX.Element; x?: number; y?: number } | null | undefined;\n}\n\nexport function DragPreview(props: DragPreviewProps): JSX.Element {\n const hasDom = typeof HTMLElement !== \"undefined\";\n const isElementNode = (value: unknown): value is HTMLElement => {\n if (!value) return false;\n if (hasDom && value instanceof HTMLElement) return true;\n return typeof value === \"object\" && (value as { nodeType?: number }).nodeType === 1;\n };\n\n if (props.ref) {\n const renderer: DragPreviewRenderer = (items, callback) => {\n const rendered = props.children(items);\n if (!rendered) {\n callback(null);\n return;\n }\n if (typeof rendered === \"object\" && rendered !== null && \"element\" in rendered) {\n const previewValue = rendered as { element: unknown; x?: number; y?: number };\n callback(\n isElementNode(previewValue.element) ? previewValue.element : null,\n previewValue.x,\n previewValue.y,\n );\n return;\n }\n callback(isElementNode(rendered) ? rendered : null);\n };\n\n props.ref.current = renderer;\n onCleanup(() => {\n if (props.ref?.current === renderer) {\n props.ref.current = null;\n }\n });\n }\n\n return null as unknown as JSX.Element;\n}\n","import type { Accessor } from \"solid-js\";\nimport type { DropTarget } from \"@proyecto-viviana/solid-stately\";\n\ntype Direction = \"ltr\" | \"rtl\";\ntype Orientation = \"horizontal\" | \"vertical\";\ntype Layout = \"stack\" | \"grid\";\n\ninterface CollectionNodeLike {\n key: string | number;\n type?: string;\n}\n\nexport interface ListDropTargetDelegateOptions {\n layout?: Layout;\n orientation?: Orientation;\n direction?: Direction;\n}\n\nconst cssEscape = (value: string): string => {\n const css = (globalThis as { CSS?: { escape?: (input: string) => string } }).CSS;\n return css?.escape ? css.escape(value) : value.replace(/[^a-zA-Z0-9_-]/g, \"\\\\$&\");\n};\n\nexport class ListDropTargetDelegate {\n private collection: Iterable<CollectionNodeLike> | (() => Iterable<CollectionNodeLike>);\n private ref: Accessor<HTMLElement | null>;\n private layout: Layout;\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(\n collection: Iterable<CollectionNodeLike> | (() => Iterable<CollectionNodeLike>),\n ref: Accessor<HTMLElement | null>,\n options?: ListDropTargetDelegateOptions,\n ) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout ?? \"stack\";\n this.orientation = options?.orientation ?? \"vertical\";\n this.direction = options?.direction ?? \"ltr\";\n }\n\n private getCollection(): Iterable<CollectionNodeLike> {\n return typeof this.collection === \"function\"\n ? (this.collection as () => Iterable<CollectionNodeLike>)()\n : this.collection;\n }\n\n private getPrimaryStart(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect): number {\n return this.layout === \"stack\" ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect): number {\n return this.layout === \"stack\" ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect): number {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n private getItemKeys(): Array<string | number> {\n return [...this.getCollection()].filter((item) => item.type === \"item\").map((item) => item.key);\n }\n\n private resolveBoundaryTarget(\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n const keys = this.getItemKeys();\n if (keys.length === 0) return null;\n const key = direction === \"next\" ? keys[0] : keys[keys.length - 1];\n const order: Array<\"before\" | \"on\" | \"after\"> =\n direction === \"next\" ? [\"before\", \"on\", \"after\"] : [\"after\", \"on\", \"before\"];\n for (const dropPosition of order) {\n const target: DropTarget = { type: \"item\", key, dropPosition };\n if (isValidDropTarget(target)) return target;\n }\n return null;\n }\n\n private resolveTransitionTarget(\n target: DropTarget,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (target.type !== \"item\") return null;\n const tryPosition = (dropPosition: \"before\" | \"on\" | \"after\"): DropTarget | null => {\n if (target.dropPosition === dropPosition) return null;\n const nextTarget: DropTarget = {\n type: \"item\",\n key: target.key,\n dropPosition,\n };\n return isValidDropTarget(nextTarget) ? nextTarget : null;\n };\n\n if (direction === \"next\") {\n if (target.dropPosition === \"before\") {\n return tryPosition(\"on\") ?? tryPosition(\"after\");\n }\n if (target.dropPosition === \"on\") {\n return tryPosition(\"after\");\n }\n } else {\n if (target.dropPosition === \"after\") {\n return tryPosition(\"on\") ?? tryPosition(\"before\");\n }\n if (target.dropPosition === \"on\") {\n return tryPosition(\"before\");\n }\n }\n\n return null;\n }\n\n private resolveNeighborTarget(\n target: DropTarget,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (target.type !== \"item\") return null;\n const keys = this.getItemKeys();\n const index = keys.findIndex((key) => key === target.key);\n if (index < 0) return this.resolveBoundaryTarget(direction, isValidDropTarget);\n const nextIndex = direction === \"next\" ? index + 1 : index - 1;\n if (nextIndex < 0 || nextIndex >= keys.length) {\n const rootTarget: DropTarget = { type: \"root\" };\n return isValidDropTarget(rootTarget) ? rootTarget : null;\n }\n const key = keys[nextIndex];\n const order: Array<\"on\" | \"before\" | \"after\"> =\n direction === \"next\" ? [\"on\", \"before\", \"after\"] : [\"on\", \"after\", \"before\"];\n for (const dropPosition of order) {\n const nextTarget: DropTarget = { type: \"item\", key, dropPosition };\n if (isValidDropTarget(nextTarget)) return nextTarget;\n }\n return null;\n }\n\n getKeyboardNavigationTarget(\n target: DropTarget | null,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (!target || target.type === \"root\") {\n return this.resolveBoundaryTarget(direction, isValidDropTarget);\n }\n const transition = this.resolveTransitionTarget(target, direction, isValidDropTarget);\n if (transition) return transition;\n return this.resolveNeighborTarget(target, direction, isValidDropTarget);\n }\n\n getDropTargetFromPoint(\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget {\n const root = this.ref();\n if (!root) {\n return { type: \"root\" };\n }\n\n const allItems = [...this.getCollection()].filter((item) => item.type === \"item\");\n if (allItems.length === 0) {\n return { type: \"root\" };\n }\n\n const collectionId = root.dataset.collection;\n const selector = collectionId ? `[data-collection=\"${cssEscape(collectionId)}\"]` : \"[data-key]\";\n const elements = root.querySelectorAll(selector);\n const elementMap = new Map<string, HTMLElement>();\n for (const node of elements) {\n if (node instanceof HTMLElement && node.dataset.key != null) {\n elementMap.set(node.dataset.key, node);\n }\n }\n\n let low = 0;\n let high = allItems.length;\n const rootRect = root.getBoundingClientRect();\n let primary = this.orientation === \"horizontal\" ? x : y;\n let secondary = this.orientation === \"horizontal\" ? y : x;\n primary += this.getPrimaryStart(rootRect);\n secondary += this.getSecondaryStart(rootRect);\n\n const flow = this.layout === \"stack\" ? primary : secondary;\n const isPrimaryRtl = this.orientation === \"horizontal\" && this.direction === \"rtl\";\n const isSecondaryRtl =\n this.layout === \"grid\" && this.orientation === \"vertical\" && this.direction === \"rtl\";\n const isFlowRtl = this.layout === \"stack\" ? isPrimaryRtl : isSecondaryRtl;\n\n while (low < high) {\n const mid = Math.floor((low + high) / 2);\n const item = allItems[mid];\n const element = elementMap.get(String(item.key));\n if (!element) break;\n const rect = element.getBoundingClientRect();\n const update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRtl);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRtl);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRtl);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRtl);\n } else {\n const target: DropTarget = {\n type: \"item\",\n key: item.key,\n dropPosition: \"on\",\n };\n\n if (isValidDropTarget(target)) {\n if (\n flow <= this.getFlowStart(rect) + 5 &&\n isValidDropTarget({ ...target, dropPosition: \"before\" })\n ) {\n target.dropPosition = isFlowRtl ? \"after\" : \"before\";\n } else if (\n flow >= this.getFlowEnd(rect) - 5 &&\n isValidDropTarget({ ...target, dropPosition: \"after\" })\n ) {\n target.dropPosition = isFlowRtl ? \"before\" : \"after\";\n }\n } else {\n const midpoint = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= midpoint && isValidDropTarget({ ...target, dropPosition: \"before\" })) {\n target.dropPosition = isFlowRtl ? \"after\" : \"before\";\n } else if (flow >= midpoint && isValidDropTarget({ ...target, dropPosition: \"after\" })) {\n target.dropPosition = isFlowRtl ? \"before\" : \"after\";\n }\n }\n\n return target;\n }\n }\n\n const item = allItems[Math.min(low, allItems.length - 1)];\n const element = elementMap.get(String(item.key));\n const rect = element?.getBoundingClientRect();\n if (\n rect &&\n (primary < this.getPrimaryStart(rect) ||\n Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))\n ) {\n return {\n type: \"item\",\n key: item.key,\n dropPosition: isFlowRtl ? \"after\" : \"before\",\n };\n }\n\n return {\n type: \"item\",\n key: item.key,\n dropPosition: isFlowRtl ? \"before\" : \"after\",\n };\n }\n}\n","/**\n * Drag and drop compatibility hook for collection components.\n *\n * Mirrors RAC's `useDragAndDrop` shape while delegating to Solid\n * state and aria primitives.\n */\n\nimport type { Accessor, JSX } from \"solid-js\";\nimport { DragPreview } from \"./DragPreview\";\nimport { ListDropTargetDelegate } from \"./ListDropTargetDelegate\";\nimport {\n createDraggableCollection,\n createDraggableItem,\n createDroppableCollection,\n createDroppableItem,\n getGlobalDraggingCollectionRef,\n getGlobalDraggingKeys,\n type DraggableCollectionOptions,\n type DraggableCollectionAria,\n type DraggableItemOptions,\n type DraggableItemAria,\n type DroppableCollectionOptions,\n type DroppableCollectionAria,\n type DroppableItemOptions,\n type DroppableItemAria,\n type DropTargetDelegate as AriaDropTargetDelegate,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createDraggableCollectionState,\n createDroppableCollectionState,\n type DragItem,\n type DragPreviewRenderer,\n type DraggableCollectionProps,\n type DraggableCollectionState,\n type DraggableCollectionStateOptions,\n type DropTarget,\n type DroppableCollectionProps,\n type DroppableCollectionState,\n type DroppableCollectionStateOptions,\n} from \"@proyecto-viviana/solid-stately\";\n\ninterface DraggableCollectionStateOpts<T = object> extends Omit<\n DraggableCollectionStateOptions<T>,\n \"getItems\"\n> {\n items?: T[];\n}\n\ninterface DragHooks<T = object> {\n useDraggableCollectionState?: (\n props: DraggableCollectionStateOpts<T>,\n ) => DraggableCollectionState;\n useDraggableCollection?: (\n props: Omit<DraggableCollectionOptions, \"ref\">,\n state: DraggableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DraggableCollectionAria;\n useDraggableItem?: (\n props: DraggableItemOptions,\n state: DraggableCollectionState,\n ) => DraggableItemAria;\n DragPreview?: typeof DragPreview;\n renderDragPreview?: DragAndDropOptions<T>[\"renderDragPreview\"];\n isVirtualDragging?: () => boolean;\n}\n\ninterface DropHooks {\n useDroppableCollectionState?: (\n props: DroppableCollectionStateOptions,\n ) => DroppableCollectionState;\n useDroppableCollection?: (\n props: Omit<DroppableCollectionOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DroppableCollectionAria;\n useDroppableItem?: (\n options: Omit<DroppableItemOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DroppableItemAria;\n useDropIndicator?: (\n props: { target: DropTarget },\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => {\n dropIndicatorProps: JSX.HTMLAttributes<HTMLElement>;\n isDropTarget: boolean;\n isHidden: boolean;\n };\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n dropTargetDelegate?: AriaDropTargetDelegate;\n ListDropTargetDelegate?: typeof ListDropTargetDelegate;\n}\n\nexport type DragAndDropHooks<T = object> = DragHooks<T> & DropHooks;\n\nexport interface DragAndDrop<T = object> {\n /** Drag and drop hooks for the collection element. */\n dragAndDropHooks: DragAndDropHooks<T>;\n}\n\nexport interface DragAndDropOptions<T = object>\n extends Partial<Omit<DraggableCollectionProps<T>, \"preview\">>, Partial<DroppableCollectionProps> {\n /**\n * A function that returns the items being dragged.\n * If omitted, draggable hooks are not added.\n */\n getItems?: (keys: Set<string | number>, items: T[]) => DragItem[];\n /**\n * Optional custom drag preview renderer.\n */\n renderDragPreview?: (\n items: DragItem[],\n ) => JSX.Element | { element: JSX.Element; x: number; y: number };\n /**\n * Optional drop indicator renderer for collection components.\n */\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n /**\n * Optional custom drop target delegate.\n */\n dropTargetDelegate?: AriaDropTargetDelegate;\n /**\n * Optional drag preview ref.\n */\n preview?: { current: DragPreviewRenderer | null };\n /**\n * Optional item snapshot used by draggable state `getItems`.\n */\n items?: T[];\n /**\n * Disable both drag and drop behavior.\n */\n isDisabled?: boolean;\n}\n\n/**\n * Provides hooks to enable drag-and-drop behavior for collection components.\n */\nexport function useDragAndDrop<T = object>(options: DragAndDropOptions<T> = {}): DragAndDrop<T> {\n const {\n getItems,\n onDrop,\n onInsert,\n onItemDrop,\n onReorder,\n onMove,\n onRootDrop,\n renderDragPreview,\n renderDropIndicator,\n dropTargetDelegate,\n } = options;\n\n const isDraggable = typeof getItems === \"function\";\n const isDroppable = Boolean(\n onDrop || onInsert || onItemDrop || onReorder || onMove || onRootDrop,\n );\n\n const hooks: DragAndDropHooks<T> = {};\n const hasDom = typeof HTMLElement !== \"undefined\";\n const isElementNode = (value: unknown): value is HTMLElement => {\n if (!value) return false;\n if (hasDom && value instanceof HTMLElement) return true;\n return typeof value === \"object\" && (value as { nodeType?: number }).nodeType === 1;\n };\n const resolvedPreview =\n options.preview ??\n (renderDragPreview\n ? {\n current: (\n items: DragItem[],\n callback: (node: HTMLElement | null, x?: number, y?: number) => void,\n ) => {\n const rendered = renderDragPreview(items);\n if (!rendered) {\n callback(null);\n return;\n }\n if (typeof rendered === \"object\" && rendered !== null && \"element\" in rendered) {\n const previewValue = rendered as { element: unknown; x?: number; y?: number };\n callback(\n isElementNode(previewValue.element) ? previewValue.element : null,\n previewValue.x,\n previewValue.y,\n );\n return;\n }\n callback(isElementNode(rendered) ? rendered : null);\n },\n }\n : undefined);\n\n if (isDraggable && getItems) {\n hooks.useDraggableCollectionState = (props: DraggableCollectionStateOpts<T>) => {\n return createDraggableCollectionState<T>(() => ({\n onDragStart: options.onDragStart ?? props.onDragStart,\n onDragMove: options.onDragMove ?? props.onDragMove,\n onDragEnd: options.onDragEnd ?? props.onDragEnd,\n getAllowedDropOperations:\n options.getAllowedDropOperations ?? props.getAllowedDropOperations,\n isDisabled: options.isDisabled ?? props.isDisabled,\n preview: resolvedPreview ?? props.preview,\n getItems: (keys) => {\n const sourceItems = props.items ?? options.items ?? [];\n return getItems(keys, sourceItems);\n },\n }));\n };\n hooks.useDraggableCollection = (\n props: Omit<DraggableCollectionOptions, \"ref\">,\n state: DraggableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => createDraggableCollection({ ...props, ref }, state);\n hooks.useDraggableItem = (props, state) => createDraggableItem(() => props, state);\n hooks.DragPreview = DragPreview;\n hooks.renderDragPreview = renderDragPreview;\n hooks.isVirtualDragging = () =>\n getGlobalDraggingCollectionRef() != null || getGlobalDraggingKeys().size > 0;\n }\n\n if (isDroppable) {\n hooks.useDroppableCollectionState = (props: DroppableCollectionStateOptions) => {\n return createDroppableCollectionState(() => ({\n acceptedDragTypes: options.acceptedDragTypes ?? props.acceptedDragTypes,\n getDropOperation: options.getDropOperation ?? props.getDropOperation,\n onDropEnter: options.onDropEnter ?? props.onDropEnter,\n onDropActivate: options.onDropActivate ?? props.onDropActivate,\n onDropExit: options.onDropExit ?? props.onDropExit,\n onDrop: options.onDrop ?? props.onDrop,\n onInsert: options.onInsert ?? props.onInsert,\n onRootDrop: options.onRootDrop ?? props.onRootDrop,\n onItemDrop: options.onItemDrop ?? props.onItemDrop,\n onReorder: options.onReorder ?? props.onReorder,\n onMove: options.onMove ?? props.onMove,\n shouldAcceptItemDrop: options.shouldAcceptItemDrop ?? props.shouldAcceptItemDrop,\n isDisabled: options.isDisabled ?? props.isDisabled,\n }));\n };\n hooks.useDroppableCollection = (\n props: Omit<DroppableCollectionOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => {\n const acceptedDragTypes = options.acceptedDragTypes ?? props.acceptedDragTypes;\n const normalizedAcceptedDragTypes =\n acceptedDragTypes === \"all\"\n ? \"all\"\n : acceptedDragTypes?.filter(\n (type): type is string | symbol =>\n typeof type === \"string\" || typeof type === \"symbol\",\n );\n return createDroppableCollection(\n () => ({\n ref,\n dropTargetDelegate: options.dropTargetDelegate ?? props.dropTargetDelegate,\n keyboardDelegate: props.keyboardDelegate,\n // Host collection + selection/focus setters, forwarded so keyboard\n // drop-target navigation and post-drop focus restoration work.\n collection: props.collection,\n selectedKeys: props.selectedKeys,\n setSelectedKeys: props.setSelectedKeys,\n setFocusedKey: props.setFocusedKey,\n onKeyDown: props.onKeyDown,\n acceptedDragTypes: normalizedAcceptedDragTypes,\n isDisabled: options.isDisabled ?? props.isDisabled,\n onDropActivate: (e) => {\n (options.onDropActivate ?? props.onDropActivate)?.({\n type: \"dropactivate\",\n target: e.target,\n x: e.x,\n y: e.y,\n });\n },\n onDrop: (e) => {\n (options.onDrop ?? props.onDrop)?.({\n type: \"drop\",\n target: e.target,\n x: e.x,\n y: e.y,\n items: e.items,\n dropOperation: e.dropOperation,\n });\n },\n onRootDrop: options.onRootDrop ?? props.onRootDrop,\n onItemDrop: (e) => {\n if (e.target.type === \"item\") {\n (options.onItemDrop ?? props.onItemDrop)?.({\n items: e.items,\n target: e.target,\n dropOperation: e.dropOperation,\n isInternal: e.isInternal,\n });\n }\n },\n onInsert: (e) => {\n if (e.target.type === \"item\") {\n (options.onInsert ?? props.onInsert)?.({\n items: e.items,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n onReorder: (e) => {\n if (e.target.type === \"item\") {\n (options.onReorder ?? props.onReorder)?.({\n keys: e.keys,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n onMove: (e) => {\n if (e.target.type === \"item\") {\n (options.onMove ?? props.onMove)?.({\n keys: e.keys,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n }),\n state,\n );\n };\n hooks.useDroppableItem = (\n props: Omit<DroppableItemOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => createDroppableItem(() => ({ ...props, ref }), state);\n hooks.useDropIndicator = (\n props: { target: DropTarget },\n state: DroppableCollectionState,\n _ref: Accessor<HTMLElement | null>,\n ) => {\n const target = props.target;\n const activeTarget = state.target;\n const isDropTarget =\n activeTarget?.type === target.type &&\n (target.type === \"root\" ||\n (activeTarget.type === \"item\" &&\n target.type === \"item\" &&\n activeTarget.key === target.key &&\n activeTarget.dropPosition === target.dropPosition));\n return {\n dropIndicatorProps: {\n role: \"option\",\n \"aria-disabled\": true,\n \"aria-hidden\": isDropTarget ? undefined : \"true\",\n tabIndex: -1,\n \"data-drop-target\": isDropTarget ? \"\" : undefined,\n },\n isDropTarget,\n isHidden: !isDropTarget,\n };\n };\n hooks.renderDropIndicator = renderDropIndicator;\n hooks.dropTargetDelegate = dropTargetDelegate;\n hooks.ListDropTargetDelegate = ListDropTargetDelegate;\n }\n\n return {\n dragAndDropHooks: hooks,\n };\n}\n"],"mappings":";;;;AAUA,SAAgB,YAAY,OAAsC;CAChE,MAAM,SAAS,OAAO,gBAAgB;CACtC,MAAM,iBAAiB,UAAyC;EAC9D,IAAI,CAAC,OAAO,OAAO;EACnB,IAAI,UAAU,iBAAiB,aAAa,OAAO;EACnD,OAAO,OAAO,UAAU,YAAa,MAAgC,aAAa;CACpF;CAEA,IAAI,MAAM,KAAK;EACb,MAAM,YAAiC,OAAO,aAAa;GACzD,MAAM,WAAW,MAAM,SAAS,KAAK;GACrC,IAAI,CAAC,UAAU;IACb,SAAS,IAAI;IACb;GACF;GACA,IAAI,OAAO,aAAa,YAAY,aAAa,QAAQ,aAAa,UAAU;IAC9E,MAAM,eAAe;IACrB,SACE,cAAc,aAAa,OAAO,IAAI,aAAa,UAAU,MAC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AAO,SAAS,QACpB,CAAC,QAAQ,YAAY,MAAM,SAAA,GAAY;MACrC,OAAO,EAAE;MACT,QAAQ,EAAE;MACV,eAAe,EAAE;KACnB,CAAC;IAEL;IACA,YAAY,MAAM;KAChB,IAAI,EAAE,OAAO,SAAS,QACpB,CAAC,QAAQ,aAAa,MAAM,UAAA,GAAa;MACvC,MAAM,EAAE;MACR,QAAQ,EAAE;MACV,eAAe,EAAE;KACnB,CAAC;IAEL;IACA,SAAS,MAAM;KACb,IAAI,EAAE,OAAO,SAAS,QACpB,CAAC,QAAQ,UAAU,MAAM,OAAA,GAAU;MACjC,MAAM,EAAE;MACR,QAAQ,EAAE;MACV,eAAe,EAAE;KACnB,CAAC;IAEL;GACF,IACA,KACF;EACF;EACA,MAAM,oBACJ,OACA,OACA,QACG,2BAA2B;GAAE,GAAG;GAAO;EAAI,IAAI,KAAK;EACzD,MAAM,oBACJ,OACA,OACA,SACG;GACH,MAAM,SAAS,MAAM;GACrB,MAAM,eAAe,MAAM;GAC3B,MAAM,eACJ,cAAc,SAAS,OAAO,SAC7B,OAAO,SAAS,UACd,aAAa,SAAS,UACrB,OAAO,SAAS,UAChB,aAAa,QAAQ,OAAO,OAC5B,aAAa,iBAAiB,OAAO;GAC3C,OAAO;IACL,oBAAoB;KAClB,MAAM;KACN,iBAAiB;KACjB,eAAe,eAAe,KAAA,IAAY;KAC1C,UAAU;KACV,oBAAoB,eAAe,KAAK,KAAA;IAC1C;IACA;IACA,UAAU,CAAC;GACb;EACF;EACA,MAAM,sBAAsB;EAC5B,MAAM,qBAAqB;EAC3B,MAAM,yBAAyB;CACjC;CAEA,OAAO,EACL,kBAAkB,MACpB;AACF"}
package/dist/utils.d.ts CHANGED
@@ -180,6 +180,7 @@ export declare function removeDataAttributes<T extends Record<string, unknown>>(
180
180
  */
181
181
  export declare function filterDOMProps<R extends object = Record<string, unknown>>(props: object, options?: {
182
182
  global?: boolean;
183
+ events?: boolean;
183
184
  }): R;
184
185
  export interface ClientOnlyProps {
185
186
  /** The children to render only on the client */
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,GAAG,EACR,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,aAAa,EAUnB,MAAM,UAAU,CAAC;AAIlB;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC;AAEhF;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC;AAE3E;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,GAAG,CAAC,aAAa,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,GAAG,CAAC,aAAa,CAAC,CAAC;AAE7F;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,yFAAyF;IACzF,QAAQ,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAC7B,yGAAyG;IACzG,KAAK,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAC/B,wGAAwG;IACxG,KAAK,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,YAAY,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,gDAAgD;IAChD,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxB,gDAAgD;IAChD,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,aAAa,GAAG,SAAS,CA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K,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3C,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC;CACvB,GAAG,GAAG,CAAC,OAAO,CAcd;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,EAAE,GAAG,SAAS,CAEnE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,EACzF,MAAM,EAAE,CAAC,GACR,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAYpC;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAUnF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvE,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,CAAC,CAqCH;AAED,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,eAAe,CAwBrD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,IAAI,QAAQ,CAAC,OAAO,CAAC,CAiCjD"}
package/dist/utils.js CHANGED
@@ -197,7 +197,7 @@ function removeDataAttributes(props) {
197
197
  * @returns Object containing only valid DOM props. Use type parameter R to specify return type.
198
198
  */
199
199
  function filterDOMProps(props, options = {}) {
200
- const { global = false } = options;
200
+ const { global = false, events = true } = options;
201
201
  const result = {};
202
202
  const globalAttrs = new Set([
203
203
  "id",
@@ -217,7 +217,7 @@ function filterDOMProps(props, options = {}) {
217
217
  const ariaAttrs = /^aria-/;
218
218
  const dataAttrs = /^data-/;
219
219
  const eventHandlers = /^on[A-Z]/;
220
- for (const key in props) if (Object.prototype.hasOwnProperty.call(props, key) && (global && globalAttrs.has(key) || ariaAttrs.test(key) || dataAttrs.test(key) || eventHandlers.test(key))) result[key] = props[key];
220
+ for (const key in props) if (Object.prototype.hasOwnProperty.call(props, key) && (global && globalAttrs.has(key) || ariaAttrs.test(key) || dataAttrs.test(key) || events && eventHandlers.test(key))) result[key] = props[key];
221
221
  return result;
222
222
  }
223
223
  /**
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["JSX","Accessor","Context","FlowComponent","createComponent","createContext","useContext","createMemo","createSignal","onMount","sharedConfig","untrack","Show","isServer","mergeProps","RenderChildren","Element","renderProps","T","ClassNameOrFunction","StyleOrFunction","CSSProperties","RenderPropsBase","children","class","style","SlotProps","slot","DEFAULT_SLOT","RenderPropsResult","renderChildren","renderChildrenStable","values","useRenderProps","props","defaultClassName","className","computedClass","currentValues","computedStyle","length","snapshot","view","key","Object","keys","Array","defineProperty","enumerable","configurable","get","composeRenderProps","base","override","RefLike","el","current","WithRef","ref","E","SlottedValue","slots","Record","SlottedContextValue","ContextValue","HTMLElement","createSlottedContext","assignRef","mergeRefs","refs","seen","Set","has","add","useSlottedContext","context","ctx","slotName","slotValue","validSlots","map","name","join","Error","useContextProps","TProps","TRef","Partial","contextRef","contextProps","mergedRef","mergedProps","useSlot","initialState","hasSlot","setHasSlot","hasRun","Provider","build","index","value","dataAttr","undefined","createDataAttributes","result","entries","camelToKebab","str","replace","toLowerCase","removeDataAttributes","startsWith","filterDOMProps","options","global","R","globalAttrs","ariaAttrs","dataAttrs","eventHandlers","prototype","hasOwnProperty","call","test","ClientOnlyProps","fallback","ClientOnly","_$memo","isHydrated","setIsHydrated","_$createComponent","when","useIsHydrated"],"sources":["../src/utils.tsx"],"sourcesContent":["/**\n * Utility functions for solidaria-components\n * Port of react-aria-components/src/utils.tsx\n */\n\nimport {\n type JSX,\n type Accessor,\n type Context,\n type FlowComponent,\n createComponent,\n createContext,\n useContext,\n createMemo,\n createSignal,\n onMount,\n sharedConfig,\n untrack,\n Show,\n} from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport { mergeProps } from \"@proyecto-viviana/solidaria\";\n\n/**\n * Render props pattern - children can be a function that receives state\n */\nexport type RenderChildren<T> = JSX.Element | ((renderProps: T) => JSX.Element);\n\n/**\n * Class name can be a string or a function that computes based on state\n */\nexport type ClassNameOrFunction<T> = string | ((renderProps: T) => string);\n\n/**\n * Style can be an object or a function that computes based on state\n */\nexport type StyleOrFunction<T> = JSX.CSSProperties | ((renderProps: T) => JSX.CSSProperties);\n\n/**\n * Common render props interface\n */\nexport interface RenderPropsBase<T> {\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<T>;\n /** The CSS className for the element. A function may be provided to compute the class based on state. */\n class?: ClassNameOrFunction<T>;\n /** The inline style for the element. A function may be provided to compute the style based on state. */\n style?: StyleOrFunction<T>;\n}\n\n/**\n * Slot props for named slots\n */\nexport interface SlotProps {\n /** A slot name for the component. */\n slot?: string;\n}\n\nexport const DEFAULT_SLOT = \"default\";\n\n/**\n * Return type for useRenderProps\n */\nexport interface RenderPropsResult<T> {\n /** Accessor for class - safe to call anytime */\n class: Accessor<string>;\n /** Accessor for style - safe to call anytime */\n style: Accessor<JSX.CSSProperties | undefined>;\n /**\n * Render the children. This is a function that returns JSX, NOT a getter.\n * For SSR compatibility, this should be called within the JSX tree.\n *\n * Usage in components:\n * {renderProps.renderChildren()}\n *\n * Or if you need the raw children/function:\n * {renderProps.renderChildren()}\n */\n renderChildren: () => JSX.Element;\n /**\n * Render a render-prop child ONCE over a reactive view of the values,\n * mirroring how React reconciles a render prop's returned tree in place.\n *\n * Prefer this over `renderChildren()` for interactive leaf components (a\n * Tab, a toggle segment) whose child wraps the pressable element: re-invoking\n * the render function on every values() change recreates that DOM subtree,\n * which detaches the pointer/press target mid-gesture and makes the browser\n * suppress the native `click` (createPress then has to synthesize an\n * untrusted fallback click — a visible parity break vs React). Static (non\n * function) children are returned untouched, exactly like `renderChildren`.\n */\n renderChildrenStable: () => JSX.Element;\n /** The raw children prop (function or JSX) - use renderChildren() in most cases */\n children: RenderChildren<T> | undefined;\n /** The render props values accessor */\n values: Accessor<T>;\n}\n\n/**\n * Resolves render props (children, class, style) based on component state.\n *\n * For SSR compatibility, children are NOT evaluated eagerly. Instead:\n * - Use `renderChildren()` to render children with current values\n * - Or access `children` directly if you need the raw prop\n *\n * This avoids the getter pattern that causes SSR hydration mismatches.\n */\nexport function useRenderProps<T extends object>(\n props: RenderPropsBase<T> & { defaultClassName?: string },\n values: Accessor<T>,\n): RenderPropsResult<T> {\n // Don't destructure children — access lazily to avoid eager evaluation\n // that would trigger child component creation before context providers mount.\n const { class: className, style, defaultClassName = \"\" } = props;\n\n // Compute class and style eagerly (they don't depend on context)\n const computedClass = createMemo(() => {\n const currentValues = values();\n return typeof className === \"function\"\n ? className(currentValues)\n : (className ?? defaultClassName);\n });\n\n const computedStyle = createMemo(() => {\n const currentValues = values();\n return typeof style === \"function\" ? style(currentValues) : style;\n });\n\n // Return object with explicit function for rendering children\n // Children are accessed lazily during render (inside context providers)\n return {\n class: computedClass,\n style: computedStyle,\n renderChildren: () => {\n const children = props.children;\n // Only read values() for render-prop children. Static JSX children must\n // not track the render-state memo: re-running the insertion effect\n // recreates real DOM nodes on every hover/press/focus flip (React keeps\n // them stable via vdom diffing), which detaches the pressed node\n // mid-press and suppresses the browser's native click.\n //\n // A render prop takes the values argument, so classify by arity — the\n // same convention `solid-js/h` uses for dynamic props. A zero-arg\n // function child is an accessor (a compiled `{expression}` child, a\n // solid-refresh dev wrapper, a one-shot `solid-js/h` element thunk):\n // return it untouched so the insert machinery unwraps it in its own\n // nested effect. Calling it here would track its reads in the shared\n // insertion effect, and every re-run disposes the child computations\n // that effect owns — a one-shot h thunk then hands back the same\n // disposed node, leaving connected DOM whose reactivity is dead.\n return typeof children === \"function\" && children.length > 0\n ? children(values())\n : (children as JSX.Element);\n },\n renderChildrenStable: () => {\n const children = props.children;\n if (typeof children !== \"function\" || children.length === 0) {\n return children as JSX.Element;\n }\n // Invoke the render function exactly once, over a getter view of the\n // values, so the returned DOM is created a single time and only the\n // reactive reads inside it (JSX bindings, component props) re-run on a\n // values() change — React's reconciliation, not Solid's recreation.\n //\n // `untrack` keeps the enclosing insert from tracking values() (so it\n // never re-runs and never recreates), but does NOT change the owner:\n // this still executes inside the caller's insert scope, so any slotted\n // context the render prop reads binds against the surrounding provider.\n //\n // The value keys are read once here (untracked). Render-state memos in\n // this codebase return a fixed-shape object, so the key set is stable.\n return untrack(() => {\n const snapshot = values();\n const view = {} as T;\n for (const key of Object.keys(snapshot) as Array<keyof T & string>) {\n Object.defineProperty(view, key, {\n enumerable: true,\n configurable: true,\n get: () => values()[key],\n });\n }\n return (children as (renderProps: T) => JSX.Element)(view);\n });\n },\n get children() {\n return props.children;\n },\n values,\n };\n}\n\nexport function composeRenderProps<T extends object>(\n base: RenderPropsBase<T> | undefined,\n override: RenderPropsBase<T> | undefined,\n): RenderPropsBase<T> {\n if (!base) return override ?? {};\n if (!override) return base;\n return {\n children: override.children ?? base.children,\n class: override.class ?? base.class,\n style: override.style ?? base.style,\n };\n}\n\n/** A Solid ref target: a callback, a mutable `{ current }` object, or undefined. */\nexport type RefLike<T> = T | ((el: T) => void) | { current?: T | null } | undefined;\n\n/** A value paired with an optional ref to merge onto the consuming element. */\nexport type WithRef<T, E> = T & { ref?: RefLike<E> };\n\n/**\n * A context value carrying named slots (mirrors react-aria-components'\n * `SlottedValue`). Each entry under `slots` is the props object delivered to the\n * component rendered with the matching `slot` name.\n */\nexport interface SlottedValue<T> {\n slots?: Record<string, T>;\n}\n\n/** A slotted context value: a slots record, a bare value, or null/undefined. */\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\n\n/**\n * The value type for a context consumed via {@link useContextProps}. Mirrors\n * upstream `ContextValue<T, E>`: it may carry `slots` and an optional `ref` to\n * merge onto the consuming element.\n */\nexport type ContextValue<T, E = HTMLElement> = SlottedContextValue<WithRef<T, E>>;\n\n/**\n * Creates a context that can carry either a bare value or a `slots` record.\n */\nexport function createSlottedContext<T>() {\n return createContext<SlottedContextValue<T>>(null);\n}\n\n/** Assigns an element to a Solid ref (callback or mutable `{ current }` object). */\nexport function assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n (ref as (el: T) => void)(el);\n } else if (typeof ref === \"object\" && \"current\" in ref) {\n (ref as { current?: T | null }).current = el;\n }\n}\n\n/** Merges multiple Solid refs into one callback that forwards to each, once. */\nexport function mergeRefs<T>(...refs: Array<RefLike<T>>): (el: T) => void {\n return (el: T) => {\n const seen = new Set<RefLike<T>>();\n for (const ref of refs) {\n if (!ref || seen.has(ref)) {\n continue;\n }\n\n seen.add(ref);\n assignRef(ref, el);\n }\n };\n}\n\n/**\n * Resolves a (possibly slotted) context value for the given slot name. Port of\n * react-aria-components' `useSlottedContext`:\n * - `slot === null` opts out of the context entirely (returns `null`);\n * - if the context carries a `slots` record, the entry for `slot` (or\n * {@link DEFAULT_SLOT}) is returned, throwing on an unknown slot name;\n * - otherwise the bare context value is returned.\n */\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null,\n): T | null | undefined {\n const ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means: ignore this context.\n return null;\n }\n\n if (ctx && typeof ctx === \"object\" && \"slots\" in ctx && ctx.slots) {\n const slots = ctx.slots as Record<string, T>;\n const slotName = slot || DEFAULT_SLOT;\n const slotValue = slots[slotName];\n if (!slotValue) {\n const validSlots = Object.keys(slots)\n .map((name) => `\"${name}\"`)\n .join(\", \");\n throw new Error(\n slot\n ? `Invalid slot \"${slot}\". Valid slot names are ${validSlots}.`\n : `A slot prop is required. Valid slot names are ${validSlots}.`,\n );\n }\n return slotValue;\n }\n\n return ctx as T | null | undefined;\n}\n\n/**\n * Merges context-provided props and a context ref into a component's own props\n * and ref. Port of react-aria-components' `useContextProps`:\n * - the context is resolved for `props.slot` via {@link useSlottedContext};\n * - props win over context props (handler props are chained by `mergeProps`);\n * - the component's own ref and the context's ref merge into one callback.\n *\n * The prop merge stays reactive (Solid `mergeProps` preserves getters), so prop\n * changes keep flowing; the context value is read once at setup, matching a single\n * upstream render.\n */\nexport function useContextProps<TProps extends SlotProps, TRef>(\n props: TProps,\n ref: RefLike<TRef>,\n context: Context<ContextValue<TProps, TRef>>,\n): [TProps, (el: TRef) => void] {\n const ctx = (useSlottedContext(context, props.slot) ?? {}) as WithRef<Partial<TProps>, TRef>;\n const { ref: contextRef, ...contextProps } = ctx;\n const mergedRef = mergeRefs(ref, contextRef);\n const mergedProps = mergeProps(contextProps as object, props as object) as unknown as TProps;\n return [mergedProps, mergedRef];\n}\n\n/**\n * Detects whether slotted content was rendered into a placeholder, for the\n * aria-label fallback pattern. Port of react-aria-components' `useSlot`: returns a\n * ref callback to attach to the placeholder and an accessor that is `true` while\n * an element is mounted there. The accessor flips to `false` after mount if the\n * ref never ran (no slotted content was provided).\n */\nexport function useSlot(initialState = true): [(el: Element | null) => void, Accessor<boolean>] {\n const [hasSlot, setHasSlot] = createSignal(initialState);\n let hasRun = false;\n const ref = (el: Element | null) => {\n hasRun = true;\n setHasSlot(!!el);\n };\n onMount(() => {\n if (!hasRun) {\n setHasSlot(false);\n }\n });\n return [ref, hasSlot];\n}\n\n/**\n * Nests a set of context providers around `children`. Port of\n * react-aria-components' `Provider`: each `[Context, value]` pair wraps the\n * previous result, so the LAST pair is the outermost provider — matching upstream's\n * wrap-in-iteration-order.\n *\n * `children` is read through a lazy getter inside the innermost provider so child\n * components are *created* within every provider's owner; Solid binds `useContext`\n * at component-execution time, so eager children would miss these providers.\n */\nexport function Provider(props: {\n values: Array<[Context<unknown>, unknown]>;\n children: JSX.Element;\n}): JSX.Element {\n const build = (index: number): JSX.Element => {\n if (index < 0) {\n return props.children;\n }\n const [context, value] = props.values[index];\n return createComponent(context.Provider, {\n value,\n get children() {\n return build(index - 1);\n },\n });\n };\n return build(props.values.length - 1);\n}\n\n/**\n * Converts boolean state values to data attributes\n */\nexport function dataAttr(value: boolean | undefined): \"\" | undefined {\n return value ? \"\" : undefined;\n}\n\n/**\n * Creates data attributes from render props\n */\nexport function createDataAttributes<T extends Record<string, boolean | string | undefined>>(\n values: T,\n): Record<string, string | undefined> {\n const result: Record<string, string | undefined> = {};\n\n for (const [key, value] of Object.entries(values)) {\n if (typeof value === \"boolean\") {\n result[`data-${camelToKebab(key)}`] = value ? \"\" : undefined;\n } else if (value !== undefined) {\n result[`data-${camelToKebab(key)}`] = value;\n }\n }\n\n return result;\n}\n\nfunction camelToKebab(str: string): string {\n return str.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n}\n\n/**\n * Remove data attributes from props (for internal use)\n */\nexport function removeDataAttributes<T extends Record<string, unknown>>(props: T): T {\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (!key.startsWith(\"data-\")) {\n result[key] = value;\n }\n }\n\n return result as T;\n}\n\n/**\n * Filter DOM props - keep only valid DOM attributes.\n *\n * @param props - Component props to filter\n * @param options - Options for filtering (global: include global attrs)\n * @returns Object containing only valid DOM props. Use type parameter R to specify return type.\n */\nexport function filterDOMProps<R extends object = Record<string, unknown>>(\n props: object,\n options: { global?: boolean } = {},\n): R {\n const { global = false } = options;\n const result: Record<string, unknown> = {};\n\n const globalAttrs = new Set([\n \"id\",\n \"class\",\n \"style\",\n \"tabIndex\",\n \"role\",\n \"title\",\n \"lang\",\n \"dir\",\n \"hidden\",\n \"draggable\",\n \"accessKey\",\n \"contentEditable\",\n \"spellcheck\",\n ]);\n\n const ariaAttrs = /^aria-/;\n const dataAttrs = /^data-/;\n const eventHandlers = /^on[A-Z]/;\n\n for (const key in props) {\n if (\n Object.prototype.hasOwnProperty.call(props, key) &&\n ((global && globalAttrs.has(key)) ||\n ariaAttrs.test(key) ||\n dataAttrs.test(key) ||\n eventHandlers.test(key))\n ) {\n result[key] = (props as Record<string, unknown>)[key];\n }\n }\n\n return result as R;\n}\n\nexport interface ClientOnlyProps {\n /** The children to render only on the client */\n children: JSX.Element;\n /** Optional fallback to render during SSR and initial hydration */\n fallback?: JSX.Element;\n}\n\n/**\n * ClientOnly component - renders children only on the client side.\n *\n * During SSR, renders the fallback (or nothing).\n * During hydration, renders the same fallback to match SSR.\n * After hydration completes, switches to render children.\n *\n * This is useful for components that rely on browser APIs or\n * have different server/client output.\n *\n * @example\n * ```tsx\n * <ClientOnly fallback={<div>Loading...</div>}>\n * <Calendar />\n * </ClientOnly>\n * ```\n */\nexport const ClientOnly: FlowComponent<ClientOnlyProps> = (props) => {\n // On server, always render fallback\n if (isServer) {\n return <>{props.fallback}</>;\n }\n\n // Outside a hydration walk there is nothing to defer (see useIsHydrated).\n if (!sharedConfig.context) {\n return <>{props.children}</>;\n }\n\n // Hydrating: render the fallback until the walk completes.\n const [isHydrated, setIsHydrated] = createSignal(false);\n\n // onMount runs after hydration is complete\n onMount(() => {\n setIsHydrated(true);\n });\n\n return (\n <Show when={isHydrated()} fallback={props.fallback}>\n {props.children}\n </Show>\n );\n};\n\n/**\n * Returns true only on the client after hydration is complete.\n * Can be used to conditionally render client-only content.\n *\n * @example\n * ```tsx\n * const hydrated = useIsHydrated();\n * return (\n * <Show when={hydrated()} fallback={<Placeholder />}>\n * <ClientOnlyComponent />\n * </Show>\n * );\n * ```\n */\nexport function useIsHydrated(): Accessor<boolean> {\n // On server, always return false\n if (isServer) {\n return () => false;\n }\n\n // Outside a hydration walk (pure CSR, or a remount created after hydration\n // finished) the caller is already \"hydrated\" — report true immediately.\n // Solid sets `sharedConfig.context` only while synchronously walking\n // server-rendered DOM, so this is exactly the window the false→true flip\n // exists for. A fresh per-instance false→true flip on every remount is not\n // just wasted work: ancestor `children()`/`Context.Provider` resolution\n // unwraps and tracks the <Show> accessor this hook gates, so the post-mount\n // flip re-resolves those children, recreates the subtree (with another fresh\n // signal), and loops forever — a stack overflow with no overlay rendered.\n if (!sharedConfig.context) {\n return () => true;\n }\n\n // Hydrating: start false (so the first render matches the server, which\n // emitted nothing for hydrated-gated content) and flip to true after mount.\n const [isHydrated, setIsHydrated] = createSignal(false);\n\n // onMount runs in the effect phase — *after* the synchronous hydration pass\n // has finished walking the server DOM — so flipping here renders the gated\n // content as a fresh client-side update (Portal: no getNextElement walk, no\n // mismatch). This mirrors the component gate above and is strictly earlier\n // than a rAF tick.\n onMount(() => {\n setIsHydrated(true);\n });\n\n return isHydrated;\n}\n"],"mappings":";;;;;;;;AA0DA,MAAa4B,eAAe;;;;;;;;;;AAiD5B,SAAgBK,eACdC,OACAF,QACsB;CAGtB,MAAM,EAAER,OAAOY,WAAWX,OAAOU,mBAAmB,OAAOD;CAiB3D,OAAO;EACLV,OAfoBjB,iBAAiB;GACrC,MAAM+B,gBAAgBN,OAAO;GAC7B,OAAO,OAAOI,cAAc,aACxBA,UAAUE,aAAa,IACtBF,aAAaD;EACpB,CAUSE;EACPZ,OAToBlB,iBAAiB;GACrC,MAAM+B,gBAAgBN,OAAO;GAC7B,OAAO,OAAOP,UAAU,aAAaA,MAAMa,aAAa,IAAIb;EAC9D,CAMSc;EACPT,sBAAsB;GACpB,MAAMP,WAAWW,MAAMX;GAgBvB,OAAO,OAAOA,aAAa,cAAcA,SAASiB,SAAS,IACvDjB,SAASS,OAAO,CAAC,IAChBT;EACP;EACAQ,4BAA4B;GAC1B,MAAMR,WAAWW,MAAMX;GACvB,IAAI,OAAOA,aAAa,cAAcA,SAASiB,WAAW,GACxD,OAAOjB;GAcT,OAAOZ,cA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AIrD,OAAO6D;AACT;;;;;;;;;;;;;;;;;;AA0BA,MAAasB,cAA8C5F,UAAU;CAEnE,IAAIrB,UACF,OAAAkH,WAAU7F,MAAM2F,QAAQ;CAI1B,IAAI,CAACnH,aAAaiE,SAChB,OAAAoD,WAAU7F,MAAMX,QAAQ;CAI1B,MAAM,CAACyG,YAAYC,iBAAiBzH,aAAa,KAAK;CAGtDC,cAAc;EACZwH,cAAc,IAAI;CACpB,CAAC;CAED,OAAAC,gBACGtH,MAAI;EAAA,IAACuH,OAAI;GAAA,OAAEH,WAAW;EAAC;EAAA,IAAEH,WAAQ;GAAA,OAAE3F,MAAM2F;EAAQ;EAAA,IAAAtG,WAAA;GAAA,OAC/CW,MAAMX;EAAQ;CAAA,CAAA;AAGrB;;;;;;;;;;;;;;;AAgBA,SAAgB6G,gBAAmC;CAEjD,IAAIvH,UACF,aAAa;CAYf,IAAI,CAACH,aAAaiE,SAChB,aAAa;CAKf,MAAM,CAACqD,YAAYC,iBAAiBzH,aAAa,KAAK;CAOtDC,cAAc;EACZwH,cAAc,IAAI;CACpB,CAAC;CAED,OAAOD;AACT"}
1
+ {"version":3,"file":"utils.js","names":["JSX","Accessor","Context","FlowComponent","createComponent","createContext","useContext","createMemo","createSignal","onMount","sharedConfig","untrack","Show","isServer","mergeProps","RenderChildren","Element","renderProps","T","ClassNameOrFunction","StyleOrFunction","CSSProperties","RenderPropsBase","children","class","style","SlotProps","slot","DEFAULT_SLOT","RenderPropsResult","renderChildren","renderChildrenStable","values","useRenderProps","props","defaultClassName","className","computedClass","currentValues","computedStyle","length","snapshot","view","key","Object","keys","Array","defineProperty","enumerable","configurable","get","composeRenderProps","base","override","RefLike","el","current","WithRef","ref","E","SlottedValue","slots","Record","SlottedContextValue","ContextValue","HTMLElement","createSlottedContext","assignRef","mergeRefs","refs","seen","Set","has","add","useSlottedContext","context","ctx","slotName","slotValue","validSlots","map","name","join","Error","useContextProps","TProps","TRef","Partial","contextRef","contextProps","mergedRef","mergedProps","useSlot","initialState","hasSlot","setHasSlot","hasRun","Provider","build","index","value","dataAttr","undefined","createDataAttributes","result","entries","camelToKebab","str","replace","toLowerCase","removeDataAttributes","startsWith","filterDOMProps","options","global","events","R","globalAttrs","ariaAttrs","dataAttrs","eventHandlers","prototype","hasOwnProperty","call","test","ClientOnlyProps","fallback","ClientOnly","_$memo","isHydrated","setIsHydrated","_$createComponent","when","useIsHydrated"],"sources":["../src/utils.tsx"],"sourcesContent":["/**\n * Utility functions for solidaria-components\n * Port of react-aria-components/src/utils.tsx\n */\n\nimport {\n type JSX,\n type Accessor,\n type Context,\n type FlowComponent,\n createComponent,\n createContext,\n useContext,\n createMemo,\n createSignal,\n onMount,\n sharedConfig,\n untrack,\n Show,\n} from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport { mergeProps } from \"@proyecto-viviana/solidaria\";\n\n/**\n * Render props pattern - children can be a function that receives state\n */\nexport type RenderChildren<T> = JSX.Element | ((renderProps: T) => JSX.Element);\n\n/**\n * Class name can be a string or a function that computes based on state\n */\nexport type ClassNameOrFunction<T> = string | ((renderProps: T) => string);\n\n/**\n * Style can be an object or a function that computes based on state\n */\nexport type StyleOrFunction<T> = JSX.CSSProperties | ((renderProps: T) => JSX.CSSProperties);\n\n/**\n * Common render props interface\n */\nexport interface RenderPropsBase<T> {\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<T>;\n /** The CSS className for the element. A function may be provided to compute the class based on state. */\n class?: ClassNameOrFunction<T>;\n /** The inline style for the element. A function may be provided to compute the style based on state. */\n style?: StyleOrFunction<T>;\n}\n\n/**\n * Slot props for named slots\n */\nexport interface SlotProps {\n /** A slot name for the component. */\n slot?: string;\n}\n\nexport const DEFAULT_SLOT = \"default\";\n\n/**\n * Return type for useRenderProps\n */\nexport interface RenderPropsResult<T> {\n /** Accessor for class - safe to call anytime */\n class: Accessor<string>;\n /** Accessor for style - safe to call anytime */\n style: Accessor<JSX.CSSProperties | undefined>;\n /**\n * Render the children. This is a function that returns JSX, NOT a getter.\n * For SSR compatibility, this should be called within the JSX tree.\n *\n * Usage in components:\n * {renderProps.renderChildren()}\n *\n * Or if you need the raw children/function:\n * {renderProps.renderChildren()}\n */\n renderChildren: () => JSX.Element;\n /**\n * Render a render-prop child ONCE over a reactive view of the values,\n * mirroring how React reconciles a render prop's returned tree in place.\n *\n * Prefer this over `renderChildren()` for interactive leaf components (a\n * Tab, a toggle segment) whose child wraps the pressable element: re-invoking\n * the render function on every values() change recreates that DOM subtree,\n * which detaches the pointer/press target mid-gesture and makes the browser\n * suppress the native `click` (createPress then has to synthesize an\n * untrusted fallback click — a visible parity break vs React). Static (non\n * function) children are returned untouched, exactly like `renderChildren`.\n */\n renderChildrenStable: () => JSX.Element;\n /** The raw children prop (function or JSX) - use renderChildren() in most cases */\n children: RenderChildren<T> | undefined;\n /** The render props values accessor */\n values: Accessor<T>;\n}\n\n/**\n * Resolves render props (children, class, style) based on component state.\n *\n * For SSR compatibility, children are NOT evaluated eagerly. Instead:\n * - Use `renderChildren()` to render children with current values\n * - Or access `children` directly if you need the raw prop\n *\n * This avoids the getter pattern that causes SSR hydration mismatches.\n */\nexport function useRenderProps<T extends object>(\n props: RenderPropsBase<T> & { defaultClassName?: string },\n values: Accessor<T>,\n): RenderPropsResult<T> {\n // Don't destructure children — access lazily to avoid eager evaluation\n // that would trigger child component creation before context providers mount.\n const { class: className, style, defaultClassName = \"\" } = props;\n\n // Compute class and style eagerly (they don't depend on context)\n const computedClass = createMemo(() => {\n const currentValues = values();\n return typeof className === \"function\"\n ? className(currentValues)\n : (className ?? defaultClassName);\n });\n\n const computedStyle = createMemo(() => {\n const currentValues = values();\n return typeof style === \"function\" ? style(currentValues) : style;\n });\n\n // Return object with explicit function for rendering children\n // Children are accessed lazily during render (inside context providers)\n return {\n class: computedClass,\n style: computedStyle,\n renderChildren: () => {\n const children = props.children;\n // Only read values() for render-prop children. Static JSX children must\n // not track the render-state memo: re-running the insertion effect\n // recreates real DOM nodes on every hover/press/focus flip (React keeps\n // them stable via vdom diffing), which detaches the pressed node\n // mid-press and suppresses the browser's native click.\n //\n // A render prop takes the values argument, so classify by arity — the\n // same convention `solid-js/h` uses for dynamic props. A zero-arg\n // function child is an accessor (a compiled `{expression}` child, a\n // solid-refresh dev wrapper, a one-shot `solid-js/h` element thunk):\n // return it untouched so the insert machinery unwraps it in its own\n // nested effect. Calling it here would track its reads in the shared\n // insertion effect, and every re-run disposes the child computations\n // that effect owns — a one-shot h thunk then hands back the same\n // disposed node, leaving connected DOM whose reactivity is dead.\n return typeof children === \"function\" && children.length > 0\n ? children(values())\n : (children as JSX.Element);\n },\n renderChildrenStable: () => {\n const children = props.children;\n if (typeof children !== \"function\" || children.length === 0) {\n return children as JSX.Element;\n }\n // Invoke the render function exactly once, over a getter view of the\n // values, so the returned DOM is created a single time and only the\n // reactive reads inside it (JSX bindings, component props) re-run on a\n // values() change — React's reconciliation, not Solid's recreation.\n //\n // `untrack` keeps the enclosing insert from tracking values() (so it\n // never re-runs and never recreates), but does NOT change the owner:\n // this still executes inside the caller's insert scope, so any slotted\n // context the render prop reads binds against the surrounding provider.\n //\n // The value keys are read once here (untracked). Render-state memos in\n // this codebase return a fixed-shape object, so the key set is stable.\n return untrack(() => {\n const snapshot = values();\n const view = {} as T;\n for (const key of Object.keys(snapshot) as Array<keyof T & string>) {\n Object.defineProperty(view, key, {\n enumerable: true,\n configurable: true,\n get: () => values()[key],\n });\n }\n return (children as (renderProps: T) => JSX.Element)(view);\n });\n },\n get children() {\n return props.children;\n },\n values,\n };\n}\n\nexport function composeRenderProps<T extends object>(\n base: RenderPropsBase<T> | undefined,\n override: RenderPropsBase<T> | undefined,\n): RenderPropsBase<T> {\n if (!base) return override ?? {};\n if (!override) return base;\n return {\n children: override.children ?? base.children,\n class: override.class ?? base.class,\n style: override.style ?? base.style,\n };\n}\n\n/** A Solid ref target: a callback, a mutable `{ current }` object, or undefined. */\nexport type RefLike<T> = T | ((el: T) => void) | { current?: T | null } | undefined;\n\n/** A value paired with an optional ref to merge onto the consuming element. */\nexport type WithRef<T, E> = T & { ref?: RefLike<E> };\n\n/**\n * A context value carrying named slots (mirrors react-aria-components'\n * `SlottedValue`). Each entry under `slots` is the props object delivered to the\n * component rendered with the matching `slot` name.\n */\nexport interface SlottedValue<T> {\n slots?: Record<string, T>;\n}\n\n/** A slotted context value: a slots record, a bare value, or null/undefined. */\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\n\n/**\n * The value type for a context consumed via {@link useContextProps}. Mirrors\n * upstream `ContextValue<T, E>`: it may carry `slots` and an optional `ref` to\n * merge onto the consuming element.\n */\nexport type ContextValue<T, E = HTMLElement> = SlottedContextValue<WithRef<T, E>>;\n\n/**\n * Creates a context that can carry either a bare value or a `slots` record.\n */\nexport function createSlottedContext<T>() {\n return createContext<SlottedContextValue<T>>(null);\n}\n\n/** Assigns an element to a Solid ref (callback or mutable `{ current }` object). */\nexport function assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n (ref as (el: T) => void)(el);\n } else if (typeof ref === \"object\" && \"current\" in ref) {\n (ref as { current?: T | null }).current = el;\n }\n}\n\n/** Merges multiple Solid refs into one callback that forwards to each, once. */\nexport function mergeRefs<T>(...refs: Array<RefLike<T>>): (el: T) => void {\n return (el: T) => {\n const seen = new Set<RefLike<T>>();\n for (const ref of refs) {\n if (!ref || seen.has(ref)) {\n continue;\n }\n\n seen.add(ref);\n assignRef(ref, el);\n }\n };\n}\n\n/**\n * Resolves a (possibly slotted) context value for the given slot name. Port of\n * react-aria-components' `useSlottedContext`:\n * - `slot === null` opts out of the context entirely (returns `null`);\n * - if the context carries a `slots` record, the entry for `slot` (or\n * {@link DEFAULT_SLOT}) is returned, throwing on an unknown slot name;\n * - otherwise the bare context value is returned.\n */\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null,\n): T | null | undefined {\n const ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means: ignore this context.\n return null;\n }\n\n if (ctx && typeof ctx === \"object\" && \"slots\" in ctx && ctx.slots) {\n const slots = ctx.slots as Record<string, T>;\n const slotName = slot || DEFAULT_SLOT;\n const slotValue = slots[slotName];\n if (!slotValue) {\n const validSlots = Object.keys(slots)\n .map((name) => `\"${name}\"`)\n .join(\", \");\n throw new Error(\n slot\n ? `Invalid slot \"${slot}\". Valid slot names are ${validSlots}.`\n : `A slot prop is required. Valid slot names are ${validSlots}.`,\n );\n }\n return slotValue;\n }\n\n return ctx as T | null | undefined;\n}\n\n/**\n * Merges context-provided props and a context ref into a component's own props\n * and ref. Port of react-aria-components' `useContextProps`:\n * - the context is resolved for `props.slot` via {@link useSlottedContext};\n * - props win over context props (handler props are chained by `mergeProps`);\n * - the component's own ref and the context's ref merge into one callback.\n *\n * The prop merge stays reactive (Solid `mergeProps` preserves getters), so prop\n * changes keep flowing; the context value is read once at setup, matching a single\n * upstream render.\n */\nexport function useContextProps<TProps extends SlotProps, TRef>(\n props: TProps,\n ref: RefLike<TRef>,\n context: Context<ContextValue<TProps, TRef>>,\n): [TProps, (el: TRef) => void] {\n const ctx = (useSlottedContext(context, props.slot) ?? {}) as WithRef<Partial<TProps>, TRef>;\n const { ref: contextRef, ...contextProps } = ctx;\n const mergedRef = mergeRefs(ref, contextRef);\n const mergedProps = mergeProps(contextProps as object, props as object) as unknown as TProps;\n return [mergedProps, mergedRef];\n}\n\n/**\n * Detects whether slotted content was rendered into a placeholder, for the\n * aria-label fallback pattern. Port of react-aria-components' `useSlot`: returns a\n * ref callback to attach to the placeholder and an accessor that is `true` while\n * an element is mounted there. The accessor flips to `false` after mount if the\n * ref never ran (no slotted content was provided).\n */\nexport function useSlot(initialState = true): [(el: Element | null) => void, Accessor<boolean>] {\n const [hasSlot, setHasSlot] = createSignal(initialState);\n let hasRun = false;\n const ref = (el: Element | null) => {\n hasRun = true;\n setHasSlot(!!el);\n };\n onMount(() => {\n if (!hasRun) {\n setHasSlot(false);\n }\n });\n return [ref, hasSlot];\n}\n\n/**\n * Nests a set of context providers around `children`. Port of\n * react-aria-components' `Provider`: each `[Context, value]` pair wraps the\n * previous result, so the LAST pair is the outermost provider — matching upstream's\n * wrap-in-iteration-order.\n *\n * `children` is read through a lazy getter inside the innermost provider so child\n * components are *created* within every provider's owner; Solid binds `useContext`\n * at component-execution time, so eager children would miss these providers.\n */\nexport function Provider(props: {\n values: Array<[Context<unknown>, unknown]>;\n children: JSX.Element;\n}): JSX.Element {\n const build = (index: number): JSX.Element => {\n if (index < 0) {\n return props.children;\n }\n const [context, value] = props.values[index];\n return createComponent(context.Provider, {\n value,\n get children() {\n return build(index - 1);\n },\n });\n };\n return build(props.values.length - 1);\n}\n\n/**\n * Converts boolean state values to data attributes\n */\nexport function dataAttr(value: boolean | undefined): \"\" | undefined {\n return value ? \"\" : undefined;\n}\n\n/**\n * Creates data attributes from render props\n */\nexport function createDataAttributes<T extends Record<string, boolean | string | undefined>>(\n values: T,\n): Record<string, string | undefined> {\n const result: Record<string, string | undefined> = {};\n\n for (const [key, value] of Object.entries(values)) {\n if (typeof value === \"boolean\") {\n result[`data-${camelToKebab(key)}`] = value ? \"\" : undefined;\n } else if (value !== undefined) {\n result[`data-${camelToKebab(key)}`] = value;\n }\n }\n\n return result;\n}\n\nfunction camelToKebab(str: string): string {\n return str.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n}\n\n/**\n * Remove data attributes from props (for internal use)\n */\nexport function removeDataAttributes<T extends Record<string, unknown>>(props: T): T {\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (!key.startsWith(\"data-\")) {\n result[key] = value;\n }\n }\n\n return result as T;\n}\n\n/**\n * Filter DOM props - keep only valid DOM attributes.\n *\n * @param props - Component props to filter\n * @param options - Options for filtering (global: include global attrs)\n * @returns Object containing only valid DOM props. Use type parameter R to specify return type.\n */\nexport function filterDOMProps<R extends object = Record<string, unknown>>(\n props: object,\n options: { global?: boolean; events?: boolean } = {},\n): R {\n const { global = false, events = true } = options;\n const result: Record<string, unknown> = {};\n\n const globalAttrs = new Set([\n \"id\",\n \"class\",\n \"style\",\n \"tabIndex\",\n \"role\",\n \"title\",\n \"lang\",\n \"dir\",\n \"hidden\",\n \"draggable\",\n \"accessKey\",\n \"contentEditable\",\n \"spellcheck\",\n ]);\n\n const ariaAttrs = /^aria-/;\n const dataAttrs = /^data-/;\n const eventHandlers = /^on[A-Z]/;\n\n for (const key in props) {\n if (\n Object.prototype.hasOwnProperty.call(props, key) &&\n ((global && globalAttrs.has(key)) ||\n ariaAttrs.test(key) ||\n dataAttrs.test(key) ||\n (events && eventHandlers.test(key)))\n ) {\n result[key] = (props as Record<string, unknown>)[key];\n }\n }\n\n return result as R;\n}\n\nexport interface ClientOnlyProps {\n /** The children to render only on the client */\n children: JSX.Element;\n /** Optional fallback to render during SSR and initial hydration */\n fallback?: JSX.Element;\n}\n\n/**\n * ClientOnly component - renders children only on the client side.\n *\n * During SSR, renders the fallback (or nothing).\n * During hydration, renders the same fallback to match SSR.\n * After hydration completes, switches to render children.\n *\n * This is useful for components that rely on browser APIs or\n * have different server/client output.\n *\n * @example\n * ```tsx\n * <ClientOnly fallback={<div>Loading...</div>}>\n * <Calendar />\n * </ClientOnly>\n * ```\n */\nexport const ClientOnly: FlowComponent<ClientOnlyProps> = (props) => {\n // On server, always render fallback\n if (isServer) {\n return <>{props.fallback}</>;\n }\n\n // Outside a hydration walk there is nothing to defer (see useIsHydrated).\n if (!sharedConfig.context) {\n return <>{props.children}</>;\n }\n\n // Hydrating: render the fallback until the walk completes.\n const [isHydrated, setIsHydrated] = createSignal(false);\n\n // onMount runs after hydration is complete\n onMount(() => {\n setIsHydrated(true);\n });\n\n return (\n <Show when={isHydrated()} fallback={props.fallback}>\n {props.children}\n </Show>\n );\n};\n\n/**\n * Returns true only on the client after hydration is complete.\n * Can be used to conditionally render client-only content.\n *\n * @example\n * ```tsx\n * const hydrated = useIsHydrated();\n * return (\n * <Show when={hydrated()} fallback={<Placeholder />}>\n * <ClientOnlyComponent />\n * </Show>\n * );\n * ```\n */\nexport function useIsHydrated(): Accessor<boolean> {\n // On server, always return false\n if (isServer) {\n return () => false;\n }\n\n // Outside a hydration walk (pure CSR, or a remount created after hydration\n // finished) the caller is already \"hydrated\" — report true immediately.\n // Solid sets `sharedConfig.context` only while synchronously walking\n // server-rendered DOM, so this is exactly the window the false→true flip\n // exists for. A fresh per-instance false→true flip on every remount is not\n // just wasted work: ancestor `children()`/`Context.Provider` resolution\n // unwraps and tracks the <Show> accessor this hook gates, so the post-mount\n // flip re-resolves those children, recreates the subtree (with another fresh\n // signal), and loops forever — a stack overflow with no overlay rendered.\n if (!sharedConfig.context) {\n return () => true;\n }\n\n // Hydrating: start false (so the first render matches the server, which\n // emitted nothing for hydrated-gated content) and flip to true after mount.\n const [isHydrated, setIsHydrated] = createSignal(false);\n\n // onMount runs in the effect phase — *after* the synchronous hydration pass\n // has finished walking the server DOM — so flipping here renders the gated\n // content as a fresh client-side update (Portal: no getNextElement walk, no\n // mismatch). This mirrors the component gate above and is strictly earlier\n // than a rAF tick.\n onMount(() => {\n setIsHydrated(true);\n });\n\n return isHydrated;\n}\n"],"mappings":";;;;;;;;AA0DA,MAAa4B,eAAe;;;;;;;;;;AAiD5B,SAAgBK,eACdC,OACAF,QACsB;CAGtB,MAAM,EAAER,OAAOY,WAAWX,OAAOU,mBAAmB,OAAOD;CAiB3D,OAAO;EACLV,OAfoBjB,iBAAiB;GACrC,MAAM+B,gBAAgBN,OAAO;GAC7B,OAAO,OAAOI,cAAc,aACxBA,UAAUE,aAAa,IACtBF,aAAaD;EACpB,CAUSE;EACPZ,OAToBlB,iBAAiB;GACrC,MAAM+B,gBAAgBN,OAAO;GAC7B,OAAO,OAAOP,UAAU,aAAaA,MAAMa,aAAa,IAAIb;EAC9D,CAMSc;EACPT,sBAAsB;GACpB,MAAMP,WAAWW,MAAMX;GAgBvB,OAAO,OAAOA,aAAa,cAAcA,SAASiB,SA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OS,GAAG,MAC7CuE,UAAUG,YAAY7C,IAAI7B,GAAG,KAC7B2E,UAAUM,KAAKjF,GAAG,KAClB4E,UAAUK,KAAKjF,GAAG,KACjBwE,UAAUK,cAAcI,KAAKjF,GAAG,IAEnC6D,OAAO7D,OAAQT,MAAkCS;CAIrD,OAAO6D;AACT;;;;;;;;;;;;;;;;;;AA0BA,MAAauB,cAA8C7F,UAAU;CAEnE,IAAIrB,UACF,OAAAmH,WAAU9F,MAAM4F,QAAQ;CAI1B,IAAI,CAACpH,aAAaiE,SAChB,OAAAqD,WAAU9F,MAAMX,QAAQ;CAI1B,MAAM,CAAC0G,YAAYC,iBAAiB1H,aAAa,KAAK;CAGtDC,cAAc;EACZyH,cAAc,IAAI;CACpB,CAAC;CAED,OAAAC,gBACGvH,MAAI;EAAA,IAACwH,OAAI;GAAA,OAAEH,WAAW;EAAC;EAAA,IAAEH,WAAQ;GAAA,OAAE5F,MAAM4F;EAAQ;EAAA,IAAAvG,WAAA;GAAA,OAC/CW,MAAMX;EAAQ;CAAA,CAAA;AAGrB;;;;;;;;;;;;;;;AAgBA,SAAgB8G,gBAAmC;CAEjD,IAAIxH,UACF,aAAa;CAYf,IAAI,CAACH,aAAaiE,SAChB,aAAa;CAKf,MAAM,CAACsD,YAAYC,iBAAiB1H,aAAa,KAAK;CAOtDC,cAAc;EACZyH,cAAc,IAAI;CACpB,CAAC;CAED,OAAOD;AACT"}
package/dist/utils.jsx CHANGED
@@ -197,7 +197,7 @@ function removeDataAttributes(props) {
197
197
  * @returns Object containing only valid DOM props. Use type parameter R to specify return type.
198
198
  */
199
199
  function filterDOMProps(props, options = {}) {
200
- const { global = false } = options;
200
+ const { global = false, events = true } = options;
201
201
  const result = {};
202
202
  const globalAttrs = new Set([
203
203
  "id",
@@ -217,7 +217,7 @@ function filterDOMProps(props, options = {}) {
217
217
  const ariaAttrs = /^aria-/;
218
218
  const dataAttrs = /^data-/;
219
219
  const eventHandlers = /^on[A-Z]/;
220
- for (const key in props) if (Object.prototype.hasOwnProperty.call(props, key) && (global && globalAttrs.has(key) || ariaAttrs.test(key) || dataAttrs.test(key) || eventHandlers.test(key))) result[key] = props[key];
220
+ for (const key in props) if (Object.prototype.hasOwnProperty.call(props, key) && (global && globalAttrs.has(key) || ariaAttrs.test(key) || dataAttrs.test(key) || events && eventHandlers.test(key))) result[key] = props[key];
221
221
  return result;
222
222
  }
223
223
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"utils.jsx","names":["mergeProps"],"sources":["../src/utils.tsx"],"sourcesContent":["/**\n * Utility functions for solidaria-components\n * Port of react-aria-components/src/utils.tsx\n */\n\nimport {\n type JSX,\n type Accessor,\n type Context,\n type FlowComponent,\n createComponent,\n createContext,\n useContext,\n createMemo,\n createSignal,\n onMount,\n sharedConfig,\n untrack,\n Show,\n} from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport { mergeProps } from \"@proyecto-viviana/solidaria\";\n\n/**\n * Render props pattern - children can be a function that receives state\n */\nexport type RenderChildren<T> = JSX.Element | ((renderProps: T) => JSX.Element);\n\n/**\n * Class name can be a string or a function that computes based on state\n */\nexport type ClassNameOrFunction<T> = string | ((renderProps: T) => string);\n\n/**\n * Style can be an object or a function that computes based on state\n */\nexport type StyleOrFunction<T> = JSX.CSSProperties | ((renderProps: T) => JSX.CSSProperties);\n\n/**\n * Common render props interface\n */\nexport interface RenderPropsBase<T> {\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<T>;\n /** The CSS className for the element. A function may be provided to compute the class based on state. */\n class?: ClassNameOrFunction<T>;\n /** The inline style for the element. A function may be provided to compute the style based on state. */\n style?: StyleOrFunction<T>;\n}\n\n/**\n * Slot props for named slots\n */\nexport interface SlotProps {\n /** A slot name for the component. */\n slot?: string;\n}\n\nexport const DEFAULT_SLOT = \"default\";\n\n/**\n * Return type for useRenderProps\n */\nexport interface RenderPropsResult<T> {\n /** Accessor for class - safe to call anytime */\n class: Accessor<string>;\n /** Accessor for style - safe to call anytime */\n style: Accessor<JSX.CSSProperties | undefined>;\n /**\n * Render the children. This is a function that returns JSX, NOT a getter.\n * For SSR compatibility, this should be called within the JSX tree.\n *\n * Usage in components:\n * {renderProps.renderChildren()}\n *\n * Or if you need the raw children/function:\n * {renderProps.renderChildren()}\n */\n renderChildren: () => JSX.Element;\n /**\n * Render a render-prop child ONCE over a reactive view of the values,\n * mirroring how React reconciles a render prop's returned tree in place.\n *\n * Prefer this over `renderChildren()` for interactive leaf components (a\n * Tab, a toggle segment) whose child wraps the pressable element: re-invoking\n * the render function on every values() change recreates that DOM subtree,\n * which detaches the pointer/press target mid-gesture and makes the browser\n * suppress the native `click` (createPress then has to synthesize an\n * untrusted fallback click — a visible parity break vs React). Static (non\n * function) children are returned untouched, exactly like `renderChildren`.\n */\n renderChildrenStable: () => JSX.Element;\n /** The raw children prop (function or JSX) - use renderChildren() in most cases */\n children: RenderChildren<T> | undefined;\n /** The render props values accessor */\n values: Accessor<T>;\n}\n\n/**\n * Resolves render props (children, class, style) based on component state.\n *\n * For SSR compatibility, children are NOT evaluated eagerly. Instead:\n * - Use `renderChildren()` to render children with current values\n * - Or access `children` directly if you need the raw prop\n *\n * This avoids the getter pattern that causes SSR hydration mismatches.\n */\nexport function useRenderProps<T extends object>(\n props: RenderPropsBase<T> & { defaultClassName?: string },\n values: Accessor<T>,\n): RenderPropsResult<T> {\n // Don't destructure children — access lazily to avoid eager evaluation\n // that would trigger child component creation before context providers mount.\n const { class: className, style, defaultClassName = \"\" } = props;\n\n // Compute class and style eagerly (they don't depend on context)\n const computedClass = createMemo(() => {\n const currentValues = values();\n return typeof className === \"function\"\n ? className(currentValues)\n : (className ?? defaultClassName);\n });\n\n const computedStyle = createMemo(() => {\n const currentValues = values();\n return typeof style === \"function\" ? style(currentValues) : style;\n });\n\n // Return object with explicit function for rendering children\n // Children are accessed lazily during render (inside context providers)\n return {\n class: computedClass,\n style: computedStyle,\n renderChildren: () => {\n const children = props.children;\n // Only read values() for render-prop children. Static JSX children must\n // not track the render-state memo: re-running the insertion effect\n // recreates real DOM nodes on every hover/press/focus flip (React keeps\n // them stable via vdom diffing), which detaches the pressed node\n // mid-press and suppresses the browser's native click.\n //\n // A render prop takes the values argument, so classify by arity — the\n // same convention `solid-js/h` uses for dynamic props. A zero-arg\n // function child is an accessor (a compiled `{expression}` child, a\n // solid-refresh dev wrapper, a one-shot `solid-js/h` element thunk):\n // return it untouched so the insert machinery unwraps it in its own\n // nested effect. Calling it here would track its reads in the shared\n // insertion effect, and every re-run disposes the child computations\n // that effect owns — a one-shot h thunk then hands back the same\n // disposed node, leaving connected DOM whose reactivity is dead.\n return typeof children === \"function\" && children.length > 0\n ? children(values())\n : (children as JSX.Element);\n },\n renderChildrenStable: () => {\n const children = props.children;\n if (typeof children !== \"function\" || children.length === 0) {\n return children as JSX.Element;\n }\n // Invoke the render function exactly once, over a getter view of the\n // values, so the returned DOM is created a single time and only the\n // reactive reads inside it (JSX bindings, component props) re-run on a\n // values() change — React's reconciliation, not Solid's recreation.\n //\n // `untrack` keeps the enclosing insert from tracking values() (so it\n // never re-runs and never recreates), but does NOT change the owner:\n // this still executes inside the caller's insert scope, so any slotted\n // context the render prop reads binds against the surrounding provider.\n //\n // The value keys are read once here (untracked). Render-state memos in\n // this codebase return a fixed-shape object, so the key set is stable.\n return untrack(() => {\n const snapshot = values();\n const view = {} as T;\n for (const key of Object.keys(snapshot) as Array<keyof T & string>) {\n Object.defineProperty(view, key, {\n enumerable: true,\n configurable: true,\n get: () => values()[key],\n });\n }\n return (children as (renderProps: T) => JSX.Element)(view);\n });\n },\n get children() {\n return props.children;\n },\n values,\n };\n}\n\nexport function composeRenderProps<T extends object>(\n base: RenderPropsBase<T> | undefined,\n override: RenderPropsBase<T> | undefined,\n): RenderPropsBase<T> {\n if (!base) return override ?? {};\n if (!override) return base;\n return {\n children: override.children ?? base.children,\n class: override.class ?? base.class,\n style: override.style ?? base.style,\n };\n}\n\n/** A Solid ref target: a callback, a mutable `{ current }` object, or undefined. */\nexport type RefLike<T> = T | ((el: T) => void) | { current?: T | null } | undefined;\n\n/** A value paired with an optional ref to merge onto the consuming element. */\nexport type WithRef<T, E> = T & { ref?: RefLike<E> };\n\n/**\n * A context value carrying named slots (mirrors react-aria-components'\n * `SlottedValue`). Each entry under `slots` is the props object delivered to the\n * component rendered with the matching `slot` name.\n */\nexport interface SlottedValue<T> {\n slots?: Record<string, T>;\n}\n\n/** A slotted context value: a slots record, a bare value, or null/undefined. */\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\n\n/**\n * The value type for a context consumed via {@link useContextProps}. Mirrors\n * upstream `ContextValue<T, E>`: it may carry `slots` and an optional `ref` to\n * merge onto the consuming element.\n */\nexport type ContextValue<T, E = HTMLElement> = SlottedContextValue<WithRef<T, E>>;\n\n/**\n * Creates a context that can carry either a bare value or a `slots` record.\n */\nexport function createSlottedContext<T>() {\n return createContext<SlottedContextValue<T>>(null);\n}\n\n/** Assigns an element to a Solid ref (callback or mutable `{ current }` object). */\nexport function assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n (ref as (el: T) => void)(el);\n } else if (typeof ref === \"object\" && \"current\" in ref) {\n (ref as { current?: T | null }).current = el;\n }\n}\n\n/** Merges multiple Solid refs into one callback that forwards to each, once. */\nexport function mergeRefs<T>(...refs: Array<RefLike<T>>): (el: T) => void {\n return (el: T) => {\n const seen = new Set<RefLike<T>>();\n for (const ref of refs) {\n if (!ref || seen.has(ref)) {\n continue;\n }\n\n seen.add(ref);\n assignRef(ref, el);\n }\n };\n}\n\n/**\n * Resolves a (possibly slotted) context value for the given slot name. Port of\n * react-aria-components' `useSlottedContext`:\n * - `slot === null` opts out of the context entirely (returns `null`);\n * - if the context carries a `slots` record, the entry for `slot` (or\n * {@link DEFAULT_SLOT}) is returned, throwing on an unknown slot name;\n * - otherwise the bare context value is returned.\n */\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null,\n): T | null | undefined {\n const ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means: ignore this context.\n return null;\n }\n\n if (ctx && typeof ctx === \"object\" && \"slots\" in ctx && ctx.slots) {\n const slots = ctx.slots as Record<string, T>;\n const slotName = slot || DEFAULT_SLOT;\n const slotValue = slots[slotName];\n if (!slotValue) {\n const validSlots = Object.keys(slots)\n .map((name) => `\"${name}\"`)\n .join(\", \");\n throw new Error(\n slot\n ? `Invalid slot \"${slot}\". Valid slot names are ${validSlots}.`\n : `A slot prop is required. Valid slot names are ${validSlots}.`,\n );\n }\n return slotValue;\n }\n\n return ctx as T | null | undefined;\n}\n\n/**\n * Merges context-provided props and a context ref into a component's own props\n * and ref. Port of react-aria-components' `useContextProps`:\n * - the context is resolved for `props.slot` via {@link useSlottedContext};\n * - props win over context props (handler props are chained by `mergeProps`);\n * - the component's own ref and the context's ref merge into one callback.\n *\n * The prop merge stays reactive (Solid `mergeProps` preserves getters), so prop\n * changes keep flowing; the context value is read once at setup, matching a single\n * upstream render.\n */\nexport function useContextProps<TProps extends SlotProps, TRef>(\n props: TProps,\n ref: RefLike<TRef>,\n context: Context<ContextValue<TProps, TRef>>,\n): [TProps, (el: TRef) => void] {\n const ctx = (useSlottedContext(context, props.slot) ?? {}) as WithRef<Partial<TProps>, TRef>;\n const { ref: contextRef, ...contextProps } = ctx;\n const mergedRef = mergeRefs(ref, contextRef);\n const mergedProps = mergeProps(contextProps as object, props as object) as unknown as TProps;\n return [mergedProps, mergedRef];\n}\n\n/**\n * Detects whether slotted content was rendered into a placeholder, for the\n * aria-label fallback pattern. Port of react-aria-components' `useSlot`: returns a\n * ref callback to attach to the placeholder and an accessor that is `true` while\n * an element is mounted there. The accessor flips to `false` after mount if the\n * ref never ran (no slotted content was provided).\n */\nexport function useSlot(initialState = true): [(el: Element | null) => void, Accessor<boolean>] {\n const [hasSlot, setHasSlot] = createSignal(initialState);\n let hasRun = false;\n const ref = (el: Element | null) => {\n hasRun = true;\n setHasSlot(!!el);\n };\n onMount(() => {\n if (!hasRun) {\n setHasSlot(false);\n }\n });\n return [ref, hasSlot];\n}\n\n/**\n * Nests a set of context providers around `children`. Port of\n * react-aria-components' `Provider`: each `[Context, value]` pair wraps the\n * previous result, so the LAST pair is the outermost provider — matching upstream's\n * wrap-in-iteration-order.\n *\n * `children` is read through a lazy getter inside the innermost provider so child\n * components are *created* within every provider's owner; Solid binds `useContext`\n * at component-execution time, so eager children would miss these providers.\n */\nexport function Provider(props: {\n values: Array<[Context<unknown>, unknown]>;\n children: JSX.Element;\n}): JSX.Element {\n const build = (index: number): JSX.Element => {\n if (index < 0) {\n return props.children;\n }\n const [context, value] = props.values[index];\n return createComponent(context.Provider, {\n value,\n get children() {\n return build(index - 1);\n },\n });\n };\n return build(props.values.length - 1);\n}\n\n/**\n * Converts boolean state values to data attributes\n */\nexport function dataAttr(value: boolean | undefined): \"\" | undefined {\n return value ? \"\" : undefined;\n}\n\n/**\n * Creates data attributes from render props\n */\nexport function createDataAttributes<T extends Record<string, boolean | string | undefined>>(\n values: T,\n): Record<string, string | undefined> {\n const result: Record<string, string | undefined> = {};\n\n for (const [key, value] of Object.entries(values)) {\n if (typeof value === \"boolean\") {\n result[`data-${camelToKebab(key)}`] = value ? \"\" : undefined;\n } else if (value !== undefined) {\n result[`data-${camelToKebab(key)}`] = value;\n }\n }\n\n return result;\n}\n\nfunction camelToKebab(str: string): string {\n return str.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n}\n\n/**\n * Remove data attributes from props (for internal use)\n */\nexport function removeDataAttributes<T extends Record<string, unknown>>(props: T): T {\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (!key.startsWith(\"data-\")) {\n result[key] = value;\n }\n }\n\n return result as T;\n}\n\n/**\n * Filter DOM props - keep only valid DOM attributes.\n *\n * @param props - Component props to filter\n * @param options - Options for filtering (global: include global attrs)\n * @returns Object containing only valid DOM props. Use type parameter R to specify return type.\n */\nexport function filterDOMProps<R extends object = Record<string, unknown>>(\n props: object,\n options: { global?: boolean } = {},\n): R {\n const { global = false } = options;\n const result: Record<string, unknown> = {};\n\n const globalAttrs = new Set([\n \"id\",\n \"class\",\n \"style\",\n \"tabIndex\",\n \"role\",\n \"title\",\n \"lang\",\n \"dir\",\n \"hidden\",\n \"draggable\",\n \"accessKey\",\n \"contentEditable\",\n \"spellcheck\",\n ]);\n\n const ariaAttrs = /^aria-/;\n const dataAttrs = /^data-/;\n const eventHandlers = /^on[A-Z]/;\n\n for (const key in props) {\n if (\n Object.prototype.hasOwnProperty.call(props, key) &&\n ((global && globalAttrs.has(key)) ||\n ariaAttrs.test(key) ||\n dataAttrs.test(key) ||\n eventHandlers.test(key))\n ) {\n result[key] = (props as Record<string, unknown>)[key];\n }\n }\n\n return result as R;\n}\n\nexport interface ClientOnlyProps {\n /** The children to render only on the client */\n children: JSX.Element;\n /** Optional fallback to render during SSR and initial hydration */\n fallback?: JSX.Element;\n}\n\n/**\n * ClientOnly component - renders children only on the client side.\n *\n * During SSR, renders the fallback (or nothing).\n * During hydration, renders the same fallback to match SSR.\n * After hydration completes, switches to render children.\n *\n * This is useful for components that rely on browser APIs or\n * have different server/client output.\n *\n * @example\n * ```tsx\n * <ClientOnly fallback={<div>Loading...</div>}>\n * <Calendar />\n * </ClientOnly>\n * ```\n */\nexport const ClientOnly: FlowComponent<ClientOnlyProps> = (props) => {\n // On server, always render fallback\n if (isServer) {\n return <>{props.fallback}</>;\n }\n\n // Outside a hydration walk there is nothing to defer (see useIsHydrated).\n if (!sharedConfig.context) {\n return <>{props.children}</>;\n }\n\n // Hydrating: render the fallback until the walk completes.\n const [isHydrated, setIsHydrated] = createSignal(false);\n\n // onMount runs after hydration is complete\n onMount(() => {\n setIsHydrated(true);\n });\n\n return (\n <Show when={isHydrated()} fallback={props.fallback}>\n {props.children}\n </Show>\n );\n};\n\n/**\n * Returns true only on the client after hydration is complete.\n * Can be used to conditionally render client-only content.\n *\n * @example\n * ```tsx\n * const hydrated = useIsHydrated();\n * return (\n * <Show when={hydrated()} fallback={<Placeholder />}>\n * <ClientOnlyComponent />\n * </Show>\n * );\n * ```\n */\nexport function useIsHydrated(): Accessor<boolean> {\n // On server, always return false\n if (isServer) {\n return () => false;\n }\n\n // Outside a hydration walk (pure CSR, or a remount created after hydration\n // finished) the caller is already \"hydrated\" — report true immediately.\n // Solid sets `sharedConfig.context` only while synchronously walking\n // server-rendered DOM, so this is exactly the window the false→true flip\n // exists for. A fresh per-instance false→true flip on every remount is not\n // just wasted work: ancestor `children()`/`Context.Provider` resolution\n // unwraps and tracks the <Show> accessor this hook gates, so the post-mount\n // flip re-resolves those children, recreates the subtree (with another fresh\n // signal), and loops forever — a stack overflow with no overlay rendered.\n if (!sharedConfig.context) {\n return () => true;\n }\n\n // Hydrating: start false (so the first render matches the server, which\n // emitted nothing for hydrated-gated content) and flip to true after mount.\n const [isHydrated, setIsHydrated] = createSignal(false);\n\n // onMount runs in the effect phase — *after* the synchronous hydration pass\n // has finished walking the server DOM — so flipping here renders the gated\n // content as a fresh client-side update (Portal: no getNextElement walk, no\n // mismatch). This mirrors the component gate above and is strictly earlier\n // than a rAF tick.\n onMount(() => {\n setIsHydrated(true);\n });\n\n return isHydrated;\n}\n"],"mappings":";;;;;;;;AA0DA,MAAa,eAAe;;;;;;;;;;AAiD5B,SAAgB,eACd,OACA,QACsB;CAGtB,MAAM,EAAE,OAAO,WAAW,OAAO,mBAAmB,OAAO;CAiB3D,OAAO;EACL,OAfoB,iBAAiB;GACrC,MAAM,gBAAgB,OAAO;GAC7B,OAAO,OAAO,cAAc,aACxB,UAAU,aAAa,IACtB,aAAa;EACpB,CAUqB;EACnB,OAToB,iBAAiB;GACrC,MAAM,gBAAgB,OAAO;GAC7B,OAAO,OAAO,UAAU,aAAa,MAAM,aAAa,IAAI;EAC9D,CAMqB;EACnB,sBAAsB;GACpB,MAAM,WAAW,MAAM;GAgBvB,OAAO,OAAO,aAAa,cAAc,SAAS,SAAS,IACvD,SAA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AAK,MAAM,WAAW,GAAG,UAAU,MAAM,UAAU;OACjD,MAAM,SAAS;IAClB,EAAE;AAEN;;;;;;;;;;;;;;;AAgBA,SAAgB,gBAAmC;CAEjD,IAAI,UACF,aAAa;CAYf,IAAI,CAAC,aAAa,SAChB,aAAa;CAKf,MAAM,CAAC,YAAY,iBAAiB,aAAa,KAAK;CAOtD,cAAc;EACZ,cAAc,IAAI;CACpB,CAAC;CAED,OAAO;AACT"}
1
+ {"version":3,"file":"utils.jsx","names":["mergeProps"],"sources":["../src/utils.tsx"],"sourcesContent":["/**\n * Utility functions for solidaria-components\n * Port of react-aria-components/src/utils.tsx\n */\n\nimport {\n type JSX,\n type Accessor,\n type Context,\n type FlowComponent,\n createComponent,\n createContext,\n useContext,\n createMemo,\n createSignal,\n onMount,\n sharedConfig,\n untrack,\n Show,\n} from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport { mergeProps } from \"@proyecto-viviana/solidaria\";\n\n/**\n * Render props pattern - children can be a function that receives state\n */\nexport type RenderChildren<T> = JSX.Element | ((renderProps: T) => JSX.Element);\n\n/**\n * Class name can be a string or a function that computes based on state\n */\nexport type ClassNameOrFunction<T> = string | ((renderProps: T) => string);\n\n/**\n * Style can be an object or a function that computes based on state\n */\nexport type StyleOrFunction<T> = JSX.CSSProperties | ((renderProps: T) => JSX.CSSProperties);\n\n/**\n * Common render props interface\n */\nexport interface RenderPropsBase<T> {\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<T>;\n /** The CSS className for the element. A function may be provided to compute the class based on state. */\n class?: ClassNameOrFunction<T>;\n /** The inline style for the element. A function may be provided to compute the style based on state. */\n style?: StyleOrFunction<T>;\n}\n\n/**\n * Slot props for named slots\n */\nexport interface SlotProps {\n /** A slot name for the component. */\n slot?: string;\n}\n\nexport const DEFAULT_SLOT = \"default\";\n\n/**\n * Return type for useRenderProps\n */\nexport interface RenderPropsResult<T> {\n /** Accessor for class - safe to call anytime */\n class: Accessor<string>;\n /** Accessor for style - safe to call anytime */\n style: Accessor<JSX.CSSProperties | undefined>;\n /**\n * Render the children. This is a function that returns JSX, NOT a getter.\n * For SSR compatibility, this should be called within the JSX tree.\n *\n * Usage in components:\n * {renderProps.renderChildren()}\n *\n * Or if you need the raw children/function:\n * {renderProps.renderChildren()}\n */\n renderChildren: () => JSX.Element;\n /**\n * Render a render-prop child ONCE over a reactive view of the values,\n * mirroring how React reconciles a render prop's returned tree in place.\n *\n * Prefer this over `renderChildren()` for interactive leaf components (a\n * Tab, a toggle segment) whose child wraps the pressable element: re-invoking\n * the render function on every values() change recreates that DOM subtree,\n * which detaches the pointer/press target mid-gesture and makes the browser\n * suppress the native `click` (createPress then has to synthesize an\n * untrusted fallback click — a visible parity break vs React). Static (non\n * function) children are returned untouched, exactly like `renderChildren`.\n */\n renderChildrenStable: () => JSX.Element;\n /** The raw children prop (function or JSX) - use renderChildren() in most cases */\n children: RenderChildren<T> | undefined;\n /** The render props values accessor */\n values: Accessor<T>;\n}\n\n/**\n * Resolves render props (children, class, style) based on component state.\n *\n * For SSR compatibility, children are NOT evaluated eagerly. Instead:\n * - Use `renderChildren()` to render children with current values\n * - Or access `children` directly if you need the raw prop\n *\n * This avoids the getter pattern that causes SSR hydration mismatches.\n */\nexport function useRenderProps<T extends object>(\n props: RenderPropsBase<T> & { defaultClassName?: string },\n values: Accessor<T>,\n): RenderPropsResult<T> {\n // Don't destructure children — access lazily to avoid eager evaluation\n // that would trigger child component creation before context providers mount.\n const { class: className, style, defaultClassName = \"\" } = props;\n\n // Compute class and style eagerly (they don't depend on context)\n const computedClass = createMemo(() => {\n const currentValues = values();\n return typeof className === \"function\"\n ? className(currentValues)\n : (className ?? defaultClassName);\n });\n\n const computedStyle = createMemo(() => {\n const currentValues = values();\n return typeof style === \"function\" ? style(currentValues) : style;\n });\n\n // Return object with explicit function for rendering children\n // Children are accessed lazily during render (inside context providers)\n return {\n class: computedClass,\n style: computedStyle,\n renderChildren: () => {\n const children = props.children;\n // Only read values() for render-prop children. Static JSX children must\n // not track the render-state memo: re-running the insertion effect\n // recreates real DOM nodes on every hover/press/focus flip (React keeps\n // them stable via vdom diffing), which detaches the pressed node\n // mid-press and suppresses the browser's native click.\n //\n // A render prop takes the values argument, so classify by arity — the\n // same convention `solid-js/h` uses for dynamic props. A zero-arg\n // function child is an accessor (a compiled `{expression}` child, a\n // solid-refresh dev wrapper, a one-shot `solid-js/h` element thunk):\n // return it untouched so the insert machinery unwraps it in its own\n // nested effect. Calling it here would track its reads in the shared\n // insertion effect, and every re-run disposes the child computations\n // that effect owns — a one-shot h thunk then hands back the same\n // disposed node, leaving connected DOM whose reactivity is dead.\n return typeof children === \"function\" && children.length > 0\n ? children(values())\n : (children as JSX.Element);\n },\n renderChildrenStable: () => {\n const children = props.children;\n if (typeof children !== \"function\" || children.length === 0) {\n return children as JSX.Element;\n }\n // Invoke the render function exactly once, over a getter view of the\n // values, so the returned DOM is created a single time and only the\n // reactive reads inside it (JSX bindings, component props) re-run on a\n // values() change — React's reconciliation, not Solid's recreation.\n //\n // `untrack` keeps the enclosing insert from tracking values() (so it\n // never re-runs and never recreates), but does NOT change the owner:\n // this still executes inside the caller's insert scope, so any slotted\n // context the render prop reads binds against the surrounding provider.\n //\n // The value keys are read once here (untracked). Render-state memos in\n // this codebase return a fixed-shape object, so the key set is stable.\n return untrack(() => {\n const snapshot = values();\n const view = {} as T;\n for (const key of Object.keys(snapshot) as Array<keyof T & string>) {\n Object.defineProperty(view, key, {\n enumerable: true,\n configurable: true,\n get: () => values()[key],\n });\n }\n return (children as (renderProps: T) => JSX.Element)(view);\n });\n },\n get children() {\n return props.children;\n },\n values,\n };\n}\n\nexport function composeRenderProps<T extends object>(\n base: RenderPropsBase<T> | undefined,\n override: RenderPropsBase<T> | undefined,\n): RenderPropsBase<T> {\n if (!base) return override ?? {};\n if (!override) return base;\n return {\n children: override.children ?? base.children,\n class: override.class ?? base.class,\n style: override.style ?? base.style,\n };\n}\n\n/** A Solid ref target: a callback, a mutable `{ current }` object, or undefined. */\nexport type RefLike<T> = T | ((el: T) => void) | { current?: T | null } | undefined;\n\n/** A value paired with an optional ref to merge onto the consuming element. */\nexport type WithRef<T, E> = T & { ref?: RefLike<E> };\n\n/**\n * A context value carrying named slots (mirrors react-aria-components'\n * `SlottedValue`). Each entry under `slots` is the props object delivered to the\n * component rendered with the matching `slot` name.\n */\nexport interface SlottedValue<T> {\n slots?: Record<string, T>;\n}\n\n/** A slotted context value: a slots record, a bare value, or null/undefined. */\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\n\n/**\n * The value type for a context consumed via {@link useContextProps}. Mirrors\n * upstream `ContextValue<T, E>`: it may carry `slots` and an optional `ref` to\n * merge onto the consuming element.\n */\nexport type ContextValue<T, E = HTMLElement> = SlottedContextValue<WithRef<T, E>>;\n\n/**\n * Creates a context that can carry either a bare value or a `slots` record.\n */\nexport function createSlottedContext<T>() {\n return createContext<SlottedContextValue<T>>(null);\n}\n\n/** Assigns an element to a Solid ref (callback or mutable `{ current }` object). */\nexport function assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n (ref as (el: T) => void)(el);\n } else if (typeof ref === \"object\" && \"current\" in ref) {\n (ref as { current?: T | null }).current = el;\n }\n}\n\n/** Merges multiple Solid refs into one callback that forwards to each, once. */\nexport function mergeRefs<T>(...refs: Array<RefLike<T>>): (el: T) => void {\n return (el: T) => {\n const seen = new Set<RefLike<T>>();\n for (const ref of refs) {\n if (!ref || seen.has(ref)) {\n continue;\n }\n\n seen.add(ref);\n assignRef(ref, el);\n }\n };\n}\n\n/**\n * Resolves a (possibly slotted) context value for the given slot name. Port of\n * react-aria-components' `useSlottedContext`:\n * - `slot === null` opts out of the context entirely (returns `null`);\n * - if the context carries a `slots` record, the entry for `slot` (or\n * {@link DEFAULT_SLOT}) is returned, throwing on an unknown slot name;\n * - otherwise the bare context value is returned.\n */\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null,\n): T | null | undefined {\n const ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means: ignore this context.\n return null;\n }\n\n if (ctx && typeof ctx === \"object\" && \"slots\" in ctx && ctx.slots) {\n const slots = ctx.slots as Record<string, T>;\n const slotName = slot || DEFAULT_SLOT;\n const slotValue = slots[slotName];\n if (!slotValue) {\n const validSlots = Object.keys(slots)\n .map((name) => `\"${name}\"`)\n .join(\", \");\n throw new Error(\n slot\n ? `Invalid slot \"${slot}\". Valid slot names are ${validSlots}.`\n : `A slot prop is required. Valid slot names are ${validSlots}.`,\n );\n }\n return slotValue;\n }\n\n return ctx as T | null | undefined;\n}\n\n/**\n * Merges context-provided props and a context ref into a component's own props\n * and ref. Port of react-aria-components' `useContextProps`:\n * - the context is resolved for `props.slot` via {@link useSlottedContext};\n * - props win over context props (handler props are chained by `mergeProps`);\n * - the component's own ref and the context's ref merge into one callback.\n *\n * The prop merge stays reactive (Solid `mergeProps` preserves getters), so prop\n * changes keep flowing; the context value is read once at setup, matching a single\n * upstream render.\n */\nexport function useContextProps<TProps extends SlotProps, TRef>(\n props: TProps,\n ref: RefLike<TRef>,\n context: Context<ContextValue<TProps, TRef>>,\n): [TProps, (el: TRef) => void] {\n const ctx = (useSlottedContext(context, props.slot) ?? {}) as WithRef<Partial<TProps>, TRef>;\n const { ref: contextRef, ...contextProps } = ctx;\n const mergedRef = mergeRefs(ref, contextRef);\n const mergedProps = mergeProps(contextProps as object, props as object) as unknown as TProps;\n return [mergedProps, mergedRef];\n}\n\n/**\n * Detects whether slotted content was rendered into a placeholder, for the\n * aria-label fallback pattern. Port of react-aria-components' `useSlot`: returns a\n * ref callback to attach to the placeholder and an accessor that is `true` while\n * an element is mounted there. The accessor flips to `false` after mount if the\n * ref never ran (no slotted content was provided).\n */\nexport function useSlot(initialState = true): [(el: Element | null) => void, Accessor<boolean>] {\n const [hasSlot, setHasSlot] = createSignal(initialState);\n let hasRun = false;\n const ref = (el: Element | null) => {\n hasRun = true;\n setHasSlot(!!el);\n };\n onMount(() => {\n if (!hasRun) {\n setHasSlot(false);\n }\n });\n return [ref, hasSlot];\n}\n\n/**\n * Nests a set of context providers around `children`. Port of\n * react-aria-components' `Provider`: each `[Context, value]` pair wraps the\n * previous result, so the LAST pair is the outermost provider — matching upstream's\n * wrap-in-iteration-order.\n *\n * `children` is read through a lazy getter inside the innermost provider so child\n * components are *created* within every provider's owner; Solid binds `useContext`\n * at component-execution time, so eager children would miss these providers.\n */\nexport function Provider(props: {\n values: Array<[Context<unknown>, unknown]>;\n children: JSX.Element;\n}): JSX.Element {\n const build = (index: number): JSX.Element => {\n if (index < 0) {\n return props.children;\n }\n const [context, value] = props.values[index];\n return createComponent(context.Provider, {\n value,\n get children() {\n return build(index - 1);\n },\n });\n };\n return build(props.values.length - 1);\n}\n\n/**\n * Converts boolean state values to data attributes\n */\nexport function dataAttr(value: boolean | undefined): \"\" | undefined {\n return value ? \"\" : undefined;\n}\n\n/**\n * Creates data attributes from render props\n */\nexport function createDataAttributes<T extends Record<string, boolean | string | undefined>>(\n values: T,\n): Record<string, string | undefined> {\n const result: Record<string, string | undefined> = {};\n\n for (const [key, value] of Object.entries(values)) {\n if (typeof value === \"boolean\") {\n result[`data-${camelToKebab(key)}`] = value ? \"\" : undefined;\n } else if (value !== undefined) {\n result[`data-${camelToKebab(key)}`] = value;\n }\n }\n\n return result;\n}\n\nfunction camelToKebab(str: string): string {\n return str.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n}\n\n/**\n * Remove data attributes from props (for internal use)\n */\nexport function removeDataAttributes<T extends Record<string, unknown>>(props: T): T {\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (!key.startsWith(\"data-\")) {\n result[key] = value;\n }\n }\n\n return result as T;\n}\n\n/**\n * Filter DOM props - keep only valid DOM attributes.\n *\n * @param props - Component props to filter\n * @param options - Options for filtering (global: include global attrs)\n * @returns Object containing only valid DOM props. Use type parameter R to specify return type.\n */\nexport function filterDOMProps<R extends object = Record<string, unknown>>(\n props: object,\n options: { global?: boolean; events?: boolean } = {},\n): R {\n const { global = false, events = true } = options;\n const result: Record<string, unknown> = {};\n\n const globalAttrs = new Set([\n \"id\",\n \"class\",\n \"style\",\n \"tabIndex\",\n \"role\",\n \"title\",\n \"lang\",\n \"dir\",\n \"hidden\",\n \"draggable\",\n \"accessKey\",\n \"contentEditable\",\n \"spellcheck\",\n ]);\n\n const ariaAttrs = /^aria-/;\n const dataAttrs = /^data-/;\n const eventHandlers = /^on[A-Z]/;\n\n for (const key in props) {\n if (\n Object.prototype.hasOwnProperty.call(props, key) &&\n ((global && globalAttrs.has(key)) ||\n ariaAttrs.test(key) ||\n dataAttrs.test(key) ||\n (events && eventHandlers.test(key)))\n ) {\n result[key] = (props as Record<string, unknown>)[key];\n }\n }\n\n return result as R;\n}\n\nexport interface ClientOnlyProps {\n /** The children to render only on the client */\n children: JSX.Element;\n /** Optional fallback to render during SSR and initial hydration */\n fallback?: JSX.Element;\n}\n\n/**\n * ClientOnly component - renders children only on the client side.\n *\n * During SSR, renders the fallback (or nothing).\n * During hydration, renders the same fallback to match SSR.\n * After hydration completes, switches to render children.\n *\n * This is useful for components that rely on browser APIs or\n * have different server/client output.\n *\n * @example\n * ```tsx\n * <ClientOnly fallback={<div>Loading...</div>}>\n * <Calendar />\n * </ClientOnly>\n * ```\n */\nexport const ClientOnly: FlowComponent<ClientOnlyProps> = (props) => {\n // On server, always render fallback\n if (isServer) {\n return <>{props.fallback}</>;\n }\n\n // Outside a hydration walk there is nothing to defer (see useIsHydrated).\n if (!sharedConfig.context) {\n return <>{props.children}</>;\n }\n\n // Hydrating: render the fallback until the walk completes.\n const [isHydrated, setIsHydrated] = createSignal(false);\n\n // onMount runs after hydration is complete\n onMount(() => {\n setIsHydrated(true);\n });\n\n return (\n <Show when={isHydrated()} fallback={props.fallback}>\n {props.children}\n </Show>\n );\n};\n\n/**\n * Returns true only on the client after hydration is complete.\n * Can be used to conditionally render client-only content.\n *\n * @example\n * ```tsx\n * const hydrated = useIsHydrated();\n * return (\n * <Show when={hydrated()} fallback={<Placeholder />}>\n * <ClientOnlyComponent />\n * </Show>\n * );\n * ```\n */\nexport function useIsHydrated(): Accessor<boolean> {\n // On server, always return false\n if (isServer) {\n return () => false;\n }\n\n // Outside a hydration walk (pure CSR, or a remount created after hydration\n // finished) the caller is already \"hydrated\" — report true immediately.\n // Solid sets `sharedConfig.context` only while synchronously walking\n // server-rendered DOM, so this is exactly the window the false→true flip\n // exists for. A fresh per-instance false→true flip on every remount is not\n // just wasted work: ancestor `children()`/`Context.Provider` resolution\n // unwraps and tracks the <Show> accessor this hook gates, so the post-mount\n // flip re-resolves those children, recreates the subtree (with another fresh\n // signal), and loops forever — a stack overflow with no overlay rendered.\n if (!sharedConfig.context) {\n return () => true;\n }\n\n // Hydrating: start false (so the first render matches the server, which\n // emitted nothing for hydrated-gated content) and flip to true after mount.\n const [isHydrated, setIsHydrated] = createSignal(false);\n\n // onMount runs in the effect phase — *after* the synchronous hydration pass\n // has finished walking the server DOM — so flipping here renders the gated\n // content as a fresh client-side update (Portal: no getNextElement walk, no\n // mismatch). This mirrors the component gate above and is strictly earlier\n // than a rAF tick.\n onMount(() => {\n setIsHydrated(true);\n });\n\n return isHydrated;\n}\n"],"mappings":";;;;;;;;AA0DA,MAAa,eAAe;;;;;;;;;;AAiD5B,SAAgB,eACd,OACA,QACsB;CAGtB,MAAM,EAAE,OAAO,WAAW,OAAO,mBAAmB,OAAO;CAiB3D,OAAO;EACL,OAfoB,iBAAiB;GACrC,MAAM,gBAAgB,OAAO;GAC7B,OAAO,OAAO,cAAc,aACxB,UAAU,aAAa,IACtB,aAAa;EACpB,CAUqB;EACnB,OAToB,iBAAiB;GACrC,MAAM,gBAAgB,OAAO;GAC7B,OAAO,OAAO,UAAU,aAAa,MAAM,aAAa,IAAI;EAC9D,CAMqB;EACnB,sBAAsB;GACpB,MAAM,WAAW,MAAM;GAgBvB,OAAO,OAAO,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AAc;EACZ,cAAc,IAAI;CACpB,CAAC;CAED,OACE,CAAC,KAAK,MAAM,WAAW,GAAG,UAAU,MAAM,UAAU;OACjD,MAAM,SAAS;IAClB,EAAE;AAEN;;;;;;;;;;;;;;;AAgBA,SAAgB,gBAAmC;CAEjD,IAAI,UACF,aAAa;CAYf,IAAI,CAAC,aAAa,SAChB,aAAa;CAKf,MAAM,CAAC,YAAY,iBAAiB,aAAa,KAAK;CAOtD,cAAc;EACZ,cAAc,IAAI;CACpB,CAAC;CAED,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proyecto-viviana/solidaria-components",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Pre-wired headless components for SolidJS - port of react-aria-components",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -182,12 +182,6 @@
182
182
  "import": "./dist/GridList.js",
183
183
  "default": "./dist/GridList.js"
184
184
  },
185
- "./HiddenTimeInput": {
186
- "types": "./dist/HiddenTimeInput.d.ts",
187
- "solid": "./dist/HiddenTimeInput.jsx",
188
- "import": "./dist/HiddenTimeInput.js",
189
- "default": "./dist/HiddenTimeInput.js"
190
- },
191
185
  "./Icon": {
192
186
  "types": "./dist/Icon.d.ts",
193
187
  "solid": "./dist/Icon.jsx",
@@ -435,8 +429,8 @@
435
429
  },
436
430
  "dependencies": {
437
431
  "@internationalized/date": "^3.8.0",
438
- "@proyecto-viviana/solid-stately": "0.4.0",
439
- "@proyecto-viviana/solidaria": "0.4.0"
432
+ "@proyecto-viviana/solid-stately": "0.4.1",
433
+ "@proyecto-viviana/solidaria": "0.4.1"
440
434
  },
441
435
  "devDependencies": {
442
436
  "solid-js": "^1.9.11"
package/src/ActionBar.tsx CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  splitProps,
19
19
  useContext,
20
20
  } from "solid-js";
21
- import { announce, createToolbar } from "@proyecto-viviana/solidaria";
21
+ import { announce } from "@proyecto-viviana/solidaria";
22
22
  import type { Key } from "@proyecto-viviana/solid-stately";
23
23
  import {
24
24
  type ClassNameOrFunction,
@@ -105,16 +105,15 @@ export function ActionBar(props: ActionBarProps): JSX.Element {
105
105
  const selectedItemCount = () => local.selectedItemCount ?? 0;
106
106
  const isOpen = () => selectedItemCount() !== 0;
107
107
 
108
- const { toolbarProps } = createToolbar({
109
- orientation: "horizontal",
110
- get "aria-label"() {
111
- return local["aria-label"] ?? (local["aria-labelledby"] ? undefined : "Actions");
112
- },
113
- get "aria-labelledby"() {
114
- return local["aria-labelledby"];
115
- },
116
- });
117
-
108
+ // Faithful to S2 `ActionBar` (ActionBar.tsx:192): the ROOT is a PLAIN
109
+ // container with NO `role` — S2 spreads only `keyboardProps` (an Escape
110
+ // handler that clears the selection) onto it. The single `toolbar` is the
111
+ // inner `ActionButtonGroup` (styled layer), NOT this root. Applying
112
+ // `createToolbar` here would (a) give the root a spurious `role="toolbar"`
113
+ // S2 never renders and (b) nest the real action toolbar inside it, forcing
114
+ // its role to downgrade to `group`. So the root deliberately carries no
115
+ // toolbar props — `aria-label`/`aria-labelledby` are consumed by the inner
116
+ // ActionButtonGroup at the styled layer.
118
117
  let wasOpen = false;
119
118
  createEffect(() => {
120
119
  const open = isOpen();
@@ -171,7 +170,6 @@ export function ActionBar(props: ActionBarProps): JSX.Element {
171
170
  <ActionBarContext.Provider value={contextValue()}>
172
171
  <div
173
172
  {...filteredDOMProps()}
174
- {...toolbarProps}
175
173
  class={renderProps.class()}
176
174
  style={renderProps.style()}
177
175
  slot={local.slot}
@@ -256,9 +256,11 @@ function ActionGroupItemWrapper(props: ActionGroupItemWrapperProps): JSX.Element
256
256
  isFocused: isFocused(),
257
257
  }));
258
258
 
259
- const { ref: _ref, ...restButtonProps } = buttonProps as Record<string, unknown> & {
260
- ref?: unknown;
261
- };
259
+ // splitProps (not object destructuring) so the reactive getters on buttonProps
260
+ // — tabIndex (roving stop), onFocus (sets the focused key), role, aria-checked
261
+ // — stay live. A rest-spread `{ ref, ...rest }` would FREEZE them at their
262
+ // first-render values, pinning the roving tabIndex and killing focus tracking.
263
+ const [, restButtonProps] = splitProps(buttonProps, ["ref"]);
262
264
 
263
265
  return (
264
266
  <button