@viasoftbr/shared-ui 0.0.3 → 0.0.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/components/encoder/DvB.d.ts +5 -2
- package/dist/components/encoder/Livecast.d.ts +4 -2
- package/dist/components/index.d.ts +1 -2
- package/dist/components/main/Header.d.ts +1 -0
- package/dist/components.cjs +53280 -0
- package/dist/components.js +845 -2904
- package/dist/context/AuthContext.d.ts +11 -2
- package/dist/context/SharedUiProvider.d.ts +7 -0
- package/dist/context/ThemeContext.d.ts +3 -1
- package/dist/context/index.d.ts +4 -3
- package/dist/context.cjs +3039 -0
- package/dist/context.js +84 -556
- package/dist/hooks.cjs +3109 -0
- package/dist/hooks.js +21 -1384
- package/dist/i18n.cjs +3277 -0
- package/dist/i18n.js +2 -87
- package/dist/index.cjs +53677 -0
- package/dist/index.js +935 -3161
- package/dist/services/index.d.ts +0 -2
- package/dist/services.cjs +3124 -0
- package/dist/services.js +0 -137
- package/dist/types.cjs +34 -0
- package/package.json +19 -9
package/dist/context.js
CHANGED
|
@@ -10,436 +10,40 @@ var __publicField = (obj, key, value) => {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
// src/context/ThemeContext.tsx
|
|
13
|
-
import { createContext,
|
|
13
|
+
import { createContext, use, useEffect, useState } from "react";
|
|
14
14
|
import { jsx } from "react/jsx-runtime";
|
|
15
15
|
var ThemeContext = createContext(void 0);
|
|
16
|
-
function ThemeProvider({ children }) {
|
|
16
|
+
function ThemeProvider({ children, storage }) {
|
|
17
|
+
const resolvedStorage = storage ?? (typeof window !== "undefined" ? window.localStorage : null);
|
|
17
18
|
const [theme, setTheme] = useState(() => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
try {
|
|
20
|
+
if (!resolvedStorage)
|
|
21
|
+
return "light";
|
|
22
|
+
const savedTheme = resolvedStorage.getItem("theme");
|
|
23
|
+
const systemPreference = typeof window !== "undefined" && window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
24
|
+
return savedTheme ?? systemPreference;
|
|
25
|
+
} catch {
|
|
26
|
+
return "light";
|
|
27
|
+
}
|
|
21
28
|
});
|
|
22
29
|
useEffect(() => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
root.classList.
|
|
26
|
-
} else {
|
|
27
|
-
root.classList.remove("dark");
|
|
28
|
-
}
|
|
29
|
-
localStorage.setItem("theme", theme);
|
|
30
|
-
}, [theme]);
|
|
31
|
-
const toggleTheme = () => {
|
|
32
|
-
setTheme((prevTheme) => prevTheme === "light" ? "dark" : "light");
|
|
33
|
-
};
|
|
34
|
-
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: { theme, toggleTheme }, children });
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// src/context/AuthContext.tsx
|
|
38
|
-
import { createContext as createContext4, useContext as useContext4, useEffect as useEffect4, useState as useState4 } from "react";
|
|
39
|
-
|
|
40
|
-
// node_modules/.pnpm/react-router-dom@6.30.3_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-router-dom/dist/index.js
|
|
41
|
-
import * as React3 from "react";
|
|
42
|
-
import * as ReactDOM from "react-dom";
|
|
43
|
-
|
|
44
|
-
// node_modules/.pnpm/react-router@6.30.3_react@19.2.4/node_modules/react-router/dist/index.js
|
|
45
|
-
import * as React2 from "react";
|
|
46
|
-
|
|
47
|
-
// node_modules/.pnpm/@remix-run+router@1.23.2/node_modules/@remix-run/router/dist/router.js
|
|
48
|
-
function _extends() {
|
|
49
|
-
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
50
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
51
|
-
var source = arguments[i];
|
|
52
|
-
for (var key in source) {
|
|
53
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
54
|
-
target[key] = source[key];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
30
|
+
if (typeof document !== "undefined") {
|
|
31
|
+
const root = document.documentElement;
|
|
32
|
+
root.classList.toggle("dark", theme === "dark");
|
|
57
33
|
}
|
|
58
|
-
return target;
|
|
59
|
-
};
|
|
60
|
-
return _extends.apply(this, arguments);
|
|
61
|
-
}
|
|
62
|
-
var Action;
|
|
63
|
-
(function(Action2) {
|
|
64
|
-
Action2["Pop"] = "POP";
|
|
65
|
-
Action2["Push"] = "PUSH";
|
|
66
|
-
Action2["Replace"] = "REPLACE";
|
|
67
|
-
})(Action || (Action = {}));
|
|
68
|
-
function invariant(value, message) {
|
|
69
|
-
if (value === false || value === null || typeof value === "undefined") {
|
|
70
|
-
throw new Error(message);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function warning(cond, message) {
|
|
74
|
-
if (!cond) {
|
|
75
|
-
if (typeof console !== "undefined")
|
|
76
|
-
console.warn(message);
|
|
77
34
|
try {
|
|
78
|
-
|
|
79
|
-
} catch
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function parsePath(path) {
|
|
84
|
-
let parsedPath = {};
|
|
85
|
-
if (path) {
|
|
86
|
-
let hashIndex = path.indexOf("#");
|
|
87
|
-
if (hashIndex >= 0) {
|
|
88
|
-
parsedPath.hash = path.substr(hashIndex);
|
|
89
|
-
path = path.substr(0, hashIndex);
|
|
90
|
-
}
|
|
91
|
-
let searchIndex = path.indexOf("?");
|
|
92
|
-
if (searchIndex >= 0) {
|
|
93
|
-
parsedPath.search = path.substr(searchIndex);
|
|
94
|
-
path = path.substr(0, searchIndex);
|
|
95
|
-
}
|
|
96
|
-
if (path) {
|
|
97
|
-
parsedPath.pathname = path;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return parsedPath;
|
|
101
|
-
}
|
|
102
|
-
var ResultType;
|
|
103
|
-
(function(ResultType2) {
|
|
104
|
-
ResultType2["data"] = "data";
|
|
105
|
-
ResultType2["deferred"] = "deferred";
|
|
106
|
-
ResultType2["redirect"] = "redirect";
|
|
107
|
-
ResultType2["error"] = "error";
|
|
108
|
-
})(ResultType || (ResultType = {}));
|
|
109
|
-
var ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
110
|
-
var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX$1.test(url);
|
|
111
|
-
function resolvePath(to, fromPathname) {
|
|
112
|
-
if (fromPathname === void 0) {
|
|
113
|
-
fromPathname = "/";
|
|
114
|
-
}
|
|
115
|
-
let {
|
|
116
|
-
pathname: toPathname,
|
|
117
|
-
search = "",
|
|
118
|
-
hash = ""
|
|
119
|
-
} = typeof to === "string" ? parsePath(to) : to;
|
|
120
|
-
let pathname;
|
|
121
|
-
if (toPathname) {
|
|
122
|
-
if (isAbsoluteUrl(toPathname)) {
|
|
123
|
-
pathname = toPathname;
|
|
124
|
-
} else {
|
|
125
|
-
if (toPathname.includes("//")) {
|
|
126
|
-
let oldPathname = toPathname;
|
|
127
|
-
toPathname = toPathname.replace(/\/\/+/g, "/");
|
|
128
|
-
warning(false, "Pathnames cannot have embedded double slashes - normalizing " + (oldPathname + " -> " + toPathname));
|
|
129
|
-
}
|
|
130
|
-
if (toPathname.startsWith("/")) {
|
|
131
|
-
pathname = resolvePathname(toPathname.substring(1), "/");
|
|
132
|
-
} else {
|
|
133
|
-
pathname = resolvePathname(toPathname, fromPathname);
|
|
134
|
-
}
|
|
35
|
+
resolvedStorage?.setItem("theme", theme);
|
|
36
|
+
} catch {
|
|
135
37
|
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return {
|
|
140
|
-
pathname,
|
|
141
|
-
search: normalizeSearch(search),
|
|
142
|
-
hash: normalizeHash(hash)
|
|
38
|
+
}, [theme, resolvedStorage]);
|
|
39
|
+
const toggleTheme = () => {
|
|
40
|
+
setTheme((prev) => prev === "light" ? "dark" : "light");
|
|
143
41
|
};
|
|
42
|
+
return /* @__PURE__ */ jsx(ThemeContext, { value: { theme, toggleTheme }, children });
|
|
144
43
|
}
|
|
145
|
-
function resolvePathname(relativePath, fromPathname) {
|
|
146
|
-
let segments = fromPathname.replace(/\/+$/, "").split("/");
|
|
147
|
-
let relativeSegments = relativePath.split("/");
|
|
148
|
-
relativeSegments.forEach((segment) => {
|
|
149
|
-
if (segment === "..") {
|
|
150
|
-
if (segments.length > 1)
|
|
151
|
-
segments.pop();
|
|
152
|
-
} else if (segment !== ".") {
|
|
153
|
-
segments.push(segment);
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
return segments.length > 1 ? segments.join("/") : "/";
|
|
157
|
-
}
|
|
158
|
-
function getInvalidPathError(char, field, dest, path) {
|
|
159
|
-
return "Cannot include a '" + char + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path) + "]. Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
|
|
160
|
-
}
|
|
161
|
-
function getPathContributingMatches(matches) {
|
|
162
|
-
return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);
|
|
163
|
-
}
|
|
164
|
-
function getResolveToMatches(matches, v7_relativeSplatPath) {
|
|
165
|
-
let pathMatches = getPathContributingMatches(matches);
|
|
166
|
-
if (v7_relativeSplatPath) {
|
|
167
|
-
return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);
|
|
168
|
-
}
|
|
169
|
-
return pathMatches.map((match) => match.pathnameBase);
|
|
170
|
-
}
|
|
171
|
-
function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {
|
|
172
|
-
if (isPathRelative === void 0) {
|
|
173
|
-
isPathRelative = false;
|
|
174
|
-
}
|
|
175
|
-
let to;
|
|
176
|
-
if (typeof toArg === "string") {
|
|
177
|
-
to = parsePath(toArg);
|
|
178
|
-
} else {
|
|
179
|
-
to = _extends({}, toArg);
|
|
180
|
-
invariant(!to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to));
|
|
181
|
-
invariant(!to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to));
|
|
182
|
-
invariant(!to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to));
|
|
183
|
-
}
|
|
184
|
-
let isEmptyPath = toArg === "" || to.pathname === "";
|
|
185
|
-
let toPathname = isEmptyPath ? "/" : to.pathname;
|
|
186
|
-
let from;
|
|
187
|
-
if (toPathname == null) {
|
|
188
|
-
from = locationPathname;
|
|
189
|
-
} else {
|
|
190
|
-
let routePathnameIndex = routePathnames.length - 1;
|
|
191
|
-
if (!isPathRelative && toPathname.startsWith("..")) {
|
|
192
|
-
let toSegments = toPathname.split("/");
|
|
193
|
-
while (toSegments[0] === "..") {
|
|
194
|
-
toSegments.shift();
|
|
195
|
-
routePathnameIndex -= 1;
|
|
196
|
-
}
|
|
197
|
-
to.pathname = toSegments.join("/");
|
|
198
|
-
}
|
|
199
|
-
from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
|
|
200
|
-
}
|
|
201
|
-
let path = resolvePath(to, from);
|
|
202
|
-
let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
|
|
203
|
-
let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
|
|
204
|
-
if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
|
|
205
|
-
path.pathname += "/";
|
|
206
|
-
}
|
|
207
|
-
return path;
|
|
208
|
-
}
|
|
209
|
-
var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
|
|
210
|
-
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
|
211
|
-
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
|
212
|
-
var validMutationMethodsArr = ["post", "put", "patch", "delete"];
|
|
213
|
-
var validMutationMethods = new Set(validMutationMethodsArr);
|
|
214
|
-
var validRequestMethodsArr = ["get", ...validMutationMethodsArr];
|
|
215
|
-
var validRequestMethods = new Set(validRequestMethodsArr);
|
|
216
|
-
var UNSAFE_DEFERRED_SYMBOL = Symbol("deferred");
|
|
217
44
|
|
|
218
|
-
//
|
|
219
|
-
|
|
220
|
-
_extends2 = Object.assign ? Object.assign.bind() : function(target) {
|
|
221
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
222
|
-
var source = arguments[i];
|
|
223
|
-
for (var key in source) {
|
|
224
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
225
|
-
target[key] = source[key];
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
return target;
|
|
230
|
-
};
|
|
231
|
-
return _extends2.apply(this, arguments);
|
|
232
|
-
}
|
|
233
|
-
var DataRouterContext = /* @__PURE__ */ React2.createContext(null);
|
|
234
|
-
if (false) {
|
|
235
|
-
DataRouterContext.displayName = "DataRouter";
|
|
236
|
-
}
|
|
237
|
-
if (false) {
|
|
238
|
-
DataRouterStateContext.displayName = "DataRouterState";
|
|
239
|
-
}
|
|
240
|
-
if (false) {
|
|
241
|
-
AwaitContext.displayName = "Await";
|
|
242
|
-
}
|
|
243
|
-
var NavigationContext = /* @__PURE__ */ React2.createContext(null);
|
|
244
|
-
if (false) {
|
|
245
|
-
NavigationContext.displayName = "Navigation";
|
|
246
|
-
}
|
|
247
|
-
var LocationContext = /* @__PURE__ */ React2.createContext(null);
|
|
248
|
-
if (false) {
|
|
249
|
-
LocationContext.displayName = "Location";
|
|
250
|
-
}
|
|
251
|
-
var RouteContext = /* @__PURE__ */ React2.createContext({
|
|
252
|
-
outlet: null,
|
|
253
|
-
matches: [],
|
|
254
|
-
isDataRoute: false
|
|
255
|
-
});
|
|
256
|
-
if (false) {
|
|
257
|
-
RouteContext.displayName = "Route";
|
|
258
|
-
}
|
|
259
|
-
if (false) {
|
|
260
|
-
RouteErrorContext.displayName = "RouteError";
|
|
261
|
-
}
|
|
262
|
-
function useInRouterContext() {
|
|
263
|
-
return React2.useContext(LocationContext) != null;
|
|
264
|
-
}
|
|
265
|
-
function useLocation() {
|
|
266
|
-
!useInRouterContext() ? false ? invariant(
|
|
267
|
-
false,
|
|
268
|
-
// TODO: This error is probably because they somehow have 2 versions of the
|
|
269
|
-
// router loaded. We can help them understand how to avoid that.
|
|
270
|
-
"useLocation() may be used only in the context of a <Router> component."
|
|
271
|
-
) : invariant(false) : void 0;
|
|
272
|
-
return React2.useContext(LocationContext).location;
|
|
273
|
-
}
|
|
274
|
-
function useIsomorphicLayoutEffect(cb) {
|
|
275
|
-
let isStatic = React2.useContext(NavigationContext).static;
|
|
276
|
-
if (!isStatic) {
|
|
277
|
-
React2.useLayoutEffect(cb);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
function useNavigate() {
|
|
281
|
-
let {
|
|
282
|
-
isDataRoute
|
|
283
|
-
} = React2.useContext(RouteContext);
|
|
284
|
-
return isDataRoute ? useNavigateStable() : useNavigateUnstable();
|
|
285
|
-
}
|
|
286
|
-
function useNavigateUnstable() {
|
|
287
|
-
!useInRouterContext() ? false ? invariant(
|
|
288
|
-
false,
|
|
289
|
-
// TODO: This error is probably because they somehow have 2 versions of the
|
|
290
|
-
// router loaded. We can help them understand how to avoid that.
|
|
291
|
-
"useNavigate() may be used only in the context of a <Router> component."
|
|
292
|
-
) : invariant(false) : void 0;
|
|
293
|
-
let dataRouterContext = React2.useContext(DataRouterContext);
|
|
294
|
-
let {
|
|
295
|
-
basename,
|
|
296
|
-
future,
|
|
297
|
-
navigator: navigator2
|
|
298
|
-
} = React2.useContext(NavigationContext);
|
|
299
|
-
let {
|
|
300
|
-
matches
|
|
301
|
-
} = React2.useContext(RouteContext);
|
|
302
|
-
let {
|
|
303
|
-
pathname: locationPathname
|
|
304
|
-
} = useLocation();
|
|
305
|
-
let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath));
|
|
306
|
-
let activeRef = React2.useRef(false);
|
|
307
|
-
useIsomorphicLayoutEffect(() => {
|
|
308
|
-
activeRef.current = true;
|
|
309
|
-
});
|
|
310
|
-
let navigate = React2.useCallback(function(to, options) {
|
|
311
|
-
if (options === void 0) {
|
|
312
|
-
options = {};
|
|
313
|
-
}
|
|
314
|
-
false ? warning(activeRef.current, navigateEffectWarning) : void 0;
|
|
315
|
-
if (!activeRef.current)
|
|
316
|
-
return;
|
|
317
|
-
if (typeof to === "number") {
|
|
318
|
-
navigator2.go(to);
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path");
|
|
322
|
-
if (dataRouterContext == null && basename !== "/") {
|
|
323
|
-
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
324
|
-
}
|
|
325
|
-
(!!options.replace ? navigator2.replace : navigator2.push)(path, options.state, options);
|
|
326
|
-
}, [basename, navigator2, routePathnamesJson, locationPathname, dataRouterContext]);
|
|
327
|
-
return navigate;
|
|
328
|
-
}
|
|
329
|
-
var DataRouterHook = /* @__PURE__ */ function(DataRouterHook3) {
|
|
330
|
-
DataRouterHook3["UseBlocker"] = "useBlocker";
|
|
331
|
-
DataRouterHook3["UseRevalidator"] = "useRevalidator";
|
|
332
|
-
DataRouterHook3["UseNavigateStable"] = "useNavigate";
|
|
333
|
-
return DataRouterHook3;
|
|
334
|
-
}(DataRouterHook || {});
|
|
335
|
-
var DataRouterStateHook = /* @__PURE__ */ function(DataRouterStateHook3) {
|
|
336
|
-
DataRouterStateHook3["UseBlocker"] = "useBlocker";
|
|
337
|
-
DataRouterStateHook3["UseLoaderData"] = "useLoaderData";
|
|
338
|
-
DataRouterStateHook3["UseActionData"] = "useActionData";
|
|
339
|
-
DataRouterStateHook3["UseRouteError"] = "useRouteError";
|
|
340
|
-
DataRouterStateHook3["UseNavigation"] = "useNavigation";
|
|
341
|
-
DataRouterStateHook3["UseRouteLoaderData"] = "useRouteLoaderData";
|
|
342
|
-
DataRouterStateHook3["UseMatches"] = "useMatches";
|
|
343
|
-
DataRouterStateHook3["UseRevalidator"] = "useRevalidator";
|
|
344
|
-
DataRouterStateHook3["UseNavigateStable"] = "useNavigate";
|
|
345
|
-
DataRouterStateHook3["UseRouteId"] = "useRouteId";
|
|
346
|
-
return DataRouterStateHook3;
|
|
347
|
-
}(DataRouterStateHook || {});
|
|
348
|
-
function useDataRouterContext(hookName) {
|
|
349
|
-
let ctx = React2.useContext(DataRouterContext);
|
|
350
|
-
!ctx ? false ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
|
|
351
|
-
return ctx;
|
|
352
|
-
}
|
|
353
|
-
function useRouteContext(hookName) {
|
|
354
|
-
let route = React2.useContext(RouteContext);
|
|
355
|
-
!route ? false ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
|
|
356
|
-
return route;
|
|
357
|
-
}
|
|
358
|
-
function useCurrentRouteId(hookName) {
|
|
359
|
-
let route = useRouteContext(hookName);
|
|
360
|
-
let thisRoute = route.matches[route.matches.length - 1];
|
|
361
|
-
!thisRoute.route.id ? false ? invariant(false, hookName + ' can only be used on routes that contain a unique "id"') : invariant(false) : void 0;
|
|
362
|
-
return thisRoute.route.id;
|
|
363
|
-
}
|
|
364
|
-
function useNavigateStable() {
|
|
365
|
-
let {
|
|
366
|
-
router
|
|
367
|
-
} = useDataRouterContext(DataRouterHook.UseNavigateStable);
|
|
368
|
-
let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);
|
|
369
|
-
let activeRef = React2.useRef(false);
|
|
370
|
-
useIsomorphicLayoutEffect(() => {
|
|
371
|
-
activeRef.current = true;
|
|
372
|
-
});
|
|
373
|
-
let navigate = React2.useCallback(function(to, options) {
|
|
374
|
-
if (options === void 0) {
|
|
375
|
-
options = {};
|
|
376
|
-
}
|
|
377
|
-
false ? warning(activeRef.current, navigateEffectWarning) : void 0;
|
|
378
|
-
if (!activeRef.current)
|
|
379
|
-
return;
|
|
380
|
-
if (typeof to === "number") {
|
|
381
|
-
router.navigate(to);
|
|
382
|
-
} else {
|
|
383
|
-
router.navigate(to, _extends2({
|
|
384
|
-
fromRouteId: id
|
|
385
|
-
}, options));
|
|
386
|
-
}
|
|
387
|
-
}, [router, id]);
|
|
388
|
-
return navigate;
|
|
389
|
-
}
|
|
390
|
-
var START_TRANSITION = "startTransition";
|
|
391
|
-
var startTransitionImpl = React2[START_TRANSITION];
|
|
392
|
-
var neverSettledPromise = new Promise(() => {
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
// node_modules/.pnpm/react-router-dom@6.30.3_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-router-dom/dist/index.js
|
|
396
|
-
var REACT_ROUTER_VERSION = "6";
|
|
397
|
-
try {
|
|
398
|
-
window.__reactRouterVersion = REACT_ROUTER_VERSION;
|
|
399
|
-
} catch (e) {
|
|
400
|
-
}
|
|
401
|
-
if (false) {
|
|
402
|
-
ViewTransitionContext.displayName = "ViewTransition";
|
|
403
|
-
}
|
|
404
|
-
if (false) {
|
|
405
|
-
FetchersContext.displayName = "Fetchers";
|
|
406
|
-
}
|
|
407
|
-
var START_TRANSITION2 = "startTransition";
|
|
408
|
-
var startTransitionImpl2 = React3[START_TRANSITION2];
|
|
409
|
-
var FLUSH_SYNC = "flushSync";
|
|
410
|
-
var flushSyncImpl = ReactDOM[FLUSH_SYNC];
|
|
411
|
-
var USE_ID = "useId";
|
|
412
|
-
var useIdImpl = React3[USE_ID];
|
|
413
|
-
if (false) {
|
|
414
|
-
HistoryRouter.displayName = "unstable_HistoryRouter";
|
|
415
|
-
}
|
|
416
|
-
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
417
|
-
if (false) {
|
|
418
|
-
Link.displayName = "Link";
|
|
419
|
-
}
|
|
420
|
-
if (false) {
|
|
421
|
-
NavLink.displayName = "NavLink";
|
|
422
|
-
}
|
|
423
|
-
if (false) {
|
|
424
|
-
Form.displayName = "Form";
|
|
425
|
-
}
|
|
426
|
-
if (false) {
|
|
427
|
-
ScrollRestoration.displayName = "ScrollRestoration";
|
|
428
|
-
}
|
|
429
|
-
var DataRouterHook2;
|
|
430
|
-
(function(DataRouterHook3) {
|
|
431
|
-
DataRouterHook3["UseScrollRestoration"] = "useScrollRestoration";
|
|
432
|
-
DataRouterHook3["UseSubmit"] = "useSubmit";
|
|
433
|
-
DataRouterHook3["UseSubmitFetcher"] = "useSubmitFetcher";
|
|
434
|
-
DataRouterHook3["UseFetcher"] = "useFetcher";
|
|
435
|
-
DataRouterHook3["useViewTransitionState"] = "useViewTransitionState";
|
|
436
|
-
})(DataRouterHook2 || (DataRouterHook2 = {}));
|
|
437
|
-
var DataRouterStateHook2;
|
|
438
|
-
(function(DataRouterStateHook3) {
|
|
439
|
-
DataRouterStateHook3["UseFetcher"] = "useFetcher";
|
|
440
|
-
DataRouterStateHook3["UseFetchers"] = "useFetchers";
|
|
441
|
-
DataRouterStateHook3["UseScrollRestoration"] = "useScrollRestoration";
|
|
442
|
-
})(DataRouterStateHook2 || (DataRouterStateHook2 = {}));
|
|
45
|
+
// src/context/AuthContext.tsx
|
|
46
|
+
import { createContext as createContext2, use as use2, useEffect as useEffect2, useState as useState2 } from "react";
|
|
443
47
|
|
|
444
48
|
// node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/helpers/bind.js
|
|
445
49
|
function bind(fn, thisArg) {
|
|
@@ -2275,9 +1879,9 @@ var trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
2275
1879
|
// node_modules/.pnpm/axios@1.13.4/node_modules/axios/lib/adapters/fetch.js
|
|
2276
1880
|
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
2277
1881
|
var { isFunction: isFunction2 } = utils_default;
|
|
2278
|
-
var globalFetchAPI = (({ Request
|
|
2279
|
-
Request
|
|
2280
|
-
Response
|
|
1882
|
+
var globalFetchAPI = (({ Request, Response }) => ({
|
|
1883
|
+
Request,
|
|
1884
|
+
Response
|
|
2281
1885
|
}))(utils_default.global);
|
|
2282
1886
|
var {
|
|
2283
1887
|
ReadableStream: ReadableStream2,
|
|
@@ -2294,18 +1898,18 @@ var factory = (env) => {
|
|
|
2294
1898
|
env = utils_default.merge.call({
|
|
2295
1899
|
skipUndefined: true
|
|
2296
1900
|
}, globalFetchAPI, env);
|
|
2297
|
-
const { fetch: envFetch, Request
|
|
1901
|
+
const { fetch: envFetch, Request, Response } = env;
|
|
2298
1902
|
const isFetchSupported = envFetch ? isFunction2(envFetch) : typeof fetch === "function";
|
|
2299
|
-
const isRequestSupported = isFunction2(
|
|
2300
|
-
const isResponseSupported = isFunction2(
|
|
1903
|
+
const isRequestSupported = isFunction2(Request);
|
|
1904
|
+
const isResponseSupported = isFunction2(Response);
|
|
2301
1905
|
if (!isFetchSupported) {
|
|
2302
1906
|
return false;
|
|
2303
1907
|
}
|
|
2304
1908
|
const isReadableStreamSupported = isFetchSupported && isFunction2(ReadableStream2);
|
|
2305
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new
|
|
1909
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
2306
1910
|
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
2307
1911
|
let duplexAccessed = false;
|
|
2308
|
-
const hasContentType = new
|
|
1912
|
+
const hasContentType = new Request(platform_default.origin, {
|
|
2309
1913
|
body: new ReadableStream2(),
|
|
2310
1914
|
method: "POST",
|
|
2311
1915
|
get duplex() {
|
|
@@ -2315,7 +1919,7 @@ var factory = (env) => {
|
|
|
2315
1919
|
}).headers.has("Content-Type");
|
|
2316
1920
|
return duplexAccessed && !hasContentType;
|
|
2317
1921
|
});
|
|
2318
|
-
const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils_default.isReadableStream(new
|
|
1922
|
+
const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
|
|
2319
1923
|
const resolvers = {
|
|
2320
1924
|
stream: supportsResponseStream && ((res) => res.body)
|
|
2321
1925
|
};
|
|
@@ -2338,7 +1942,7 @@ var factory = (env) => {
|
|
|
2338
1942
|
return body.size;
|
|
2339
1943
|
}
|
|
2340
1944
|
if (utils_default.isSpecCompliantForm(body)) {
|
|
2341
|
-
const _request = new
|
|
1945
|
+
const _request = new Request(platform_default.origin, {
|
|
2342
1946
|
method: "POST",
|
|
2343
1947
|
body
|
|
2344
1948
|
});
|
|
@@ -2383,7 +1987,7 @@ var factory = (env) => {
|
|
|
2383
1987
|
let requestContentLength;
|
|
2384
1988
|
try {
|
|
2385
1989
|
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
|
|
2386
|
-
let _request = new
|
|
1990
|
+
let _request = new Request(url, {
|
|
2387
1991
|
method: "POST",
|
|
2388
1992
|
body: data,
|
|
2389
1993
|
duplex: "half"
|
|
@@ -2403,7 +2007,7 @@ var factory = (env) => {
|
|
|
2403
2007
|
if (!utils_default.isString(withCredentials)) {
|
|
2404
2008
|
withCredentials = withCredentials ? "include" : "omit";
|
|
2405
2009
|
}
|
|
2406
|
-
const isCredentialsSupported = isRequestSupported && "credentials" in
|
|
2010
|
+
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
2407
2011
|
const resolvedOptions = {
|
|
2408
2012
|
...fetchOptions,
|
|
2409
2013
|
signal: composedSignal,
|
|
@@ -2413,7 +2017,7 @@ var factory = (env) => {
|
|
|
2413
2017
|
duplex: "half",
|
|
2414
2018
|
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
2415
2019
|
};
|
|
2416
|
-
request = isRequestSupported && new
|
|
2020
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
2417
2021
|
let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
|
|
2418
2022
|
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
2419
2023
|
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
@@ -2426,7 +2030,7 @@ var factory = (env) => {
|
|
|
2426
2030
|
responseContentLength,
|
|
2427
2031
|
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
2428
2032
|
) || [];
|
|
2429
|
-
response = new
|
|
2033
|
+
response = new Response(
|
|
2430
2034
|
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
2431
2035
|
flush && flush();
|
|
2432
2036
|
unsubscribe && unsubscribe();
|
|
@@ -2464,10 +2068,10 @@ var factory = (env) => {
|
|
|
2464
2068
|
var seedCache = /* @__PURE__ */ new Map();
|
|
2465
2069
|
var getFetch = (config) => {
|
|
2466
2070
|
let env = config && config.env || {};
|
|
2467
|
-
const { fetch: fetch2, Request
|
|
2071
|
+
const { fetch: fetch2, Request, Response } = env;
|
|
2468
2072
|
const seeds = [
|
|
2469
|
-
|
|
2470
|
-
|
|
2073
|
+
Request,
|
|
2074
|
+
Response,
|
|
2471
2075
|
fetch2
|
|
2472
2076
|
];
|
|
2473
2077
|
let len = seeds.length, i = len, seed, target, map = seedCache;
|
|
@@ -3224,69 +2828,6 @@ var authService = {
|
|
|
3224
2828
|
}
|
|
3225
2829
|
};
|
|
3226
2830
|
|
|
3227
|
-
// src/services/loadRemoteModule.ts
|
|
3228
|
-
import * as React4 from "react";
|
|
3229
|
-
import * as ReactDOM2 from "react-dom";
|
|
3230
|
-
|
|
3231
|
-
// src/services/metadataLoader.ts
|
|
3232
|
-
var MetadataLoader = class {
|
|
3233
|
-
constructor() {
|
|
3234
|
-
__publicField(this, "metadataCache", /* @__PURE__ */ new Map());
|
|
3235
|
-
}
|
|
3236
|
-
async loadMetadata(metadataUrl) {
|
|
3237
|
-
if (this.metadataCache.has(metadataUrl)) {
|
|
3238
|
-
return this.metadataCache.get(metadataUrl) || [];
|
|
3239
|
-
}
|
|
3240
|
-
try {
|
|
3241
|
-
const response = await fetch(metadataUrl);
|
|
3242
|
-
console.log(response);
|
|
3243
|
-
if (!response.ok) {
|
|
3244
|
-
throw new Error(`Failed to fetch metadata: ${response.statusText}`);
|
|
3245
|
-
}
|
|
3246
|
-
const data = await response.json();
|
|
3247
|
-
let metadata;
|
|
3248
|
-
if (Array.isArray(data)) {
|
|
3249
|
-
metadata = data;
|
|
3250
|
-
} else if (data.pages && Array.isArray(data.pages)) {
|
|
3251
|
-
metadata = data.pages;
|
|
3252
|
-
} else {
|
|
3253
|
-
throw new Error(
|
|
3254
|
-
"Invalid metadata format: expected array or object with pages property"
|
|
3255
|
-
);
|
|
3256
|
-
}
|
|
3257
|
-
metadata.forEach((page, index) => {
|
|
3258
|
-
if (!page.id || !page.name || !page.path || !page.url) {
|
|
3259
|
-
throw new Error(
|
|
3260
|
-
`Invalid page metadata at index ${index}: missing required fields`
|
|
3261
|
-
);
|
|
3262
|
-
}
|
|
3263
|
-
});
|
|
3264
|
-
this.metadataCache.set(metadataUrl, metadata);
|
|
3265
|
-
return metadata;
|
|
3266
|
-
} catch (error) {
|
|
3267
|
-
console.warn(`Failed to load metadata from ${metadataUrl}:`, error);
|
|
3268
|
-
return [];
|
|
3269
|
-
}
|
|
3270
|
-
}
|
|
3271
|
-
async loadFromDirectory(directoryUrl) {
|
|
3272
|
-
try {
|
|
3273
|
-
const manifestUrl = `${directoryUrl}/manifest.json`;
|
|
3274
|
-
return await this.loadMetadata(manifestUrl);
|
|
3275
|
-
} catch (error) {
|
|
3276
|
-
throw new Error(
|
|
3277
|
-
`Directory manifest not found at ${directoryUrl}/manifest.json: ${error}`
|
|
3278
|
-
);
|
|
3279
|
-
}
|
|
3280
|
-
}
|
|
3281
|
-
clearCache() {
|
|
3282
|
-
this.metadataCache.clear();
|
|
3283
|
-
}
|
|
3284
|
-
getCachedMetadata(metadataUrl) {
|
|
3285
|
-
return this.metadataCache.get(metadataUrl);
|
|
3286
|
-
}
|
|
3287
|
-
};
|
|
3288
|
-
var metadataLoader = new MetadataLoader();
|
|
3289
|
-
|
|
3290
2831
|
// src/services/registry.ts
|
|
3291
2832
|
var PluginRegistryImpl = class {
|
|
3292
2833
|
constructor() {
|
|
@@ -3370,21 +2911,28 @@ var hostConfigLoader = new HostConfigLoader();
|
|
|
3370
2911
|
|
|
3371
2912
|
// src/context/AuthContext.tsx
|
|
3372
2913
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
3373
|
-
var AuthContext =
|
|
3374
|
-
var AuthProvider = ({
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
2914
|
+
var AuthContext = createContext2(void 0);
|
|
2915
|
+
var AuthProvider = ({
|
|
2916
|
+
children,
|
|
2917
|
+
onNavigate,
|
|
2918
|
+
storage = typeof window !== "undefined" ? window.localStorage : null,
|
|
2919
|
+
authService: authService2 = authService,
|
|
2920
|
+
initialUser = null,
|
|
2921
|
+
initialAccessToken = null
|
|
2922
|
+
}) => {
|
|
2923
|
+
const [user, setUser] = useState2(initialUser);
|
|
2924
|
+
const [accessToken, setToken] = useState2(initialAccessToken ?? null);
|
|
2925
|
+
const [loading, setLoading] = useState2(true);
|
|
2926
|
+
useEffect2(() => {
|
|
3379
2927
|
try {
|
|
3380
|
-
const storedUser =
|
|
2928
|
+
const storedUser = storage?.getItem("user");
|
|
3381
2929
|
if (storedUser)
|
|
3382
2930
|
setUser(JSON.parse(storedUser));
|
|
3383
2931
|
} catch {
|
|
3384
2932
|
}
|
|
3385
2933
|
try {
|
|
3386
|
-
const savedAccess =
|
|
3387
|
-
const savedRefresh =
|
|
2934
|
+
const savedAccess = storage?.getItem("accessToken");
|
|
2935
|
+
const savedRefresh = storage?.getItem("refreshToken");
|
|
3388
2936
|
if (savedAccess) {
|
|
3389
2937
|
setToken(savedAccess);
|
|
3390
2938
|
setAccessToken(savedAccess);
|
|
@@ -3395,33 +2943,36 @@ var AuthProvider = ({ children }) => {
|
|
|
3395
2943
|
} catch {
|
|
3396
2944
|
}
|
|
3397
2945
|
setLoading(false);
|
|
3398
|
-
}, []);
|
|
3399
|
-
const navigate = useNavigate();
|
|
2946
|
+
}, [storage]);
|
|
3400
2947
|
const login = async (username, password, options) => {
|
|
3401
|
-
const resp = await
|
|
2948
|
+
const resp = await authService2.login(username, password);
|
|
3402
2949
|
setToken(resp.accessToken);
|
|
3403
2950
|
setAccessToken(resp.accessToken);
|
|
3404
2951
|
setRefreshToken(resp.refreshToken);
|
|
3405
2952
|
setUser(resp.user);
|
|
3406
2953
|
try {
|
|
3407
|
-
|
|
2954
|
+
storage?.setItem("user", JSON.stringify(resp.user));
|
|
2955
|
+
storage?.setItem("accessToken", resp.accessToken);
|
|
2956
|
+
storage?.setItem("refreshToken", resp.refreshToken);
|
|
3408
2957
|
} catch {
|
|
3409
2958
|
}
|
|
3410
2959
|
if (options?.redirect !== false)
|
|
3411
|
-
|
|
2960
|
+
onNavigate?.("/");
|
|
3412
2961
|
};
|
|
3413
2962
|
const logout = async () => {
|
|
3414
2963
|
try {
|
|
3415
|
-
await
|
|
2964
|
+
await authService2.logout();
|
|
3416
2965
|
} finally {
|
|
3417
2966
|
setToken(null);
|
|
3418
2967
|
clearTokens();
|
|
3419
2968
|
setUser(null);
|
|
3420
2969
|
try {
|
|
3421
|
-
|
|
2970
|
+
storage?.removeItem("user");
|
|
2971
|
+
storage?.removeItem("accessToken");
|
|
2972
|
+
storage?.removeItem("refreshToken");
|
|
3422
2973
|
} catch {
|
|
3423
2974
|
}
|
|
3424
|
-
|
|
2975
|
+
onNavigate?.("/login");
|
|
3425
2976
|
}
|
|
3426
2977
|
};
|
|
3427
2978
|
const hasRole = (roles) => {
|
|
@@ -3430,54 +2981,31 @@ var AuthProvider = ({ children }) => {
|
|
|
3430
2981
|
const want = Array.isArray(roles) ? roles : [roles];
|
|
3431
2982
|
return want.some((r) => user.role === r);
|
|
3432
2983
|
};
|
|
3433
|
-
return /* @__PURE__ */ jsx2(AuthContext
|
|
2984
|
+
return /* @__PURE__ */ jsx2(AuthContext, { value: { user, accessToken, loading, login, logout, hasRole }, children });
|
|
3434
2985
|
};
|
|
3435
2986
|
function useAuth() {
|
|
3436
|
-
const ctx =
|
|
2987
|
+
const ctx = use2(AuthContext);
|
|
3437
2988
|
if (!ctx)
|
|
3438
2989
|
throw new Error("useAuth must be used within AuthProvider");
|
|
3439
2990
|
return ctx;
|
|
3440
2991
|
}
|
|
2992
|
+
|
|
2993
|
+
// src/context/SharedUiProvider.tsx
|
|
2994
|
+
import React3 from "react";
|
|
2995
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
2996
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
2997
|
+
function SharedUiProvider({ children, client }) {
|
|
2998
|
+
const ref = React3.useRef(null);
|
|
2999
|
+
if (!ref.current)
|
|
3000
|
+
ref.current = client ?? new QueryClient();
|
|
3001
|
+
const internal = ref.current;
|
|
3002
|
+
return /* @__PURE__ */ jsx3(QueryClientProvider, { client: internal, children });
|
|
3003
|
+
}
|
|
3441
3004
|
export {
|
|
3005
|
+
AuthContext,
|
|
3442
3006
|
AuthProvider,
|
|
3007
|
+
SharedUiProvider,
|
|
3008
|
+
ThemeContext,
|
|
3443
3009
|
ThemeProvider,
|
|
3444
3010
|
useAuth
|
|
3445
3011
|
};
|
|
3446
|
-
/*! Bundled license information:
|
|
3447
|
-
|
|
3448
|
-
@remix-run/router/dist/router.js:
|
|
3449
|
-
(**
|
|
3450
|
-
* @remix-run/router v1.23.2
|
|
3451
|
-
*
|
|
3452
|
-
* Copyright (c) Remix Software Inc.
|
|
3453
|
-
*
|
|
3454
|
-
* This source code is licensed under the MIT license found in the
|
|
3455
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
3456
|
-
*
|
|
3457
|
-
* @license MIT
|
|
3458
|
-
*)
|
|
3459
|
-
|
|
3460
|
-
react-router/dist/index.js:
|
|
3461
|
-
(**
|
|
3462
|
-
* React Router v6.30.3
|
|
3463
|
-
*
|
|
3464
|
-
* Copyright (c) Remix Software Inc.
|
|
3465
|
-
*
|
|
3466
|
-
* This source code is licensed under the MIT license found in the
|
|
3467
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
3468
|
-
*
|
|
3469
|
-
* @license MIT
|
|
3470
|
-
*)
|
|
3471
|
-
|
|
3472
|
-
react-router-dom/dist/index.js:
|
|
3473
|
-
(**
|
|
3474
|
-
* React Router DOM v6.30.3
|
|
3475
|
-
*
|
|
3476
|
-
* Copyright (c) Remix Software Inc.
|
|
3477
|
-
*
|
|
3478
|
-
* This source code is licensed under the MIT license found in the
|
|
3479
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
3480
|
-
*
|
|
3481
|
-
* @license MIT
|
|
3482
|
-
*)
|
|
3483
|
-
*/
|