fiboui 2.0.0 → 2.2.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.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # FiboUI v2.0.0
1
+ # FiboUI v2.2.0
2
2
 
3
3
  **A Flutter & SwiftUI-inspired React UI framework featuring a fluent builder API and fine-grained reactivity.**
4
4
 
5
- FiboUI brings chainable builders to React. Compose screens with `Column()`, `Row()`, `Button()`, and `signal()` — builders passed to `.children()` are finalized automatically.
5
+ FiboUI brings chainable builders to React. Compose screens with `Column()`, `Row()`, `Button()`, and `signal()`. Builders **are** React elements — return them from functions and skip `.build()`. Prefer the fluent API (no JSX tags).
6
6
 
7
7
  ---
8
8
 
@@ -13,6 +13,8 @@ FiboUI brings chainable builders to React. Compose screens with `Column()`, `Row
13
13
  - **Fine-grained reactivity** — `signal()`, `computed()`, `createStore()`, `.bindSignal()`, `.observer()`.
14
14
  - **Multi-theme** — Material, Cupertino, and Web tokens with CSS variables.
15
15
  - **Type-safe** — TypeScript builders; `FiboChild` / `FiboChildren` describe child slots.
16
+ - **Media queries** — `Box().padding(8).md({ padding: 16 }).lg({ padding: 24 })` compiles to CSS `@media`. `.responsive({ mobile, tablet, desktop })` still works (JS).
17
+ - **CSS motion & scroll** — `Box().animate('fadeIn').ease('spring')`, `.onScroll('fadeIn')`, `.stagger(80)`, `.scrollProgress()`, `Presence(open).enter('fadeIn').exit('fadeOut')`. Default path is CSS (no rAF). See `docs/guide/animation.md`.
16
18
 
17
19
  ---
18
20
 
@@ -49,26 +51,29 @@ Do not run `npm publish` locally. The `Publish` workflow runs on GitHub Release
49
51
  ```tsx
50
52
  import { Card, Text } from 'fiboui';
51
53
 
52
- Card()
53
- .className('p-8')
54
- .style({ backgroundColor: '#111' })
55
- .children([Text('Hello')])
56
- .build();
54
+ function Hello() {
55
+ return Card()
56
+ .className('p-8')
57
+ .style({ backgroundColor: '#111' })
58
+ .children([Text('Hello')]);
59
+ }
57
60
  ```
58
61
 
59
- ### Implicit construction
62
+ ### No `.build()`
63
+
64
+ Builders are valid React elements (`isValidElement(Button('Go'))`). Return them from functions, nest them in `.children()`, or pass them as `React.createElement` arguments. `.build()` still exists and is deprecated.
60
65
 
61
- Builders in `.children()` do not need `.build()`. The event API on `Button` is **`.onPress`** (not `onClick`). `FiboBuilder.onClick` still exists for raw DOM handlers on any builder.
66
+ The event API on `Button` is **`.onPress`** (not `onClick`). `FiboBuilder.onClick` still exists for raw DOM handlers on any builder.
62
67
 
63
68
  ```tsx
64
69
  import { Button, Column, Text } from 'fiboui';
65
70
 
66
- Column()
67
- .children([
71
+ function App() {
72
+ return Column().children([
68
73
  Text('Title').variant('h1'),
69
74
  Button('Action').onPress(() => undefined),
70
- ])
71
- .build();
75
+ ]);
76
+ }
72
77
  ```
73
78
 
74
79
  ---
@@ -77,7 +82,7 @@ Column()
77
82
 
78
83
  ### Signals
79
84
 
80
- `.bindSignal(sig)` subscribes the builder and **re-runs `build()`** when the signal changes. Read the signal inside a **function child** (or `Text(() => ...)`) so the new value is picked up. Interpolating `sig.value` into a string at construction time is a one-shot snapshot.
85
+ `.bindSignal(sig)` subscribes the builder and **re-assembles** when the signal changes. Read the signal inside a **function child** (or `Text(() => ...)`) so the new value is picked up. Interpolating `sig.value` into a string at construction time is a one-shot snapshot.
81
86
 
82
87
  ```tsx
83
88
  import { Box, Button, Text, signal } from 'fiboui';
@@ -91,8 +96,7 @@ Box()
91
96
  Button('+').onPress(() => {
92
97
  count.value += 1;
93
98
  }),
94
- ])
95
- .build();
99
+ ]);
96
100
  ```
97
101
 
98
102
  `useSignal(count)` and `.observer()` with a function child also work. Signal subscriptions unsubscribe on unmount and are Safe for React 18/19 StrictMode (`useSyncExternalStore`). Signals are in-memory and client-only — do not rely on them during SSR.
@@ -110,8 +114,7 @@ const store = createStore({ theme: 'dark', user: 'John' });
110
114
 
111
115
  Box()
112
116
  .observer()
113
- .children(() => Text(store.getState().user))
114
- .build();
117
+ .children(() => Text(store.getState().user));
115
118
  ```
116
119
 
117
120
  ---
@@ -149,8 +152,7 @@ Scaffold()
149
152
  .sideBarLeft(
150
153
  Sidebar().width(240).children([Text('Home'), Text('Settings')])
151
154
  )
152
- .children([Text('Welcome to the main content area.')])
153
- .build();
155
+ .children([Text('Welcome to the main content area.')]);
154
156
  ```
155
157
 
156
158
  ---
@@ -206,8 +208,7 @@ export function ShopHeader() {
206
208
  ])
207
209
  )
208
210
  ),
209
- ])
210
- .build();
211
+ ]);
211
212
  }
212
213
  ```
213
214
 
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import s, { useRef as l, useEffect as p } from "react";
3
- import { i as x, r as m, E } from "./builder-DjLYXkXu.js";
3
+ import { w as x, r as m, E } from "./builder-KLTu7nAI.js";
4
4
  function R({
5
5
  compute: e,
6
6
  as: n = "span",
7
- className: i,
8
- style: o,
7
+ className: o,
8
+ style: i,
9
9
  ...u
10
10
  }) {
11
11
  const r = x(), t = l(null), a = e();
@@ -15,7 +15,7 @@ function R({
15
15
  t.current && t.current.textContent !== c && (t.current.textContent = c);
16
16
  });
17
17
  return () => f.dispose();
18
- }), [e, r]), s.createElement(n, { ref: t, className: i, style: o, ...u }, a);
18
+ }), [e, r]), s.createElement(n, { ref: t, className: o, style: i, ...u }, a);
19
19
  }
20
20
  function d(e, n) {
21
21
  return s.createElement(R, {