@vuer-ai/vuer-uikit 0.0.75 → 0.0.77

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 (124) hide show
  1. package/dist/{chunk-P27TWGME.cjs → chunk-33ZAFHOY.cjs} +2 -2
  2. package/dist/{chunk-IZFHHQ6S.mjs → chunk-3HERIMKO.mjs} +2 -2
  3. package/dist/chunk-3LM4LVYM.mjs +187 -0
  4. package/dist/chunk-6E4NTY34.cjs +494 -0
  5. package/dist/{chunk-VNYP2IVJ.cjs → chunk-7644AY3P.cjs} +2 -2
  6. package/dist/chunk-AHNVEAOM.cjs +855 -0
  7. package/dist/{chunk-5432JOTN.mjs → chunk-AOAM6HV2.mjs} +2 -2
  8. package/dist/chunk-BWBBQCG2.mjs +217 -0
  9. package/dist/{chunk-P5T6EVSQ.mjs → chunk-CSSMBHBD.mjs} +1 -1
  10. package/dist/chunk-CW6FHIAT.cjs +624 -0
  11. package/dist/chunk-D4W2G6CY.cjs +494 -0
  12. package/dist/{chunk-NS2P4CPA.mjs → chunk-D5YKZOUG.mjs} +4 -4
  13. package/dist/{chunk-2274XZ2C.cjs → chunk-E6D3BSYY.cjs} +6 -6
  14. package/dist/chunk-HOJOWLJT.mjs +142 -0
  15. package/dist/chunk-HTAFERCZ.mjs +1 -0
  16. package/dist/chunk-HTHCG2AN.cjs +125 -0
  17. package/dist/chunk-HVVT3D2T.mjs +1 -0
  18. package/dist/chunk-IZJYFVS7.mjs +15 -0
  19. package/dist/chunk-KFPS5CCR.cjs +2 -0
  20. package/dist/chunk-KQXLV6YW.mjs +489 -0
  21. package/dist/chunk-LBENVTO2.mjs +853 -0
  22. package/dist/chunk-MMT74K7A.mjs +247 -0
  23. package/dist/chunk-NEOSSUNE.mjs +599 -0
  24. package/dist/chunk-OEM5OJDP.mjs +489 -0
  25. package/dist/chunk-RM7E3WGH.cjs +71 -0
  26. package/dist/chunk-SYXRPCBO.cjs +220 -0
  27. package/dist/chunk-TE5JNR5C.mjs +117 -0
  28. package/dist/chunk-UHDBWDHS.cjs +190 -0
  29. package/dist/{chunk-Z5P6VCGR.cjs → chunk-V2OROE7H.cjs} +2 -2
  30. package/dist/chunk-VOTZLQ6J.cjs +2 -0
  31. package/dist/chunk-W4CDQ2RJ.mjs +69 -0
  32. package/dist/chunk-XKIB3LSS.cjs +167 -0
  33. package/dist/chunk-YPQYI63K.cjs +249 -0
  34. package/dist/chunk-ZO3X2NDT.cjs +21 -0
  35. package/dist/highlight-cursor/enhanced-components.cjs +8 -8
  36. package/dist/highlight-cursor/enhanced-components.mjs +3 -3
  37. package/dist/highlight-cursor/index.cjs +12 -12
  38. package/dist/highlight-cursor/index.mjs +3 -3
  39. package/dist/index.cjs +442 -417
  40. package/dist/index.d.cts +6 -2
  41. package/dist/index.d.ts +6 -2
  42. package/dist/index.mjs +43 -38
  43. package/dist/ui/UIKitBadge.cjs +5 -5
  44. package/dist/ui/UIKitBadge.mjs +1 -1
  45. package/dist/ui/badge.d.cts +1 -1
  46. package/dist/ui/badge.d.ts +1 -1
  47. package/dist/ui/index.cjs +362 -337
  48. package/dist/ui/index.d.cts +6 -2
  49. package/dist/ui/index.d.ts +6 -2
  50. package/dist/ui/index.mjs +42 -37
  51. package/dist/ui/inputs/index.cjs +5 -5
  52. package/dist/ui/inputs/index.mjs +1 -1
  53. package/dist/ui/inputs/input.d.cts +1 -1
  54. package/dist/ui/inputs/input.d.ts +1 -1
  55. package/dist/ui/layouts/index.cjs +6 -6
  56. package/dist/ui/layouts/index.mjs +2 -2
  57. package/dist/ui/pagination.cjs +9 -9
  58. package/dist/ui/pagination.mjs +2 -2
  59. package/dist/ui/select.d.cts +1 -1
  60. package/dist/ui/select.d.ts +1 -1
  61. package/dist/ui/sidebar.cjs +26 -26
  62. package/dist/ui/sidebar.mjs +2 -2
  63. package/dist/ui/{tree-view.cjs → simple-tree-view.cjs} +3 -3
  64. package/dist/ui/{tree-view.d.cts → simple-tree-view.d.cts} +1 -1
  65. package/dist/ui/{tree-view.d.ts → simple-tree-view.d.ts} +1 -1
  66. package/dist/ui/{tree-view.mjs → simple-tree-view.mjs} +1 -1
  67. package/dist/ui/tabs.cjs +6 -6
  68. package/dist/ui/tabs.mjs +2 -2
  69. package/dist/ui/textarea.d.cts +1 -1
  70. package/dist/ui/textarea.d.ts +1 -1
  71. package/dist/ui/timeline.cjs +4 -4
  72. package/dist/ui/timeline.d.cts +1 -1
  73. package/dist/ui/timeline.d.ts +1 -1
  74. package/dist/ui/timeline.mjs +3 -3
  75. package/dist/ui/tree-view/TreeSearchBar.cjs +22 -0
  76. package/dist/ui/tree-view/TreeSearchBar.d.cts +16 -0
  77. package/dist/ui/tree-view/TreeSearchBar.d.ts +16 -0
  78. package/dist/ui/tree-view/TreeSearchBar.mjs +13 -0
  79. package/dist/ui/tree-view/TreeView.cjs +24 -0
  80. package/dist/ui/tree-view/TreeView.d.cts +48 -0
  81. package/dist/ui/tree-view/TreeView.d.ts +48 -0
  82. package/dist/ui/tree-view/TreeView.mjs +11 -0
  83. package/dist/ui/tree-view/hooks.cjs +14 -0
  84. package/dist/ui/tree-view/hooks.d.cts +38 -0
  85. package/dist/ui/tree-view/hooks.d.ts +38 -0
  86. package/dist/ui/tree-view/hooks.mjs +1 -0
  87. package/dist/ui/tree-view/index.cjs +42 -0
  88. package/dist/ui/tree-view/index.d.cts +6 -0
  89. package/dist/ui/tree-view/index.d.ts +6 -0
  90. package/dist/ui/tree-view/index.mjs +17 -0
  91. package/dist/ui/tree-view/types.cjs +4 -0
  92. package/dist/ui/tree-view/types.d.cts +24 -0
  93. package/dist/ui/tree-view/types.d.ts +24 -0
  94. package/dist/ui/tree-view/types.mjs +1 -0
  95. package/dist/ui/tree-view-legacy.cjs +37 -0
  96. package/dist/ui/tree-view-legacy.d.cts +108 -0
  97. package/dist/ui/tree-view-legacy.d.ts +108 -0
  98. package/dist/ui/{tree-view-v2.mjs → tree-view-legacy.mjs} +2 -2
  99. package/dist/ui/waterfall/TimelineEvent.d.cts +1 -1
  100. package/dist/ui/waterfall/TimelineEvent.d.ts +1 -1
  101. package/dist/ui/waterfall/TimelineProcessBar.d.cts +1 -1
  102. package/dist/ui/waterfall/TimelineProcessBar.d.ts +1 -1
  103. package/dist/ui/waterfall/Wedges.d.cts +1 -1
  104. package/dist/ui/waterfall/Wedges.d.ts +1 -1
  105. package/dist/ui/waterfall/hooks/useTimelineState.d.cts +1 -2
  106. package/dist/ui/waterfall/hooks/useTimelineState.d.ts +1 -2
  107. package/dist/ui/waterfall/hooks/useViewport.d.cts +1 -2
  108. package/dist/ui/waterfall/hooks/useViewport.d.ts +1 -2
  109. package/dist/ui/waterfall/index.cjs +6 -6
  110. package/dist/ui/waterfall/index.d.cts +1 -1
  111. package/dist/ui/waterfall/index.d.ts +1 -1
  112. package/dist/ui/waterfall/index.mjs +5 -5
  113. package/dist/ui/waterfall/types.d.cts +1 -2
  114. package/dist/ui/waterfall/types.d.ts +1 -2
  115. package/package.json +1 -1
  116. package/dist/chunk-FD5AAGON.cjs +0 -487
  117. package/dist/chunk-ILGNKXK2.mjs +0 -485
  118. package/dist/ui/tree-view-v2.cjs +0 -25
  119. package/dist/ui/tree-view-v2.d.cts +0 -43
  120. package/dist/ui/tree-view-v2.d.ts +0 -43
  121. /package/dist/{chunk-SUABRIFA.mjs → chunk-2SWBXWLK.mjs} +0 -0
  122. /package/dist/{chunk-XMUP5MIM.mjs → chunk-G3EIVAVR.mjs} +0 -0
  123. /package/dist/{chunk-OX2U5RAG.cjs → chunk-G5NT42YF.cjs} +0 -0
  124. /package/dist/{chunk-J5DLIKNB.cjs → chunk-X2A7TKER.cjs} +0 -0
@@ -2,9 +2,9 @@ import { cn } from './chunk-HMN4IKTG.mjs';
2
2
  import { GitBranch } from 'lucide-react';
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
4
 
5
- var PACKAGE_VERSION = "0.0.74" ;
5
+ var PACKAGE_VERSION = "0.0.75" ;
6
6
  var PACKAGE_NAME = "@vuer-ai/vuer-uikit" ;
7
- var GIT_HASH = "5cd2f59" ;
7
+ var GIT_HASH = "f5eb08c" ;
8
8
  function PackageBadge({
9
9
  className,
10
10
  packageName,
@@ -0,0 +1,217 @@
1
+ import { useState, useMemo, useCallback } from 'react';
2
+ import { jsx, Fragment } from 'react/jsx-runtime';
3
+
4
+ // src/ui/tree-view/hooks.tsx
5
+ function useTreeSearch({
6
+ data,
7
+ searchQuery,
8
+ isCaseSensitive = false,
9
+ isRegex = false
10
+ }) {
11
+ const [isRegexValid, setIsRegexValid] = useState(true);
12
+ const { filteredData, matchingIds, searchResultsCount } = useMemo(() => {
13
+ const dataMap = new Map(data.map((item) => [item.id, item]));
14
+ if (!searchQuery) {
15
+ return {
16
+ filteredData: data,
17
+ matchingIds: /* @__PURE__ */ new Set(),
18
+ searchResultsCount: 0
19
+ };
20
+ }
21
+ const matchingAndAncestorIds = /* @__PURE__ */ new Set();
22
+ const directMatchIds = /* @__PURE__ */ new Set();
23
+ let regex = null;
24
+ if (isRegex) {
25
+ try {
26
+ regex = new RegExp(searchQuery, isCaseSensitive ? "" : "i");
27
+ if (!isRegexValid) setIsRegexValid(true);
28
+ } catch {
29
+ if (isRegexValid) setIsRegexValid(false);
30
+ return {
31
+ filteredData: [],
32
+ matchingIds: /* @__PURE__ */ new Set(),
33
+ searchResultsCount: 0
34
+ };
35
+ }
36
+ }
37
+ data.forEach((item) => {
38
+ let labelMatches = false;
39
+ if (regex) {
40
+ labelMatches = regex.test(item.label);
41
+ } else {
42
+ const source = isCaseSensitive ? item.label : item.label.toLowerCase();
43
+ const query = isCaseSensitive ? searchQuery : searchQuery.toLowerCase();
44
+ labelMatches = source.includes(query);
45
+ }
46
+ if (labelMatches) {
47
+ directMatchIds.add(item.id);
48
+ matchingAndAncestorIds.add(item.id);
49
+ let current = item.parentId;
50
+ while (current) {
51
+ const parent = dataMap.get(current);
52
+ if (parent) {
53
+ matchingAndAncestorIds.add(parent.id);
54
+ current = parent.parentId;
55
+ } else {
56
+ break;
57
+ }
58
+ }
59
+ }
60
+ });
61
+ const filtered = data.filter((item) => matchingAndAncestorIds.has(item.id));
62
+ return {
63
+ filteredData: filtered,
64
+ matchingIds: directMatchIds,
65
+ searchResultsCount: directMatchIds.size
66
+ };
67
+ }, [searchQuery, data, isCaseSensitive, isRegex, isRegexValid]);
68
+ const renderLabel = useCallback((label, itemId) => {
69
+ if (!searchQuery || !isRegexValid || !matchingIds.has(itemId)) {
70
+ return label;
71
+ }
72
+ let regex;
73
+ try {
74
+ regex = new RegExp(`(${searchQuery})`, isCaseSensitive ? "g" : "gi");
75
+ } catch {
76
+ return label;
77
+ }
78
+ const parts = label.split(regex);
79
+ return /* @__PURE__ */ jsx(Fragment, { children: parts.map(
80
+ (part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx("span", { className: "rounded-uk-xs bg-accent-warning", children: part }, i) : part
81
+ ) });
82
+ }, [searchQuery, isCaseSensitive, isRegexValid, matchingIds]);
83
+ return {
84
+ filteredData,
85
+ searchResultsCount,
86
+ isRegexValid,
87
+ renderLabel,
88
+ hasActiveSearch: !!searchQuery
89
+ };
90
+ }
91
+ function useTreeState({
92
+ data,
93
+ defaultExpanded = true,
94
+ expandedItems: externalExpandedItems,
95
+ onToggleItem: externalOnToggleItem
96
+ }) {
97
+ const [internalExpandedItems, setInternalExpandedItems] = useState(() => {
98
+ const initial = /* @__PURE__ */ new Set();
99
+ if (defaultExpanded) {
100
+ data.forEach((item) => {
101
+ if (item.isCollapsible) initial.add(item.id);
102
+ });
103
+ }
104
+ return initial;
105
+ });
106
+ const expandedItems = externalExpandedItems ?? internalExpandedItems;
107
+ const toggleItem = useCallback((id) => {
108
+ if (externalOnToggleItem) {
109
+ externalOnToggleItem(id);
110
+ } else {
111
+ setInternalExpandedItems((prev) => {
112
+ const newSet = new Set(prev);
113
+ if (newSet.has(id)) {
114
+ newSet.delete(id);
115
+ } else {
116
+ newSet.add(id);
117
+ }
118
+ return newSet;
119
+ });
120
+ }
121
+ }, [externalOnToggleItem]);
122
+ const expandAll = useCallback(() => {
123
+ const allCollapsible = /* @__PURE__ */ new Set();
124
+ data.forEach((item) => {
125
+ if (item.isCollapsible) allCollapsible.add(item.id);
126
+ });
127
+ if (externalExpandedItems) {
128
+ allCollapsible.forEach((id) => {
129
+ if (!expandedItems.has(id) && externalOnToggleItem) {
130
+ externalOnToggleItem(id);
131
+ }
132
+ });
133
+ } else {
134
+ setInternalExpandedItems(allCollapsible);
135
+ }
136
+ }, [data, expandedItems, externalExpandedItems, externalOnToggleItem]);
137
+ const collapseAll = useCallback(() => {
138
+ if (externalExpandedItems) {
139
+ expandedItems.forEach((id) => {
140
+ if (externalOnToggleItem) {
141
+ externalOnToggleItem(id);
142
+ }
143
+ });
144
+ } else {
145
+ setInternalExpandedItems(/* @__PURE__ */ new Set());
146
+ }
147
+ }, [expandedItems, externalExpandedItems, externalOnToggleItem]);
148
+ const childrenMap = useMemo(() => {
149
+ const map = /* @__PURE__ */ new Map();
150
+ data.forEach((item) => {
151
+ if (!map.has(item.parentId)) {
152
+ map.set(item.parentId, []);
153
+ }
154
+ map.get(item.parentId).push(item);
155
+ });
156
+ return map;
157
+ }, [data]);
158
+ const hasDescendants = useCallback((itemId) => {
159
+ return (childrenMap.get(itemId) || []).length > 0;
160
+ }, [childrenMap]);
161
+ const dataWithMeta = useMemo(() => {
162
+ const dataMap = new Map(data.map((item) => [item.id, item]));
163
+ const getAncestors = (item) => {
164
+ const ancestors = [];
165
+ let current = item.parentId;
166
+ while (current) {
167
+ const parent = dataMap.get(current);
168
+ if (parent) {
169
+ ancestors.unshift(parent);
170
+ current = parent.parentId;
171
+ } else {
172
+ break;
173
+ }
174
+ }
175
+ return ancestors;
176
+ };
177
+ const sortedData = [];
178
+ const visited = /* @__PURE__ */ new Set();
179
+ const traverseNode = (nodeId) => {
180
+ const children = childrenMap.get(nodeId) || [];
181
+ children.forEach((child) => {
182
+ if (!visited.has(child.id)) {
183
+ visited.add(child.id);
184
+ sortedData.push(child);
185
+ traverseNode(child.id);
186
+ }
187
+ });
188
+ };
189
+ traverseNode(null);
190
+ return sortedData.map((item) => {
191
+ const siblings = childrenMap.get(item.parentId) || [];
192
+ const isLast = siblings.length > 0 && siblings[siblings.length - 1].id === item.id;
193
+ const ancestors = getAncestors(item);
194
+ const indent = ancestors.length;
195
+ return { ...item, indent, isLast, ancestors };
196
+ });
197
+ }, [data, childrenMap]);
198
+ const visibleData = useMemo(() => {
199
+ const isVisible = (item) => {
200
+ return item.ancestors.every(
201
+ (ancestor) => !ancestor.isCollapsible || expandedItems.has(ancestor.id)
202
+ );
203
+ };
204
+ return dataWithMeta.filter(isVisible);
205
+ }, [dataWithMeta, expandedItems]);
206
+ return {
207
+ visibleData,
208
+ expandedItems,
209
+ toggleItem,
210
+ expandAll,
211
+ collapseAll,
212
+ hasDescendants,
213
+ dataWithMeta
214
+ };
215
+ }
216
+
217
+ export { useTreeSearch, useTreeState };
@@ -1,4 +1,4 @@
1
- import { TreeView } from './chunk-ILGNKXK2.mjs';
1
+ import { TreeView } from './chunk-KQXLV6YW.mjs';
2
2
  import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from './chunk-PCSY5IJ2.mjs';
3
3
  import { cn } from './chunk-HMN4IKTG.mjs';
4
4
  import { Magnet, ChevronLeft, ChevronRight } from 'lucide-react';