@torpor/ui 0.3.5 → 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 (225) hide show
  1. package/dist/metafile-esm.json +1 -1
  2. package/package.json +5 -2
  3. package/CHANGELOG.md +0 -344
  4. package/scripts/postbuild.ts +0 -127
  5. package/src/Accordion/Accordion.torp +0 -230
  6. package/src/Accordion/AccordionContent.torp +0 -46
  7. package/src/Accordion/AccordionHeader.torp +0 -45
  8. package/src/Accordion/AccordionItem.torp +0 -101
  9. package/src/Accordion/AccordionTrigger.torp +0 -70
  10. package/src/Accordion/AccordionTypes.ts +0 -36
  11. package/src/Accordion/index.ts +0 -7
  12. package/src/Breadcrumb/Breadcrumb.torp +0 -45
  13. package/src/Breadcrumb/BreadcrumbItem.torp +0 -30
  14. package/src/Breadcrumb/BreadcrumbSeparator.torp +0 -27
  15. package/src/Breadcrumb/index.ts +0 -5
  16. package/src/Calendar/Calendar.torp +0 -277
  17. package/src/Calendar/CalendarDay.torp +0 -78
  18. package/src/Calendar/CalendarTypes.ts +0 -22
  19. package/src/Calendar/index.ts +0 -4
  20. package/src/Contextual/Contextual.torp +0 -129
  21. package/src/Contextual/ContextualContent.torp +0 -112
  22. package/src/Contextual/ContextualTrigger.torp +0 -70
  23. package/src/Contextual/ContextualTypes.ts +0 -30
  24. package/src/Contextual/index.ts +0 -5
  25. package/src/Dialog/Dialog.torp +0 -136
  26. package/src/Dialog/DialogBody.torp +0 -44
  27. package/src/Dialog/DialogButton.torp +0 -66
  28. package/src/Dialog/DialogFooter.torp +0 -25
  29. package/src/Dialog/DialogHeader.torp +0 -45
  30. package/src/Dialog/DialogTypes.ts +0 -17
  31. package/src/Dialog/index.ts +0 -7
  32. package/src/Disclosure/Disclosure.torp +0 -82
  33. package/src/Disclosure/DisclosureContent.torp +0 -46
  34. package/src/Disclosure/DisclosureHeader.torp +0 -45
  35. package/src/Disclosure/DisclosureTrigger.torp +0 -47
  36. package/src/Disclosure/DisclosureTypes.ts +0 -13
  37. package/src/Disclosure/index.ts +0 -6
  38. package/src/Drawer/Drawer.torp +0 -127
  39. package/src/Drawer/DrawerContent.torp +0 -83
  40. package/src/Drawer/DrawerOverlay.torp +0 -42
  41. package/src/Drawer/DrawerTrigger.torp +0 -39
  42. package/src/Drawer/DrawerTypes.ts +0 -24
  43. package/src/Drawer/index.ts +0 -6
  44. package/src/Form/CheckBox.torp +0 -94
  45. package/src/Form/Field.torp +0 -95
  46. package/src/Form/File.torp +0 -102
  47. package/src/Form/Form.torp +0 -147
  48. package/src/Form/FormTypes.ts +0 -35
  49. package/src/Form/Hidden.torp +0 -25
  50. package/src/Form/Input.torp +0 -112
  51. package/src/Form/Label.torp +0 -35
  52. package/src/Form/Message.torp +0 -39
  53. package/src/Form/Option.torp +0 -28
  54. package/src/Form/Select.torp +0 -101
  55. package/src/Form/StandardSchemaV1.ts +0 -70
  56. package/src/Form/TextArea.torp +0 -105
  57. package/src/Form/index.ts +0 -13
  58. package/src/Menu/Menu.torp +0 -174
  59. package/src/Menu/MenuButton.torp +0 -74
  60. package/src/Menu/MenuCheck.torp +0 -89
  61. package/src/Menu/MenuGroup.torp +0 -31
  62. package/src/Menu/MenuIndicator.torp +0 -40
  63. package/src/Menu/MenuPopout.torp +0 -83
  64. package/src/Menu/MenuPopoutContent.torp +0 -84
  65. package/src/Menu/MenuPopoutTrigger.torp +0 -128
  66. package/src/Menu/MenuRadio.torp +0 -103
  67. package/src/Menu/MenuRadioGroup.torp +0 -109
  68. package/src/Menu/MenuSeparator.torp +0 -26
  69. package/src/Menu/MenuTypes.ts +0 -60
  70. package/src/Menu/index.ts +0 -25
  71. package/src/MenuBar/MenuBar.torp +0 -162
  72. package/src/MenuBar/MenuBarItem.torp +0 -116
  73. package/src/MenuBar/MenuBarItemContent.torp +0 -119
  74. package/src/MenuBar/MenuBarItemTrigger.torp +0 -99
  75. package/src/MenuBar/MenuBarTypes.ts +0 -36
  76. package/src/MenuBar/index.ts +0 -6
  77. package/src/Modal/Modal.torp +0 -122
  78. package/src/Modal/ModalContent.torp +0 -81
  79. package/src/Modal/ModalOverlay.torp +0 -42
  80. package/src/Modal/ModalTrigger.torp +0 -54
  81. package/src/Modal/ModalTypes.ts +0 -22
  82. package/src/Modal/index.ts +0 -10
  83. package/src/Modal/showModal.ts +0 -19
  84. package/src/Modal/showPrompt.ts +0 -23
  85. package/src/NavMenu/NavMenu.torp +0 -190
  86. package/src/NavMenu/NavMenuButton.torp +0 -55
  87. package/src/NavMenu/NavMenuElement.torp +0 -55
  88. package/src/NavMenu/NavMenuGroup.torp +0 -41
  89. package/src/NavMenu/NavMenuGroupHeader.torp +0 -41
  90. package/src/NavMenu/NavMenuLink.torp +0 -60
  91. package/src/NavMenu/NavMenuPopout.torp +0 -89
  92. package/src/NavMenu/NavMenuPopoutButton.torp +0 -129
  93. package/src/NavMenu/NavMenuPopoutContent.torp +0 -92
  94. package/src/NavMenu/NavMenuSeparator.torp +0 -24
  95. package/src/NavMenu/NavMenuTypes.ts +0 -32
  96. package/src/NavMenu/index.ts +0 -23
  97. package/src/Notification/Notification.torp +0 -71
  98. package/src/Notification/NotificationClose.torp +0 -39
  99. package/src/Notification/NotificationContainer.torp +0 -26
  100. package/src/Notification/NotificationContent.torp +0 -25
  101. package/src/Notification/NotificationTypes.ts +0 -5
  102. package/src/Notification/index.ts +0 -13
  103. package/src/Notification/showNotification.ts +0 -30
  104. package/src/Popover/Popover.torp +0 -129
  105. package/src/Popover/PopoverContent.torp +0 -117
  106. package/src/Popover/PopoverTrigger.torp +0 -62
  107. package/src/Popover/PopoverTypes.ts +0 -30
  108. package/src/Popover/index.ts +0 -6
  109. package/src/Popover/showPopover.ts +0 -24
  110. package/src/Slider/Slider.torp +0 -84
  111. package/src/Slider/index.ts +0 -3
  112. package/src/TabGroup/TabContent.torp +0 -49
  113. package/src/TabGroup/TabGroup.torp +0 -250
  114. package/src/TabGroup/TabGroupTypes.ts +0 -44
  115. package/src/TabGroup/TabHeader.torp +0 -81
  116. package/src/TabGroup/TabList.torp +0 -61
  117. package/src/TabGroup/TabTrigger.torp +0 -76
  118. package/src/TabGroup/index.ts +0 -7
  119. package/src/ambient.d.ts +0 -7
  120. package/src/icons/ArrowDown.torp +0 -18
  121. package/src/icons/ArrowLeft.torp +0 -18
  122. package/src/icons/ArrowRight.torp +0 -18
  123. package/src/icons/ArrowUp.torp +0 -18
  124. package/src/icons/Bars.torp +0 -20
  125. package/src/icons/Check.torp +0 -18
  126. package/src/icons/ChevronDown.torp +0 -18
  127. package/src/icons/ChevronLeft.torp +0 -18
  128. package/src/icons/ChevronRight.torp +0 -18
  129. package/src/icons/ChevronUp.torp +0 -18
  130. package/src/icons/Cross.torp +0 -19
  131. package/src/icons/IconTypes.ts +0 -10
  132. package/src/icons/Loading.torp +0 -19
  133. package/src/icons/Minus.torp +0 -18
  134. package/src/icons/Plus.torp +0 -19
  135. package/src/icons/index.ts +0 -31
  136. package/src/motion/fade.ts +0 -16
  137. package/src/motion/grow.ts +0 -23
  138. package/src/motion/index.ts +0 -6
  139. package/src/motion/measure.ts +0 -28
  140. package/src/motion/slide.ts +0 -45
  141. package/src/mount/clickPopover.ts +0 -51
  142. package/src/mount/contextPopover.ts +0 -51
  143. package/src/mount/disableScroll.ts +0 -28
  144. package/src/mount/hoverPopover.ts +0 -58
  145. package/src/mount/hoverTrigger.ts +0 -59
  146. package/src/mount/trapFocus.ts +0 -58
  147. package/src/utils/dateUtils.ts +0 -244
  148. package/src/utils/documentEvents.ts +0 -17
  149. package/src/utils/getId.ts +0 -6
  150. package/src/utils/getScrollParent.ts +0 -22
  151. package/src/utils/setContextPosition.ts +0 -31
  152. package/src/utils/setPopoverPosition.ts +0 -142
  153. package/test/Accordion/accessibility.test.ts +0 -59
  154. package/test/Accordion/components/AccordionAccessibility.torp +0 -44
  155. package/test/Accordion/components/AccordionKeyboard.torp +0 -32
  156. package/test/Accordion/components/AccordionList.torp +0 -23
  157. package/test/Accordion/components/AccordionMultiple.torp +0 -32
  158. package/test/Accordion/components/AccordionSingle.torp +0 -32
  159. package/test/Accordion/for-items.test.ts +0 -52
  160. package/test/Accordion/keyboard.test.ts +0 -64
  161. package/test/Accordion/multiple-item-toggle.test.ts +0 -32
  162. package/test/Accordion/multiple-item-value.test.ts +0 -17
  163. package/test/Accordion/single-item-toggle.test.ts +0 -31
  164. package/test/Accordion/single-item-value.test.ts +0 -17
  165. package/test/Breadcrumb/accessibility.test.ts +0 -29
  166. package/test/Breadcrumb/basic.test.ts +0 -17
  167. package/test/Breadcrumb/components/BreadcrumbTest.torp +0 -15
  168. package/test/Calendar/components/CalendarTest.torp +0 -9
  169. package/test/Calendar/default.test.ts +0 -18
  170. package/test/Dialog/accessibility-alert.test.ts +0 -40
  171. package/test/Dialog/accessibility-modal.test.ts +0 -52
  172. package/test/Dialog/components/DialogAccessibility.torp +0 -25
  173. package/test/Dialog/components/DialogFunction.torp +0 -36
  174. package/test/Dialog/components/DialogModal.torp +0 -30
  175. package/test/Dialog/components/DialogVariable.torp +0 -33
  176. package/test/Dialog/function.test.ts +0 -26
  177. package/test/Dialog/variable.test.ts +0 -27
  178. package/test/Disclosure/accessibility.test.ts +0 -31
  179. package/test/Disclosure/components/DisclosureTest.torp +0 -17
  180. package/test/Disclosure/default.test.ts +0 -15
  181. package/test/Disclosure/toggle.test.ts +0 -20
  182. package/test/Form/components/FieldTest.torp +0 -25
  183. package/test/Form/components/FormTest.torp +0 -31
  184. package/test/Form/components/InputTest.torp +0 -9
  185. package/test/Form/field.test.ts +0 -34
  186. package/test/Form/form.test.ts +0 -34
  187. package/test/Form/input.test.ts +0 -19
  188. package/test/Menu/accessibility.test.ts +0 -83
  189. package/test/Menu/basic.test.ts +0 -58
  190. package/test/Menu/components/MenuAccessibility.torp +0 -59
  191. package/test/Menu/components/MenuBasic.torp +0 -58
  192. package/test/MenuBar/accessibility.test.ts +0 -87
  193. package/test/MenuBar/basic.test.ts +0 -22
  194. package/test/MenuBar/components/MenuBarAccessibility.torp +0 -34
  195. package/test/MenuBar/components/MenuBarBasic.torp +0 -25
  196. package/test/NavMenu/accessibility.test.ts +0 -97
  197. package/test/NavMenu/basic.test.ts +0 -22
  198. package/test/NavMenu/components/NavMenuAccessibility.torp +0 -35
  199. package/test/NavMenu/components/NavMenuBasic.torp +0 -28
  200. package/test/Notification/accessibility.test.ts +0 -21
  201. package/test/Notification/components/CustomNotification.torp +0 -14
  202. package/test/Notification/components/NotificationAccessibility.torp +0 -14
  203. package/test/Notification/components/NotificationFunction.torp +0 -17
  204. package/test/Notification/components/NotificationVariable.torp +0 -22
  205. package/test/Notification/function.test.ts +0 -25
  206. package/test/Notification/variable.test.ts +0 -25
  207. package/test/Popover/components/CustomDialog.torp +0 -25
  208. package/test/Popover/components/PopoverFunction.torp +0 -37
  209. package/test/Popover/components/PopoverTrigger.torp +0 -36
  210. package/test/Popover/components/PopoverVariable.torp +0 -40
  211. package/test/Popover/function.test.ts +0 -21
  212. package/test/Popover/trigger.test.ts +0 -27
  213. package/test/Popover/variable.test.ts +0 -27
  214. package/test/TabGroup/accessibility.test.ts +0 -67
  215. package/test/TabGroup/components/TabGroupAccessibility.torp +0 -28
  216. package/test/TabGroup/components/TabGroupKeyboard.torp +0 -28
  217. package/test/TabGroup/components/TabGroupList.torp +0 -26
  218. package/test/TabGroup/components/TabGroupTrigger.torp +0 -28
  219. package/test/TabGroup/for-items.test.ts +0 -52
  220. package/test/TabGroup/item-trigger.test.ts +0 -33
  221. package/test/TabGroup/item-value.test.ts +0 -17
  222. package/test/TabGroup/keyboard.test.ts +0 -72
  223. package/tsconfig.json +0 -4
  224. package/tsup.config.ts +0 -37
  225. package/vitest.config.ts +0 -12
package/CHANGELOG.md DELETED
@@ -1,344 +0,0 @@
1
- # @torpor/ui
2
-
3
- ## 0.3.5
4
-
5
- ### Patch Changes
6
-
7
- - 8731a11: Fix: add form action
8
-
9
- ## 0.3.4
10
-
11
- ### Patch Changes
12
-
13
- - b8d978a: Feat: style property for UI components
14
- - Updated dependencies [aa0c0e2]
15
- - @torpor/view@0.4.13
16
-
17
- ## 0.3.3
18
-
19
- ### Patch Changes
20
-
21
- - 2fdad81: Fix: File input add accept, remove value
22
-
23
- ## 0.3.2
24
-
25
- ### Patch Changes
26
-
27
- - 3f4eef3: Fix: File component name
28
- - dddec65: Feat: Hidden UI form component
29
- - fae47e6: Fix: TextArea should be a textarea
30
- - e9fe640: Fix: get checkbox checked from state value
31
- - 00c4d30: Feat: allow setting input required
32
- - e1a3f46: Fix: string unions don't work in $props
33
- - 14cd367: Fix: valibot uses a different path format
34
-
35
- ## 0.3.1
36
-
37
- ### Patch Changes
38
-
39
- - b670819: Feat: more UI form components
40
- - Updated dependencies [3cc2168]
41
- - Updated dependencies [13f2afb]
42
- - @torpor/view@0.4.7
43
-
44
- ## 0.3.0
45
-
46
- ### Minor Changes
47
-
48
- - 92438fc: !Edit: split Popover into Contextual, Modal and Popover
49
- - 42c6b60: !Fix: transitions
50
-
51
- ### Patch Changes
52
-
53
- - 4f17acb: Fix: handle undefined $props in UI components
54
- - Updated dependencies [255aad3]
55
- - Updated dependencies [8b377a2]
56
- - Updated dependencies [450b739]
57
- - Updated dependencies [168dff3]
58
- - Updated dependencies [fc60fe0]
59
- - Updated dependencies [42c6b60]
60
- - Updated dependencies [2818679]
61
- - Updated dependencies [38fd0a5]
62
- - Updated dependencies [3e6f3f7]
63
- - Updated dependencies [051998b]
64
- - @torpor/view@0.4.0
65
- - @torpor/unplugin@0.2.1
66
-
67
- ## 0.2.1
68
-
69
- ### Patch Changes
70
-
71
- - 84f7d87: Fix: prop types
72
- - 34d17f7: Feat: UI Form component and client-side submit
73
- - Updated dependencies [f4716c5]
74
- - Updated dependencies [1253f7a]
75
- - Updated dependencies [6268e00]
76
- - Updated dependencies [f2fb547]
77
- - @torpor/view@0.3.2
78
-
79
- ## 0.2.0
80
-
81
- ### Minor Changes
82
-
83
- - 51dbba7: Chore: drop CJS build and go ESM only
84
-
85
- ### Patch Changes
86
-
87
- - e613d99: Feat: create UI component d.ts files
88
- - 55750d4: Feat: UI Notification component
89
- - 94e8f0b: !Refactor: renamed OffScreen to Drawer
90
- - ede55da: Feat: add some basic UI icons
91
- - 7000755: Feat: UI Breadcrumb component
92
- - 2232fae: Feat: UI Menu and MenuBar components
93
- - 5492230: Feat: UI Calendar component
94
- - Updated dependencies [be98b35]
95
- - Updated dependencies [51dbba7]
96
- - Updated dependencies [2298a87]
97
- - Updated dependencies [3a8431a]
98
- - Updated dependencies [eb58d37]
99
- - Updated dependencies [e0637be]
100
- - Updated dependencies [9fcc613]
101
- - Updated dependencies [f5f84e6]
102
- - Updated dependencies [6cc57ff]
103
- - Updated dependencies [c4f9d18]
104
- - Updated dependencies [5598bc9]
105
- - Updated dependencies [18f1ccf]
106
- - Updated dependencies [c2b5c02]
107
- - Updated dependencies [91d1536]
108
- - Updated dependencies [4dc16df]
109
- - Updated dependencies [543b229]
110
- - Updated dependencies [3cf3ae6]
111
- - @torpor/view@0.3.0
112
- - @torpor/unplugin@0.2.0
113
-
114
- ## 0.1.7
115
-
116
- ### Patch Changes
117
-
118
- - 995d950: Fix: merge :class and class (making :class obsolete)
119
- - Updated dependencies [c38f914]
120
- - Updated dependencies [995d950]
121
- - Updated dependencies [b716d5c]
122
- - Updated dependencies [014bda0]
123
- - @torpor/view@0.2.0
124
- - @torpor/unplugin@0.1.17
125
-
126
- ## 0.1.6
127
-
128
- ### Patch Changes
129
-
130
- - 586f073: Fix: set disabled properly
131
- - a14a74f: Refactor: remove <div style="display: contents">
132
- - Updated dependencies [1866f30]
133
- - Updated dependencies [a31647f]
134
- - Updated dependencies [951a86f]
135
- - Updated dependencies [6d6fb89]
136
- - Updated dependencies [9c13f0f]
137
- - @torpor/view@0.1.6
138
-
139
- ## 0.1.5
140
-
141
- ### Patch Changes
142
-
143
- - Updated dependencies [f390b78]
144
- - @torpor/view@0.1.5
145
- - @torpor/unplugin@0.1.16
146
-
147
- ## 0.1.4
148
-
149
- ### Patch Changes
150
-
151
- - Updated dependencies [daba2ad]
152
- - @torpor/view@0.1.4
153
- - @torpor/unplugin@0.1.15
154
-
155
- ## 0.1.3
156
-
157
- ### Patch Changes
158
-
159
- - Updated dependencies [de51225]
160
- - @torpor/view@0.1.3
161
- - @torpor/unplugin@0.1.14
162
-
163
- ## 0.1.2
164
-
165
- ### Patch Changes
166
-
167
- - Updated dependencies [0e69292]
168
- - Updated dependencies [b69fde1]
169
- - @torpor/view@0.1.2
170
- - @torpor/unplugin@0.1.13
171
-
172
- ## 0.1.1
173
-
174
- ### Patch Changes
175
-
176
- - 4e6a5aa: Break: rename PopoverContentStatic to PopoverContent
177
- - 2d7fae6: Fix: show the first tab content if no value set
178
- - a3a40f6: Fix: Popover issues
179
- - Updated dependencies [f9fd76d]
180
- - Updated dependencies [1ddc240]
181
- - Updated dependencies [7b9dc31]
182
- - @torpor/view@0.1.1
183
- - @torpor/unplugin@0.1.12
184
-
185
- ## 0.1.0
186
-
187
- ### Minor Changes
188
-
189
- - 995513a: Break: specify binding with `&` rather than `:`
190
-
191
- ### Patch Changes
192
-
193
- - cda6804: Fix: move itemStates out of $state
194
- - 80c5461: Feat: id and class props for the Accordion
195
- - cbd07ca: Feat: bind component props with `&name`
196
- - d4a7ecc: Feat: UI Popover component
197
- - b6bf066: Fix: set data-state (open/closed/active/inactive)
198
- - baec4c7: Feat: UI NavMenu component
199
- - 8545f43: Feat: UI Dialog component
200
- - 7cdeaa5: Feat: id and class props for the TabGroup
201
- - Updated dependencies [28a993b]
202
- - Updated dependencies [98602ec]
203
- - Updated dependencies [a49d307]
204
- - Updated dependencies [995513a]
205
- - Updated dependencies [c9a9cf8]
206
- - Updated dependencies [cbd07ca]
207
- - Updated dependencies [f53b184]
208
- - Updated dependencies [215db17]
209
- - Updated dependencies [95e866b]
210
- - @torpor/unplugin@0.1.11
211
- - @torpor/view@0.1.0
212
-
213
- ## 0.0.17
214
-
215
- ### Patch Changes
216
-
217
- - 819a7d8: Feat: UI TabGroup component
218
- - Updated dependencies [fb896c6]
219
- - Updated dependencies [85bccf6]
220
- - @torpor/view@0.0.14
221
- - @torpor/unplugin@0.1.10
222
-
223
- ## 0.0.16
224
-
225
- ### Patch Changes
226
-
227
- - Updated dependencies [ed4a6db]
228
- - @torpor/view@0.0.13
229
- - @torpor/unplugin@0.1.9
230
-
231
- ## 0.0.15
232
-
233
- ### Patch Changes
234
-
235
- - Updated dependencies [ff5f459]
236
- - @torpor/view@0.0.12
237
- - @torpor/unplugin@0.1.8
238
-
239
- ## 0.0.14
240
-
241
- ### Patch Changes
242
-
243
- - Updated dependencies [e4060e6]
244
- - @torpor/unplugin@0.1.7
245
-
246
- ## 0.0.13
247
-
248
- ### Patch Changes
249
-
250
- - Updated dependencies [5676a0b]
251
- - @torpor/unplugin@0.1.6
252
-
253
- ## 0.0.12
254
-
255
- ### Patch Changes
256
-
257
- - Updated dependencies [78e78b9]
258
- - @torpor/view@0.0.11
259
- - @torpor/unplugin@0.1.5
260
-
261
- ## 0.0.11
262
-
263
- ### Patch Changes
264
-
265
- - Updated dependencies [8852c89]
266
- - @torpor/unplugin@0.1.4
267
-
268
- ## 0.0.10
269
-
270
- ### Patch Changes
271
-
272
- - Updated dependencies [3cf6de6]
273
- - @torpor/view@0.0.10
274
- - @torpor/unplugin@0.1.3
275
-
276
- ## 0.0.9
277
-
278
- ### Patch Changes
279
-
280
- - 47c5277: Chore: update dependencies
281
- - Updated dependencies [47c5277]
282
- - @torpor/unplugin@0.1.2
283
- - @torpor/view@0.0.9
284
-
285
- ## 0.0.8
286
-
287
- ### Patch Changes
288
-
289
- - Updated dependencies [a8ead36]
290
- - @torpor/view@0.0.8
291
- - @torpor/unplugin@0.1.1
292
-
293
- ## 0.0.7
294
-
295
- ### Patch Changes
296
-
297
- - Updated dependencies
298
- - @torpor/unplugin@0.1.0
299
-
300
- ## 0.0.6
301
-
302
- ### Patch Changes
303
-
304
- - Updated dependencies [b90d729]
305
- - @torpor/view@0.0.7
306
- - @torpor/unplugin@0.0.6
307
-
308
- ## 0.0.5
309
-
310
- ### Patch Changes
311
-
312
- - Updated dependencies [808da4c]
313
- - @torpor/view@0.0.6
314
- - @torpor/unplugin@0.0.5
315
-
316
- ## 0.0.4
317
-
318
- ### Patch Changes
319
-
320
- - Updated dependencies [44cf656]
321
- - Updated dependencies [a278176]
322
- - @torpor/view@0.0.5
323
- - @torpor/unplugin@0.0.4
324
-
325
- ## 0.0.3
326
-
327
- ### Patch Changes
328
-
329
- - Updated dependencies [76dd6ea]
330
- - Updated dependencies [8f0a0a1]
331
- - @torpor/view@0.0.4
332
- - @torpor/unplugin@0.0.3
333
-
334
- ## 0.0.2
335
-
336
- ### Patch Changes
337
-
338
- - Updated dependencies
339
- - Updated dependencies
340
- - Updated dependencies
341
- - Updated dependencies
342
- - Updated dependencies
343
- - @torpor/view@0.0.3
344
- - @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
- }