fiboui 2.4.2 → 2.4.4

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,220 +1,177 @@
1
- # FiboUI v2.4.2
1
+ <div align="center">
2
2
 
3
- **A Flutter & SwiftUI-inspired React UI framework featuring a fluent builder API and fine-grained reactivity.**
3
+ ```
4
+ ███████╗██╗██████╗ ██████╗ ██╗ ██╗██╗
5
+ ██╔════╝██║██╔══██╗██╔═══██╗██║ ██║██║
6
+ █████╗ ██║██████╔╝██║ ██║██║ ██║██║
7
+ ██╔══╝ ██║██╔══██╗██║ ██║██║ ██║██║
8
+ ██║ ██║██████╔╝╚██████╔╝╚██████╔╝██║
9
+ ╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═════╝ ╚═╝
10
+ ```
4
11
 
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).
12
+ # FiboUI
6
13
 
7
- ---
14
+ **Fluent React UI.** Flutter & SwiftUI energy — chainable builders, signals, themes.
8
15
 
9
- ## Features
16
+ Builders **are** React elements. Return them from functions. Skip `.build()`. Prefer the fluent API — no JSX tags.
10
17
 
11
- - **Assembly pattern** — factories return builders for endless chaining.
12
- - **Zero-build children** — pass builders to `.children()`; they build implicitly. Typed methods (`.onPress`, `.id`, `.spacing`, `.children`) stay assignable as children.
13
- - **Fine-grained reactivity** — `signal()`, `computed()`, `createStore()`, `.bindSignal()`, `.observer()`.
14
- - **Fluent themes** — `.theme("noir" \| "web" \| …)` / `extendTheme` / `FiboThemeProvider` — CSS vars SSR-safe (Flutter / SwiftUI model). Presets: Material, Cupertino, Web, **Noir**.
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`.
18
- - **Interaction effects** — full Hover.css–inspired catalog (2D, background sweeps, borders, shadows, bubbles, curls) as fiboui-owned CSS. Any trigger: `.hover(h => h.effect("sweepToRight"))`, `.pressEffect("shrink")`, `.hoverEffect("float")`.
18
+ <br />
19
19
 
20
- ---
20
+ [![npm](https://img.shields.io/npm/v/fiboui?style=flat-square&color=ff2d8a)](https://www.npmjs.com/package/fiboui)
21
+ [![license](https://img.shields.io/npm/l/fiboui?style=flat-square)](./LICENSE)
22
+ [![site](https://img.shields.io/badge/site-fiboui.vercel.app-0a0a0a?style=flat-square)](https://fiboui.vercel.app)
23
+ [![store](https://img.shields.io/badge/demo-fiboui--store-c8ff00?style=flat-square&labelColor=0a0a0a)](https://fiboui-store.vercel.app)
21
24
 
22
- ## Installation
25
+ **Live**
26
+ [`fiboui.vercel.app`](https://fiboui.vercel.app)
27
+ ·
28
+ **Store demo**
29
+ [`fiboui-store.vercel.app`](https://fiboui-store.vercel.app)
30
+ ·
31
+ **npm**
32
+ [`fiboui`](https://www.npmjs.com/package/fiboui)
23
33
 
24
34
  ```bash
25
35
  npm install fiboui
26
36
  ```
27
37
 
28
- Import the stylesheet once in your entry file:
38
+ </div>
29
39
 
30
- ```tsx
31
- import 'fiboui/style.css';
32
- ```
33
-
34
- **Required.** The JS entry does not load CSS. ESM-only (`import`, no `require`). See [MIGRATION.md](./MIGRATION.md) if you used 1.x snapshots.
35
-
36
- Peer dependencies: React 18 or 19.
37
-
38
- Next.js App Router: files that **call** builders (`Button()`, `Column()`, …) must be Client Components (`'use client'`). FiboUI uses hooks and context; it is not an RSC factory API. Import `'fiboui/style.css'` from a layout or the client entry.
39
-
40
- ## Releasing
40
+ ---
41
41
 
42
- Publishing is automated. The owner must add an **`NPM_TOKEN`** automation secret in the GitHub repo settings. Release branch is **`main`**. See [CONTRIBUTING.md](./CONTRIBUTING.md).
42
+ ## Why FiboUI
43
43
 
44
- Do not run `npm publish` locally. The `Publish` workflow runs on GitHub Release and on push to `main`: install, typecheck, test, build, then `npm publish --provenance --access public` only if that version is not already on npm. After a successful `main` publish it opens GitHub Release `vX.Y.Z` with the matching CHANGELOG section as notes.
44
+ | | |
45
+ | :--- | :--- |
46
+ | **Assembly pattern** | Factories return builders for endless chaining |
47
+ | **Zero-build children** | Pass builders to `.children()` — they finalize implicitly |
48
+ | **Signals** | `signal()`, `computed()`, `.bindSignal()`, `.observer()` |
49
+ | **Themes** | `.theme("noir")` · `extendTheme` · Material / Cupertino / Web / Noir |
50
+ | **Motion** | `.animate('fadeIn')` · `.onScroll` · `.hoverEffect` · CSS-first |
51
+ | **Type-safe** | TypeScript builders · `FiboChild` / `FiboChildren` |
45
52
 
46
53
  ---
47
54
 
48
- ## The assembly pattern
49
-
50
- ### Components as builders
55
+ ## Quick start
51
56
 
52
57
  ```tsx
53
- import { Card, Text } from 'fiboui';
58
+ import 'fiboui/style.css'
59
+ import { Button, Column, Text, mount } from 'fiboui'
54
60
 
55
- function Hello() {
56
- return Card()
57
- .className('p-8')
58
- .style({ backgroundColor: '#111' })
59
- .children([Text('Hello')]);
61
+ function App() {
62
+ return Column()
63
+ .gap(12)
64
+ .padding(24)
65
+ .children([
66
+ Text('Hello FiboUI').variant('h1'),
67
+ Button('Ship it').onPress(() => undefined),
68
+ ])
60
69
  }
70
+
71
+ mount('#root', App)
61
72
  ```
62
73
 
63
- ### No `.build()`
74
+ **Required:** import `'fiboui/style.css'` once — the JS entry does not load CSS.
75
+ ESM-only (`import`, no `require`). Peer deps: **React 18 or 19**.
64
76
 
65
- 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.
77
+ Next.js App Router: files that **call** builders must be Client Components (`'use client'`).
66
78
 
67
- The event API on `Button` is **`.onPress`** (not `onClick`). `FiboBuilder.onClick` still exists for raw DOM handlers on any builder.
79
+ ---
80
+
81
+ ## Taste of the API
82
+
83
+ ### Builders (no `.build()`)
68
84
 
69
85
  ```tsx
70
- import { Button, Column, Text } from 'fiboui';
86
+ import { Card, Text } from 'fiboui'
71
87
 
72
- function App() {
73
- return Column().children([
74
- Text('Title').variant('h1'),
75
- Button('Action').onPress(() => undefined),
76
- ]);
88
+ function Hello() {
89
+ return Card()
90
+ .padding(32)
91
+ .bg('#111')
92
+ .children([Text('Hello').variant('h2')])
77
93
  }
78
94
  ```
79
95
 
80
- ---
81
-
82
- ## Reactivity & state
96
+ `Button` uses **`.onPress`** (not `onClick`).
83
97
 
84
98
  ### Signals
85
99
 
86
- `.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.
100
+ `.bindSignal(sig)` re-assembles when the signal changes. Read values inside a **function child**:
87
101
 
88
102
  ```tsx
89
- import { Box, Button, Text, signal } from 'fiboui';
103
+ import { Box, Button, Text, signal } from 'fiboui'
90
104
 
91
- const count = signal(0);
105
+ const count = signal(0)
92
106
 
93
107
  Box()
94
108
  .bindSignal(count)
95
109
  .children(() => [
96
110
  Text(`Count: ${count.value}`),
97
111
  Button('+').onPress(() => {
98
- count.value += 1;
112
+ count.value += 1
99
113
  }),
100
- ]);
114
+ ])
101
115
  ```
102
116
 
103
- `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.
104
-
105
- `computed(() => ...)` is lazy: the first `.value` read attaches the internal effect. Read it (or `.bindSignal`) so updates notify.
106
-
107
- Two store APIs exist: `createStore()` + `useReactiveStore(store)`, and the `@Store()` decorator + `useStore(StoreClass)` (the package-root `useStore`). Builder `.state(key, initial)` is runtime-updatable via `useBuilderState(key)`.
108
-
109
- ### Global store
117
+ ### Themes & motion
110
118
 
111
119
  ```tsx
112
- import { Box, Text, createStore } from 'fiboui';
120
+ Box()
121
+ .theme('noir')
122
+ .animate('fadeIn')
123
+ .ease('spring')
124
+ .hover((h) => h.effect('sweepToRight'))
125
+ ```
113
126
 
114
- const store = createStore({ theme: 'dark', user: 'John' });
127
+ Responsive:
115
128
 
116
- Box()
117
- .observer()
118
- .children(() => Text(store.getState().user));
129
+ ```tsx
130
+ Box().padding(8).md({ padding: 16 }).lg({ padding: 24 })
119
131
  ```
120
132
 
121
133
  ---
122
134
 
123
135
  ## Layout notes
124
136
 
125
- ### Column + Row (`spaceBetween`)
126
-
127
- Flutter `Column` defaults to `CrossAxisAlignment.center`. SwiftUI `VStack` defaults to `.center`. FiboUI **2.0 matches that: `crossAxisAlignment('center')`.**
128
-
129
- **Row uses `align-self: stretch`** so `spaceBetween` still fills the Column width under a centered cross axis.
130
-
131
- To stretch every child (Flutter `CrossAxisAlignment.stretch`):
137
+ FiboUI **2.x** matches Flutter / SwiftUI: `Column` defaults to `crossAxisAlignment('center')`.
138
+ `Row` uses `align-self: stretch` so `spaceBetween` still fills width.
132
139
 
133
140
  ```tsx
134
- Column().crossAxisAlignment('stretch');
141
+ Column().crossAxisAlignment('stretch')
135
142
  ```
136
143
 
144
+ `Scaffold` uses `headerBar`, `footerBar`, `sideBarLeft`, `sideBarRight`.
145
+
137
146
  ---
138
147
 
139
- ## Scaffold & layout shells
148
+ ## Live demos
140
149
 
141
- `Scaffold` uses `headerBar`, `footerBar`, `sideBarLeft`, and `sideBarRight`. `DashboardLayout` uses `header` and `sidebar`.
150
+ | | |
151
+ | :--- | :--- |
152
+ | **[fiboui.vercel.app](https://fiboui.vercel.app)** | Marketing site — builders, signals, theme, motion, media |
153
+ | **[fiboui-store.vercel.app](https://fiboui-store.vercel.app)** | Full retail demo — catalog → bag → checkout |
142
154
 
143
- ```tsx
144
- import { Header, Scaffold, Sidebar, Text } from 'fiboui';
145
-
146
- Scaffold()
147
- .headerBar(
148
- Header()
149
- .height(80)
150
- .className('px-6 bg-white shadow-sm')
151
- .children([Text('App Title').variant('h2')])
152
- )
153
- .sideBarLeft(
154
- Sidebar().width(240).children([Text('Home'), Text('Settings')])
155
- )
156
- .children([Text('Welcome to the main content area.')]);
157
- ```
155
+ Both are built **only** with FiboUI fluent builders.
158
156
 
159
157
  ---
160
158
 
161
- ## Example: reactive product grid
159
+ ## Docs & contributing
162
160
 
163
- ```tsx
164
- import {
165
- Badge,
166
- Box,
167
- Button,
168
- Card,
169
- Grid,
170
- Row,
171
- Text,
172
- computed,
173
- createStore,
174
- } from 'fiboui';
175
-
176
- const appStore = createStore({
177
- cart: [] as { id: string; name: string; price: number; quantity: number }[],
178
- products: [
179
- { id: '1', name: 'MacBook Pro', price: 2499 },
180
- { id: '2', name: 'iPhone 15', price: 999 },
181
- ],
182
- });
183
-
184
- const cartTotal = computed(() => {
185
- const cart = appStore.getState().cart;
186
- return cart.reduce((sum, item) => sum + item.price * item.quantity, 0);
187
- });
188
-
189
- export function ShopHeader() {
190
- return Box()
191
- .observer()
192
- .children(() => [
193
- Row().children([
194
- Text(`Total: $${cartTotal.value.toFixed(2)}`).bindSignal(cartTotal),
195
- Badge().text(String(appStore.getState().cart.length)),
196
- ]),
197
- Grid()
198
- .columns(2)
199
- .gap('md')
200
- .children(
201
- appStore.getState().products.map((product) =>
202
- Card().children([
203
- Text(product.name).weight('bold'),
204
- Button(`Add $${product.price}`).onPress(() => {
205
- appStore.setState((s) => ({
206
- cart: [...s.cart, { ...product, quantity: 1 }],
207
- }));
208
- }),
209
- ])
210
- )
211
- ),
212
- ]);
213
- }
214
- ```
161
+ - Migration from 1.x → [MIGRATION.md](./MIGRATION.md)
162
+ - Contributing & release → [CONTRIBUTING.md](./CONTRIBUTING.md)
163
+ - Animation guide → `docs/guide/animation.md`
164
+
165
+ Publishing is automated on **`main`** (GitHub Actions + `NPM_TOKEN`). Prefer not to `npm publish` locally.
215
166
 
216
167
  ---
217
168
 
218
- ## License
169
+ <div align="center">
170
+
171
+ **Wear the return.**
219
172
 
220
173
  MIT © 2025–2026 FiboUI
174
+
175
+ [Site](https://fiboui.vercel.app) · [Store](https://fiboui-store.vercel.app) · [npm](https://www.npmjs.com/package/fiboui) · [GitHub](https://github.com/felipeoliveiradev/fiboui)
176
+
177
+ </div>
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import s, { useRef as l, useEffect as p } from "react";
3
- import { E as x, r as m, G as E } from "./builder-CCVmfPD1.js";
3
+ import { G as x, r as m, H as E } from "./builder-B5cebEWZ.js";
4
4
  function R({
5
5
  compute: e,
6
6
  as: n = "span",