@skygraph/core 0.0.0-placeholder.0 → 0.5.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 (70) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -6
  3. package/dist/calendar.cjs +404 -0
  4. package/dist/calendar.cjs.map +1 -0
  5. package/dist/calendar.d.cts +209 -0
  6. package/dist/calendar.d.ts +209 -0
  7. package/dist/calendar.js +12 -0
  8. package/dist/calendar.js.map +1 -0
  9. package/dist/chunk-5CCD5Q4B.js +36 -0
  10. package/dist/chunk-5CCD5Q4B.js.map +1 -0
  11. package/dist/chunk-7FA2TBSZ.js +1211 -0
  12. package/dist/chunk-7FA2TBSZ.js.map +1 -0
  13. package/dist/chunk-AB3RLBLW.js +357 -0
  14. package/dist/chunk-AB3RLBLW.js.map +1 -0
  15. package/dist/chunk-GEMALROQ.js +258 -0
  16. package/dist/chunk-GEMALROQ.js.map +1 -0
  17. package/dist/chunk-IY6LJU3L.js +256 -0
  18. package/dist/chunk-IY6LJU3L.js.map +1 -0
  19. package/dist/chunk-KMGRNPLG.js +453 -0
  20. package/dist/chunk-KMGRNPLG.js.map +1 -0
  21. package/dist/chunk-Y7FTBBYX.js +397 -0
  22. package/dist/chunk-Y7FTBBYX.js.map +1 -0
  23. package/dist/chunk-ZWB7JGAJ.js +488 -0
  24. package/dist/chunk-ZWB7JGAJ.js.map +1 -0
  25. package/dist/form.cjs +498 -0
  26. package/dist/form.cjs.map +1 -0
  27. package/dist/form.d.cts +130 -0
  28. package/dist/form.d.ts +130 -0
  29. package/dist/form.js +8 -0
  30. package/dist/form.js.map +1 -0
  31. package/dist/graph.cjs +1269 -0
  32. package/dist/graph.cjs.map +1 -0
  33. package/dist/graph.d.cts +671 -0
  34. package/dist/graph.d.ts +671 -0
  35. package/dist/graph.js +34 -0
  36. package/dist/graph.js.map +1 -0
  37. package/dist/index.cjs +3860 -0
  38. package/dist/index.cjs.map +1 -0
  39. package/dist/index.d.cts +144 -0
  40. package/dist/index.d.ts +144 -0
  41. package/dist/index.js +477 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/runtime-internal.cjs +339 -0
  44. package/dist/runtime-internal.cjs.map +1 -0
  45. package/dist/runtime-internal.d.cts +130 -0
  46. package/dist/runtime-internal.d.ts +130 -0
  47. package/dist/runtime-internal.js +67 -0
  48. package/dist/runtime-internal.js.map +1 -0
  49. package/dist/table.cjs +537 -0
  50. package/dist/table.cjs.map +1 -0
  51. package/dist/table.d.cts +215 -0
  52. package/dist/table.d.ts +215 -0
  53. package/dist/table.js +16 -0
  54. package/dist/table.js.map +1 -0
  55. package/dist/tree.cjs +442 -0
  56. package/dist/tree.cjs.map +1 -0
  57. package/dist/tree.d.cts +76 -0
  58. package/dist/tree.d.ts +76 -0
  59. package/dist/tree.js +8 -0
  60. package/dist/tree.js.map +1 -0
  61. package/dist/types-B-rKQJ4R.d.cts +35 -0
  62. package/dist/types-B-rKQJ4R.d.ts +35 -0
  63. package/dist/virtual.cjs +283 -0
  64. package/dist/virtual.cjs.map +1 -0
  65. package/dist/virtual.d.cts +96 -0
  66. package/dist/virtual.d.ts +96 -0
  67. package/dist/virtual.js +9 -0
  68. package/dist/virtual.js.map +1 -0
  69. package/package.json +98 -18
  70. package/index.js +0 -3
@@ -0,0 +1,397 @@
1
+ import {
2
+ TREE_PREFIX
3
+ } from "./chunk-5CCD5Q4B.js";
4
+
5
+ // src/engines/tree/TreeEngine.ts
6
+ var treeCounter = 0;
7
+ function createTree(core, options) {
8
+ const treeId = `tr${treeCounter++}`;
9
+ const fn = {
10
+ key: options?.fieldNames?.key ?? "key",
11
+ title: options?.fieldNames?.title ?? "title",
12
+ children: options?.fieldNames?.children ?? "children"
13
+ };
14
+ const checkStrictly = options?.checkStrictly ?? false;
15
+ let nodes = [];
16
+ let nodeMap = /* @__PURE__ */ new Map();
17
+ let expandedKeys = new Set(options?.defaultExpandedKeys ?? []);
18
+ let checkedKeys = new Set(options?.defaultCheckedKeys ?? []);
19
+ let halfCheckedKeys = /* @__PURE__ */ new Set();
20
+ let selectedKeys = new Set(options?.defaultSelectedKeys ?? []);
21
+ let loadedKeys = /* @__PURE__ */ new Set();
22
+ let loadingKeys = /* @__PURE__ */ new Set();
23
+ let filteredKeys = null;
24
+ function getKey(node) {
25
+ return node[fn.key];
26
+ }
27
+ function getChildren(node) {
28
+ return node[fn.children];
29
+ }
30
+ function buildMap(data) {
31
+ nodeMap = /* @__PURE__ */ new Map();
32
+ function walk(list, parentKey, depth) {
33
+ for (const n of list) {
34
+ const k = getKey(n);
35
+ const children = getChildren(n);
36
+ const childKeys = [];
37
+ const isLeaf = n.isLeaf === true || (!children || children.length === 0);
38
+ if (children && children.length > 0) {
39
+ for (const ch of children) childKeys.push(getKey(ch));
40
+ }
41
+ nodeMap.set(k, { node: n, key: k, depth, parentKey, childKeys, isLeaf });
42
+ if (children && children.length > 0) {
43
+ walk(children, k, depth + 1);
44
+ }
45
+ }
46
+ }
47
+ walk(data, null, 0);
48
+ }
49
+ function getAllDescendantKeys(key) {
50
+ const result = [];
51
+ const internal = nodeMap.get(key);
52
+ if (!internal) return result;
53
+ for (const ck of internal.childKeys) {
54
+ result.push(ck);
55
+ result.push(...getAllDescendantKeys(ck));
56
+ }
57
+ return result;
58
+ }
59
+ function getAllAncestorKeys(key) {
60
+ const result = [];
61
+ let current = nodeMap.get(key);
62
+ while (current && current.parentKey !== null) {
63
+ result.push(current.parentKey);
64
+ current = nodeMap.get(current.parentKey);
65
+ }
66
+ return result;
67
+ }
68
+ function recomputeHalfChecked() {
69
+ if (checkStrictly) {
70
+ halfCheckedKeys = /* @__PURE__ */ new Set();
71
+ return;
72
+ }
73
+ const half = /* @__PURE__ */ new Set();
74
+ for (const [key, internal] of nodeMap) {
75
+ if (internal.childKeys.length === 0) continue;
76
+ if (checkedKeys.has(key)) continue;
77
+ const allDescendants = getAllDescendantKeys(key);
78
+ const someChecked = allDescendants.some((dk) => checkedKeys.has(dk));
79
+ if (someChecked) half.add(key);
80
+ }
81
+ halfCheckedKeys = half;
82
+ }
83
+ function cascadeCheck(key, checked) {
84
+ if (checkStrictly) {
85
+ if (checked) checkedKeys.add(key);
86
+ else checkedKeys.delete(key);
87
+ return;
88
+ }
89
+ const internal = nodeMap.get(key);
90
+ if (!internal) return;
91
+ if (checked) {
92
+ checkedKeys.add(key);
93
+ const descendants = getAllDescendantKeys(key);
94
+ for (const dk of descendants) {
95
+ const dn = nodeMap.get(dk);
96
+ if (dn && !dn.node.disabled && !dn.node.disableCheckbox) {
97
+ checkedKeys.add(dk);
98
+ }
99
+ }
100
+ } else {
101
+ checkedKeys.delete(key);
102
+ const descendants = getAllDescendantKeys(key);
103
+ for (const dk of descendants) {
104
+ checkedKeys.delete(dk);
105
+ }
106
+ }
107
+ const ancestors = getAllAncestorKeys(key);
108
+ for (const ak of ancestors) {
109
+ const an = nodeMap.get(ak);
110
+ if (!an) continue;
111
+ const allChildren = getAllDescendantKeys(ak);
112
+ const enabledChildren = allChildren.filter((ck) => {
113
+ const cn = nodeMap.get(ck);
114
+ return cn && !cn.node.disabled && !cn.node.disableCheckbox;
115
+ });
116
+ const allChecked = enabledChildren.length > 0 && enabledChildren.every((ck) => checkedKeys.has(ck));
117
+ if (allChecked) {
118
+ checkedKeys.add(ak);
119
+ } else {
120
+ checkedKeys.delete(ak);
121
+ }
122
+ }
123
+ recomputeHalfChecked();
124
+ }
125
+ function removeFromTree(data, targetKey) {
126
+ let removed = null;
127
+ const remaining = data.filter((n) => {
128
+ if (getKey(n) === targetKey) {
129
+ removed = n;
130
+ return false;
131
+ }
132
+ return true;
133
+ });
134
+ if (!removed) {
135
+ for (const n of remaining) {
136
+ const children = getChildren(n);
137
+ if (children && children.length > 0) {
138
+ const result = removeFromTree(children, targetKey);
139
+ if (result.removed) {
140
+ ;
141
+ n[fn.children] = result.remaining;
142
+ return { remaining, removed: result.removed };
143
+ }
144
+ }
145
+ }
146
+ }
147
+ return { remaining, removed };
148
+ }
149
+ function insertIntoTree(data, targetKey, node, position) {
150
+ if (position === 0) {
151
+ return data.map((n) => {
152
+ if (getKey(n) === targetKey) {
153
+ const children2 = getChildren(n) ?? [];
154
+ n[fn.children] = [...children2, node];
155
+ return n;
156
+ }
157
+ const children = getChildren(n);
158
+ if (children && children.length > 0) {
159
+ ;
160
+ n[fn.children] = insertIntoTree(children, targetKey, node, position);
161
+ }
162
+ return n;
163
+ });
164
+ }
165
+ const result = [];
166
+ for (const n of data) {
167
+ if (getKey(n) === targetKey) {
168
+ if (position === -1) {
169
+ result.push(node, n);
170
+ } else {
171
+ result.push(n, node);
172
+ }
173
+ } else {
174
+ const children = getChildren(n);
175
+ if (children && children.length > 0) {
176
+ ;
177
+ n[fn.children] = insertIntoTree(children, targetKey, node, position);
178
+ }
179
+ result.push(n);
180
+ }
181
+ }
182
+ return result;
183
+ }
184
+ function publishState() {
185
+ const path = (k) => `${TREE_PREFIX}${treeId}.${k}`;
186
+ core.batch(() => {
187
+ core.set(path("expandedKeys"), [...expandedKeys]);
188
+ core.set(path("checkedKeys"), [...checkedKeys]);
189
+ core.set(path("halfCheckedKeys"), [...halfCheckedKeys]);
190
+ core.set(path("selectedKeys"), [...selectedKeys]);
191
+ core.set(path("loadedKeys"), [...loadedKeys]);
192
+ core.set(path("loadingKeys"), [...loadingKeys]);
193
+ });
194
+ }
195
+ function initDefaults() {
196
+ if (options?.defaultExpandAll) {
197
+ for (const [key, internal] of nodeMap) {
198
+ if (!internal.isLeaf) expandedKeys.add(key);
199
+ }
200
+ }
201
+ if (options?.defaultCheckedKeys && !checkStrictly) {
202
+ for (const key of options.defaultCheckedKeys) {
203
+ cascadeCheck(key, true);
204
+ }
205
+ }
206
+ recomputeHalfChecked();
207
+ publishState();
208
+ }
209
+ const engine = {
210
+ setData(data) {
211
+ nodes = data;
212
+ buildMap(data);
213
+ initDefaults();
214
+ },
215
+ getData() {
216
+ return nodes;
217
+ },
218
+ // Expand
219
+ expand(key) {
220
+ expandedKeys.add(key);
221
+ publishState();
222
+ },
223
+ collapse(key) {
224
+ expandedKeys.delete(key);
225
+ publishState();
226
+ },
227
+ toggleExpand(key) {
228
+ if (expandedKeys.has(key)) expandedKeys.delete(key);
229
+ else expandedKeys.add(key);
230
+ publishState();
231
+ },
232
+ setExpandedKeys(keys) {
233
+ expandedKeys = new Set(keys);
234
+ publishState();
235
+ },
236
+ expandAll() {
237
+ for (const [key, internal] of nodeMap) {
238
+ if (!internal.isLeaf) expandedKeys.add(key);
239
+ }
240
+ publishState();
241
+ },
242
+ collapseAll() {
243
+ expandedKeys = /* @__PURE__ */ new Set();
244
+ publishState();
245
+ },
246
+ // Check
247
+ check(key) {
248
+ cascadeCheck(key, true);
249
+ publishState();
250
+ },
251
+ uncheck(key) {
252
+ cascadeCheck(key, false);
253
+ publishState();
254
+ },
255
+ toggleCheck(key) {
256
+ const checked = !checkedKeys.has(key);
257
+ cascadeCheck(key, checked);
258
+ publishState();
259
+ },
260
+ setCheckedKeys(keys) {
261
+ checkedKeys = new Set(keys);
262
+ recomputeHalfChecked();
263
+ publishState();
264
+ },
265
+ // Select
266
+ select(key, multiple) {
267
+ if (multiple) {
268
+ if (selectedKeys.has(key)) selectedKeys.delete(key);
269
+ else selectedKeys.add(key);
270
+ } else {
271
+ selectedKeys = /* @__PURE__ */ new Set([key]);
272
+ }
273
+ publishState();
274
+ },
275
+ deselect(key) {
276
+ selectedKeys.delete(key);
277
+ publishState();
278
+ },
279
+ setSelectedKeys(keys) {
280
+ selectedKeys = new Set(keys);
281
+ publishState();
282
+ },
283
+ // Async loading
284
+ markLoading(key) {
285
+ loadingKeys.add(key);
286
+ publishState();
287
+ },
288
+ markLoaded(key) {
289
+ loadingKeys.delete(key);
290
+ loadedKeys.add(key);
291
+ publishState();
292
+ },
293
+ addChildren(parentKey, children) {
294
+ const internal = nodeMap.get(parentKey);
295
+ if (!internal) return;
296
+ internal.node[fn.children] = children;
297
+ buildMap(nodes);
298
+ publishState();
299
+ },
300
+ // Drag & drop
301
+ moveNode(dragKey, dropKey, position) {
302
+ if (dragKey === dropKey) return null;
303
+ const ancestors = getAllAncestorKeys(dropKey);
304
+ if (ancestors.includes(dragKey)) return null;
305
+ const { remaining, removed } = removeFromTree(nodes, dragKey);
306
+ if (!removed) return null;
307
+ nodes = insertIntoTree(remaining, dropKey, removed, position);
308
+ buildMap(nodes);
309
+ publishState();
310
+ return nodes;
311
+ },
312
+ // Filter
313
+ filterNodes(predicate) {
314
+ if (!predicate) {
315
+ filteredKeys = null;
316
+ return;
317
+ }
318
+ const matched = /* @__PURE__ */ new Set();
319
+ for (const [key, internal] of nodeMap) {
320
+ if (predicate(internal.node)) {
321
+ matched.add(key);
322
+ const ancestors = getAllAncestorKeys(key);
323
+ for (const ak of ancestors) matched.add(ak);
324
+ }
325
+ }
326
+ filteredKeys = matched;
327
+ },
328
+ getFilteredKeys() {
329
+ return filteredKeys ? [...filteredKeys] : null;
330
+ },
331
+ // Query
332
+ getNode(key) {
333
+ return nodeMap.get(key)?.node;
334
+ },
335
+ getParentKey(key) {
336
+ return nodeMap.get(key)?.parentKey ?? null;
337
+ },
338
+ getChildKeys(key) {
339
+ return nodeMap.get(key)?.childKeys ?? [];
340
+ },
341
+ getAllKeys() {
342
+ return [...nodeMap.keys()];
343
+ },
344
+ getLeafKeys() {
345
+ const result = [];
346
+ for (const [key, internal] of nodeMap) {
347
+ if (internal.isLeaf) result.push(key);
348
+ }
349
+ return result;
350
+ },
351
+ getState() {
352
+ return {
353
+ expandedKeys: [...expandedKeys],
354
+ checkedKeys: [...checkedKeys],
355
+ halfCheckedKeys: [...halfCheckedKeys],
356
+ selectedKeys: [...selectedKeys],
357
+ loadedKeys: [...loadedKeys],
358
+ loadingKeys: [...loadingKeys]
359
+ };
360
+ },
361
+ getFlatNodes() {
362
+ const result = [];
363
+ function walk(list, parentKey, depth) {
364
+ for (const n of list) {
365
+ const k = getKey(n);
366
+ if (filteredKeys && !filteredKeys.has(k)) continue;
367
+ const children = getChildren(n);
368
+ const isLeaf = n.isLeaf === true || (!children || children.length === 0);
369
+ result.push({ node: n, key: k, depth, isLeaf, parentKey });
370
+ if (!isLeaf && expandedKeys.has(k) && children && children.length > 0) {
371
+ walk(children, k, depth + 1);
372
+ }
373
+ }
374
+ }
375
+ walk(nodes, null, 0);
376
+ return result;
377
+ },
378
+ reset() {
379
+ nodes = [];
380
+ nodeMap = /* @__PURE__ */ new Map();
381
+ expandedKeys = /* @__PURE__ */ new Set();
382
+ checkedKeys = /* @__PURE__ */ new Set();
383
+ halfCheckedKeys = /* @__PURE__ */ new Set();
384
+ selectedKeys = /* @__PURE__ */ new Set();
385
+ loadedKeys = /* @__PURE__ */ new Set();
386
+ loadingKeys = /* @__PURE__ */ new Set();
387
+ filteredKeys = null;
388
+ publishState();
389
+ }
390
+ };
391
+ return engine;
392
+ }
393
+
394
+ export {
395
+ createTree
396
+ };
397
+ //# sourceMappingURL=chunk-Y7FTBBYX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/engines/tree/TreeEngine.ts"],"sourcesContent":["import type { Core } from '../../types'\nimport type {\n TreeKey,\n TreeNodeData,\n TreeFieldNames,\n TreeEngine,\n TreeEngineOptions,\n TreeState,\n} from './types'\n\nimport { TREE_PREFIX } from '../namespaces'\n\nlet treeCounter = 0\n\ninterface InternalNode {\n node: TreeNodeData\n key: TreeKey\n depth: number\n parentKey: TreeKey | null\n childKeys: TreeKey[]\n isLeaf: boolean\n}\n\nexport function createTree(core: Core, options?: TreeEngineOptions): TreeEngine {\n const treeId = `tr${treeCounter++}`\n const fn: Required<TreeFieldNames> = {\n key: options?.fieldNames?.key ?? 'key',\n title: options?.fieldNames?.title ?? 'title',\n children: options?.fieldNames?.children ?? 'children',\n }\n const checkStrictly = options?.checkStrictly ?? false\n\n let nodes: TreeNodeData[] = []\n let nodeMap = new Map<TreeKey, InternalNode>()\n\n let expandedKeys = new Set<TreeKey>(options?.defaultExpandedKeys ?? [])\n let checkedKeys = new Set<TreeKey>(options?.defaultCheckedKeys ?? [])\n let halfCheckedKeys = new Set<TreeKey>()\n let selectedKeys = new Set<TreeKey>(options?.defaultSelectedKeys ?? [])\n let loadedKeys = new Set<TreeKey>()\n let loadingKeys = new Set<TreeKey>()\n let filteredKeys: Set<TreeKey> | null = null\n\n function getKey(node: TreeNodeData): TreeKey {\n return (node as Record<string, unknown>)[fn.key] as TreeKey\n }\n\n function getChildren(node: TreeNodeData): TreeNodeData[] | undefined {\n return (node as Record<string, unknown>)[fn.children] as TreeNodeData[] | undefined\n }\n\n function buildMap(data: TreeNodeData[]): void {\n nodeMap = new Map()\n function walk(list: TreeNodeData[], parentKey: TreeKey | null, depth: number) {\n for (const n of list) {\n const k = getKey(n)\n const children = getChildren(n)\n const childKeys: TreeKey[] = []\n const isLeaf = n.isLeaf === true || (!children || children.length === 0)\n\n if (children && children.length > 0) {\n for (const ch of children) childKeys.push(getKey(ch))\n }\n\n nodeMap.set(k, { node: n, key: k, depth, parentKey, childKeys, isLeaf })\n\n if (children && children.length > 0) {\n walk(children, k, depth + 1)\n }\n }\n }\n walk(data, null, 0)\n }\n\n function getAllDescendantKeys(key: TreeKey): TreeKey[] {\n const result: TreeKey[] = []\n const internal = nodeMap.get(key)\n if (!internal) return result\n for (const ck of internal.childKeys) {\n result.push(ck)\n result.push(...getAllDescendantKeys(ck))\n }\n return result\n }\n\n function getAllAncestorKeys(key: TreeKey): TreeKey[] {\n const result: TreeKey[] = []\n let current = nodeMap.get(key)\n while (current && current.parentKey !== null) {\n result.push(current.parentKey)\n current = nodeMap.get(current.parentKey)\n }\n return result\n }\n\n function recomputeHalfChecked(): void {\n if (checkStrictly) {\n halfCheckedKeys = new Set()\n return\n }\n const half = new Set<TreeKey>()\n for (const [key, internal] of nodeMap) {\n if (internal.childKeys.length === 0) continue\n if (checkedKeys.has(key)) continue\n const allDescendants = getAllDescendantKeys(key)\n const someChecked = allDescendants.some((dk) => checkedKeys.has(dk))\n if (someChecked) half.add(key)\n }\n halfCheckedKeys = half\n }\n\n function cascadeCheck(key: TreeKey, checked: boolean): void {\n if (checkStrictly) {\n if (checked) checkedKeys.add(key)\n else checkedKeys.delete(key)\n return\n }\n\n const internal = nodeMap.get(key)\n if (!internal) return\n\n if (checked) {\n checkedKeys.add(key)\n const descendants = getAllDescendantKeys(key)\n for (const dk of descendants) {\n const dn = nodeMap.get(dk)\n if (dn && !dn.node.disabled && !dn.node.disableCheckbox) {\n checkedKeys.add(dk)\n }\n }\n } else {\n checkedKeys.delete(key)\n const descendants = getAllDescendantKeys(key)\n for (const dk of descendants) {\n checkedKeys.delete(dk)\n }\n }\n\n // Propagate up\n const ancestors = getAllAncestorKeys(key)\n for (const ak of ancestors) {\n const an = nodeMap.get(ak)\n if (!an) continue\n const allChildren = getAllDescendantKeys(ak)\n const enabledChildren = allChildren.filter((ck) => {\n const cn = nodeMap.get(ck)\n return cn && !cn.node.disabled && !cn.node.disableCheckbox\n })\n const allChecked = enabledChildren.length > 0 && enabledChildren.every((ck) => checkedKeys.has(ck))\n if (allChecked) {\n checkedKeys.add(ak)\n } else {\n checkedKeys.delete(ak)\n }\n }\n\n recomputeHalfChecked()\n }\n\n function removeFromTree(data: TreeNodeData[], targetKey: TreeKey): { remaining: TreeNodeData[]; removed: TreeNodeData | null } {\n let removed: TreeNodeData | null = null\n const remaining = data.filter((n) => {\n if (getKey(n) === targetKey) {\n removed = n\n return false\n }\n return true\n })\n if (!removed) {\n for (const n of remaining) {\n const children = getChildren(n)\n if (children && children.length > 0) {\n const result = removeFromTree(children, targetKey)\n if (result.removed) {\n ;(n as Record<string, unknown>)[fn.children] = result.remaining\n return { remaining, removed: result.removed }\n }\n }\n }\n }\n return { remaining, removed }\n }\n\n function insertIntoTree(\n data: TreeNodeData[],\n targetKey: TreeKey,\n node: TreeNodeData,\n position: -1 | 0 | 1,\n ): TreeNodeData[] {\n if (position === 0) {\n return data.map((n) => {\n if (getKey(n) === targetKey) {\n const children = getChildren(n) ?? []\n ;(n as Record<string, unknown>)[fn.children] = [...children, node]\n return n\n }\n const children = getChildren(n)\n if (children && children.length > 0) {\n ;(n as Record<string, unknown>)[fn.children] = insertIntoTree(children, targetKey, node, position)\n }\n return n\n })\n }\n\n const result: TreeNodeData[] = []\n for (const n of data) {\n if (getKey(n) === targetKey) {\n if (position === -1) {\n result.push(node, n)\n } else {\n result.push(n, node)\n }\n } else {\n const children = getChildren(n)\n if (children && children.length > 0) {\n ;(n as Record<string, unknown>)[fn.children] = insertIntoTree(children, targetKey, node, position)\n }\n result.push(n)\n }\n }\n return result\n }\n\n function publishState(): void {\n const path = (k: string) => `${TREE_PREFIX}${treeId}.${k}`\n core.batch(() => {\n core.set(path('expandedKeys'), [...expandedKeys])\n core.set(path('checkedKeys'), [...checkedKeys])\n core.set(path('halfCheckedKeys'), [...halfCheckedKeys])\n core.set(path('selectedKeys'), [...selectedKeys])\n core.set(path('loadedKeys'), [...loadedKeys])\n core.set(path('loadingKeys'), [...loadingKeys])\n })\n }\n\n function initDefaults(): void {\n if (options?.defaultExpandAll) {\n for (const [key, internal] of nodeMap) {\n if (!internal.isLeaf) expandedKeys.add(key)\n }\n }\n\n if (options?.defaultCheckedKeys && !checkStrictly) {\n for (const key of options.defaultCheckedKeys) {\n cascadeCheck(key, true)\n }\n }\n\n recomputeHalfChecked()\n publishState()\n }\n\n const engine: TreeEngine = {\n setData(data: TreeNodeData[]): void {\n nodes = data\n buildMap(data)\n initDefaults()\n },\n\n getData(): TreeNodeData[] {\n return nodes\n },\n\n // Expand\n expand(key: TreeKey): void {\n expandedKeys.add(key)\n publishState()\n },\n\n collapse(key: TreeKey): void {\n expandedKeys.delete(key)\n publishState()\n },\n\n toggleExpand(key: TreeKey): void {\n if (expandedKeys.has(key)) expandedKeys.delete(key)\n else expandedKeys.add(key)\n publishState()\n },\n\n setExpandedKeys(keys: TreeKey[]): void {\n expandedKeys = new Set(keys)\n publishState()\n },\n\n expandAll(): void {\n for (const [key, internal] of nodeMap) {\n if (!internal.isLeaf) expandedKeys.add(key)\n }\n publishState()\n },\n\n collapseAll(): void {\n expandedKeys = new Set()\n publishState()\n },\n\n // Check\n check(key: TreeKey): void {\n cascadeCheck(key, true)\n publishState()\n },\n\n uncheck(key: TreeKey): void {\n cascadeCheck(key, false)\n publishState()\n },\n\n toggleCheck(key: TreeKey): void {\n const checked = !checkedKeys.has(key)\n cascadeCheck(key, checked)\n publishState()\n },\n\n setCheckedKeys(keys: TreeKey[]): void {\n checkedKeys = new Set(keys)\n recomputeHalfChecked()\n publishState()\n },\n\n // Select\n select(key: TreeKey, multiple?: boolean): void {\n if (multiple) {\n if (selectedKeys.has(key)) selectedKeys.delete(key)\n else selectedKeys.add(key)\n } else {\n selectedKeys = new Set([key])\n }\n publishState()\n },\n\n deselect(key: TreeKey): void {\n selectedKeys.delete(key)\n publishState()\n },\n\n setSelectedKeys(keys: TreeKey[]): void {\n selectedKeys = new Set(keys)\n publishState()\n },\n\n // Async loading\n markLoading(key: TreeKey): void {\n loadingKeys.add(key)\n publishState()\n },\n\n markLoaded(key: TreeKey): void {\n loadingKeys.delete(key)\n loadedKeys.add(key)\n publishState()\n },\n\n addChildren(parentKey: TreeKey, children: TreeNodeData[]): void {\n const internal = nodeMap.get(parentKey)\n if (!internal) return\n ;(internal.node as Record<string, unknown>)[fn.children] = children\n buildMap(nodes)\n publishState()\n },\n\n // Drag & drop\n moveNode(dragKey: TreeKey, dropKey: TreeKey, position: -1 | 0 | 1): TreeNodeData[] | null {\n if (dragKey === dropKey) return null\n const ancestors = getAllAncestorKeys(dropKey)\n if (ancestors.includes(dragKey)) return null\n\n const { remaining, removed } = removeFromTree(nodes, dragKey)\n if (!removed) return null\n\n nodes = insertIntoTree(remaining, dropKey, removed, position)\n buildMap(nodes)\n publishState()\n return nodes\n },\n\n // Filter\n filterNodes(predicate: ((node: TreeNodeData) => boolean) | null): void {\n if (!predicate) {\n filteredKeys = null\n return\n }\n const matched = new Set<TreeKey>()\n for (const [key, internal] of nodeMap) {\n if (predicate(internal.node)) {\n matched.add(key)\n const ancestors = getAllAncestorKeys(key)\n for (const ak of ancestors) matched.add(ak)\n }\n }\n filteredKeys = matched\n },\n\n getFilteredKeys(): TreeKey[] | null {\n return filteredKeys ? [...filteredKeys] : null\n },\n\n // Query\n getNode(key: TreeKey): TreeNodeData | undefined {\n return nodeMap.get(key)?.node\n },\n\n getParentKey(key: TreeKey): TreeKey | null {\n return nodeMap.get(key)?.parentKey ?? null\n },\n\n getChildKeys(key: TreeKey): TreeKey[] {\n return nodeMap.get(key)?.childKeys ?? []\n },\n\n getAllKeys(): TreeKey[] {\n return [...nodeMap.keys()]\n },\n\n getLeafKeys(): TreeKey[] {\n const result: TreeKey[] = []\n for (const [key, internal] of nodeMap) {\n if (internal.isLeaf) result.push(key)\n }\n return result\n },\n\n getState(): TreeState {\n return {\n expandedKeys: [...expandedKeys],\n checkedKeys: [...checkedKeys],\n halfCheckedKeys: [...halfCheckedKeys],\n selectedKeys: [...selectedKeys],\n loadedKeys: [...loadedKeys],\n loadingKeys: [...loadingKeys],\n }\n },\n\n getFlatNodes() {\n const result: Array<{ node: TreeNodeData; key: TreeKey; depth: number; isLeaf: boolean; parentKey: TreeKey | null }> = []\n\n function walk(list: TreeNodeData[], parentKey: TreeKey | null, depth: number) {\n for (const n of list) {\n const k = getKey(n)\n if (filteredKeys && !filteredKeys.has(k)) continue\n\n const children = getChildren(n)\n const isLeaf = n.isLeaf === true || (!children || children.length === 0)\n\n result.push({ node: n, key: k, depth, isLeaf, parentKey })\n\n if (!isLeaf && expandedKeys.has(k) && children && children.length > 0) {\n walk(children, k, depth + 1)\n }\n }\n }\n\n walk(nodes, null, 0)\n return result\n },\n\n reset(): void {\n nodes = []\n nodeMap = new Map()\n expandedKeys = new Set()\n checkedKeys = new Set()\n halfCheckedKeys = new Set()\n selectedKeys = new Set()\n loadedKeys = new Set()\n loadingKeys = new Set()\n filteredKeys = null\n publishState()\n },\n }\n\n return engine\n}\n"],"mappings":";;;;;AAYA,IAAI,cAAc;AAWX,SAAS,WAAW,M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