@tachui/core 0.8.0-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 +58 -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/assets.d.ts +19 -0
- package/dist/bundles/assets.d.ts.map +1 -0
- package/dist/bundles/context.d.ts +22 -0
- package/dist/bundles/context.d.ts.map +1 -0
- package/dist/bundles/minimal.d.ts +8 -2
- package/dist/bundles/minimal.d.ts.map +1 -1
- package/dist/common.js +427 -393
- package/dist/compiler/codegen.d.ts.map +1 -1
- package/dist/compiler/index.js +6 -1393
- package/dist/compiler/parser.d.ts +1 -1
- package/dist/compiler/parser.d.ts.map +1 -1
- package/dist/compiler/plugin.d.ts.map +1 -1
- package/dist/compiler/types.d.ts +28 -0
- package/dist/compiler/types.d.ts.map +1 -1
- 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 +425 -391
- 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 +426 -392
- package/dist/minimal-prod.js +94 -93
- package/dist/minimal.js +126 -106
- 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-DepiqSgg.js +269 -0
- package/dist/optimization-CbKNA9w4.js +21 -0
- package/dist/plugin-BCAdZXKq.js +1680 -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 +24 -0
- package/dist/runtime/concatenation-aria.d.ts.map +1 -0
- package/dist/runtime/concatenation-aria.js +58 -0
- package/dist/runtime/concatenation-full.d.ts +30 -0
- package/dist/runtime/concatenation-full.d.ts.map +1 -0
- package/dist/runtime/concatenation-full.js +85 -0
- package/dist/runtime/concatenation-minimal.d.ts +25 -0
- package/dist/runtime/concatenation-minimal.d.ts.map +1 -0
- package/dist/runtime/concatenation-minimal.js +45 -0
- 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 +69 -9
- package/dist/concatenated-component-ByPl3_FF.js +0 -2933
- package/dist/dom-bridge-CAa1N2zX.js +0 -406
- package/dist/index-DCPJFUm9.js +0 -1407
- 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
|
@@ -0,0 +1,2288 @@
|
|
|
1
|
+
import { globalModifierRegistry as C } from "@tachui/registry";
|
|
2
|
+
import "./scheduler-DI_8ykMk.js";
|
|
3
|
+
import { i as w, d as x, n as j, u as U } from "./theme-BFaKUcjZ.js";
|
|
4
|
+
import { c as E } from "./effect-DGmdACI2.js";
|
|
5
|
+
import "@tachui/types/reactive";
|
|
6
|
+
var F = Object.defineProperty, G = (n, e, t) => e in n ? F(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, z = (n, e, t) => G(n, e + "", t);
|
|
7
|
+
const K = /* @__PURE__ */ new Set([
|
|
8
|
+
"onFocus",
|
|
9
|
+
"onBlur",
|
|
10
|
+
"onKeyDown",
|
|
11
|
+
"onKeyUp",
|
|
12
|
+
"onKeyPress",
|
|
13
|
+
"onScroll",
|
|
14
|
+
"onWheel",
|
|
15
|
+
"onInput",
|
|
16
|
+
"onChange",
|
|
17
|
+
"onCopy",
|
|
18
|
+
"onCut",
|
|
19
|
+
"onPaste",
|
|
20
|
+
"onSelect",
|
|
21
|
+
"onTouchStart",
|
|
22
|
+
"onTouchMove",
|
|
23
|
+
"onTouchEnd",
|
|
24
|
+
"onSwipeLeft",
|
|
25
|
+
"onSwipeRight"
|
|
26
|
+
]);
|
|
27
|
+
let P = null;
|
|
28
|
+
function Ne(n) {
|
|
29
|
+
P = n, console.debug(
|
|
30
|
+
"[RegistryBridge] External modifier registry set with",
|
|
31
|
+
n?.list()?.length || 0,
|
|
32
|
+
"modifiers"
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function B() {
|
|
36
|
+
return P || C;
|
|
37
|
+
}
|
|
38
|
+
function l(n, ...e) {
|
|
39
|
+
const i = B().get(n);
|
|
40
|
+
if (i)
|
|
41
|
+
try {
|
|
42
|
+
return i.apply(null, e);
|
|
43
|
+
} catch (s) {
|
|
44
|
+
throw console.warn(`Error creating modifier '${n}':`, s), s;
|
|
45
|
+
}
|
|
46
|
+
throw new Error(
|
|
47
|
+
`Modifier '${n}' not found in registry. Import @tachui/modifiers or @tachui/modifiers/effects to register modifiers.`
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
class q {
|
|
51
|
+
constructor(e) {
|
|
52
|
+
this.component = e, z(this, "modifiers", []);
|
|
53
|
+
}
|
|
54
|
+
frame(e, t) {
|
|
55
|
+
let i;
|
|
56
|
+
return typeof e == "object" ? i = e : (i = {}, e !== void 0 && (i.width = e), t !== void 0 && (i.height = t)), this.modifiers.push(l("frame", i)), this;
|
|
57
|
+
}
|
|
58
|
+
// margin() moved to @tachui/modifiers - available via Proxy when imported
|
|
59
|
+
layoutPriority(e) {
|
|
60
|
+
return this.modifiers.push(l("layoutPriority", e)), this;
|
|
61
|
+
}
|
|
62
|
+
// Size, padding, and margin modifiers moved to @tachui/modifiers
|
|
63
|
+
// All available via Proxy when @tachui/modifiers is imported:
|
|
64
|
+
// - size(), width(), height(), minWidth(), maxWidth(), minHeight(), maxHeight()
|
|
65
|
+
// - padding(), paddingTop(), paddingBottom(), paddingLeft(), paddingRight()
|
|
66
|
+
// - paddingLeading(), paddingTrailing(), paddingHorizontal(), paddingVertical()
|
|
67
|
+
// - marginTop(), marginBottom(), marginLeft(), marginRight()
|
|
68
|
+
// - marginHorizontal(), marginVertical()
|
|
69
|
+
// Typography modifiers moved to @tachui/modifiers:
|
|
70
|
+
// typography(), textAlign(), textTransform(), gradientText()
|
|
71
|
+
// Available via Proxy when @tachui/modifiers is imported
|
|
72
|
+
// Text modifiers (lineClamp, wordBreak, overflowWrap, hyphens) moved to @tachui/modifiers
|
|
73
|
+
// Available via Proxy when @tachui/modifiers is imported
|
|
74
|
+
// position() and zIndex() methods have been migrated to @tachui/modifiers/layout
|
|
75
|
+
// for enhanced SwiftUI-compatible functionality
|
|
76
|
+
// Text spacing and overflow methods moved to @tachui/modifiers:
|
|
77
|
+
// letterSpacing(), lineHeight(), textOverflow(), whiteSpace(), overflow()
|
|
78
|
+
// Border modifiers moved to @tachui/modifiers:
|
|
79
|
+
// borderTop(), borderRight(), borderBottom(), borderLeft()
|
|
80
|
+
// Flexbox modifiers moved to @tachui/modifiers:
|
|
81
|
+
// flexGrow(), flexShrink(), justifyContent(), alignItems(), gap(), flexDirection(), flexWrap()
|
|
82
|
+
// Utility modifiers moved to @tachui/modifiers:
|
|
83
|
+
// cursor(), overflowX(), overflowY(), outline(), outlineOffset(), display()
|
|
84
|
+
// Raw CSS modifiers moved to @tachui/modifiers/utility
|
|
85
|
+
// Import { css } from '@tachui/modifiers/utility' and apply explicitly.
|
|
86
|
+
// textCase(), textDecoration(), and aspectRatio() moved to @tachui/modifiers
|
|
87
|
+
// Available via Proxy when @tachui/modifiers is imported
|
|
88
|
+
// Phase 1 SwiftUI modifiers
|
|
89
|
+
// Note: clipped() has been moved to @tachui/modifiers
|
|
90
|
+
// Phase 2 SwiftUI modifiers
|
|
91
|
+
// Note: clipShape() and overlay() have been moved to @tachui/modifiers
|
|
92
|
+
// Phase 3 SwiftUI modifiers - Critical Transform Modifiers
|
|
93
|
+
absolutePosition(e, t) {
|
|
94
|
+
return this.modifiers.push(l("absolutePosition", e, t)), this;
|
|
95
|
+
}
|
|
96
|
+
// Appearance modifiers
|
|
97
|
+
foregroundColor(e) {
|
|
98
|
+
return this.modifiers.push(l("foregroundColor", e)), this;
|
|
99
|
+
}
|
|
100
|
+
backgroundColor(e) {
|
|
101
|
+
return this.modifiers.push(l("backgroundColor", e)), this;
|
|
102
|
+
}
|
|
103
|
+
background(e) {
|
|
104
|
+
const t = l("background", e);
|
|
105
|
+
return this.modifiers.push(t), this;
|
|
106
|
+
}
|
|
107
|
+
font(e) {
|
|
108
|
+
let t;
|
|
109
|
+
return typeof e == "object" ? (t = e, t.family !== void 0 && this.modifiers.push(
|
|
110
|
+
l("fontFamily", t.family)
|
|
111
|
+
), t.size !== void 0 && this.modifiers.push(l("fontSize", t.size)), t.weight !== void 0 && this.modifiers.push(l("fontWeight", t.weight)), t.style !== void 0 && this.modifiers.push(l("fontStyle", t.style))) : (t = e !== void 0 ? { size: e } : {}, typeof e == "string" && e.startsWith(".") ? this.modifiers.push(l("fontPreset", e)) : t.size !== void 0 && this.modifiers.push(l("fontSize", t.size))), this;
|
|
112
|
+
}
|
|
113
|
+
fontWeight(e) {
|
|
114
|
+
return this.modifiers.push(l("fontWeight", e)), this;
|
|
115
|
+
}
|
|
116
|
+
fontSize(e) {
|
|
117
|
+
return this.modifiers.push(l("fontSize", e)), this;
|
|
118
|
+
}
|
|
119
|
+
fontFamily(e) {
|
|
120
|
+
return this.modifiers.push(l("fontFamily", e)), this;
|
|
121
|
+
}
|
|
122
|
+
opacity(e) {
|
|
123
|
+
return this.modifiers.push(l("opacity", e)), this;
|
|
124
|
+
}
|
|
125
|
+
cornerRadius(e) {
|
|
126
|
+
return this.modifiers.push(l("cornerRadius", e)), this;
|
|
127
|
+
}
|
|
128
|
+
border(e, t) {
|
|
129
|
+
let i;
|
|
130
|
+
return typeof e == "object" ? i = e : i = {
|
|
131
|
+
style: "solid",
|
|
132
|
+
...e !== void 0 && { width: e },
|
|
133
|
+
...t !== void 0 && { color: t }
|
|
134
|
+
}, this.modifiers.push(l("border", i)), this;
|
|
135
|
+
}
|
|
136
|
+
borderWidth(e) {
|
|
137
|
+
return this.modifiers.push(l("border", { width: e })), this;
|
|
138
|
+
}
|
|
139
|
+
// Shadow functionality moved to @tachui/modifiers/effects entry point
|
|
140
|
+
// Visual Effects Modifiers (Phase 2 - Epic: Butternut)
|
|
141
|
+
blur(e) {
|
|
142
|
+
return this.modifiers.push(l("blur", e)), this;
|
|
143
|
+
}
|
|
144
|
+
brightness(e) {
|
|
145
|
+
return this.modifiers.push(l("brightness", e)), this;
|
|
146
|
+
}
|
|
147
|
+
contrast(e) {
|
|
148
|
+
return this.modifiers.push(l("contrast", e)), this;
|
|
149
|
+
}
|
|
150
|
+
saturation(e) {
|
|
151
|
+
return this.modifiers.push(l("saturation", e)), this;
|
|
152
|
+
}
|
|
153
|
+
hueRotation(e) {
|
|
154
|
+
return this.modifiers.push(l("hueRotation", e)), this;
|
|
155
|
+
}
|
|
156
|
+
grayscale(e) {
|
|
157
|
+
return this.modifiers.push(l("grayscale", e)), this;
|
|
158
|
+
}
|
|
159
|
+
colorInvert(e = 1) {
|
|
160
|
+
return this.modifiers.push(l("colorInvert", e)), this;
|
|
161
|
+
}
|
|
162
|
+
// ============================================================================
|
|
163
|
+
// VISUAL EFFECTS MOVED TO @tachui/modifiers/effects ENTRY
|
|
164
|
+
// ============================================================================
|
|
165
|
+
//
|
|
166
|
+
// Visual effects have been extracted to @tachui/modifiers/effects for better tree-shaking
|
|
167
|
+
// Visual effects methods removed - use @tachui/modifiers/effects
|
|
168
|
+
// Advanced gesture and interaction modifiers moved to @tachui/modifiers
|
|
169
|
+
// Available via Proxy when @tachui/modifiers is imported:
|
|
170
|
+
// - onLongPressGesture(), keyboardShortcut(), focused(), focusable(), onContinuousHover()
|
|
171
|
+
highPriorityGesture(e, t) {
|
|
172
|
+
return this.modifiers.push(l("highPriorityGesture", e, t)), this;
|
|
173
|
+
}
|
|
174
|
+
simultaneousGesture(e, t) {
|
|
175
|
+
return this.modifiers.push(l("simultaneousGesture", e, t)), this;
|
|
176
|
+
}
|
|
177
|
+
// allowsHitTesting() moved to @tachui/modifiers - available via Proxy when imported
|
|
178
|
+
// Animation modifiers
|
|
179
|
+
transform(e) {
|
|
180
|
+
return this.modifiers.push(l("transform", e)), this;
|
|
181
|
+
}
|
|
182
|
+
animation(e) {
|
|
183
|
+
return this.modifiers.push(l("animation", e)), this;
|
|
184
|
+
}
|
|
185
|
+
// Lifecycle modifiers
|
|
186
|
+
task(e, t) {
|
|
187
|
+
return this.modifiers.push(
|
|
188
|
+
l("task", {
|
|
189
|
+
operation: e,
|
|
190
|
+
id: t?.id,
|
|
191
|
+
priority: t?.priority || "default"
|
|
192
|
+
})
|
|
193
|
+
), this;
|
|
194
|
+
}
|
|
195
|
+
// Custom modifier application
|
|
196
|
+
/**
|
|
197
|
+
* @deprecated DO NOT USE - This is an internal API only.
|
|
198
|
+
* Always use direct modifier methods instead of .modifier()
|
|
199
|
+
*
|
|
200
|
+
* BAD: component.modifier(padding(16))
|
|
201
|
+
* GOOD: component.padding(16)
|
|
202
|
+
*
|
|
203
|
+
* If you need a modifier from @tachui/modifiers, import and use it directly:
|
|
204
|
+
* BAD: component.modifier(shadow({ radius: 4 }))
|
|
205
|
+
* GOOD: import { shadow } from '@tachui/modifiers'
|
|
206
|
+
* const mod = shadow({ radius: 4 })
|
|
207
|
+
* // Then apply via registry or component method
|
|
208
|
+
*/
|
|
209
|
+
modifier(e) {
|
|
210
|
+
return process.env.NODE_ENV === "development" && console.warn(
|
|
211
|
+
`⚠️ .modifier() should NOT be used by developers.
|
|
212
|
+
Use direct modifier methods instead:
|
|
213
|
+
BAD: component.modifier(padding(16))
|
|
214
|
+
GOOD: component.padding(16)
|
|
215
|
+
|
|
216
|
+
If the method doesn't exist on the component, import the modifier package:
|
|
217
|
+
import { shadowModifier } from '@tachui/modifiers'
|
|
218
|
+
|
|
219
|
+
This method is for internal framework use only.`
|
|
220
|
+
), this.modifiers.push(e), this;
|
|
221
|
+
}
|
|
222
|
+
// Public method to add a modifier (used by Proxy)
|
|
223
|
+
addModifierInternal(e) {
|
|
224
|
+
return this.modifiers.push(e), this;
|
|
225
|
+
}
|
|
226
|
+
// Resizable modifier for images
|
|
227
|
+
resizable() {
|
|
228
|
+
return this.modifiers.push(l("resizable")), this;
|
|
229
|
+
}
|
|
230
|
+
// Responsive Design Methods
|
|
231
|
+
/**
|
|
232
|
+
* Add modifier to internal list (used by responsive builder)
|
|
233
|
+
*/
|
|
234
|
+
addModifier(e) {
|
|
235
|
+
if (this.modifiers.push(e), "modifiers" in this.component && Array.isArray(this.component.modifiers)) {
|
|
236
|
+
const t = this.component;
|
|
237
|
+
t.modifiers = [
|
|
238
|
+
...t.modifiers,
|
|
239
|
+
e
|
|
240
|
+
];
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
// Responsive functionality moved to @tachui/responsive package
|
|
244
|
+
// Interaction modifiers
|
|
245
|
+
onTap(e) {
|
|
246
|
+
return this.modifiers.push(l("onTap", e)), this;
|
|
247
|
+
}
|
|
248
|
+
onFocus(e) {
|
|
249
|
+
return this.modifiers.push(l("onFocus", e)), this;
|
|
250
|
+
}
|
|
251
|
+
onBlur(e) {
|
|
252
|
+
return this.modifiers.push(l("onBlur", e)), this;
|
|
253
|
+
}
|
|
254
|
+
onKeyDown(e) {
|
|
255
|
+
return this.modifiers.push(l("onKeyDown", e)), this;
|
|
256
|
+
}
|
|
257
|
+
onScroll(e) {
|
|
258
|
+
return this.modifiers.push(l("onScroll", e)), this;
|
|
259
|
+
}
|
|
260
|
+
onKeyPress(e) {
|
|
261
|
+
return this.modifiers.push(l("onKeyPress", e)), this;
|
|
262
|
+
}
|
|
263
|
+
onKeyUp(e) {
|
|
264
|
+
return this.modifiers.push(l("onKeyUp", e)), this;
|
|
265
|
+
}
|
|
266
|
+
onDoubleClick(e) {
|
|
267
|
+
return this.modifiers.push(l("onDoubleClick", e)), this;
|
|
268
|
+
}
|
|
269
|
+
onContextMenu(e) {
|
|
270
|
+
return this.modifiers.push(l("onContextMenu", e)), this;
|
|
271
|
+
}
|
|
272
|
+
onWheel(e) {
|
|
273
|
+
return this.modifiers.push(l("onWheel", e)), this;
|
|
274
|
+
}
|
|
275
|
+
onInput(e) {
|
|
276
|
+
return this.modifiers.push(l("onInput", e)), this;
|
|
277
|
+
}
|
|
278
|
+
onChange(e) {
|
|
279
|
+
return this.modifiers.push(l("onChange", e)), this;
|
|
280
|
+
}
|
|
281
|
+
onCopy(e) {
|
|
282
|
+
return this.modifiers.push(l("onCopy", e)), this;
|
|
283
|
+
}
|
|
284
|
+
onCut(e) {
|
|
285
|
+
return this.modifiers.push(l("onCut", e)), this;
|
|
286
|
+
}
|
|
287
|
+
onPaste(e) {
|
|
288
|
+
return this.modifiers.push(l("onPaste", e)), this;
|
|
289
|
+
}
|
|
290
|
+
onSelect(e) {
|
|
291
|
+
return this.modifiers.push(l("onSelect", e)), this;
|
|
292
|
+
}
|
|
293
|
+
// Transition modifier moved to @tachui/modifiers:
|
|
294
|
+
// transition()
|
|
295
|
+
// HTML and ARIA Attributes moved to @tachui/modifiers
|
|
296
|
+
// Available via Proxy when @tachui/modifiers is imported:
|
|
297
|
+
// - id(), data(), aria(), tabIndex()
|
|
298
|
+
customProperties(e) {
|
|
299
|
+
throw new Error(
|
|
300
|
+
'CSS property modifiers have been moved to @tachui/modifiers. Please import { customProperties } from "@tachui/modifiers" and use it directly instead of chaining it on components.'
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
customProperty(e, t) {
|
|
304
|
+
throw new Error(
|
|
305
|
+
'CSS property modifiers have been moved to @tachui/modifiers. Please import { customProperty } from "@tachui/modifiers" and use it directly instead of chaining it on components.'
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
cssVariables(e) {
|
|
309
|
+
throw new Error(
|
|
310
|
+
'CSS property modifiers have been moved to @tachui/modifiers. Please import { cssVariables } from "@tachui/modifiers" and use it directly instead of chaining it on components.'
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
themeColors(e) {
|
|
314
|
+
throw new Error(
|
|
315
|
+
'Theme modifiers have been moved to @tachui/modifiers. Please import { themeColors } from "@tachui/modifiers" and use it directly instead of chaining it on components.'
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
designTokens(e) {
|
|
319
|
+
throw new Error(
|
|
320
|
+
'Design token modifiers have been moved to @tachui/modifiers. Please import { designTokens } from "@tachui/modifiers" and use it directly instead of chaining it on components.'
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
// State modifiers
|
|
324
|
+
disabled(e = !0) {
|
|
325
|
+
return this.modifiers.push(l("disabled", e)), this;
|
|
326
|
+
}
|
|
327
|
+
asHTML(e) {
|
|
328
|
+
const t = l("asHTML", e);
|
|
329
|
+
return this.modifiers.push(t), this;
|
|
330
|
+
}
|
|
331
|
+
// Build the final component with all modifiers applied
|
|
332
|
+
build() {
|
|
333
|
+
if ("modifiers" in this.component) {
|
|
334
|
+
const e = this.component, t = Array.isArray(
|
|
335
|
+
e.modifiers
|
|
336
|
+
) ? [...e.modifiers] : [], i = this.modifiers.filter(
|
|
337
|
+
(d) => !e.modifiers.some(
|
|
338
|
+
(u) => u === d
|
|
339
|
+
// Reference equality check
|
|
340
|
+
)
|
|
341
|
+
), s = [...t, ...i], r = e._originalComponent || e;
|
|
342
|
+
let o;
|
|
343
|
+
if (typeof r?.clone == "function")
|
|
344
|
+
o = r.clone();
|
|
345
|
+
else {
|
|
346
|
+
const d = r && Object.getPrototypeOf(r) || Object.prototype;
|
|
347
|
+
o = Object.create(d), Object.assign(o, r), o.props = { ...r.props }, o.cleanup = Array.isArray(r.cleanup) ? [...r.cleanup] : [], o.mounted = r.mounted ?? !1, o.id = r.id, o.type = r.type, o.render = typeof r.render == "function" ? r.render.bind(r) : () => [];
|
|
348
|
+
}
|
|
349
|
+
const a = k(
|
|
350
|
+
o,
|
|
351
|
+
s
|
|
352
|
+
);
|
|
353
|
+
return process.env.NODE_ENV === "test" && this.applyModifiersToPropsForTesting(
|
|
354
|
+
a,
|
|
355
|
+
s
|
|
356
|
+
), a;
|
|
357
|
+
} else {
|
|
358
|
+
const e = k(
|
|
359
|
+
this.component,
|
|
360
|
+
this.modifiers
|
|
361
|
+
);
|
|
362
|
+
return process.env.NODE_ENV === "test" && this.applyModifiersToPropsForTesting(
|
|
363
|
+
e,
|
|
364
|
+
this.modifiers
|
|
365
|
+
), e;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
applyModifiersToPropsForTesting(e, t) {
|
|
369
|
+
e.props || (e.props = {}), t.forEach((i) => {
|
|
370
|
+
if (i.type === "aria") {
|
|
371
|
+
const r = i.properties?.aria || {};
|
|
372
|
+
Object.entries(r).forEach(([o, a]) => {
|
|
373
|
+
if (a != null)
|
|
374
|
+
if (o === "role")
|
|
375
|
+
e.props.role = a;
|
|
376
|
+
else {
|
|
377
|
+
const d = o.startsWith("aria-") ? o : `aria-${o}`;
|
|
378
|
+
e.props[d] = typeof a == "boolean" ? a : String(a);
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
} else if (K.has(i.type)) {
|
|
382
|
+
const r = i.properties || {};
|
|
383
|
+
Object.entries(r).forEach(([o, a]) => {
|
|
384
|
+
typeof a == "function" && (e.props[o] = a);
|
|
385
|
+
});
|
|
386
|
+
} else if (i.type === "interaction") {
|
|
387
|
+
const r = i.properties;
|
|
388
|
+
Object.entries(r).forEach(([o, a]) => {
|
|
389
|
+
typeof a == "function" && (e.props[o] = a);
|
|
390
|
+
}), (r.onSwipeLeft || r.onSwipeRight) && (e.props.onTouchStart = () => {
|
|
391
|
+
});
|
|
392
|
+
} else if (i.type === "utility") {
|
|
393
|
+
const r = i.properties;
|
|
394
|
+
e.props.style || (e.props.style = {}), Object.entries(r).forEach(([o, a]) => {
|
|
395
|
+
a != null && (e.props.style[o] = a);
|
|
396
|
+
});
|
|
397
|
+
} else if (i.type === "tabIndex") {
|
|
398
|
+
const s = i;
|
|
399
|
+
e.props.tabIndex = s.properties?.tabIndex;
|
|
400
|
+
} else if (i.type === "appearance") {
|
|
401
|
+
const r = i.properties;
|
|
402
|
+
e.props.style || (e.props.style = {}), r.backgroundColor && (e.props.style.backgroundColor = r.backgroundColor), r.foregroundColor && (e.props.style.color = r.foregroundColor), r.opacity !== void 0 && (e.props.style.opacity = r.opacity), r.role !== void 0 && (e.props.role = String(r.role)), r["aria-label"] !== void 0 && (e.props["aria-label"] = String(r["aria-label"])), r["aria-live"] !== void 0 && (e.props["aria-live"] = String(r["aria-live"])), r["aria-describedby"] !== void 0 && (e.props["aria-describedby"] = String(
|
|
403
|
+
r["aria-describedby"]
|
|
404
|
+
)), r["aria-modal"] !== void 0 && (e.props["aria-modal"] = r["aria-modal"] === "true" || r["aria-modal"] === !0), r["aria-hidden"] !== void 0 && (e.props["aria-hidden"] = String(r["aria-hidden"])), r.navigationTitle !== void 0 && (e.props.navigationTitle = String(r.navigationTitle)), r.navigationBarHidden !== void 0 && (e.props.navigationBarHidden = r.navigationBarHidden, r.navigationBarHidden && (e.props["aria-hidden"] = "true")), r.navigationBarItems !== void 0 && (e.props.navigationBarItems = r.navigationBarItems);
|
|
405
|
+
} else if (i.type === "foreground") {
|
|
406
|
+
const r = i.properties || {};
|
|
407
|
+
r.color !== void 0 && (e.props.style || (e.props.style = {}), e.props.style.color = r.color);
|
|
408
|
+
} else if (i.type === "background") {
|
|
409
|
+
const r = i.properties || {};
|
|
410
|
+
r.background !== void 0 && (e.props.style || (e.props.style = {}), e.props.style.background = r.background, typeof r.background == "string" && (e.props.style.backgroundColor = r.background));
|
|
411
|
+
} else if (i.type === "transition") {
|
|
412
|
+
const r = i.properties;
|
|
413
|
+
e.props.style || (e.props.style = {}), r.transition && (e.props.style.transition = r.transition);
|
|
414
|
+
} else if (i.type === "size") {
|
|
415
|
+
const r = i.properties;
|
|
416
|
+
e.props.style || (e.props.style = {}), r.minHeight !== void 0 && (e.props.style.minHeight = r.minHeight), r.minWidth !== void 0 && (e.props.style.minWidth = r.minWidth), r.maxHeight !== void 0 && (e.props.style.maxHeight = r.maxHeight), r.maxWidth !== void 0 && (e.props.style.maxWidth = r.maxWidth), r.width !== void 0 && (e.props.style.width = r.width), r.height !== void 0 && (e.props.style.height = r.height);
|
|
417
|
+
} else if (i.type === "css") {
|
|
418
|
+
const r = i.properties;
|
|
419
|
+
e.props.style || (e.props.style = {}), Object.entries(r).forEach(([o, a]) => {
|
|
420
|
+
a != null && (e.props.style[o] = a);
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
// ============================================================================
|
|
426
|
+
// MISSING MODIFIER METHODS - ACCESSIBILITY & NAVIGATION
|
|
427
|
+
// ============================================================================
|
|
428
|
+
// Individual ARIA methods for better developer experience
|
|
429
|
+
role(e) {
|
|
430
|
+
return this.modifiers.push(l("role", e)), this;
|
|
431
|
+
}
|
|
432
|
+
ariaLabel(e) {
|
|
433
|
+
return this.modifiers.push(l("ariaLabel", e)), this;
|
|
434
|
+
}
|
|
435
|
+
ariaLive(e) {
|
|
436
|
+
return this.modifiers.push(l("ariaLive", e)), this;
|
|
437
|
+
}
|
|
438
|
+
ariaDescribedBy(e) {
|
|
439
|
+
return this.modifiers.push(l("ariaDescribedBy", e)), this;
|
|
440
|
+
}
|
|
441
|
+
ariaModal(e) {
|
|
442
|
+
return this.modifiers.push(l("ariaModal", e)), this;
|
|
443
|
+
}
|
|
444
|
+
// Touch and gesture events
|
|
445
|
+
onTouchStart(e) {
|
|
446
|
+
return this.modifiers.push(l("onTouchStart", e)), this;
|
|
447
|
+
}
|
|
448
|
+
onTouchMove(e) {
|
|
449
|
+
return this.modifiers.push(l("onTouchMove", e)), this;
|
|
450
|
+
}
|
|
451
|
+
onTouchEnd(e) {
|
|
452
|
+
return this.modifiers.push(l("onTouchEnd", e)), this;
|
|
453
|
+
}
|
|
454
|
+
// Swipe gestures (simplified implementations)
|
|
455
|
+
onSwipeLeft(e) {
|
|
456
|
+
return this.modifiers.push(l("onSwipeLeft", e)), this;
|
|
457
|
+
}
|
|
458
|
+
onSwipeRight(e) {
|
|
459
|
+
return this.modifiers.push(l("onSwipeRight", e)), this;
|
|
460
|
+
}
|
|
461
|
+
// Navigation methods - these delegate to the navigation package functions
|
|
462
|
+
navigationTitle(e) {
|
|
463
|
+
return this.modifiers.push(l("navigationTitle", e)), this;
|
|
464
|
+
}
|
|
465
|
+
navigationBarHidden(e = !0) {
|
|
466
|
+
return this.modifiers.push(l("navigationBarHidden", e)), this;
|
|
467
|
+
}
|
|
468
|
+
navigationBarItems(e) {
|
|
469
|
+
return this.modifiers.push(l("navigationBarItems", e)), this;
|
|
470
|
+
}
|
|
471
|
+
// ============================================================================
|
|
472
|
+
// MISSING TRANSITION METHODS
|
|
473
|
+
// ============================================================================
|
|
474
|
+
transitions(e) {
|
|
475
|
+
return this.modifiers.push(l("transitions", e)), this;
|
|
476
|
+
}
|
|
477
|
+
// All transition methods moved to @tachui/modifiers:
|
|
478
|
+
// fadeTransition(), transformTransition(), colorTransition(), layoutTransition(),
|
|
479
|
+
// buttonTransition(), cardTransition(), modalTransition(), smoothTransition(),
|
|
480
|
+
// quickTransition(), slowTransition()
|
|
481
|
+
// ============================================================================
|
|
482
|
+
// SCROLL METHODS - ALL MOVED TO @tachui/modifiers
|
|
483
|
+
// ============================================================================
|
|
484
|
+
// scroll(), scrollBehavior(), overscrollBehavior(), overscrollBehaviorX(),
|
|
485
|
+
// overscrollBehaviorY(), scrollMargin(), scrollPadding(), scrollSnap()
|
|
486
|
+
// ============================================================================
|
|
487
|
+
// MIGRATED MODIFIERS - NOW IN SPECIALIZED PACKAGES
|
|
488
|
+
// ============================================================================
|
|
489
|
+
// Viewport lifecycle modifiers - moved to @tachui/viewport
|
|
490
|
+
onAppear(e) {
|
|
491
|
+
throw new Error(
|
|
492
|
+
'onAppear modifier has been moved to @tachui/viewport. Please import { onAppear } from "@tachui/viewport/modifiers" and use it directly instead of chaining it on components.'
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
onDisappear(e) {
|
|
496
|
+
throw new Error(
|
|
497
|
+
'onDisappear modifier has been moved to @tachui/viewport. Please import { onDisappear } from "@tachui/viewport/modifiers" and use it directly instead of chaining it on components.'
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
// Mobile gesture modifiers - moved to @tachui/mobile
|
|
501
|
+
refreshable(e, t) {
|
|
502
|
+
throw new Error(
|
|
503
|
+
'refreshable modifier has been moved to @tachui/mobile. Please import { refreshable } from "@tachui/mobile/modifiers" and use it directly instead of chaining it on components.'
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
// onAppear and onDisappear have been moved to @tachui/viewport/modifiers
|
|
507
|
+
// to maintain proper architectural boundaries
|
|
508
|
+
// Transform modifiers
|
|
509
|
+
scaleEffect(e, t, i) {
|
|
510
|
+
return this.modifiers.push(l("scaleEffect", e, t, i)), this;
|
|
511
|
+
}
|
|
512
|
+
// Shadow and clipping modifiers moved to @tachui/modifiers
|
|
513
|
+
// Available via Proxy when @tachui/modifiers is imported:
|
|
514
|
+
// - shadow(), textShadow(), shadows(), shadowPreset(), clipped()
|
|
515
|
+
}
|
|
516
|
+
function O(n) {
|
|
517
|
+
const e = new q(n);
|
|
518
|
+
return new Proxy(e, {
|
|
519
|
+
get(t, i, s) {
|
|
520
|
+
if (i in t) {
|
|
521
|
+
const r = t[i];
|
|
522
|
+
return typeof r == "function" ? function(...o) {
|
|
523
|
+
const a = r.apply(s, o);
|
|
524
|
+
return a === t ? s : a;
|
|
525
|
+
} : r;
|
|
526
|
+
}
|
|
527
|
+
if (typeof i == "string") {
|
|
528
|
+
const r = B();
|
|
529
|
+
if (i === "responsive")
|
|
530
|
+
return function(...o) {
|
|
531
|
+
const a = o[0];
|
|
532
|
+
if (a) {
|
|
533
|
+
const d = l(i, a);
|
|
534
|
+
this.addModifierInternal(d);
|
|
535
|
+
}
|
|
536
|
+
return s;
|
|
537
|
+
};
|
|
538
|
+
if (i === "base" || i === "sm" || i === "md" || i === "lg" || i === "xl" || i === "2xl")
|
|
539
|
+
return new Proxy({}, {
|
|
540
|
+
get(o, a) {
|
|
541
|
+
if (typeof a == "string")
|
|
542
|
+
return (...d) => {
|
|
543
|
+
const u = { [a]: { [i]: d[0] } }, b = l("responsive", u);
|
|
544
|
+
return t.addModifierInternal(b), s;
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
if (r.has(i))
|
|
549
|
+
return function(...o) {
|
|
550
|
+
const a = l(i, ...o);
|
|
551
|
+
return this.addModifierInternal(a), s;
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
function _e(n, e) {
|
|
558
|
+
return {
|
|
559
|
+
...n,
|
|
560
|
+
modifiers: e,
|
|
561
|
+
modifierBuilder: O(n)
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
const Te = {
|
|
565
|
+
/**
|
|
566
|
+
* Create a padding modifier with all sides
|
|
567
|
+
*/
|
|
568
|
+
paddingAll(n) {
|
|
569
|
+
return l("padding", { all: n });
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
class Z {
|
|
573
|
+
register(e, t) {
|
|
574
|
+
C.register(e, t);
|
|
575
|
+
}
|
|
576
|
+
get(e) {
|
|
577
|
+
return C.get(e);
|
|
578
|
+
}
|
|
579
|
+
has(e) {
|
|
580
|
+
return C.has(e);
|
|
581
|
+
}
|
|
582
|
+
list() {
|
|
583
|
+
return C.list();
|
|
584
|
+
}
|
|
585
|
+
clear() {
|
|
586
|
+
C.clear();
|
|
587
|
+
}
|
|
588
|
+
validateRegistry() {
|
|
589
|
+
return C.validateRegistry();
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
const J = new Z();
|
|
593
|
+
process.env.NODE_ENV === "development" && console.log("📤 Created RegistryAdapter for globalModifierRegistry", {
|
|
594
|
+
registryId: C.instanceId,
|
|
595
|
+
currentSize: C.list().length
|
|
596
|
+
});
|
|
597
|
+
function Re() {
|
|
598
|
+
return J;
|
|
599
|
+
}
|
|
600
|
+
function H(n, e, t = {}, i = {}) {
|
|
601
|
+
if (!e.length) return n;
|
|
602
|
+
const s = {
|
|
603
|
+
componentId: t.componentId || "unknown",
|
|
604
|
+
phase: t.phase || "creation",
|
|
605
|
+
...t.element && { element: t.element },
|
|
606
|
+
...t.parentElement && { parentElement: t.parentElement },
|
|
607
|
+
...t.componentInstance && {
|
|
608
|
+
componentInstance: t.componentInstance
|
|
609
|
+
},
|
|
610
|
+
...t.previousModifiers && {
|
|
611
|
+
previousModifiers: t.previousModifiers
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
switch (i.batch ? "batch" : "sequential") {
|
|
615
|
+
case "batch":
|
|
616
|
+
return Q(n, e, s, i);
|
|
617
|
+
default:
|
|
618
|
+
return Y(n, e, s, i);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
function Y(n, e, t, i) {
|
|
622
|
+
const s = [...e].sort(
|
|
623
|
+
(d, u) => d.priority - u.priority
|
|
624
|
+
);
|
|
625
|
+
let r = n;
|
|
626
|
+
const o = [], a = [];
|
|
627
|
+
for (const d of s)
|
|
628
|
+
try {
|
|
629
|
+
const u = d.apply(r, t);
|
|
630
|
+
u && typeof u == "object" && "type" in u && (r = u), i.immediate && !i.suppressEffects && (o.forEach((b) => b()), o.length = 0);
|
|
631
|
+
} catch (u) {
|
|
632
|
+
console.error(`Failed to apply modifier ${d.type}:`, u);
|
|
633
|
+
}
|
|
634
|
+
if (a.length > 0) {
|
|
635
|
+
const d = r.dispose;
|
|
636
|
+
r.dispose = () => {
|
|
637
|
+
a.forEach((u) => u()), d && d();
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
return r;
|
|
641
|
+
}
|
|
642
|
+
function Q(n, e, t, i) {
|
|
643
|
+
const s = X(e);
|
|
644
|
+
let r = n;
|
|
645
|
+
const o = [], a = [];
|
|
646
|
+
for (const [d, u] of s)
|
|
647
|
+
try {
|
|
648
|
+
r = ee(r, u, t);
|
|
649
|
+
} catch (b) {
|
|
650
|
+
(typeof process > "u" || process.env.NODE_ENV !== "test") && console.error(`Failed to apply modifier group ${d}:`, b);
|
|
651
|
+
}
|
|
652
|
+
if (i.suppressEffects || o.forEach((d) => d()), a.length > 0) {
|
|
653
|
+
const d = r.dispose;
|
|
654
|
+
r.dispose = () => {
|
|
655
|
+
a.forEach((u) => u()), d && d();
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
return r;
|
|
659
|
+
}
|
|
660
|
+
function X(n) {
|
|
661
|
+
const e = /* @__PURE__ */ new Map();
|
|
662
|
+
for (const t of n) {
|
|
663
|
+
const i = e.get(t.type) || [];
|
|
664
|
+
i.push(t), e.set(t.type, i);
|
|
665
|
+
}
|
|
666
|
+
return e;
|
|
667
|
+
}
|
|
668
|
+
function ee(n, e, t) {
|
|
669
|
+
const i = [...e].sort(
|
|
670
|
+
(r, o) => r.priority - o.priority
|
|
671
|
+
);
|
|
672
|
+
let s = n;
|
|
673
|
+
for (const r of i)
|
|
674
|
+
try {
|
|
675
|
+
const o = r.apply(s, t);
|
|
676
|
+
o && typeof o == "object" && "type" in o && (s = o);
|
|
677
|
+
} catch (o) {
|
|
678
|
+
(typeof process > "u" || process.env.NODE_ENV !== "test") && console.error(`Failed to apply modifier ${r.type}:`, o);
|
|
679
|
+
}
|
|
680
|
+
return s;
|
|
681
|
+
}
|
|
682
|
+
function te(n) {
|
|
683
|
+
return n && typeof n.concat == "function" && typeof n.toSegment == "function" && typeof n.isConcatenatable == "function";
|
|
684
|
+
}
|
|
685
|
+
function k(n, e = []) {
|
|
686
|
+
const t = {
|
|
687
|
+
type: n.type,
|
|
688
|
+
id: n.id,
|
|
689
|
+
props: { ...n.props },
|
|
690
|
+
mounted: n.mounted,
|
|
691
|
+
cleanup: n.cleanup ? [...n.cleanup] : [],
|
|
692
|
+
modifiers: [...e],
|
|
693
|
+
modifierBuilder: null,
|
|
694
|
+
// Will be set after component is created
|
|
695
|
+
render: n.render ? n.render.bind(n) : () => [],
|
|
696
|
+
// Bind to original component or provide default
|
|
697
|
+
// Store reference to original component for modifier context
|
|
698
|
+
_originalComponent: n
|
|
699
|
+
};
|
|
700
|
+
t.modifierBuilder = O(
|
|
701
|
+
t
|
|
702
|
+
), t.modifier = t.modifierBuilder, Object.prototype.hasOwnProperty.call(n, "modifier") || Object.defineProperty(n, "modifier", {
|
|
703
|
+
configurable: !0,
|
|
704
|
+
enumerable: !1,
|
|
705
|
+
get() {
|
|
706
|
+
return t.modifierBuilder;
|
|
707
|
+
}
|
|
708
|
+
}), n.modifiableComponent = t;
|
|
709
|
+
const i = n._enhancedLifecycle;
|
|
710
|
+
i && (t._enhancedLifecycle = i, "domElements" in n && (t.domElements = n.domElements), "primaryElement" in n && (t.primaryElement = n.primaryElement), "domReady" in n && (t.domReady = n.domReady), "children" in n && (t.children = n.children));
|
|
711
|
+
const s = n.render ? n.render.bind(n) : () => [];
|
|
712
|
+
return t.render = () => {
|
|
713
|
+
const r = s();
|
|
714
|
+
return (Array.isArray(r) ? r : [r]).map((a, d) => (a && typeof a == "object" && (d === 0 ? (a.modifiers = [...t.modifiers], a.componentId = n.id, a._originalComponent = t._originalComponent) : (a.modifiers && delete a.modifiers, a.componentId && a.componentId === n.id && delete a.componentId)), a));
|
|
715
|
+
}, te(n) && (t.concat = function(r) {
|
|
716
|
+
const o = {
|
|
717
|
+
id: t.id,
|
|
718
|
+
component: t,
|
|
719
|
+
modifiers: t.modifiers,
|
|
720
|
+
render: () => {
|
|
721
|
+
const u = t.render();
|
|
722
|
+
return Array.isArray(u) ? u[0] : u;
|
|
723
|
+
}
|
|
724
|
+
}, a = r.toSegment(), d = {
|
|
725
|
+
totalSegments: r instanceof M ? r.segments.length + 1 : 2,
|
|
726
|
+
accessibilityRole: "text",
|
|
727
|
+
// Simplified for now
|
|
728
|
+
semanticStructure: "inline"
|
|
729
|
+
// Simplified for now
|
|
730
|
+
};
|
|
731
|
+
return r instanceof M ? new M(
|
|
732
|
+
[o, ...r.segments],
|
|
733
|
+
d
|
|
734
|
+
) : new M([o, a], d);
|
|
735
|
+
}, t.toSegment = function() {
|
|
736
|
+
return {
|
|
737
|
+
id: t.id,
|
|
738
|
+
component: t,
|
|
739
|
+
modifiers: t.modifiers,
|
|
740
|
+
render: () => {
|
|
741
|
+
const r = t.render();
|
|
742
|
+
return Array.isArray(r) ? r[0] : r;
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
}, t.isConcatenatable = function() {
|
|
746
|
+
return !0;
|
|
747
|
+
}), typeof n?.clone == "function" && (t.clone = (r) => {
|
|
748
|
+
const o = n.clone(r);
|
|
749
|
+
return k(
|
|
750
|
+
o,
|
|
751
|
+
[...t.modifiers]
|
|
752
|
+
);
|
|
753
|
+
}), t;
|
|
754
|
+
}
|
|
755
|
+
function Ie(n, e, t = {}) {
|
|
756
|
+
n.modifiers = [...e], n.mounted && n.context;
|
|
757
|
+
}
|
|
758
|
+
const Pe = {
|
|
759
|
+
/**
|
|
760
|
+
* Check if a component has specific modifier types
|
|
761
|
+
*/
|
|
762
|
+
hasModifierOfType(n, e) {
|
|
763
|
+
return n.modifiers.some((t) => t.type === e);
|
|
764
|
+
},
|
|
765
|
+
/**
|
|
766
|
+
* Get modifiers of a specific type from a component
|
|
767
|
+
*/
|
|
768
|
+
getModifiersOfType(n, e) {
|
|
769
|
+
return n.modifiers.filter((t) => t.type === e);
|
|
770
|
+
},
|
|
771
|
+
/**
|
|
772
|
+
* Remove modifiers of a specific type from a component
|
|
773
|
+
*/
|
|
774
|
+
removeModifiersOfType(n, e) {
|
|
775
|
+
n.modifiers = n.modifiers.filter(
|
|
776
|
+
(t) => t.type !== e
|
|
777
|
+
);
|
|
778
|
+
},
|
|
779
|
+
/**
|
|
780
|
+
* Replace modifiers of a specific type
|
|
781
|
+
*/
|
|
782
|
+
replaceModifiersOfType(n, e, t) {
|
|
783
|
+
n.modifiers = n.modifiers.filter(
|
|
784
|
+
(i) => i.type !== e
|
|
785
|
+
), n.modifiers.push(...t);
|
|
786
|
+
},
|
|
787
|
+
/**
|
|
788
|
+
* Get the total number of modifiers on a component
|
|
789
|
+
*/
|
|
790
|
+
getModifierCount(n) {
|
|
791
|
+
return n.modifiers.length;
|
|
792
|
+
},
|
|
793
|
+
/**
|
|
794
|
+
* Check if two modifier arrays are equivalent
|
|
795
|
+
*/
|
|
796
|
+
areModifiersEqual(n, e) {
|
|
797
|
+
if (n.length !== e.length) return !1;
|
|
798
|
+
for (let t = 0; t < n.length; t++) {
|
|
799
|
+
const i = n[t], s = e[t];
|
|
800
|
+
if (i.type !== s.type || i.priority !== s.priority || JSON.stringify(i.properties) !== JSON.stringify(s.properties))
|
|
801
|
+
return !1;
|
|
802
|
+
}
|
|
803
|
+
return !0;
|
|
804
|
+
}
|
|
805
|
+
}, ie = /* @__PURE__ */ new Set([
|
|
806
|
+
// Container tags
|
|
807
|
+
"div",
|
|
808
|
+
"section",
|
|
809
|
+
"article",
|
|
810
|
+
"aside",
|
|
811
|
+
"nav",
|
|
812
|
+
"main",
|
|
813
|
+
"header",
|
|
814
|
+
"footer",
|
|
815
|
+
// Heading tags
|
|
816
|
+
"h1",
|
|
817
|
+
"h2",
|
|
818
|
+
"h3",
|
|
819
|
+
"h4",
|
|
820
|
+
"h5",
|
|
821
|
+
"h6",
|
|
822
|
+
// Content tags
|
|
823
|
+
"p",
|
|
824
|
+
"span",
|
|
825
|
+
"strong",
|
|
826
|
+
"em",
|
|
827
|
+
"code",
|
|
828
|
+
"pre",
|
|
829
|
+
"blockquote",
|
|
830
|
+
"address",
|
|
831
|
+
// List tags
|
|
832
|
+
"ul",
|
|
833
|
+
"ol",
|
|
834
|
+
"li",
|
|
835
|
+
"dl",
|
|
836
|
+
"dt",
|
|
837
|
+
"dd",
|
|
838
|
+
// Interactive tags (with warnings)
|
|
839
|
+
"button",
|
|
840
|
+
"a",
|
|
841
|
+
"input",
|
|
842
|
+
"textarea",
|
|
843
|
+
"select",
|
|
844
|
+
"form",
|
|
845
|
+
"label",
|
|
846
|
+
// Media tags
|
|
847
|
+
"img",
|
|
848
|
+
"video",
|
|
849
|
+
"audio",
|
|
850
|
+
"canvas",
|
|
851
|
+
"svg",
|
|
852
|
+
"picture",
|
|
853
|
+
"source",
|
|
854
|
+
// Table tags
|
|
855
|
+
"table",
|
|
856
|
+
"thead",
|
|
857
|
+
"tbody",
|
|
858
|
+
"tfoot",
|
|
859
|
+
"tr",
|
|
860
|
+
"th",
|
|
861
|
+
"td",
|
|
862
|
+
"caption",
|
|
863
|
+
"colgroup",
|
|
864
|
+
"col",
|
|
865
|
+
// Form tags
|
|
866
|
+
"fieldset",
|
|
867
|
+
"legend",
|
|
868
|
+
"optgroup",
|
|
869
|
+
"option",
|
|
870
|
+
"datalist",
|
|
871
|
+
"output",
|
|
872
|
+
"progress",
|
|
873
|
+
"meter",
|
|
874
|
+
// Interactive content
|
|
875
|
+
"details",
|
|
876
|
+
"summary",
|
|
877
|
+
"dialog",
|
|
878
|
+
// Text semantics
|
|
879
|
+
"abbr",
|
|
880
|
+
"cite",
|
|
881
|
+
"dfn",
|
|
882
|
+
"kbd",
|
|
883
|
+
"mark",
|
|
884
|
+
"q",
|
|
885
|
+
"s",
|
|
886
|
+
"samp",
|
|
887
|
+
"small",
|
|
888
|
+
"sub",
|
|
889
|
+
"sup",
|
|
890
|
+
"time",
|
|
891
|
+
"u",
|
|
892
|
+
"var",
|
|
893
|
+
// Document sections
|
|
894
|
+
"body",
|
|
895
|
+
"head",
|
|
896
|
+
"title",
|
|
897
|
+
"base",
|
|
898
|
+
"link",
|
|
899
|
+
"meta",
|
|
900
|
+
"style",
|
|
901
|
+
"script",
|
|
902
|
+
"noscript",
|
|
903
|
+
// Embedded content
|
|
904
|
+
"embed",
|
|
905
|
+
"iframe",
|
|
906
|
+
"object",
|
|
907
|
+
"param",
|
|
908
|
+
"track",
|
|
909
|
+
"map",
|
|
910
|
+
"area",
|
|
911
|
+
// Interactive elements
|
|
912
|
+
"menu",
|
|
913
|
+
"menuitem"
|
|
914
|
+
]), N = /* @__PURE__ */ new Map([
|
|
915
|
+
["nav", { role: "navigation", applyARIA: !0 }],
|
|
916
|
+
["main", { role: "main", applyARIA: !0 }],
|
|
917
|
+
["article", { role: "article", applyARIA: !0 }],
|
|
918
|
+
["section", { role: "region", applyARIA: !0 }],
|
|
919
|
+
["aside", { role: "complementary", applyARIA: !0 }],
|
|
920
|
+
["header", { role: "banner", applyARIA: !1 }],
|
|
921
|
+
// Context dependent - may not always be page banner
|
|
922
|
+
["footer", { role: "contentinfo", applyARIA: !1 }],
|
|
923
|
+
// Context dependent - may not always be page footer
|
|
924
|
+
["form", { role: "form", applyARIA: !0 }],
|
|
925
|
+
["search", { role: "search", applyARIA: !0 }],
|
|
926
|
+
["dialog", { role: "dialog", applyARIA: !0 }],
|
|
927
|
+
["button", { role: "button", applyARIA: !1 }],
|
|
928
|
+
// Usually implicit
|
|
929
|
+
["a", { role: "link", applyARIA: !1 }]
|
|
930
|
+
// Usually implicit
|
|
931
|
+
]), re = /* @__PURE__ */ new Map([
|
|
932
|
+
// Layout Components - Ideal for semantic containers (Warning Level: None)
|
|
933
|
+
[
|
|
934
|
+
"HStack",
|
|
935
|
+
{
|
|
936
|
+
warningLevel: "none",
|
|
937
|
+
idealTags: [
|
|
938
|
+
"nav",
|
|
939
|
+
"header",
|
|
940
|
+
"footer",
|
|
941
|
+
"section",
|
|
942
|
+
"article",
|
|
943
|
+
"aside",
|
|
944
|
+
"main",
|
|
945
|
+
"div"
|
|
946
|
+
]
|
|
947
|
+
}
|
|
948
|
+
],
|
|
949
|
+
[
|
|
950
|
+
"VStack",
|
|
951
|
+
{
|
|
952
|
+
warningLevel: "none",
|
|
953
|
+
idealTags: [
|
|
954
|
+
"main",
|
|
955
|
+
"section",
|
|
956
|
+
"article",
|
|
957
|
+
"aside",
|
|
958
|
+
"header",
|
|
959
|
+
"footer",
|
|
960
|
+
"div"
|
|
961
|
+
]
|
|
962
|
+
}
|
|
963
|
+
],
|
|
964
|
+
[
|
|
965
|
+
"ZStack",
|
|
966
|
+
{ warningLevel: "none", idealTags: ["article", "aside", "section", "div"] }
|
|
967
|
+
],
|
|
968
|
+
// Content Components - Common for specific overrides (Warning Level: None for appropriate tags)
|
|
969
|
+
[
|
|
970
|
+
"Text",
|
|
971
|
+
{
|
|
972
|
+
warningLevel: "none",
|
|
973
|
+
idealTags: [
|
|
974
|
+
"h1",
|
|
975
|
+
"h2",
|
|
976
|
+
"h3",
|
|
977
|
+
"h4",
|
|
978
|
+
"h5",
|
|
979
|
+
"h6",
|
|
980
|
+
"p",
|
|
981
|
+
"span",
|
|
982
|
+
"strong",
|
|
983
|
+
"em"
|
|
984
|
+
]
|
|
985
|
+
}
|
|
986
|
+
],
|
|
987
|
+
[
|
|
988
|
+
"Image",
|
|
989
|
+
{ warningLevel: "warning", problematicTags: ["figure", "picture"] }
|
|
990
|
+
],
|
|
991
|
+
// May break functionality
|
|
992
|
+
["Spacer", { warningLevel: "none" }],
|
|
993
|
+
// Interactive Components - Use with warnings
|
|
994
|
+
[
|
|
995
|
+
"Button",
|
|
996
|
+
{ warningLevel: "warning", problematicTags: ["div", "span", "a"] }
|
|
997
|
+
],
|
|
998
|
+
// May break accessibility
|
|
999
|
+
[
|
|
1000
|
+
"Link",
|
|
1001
|
+
{ warningLevel: "warning", problematicTags: ["div", "span", "button"] }
|
|
1002
|
+
]
|
|
1003
|
+
// May break navigation
|
|
1004
|
+
]);
|
|
1005
|
+
function se(n, e) {
|
|
1006
|
+
const t = re.get(n);
|
|
1007
|
+
return t ? t.warningLevel === "none" ? !1 : t.warningLevel === "warning" && t.problematicTags ? t.problematicTags.includes(e) : !(t.idealTags && t.idealTags.includes(e)) : !0;
|
|
1008
|
+
}
|
|
1009
|
+
class ne {
|
|
1010
|
+
static validate(e, t) {
|
|
1011
|
+
return ie.has(e) ? {
|
|
1012
|
+
valid: !0,
|
|
1013
|
+
warnings: this.checkSemanticWarnings(e, t),
|
|
1014
|
+
semanticRole: N.get(e)
|
|
1015
|
+
} : (process.env.NODE_ENV !== "production" && console.error(
|
|
1016
|
+
`Invalid tag '${e}' for component type '${t}'`
|
|
1017
|
+
), {
|
|
1018
|
+
valid: !1,
|
|
1019
|
+
warning: `Invalid HTML tag '${e}' specified for ${t}. Tag will be used as-is.`,
|
|
1020
|
+
severity: "error"
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
static checkSemanticWarnings(e, t) {
|
|
1024
|
+
const i = [];
|
|
1025
|
+
if (["button", "a", "input", "select", "textarea"].includes(e) && ["HStack", "VStack", "ZStack"].includes(t)) {
|
|
1026
|
+
const s = `Using interactive tag '${e}' on layout component ${t} may cause accessibility issues.`;
|
|
1027
|
+
i.push({ message: s, severity: "warning" }), process.env.NODE_ENV !== "production" && console.warn(
|
|
1028
|
+
`Interactive tag '${e}' on layout component '${t}' may cause unexpected behavior`
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
1031
|
+
if (e === "li" && !["VStack", "HStack"].includes(t) && (i.push({ message: "<li> tags should typically be used within list structures.", severity: "info" }), process.env.NODE_ENV !== "production" && console.info(
|
|
1032
|
+
`Consider using '${e}' within <ul> or <ol> structure for component '${t}'`
|
|
1033
|
+
)), ["h1", "h2", "h3", "h4", "h5", "h6"].includes(e) && ["HStack", "VStack", "ZStack"].includes(t)) {
|
|
1034
|
+
const s = `Using heading tag '${e}' on layout component ${t}. Consider using Text component instead.`;
|
|
1035
|
+
i.push({ message: s, severity: "info" }), process.env.NODE_ENV !== "production" && console.info(
|
|
1036
|
+
`Heading tag '${e}' is better suited for Text components than '${t}'`
|
|
1037
|
+
);
|
|
1038
|
+
}
|
|
1039
|
+
if (["form", "fieldset", "legend"].includes(e) && !["VStack", "HStack", "Form"].includes(t)) {
|
|
1040
|
+
const s = `Form tag '${e}' used on ${t}. Ensure proper form semantics.`;
|
|
1041
|
+
i.push({ message: s, severity: "info" }), process.env.NODE_ENV !== "production" && console.info(
|
|
1042
|
+
`Form tag '${e}' requires proper semantic context for component '${t}'`
|
|
1043
|
+
);
|
|
1044
|
+
}
|
|
1045
|
+
return i;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
let L = {
|
|
1049
|
+
autoApplySemanticRoles: !0,
|
|
1050
|
+
warnOnOverrides: process.env.NODE_ENV !== "production",
|
|
1051
|
+
warnOnSemanticIssues: process.env.NODE_ENV !== "production",
|
|
1052
|
+
validateTags: !0,
|
|
1053
|
+
allowInvalidTags: !0
|
|
1054
|
+
};
|
|
1055
|
+
function ke(n) {
|
|
1056
|
+
L = { ...L, ...n };
|
|
1057
|
+
}
|
|
1058
|
+
function V() {
|
|
1059
|
+
return { ...L };
|
|
1060
|
+
}
|
|
1061
|
+
function oe(n, e, t) {
|
|
1062
|
+
const i = t || e, s = V();
|
|
1063
|
+
let r = { valid: !0 };
|
|
1064
|
+
return t && (s.warnOnOverrides && se(n, t) && process.env.NODE_ENV !== "production" && console.warn(
|
|
1065
|
+
`Element override: ${n} changed from '${e}' to '${t}'`
|
|
1066
|
+
), s.validateTags && (r = ne.validate(t, n), !r.valid && !s.allowInvalidTags)) ? (process.env.NODE_ENV !== "production" && console.warn(
|
|
1067
|
+
`Invalid tag '${t}' rejected for '${n}', using default '${e}' instead`
|
|
1068
|
+
), { tag: e, validation: r }) : { tag: i, validation: r };
|
|
1069
|
+
}
|
|
1070
|
+
function Le(n, e) {
|
|
1071
|
+
return (t) => oe(n, e, t);
|
|
1072
|
+
}
|
|
1073
|
+
var ae = Object.defineProperty, ce = (n, e, t) => e in n ? ae(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, le = (n, e, t) => ce(n, e + "", t);
|
|
1074
|
+
const W = class _ {
|
|
1075
|
+
static getInstance() {
|
|
1076
|
+
return _.instance || (_.instance = new _()), _.instance;
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Apply semantic ARIA attributes to an element based on its tag
|
|
1080
|
+
*/
|
|
1081
|
+
applySemanticAttributes(e, t, i) {
|
|
1082
|
+
const s = V();
|
|
1083
|
+
if (!s.autoApplySemanticRoles) return;
|
|
1084
|
+
const r = N.get(t);
|
|
1085
|
+
if (!(!r || !r.applyARIA)) {
|
|
1086
|
+
if (i?.role) {
|
|
1087
|
+
s.warnOnSemanticIssues && process.env.NODE_ENV !== "production" && console.warn(
|
|
1088
|
+
`ARIA role '${i.role}' overrides semantic role '${r.role}' for tag '${t}'`
|
|
1089
|
+
);
|
|
1090
|
+
return;
|
|
1091
|
+
}
|
|
1092
|
+
if (e.hasAttribute("role")) {
|
|
1093
|
+
s.warnOnSemanticIssues && process.env.NODE_ENV !== "production" && console.warn(
|
|
1094
|
+
`Existing role attribute overrides semantic role '${r.role}' for tag '${t}'`
|
|
1095
|
+
);
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
e.setAttribute("role", r.role);
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Get semantic role information for a tag
|
|
1103
|
+
*/
|
|
1104
|
+
getSemanticRole(e) {
|
|
1105
|
+
return N.get(e);
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* Check if a tag has automatic ARIA role application enabled
|
|
1109
|
+
*/
|
|
1110
|
+
hasAutoARIA(e) {
|
|
1111
|
+
const t = N.get(e);
|
|
1112
|
+
return t ? t.applyARIA : !1;
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Get all tags that support automatic ARIA roles
|
|
1116
|
+
*/
|
|
1117
|
+
getAutoARIATags() {
|
|
1118
|
+
return Array.from(N.entries()).filter(([, e]) => e.applyARIA).map(([e]) => e);
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Apply semantic attributes during DOM node creation
|
|
1122
|
+
* This is called by the renderer when creating elements
|
|
1123
|
+
*/
|
|
1124
|
+
processElementNode(e, t, i, s) {
|
|
1125
|
+
if (this.applySemanticAttributes(e, t, s), i && process.env.NODE_ENV !== "production") {
|
|
1126
|
+
const r = this.getSemanticRole(t);
|
|
1127
|
+
r && e.setAttribute(
|
|
1128
|
+
"data-tachui-semantic",
|
|
1129
|
+
JSON.stringify({
|
|
1130
|
+
originalComponent: i.originalType,
|
|
1131
|
+
overriddenTo: t,
|
|
1132
|
+
semanticRole: r.role,
|
|
1133
|
+
autoApplied: r.applyARIA
|
|
1134
|
+
})
|
|
1135
|
+
);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
};
|
|
1139
|
+
le(W, "instance");
|
|
1140
|
+
let de = W;
|
|
1141
|
+
const R = de.getInstance(), $e = (n, e, t) => R.applySemanticAttributes(n, e, t), De = (n) => R.getSemanticRole(n), Be = (n) => R.hasAutoARIA(n);
|
|
1142
|
+
var ue = Object.defineProperty, pe = (n, e, t) => e in n ? ue(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, I = (n, e, t) => pe(n, typeof e != "symbol" ? e + "" : e, t);
|
|
1143
|
+
const fe = /* @__PURE__ */ new Set([
|
|
1144
|
+
"click",
|
|
1145
|
+
"dblclick",
|
|
1146
|
+
"mousedown",
|
|
1147
|
+
"mouseup",
|
|
1148
|
+
"mouseover",
|
|
1149
|
+
"mouseout",
|
|
1150
|
+
"mouseenter",
|
|
1151
|
+
"mouseleave",
|
|
1152
|
+
"focusin",
|
|
1153
|
+
// Bubbles, unlike 'focus'
|
|
1154
|
+
"focusout",
|
|
1155
|
+
// Bubbles, unlike 'blur'
|
|
1156
|
+
"input",
|
|
1157
|
+
"change",
|
|
1158
|
+
"submit",
|
|
1159
|
+
"keydown",
|
|
1160
|
+
"keyup",
|
|
1161
|
+
"keypress"
|
|
1162
|
+
]), D = /* @__PURE__ */ new Set([
|
|
1163
|
+
"scroll",
|
|
1164
|
+
"wheel",
|
|
1165
|
+
"touchstart",
|
|
1166
|
+
"touchmove",
|
|
1167
|
+
"touchend"
|
|
1168
|
+
]);
|
|
1169
|
+
class he {
|
|
1170
|
+
constructor() {
|
|
1171
|
+
I(this, "containerListeners", /* @__PURE__ */ new WeakMap()), I(this, "elementHandlers", /* @__PURE__ */ new WeakMap()), I(this, "handlerCounts", /* @__PURE__ */ new WeakMap());
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* Register an event handler with delegation
|
|
1175
|
+
*/
|
|
1176
|
+
register(e, t, i, s) {
|
|
1177
|
+
let r = this.elementHandlers.get(t);
|
|
1178
|
+
r && r.has(i) && this.unregister(e, t, i), r || (r = /* @__PURE__ */ new Map(), this.elementHandlers.set(t, r)), r.set(i, { handler: s, element: t });
|
|
1179
|
+
let o = this.handlerCounts.get(e);
|
|
1180
|
+
o || (o = /* @__PURE__ */ new Map(), this.handlerCounts.set(e, o));
|
|
1181
|
+
const a = o.get(i) || 0;
|
|
1182
|
+
return o.set(i, a + 1), this.ensureRootListener(e, i), () => {
|
|
1183
|
+
this.unregister(e, t, i);
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Unregister an event handler
|
|
1188
|
+
*/
|
|
1189
|
+
unregister(e, t, i) {
|
|
1190
|
+
const s = this.elementHandlers.get(t);
|
|
1191
|
+
s && (s.delete(i), s.size === 0 && this.elementHandlers.delete(t));
|
|
1192
|
+
const r = this.handlerCounts.get(e);
|
|
1193
|
+
if (r) {
|
|
1194
|
+
const a = (r.get(i) || 0) - 1;
|
|
1195
|
+
a <= 0 ? (r.delete(i), this.removeRootListener(e, i)) : r.set(i, a);
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* Ensure root listener exists for event type on container
|
|
1200
|
+
*/
|
|
1201
|
+
ensureRootListener(e, t) {
|
|
1202
|
+
let i = this.containerListeners.get(e);
|
|
1203
|
+
if (i || (i = /* @__PURE__ */ new Map(), this.containerListeners.set(e, i)), i.has(t))
|
|
1204
|
+
return;
|
|
1205
|
+
const s = (o) => {
|
|
1206
|
+
this.handleDelegatedEvent(e, t, o);
|
|
1207
|
+
}, r = D.has(t) ? { passive: !0 } : { passive: !1 };
|
|
1208
|
+
e.addEventListener(t, s, r), i.set(t, s);
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Remove root listener for event type on container
|
|
1212
|
+
*/
|
|
1213
|
+
removeRootListener(e, t) {
|
|
1214
|
+
const i = this.containerListeners.get(e);
|
|
1215
|
+
if (!i) return;
|
|
1216
|
+
const s = i.get(t);
|
|
1217
|
+
s && (e.removeEventListener(t, s), i.delete(t));
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Handle delegated event by finding target handler
|
|
1221
|
+
*/
|
|
1222
|
+
handleDelegatedEvent(e, t, i) {
|
|
1223
|
+
const s = i.target;
|
|
1224
|
+
if (!s) return;
|
|
1225
|
+
let r = s;
|
|
1226
|
+
for (; r && r !== e; ) {
|
|
1227
|
+
const o = this.elementHandlers.get(r);
|
|
1228
|
+
if (o) {
|
|
1229
|
+
const a = o.get(t);
|
|
1230
|
+
if (a) {
|
|
1231
|
+
try {
|
|
1232
|
+
a.handler(i);
|
|
1233
|
+
} catch (d) {
|
|
1234
|
+
console.error(`Delegated event handler error for ${t}:`, d);
|
|
1235
|
+
}
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
r = r.parentElement;
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Check if event type should use delegation
|
|
1244
|
+
*/
|
|
1245
|
+
shouldDelegate(e) {
|
|
1246
|
+
return fe.has(e);
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Check if event type should use passive listeners
|
|
1250
|
+
*/
|
|
1251
|
+
shouldBePassive(e) {
|
|
1252
|
+
return D.has(e);
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Get metrics for debugging
|
|
1256
|
+
*/
|
|
1257
|
+
getMetrics(e) {
|
|
1258
|
+
const t = this.handlerCounts.get(e);
|
|
1259
|
+
if (!t)
|
|
1260
|
+
return { eventTypes: [], totalHandlers: 0, handlersPerType: {} };
|
|
1261
|
+
const i = {};
|
|
1262
|
+
let s = 0;
|
|
1263
|
+
return t.forEach((r, o) => {
|
|
1264
|
+
i[o] = r, s += r;
|
|
1265
|
+
}), {
|
|
1266
|
+
eventTypes: Array.from(t.keys()),
|
|
1267
|
+
totalHandlers: s,
|
|
1268
|
+
handlersPerType: i
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Cleanup all handlers for a container
|
|
1273
|
+
*/
|
|
1274
|
+
cleanupContainer(e) {
|
|
1275
|
+
const t = this.containerListeners.get(e);
|
|
1276
|
+
t && (t.forEach((i, s) => {
|
|
1277
|
+
e.removeEventListener(s, i);
|
|
1278
|
+
}), this.containerListeners.delete(e)), this.handlerCounts.delete(e);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
const T = new he();
|
|
1282
|
+
var me = Object.defineProperty, ge = (n, e, t) => e in n ? me(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, S = (n, e, t) => ge(n, typeof e != "symbol" ? e + "" : e, t);
|
|
1283
|
+
class ye {
|
|
1284
|
+
constructor() {
|
|
1285
|
+
S(this, "nodeMap", /* @__PURE__ */ new WeakMap()), S(this, "cleanupMap", /* @__PURE__ */ new WeakMap()), S(this, "renderedNodes", /* @__PURE__ */ new Set()), S(this, "elementToContainer", /* @__PURE__ */ new WeakMap()), S(this, "metrics", {
|
|
1286
|
+
created: 0,
|
|
1287
|
+
adopted: 0,
|
|
1288
|
+
removed: 0,
|
|
1289
|
+
inserted: 0,
|
|
1290
|
+
moved: 0,
|
|
1291
|
+
cacheHits: 0,
|
|
1292
|
+
cacheMisses: 0,
|
|
1293
|
+
attributeWrites: 0,
|
|
1294
|
+
attributeRemovals: 0,
|
|
1295
|
+
textUpdates: 0,
|
|
1296
|
+
modifierApplications: 0
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
/**
|
|
1300
|
+
* Render a DOM node to an actual DOM element
|
|
1301
|
+
*/
|
|
1302
|
+
render(e, t) {
|
|
1303
|
+
return Array.isArray(e) ? this.renderFragment(e, t) : this.renderSingle(e, t);
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* Check if a DOM node has been rendered and tracked.
|
|
1307
|
+
*/
|
|
1308
|
+
hasNode(e) {
|
|
1309
|
+
return this.nodeMap.has(e);
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Get the rendered DOM element associated with a node.
|
|
1313
|
+
*/
|
|
1314
|
+
getRenderedNode(e) {
|
|
1315
|
+
return this.nodeMap.get(e);
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Render a single DOM node
|
|
1319
|
+
*/
|
|
1320
|
+
renderSingle(e, t) {
|
|
1321
|
+
this.renderedNodes.add(e);
|
|
1322
|
+
let i;
|
|
1323
|
+
switch (e.type) {
|
|
1324
|
+
case "element":
|
|
1325
|
+
i = this.createOrUpdateElement(e, t);
|
|
1326
|
+
break;
|
|
1327
|
+
case "text":
|
|
1328
|
+
i = this.createOrUpdateTextNode(e);
|
|
1329
|
+
break;
|
|
1330
|
+
case "comment":
|
|
1331
|
+
i = this.createComment(e), this.metrics.created++;
|
|
1332
|
+
break;
|
|
1333
|
+
default:
|
|
1334
|
+
throw new Error(`Unknown node type: ${e.type}`);
|
|
1335
|
+
}
|
|
1336
|
+
if (this.nodeMap.set(e, i), e.element = i, i instanceof Element && t && this.elementToContainer.set(i, t), i instanceof Element) {
|
|
1337
|
+
let s = [];
|
|
1338
|
+
"modifiers" in e && Array.isArray(e.modifiers) && e.modifiers.length > 0 && (s = e.modifiers), "componentMetadata" in e && e.componentMetadata?.modifiers && Array.isArray(e.componentMetadata.modifiers) && e.componentMetadata.modifiers.length > 0 && (s = e.componentMetadata.modifiers), s.length > 0 && this.applyModifiersToElement(i, s, e);
|
|
1339
|
+
}
|
|
1340
|
+
return e.dispose && this.addCleanup(i, e.dispose), t && this.appendNode(t, i), i;
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Render multiple nodes as a document fragment
|
|
1344
|
+
*/
|
|
1345
|
+
renderFragment(e, t) {
|
|
1346
|
+
const i = document.createDocumentFragment();
|
|
1347
|
+
return e.forEach((s) => {
|
|
1348
|
+
const r = this.renderSingle(s);
|
|
1349
|
+
i.appendChild(r);
|
|
1350
|
+
}), t && (t.appendChild(i), this.metrics.inserted += e.length), i;
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Create a DOM element with props and children
|
|
1354
|
+
*/
|
|
1355
|
+
createOrUpdateElement(e, t) {
|
|
1356
|
+
if (!e.tag)
|
|
1357
|
+
throw new Error("Element node must have a tag");
|
|
1358
|
+
if (e.element && e.element instanceof Element) {
|
|
1359
|
+
const s = e.element;
|
|
1360
|
+
return t && this.elementToContainer.set(s, t), this.updateProps(s, e, t), this.updateChildren(s, e), s;
|
|
1361
|
+
}
|
|
1362
|
+
const i = document.createElement(e.tag);
|
|
1363
|
+
return this.metrics.created++, t && this.elementToContainer.set(i, t), this.applyDebugAttributes(i, e), this.updateProps(i, e, t), this.updateChildren(i, e), i;
|
|
1364
|
+
}
|
|
1365
|
+
updateProps(e, t, i) {
|
|
1366
|
+
const s = t.props || {}, r = t.__appliedProps || {};
|
|
1367
|
+
if (Object.keys(r).forEach((o) => {
|
|
1368
|
+
if (!(o in s)) {
|
|
1369
|
+
if (o === "key" || o === "children" || o.startsWith("on"))
|
|
1370
|
+
return;
|
|
1371
|
+
this.setElementProp(e, o, void 0);
|
|
1372
|
+
}
|
|
1373
|
+
}), Object.entries(s).forEach(([o, a]) => {
|
|
1374
|
+
o === "key" || o === "children" || r && r[o] === a || this.applyProp(e, o, a, i);
|
|
1375
|
+
}), t.__appliedProps = { ...s }, "componentMetadata" in t && t.componentMetadata) {
|
|
1376
|
+
const o = t.componentMetadata;
|
|
1377
|
+
if (o.overriddenTo && o.originalType && t.tag)
|
|
1378
|
+
try {
|
|
1379
|
+
R.processElementNode(
|
|
1380
|
+
e,
|
|
1381
|
+
t.tag,
|
|
1382
|
+
o,
|
|
1383
|
+
s?.aria || void 0
|
|
1384
|
+
);
|
|
1385
|
+
} catch (a) {
|
|
1386
|
+
console.warn("[tachUI] Could not process semantic attributes:", a);
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
updateChildren(e, t) {
|
|
1391
|
+
const i = t.__renderedChildren || [], s = t.children || [], r = this.elementToContainer.get(e), o = typeof process < "u" && process.env?.TACHUI_DEBUG_PHASE1B === "1";
|
|
1392
|
+
if (i.length === s.length && i.length > 0 && i.every((f, g) => f === s[g])) {
|
|
1393
|
+
s.forEach((f) => {
|
|
1394
|
+
this.updateExistingNode(f);
|
|
1395
|
+
}), t.__renderedChildren = s;
|
|
1396
|
+
return;
|
|
1397
|
+
}
|
|
1398
|
+
if (i.length === 0) {
|
|
1399
|
+
s.forEach((f) => {
|
|
1400
|
+
if (!f || f.type == null) return;
|
|
1401
|
+
const g = this.renderSingle(f, r);
|
|
1402
|
+
this.appendNode(e, g);
|
|
1403
|
+
}), t.__renderedChildren = s;
|
|
1404
|
+
return;
|
|
1405
|
+
}
|
|
1406
|
+
const a = /* @__PURE__ */ new Map(), d = [];
|
|
1407
|
+
i.forEach((f) => {
|
|
1408
|
+
f.key != null ? a.set(f.key, f) : d.push(f);
|
|
1409
|
+
});
|
|
1410
|
+
const u = Array.from({ length: s.length });
|
|
1411
|
+
if (s.forEach((f, g) => {
|
|
1412
|
+
let m;
|
|
1413
|
+
f.key != null ? (m = a.get(f.key), m && a.delete(f.key)) : d.length > 0 && (m = d.shift()), m && this.adoptNode(m, f);
|
|
1414
|
+
const y = this.renderSingle(f, r);
|
|
1415
|
+
u[g] = y;
|
|
1416
|
+
}), o && t.tag) {
|
|
1417
|
+
const f = s.map((y) => y.key ?? null), g = i.map((y) => y.key ?? null), m = u.map(
|
|
1418
|
+
(y) => y && "getAttribute" in y ? y.getAttribute("data-id") : null
|
|
1419
|
+
);
|
|
1420
|
+
console.log("[diff] state", {
|
|
1421
|
+
parent: t.tag,
|
|
1422
|
+
prev: g,
|
|
1423
|
+
next: f,
|
|
1424
|
+
dom: m
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1427
|
+
if (a.forEach((f) => {
|
|
1428
|
+
this.removeNode(f);
|
|
1429
|
+
}), d.forEach((f) => {
|
|
1430
|
+
this.removeNode(f);
|
|
1431
|
+
}), typeof e.insertBefore == "function" && typeof e.appendChild == "function") {
|
|
1432
|
+
let f = null;
|
|
1433
|
+
for (let g = u.length - 1; g >= 0; g--) {
|
|
1434
|
+
const m = u[g];
|
|
1435
|
+
m && (this.insertNode(e, m, f), f = m);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
t.__renderedChildren = s;
|
|
1439
|
+
}
|
|
1440
|
+
updateExistingNode(e) {
|
|
1441
|
+
if (e.type === "element" && e.element instanceof Element) {
|
|
1442
|
+
const t = this.elementToContainer.get(e.element);
|
|
1443
|
+
this.updateProps(e.element, e, t), this.updateChildren(e.element, e);
|
|
1444
|
+
} else e.type === "text" && e.element instanceof Text && e.element.textContent !== e.text && (e.element.textContent = e.text || "", this.recordTextUpdate());
|
|
1445
|
+
}
|
|
1446
|
+
/**
|
|
1447
|
+
* Apply debug attributes to DOM element if debug mode is enabled
|
|
1448
|
+
*/
|
|
1449
|
+
applyDebugAttributes(e, t) {
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Create or update a text node
|
|
1453
|
+
*/
|
|
1454
|
+
createOrUpdateTextNode(e) {
|
|
1455
|
+
if (e.element && e.element instanceof Text) {
|
|
1456
|
+
const t = e.element;
|
|
1457
|
+
if (t.textContent !== e.text && (t.textContent = e.text || "", this.recordTextUpdate()), e.reactiveContent && !e.dispose) {
|
|
1458
|
+
const i = e.reactiveContent, s = E(() => {
|
|
1459
|
+
try {
|
|
1460
|
+
const r = i();
|
|
1461
|
+
e.text = String(r);
|
|
1462
|
+
const o = t.parentElement;
|
|
1463
|
+
if (o && o.__tachui_asHTML)
|
|
1464
|
+
return;
|
|
1465
|
+
t.textContent = e.text, this.recordTextUpdate();
|
|
1466
|
+
} catch (r) {
|
|
1467
|
+
console.error("createOrUpdateTextNode() reactive effect error:", r);
|
|
1468
|
+
}
|
|
1469
|
+
});
|
|
1470
|
+
e.dispose = () => {
|
|
1471
|
+
s.dispose();
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
return t;
|
|
1475
|
+
}
|
|
1476
|
+
return this.createTextNode(e);
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Create a text node
|
|
1480
|
+
*/
|
|
1481
|
+
createTextNode(e) {
|
|
1482
|
+
const t = document.createTextNode(e.text || "");
|
|
1483
|
+
if (this.metrics.created++, this.recordTextUpdate(), e.reactiveContent) {
|
|
1484
|
+
const i = e.reactiveContent, s = E(() => {
|
|
1485
|
+
try {
|
|
1486
|
+
const r = i();
|
|
1487
|
+
e.text = String(r);
|
|
1488
|
+
const o = t.parentElement;
|
|
1489
|
+
if (o && o.__tachui_asHTML)
|
|
1490
|
+
return;
|
|
1491
|
+
t.textContent = e.text, this.recordTextUpdate();
|
|
1492
|
+
} catch (r) {
|
|
1493
|
+
console.error("createTextNode() reactive effect error:", r);
|
|
1494
|
+
}
|
|
1495
|
+
});
|
|
1496
|
+
e.dispose = () => {
|
|
1497
|
+
s.dispose();
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
return t;
|
|
1501
|
+
}
|
|
1502
|
+
/**
|
|
1503
|
+
* Create a comment node
|
|
1504
|
+
*/
|
|
1505
|
+
createComment(e) {
|
|
1506
|
+
return this.metrics.created++, document.createComment(e.text || "");
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* Apply props to a DOM element with reactive updates
|
|
1510
|
+
*/
|
|
1511
|
+
applyProps(e, t) {
|
|
1512
|
+
Object.entries(t).forEach(([i, s]) => {
|
|
1513
|
+
this.applyProp(e, i, s);
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
/**
|
|
1517
|
+
* Apply a single prop to an element
|
|
1518
|
+
*/
|
|
1519
|
+
applyProp(e, t, i, s) {
|
|
1520
|
+
if (t === "className" || t === "class") {
|
|
1521
|
+
this.applyClassName(e, i);
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
if (t === "style") {
|
|
1525
|
+
this.applyStyle(e, i);
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
if (t.startsWith("on") && typeof i == "function") {
|
|
1529
|
+
this.applyEventListener(e, t, i, s);
|
|
1530
|
+
return;
|
|
1531
|
+
}
|
|
1532
|
+
if (w(i) || x(i)) {
|
|
1533
|
+
const r = E(() => {
|
|
1534
|
+
const o = i();
|
|
1535
|
+
this.setElementProp(e, t, o);
|
|
1536
|
+
});
|
|
1537
|
+
this.addCleanup(e, () => {
|
|
1538
|
+
r.dispose();
|
|
1539
|
+
});
|
|
1540
|
+
return;
|
|
1541
|
+
}
|
|
1542
|
+
this.setElementProp(e, t, i);
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* Set a property on an element
|
|
1546
|
+
*/
|
|
1547
|
+
setElementProp(e, t, i) {
|
|
1548
|
+
if (i == null) {
|
|
1549
|
+
e.hasAttribute(t) && (e.removeAttribute(t), this.recordAttributeRemoval());
|
|
1550
|
+
return;
|
|
1551
|
+
}
|
|
1552
|
+
const s = e;
|
|
1553
|
+
if ((t === "value" || t === "checked" || t === "disabled") && t in s) {
|
|
1554
|
+
s[t] !== i && (s[t] = i, this.recordAttributeWrite());
|
|
1555
|
+
return;
|
|
1556
|
+
}
|
|
1557
|
+
if (typeof i == "boolean") {
|
|
1558
|
+
i ? e.hasAttribute(t) || (e.setAttribute(t, ""), this.recordAttributeWrite()) : e.hasAttribute(t) ? (e.removeAttribute(t), this.recordAttributeRemoval()) : e.removeAttribute(t);
|
|
1559
|
+
return;
|
|
1560
|
+
}
|
|
1561
|
+
const r = e.getAttribute(t), o = String(i);
|
|
1562
|
+
r !== o && (e.setAttribute(t, o), this.recordAttributeWrite());
|
|
1563
|
+
}
|
|
1564
|
+
/**
|
|
1565
|
+
* Apply className with reactive updates
|
|
1566
|
+
*/
|
|
1567
|
+
applyClassName(e, t) {
|
|
1568
|
+
if (w(t) || x(t)) {
|
|
1569
|
+
const i = E(() => {
|
|
1570
|
+
const s = t(), r = this.normalizeClassName(s);
|
|
1571
|
+
e.className !== r && (e.className = r, this.recordAttributeWrite());
|
|
1572
|
+
});
|
|
1573
|
+
this.addCleanup(e, () => {
|
|
1574
|
+
i.dispose();
|
|
1575
|
+
});
|
|
1576
|
+
} else {
|
|
1577
|
+
const i = this.normalizeClassName(t);
|
|
1578
|
+
e.className !== i && (e.className = i, this.recordAttributeWrite());
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
/**
|
|
1582
|
+
* Normalize className value
|
|
1583
|
+
*/
|
|
1584
|
+
normalizeClassName(e) {
|
|
1585
|
+
return Array.isArray(e) ? e.filter(Boolean).join(" ") : typeof e == "object" && e !== null ? Object.entries(e).filter(([, t]) => !!t).map(([t]) => t).join(" ") : String(e || "");
|
|
1586
|
+
}
|
|
1587
|
+
/**
|
|
1588
|
+
* Apply styles with reactive updates
|
|
1589
|
+
*/
|
|
1590
|
+
applyStyle(e, t) {
|
|
1591
|
+
const i = e;
|
|
1592
|
+
if (w(t) || x(t)) {
|
|
1593
|
+
const s = E(() => {
|
|
1594
|
+
const r = t();
|
|
1595
|
+
this.setElementStyles(i, r);
|
|
1596
|
+
});
|
|
1597
|
+
this.addCleanup(e, () => {
|
|
1598
|
+
s.dispose();
|
|
1599
|
+
});
|
|
1600
|
+
} else
|
|
1601
|
+
this.setElementStyles(i, t);
|
|
1602
|
+
}
|
|
1603
|
+
/**
|
|
1604
|
+
* Set styles on an element
|
|
1605
|
+
*/
|
|
1606
|
+
setElementStyles(e, t) {
|
|
1607
|
+
if (typeof t == "string") {
|
|
1608
|
+
e.style.cssText !== t && (e.style.cssText = t, this.recordAttributeWrite());
|
|
1609
|
+
return;
|
|
1610
|
+
}
|
|
1611
|
+
if (typeof t == "object" && t !== null) {
|
|
1612
|
+
const i = e.__appliedStyles || {};
|
|
1613
|
+
Object.keys(i).forEach((s) => {
|
|
1614
|
+
s in t || (e.style.removeProperty(s.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`)), this.recordAttributeRemoval());
|
|
1615
|
+
}), Object.entries(t).forEach(([s, r]) => {
|
|
1616
|
+
if (w(r) || x(r)) {
|
|
1617
|
+
const o = E(() => {
|
|
1618
|
+
const a = r(), d = s.replace(/[A-Z]/g, (u) => `-${u.toLowerCase()}`);
|
|
1619
|
+
if (a == null)
|
|
1620
|
+
e.style.removeProperty(d), this.recordAttributeRemoval();
|
|
1621
|
+
else {
|
|
1622
|
+
const u = String(a);
|
|
1623
|
+
e.style.getPropertyValue(d) !== u && (e.style.setProperty(d, u), this.recordAttributeWrite());
|
|
1624
|
+
}
|
|
1625
|
+
});
|
|
1626
|
+
this.addCleanup(e, () => {
|
|
1627
|
+
o.dispose();
|
|
1628
|
+
});
|
|
1629
|
+
} else {
|
|
1630
|
+
const o = s.replace(/[A-Z]/g, (a) => `-${a.toLowerCase()}`);
|
|
1631
|
+
if (r == null)
|
|
1632
|
+
e.style.getPropertyValue(o) && (e.style.removeProperty(o), this.recordAttributeRemoval());
|
|
1633
|
+
else {
|
|
1634
|
+
const a = String(r);
|
|
1635
|
+
e.style.getPropertyValue(o) !== a && (e.style.setProperty(o, a), this.recordAttributeWrite());
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
}), e.__appliedStyles = { ...t };
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
/**
|
|
1642
|
+
* Apply event listener (with delegation if possible)
|
|
1643
|
+
*/
|
|
1644
|
+
applyEventListener(e, t, i, s) {
|
|
1645
|
+
let r = t.slice(2).toLowerCase();
|
|
1646
|
+
r === "focus" ? r = "focusin" : r === "blur" && (r = "focusout");
|
|
1647
|
+
const o = s || this.elementToContainer.get(e);
|
|
1648
|
+
if (o && T.shouldDelegate(r)) {
|
|
1649
|
+
const u = T.register(
|
|
1650
|
+
o,
|
|
1651
|
+
e,
|
|
1652
|
+
r,
|
|
1653
|
+
i
|
|
1654
|
+
);
|
|
1655
|
+
this.addCleanup(e, u);
|
|
1656
|
+
return;
|
|
1657
|
+
}
|
|
1658
|
+
const a = (u) => {
|
|
1659
|
+
try {
|
|
1660
|
+
i(u);
|
|
1661
|
+
} catch (b) {
|
|
1662
|
+
console.error(`Event handler error for ${t}:`, b);
|
|
1663
|
+
}
|
|
1664
|
+
}, d = T.shouldBePassive(r) ? { passive: !0 } : void 0;
|
|
1665
|
+
e.addEventListener(r, a, d), this.addCleanup(e, () => {
|
|
1666
|
+
e.removeEventListener(r, a, d);
|
|
1667
|
+
});
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Add cleanup function for an element
|
|
1671
|
+
*/
|
|
1672
|
+
addCleanup(e, t) {
|
|
1673
|
+
const i = this.cleanupMap.get(e) || [];
|
|
1674
|
+
i.push(t), this.cleanupMap.set(e, i);
|
|
1675
|
+
}
|
|
1676
|
+
/**
|
|
1677
|
+
* Update an existing DOM node
|
|
1678
|
+
*/
|
|
1679
|
+
updateNode(e, t) {
|
|
1680
|
+
const i = this.nodeMap.get(e);
|
|
1681
|
+
!i || typeof i.setAttribute != "function" || t && this.applyProps(i, t);
|
|
1682
|
+
}
|
|
1683
|
+
/**
|
|
1684
|
+
* Remove a DOM node and run cleanup
|
|
1685
|
+
*/
|
|
1686
|
+
removeNode(e) {
|
|
1687
|
+
this.cleanupNode(e, !0);
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Cleanup a node (and its descendants) and optionally remove from DOM.
|
|
1691
|
+
*/
|
|
1692
|
+
cleanupNode(e, t) {
|
|
1693
|
+
const i = this.nodeMap.get(e);
|
|
1694
|
+
if (e.children && e.children.length > 0 && e.children.forEach((r) => {
|
|
1695
|
+
this.cleanupNode(r, !1);
|
|
1696
|
+
}), !i) {
|
|
1697
|
+
e.element !== void 0 && (e.element = void 0), this.renderedNodes.delete(e), this.nodeMap.delete(e);
|
|
1698
|
+
return;
|
|
1699
|
+
}
|
|
1700
|
+
const s = this.cleanupMap.get(i);
|
|
1701
|
+
s && (s.forEach((r) => {
|
|
1702
|
+
try {
|
|
1703
|
+
r();
|
|
1704
|
+
} catch (o) {
|
|
1705
|
+
console.error("Cleanup error:", o);
|
|
1706
|
+
}
|
|
1707
|
+
}), this.cleanupMap.delete(i)), t && i.parentNode && i.parentNode.removeChild(i), this.nodeMap.delete(e), e.element !== void 0 && (e.element = void 0), this.renderedNodes.delete(e), this.metrics.removed++;
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* Create reactive text content
|
|
1711
|
+
*/
|
|
1712
|
+
createReactiveText(e) {
|
|
1713
|
+
const t = document.createTextNode("");
|
|
1714
|
+
return E(() => {
|
|
1715
|
+
t.textContent = e();
|
|
1716
|
+
}), t;
|
|
1717
|
+
}
|
|
1718
|
+
/**
|
|
1719
|
+
* Create reactive element with dynamic props
|
|
1720
|
+
*/
|
|
1721
|
+
createReactiveElement(e, t, i) {
|
|
1722
|
+
const s = document.createElement(e);
|
|
1723
|
+
return E(() => {
|
|
1724
|
+
const r = t();
|
|
1725
|
+
this.applyProps(s, r);
|
|
1726
|
+
}), i && i.forEach((r) => {
|
|
1727
|
+
const o = this.renderSingle(r);
|
|
1728
|
+
s.appendChild(o);
|
|
1729
|
+
}), s;
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Apply modifiers to a DOM element
|
|
1733
|
+
*/
|
|
1734
|
+
applyModifiersToElement(e, t, i) {
|
|
1735
|
+
try {
|
|
1736
|
+
t.length > 0 && this.recordModifierApplications(t.length);
|
|
1737
|
+
const s = i.componentInstance || i.componentMetadata && i.componentMetadata.componentInstance || i._originalComponent || // Use original component if available
|
|
1738
|
+
i;
|
|
1739
|
+
H(
|
|
1740
|
+
i,
|
|
1741
|
+
t,
|
|
1742
|
+
{
|
|
1743
|
+
element: e,
|
|
1744
|
+
componentId: i.componentId || "unknown",
|
|
1745
|
+
phase: "creation",
|
|
1746
|
+
componentInstance: s
|
|
1747
|
+
// Pass the component instance
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
batch: !0
|
|
1751
|
+
// Enable batched modifier application
|
|
1752
|
+
}
|
|
1753
|
+
);
|
|
1754
|
+
} catch (s) {
|
|
1755
|
+
console.error("Failed to apply modifiers to element:", s);
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Adopt an existing DOM mapping from one node to another.
|
|
1760
|
+
*/
|
|
1761
|
+
adoptNode(e, t) {
|
|
1762
|
+
const i = this.nodeMap.get(e);
|
|
1763
|
+
i && (this.nodeMap.set(t, i), this.nodeMap.delete(e), this.renderedNodes.delete(e), this.renderedNodes.add(t), t.element = i, e.dispose && (t.dispose = e.dispose), e.__renderedChildren && (t.__renderedChildren = e.__renderedChildren), e.__appliedProps && (t.__appliedProps = e.__appliedProps), this.metrics.adopted++);
|
|
1764
|
+
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Cleanup all tracked elements
|
|
1767
|
+
*/
|
|
1768
|
+
cleanup() {
|
|
1769
|
+
for (const e of this.renderedNodes)
|
|
1770
|
+
if (e.dispose && typeof e.dispose == "function")
|
|
1771
|
+
try {
|
|
1772
|
+
e.dispose();
|
|
1773
|
+
} catch (t) {
|
|
1774
|
+
console.error("Cleanup error:", t);
|
|
1775
|
+
}
|
|
1776
|
+
this.renderedNodes.clear(), this.nodeMap = /* @__PURE__ */ new WeakMap(), this.cleanupMap = /* @__PURE__ */ new WeakMap(), this.resetMetrics();
|
|
1777
|
+
}
|
|
1778
|
+
resetMetrics() {
|
|
1779
|
+
this.metrics = {
|
|
1780
|
+
created: 0,
|
|
1781
|
+
adopted: 0,
|
|
1782
|
+
removed: 0,
|
|
1783
|
+
inserted: 0,
|
|
1784
|
+
moved: 0,
|
|
1785
|
+
cacheHits: 0,
|
|
1786
|
+
cacheMisses: 0,
|
|
1787
|
+
attributeWrites: 0,
|
|
1788
|
+
attributeRemovals: 0,
|
|
1789
|
+
textUpdates: 0,
|
|
1790
|
+
modifierApplications: 0
|
|
1791
|
+
};
|
|
1792
|
+
}
|
|
1793
|
+
getMetrics() {
|
|
1794
|
+
return { ...this.metrics };
|
|
1795
|
+
}
|
|
1796
|
+
recordCacheHit() {
|
|
1797
|
+
this.metrics.cacheHits++;
|
|
1798
|
+
}
|
|
1799
|
+
recordCacheMiss() {
|
|
1800
|
+
this.metrics.cacheMisses++;
|
|
1801
|
+
}
|
|
1802
|
+
insertNode(e, t, i) {
|
|
1803
|
+
const s = typeof process < "u" && process.env?.TACHUI_DEBUG_PHASE1B === "1";
|
|
1804
|
+
t.parentNode !== e ? (s && console.log("[diff] insertNode append", {
|
|
1805
|
+
tag: "tagName" in t ? t.tagName : "text",
|
|
1806
|
+
before: i && "getAttribute" in i ? i.getAttribute("data-id") : null
|
|
1807
|
+
}), e.insertBefore(t, i), this.metrics.inserted++) : t.nextSibling !== i && (s && console.log("[diff] insertNode move", {
|
|
1808
|
+
tag: "tagName" in t ? t.tagName : "text",
|
|
1809
|
+
before: i && "getAttribute" in i ? i.getAttribute("data-id") : null
|
|
1810
|
+
}), e.insertBefore(t, i), this.metrics.moved++);
|
|
1811
|
+
}
|
|
1812
|
+
appendNode(e, t) {
|
|
1813
|
+
t.parentNode !== e && (e.appendChild(t), this.metrics.inserted++);
|
|
1814
|
+
}
|
|
1815
|
+
recordAttributeWrite() {
|
|
1816
|
+
this.metrics.attributeWrites++;
|
|
1817
|
+
}
|
|
1818
|
+
recordAttributeRemoval() {
|
|
1819
|
+
this.metrics.attributeRemovals++;
|
|
1820
|
+
}
|
|
1821
|
+
recordTextUpdate() {
|
|
1822
|
+
this.metrics.textUpdates++;
|
|
1823
|
+
}
|
|
1824
|
+
recordModifierApplications(e) {
|
|
1825
|
+
this.metrics.modifierApplications += e;
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
const h = new ye();
|
|
1829
|
+
function Oe() {
|
|
1830
|
+
h.resetMetrics();
|
|
1831
|
+
}
|
|
1832
|
+
function He() {
|
|
1833
|
+
return h.getMetrics();
|
|
1834
|
+
}
|
|
1835
|
+
function Ve(n, e) {
|
|
1836
|
+
return j(() => {
|
|
1837
|
+
let t = [];
|
|
1838
|
+
const i = /* @__PURE__ */ new Map(), s = (o) => {
|
|
1839
|
+
if (o.key != null) {
|
|
1840
|
+
const a = i.get(o.key);
|
|
1841
|
+
a && a.type === o.type && a.tag === o.tag && a.element ? (o.element = a.element, a.__appliedProps && (o.__appliedProps = a.__appliedProps), a.__renderedChildren && (o.__renderedChildren = a.__renderedChildren), h.recordCacheHit()) : h.recordCacheMiss();
|
|
1842
|
+
}
|
|
1843
|
+
o.children && o.children.forEach(s);
|
|
1844
|
+
}, r = E(() => {
|
|
1845
|
+
let o = n;
|
|
1846
|
+
"build" in n && typeof n.build == "function" && (o = n.build());
|
|
1847
|
+
const a = o.render(), d = Array.isArray(a) ? a : [a];
|
|
1848
|
+
d.forEach(s);
|
|
1849
|
+
const u = new Set(t), b = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set(), g = Math.min(t.length, d.length);
|
|
1850
|
+
for (let c = 0; c < g; c++) {
|
|
1851
|
+
const p = t[c], v = d[c];
|
|
1852
|
+
p && v && p.type === v.type && p.tag === v.tag && (p.key === v.key || p.key == null && v.key == null) && (h.adoptNode(p, v), b.add(v), f.add(p), u.delete(p));
|
|
1853
|
+
}
|
|
1854
|
+
t.forEach((c) => {
|
|
1855
|
+
c.key != null && i.set(c.key, c);
|
|
1856
|
+
});
|
|
1857
|
+
const m = /* @__PURE__ */ new Map();
|
|
1858
|
+
t.forEach((c) => {
|
|
1859
|
+
c.key != null && !f.has(c) && m.set(c.key, c);
|
|
1860
|
+
});
|
|
1861
|
+
const y = d.map((c) => {
|
|
1862
|
+
if (b.has(c))
|
|
1863
|
+
return h.render(c, e), h.getRenderedNode(c);
|
|
1864
|
+
if (c.key != null) {
|
|
1865
|
+
const p = i.get(c.key);
|
|
1866
|
+
if (p && p.type === c.type && p.tag === c.tag)
|
|
1867
|
+
return h.recordCacheHit(), u.delete(p), m.delete(c.key), i.set(c.key, c), h.adoptNode(p, c), h.render(c, e), h.getRenderedNode(c);
|
|
1868
|
+
h.recordCacheMiss();
|
|
1869
|
+
}
|
|
1870
|
+
if (c.key != null) {
|
|
1871
|
+
const p = m.get(c.key);
|
|
1872
|
+
if (p)
|
|
1873
|
+
return m.delete(c.key), u.delete(p), h.adoptNode(p, c), i.set(c.key, c), h.render(c, e), h.getRenderedNode(c);
|
|
1874
|
+
}
|
|
1875
|
+
if (c.key != null) {
|
|
1876
|
+
for (const p of u)
|
|
1877
|
+
if (p.key === c.key) {
|
|
1878
|
+
u.delete(p), h.adoptNode(p, c), h.render(c, e);
|
|
1879
|
+
break;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
if (!h.hasNode(c)) {
|
|
1883
|
+
for (const p of u)
|
|
1884
|
+
if (p.type === c.type && p.tag === c.tag && p.key == null && c.key == null) {
|
|
1885
|
+
u.delete(p), h.adoptNode(p, c), h.render(c, e);
|
|
1886
|
+
break;
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
return h.hasNode(c) || (h.render(c, e), c.key != null && i.set(c.key, c)), h.getRenderedNode(c);
|
|
1890
|
+
});
|
|
1891
|
+
if (u.forEach((c) => {
|
|
1892
|
+
h.removeNode(c), c.key != null && i.delete(c.key);
|
|
1893
|
+
}), typeof e.insertBefore == "function" && typeof e.appendChild == "function") {
|
|
1894
|
+
let c = null;
|
|
1895
|
+
for (let p = y.length - 1; p >= 0; p--) {
|
|
1896
|
+
const v = y[p];
|
|
1897
|
+
v && (h.insertNode(e, v, c), c = v);
|
|
1898
|
+
}
|
|
1899
|
+
} else
|
|
1900
|
+
y.forEach((c) => {
|
|
1901
|
+
c && c.parentNode !== e && h.appendNode(e, c);
|
|
1902
|
+
});
|
|
1903
|
+
const $ = (c) => {
|
|
1904
|
+
c.key != null && c.element && i.set(c.key, c), c.children && c.children.forEach($);
|
|
1905
|
+
};
|
|
1906
|
+
d.forEach($), t = d;
|
|
1907
|
+
});
|
|
1908
|
+
return () => {
|
|
1909
|
+
r.dispose(), t.forEach((o) => {
|
|
1910
|
+
h.removeNode(o);
|
|
1911
|
+
}), i.clear(), T.cleanupContainer(e);
|
|
1912
|
+
};
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1915
|
+
function be(n, e, ...t) {
|
|
1916
|
+
const i = t.flat().filter((r) => r != null).map((r) => typeof r == "string" || typeof r == "number" ? { type: "text", text: String(r) } : r), s = {
|
|
1917
|
+
type: "element",
|
|
1918
|
+
tag: n,
|
|
1919
|
+
props: e || {},
|
|
1920
|
+
children: i,
|
|
1921
|
+
key: e?.key ?? void 0
|
|
1922
|
+
};
|
|
1923
|
+
return e && "componentMetadata" in e && (s.componentMetadata = e.componentMetadata), s;
|
|
1924
|
+
}
|
|
1925
|
+
function We(n) {
|
|
1926
|
+
if (w(n) || x(n) || typeof n == "function") {
|
|
1927
|
+
const e = {
|
|
1928
|
+
type: "text",
|
|
1929
|
+
text: "",
|
|
1930
|
+
reactiveContent: n
|
|
1931
|
+
// Store the reactive content function
|
|
1932
|
+
}, t = U(() => n());
|
|
1933
|
+
e.text = String(t);
|
|
1934
|
+
const i = E(() => {
|
|
1935
|
+
const s = n();
|
|
1936
|
+
e.text = String(s), e.element && "textContent" in e.element && (e.element.textContent = String(s));
|
|
1937
|
+
});
|
|
1938
|
+
return e.dispose = i.dispose.bind(i), e;
|
|
1939
|
+
}
|
|
1940
|
+
return {
|
|
1941
|
+
type: "text",
|
|
1942
|
+
text: n
|
|
1943
|
+
};
|
|
1944
|
+
}
|
|
1945
|
+
var ve = Object.defineProperty, Ee = (n, e, t) => e in n ? ve(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, A = (n, e, t) => Ee(n, typeof e != "symbol" ? e + "" : e, t);
|
|
1946
|
+
class M {
|
|
1947
|
+
// Required by ModifiableComponent interface
|
|
1948
|
+
constructor(e, t, i = !0) {
|
|
1949
|
+
this.metadata = t, A(this, "type", "component"), A(this, "id"), A(this, "mounted", !1), A(this, "cleanup", []), A(this, "props", {}), A(this, "segments"), A(this, "modifiers", []), this.id = `concat-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, this.segments = e;
|
|
1950
|
+
}
|
|
1951
|
+
/**
|
|
1952
|
+
* Render the concatenated component to DOM nodes (Enhanced - Phase 4.2)
|
|
1953
|
+
*/
|
|
1954
|
+
render() {
|
|
1955
|
+
const e = this.determineContainerClass(), t = this.buildAccessibilityLabel(), i = this.buildAccessibilityAttributes(), s = this.modifiers && this.modifiers.some((a) => a.type === "asHTML");
|
|
1956
|
+
let r;
|
|
1957
|
+
return s ? r = this.renderSegmentsWithAsHTML() : r = this.segments.map((a) => a.render()).flat(), [be("span", {
|
|
1958
|
+
class: `tachui-concatenated ${e}`,
|
|
1959
|
+
...i,
|
|
1960
|
+
"aria-label": t || void 0,
|
|
1961
|
+
// Enhanced live region support for dynamic content
|
|
1962
|
+
...this.hasInteractiveContent() && {
|
|
1963
|
+
"aria-live": "polite",
|
|
1964
|
+
"aria-atomic": "true"
|
|
1965
|
+
},
|
|
1966
|
+
// Add debug information in development
|
|
1967
|
+
...process.env.NODE_ENV === "development" && {
|
|
1968
|
+
"data-concatenated-segments": this.segments.length,
|
|
1969
|
+
"data-semantic-structure": this.metadata.semanticStructure,
|
|
1970
|
+
"data-accessibility-role": this.metadata.accessibilityRole
|
|
1971
|
+
}
|
|
1972
|
+
}, ...r)];
|
|
1973
|
+
}
|
|
1974
|
+
/**
|
|
1975
|
+
* Build comprehensive accessibility attributes
|
|
1976
|
+
*/
|
|
1977
|
+
buildAccessibilityAttributes() {
|
|
1978
|
+
const e = {};
|
|
1979
|
+
switch (this.metadata.accessibilityRole) {
|
|
1980
|
+
case "text":
|
|
1981
|
+
break;
|
|
1982
|
+
case "group":
|
|
1983
|
+
e.role = "group", e["aria-describedby"] = this.generateGroupDescription();
|
|
1984
|
+
break;
|
|
1985
|
+
case "composite":
|
|
1986
|
+
e.role = "group", e["aria-roledescription"] = "interactive content group";
|
|
1987
|
+
break;
|
|
1988
|
+
}
|
|
1989
|
+
return this.metadata.semanticStructure === "mixed" && this.segments.length > 2 && (e["aria-flowto"] = this.generateFlowTargets()), this.hasInteractiveContent() && (e.tabindex = "0", e["aria-description"] = "Contains interactive elements. Use Tab to navigate."), e;
|
|
1990
|
+
}
|
|
1991
|
+
/**
|
|
1992
|
+
* Generate description for grouped content
|
|
1993
|
+
*/
|
|
1994
|
+
generateGroupDescription() {
|
|
1995
|
+
const e = this.getUniqueComponentTypes();
|
|
1996
|
+
return e.length === 1 ? `Group of ${this.segments.length} ${e[0]} elements` : `Group containing ${e.join(", ")} elements`;
|
|
1997
|
+
}
|
|
1998
|
+
/**
|
|
1999
|
+
* Generate flow targets for reading order
|
|
2000
|
+
*/
|
|
2001
|
+
generateFlowTargets() {
|
|
2002
|
+
return "";
|
|
2003
|
+
}
|
|
2004
|
+
/**
|
|
2005
|
+
* Check if concatenated content contains interactive elements
|
|
2006
|
+
*/
|
|
2007
|
+
hasInteractiveContent() {
|
|
2008
|
+
return this.segments.some((e) => {
|
|
2009
|
+
const t = e.component.constructor.name;
|
|
2010
|
+
return t === "EnhancedButton" || t === "EnhancedLinkComponent";
|
|
2011
|
+
});
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* Get unique component types in this concatenation
|
|
2015
|
+
*/
|
|
2016
|
+
getUniqueComponentTypes() {
|
|
2017
|
+
const e = new Set(this.segments.map((t) => {
|
|
2018
|
+
switch (t.component.constructor.name) {
|
|
2019
|
+
case "EnhancedText":
|
|
2020
|
+
return "text";
|
|
2021
|
+
case "EnhancedImage":
|
|
2022
|
+
return "image";
|
|
2023
|
+
case "EnhancedButton":
|
|
2024
|
+
return "button";
|
|
2025
|
+
case "EnhancedLinkComponent":
|
|
2026
|
+
return "link";
|
|
2027
|
+
default:
|
|
2028
|
+
return "component";
|
|
2029
|
+
}
|
|
2030
|
+
}));
|
|
2031
|
+
return Array.from(e);
|
|
2032
|
+
}
|
|
2033
|
+
/**
|
|
2034
|
+
* Concatenate this component with another concatenatable component
|
|
2035
|
+
*/
|
|
2036
|
+
concat(e) {
|
|
2037
|
+
let t, i;
|
|
2038
|
+
return e instanceof M ? (t = [...this.segments, ...e.segments], i = this.mergeMetadata(this.metadata, e.metadata, t.length)) : (t = [...this.segments, e.toSegment()], i = this.mergeMetadata(
|
|
2039
|
+
this.metadata,
|
|
2040
|
+
{
|
|
2041
|
+
totalSegments: 1,
|
|
2042
|
+
accessibilityRole: this.determineComponentAccessibilityRole(e),
|
|
2043
|
+
semanticStructure: this.determineComponentSemanticStructure(e)
|
|
2044
|
+
},
|
|
2045
|
+
t.length
|
|
2046
|
+
)), new M(t, i);
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* Convert this concatenated component to a segment (for further concatenation)
|
|
2050
|
+
*/
|
|
2051
|
+
toSegment() {
|
|
2052
|
+
return {
|
|
2053
|
+
id: this.id,
|
|
2054
|
+
component: this,
|
|
2055
|
+
// Cast to satisfy interface requirements
|
|
2056
|
+
modifiers: [],
|
|
2057
|
+
// Concatenated components don't have their own modifiers
|
|
2058
|
+
render: () => this.render()[0]
|
|
2059
|
+
};
|
|
2060
|
+
}
|
|
2061
|
+
/**
|
|
2062
|
+
* Check if this component supports concatenation
|
|
2063
|
+
*/
|
|
2064
|
+
isConcatenatable() {
|
|
2065
|
+
return !0;
|
|
2066
|
+
}
|
|
2067
|
+
/**
|
|
2068
|
+
* Determine the appropriate CSS class for the container
|
|
2069
|
+
*/
|
|
2070
|
+
determineContainerClass() {
|
|
2071
|
+
const e = this.segments.map((o) => o.component.constructor.name), t = e.some((o) => o === "EnhancedImage"), i = e.some((o) => o === "EnhancedText"), s = e.some((o) => o === "EnhancedButton"), r = e.some((o) => o === "EnhancedLink");
|
|
2072
|
+
return t && i && (s || r) ? "mixed-content" : t && i ? "image-text-composition" : t && !i ? "image-composition" : i && !t ? "text-composition" : "generic-composition";
|
|
2073
|
+
}
|
|
2074
|
+
/**
|
|
2075
|
+
* Build comprehensive accessibility label for screen readers (Enhanced - Phase 4.2)
|
|
2076
|
+
*/
|
|
2077
|
+
buildAccessibilityLabel() {
|
|
2078
|
+
const t = this.segments.map((i) => this.extractAccessibilityText(i)).filter(Boolean);
|
|
2079
|
+
return t.length === 0 ? "" : this.joinAccessibilityLabels(t);
|
|
2080
|
+
}
|
|
2081
|
+
/**
|
|
2082
|
+
* Intelligently join accessibility labels based on content and structure
|
|
2083
|
+
*/
|
|
2084
|
+
joinAccessibilityLabels(e) {
|
|
2085
|
+
if (e.length === 1) return e[0];
|
|
2086
|
+
switch (this.metadata.semanticStructure) {
|
|
2087
|
+
case "inline":
|
|
2088
|
+
return e.join(" ");
|
|
2089
|
+
case "block":
|
|
2090
|
+
return e.join(". ");
|
|
2091
|
+
case "mixed":
|
|
2092
|
+
return this.smartJoinLabels(e);
|
|
2093
|
+
default:
|
|
2094
|
+
return e.join(" ");
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
/**
|
|
2098
|
+
* Context-aware label joining for mixed content
|
|
2099
|
+
*/
|
|
2100
|
+
smartJoinLabels(e) {
|
|
2101
|
+
const t = [];
|
|
2102
|
+
for (let i = 0; i < e.length; i++) {
|
|
2103
|
+
const s = e[i], r = e[i + 1];
|
|
2104
|
+
t.push(s), r && (this.needsExplicitSeparator(s, r) ? t.push(". ") : t.push(" "));
|
|
2105
|
+
}
|
|
2106
|
+
return t.join("");
|
|
2107
|
+
}
|
|
2108
|
+
/**
|
|
2109
|
+
* Determine if two accessibility labels need explicit separation
|
|
2110
|
+
*/
|
|
2111
|
+
needsExplicitSeparator(e, t) {
|
|
2112
|
+
const i = /[.!?:;]$/.test(e.trim()), s = /^[A-Z]/.test(t.trim());
|
|
2113
|
+
return !i && s;
|
|
2114
|
+
}
|
|
2115
|
+
/**
|
|
2116
|
+
* Extract accessibility text from a component segment
|
|
2117
|
+
*/
|
|
2118
|
+
extractAccessibilityText(e) {
|
|
2119
|
+
const t = e.component;
|
|
2120
|
+
switch (t.constructor.name) {
|
|
2121
|
+
case "EnhancedText":
|
|
2122
|
+
return t.content || t.title || "";
|
|
2123
|
+
case "EnhancedImage":
|
|
2124
|
+
return t.alt || t.accessibilityLabel || "Image";
|
|
2125
|
+
case "EnhancedButton":
|
|
2126
|
+
return t.title || t.accessibilityLabel || "Button";
|
|
2127
|
+
case "EnhancedLink":
|
|
2128
|
+
return t.title || t.accessibilityLabel || "Link";
|
|
2129
|
+
case "ConcatenatedComponent":
|
|
2130
|
+
return t.buildAccessibilityLabel();
|
|
2131
|
+
default:
|
|
2132
|
+
return t.accessibilityLabel || "";
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
/**
|
|
2136
|
+
* Merge metadata from two concatenation operations
|
|
2137
|
+
*/
|
|
2138
|
+
mergeMetadata(e, t, i) {
|
|
2139
|
+
return {
|
|
2140
|
+
totalSegments: i,
|
|
2141
|
+
accessibilityRole: this.mergeAccessibilityRoles(
|
|
2142
|
+
e.accessibilityRole,
|
|
2143
|
+
t.accessibilityRole
|
|
2144
|
+
),
|
|
2145
|
+
semanticStructure: this.mergeSemanticStructures(
|
|
2146
|
+
e.semanticStructure,
|
|
2147
|
+
t.semanticStructure
|
|
2148
|
+
)
|
|
2149
|
+
};
|
|
2150
|
+
}
|
|
2151
|
+
/**
|
|
2152
|
+
* Merge accessibility roles from two components
|
|
2153
|
+
*/
|
|
2154
|
+
mergeAccessibilityRoles(e, t) {
|
|
2155
|
+
return e === "text" && t === "text" ? "text" : e === "composite" || t === "composite" ? "composite" : "group";
|
|
2156
|
+
}
|
|
2157
|
+
/**
|
|
2158
|
+
* Merge semantic structures from two components
|
|
2159
|
+
*/
|
|
2160
|
+
mergeSemanticStructures(e, t) {
|
|
2161
|
+
return e === "inline" && t === "inline" ? "inline" : e === "block" && t === "block" ? "block" : "mixed";
|
|
2162
|
+
}
|
|
2163
|
+
/**
|
|
2164
|
+
* Determine accessibility role for a single component
|
|
2165
|
+
*/
|
|
2166
|
+
determineComponentAccessibilityRole(e) {
|
|
2167
|
+
switch (e.constructor.name) {
|
|
2168
|
+
case "EnhancedText":
|
|
2169
|
+
return "text";
|
|
2170
|
+
case "EnhancedImage":
|
|
2171
|
+
return "group";
|
|
2172
|
+
case "EnhancedButton":
|
|
2173
|
+
case "EnhancedLink":
|
|
2174
|
+
return "group";
|
|
2175
|
+
default:
|
|
2176
|
+
return "composite";
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
/**
|
|
2180
|
+
* Determine semantic structure for a single component
|
|
2181
|
+
*/
|
|
2182
|
+
determineComponentSemanticStructure(e) {
|
|
2183
|
+
switch (e.constructor.name) {
|
|
2184
|
+
case "EnhancedText":
|
|
2185
|
+
case "EnhancedImage":
|
|
2186
|
+
return "inline";
|
|
2187
|
+
case "EnhancedButton":
|
|
2188
|
+
case "EnhancedLink":
|
|
2189
|
+
return "inline";
|
|
2190
|
+
// Buttons and links are typically inline in concatenation
|
|
2191
|
+
default:
|
|
2192
|
+
return "mixed";
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
/**
|
|
2196
|
+
* Special rendering method for segments with asHTML modifiers
|
|
2197
|
+
*/
|
|
2198
|
+
renderSegmentsWithAsHTML() {
|
|
2199
|
+
const e = this.modifiers?.filter((i) => i.type === "asHTML") || [], t = [];
|
|
2200
|
+
for (const i of this.segments) {
|
|
2201
|
+
const s = i.render(), r = Array.isArray(s) ? s : [s];
|
|
2202
|
+
if (this.isTextSegment(i) && r.length > 0) {
|
|
2203
|
+
const a = this.applyAsHTMLToSegment(r[0], e, i);
|
|
2204
|
+
t.push(a);
|
|
2205
|
+
} else
|
|
2206
|
+
t.push(...r);
|
|
2207
|
+
}
|
|
2208
|
+
return t;
|
|
2209
|
+
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Check if a segment represents a Text component
|
|
2212
|
+
*/
|
|
2213
|
+
isTextSegment(e) {
|
|
2214
|
+
const t = e.component;
|
|
2215
|
+
return t ? t.constructor?.name === "TextComponent" || t.constructor?.name === "EnhancedText" || t.__tachui_component_type === "Text" || t.componentMetadata?.originalType === "Text" : !1;
|
|
2216
|
+
}
|
|
2217
|
+
/**
|
|
2218
|
+
* Apply asHTML modifiers to a segment with proper component context
|
|
2219
|
+
*/
|
|
2220
|
+
applyAsHTMLToSegment(e, t, i) {
|
|
2221
|
+
const s = {
|
|
2222
|
+
element: void 0,
|
|
2223
|
+
// Will be set when the node is rendered to DOM
|
|
2224
|
+
componentId: i.id,
|
|
2225
|
+
phase: "creation",
|
|
2226
|
+
componentInstance: i.component
|
|
2227
|
+
// Pass the original component
|
|
2228
|
+
};
|
|
2229
|
+
return H(e, t, s, { batch: !0 });
|
|
2230
|
+
}
|
|
2231
|
+
/**
|
|
2232
|
+
* Generate comprehensive accessibility tree for this concatenated component
|
|
2233
|
+
*/
|
|
2234
|
+
generateAccessibilityTree() {
|
|
2235
|
+
return {
|
|
2236
|
+
role: this.metadata.accessibilityRole,
|
|
2237
|
+
label: this.buildAccessibilityLabel(),
|
|
2238
|
+
children: this.segments.map((e) => this.segmentToAccessibilityNode(e))
|
|
2239
|
+
};
|
|
2240
|
+
}
|
|
2241
|
+
/**
|
|
2242
|
+
* Convert a component segment to an accessibility node
|
|
2243
|
+
*/
|
|
2244
|
+
segmentToAccessibilityNode(e) {
|
|
2245
|
+
const t = e.component;
|
|
2246
|
+
return {
|
|
2247
|
+
role: this.determineComponentAccessibilityRole(t),
|
|
2248
|
+
label: this.extractAccessibilityText(e),
|
|
2249
|
+
children: t instanceof M ? t.generateAccessibilityTree().children : void 0
|
|
2250
|
+
};
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
export {
|
|
2254
|
+
Ie as A,
|
|
2255
|
+
Pe as B,
|
|
2256
|
+
re as C,
|
|
2257
|
+
ye as D,
|
|
2258
|
+
he as E,
|
|
2259
|
+
q as M,
|
|
2260
|
+
N as S,
|
|
2261
|
+
ie as V,
|
|
2262
|
+
_e as a,
|
|
2263
|
+
H as b,
|
|
2264
|
+
O as c,
|
|
2265
|
+
k as d,
|
|
2266
|
+
Re as e,
|
|
2267
|
+
Oe as f,
|
|
2268
|
+
He as g,
|
|
2269
|
+
be as h,
|
|
2270
|
+
T as i,
|
|
2271
|
+
se as j,
|
|
2272
|
+
ne as k,
|
|
2273
|
+
ke as l,
|
|
2274
|
+
Te as m,
|
|
2275
|
+
V as n,
|
|
2276
|
+
Le as o,
|
|
2277
|
+
oe as p,
|
|
2278
|
+
de as q,
|
|
2279
|
+
Ve as r,
|
|
2280
|
+
Ne as s,
|
|
2281
|
+
We as t,
|
|
2282
|
+
R as u,
|
|
2283
|
+
$e as v,
|
|
2284
|
+
De as w,
|
|
2285
|
+
Be as x,
|
|
2286
|
+
M as y,
|
|
2287
|
+
J as z
|
|
2288
|
+
};
|