fiboui 2.8.5 → 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.
@@ -1,839 +0,0 @@
1
- var tt = Object.defineProperty;
2
- var it = (e, i, t) => i in e ? tt(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t;
3
- var h = (e, i, t) => it(e, typeof i != "symbol" ? i + "" : i, t);
4
- import d from "react";
5
- import { aZ as v, a_ as $, b2 as C, b1 as g, b4 as T, bp as w, bq as O, br as S, bs as et, bk as nt } from "./client-BzMPiV64.js";
6
- function rt(e, i) {
7
- if (!(typeof i != "string" || !g(i)))
8
- for (const t of T(i))
9
- e.bindSignal(t);
10
- }
11
- function I(e, i) {
12
- if (typeof i == "function") {
13
- try {
14
- I(e, i());
15
- } catch {
16
- }
17
- return;
18
- }
19
- if (typeof i == "string") {
20
- rt(e, i);
21
- return;
22
- }
23
- if (Array.isArray(i))
24
- for (const t of i) I(e, t);
25
- }
26
- function st(e) {
27
- return typeof e == "string" && g(e) ? C(e) : e;
28
- }
29
- function ot(e) {
30
- return e && typeof e == "object" && !Array.isArray(e) ? e : {};
31
- }
32
- function lt(e) {
33
- e.display !== "none" && (e.display = "flex", (e.alignItems == null || e.alignItems === "") && (e.alignItems = "center"), (e.justifyContent == null || e.justifyContent === "") && (e.justifyContent = "center")), e.margin == null && (e.marginLeft == null && (e.marginLeft = "auto"), e.marginRight == null && (e.marginRight = "auto"));
34
- }
35
- function at(e, i) {
36
- const { children: t, ...n } = i, r = t !== void 0 ? t : e;
37
- return { nodes: r == null ? [] : Array.isArray(r) ? r : [r], rest: n };
38
- }
39
- class ct extends $ {
40
- children(i) {
41
- return I(this, i), super.children(i);
42
- }
43
- props(i) {
44
- return i && "children" in i && I(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: n } = at(this.processChildren(), this._props), { className: r, style: s, ...o } = n, l = [...i, r].filter(Boolean).join(" "), a = t.map(st), f = { ...this.getStyle(), ...ot(s) };
57
- return lt(f), d.createElement(
58
- "div",
59
- {
60
- style: f,
61
- ...o,
62
- className: l
63
- },
64
- ...a
65
- );
66
- }
67
- }
68
- const Zt = v(ct);
69
- function ft(e, i) {
70
- if (!(typeof i != "string" || !g(i)))
71
- for (const t of T(i))
72
- e.bindSignal(t);
73
- }
74
- function L(e, i) {
75
- if (typeof i == "function") {
76
- try {
77
- L(e, i());
78
- } catch {
79
- }
80
- return;
81
- }
82
- if (typeof i == "string") {
83
- ft(e, i);
84
- return;
85
- }
86
- if (Array.isArray(i))
87
- for (const t of i) L(e, t);
88
- }
89
- function ht(e) {
90
- return typeof e == "string" && g(e) ? C(e) : e;
91
- }
92
- function dt(e, i) {
93
- const t = i !== void 0 ? i : e;
94
- return t == null ? [] : Array.isArray(t) ? t : [t];
95
- }
96
- const pt = /* @__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
- ]), ut = /^[a-z][a-z0-9]*$/;
125
- function gt(e) {
126
- if (typeof e != "string") return "div";
127
- const i = e.trim().toLowerCase();
128
- return !ut.test(i) || pt.has(i) ? "div" : i;
129
- }
130
- function B(e, i) {
131
- const t = `fibo-${i}-`;
132
- return e.some((n) => n.startsWith(t));
133
- }
134
- function mt(e) {
135
- return typeof e == "number" ? `${e}px` : String(e);
136
- }
137
- function k(e, i) {
138
- const t = `env(safe-area-inset-${i}, 0px)`;
139
- if (e == null || e === "") return t;
140
- const n = mt(e);
141
- return n.includes("safe-area-inset") ? n : `max(${n}, ${t})`;
142
- }
143
- function yt(e, i) {
144
- const t = { ...e }, n = t;
145
- for (const r of ["padding", "margin"]) {
146
- const s = n[r];
147
- if (s == null || s === "") continue;
148
- const o = `${r}Top`, l = `${r}Right`, a = `${r}Bottom`, f = `${r}Left`;
149
- if (!(n[o] != null || n[l] != null || n[a] != null || n[f] != null || i.has(`${r}-top`) || i.has(`${r}-right`) || i.has(`${r}-bottom`) || i.has(`${r}-left`))) continue;
150
- const [m, c, y, b] = O(String(s));
151
- n[o] == null && !i.has(`${r}-top`) && (n[o] = m), n[l] == null && !i.has(`${r}-right`) && (n[l] = c), n[a] == null && !i.has(`${r}-bottom`) && (n[a] = y), n[f] == null && !i.has(`${r}-left`) && (n[f] = b), delete n[r];
152
- }
153
- return t;
154
- }
155
- function bt(e, i) {
156
- const t = e;
157
- if (t.padding != null && t.padding !== "") {
158
- const [s, o, l, a] = O(String(t.padding));
159
- t.paddingTop == null && (t.paddingTop = s), t.paddingRight == null && (t.paddingRight = o), 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 n = t.paddingTop != null && t.paddingTop !== "", r = t.paddingBottom != null && t.paddingBottom !== "";
163
- t.paddingLeft = k(t.paddingLeft, "left"), t.paddingRight = k(t.paddingRight, "right"), n && (t.paddingTop = k(t.paddingTop, "top")), r && (t.paddingBottom = k(t.paddingBottom, "bottom"));
164
- }
165
- function _t(e, i, t, n) {
166
- const r = e, s = r.width != null || n.has("width") || B(t, "width");
167
- if (i) {
168
- s || (r.width = "auto");
169
- return;
170
- }
171
- s || (r.width = "100%");
172
- const o = r.margin != null && r.margin !== "", l = o || r.marginLeft != null || r.marginInlineStart != null || n.has("margin-left") || B(t, "margin-left"), a = o || r.marginRight != null || r.marginInlineEnd != null || n.has("margin-right") || B(t, "margin-right");
173
- l || (r.marginLeft = "auto"), a || (r.marginRight = "auto");
174
- }
175
- function St(e, i, t, n, r, s, o) {
176
- const l = i ? et({ ...e, ...i }) : { ...e }, a = yt(l, s);
177
- return !(a.maxWidth != null || B(r, "max-width") || s.has("max-width")) && t != null && t !== "" && (a.maxWidth = w("maxWidth", t)), _t(a, n, r, s), bt(a, o), a;
178
- }
179
- class wt extends $ {
180
- constructor() {
181
- super(...arguments);
182
- h(this, "_userPad", {});
183
- }
184
- children(t) {
185
- return L(this, t), super.children(t);
186
- }
187
- props(t) {
188
- return t && "children" in t && L(this, t.children), super.props(t);
189
- }
190
- padding(t) {
191
- const n = w("padding", t), [r, s, o, l] = O(n);
192
- return this._boxLonghands.has("padding-top") || (this._userPad.top = r), this._boxLonghands.has("padding-right") || (this._userPad.right = s), this._boxLonghands.has("padding-bottom") || (this._userPad.bottom = o), this._boxLonghands.has("padding-left") || (this._userPad.left = l), super.padding(t);
193
- }
194
- paddingHorizontal(t) {
195
- const n = w("paddingLeft", t);
196
- return this._userPad.left = n, this._userPad.right = n, super.paddingHorizontal(t);
197
- }
198
- paddingVertical(t) {
199
- const n = w("paddingTop", t);
200
- return this._userPad.top = n, this._userPad.bottom = n, super.paddingVertical(t);
201
- }
202
- paddingLeft(t) {
203
- const n = w("paddingLeft", t);
204
- return this._userPad.left = n, this._boxLonghands.add("padding-left"), this.addClassName(S.register("padding-left", n)), this;
205
- }
206
- paddingRight(t) {
207
- const n = w("paddingRight", t);
208
- return this._userPad.right = n, this._boxLonghands.add("padding-right"), this.addClassName(S.register("padding-right", n)), this;
209
- }
210
- paddingTop(t) {
211
- const n = w("paddingTop", t);
212
- return this._userPad.top = n, this._boxLonghands.add("padding-top"), this.addClassName(S.register("padding-top", n)), this;
213
- }
214
- paddingBottom(t) {
215
- const n = w("paddingBottom", t);
216
- return this._userPad.bottom = n, this._boxLonghands.add("padding-bottom"), this.addClassName(S.register("padding-bottom", n)), this;
217
- }
218
- build() {
219
- const {
220
- children: t,
221
- className: n,
222
- style: r,
223
- as: s,
224
- tag: o,
225
- dangerouslySetInnerHTML: l,
226
- maxWidth: a,
227
- ...f
228
- } = this._props, p = this.isHug(), m = dt(this.processChildren(), t).map(ht), c = St(
229
- this.getStyle(),
230
- r,
231
- a,
232
- p,
233
- this._classNames,
234
- this._boxLonghands,
235
- this._userPad
236
- ), y = [
237
- S.register("padding-left", String(c.paddingLeft ?? k(void 0, "left"))),
238
- S.register("padding-right", String(c.paddingRight ?? k(void 0, "right")))
239
- ];
240
- c.paddingTop != null && String(c.paddingTop).includes("safe-area-inset") && y.push(S.register("padding-top", String(c.paddingTop))), c.paddingBottom != null && String(c.paddingBottom).includes("safe-area-inset") && y.push(S.register("padding-bottom", String(c.paddingBottom)));
241
- const b = [
242
- "fibo-container",
243
- p ? "w-auto" : "w-full mx-auto",
244
- this.getClassName(),
245
- n,
246
- ...y
247
- ].filter(Boolean).join(" ").replace(/\s+/g, " ").trim(), E = gt(s ?? o);
248
- return d.createElement(
249
- E,
250
- {
251
- ...f,
252
- className: b,
253
- style: c
254
- },
255
- ...m
256
- );
257
- }
258
- }
259
- const Ut = v(wt);
260
- function xt(e, i) {
261
- if (!(typeof i != "string" || !g(i)))
262
- for (const t of T(i))
263
- e.bindSignal(t);
264
- }
265
- function _(e, i) {
266
- if (typeof i == "function") {
267
- try {
268
- _(e, i());
269
- } catch {
270
- }
271
- return;
272
- }
273
- if (typeof i == "string") {
274
- xt(e, i);
275
- return;
276
- }
277
- if (Array.isArray(i))
278
- for (const t of i) _(e, t);
279
- }
280
- function Ct(e) {
281
- return typeof e == "string" && g(e) ? C(e) : e;
282
- }
283
- function H(e) {
284
- return e == null || e === !1 ? null : typeof e == "string" ? g(e) ? C(e) : e : nt(e);
285
- }
286
- function kt(e, i) {
287
- const t = i !== void 0 ? i : e;
288
- return (t == null ? [] : Array.isArray(t) ? t : [t]).map(Ct);
289
- }
290
- const vt = d.memo((e) => {
291
- const {
292
- height: i = 64,
293
- sticky: t,
294
- className: n,
295
- style: r,
296
- children: s,
297
- leading: o,
298
- trailing: l,
299
- title: a,
300
- role: f,
301
- ...p
302
- } = e, m = Array.isArray(s) ? s : s == null ? [] : [s], c = o == null || o === !1 ? null : o, y = l == null || l === !1 ? null : l, b = a == null || a === !1 ? null : a;
303
- return d.createElement(
304
- "header",
305
- {
306
- ...p,
307
- className: [
308
- "flex items-center px-6 border-b border-gray-200 bg-white/80 backdrop-blur-md w-full",
309
- t ? "sticky z-10" : "",
310
- n || ""
311
- ].filter(Boolean).join(" "),
312
- style: { height: i, minHeight: i, ...r },
313
- role: f ?? "banner"
314
- },
315
- c != null ? d.createElement(
316
- "div",
317
- { key: "leading", className: "fibo-header-leading shrink-0 flex items-center" },
318
- c
319
- ) : null,
320
- b != null ? d.createElement(
321
- "span",
322
- { key: "title", className: "fibo-header-title flex-1 min-w-0" },
323
- b
324
- ) : null,
325
- ...m,
326
- y != null ? d.createElement(
327
- "div",
328
- { key: "trailing", className: "fibo-header-trailing shrink-0 flex items-center" },
329
- y
330
- ) : null
331
- );
332
- }), N = class N extends $ {
333
- constructor() {
334
- super(...arguments);
335
- h(this, "_height", 64);
336
- h(this, "_sticky", !1);
337
- h(this, "_stickyTop", 0);
338
- h(this, "_stickyStamp", []);
339
- h(this, "_leading");
340
- h(this, "_trailing");
341
- h(this, "_title");
342
- }
343
- children(t) {
344
- return _(this, t), super.children(t);
345
- }
346
- props(t) {
347
- return t && (_(this, t.children), _(this, t.leading), _(this, t.trailing), _(this, t.title)), super.props(t);
348
- }
349
- leading(t) {
350
- return this._leading = t, _(this, t), this;
351
- }
352
- trailing(t) {
353
- return this._trailing = t, _(this, t), this;
354
- }
355
- title(t) {
356
- return this._title = t, _(this, t), this;
357
- }
358
- height(t) {
359
- return this._height = t, this._sticky && this.syncStickyOffset(), this;
360
- }
361
- sticky(t = !0) {
362
- if (t === !1)
363
- return this._sticky && (this.dropStickyStamp(), N.unstickSeq += 1, this.publishStickyOffset(`0px${" ".repeat(N.unstickSeq)}`)), this._sticky = !1, this;
364
- this._sticky = !0, this._stickyTop = t === !0 ? 0 : t, this.dropStickyStamp();
365
- const n = new Set(this._classNames);
366
- return super.sticky(this._stickyTop), this._stickyStamp = this._classNames.filter((r) => !n.has(r)), this.syncStickyOffset(), this;
367
- }
368
- dropStickyStamp() {
369
- if (!this._stickyStamp.length) return;
370
- const t = new Set(this._stickyStamp);
371
- this._classNames = this._classNames.filter((n) => !t.has(n)), this._stickyStamp = [];
372
- }
373
- syncStickyOffset() {
374
- const t = this._stickyTop;
375
- if (typeof t == "number" && typeof this._height == "number") {
376
- this.publishStickyOffset(t + this._height);
377
- return;
378
- }
379
- if (t === 0 || t === "0" || t === "0px") {
380
- this.publishStickyOffset(this._height);
381
- return;
382
- }
383
- const n = typeof t == "number" ? `${t}px` : t, r = typeof this._height == "number" ? `${this._height}px` : this._height;
384
- this.publishStickyOffset(`calc(${n} + ${r})`);
385
- }
386
- build() {
387
- const {
388
- className: t,
389
- children: n,
390
- style: r,
391
- leading: s,
392
- trailing: o,
393
- title: l,
394
- ...a
395
- } = this._props, f = [this.getClassName(), t].filter(Boolean).join(" "), p = r ? { ...this.getStyle(), ...r } : this.getStyle();
396
- return d.createElement(vt, {
397
- ...a,
398
- height: this._height,
399
- sticky: this._sticky,
400
- className: f,
401
- style: p,
402
- leading: H(this._leading ?? s),
403
- trailing: H(this._trailing ?? o),
404
- title: H(this._title ?? l),
405
- children: kt(this.processChildren(), n)
406
- });
407
- }
408
- };
409
- h(N, "unstickSeq", 0);
410
- let W = N;
411
- const Jt = v(W);
412
- function $t(e, i) {
413
- if (!(typeof i != "string" || !g(i)))
414
- for (const t of T(i))
415
- e.bindSignal(t);
416
- }
417
- function j(e, i) {
418
- if (typeof i == "function") {
419
- try {
420
- j(e, i());
421
- } catch {
422
- }
423
- return;
424
- }
425
- if (typeof i == "string") {
426
- $t(e, i);
427
- return;
428
- }
429
- if (Array.isArray(i))
430
- for (const t of i) j(e, t);
431
- }
432
- function Tt(e) {
433
- return typeof e == "string" && g(e) ? C(e) : e;
434
- }
435
- function Nt(e, i) {
436
- const { children: t, ...n } = i, r = t !== void 0 ? t : e;
437
- return { nodes: r == null ? [] : Array.isArray(r) ? r : [r], rest: n };
438
- }
439
- class At extends $ {
440
- constructor() {
441
- super(...arguments);
442
- h(this, "_alignment", "center");
443
- }
444
- children(t) {
445
- return j(this, t), super.children(t);
446
- }
447
- props(t) {
448
- return t && "children" in t && j(this, t.children), super.props(t);
449
- }
450
- alignment(t) {
451
- return this._alignment = t, this;
452
- }
453
- build() {
454
- const t = {
455
- center: "items-center justify-items-center",
456
- top: "items-start justify-items-center",
457
- bottom: "items-end justify-items-center",
458
- left: "justify-items-start items-center",
459
- right: "justify-items-end items-center",
460
- topLeft: "items-start justify-items-start",
461
- topRight: "justify-items-end items-start",
462
- bottomLeft: "justify-items-start items-end",
463
- bottomRight: "items-end justify-items-end"
464
- }, n = [
465
- "fibo-zstack",
466
- // Containing block + stacking context: abspos children pin here,
467
- // child z-index does not leak to the page.
468
- "relative",
469
- "isolate",
470
- "grid",
471
- "grid-cols-1",
472
- "grid-rows-1",
473
- "[&>*]:col-start-1",
474
- "[&>*]:row-start-1",
475
- // Layer isolate: z-index:-1 FX (::before) stay inside each sibling.
476
- // Do not force [&>*]:absolute — grid overlay, not inset-0 leftover.
477
- "[&>*]:isolate",
478
- this.isHug() ? "w-auto self-auto" : "w-full min-w-0 min-h-0 self-stretch",
479
- t[this._alignment] || "items-center justify-items-center",
480
- ...this._classNames
481
- ], r = this.getStyle(), { nodes: s, rest: o } = Nt(this.processChildren(), this._props), { className: l, ...a } = o, f = [...n, l].filter(Boolean).join(" "), p = s.map(Tt);
482
- return d.createElement(
483
- "div",
484
- {
485
- style: r,
486
- ...a,
487
- className: f
488
- },
489
- ...p
490
- );
491
- }
492
- }
493
- const Qt = v(At);
494
- function Bt(e, i) {
495
- if (!(typeof i != "string" || !g(i)))
496
- for (const t of T(i))
497
- e.bindSignal(t);
498
- }
499
- function z(e, i) {
500
- if (typeof i == "function") {
501
- try {
502
- z(e, i());
503
- } catch {
504
- }
505
- return;
506
- }
507
- if (typeof i == "string") {
508
- Bt(e, i);
509
- return;
510
- }
511
- if (Array.isArray(i))
512
- for (const t of i) z(e, t);
513
- }
514
- function It(e) {
515
- return typeof e == "string" && g(e) ? C(e) : e;
516
- }
517
- function Lt(e) {
518
- return e && typeof e == "object" && !Array.isArray(e) ? e : {};
519
- }
520
- function jt(e, i) {
521
- return e === !0 || e === "true" ? !0 : i === "none" || i === "presentation";
522
- }
523
- function zt(e) {
524
- return e.flexDirection === "column" || e.flexDirection === "column-reverse";
525
- }
526
- function Rt(e, i) {
527
- const { children: t, ...n } = i, r = t !== void 0 ? t : e;
528
- return { nodes: r == null ? [] : Array.isArray(r) ? r : [r], rest: n };
529
- }
530
- class Et extends $ {
531
- constructor() {
532
- super(...arguments);
533
- h(this, "_sizeHeight");
534
- }
535
- children(t) {
536
- return z(this, t), super.children(t);
537
- }
538
- props(t) {
539
- return t && "children" in t && z(this, t.children), super.props(t);
540
- }
541
- sizeHeight(t) {
542
- return this._sizeHeight = t, this;
543
- }
544
- /** Separator axis. `vertical` paints a 1px column rule. */
545
- direction(t) {
546
- return this.flexDirection(t === "vertical" ? "column" : "row");
547
- }
548
- build() {
549
- const { nodes: t, rest: n } = Rt(this.processChildren(), this._props), { className: r, style: s, ...o } = n, l = { ...this.getStyle(), ...Lt(s) };
550
- this._sizeHeight && (l.height = this._sizeHeight);
551
- const a = t.map(It), f = zt(l), p = jt(o["aria-hidden"], o.role), m = ["fibo-line", ...this._classNames, r].filter(Boolean).join(" ");
552
- if (f && a.length === 0)
553
- return l.width = l.width ?? "1px", l.alignSelf = l.alignSelf ?? "stretch", l.height == null && (l.height = "100%"), p ? d.createElement("div", {
554
- ...o,
555
- role: "none",
556
- "aria-hidden": !0,
557
- "aria-orientation": void 0,
558
- style: l,
559
- className: m
560
- }) : d.createElement("div", {
561
- ...o,
562
- role: "separator",
563
- "aria-orientation": "vertical",
564
- style: l,
565
- className: m
566
- });
567
- if (a.length === 0)
568
- return p ? d.createElement("hr", {
569
- ...o,
570
- role: "none",
571
- "aria-hidden": !0,
572
- "aria-orientation": void 0,
573
- style: l,
574
- className: m
575
- }) : d.createElement("hr", {
576
- ...o,
577
- role: "separator",
578
- "aria-orientation": "horizontal",
579
- style: l,
580
- className: m
581
- });
582
- const c = [
583
- "fibo-line",
584
- "flex",
585
- f ? "flex-col" : "flex-row",
586
- "min-w-0",
587
- ...this._classNames,
588
- r
589
- ].filter(Boolean).join(" ");
590
- return d.createElement(
591
- "div",
592
- {
593
- ...o,
594
- style: l,
595
- className: c
596
- },
597
- ...a
598
- );
599
- }
600
- }
601
- const ti = v(Et);
602
- class Ht {
603
- constructor() {
604
- h(this, "_node", null);
605
- }
606
- /** @internal Attached by ScrollView on mount. */
607
- attach(i) {
608
- if (i == null) {
609
- this._node = null;
610
- return;
611
- }
612
- typeof document > "u" || (this._node = i);
613
- }
614
- get node() {
615
- return this._node;
616
- }
617
- /** Prefer the inner strip so wrapping for overflow does not count as a slide. */
618
- itemHost() {
619
- var n;
620
- const i = this._node;
621
- if (!i) return null;
622
- const t = i.firstElementChild;
623
- return (n = t == null ? void 0 : t.classList) != null && n.contains("fibo-scroll-inner") ? t : i;
624
- }
625
- alive() {
626
- return typeof document > "u" ? null : this._node;
627
- }
628
- scrollBy(i) {
629
- var t, n;
630
- (n = (t = this.alive()) == null ? void 0 : t.scrollBy) == null || n.call(t, i);
631
- }
632
- scrollTo(i) {
633
- var t, n;
634
- (n = (t = this.alive()) == null ? void 0 : t.scrollTo) == null || n.call(t, i);
635
- }
636
- /** Prefer overflow styles (direction) over whether content currently overflows. */
637
- scrollAxis(i) {
638
- const t = i.style.overflowX, n = i.style.overflowY, r = t === "auto" || t === "scroll", s = n === "auto" || n === "scroll";
639
- return r && !s ? "left" : !r && s ? "top" : i.scrollWidth > i.clientWidth ? "left" : "top";
640
- }
641
- /**
642
- * Carousel step: scroll by the first child's outer width (+ gap).
643
- * Prefer this over measuring in app code.
644
- */
645
- scrollByChild(i = 1, t = 0) {
646
- const n = this.alive(), r = this.itemHost();
647
- if (!n || !r) return;
648
- const s = r.firstElementChild;
649
- if (!s) return;
650
- const o = this.scrollAxis(n), a = (o === "left" ? s.getBoundingClientRect().width : s.getBoundingClientRect().height) + t;
651
- n.scrollBy(
652
- o === "left" ? { left: i * a, behavior: "smooth" } : { top: i * a, behavior: "smooth" }
653
- );
654
- }
655
- scrollToChild(i, t = 0) {
656
- const n = this.alive(), r = this.itemHost();
657
- if (!n || !r) return;
658
- const s = r.children[i];
659
- if (!s) return;
660
- const o = this.scrollAxis(n), l = (o === "left" ? s.offsetLeft : s.offsetTop) + i * t;
661
- n.scrollTo({
662
- [o]: l,
663
- behavior: "smooth"
664
- });
665
- }
666
- }
667
- function Wt(e) {
668
- return e === "horizontal" ? "x mandatory" : e === "both" ? "both mandatory" : "y mandatory";
669
- }
670
- function Ot(e, i) {
671
- if (!(typeof i != "string" || !g(i)))
672
- for (const t of T(i))
673
- e.bindSignal(t);
674
- }
675
- function R(e, i) {
676
- if (typeof i == "function") {
677
- try {
678
- R(e, i());
679
- } catch {
680
- }
681
- return;
682
- }
683
- if (typeof i == "string") {
684
- Ot(e, i);
685
- return;
686
- }
687
- if (Array.isArray(i))
688
- for (const t of i) R(e, t);
689
- }
690
- function Dt(e) {
691
- return typeof e == "string" && g(e) ? C(e) : e;
692
- }
693
- function Pt(e, i) {
694
- const { children: t, ...n } = i, r = t !== void 0 ? t : e;
695
- return { nodes: (r == null ? [] : Array.isArray(r) ? r : [r]).map(Dt), rest: n };
696
- }
697
- function Vt(...e) {
698
- return (i) => {
699
- for (const t of e)
700
- t && (typeof t == "function" ? t(i) : t.current = i);
701
- };
702
- }
703
- function Gt(e) {
704
- return e === "horizontal" || e === "vertical" || e === "both";
705
- }
706
- function Kt(e) {
707
- return e === "hidden" || e === "visible" || e === "auto";
708
- }
709
- function Mt(e) {
710
- const i = { ...e }, t = i.overflow;
711
- if (t == null || t === "")
712
- return delete i.overflow, i;
713
- const n = String(t).trim().split(/\s+/).filter(Boolean);
714
- if (n.length === 0)
715
- return delete i.overflow, i;
716
- const r = n[0], s = n[1] ?? n[0];
717
- return i.overflowX == null && (i.overflowX = r), i.overflowY == null && (i.overflowY = s), delete i.overflow, i;
718
- }
719
- class Xt extends $ {
720
- constructor() {
721
- super(...arguments);
722
- h(this, "_direction", "vertical");
723
- h(this, "_scrollbar", "auto");
724
- h(this, "_controller");
725
- h(this, "_anchor");
726
- h(this, "_refresh");
727
- }
728
- children(t) {
729
- return R(this, t), super.children(t);
730
- }
731
- props(t) {
732
- return t && "children" in t && R(this, t.children), super.props(t);
733
- }
734
- direction(t) {
735
- return this._direction = t, this;
736
- }
737
- horizontal() {
738
- return this._direction = "horizontal", this;
739
- }
740
- vertical() {
741
- return this._direction = "vertical", this;
742
- }
743
- scrollbar(t) {
744
- return this._scrollbar = t, this;
745
- }
746
- /** Attach a ScrollController for programmatic scroll (carousel prev/next). */
747
- controller(t) {
748
- return this._controller = t, this;
749
- }
750
- scrollAnchor(t) {
751
- return this._anchor = t, this;
752
- }
753
- refreshable(t) {
754
- return this._refresh = t, this;
755
- }
756
- onScroll(t = "fadeIn") {
757
- return typeof t == "function" ? (this._props.onScroll = t, this) : super.onScroll(t);
758
- }
759
- build() {
760
- const { nodes: t, rest: n } = Pt(this.processChildren(), this._props), {
761
- ref: r,
762
- className: s,
763
- style: o,
764
- controller: l,
765
- direction: a,
766
- scrollbar: f,
767
- onScroll: p,
768
- ...m
769
- } = n, c = Gt(a) ? a : this._direction, y = Kt(f) ? f : this._scrollbar, b = this._controller ?? (l instanceof Ht ? l : void 0), E = c === "horizontal" || c === "both", M = c === "vertical" || c === "both", X = this.getStyle(), { gap: D, rowGap: P, columnGap: V, ...Y } = X, q = E ? "auto" : "hidden", F = M ? "auto" : "hidden", u = {
770
- display: "flex",
771
- flexDirection: c === "horizontal" ? "row" : "column",
772
- flexWrap: "nowrap",
773
- flex: "0 0 auto"
774
- };
775
- D != null && (u.gap = D), P != null && (u.rowGap = P), V != null && (u.columnGap = V), 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");
776
- const G = [
777
- "fibo-scrollview",
778
- ...this.getClassName().split(" ").filter(Boolean),
779
- s
780
- ], Z = Mt({
781
- ...Y,
782
- ...o && typeof o == "object" ? o : {}
783
- }), x = {
784
- WebkitOverflowScrolling: "touch",
785
- minWidth: "0px",
786
- minHeight: "0px",
787
- display: "flex",
788
- flexDirection: c === "horizontal" ? "row" : "column",
789
- ...Z,
790
- // Direction overflow must survive `.props({ style })` replacing the object.
791
- overflowX: q,
792
- overflowY: F
793
- };
794
- if (y === "hidden" && (G.push("scrollbar-hide"), x.scrollbarWidth = "none", x.msOverflowStyle = "none"), this._anchor) {
795
- x.scrollSnapAlign = this._anchor;
796
- const A = x.scrollSnapType ?? x["scroll-snap-type"];
797
- (A == null || A === "") && (x.scrollSnapType = Wt(c));
798
- }
799
- const U = Vt(
800
- (A) => {
801
- b == null || b.attach(A);
802
- },
803
- r
804
- ), K = this._refresh, J = K ? [
805
- d.createElement(
806
- "button",
807
- { type: "button", onClick: () => K() },
808
- "Refresh"
809
- ),
810
- ...t
811
- ] : t, Q = d.createElement(
812
- "div",
813
- { className: "fibo-scroll-inner", style: u },
814
- ...J
815
- );
816
- return d.createElement(
817
- "div",
818
- {
819
- ...m,
820
- ...this._anchor ? { "data-scroll-anchor": this._anchor } : {},
821
- className: G.filter(Boolean).join(" "),
822
- style: x,
823
- ref: U,
824
- onScroll: p
825
- },
826
- Q
827
- );
828
- }
829
- }
830
- const ii = v(Xt);
831
- export {
832
- Zt as C,
833
- Jt as H,
834
- ti as L,
835
- ii as S,
836
- Qt as Z,
837
- Ut as a,
838
- Ht as b
839
- };