fiboui 2.9.4 → 2.9.6

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,49 +1,49 @@
1
1
  var w = Object.defineProperty;
2
2
  var S = (s, e, t) => e in s ? w(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var n = (s, e, t) => S(s, typeof e != "symbol" ? e + "" : e, t);
3
+ var r = (s, e, t) => S(s, typeof e != "symbol" ? e + "" : e, t);
4
4
  import m from "react";
5
- import { b2 as g, b3 as d, ba as N, bb as C, b7 as j, b6 as _, b9 as z } from "./client-lzMYg4vy.js";
6
- function B(s, e) {
5
+ import { b2 as g, b3 as d, ba as N, bb as C, bc as j, b7 as z, b6 as _, b9 as B } from "./client-DspTEDnT.js";
6
+ function I(s, e) {
7
7
  if (!(typeof e != "string" || !_(e)))
8
- for (const t of z(e))
8
+ for (const t of B(e))
9
9
  s.bindSignal(t);
10
10
  }
11
- function l(s, e) {
11
+ function h(s, e) {
12
12
  if (typeof e == "function") {
13
13
  try {
14
- l(s, e());
14
+ h(s, e());
15
15
  } catch {
16
16
  }
17
17
  return;
18
18
  }
19
19
  if (typeof e == "string") {
20
- B(s, e);
20
+ I(s, e);
21
21
  return;
22
22
  }
23
23
  if (Array.isArray(e))
24
- for (const t of e) l(s, t);
24
+ for (const t of e) h(s, t);
25
25
  }
26
- function I(s) {
27
- return typeof s == "string" && _(s) ? j(s) : s;
26
+ function E(s) {
27
+ return typeof s == "string" && _(s) ? z(s) : s;
28
28
  }
29
29
  function M(s, e) {
30
- const { children: t, ...r } = e, o = t !== void 0 ? t : s;
31
- return { nodes: o == null ? [] : Array.isArray(o) ? o : [o], rest: r };
30
+ const { children: t, ...n } = e, o = t !== void 0 ? t : s;
31
+ return { nodes: o == null ? [] : Array.isArray(o) ? o : [o], rest: n };
32
32
  }
33
33
  class $ extends d {
34
34
  constructor() {
35
35
  super(...arguments);
36
- n(this, "_mainAxisAlignment", "start");
36
+ r(this, "_mainAxisAlignment", "start");
37
37
  // Flutter Column / SwiftUI VStack default: center. Stretch is opt-in.
38
- n(this, "_crossAxisAlignment", "center");
39
- n(this, "_spacing");
40
- n(this, "_size");
38
+ r(this, "_crossAxisAlignment", "center");
39
+ r(this, "_spacing");
40
+ r(this, "_size");
41
41
  }
42
42
  children(t) {
43
- return l(this, t), super.children(t);
43
+ return h(this, t), super.children(t);
44
44
  }
45
45
  props(t) {
46
- return t && "children" in t && l(this, t.children), super.props(t);
46
+ return t && "children" in t && h(this, t.children), super.props(t);
47
47
  }
48
48
  mainAxisAlignment(t) {
49
49
  return this._mainAxisAlignment = t, this;
@@ -65,6 +65,13 @@ class $ extends d {
65
65
  size(t) {
66
66
  return this._size = t, this;
67
67
  }
68
+ /**
69
+ * Sugar for `.children(ForEach(data).renderItem(fn))`.
70
+ * Prefer `ForEach` when you need `.keyBy()`.
71
+ */
72
+ forEach(t, n) {
73
+ return this.children(j(t).renderItem(n));
74
+ }
68
75
  build() {
69
76
  const t = {
70
77
  start: "justify-start",
@@ -73,7 +80,7 @@ class $ extends d {
73
80
  spaceBetween: "justify-between",
74
81
  spaceAround: "justify-around",
75
82
  spaceEvenly: "justify-evenly"
76
- }, r = {
83
+ }, n = {
77
84
  start: "items-start",
78
85
  center: "items-center",
79
86
  end: "items-end",
@@ -89,11 +96,11 @@ class $ extends d {
89
96
  // min-w-0 / min-h-0: shrink inside flex/grid so nested overflow can scroll
90
97
  this.isHug() ? "w-auto self-auto" : "w-full min-w-0 min-h-0",
91
98
  t[this._mainAxisAlignment],
92
- r[this._crossAxisAlignment],
99
+ n[this._crossAxisAlignment],
93
100
  this._size ? o[this._size] : "",
94
101
  ...this._classNames
95
- ], h = this.getStyle(), { nodes: c, rest: p } = M(this.processChildren(), this._props), { className: x, style: u, ...y } = p, A = [...i, x].filter(Boolean).join(" "), b = c.map(I), a = {
96
- ...h,
102
+ ], l = this.getStyle(), { nodes: c, rest: p } = M(this.processChildren(), this._props), { className: x, style: u, ...y } = p, A = [...i, x].filter(Boolean).join(" "), b = c.map(E), a = {
103
+ ...l,
97
104
  ...u && typeof u == "object" ? u : {}
98
105
  };
99
106
  return this._spacing != null && this._spacing !== "" && (typeof this._spacing == "number" ? a.gap = `${this._spacing}px` : isNaN(Number(this._spacing)) ? a.gap = this._spacing : a.gap = `${Number(this._spacing) * 4}px`), m.createElement(
@@ -107,20 +114,20 @@ class $ extends d {
107
114
  );
108
115
  }
109
116
  }
110
- const R = g($);
117
+ const T = g($);
111
118
  function f(s) {
112
119
  return typeof s == "number" ? `${s}px` : s;
113
120
  }
114
- function E(s) {
121
+ function F(s) {
115
122
  return s && typeof s == "object" && !Array.isArray(s) ? s : {};
116
123
  }
117
124
  class H extends d {
118
125
  constructor() {
119
126
  super(...arguments);
120
- n(this, "_height");
121
- n(this, "_width");
122
- n(this, "_grow");
123
- n(this, "_expand");
127
+ r(this, "_height");
128
+ r(this, "_width");
129
+ r(this, "_grow");
130
+ r(this, "_expand");
124
131
  }
125
132
  height(t) {
126
133
  return this._height = t, this;
@@ -136,11 +143,11 @@ class H extends d {
136
143
  }
137
144
  /** Grow factor inside a Row or Column. Does not turn the spacer into a flex container. */
138
145
  flex(t = 1) {
139
- const r = typeof t == "number" ? t : Number(t);
140
- return this._grow = Number.isFinite(r) ? r : 1, this._expand = !0, this;
146
+ const n = typeof t == "number" ? t : Number(t);
147
+ return this._grow = Number.isFinite(n) ? n : 1, this._expand = !0, this;
141
148
  }
142
149
  build() {
143
- const { className: t, style: r, ...o } = this._props, i = { ...this.getStyle(), ...E(r) }, h = this._height != null || this._width != null, c = this._expand ?? !h;
150
+ const { className: t, style: n, ...o } = this._props, i = { ...this.getStyle(), ...F(n) }, l = this._height != null || this._width != null, c = this._expand ?? !l;
144
151
  this._height != null && (i.height = f(this._height)), this._width != null && (i.width = f(this._width)), c ? (i.flex = `${this._grow ?? 1} 1 0%`, i.alignSelf = i.alignSelf ?? "stretch", i.minWidth = i.minWidth ?? 0, i.minHeight = i.minHeight ?? 0) : i.flex = "0 0 auto";
145
152
  const p = ["fibo-spacer", this.getClassName(), t].filter(Boolean).join(" ");
146
153
  return m.createElement("div", {
@@ -151,8 +158,8 @@ class H extends d {
151
158
  });
152
159
  }
153
160
  }
154
- const T = g(H);
161
+ const X = g(H);
155
162
  export {
156
- R as C,
157
- T as S
163
+ T as C,
164
+ X as S
158
165
  };
package/dist/index.d.ts CHANGED
@@ -1470,6 +1470,7 @@ export type FrameSize = number | string | Size;
1470
1470
  * ```ts
1471
1471
  * .frame({ width: 300, height: 400 })
1472
1472
  * .frame({ maxWidth: Size.infinity, maxHeight: Size.infinity, alignment: StackAlign.topTrailing })
1473
+ * .frame({ maxWidth: Size.infinity, fill: true }) // child stretches — bg/border fill the slot
1473
1474
  * ```
1474
1475
  */
1475
1476
  export interface FrameSpec {
@@ -1482,6 +1483,12 @@ export interface FrameSpec {
1482
1483
  idealHeight?: FrameSize;
1483
1484
  maxHeight?: FrameSize;
1484
1485
  alignment?: StackAlign | keyof typeof StackAlign;
1486
+ /**
1487
+ * Stretch the direct child to the frame slot (`width/height: 100%`).
1488
+ * Default `false` — SwiftUI-like hug + `alignment`.
1489
+ * Use when paint (`.bg`, border) lives on the child and should fill the frame.
1490
+ */
1491
+ fill?: boolean;
1485
1492
  }
1486
1493
  /** Resolve a frame size to a CSS length. `Size.infinity` → fill parent (`100%`). */
1487
1494
  export declare function resolveFrameSize(value: FrameSize | undefined, role: "min" | "ideal" | "max" | "fixed", axis?: "width" | "height"): string | undefined;
@@ -1726,6 +1733,34 @@ export declare function applyEdgeSet(set: EdgeSet, value: number | string): {
1726
1733
  bottom?: number | string;
1727
1734
  left?: number | string;
1728
1735
  };
1736
+ /**
1737
+ * SwiftUI `Material` — glass fills for `.material(Material.ultraThin)`.
1738
+ * Light translucent defaults; pair with `.theme('noir')` / dark bg as needed.
1739
+ */
1740
+ export declare const Material: {
1741
+ readonly ultraThin: {
1742
+ readonly blur: 20;
1743
+ readonly background: "rgba(255, 255, 255, 0.35)";
1744
+ };
1745
+ readonly thin: {
1746
+ readonly blur: 28;
1747
+ readonly background: "rgba(255, 255, 255, 0.48)";
1748
+ };
1749
+ readonly regular: {
1750
+ readonly blur: 36;
1751
+ readonly background: "rgba(255, 255, 255, 0.62)";
1752
+ };
1753
+ readonly thick: {
1754
+ readonly blur: 48;
1755
+ readonly background: "rgba(255, 255, 255, 0.78)";
1756
+ };
1757
+ readonly ultraThick: {
1758
+ readonly blur: 60;
1759
+ readonly background: "rgba(255, 255, 255, 0.88)";
1760
+ };
1761
+ };
1762
+ export type MaterialKind = keyof typeof Material;
1763
+ export type MaterialSpec = (typeof Material)[MaterialKind];
1729
1764
  export type SafeAreaInsetEdge = Edge | "top" | "bottom" | "leading" | "trailing" | "left" | "right";
1730
1765
  export type SafeAreaInsetSpec = {
1731
1766
  edge: SafeAreaInsetEdge;
@@ -2028,9 +2063,12 @@ declare abstract class FiboBuilder {
2028
2063
  * maxHeight: Size.infinity,
2029
2064
  * alignment: StackAlign.topTrailing,
2030
2065
  * })
2066
+ * // Child fills the slot (bg/border on the child cover the frame):
2067
+ * Box().bg('red').frame({ maxWidth: Size.infinity, fill: true })
2031
2068
  * ```
2032
2069
  *
2033
2070
  * Chainable: each `.frame()` wraps the previous (same as SwiftUI).
2071
+ * Default: child hugs + `alignment`. Pass `fill: true` to stretch the child.
2034
2072
  */
2035
2073
  frame(spec: FrameSpec): this;
2036
2074
  /**
@@ -2239,6 +2277,16 @@ declare abstract class FiboBuilder {
2239
2277
  text(color: string | Colors): this;
2240
2278
  color(value: string | Colors): this;
2241
2279
  private resolveSemanticColor;
2280
+ /**
2281
+ * Backdrop blur (glass). Prefer over raw `.backdropFilter('blur(…)')`.
2282
+ * `20` → `blur(20px)`; also accepts `'20px'` or a full `blur(…)` string.
2283
+ */
2284
+ backdropBlur(radius?: number | string): this;
2285
+ /**
2286
+ * SwiftUI `Material` glass fill — blur + translucent background.
2287
+ * `Box().material(Material.ultraThin)` or `.material('regular')`.
2288
+ */
2289
+ material(kind: MaterialKind | MaterialSpec): this;
2242
2290
  shadow(config?: ShadowConfig): this;
2243
2291
  /**
2244
2292
  * Breakpoint styles compiled to CSS `@media` (same engine as `.md()`).
@@ -3055,6 +3103,11 @@ declare class ColumnBuilder extends FiboBuilder {
3055
3103
  alignY(alignment: AlignAxis): this;
3056
3104
  spacing(value: string | number): this;
3057
3105
  size(size: "small" | "medium" | "large"): this;
3106
+ /**
3107
+ * Sugar for `.children(ForEach(data).renderItem(fn))`.
3108
+ * Prefer `ForEach` when you need `.keyBy()`.
3109
+ */
3110
+ forEach<T>(items: T[] | readonly T[], renderItem: (item: T, index: number) => unknown): this;
3058
3111
  build(): React$1.ReactElement;
3059
3112
  }
3060
3113
  export declare const Column: () => StyleBuilder<ColumnBuilder>;
@@ -3087,6 +3140,11 @@ declare class RowBuilder extends FiboBuilder {
3087
3140
  alignY(alignment: AlignAxis): this;
3088
3141
  spacing(value: string | number): this;
3089
3142
  items(children: React$1.ReactElement[]): this;
3143
+ /**
3144
+ * Sugar for `.children(ForEach(data).renderItem(fn))`.
3145
+ * Prefer `ForEach` when you need `.keyBy()`.
3146
+ */
3147
+ forEach<T>(items: T[] | readonly T[], renderItem: (item: T, index: number) => unknown): this;
3090
3148
  build(): React$1.ReactElement;
3091
3149
  }
3092
3150
  export declare const Row: () => StyleBuilder<RowBuilder>;
@@ -3268,8 +3326,14 @@ export declare const ToolbarItem: () => StyleBuilder<ToolbarItemBuilder>;
3268
3326
  export declare const AppBar: () => StyleBuilder<AppBarBuilder>;
3269
3327
  declare class BottomAppBarBuilder extends FiboBuilder {
3270
3328
  private _items;
3329
+ private _floating;
3271
3330
  /** Same contract as `AppBar().items` — zone via `ToolbarItem` place. */
3272
3331
  items(children: FiboChildren): this;
3332
+ /**
3333
+ * iOS-style floating capsule — inset from edges, rounded, shadow.
3334
+ * Pair with `.resetStyle().material(Material.ultraThin)` for glass.
3335
+ */
3336
+ floating(value?: boolean): this;
3273
3337
  build(): React$1.ReactElement;
3274
3338
  }
3275
3339
  export declare const BottomAppBar: () => StyleBuilder<BottomAppBarBuilder>;
@@ -5158,6 +5222,29 @@ declare class ListBuilder<T = any> extends FiboBuilder {
5158
5222
  build(): React$1.ReactElement;
5159
5223
  }
5160
5224
  export declare const List: <T = any>() => StyleBuilder<ListBuilder<T>>;
5225
+ export type ForEachSource<T> = readonly T[] | T[] | (() => readonly T[] | T[]) | BindableSignal<readonly T[] | T[]>;
5226
+ declare class ForEachBuilder<T = unknown> extends FiboBuilder {
5227
+ private _source?;
5228
+ private _renderItem?;
5229
+ private _keyBy?;
5230
+ constructor(source?: ForEachSource<T>, renderItem?: (item: T, index: number) => unknown);
5231
+ /** Data: array, `() => array`, or bindable / `listSignal` (read `.value` at build). */
5232
+ items(source: ForEachSource<T>): this;
5233
+ /** Factory per item — same idea as `List.renderItem`. */
5234
+ renderItem(fn: (item: T, index: number) => unknown): this;
5235
+ /**
5236
+ * Stable React key per item.
5237
+ * Defaults to `id` / `_id` / `key` on objects, else index.
5238
+ * (Not `.id()` — that sets the host HTML id on `FiboBuilder`.)
5239
+ */
5240
+ keyBy(fn: (item: T, index: number) => string | number): this;
5241
+ build(): React$1.ReactElement;
5242
+ }
5243
+ export declare const ForEach: <T = unknown>(source?: ForEachSource<T> | undefined, renderItem?: ((item: T, index: number) => unknown) | undefined) => StyleBuilder<ForEachBuilder<T>>;
5244
+ declare class GroupBuilder extends FiboBuilder {
5245
+ build(): React$1.ReactElement;
5246
+ }
5247
+ export declare const Group: () => StyleBuilder<GroupBuilder>;
5161
5248
  declare class SectionBuilder extends FiboBuilder {
5162
5249
  private _header?;
5163
5250
  private _footer?;
@@ -6071,6 +6158,8 @@ export {
6071
6158
  Store as ReactiveStore,
6072
6159
  Store$1 as Store,
6073
6160
  Text$1 as Text,
6161
+ VirtualColumn as LazyVStack,
6162
+ VirtualRow as LazyHStack,
6074
6163
  open$1 as open,
6075
6164
  scrollTo$1 as scrollTo,
6076
6165
  };