@tachui/core 0.8.24 → 0.8.26

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/assets/ColorAsset.d.ts +1 -0
  2. package/dist/assets/ColorAsset.d.ts.map +1 -1
  3. package/dist/assets/FontAsset.d.ts +3 -0
  4. package/dist/assets/FontAsset.d.ts.map +1 -1
  5. package/dist/assets/ImageAsset.d.ts.map +1 -1
  6. package/dist/assets/index.d.ts +1 -0
  7. package/dist/assets/index.d.ts.map +1 -1
  8. package/dist/assets/index.js +196 -132
  9. package/dist/assets/ssr-context.d.ts +8 -0
  10. package/dist/assets/ssr-context.d.ts.map +1 -0
  11. package/dist/{binding-DCr-JHsC.js → binding-DNl4QUbT.js} +1 -1
  12. package/dist/common.js +388 -386
  13. package/dist/{component-BzvSm8rM.js → component-DR1wgdPH.js} +66 -69
  14. package/dist/{component-context-C7Y6Xu6h.js → component-context-BB80qzyZ.js} +66 -44
  15. package/dist/components/index.js +1 -1
  16. package/dist/{concatenated-component-CA54ng_j.js → concatenated-component-DisxEqg6.js} +123 -113
  17. package/dist/essential.js +390 -388
  18. package/dist/{factories-B05hE6kc.js → factories-Bz6LZlk6.js} +108 -99
  19. package/dist/{factory-B1YXfgU1.js → factory-C2LUc2BF.js} +2 -2
  20. package/dist/full.js +390 -388
  21. package/dist/{index-CmQmIgPK.js → index-B1zQAJuG.js} +91 -89
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +390 -388
  25. package/dist/minimal-prod.js +3 -3
  26. package/dist/minimal.js +5 -5
  27. package/dist/modifiers/base.d.ts +17 -0
  28. package/dist/modifiers/base.d.ts.map +1 -1
  29. package/dist/modifiers/base.js +169 -133
  30. package/dist/modifiers/builder.js +1 -1
  31. package/dist/modifiers/factories.d.ts.map +1 -1
  32. package/dist/modifiers/index.js +3 -3
  33. package/dist/modifiers/registry.js +1 -1
  34. package/dist/{observed-object-DCoyucmV.js → observed-object-gKl1Kk85.js} +1 -1
  35. package/dist/{optimization-D9t53vNJ.js → optimization-CnRxoggr.js} +1 -1
  36. package/dist/{proxy-B7ZIqGd0.js → proxy-B6FFddJq.js} +1 -1
  37. package/dist/runtime/component-context.d.ts +2 -0
  38. package/dist/runtime/component-context.d.ts.map +1 -1
  39. package/dist/runtime/component.d.ts.map +1 -1
  40. package/dist/runtime/dom-bridge.js +2 -2
  41. package/dist/runtime/index.js +4 -4
  42. package/dist/runtime/lazy-component.d.ts.map +1 -1
  43. package/dist/runtime/renderer.d.ts.map +1 -1
  44. package/dist/runtime/renderer.js +1 -1
  45. package/dist/state/index.js +5 -5
  46. package/dist/version.js +1 -1
  47. package/package.json +3 -3
@@ -1,12 +1,12 @@
1
- import { o as x } from "./cleanup-BR8UpYPX.js";
1
+ import { o as _ } from "./cleanup-BR8UpYPX.js";
2
2
  import { c as h } from "./effect-DgNm6jk9.js";
3
- import { b as _, r as K } from "./component-context-C7Y6Xu6h.js";
4
- import { c as $ } from "./computed-CA4Cgtoe.js";
5
- import { d as P } from "./signal-BRoiFOO7.js";
6
- var Q = Object.defineProperty, N = (n, e, r) => e in n ? Q(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r, p = (n, e, r) => N(n, typeof e != "symbol" ? e + "" : e, r);
7
- class b {
3
+ import { e as E, f as U, b as Q, r as $ } from "./component-context-BB80qzyZ.js";
4
+ import { c as O } from "./computed-CA4Cgtoe.js";
5
+ import { d as A } from "./signal-BRoiFOO7.js";
6
+ var j = Object.defineProperty, q = (n, e, r) => e in n ? j(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r, p = (n, e, r) => q(n, typeof e != "symbol" ? e + "" : e, r);
7
+ class v {
8
8
  constructor(e, r) {
9
- this.validator = r, p(this, "propsSignal"), p(this, "childrenSignal"), p(this, "changedKeys", /* @__PURE__ */ new Set()), this.propsSignal = P(this.validateAndMergeProps(e)), this.childrenSignal = P(e.children), h(() => {
9
+ this.validator = r, p(this, "propsSignal"), p(this, "childrenSignal"), p(this, "changedKeys", /* @__PURE__ */ new Set()), this.propsSignal = A(this.validateAndMergeProps(e)), this.childrenSignal = A(e.children), h(() => {
10
10
  const t = this.propsSignal[0]();
11
11
  this.trackChanges(t);
12
12
  });
@@ -48,7 +48,7 @@ class b {
48
48
  * Create reactive computed for a specific prop
49
49
  */
50
50
  createPropComputed(e) {
51
- return $(() => this.getProps()[e]);
51
+ return O(() => this.getProps()[e]);
52
52
  }
53
53
  /**
54
54
  * Create effect that runs when specific props change
@@ -84,7 +84,7 @@ class b {
84
84
  }
85
85
  class d {
86
86
  constructor(e = null) {
87
- p(this, "childrenSignal"), this.childrenSignal = P(e);
87
+ p(this, "childrenSignal"), this.childrenSignal = A(e);
88
88
  }
89
89
  /**
90
90
  * Get current children reactively
@@ -147,7 +147,7 @@ class d {
147
147
  Array.isArray(o) ? r.push(...o) : r.push(o);
148
148
  } else if (Array.isArray(t))
149
149
  r.push(...this.renderChildrenArray(t));
150
- else if (j(t)) {
150
+ else if (F(t)) {
151
151
  const i = t.build().render();
152
152
  Array.isArray(i) ? r.push(...i) : r.push(i);
153
153
  } else if (typeof t == "object" && t !== null && "render" in t) {
@@ -205,19 +205,19 @@ class g {
205
205
  };
206
206
  }
207
207
  }
208
- function G(n, e) {
209
- return new b(n, e);
208
+ function z(n, e) {
209
+ return new v(n, e);
210
210
  }
211
- function T(n) {
211
+ function H(n) {
212
212
  return new d(n);
213
213
  }
214
- function j(n) {
214
+ function F(n) {
215
215
  return typeof n != "object" || n === null || !("build" in n && typeof n.build == "function") ? !1 : !("render" in n && typeof n.render == "function");
216
216
  }
217
- function W(n) {
217
+ function J(n) {
218
218
  return new g(n);
219
219
  }
220
- const S = {
220
+ const x = {
221
221
  /**
222
222
  * Compare props for changes
223
223
  */
@@ -257,9 +257,9 @@ const S = {
257
257
  delete r[t];
258
258
  return r;
259
259
  }
260
- }, z = (n) => new d(n).renderChildren();
261
- var O = Object.defineProperty, q = (n, e, r) => e in n ? O(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r, u = (n, e, r) => q(n, typeof e != "symbol" ? e + "" : e, r);
262
- const E = class f {
260
+ }, X = (n) => new d(n).renderChildren();
261
+ var B = Object.defineProperty, k = (n, e, r) => e in n ? B(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r, u = (n, e, r) => k(n, typeof e != "symbol" ? e + "" : e, r);
262
+ const K = class f {
263
263
  constructor() {
264
264
  u(this, "components", /* @__PURE__ */ new Map()), u(this, "contexts", /* @__PURE__ */ new Map()), u(this, "cleanupQueue", /* @__PURE__ */ new Set()), u(this, "updateQueue", /* @__PURE__ */ new Set()), u(this, "isUpdating", !1);
265
265
  }
@@ -356,61 +356,58 @@ const E = class f {
356
356
  }), this.cleanupQueue.clear(), this.updateQueue.clear();
357
357
  }
358
358
  };
359
- u(E, "instance");
360
- let F = E;
359
+ u(K, "instance");
360
+ let I = K;
361
361
  function m(n, e = {}) {
362
362
  const r = (t) => {
363
- const o = R(), i = F.getInstance(), s = [], l = _(o), C = new b(t, {
363
+ const o = E() || void 0, i = e.displayName || n.name || "unknown", s = U(i, o), l = I.getInstance(), C = [], w = Q(s, o), P = new v(t, {
364
364
  defaults: e.defaultProps || void 0,
365
365
  ...e.validation
366
- }), w = new d(t.children), U = new g();
367
- let c, A = !1, v = !1;
368
- const M = {
366
+ }), b = new d(t.children), N = new g();
367
+ let c, M = !1, R = !1;
368
+ const S = {
369
369
  type: "component",
370
- render: () => K(l, () => {
371
- if (e.lifecycle?.onMount && !A) {
370
+ render: () => $(w, () => {
371
+ if (w.beginRenderPass(), e.lifecycle?.onMount && !M) {
372
372
  const a = e.lifecycle.onMount();
373
- typeof a == "function" && s.push(a), A = !0;
373
+ typeof a == "function" && C.push(a), M = !0;
374
374
  }
375
- v || (v = !0, h(() => {
376
- x(() => {
377
- e.lifecycle?.onUnmount && e.lifecycle.onUnmount(), s.forEach((a) => a()), i.unregisterComponent(o);
375
+ R || (R = !0, h(() => {
376
+ _(() => {
377
+ e.lifecycle?.onUnmount && e.lifecycle.onUnmount(), C.forEach((a) => a()), l.unregisterComponent(s);
378
378
  });
379
379
  })), h(() => {
380
- const a = C.getProps();
380
+ const a = P.getProps();
381
381
  if (c && e.lifecycle?.onPropsChange) {
382
- const y = S.compareProps(c, a);
382
+ const y = x.compareProps(c, a);
383
383
  y.length > 0 && e.lifecycle.onPropsChange(c, a, y);
384
384
  }
385
385
  c && e.lifecycle?.onUpdate && e.lifecycle.onUpdate(c, a), c = { ...a };
386
386
  }), h(() => {
387
- const a = w.getChildren();
387
+ const a = b.getChildren();
388
388
  e.lifecycle?.onChildrenChange && c && e.lifecycle.onChildrenChange(c.children, a);
389
389
  });
390
390
  try {
391
391
  e.lifecycle?.onRender && e.lifecycle.onRender();
392
- const a = C.getProps(), y = w.getChildren();
392
+ const a = P.getProps(), y = b.getChildren();
393
393
  return c && e.shouldUpdate && !e.shouldUpdate(c, a) ? [] : n(a, y);
394
394
  } catch (a) {
395
395
  throw e.lifecycle?.onError && e.lifecycle.onError(a), a;
396
396
  }
397
397
  }),
398
- props: C.getProps(),
399
- children: w.getChildren(),
400
- context: l,
401
- cleanup: s,
402
- id: o,
398
+ props: P.getProps(),
399
+ children: b.getChildren(),
400
+ context: w,
401
+ cleanup: C,
402
+ id: s,
403
403
  ref: t.ref,
404
404
  mounted: !1
405
405
  };
406
- return t.ref && g.applyRef(t.ref, U.getRef()), i.registerComponent(M), M;
406
+ return t.ref && g.applyRef(t.ref, N.getRef()), l.registerComponent(S), S;
407
407
  };
408
408
  return e.displayName && (r.displayName = e.displayName), e.defaultProps && (r.defaultProps = e.defaultProps), r;
409
409
  }
410
- function R() {
411
- return `component_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
412
- }
413
- function H(n, e) {
410
+ function Y(n, e) {
414
411
  const r = (t) => {
415
412
  const o = n(t), i = o.cleanup || [], s = [];
416
413
  if (e.onMount) {
@@ -424,12 +421,12 @@ function H(n, e) {
424
421
  };
425
422
  return r.displayName = `withLifecycle(${n.displayName || "Component"})`, r;
426
423
  }
427
- function J(n) {
424
+ function Z(n) {
428
425
  return m(n, {
429
- shouldUpdate: (e, r) => !S.shallowEqual(e, r)
426
+ shouldUpdate: (e, r) => !x.shallowEqual(e, r)
430
427
  });
431
428
  }
432
- function X(n) {
429
+ function ee(n) {
433
430
  return m(
434
431
  (e, r) => {
435
432
  const t = new d(r || e.children);
@@ -449,9 +446,9 @@ function X(n) {
449
446
  }
450
447
  );
451
448
  }
452
- function Y(n, e = {}) {
449
+ function re(n, e = {}) {
453
450
  return m((r, t) => {
454
- const o = new b(r, e.validation), i = new d(t || r.children), s = new g();
451
+ const o = new v(r, e.validation), i = new d(t || r.children), s = new g();
455
452
  return n(r, t || r.children, {
456
453
  propsManager: o,
457
454
  childrenManager: i,
@@ -459,41 +456,41 @@ function Y(n, e = {}) {
459
456
  });
460
457
  }, e);
461
458
  }
462
- function Z(n) {
463
- const e = new d(n);
459
+ function te(n) {
460
+ const e = new d(n), r = E() || void 0;
464
461
  return {
465
462
  type: "component",
466
463
  render: () => e.renderChildren(),
467
464
  props: { children: n },
468
465
  children: n,
469
- id: R()
466
+ id: U("fragment", r)
470
467
  };
471
468
  }
472
- function ee(n = null) {
469
+ function ne(n = null) {
473
470
  return g.createRef(n);
474
471
  }
475
- function re(n) {
472
+ function oe(n) {
476
473
  return m((e) => {
477
474
  const { ref: r, ...t } = e;
478
475
  return n(t, r || void 0);
479
476
  });
480
477
  }
481
478
  export {
482
- F as C,
483
- b as P,
479
+ I as C,
480
+ v as P,
484
481
  g as R,
485
482
  m as a,
486
- Z as b,
487
- Y as c,
488
- J as d,
489
- ee as e,
490
- re as f,
483
+ te as b,
484
+ re as c,
485
+ Z as d,
486
+ ne as e,
487
+ oe as f,
491
488
  d as g,
492
- T as h,
493
- G as i,
494
- W as j,
495
- z as k,
496
- X as l,
497
- S as p,
498
- H as w
489
+ H as h,
490
+ z as i,
491
+ J as j,
492
+ X as k,
493
+ ee as l,
494
+ x as p,
495
+ Y as w
499
496
  };
@@ -1,10 +1,20 @@
1
- import { j as u } from "./signal-BRoiFOO7.js";
2
- var d = Object.defineProperty, l = (e, t, n) => t in e ? d(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, r = (e, t, n) => l(e, typeof t != "symbol" ? t + "" : t, n);
3
- const a = Symbol("TachUI.ComponentContext"), v = Symbol("TachUI.Environment");
4
- let o = null;
5
- class m {
1
+ import { j as l } from "./signal-BRoiFOO7.js";
2
+ var x = Object.defineProperty, f = (e, t, n) => t in e ? x(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, o = (e, t, n) => f(e, typeof t != "symbol" ? t + "" : t, n);
3
+ const c = Symbol("TachUI.ComponentContext"), I = Symbol("TachUI.Environment");
4
+ let i = null;
5
+ function g(e) {
6
+ return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "unknown";
7
+ }
8
+ class v {
6
9
  constructor(t, n) {
7
- r(this, "id"), r(this, "parent"), r(this, "providers", /* @__PURE__ */ new Map()), r(this, "consumers", /* @__PURE__ */ new Set()), r(this, "cleanup", /* @__PURE__ */ new Set()), r(this, "stateStore", /* @__PURE__ */ new Map()), r(this, "bindingStore", /* @__PURE__ */ new Map()), r(this, "createdAt", Date.now()), r(this, "updateCount", 0), this.id = t, this.parent = n;
10
+ o(this, "id"), o(this, "parent"), o(this, "providers", /* @__PURE__ */ new Map()), o(this, "consumers", /* @__PURE__ */ new Set()), o(this, "cleanup", /* @__PURE__ */ new Set()), o(this, "stateStore", /* @__PURE__ */ new Map()), o(this, "bindingStore", /* @__PURE__ */ new Map()), o(this, "nextChildIndex", 0), o(this, "createdAt", Date.now()), o(this, "updateCount", 0), this.id = t, this.parent = n;
11
+ }
12
+ beginRenderPass() {
13
+ this.nextChildIndex = 0;
14
+ }
15
+ allocateChildIndex() {
16
+ const t = this.nextChildIndex;
17
+ return this.nextChildIndex += 1, t;
8
18
  }
9
19
  /**
10
20
  * Store state value for a property
@@ -88,56 +98,66 @@ class m {
88
98
  };
89
99
  }
90
100
  }
91
- function C(e, t) {
92
- return new m(e, t);
101
+ function w(e, t) {
102
+ return new v(e, t);
93
103
  }
94
- function p() {
95
- if (o)
96
- return o;
97
- let e = u();
104
+ function h() {
105
+ if (i)
106
+ return i;
107
+ let e = l();
98
108
  for (; e; ) {
99
- if (e.context.has(a))
100
- return e.context.get(a);
109
+ if (e.context.has(c))
110
+ return e.context.get(c);
101
111
  e = e.parent;
102
112
  }
113
+ return null;
114
+ }
115
+ function S(e, t) {
116
+ const n = t?.id || "app", r = t?.allocateChildIndex() ?? 0;
117
+ return `${n}:${g(e)}:${r}`;
118
+ }
119
+ function p() {
120
+ const e = h();
121
+ if (e)
122
+ return e;
103
123
  throw new Error(
104
124
  "@State can only be used within a component context. Make sure you are using @State inside a TachUI component render function."
105
125
  );
106
126
  }
107
- function g(e) {
108
- o = e;
127
+ function E(e) {
128
+ i = e;
109
129
  }
110
- function f(e, t) {
111
- const n = o;
112
- o = e;
113
- const i = u();
114
- i && i.context.set(a, e);
130
+ function d(e, t) {
131
+ const n = i;
132
+ i = e;
133
+ const r = l();
134
+ r && r.context.set(c, e);
115
135
  try {
116
136
  return t();
117
137
  } finally {
118
- o === e && (o = n), i && (n ? i.context.set(a, n) : i.context.delete(a));
138
+ i === e && (i = n), r && (n ? r.context.set(c, n) : r.context.delete(c));
119
139
  }
120
140
  }
121
- function S(e, t) {
141
+ function y(e, t) {
122
142
  return (n) => {
123
- const i = t || `component-${Math.random().toString(36).substr(2, 9)}`, c = C(i, o || void 0);
124
- return f(c, () => {
125
- const s = e(n);
126
- return s.context = c, s.cleanup || (s.cleanup = []), s.cleanup.push(() => c.dispose()), s;
143
+ const r = h() || void 0, u = e.displayName || e.name || "unknown", m = t || S(u, r), a = w(m, r);
144
+ return a.beginRenderPass(), d(a, () => {
145
+ const s = e(n), C = s.render.bind(s);
146
+ return s.render = () => d(a, () => (a.beginRenderPass(), C())), s.context = a, s.cleanup || (s.cleanup = []), s.cleanup.push(() => a.dispose()), s;
127
147
  });
128
148
  };
129
149
  }
130
- function w(e, t) {
150
+ function z(e, t) {
131
151
  return {
132
152
  symbol: Symbol(`Environment.${e}`),
133
153
  defaultValue: t,
134
154
  name: e
135
155
  };
136
156
  }
137
- function b(e, t) {
157
+ function M(e, t) {
138
158
  p().provide(e.symbol, t);
139
159
  }
140
- function E(e) {
160
+ function $(e) {
141
161
  const n = p().consume(e.symbol);
142
162
  if (n !== void 0)
143
163
  return n;
@@ -147,30 +167,32 @@ function E(e) {
147
167
  `Environment value for '${e.name}' not found. Make sure to provide this value higher in the component hierarchy.`
148
168
  );
149
169
  }
150
- const y = {
151
- getCurrentContext: () => o,
170
+ const P = {
171
+ getCurrentContext: () => i,
152
172
  getContextHierarchy: () => {
153
173
  const e = [];
154
- let t = o || void 0;
174
+ let t = i || void 0;
155
175
  for (; t; )
156
176
  e.push(t), t = t.parent;
157
177
  return e;
158
178
  },
159
179
  getContextMetrics: (e) => {
160
- const t = e || o;
180
+ const t = e || i;
161
181
  return t ? t.getMetrics() : null;
162
182
  }
163
183
  };
164
184
  export {
165
- y as C,
166
- v as E,
167
- a,
168
- C as b,
169
- E as c,
170
- w as d,
185
+ P as C,
186
+ I as E,
187
+ c as a,
188
+ w as b,
189
+ $ as c,
190
+ z as d,
191
+ h as e,
192
+ S as f,
171
193
  p as g,
172
- b as p,
173
- f as r,
174
- g as s,
175
- S as w
194
+ M as p,
195
+ d as r,
196
+ E as s,
197
+ y as w
176
198
  };
@@ -1,4 +1,4 @@
1
- import { h as o, L as t, g as r, b as n, d as p, w as s, e as i, f as c } from "../factory-B1YXfgU1.js";
1
+ import { h as o, L as t, g as r, b as n, d as p, w as s, e as i, f as c } from "../factory-C2LUc2BF.js";
2
2
  export {
3
3
  o as Layout,
4
4
  t as LayoutComponent,