@vielzeug/refine 1.5.4 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/dist/accordion.cjs +1 -1
  2. package/dist/accordion.cjs.map +1 -1
  3. package/dist/accordion.js +30 -28
  4. package/dist/accordion.js.map +1 -1
  5. package/dist/async.cjs +11 -11
  6. package/dist/async.cjs.map +1 -1
  7. package/dist/async.js +1 -2
  8. package/dist/async.js.map +1 -1
  9. package/dist/button-group.cjs.map +1 -1
  10. package/dist/button-group.js.map +1 -1
  11. package/dist/button.cjs +1 -1
  12. package/dist/button.cjs.map +1 -1
  13. package/dist/button.js +1 -0
  14. package/dist/button.js.map +1 -1
  15. package/dist/calendar.cjs +26 -26
  16. package/dist/calendar.cjs.map +1 -1
  17. package/dist/calendar.js +4 -5
  18. package/dist/calendar.js.map +1 -1
  19. package/dist/checkbox-group.cjs +9 -9
  20. package/dist/checkbox-group.cjs.map +1 -1
  21. package/dist/checkbox-group.js +50 -58
  22. package/dist/checkbox-group.js.map +1 -1
  23. package/dist/code-window.cjs +4 -4
  24. package/dist/code-window.cjs.map +1 -1
  25. package/dist/code-window.js +1 -2
  26. package/dist/code-window.js.map +1 -1
  27. package/dist/combobox.cjs +29 -28
  28. package/dist/combobox.cjs.map +1 -1
  29. package/dist/combobox.js +201 -195
  30. package/dist/combobox.js.map +1 -1
  31. package/dist/command-palette.cjs +6 -6
  32. package/dist/command-palette.cjs.map +1 -1
  33. package/dist/command-palette.js +46 -47
  34. package/dist/command-palette.js.map +1 -1
  35. package/dist/content/card/card.css.cjs +1 -1
  36. package/dist/content/card/card.css.cjs.map +1 -1
  37. package/dist/content/card/card.css.js +1 -1
  38. package/dist/content/card/card.css.js.map +1 -1
  39. package/dist/content/chat-message/chat-message.css.cjs +1 -1
  40. package/dist/content/chat-message/chat-message.css.cjs.map +1 -1
  41. package/dist/content/chat-message/chat-message.css.js +1 -1
  42. package/dist/content/chat-message/chat-message.css.js.map +1 -1
  43. package/dist/content/code-window/code-window.d.ts.map +1 -1
  44. package/dist/content/icon/icon.d.ts.map +1 -1
  45. package/dist/content/index.d.ts +4 -0
  46. package/dist/content/index.d.ts.map +1 -1
  47. package/dist/content/list/_list-item-reveal.cjs +2 -0
  48. package/dist/content/list/_list-item-reveal.cjs.map +1 -0
  49. package/dist/content/list/_list-item-reveal.d.ts +25 -0
  50. package/dist/content/list/_list-item-reveal.d.ts.map +1 -0
  51. package/dist/content/list/_list-item-reveal.js +33 -0
  52. package/dist/content/list/_list-item-reveal.js.map +1 -0
  53. package/dist/content/list/list-item.css.cjs +2 -0
  54. package/dist/content/list/list-item.css.cjs.map +1 -0
  55. package/dist/content/list/list-item.css.js +6 -0
  56. package/dist/content/list/list-item.css.js.map +1 -0
  57. package/dist/content/list/list-item.d.ts +111 -0
  58. package/dist/content/list/list-item.d.ts.map +1 -0
  59. package/dist/content/list/list.css.cjs +2 -0
  60. package/dist/content/list/list.css.cjs.map +1 -0
  61. package/dist/content/list/list.css.js +6 -0
  62. package/dist/content/list/list.css.js.map +1 -0
  63. package/dist/content/list/list.d.ts +93 -0
  64. package/dist/content/list/list.d.ts.map +1 -0
  65. package/dist/custom-elements.json +5693 -5090
  66. package/dist/datagrid.cjs +2 -2
  67. package/dist/datagrid.js +206 -206
  68. package/dist/datagrid.js.map +1 -1
  69. package/dist/date-picker.cjs +2 -1
  70. package/dist/date-picker.cjs.map +1 -1
  71. package/dist/date-picker.js +2 -0
  72. package/dist/date-picker.js.map +1 -1
  73. package/dist/disclosure/tab-item/tab-item.d.ts.map +1 -1
  74. package/dist/disclosure/tabs/tabs.d.ts.map +1 -1
  75. package/dist/drawer.cjs +1 -1
  76. package/dist/drawer.cjs.map +1 -1
  77. package/dist/drawer.js +47 -48
  78. package/dist/drawer.js.map +1 -1
  79. package/dist/feedback/async/async.d.ts.map +1 -1
  80. package/dist/feedback/progress/progress.d.ts.map +1 -1
  81. package/dist/file-input.cjs +108 -42
  82. package/dist/file-input.cjs.map +1 -1
  83. package/dist/file-input.js +215 -156
  84. package/dist/file-input.js.map +1 -1
  85. package/dist/headless/aria-reflection.cjs +2 -0
  86. package/dist/headless/aria-reflection.cjs.map +1 -0
  87. package/dist/headless/aria-reflection.d.ts +27 -0
  88. package/dist/headless/aria-reflection.d.ts.map +1 -0
  89. package/dist/headless/aria-reflection.js +18 -0
  90. package/dist/headless/aria-reflection.js.map +1 -0
  91. package/dist/headless/checkable.cjs +1 -1
  92. package/dist/headless/checkable.cjs.map +1 -1
  93. package/dist/headless/checkable.d.ts +2 -10
  94. package/dist/headless/checkable.d.ts.map +1 -1
  95. package/dist/headless/checkable.js +29 -29
  96. package/dist/headless/checkable.js.map +1 -1
  97. package/dist/headless/choice-field.cjs +1 -1
  98. package/dist/headless/choice-field.cjs.map +1 -1
  99. package/dist/headless/choice-field.d.ts +2 -7
  100. package/dist/headless/choice-field.d.ts.map +1 -1
  101. package/dist/headless/choice-field.js +37 -37
  102. package/dist/headless/choice-field.js.map +1 -1
  103. package/dist/headless/field-base.cjs +1 -1
  104. package/dist/headless/field-base.cjs.map +1 -1
  105. package/dist/headless/field-base.d.ts +17 -0
  106. package/dist/headless/field-base.d.ts.map +1 -1
  107. package/dist/headless/field-base.js +21 -6
  108. package/dist/headless/field-base.js.map +1 -1
  109. package/dist/headless/focus.cjs +1 -1
  110. package/dist/headless/focus.cjs.map +1 -1
  111. package/dist/headless/focus.d.ts +7 -0
  112. package/dist/headless/focus.d.ts.map +1 -1
  113. package/dist/headless/focus.js +6 -6
  114. package/dist/headless/focus.js.map +1 -1
  115. package/dist/headless/index.d.ts +4 -2
  116. package/dist/headless/index.d.ts.map +1 -1
  117. package/dist/headless/nav.cjs +1 -1
  118. package/dist/headless/nav.cjs.map +1 -1
  119. package/dist/headless/nav.d.ts +12 -0
  120. package/dist/headless/nav.d.ts.map +1 -1
  121. package/dist/headless/nav.js +68 -50
  122. package/dist/headless/nav.js.map +1 -1
  123. package/dist/headless/overlay.cjs +1 -1
  124. package/dist/headless/overlay.cjs.map +1 -1
  125. package/dist/headless/overlay.d.ts +2 -0
  126. package/dist/headless/overlay.d.ts.map +1 -1
  127. package/dist/headless/overlay.js +8 -5
  128. package/dist/headless/overlay.js.map +1 -1
  129. package/dist/headless/ref-callback.cjs +2 -0
  130. package/dist/headless/ref-callback.cjs.map +1 -0
  131. package/dist/headless/ref-callback.d.ts +26 -0
  132. package/dist/headless/ref-callback.d.ts.map +1 -0
  133. package/dist/headless/ref-callback.js +13 -0
  134. package/dist/headless/ref-callback.js.map +1 -0
  135. package/dist/headless/swipe.cjs +1 -1
  136. package/dist/headless/swipe.cjs.map +1 -1
  137. package/dist/headless/swipe.d.ts +2 -0
  138. package/dist/headless/swipe.d.ts.map +1 -1
  139. package/dist/headless/swipe.js +26 -21
  140. package/dist/headless/swipe.js.map +1 -1
  141. package/dist/headless.cjs +1 -1
  142. package/dist/headless.js +28 -26
  143. package/dist/icon.cjs +1 -1
  144. package/dist/icon.cjs.map +1 -1
  145. package/dist/icon.js +35 -38
  146. package/dist/icon.js.map +1 -1
  147. package/dist/index.cjs +1 -1
  148. package/dist/index.js +63 -61
  149. package/dist/input.cjs +29 -26
  150. package/dist/input.cjs.map +1 -1
  151. package/dist/input.js +91 -79
  152. package/dist/input.js.map +1 -1
  153. package/dist/inputs/button/button.css.cjs +1 -1
  154. package/dist/inputs/button/button.css.cjs.map +1 -1
  155. package/dist/inputs/button/button.css.js +1 -1
  156. package/dist/inputs/button/button.css.js.map +1 -1
  157. package/dist/inputs/button/button.d.ts +8 -0
  158. package/dist/inputs/button/button.d.ts.map +1 -1
  159. package/dist/inputs/calendar/calendar.d.ts.map +1 -1
  160. package/dist/inputs/checkbox/checkbox.css.cjs +1 -1
  161. package/dist/inputs/checkbox/checkbox.css.cjs.map +1 -1
  162. package/dist/inputs/checkbox/checkbox.css.js +1 -1
  163. package/dist/inputs/checkbox/checkbox.css.js.map +1 -1
  164. package/dist/inputs/combobox/combobox.d.ts +1 -0
  165. package/dist/inputs/combobox/combobox.d.ts.map +1 -1
  166. package/dist/inputs/date-picker/date-picker.css.cjs +1 -1
  167. package/dist/inputs/date-picker/date-picker.css.cjs.map +1 -1
  168. package/dist/inputs/date-picker/date-picker.css.js +1 -1
  169. package/dist/inputs/date-picker/date-picker.css.js.map +1 -1
  170. package/dist/inputs/date-picker/date-picker.d.ts +6 -0
  171. package/dist/inputs/date-picker/date-picker.d.ts.map +1 -1
  172. package/dist/inputs/file-input/file-input-upload.cjs +2 -0
  173. package/dist/inputs/file-input/file-input-upload.cjs.map +1 -0
  174. package/dist/inputs/file-input/file-input-upload.d.ts +76 -0
  175. package/dist/inputs/file-input/file-input-upload.d.ts.map +1 -0
  176. package/dist/inputs/file-input/file-input-upload.js +145 -0
  177. package/dist/inputs/file-input/file-input-upload.js.map +1 -0
  178. package/dist/inputs/file-input/file-input.css.cjs +1 -1
  179. package/dist/inputs/file-input/file-input.css.cjs.map +1 -1
  180. package/dist/inputs/file-input/file-input.css.js +1 -1
  181. package/dist/inputs/file-input/file-input.css.js.map +1 -1
  182. package/dist/inputs/file-input/file-input.d.ts +54 -1
  183. package/dist/inputs/file-input/file-input.d.ts.map +1 -1
  184. package/dist/inputs/input/input.css.cjs +1 -1
  185. package/dist/inputs/input/input.css.cjs.map +1 -1
  186. package/dist/inputs/input/input.css.js +1 -1
  187. package/dist/inputs/input/input.css.js.map +1 -1
  188. package/dist/inputs/input/input.d.ts +13 -0
  189. package/dist/inputs/input/input.d.ts.map +1 -1
  190. package/dist/inputs/message-composer/message-composer.css.cjs +1 -1
  191. package/dist/inputs/message-composer/message-composer.css.cjs.map +1 -1
  192. package/dist/inputs/message-composer/message-composer.css.js +1 -1
  193. package/dist/inputs/message-composer/message-composer.css.js.map +1 -1
  194. package/dist/inputs/message-composer/message-composer.d.ts +7 -0
  195. package/dist/inputs/message-composer/message-composer.d.ts.map +1 -1
  196. package/dist/inputs/number-input/number-input.css.cjs +1 -1
  197. package/dist/inputs/number-input/number-input.css.cjs.map +1 -1
  198. package/dist/inputs/number-input/number-input.css.js +1 -1
  199. package/dist/inputs/number-input/number-input.css.js.map +1 -1
  200. package/dist/inputs/number-input/number-input.d.ts +15 -0
  201. package/dist/inputs/number-input/number-input.d.ts.map +1 -1
  202. package/dist/inputs/otp-input/otp-input.css.cjs +1 -1
  203. package/dist/inputs/otp-input/otp-input.css.cjs.map +1 -1
  204. package/dist/inputs/otp-input/otp-input.css.js +1 -1
  205. package/dist/inputs/otp-input/otp-input.css.js.map +1 -1
  206. package/dist/inputs/radio/radio.d.ts.map +1 -1
  207. package/dist/inputs/select/select.d.ts +1 -0
  208. package/dist/inputs/select/select.d.ts.map +1 -1
  209. package/dist/inputs/shared/index.d.ts +1 -1
  210. package/dist/inputs/shared/index.d.ts.map +1 -1
  211. package/dist/inputs/shared/templates.cjs +26 -3
  212. package/dist/inputs/shared/templates.cjs.map +1 -1
  213. package/dist/inputs/shared/templates.d.ts +20 -0
  214. package/dist/inputs/shared/templates.d.ts.map +1 -1
  215. package/dist/inputs/shared/templates.js +29 -5
  216. package/dist/inputs/shared/templates.js.map +1 -1
  217. package/dist/inputs/switch/switch.css.cjs +1 -1
  218. package/dist/inputs/switch/switch.css.cjs.map +1 -1
  219. package/dist/inputs/switch/switch.css.js +1 -1
  220. package/dist/inputs/switch/switch.css.js.map +1 -1
  221. package/dist/inputs/switch/switch.d.ts.map +1 -1
  222. package/dist/inputs/textarea/textarea.css.cjs +1 -1
  223. package/dist/inputs/textarea/textarea.css.cjs.map +1 -1
  224. package/dist/inputs/textarea/textarea.css.js +1 -1
  225. package/dist/inputs/textarea/textarea.css.js.map +1 -1
  226. package/dist/inputs/textarea/textarea.d.ts +14 -0
  227. package/dist/inputs/textarea/textarea.d.ts.map +1 -1
  228. package/dist/inputs/time-picker/time-picker.css.cjs +1 -1
  229. package/dist/inputs/time-picker/time-picker.css.cjs.map +1 -1
  230. package/dist/inputs/time-picker/time-picker.css.js +1 -1
  231. package/dist/inputs/time-picker/time-picker.css.js.map +1 -1
  232. package/dist/inputs/time-picker/time-picker.d.ts +6 -0
  233. package/dist/inputs/time-picker/time-picker.d.ts.map +1 -1
  234. package/dist/list-item.cjs +22 -0
  235. package/dist/list-item.cjs.map +1 -0
  236. package/dist/list-item.js +91 -0
  237. package/dist/list-item.js.map +1 -0
  238. package/dist/list.cjs +2 -0
  239. package/dist/list.cjs.map +1 -0
  240. package/dist/list.js +64 -0
  241. package/dist/list.js.map +1 -0
  242. package/dist/menu.cjs +4 -4
  243. package/dist/menu.cjs.map +1 -1
  244. package/dist/menu.js +60 -59
  245. package/dist/menu.js.map +1 -1
  246. package/dist/message-composer.cjs +14 -20
  247. package/dist/message-composer.cjs.map +1 -1
  248. package/dist/message-composer.js +63 -64
  249. package/dist/message-composer.js.map +1 -1
  250. package/dist/number-input.cjs +5 -3
  251. package/dist/number-input.cjs.map +1 -1
  252. package/dist/number-input.js +8 -4
  253. package/dist/number-input.js.map +1 -1
  254. package/dist/otp-input.cjs +9 -9
  255. package/dist/otp-input.cjs.map +1 -1
  256. package/dist/otp-input.js +70 -62
  257. package/dist/otp-input.js.map +1 -1
  258. package/dist/overlay/menu/menu-item.css.cjs +1 -1
  259. package/dist/overlay/menu/menu-item.css.cjs.map +1 -1
  260. package/dist/overlay/menu/menu-item.css.js +1 -1
  261. package/dist/overlay/menu/menu-item.css.js.map +1 -1
  262. package/dist/overlay/menu/menu-separator.css.cjs +1 -1
  263. package/dist/overlay/menu/menu-separator.css.cjs.map +1 -1
  264. package/dist/overlay/menu/menu-separator.css.js +1 -1
  265. package/dist/overlay/menu/menu-separator.css.js.map +1 -1
  266. package/dist/overlay/menu/menu.css.cjs +1 -1
  267. package/dist/overlay/menu/menu.css.cjs.map +1 -1
  268. package/dist/overlay/menu/menu.css.js +1 -1
  269. package/dist/overlay/menu/menu.css.js.map +1 -1
  270. package/dist/overlay/shared/use-dialog.cjs +1 -1
  271. package/dist/overlay/shared/use-dialog.cjs.map +1 -1
  272. package/dist/overlay/shared/use-dialog.d.ts.map +1 -1
  273. package/dist/overlay/shared/use-dialog.js +7 -6
  274. package/dist/overlay/shared/use-dialog.js.map +1 -1
  275. package/dist/progress.cjs +13 -13
  276. package/dist/progress.cjs.map +1 -1
  277. package/dist/progress.js +3 -4
  278. package/dist/progress.js.map +1 -1
  279. package/dist/radio-group.cjs +11 -11
  280. package/dist/radio-group.cjs.map +1 -1
  281. package/dist/radio-group.js +63 -70
  282. package/dist/radio-group.js.map +1 -1
  283. package/dist/radio.cjs +4 -4
  284. package/dist/radio.cjs.map +1 -1
  285. package/dist/radio.js +58 -58
  286. package/dist/radio.js.map +1 -1
  287. package/dist/rating.cjs.map +1 -1
  288. package/dist/rating.js.map +1 -1
  289. package/dist/refine.cjs +502 -309
  290. package/dist/refine.cjs.map +1 -1
  291. package/dist/refine.iife.js +562 -369
  292. package/dist/refine.iife.js.map +1 -1
  293. package/dist/refine.js +558 -365
  294. package/dist/refine.js.map +1 -1
  295. package/dist/select.cjs +21 -21
  296. package/dist/select.cjs.map +1 -1
  297. package/dist/select.js +135 -127
  298. package/dist/select.js.map +1 -1
  299. package/dist/shared/size-presets.cjs +1 -1
  300. package/dist/shared/size-presets.cjs.map +1 -1
  301. package/dist/shared/size-presets.d.ts +74 -0
  302. package/dist/shared/size-presets.d.ts.map +1 -1
  303. package/dist/shared/size-presets.js +48 -1
  304. package/dist/shared/size-presets.js.map +1 -1
  305. package/dist/shared/types.d.ts +5 -0
  306. package/dist/shared/types.d.ts.map +1 -1
  307. package/dist/styles/index.cjs +1 -1
  308. package/dist/styles/index.cjs.map +1 -1
  309. package/dist/styles/index.d.ts +1 -0
  310. package/dist/styles/index.d.ts.map +1 -1
  311. package/dist/styles/index.js +5 -4
  312. package/dist/styles/index.js.map +1 -1
  313. package/dist/styles/mixins/field-variants.css.cjs +85 -0
  314. package/dist/styles/mixins/field-variants.css.cjs.map +1 -0
  315. package/dist/styles/mixins/field-variants.css.d.ts +66 -0
  316. package/dist/styles/mixins/field-variants.css.d.ts.map +1 -0
  317. package/dist/styles/mixins/field-variants.css.js +90 -0
  318. package/dist/styles/mixins/field-variants.css.js.map +1 -0
  319. package/dist/switch.cjs +3 -3
  320. package/dist/switch.cjs.map +1 -1
  321. package/dist/switch.js +38 -36
  322. package/dist/switch.js.map +1 -1
  323. package/dist/tab-item.cjs +8 -8
  324. package/dist/tab-item.cjs.map +1 -1
  325. package/dist/tab-item.js +38 -28
  326. package/dist/tab-item.js.map +1 -1
  327. package/dist/tab-panel.cjs +7 -7
  328. package/dist/tab-panel.cjs.map +1 -1
  329. package/dist/tab-panel.js +33 -26
  330. package/dist/tab-panel.js.map +1 -1
  331. package/dist/tabs.cjs +4 -4
  332. package/dist/tabs.cjs.map +1 -1
  333. package/dist/tabs.js +64 -60
  334. package/dist/tabs.js.map +1 -1
  335. package/dist/testing/index.d.ts +15 -60
  336. package/dist/testing/index.d.ts.map +1 -1
  337. package/dist/testing.cjs +1 -1
  338. package/dist/testing.cjs.map +1 -1
  339. package/dist/testing.js +7 -24
  340. package/dist/testing.js.map +1 -1
  341. package/dist/textarea.cjs +15 -18
  342. package/dist/textarea.cjs.map +1 -1
  343. package/dist/textarea.js +83 -74
  344. package/dist/textarea.js.map +1 -1
  345. package/dist/time-picker.cjs +34 -31
  346. package/dist/time-picker.cjs.map +1 -1
  347. package/dist/time-picker.js +121 -109
  348. package/dist/time-picker.js.map +1 -1
  349. package/package.json +22 -9
  350. package/dist/headless/dialog-focus.cjs +0 -2
  351. package/dist/headless/dialog-focus.cjs.map +0 -1
  352. package/dist/headless/dialog-focus.d.ts +0 -40
  353. package/dist/headless/dialog-focus.d.ts.map +0 -1
  354. package/dist/headless/dialog-focus.js +0 -22
  355. package/dist/headless/dialog-focus.js.map +0 -1
  356. package/dist/headless/focus-trap.cjs +0 -2
  357. package/dist/headless/focus-trap.cjs.map +0 -1
  358. package/dist/headless/focus-trap.d.ts +0 -45
  359. package/dist/headless/focus-trap.d.ts.map +0 -1
  360. package/dist/headless/focus-trap.js +0 -51
  361. package/dist/headless/focus-trap.js.map +0 -1
  362. package/dist/keymap/dist/_dev.cjs +0 -2
  363. package/dist/keymap/dist/_dev.cjs.map +0 -1
  364. package/dist/keymap/dist/_dev.js +0 -4
  365. package/dist/keymap/dist/_dev.js.map +0 -1
  366. package/dist/keymap/dist/format.cjs +0 -1
  367. package/dist/keymap/dist/format.js +0 -1
  368. package/dist/keymap/dist/index.cjs +0 -1
  369. package/dist/keymap/dist/index.js +0 -4
  370. package/dist/keymap/dist/keymap.cjs +0 -2
  371. package/dist/keymap/dist/keymap.cjs.map +0 -1
  372. package/dist/keymap/dist/keymap.js +0 -221
  373. package/dist/keymap/dist/keymap.js.map +0 -1
  374. package/dist/keymap/dist/layer.cjs +0 -1
  375. package/dist/keymap/dist/layer.js +0 -1
package/dist/tabs.cjs CHANGED
@@ -1,17 +1,17 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/theme.css.cjs"),t=require("./shared/prop-bundles.cjs"),n=require("./headless/keyboard.cjs"),r=require("./headless/nav.cjs"),i=require("./disclosure/tabs/tabs.css.cjs");let a=require("@vielzeug/ore"),o=require("@vielzeug/ripple");var s=(0,a.createContext)(`TabsContext`),c=`ore-tabs`;(0,a.define)(c,{props:{...t.themableBundle,...t.sizableBundle,activation:a.prop.oneOf([`auto`,`manual`],`auto`),label:a.prop.string(),orientation:a.prop.oneOf([`horizontal`,`vertical`],`horizontal`),value:a.prop.string(),variant:a.prop.string()},setup(e){let t=(0,a.getHost)(),i=(0,a.useEmit)(),c=t.shadowRoot,l=(0,a.ref)(),u=(0,a.ref)(),d=(0,o.signal)(e.value.value),f=()=>e.activation.value===`manual`,p=()=>e.orientation.value===`vertical`;(0,a.bind)({attr:{value:()=>d.value??null}});let m=()=>[...t.querySelectorAll(`:scope > ore-tab-item[slot="tabs"]`)],h=()=>m().filter(e=>!e.hasAttribute(`disabled`)),g=e=>{e&&(e.shadowRoot?.querySelector(`[role="tab"]`)??e).focus()},_=(e,t=!1)=>{d.value=e,t&&e&&i(`change`,{value:e})},v=()=>{let e=m();if(e.length===0)return;let t=d.value;if(t&&e.some(e=>e.getAttribute(`value`)===t&&!e.hasAttribute(`disabled`)))return;let n=e.find(e=>!e.hasAttribute(`disabled`))?.getAttribute(`value`)??void 0;_(n,!1)};(0,o.watch)(e.value,e=>{d.value=e,v()});let y=r.createListControl({getItems:()=>h(),loop:!0,onNavigate:(e,t)=>{let n=h()[t];if(g(n),!f()){let e=n?.getAttribute(`value`);e&&_(e,!0)}},orientation:()=>p()?`vertical`:`both`});(0,a.provide)(s,{color:e.color,orientation:(0,o.computed)(()=>e.orientation.value??`horizontal`),size:e.size,value:d,variant:e.variant});let b=e=>{let t=u.value,n=l.value;if(!t||!n||!e)return;let r=e.getBoundingClientRect(),i=n.getBoundingClientRect();if(p()){let e=r.top-i.top+n.scrollTop;t.style.transition=`none`,t.style.height=`${r.height}px`,t.style.width=``,t.style.left=`0`,t.style.top=`0`,t.offsetWidth,t.style.transition=``,t.style.transform=`translateY(${e}px)`}else{let e=r.left-i.left+n.scrollLeft;t.style.transition=`none`,t.style.width=`${r.width}px`,t.style.height=``,t.style.top=``,t.style.left=`0`,t.offsetWidth,t.style.transition=``,t.style.transform=`translateX(${e}px)`}},x=()=>{let e=d.value;if(!e)return;let t=m().find(t=>t.getAttribute(`value`)===e);b(t)};(0,o.watch)(d,()=>{requestAnimationFrame(x)});let S=e=>{let n=e.composedPath().find(e=>e instanceof HTMLElement&&e.localName===`ore-tab-item`);if(!n||n.hasAttribute(`disabled`)||n.closest(`ore-tabs`)!==t)return;let r=n.getAttribute(`value`);!r||r===d.value||_(r,!0)},C=n.createInteraction({disabled:(0,o.computed)(()=>!f()),onPress:()=>{let e=h().find(e=>e===document.activeElement||e.shadowRoot?.activeElement===document.activeElement)?.getAttribute(`value`);e&&e!==d.value&&_(e,!0)}});return(0,a.bind)({on:{click:S,keydown:e=>{let t=h();if(t.length===0)return;let n=e.composedPath().find(e=>e instanceof HTMLElement&&e.localName===`ore-tab-item`)??t.find(e=>e.getAttribute(`value`)===d.value),r=n?t.indexOf(n):-1;r>=0&&y.set(r),!y.handleKeydown(e)&&C.handleKeydown(e)}}}),(0,a.onMounted)(()=>{let e=()=>{v(),x()},t=c?.querySelector(`slot[name="tabs"]`);return t&&t.addEventListener(`slotchange`,e),e(),requestAnimationFrame(e),()=>{t&&t.removeEventListener(`slotchange`,e)}}),a.html`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/theme.css.cjs"),t=require("./shared/prop-bundles.cjs"),n=require("./headless/ore.cjs"),r=require("./headless/keyboard.cjs"),i=require("./headless/nav.cjs"),a=require("./headless/direction.cjs"),o=require("./disclosure/tabs/tabs.css.cjs");let s=require("@vielzeug/ore"),c=require("@vielzeug/ripple");var l=(0,s.createContext)(`TabsContext`),u=`ore-tabs`;(0,s.define)(u,{props:{...t.themableBundle,...t.sizableBundle,activation:s.prop.oneOf([`auto`,`manual`],`auto`),label:s.prop.string(),orientation:s.prop.oneOf([`horizontal`,`vertical`],`horizontal`),value:s.prop.string(),variant:s.prop.string()},setup(e){let t=(0,s.getHost)(),o=(0,s.useEmit)(),u=t.shadowRoot,d=(0,s.ref)(),f=(0,s.ref)(),p=(0,c.signal)(e.value.value),m=()=>e.activation.value===`manual`,h=()=>e.orientation.value===`vertical`;(0,s.bind)({attr:{value:()=>p.value??null}});let g=()=>[...t.querySelectorAll(`:scope > ore-tab-item[slot="tabs"]`)],_=()=>g().filter(e=>!e.hasAttribute(`disabled`)),v=e=>{e&&(e.shadowRoot?.querySelector(`[role="tab"]`)??e).focus()},y=(e,t=!1)=>{p.value=e,t&&e&&o(`change`,{value:e})},b=()=>{let e=g();if(e.length===0)return;let t=p.value;if(t&&e.some(e=>e.getAttribute(`value`)===t&&!e.hasAttribute(`disabled`)))return;let n=e.find(e=>!e.hasAttribute(`disabled`))?.getAttribute(`value`)??void 0;y(n,!1)};(0,c.watch)(e.value,e=>{p.value=e,b()});let x=i.createListControl({direction:()=>a.elementDirection(t),getItems:()=>_(),loop:!0,onNavigate:(e,t)=>{let n=_()[t];if(v(n),!m()){let e=n?.getAttribute(`value`);e&&y(e,!0)}},orientation:()=>h()?`vertical`:`both`,signal:n.lifecycleSignal(s.onCleanup)});(0,s.provide)(l,{color:e.color,orientation:(0,c.computed)(()=>e.orientation.value??`horizontal`),size:e.size,value:p,variant:e.variant});let S=e=>{let t=f.value,n=d.value;if(!t||!n||!e)return;let r=e.getBoundingClientRect(),i=n.getBoundingClientRect();if(h()){let e=r.top-i.top+n.scrollTop;t.style.transition=`none`,t.style.height=`${r.height}px`,t.style.width=``,t.style.left=`0`,t.style.top=`0`,t.offsetWidth,t.style.transition=``,t.style.transform=`translateY(${e}px)`}else{let e=r.left-i.left+n.scrollLeft;t.style.transition=`none`,t.style.width=`${r.width}px`,t.style.height=``,t.style.top=``,t.style.left=`0`,t.offsetWidth,t.style.transition=``,t.style.transform=`translateX(${e}px)`}},C=()=>{let e=p.value;if(!e)return;let t=g().find(t=>t.getAttribute(`value`)===e);S(t)};(0,c.watch)(p,()=>{requestAnimationFrame(C)});let w=e=>{let n=e.composedPath().find(e=>e instanceof HTMLElement&&e.localName===`ore-tab-item`);if(!n||n.hasAttribute(`disabled`)||n.closest(`ore-tabs`)!==t)return;let r=n.getAttribute(`value`);!r||r===p.value||y(r,!0)},T=r.createInteraction({disabled:(0,c.computed)(()=>!m()),onPress:()=>{let e=_().find(e=>e===document.activeElement||e.shadowRoot?.activeElement===document.activeElement)?.getAttribute(`value`);e&&e!==p.value&&y(e,!0)}});return(0,s.bind)({on:{click:w,keydown:e=>{let t=_();if(t.length===0)return;let n=e.composedPath().find(e=>e instanceof HTMLElement&&e.localName===`ore-tab-item`)??t.find(e=>e.getAttribute(`value`)===p.value),r=n?t.indexOf(n):-1;r>=0&&x.set(r),!x.handleKeydown(e)&&T.handleKeydown(e)}}}),(0,s.onMounted)(()=>{let e=()=>{b(),C()},t=u?.querySelector(`slot[name="tabs"]`);return t&&t.addEventListener(`slotchange`,e),e(),requestAnimationFrame(e),()=>{t&&t.removeEventListener(`slotchange`,e)}}),s.html`
2
2
  <div class="tablist-wrapper">
3
3
  <div
4
4
  role="tablist"
5
- ref="${l}"
5
+ ref="${d}"
6
6
  part="tablist"
7
7
  aria-orientation="${e.orientation}"
8
8
  aria-label="${e.label}">
9
9
  <slot name="tabs"></slot>
10
10
  </div>
11
- <div class="indicator" ref="${u}" part="indicator"></div>
11
+ <div class="indicator" ref="${f}" part="indicator"></div>
12
12
  </div>
13
13
  <div class="panels" part="panels">
14
14
  <slot></slot>
15
15
  </div>
16
- `},styles:[e.colorThemeMixin,i.default]}),exports.TABS_CTX=s,exports.TABS_TAG=c;
16
+ `},styles:[e.colorThemeMixin,o.default]}),exports.TABS_CTX=l,exports.TABS_TAG=u;
17
17
  //# sourceMappingURL=tabs.cjs.map
package/dist/tabs.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.cjs","names":[],"sources":["../src/disclosure/tabs/tabs.ts"],"sourcesContent":["import { createContext, define, html, prop, ref, bind, getHost, onMounted, provide, useEmit } from '@vielzeug/ore';\nimport { computed, type Readable, signal, watch } from '@vielzeug/ripple';\n\nimport type { ComponentSize, SurfaceVariant, ThemeColor } from '../../types';\n\nimport { createInteraction, createListControl } from '../../headless';\nimport { sizableBundle, themableBundle } from '../../shared';\nimport { colorThemeMixin } from '../../styles';\nimport styles from './tabs.css?inline';\n\n/** Context provided by ore-tabs to its ore-tab-item and ore-tab-panel children. */\nexport type TabsContext = {\n color: Readable<ThemeColor | undefined>;\n orientation: Readable<'horizontal' | 'vertical'>;\n size: Readable<ComponentSize | undefined>;\n value: Readable<string | undefined>;\n variant: Readable<SurfaceVariant | undefined>;\n};\n/** Injection key for the tabs context. */\nexport const TABS_CTX = createContext<TabsContext>('TabsContext');\n\nexport type OreTabsEvents = {\n change: { value: string };\n};\n\nexport type OreTabsProps = {\n /**\n * Keyboard activation mode.\n * - `'auto'` (default): Selecting a tab on arrow-key focus immediately activates it (ARIA recommendation for most cases).\n * - `'manual'`: Arrow keys only move focus; the user must press Enter or Space to activate the focused tab.\n */\n activation?: 'auto' | 'manual';\n /** Theme color */\n color?: ThemeColor;\n /** Accessible label for the tablist (passed as aria-label). Use when there is no visible heading labelling the tabs. */\n label?: string;\n /** Tab list orientation */\n orientation?: 'horizontal' | 'vertical';\n /** Component size */\n size?: ComponentSize;\n /** Currently selected tab value */\n value?: string;\n /** Visual style variant */\n variant?: SurfaceVariant;\n};\n\n/**\n * Tabs container. Manages tab selection and syncs state to child tab items and panels.\n *\n * @element ore-tabs\n * @element ore-tab-item - Child element for tab buttons (auto-discovered)\n * @element ore-tab-panel - Child element for tab content (auto-discovered)\n *\n * @attr {string} value - The value of the currently selected tab\n * @attr {string} variant - Visual variant: 'solid' | 'flat' | 'bordered' | 'ghost' | 'glass' | 'frost'\n * @attr {string} size - Size: 'sm' | 'md' | 'lg'\n * @attr {string} color - Theme color: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'\n *\n * @fires change - Emitted when the active tab changes with detail: { value: string }\n *\n * @slot tabs - Place `ore-tab-item` elements here\n * @slot - Place `ore-tab-panel` elements here\n *\n * @cssprop --tabs-radius - Border radius of the tablist container and panels\n * @cssprop --tabs-transition - Transition duration/easing for the active indicator\n * @cssprop --tabs-indicator-color - Color of the sliding active indicator line\n * @cssprop --tabs-bg - Background of the host element (flat variant)\n * @cssprop --tabs-tablist-bg - Tablist container background (solid/glass/frost variants)\n * @cssprop --tabs-tablist-border-color - Tablist container border color\n * @part tablist - Container that holds the slotted tab items\n * @part indicator - Active tab indicator element\n * @part panels - Container that holds tab panel content\n * @example\n * ```html\n * <ore-tabs value=\"tab1\" variant=\"bordered\">\n * <ore-tab-item slot=\"tabs\" value=\"tab1\">Overview</ore-tab-item>\n * <ore-tab-item slot=\"tabs\" value=\"tab2\">Settings</ore-tab-item>\n * <ore-tab-panel value=\"tab1\"><p>Overview content</p></ore-tab-panel>\n * <ore-tab-panel value=\"tab2\"><p>Settings content</p></ore-tab-panel>\n * </ore-tabs>\n * ```\n */\nexport const TABS_TAG = 'ore-tabs' as const;\ndefine<OreTabsProps>(TABS_TAG, {\n props: {\n ...themableBundle,\n ...sizableBundle,\n activation: prop.oneOf(['auto', 'manual'] as const, 'auto'),\n label: prop.string(),\n orientation: prop.oneOf(['horizontal', 'vertical'] as const, 'horizontal'),\n value: prop.string(),\n variant: prop.string<SurfaceVariant>(),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreTabsEvents>();\n\n const shadowRoot = el.shadowRoot;\n const tablistRef = ref<HTMLElement>();\n const indicatorRef = ref<HTMLElement>();\n const selectedValue = signal<string | undefined>(props.value.value);\n const isManualActivation = () => props.activation.value === 'manual';\n const isVertical = () => props.orientation.value === 'vertical';\n\n bind({\n attr: {\n value: () => selectedValue.value ?? null,\n },\n });\n\n const getTabs = () => [...el.querySelectorAll<HTMLElement>(':scope > ore-tab-item[slot=\"tabs\"]')];\n const getEnabledTabs = () => getTabs().filter((t) => !t.hasAttribute('disabled'));\n const focusTab = (tab: HTMLElement | undefined) => {\n if (!tab) return;\n\n const focusable = tab.shadowRoot?.querySelector<HTMLElement>('[role=\"tab\"]') ?? tab;\n\n focusable.focus();\n };\n\n // ────────────────────────────────────────────────────────────────\n // Selection State Management\n // ────────────────────────────────────────────────────────────────\n\n const setSelection = (value: string | undefined, shouldEmit = false) => {\n selectedValue.value = value;\n\n if (shouldEmit && value) emit('change', { value });\n };\n\n const ensureSelection = () => {\n const tabs = getTabs();\n\n if (tabs.length === 0) return; // No tabs yet, keep current selection\n\n const current = selectedValue.value;\n const hasCurrent = current\n ? tabs.some((tab) => tab.getAttribute('value') === current && !tab.hasAttribute('disabled'))\n : false;\n\n if (hasCurrent) return;\n\n const firstEnabled = tabs.find((tab) => !tab.hasAttribute('disabled'))?.getAttribute('value') ?? undefined;\n\n setSelection(firstEnabled, false);\n };\n\n watch(props.value, (value) => {\n selectedValue.value = value;\n ensureSelection();\n });\n\n // ────────────────────────────────────────────────────────────────\n // List Control for Keyboard Navigation\n // ────────────────────────────────────────────────────────────────\n\n const listControl = createListControl({\n getItems: () => getEnabledTabs(),\n loop: true,\n onNavigate: (_action, index) => {\n const tabs = getEnabledTabs();\n const nextTab = tabs[index];\n\n focusTab(nextTab);\n\n if (!isManualActivation()) {\n const value = nextTab?.getAttribute('value');\n\n if (value) setSelection(value, true);\n }\n },\n orientation: () => (isVertical() ? 'vertical' : 'both'),\n });\n\n // ────────────────────────────────────────────────────────────────\n // Context & Indicator Management\n // ────────────────────────────────────────────────────────────────\n\n provide(TABS_CTX, {\n color: props.color,\n orientation: computed(() => props.orientation.value ?? 'horizontal'),\n size: props.size,\n value: selectedValue,\n variant: props.variant,\n });\n\n const moveIndicator = (activeTab: HTMLElement | undefined) => {\n const indicator = indicatorRef.value;\n const tablist = tablistRef.value;\n\n if (!indicator || !tablist || !activeTab) return;\n\n const tabRect = activeTab.getBoundingClientRect();\n const listRect = tablist.getBoundingClientRect();\n\n if (isVertical()) {\n const y = tabRect.top - listRect.top + tablist.scrollTop;\n\n indicator.style.transition = 'none';\n indicator.style.height = `${tabRect.height}px`;\n indicator.style.width = '';\n indicator.style.left = '0';\n indicator.style.top = '0';\n void indicator.offsetWidth;\n indicator.style.transition = '';\n indicator.style.transform = `translateY(${y}px)`;\n } else {\n const x = tabRect.left - listRect.left + tablist.scrollLeft;\n\n indicator.style.transition = 'none';\n indicator.style.width = `${tabRect.width}px`;\n indicator.style.height = '';\n indicator.style.top = '';\n indicator.style.left = '0';\n void indicator.offsetWidth;\n indicator.style.transition = '';\n indicator.style.transform = `translateX(${x}px)`;\n }\n };\n\n const updateIndicator = () => {\n const value = selectedValue.value;\n\n if (!value) return;\n\n const activeTab = getTabs().find((t) => t.getAttribute('value') === value);\n\n moveIndicator(activeTab);\n };\n\n watch(selectedValue, () => {\n requestAnimationFrame(updateIndicator);\n });\n\n // ────────────────────────────────────────────────────────────────\n // Event Handlers\n // ────────────────────────────────────────────────────────────────\n\n const handleTabClick = (e: Event) => {\n const tab = e\n .composedPath()\n .find((node): node is HTMLElement => node instanceof HTMLElement && node.localName === 'ore-tab-item');\n\n if (!tab || tab.hasAttribute('disabled')) return;\n\n // Guard: only respond to tab-items that belong to THIS tabs instance\n if (tab.closest('ore-tabs') !== el) return;\n\n const value = tab.getAttribute('value');\n\n if (!value || value === selectedValue.value) return;\n\n setSelection(value, true);\n };\n\n const activateFocusedTab = (): void => {\n const tabs = getEnabledTabs();\n const focusedTab = tabs.find(\n (tab) => tab === document.activeElement || tab.shadowRoot?.activeElement === document.activeElement,\n );\n const focusedValue = focusedTab?.getAttribute('value');\n\n if (focusedValue && focusedValue !== selectedValue.value) setSelection(focusedValue, true);\n };\n\n const manualActivationPress = createInteraction({\n disabled: computed(() => !isManualActivation()),\n onPress: activateFocusedTab,\n });\n\n const handleKeydown = (e: KeyboardEvent) => {\n const tabs = getEnabledTabs();\n\n if (tabs.length === 0) return;\n\n const path = e.composedPath();\n const activeTabFromEvent = path.find(\n (node): node is HTMLElement => node instanceof HTMLElement && node.localName === 'ore-tab-item',\n );\n\n const tabFromEvent = activeTabFromEvent ?? tabs.find((t) => t.getAttribute('value') === selectedValue.value);\n const focused = tabFromEvent ? tabs.indexOf(tabFromEvent) : -1;\n\n if (focused >= 0) listControl.set(focused);\n\n if (listControl.handleKeydown(e)) return;\n\n manualActivationPress.handleKeydown(e);\n };\n\n bind({\n on: {\n click: handleTabClick,\n keydown: handleKeydown,\n },\n });\n\n // ────────────────────────────────────────────────────────────────\n // Lifecycle\n // ────────────────────────────────────────────────────────────────\n\n onMounted(() => {\n const syncSelection = () => {\n ensureSelection();\n updateIndicator();\n };\n\n const tabsSlot = shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"tabs\"]');\n\n if (tabsSlot) {\n tabsSlot.addEventListener('slotchange', syncSelection);\n }\n\n syncSelection();\n requestAnimationFrame(syncSelection);\n\n return () => {\n if (tabsSlot) {\n tabsSlot.removeEventListener('slotchange', syncSelection);\n }\n };\n });\n\n return html`\n <div class=\"tablist-wrapper\">\n <div\n role=\"tablist\"\n ref=\"${tablistRef}\"\n part=\"tablist\"\n aria-orientation=\"${props.orientation}\"\n aria-label=\"${props.label}\">\n <slot name=\"tabs\"></slot>\n </div>\n <div class=\"indicator\" ref=\"${indicatorRef}\" part=\"indicator\"></div>\n </div>\n <div class=\"panels\" part=\"panels\">\n <slot></slot>\n </div>\n `;\n },\n styles: [colorThemeMixin, styles],\n});\n"],"mappings":"yUAmBA,IAAa,GAAA,EAAA,EAAA,cAAA,CAAsC,aAAa,EA+DnD,EAAW,wBACH,EAAU,CAC7B,MAAO,CACL,GAAG,EAAA,eACH,GAAG,EAAA,cACH,WAAY,EAAA,KAAK,MAAM,CAAC,OAAQ,QAAQ,EAAY,MAAM,EAC1D,MAAO,EAAA,KAAK,OAAO,EACnB,YAAa,EAAA,KAAK,MAAM,CAAC,aAAc,UAAU,EAAY,YAAY,EACzE,MAAO,EAAA,KAAK,OAAO,EACnB,QAAS,EAAA,KAAK,OAAuB,CACvC,EACA,MAAM,EAAO,CACX,IAAM,GAAA,EAAA,EAAA,QAAA,CAAa,EACb,GAAA,EAAA,EAAA,QAAA,CAA8B,EAE9B,EAAa,EAAG,WAChB,GAAA,EAAA,EAAA,IAAA,CAA8B,EAC9B,GAAA,EAAA,EAAA,IAAA,CAAgC,EAChC,GAAA,EAAA,EAAA,OAAA,CAA2C,EAAM,MAAM,KAAK,EAC5D,MAA2B,EAAM,WAAW,QAAU,SACtD,MAAmB,EAAM,YAAY,QAAU,YAErD,EAAA,EAAA,KAAA,CAAK,CACH,KAAM,CACJ,UAAa,EAAc,OAAS,IACtC,CACF,CAAC,EAED,IAAM,MAAgB,CAAC,GAAG,EAAG,iBAA8B,oCAAoC,CAAC,EAC1F,MAAuB,EAAQ,CAAC,CAAC,OAAQ,GAAM,CAAC,EAAE,aAAa,UAAU,CAAC,EAC1E,EAAY,GAA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EAC9C,YAZqC,CAKrC,IAAM,EAJO,EACM,CAAA,CAAK,KACrB,GAAQ,IAAQ,SAAS,eAAiB,EAAI,YAAY,gBAAkB,SAAS,aAEnE,CAAA,EAAY,aAAa,OAAO,EAEjD,GAAgB,IAAiB,EAAc,OAAO,EAAa,EAAc,EAAI,CAC3F,CAKA,CAAC,EAuDD,OAjCA,EAAA,EAAA,KAAA,CAAK,CACH,GAAI,CACF,MAAO,EACP,QAvBmB,GAAqB,CAC1C,IAAM,EAAO,EAAe,EAE5B,GAAI,EAAK,SAAW,EAAG,OAOvB,IAAM,EALO,EAAE,aACY,CAAA,CAAK,KAC7B,GAA8B,aAAgB,aAAe,EAAK,YAAc,cAG9D,GAAsB,EAAK,KAAM,GAAM,EAAE,aAAa,OAAO,IAAM,EAAc,KAAK,EACrG,EAAU,EAAe,EAAK,QAAQ,CAAY,EAAI,GAExD,GAAW,GAAG,EAAY,IAAI,CAAO,EAErC,GAAY,cAAc,CAAC,GAE/B,EAAsB,cAAc,CAAC,CACvC,CAME,CACF,CAAC,GAMD,EAAA,EAAA,UAAA,KAAgB,CACd,IAAM,MAAsB,CAC1B,EAAgB,EAChB,EAAgB,CAClB,EAEM,EAAW,GAAY,cAA+B,mBAAmB,EAS/E,OAPI,GACF,EAAS,iBAAiB,aAAc,CAAa,EAGvD,EAAc,EACd,sBAAsB,CAAa,MAEtB,CACP,GACF,EAAS,oBAAoB,aAAc,CAAa,CAE5D,CACF,CAAC,EAEM,EAAA,IAAI;;;;iBAIE,EAAW;;8BAEE,EAAM,YAAY;wBACxB,EAAM,MAAM;;;sCAGE,EAAa;;;;;KAMjD,EACA,OAAQ,CAAC,EAAA,gBAAiB,EAAA,OAAM,CAClC,CAAC"}
1
+ {"version":3,"file":"tabs.cjs","names":[],"sources":["../src/disclosure/tabs/tabs.ts"],"sourcesContent":["import {\n createContext,\n define,\n html,\n prop,\n ref,\n bind,\n getHost,\n onCleanup,\n onMounted,\n provide,\n useEmit,\n} from '@vielzeug/ore';\nimport { computed, type Readable, signal, watch } from '@vielzeug/ripple';\n\nimport type { ComponentSize, SurfaceVariant, ThemeColor } from '../../types';\n\nimport { createInteraction, createListControl, elementDirection, lifecycleSignal } from '../../headless';\nimport { sizableBundle, themableBundle } from '../../shared';\nimport { colorThemeMixin } from '../../styles';\nimport styles from './tabs.css?inline';\n\n/** Context provided by ore-tabs to its ore-tab-item and ore-tab-panel children. */\nexport type TabsContext = {\n color: Readable<ThemeColor | undefined>;\n orientation: Readable<'horizontal' | 'vertical'>;\n size: Readable<ComponentSize | undefined>;\n value: Readable<string | undefined>;\n variant: Readable<SurfaceVariant | undefined>;\n};\n/** Injection key for the tabs context. */\nexport const TABS_CTX = createContext<TabsContext>('TabsContext');\n\nexport type OreTabsEvents = {\n change: { value: string };\n};\n\nexport type OreTabsProps = {\n /**\n * Keyboard activation mode.\n * - `'auto'` (default): Selecting a tab on arrow-key focus immediately activates it (ARIA recommendation for most cases).\n * - `'manual'`: Arrow keys only move focus; the user must press Enter or Space to activate the focused tab.\n */\n activation?: 'auto' | 'manual';\n /** Theme color */\n color?: ThemeColor;\n /** Accessible label for the tablist (passed as aria-label). Use when there is no visible heading labelling the tabs. */\n label?: string;\n /** Tab list orientation */\n orientation?: 'horizontal' | 'vertical';\n /** Component size */\n size?: ComponentSize;\n /** Currently selected tab value */\n value?: string;\n /** Visual style variant */\n variant?: SurfaceVariant;\n};\n\n/**\n * Tabs container. Manages tab selection and syncs state to child tab items and panels.\n *\n * @element ore-tabs\n * @element ore-tab-item - Child element for tab buttons (auto-discovered)\n * @element ore-tab-panel - Child element for tab content (auto-discovered)\n *\n * @attr {string} value - The value of the currently selected tab\n * @attr {string} variant - Visual variant: 'solid' | 'flat' | 'bordered' | 'ghost' | 'glass' | 'frost'\n * @attr {string} size - Size: 'sm' | 'md' | 'lg'\n * @attr {string} color - Theme color: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'\n *\n * @fires change - Emitted when the active tab changes with detail: { value: string }\n *\n * @slot tabs - Place `ore-tab-item` elements here\n * @slot - Place `ore-tab-panel` elements here\n *\n * @cssprop --tabs-radius - Border radius of the tablist container and panels\n * @cssprop --tabs-transition - Transition duration/easing for the active indicator\n * @cssprop --tabs-indicator-color - Color of the sliding active indicator line\n * @cssprop --tabs-bg - Background of the host element (flat variant)\n * @cssprop --tabs-tablist-bg - Tablist container background (solid/glass/frost variants)\n * @cssprop --tabs-tablist-border-color - Tablist container border color\n * @part tablist - Container that holds the slotted tab items\n * @part indicator - Active tab indicator element\n * @part panels - Container that holds tab panel content\n * @example\n * ```html\n * <ore-tabs value=\"tab1\" variant=\"bordered\">\n * <ore-tab-item slot=\"tabs\" value=\"tab1\">Overview</ore-tab-item>\n * <ore-tab-item slot=\"tabs\" value=\"tab2\">Settings</ore-tab-item>\n * <ore-tab-panel value=\"tab1\"><p>Overview content</p></ore-tab-panel>\n * <ore-tab-panel value=\"tab2\"><p>Settings content</p></ore-tab-panel>\n * </ore-tabs>\n * ```\n */\nexport const TABS_TAG = 'ore-tabs' as const;\ndefine<OreTabsProps>(TABS_TAG, {\n props: {\n ...themableBundle,\n ...sizableBundle,\n activation: prop.oneOf(['auto', 'manual'] as const, 'auto'),\n label: prop.string(),\n orientation: prop.oneOf(['horizontal', 'vertical'] as const, 'horizontal'),\n value: prop.string(),\n variant: prop.string<SurfaceVariant>(),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreTabsEvents>();\n\n const shadowRoot = el.shadowRoot;\n const tablistRef = ref<HTMLElement>();\n const indicatorRef = ref<HTMLElement>();\n const selectedValue = signal<string | undefined>(props.value.value);\n const isManualActivation = () => props.activation.value === 'manual';\n const isVertical = () => props.orientation.value === 'vertical';\n\n bind({\n attr: {\n value: () => selectedValue.value ?? null,\n },\n });\n\n const getTabs = () => [...el.querySelectorAll<HTMLElement>(':scope > ore-tab-item[slot=\"tabs\"]')];\n const getEnabledTabs = () => getTabs().filter((t) => !t.hasAttribute('disabled'));\n const focusTab = (tab: HTMLElement | undefined) => {\n if (!tab) return;\n\n const focusable = tab.shadowRoot?.querySelector<HTMLElement>('[role=\"tab\"]') ?? tab;\n\n focusable.focus();\n };\n\n // ────────────────────────────────────────────────────────────────\n // Selection State Management\n // ────────────────────────────────────────────────────────────────\n\n const setSelection = (value: string | undefined, shouldEmit = false) => {\n selectedValue.value = value;\n\n if (shouldEmit && value) emit('change', { value });\n };\n\n const ensureSelection = () => {\n const tabs = getTabs();\n\n if (tabs.length === 0) return; // No tabs yet, keep current selection\n\n const current = selectedValue.value;\n const hasCurrent = current\n ? tabs.some((tab) => tab.getAttribute('value') === current && !tab.hasAttribute('disabled'))\n : false;\n\n if (hasCurrent) return;\n\n const firstEnabled = tabs.find((tab) => !tab.hasAttribute('disabled'))?.getAttribute('value') ?? undefined;\n\n setSelection(firstEnabled, false);\n };\n\n watch(props.value, (value) => {\n selectedValue.value = value;\n ensureSelection();\n });\n\n // ────────────────────────────────────────────────────────────────\n // List Control for Keyboard Navigation\n // ────────────────────────────────────────────────────────────────\n\n const listControl = createListControl({\n direction: () => elementDirection(el),\n getItems: () => getEnabledTabs(),\n loop: true,\n onNavigate: (_action, index) => {\n const tabs = getEnabledTabs();\n const nextTab = tabs[index];\n\n focusTab(nextTab);\n\n if (!isManualActivation()) {\n const value = nextTab?.getAttribute('value');\n\n if (value) setSelection(value, true);\n }\n },\n orientation: () => (isVertical() ? 'vertical' : 'both'),\n signal: lifecycleSignal(onCleanup),\n });\n\n // ────────────────────────────────────────────────────────────────\n // Context & Indicator Management\n // ────────────────────────────────────────────────────────────────\n\n provide(TABS_CTX, {\n color: props.color,\n orientation: computed(() => props.orientation.value ?? 'horizontal'),\n size: props.size,\n value: selectedValue,\n variant: props.variant,\n });\n\n const moveIndicator = (activeTab: HTMLElement | undefined) => {\n const indicator = indicatorRef.value;\n const tablist = tablistRef.value;\n\n if (!indicator || !tablist || !activeTab) return;\n\n const tabRect = activeTab.getBoundingClientRect();\n const listRect = tablist.getBoundingClientRect();\n\n if (isVertical()) {\n const y = tabRect.top - listRect.top + tablist.scrollTop;\n\n indicator.style.transition = 'none';\n indicator.style.height = `${tabRect.height}px`;\n indicator.style.width = '';\n indicator.style.left = '0';\n indicator.style.top = '0';\n void indicator.offsetWidth;\n indicator.style.transition = '';\n indicator.style.transform = `translateY(${y}px)`;\n } else {\n const x = tabRect.left - listRect.left + tablist.scrollLeft;\n\n indicator.style.transition = 'none';\n indicator.style.width = `${tabRect.width}px`;\n indicator.style.height = '';\n indicator.style.top = '';\n indicator.style.left = '0';\n void indicator.offsetWidth;\n indicator.style.transition = '';\n indicator.style.transform = `translateX(${x}px)`;\n }\n };\n\n const updateIndicator = () => {\n const value = selectedValue.value;\n\n if (!value) return;\n\n const activeTab = getTabs().find((t) => t.getAttribute('value') === value);\n\n moveIndicator(activeTab);\n };\n\n watch(selectedValue, () => {\n requestAnimationFrame(updateIndicator);\n });\n\n // ────────────────────────────────────────────────────────────────\n // Event Handlers\n // ────────────────────────────────────────────────────────────────\n\n const handleTabClick = (e: Event) => {\n const tab = e\n .composedPath()\n .find((node): node is HTMLElement => node instanceof HTMLElement && node.localName === 'ore-tab-item');\n\n if (!tab || tab.hasAttribute('disabled')) return;\n\n // Guard: only respond to tab-items that belong to THIS tabs instance\n if (tab.closest('ore-tabs') !== el) return;\n\n const value = tab.getAttribute('value');\n\n if (!value || value === selectedValue.value) return;\n\n setSelection(value, true);\n };\n\n const activateFocusedTab = (): void => {\n const tabs = getEnabledTabs();\n const focusedTab = tabs.find(\n (tab) => tab === document.activeElement || tab.shadowRoot?.activeElement === document.activeElement,\n );\n const focusedValue = focusedTab?.getAttribute('value');\n\n if (focusedValue && focusedValue !== selectedValue.value) setSelection(focusedValue, true);\n };\n\n const manualActivationPress = createInteraction({\n disabled: computed(() => !isManualActivation()),\n onPress: activateFocusedTab,\n });\n\n const handleKeydown = (e: KeyboardEvent) => {\n const tabs = getEnabledTabs();\n\n if (tabs.length === 0) return;\n\n const path = e.composedPath();\n const activeTabFromEvent = path.find(\n (node): node is HTMLElement => node instanceof HTMLElement && node.localName === 'ore-tab-item',\n );\n\n const tabFromEvent = activeTabFromEvent ?? tabs.find((t) => t.getAttribute('value') === selectedValue.value);\n const focused = tabFromEvent ? tabs.indexOf(tabFromEvent) : -1;\n\n if (focused >= 0) listControl.set(focused);\n\n if (listControl.handleKeydown(e)) return;\n\n manualActivationPress.handleKeydown(e);\n };\n\n bind({\n on: {\n click: handleTabClick,\n keydown: handleKeydown,\n },\n });\n\n // ────────────────────────────────────────────────────────────────\n // Lifecycle\n // ────────────────────────────────────────────────────────────────\n\n onMounted(() => {\n const syncSelection = () => {\n ensureSelection();\n updateIndicator();\n };\n\n const tabsSlot = shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"tabs\"]');\n\n if (tabsSlot) {\n tabsSlot.addEventListener('slotchange', syncSelection);\n }\n\n syncSelection();\n requestAnimationFrame(syncSelection);\n\n return () => {\n if (tabsSlot) {\n tabsSlot.removeEventListener('slotchange', syncSelection);\n }\n };\n });\n\n return html`\n <div class=\"tablist-wrapper\">\n <div\n role=\"tablist\"\n ref=\"${tablistRef}\"\n part=\"tablist\"\n aria-orientation=\"${props.orientation}\"\n aria-label=\"${props.label}\">\n <slot name=\"tabs\"></slot>\n </div>\n <div class=\"indicator\" ref=\"${indicatorRef}\" part=\"indicator\"></div>\n </div>\n <div class=\"panels\" part=\"panels\">\n <slot></slot>\n </div>\n `;\n },\n styles: [colorThemeMixin, styles],\n});\n"],"mappings":"+YA+BA,IAAa,GAAA,EAAA,EAAA,cAAA,CAAsC,aAAa,EA+DnD,EAAW,wBACH,EAAU,CAC7B,MAAO,CACL,GAAG,EAAA,eACH,GAAG,EAAA,cACH,WAAY,EAAA,KAAK,MAAM,CAAC,OAAQ,QAAQ,EAAY,MAAM,EAC1D,MAAO,EAAA,KAAK,OAAO,EACnB,YAAa,EAAA,KAAK,MAAM,CAAC,aAAc,UAAU,EAAY,YAAY,EACzE,MAAO,EAAA,KAAK,OAAO,EACnB,QAAS,EA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Ac,CAAC,GAE/B,EAAsB,cAAc,CAAC,CACvC,CAME,CACF,CAAC,GAMD,EAAA,EAAA,UAAA,KAAgB,CACd,IAAM,MAAsB,CAC1B,EAAgB,EAChB,EAAgB,CAClB,EAEM,EAAW,GAAY,cAA+B,mBAAmB,EAS/E,OAPI,GACF,EAAS,iBAAiB,aAAc,CAAa,EAGvD,EAAc,EACd,sBAAsB,CAAa,MAEtB,CACP,GACF,EAAS,oBAAoB,aAAc,CAAa,CAE5D,CACF,CAAC,EAEM,EAAA,IAAI;;;;iBAIE,EAAW;;8BAEE,EAAM,YAAY;wBACxB,EAAM,MAAM;;;sCAGE,EAAa;;;;;KAMjD,EACA,OAAQ,CAAC,EAAA,gBAAiB,EAAA,OAAM,CAClC,CAAC"}
package/dist/tabs.js CHANGED
@@ -1,126 +1,130 @@
1
1
  import { colorThemeMixin as e } from "./styles/mixins/theme.css.js";
2
2
  import { sizableBundle as t, themableBundle as n } from "./shared/prop-bundles.js";
3
- import { createInteraction as r } from "./headless/keyboard.js";
4
- import { createListControl as i } from "./headless/nav.js";
5
- import a from "./disclosure/tabs/tabs.css.js";
6
- import { bind as o, createContext as s, define as c, getHost as l, html as u, onMounted as d, prop as f, provide as p, ref as m, useEmit as h } from "@vielzeug/ore";
7
- import { computed as g, signal as _, watch as v } from "@vielzeug/ripple";
3
+ import { lifecycleSignal as r } from "./headless/ore.js";
4
+ import { createInteraction as i } from "./headless/keyboard.js";
5
+ import { createListControl as a } from "./headless/nav.js";
6
+ import { elementDirection as o } from "./headless/direction.js";
7
+ import s from "./disclosure/tabs/tabs.css.js";
8
+ import { bind as c, createContext as l, define as u, getHost as d, html as f, onCleanup as p, onMounted as m, prop as h, provide as g, ref as _, useEmit as v } from "@vielzeug/ore";
9
+ import { computed as y, signal as b, watch as x } from "@vielzeug/ripple";
8
10
  //#region src/disclosure/tabs/tabs.ts
9
- var y = s("TabsContext"), b = "ore-tabs";
10
- c(b, {
11
+ var S = l("TabsContext"), C = "ore-tabs";
12
+ u(C, {
11
13
  props: {
12
14
  ...n,
13
15
  ...t,
14
- activation: f.oneOf(["auto", "manual"], "auto"),
15
- label: f.string(),
16
- orientation: f.oneOf(["horizontal", "vertical"], "horizontal"),
17
- value: f.string(),
18
- variant: f.string()
16
+ activation: h.oneOf(["auto", "manual"], "auto"),
17
+ label: h.string(),
18
+ orientation: h.oneOf(["horizontal", "vertical"], "horizontal"),
19
+ value: h.string(),
20
+ variant: h.string()
19
21
  },
20
22
  setup(e) {
21
- let t = l(), n = h(), a = t.shadowRoot, s = m(), c = m(), f = _(e.value.value), b = () => e.activation.value === "manual", x = () => e.orientation.value === "vertical";
22
- o({ attr: { value: () => f.value ?? null } });
23
- let S = () => [...t.querySelectorAll(":scope > ore-tab-item[slot=\"tabs\"]")], C = () => S().filter((e) => !e.hasAttribute("disabled")), w = (e) => {
23
+ let t = d(), n = v(), s = t.shadowRoot, l = _(), u = _(), h = b(e.value.value), C = () => e.activation.value === "manual", w = () => e.orientation.value === "vertical";
24
+ c({ attr: { value: () => h.value ?? null } });
25
+ let T = () => [...t.querySelectorAll(":scope > ore-tab-item[slot=\"tabs\"]")], E = () => T().filter((e) => !e.hasAttribute("disabled")), D = (e) => {
24
26
  e && (e.shadowRoot?.querySelector("[role=\"tab\"]") ?? e).focus();
25
- }, T = (e, t = !1) => {
26
- f.value = e, t && e && n("change", { value: e });
27
- }, E = () => {
28
- let e = S();
27
+ }, O = (e, t = !1) => {
28
+ h.value = e, t && e && n("change", { value: e });
29
+ }, k = () => {
30
+ let e = T();
29
31
  if (e.length === 0) return;
30
- let t = f.value;
32
+ let t = h.value;
31
33
  if (t && e.some((e) => e.getAttribute("value") === t && !e.hasAttribute("disabled"))) return;
32
34
  let n = e.find((e) => !e.hasAttribute("disabled"))?.getAttribute("value") ?? void 0;
33
- T(n, !1);
35
+ O(n, !1);
34
36
  };
35
- v(e.value, (e) => {
36
- f.value = e, E();
37
+ x(e.value, (e) => {
38
+ h.value = e, k();
37
39
  });
38
- let D = i({
39
- getItems: () => C(),
40
+ let A = a({
41
+ direction: () => o(t),
42
+ getItems: () => E(),
40
43
  loop: !0,
41
44
  onNavigate: (e, t) => {
42
- let n = C()[t];
43
- if (w(n), !b()) {
45
+ let n = E()[t];
46
+ if (D(n), !C()) {
44
47
  let e = n?.getAttribute("value");
45
- e && T(e, !0);
48
+ e && O(e, !0);
46
49
  }
47
50
  },
48
- orientation: () => x() ? "vertical" : "both"
51
+ orientation: () => w() ? "vertical" : "both",
52
+ signal: r(p)
49
53
  });
50
- p(y, {
54
+ g(S, {
51
55
  color: e.color,
52
- orientation: g(() => e.orientation.value ?? "horizontal"),
56
+ orientation: y(() => e.orientation.value ?? "horizontal"),
53
57
  size: e.size,
54
- value: f,
58
+ value: h,
55
59
  variant: e.variant
56
60
  });
57
- let O = (e) => {
58
- let t = c.value, n = s.value;
61
+ let j = (e) => {
62
+ let t = u.value, n = l.value;
59
63
  if (!t || !n || !e) return;
60
64
  let r = e.getBoundingClientRect(), i = n.getBoundingClientRect();
61
- if (x()) {
65
+ if (w()) {
62
66
  let e = r.top - i.top + n.scrollTop;
63
67
  t.style.transition = "none", t.style.height = `${r.height}px`, t.style.width = "", t.style.left = "0", t.style.top = "0", t.offsetWidth, t.style.transition = "", t.style.transform = `translateY(${e}px)`;
64
68
  } else {
65
69
  let e = r.left - i.left + n.scrollLeft;
66
70
  t.style.transition = "none", t.style.width = `${r.width}px`, t.style.height = "", t.style.top = "", t.style.left = "0", t.offsetWidth, t.style.transition = "", t.style.transform = `translateX(${e}px)`;
67
71
  }
68
- }, k = () => {
69
- let e = f.value;
72
+ }, M = () => {
73
+ let e = h.value;
70
74
  if (!e) return;
71
- let t = S().find((t) => t.getAttribute("value") === e);
72
- O(t);
75
+ let t = T().find((t) => t.getAttribute("value") === e);
76
+ j(t);
73
77
  };
74
- v(f, () => {
75
- requestAnimationFrame(k);
78
+ x(h, () => {
79
+ requestAnimationFrame(M);
76
80
  });
77
- let A = (e) => {
81
+ let N = (e) => {
78
82
  let n = e.composedPath().find((e) => e instanceof HTMLElement && e.localName === "ore-tab-item");
79
83
  if (!n || n.hasAttribute("disabled") || n.closest("ore-tabs") !== t) return;
80
84
  let r = n.getAttribute("value");
81
- !r || r === f.value || T(r, !0);
82
- }, j = r({
83
- disabled: g(() => !b()),
85
+ !r || r === h.value || O(r, !0);
86
+ }, P = i({
87
+ disabled: y(() => !C()),
84
88
  onPress: () => {
85
- let e = C().find((e) => e === document.activeElement || e.shadowRoot?.activeElement === document.activeElement)?.getAttribute("value");
86
- e && e !== f.value && T(e, !0);
89
+ let e = E().find((e) => e === document.activeElement || e.shadowRoot?.activeElement === document.activeElement)?.getAttribute("value");
90
+ e && e !== h.value && O(e, !0);
87
91
  }
88
92
  });
89
- return o({ on: {
90
- click: A,
93
+ return c({ on: {
94
+ click: N,
91
95
  keydown: (e) => {
92
- let t = C();
96
+ let t = E();
93
97
  if (t.length === 0) return;
94
- let n = e.composedPath().find((e) => e instanceof HTMLElement && e.localName === "ore-tab-item") ?? t.find((e) => e.getAttribute("value") === f.value), r = n ? t.indexOf(n) : -1;
95
- r >= 0 && D.set(r), !D.handleKeydown(e) && j.handleKeydown(e);
98
+ let n = e.composedPath().find((e) => e instanceof HTMLElement && e.localName === "ore-tab-item") ?? t.find((e) => e.getAttribute("value") === h.value), r = n ? t.indexOf(n) : -1;
99
+ r >= 0 && A.set(r), !A.handleKeydown(e) && P.handleKeydown(e);
96
100
  }
97
- } }), d(() => {
101
+ } }), m(() => {
98
102
  let e = () => {
99
- E(), k();
100
- }, t = a?.querySelector("slot[name=\"tabs\"]");
103
+ k(), M();
104
+ }, t = s?.querySelector("slot[name=\"tabs\"]");
101
105
  return t && t.addEventListener("slotchange", e), e(), requestAnimationFrame(e), () => {
102
106
  t && t.removeEventListener("slotchange", e);
103
107
  };
104
- }), u`
108
+ }), f`
105
109
  <div class="tablist-wrapper">
106
110
  <div
107
111
  role="tablist"
108
- ref="${s}"
112
+ ref="${l}"
109
113
  part="tablist"
110
114
  aria-orientation="${e.orientation}"
111
115
  aria-label="${e.label}">
112
116
  <slot name="tabs"></slot>
113
117
  </div>
114
- <div class="indicator" ref="${c}" part="indicator"></div>
118
+ <div class="indicator" ref="${u}" part="indicator"></div>
115
119
  </div>
116
120
  <div class="panels" part="panels">
117
121
  <slot></slot>
118
122
  </div>
119
123
  `;
120
124
  },
121
- styles: [e, a]
125
+ styles: [e, s]
122
126
  });
123
127
  //#endregion
124
- export { y as TABS_CTX, b as TABS_TAG };
128
+ export { S as TABS_CTX, C as TABS_TAG };
125
129
 
126
130
  //# sourceMappingURL=tabs.js.map
package/dist/tabs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.js","names":[],"sources":["../src/disclosure/tabs/tabs.ts"],"sourcesContent":["import { createContext, define, html, prop, ref, bind, getHost, onMounted, provide, useEmit } from '@vielzeug/ore';\nimport { computed, type Readable, signal, watch } from '@vielzeug/ripple';\n\nimport type { ComponentSize, SurfaceVariant, ThemeColor } from '../../types';\n\nimport { createInteraction, createListControl } from '../../headless';\nimport { sizableBundle, themableBundle } from '../../shared';\nimport { colorThemeMixin } from '../../styles';\nimport styles from './tabs.css?inline';\n\n/** Context provided by ore-tabs to its ore-tab-item and ore-tab-panel children. */\nexport type TabsContext = {\n color: Readable<ThemeColor | undefined>;\n orientation: Readable<'horizontal' | 'vertical'>;\n size: Readable<ComponentSize | undefined>;\n value: Readable<string | undefined>;\n variant: Readable<SurfaceVariant | undefined>;\n};\n/** Injection key for the tabs context. */\nexport const TABS_CTX = createContext<TabsContext>('TabsContext');\n\nexport type OreTabsEvents = {\n change: { value: string };\n};\n\nexport type OreTabsProps = {\n /**\n * Keyboard activation mode.\n * - `'auto'` (default): Selecting a tab on arrow-key focus immediately activates it (ARIA recommendation for most cases).\n * - `'manual'`: Arrow keys only move focus; the user must press Enter or Space to activate the focused tab.\n */\n activation?: 'auto' | 'manual';\n /** Theme color */\n color?: ThemeColor;\n /** Accessible label for the tablist (passed as aria-label). Use when there is no visible heading labelling the tabs. */\n label?: string;\n /** Tab list orientation */\n orientation?: 'horizontal' | 'vertical';\n /** Component size */\n size?: ComponentSize;\n /** Currently selected tab value */\n value?: string;\n /** Visual style variant */\n variant?: SurfaceVariant;\n};\n\n/**\n * Tabs container. Manages tab selection and syncs state to child tab items and panels.\n *\n * @element ore-tabs\n * @element ore-tab-item - Child element for tab buttons (auto-discovered)\n * @element ore-tab-panel - Child element for tab content (auto-discovered)\n *\n * @attr {string} value - The value of the currently selected tab\n * @attr {string} variant - Visual variant: 'solid' | 'flat' | 'bordered' | 'ghost' | 'glass' | 'frost'\n * @attr {string} size - Size: 'sm' | 'md' | 'lg'\n * @attr {string} color - Theme color: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'\n *\n * @fires change - Emitted when the active tab changes with detail: { value: string }\n *\n * @slot tabs - Place `ore-tab-item` elements here\n * @slot - Place `ore-tab-panel` elements here\n *\n * @cssprop --tabs-radius - Border radius of the tablist container and panels\n * @cssprop --tabs-transition - Transition duration/easing for the active indicator\n * @cssprop --tabs-indicator-color - Color of the sliding active indicator line\n * @cssprop --tabs-bg - Background of the host element (flat variant)\n * @cssprop --tabs-tablist-bg - Tablist container background (solid/glass/frost variants)\n * @cssprop --tabs-tablist-border-color - Tablist container border color\n * @part tablist - Container that holds the slotted tab items\n * @part indicator - Active tab indicator element\n * @part panels - Container that holds tab panel content\n * @example\n * ```html\n * <ore-tabs value=\"tab1\" variant=\"bordered\">\n * <ore-tab-item slot=\"tabs\" value=\"tab1\">Overview</ore-tab-item>\n * <ore-tab-item slot=\"tabs\" value=\"tab2\">Settings</ore-tab-item>\n * <ore-tab-panel value=\"tab1\"><p>Overview content</p></ore-tab-panel>\n * <ore-tab-panel value=\"tab2\"><p>Settings content</p></ore-tab-panel>\n * </ore-tabs>\n * ```\n */\nexport const TABS_TAG = 'ore-tabs' as const;\ndefine<OreTabsProps>(TABS_TAG, {\n props: {\n ...themableBundle,\n ...sizableBundle,\n activation: prop.oneOf(['auto', 'manual'] as const, 'auto'),\n label: prop.string(),\n orientation: prop.oneOf(['horizontal', 'vertical'] as const, 'horizontal'),\n value: prop.string(),\n variant: prop.string<SurfaceVariant>(),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreTabsEvents>();\n\n const shadowRoot = el.shadowRoot;\n const tablistRef = ref<HTMLElement>();\n const indicatorRef = ref<HTMLElement>();\n const selectedValue = signal<string | undefined>(props.value.value);\n const isManualActivation = () => props.activation.value === 'manual';\n const isVertical = () => props.orientation.value === 'vertical';\n\n bind({\n attr: {\n value: () => selectedValue.value ?? null,\n },\n });\n\n const getTabs = () => [...el.querySelectorAll<HTMLElement>(':scope > ore-tab-item[slot=\"tabs\"]')];\n const getEnabledTabs = () => getTabs().filter((t) => !t.hasAttribute('disabled'));\n const focusTab = (tab: HTMLElement | undefined) => {\n if (!tab) return;\n\n const focusable = tab.shadowRoot?.querySelector<HTMLElement>('[role=\"tab\"]') ?? tab;\n\n focusable.focus();\n };\n\n // ────────────────────────────────────────────────────────────────\n // Selection State Management\n // ────────────────────────────────────────────────────────────────\n\n const setSelection = (value: string | undefined, shouldEmit = false) => {\n selectedValue.value = value;\n\n if (shouldEmit && value) emit('change', { value });\n };\n\n const ensureSelection = () => {\n const tabs = getTabs();\n\n if (tabs.length === 0) return; // No tabs yet, keep current selection\n\n const current = selectedValue.value;\n const hasCurrent = current\n ? tabs.some((tab) => tab.getAttribute('value') === current && !tab.hasAttribute('disabled'))\n : false;\n\n if (hasCurrent) return;\n\n const firstEnabled = tabs.find((tab) => !tab.hasAttribute('disabled'))?.getAttribute('value') ?? undefined;\n\n setSelection(firstEnabled, false);\n };\n\n watch(props.value, (value) => {\n selectedValue.value = value;\n ensureSelection();\n });\n\n // ────────────────────────────────────────────────────────────────\n // List Control for Keyboard Navigation\n // ────────────────────────────────────────────────────────────────\n\n const listControl = createListControl({\n getItems: () => getEnabledTabs(),\n loop: true,\n onNavigate: (_action, index) => {\n const tabs = getEnabledTabs();\n const nextTab = tabs[index];\n\n focusTab(nextTab);\n\n if (!isManualActivation()) {\n const value = nextTab?.getAttribute('value');\n\n if (value) setSelection(value, true);\n }\n },\n orientation: () => (isVertical() ? 'vertical' : 'both'),\n });\n\n // ────────────────────────────────────────────────────────────────\n // Context & Indicator Management\n // ────────────────────────────────────────────────────────────────\n\n provide(TABS_CTX, {\n color: props.color,\n orientation: computed(() => props.orientation.value ?? 'horizontal'),\n size: props.size,\n value: selectedValue,\n variant: props.variant,\n });\n\n const moveIndicator = (activeTab: HTMLElement | undefined) => {\n const indicator = indicatorRef.value;\n const tablist = tablistRef.value;\n\n if (!indicator || !tablist || !activeTab) return;\n\n const tabRect = activeTab.getBoundingClientRect();\n const listRect = tablist.getBoundingClientRect();\n\n if (isVertical()) {\n const y = tabRect.top - listRect.top + tablist.scrollTop;\n\n indicator.style.transition = 'none';\n indicator.style.height = `${tabRect.height}px`;\n indicator.style.width = '';\n indicator.style.left = '0';\n indicator.style.top = '0';\n void indicator.offsetWidth;\n indicator.style.transition = '';\n indicator.style.transform = `translateY(${y}px)`;\n } else {\n const x = tabRect.left - listRect.left + tablist.scrollLeft;\n\n indicator.style.transition = 'none';\n indicator.style.width = `${tabRect.width}px`;\n indicator.style.height = '';\n indicator.style.top = '';\n indicator.style.left = '0';\n void indicator.offsetWidth;\n indicator.style.transition = '';\n indicator.style.transform = `translateX(${x}px)`;\n }\n };\n\n const updateIndicator = () => {\n const value = selectedValue.value;\n\n if (!value) return;\n\n const activeTab = getTabs().find((t) => t.getAttribute('value') === value);\n\n moveIndicator(activeTab);\n };\n\n watch(selectedValue, () => {\n requestAnimationFrame(updateIndicator);\n });\n\n // ────────────────────────────────────────────────────────────────\n // Event Handlers\n // ────────────────────────────────────────────────────────────────\n\n const handleTabClick = (e: Event) => {\n const tab = e\n .composedPath()\n .find((node): node is HTMLElement => node instanceof HTMLElement && node.localName === 'ore-tab-item');\n\n if (!tab || tab.hasAttribute('disabled')) return;\n\n // Guard: only respond to tab-items that belong to THIS tabs instance\n if (tab.closest('ore-tabs') !== el) return;\n\n const value = tab.getAttribute('value');\n\n if (!value || value === selectedValue.value) return;\n\n setSelection(value, true);\n };\n\n const activateFocusedTab = (): void => {\n const tabs = getEnabledTabs();\n const focusedTab = tabs.find(\n (tab) => tab === document.activeElement || tab.shadowRoot?.activeElement === document.activeElement,\n );\n const focusedValue = focusedTab?.getAttribute('value');\n\n if (focusedValue && focusedValue !== selectedValue.value) setSelection(focusedValue, true);\n };\n\n const manualActivationPress = createInteraction({\n disabled: computed(() => !isManualActivation()),\n onPress: activateFocusedTab,\n });\n\n const handleKeydown = (e: KeyboardEvent) => {\n const tabs = getEnabledTabs();\n\n if (tabs.length === 0) return;\n\n const path = e.composedPath();\n const activeTabFromEvent = path.find(\n (node): node is HTMLElement => node instanceof HTMLElement && node.localName === 'ore-tab-item',\n );\n\n const tabFromEvent = activeTabFromEvent ?? tabs.find((t) => t.getAttribute('value') === selectedValue.value);\n const focused = tabFromEvent ? tabs.indexOf(tabFromEvent) : -1;\n\n if (focused >= 0) listControl.set(focused);\n\n if (listControl.handleKeydown(e)) return;\n\n manualActivationPress.handleKeydown(e);\n };\n\n bind({\n on: {\n click: handleTabClick,\n keydown: handleKeydown,\n },\n });\n\n // ────────────────────────────────────────────────────────────────\n // Lifecycle\n // ────────────────────────────────────────────────────────────────\n\n onMounted(() => {\n const syncSelection = () => {\n ensureSelection();\n updateIndicator();\n };\n\n const tabsSlot = shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"tabs\"]');\n\n if (tabsSlot) {\n tabsSlot.addEventListener('slotchange', syncSelection);\n }\n\n syncSelection();\n requestAnimationFrame(syncSelection);\n\n return () => {\n if (tabsSlot) {\n tabsSlot.removeEventListener('slotchange', syncSelection);\n }\n };\n });\n\n return html`\n <div class=\"tablist-wrapper\">\n <div\n role=\"tablist\"\n ref=\"${tablistRef}\"\n part=\"tablist\"\n aria-orientation=\"${props.orientation}\"\n aria-label=\"${props.label}\">\n <slot name=\"tabs\"></slot>\n </div>\n <div class=\"indicator\" ref=\"${indicatorRef}\" part=\"indicator\"></div>\n </div>\n <div class=\"panels\" part=\"panels\">\n <slot></slot>\n </div>\n `;\n },\n styles: [colorThemeMixin, styles],\n});\n"],"mappings":";;;;;;;;AAmBA,IAAa,IAAW,EAA2B,aAAa,GA+DnD,IAAW;AACxB,EAAqB,GAAU;CAC7B,OAAO;EACL,GAAG;EACH,GAAG;EACH,YAAY,EAAK,MAAM,CAAC,QAAQ,QAAQ,GAAY,MAAM;EAC1D,OAAO,EAAK,OAAO;EACnB,aAAa,EAAK,MAAM,CAAC,cAAc,UAAU,GAAY,YAAY;EACzE,OAAO,EAAK,OAAO;EACnB,SAAS,EAAK,OAAuB;CACvC;CACA,MAAM,GAAO;EACX,IAAM,IAAK,EAAQ,GACb,IAAO,EAAuB,GAE9B,IAAa,EAAG,YAChB,IAAa,EAAiB,GAC9B,IAAe,EAAiB,GAChC,IAAgB,EAA2B,EAAM,MAAM,KAAK,GAC5D,UAA2B,EAAM,WAAW,UAAU,UACtD,UAAmB,EAAM,YAAY,UAAU;EAErD,EAAK,EACH,MAAM,EACJ,aAAa,EAAc,SAAS,KACtC,EACF,CAAC;EAED,IAAM,UAAgB,CAAC,GAAG,EAAG,iBAA8B,sCAAoC,CAAC,GAC1F,UAAuB,EAAQ,CAAC,CAAC,QAAQ,MAAM,CAAC,EAAE,aAAa,UAAU,CAAC,GAC1E,KAAY,MAAiC;GAC5C,MAEa,EAAI,YAAY,cAA2B,gBAAc,KAAK,EAAA,CAEtE,MAAM;EAClB,GAMM,KAAgB,GAA2B,IAAa,OAAU;GAGtE,AAFA,EAAc,QAAQ,GAElB,KAAc,KAAO,EAAK,UAAU,EAAE,SAAM,CAAC;EACnD,GAEM,UAAwB;GAC5B,IAAM,IAAO,EAAQ;GAErB,IAAI,EAAK,WAAW,GAAG;GAEvB,IAAM,IAAU,EAAc;GAK9B,IAJmB,KACf,EAAK,MAAM,MAAQ,EAAI,aAAa,OAAO,MAAM,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G9D,KAAsB,EAAK,MAAM,MAAM,EAAE,aAAa,OAAO,MAAM,EAAc,KAAK,GACrG,IAAU,IAAe,EAAK,QAAQ,CAAY,IAAI;IAE5D,AAAI,KAAW,KAAG,EAAY,IAAI,CAAO,GAErC,GAAY,cAAc,CAAC,KAE/B,EAAsB,cAAc,CAAC;GACvC;EAME,EACF,CAAC,GAMD,QAAgB;GACd,IAAM,UAAsB;IAE1B,AADA,EAAgB,GAChB,EAAgB;GAClB,GAEM,IAAW,GAAY,cAA+B,qBAAmB;GAS/E,OAPI,KACF,EAAS,iBAAiB,cAAc,CAAa,GAGvD,EAAc,GACd,sBAAsB,CAAa,SAEtB;IACX,AAAI,KACF,EAAS,oBAAoB,cAAc,CAAa;GAE5D;EACF,CAAC,GAEM,CAAI;;;;iBAIE,EAAW;;8BAEE,EAAM,YAAY;wBACxB,EAAM,MAAM;;;sCAGE,EAAa;;;;;;CAMjD;CACA,QAAQ,CAAC,GAAiB,CAAM;AAClC,CAAC"}
1
+ {"version":3,"file":"tabs.js","names":[],"sources":["../src/disclosure/tabs/tabs.ts"],"sourcesContent":["import {\n createContext,\n define,\n html,\n prop,\n ref,\n bind,\n getHost,\n onCleanup,\n onMounted,\n provide,\n useEmit,\n} from '@vielzeug/ore';\nimport { computed, type Readable, signal, watch } from '@vielzeug/ripple';\n\nimport type { ComponentSize, SurfaceVariant, ThemeColor } from '../../types';\n\nimport { createInteraction, createListControl, elementDirection, lifecycleSignal } from '../../headless';\nimport { sizableBundle, themableBundle } from '../../shared';\nimport { colorThemeMixin } from '../../styles';\nimport styles from './tabs.css?inline';\n\n/** Context provided by ore-tabs to its ore-tab-item and ore-tab-panel children. */\nexport type TabsContext = {\n color: Readable<ThemeColor | undefined>;\n orientation: Readable<'horizontal' | 'vertical'>;\n size: Readable<ComponentSize | undefined>;\n value: Readable<string | undefined>;\n variant: Readable<SurfaceVariant | undefined>;\n};\n/** Injection key for the tabs context. */\nexport const TABS_CTX = createContext<TabsContext>('TabsContext');\n\nexport type OreTabsEvents = {\n change: { value: string };\n};\n\nexport type OreTabsProps = {\n /**\n * Keyboard activation mode.\n * - `'auto'` (default): Selecting a tab on arrow-key focus immediately activates it (ARIA recommendation for most cases).\n * - `'manual'`: Arrow keys only move focus; the user must press Enter or Space to activate the focused tab.\n */\n activation?: 'auto' | 'manual';\n /** Theme color */\n color?: ThemeColor;\n /** Accessible label for the tablist (passed as aria-label). Use when there is no visible heading labelling the tabs. */\n label?: string;\n /** Tab list orientation */\n orientation?: 'horizontal' | 'vertical';\n /** Component size */\n size?: ComponentSize;\n /** Currently selected tab value */\n value?: string;\n /** Visual style variant */\n variant?: SurfaceVariant;\n};\n\n/**\n * Tabs container. Manages tab selection and syncs state to child tab items and panels.\n *\n * @element ore-tabs\n * @element ore-tab-item - Child element for tab buttons (auto-discovered)\n * @element ore-tab-panel - Child element for tab content (auto-discovered)\n *\n * @attr {string} value - The value of the currently selected tab\n * @attr {string} variant - Visual variant: 'solid' | 'flat' | 'bordered' | 'ghost' | 'glass' | 'frost'\n * @attr {string} size - Size: 'sm' | 'md' | 'lg'\n * @attr {string} color - Theme color: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'\n *\n * @fires change - Emitted when the active tab changes with detail: { value: string }\n *\n * @slot tabs - Place `ore-tab-item` elements here\n * @slot - Place `ore-tab-panel` elements here\n *\n * @cssprop --tabs-radius - Border radius of the tablist container and panels\n * @cssprop --tabs-transition - Transition duration/easing for the active indicator\n * @cssprop --tabs-indicator-color - Color of the sliding active indicator line\n * @cssprop --tabs-bg - Background of the host element (flat variant)\n * @cssprop --tabs-tablist-bg - Tablist container background (solid/glass/frost variants)\n * @cssprop --tabs-tablist-border-color - Tablist container border color\n * @part tablist - Container that holds the slotted tab items\n * @part indicator - Active tab indicator element\n * @part panels - Container that holds tab panel content\n * @example\n * ```html\n * <ore-tabs value=\"tab1\" variant=\"bordered\">\n * <ore-tab-item slot=\"tabs\" value=\"tab1\">Overview</ore-tab-item>\n * <ore-tab-item slot=\"tabs\" value=\"tab2\">Settings</ore-tab-item>\n * <ore-tab-panel value=\"tab1\"><p>Overview content</p></ore-tab-panel>\n * <ore-tab-panel value=\"tab2\"><p>Settings content</p></ore-tab-panel>\n * </ore-tabs>\n * ```\n */\nexport const TABS_TAG = 'ore-tabs' as const;\ndefine<OreTabsProps>(TABS_TAG, {\n props: {\n ...themableBundle,\n ...sizableBundle,\n activation: prop.oneOf(['auto', 'manual'] as const, 'auto'),\n label: prop.string(),\n orientation: prop.oneOf(['horizontal', 'vertical'] as const, 'horizontal'),\n value: prop.string(),\n variant: prop.string<SurfaceVariant>(),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreTabsEvents>();\n\n const shadowRoot = el.shadowRoot;\n const tablistRef = ref<HTMLElement>();\n const indicatorRef = ref<HTMLElement>();\n const selectedValue = signal<string | undefined>(props.value.value);\n const isManualActivation = () => props.activation.value === 'manual';\n const isVertical = () => props.orientation.value === 'vertical';\n\n bind({\n attr: {\n value: () => selectedValue.value ?? null,\n },\n });\n\n const getTabs = () => [...el.querySelectorAll<HTMLElement>(':scope > ore-tab-item[slot=\"tabs\"]')];\n const getEnabledTabs = () => getTabs().filter((t) => !t.hasAttribute('disabled'));\n const focusTab = (tab: HTMLElement | undefined) => {\n if (!tab) return;\n\n const focusable = tab.shadowRoot?.querySelector<HTMLElement>('[role=\"tab\"]') ?? tab;\n\n focusable.focus();\n };\n\n // ────────────────────────────────────────────────────────────────\n // Selection State Management\n // ────────────────────────────────────────────────────────────────\n\n const setSelection = (value: string | undefined, shouldEmit = false) => {\n selectedValue.value = value;\n\n if (shouldEmit && value) emit('change', { value });\n };\n\n const ensureSelection = () => {\n const tabs = getTabs();\n\n if (tabs.length === 0) return; // No tabs yet, keep current selection\n\n const current = selectedValue.value;\n const hasCurrent = current\n ? tabs.some((tab) => tab.getAttribute('value') === current && !tab.hasAttribute('disabled'))\n : false;\n\n if (hasCurrent) return;\n\n const firstEnabled = tabs.find((tab) => !tab.hasAttribute('disabled'))?.getAttribute('value') ?? undefined;\n\n setSelection(firstEnabled, false);\n };\n\n watch(props.value, (value) => {\n selectedValue.value = value;\n ensureSelection();\n });\n\n // ────────────────────────────────────────────────────────────────\n // List Control for Keyboard Navigation\n // ────────────────────────────────────────────────────────────────\n\n const listControl = createListControl({\n direction: () => elementDirection(el),\n getItems: () => getEnabledTabs(),\n loop: true,\n onNavigate: (_action, index) => {\n const tabs = getEnabledTabs();\n const nextTab = tabs[index];\n\n focusTab(nextTab);\n\n if (!isManualActivation()) {\n const value = nextTab?.getAttribute('value');\n\n if (value) setSelection(value, true);\n }\n },\n orientation: () => (isVertical() ? 'vertical' : 'both'),\n signal: lifecycleSignal(onCleanup),\n });\n\n // ────────────────────────────────────────────────────────────────\n // Context & Indicator Management\n // ────────────────────────────────────────────────────────────────\n\n provide(TABS_CTX, {\n color: props.color,\n orientation: computed(() => props.orientation.value ?? 'horizontal'),\n size: props.size,\n value: selectedValue,\n variant: props.variant,\n });\n\n const moveIndicator = (activeTab: HTMLElement | undefined) => {\n const indicator = indicatorRef.value;\n const tablist = tablistRef.value;\n\n if (!indicator || !tablist || !activeTab) return;\n\n const tabRect = activeTab.getBoundingClientRect();\n const listRect = tablist.getBoundingClientRect();\n\n if (isVertical()) {\n const y = tabRect.top - listRect.top + tablist.scrollTop;\n\n indicator.style.transition = 'none';\n indicator.style.height = `${tabRect.height}px`;\n indicator.style.width = '';\n indicator.style.left = '0';\n indicator.style.top = '0';\n void indicator.offsetWidth;\n indicator.style.transition = '';\n indicator.style.transform = `translateY(${y}px)`;\n } else {\n const x = tabRect.left - listRect.left + tablist.scrollLeft;\n\n indicator.style.transition = 'none';\n indicator.style.width = `${tabRect.width}px`;\n indicator.style.height = '';\n indicator.style.top = '';\n indicator.style.left = '0';\n void indicator.offsetWidth;\n indicator.style.transition = '';\n indicator.style.transform = `translateX(${x}px)`;\n }\n };\n\n const updateIndicator = () => {\n const value = selectedValue.value;\n\n if (!value) return;\n\n const activeTab = getTabs().find((t) => t.getAttribute('value') === value);\n\n moveIndicator(activeTab);\n };\n\n watch(selectedValue, () => {\n requestAnimationFrame(updateIndicator);\n });\n\n // ────────────────────────────────────────────────────────────────\n // Event Handlers\n // ────────────────────────────────────────────────────────────────\n\n const handleTabClick = (e: Event) => {\n const tab = e\n .composedPath()\n .find((node): node is HTMLElement => node instanceof HTMLElement && node.localName === 'ore-tab-item');\n\n if (!tab || tab.hasAttribute('disabled')) return;\n\n // Guard: only respond to tab-items that belong to THIS tabs instance\n if (tab.closest('ore-tabs') !== el) return;\n\n const value = tab.getAttribute('value');\n\n if (!value || value === selectedValue.value) return;\n\n setSelection(value, true);\n };\n\n const activateFocusedTab = (): void => {\n const tabs = getEnabledTabs();\n const focusedTab = tabs.find(\n (tab) => tab === document.activeElement || tab.shadowRoot?.activeElement === document.activeElement,\n );\n const focusedValue = focusedTab?.getAttribute('value');\n\n if (focusedValue && focusedValue !== selectedValue.value) setSelection(focusedValue, true);\n };\n\n const manualActivationPress = createInteraction({\n disabled: computed(() => !isManualActivation()),\n onPress: activateFocusedTab,\n });\n\n const handleKeydown = (e: KeyboardEvent) => {\n const tabs = getEnabledTabs();\n\n if (tabs.length === 0) return;\n\n const path = e.composedPath();\n const activeTabFromEvent = path.find(\n (node): node is HTMLElement => node instanceof HTMLElement && node.localName === 'ore-tab-item',\n );\n\n const tabFromEvent = activeTabFromEvent ?? tabs.find((t) => t.getAttribute('value') === selectedValue.value);\n const focused = tabFromEvent ? tabs.indexOf(tabFromEvent) : -1;\n\n if (focused >= 0) listControl.set(focused);\n\n if (listControl.handleKeydown(e)) return;\n\n manualActivationPress.handleKeydown(e);\n };\n\n bind({\n on: {\n click: handleTabClick,\n keydown: handleKeydown,\n },\n });\n\n // ────────────────────────────────────────────────────────────────\n // Lifecycle\n // ────────────────────────────────────────────────────────────────\n\n onMounted(() => {\n const syncSelection = () => {\n ensureSelection();\n updateIndicator();\n };\n\n const tabsSlot = shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"tabs\"]');\n\n if (tabsSlot) {\n tabsSlot.addEventListener('slotchange', syncSelection);\n }\n\n syncSelection();\n requestAnimationFrame(syncSelection);\n\n return () => {\n if (tabsSlot) {\n tabsSlot.removeEventListener('slotchange', syncSelection);\n }\n };\n });\n\n return html`\n <div class=\"tablist-wrapper\">\n <div\n role=\"tablist\"\n ref=\"${tablistRef}\"\n part=\"tablist\"\n aria-orientation=\"${props.orientation}\"\n aria-label=\"${props.label}\">\n <slot name=\"tabs\"></slot>\n </div>\n <div class=\"indicator\" ref=\"${indicatorRef}\" part=\"indicator\"></div>\n </div>\n <div class=\"panels\" part=\"panels\">\n <slot></slot>\n </div>\n `;\n },\n styles: [colorThemeMixin, styles],\n});\n"],"mappings":";;;;;;;;;;AA+BA,IAAa,IAAW,EAA2B,aAAa,GA+DnD,IAAW;AACxB,EAAqB,GAAU;CAC7B,OAAO;EACL,GAAG;EACH,GAAG;EACH,YAAY,EAAK,MAAM,CAAC,QAAQ,QAAQ,GAAY,MAAM;EAC1D,OAAO,EAAK,OAAO;EACnB,aAAa,EAAK,MAAM,CAAC,cAAc,UAAU,GAAY,YAAY;EACzE,OAAO,EAAK,OAAO;EACnB,SAAS,EAAK,OAAuB;CACvC;CACA,MAAM,GAAO;EACX,IAAM,IAAK,EAAQ,GACb,IAAO,EAAuB,GAE9B,IAAa,EAAG,YAChB,IAAa,EAAiB,GAC9B,IAAe,EAAiB,GAChC,IAAgB,EAA2B,EAAM,MAAM,KAAK,GAC5D,UAA2B,EAAM,WAAW,UAAU,UACtD,UAAmB,EAAM,YAAY,UAAU;EAErD,EAAK,EACH,MAAM,EACJ,aAAa,EAAc,SAAS,KACtC,EACF,CAAC;EAED,IAAM,UAAgB,CAAC,GAAG,EAAG,iBAA8B,sCAAoC,CAAC,GAC1F,UAAuB,EAAQ,CAAC,CAAC,QAAQ,MAAM,CAAC,EAAE,aAAa,UAAU,CAAC,GAC1E,KAAY,MAAiC;GAC5C,MAEa,EAAI,YAAY,cAA2B,g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AQ,MAAQ,SAAS,iBAAiB,EAAI,YAAY,kBAAkB,SAAS,aAEnE,CAAA,EAAY,aAAa,OAAO;IAErD,AAAI,KAAgB,MAAiB,EAAc,SAAO,EAAa,GAAc,EAAI;GAC3F;EAKA,CAAC;EAuDD,OAjCA,EAAK,EACH,IAAI;GACF,OAAO;GACP,UAvBmB,MAAqB;IAC1C,IAAM,IAAO,EAAe;IAE5B,IAAI,EAAK,WAAW,GAAG;IAOvB,IAAM,IALO,EAAE,aACY,CAAA,CAAK,MAC7B,MAA8B,aAAgB,eAAe,EAAK,cAAc,cAG9D,KAAsB,EAAK,MAAM,MAAM,EAAE,aAAa,OAAO,MAAM,EAAc,KAAK,GACrG,IAAU,IAAe,EAAK,QAAQ,CAAY,IAAI;IAE5D,AAAI,KAAW,KAAG,EAAY,IAAI,CAAO,GAErC,GAAY,cAAc,CAAC,KAE/B,EAAsB,cAAc,CAAC;GACvC;EAME,EACF,CAAC,GAMD,QAAgB;GACd,IAAM,UAAsB;IAE1B,AADA,EAAgB,GAChB,EAAgB;GAClB,GAEM,IAAW,GAAY,cAA+B,qBAAmB;GAS/E,OAPI,KACF,EAAS,iBAAiB,cAAc,CAAa,GAGvD,EAAc,GACd,sBAAsB,CAAa,SAEtB;IACX,AAAI,KACF,EAAS,oBAAoB,cAAc,CAAa;GAE5D;EACF,CAAC,GAEM,CAAI;;;;iBAIE,EAAW;;8BAEE,EAAM,YAAY;wBACxB,EAAM,MAAM;;;sCAGE,EAAa;;;;;;CAMjD;CACA,QAAQ,CAAC,GAAiB,CAAM;AAClC,CAAC"}
@@ -41,49 +41,13 @@ export declare const getAriaControls: (el: Element) => null | string;
41
41
  /** Returns the `role` attribute value, or null. */
42
42
  export declare const getRole: (el: Element) => null | string;
43
43
  /**
44
- * Queries the shadow root of a custom element for a matching CSS selector.
45
- * Returns null if the element has no shadow root or no match is found.
44
+ * Generic, framework-agnostic — re-exported from `@vielzeug/assay` rather than duplicated here.
45
+ * `dispatchPointer(el, type, init)` from earlier versions of this module is now
46
+ * `fire.pointer<Type>(el, init)` (e.g. `fire.pointerEnter`/`fire.pointerLeave`), imported from
47
+ * `@vielzeug/ore/testing` alongside `mount()` — pass `{ composed: true }` explicitly if you need
48
+ * the event to cross shadow boundaries.
46
49
  */
47
- export declare const queryInShadow: <T extends Element = Element>(host: Element, selector: string) => null | T;
48
- /**
49
- * Queries all matching elements inside the shadow root of a custom element.
50
- * Returns an empty array if the element has no shadow root.
51
- */
52
- export declare const queryAllInShadow: <T extends Element = Element>(host: Element, selector: string) => T[];
53
- /**
54
- * Queries a shadow DOM element by its CSS `part` attribute.
55
- * Shorthand for `queryInShadow(host, '[part="name"]')`.
56
- *
57
- * @example
58
- * ```ts
59
- * const btn = queryPart(carousel, 'prev-btn');
60
- * expect(btn).not.toBeNull();
61
- * ```
62
- */
63
- export declare const queryPart: <T extends Element = Element>(host: Element, part: string) => null | T;
64
- /**
65
- * Returns an array of light-DOM children assigned to a named slot,
66
- * or all slotted children if no name is given.
67
- *
68
- * @example
69
- * ```ts
70
- * const slides = getSlotted(carousel);
71
- * expect(slides).toHaveLength(3);
72
- * ```
73
- */
74
- export declare const getSlotted: (host: Element, slotName?: string) => Element[];
75
- /**
76
- * Dispatches a `PointerEvent` on the given element.
77
- * Useful for testing hover, drag, and pointer interactions without
78
- * relying on the fire helper from @vielzeug/ore/testing.
79
- *
80
- * @example
81
- * ```ts
82
- * dispatchPointer(el, 'enter');
83
- * dispatchPointer(el, 'leave');
84
- * ```
85
- */
86
- export declare const dispatchPointer: (el: Element, type: "cancel" | "down" | "enter" | "leave" | "move" | "up", init?: PointerEventInit) => void;
50
+ export { queryInShadow, queryAllInShadow, queryPart, getSlotted } from '@vielzeug/assay';
87
51
  /**
88
52
  * Returns the current form value of a form-associated custom element.
89
53
  * Uses the ElementInternals-exposed `value` if available, then falls back
@@ -100,32 +64,23 @@ export declare const isFormValid: (el: HTMLElement & {
100
64
  validity?: ValidityState;
101
65
  }) => boolean;
102
66
  /**
103
- * Creates a synthetic `KeyboardEvent` with the given key.
104
- * Useful for testing keyboard navigation in headless controls.
105
- */
106
- export declare const keyEvent: (key: string, init?: KeyboardEventInit) => KeyboardEvent;
107
- /**
108
- * Returns a Promise that resolves after a microtask tick (one `queueMicrotask`).
109
- * Use when you need to wait for reactivity (signal effects) to settle without
110
- * moving into the macrotask queue.
111
- */
112
- export declare const nextTick: () => Promise<void>;
113
- /**
114
- * Returns a Promise that resolves after `ms` milliseconds.
115
- * Use sparingly — prefer `nextTick()` for reactive updates.
67
+ * Generic, framework-agnostic — re-exported from `@vielzeug/assay` rather than duplicated here.
68
+ * `keyEvent(key, init)` from earlier versions of this module (construct-only, no dispatch, and
69
+ * unused anywhere in this package's own tests) has been removed — use `fire.keyDown`/
70
+ * `fire.keyboard` from `@vielzeug/ore/testing`, which construct and dispatch in one call.
116
71
  */
117
- export declare const wait: (ms?: number) => Promise<void>;
72
+ export { nextTick, wait } from '@vielzeug/assay';
118
73
  /**
119
- * Resets the headless ID counter to 0. Use in test `beforeEach` hooks when you need
74
+ * Resets the headless stable-ID counter to 0. Use in test `beforeEach` hooks when you need
120
75
  * deterministic IDs across test runs.
121
76
  *
122
77
  * @example
123
78
  * ```ts
124
- * import { resetIdCounter } from '@vielzeug/refine/testing';
125
- * beforeEach(() => resetIdCounter());
79
+ * import { resetStableIdCounter } from '@vielzeug/refine/testing';
80
+ * beforeEach(() => resetStableIdCounter());
126
81
  * ```
127
82
  */
128
- export { resetIdCounter } from '@vielzeug/ore';
83
+ export { resetStableIdCounter } from '@vielzeug/ore';
129
84
  /**
130
85
  * Returns a snapshot of the most commonly tested ARIA attributes on an element.
131
86
  * Useful for concise inline snapshot assertions in component tests.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,mEAAmE;AACnE,eAAO,MAAM,aAAa,GAAI,IAAI,OAAO,KAAG,OAAqD,CAA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M,cAAc,GAAI,QAAQ,OAAO,CAAC,cAAc,CAAC,EAAE,OAAO,YAAY,KAAG,OAAO,CAAC,OAAO,CACL,CAAC;AAEjG,oDAAoD;AACpD,eAAO,MAAM,mBAAmB,GAAI,QAAQ,OAAO,CAAC,mBAAmB,CAAC,EAAE,OAAO,YAAY,KAAG,OAAO,CAAC,OAAO,CACH,CAAC;AAE7G,kDAAkD;AAClD,eAAO,MAAM,iBAAiB,GAAI,QAAQ,OAAO,CAAC,iBAAiB,CAAC,EAAE,OAAO,YAAY,KAAG,OAAO,CAAC,OAAO,CACH,CAAC;AAEzG,4CAA4C;AAC5C,eAAO,MAAM,YAAY,GAAI,QAAQ,OAAO,CAAC,YAAY,CAAC,EAAE,OAAO,YAAY,KAAG,OAAO,CAAC,OAAO,CACL,CAAC;AAE7F,oDAAoD;AACpD,eAAO,MAAM,mBAAmB,GAAI,QAAQ,OAAO,CAAC,mBAAmB,CAAC,EAAE,OAAO,YAAY,KAAG,OAAO,CAAC,OAAO,CACH,CAAC;AAE7G,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,GAAI,QAAQ,OAAO,CAAC,gBAAgB,CAAC,EAAE,OAAO,YAAY,KAAG,OAAO,CAAC,OAAO,CACH,CAAC;AAEvG,8CAA8C;AAC9C,eAAO,MAAM,cAAc,GAAI,QAAQ,OAAO,CAAC,cAAc,CAAC,EAAE,OAAO,YAAY,KAAG,OAAO,CAAC,OAAO,CACL,CAAC;AAEjG,8CAA8C;AAC9C,eAAO,MAAM,cAAc,GAAI,QAAQ,OAAO,CAAC,cAAc,CAAC,EAAE,OAAO,YAAY,KAAG,OAAO,CAAC,OAAO,CACL,CAAC"}
package/dist/testing.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@vielzeug/ore"),t=require("@vielzeug/ore/testing");var n=e=>e.getAttribute(`aria-invalid`)===`true`,r=e=>e.getAttribute(`aria-disabled`)===`true`,i=e=>e.getAttribute(`aria-checked`)===`true`,a=e=>e.getAttribute(`aria-checked`)===`mixed`,o=e=>e.getAttribute(`aria-expanded`)===`true`,s=e=>e.getAttribute(`aria-pressed`)===`true`,c=e=>e.getAttribute(`aria-required`)===`true`,l=e=>e.getAttribute(`aria-hidden`)===`true`,u=e=>e.getAttribute(`aria-label`),d=e=>e.getAttribute(`aria-labelledby`),f=e=>e.getAttribute(`aria-describedby`),p=e=>e.getAttribute(`aria-controls`),m=e=>e.getAttribute(`role`),h=(e,t)=>e.shadowRoot?.querySelector(t)??null,g=(e,t)=>Array.from(e.shadowRoot?.querySelectorAll(t)??[]),_=(e,t)=>h(e,`[part="${t}"]`),v=(e,t)=>{let n=t?`[slot="${t}"]`:`:not([slot])`;return Array.from(e.querySelectorAll(`:scope > ${n}`))},y=(e,t,n)=>{e.dispatchEvent(new PointerEvent(`pointer${t}`,{bubbles:!0,composed:!0,...n}))},b=e=>e.value??null,x=e=>e.validity?.valid??!0,S=(e,t)=>new KeyboardEvent(`keydown`,{bubbles:!0,cancelable:!0,key:e,...t}),C=()=>new Promise(e=>{queueMicrotask(e)}),w=(e=0)=>new Promise(t=>{setTimeout(t,e)}),T=e=>({ariaLabel:e.getAttribute(`aria-label`),checked:e.getAttribute(`aria-checked`),disabled:e.getAttribute(`aria-disabled`),expanded:e.getAttribute(`aria-expanded`),invalid:e.getAttribute(`aria-invalid`),labelledby:e.getAttribute(`aria-labelledby`),required:e.getAttribute(`aria-required`),role:e.getAttribute(`role`)}),E=e=>Object.entries(e).map(([e,t])=>t===``?e:`${e}="${t.replace(/"/g,`&quot;`)}"`).join(` `),D=(e={})=>{let t={};for(let[n,r]of Object.entries(e))if(!(r===!1||r==null))if(r===!0)t[n]=``;else if(Array.isArray(r)){if(r.length>0&&typeof r[0]==`object`)continue;t[n]=r.join(`,`)}else t[n]=String(r);return t},O=(e,n)=>(0,t.mount)(`<ore-input ${E(D(e))}>${n?.innerHTML??``}</ore-input>`),k=(e,n)=>(0,t.mount)(`<ore-textarea ${E(D(e))}>${n?.innerHTML??``}</ore-textarea>`),A=(e,n)=>(0,t.mount)(`<ore-select ${E(D(e))}>${n?.innerHTML??``}</ore-select>`),j=(e,n)=>(0,t.mount)(`<ore-combobox ${E(D(e))}>${n?.innerHTML??``}</ore-combobox>`),M=(e,n)=>(0,t.mount)(`<ore-checkbox ${E(D(e))}>${n?.innerHTML??``}</ore-checkbox>`),N=(e,n)=>(0,t.mount)(`<ore-checkbox-group ${E(D(e))}>${n?.innerHTML??``}</ore-checkbox-group>`),P=(e,n)=>(0,t.mount)(`<ore-radio ${E(D(e))}>${n?.innerHTML??``}</ore-radio>`),F=(e,n)=>(0,t.mount)(`<ore-radio-group ${E(D(e))}>${n?.innerHTML??``}</ore-radio-group>`),I=(e,n)=>(0,t.mount)(`<ore-switch ${E(D(e))}>${n?.innerHTML??``}</ore-switch>`),L=(e,n)=>(0,t.mount)(`<ore-button ${E(D(e))}>${n?.innerHTML??``}</ore-button>`),R=(e,n)=>(0,t.mount)(`<ore-button-group ${E(D(e))}>${n?.innerHTML??``}</ore-button-group>`),z=(e,n)=>(0,t.mount)(`<ore-file-input ${E(D(e))}>${n?.innerHTML??``}</ore-file-input>`),B=(e,n)=>(0,t.mount)(`<ore-form ${E(D(e))}>${n?.innerHTML??``}</ore-form>`),V=(e,n)=>(0,t.mount)(`<ore-number-input ${E(D(e))}>${n?.innerHTML??``}</ore-number-input>`),H=(e,n)=>(0,t.mount)(`<ore-otp-input ${E(D(e))}>${n?.innerHTML??``}</ore-otp-input>`),U=(e,n)=>(0,t.mount)(`<ore-rating ${E(D(e))}>${n?.innerHTML??``}</ore-rating>`),W=(e,n)=>(0,t.mount)(`<ore-slider ${E(D(e))}>${n?.innerHTML??``}</ore-slider>`);exports.attrsToHtml=E,exports.dispatchPointer=y,exports.getAriaControls=p,exports.getAriaDescribedBy=f,exports.getAriaLabel=u,exports.getAriaLabelledBy=d,exports.getAriaState=T,exports.getFormValue=b,exports.getRole=m,exports.getSlotted=v,exports.isAriaChecked=i,exports.isAriaDisabled=r,exports.isAriaExpanded=o,exports.isAriaHidden=l,exports.isAriaIndeterminate=a,exports.isAriaInvalid=n,exports.isAriaPressed=s,exports.isAriaRequired=c,exports.isFormValid=x,exports.keyEvent=S,exports.mountOreButton=L,exports.mountOreButtonGroup=R,exports.mountOreCheckbox=M,exports.mountOreCheckboxGroup=N,exports.mountOreCombobox=j,exports.mountOreFileInput=z,exports.mountOreForm=B,exports.mountOreInput=O,exports.mountOreNumberInput=V,exports.mountOreOtpInput=H,exports.mountOreRadio=P,exports.mountOreRadioGroup=F,exports.mountOreRating=U,exports.mountOreSelect=A,exports.mountOreSlider=W,exports.mountOreSwitch=I,exports.mountOreTextarea=k,exports.nextTick=C,exports.propsToAttrs=D,exports.queryAllInShadow=g,exports.queryInShadow=h,exports.queryPart=_,Object.defineProperty(exports,"resetIdCounter",{enumerable:!0,get:function(){return e.resetIdCounter}}),exports.wait=w;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@vielzeug/ore"),t=require("@vielzeug/assay"),n=require("@vielzeug/ore/testing");var r=e=>e.getAttribute(`aria-invalid`)===`true`,i=e=>e.getAttribute(`aria-disabled`)===`true`,a=e=>e.getAttribute(`aria-checked`)===`true`,o=e=>e.getAttribute(`aria-checked`)===`mixed`,s=e=>e.getAttribute(`aria-expanded`)===`true`,c=e=>e.getAttribute(`aria-pressed`)===`true`,l=e=>e.getAttribute(`aria-required`)===`true`,u=e=>e.getAttribute(`aria-hidden`)===`true`,d=e=>e.getAttribute(`aria-label`),f=e=>e.getAttribute(`aria-labelledby`),p=e=>e.getAttribute(`aria-describedby`),m=e=>e.getAttribute(`aria-controls`),h=e=>e.getAttribute(`role`),g=e=>e.value??null,_=e=>e.validity?.valid??!0,v=e=>({ariaLabel:e.getAttribute(`aria-label`),checked:e.getAttribute(`aria-checked`),disabled:e.getAttribute(`aria-disabled`),expanded:e.getAttribute(`aria-expanded`),invalid:e.getAttribute(`aria-invalid`),labelledby:e.getAttribute(`aria-labelledby`),required:e.getAttribute(`aria-required`),role:e.getAttribute(`role`)}),y=e=>Object.entries(e).map(([e,t])=>t===``?e:`${e}="${t.replace(/"/g,`&quot;`)}"`).join(` `),b=(e={})=>{let t={};for(let[n,r]of Object.entries(e))if(!(r===!1||r==null))if(r===!0)t[n]=``;else if(Array.isArray(r)){if(r.length>0&&typeof r[0]==`object`)continue;t[n]=r.join(`,`)}else t[n]=String(r);return t},x=(e,t)=>(0,n.mount)(`<ore-input ${y(b(e))}>${t?.innerHTML??``}</ore-input>`),S=(e,t)=>(0,n.mount)(`<ore-textarea ${y(b(e))}>${t?.innerHTML??``}</ore-textarea>`),C=(e,t)=>(0,n.mount)(`<ore-select ${y(b(e))}>${t?.innerHTML??``}</ore-select>`),w=(e,t)=>(0,n.mount)(`<ore-combobox ${y(b(e))}>${t?.innerHTML??``}</ore-combobox>`),T=(e,t)=>(0,n.mount)(`<ore-checkbox ${y(b(e))}>${t?.innerHTML??``}</ore-checkbox>`),E=(e,t)=>(0,n.mount)(`<ore-checkbox-group ${y(b(e))}>${t?.innerHTML??``}</ore-checkbox-group>`),D=(e,t)=>(0,n.mount)(`<ore-radio ${y(b(e))}>${t?.innerHTML??``}</ore-radio>`),O=(e,t)=>(0,n.mount)(`<ore-radio-group ${y(b(e))}>${t?.innerHTML??``}</ore-radio-group>`),k=(e,t)=>(0,n.mount)(`<ore-switch ${y(b(e))}>${t?.innerHTML??``}</ore-switch>`),A=(e,t)=>(0,n.mount)(`<ore-button ${y(b(e))}>${t?.innerHTML??``}</ore-button>`),j=(e,t)=>(0,n.mount)(`<ore-button-group ${y(b(e))}>${t?.innerHTML??``}</ore-button-group>`),M=(e,t)=>(0,n.mount)(`<ore-file-input ${y(b(e))}>${t?.innerHTML??``}</ore-file-input>`),N=(e,t)=>(0,n.mount)(`<ore-form ${y(b(e))}>${t?.innerHTML??``}</ore-form>`),P=(e,t)=>(0,n.mount)(`<ore-number-input ${y(b(e))}>${t?.innerHTML??``}</ore-number-input>`),F=(e,t)=>(0,n.mount)(`<ore-otp-input ${y(b(e))}>${t?.innerHTML??``}</ore-otp-input>`),I=(e,t)=>(0,n.mount)(`<ore-rating ${y(b(e))}>${t?.innerHTML??``}</ore-rating>`),L=(e,t)=>(0,n.mount)(`<ore-slider ${y(b(e))}>${t?.innerHTML??``}</ore-slider>`);exports.attrsToHtml=y,exports.getAriaControls=m,exports.getAriaDescribedBy=p,exports.getAriaLabel=d,exports.getAriaLabelledBy=f,exports.getAriaState=v,exports.getFormValue=g,exports.getRole=h,Object.defineProperty(exports,"getSlotted",{enumerable:!0,get:function(){return t.getSlotted}}),exports.isAriaChecked=a,exports.isAriaDisabled=i,exports.isAriaExpanded=s,exports.isAriaHidden=u,exports.isAriaIndeterminate=o,exports.isAriaInvalid=r,exports.isAriaPressed=c,exports.isAriaRequired=l,exports.isFormValid=_,exports.mountOreButton=A,exports.mountOreButtonGroup=j,exports.mountOreCheckbox=T,exports.mountOreCheckboxGroup=E,exports.mountOreCombobox=w,exports.mountOreFileInput=M,exports.mountOreForm=N,exports.mountOreInput=x,exports.mountOreNumberInput=P,exports.mountOreOtpInput=F,exports.mountOreRadio=D,exports.mountOreRadioGroup=O,exports.mountOreRating=I,exports.mountOreSelect=C,exports.mountOreSlider=L,exports.mountOreSwitch=k,exports.mountOreTextarea=S,Object.defineProperty(exports,"nextTick",{enumerable:!0,get:function(){return t.nextTick}}),exports.propsToAttrs=b,Object.defineProperty(exports,"queryAllInShadow",{enumerable:!0,get:function(){return t.queryAllInShadow}}),Object.defineProperty(exports,"queryInShadow",{enumerable:!0,get:function(){return t.queryInShadow}}),Object.defineProperty(exports,"queryPart",{enumerable:!0,get:function(){return t.queryPart}}),Object.defineProperty(exports,"resetStableIdCounter",{enumerable:!0,get:function(){return e.resetStableIdCounter}}),Object.defineProperty(exports,"wait",{enumerable:!0,get:function(){return t.wait}});
2
2
  //# sourceMappingURL=testing.cjs.map