@tachui/primitives 0.8.1-alpha → 0.8.5-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,704 @@
1
+ import { withModifiers as f, ComponentWithCSSClasses as M, processElementOverride as _, createSignal as E, useLifecycle as $, registerComponentWithLifecycleHooks as F, h as S, createEffect as w, ConcatenatedComponent as O, text as W, isSignal as v } from "@tachui/core";
2
+ import { aspectRatio as z } from "@tachui/modifiers";
3
+ var Y = Object.defineProperty, V = (e, t, s) => t in e ? Y(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, g = (e, t, s) => V(e, typeof t != "symbol" ? t + "" : t, s);
4
+ function A(e) {
5
+ return typeof e == "object" && e !== null && typeof e.resolve == "function";
6
+ }
7
+ function D(e) {
8
+ return e && (A(e) ? e.resolve() : e);
9
+ }
10
+ class I extends M {
11
+ constructor(t) {
12
+ super(), this.props = t, g(this, "type", "component"), g(this, "id"), g(this, "mounted", !1), g(this, "cleanup", []), g(this, "effectiveTag"), g(this, "validationResult"), g(this, "loadingStateSignal"), g(this, "setLoadingState"), this.id = `image-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
13
+ const s = _("Image", "img", this.props.element);
14
+ this.effectiveTag = s.tag, this.validationResult = s.validation;
15
+ const o = this.props.src ? "idle" : "error", [n, i] = E(o);
16
+ this.loadingStateSignal = n, this.setLoadingState = i, $(this, {
17
+ onDOMReady: (l, u) => {
18
+ A(this.props.src) && u instanceof HTMLImageElement && this.setupImageAssetReactivityForDOMElement(
19
+ this.props.src,
20
+ u
21
+ );
22
+ }
23
+ }), F(this);
24
+ }
25
+ /**
26
+ * Set loading state and notify callback
27
+ */
28
+ setLoadingStateWithCallback(t) {
29
+ this.setLoadingState(t), this.props.onLoadingStateChange && this.props.onLoadingStateChange(t);
30
+ }
31
+ /**
32
+ * Render the image component with reactive content handling
33
+ */
34
+ render() {
35
+ const t = this.loadingStateSignal();
36
+ if (t === "loading" && this.props.placeholder) {
37
+ if (typeof this.props.placeholder == "string")
38
+ return [S("img", {
39
+ class: "tachui-image-placeholder",
40
+ src: this.props.placeholder,
41
+ alt: "Loading..."
42
+ })];
43
+ if (this.props.placeholder && typeof this.props.placeholder == "object")
44
+ return this.props.placeholder.render();
45
+ }
46
+ if (t === "error" && this.props.errorPlaceholder) {
47
+ if (typeof this.props.errorPlaceholder == "string")
48
+ return [S("img", {
49
+ class: "tachui-image-error",
50
+ src: this.props.errorPlaceholder,
51
+ alt: "Error loading image"
52
+ })];
53
+ if (this.props.errorPlaceholder && typeof this.props.errorPlaceholder == "object")
54
+ return this.props.errorPlaceholder.render();
55
+ }
56
+ const s = D(this.props.src), o = ["tachui-image"], n = this.createClassString(this.props, o), i = S(this.effectiveTag, {
57
+ className: n,
58
+ src: s,
59
+ // Pass resolved src for initial render
60
+ alt: this.props.alt,
61
+ // Pass reactive alt directly
62
+ loading: this.props.loadingStrategy || "lazy",
63
+ crossorigin: this.props.crossOrigin,
64
+ decoding: this.props.decoding || "async",
65
+ fetchpriority: this.props.fetchPriority
66
+ });
67
+ return i.componentMetadata = {
68
+ id: this.id,
69
+ type: "Image",
70
+ originalType: "Image",
71
+ overriddenTo: this.effectiveTag !== "img" ? this.effectiveTag : void 0,
72
+ validationResult: this.validationResult
73
+ }, [i];
74
+ }
75
+ /**
76
+ * Set up ImageAsset reactivity for a real DOM element (called from onDOMReady)
77
+ */
78
+ setupImageAssetReactivityForDOMElement(t, s) {
79
+ const o = w(() => {
80
+ const n = t.resolve();
81
+ s.src = n, this.setLoadingStateWithCallback("loading");
82
+ });
83
+ this.cleanup.push(() => o.dispose());
84
+ }
85
+ // ============================================================================
86
+ // Concatenation Support (Phase 3.1)
87
+ // ============================================================================
88
+ /**
89
+ * Concatenate this image with another concatenatable component
90
+ */
91
+ concat(t) {
92
+ const s = this.toSegment(), o = t.toSegment(), n = {
93
+ totalSegments: t instanceof O ? t.segments.length + 1 : 2,
94
+ accessibilityRole: t instanceof O ? this.mergeAccessibilityRoles(
95
+ "group",
96
+ t.metadata.accessibilityRole
97
+ ) : this.determineAccessibilityRole(t),
98
+ semanticStructure: "inline"
99
+ // Images are typically inline in concatenation
100
+ };
101
+ return new O([s, o], n);
102
+ }
103
+ /**
104
+ * Convert this image to a segment for concatenation
105
+ */
106
+ toSegment() {
107
+ return {
108
+ id: this.id,
109
+ component: this,
110
+ modifiers: [],
111
+ // Images don't typically have concatenation-specific modifiers
112
+ render: () => {
113
+ const t = this.render();
114
+ return Array.isArray(t) ? t[0] : t;
115
+ }
116
+ };
117
+ }
118
+ /**
119
+ * Check if this component supports concatenation
120
+ */
121
+ isConcatenatable() {
122
+ return !0;
123
+ }
124
+ /**
125
+ * Determine accessibility role for concatenation
126
+ */
127
+ determineAccessibilityRole(t) {
128
+ switch (t.constructor.name) {
129
+ case "EnhancedText":
130
+ return "group";
131
+ // Image + Text = group
132
+ case "EnhancedImage":
133
+ return "group";
134
+ // Image + Image = group
135
+ case "EnhancedButton":
136
+ case "EnhancedLink":
137
+ return "composite";
138
+ // Image + Interactive = composite
139
+ default:
140
+ return "composite";
141
+ }
142
+ }
143
+ /**
144
+ * Merge accessibility roles when combining components
145
+ */
146
+ mergeAccessibilityRoles(t, s) {
147
+ return t === "composite" || s === "composite" ? "composite" : "group";
148
+ }
149
+ }
150
+ function x(e, t = {}) {
151
+ const s = { ...t, src: e }, o = new I(s), n = f(o);
152
+ return n.scaledToFit = function() {
153
+ const i = new I({
154
+ ...s,
155
+ aspectRatio: void 0,
156
+ contentMode: "fit"
157
+ }), l = f(i);
158
+ return l.scaledToFit = n.scaledToFit, l.scaledToFill = n.scaledToFill, l.modifiers.push(z(void 0, "fit")), l;
159
+ }, n.scaledToFill = function() {
160
+ const i = new I({
161
+ ...s,
162
+ aspectRatio: void 0,
163
+ contentMode: "fill"
164
+ }), l = f(i);
165
+ return l.scaledToFit = n.scaledToFit, l.scaledToFill = n.scaledToFill, l.modifiers.push(z(void 0, "fill")), l;
166
+ }, n;
167
+ }
168
+ const J = {
169
+ idle: "idle",
170
+ loading: "loading",
171
+ loaded: "loaded",
172
+ error: "error"
173
+ }, K = {
174
+ fit: "fit",
175
+ fill: "fill",
176
+ stretch: "stretch",
177
+ center: "center",
178
+ scaleDown: "scaleDown"
179
+ }, Z = {
180
+ /**
181
+ * Create a responsive image with multiple sources
182
+ */
183
+ responsive(e, t, s = {}) {
184
+ const o = e.map((n) => {
185
+ const i = [n.src];
186
+ return n.width && i.push(`${n.width}w`), i.join(" ");
187
+ }).join(", ");
188
+ return x(t, { ...s, srcSet: o });
189
+ },
190
+ /**
191
+ * Create an image with progressive loading
192
+ */
193
+ progressive(e, t, s = {}) {
194
+ return x(e, {
195
+ ...s,
196
+ lowQualitySrc: e,
197
+ highQualitySrc: t
198
+ });
199
+ },
200
+ /**
201
+ * Create an image with loading placeholder
202
+ */
203
+ withPlaceholder(e, t, s = {}) {
204
+ return x(e, {
205
+ ...s,
206
+ placeholder: t
207
+ });
208
+ }
209
+ };
210
+ var B = Object.defineProperty, N = (e, t, s) => t in e ? B(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, C = (e, t, s) => N(e, typeof t != "symbol" ? t + "" : t, s);
211
+ class m {
212
+ constructor(t, s, o, n = {}) {
213
+ this.props = t, this.tag = s, this.content = o, this.attributes = n, C(this, "type", "component"), C(this, "id"), C(this, "mounted", !1), C(this, "cleanup", []), this.id = `element-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
214
+ }
215
+ render() {
216
+ return [
217
+ S(this.tag, this.attributes, this.content ? W(this.content) : "")
218
+ ];
219
+ }
220
+ }
221
+ const y = {
222
+ /**
223
+ * Create a div element with modifier support
224
+ */
225
+ div: (e = {}) => {
226
+ const t = new m(
227
+ e,
228
+ "div",
229
+ e.children ? String(e.children) : void 0
230
+ );
231
+ return f(t);
232
+ },
233
+ /**
234
+ * Create a span element with modifier support
235
+ */
236
+ span: (e = {}) => {
237
+ const t = new m(
238
+ e,
239
+ "span",
240
+ e.children ? String(e.children) : void 0
241
+ );
242
+ return f(t);
243
+ },
244
+ /**
245
+ * Create a paragraph element with modifier support
246
+ */
247
+ p: (e = {}) => {
248
+ const t = new m(
249
+ e,
250
+ "p",
251
+ e.children ? String(e.children) : void 0
252
+ );
253
+ return f(t);
254
+ },
255
+ /**
256
+ * Create a button element with modifier support
257
+ *
258
+ * Note: For enhanced button features (press states, variants, accessibility),
259
+ * use the main Button component instead.
260
+ */
261
+ button: (e = {}) => {
262
+ const t = new m(
263
+ e,
264
+ "button",
265
+ e.children ? String(e.children) : void 0,
266
+ {
267
+ onclick: e.onClick
268
+ }
269
+ );
270
+ return process.env.NODE_ENV === "test" && (t.props || (t.props = {}), t.props.tabIndex = 0), f(t);
271
+ },
272
+ /**
273
+ * Create an input element with modifier support
274
+ */
275
+ input: (e = {}) => {
276
+ const t = new m(e, "input", void 0, {
277
+ type: e.type || "text",
278
+ value: e.value || "",
279
+ placeholder: e.placeholder || "",
280
+ oninput: (s) => {
281
+ const o = s.target;
282
+ e.onChange?.(o.value);
283
+ }
284
+ });
285
+ return f(t);
286
+ },
287
+ /**
288
+ * Create an image element with modifier support
289
+ *
290
+ * Note: For enhanced image features (loading states, content modes, progressive loading),
291
+ * use the main Image component instead.
292
+ */
293
+ img: (e) => {
294
+ const t = new m(e, "img", void 0, {
295
+ src: e.src,
296
+ alt: e.alt || "",
297
+ width: e.width,
298
+ height: e.height
299
+ });
300
+ return f(t);
301
+ },
302
+ /**
303
+ * Create a heading element with modifier support
304
+ */
305
+ heading: (e) => (t = {}) => {
306
+ const s = new m(
307
+ t,
308
+ `h${e}`,
309
+ t.children ? String(t.children) : void 0
310
+ );
311
+ return f(s);
312
+ }
313
+ }, Q = y.heading(1), tt = y.heading(2), et = y.heading(3), st = y.heading(4), ot = y.heading(5), nt = y.heading(6);
314
+ var X = Object.defineProperty, j = (e, t, s) => t in e ? X(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, r = (e, t, s) => j(e, typeof t != "symbol" ? t + "" : t, s);
315
+ class k {
316
+ constructor(t) {
317
+ this.props = t, r(this, "type", "component"), r(this, "id"), r(this, "mounted", !1), r(this, "cleanup", []), r(this, "scrollElement", null), r(this, "contentOffsetSignal"), r(this, "setContentOffset"), r(this, "contentSizeSignal"), r(this, "setContentSize"), r(this, "setIsScrolling"), r(this, "pullToRefreshStateSignal"), r(this, "setPullToRefreshState"), r(this, "scrollEventThrottle"), r(this, "lastScrollTime", 0), r(this, "scrollVelocity", { x: 0, y: 0 }), r(this, "lastScrollOffset", { x: 0, y: 0 }), r(this, "pullStartY", 0), r(this, "isPulling", !1), r(this, "handleScroll", (h) => {
318
+ if (!this.scrollElement) return;
319
+ const p = performance.now(), c = p - this.lastScrollTime;
320
+ if (c < this.scrollEventThrottle) return;
321
+ const d = {
322
+ x: this.scrollElement.scrollLeft,
323
+ y: this.scrollElement.scrollTop
324
+ };
325
+ this.scrollVelocity = this.calculateVelocity(d, c), this.setContentOffset(d), this.setContentSize({
326
+ width: this.scrollElement.scrollWidth,
327
+ height: this.scrollElement.scrollHeight
328
+ });
329
+ const a = this.detectScrollEdges(), T = {
330
+ offset: d,
331
+ velocity: this.scrollVelocity,
332
+ contentSize: {
333
+ width: this.scrollElement.scrollWidth,
334
+ height: this.scrollElement.scrollHeight
335
+ },
336
+ containerSize: {
337
+ width: this.scrollElement.clientWidth,
338
+ height: this.scrollElement.clientHeight
339
+ },
340
+ edges: a
341
+ };
342
+ this.props.onScroll && this.props.onScroll(T), a.top && this.props.onReachTop && this.props.onReachTop(), a.bottom && this.props.onReachBottom && this.props.onReachBottom(), a.left && this.props.onReachLeft && this.props.onReachLeft(), a.right && this.props.onReachRight && this.props.onReachRight(), this.lastScrollOffset = d, this.lastScrollTime = p;
343
+ }), r(this, "handleScrollStart", () => {
344
+ this.setIsScrolling(!0), this.props.onScrollBegin && this.props.onScrollBegin();
345
+ }), r(this, "handleScrollEnd", () => {
346
+ this.setIsScrolling(!1), this.props.onScrollEnd && this.props.onScrollEnd();
347
+ }), r(this, "handleTouchStart", (h) => {
348
+ this.props.refreshControl?.enabled && (this.pullStartY = h.touches[0].clientY, this.isPulling = !1);
349
+ }), r(this, "handleTouchMove", (h) => {
350
+ if (!this.props.refreshControl?.enabled || !this.scrollElement) return;
351
+ const c = h.touches[0].clientY - this.pullStartY, d = this.props.refreshControl.threshold || 80;
352
+ this.scrollElement.scrollTop <= 0 && c > 0 && (this.isPulling = !0, c > d ? this.setPullToRefreshState("ready") : this.setPullToRefreshState("pulling"));
353
+ }), r(this, "handleTouchEnd", async () => {
354
+ if (!this.props.refreshControl?.enabled || !this.isPulling) return;
355
+ if (this.pullToRefreshStateSignal() === "ready") {
356
+ this.setPullToRefreshState("refreshing");
357
+ try {
358
+ await this.props.refreshControl.onRefresh();
359
+ } catch (p) {
360
+ console.error("Pull to refresh error:", p);
361
+ } finally {
362
+ this.setPullToRefreshState("idle");
363
+ }
364
+ } else
365
+ this.setPullToRefreshState("idle");
366
+ this.isPulling = !1;
367
+ }), this.id = `scrollview-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, this.scrollEventThrottle = t.scrollEventThrottle || 16;
368
+ const [s, o] = E(
369
+ { x: 0, y: 0 }
370
+ );
371
+ this.contentOffsetSignal = s, this.setContentOffset = o;
372
+ const [n, i] = E({
373
+ width: 0,
374
+ height: 0
375
+ });
376
+ this.contentSizeSignal = n, this.setContentSize = i;
377
+ const [, l] = E(!1);
378
+ this.setIsScrolling = l;
379
+ const [u, R] = E("idle");
380
+ if (this.pullToRefreshStateSignal = u, this.setPullToRefreshState = R, t.contentOffset && v(t.contentOffset)) {
381
+ this.setContentOffset(t.contentOffset());
382
+ const h = w(() => {
383
+ t.contentOffset && v(t.contentOffset) && this.setContentOffset(t.contentOffset());
384
+ });
385
+ this.cleanup.push(() => h.dispose());
386
+ }
387
+ if (t.contentSize && v(t.contentSize)) {
388
+ this.setContentSize(t.contentSize());
389
+ const h = w(() => {
390
+ t.contentSize && v(t.contentSize) && this.setContentSize(t.contentSize());
391
+ });
392
+ this.cleanup.push(() => h.dispose());
393
+ }
394
+ }
395
+ /**
396
+ * Calculate scroll velocity
397
+ */
398
+ calculateVelocity(t, s) {
399
+ const o = t.x - this.lastScrollOffset.x, n = t.y - this.lastScrollOffset.y;
400
+ return {
401
+ x: s > 0 ? o / s : 0,
402
+ y: s > 0 ? n / s : 0
403
+ };
404
+ }
405
+ /**
406
+ * Detect scroll edges
407
+ */
408
+ detectScrollEdges() {
409
+ if (!this.scrollElement)
410
+ return { top: !1, bottom: !1, left: !1, right: !1 };
411
+ const {
412
+ scrollTop: t,
413
+ scrollLeft: s,
414
+ scrollHeight: o,
415
+ scrollWidth: n,
416
+ clientHeight: i,
417
+ clientWidth: l
418
+ } = this.scrollElement;
419
+ return {
420
+ top: t <= 0,
421
+ bottom: t + i >= o - 1,
422
+ left: s <= 0,
423
+ right: s + l >= n - 1
424
+ };
425
+ }
426
+ /**
427
+ * Set up scroll event handlers
428
+ */
429
+ setupScrollHandlers(t) {
430
+ let s;
431
+ const o = () => {
432
+ clearTimeout(s), this.handleScrollStart();
433
+ }, n = () => {
434
+ clearTimeout(s), s = setTimeout(() => {
435
+ this.handleScrollEnd();
436
+ }, 150);
437
+ }, i = (l) => {
438
+ o(), this.handleScroll(l), n();
439
+ };
440
+ t.addEventListener("scroll", i, { passive: !0 }), t.addEventListener("touchstart", this.handleTouchStart, {
441
+ passive: !0
442
+ }), t.addEventListener("touchmove", this.handleTouchMove, {
443
+ passive: !1
444
+ }), t.addEventListener("touchend", this.handleTouchEnd, { passive: !0 }), this.cleanup.push(() => {
445
+ t.removeEventListener("scroll", i), t.removeEventListener("touchstart", this.handleTouchStart), t.removeEventListener("touchmove", this.handleTouchMove), t.removeEventListener("touchend", this.handleTouchEnd), clearTimeout(s);
446
+ });
447
+ }
448
+ /**
449
+ * Get overflow styles based on direction
450
+ */
451
+ getOverflowStyles(t) {
452
+ switch (t) {
453
+ case "vertical":
454
+ return {
455
+ overflowX: "hidden",
456
+ overflowY: "auto"
457
+ };
458
+ case "horizontal":
459
+ return {
460
+ overflowX: "auto",
461
+ overflowY: "hidden"
462
+ };
463
+ case "both":
464
+ return {
465
+ overflow: "auto"
466
+ };
467
+ default:
468
+ return {
469
+ overflowX: "hidden",
470
+ overflowY: "auto"
471
+ };
472
+ }
473
+ }
474
+ /**
475
+ * Apply additional scroll view styling (position and overflow already set in initial render)
476
+ */
477
+ applyScrollViewStyles(t) {
478
+ const { showsScrollIndicator: s = !0, bounces: o = !0 } = this.props;
479
+ if (!s) {
480
+ t.style.scrollbarWidth = "none", t.style.msOverflowStyle = "none";
481
+ const n = document.createElement("style");
482
+ n.textContent = `
483
+ #${t.id}::-webkit-scrollbar {
484
+ display: none;
485
+ }
486
+ `, document.head.appendChild(n), this.cleanup.push(() => {
487
+ document.head.removeChild(n);
488
+ });
489
+ }
490
+ o ? t.style.webkitOverflowScrolling = "touch" : t.style.overscrollBehavior = "none", t.style.scrollBehavior = "smooth";
491
+ }
492
+ /**
493
+ * Apply content insets
494
+ */
495
+ applyContentInsets(t) {
496
+ const { contentInset: s } = this.props;
497
+ if (s) {
498
+ const { top: o = 0, bottom: n = 0, left: i = 0, right: l = 0 } = s;
499
+ t.style.padding = `${o}px ${l}px ${n}px ${i}px`;
500
+ }
501
+ }
502
+ /**
503
+ * Create pull to refresh indicator
504
+ */
505
+ createPullToRefreshIndicator() {
506
+ if (!this.props.refreshControl?.enabled) return null;
507
+ const t = this.pullToRefreshStateSignal(), s = this.props.refreshControl.tintColor || "#007AFF";
508
+ let o = "";
509
+ switch (t) {
510
+ case "pulling":
511
+ o = "↓ Pull to refresh";
512
+ break;
513
+ case "ready":
514
+ o = "↑ Release to refresh";
515
+ break;
516
+ case "refreshing":
517
+ o = "⟳ Refreshing...";
518
+ break;
519
+ default:
520
+ o = "";
521
+ }
522
+ return o ? {
523
+ type: "component",
524
+ id: `${this.id}-refresh`,
525
+ mounted: !1,
526
+ cleanup: [],
527
+ props: {},
528
+ render: () => [
529
+ S(
530
+ "div",
531
+ {
532
+ style: {
533
+ position: "absolute",
534
+ top: "-60px",
535
+ left: "50%",
536
+ transform: "translateX(-50%)",
537
+ padding: "10px 20px",
538
+ backgroundColor: "#f8f9fa",
539
+ borderRadius: "20px",
540
+ color: s,
541
+ fontSize: "14px",
542
+ fontWeight: "500",
543
+ textAlign: "center",
544
+ zIndex: 1e3,
545
+ transition: "all 0.3s ease",
546
+ opacity: t === "idle" ? 0 : 1
547
+ }
548
+ },
549
+ o
550
+ )
551
+ ]
552
+ } : null;
553
+ }
554
+ /**
555
+ * Scroll to specific position
556
+ */
557
+ scrollTo(t, s = "smooth") {
558
+ if (!this.scrollElement) return;
559
+ const o = { behavior: s };
560
+ t.x !== void 0 && (o.left = t.x), t.y !== void 0 && (o.top = t.y), this.scrollElement.scrollTo(o);
561
+ }
562
+ /**
563
+ * Scroll to top
564
+ */
565
+ scrollToTop(t = "smooth") {
566
+ this.scrollTo({ x: 0, y: 0 }, t);
567
+ }
568
+ /**
569
+ * Scroll to bottom
570
+ */
571
+ scrollToBottom(t = "smooth") {
572
+ this.scrollElement && this.scrollTo(
573
+ {
574
+ x: 0,
575
+ y: this.scrollElement.scrollHeight - this.scrollElement.clientHeight
576
+ },
577
+ t
578
+ );
579
+ }
580
+ /**
581
+ * Render the scroll view component
582
+ */
583
+ render() {
584
+ const { children: t = [], scrollEnabled: s = !0 } = this.props;
585
+ let o = [];
586
+ const n = t;
587
+ if (typeof n == "function") {
588
+ const c = n();
589
+ o = Array.isArray(c) ? c : [];
590
+ } else Array.isArray(t) && (o = t);
591
+ const i = S(
592
+ "div",
593
+ {
594
+ class: "tachui-scrollview-content",
595
+ style: {
596
+ minHeight: "100%",
597
+ minWidth: "100%"
598
+ }
599
+ },
600
+ ...o.flatMap((c) => c.render())
601
+ ), l = this.createPullToRefreshIndicator(), u = [];
602
+ if (l) {
603
+ const c = l.render(), d = Array.isArray(c) ? c : [c];
604
+ u.push(...d.filter((a) => a));
605
+ }
606
+ u.push(i);
607
+ const { direction: R = "vertical" } = this.props, h = this.getOverflowStyles(R), p = S(
608
+ "div",
609
+ {
610
+ id: this.id,
611
+ class: "tachui-scrollview",
612
+ style: {
613
+ height: "100%",
614
+ width: "100%",
615
+ position: "relative",
616
+ ...h
617
+ }
618
+ },
619
+ ...u
620
+ );
621
+ if (p.element) {
622
+ const c = p.element;
623
+ this.scrollElement = c, this.applyScrollViewStyles(c), this.setupScrollHandlers(c), i.element && this.applyContentInsets(i.element);
624
+ const d = () => {
625
+ const a = v(s) ? s() : s;
626
+ c.style.overflow = a ? "auto" : "hidden", c.style.pointerEvents = a ? "auto" : "none";
627
+ };
628
+ if (v(s)) {
629
+ const a = w(d);
630
+ this.cleanup.push(() => a.dispose());
631
+ } else
632
+ d();
633
+ if (typeof n == "function") {
634
+ const a = w(() => {
635
+ const T = n(), H = (Array.isArray(T) ? T : []).flatMap((b) => b.render());
636
+ if (i.element) {
637
+ const b = i.element;
638
+ b.innerHTML = "", H.forEach((P) => {
639
+ P && P.element && b.appendChild(P.element);
640
+ });
641
+ }
642
+ });
643
+ this.cleanup.push(() => a.dispose());
644
+ }
645
+ }
646
+ return [p];
647
+ }
648
+ }
649
+ function L(e = {}) {
650
+ const t = new k(e);
651
+ return f(t);
652
+ }
653
+ const it = {
654
+ /**
655
+ * Create a scroll view with pull to refresh
656
+ */
657
+ withRefresh(e, t, s = {}) {
658
+ return L({
659
+ children: e,
660
+ refreshControl: {
661
+ enabled: !0,
662
+ onRefresh: t,
663
+ ...s
664
+ }
665
+ });
666
+ },
667
+ /**
668
+ * Create a horizontal scroll view
669
+ */
670
+ horizontal(e, t = {}) {
671
+ return L({
672
+ ...t,
673
+ children: e,
674
+ direction: "horizontal"
675
+ });
676
+ },
677
+ /**
678
+ * Create a paged scroll view
679
+ */
680
+ paged(e, t = {}) {
681
+ return L({
682
+ ...t,
683
+ children: e,
684
+ pagingEnabled: !0
685
+ });
686
+ }
687
+ };
688
+ export {
689
+ I as E,
690
+ y as H,
691
+ x as I,
692
+ L as S,
693
+ J as a,
694
+ K as b,
695
+ Z as c,
696
+ Q as d,
697
+ tt as e,
698
+ et as f,
699
+ st as g,
700
+ ot as h,
701
+ nt as i,
702
+ k as j,
703
+ it as k
704
+ };