@composy/store-core 0.0.1 → 0.0.2
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 +64 -3
- package/README.md +196 -172
- package/dist/index.js +1331 -1115
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +578 -417
- package/dist/index.min.js.map +1 -1
- package/es/.dts-output-manifest.json +1 -0
- package/es/.dts.tsbuildinfo +1 -0
- package/es/core/async-action.d.ts +1 -71
- package/es/core/async-action.js +83 -35
- package/es/core/async-action.js.map +1 -1
- package/es/core/base-store.d.ts +27 -62
- package/es/core/base-store.js +174 -74
- package/es/core/base-store.js.map +1 -1
- package/es/core/batch-manager.d.ts +0 -1
- package/es/core/batch-manager.js +15 -2
- package/es/core/batch-manager.js.map +1 -1
- package/es/core/create-store.d.ts +3 -3
- package/es/core/create-store.js +3 -3
- package/es/core/create-store.js.map +1 -1
- package/es/core/event-bus.d.ts +0 -1
- package/es/core/event-bus.js +1 -1
- package/es/core/event-bus.js.map +1 -1
- package/es/core/index.d.ts +1 -2
- package/es/core/index.js +2 -2
- package/es/core/pub-sub.d.ts +0 -1
- package/es/core/pub-sub.js +1 -1
- package/es/core/pub-sub.js.map +1 -1
- package/es/engine/index.d.ts +0 -1
- package/es/engine/index.js +1 -1
- package/es/engine/plugin.d.ts +0 -1
- package/es/engine/plugin.js +11 -2
- package/es/engine/plugin.js.map +1 -1
- package/es/engine/types.d.ts +0 -1
- package/es/engine/types.js +1 -1
- package/es/errors/index.d.ts +0 -1
- package/es/errors/index.js +17 -1
- package/es/errors/index.js.map +1 -1
- package/es/index.d.ts +3 -4
- package/es/index.js +8 -8
- package/es/index.js.map +1 -1
- package/es/middleware/index.d.ts +3 -4
- package/es/middleware/index.js +2 -2
- package/es/middleware/logger.d.ts +0 -1
- package/es/middleware/logger.js +2 -2
- package/es/middleware/logger.js.map +1 -1
- package/es/middleware/middleware-manager.d.ts +0 -1
- package/es/middleware/middleware-manager.js +5 -2
- package/es/middleware/middleware-manager.js.map +1 -1
- package/es/middleware/persist.d.ts +0 -1
- package/es/middleware/persist.js +3 -3
- package/es/middleware/persist.js.map +1 -1
- package/es/middleware/time-travel.d.ts +0 -1
- package/es/middleware/time-travel.js +1 -1
- package/es/middleware/time-travel.js.map +1 -1
- package/es/middleware/validation.d.ts +0 -1
- package/es/middleware/validation.js +2 -2
- package/es/middleware/validation.js.map +1 -1
- package/es/plugins/define-plugin.d.ts +1 -2
- package/es/plugins/define-plugin.js +2 -2
- package/es/plugins/define-plugin.js.map +1 -1
- package/es/plugins/index.d.ts +0 -1
- package/es/plugins/index.js +2 -2
- package/es/plugins/plugin-manager.d.ts +1 -31
- package/es/plugins/plugin-manager.js +58 -27
- package/es/plugins/plugin-manager.js.map +1 -1
- package/es/types/action.d.ts +2 -0
- package/es/types/action.js +10 -0
- package/es/types/batch.d.ts +2 -0
- package/es/types/batch.js +10 -0
- package/es/types/event.d.ts +2 -0
- package/es/types/event.js +10 -0
- package/es/types/index.d.ts +2 -3
- package/es/types/index.js +1 -1
- package/es/types/middleware.d.ts +10 -2
- package/es/types/middleware.js +1 -1
- package/es/types/mutation.d.ts +2 -0
- package/es/types/mutation.js +10 -0
- package/es/types/plugin.d.ts +4 -1
- package/es/types/plugin.js +1 -1
- package/es/types/state.d.ts +2 -0
- package/es/types/state.js +10 -0
- package/es/types/store.d.ts +19 -1
- package/es/types/store.js +1 -1
- package/es/types/subscription.d.ts +7 -2
- package/es/types/subscription.js +1 -1
- package/es/types/time-travel.d.ts +2 -0
- package/es/types/time-travel.js +10 -0
- package/es/types/utility.d.ts +3 -4
- package/es/types/utility.js +1 -1
- package/es/utils/debounce-throttle.d.ts +0 -1
- package/es/utils/debounce-throttle.js +1 -1
- package/es/utils/debounce-throttle.js.map +1 -1
- package/es/utils/deep-clone.d.ts +0 -1
- package/es/utils/deep-clone.js +1 -1
- package/es/utils/deep-clone.js.map +1 -1
- package/es/utils/index.d.ts +4 -5
- package/es/utils/index.js +1 -1
- package/es/utils/selector.d.ts +0 -1
- package/es/utils/selector.js +1 -1
- package/es/utils/selector.js.map +1 -1
- package/esm/core/async-action.js +83 -35
- package/esm/core/async-action.js.map +1 -1
- package/esm/core/base-store.js +174 -74
- package/esm/core/base-store.js.map +1 -1
- package/esm/core/batch-manager.js +15 -2
- package/esm/core/batch-manager.js.map +1 -1
- package/esm/core/create-store.js +3 -3
- package/esm/core/create-store.js.map +1 -1
- package/esm/core/event-bus.js +1 -1
- package/esm/core/event-bus.js.map +1 -1
- package/esm/core/index.js +2 -2
- package/esm/core/pub-sub.js +1 -1
- package/esm/core/pub-sub.js.map +1 -1
- package/esm/engine/index.js +1 -1
- package/esm/engine/plugin.js +11 -2
- package/esm/engine/plugin.js.map +1 -1
- package/esm/errors/index.js +17 -1
- package/esm/errors/index.js.map +1 -1
- package/esm/index.js +8 -8
- package/esm/index.js.map +1 -1
- package/esm/middleware/logger.js +2 -2
- package/esm/middleware/logger.js.map +1 -1
- package/esm/middleware/middleware-manager.js +5 -2
- package/esm/middleware/middleware-manager.js.map +1 -1
- package/esm/middleware/persist.js +3 -3
- package/esm/middleware/persist.js.map +1 -1
- package/esm/middleware/time-travel.js +1 -1
- package/esm/middleware/time-travel.js.map +1 -1
- package/esm/middleware/validation.js +2 -2
- package/esm/middleware/validation.js.map +1 -1
- package/esm/plugins/define-plugin.js +2 -2
- package/esm/plugins/define-plugin.js.map +1 -1
- package/esm/plugins/plugin-manager.js +58 -27
- package/esm/plugins/plugin-manager.js.map +1 -1
- package/esm/utils/debounce-throttle.js +1 -1
- package/esm/utils/debounce-throttle.js.map +1 -1
- package/esm/utils/deep-clone.js +1 -1
- package/esm/utils/deep-clone.js.map +1 -1
- package/esm/utils/selector.js +1 -1
- package/esm/utils/selector.js.map +1 -1
- package/lib/core/async-action.cjs +83 -35
- package/lib/core/async-action.cjs.map +1 -1
- package/lib/core/async-action.d.cts +25 -0
- package/lib/core/base-store.cjs +174 -74
- package/lib/core/base-store.cjs.map +1 -1
- package/lib/core/base-store.d.cts +50 -0
- package/lib/core/batch-manager.cjs +15 -2
- package/lib/core/batch-manager.cjs.map +1 -1
- package/{esm/core/batch-manager.d.ts → lib/core/batch-manager.d.cts} +0 -1
- package/lib/core/create-store.cjs +3 -3
- package/lib/core/create-store.cjs.map +1 -1
- package/lib/core/{create-store.d.ts → create-store.d.cts} +3 -3
- package/lib/core/event-bus.cjs +1 -1
- package/lib/core/event-bus.cjs.map +1 -1
- package/lib/core/{event-bus.d.ts → event-bus.d.cts} +0 -1
- package/lib/core/index.cjs +2 -2
- package/{esm/core/index.d.ts → lib/core/index.d.cts} +1 -2
- package/lib/core/pub-sub.cjs +1 -1
- package/lib/core/pub-sub.cjs.map +1 -1
- package/lib/core/{pub-sub.d.ts → pub-sub.d.cts} +0 -1
- package/lib/engine/index.cjs +1 -1
- package/{esm/engine/index.d.ts → lib/engine/index.d.cts} +0 -1
- package/lib/engine/plugin.cjs +11 -2
- package/lib/engine/plugin.cjs.map +1 -1
- package/{esm/engine/plugin.d.ts → lib/engine/plugin.d.cts} +0 -1
- package/lib/engine/types.cjs +1 -1
- package/lib/engine/{types.d.ts → types.d.cts} +0 -1
- package/lib/errors/index.cjs +17 -1
- package/lib/errors/index.cjs.map +1 -1
- package/lib/errors/{index.d.ts → index.d.cts} +0 -1
- package/lib/index.cjs +8 -8
- package/lib/index.cjs.map +1 -1
- package/lib/{index.d.ts → index.d.cts} +3 -4
- package/lib/middleware/index.cjs +2 -2
- package/lib/middleware/{index.d.ts → index.d.cts} +3 -4
- package/lib/middleware/logger.cjs +2 -2
- package/lib/middleware/logger.cjs.map +1 -1
- package/lib/middleware/{logger.d.ts → logger.d.cts} +0 -1
- package/lib/middleware/middleware-manager.cjs +5 -2
- package/lib/middleware/middleware-manager.cjs.map +1 -1
- package/lib/middleware/{middleware-manager.d.ts → middleware-manager.d.cts} +0 -1
- package/lib/middleware/persist.cjs +3 -3
- package/lib/middleware/persist.cjs.map +1 -1
- package/{esm/middleware/persist.d.ts → lib/middleware/persist.d.cts} +0 -1
- package/lib/middleware/time-travel.cjs +1 -1
- package/lib/middleware/time-travel.cjs.map +1 -1
- package/{esm/middleware/time-travel.d.ts → lib/middleware/time-travel.d.cts} +0 -1
- package/lib/middleware/validation.cjs +2 -2
- package/lib/middleware/validation.cjs.map +1 -1
- package/{esm/middleware/validation.d.ts → lib/middleware/validation.d.cts} +0 -1
- package/lib/plugins/define-plugin.cjs +2 -2
- package/lib/plugins/define-plugin.cjs.map +1 -1
- package/{esm/plugins/define-plugin.d.ts → lib/plugins/define-plugin.d.cts} +1 -2
- package/lib/plugins/index.cjs +2 -2
- package/{esm/plugins/index.d.ts → lib/plugins/index.d.cts} +0 -1
- package/lib/plugins/plugin-manager.cjs +58 -27
- package/lib/plugins/plugin-manager.cjs.map +1 -1
- package/lib/plugins/plugin-manager.d.cts +5 -0
- package/lib/types/action.cjs +12 -0
- package/lib/types/action.d.cts +2 -0
- package/lib/types/batch.cjs +12 -0
- package/lib/types/batch.d.cts +2 -0
- package/lib/types/event.cjs +12 -0
- package/lib/types/event.d.cts +2 -0
- package/lib/types/index.cjs +1 -1
- package/{esm/types/index.d.ts → lib/types/index.d.cts} +2 -3
- package/lib/types/middleware.cjs +1 -1
- package/lib/types/{middleware.d.ts → middleware.d.cts} +10 -2
- package/lib/types/mutation.cjs +12 -0
- package/lib/types/mutation.d.cts +2 -0
- package/lib/types/plugin.cjs +1 -1
- package/lib/types/{plugin.d.ts → plugin.d.cts} +4 -1
- package/lib/types/state.cjs +12 -0
- package/lib/types/state.d.cts +2 -0
- package/lib/types/store.cjs +1 -1
- package/lib/types/{store.d.ts → store.d.cts} +19 -1
- package/lib/types/subscription.cjs +1 -1
- package/lib/types/{subscription.d.ts → subscription.d.cts} +7 -2
- package/lib/types/time-travel.cjs +12 -0
- package/lib/types/time-travel.d.cts +2 -0
- package/lib/types/utility.cjs +1 -1
- package/lib/types/{utility.d.ts → utility.d.cts} +3 -4
- package/lib/utils/debounce-throttle.cjs +1 -1
- package/lib/utils/debounce-throttle.cjs.map +1 -1
- package/{esm/utils/debounce-throttle.d.ts → lib/utils/debounce-throttle.d.cts} +0 -1
- package/lib/utils/deep-clone.cjs +1 -1
- package/lib/utils/deep-clone.cjs.map +1 -1
- package/lib/utils/{deep-clone.d.ts → deep-clone.d.cts} +0 -1
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/{index.d.ts → index.d.cts} +4 -5
- package/lib/utils/selector.cjs +1 -1
- package/lib/utils/selector.cjs.map +1 -1
- package/lib/utils/{selector.d.ts → selector.d.cts} +0 -1
- package/package.json +14 -11
- package/es/core/async-action.d.ts.map +0 -1
- package/es/core/base-store.d.ts.map +0 -1
- package/es/core/batch-manager.d.ts.map +0 -1
- package/es/core/create-store.d.ts.map +0 -1
- package/es/core/event-bus.d.ts.map +0 -1
- package/es/core/index.d.ts.map +0 -1
- package/es/core/pub-sub.d.ts.map +0 -1
- package/es/engine/index.d.ts.map +0 -1
- package/es/engine/plugin.d.ts.map +0 -1
- package/es/engine/types.d.ts.map +0 -1
- package/es/errors/index.d.ts.map +0 -1
- package/es/index.d.ts.map +0 -1
- package/es/middleware/index.d.ts.map +0 -1
- package/es/middleware/logger.d.ts.map +0 -1
- package/es/middleware/middleware-manager.d.ts.map +0 -1
- package/es/middleware/persist.d.ts.map +0 -1
- package/es/middleware/time-travel.d.ts.map +0 -1
- package/es/middleware/validation.d.ts.map +0 -1
- package/es/plugins/define-plugin.d.ts.map +0 -1
- package/es/plugins/index.d.ts.map +0 -1
- package/es/plugins/plugin-manager.d.ts.map +0 -1
- package/es/types/index.d.ts.map +0 -1
- package/es/types/middleware.d.ts.map +0 -1
- package/es/types/plugin.d.ts.map +0 -1
- package/es/types/store.d.ts.map +0 -1
- package/es/types/subscription.d.ts.map +0 -1
- package/es/types/utility.d.ts.map +0 -1
- package/es/utils/debounce-throttle.d.ts.map +0 -1
- package/es/utils/deep-clone.d.ts.map +0 -1
- package/es/utils/index.d.ts.map +0 -1
- package/es/utils/selector.d.ts.map +0 -1
- package/esm/core/async-action.d.ts +0 -95
- package/esm/core/base-store.d.ts +0 -85
- package/esm/core/create-store.d.ts +0 -66
- package/esm/core/event-bus.d.ts +0 -34
- package/esm/core/pub-sub.d.ts +0 -41
- package/esm/engine/types.d.ts +0 -81
- package/esm/errors/index.d.ts +0 -208
- package/esm/index.d.ts +0 -27
- package/esm/middleware/index.d.ts +0 -13
- package/esm/middleware/logger.d.ts +0 -67
- package/esm/middleware/middleware-manager.d.ts +0 -40
- package/esm/plugins/plugin-manager.d.ts +0 -35
- package/esm/types/middleware.d.ts +0 -172
- package/esm/types/plugin.d.ts +0 -136
- package/esm/types/store.d.ts +0 -198
- package/esm/types/subscription.d.ts +0 -158
- package/esm/types/utility.d.ts +0 -312
- package/esm/utils/deep-clone.d.ts +0 -143
- package/esm/utils/index.d.ts +0 -13
- package/esm/utils/selector.d.ts +0 -213
- package/lib/core/async-action.d.ts +0 -95
- package/lib/core/base-store.d.ts +0 -85
- package/lib/core/batch-manager.d.ts +0 -46
- package/lib/core/index.d.ts +0 -14
- package/lib/engine/index.d.ts +0 -10
- package/lib/engine/plugin.d.ts +0 -20
- package/lib/middleware/persist.d.ts +0 -34
- package/lib/middleware/time-travel.d.ts +0 -30
- package/lib/middleware/validation.d.ts +0 -100
- package/lib/plugins/define-plugin.d.ts +0 -74
- package/lib/plugins/index.d.ts +0 -8
- package/lib/plugins/plugin-manager.d.ts +0 -35
- package/lib/types/index.d.ts +0 -12
- package/lib/utils/debounce-throttle.d.ts +0 -86
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,66 @@
|
|
|
1
|
-
|
|
1
|
+
## [0.0.2] - 2026-10-12
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
### ✨ 新功能
|
|
4
4
|
|
|
5
|
-
-
|
|
5
|
+
- **store**: 优化核心类型定义与基础实现,完善文档及示例 ([1a4771d](https://gitee.com/ldesign-v1/ldesign-store/commit/1a4771ddfb2802408500d13d4824f40b1290812d)) - @swimly
|
|
6
|
+
- **store**: 新增 playground 示例与文档体系 ([87bf247](https://gitee.com/ldesign-v1/ldesign-store/commit/87bf2471823bc12c7b12ac97c5859b005e7929d7)) - @swimly
|
|
7
|
+
- **store**: 添加 LDesign 项目配置及 Store 优化实施规范 ([7c2671e](https://gitee.com/ldesign-v1/ldesign-store/commit/7c2671e5cef66284d3acdd84297472afeea0b5e0)) - @swimly
|
|
8
|
+
- **store**: 完善构建配置并暴露 getters 和 actions 运行时属性 ([8545317](https://gitee.com/ldesign-v1/ldesign-store/commit/854531704d5a9ec9222eee40d445112722f2e698)) - @swimly
|
|
9
|
+
- hand-crafted playground with real demos for store\packages\core ([d04cb89](https://gitee.com/ldesign-v1/ldesign-store/commit/d04cb89393558d33425c55e1803e6618e672aa64)) - @swimly
|
|
10
|
+
- auto-generated playground + README for store sub-packages ([90e109c](https://gitee.com/ldesign-v1/ldesign-store/commit/90e109c10b911656a6ed2322b2815bf83baaea2f)) - @swimly
|
|
11
|
+
- add playground for store\packages\core ([23b3bc8](https://gitee.com/ldesign-v1/ldesign-store/commit/23b3bc8638d6181bbffd530ae9f1227102059e81)) - @swimly
|
|
12
|
+
- 新增 Vue 插件、工具函数与 Playground 示例 ([4df6602](https://gitee.com/ldesign-v1/ldesign-store/commit/4df6602a2800b3698e6bc5c7036a140958a0504c)) - @swimly
|
|
13
|
+
- **engine**: 添加 store engine 插件基础结构 ([07ef880](https://gitee.com/ldesign-v1/ldesign-store/commit/07ef8801f672654b3ff207c4b28defc3944a52cd)) - @swimly
|
|
14
|
+
- 新增工具类型、错误处理和快照功能 ([6219701](https://gitee.com/ldesign-v1/ldesign-store/commit/6219701e7327f26794df8264cbd70c3037618080)) - @swimly
|
|
15
|
+
|
|
16
|
+
### ♻️ 代码重构
|
|
17
|
+
|
|
18
|
+
- 重构项目配置与代码结构,优化类型系统与功能 ([64e29ac](https://gitee.com/ldesign-v1/ldesign-store/commit/64e29ac61444ffff1e6e792bbe9a9501227e376b)) - @swimly
|
|
19
|
+
- **vue**: 重构运行时架构并统一持久化实现 ([c9a66e3](https://gitee.com/ldesign-v1/ldesign-store/commit/c9a66e3e563780a4f46879387faaa9f8b1408709)) - @swimly
|
|
20
|
+
- 移除文档系统和playground,标准化构建配置 ([9ae1c1b](https://gitee.com/ldesign-v1/ldesign-store/commit/9ae1c1b150aa765fae43e3599d338691a9a01345)) - @swimly
|
|
21
|
+
- **core**: 重构核心模块结构并优化类型定义 ([20a3436](https://gitee.com/ldesign-v1/ldesign-store/commit/20a343674d6f5117089729acd0732a64ad0d21b8)) - @swimly
|
|
22
|
+
- **build**: 移除umd格式并更新构建配置 ([c02dc47](https://gitee.com/ldesign-v1/ldesign-store/commit/c02dc47d00a56a6ed22b7391777953053ad6c740)) - @swimly
|
|
23
|
+
|
|
24
|
+
### 📝 文档更新
|
|
25
|
+
|
|
26
|
+
- **core**: 新增@ldesign/store-core优化任务文档 ([b421080](https://gitee.com/ldesign-v1/ldesign-store/commit/b421080ab44f4df0438f1e0941d5b998efc30dce)) - @swimly
|
|
27
|
+
|
|
28
|
+
### 📦 构建系统
|
|
29
|
+
|
|
30
|
+
- add rolldown bundler config for vue and core packages ([2a1f932](https://gitee.com/ldesign-v1/ldesign-store/commit/2a1f932a150c946b8c453a25527c4de1353c5d0a)) - @swimly
|
|
31
|
+
- 升级项目所有依赖至兼容最新版本 ([2bf6f05](https://gitee.com/ldesign-v1/ldesign-store/commit/2bf6f05ca266c410d2df4d5ec1ccea5840654492)) - @swimly
|
|
32
|
+
- 重构构建配置与修复类型检查问题 ([2ef2c0b](https://gitee.com/ldesign-v1/ldesign-store/commit/2ef2c0b74779cf4911cb61954bfce8523b9b5725)) - @swimly
|
|
33
|
+
- 标准化构建配置并调整输出目录结构 ([33c101e](https://gitee.com/ldesign-v1/ldesign-store/commit/33c101ee476820b3a3de8be1be354169ba4e90b5)) - @swimly
|
|
34
|
+
- **vue**: 添加 libraryType 配置并扩展 core 包导出 ([980c3e8](https://gitee.com/ldesign-v1/ldesign-store/commit/980c3e87ce3be2b73f2d74073e702da3ce79b8f8)) - @swimly
|
|
35
|
+
|
|
36
|
+
### 🔧 其他
|
|
37
|
+
|
|
38
|
+
- 更新项目配置与依赖版本 ([a98d95c](https://gitee.com/ldesign-v1/ldesign-store/commit/a98d95c2cf6fc17d601dcdfc34940dca631426f3)) - @swimly
|
|
39
|
+
- 更新 core 和 vue 包的依赖版本 ([8e29acd](https://gitee.com/ldesign-v1/ldesign-store/commit/8e29acdad154447e140c7475313ff947265ffef2)) - @swimly
|
|
40
|
+
- update store (26 files) ([b8cccd2](https://gitee.com/ldesign-v1/ldesign-store/commit/b8cccd20cd665d78968b104c030aacf01f33f2a8)) - @swimly
|
|
41
|
+
- normalize versions, clean artifacts, update gitignore ([7b373ed](https://gitee.com/ldesign-v1/ldesign-store/commit/7b373ed6f54f1afc004ae7ac3ebc33fea062a22b)) - @swimly
|
|
42
|
+
- update - docs(core): 新增@ldesign/store-core优化任务æ ([a486937](https://gitee.com/ldesign-v1/ldesign-store/commit/a486937b0c0939cad23dcfcb675dd2aa450171cd)) - @swimly
|
|
43
|
+
- 批量更新 - 规范 .gitignore 清理源码 ([d4fc64e](https://gitee.com/ldesign-v1/ldesign-store/commit/d4fc64ebb656fa8ef03adc319b41becaa453fd00)) - @swimly
|
|
44
|
+
- unified build config and structure ([e41794e](https://gitee.com/ldesign-v1/ldesign-store/commit/e41794e94409cf358de7568b812794d44b656813)) - @swimly
|
|
45
|
+
- 统一配置 ESLint、Prettier 和测试脚本 ([de95488](https://gitee.com/ldesign-v1/ldesign-store/commit/de95488a91bbe087badc21feabf9f54a22ee5459)) - @swimly
|
|
46
|
+
- 统一代码规范配置并更新测试工具 ([7ecaf03](https://gitee.com/ldesign-v1/ldesign-store/commit/7ecaf03f7bd22ae43b9d0775f8439a583f548829)) - @swimly
|
|
47
|
+
- 更新依赖版本至固定版本并移除冗余插件 ([fd11677](https://gitee.com/ldesign-v1/ldesign-store/commit/fd116777c7ca95a0d29ea1e05d6c4e7513584a33)) - @swimly
|
|
48
|
+
- batch commit submodule changes ([b2bb508](https://gitee.com/ldesign-v1/ldesign-store/commit/b2bb508085b6eac2b9e748a89b46470964382b6d)) - @swimly
|
|
49
|
+
- set versions to 0.0.1 and pin @ldesign deps ([b4219a7](https://gitee.com/ldesign-v1/ldesign-store/commit/b4219a727eeaf842199869cb9b40c702010bbb2f)) - @swimly
|
|
50
|
+
- 更新多个子模块至最新提交并重构lottie库依赖配置 ([792a7ec](https://gitee.com/ldesign-v1/ldesign-store/commit/792a7eca24e6f9825ad37fb70926b1562c17ae52)) - @swimly
|
|
51
|
+
- 移除多余的空行并删除vue示例的README文件 ([37c15f7](https://gitee.com/ldesign-v1/ldesign-store/commit/37c15f7d7df4acafdc3307a6417e468c503bfa0f)) - @swimly
|
|
52
|
+
|
|
53
|
+
### 👥 Contributors
|
|
54
|
+
|
|
55
|
+
swimly, swimly
|
|
56
|
+
|
|
57
|
+
### 📊 Statistics
|
|
58
|
+
|
|
59
|
+
- Total Commits: **35**
|
|
60
|
+
- Contributors: **2**
|
|
61
|
+
|
|
62
|
+
# Changelog
|
|
63
|
+
|
|
64
|
+
## 0.1.0 (2026-06-11)
|
|
65
|
+
|
|
66
|
+
- 初始版本发布
|
package/README.md
CHANGED
|
@@ -1,172 +1,196 @@
|
|
|
1
|
-
# @composy/store-core
|
|
2
|
-
|
|
3
|
-
> 🎯 框架无关的状态管理核心库 — Store、中间件、插件、PubSub、工具函数,一应俱全
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@composy/store-core)
|
|
6
|
-
[](https://opensource.org/licenses/MIT)
|
|
7
|
-
|
|
8
|
-
## ✨ 特性
|
|
9
|
-
|
|
10
|
-
- 🏗️ **Store 抽象** — BaseStore 基类 + createStore 工厂函数,灵活创建状态管理
|
|
11
|
-
- 🔧 **中间件系统** — Logger/持久化/时间旅行/校验中间件开箱即用
|
|
12
|
-
- 🔌 **插件扩展** — defineStorePlugin + createPluginManager,可扩展架构
|
|
13
|
-
- 📢 **事件通信** — PubSub 发布订阅 + EventBus 事件总线
|
|
14
|
-
- ⚡ **性能优化** — 批量更新(batch)、记忆化选择器、智能缓存
|
|
15
|
-
- 🧰 **工具函数** — deepClone/deepMerge/createSelector/debounce/throttle 全套
|
|
16
|
-
- 🧩 **Engine Bridge** — 框架无关的 engine state/API/container/events 生命周期桥接
|
|
17
|
-
- 📦 **TypeScript** — 完整类型定义
|
|
18
|
-
|
|
19
|
-
## 🧭 Core-first 边界
|
|
20
|
-
|
|
21
|
-
`@composy/store-core`
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
bus
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
1
|
+
# @composy/store-core
|
|
2
|
+
|
|
3
|
+
> 🎯 框架无关的状态管理核心库 — Store、中间件、插件、PubSub、工具函数,一应俱全
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@composy/store-core)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## ✨ 特性
|
|
9
|
+
|
|
10
|
+
- 🏗️ **Store 抽象** — BaseStore 基类 + createStore 工厂函数,灵活创建状态管理
|
|
11
|
+
- 🔧 **中间件系统** — Logger/持久化/时间旅行/校验中间件开箱即用
|
|
12
|
+
- 🔌 **插件扩展** — defineStorePlugin + createPluginManager,可扩展架构
|
|
13
|
+
- 📢 **事件通信** — PubSub 发布订阅 + EventBus 事件总线
|
|
14
|
+
- ⚡ **性能优化** — 批量更新(batch)、记忆化选择器、智能缓存
|
|
15
|
+
- 🧰 **工具函数** — deepClone/deepMerge/createSelector/debounce/throttle 全套
|
|
16
|
+
- 🧩 **Engine Bridge** — 框架无关的 engine state/API/container/events 生命周期桥接
|
|
17
|
+
- 📦 **TypeScript** — 完整类型定义
|
|
18
|
+
|
|
19
|
+
## 🧭 Core-first 边界
|
|
20
|
+
|
|
21
|
+
`@composy/store-core`
|
|
22
|
+
是唯一的通用能力承载层。Store 生命周期、action 订阅、批处理、中间件链、时间旅行快照、engine
|
|
23
|
+
state/API 同步和工具函数都在这里维护。
|
|
24
|
+
|
|
25
|
+
框架适配包只能通过公开 API 复用 core:
|
|
26
|
+
|
|
27
|
+
- Vue/Pinia runtime 由 `@composy/store-vue` 创建。
|
|
28
|
+
- engine state/API/container/events 的绑定由 `createStoreEngineBridge()` 统一完成。
|
|
29
|
+
- 后续新增 React/Lit/Vanilla 适配时应复用同一个 bridge,不要再复制 engine plugin 生命周期。
|
|
30
|
+
|
|
31
|
+
## 📦 安装
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm add @composy/store-core
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 🚀 快速开始
|
|
38
|
+
|
|
39
|
+
### createStore — 工厂函数
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { createStore } from '@composy/store-core'
|
|
43
|
+
|
|
44
|
+
const useCounterStore = createStore({
|
|
45
|
+
id: 'counter',
|
|
46
|
+
state: () => ({ count: 0 }),
|
|
47
|
+
getters: {
|
|
48
|
+
doubleCount: state => state.count * 2,
|
|
49
|
+
isPositive: state => state.count > 0,
|
|
50
|
+
},
|
|
51
|
+
actions: {
|
|
52
|
+
increment() {
|
|
53
|
+
this.$patch({ count: this.$state.count + 1 })
|
|
54
|
+
},
|
|
55
|
+
decrement() {
|
|
56
|
+
this.$patch({ count: this.$state.count - 1 })
|
|
57
|
+
},
|
|
58
|
+
reset() {
|
|
59
|
+
this.$reset()
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const store = useCounterStore()
|
|
65
|
+
store.actions.increment()
|
|
66
|
+
console.info(store.$state.count) // 1
|
|
67
|
+
console.info(store.getters.doubleCount) // 2
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Async middleware mutation ordering
|
|
71
|
+
|
|
72
|
+
When a store uses asynchronous middleware, `$patch`, `$patchAsync`, `$state = ...`, and `$reset()`
|
|
73
|
+
are serialized. Each queued mutation is built from the state committed by the previous mutation, so
|
|
74
|
+
concurrent updates do not overwrite each other with stale snapshots. Stores without middleware keep
|
|
75
|
+
their synchronous patch behavior.
|
|
76
|
+
|
|
77
|
+
### 中间件
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import {
|
|
81
|
+
createLoggerMiddleware,
|
|
82
|
+
createMiddlewareManager,
|
|
83
|
+
createPersistMiddleware,
|
|
84
|
+
createTimeTravelMiddleware,
|
|
85
|
+
} from '@composy/store-core'
|
|
86
|
+
|
|
87
|
+
const manager = createMiddlewareManager()
|
|
88
|
+
|
|
89
|
+
// Logger — 自动记录状态变化
|
|
90
|
+
manager.use(createLoggerMiddleware({ logState: true }))
|
|
91
|
+
|
|
92
|
+
// 持久化 — 状态自动保存到 localStorage
|
|
93
|
+
manager.use(createPersistMiddleware({ storage: 'localStorage', stores: ['user'] }))
|
|
94
|
+
|
|
95
|
+
// 时间旅行 — 撤销/重做
|
|
96
|
+
const { middleware, controller } = createTimeTravelMiddleware({ maxHistory: 50 })
|
|
97
|
+
manager.use(middleware)
|
|
98
|
+
|
|
99
|
+
controller.undo() // 撤销
|
|
100
|
+
controller.redo() // 重做
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Engine Bridge
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { createStoreEngineBridge } from '@composy/store-core/engine'
|
|
107
|
+
|
|
108
|
+
const bridge = createStoreEngineBridge({
|
|
109
|
+
name: 'store',
|
|
110
|
+
version: '1.0.0',
|
|
111
|
+
createRuntime: () => runtime,
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
await bridge.install(engine)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Bridge 会同步写入 `store:runtime`、`store:pinia`、`store:api`、`store:registry` 和
|
|
118
|
+
`store:bus`,并注册 engine API。
|
|
119
|
+
|
|
120
|
+
### PubSub & EventBus
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { createEventBus, createPubSubWithValue } from '@composy/store-core'
|
|
124
|
+
|
|
125
|
+
// PubSub — 值订阅
|
|
126
|
+
const counter = createPubSubWithValue(0)
|
|
127
|
+
counter.subscribe((value, oldValue) => {
|
|
128
|
+
console.info(`${oldValue} → ${value}`)
|
|
129
|
+
})
|
|
130
|
+
counter.setValue(42)
|
|
131
|
+
|
|
132
|
+
// EventBus — 事件总线
|
|
133
|
+
const bus = createEventBus()
|
|
134
|
+
bus.on('state:changed', data => console.info(data))
|
|
135
|
+
bus.emit('state:changed', { storeId: 'counter', state: { count: 1 } })
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 工具函数
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
import {
|
|
142
|
+
createSelector,
|
|
143
|
+
debounce,
|
|
144
|
+
deepClone,
|
|
145
|
+
deepEqual,
|
|
146
|
+
deepMerge,
|
|
147
|
+
getByPath,
|
|
148
|
+
setByPath,
|
|
149
|
+
throttle,
|
|
150
|
+
} from '@composy/store-core'
|
|
151
|
+
|
|
152
|
+
deepClone({ nested: { value: 1 } }) // 深拷贝
|
|
153
|
+
deepMerge({ a: 1 }, { b: 2 }, { a: 3 }) // → { a: 3, b: 2 }
|
|
154
|
+
deepEqual({ a: 1 }, { a: 1 }) // → true
|
|
155
|
+
createSelector((state: { count: number }) => state.count)
|
|
156
|
+
getByPath(obj, 'a.b.c') // 路径读取
|
|
157
|
+
setByPath(obj, 'a.b.c', 'new') // 路径设置
|
|
158
|
+
debounce(fn, 300) // 防抖
|
|
159
|
+
throttle(fn, 300) // 节流
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## 📚 API 速查
|
|
163
|
+
|
|
164
|
+
| 模块 | API | 说明 |
|
|
165
|
+
| ------ | ------------------------------- | ------------ |
|
|
166
|
+
| 核心 | `BaseStore` | Store 基类 |
|
|
167
|
+
| 核心 | `createStore` | 工厂函数 |
|
|
168
|
+
| 核心 | `batch` | 批量更新 |
|
|
169
|
+
| 中间件 | `createLoggerMiddleware` | 日志中间件 |
|
|
170
|
+
| 中间件 | `createPersistMiddleware` | 持久化中间件 |
|
|
171
|
+
| 中间件 | `createTimeTravelMiddleware` | 时间旅行 |
|
|
172
|
+
| Engine | `createStoreEngineBridge` | engine 桥接 |
|
|
173
|
+
| 插件 | `defineStorePlugin` | 定义插件 |
|
|
174
|
+
| 插件 | `createPluginManager` | 插件管理器 |
|
|
175
|
+
| 工具 | `deepClone/deepMerge/deepEqual` | 深度操作 |
|
|
176
|
+
| 工具 | `getByPath/setByPath` | 路径操作 |
|
|
177
|
+
| 工具 | `createSelector` | 记忆化选择器 |
|
|
178
|
+
| 工具 | `debounce/throttle` | 防抖/节流 |
|
|
179
|
+
|
|
180
|
+
## ✅ 验证与产物
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
pnpm -C packages/store/packages/core run lint:check
|
|
184
|
+
pnpm -C packages/store/packages/core run type-check
|
|
185
|
+
pnpm -C packages/store/packages/core run test:run
|
|
186
|
+
pnpm -C packages/store/packages/core run build
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
完整构建后必须同时存在 `dist`、`es`、`esm`、`lib` 四类产物目录。
|
|
190
|
+
|
|
191
|
+
Build and TypeScript project settings are maintained in `.ldesign/`; package-root `tsconfig.json`
|
|
192
|
+
and `eslint.config.js` are compatibility entry points.
|
|
193
|
+
|
|
194
|
+
## 📄 License
|
|
195
|
+
|
|
196
|
+
MIT © [LDesign Team](https://github.com/ldesign)
|