@tachui/core 0.8.16 → 0.8.18
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/common.js +383 -382
- package/dist/components/index.js +1 -1
- package/dist/components/wrapper.d.ts.map +1 -1
- package/dist/{concatenated-component-BCrw_7cC.js → concatenated-component-2Gzy5e2c.js} +2 -2
- package/dist/essential.js +396 -395
- package/dist/{factory-oMYyVSAY.js → factory-gqfMcmOy.js} +73 -66
- package/dist/index-DL9Cys3t.js +733 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +376 -375
- package/dist/modifiers/builder.js +1 -1
- package/dist/modifiers/index.js +2 -2
- package/dist/modifiers/registry.js +1 -1
- package/dist/{proxy-gO-vDCUZ.js → proxy-Cp0QUXME.js} +1 -1
- package/dist/runtime/dom-bridge.js +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/renderer.js +1 -1
- package/dist/utils/sanitize-svg.d.ts +2 -0
- package/dist/utils/sanitize-svg.d.ts.map +1 -0
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/index-BaBj0d3d.js +0 -618
|
@@ -2,8 +2,8 @@ import "./scheduler-DppMK9mR.js";
|
|
|
2
2
|
import "./theme-CRLPHryV.js";
|
|
3
3
|
import "@tachui/types/reactive";
|
|
4
4
|
import "@tachui/types/modifiers";
|
|
5
|
-
import { p as z, h as _, d as M, c as L } from "./concatenated-component-
|
|
6
|
-
import { i as
|
|
5
|
+
import { p as z, h as _, d as M, c as L } from "./concatenated-component-2Gzy5e2c.js";
|
|
6
|
+
import { i as T, c as x } from "./proxy-Cp0QUXME.js";
|
|
7
7
|
import "./presets-B9x94uRn.js";
|
|
8
8
|
import "@tachui/registry";
|
|
9
9
|
import "./component-D-O9yq0P.js";
|
|
@@ -19,7 +19,7 @@ function j(e) {
|
|
|
19
19
|
function I(e) {
|
|
20
20
|
return e !== null && typeof e == "object" && e.type === "component" && typeof e.render == "function";
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function A(e, t = {}) {
|
|
23
23
|
if (e == null)
|
|
24
24
|
return e;
|
|
25
25
|
const i = {};
|
|
@@ -56,15 +56,15 @@ function E(e) {
|
|
|
56
56
|
const t = W();
|
|
57
57
|
e.mounted = t.mounted, e.cleanup = t.cleanup, e.domElements = t.domElements, e.primaryElement = t.primaryElement, e.domReady = t.domReady;
|
|
58
58
|
}
|
|
59
|
-
var
|
|
60
|
-
const
|
|
59
|
+
var q = Object.defineProperty, F = (e, t, i) => t in e ? q(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i, C = (e, t, i) => F(e, typeof t != "symbol" ? t + "" : t, i);
|
|
60
|
+
const S = {
|
|
61
61
|
isEnabled: () => !1,
|
|
62
62
|
logComponent: (...e) => {
|
|
63
63
|
},
|
|
64
64
|
addDebugAttributes: (...e) => {
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
function
|
|
67
|
+
function H(e) {
|
|
68
68
|
return e && typeof e.concat == "function" && typeof e.toSegment == "function" && typeof e.isConcatenatable == "function";
|
|
69
69
|
}
|
|
70
70
|
function h(e) {
|
|
@@ -73,8 +73,8 @@ function h(e) {
|
|
|
73
73
|
configurable: !0,
|
|
74
74
|
enumerable: !1,
|
|
75
75
|
get: () => i
|
|
76
|
-
}),
|
|
77
|
-
return
|
|
76
|
+
}), T())
|
|
77
|
+
return x(
|
|
78
78
|
e
|
|
79
79
|
);
|
|
80
80
|
const n = {
|
|
@@ -82,7 +82,7 @@ function h(e) {
|
|
|
82
82
|
modifier: i,
|
|
83
83
|
modifierBuilder: i
|
|
84
84
|
};
|
|
85
|
-
return typeof i.build == "function" && (n.build = i.build.bind(i)),
|
|
85
|
+
return typeof i.build == "function" && (n.build = i.build.bind(i)), H(e) && (n.concat = function(r) {
|
|
86
86
|
return e.concat(r);
|
|
87
87
|
}, n.toSegment = function() {
|
|
88
88
|
return e.toSegment();
|
|
@@ -110,12 +110,12 @@ function ie(e, t = {}) {
|
|
|
110
110
|
class v extends $ {
|
|
111
111
|
constructor(t, i, n = [], r = {}) {
|
|
112
112
|
super(), this.props = t, this.layoutType = i, this.children = n, this.layoutProps = r, C(this, "type", "component"), C(this, "id"), C(this, "mounted", !1), C(this, "cleanup", []), C(this, "effectiveTag"), C(this, "validationResult"), this.id = t?.id?.toString() || `layout-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
113
|
-
const o = this.layoutType === "hstack" ? "HStack" : this.layoutType === "vstack" ? "VStack" : "ZStack",
|
|
113
|
+
const o = this.layoutType === "hstack" ? "HStack" : this.layoutType === "vstack" ? "VStack" : "ZStack", a = z(
|
|
114
114
|
o,
|
|
115
115
|
"div",
|
|
116
116
|
this.props.element
|
|
117
117
|
);
|
|
118
|
-
if (this.effectiveTag =
|
|
118
|
+
if (this.effectiveTag = a.tag, this.validationResult = a.validation, process.env.NODE_ENV === "test" && this.effectiveTag !== "div" && !this.props.role) {
|
|
119
119
|
const d = {
|
|
120
120
|
nav: "navigation",
|
|
121
121
|
header: "banner",
|
|
@@ -128,8 +128,8 @@ class v extends $ {
|
|
|
128
128
|
O(this, {
|
|
129
129
|
onDOMReady: (b, d) => {
|
|
130
130
|
this.children.forEach((s, m) => {
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
131
|
+
const l = s._enhancedLifecycle;
|
|
132
|
+
if (l && l.onDOMReady && !s.domReady)
|
|
133
133
|
try {
|
|
134
134
|
if (d) {
|
|
135
135
|
const y = this.findChildDOMElements(
|
|
@@ -138,17 +138,17 @@ class v extends $ {
|
|
|
138
138
|
m
|
|
139
139
|
);
|
|
140
140
|
if (y.length > 0) {
|
|
141
|
-
s.domElements = /* @__PURE__ */ new Map(), y.forEach((
|
|
142
|
-
const
|
|
143
|
-
s.domElements.set(
|
|
141
|
+
s.domElements = /* @__PURE__ */ new Map(), y.forEach((f, p) => {
|
|
142
|
+
const u = f.id || `element-${p}`;
|
|
143
|
+
s.domElements.set(u, f), s.primaryElement || (s.primaryElement = f);
|
|
144
144
|
}), s.domReady = !0;
|
|
145
|
-
const
|
|
145
|
+
const c = l.onDOMReady(
|
|
146
146
|
s.domElements,
|
|
147
147
|
s.primaryElement
|
|
148
148
|
);
|
|
149
|
-
if (typeof
|
|
150
|
-
const
|
|
151
|
-
typeof
|
|
149
|
+
if (typeof c == "function" && (s.cleanup = s.cleanup || [], s.cleanup.push(c)), l.onMount) {
|
|
150
|
+
const f = l.onMount();
|
|
151
|
+
typeof f == "function" && (s.cleanup = s.cleanup || [], s.cleanup.push(f));
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -166,26 +166,33 @@ class v extends $ {
|
|
|
166
166
|
* Find DOM elements for a specific child component within the layout container
|
|
167
167
|
*/
|
|
168
168
|
findChildDOMElements(t, i, n) {
|
|
169
|
+
const r = i.querySelectorAll(
|
|
170
|
+
`[data-component-id="${t.id}"]`
|
|
171
|
+
);
|
|
172
|
+
if (r.length > 0)
|
|
173
|
+
return Array.from(r);
|
|
169
174
|
if (t.id.startsWith("image-")) {
|
|
170
|
-
const
|
|
171
|
-
|
|
175
|
+
const a = i.querySelectorAll(
|
|
176
|
+
"img.tachui-image, span.tachui-image-template"
|
|
177
|
+
);
|
|
178
|
+
return a[n] ? [a[n]] : Array.from(a);
|
|
172
179
|
}
|
|
173
180
|
if (t.id.startsWith("button-")) {
|
|
174
|
-
const
|
|
175
|
-
return
|
|
181
|
+
const a = i.querySelectorAll("button.tachui-button");
|
|
182
|
+
return a[n] ? [a[n]] : Array.from(a);
|
|
176
183
|
}
|
|
177
184
|
if (t.id.startsWith("text-")) {
|
|
178
|
-
const
|
|
185
|
+
const a = i.querySelectorAll(
|
|
179
186
|
"span.tachui-text, .tachui-text"
|
|
180
187
|
);
|
|
181
|
-
return
|
|
188
|
+
return a[n] ? [a[n]] : Array.from(a);
|
|
182
189
|
}
|
|
183
|
-
const
|
|
184
|
-
return
|
|
190
|
+
const o = Array.from(i.children);
|
|
191
|
+
return o[n] ? [o[n]] : o;
|
|
185
192
|
}
|
|
186
193
|
render() {
|
|
187
194
|
const { spacing: t = 0, debugLabel: i } = this.layoutProps, n = this.layoutProps.alignment !== void 0 ? this.layoutProps.alignment : "center";
|
|
188
|
-
|
|
195
|
+
S.logComponent(this.layoutType.toUpperCase(), i);
|
|
189
196
|
const r = [
|
|
190
197
|
`tachui-${this.layoutType}`
|
|
191
198
|
], o = this.createClassString(this.props, r);
|
|
@@ -194,8 +201,8 @@ class v extends $ {
|
|
|
194
201
|
const b = this.children.map((s) => {
|
|
195
202
|
let m = s;
|
|
196
203
|
"build" in s && typeof s.build == "function" && (m = s.build());
|
|
197
|
-
const
|
|
198
|
-
return Array.isArray(
|
|
204
|
+
const l = m.render();
|
|
205
|
+
return Array.isArray(l) ? l : [l];
|
|
199
206
|
}).flat();
|
|
200
207
|
return [{
|
|
201
208
|
type: "element",
|
|
@@ -209,7 +216,7 @@ class v extends $ {
|
|
|
209
216
|
alignItems: n === "leading" ? "flex-start" : n === "trailing" ? "flex-end" : "center"
|
|
210
217
|
},
|
|
211
218
|
// Add debug attributes
|
|
212
|
-
...
|
|
219
|
+
...S.isEnabled()
|
|
213
220
|
},
|
|
214
221
|
children: b,
|
|
215
222
|
// Add component metadata for semantic role processing
|
|
@@ -221,11 +228,11 @@ class v extends $ {
|
|
|
221
228
|
}];
|
|
222
229
|
}
|
|
223
230
|
case "hstack": {
|
|
224
|
-
const b = this.children.map((
|
|
225
|
-
let y =
|
|
226
|
-
"build" in
|
|
227
|
-
const
|
|
228
|
-
return Array.isArray(
|
|
231
|
+
const b = this.children.map((l) => {
|
|
232
|
+
let y = l;
|
|
233
|
+
"build" in l && typeof l.build == "function" && (y = l.build());
|
|
234
|
+
const c = y.render();
|
|
235
|
+
return Array.isArray(c) ? c : [c];
|
|
229
236
|
}).flat(), d = n === "leading" || n === "left" ? "flex-start" : n === "trailing" || n === "right" ? "flex-end" : void 0, s = n === "top" ? "flex-start" : n === "bottom" ? "flex-end" : "center";
|
|
230
237
|
return [{
|
|
231
238
|
type: "element",
|
|
@@ -240,7 +247,7 @@ class v extends $ {
|
|
|
240
247
|
...d ? { justifyContent: d } : {}
|
|
241
248
|
},
|
|
242
249
|
// Add debug attributes
|
|
243
|
-
...
|
|
250
|
+
...S.isEnabled()
|
|
244
251
|
},
|
|
245
252
|
children: b,
|
|
246
253
|
// Add component metadata for semantic role processing
|
|
@@ -252,21 +259,21 @@ class v extends $ {
|
|
|
252
259
|
}];
|
|
253
260
|
}
|
|
254
261
|
case "zstack": {
|
|
255
|
-
const
|
|
262
|
+
const a = this.layoutProps.sizing && ["content", "priority", "explicit"].includes(this.layoutProps.sizing) ? this.layoutProps.sizing : "content", b = typeof this.layoutProps.sizingChildIndex == "number" && Number.isInteger(this.layoutProps.sizingChildIndex) ? this.layoutProps.sizingChildIndex : 0, d = this.children.length > 0 ? Math.min(Math.max(b, 0), this.children.length - 1) : -1;
|
|
256
263
|
let s = -1 / 0, m = null;
|
|
257
|
-
|
|
258
|
-
let
|
|
259
|
-
if ("build" in
|
|
260
|
-
const p =
|
|
261
|
-
(
|
|
264
|
+
a === "priority" && this.children.forEach((c) => {
|
|
265
|
+
let f = c;
|
|
266
|
+
if ("build" in c && typeof c.build == "function" && (f = c.build()), "modifiers" in f && Array.isArray(f.modifiers)) {
|
|
267
|
+
const p = f.modifiers.find(
|
|
268
|
+
(u) => u.type === "layout" && u.properties && "layoutPriority" in u.properties && typeof u.properties.layoutPriority == "number"
|
|
262
269
|
);
|
|
263
270
|
if (p) {
|
|
264
|
-
const
|
|
265
|
-
|
|
271
|
+
const u = p.properties.layoutPriority;
|
|
272
|
+
u > s && (s = u, m = f);
|
|
266
273
|
}
|
|
267
274
|
}
|
|
268
275
|
});
|
|
269
|
-
const
|
|
276
|
+
const l = _("div", {
|
|
270
277
|
className: o,
|
|
271
278
|
style: {
|
|
272
279
|
position: "relative",
|
|
@@ -274,18 +281,18 @@ class v extends $ {
|
|
|
274
281
|
justifyContent: n.includes("Leading") ? "flex-start" : n.includes("Trailing") ? "flex-end" : "center",
|
|
275
282
|
alignItems: n.includes("top") ? "flex-start" : n.includes("bottom") ? "flex-end" : "center",
|
|
276
283
|
// Legacy priority mode sizes to the highest-priority child.
|
|
277
|
-
...
|
|
284
|
+
...a === "priority" && m ? {
|
|
278
285
|
minWidth: "fit-content",
|
|
279
286
|
minHeight: "fit-content"
|
|
280
287
|
} : {}
|
|
281
288
|
},
|
|
282
289
|
// Add debug attributes
|
|
283
|
-
...
|
|
284
|
-
}), y = this.children.flatMap((
|
|
285
|
-
let p =
|
|
286
|
-
"build" in
|
|
287
|
-
const
|
|
288
|
-
let R =
|
|
290
|
+
...S.isEnabled()
|
|
291
|
+
}), y = this.children.flatMap((c, f) => {
|
|
292
|
+
let p = c;
|
|
293
|
+
"build" in c && typeof c.build == "function" && (p = c.build());
|
|
294
|
+
const u = p.render(), w = Array.isArray(u) ? u : [u];
|
|
295
|
+
let R = f;
|
|
289
296
|
if ("modifiers" in p && Array.isArray(p.modifiers)) {
|
|
290
297
|
const g = p.modifiers.find(
|
|
291
298
|
(P) => P.type === "layout" && P.properties && "layoutPriority" in P.properties
|
|
@@ -294,7 +301,7 @@ class v extends $ {
|
|
|
294
301
|
}
|
|
295
302
|
return w.map((g) => {
|
|
296
303
|
if (g.type === "element") {
|
|
297
|
-
const k =
|
|
304
|
+
const k = a === "content" ? f === d : a === "priority" ? a === "priority" && m !== null && p === m : !1;
|
|
298
305
|
return {
|
|
299
306
|
...g,
|
|
300
307
|
props: {
|
|
@@ -324,7 +331,7 @@ class v extends $ {
|
|
|
324
331
|
type: "element",
|
|
325
332
|
tag: this.effectiveTag,
|
|
326
333
|
props: {
|
|
327
|
-
...
|
|
334
|
+
...l.props,
|
|
328
335
|
className: o
|
|
329
336
|
},
|
|
330
337
|
children: y,
|
|
@@ -352,7 +359,7 @@ class v extends $ {
|
|
|
352
359
|
return t.deep ? this.deepClone() : this.shallowClone();
|
|
353
360
|
}
|
|
354
361
|
shallowClone() {
|
|
355
|
-
const t =
|
|
362
|
+
const t = A(this.props), i = A(this.layoutProps), n = (this.children ?? []).slice(), r = new v(
|
|
356
363
|
t,
|
|
357
364
|
this.layoutType,
|
|
358
365
|
n,
|
|
@@ -361,9 +368,9 @@ class v extends $ {
|
|
|
361
368
|
return E(r), r;
|
|
362
369
|
}
|
|
363
370
|
deepClone() {
|
|
364
|
-
const t =
|
|
371
|
+
const t = A(this.props, {
|
|
365
372
|
deep: !0
|
|
366
|
-
}), i =
|
|
373
|
+
}), i = A(this.layoutProps, {
|
|
367
374
|
deep: !0
|
|
368
375
|
}), n = (this.children ?? []).map((o) => typeof o?.clone == "function" ? o.clone({ deep: !0 }) : o), r = new v(
|
|
369
376
|
t,
|
|
@@ -417,13 +424,13 @@ const re = {
|
|
|
417
424
|
sizing: n = "content",
|
|
418
425
|
sizingChildIndex: r = 0,
|
|
419
426
|
debugLabel: o
|
|
420
|
-
} = e,
|
|
427
|
+
} = e, a = new v(e, "zstack", t, {
|
|
421
428
|
alignment: i,
|
|
422
429
|
sizing: n,
|
|
423
430
|
sizingChildIndex: r,
|
|
424
431
|
debugLabel: o
|
|
425
432
|
});
|
|
426
|
-
return h(
|
|
433
|
+
return h(a);
|
|
427
434
|
}
|
|
428
435
|
};
|
|
429
436
|
function oe(e) {
|
|
@@ -434,7 +441,7 @@ function se(e) {
|
|
|
434
441
|
constructor(t) {
|
|
435
442
|
super(t), C(this, "_modifiableComponent");
|
|
436
443
|
const i = h(this);
|
|
437
|
-
|
|
444
|
+
T() ? (this._modifiableComponent = M(this), x(this)) : (this._modifiableComponent = i, Object.defineProperty(this, "modifier", {
|
|
438
445
|
configurable: !0,
|
|
439
446
|
enumerable: !1,
|
|
440
447
|
value: i.modifier,
|
|
@@ -447,8 +454,8 @@ function se(e) {
|
|
|
447
454
|
}));
|
|
448
455
|
}
|
|
449
456
|
get modifier() {
|
|
450
|
-
if (
|
|
451
|
-
return
|
|
457
|
+
if (T())
|
|
458
|
+
return x(this).modifier;
|
|
452
459
|
const t = this._modifiableComponent ?? h(this);
|
|
453
460
|
return this._modifiableComponent = t, t.modifier;
|
|
454
461
|
}
|
|
@@ -476,7 +483,7 @@ function ae(e) {
|
|
|
476
483
|
}
|
|
477
484
|
function le(e, t, i = {}, ...n) {
|
|
478
485
|
const r = new e(t, ...n);
|
|
479
|
-
return
|
|
486
|
+
return T() && i.prewarmProxy !== !1 && x(r), r;
|
|
480
487
|
}
|
|
481
488
|
export {
|
|
482
489
|
re as L,
|
|
@@ -486,7 +493,7 @@ export {
|
|
|
486
493
|
h as d,
|
|
487
494
|
oe as e,
|
|
488
495
|
le as f,
|
|
489
|
-
|
|
496
|
+
A as g,
|
|
490
497
|
W as h,
|
|
491
498
|
E as r,
|
|
492
499
|
se as w
|