impact-nova 1.7.29 → 1.7.30

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.
@@ -9,6 +9,7 @@ interface UseNestedListStateProps {
9
9
  initialItems: NestedListItem[];
10
10
  enableApplyDiscard: boolean;
11
11
  enableNormalizedState?: boolean;
12
+ initialCollapsedItems?: Record<string, boolean>;
12
13
  }
13
14
  /**
14
15
  * Build normalized state from nested tree structure
@@ -35,7 +36,7 @@ declare function getAncestorIds(normalized: NormalizedItems, itemId: string): st
35
36
  * Get all descendant IDs for an item (for cascade operations)
36
37
  */
37
38
  declare function getDescendantIds(normalized: NormalizedItems, itemId: string): string[];
38
- export declare const useNestedListState: ({ initialItems, enableApplyDiscard, enableNormalizedState, }: UseNestedListStateProps) => {
39
+ export declare const useNestedListState: ({ initialItems, enableApplyDiscard, enableNormalizedState, initialCollapsedItems, }: UseNestedListStateProps) => {
39
40
  findItemByIdFast: (id: string) => NestedListItem | null;
40
41
  updateItemFast: (itemId: string, updates: Partial<NestedListItem>) => void;
41
42
  getAncestors: (itemId: string) => string[];
@@ -1,22 +1,22 @@
1
- import { useState as o, useMemo as O, useCallback as y } from "react";
1
+ import { useState as u, useMemo as O, useCallback as g } from "react";
2
2
  function p(s) {
3
- const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), u = [], d = (f, g) => {
4
- f.forEach((r) => {
5
- e.set(r.id, r), n.set(r.id, g), r.children && r.children.length > 0 ? (t.set(r.id, r.children.map((C) => C.id)), d(r.children, r.id)) : t.set(r.id, []), g === null && u.push(r.id);
3
+ const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), d = [], i = (r, h) => {
4
+ r.forEach((o) => {
5
+ e.set(o.id, o), n.set(o.id, h), o.children && o.children.length > 0 ? (t.set(o.id, o.children.map((C) => C.id)), i(o.children, o.id)) : t.set(o.id, []), h === null && d.push(o.id);
6
6
  });
7
7
  };
8
- return d(s, null), { byId: e, childrenById: t, parentById: n, rootIds: u };
8
+ return i(s, null), { byId: e, childrenById: t, parentById: n, rootIds: d };
9
9
  }
10
10
  function a(s) {
11
11
  const e = (t) => {
12
12
  const n = [];
13
- for (const u of t) {
14
- const d = s.byId.get(u);
15
- if (!d) continue;
16
- const f = s.childrenById.get(u) || [], g = f.length > 0 ? e(f) : void 0;
13
+ for (const d of t) {
14
+ const i = s.byId.get(d);
15
+ if (!i) continue;
16
+ const r = s.childrenById.get(d) || [], h = r.length > 0 ? e(r) : void 0;
17
17
  n.push({
18
- ...d,
19
- children: g
18
+ ...i,
19
+ children: h
20
20
  });
21
21
  }
22
22
  return n;
@@ -26,85 +26,86 @@ function a(s) {
26
26
  function R(s, e, t) {
27
27
  const n = s.byId.get(e);
28
28
  if (!n) return s;
29
- const u = new Map(s.byId);
30
- return u.set(e, { ...n, ...t }), {
29
+ const d = new Map(s.byId);
30
+ return d.set(e, { ...n, ...t }), {
31
31
  ...s,
32
- byId: u
32
+ byId: d
33
33
  };
34
34
  }
35
- function S(s, e) {
35
+ function N(s, e) {
36
36
  return s.byId.get(e) || null;
37
37
  }
38
- function N(s, e) {
38
+ function z(s, e) {
39
39
  const t = [];
40
40
  let n = s.parentById.get(e) || null;
41
41
  for (; n !== null; )
42
42
  t.push(n), n = s.parentById.get(n) || null;
43
43
  return t;
44
44
  }
45
- function z(s, e) {
46
- const t = [], n = (u) => {
47
- (s.childrenById.get(u) || []).forEach((f) => {
48
- t.push(f), n(f);
45
+ function tt(s, e) {
46
+ const t = [], n = (d) => {
47
+ (s.childrenById.get(d) || []).forEach((r) => {
48
+ t.push(r), n(r);
49
49
  });
50
50
  };
51
51
  return n(e), t;
52
52
  }
53
- const st = ({
53
+ const nt = ({
54
54
  initialItems: s,
55
55
  enableApplyDiscard: e,
56
- enableNormalizedState: t = !1
56
+ enableNormalizedState: t = !1,
57
+ initialCollapsedItems: n
57
58
  }) => {
58
- const [n, u] = o(s), [d, f] = o(!1), g = O(() => ({
59
+ const [d, i] = u(s), [r, h] = u(!1), o = O(() => ({
59
60
  get current() {
60
- return d;
61
+ return r;
61
62
  },
62
63
  set current(c) {
63
- c !== d && queueMicrotask(() => f(c));
64
+ c !== r && queueMicrotask(() => h(c));
64
65
  }
65
- }), [d]), r = n !== s, [C, x] = o(s), [v, l] = o(s), [i, w] = o(
66
+ }), [r]), C = d !== s, [j, x] = u(s), [v, l] = u(s), [f, w] = u(
66
67
  () => t ? p(s) : {
67
68
  byId: /* @__PURE__ */ new Map(),
68
69
  childrenById: /* @__PURE__ */ new Map(),
69
70
  parentById: /* @__PURE__ */ new Map(),
70
71
  rootIds: []
71
72
  }
72
- ), [k, E] = o(
73
+ ), [k, E] = u(
73
74
  () => t ? p(s) : {
74
75
  byId: /* @__PURE__ */ new Map(),
75
76
  childrenById: /* @__PURE__ */ new Map(),
76
77
  parentById: /* @__PURE__ */ new Map(),
77
78
  rootIds: []
78
79
  }
79
- ), [j, G] = o(""), [J, K] = o({}), [P, Q] = o(!1), [V, W] = o(null), [X, Y] = o(null), [Z, _] = o(
80
+ ), [G, J] = u(""), [K, P] = u(n ?? {}), [Q, V] = u(!1), [W, X] = u(null), [Y, Z] = u(null), [_, $] = u(
80
81
  /* @__PURE__ */ new Set()
81
- ), [$, m] = o(/* @__PURE__ */ new Set());
82
- if (r && !d && (u(s), l(s), e && x(s), t)) {
82
+ ), [m, b] = u(/* @__PURE__ */ new Set());
83
+ if (C && !r && (i(s), l(s), e && x(s), t)) {
83
84
  const c = p(s);
84
85
  w(c), e && E(c);
85
86
  }
86
- d && !r && f(!1);
87
- const U = y((c) => t ? S(i, c) : null, [t, i]), L = y((c, h) => {
88
- t && (w((I) => R(I, c, h)), l((I) => a(R(p(I), c, h))));
89
- }, [t]), A = y((c) => t ? N(i, c) : [], [t, i]), F = y((c) => t ? z(i, c) : [], [t, i]), q = y((c) => {
90
- t && (w((h) => {
91
- const I = new Map(h.byId);
87
+ r && !C && h(!1);
88
+ const U = g((c) => t ? N(f, c) : null, [t, f]), L = g((c, y) => {
89
+ t && (w((I) => R(I, c, y)), l((I) => a(R(p(I), c, y))));
90
+ }, [t]), A = g((c) => t ? z(f, c) : [], [t, f]), F = g((c) => t ? tt(f, c) : [], [t, f]), q = g((c) => {
91
+ t && (w((y) => {
92
+ const I = new Map(y.byId);
92
93
  return c.forEach((T, B) => {
93
94
  const M = I.get(B);
94
95
  M && I.set(B, { ...M, ...T });
95
- }), { ...h, byId: I };
96
- }), l((h) => {
97
- const I = p(h);
96
+ }), { ...y, byId: I };
97
+ }), l((y) => {
98
+ const I = p(y);
98
99
  return c.forEach((T, B) => {
99
100
  const M = I.byId.get(B);
100
101
  M && I.byId.set(B, { ...M, ...T });
101
102
  }), a(I);
102
103
  }));
103
- }, [t]), D = y(() => {
104
- t && l(a(i));
105
- }, [t, i]), H = y(() => {
104
+ }, [t]), D = g(() => {
105
+ t && l(a(f));
106
+ }, [t, f]), H = g(() => {
106
107
  t && w(p(v));
107
- }, [t, v]), b = O(() => ({
108
+ }, [t, v]), S = O(() => ({
108
109
  findItemByIdFast: U,
109
110
  updateItemFast: L,
110
111
  getAncestors: A,
@@ -113,7 +114,7 @@ const st = ({
113
114
  syncToTreeState: D,
114
115
  syncToNormalizedState: H,
115
116
  isNormalized: t,
116
- normalizedState: i,
117
+ normalizedState: f,
117
118
  setNormalizedState: w,
118
119
  savedNormalizedState: k,
119
120
  setSavedNormalizedState: E
@@ -126,40 +127,40 @@ const st = ({
126
127
  D,
127
128
  H,
128
129
  t,
129
- i,
130
+ f,
130
131
  k
131
132
  ]);
132
133
  return {
133
134
  // Standard state (backward compatible)
134
135
  items: v,
135
136
  setItems: l,
136
- savedItems: C,
137
+ savedItems: j,
137
138
  setSavedItems: x,
138
- isUserChangeRef: g,
139
- searchText: j,
140
- setSearchText: G,
141
- collapsedItems: J,
142
- setCollapsedItems: K,
143
- isListCollapsed: P,
144
- setIsListCollapsed: Q,
145
- activeId: V,
146
- setActiveId: W,
147
- overId: X,
148
- setOverId: Y,
149
- selectedCategories: Z,
150
- setSelectedCategories: _,
151
- itemsToBlink: $,
152
- setItemsToBlink: m,
139
+ isUserChangeRef: o,
140
+ searchText: G,
141
+ setSearchText: J,
142
+ collapsedItems: K,
143
+ setCollapsedItems: P,
144
+ isListCollapsed: Q,
145
+ setIsListCollapsed: V,
146
+ activeId: W,
147
+ setActiveId: X,
148
+ overId: Y,
149
+ setOverId: Z,
150
+ selectedCategories: _,
151
+ setSelectedCategories: $,
152
+ itemsToBlink: m,
153
+ setItemsToBlink: b,
153
154
  // Normalized state helpers (for optimized operations)
154
- ...b
155
+ ...S
155
156
  };
156
157
  };
157
158
  export {
158
159
  a as denormalizeItems,
159
- N as getAncestorIds,
160
- z as getDescendantIds,
161
- S as getItemById,
160
+ z as getAncestorIds,
161
+ tt as getDescendantIds,
162
+ N as getItemById,
162
163
  p as normalizeItems,
163
164
  R as updateNormalizedItem,
164
- st as useNestedListState
165
+ nt as useNestedListState
165
166
  };