@vef-framework/shared 1.0.5
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 +25 -0
- package/dist/constants.d.ts +28 -0
- package/dist/constants.js +3 -0
- package/dist/context.d.ts +21 -0
- package/dist/context.js +3 -0
- package/dist/dom.d.ts +9 -0
- package/dist/dom.js +3 -0
- package/dist/error.d.ts +16 -0
- package/dist/error.js +3 -0
- package/dist/event.d.ts +6 -0
- package/dist/event.js +3 -0
- package/dist/expression.d.ts +23 -0
- package/dist/expression.js +3 -0
- package/dist/function.d.ts +8 -0
- package/dist/function.js +3 -0
- package/dist/icons.d.ts +14 -0
- package/dist/icons.js +3 -0
- package/dist/id.d.ts +6 -0
- package/dist/id.js +3 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +3 -0
- package/dist/lib.d.ts +5 -0
- package/dist/lib.js +3 -0
- package/dist/message.d.ts +372 -0
- package/dist/message.js +3 -0
- package/dist/path.d.ts +43 -0
- package/dist/path.js +3 -0
- package/dist/pinyin.d.ts +14 -0
- package/dist/pinyin.js +3 -0
- package/dist/security.d.ts +16 -0
- package/dist/security.js +3 -0
- package/dist/store.d.ts +25 -0
- package/dist/store.js +3 -0
- package/dist/styles.d.ts +21 -0
- package/dist/styles.js +3 -0
- package/dist/temporal.d.ts +18 -0
- package/dist/temporal.js +3 -0
- package/dist/theme-variables.d.ts +339 -0
- package/dist/theme-variables.js +3 -0
- package/dist/types.d.ts +769 -0
- package/dist/utils.d.ts +45 -0
- package/dist/utils.js +3 -0
- package/dist/validation.d.ts +38 -0
- package/dist/validation.js +3 -0
- package/package.json +59 -0
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Consumer, GenericFunction, Handler, MaybePromise, ReturnAnyFunction } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Check if the function is an async function
|
|
4
|
+
*
|
|
5
|
+
* @param fn - The function
|
|
6
|
+
* @returns {boolean} - The result
|
|
7
|
+
*/
|
|
8
|
+
export declare function isAsyncFunction(fn: unknown): fn is ReturnAnyFunction<Promise<any>>;
|
|
9
|
+
/**
|
|
10
|
+
* Options for invoking a maybe async function
|
|
11
|
+
*/
|
|
12
|
+
export interface AsyncFnInvocationOptions<R> {
|
|
13
|
+
/**
|
|
14
|
+
* The function to invoke before the main function
|
|
15
|
+
*/
|
|
16
|
+
beforeInvoke?: Handler;
|
|
17
|
+
/**
|
|
18
|
+
* The function to invoke on success
|
|
19
|
+
*/
|
|
20
|
+
onSuccess?: Consumer<R>;
|
|
21
|
+
/**
|
|
22
|
+
* The function to invoke after the main function
|
|
23
|
+
*/
|
|
24
|
+
onFinally?: Handler;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Invoke a maybe async function
|
|
28
|
+
*
|
|
29
|
+
* @param fn - The function
|
|
30
|
+
* @param options - The options
|
|
31
|
+
* @param options.beforeInvoke - The function to invoke before the main function
|
|
32
|
+
* @param options.onSuccess - The function to invoke on success
|
|
33
|
+
* @param options.onFinally - The function to invoke after the main function
|
|
34
|
+
* @param args - The arguments
|
|
35
|
+
* @returns - The result
|
|
36
|
+
*/
|
|
37
|
+
export declare function invokeMaybeAsyncFn<A extends any[], R>(fn: GenericFunction<A, MaybePromise<R>>, { beforeInvoke, onSuccess, onFinally }: AsyncFnInvocationOptions<R>, ...args: A): Promise<R>;
|
|
38
|
+
/**
|
|
39
|
+
* Get the difference between two objects
|
|
40
|
+
*
|
|
41
|
+
* @param oldValues - The old values
|
|
42
|
+
* @param newValues - The new values
|
|
43
|
+
* @returns - The difference
|
|
44
|
+
*/
|
|
45
|
+
export declare function difference(oldValues: Record<string, any>, newValues: Record<string, any>): Record<string, any>;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! VefFramework version: 1.0.5, build time: 2024-12-10T10:24:47.065Z, made by Venus. */
|
|
2
|
+
import"./lib.js";import{isFunction as t}from"radashi";function n(n){return!!t(n)&&("AsyncFunction"===n.constructor.name||"[object AsyncFunction]"===Object.prototype.toString.call(n)||n.toString().startsWith("async "))}async function r(t,{beforeInvoke:r,onSuccess:o,onFinally:e},...c){if(n(t))try{r?.();const n=await t(...c);return o?.(n),n}finally{e?.()}else{const n=t(...c);if(!(n instanceof Promise))return n;try{r?.();const t=await n;return o?.(t),t}finally{e?.()}}}function o(t,n){return Object.keys(n).filter((r=>t[r]!==n[r])).reduce(((t,r)=>(t[r]=n[r],t)),{})}export{o as difference,r as invokeMaybeAsyncFn,n as isAsyncFunction};
|
|
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,38 @@
|
|
|
1
|
+
import { type IPVersion, type IsFloatOptions, type IsIntOptions, type IsLengthOptions, type IsTimeOptions, type UUIDVersion } from "validator";
|
|
2
|
+
export declare function isAlpha(value: string): boolean;
|
|
3
|
+
export declare function isAlphanumeric(value: string): boolean;
|
|
4
|
+
export declare function isAscii(value: string): boolean;
|
|
5
|
+
export declare function isNumeric(value: string): boolean;
|
|
6
|
+
export declare function isDecimal(value: string): boolean;
|
|
7
|
+
export declare function isFloat(value: string, options?: IsFloatOptions): boolean;
|
|
8
|
+
export declare function isBoolean(value: string): boolean;
|
|
9
|
+
export declare function isDate(value: string): boolean;
|
|
10
|
+
export declare function isEmpty(value: string): boolean;
|
|
11
|
+
export declare function isBlank(value: string): boolean;
|
|
12
|
+
export declare function isIdentityCard(value: string): boolean;
|
|
13
|
+
export declare function isAfter(value: string, date: string): boolean;
|
|
14
|
+
export declare function isBefore(value: string, date: string): boolean;
|
|
15
|
+
export declare function isEmail(value: string): boolean;
|
|
16
|
+
export declare function isHexColor(value: string): boolean;
|
|
17
|
+
export declare function isIn(value: string, values: string[]): boolean;
|
|
18
|
+
export declare function isInt(value: string, options?: IsIntOptions): boolean;
|
|
19
|
+
export declare function isIp(value: string, version?: IPVersion): boolean;
|
|
20
|
+
export declare function isIpRange(value: string, version?: IPVersion): boolean;
|
|
21
|
+
export declare function isJson(value: string): boolean;
|
|
22
|
+
export declare function isJwt(value: string): boolean;
|
|
23
|
+
export declare function isLatLong(value: string): boolean;
|
|
24
|
+
export declare function isLength(value: string, options: IsLengthOptions): boolean;
|
|
25
|
+
export declare function isMimeType(value: string): boolean;
|
|
26
|
+
export declare function isMobilePhone(value: string): boolean;
|
|
27
|
+
export declare function isPort(value: string): boolean;
|
|
28
|
+
export declare function isPostalCode(value: string): boolean;
|
|
29
|
+
export declare function isSemVer(value: string): boolean;
|
|
30
|
+
export declare function isSlug(value: string): boolean;
|
|
31
|
+
export declare function isStrongPassword(value: string): boolean;
|
|
32
|
+
export declare function isTime(value: string, options?: IsTimeOptions): boolean;
|
|
33
|
+
export declare function isUrl(value: string): boolean;
|
|
34
|
+
export declare function isUri(value: string): boolean;
|
|
35
|
+
export declare function isUuid(value: string, version?: UUIDVersion): boolean;
|
|
36
|
+
export declare function isDateTime(value: string): boolean;
|
|
37
|
+
export declare function matches(value: string, pattern: string, modifiers?: string): boolean;
|
|
38
|
+
export declare function isChineseName(value: string): boolean;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! VefFramework version: 1.0.5, build time: 2024-12-10T10:24:47.065Z, made by Venus. */
|
|
2
|
+
import n from"validator";function r(r){return n.isAlpha(r)}function t(r){return n.isAlphanumeric(r)}function i(r){return n.isAscii(r)}function e(r){return n.isNumeric(r)}function o(r){return n.isDecimal(r)}function u(r,t){return n.isFloat(r,t)}function s(r){return n.isBoolean(r,{loose:!1})}function c(r){return n.isDate(r,{format:"YYYY-MM-DD",strictMode:!0})}function f(r){return n.isEmpty(r)}function l(r){return n.isEmpty(r,{ignore_whitespace:!0})}function a(r){return n.isIdentityCard(r,"zh-CN")}function p(r,t){return n.isAfter(r,t)}function m(r,t){return n.isBefore(r,t)}function _(r){return n.isEmail(r)}function d(r){return n.isHexColor(r)}function h(r,t){return n.isIn(r,t)}function q(r,t){return n.isInt(r,t)}function g(r,t){return n.isIP(r,t)}function w(r,t){return n.isIPRange(r,t)}function L(r){return n.isJSON(r)}function y(r){return n.isJWT(r)}function C(r){return n.isLatLong(r)}function I(r,t){return n.isLength(r,t)}function N(r){return n.isMimeType(r)}function P(r){return n.isMobilePhone(r,"zh-CN")}function A(r){return n.isPort(r)}function D(r){return n.isPostalCode(r,"CN")}function M(r){return n.isSemVer(r)}function S(r){return n.isSlug(r)}function U(r){return n.isStrongPassword(r,{minLength:8,minLowercase:1,minUppercase:1,minNumbers:1,minSymbols:1})}function v(r,t){return n.isTime(r,t)}function E(r){return n.isURL(r,{protocols:["http","https"],require_tld:!0,require_protocol:!0,require_host:!0,require_port:!1,require_valid_protocol:!0,allow_underscores:!0})}function Y(r){return n.isURL(r,{protocols:[],require_tld:!1,require_protocol:!1,require_host:!1,require_port:!1,require_valid_protocol:!1,allow_underscores:!0,allow_fragments:!1,allow_query_components:!1,allow_protocol_relative_urls:!1})}function b(r,t){return n.isUUID(r,t)}function R(n){const[r,t]=n.split(" ",2);return c(r)&&v(t)}function T(r,t,i){return n.matches(r,t,i)}const x=/^[\u4E00-\u9FA5]+\d*$/;function z(n){return x.test(n)}export{p as isAfter,r as isAlpha,t as isAlphanumeric,i as isAscii,m as isBefore,l as isBlank,s as isBoolean,z as isChineseName,c as isDate,R as isDateTime,o as isDecimal,_ as isEmail,f as isEmpty,u as isFloat,d as isHexColor,a as isIdentityCard,h as isIn,q as isInt,g as isIp,w as isIpRange,L as isJson,y as isJwt,C as isLatLong,I as isLength,N as isMimeType,P as isMobilePhone,e as isNumeric,A as isPort,D as isPostalCode,M as isSemVer,S as isSlug,U as isStrongPassword,v as isTime,Y as isUri,E as isUrl,b as isUuid,T as matches};
|
|
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
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vef-framework/shared",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.5",
|
|
5
|
+
"private": false,
|
|
6
|
+
"description": "Shared fundamental to the VEF framework",
|
|
7
|
+
"author": "Venus",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"vef",
|
|
10
|
+
"vef-framework",
|
|
11
|
+
"vef-shared"
|
|
12
|
+
],
|
|
13
|
+
"main": "dist/index.js",
|
|
14
|
+
"types": "dist/index.d.ts",
|
|
15
|
+
"files": [
|
|
16
|
+
"*"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=20"
|
|
20
|
+
},
|
|
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
|
+
"dependencies": {
|
|
31
|
+
"@emotion/cache": "11.13.5",
|
|
32
|
+
"@emotion/react": "11.13.5",
|
|
33
|
+
"@emotion/styled": "11.13.5",
|
|
34
|
+
"antd": "5.22.3",
|
|
35
|
+
"tslib": "2.8.1",
|
|
36
|
+
"@ant-design/icons": "5.5.2",
|
|
37
|
+
"@date-fns/tz": "1.1.2",
|
|
38
|
+
"date-fns": "4.1.0",
|
|
39
|
+
"jsencrypt": "3.3.2",
|
|
40
|
+
"mitt": "3.0.1",
|
|
41
|
+
"nanoid": "5.0.9",
|
|
42
|
+
"path-browserify": "1.0.1",
|
|
43
|
+
"pinyin-pro": "3.26.0",
|
|
44
|
+
"radashi": "12.3.0",
|
|
45
|
+
"react-fast-compare": "3.2.2",
|
|
46
|
+
"scheduler": "0.25.0",
|
|
47
|
+
"type-fest": "4.30.0",
|
|
48
|
+
"use-context-selector": "2.0.0",
|
|
49
|
+
"validator": "13.12.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/path-browserify": "1.0.3",
|
|
53
|
+
"@types/scheduler": "0.23.0",
|
|
54
|
+
"@types/validator": "13.12.2"
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
}
|
|
59
|
+
}
|