pxd 0.1.4 → 0.1.7

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 (281) hide show
  1. package/dist/components/_internal/dismiss-container.d.vue.ts +2 -2
  2. package/dist/components/_internal/dismiss-container.vue +1 -1
  3. package/dist/components/_internal/mention-editor.d.vue.ts +3 -4
  4. package/dist/components/_internal/mention-editor.vue +7 -5
  5. package/dist/components/_internal/tree-node.d.vue.ts +10 -1
  6. package/dist/components/_internal/tree-node.vue +32 -12
  7. package/dist/components/active-graph/index.d.vue.ts +1 -1
  8. package/dist/components/active-graph/index.vue +4 -18
  9. package/dist/components/active-graph/types.d.ts +1 -1
  10. package/dist/components/approval-card/index.d.vue.ts +2 -2
  11. package/dist/components/approval-card/index.vue +8 -4
  12. package/dist/components/approval-card/types.d.ts +1 -1
  13. package/dist/components/avatar/index.d.vue.ts +2 -2
  14. package/dist/components/avatar/index.vue +1 -1
  15. package/dist/components/backtop/index.d.vue.ts +1 -1
  16. package/dist/components/badge/index.vue +4 -2
  17. package/dist/components/badge/types.d.ts +7 -2
  18. package/dist/components/browser/index.vue +1 -1
  19. package/dist/components/bubble/index.d.vue.ts +1 -1
  20. package/dist/components/bubble/index.vue +35 -14
  21. package/dist/components/bubble/types.d.ts +2 -1
  22. package/dist/components/bubble-group/index.d.vue.ts +10 -3
  23. package/dist/components/bubble-group/index.vue +41 -8
  24. package/dist/components/bubble-group/types.d.ts +5 -4
  25. package/dist/components/button/index.d.vue.ts +1 -1
  26. package/dist/components/button/index.vue +4 -4
  27. package/dist/components/calendar/index.d.vue.ts +2 -2
  28. package/dist/components/calendar/index.vue +3 -3
  29. package/dist/components/calendar/types.d.ts +1 -1
  30. package/dist/components/checkbox/index.d.vue.ts +2 -2
  31. package/dist/components/checkbox/index.vue +3 -3
  32. package/dist/components/checkbox/types.d.ts +1 -1
  33. package/dist/components/checkbox-group/index.d.vue.ts +2 -2
  34. package/dist/components/checkbox-group/index.vue +2 -2
  35. package/dist/components/checkbox-group/types.d.ts +1 -1
  36. package/dist/components/checkerboard/index.d.vue.ts +3 -1
  37. package/dist/components/checkerboard/index.vue +13 -2
  38. package/dist/components/checkerboard/types.d.ts +1 -0
  39. package/dist/components/choicebox/index.d.vue.ts +2 -2
  40. package/dist/components/choicebox/index.vue +2 -2
  41. package/dist/components/choicebox/types.d.ts +1 -1
  42. package/dist/components/choicebox-item/index.vue +1 -1
  43. package/dist/components/code-block/index.d.vue.ts +7 -3
  44. package/dist/components/code-block/index.vue +268 -72
  45. package/dist/components/code-block/types.d.ts +33 -14
  46. package/dist/components/collapse/index.d.vue.ts +3 -1
  47. package/dist/components/collapse/index.vue +37 -41
  48. package/dist/components/collapse/types.d.ts +3 -1
  49. package/dist/components/collapse-group/index.vue +3 -3
  50. package/dist/components/color-selector/index.d.vue.ts +2 -2
  51. package/dist/components/color-selector/index.vue +2 -2
  52. package/dist/components/color-selector/types.d.ts +1 -1
  53. package/dist/components/command-menu/index.d.vue.ts +3 -3
  54. package/dist/components/command-menu/index.vue +2 -2
  55. package/dist/components/command-menu/types.d.ts +1 -1
  56. package/dist/components/confirm-popover/index.d.vue.ts +2 -2
  57. package/dist/components/confirm-popover/index.vue +10 -15
  58. package/dist/components/confirm-popover/types.d.ts +6 -7
  59. package/dist/components/context-usage/index.d.vue.ts +6 -0
  60. package/dist/components/context-usage/index.vue +120 -0
  61. package/dist/components/context-usage/types.d.ts +13 -0
  62. package/dist/components/copy-button/index.vue +17 -9
  63. package/dist/components/copy-button/types.d.ts +3 -1
  64. package/dist/components/countdown/index.vue +1 -1
  65. package/dist/components/date-picker/index.d.vue.ts +13 -3
  66. package/dist/components/date-picker/index.vue +6 -4
  67. package/dist/components/date-picker/types.d.ts +1 -1
  68. package/dist/components/description/index.vue +1 -1
  69. package/dist/components/description/types.d.ts +3 -1
  70. package/dist/components/drawer/index.d.vue.ts +5 -5
  71. package/dist/components/drawer/index.vue +13 -13
  72. package/dist/components/drawer/types.d.ts +2 -2
  73. package/dist/components/effort-slider/index.d.vue.ts +2 -2
  74. package/dist/components/effort-slider/index.vue +63 -17
  75. package/dist/components/effort-slider/types.d.ts +3 -1
  76. package/dist/components/ellipsis-text/index.d.vue.ts +3 -3
  77. package/dist/components/ellipsis-text/index.vue +5 -5
  78. package/dist/components/ellipsis-text/types.d.ts +4 -2
  79. package/dist/components/empty-state/index.vue +1 -1
  80. package/dist/components/empty-state/types.d.ts +3 -1
  81. package/dist/components/feedback-bar/index.d.vue.ts +4 -4
  82. package/dist/components/feedback-bar/index.vue +4 -4
  83. package/dist/components/feedback-bar/types.d.ts +2 -2
  84. package/dist/components/gauge/index.vue +75 -79
  85. package/dist/components/gauge/types.d.ts +2 -0
  86. package/dist/components/hint/index.vue +2 -3
  87. package/dist/components/hold-button/index.d.vue.ts +4 -4
  88. package/dist/components/hold-button/index.vue +86 -75
  89. package/dist/components/hue-text/index.vue +2 -2
  90. package/dist/components/hue-text/types.d.ts +3 -1
  91. package/dist/components/image-preview/index.d.vue.ts +2 -0
  92. package/dist/components/image-preview/index.vue +156 -131
  93. package/dist/components/image-preview/types.d.ts +18 -18
  94. package/dist/components/index.d.ts +132 -0
  95. package/dist/components/index.js +3 -0
  96. package/dist/components/input/index.d.vue.ts +2 -2
  97. package/dist/components/input/index.vue +2 -2
  98. package/dist/components/input/types.d.ts +1 -1
  99. package/dist/components/kbd/index.vue +1 -1
  100. package/dist/components/link-button/index.d.vue.ts +1 -1
  101. package/dist/components/link-button/index.vue +1 -1
  102. package/dist/components/link-button/types.d.ts +1 -1
  103. package/dist/components/list/index.d.vue.ts +3 -3
  104. package/dist/components/list/index.vue +4 -4
  105. package/dist/components/list/types.d.ts +1 -1
  106. package/dist/components/list-group/index.vue +1 -1
  107. package/dist/components/{_internal/loading-mask.d.vue.ts → loading-mask/index.d.vue.ts} +2 -4
  108. package/dist/components/{_internal/loading-mask.vue → loading-mask/index.vue} +1 -1
  109. package/dist/components/loading-mask/types.d.ts +3 -0
  110. package/dist/components/marching-ants/index.d.vue.ts +1 -1
  111. package/dist/components/marquee/index.d.vue.ts +3 -3
  112. package/dist/components/marquee/index.vue +1 -1
  113. package/dist/components/marquee/types.d.ts +2 -2
  114. package/dist/components/mention/index.d.vue.ts +6 -4
  115. package/dist/components/mention/index.vue +6 -2
  116. package/dist/components/mention/types.d.ts +1 -1
  117. package/dist/components/menu/index.d.vue.ts +5 -3
  118. package/dist/components/menu/index.vue +6 -2
  119. package/dist/components/menu/types.d.ts +1 -1
  120. package/dist/components/message/index.d.vue.ts +1 -1
  121. package/dist/components/modal/index.d.vue.ts +4 -4
  122. package/dist/components/modal/index.vue +13 -13
  123. package/dist/components/modal/types.d.ts +2 -2
  124. package/dist/components/more-button/index.d.vue.ts +4 -4
  125. package/dist/components/more-button/index.vue +4 -4
  126. package/dist/components/more-button/types.d.ts +3 -3
  127. package/dist/components/note/index.vue +1 -1
  128. package/dist/components/note/types.d.ts +1 -1
  129. package/dist/components/number-input/index.d.vue.ts +2 -2
  130. package/dist/components/number-input/index.vue +2 -2
  131. package/dist/components/number-input/types.d.ts +1 -1
  132. package/dist/components/overlay/index.d.vue.ts +2 -2
  133. package/dist/components/overlay/index.vue +4 -4
  134. package/dist/components/overlay/types.d.ts +1 -1
  135. package/dist/components/page-number/index.d.vue.ts +3 -3
  136. package/dist/components/page-number/index.vue +3 -3
  137. package/dist/components/page-number/types.d.ts +1 -1
  138. package/dist/components/pagination/index.vue +2 -2
  139. package/dist/components/pin-input/index.d.vue.ts +4 -4
  140. package/dist/components/pin-input/index.vue +3 -3
  141. package/dist/components/pin-input/types.d.ts +1 -1
  142. package/dist/components/placeholder/index.vue +3 -3
  143. package/dist/components/placeholder/types.d.ts +1 -1
  144. package/dist/components/popover/index.vue +73 -36
  145. package/dist/components/popover/types.d.ts +1 -2
  146. package/dist/components/questionnaire/index.d.vue.ts +1 -0
  147. package/dist/components/questionnaire/index.vue +92 -87
  148. package/dist/components/questionnaire/types.d.ts +1 -3
  149. package/dist/components/radio/index.d.vue.ts +2 -2
  150. package/dist/components/radio/index.vue +3 -3
  151. package/dist/components/radio/types.d.ts +1 -1
  152. package/dist/components/radio-group/index.d.vue.ts +2 -2
  153. package/dist/components/radio-group/index.vue +2 -2
  154. package/dist/components/radio-group/types.d.ts +1 -1
  155. package/dist/components/rating/index.d.vue.ts +3 -3
  156. package/dist/components/rating/index.vue +2 -2
  157. package/dist/components/rating/types.d.ts +1 -1
  158. package/dist/components/reactions/index.d.vue.ts +34 -0
  159. package/dist/components/reactions/index.vue +143 -0
  160. package/dist/components/reactions/types.d.ts +23 -0
  161. package/dist/components/reasoning/index.d.vue.ts +2 -0
  162. package/dist/components/reasoning/index.vue +49 -30
  163. package/dist/components/reasoning/types.d.ts +9 -0
  164. package/dist/components/resizable/index.d.vue.ts +2 -2
  165. package/dist/components/resizable/index.vue +3 -3
  166. package/dist/components/resizable/types.d.ts +1 -1
  167. package/dist/components/reveal/index.d.vue.ts +1 -1
  168. package/dist/components/rolling-number/index.vue +1 -1
  169. package/dist/components/scroll-text/index.d.vue.ts +1 -1
  170. package/dist/components/scroll-text/index.vue +2 -2
  171. package/dist/components/scroll-text/types.d.ts +2 -2
  172. package/dist/components/scrollable/index.d.vue.ts +3 -2
  173. package/dist/components/scrollable/types.d.ts +0 -15
  174. package/dist/components/search-input/index.d.vue.ts +5 -5
  175. package/dist/components/search-input/index.vue +1 -1
  176. package/dist/components/select/index.d.vue.ts +10 -6
  177. package/dist/components/select/index.vue +15 -8
  178. package/dist/components/select/types.d.ts +1 -1
  179. package/dist/components/shimmer-text/index.d.vue.ts +1 -1
  180. package/dist/components/shimmer-text/index.vue +1 -1
  181. package/dist/components/shimmer-text/types.d.ts +1 -1
  182. package/dist/components/skeleton/index.d.vue.ts +1 -1
  183. package/dist/components/slider/index.d.vue.ts +2 -3
  184. package/dist/components/slider/index.vue +17 -6
  185. package/dist/components/slider/types.d.ts +2 -1
  186. package/dist/components/snippet/index.vue +1 -5
  187. package/dist/components/snippet/types.d.ts +6 -2
  188. package/dist/components/spinner-dots/types.d.ts +1 -1
  189. package/dist/components/split-button/index.d.vue.ts +5 -3
  190. package/dist/components/split-button/index.vue +6 -2
  191. package/dist/components/split-button/types.d.ts +1 -1
  192. package/dist/components/steps/index.d.vue.ts +2 -2
  193. package/dist/components/steps/index.vue +2 -2
  194. package/dist/components/steps/types.d.ts +1 -1
  195. package/dist/components/stick-to-bottom/index.vue +3 -6
  196. package/dist/components/swipe-cell/index.d.vue.ts +2 -2
  197. package/dist/components/swipe-cell/index.vue +3 -3
  198. package/dist/components/swipe-cell/types.d.ts +1 -1
  199. package/dist/components/switch/index.d.vue.ts +2 -2
  200. package/dist/components/switch/index.vue +2 -2
  201. package/dist/components/switch/types.d.ts +1 -1
  202. package/dist/components/switch-item/index.vue +2 -2
  203. package/dist/components/tabs/index.d.vue.ts +2 -2
  204. package/dist/components/tabs/index.vue +3 -3
  205. package/dist/components/tabs/types.d.ts +1 -1
  206. package/dist/components/text/index.vue +1 -1
  207. package/dist/components/text/types.d.ts +1 -1
  208. package/dist/components/textarea/index.d.vue.ts +2 -2
  209. package/dist/components/textarea/index.vue +2 -2
  210. package/dist/components/textarea/types.d.ts +1 -1
  211. package/dist/components/theme-switcher/index.d.vue.ts +2 -3
  212. package/dist/components/theme-switcher/index.vue +7 -7
  213. package/dist/components/time-picker/index.d.vue.ts +13 -3
  214. package/dist/components/time-picker/index.vue +10 -8
  215. package/dist/components/time-picker/types.d.ts +1 -1
  216. package/dist/components/timeline-item/index.d.vue.ts +0 -1
  217. package/dist/components/timeline-item/index.vue +20 -4
  218. package/dist/components/timeline-item/types.d.ts +2 -2
  219. package/dist/components/toc/index.d.vue.ts +4 -1
  220. package/dist/components/toc/index.vue +65 -8
  221. package/dist/components/toc/types.d.ts +10 -1
  222. package/dist/components/todo-list/index.d.vue.ts +4 -13
  223. package/dist/components/todo-list/index.vue +122 -133
  224. package/dist/components/todo-list/types.d.ts +5 -4
  225. package/dist/components/toggle/index.d.vue.ts +4 -4
  226. package/dist/components/toggle/index.vue +4 -4
  227. package/dist/components/toggle/types.d.ts +6 -6
  228. package/dist/components/toggle-button/index.d.vue.ts +2 -2
  229. package/dist/components/toggle-button/index.vue +2 -2
  230. package/dist/components/toggle-button/types.d.ts +1 -1
  231. package/dist/components/toggle-button-group/index.d.vue.ts +2 -2
  232. package/dist/components/toggle-button-group/index.vue +2 -2
  233. package/dist/components/toggle-button-group/types.d.ts +1 -1
  234. package/dist/components/tool-call/index.d.vue.ts +2 -0
  235. package/dist/components/tool-call/index.vue +139 -133
  236. package/dist/components/tool-call/types.d.ts +6 -1
  237. package/dist/components/tooltip/index.d.vue.ts +1 -1
  238. package/dist/components/tooltip/index.vue +1 -0
  239. package/dist/components/tour/index.d.vue.ts +4 -4
  240. package/dist/components/tour/index.vue +4 -4
  241. package/dist/components/tour/types.d.ts +5 -5
  242. package/dist/components/tree/index.d.vue.ts +27 -18
  243. package/dist/components/tree/index.vue +95 -27
  244. package/dist/components/tree/types.d.ts +18 -17
  245. package/dist/components/virtual-list/index.d.vue.ts +5 -4
  246. package/dist/components/virtual-list/index.vue +5 -4
  247. package/dist/components/virtual-list/types.d.ts +10 -8
  248. package/dist/composables/_internal/use-code-highlight.js +3 -1
  249. package/dist/composables/_internal/use-details-collapse.d.ts +7 -0
  250. package/dist/composables/_internal/use-details-collapse.js +68 -0
  251. package/dist/composables/_internal/use-list-selection.d.ts +1 -1
  252. package/dist/composables/_internal/use-list-selection.js +2 -2
  253. package/dist/composables/_internal/use-model-value.d.ts +1 -1
  254. package/dist/composables/_internal/use-model-value.js +1 -1
  255. package/dist/composables/_internal/use-tailwind-variant.js +1 -1
  256. package/dist/composables/_internal/use-tree.d.ts +32 -6
  257. package/dist/composables/_internal/use-tree.js +89 -54
  258. package/dist/composables/use-color-scheme.d.ts +1 -1
  259. package/dist/composables/use-color-scheme.js +7 -3
  260. package/dist/composables/use-countdown.d.ts +1 -1
  261. package/dist/composables/use-countdown.js +9 -9
  262. package/dist/composables/use-loading-bar.js +4 -0
  263. package/dist/composables/use-stick-to-bottom.d.ts +5 -0
  264. package/dist/composables/use-stick-to-bottom.js +45 -31
  265. package/dist/composables/use-virtual-list.d.ts +21 -1
  266. package/dist/composables/use-virtual-list.js +30 -9
  267. package/dist/constants/tooltip-variants.d.ts +2 -2
  268. package/dist/constants/tooltip-variants.js +3 -3
  269. package/dist/contexts/collapse.d.ts +1 -1
  270. package/dist/styles/styles.css +1 -1
  271. package/dist/styles/tw.css +12 -7
  272. package/package.json +10 -11
  273. package/volar.d.ts +3 -0
  274. package/dist/components/bubble-group/types.js +0 -0
  275. package/dist/components/virtual-list/types.js +0 -0
  276. package/dist/composables/_internal/use-collapse-motion.d.ts +0 -6
  277. package/dist/composables/_internal/use-collapse-motion.js +0 -85
  278. package/dist/utils/_internal/cn-tables.d.ts +0 -27
  279. package/dist/utils/_internal/cn-tables.js +0 -131
  280. package/dist/utils/cn.d.ts +0 -1
  281. package/dist/utils/cn.js +0 -3
@@ -2,12 +2,12 @@
2
2
  import { computed, shallowRef, useSlots, watch } from "vue";
3
3
  import { useListKeyboardController } from "../../composables/_internal/use-list-keyboard-controller.js";
4
4
  import { useListNavigation } from "../../composables/_internal/use-list-navigation.js";
5
- import { graftLoadedChildren, isTreeDescendant, moveTreeNode, useTreeDrag, useTreeIndex, useTreeMatched, useTreeRows, useTreeSearch, useTreeSelection } from "../../composables/_internal/use-tree.js";
5
+ import { graftLoadedChildren, hasTreeChildren, isTreeDescendant, isTreeLeaf, moveTreeNode, resolveTreeFieldNames, useTreeDrag, useTreeIndex, useTreeMatched, useTreeRows, useTreeSearch, useTreeSelection } from "../../composables/_internal/use-tree.js";
6
6
  import { useVirtualList } from "../../composables/use-virtual-list.js";
7
7
  import { getUniqueId } from "../../utils/helper.js";
8
8
  import { isNumber } from "../../utils/is.js";
9
- import PLoadingMask from "../_internal/loading-mask.vue";
10
9
  import PTreeNode from "../_internal/tree-node.vue";
10
+ import PLoadingMask from "../loading-mask/index.vue";
11
11
  import PSearchInput from "../search-input/index.vue";
12
12
  import PTeleport from "../teleport/index.vue";
13
13
  defineOptions({
@@ -15,7 +15,7 @@ defineOptions({
15
15
  inheritAttrs: false,
16
16
  model: {
17
17
  prop: "modelValue",
18
- event: "update:modelValue"
18
+ event: "update:model-value"
19
19
  }
20
20
  });
21
21
  const props = defineProps({
@@ -113,10 +113,14 @@ const props = defineProps({
113
113
  type: Array,
114
114
  required: false
115
115
  },
116
- childrenField: {
117
- type: String,
116
+ accordion: {
117
+ type: Boolean,
118
118
  required: false,
119
- default: "children"
119
+ default: false
120
+ },
121
+ fieldNames: {
122
+ type: Object,
123
+ required: false
120
124
  },
121
125
  lazy: {
122
126
  type: Boolean,
@@ -157,7 +161,7 @@ const props = defineProps({
157
161
  searchPlaceholder: {
158
162
  type: String,
159
163
  required: false,
160
- default: "Search"
164
+ default: ""
161
165
  },
162
166
  searchValue: {
163
167
  type: String,
@@ -178,13 +182,15 @@ const props = defineProps({
178
182
  }
179
183
  });
180
184
  const emits = defineEmits([
181
- "update:modelValue",
185
+ "update:model-value",
182
186
  "update:data",
183
187
  "move",
184
188
  "change",
185
189
  "update:expandedKeys",
186
190
  "expand",
187
191
  "collapse",
192
+ "node-click",
193
+ "node-contextmenu",
188
194
  "update:searchValue"
189
195
  ]);
190
196
  const uid = getUniqueId();
@@ -209,7 +215,9 @@ const searchValue = computed(() => props.searchValue ?? internalSearchValue.valu
209
215
  const internalExpandedKeys = shallowRef([...props.defaultExpandedKeys ?? []]);
210
216
  const loadedChildren = shallowRef(new Map());
211
217
  const loadingKeys = shallowRef(new Set());
212
- const treeData = computed(() => graftLoadedChildren(props.data, loadedChildren.value, props.childrenField));
218
+ const expandAllPending = shallowRef(false);
219
+ const fields = computed(() => resolveTreeFieldNames(props.fieldNames));
220
+ const treeData = computed(() => graftLoadedChildren(props.data, loadedChildren.value, fields.value));
213
221
  const expandedKeys = computed(() => props.expandedKeys ?? internalExpandedKeys.value);
214
222
  const expanded = computed(() => new Set(expandedKeys.value));
215
223
  const highlightQuery = computed(() => props.highlightMatch ? searchValue.value.trim() : "");
@@ -230,8 +238,8 @@ const { matches: remoteMatches, remote: remoteMode, pending: searchPending, acti
230
238
  remoteFilter: () => props.remoteFilter
231
239
  });
232
240
  const searchData = computed(() => remoteActive.value ? remoteMatches.value ?? [] : treeData.value);
233
- const index = useTreeIndex(() => searchData.value, () => props.childrenField);
234
- const localMatched = useTreeMatched(index, () => searchValue.value, () => props.filter);
241
+ const index = useTreeIndex(() => searchData.value, () => fields.value);
242
+ const localMatched = useTreeMatched(index, () => searchValue.value, () => props.filter, () => fields.value);
235
243
  const matched = computed(() => {
236
244
  if (!remoteMode.value) {
237
245
  return localMatched.value;
@@ -240,7 +248,7 @@ const matched = computed(() => {
240
248
  return NO_MATCHED;
241
249
  }
242
250
  // The whole returned forest shows: an ancestor is as much a hit as the node at the end of it.
243
- const visible = new Set(index.value.list.map((meta) => meta.node.value));
251
+ const visible = new Set(index.value.list.map((meta) => meta.node[fields.value.value]));
244
252
  return {
245
253
  visible,
246
254
  exact: visible
@@ -251,7 +259,8 @@ const { checked, indeterminate, toggle, extend, isSelectable } = useTreeSelectio
251
259
  modelValue: () => props.modelValue,
252
260
  multiple: () => props.multiple,
253
261
  checkStrictly: () => props.checkStrictly,
254
- selectable: () => props.selectable
262
+ selectable: () => props.selectable,
263
+ fieldNames: () => fields.value
255
264
  });
256
265
  const rows = useTreeRows(index, {
257
266
  query: () => searchValue.value,
@@ -259,7 +268,8 @@ const rows = useTreeRows(index, {
259
268
  matched: () => matched.value.visible,
260
269
  exactMatched: () => matched.value.exact,
261
270
  matchesOnly: () => props.searchMatchesOnly,
262
- canLoad: () => canLoad
271
+ canLoad: () => canLoad,
272
+ fieldNames: () => fields.value
263
273
  });
264
274
  /** Not `reactive()`: the virtualizer would get a deep proxy of the rows instead of the rows. */
265
275
  const virtualOptions = {
@@ -376,7 +386,7 @@ function canLoad(value) {
376
386
  return false;
377
387
  }
378
388
  const meta = index.value.byValue.get(value);
379
- return meta !== undefined && meta.node.isLeaf !== true && meta.children.length === 0;
389
+ return meta !== undefined && meta.node[fields.value.isLeaf] !== true && !hasTreeChildren(meta.node, fields.value);
380
390
  }
381
391
  function commitLoading(value, next) {
382
392
  const keys = new Set(loadingKeys.value);
@@ -414,11 +424,26 @@ function commitExpandedKeys(next) {
414
424
  internalExpandedKeys.value = next;
415
425
  emits("update:expandedKeys", next);
416
426
  }
427
+ function siblingKeys(value) {
428
+ const meta = index.value.byValue.get(value);
429
+ if (!meta) {
430
+ return [];
431
+ }
432
+ const siblings = meta.parentValue === undefined ? index.value.list.filter((item) => item.parentValue === undefined) : index.value.byValue.get(meta.parentValue)?.children ?? [];
433
+ return siblings.map((item) => item.node[fields.value.value]);
434
+ }
417
435
  function setExpandedByValue(value, next) {
418
436
  if (expanded.value.has(value) === next) {
419
437
  return;
420
438
  }
421
- const current = expandedKeys.value;
439
+ let current = expandedKeys.value;
440
+ if (next && props.accordion) {
441
+ const siblings = new Set(siblingKeys(value));
442
+ current = current.filter((key) => key === value || !siblings.has(key));
443
+ }
444
+ if (!next) {
445
+ expandAllPending.value = false;
446
+ }
422
447
  commitExpandedKeys(next ? [...current, value] : current.filter((key) => key !== value));
423
448
  const node = index.value.byValue.get(value)?.node;
424
449
  if (!node) {
@@ -442,10 +467,18 @@ function toggleNode(row) {
442
467
  }
443
468
  setExpandedByValue(row.key, !row.expanded);
444
469
  }
470
+ function expandableKeys() {
471
+ return index.value.list.filter((meta) => {
472
+ const value = meta.node[fields.value.value];
473
+ return !isTreeLeaf(meta.node, fields.value, canLoad(value));
474
+ }).map((meta) => meta.node[fields.value.value]);
475
+ }
445
476
  function expandAll() {
446
- commitExpandedKeys(index.value.list.filter((meta) => meta.children.length > 0).map((meta) => meta.node.value));
477
+ expandAllPending.value = true;
478
+ commitExpandedKeys(expandableKeys());
447
479
  }
448
480
  function collapseAll() {
481
+ expandAllPending.value = false;
449
482
  commitExpandedKeys([]);
450
483
  }
451
484
  function toValues(value) {
@@ -460,7 +493,7 @@ function onCheck(row, event) {
460
493
  }
461
494
  const next = event?.shiftKey ? extend(row.key) : toggle(row.key);
462
495
  const checkedValues = toValues(next.value);
463
- emits("update:modelValue", next.value);
496
+ emits("update:model-value", next.value);
464
497
  emits("change", {
465
498
  value: row.key,
466
499
  node: row.node,
@@ -477,7 +510,7 @@ function onSearchInput(value) {
477
510
  emits("update:searchValue", value);
478
511
  }
479
512
  function isNodeDisabled(row) {
480
- return props.disabled || row.node.disabled === true;
513
+ return props.disabled || row.node[fields.value.disabled] === true;
481
514
  }
482
515
  function scrollRowIntoView(index) {
483
516
  if (props.virtual) {
@@ -504,6 +537,10 @@ function onRowClick(value, event) {
504
537
  if (!row) {
505
538
  return;
506
539
  }
540
+ emits("node-click", {
541
+ value,
542
+ node: row.node
543
+ }, event);
507
544
  if (props.expandOnly && !event?.shiftKey) {
508
545
  if (row.hasChildren) {
509
546
  toggleNode(row);
@@ -548,13 +585,17 @@ function setActiveKey(value) {
548
585
  scrollRowIntoView(at);
549
586
  }
550
587
  /** The whole index, not the rendered rows: a collapsed subtree still holds checked nodes. */
551
- function getCheckedKeys(includeIndeterminate = false) {
588
+ function getCheckedKeys(leafOnly = false, includeIndeterminate = false) {
552
589
  const result = [];
553
590
  for (const meta of index.value.list) {
554
- const value = meta.node.value;
555
- if (checked.value.has(value) || includeIndeterminate && indeterminate.value.has(value)) {
556
- result.push(value);
591
+ const value = meta.node[fields.value.value];
592
+ if (!checked.value.has(value) && !(includeIndeterminate && indeterminate.value.has(value))) {
593
+ continue;
594
+ }
595
+ if (leafOnly && !isTreeLeaf(meta.node, fields.value, canLoad(value))) {
596
+ continue;
557
597
  }
598
+ result.push(value);
558
599
  }
559
600
  return result;
560
601
  }
@@ -578,7 +619,7 @@ function canDrop(value, targetValue, position) {
578
619
  position
579
620
  });
580
621
  }
581
- return meta.node.disabled !== true;
622
+ return meta.node[fields.value.disabled] !== true;
582
623
  }
583
624
  function getData(value) {
584
625
  return index.value.byValue.get(value)?.node;
@@ -586,7 +627,7 @@ function getData(value) {
586
627
  /** The caller owns `data`: a drop only proposes the next tree, and a no-op move is silent. */
587
628
  function onCommit(value, target) {
588
629
  // The grafted tree, not the prop: nodes that arrived through `load` live only in there.
589
- const result = moveTreeNode(treeData.value, props.childrenField, value, target);
630
+ const result = moveTreeNode(treeData.value, fields.value, value, target);
590
631
  if (!result) {
591
632
  return;
592
633
  }
@@ -596,12 +637,33 @@ function onCommit(value, target) {
596
637
  setExpandedByValue(target.targetValue, true);
597
638
  }
598
639
  }
640
+ function onRowContextMenu(value, event) {
641
+ const row = getRow(value);
642
+ if (row) {
643
+ emits("node-contextmenu", {
644
+ value,
645
+ node: row.node
646
+ }, event);
647
+ }
648
+ }
599
649
  // `treeData` too: a key below a parent still on its way only becomes loadable once it arrives.
600
650
  watch([expanded, treeData], ([keys]) => {
601
651
  for (const value of keys) {
602
652
  ensureLoaded(value);
603
653
  }
604
654
  }, { immediate: true });
655
+ // `expandAll` on a lazy tree: a level only exists once its parent resolved, so keep opening.
656
+ watch(treeData, () => {
657
+ if (!expandAllPending.value) {
658
+ return;
659
+ }
660
+ const missing = expandableKeys().filter((key) => !expanded.value.has(key));
661
+ if (missing.length === 0) {
662
+ expandAllPending.value = false;
663
+ return;
664
+ }
665
+ commitExpandedKeys([...expandedKeys.value, ...missing]);
666
+ });
605
667
  defineExpose({
606
668
  focus: () => containerRef.value?.focus(),
607
669
  scrollToKey,
@@ -656,7 +718,7 @@ defineExpose({
656
718
  v-for="entry in renderEntries"
657
719
  :key="entry.key"
658
720
  :data-checked="checked.has(entry.key)"
659
- class="pxd-tree--row grid w-full grid-rows-[1fr]"
721
+ class="pxd-tree--row grid-template-cols-1fr grid-template-rows-1fr grid w-full"
660
722
  :class="{ 'left-0 top-0 absolute': virtual }"
661
723
  :style="virtual ? { transform: 'translateY(' + entry.start + 'px)' } : void 0"
662
724
  >
@@ -665,6 +727,8 @@ defineExpose({
665
727
  v-if="hasNodeSlot"
666
728
  :id="entry.id"
667
729
  :node="entry.node"
730
+ :label="entry.node[fields.label]"
731
+ :node-disabled="entry.node[fields.disabled] === true"
668
732
  :value="entry.key"
669
733
  :depth="entry.depth"
670
734
  :index="entry.index"
@@ -689,6 +753,7 @@ defineExpose({
689
753
  dropTarget?.targetValue === entry.key ? dropTarget.position : void 0
690
754
  "
691
755
  @row-click="onRowClick"
756
+ @row-contextmenu="onRowContextMenu"
692
757
  @drag-pointerdown="onDragPointerdown"
693
758
  @check="onCheckboxClick"
694
759
  @toggle="onSwitcherClick"
@@ -714,6 +779,8 @@ defineExpose({
714
779
  v-else
715
780
  :id="entry.id"
716
781
  :node="entry.node"
782
+ :label="entry.node[fields.label]"
783
+ :node-disabled="entry.node[fields.disabled] === true"
717
784
  :value="entry.key"
718
785
  :depth="entry.depth"
719
786
  :index="entry.index"
@@ -738,6 +805,7 @@ defineExpose({
738
805
  dropTarget?.targetValue === entry.key ? dropTarget.position : void 0
739
806
  "
740
807
  @row-click="onRowClick"
808
+ @row-contextmenu="onRowContextMenu"
741
809
  @drag-pointerdown="onDragPointerdown"
742
810
  @check="onCheckboxClick"
743
811
  @toggle="onSwitcherClick"
@@ -764,7 +832,7 @@ defineExpose({
764
832
  :style="{ left: dragX + 'px', top: dragY + 'px' }"
765
833
  >
766
834
  <slot name="node-drag-preview" :node="dragNode">
767
- {{ dragNode?.label }}
835
+ {{ dragNode?.[fields.label] }}
768
836
  </slot>
769
837
  </div>
770
838
  </PTeleport>
@@ -1,16 +1,24 @@
1
1
  import type { ComponentClass, ComponentLabel, ComponentValue } from '../../types/shared/props'
2
2
 
3
3
  export interface TreeOption {
4
- value: ComponentValue
4
+ value?: ComponentValue
5
5
  label?: ComponentLabel
6
6
  disabled?: boolean
7
- children?: TreeOption[]
8
- /** Marks a leaf under `lazy`: no arrow, and never handed to `load`. */
7
+ children?: readonly TreeOption[]
9
8
  isLeaf?: boolean
10
9
  keywords?: string[]
11
10
  [key: string]: any
12
11
  }
13
12
 
13
+ /** Where a node keeps each of the fields the tree reads. */
14
+ export interface TreeFieldNames {
15
+ value?: string
16
+ label?: string
17
+ children?: string
18
+ disabled?: string
19
+ isLeaf?: string
20
+ }
21
+
14
22
  export type TreeOptions = TreeOption[]
15
23
 
16
24
  export type TreeModelValue = ComponentValue | ComponentValue[] | null
@@ -20,7 +28,7 @@ export type TreeFilterFn = (node: TreeOption, query: string) => boolean
20
28
  /** Hands the tree the nodes a query matched, their ancestors included. */
21
29
  export type TreeRemoteFilterFn = (query: string) => TreeOptions | Promise<TreeOptions>
22
30
 
23
- /** Hands the children of a node to the tree. An empty array marks it a leaf. */
31
+ /** Hands the children of a node to the tree. An empty array settles it as a leaf, never asked again. */
24
32
  export type TreeLoadResolve = (children: TreeOptions) => void
25
33
 
26
34
  /** Gives up on a node without children: the arrow stays, and the next expand asks again. */
@@ -90,18 +98,8 @@ export interface TreeMoveDetail {
90
98
  }
91
99
  }
92
100
 
93
- export interface TreeFlatNode {
94
- key: ComponentValue
95
- node: TreeOption
96
- depth: number
97
- index: number
98
- parentValue?: ComponentValue
99
- hasChildren: boolean
100
- expanded: boolean
101
- }
102
-
103
101
  export interface TreeProps {
104
- data?: TreeOptions
102
+ data?: readonly TreeOption[]
105
103
  modelValue?: TreeModelValue
106
104
  multiple?: boolean
107
105
  checkStrictly?: boolean
@@ -122,7 +120,8 @@ export interface TreeProps {
122
120
  indent?: number
123
121
  expandedKeys?: ComponentValue[]
124
122
  defaultExpandedKeys?: ComponentValue[]
125
- childrenField?: string
123
+ accordion?: boolean
124
+ fieldNames?: TreeFieldNames
126
125
  /** Fetch the children of a node when it first opens, instead of reading them from `data`. */
127
126
  lazy?: boolean
128
127
  /** Fetches the children of a node neither `data` nor an earlier request provided. */
@@ -144,12 +143,14 @@ export interface TreeProps {
144
143
  }
145
144
 
146
145
  export interface TreeEmits {
147
- 'update:modelValue': [TreeModelValue]
146
+ 'update:model-value': [TreeModelValue]
148
147
  'update:data': [TreeOptions]
149
148
  move: [TreeMoveDetail]
150
149
  change: [TreeChangeDetail]
151
150
  'update:expandedKeys': [ComponentValue[]]
152
151
  expand: [TreeNodeDetail]
153
152
  collapse: [TreeNodeDetail]
153
+ 'node-click': [TreeNodeDetail, MouseEvent]
154
+ 'node-contextmenu': [TreeNodeDetail, MouseEvent]
154
155
  'update:searchValue': [string]
155
156
  }
@@ -13,6 +13,7 @@ declare const __VLS_base: import("vue").DefineComponent<VirtualListProps, {
13
13
  totalSize: import("vue").ComputedRef<number>;
14
14
  virtualItems: import("vue").ComputedRef<VirtualListItem[]>;
15
15
  getVirtualizer: () => import("@tanstack/virtual-core").Virtualizer<HTMLElement, HTMLElement>;
16
+ scrollSource: import("../../composables/use-virtual-list.js").VirtualListScrollSource;
16
17
  scrollToIndex: (index: number, args_1?: import("@tanstack/virtual-core").ScrollToOptions | undefined) => void;
17
18
  scrollToOffset: (toOffset: number, args_1?: import("@tanstack/virtual-core").ScrollToOptions | undefined) => void;
18
19
  scrollBy: (delta: number, args_1?: import("@tanstack/virtual-core").ScrollToOptions | undefined) => void;
@@ -21,11 +22,11 @@ declare const __VLS_base: import("vue").DefineComponent<VirtualListProps, {
21
22
  }, string, import("vue").PublicProps, Readonly<VirtualListProps> & Readonly<{
22
23
  onRetry?: (() => any) | undefined;
23
24
  }>, {
24
- items: any[];
25
+ items: readonly any[];
25
26
  dataKey: string;
26
- loadingText: string;
27
- errorText: string;
28
- finishedText: string;
27
+ loadingText: any;
28
+ errorText: any;
29
+ finishedText: any;
29
30
  columnGap: number;
30
31
  columnCount: number;
31
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -24,17 +24,17 @@ const props = defineProps({
24
24
  required: false
25
25
  },
26
26
  errorText: {
27
- type: String,
27
+ type: null,
28
28
  required: false,
29
29
  default: "Request failed. Click to reload"
30
30
  },
31
31
  loadingText: {
32
- type: String,
32
+ type: null,
33
33
  required: false,
34
34
  default: "Loading..."
35
35
  },
36
36
  finishedText: {
37
- type: String,
37
+ type: null,
38
38
  required: false,
39
39
  default: "Finished"
40
40
  },
@@ -93,7 +93,7 @@ const props = defineProps({
93
93
  });
94
94
  const emits = defineEmits(["retry"]);
95
95
  const containerRef = shallowRef();
96
- const { totalSize, virtualItems, measureElement, getVirtualizer, scrollToIndex, scrollToOffset, scrollBy } = useVirtualList(containerRef, props);
96
+ const { totalSize, virtualItems, measureElement, getVirtualizer, scrollSource, scrollToIndex, scrollToOffset, scrollBy } = useVirtualList(containerRef, props);
97
97
  function getItemStyle(virtualItem) {
98
98
  const lanes = Math.max(1, Math.floor(props.columnCount));
99
99
  const gap = props.columnGap;
@@ -120,6 +120,7 @@ defineExpose({
120
120
  totalSize,
121
121
  virtualItems,
122
122
  getVirtualizer,
123
+ scrollSource,
123
124
  scrollToIndex,
124
125
  scrollToOffset,
125
126
  scrollBy
@@ -1,12 +1,14 @@
1
- import type { VirtualListOptions } from '../../composables/use-virtual-list';
2
- import type { ComponentClass } from '../../types/shared/props';
1
+ import type { VirtualListOptions } from '../../composables/use-virtual-list'
2
+ import type { ComponentClass } from '../../types/shared/props'
3
+
3
4
  export interface VirtualListProps extends VirtualListOptions {
4
- listClass?: ComponentClass;
5
- itemClass?: ComponentClass;
6
- errorText?: string;
7
- loadingText?: string;
8
- finishedText?: string;
5
+ listClass?: ComponentClass
6
+ itemClass?: ComponentClass
7
+ errorText?: ComponentLabel
8
+ loadingText?: ComponentLabel
9
+ finishedText?: ComponentLabel
9
10
  }
11
+
10
12
  export interface VirtualListEmits {
11
- retry: [];
13
+ retry: []
12
14
  }
@@ -26,7 +26,9 @@ async function flush() {
26
26
  if (!module) {
27
27
  return;
28
28
  }
29
- await module.highlightAll();
29
+ await module.highlightAll({
30
+ selector: "pre > code, .pxd-code-block--line-code"
31
+ });
30
32
  }
31
33
  } catch {
32
34
  unavailable = true;
@@ -0,0 +1,7 @@
1
+ import type { MaybeRefOrGetter, Ref } from 'vue';
2
+ export declare function useDetailsCollapse(contentRef: Ref<HTMLElement | undefined>, source: MaybeRefOrGetter<boolean>): {
3
+ isOpen: import("vue").ShallowRef<boolean, boolean>;
4
+ detailsOpen: import("vue").ShallowRef<boolean, boolean>;
5
+ onToggleClick: () => void;
6
+ onDetailsToggle: (ev: Event) => void;
7
+ };
@@ -0,0 +1,68 @@
1
+ import { onScopeDispose, shallowRef, watch } from "vue";
2
+ import { getStyle } from "../../utils/dom.js";
3
+ import { toValue } from "../../utils/helper.js";
4
+ export function useDetailsCollapse(contentRef, source) {
5
+ const isOpen = shallowRef(toValue(source));
6
+ const detailsOpen = shallowRef(isOpen.value);
7
+ let stopWait;
8
+ function clearWait() {
9
+ stopWait?.();
10
+ stopWait = void 0;
11
+ }
12
+ function waitForLeaveEnd() {
13
+ const el = contentRef.value;
14
+ if (!el) {
15
+ detailsOpen.value = false;
16
+ return;
17
+ }
18
+ clearWait();
19
+ const done = (event) => {
20
+ if (event && (event.propertyName !== "grid-template-rows" || event.target !== el)) {
21
+ return;
22
+ }
23
+ clearWait();
24
+ if (!isOpen.value) {
25
+ detailsOpen.value = false;
26
+ }
27
+ };
28
+ const ms = (Number.parseFloat(getStyle(el).transitionDuration) || 0) * 1e3;
29
+ if (!ms) {
30
+ done();
31
+ return;
32
+ }
33
+ el.addEventListener("transitionend", done);
34
+ const timer = window.setTimeout(done, ms + 50);
35
+ stopWait = () => {
36
+ el.removeEventListener("transitionend", done);
37
+ window.clearTimeout(timer);
38
+ };
39
+ }
40
+ function onToggleClick() {
41
+ isOpen.value = !isOpen.value;
42
+ }
43
+ function onDetailsToggle(ev) {
44
+ const details = ev.currentTarget;
45
+ if (details.open && !isOpen.value) {
46
+ isOpen.value = true;
47
+ }
48
+ }
49
+ watch(
50
+ () => toValue(source),
51
+ (value) => {
52
+ isOpen.value = value;
53
+ }
54
+ );
55
+ watch(
56
+ () => isOpen.value,
57
+ (open) => {
58
+ if (open) {
59
+ detailsOpen.value = true;
60
+ } else {
61
+ waitForLeaveEnd();
62
+ }
63
+ },
64
+ { flush: "post" }
65
+ );
66
+ onScopeDispose(clearWait);
67
+ return { isOpen, detailsOpen, onToggleClick, onDetailsToggle };
68
+ }
@@ -6,7 +6,7 @@ interface ListSelectionProps {
6
6
  }
7
7
  interface ListSelectionEmits {
8
8
  (event: 'change', value: NonNullable<ListModelValue>): void;
9
- (event: 'update:modelValue', value: NonNullable<ListModelValue>): void;
9
+ (event: 'update:model-value', value: NonNullable<ListModelValue>): void;
10
10
  }
11
11
  /** Next model value after an option click. Used by List; Menu only applies the result. */
12
12
  export declare function resolveNextListValue(current: ListModelValue | undefined, clicked: ComponentValue, multiple?: boolean): ListModelValue;
@@ -23,10 +23,10 @@ export function useListSelection(props, emits) {
23
23
  selected.value = nextValue;
24
24
  if (props.multiple) {
25
25
  dirty = true;
26
- emits("update:modelValue", nextValue);
26
+ emits("update:model-value", nextValue);
27
27
  return false;
28
28
  }
29
- emits("update:modelValue", nextValue);
29
+ emits("update:model-value", nextValue);
30
30
  emits("change", nextValue);
31
31
  return true;
32
32
  }
@@ -4,7 +4,7 @@ interface BaseProps {
4
4
  }
5
5
  interface BaseEmits {
6
6
  (event: 'change', ...args: any[]): void;
7
- (event: 'update:modelValue', ...args: any[]): void;
7
+ (event: 'update:model-value', ...args: any[]): void;
8
8
  }
9
9
  interface ModelValueOptions {
10
10
  get?: (value: any) => any;
@@ -6,7 +6,7 @@ export function useModelValue(props, emits, { withChange = true, get, set } = {}
6
6
  if (withChange) {
7
7
  emits("change", value);
8
8
  }
9
- emits("update:modelValue", value);
9
+ emits("update:model-value", value);
10
10
  })
11
11
  });
12
12
  return modelValue;
@@ -1,5 +1,5 @@
1
+ import { cn } from "cn";
1
2
  import { computed, useAttrs } from "vue";
2
- import { cn } from "../../utils/cn.js";
3
3
  function createTailwindVariantResolver(config) {
4
4
  const compoundVariants = config.compoundVariants?.map(({ class: classes, ...conditions }) => ({
5
5
  classes,