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.
@@ -1,34 +0,0 @@
1
- "use client";
2
- import o from "react";
3
- import { D as l, E as i } from "./builder-B5cebEWZ.js";
4
- const a = o.memo((r) => {
5
- const { className: c, style: e, children: s, ...t } = r;
6
- return o.createElement(
7
- "div",
8
- {
9
- className: c,
10
- style: e,
11
- ...t
12
- },
13
- ...s
14
- );
15
- });
16
- class m extends i {
17
- build() {
18
- const e = [
19
- "fibo-box",
20
- "min-w-0",
21
- ...this._classNames
22
- ].filter(Boolean).join(" "), s = this.getStyle(), t = this.processChildren(), n = {
23
- className: e,
24
- style: s,
25
- children: t,
26
- ...this._props
27
- };
28
- return o.createElement(a, n);
29
- }
30
- }
31
- const B = l(m);
32
- export {
33
- B
34
- };
@@ -1,358 +0,0 @@
1
- "use client";
2
- var q = Object.defineProperty;
3
- var I = (e, t, n) => t in e ? q(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
- var b = (e, t, n) => I(e, typeof t != "symbol" ? t + "" : t, n);
5
- import h, { useCallback as R, useSyncExternalStore as M, memo as T, useState as w, useRef as _, useEffect as v, StrictMode as L } from "react";
6
- import { n as k, S as F, D as $, J as j, K as z, E as H, R as x, L as N, P as D, N as W, Q as J } from "./builder-B5cebEWZ.js";
7
- import { createRoot as C } from "react-dom/client";
8
- import { P as K } from "./PluginManager-D5-ApsSN.js";
9
- function Q(e) {
10
- return (t) => e.subscribe(t);
11
- }
12
- function fe(e) {
13
- const t = R(Q(e), [e]);
14
- return M(t, () => e.value, () => e.value);
15
- }
16
- function me(e) {
17
- const t = R(
18
- (n) => e.subscribe(n),
19
- [e]
20
- );
21
- return M(t, () => e.getState(), () => e.getState());
22
- }
23
- function he(e) {
24
- const t = R(
25
- (n) => e.subscribe(n),
26
- [e]
27
- );
28
- return M(t, () => e.get(), () => e.get());
29
- }
30
- function pe(e, t, n) {
31
- if (!t || n === void 0)
32
- return e;
33
- const r = n;
34
- let i = { ...e };
35
- return r < 768 && t.mobile ? i = { ...i, ...t.mobile } : r >= 768 && r < 1024 && t.tablet ? i = { ...i, ...t.tablet } : r >= 1024 && t.desktop && (i = { ...i, ...t.desktop }), i;
36
- }
37
- function we(e, t) {
38
- const n = T(e, t);
39
- return (r) => h.createElement(n, r);
40
- }
41
- const Y = {
42
- linear: (e) => e,
43
- easeIn: (e) => e * e,
44
- easeOut: (e) => e * (2 - e),
45
- easeInOut: (e) => e < 0.5 ? 2 * e * e : -1 + (4 - 2 * e) * e,
46
- easeInCubic: (e) => e * e * e,
47
- easeOutCubic: (e) => --e * e * e + 1,
48
- elastic: (e) => e === 0 || e === 1 ? e : Math.pow(2, -10 * e) * Math.sin((e - 0.075) * (2 * Math.PI) / 0.3) + 1,
49
- bounce: (e) => e < 1 / 2.75 ? 7.5625 * e * e : e < 2 / 2.75 ? 7.5625 * (e -= 1.5 / 2.75) * e + 0.75 : e < 2.5 / 2.75 ? 7.5625 * (e -= 2.25 / 2.75) * e + 0.9375 : 7.5625 * (e -= 2.625 / 2.75) * e + 0.984375
50
- };
51
- function be(e, t) {
52
- const { duration: n = 300, delay: r = 0, easing: i = Y.easeOut } = t || {}, [o, c] = w(e), s = _(), l = _(o);
53
- return l.current = o, v(() => {
54
- s.current && cancelAnimationFrame(s.current);
55
- let u = null;
56
- const a = l.current, d = (m) => {
57
- u || (u = m);
58
- const f = m - u - r;
59
- if (f < 0) {
60
- s.current = requestAnimationFrame(d);
61
- return;
62
- }
63
- const p = Math.min(f / n, 1), y = i(p), S = a + (e - a) * y;
64
- c(S), p < 1 && (s.current = requestAnimationFrame(d));
65
- };
66
- return s.current = requestAnimationFrame(d), () => {
67
- s.current && cancelAnimationFrame(s.current);
68
- };
69
- }, [e, n, r]), o;
70
- }
71
- function ge(e, t) {
72
- const { stiffness: n = 170, damping: r = 26, mass: i = 1 } = t || {}, [o, c] = w(e), s = _(0), l = _();
73
- return v(() => {
74
- let u = o, a = s.current;
75
- const d = () => {
76
- const m = -n * (u - e), f = -r * a, p = (m + f) / i;
77
- a += p * (1 / 60), u += a * (1 / 60), c(u), s.current = a, (Math.abs(a) > 0.01 || Math.abs(u - e) > 0.01) && (l.current = requestAnimationFrame(d));
78
- };
79
- return l.current = requestAnimationFrame(d), () => {
80
- l.current && cancelAnimationFrame(l.current);
81
- };
82
- }, [e, n, r, i]), o;
83
- }
84
- function ve(e, t = 300) {
85
- const [n, r] = w(e), [i, o] = w(
86
- e ? "entered" : "exited"
87
- );
88
- return v(() => {
89
- if (e) {
90
- r(!0), o("entering");
91
- const c = setTimeout(() => o("entered"), 50);
92
- return () => clearTimeout(c);
93
- } else {
94
- o("exiting");
95
- const c = setTimeout(() => {
96
- o("exited"), r(!1);
97
- }, t);
98
- return () => clearTimeout(c);
99
- }
100
- }, [e, t]), { shouldRender: n, stage: i };
101
- }
102
- function Ee(e, t = 50) {
103
- return Array.from({ length: e }, (n, r) => r * t);
104
- }
105
- function G(e) {
106
- if (typeof window > "u" || typeof window.matchMedia != "function")
107
- return () => {
108
- };
109
- const t = window.matchMedia("(prefers-reduced-motion: reduce)");
110
- return t.addEventListener("change", e), () => t.removeEventListener("change", e);
111
- }
112
- function Me() {
113
- return M(
114
- G,
115
- () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches,
116
- () => !1
117
- );
118
- }
119
- function ye() {
120
- const [e, t] = w(0);
121
- return v(() => {
122
- if (typeof window > "u") return;
123
- const n = () => {
124
- const r = document.documentElement.scrollHeight - window.innerHeight;
125
- t(r > 0 ? Math.min(1, Math.max(0, window.scrollY / r)) : 0);
126
- };
127
- return n(), window.addEventListener("scroll", n, { passive: !0 }), window.addEventListener("resize", n), () => {
128
- window.removeEventListener("scroll", n), window.removeEventListener("resize", n);
129
- };
130
- }, []), e;
131
- }
132
- const A = {
133
- linear: (e) => e,
134
- easeIn: (e) => e * e,
135
- easeOut: (e) => e * (2 - e),
136
- easeInOut: (e) => e < 0.5 ? 2 * e * e : -1 + (4 - 2 * e) * e
137
- };
138
- function U(e, t, n) {
139
- return e + (t - e) * n;
140
- }
141
- const g = /* @__PURE__ */ new WeakMap();
142
- F.prototype.spring = function(e, t = {}) {
143
- this.animate(e, { ...t, curve: "spring", damping: t.damping ?? 26, stiffness: t.stiffness ?? 170 });
144
- };
145
- F.prototype.animate = function(e, t = {}) {
146
- const n = this.value, r = e, i = g.get(this);
147
- if (i && cancelAnimationFrame(i), t.curve === "spring") {
148
- const u = t.stiffness ?? 170, a = t.damping ?? 26, d = t.mass ?? 1;
149
- let m = n, f = t.velocity ?? 0;
150
- const p = 1 / 60, y = () => {
151
- var P;
152
- const S = -u * (m - r) - a * f;
153
- f += S / d * p, m += f * p, this.value = m, Math.abs(m - r) > 0.01 || Math.abs(f) > 0.01 ? g.set(this, requestAnimationFrame(y)) : (this.value = r, g.delete(this), (P = t.onComplete) == null || P.call(t));
154
- };
155
- g.set(this, requestAnimationFrame(y));
156
- return;
157
- }
158
- const o = t.duration || 300, c = A[t.curve || "easeOut"] ?? A.easeOut;
159
- let s = null;
160
- const l = (u) => {
161
- var d;
162
- s || (s = u);
163
- const a = Math.min((u - s) / o, 1);
164
- this.value = U(n, r, c(a)), a < 1 ? g.set(this, requestAnimationFrame(l)) : (g.delete(this), (d = t.onComplete) == null || d.call(t));
165
- };
166
- g.set(this, requestAnimationFrame(l));
167
- };
168
- F.prototype.snapTo = function(e, t = {}) {
169
- this.animate(e, { duration: 300, curve: "easeOut", ...t });
170
- };
171
- function _e(e = {}) {
172
- return k(e.curve ?? "easeOut", {
173
- stiffness: e.stiffness,
174
- damping: e.damping,
175
- mass: e.mass
176
- });
177
- }
178
- function E(e) {
179
- return !!e && typeof e == "object" && "value" in e && typeof e.subscribe == "function";
180
- }
181
- function X(e) {
182
- return !e || typeof e != "object" || E(e) ? !1 : Object.prototype.hasOwnProperty.call(e, "show");
183
- }
184
- function Z(e) {
185
- if (typeof window > "u" || typeof window.matchMedia != "function")
186
- return () => {
187
- };
188
- const t = window.matchMedia("(prefers-reduced-motion: reduce)");
189
- return t.addEventListener("change", e), () => t.removeEventListener("change", e);
190
- }
191
- function V() {
192
- return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
193
- }
194
- function ee() {
195
- return M(Z, V, () => !1);
196
- }
197
- function te(e) {
198
- return E(e) ? !!e.value : !!e;
199
- }
200
- function ne(e) {
201
- const [t, n] = w(() => te(e));
202
- return v(() => {
203
- if (!E(e)) {
204
- n(!!e);
205
- return;
206
- }
207
- return n(!!e.value), e.subscribe((r) => n(!!r));
208
- }, [e]), E(e) ? t : !!e;
209
- }
210
- function O({
211
- show: e,
212
- enter: t = "fadeIn",
213
- exit: n = "fadeOut",
214
- duration: r = 200,
215
- reducedMotion: i = "reduce",
216
- children: o
217
- }) {
218
- const c = ne(e), [s, l] = w(c), [u, a] = w(c ? "enter" : "idle"), d = i !== "never" && ee();
219
- if (v(() => {
220
- if (j(), c) {
221
- l(!0), a(d ? "idle" : "enter");
222
- return;
223
- }
224
- if (s) {
225
- if (d) {
226
- l(!1), a("idle");
227
- return;
228
- }
229
- a("exit");
230
- }
231
- }, [c, d]), !s) return null;
232
- const m = u === "exit" ? n : u === "enter" ? t : void 0, f = m && !d ? z(m) : void 0;
233
- return h.createElement(
234
- "div",
235
- {
236
- className: f ? `fibo-anim fibo-anim-${f}` : void 0,
237
- style: f ? { "--fibo-dur": `${r}ms`, "--fibo-ease": "ease" } : void 0,
238
- "data-fibo-presence": u,
239
- onAnimationEnd: (p) => {
240
- p.target === p.currentTarget && (u === "exit" && l(!1), u === "enter" && a("idle"));
241
- }
242
- },
243
- o
244
- );
245
- }
246
- class re extends H {
247
- constructor(n = !0) {
248
- super();
249
- b(this, "_show", !0);
250
- b(this, "_enter", "fadeIn");
251
- b(this, "_exit", "fadeOut");
252
- this.show(n);
253
- }
254
- show(n) {
255
- return this._show = n, E(n) && (this.bindSignal(n), this.observer()), this;
256
- }
257
- enter(n) {
258
- return this._enter = n, this;
259
- }
260
- exit(n) {
261
- return this._exit = n, this;
262
- }
263
- duration(n) {
264
- return this._transitionDuration = n, this;
265
- }
266
- build() {
267
- return h.createElement(O, {
268
- show: this._show,
269
- enter: this._enter,
270
- exit: this._exit,
271
- duration: this._transitionDuration,
272
- reducedMotion: this._reducedMotion,
273
- children: this.processChildren()
274
- });
275
- }
276
- }
277
- const ie = $(re);
278
- function se(e) {
279
- return X(e) ? h.createElement(O, e) : ie(e ?? !0);
280
- }
281
- se.displayName = "Presence";
282
- class oe {
283
- constructor() {
284
- b(this, "_rootComponent", null);
285
- b(this, "_rootElement", null);
286
- b(this, "_plugins", []);
287
- }
288
- use(t) {
289
- return this._plugins.push(t), this;
290
- }
291
- plugins(t) {
292
- return this._plugins.push(...t), this;
293
- }
294
- root(t) {
295
- return this._rootComponent = t, this;
296
- }
297
- mount(t) {
298
- const n = document.getElementById(t);
299
- if (!n)
300
- throw new Error(`Root element with id "${t}" not found`);
301
- this._rootElement = n, this.build();
302
- }
303
- build() {
304
- if (!this._rootComponent || !this._rootElement)
305
- throw new Error("Root component and mount element must be provided");
306
- const t = K.getInstance();
307
- this._plugins.forEach((o) => {
308
- t.use(o);
309
- });
310
- const n = this._rootComponent, r = () => h.createElement(x, {
311
- children: h.createElement(N, {
312
- stateMap: /* @__PURE__ */ new Map(),
313
- children: h.createElement(D, {
314
- providers: /* @__PURE__ */ new Map(),
315
- children: h.createElement(n, null)
316
- })
317
- })
318
- });
319
- C(this._rootElement).render(h.createElement(r));
320
- }
321
- }
322
- const Se = () => new oe();
323
- function B(e) {
324
- return J(e);
325
- }
326
- function Re({ children: e }) {
327
- return B(e);
328
- }
329
- function Fe(e, t, n) {
330
- const r = typeof e == "string" ? document.querySelector(e) : e;
331
- if (!r)
332
- throw new Error(`mount: element not found: ${String(e)}`);
333
- const i = typeof t == "function" && !W(t) ? t() : t, o = B(i), c = C(r), s = h.createElement(x, { children: o });
334
- return c.render(
335
- (n == null ? void 0 : n.strict) === !1 ? s : h.createElement(L, null, s)
336
- ), c;
337
- }
338
- export {
339
- Y as E,
340
- Se as F,
341
- se as P,
342
- me as a,
343
- he as b,
344
- pe as c,
345
- be as d,
346
- ge as e,
347
- Ee as f,
348
- ve as g,
349
- Me as h,
350
- ye as i,
351
- _e as j,
352
- oe as k,
353
- Re as l,
354
- Fe as m,
355
- we as n,
356
- B as t,
357
- fe as u
358
- };
@@ -1,44 +0,0 @@
1
- "use client";
2
- import { jsx as s } from "react/jsx-runtime";
3
- import { useState as a, useCallback as F, useMemo as T, createContext as C, useContext as p } from "react";
4
- import { r as x, f as P, b as g } from "./themeData-Dtm0M_mF.js";
5
- const l = C(void 0);
6
- function k(e) {
7
- return typeof e == "string" ? e : `${e.name}|${e.colors.primary}|${e.colors.background}|${e.fontFamily}`;
8
- }
9
- function N({
10
- theme: e = "web",
11
- children: m,
12
- className: c,
13
- style: i
14
- }) {
15
- const t = k(e), [u, f] = a(t), [h, r] = a(null);
16
- t !== u && (f(t), r(null));
17
- const o = x(h ?? e), n = F((v) => {
18
- r(v);
19
- }, []), b = T(
20
- () => ({
21
- theme: o,
22
- themeName: o.name,
23
- setTheme: n
24
- }),
25
- [o, n]
26
- ), d = [P(o), c].filter(Boolean).join(" "), y = {
27
- ...g(o),
28
- backgroundColor: o.colors.background,
29
- color: o.colors.onBackground,
30
- fontFamily: o.fontFamily,
31
- ...i
32
- };
33
- return /* @__PURE__ */ s(l.Provider, { value: b, children: /* @__PURE__ */ s("div", { className: d, "data-fibo-theme": o.name, style: y, children: m }) });
34
- }
35
- function S() {
36
- const e = p(l);
37
- if (!e)
38
- throw new Error("useFiboTheme must be used within a FiboThemeProvider");
39
- return e;
40
- }
41
- export {
42
- N as F,
43
- S as u
44
- };