@fast-china/utils 2.1.3 → 2.1.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/CHANGELOG.md +21 -0
- package/README.md +2 -0
- package/README.zh.md +2 -0
- package/dist/array/index.d.mts +19 -12
- package/dist/array/index.mjs +15 -1
- package/dist/array/index.mjs.map +1 -1
- package/dist/async/index.d.mts +13 -14
- package/dist/async/index.mjs +7 -5
- package/dist/async/index.mjs.map +1 -1
- package/dist/base64/index.d.mts +13 -13
- package/dist/color/index.d.mts +10 -11
- package/dist/color/index.mjs.map +1 -1
- package/dist/crypto/index.d.mts +38 -39
- package/dist/crypto/index.mjs +9 -4
- package/dist/crypto/index.mjs.map +1 -1
- package/dist/date/index.d.mts +23 -24
- package/dist/date/index.mjs.map +1 -1
- package/dist/dom/style.d.mts +5 -6
- package/dist/env/index.d.mts +9 -10
- package/dist/env/index.mjs +17 -10
- package/dist/env/index.mjs.map +1 -1
- package/dist/function/index.d.mts +13 -0
- package/dist/function/index.mjs +38 -0
- package/dist/function/index.mjs.map +1 -0
- package/dist/identity/index.d.mts +5 -6
- package/dist/index.d.mts +4 -3
- package/dist/index.global.min.js +2 -2
- package/dist/index.global.min.js.map +1 -1
- package/dist/index.mjs +4 -3
- package/dist/internal/runtime.mjs +12 -0
- package/dist/internal/runtime.mjs.map +1 -0
- package/dist/internal/text.d.mts +1 -2
- package/dist/internal/text.mjs +1 -1
- package/dist/internal/text.mjs.map +1 -1
- package/dist/logger/index.d.mts +7 -8
- package/dist/logger/index.mjs +6 -7
- package/dist/logger/index.mjs.map +1 -1
- package/dist/number/index.d.mts +9 -10
- package/dist/number/index.mjs +4 -3
- package/dist/number/index.mjs.map +1 -1
- package/dist/object/index.d.mts +49 -11
- package/dist/object/index.mjs +258 -14
- package/dist/object/index.mjs.map +1 -1
- package/dist/storage/index.d.mts +10 -11
- package/dist/storage/index.mjs +3 -2
- package/dist/storage/index.mjs.map +1 -1
- package/dist/string/index.d.mts +18 -19
- package/dist/string/index.mjs +15 -13
- package/dist/string/index.mjs.map +1 -1
- package/dist/vue/emits.d.mts +2 -3
- package/dist/vue/emits.mjs.map +1 -1
- package/dist/vue/expose.d.mts +1 -2
- package/dist/vue/func.d.mts +2 -3
- package/dist/vue/install.d.mts +6 -7
- package/dist/vue/install.mjs.map +1 -1
- package/dist/vue/props.d.mts +2 -3
- package/dist/vue/render.d.mts +1 -2
- package/dist/vue/render.mjs.map +1 -1
- package/dist/vue/slots.d.mts +3 -4
- package/dist/vue/with.d.mts +1 -2
- package/docs/API.md +3 -2
- package/docs/API.zh-CN.md +3 -2
- package/package.json +11 -11
package/dist/vue/install.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.mjs","names":[],"sources":["../../src/vue/install.ts"],"sourcesContent":["import type { App } from \"vue\";\n\n/** Vue 组件对象、函数组件或指令对象可接受的最小结构类型。 */\nexport type VueInstallValue = object | ((...arguments_: never[]) => unknown);\n\n/** 为 Vue 组件或指令附加供 Vue 3 `app.use()` 调用的安装能力。 */\nexport type Installable<Value> = Value & {\n\t/**\n\t * 把当前组件或指令安装到 Vue 3 App。\n\t * @param app - Vue 3 App 实例。\n\t */\n\tinstall: (app: App) => void;\n};\n\n/** TSX 组件安装类型;与 {@link Installable} 保持同一运行时契约。 */\nexport type TSXWithInstall<Value> = Installable<Value>;\n\n/** 组件、指令注册所需的 Vue 3 App 能力。 */\ninterface VueAppRegistrationTarget {\n\t/**\n\t * 读取或注册全局组件。\n\t *\n\t * @param name - 全局组件名。\n\t * @param component - 注册时传入的组件;省略时读取现有组件。\n\t * @returns Vue App 返回的现有组件、注册结果或 App 自身。\n\t */\n\tcomponent: (name: string, component?: unknown) => unknown;\n\t/**\n\t * 读取或注册全局指令。\n\t *\n\t * @param name - 不带 `v-` 的全局指令名。\n\t * @param directive - 注册时传入的指令;省略时读取现有指令。\n\t * @returns Vue App 返回的现有指令、注册结果或 App 自身。\n\t */\n\tdirective: (name: string, directive?: unknown) => unknown;\n}\n\n/**\n * 校验 Vue 3 插件安装目标。\n *\n * @param value - Vue 3 App 实例。\n * @returns 只包含组件和指令注册能力的 App。\n * @throws `TypeError` 当目标不是对象或缺少 `component`、`directive` 方法。\n */\nconst assertApp = (value:
|
|
1
|
+
{"version":3,"file":"install.mjs","names":[],"sources":["../../src/vue/install.ts"],"sourcesContent":["import type { App } from \"vue\";\n\n/** Vue 组件对象、函数组件或指令对象可接受的最小结构类型。 */\nexport type VueInstallValue = object | ((...arguments_: never[]) => unknown);\n\n/** 为 Vue 组件或指令附加供 Vue 3 `app.use()` 调用的安装能力。 */\nexport type Installable<Value> = Value & {\n\t/**\n\t * 把当前组件或指令安装到 Vue 3 App。\n\t * @param app - Vue 3 App 实例。\n\t */\n\tinstall: (app: App) => void;\n};\n\n/** TSX 组件安装类型;与 {@link Installable} 保持同一运行时契约。 */\nexport type TSXWithInstall<Value> = Installable<Value>;\n\n/** 组件、指令注册所需的 Vue 3 App 能力。 */\ninterface VueAppRegistrationTarget {\n\t/**\n\t * 读取或注册全局组件。\n\t *\n\t * @param name - 全局组件名。\n\t * @param component - 注册时传入的组件;省略时读取现有组件。\n\t * @returns Vue App 返回的现有组件、注册结果或 App 自身。\n\t */\n\tcomponent: (name: string, component?: unknown) => unknown;\n\t/**\n\t * 读取或注册全局指令。\n\t *\n\t * @param name - 不带 `v-` 的全局指令名。\n\t * @param directive - 注册时传入的指令;省略时读取现有指令。\n\t * @returns Vue App 返回的现有指令、注册结果或 App 自身。\n\t */\n\tdirective: (name: string, directive?: unknown) => unknown;\n}\n\n/**\n * 校验 Vue 3 插件安装目标。\n *\n * @param value - Vue 3 App 实例。\n * @returns 只包含组件和指令注册能力的 App。\n * @throws `TypeError` 当目标不是对象或缺少 `component`、`directive` 方法。\n */\nconst assertApp = (value: unknown): VueAppRegistrationTarget => {\n\tif (typeof value !== \"object\" || value === null) {\n\t\tthrow new TypeError(\"安装 Vue 插件需要 Vue 3 App 实例。\");\n\t}\n\tconst app = value as Partial<VueAppRegistrationTarget>;\n\tif (typeof app.component !== \"function\" || typeof app.directive !== \"function\") {\n\t\tthrow new TypeError(\"安装 Vue 插件需要 `component()` 和 `directive()` 注册方法。\");\n\t}\n\treturn app as VueAppRegistrationTarget;\n};\n\n/**\n * 提取组件的全局注册名称。\n *\n * @param component - 待注册组件。\n * @returns 经过校验的显式名称。\n * @throws `TypeError` 当组件没有非空字符串名称,或名称包含空白。\n */\nconst getComponentName = (component: VueInstallValue): string => {\n\tconst name = (component as { name?: unknown }).name;\n\tif (typeof name !== \"string\" || name.length === 0 || /\\s/u.test(name)) {\n\t\tthrow new TypeError(\"可安装的 Vue 组件必须公开不含空白的非空名称。\");\n\t}\n\treturn name;\n};\n\n/**\n * 预检单个组件注册。\n *\n * @remarks 先读取同名组件并完成冲突判断,再返回延迟执行动作;调用方可以在所有组件预检通过后统一提交。\n * @param app - 已校验的 Vue 3 App 注册目标。\n * @param component - 待注册组件。\n * @returns 已校验的组件引用、名称和目标中是否已经存在同一引用。\n * @throws `Error` 当同名位置已由其他组件占用。\n */\nconst prepareComponentRegistration = (app: VueAppRegistrationTarget, component: VueInstallValue) => {\n\tconst name = getComponentName(component);\n\tconst existing = app.component(name);\n\tif (existing !== undefined && existing !== component) {\n\t\tthrow new Error(`Vue 组件名称“${name}”已被其他组件注册。`);\n\t}\n\treturn { component, name, registered: existing === component };\n};\n\n/**\n * 为主组件附加 Vue 3 `app.use()` 安装能力。\n *\n * @remarks 函数会直接为 `main` 定义附属组件属性和 `install`。所有组件名称、附属属性\n * 冲突会在修改 `main` 前完成校验;安装到 App 时也会先预检全部全局名称,再统一注册。\n * @param main - 具有非空 `name` 的组件。\n * @param extras - 同时注册并以可枚举属性挂到主组件的附属组件映射。\n * @returns 原始 `main` 引用,并附加类型化的 `install` 与 `extras` 属性。\n * @throws `TypeError` 当组件缺少合法名称、已有 `install`、附属键或名称发生冲突。\n * @throws `Error` 当 App 中同名位置已经注册其他组件。\n */\nexport function withInstall<Main extends VueInstallValue, Extras extends Record<string, VueInstallValue> = Record<never, never>>(\n\tmain: Main,\n\textras?: Extras\n): Installable<Main> & Extras {\n\tconst componentNames = new Set([getComponentName(main)]);\n\tif (\"install\" in Object(main)) throw new TypeError(\"Vue 组件已定义 `install` 属性。\");\n\tconst extraEntries = Object.entries(extras ?? {});\n\tif (extras !== undefined && Object.getOwnPropertySymbols(extras).some((key) => Object.prototype.propertyIsEnumerable.call(extras, key))) {\n\t\tthrow new TypeError(\"Vue 组件附属项必须使用字符串属性名。\");\n\t}\n\tfor (const [key, component] of extraEntries) {\n\t\tconst componentName = getComponentName(component);\n\t\tif (componentNames.has(componentName)) throw new TypeError(`Vue 组件名称“${componentName}”被重复注册。`);\n\t\tcomponentNames.add(componentName);\n\t\tif (key === \"install\" || key in Object(main)) {\n\t\t\tthrow new TypeError(`Vue 组件附属项“${key}”会覆盖主组件上的属性。`);\n\t\t}\n\t}\n\tconst installable = main as Installable<Main> & Extras;\n\tfor (const [key, component] of extraEntries) {\n\t\tObject.defineProperty(installable, key, { configurable: true, enumerable: true, value: component, writable: true });\n\t}\n\tinstallable.install = (value: App) => {\n\t\tconst app = assertApp(value);\n\t\t// 先完成全部冲突检查,再统一注册,避免安装到一半留下部分全局组件。\n\t\tconst registrations = [main, ...extraEntries.map(([, component]) => component)].map((component) =>\n\t\t\tprepareComponentRegistration(app, component)\n\t\t);\n\t\tfor (const registration of registrations) {\n\t\t\tif (!registration.registered) app.component(registration.name, registration.component);\n\t\t}\n\t};\n\treturn installable;\n}\n\n/**\n * 为不需要单独注册的附属组件附加空安装函数。\n *\n * @remarks 适用于只能作为主组件附属属性使用、但仍需满足 Vue Plugin 类型的组件。\n * 函数直接修改并返回传入组件,不会向 Vue 3 App 注册内容。\n * @param component - 尚未定义或继承 `install` 属性的组件。\n * @returns 原组件引用及无副作用的 `install` 方法。\n * @throws `TypeError` 当组件自身或原型链已经存在 `install`。\n */\nexport function withNoopInstall<Value extends VueInstallValue>(component: Value): TSXWithInstall<Value> {\n\tif (\"install\" in Object(component)) throw new TypeError(\"Vue 组件已定义 `install` 属性。\");\n\tconst installable = component as TSXWithInstall<Value>;\n\tinstallable.install = () => undefined;\n\treturn installable;\n}\n\n/**\n * 为 Vue 3 指令附加插件安装能力。\n *\n * @remarks 函数直接修改并返回指令。安装时重复注册同一引用保持幂等,不会覆盖同名的\n * 其他指令。名称只传给 `directive()`,不得包含 `v-` 前缀。\n * @param directive - 尚未定义或继承 `install` 属性的 Vue 指令对象。\n * @param name - 非空、无空白且不以 `v-` 开头的全局指令名。\n * @returns 原指令引用及 Vue Plugin `install` 方法。\n * @throws `TypeError` 当名称非法、指令已有 `install`,或安装目标无效。\n * @throws `Error` 当 App 中同名位置已经注册其他指令。\n */\nexport function withInstallDirective<Value extends VueInstallValue>(directive: Value, name: string): Installable<Value> {\n\tif (name.length === 0 || /\\s/u.test(name) || name.startsWith(\"v-\")) {\n\t\tthrow new TypeError(\"可安装的 Vue 指令名称不能包含空白或 `v-` 前缀。\");\n\t}\n\tif (\"install\" in Object(directive)) throw new TypeError(\"Vue 指令已定义 `install` 属性。\");\n\tconst installable = directive as Installable<Value>;\n\tinstallable.install = (value: App) => {\n\t\tconst app = assertApp(value);\n\t\tconst existing = app.directive(name);\n\t\tif (existing !== undefined && existing !== directive) {\n\t\t\tthrow new Error(`Vue 指令名称“${name}”已被其他指令注册。`);\n\t\t}\n\t\tif (existing !== directive) app.directive(name, directive);\n\t};\n\treturn installable;\n}\n"],"mappings":"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"}
|
package/dist/vue/props.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ import { ComputedRef, PropType } from "vue";
|
|
|
8
8
|
* @param runtimeType - Vue 支持的运行时构造器或构造器数组。
|
|
9
9
|
* @returns 同一引用,仅在类型层收窄为 `PropType<Value>`。
|
|
10
10
|
*/
|
|
11
|
-
declare function definePropType<Value>(runtimeType: unknown): PropType<Value>;
|
|
11
|
+
export declare function definePropType<Value>(runtimeType: unknown): PropType<Value>;
|
|
12
12
|
/**
|
|
13
13
|
* 构建需要透传给子组件的响应式 Props。
|
|
14
14
|
*
|
|
@@ -17,7 +17,6 @@ declare function definePropType<Value>(runtimeType: unknown): PropType<Value>;
|
|
|
17
17
|
* @param ignoredProps - 不需要透传的 Props 名称。
|
|
18
18
|
* @returns 只包含 `rawProps` 声明键且随 Props 更新的 ComputedRef。
|
|
19
19
|
*/
|
|
20
|
-
declare function useProps<Props extends object, RawProps extends object, IgnoredProp extends keyof RawProps = never>(props: Props, rawProps: RawProps, ignoredProps?: readonly IgnoredProp[]): ComputedRef<Omit<Pick<Props, Extract<keyof Props, keyof RawProps>>, Extract<IgnoredProp, keyof Props>>>;
|
|
20
|
+
export declare function useProps<Props extends object, RawProps extends object, IgnoredProp extends keyof RawProps = never>(props: Props, rawProps: RawProps, ignoredProps?: readonly IgnoredProp[]): ComputedRef<Omit<Pick<Props, Extract<keyof Props, keyof RawProps>>, Extract<IgnoredProp, keyof Props>>>;
|
|
21
21
|
//#endregion
|
|
22
|
-
export { definePropType, useProps };
|
|
23
22
|
//# sourceMappingURL=props.d.mts.map
|
package/dist/vue/render.d.mts
CHANGED
|
@@ -6,7 +6,6 @@ import { VNode } from "vue";
|
|
|
6
6
|
* @param render - 当前组件的渲染函数。
|
|
7
7
|
* @throws 不在组件 `setup` 调用栈中使用时抛出 `Error`。
|
|
8
8
|
*/
|
|
9
|
-
declare function useRender(render: () => VNode): void;
|
|
9
|
+
export declare function useRender(render: () => VNode): void;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { useRender };
|
|
12
11
|
//# sourceMappingURL=render.d.mts.map
|
package/dist/vue/render.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.mjs","names":[],"sources":["../../src/vue/render.ts"],"sourcesContent":["import { getCurrentInstance } from \"vue\";\nimport type { VNode } from \"vue\";\n\n/** `useRender` 需要写入的 Vue 3 内部组件实例字段。 */\ninterface MutableVueComponentInstance {\n\trender?: () => VNode;\n}\n\n/**\n * 在当前 Vue 3 组件实例上安装 TSX 渲染函数。\n * @remarks `setup` 仍可返回状态对象,因此状态能够显示在 Vue Devtools 中。\n * @param render - 当前组件的渲染函数。\n * @throws 不在组件 `setup` 调用栈中使用时抛出 `Error`。\n */\nexport function useRender(render: () => VNode): void {\n\tconst instance = getCurrentInstance();\n\tif (instance === null) throw new Error(\"`useRender` 必须在 `setup` 函数内部调用。\");\n\t(instance as
|
|
1
|
+
{"version":3,"file":"render.mjs","names":[],"sources":["../../src/vue/render.ts"],"sourcesContent":["import { getCurrentInstance } from \"vue\";\nimport type { VNode } from \"vue\";\n\n/** `useRender` 需要写入的 Vue 3 内部组件实例字段。 */\ninterface MutableVueComponentInstance {\n\trender?: () => VNode;\n}\n\n/**\n * 在当前 Vue 3 组件实例上安装 TSX 渲染函数。\n * @remarks `setup` 仍可返回状态对象,因此状态能够显示在 Vue Devtools 中。\n * @param render - 当前组件的渲染函数。\n * @throws 不在组件 `setup` 调用栈中使用时抛出 `Error`。\n */\nexport function useRender(render: () => VNode): void {\n\tconst instance = getCurrentInstance();\n\tif (instance === null) throw new Error(\"`useRender` 必须在 `setup` 函数内部调用。\");\n\t(instance as MutableVueComponentInstance).render = render;\n}\n"],"mappings":";;;;;;;;AAcA,SAAgB,UAAU,QAA2B;CACpD,MAAM,WAAW,mBAAmB;CACpC,IAAI,aAAa,MAAM,MAAM,IAAI,MAAM,iCAAiC;CACxE,SAA0C,SAAS;AACpD"}
|
package/dist/vue/slots.d.mts
CHANGED
|
@@ -5,15 +5,14 @@ type RawSlots = Record<string, unknown>;
|
|
|
5
5
|
/** 根据 Slot Props 是否为 never 生成无参数或有参数的 Slot 签名。 */
|
|
6
6
|
type VueSlot<Properties> = [Properties] extends [never] ? () => VNode[] : (properties: Properties) => VNode[];
|
|
7
7
|
/** 把 Slot 名称与作用域参数映射为 Vue 3 Slot 函数。 */
|
|
8
|
-
type TypedSlots<Slots extends RawSlots> = { [Name in keyof Slots]: VueSlot<Slots[Name]>; };
|
|
8
|
+
export type TypedSlots<Slots extends RawSlots> = { [Name in keyof Slots]: VueSlot<Slots[Name]>; };
|
|
9
9
|
/** Vue 3 `slots` 选项接受的运行时声明与官方静态类型标记。 */
|
|
10
|
-
type TypedSlotsDeclaration<Slots extends RawSlots> = SlotsType<Partial<TypedSlots<Slots>>>;
|
|
10
|
+
export type TypedSlotsDeclaration<Slots extends RawSlots> = SlotsType<Partial<TypedSlots<Slots>>>;
|
|
11
11
|
/**
|
|
12
12
|
* 为 Options API 的 `slots` 选项创建带作用域参数的类型声明。
|
|
13
13
|
*
|
|
14
14
|
* @returns 运行时 `Object` 构造器,并携带仅供 TypeScript 使用的 Slot 类型标记。
|
|
15
15
|
*/
|
|
16
|
-
declare function makeSlots<Slots extends RawSlots>(): TypedSlotsDeclaration<Slots>;
|
|
16
|
+
export declare function makeSlots<Slots extends RawSlots>(): TypedSlotsDeclaration<Slots>;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { TypedSlots, TypedSlotsDeclaration, makeSlots };
|
|
19
18
|
//# sourceMappingURL=slots.d.mts.map
|
package/dist/vue/with.d.mts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* @param data - 可选的原始值。
|
|
7
7
|
* @returns 传入值本身;省略时返回类型化的 `undefined`。
|
|
8
8
|
*/
|
|
9
|
-
declare function withDefineType<Value>(data?: Value): Value;
|
|
9
|
+
export declare function withDefineType<Value>(data?: Value): Value;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { withDefineType };
|
|
12
11
|
//# sourceMappingURL=with.d.mts.map
|
package/docs/API.md
CHANGED
|
@@ -123,7 +123,7 @@ Store passwords with `HashPasswordPBKDF2SHA256` and `VerifyPasswordPBKDF2SHA256`
|
|
|
123
123
|
|
|
124
124
|
## Modules
|
|
125
125
|
|
|
126
|
-
- `array`: `chunk`, `removeNullishValues`, `unique`, `uniqueBy`, `groupBy`, `partition`, `difference`, `intersection`, `hasDuplicatesBy`, and `allEqualBy`.
|
|
126
|
+
- `array`: `chunk`, `removeNullishValues`, `unique`, `uniqueBy`, `groupBy`, `partition`, `difference`, `intersection`, `symmetricDifference`, `hasDuplicatesBy`, and `allEqualBy`.
|
|
127
127
|
- `async`: abort-aware `sleep`, timeout, retry, bounded concurrent mapping, debounce, and throttle primitives.
|
|
128
128
|
- `base64`: strict UTF-8 Base64/Base64URL byte functions and chainable text results plus the historical Latin-1 and dictionary-obfuscation functions.
|
|
129
129
|
- `color`: Hex parsing/formatting/mixing, explicit black/white mixing, luminance, and contrast helpers.
|
|
@@ -131,9 +131,10 @@ Store passwords with `HashPasswordPBKDF2SHA256` and `VerifyPasswordPBKDF2SHA256`
|
|
|
131
131
|
- `date`: date validation and arithmetic, day ranges, relative formatting, and the seven historical date helpers as named functions.
|
|
132
132
|
- `dom`: CSS unit and style serialization helpers.
|
|
133
133
|
- `env`: capability and user-agent detection. Detection does not expand the supported runtime contract.
|
|
134
|
+
- `function`: `once` execution with cached return, Promise identity, and synchronous-error behavior.
|
|
134
135
|
- `logger`: isolated configurable loggers and the default `logger`.
|
|
135
136
|
- `number`: ranges, rounding, aggregation, interpolation, byte formatting, and Web Crypto-preferred `randomInt`.
|
|
136
|
-
- `object`: prototype-safe selection,
|
|
137
|
+
- `object`: deep cloning and equality, prototype-safe key and predicate selection, mapping, and query serialization. Style serialization is provided by the `dom` module.
|
|
137
138
|
- `string`: query parsing, casing, grapheme-aware truncation, clipboard copying, UUID, Web Crypto-preferred `randomString`, escaping, and whitespace normalization.
|
|
138
139
|
- `vue`: Composition API, type, render, and `app.use()` registration helpers for Vue 3.
|
|
139
140
|
|
package/docs/API.zh-CN.md
CHANGED
|
@@ -122,7 +122,7 @@ const result = plaintext.parseJson<{ id: number }>();
|
|
|
122
122
|
|
|
123
123
|
## 模块
|
|
124
124
|
|
|
125
|
-
- `array
|
|
125
|
+
- `array`:分块、压缩、去重、分组、分区、差集、交集、对称差集和一致性判断。
|
|
126
126
|
- `async`:支持取消的 Sleep、超时、重试、受限并发映射、防抖和节流。
|
|
127
127
|
- `base64`:严格 UTF-8 Base64/Base64URL 字节与链式文本结果,以及 Latin-1 和 SecureBase64 兼容函数。
|
|
128
128
|
- `color`:颜色解析、格式化、混合、明暗、亮度和对比度。
|
|
@@ -130,9 +130,10 @@ const result = plaintext.parseJson<{ id: number }>();
|
|
|
130
130
|
- `date`:日期校验、加减、日范围、相对时间,以及七个历史日期功能的具名函数。
|
|
131
131
|
- `dom`:CSS 单位和 Style 序列化。
|
|
132
132
|
- `env`:能力与 User-Agent 检测;检测函数不扩大运行时支持范围。
|
|
133
|
+
- `function`:最多执行一次并缓存返回值、Promise 引用或同步错误的 `once`。
|
|
133
134
|
- `logger`:隔离的可配置 Logger 和默认 `logger`。
|
|
134
135
|
- `number`:范围、舍入、聚合、插值、字节格式化,以及优先使用 Web Crypto 的 `randomInt`。
|
|
135
|
-
- `object
|
|
136
|
+
- `object`:深复制、深度比较、防原型污染的键和条件筛选、映射及 Query 序列化;Style 序列化由 `dom` 模块提供。
|
|
136
137
|
- `string`:Query 解析、大小写、字素截断、剪贴板复制、UUID、优先使用 Web Crypto 的 `randomString`、转义和空白规范化。
|
|
137
138
|
- `vue`:Vue 3 的 Composition API、类型、Render 和 `app.use()` 注册 Helper。
|
|
138
139
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fast-china/utils",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "Typed utilities for modern browsers, WebViews, Vue 3, and uni-app applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"prepack": "pnpm run check"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"vue": "^3.
|
|
65
|
+
"vue": "^3.5.11"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"crypto-js": "^4.2.0"
|
|
@@ -71,21 +71,21 @@
|
|
|
71
71
|
"@eslint/js": "^10.0.1",
|
|
72
72
|
"@eslint/markdown": "^8.0.3",
|
|
73
73
|
"@types/crypto-js": "^4.2.2",
|
|
74
|
-
"@types/node": "^24.13.
|
|
75
|
-
"eslint": "^10.
|
|
76
|
-
"eslint-config-flat-gitignore": "^2.
|
|
74
|
+
"@types/node": "^24.13.4",
|
|
75
|
+
"eslint": "^10.10.0",
|
|
76
|
+
"eslint-config-flat-gitignore": "^2.4.0",
|
|
77
77
|
"eslint-config-prettier": "^10.1.8",
|
|
78
78
|
"eslint-plugin-import-x": "^4.17.1",
|
|
79
79
|
"eslint-plugin-jsonc": "^3.4.2",
|
|
80
|
-
"eslint-plugin-regexp": "^3.
|
|
81
|
-
"globals": "^17.
|
|
80
|
+
"eslint-plugin-regexp": "^3.3.0",
|
|
81
|
+
"globals": "^17.12.0",
|
|
82
82
|
"prettier": "^3.9.6",
|
|
83
83
|
"publint": "^0.3.24",
|
|
84
|
-
"tsdown": "^0.
|
|
85
|
-
"tsx": "^4.23.
|
|
84
|
+
"tsdown": "^0.23.0",
|
|
85
|
+
"tsx": "^4.23.13",
|
|
86
86
|
"typescript": "^6.0.3",
|
|
87
|
-
"typescript-eslint": "^8.
|
|
88
|
-
"vue": "^3.5.
|
|
87
|
+
"typescript-eslint": "^8.70.0",
|
|
88
|
+
"vue": "^3.5.11"
|
|
89
89
|
},
|
|
90
90
|
"engines": {
|
|
91
91
|
"node": "^22.18.0 || ^24.18.0",
|