@vef-framework/starter 1.0.98 → 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 +5 -5
package/es/routes/layout.js
CHANGED
|
@@ -1,3 +1,134 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
import{jsx
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
3
|
+
import { useRouter, useNavigate, useLocation, Outlet, redirect } from '@tanstack/react-router';
|
|
4
|
+
import { VefIcon, VefLayout, VefLoadingPlaceholder } from '@vef-framework/components';
|
|
5
|
+
import { useApiContext } from '@vef-framework/core';
|
|
6
|
+
import { buildRouteParentMenusMappings } from '@vef-framework/shared';
|
|
7
|
+
import { HomeIcon } from 'lucide-react';
|
|
8
|
+
import { useMemo, useCallback } from 'react';
|
|
9
|
+
import { INDEX_PAGE_PATH, ACCESS_DENIED_PAGE_PATH, LOGIN_PAGE_PATH } from '../constants.js';
|
|
10
|
+
import { handleClientLogout } from '../helper.js';
|
|
11
|
+
import { useAppStore } from '../store.js';
|
|
12
|
+
|
|
13
|
+
const indexBreadcrumbItem = {
|
|
14
|
+
key: INDEX_PAGE_PATH,
|
|
15
|
+
label: /* @__PURE__ */ jsx(VefIcon, { children: /* @__PURE__ */ jsx(HomeIcon, {}) })
|
|
16
|
+
};
|
|
17
|
+
function createLayoutRouteOptions({
|
|
18
|
+
title,
|
|
19
|
+
logo,
|
|
20
|
+
getUserDescription
|
|
21
|
+
}) {
|
|
22
|
+
function LayoutComponent() {
|
|
23
|
+
const router = useRouter();
|
|
24
|
+
const navigate = useNavigate();
|
|
25
|
+
const { pathname } = useLocation();
|
|
26
|
+
const [menus, user, routeParentMenusMappings] = useAppStore((state) => [state.menus, state.user, state.routeParentMenusMappings]);
|
|
27
|
+
const defaultOpenedMenuKeys = routeParentMenusMappings?.get(pathname)?.[1].map((it) => it.key);
|
|
28
|
+
const breadcrumbItems = useMemo(() => {
|
|
29
|
+
const mapping = routeParentMenusMappings?.get(pathname);
|
|
30
|
+
if (!mapping) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
const [currentMenu, parentMenus] = mapping;
|
|
34
|
+
return [
|
|
35
|
+
indexBreadcrumbItem,
|
|
36
|
+
...parentMenus.map((menu) => ({
|
|
37
|
+
key: menu.key,
|
|
38
|
+
label: menu.label,
|
|
39
|
+
dropdownItems: menu.children.filter((child) => child.type !== "divider").map((child) => ({
|
|
40
|
+
key: child.key,
|
|
41
|
+
label: child.label
|
|
42
|
+
}))
|
|
43
|
+
})),
|
|
44
|
+
{
|
|
45
|
+
label: currentMenu.label
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
}, [pathname, routeParentMenusMappings]);
|
|
49
|
+
const { logoutApi, fetchAuthenticatedUserApi } = useApiContext();
|
|
50
|
+
const { mutate: logout } = logoutApi.useMutation();
|
|
51
|
+
const handleLogout = useCallback(async () => {
|
|
52
|
+
await logout();
|
|
53
|
+
await handleClientLogout(router, fetchAuthenticatedUserApi);
|
|
54
|
+
}, [logout, router, fetchAuthenticatedUserApi]);
|
|
55
|
+
const handleMenuSwitch = useCallback((menuKey) => {
|
|
56
|
+
navigate({
|
|
57
|
+
to: menuKey
|
|
58
|
+
});
|
|
59
|
+
}, [navigate]);
|
|
60
|
+
return /* @__PURE__ */ jsx(
|
|
61
|
+
VefLayout,
|
|
62
|
+
{
|
|
63
|
+
activeMenuKey: pathname,
|
|
64
|
+
breadcrumbItems,
|
|
65
|
+
defaultOpenedMenuKeys,
|
|
66
|
+
logo,
|
|
67
|
+
menuItems: menus,
|
|
68
|
+
title,
|
|
69
|
+
userAvatar: user?.avatar,
|
|
70
|
+
userDescription: getUserDescription?.(user),
|
|
71
|
+
userGender: user?.gender,
|
|
72
|
+
userName: user?.name,
|
|
73
|
+
onActiveMenuKeyChange: handleMenuSwitch,
|
|
74
|
+
onBreadcrumbClick: handleMenuSwitch,
|
|
75
|
+
onLogout: handleLogout,
|
|
76
|
+
children: /* @__PURE__ */ jsx(Outlet, {})
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
beforeLoad: ({ location }) => {
|
|
82
|
+
const { isAuthenticated, routeParentMenusMappings } = useAppStore.getState();
|
|
83
|
+
if (!isAuthenticated) {
|
|
84
|
+
throw redirect({
|
|
85
|
+
to: LOGIN_PAGE_PATH,
|
|
86
|
+
search: {
|
|
87
|
+
redirect: location.href
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (routeParentMenusMappings && !routeParentMenusMappings.has(location.pathname)) {
|
|
92
|
+
throw redirect({
|
|
93
|
+
to: ACCESS_DENIED_PAGE_PATH,
|
|
94
|
+
replace: true
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
loader: async ({ context, location }) => {
|
|
99
|
+
const { fetchAuthenticatedUserApi } = context;
|
|
100
|
+
const {
|
|
101
|
+
menus,
|
|
102
|
+
permissions,
|
|
103
|
+
...user
|
|
104
|
+
} = await fetchAuthenticatedUserApi.fetchQuery();
|
|
105
|
+
const routeParentMenusMappings = Object.freeze(buildRouteParentMenusMappings(menus));
|
|
106
|
+
useAppStore.setState({
|
|
107
|
+
user: Object.freeze(user),
|
|
108
|
+
menus: Object.freeze(menus),
|
|
109
|
+
permissions: Object.freeze(new Set(permissions)),
|
|
110
|
+
routeParentMenusMappings
|
|
111
|
+
});
|
|
112
|
+
if (!routeParentMenusMappings.has(location.pathname)) {
|
|
113
|
+
throw redirect({
|
|
114
|
+
to: ACCESS_DENIED_PAGE_PATH,
|
|
115
|
+
replace: true
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
pendingComponent: () => /* @__PURE__ */ jsx(
|
|
120
|
+
VefLoadingPlaceholder,
|
|
121
|
+
{
|
|
122
|
+
size: "large",
|
|
123
|
+
tip: "\u7CFB\u7EDF\u52A0\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u540E..."
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
component: LayoutComponent,
|
|
127
|
+
staleTime: Infinity,
|
|
128
|
+
gcTime: 0,
|
|
129
|
+
shouldReload: false
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export { createLayoutRouteOptions };
|
|
3
134
|
/*! 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/es/routes/login.js
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
import{jsx
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
3
|
+
import { redirect } from '@tanstack/react-router';
|
|
4
|
+
import { z } from '@vef-framework/shared';
|
|
5
|
+
import '../components/index.js';
|
|
6
|
+
import { INDEX_PAGE_PATH } from '../constants.js';
|
|
7
|
+
import { useAppStore } from '../store.js';
|
|
8
|
+
import VefLoginPage from '../components/vef-login-page/index.js';
|
|
9
|
+
|
|
10
|
+
function createLoginRouteOptions(props) {
|
|
11
|
+
return {
|
|
12
|
+
validateSearch: z.object({
|
|
13
|
+
redirect: z.string().optional().default(INDEX_PAGE_PATH).catch(INDEX_PAGE_PATH)
|
|
14
|
+
}),
|
|
15
|
+
beforeLoad: ({ search }) => {
|
|
16
|
+
if (useAppStore.getState().isAuthenticated) {
|
|
17
|
+
const { redirect: redirectPath } = search;
|
|
18
|
+
throw redirect({
|
|
19
|
+
to: redirectPath,
|
|
20
|
+
replace: true
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
component: () => /* @__PURE__ */ jsx(VefLoginPage, { ...props })
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { createLoginRouteOptions };
|
|
3
29
|
/*! 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/es/routes/root.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
import{jsxs
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
import { jsxs, Fragment, jsx } from '@emotion/react/jsx-runtime';
|
|
3
|
+
import { createRootRouteWithContext, Outlet } from '@tanstack/react-router';
|
|
4
|
+
import '../components/index.js';
|
|
5
|
+
import VefNotFoundPage from '../components/vef-not-found-page/index.js';
|
|
6
|
+
import VefErrorPage from '../components/vef-error-page/index.js';
|
|
7
|
+
import VefDevAssistant from '../components/vef-dev-assistant/index.js';
|
|
8
|
+
|
|
9
|
+
function createRootRoute() {
|
|
10
|
+
return createRootRouteWithContext()({
|
|
11
|
+
component: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
|
+
/* @__PURE__ */ jsx(Outlet, {}),
|
|
13
|
+
process.env.NODE_ENV === "development" && /* @__PURE__ */ jsx(VefDevAssistant, {})
|
|
14
|
+
] }),
|
|
15
|
+
errorComponent: VefErrorPage,
|
|
16
|
+
notFoundComponent: VefNotFoundPage,
|
|
17
|
+
ssr: false
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { createRootRoute };
|
|
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 */
|
package/es/store.js
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
/*! VefFramework version: 1.0.
|
|
2
|
-
import{createStore
|
|
1
|
+
/*! VefFramework version: 1.0.99, build time: 2025-03-07T13:41:56.083Z, made by Venus. */
|
|
2
|
+
import { createStore } from '@vef-framework/shared';
|
|
3
|
+
|
|
4
|
+
const useAppStore = createStore(
|
|
5
|
+
() => ({
|
|
6
|
+
isAuthenticated: false
|
|
7
|
+
}),
|
|
8
|
+
{
|
|
9
|
+
name: "APP",
|
|
10
|
+
storage: "session",
|
|
11
|
+
selector: (state) => ({
|
|
12
|
+
isAuthenticated: state.isAuthenticated,
|
|
13
|
+
token: state.token
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export { useAppStore };
|
|
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/api.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 core = require('@vef-framework/core');
|
|
7
|
+
const store = require('./store.cjs');
|
|
8
|
+
|
|
9
|
+
function createApiClient(options) {
|
|
10
|
+
return core.createApiClient({
|
|
11
|
+
...options,
|
|
12
|
+
getAccessToken() {
|
|
13
|
+
return store.useAppStore.getState().token?.accessToken;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports.createApiClient = createApiClient;
|
|
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/app.cjs
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
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 react = require('react');
|
|
7
|
+
const client = require('react-dom/client');
|
|
8
|
+
require('./components/index.cjs');
|
|
9
|
+
const index = require('./components/vef-app/index.cjs');
|
|
10
|
+
|
|
11
|
+
function createApp() {
|
|
12
|
+
const root = client.createRoot(
|
|
13
|
+
document.getElementById("root"),
|
|
14
|
+
{
|
|
15
|
+
identifierPrefix: "vef-"
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
return {
|
|
19
|
+
render: (props) => {
|
|
20
|
+
root.render(
|
|
21
|
+
react.createElement(index.default, props)
|
|
22
|
+
);
|
|
23
|
+
},
|
|
24
|
+
unmount: () => root.unmount()
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.createApp = createApp;
|
|
3
29
|
/*! 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/components/index.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 index = require('./vef-access-denied-page/index.cjs');
|
|
7
|
+
const index$1 = require('./vef-app/index.cjs');
|
|
8
|
+
const index$2 = require('./vef-dev-assistant/index.cjs');
|
|
9
|
+
const index$3 = require('./vef-error-page/index.cjs');
|
|
10
|
+
const index$4 = require('./vef-login-page/index.cjs');
|
|
11
|
+
const index$5 = require('./vef-not-found-page/index.cjs');
|
|
12
|
+
const index$6 = require('./vef-router-provider/index.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
exports.VefAccessDeniedPage = index.default;
|
|
17
|
+
exports.VefApp = index$1.default;
|
|
18
|
+
exports.VefDevAssistant = index$2.default;
|
|
19
|
+
exports.VefErrorPage = index$3.default;
|
|
20
|
+
exports.VefLoginPage = index$4.default;
|
|
21
|
+
exports.VefNotFoundPage = index$5.default;
|
|
22
|
+
exports.VefRouterProvider = index$6.default;
|
|
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 */
|
|
@@ -1,3 +1,27 @@
|
|
|
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 VefAccessDeniedPage(props) {
|
|
13
|
+
const { pathname } = reactRouter.useLocation();
|
|
14
|
+
const { redirect } = reactRouter.useRouterState();
|
|
15
|
+
const navigate = reactRouter.useNavigate();
|
|
16
|
+
const handleNavigateHome = react.useCallback(
|
|
17
|
+
() => navigate({
|
|
18
|
+
to: constants.INDEX_PAGE_PATH,
|
|
19
|
+
replace: true
|
|
20
|
+
}),
|
|
21
|
+
[navigate]
|
|
22
|
+
);
|
|
23
|
+
return /* @__PURE__ */ jsxRuntime.jsx(components.VefAccessDenied, { uri: redirect?._fromLocation?.pathname ?? pathname, onNavigateHome: handleNavigateHome, ...props });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.default = VefAccessDeniedPage;
|
|
3
27
|
/*! 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,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.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
7
|
+
const components = require('@vef-framework/components');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const index = require('../vef-router-provider/index.cjs');
|
|
10
|
+
|
|
11
|
+
function VefApp({
|
|
12
|
+
router,
|
|
13
|
+
...configProviderProps
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.StrictMode, { children: /* @__PURE__ */ jsxRuntime.jsx(components.VefConfigProvider, { ...configProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(index.default, { router }) }) });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports.default = VefApp;
|
|
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 */
|
|
@@ -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,5 +1,18 @@
|
|
|
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 react = require('@emotion/react');
|
|
8
|
+
const components = require('@vef-framework/components');
|
|
9
|
+
const hooks = require('@vef-framework/hooks');
|
|
10
|
+
const shared = require('@vef-framework/shared');
|
|
11
|
+
const lucideReact = require('lucide-react');
|
|
12
|
+
const react$2 = require('motion/react');
|
|
13
|
+
const react$1 = require('react');
|
|
14
|
+
|
|
15
|
+
const devtoolsContainerStyle = react.css`
|
|
3
16
|
position: fixed;
|
|
4
17
|
bottom: 0;
|
|
5
18
|
width: 100%;
|
|
@@ -22,11 +35,125 @@
|
|
|
22
35
|
}
|
|
23
36
|
|
|
24
37
|
> div {
|
|
25
|
-
padding: ${
|
|
38
|
+
padding: ${shared.themeVariables.paddingSm};
|
|
26
39
|
scrollbar-width: thin;
|
|
27
40
|
scrollbar-color: #334155 transparent;
|
|
28
|
-
box-shadow: ${
|
|
41
|
+
box-shadow: ${shared.themeVariables.boxShadowDrawerDown};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
function IconCoffee(props) {
|
|
46
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { height: 24, viewBox: "0 0 24 24", width: 24, xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
47
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17 14v4c0 1.66 -1.34 3 -3 3h-6c-1.66 0 -3 -1.34 -3 -3v-4Z", fill: "currentColor", fillOpacity: 0, children: /* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "fill-opacity", begin: "0.8s", dur: "0.5s", fill: "freeze", values: "0;1" }) }),
|
|
48
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, children: [
|
|
49
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17 9v9c0 1.66 -1.34 3 -3 3h-6c-1.66 0 -3 -1.34 -3 -3v-9Z", strokeDasharray: 48, strokeDashoffset: 48, children: /* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "stroke-dashoffset", dur: "0.6s", fill: "freeze", values: "48;0" }) }),
|
|
50
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17 9h3c0.55 0 1 0.45 1 1v3c0 0.55 -0.45 1 -1 1h-3", strokeDasharray: 14, strokeDashoffset: 14, children: /* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "stroke-dashoffset", begin: "0.6s", dur: "0.2s", fill: "freeze", values: "14;0" }) }),
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx("mask", { id: "lineMdCoffeeHalfEmptyFilledLoop0", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 0c0 2-2 2-2 4s2 2 2 4-2 2-2 4 2 2 2 4M12 0c0 2-2 2-2 4s2 2 2 4-2 2-2 4 2 2 2 4M16 0c0 2-2 2-2 4s2 2 2 4-2 2-2 4 2 2 2 4", stroke: "#fff", children: /* @__PURE__ */ jsxRuntime.jsx("animateMotion", { calcMode: "linear", dur: "3s", path: "M0 0v-8", repeatCount: "indefinite" }) }) }),
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsxs("rect", { fill: "currentColor", height: 0, mask: "url(#lineMdCoffeeHalfEmptyFilledLoop0)", width: 24, y: 7, children: [
|
|
53
|
+
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "y", begin: "0.8s", dur: "0.6s", fill: "freeze", values: "7;2" }),
|
|
54
|
+
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "height", begin: "0.8s", dur: "0.6s", fill: "freeze", values: "0;5" })
|
|
55
|
+
] })
|
|
56
|
+
] })
|
|
57
|
+
] });
|
|
58
|
+
}
|
|
59
|
+
const isDev = process.env.NODE_ENV === "development";
|
|
60
|
+
const RouterDevtools = isDev ? react$1.lazy(() => import('@tanstack/router-devtools').then((mod) => ({
|
|
61
|
+
default: mod.TanStackRouterDevtoolsPanel
|
|
62
|
+
}))) : () => null;
|
|
63
|
+
const QueryDevtools = isDev ? react$1.lazy(() => import('@tanstack/react-query-devtools').then((mod) => ({
|
|
64
|
+
default: mod.ReactQueryDevtoolsPanel
|
|
65
|
+
}))) : () => null;
|
|
66
|
+
const variants = {
|
|
67
|
+
opened: {
|
|
68
|
+
opacity: 1,
|
|
69
|
+
y: 0,
|
|
70
|
+
transition: {
|
|
71
|
+
type: "spring",
|
|
72
|
+
bounce: 0,
|
|
73
|
+
duration: 0.2
|
|
29
74
|
}
|
|
75
|
+
},
|
|
76
|
+
closed: {
|
|
77
|
+
opacity: 0,
|
|
78
|
+
y: "50%"
|
|
30
79
|
}
|
|
31
|
-
|
|
80
|
+
};
|
|
81
|
+
function VefDevAssistant() {
|
|
82
|
+
const [visibleDevtools, setVisibleDevtools] = react$1.useState(null);
|
|
83
|
+
const handleShowQueryDevtools = react$1.useCallback((event) => {
|
|
84
|
+
event.stopPropagation();
|
|
85
|
+
setVisibleDevtools((visible) => visible === "query" ? null : "query");
|
|
86
|
+
}, []);
|
|
87
|
+
const handleShowRouterDevtools = react$1.useCallback((event) => {
|
|
88
|
+
event.stopPropagation();
|
|
89
|
+
setVisibleDevtools((visible) => visible === "router" ? null : "router");
|
|
90
|
+
}, []);
|
|
91
|
+
hooks.useKeyPress("esc", () => {
|
|
92
|
+
if (visibleDevtools) {
|
|
93
|
+
setVisibleDevtools(null);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
97
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
98
|
+
components.VefFloatButtonGroup,
|
|
99
|
+
{
|
|
100
|
+
collapsable: true,
|
|
101
|
+
shape: "square",
|
|
102
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(components.VefIcon, { size: "huge", children: /* @__PURE__ */ jsxRuntime.jsx(IconCoffee, {}) }),
|
|
103
|
+
onClick: (event) => event.stopPropagation(),
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
106
|
+
components.VefFloatButton,
|
|
107
|
+
{
|
|
108
|
+
tip: "API\u8C03\u8BD5\u63A7\u5236\u53F0",
|
|
109
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(components.VefIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CompassIcon, {}) }),
|
|
110
|
+
onClick: handleShowQueryDevtools
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
114
|
+
components.VefFloatButton,
|
|
115
|
+
{
|
|
116
|
+
tip: "\u8DEF\u7531\u8C03\u8BD5\u63A7\u5236\u53F0",
|
|
117
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(components.VefIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SendIcon, {}) }),
|
|
118
|
+
onClick: handleShowRouterDevtools
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ jsxRuntime.jsxs(react$2.AnimatePresence, { mode: "wait", children: [
|
|
125
|
+
visibleDevtools === "query" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
126
|
+
react$2.motion.div,
|
|
127
|
+
{
|
|
128
|
+
animate: "opened",
|
|
129
|
+
css: devtoolsContainerStyle,
|
|
130
|
+
exit: "closed",
|
|
131
|
+
initial: "closed",
|
|
132
|
+
variants,
|
|
133
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react$1.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(components.VefLoadingPlaceholder, {}), children: /* @__PURE__ */ jsxRuntime.jsx(QueryDevtools, { style: { height: "100%" } }) })
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
visibleDevtools === "router" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
137
|
+
react$2.motion.div,
|
|
138
|
+
{
|
|
139
|
+
animate: "opened",
|
|
140
|
+
css: devtoolsContainerStyle,
|
|
141
|
+
exit: "closed",
|
|
142
|
+
initial: "closed",
|
|
143
|
+
variants,
|
|
144
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react$1.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(components.VefLoadingPlaceholder, {}), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
145
|
+
RouterDevtools,
|
|
146
|
+
{
|
|
147
|
+
isOpen: visibleDevtools === "router",
|
|
148
|
+
setIsOpen: shared.noop,
|
|
149
|
+
style: { height: "100%" }
|
|
150
|
+
}
|
|
151
|
+
) })
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
] })
|
|
155
|
+
] });
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
exports.default = VefDevAssistant;
|
|
32
159
|
/*! 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,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.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
7
|
+
const components = require('@vef-framework/components');
|
|
8
|
+
const core = require('@vef-framework/core');
|
|
9
|
+
const react = require('react');
|
|
10
|
+
|
|
11
|
+
function VefErrorPage({
|
|
12
|
+
error,
|
|
13
|
+
info,
|
|
14
|
+
reset
|
|
15
|
+
}) {
|
|
16
|
+
const { reset: resetQueryError } = core.useQueryErrorResetBoundary();
|
|
17
|
+
react.useEffect(() => {
|
|
18
|
+
resetQueryError();
|
|
19
|
+
}, [resetQueryError]);
|
|
20
|
+
return /* @__PURE__ */ jsxRuntime.jsx(components.VefError, { componentStack: info?.componentStack, error, reset });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exports.default = VefErrorPage;
|
|
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 */
|
|
@@ -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,41 @@
|
|
|
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 constants = require('../../constants.cjs');
|
|
10
|
+
const store = require('../../store.cjs');
|
|
11
|
+
|
|
12
|
+
function VefLoginPage(props) {
|
|
13
|
+
const router = reactRouter.useRouter();
|
|
14
|
+
const navigate = reactRouter.useNavigate();
|
|
15
|
+
const { redirect } = reactRouter.useSearch({
|
|
16
|
+
from: constants.LOGIN_PAGE_ROUTE
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19
|
+
components.VefLogin,
|
|
20
|
+
{
|
|
21
|
+
onLoginSuccess: async ({ accessToken, refreshToken }) => {
|
|
22
|
+
store.useAppStore.setState({
|
|
23
|
+
isAuthenticated: true,
|
|
24
|
+
token: Object.freeze({
|
|
25
|
+
accessToken,
|
|
26
|
+
refreshToken
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
await router.invalidate();
|
|
30
|
+
await navigate({
|
|
31
|
+
to: redirect,
|
|
32
|
+
replace: true
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
...props
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.default = VefLoginPage;
|
|
3
41
|
/*! 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 */
|