@actdim/dynstruct 1.0.3 → 1.0.5

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 (51) hide show
  1. package/dist/appDomain/adapters.d.ts +10 -0
  2. package/dist/appDomain/adapters.d.ts.map +1 -0
  3. package/dist/appDomain/adapters.es.js +25 -0
  4. package/dist/appDomain/adapters.es.js.map +1 -0
  5. package/dist/appDomain/appContracts.d.ts +10 -8
  6. package/dist/appDomain/appContracts.d.ts.map +1 -1
  7. package/dist/appDomain/appContracts.es.js +10 -8
  8. package/dist/appDomain/appContracts.es.js.map +1 -1
  9. package/dist/appDomain/reactHooks.d.ts +6 -0
  10. package/dist/appDomain/reactHooks.d.ts.map +1 -0
  11. package/dist/appDomain/reactHooks.es.js +12 -0
  12. package/dist/appDomain/reactHooks.es.js.map +1 -0
  13. package/dist/appDomain/security/securityContracts.d.ts +3 -3
  14. package/dist/appDomain/security/securityContracts.d.ts.map +1 -1
  15. package/dist/appDomain/security/securityContracts.es.js.map +1 -1
  16. package/dist/appDomain/security/securityProvider.d.ts +2 -2
  17. package/dist/appDomain/security/securityProvider.es.js.map +1 -1
  18. package/dist/componentModel/DynamicContent.d.ts +14 -0
  19. package/dist/componentModel/DynamicContent.d.ts.map +1 -0
  20. package/dist/componentModel/DynamicContent.es.js +14 -0
  21. package/dist/componentModel/DynamicContent.es.js.map +1 -0
  22. package/dist/componentModel/componentContext.d.ts +8 -0
  23. package/dist/componentModel/componentContext.d.ts.map +1 -0
  24. package/dist/componentModel/componentContext.es.js +77 -0
  25. package/dist/componentModel/componentContext.es.js.map +1 -0
  26. package/dist/componentModel/componentModel.d.ts +50 -33
  27. package/dist/componentModel/componentModel.d.ts.map +1 -1
  28. package/dist/componentModel/componentModel.es.js +243 -154
  29. package/dist/componentModel/componentModel.es.js.map +1 -1
  30. package/dist/componentModel/contracts.d.ts +22 -0
  31. package/dist/componentModel/contracts.d.ts.map +1 -0
  32. package/dist/componentModel/contracts.es.js +2 -0
  33. package/dist/componentModel/contracts.es.js.map +1 -0
  34. package/dist/dist/componentModel/componentContext.es.es.js +15 -0
  35. package/dist/dist/componentModel/componentContext.es.es.js.map +1 -0
  36. package/dist/dist/componentModel/componentModel.es.es.js +260 -0
  37. package/dist/dist/componentModel/componentModel.es.es.js.map +1 -0
  38. package/dist/dist/globals.es.es.js +10 -0
  39. package/dist/dist/globals.es.es.js.map +1 -0
  40. package/dist/dist/reactHooks.es.es.js +9 -0
  41. package/dist/dist/reactHooks.es.es.js.map +1 -0
  42. package/dist/net/client.es.js.map +1 -1
  43. package/dist/services/NavService.d.ts +17 -0
  44. package/dist/services/NavService.d.ts.map +1 -0
  45. package/dist/services/NavService.es.js +65 -0
  46. package/dist/services/NavService.es.js.map +1 -0
  47. package/dist/services/StorageService.d.ts +15 -0
  48. package/dist/services/StorageService.d.ts.map +1 -0
  49. package/dist/services/StorageService.es.js +54 -0
  50. package/dist/services/StorageService.es.js.map +1 -0
  51. package/package.json +4 -5
@@ -1,10 +1,13 @@
1
- import v, { useLayoutEffect as R, useEffect as F } from "react";
2
- import { observer as D } from "mobx-react-lite";
3
- import { observable as G, runInAction as S } from "mobx";
4
- import { useLazyRef as L } from "../reactHooks.es.js";
5
- import { getGlobalFlags as O } from "../globals.es.js";
6
- const I = Symbol("$isBinding");
7
- class B {
1
+ import P, { useLayoutEffect as G, useMemo as S, useEffect as U } from "react";
2
+ import { observer as z } from "mobx-react-lite";
3
+ import { observable as A, runInAction as L } from "mobx";
4
+ import { useLazyRef as M } from "../reactHooks.es.js";
5
+ import { getGlobalFlags as w } from "../globals.es.js";
6
+ import { useComponentContext as _, ReactComponentContext as p } from "./componentContext.es.js";
7
+ import { lazy as V } from "@actdim/utico/utils";
8
+ var Z = /* @__PURE__ */ ((e) => (e[e.None = 0] = "None", e[e.FromAncestors = 1] = "FromAncestors", e[e.FromDescendants = 2] = "FromDescendants", e))(Z || {});
9
+ const E = Symbol("$isBinding");
10
+ class H {
8
11
  // getter
9
12
  get;
10
13
  // setter
@@ -12,211 +15,297 @@ class B {
12
15
  converter;
13
16
  validator;
14
17
  readOnly;
15
- constructor(r, o, n, l) {
16
- this.get = r, this.set = o, this.converter = n, this.validator = l, this.readOnly = !!o, this[I] = !0;
18
+ constructor(t, o, n, r) {
19
+ this.get = t, this.set = o, this.converter = n, this.validator = r, this.readOnly = !!o, this[E] = !0;
17
20
  }
18
- [I];
21
+ [E];
19
22
  }
20
- function z(e) {
21
- return e[I] === !0;
23
+ function J(e) {
24
+ return e[E] === !0;
22
25
  }
23
- function Q(e, r, o, n) {
24
- return new B(e, r, o, n);
26
+ function ue(e, t, o, n) {
27
+ return new H(e, t, o, n);
25
28
  }
26
- function W(e, r) {
27
- return new B(
28
- () => e()[r],
29
+ function ae(e, t) {
30
+ return new H(
31
+ () => e()[t],
29
32
  (o) => {
30
- e()[r] = o;
33
+ e()[t] = o;
31
34
  }
32
35
  );
33
36
  }
34
- const A = "onGet", _ = "onChanging", M = "onChange";
35
- function H(e, r, o) {
36
- const n = o.onPropChanging, l = o.onPropChange;
37
+ const K = "onGet", T = "onChanging", q = "onChange";
38
+ function Q(e, t, o) {
39
+ const n = o.onPropChanging, r = o.onPropChange;
37
40
  return new Proxy(e, {
38
- get(i, g, c) {
39
- const y = o[g]?.onGet;
40
- if (y)
41
- return y();
42
- const h = r.get(String(g));
43
- if (h) {
44
- let b;
45
- return b = h.get(), b;
41
+ get(c, l, a) {
42
+ const h = o[l]?.onGet;
43
+ if (h)
44
+ return h();
45
+ const b = t.get(String(l));
46
+ if (b) {
47
+ let d;
48
+ return d = b.get(), d;
46
49
  }
47
- return Reflect.get(i, g, c);
50
+ return Reflect.get(c, l, a);
48
51
  },
49
- set(i, g, c, y) {
50
- const h = i[g], b = o[g]?.onChanging;
51
- if (b && !b(h, c) || n && !n(g, h, c))
52
+ set(c, l, a, h) {
53
+ const b = c[l], d = o[l]?.onChanging;
54
+ if (d && !d(b, a) || n && !n(l, b, a))
52
55
  return !0;
53
- const P = S(() => Reflect.set(i, g, c, y)), C = r.get(g);
54
- C?.set && C.set(c);
55
- const $ = o[g]?.onChange;
56
- return $ && $(c), l && l(g, c), P;
56
+ const k = L(() => Reflect.set(c, l, a, h)), g = t.get(l);
57
+ g?.set && g.set(a);
58
+ const f = o[l]?.onChange;
59
+ return f && f(a), r && r(l, a), k;
57
60
  }
58
61
  });
59
62
  }
60
- function k(e) {
63
+ function N(e) {
61
64
  return e.replace(/^./, e[0].toUpperCase());
62
65
  }
63
- const E = {
66
+ const D = {
64
67
  sources: /* @__PURE__ */ new Map(),
65
68
  count: 0
66
69
  };
67
- function V(e, r = 1) {
68
- return e.split(/[?#]/)[0].split("/").filter(Boolean).map((c) => decodeURIComponent(c)).slice(-r).join("-").normalize("NFKD").replace(/[^a-zA-Z0-9\-_:.+#]/g, "-").replace(/-+/g, "-").replace(/^[^a-zA-Z]+/, "-").replace(/[+#]$/, "-");
70
+ function W(e, t = 1) {
71
+ return e.split(/[?#]/)[0].split("/").filter(Boolean).map((a) => decodeURIComponent(a)).slice(-t).join("-").normalize("NFKD").replace(/[^a-zA-Z0-9\-_:.+#]/g, "-").replace(/-+/g, "-").replace(/^[^a-zA-Z]+/, "-").replace(/[+#]$/, "-");
69
72
  }
70
- function U(e = 2) {
73
+ function X(e = 2) {
71
74
  const o = new Error().stack?.split(`
72
75
  `);
73
76
  if (!o || o.length <= e) return null;
74
77
  const n = o[e].match(/\((.*):\d+:\d+\)/);
75
78
  return n ? n[1] : null;
76
79
  }
77
- function Z(e, r) {
78
- const o = e.msgBus, n = /* @__PURE__ */ new Map(), l = e.view;
79
- let i;
80
- const g = D((t) => {
80
+ function Y(e) {
81
+ const t = e?.msgBroker.provide;
82
+ if (t)
83
+ for (const [n, r] of Object.entries(t))
84
+ for (const [c, l] of Object.entries(r)) {
85
+ const a = l, h = a.callback;
86
+ h && (a.callback = (g, f) => h(g, f, e));
87
+ const b = a.filter, d = a.componentFilter || 0, k = (g) => {
88
+ let f = !0;
89
+ return d & 1 && (f = e.$.getChainUp().indexOf(g.headers?.sourceId) >= 0), f && d & 2 && (f = e.$.getChainDown().indexOf(g.headers?.sourceId) >= 0), f && b && (f = b(g, e)), f;
90
+ };
91
+ a.filter = k, e.msgBus.provide({
92
+ ...l,
93
+ channel: n,
94
+ group: c,
95
+ config: {
96
+ abortSignal: e.msgBroker.abortController.signal
97
+ }
98
+ });
99
+ }
100
+ const o = e?.msgBroker?.subscribe;
101
+ if (o)
102
+ for (const [n, r] of Object.entries(o))
103
+ for (const [c, l] of Object.entries(r)) {
104
+ const a = l, h = a.callback;
105
+ h && (a.callback = (g) => h(g, e));
106
+ const b = a.filter, d = a.componentFilter || 0, k = (g) => {
107
+ let f = !0;
108
+ return d & 1 && (f = e.$.getChainUp().indexOf(g.headers?.sourceId) >= 0), f && d & 2 && (f = e.$.getChainDown().indexOf(g.headers?.sourceId) >= 0), f && b && (f = b(g, e)), f;
109
+ };
110
+ a.filter = k, e.msgBus.on({
111
+ ...l,
112
+ channel: n,
113
+ group: c,
114
+ config: {
115
+ abortSignal: e.msgBroker.abortController.signal
116
+ }
117
+ });
118
+ }
119
+ }
120
+ function m(e, t) {
121
+ const o = (n) => {
122
+ n.headers || (n.headers = {}), n.headers.sourceId == null && (n.headers.sourceId = t.id);
123
+ };
124
+ return {
125
+ config: e.config,
126
+ on: (n) => e.on(n),
127
+ onceAsync: (n) => e.onceAsync(n),
128
+ stream: (n) => e.stream(n),
129
+ provide: (n) => (o(n), e.provide(n)),
130
+ dispatch: (n) => (o(n), e.dispatch(n)),
131
+ dispatchAsync: (n) => (o(n), e.dispatchAsync(n))
132
+ };
133
+ }
134
+ function ee(e, t) {
135
+ const o = /* @__PURE__ */ new Map(), n = e.view;
136
+ let r, c, l = e.msgBus;
137
+ const a = V(() => m(l, c));
138
+ let h = {
139
+ ...e.msgBroker
140
+ };
141
+ h.abortController || (h.abortController = new AbortController());
142
+ const b = z((s) => {
143
+ const i = c.id, u = _(), v = u.currentId;
144
+ c.parentId = v, l || (l = u.msgBus);
145
+ const y = S(
146
+ () => ({ ...u, currentId: i }),
147
+ [e, t, u]
148
+ );
149
+ G(() => {
150
+ try {
151
+ if (w().debug) {
152
+ const C = c.getHierarchyId;
153
+ console.debug(`${C}>layout`);
154
+ }
155
+ u.register(i, v), c.getHierarchyId = () => u.getHierarchyPath(i), c.getChainDown = () => u.getChainDown(i), c.getChainUp = () => u.getChainUp(i), c.getChildren = () => u.getChildren(i), c.getParent = () => u.getParent(i), c.getNodeMap = () => u.getNodeMap(), Y(r), e.events?.onLayout?.(r), t?.onLayout?.(r);
156
+ } catch (C) {
157
+ e.events?.onError?.(r, C), t?.onError?.(r, C);
158
+ }
159
+ return () => {
160
+ if (w().debug) {
161
+ const C = c.getHierarchyId;
162
+ console.debug(`${C}>layout-destroy`);
163
+ }
164
+ u.unregister(i), h.abortController.abort(), e.events?.onLayoutDestroy?.(r), t?.onLayoutDestroy?.(r);
165
+ };
166
+ }, [e, t, u]), U(() => {
167
+ try {
168
+ if (w().debug) {
169
+ const C = c.getHierarchyId;
170
+ console.debug(`${C}>ready`);
171
+ }
172
+ e.events?.onReady?.(r), t?.onReady?.(r);
173
+ } catch (C) {
174
+ if (w().debug) {
175
+ const B = c.getHierarchyId;
176
+ console.debug(`${B}>destroy`);
177
+ }
178
+ e.events?.onError?.(r, C), t?.onError?.(r, C);
179
+ }
180
+ return () => {
181
+ e.events?.onDestroy?.(r), t?.onDestroy?.(r);
182
+ };
183
+ }, [e, t, u]);
184
+ let I;
81
185
  try {
82
- return O().debug && console.debug(`${i.$.id}>view`), typeof l == "function" ? l(t, i) : /* @__PURE__ */ v.createElement(v.Fragment, null, t.children);
83
- } catch (s) {
84
- const u = JSON.stringify(s);
85
- return /* @__PURE__ */ v.createElement(v.Fragment, null, u);
86
- } finally {
186
+ if (w().debug) {
187
+ const C = c.getHierarchyId;
188
+ console.debug(`${C}>view`);
189
+ }
190
+ typeof n == "function" ? I = n(s, r) : I = /* @__PURE__ */ P.createElement(P.Fragment, null, s.children);
191
+ } catch (C) {
192
+ const B = JSON.stringify(C);
193
+ I = /* @__PURE__ */ P.createElement(P.Fragment, null, B);
87
194
  }
195
+ return /* @__PURE__ */ P.createElement(p.Provider, { value: y }, I);
88
196
  });
89
- let c;
90
- const y = E.sources, h = U(6), b = V(h, 2);
91
- y.has(h) ? (c = y.get(h), c.count++) : (c = {
92
- structId: e.name || b || `Component_${E.count}`,
197
+ let d;
198
+ const k = D.sources, g = X(6), f = W(g, 2);
199
+ k.has(g) ? (d = k.get(g), d.count++) : (d = {
200
+ structId: e.name || f || `Component_${D.count}`,
93
201
  count: 0
94
- }, y.set(h, c), E.count++);
95
- const P = `${c.structId}#${c.count}`;
96
- if (i = {
202
+ }, k.set(g, d), D.count++);
203
+ const $ = `${d.structId}#${d.count}`;
204
+ if (c = {
205
+ bindings: o,
206
+ id: $,
207
+ parentId: void 0,
208
+ getHierarchyId: () => {
209
+ },
210
+ getChainDown: () => {
211
+ },
212
+ getChainUp: () => {
213
+ },
214
+ getChildren: () => {
215
+ },
216
+ getParent: () => {
217
+ },
218
+ getNodeMap: () => {
219
+ }
220
+ }, r = {
97
221
  ...e.props,
98
222
  ...e.methods,
99
223
  // view: component.view,
100
- View: g,
101
- msgBus: o,
102
- $: {
103
- bindings: n,
104
- id: P
105
- }
224
+ View: b,
225
+ get msgBus() {
226
+ return a();
227
+ },
228
+ msgBroker: h,
229
+ $: c
106
230
  }, e.children)
107
- for (const [t, s] of Object.entries(e.children))
108
- if (typeof s == "function") {
109
- const u = s, d = (f) => {
110
- const a = u(f);
111
- return /* @__PURE__ */ v.createElement(a.View, null);
231
+ for (const [s, i] of Object.entries(e.children))
232
+ if (typeof i == "function") {
233
+ const u = i, v = (y) => {
234
+ const I = u(y);
235
+ return /* @__PURE__ */ P.createElement(I.View, null);
112
236
  };
113
- Reflect.set(i, k(t), d);
237
+ Reflect.set(r, N(s), v);
114
238
  } else
115
- Reflect.set(i, t, s);
116
- if (e.msgBroker) {
117
- const t = e.msgBroker.provide;
118
- if (t)
119
- for (const [u, d] of Object.entries(t))
120
- for (const [f, a] of Object.entries(d))
121
- o.provide({
122
- ...a,
123
- channel: u,
124
- group: f
125
- });
126
- const s = e.msgBroker.subscribe;
127
- if (s)
128
- for (const [u, d] of Object.entries(s))
129
- for (const [f, a] of Object.entries(d))
130
- o.on({
131
- ...a,
132
- channel: u,
133
- group: f
134
- });
135
- }
136
- for (const [t, s] of Object.entries(r))
137
- z(s) ? n.set(t, s) : Reflect.set(i, t, s);
138
- const C = {};
239
+ Reflect.set(r, s, i);
240
+ for (const [s, i] of Object.entries(t))
241
+ J(i) ? o.set(s, i) : Reflect.set(r, s, i);
242
+ const O = {};
139
243
  if (e.props)
140
- for (const t of Object.keys(e.props))
141
- C[t] = G.ref;
244
+ for (const s of Object.keys(e.props))
245
+ O[s] = A.ref;
142
246
  if (e.methods)
143
- for (const t of Object.keys(e.methods))
144
- C[t] = !1;
247
+ for (const s of Object.keys(e.methods))
248
+ O[s] = !1;
145
249
  if (e.children)
146
- for (const t of Object.keys(e.children))
147
- C[t] = !1;
148
- C.View = !1, C.msgBus = !1, C.$ = !1;
149
- const $ = {
150
- onPropChanging: r?.onPropChanging || e.events?.onPropChanging ? (t, s, u) => {
151
- let d = !0, f = r.onPropChanging;
152
- return f && (d = f(String(t), s, u)), d && (f = e.events?.onPropChanging, f && (d = f(String(t), s, u))), d;
250
+ for (const s of Object.keys(e.children))
251
+ O[s] = !1;
252
+ O.View = !1, O.msgBus = !1, O.$ = !1;
253
+ const F = {
254
+ onPropChanging: t?.onPropChanging || e.events?.onPropChanging ? (s, i, u) => {
255
+ let v = !0, y = t.onPropChanging;
256
+ return y && (v = y(String(s), i, u)), v && (y = e.events?.onPropChanging, y && (v = y(String(s), i, u))), v;
153
257
  } : void 0,
154
- onPropChange: r?.onPropChange || e.events?.onPropChange ? (t, s) => {
155
- r.onPropChange?.(String(t), s), e.events.onPropChange?.(String(t), s);
258
+ onPropChange: t?.onPropChange || e.events?.onPropChange ? (s, i) => {
259
+ t.onPropChange?.(String(s), i), e.events.onPropChange?.(String(s), i);
156
260
  } : void 0
157
261
  };
158
- function w(t) {
159
- const s = `${A}${k(t)}`;
160
- return r[s] || e.events?.[s];
262
+ function R(s) {
263
+ const i = `${K}${N(s)}`;
264
+ return t[i] || e.events?.[i];
161
265
  }
162
- function N(t) {
163
- const s = `${_}${k(t)}`;
164
- return ((u, d) => {
165
- let f = !0, a = r[s];
166
- return a && (f = a(u, d)), f && (a = e.events[s], a && (f = a(u, d))), f;
266
+ function j(s) {
267
+ const i = `${T}${N(s)}`;
268
+ return ((u, v) => {
269
+ let y = !0, I = t[i];
270
+ return I && (y = I(u, v)), y && (I = e.events[i], I && (y = I(u, v))), y;
167
271
  });
168
272
  }
169
- function j(t) {
170
- const s = `${M}${k(t)}`;
273
+ function x(s) {
274
+ const i = `${q}${N(s)}`;
171
275
  return ((u) => {
172
- r[s]?.(u), e.events[s]?.(u);
276
+ t[i]?.(u), e.events[i]?.(u);
173
277
  });
174
278
  }
175
279
  if (e.props)
176
- for (const t of Object.keys(e.props))
177
- $[t] = {
178
- onGet: w(t),
179
- onChanging: N(t),
180
- onChange: j(t)
280
+ for (const s of Object.keys(e.props))
281
+ F[s] = {
282
+ onGet: R(s),
283
+ onChanging: j(s),
284
+ onChange: x(s)
181
285
  };
182
- return i = G(i, C, {
286
+ return r = A(r, O, {
183
287
  deep: !0
184
- }), i = H(i, n, $), e.events?.onInit && e.events.onInit(i), r?.onInit && r.onInit(i), i;
288
+ }), r = Q(r, o, F), e.events?.onInit && e.events.onInit(r), t?.onInit && t.onInit(r), r;
185
289
  }
186
- function X(e, r) {
187
- const o = L(() => Z(e, r)), n = o.current;
188
- return R(() => {
189
- try {
190
- O().debug && console.debug(`${n.$.id}>layout`), e.events?.onLayout?.(n), r?.onLayout?.(n);
191
- } catch (l) {
192
- e.events?.onError?.(n, l), r?.onError?.(n, l);
193
- }
194
- return () => {
195
- O().debug && console.debug(`${n.$.id}>layout-destroy`), e.events?.onLayoutDestroy?.(n), r?.onLayoutDestroy?.(n), o.current = null;
196
- };
197
- }, []), F(() => {
198
- try {
199
- O().debug && console.debug(`${n.$.id}>ready`), e.events?.onReady?.(n), r?.onReady?.(n);
200
- } catch (l) {
201
- O().debug && console.debug(`${n.$.id}>destroy`), e.events?.onError?.(n, l), r?.onError?.(n, l);
202
- }
203
- return () => {
204
- e.events?.onDestroy?.(n), r?.onDestroy?.(n);
205
- };
206
- }, []), o.current;
290
+ function le(e, t) {
291
+ const o = M(() => ee(e, t));
292
+ return G(() => () => {
293
+ o.current = null;
294
+ }, [e, t]), o.current;
207
295
  }
208
- function Y(e) {
296
+ function fe(e) {
209
297
  return (o) => {
210
298
  const n = e(o);
211
- return /* @__PURE__ */ v.createElement(n.View, { ...o });
299
+ return /* @__PURE__ */ P.createElement(n.View, { ...o });
212
300
  };
213
301
  }
214
302
  export {
215
- Q as bind,
216
- W as bindProp,
217
- Y as getFC,
218
- z as isBinding,
219
- V as toHtmlId,
220
- X as useComponent
303
+ Z as ComponentMsgFilter,
304
+ ue as bind,
305
+ ae as bindProp,
306
+ fe as getFC,
307
+ J as isBinding,
308
+ W as toHtmlId,
309
+ le as useComponent
221
310
  };
222
311
  //# sourceMappingURL=componentModel.es.js.map