@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.
Files changed (48) hide show
  1. package/es/api.js +14 -2
  2. package/es/app.js +24 -2
  3. package/es/components/index.js +8 -2
  4. package/es/components/vef-access-denied-page/index.js +22 -2
  5. package/es/components/vef-app/index.js +14 -2
  6. package/es/components/vef-dev-assistant/index.js +128 -5
  7. package/es/components/vef-error-page/index.js +19 -2
  8. package/es/components/vef-login-page/index.js +36 -2
  9. package/es/components/vef-not-found-page/index.js +21 -2
  10. package/es/components/vef-router-provider/index.js +17 -2
  11. package/es/constants.js +9 -2
  12. package/es/helper.js +19 -2
  13. package/es/index.js +20 -2
  14. package/es/router.js +69 -2
  15. package/es/routes/access-denied.js +11 -2
  16. package/es/routes/index.js +5 -2
  17. package/es/routes/layout.js +133 -2
  18. package/es/routes/login.js +28 -2
  19. package/es/routes/root.js +21 -2
  20. package/es/store.js +18 -2
  21. package/lib/api.cjs +18 -2
  22. package/lib/app.cjs +28 -2
  23. package/lib/components/index.cjs +22 -2
  24. package/lib/components/vef-access-denied-page/index.cjs +26 -2
  25. package/lib/components/vef-access-denied-page/props.cjs +4 -2
  26. package/lib/components/vef-app/index.cjs +18 -2
  27. package/lib/components/vef-app/props.cjs +4 -2
  28. package/lib/components/vef-dev-assistant/index.cjs +132 -5
  29. package/lib/components/vef-dev-assistant/props.cjs +4 -2
  30. package/lib/components/vef-error-page/index.cjs +23 -2
  31. package/lib/components/vef-error-page/props.cjs +4 -2
  32. package/lib/components/vef-login-page/index.cjs +40 -2
  33. package/lib/components/vef-login-page/props.cjs +4 -2
  34. package/lib/components/vef-not-found-page/index.cjs +25 -2
  35. package/lib/components/vef-not-found-page/props.cjs +4 -2
  36. package/lib/components/vef-router-provider/index.cjs +21 -2
  37. package/lib/components/vef-router-provider/props.cjs +4 -2
  38. package/lib/constants.cjs +18 -2
  39. package/lib/helper.cjs +23 -2
  40. package/lib/index.cjs +49 -2
  41. package/lib/router.cjs +73 -2
  42. package/lib/routes/access-denied.cjs +15 -2
  43. package/lib/routes/index.cjs +16 -2
  44. package/lib/routes/layout.cjs +137 -2
  45. package/lib/routes/login.cjs +32 -2
  46. package/lib/routes/root.cjs +25 -2
  47. package/lib/store.cjs +22 -2
  48. package/package.json +7 -7
@@ -1,3 +1,134 @@
1
- /*! VefFramework version: 1.0.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- import{jsx as e}from"@emotion/react/jsx-runtime";import{useRouter as t,useNavigate as r,useLocation as o,Outlet as a,redirect as n}from"@tanstack/react-router";import{VefIcon as i,VefLayout as s,VefLoadingPlaceholder as m}from"@vef-framework/components";import{useApiContext as c}from"@vef-framework/core";import{buildRouteParentMenusMappings as u}from"@vef-framework/shared";import{HomeIcon as p}from"lucide-react";import{useMemo as l,useCallback as f}from"react";import{INDEX_PAGE_PATH as d,ACCESS_DENIED_PAGE_PATH as h,LOGIN_PAGE_PATH as g}from"../constants.js";import{handleClientLogout as y}from"../helper.js";import{useAppStore as b}from"../store.js";const k={key:d,label:e(i,{children:e(p,{})})};function createLayoutRouteOptions({title:i,logo:p,getUserDescription:d}){return{beforeLoad:({location:e})=>{const{isAuthenticated:t,routeParentMenusMappings:r}=b.getState();if(!t)throw n({to:g,search:{redirect:e.href}});if(r&&!r.has(e.pathname))throw n({to:h,replace:!0})},loader:async({context:e,location:t})=>{const{fetchAuthenticatedUserApi:r}=e,{menus:o,permissions:a,...i}=await r.fetchQuery(),s=Object.freeze(u(o));if(b.setState({user:Object.freeze(i),menus:Object.freeze(o),permissions:Object.freeze(new Set(a)),routeParentMenusMappings:s}),!s.has(t.pathname))throw n({to:h,replace:!0})},pendingComponent:()=>e(m,{size:"large",tip:"系统加载中,请稍后..."}),component:function LayoutComponent(){const n=t(),m=r(),{pathname:u}=o(),[h,g,w]=b((e=>[e.menus,e.user,e.routeParentMenusMappings])),M=w?.get(u)?.[1].map((e=>e.key)),j=l((()=>{const e=w?.get(u);if(!e)return[];const[t,r]=e;return[k,...r.map((e=>({key:e.key,label:e.label,dropdownItems:e.children.filter((e=>"divider"!==e.type)).map((e=>({key:e.key,label:e.label})))}))),{label:t.label}]}),[u,w]),{logoutApi:v,fetchAuthenticatedUserApi:A}=c(),{mutate:O}=v.useMutation(),z=f((async()=>{await O(),await y(n,A)}),[O,n,A]),L=f((e=>{m({to:e})}),[m]);return e(s,{activeMenuKey:u,breadcrumbItems:j,defaultOpenedMenuKeys:M,logo:p,menuItems:h,title:i,userAvatar:g?.avatar,userDescription:d?.(g),userGender:g?.gender,userName:g?.name,onActiveMenuKeyChange:L,onBreadcrumbClick:L,onLogout:z,children:e(a,{})})},staleTime:1/0,gcTime:0,shouldReload:!1}}export{createLayoutRouteOptions};
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 */
@@ -1,3 +1,29 @@
1
- /*! VefFramework version: 1.0.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- import{jsx as t}from"@emotion/react/jsx-runtime";import{redirect as o}from"@tanstack/react-router";import{z as e}from"@vef-framework/shared";import"../components/index.js";import{INDEX_PAGE_PATH as r}from"../constants.js";import{useAppStore as i}from"../store.js";import n from"../components/vef-login-page/index.js";function createLoginRouteOptions(a){return{validateSearch:e.object({redirect:e.string().optional().default(r).catch(r)}),beforeLoad:({search:t})=>{if(i.getState().isAuthenticated){const{redirect:e}=t;throw o({to:e,replace:!0})}},component:()=>t(n,{...a})}}export{createLoginRouteOptions};
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.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- import{jsxs as o,Fragment as e,jsx as t}from"@emotion/react/jsx-runtime";import{createRootRouteWithContext as n,Outlet as r}from"@tanstack/react-router";import"../components/index.js";import m from"../components/vef-not-found-page/index.js";import p from"../components/vef-error-page/index.js";import s from"../components/vef-dev-assistant/index.js";function createRootRoute(){return n()({component:()=>o(e,{children:[t(r,{}),"development"===process.env.NODE_ENV&&t(s,{})]}),errorComponent:p,notFoundComponent:m,ssr:!1})}export{createRootRoute};
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.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- import{createStore as e}from"@vef-framework/shared";const t=e((()=>({isAuthenticated:!1})),{name:"APP",storage:"session",selector:e=>({isAuthenticated:e.isAuthenticated,token:e.token})});export{t as useAppStore};
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.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@vef-framework/core"),t=require("./store.cjs");exports.createApiClient=function createApiClient(r){return e.createApiClient({...r,getAccessToken:()=>t.useAppStore.getState().token?.accessToken})};
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.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("react-dom/client");require("./components/index.cjs");const r=require("./components/vef-app/index.cjs");exports.createApp=function createApp(){const n=t.createRoot(document.getElementById("root"),{identifierPrefix:"vef-"});return{render:t=>{n.render(e.createElement(r.default,t))},unmount:()=>n.unmount()}};
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 */
@@ -1,3 +1,23 @@
1
- /*! VefFramework version: 1.0.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./vef-access-denied-page/index.cjs"),r=require("./vef-app/index.cjs"),t=require("./vef-dev-assistant/index.cjs"),s=require("./vef-error-page/index.cjs"),i=require("./vef-login-page/index.cjs"),o=require("./vef-not-found-page/index.cjs"),d=require("./vef-router-provider/index.cjs");exports.VefAccessDeniedPage=e.default,exports.VefApp=r.default,exports.VefDevAssistant=t.default,exports.VefErrorPage=s.default,exports.VefLoginPage=i.default,exports.VefNotFoundPage=o.default,exports.VefRouterProvider=d.default;
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.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("@emotion/react/jsx-runtime"),t=require("@tanstack/react-router"),r=require("@vef-framework/components"),a=require("react"),o=require("../../constants.cjs");exports.default=function VefAccessDeniedPage(s){const{pathname:c}=t.useLocation(),{redirect:n}=t.useRouterState(),u=t.useNavigate(),i=a.useCallback((()=>u({to:o.INDEX_PAGE_PATH,replace:!0})),[u]);return e.jsx(r.VefAccessDenied,{uri:n?._fromLocation?.pathname??c,onNavigateHome:i,...s})};
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.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- "use strict";
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.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("@emotion/react/jsx-runtime"),r=require("@vef-framework/components"),t=require("react"),o=require("../vef-router-provider/index.cjs");exports.default=function VefApp({router:i,...u}){return e.jsx(t.StrictMode,{children:e.jsx(r.VefConfigProvider,{...u,children:e.jsx(o.default,{router:i})})})};
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.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- "use strict";
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.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("@emotion/react/jsx-runtime"),t=require("@emotion/react"),o=require("@vef-framework/components"),s=require("@vef-framework/hooks"),r=require("@vef-framework/shared"),i=require("lucide-react"),a=require("motion/react"),n=require("react"),l=t.css`
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: ${r.themeVariables.paddingSm};
38
+ padding: ${shared.themeVariables.paddingSm};
26
39
  scrollbar-width: thin;
27
40
  scrollbar-color: #334155 transparent;
28
- box-shadow: ${r.themeVariables.boxShadowDrawerDown};
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
- `;function IconCoffee(t){return e.jsxs("svg",{height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",...t,children:[e.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:e.jsx("animate",{attributeName:"fill-opacity",begin:"0.8s",dur:"0.5s",fill:"freeze",values:"0;1"})}),e.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,children:[e.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:e.jsx("animate",{attributeName:"stroke-dashoffset",dur:"0.6s",fill:"freeze",values:"48;0"})}),e.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:e.jsx("animate",{attributeName:"stroke-dashoffset",begin:"0.6s",dur:"0.2s",fill:"freeze",values:"14;0"})}),e.jsx("mask",{id:"lineMdCoffeeHalfEmptyFilledLoop0",children:e.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:e.jsx("animateMotion",{calcMode:"linear",dur:"3s",path:"M0 0v-8",repeatCount:"indefinite"})})}),e.jsxs("rect",{fill:"currentColor",height:0,mask:"url(#lineMdCoffeeHalfEmptyFilledLoop0)",width:24,y:7,children:[e.jsx("animate",{attributeName:"y",begin:"0.8s",dur:"0.6s",fill:"freeze",values:"7;2"}),e.jsx("animate",{attributeName:"height",begin:"0.8s",dur:"0.6s",fill:"freeze",values:"0;5"})]})]})]})}const c="development"===process.env.NODE_ENV,d=c?n.lazy((()=>import("@tanstack/router-devtools").then((e=>({default:e.TanStackRouterDevtoolsPanel}))))):()=>null,u=c?n.lazy((()=>import("@tanstack/react-query-devtools").then((e=>({default:e.ReactQueryDevtoolsPanel}))))):()=>null,f={opened:{opacity:1,y:0,transition:{type:"spring",bounce:0,duration:.2}},closed:{opacity:0,y:"50%"}};exports.default=function VefDevAssistant(){const[t,c]=n.useState(null),h=n.useCallback((e=>{e.stopPropagation(),c((e=>"query"===e?null:"query"))}),[]),p=n.useCallback((e=>{e.stopPropagation(),c((e=>"router"===e?null:"router"))}),[]);return s.useKeyPress("esc",(()=>{t&&c(null)})),e.jsxs(e.Fragment,{children:[e.jsxs(o.VefFloatButtonGroup,{collapsable:!0,shape:"square",icon:e.jsx(o.VefIcon,{size:"huge",children:e.jsx(IconCoffee,{})}),onClick:e=>e.stopPropagation(),children:[e.jsx(o.VefFloatButton,{tip:"API调试控制台",icon:e.jsx(o.VefIcon,{children:e.jsx(i.CompassIcon,{})}),onClick:h}),e.jsx(o.VefFloatButton,{tip:"路由调试控制台",icon:e.jsx(o.VefIcon,{children:e.jsx(i.SendIcon,{})}),onClick:p})]}),e.jsxs(a.AnimatePresence,{mode:"wait",children:["query"===t&&e.jsx(a.motion.div,{animate:"opened",css:l,exit:"closed",initial:"closed",variants:f,children:e.jsx(n.Suspense,{fallback:e.jsx(o.VefLoadingPlaceholder,{}),children:e.jsx(u,{style:{height:"100%"}})})}),"router"===t&&e.jsx(a.motion.div,{animate:"opened",css:l,exit:"closed",initial:"closed",variants:f,children:e.jsx(n.Suspense,{fallback:e.jsx(o.VefLoadingPlaceholder,{}),children:e.jsx(d,{isOpen:"router"===t,setIsOpen:r.noop,style:{height:"100%"}})})})]})]})};
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.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- "use strict";
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.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("@emotion/react/jsx-runtime"),r=require("@vef-framework/components"),o=require("@vef-framework/core"),t=require("react");exports.default=function VefErrorPage({error:n,info:s,reset:u}){const{reset:c}=o.useQueryErrorResetBoundary();return t.useEffect((()=>{c()}),[c]),e.jsx(r.VefError,{componentStack:s?.componentStack,error:n,reset:u})};
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.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- "use strict";
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.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("@emotion/react/jsx-runtime"),t=require("@tanstack/react-router"),r=require("@vef-framework/components"),s=require("../../constants.cjs"),o=require("../../store.cjs");exports.default=function VefLoginPage(a){const n=t.useRouter(),c=t.useNavigate(),{redirect:i}=t.useSearch({from:s.LOGIN_PAGE_ROUTE});return e.jsx(r.VefLogin,{onLoginSuccess:async({accessToken:e,refreshToken:t})=>{o.useAppStore.setState({isAuthenticated:!0,token:Object.freeze({accessToken:e,refreshToken:t})}),await n.invalidate(),await c({to:i,replace:!0})},...a})};
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.97, build time: 2025-03-06T12:24:37.719Z, made by Venus. */
2
- "use strict";
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 */