@fast-china/utils 2.1.5 → 2.1.7

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 (55) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +14 -4
  3. package/README.zh.md +14 -4
  4. package/THIRD_PARTY_LICENSES.md +26 -0
  5. package/dist/crypto/index.mjs +2240 -33
  6. package/dist/crypto/index.mjs.map +1 -1
  7. package/dist/dom/index.mjs +2 -0
  8. package/dist/index.d.mts +1918 -26
  9. package/dist/index.global.min.js +1 -1
  10. package/dist/index.global.min.js.map +1 -1
  11. package/dist/index.mjs +9 -1
  12. package/dist/internal/runtime.mjs.map +1 -1
  13. package/dist/vue/breakpoints.mjs +46 -0
  14. package/dist/vue/breakpoints.mjs.map +1 -0
  15. package/dist/vue/element-size.mjs +33 -0
  16. package/dist/vue/element-size.mjs.map +1 -0
  17. package/dist/vue/event-listener.mjs +30 -0
  18. package/dist/vue/event-listener.mjs.map +1 -0
  19. package/dist/vue/index.mjs +15 -0
  20. package/dist/vue/now.mjs +29 -0
  21. package/dist/vue/now.mjs.map +1 -0
  22. package/dist/vue/resize-observer.mjs +31 -0
  23. package/dist/vue/resize-observer.mjs.map +1 -0
  24. package/dist/vue/window-size.mjs +32 -0
  25. package/dist/vue/window-size.mjs.map +1 -0
  26. package/package.json +4 -6
  27. package/dist/array/index.d.mts +0 -94
  28. package/dist/async/index.d.mts +0 -145
  29. package/dist/base64/index.d.mts +0 -106
  30. package/dist/color/index.d.mts +0 -89
  31. package/dist/crypto/index.d.mts +0 -327
  32. package/dist/date/index.d.mts +0 -190
  33. package/dist/dom/style.d.mts +0 -29
  34. package/dist/env/index.d.mts +0 -62
  35. package/dist/function/index.d.mts +0 -13
  36. package/dist/identity/index.d.mts +0 -77
  37. package/dist/internal/text.d.mts +0 -15
  38. package/dist/logger/index.d.mts +0 -90
  39. package/dist/number/index.d.mts +0 -89
  40. package/dist/object/index.d.mts +0 -114
  41. package/dist/storage/index.d.mts +0 -115
  42. package/dist/string/index.d.mts +0 -141
  43. package/dist/vue/emits.d.mts +0 -23
  44. package/dist/vue/expose.d.mts +0 -11
  45. package/dist/vue/func.d.mts +0 -13
  46. package/dist/vue/index.d.mts +0 -9
  47. package/dist/vue/install.d.mts +0 -50
  48. package/dist/vue/props.d.mts +0 -22
  49. package/dist/vue/render.d.mts +0 -11
  50. package/dist/vue/slots.d.mts +0 -18
  51. package/dist/vue/with.d.mts +0 -11
  52. package/docs/API.md +0 -155
  53. package/docs/API.zh-CN.md +0 -154
  54. package/docs/DEVELOPMENT_RELEASE.zh-CN.md +0 -65
  55. package/docs/RUNTIME_CONTRACT.md +0 -42
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to Fast.Utils are documented in this file.
4
4
 
5
+ ## [2.1.7] - 2026-09-14
6
+
7
+ ### Changed
8
+
9
+ - Bundled CryptoJS into the ESM package output to avoid CommonJS subpath resolution failures in strict ESM and uni-app toolchains while preserving module-level tree-shaking.
10
+
11
+ ## [2.1.6] - 2026-09-13
12
+
13
+ ### Added
14
+
15
+ - Added lightweight Vue 3 composables for native event listeners, window size, ResizeObserver, element size, current time, and minimum-width breakpoints.
16
+ - Added automatic Vue scope cleanup, manual stop handles where applicable, SSR-safe initial state, runtime validation, and public type coverage for the new composables.
17
+
5
18
  ## [2.1.5] - 2026-09-12
6
19
 
7
20
  ### Added
@@ -113,6 +126,8 @@ All notable changes to Fast.Utils are documented in this file.
113
126
 
114
127
  - Added authenticated ciphertext validation, bounded crypto parameters and payloads, unbiased Web Crypto randomness, prototype-safe query/object transforms, and namespace-scoped Storage cleanup.
115
128
 
129
+ [2.1.7]: https://github.com/China-xiaoFang/Fast.Utils/compare/v2.1.6...v2.1.7
130
+ [2.1.6]: https://github.com/China-xiaoFang/Fast.Utils/compare/v2.1.5...v2.1.6
116
131
  [2.1.5]: https://github.com/China-xiaoFang/Fast.Utils/compare/v2.1.4...v2.1.5
117
132
  [2.1.4]: https://github.com/China-xiaoFang/Fast.Utils/compare/v2.1.3...v2.1.4
118
133
  [2.1.3]: https://github.com/China-xiaoFang/Fast.Utils/compare/v2.1.2...v2.1.3
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  Browser-first TypeScript utilities for modern browsers, WebViews, Vue 3, and uni-app.
12
12
 
13
- [![npm version](https://img.shields.io/npm/v/@fast-china/utils?color=orange)](https://www.npmjs.com/package/@fast-china/utils) [![node](https://img.shields.io/badge/node-%5E22.18%20%7C%7C%20%5E24.18-brightgreen)](https://nodejs.org/) [![vue](https://img.shields.io/badge/vue-%5E3.3-42b883)](https://vuejs.org/) [![license](https://img.shields.io/npm/l/@fast-china/utils)](./LICENSE)
13
+ [![npm version](https://img.shields.io/npm/v/@fast-china/utils?color=orange)](https://www.npmjs.com/package/@fast-china/utils) [![node](https://img.shields.io/badge/node-%5E22.18%20%7C%7C%20%5E24.18-brightgreen)](https://nodejs.org/) [![vue](https://img.shields.io/badge/vue-%5E3.5.11-42b883)](https://vuejs.org/) [![license](https://img.shields.io/npm/l/@fast-china/utils)](./LICENSE)
14
14
 
15
15
  ## Highlights
16
16
 
@@ -133,13 +133,23 @@ Base64 and Crypto text decoding/decryption functions return the primitive-string
133
133
 
134
134
  Store passwords with `HashPasswordPBKDF2SHA256` and `VerifyPasswordPBKDF2SHA256`. MD5, SHA-1, AES-CBC, and AES-ECB do not provide password-storage or authenticated-encryption guarantees. See the [API reference](./docs/API.md#crypto) for the complete method list and security boundaries.
135
135
 
136
+ CryptoJS is bundled into the ESM and CDN artifacts for the compatibility hash and AES APIs. Consumers do not install or resolve `crypto-js` subpaths; applications that do not use Crypto APIs can still remove the independent crypto module through Tree Shaking.
137
+
136
138
  ## Vue 3
137
139
 
138
140
  ```ts
139
- import { useEmits, useProps, withInstall } from "@fast-china/utils";
141
+ import { useBreakpoints, useElementSize, useEventListener, useNow, useWindowSize } from "@fast-china/utils";
142
+ import { useTemplateRef } from "vue";
143
+
144
+ const elementRef = useTemplateRef<HTMLElement>("element");
145
+ const { width: windowWidth } = useWindowSize();
146
+ const { width: elementWidth } = useElementSize(elementRef);
147
+ const now = useNow();
148
+ const breakpoints = useBreakpoints({ desktop: 1280, mobile: 0, tablet: 768 });
149
+ useEventListener(document, "visibilitychange", () => console.log(document.visibilityState));
140
150
  ```
141
151
 
142
- The package provides Vue 3 `app.use()` registration, Composition API helpers, typed props/emits/slots, and TSX rendering. Vue remains external to the build and is required as a peer dependency.
152
+ The package provides lightweight native-backed browser composables, Vue 3 `app.use()` registration, typed props/emits/slots, and TSX rendering. Browser composables clean up with the current Vue scope; advanced scheduling, controls, SSR configuration, and device APIs remain outside this package. Vue remains external to the build and is required as a peer dependency.
143
153
 
144
154
  ## Modules
145
155
 
@@ -153,7 +163,7 @@ The `object` module includes dependency-free deep cloning and equality plus pred
153
163
 
154
164
  - The package-manager entry is pure ESM; the CDN entry is a separately minified IIFE.
155
165
  - ES2022 modern browsers and WebViews.
156
- - Vue 3.3 or newer through a required peer dependency.
166
+ - Vue 3.5.11 or newer through a required peer dependency.
157
167
  - uni-app through automatic global `uni` detection when Storage is configured.
158
168
  - No import-time access to `window`, Storage, or `uni`; unsupported calls fail explicitly.
159
169
  - Web Crypto, URL, Intl, TextEncoder, and related platform capabilities are not polyfilled.
package/README.zh.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  面向现代浏览器、WebView、Vue 3 与 uni-app 的 TypeScript 前端工具库。
12
12
 
13
- [![npm 版本](https://img.shields.io/npm/v/@fast-china/utils?color=orange)](https://www.npmjs.com/package/@fast-china/utils) [![node](https://img.shields.io/badge/node-%5E22.18%20%7C%7C%20%5E24.18-brightgreen)](https://nodejs.org/) [![Vue](https://img.shields.io/badge/vue-%5E3.3-42b883)](https://vuejs.org/) [![开源协议](https://img.shields.io/npm/l/@fast-china/utils)](./LICENSE)
13
+ [![npm 版本](https://img.shields.io/npm/v/@fast-china/utils?color=orange)](https://www.npmjs.com/package/@fast-china/utils) [![node](https://img.shields.io/badge/node-%5E22.18%20%7C%7C%20%5E24.18-brightgreen)](https://nodejs.org/) [![Vue](https://img.shields.io/badge/vue-%5E3.5.11-42b883)](https://vuejs.org/) [![开源协议](https://img.shields.io/npm/l/@fast-china/utils)](./LICENSE)
14
14
 
15
15
  ## 特性
16
16
 
@@ -133,13 +133,23 @@ Base64 与 Crypto 的文本解码/解密入口返回原始字符串类型 `Decod
133
133
 
134
134
  密码存储使用 `HashPasswordPBKDF2SHA256` 和 `VerifyPasswordPBKDF2SHA256`。MD5、SHA-1、AES-CBC 与 AES-ECB 不提供密码存储或认证加密保证。完整方法列表和安全边界见 [API 文档](./docs/API.zh-CN.md#crypto)。
135
135
 
136
+ 兼容哈希与 AES API 使用的 CryptoJS 已内联到 ESM 和 CDN 产物,消费项目无需安装或解析 `crypto-js` 子路径;未使用 Crypto API 的应用仍可通过 Tree Shaking 移除独立的加密模块。
137
+
136
138
  ## Vue 3
137
139
 
138
140
  ```ts
139
- import { useEmits, useProps, withInstall } from "@fast-china/utils";
141
+ import { useBreakpoints, useElementSize, useEventListener, useNow, useWindowSize } from "@fast-china/utils";
142
+ import { useTemplateRef } from "vue";
143
+
144
+ const elementRef = useTemplateRef<HTMLElement>("element");
145
+ const { width: windowWidth } = useWindowSize();
146
+ const { width: elementWidth } = useElementSize(elementRef);
147
+ const now = useNow();
148
+ const breakpoints = useBreakpoints({ desktop: 1280, mobile: 0, tablet: 768 });
149
+ useEventListener(document, "visibilitychange", () => console.log(document.visibilityState));
140
150
  ```
141
151
 
142
- 包内提供 Vue 3 `app.use()` 注册、Composition API Helper、Props/Emits/Slots 类型和 TSX 渲染。Vue 不会打进构建产物,并作为必须安装的 Peer Dependency。
152
+ 包内提供基于原生浏览器 API 的轻量 Composable、Vue 3 `app.use()` 注册、Props/Emits/Slots 类型和 TSX 渲染。浏览器 Composable 随当前 Vue 作用域自动清理;高级调度、控制、SSR 配置和设备 API 不在本包范围内。Vue 不会打进构建产物,并作为必须安装的 Peer Dependency。
143
153
 
144
154
  ## 模块
145
155
 
@@ -153,7 +163,7 @@ import { useEmits, useProps, withInstall } from "@fast-china/utils";
153
163
 
154
164
  - 包管理器入口为纯 ESM;CDN 入口为单独压缩的 IIFE。
155
165
  - 面向 ES2022 现代浏览器与 WebView。
156
- - Vue 3.3 及以上版本通过必须安装的 Peer Dependency 接入。
166
+ - Vue 3.5.11 及以上版本通过必须安装的 Peer Dependency 接入。
157
167
  - 配置 Storage 时自动检测全局 `uni` 并接入 uni-app。
158
168
  - 导入阶段不访问 `window`、Storage 或 `uni`;不支持的调用明确失败。
159
169
  - 不注入 Web Crypto、URL、Intl、TextEncoder 等 Polyfill。
@@ -0,0 +1,26 @@
1
+ # Third-Party Licenses
2
+
3
+ ## CryptoJS
4
+
5
+ CryptoJS is licensed under the MIT License.
6
+
7
+ Copyright (c) 2009-2013 Jeff Mott
8
+ Copyright (c) 2013-2016 Evan Vosberg
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in
18
+ all copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
+ THE SOFTWARE.