@vef-framework/starter 1.0.63 → 1.0.64

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 +23 -2
  2. package/es/app.js +26 -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 +23 -2
  13. package/es/index.js +19 -2
  14. package/es/router.js +66 -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 +27 -2
  22. package/lib/app.cjs +30 -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 +28 -2
  40. package/lib/index.cjs +47 -2
  41. package/lib/router.cjs +70 -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 +5 -5
package/es/api.js CHANGED
@@ -1,3 +1,24 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- import{createApiClient as e}from"@vef-framework/core";import{handleClientLogout as o}from"./helper.js";import{useAppStore as r}from"./store.js";function t({router:t,...n}){return e({...n,getAccessToken:()=>r.getState().token?.accessToken,onUnauthorized(){o(t)},onAccessDenied(){}})}export{t as createApiClient};
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ import { createApiClient as createApiClient$1 } from '@vef-framework/core';
3
+ import { handleClientLogout } from './helper.js';
4
+ import { useAppStore } from './store.js';
5
+
6
+ function createApiClient({
7
+ router,
8
+ ...options
9
+ }) {
10
+ return createApiClient$1({
11
+ ...options,
12
+ getAccessToken() {
13
+ return useAppStore.getState().token?.accessToken;
14
+ },
15
+ onUnauthorized() {
16
+ handleClientLogout(router);
17
+ },
18
+ onAccessDenied() {
19
+ }
20
+ });
21
+ }
22
+
23
+ export { createApiClient };
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/es/app.js CHANGED
@@ -1,3 +1,27 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- import{createElement as e}from"react";import{createRoot as t}from"react-dom/client";import"./components/index.js";import{setCurrentFetchAuthenticatedUserApi as r}from"./helper.js";import o from"./components/vef-app/index.js";function n(){const n=t(document.getElementById("root"),{identifierPrefix:"vef-"});return{render:t=>{r(t.fetchAuthenticatedUserApi),n.render(e(o,t))},unmount:()=>n.unmount()}}export{n as createApp};
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ import { createElement } from 'react';
3
+ import { createRoot } from 'react-dom/client';
4
+ import './components/index.js';
5
+ import { setCurrentFetchAuthenticatedUserApi } from './helper.js';
6
+ import VefApp from './components/vef-app/index.js';
7
+
8
+ function createApp() {
9
+ const root = createRoot(
10
+ document.getElementById("root"),
11
+ {
12
+ identifierPrefix: "vef-"
13
+ }
14
+ );
15
+ return {
16
+ render: (props) => {
17
+ setCurrentFetchAuthenticatedUserApi(props.fetchAuthenticatedUserApi);
18
+ root.render(
19
+ createElement(VefApp, props)
20
+ );
21
+ },
22
+ unmount: () => root.unmount()
23
+ };
24
+ }
25
+
26
+ export { createApp };
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,9 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- export{default as VefAccessDeniedPage}from"./vef-access-denied-page/index.js";export{default as VefApp}from"./vef-app/index.js";export{default as VefDevAssistant}from"./vef-dev-assistant/index.js";export{default as VefErrorPage}from"./vef-error-page/index.js";export{default as VefLoginPage}from"./vef-login-page/index.js";export{default as VefNotFoundPage}from"./vef-not-found-page/index.js";export{default as VefRouterProvider}from"./vef-router-provider/index.js";
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ export { default as VefAccessDeniedPage } from './vef-access-denied-page/index.js';
3
+ export { default as VefApp } from './vef-app/index.js';
4
+ export { default as VefDevAssistant } from './vef-dev-assistant/index.js';
5
+ export { default as VefErrorPage } from './vef-error-page/index.js';
6
+ export { default as VefLoginPage } from './vef-login-page/index.js';
7
+ export { default as VefNotFoundPage } from './vef-not-found-page/index.js';
8
+ export { default as VefRouterProvider } from './vef-router-provider/index.js';
3
9
  /*! 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.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- import{jsx as t}from"@emotion/react/jsx-runtime";import{useLocation as o,useRouterState as r,useNavigate as e}from"@tanstack/react-router";import{VefAccessDenied as m}from"@vef-framework/components";import{useCallback as a}from"react";import{INDEX_PAGE_PATH as n}from"../../constants.js";function i(i){const{pathname:c}=o(),{redirect:f}=r(),p=e(),s=a((()=>p({to:n,replace:!0})),[p]);return t(m,{uri:f?._fromLocation?.pathname??c,onNavigateHome:s,...i})}export{i as default};
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ import { jsx } from '@emotion/react/jsx-runtime';
3
+ import { useLocation, useRouterState, useNavigate } from '@tanstack/react-router';
4
+ import { VefAccessDenied } from '@vef-framework/components';
5
+ import { useCallback } from 'react';
6
+ import { INDEX_PAGE_PATH } from '../../constants.js';
7
+
8
+ function VefAccessDeniedPage(props) {
9
+ const { pathname } = useLocation();
10
+ const { redirect } = useRouterState();
11
+ const navigate = useNavigate();
12
+ const handleNavigateHome = useCallback(
13
+ () => navigate({
14
+ to: INDEX_PAGE_PATH,
15
+ replace: true
16
+ }),
17
+ [navigate]
18
+ );
19
+ return /* @__PURE__ */ jsx(VefAccessDenied, { uri: redirect?._fromLocation?.pathname ?? pathname, onNavigateHome: handleNavigateHome, ...props });
20
+ }
21
+
22
+ export { VefAccessDeniedPage as 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,15 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- import{jsx as r}from"@emotion/react/jsx-runtime";import{VefConfigProvider as o}from"@vef-framework/components";import{StrictMode as e}from"react";import t from"../vef-router-provider/index.js";function m({router:m,...i}){return r(e,{children:r(o,{...i,children:r(t,{router:m})})})}export{m as default};
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ import { jsx } from '@emotion/react/jsx-runtime';
3
+ import { VefConfigProvider } from '@vef-framework/components';
4
+ import { StrictMode } from 'react';
5
+ import VefRouterProvider from '../vef-router-provider/index.js';
6
+
7
+ function VefApp({
8
+ router,
9
+ ...configProviderProps
10
+ }) {
11
+ return /* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(VefConfigProvider, { ...configProviderProps, children: /* @__PURE__ */ jsx(VefRouterProvider, { router }) }) });
12
+ }
13
+
14
+ export { VefApp as default };
3
15
  /*! 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,14 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- import{jsxs as e,jsx as t,Fragment as o}from"@emotion/react/jsx-runtime";import{css as r}from"@emotion/react";import{VefFloatButtonGroup as i,VefIcon as a,VefFloatButton as n,VefLoadingPlaceholder as l}from"@vef-framework/components";import{useKeyPress as s}from"@vef-framework/hooks";import{themeVariables as c,noop as d}from"@vef-framework/shared";import{CompassIcon as h,SendIcon as f}from"lucide-react";import{AnimatePresence as p,motion as u}from"motion/react";import{lazy as m,useState as v,useCallback as k,Suspense as y}from"react";const g=r`
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ import { jsxs, jsx, Fragment } from '@emotion/react/jsx-runtime';
3
+ import { css } from '@emotion/react';
4
+ import { VefFloatButtonGroup, VefIcon, VefFloatButton, VefLoadingPlaceholder } from '@vef-framework/components';
5
+ import { useKeyPress } from '@vef-framework/hooks';
6
+ import { themeVariables, noop } from '@vef-framework/shared';
7
+ import { CompassIcon, SendIcon } from 'lucide-react';
8
+ import { AnimatePresence, motion } from 'motion/react';
9
+ import { lazy, useState, useCallback, Suspense } from 'react';
10
+
11
+ const devtoolsContainerStyle = css`
3
12
  position: fixed;
4
13
  bottom: 0;
5
14
  width: 100%;
@@ -22,11 +31,125 @@ import{jsxs as e,jsx as t,Fragment as o}from"@emotion/react/jsx-runtime";import{
22
31
  }
23
32
 
24
33
  > div {
25
- padding: ${c.paddingSm};
34
+ padding: ${themeVariables.paddingSm};
26
35
  scrollbar-width: thin;
27
36
  scrollbar-color: #334155 transparent;
28
- box-shadow: ${c.boxShadowDrawerDown};
37
+ box-shadow: ${themeVariables.boxShadowDrawerDown};
38
+ }
39
+ }
40
+ `;
41
+ function IconCoffee(props) {
42
+ return /* @__PURE__ */ jsxs("svg", { height: 24, viewBox: "0 0 24 24", width: 24, xmlns: "http://www.w3.org/2000/svg", ...props, children: [
43
+ /* @__PURE__ */ 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__ */ jsx("animate", { attributeName: "fill-opacity", begin: "0.8s", dur: "0.5s", fill: "freeze", values: "0;1" }) }),
44
+ /* @__PURE__ */ jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, children: [
45
+ /* @__PURE__ */ 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__ */ jsx("animate", { attributeName: "stroke-dashoffset", dur: "0.6s", fill: "freeze", values: "48;0" }) }),
46
+ /* @__PURE__ */ 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__ */ jsx("animate", { attributeName: "stroke-dashoffset", begin: "0.6s", dur: "0.2s", fill: "freeze", values: "14;0" }) }),
47
+ /* @__PURE__ */ jsx("mask", { id: "lineMdCoffeeHalfEmptyFilledLoop0", children: /* @__PURE__ */ 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__ */ jsx("animateMotion", { calcMode: "linear", dur: "3s", path: "M0 0v-8", repeatCount: "indefinite" }) }) }),
48
+ /* @__PURE__ */ jsxs("rect", { fill: "currentColor", height: 0, mask: "url(#lineMdCoffeeHalfEmptyFilledLoop0)", width: 24, y: 7, children: [
49
+ /* @__PURE__ */ jsx("animate", { attributeName: "y", begin: "0.8s", dur: "0.6s", fill: "freeze", values: "7;2" }),
50
+ /* @__PURE__ */ jsx("animate", { attributeName: "height", begin: "0.8s", dur: "0.6s", fill: "freeze", values: "0;5" })
51
+ ] })
52
+ ] })
53
+ ] });
54
+ }
55
+ const isDev = process.env.NODE_ENV === "development";
56
+ const RouterDevtools = isDev ? lazy(() => import('@tanstack/router-devtools').then((mod) => ({
57
+ default: mod.TanStackRouterDevtoolsPanel
58
+ }))) : () => null;
59
+ const QueryDevtools = isDev ? lazy(() => import('@tanstack/react-query-devtools').then((mod) => ({
60
+ default: mod.ReactQueryDevtoolsPanel
61
+ }))) : () => null;
62
+ const variants = {
63
+ opened: {
64
+ opacity: 1,
65
+ y: 0,
66
+ transition: {
67
+ type: "spring",
68
+ bounce: 0,
69
+ duration: 0.2
29
70
  }
71
+ },
72
+ closed: {
73
+ opacity: 0,
74
+ y: "50%"
30
75
  }
31
- `;function b(o){return e("svg",{height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",...o,children:[t("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:t("animate",{attributeName:"fill-opacity",begin:"0.8s",dur:"0.5s",fill:"freeze",values:"0;1"})}),e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,children:[t("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:t("animate",{attributeName:"stroke-dashoffset",dur:"0.6s",fill:"freeze",values:"48;0"})}),t("path",{d:"M17 9h3c0.55 0 1 0.45 1 1v3c0 0.55 -0.45 1 -1 1h-3",strokeDasharray:14,strokeDashoffset:14,children:t("animate",{attributeName:"stroke-dashoffset",begin:"0.6s",dur:"0.2s",fill:"freeze",values:"14;0"})}),t("mask",{id:"lineMdCoffeeHalfEmptyFilledLoop0",children:t("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:t("animateMotion",{calcMode:"linear",dur:"3s",path:"M0 0v-8",repeatCount:"indefinite"})})}),e("rect",{fill:"currentColor",height:0,mask:"url(#lineMdCoffeeHalfEmptyFilledLoop0)",width:24,y:7,children:[t("animate",{attributeName:"y",begin:"0.8s",dur:"0.6s",fill:"freeze",values:"7;2"}),t("animate",{attributeName:"height",begin:"0.8s",dur:"0.6s",fill:"freeze",values:"0;5"})]})]})]})}const w="development"===process.env.NODE_ENV,x=w?m((()=>import("@tanstack/router-devtools").then((e=>({default:e.TanStackRouterDevtoolsPanel}))))):()=>null,M=w?m((()=>import("@tanstack/react-query-devtools").then((e=>({default:e.ReactQueryDevtoolsPanel}))))):()=>null,D={opened:{opacity:1,y:0,transition:{type:"spring",bounce:0,duration:.2}},closed:{opacity:0,y:"50%"}};function C(){const[r,c]=v(null),m=k((e=>{e.stopPropagation(),c((e=>"query"===e?null:"query"))}),[]),w=k((e=>{e.stopPropagation(),c((e=>"router"===e?null:"router"))}),[]);return s("esc",(()=>{r&&c(null)})),e(o,{children:[e(i,{collapsable:!0,shape:"square",icon:t(a,{size:"huge",children:t(b,{})}),onClick:e=>e.stopPropagation(),children:[t(n,{tip:"API调试控制台",icon:t(a,{children:t(h,{})}),onClick:m}),t(n,{tip:"路由调试控制台",icon:t(a,{children:t(f,{})}),onClick:w})]}),e(p,{mode:"wait",children:["query"===r&&t(u.div,{animate:"opened",css:g,exit:"closed",initial:"closed",variants:D,children:t(y,{fallback:t(l,{}),children:t(M,{style:{height:"100%"}})})}),"router"===r&&t(u.div,{animate:"opened",css:g,exit:"closed",initial:"closed",variants:D,children:t(y,{fallback:t(l,{}),children:t(x,{isOpen:"router"===r,setIsOpen:d,style:{height:"100%"}})})})]})]})}export{C as default};
76
+ };
77
+ function VefDevAssistant() {
78
+ const [visibleDevtools, setVisibleDevtools] = useState(null);
79
+ const handleShowQueryDevtools = useCallback((event) => {
80
+ event.stopPropagation();
81
+ setVisibleDevtools((visible) => visible === "query" ? null : "query");
82
+ }, []);
83
+ const handleShowRouterDevtools = useCallback((event) => {
84
+ event.stopPropagation();
85
+ setVisibleDevtools((visible) => visible === "router" ? null : "router");
86
+ }, []);
87
+ useKeyPress("esc", () => {
88
+ if (visibleDevtools) {
89
+ setVisibleDevtools(null);
90
+ }
91
+ });
92
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
93
+ /* @__PURE__ */ jsxs(
94
+ VefFloatButtonGroup,
95
+ {
96
+ collapsable: true,
97
+ shape: "square",
98
+ icon: /* @__PURE__ */ jsx(VefIcon, { size: "huge", children: /* @__PURE__ */ jsx(IconCoffee, {}) }),
99
+ onClick: (event) => event.stopPropagation(),
100
+ children: [
101
+ /* @__PURE__ */ jsx(
102
+ VefFloatButton,
103
+ {
104
+ tip: "API\u8C03\u8BD5\u63A7\u5236\u53F0",
105
+ icon: /* @__PURE__ */ jsx(VefIcon, { children: /* @__PURE__ */ jsx(CompassIcon, {}) }),
106
+ onClick: handleShowQueryDevtools
107
+ }
108
+ ),
109
+ /* @__PURE__ */ jsx(
110
+ VefFloatButton,
111
+ {
112
+ tip: "\u8DEF\u7531\u8C03\u8BD5\u63A7\u5236\u53F0",
113
+ icon: /* @__PURE__ */ jsx(VefIcon, { children: /* @__PURE__ */ jsx(SendIcon, {}) }),
114
+ onClick: handleShowRouterDevtools
115
+ }
116
+ )
117
+ ]
118
+ }
119
+ ),
120
+ /* @__PURE__ */ jsxs(AnimatePresence, { mode: "wait", children: [
121
+ visibleDevtools === "query" && /* @__PURE__ */ jsx(
122
+ motion.div,
123
+ {
124
+ animate: "opened",
125
+ css: devtoolsContainerStyle,
126
+ exit: "closed",
127
+ initial: "closed",
128
+ variants,
129
+ children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(VefLoadingPlaceholder, {}), children: /* @__PURE__ */ jsx(QueryDevtools, { style: { height: "100%" } }) })
130
+ }
131
+ ),
132
+ visibleDevtools === "router" && /* @__PURE__ */ jsx(
133
+ motion.div,
134
+ {
135
+ animate: "opened",
136
+ css: devtoolsContainerStyle,
137
+ exit: "closed",
138
+ initial: "closed",
139
+ variants,
140
+ children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(VefLoadingPlaceholder, {}), children: /* @__PURE__ */ jsx(
141
+ RouterDevtools,
142
+ {
143
+ isOpen: visibleDevtools === "router",
144
+ setIsOpen: noop,
145
+ style: { height: "100%" }
146
+ }
147
+ ) })
148
+ }
149
+ )
150
+ ] })
151
+ ] });
152
+ }
153
+
154
+ export { VefDevAssistant as default };
32
155
  /*! 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,20 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- import{jsx as r}from"@emotion/react/jsx-runtime";import{VefError as o}from"@vef-framework/components";import{useQueryErrorResetBoundary as e}from"@vef-framework/core";import{useEffect as t}from"react";function m({error:m,info:n,reset:f}){const{reset:c}=e();return t((()=>{c()}),[c]),r(o,{componentStack:n?.componentStack,error:m,reset:f})}export{m as default};
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ import { jsx } from '@emotion/react/jsx-runtime';
3
+ import { VefError } from '@vef-framework/components';
4
+ import { useQueryErrorResetBoundary } from '@vef-framework/core';
5
+ import { useEffect } from 'react';
6
+
7
+ function VefErrorPage({
8
+ error,
9
+ info,
10
+ reset
11
+ }) {
12
+ const { reset: resetQueryError } = useQueryErrorResetBoundary();
13
+ useEffect(() => {
14
+ resetQueryError();
15
+ }, [resetQueryError]);
16
+ return /* @__PURE__ */ jsx(VefError, { componentStack: info?.componentStack, error, reset });
17
+ }
18
+
19
+ export { VefErrorPage as default };
3
20
  /*! 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,37 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- import{jsx as e}from"@emotion/react/jsx-runtime";import{useRouter as t,useNavigate as o,useSearch as r}from"@tanstack/react-router";import{VefLogin as n}from"@vef-framework/components";import{LOGIN_PAGE_ROUTE as s}from"../../constants.js";import{useAppStore as a}from"../../store.js";function c(c){const i=t(),m=o(),{redirect:f}=r({from:s});return e(n,{onLoginSuccess:async({accessToken:e,refreshToken:t})=>{a.setState({isAuthenticated:!0,token:Object.freeze({accessToken:e,refreshToken:t})}),await i.invalidate(),await m({to:f,replace:!0})},...c})}export{c as default};
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ import { jsx } from '@emotion/react/jsx-runtime';
3
+ import { useRouter, useNavigate, useSearch } from '@tanstack/react-router';
4
+ import { VefLogin } from '@vef-framework/components';
5
+ import { LOGIN_PAGE_ROUTE } from '../../constants.js';
6
+ import { useAppStore } from '../../store.js';
7
+
8
+ function VefLoginPage(props) {
9
+ const router = useRouter();
10
+ const navigate = useNavigate();
11
+ const { redirect } = useSearch({
12
+ from: LOGIN_PAGE_ROUTE
13
+ });
14
+ return /* @__PURE__ */ jsx(
15
+ VefLogin,
16
+ {
17
+ onLoginSuccess: async ({ accessToken, refreshToken }) => {
18
+ useAppStore.setState({
19
+ isAuthenticated: true,
20
+ token: Object.freeze({
21
+ accessToken,
22
+ refreshToken
23
+ })
24
+ });
25
+ await router.invalidate();
26
+ await navigate({
27
+ to: redirect,
28
+ replace: true
29
+ });
30
+ },
31
+ ...props
32
+ }
33
+ );
34
+ }
35
+
36
+ export { VefLoginPage as default };
3
37
  /*! 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.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- import{jsx as t}from"@emotion/react/jsx-runtime";import{useNavigate as o,useLocation as r}from"@tanstack/react-router";import{VefNotFound as e}from"@vef-framework/components";import{useCallback as m}from"react";import{INDEX_PAGE_PATH as a}from"../../constants.js";function n(){const n=o(),i=m((()=>n({to:a,replace:!0})),[n]),{pathname:c}=r();return t(e,{uri:c,onNavigateHome:i})}export{n as default};
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ import { jsx } from '@emotion/react/jsx-runtime';
3
+ import { useNavigate, useLocation } from '@tanstack/react-router';
4
+ import { VefNotFound } from '@vef-framework/components';
5
+ import { useCallback } from 'react';
6
+ import { INDEX_PAGE_PATH } from '../../constants.js';
7
+
8
+ function VefNotFoundPage() {
9
+ const navigate = useNavigate();
10
+ const handleNavigateHome = useCallback(
11
+ () => navigate({
12
+ to: INDEX_PAGE_PATH,
13
+ replace: true
14
+ }),
15
+ [navigate]
16
+ );
17
+ const { pathname } = useLocation();
18
+ return /* @__PURE__ */ jsx(VefNotFound, { uri: pathname, onNavigateHome: handleNavigateHome });
19
+ }
20
+
21
+ export { VefNotFoundPage as default };
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,18 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- import{jsx as t}from"@emotion/react/jsx-runtime";import{RouterProvider as r}from"@tanstack/react-router";import{useApiContext as e}from"@vef-framework/core";import{useMemo as o}from"react";function c({router:c}){const{fetchAuthenticatedUserApi:i}=e(),m=o((()=>({fetchAuthenticatedUserApi:i})),[i]);return t(r,{context:m,router:c})}export{c as default};
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ import { jsx } from '@emotion/react/jsx-runtime';
3
+ import { RouterProvider } from '@tanstack/react-router';
4
+ import { useApiContext } from '@vef-framework/core';
5
+ import { useMemo } from 'react';
6
+
7
+ function VefRouterProvider({
8
+ router
9
+ }) {
10
+ const { fetchAuthenticatedUserApi } = useApiContext();
11
+ const context = useMemo(() => ({
12
+ fetchAuthenticatedUserApi
13
+ }), [fetchAuthenticatedUserApi]);
14
+ return /* @__PURE__ */ jsx(RouterProvider, { context, router });
15
+ }
16
+
17
+ export { VefRouterProvider as default };
3
18
  /*! 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/constants.js CHANGED
@@ -1,3 +1,10 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- const o="/login",c="/_common/login",e="/",n="/_layout",s="/access-denied",d="/_common/access-denied";export{s as ACCESS_DENIED_PAGE_PATH,d as ACCESS_DENIED_PAGE_ROUTE,e as INDEX_PAGE_PATH,n as INDEX_PAGE_ROUTE,o as LOGIN_PAGE_PATH,c as LOGIN_PAGE_ROUTE};
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ const LOGIN_PAGE_PATH = "/login";
3
+ const LOGIN_PAGE_ROUTE = "/_common/login";
4
+ const INDEX_PAGE_PATH = "/";
5
+ const INDEX_PAGE_ROUTE = "/_layout";
6
+ const ACCESS_DENIED_PAGE_PATH = "/access-denied";
7
+ const ACCESS_DENIED_PAGE_ROUTE = "/_common/access-denied";
8
+
9
+ export { ACCESS_DENIED_PAGE_PATH, ACCESS_DENIED_PAGE_ROUTE, INDEX_PAGE_PATH, INDEX_PAGE_ROUTE, LOGIN_PAGE_PATH, LOGIN_PAGE_ROUTE };
3
10
  /*! 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/helper.js CHANGED
@@ -1,3 +1,24 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- import{LOGIN_PAGE_PATH as t}from"./constants.js";import{useAppStore as a}from"./store.js";let i=null;function e(t){i=t}async function n(e){await i.invalidateQueries(),a.setState({isAuthenticated:!1},!0),await e.invalidate(),await e.navigate({to:t})}export{n as handleClientLogout,e as setCurrentFetchAuthenticatedUserApi};
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ import { LOGIN_PAGE_PATH } from './constants.js';
3
+ import { useAppStore } from './store.js';
4
+
5
+ let currentFetchAuthenticatedUserApi = null;
6
+ function setCurrentFetchAuthenticatedUserApi(fetchAuthenticatedUserApi) {
7
+ currentFetchAuthenticatedUserApi = fetchAuthenticatedUserApi;
8
+ }
9
+ async function handleClientLogout(router) {
10
+ await currentFetchAuthenticatedUserApi.invalidateQueries();
11
+ useAppStore.setState(
12
+ {
13
+ isAuthenticated: false
14
+ },
15
+ true
16
+ );
17
+ await router.invalidate();
18
+ await router.navigate({
19
+ to: LOGIN_PAGE_PATH
20
+ });
21
+ }
22
+
23
+ export { handleClientLogout, setCurrentFetchAuthenticatedUserApi };
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/es/index.js CHANGED
@@ -1,3 +1,20 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- export{createApiClient}from"./api.js";export{createApp}from"./app.js";import"./components/index.js";export{ACCESS_DENIED_PAGE_PATH,ACCESS_DENIED_PAGE_ROUTE,INDEX_PAGE_PATH,INDEX_PAGE_ROUTE,LOGIN_PAGE_PATH,LOGIN_PAGE_ROUTE}from"./constants.js";export{createRouter}from"./router.js";import"./routes/index.js";export{useAppStore}from"./store.js";export{default as VefAccessDeniedPage}from"./components/vef-access-denied-page/index.js";export{default as VefApp}from"./components/vef-app/index.js";export{default as VefDevAssistant}from"./components/vef-dev-assistant/index.js";export{default as VefErrorPage}from"./components/vef-error-page/index.js";export{default as VefLoginPage}from"./components/vef-login-page/index.js";export{default as VefNotFoundPage}from"./components/vef-not-found-page/index.js";export{default as VefRouterProvider}from"./components/vef-router-provider/index.js";export{createAccessDeniedRouteOptions}from"./routes/access-denied.js";export{createLayoutRouteOptions}from"./routes/layout.js";export{createLoginRouteOptions}from"./routes/login.js";export{createRootRoute}from"./routes/root.js";
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ export { createApiClient } from './api.js';
3
+ export { createApp } from './app.js';
4
+ import './components/index.js';
5
+ export { ACCESS_DENIED_PAGE_PATH, ACCESS_DENIED_PAGE_ROUTE, INDEX_PAGE_PATH, INDEX_PAGE_ROUTE, LOGIN_PAGE_PATH, LOGIN_PAGE_ROUTE } from './constants.js';
6
+ export { createRouter } from './router.js';
7
+ import './routes/index.js';
8
+ export { useAppStore } from './store.js';
9
+ export { default as VefAccessDeniedPage } from './components/vef-access-denied-page/index.js';
10
+ export { default as VefApp } from './components/vef-app/index.js';
11
+ export { default as VefDevAssistant } from './components/vef-dev-assistant/index.js';
12
+ export { default as VefErrorPage } from './components/vef-error-page/index.js';
13
+ export { default as VefLoginPage } from './components/vef-login-page/index.js';
14
+ export { default as VefNotFoundPage } from './components/vef-not-found-page/index.js';
15
+ export { default as VefRouterProvider } from './components/vef-router-provider/index.js';
16
+ export { createAccessDeniedRouteOptions } from './routes/access-denied.js';
17
+ export { createLayoutRouteOptions } from './routes/layout.js';
18
+ export { createLoginRouteOptions } from './routes/login.js';
19
+ export { createRootRoute } from './routes/root.js';
3
20
  /*! 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/router.js CHANGED
@@ -1,3 +1,67 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- import{createRouter as e,createBrowserHistory as r}from"@tanstack/react-router";import{VefLoadingPlaceholder as t,VefText as o}from"@vef-framework/components";import{showErrorNotification as a}from"@vef-framework/shared";import n from"nprogress";import{createElement as l}from"react";const s=6e5;function i({routeTree:i}){const c=e({routeTree:i,trailingSlash:"never",caseSensitive:!0,history:r(),search:{strict:!0},notFoundMode:"root",defaultPendingComponent:()=>l(t,{size:"large"}),defaultPendingMs:500,defaultPendingMinMs:300,defaultSsr:!1,defaultStructuralSharing:!0,defaultHashScrollIntoView:{behavior:"smooth",block:"start",inline:"center"},defaultPreload:"intent",defaultPreloadDelay:50,defaultPreloadGcTime:s,defaultGcTime:s,defaultOnCatch(e,r){a(e.message||e.name,l(o,{color:"error",children:l("pre",{style:{maxHeight:"480px",overflowY:"auto",scrollbarWidth:"thin",scrollbarColor:"rgba(0, 0, 0, 0.2) transparent"},children:e.stack||r.componentStack||"No stack trace available"})}))}});return c.subscribe("onBeforeLoad",(({pathChanged:e})=>e&&n.start())),c.subscribe("onLoad",(()=>n.done())),c}export{i as createRouter};
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ import { createRouter as createRouter$1, createBrowserHistory } from '@tanstack/react-router';
3
+ import { VefLoadingPlaceholder, VefText } from '@vef-framework/components';
4
+ import { showErrorNotification } from '@vef-framework/shared';
5
+ import NProgress from 'nprogress';
6
+ import { createElement } from 'react';
7
+
8
+ const defaultGcTime = 10 * 60 * 1e3;
9
+ function createRouter({
10
+ routeTree
11
+ }) {
12
+ const router = createRouter$1({
13
+ routeTree,
14
+ trailingSlash: "never",
15
+ caseSensitive: true,
16
+ history: createBrowserHistory(),
17
+ search: {
18
+ strict: true
19
+ },
20
+ notFoundMode: "root",
21
+ defaultPendingComponent: () => createElement(
22
+ VefLoadingPlaceholder,
23
+ {
24
+ size: "large"
25
+ }
26
+ ),
27
+ defaultPendingMs: 500,
28
+ defaultPendingMinMs: 300,
29
+ defaultSsr: false,
30
+ defaultStructuralSharing: true,
31
+ defaultHashScrollIntoView: {
32
+ behavior: "smooth",
33
+ block: "start",
34
+ inline: "center"
35
+ },
36
+ defaultPreload: "intent",
37
+ defaultPreloadDelay: 50,
38
+ defaultPreloadGcTime: defaultGcTime,
39
+ defaultGcTime,
40
+ defaultOnCatch(error, errorInfo) {
41
+ showErrorNotification(
42
+ error.message || error.name,
43
+ createElement(
44
+ VefText,
45
+ {
46
+ color: "error",
47
+ children: createElement("pre", {
48
+ style: {
49
+ maxHeight: "480px",
50
+ overflowY: "auto",
51
+ scrollbarWidth: "thin",
52
+ scrollbarColor: "rgba(0, 0, 0, 0.2) transparent"
53
+ },
54
+ children: error.stack || errorInfo.componentStack || "No stack trace available"
55
+ })
56
+ }
57
+ )
58
+ );
59
+ }
60
+ });
61
+ router.subscribe("onBeforeLoad", ({ pathChanged }) => pathChanged && NProgress.start());
62
+ router.subscribe("onLoad", () => NProgress.done());
63
+ return router;
64
+ }
65
+
66
+ export { createRouter };
3
67
  /*! 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,12 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- import"../components/index.js";import e from"../components/vef-access-denied-page/index.js";function n(){return{component:e}}export{n as createAccessDeniedRouteOptions};
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ import '../components/index.js';
3
+ import VefAccessDeniedPage from '../components/vef-access-denied-page/index.js';
4
+
5
+ function createAccessDeniedRouteOptions() {
6
+ return {
7
+ component: VefAccessDeniedPage
8
+ };
9
+ }
10
+
11
+ export { createAccessDeniedRouteOptions };
3
12
  /*! 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,6 @@
1
- /*! VefFramework version: 1.0.63, build time: 2025-01-09T12:00:01.608Z, made by Venus. */
2
- export{createAccessDeniedRouteOptions}from"./access-denied.js";export{createLayoutRouteOptions}from"./layout.js";export{createLoginRouteOptions}from"./login.js";export{createRootRoute}from"./root.js";
1
+ /*! VefFramework version: 1.0.64, build time: 2025-01-10T01:26:01.879Z, made by Venus. */
2
+ export { createAccessDeniedRouteOptions } from './access-denied.js';
3
+ export { createLayoutRouteOptions } from './layout.js';
4
+ export { createLoginRouteOptions } from './login.js';
5
+ export { createRootRoute } from './root.js';
3
6
  /*! 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 */