fiboui 2.4.4 → 2.6.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/dist/style.js CHANGED
@@ -1 +1 @@
1
- "use client";
1
+
package/dist/theme.js CHANGED
@@ -1,19 +1,17 @@
1
- "use client";
2
- import { F as a, u as m } from "./provider-BTNE3N5g.js";
3
- import { F as o, a as t, c as T, e as r, m as i, n as l, r as n, f as u, d as F, t as b, b as c, w as p } from "./themeData-Dtm0M_mF.js";
1
+ import { ak as s, ae as m, am as h, ah as o, an as T, ag as r, aj as t, al as i, ar as l, aq as n, ao as p, ap as b, af as u, ai as C } from "./client-C9ZVisXx.js";
4
2
  export {
5
- o as FIBO_THEMES,
6
- a as FiboThemeProvider,
7
- t as copyWithTheme,
8
- T as cupertinoTheme,
9
- r as extendTheme,
10
- i as materialTheme,
11
- l as noirTheme,
12
- n as resolveTheme,
13
- u as themeClassName,
14
- F as themeToCssRule,
15
- b as themeToCssVars,
16
- c as themeToInlineStyle,
17
- m as useFiboTheme,
18
- p as webTheme
3
+ s as FIBO_THEMES,
4
+ m as FiboThemeProvider,
5
+ h as copyWithTheme,
6
+ o as cupertinoTheme,
7
+ T as extendTheme,
8
+ r as materialTheme,
9
+ t as noirTheme,
10
+ i as resolveTheme,
11
+ l as themeClassName,
12
+ n as themeToCssRule,
13
+ p as themeToCssVars,
14
+ b as themeToInlineStyle,
15
+ u as useFiboTheme,
16
+ C as webTheme
19
17
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fiboui",
3
- "version": "2.4.4",
4
- "description": "Flutter/SwiftUI-inspired React UI \u2014 fluent builders, signals, and themes. https://fiboui.vercel.app",
3
+ "version": "2.6.0",
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",
7
7
  "module": "./dist/index.js",
@@ -9,9 +9,14 @@
9
9
  "exports": {
10
10
  ".": {
11
11
  "types": "./dist/index.d.ts",
12
+ "react-server": "./dist/server.js",
12
13
  "import": "./dist/index.js",
13
14
  "default": "./dist/index.js"
14
15
  },
16
+ "./server": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/server.js"
19
+ },
15
20
  "./core": {
16
21
  "import": "./dist/core.js"
17
22
  },
@@ -47,7 +52,7 @@
47
52
  ],
48
53
  "scripts": {
49
54
  "dev": "vite",
50
- "build": "tsc --noEmit && vite build && npm run build:dts && tsc --project tsconfig.cli.json",
55
+ "build": "tsc --noEmit && vite build && vite build --config vite.server.config.ts && npm run build:dts && tsc --project tsconfig.cli.json",
51
56
  "build:dts": "dts-bundle-generator --no-check --export-referenced-types false --external-imports=@metagptx/css-to-tailwind --external-imports=react --external-imports=react-dom -o dist/index.d.ts src/index.ts",
52
57
  "type-check": "tsc --noEmit",
53
58
  "test": "vitest run",
@@ -1,29 +0,0 @@
1
- "use client";
2
- import s, { useRef as l, useEffect as p } from "react";
3
- import { G as x, r as m, H as E } from "./builder-B5cebEWZ.js";
4
- function R({
5
- compute: e,
6
- as: n = "span",
7
- className: o,
8
- style: i,
9
- ...u
10
- }) {
11
- const r = x(), t = l(null), a = e();
12
- return p(() => m(r, () => {
13
- const f = new E(() => {
14
- const c = e();
15
- t.current && t.current.textContent !== c && (t.current.textContent = c);
16
- });
17
- return () => f.dispose();
18
- }), [e, r]), s.createElement(n, { ref: t, className: o, style: i, ...u }, a);
19
- }
20
- function d(e, n) {
21
- return s.createElement(R, {
22
- compute: () => String(e.value),
23
- as: n
24
- });
25
- }
26
- export {
27
- R as F,
28
- d as b
29
- };
@@ -1,89 +0,0 @@
1
- "use client";
2
- import { jsx as m } from "react/jsx-runtime";
3
- import { createContext as x, useContext as p } from "react";
4
- const v = x(null);
5
- function o() {
6
- const t = p(v);
7
- if (!t)
8
- throw new Error("useRouter must be used within a Router");
9
- return t;
10
- }
11
- function C() {
12
- return p(v);
13
- }
14
- function R() {
15
- const { navigate: t } = o();
16
- return t;
17
- }
18
- function g() {
19
- const { params: t } = o();
20
- return t;
21
- }
22
- function k() {
23
- const { query: t } = o();
24
- return t;
25
- }
26
- function L() {
27
- var r;
28
- const { currentPath: t, query: n, hash: a } = o(), e = ((r = n == null ? void 0 : n.toString) == null ? void 0 : r.call(n)) ?? "";
29
- return {
30
- pathname: t,
31
- search: e ? `?${e}` : "",
32
- hash: a ?? ""
33
- };
34
- }
35
- const $ = ({
36
- to: t,
37
- children: n,
38
- replace: a = !1,
39
- state: e,
40
- className: r,
41
- style: h,
42
- onClick: i
43
- }) => {
44
- const f = R(), c = C(), u = t.startsWith("http") || t.startsWith("//") || t.startsWith("#") ? t : `${(c == null ? void 0 : c.basename) ?? ""}${t}`;
45
- return /* @__PURE__ */ m(
46
- "a",
47
- {
48
- href: u,
49
- onClick: (s) => {
50
- s.ctrlKey || s.metaKey || s.shiftKey || s.button !== 0 || (s.preventDefault(), i && i(s), f(t, { replace: a, state: e }));
51
- },
52
- className: r,
53
- style: h,
54
- children: n
55
- }
56
- );
57
- }, N = ({
58
- to: t,
59
- children: n,
60
- className: a = "",
61
- style: e = {},
62
- activeClassName: r = "active",
63
- activeStyle: h = {},
64
- exact: i = !1,
65
- ...f
66
- }) => {
67
- const { currentPath: c } = o(), u = i ? c === t : c.startsWith(t), l = u ? `${a} ${r}`.trim() : a, s = u ? { ...e, ...h } : e;
68
- return /* @__PURE__ */ m(
69
- $,
70
- {
71
- to: t,
72
- className: l,
73
- style: s,
74
- ...f,
75
- children: n
76
- }
77
- );
78
- };
79
- export {
80
- $ as L,
81
- N,
82
- v as R,
83
- R as a,
84
- g as b,
85
- L as c,
86
- k as d,
87
- C as e,
88
- o as u
89
- };
@@ -1,398 +0,0 @@
1
- "use client";
2
- var A = Object.defineProperty;
3
- var D = (e, o, r) => o in e ? A(e, o, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[o] = r;
4
- var E = (e, o, r) => D(e, typeof o != "symbol" ? o + "" : o, r);
5
- import { jsxs as p, jsx as t } from "react/jsx-runtime";
6
- import F, { Component as I, useState as w, useCallback as b, useEffect as U, Suspense as G, createContext as N } from "react";
7
- import { R as q } from "./Link-ElmaMZB8.js";
8
- function O(e, o) {
9
- const r = o.split("/").filter(Boolean), i = e.split("/").filter(Boolean);
10
- if (r.length !== i.length)
11
- return { match: !1, params: {} };
12
- const n = {};
13
- for (let a = 0; a < r.length; a++) {
14
- const f = r[a], m = i[a];
15
- if (f.startsWith(":")) {
16
- const y = f.slice(1);
17
- n[y] = m;
18
- continue;
19
- }
20
- if (f !== m)
21
- return { match: !1, params: {} };
22
- }
23
- return { match: !0, params: n };
24
- }
25
- function x(e, o) {
26
- for (const r of e) {
27
- const { match: i, params: n } = O(o, r.path);
28
- if (i)
29
- return { route: r, params: n };
30
- if (r.children) {
31
- const a = x(r.children, o);
32
- if (a.route)
33
- return a;
34
- }
35
- }
36
- return { route: null, params: {} };
37
- }
38
- class Q extends I {
39
- constructor(r) {
40
- super(r);
41
- E(this, "reset", () => {
42
- this.setState({
43
- hasError: !1,
44
- error: null,
45
- errorInfo: null
46
- });
47
- });
48
- this.state = {
49
- hasError: !1,
50
- error: null,
51
- errorInfo: null
52
- };
53
- }
54
- static getDerivedStateFromError(r) {
55
- return {
56
- hasError: !0,
57
- error: r
58
- };
59
- }
60
- componentDidCatch(r, i) {
61
- var n, a;
62
- console.error("RouteErrorBoundary caught error:", r, i), (a = (n = this.props).onError) == null || a.call(n, r, i), this.setState({
63
- errorInfo: i
64
- });
65
- }
66
- render() {
67
- if (this.state.hasError && this.state.error) {
68
- const { fallback: r } = this.props;
69
- return typeof r == "function" ? r(this.state.error, this.state.errorInfo) : r || /* @__PURE__ */ p("div", { style: { padding: "2rem", textAlign: "center" }, children: [
70
- /* @__PURE__ */ t("h1", { children: "Something went wrong" }),
71
- /* @__PURE__ */ t("p", { children: this.state.error.message })
72
- ] });
73
- }
74
- return this.props.children;
75
- }
76
- }
77
- const V = ({ error: e, onReset: o }) => {
78
- const r = () => {
79
- window.location.href = "/";
80
- }, i = () => {
81
- window.location.reload();
82
- };
83
- return /* @__PURE__ */ t(
84
- "div",
85
- {
86
- style: {
87
- display: "flex",
88
- flexDirection: "column",
89
- alignItems: "center",
90
- justifyContent: "center",
91
- minHeight: "100vh",
92
- padding: "2rem",
93
- backgroundColor: "#f9fafb",
94
- fontFamily: "system-ui, -apple-system, sans-serif"
95
- },
96
- children: /* @__PURE__ */ p(
97
- "div",
98
- {
99
- style: {
100
- maxWidth: "600px",
101
- width: "100%",
102
- backgroundColor: "white",
103
- borderRadius: "12px",
104
- padding: "3rem",
105
- boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)",
106
- textAlign: "center"
107
- },
108
- children: [
109
- /* @__PURE__ */ t(
110
- "div",
111
- {
112
- style: {
113
- width: "64px",
114
- height: "64px",
115
- margin: "0 auto 1.5rem",
116
- backgroundColor: "#fee2e2",
117
- borderRadius: "50%",
118
- display: "flex",
119
- alignItems: "center",
120
- justifyContent: "center"
121
- },
122
- children: /* @__PURE__ */ p(
123
- "svg",
124
- {
125
- width: "32",
126
- height: "32",
127
- viewBox: "0 0 24 24",
128
- fill: "none",
129
- stroke: "#dc2626",
130
- strokeWidth: "2",
131
- strokeLinecap: "round",
132
- strokeLinejoin: "round",
133
- children: [
134
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
135
- /* @__PURE__ */ t("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
136
- /* @__PURE__ */ t("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
137
- ]
138
- }
139
- )
140
- }
141
- ),
142
- /* @__PURE__ */ t(
143
- "h1",
144
- {
145
- style: {
146
- fontSize: "1.875rem",
147
- fontWeight: "700",
148
- color: "#111827",
149
- marginBottom: "0.5rem"
150
- },
151
- children: "Oops! Something went wrong"
152
- }
153
- ),
154
- e && /* @__PURE__ */ t(
155
- "div",
156
- {
157
- style: {
158
- marginTop: "1.5rem",
159
- padding: "1rem",
160
- backgroundColor: "#fef2f2",
161
- borderRadius: "8px",
162
- border: "1px solid #fecaca"
163
- },
164
- children: /* @__PURE__ */ t(
165
- "p",
166
- {
167
- style: {
168
- fontSize: "0.875rem",
169
- color: "#991b1b",
170
- fontFamily: "monospace",
171
- margin: 0,
172
- wordBreak: "break-word"
173
- },
174
- children: e.message
175
- }
176
- )
177
- }
178
- ),
179
- /* @__PURE__ */ t(
180
- "p",
181
- {
182
- style: {
183
- fontSize: "1rem",
184
- color: "#6b7280",
185
- marginTop: "1rem",
186
- marginBottom: "2rem"
187
- },
188
- children: "We're sorry for the inconvenience. Please try one of the options below."
189
- }
190
- ),
191
- /* @__PURE__ */ p(
192
- "div",
193
- {
194
- style: {
195
- display: "flex",
196
- gap: "1rem",
197
- justifyContent: "center",
198
- flexWrap: "wrap"
199
- },
200
- children: [
201
- o && /* @__PURE__ */ t(
202
- "button",
203
- {
204
- onClick: o,
205
- style: {
206
- padding: "0.75rem 1.5rem",
207
- backgroundColor: "#3b82f6",
208
- color: "white",
209
- border: "none",
210
- borderRadius: "8px",
211
- fontSize: "1rem",
212
- fontWeight: "500",
213
- cursor: "pointer",
214
- transition: "background-color 0.2s"
215
- },
216
- onMouseEnter: (n) => {
217
- n.currentTarget.style.backgroundColor = "#2563eb";
218
- },
219
- onMouseLeave: (n) => {
220
- n.currentTarget.style.backgroundColor = "#3b82f6";
221
- },
222
- children: "Try Again"
223
- }
224
- ),
225
- /* @__PURE__ */ t(
226
- "button",
227
- {
228
- onClick: i,
229
- style: {
230
- padding: "0.75rem 1.5rem",
231
- backgroundColor: "#6b7280",
232
- color: "white",
233
- border: "none",
234
- borderRadius: "8px",
235
- fontSize: "1rem",
236
- fontWeight: "500",
237
- cursor: "pointer",
238
- transition: "background-color 0.2s"
239
- },
240
- onMouseEnter: (n) => {
241
- n.currentTarget.style.backgroundColor = "#4b5563";
242
- },
243
- onMouseLeave: (n) => {
244
- n.currentTarget.style.backgroundColor = "#6b7280";
245
- },
246
- children: "Reload Page"
247
- }
248
- ),
249
- /* @__PURE__ */ t(
250
- "button",
251
- {
252
- onClick: r,
253
- style: {
254
- padding: "0.75rem 1.5rem",
255
- backgroundColor: "white",
256
- color: "#374151",
257
- border: "1px solid #d1d5db",
258
- borderRadius: "8px",
259
- fontSize: "1rem",
260
- fontWeight: "500",
261
- cursor: "pointer",
262
- transition: "all 0.2s"
263
- },
264
- onMouseEnter: (n) => {
265
- n.currentTarget.style.backgroundColor = "#f9fafb", n.currentTarget.style.borderColor = "#9ca3af";
266
- },
267
- onMouseLeave: (n) => {
268
- n.currentTarget.style.backgroundColor = "white", n.currentTarget.style.borderColor = "#d1d5db";
269
- },
270
- children: "Go Home"
271
- }
272
- )
273
- ]
274
- }
275
- ),
276
- (e == null ? void 0 : e.stack) && /* @__PURE__ */ p(
277
- "details",
278
- {
279
- style: {
280
- marginTop: "2rem",
281
- textAlign: "left"
282
- },
283
- children: [
284
- /* @__PURE__ */ t(
285
- "summary",
286
- {
287
- style: {
288
- cursor: "pointer",
289
- fontSize: "0.875rem",
290
- color: "#6b7280",
291
- fontWeight: "500"
292
- },
293
- children: "Stack Trace"
294
- }
295
- ),
296
- /* @__PURE__ */ t(
297
- "pre",
298
- {
299
- style: {
300
- marginTop: "1rem",
301
- padding: "1rem",
302
- backgroundColor: "#1f2937",
303
- color: "#f3f4f6",
304
- borderRadius: "8px",
305
- fontSize: "0.75rem",
306
- overflow: "auto",
307
- maxHeight: "300px"
308
- },
309
- children: e.stack
310
- }
311
- )
312
- ]
313
- }
314
- )
315
- ]
316
- }
317
- )
318
- }
319
- );
320
- };
321
- function T(e, o) {
322
- return o && e.startsWith(o) ? e.slice(o.length) || "/" : e || "/";
323
- }
324
- function $(e) {
325
- return e ? e.startsWith("?") ? e.slice(1) : e : "";
326
- }
327
- function J(e) {
328
- return e ? e.startsWith("#") ? e : `#${e}` : "";
329
- }
330
- const K = N(null), ee = ({
331
- routes: e,
332
- fallback: o,
333
- loading: r,
334
- basename: i = "",
335
- initialPath: n = "/",
336
- initialSearch: a = "",
337
- initialHash: f = "",
338
- errorBoundary: m,
339
- onError: y
340
- }) => {
341
- const [k, C] = w(() => T(n, i)), [W, v] = w(() => new URLSearchParams($(a))), [L, z] = w(() => J(f)), { route: h, params: B } = x(e, k), R = F.useRef(h);
342
- R.current = h;
343
- const g = b(async (s, d = {}) => {
344
- const u = R.current, { route: c } = x(e, s);
345
- if (u != null && u.beforeLeave && c) {
346
- const l = await u.beforeLeave(c, u);
347
- if (l === !1)
348
- return;
349
- if (typeof l == "string")
350
- return g(l, d);
351
- }
352
- if (c != null && c.beforeEnter) {
353
- const l = await c.beforeEnter(c, u);
354
- if (l === !1)
355
- return;
356
- typeof l == "string" && (s = l);
357
- }
358
- const P = i + s;
359
- typeof window < "u" && (d.replace ? window.history.replaceState(d.state || {}, "", P) : window.history.pushState(d.state || {}, "", P), v(new URLSearchParams(window.location.search))), C(s);
360
- }, [i, e]), M = b(() => {
361
- typeof window < "u" && window.history.back();
362
- }, []), j = b((s) => {
363
- g(s, { replace: !0 });
364
- }, [g]);
365
- U(() => {
366
- if (typeof window > "u") return;
367
- const s = () => {
368
- C(T(window.location.pathname, i)), v(new URLSearchParams(window.location.search)), z(window.location.hash || "");
369
- };
370
- return s(), window.addEventListener("popstate", s), () => window.removeEventListener("popstate", s);
371
- }, [i]);
372
- const H = {
373
- currentPath: k,
374
- basename: i,
375
- navigate: g,
376
- goBack: M,
377
- replace: j,
378
- params: B,
379
- query: W,
380
- hash: L
381
- }, S = () => {
382
- if (!h)
383
- return o ? /* @__PURE__ */ t(o, {}) : /* @__PURE__ */ t("div", { children: "404 - Page Not Found" });
384
- const s = h.component, d = /* @__PURE__ */ t(K.Provider, { value: h, children: /* @__PURE__ */ t(s, {}) });
385
- return /* @__PURE__ */ t(
386
- Q,
387
- {
388
- fallback: m || /* @__PURE__ */ t(V, {}),
389
- onError: y,
390
- children: d
391
- }
392
- );
393
- };
394
- return /* @__PURE__ */ t(q.Provider, { value: H, children: r ? /* @__PURE__ */ t(G, { fallback: r, children: S() }) : S() });
395
- };
396
- export {
397
- ee as R
398
- };