@tachui/core 0.8.1-alpha → 0.8.5-alpha
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 +40 -2
- package/dist/assets/AssetCollection.d.ts.map +1 -1
- package/dist/assets/ColorAsset.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 +486 -0
- package/dist/assets/types.d.ts +8 -68
- package/dist/assets/types.d.ts.map +1 -1
- package/dist/binding-CYpEQquE.js +308 -0
- package/dist/build-plugins/index.d.ts +3 -0
- package/dist/build-plugins/index.d.ts.map +1 -0
- package/dist/build-plugins/modifier-types.d.ts +12 -0
- package/dist/build-plugins/modifier-types.d.ts.map +1 -0
- package/dist/build-tools/typegen-runner.d.ts +29 -0
- package/dist/build-tools/typegen-runner.d.ts.map +1 -0
- package/dist/bundles/minimal.d.ts +2 -0
- package/dist/bundles/minimal.d.ts.map +1 -1
- package/dist/common.js +427 -394
- package/dist/{component-XAzF1xqs.js → component-CECyfUOE.js} +80 -68
- package/dist/{component-base-x2XmHFjy.js → component-base-CJ__jTlr.js} +9 -7
- package/dist/component-context-B6qX_Qsg.js +176 -0
- package/dist/components/factory.d.ts +24 -0
- package/dist/components/factory.d.ts.map +1 -0
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +8 -6
- package/dist/components/wrapper.d.ts +70 -30
- package/dist/components/wrapper.d.ts.map +1 -1
- package/dist/concatenated-component-_tF1eMvy.js +2288 -0
- package/dist/concatenation/concatenated-component.d.ts +16 -2
- package/dist/concatenation/concatenated-component.d.ts.map +1 -1
- package/dist/concatenation/text-optimizer.d.ts.map +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/constants/layout.d.ts +2 -9
- package/dist/constants/layout.d.ts.map +1 -1
- package/dist/css-classes/index.js +15 -173
- package/dist/{effect-B9Knft0b.js → effect-DGmdACI2.js} +3 -3
- package/dist/enhanced-renderer-Bwqsh8Ku.js +172 -0
- package/dist/essential.js +427 -394
- package/dist/{index-DIvMCJQO.js → factories-Co2Lv2kJ.js} +13 -13
- package/dist/factory-D7jAY5Kn.js +485 -0
- package/dist/gradients/css-generator.js +99 -0
- package/dist/gradients/index.js +56 -0
- package/dist/gradients/reactive.d.ts.map +1 -1
- package/dist/gradients/types.d.ts +3 -91
- package/dist/gradients/types.d.ts.map +1 -1
- package/dist/hooks-DeLasj54.js +446 -0
- package/dist/index-JQ1sW1SK.js +2049 -0
- package/dist/index-X8MVY78C.js +618 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +427 -394
- package/dist/minimal-prod.js +94 -93
- package/dist/minimal.js +114 -108
- package/dist/modifiers/alignment.d.ts +5 -0
- package/dist/modifiers/alignment.d.ts.map +1 -0
- package/dist/modifiers/base.d.ts +6 -7
- package/dist/modifiers/base.d.ts.map +1 -1
- package/dist/modifiers/base.js +24 -16
- package/dist/modifiers/builder.d.ts +28 -165
- package/dist/modifiers/builder.d.ts.map +1 -1
- package/dist/modifiers/builder.js +7 -7
- package/dist/modifiers/core.d.ts +0 -1
- package/dist/modifiers/core.d.ts.map +1 -1
- package/dist/modifiers/corner-radius.d.ts +8 -0
- package/dist/modifiers/corner-radius.d.ts.map +1 -0
- package/dist/modifiers/index.d.ts +9 -6
- package/dist/modifiers/index.d.ts.map +1 -1
- package/dist/modifiers/index.js +36 -30
- package/dist/modifiers/layout-priority.d.ts +8 -0
- package/dist/modifiers/layout-priority.d.ts.map +1 -0
- package/dist/modifiers/opacity.d.ts +8 -0
- package/dist/modifiers/opacity.d.ts.map +1 -0
- package/dist/modifiers/presets.d.ts.map +1 -1
- package/dist/modifiers/proxy.d.ts +4 -0
- package/dist/modifiers/proxy.d.ts.map +1 -0
- package/dist/modifiers/registration-utils.d.ts +7 -0
- package/dist/modifiers/registration-utils.d.ts.map +1 -0
- package/dist/modifiers/registry.d.ts +18 -9
- package/dist/modifiers/registry.d.ts.map +1 -1
- package/dist/modifiers/registry.js +2 -2
- package/dist/modifiers/type-generator.d.ts +82 -0
- package/dist/modifiers/type-generator.d.ts.map +1 -0
- package/dist/modifiers/types.d.ts +2 -479
- package/dist/modifiers/types.d.ts.map +1 -1
- package/dist/modifiers/types.js +1 -4
- package/dist/{observed-object-Cos-FtjP.js → observed-object-DepiqSgg.js} +3 -3
- package/dist/optimization-CbKNA9w4.js +21 -0
- package/dist/plugins/index.js +28 -8
- package/dist/plugins/simplified-lazy-loader.d.ts.map +1 -1
- package/dist/presets-B9x94uRn.js +381 -0
- package/dist/proxy-Cqmbiyx0.js +175 -0
- package/dist/reactive/cleanup.d.ts.map +1 -1
- package/dist/reactive/computed.d.ts +1 -1
- package/dist/reactive/computed.d.ts.map +1 -1
- package/dist/reactive/context.d.ts +4 -3
- package/dist/reactive/context.d.ts.map +1 -1
- package/dist/reactive/index.d.ts +1 -0
- package/dist/reactive/index.d.ts.map +1 -1
- package/dist/reactive/index.js +84 -490
- package/dist/reactive/signal-list.d.ts +100 -0
- package/dist/reactive/signal-list.d.ts.map +1 -0
- package/dist/reactive/signal.d.ts.map +1 -1
- package/dist/reactive/types.d.ts +2 -89
- package/dist/reactive/types.d.ts.map +1 -1
- package/dist/reactive/types.js +1 -4
- package/dist/registration-utils-CNsN4eoU.js +27 -0
- package/dist/runtime/component.d.ts.map +1 -1
- package/dist/runtime/concatenation-aria.d.ts.map +1 -1
- package/dist/runtime/concatenation-aria.js +18 -13
- package/dist/runtime/concatenation-full.d.ts.map +1 -1
- package/dist/runtime/concatenation-full.js +42 -34
- package/dist/runtime/concatenation-minimal.d.ts.map +1 -1
- package/dist/runtime/concatenation-minimal.js +13 -8
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/dom-bridge.d.ts +1 -1
- package/dist/runtime/dom-bridge.d.ts.map +1 -1
- package/dist/runtime/dom-bridge.js +239 -12
- package/dist/runtime/event-delegation.d.ts +59 -0
- package/dist/runtime/event-delegation.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +3 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +96 -0
- package/dist/runtime/layout-scheduler.d.ts +89 -0
- package/dist/runtime/layout-scheduler.d.ts.map +1 -0
- package/dist/runtime/props.d.ts.map +1 -1
- package/dist/runtime/renderer.d.ts +54 -2
- package/dist/runtime/renderer.d.ts.map +1 -1
- package/dist/runtime/renderer.js +11 -7
- package/dist/runtime/semantic-role-manager.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +2 -226
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/types.js +1 -1
- package/dist/scheduler-DI_8ykMk.js +169 -0
- package/dist/signal-list-BdpxSodS.js +525 -0
- package/dist/state/index.js +319 -0
- package/dist/theme-BFaKUcjZ.js +677 -0
- package/dist/utils/clone-helpers.d.ts +11 -0
- package/dist/utils/clone-helpers.d.ts.map +1 -0
- package/dist/validation/index.js +28 -26
- package/dist/version.d.ts +19 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/package.json +51 -11
- package/dist/concatenated-component-ByPl3_FF.js +0 -2933
- package/dist/dom-bridge-CAa1N2zX.js +0 -406
- package/dist/index-DEBd8cq7.js +0 -1144
- package/dist/index-vdsiw6gQ.js +0 -777
- package/dist/modifiers/as-html-validator.d.ts +0 -20
- package/dist/modifiers/as-html-validator.d.ts.map +0 -1
- package/dist/modifiers/as-html.d.ts +0 -65
- package/dist/modifiers/as-html.d.ts.map +0 -1
- package/dist/modifiers/background.d.ts +0 -51
- package/dist/modifiers/background.d.ts.map +0 -1
- package/dist/modifiers/basic-sanitizer.d.ts +0 -54
- package/dist/modifiers/basic-sanitizer.d.ts.map +0 -1
- package/dist/modifiers/css.d.ts +0 -86
- package/dist/modifiers/css.d.ts.map +0 -1
- package/dist/production-minimal-BY_gMc-l.js +0 -2532
- package/dist/scheduler-BKeqwrYE.js +0 -814
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { o as x } from "./scheduler-DI_8ykMk.js";
|
|
2
|
+
import { c as P, a as _ } from "./theme-BFaKUcjZ.js";
|
|
3
|
+
import "@tachui/types/reactive";
|
|
4
|
+
import { c as h } from "./effect-DGmdACI2.js";
|
|
5
|
+
import { b as K, r as $ } from "./component-context-B6qX_Qsg.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 {
|
|
6
8
|
constructor(e, r) {
|
|
7
|
-
this.validator = 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(() => {
|
|
8
10
|
const t = this.propsSignal[0]();
|
|
9
11
|
this.trackChanges(t);
|
|
10
12
|
});
|
|
@@ -46,13 +48,13 @@ class v {
|
|
|
46
48
|
* Create reactive computed for a specific prop
|
|
47
49
|
*/
|
|
48
50
|
createPropComputed(e) {
|
|
49
|
-
return
|
|
51
|
+
return _(() => this.getProps()[e]);
|
|
50
52
|
}
|
|
51
53
|
/**
|
|
52
54
|
* Create effect that runs when specific props change
|
|
53
55
|
*/
|
|
54
56
|
createPropsEffect(e, r) {
|
|
55
|
-
const t =
|
|
57
|
+
const t = h(() => {
|
|
56
58
|
const o = this.getProps(), i = this.getChangedKeys();
|
|
57
59
|
(i.length === 0 || e.some((l) => i.includes(l))) && r(
|
|
58
60
|
o,
|
|
@@ -82,7 +84,7 @@ class v {
|
|
|
82
84
|
}
|
|
83
85
|
class d {
|
|
84
86
|
constructor(e = null) {
|
|
85
|
-
|
|
87
|
+
p(this, "childrenSignal"), this.childrenSignal = P(e);
|
|
86
88
|
}
|
|
87
89
|
/**
|
|
88
90
|
* Get current children reactively
|
|
@@ -145,18 +147,23 @@ class d {
|
|
|
145
147
|
Array.isArray(o) ? r.push(...o) : r.push(o);
|
|
146
148
|
} else if (Array.isArray(t))
|
|
147
149
|
r.push(...this.renderChildrenArray(t));
|
|
148
|
-
else if (
|
|
149
|
-
const
|
|
150
|
-
Array.isArray(
|
|
150
|
+
else if (j(t)) {
|
|
151
|
+
const i = t.build().render();
|
|
152
|
+
Array.isArray(i) ? r.push(...i) : r.push(i);
|
|
153
|
+
} else if (typeof t == "object" && t !== null && "render" in t) {
|
|
154
|
+
let o = t;
|
|
155
|
+
"build" in t && typeof t.build == "function" && (o = t.build());
|
|
156
|
+
const i = o.render();
|
|
157
|
+
Array.isArray(i) ? r.push(...i) : r.push(i);
|
|
151
158
|
}
|
|
152
159
|
}
|
|
153
160
|
}
|
|
154
161
|
return r;
|
|
155
162
|
}
|
|
156
163
|
}
|
|
157
|
-
class
|
|
164
|
+
class g {
|
|
158
165
|
constructor(e = null) {
|
|
159
|
-
|
|
166
|
+
p(this, "ref"), this.ref = { current: e };
|
|
160
167
|
}
|
|
161
168
|
/**
|
|
162
169
|
* Get the ref object
|
|
@@ -198,16 +205,19 @@ class p {
|
|
|
198
205
|
};
|
|
199
206
|
}
|
|
200
207
|
}
|
|
201
|
-
function
|
|
202
|
-
return new
|
|
208
|
+
function G(n, e) {
|
|
209
|
+
return new b(n, e);
|
|
203
210
|
}
|
|
204
|
-
function
|
|
211
|
+
function T(n) {
|
|
205
212
|
return new d(n);
|
|
206
213
|
}
|
|
207
|
-
function
|
|
208
|
-
return
|
|
214
|
+
function j(n) {
|
|
215
|
+
return typeof n != "object" || n === null || !("build" in n && typeof n.build == "function") ? !1 : !("render" in n && typeof n.render == "function");
|
|
216
|
+
}
|
|
217
|
+
function W(n) {
|
|
218
|
+
return new g(n);
|
|
209
219
|
}
|
|
210
|
-
const
|
|
220
|
+
const S = {
|
|
211
221
|
/**
|
|
212
222
|
* Compare props for changes
|
|
213
223
|
*/
|
|
@@ -247,14 +257,14 @@ const b = {
|
|
|
247
257
|
delete r[t];
|
|
248
258
|
return r;
|
|
249
259
|
}
|
|
250
|
-
},
|
|
251
|
-
var
|
|
252
|
-
const
|
|
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 {
|
|
253
263
|
constructor() {
|
|
254
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);
|
|
255
265
|
}
|
|
256
266
|
static getInstance() {
|
|
257
|
-
return
|
|
267
|
+
return f.instance || (f.instance = new f()), f.instance;
|
|
258
268
|
}
|
|
259
269
|
/**
|
|
260
270
|
* Register a new component instance
|
|
@@ -346,43 +356,45 @@ const S = class h {
|
|
|
346
356
|
}), this.cleanupQueue.clear(), this.updateQueue.clear();
|
|
347
357
|
}
|
|
348
358
|
};
|
|
349
|
-
u(
|
|
350
|
-
let
|
|
359
|
+
u(E, "instance");
|
|
360
|
+
let F = E;
|
|
351
361
|
function m(n, e = {}) {
|
|
352
362
|
const r = (t) => {
|
|
353
|
-
const o =
|
|
363
|
+
const o = R(), i = F.getInstance(), s = [], l = K(o), C = new b(t, {
|
|
354
364
|
defaults: e.defaultProps || void 0,
|
|
355
365
|
...e.validation
|
|
356
|
-
}), w = new d(t.children), U = new
|
|
357
|
-
let c, A = !1;
|
|
366
|
+
}), w = new d(t.children), U = new g();
|
|
367
|
+
let c, A = !1, v = !1;
|
|
358
368
|
const M = {
|
|
359
369
|
type: "component",
|
|
360
|
-
render: () => {
|
|
370
|
+
render: () => $(l, () => {
|
|
361
371
|
if (e.lifecycle?.onMount && !A) {
|
|
362
372
|
const a = e.lifecycle.onMount();
|
|
363
373
|
typeof a == "function" && s.push(a), A = !0;
|
|
364
374
|
}
|
|
365
|
-
|
|
375
|
+
v || (v = !0, h(() => {
|
|
376
|
+
x(() => {
|
|
377
|
+
e.lifecycle?.onUnmount && e.lifecycle.onUnmount(), s.forEach((a) => a()), i.unregisterComponent(o);
|
|
378
|
+
});
|
|
379
|
+
})), h(() => {
|
|
366
380
|
const a = C.getProps();
|
|
367
381
|
if (c && e.lifecycle?.onPropsChange) {
|
|
368
|
-
const
|
|
369
|
-
|
|
382
|
+
const y = S.compareProps(c, a);
|
|
383
|
+
y.length > 0 && e.lifecycle.onPropsChange(c, a, y);
|
|
370
384
|
}
|
|
371
385
|
c && e.lifecycle?.onUpdate && e.lifecycle.onUpdate(c, a), c = { ...a };
|
|
372
|
-
}),
|
|
386
|
+
}), h(() => {
|
|
373
387
|
const a = w.getChildren();
|
|
374
388
|
e.lifecycle?.onChildrenChange && c && e.lifecycle.onChildrenChange(c.children, a);
|
|
375
|
-
}), _(() => {
|
|
376
|
-
e.lifecycle?.onUnmount && e.lifecycle.onUnmount(), s.forEach((a) => a()), i.unregisterComponent(o);
|
|
377
389
|
});
|
|
378
390
|
try {
|
|
379
391
|
e.lifecycle?.onRender && e.lifecycle.onRender();
|
|
380
|
-
const a = C.getProps(),
|
|
381
|
-
return c && e.shouldUpdate && !e.shouldUpdate(c, a) ? [] : n(a,
|
|
392
|
+
const a = C.getProps(), y = w.getChildren();
|
|
393
|
+
return c && e.shouldUpdate && !e.shouldUpdate(c, a) ? [] : n(a, y);
|
|
382
394
|
} catch (a) {
|
|
383
395
|
throw e.lifecycle?.onError && e.lifecycle.onError(a), a;
|
|
384
396
|
}
|
|
385
|
-
},
|
|
397
|
+
}),
|
|
386
398
|
props: C.getProps(),
|
|
387
399
|
children: w.getChildren(),
|
|
388
400
|
context: l,
|
|
@@ -391,14 +403,14 @@ function m(n, e = {}) {
|
|
|
391
403
|
ref: t.ref,
|
|
392
404
|
mounted: !1
|
|
393
405
|
};
|
|
394
|
-
return t.ref &&
|
|
406
|
+
return t.ref && g.applyRef(t.ref, U.getRef()), i.registerComponent(M), M;
|
|
395
407
|
};
|
|
396
408
|
return e.displayName && (r.displayName = e.displayName), e.defaultProps && (r.defaultProps = e.defaultProps), r;
|
|
397
409
|
}
|
|
398
|
-
function
|
|
410
|
+
function R() {
|
|
399
411
|
return `component_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
400
412
|
}
|
|
401
|
-
function
|
|
413
|
+
function H(n, e) {
|
|
402
414
|
const r = (t) => {
|
|
403
415
|
const o = n(t), i = o.cleanup || [], s = [];
|
|
404
416
|
if (e.onMount) {
|
|
@@ -412,12 +424,12 @@ function V(n, e) {
|
|
|
412
424
|
};
|
|
413
425
|
return r.displayName = `withLifecycle(${n.displayName || "Component"})`, r;
|
|
414
426
|
}
|
|
415
|
-
function
|
|
427
|
+
function J(n) {
|
|
416
428
|
return m(n, {
|
|
417
|
-
shouldUpdate: (e, r) => !
|
|
429
|
+
shouldUpdate: (e, r) => !S.shallowEqual(e, r)
|
|
418
430
|
});
|
|
419
431
|
}
|
|
420
|
-
function
|
|
432
|
+
function X(n) {
|
|
421
433
|
return m(
|
|
422
434
|
(e, r) => {
|
|
423
435
|
const t = new d(r || e.children);
|
|
@@ -437,9 +449,9 @@ function z(n) {
|
|
|
437
449
|
}
|
|
438
450
|
);
|
|
439
451
|
}
|
|
440
|
-
function
|
|
452
|
+
function Y(n, e = {}) {
|
|
441
453
|
return m((r, t) => {
|
|
442
|
-
const o = new
|
|
454
|
+
const o = new b(r, e.validation), i = new d(t || r.children), s = new g();
|
|
443
455
|
return n(r, t || r.children, {
|
|
444
456
|
propsManager: o,
|
|
445
457
|
childrenManager: i,
|
|
@@ -447,41 +459,41 @@ function H(n, e = {}) {
|
|
|
447
459
|
});
|
|
448
460
|
}, e);
|
|
449
461
|
}
|
|
450
|
-
function
|
|
462
|
+
function Z(n) {
|
|
451
463
|
const e = new d(n);
|
|
452
464
|
return {
|
|
453
465
|
type: "component",
|
|
454
466
|
render: () => e.renderChildren(),
|
|
455
467
|
props: { children: n },
|
|
456
468
|
children: n,
|
|
457
|
-
id:
|
|
469
|
+
id: R()
|
|
458
470
|
};
|
|
459
471
|
}
|
|
460
|
-
function
|
|
461
|
-
return
|
|
472
|
+
function ee(n = null) {
|
|
473
|
+
return g.createRef(n);
|
|
462
474
|
}
|
|
463
|
-
function
|
|
475
|
+
function re(n) {
|
|
464
476
|
return m((e) => {
|
|
465
477
|
const { ref: r, ...t } = e;
|
|
466
478
|
return n(t, r || void 0);
|
|
467
479
|
});
|
|
468
480
|
}
|
|
469
481
|
export {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
482
|
+
F as C,
|
|
483
|
+
b as P,
|
|
484
|
+
g as R,
|
|
485
|
+
J as a,
|
|
486
|
+
X as b,
|
|
487
|
+
m as c,
|
|
488
|
+
Y as d,
|
|
489
|
+
Z as e,
|
|
490
|
+
ee as f,
|
|
491
|
+
re as g,
|
|
492
|
+
d as h,
|
|
493
|
+
G as i,
|
|
494
|
+
T as j,
|
|
495
|
+
W as k,
|
|
484
496
|
z as l,
|
|
485
|
-
|
|
486
|
-
|
|
497
|
+
S as p,
|
|
498
|
+
H as w
|
|
487
499
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./scheduler-DI_8ykMk.js";
|
|
2
|
+
import { i as n, d as f, a as h } from "./theme-BFaKUcjZ.js";
|
|
3
|
+
import "@tachui/types/reactive";
|
|
2
4
|
var g = Object.defineProperty, u = (i, s, e) => s in i ? g(i, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[s] = e, o = (i, s, e) => u(i, typeof s != "symbol" ? s + "" : s, e);
|
|
3
5
|
const d = {
|
|
4
6
|
sanitizeClassNames: !0,
|
|
@@ -189,14 +191,14 @@ class p {
|
|
|
189
191
|
}
|
|
190
192
|
}
|
|
191
193
|
const l = new p();
|
|
192
|
-
function
|
|
194
|
+
function v(i) {
|
|
193
195
|
l.updateConfig(i);
|
|
194
196
|
}
|
|
195
|
-
function
|
|
197
|
+
function z() {
|
|
196
198
|
return l.getConfig();
|
|
197
199
|
}
|
|
198
200
|
var m = Object.defineProperty, y = (i, s, e) => s in i ? m(i, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[s] = e, S = (i, s, e) => y(i, s + "", e);
|
|
199
|
-
class
|
|
201
|
+
class M {
|
|
200
202
|
constructor() {
|
|
201
203
|
S(this, "cssClassManager", l);
|
|
202
204
|
}
|
|
@@ -248,8 +250,8 @@ class v {
|
|
|
248
250
|
}
|
|
249
251
|
export {
|
|
250
252
|
p as C,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
+
v as a,
|
|
254
|
+
M as b,
|
|
253
255
|
l as c,
|
|
254
|
-
|
|
256
|
+
z as g
|
|
255
257
|
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { l as u } from "./theme-BFaKUcjZ.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 {
|
|
6
|
+
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;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Store state value for a property
|
|
11
|
+
*/
|
|
12
|
+
setState(t, n) {
|
|
13
|
+
this.stateStore.set(t, n), this.updateCount++;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get state value for a property
|
|
17
|
+
*/
|
|
18
|
+
getState(t) {
|
|
19
|
+
return this.stateStore.get(t);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Check if state exists for a property
|
|
23
|
+
*/
|
|
24
|
+
hasState(t) {
|
|
25
|
+
return this.stateStore.has(t);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Store binding for a property
|
|
29
|
+
*/
|
|
30
|
+
setBinding(t, n) {
|
|
31
|
+
this.bindingStore.set(t, n);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get binding for a property
|
|
35
|
+
*/
|
|
36
|
+
getBinding(t) {
|
|
37
|
+
return this.bindingStore.get(t);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Provide a value for dependency injection
|
|
41
|
+
*/
|
|
42
|
+
provide(t, n) {
|
|
43
|
+
this.providers.set(t, n);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Consume a value from dependency injection hierarchy
|
|
47
|
+
*/
|
|
48
|
+
consume(t) {
|
|
49
|
+
if (this.consumers.add(t), this.providers.has(t))
|
|
50
|
+
return this.providers.get(t);
|
|
51
|
+
let n = this.parent;
|
|
52
|
+
for (; n; ) {
|
|
53
|
+
if (n.providers.has(t))
|
|
54
|
+
return n.providers.get(t);
|
|
55
|
+
n = n.parent;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Register cleanup function
|
|
60
|
+
*/
|
|
61
|
+
onCleanup(t) {
|
|
62
|
+
this.cleanup.add(t);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Dispose of context and run cleanup
|
|
66
|
+
*/
|
|
67
|
+
dispose() {
|
|
68
|
+
for (const t of this.cleanup)
|
|
69
|
+
try {
|
|
70
|
+
t();
|
|
71
|
+
} catch (n) {
|
|
72
|
+
console.error(`Error in component context cleanup (${this.id}):`, n);
|
|
73
|
+
}
|
|
74
|
+
this.cleanup.clear(), this.stateStore.clear(), this.bindingStore.clear(), this.providers.clear(), this.consumers.clear();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get performance metrics
|
|
78
|
+
*/
|
|
79
|
+
getMetrics() {
|
|
80
|
+
return {
|
|
81
|
+
id: this.id,
|
|
82
|
+
createdAt: this.createdAt,
|
|
83
|
+
updateCount: this.updateCount,
|
|
84
|
+
stateCount: this.stateStore.size,
|
|
85
|
+
bindingCount: this.bindingStore.size,
|
|
86
|
+
providerCount: this.providers.size,
|
|
87
|
+
consumerCount: this.consumers.size
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function C(e, t) {
|
|
92
|
+
return new m(e, t);
|
|
93
|
+
}
|
|
94
|
+
function p() {
|
|
95
|
+
if (o)
|
|
96
|
+
return o;
|
|
97
|
+
let e = u();
|
|
98
|
+
for (; e; ) {
|
|
99
|
+
if (e.context.has(a))
|
|
100
|
+
return e.context.get(a);
|
|
101
|
+
e = e.parent;
|
|
102
|
+
}
|
|
103
|
+
throw new Error(
|
|
104
|
+
"@State can only be used within a component context. Make sure you are using @State inside a TachUI component render function."
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
function g(e) {
|
|
108
|
+
o = e;
|
|
109
|
+
}
|
|
110
|
+
function f(e, t) {
|
|
111
|
+
const n = o;
|
|
112
|
+
o = e;
|
|
113
|
+
const i = u();
|
|
114
|
+
i && i.context.set(a, e);
|
|
115
|
+
try {
|
|
116
|
+
return t();
|
|
117
|
+
} finally {
|
|
118
|
+
o === e && (o = n), i && (n ? i.context.set(a, n) : i.context.delete(a));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function S(e, t) {
|
|
122
|
+
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;
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function w(e, t) {
|
|
131
|
+
return {
|
|
132
|
+
symbol: Symbol(`Environment.${e}`),
|
|
133
|
+
defaultValue: t,
|
|
134
|
+
name: e
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function b(e, t) {
|
|
138
|
+
p().provide(e.symbol, t);
|
|
139
|
+
}
|
|
140
|
+
function E(e) {
|
|
141
|
+
const n = p().consume(e.symbol);
|
|
142
|
+
if (n !== void 0)
|
|
143
|
+
return n;
|
|
144
|
+
if (e.defaultValue !== void 0)
|
|
145
|
+
return e.defaultValue;
|
|
146
|
+
throw new Error(
|
|
147
|
+
`Environment value for '${e.name}' not found. Make sure to provide this value higher in the component hierarchy.`
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
const y = {
|
|
151
|
+
getCurrentContext: () => o,
|
|
152
|
+
getContextHierarchy: () => {
|
|
153
|
+
const e = [];
|
|
154
|
+
let t = o || void 0;
|
|
155
|
+
for (; t; )
|
|
156
|
+
e.push(t), t = t.parent;
|
|
157
|
+
return e;
|
|
158
|
+
},
|
|
159
|
+
getContextMetrics: (e) => {
|
|
160
|
+
const t = e || o;
|
|
161
|
+
return t ? t.getMetrics() : null;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
export {
|
|
165
|
+
y as C,
|
|
166
|
+
v as E,
|
|
167
|
+
a,
|
|
168
|
+
C as b,
|
|
169
|
+
E as c,
|
|
170
|
+
w as d,
|
|
171
|
+
p as g,
|
|
172
|
+
b as p,
|
|
173
|
+
f as r,
|
|
174
|
+
g as s,
|
|
175
|
+
S as w
|
|
176
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ComponentInstance, ComponentProps } from '../runtime/types';
|
|
2
|
+
/**
|
|
3
|
+
* Options for class-based component creation.
|
|
4
|
+
*/
|
|
5
|
+
export interface CreateComponentOptions {
|
|
6
|
+
/**
|
|
7
|
+
* When true, the returned instance is immediately wrapped in the modifier proxy.
|
|
8
|
+
* Defaults to true so that downstream code can access modifier methods without
|
|
9
|
+
* re-wrapping manually. Legacy paths that apply modifiers separately can set
|
|
10
|
+
* this to false.
|
|
11
|
+
*/
|
|
12
|
+
prewarmProxy?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Instantiate a class-based component and ensure modifier proxy state is primed.
|
|
16
|
+
*
|
|
17
|
+
* This helper mirrors SwiftUI's component allocation flow while keeping
|
|
18
|
+
* TachUI's modifier proxy cache in sync. When proxy mode is enabled the
|
|
19
|
+
* instance is registered with the proxy cache so subsequent `withModifiers`
|
|
20
|
+
* calls can reuse the same proxy. When proxy mode is disabled the raw
|
|
21
|
+
* instance is returned.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createComponentInstance<P extends ComponentProps, R extends ComponentInstance<P>, Args extends unknown[]>(ComponentClass: new (props: P, ...rest: Args) => R, props: P, options?: CreateComponentOptions, ...rest: Args): R;
|
|
24
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/components/factory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEzE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,iBAAiB,CAAC,CAAC,CAAC,EAC9B,IAAI,SAAS,OAAO,EAAE,EAEtB,cAAc,EAAE,KAAK,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,EAClD,KAAK,EAAE,CAAC,EACR,OAAO,GAAE,sBAA2B,EACpC,GAAG,IAAI,EAAE,IAAI,GACZ,CAAC,CAQH"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export type { ModifiableComponent, ModifierBuilder } from '../modifiers/types';
|
|
8
8
|
export type { ComponentInstance, ComponentProps, DOMNode, } from '../runtime/types';
|
|
9
|
-
export type { WrapperOptions } from './wrapper';
|
|
10
|
-
export { createModifiableComponentFactory, createReactiveWrapper, Layout, withModifierSupport, withModifiers, wrapComponent, } from './wrapper';
|
|
9
|
+
export type { WrapperOptions, BaseLayoutProps, VStackLayoutProps, HStackLayoutProps, ZStackLayoutProps, } from './wrapper';
|
|
10
|
+
export { createModifiableComponentFactory, createReactiveWrapper, Layout, LayoutComponent, withModifierSupport, withModifiers, wrapComponent, } from './wrapper';
|
|
11
|
+
export { createComponentInstance, type CreateComponentOptions } from './factory';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAC9E,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,OAAO,GACR,MAAM,kBAAkB,CAAA;AAGzB,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAC9E,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,OAAO,GACR,MAAM,kBAAkB,CAAA;AAGzB,YAAY,EACV,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,gCAAgC,EAChC,qBAAqB,EACrB,MAAM,EACN,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,aAAa,GACd,MAAM,WAAW,CAAA;AAElB,OAAO,EAAE,uBAAuB,EAAE,KAAK,sBAAsB,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/components/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { L as o,
|
|
1
|
+
import { L as o, b as t, f as r, c as n, a as p, w as s, d as i, e as c } from "../factory-D7jAY5Kn.js";
|
|
2
2
|
export {
|
|
3
3
|
o as Layout,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
p as
|
|
8
|
-
s as
|
|
4
|
+
t as LayoutComponent,
|
|
5
|
+
r as createComponentInstance,
|
|
6
|
+
n as createModifiableComponentFactory,
|
|
7
|
+
p as createReactiveWrapper,
|
|
8
|
+
s as withModifierSupport,
|
|
9
|
+
i as withModifiers,
|
|
10
|
+
c as wrapComponent
|
|
9
11
|
};
|