@tachui/core 0.8.25 → 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.
- package/dist/assets/ColorAsset.d.ts +1 -0
- package/dist/assets/ColorAsset.d.ts.map +1 -1
- package/dist/assets/FontAsset.d.ts +3 -0
- package/dist/assets/FontAsset.d.ts.map +1 -1
- package/dist/assets/ImageAsset.d.ts.map +1 -1
- package/dist/assets/index.d.ts +1 -0
- package/dist/assets/index.d.ts.map +1 -1
- package/dist/assets/index.js +196 -132
- package/dist/assets/ssr-context.d.ts +8 -0
- package/dist/assets/ssr-context.d.ts.map +1 -0
- package/dist/{binding-DCr-JHsC.js → binding-DNl4QUbT.js} +1 -1
- package/dist/common.js +388 -386
- package/dist/{component-BzvSm8rM.js → component-DR1wgdPH.js} +66 -69
- package/dist/{component-context-C7Y6Xu6h.js → component-context-BB80qzyZ.js} +66 -44
- package/dist/components/index.js +1 -1
- package/dist/{concatenated-component-CA54ng_j.js → concatenated-component-DisxEqg6.js} +123 -113
- package/dist/essential.js +390 -388
- package/dist/{factory-B1YXfgU1.js → factory-C2LUc2BF.js} +2 -2
- package/dist/full.js +390 -388
- package/dist/{index-CmQmIgPK.js → index-B1zQAJuG.js} +91 -89
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +390 -388
- package/dist/minimal-prod.js +2 -2
- package/dist/minimal.js +4 -4
- package/dist/modifiers/base.d.ts +17 -0
- package/dist/modifiers/base.d.ts.map +1 -1
- package/dist/modifiers/base.js +97 -67
- package/dist/modifiers/builder.js +1 -1
- package/dist/modifiers/index.js +2 -2
- package/dist/modifiers/registry.js +1 -1
- package/dist/{observed-object-DCoyucmV.js → observed-object-gKl1Kk85.js} +1 -1
- package/dist/{optimization-D9t53vNJ.js → optimization-CnRxoggr.js} +1 -1
- package/dist/{proxy-B7ZIqGd0.js → proxy-B6FFddJq.js} +1 -1
- package/dist/runtime/component-context.d.ts +2 -0
- package/dist/runtime/component-context.d.ts.map +1 -1
- package/dist/runtime/component.d.ts.map +1 -1
- package/dist/runtime/dom-bridge.js +2 -2
- package/dist/runtime/index.js +4 -4
- package/dist/runtime/lazy-component.d.ts.map +1 -1
- package/dist/runtime/renderer.d.ts.map +1 -1
- package/dist/runtime/renderer.js +1 -1
- package/dist/state/index.js +5 -5
- package/dist/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { o as
|
|
1
|
+
import { o as _ } from "./cleanup-BR8UpYPX.js";
|
|
2
2
|
import { c as h } from "./effect-DgNm6jk9.js";
|
|
3
|
-
import { b as
|
|
4
|
-
import { c as
|
|
5
|
-
import { d as
|
|
6
|
-
var
|
|
7
|
-
class
|
|
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 =
|
|
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
|
|
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 =
|
|
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 (
|
|
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
|
|
209
|
-
return new
|
|
208
|
+
function z(n, e) {
|
|
209
|
+
return new v(n, e);
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function H(n) {
|
|
212
212
|
return new d(n);
|
|
213
213
|
}
|
|
214
|
-
function
|
|
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
|
|
217
|
+
function J(n) {
|
|
218
218
|
return new g(n);
|
|
219
219
|
}
|
|
220
|
-
const
|
|
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
|
-
},
|
|
261
|
-
var
|
|
262
|
-
const
|
|
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(
|
|
360
|
-
let
|
|
359
|
+
u(K, "instance");
|
|
360
|
+
let I = K;
|
|
361
361
|
function m(n, e = {}) {
|
|
362
362
|
const r = (t) => {
|
|
363
|
-
const o =
|
|
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
|
-
}),
|
|
367
|
-
let c,
|
|
368
|
-
const
|
|
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: () =>
|
|
371
|
-
if (e.lifecycle?.onMount && !
|
|
370
|
+
render: () => $(w, () => {
|
|
371
|
+
if (w.beginRenderPass(), e.lifecycle?.onMount && !M) {
|
|
372
372
|
const a = e.lifecycle.onMount();
|
|
373
|
-
typeof a == "function" &&
|
|
373
|
+
typeof a == "function" && C.push(a), M = !0;
|
|
374
374
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
e.lifecycle?.onUnmount && e.lifecycle.onUnmount(),
|
|
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 =
|
|
380
|
+
const a = P.getProps();
|
|
381
381
|
if (c && e.lifecycle?.onPropsChange) {
|
|
382
|
-
const y =
|
|
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 =
|
|
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 =
|
|
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:
|
|
399
|
-
children:
|
|
400
|
-
context:
|
|
401
|
-
cleanup:
|
|
402
|
-
id:
|
|
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,
|
|
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
|
|
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
|
|
424
|
+
function Z(n) {
|
|
428
425
|
return m(n, {
|
|
429
|
-
shouldUpdate: (e, r) => !
|
|
426
|
+
shouldUpdate: (e, r) => !x.shallowEqual(e, r)
|
|
430
427
|
});
|
|
431
428
|
}
|
|
432
|
-
function
|
|
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
|
|
449
|
+
function re(n, e = {}) {
|
|
453
450
|
return m((r, t) => {
|
|
454
|
-
const o = new
|
|
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
|
|
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:
|
|
466
|
+
id: U("fragment", r)
|
|
470
467
|
};
|
|
471
468
|
}
|
|
472
|
-
function
|
|
469
|
+
function ne(n = null) {
|
|
473
470
|
return g.createRef(n);
|
|
474
471
|
}
|
|
475
|
-
function
|
|
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
|
-
|
|
483
|
-
|
|
479
|
+
I as C,
|
|
480
|
+
v as P,
|
|
484
481
|
g as R,
|
|
485
482
|
m as a,
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
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
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
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
|
|
2
|
-
var
|
|
3
|
-
const
|
|
4
|
-
let
|
|
5
|
-
|
|
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
|
-
|
|
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
|
|
92
|
-
return new
|
|
101
|
+
function w(e, t) {
|
|
102
|
+
return new v(e, t);
|
|
93
103
|
}
|
|
94
|
-
function
|
|
95
|
-
if (
|
|
96
|
-
return
|
|
97
|
-
let e =
|
|
104
|
+
function h() {
|
|
105
|
+
if (i)
|
|
106
|
+
return i;
|
|
107
|
+
let e = l();
|
|
98
108
|
for (; e; ) {
|
|
99
|
-
if (e.context.has(
|
|
100
|
-
return e.context.get(
|
|
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
|
|
108
|
-
|
|
127
|
+
function E(e) {
|
|
128
|
+
i = e;
|
|
109
129
|
}
|
|
110
|
-
function
|
|
111
|
-
const n =
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
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
|
-
|
|
138
|
+
i === e && (i = n), r && (n ? r.context.set(c, n) : r.context.delete(c));
|
|
119
139
|
}
|
|
120
140
|
}
|
|
121
|
-
function
|
|
141
|
+
function y(e, t) {
|
|
122
142
|
return (n) => {
|
|
123
|
-
const
|
|
124
|
-
return
|
|
125
|
-
const s = e(n);
|
|
126
|
-
return s.context =
|
|
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
|
|
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
|
|
157
|
+
function M(e, t) {
|
|
138
158
|
p().provide(e.symbol, t);
|
|
139
159
|
}
|
|
140
|
-
function
|
|
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
|
|
151
|
-
getCurrentContext: () =>
|
|
170
|
+
const P = {
|
|
171
|
+
getCurrentContext: () => i,
|
|
152
172
|
getContextHierarchy: () => {
|
|
153
173
|
const e = [];
|
|
154
|
-
let t =
|
|
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 ||
|
|
180
|
+
const t = e || i;
|
|
161
181
|
return t ? t.getMetrics() : null;
|
|
162
182
|
}
|
|
163
183
|
};
|
|
164
184
|
export {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
a,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
194
|
+
M as p,
|
|
195
|
+
d as r,
|
|
196
|
+
E as s,
|
|
197
|
+
y as w
|
|
176
198
|
};
|
package/dist/components/index.js
CHANGED