@actdim/dynstruct 1.0.3 → 1.0.7

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