@adecore/ui 0.49.6 → 0.49.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.
@@ -150,13 +150,22 @@ function plainKey(rowPath) {
150
150
  return dirPathOf(rowPath);
151
151
  }
152
152
  export function collapsedPathsOf(rows, keyOf = plainKey) {
153
- return rows.flatMap(row => {
153
+ const paths = [];
154
+ for (const row of rows) {
154
155
  const key = row.kind === 'directory' && !row.isExpanded ? keyOf(row.path) : null;
155
- return key === null ? [] : [key];
156
- });
156
+ if (key !== null) {
157
+ paths.push(key);
158
+ }
159
+ }
160
+ return paths;
157
161
  }
158
162
  export function mergeCollapsedPaths(current, rows, keyOf = plainKey) {
159
- const known = new Set(rows.flatMap(row => row.kind === 'directory' ? [keyOf(row.path)] : []));
163
+ const known = new Set();
164
+ for (const row of rows) {
165
+ if (row.kind === 'directory') {
166
+ known.add(keyOf(row.path));
167
+ }
168
+ }
160
169
  const folded = new Set(collapsedPathsOf(rows, keyOf));
161
170
  const next = current.filter(dir => !known.has(dir) || folded.has(dir));
162
171
  const existing = new Set(current);
@@ -18,7 +18,15 @@ export function findSplitNode(node, id) {
18
18
  if (node.id === id) {
19
19
  return node;
20
20
  }
21
- return node.type === 'split' ? node.children.map(child => findSplitNode(child, id)).find(Boolean) : undefined;
21
+ if (node.type === 'split') {
22
+ for (const child of node.children) {
23
+ const found = findSplitNode(child, id);
24
+ if (found !== undefined) {
25
+ return found;
26
+ }
27
+ }
28
+ }
29
+ return undefined;
22
30
  }
23
31
  function shares(values, length) {
24
32
  const safe = Array.from({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/ui",
3
- "version": "0.49.6",
3
+ "version": "0.49.7",
4
4
  "description": "React components, a theme, formatters and a settings dialog for desktop-grade apps on React 19, Base UI and Tailwind 4.",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "author": "Bas Milius",
@@ -195,15 +195,28 @@ function plainKey(rowPath: string): string | null {
195
195
  }
196
196
 
197
197
  export function collapsedPathsOf(rows: readonly FileTreeVisibleRow[], keyOf: FoldKeyOf = plainKey): string[] {
198
- return rows.flatMap((row) => {
198
+ const paths: string[] = [];
199
+
200
+ for (const row of rows) {
199
201
  const key = row.kind === 'directory' && !row.isExpanded ? keyOf(row.path) : null;
200
202
 
201
- return key === null ? [] : [key];
202
- });
203
+ if (key !== null) {
204
+ paths.push(key);
205
+ }
206
+ }
207
+
208
+ return paths;
203
209
  }
204
210
 
205
211
  export function mergeCollapsedPaths(current: string[], rows: readonly FileTreeVisibleRow[], keyOf: FoldKeyOf = plainKey): string[] {
206
- const known = new Set(rows.flatMap((row) => (row.kind === 'directory' ? [keyOf(row.path)] : [])));
212
+ const known = new Set<string | null>();
213
+
214
+ for (const row of rows) {
215
+ if (row.kind === 'directory') {
216
+ known.add(keyOf(row.path));
217
+ }
218
+ }
219
+
207
220
  const folded = new Set(collapsedPathsOf(rows, keyOf));
208
221
  const next = current.filter((dir) => !known.has(dir) || folded.has(dir));
209
222
  const existing = new Set(current);
@@ -53,7 +53,17 @@ export function findSplitNode(node: SplitNode, id: string): SplitNode | undefine
53
53
  return node;
54
54
  }
55
55
 
56
- return node.type === 'split' ? node.children.map((child) => findSplitNode(child, id)).find(Boolean) : undefined;
56
+ if (node.type === 'split') {
57
+ for (const child of node.children) {
58
+ const found = findSplitNode(child, id);
59
+
60
+ if (found !== undefined) {
61
+ return found;
62
+ }
63
+ }
64
+ }
65
+
66
+ return undefined;
57
67
  }
58
68
 
59
69
  function shares(values: number[], length: number): number[] {