pxd 0.1.8 → 0.2.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 (244) hide show
  1. package/README.md +2 -2
  2. package/dist/components/_internal/calendar-day.d.vue.ts +15 -13
  3. package/dist/components/_internal/dismiss-container.d.vue.ts +5 -3
  4. package/dist/components/_internal/fragment-container.d.vue.ts +5 -3
  5. package/dist/components/_internal/mention-editor.d.vue.ts +3 -1
  6. package/dist/components/_internal/mention-editor.vue +9 -3
  7. package/dist/components/_internal/step-item.d.vue.ts +5 -3
  8. package/dist/components/_internal/tree-node.d.vue.ts +37 -33
  9. package/dist/components/_internal/tree-node.vue +17 -3
  10. package/dist/components/active-graph/index.d.vue.ts +7 -5
  11. package/dist/components/active-graph/index.vue +63 -63
  12. package/dist/components/approval-card/index.d.vue.ts +5 -3
  13. package/dist/components/avatar/index.d.vue.ts +7 -5
  14. package/dist/components/avatar/index.vue +1 -1
  15. package/dist/components/backtop/index.d.vue.ts +6 -4
  16. package/dist/components/backtop/index.vue +71 -38
  17. package/dist/components/backtop/types.d.ts +1 -0
  18. package/dist/components/badge/index.d.vue.ts +7 -5
  19. package/dist/components/book/index.d.vue.ts +9 -7
  20. package/dist/components/border-beam/index.d.vue.ts +5 -3
  21. package/dist/components/breadcrumb/index.d.vue.ts +5 -3
  22. package/dist/components/breadcrumb-item/index.d.vue.ts +7 -5
  23. package/dist/components/browser/index.d.vue.ts +5 -3
  24. package/dist/components/browser/index.vue +1 -1
  25. package/dist/components/bubble/index.d.vue.ts +14 -12
  26. package/dist/components/bubble/index.vue +8 -6
  27. package/dist/components/bubble/types.d.ts +1 -1
  28. package/dist/components/bubble-group/index.d.vue.ts +17 -14
  29. package/dist/components/bubble-group/index.vue +121 -9
  30. package/dist/components/bubble-group/types.d.ts +1 -1
  31. package/dist/components/button/index.d.vue.ts +9 -7
  32. package/dist/components/button/index.vue +6 -3
  33. package/dist/components/button-group/index.d.vue.ts +5 -3
  34. package/dist/components/calendar/index.d.vue.ts +20 -18
  35. package/dist/components/card/index.d.vue.ts +9 -7
  36. package/dist/components/carousel/index.d.vue.ts +13 -11
  37. package/dist/components/checkbox/index.d.vue.ts +5 -3
  38. package/dist/components/checkbox-group/index.d.vue.ts +5 -3
  39. package/dist/components/checkerboard/index.d.vue.ts +5 -3
  40. package/dist/components/chip/index.d.vue.ts +5 -3
  41. package/dist/components/choicebox/index.d.vue.ts +5 -3
  42. package/dist/components/choicebox/types.d.ts +2 -2
  43. package/dist/components/choicebox-item/index.d.vue.ts +9 -7
  44. package/dist/components/choicebox-item/index.vue +9 -5
  45. package/dist/components/choicebox-item/types.d.ts +1 -1
  46. package/dist/components/code-block/index.d.vue.ts +7 -5
  47. package/dist/components/code-block/index.vue +6 -6
  48. package/dist/components/collapse/index.d.vue.ts +7 -5
  49. package/dist/components/collapse-group/index.d.vue.ts +5 -3
  50. package/dist/components/command-menu/index.d.vue.ts +12 -10
  51. package/dist/components/command-menu/index.vue +1 -1
  52. package/dist/components/config-provider/index.d.vue.ts +5 -14
  53. package/dist/components/confirm-popover/index.d.vue.ts +16 -14
  54. package/dist/components/confirm-popover/index.vue +1 -1
  55. package/dist/components/context-usage/index.vue +19 -12
  56. package/dist/components/copy-button/index.d.vue.ts +7 -5
  57. package/dist/components/countdown/index.d.vue.ts +17 -16
  58. package/dist/components/countdown/index.vue +3 -8
  59. package/dist/components/countdown/types.d.ts +1 -1
  60. package/dist/components/date-picker/index.d.vue.ts +5 -3
  61. package/dist/components/description/index.d.vue.ts +7 -5
  62. package/dist/components/description/index.vue +5 -2
  63. package/dist/components/description/types.d.ts +1 -1
  64. package/dist/components/drawer/index.d.vue.ts +13 -11
  65. package/dist/components/drawer/index.vue +1 -1
  66. package/dist/components/effort-slider/index.vue +47 -47
  67. package/dist/components/empty-state/index.d.vue.ts +11 -9
  68. package/dist/components/empty-state/index.vue +2 -2
  69. package/dist/components/empty-state/types.d.ts +1 -1
  70. package/dist/components/error/index.d.vue.ts +5 -3
  71. package/dist/components/error/index.vue +1 -1
  72. package/dist/components/fader/index.d.vue.ts +2 -0
  73. package/dist/components/fader/index.vue +55 -29
  74. package/dist/components/fader/types.d.ts +2 -1
  75. package/dist/components/grid/index.d.vue.ts +5 -3
  76. package/dist/components/grid-item/index.d.vue.ts +5 -3
  77. package/dist/components/hint/index.d.vue.ts +15 -13
  78. package/dist/components/hold-button/index.d.vue.ts +9 -7
  79. package/dist/components/hue-text/index.d.vue.ts +7 -5
  80. package/dist/components/image-preview/index.d.vue.ts +24 -7
  81. package/dist/components/image-preview/index.vue +122 -23
  82. package/dist/components/image-preview/types.d.ts +9 -1
  83. package/dist/components/input/index.d.vue.ts +7 -5
  84. package/dist/components/input/index.vue +1 -1
  85. package/dist/components/intersection-observer/index.d.vue.ts +7 -5
  86. package/dist/components/kbd/index.d.vue.ts +5 -3
  87. package/dist/components/kbd/index.vue +1 -1
  88. package/dist/components/label/index.d.vue.ts +5 -3
  89. package/dist/components/link-button/index.d.vue.ts +10 -8
  90. package/dist/components/list/index.d.vue.ts +12 -10
  91. package/dist/components/list/index.vue +36 -43
  92. package/dist/components/list/types.d.ts +5 -5
  93. package/dist/components/list-group/index.vue +1 -1
  94. package/dist/components/list-item/index.d.vue.ts +5 -3
  95. package/dist/components/list-item/index.vue +16 -6
  96. package/dist/components/loading-dots/index.vue +0 -1
  97. package/dist/components/loading-mask/index.d.vue.ts +13 -1
  98. package/dist/components/loading-mask/index.vue +5 -3
  99. package/dist/components/marching-ants/index.d.vue.ts +6 -4
  100. package/dist/components/marquee/index.d.vue.ts +12 -10
  101. package/dist/components/material/index.d.vue.ts +5 -3
  102. package/dist/components/mention/index.d.vue.ts +17 -13
  103. package/dist/components/mention/index.vue +35 -3
  104. package/dist/components/mention/types.d.ts +11 -0
  105. package/dist/components/menu/index.d.vue.ts +16 -14
  106. package/dist/components/message/index.d.vue.ts +1 -1
  107. package/dist/components/modal/index.d.vue.ts +13 -11
  108. package/dist/components/modal/index.vue +2 -2
  109. package/dist/components/note/index.d.vue.ts +9 -7
  110. package/dist/components/number-input/index.d.vue.ts +15 -13
  111. package/dist/components/number-input/index.vue +7 -3
  112. package/dist/components/overlay/index.d.vue.ts +5 -3
  113. package/dist/components/pagination/index.d.vue.ts +5 -3
  114. package/dist/components/pagination/index.vue +2 -2
  115. package/dist/components/pin-input/index.d.vue.ts +1 -1
  116. package/dist/components/pin-input/index.vue +1 -1
  117. package/dist/components/placeholder/index.d.vue.ts +5 -3
  118. package/dist/components/popover/index.vue +4 -5
  119. package/dist/components/progress/index.d.vue.ts +5 -3
  120. package/dist/components/project-banner/index.d.vue.ts +9 -7
  121. package/dist/components/radial-burst/index.d.vue.ts +5 -3
  122. package/dist/components/radio/index.d.vue.ts +5 -3
  123. package/dist/components/radio-group/index.d.vue.ts +5 -3
  124. package/dist/components/rating/index.d.vue.ts +1 -1
  125. package/dist/components/reactions/index.d.vue.ts +5 -3
  126. package/dist/components/reasoning/index.d.vue.ts +6 -4
  127. package/dist/components/reasoning/index.vue +14 -12
  128. package/dist/components/reasoning/types.d.ts +5 -7
  129. package/dist/components/resizable/index.d.vue.ts +11 -9
  130. package/dist/components/resizable/index.vue +2 -2
  131. package/dist/components/reveal/index.d.vue.ts +6 -4
  132. package/dist/components/rolling-number/index.d.vue.ts +1 -1
  133. package/dist/components/scroll-progress/index.d.vue.ts +7 -5
  134. package/dist/components/scroll-text/index.d.vue.ts +6 -3
  135. package/dist/components/scroll-text/index.vue +11 -2
  136. package/dist/components/scroll-text/types.d.ts +1 -0
  137. package/dist/components/scrollable/index.d.vue.ts +5 -3
  138. package/dist/components/scrollable/index.vue +119 -179
  139. package/dist/components/search-input/index.d.vue.ts +7 -5
  140. package/dist/components/select/index.d.vue.ts +22 -20
  141. package/dist/components/select/index.vue +2 -2
  142. package/dist/components/shimmer-text/index.d.vue.ts +6 -4
  143. package/dist/components/skeleton/index.d.vue.ts +5 -3
  144. package/dist/components/slider/index.vue +74 -74
  145. package/dist/components/spinner/index.vue +0 -1
  146. package/dist/components/spinner-dots/index.vue +0 -1
  147. package/dist/components/split-button/index.d.vue.ts +18 -16
  148. package/dist/components/stack/index.d.vue.ts +5 -3
  149. package/dist/components/steps/index.d.vue.ts +9 -7
  150. package/dist/components/steps/index.vue +3 -3
  151. package/dist/components/stick-to-bottom/index.d.vue.ts +13 -10
  152. package/dist/components/stick-to-bottom/index.vue +25 -10
  153. package/dist/components/stick-to-bottom/types.d.ts +2 -1
  154. package/dist/components/swipe-cell/index.d.vue.ts +21 -19
  155. package/dist/components/switch/index.d.vue.ts +5 -3
  156. package/dist/components/switch/index.vue +1 -1
  157. package/dist/components/switch-item/index.d.vue.ts +5 -3
  158. package/dist/components/tabs/index.vue +1 -1
  159. package/dist/components/teleport/index.d.vue.ts +7 -5
  160. package/dist/components/text/index.d.vue.ts +5 -3
  161. package/dist/components/textarea/index.vue +1 -1
  162. package/dist/components/time-picker/index.d.vue.ts +5 -3
  163. package/dist/components/time-picker/index.vue +3 -8
  164. package/dist/components/timeline-item/index.d.vue.ts +7 -5
  165. package/dist/components/toc/index.d.vue.ts +11 -9
  166. package/dist/components/toc/index.vue +81 -62
  167. package/dist/components/todo-list/index.d.vue.ts +25 -23
  168. package/dist/components/todo-list/index.vue +2 -3
  169. package/dist/components/todo-list/types.d.ts +1 -1
  170. package/dist/components/toggle/index.d.vue.ts +7 -5
  171. package/dist/components/toggle/index.vue +1 -1
  172. package/dist/components/toggle-button/index.d.vue.ts +5 -3
  173. package/dist/components/toggle-button/index.vue +1 -1
  174. package/dist/components/toggle-button-group/index.d.vue.ts +5 -3
  175. package/dist/components/tool-call/index.d.vue.ts +15 -1
  176. package/dist/components/tool-call/index.vue +26 -16
  177. package/dist/components/tooltip/index.d.vue.ts +11 -9
  178. package/dist/components/tour/index.d.vue.ts +2 -2
  179. package/dist/components/tour/index.vue +1 -1
  180. package/dist/components/tour/types.d.ts +1 -1
  181. package/dist/components/tree/index.d.vue.ts +44 -42
  182. package/dist/components/tree/index.vue +16 -12
  183. package/dist/components/virtual-list/index.d.vue.ts +13 -10
  184. package/dist/components/virtual-list/index.vue +10 -5
  185. package/dist/components/virtual-list/types.d.ts +2 -1
  186. package/dist/composables/_internal/use-details-collapse.d.ts +2 -1
  187. package/dist/composables/_internal/use-focus-trap.d.ts +1 -2
  188. package/dist/composables/_internal/use-forward-ref-expose.d.ts +1 -1
  189. package/dist/composables/_internal/use-list-keyboard-controller.d.ts +1 -1
  190. package/dist/composables/_internal/use-list-navigation.d.ts +2 -1
  191. package/dist/composables/_internal/use-list-search.d.ts +2 -1
  192. package/dist/composables/_internal/use-list-search.js +1 -3
  193. package/dist/composables/_internal/use-mention-editor.d.ts +10 -5
  194. package/dist/composables/_internal/use-mention-editor.js +97 -25
  195. package/dist/composables/_internal/use-message-group.d.ts +1 -1
  196. package/dist/composables/_internal/use-overlay-manager.d.ts +1 -1
  197. package/dist/composables/_internal/use-remote-search.d.ts +2 -1
  198. package/dist/composables/_internal/use-selected-list-item.d.ts +1 -1
  199. package/dist/composables/_internal/use-swipe-gesture.d.ts +1 -2
  200. package/dist/composables/_internal/use-tailwind-variant.js +1 -1
  201. package/dist/composables/_internal/use-tour-target.d.ts +1 -1
  202. package/dist/composables/_internal/use-tree.d.ts +2 -2
  203. package/dist/composables/_internal/use-word-limit.d.ts +2 -1
  204. package/dist/composables/use-countdown.d.ts +2 -7
  205. package/dist/composables/use-countdown.js +6 -6
  206. package/dist/composables/use-deferred-value.d.ts +2 -1
  207. package/dist/composables/use-delay-change.d.ts +2 -1
  208. package/dist/composables/use-delay-destroy.d.ts +2 -2
  209. package/dist/composables/use-intersection-observer.d.ts +1 -1
  210. package/dist/composables/use-mutation-observer.d.ts +1 -1
  211. package/dist/composables/use-mutation-observer.js +4 -1
  212. package/dist/composables/use-outside-click.d.ts +1 -2
  213. package/dist/composables/use-repeat-action.d.ts +1 -2
  214. package/dist/composables/use-resize-observer.d.ts +1 -1
  215. package/dist/composables/use-scrollspy.d.ts +2 -1
  216. package/dist/composables/use-stick-to-bottom.d.ts +6 -2
  217. package/dist/composables/use-stick-to-bottom.js +18 -2
  218. package/dist/composables/use-virtual-list.d.ts +9 -3
  219. package/dist/composables/use-virtual-list.js +92 -48
  220. package/dist/constants/size.d.ts +1 -0
  221. package/dist/constants/size.js +1 -0
  222. package/dist/constants/tooltip-variants.d.ts +1 -1
  223. package/dist/constants/tooltip-variants.js +1 -1
  224. package/dist/index.d.ts +1 -1
  225. package/dist/index.js +1 -1
  226. package/dist/locales/en-us.d.ts +0 -11
  227. package/dist/locales/en-us.js +0 -11
  228. package/dist/locales/zh-cn.d.ts +0 -11
  229. package/dist/locales/zh-cn.js +0 -11
  230. package/dist/styles/styles.css +2 -2
  231. package/dist/types/shared/props.d.ts +4 -0
  232. package/dist/types/shared/utils.d.ts +4 -1
  233. package/dist/utils/_internal/mention-html.d.ts +32 -0
  234. package/dist/utils/_internal/mention-html.js +45 -17
  235. package/dist/utils/_internal/observer.d.ts +2 -1
  236. package/dist/utils/dom.d.ts +5 -6
  237. package/dist/utils/dom.js +5 -31
  238. package/dist/utils/event.d.ts +0 -1
  239. package/dist/utils/event.js +0 -3
  240. package/dist/utils/helper.d.ts +1 -4
  241. package/dist/utils/mention-html.js +13 -38
  242. package/dist/version.d.ts +1 -0
  243. package/dist/version.js +1 -0
  244. package/package.json +12 -12
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import ArrowUpIcon from "@gdsicon/vue/arrow-up";
3
- import { computed, onBeforeUnmount, onMounted, shallowRef } from "vue";
3
+ import { onBeforeUnmount, onMounted, shallowRef, watch } from "vue";
4
4
  import { useTailwindVariant } from "../../composables/_internal/use-tailwind-variant.js";
5
5
  import { useMotionReduced } from "../../composables/use-motion-reduce.js";
6
6
  import { useMutationObserver } from "../../composables/use-mutation-observer.js";
@@ -37,32 +37,32 @@ const props = defineProps({
37
37
  type: null,
38
38
  required: false,
39
39
  default: "auto"
40
+ },
41
+ scrollContainer: {
42
+ type: null,
43
+ required: false
40
44
  }
41
45
  });
42
46
  const emits = defineEmits(["click"]);
43
- let scrollContainer;
44
- const scrollTop = shallowRef(0);
45
- const maxScrollTop = shallowRef(0);
47
+ let scrollHost;
48
+ let maxScrollTop = 0;
49
+ // Starts stale, so the first evaluation reads the range off the element
50
+ let rangeDirty = true;
46
51
  const scrollContainerEl = shallowRef(null);
47
- const isMeasured = shallowRef(false);
48
- const updateScrollTop = throttleByRaf(() => {
52
+ const contentVersion = shallowRef(0);
53
+ const wrapperRef = shallowRef();
54
+ const isVisible = shallowRef(false);
55
+ const update = throttleByRaf(() => {
49
56
  const el = scrollContainerEl.value;
50
57
  if (!el) {
51
58
  return;
52
59
  }
53
- isMeasured.value = true;
54
- scrollTop.value = el.scrollTop;
55
- maxScrollTop.value = Math.max(0, el.scrollHeight - el.clientHeight);
56
- });
57
- const wrapperRef = shallowRef();
58
- const isVisible = computed(() => {
59
- if (!isMeasured.value) {
60
- return false;
61
- }
62
- if (props.scrollTarget === "top") {
63
- return scrollTop.value >= props.visibleThreshold;
60
+ if (rangeDirty) {
61
+ rangeDirty = false;
62
+ maxScrollTop = Math.max(0, el.scrollHeight - el.clientHeight);
64
63
  }
65
- return maxScrollTop.value - scrollTop.value >= props.visibleThreshold;
64
+ const distance = props.scrollTarget === "top" ? el.scrollTop : maxScrollTop - el.scrollTop;
65
+ isVisible.value = distance >= props.visibleThreshold;
66
66
  });
67
67
  const { attrs, classes } = useTailwindVariant({
68
68
  base: "pxd-backtop",
@@ -78,42 +78,75 @@ const { attrs, classes } = useTailwindVariant({
78
78
  visible: isVisible.value
79
79
  }) });
80
80
  const motionReduce = useMotionReduced();
81
- useResizeObserver(() => scrollContainerEl.value, updateScrollTop);
81
+ // An expanding panel moves a content root's box, while the container box and the node tree stay
82
+ // as they were
83
+ useResizeObserver(getContentTargets, invalidateRange);
82
84
  useMutationObserver(() => {
83
85
  const el = scrollContainerEl.value;
84
86
  return el && !isViewportScroll(el) ? el : null;
85
- }, updateScrollTop, {
87
+ }, () => {
88
+ contentVersion.value++;
89
+ invalidateRange();
90
+ }, {
86
91
  childList: true,
87
- subtree: true,
88
- attributes: true,
89
- attributeFilter: [
90
- "style",
91
- "class",
92
- "hidden"
93
- ]
92
+ subtree: true
94
93
  });
94
+ function invalidateRange() {
95
+ rangeDirty = true;
96
+ update();
97
+ }
98
+ function resolveScrollHost() {
99
+ if (props.scrollContainer) {
100
+ return props.scrollContainer;
101
+ }
102
+ const wrapper = wrapperRef.value;
103
+ return wrapper ? getScrollTarget(wrapper) : null;
104
+ }
105
+ function bindScrollHost() {
106
+ const host = resolveScrollHost();
107
+ const el = host ? getScrollElement(host) : null;
108
+ if (host === scrollHost && el === scrollContainerEl.value) {
109
+ return;
110
+ }
111
+ update.cancel();
112
+ if (scrollHost) {
113
+ cachedOff(scrollHost, "scroll", update, { passive: true });
114
+ }
115
+ scrollHost = host;
116
+ scrollContainerEl.value = el;
117
+ if (host) {
118
+ cachedOn(host, "scroll", update, { passive: true });
119
+ } else {
120
+ isVisible.value = false;
121
+ }
122
+ invalidateRange();
123
+ }
124
+ function getContentTargets() {
125
+ void contentVersion.value;
126
+ const el = scrollContainerEl.value;
127
+ return el ? [el, ...Array.from(el.children)] : [];
128
+ }
95
129
  function onActionClick(ev) {
96
130
  emits("click", ev);
97
- if (!scrollContainer || !scrollContainerEl.value) {
131
+ if (!scrollHost || !scrollContainerEl.value) {
98
132
  return;
99
133
  }
100
134
  const top = props.scrollTarget === "bottom" ? Math.max(0, scrollContainerEl.value.scrollHeight - scrollContainerEl.value.clientHeight) : 0;
101
- scrollContainer.scrollTo({
135
+ scrollHost.scrollTo({
102
136
  top,
103
137
  left: 0,
104
138
  behavior: resolveScrollBehavior(props.scrollBehavior, motionReduce)
105
139
  });
106
140
  }
107
- onMounted(() => {
108
- scrollContainer = getScrollTarget(wrapperRef.value);
109
- scrollContainerEl.value = getScrollElement(scrollContainer);
110
- updateScrollTop();
111
- cachedOn(scrollContainer, "scroll", updateScrollTop, { passive: true });
112
- });
141
+ watch(() => [props.scrollTarget, props.visibleThreshold], update);
142
+ watch(() => props.scrollContainer, bindScrollHost, { flush: "post" });
143
+ onMounted(bindScrollHost);
113
144
  onBeforeUnmount(() => {
114
- updateScrollTop.cancel();
115
- cachedOff(scrollContainer, "scroll", updateScrollTop, { passive: true });
116
- scrollContainer = null;
145
+ update.cancel();
146
+ if (scrollHost) {
147
+ cachedOff(scrollHost, "scroll", update, { passive: true });
148
+ }
149
+ scrollHost = null;
117
150
  scrollContainerEl.value = null;
118
151
  });
119
152
  </script>
@@ -6,6 +6,7 @@ export interface BacktopProps {
6
6
  visibleThreshold?: number
7
7
  scrollTarget?: 'top' | 'bottom'
8
8
  scrollBehavior?: ScrollBehavior
9
+ scrollContainer?: HTMLElement | null
9
10
  }
10
11
 
11
12
  export interface BacktopEmits {
@@ -1,10 +1,12 @@
1
1
  import type { BadgeProps } from './types';
2
- declare var __VLS_7: {}, __VLS_9: {};
3
- type __VLS_Slots = {} & {
4
- prefix?: (props: typeof __VLS_7) => any;
5
- } & {
6
- default?: (props: typeof __VLS_9) => any;
2
+ declare const __VLS_template: () => {
3
+ __VLS_Slots: {
4
+ prefix?: (props: {}) => any;
5
+ } & {
6
+ default?: (props: {}) => any;
7
+ };
7
8
  };
9
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
10
  declare const __VLS_base: import("vue").DefineComponent<BadgeProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
11
  close: (args_0: Event) => any;
10
12
  }, string, import("vue").PublicProps, Readonly<BadgeProps> & Readonly<{
@@ -1,12 +1,14 @@
1
1
  import type { BookProps } from './types';
2
- declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {};
3
- type __VLS_Slots = {} & {
4
- icon?: (props: typeof __VLS_1) => any;
5
- } & {
6
- title?: (props: typeof __VLS_3) => any;
7
- } & {
8
- icon?: (props: typeof __VLS_5) => any;
2
+ declare const __VLS_template: () => {
3
+ __VLS_Slots: {
4
+ icon?: (props: {}) => any;
5
+ } & {
6
+ title?: (props: {}) => any;
7
+ } & {
8
+ icon?: (props: {}) => any;
9
+ };
9
10
  };
11
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
10
12
  declare const __VLS_base: import("vue").DefineComponent<BookProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BookProps> & Readonly<{}>, {
11
13
  variant: "simple" | "stripe";
12
14
  textured: boolean;
@@ -1,8 +1,10 @@
1
1
  import type { BorderBeamProps } from './types';
2
- declare var __VLS_1: {};
3
- type __VLS_Slots = {} & {
4
- default?: (props: typeof __VLS_1) => any;
2
+ declare const __VLS_template: () => {
3
+ __VLS_Slots: {
4
+ default?: (props: {}) => any;
5
+ };
5
6
  };
7
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
6
8
  declare const __VLS_base: import("vue").DefineComponent<BorderBeamProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BorderBeamProps> & Readonly<{}>, {
7
9
  variant: import("./types").BorderBeamVariant;
8
10
  disabled: boolean;
@@ -1,8 +1,10 @@
1
1
  import type { BreadcrumbProps } from './types';
2
- declare var __VLS_1: {};
3
- type __VLS_Slots = {} & {
4
- default?: (props: typeof __VLS_1) => any;
2
+ declare const __VLS_template: () => {
3
+ __VLS_Slots: {
4
+ default?: (props: {}) => any;
5
+ };
5
6
  };
7
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
6
8
  declare const __VLS_base: import("vue").DefineComponent<BreadcrumbProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BreadcrumbProps> & Readonly<{}>, {
7
9
  separator: string;
8
10
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,10 +1,12 @@
1
1
  import type { BreadcrumbItemProps } from './types';
2
- declare var __VLS_7: {}, __VLS_9: {};
3
- type __VLS_Slots = {} & {
4
- default?: (props: typeof __VLS_7) => any;
5
- } & {
6
- default?: (props: typeof __VLS_9) => any;
2
+ declare const __VLS_template: () => {
3
+ __VLS_Slots: {
4
+ default?: (props: {}) => any;
5
+ } & {
6
+ default?: (props: {}) => any;
7
+ };
7
8
  };
9
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
8
10
  declare const __VLS_base: import("vue").DefineComponent<BreadcrumbItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BreadcrumbItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
11
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
12
  declare const _default: typeof __VLS_export;
@@ -1,8 +1,10 @@
1
1
  import type { BrowserProps } from './types';
2
- declare var __VLS_26: {};
3
- type __VLS_Slots = {} & {
4
- default?: (props: typeof __VLS_26) => any;
2
+ declare const __VLS_template: () => {
3
+ __VLS_Slots: {
4
+ default?: (props: {}) => any;
5
+ };
5
6
  };
7
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
6
8
  declare const __VLS_base: import("vue").DefineComponent<BrowserProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BrowserProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
9
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
8
10
  declare const _default: typeof __VLS_export;
@@ -44,7 +44,7 @@ defineProps({ address: {
44
44
  >
45
45
  <LockClosedIcon class="text-sm text-foreground-secondary" />
46
46
 
47
- <div class="ps-1.5 min-w-0 flex-1 truncate text-center text-[0.8125rem] text-gray-1000">
47
+ <div class="ps-1.5 min-w-0 text-xs flex-1 truncate text-center text-gray-1000">
48
48
  {{ address }}
49
49
  </div>
50
50
 
@@ -1,19 +1,21 @@
1
1
  import type { BubbleProps } from './types';
2
- declare var __VLS_1: {}, __VLS_8: {}, __VLS_15: {}, __VLS_17: {}, __VLS_19: {};
3
- type __VLS_Slots = {} & {
4
- avatar?: (props: typeof __VLS_1) => any;
5
- } & {
6
- header?: (props: typeof __VLS_8) => any;
7
- } & {
8
- default?: (props: typeof __VLS_15) => any;
9
- } & {
10
- reactions?: (props: typeof __VLS_17) => any;
11
- } & {
12
- footer?: (props: typeof __VLS_19) => any;
2
+ declare const __VLS_template: () => {
3
+ __VLS_Slots: {
4
+ avatar?: (props: {}) => any;
5
+ } & {
6
+ header?: (props: {}) => any;
7
+ } & {
8
+ default?: (props: {}) => any;
9
+ } & {
10
+ reactions?: (props: {}) => any;
11
+ } & {
12
+ footer?: (props: {}) => any;
13
+ };
13
14
  };
15
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
14
16
  declare const __VLS_base: import("vue").DefineComponent<BubbleProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BubbleProps> & Readonly<{}>, {
15
- variant: "default" | "ghost";
16
17
  role: "user" | "system" | "assistant";
18
+ variant: "default" | "primary" | "secondary" | "ghost";
17
19
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
20
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
21
  declare const _default: typeof __VLS_export;
@@ -49,15 +49,17 @@ const { attrs, classes } = useTailwindVariant({
49
49
  } }
50
50
  }, { selection: () => ({ role: props.role }) });
51
51
  const { classes: contentClasses } = useTailwindVariant({
52
- base: "pxd-bubble--content px-2.5 py-2 relative w-max max-w-full overflow-hidden rounded-lg border border-gray-alpha-100 break-all whitespace-pre-wrap motion-safe:transition-colors",
52
+ base: "pxd-bubble--content px-2.5 py-2 relative w-max max-w-full overflow-hidden rounded-lg border break-all whitespace-pre-wrap motion-safe:transition-colors",
53
53
  variants: {
54
54
  role: {
55
- user: "ms-auto bg-primary text-primary-foreground motion-safe:transition-[filter]",
56
- system: "bg-gray-100",
57
- assistant: "bg-gray-100"
55
+ user: "ms-auto",
56
+ system: "",
57
+ assistant: ""
58
58
  },
59
59
  variant: {
60
- default: "",
60
+ default: "bg-background-100",
61
+ primary: "border-primary bg-primary text-primary-foreground motion-safe:transition-[filter]",
62
+ secondary: "bg-gray-100",
61
63
  ghost: "bg-background border-transparent text-foreground"
62
64
  },
63
65
  interactive: {}
@@ -71,7 +73,7 @@ const { classes: contentClasses } = useTailwindVariant({
71
73
  },
72
74
  {
73
75
  role: "user",
74
- variant: "default",
76
+ variant: "primary",
75
77
  interactive: true,
76
78
  class: "hover:brightness-90"
77
79
  },
@@ -4,6 +4,6 @@ export interface BubbleProps {
4
4
  header?: string
5
5
  avatar?: string
6
6
  loading?: boolean
7
- variant?: 'default' | 'ghost'
7
+ variant?: 'default' | 'ghost' | 'primary' | 'secondary'
8
8
  interactive?: boolean
9
9
  }
@@ -1,20 +1,23 @@
1
+ import type { VirtualListScrollSource } from '../../composables/use-virtual-list.js';
1
2
  import type { BubbleGroupProps } from './types';
2
- declare var __VLS_8: {
3
- item: any;
4
- index: number;
5
- }, __VLS_11: {
6
- item: any;
7
- index: number;
8
- }, __VLS_13: {};
9
- type __VLS_Slots = {} & {
10
- item?: (props: typeof __VLS_8) => any;
11
- } & {
12
- item?: (props: typeof __VLS_11) => any;
13
- } & {
14
- default?: (props: typeof __VLS_13) => any;
3
+ declare const __VLS_template: () => {
4
+ __VLS_Slots: {
5
+ item?: (props: {
6
+ item: any;
7
+ index: number;
8
+ }) => any;
9
+ } & {
10
+ item?: (props: {
11
+ item: any;
12
+ index: number;
13
+ }) => any;
14
+ } & {
15
+ default?: (props: {}) => any;
16
+ };
15
17
  };
18
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
16
19
  declare const __VLS_base: import("vue").DefineComponent<BubbleGroupProps, {
17
- scrollSource: import("../../composables/use-virtual-list.js").VirtualListScrollSource;
20
+ scrollSource: VirtualListScrollSource;
18
21
  forceStickToBottom: () => void | undefined;
19
22
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BubbleGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
23
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1,6 +1,8 @@
1
1
  <script setup>
2
- import { computed, onMounted, shallowRef } from "vue";
2
+ import { computed, onMounted, onScopeDispose, shallowRef } from "vue";
3
+ import { useResizeObserver } from "../../composables/use-resize-observer.js";
3
4
  import { useVirtualList } from "../../composables/use-virtual-list.js";
5
+ import { cachedOn, throttleByRaf } from "../../utils/event.js";
4
6
  import PBacktop from "../backtop/index.vue";
5
7
  import PStickToBottom from "../stick-to-bottom/index.vue";
6
8
  defineOptions({
@@ -21,7 +23,7 @@ const props = defineProps({
21
23
  required: false
22
24
  },
23
25
  itemSize: {
24
- type: Number,
26
+ type: [Number, Function],
25
27
  required: false
26
28
  },
27
29
  overScan: {
@@ -29,9 +31,21 @@ const props = defineProps({
29
31
  required: false
30
32
  }
31
33
  });
34
+ const ITEM_STYLE_CACHE_LIMIT = 512;
35
+ const itemStyles = new Map();
36
+ let domOffsets = [];
37
+ let stopScroll = null;
32
38
  const stickRef = shallowRef();
39
+ const scrollVersion = shallowRef(0);
33
40
  const isVirtual = computed(() => props.virtual === true && !!props.data);
34
- const { totalSize, virtualItems, measureElement, scrollSource } = useVirtualList(() => stickRef.value?.containerRef ?? null, {
41
+ const bumpScroll = throttleByRaf(() => {
42
+ if (isVirtual.value) {
43
+ return;
44
+ }
45
+ measureDomOffsets();
46
+ scrollVersion.value++;
47
+ });
48
+ const { totalSize, virtualItems, measureElement, scrollSource: virtualScrollSource } = useVirtualList(() => stickRef.value?.containerRef ?? null, {
35
49
  enabled: () => isVirtual.value,
36
50
  get dataKey() {
37
51
  return props.dataKey;
@@ -44,19 +58,115 @@ const { totalSize, virtualItems, measureElement, scrollSource } = useVirtualList
44
58
  },
45
59
  get overScan() {
46
60
  return props.overScan;
47
- }
61
+ },
62
+ onGeometryChange: () => stickRef.value?.stickIfNeeded()
48
63
  });
64
+ const scrollSource = {
65
+ getOffsetForIndex(index) {
66
+ return isVirtual.value ? virtualScrollSource.getOffsetForIndex(index) : getDomOffset(index);
67
+ },
68
+ getScrollOffset() {
69
+ if (isVirtual.value) {
70
+ return virtualScrollSource.getScrollOffset();
71
+ }
72
+ void scrollVersion.value;
73
+ return getContainer()?.scrollTop ?? null;
74
+ },
75
+ getMaxScrollOffset() {
76
+ if (isVirtual.value) {
77
+ return virtualScrollSource.getMaxScrollOffset();
78
+ }
79
+ void scrollVersion.value;
80
+ const container = getContainer();
81
+ return container ? Math.max(0, container.scrollHeight - container.clientHeight) : 0;
82
+ },
83
+ scrollToIndex(index, options) {
84
+ if (isVirtual.value) {
85
+ virtualScrollSource.scrollToIndex(index, options);
86
+ return;
87
+ }
88
+ const offset = getDomOffset(index);
89
+ const container = getContainer();
90
+ if (offset == null || !container) {
91
+ return;
92
+ }
93
+ container.scrollTo({
94
+ top: Math.max(0, offset),
95
+ behavior: options?.behavior ?? "auto"
96
+ });
97
+ }
98
+ };
49
99
  const contentStyle = computed(() => {
50
100
  if (!isVirtual.value) {
51
101
  return undefined;
52
102
  }
53
103
  return { "--bubble-group-height": `${totalSize.value}px` };
54
104
  });
105
+ useResizeObserver(() => stickRef.value?.contentRef ?? null, () => {
106
+ if (isVirtual.value) {
107
+ return;
108
+ }
109
+ measureDomOffsets();
110
+ scrollVersion.value++;
111
+ });
112
+ function getItemStyle(start) {
113
+ let style = itemStyles.get(start);
114
+ if (!style) {
115
+ if (itemStyles.size >= ITEM_STYLE_CACHE_LIMIT) {
116
+ itemStyles.clear();
117
+ }
118
+ style = {
119
+ transform: `translateY(${start}px)`,
120
+ contain: "layout"
121
+ };
122
+ itemStyles.set(start, style);
123
+ }
124
+ return style;
125
+ }
55
126
  function getDataItemKey(item, index) {
56
127
  return (props.dataKey ? item[props.dataKey] : index) ?? index;
57
128
  }
129
+ function getContainer() {
130
+ return stickRef.value?.containerRef ?? null;
131
+ }
132
+ function measureDomOffsets() {
133
+ const container = getContainer();
134
+ const content = stickRef.value?.contentRef;
135
+ if (!container || !content) {
136
+ domOffsets = [];
137
+ return;
138
+ }
139
+ const base = content.getBoundingClientRect().top - container.getBoundingClientRect().top + container.scrollTop + content.clientTop;
140
+ const rows = content.children;
141
+ const next = [];
142
+ for (let index = 0; index < rows.length; index++) {
143
+ next.push(base + rows[index].offsetTop);
144
+ }
145
+ domOffsets = next;
146
+ }
147
+ function getDomOffset(index) {
148
+ void scrollVersion.value;
149
+ const content = stickRef.value?.contentRef;
150
+ if (!content) {
151
+ return undefined;
152
+ }
153
+ if (domOffsets.length !== content.children.length) {
154
+ measureDomOffsets();
155
+ }
156
+ return domOffsets[index];
157
+ }
58
158
  onMounted(() => {
159
+ const container = getContainer();
160
+ if (container) {
161
+ stopScroll = cachedOn(container, "scroll", bumpScroll, { passive: true });
162
+ }
59
163
  stickRef.value?.forceStickToBottom();
164
+ measureDomOffsets();
165
+ });
166
+ onScopeDispose(() => {
167
+ stopScroll?.();
168
+ stopScroll = null;
169
+ bumpScroll.cancel();
60
170
  });
61
171
  defineExpose({
62
172
  scrollSource,
@@ -68,8 +178,8 @@ defineExpose({
68
178
  <PStickToBottom
69
179
  ref="stickRef"
70
180
  data-bubble-group
71
- class="pxd-bubble-group relative overflow-x-hidden"
72
- :threshold="8"
181
+ class="pxd-bubble-group min-h-0 h-full flex-1"
182
+ wrapper-class="overflow-x-hidden px-1 py-4 scrollbar-gutter-both"
73
183
  content-class="pxd-bubble-group--content relative w-full h-(--bubble-group-height)"
74
184
  :style="contentStyle"
75
185
  v-bind="$attrs"
@@ -78,10 +188,10 @@ defineExpose({
78
188
  <div
79
189
  v-for="virtualItem in virtualItems"
80
190
  :key="virtualItem.key"
81
- :ref="(el) => measureElement(el)"
191
+ :ref="measureElement"
82
192
  :data-index="virtualItem.index"
83
193
  class="pxd-bubble-group--item sibling:pbs-3 left-0 top-0 absolute w-full"
84
- :style="{ transform: `translateY(${virtualItem.start}px)` }"
194
+ :style="getItemStyle(virtualItem.start)"
85
195
  >
86
196
  <slot name="item" :item="data[virtualItem.index]" :index="virtualItem.index" />
87
197
  </div>
@@ -91,6 +201,7 @@ defineExpose({
91
201
  <div
92
202
  v-for="(item, index) in data"
93
203
  :key="getDataItemKey(item, index)"
204
+ :data-index="index"
94
205
  class="pxd-bubble-group--item sibling:pbs-3 w-full"
95
206
  >
96
207
  <slot name="item" :item="item" :index="index" />
@@ -99,8 +210,9 @@ defineExpose({
99
210
 
100
211
  <slot v-else />
101
212
 
102
- <template #action>
213
+ <template #action="{ container }">
103
214
  <PBacktop
215
+ :scroll-container="container"
104
216
  class="bottom-1 shadow-sm left-1/2 z-1 w-max -translate-x-1/2 rounded-full"
105
217
  scroll-target="bottom"
106
218
  :append-to-body="false"
@@ -2,6 +2,6 @@ export interface BubbleGroupProps {
2
2
  data?: readonly any[]
3
3
  virtual?: boolean
4
4
  dataKey?: string
5
- itemSize?: number
5
+ itemSize?: number | ((index: number) => number)
6
6
  overScan?: number
7
7
  }
@@ -1,12 +1,14 @@
1
1
  import type { ButtonProps } from './types';
2
- declare var __VLS_12: {}, __VLS_14: {}, __VLS_16: {};
3
- type __VLS_Slots = {} & {
4
- prefix?: (props: typeof __VLS_12) => any;
5
- } & {
6
- default?: (props: typeof __VLS_14) => any;
7
- } & {
8
- suffix?: (props: typeof __VLS_16) => any;
2
+ declare const __VLS_template: () => {
3
+ __VLS_Slots: {
4
+ prefix?: (props: {}) => any;
5
+ } & {
6
+ default?: (props: {}) => any;
7
+ } & {
8
+ suffix?: (props: {}) => any;
9
+ };
9
10
  };
11
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
10
12
  declare const __VLS_base: import("vue").DefineComponent<ButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ButtonProps> & Readonly<{}>, {
11
13
  as: import("../../types/shared/props.js").ComponentAs;
12
14
  shape: import("../../types/shared/props.js").ComponentShape;
@@ -66,7 +66,7 @@ const btnContentClasses = computed(() => {
66
66
  right: "justify-end"
67
67
  }[internalAlign || buttonGroupContext?.props.align || "center"];
68
68
  return {
69
- "px-1": !icon,
69
+ "not-first:ps-1 not-last:pe-1 only:px-1": !icon,
70
70
  [alignClasses]: true
71
71
  };
72
72
  });
@@ -76,7 +76,7 @@ const { attrs, classes } = useTailwindVariant({
76
76
  size: {
77
77
  xxs: `${BASIC_HEIGHTS.xxs} px-1 rounded-sm text-[0.6875rem]`,
78
78
  xs: `${BASIC_HEIGHTS.xs} px-1 text-xs rounded-sm`,
79
- sm: `${BASIC_HEIGHTS.sm} px-2 rounded-md text-[0.8125rem]`,
79
+ sm: `${BASIC_HEIGHTS.sm} px-2 text-sm rounded-md`,
80
80
  md: `${BASIC_HEIGHTS.md} px-3 text-sm rounded-md`,
81
81
  lg: `${BASIC_HEIGHTS.lg} px-4 text-base rounded-lg`
82
82
  },
@@ -142,7 +142,10 @@ const { attrs, classes } = useTailwindVariant({
142
142
  <PSpinner v-if="loading" />
143
143
  <slot v-else name="prefix" />
144
144
 
145
- <span class="min-w-0 flex flex-1 items-center empty:hidden" :class="btnContentClasses">
145
+ <span
146
+ class="min-w-0 flex flex-1 items-center whitespace-nowrap empty:hidden"
147
+ :class="btnContentClasses"
148
+ >
146
149
  <slot />
147
150
  </span>
148
151