@vef-framework/starter 1.0.97 → 1.0.99
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/es/api.js +14 -2
- package/es/app.js +24 -2
- package/es/components/index.js +8 -2
- package/es/components/vef-access-denied-page/index.js +22 -2
- package/es/components/vef-app/index.js +14 -2
- package/es/components/vef-dev-assistant/index.js +128 -5
- package/es/components/vef-error-page/index.js +19 -2
- package/es/components/vef-login-page/index.js +36 -2
- package/es/components/vef-not-found-page/index.js +21 -2
- package/es/components/vef-router-provider/index.js +17 -2
- package/es/constants.js +9 -2
- package/es/helper.js +19 -2
- package/es/index.js +20 -2
- package/es/router.js +69 -2
- package/es/routes/access-denied.js +11 -2
- package/es/routes/index.js +5 -2
- package/es/routes/layout.js +133 -2
- package/es/routes/login.js +28 -2
- package/es/routes/root.js +21 -2
- package/es/store.js +18 -2
- package/lib/api.cjs +18 -2
- package/lib/app.cjs +28 -2
- package/lib/components/index.cjs +22 -2
- package/lib/components/vef-access-denied-page/index.cjs +26 -2
- package/lib/components/vef-access-denied-page/props.cjs +4 -2
- package/lib/components/vef-app/index.cjs +18 -2
- package/lib/components/vef-app/props.cjs +4 -2
- package/lib/components/vef-dev-assistant/index.cjs +132 -5
- package/lib/components/vef-dev-assistant/props.cjs +4 -2
- package/lib/components/vef-error-page/index.cjs +23 -2
- package/lib/components/vef-error-page/props.cjs +4 -2
- package/lib/components/vef-login-page/index.cjs +40 -2
- package/lib/components/vef-login-page/props.cjs +4 -2
- package/lib/components/vef-not-found-page/index.cjs +25 -2
- package/lib/components/vef-not-found-page/props.cjs +4 -2
- package/lib/components/vef-router-provider/index.cjs +21 -2
- package/lib/components/vef-router-provider/props.cjs +4 -2
- package/lib/constants.cjs +18 -2
- package/lib/helper.cjs +23 -2
- package/lib/index.cjs +49 -2
- package/lib/router.cjs +73 -2
- package/lib/routes/access-denied.cjs +15 -2
- package/lib/routes/index.cjs +16 -2
- package/lib/routes/layout.cjs +137 -2
- package/lib/routes/login.cjs +32 -2
- package/lib/routes/root.cjs +25 -2
- package/lib/store.cjs +22 -2
- package/package.json +7 -7
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
7
|
+
const reactRouter = require('@tanstack/react-router');
|
|
8
|
+
const components = require('@vef-framework/components');
|
|
9
|
+
const react = require('react');
|
|
10
|
+
const constants = require('../../constants.cjs');
|
|
11
|
+
|
|
12
|
+
function VefNotFoundPage() {
|
|
13
|
+
const navigate = reactRouter.useNavigate();
|
|
14
|
+
const handleNavigateHome = react.useCallback(
|
|
15
|
+
() => navigate({
|
|
16
|
+
to: constants.INDEX_PAGE_PATH,
|
|
17
|
+
replace: true
|
|
18
|
+
}),
|
|
19
|
+
[navigate]
|
|
20
|
+
);
|
|
21
|
+
const { pathname } = reactRouter.useLocation();
|
|
22
|
+
return /* @__PURE__ */ jsxRuntime.jsx(components.VefNotFound, { uri: pathname, onNavigateHome: handleNavigateHome });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.default = VefNotFoundPage;
|
|
3
26
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
|
|
3
5
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
7
|
+
const reactRouter = require('@tanstack/react-router');
|
|
8
|
+
const core = require('@vef-framework/core');
|
|
9
|
+
const react = require('react');
|
|
10
|
+
|
|
11
|
+
function VefRouterProvider({
|
|
12
|
+
router
|
|
13
|
+
}) {
|
|
14
|
+
const { fetchAuthenticatedUserApi } = core.useApiContext();
|
|
15
|
+
const context = react.useMemo(() => ({
|
|
16
|
+
fetchAuthenticatedUserApi
|
|
17
|
+
}), [fetchAuthenticatedUserApi]);
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouter.RouterProvider, { context, router });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
exports.default = VefRouterProvider;
|
|
3
22
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
|
|
3
5
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/constants.cjs
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const LOGIN_PAGE_PATH = "/login";
|
|
7
|
+
const LOGIN_PAGE_ROUTE = "/_common/login";
|
|
8
|
+
const INDEX_PAGE_PATH = "/";
|
|
9
|
+
const INDEX_PAGE_ROUTE = "/_layout";
|
|
10
|
+
const ACCESS_DENIED_PAGE_PATH = "/access-denied";
|
|
11
|
+
const ACCESS_DENIED_PAGE_ROUTE = "/_common/access-denied";
|
|
12
|
+
|
|
13
|
+
exports.ACCESS_DENIED_PAGE_PATH = ACCESS_DENIED_PAGE_PATH;
|
|
14
|
+
exports.ACCESS_DENIED_PAGE_ROUTE = ACCESS_DENIED_PAGE_ROUTE;
|
|
15
|
+
exports.INDEX_PAGE_PATH = INDEX_PAGE_PATH;
|
|
16
|
+
exports.INDEX_PAGE_ROUTE = INDEX_PAGE_ROUTE;
|
|
17
|
+
exports.LOGIN_PAGE_PATH = LOGIN_PAGE_PATH;
|
|
18
|
+
exports.LOGIN_PAGE_ROUTE = LOGIN_PAGE_ROUTE;
|
|
3
19
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/helper.cjs
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const constants = require('./constants.cjs');
|
|
7
|
+
const store = require('./store.cjs');
|
|
8
|
+
|
|
9
|
+
async function handleClientLogout(router, fetchAuthenticatedUserApi) {
|
|
10
|
+
await fetchAuthenticatedUserApi.invalidateQueries();
|
|
11
|
+
store.useAppStore.setState(
|
|
12
|
+
{
|
|
13
|
+
isAuthenticated: false
|
|
14
|
+
},
|
|
15
|
+
true
|
|
16
|
+
);
|
|
17
|
+
await router.invalidate();
|
|
18
|
+
await router.navigate({
|
|
19
|
+
to: constants.LOGIN_PAGE_PATH
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exports.handleClientLogout = handleClientLogout;
|
|
3
24
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/index.cjs
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const api = require('./api.cjs');
|
|
7
|
+
const app = require('./app.cjs');
|
|
8
|
+
require('./components/index.cjs');
|
|
9
|
+
const constants = require('./constants.cjs');
|
|
10
|
+
const helper = require('./helper.cjs');
|
|
11
|
+
const router = require('./router.cjs');
|
|
12
|
+
require('./routes/index.cjs');
|
|
13
|
+
const store = require('./store.cjs');
|
|
14
|
+
const index = require('./components/vef-access-denied-page/index.cjs');
|
|
15
|
+
const index$1 = require('./components/vef-app/index.cjs');
|
|
16
|
+
const index$2 = require('./components/vef-dev-assistant/index.cjs');
|
|
17
|
+
const index$3 = require('./components/vef-error-page/index.cjs');
|
|
18
|
+
const index$4 = require('./components/vef-login-page/index.cjs');
|
|
19
|
+
const index$5 = require('./components/vef-not-found-page/index.cjs');
|
|
20
|
+
const index$6 = require('./components/vef-router-provider/index.cjs');
|
|
21
|
+
const accessDenied = require('./routes/access-denied.cjs');
|
|
22
|
+
const layout = require('./routes/layout.cjs');
|
|
23
|
+
const login = require('./routes/login.cjs');
|
|
24
|
+
const root = require('./routes/root.cjs');
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
exports.createApiClient = api.createApiClient;
|
|
29
|
+
exports.createApp = app.createApp;
|
|
30
|
+
exports.ACCESS_DENIED_PAGE_PATH = constants.ACCESS_DENIED_PAGE_PATH;
|
|
31
|
+
exports.ACCESS_DENIED_PAGE_ROUTE = constants.ACCESS_DENIED_PAGE_ROUTE;
|
|
32
|
+
exports.INDEX_PAGE_PATH = constants.INDEX_PAGE_PATH;
|
|
33
|
+
exports.INDEX_PAGE_ROUTE = constants.INDEX_PAGE_ROUTE;
|
|
34
|
+
exports.LOGIN_PAGE_PATH = constants.LOGIN_PAGE_PATH;
|
|
35
|
+
exports.LOGIN_PAGE_ROUTE = constants.LOGIN_PAGE_ROUTE;
|
|
36
|
+
exports.handleClientLogout = helper.handleClientLogout;
|
|
37
|
+
exports.createRouter = router.createRouter;
|
|
38
|
+
exports.useAppStore = store.useAppStore;
|
|
39
|
+
exports.VefAccessDeniedPage = index.default;
|
|
40
|
+
exports.VefApp = index$1.default;
|
|
41
|
+
exports.VefDevAssistant = index$2.default;
|
|
42
|
+
exports.VefErrorPage = index$3.default;
|
|
43
|
+
exports.VefLoginPage = index$4.default;
|
|
44
|
+
exports.VefNotFoundPage = index$5.default;
|
|
45
|
+
exports.VefRouterProvider = index$6.default;
|
|
46
|
+
exports.createAccessDeniedRouteOptions = accessDenied.createAccessDeniedRouteOptions;
|
|
47
|
+
exports.createLayoutRouteOptions = layout.createLayoutRouteOptions;
|
|
48
|
+
exports.createLoginRouteOptions = login.createLoginRouteOptions;
|
|
49
|
+
exports.createRootRoute = root.createRootRoute;
|
|
3
50
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/router.cjs
CHANGED
|
@@ -1,3 +1,74 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const reactRouter = require('@tanstack/react-router');
|
|
7
|
+
const components = require('@vef-framework/components');
|
|
8
|
+
const shared = require('@vef-framework/shared');
|
|
9
|
+
const NProgress = require('nprogress');
|
|
10
|
+
const react = require('react');
|
|
11
|
+
|
|
12
|
+
const defaultGcTime = 10 * 60 * 1e3;
|
|
13
|
+
function createRouter({
|
|
14
|
+
routeTree,
|
|
15
|
+
history
|
|
16
|
+
}) {
|
|
17
|
+
const router = reactRouter.createRouter({
|
|
18
|
+
routeTree,
|
|
19
|
+
trailingSlash: "never",
|
|
20
|
+
caseSensitive: true,
|
|
21
|
+
history: history === "hash" ? reactRouter.createHashHistory() : reactRouter.createBrowserHistory(),
|
|
22
|
+
search: {
|
|
23
|
+
strict: true
|
|
24
|
+
},
|
|
25
|
+
notFoundMode: "root",
|
|
26
|
+
defaultPendingComponent: () => react.createElement(
|
|
27
|
+
components.VefLoadingPlaceholder,
|
|
28
|
+
{
|
|
29
|
+
size: "large"
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
defaultPendingMs: 500,
|
|
33
|
+
defaultPendingMinMs: 300,
|
|
34
|
+
defaultSsr: false,
|
|
35
|
+
defaultStructuralSharing: true,
|
|
36
|
+
defaultHashScrollIntoView: {
|
|
37
|
+
behavior: "smooth",
|
|
38
|
+
block: "start",
|
|
39
|
+
inline: "center"
|
|
40
|
+
},
|
|
41
|
+
defaultPreload: "intent",
|
|
42
|
+
defaultPreloadDelay: 50,
|
|
43
|
+
defaultPreloadGcTime: defaultGcTime,
|
|
44
|
+
defaultGcTime,
|
|
45
|
+
defaultOnCatch(error, errorInfo) {
|
|
46
|
+
shared.showErrorNotification(
|
|
47
|
+
error.message || error.name,
|
|
48
|
+
react.createElement(
|
|
49
|
+
components.VefText,
|
|
50
|
+
{
|
|
51
|
+
color: "error",
|
|
52
|
+
children: react.createElement("pre", {
|
|
53
|
+
style: {
|
|
54
|
+
maxHeight: "480px",
|
|
55
|
+
overflowY: "auto",
|
|
56
|
+
scrollbarWidth: "thin",
|
|
57
|
+
scrollbarColor: "rgba(0, 0, 0, 0.2) transparent"
|
|
58
|
+
},
|
|
59
|
+
children: error.stack || errorInfo.componentStack || "No stack trace available"
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
router.subscribe("onBeforeLoad", ({ pathChanged }) => pathChanged && NProgress.start());
|
|
67
|
+
router.subscribe("onLoad", () => {
|
|
68
|
+
NProgress.done();
|
|
69
|
+
});
|
|
70
|
+
return router;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
exports.createRouter = createRouter;
|
|
3
74
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
require('../components/index.cjs');
|
|
7
|
+
const index = require('../components/vef-access-denied-page/index.cjs');
|
|
8
|
+
|
|
9
|
+
function createAccessDeniedRouteOptions() {
|
|
10
|
+
return {
|
|
11
|
+
component: index.default
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.createAccessDeniedRouteOptions = createAccessDeniedRouteOptions;
|
|
3
16
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/routes/index.cjs
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const accessDenied = require('./access-denied.cjs');
|
|
7
|
+
const layout = require('./layout.cjs');
|
|
8
|
+
const login = require('./login.cjs');
|
|
9
|
+
const root = require('./root.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.createAccessDeniedRouteOptions = accessDenied.createAccessDeniedRouteOptions;
|
|
14
|
+
exports.createLayoutRouteOptions = layout.createLayoutRouteOptions;
|
|
15
|
+
exports.createLoginRouteOptions = login.createLoginRouteOptions;
|
|
16
|
+
exports.createRootRoute = root.createRootRoute;
|
|
3
17
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/routes/layout.cjs
CHANGED
|
@@ -1,3 +1,138 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
7
|
+
const reactRouter = require('@tanstack/react-router');
|
|
8
|
+
const components = require('@vef-framework/components');
|
|
9
|
+
const core = require('@vef-framework/core');
|
|
10
|
+
const shared = require('@vef-framework/shared');
|
|
11
|
+
const lucideReact = require('lucide-react');
|
|
12
|
+
const react = require('react');
|
|
13
|
+
const constants = require('../constants.cjs');
|
|
14
|
+
const helper = require('../helper.cjs');
|
|
15
|
+
const store = require('../store.cjs');
|
|
16
|
+
|
|
17
|
+
const indexBreadcrumbItem = {
|
|
18
|
+
key: constants.INDEX_PAGE_PATH,
|
|
19
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(components.VefIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.HomeIcon, {}) })
|
|
20
|
+
};
|
|
21
|
+
function createLayoutRouteOptions({
|
|
22
|
+
title,
|
|
23
|
+
logo,
|
|
24
|
+
getUserDescription
|
|
25
|
+
}) {
|
|
26
|
+
function LayoutComponent() {
|
|
27
|
+
const router = reactRouter.useRouter();
|
|
28
|
+
const navigate = reactRouter.useNavigate();
|
|
29
|
+
const { pathname } = reactRouter.useLocation();
|
|
30
|
+
const [menus, user, routeParentMenusMappings] = store.useAppStore((state) => [state.menus, state.user, state.routeParentMenusMappings]);
|
|
31
|
+
const defaultOpenedMenuKeys = routeParentMenusMappings?.get(pathname)?.[1].map((it) => it.key);
|
|
32
|
+
const breadcrumbItems = react.useMemo(() => {
|
|
33
|
+
const mapping = routeParentMenusMappings?.get(pathname);
|
|
34
|
+
if (!mapping) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
const [currentMenu, parentMenus] = mapping;
|
|
38
|
+
return [
|
|
39
|
+
indexBreadcrumbItem,
|
|
40
|
+
...parentMenus.map((menu) => ({
|
|
41
|
+
key: menu.key,
|
|
42
|
+
label: menu.label,
|
|
43
|
+
dropdownItems: menu.children.filter((child) => child.type !== "divider").map((child) => ({
|
|
44
|
+
key: child.key,
|
|
45
|
+
label: child.label
|
|
46
|
+
}))
|
|
47
|
+
})),
|
|
48
|
+
{
|
|
49
|
+
label: currentMenu.label
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
}, [pathname, routeParentMenusMappings]);
|
|
53
|
+
const { logoutApi, fetchAuthenticatedUserApi } = core.useApiContext();
|
|
54
|
+
const { mutate: logout } = logoutApi.useMutation();
|
|
55
|
+
const handleLogout = react.useCallback(async () => {
|
|
56
|
+
await logout();
|
|
57
|
+
await helper.handleClientLogout(router, fetchAuthenticatedUserApi);
|
|
58
|
+
}, [logout, router, fetchAuthenticatedUserApi]);
|
|
59
|
+
const handleMenuSwitch = react.useCallback((menuKey) => {
|
|
60
|
+
navigate({
|
|
61
|
+
to: menuKey
|
|
62
|
+
});
|
|
63
|
+
}, [navigate]);
|
|
64
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
65
|
+
components.VefLayout,
|
|
66
|
+
{
|
|
67
|
+
activeMenuKey: pathname,
|
|
68
|
+
breadcrumbItems,
|
|
69
|
+
defaultOpenedMenuKeys,
|
|
70
|
+
logo,
|
|
71
|
+
menuItems: menus,
|
|
72
|
+
title,
|
|
73
|
+
userAvatar: user?.avatar,
|
|
74
|
+
userDescription: getUserDescription?.(user),
|
|
75
|
+
userGender: user?.gender,
|
|
76
|
+
userName: user?.name,
|
|
77
|
+
onActiveMenuKeyChange: handleMenuSwitch,
|
|
78
|
+
onBreadcrumbClick: handleMenuSwitch,
|
|
79
|
+
onLogout: handleLogout,
|
|
80
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactRouter.Outlet, {})
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
beforeLoad: ({ location }) => {
|
|
86
|
+
const { isAuthenticated, routeParentMenusMappings } = store.useAppStore.getState();
|
|
87
|
+
if (!isAuthenticated) {
|
|
88
|
+
throw reactRouter.redirect({
|
|
89
|
+
to: constants.LOGIN_PAGE_PATH,
|
|
90
|
+
search: {
|
|
91
|
+
redirect: location.href
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if (routeParentMenusMappings && !routeParentMenusMappings.has(location.pathname)) {
|
|
96
|
+
throw reactRouter.redirect({
|
|
97
|
+
to: constants.ACCESS_DENIED_PAGE_PATH,
|
|
98
|
+
replace: true
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
loader: async ({ context, location }) => {
|
|
103
|
+
const { fetchAuthenticatedUserApi } = context;
|
|
104
|
+
const {
|
|
105
|
+
menus,
|
|
106
|
+
permissions,
|
|
107
|
+
...user
|
|
108
|
+
} = await fetchAuthenticatedUserApi.fetchQuery();
|
|
109
|
+
const routeParentMenusMappings = Object.freeze(shared.buildRouteParentMenusMappings(menus));
|
|
110
|
+
store.useAppStore.setState({
|
|
111
|
+
user: Object.freeze(user),
|
|
112
|
+
menus: Object.freeze(menus),
|
|
113
|
+
permissions: Object.freeze(new Set(permissions)),
|
|
114
|
+
routeParentMenusMappings
|
|
115
|
+
});
|
|
116
|
+
if (!routeParentMenusMappings.has(location.pathname)) {
|
|
117
|
+
throw reactRouter.redirect({
|
|
118
|
+
to: constants.ACCESS_DENIED_PAGE_PATH,
|
|
119
|
+
replace: true
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
pendingComponent: () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
124
|
+
components.VefLoadingPlaceholder,
|
|
125
|
+
{
|
|
126
|
+
size: "large",
|
|
127
|
+
tip: "\u7CFB\u7EDF\u52A0\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u540E..."
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
component: LayoutComponent,
|
|
131
|
+
staleTime: Infinity,
|
|
132
|
+
gcTime: 0,
|
|
133
|
+
shouldReload: false
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
exports.createLayoutRouteOptions = createLayoutRouteOptions;
|
|
3
138
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/routes/login.cjs
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
7
|
+
const reactRouter = require('@tanstack/react-router');
|
|
8
|
+
const shared = require('@vef-framework/shared');
|
|
9
|
+
require('../components/index.cjs');
|
|
10
|
+
const constants = require('../constants.cjs');
|
|
11
|
+
const store = require('../store.cjs');
|
|
12
|
+
const index = require('../components/vef-login-page/index.cjs');
|
|
13
|
+
|
|
14
|
+
function createLoginRouteOptions(props) {
|
|
15
|
+
return {
|
|
16
|
+
validateSearch: shared.z.object({
|
|
17
|
+
redirect: shared.z.string().optional().default(constants.INDEX_PAGE_PATH).catch(constants.INDEX_PAGE_PATH)
|
|
18
|
+
}),
|
|
19
|
+
beforeLoad: ({ search }) => {
|
|
20
|
+
if (store.useAppStore.getState().isAuthenticated) {
|
|
21
|
+
const { redirect: redirectPath } = search;
|
|
22
|
+
throw reactRouter.redirect({
|
|
23
|
+
to: redirectPath,
|
|
24
|
+
replace: true
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
component: () => /* @__PURE__ */ jsxRuntime.jsx(index.default, { ...props })
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
exports.createLoginRouteOptions = createLoginRouteOptions;
|
|
3
33
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/routes/root.cjs
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
7
|
+
const reactRouter = require('@tanstack/react-router');
|
|
8
|
+
require('../components/index.cjs');
|
|
9
|
+
const index = require('../components/vef-not-found-page/index.cjs');
|
|
10
|
+
const index$1 = require('../components/vef-error-page/index.cjs');
|
|
11
|
+
const index$2 = require('../components/vef-dev-assistant/index.cjs');
|
|
12
|
+
|
|
13
|
+
function createRootRoute() {
|
|
14
|
+
return reactRouter.createRootRouteWithContext()({
|
|
15
|
+
component: () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
16
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouter.Outlet, {}),
|
|
17
|
+
process.env.NODE_ENV === "development" && /* @__PURE__ */ jsxRuntime.jsx(index$2.default, {})
|
|
18
|
+
] }),
|
|
19
|
+
errorComponent: index$1.default,
|
|
20
|
+
notFoundComponent: index.default,
|
|
21
|
+
ssr: false
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.createRootRoute = createRootRoute;
|
|
3
26
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/lib/store.cjs
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const shared = require('@vef-framework/shared');
|
|
7
|
+
|
|
8
|
+
const useAppStore = shared.createStore(
|
|
9
|
+
() => ({
|
|
10
|
+
isAuthenticated: false
|
|
11
|
+
}),
|
|
12
|
+
{
|
|
13
|
+
name: "APP",
|
|
14
|
+
storage: "session",
|
|
15
|
+
selector: (state) => ({
|
|
16
|
+
isAuthenticated: state.isAuthenticated,
|
|
17
|
+
token: state.token
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
exports.useAppStore = useAppStore;
|
|
3
23
|
/*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vef-framework/starter",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.99",
|
|
5
5
|
"private": false,
|
|
6
6
|
"packageManager": "pnpm@9.15.0",
|
|
7
7
|
"description": "The starter of the VEF framework",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": "18.3.1",
|
|
32
32
|
"react-dom": "18.3.1",
|
|
33
|
-
"@tanstack/react-router": "^1.112.
|
|
33
|
+
"@tanstack/react-router": "^1.112.18"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@emotion/cache": "11.14.0",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"tslib": "2.8.1",
|
|
41
41
|
"use-sync-external-store": "^1.4.0",
|
|
42
42
|
"@tanstack/react-query-devtools": "5.67.1",
|
|
43
|
-
"@tanstack/router-devtools": "^1.112.
|
|
44
|
-
"@vef-framework/components": "1.0.
|
|
45
|
-
"@vef-framework/core": "1.0.
|
|
46
|
-
"@vef-framework/hooks": "1.0.
|
|
47
|
-
"@vef-framework/shared": "1.0.
|
|
43
|
+
"@tanstack/router-devtools": "^1.112.18",
|
|
44
|
+
"@vef-framework/components": "1.0.99",
|
|
45
|
+
"@vef-framework/core": "1.0.99",
|
|
46
|
+
"@vef-framework/hooks": "1.0.99",
|
|
47
|
+
"@vef-framework/shared": "1.0.99",
|
|
48
48
|
"lucide-react": "0.477.0",
|
|
49
49
|
"motion": "12.4.10",
|
|
50
50
|
"nprogress": "^0.2.0"
|