@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
package/dist/base.js CHANGED
@@ -1,842 +1,11 @@
1
- var T = Object.defineProperty;
2
- var M = (v, l, n) => l in v ? T(v, l, { enumerable: !0, configurable: !0, writable: !0, value: n }) : v[l] = n;
3
- var y = (v, l, n) => M(v, typeof l != "symbol" ? l + "" : l, n);
4
- import { isSignal as u, isComputed as m, createEffect as g, getThemeSignal as w } from "@tachui/core/reactive";
5
- import { ModifierPriority as E } from "@tachui/core/modifiers/types";
6
- import { shouldExpandForInfinity as A, dimensionToCSS as S, isInfinity as C } from "@tachui/core/constants/layout";
7
- class L {
8
- constructor(l) {
9
- this.properties = l;
10
- }
11
- /**
12
- * Helper to resolve reactive properties
13
- */
14
- resolveReactiveProps(l, n) {
15
- const t = {};
16
- for (const [e, i] of Object.entries(l))
17
- u(i) || m(i), t[e] = i;
18
- return t;
19
- }
20
- /**
21
- * Apply a single style change to an element with reactive support
22
- */
23
- applyStyleChange(l, n, t) {
24
- if (l instanceof HTMLElement) {
25
- const e = this.toCSSProperty(n);
26
- if (u(t) || m(t))
27
- g(() => {
28
- const i = t(), s = String(i);
29
- if (s.includes("!important")) {
30
- const o = s.replace(/\s*!important\s*$/, "").trim();
31
- l.style.setProperty(e, o, "important");
32
- } else
33
- l.style.setProperty(e, s);
34
- });
35
- else {
36
- const i = String(t);
37
- if (i.includes("!important")) {
38
- const s = i.replace(/\s*!important\s*$/, "").trim();
39
- l.style.setProperty(e, s, "important");
40
- } else
41
- l.style.setProperty(e, i);
42
- }
43
- }
44
- }
45
- /**
46
- * Convert camelCase property to CSS kebab-case
47
- */
48
- toCSSProperty(l) {
49
- return l.replace(/([A-Z])/g, "-$1").toLowerCase();
50
- }
51
- /**
52
- * Convert value to CSS value string
53
- */
54
- toCSSValue(l) {
55
- return typeof l == "number" ? `${l}px` : String(l);
56
- }
57
- /**
58
- * Convert value to CSS value string with property-specific handling
59
- */
60
- toCSSValueForProperty(l, n) {
61
- return typeof n == "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(l) ? String(n) : `${n}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(l), String(n));
78
- }
79
- /**
80
- * Apply multiple CSS properties to an element with reactive support
81
- */
82
- applyStyles(l, n) {
83
- if (l instanceof HTMLElement || l.style) {
84
- const t = (l instanceof HTMLElement, l.style);
85
- for (const [e, i] of Object.entries(n))
86
- if (i !== void 0) {
87
- const s = this.toCSSProperty(e);
88
- if (u(i) || m(i))
89
- g(() => {
90
- const o = i(), r = this.toCSSValueForProperty(
91
- s,
92
- o
93
- );
94
- if (t.setProperty)
95
- if (typeof r == "string" && r.includes("!important")) {
96
- const a = r.replace(/\s*!important\s*$/, "").trim();
97
- t.setProperty(s, a, "important");
98
- } else
99
- t.setProperty(s, r);
100
- else
101
- t[s] = r;
102
- });
103
- else {
104
- const o = this.toCSSValueForProperty(s, i);
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(l, n) {
121
- l instanceof HTMLElement && l.classList.add(...n);
122
- }
123
- /**
124
- * Remove CSS classes from an element
125
- */
126
- removeClasses(l, n) {
127
- l instanceof HTMLElement && l.classList.remove(...n);
128
- }
129
- /**
130
- * Create a style computation context
131
- */
132
- createStyleContext(l, n, t) {
133
- return {
134
- componentId: l,
135
- element: n,
136
- modifiers: t,
137
- signals: /* @__PURE__ */ new Set(),
138
- cleanup: []
139
- };
140
- }
141
- }
142
- class R extends L {
143
- constructor() {
144
- super(...arguments);
145
- y(this, "type", "layout");
146
- y(this, "priority", E.LAYOUT);
147
- }
148
- apply(n, t) {
149
- if (!n.element || !t.element) return;
150
- const e = this.createStyleContext(
151
- t.componentId,
152
- t.element,
153
- []
154
- ), i = this.computeLayoutStyles(
155
- this.properties,
156
- e
157
- );
158
- this.applyStyles(t.element, i);
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(n, t) {
163
- const { x: e, y: i } = t;
164
- if (u(e) || m(e) || u(i) || m(i))
165
- g(() => {
166
- const s = u(e) || m(e) ? e() : e ?? 0, o = u(i) || m(i) ? i() : i ?? 0, r = this.toCSSValue(s), a = this.toCSSValue(o), c = `translate(${r}, ${a})`, h = (n.style.transform || "").split(" ").filter((p) => p && !p.startsWith("translate(")).join(" "), d = h ? `${h} ${c}` : c;
167
- n.style.transform = d;
168
- });
169
- else {
170
- const s = e ?? 0, o = i ?? 0, r = this.toCSSValue(s), a = this.toCSSValue(o), c = `translate(${r}, ${a})`, h = (n.style.transform || "").split(" ").filter((p) => p && !p.startsWith("translate(")).join(" "), d = h ? `${h} ${c}` : c;
171
- n.style.transform = d;
172
- }
173
- }
174
- applyAspectRatio(n, t) {
175
- const { ratio: e, contentMode: i } = t;
176
- e !== void 0 && (u(e) || m(e) ? g(() => {
177
- const s = typeof e == "function" ? e() : e;
178
- n.style.aspectRatio = String(s);
179
- }) : n.style.aspectRatio = String(e), i === "fill" ? n.style.objectFit = "cover" : n.style.objectFit = "contain");
180
- }
181
- // Phase 3 - Epic: Butternut Transform Methods
182
- applyScaleTransform(n, t) {
183
- const { x: e, y: i, anchor: s } = t, o = e ?? 1, r = i ?? o;
184
- if (u(o) || m(o) || u(r) || m(r))
185
- g(() => {
186
- const a = u(o) || m(o) ? o() : o, c = u(r) || m(r) ? r() : r, f = `scale(${a}, ${c})`;
187
- n.style.transformOrigin = this.getTransformOrigin(
188
- s || "center"
189
- );
190
- const d = (n.style.transform || "").replace(/\s*scale\([^)]*\)\s*/g, " ").replace(/\s+/g, " ").trim(), p = d ? `${d} ${f}` : f;
191
- n.style.transform = p;
192
- });
193
- else {
194
- const a = `scale(${o}, ${r})`;
195
- n.style.transformOrigin = this.getTransformOrigin(
196
- s || "center"
197
- );
198
- const f = (n.style.transform || "").replace(/\s*scale\([^)]*\)\s*/g, " ").replace(/\s+/g, " ").trim(), h = f ? `${f} ${a}` : a;
199
- n.style.transform = h;
200
- }
201
- }
202
- applyAbsolutePosition(n, t) {
203
- const { x: e, y: i } = t;
204
- if (n.style.position = "absolute", u(e) || m(e) || u(i) || m(i))
205
- g(() => {
206
- const s = u(e) || m(e) ? e() : e ?? 0, o = u(i) || m(i) ? i() : i ?? 0;
207
- n.style.left = this.toCSSValue(s), n.style.top = this.toCSSValue(o);
208
- });
209
- else {
210
- const s = e ?? 0, o = i ?? 0;
211
- n.style.left = this.toCSSValue(s), n.style.top = this.toCSSValue(o);
212
- }
213
- }
214
- applyZIndex(n, t) {
215
- u(t) || m(t) ? g(() => {
216
- const e = t();
217
- n.style.zIndex = String(e);
218
- }) : n.style.zIndex = String(t);
219
- }
220
- getTransformOrigin(n) {
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
- }[n] || "center center";
232
- }
233
- computeLayoutStyles(n, t) {
234
- const e = {};
235
- if (n.frame) {
236
- const i = n.frame, s = A(i);
237
- if (Object.assign(e, s.cssProps), i.width !== void 0) {
238
- const o = S(i.width);
239
- o !== void 0 && !C(i.width) && !s.expandWidth && (e.width = o);
240
- }
241
- if (i.height !== void 0) {
242
- const o = S(i.height);
243
- o !== void 0 && !C(i.height) && !s.expandHeight && (e.height = o);
244
- }
245
- if (i.minWidth !== void 0) {
246
- const o = S(i.minWidth);
247
- o !== void 0 && (e.minWidth = o);
248
- }
249
- if (i.maxWidth !== void 0 && !C(i.maxWidth)) {
250
- const o = S(i.maxWidth);
251
- o !== void 0 && (e.maxWidth = o);
252
- } else C(i.maxWidth) && (e.maxWidth = "none", e.flexGrow = "1 !important", e.flexShrink = "1 !important", e.flexBasis = "0% !important", e.alignSelf = "stretch !important");
253
- if (i.minHeight !== void 0) {
254
- const o = S(i.minHeight);
255
- o !== void 0 && (e.minHeight = o);
256
- }
257
- if (i.maxHeight !== void 0 && !C(i.maxHeight)) {
258
- const o = S(i.maxHeight);
259
- o !== void 0 && (e.maxHeight = o);
260
- } else C(i.maxHeight) && (e.maxHeight = "none", e.flexGrow = "1 !important", e.flexShrink = "1 !important", e.flexBasis = "0% !important", e.alignSelf = "stretch !important");
261
- }
262
- if (n.padding !== void 0)
263
- if (typeof n.padding == "number")
264
- e.padding = this.toCSSValue(n.padding);
265
- else {
266
- const i = n.padding;
267
- i.top !== void 0 && (e.paddingTop = this.toCSSValue(i.top)), i.right !== void 0 && (e.paddingRight = this.toCSSValue(i.right)), i.bottom !== void 0 && (e.paddingBottom = this.toCSSValue(i.bottom)), i.left !== void 0 && (e.paddingLeft = this.toCSSValue(i.left));
268
- }
269
- if (n.margin !== void 0)
270
- if (typeof n.margin == "number")
271
- e.margin = this.toCSSValue(n.margin);
272
- else {
273
- const i = n.margin;
274
- i.top !== void 0 && (e.marginTop = this.toCSSValue(i.top)), i.right !== void 0 && (e.marginRight = this.toCSSValue(i.right)), i.bottom !== void 0 && (e.marginBottom = this.toCSSValue(i.bottom)), i.left !== void 0 && (e.marginLeft = this.toCSSValue(i.left));
275
- }
276
- if (n.alignment)
277
- switch (n.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 (n.layoutPriority !== void 0) {
295
- const i = Number(n.layoutPriority);
296
- i > 0 ? (e.flexShrink = "0", e.flexGrow = String(Math.max(1, i / 10)), e.zIndex = String(i), e.gridRowEnd = `span ${String(Math.min(10, Math.max(1, Math.ceil(i / 10))))}`, e.gridColumnEnd = `span ${String(Math.min(10, Math.max(1, Math.ceil(i / 10))))}`) : i === 0 ? (e.flexShrink = "1", e.flexGrow = "1") : (e.flexShrink = String(Math.abs(i)), e.flexGrow = "0", e.zIndex = String(i)), e && typeof e == "object" && "setProperty" in e && e.setProperty("--layout-priority", String(i));
297
- }
298
- if (n.offset, n.aspectRatio) {
299
- const { ratio: i, contentMode: s } = n.aspectRatio;
300
- i !== void 0 && (e.aspectRatio = typeof i == "number" ? String(i) : i, s === "fill" ? e.objectFit = "cover" : e.objectFit = "contain");
301
- }
302
- if (n.fixedSize) {
303
- const { horizontal: i, vertical: s } = n.fixedSize;
304
- i && (e.flexShrink = "0", e.width = "max-content"), s && (e.flexShrink = "0", e.height = "max-content");
305
- }
306
- return e;
307
- }
308
- }
309
- class x extends L {
310
- constructor() {
311
- super(...arguments);
312
- y(this, "type", "appearance");
313
- y(this, "priority", E.APPEARANCE);
314
- }
315
- apply(n, t) {
316
- if (!n.element || !t.element)
317
- return;
318
- const e = this.createStyleContext(
319
- t.componentId,
320
- t.element,
321
- []
322
- ), i = this.resolveReactiveProps(
323
- this.properties,
324
- e
325
- );
326
- this.applyAssetBasedStyles(t.element, i);
327
- const s = this.computeAppearanceStyles(i);
328
- this.applyStyles(t.element, s), this.applyAttributes(t.element, i);
329
- }
330
- /**
331
- * Apply Asset-based styles with theme reactivity
332
- */
333
- applyAssetBasedStyles(n, t) {
334
- const e = w();
335
- t.foregroundColor && this.isAsset(t.foregroundColor) && g(() => {
336
- e();
337
- const i = t.foregroundColor.resolve();
338
- this.applyStyleChange(n, "color", i);
339
- }), t.backgroundColor && this.isAsset(t.backgroundColor) && g(() => {
340
- e();
341
- const i = t.backgroundColor.resolve();
342
- this.applyStyleChange(n, "backgroundColor", i);
343
- }), t.border?.color && this.isAsset(t.border.color) && g(() => {
344
- e();
345
- const i = t.border.color.resolve();
346
- this.applyStyleChange(n, "borderColor", i);
347
- });
348
- }
349
- /**
350
- * Check if a value is an Asset object (including Asset proxies)
351
- */
352
- isAsset(n) {
353
- return n != null && typeof n == "object" && "resolve" in n && typeof n.resolve == "function";
354
- }
355
- computeAppearanceStyles(n) {
356
- const t = {};
357
- if (n.foregroundColor && !this.isAsset(n.foregroundColor) && (t.color = n.foregroundColor), n.backgroundColor && !this.isAsset(n.backgroundColor) && (t.backgroundColor = n.backgroundColor), n.opacity !== void 0 && (t.opacity = n.opacity), n.font) {
358
- const i = n.font;
359
- i.family && (typeof i.family == "object" && i.family !== null && "resolve" in i.family ? t.fontFamily = i.family.resolve() : t.fontFamily = i.family), i.size && (t.fontSize = this.toCSSValue(i.size)), i.weight && (t.fontWeight = String(i.weight)), i.style && (t.fontStyle = i.style);
360
- }
361
- if (n.cornerRadius !== void 0 && (t.borderRadius = this.toCSSValue(n.cornerRadius)), n.border) {
362
- const i = n.border;
363
- i.width !== void 0 && (t.borderWidth = this.toCSSValue(i.width)), i.color && !this.isAsset(i.color) && (t.borderColor = i.color), i.style && (t.borderStyle = i.style);
364
- }
365
- if (n.shadow) {
366
- const i = n.shadow, s = i.x || 0, o = i.y || 0, r = i.radius || 0, a = i.color || "rgba(0,0,0,0.25)";
367
- t.boxShadow = `${s}px ${o}px ${r}px ${a}`;
368
- }
369
- if (n.clipped && (t.overflow = "hidden"), n.clipShape) {
370
- const { shape: i, parameters: s } = n.clipShape;
371
- switch (i) {
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 n.blur !== void 0 && e.push(`blur(${n.blur}px)`), n.brightness !== void 0 && e.push(`brightness(${n.brightness})`), n.contrast !== void 0 && e.push(`contrast(${n.contrast})`), n.saturation !== void 0 && e.push(`saturate(${n.saturation})`), n.hueRotation !== void 0 && e.push(`hue-rotate(${n.hueRotation}deg)`), n.grayscale !== void 0 && e.push(`grayscale(${n.grayscale})`), n.colorInvert !== void 0 && e.push(`invert(${n.colorInvert})`), e.length > 0 && (t.filter = e.join(" ")), t;
394
- }
395
- /**
396
- * Apply HTML attributes (ARIA, role, data attributes, etc.)
397
- */
398
- applyAttributes(n, t) {
399
- if (!n) return;
400
- const e = this.findComponentFromElement(n);
401
- t.role !== void 0 && (n.setAttribute("role", String(t.role)), e?.props && (e.props.role = String(t.role))), t["aria-label"] !== void 0 && (n.setAttribute("aria-label", String(t["aria-label"])), e?.props && (e.props["aria-label"] = String(t["aria-label"]))), t["aria-live"] !== void 0 && (n.setAttribute("aria-live", String(t["aria-live"])), e?.props && (e.props["aria-live"] = String(t["aria-live"]))), t["aria-describedby"] !== void 0 && (n.setAttribute(
402
- "aria-describedby",
403
- String(t["aria-describedby"])
404
- ), e?.props && (e.props["aria-describedby"] = String(t["aria-describedby"]))), t["aria-modal"] !== void 0 && (n.setAttribute("aria-modal", String(t["aria-modal"])), e?.props && (e.props["aria-modal"] = String(t["aria-modal"]))), t["aria-hidden"] !== void 0 && (n.setAttribute("aria-hidden", String(t["aria-hidden"])), e?.props && (e.props["aria-hidden"] = String(t["aria-hidden"]))), t.navigationTitle !== void 0 && (n.setAttribute(
405
- "data-navigation-title",
406
- String(t.navigationTitle)
407
- ), e?.props && (e.props.navigationTitle = String(t.navigationTitle))), t.navigationBarHidden !== void 0 && (n.setAttribute(
408
- "data-navigation-bar-hidden",
409
- String(t.navigationBarHidden)
410
- ), e?.props && (e.props.navigationBarHidden = t.navigationBarHidden), t.navigationBarHidden && (n.setAttribute("aria-hidden", "true"), e?.props && (e.props["aria-hidden"] = "true"))), t.navigationBarItems !== void 0 && (n.setAttribute(
411
- "data-navigation-bar-items",
412
- JSON.stringify(t.navigationBarItems)
413
- ), e?.props && (e.props.navigationBarItems = t.navigationBarItems));
414
- }
415
- findComponentFromElement(n) {
416
- return n._tachui_component || null;
417
- }
418
- }
419
- class I extends L {
420
- constructor() {
421
- super(...arguments);
422
- y(this, "type", "interaction");
423
- y(this, "priority", E.INTERACTION);
424
- }
425
- apply(n, t) {
426
- if (!t.element) return;
427
- const e = this.properties;
428
- if (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.onTouchStart && t.element.addEventListener("touchstart", e.onTouchStart, {
429
- passive: !0
430
- }), e.onTouchMove && t.element.addEventListener("touchmove", e.onTouchMove, {
431
- passive: !0
432
- }), e.onTouchEnd && t.element.addEventListener("touchend", e.onTouchEnd, {
433
- passive: !0
434
- }), e.onTouchCancel && t.element.addEventListener("touchcancel", e.onTouchCancel, {
435
- passive: !0
436
- }), e.onSwipeLeft || e.onSwipeRight) {
437
- let i = 0, s = 0;
438
- t.element.addEventListener(
439
- "touchstart",
440
- (o) => {
441
- const a = o.touches[0];
442
- i = a.clientX, s = a.clientY;
443
- },
444
- { passive: !0 }
445
- ), t.element.addEventListener(
446
- "touchend",
447
- (o) => {
448
- const a = o.changedTouches[0], c = a.clientX - i, f = a.clientY - s;
449
- Math.abs(c) > Math.abs(f) && Math.abs(c) > 50 && (c < 0 && e.onSwipeLeft ? e.onSwipeLeft() : c > 0 && e.onSwipeRight && e.onSwipeRight());
450
- },
451
- { passive: !0 }
452
- );
453
- }
454
- e.onScroll && t.element.addEventListener("scroll", e.onScroll, {
455
- passive: !0
456
- }), e.onWheel && t.element.addEventListener("wheel", e.onWheel, {
457
- passive: !1
458
- }), e.onInput && t.element.addEventListener("input", e.onInput), e.onChange && t.element.addEventListener("change", (i) => {
459
- const s = i.target, o = s.value || s.textContent || "";
460
- e.onChange(o, i);
461
- }), 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);
462
- }
463
- // Phase 4 Advanced Gesture Methods
464
- /**
465
- * Setup long press gesture with timing and distance constraints
466
- */
467
- setupLongPressGesture(n, t) {
468
- const e = t.minimumDuration ?? 500, i = t.maximumDistance ?? 10;
469
- let s, o = null, r = !1;
470
- const a = () => {
471
- s && (clearTimeout(s), s = void 0), r && t.onPressingChanged && t.onPressingChanged(!1), r = !1, o = null;
472
- }, c = (p) => {
473
- const b = p;
474
- o = { x: b.clientX, y: b.clientY }, r = !0, t.onPressingChanged && t.onPressingChanged(!0), s = window.setTimeout(() => {
475
- r && o && (t.perform(), a());
476
- }, e);
477
- }, f = (p) => {
478
- const b = p;
479
- if (!o || !r) return;
480
- Math.sqrt(
481
- Math.pow(b.clientX - o.x, 2) + Math.pow(b.clientY - o.y, 2)
482
- ) > i && a();
483
- }, h = () => {
484
- a();
485
- }, d = () => {
486
- a();
487
- };
488
- n.addEventListener("pointerdown", c), n.addEventListener("pointermove", f), n.addEventListener("pointerup", h), n.addEventListener(
489
- "pointercancel",
490
- d
491
- ), n._longPressCleanup = a;
492
- }
493
- /**
494
- * Setup keyboard shortcut handling
495
- */
496
- setupKeyboardShortcut(n, t) {
497
- const e = t.modifiers ?? [], i = (s) => {
498
- const o = {
499
- cmd: e.includes("cmd") || e.includes("meta"),
500
- ctrl: e.includes("ctrl"),
501
- shift: e.includes("shift"),
502
- alt: e.includes("alt")
503
- }, r = {
504
- cmd: s.metaKey || s.ctrlKey,
505
- // Handle both Mac (meta) and PC (ctrl)
506
- ctrl: s.ctrlKey,
507
- shift: s.shiftKey,
508
- alt: s.altKey
509
- }, a = s.key.toLowerCase() === t.key.toLowerCase(), c = Object.entries(o).every(
510
- ([f, h]) => h === r[f]
511
- );
512
- a && c && (s.preventDefault(), t.action());
513
- };
514
- document.addEventListener("keydown", i), n._keyboardShortcutCleanup = () => {
515
- document.removeEventListener("keydown", i);
516
- };
517
- }
518
- /**
519
- * Setup focus management with reactive binding
520
- */
521
- setupFocusManagement(n, t) {
522
- if (!(n instanceof HTMLElement)) return;
523
- const e = n;
524
- e.hasAttribute("tabindex") || e.setAttribute("tabindex", "0"), u(t) || m(t) ? g(() => {
525
- t() ? e.focus() : e.blur();
526
- }) : t && e.focus();
527
- }
528
- /**
529
- * Setup focusable behavior
530
- */
531
- setupFocusable(n, t) {
532
- if (!(n instanceof HTMLElement)) return;
533
- const e = n;
534
- t.isFocusable === !1 ? e.setAttribute("tabindex", "-1") : e.hasAttribute("tabindex") || e.setAttribute("tabindex", "0"), t.interactions?.includes("activate") && e.addEventListener("keydown", (i) => {
535
- (i.key === "Enter" || i.key === " ") && (i.preventDefault(), e.click());
536
- }), t.interactions?.includes("edit") && (e.setAttribute("role", "textbox"), e.setAttribute("contenteditable", "true"));
537
- }
538
- /**
539
- * Setup continuous hover tracking with coordinates
540
- */
541
- setupContinuousHover(n, t) {
542
- const e = t.coordinateSpace ?? "local", i = (o) => {
543
- const r = o;
544
- let a, c;
545
- if (e === "local") {
546
- const f = n.getBoundingClientRect();
547
- a = r.clientX - f.left, c = r.clientY - f.top;
548
- } else
549
- a = r.clientX, c = r.clientY;
550
- t.perform({ x: a, y: c });
551
- }, s = () => {
552
- t.perform(null);
553
- };
554
- n.addEventListener("mousemove", i), n.addEventListener("mouseleave", s), n._continuousHoverCleanup = () => {
555
- n.removeEventListener("mousemove", i), n.removeEventListener(
556
- "mouseleave",
557
- s
558
- );
559
- };
560
- }
561
- /**
562
- * Setup hit testing control
563
- */
564
- setupHitTesting(n, t) {
565
- n instanceof HTMLElement && (n.style.pointerEvents = t ? "" : "none");
566
- }
567
- }
568
- class O extends L {
569
- constructor() {
570
- super(...arguments);
571
- y(this, "type", "animation");
572
- y(this, "priority", E.ANIMATION);
573
- }
574
- apply(n, t) {
575
- if (!t.element) return;
576
- const e = this.properties;
577
- if (e.transition) {
578
- const i = e.transition, s = i.property || "all", o = i.duration || 300, r = i.easing || "ease", a = i.delay || 0;
579
- t.element instanceof HTMLElement && (t.element.style.transition = `${s} ${o}ms ${r} ${a}ms`);
580
- }
581
- if (e.animation && t.element instanceof HTMLElement) {
582
- const i = e.animation;
583
- if (i.keyframes) {
584
- const s = `tachui-animation-${t.componentId}-${Date.now()}`, o = this.createKeyframeRule(
585
- s,
586
- i.keyframes
587
- );
588
- this.addKeyframesToStylesheet(o);
589
- const r = i.duration || 1e3, a = i.easing || "ease", c = i.iterations || 1, f = i.direction || "normal";
590
- t.element.style.animation = `${s} ${r}ms ${a} ${c} ${f}`;
591
- }
592
- }
593
- if (e.transform && t.element instanceof HTMLElement && (u(e.transform) || m(e.transform) ? g(() => {
594
- const i = e.transform();
595
- t.element instanceof HTMLElement && (t.element.style.transform = i);
596
- }) : t.element.style.transform = e.transform), e.rotationEffect && t.element instanceof HTMLElement) {
597
- const { angle: i, anchor: s } = e.rotationEffect, r = {
598
- center: "50% 50%",
599
- top: "50% 0%",
600
- topLeading: "0% 0%",
601
- topTrailing: "100% 0%",
602
- bottom: "50% 100%",
603
- bottomLeading: "0% 100%",
604
- bottomTrailing: "100% 100%",
605
- leading: "0% 50%",
606
- trailing: "100% 50%"
607
- }[s || "center"] || "50% 50%", a = `rotate(${i}deg)`;
608
- if (u(i) || m(i))
609
- g(() => {
610
- const f = `rotate(${typeof i == "function" ? i() : i}deg)`;
611
- if (t.element instanceof HTMLElement) {
612
- t.element.style.transformOrigin = r;
613
- const d = (t.element.style.transform || "").split(" ").filter((b) => b && !b.startsWith("rotate(")).join(" "), p = d ? `${d} ${f}` : f;
614
- t.element.style.transform = p;
615
- }
616
- });
617
- else if (t.element instanceof HTMLElement) {
618
- t.element.style.transformOrigin = r;
619
- const f = (t.element.style.transform || "").split(" ").filter((d) => d && !d.startsWith("rotate(")).join(" "), h = f ? `${f} ${a}` : a;
620
- t.element.style.transform = h;
621
- }
622
- }
623
- e.overlay && t.element instanceof HTMLElement && this.applyOverlay(t.element, e.overlay, t);
624
- }
625
- applyOverlay(n, t, e) {
626
- const { content: i, alignment: s = "center" } = t;
627
- (n.style.position === "" || n.style.position === "static") && (n.style.position = "relative");
628
- const o = document.createElement("div");
629
- o.style.position = "absolute", o.style.pointerEvents = "none";
630
- const r = this.getOverlayAlignment(s);
631
- if (Object.assign(o.style, r), typeof i == "function") {
632
- const a = i();
633
- if (a && typeof a.render == "function") {
634
- const c = a.render();
635
- c.element && o.appendChild(c.element);
636
- }
637
- } else if (i && typeof i.render == "function") {
638
- const a = i.render();
639
- a.element && o.appendChild(a.element);
640
- } else i instanceof HTMLElement && o.appendChild(i);
641
- n.appendChild(o);
642
- }
643
- getOverlayAlignment(n) {
644
- const t = {
645
- center: {
646
- top: "50%",
647
- left: "50%",
648
- transform: "translate(-50%, -50%)"
649
- },
650
- top: {
651
- top: "0",
652
- left: "50%",
653
- transform: "translateX(-50%)"
654
- },
655
- bottom: {
656
- bottom: "0",
657
- left: "50%",
658
- transform: "translateX(-50%)"
659
- },
660
- leading: {
661
- top: "50%",
662
- left: "0",
663
- transform: "translateY(-50%)"
664
- },
665
- trailing: {
666
- top: "50%",
667
- right: "0",
668
- transform: "translateY(-50%)"
669
- },
670
- topLeading: {
671
- top: "0",
672
- left: "0"
673
- },
674
- topTrailing: {
675
- top: "0",
676
- right: "0"
677
- },
678
- bottomLeading: {
679
- bottom: "0",
680
- left: "0"
681
- },
682
- bottomTrailing: {
683
- bottom: "0",
684
- right: "0"
685
- }
686
- };
687
- return t[n] || t.center;
688
- }
689
- createKeyframeRule(n, t) {
690
- let e = `@keyframes ${n} {
691
- `;
692
- for (const [i, s] of Object.entries(t)) {
693
- e += ` ${i} {
694
- `;
695
- for (const [o, r] of Object.entries(s)) {
696
- const a = this.toCSSProperty(o);
697
- e += ` ${a}: ${r};
698
- `;
699
- }
700
- e += ` }
701
- `;
702
- }
703
- return e += "}", e;
704
- }
705
- addKeyframesToStylesheet(n) {
706
- let t = document.querySelector(
707
- "#tachui-animations"
708
- );
709
- t || (t = document.createElement("style"), t.id = "tachui-animations", document.head.appendChild(t)), t.appendChild(document.createTextNode(n));
710
- }
711
- }
712
- class D extends L {
713
- constructor() {
714
- super(...arguments);
715
- y(this, "type", "lifecycle");
716
- y(this, "priority", E.CUSTOM);
717
- y(this, "activeAbortController");
718
- // Cleanup helpers
719
- y(this, "cleanupFunctions", []);
720
- }
721
- apply(n, t) {
722
- if (!t.element) return;
723
- const e = this.properties;
724
- 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);
725
- }
726
- setupLifecycleObserver(n, t) {
727
- const e = new IntersectionObserver(
728
- (i) => {
729
- i.forEach((s) => {
730
- s.isIntersecting && t.onAppear ? t.onAppear() : !s.isIntersecting && t.onDisappear && t.onDisappear();
731
- });
732
- },
733
- {
734
- threshold: 0.1,
735
- // Trigger when 10% of element is visible
736
- rootMargin: "10px"
737
- // Add some margin for better UX
738
- }
739
- );
740
- e.observe(n), this.addCleanup(() => {
741
- e.disconnect();
742
- });
743
- }
744
- setupTask(n, t) {
745
- if (!t) return;
746
- this.activeAbortController = new AbortController();
747
- const { signal: e } = this.activeAbortController;
748
- (async () => {
749
- try {
750
- if (e.aborted) return;
751
- const s = t.operation();
752
- s instanceof Promise && await s;
753
- } catch (s) {
754
- if (e.aborted) return;
755
- console.error("TachUI Task Error:", s);
756
- }
757
- })(), this.addCleanup(() => {
758
- this.activeAbortController && this.activeAbortController.abort();
759
- });
760
- }
761
- setupRefreshable(n, t) {
762
- if (!t) return;
763
- let e = !1, i = 0, s = 0;
764
- const o = 70, r = document.createElement("div");
765
- if (r.style.cssText = `
766
- position: absolute;
767
- top: -50px;
768
- left: 50%;
769
- transform: translateX(-50%);
770
- width: 30px;
771
- height: 30px;
772
- border: 2px solid #ccc;
773
- border-top: 2px solid #007AFF;
774
- border-radius: 50%;
775
- animation: tachui-spin 1s linear infinite;
776
- opacity: 0;
777
- transition: opacity 0.3s ease;
778
- z-index: 1000;
779
- `, !document.querySelector("#tachui-refresh-styles")) {
780
- const d = document.createElement("style");
781
- d.id = "tachui-refresh-styles", d.textContent = `
782
- @keyframes tachui-spin {
783
- 0% { transform: translateX(-50%) rotate(0deg); }
784
- 100% { transform: translateX(-50%) rotate(360deg); }
785
- }
786
- `, document.head.appendChild(d);
787
- }
788
- const a = n.parentElement || n;
789
- a instanceof HTMLElement && (a.style.position = "relative", a.appendChild(r));
790
- const c = (d) => {
791
- e || (s = d.touches[0].clientY);
792
- }, f = (d) => {
793
- if (e) return;
794
- const p = d.touches[0].clientY;
795
- if (i = Math.max(0, p - s), i > 20) {
796
- const b = Math.min(1, i / o);
797
- r.style.opacity = String(b);
798
- }
799
- i > 0 && n.scrollTop === 0 && d.preventDefault();
800
- }, h = async () => {
801
- if (!e)
802
- if (i > o) {
803
- e = !0, r.style.opacity = "1";
804
- try {
805
- await t.onRefresh();
806
- } catch (d) {
807
- console.error("Refresh error:", d);
808
- } finally {
809
- e = !1, r.style.opacity = "0", i = 0;
810
- }
811
- } else
812
- r.style.opacity = "0", i = 0;
813
- };
814
- n.addEventListener("touchstart", c, {
815
- passive: !0
816
- }), n.addEventListener("touchmove", f, {
817
- passive: !1
818
- }), n.addEventListener("touchend", h, {
819
- passive: !0
820
- }), this.addCleanup(() => {
821
- n.removeEventListener(
822
- "touchstart",
823
- c
824
- ), n.removeEventListener("touchmove", f), n.removeEventListener("touchend", h), r.parentElement && r.parentElement.removeChild(r);
825
- });
826
- }
827
- addCleanup(n) {
828
- this.cleanupFunctions.push(n);
829
- }
830
- cleanup() {
831
- this.cleanupFunctions.forEach((n) => n()), this.cleanupFunctions = [];
832
- }
833
- }
1
+ import "@tachui/core/reactive";
2
+ import { dj as d, dh as r, df as f, di as s, dg as t, dk as M } from "./modifiers-basic-DLmE749_.js";
3
+ import "@tachui/core/constants/layout";
834
4
  export {
835
- O as AnimationModifier,
836
- x as AppearanceModifier,
837
- L as BaseModifier,
838
- I as InteractionModifier,
839
- R as LayoutModifier,
840
- D as LifecycleModifier
5
+ d as AnimationModifier,
6
+ r as AppearanceModifier,
7
+ f as BaseModifier,
8
+ s as InteractionModifier,
9
+ t as LayoutModifier,
10
+ M as LifecycleModifier
841
11
  };
842
- //# sourceMappingURL=base.js.map