@tachui/modifiers 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.
Files changed (197) hide show
  1. package/README.md +19 -9
  2. package/dist/animation/index.d.ts +11 -0
  3. package/dist/animation/index.d.ts.map +1 -0
  4. package/dist/appearance/background.d.ts +23 -6
  5. package/dist/appearance/background.d.ts.map +1 -1
  6. package/dist/appearance/border.d.ts +2 -2
  7. package/dist/appearance/border.d.ts.map +1 -1
  8. package/dist/appearance/clip-shape.d.ts +2 -2
  9. package/dist/appearance/clip-shape.d.ts.map +1 -1
  10. package/dist/appearance/clipped.d.ts +2 -2
  11. package/dist/appearance/clipped.d.ts.map +1 -1
  12. package/dist/appearance/foreground.d.ts +14 -5
  13. package/dist/appearance/foreground.d.ts.map +1 -1
  14. package/dist/appearance/index.js +11 -12
  15. package/dist/appearance/reactive-factories.d.ts +20 -0
  16. package/dist/appearance/reactive-factories.d.ts.map +1 -0
  17. package/dist/attributes/accessibility.d.ts +10 -0
  18. package/dist/attributes/accessibility.d.ts.map +1 -0
  19. package/dist/attributes/aria.d.ts +2 -2
  20. package/dist/attributes/aria.d.ts.map +1 -1
  21. package/dist/attributes/css-properties.d.ts +2 -2
  22. package/dist/attributes/css-properties.d.ts.map +1 -1
  23. package/dist/attributes/html.d.ts +2 -2
  24. package/dist/attributes/html.d.ts.map +1 -1
  25. package/dist/attributes/index.d.ts +1 -0
  26. package/dist/attributes/index.d.ts.map +1 -1
  27. package/dist/base.d.ts +6 -7
  28. package/dist/base.d.ts.map +1 -1
  29. package/dist/base.js +9 -840
  30. package/dist/basic/animation.d.ts +41 -0
  31. package/dist/basic/animation.d.ts.map +1 -0
  32. package/dist/basic/base.d.ts +7 -8
  33. package/dist/basic/base.d.ts.map +1 -1
  34. package/dist/basic/index.d.ts +19 -2
  35. package/dist/basic/index.d.ts.map +1 -1
  36. package/dist/basic/index.js +252 -0
  37. package/dist/basic/margin.d.ts +2 -2
  38. package/dist/basic/margin.d.ts.map +1 -1
  39. package/dist/basic/margin.js +13 -158
  40. package/dist/basic/padding.d.ts +2 -2
  41. package/dist/basic/padding.d.ts.map +1 -1
  42. package/dist/basic/padding.js +13 -153
  43. package/dist/basic/size.d.ts +2 -2
  44. package/dist/basic/size.d.ts.map +1 -1
  45. package/dist/basic/size.js +10 -76
  46. package/dist/effects/backdrop/index.d.ts +60 -0
  47. package/dist/effects/backdrop/index.d.ts.map +1 -0
  48. package/dist/effects/backdrop/index.js +118 -0
  49. package/dist/effects/effects/index.d.ts +190 -0
  50. package/dist/effects/effects/index.d.ts.map +1 -0
  51. package/dist/effects/filters/index.d.ts +297 -0
  52. package/dist/effects/filters/index.d.ts.map +1 -0
  53. package/dist/effects/filters/index.js +234 -0
  54. package/dist/effects/index.d.ts +14 -0
  55. package/dist/effects/index.d.ts.map +1 -0
  56. package/dist/effects/index.js +373 -0
  57. package/dist/effects/internal-exports.d.ts +9 -0
  58. package/dist/effects/internal-exports.d.ts.map +1 -0
  59. package/dist/effects/shadows/index.d.ts +316 -0
  60. package/dist/effects/shadows/index.d.ts.map +1 -0
  61. package/dist/effects/shadows/index.js +405 -0
  62. package/dist/effects/transforms/index.d.ts +316 -0
  63. package/dist/effects/transforms/index.d.ts.map +1 -0
  64. package/dist/effects/transforms/index.js +193 -0
  65. package/dist/elements/pseudo-elements.d.ts +2 -2
  66. package/dist/elements/pseudo-elements.d.ts.map +1 -1
  67. package/dist/essential-manifest.d.ts +5 -0
  68. package/dist/essential-manifest.d.ts.map +1 -0
  69. package/dist/index.d.ts +10 -3
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +273 -881
  72. package/dist/interaction/allows-hit-testing.d.ts +1 -1
  73. package/dist/interaction/allows-hit-testing.d.ts.map +1 -1
  74. package/dist/interaction/dom-events.d.ts +35 -0
  75. package/dist/interaction/dom-events.d.ts.map +1 -0
  76. package/dist/interaction/focus-events.d.ts +54 -0
  77. package/dist/interaction/focus-events.d.ts.map +1 -0
  78. package/dist/interaction/focusable.d.ts +1 -1
  79. package/dist/interaction/focusable.d.ts.map +1 -1
  80. package/dist/interaction/focused.d.ts +1 -1
  81. package/dist/interaction/focused.d.ts.map +1 -1
  82. package/dist/interaction/index.d.ts +5 -0
  83. package/dist/interaction/index.d.ts.map +1 -1
  84. package/dist/interaction/index.js +75 -28
  85. package/dist/interaction/keyboard-events.d.ts +69 -0
  86. package/dist/interaction/keyboard-events.d.ts.map +1 -0
  87. package/dist/interaction/keyboard-shortcut.d.ts +1 -1
  88. package/dist/interaction/keyboard-shortcut.d.ts.map +1 -1
  89. package/dist/interaction/mouse-events.d.ts +125 -0
  90. package/dist/interaction/mouse-events.d.ts.map +1 -0
  91. package/dist/interaction/on-continuous-hover.d.ts +1 -1
  92. package/dist/interaction/on-continuous-hover.d.ts.map +1 -1
  93. package/dist/interaction/on-hover.d.ts +30 -0
  94. package/dist/interaction/on-hover.d.ts.map +1 -0
  95. package/dist/interaction/on-long-press-gesture.d.ts +1 -1
  96. package/dist/interaction/on-long-press-gesture.d.ts.map +1 -1
  97. package/dist/interaction/scroll.d.ts +2 -2
  98. package/dist/interaction/scroll.d.ts.map +1 -1
  99. package/dist/layout/aspect-ratio.d.ts +2 -2
  100. package/dist/layout/aspect-ratio.d.ts.map +1 -1
  101. package/dist/layout/fixed-size.d.ts +2 -2
  102. package/dist/layout/fixed-size.d.ts.map +1 -1
  103. package/dist/layout/flexbox.d.ts +2 -2
  104. package/dist/layout/flexbox.d.ts.map +1 -1
  105. package/dist/layout/frame.d.ts +13 -0
  106. package/dist/layout/frame.d.ts.map +1 -0
  107. package/dist/layout/index.d.ts +2 -0
  108. package/dist/layout/index.d.ts.map +1 -1
  109. package/dist/layout/index.js +25 -22
  110. package/dist/layout/offset.d.ts +2 -2
  111. package/dist/layout/offset.d.ts.map +1 -1
  112. package/dist/layout/overlay.d.ts +1 -1
  113. package/dist/layout/overlay.d.ts.map +1 -1
  114. package/dist/layout/position.d.ts +2 -2
  115. package/dist/layout/position.d.ts.map +1 -1
  116. package/dist/layout/resizable.d.ts +6 -0
  117. package/dist/layout/resizable.d.ts.map +1 -0
  118. package/dist/layout/scale-effect.d.ts +6 -5
  119. package/dist/layout/scale-effect.d.ts.map +1 -1
  120. package/dist/layout/z-index.d.ts +2 -2
  121. package/dist/layout/z-index.d.ts.map +1 -1
  122. package/dist/lifecycle/index.d.ts +6 -0
  123. package/dist/lifecycle/index.d.ts.map +1 -0
  124. package/dist/modifiers-basic-DLmE749_.js +5604 -0
  125. package/dist/navigation/index.d.ts +12 -0
  126. package/dist/navigation/index.d.ts.map +1 -0
  127. package/dist/preload/backdrop.d.ts +5 -0
  128. package/dist/preload/backdrop.d.ts.map +1 -0
  129. package/dist/preload/backdrop.js +7 -0
  130. package/dist/preload/basic.d.ts +7 -0
  131. package/dist/preload/basic.d.ts.map +1 -0
  132. package/dist/preload/basic.js +251 -0
  133. package/dist/preload/effects.d.ts +6 -0
  134. package/dist/preload/effects.d.ts.map +1 -0
  135. package/dist/preload/effects.js +95 -0
  136. package/dist/preload/filters.d.ts +6 -0
  137. package/dist/preload/filters.d.ts.map +1 -0
  138. package/dist/preload/filters.js +31 -0
  139. package/dist/preload/shadows.d.ts +5 -0
  140. package/dist/preload/shadows.d.ts.map +1 -0
  141. package/dist/preload/shadows.js +27 -0
  142. package/dist/preload/transforms.d.ts +5 -0
  143. package/dist/preload/transforms.d.ts.map +1 -0
  144. package/dist/preload/transforms.js +30 -0
  145. package/dist/types.d.ts +7 -6
  146. package/dist/types.d.ts.map +1 -1
  147. package/dist/types.js +0 -1
  148. package/dist/typography/font.d.ts +5 -2
  149. package/dist/typography/font.d.ts.map +1 -1
  150. package/dist/typography/index.d.ts +1 -0
  151. package/dist/typography/index.d.ts.map +1 -1
  152. package/dist/typography/index.js +26 -28
  153. package/dist/typography/text.d.ts +2 -2
  154. package/dist/typography/text.d.ts.map +1 -1
  155. package/dist/typography/text.js +9 -127
  156. package/dist/typography/typography.d.ts +6 -4
  157. package/dist/typography/typography.d.ts.map +1 -1
  158. package/dist/utility/as-html-validator.d.ts +20 -0
  159. package/dist/utility/as-html-validator.d.ts.map +1 -0
  160. package/dist/utility/as-html.d.ts +65 -0
  161. package/dist/utility/as-html.d.ts.map +1 -0
  162. package/dist/utility/basic-sanitizer.d.ts +54 -0
  163. package/dist/utility/basic-sanitizer.d.ts.map +1 -0
  164. package/dist/utility/css.d.ts +2 -2
  165. package/dist/utility/css.d.ts.map +1 -1
  166. package/dist/utility/index.d.ts +3 -0
  167. package/dist/utility/index.d.ts.map +1 -1
  168. package/dist/utility/index.js +19 -15
  169. package/dist/utility/utility.d.ts +2 -2
  170. package/dist/utility/utility.d.ts.map +1 -1
  171. package/dist/version.d.ts +14 -0
  172. package/dist/version.d.ts.map +1 -0
  173. package/package.json +59 -4
  174. package/dist/allows-hit-testing-DscPrcOw.js +0 -464
  175. package/dist/allows-hit-testing-DscPrcOw.js.map +0 -1
  176. package/dist/appearance/index.js.map +0 -1
  177. package/dist/base-CkGf4b9G.js +0 -786
  178. package/dist/base-CkGf4b9G.js.map +0 -1
  179. package/dist/base.js.map +0 -1
  180. package/dist/basic/margin.js.map +0 -1
  181. package/dist/basic/padding.js.map +0 -1
  182. package/dist/basic/size.js.map +0 -1
  183. package/dist/clipped-CCW8gJqJ.js +0 -282
  184. package/dist/clipped-CCW8gJqJ.js.map +0 -1
  185. package/dist/css-CJEXRr6H.js +0 -124
  186. package/dist/css-CJEXRr6H.js.map +0 -1
  187. package/dist/font-3qM2Z97N.js +0 -135
  188. package/dist/font-3qM2Z97N.js.map +0 -1
  189. package/dist/index.js.map +0 -1
  190. package/dist/interaction/index.js.map +0 -1
  191. package/dist/layout/index.js.map +0 -1
  192. package/dist/overlay-DDiSLprp.js +0 -774
  193. package/dist/overlay-DDiSLprp.js.map +0 -1
  194. package/dist/types.js.map +0 -1
  195. package/dist/typography/index.js.map +0 -1
  196. package/dist/typography/text.js.map +0 -1
  197. package/dist/utility/index.js.map +0 -1
@@ -1,786 +0,0 @@
1
- var T = Object.defineProperty;
2
- var M = (v, a, i) => a in v ? T(v, a, { enumerable: !0, configurable: !0, writable: !0, value: i }) : v[a] = i;
3
- var g = (v, a, i) => M(v, typeof a != "symbol" ? a + "" : a, i);
4
- import { isSignal as u, isComputed as m, createEffect as y, getThemeSignal as $ } from "@tachui/core/reactive";
5
- import { ModifierPriority as E } from "@tachui/core/modifiers/types";
6
- import { shouldExpandForInfinity as P, dimensionToCSS as S, isInfinity as C } from "@tachui/core/constants/layout";
7
- class L {
8
- constructor(a) {
9
- this.properties = a;
10
- }
11
- /**
12
- * Helper to resolve reactive properties
13
- */
14
- resolveReactiveProps(a, i) {
15
- const t = {};
16
- for (const [e, n] of Object.entries(a))
17
- u(n) || m(n), t[e] = n;
18
- return t;
19
- }
20
- /**
21
- * Apply a single style change to an element with reactive support
22
- */
23
- applyStyleChange(a, i, t) {
24
- if (a instanceof HTMLElement) {
25
- const e = this.toCSSProperty(i);
26
- if (u(t) || m(t))
27
- y(() => {
28
- const n = t(), s = String(n);
29
- if (s.includes("!important")) {
30
- const o = s.replace(/\s*!important\s*$/, "").trim();
31
- a.style.setProperty(e, o, "important");
32
- } else
33
- a.style.setProperty(e, s);
34
- });
35
- else {
36
- const n = String(t);
37
- if (n.includes("!important")) {
38
- const s = n.replace(/\s*!important\s*$/, "").trim();
39
- a.style.setProperty(e, s, "important");
40
- } else
41
- a.style.setProperty(e, n);
42
- }
43
- }
44
- }
45
- /**
46
- * Convert camelCase property to CSS kebab-case
47
- */
48
- toCSSProperty(a) {
49
- return a.replace(/([A-Z])/g, "-$1").toLowerCase();
50
- }
51
- /**
52
- * Convert value to CSS value string
53
- */
54
- toCSSValue(a) {
55
- return typeof a == "number" ? `${a}px` : String(a);
56
- }
57
- /**
58
- * Convert value to CSS value string with property-specific handling
59
- */
60
- toCSSValueForProperty(a, i) {
61
- return typeof i == "number" ? [
62
- "opacity",
63
- "z-index",
64
- "line-height",
65
- "flex-grow",
66
- "flex-shrink",
67
- "order",
68
- "column-count",
69
- "font-weight"
70
- ].includes(a) ? String(i) : `${i}px` : ([
71
- "filter",
72
- // CSS filter strings should not be processed
73
- "transform",
74
- // CSS transform strings
75
- "clip-path"
76
- // CSS clip-path strings
77
- ].includes(a), String(i));
78
- }
79
- /**
80
- * Apply multiple CSS properties to an element with reactive support
81
- */
82
- applyStyles(a, i) {
83
- if (a instanceof HTMLElement || a.style) {
84
- const t = (a instanceof HTMLElement, a.style);
85
- for (const [e, n] of Object.entries(i))
86
- if (n !== void 0) {
87
- const s = this.toCSSProperty(e);
88
- if (u(n) || m(n))
89
- y(() => {
90
- const o = n(), r = this.toCSSValueForProperty(
91
- s,
92
- o
93
- );
94
- if (t.setProperty)
95
- if (typeof r == "string" && r.includes("!important")) {
96
- const l = r.replace(/\s*!important\s*$/, "").trim();
97
- t.setProperty(s, l, "important");
98
- } else
99
- t.setProperty(s, r);
100
- else
101
- t[s] = r;
102
- });
103
- else {
104
- const o = this.toCSSValueForProperty(s, n);
105
- if (t.setProperty)
106
- if (typeof o == "string" && o.includes("!important")) {
107
- const r = o.replace(/\s*!important\s*$/, "").trim();
108
- t.setProperty(s, r, "important");
109
- } else
110
- t.setProperty(s, o);
111
- else
112
- t[s] = o;
113
- }
114
- }
115
- }
116
- }
117
- /**
118
- * Add CSS classes to an element
119
- */
120
- addClasses(a, i) {
121
- a instanceof HTMLElement && a.classList.add(...i);
122
- }
123
- /**
124
- * Remove CSS classes from an element
125
- */
126
- removeClasses(a, i) {
127
- a instanceof HTMLElement && a.classList.remove(...i);
128
- }
129
- /**
130
- * Create a style computation context
131
- */
132
- createStyleContext(a, i, t) {
133
- return {
134
- componentId: a,
135
- element: i,
136
- modifiers: t,
137
- signals: /* @__PURE__ */ new Set(),
138
- cleanup: []
139
- };
140
- }
141
- }
142
- class V extends L {
143
- constructor() {
144
- super(...arguments);
145
- g(this, "type", "layout");
146
- g(this, "priority", E.LAYOUT);
147
- }
148
- apply(i, t) {
149
- if (!i.element || !t.element) return;
150
- const e = this.createStyleContext(
151
- t.componentId,
152
- t.element,
153
- []
154
- ), n = this.computeLayoutStyles(
155
- this.properties,
156
- e
157
- );
158
- this.applyStyles(t.element, n);
159
- const s = this.properties;
160
- s.offset && t.element instanceof HTMLElement && this.applyOffsetTransform(t.element, s.offset), s.aspectRatio && t.element instanceof HTMLElement && this.applyAspectRatio(t.element, s.aspectRatio), s.scaleEffect && t.element instanceof HTMLElement && this.applyScaleTransform(t.element, s.scaleEffect), s.position && t.element instanceof HTMLElement && this.applyAbsolutePosition(t.element, s.position), s.zIndex !== void 0 && t.element instanceof HTMLElement && this.applyZIndex(t.element, s.zIndex);
161
- }
162
- applyOffsetTransform(i, t) {
163
- const { x: e, y: n } = t;
164
- if (u(e) || m(e) || u(n) || m(n))
165
- y(() => {
166
- const s = u(e) || m(e) ? e() : e ?? 0, o = u(n) || m(n) ? n() : n ?? 0, r = this.toCSSValue(s), l = this.toCSSValue(o), c = `translate(${r}, ${l})`, p = (i.style.transform || "").split(" ").filter((h) => h && !h.startsWith("translate(")).join(" "), d = p ? `${p} ${c}` : c;
167
- i.style.transform = d;
168
- });
169
- else {
170
- const s = e ?? 0, o = n ?? 0, r = this.toCSSValue(s), l = this.toCSSValue(o), c = `translate(${r}, ${l})`, p = (i.style.transform || "").split(" ").filter((h) => h && !h.startsWith("translate(")).join(" "), d = p ? `${p} ${c}` : c;
171
- i.style.transform = d;
172
- }
173
- }
174
- applyAspectRatio(i, t) {
175
- const { ratio: e, contentMode: n } = t;
176
- e !== void 0 && (u(e) || m(e) ? y(() => {
177
- const s = typeof e == "function" ? e() : e;
178
- i.style.aspectRatio = String(s);
179
- }) : i.style.aspectRatio = String(e), n === "fill" ? i.style.objectFit = "cover" : i.style.objectFit = "contain");
180
- }
181
- // Phase 3 - Epic: Butternut Transform Methods
182
- applyScaleTransform(i, t) {
183
- const { x: e, y: n, anchor: s } = t, o = e ?? 1, r = n ?? o;
184
- if (u(o) || m(o) || u(r) || m(r))
185
- y(() => {
186
- const l = u(o) || m(o) ? o() : o, c = u(r) || m(r) ? r() : r, f = `scale(${l}, ${c})`;
187
- i.style.transformOrigin = this.getTransformOrigin(
188
- s || "center"
189
- );
190
- const d = (i.style.transform || "").replace(/\s*scale\([^)]*\)\s*/g, " ").replace(/\s+/g, " ").trim(), h = d ? `${d} ${f}` : f;
191
- i.style.transform = h;
192
- });
193
- else {
194
- const l = `scale(${o}, ${r})`;
195
- i.style.transformOrigin = this.getTransformOrigin(
196
- s || "center"
197
- );
198
- const f = (i.style.transform || "").replace(/\s*scale\([^)]*\)\s*/g, " ").replace(/\s+/g, " ").trim(), p = f ? `${f} ${l}` : l;
199
- i.style.transform = p;
200
- }
201
- }
202
- applyAbsolutePosition(i, t) {
203
- const { x: e, y: n } = t;
204
- if (i.style.position = "absolute", u(e) || m(e) || u(n) || m(n))
205
- y(() => {
206
- const s = u(e) || m(e) ? e() : e ?? 0, o = u(n) || m(n) ? n() : n ?? 0;
207
- i.style.left = this.toCSSValue(s), i.style.top = this.toCSSValue(o);
208
- });
209
- else {
210
- const s = e ?? 0, o = n ?? 0;
211
- i.style.left = this.toCSSValue(s), i.style.top = this.toCSSValue(o);
212
- }
213
- }
214
- applyZIndex(i, t) {
215
- u(t) || m(t) ? y(() => {
216
- const e = t();
217
- i.style.zIndex = String(e);
218
- }) : i.style.zIndex = String(t);
219
- }
220
- getTransformOrigin(i) {
221
- return {
222
- center: "center center",
223
- top: "center top",
224
- topLeading: "left top",
225
- topTrailing: "right top",
226
- bottom: "center bottom",
227
- bottomLeading: "left bottom",
228
- bottomTrailing: "right bottom",
229
- leading: "left center",
230
- trailing: "right center"
231
- }[i] || "center center";
232
- }
233
- computeLayoutStyles(i, t) {
234
- const e = {};
235
- if (i.frame) {
236
- const n = i.frame, s = P(n);
237
- if (Object.assign(e, s.cssProps), n.width !== void 0) {
238
- const o = S(n.width);
239
- o !== void 0 && !C(n.width) && !s.expandWidth && (e.width = o);
240
- }
241
- if (n.height !== void 0) {
242
- const o = S(n.height);
243
- o !== void 0 && !C(n.height) && !s.expandHeight && (e.height = o);
244
- }
245
- if (n.minWidth !== void 0) {
246
- const o = S(n.minWidth);
247
- o !== void 0 && (e.minWidth = o);
248
- }
249
- if (n.maxWidth !== void 0 && !C(n.maxWidth)) {
250
- const o = S(n.maxWidth);
251
- o !== void 0 && (e.maxWidth = o);
252
- } else C(n.maxWidth) && (e.maxWidth = "none", e.flexGrow = "1 !important", e.flexShrink = "1 !important", e.flexBasis = "0% !important", e.alignSelf = "stretch !important");
253
- if (n.minHeight !== void 0) {
254
- const o = S(n.minHeight);
255
- o !== void 0 && (e.minHeight = o);
256
- }
257
- if (n.maxHeight !== void 0 && !C(n.maxHeight)) {
258
- const o = S(n.maxHeight);
259
- o !== void 0 && (e.maxHeight = o);
260
- } else C(n.maxHeight) && (e.maxHeight = "none", e.flexGrow = "1 !important", e.flexShrink = "1 !important", e.flexBasis = "0% !important", e.alignSelf = "stretch !important");
261
- }
262
- if (i.padding !== void 0)
263
- if (typeof i.padding == "number")
264
- e.padding = this.toCSSValue(i.padding);
265
- else {
266
- const n = i.padding;
267
- n.top !== void 0 && (e.paddingTop = this.toCSSValue(n.top)), n.right !== void 0 && (e.paddingRight = this.toCSSValue(n.right)), n.bottom !== void 0 && (e.paddingBottom = this.toCSSValue(n.bottom)), n.left !== void 0 && (e.paddingLeft = this.toCSSValue(n.left));
268
- }
269
- if (i.margin !== void 0)
270
- if (typeof i.margin == "number")
271
- e.margin = this.toCSSValue(i.margin);
272
- else {
273
- const n = i.margin;
274
- n.top !== void 0 && (e.marginTop = this.toCSSValue(n.top)), n.right !== void 0 && (e.marginRight = this.toCSSValue(n.right)), n.bottom !== void 0 && (e.marginBottom = this.toCSSValue(n.bottom)), n.left !== void 0 && (e.marginLeft = this.toCSSValue(n.left));
275
- }
276
- if (i.alignment)
277
- switch (i.alignment) {
278
- case "leading":
279
- e.textAlign = "left", e.alignItems = "flex-start";
280
- break;
281
- case "center":
282
- e.textAlign = "center", e.alignItems = "center";
283
- break;
284
- case "trailing":
285
- e.textAlign = "right", e.alignItems = "flex-end";
286
- break;
287
- case "top":
288
- e.alignItems = "flex-start";
289
- break;
290
- case "bottom":
291
- e.alignItems = "flex-end";
292
- break;
293
- }
294
- if (i.layoutPriority !== void 0) {
295
- const n = Number(i.layoutPriority);
296
- n > 0 ? (e.flexShrink = "0", e.flexGrow = String(Math.max(1, n / 10)), e.zIndex = String(n), e.gridRowEnd = `span ${String(Math.min(10, Math.max(1, Math.ceil(n / 10))))}`, e.gridColumnEnd = `span ${String(Math.min(10, Math.max(1, Math.ceil(n / 10))))}`) : n === 0 ? (e.flexShrink = "1", e.flexGrow = "1") : (e.flexShrink = String(Math.abs(n)), e.flexGrow = "0", e.zIndex = String(n)), e && typeof e == "object" && "setProperty" in e && e.setProperty("--layout-priority", String(n));
297
- }
298
- if (i.offset, i.aspectRatio) {
299
- const { ratio: n, contentMode: s } = i.aspectRatio;
300
- n !== void 0 && (e.aspectRatio = typeof n == "number" ? String(n) : n, s === "fill" ? e.objectFit = "cover" : e.objectFit = "contain");
301
- }
302
- if (i.fixedSize) {
303
- const { horizontal: n, vertical: s } = i.fixedSize;
304
- n && (e.flexShrink = "0", e.width = "max-content"), s && (e.flexShrink = "0", e.height = "max-content");
305
- }
306
- return e;
307
- }
308
- }
309
- class I extends L {
310
- constructor() {
311
- super(...arguments);
312
- g(this, "type", "appearance");
313
- g(this, "priority", E.APPEARANCE);
314
- }
315
- apply(i, t) {
316
- if (!i.element || !t.element)
317
- return;
318
- const e = this.createStyleContext(
319
- t.componentId,
320
- t.element,
321
- []
322
- ), n = this.resolveReactiveProps(
323
- this.properties,
324
- e
325
- );
326
- this.applyAssetBasedStyles(t.element, n);
327
- const s = this.computeAppearanceStyles(n);
328
- this.applyStyles(t.element, s);
329
- }
330
- /**
331
- * Apply Asset-based styles with theme reactivity
332
- */
333
- applyAssetBasedStyles(i, t) {
334
- const e = $();
335
- t.foregroundColor && this.isAsset(t.foregroundColor) && y(() => {
336
- e();
337
- const n = t.foregroundColor.resolve();
338
- this.applyStyleChange(i, "color", n);
339
- }), t.backgroundColor && this.isAsset(t.backgroundColor) && y(() => {
340
- e();
341
- const n = t.backgroundColor.resolve();
342
- this.applyStyleChange(i, "backgroundColor", n);
343
- }), t.border?.color && this.isAsset(t.border.color) && y(() => {
344
- e();
345
- const n = t.border.color.resolve();
346
- this.applyStyleChange(i, "borderColor", n);
347
- });
348
- }
349
- /**
350
- * Check if a value is an Asset object (including Asset proxies)
351
- */
352
- isAsset(i) {
353
- return i != null && typeof i == "object" && "resolve" in i && typeof i.resolve == "function";
354
- }
355
- computeAppearanceStyles(i) {
356
- const t = {};
357
- if (i.foregroundColor && !this.isAsset(i.foregroundColor) && (t.color = i.foregroundColor), i.backgroundColor && !this.isAsset(i.backgroundColor) && (t.backgroundColor = i.backgroundColor), i.opacity !== void 0 && (t.opacity = i.opacity), i.font) {
358
- const n = i.font;
359
- n.family && (typeof n.family == "object" && n.family !== null && "resolve" in n.family ? t.fontFamily = n.family.resolve() : t.fontFamily = n.family), n.size && (t.fontSize = this.toCSSValue(n.size)), n.weight && (t.fontWeight = String(n.weight)), n.style && (t.fontStyle = n.style);
360
- }
361
- if (i.cornerRadius !== void 0 && (t.borderRadius = this.toCSSValue(i.cornerRadius)), i.border) {
362
- const n = i.border;
363
- n.width !== void 0 && (t.borderWidth = this.toCSSValue(n.width)), n.color && !this.isAsset(n.color) && (t.borderColor = n.color), n.style && (t.borderStyle = n.style);
364
- }
365
- if (i.shadow) {
366
- const n = i.shadow, s = n.x || 0, o = n.y || 0, r = n.radius || 0, l = n.color || "rgba(0,0,0,0.25)";
367
- t.boxShadow = `${s}px ${o}px ${r}px ${l}`;
368
- }
369
- if (i.clipped && (t.overflow = "hidden"), i.clipShape) {
370
- const { shape: n, parameters: s } = i.clipShape;
371
- switch (n) {
372
- case "circle":
373
- t.clipPath = "circle(50%)";
374
- break;
375
- case "ellipse": {
376
- const o = s?.radiusX || "50%", r = s?.radiusY || "50%";
377
- t.clipPath = `ellipse(${o} ${r} at center)`;
378
- break;
379
- }
380
- case "rect": {
381
- const o = s?.inset || 0;
382
- t.clipPath = `inset(${o}px)`;
383
- break;
384
- }
385
- case "polygon": {
386
- const o = s?.points || "0% 0%, 100% 0%, 100% 100%, 0% 100%";
387
- t.clipPath = `polygon(${o})`;
388
- break;
389
- }
390
- }
391
- }
392
- const e = [];
393
- return i.blur !== void 0 && e.push(`blur(${i.blur}px)`), i.brightness !== void 0 && e.push(`brightness(${i.brightness})`), i.contrast !== void 0 && e.push(`contrast(${i.contrast})`), i.saturation !== void 0 && e.push(`saturate(${i.saturation})`), i.hueRotation !== void 0 && e.push(`hue-rotate(${i.hueRotation}deg)`), i.grayscale !== void 0 && e.push(`grayscale(${i.grayscale})`), i.colorInvert !== void 0 && e.push(`invert(${i.colorInvert})`), e.length > 0 && (t.filter = e.join(" ")), t;
394
- }
395
- }
396
- class R extends L {
397
- constructor() {
398
- super(...arguments);
399
- g(this, "type", "interaction");
400
- g(this, "priority", E.INTERACTION);
401
- }
402
- apply(i, t) {
403
- if (!t.element) return;
404
- const e = this.properties;
405
- e.onTap && t.element.addEventListener("click", e.onTap), e.onHover && (t.element.addEventListener("mouseenter", () => e.onHover(!0)), t.element.addEventListener("mouseleave", () => e.onHover(!1))), e.onMouseEnter && t.element.addEventListener("mouseenter", e.onMouseEnter), e.onMouseLeave && t.element.addEventListener("mouseleave", e.onMouseLeave), e.onMouseDown && t.element.addEventListener("mousedown", e.onMouseDown), e.onMouseUp && t.element.addEventListener("mouseup", e.onMouseUp), e.onDragStart && t.element.addEventListener("dragstart", e.onDragStart), e.onDragOver && t.element.addEventListener("dragover", e.onDragOver), e.onDragLeave && t.element.addEventListener("dragleave", e.onDragLeave), e.onDrop && t.element.addEventListener("drop", e.onDrop), e.onDoubleClick && t.element.addEventListener("dblclick", e.onDoubleClick), e.onContextMenu && t.element.addEventListener("contextmenu", e.onContextMenu), e.onFocus && (t.element.addEventListener("focus", () => e.onFocus(!0)), t.element.addEventListener("blur", () => e.onFocus(!1))), e.onBlur && t.element.addEventListener("blur", () => e.onBlur(!1)), e.onKeyPress && t.element.addEventListener("keypress", e.onKeyPress), e.onKeyDown && t.element.addEventListener("keydown", e.onKeyDown), e.onKeyUp && t.element.addEventListener("keyup", e.onKeyUp), e.onScroll && t.element.addEventListener("scroll", e.onScroll, {
406
- passive: !0
407
- }), e.onWheel && t.element.addEventListener("wheel", e.onWheel, {
408
- passive: !1
409
- }), e.onInput && t.element.addEventListener("input", e.onInput), e.onChange && t.element.addEventListener("change", (n) => {
410
- const s = n.target, o = s.value || s.textContent || "";
411
- e.onChange(o, n);
412
- }), e.onCopy && t.element.addEventListener("copy", e.onCopy), e.onCut && t.element.addEventListener("cut", e.onCut), e.onPaste && t.element.addEventListener("paste", e.onPaste), e.onSelect && t.element.addEventListener("select", e.onSelect), e.disabled !== void 0 && t.element instanceof HTMLElement && (e.disabled ? (t.element.setAttribute("disabled", "true"), t.element.style.pointerEvents = "none", t.element.style.opacity = "0.6") : (t.element.removeAttribute("disabled"), t.element.style.pointerEvents = "", t.element.style.opacity = "")), e.draggable !== void 0 && t.element instanceof HTMLElement && (t.element.draggable = e.draggable), e.accessibilityLabel && t.element.setAttribute("aria-label", e.accessibilityLabel), e.accessibilityHint && t.element.setAttribute("aria-describedby", e.accessibilityHint), e.onLongPressGesture && this.setupLongPressGesture(t.element, e.onLongPressGesture), e.keyboardShortcut && this.setupKeyboardShortcut(t.element, e.keyboardShortcut), e.focused !== void 0 && this.setupFocusManagement(t.element, e.focused), e.focusable && this.setupFocusable(t.element, e.focusable), e.onContinuousHover && this.setupContinuousHover(t.element, e.onContinuousHover), e.allowsHitTesting !== void 0 && this.setupHitTesting(t.element, e.allowsHitTesting);
413
- }
414
- // Phase 4 Advanced Gesture Methods
415
- /**
416
- * Setup long press gesture with timing and distance constraints
417
- */
418
- setupLongPressGesture(i, t) {
419
- const e = t.minimumDuration ?? 500, n = t.maximumDistance ?? 10;
420
- let s, o = null, r = !1;
421
- const l = () => {
422
- s && (clearTimeout(s), s = void 0), r && t.onPressingChanged && t.onPressingChanged(!1), r = !1, o = null;
423
- }, c = (h) => {
424
- const b = h;
425
- o = { x: b.clientX, y: b.clientY }, r = !0, t.onPressingChanged && t.onPressingChanged(!0), s = window.setTimeout(() => {
426
- r && o && (t.perform(), l());
427
- }, e);
428
- }, f = (h) => {
429
- const b = h;
430
- if (!o || !r) return;
431
- Math.sqrt(
432
- Math.pow(b.clientX - o.x, 2) + Math.pow(b.clientY - o.y, 2)
433
- ) > n && l();
434
- }, p = () => {
435
- l();
436
- }, d = () => {
437
- l();
438
- };
439
- i.addEventListener("pointerdown", c), i.addEventListener("pointermove", f), i.addEventListener("pointerup", p), i.addEventListener(
440
- "pointercancel",
441
- d
442
- ), i._longPressCleanup = l;
443
- }
444
- /**
445
- * Setup keyboard shortcut handling
446
- */
447
- setupKeyboardShortcut(i, t) {
448
- const e = t.modifiers ?? [], n = (s) => {
449
- const o = {
450
- cmd: e.includes("cmd") || e.includes("meta"),
451
- ctrl: e.includes("ctrl"),
452
- shift: e.includes("shift"),
453
- alt: e.includes("alt")
454
- }, r = {
455
- cmd: s.metaKey || s.ctrlKey,
456
- // Handle both Mac (meta) and PC (ctrl)
457
- ctrl: s.ctrlKey,
458
- shift: s.shiftKey,
459
- alt: s.altKey
460
- }, l = s.key.toLowerCase() === t.key.toLowerCase(), c = Object.entries(o).every(
461
- ([f, p]) => p === r[f]
462
- );
463
- l && c && (s.preventDefault(), t.action());
464
- };
465
- document.addEventListener("keydown", n), i._keyboardShortcutCleanup = () => {
466
- document.removeEventListener("keydown", n);
467
- };
468
- }
469
- /**
470
- * Setup focus management with reactive binding
471
- */
472
- setupFocusManagement(i, t) {
473
- if (!(i instanceof HTMLElement)) return;
474
- const e = i;
475
- e.hasAttribute("tabindex") || e.setAttribute("tabindex", "0"), u(t) || m(t) ? y(() => {
476
- t() ? e.focus() : e.blur();
477
- }) : t && e.focus();
478
- }
479
- /**
480
- * Setup focusable behavior
481
- */
482
- setupFocusable(i, t) {
483
- if (!(i instanceof HTMLElement)) return;
484
- const e = i;
485
- t.isFocusable === !1 ? e.setAttribute("tabindex", "-1") : e.hasAttribute("tabindex") || e.setAttribute("tabindex", "0"), t.interactions?.includes("activate") && e.addEventListener("keydown", (n) => {
486
- (n.key === "Enter" || n.key === " ") && (n.preventDefault(), e.click());
487
- }), t.interactions?.includes("edit") && (e.setAttribute("role", "textbox"), e.setAttribute("contenteditable", "true"));
488
- }
489
- /**
490
- * Setup continuous hover tracking with coordinates
491
- */
492
- setupContinuousHover(i, t) {
493
- const e = t.coordinateSpace ?? "local", n = (o) => {
494
- const r = o;
495
- let l, c;
496
- if (e === "local") {
497
- const f = i.getBoundingClientRect();
498
- l = r.clientX - f.left, c = r.clientY - f.top;
499
- } else
500
- l = r.clientX, c = r.clientY;
501
- t.perform({ x: l, y: c });
502
- }, s = () => {
503
- t.perform(null);
504
- };
505
- i.addEventListener("mousemove", n), i.addEventListener("mouseleave", s), i._continuousHoverCleanup = () => {
506
- i.removeEventListener("mousemove", n), i.removeEventListener(
507
- "mouseleave",
508
- s
509
- );
510
- };
511
- }
512
- /**
513
- * Setup hit testing control
514
- */
515
- setupHitTesting(i, t) {
516
- i instanceof HTMLElement && (i.style.pointerEvents = t ? "" : "none");
517
- }
518
- }
519
- class O extends L {
520
- constructor() {
521
- super(...arguments);
522
- g(this, "type", "animation");
523
- g(this, "priority", E.ANIMATION);
524
- }
525
- apply(i, t) {
526
- if (!t.element) return;
527
- const e = this.properties;
528
- if (e.transition) {
529
- const n = e.transition, s = n.property || "all", o = n.duration || 300, r = n.easing || "ease", l = n.delay || 0;
530
- t.element instanceof HTMLElement && (t.element.style.transition = `${s} ${o}ms ${r} ${l}ms`);
531
- }
532
- if (e.animation && t.element instanceof HTMLElement) {
533
- const n = e.animation;
534
- if (n.keyframes) {
535
- const s = `tachui-animation-${t.componentId}-${Date.now()}`, o = this.createKeyframeRule(
536
- s,
537
- n.keyframes
538
- );
539
- this.addKeyframesToStylesheet(o);
540
- const r = n.duration || 1e3, l = n.easing || "ease", c = n.iterations || 1, f = n.direction || "normal";
541
- t.element.style.animation = `${s} ${r}ms ${l} ${c} ${f}`;
542
- }
543
- }
544
- if (e.transform && t.element instanceof HTMLElement && (u(e.transform) || m(e.transform) ? y(() => {
545
- const n = e.transform();
546
- t.element instanceof HTMLElement && (t.element.style.transform = n);
547
- }) : t.element.style.transform = e.transform), e.rotationEffect && t.element instanceof HTMLElement) {
548
- const { angle: n, anchor: s } = e.rotationEffect, r = {
549
- center: "50% 50%",
550
- top: "50% 0%",
551
- topLeading: "0% 0%",
552
- topTrailing: "100% 0%",
553
- bottom: "50% 100%",
554
- bottomLeading: "0% 100%",
555
- bottomTrailing: "100% 100%",
556
- leading: "0% 50%",
557
- trailing: "100% 50%"
558
- }[s || "center"] || "50% 50%", l = `rotate(${n}deg)`;
559
- if (u(n) || m(n))
560
- y(() => {
561
- const f = `rotate(${typeof n == "function" ? n() : n}deg)`;
562
- if (t.element instanceof HTMLElement) {
563
- t.element.style.transformOrigin = r;
564
- const d = (t.element.style.transform || "").split(" ").filter((b) => b && !b.startsWith("rotate(")).join(" "), h = d ? `${d} ${f}` : f;
565
- t.element.style.transform = h;
566
- }
567
- });
568
- else if (t.element instanceof HTMLElement) {
569
- t.element.style.transformOrigin = r;
570
- const f = (t.element.style.transform || "").split(" ").filter((d) => d && !d.startsWith("rotate(")).join(" "), p = f ? `${f} ${l}` : l;
571
- t.element.style.transform = p;
572
- }
573
- }
574
- e.overlay && t.element instanceof HTMLElement && this.applyOverlay(t.element, e.overlay, t);
575
- }
576
- applyOverlay(i, t, e) {
577
- const { content: n, alignment: s = "center" } = t;
578
- (i.style.position === "" || i.style.position === "static") && (i.style.position = "relative");
579
- const o = document.createElement("div");
580
- o.style.position = "absolute", o.style.pointerEvents = "none";
581
- const r = this.getOverlayAlignment(s);
582
- if (Object.assign(o.style, r), typeof n == "function") {
583
- const l = n();
584
- if (l && typeof l.render == "function") {
585
- const c = l.render();
586
- c.element && o.appendChild(c.element);
587
- }
588
- } else if (n && typeof n.render == "function") {
589
- const l = n.render();
590
- l.element && o.appendChild(l.element);
591
- } else n instanceof HTMLElement && o.appendChild(n);
592
- i.appendChild(o);
593
- }
594
- getOverlayAlignment(i) {
595
- const t = {
596
- center: {
597
- top: "50%",
598
- left: "50%",
599
- transform: "translate(-50%, -50%)"
600
- },
601
- top: {
602
- top: "0",
603
- left: "50%",
604
- transform: "translateX(-50%)"
605
- },
606
- bottom: {
607
- bottom: "0",
608
- left: "50%",
609
- transform: "translateX(-50%)"
610
- },
611
- leading: {
612
- top: "50%",
613
- left: "0",
614
- transform: "translateY(-50%)"
615
- },
616
- trailing: {
617
- top: "50%",
618
- right: "0",
619
- transform: "translateY(-50%)"
620
- },
621
- topLeading: {
622
- top: "0",
623
- left: "0"
624
- },
625
- topTrailing: {
626
- top: "0",
627
- right: "0"
628
- },
629
- bottomLeading: {
630
- bottom: "0",
631
- left: "0"
632
- },
633
- bottomTrailing: {
634
- bottom: "0",
635
- right: "0"
636
- }
637
- };
638
- return t[i] || t.center;
639
- }
640
- createKeyframeRule(i, t) {
641
- let e = `@keyframes ${i} {
642
- `;
643
- for (const [n, s] of Object.entries(t)) {
644
- e += ` ${n} {
645
- `;
646
- for (const [o, r] of Object.entries(s)) {
647
- const l = this.toCSSProperty(o);
648
- e += ` ${l}: ${r};
649
- `;
650
- }
651
- e += ` }
652
- `;
653
- }
654
- return e += "}", e;
655
- }
656
- addKeyframesToStylesheet(i) {
657
- let t = document.querySelector(
658
- "#tachui-animations"
659
- );
660
- t || (t = document.createElement("style"), t.id = "tachui-animations", document.head.appendChild(t)), t.appendChild(document.createTextNode(i));
661
- }
662
- }
663
- class D extends L {
664
- constructor() {
665
- super(...arguments);
666
- g(this, "type", "lifecycle");
667
- g(this, "priority", E.CUSTOM);
668
- g(this, "activeAbortController");
669
- }
670
- apply(i, t) {
671
- if (!t.element) return;
672
- const e = this.properties;
673
- this.activeAbortController && this.activeAbortController.abort(), (e.onAppear || e.onDisappear) && this.setupLifecycleObserver(t.element, e), e.task && this.setupTask(t, e.task), e.refreshable && this.setupRefreshable(t.element, e.refreshable);
674
- }
675
- setupLifecycleObserver(i, t) {
676
- const e = new IntersectionObserver(
677
- (n) => {
678
- n.forEach((s) => {
679
- s.isIntersecting && t.onAppear ? t.onAppear() : !s.isIntersecting && t.onDisappear && t.onDisappear();
680
- });
681
- },
682
- {
683
- threshold: 0.1,
684
- // Trigger when 10% of element is visible
685
- rootMargin: "10px"
686
- // Add some margin for better UX
687
- }
688
- );
689
- e.observe(i), this.addCleanup(() => {
690
- e.disconnect();
691
- });
692
- }
693
- setupTask(i, t) {
694
- if (!t) return;
695
- this.activeAbortController = new AbortController();
696
- const { signal: e } = this.activeAbortController;
697
- (async () => {
698
- try {
699
- if (e.aborted) return;
700
- const s = t.operation();
701
- s instanceof Promise && await s;
702
- } catch (s) {
703
- if (e.aborted) return;
704
- console.error("TachUI Task Error:", s);
705
- }
706
- })(), this.addCleanup(() => {
707
- this.activeAbortController && this.activeAbortController.abort();
708
- });
709
- }
710
- setupRefreshable(i, t) {
711
- if (!t) return;
712
- let e = !1, n = 0, s = 0;
713
- const o = 70, r = document.createElement("div");
714
- if (r.style.cssText = `
715
- position: absolute;
716
- top: -50px;
717
- left: 50%;
718
- transform: translateX(-50%);
719
- width: 30px;
720
- height: 30px;
721
- border: 2px solid #ccc;
722
- border-top: 2px solid #007AFF;
723
- border-radius: 50%;
724
- animation: tachui-spin 1s linear infinite;
725
- opacity: 0;
726
- transition: opacity 0.3s ease;
727
- z-index: 1000;
728
- `, !document.querySelector("#tachui-refresh-styles")) {
729
- const d = document.createElement("style");
730
- d.id = "tachui-refresh-styles", d.textContent = `
731
- @keyframes tachui-spin {
732
- 0% { transform: translateX(-50%) rotate(0deg); }
733
- 100% { transform: translateX(-50%) rotate(360deg); }
734
- }
735
- `, document.head.appendChild(d);
736
- }
737
- const l = i.parentElement || i;
738
- l instanceof HTMLElement && (l.style.position = "relative", l.appendChild(r));
739
- const c = (d) => {
740
- e || (s = d.touches[0].clientY);
741
- }, f = (d) => {
742
- if (e) return;
743
- const h = d.touches[0].clientY;
744
- if (n = Math.max(0, h - s), n > 20) {
745
- d.preventDefault();
746
- const b = Math.min(n / o, 1);
747
- r.style.opacity = String(b * 0.8), r.style.top = `${-50 + b * 20}px`;
748
- }
749
- }, p = async () => {
750
- if (e || n < o) {
751
- r.style.opacity = "0", r.style.top = "-50px", n = 0;
752
- return;
753
- }
754
- e = !0, r.style.opacity = "1", r.style.top = "10px";
755
- try {
756
- await t.onRefresh();
757
- } catch (d) {
758
- console.error("TachUI Refresh Error:", d);
759
- } finally {
760
- e = !1, r.style.opacity = "0", r.style.top = "-50px", n = 0;
761
- }
762
- };
763
- i.addEventListener("touchstart", c, {
764
- passive: !1
765
- }), i.addEventListener("touchmove", f, {
766
- passive: !1
767
- }), i.addEventListener("touchend", p), this.addCleanup(() => {
768
- i.removeEventListener(
769
- "touchstart",
770
- c
771
- ), i.removeEventListener("touchmove", f), i.removeEventListener("touchend", p), r.parentElement && r.parentElement.removeChild(r);
772
- });
773
- }
774
- addCleanup(i) {
775
- this.properties._cleanupFunctions || (this.properties._cleanupFunctions = []), this.properties._cleanupFunctions.push(i);
776
- }
777
- }
778
- export {
779
- I as A,
780
- L as B,
781
- R as I,
782
- V as L,
783
- O as a,
784
- D as b
785
- };
786
- //# sourceMappingURL=base-CkGf4b9G.js.map