fiboui 2.8.3 → 2.8.5

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/dist/structure.js CHANGED
@@ -1,18 +1,18 @@
1
- import { au as r, aw as e, av as o } from "./client-8KCOzRhg.js";
2
- import { A as C, B as d, C as i, c as l, d as n, G as T, b as f, L as m, P as p, T as x, a as B } from "./index-Bwb4FNoc.js";
1
+ import { aA as r, aC as e, aB as o } from "./client-BzMPiV64.js";
2
+ import { A as t, B as d, C as i, c as l, d as n, G as B, b as T, L as f, P as m, T as p, a as x } from "./index-B9YuBkEv.js";
3
3
  export {
4
- C as AssetCard,
4
+ t as AssetCard,
5
5
  d as Banner,
6
6
  r as Box,
7
7
  i as Card,
8
8
  e as Collapse,
9
9
  l as CollectionCard,
10
10
  n as ContentCard,
11
- T as Grid,
12
- f as GridItem,
11
+ B as Grid,
12
+ T as GridItem,
13
13
  o as List,
14
- m as ListTile,
15
- p as ProfileCard,
16
- x as Table,
17
- B as Tags
14
+ f as ListTile,
15
+ m as ProfileCard,
16
+ p as Table,
17
+ x as Tags
18
18
  };
package/dist/theme.d.ts CHANGED
@@ -1,2 +1,149 @@
1
- export { FiboThemeProvider, useFiboTheme, materialTheme, cupertinoTheme, webTheme, noirTheme, FIBO_THEMES, resolveTheme, copyWithTheme, extendTheme, themeToCssVars, themeToInlineStyle, themeToCssRule, themeClassName } from './index.js';
2
- export type { FiboThemeProviderProps, FiboThemePreset, ThemeInput, FiboThemePatch, FiboTheme, ThemeColors, ThemeTypography } from './index.js';
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import { CSSProperties, ReactNode } from 'react';
4
+
5
+ type FiboThemeName = "material" | "cupertino" | "web" | "noir";
6
+ interface TextStyle {
7
+ fontSize?: string | number;
8
+ fontWeight?: string | number;
9
+ fontFamily?: string;
10
+ color?: string;
11
+ lineHeight?: string | number;
12
+ letterSpacing?: string | number;
13
+ }
14
+ export interface ThemeColors {
15
+ primary: string;
16
+ primaryVariant?: string;
17
+ primaryContainer?: string;
18
+ onPrimaryContainer?: string;
19
+ secondary: string;
20
+ secondaryVariant?: string;
21
+ secondaryContainer?: string;
22
+ onSecondaryContainer?: string;
23
+ tertiary?: string;
24
+ onTertiary?: string;
25
+ tertiaryContainer?: string;
26
+ onTertiaryContainer?: string;
27
+ background: string;
28
+ surface: string;
29
+ surfaceVariant?: string;
30
+ onSurfaceVariant?: string;
31
+ error: string;
32
+ errorContainer?: string;
33
+ onErrorContainer?: string;
34
+ success?: string;
35
+ warning?: string;
36
+ info?: string;
37
+ onPrimary: string;
38
+ onSecondary: string;
39
+ onBackground: string;
40
+ onSurface: string;
41
+ onError: string;
42
+ /** Borders / hairlines — maps to `--fibo-outline`. */
43
+ outline?: string;
44
+ outlineVariant?: string;
45
+ /** Maps to `--fibo-surface-container-low` (M3 card surfaces). */
46
+ surfaceContainerLow?: string;
47
+ }
48
+ export interface ThemeTypography {
49
+ h1: TextStyle;
50
+ h2: TextStyle;
51
+ h3: TextStyle;
52
+ h4: TextStyle;
53
+ h5: TextStyle;
54
+ h6: TextStyle;
55
+ body: TextStyle;
56
+ caption: TextStyle;
57
+ label: TextStyle;
58
+ }
59
+ interface ThemeSpacing {
60
+ xs: string;
61
+ sm: string;
62
+ md: string;
63
+ lg: string;
64
+ xl: string;
65
+ }
66
+ interface ThemeBorderRadius {
67
+ /** Maps to `--fibo-radius-xs` when set (CSS sheets already define it). */
68
+ xs?: string;
69
+ sm: string;
70
+ md: string;
71
+ lg: string;
72
+ /** Maps to `--fibo-radius-xl` when set (CSS sheets already define it). */
73
+ xl?: string;
74
+ full: string;
75
+ }
76
+ interface ThemeShadows {
77
+ sm: string;
78
+ md: string;
79
+ lg: string;
80
+ }
81
+ export interface FiboTheme {
82
+ name: FiboThemeName;
83
+ colors: ThemeColors;
84
+ typography: ThemeTypography;
85
+ spacing: ThemeSpacing;
86
+ borderRadius: ThemeBorderRadius;
87
+ shadows: ThemeShadows;
88
+ fontFamily: string;
89
+ }
90
+ /** Built-in presets. `noir` is the dark editorial theme (site / dense apps). */
91
+ export declare const FIBO_THEMES: {
92
+ readonly material: FiboTheme;
93
+ readonly cupertino: FiboTheme;
94
+ readonly web: FiboTheme;
95
+ readonly noir: FiboTheme;
96
+ };
97
+ export type FiboThemePreset = keyof typeof FIBO_THEMES;
98
+ export type ThemeInput = FiboTheme | FiboThemePreset;
99
+ export declare function resolveTheme(input: ThemeInput): FiboTheme;
100
+ export type FiboThemePatch = {
101
+ name?: string;
102
+ colors?: Partial<ThemeColors>;
103
+ typography?: Partial<Record<keyof ThemeTypography, Partial<TextStyle>>>;
104
+ spacing?: Partial<ThemeSpacing>;
105
+ borderRadius?: Partial<ThemeBorderRadius>;
106
+ shadows?: Partial<ThemeShadows>;
107
+ fontFamily?: string;
108
+ };
109
+ /** Flutter-style copyWith / SwiftUI environment override. */
110
+ export declare function copyWithTheme(base: FiboTheme, patch: FiboThemePatch): FiboTheme;
111
+ /** Alias — SwiftUI/Flutter mental model. */
112
+ export declare const extendTheme: typeof copyWithTheme;
113
+ /** Flat CSS custom properties for a theme (inline style or :root block). */
114
+ export declare function themeToCssVars(theme: FiboTheme): Record<string, string>;
115
+ /** Inline style object safe for React (CSSProperties + custom props). */
116
+ export declare function themeToInlineStyle(theme: FiboTheme): CSSProperties;
117
+ /** CSS rule body for `.fibo-theme-{name}` — SSR-safe, no useEffect. */
118
+ export declare function themeToCssRule(theme: FiboTheme): string;
119
+ export declare function themeClassName(theme: FiboTheme): string;
120
+ interface FiboThemeContextValue {
121
+ theme: FiboTheme;
122
+ themeName: string;
123
+ setTheme: (input: ThemeInput) => void;
124
+ }
125
+ export interface FiboThemeProviderProps {
126
+ /** Preset name (`"noir"`) or full `FiboTheme` / `extendTheme(...)`. */
127
+ theme?: ThemeInput;
128
+ children: ReactNode;
129
+ /** Extra class on the theme root. */
130
+ className?: string;
131
+ /** Merge into the theme root style (after theme vars). */
132
+ style?: CSSProperties;
133
+ }
134
+ /**
135
+ * Theme environment (Flutter Theme / SwiftUI Environment).
136
+ * SSR-safe: class + CSS vars on first paint — no documentElement useEffect.
137
+ */
138
+ export declare function FiboThemeProvider({ theme: themeProp, children, className, style, }: FiboThemeProviderProps): import("react/jsx-runtime").JSX.Element;
139
+ export declare function useFiboTheme(): FiboThemeContextValue;
140
+ export declare const materialTheme: FiboTheme;
141
+ export declare const cupertinoTheme: FiboTheme;
142
+ export declare const webTheme: FiboTheme;
143
+ /**
144
+ * Obsidian editorial dark — Fibonacci site / dense dashboards.
145
+ * Apply fluently: `Column().theme("noir")` or `FiboThemeProvider({ theme: "noir" })`.
146
+ */
147
+ export declare const noirTheme: FiboTheme;
148
+
149
+ export {};
package/dist/theme.js CHANGED
@@ -1,4 +1,4 @@
1
- import { aL as s, aF as m, aN as h, aI as T, aO as o, aH as t, aK as r, aM as i, aS as l, aR as n, aP as F, aQ as b, aG as p, aJ as u } from "./client-8KCOzRhg.js";
1
+ import { aR as s, aL as m, aT as h, aO as T, aU as o, aN as t, aQ as r, aS as i, aY as l, aX as n, aV as b, aW as p, aM as u, aP as C } from "./client-BzMPiV64.js";
2
2
  export {
3
3
  s as FIBO_THEMES,
4
4
  m as FiboThemeProvider,
@@ -10,8 +10,8 @@ export {
10
10
  i as resolveTheme,
11
11
  l as themeClassName,
12
12
  n as themeToCssRule,
13
- F as themeToCssVars,
14
- b as themeToInlineStyle,
15
- p as useFiboTheme,
16
- u as webTheme
13
+ b as themeToCssVars,
14
+ p as themeToInlineStyle,
15
+ u as useFiboTheme,
16
+ C as webTheme
17
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiboui",
3
- "version": "2.8.3",
3
+ "version": "2.8.5",
4
4
  "description": "Flutter/SwiftUI-inspired React UI — fluent builders, signals, and themes. https://fiboui.vercel.app",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -60,7 +60,7 @@
60
60
  "scripts": {
61
61
  "dev": "vite",
62
62
  "build": "tsc --noEmit && vite build && vite build --config vite.server.config.ts && npm run build:dts && tsc --project tsconfig.cli.json",
63
- "build:dts": "dts-bundle-generator --no-check --export-referenced-types false --external-imports=@metagptx/css-to-tailwind --external-imports=react --external-imports=react-dom --external-imports=leaflet -o dist/index.d.ts src/index.ts",
63
+ "build:dts": "node scripts/build-dts.mjs",
64
64
  "type-check": "tsc --noEmit",
65
65
  "test": "vitest run",
66
66
  "test:ssr-e2e": "npm run build && npm --prefix examples/ssr-fixtures install && npm --prefix examples/ssr-fixtures run test:e2e",
@@ -73,7 +73,8 @@
73
73
  "prepublishOnly": "bash scripts/secret-scan.sh --pack",
74
74
  "docs:dev": "vitepress dev docs",
75
75
  "docs:build": "vitepress build docs",
76
- "docs:preview": "vitepress preview docs"
76
+ "docs:preview": "vitepress preview docs",
77
+ "pack:local": "pnpm exec vite build && npm run build:dts && mkdir -p .pack && npm pack --pack-destination .pack && node -e \"const v=require('./package.json').version; console.log('packed .pack/fiboui-'+v+'.tgz')\""
77
78
  },
78
79
  "keywords": [
79
80
  "react",
@@ -112,6 +113,7 @@
112
113
  "@vitejs/plugin-react": "^4.2.0",
113
114
  "@vitest/coverage-v8": "^3.2.7",
114
115
  "autoprefixer": "^10.4.16",
116
+ "csstype": "3.2.3",
115
117
  "dts-bundle-generator": "^9.5.1",
116
118
  "eslint": "^9.39.5",
117
119
  "jsdom": "^26.1.0",
@@ -1,302 +0,0 @@
1
- var O = Object.defineProperty;
2
- var L = (e, t, n) => t in e ? O(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var w = (e, t, n) => L(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { S as C, c as $, i as U, H as D, b1 as I, U as k, b2 as P, b3 as T, b4 as B } from "./client-8KCOzRhg.js";
5
- import m, { useSyncExternalStore as V } from "react";
6
- function j() {
7
- return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `lst_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
8
- }
9
- function N(e) {
10
- return typeof e._id == "string" && e._id.length > 0;
11
- }
12
- function F(e) {
13
- return N(e) ? e : { ...e, _id: j() };
14
- }
15
- function M(e, t, n) {
16
- if (typeof n == "function")
17
- return n(e, t);
18
- if (e != null && typeof e == "object") {
19
- const r = e;
20
- return r._id != null && r._id === n || r.id != null && r.id === n;
21
- }
22
- return e === n;
23
- }
24
- function R(e, t) {
25
- if (typeof t == "function")
26
- return F({ ...t(e), _id: e._id });
27
- const { _id: n, ...r } = t;
28
- return { ...e, ...r, _id: e._id };
29
- }
30
- function W(e, t, n) {
31
- const r = e;
32
- return (n && n.length > 0 ? n.map((i) => r[i]) : Object.entries(r).filter(([i]) => i !== "_id").map(([, i]) => i)).some((i) => i == null ? !1 : typeof i == "string" || typeof i == "number" || typeof i == "boolean" ? String(i).toLowerCase().includes(t) : !1);
33
- }
34
- class z extends C {
35
- constructor(n = []) {
36
- const r = (Array.isArray(n) ? n : []).map((s) => F(s));
37
- super(r);
38
- w(this, "_$length");
39
- /** Full list. `.value` is this array, or a filtered slice while a view/filter is set. */
40
- w(this, "_source");
41
- w(this, "_query", "");
42
- w(this, "_keys");
43
- w(this, "_predicate");
44
- this._source = r, this.publish();
45
- }
46
- get value() {
47
- return super.value;
48
- }
49
- /**
50
- * Replaces the full list, then reapplies the current view.
51
- * In-place mutation of this array (`push` / `splice`) does not notify
52
- * and does not write the stored list — assign a new array or use
53
- * `add` / `update` / `remove`.
54
- */
55
- set value(n) {
56
- this._source = n.map((r) => F(r)), this.publish();
57
- }
58
- /** Push the visible rows. Always a copy so `.value.splice` cannot write `_source`. */
59
- publish() {
60
- const r = !!this._query || !!this._predicate ? this._source.filter((s, i) => !(this._query && !W(s, this._query, this._keys) || this._predicate && !this._predicate(s, i))) : this._source.slice();
61
- super.value = r;
62
- }
63
- get length() {
64
- return this.value.length;
65
- }
66
- /**
67
- * Reactive length for plain templates:
68
- * `Text(\`Total todos: ${todos.$length}\`)`
69
- *
70
- * Embeds a marker via `interp()`; `Text` resolves it on each update.
71
- * (`todos.length` is a plain number and still freezes — use `$length`.)
72
- */
73
- get $length() {
74
- return this._$length || (this._$length = $(() => this.value.length)), U(this._$length);
75
- }
76
- /** Replace the whole array (missing `_id`s are generated). */
77
- set(n) {
78
- return this.value = n.map((r) => F(r)), this;
79
- }
80
- clear() {
81
- return this.value = [], this;
82
- }
83
- /** Append items — each gets `_id` if not already set. Writes the full list. */
84
- add(...n) {
85
- return n.length === 0 ? this : (this.value = [...this._source, ...n.map((r) => F(r))], this);
86
- }
87
- /** Insert at index (clamped) in the full list. */
88
- insert(n, r) {
89
- const s = [...this._source], i = Math.max(0, Math.min(n, s.length));
90
- return s.splice(i, 0, F(r)), this.value = s, this;
91
- }
92
- /**
93
- * Patch by `_id` / `id` / predicate.
94
- * `patch` can be a partial object or a mapper.
95
- */
96
- update(n, r) {
97
- let s = !1;
98
- const i = this._source.map((a, c) => M(a, c, n) ? (s = !0, R(a, r)) : a);
99
- return s && (this.value = i), this;
100
- }
101
- /** Replace the first match (keeps original `_id` unless `item` already has one). */
102
- replace(n, r) {
103
- const s = this._source.findIndex((c, l) => M(c, l, n));
104
- if (s < 0) return this;
105
- const i = this._source[s], a = [...this._source];
106
- return a[s] = N(r) ? r : { ...r, _id: i._id }, this.value = a, this;
107
- }
108
- /** Remove by `_id` / `id` / predicate. Alias: `delete`. */
109
- remove(n) {
110
- const r = this._source.filter((s, i) => !M(s, i, n));
111
- return r.length !== this._source.length && (this.value = r), this;
112
- }
113
- delete(n) {
114
- return this.remove(n);
115
- }
116
- find(n) {
117
- return this._source.find((r, s) => M(r, s, n));
118
- }
119
- /**
120
- * Show only rows that match `query`. The full list stays stored.
121
- * `view('')` or `view()` shows every item again (does not clear `viewWhere`).
122
- * `keys` limits the match to those fields (`['text']`).
123
- */
124
- view(n = "", r) {
125
- return this._query = n.trim().toLowerCase(), this._keys = r, this.publish(), this;
126
- }
127
- /**
128
- * Live predicate on `publish()` (AND with `view`/`search` query).
129
- * `viewWhere()` with no fn (or `null`) clears it.
130
- */
131
- viewWhere(n) {
132
- return this._predicate = typeof n == "function" ? n : void 0, this.publish(), this;
133
- }
134
- /**
135
- * Same live view as `view()`, plus a copy of the visible rows.
136
- * Bound List/Table update; `const hits = todos.search('x')` still works.
137
- */
138
- search(n, r) {
139
- return this.view(n, r), [...this.value];
140
- }
141
- /**
142
- * One-shot snapshot of `_source` (Array.filter). Does not change `.value`.
143
- * Safe inside `computed(() => todos.filter(fn))`.
144
- * `todos.set(todos.filter(fn))` replaces the full list (clearDone).
145
- */
146
- filter(n) {
147
- return this._source.filter(n);
148
- }
149
- map(n) {
150
- return this._source.map(n);
151
- }
152
- move(n, r) {
153
- const s = [...this._source];
154
- if (n < 0 || n >= s.length) return this;
155
- const i = Math.max(0, Math.min(r, s.length - 1));
156
- if (n === i) return this;
157
- const [a] = s.splice(n, 1);
158
- return s.splice(i, 0, a), this.value = s, this;
159
- }
160
- }
161
- function H(e = []) {
162
- return new z(e);
163
- }
164
- const te = H, A = {
165
- linear: (e) => e,
166
- easeIn: (e) => e * e,
167
- easeOut: (e) => e * (2 - e),
168
- easeInOut: (e) => e < 0.5 ? 2 * e * e : -1 + (4 - 2 * e) * e
169
- };
170
- function G(e, t, n) {
171
- return e + (t - e) * n;
172
- }
173
- const h = /* @__PURE__ */ new WeakMap();
174
- function J() {
175
- return typeof requestAnimationFrame == "function";
176
- }
177
- function K() {
178
- return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
179
- }
180
- function Q(e) {
181
- const t = h.get(e);
182
- t != null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(t), h.delete(e);
183
- }
184
- C.prototype.spring = function(e, t = {}) {
185
- this.animate(e, { ...t, curve: "spring", damping: t.damping ?? 26, stiffness: t.stiffness ?? 170 });
186
- };
187
- C.prototype.animate = function(e, t = {}) {
188
- var p, f;
189
- const n = this.value, r = e;
190
- if (Q(this), !J() || K()) {
191
- this.value = r, (p = t.onComplete) == null || p.call(t);
192
- return;
193
- }
194
- if (t.curve === "spring") {
195
- const o = typeof t.stiffness == "number" && Number.isFinite(t.stiffness) && t.stiffness > 0 ? t.stiffness : 170, g = typeof t.damping == "number" && Number.isFinite(t.damping) && t.damping >= 0 ? t.damping : 26, _ = typeof t.mass == "number" && Number.isFinite(t.mass) && t.mass > 0 ? t.mass : 1;
196
- let y = n, v = typeof t.velocity == "number" && Number.isFinite(t.velocity) ? t.velocity : 0;
197
- const S = 1 / 60, x = () => {
198
- var b, u;
199
- const q = -o * (y - r) - g * v;
200
- if (v += q / _ * S, y += v * S, !Number.isFinite(y) || !Number.isFinite(v)) {
201
- this.value = r, h.delete(this), (b = t.onComplete) == null || b.call(t);
202
- return;
203
- }
204
- this.value = y, Math.abs(y - r) > 0.01 || Math.abs(v) > 0.01 ? h.set(this, requestAnimationFrame(x)) : (this.value = r, h.delete(this), (u = t.onComplete) == null || u.call(t));
205
- };
206
- h.set(this, requestAnimationFrame(x));
207
- return;
208
- }
209
- const s = t.duration, i = typeof s == "number" && Number.isFinite(s) && s > 0 ? s : s === void 0 ? 300 : 0;
210
- if (i === 0) {
211
- this.value = r, (f = t.onComplete) == null || f.call(t);
212
- return;
213
- }
214
- const a = A[t.curve || "easeOut"] ?? A.easeOut;
215
- let c = null;
216
- const l = (o) => {
217
- var _;
218
- c || (c = o);
219
- const g = Math.min((o - c) / i, 1);
220
- this.value = G(n, r, a(g)), g < 1 ? h.set(this, requestAnimationFrame(l)) : (h.delete(this), (_ = t.onComplete) == null || _.call(t));
221
- };
222
- h.set(this, requestAnimationFrame(l));
223
- };
224
- C.prototype.snapTo = function(e, t = {}) {
225
- this.animate(e, { duration: 300, curve: "easeOut", ...t });
226
- };
227
- function ne(e = {}) {
228
- return D(e.curve ?? "easeOut", {
229
- stiffness: e.stiffness,
230
- damping: e.damping,
231
- mass: e.mass
232
- });
233
- }
234
- function X(e, t = {}) {
235
- const { styles: n = !0, meta: r } = t, s = [], i = [];
236
- let a = "", c = 0, l = null, p = -1, f = null;
237
- const o = /* @__PURE__ */ new Set();
238
- function g(u) {
239
- const d = [];
240
- return typeof (r == null ? void 0 : r.title) == "string" && r.title.length > 0 && d.push(m.createElement("title", { key: "fibo-title" }, r.title)), typeof (r == null ? void 0 : r.description) == "string" && r.description.length > 0 && d.push(
241
- m.createElement("meta", {
242
- key: "fibo-description",
243
- name: "description",
244
- content: r.description
245
- })
246
- ), d.push(u), n && d.push(m.createElement(k)), m.createElement(m.Fragment, null, ...d);
247
- }
248
- function _() {
249
- f || (f = new P(y));
250
- let u;
251
- const d = T(s, i, () => {
252
- u = f.execute(() => I(e()));
253
- });
254
- return { tree: u, ...d.outcome };
255
- }
256
- function y() {
257
- const u = _();
258
- if (!(u.shape === a && !u.layout && B(i, u.slotCount))) {
259
- a = u.shape, c += 1, l = g(u.tree), p = c;
260
- for (const E of o) E();
261
- }
262
- }
263
- function v() {
264
- if (l && p === c) return l;
265
- const u = _();
266
- return a = u.shape, l = g(u.tree), p = c, l;
267
- }
268
- function S(u) {
269
- return o.add(u), () => {
270
- o.delete(u), o.size === 0 && f && (f.dispose(), f = null, l = null, p = -1);
271
- };
272
- }
273
- function x() {
274
- return c;
275
- }
276
- function q() {
277
- return 0;
278
- }
279
- function b() {
280
- return V(S, x, q), v();
281
- }
282
- return b.displayName = "FiboPage", r && (b.meta = r), b;
283
- }
284
- const re = X;
285
- function se(e) {
286
- return m.createElement(
287
- m.Fragment,
288
- null,
289
- I(e),
290
- m.createElement(k)
291
- );
292
- }
293
- export {
294
- z as L,
295
- ne as a,
296
- re as b,
297
- te as c,
298
- F as e,
299
- H as l,
300
- X as p,
301
- se as w
302
- };