@torpor/ui 0.3.4 → 0.3.6

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 (226) hide show
  1. package/dist/Form/Form.torp +1 -0
  2. package/dist/metafile-esm.json +1 -1
  3. package/package.json +12 -9
  4. package/CHANGELOG.md +0 -338
  5. package/scripts/postbuild.ts +0 -127
  6. package/src/Accordion/Accordion.torp +0 -230
  7. package/src/Accordion/AccordionContent.torp +0 -46
  8. package/src/Accordion/AccordionHeader.torp +0 -45
  9. package/src/Accordion/AccordionItem.torp +0 -101
  10. package/src/Accordion/AccordionTrigger.torp +0 -70
  11. package/src/Accordion/AccordionTypes.ts +0 -36
  12. package/src/Accordion/index.ts +0 -7
  13. package/src/Breadcrumb/Breadcrumb.torp +0 -45
  14. package/src/Breadcrumb/BreadcrumbItem.torp +0 -30
  15. package/src/Breadcrumb/BreadcrumbSeparator.torp +0 -27
  16. package/src/Breadcrumb/index.ts +0 -5
  17. package/src/Calendar/Calendar.torp +0 -277
  18. package/src/Calendar/CalendarDay.torp +0 -78
  19. package/src/Calendar/CalendarTypes.ts +0 -22
  20. package/src/Calendar/index.ts +0 -4
  21. package/src/Contextual/Contextual.torp +0 -129
  22. package/src/Contextual/ContextualContent.torp +0 -112
  23. package/src/Contextual/ContextualTrigger.torp +0 -70
  24. package/src/Contextual/ContextualTypes.ts +0 -30
  25. package/src/Contextual/index.ts +0 -5
  26. package/src/Dialog/Dialog.torp +0 -136
  27. package/src/Dialog/DialogBody.torp +0 -44
  28. package/src/Dialog/DialogButton.torp +0 -66
  29. package/src/Dialog/DialogFooter.torp +0 -25
  30. package/src/Dialog/DialogHeader.torp +0 -45
  31. package/src/Dialog/DialogTypes.ts +0 -17
  32. package/src/Dialog/index.ts +0 -7
  33. package/src/Disclosure/Disclosure.torp +0 -82
  34. package/src/Disclosure/DisclosureContent.torp +0 -46
  35. package/src/Disclosure/DisclosureHeader.torp +0 -45
  36. package/src/Disclosure/DisclosureTrigger.torp +0 -47
  37. package/src/Disclosure/DisclosureTypes.ts +0 -13
  38. package/src/Disclosure/index.ts +0 -6
  39. package/src/Drawer/Drawer.torp +0 -127
  40. package/src/Drawer/DrawerContent.torp +0 -83
  41. package/src/Drawer/DrawerOverlay.torp +0 -42
  42. package/src/Drawer/DrawerTrigger.torp +0 -39
  43. package/src/Drawer/DrawerTypes.ts +0 -24
  44. package/src/Drawer/index.ts +0 -6
  45. package/src/Form/CheckBox.torp +0 -94
  46. package/src/Form/Field.torp +0 -95
  47. package/src/Form/File.torp +0 -102
  48. package/src/Form/Form.torp +0 -146
  49. package/src/Form/FormTypes.ts +0 -35
  50. package/src/Form/Hidden.torp +0 -25
  51. package/src/Form/Input.torp +0 -112
  52. package/src/Form/Label.torp +0 -35
  53. package/src/Form/Message.torp +0 -39
  54. package/src/Form/Option.torp +0 -28
  55. package/src/Form/Select.torp +0 -101
  56. package/src/Form/StandardSchemaV1.ts +0 -70
  57. package/src/Form/TextArea.torp +0 -105
  58. package/src/Form/index.ts +0 -13
  59. package/src/Menu/Menu.torp +0 -174
  60. package/src/Menu/MenuButton.torp +0 -74
  61. package/src/Menu/MenuCheck.torp +0 -89
  62. package/src/Menu/MenuGroup.torp +0 -31
  63. package/src/Menu/MenuIndicator.torp +0 -40
  64. package/src/Menu/MenuPopout.torp +0 -83
  65. package/src/Menu/MenuPopoutContent.torp +0 -84
  66. package/src/Menu/MenuPopoutTrigger.torp +0 -128
  67. package/src/Menu/MenuRadio.torp +0 -103
  68. package/src/Menu/MenuRadioGroup.torp +0 -109
  69. package/src/Menu/MenuSeparator.torp +0 -26
  70. package/src/Menu/MenuTypes.ts +0 -60
  71. package/src/Menu/index.ts +0 -25
  72. package/src/MenuBar/MenuBar.torp +0 -162
  73. package/src/MenuBar/MenuBarItem.torp +0 -116
  74. package/src/MenuBar/MenuBarItemContent.torp +0 -119
  75. package/src/MenuBar/MenuBarItemTrigger.torp +0 -99
  76. package/src/MenuBar/MenuBarTypes.ts +0 -36
  77. package/src/MenuBar/index.ts +0 -6
  78. package/src/Modal/Modal.torp +0 -122
  79. package/src/Modal/ModalContent.torp +0 -81
  80. package/src/Modal/ModalOverlay.torp +0 -42
  81. package/src/Modal/ModalTrigger.torp +0 -54
  82. package/src/Modal/ModalTypes.ts +0 -22
  83. package/src/Modal/index.ts +0 -10
  84. package/src/Modal/showModal.ts +0 -19
  85. package/src/Modal/showPrompt.ts +0 -23
  86. package/src/NavMenu/NavMenu.torp +0 -190
  87. package/src/NavMenu/NavMenuButton.torp +0 -55
  88. package/src/NavMenu/NavMenuElement.torp +0 -55
  89. package/src/NavMenu/NavMenuGroup.torp +0 -41
  90. package/src/NavMenu/NavMenuGroupHeader.torp +0 -41
  91. package/src/NavMenu/NavMenuLink.torp +0 -60
  92. package/src/NavMenu/NavMenuPopout.torp +0 -89
  93. package/src/NavMenu/NavMenuPopoutButton.torp +0 -129
  94. package/src/NavMenu/NavMenuPopoutContent.torp +0 -92
  95. package/src/NavMenu/NavMenuSeparator.torp +0 -24
  96. package/src/NavMenu/NavMenuTypes.ts +0 -32
  97. package/src/NavMenu/index.ts +0 -23
  98. package/src/Notification/Notification.torp +0 -71
  99. package/src/Notification/NotificationClose.torp +0 -39
  100. package/src/Notification/NotificationContainer.torp +0 -26
  101. package/src/Notification/NotificationContent.torp +0 -25
  102. package/src/Notification/NotificationTypes.ts +0 -5
  103. package/src/Notification/index.ts +0 -13
  104. package/src/Notification/showNotification.ts +0 -30
  105. package/src/Popover/Popover.torp +0 -129
  106. package/src/Popover/PopoverContent.torp +0 -117
  107. package/src/Popover/PopoverTrigger.torp +0 -62
  108. package/src/Popover/PopoverTypes.ts +0 -30
  109. package/src/Popover/index.ts +0 -6
  110. package/src/Popover/showPopover.ts +0 -24
  111. package/src/Slider/Slider.torp +0 -84
  112. package/src/Slider/index.ts +0 -3
  113. package/src/TabGroup/TabContent.torp +0 -49
  114. package/src/TabGroup/TabGroup.torp +0 -250
  115. package/src/TabGroup/TabGroupTypes.ts +0 -44
  116. package/src/TabGroup/TabHeader.torp +0 -81
  117. package/src/TabGroup/TabList.torp +0 -61
  118. package/src/TabGroup/TabTrigger.torp +0 -76
  119. package/src/TabGroup/index.ts +0 -7
  120. package/src/ambient.d.ts +0 -7
  121. package/src/icons/ArrowDown.torp +0 -18
  122. package/src/icons/ArrowLeft.torp +0 -18
  123. package/src/icons/ArrowRight.torp +0 -18
  124. package/src/icons/ArrowUp.torp +0 -18
  125. package/src/icons/Bars.torp +0 -20
  126. package/src/icons/Check.torp +0 -18
  127. package/src/icons/ChevronDown.torp +0 -18
  128. package/src/icons/ChevronLeft.torp +0 -18
  129. package/src/icons/ChevronRight.torp +0 -18
  130. package/src/icons/ChevronUp.torp +0 -18
  131. package/src/icons/Cross.torp +0 -19
  132. package/src/icons/IconTypes.ts +0 -10
  133. package/src/icons/Loading.torp +0 -19
  134. package/src/icons/Minus.torp +0 -18
  135. package/src/icons/Plus.torp +0 -19
  136. package/src/icons/index.ts +0 -31
  137. package/src/motion/fade.ts +0 -16
  138. package/src/motion/grow.ts +0 -23
  139. package/src/motion/index.ts +0 -6
  140. package/src/motion/measure.ts +0 -28
  141. package/src/motion/slide.ts +0 -45
  142. package/src/mount/clickPopover.ts +0 -51
  143. package/src/mount/contextPopover.ts +0 -51
  144. package/src/mount/disableScroll.ts +0 -28
  145. package/src/mount/hoverPopover.ts +0 -58
  146. package/src/mount/hoverTrigger.ts +0 -59
  147. package/src/mount/trapFocus.ts +0 -58
  148. package/src/utils/dateUtils.ts +0 -244
  149. package/src/utils/documentEvents.ts +0 -17
  150. package/src/utils/getId.ts +0 -6
  151. package/src/utils/getScrollParent.ts +0 -22
  152. package/src/utils/setContextPosition.ts +0 -31
  153. package/src/utils/setPopoverPosition.ts +0 -142
  154. package/test/Accordion/accessibility.test.ts +0 -59
  155. package/test/Accordion/components/AccordionAccessibility.torp +0 -44
  156. package/test/Accordion/components/AccordionKeyboard.torp +0 -32
  157. package/test/Accordion/components/AccordionList.torp +0 -23
  158. package/test/Accordion/components/AccordionMultiple.torp +0 -32
  159. package/test/Accordion/components/AccordionSingle.torp +0 -32
  160. package/test/Accordion/for-items.test.ts +0 -52
  161. package/test/Accordion/keyboard.test.ts +0 -64
  162. package/test/Accordion/multiple-item-toggle.test.ts +0 -32
  163. package/test/Accordion/multiple-item-value.test.ts +0 -17
  164. package/test/Accordion/single-item-toggle.test.ts +0 -31
  165. package/test/Accordion/single-item-value.test.ts +0 -17
  166. package/test/Breadcrumb/accessibility.test.ts +0 -29
  167. package/test/Breadcrumb/basic.test.ts +0 -17
  168. package/test/Breadcrumb/components/BreadcrumbTest.torp +0 -15
  169. package/test/Calendar/components/CalendarTest.torp +0 -9
  170. package/test/Calendar/default.test.ts +0 -18
  171. package/test/Dialog/accessibility-alert.test.ts +0 -40
  172. package/test/Dialog/accessibility-modal.test.ts +0 -52
  173. package/test/Dialog/components/DialogAccessibility.torp +0 -25
  174. package/test/Dialog/components/DialogFunction.torp +0 -36
  175. package/test/Dialog/components/DialogModal.torp +0 -30
  176. package/test/Dialog/components/DialogVariable.torp +0 -33
  177. package/test/Dialog/function.test.ts +0 -26
  178. package/test/Dialog/variable.test.ts +0 -27
  179. package/test/Disclosure/accessibility.test.ts +0 -31
  180. package/test/Disclosure/components/DisclosureTest.torp +0 -17
  181. package/test/Disclosure/default.test.ts +0 -15
  182. package/test/Disclosure/toggle.test.ts +0 -20
  183. package/test/Form/components/FieldTest.torp +0 -25
  184. package/test/Form/components/FormTest.torp +0 -31
  185. package/test/Form/components/InputTest.torp +0 -9
  186. package/test/Form/field.test.ts +0 -34
  187. package/test/Form/form.test.ts +0 -34
  188. package/test/Form/input.test.ts +0 -19
  189. package/test/Menu/accessibility.test.ts +0 -83
  190. package/test/Menu/basic.test.ts +0 -58
  191. package/test/Menu/components/MenuAccessibility.torp +0 -59
  192. package/test/Menu/components/MenuBasic.torp +0 -58
  193. package/test/MenuBar/accessibility.test.ts +0 -87
  194. package/test/MenuBar/basic.test.ts +0 -22
  195. package/test/MenuBar/components/MenuBarAccessibility.torp +0 -34
  196. package/test/MenuBar/components/MenuBarBasic.torp +0 -25
  197. package/test/NavMenu/accessibility.test.ts +0 -97
  198. package/test/NavMenu/basic.test.ts +0 -22
  199. package/test/NavMenu/components/NavMenuAccessibility.torp +0 -35
  200. package/test/NavMenu/components/NavMenuBasic.torp +0 -28
  201. package/test/Notification/accessibility.test.ts +0 -21
  202. package/test/Notification/components/CustomNotification.torp +0 -14
  203. package/test/Notification/components/NotificationAccessibility.torp +0 -14
  204. package/test/Notification/components/NotificationFunction.torp +0 -17
  205. package/test/Notification/components/NotificationVariable.torp +0 -22
  206. package/test/Notification/function.test.ts +0 -25
  207. package/test/Notification/variable.test.ts +0 -25
  208. package/test/Popover/components/CustomDialog.torp +0 -25
  209. package/test/Popover/components/PopoverFunction.torp +0 -37
  210. package/test/Popover/components/PopoverTrigger.torp +0 -36
  211. package/test/Popover/components/PopoverVariable.torp +0 -40
  212. package/test/Popover/function.test.ts +0 -21
  213. package/test/Popover/trigger.test.ts +0 -27
  214. package/test/Popover/variable.test.ts +0 -27
  215. package/test/TabGroup/accessibility.test.ts +0 -67
  216. package/test/TabGroup/components/TabGroupAccessibility.torp +0 -28
  217. package/test/TabGroup/components/TabGroupKeyboard.torp +0 -28
  218. package/test/TabGroup/components/TabGroupList.torp +0 -26
  219. package/test/TabGroup/components/TabGroupTrigger.torp +0 -28
  220. package/test/TabGroup/for-items.test.ts +0 -52
  221. package/test/TabGroup/item-trigger.test.ts +0 -33
  222. package/test/TabGroup/item-value.test.ts +0 -17
  223. package/test/TabGroup/keyboard.test.ts +0 -72
  224. package/tsconfig.json +0 -4
  225. package/tsup.config.ts +0 -37
  226. package/vitest.config.ts +0 -12
package/CHANGELOG.md DELETED
@@ -1,338 +0,0 @@
1
- # @torpor/ui
2
-
3
- ## 0.3.4
4
-
5
- ### Patch Changes
6
-
7
- - b8d978a: Feat: style property for UI components
8
- - Updated dependencies [aa0c0e2]
9
- - @torpor/view@0.4.13
10
-
11
- ## 0.3.3
12
-
13
- ### Patch Changes
14
-
15
- - 2fdad81: Fix: File input add accept, remove value
16
-
17
- ## 0.3.2
18
-
19
- ### Patch Changes
20
-
21
- - 3f4eef3: Fix: File component name
22
- - dddec65: Feat: Hidden UI form component
23
- - fae47e6: Fix: TextArea should be a textarea
24
- - e9fe640: Fix: get checkbox checked from state value
25
- - 00c4d30: Feat: allow setting input required
26
- - e1a3f46: Fix: string unions don't work in $props
27
- - 14cd367: Fix: valibot uses a different path format
28
-
29
- ## 0.3.1
30
-
31
- ### Patch Changes
32
-
33
- - b670819: Feat: more UI form components
34
- - Updated dependencies [3cc2168]
35
- - Updated dependencies [13f2afb]
36
- - @torpor/view@0.4.7
37
-
38
- ## 0.3.0
39
-
40
- ### Minor Changes
41
-
42
- - 92438fc: !Edit: split Popover into Contextual, Modal and Popover
43
- - 42c6b60: !Fix: transitions
44
-
45
- ### Patch Changes
46
-
47
- - 4f17acb: Fix: handle undefined $props in UI components
48
- - Updated dependencies [255aad3]
49
- - Updated dependencies [8b377a2]
50
- - Updated dependencies [450b739]
51
- - Updated dependencies [168dff3]
52
- - Updated dependencies [fc60fe0]
53
- - Updated dependencies [42c6b60]
54
- - Updated dependencies [2818679]
55
- - Updated dependencies [38fd0a5]
56
- - Updated dependencies [3e6f3f7]
57
- - Updated dependencies [051998b]
58
- - @torpor/view@0.4.0
59
- - @torpor/unplugin@0.2.1
60
-
61
- ## 0.2.1
62
-
63
- ### Patch Changes
64
-
65
- - 84f7d87: Fix: prop types
66
- - 34d17f7: Feat: UI Form component and client-side submit
67
- - Updated dependencies [f4716c5]
68
- - Updated dependencies [1253f7a]
69
- - Updated dependencies [6268e00]
70
- - Updated dependencies [f2fb547]
71
- - @torpor/view@0.3.2
72
-
73
- ## 0.2.0
74
-
75
- ### Minor Changes
76
-
77
- - 51dbba7: Chore: drop CJS build and go ESM only
78
-
79
- ### Patch Changes
80
-
81
- - e613d99: Feat: create UI component d.ts files
82
- - 55750d4: Feat: UI Notification component
83
- - 94e8f0b: !Refactor: renamed OffScreen to Drawer
84
- - ede55da: Feat: add some basic UI icons
85
- - 7000755: Feat: UI Breadcrumb component
86
- - 2232fae: Feat: UI Menu and MenuBar components
87
- - 5492230: Feat: UI Calendar component
88
- - Updated dependencies [be98b35]
89
- - Updated dependencies [51dbba7]
90
- - Updated dependencies [2298a87]
91
- - Updated dependencies [3a8431a]
92
- - Updated dependencies [eb58d37]
93
- - Updated dependencies [e0637be]
94
- - Updated dependencies [9fcc613]
95
- - Updated dependencies [f5f84e6]
96
- - Updated dependencies [6cc57ff]
97
- - Updated dependencies [c4f9d18]
98
- - Updated dependencies [5598bc9]
99
- - Updated dependencies [18f1ccf]
100
- - Updated dependencies [c2b5c02]
101
- - Updated dependencies [91d1536]
102
- - Updated dependencies [4dc16df]
103
- - Updated dependencies [543b229]
104
- - Updated dependencies [3cf3ae6]
105
- - @torpor/view@0.3.0
106
- - @torpor/unplugin@0.2.0
107
-
108
- ## 0.1.7
109
-
110
- ### Patch Changes
111
-
112
- - 995d950: Fix: merge :class and class (making :class obsolete)
113
- - Updated dependencies [c38f914]
114
- - Updated dependencies [995d950]
115
- - Updated dependencies [b716d5c]
116
- - Updated dependencies [014bda0]
117
- - @torpor/view@0.2.0
118
- - @torpor/unplugin@0.1.17
119
-
120
- ## 0.1.6
121
-
122
- ### Patch Changes
123
-
124
- - 586f073: Fix: set disabled properly
125
- - a14a74f: Refactor: remove <div style="display: contents">
126
- - Updated dependencies [1866f30]
127
- - Updated dependencies [a31647f]
128
- - Updated dependencies [951a86f]
129
- - Updated dependencies [6d6fb89]
130
- - Updated dependencies [9c13f0f]
131
- - @torpor/view@0.1.6
132
-
133
- ## 0.1.5
134
-
135
- ### Patch Changes
136
-
137
- - Updated dependencies [f390b78]
138
- - @torpor/view@0.1.5
139
- - @torpor/unplugin@0.1.16
140
-
141
- ## 0.1.4
142
-
143
- ### Patch Changes
144
-
145
- - Updated dependencies [daba2ad]
146
- - @torpor/view@0.1.4
147
- - @torpor/unplugin@0.1.15
148
-
149
- ## 0.1.3
150
-
151
- ### Patch Changes
152
-
153
- - Updated dependencies [de51225]
154
- - @torpor/view@0.1.3
155
- - @torpor/unplugin@0.1.14
156
-
157
- ## 0.1.2
158
-
159
- ### Patch Changes
160
-
161
- - Updated dependencies [0e69292]
162
- - Updated dependencies [b69fde1]
163
- - @torpor/view@0.1.2
164
- - @torpor/unplugin@0.1.13
165
-
166
- ## 0.1.1
167
-
168
- ### Patch Changes
169
-
170
- - 4e6a5aa: Break: rename PopoverContentStatic to PopoverContent
171
- - 2d7fae6: Fix: show the first tab content if no value set
172
- - a3a40f6: Fix: Popover issues
173
- - Updated dependencies [f9fd76d]
174
- - Updated dependencies [1ddc240]
175
- - Updated dependencies [7b9dc31]
176
- - @torpor/view@0.1.1
177
- - @torpor/unplugin@0.1.12
178
-
179
- ## 0.1.0
180
-
181
- ### Minor Changes
182
-
183
- - 995513a: Break: specify binding with `&` rather than `:`
184
-
185
- ### Patch Changes
186
-
187
- - cda6804: Fix: move itemStates out of $state
188
- - 80c5461: Feat: id and class props for the Accordion
189
- - cbd07ca: Feat: bind component props with `&name`
190
- - d4a7ecc: Feat: UI Popover component
191
- - b6bf066: Fix: set data-state (open/closed/active/inactive)
192
- - baec4c7: Feat: UI NavMenu component
193
- - 8545f43: Feat: UI Dialog component
194
- - 7cdeaa5: Feat: id and class props for the TabGroup
195
- - Updated dependencies [28a993b]
196
- - Updated dependencies [98602ec]
197
- - Updated dependencies [a49d307]
198
- - Updated dependencies [995513a]
199
- - Updated dependencies [c9a9cf8]
200
- - Updated dependencies [cbd07ca]
201
- - Updated dependencies [f53b184]
202
- - Updated dependencies [215db17]
203
- - Updated dependencies [95e866b]
204
- - @torpor/unplugin@0.1.11
205
- - @torpor/view@0.1.0
206
-
207
- ## 0.0.17
208
-
209
- ### Patch Changes
210
-
211
- - 819a7d8: Feat: UI TabGroup component
212
- - Updated dependencies [fb896c6]
213
- - Updated dependencies [85bccf6]
214
- - @torpor/view@0.0.14
215
- - @torpor/unplugin@0.1.10
216
-
217
- ## 0.0.16
218
-
219
- ### Patch Changes
220
-
221
- - Updated dependencies [ed4a6db]
222
- - @torpor/view@0.0.13
223
- - @torpor/unplugin@0.1.9
224
-
225
- ## 0.0.15
226
-
227
- ### Patch Changes
228
-
229
- - Updated dependencies [ff5f459]
230
- - @torpor/view@0.0.12
231
- - @torpor/unplugin@0.1.8
232
-
233
- ## 0.0.14
234
-
235
- ### Patch Changes
236
-
237
- - Updated dependencies [e4060e6]
238
- - @torpor/unplugin@0.1.7
239
-
240
- ## 0.0.13
241
-
242
- ### Patch Changes
243
-
244
- - Updated dependencies [5676a0b]
245
- - @torpor/unplugin@0.1.6
246
-
247
- ## 0.0.12
248
-
249
- ### Patch Changes
250
-
251
- - Updated dependencies [78e78b9]
252
- - @torpor/view@0.0.11
253
- - @torpor/unplugin@0.1.5
254
-
255
- ## 0.0.11
256
-
257
- ### Patch Changes
258
-
259
- - Updated dependencies [8852c89]
260
- - @torpor/unplugin@0.1.4
261
-
262
- ## 0.0.10
263
-
264
- ### Patch Changes
265
-
266
- - Updated dependencies [3cf6de6]
267
- - @torpor/view@0.0.10
268
- - @torpor/unplugin@0.1.3
269
-
270
- ## 0.0.9
271
-
272
- ### Patch Changes
273
-
274
- - 47c5277: Chore: update dependencies
275
- - Updated dependencies [47c5277]
276
- - @torpor/unplugin@0.1.2
277
- - @torpor/view@0.0.9
278
-
279
- ## 0.0.8
280
-
281
- ### Patch Changes
282
-
283
- - Updated dependencies [a8ead36]
284
- - @torpor/view@0.0.8
285
- - @torpor/unplugin@0.1.1
286
-
287
- ## 0.0.7
288
-
289
- ### Patch Changes
290
-
291
- - Updated dependencies
292
- - @torpor/unplugin@0.1.0
293
-
294
- ## 0.0.6
295
-
296
- ### Patch Changes
297
-
298
- - Updated dependencies [b90d729]
299
- - @torpor/view@0.0.7
300
- - @torpor/unplugin@0.0.6
301
-
302
- ## 0.0.5
303
-
304
- ### Patch Changes
305
-
306
- - Updated dependencies [808da4c]
307
- - @torpor/view@0.0.6
308
- - @torpor/unplugin@0.0.5
309
-
310
- ## 0.0.4
311
-
312
- ### Patch Changes
313
-
314
- - Updated dependencies [44cf656]
315
- - Updated dependencies [a278176]
316
- - @torpor/view@0.0.5
317
- - @torpor/unplugin@0.0.4
318
-
319
- ## 0.0.3
320
-
321
- ### Patch Changes
322
-
323
- - Updated dependencies [76dd6ea]
324
- - Updated dependencies [8f0a0a1]
325
- - @torpor/view@0.0.4
326
- - @torpor/unplugin@0.0.3
327
-
328
- ## 0.0.2
329
-
330
- ### Patch Changes
331
-
332
- - Updated dependencies
333
- - Updated dependencies
334
- - Updated dependencies
335
- - Updated dependencies
336
- - Updated dependencies
337
- - @torpor/view@0.0.3
338
- - @torpor/unplugin@0.0.2
@@ -1,127 +0,0 @@
1
- import { buildType, parse } from "@torpor/view/compile";
2
- import chalk from "chalk";
3
- import { existsSync, promises as fs, lstatSync } from "node:fs";
4
- import { basename, dirname, join, resolve } from "node:path";
5
- import { fileURLToPath } from "node:url";
6
-
7
- // HACK: There is almost certainly a way to do this with standard TS/TSUP/etc
8
- // but I can't figure it out
9
-
10
- async function run() {
11
- const scriptsFolder = dirname(fileURLToPath(import.meta.url));
12
- const sourceFolder = resolve(scriptsFolder, "../src");
13
- const distFolder = resolve(scriptsFolder, "../dist");
14
-
15
- // Wait for the types to be generated, then wait another 500ms, because
16
- // otherwise the types WE generate get deleted
17
- await waitUntilFileExists(join(distFolder, "index.d.ts"));
18
- await new Promise((resolve, _reject) => setTimeout(() => resolve(true), 500));
19
-
20
- // Read the dist files first, not for every component
21
- const distFiles = (await fs.readdir(distFolder)).filter((f) => f.endsWith(".torp"));
22
-
23
- // Loop through component folders e.g. Accordion
24
- const componentFolders = (await fs.readdir(distFolder)).filter((f) =>
25
- lstatSync(join(distFolder, f)).isDirectory(),
26
- );
27
- for (const component of componentFolders) {
28
- // If it's an old folder, delete it
29
- if (!existsSync(join(sourceFolder, component))) {
30
- await fs.rmdir(join(distFolder, component));
31
- continue;
32
- }
33
-
34
- console.log(chalk.cyan.inverse(" POST "), `Tidy ${component}`);
35
-
36
- // Loop through files and change declarations to imports so they get
37
- // processed by bundlers
38
- let indexFiles = await fs.readdir(join(distFolder, component));
39
- for (const file of indexFiles) {
40
- let jsfile = join(distFolder, component, file);
41
- let code = await fs.readFile(jsfile, "utf8");
42
- code = code.replace(/var (.+?) = "\.\.\/(.+?)-(.+?).torp"/g, 'import $1 from "./$2.torp"');
43
- await fs.writeFile(jsfile, code);
44
- }
45
-
46
- // Move all *.torp files for the component into this folder
47
- // And while we're at it, create type definitions
48
- let typeDefs: string[] = [];
49
- let relatedFiles = (await fs.readdir(join(sourceFolder, component)))
50
- .filter((f) => f.endsWith(".torp") && f !== component)
51
- .map((f) => basename(f, ".torp"))
52
- .map((f) => {
53
- const output = distFiles.find((df) => df.startsWith(`${f}-`) && df.endsWith(".torp"));
54
- if (!output) {
55
- console.log("FILE NOT FOUND:", f, distFiles);
56
- }
57
- return output!;
58
- });
59
- for (let file of relatedFiles) {
60
- const newFileName = file.substring(0, file.indexOf("-")) + ".torp";
61
- const newFilePath = join(distFolder, component, newFileName);
62
- await fs.rename(join(distFolder, file), newFilePath);
63
-
64
- const parsed = parse(await fs.readFile(newFilePath, "utf8"));
65
- // HACK: by this point we should be certain there's no errors
66
- typeDefs.push(buildType(parsed.template!));
67
- }
68
-
69
- // Move all *.ts files into this folder
70
- const srcFolder = resolve(distFolder, "..", "src", component);
71
- const tsFiles = (await fs.readdir(srcFolder)).filter(
72
- (f) => f.endsWith(".ts") && f !== "index.ts",
73
- );
74
- for (const file of tsFiles) {
75
- await fs.copyFile(join(srcFolder, file), join(distFolder, component, file));
76
- }
77
-
78
- // Create the d.ts file from the type definitions
79
- let dts = `import { type SlotRender } from "@torpor/view";\n`;
80
- let exportNames: string[] = [];
81
- for (let typeDef of typeDefs) {
82
- const match = /export default (.+?);/.exec(typeDef);
83
- if (match) {
84
- exportNames.push(match[1]);
85
- typeDef = typeDef.replace(match[0], "");
86
- }
87
- typeDef = typeDef.replace(`import { type SlotRender } from "@torpor/view";`, "");
88
- dts += typeDef;
89
- }
90
- dts += `export { ${exportNames.join(", ")} };`;
91
- await fs.writeFile(join(distFolder, component, "index.d.ts"), dts);
92
- }
93
-
94
- // Move all `utils` and `mount` TS files into the dest folder
95
- await moveUtils(distFolder, "utils");
96
- await moveUtils(distFolder, "mount");
97
-
98
- // HACK: Move index.d.ts into the motion folder. This works because it's the
99
- // only d.ts file we create (for now...?)
100
- await fs.copyFile(join(distFolder, "index.d.ts"), join(distFolder, "motion", "index.d.ts"));
101
- }
102
-
103
- async function moveUtils(distFolder: string, folderName: string) {
104
- // Move all utils/*.ts files into the dest folder
105
- if (!existsSync(join(distFolder, folderName))) {
106
- await fs.mkdir(join(distFolder, folderName));
107
- }
108
-
109
- const utilsFolder = resolve(distFolder, "..", "src", folderName);
110
- const utilsFiles = (await fs.readdir(utilsFolder)).filter(
111
- (f) => f.endsWith(".ts") && f !== "index.ts",
112
- );
113
- for (const file of utilsFiles) {
114
- await fs.copyFile(join(utilsFolder, file), join(distFolder, folderName, file));
115
- }
116
- }
117
-
118
- // From https://stackoverflow.com/a/62339353
119
- async function waitUntilFileExists(filePath: string, currentTime = 0, timeout = 5000) {
120
- if (existsSync(filePath)) return true;
121
- if (currentTime === timeout) return false;
122
- const interval = 500;
123
- await new Promise((resolve, _reject) => setTimeout(() => resolve(true), interval));
124
- return waitUntilFileExists(filePath, currentTime + interval, timeout);
125
- }
126
-
127
- await run();
@@ -1,230 +0,0 @@
1
- import type { ClassValue, StyleValue } from "@torpor/view";
2
- import { AccordionContextName, type AccordionContext, type ItemState } from "./AccordionTypes";
3
-
4
- interface AccordionProps {
5
- /** An ID for the root element */
6
- id?: string;
7
- /** Classes for the root element */
8
- class?: ClassValue,
9
- /** Styles for the root element */
10
- style?: StyleValue,
11
- /** Whether a single AccordionItem or multiple AccordionItems can be expanded at the same time */
12
- type?: "single" | "multiple",
13
- /** The value of the expanded AccordionItem, or an array of values if the type is "multiple" */
14
- value?: string | string[],
15
- /** If set to true, the user cannot interact with any items in the Accordion */
16
- disabled?: boolean,
17
- /** Raised when the expanded item(s) have changed */
18
- onchange?: (value: string | string[]) => void,
19
- }
20
-
21
- /**
22
- * A vertically stacked set of interactive headings that enable users to reveal
23
- * or hide associated sections of content.
24
- *
25
- * See [the WAI ARIA guidelines for Accordions](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/).
26
- *
27
- * The structure of an Accordion is:
28
- *
29
- * ```
30
- * <Accordion>
31
- * <AccordionItem>
32
- * <AccordionHeader>
33
- * <AccordionTrigger />
34
- * </AccordionHeader>
35
- * <AccordionContent />
36
- * </AccordionItem>
37
- * </Accordion>
38
- * ```
39
- */
40
- export default function Accordion($props: AccordionProps | undefined) {
41
- let type = $props?.type ?? "single";
42
-
43
- let $state = $watch({
44
- value: $props?.value ?? (type === "single" ? "" : [] as string[])
45
- });
46
-
47
- $run(() => {
48
- if ($props !== undefined) {
49
- $props.value = $state.value;
50
- }
51
- });
52
-
53
- let itemStates: ItemState[] = [];
54
-
55
- // This is used to assign automatic indexes to items where needed
56
- let nextIndex = 0;
57
-
58
- // Set the context to pass down to items, with functions for each item to call
59
- let context: AccordionContext = {
60
- registerItem,
61
- removeItem,
62
- toggleItem,
63
- handleHeaderKey
64
- };
65
- $context[AccordionContextName] = context;
66
-
67
- $run(() => {
68
- // HACK: This should probably be done with setters?
69
- let newValue = $state.value;
70
-
71
- // Get the value
72
- switch (type) {
73
- case "single": {
74
- // Ensure the value passed in was a string (in case e.g. the user has set values to ints)
75
- newValue = newValue.toString();
76
- for (let item of itemStates) {
77
- item.expanded = item.value === newValue;
78
- }
79
- break;
80
- }
81
- case "multiple": {
82
- // Ensure the value passed in is an array
83
- if (!Array.isArray(newValue)) {
84
- newValue = [newValue];
85
- }
86
- for (let item of itemStates) {
87
- item.expanded = newValue.indexOf(item.value) !== -1;
88
- }
89
- break;
90
- }
91
- }
92
-
93
- // Set the value
94
- $state.value = newValue;
95
- })
96
-
97
- $run(() => {
98
- itemStates.forEach((s) => s.parentDisabled = $props?.disabled === true);
99
- });
100
-
101
- // Dispatch the change event when the value changes
102
- let firstChange = true;
103
- $run(() => {
104
- const ev = $props?.onchange;
105
- const value = $state.value;
106
- if (firstChange) {
107
- firstChange = false;
108
- } else if (ev) {
109
- ev(value);
110
- }
111
- });
112
-
113
- function registerItem(itemState: ItemState) {
114
- // If an index wasn't set for the item, set it automatically
115
- if (itemState.index === -1) {
116
- itemState.index = nextIndex++;
117
- }
118
-
119
- // If a value wasn't set for the item, set it to the index
120
- if (!itemState.value) {
121
- itemState.value = itemState.index.toString();
122
- }
123
-
124
- // If we have a value, set whether the item should be expanded
125
- if ($state.value) {
126
- switch (type) {
127
- case "single": {
128
- itemState.expanded = $state.value === itemState.value;
129
- break;
130
- }
131
- case "multiple": {
132
- itemState.expanded = $state.value.includes(itemState.value);
133
- break;
134
- }
135
- }
136
- }
137
-
138
- // Set whether the Accordion itself is disabled
139
- itemState.parentDisabled = $props?.disabled === true
140
-
141
- // Add the item's state to the array
142
- itemStates.splice(itemState.index, 0, itemState);
143
- }
144
-
145
- // TODO: I think this should be done by value
146
- function removeItem(itemIndex: number) {
147
- // Remove the item and re-index
148
- let index = itemStates.findIndex((item) => item.index === itemIndex);
149
- if (index !== -1) {
150
- itemStates.splice(itemIndex, 1);
151
- }
152
- itemStates.forEach((item, i) => (item.index = i));
153
- }
154
-
155
- function toggleItem(toggleValue: string) {
156
- switch (type) {
157
- case "single": {
158
- for (let item of itemStates) {
159
- // The item is expanded if it has the supplied value (i.e. if it was clicked) and if it
160
- // wasn't already expanded (i.e. we collapse it if it was expanded and clicked)
161
- if (item.value === toggleValue) {
162
- $state.value = item.expanded ? "" : item.value;
163
- break;
164
- }
165
- }
166
- break;
167
- }
168
- case "multiple": {
169
- let newValue = [];
170
- for (let item of itemStates) {
171
- // The item is expanded if it has the supplied value (i.e. if it was clicked) or if it
172
- // was already expanded
173
- if (
174
- (item.value === toggleValue && !item.expanded) ||
175
- (item.value !== toggleValue && item.expanded)
176
- ) {
177
- newValue.push(item.value);
178
- }
179
- }
180
- $state.value = newValue.sort();
181
- break;
182
- }
183
- }
184
- }
185
-
186
- function handleHeaderKey(headerIndex: number, e: KeyboardEvent) {
187
- switch (e.key) {
188
- case "Up":
189
- case "ArrowUp": {
190
- if (headerIndex > 0) {
191
- e.preventDefault();
192
- itemStates[headerIndex - 1].setFocused();
193
- }
194
- break;
195
- }
196
- case "Down":
197
- case "ArrowDown": {
198
- if (headerIndex < itemStates.length - 1) {
199
- e.preventDefault();
200
- itemStates[headerIndex + 1].setFocused();
201
- }
202
- break;
203
- }
204
- case "Home": {
205
- if (headerIndex > 0) {
206
- e.preventDefault();
207
- itemStates[0].setFocused();
208
- }
209
- break;
210
- }
211
- case "End": {
212
- if (headerIndex < itemStates.length - 1) {
213
- e.preventDefault();
214
- itemStates[itemStates.length - 1].setFocused();
215
- }
216
- break;
217
- }
218
- }
219
- }
220
-
221
- @render {
222
- <div
223
- {$props?.id}
224
- class={["torp-accordion", $props?.class]}
225
- {$props?.style}
226
- >
227
- <slot />
228
- </div>
229
- }
230
- }