@vef-framework/core 1.0.7 → 1.0.9

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # The Core of VEF Framework
2
2
 
3
- VEF framework designed by Venus is built on top of React, and it provides a set of components that are essential for building a modern web application. These components are designed to be highly customizable and reusable, allowing developers to build complex and dynamic user interfaces with ease.
3
+ VEF framework made by Venus is built on top of React, and it provides a set of components that are essential for building a modern web application. These components are designed to be highly customizable and reusable, allowing developers to build complex and dynamic user interfaces with ease.
4
4
 
5
5
  ## Installation
6
6
 
@@ -1,3 +1,3 @@
1
- /*! VefFramework version: 1.0.7, build time: 2024-12-10T13:48:48.540Z, made by Venus. */
1
+ /*! VefFramework version: 1.0.9, build time: 2024-12-19T05:12:56.660Z, made by Venus. */
2
2
  import{useQuery as e,keepPreviousData as t,useMutation as i,useIsFetching as r,useIsMutating as s,QueryClientProvider as a}from"@tanstack/react-query";import{createElement as n}from"react";import{createQueryClient as u}from"./query-client.js";import{createRequestClient as c}from"./request-client.js";var h,o,l,d,y,g,p,f,Q=Object.defineProperty,v=e=>{throw TypeError(e)},m=(e,t,i)=>((e,t,i)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),A=(e,t,i)=>t.has(e)||v("Cannot "+i),b=(e,t,i)=>(A(e,t,"read from private field"),i?i.call(e):t.get(e)),D=(e,t,i)=>t.has(e)?v("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),w=(e,t,i,r)=>(A(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),q=(e,t,i)=>(A(e,t,"access private method"),i);class M{constructor(f){this.options=f,D(this,y),m(this,"useApiQuery"),m(this,"useApiMutation"),m(this,"useIsFetching"),m(this,"useIsMutating"),m(this,"QueryClientProvider"),D(this,h),D(this,o),D(this,l),D(this,d),w(this,h,u(f)),w(this,o,c(f)),w(this,l,{get:async(e,t)=>{const i=b(this,d);return w(this,d,void 0),await b(this,o).get(e,{...t,signal:i})},post:async(e,t,i)=>{const r=b(this,d);return w(this,d,void 0),await b(this,o).post(e,t,{...i,signal:r})},put:async(e,t,i)=>{const r=b(this,d);return w(this,d,void 0),await b(this,o).put(e,t,{...i,signal:r})},delete:async(e,t)=>{const i=b(this,d);return w(this,d,void 0),await b(this,o).delete(e,{...t,signal:i})}});const Q=this;this.useApiQuery=function(i,r,s){var a;const{keepPreviousData:n,placeholderData:u,initialData:c,...h}=s??{},o=e({queryKey:[i.key,r],queryFn:({signal:e})=>i(r,{signal:e}),select:q(Q,y,g),placeholderData:u??!0===n?t:void 0,initialData:c?{code:0,message:"ok",data:c}:void 0,...h});return q(a=Q,y,p).call(a,o)},this.useApiMutation=function(e){const{isPending:t,isIdle:r,isError:s,isSuccess:a,error:n,data:u,mutateAsync:c}=i({mutationKey:[e.key],mutationFn:t=>e(t)});return{mutate:async e=>await c(e),isPending:t,isIdle:r,isError:s,isSuccess:a,message:u?.message,error:n??void 0,data:u?.data}},this.useIsFetching=function(e,t){return r({queryKey:arguments.length>1?[e,t]:[e],type:"active",exact:!1})>0},this.useIsMutating=function(e){return s({mutationKey:[e],exact:!1})>0},this.QueryClientProvider=function({children:e}){return n(a,{client:b(Q,h)},e)}}async fetchApiQuery(e,t,i){const{initialData:r,...s}=i??{};return(await b(this,h).fetchQuery({queryKey:[e.key,t],queryFn:({signal:i})=>e(t,{signal:i}),initialData:r?{code:0,message:"ok",data:r}:void 0,...s})).data}createQueryApi(e,t){const i=q(this,y,f).call(this,e,t);return i.getQueryData=this.getApiQueryData.bind(this,e),i.getQueriesData=this.getApiQueriesData.bind(this,e),i.setQueryData=(t,i)=>this.setApiQueryData(t,e,i),i.removeQueries=this.removeApiQueries.bind(this,e),i.invalidateQueries=this.invalidateApiQueries.bind(this,e),i.resetQueries=this.resetApiQueries.bind(this,e),i.refetchQueries=this.refetchApiQueries.bind(this,e),i.cancelQueries=this.cancelApiQueries.bind(this,e),i.isFetching=this.isFetching.bind(this,e),i.useIsFetching=this.useIsFetching.bind(void 0,e),Object.freeze(i)}createMutationApi(e,t,i=[]){const r=q(this,y,f).call(this,e,t);return r.relatedQueries=Object.freeze(i),r.refetchRelatedQueries=function(){return Promise.all(i.map((e=>e.refetchQueries())))},r.invalidateRelatedQueries=function(){return Promise.all(i.map((e=>e.invalidateQueries())))},r.isMutating=this.isMutating.bind(this,e),r.useIsMutating=this.useIsMutating.bind(void 0,e),Object.freeze(r)}getApiQueryData(e,t){return b(this,h).getQueryData(arguments.length>1?[e,t]:[e])}getApiQueriesData(e,t){return b(this,h).getQueriesData({queryKey:arguments.length>1?[e,t]:[e],type:"active",exact:!1})}setApiQueryData(e,t,i){b(this,h).setQueryData(arguments.length>2?[t,i]:[t],e)}removeApiQueries(e,t){b(this,h).removeQueries({type:"all",exact:!1,queryKey:arguments.length>1?[e,t]:[e]})}invalidateApiQueries(e,t){return b(this,h).invalidateQueries({queryKey:arguments.length>1?[e,t]:[e],type:"all",exact:!1,stale:!1,refetchType:"active"},{throwOnError:!1,cancelRefetch:!1})}resetApiQueries(e,t){return b(this,h).resetQueries({queryKey:arguments.length>1?[e,t]:[e],type:"active",exact:!1},{cancelRefetch:!0,throwOnError:!1})}refetchApiQueries(e,t){return b(this,h).refetchQueries({queryKey:arguments.length>1?[e,t]:[e],type:"active",exact:!1},{throwOnError:!1,cancelRefetch:!1})}cancelApiQueries(e,t){return b(this,h).cancelQueries({queryKey:arguments.length>1?[e,t]:[e],type:"active",exact:!1},{revert:!0,silent:!0})}isFetching(e,t){return b(this,h).isFetching({queryKey:arguments.length>1?[e,t]:[e],type:"active",exact:!1})>0}isMutating(e){return b(this,h).isMutating({mutationKey:[e],exact:!1})>0}}function k(e){return Object.freeze(new M(e))}h=new WeakMap,o=new WeakMap,l=new WeakMap,d=new WeakMap,y=new WeakSet,g=function(e){return e.data},p=function({isPending:e,isFetching:t,isLoading:i,isRefetching:r,isSuccess:s,isPlaceholderData:a,isError:n,isLoadingError:u,isRefetchError:c,isStale:h,error:o,data:l,refetch:d}){return{isPending:e,isSuccess:s,isError:n,isLoadingError:u,isRefetchError:c,isLoading:i,isFetching:t,isRefetching:r,isPlaceholderData:a,isStale:h,error:o??void 0,data:l,refetch:async()=>{const e=await d();return{isSuccess:e.isSuccess,isError:e.isError,error:e.error,data:e.data}}}},f=function(e,t){const i=t(b(this,l)),r=async(e,t)=>(w(this,d,t?.signal),await i(e));return r.key=e,r};export{M as ApiClient,k as createApiClient};
3
3
  /*! 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,3 @@
1
- /*! VefFramework version: 1.0.7, build time: 2024-12-10T13:48:48.540Z, made by Venus. */
2
- import{ReactQueryDevtoolsPanel as e}from"@tanstack/react-query-devtools";import{VefError as i}from"@vef-framework/shared";import{createContext as t,useMemo as a,createElement as r,useContext as n}from"react";const u=t(null),s=({client:e,dataDictionaryQueryApi:i,children:t})=>{const n=a((()=>{const t=e.createQueryApi("_vefStubQueryApi",(()=>async e=>({code:0,message:"ok",data:e}))),a=e.createQueryApi("_vefAsyncFnQueryApi",(()=>async({args:e,fn:i})=>({code:0,message:"ok",data:await i(...e)}))),r=e.createMutationApi("_vefStubMutationApi",(()=>async e=>({code:0,message:"ok",data:e}))),n=e.createMutationApi("_vefAsyncFnMutationApi",(()=>async({args:e,fn:i})=>({code:0,message:"ok",data:await i(...e)})));return Object.freeze({useApiQuery:e.useApiQuery,useApiMutation:e.useApiMutation,useIsFetching:e.useIsFetching,useIsMutating:e.useIsMutating,fetchApiQuery:e.fetchApiQuery.bind(e),createQueryApi:e.createQueryApi.bind(e),createMutationApi:e.createMutationApi.bind(e),getApiQueryData:e.getApiQueryData.bind(e),getApiQueriesData:e.getApiQueriesData.bind(e),setApiQueryData:e.setApiQueryData.bind(e),removeApiQueries:e.removeApiQueries.bind(e),invalidateApiQueries:e.invalidateApiQueries.bind(e),resetApiQueries:e.resetApiQueries.bind(e),refetchApiQueries:e.refetchApiQueries.bind(e),cancelApiQueries:e.cancelApiQueries.bind(e),isFetching:e.isFetching.bind(e),isMutating:e.isMutating.bind(e),stubQueryApi:t,asyncFnQueryApi:a,stubMutationApi:r,asyncFnMutationApi:n,dataDictionaryQueryApi:i})}),[e,i]);return r(u.Provider,{value:n},r(e.QueryClientProvider,{},t))};function c(){const e=n(u);if(null===e)throw new i(-1,"Api context not found: Please ensure useApiContext is called within an ApiContextProvider");return e}const o=e;export{s as ApiContextProvider,o as ApiQueryDevtools,c as useApiContext};
1
+ /*! VefFramework version: 1.0.9, build time: 2024-12-19T05:12:56.660Z, made by Venus. */
2
+ import{ReactQueryDevtoolsPanel as e}from"@tanstack/react-query-devtools";import{VefError as i}from"@vef-framework/shared";import{createContext as t,useMemo as r,createElement as a,useContext as n}from"react";const u=t(null),s=({client:e,dataDictionaryQueryApi:i,children:t})=>{const n=r((()=>{const t=e.createQueryApi("_vefStubQueryApi",(()=>e=>Promise.resolve({code:0,message:"ok",data:e}))),r=e.createQueryApi("_vefAsyncFnQueryApi",(()=>async({args:e,fn:i})=>({code:0,message:"ok",data:await i(...e)}))),a=e.createMutationApi("_vefStubMutationApi",(()=>e=>Promise.resolve({code:0,message:"ok",data:e}))),n=e.createMutationApi("_vefAsyncFnMutationApi",(()=>async({args:e,fn:i})=>({code:0,message:"ok",data:await i(...e)})));return Object.freeze({useApiQuery:e.useApiQuery,useApiMutation:e.useApiMutation,useIsFetching:e.useIsFetching,useIsMutating:e.useIsMutating,fetchApiQuery:e.fetchApiQuery.bind(e),createQueryApi:e.createQueryApi.bind(e),createMutationApi:e.createMutationApi.bind(e),getApiQueryData:e.getApiQueryData.bind(e),getApiQueriesData:e.getApiQueriesData.bind(e),setApiQueryData:e.setApiQueryData.bind(e),removeApiQueries:e.removeApiQueries.bind(e),invalidateApiQueries:e.invalidateApiQueries.bind(e),resetApiQueries:e.resetApiQueries.bind(e),refetchApiQueries:e.refetchApiQueries.bind(e),cancelApiQueries:e.cancelApiQueries.bind(e),isFetching:e.isFetching.bind(e),isMutating:e.isMutating.bind(e),stubQueryApi:t,asyncFnQueryApi:r,stubMutationApi:a,asyncFnMutationApi:n,dataDictionaryQueryApi:i})}),[e,i]);return a(u.Provider,{value:n},a(e.QueryClientProvider,{},t))};function o(){const e=n(u);if(null===e)throw new i(-1,"Api context not found: Please ensure useApiContext is called within an ApiContextProvider");return e}const p=e;export{s as ApiContextProvider,p as ApiQueryDevtools,o as useApiContext};
3
3
  /*! 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/dist/api/index.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! VefFramework version: 1.0.7, build time: 2024-12-10T13:48:48.540Z, made by Venus. */
1
+ /*! VefFramework version: 1.0.9, build time: 2024-12-19T05:12:56.660Z, made by Venus. */
2
2
  export{ApiClient,createApiClient}from"./api-client.js";export{ApiContextProvider,ApiQueryDevtools,useApiContext}from"./api-context.js";export{useMutation}from"@tanstack/react-query";
3
3
  /*! 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,3 @@
1
- /*! VefFramework version: 1.0.7, build time: 2024-12-10T13:48:48.540Z, made by Venus. */
1
+ /*! VefFramework version: 1.0.9, build time: 2024-12-19T05:12:56.660Z, made by Venus. */
2
2
  import{QueryClient as e}from"@tanstack/react-query";function r(r){const t=r?.staleTime??1/0;return new e({defaultOptions:{queries:{networkMode:"always",staleTime:t,gcTime:r?.gcTime??6e5,retry:3,structuralSharing:!0,throwOnError:!1,refetchOnMount:!1,refetchOnReconnect:!0,refetchOnWindowFocus:!0},mutations:{networkMode:"always",gcTime:t,retry:!1,throwOnError:!1}}})}export{r as createQueryClient};
3
3
  /*! 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,5 @@
1
- import type { GenericAbortSignal } from "axios";
2
1
  import { type ApiResponse, type Consumer, type Except, type Mapper, type MaybeNullish, type ObjectType, type ObjectValue } from "@vef-framework/shared";
2
+ import { type GenericAbortSignal } from "axios";
3
3
  /**
4
4
  * The request client options.
5
5
  */
@@ -1,3 +1,3 @@
1
- /*! VefFramework version: 1.0.7, build time: 2024-12-10T13:48:48.540Z, made by Venus. */
2
- import{isNullish as e,showWarningMessage as t,VefError as a,isString as s,showErrorMessage as r,isFunction as o}from"@vef-framework/shared";import n,{CanceledError as i}from"axios";import l from"qs";var c,p=e=>{throw TypeError(e)},d=(e,t,a)=>t.has(e)||p("Cannot "+a),m=(e,t,a)=>(d(e,t,"read from private field"),a?a.call(e):t.get(e));const u=/\{(\w+)\}/;class h{constructor(o){var h,f,g;this.options=o,h=this,(f=c).has(h)?p("Cannot add the same private member more than once"):f instanceof WeakSet?f.add(h):f.set(h,g),((e,t,a,s)=>{d(e,t,"write to private field"),s?s.call(e,a):t.set(e,a)})(this,c,n.create({baseURL:o.baseUrl,timeout:o.timeout??3e4,headers:{"Content-Type":"application/json"},paramsSerializer:e=>l.stringify(e,{arrayFormat:"repeat",skipNulls:!0,charset:"utf-8"}),responseType:"json",validateStatus:()=>!0})),m(this,c).interceptors.request.use((t=>{const a=this.options.getAccessToken();a&&(t.headers.Authorization=`Bearer ${a}`);const s=t.url;return s&&u.test(s)&&(t.url=s.replace(u,((a,s)=>{const r=t.params?.[s];if(e(r))throw new Error(`Path parameter ${s} is nil`);return r}))),t})),m(this,c).interceptors.response.use((e=>{const{code:s,message:r}=e.data;return 0===s?e:(t(r),Promise.reject(new a(s,r)))}),(e=>{if(e instanceof i)return Promise.reject(e);const{response:t,message:o}=e;if(t?.data){const e=`处理请求响应信息异常:${o??"无"}`;return Promise.reject(new a(t.status,e))}{let t=o??(s(e)?e:"");if("Network Error"===t)t="接口连接异常可能原因:网络不通或存在跨域问题。";else if(t.includes("timeout"))t="接口请求超时";else if(t.includes("Request failed with status code")){t=`接口状态码异常:${o.substring(o.length-3)}`}else t="接口未知异常";return r(t),Promise.reject(new a(-1,t))}}))}async get(e,t){return(await m(this,c).get(e,{params:t?.params,signal:t?.signal})).data}async post(e,t,a){return(await m(this,c).post(e,t,{params:a?.params,signal:a?.signal})).data}async put(e,t,a){return(await m(this,c).put(e,t,{params:a?.params,signal:a?.signal})).data}async delete(e,t){return(await m(this,c).delete(e,{params:t?.params,signal:t?.signal})).data}async upload(e,t,a){return(await m(this,c).postForm(e,t,{params:a?.params,signal:a?.signal,onUploadProgress:o(a?.onProgress)?e=>{const t=e.lengthComputable?e.total??0:0,s=e.loaded,r=Math.round(s/t*100);a.onProgress?.(r)}:void 0})).data}async download(e,t){const{data:r,headers:n}=await m(this,c).get(e,{params:t?.params,responseType:"blob",onDownloadProgress:o(t?.onProgress)?e=>{const a=e.lengthComputable?e.total??0:0,s=e.loaded,r=Math.round(s/a*100);t.onProgress?.(r)}:void 0});let i=null;try{i=JSON.parse(await r.text())}catch{}if(i&&0!==i.code)throw new a(i.code,i.message);const l=n.get("content-disposition");if(s(l)){const e=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(l);if(e){const a=decodeURIComponent(e[1]),s=document.createElement("a");s.href=URL.createObjectURL(r),s.download=o(t?.fileName)?t.fileName(a):t?.fileName??a,s.click(),URL.revokeObjectURL(s.href)}}}}function f(e){return Object.freeze(new h(e))}c=new WeakMap;export{h as RequestClient,f as createRequestClient};
1
+ /*! VefFramework version: 1.0.9, build time: 2024-12-19T05:12:56.660Z, made by Venus. */
2
+ import{isNullish as e,showWarningMessage as t,VefError as a,isString as s,showErrorMessage as r,isFunction as o}from"@vef-framework/shared";import n,{CanceledError as i}from"axios";import l from"qs";var c,p=e=>{throw TypeError(e)},m=(e,t,a)=>t.has(e)||p("Cannot "+a),d=(e,t,a)=>(m(e,t,"read from private field"),a?a.call(e):t.get(e));const u=/\{\w+\}/;class h{constructor(o){var h,g,f;this.options=o,h=this,(g=c).has(h)?p("Cannot add the same private member more than once"):g instanceof WeakSet?g.add(h):g.set(h,f),((e,t,a,s)=>{m(e,t,"write to private field"),s?s.call(e,a):t.set(e,a)})(this,c,n.create({baseURL:o.baseUrl,timeout:o.timeout??3e4,headers:{"Content-Type":"application/json"},paramsSerializer:e=>l.stringify(e,{arrayFormat:"repeat",skipNulls:!0,charset:"utf-8"}),responseType:"json",validateStatus:()=>!0})),d(this,c).interceptors.request.use((t=>{const a=this.options.getAccessToken();a&&(t.headers.Authorization=`Bearer ${a}`);const{url:s}=t;return s&&u.test(s)&&(t.url=s.replace(u,((a,s)=>{const r=t.params?.[s];if(e(r))throw new Error(`Path parameter ${s} is nil`);return r}))),t})),d(this,c).interceptors.response.use((e=>{const{code:s,message:r}=e.data;return 0===s?e:(t(r),Promise.reject(new a(s,r)))}),(e=>{if(e instanceof i)return Promise.reject(e);const{response:t,message:o}=e;if(t?.data){const e=`处理请求响应信息异常:${o??"无"}`;return Promise.reject(new a(t.status,e))}{let t=o??(s(e)?e:"");if("Network Error"===t)t="接口连接异常可能原因:网络不通或存在跨域问题。";else if(t.includes("timeout"))t="接口请求超时";else if(t.includes("Request failed with status code")){t=`接口状态码异常:${o.substring(o.length-3)}`}else t="接口未知异常";return r(t),Promise.reject(new a(-1,t))}}))}async get(e,t){return(await d(this,c).get(e,{params:t?.params,signal:t?.signal})).data}async post(e,t,a){return(await d(this,c).post(e,t,{params:a?.params,signal:a?.signal})).data}async put(e,t,a){return(await d(this,c).put(e,t,{params:a?.params,signal:a?.signal})).data}async delete(e,t){return(await d(this,c).delete(e,{params:t?.params,signal:t?.signal})).data}async upload(e,t,a){return(await d(this,c).postForm(e,t,{params:a?.params,signal:a?.signal,onUploadProgress:o(a?.onProgress)?e=>{const t=e.lengthComputable?e.total??0:0,{loaded:s}=e,r=Math.round(s/t*100);a.onProgress?.(r)}:void 0})).data}async download(e,t){const{data:r,headers:n}=await d(this,c).get(e,{params:t?.params,responseType:"blob",onDownloadProgress:o(t?.onProgress)?e=>{const a=e.lengthComputable?e.total??0:0,{loaded:s}=e,r=Math.round(s/a*100);t.onProgress?.(r)}:void 0});let i=null;try{i=JSON.parse(await r.text())}catch{}if(i&&0!==i.code)throw new a(i.code,i.message);const l=n.get("content-disposition");if(s(l)){const e=/filename[^;=\n]*=(?<name>(?<quote>['"]).*?\2|[^;\n]*)/.exec(l);if(e&&e.groups){const{name:a}=e.groups,s=decodeURIComponent(a),n=document.createElement("a");n.href=URL.createObjectURL(r),n.download=o(t?.fileName)?t.fileName(s):t?.fileName??s,n.click(),URL.revokeObjectURL(n.href)}}}}function g(e){return Object.freeze(new h(e))}c=new WeakMap;export{h as RequestClient,g as createRequestClient};
3
3
  /*! 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,3 @@
1
- /*! VefFramework version: 1.0.7, build time: 2024-12-10T13:48:48.540Z, made by Venus. */
1
+ /*! VefFramework version: 1.0.9, build time: 2024-12-19T05:12:56.660Z, made by Venus. */
2
2
  import{isString as e,VefError as r}from"@vef-framework/shared";import{createContext as t,useMemo as o,createElement as n,useContext as i}from"react";const s=t(null),u=({permissionChecker:r,children:t})=>{const i=o((()=>({checkPermission:t=>!r||(e(t)?r(t):r(t.key))})),[r]);return n(s.Provider,{value:i},t)};function c(){const e=i(s);if(null===e)throw new r(-1,"useAuthContext must be used within a AuthContextProvider");return e}export{u as AuthContextProvider,c as useAuthContext};
3
3
  /*! 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,3 @@
1
- /*! VefFramework version: 1.0.7, build time: 2024-12-10T13:48:48.540Z, made by Venus. */
1
+ /*! VefFramework version: 1.0.9, build time: 2024-12-19T05:12:56.660Z, made by Venus. */
2
2
  export{AuthContextProvider,useAuthContext}from"./auth-context.js";
3
3
  /*! 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,3 @@
1
- /*! VefFramework version: 1.0.7, build time: 2024-12-10T13:48:48.540Z, made by Venus. */
2
- import{parseArgs as n,getAt as t,isQuotedString as e,rmEscapes as r}from"./helpers.js";function i(s){let l;const o=new Set,u=function(n,t){return"function"==typeof n?n(t):n},f=[{"&&":(n,t,e)=>u(n,e)&&u(t,e),"||":(n,t,e)=>u(n,e)||u(t,e)},{"===":(n,t,e)=>!(u(n,e)!==u(t,e)),"!==":(n,t,e)=>!(u(n,e)===u(t,e)),"==":(n,t,e)=>!(u(n,e)!=u(t,e)),"!=":(n,t,e)=>!(u(n,e)==u(t,e)),">=":(n,t,e)=>!!(u(n,e)>=u(t,e)),"<=":(n,t,e)=>!!(u(n,e)<=u(t,e)),">":(n,t,e)=>!!(u(n,e)>u(t,e)),"<":(n,t,e)=>!!(u(n,e)<u(t,e))},{"+":(n,t,e)=>u(n,e)+u(t,e),"-":(n,t,e)=>u(n,e)-u(t,e)},{"*":(n,t,e)=>u(n,e)*u(t,e),"/":(n,t,e)=>u(n,e)/u(t,e),"%":(n,t,e)=>u(n,e)%u(t,e)}],c=f.reduce(((n,t)=>n.concat(Object.keys(t))),[]),d=new Set(c.map((n=>n.charAt(0))));function g(n,t,e,r){const i=n.filter((n=>n.startsWith(t)));return!!i.length&&i.find((n=>{if(r.length>=e+n.length){if(r.substring(e,e+n.length)===n)return n}return!1}))}function h(n,t,e=1){let r=e?t.substring(n+1).trim():t.substring(0,n).trim();if(!r.length)return-1;if(!e){const n=r.split("").reverse(),t=n.findIndex((n=>d.has(n)));r=n.slice(t).join("")}const i=r[0];return f.findIndex((n=>!!g(Object.keys(n),i,0,r)))}function a(n,t){let e="";const r=t.length;let i=0;for(let s=n;s<r;s++){const n=t.charAt(s);if("("===n)i++;else if(")"===n)i--;else if(0===i&&" "===n)continue;if(0===i&&g(c,n,s,t))return[e,s-1];e+=n}return[e,t.length-1]}function b(n,t=0){const e=f[t],r=n.length,i=Object.keys(e);let s,l=0,o=!1,u=null,c="",d=null,b="",y="",m="",$="",j=0;const v=(n,t)=>{n?m+=t:c+=t};for(let f=0;f<r;f++)if(b=y,y=n.charAt(f),"'"!==y&&'"'!==y||"\\"===b||!(0===l&&!o||l&&!$))if(o&&(y!==o||"\\"===b)||$&&(y!==$||"\\"===b))v(l,y);else if(o!==y)if($!==y){if(" "!==y)if("("===y)0===l?j=f:m+=y,l++;else if(")"===y)if(l--,0===l){const e="string"==typeof c&&c.startsWith("$")?c:void 0,r=e&&"."===n.charAt(f+1);let i="";r&&([i,f]=a(f+2,n));const s=u?t:h(j,n,0),l=h(f,n);-1===s&&-1===l?(c=p(m,-1,e,i),"string"==typeof c&&(c=m)):u&&(s>=l||-1===l)&&t===s?(d=u.bind(null,p(m,-1,e,i)),u=null,c=""):l>s&&t===l?c=p(m,-1,e,i):c+=`(${m})${r?`.${i}`:""}`,m=""}else m+=y;else{if(0===l&&(s=g(i,y,f,n))){0===f&&console.error(103,[s,n]),f+=s.length-1,f===n.length-1&&console.error(104,[s,n]),u?c&&(d=u.bind(null,p(c,t)),u=e[s].bind(null,d),c=""):d?(u=e[s].bind(null,p(d,t)),d=null):(u=e[s].bind(null,p(c,t)),c="");continue}v(l,y)}}else $=!1,v(l,y);else o=!1,v(l,y);else l?$=y:o=y,v(l,y);return c&&u&&(u=u.bind(null,p(c,t))),u=!u&&d?d:u,!u&&c&&(u=(n,t)=>"function"==typeof n?n(t):n,u=u.bind(null,p(c,t))),u||c||console.error(105,n),u}function p(s,u,c,d){if(c){const e=p(c,f.length);let r,o=!!d&&i(`$${d}`);if("function"==typeof e){const i=n(String(s)).map((n=>p(n,-1)));return n=>{const s=e(n);return"function"!=typeof s?(console.warn(150,c),s):(r=s(...i.map((t=>"function"==typeof t?t(n):t))),o&&(o=o.provide((n=>{const e=l(n);return n.reduce(((n,i)=>{if(i===d||d?.startsWith(`${i}(`)){const e=t(r,i);n[i]=()=>e}else n[i]=e[i];return n}),{})}))),o?o():r)}}}else if("string"==typeof s){if("true"===s)return!0;if("false"===s)return!1;if("undefined"===s)return;if(e(s))return r(s.substring(1,s.length-1));if(!Number.isNaN(+s))return Number(s);if(u<f.length-1)return b(s,u+1);if(s.startsWith("$")){const n=s.substring(1);return o.add(n),function(t){return n in t?t[n]():void 0}}return s}return s}const y=b(s),m=Array.from(o);return Object.assign(y,{provide:function n(t){return l=t,Object.assign(y.bind(null,t(m)),{provide:n})}})}export{i as compile};
1
+ /*! VefFramework version: 1.0.9, build time: 2024-12-19T05:12:56.660Z, made by Venus. */
2
+ import{parseArgs as n,getAt as t,isQuotedString as e,rmEscapes as r}from"./helpers.js";function i(s){let l;const o=new Set,u=function(n,t){return"function"==typeof n?n(t):n},f=[{"&&":(n,t,e)=>u(n,e)&&u(t,e),"||":(n,t,e)=>u(n,e)||u(t,e)},{"===":(n,t,e)=>!(u(n,e)!==u(t,e)),"!==":(n,t,e)=>!(u(n,e)===u(t,e)),"==":(n,t,e)=>!(u(n,e)!=u(t,e)),"!=":(n,t,e)=>!(u(n,e)==u(t,e)),">=":(n,t,e)=>!!(u(n,e)>=u(t,e)),"<=":(n,t,e)=>!!(u(n,e)<=u(t,e)),">":(n,t,e)=>!!(u(n,e)>u(t,e)),"<":(n,t,e)=>!!(u(n,e)<u(t,e))},{"+":(n,t,e)=>u(n,e)+u(t,e),"-":(n,t,e)=>u(n,e)-u(t,e)},{"*":(n,t,e)=>u(n,e)*u(t,e),"/":(n,t,e)=>u(n,e)/u(t,e),"%":(n,t,e)=>u(n,e)%u(t,e)}],c=f.reduce(((n,t)=>n.concat(Object.keys(t))),[]),d=new Set(c.map((n=>n.charAt(0))));function g(n,t,e,r){const i=n.filter((n=>n.startsWith(t)));return!!i.length&&i.find((n=>{if(r.length>=e+n.length){if(r.substring(e,e+n.length)===n)return n}return!1}))}function h(n,t,e=1){let r=e?t.substring(n+1).trim():t.substring(0,n).trim();if(!r.length)return-1;if(!e){const n=r.split("").reverse(),t=n.findIndex((n=>d.has(n)));r=n.slice(t).join("")}const[i]=r;return f.findIndex((n=>!!g(Object.keys(n),i,0,r)))}function a(n,t){let e="";const{length:r}=t;let i=0;for(let s=n;s<r;s++){const n=t.charAt(s);if("("===n)i++;else if(")"===n)i--;else if(0===i&&" "===n)continue;if(0===i&&g(c,n,s,t))return[e,s-1];e+=n}return[e,t.length-1]}function b(n,t=0){const e=f[t],{length:r}=n,i=Object.keys(e);let s,l,o=0,u=!1,c=null,d="",b=null,y="",m="",$="",j=0;const v=(n,t)=>{n?m+=t:d+=t};for(let f=0;f<r;f++)if(l=y,y=n.charAt(f),"'"!==y&&'"'!==y||"\\"===l||!(0===o&&!u||o&&!$))if(u&&(y!==u||"\\"===l)||$&&(y!==$||"\\"===l))v(o,y);else if(u!==y)if($!==y){if(" "!==y)if("("===y)0===o?j=f:m+=y,o++;else if(")"===y)if(o--,0===o){const e="string"==typeof d&&d.startsWith("$")?d:void 0,r=e&&"."===n.charAt(f+1);let i="";r&&([i,f]=a(f+2,n));const s=c?t:h(j,n,0),l=h(f,n);-1===s&&-1===l?(d=p(m,-1,e,i),"string"==typeof d&&(d=m)):c&&(s>=l||-1===l)&&t===s?(b=c.bind(null,p(m,-1,e,i)),c=null,d=""):l>s&&t===l?d=p(m,-1,e,i):d+=`(${m})${r?`.${i}`:""}`,m=""}else m+=y;else{if(0===o&&(s=g(i,y,f,n))){0===f&&console.error(103,[s,n]),f+=s.length-1,f===n.length-1&&console.error(104,[s,n]),c?d&&(b=c.bind(null,p(d,t)),c=e[s].bind(null,b),d=""):b?(c=e[s].bind(null,p(b,t)),b=null):(c=e[s].bind(null,p(d,t)),d="");continue}v(o,y)}}else $=!1,v(o,y);else u=!1,v(o,y);else o?$=y:u=y,v(o,y);return d&&c&&(c=c.bind(null,p(d,t))),c=!c&&b?b:c,!c&&d&&(c=(n,t)=>"function"==typeof n?n(t):n,c=c.bind(null,p(d,t))),c||d||console.error(105,n),c}function p(s,u,c,d){if(c){const e=p(c,f.length);let r,o=!!d&&i(`$${d}`);if("function"==typeof e){const i=n(String(s)).map((n=>p(n,-1)));return n=>{const s=e(n);return"function"!=typeof s?(console.warn(150,c),s):(r=s(...i.map((t=>"function"==typeof t?t(n):t))),o&&(o=o.provide((n=>{const e=l(n);return n.reduce(((n,i)=>{if(i===d||d?.startsWith(`${i}(`)){const e=t(r,i);n[i]=()=>e}else n[i]=e[i];return n}),{})}))),o?o():r)}}}else if("string"==typeof s){if("true"===s)return!0;if("false"===s)return!1;if("undefined"===s)return;if(e(s))return r(s.substring(1,s.length-1));if(!Number.isNaN(+s))return Number(s);if(u<f.length-1)return b(s,u+1);if(s.startsWith("$")){const n=s.substring(1);return o.add(n),function(t){return n in t?t[n]():void 0}}return s}return s}const y=b(s),m=Array.from(o);return Object.assign(y,{provide:function n(t){return l=t,Object.assign(y.bind(null,t(m)),{provide:n})}})}export{i as compile};
3
3
  /*! 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,3 @@
1
- /*! VefFramework version: 1.0.7, build time: 2024-12-10T13:48:48.540Z, made by Venus. */
2
- function t(t,n){return Object.prototype.hasOwnProperty.call(t,n)}function n(n,r){if(!n||"object"!=typeof n)return null;const e=r.split(".");let o=n;for(const n in e){const r=e[n];if(t(o,r)&&(o=o[r]),+n==e.length-1)return o;if(!o||"object"!=typeof o)return null}return null}function r(t){if('"'!==t[0]&&"'"!==t[0])return!1;if(t[0]!==t[t.length-1])return!1;const n=t[0];for(let r=1;r<t.length;r++)if(t[r]===n&&(1===r||"\\"!==t[r-1])&&r!==t.length-1)return!1;return!0}function e(t){const n=[];let r="",e=0,o="",l="";for(let u=0;u<t.length;u++){const c=t.charAt(u);c===o&&"\\"!==l?o="":"'"!==c&&'"'!==c||o||"\\"===l?"("!==c||o?")"!==c||o||e--:e++:o=c,","!==c||o||0!==e?(" "!==c||o)&&(r+=c):(n.push(r),r=""),l=c}return r&&n.push(r),n}function o(t){if(!t.length)return"";let n="",r="";for(let e=0;e<t.length;e++){const o=t.charAt(e);"\\"===o&&"\\"!==r||(n+=o),r=o}return n}export{n as getAt,t as has,r as isQuotedString,e as parseArgs,o as rmEscapes};
1
+ /*! VefFramework version: 1.0.9, build time: 2024-12-19T05:12:56.660Z, made by Venus. */
2
+ function t(t,n){return Object.hasOwn(t,n)}function n(n,e){if(!n||"object"!=typeof n)return null;const r=e.split(".");let u=n;for(const n in r){const e=r[n];if(t(u,e)&&(u=u[e]),+n==r.length-1)return u;if(!u||"object"!=typeof u)return null}return null}function e(t){if('"'!==t[0]&&"'"!==t[0])return!1;if(t[0]!==t[t.length-1])return!1;const[n]=t;for(let e=1;e<t.length;e++)if(t[e]===n&&(1===e||"\\"!==t[e-1])&&e!==t.length-1)return!1;return!0}function r(t){const n=[];let e="",r=0,u="",o="";for(let l=0;l<t.length;l++){const f=t.charAt(l);f===u&&"\\"!==o?u="":"'"!==f&&'"'!==f||u||"\\"===o?"("!==f||u?")"!==f||u||r--:r++:u=f,","!==f||u||0!==r?(" "!==f||u)&&(e+=f):(n.push(e),e=""),o=f}return e&&n.push(e),n}function u(t){if(!t.length)return"";let n="",e="";for(let r=0;r<t.length;r++){const u=t.charAt(r);"\\"===u&&"\\"!==e||(n+=u),e=u}return n}export{n as getAt,t as has,e as isQuotedString,r as parseArgs,u as rmEscapes};
3
3
  /*! 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/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./api";
2
2
  export * from "./auth";
3
3
  export { compile } from "./expr/compiler";
4
+ export * from "./router";
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- /*! VefFramework version: 1.0.7, build time: 2024-12-10T13:48:48.540Z, made by Venus. */
2
- import"./api/index.js";import"./auth/index.js";export{compile}from"./expr/compiler.js";export{ApiClient,createApiClient}from"./api/api-client.js";export{useMutation}from"@tanstack/react-query";export{ApiContextProvider,ApiQueryDevtools,useApiContext}from"./api/api-context.js";export{AuthContextProvider,useAuthContext}from"./auth/auth-context.js";
1
+ /*! VefFramework version: 1.0.9, build time: 2024-12-19T05:12:56.660Z, made by Venus. */
2
+ import"./api/index.js";import"./auth/index.js";export{compile}from"./expr/compiler.js";import"./router/index.js";export{ApiClient,createApiClient}from"./api/api-client.js";export{useMutation}from"@tanstack/react-query";export{ApiContextProvider,ApiQueryDevtools,useApiContext}from"./api/api-context.js";export{AuthContextProvider,useAuthContext}from"./auth/auth-context.js";export{VefRouterProvider}from"./router/router-provider.js";
3
3
  /*! 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,3 @@
1
- /*! VefFramework version: 1.0.7, build time: 2024-12-10T13:48:48.540Z, made by Venus. */
1
+ /*! VefFramework version: 1.0.9, build time: 2024-12-19T05:12:56.660Z, made by Venus. */
2
2
  function t(){const t=[];let n=0;const e=n=>t.push(n),s=e=>{const o=t[n];return"function"==typeof o?o(e,(t=>(n++,s(t)))):(n=0,e)};return e.dispatch=s,e.unshift=n=>t.unshift(n),e.remove=n=>{const e=t.indexOf(n);e>-1&&t.splice(e,1)},e}export{t as default};
3
3
  /*! 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 */
@@ -0,0 +1 @@
1
+ export * from "./router-provider";
@@ -0,0 +1,3 @@
1
+ /*! VefFramework version: 1.0.9, build time: 2024-12-19T05:12:56.660Z, made by Venus. */
2
+ export{VefRouterProvider}from"./router-provider.js";
3
+ /*! 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 */
@@ -0,0 +1,18 @@
1
+ import { type RouterProps } from "@tanstack/react-router";
2
+ import { type ApiClient } from "../api";
3
+ /**
4
+ * The props of the VefRouterProvider component.
5
+ */
6
+ export interface VefRouterProviderProps extends Pick<RouterProps, "router"> {
7
+ }
8
+ /**
9
+ * The context of the router.
10
+ */
11
+ export interface RouterContext {
12
+ /**
13
+ * The fetchApiQuery function.
14
+ */
15
+ fetchApiQuery: ApiClient["fetchApiQuery"];
16
+ }
17
+ declare function VefRouterProvider({ router, }: VefRouterProviderProps): import("react").FunctionComponentElement<RouterProps<import("@tanstack/react-router").AnyRouter, Record<string, any>>>;
18
+ export { VefRouterProvider };
@@ -0,0 +1,3 @@
1
+ /*! VefFramework version: 1.0.9, build time: 2024-12-19T05:12:56.660Z, made by Venus. */
2
+ import{RouterProvider as t}from"@tanstack/react-router";import{useMemo as r,createElement as o}from"react";import"../api/index.js";import{useApiContext as e}from"../api/api-context.js";function i({router:i}){const{fetchApiQuery:p}=e(),c=r((()=>({fetchApiQuery:p})),[p]);return o(t,{router:i,context:c})}export{i as VefRouterProvider};
3
+ /*! VefFramework is a blazingly high-level, modern, flexible, easy-to-use UI framework made by Venus. Follow me on Github: https://github.com/ilxqx! @ilxqx */
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@vef-framework/core",
3
3
  "type": "module",
4
- "version": "1.0.7",
4
+ "version": "1.0.9",
5
5
  "private": false,
6
+ "packageManager": "pnpm@9.15.0",
6
7
  "description": "The core of the VEF framework",
7
8
  "author": "Venus",
8
9
  "keywords": [
@@ -18,32 +19,26 @@
18
19
  "engines": {
19
20
  "node": ">=20"
20
21
  },
21
- "scripts": {
22
- "build": "pnpm clean && tsx build.ts",
23
- "clean": "rimraf dist"
24
- },
25
- "peerDependencies": {
26
- "react": "18.3.1",
27
- "react-dom": "18.3.1",
28
- "zustand": "5.0.1"
29
- },
30
22
  "dependencies": {
31
- "@emotion/cache": "11.13.5",
32
- "@emotion/react": "11.13.5",
33
- "@emotion/styled": "11.13.5",
34
- "antd": "5.22.3",
23
+ "@emotion/cache": "11.14.0",
24
+ "@emotion/react": "11.14.0",
25
+ "@emotion/styled": "11.14.0",
26
+ "antd": "5.22.4",
35
27
  "tslib": "2.8.1",
36
28
  "use-sync-external-store": "^1.4.0",
37
- "@tanstack/react-query": "5.62.0",
38
- "@tanstack/react-query-devtools": "5.62.0",
39
- "@vef-framework/shared": "1.0.7",
40
- "axios": "1.7.8",
29
+ "@tanstack/react-query": "5.62.7",
30
+ "@tanstack/react-query-devtools": "5.62.7",
31
+ "@tanstack/react-router": "1.91.3",
32
+ "@vef-framework/shared": "1.0.9",
33
+ "axios": "1.7.9",
41
34
  "qs": "6.13.1"
42
35
  },
43
- "devDependencies": {
44
- "@types/qs": "6.9.17"
45
- },
46
36
  "publishConfig": {
47
37
  "access": "public"
38
+ },
39
+ "peerDependencies": {
40
+ "react": ">=18.0.0",
41
+ "react-dom": ">=18.0.0",
42
+ "zustand": ">=5.0.0"
48
43
  }
49
44
  }