fiboui 1.0.1 → 2.0.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 +138 -92
- package/dist/FineGrain-kBxv0WeR.js +29 -0
- package/dist/Link-DDzSPY1Q.js +88 -0
- package/dist/PluginManager-D5-ApsSN.js +111 -0
- package/dist/Router-i6Nc6qVs.js +386 -0
- package/dist/builder-DjLYXkXu.js +1842 -0
- package/dist/bundle-mjs-wppB-TKB.js +2760 -0
- package/dist/cli/bin.js +20 -0
- package/dist/cli/commands/generate/component.js +67 -0
- package/dist/cli/commands/generate/index.js +10 -0
- package/dist/cli/commands/generate/module.js +58 -0
- package/dist/cli/commands/generate/plugin.js +67 -0
- package/dist/cli/commands/init.js +58 -0
- package/dist/content.js +17 -0
- package/dist/core.js +33 -0
- package/dist/{effects-D16XdB_d.mjs → effects-CnevV566.js} +1 -0
- package/dist/index-B1av7e36.js +1102 -0
- package/dist/index-BQGRpkzR.js +1024 -0
- package/dist/index-CTRZRn9S.js +90 -0
- package/dist/index-DKFr-sai.js +33 -0
- package/dist/index-Dm4j2mMM.js +1031 -0
- package/dist/index-RbfIZuAo.js +119 -0
- package/dist/index-yeYkDTAx.js +778 -0
- package/dist/index.d.ts +43753 -6
- package/dist/index.js +2054 -0
- package/dist/interactive.js +12 -0
- package/dist/layout.js +18 -0
- package/dist/mount-sAVX_FBU.js +95 -0
- package/dist/navigation.js +13 -0
- package/dist/provider-B0eB-Wy7.js +286 -0
- package/dist/structure.js +15 -0
- package/dist/style.css +1 -1
- package/dist/style.js +1 -0
- package/dist/theme.js +9 -0
- package/package.json +88 -13
- package/dist/content/Alert/index.d.ts +0 -878
- package/dist/content/Avatar/index.d.ts +0 -886
- package/dist/content/Badge/index.d.ts +0 -887
- package/dist/content/Image/index.d.ts +0 -893
- package/dist/content/Label/index.d.ts +0 -879
- package/dist/content/Progress/index.d.ts +0 -898
- package/dist/content/Skeleton/index.d.ts +0 -879
- package/dist/content/Spinner/index.d.ts +0 -880
- package/dist/content/Text/index.d.ts +0 -878
- package/dist/content/index.d.ts +0 -9
- package/dist/core/StateWrapper.d.ts +0 -31
- package/dist/core/builder.d.ts +0 -53
- package/dist/core/component.d.ts +0 -7
- package/dist/core/effects.d.ts +0 -4
- package/dist/core/hooks.d.ts +0 -5
- package/dist/core/icons.d.ts +0 -11
- package/dist/core/index.d.ts +0 -6
- package/dist/core/state.d.ts +0 -86
- package/dist/core/types.d.ts +0 -51
- package/dist/demo.d.ts +0 -7
- package/dist/index.esm.js +0 -4777
- package/dist/index.umd.js +0 -251
- package/dist/interactive/Button/index.d.ts +0 -897
- package/dist/interactive/Checkbox/index.d.ts +0 -884
- package/dist/interactive/Combobox/index.d.ts +0 -898
- package/dist/interactive/RadioGroup/index.d.ts +0 -888
- package/dist/interactive/Select/index.d.ts +0 -895
- package/dist/interactive/Switch/index.d.ts +0 -881
- package/dist/interactive/TextField/index.d.ts +0 -893
- package/dist/interactive/Textarea/index.d.ts +0 -890
- package/dist/interactive/index.d.ts +0 -8
- package/dist/layout/Center/index.d.ts +0 -869
- package/dist/layout/Column/index.d.ts +0 -881
- package/dist/layout/Container/index.d.ts +0 -870
- package/dist/layout/DashboardLayout/index.d.ts +0 -870
- package/dist/layout/Header/index.d.ts +0 -870
- package/dist/layout/Line/index.d.ts +0 -872
- package/dist/layout/Row/index.d.ts +0 -879
- package/dist/layout/Scaffold/index.d.ts +0 -878
- package/dist/layout/ScrollView/index.d.ts +0 -879
- package/dist/layout/Sidebar/index.d.ts +0 -870
- package/dist/layout/Spacer/index.d.ts +0 -875
- package/dist/layout/StakentComponents.d.ts +0 -4
- package/dist/layout/index.d.ts +0 -11
- package/dist/structure/Banner/index.d.ts +0 -879
- package/dist/structure/Box/index.d.ts +0 -869
- package/dist/structure/Card/index.d.ts +0 -881
- package/dist/structure/Collapse/index.d.ts +0 -884
- package/dist/structure/Grid/index.d.ts +0 -1757
- package/dist/structure/List/index.d.ts +0 -888
- package/dist/structure/Table/index.d.ts +0 -895
- package/dist/structure/Tags/index.d.ts +0 -876
- package/dist/structure/cards/AssetCard/index.d.ts +0 -884
- package/dist/structure/cards/CollectionCard/index.d.ts +0 -880
- package/dist/structure/cards/ContentCard/index.d.ts +0 -884
- package/dist/structure/cards/ProfileCard/index.d.ts +0 -892
- package/dist/structure/cards/index.d.ts +0 -5
- package/dist/structure/cards/variants/index.d.ts +0 -3490
- package/dist/structure/index.d.ts +0 -9
- package/dist/theme/cupertino.d.ts +0 -3
- package/dist/theme/index.d.ts +0 -5
- package/dist/theme/material.d.ts +0 -3
- package/dist/theme/provider.d.ts +0 -16
- package/dist/theme/types.d.ts +0 -57
- package/dist/theme/web.d.ts +0 -3
- package/src/content/Alert/index.ts +0 -110
- package/src/content/Avatar/index.ts +0 -116
- package/src/content/Badge/index.ts +0 -162
- package/src/content/Image/index.ts +0 -137
- package/src/content/Label/index.ts +0 -66
- package/src/content/Progress/index.ts +0 -378
- package/src/content/Skeleton/index.ts +0 -71
- package/src/content/Spinner/index.ts +0 -139
- package/src/content/Text/index.ts +0 -74
- package/src/content/index.ts +0 -9
- package/src/core/StateWrapper.tsx +0 -131
- package/src/core/builder.ts +0 -297
- package/src/core/component.ts +0 -49
- package/src/core/effects.ts +0 -27
- package/src/core/hooks.ts +0 -48
- package/src/core/icons.tsx +0 -57
- package/src/core/index.ts +0 -6
- package/src/core/state.ts +0 -297
- package/src/core/types.ts +0 -62
- package/src/demo.tsx +0 -1050
- package/src/index.ts +0 -8
- package/src/interactive/Button/index.ts +0 -219
- package/src/interactive/Checkbox/index.ts +0 -145
- package/src/interactive/Combobox/index.ts +0 -278
- package/src/interactive/RadioGroup/index.ts +0 -124
- package/src/interactive/Select/index.ts +0 -227
- package/src/interactive/Switch/index.ts +0 -123
- package/src/interactive/TextField/index.ts +0 -223
- package/src/interactive/Textarea/index.ts +0 -129
- package/src/interactive/index.ts +0 -8
- package/src/layout/Center/index.ts +0 -34
- package/src/layout/Column/index.ts +0 -101
- package/src/layout/Container/index.ts +0 -28
- package/src/layout/DashboardLayout/index.ts +0 -106
- package/src/layout/Header/index.ts +0 -50
- package/src/layout/Line/index.ts +0 -41
- package/src/layout/Row/index.ts +0 -93
- package/src/layout/Scaffold/index.ts +0 -133
- package/src/layout/ScrollView/index.ts +0 -67
- package/src/layout/Sidebar/index.ts +0 -56
- package/src/layout/Spacer/index.ts +0 -46
- package/src/layout/StakentComponents.tsx +0 -57
- package/src/layout/index.ts +0 -11
- package/src/structure/Banner/index.ts +0 -92
- package/src/structure/Box/index.ts +0 -46
- package/src/structure/Card/index.ts +0 -113
- package/src/structure/Collapse/index.ts +0 -122
- package/src/structure/Grid/index.ts +0 -197
- package/src/structure/List/index.ts +0 -185
- package/src/structure/Table/index.ts +0 -165
- package/src/structure/Tags/index.ts +0 -69
- package/src/structure/cards/AssetCard/index.ts +0 -158
- package/src/structure/cards/CollectionCard/index.ts +0 -95
- package/src/structure/cards/ContentCard/index.ts +0 -127
- package/src/structure/cards/ProfileCard/index.ts +0 -152
- package/src/structure/cards/index.ts +0 -5
- package/src/structure/cards/variants/index.ts +0 -301
- package/src/structure/index.ts +0 -10
- package/src/styles/base.css +0 -186
- package/src/styles/core.css +0 -52
- package/src/styles/themes/cupertino.css +0 -197
- package/src/styles/themes/material.css +0 -322
- package/src/styles/themes/web.css +0 -196
- package/src/theme/cupertino.ts +0 -85
- package/src/theme/index.ts +0 -5
- package/src/theme/material.ts +0 -86
- package/src/theme/provider.tsx +0 -76
- package/src/theme/types.ts +0 -62
- package/src/theme/web.ts +0 -82
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var W = Object.defineProperty;
|
|
3
|
+
var B = (o, n, e) => n in o ? W(o, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[n] = e;
|
|
4
|
+
var R = (o, n, e) => B(o, typeof n != "symbol" ? n + "" : n, e);
|
|
5
|
+
import { jsxs as m, jsx as r } from "react/jsx-runtime";
|
|
6
|
+
import z, { Component as M, useState as S, useCallback as y, useEffect as j, Suspense as A, createContext as D } from "react";
|
|
7
|
+
import { R as H } from "./Link-DDzSPY1Q.js";
|
|
8
|
+
function U(o, n) {
|
|
9
|
+
const e = n.split("/").filter(Boolean), a = o.split("/").filter(Boolean);
|
|
10
|
+
if (e.length !== a.length)
|
|
11
|
+
return { match: !1, params: {} };
|
|
12
|
+
const t = {};
|
|
13
|
+
for (let i = 0; i < e.length; i++) {
|
|
14
|
+
const u = e[i], h = a[i];
|
|
15
|
+
if (u.startsWith(":")) {
|
|
16
|
+
const w = u.slice(1);
|
|
17
|
+
t[w] = h;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (u !== h)
|
|
21
|
+
return { match: !1, params: {} };
|
|
22
|
+
}
|
|
23
|
+
return { match: !0, params: t };
|
|
24
|
+
}
|
|
25
|
+
function b(o, n) {
|
|
26
|
+
for (const e of o) {
|
|
27
|
+
const { match: a, params: t } = U(n, e.path);
|
|
28
|
+
if (a)
|
|
29
|
+
return { route: e, params: t };
|
|
30
|
+
if (e.children) {
|
|
31
|
+
const i = b(e.children, n);
|
|
32
|
+
if (i.route)
|
|
33
|
+
return i;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return { route: null, params: {} };
|
|
37
|
+
}
|
|
38
|
+
class F extends M {
|
|
39
|
+
constructor(e) {
|
|
40
|
+
super(e);
|
|
41
|
+
R(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(e) {
|
|
55
|
+
return {
|
|
56
|
+
hasError: !0,
|
|
57
|
+
error: e
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
componentDidCatch(e, a) {
|
|
61
|
+
var t, i;
|
|
62
|
+
console.error("RouteErrorBoundary caught error:", e, a), (i = (t = this.props).onError) == null || i.call(t, e, a), this.setState({
|
|
63
|
+
errorInfo: a
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
if (this.state.hasError && this.state.error) {
|
|
68
|
+
const { fallback: e } = this.props;
|
|
69
|
+
return typeof e == "function" ? e(this.state.error, this.state.errorInfo) : e || /* @__PURE__ */ m("div", { style: { padding: "2rem", textAlign: "center" }, children: [
|
|
70
|
+
/* @__PURE__ */ r("h1", { children: "Something went wrong" }),
|
|
71
|
+
/* @__PURE__ */ r("p", { children: this.state.error.message })
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
return this.props.children;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const I = ({ error: o, onReset: n }) => {
|
|
78
|
+
const e = () => {
|
|
79
|
+
window.location.href = "/";
|
|
80
|
+
}, a = () => {
|
|
81
|
+
window.location.reload();
|
|
82
|
+
};
|
|
83
|
+
return /* @__PURE__ */ r(
|
|
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__ */ m(
|
|
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__ */ r(
|
|
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__ */ m(
|
|
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__ */ r("circle", { cx: "12", cy: "12", r: "10" }),
|
|
135
|
+
/* @__PURE__ */ r("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
136
|
+
/* @__PURE__ */ r("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ r(
|
|
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
|
+
o && /* @__PURE__ */ r(
|
|
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__ */ r(
|
|
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: o.message
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
),
|
|
179
|
+
/* @__PURE__ */ r(
|
|
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__ */ m(
|
|
192
|
+
"div",
|
|
193
|
+
{
|
|
194
|
+
style: {
|
|
195
|
+
display: "flex",
|
|
196
|
+
gap: "1rem",
|
|
197
|
+
justifyContent: "center",
|
|
198
|
+
flexWrap: "wrap"
|
|
199
|
+
},
|
|
200
|
+
children: [
|
|
201
|
+
n && /* @__PURE__ */ r(
|
|
202
|
+
"button",
|
|
203
|
+
{
|
|
204
|
+
onClick: n,
|
|
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: (t) => {
|
|
217
|
+
t.currentTarget.style.backgroundColor = "#2563eb";
|
|
218
|
+
},
|
|
219
|
+
onMouseLeave: (t) => {
|
|
220
|
+
t.currentTarget.style.backgroundColor = "#3b82f6";
|
|
221
|
+
},
|
|
222
|
+
children: "Try Again"
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
/* @__PURE__ */ r(
|
|
226
|
+
"button",
|
|
227
|
+
{
|
|
228
|
+
onClick: a,
|
|
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: (t) => {
|
|
241
|
+
t.currentTarget.style.backgroundColor = "#4b5563";
|
|
242
|
+
},
|
|
243
|
+
onMouseLeave: (t) => {
|
|
244
|
+
t.currentTarget.style.backgroundColor = "#6b7280";
|
|
245
|
+
},
|
|
246
|
+
children: "Reload Page"
|
|
247
|
+
}
|
|
248
|
+
),
|
|
249
|
+
/* @__PURE__ */ r(
|
|
250
|
+
"button",
|
|
251
|
+
{
|
|
252
|
+
onClick: e,
|
|
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: (t) => {
|
|
265
|
+
t.currentTarget.style.backgroundColor = "#f9fafb", t.currentTarget.style.borderColor = "#9ca3af";
|
|
266
|
+
},
|
|
267
|
+
onMouseLeave: (t) => {
|
|
268
|
+
t.currentTarget.style.backgroundColor = "white", t.currentTarget.style.borderColor = "#d1d5db";
|
|
269
|
+
},
|
|
270
|
+
children: "Go Home"
|
|
271
|
+
}
|
|
272
|
+
)
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
),
|
|
276
|
+
(o == null ? void 0 : o.stack) && /* @__PURE__ */ m(
|
|
277
|
+
"details",
|
|
278
|
+
{
|
|
279
|
+
style: {
|
|
280
|
+
marginTop: "2rem",
|
|
281
|
+
textAlign: "left"
|
|
282
|
+
},
|
|
283
|
+
children: [
|
|
284
|
+
/* @__PURE__ */ r(
|
|
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__ */ r(
|
|
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: o.stack
|
|
310
|
+
}
|
|
311
|
+
)
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
)
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
}
|
|
319
|
+
);
|
|
320
|
+
}, G = D(null), V = ({
|
|
321
|
+
routes: o,
|
|
322
|
+
fallback: n,
|
|
323
|
+
loading: e,
|
|
324
|
+
basename: a = "",
|
|
325
|
+
errorBoundary: t,
|
|
326
|
+
onError: i
|
|
327
|
+
}) => {
|
|
328
|
+
const [u, h] = S(() => typeof window > "u" ? "/" : window.location.pathname.replace(a, "") || "/"), [w, x] = S(
|
|
329
|
+
() => typeof window > "u" ? new URLSearchParams() : new URLSearchParams(window.location.search)
|
|
330
|
+
), { route: p, params: P } = b(o, u), k = z.useRef(p);
|
|
331
|
+
k.current = p;
|
|
332
|
+
const g = y(async (s, c = {}) => {
|
|
333
|
+
const f = k.current, { route: l } = b(o, s);
|
|
334
|
+
if (f != null && f.beforeLeave && l) {
|
|
335
|
+
const d = await f.beforeLeave(l, f);
|
|
336
|
+
if (d === !1)
|
|
337
|
+
return;
|
|
338
|
+
if (typeof d == "string")
|
|
339
|
+
return g(d, c);
|
|
340
|
+
}
|
|
341
|
+
if (l != null && l.beforeEnter) {
|
|
342
|
+
const d = await l.beforeEnter(l, f);
|
|
343
|
+
if (d === !1)
|
|
344
|
+
return;
|
|
345
|
+
typeof d == "string" && (s = d);
|
|
346
|
+
}
|
|
347
|
+
const v = a + s;
|
|
348
|
+
typeof window < "u" && (c.replace ? window.history.replaceState(c.state || {}, "", v) : window.history.pushState(c.state || {}, "", v), x(new URLSearchParams(window.location.search))), h(s);
|
|
349
|
+
}, [a, o]), E = y(() => {
|
|
350
|
+
typeof window < "u" && window.history.back();
|
|
351
|
+
}, []), T = y((s) => {
|
|
352
|
+
g(s, { replace: !0 });
|
|
353
|
+
}, [g]);
|
|
354
|
+
j(() => {
|
|
355
|
+
const s = () => {
|
|
356
|
+
const c = window.location.pathname.replace(a, "") || "/";
|
|
357
|
+
h(c), x(new URLSearchParams(window.location.search));
|
|
358
|
+
};
|
|
359
|
+
return window.addEventListener("popstate", s), () => window.removeEventListener("popstate", s);
|
|
360
|
+
}, [a]);
|
|
361
|
+
const L = {
|
|
362
|
+
currentPath: u,
|
|
363
|
+
basename: a,
|
|
364
|
+
navigate: g,
|
|
365
|
+
goBack: E,
|
|
366
|
+
replace: T,
|
|
367
|
+
params: P,
|
|
368
|
+
query: w
|
|
369
|
+
}, C = () => {
|
|
370
|
+
if (!p)
|
|
371
|
+
return n ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("div", { children: "404 - Page Not Found" });
|
|
372
|
+
const s = p.component, c = /* @__PURE__ */ r(G.Provider, { value: p, children: /* @__PURE__ */ r(s, {}) });
|
|
373
|
+
return /* @__PURE__ */ r(
|
|
374
|
+
F,
|
|
375
|
+
{
|
|
376
|
+
fallback: t || /* @__PURE__ */ r(I, {}),
|
|
377
|
+
onError: i,
|
|
378
|
+
children: c
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
};
|
|
382
|
+
return /* @__PURE__ */ r(H.Provider, { value: L, children: e ? /* @__PURE__ */ r(A, { fallback: e, children: C() }) : C() });
|
|
383
|
+
};
|
|
384
|
+
export {
|
|
385
|
+
V as R
|
|
386
|
+
};
|