ui-ingredients 0.0.38 → 0.0.40

Sign up to get free protection for your applications and to get access to all the features.
Files changed (339) hide show
  1. package/README.md +2 -0
  2. package/dist/accordion/item-content.svelte +42 -32
  3. package/dist/accordion/item-indicator.svelte +3 -4
  4. package/dist/accordion/item-trigger.svelte +31 -32
  5. package/dist/accordion/item.svelte +39 -43
  6. package/dist/accordion/root.svelte +5 -6
  7. package/dist/avatar/fallback.svelte +2 -4
  8. package/dist/avatar/image.svelte +2 -4
  9. package/dist/avatar/root.svelte +5 -6
  10. package/dist/carousel/indicator-group.svelte +3 -4
  11. package/dist/carousel/indicator.svelte +2 -4
  12. package/dist/carousel/item-group.svelte +2 -4
  13. package/dist/carousel/item.svelte +2 -6
  14. package/dist/carousel/next-trigger.svelte +3 -4
  15. package/dist/carousel/prev-trigger.svelte +3 -4
  16. package/dist/carousel/root.svelte +5 -6
  17. package/dist/carousel/viewport.svelte +2 -4
  18. package/dist/checkbox/control.svelte +2 -4
  19. package/dist/checkbox/hidden-input.svelte +9 -4
  20. package/dist/checkbox/indicator.svelte +2 -4
  21. package/dist/checkbox/label.svelte +2 -4
  22. package/dist/checkbox/root.svelte +5 -6
  23. package/dist/clipboard/control.svelte +2 -4
  24. package/dist/clipboard/indicator.svelte +2 -4
  25. package/dist/clipboard/input.svelte +2 -4
  26. package/dist/clipboard/label.svelte +2 -4
  27. package/dist/clipboard/root.svelte +5 -6
  28. package/dist/clipboard/trigger.svelte +3 -4
  29. package/dist/collapsible/content.svelte +2 -4
  30. package/dist/collapsible/root.svelte +5 -6
  31. package/dist/collapsible/trigger.svelte +3 -4
  32. package/dist/color-picker/area-background.svelte +4 -3
  33. package/dist/color-picker/area-thumb.svelte +3 -2
  34. package/dist/color-picker/area.svelte +2 -2
  35. package/dist/color-picker/channel-input.svelte +2 -2
  36. package/dist/color-picker/channel-slider-label.svelte +2 -2
  37. package/dist/color-picker/channel-slider-thumb.svelte +2 -2
  38. package/dist/color-picker/channel-slider-track.svelte +2 -2
  39. package/dist/color-picker/channel-slider-value-text.svelte +2 -2
  40. package/dist/color-picker/channel-slider.svelte +2 -2
  41. package/dist/color-picker/content.svelte +28 -20
  42. package/dist/color-picker/control.svelte +2 -2
  43. package/dist/color-picker/eye-dropper-trigger.svelte +2 -2
  44. package/dist/color-picker/format-select.svelte +3 -2
  45. package/dist/color-picker/format-trigger.svelte +3 -2
  46. package/dist/color-picker/hidden-input.svelte +3 -2
  47. package/dist/color-picker/label.svelte +2 -2
  48. package/dist/color-picker/positioner.svelte +29 -22
  49. package/dist/color-picker/root.svelte +68 -60
  50. package/dist/color-picker/swatch-group.svelte +3 -2
  51. package/dist/color-picker/swatch-indicator.svelte +3 -2
  52. package/dist/color-picker/swatch-trigger.svelte +5 -2
  53. package/dist/color-picker/swatch.svelte +2 -2
  54. package/dist/color-picker/transparency-grid.svelte +2 -2
  55. package/dist/color-picker/trigger.svelte +3 -2
  56. package/dist/color-picker/value-text.svelte +3 -2
  57. package/dist/combobox/clear-trigger.svelte +3 -4
  58. package/dist/combobox/content.svelte +28 -26
  59. package/dist/combobox/control.svelte +2 -4
  60. package/dist/combobox/create-combobox.svelte.js +0 -1
  61. package/dist/combobox/input.svelte +2 -4
  62. package/dist/combobox/item-group-label.svelte +3 -4
  63. package/dist/combobox/item-group.svelte +2 -4
  64. package/dist/combobox/item-indicator.svelte +3 -4
  65. package/dist/combobox/item-text.svelte +2 -4
  66. package/dist/combobox/item.svelte +2 -6
  67. package/dist/combobox/label.svelte +2 -4
  68. package/dist/combobox/list.svelte +2 -4
  69. package/dist/combobox/positioner.svelte +32 -26
  70. package/dist/combobox/root.svelte +91 -84
  71. package/dist/combobox/trigger.svelte +2 -4
  72. package/dist/date-picker/clear-trigger.svelte +3 -4
  73. package/dist/date-picker/content.svelte +32 -26
  74. package/dist/date-picker/control.svelte +2 -4
  75. package/dist/date-picker/day-table-cell-trigger.svelte +2 -4
  76. package/dist/date-picker/day-table-cell.svelte +5 -6
  77. package/dist/date-picker/input.svelte +2 -4
  78. package/dist/date-picker/label.svelte +2 -4
  79. package/dist/date-picker/month-select.svelte +3 -4
  80. package/dist/date-picker/month-table-cell-trigger.svelte +2 -4
  81. package/dist/date-picker/month-table-cell.svelte +2 -6
  82. package/dist/date-picker/next-trigger.svelte +3 -4
  83. package/dist/date-picker/positioner.svelte +33 -28
  84. package/dist/date-picker/preset-trigger.svelte +2 -4
  85. package/dist/date-picker/prev-trigger.svelte +3 -4
  86. package/dist/date-picker/range-text.svelte +3 -4
  87. package/dist/date-picker/root.svelte +78 -71
  88. package/dist/date-picker/table-body.svelte +3 -4
  89. package/dist/date-picker/table-head.svelte +3 -4
  90. package/dist/date-picker/table-header.svelte +3 -4
  91. package/dist/date-picker/table-row.svelte +2 -4
  92. package/dist/date-picker/table.svelte +2 -4
  93. package/dist/date-picker/trigger.svelte +3 -4
  94. package/dist/date-picker/view-control.svelte +3 -4
  95. package/dist/date-picker/view-trigger.svelte +3 -4
  96. package/dist/date-picker/view.svelte +2 -4
  97. package/dist/date-picker/year-select.svelte +3 -4
  98. package/dist/date-picker/year-table-cell-trigger.svelte +2 -4
  99. package/dist/date-picker/year-table-cell.svelte +2 -6
  100. package/dist/dialog/backdrop.svelte +32 -26
  101. package/dist/dialog/close-trigger.svelte +3 -4
  102. package/dist/dialog/content.svelte +28 -26
  103. package/dist/dialog/description.svelte +2 -4
  104. package/dist/dialog/positioner.svelte +28 -27
  105. package/dist/dialog/root.svelte +32 -24
  106. package/dist/dialog/title.svelte +2 -4
  107. package/dist/dialog/trigger.svelte +2 -4
  108. package/dist/editable/area.svelte +2 -4
  109. package/dist/editable/cancel-trigger.svelte +3 -4
  110. package/dist/editable/control.svelte +2 -4
  111. package/dist/editable/edit-trigger.svelte +3 -4
  112. package/dist/editable/input.svelte +2 -4
  113. package/dist/editable/label.svelte +2 -4
  114. package/dist/editable/preview.svelte +2 -4
  115. package/dist/editable/root.svelte +5 -6
  116. package/dist/editable/submit-trigger.svelte +3 -4
  117. package/dist/field/create-field.svelte.d.ts +8 -8
  118. package/dist/field/error-text.svelte +2 -4
  119. package/dist/field/helper-text.svelte +2 -4
  120. package/dist/field/input.svelte +2 -4
  121. package/dist/field/label.svelte +2 -4
  122. package/dist/field/root.svelte +18 -14
  123. package/dist/field/select.svelte +2 -4
  124. package/dist/field/textarea.svelte +2 -4
  125. package/dist/file-upload/dropzone.svelte +2 -4
  126. package/dist/file-upload/hidden-input.svelte +9 -4
  127. package/dist/file-upload/item-delete-trigger.svelte +2 -4
  128. package/dist/file-upload/item-group.svelte +3 -4
  129. package/dist/file-upload/item-name.svelte +3 -4
  130. package/dist/file-upload/item-preview-image.svelte +3 -4
  131. package/dist/file-upload/item-preview.svelte +3 -4
  132. package/dist/file-upload/item-size-text.svelte +3 -4
  133. package/dist/file-upload/item.svelte +2 -4
  134. package/dist/file-upload/label.svelte +2 -4
  135. package/dist/file-upload/root.svelte +5 -6
  136. package/dist/file-upload/trigger.svelte +3 -4
  137. package/dist/hover-card/arrow-tip.svelte +2 -4
  138. package/dist/hover-card/arrow.svelte +2 -4
  139. package/dist/hover-card/content.svelte +28 -26
  140. package/dist/hover-card/positioner.svelte +33 -26
  141. package/dist/hover-card/root.svelte +32 -24
  142. package/dist/hover-card/trigger.svelte +2 -4
  143. package/dist/menu/arrow-tip.svelte +2 -4
  144. package/dist/menu/arrow.svelte +2 -4
  145. package/dist/menu/content.svelte +28 -26
  146. package/dist/menu/context-trigger.svelte +3 -4
  147. package/dist/menu/indicator.svelte +2 -4
  148. package/dist/menu/item-group-label.svelte +3 -4
  149. package/dist/menu/item-group.svelte +2 -4
  150. package/dist/menu/item.svelte +2 -6
  151. package/dist/menu/option-item-indicator.svelte +3 -4
  152. package/dist/menu/option-item-text.svelte +3 -4
  153. package/dist/menu/option-item.svelte +5 -6
  154. package/dist/menu/positioner.svelte +28 -26
  155. package/dist/menu/root.svelte +32 -24
  156. package/dist/menu/separator.svelte +2 -4
  157. package/dist/menu/trigger-item.svelte +3 -4
  158. package/dist/menu/trigger.svelte +2 -4
  159. package/dist/number-input/control.svelte +3 -4
  160. package/dist/number-input/decrement-trigger.svelte +2 -4
  161. package/dist/number-input/increment-trigger.svelte +2 -4
  162. package/dist/number-input/input.svelte +2 -4
  163. package/dist/number-input/label.svelte +2 -4
  164. package/dist/number-input/root.svelte +5 -6
  165. package/dist/number-input/scrubber.svelte +3 -4
  166. package/dist/pagination/ellipsis.svelte +2 -4
  167. package/dist/pagination/item.svelte +2 -4
  168. package/dist/pagination/next-trigger.svelte +3 -4
  169. package/dist/pagination/prev-trigger.svelte +3 -4
  170. package/dist/pagination/root.svelte +5 -6
  171. package/dist/pin-input/clear-trigger.svelte +3 -4
  172. package/dist/pin-input/create-pin-input.svelte.d.ts +2 -2
  173. package/dist/pin-input/hidden-input.svelte +9 -4
  174. package/dist/pin-input/input.svelte +2 -4
  175. package/dist/pin-input/label.svelte +2 -4
  176. package/dist/pin-input/root.svelte +5 -6
  177. package/dist/popover/arrow-tip.svelte +2 -4
  178. package/dist/popover/arrow.svelte +2 -4
  179. package/dist/popover/close-trigger.svelte +3 -4
  180. package/dist/popover/content.svelte +28 -26
  181. package/dist/popover/description.svelte +2 -4
  182. package/dist/popover/positioner.svelte +32 -26
  183. package/dist/popover/root.svelte +32 -24
  184. package/dist/popover/title.svelte +2 -4
  185. package/dist/popover/trigger.svelte +2 -4
  186. package/dist/presence/create-presence.svelte.d.ts +3 -10
  187. package/dist/presence/create-presence.svelte.js +15 -24
  188. package/dist/presence/root.svelte +30 -30
  189. package/dist/progress/circle-range.svelte +3 -4
  190. package/dist/progress/circle-track.svelte +3 -4
  191. package/dist/progress/circle.svelte +2 -4
  192. package/dist/progress/label.svelte +2 -4
  193. package/dist/progress/range.svelte +2 -4
  194. package/dist/progress/root.svelte +6 -7
  195. package/dist/progress/track.svelte +2 -4
  196. package/dist/progress/value-text.svelte +2 -4
  197. package/dist/progress/view.svelte +2 -4
  198. package/dist/qr-code/frame.svelte +2 -4
  199. package/dist/qr-code/overlay.svelte +2 -4
  200. package/dist/qr-code/pattern.svelte +2 -4
  201. package/dist/qr-code/root.svelte +5 -6
  202. package/dist/radio-group/indicator.svelte +3 -4
  203. package/dist/radio-group/item-control.svelte +3 -4
  204. package/dist/radio-group/item-hidden-input.svelte +9 -4
  205. package/dist/radio-group/item-text.svelte +3 -4
  206. package/dist/radio-group/item.svelte +2 -6
  207. package/dist/radio-group/label.svelte +2 -4
  208. package/dist/radio-group/root.svelte +5 -6
  209. package/dist/rating-group/control.svelte +2 -4
  210. package/dist/rating-group/hidden-input.svelte +9 -4
  211. package/dist/rating-group/item.svelte +2 -6
  212. package/dist/rating-group/label.svelte +2 -4
  213. package/dist/rating-group/root.svelte +5 -6
  214. package/dist/segment-group/indicator.svelte +3 -4
  215. package/dist/segment-group/item-control.svelte +3 -4
  216. package/dist/segment-group/item-hidden-input.svelte +8 -4
  217. package/dist/segment-group/item-text.svelte +3 -4
  218. package/dist/segment-group/item.svelte +2 -6
  219. package/dist/segment-group/label.svelte +2 -4
  220. package/dist/segment-group/root.svelte +3 -7
  221. package/dist/select/clear-trigger.svelte +3 -4
  222. package/dist/select/content.svelte +28 -26
  223. package/dist/select/control.svelte +2 -4
  224. package/dist/select/hidden-select.svelte +11 -6
  225. package/dist/select/indicator.svelte +2 -4
  226. package/dist/select/item-group-label.svelte +3 -4
  227. package/dist/select/item-group.svelte +2 -4
  228. package/dist/select/item-indicator.svelte +3 -4
  229. package/dist/select/item-text.svelte +2 -4
  230. package/dist/select/item.svelte +2 -6
  231. package/dist/select/label.svelte +2 -4
  232. package/dist/select/list.svelte +2 -4
  233. package/dist/select/positioner.svelte +28 -26
  234. package/dist/select/root.svelte +78 -71
  235. package/dist/select/trigger.svelte +2 -4
  236. package/dist/select/value-text.svelte +2 -4
  237. package/dist/signature-pad/clear-trigger.svelte +3 -4
  238. package/dist/signature-pad/control.svelte +3 -4
  239. package/dist/signature-pad/current-segment-path.svelte +2 -4
  240. package/dist/signature-pad/guide.svelte +2 -4
  241. package/dist/signature-pad/hidden-input.svelte +8 -4
  242. package/dist/signature-pad/label.svelte +3 -4
  243. package/dist/signature-pad/root.svelte +3 -7
  244. package/dist/signature-pad/segment-path.svelte +2 -4
  245. package/dist/signature-pad/segment.svelte +3 -4
  246. package/dist/slider/control.svelte +2 -4
  247. package/dist/slider/hidden-input.svelte +9 -4
  248. package/dist/slider/label.svelte +2 -4
  249. package/dist/slider/marker-group.svelte +2 -4
  250. package/dist/slider/marker.svelte +2 -4
  251. package/dist/slider/range.svelte +2 -4
  252. package/dist/slider/root.svelte +5 -6
  253. package/dist/slider/thumb.svelte +2 -4
  254. package/dist/slider/track.svelte +2 -4
  255. package/dist/slider/value-text.svelte +2 -4
  256. package/dist/splitter/panel.svelte +2 -4
  257. package/dist/splitter/resize-trigger.svelte +5 -6
  258. package/dist/splitter/root.svelte +5 -6
  259. package/dist/steps/completed-content.svelte +3 -4
  260. package/dist/steps/content.svelte +2 -4
  261. package/dist/steps/indicator.svelte +2 -4
  262. package/dist/steps/item.svelte +2 -6
  263. package/dist/steps/list.svelte +2 -4
  264. package/dist/steps/next-trigger.svelte +3 -4
  265. package/dist/steps/prev-trigger.svelte +3 -4
  266. package/dist/steps/progress.svelte +2 -4
  267. package/dist/steps/root.svelte +5 -6
  268. package/dist/steps/separator.svelte +2 -4
  269. package/dist/steps/trigger.svelte +2 -4
  270. package/dist/switch/control.svelte +2 -4
  271. package/dist/switch/hidden-input.svelte +9 -4
  272. package/dist/switch/label.svelte +2 -4
  273. package/dist/switch/root.svelte +5 -6
  274. package/dist/switch/thumb.svelte +2 -4
  275. package/dist/tabs/content.svelte +2 -4
  276. package/dist/tabs/list.svelte +2 -4
  277. package/dist/tabs/root.svelte +5 -6
  278. package/dist/tabs/trigger.svelte +2 -4
  279. package/dist/tags-input/clear-trigger.svelte +3 -4
  280. package/dist/tags-input/control.svelte +2 -4
  281. package/dist/tags-input/hidden-input.svelte +9 -4
  282. package/dist/tags-input/input.svelte +2 -4
  283. package/dist/tags-input/item-delete-trigger.svelte +3 -4
  284. package/dist/tags-input/item-input.svelte +3 -4
  285. package/dist/tags-input/item-preview.svelte +3 -4
  286. package/dist/tags-input/item-text.svelte +2 -4
  287. package/dist/tags-input/item.svelte +2 -6
  288. package/dist/tags-input/label.svelte +2 -4
  289. package/dist/tags-input/root.svelte +5 -6
  290. package/dist/time-picker/clear-trigger.svelte +3 -4
  291. package/dist/time-picker/column.svelte +2 -4
  292. package/dist/time-picker/content.svelte +24 -26
  293. package/dist/time-picker/control.svelte +2 -4
  294. package/dist/time-picker/hour-cell.svelte +2 -4
  295. package/dist/time-picker/input.svelte +2 -4
  296. package/dist/time-picker/label.svelte +2 -4
  297. package/dist/time-picker/minute-cell.svelte +2 -4
  298. package/dist/time-picker/period-cell.svelte +2 -4
  299. package/dist/time-picker/positioner.svelte +3 -4
  300. package/dist/time-picker/root.svelte +5 -6
  301. package/dist/time-picker/second-cell.svelte +2 -4
  302. package/dist/time-picker/spacer.svelte +2 -4
  303. package/dist/time-picker/trigger.svelte +3 -4
  304. package/dist/timer/action-trigger.svelte +2 -4
  305. package/dist/timer/item-label.svelte +2 -4
  306. package/dist/timer/item-value.svelte +2 -4
  307. package/dist/timer/item.svelte +3 -4
  308. package/dist/timer/root.svelte +5 -6
  309. package/dist/timer/separator.svelte +2 -4
  310. package/dist/toast/action-trigger.svelte +3 -4
  311. package/dist/toast/close-trigger.svelte +3 -4
  312. package/dist/toast/description.svelte +2 -4
  313. package/dist/toast/ghost-after.svelte +10 -5
  314. package/dist/toast/ghost-before.svelte +10 -5
  315. package/dist/toast/root.svelte +3 -6
  316. package/dist/toast/title.svelte +2 -4
  317. package/dist/toast/toaster.svelte +4 -5
  318. package/dist/toggle-group/item.svelte +3 -7
  319. package/dist/toggle-group/root.svelte +5 -6
  320. package/dist/tooltip/arrow-tip.svelte +2 -4
  321. package/dist/tooltip/arrow.svelte +2 -4
  322. package/dist/tooltip/content.svelte +28 -26
  323. package/dist/tooltip/positioner.svelte +32 -26
  324. package/dist/tooltip/root.svelte +32 -24
  325. package/dist/tooltip/trigger.svelte +2 -4
  326. package/dist/tree-view/branch-content.svelte +3 -4
  327. package/dist/tree-view/branch-control.svelte +3 -4
  328. package/dist/tree-view/branch-indicator.svelte +3 -4
  329. package/dist/tree-view/branch-text.svelte +3 -4
  330. package/dist/tree-view/branch-trigger.svelte +3 -4
  331. package/dist/tree-view/branch.svelte +2 -6
  332. package/dist/tree-view/item-indicator.svelte +3 -4
  333. package/dist/tree-view/item-text.svelte +2 -4
  334. package/dist/tree-view/item.svelte +2 -6
  335. package/dist/tree-view/label.svelte +2 -4
  336. package/dist/tree-view/root.svelte +5 -6
  337. package/dist/tree-view/tree.svelte +2 -4
  338. package/dist/types.d.ts +16 -4
  339. package/package.json +52 -50
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Headless component library for [Svelte](https://svelte.dev/) powered by [zag](https://zagjs.com/)
4
4
 
5
+ > ⚠️ This project is in early development. Feel free to use it, and contributions are welcome. Use with caution!
6
+
5
7
  ## Installation
6
8
 
7
9
  ```bash
@@ -1,32 +1,42 @@
1
- <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
3
-
4
- export interface AccordionItemContentProps extends HTMLProps<'div'> {
5
- asChild?: AsChild;
6
- }
7
- </script>
8
-
9
- <script lang="ts">
10
- import {mergeProps} from '../merge-props.js';
11
- import {
12
- getAccordionContext,
13
- getAccordionItemPropsContext,
14
- } from './context.svelte.js';
15
-
16
- let {asChild, children, ...props}: AccordionItemContentProps = $props();
17
-
18
- let accordion = getAccordionContext();
19
- let itemProps = getAccordionItemPropsContext();
20
-
21
- let mergedProps = $derived(
22
- mergeProps(props, accordion.getItemContentProps(itemProps)),
23
- );
24
- </script>
25
-
26
- {#if asChild}
27
- {@render asChild(mergedProps)}
28
- {:else}
29
- <div {...mergedProps}>
30
- {@render children?.()}
31
- </div>
32
- {/if}
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+
4
+ export interface AccordionItemContentProps
5
+ extends HtmlIngredientProps<'div'> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '../merge-props.js';
10
+ import {createPresence} from '../presence/create-presence.svelte.js';
11
+ import {
12
+ getAccordionContext,
13
+ getAccordionItemPropsContext,
14
+ } from './context.svelte.js';
15
+
16
+ let {asChild, children, ...props}: AccordionItemContentProps = $props();
17
+
18
+ let accordion = getAccordionContext();
19
+ let itemProps = getAccordionItemPropsContext();
20
+ let itemsState = $derived(accordion.getItemState(itemProps));
21
+ let presence = createPresence({
22
+ get present() {
23
+ return itemsState.expanded;
24
+ },
25
+ });
26
+
27
+ let mergedProps = $derived(
28
+ mergeProps(
29
+ props,
30
+ accordion.getItemContentProps(itemProps),
31
+ presence.getPresenceProps(),
32
+ ),
33
+ );
34
+ </script>
35
+
36
+ {#if asChild}
37
+ {@render asChild(mergedProps)}
38
+ {:else}
39
+ <div use:presence.ref {...mergedProps}>
40
+ {@render children?.()}
41
+ </div>
42
+ {/if}
@@ -1,9 +1,8 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface AccordionIndicatorProps extends HTMLProps<'span'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface AccordionIndicatorProps
5
+ extends HtmlIngredientProps<'span'> {}
7
6
  </script>
8
7
 
9
8
  <script lang="ts">
@@ -1,32 +1,31 @@
1
- <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
3
-
4
- export interface AccordionItemTriggerProps extends HTMLProps<'button'> {
5
- asChild?: AsChild;
6
- }
7
- </script>
8
-
9
- <script lang="ts">
10
- import {mergeProps} from '../merge-props.js';
11
- import {
12
- getAccordionContext,
13
- getAccordionItemPropsContext,
14
- } from './context.svelte.js';
15
-
16
- let {asChild, children, ...props}: AccordionItemTriggerProps = $props();
17
-
18
- let accordion = getAccordionContext();
19
- let itemProps = getAccordionItemPropsContext();
20
-
21
- let mergedProps = $derived(
22
- mergeProps(props, accordion.getItemTriggerProps(itemProps)),
23
- );
24
- </script>
25
-
26
- {#if asChild}
27
- {@render asChild(mergedProps)}
28
- {:else}
29
- <button type="button" {...mergedProps}>
30
- {@render children?.()}
31
- </button>
32
- {/if}
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+
4
+ export interface AccordionItemTriggerProps
5
+ extends HtmlIngredientProps<'button'> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '../merge-props.js';
10
+ import {
11
+ getAccordionContext,
12
+ getAccordionItemPropsContext,
13
+ } from './context.svelte.js';
14
+
15
+ let {asChild, children, ...props}: AccordionItemTriggerProps = $props();
16
+
17
+ let accordion = getAccordionContext();
18
+ let itemProps = getAccordionItemPropsContext();
19
+
20
+ let mergedProps = $derived(
21
+ mergeProps(props, accordion.getItemTriggerProps(itemProps)),
22
+ );
23
+ </script>
24
+
25
+ {#if asChild}
26
+ {@render asChild(mergedProps)}
27
+ {:else}
28
+ <button type="button" {...mergedProps}>
29
+ {@render children?.()}
30
+ </button>
31
+ {/if}
@@ -1,43 +1,39 @@
1
- <script lang="ts" module>
2
- import type {AsChild, Assign, HTMLProps} from '../types.js';
3
- import type {ItemProps, ItemState} from '@zag-js/accordion';
4
- import type {Snippet} from 'svelte';
5
-
6
- export interface AccordionItemProps
7
- extends Assign<Omit<HTMLProps<'div'>, 'children'>, ItemProps> {
8
- asChild?: AsChild;
9
- children?: Snippet<[ItemState]>;
10
- }
11
- </script>
12
-
13
- <script lang="ts">
14
- import {mergeProps} from '../merge-props.js';
15
- import {createSplitProps} from '@zag-js/utils';
16
- import {
17
- getAccordionContext,
18
- setAccordionItemPropsContext,
19
- } from './context.svelte.js';
20
-
21
- let {asChild, children, ...props}: AccordionItemProps = $props();
22
-
23
- let accordion = getAccordionContext();
24
-
25
- let [itemProps, otherProps] = $derived(
26
- createSplitProps<ItemProps>(['value', 'disabled'])(props),
27
- );
28
-
29
- let itemState = $derived(accordion.getItemState(itemProps));
30
- let mergedProps = $derived(
31
- mergeProps(otherProps, accordion.getItemProps(itemProps)),
32
- );
33
-
34
- setAccordionItemPropsContext(() => itemProps);
35
- </script>
36
-
37
- {#if asChild}
38
- {@render asChild(mergedProps)}
39
- {:else}
40
- <div {...mergedProps}>
41
- {@render children?.(itemState)}
42
- </div>
43
- {/if}
1
+ <script lang="ts" module>
2
+ import type {Assign, HtmlIngredientProps} from '../types.js';
3
+ import type {ItemProps, ItemState} from '@zag-js/accordion';
4
+
5
+ export interface AccordionItemProps
6
+ extends Assign<HtmlIngredientProps<'div', ItemState>, ItemProps> {}
7
+ </script>
8
+
9
+ <script lang="ts">
10
+ import {mergeProps} from '../merge-props.js';
11
+ import {createSplitProps} from '@zag-js/utils';
12
+ import {
13
+ getAccordionContext,
14
+ setAccordionItemPropsContext,
15
+ } from './context.svelte.js';
16
+
17
+ let {asChild, children, ...props}: AccordionItemProps = $props();
18
+
19
+ let accordion = getAccordionContext();
20
+
21
+ let [itemProps, otherProps] = $derived(
22
+ createSplitProps<ItemProps>(['value', 'disabled'])(props),
23
+ );
24
+
25
+ let itemState = $derived(accordion.getItemState(itemProps));
26
+ let mergedProps = $derived(
27
+ mergeProps(otherProps, accordion.getItemProps(itemProps)),
28
+ );
29
+
30
+ setAccordionItemPropsContext(() => itemProps);
31
+ </script>
32
+
33
+ {#if asChild}
34
+ {@render asChild(mergedProps, itemState)}
35
+ {:else}
36
+ <div {...mergedProps}>
37
+ {@render children?.(itemState)}
38
+ </div>
39
+ {/if}
@@ -1,16 +1,15 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, Assign, HTMLProps} from '../types.js';
3
- import type {Snippet} from 'svelte';
2
+ import type {Assign, HtmlIngredientProps} from '../types.js';
4
3
  import type {
5
4
  CreateAccordionProps,
6
5
  CreateAccordionReturn,
7
6
  } from './create-accordion.svelte.js';
8
7
 
9
8
  export interface AccordionProps
10
- extends Assign<Omit<HTMLProps<'div'>, 'children'>, CreateAccordionProps> {
11
- asChild?: AsChild<CreateAccordionReturn>;
12
- children?: Snippet<[CreateAccordionReturn]>;
13
- }
9
+ extends Assign<
10
+ HtmlIngredientProps<'div', CreateAccordionReturn>,
11
+ CreateAccordionProps
12
+ > {}
14
13
  </script>
15
14
 
16
15
  <script lang="ts">
@@ -1,9 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface AvatarFallbackProps extends HTMLProps<'span'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface AvatarFallbackProps extends HtmlIngredientProps<'span'> {}
7
5
  </script>
8
6
 
9
7
  <script lang="ts">
@@ -1,9 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface AvatarImageProps extends HTMLProps<'img'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface AvatarImageProps extends HtmlIngredientProps<'img'> {}
7
5
  </script>
8
6
 
9
7
  <script lang="ts">
@@ -1,16 +1,15 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, Assign, HTMLProps} from '../types.js';
3
- import type {Snippet} from 'svelte';
2
+ import type {Assign, HtmlIngredientProps} from '../types.js';
4
3
  import {
5
4
  type CreateAvatarProps,
6
5
  type CreateAvatarReturn,
7
6
  } from './create-avatar.svelte.js';
8
7
 
9
8
  export interface AvatarProps
10
- extends Assign<Omit<HTMLProps<'div'>, 'children'>, CreateAvatarProps> {
11
- asChild?: AsChild<CreateAvatarReturn>;
12
- children?: Snippet<[CreateAvatarReturn]>;
13
- }
9
+ extends Assign<
10
+ HtmlIngredientProps<'div', CreateAvatarReturn>,
11
+ CreateAvatarProps
12
+ > {}
14
13
  </script>
15
14
 
16
15
  <script lang="ts">
@@ -1,9 +1,8 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface CarouselIndicatorGroupProps extends HTMLProps<'div'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface CarouselIndicatorGroupProps
5
+ extends HtmlIngredientProps<'div'> {}
7
6
  </script>
8
7
 
9
8
  <script lang="ts">
@@ -1,11 +1,9 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, Assign, HTMLProps} from '../types.js';
2
+ import type {Assign, HtmlIngredientProps} from '../types.js';
3
3
  import type {IndicatorProps} from '@zag-js/carousel';
4
4
 
5
5
  export interface CarouselIndicatorProps
6
- extends Assign<HTMLProps<'button'>, IndicatorProps> {
7
- asChild?: AsChild;
8
- }
6
+ extends Assign<HtmlIngredientProps<'button'>, IndicatorProps> {}
9
7
  </script>
10
8
 
11
9
  <script lang="ts">
@@ -1,9 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface CarouselItemGroupProps extends HTMLProps<'div'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface CarouselItemGroupProps extends HtmlIngredientProps<'div'> {}
7
5
  </script>
8
6
 
9
7
  <script lang="ts">
@@ -1,13 +1,9 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, Assign, HTMLProps} from '../types.js';
2
+ import type {Assign, HtmlIngredientProps} from '../types.js';
3
3
  import type {ItemProps, ItemState} from '@zag-js/carousel';
4
- import type {Snippet} from 'svelte';
5
4
 
6
5
  export interface CarouselItemProps
7
- extends Assign<Omit<HTMLProps<'div'>, 'children'>, ItemProps> {
8
- asChild?: AsChild<ItemState>;
9
- children?: Snippet<[ItemState]>;
10
- }
6
+ extends Assign<HtmlIngredientProps<'div', ItemState>, ItemProps> {}
11
7
  </script>
12
8
 
13
9
  <script lang="ts">
@@ -1,9 +1,8 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface CarouselNextTriggerProps extends HTMLProps<'button'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface CarouselNextTriggerProps
5
+ extends HtmlIngredientProps<'button'> {}
7
6
  </script>
8
7
 
9
8
  <script lang="ts">
@@ -1,9 +1,8 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface CarouselPrevTriggerProps extends HTMLProps<'button'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface CarouselPrevTriggerProps
5
+ extends HtmlIngredientProps<'button'> {}
7
6
  </script>
8
7
 
9
8
  <script lang="ts">
@@ -1,16 +1,15 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, Assign, HTMLProps} from '../types.js';
3
- import type {Snippet} from 'svelte';
2
+ import type {Assign, HtmlIngredientProps} from '../types.js';
4
3
  import type {
5
4
  CreateCarouselProps,
6
5
  CreateCarouselReturn,
7
6
  } from './create-carousel.svelte.js';
8
7
 
9
8
  export interface CarouselProps
10
- extends Assign<Omit<HTMLProps<'div'>, 'children'>, CreateCarouselProps> {
11
- asChild?: AsChild<CreateCarouselReturn>;
12
- children?: Snippet<[CreateCarouselReturn]>;
13
- }
9
+ extends Assign<
10
+ HtmlIngredientProps<'div', CreateCarouselReturn>,
11
+ CreateCarouselProps
12
+ > {}
14
13
  </script>
15
14
 
16
15
  <script lang="ts">
@@ -1,9 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface CarouselViewportProps extends HTMLProps<'div'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface CarouselViewportProps extends HtmlIngredientProps<'div'> {}
7
5
  </script>
8
6
 
9
7
  <script lang="ts">
@@ -1,9 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface CheckboxControlProps extends HTMLProps<'div'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface CheckboxControlProps extends HtmlIngredientProps<'div'> {}
7
5
  </script>
8
6
 
9
7
  <script lang="ts">
@@ -1,18 +1,23 @@
1
1
  <script lang="ts" module>
2
- import type {HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface CheckboxHiddenInputProps extends HTMLProps<'input'> {}
4
+ export interface CheckboxHiddenInputProps
5
+ extends HtmlIngredientProps<'input'> {}
5
6
  </script>
6
7
 
7
8
  <script lang="ts">
8
9
  import {mergeProps} from '../merge-props.js';
9
10
  import {getCheckboxContext} from './context.svelte.js';
10
11
 
11
- let {...props}: CheckboxHiddenInputProps = $props();
12
+ let {asChild, ...props}: CheckboxHiddenInputProps = $props();
12
13
 
13
14
  let checkbox = getCheckboxContext();
14
15
 
15
16
  let mergedProps = $derived(mergeProps(props, checkbox.getHiddenInputProps()));
16
17
  </script>
17
18
 
18
- <input {...mergedProps} />
19
+ {#if asChild}
20
+ {@render asChild(mergedProps)}
21
+ {:else}
22
+ <input {...mergedProps} />
23
+ {/if}
@@ -1,9 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface CheckboxIndicatorProps extends HTMLProps<'div'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface CheckboxIndicatorProps extends HtmlIngredientProps<'div'> {}
7
5
  </script>
8
6
 
9
7
  <script lang="ts">
@@ -1,9 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface CheckboxLabelProps extends HTMLProps<'span'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface CheckboxLabelProps extends HtmlIngredientProps<'span'> {}
7
5
  </script>
8
6
 
9
7
  <script lang="ts">
@@ -1,16 +1,15 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, Assign, HTMLProps} from '../types.js';
3
- import type {Snippet} from 'svelte';
2
+ import type {Assign, HtmlIngredientProps} from '../types.js';
4
3
  import type {
5
4
  CreateCheckboxProps,
6
5
  CreateCheckboxReturn,
7
6
  } from './create-checkbox.svelte.js';
8
7
 
9
8
  export interface CheckboxProps
10
- extends Assign<Omit<HTMLProps<'label'>, 'children'>, CreateCheckboxProps> {
11
- asChild?: AsChild<CreateCheckboxReturn>;
12
- children?: Snippet<[CreateCheckboxReturn]>;
13
- }
9
+ extends Assign<
10
+ HtmlIngredientProps<'label', CreateCheckboxReturn>,
11
+ CreateCheckboxProps
12
+ > {}
14
13
  </script>
15
14
 
16
15
  <script lang="ts">
@@ -1,9 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface ClipboardControlProps extends HTMLProps<'div'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface ClipboardControlProps extends HtmlIngredientProps<'div'> {}
7
5
  </script>
8
6
 
9
7
  <script lang="ts">
@@ -1,11 +1,9 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, Assign, HTMLProps} from '../types.js';
2
+ import type {Assign, HtmlIngredientProps} from '../types.js';
3
3
  import type {IndicatorProps} from '@zag-js/clipboard';
4
4
 
5
5
  export interface ClipboardIndicatorProps
6
- extends Assign<HTMLProps<'span'>, Partial<IndicatorProps>> {
7
- asChild?: AsChild;
8
- }
6
+ extends Assign<HtmlIngredientProps<'span'>, Partial<IndicatorProps>> {}
9
7
  </script>
10
8
 
11
9
  <script lang="ts">
@@ -1,9 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface ClipboardInputProps extends HTMLProps<'input'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface ClipboardInputProps extends HtmlIngredientProps<'input'> {}
7
5
  </script>
8
6
 
9
7
  <script lang="ts">
@@ -1,9 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface ClipboardLabelProps extends HTMLProps<'label'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface ClipboardLabelProps extends HtmlIngredientProps<'label'> {}
7
5
  </script>
8
6
 
9
7
  <script lang="ts">
@@ -1,16 +1,15 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, Assign, HTMLProps} from '../types.js';
3
- import type {Snippet} from 'svelte';
2
+ import type {Assign, HtmlIngredientProps} from '../types.js';
4
3
  import type {
5
4
  CreateClipboardProps,
6
5
  CreateClipboardReturn,
7
6
  } from './create-clipboard.svelte.js';
8
7
 
9
8
  export interface ClipboardProps
10
- extends Assign<Omit<HTMLProps<'div'>, 'children'>, CreateClipboardProps> {
11
- asChild?: AsChild<CreateClipboardReturn>;
12
- children?: Snippet<[CreateClipboardReturn]>;
13
- }
9
+ extends Assign<
10
+ HtmlIngredientProps<'div', CreateClipboardReturn>,
11
+ CreateClipboardProps
12
+ > {}
14
13
  </script>
15
14
 
16
15
  <script lang="ts">
@@ -1,9 +1,8 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface ClipboardTriggerProps extends HTMLProps<'button'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface ClipboardTriggerProps
5
+ extends HtmlIngredientProps<'button'> {}
7
6
  </script>
8
7
 
9
8
  <script lang="ts">
@@ -1,9 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {AsChild, HTMLProps} from '../types.js';
2
+ import type {HtmlIngredientProps} from '../types.js';
3
3
 
4
- export interface CollapsibleContentProps extends HTMLProps<'div'> {
5
- asChild?: AsChild;
6
- }
4
+ export interface CollapsibleContentProps extends HtmlIngredientProps<'div'> {}
7
5
  </script>
8
6
 
9
7
  <script lang="ts">