pxd 0.1.2 → 0.1.4

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 (349) hide show
  1. package/dist/components/_internal/calendar-day.vue +19 -19
  2. package/dist/components/_internal/dismiss-container.d.vue.ts +1 -1
  3. package/dist/components/_internal/dismiss-container.vue +20 -20
  4. package/dist/components/_internal/loading-mask.vue +9 -1
  5. package/dist/components/_internal/mention-editor.vue +3 -3
  6. package/dist/components/_internal/popover-arrow.d.vue.ts +1 -1
  7. package/dist/components/_internal/popover-arrow.vue +1 -1
  8. package/dist/components/{steps → _internal}/step-item.d.vue.ts +1 -1
  9. package/dist/components/{steps → _internal}/step-item.vue +2 -2
  10. package/dist/components/_internal/tree-node.d.vue.ts +23 -20
  11. package/dist/components/_internal/tree-node.vue +68 -51
  12. package/dist/components/active-graph/index.d.vue.ts +2 -2
  13. package/dist/components/active-graph/index.vue +1 -1
  14. package/dist/components/approval-card/index.d.vue.ts +1 -1
  15. package/dist/components/approval-card/index.vue +34 -17
  16. package/dist/components/approval-card/types.d.ts +1 -1
  17. package/dist/components/avatar/index.vue +2 -2
  18. package/dist/components/backtop/index.d.vue.ts +3 -3
  19. package/dist/components/backtop/index.vue +17 -17
  20. package/dist/components/backtop/types.d.ts +1 -1
  21. package/dist/components/badge/index.d.vue.ts +3 -3
  22. package/dist/components/badge/index.vue +45 -45
  23. package/dist/components/badge/types.d.ts +1 -1
  24. package/dist/components/book/types.d.ts +1 -1
  25. package/dist/components/border-beam/index.vue +1 -1
  26. package/dist/components/border-beam/types.d.ts +1 -1
  27. package/dist/components/browser/index.vue +1 -1
  28. package/dist/components/bubble/index.vue +6 -6
  29. package/dist/components/bubble-group/index.d.vue.ts +4 -4
  30. package/dist/components/button/index.d.vue.ts +4 -4
  31. package/dist/components/button/index.vue +18 -17
  32. package/dist/components/button/types.d.ts +2 -2
  33. package/dist/components/button-group/types.d.ts +2 -2
  34. package/dist/components/calendar/index.d.vue.ts +2 -2
  35. package/dist/components/calendar/index.vue +10 -10
  36. package/dist/components/calendar/types.d.ts +1 -1
  37. package/dist/components/card/index.vue +2 -2
  38. package/dist/components/card/types.d.ts +1 -1
  39. package/dist/components/carousel/index.d.vue.ts +6 -7
  40. package/dist/components/carousel/index.vue +23 -18
  41. package/dist/components/carousel/types.d.ts +1 -2
  42. package/dist/components/checkbox/index.vue +2 -2
  43. package/dist/components/checkbox/types.d.ts +1 -1
  44. package/dist/components/checkbox-group/index.d.vue.ts +2 -2
  45. package/dist/components/checkbox-group/types.d.ts +1 -1
  46. package/dist/components/chip/index.d.vue.ts +1 -1
  47. package/dist/components/chip/types.d.ts +1 -1
  48. package/dist/components/choicebox/index.d.vue.ts +3 -3
  49. package/dist/components/choicebox/types.d.ts +1 -1
  50. package/dist/components/choicebox-item/index.vue +10 -10
  51. package/dist/components/choicebox-item/types.d.ts +1 -1
  52. package/dist/components/code-block/index.d.vue.ts +22 -0
  53. package/dist/components/code-block/index.vue +166 -0
  54. package/dist/components/code-block/types.d.ts +14 -0
  55. package/dist/components/collapse/index.vue +2 -2
  56. package/dist/components/collapse-group/index.vue +1 -1
  57. package/dist/components/collapse-group/types.d.ts +1 -1
  58. package/dist/components/command-menu/index.d.vue.ts +4 -4
  59. package/dist/components/command-menu/index.vue +11 -5
  60. package/dist/components/config-provider/index.d.vue.ts +44 -5
  61. package/dist/components/config-provider/types.d.ts +2 -1
  62. package/dist/components/confirm-popover/index.d.vue.ts +38 -0
  63. package/dist/components/confirm-popover/index.vue +203 -0
  64. package/dist/components/confirm-popover/types.d.ts +25 -0
  65. package/dist/components/copy-button/index.d.vue.ts +2 -6
  66. package/dist/components/copy-button/index.vue +4 -10
  67. package/dist/components/dash-line/index.d.vue.ts +1 -1
  68. package/dist/components/dash-line/index.vue +8 -8
  69. package/dist/components/dash-line/types.d.ts +1 -1
  70. package/dist/components/date-picker/index.d.vue.ts +1 -1
  71. package/dist/components/date-picker/index.vue +4 -4
  72. package/dist/components/date-picker/types.d.ts +1 -1
  73. package/dist/components/description/index.vue +1 -1
  74. package/dist/components/drawer/index.d.vue.ts +10 -10
  75. package/dist/components/drawer/index.vue +36 -27
  76. package/dist/components/drawer/types.d.ts +2 -2
  77. package/dist/components/effort-slider/index.vue +12 -18
  78. package/dist/components/effort-slider/types.d.ts +1 -1
  79. package/dist/components/ellipsis-text/index.d.vue.ts +2 -2
  80. package/dist/components/ellipsis-text/index.vue +76 -76
  81. package/dist/components/error/index.vue +2 -2
  82. package/dist/components/error/types.d.ts +1 -1
  83. package/dist/components/fader/index.vue +2 -2
  84. package/dist/components/fader/types.d.ts +1 -1
  85. package/dist/components/gauge/index.vue +2 -2
  86. package/dist/components/gauge/types.d.ts +1 -1
  87. package/dist/components/grid/types.d.ts +1 -1
  88. package/dist/components/grid-item/types.d.ts +1 -1
  89. package/dist/components/hint/index.d.vue.ts +32 -0
  90. package/dist/components/hint/index.vue +239 -0
  91. package/dist/components/hint/types.d.ts +17 -0
  92. package/dist/components/hold-button/index.d.vue.ts +4 -4
  93. package/dist/components/hold-button/index.vue +10 -10
  94. package/dist/components/image-preview/index.d.vue.ts +38 -0
  95. package/dist/components/image-preview/index.vue +351 -0
  96. package/dist/components/image-preview/types.d.ts +18 -0
  97. package/dist/components/index.d.ts +6 -0
  98. package/dist/components/index.js +6 -0
  99. package/dist/components/input/index.d.vue.ts +1 -1
  100. package/dist/components/input/index.vue +19 -11
  101. package/dist/components/input/types.d.ts +1 -1
  102. package/dist/components/intersection-observer/index.vue +3 -3
  103. package/dist/components/kbd/index.vue +3 -3
  104. package/dist/components/kbd/types.d.ts +1 -1
  105. package/dist/components/link-button/index.d.vue.ts +5 -5
  106. package/dist/components/list/index.d.vue.ts +4 -4
  107. package/dist/components/list/index.vue +126 -47
  108. package/dist/components/list/types.d.ts +1 -1
  109. package/dist/components/list-group/index.vue +7 -1
  110. package/dist/components/list-group/types.d.ts +1 -1
  111. package/dist/components/list-item/index.d.vue.ts +2 -2
  112. package/dist/components/list-item/index.vue +42 -11
  113. package/dist/components/loading-bar/index.vue +5 -5
  114. package/dist/components/marching-ants/index.d.vue.ts +2 -2
  115. package/dist/components/marching-ants/index.vue +56 -56
  116. package/dist/components/marching-ants/types.d.ts +1 -1
  117. package/dist/components/marquee/index.d.vue.ts +6 -6
  118. package/dist/components/marquee/index.vue +22 -18
  119. package/dist/components/marquee/types.d.ts +1 -1
  120. package/dist/components/material/index.d.vue.ts +3 -3
  121. package/dist/components/mention/index.d.vue.ts +4 -4
  122. package/dist/components/mention/index.vue +68 -68
  123. package/dist/components/menu/index.d.vue.ts +4 -4
  124. package/dist/components/menu/index.vue +10 -10
  125. package/dist/components/menu/types.d.ts +1 -1
  126. package/dist/components/message/index.d.vue.ts +1 -1
  127. package/dist/components/message/index.vue +20 -26
  128. package/dist/components/message/types.d.ts +1 -1
  129. package/dist/components/message-item/index.vue +2 -6
  130. package/dist/components/modal/index.d.vue.ts +9 -9
  131. package/dist/components/modal/index.vue +32 -23
  132. package/dist/components/modal/types.d.ts +2 -2
  133. package/dist/components/noise-background/types.d.ts +1 -1
  134. package/dist/components/note/index.vue +7 -3
  135. package/dist/components/note/types.d.ts +2 -1
  136. package/dist/components/number-input/index.d.vue.ts +11 -6
  137. package/dist/components/number-input/index.vue +61 -20
  138. package/dist/components/number-input/types.d.ts +2 -1
  139. package/dist/components/overlay/index.d.vue.ts +2 -4
  140. package/dist/components/overlay/index.vue +12 -70
  141. package/dist/components/overlay/types.d.ts +1 -4
  142. package/dist/components/page-number/index.vue +30 -29
  143. package/dist/components/page-number/types.d.ts +1 -1
  144. package/dist/components/pagination/index.vue +4 -4
  145. package/dist/components/pin-input/index.vue +11 -7
  146. package/dist/components/pin-input/types.d.ts +1 -1
  147. package/dist/components/popover/index.vue +72 -39
  148. package/dist/components/popover/types.d.ts +4 -1
  149. package/dist/components/progress/index.d.vue.ts +2 -2
  150. package/dist/components/progress/index.vue +12 -12
  151. package/dist/components/progress/types.d.ts +1 -1
  152. package/dist/components/project-banner/index.vue +22 -9
  153. package/dist/components/project-banner/types.d.ts +1 -1
  154. package/dist/components/questionnaire/index.vue +15 -15
  155. package/dist/components/radio/index.vue +1 -1
  156. package/dist/components/radio/types.d.ts +1 -1
  157. package/dist/components/radio-group/index.d.vue.ts +2 -2
  158. package/dist/components/radio-group/types.d.ts +1 -1
  159. package/dist/components/rating/index.vue +28 -28
  160. package/dist/components/rating/types.d.ts +1 -1
  161. package/dist/components/resizable/index.d.vue.ts +6 -0
  162. package/dist/components/resizable/index.vue +320 -236
  163. package/dist/components/resizable/types.d.ts +8 -10
  164. package/dist/components/reveal/index.d.vue.ts +3 -3
  165. package/dist/components/reveal/index.vue +4 -4
  166. package/dist/components/reveal/types.d.ts +1 -1
  167. package/dist/components/rolling-number/index.d.vue.ts +2 -2
  168. package/dist/components/rolling-number/index.vue +15 -15
  169. package/dist/components/scalable-text/index.vue +9 -9
  170. package/dist/components/scroll-text/index.d.vue.ts +3 -3
  171. package/dist/components/scroll-text/index.vue +6 -6
  172. package/dist/components/scroll-text/types.d.ts +1 -1
  173. package/dist/components/scrollable/types.d.ts +2 -1
  174. package/dist/components/search-input/index.d.vue.ts +5 -5
  175. package/dist/components/search-input/index.vue +2 -1
  176. package/dist/components/select/index.d.vue.ts +12 -9
  177. package/dist/components/select/index.vue +167 -42
  178. package/dist/components/select/types.d.ts +3 -1
  179. package/dist/components/separator/index.d.vue.ts +1 -1
  180. package/dist/components/separator/types.d.ts +1 -1
  181. package/dist/components/skeleton/index.vue +11 -11
  182. package/dist/components/skeleton/types.d.ts +1 -1
  183. package/dist/components/slider/index.d.vue.ts +1 -1
  184. package/dist/components/slider/index.vue +1 -1
  185. package/dist/components/slider/types.d.ts +1 -1
  186. package/dist/components/snippet/index.d.vue.ts +3 -3
  187. package/dist/components/snippet/index.vue +7 -5
  188. package/dist/components/snippet/types.d.ts +1 -1
  189. package/dist/components/spinner/index.vue +5 -1
  190. package/dist/components/spinner-dots/index.d.vue.ts +1 -1
  191. package/dist/components/split-button/index.d.vue.ts +5 -5
  192. package/dist/components/split-button/types.d.ts +1 -1
  193. package/dist/components/stack/index.d.vue.ts +3 -3
  194. package/dist/components/stack/index.vue +28 -29
  195. package/dist/components/stack/types.d.ts +1 -1
  196. package/dist/components/status-dot/types.d.ts +1 -1
  197. package/dist/components/steps/index.d.vue.ts +2 -2
  198. package/dist/components/steps/index.vue +6 -6
  199. package/dist/components/steps/types.d.ts +1 -1
  200. package/dist/components/stick-to-bottom/types.d.ts +1 -1
  201. package/dist/components/swipe-cell/index.d.vue.ts +6 -6
  202. package/dist/components/swipe-cell/index.vue +64 -64
  203. package/dist/components/swipe-cell/types.d.ts +2 -1
  204. package/dist/components/switch/index.vue +2 -2
  205. package/dist/components/switch/types.d.ts +1 -1
  206. package/dist/components/switch-item/index.vue +1 -1
  207. package/dist/components/switch-item/types.d.ts +1 -1
  208. package/dist/components/tabs/index.d.vue.ts +1 -1
  209. package/dist/components/tabs/index.vue +49 -52
  210. package/dist/components/tabs/types.d.ts +1 -1
  211. package/dist/components/teleport/index.vue +22 -24
  212. package/dist/components/text/index.d.vue.ts +3 -3
  213. package/dist/components/text/index.vue +11 -11
  214. package/dist/components/text/types.d.ts +1 -1
  215. package/dist/components/textarea/index.vue +2 -1
  216. package/dist/components/textarea/types.d.ts +1 -1
  217. package/dist/components/theme-switcher/index.d.vue.ts +3 -2
  218. package/dist/components/theme-switcher/index.vue +15 -7
  219. package/dist/components/theme-switcher/types.d.ts +2 -2
  220. package/dist/components/time-ago/index.d.vue.ts +6 -0
  221. package/dist/components/time-ago/index.vue +143 -0
  222. package/dist/components/time-ago/types.d.ts +4 -0
  223. package/dist/components/time-picker/index.d.vue.ts +1 -1
  224. package/dist/components/time-picker/index.vue +11 -11
  225. package/dist/components/time-picker/types.d.ts +1 -1
  226. package/dist/components/toc/index.d.vue.ts +2 -2
  227. package/dist/components/toc/index.vue +1 -1
  228. package/dist/components/todo-list/index.d.vue.ts +5 -5
  229. package/dist/components/todo-list/index.vue +15 -15
  230. package/dist/components/todo-list/types.d.ts +1 -1
  231. package/dist/components/toggle/index.vue +4 -4
  232. package/dist/components/toggle/types.d.ts +1 -1
  233. package/dist/components/toggle-button/index.vue +24 -15
  234. package/dist/components/toggle-button/types.d.ts +4 -3
  235. package/dist/components/toggle-button-group/index.d.vue.ts +3 -3
  236. package/dist/components/toggle-button-group/index.vue +3 -2
  237. package/dist/components/toggle-button-group/types.d.ts +4 -4
  238. package/dist/components/tool-call/index.vue +5 -5
  239. package/dist/components/tooltip/index.d.vue.ts +4 -5
  240. package/dist/components/tooltip/index.vue +4 -49
  241. package/dist/components/tooltip/types.d.ts +3 -7
  242. package/dist/components/tour/index.d.vue.ts +33 -0
  243. package/dist/components/tour/index.vue +302 -0
  244. package/dist/components/tour/types.d.ts +29 -0
  245. package/dist/components/tree/index.d.vue.ts +33 -34
  246. package/dist/components/tree/index.vue +385 -293
  247. package/dist/components/tree/types.d.ts +42 -13
  248. package/dist/components/virtual-list/index.d.vue.ts +4 -4
  249. package/dist/composables/_internal/use-code-highlight.d.ts +12 -0
  250. package/dist/composables/_internal/use-code-highlight.js +47 -0
  251. package/dist/composables/_internal/use-list-keyboard-controller.js +9 -10
  252. package/dist/composables/_internal/use-list-rows.d.ts +4 -0
  253. package/dist/composables/_internal/use-list-rows.js +12 -4
  254. package/dist/composables/_internal/use-list-selection.d.ts +1 -1
  255. package/dist/composables/_internal/use-lock-scroll.d.ts +8 -1
  256. package/dist/composables/_internal/use-lock-scroll.js +39 -35
  257. package/dist/composables/_internal/use-mention-editor.js +1 -1
  258. package/dist/composables/_internal/use-message-group.d.ts +22 -0
  259. package/dist/composables/_internal/use-message-group.js +143 -0
  260. package/dist/composables/_internal/use-overlay-dialog.js +1 -3
  261. package/dist/composables/_internal/use-overlay-manager.d.ts +4 -2
  262. package/dist/composables/_internal/use-overlay-manager.js +53 -10
  263. package/dist/composables/_internal/use-popover-responsive.js +9 -12
  264. package/dist/composables/_internal/use-swipe-gesture.d.ts +2 -2
  265. package/dist/composables/_internal/use-swipe-gesture.js +5 -4
  266. package/dist/composables/_internal/use-tailwind-variant.js +1 -1
  267. package/dist/composables/_internal/use-tour-target.d.ts +29 -0
  268. package/dist/composables/_internal/use-tour-target.js +201 -0
  269. package/dist/composables/_internal/use-tree.d.ts +103 -0
  270. package/dist/composables/_internal/use-tree.js +676 -0
  271. package/dist/composables/_internal/use-word-limit.d.ts +1 -1
  272. package/dist/composables/index.d.ts +1 -0
  273. package/dist/composables/index.js +1 -0
  274. package/dist/composables/use-color-scheme.d.ts +1 -1
  275. package/dist/composables/use-color-scheme.js +7 -6
  276. package/dist/composables/use-delay-destroy.d.ts +1 -1
  277. package/dist/composables/use-document-hidden.d.ts +1 -1
  278. package/dist/composables/use-intersection-observer.d.ts +1 -1
  279. package/dist/composables/use-intersection-observer.js +1 -1
  280. package/dist/composables/use-media-query.d.ts +3 -1
  281. package/dist/composables/use-media-query.js +33 -51
  282. package/dist/composables/{_internal/use-motion-reduce.js → use-motion-reduce.js} +2 -2
  283. package/dist/composables/use-mutation-observer.d.ts +1 -1
  284. package/dist/composables/use-mutation-observer.js +1 -1
  285. package/dist/composables/use-outside-click.d.ts +2 -1
  286. package/dist/composables/use-outside-click.js +3 -7
  287. package/dist/composables/use-repeat-action.d.ts +1 -1
  288. package/dist/composables/use-repeat-action.js +3 -3
  289. package/dist/composables/use-resize-observer.d.ts +1 -1
  290. package/dist/composables/use-resize-observer.js +1 -1
  291. package/dist/composables/use-view-transition.js +1 -0
  292. package/dist/composables/use-virtual-list.d.ts +1 -1
  293. package/dist/constants/size.d.ts +1 -0
  294. package/dist/constants/size.js +7 -6
  295. package/dist/constants/tooltip-variants.d.ts +28 -0
  296. package/dist/constants/tooltip-variants.js +27 -0
  297. package/dist/contexts/avatar.js +1 -1
  298. package/dist/contexts/breadcrumb.js +1 -1
  299. package/dist/contexts/button.js +1 -1
  300. package/dist/contexts/checkbox.js +1 -1
  301. package/dist/contexts/choicebox.js +1 -1
  302. package/dist/contexts/collapse.js +1 -1
  303. package/dist/contexts/config-provider.js +1 -1
  304. package/dist/contexts/list.js +1 -1
  305. package/dist/contexts/radio.js +1 -1
  306. package/dist/contexts/switch.js +1 -1
  307. package/dist/contexts/toggle-button.js +1 -1
  308. package/dist/index.d.ts +2 -1
  309. package/dist/locales/en-us.d.ts +39 -0
  310. package/dist/locales/en-us.js +24 -0
  311. package/dist/locales/zh-cn.d.ts +39 -0
  312. package/dist/locales/zh-cn.js +24 -0
  313. package/dist/styles/styles.css +1 -1
  314. package/dist/styles/tw.css +55 -37
  315. package/dist/utils/_internal/cn-tables.d.ts +27 -0
  316. package/dist/utils/_internal/cn-tables.js +131 -0
  317. package/dist/utils/{context.js → _internal/context.js} +1 -1
  318. package/dist/utils/{observer.d.ts → _internal/observer.d.ts} +1 -1
  319. package/dist/utils/{observer.js → _internal/observer.js} +4 -4
  320. package/dist/{components/swipe-cell/instances.d.ts → utils/_internal/swipe-cell-instances.d.ts} +1 -1
  321. package/dist/utils/cn.d.ts +1 -0
  322. package/dist/utils/cn.js +3 -0
  323. package/dist/utils/event.d.ts +2 -1
  324. package/dist/utils/event.js +3 -0
  325. package/package.json +29 -51
  326. package/volar.d.ts +6 -0
  327. package/dist/components/message/composables/use-group-expand.d.ts +0 -13
  328. package/dist/components/message/composables/use-group-expand.js +0 -50
  329. package/dist/components/message/composables/use-message-timer.d.ts +0 -9
  330. package/dist/components/message/composables/use-message-timer.js +0 -62
  331. package/dist/components/message/composables/use-promise-message.d.ts +0 -4
  332. package/dist/components/message/composables/use-promise-message.js +0 -49
  333. package/dist/components/resizable/utils.d.ts +0 -4
  334. package/dist/components/resizable/utils.js +0 -10
  335. package/dist/composables/_internal/use-tree-drag.d.ts +0 -23
  336. package/dist/composables/_internal/use-tree-drag.js +0 -196
  337. package/dist/composables/_internal/use-tree-move.d.ts +0 -20
  338. package/dist/composables/_internal/use-tree-move.js +0 -96
  339. package/dist/composables/_internal/use-tree-rows.d.ts +0 -46
  340. package/dist/composables/_internal/use-tree-rows.js +0 -101
  341. package/dist/composables/_internal/use-tree-selection.d.ts +0 -22
  342. package/dist/composables/_internal/use-tree-selection.js +0 -87
  343. package/dist/styles/source.css +0 -675
  344. package/dist/types/shared/index.d.ts +0 -2
  345. /package/dist/composables/{_internal/use-motion-reduce.d.ts → use-motion-reduce.d.ts} +0 -0
  346. /package/dist/utils/{context.d.ts → _internal/context.d.ts} +0 -0
  347. /package/dist/utils/{mention-html.d.ts → _internal/mention-html.d.ts} +0 -0
  348. /package/dist/utils/{mention-html.js → _internal/mention-html.js} +0 -0
  349. /package/dist/{components/swipe-cell/instances.js → utils/_internal/swipe-cell-instances.js} +0 -0
@@ -41,18 +41,48 @@ const props = defineProps({
41
41
  const emits = defineEmits(["change", "update:modelValue"]);
42
42
  const BORDER_WIDTH = 2;
43
43
  const SCROLL_EPSILON = 2;
44
- const modelValue = useModelValue(props, emits, { withChange: false });
44
+ const uid = getUniqueId("pxd-tabs");
45
+ let resizeObserver = null;
45
46
  /** Uncontrolled fallback: a bound `modelValue` always wins. */
46
47
  const innerValue = shallowRef(props.defaultValue);
47
48
  const activeValue = computed(() => props.modelValue === undefined ? innerValue.value : props.modelValue);
48
- const slots = useSlots();
49
- const uid = getUniqueId("pxd-tabs");
50
49
  const scrollRef = shallowRef();
51
50
  const innerNavRef = shallowRef();
52
51
  const overflowing = shallowRef(false);
53
52
  const canScrollLeft = shallowRef(false);
54
53
  const canScrollRight = shallowRef(false);
55
- let resizeObserver = null;
54
+ /**
55
+ * Values whose panel was already activated. Kept as a plain array because
56
+ * reactive collections are banned here, and pruned so dynamic option lists
57
+ * cannot grow it without bound.
58
+ */
59
+ const activatedValues = shallowRef([]);
60
+ const modelValue = useModelValue(props, emits, { withChange: false });
61
+ const slots = useSlots();
62
+ /** Roving tabindex: arrow keys move focus and activate, matching the APG tabs pattern. */
63
+ const navigation = useListNavigation({
64
+ count: () => props.options.length,
65
+ isDisabled: (index) => !!props.options[index]?.disabled,
66
+ scrollToIndex: (index) => focusTab(index)
67
+ });
68
+ const { onKeydown: onNavKeydown } = useListKeyboardController({
69
+ keymap: {
70
+ ArrowRight: "next",
71
+ ArrowLeft: "previous",
72
+ Home: "first",
73
+ End: "last"
74
+ },
75
+ onCommand: (command) => {
76
+ if (!navigation.dispatch(command)) {
77
+ return false;
78
+ }
79
+ const option = props.options[navigation.activeIndex.value];
80
+ if (option) {
81
+ select(option.value);
82
+ }
83
+ return true;
84
+ }
85
+ });
56
86
  function tabId(index) {
57
87
  return `${uid}-tab-${index}`;
58
88
  }
@@ -71,26 +101,6 @@ function select(value) {
71
101
  modelValue.value = value;
72
102
  emits("change", value);
73
103
  }
74
- /**
75
- * Values whose panel was already activated. Kept as a plain array because
76
- * reactive collections are banned here, and pruned so dynamic option lists
77
- * cannot grow it without bound.
78
- */
79
- const activatedValues = shallowRef([]);
80
- watch(activeValue, (value) => {
81
- if (value !== undefined && !activatedValues.value.includes(value)) {
82
- activatedValues.value = [...activatedValues.value, value];
83
- }
84
- }, {
85
- immediate: true,
86
- flush: "sync"
87
- });
88
- watch(() => props.options.map((option) => option.value), (values) => {
89
- const kept = activatedValues.value.filter((value) => values.includes(value));
90
- if (kept.length !== activatedValues.value.length) {
91
- activatedValues.value = kept;
92
- }
93
- });
94
104
  function isActivated(option) {
95
105
  return isActiveOption(option) || activatedValues.value.includes(option.value);
96
106
  }
@@ -159,30 +169,6 @@ function focusTab(index) {
159
169
  tab?.focus();
160
170
  scrollActiveTabIntoView();
161
171
  }
162
- /** Roving tabindex: arrow keys move focus and activate, matching the APG tabs pattern. */
163
- const navigation = useListNavigation({
164
- count: () => props.options.length,
165
- isDisabled: (index) => !!props.options[index]?.disabled,
166
- scrollToIndex: (index) => focusTab(index)
167
- });
168
- const { onKeydown: onNavKeydown } = useListKeyboardController({
169
- keymap: {
170
- ArrowRight: "next",
171
- ArrowLeft: "previous",
172
- Home: "first",
173
- End: "last"
174
- },
175
- onCommand: (command) => {
176
- if (!navigation.dispatch(command)) {
177
- return false;
178
- }
179
- const option = props.options[navigation.activeIndex.value];
180
- if (option) {
181
- select(option.value);
182
- }
183
- return true;
184
- }
185
- });
186
172
  function teardownScrollObservers() {
187
173
  resizeObserver?.disconnect();
188
174
  resizeObserver = null;
@@ -204,6 +190,20 @@ function setupScrollObservers() {
204
190
  }
205
191
  updateScrollState();
206
192
  }
193
+ watch(activeValue, (value) => {
194
+ if (value !== undefined && !activatedValues.value.includes(value)) {
195
+ activatedValues.value = [...activatedValues.value, value];
196
+ }
197
+ }, {
198
+ immediate: true,
199
+ flush: "sync"
200
+ });
201
+ watch(() => props.options.map((option) => option.value), (values) => {
202
+ const kept = activatedValues.value.filter((value) => values.includes(value));
203
+ if (kept.length !== activatedValues.value.length) {
204
+ activatedValues.value = kept;
205
+ }
206
+ });
207
207
  watch(() => props.options.length, () => {
208
208
  nextTick(setupScrollObservers);
209
209
  }, { flush: "post" });
@@ -217,9 +217,6 @@ watch(() => [activeValue.value, props.options.length], () => {
217
217
  if (index >= 0) {
218
218
  navigation.setActiveIndex(index);
219
219
  }
220
- if (import.meta.env?.DEV && activeValue.value !== undefined && index < 0) {
221
- console.warn(`[pxd] PTabs: active value "${String(activeValue.value)}" matches no option.`);
222
- }
223
220
  }, {
224
221
  immediate: true,
225
222
  flush: "post"
@@ -312,5 +309,5 @@ onBeforeUnmount(() => {
312
309
  </template>
313
310
 
314
311
  <style>
315
- .pxd-tabs--header[data-variant=default]{box-shadow:0 -1px 0 0 var(--color-border) inset;padding-bottom:1px}.pxd-tabs--header[data-variant=default]+.pxd-tabs--content{padding-top:.75rem}.pxd-tabs--header[data-variant=default] .pxd-tabs--scroll{margin-bottom:-1px}.pxd-tabs--header[data-variant=default] .pxd-tabs--nav{gap:1.5rem}.pxd-tabs--header[data-variant=default] .pxd-tabs--nav-item{border-bottom:2px solid transparent;padding:.875rem .375rem}.pxd-tabs--header[data-variant=default] .pxd-tabs--nav-item:not(:disabled){color:var(--color-gray-900)}.pxd-tabs--header[data-variant=default] .pxd-tabs--nav-item[aria-selected=true]{border-color:currentColor;color:var(--color-primary)}.pxd-tabs--header[data-variant=secondary]+.pxd-tabs--content{padding-top:.5rem}.pxd-tabs--header[data-variant=secondary] .pxd-tabs--nav{gap:.5rem}.pxd-tabs--header[data-variant=secondary] .pxd-tabs--nav-item{background-color:var(--color-gray-alpha-200);border-radius:var(--radius-md);font-size:var(--text-13);height:1.5rem;padding:0 .375rem}.pxd-tabs--header[data-variant=secondary] .pxd-tabs--nav-item:disabled{background-color:var(--color-gray-100)}.pxd-tabs--header[data-variant=secondary] .pxd-tabs--nav-item[aria-selected=true]{background-color:var(--color-primary);color:var(--color-gray-100)}.pxd-tabs--header[data-variant=segmented]{background-color:var(--color-gray-alpha-200);border-radius:var(--radius-md);color:var(--color-gray-800);padding:.25rem;width:-moz-max-content;width:max-content}.pxd-tabs--header[data-variant=segmented]+.pxd-tabs--content{padding-top:.75rem}.pxd-tabs--header[data-variant=segmented] .pxd-tabs--arrow{border-width:0}.pxd-tabs--header[data-variant=segmented] .pxd-tabs--nav{gap:.25rem}.pxd-tabs--header[data-variant=segmented] .pxd-tabs--nav-item{border-radius:var(--radius-sm);height:1.5rem;padding:0 .5rem}.pxd-tabs--header[data-variant=segmented] .pxd-tabs--nav-item:hover{color:var(--color-foreground)}.pxd-tabs--header[data-variant=segmented] .pxd-tabs--nav-item:disabled{color:var(--color-gray-500)}.pxd-tabs--header[data-variant=segmented] .pxd-tabs--nav-item[aria-selected=true]{background-color:var(--color-background-100);box-shadow:var(--shadow-small);color:var(--color-foreground)}
312
+ .pxd-tabs--header[data-variant=default]{box-shadow:0 -1px 0 0 var(--color-border) inset;padding-bottom:1px}.pxd-tabs--header[data-variant=default]+.pxd-tabs--content{padding-top:.75rem}.pxd-tabs--header[data-variant=default] .pxd-tabs--scroll{margin-bottom:-1px}.pxd-tabs--header[data-variant=default] .pxd-tabs--nav{gap:1.5rem}.pxd-tabs--header[data-variant=default] .pxd-tabs--nav-item{border-bottom:2px solid transparent;padding:.875rem .375rem}.pxd-tabs--header[data-variant=default] .pxd-tabs--nav-item:not(:disabled){color:var(--color-gray-900)}.pxd-tabs--header[data-variant=default] .pxd-tabs--nav-item[aria-selected=true]{border-color:currentColor;color:var(--color-primary)}.pxd-tabs--header[data-variant=secondary]+.pxd-tabs--content{padding-top:.5rem}.pxd-tabs--header[data-variant=secondary] .pxd-tabs--nav{gap:.5rem}.pxd-tabs--header[data-variant=secondary] .pxd-tabs--nav-item{background-color:var(--color-gray-alpha-200);border-radius:var(--radius-md);font-size:var(--text-13px);height:1.5rem;padding:0 .375rem}.pxd-tabs--header[data-variant=secondary] .pxd-tabs--nav-item:disabled{background-color:var(--color-gray-100)}.pxd-tabs--header[data-variant=secondary] .pxd-tabs--nav-item[aria-selected=true]{background-color:var(--color-primary);color:var(--color-gray-100)}.pxd-tabs--header[data-variant=segmented]{background-color:var(--color-gray-alpha-200);border-radius:var(--radius-md);color:var(--color-gray-800);padding:.25rem;width:-moz-max-content;width:max-content}.pxd-tabs--header[data-variant=segmented]+.pxd-tabs--content{padding-top:.75rem}.pxd-tabs--header[data-variant=segmented] .pxd-tabs--arrow{border-width:0}.pxd-tabs--header[data-variant=segmented] .pxd-tabs--nav{gap:.25rem}.pxd-tabs--header[data-variant=segmented] .pxd-tabs--nav-item{border-radius:var(--radius-sm);height:1.5rem;padding:0 .5rem}.pxd-tabs--header[data-variant=segmented] .pxd-tabs--nav-item:hover{color:var(--color-foreground)}.pxd-tabs--header[data-variant=segmented] .pxd-tabs--nav-item:disabled{color:var(--color-gray-500)}.pxd-tabs--header[data-variant=segmented] .pxd-tabs--nav-item[aria-selected=true]{background-color:var(--color-background-100);box-shadow:var(--shadow-small);color:var(--color-foreground)}
316
313
  </style>
@@ -1,4 +1,4 @@
1
- import type { ComponentOption, ComponentValue } from '../../types/shared'
1
+ import type { ComponentOption, ComponentValue } from '../../types/shared/props'
2
2
 
3
3
  export interface TabsOptions extends ComponentOption {
4
4
  label?: ComponentOption['label']
@@ -18,13 +18,13 @@ const props = defineProps({
18
18
  });
19
19
  const inVue3 = isVue3();
20
20
  const inServer = isServer();
21
+ let isTeleported = false;
22
+ let homeLocation;
21
23
  // A teleported subtree cannot be prerendered: the content never reaches the HTML, so
22
24
  // hydration would rebuild it elsewhere and leave the server copy orphaned. Render it
23
25
  // in place for the server pass and for the first client render, then move it.
24
26
  const mounted = shallowRef(false);
25
27
  const isDisabled = computed(() => props.disabled || !mounted.value);
26
- let isTeleported = false;
27
- let homeLocation;
28
28
  const containerRef = shallowRef();
29
29
  const targetEl = computed(() => {
30
30
  const { disabled, to } = props;
@@ -40,6 +40,24 @@ const targetEl = computed(() => {
40
40
  } catch {}
41
41
  return container ?? document.body;
42
42
  });
43
+ function syncContainer() {
44
+ const el = containerRef.value;
45
+ if (!el || !homeLocation) {
46
+ return;
47
+ }
48
+ if (props.disabled) {
49
+ if (isTeleported) {
50
+ const { parent, nextSibling } = homeLocation;
51
+ parent.insertBefore(el, nextSibling);
52
+ isTeleported = false;
53
+ }
54
+ return;
55
+ }
56
+ if (targetEl.value) {
57
+ targetEl.value.append(el);
58
+ isTeleported = true;
59
+ }
60
+ }
43
61
  onMounted(() => {
44
62
  mounted.value = true;
45
63
  if (inVue3 || inServer) {
@@ -51,29 +69,9 @@ onMounted(() => {
51
69
  parent: el.parentNode,
52
70
  nextSibling: el.nextSibling
53
71
  };
54
- if (!props.disabled && targetEl.value) {
55
- targetEl.value.append(el);
56
- isTeleported = true;
57
- }
72
+ syncContainer();
58
73
  }
59
- watch(() => [targetEl.value, props.disabled], () => {
60
- const el = containerRef.value;
61
- if (!el || !homeLocation) {
62
- return;
63
- }
64
- if (props.disabled) {
65
- if (isTeleported) {
66
- const { parent, nextSibling } = homeLocation;
67
- parent.insertBefore(el, nextSibling);
68
- isTeleported = false;
69
- }
70
- return;
71
- }
72
- if (targetEl.value) {
73
- targetEl.value.append(el);
74
- isTeleported = true;
75
- }
76
- });
74
+ watch(() => [targetEl.value, props.disabled], syncContainer);
77
75
  });
78
76
  onBeforeUnmount(() => {
79
77
  if (inVue3) {
@@ -1,11 +1,11 @@
1
1
  import type { TextProps } from './types';
2
- declare var __VLS_8: {};
2
+ declare var __VLS_7: {};
3
3
  type __VLS_Slots = {} & {
4
- default?: (props: typeof __VLS_8) => any;
4
+ default?: (props: typeof __VLS_7) => any;
5
5
  };
6
6
  declare const __VLS_base: import("vue").DefineComponent<TextProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TextProps> & Readonly<{}>, {
7
7
  as: import("../../types/shared/props.js").ComponentAs;
8
- align: "left" | "center" | "right";
8
+ align: "center" | "left" | "right";
9
9
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
10
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
11
11
  declare const _default: typeof __VLS_export;
@@ -39,6 +39,17 @@ const props = defineProps({
39
39
  required: false
40
40
  }
41
41
  });
42
+ const presetSize = {
43
+ "--text-xs": "text-xs",
44
+ "--text-sm": "sm:text-sm",
45
+ "--text-md": "md:text-md",
46
+ "--text-lg": "lg:text-lg",
47
+ "--text-xl": "xl:text-xl"
48
+ };
49
+ const computedStyle = computed(() => {
50
+ const { size } = props;
51
+ return getResponsiveValue(size, (typeof size === "object" ? size.xs : size) ?? "14px", (acc, bp, value) => acc[bp] = acc[`--text-${bp}`] = getCssUnitValue(value));
52
+ });
42
53
  const { attrs, classes: variantClasses } = useTailwindVariant({
43
54
  base: "pxd-text m-0 shrink-0",
44
55
  variants: {
@@ -55,17 +66,6 @@ const { attrs, classes: variantClasses } = useTailwindVariant({
55
66
  monospace: props.monospace,
56
67
  secondary: props.secondary
57
68
  }) });
58
- const presetSize = {
59
- "--text-xs": "text-xs",
60
- "--text-sm": "sm:text-sm",
61
- "--text-md": "md:text-md",
62
- "--text-lg": "lg:text-lg",
63
- "--text-xl": "xl:text-xl"
64
- };
65
- const computedStyle = computed(() => {
66
- const { size } = props;
67
- return getResponsiveValue(size, (typeof size === "object" ? size.xs : size) ?? "14px", (acc, bp, value) => acc[bp] = acc[`--text-${bp}`] = getCssUnitValue(value));
68
- });
69
69
  const computedClasses = computed(() => {
70
70
  const classes = [variantClasses.value, ...Object.keys(computedStyle.value).map((bp) => presetSize[bp])].filter(Boolean);
71
71
  return classes;
@@ -1,4 +1,4 @@
1
- import type { ComponentAs, ResponsiveValue } from '../../types/shared'
1
+ import type { ComponentAs, ResponsiveValue } from '../../types/shared/props'
2
2
 
3
3
  export interface TextProps {
4
4
  as?: ComponentAs
@@ -82,9 +82,9 @@ const emits = defineEmits([
82
82
  "blur"
83
83
  ]);
84
84
  const uniqueId = getUniqueId();
85
+ const isComposing = shallowRef(false);
85
86
  const modelValue = useModelValue(props, emits);
86
87
  const configProvider = useConfigProvider();
87
- const isComposing = shallowRef(false);
88
88
  const { isWordLimitShown, hasMaxLength, isWordLimitOutside, isWordLimitExceeded, wordLimitText, nativeMaxLength } = useWordLimit({
89
89
  modelValue,
90
90
  showWordLimit: () => props.showWordLimit,
@@ -156,6 +156,7 @@ function onCompositionEnd(event) {
156
156
  v-model="modelValue"
157
157
  class="py-2.5 px-3 size-full min-h-inherit resize-none appearance-none rounded-inherit border-none bg-transparent font-inherit outline-none placeholder:text-gray-600 placeholder:select-none disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-700 disabled:placeholder:text-gray-400"
158
158
  :class="nativeTextareaClasses"
159
+ spellcheck="false"
159
160
  autocorrect="off"
160
161
  autocomplete="off"
161
162
  autocapitalize="off"
@@ -1,4 +1,4 @@
1
- import type { ComponentLabel, ComponentSizeWithXs } from '../../types/shared'
1
+ import type { ComponentLabel, ComponentSizeWithXs } from '../../types/shared/props'
2
2
 
3
3
  export interface TextareaProps {
4
4
  rows?: string | number
@@ -1,7 +1,8 @@
1
+ import type { ColorPreference } from '../../composables/use-color-scheme';
1
2
  declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
2
- toggle: (args_0: import("../../composables/use-color-scheme.js").ColorScheme) => any;
3
+ toggle: (args_0: ColorPreference) => any;
3
4
  }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
4
- onToggle?: ((args_0: import("../../composables/use-color-scheme.js").ColorScheme) => any) | undefined;
5
+ onToggle?: ((args_0: ColorPreference) => any) | undefined;
5
6
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
7
  declare const _default: typeof __VLS_export;
7
8
  export default _default;
@@ -1,4 +1,5 @@
1
1
  <script setup>
2
+ import DeviceAlternateIcon from "@gdsicon/vue/device-alternate";
2
3
  import MoonIcon from "@gdsicon/vue/moon";
3
4
  import SunIcon from "@gdsicon/vue/sun";
4
5
  import { computed, watch } from "vue";
@@ -9,22 +10,29 @@ defineOptions({
9
10
  inheritAttrs: false
10
11
  });
11
12
  const emits = defineEmits(["toggle"]);
12
- const { isDark, toggleDarkMode } = useColorScheme({ syncStatus: true });
13
- const renderIcon = computed(() => isDark.value ? MoonIcon : SunIcon);
14
- watch(() => isDark.value, (newVal) => {
15
- emits("toggle", newVal ? "dark" : "light");
13
+ const SCHEME_ICONS = {
14
+ auto: DeviceAlternateIcon,
15
+ light: SunIcon,
16
+ dark: MoonIcon
17
+ };
18
+ const { colorScheme, toggleDarkMode } = useColorScheme({ syncStatus: true });
19
+ const renderIcon = computed(() => SCHEME_ICONS[colorScheme.value]);
20
+ watch(() => colorScheme.value, (newVal) => {
21
+ emits("toggle", newVal);
16
22
  });
17
23
  </script>
18
24
 
19
25
  <template>
20
26
  <PButton
27
+ icon
21
28
  data-theme-switcher
22
29
  aria-label="Toggle color mode"
23
30
  class="pxd-theme-switcher"
24
31
  v-bind="$attrs"
25
- icon
26
- @click="toggleDarkMode"
32
+ @click="toggleDarkMode()"
27
33
  >
28
- <Component :is="renderIcon" class="size-em" />
34
+ <Transition name="pxd-transition--fade-scale" mode="out-in">
35
+ <Component :is="renderIcon" class="size-em" />
36
+ </Transition>
29
37
  </PButton>
30
38
  </template>
@@ -1,5 +1,5 @@
1
- import type { ColorScheme } from '../../composables/use-color-scheme'
1
+ import type { ColorPreference } from '../../composables/use-color-scheme'
2
2
 
3
3
  export interface ThemeSwitcherEmits {
4
- toggle: [ColorScheme]
4
+ toggle: [ColorPreference]
5
5
  }
@@ -0,0 +1,6 @@
1
+ import type { TimeAgoProps } from './types';
2
+ declare const __VLS_export: import("vue").DefineComponent<TimeAgoProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TimeAgoProps> & Readonly<{}>, {
3
+ refresh: boolean;
4
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
@@ -0,0 +1,143 @@
1
+ <script setup>
2
+ import { computed, onActivated, onDeactivated, onMounted, onUnmounted, shallowRef, watch } from "vue";
3
+ import { useConfigProvider } from "../../contexts/config-provider.js";
4
+ import { dayjs } from "../../utils/date.js";
5
+ import { cachedOn, cachedOff } from "../../utils/event.js";
6
+ defineOptions({
7
+ name: "PTimeAgo",
8
+ inheritAttrs: false
9
+ });
10
+ const props = defineProps({
11
+ value: {
12
+ type: [
13
+ String,
14
+ Number,
15
+ Date
16
+ ],
17
+ required: true
18
+ },
19
+ refresh: {
20
+ type: Boolean,
21
+ required: false,
22
+ default: true
23
+ }
24
+ });
25
+ const SECOND = 1e3;
26
+ const MINUTE = 60 * SECOND;
27
+ const HOUR = 60 * MINUTE;
28
+ const DAY = 24 * HOUR;
29
+ const MONTH = 30 * DAY;
30
+ const YEAR = 365 * DAY;
31
+ const BUCKETS = [
32
+ {
33
+ unit: "now",
34
+ size: MINUTE,
35
+ limit: MINUTE
36
+ },
37
+ {
38
+ unit: "minute",
39
+ size: MINUTE,
40
+ limit: HOUR
41
+ },
42
+ {
43
+ unit: "hour",
44
+ size: HOUR,
45
+ limit: DAY
46
+ },
47
+ {
48
+ unit: "day",
49
+ size: DAY,
50
+ limit: MONTH
51
+ },
52
+ {
53
+ unit: "month",
54
+ size: MONTH,
55
+ limit: YEAR
56
+ },
57
+ {
58
+ unit: "year",
59
+ size: YEAR,
60
+ limit: Infinity
61
+ }
62
+ ];
63
+ let refreshTimer;
64
+ const timestamp = computed(() => dayjs(props.value).valueOf());
65
+ const now = shallowRef(Date.now());
66
+ const dateTime = computed(() => Number.isFinite(timestamp.value) ? dayjs(timestamp.value).toISOString() : undefined);
67
+ const configProvider = useConfigProvider();
68
+ const text = computed(() => {
69
+ const locale = configProvider.locale.timeAgo;
70
+ if (!Number.isFinite(timestamp.value)) {
71
+ return locale.invalid;
72
+ }
73
+ const diff = now.value - timestamp.value;
74
+ const { bucket, value } = resolveBucket(Math.abs(diff));
75
+ if (bucket.unit === "now") {
76
+ return locale.now;
77
+ }
78
+ const labels = locale.unit[bucket.unit];
79
+ const unit = value === 1 ? labels.one : labels.other;
80
+ return (diff >= 0 ? locale.past : locale.future).replace("{value}", String(value)).replace("{unit}", unit);
81
+ });
82
+ function resolveBucket(age) {
83
+ const bucket = BUCKETS.find((item) => age < item.limit) ?? BUCKETS[BUCKETS.length - 1];
84
+ return {
85
+ bucket,
86
+ value: Math.floor(age / bucket.size)
87
+ };
88
+ }
89
+ function getNextDelay() {
90
+ const age = Math.abs(now.value - timestamp.value);
91
+ const { bucket, value } = resolveBucket(age);
92
+ return Math.min((value + 1) * bucket.size, bucket.limit) - age;
93
+ }
94
+ function stopTimer() {
95
+ clearTimeout(refreshTimer);
96
+ }
97
+ function startTimer() {
98
+ stopTimer();
99
+ if (!props.refresh) {
100
+ return;
101
+ }
102
+ const delay = getNextDelay();
103
+ if (!Number.isFinite(delay) || delay > DAY) {
104
+ return;
105
+ }
106
+ refreshTimer = setTimeout(syncNow, delay);
107
+ }
108
+ function syncNow() {
109
+ if (!props.refresh) {
110
+ return;
111
+ }
112
+ now.value = Date.now();
113
+ startTimer();
114
+ }
115
+ function handleVisibilityChange() {
116
+ if (document.visibilityState === "visible") {
117
+ syncNow();
118
+ }
119
+ }
120
+ watch(() => [timestamp.value, props.refresh], startTimer);
121
+ onActivated(syncNow);
122
+ onDeactivated(stopTimer);
123
+ onMounted(() => {
124
+ startTimer();
125
+ cachedOn(document, "visibilitychange", handleVisibilityChange);
126
+ });
127
+ onUnmounted(() => {
128
+ stopTimer();
129
+ cachedOff(document, "visibilitychange", handleVisibilityChange);
130
+ });
131
+ </script>
132
+
133
+ <template>
134
+ <time
135
+ class="pxd-time-ago"
136
+ data-time-ago
137
+ data-allow-mismatch="text"
138
+ :datetime="dateTime"
139
+ v-bind="$attrs"
140
+ >
141
+ {{ text }}
142
+ </time>
143
+ </template>
@@ -0,0 +1,4 @@
1
+ export interface TimeAgoProps {
2
+ value: string | number | Date
3
+ refresh?: boolean
4
+ }
@@ -10,7 +10,7 @@ declare const __VLS_export: import("vue").DefineComponent<TimePickerProps, {}, {
10
10
  closeOnPressEscape: boolean;
11
11
  valueFormat: string;
12
12
  suffixIcon: boolean;
13
- presets: import("./types").DateTimePreset[];
13
+ presets: import("./types").DateTimePreset<Date>[];
14
14
  showSeconds: boolean;
15
15
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
16
  declare const _default: typeof __VLS_export;
@@ -92,18 +92,12 @@ const paddedTimes = {
92
92
  minutes: Array.from({ length: 60 }, (_, i) => padStringZero(i)),
93
93
  seconds: Array.from({ length: 60 }, (_, i) => padStringZero(i))
94
94
  };
95
- const configProvider = useConfigProvider();
96
- const { isAdaptive, responsiveClasses } = usePopoverResponsive();
95
+ const scrollTimers = [];
97
96
  const timeHoursRef = shallowRef();
98
97
  const timeMinutesRef = shallowRef();
99
98
  const timeSecondsRef = shallowRef();
100
99
  const popoverVisible = shallowRef(false);
101
100
  const dayjsDateTime = shallowRef(null);
102
- const committedValue = shallowRef("");
103
- const modelValue = useModelValue(props, emits, { get() {
104
- return dayjsDateTime.value ? dayjsDateTime.value.format(props.labelFormat ?? "HH:mm:ss") : "";
105
- } });
106
- const scrollTimers = [];
107
101
  const onTimeListScroll = throttleByRaf((ev) => {
108
102
  const target = ev.target;
109
103
  const value = Math.round(target.scrollTop / HEIGHT);
@@ -122,6 +116,12 @@ const onTimeListScroll = throttleByRaf((ev) => {
122
116
  dayjsDateTime.value = dayjsDateTime.value.set(type, clampedValue);
123
117
  }, 100);
124
118
  });
119
+ const committedValue = shallowRef("");
120
+ const configProvider = useConfigProvider();
121
+ const { isAdaptive, responsiveClasses } = usePopoverResponsive();
122
+ const modelValue = useModelValue(props, emits, { get() {
123
+ return dayjsDateTime.value ? dayjsDateTime.value.format(props.labelFormat ?? "HH:mm:ss") : "";
124
+ } });
125
125
  function padStringZero(value) {
126
126
  return String(value).padStart(2, "0");
127
127
  }
@@ -306,19 +306,19 @@ onBeforeUnmount(() => {
306
306
  <PButton
307
307
  size="xs"
308
308
  variant="ghost"
309
- class="sm:px-0.5 rounded-md text-13"
309
+ class="sm:px-0.5 rounded-md text-13px"
310
310
  @click="onCancelClick"
311
311
  >
312
312
  {{ configProvider.locale.interaction.cancel }}
313
313
  </PButton>
314
314
 
315
- <PButton size="xs" variant="ghost" class="sm:px-0 text-13" @click="onSetNowClick">
315
+ <PButton size="xs" variant="ghost" class="sm:px-0 text-13px" @click="onSetNowClick">
316
316
  {{ configProvider.locale.date.now }}
317
317
  </PButton>
318
318
  </div>
319
319
 
320
320
  <div
321
- class="sm:text-15 max-sm:text-base flex max-w-full transform-gpu items-stretch tabular-nums outline-none select-none"
321
+ class="sm:text-15px max-sm:text-base flex max-w-full transform-gpu items-stretch tabular-nums outline-none select-none"
322
322
  @click.stop="onTimeListClick"
323
323
  >
324
324
  <div class="p-2 gap-1 relative mx-auto flex items-center">
@@ -381,7 +381,7 @@ onBeforeUnmount(() => {
381
381
  v-for="(preset, i) in presets"
382
382
  :key="preset.label"
383
383
  :data-index="i"
384
- class="px-1.5 py-0.5 sm:text-13 sm:leading-4 max-sm:leading-5 max-sm:text-sm cursor-pointer appearance-none rounded-sm border-none bg-gray-300 font-inherit whitespace-nowrap text-foreground self-focus-ring outline-none hover:bg-gray-400 active:bg-gray-500 motion-safe:transition-colors"
384
+ class="px-1.5 py-0.5 sm:text-13px sm:leading-4 max-sm:leading-5 max-sm:text-sm cursor-pointer appearance-none rounded-sm border-none bg-gray-300 font-inherit whitespace-nowrap text-foreground self-focus-ring outline-none hover:bg-gray-400 active:bg-gray-500 motion-safe:transition-colors"
385
385
  >
386
386
  {{ preset.label }}
387
387
  </button>
@@ -1,4 +1,4 @@
1
- import type { ComponentSize, ComponentDateTimeValue } from '../../types/shared'
1
+ import type { ComponentSize, ComponentDateTimeValue } from '../../types/shared/props'
2
2
 
3
3
  export interface DateTimePreset<T = Date> {
4
4
  label: string
@@ -1,6 +1,6 @@
1
1
  import type { TocItem, TocProps } from './types';
2
2
  declare function scrollTo(id: string): boolean;
3
- declare var __VLS_1: {
3
+ declare var __VLS_2: {
4
4
  active: boolean;
5
5
  select: (event: PointerEvent) => void;
6
6
  item: TocItem;
@@ -8,7 +8,7 @@ declare var __VLS_1: {
8
8
  depth: number;
9
9
  };
10
10
  type __VLS_Slots = {} & {
11
- item?: (props: typeof __VLS_1) => any;
11
+ item?: (props: typeof __VLS_2) => any;
12
12
  };
13
13
  declare const __VLS_base: import("vue").DefineComponent<TocProps, {
14
14
  activeId: import("vue").ComputedRef<string | null>;
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
2
  import { computed, ref, shallowRef, watch } from "vue";
3
- import { useMotionReduced } from "../../composables/_internal/use-motion-reduce.js";
4
3
  import { useTailwindVariant } from "../../composables/_internal/use-tailwind-variant.js";
4
+ import { useMotionReduced } from "../../composables/use-motion-reduce.js";
5
5
  import { useMutationObserver } from "../../composables/use-mutation-observer.js";
6
6
  import { useScrollspy } from "../../composables/use-scrollspy.js";
7
7
  import { getScrollElement, isViewportScroll, resolveScrollBehavior } from "../../utils/dom.js";