fiboui 2.8.4 → 2.9.0

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,785 @@
1
+ var nt = Object.defineProperty;
2
+ var et = (n, i, t) => i in n ? nt(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t;
3
+ var d = (n, i, t) => et(n, typeof i != "symbol" ? i + "" : i, t);
4
+ import h from "react";
5
+ import { b2 as T, b3 as B, b7 as $, b6 as m, b9 as z, bu as _, bv as E, bw as b, bx as rt, bd as ot, by as st, bz as lt } from "./client-3NdKI2xE.js";
6
+ function at(n, i) {
7
+ if (!(typeof i != "string" || !m(i)))
8
+ for (const t of z(i))
9
+ n.bindSignal(t);
10
+ }
11
+ function L(n, i) {
12
+ if (typeof i == "function") {
13
+ try {
14
+ L(n, i());
15
+ } catch {
16
+ }
17
+ return;
18
+ }
19
+ if (typeof i == "string") {
20
+ at(n, i);
21
+ return;
22
+ }
23
+ if (Array.isArray(i))
24
+ for (const t of i) L(n, t);
25
+ }
26
+ function ct(n) {
27
+ return typeof n == "string" && m(n) ? $(n) : n;
28
+ }
29
+ function ft(n) {
30
+ return n && typeof n == "object" && !Array.isArray(n) ? n : {};
31
+ }
32
+ function dt(n) {
33
+ n.display !== "none" && (n.display = "flex", (n.alignItems == null || n.alignItems === "") && (n.alignItems = "center"), (n.justifyContent == null || n.justifyContent === "") && (n.justifyContent = "center")), n.margin == null && (n.marginLeft == null && (n.marginLeft = "auto"), n.marginRight == null && (n.marginRight = "auto"));
34
+ }
35
+ function ht(n, i) {
36
+ const { children: t, ...e } = i, r = t !== void 0 ? t : n;
37
+ return { nodes: r == null ? [] : Array.isArray(r) ? r : [r], rest: e };
38
+ }
39
+ class ut extends B {
40
+ children(i) {
41
+ return L(this, i), super.children(i);
42
+ }
43
+ props(i) {
44
+ return i && "children" in i && L(this, i.children), super.props(i);
45
+ }
46
+ build() {
47
+ const i = [
48
+ "fibo-center",
49
+ "flex",
50
+ "items-center",
51
+ "justify-center",
52
+ // Fill the parent so centering is visible; min-* lets flex ancestors shrink
53
+ // instead of clipping overflowing children.
54
+ this.isHug() ? "w-auto self-auto" : "w-full min-w-0 min-h-0 self-stretch",
55
+ ...this._classNames
56
+ ], { nodes: t, rest: e } = ht(this.processChildren(), this._props), { className: r, style: o, ...s } = e, l = [...i, r].filter(Boolean).join(" "), a = t.map(ct), f = { ...this.getStyle(), ...ft(o) };
57
+ return dt(f), h.createElement(
58
+ "div",
59
+ {
60
+ style: f,
61
+ ...s,
62
+ className: l
63
+ },
64
+ ...a
65
+ );
66
+ }
67
+ }
68
+ const qt = T(ut);
69
+ function pt(n, i) {
70
+ if (!(typeof i != "string" || !m(i)))
71
+ for (const t of z(i))
72
+ n.bindSignal(t);
73
+ }
74
+ function N(n, i) {
75
+ if (typeof i == "function") {
76
+ try {
77
+ N(n, i());
78
+ } catch {
79
+ }
80
+ return;
81
+ }
82
+ if (typeof i == "string") {
83
+ pt(n, i);
84
+ return;
85
+ }
86
+ if (Array.isArray(i))
87
+ for (const t of i) N(n, t);
88
+ }
89
+ function gt(n) {
90
+ return typeof n == "string" && m(n) ? $(n) : n;
91
+ }
92
+ function mt(n, i) {
93
+ const t = i !== void 0 ? i : n;
94
+ return t == null ? [] : Array.isArray(t) ? t : [t];
95
+ }
96
+ const yt = /* @__PURE__ */ new Set([
97
+ "script",
98
+ "iframe",
99
+ "object",
100
+ "embed",
101
+ "link",
102
+ "meta",
103
+ "base",
104
+ "style",
105
+ "html",
106
+ "head",
107
+ "body",
108
+ "frameset",
109
+ "frame",
110
+ "applet",
111
+ "template",
112
+ "noscript",
113
+ "foreignobject",
114
+ "area",
115
+ "br",
116
+ "col",
117
+ "hr",
118
+ "img",
119
+ "input",
120
+ "param",
121
+ "source",
122
+ "track",
123
+ "wbr"
124
+ ]), bt = /^[a-z][a-z0-9]*$/;
125
+ function _t(n) {
126
+ if (typeof n != "string") return "div";
127
+ const i = n.trim().toLowerCase();
128
+ return !bt.test(i) || yt.has(i) ? "div" : i;
129
+ }
130
+ function A(n, i) {
131
+ const t = `fibo-${i}-`;
132
+ return n.some((e) => e.startsWith(t));
133
+ }
134
+ function xt(n) {
135
+ return typeof n == "number" ? `${n}px` : String(n);
136
+ }
137
+ function v(n, i) {
138
+ const t = `env(safe-area-inset-${i}, 0px)`;
139
+ if (n == null || n === "") return t;
140
+ const e = xt(n);
141
+ return e.includes("safe-area-inset") ? e : `max(${e}, ${t})`;
142
+ }
143
+ function St(n, i) {
144
+ const t = { ...n }, e = t;
145
+ for (const r of ["padding", "margin"]) {
146
+ const o = e[r];
147
+ if (o == null || o === "") continue;
148
+ const s = `${r}Top`, l = `${r}Right`, a = `${r}Bottom`, f = `${r}Left`;
149
+ if (!(e[s] != null || e[l] != null || e[a] != null || e[f] != null || i.has(`${r}-top`) || i.has(`${r}-right`) || i.has(`${r}-bottom`) || i.has(`${r}-left`))) continue;
150
+ const [p, c, x, S] = E(String(o));
151
+ e[s] == null && !i.has(`${r}-top`) && (e[s] = p), e[l] == null && !i.has(`${r}-right`) && (e[l] = c), e[a] == null && !i.has(`${r}-bottom`) && (e[a] = x), e[f] == null && !i.has(`${r}-left`) && (e[f] = S), delete e[r];
152
+ }
153
+ return t;
154
+ }
155
+ function wt(n, i) {
156
+ const t = n;
157
+ if (t.padding != null && t.padding !== "") {
158
+ const [o, s, l, a] = E(String(t.padding));
159
+ t.paddingTop == null && (t.paddingTop = o), t.paddingRight == null && (t.paddingRight = s), t.paddingBottom == null && (t.paddingBottom = l), t.paddingLeft == null && (t.paddingLeft = a), delete t.padding;
160
+ }
161
+ t.paddingLeft == null && i.left != null && (t.paddingLeft = i.left), t.paddingRight == null && i.right != null && (t.paddingRight = i.right), t.paddingTop == null && i.top != null && (t.paddingTop = i.top), t.paddingBottom == null && i.bottom != null && (t.paddingBottom = i.bottom);
162
+ const e = t.paddingTop != null && t.paddingTop !== "", r = t.paddingBottom != null && t.paddingBottom !== "";
163
+ t.paddingLeft = v(t.paddingLeft, "left"), t.paddingRight = v(t.paddingRight, "right"), e && (t.paddingTop = v(t.paddingTop, "top")), r && (t.paddingBottom = v(t.paddingBottom, "bottom"));
164
+ }
165
+ function vt(n, i, t, e) {
166
+ const r = n, o = r.width != null || e.has("width") || A(t, "width");
167
+ if (i) {
168
+ o || (r.width = "auto");
169
+ return;
170
+ }
171
+ o || (r.width = "100%");
172
+ const s = r.margin != null && r.margin !== "", l = s || r.marginLeft != null || r.marginInlineStart != null || e.has("margin-left") || A(t, "margin-left"), a = s || r.marginRight != null || r.marginInlineEnd != null || e.has("margin-right") || A(t, "margin-right");
173
+ l || (r.marginLeft = "auto"), a || (r.marginRight = "auto");
174
+ }
175
+ function Ct(n, i, t, e, r, o, s) {
176
+ const l = i ? rt({ ...n, ...i }) : { ...n }, a = St(l, o);
177
+ return !(a.maxWidth != null || A(r, "max-width") || o.has("max-width")) && t != null && t !== "" && (a.maxWidth = _("maxWidth", t)), vt(a, e, r, o), wt(a, s), a;
178
+ }
179
+ class Tt extends B {
180
+ constructor() {
181
+ super(...arguments);
182
+ d(this, "_userPad", {});
183
+ }
184
+ children(t) {
185
+ return N(this, t), super.children(t);
186
+ }
187
+ props(t) {
188
+ return t && "children" in t && N(this, t.children), super.props(t);
189
+ }
190
+ padding(t, e) {
191
+ if (e !== void 0 || t != null && typeof t == "object")
192
+ return super.padding(t, e);
193
+ const r = t, o = _("padding", r), [s, l, a, f] = E(o);
194
+ return this._boxLonghands.has("padding-top") || (this._userPad.top = s), this._boxLonghands.has("padding-right") || (this._userPad.right = l), this._boxLonghands.has("padding-bottom") || (this._userPad.bottom = a), this._boxLonghands.has("padding-left") || (this._userPad.left = f), super.padding(r);
195
+ }
196
+ paddingHorizontal(t) {
197
+ const e = _("paddingLeft", t);
198
+ return this._userPad.left = e, this._userPad.right = e, super.paddingHorizontal(t);
199
+ }
200
+ paddingVertical(t) {
201
+ const e = _("paddingTop", t);
202
+ return this._userPad.top = e, this._userPad.bottom = e, super.paddingVertical(t);
203
+ }
204
+ paddingLeft(t) {
205
+ const e = _("paddingLeft", t);
206
+ return this._userPad.left = e, this._boxLonghands.add("padding-left"), this.addClassName(b.register("padding-left", e)), this;
207
+ }
208
+ paddingRight(t) {
209
+ const e = _("paddingRight", t);
210
+ return this._userPad.right = e, this._boxLonghands.add("padding-right"), this.addClassName(b.register("padding-right", e)), this;
211
+ }
212
+ paddingTop(t) {
213
+ const e = _("paddingTop", t);
214
+ return this._userPad.top = e, this._boxLonghands.add("padding-top"), this.addClassName(b.register("padding-top", e)), this;
215
+ }
216
+ paddingBottom(t) {
217
+ const e = _("paddingBottom", t);
218
+ return this._userPad.bottom = e, this._boxLonghands.add("padding-bottom"), this.addClassName(b.register("padding-bottom", e)), this;
219
+ }
220
+ build() {
221
+ const {
222
+ children: t,
223
+ className: e,
224
+ style: r,
225
+ as: o,
226
+ tag: s,
227
+ dangerouslySetInnerHTML: l,
228
+ maxWidth: a,
229
+ ...f
230
+ } = this._props, g = this.isHug(), p = mt(this.processChildren(), t).map(gt), c = Ct(
231
+ this.getStyle(),
232
+ r,
233
+ a,
234
+ g,
235
+ this._classNames,
236
+ this._boxLonghands,
237
+ this._userPad
238
+ ), x = [
239
+ b.register("padding-left", String(c.paddingLeft ?? v(void 0, "left"))),
240
+ b.register("padding-right", String(c.paddingRight ?? v(void 0, "right")))
241
+ ];
242
+ c.paddingTop != null && String(c.paddingTop).includes("safe-area-inset") && x.push(b.register("padding-top", String(c.paddingTop))), c.paddingBottom != null && String(c.paddingBottom).includes("safe-area-inset") && x.push(b.register("padding-bottom", String(c.paddingBottom)));
243
+ const S = [
244
+ "fibo-container",
245
+ g ? "w-auto" : "w-full mx-auto",
246
+ this.getClassName(),
247
+ e,
248
+ ...x
249
+ ].filter(Boolean).join(" ").replace(/\s+/g, " ").trim(), k = _t(o ?? s);
250
+ return h.createElement(
251
+ k,
252
+ {
253
+ ...f,
254
+ className: S,
255
+ style: c
256
+ },
257
+ ...p
258
+ );
259
+ }
260
+ }
261
+ const Ut = T(Tt);
262
+ function K(n) {
263
+ if (n == null || typeof n != "object") return;
264
+ const i = n;
265
+ if (typeof i._frameWidth == "number" && typeof i._frameHeight == "number")
266
+ return { width: i._frameWidth, height: i._frameHeight };
267
+ const t = i._frames;
268
+ if (!(t != null && t.length)) return;
269
+ const e = t[t.length - 1];
270
+ if (ot(e))
271
+ return { width: e.width, height: e.height };
272
+ }
273
+ function M(n) {
274
+ if (n == null) return;
275
+ const i = Array.isArray(n) ? n : [n];
276
+ for (const t of i)
277
+ if (t != null && typeof t != "boolean") return t;
278
+ }
279
+ function Bt(n, i) {
280
+ if (!(typeof i != "string" || !m(i)))
281
+ for (const t of z(i))
282
+ n.bindSignal(t);
283
+ }
284
+ function I(n, i) {
285
+ if (typeof i == "function") {
286
+ try {
287
+ I(n, i());
288
+ } catch {
289
+ }
290
+ return;
291
+ }
292
+ if (typeof i == "string") {
293
+ Bt(n, i);
294
+ return;
295
+ }
296
+ if (Array.isArray(i))
297
+ for (const t of i) I(n, t);
298
+ }
299
+ function $t(n) {
300
+ return typeof n == "string" && m(n) ? $(n) : n;
301
+ }
302
+ function zt(n, i) {
303
+ const { children: t, ...e } = i, r = t !== void 0 ? t : n;
304
+ return { nodes: r == null ? [] : Array.isArray(r) ? r : [r], rest: e };
305
+ }
306
+ function At(n, i, t) {
307
+ if (n == null || typeof n == "boolean") return null;
308
+ const e = i === 0, r = st(t);
309
+ return e ? h.createElement(
310
+ "div",
311
+ {
312
+ key: `fibo-zstack-layer-${i}`,
313
+ className: "fibo-zstack-layer fibo-zstack-layer-base",
314
+ style: {
315
+ position: "relative",
316
+ zIndex: 0,
317
+ isolation: "isolate",
318
+ // Shrink-wrap the base child (Image/Box). No overflow clip on the
319
+ // base so shadows/glows on the poster are not cut — overlays clip.
320
+ minWidth: 0,
321
+ minHeight: 0,
322
+ maxWidth: "100%",
323
+ lineHeight: 0
324
+ // kill inline-img baseline gap if child is reset to inline
325
+ }
326
+ },
327
+ n
328
+ ) : h.createElement(
329
+ "div",
330
+ {
331
+ key: `fibo-zstack-layer-${i}`,
332
+ className: "fibo-zstack-layer fibo-zstack-layer-overlay",
333
+ style: {
334
+ position: "absolute",
335
+ inset: 0,
336
+ zIndex: i,
337
+ isolation: "isolate",
338
+ overflow: "hidden",
339
+ boxSizing: "border-box",
340
+ minWidth: 0,
341
+ minHeight: 0,
342
+ maxWidth: "100%",
343
+ maxHeight: "100%",
344
+ pointerEvents: "none"
345
+ }
346
+ },
347
+ h.createElement(
348
+ "div",
349
+ {
350
+ className: "fibo-zstack-overlay-content",
351
+ style: {
352
+ pointerEvents: "auto",
353
+ boxSizing: "border-box",
354
+ width: "100%",
355
+ height: "100%",
356
+ minWidth: 0,
357
+ minHeight: 0,
358
+ maxWidth: "100%",
359
+ maxHeight: "100%",
360
+ overflow: "hidden",
361
+ display: "flex",
362
+ ...r
363
+ }
364
+ },
365
+ n
366
+ )
367
+ );
368
+ }
369
+ class Lt extends B {
370
+ constructor() {
371
+ super(...arguments);
372
+ d(this, "_alignment", "center");
373
+ d(this, "_fit", "content");
374
+ /** Copied from base child’s fixed frame, if any. */
375
+ d(this, "_baseFixedFrame");
376
+ }
377
+ children(t) {
378
+ return I(this, t), this._baseFixedFrame = K(M(t)), super.children(t);
379
+ }
380
+ props(t) {
381
+ return t && "children" in t && (I(this, t.children), this._baseFixedFrame = K(M(t.children))), super.props(t);
382
+ }
383
+ alignment(t) {
384
+ return this._alignment = t, this;
385
+ }
386
+ /**
387
+ * How the stack sizes itself.
388
+ * - `content` (default): hug the base child — SwiftUI ideal size / `StackFit.loose`
389
+ * - `expand`: fill the parent — `StackFit.expand`
390
+ *
391
+ * `.hug()` still forces content; explicit `.width('100%')` still fills.
392
+ */
393
+ fit(t) {
394
+ return this._fit = t, this;
395
+ }
396
+ build() {
397
+ const t = this.isHug() || this._fit === "content", e = [
398
+ "fibo-zstack",
399
+ "relative",
400
+ "isolate",
401
+ "overflow-hidden",
402
+ t ? "w-auto self-auto" : "w-full min-w-0 min-h-0 self-stretch",
403
+ ...this._classNames
404
+ ], r = this.getStyle();
405
+ r.overflow == null && (r.overflow = "hidden"), this._baseFixedFrame ? (r.width == null && (r.width = `${this._baseFixedFrame.width}px`), r.height == null && (r.height = `${this._baseFixedFrame.height}px`)) : t && r.height == null && r.minHeight == null && (r.height = "fit-content");
406
+ const { nodes: o, rest: s } = zt(this.processChildren(), this._props), { className: l, ...a } = s, f = [...e, l].filter(Boolean).join(" "), g = o.map($t).map((p, c) => At(p, c, this._alignment));
407
+ return h.createElement(
408
+ "div",
409
+ {
410
+ style: r,
411
+ ...a,
412
+ className: f
413
+ },
414
+ ...g
415
+ );
416
+ }
417
+ }
418
+ const Jt = T(Lt);
419
+ function Nt(n, i) {
420
+ if (!(typeof i != "string" || !m(i)))
421
+ for (const t of z(i))
422
+ n.bindSignal(t);
423
+ }
424
+ function H(n, i) {
425
+ if (typeof i == "function") {
426
+ try {
427
+ H(n, i());
428
+ } catch {
429
+ }
430
+ return;
431
+ }
432
+ if (typeof i == "string") {
433
+ Nt(n, i);
434
+ return;
435
+ }
436
+ if (Array.isArray(i))
437
+ for (const t of i) H(n, t);
438
+ }
439
+ function It(n) {
440
+ return typeof n == "string" && m(n) ? $(n) : n;
441
+ }
442
+ function Ht(n) {
443
+ return n && typeof n == "object" && !Array.isArray(n) ? n : {};
444
+ }
445
+ function Rt(n, i) {
446
+ return n === !0 || n === "true" ? !0 : i === "none" || i === "presentation";
447
+ }
448
+ function kt(n) {
449
+ return n.flexDirection === "column" || n.flexDirection === "column-reverse";
450
+ }
451
+ function Ft(n, i) {
452
+ const { children: t, ...e } = i, r = t !== void 0 ? t : n;
453
+ return { nodes: r == null ? [] : Array.isArray(r) ? r : [r], rest: e };
454
+ }
455
+ class Wt extends B {
456
+ constructor() {
457
+ super(...arguments);
458
+ d(this, "_sizeHeight");
459
+ }
460
+ children(t) {
461
+ return H(this, t), super.children(t);
462
+ }
463
+ props(t) {
464
+ return t && "children" in t && H(this, t.children), super.props(t);
465
+ }
466
+ sizeHeight(t) {
467
+ return this._sizeHeight = t, this;
468
+ }
469
+ /** Separator axis. `vertical` paints a 1px column rule. */
470
+ direction(t) {
471
+ return this.flexDirection(t === "vertical" ? "column" : "row");
472
+ }
473
+ build() {
474
+ const { nodes: t, rest: e } = Ft(this.processChildren(), this._props), { className: r, style: o, ...s } = e, l = { ...this.getStyle(), ...Ht(o) };
475
+ this._sizeHeight && (l.height = this._sizeHeight);
476
+ const a = t.map(It), f = kt(l), g = Rt(s["aria-hidden"], s.role), p = ["fibo-line", ...this._classNames, r].filter(Boolean).join(" ");
477
+ if (f && a.length === 0)
478
+ return l.width = l.width ?? "1px", l.alignSelf = l.alignSelf ?? "stretch", l.height == null && (l.height = "100%"), g ? h.createElement("div", {
479
+ ...s,
480
+ role: "none",
481
+ "aria-hidden": !0,
482
+ "aria-orientation": void 0,
483
+ style: l,
484
+ className: p
485
+ }) : h.createElement("div", {
486
+ ...s,
487
+ role: "separator",
488
+ "aria-orientation": "vertical",
489
+ style: l,
490
+ className: p
491
+ });
492
+ if (a.length === 0)
493
+ return g ? h.createElement("hr", {
494
+ ...s,
495
+ role: "none",
496
+ "aria-hidden": !0,
497
+ "aria-orientation": void 0,
498
+ style: l,
499
+ className: p
500
+ }) : h.createElement("hr", {
501
+ ...s,
502
+ role: "separator",
503
+ "aria-orientation": "horizontal",
504
+ style: l,
505
+ className: p
506
+ });
507
+ const c = [
508
+ "fibo-line",
509
+ "flex",
510
+ f ? "flex-col" : "flex-row",
511
+ "min-w-0",
512
+ ...this._classNames,
513
+ r
514
+ ].filter(Boolean).join(" ");
515
+ return h.createElement(
516
+ "div",
517
+ {
518
+ ...s,
519
+ style: l,
520
+ className: c
521
+ },
522
+ ...a
523
+ );
524
+ }
525
+ }
526
+ const Qt = T(Wt);
527
+ class Et {
528
+ constructor() {
529
+ d(this, "_node", null);
530
+ }
531
+ /** @internal Attached by ScrollView on mount. */
532
+ attach(i) {
533
+ if (i == null) {
534
+ this._node = null;
535
+ return;
536
+ }
537
+ typeof document > "u" || (this._node = i);
538
+ }
539
+ get node() {
540
+ return this._node;
541
+ }
542
+ /** Prefer the inner strip so wrapping for overflow does not count as a slide. */
543
+ itemHost() {
544
+ var e;
545
+ const i = this._node;
546
+ if (!i) return null;
547
+ const t = i.firstElementChild;
548
+ return (e = t == null ? void 0 : t.classList) != null && e.contains("fibo-scroll-inner") ? t : i;
549
+ }
550
+ alive() {
551
+ return typeof document > "u" ? null : this._node;
552
+ }
553
+ scrollBy(i) {
554
+ var t, e;
555
+ (e = (t = this.alive()) == null ? void 0 : t.scrollBy) == null || e.call(t, i);
556
+ }
557
+ scrollTo(i) {
558
+ var t, e;
559
+ (e = (t = this.alive()) == null ? void 0 : t.scrollTo) == null || e.call(t, i);
560
+ }
561
+ /** Prefer overflow styles (direction) over whether content currently overflows. */
562
+ scrollAxis(i) {
563
+ const t = i.style.overflowX, e = i.style.overflowY, r = t === "auto" || t === "scroll", o = e === "auto" || e === "scroll";
564
+ return r && !o ? "left" : !r && o ? "top" : i.scrollWidth > i.clientWidth ? "left" : "top";
565
+ }
566
+ /**
567
+ * Carousel step: scroll by the first child's outer width (+ gap).
568
+ * Prefer this over measuring in app code.
569
+ */
570
+ scrollByChild(i = 1, t = 0) {
571
+ const e = this.alive(), r = this.itemHost();
572
+ if (!e || !r) return;
573
+ const o = r.firstElementChild;
574
+ if (!o) return;
575
+ const s = this.scrollAxis(e), a = (s === "left" ? o.getBoundingClientRect().width : o.getBoundingClientRect().height) + t;
576
+ e.scrollBy(
577
+ s === "left" ? { left: i * a, behavior: "smooth" } : { top: i * a, behavior: "smooth" }
578
+ );
579
+ }
580
+ scrollToChild(i, t = 0) {
581
+ const e = this.alive(), r = this.itemHost();
582
+ if (!e || !r) return;
583
+ const o = r.children[i];
584
+ if (!o) return;
585
+ const s = this.scrollAxis(e), l = (s === "left" ? o.offsetLeft : o.offsetTop) + i * t;
586
+ e.scrollTo({
587
+ [s]: l,
588
+ behavior: "smooth"
589
+ });
590
+ }
591
+ }
592
+ function X(n) {
593
+ return n === "horizontal" ? "x mandatory" : n === "both" ? "both mandatory" : "y mandatory";
594
+ }
595
+ function jt(n, i) {
596
+ if (!(typeof i != "string" || !m(i)))
597
+ for (const t of z(i))
598
+ n.bindSignal(t);
599
+ }
600
+ function R(n, i) {
601
+ if (typeof i == "function") {
602
+ try {
603
+ R(n, i());
604
+ } catch {
605
+ }
606
+ return;
607
+ }
608
+ if (typeof i == "string") {
609
+ jt(n, i);
610
+ return;
611
+ }
612
+ if (Array.isArray(i))
613
+ for (const t of i) R(n, t);
614
+ }
615
+ function Pt(n) {
616
+ return typeof n == "string" && m(n) ? $(n) : n;
617
+ }
618
+ function Dt(n, i) {
619
+ const { children: t, ...e } = i, r = t !== void 0 ? t : n;
620
+ return { nodes: (r == null ? [] : Array.isArray(r) ? r : [r]).map(Pt), rest: e };
621
+ }
622
+ function Vt(...n) {
623
+ return (i) => {
624
+ for (const t of n)
625
+ t && (typeof t == "function" ? t(i) : t.current = i);
626
+ };
627
+ }
628
+ function Gt(n) {
629
+ return n === "horizontal" || n === "vertical" || n === "both";
630
+ }
631
+ function Kt(n) {
632
+ return n === "hidden" || n === "visible" || n === "auto";
633
+ }
634
+ function Mt(n) {
635
+ const i = { ...n }, t = i.overflow;
636
+ if (t == null || t === "")
637
+ return delete i.overflow, i;
638
+ const e = String(t).trim().split(/\s+/).filter(Boolean);
639
+ if (e.length === 0)
640
+ return delete i.overflow, i;
641
+ const r = e[0], o = e[1] ?? e[0];
642
+ return i.overflowX == null && (i.overflowX = r), i.overflowY == null && (i.overflowY = o), delete i.overflow, i;
643
+ }
644
+ class Xt extends B {
645
+ constructor() {
646
+ super(...arguments);
647
+ d(this, "_direction", "vertical");
648
+ d(this, "_scrollbar", "auto");
649
+ d(this, "_controller");
650
+ d(this, "_anchor");
651
+ d(this, "_refresh");
652
+ d(this, "_scrollTargetLayout", !1);
653
+ d(this, "_scrollPosition");
654
+ }
655
+ children(t) {
656
+ return R(this, t), super.children(t);
657
+ }
658
+ props(t) {
659
+ return t && "children" in t && R(this, t.children), super.props(t);
660
+ }
661
+ direction(t) {
662
+ return this._direction = t, this;
663
+ }
664
+ horizontal() {
665
+ return this._direction = "horizontal", this;
666
+ }
667
+ vertical() {
668
+ return this._direction = "vertical", this;
669
+ }
670
+ scrollbar(t) {
671
+ return this._scrollbar = t, this;
672
+ }
673
+ /** Attach a ScrollController for programmatic scroll (carousel prev/next). */
674
+ controller(t) {
675
+ return this._controller = t, this;
676
+ }
677
+ scrollAnchor(t) {
678
+ return this._anchor = t, this;
679
+ }
680
+ refreshable(t) {
681
+ return this._refresh = t, this;
682
+ }
683
+ /**
684
+ * SwiftUI `scrollTargetLayout` — children participate as scroll targets
685
+ * (snap + `data-scroll-target-layout`).
686
+ */
687
+ scrollTargetLayout(t = !0) {
688
+ return this._scrollTargetLayout = t, t && !this._anchor && (this._anchor = "start"), this;
689
+ }
690
+ /**
691
+ * SwiftUI `scrollPosition(id:)` — initial / programmatic target id
692
+ * (`data-scroll-position`). Pair with `.scrollTarget(id)` on children.
693
+ */
694
+ scrollPosition(t) {
695
+ return this._scrollPosition = t, this;
696
+ }
697
+ onScroll(t = "fadeIn") {
698
+ return typeof t == "function" ? (this._props.onScroll = t, this) : super.onScroll(t);
699
+ }
700
+ build() {
701
+ const { nodes: t, rest: e } = Dt(this.processChildren(), this._props), {
702
+ ref: r,
703
+ className: o,
704
+ style: s,
705
+ controller: l,
706
+ direction: a,
707
+ scrollbar: f,
708
+ onScroll: g,
709
+ ...p
710
+ } = e, c = Gt(a) ? a : this._direction, x = Kt(f) ? f : this._scrollbar, S = this._controller ?? (l instanceof Et ? l : void 0), k = c === "horizontal" || c === "both", Y = c === "vertical" || c === "both", Z = this.getStyle(), { gap: j, rowGap: P, columnGap: D, ...O } = Z, q = k ? "auto" : "hidden", U = Y ? "auto" : "hidden", u = {
711
+ display: "flex",
712
+ flexDirection: c === "horizontal" ? "row" : "column",
713
+ flexWrap: "nowrap",
714
+ flex: "0 0 auto"
715
+ };
716
+ j != null && (u.gap = j), P != null && (u.rowGap = P), D != null && (u.columnGap = D), c === "horizontal" ? (u.width = "max-content", u.minHeight = "0px") : c === "both" ? (u.width = "max-content", u.height = "max-content", u.minWidth = "0px", u.minHeight = "0px") : (u.width = "100%", u.maxWidth = "100%", u.minWidth = "0px");
717
+ const F = [
718
+ "fibo-scrollview",
719
+ ...this.getClassName().split(" ").filter(Boolean),
720
+ o
721
+ ], J = Mt({
722
+ ...O,
723
+ ...s && typeof s == "object" ? s : {}
724
+ }), y = {
725
+ WebkitOverflowScrolling: "touch",
726
+ minWidth: "0px",
727
+ minHeight: "0px",
728
+ display: "flex",
729
+ flexDirection: c === "horizontal" ? "row" : "column",
730
+ ...J,
731
+ // Direction overflow must survive `.props({ style })` replacing the object.
732
+ overflowX: q,
733
+ overflowY: U
734
+ };
735
+ if (x === "hidden" && (F.push("scrollbar-hide"), y.scrollbarWidth = "none", y.msOverflowStyle = "none"), this._anchor) {
736
+ y.scrollSnapAlign = this._anchor;
737
+ const w = y.scrollSnapType ?? y["scroll-snap-type"];
738
+ (w == null || w === "") && (y.scrollSnapType = X(c));
739
+ }
740
+ const C = this._scrollPosition, Q = Vt(
741
+ (w) => {
742
+ S == null || S.attach(w), w && C && requestAnimationFrame(() => {
743
+ const it = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(C) : C.replace(/"/g, '\\"'), W = w.querySelector(
744
+ `[data-scroll-id="${it}"]`
745
+ );
746
+ W == null || W.scrollIntoView({ block: "nearest", inline: "nearest" });
747
+ });
748
+ },
749
+ r
750
+ ), V = this._refresh, tt = h.createElement(
751
+ "div",
752
+ { className: "fibo-scroll-inner", style: u },
753
+ ...t
754
+ );
755
+ this._scrollTargetLayout && (F.push("fibo-scroll-target-layout"), y.scrollSnapType == null && (y.scrollSnapType = X(c)));
756
+ const G = h.createElement(
757
+ "div",
758
+ {
759
+ ...p,
760
+ ...this._anchor ? { "data-scroll-anchor": this._anchor } : {},
761
+ ...this._scrollTargetLayout ? { "data-scroll-target-layout": "1" } : {},
762
+ ...C ? { "data-scroll-position": C } : {},
763
+ "data-fibo-scroll-host": "",
764
+ className: F.filter(Boolean).join(" "),
765
+ style: y,
766
+ ref: Q,
767
+ onScroll: g
768
+ },
769
+ tt
770
+ );
771
+ return !V || c === "horizontal" ? G : h.createElement(lt, {
772
+ onRefresh: V,
773
+ children: G
774
+ });
775
+ }
776
+ }
777
+ const ti = T(Xt);
778
+ export {
779
+ qt as C,
780
+ Qt as L,
781
+ ti as S,
782
+ Jt as Z,
783
+ Ut as a,
784
+ Et as b
785
+ };