chizu 0.2.16 → 0.2.18

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.
package/README.md CHANGED
@@ -8,7 +8,9 @@ Strongly typed React framework using generators and efficiently updated views al
8
8
 
9
9
  1. [Benefits](#benefits)
10
10
  1. [Getting started](#getting-started)
11
- 1. [Handling errors](#handling-errors)
11
+ 1. [Error handling](#error-handling)
12
+ 1. [Distributed events](#distributed-events)
13
+ 1. [Module context](#module-context)
12
14
 
13
15
  ## Benefits
14
16
 
@@ -28,15 +30,15 @@ Strongly typed React framework using generators and efficiently updated views al
28
30
  Actions are responsible for mutating the state of the view. In the below example the `name` is dispatched from the view to the actions, the state is updated and the view is rendered with the updated value.
29
31
 
30
32
  ```tsx
31
- export default (function Actions(module) {
33
+ export default <Actions<Module>>function Actions(module) {
32
34
  return {
33
- async *[Events.Name](name) {
35
+ [Events.Name](name) {
34
36
  return module.actions.produce((draft) => {
35
37
  draft.name = name;
36
38
  });
37
39
  },
38
40
  };
39
- } as Actions<Module>);
41
+ };
40
42
  ```
41
43
 
42
44
  ```tsx
@@ -62,7 +64,7 @@ export default function Profile(props: Props): React.ReactElement {
62
64
  You can perform asynchronous operations in the action which will cause the associated view to render a second time:
63
65
 
64
66
  ```tsx
65
- export default (function Actions(module) {
67
+ export default <Actions<Module>>function Actions(module) {
66
68
  return {
67
69
  async *[Events.Name]() {
68
70
  yield module.actions.produce((draft) => {
@@ -76,7 +78,7 @@ export default (function Actions(module) {
76
78
  });
77
79
  },
78
80
  };
79
- } as Actions<Module>);
81
+ };
80
82
  ```
81
83
 
82
84
  ```tsx
@@ -100,11 +102,11 @@ export default function Profile(props: Props): React.ReactElement {
100
102
  However in the above example where the name is fetched asynchronously, there is no feedback to the user &ndash; we can improve that significantly by using the `module.actions.annotate` and `module.validate` helpers:
101
103
 
102
104
  ```tsx
103
- export default (function Actions(module) {
105
+ export default <Actions<Module>>function Actions(module) {
104
106
  return {
105
107
  async *[Events.Name]() {
106
108
  yield module.actions.produce((draft) => {
107
- draft.name = module.actions.annotate(null, [State.Op.Update]);
109
+ draft.name = module.actions.annotate(null);
108
110
  });
109
111
 
110
112
  const name = await fetch(/* ... */);
@@ -113,7 +115,7 @@ export default (function Actions(module) {
113
115
  });
114
116
  },
115
117
  };
116
- } as Actions<Module>);
118
+ };
117
119
  ```
118
120
 
119
121
  ```tsx
@@ -139,7 +141,7 @@ export default function ProfileView(props: Props): React.ReactElement {
139
141
  }
140
142
  ```
141
143
 
142
- ## Handling Errors
144
+ ## Error handling
143
145
 
144
146
  Actions can throw errors directly or in any of their associated `yield` actions &ndash; all unhandled errors are automatically caught and broadcast using the `Lifecycle.Error` action &ndash; you can render these [in a toast](https://github.com/fkhadra/react-toastify#readme) or similar UI.
145
147
 
@@ -155,7 +157,7 @@ export const enum Errors {
155
157
  ```
156
158
 
157
159
  ```tsx
158
- export default (function Actions(module) {
160
+ export default <Actions<Module>>function Actions(module) {
159
161
  return {
160
162
  *[Events.Name]() {
161
163
  yield module.actions.produce((draft) => {
@@ -171,13 +173,13 @@ export default (function Actions(module) {
171
173
  });
172
174
  },
173
175
  };
174
- }) as Actions<Module>;
176
+ };
175
177
  ```
176
178
 
177
179
  However showing a toast message is not always relevant, you may want a more detailed error message such as a user not found message &ndash; although you could introduce another property for such errors in your model, you could mark the property as fallible by giving it a `Maybe` type because it then keeps everything nicely associated with the `name` property rather than creating another property:
178
180
 
179
181
  ```tsx
180
- export default (function Actions(module) {
182
+ export default <Actions<Module>>function Actions(module) {
181
183
  return {
182
184
  async *[Events.Name]() {
183
185
  yield module.actions.produce((draft) => {
@@ -197,5 +199,35 @@ export default (function Actions(module) {
197
199
  });
198
200
  },
199
201
  };
200
- } as Actions<Module>);
202
+ };
203
+ ```
204
+
205
+ ## Distributed events
206
+
207
+ Actions can communicate with other mounted actions using the `DistributedActions` approach. You can configure the enum and union type in the root of your application:
208
+
209
+ ```ts
210
+ export enum DistributedEvents {
211
+ SignedOut = "distributed/signed-out",
212
+ }
213
+
214
+ export type DistributedActions = [DistributedEvents.SignedOut];
215
+ ```
216
+
217
+ Note that you must prefix the enum name with `distributed` for it to behave as a distributed event, otherwise it'll be considered a module event only. Once you have the distributed events you simply need to augment the module actions union with the `DistributedActions` and use it as you do other actions:
218
+
219
+ ```ts
220
+ export type Actions = DistributedActions | [Events.Task, string]; // etc...
221
+ ```
222
+
223
+ ## Module context
224
+
225
+ In the eventuality that you have a component but don't want associated actions, models, etc&hellip; but want to still fire events either the closest module or a distributed event, you can use the `useModule` hook:
226
+
227
+ ```ts
228
+ const module = useModule<Module>();
229
+
230
+ // ...
231
+
232
+ module.actions.dispatch([Event.Task, "My task that needs to be done."]);
201
233
  ```
package/dist/chizu.js CHANGED
@@ -3,25 +3,25 @@ var D = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
5
  var N = (t, e, n) => e in t ? z(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
- var E = (t, e, n) => N(t, typeof e != "symbol" ? e + "" : e, n), O = (t, e, n) => e.has(t) || D("Cannot " + n);
7
- var g = (t, e, n) => (O(t, e, "read from private field"), n ? n.call(t) : e.get(t)), b = (t, e, n) => e.has(t) ? D("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), w = (t, e, n, r) => (O(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n);
8
- import { jsx as $ } from "react/jsx-runtime";
9
- import * as l from "react";
6
+ var w = (t, e, n) => N(t, typeof e != "symbol" ? e + "" : e, n), C = (t, e, n) => e.has(t) || D("Cannot " + n);
7
+ var y = (t, e, n) => (C(t, e, "read from private field"), n ? n.call(t) : e.get(t)), g = (t, e, n) => e.has(t) ? D("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), b = (t, e, n, r) => (C(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n);
8
+ import { jsx as q } from "react/jsx-runtime";
9
+ import * as c from "react";
10
10
  import P from "eventemitter3";
11
- import { Immer as q } from "immer";
12
- import p from "lodash/get";
13
- import S from "traverse";
14
- class _ {
11
+ import { Immer as I } from "immer";
12
+ import v from "lodash/get";
13
+ import M from "traverse";
14
+ class U {
15
15
  constructor(e) {
16
16
  this.value = e;
17
17
  }
18
18
  }
19
- class I {
19
+ class F {
20
20
  static Draft(e) {
21
- return new _(e);
21
+ return new U(e);
22
22
  }
23
23
  }
24
- E(I, "Op", {
24
+ w(F, "Op", {
25
25
  Add: 1,
26
26
  Remove: 2,
27
27
  Update: 4,
@@ -30,8 +30,8 @@ E(I, "Op", {
30
30
  });
31
31
  var h = /* @__PURE__ */ ((t) => (t.Mount = "lifecycle/mount", t.Node = "lifecycle/node", t.Derive = "lifecycle/derive", t.Error = "distributed/lifecycle/error", t.Unmount = "lifecycle/unmount", t))(h || {});
32
32
  function d(t, e) {
33
- const n = l.useRef(null), r = l.useRef(null);
34
- return l.useMemo(() => {
33
+ const n = c.useRef(null), r = c.useRef(null);
34
+ return c.useMemo(() => {
35
35
  const s = m(e);
36
36
  if (r.current !== s) {
37
37
  r.current = s;
@@ -41,136 +41,136 @@ function d(t, e) {
41
41
  return n.current;
42
42
  }, e);
43
43
  }
44
- function B(t, e) {
45
- const n = l.useRef(null);
46
- l.useEffect(() => {
44
+ function O(t, e) {
45
+ const n = c.useRef(null);
46
+ c.useEffect(() => {
47
47
  const r = m(e);
48
48
  if (n.current !== r)
49
49
  return n.current = r, t();
50
50
  }, e);
51
51
  }
52
- const A = l.createContext({
52
+ const _ = c.createContext({
53
53
  appEmitter: new P()
54
54
  });
55
55
  function j() {
56
- return l.useContext(A);
56
+ return c.useContext(_);
57
57
  }
58
- function ft({ children: t }) {
58
+ function ht({ children: t }) {
59
59
  const e = d(
60
60
  () => ({
61
61
  appEmitter: new P()
62
62
  }),
63
63
  []
64
64
  );
65
- return /* @__PURE__ */ $(A.Provider, { value: e, children: t });
65
+ return /* @__PURE__ */ q(_.Provider, { value: e, children: t });
66
66
  }
67
- const a = {
68
- immer: new q(),
67
+ const l = {
68
+ immer: new I(),
69
69
  annotations: Symbol("annotations")
70
70
  };
71
- a.immer.setAutoFreeze(!1);
72
- class M {
71
+ l.immer.setAutoFreeze(!1);
72
+ class S {
73
73
  constructor(e, n, r = null) {
74
- E(this, "process");
74
+ w(this, "process");
75
75
  this.value = e, this.operations = n, this.field = r, this.process = null;
76
76
  }
77
77
  attach(e) {
78
78
  return this.process = e, this;
79
79
  }
80
80
  }
81
- function F(t, e = []) {
82
- return new M(t, e);
81
+ function J(t, e = []) {
82
+ return new S(t, e);
83
83
  }
84
84
  class k {
85
85
  constructor(e, n = e) {
86
86
  this.stateless = e, this.stateful = n;
87
87
  }
88
88
  get validatable() {
89
- return C(this.stateful);
89
+ return A(this.stateful);
90
90
  }
91
91
  }
92
- function C(t, e = []) {
92
+ function A(t, e = []) {
93
93
  return new Proxy(t, {
94
94
  get(n, r) {
95
95
  switch (r) {
96
96
  case "is":
97
97
  return (s) => {
98
- const o = R(t, e);
98
+ const o = x(t, e);
99
99
  if (!o) return !1;
100
100
  const u = new Set(
101
- o.flatMap((i) => i.operations)
101
+ o.flatMap((a) => a.operations)
102
102
  );
103
103
  return !!(Array.from(u).reduce(
104
- (i, f) => i | (f ?? 0),
104
+ (a, f) => a | (f ?? 0),
105
105
  0
106
106
  ) & s);
107
107
  };
108
108
  case "pending":
109
- return () => !!R(t, e);
109
+ return () => !!x(t, e);
110
110
  case "draft":
111
111
  return () => {
112
- const s = R(t, e);
113
- if (!s) return p(t, e);
114
- const o = s.flatMap((u) => u.operations).find((u) => u instanceof _);
115
- return o ? o.value : p(t, e);
112
+ const s = x(t, e);
113
+ if (!s) return v(t, e);
114
+ const o = s.flatMap((u) => u.operations).find((u) => u instanceof U);
115
+ return o ? o.value : v(t, e);
116
116
  };
117
117
  }
118
- return C(t, [...e, String(r)]);
118
+ return A(t, [...e, String(r)]);
119
119
  }
120
120
  });
121
121
  }
122
- function R(t, e) {
123
- const r = typeof p(t, e) == "object" ? e : e.slice(0, -1), s = r.length === 0 ? t : p(t, r), o = (s == null ? void 0 : s[a.annotations]) ?? [];
122
+ function x(t, e) {
123
+ const r = typeof v(t, e) == "object" ? e : e.slice(0, -1), s = r.length === 0 ? t : v(t, r), o = (s == null ? void 0 : s[l.annotations]) ?? [];
124
124
  return o.length > 0 ? o : null;
125
125
  }
126
- function J(t, e, n) {
126
+ function Q(t, e, n) {
127
127
  function r(o) {
128
- return S(o).forEach(function() {
129
- if (this.key === a.annotations) {
128
+ return M(o).forEach(function() {
129
+ if (this.key === l.annotations) {
130
130
  this.block();
131
131
  return;
132
132
  }
133
- this.node instanceof M && this.update(this.node.value);
133
+ this.node instanceof S && this.update(this.node.value);
134
134
  });
135
135
  }
136
136
  function s(o) {
137
- return S(o).forEach(function() {
138
- if (this.key === a.annotations) {
137
+ return M(o).forEach(function() {
138
+ if (this.key === l.annotations) {
139
139
  this.block();
140
140
  return;
141
141
  }
142
- if (this.node instanceof M) {
143
- const u = typeof this.node.value == "object", c = [
142
+ if (this.node instanceof S) {
143
+ const u = typeof this.node.value == "object", i = [
144
144
  ...u ? this.path : this.path.slice(0, -1),
145
- a.annotations
146
- ], i = p(t.stateful, c) ?? [], f = this.node.attach(e);
145
+ l.annotations
146
+ ], a = v(t.stateful, i) ?? [], f = this.node.attach(e);
147
147
  u ? this.update(
148
148
  {
149
149
  ...this.node.value,
150
- [a.annotations]: [f, ...i]
150
+ [l.annotations]: [f, ...a]
151
151
  },
152
152
  !0
153
- ) : (this.parent && (this.parent.node[a.annotations] = [f, ...i]), this.update(this.node.value, !0));
153
+ ) : (this.parent && (this.parent.node[l.annotations] = [f, ...a]), this.update(this.node.value, !0));
154
154
  }
155
155
  });
156
156
  }
157
157
  return new k(
158
- r(a.immer.produce(t.stateless, n)),
159
- s(a.immer.produce(t.stateful, n))
158
+ r(l.immer.produce(t.stateless, n)),
159
+ s(l.immer.produce(t.stateful, n))
160
160
  );
161
161
  }
162
- function x(t, e) {
163
- const n = S(t.stateful).forEach(function() {
164
- if (this.key === a.annotations) {
162
+ function R(t, e) {
163
+ const n = M(t.stateful).forEach(function() {
164
+ if (this.key === l.annotations) {
165
165
  this.block();
166
166
  return;
167
167
  }
168
- if (this.node && this.node[a.annotations]) {
169
- const r = this.node[a.annotations];
168
+ if (this.node && this.node[l.annotations]) {
169
+ const r = this.node[l.annotations];
170
170
  this.update(
171
171
  {
172
172
  ...this.node,
173
- [a.annotations]: r.filter(
173
+ [l.annotations]: r.filter(
174
174
  (s) => s.process !== e
175
175
  )
176
176
  },
@@ -180,72 +180,72 @@ function x(t, e) {
180
180
  });
181
181
  return new k(t.stateless, n);
182
182
  }
183
- function Q(t) {
183
+ function W(t) {
184
184
  const e = j();
185
185
  return (n, r) => async (s = Promise.withResolvers(), o) => {
186
186
  if (typeof r != "function") return;
187
- const u = Symbol("process"), c = r(...o);
187
+ const u = Symbol("process"), i = r(...o);
188
188
  try {
189
- if (c == null) return;
190
- if (typeof c == "function") {
191
- const i = c(t.model.current, u);
192
- t.model.current = x(i, u), t.update.rerender(), s.resolve();
189
+ if (i == null) return;
190
+ if (typeof i == "function") {
191
+ const a = i(t.model.current, u);
192
+ t.model.current = R(a, u), t.update.rerender(), s.resolve();
193
193
  return;
194
194
  }
195
195
  for (; ; ) {
196
- const { value: i, done: f } = await c.next();
196
+ const { value: a, done: f } = await i.next();
197
197
  if (f) {
198
- const T = i(t.model.current, u);
199
- t.model.current = x(T, u), t.update.rerender();
198
+ const $ = a(t.model.current, u);
199
+ t.model.current = R($, u), t.update.rerender();
200
200
  break;
201
201
  }
202
- const H = i;
203
- t.model.current = H(t.model.current, u), t.update.rerender(), s.resolve();
202
+ const T = a;
203
+ t.model.current = T(t.model.current, u), t.update.rerender(), s.resolve();
204
204
  }
205
- } catch (i) {
206
- x(t.model.current, u), t.update.rerender(), e.appEmitter.emit(h.Error, s, [i]);
205
+ } catch (a) {
206
+ R(t.model.current, u), t.update.rerender(), e.appEmitter.emit(h.Error, s, [a]);
207
207
  }
208
208
  };
209
209
  }
210
- function U(t) {
210
+ function B(t) {
211
211
  return t.startsWith("distributed");
212
212
  }
213
- var v, y;
214
- class W extends Error {
213
+ var p, E;
214
+ class G extends Error {
215
215
  constructor(n, r = null) {
216
216
  super(String(r));
217
- b(this, v);
218
- b(this, y);
219
- w(this, v, n), w(this, y, r);
217
+ g(this, p);
218
+ g(this, E);
219
+ b(this, p, n), b(this, E, r);
220
220
  }
221
221
  get type() {
222
- return g(this, v);
222
+ return y(this, p);
223
223
  }
224
224
  get message() {
225
- return g(this, y) || "";
225
+ return y(this, E) || "";
226
226
  }
227
227
  }
228
- v = new WeakMap(), y = new WeakMap();
229
- function G(t) {
228
+ p = new WeakMap(), E = new WeakMap();
229
+ function K(t) {
230
230
  return new Promise((e) => setTimeout(e, t));
231
231
  }
232
- function K(t) {
232
+ function V(t) {
233
233
  return t ? !!(t && typeof t != "symbol") : Symbol(`pk.${Date.now()}.${crypto.randomUUID()}`);
234
234
  }
235
- function V(t) {
236
- return t instanceof W;
235
+ function X(t) {
236
+ return t instanceof G;
237
237
  }
238
238
  function m(t) {
239
239
  return JSON.stringify(t);
240
240
  }
241
- const ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
241
+ const mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
242
242
  __proto__: null,
243
243
  hash: m,
244
- isEventError: V,
245
- pk: K,
246
- sleep: G
244
+ isEventError: X,
245
+ pk: V,
246
+ sleep: K
247
247
  }, Symbol.toStringTag, { value: "Module" }));
248
- function X(t) {
248
+ function Y(t) {
249
249
  return d(
250
250
  () => ({
251
251
  controller: {
@@ -255,10 +255,10 @@ function X(t) {
255
255
  queue: [],
256
256
  actions: {
257
257
  annotate(e, n) {
258
- return F(e, n);
258
+ return J(e, n);
259
259
  },
260
260
  produce(e) {
261
- return (n, r) => J(n, r, e);
261
+ return (n, r) => Q(n, r, e);
262
262
  },
263
263
  dispatch([e, ...n]) {
264
264
  if (e == null) return Promise.reject();
@@ -286,76 +286,88 @@ function X(t) {
286
286
  []
287
287
  );
288
288
  }
289
- function Y(t) {
289
+ function Z(t) {
290
290
  return d(() => {
291
291
  const e = t.options.using.actions(t.actions.controller);
292
292
  return Object.entries(e).forEach(([r, s]) => t.dispatchers.attach(r, s)), e;
293
293
  }, []);
294
294
  }
295
- function Z(t) {
296
- const e = j(), n = Q(t);
295
+ function L(t) {
296
+ const e = j(), n = W(t);
297
297
  return d(() => {
298
298
  const r = new P();
299
299
  return {
300
300
  attach(s, o) {
301
301
  const u = String(s);
302
- U(u) ? e.appEmitter.on(u, n(s, o)) : r.on(u, n(s, o));
302
+ B(u) ? e.appEmitter.on(u, n(s, o)) : r.on(u, n(s, o));
303
303
  },
304
304
  dispatch(s, o, u) {
305
- const c = String(s);
306
- U(c) ? e.appEmitter.emit(c, u, o) : r.emit(c, u, o);
305
+ const i = String(s);
306
+ B(i) ? e.appEmitter.emit(i, u, o) : r.emit(i, u, o);
307
307
  }
308
308
  };
309
309
  }, []);
310
310
  }
311
- function L() {
312
- const t = l.useRef(null);
311
+ function tt() {
312
+ const t = c.useRef(null);
313
313
  return d(() => ({ customElement: t }), []);
314
314
  }
315
- function tt(t) {
316
- B(() => {
315
+ function et(t) {
316
+ O(() => {
317
317
  t.dispatchers.dispatch(h.Derive, []);
318
- }, [t.options.using.props]), B(() => (t.dispatchers.dispatch(h.Mount, []), t.dispatchers.dispatch(h.Node, [
318
+ }, [t.options.using.props]), O(() => (t.dispatchers.dispatch(h.Mount, []), t.dispatchers.dispatch(h.Node, [
319
319
  t.elements.customElement.current
320
320
  ]), () => t.dispatchers.dispatch(h.Unmount, [])), []);
321
321
  }
322
- function et(t) {
322
+ function nt(t) {
323
323
  const e = d(() => t.options.using.model ?? {}, []);
324
- return l.useRef(new k(e, e));
325
- }
326
- function nt() {
327
- return l.useRef(/* @__PURE__ */ new Set());
324
+ return c.useRef(new k(e, e));
328
325
  }
329
326
  function rt() {
330
- const [t, e] = l.useReducer((n) => n + 1, 0);
327
+ return c.useRef(/* @__PURE__ */ new Set());
328
+ }
329
+ function st() {
330
+ const [t, e] = c.useReducer((n) => n + 1, 0);
331
331
  return d(() => ({ hash: t, rerender: e }), [t]);
332
332
  }
333
- function st({
333
+ const H = c.createContext(
334
+ null
335
+ );
336
+ function vt() {
337
+ const t = c.useContext(H);
338
+ if (!t) throw new Error("useModule must be used within a module.");
339
+ return t;
340
+ }
341
+ function ot({
334
342
  options: t
335
343
  }) {
336
- const e = rt(), n = nt(), r = L(), s = j(), o = et({ options: t }), u = Z({
344
+ const e = st(), n = rt(), r = tt(), s = j(), o = nt({ options: t }), u = L({
337
345
  broadcast: s,
338
346
  options: t,
339
347
  update: e,
340
348
  model: o,
341
349
  queue: n
342
- }), c = X({ model: o, dispatchers: u });
343
- return Y({ options: t, dispatchers: u, actions: c }), tt({ options: t, dispatchers: u, elements: r }), d(() => l.createElement("x-chizu", {
344
- ref: r.customElement,
345
- style: { display: "contents" },
346
- children: t.children(c.view)
350
+ }), i = Y({ model: o, dispatchers: u });
351
+ return Z({ options: t, dispatchers: u, actions: i }), et({ options: t, dispatchers: u, elements: r }), d(() => c.createElement(H.Provider, {
352
+ value: i.view,
353
+ // eslint-disable-next-line react/no-children-prop
354
+ children: c.createElement("x-chizu", {
355
+ ref: r.customElement,
356
+ style: { display: "contents" },
357
+ children: t.children(i.view)
358
+ })
347
359
  }), [e.hash, m(t.using.props)]);
348
360
  }
349
- function ot(t) {
350
- return st({ options: t });
361
+ function ut(t) {
362
+ return ot({ options: t });
351
363
  }
352
- const mt = l.memo(ot, (t, e) => m(t) === m(e));
364
+ const pt = c.memo(ut, (t, e) => m(t) === m(e));
353
365
  export {
354
- ft as BroadcastProvider,
355
- W as EventError,
366
+ ht as BroadcastProvider,
367
+ G as EventError,
356
368
  h as Lifecycle,
357
- I as State,
358
- mt as Tree,
359
- j as useBroadcast,
360
- ht as utils
369
+ F as State,
370
+ pt as Tree,
371
+ vt as useModule,
372
+ mt as utils
361
373
  };
@@ -1 +1 @@
1
- (function(r,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react/jsx-runtime"),require("react"),require("eventemitter3"),require("immer"),require("lodash/get"),require("traverse")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","eventemitter3","immer","lodash/get","traverse"],u):(r=typeof globalThis<"u"?globalThis:r||self,u(r.Chizu={},r.jsxRuntime,r.React,r.EventEmitter3,r.Immer,r.get,r.Traverse))})(this,function(r,u,a,p,I,g,S){"use strict";var le=Object.defineProperty;var H=r=>{throw TypeError(r)};var de=(r,u,a)=>u in r?le(r,u,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[u]=a;var x=(r,u,a)=>de(r,typeof u!="symbol"?u+"":u,a),N=(r,u,a)=>u.has(r)||H("Cannot "+a);var D=(r,u,a)=>(N(r,u,"read from private field"),a?a.call(r):u.get(r)),k=(r,u,a)=>u.has(r)?H("Cannot add the same private member more than once"):u instanceof WeakSet?u.add(r):u.set(r,a),T=(r,u,a,p)=>(N(r,u,"write to private field"),p?p.call(r,a):u.set(r,a),a);var w,E;function $(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const d=$(a);class _{constructor(t){this.value=t}}class q{static Draft(t){return new _(t)}}x(q,"Op",{Add:1,Remove:2,Update:4,Move:8,Replace:16});var v=(e=>(e.Mount="lifecycle/mount",e.Node="lifecycle/node",e.Derive="lifecycle/derive",e.Error="distributed/lifecycle/error",e.Unmount="lifecycle/unmount",e))(v||{});function m(e,t){const s=d.useRef(null),n=d.useRef(null);return d.useMemo(()=>{const o=y(t);if(n.current!==o){n.current=o;const i=e();return s.current=i,i}return s.current},t)}function B(e,t){const s=d.useRef(null);d.useEffect(()=>{const n=y(t);if(s.current!==n)return s.current=n,e()},t)}const U=d.createContext({appEmitter:new p});function j(){return d.useContext(U)}function F({children:e}){const t=m(()=>({appEmitter:new p}),[]);return u.jsx(U.Provider,{value:t,children:e})}const f={immer:new I.Immer,annotations:Symbol("annotations")};f.immer.setAutoFreeze(!1);class R{constructor(t,s,n=null){x(this,"process");this.value=t,this.operations=s,this.field=n,this.process=null}attach(t){return this.process=t,this}}function J(e,t=[]){return new R(e,t)}class P{constructor(t,s=t){this.stateless=t,this.stateful=s}get validatable(){return z(this.stateful)}}function z(e,t=[]){return new Proxy(e,{get(s,n){switch(n){case"is":return o=>{const i=O(e,t);if(!i)return!1;const c=new Set(i.flatMap(h=>h.operations));return!!(Array.from(c).reduce((h,b)=>h|(b??0),0)&o)};case"pending":return()=>!!O(e,t);case"draft":return()=>{const o=O(e,t);if(!o)return g(e,t);const i=o.flatMap(c=>c.operations).find(c=>c instanceof _);return i?i.value:g(e,t)}}return z(e,[...t,String(n)])}})}function O(e,t){const n=typeof g(e,t)=="object"?t:t.slice(0,-1),o=n.length===0?e:g(e,n),i=(o==null?void 0:o[f.annotations])??[];return i.length>0?i:null}function Q(e,t,s){function n(i){return S(i).forEach(function(){if(this.key===f.annotations){this.block();return}this.node instanceof R&&this.update(this.node.value)})}function o(i){return S(i).forEach(function(){if(this.key===f.annotations){this.block();return}if(this.node instanceof R){const c=typeof this.node.value=="object",l=[...c?this.path:this.path.slice(0,-1),f.annotations],h=g(e.stateful,l)??[],b=this.node.attach(t);c?this.update({...this.node.value,[f.annotations]:[b,...h]},!0):(this.parent&&(this.parent.node[f.annotations]=[b,...h]),this.update(this.node.value,!0))}})}return new P(n(f.immer.produce(e.stateless,s)),o(f.immer.produce(e.stateful,s)))}function M(e,t){const s=S(e.stateful).forEach(function(){if(this.key===f.annotations){this.block();return}if(this.node&&this.node[f.annotations]){const n=this.node[f.annotations];this.update({...this.node,[f.annotations]:n.filter(o=>o.process!==t)},!0)}});return new P(e.stateless,s)}function W(e){const t=j();return(s,n)=>async(o=Promise.withResolvers(),i)=>{if(typeof n!="function")return;const c=Symbol("process"),l=n(...i);try{if(l==null)return;if(typeof l=="function"){const h=l(e.model.current,c);e.model.current=M(h,c),e.update.rerender(),o.resolve();return}for(;;){const{value:h,done:b}=await l.next();if(b){const ae=h(e.model.current,c);e.model.current=M(ae,c),e.update.rerender();break}const ce=h;e.model.current=ce(e.model.current,c),e.update.rerender(),o.resolve()}}catch(h){M(e.model.current,c),e.update.rerender(),t.appEmitter.emit(v.Error,o,[h])}}}function A(e){return e.startsWith("distributed")}class C extends Error{constructor(s,n=null){super(String(n));k(this,w);k(this,E);T(this,w,s),T(this,E,n)}get type(){return D(this,w)}get message(){return D(this,E)||""}}w=new WeakMap,E=new WeakMap;function G(e){return new Promise(t=>setTimeout(t,e))}function K(e){return e?!!(e&&typeof e!="symbol"):Symbol(`pk.${Date.now()}.${crypto.randomUUID()}`)}function V(e){return e instanceof C}function y(e){return JSON.stringify(e)}const X=Object.freeze(Object.defineProperty({__proto__:null,hash:y,isEventError:V,pk:K,sleep:G},Symbol.toStringTag,{value:"Module"}));function Y(e){return m(()=>({controller:{get model(){return e.model.current.stateful},queue:[],actions:{annotate(t,s){return J(t,s)},produce(t){return(s,n)=>Q(s,n,t)},dispatch([t,...s]){if(t==null)return Promise.reject();const n=Promise.withResolvers();return e.dispatchers.dispatch(t,s,n),n.promise}}},view:{get model(){return e.model.current.stateless},get validate(){return e.model.current.validatable},actions:{dispatch([t,...s]){if(t==null)return Promise.reject();const n=Promise.withResolvers();return e.dispatchers.dispatch(t,s,n),n.promise}}}}),[])}function Z(e){return m(()=>{const t=e.options.using.actions(e.actions.controller);return Object.entries(t).forEach(([n,o])=>e.dispatchers.attach(n,o)),t},[])}function L(e){const t=j(),s=W(e);return m(()=>{const n=new p;return{attach(o,i){const c=String(o);A(c)?t.appEmitter.on(c,s(o,i)):n.on(c,s(o,i))},dispatch(o,i,c){const l=String(o);A(l)?t.appEmitter.emit(l,c,i):n.emit(l,c,i)}}},[])}function ee(){const e=d.useRef(null);return m(()=>({customElement:e}),[])}function te(e){B(()=>{e.dispatchers.dispatch(v.Derive,[])},[e.options.using.props]),B(()=>(e.dispatchers.dispatch(v.Mount,[]),e.dispatchers.dispatch(v.Node,[e.elements.customElement.current]),()=>e.dispatchers.dispatch(v.Unmount,[])),[])}function ne(e){const t=m(()=>e.options.using.model??{},[]);return d.useRef(new P(t,t))}function re(){return d.useRef(new Set)}function se(){const[e,t]=d.useReducer(s=>s+1,0);return m(()=>({hash:e,rerender:t}),[e])}function oe({options:e}){const t=se(),s=re(),n=ee(),o=j(),i=ne({options:e}),c=L({broadcast:o,options:e,update:t,model:i,queue:s}),l=Y({model:i,dispatchers:c});return Z({options:e,dispatchers:c,actions:l}),te({options:e,dispatchers:c,elements:n}),m(()=>d.createElement("x-chizu",{ref:n.customElement,style:{display:"contents"},children:e.children(l.view)}),[t.hash,y(e.using.props)])}function ue(e){return oe({options:e})}const ie=d.memo(ue,(e,t)=>y(e)===y(t));r.BroadcastProvider=F,r.EventError=C,r.Lifecycle=v,r.State=q,r.Tree=ie,r.useBroadcast=j,r.utils=X,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
1
+ (function(r,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react/jsx-runtime"),require("react"),require("eventemitter3"),require("immer"),require("lodash/get"),require("traverse")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","eventemitter3","immer","lodash/get","traverse"],u):(r=typeof globalThis<"u"?globalThis:r||self,u(r.Chizu={},r.jsxRuntime,r.React,r.EventEmitter3,r.Immer,r.get,r.Traverse))})(this,function(r,u,a,p,I,b,j){"use strict";var fe=Object.defineProperty;var N=r=>{throw TypeError(r)};var he=(r,u,a)=>u in r?fe(r,u,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[u]=a;var O=(r,u,a)=>he(r,typeof u!="symbol"?u+"":u,a),$=(r,u,a)=>u.has(r)||N("Cannot "+a);var D=(r,u,a)=>($(r,u,"read from private field"),a?a.call(r):u.get(r)),k=(r,u,a)=>u.has(r)?N("Cannot add the same private member more than once"):u instanceof WeakSet?u.add(r):u.set(r,a),T=(r,u,a,p)=>($(r,u,"write to private field"),p?p.call(r,a):u.set(r,a),a);var E,g;function F(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const l=F(a);class _{constructor(t){this.value=t}}class q{static Draft(t){return new _(t)}}O(q,"Op",{Add:1,Remove:2,Update:4,Move:8,Replace:16});var v=(e=>(e.Mount="lifecycle/mount",e.Node="lifecycle/node",e.Derive="lifecycle/derive",e.Error="distributed/lifecycle/error",e.Unmount="lifecycle/unmount",e))(v||{});function m(e,t){const s=l.useRef(null),n=l.useRef(null);return l.useMemo(()=>{const o=y(t);if(n.current!==o){n.current=o;const i=e();return s.current=i,i}return s.current},t)}function C(e,t){const s=l.useRef(null);l.useEffect(()=>{const n=y(t);if(s.current!==n)return s.current=n,e()},t)}const B=l.createContext({appEmitter:new p});function S(){return l.useContext(B)}function J({children:e}){const t=m(()=>({appEmitter:new p}),[]);return u.jsx(B.Provider,{value:t,children:e})}const f={immer:new I.Immer,annotations:Symbol("annotations")};f.immer.setAutoFreeze(!1);class M{constructor(t,s,n=null){O(this,"process");this.value=t,this.operations=s,this.field=n,this.process=null}attach(t){return this.process=t,this}}function Q(e,t=[]){return new M(e,t)}class P{constructor(t,s=t){this.stateless=t,this.stateful=s}get validatable(){return U(this.stateful)}}function U(e,t=[]){return new Proxy(e,{get(s,n){switch(n){case"is":return o=>{const i=R(e,t);if(!i)return!1;const c=new Set(i.flatMap(h=>h.operations));return!!(Array.from(c).reduce((h,w)=>h|(w??0),0)&o)};case"pending":return()=>!!R(e,t);case"draft":return()=>{const o=R(e,t);if(!o)return b(e,t);const i=o.flatMap(c=>c.operations).find(c=>c instanceof _);return i?i.value:b(e,t)}}return U(e,[...t,String(n)])}})}function R(e,t){const n=typeof b(e,t)=="object"?t:t.slice(0,-1),o=n.length===0?e:b(e,n),i=(o==null?void 0:o[f.annotations])??[];return i.length>0?i:null}function W(e,t,s){function n(i){return j(i).forEach(function(){if(this.key===f.annotations){this.block();return}this.node instanceof M&&this.update(this.node.value)})}function o(i){return j(i).forEach(function(){if(this.key===f.annotations){this.block();return}if(this.node instanceof M){const c=typeof this.node.value=="object",d=[...c?this.path:this.path.slice(0,-1),f.annotations],h=b(e.stateful,d)??[],w=this.node.attach(t);c?this.update({...this.node.value,[f.annotations]:[w,...h]},!0):(this.parent&&(this.parent.node[f.annotations]=[w,...h]),this.update(this.node.value,!0))}})}return new P(n(f.immer.produce(e.stateless,s)),o(f.immer.produce(e.stateful,s)))}function x(e,t){const s=j(e.stateful).forEach(function(){if(this.key===f.annotations){this.block();return}if(this.node&&this.node[f.annotations]){const n=this.node[f.annotations];this.update({...this.node,[f.annotations]:n.filter(o=>o.process!==t)},!0)}});return new P(e.stateless,s)}function G(e){const t=S();return(s,n)=>async(o=Promise.withResolvers(),i)=>{if(typeof n!="function")return;const c=Symbol("process"),d=n(...i);try{if(d==null)return;if(typeof d=="function"){const h=d(e.model.current,c);e.model.current=x(h,c),e.update.rerender(),o.resolve();return}for(;;){const{value:h,done:w}=await d.next();if(w){const de=h(e.model.current,c);e.model.current=x(de,c),e.update.rerender();break}const le=h;e.model.current=le(e.model.current,c),e.update.rerender(),o.resolve()}}catch(h){x(e.model.current,c),e.update.rerender(),t.appEmitter.emit(v.Error,o,[h])}}}function z(e){return e.startsWith("distributed")}class A extends Error{constructor(s,n=null){super(String(n));k(this,E);k(this,g);T(this,E,s),T(this,g,n)}get type(){return D(this,E)}get message(){return D(this,g)||""}}E=new WeakMap,g=new WeakMap;function K(e){return new Promise(t=>setTimeout(t,e))}function V(e){return e?!!(e&&typeof e!="symbol"):Symbol(`pk.${Date.now()}.${crypto.randomUUID()}`)}function X(e){return e instanceof A}function y(e){return JSON.stringify(e)}const Y=Object.freeze(Object.defineProperty({__proto__:null,hash:y,isEventError:X,pk:V,sleep:K},Symbol.toStringTag,{value:"Module"}));function Z(e){return m(()=>({controller:{get model(){return e.model.current.stateful},queue:[],actions:{annotate(t,s){return Q(t,s)},produce(t){return(s,n)=>W(s,n,t)},dispatch([t,...s]){if(t==null)return Promise.reject();const n=Promise.withResolvers();return e.dispatchers.dispatch(t,s,n),n.promise}}},view:{get model(){return e.model.current.stateless},get validate(){return e.model.current.validatable},actions:{dispatch([t,...s]){if(t==null)return Promise.reject();const n=Promise.withResolvers();return e.dispatchers.dispatch(t,s,n),n.promise}}}}),[])}function L(e){return m(()=>{const t=e.options.using.actions(e.actions.controller);return Object.entries(t).forEach(([n,o])=>e.dispatchers.attach(n,o)),t},[])}function ee(e){const t=S(),s=G(e);return m(()=>{const n=new p;return{attach(o,i){const c=String(o);z(c)?t.appEmitter.on(c,s(o,i)):n.on(c,s(o,i))},dispatch(o,i,c){const d=String(o);z(d)?t.appEmitter.emit(d,c,i):n.emit(d,c,i)}}},[])}function te(){const e=l.useRef(null);return m(()=>({customElement:e}),[])}function ne(e){C(()=>{e.dispatchers.dispatch(v.Derive,[])},[e.options.using.props]),C(()=>(e.dispatchers.dispatch(v.Mount,[]),e.dispatchers.dispatch(v.Node,[e.elements.customElement.current]),()=>e.dispatchers.dispatch(v.Unmount,[])),[])}function re(e){const t=m(()=>e.options.using.model??{},[]);return l.useRef(new P(t,t))}function se(){return l.useRef(new Set)}function oe(){const[e,t]=l.useReducer(s=>s+1,0);return m(()=>({hash:e,rerender:t}),[e])}const H=l.createContext(null);function ue(){const e=l.useContext(H);if(!e)throw new Error("useModule must be used within a module.");return e}function ie({options:e}){const t=oe(),s=se(),n=te(),o=S(),i=re({options:e}),c=ee({broadcast:o,options:e,update:t,model:i,queue:s}),d=Z({model:i,dispatchers:c});return L({options:e,dispatchers:c,actions:d}),ne({options:e,dispatchers:c,elements:n}),m(()=>l.createElement(H.Provider,{value:d.view,children:l.createElement("x-chizu",{ref:n.customElement,style:{display:"contents"},children:e.children(d.view)})}),[t.hash,y(e.using.props)])}function ce(e){return ie({options:e})}const ae=l.memo(ce,(e,t)=>y(e)===y(t));r.BroadcastProvider=J,r.EventError=A,r.Lifecycle=v,r.State=q,r.Tree=ae,r.useModule=ue,r.utils=Y,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
@@ -4,7 +4,7 @@ import { Head } from '../module/renderer/types.ts';
4
4
  import { Actions, Draft, Lifecycle, ModuleDefinition, Op, Queue } from '../types/index.ts';
5
5
  export type ControllerActions<M extends ModuleDefinition> = {
6
6
  annotate<T>(value: T, operations?: (Op | Draft<T>)[]): T;
7
- produce(ƒ: (model: M["Model"]) => void): (models: Models<M["Model"]>, process: Symbol) => Models<M["Model"]>;
7
+ produce(ƒ: (model: M["Model"]) => void): (models: Models<M["Model"]>, process: symbol) => Models<M["Model"]>;
8
8
  dispatch(action: M["Actions"]): Promise<void>;
9
9
  };
10
10
  export type ControllerArgs<M extends ModuleDefinition> = Readonly<{
@@ -16,7 +16,7 @@ export type ActionEvent<M extends ModuleDefinition> = (...args: M["Actions"][num
16
16
  type ActionEvents<M extends ModuleDefinition> = {
17
17
  [K in Head<M["Actions"]>]: (payload: Payload<M["Actions"], K>) => ActionGenerator<M>;
18
18
  };
19
- export type ActionGenerator<M extends ModuleDefinition> = void | ((models: Models<M["Model"]>, process: Symbol) => Models<M["Model"]>) | AsyncGenerator<(models: Models<M["Model"]>, process: Symbol) => Models<M["Model"]>, (models: Models<M["Model"]>, process: Symbol) => Models<M["Model"]>, unknown>;
19
+ export type ActionGenerator<M extends ModuleDefinition> = void | ((models: Models<M["Model"]>, process: symbol) => Models<M["Model"]>) | AsyncGenerator<(models: Models<M["Model"]>, process: symbol) => Models<M["Model"]>, (models: Models<M["Model"]>, process: symbol) => Models<M["Model"]>, unknown>;
20
20
  export type ControllerDefinition<M extends ModuleDefinition> = (controller: ControllerArgs<M>) => ControllerInstance<M>;
21
21
  export type ControllerInstance<M extends ModuleDefinition> = {
22
22
  [Lifecycle.Mount]?(): ActionGenerator<M>;
package/dist/index.d.ts CHANGED
@@ -4,7 +4,8 @@ export { Lifecycle, State } from './types/index.ts';
4
4
  export * as utils from './utils/index.ts';
5
5
  export { EventError } from './module/renderer/dispatchers/utils.ts';
6
6
  export { default as Tree } from './module/index.tsx';
7
- export { BroadcastProvider, useBroadcast } from './broadcast/index.tsx';
7
+ export { BroadcastProvider } from './broadcast/index.tsx';
8
+ export { useModule } from './module/renderer/utils.ts';
8
9
  export type * as Typed from './types/index.ts';
9
10
  export type { Pk } from './types/index.ts';
10
11
  export type { ViewDefinition as View };
@@ -1,4 +1,4 @@
1
1
  import { ModuleDefinition } from '../../types/index.ts';
2
2
  import { Props } from './types.ts';
3
- import { ReactElement } from 'react';
4
- export default function renderer<M extends ModuleDefinition>({ options, }: Props<M>): ReactElement;
3
+ import * as React from "react";
4
+ export default function renderer<M extends ModuleDefinition>({ options, }: Props<M>): React.ReactNode;
@@ -0,0 +1,5 @@
1
+ import { ModuleDefinition } from '../../types';
2
+ import { ViewArgs } from '../../view/types';
3
+ import * as React from "react";
4
+ export declare const Context: React.Context<ViewArgs<ModuleDefinition> | null>;
5
+ export declare function useModule<M extends ModuleDefinition>(): ViewArgs<M>;
@@ -30,7 +30,7 @@ export declare enum Lifecycle {
30
30
  export type Model = Record<string, any>;
31
31
  export type Actions = [] | [ActionName] | [ActionName, ...ActionPayload];
32
32
  export type Props = Record<string, unknown>;
33
- export type Module<M extends Model, A extends Actions = [], P extends Props = {}> = {
33
+ export type Module<M extends Model, A extends Actions = [], P extends Props = Record<string, never>> = {
34
34
  Model: M;
35
35
  Actions: A;
36
36
  Props: P;
@@ -40,7 +40,7 @@ export type ModuleDefinition = {
40
40
  Actions: Actions;
41
41
  Props: Props;
42
42
  };
43
- export type Pk<T> = undefined | Symbol | T;
43
+ export type Pk<T> = undefined | symbol | T;
44
44
  export type Queue<A extends ModuleDefinition["Actions"]> = {
45
45
  name: Head<A>;
46
46
  actions: {
@@ -48,6 +48,6 @@ export type Queue<A extends ModuleDefinition["Actions"]> = {
48
48
  };
49
49
  }[];
50
50
  export type Task = PromiseWithResolvers<void>;
51
- export type Process = Symbol;
51
+ export type Process = symbol;
52
52
  export type Op = number;
53
53
  export {};
@@ -1,7 +1,7 @@
1
1
  import { EventError } from '../module/renderer/dispatchers/utils.ts';
2
2
  import { Pk } from '../types/index.ts';
3
3
  export { default as sleep } from './sleep/index.ts';
4
- export declare function pk<T>(): Symbol;
4
+ export declare function pk(): symbol;
5
5
  export declare function pk<T>(id: Pk<T>): boolean;
6
6
  export declare function isEventError(error: Error | EventError): error is EventError;
7
7
  export declare function hash<T>(x: T): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chizu",
3
- "version": "0.2.16",
3
+ "version": "0.2.18",
4
4
  "type": "module",
5
5
  "main": "./dist/chizu.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,16 +21,19 @@
21
21
  "files": [
22
22
  "dist"
23
23
  ],
24
+ "scripts": {
25
+ "release": "make checks"
26
+ },
24
27
  "devDependencies": {
25
28
  "@babel/preset-env": "^7.27.2",
26
29
  "@babel/preset-react": "^7.27.1",
27
30
  "@babel/preset-typescript": "^7.27.1",
28
31
  "@emotion/css": "^11.13.5",
32
+ "@eslint/js": "^9.27.0",
29
33
  "@jest/globals": "^30.0.0-beta.3",
30
34
  "@testing-library/dom": "^10.4.0",
31
35
  "@testing-library/jest-dom": "^6.6.3",
32
36
  "@testing-library/react": "^16.3.0",
33
- "@trivago/prettier-plugin-sort-imports": "^5.2.2",
34
37
  "@types/lodash": "^4.17.17",
35
38
  "@types/react": "^19.1.6",
36
39
  "@types/react-dom": "^19.1.5",
@@ -38,7 +41,10 @@
38
41
  "commit-and-tag-version": "^12.5.1",
39
42
  "dayjs": "^1.11.13",
40
43
  "dexie": "^4.0.11",
44
+ "eslint": "^9.27.0",
45
+ "eslint-plugin-react": "^7.37.5",
41
46
  "get-port-cli": "^3.0.0",
47
+ "globals": "^16.2.0",
42
48
  "jest": "^29.7.0",
43
49
  "jest-environment-jsdom": "^30.0.0-beta.3",
44
50
  "lucide-react": "^0.511.0",
@@ -50,6 +56,7 @@
50
56
  "ts-jest": "^29.3.4",
51
57
  "ts-node": "^10.9.2",
52
58
  "typescript": "^5.8.3",
59
+ "typescript-eslint": "^8.33.0",
53
60
  "vite": "^6.3.5",
54
61
  "vite-plugin-dts": "^4.5.4",
55
62
  "wait-on": "^8.0.3"