soma-core 2.2.4 → 2.2.6

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 (259) hide show
  1. package/README.md +5 -6
  2. package/bin/soma.cjs +2 -2
  3. package/core/build/compiler/flat-page.ts +16 -0
  4. package/core/build/compiler/full-manifest-builder.ts +0 -3
  5. package/core/build/compiler/page-assets.ts +0 -1
  6. package/core/build/compiler/page-closure.ts +245 -0
  7. package/core/build/compiler/page-declaration-compiler.ts +2 -5
  8. package/core/build/compiler/soma-precompile.js +1848 -3244
  9. package/core/build/compiler/soma-precompile.ts +4 -7
  10. package/core/build/component-tree/artifact-codec.ts +4 -8
  11. package/core/build/lsp/soma-declaration.cjs +1 -1
  12. package/core/build/lsp/std-completion.generated.json +3 -3
  13. package/core/client/a11y/a11y-config.ts +2 -1
  14. package/core/client/a11y/dom-id.ts +1 -1
  15. package/core/client/base/SomaHttpClient.ts +11 -3
  16. package/core/client/base/SomaPageRootBase.ts +6 -0
  17. package/core/client/base/defineSomaView.ts +178 -0
  18. package/core/client/base/index.ts +13 -0
  19. package/core/client/base/view-context.ts +328 -0
  20. package/core/client/behavior/adapter-collection.ts +2 -2
  21. package/core/client/compiler/manifest-compiler.ts +5 -36
  22. package/core/client/component/component-definition.types.ts +2 -1
  23. package/core/client/component/component-manager.ts +110 -20
  24. package/core/client/component/structure-adapter.ts +3 -7
  25. package/core/client/container/SomaContainerAdapter.ts +9 -1
  26. package/core/client/data/data-object-resolver.ts +516 -181
  27. package/core/client/data/data-write-actions.ts +79 -15
  28. package/core/client/data/format-config.ts +3 -1
  29. package/core/client/data/region-scope-port.ts +11 -0
  30. package/core/client/engine/asset-resolver.ts +2 -5
  31. package/core/client/engine/dom-renderer.ts +7 -40
  32. package/core/client/engine/event-engine.ts +1 -105
  33. package/core/client/engine/property-watcher.ts +1 -1
  34. package/core/client/engine/reactive-proxy.ts +78 -17
  35. package/core/client/engine/runtime-builder.ts +0 -14
  36. package/core/client/engine/scope-resolver.ts +18 -0
  37. package/core/client/engine/soma-bootstrap.ts +385 -98
  38. package/core/client/engine/style-binder.ts +49 -106
  39. package/core/client/engine/timer-engine.ts +11 -1
  40. package/core/client/host-bridge/load-host-domain-class.ts +2 -1
  41. package/core/client/infra/http/SomaHttpService.ts +15 -4
  42. package/core/client/infra/i18n/pack-locales.ts +2 -2
  43. package/core/client/mount/domain-rule.ts +7 -3
  44. package/core/client/mount/mount-page.ts +38 -5
  45. package/core/client/mount/types.ts +2 -0
  46. package/core/client/parser/confirm-spec.ts +1 -1
  47. package/core/client/parser/data-config-parser.ts +27 -210
  48. package/core/client/parser/pipeline-parser.ts +14 -59
  49. package/core/client/parser/style-config-parser.ts +101 -95
  50. package/core/client/parser/timer-parser.ts +21 -0
  51. package/core/client/parser/ui-config-parser.ts +64 -12
  52. package/core/client/registry/declaration-renderer.ts +1 -1
  53. package/core/client/runtime/SomaRuntimeServices.ts +2 -1
  54. package/core/client/runtime/SomaSnapshotStore.ts +5 -0
  55. package/core/client/security/url-guard.ts +71 -11
  56. package/core/client/validation/async-check-registry.ts +2 -1
  57. package/core/client/validation/contract-validator.ts +2 -6
  58. package/core/client/validation/field-rules.ts +3 -13
  59. package/core/client/validation/object-rules.ts +2 -10
  60. package/core/index.ts +1 -35
  61. package/core/inspect/check-product.ts +5 -5
  62. package/core/inspect/runtime.ts +2 -1
  63. package/core/server/api/dispatch-service-api.ts +35 -36
  64. package/core/server/api/load-host-service.ts +5 -4
  65. package/core/server/compile-port.ts +1 -1
  66. package/core/server/host/app-config-composer.ts +2 -1
  67. package/core/server/host/host-assembly-entry.ts +1 -0
  68. package/core/server/host/host-assembly.ts +47 -3
  69. package/core/server/host/host-caller.ts +2 -1
  70. package/core/server/host/host-dir.ts +9 -0
  71. package/core/server/host/host-response-headers.ts +2 -1
  72. package/core/server/host/invoke-host-request-hook.ts +28 -4
  73. package/core/server/host/published-page-assets.ts +2 -1
  74. package/core/server/host/resolve-host-request-hook.ts +25 -7
  75. package/core/server/host/server-page-assets.ts +4 -4
  76. package/core/server/host/virtual-pages.ts +3 -2
  77. package/core/server/infra/cache/ServerFileCache.ts +79 -9
  78. package/core/server/registry/api-registry-store.ts +3 -1
  79. package/core/server/registry/declaration-precompiler.ts +0 -2
  80. package/core/server/registry/page-registry-repository.ts +2 -1
  81. package/core/server/registry/page-registry-store.ts +2 -1
  82. package/core/server/registry/registry-error.ts +6 -1
  83. package/core/server/registry/registry-file-lock.ts +296 -23
  84. package/core/server/registry/request-body-limit.ts +3 -2
  85. package/core/server/registry/validation/declaration-safety-scan.ts +151 -27
  86. package/core/server/runtime-space/access-gate.ts +21 -7
  87. package/core/server/runtime-space/bindings.ts +3 -6
  88. package/core/server/runtime-space/dynamic-pages.ts +181 -49
  89. package/core/server/runtime-space/errors.ts +3 -0
  90. package/core/server/runtime-space/inject.ts +74 -15
  91. package/core/server/runtime-space/page-grants.ts +7 -1
  92. package/core/server/runtime-space/resolve.ts +66 -19
  93. package/core/server/runtime-space/store.ts +32 -3
  94. package/core/server/runtime-space/submit-steps.ts +2 -1
  95. package/core/server/runtime-space/types.ts +3 -1
  96. package/core/shared/component-tree-errors.ts +2 -1
  97. package/core/shared/contract-a11y.ts +1 -1
  98. package/core/shared/contract-sections.ts +2 -2
  99. package/core/shared/core-diagnostic-codes.ts +8 -0
  100. package/core/shared/declaration-keys.ts +1 -1
  101. package/core/shared/engines/engine-error.ts +2 -1
  102. package/core/shared/generation-error.ts +2 -1
  103. package/core/shared/page-envelope.ts +1 -1
  104. package/core/shared/pure-binding.ts +88 -0
  105. package/core/shared/registry-generated/diagnostic-registry-index.ts +16 -19
  106. package/core/shared/registry-generated/diagnostic-registry.ts +135 -177
  107. package/core/shared/registry-generated/limits.ts +49 -13
  108. package/core/shared/registry-generated/std-grammar-completion.ts +0 -4
  109. package/core/shared/registry-generated/std-grammar-views.ts +40 -10
  110. package/core/shared/registry-generated/std-grammar.ts +42 -20
  111. package/core/shared/soma-error.ts +36 -0
  112. package/core/shared/types/compile-port.types.ts +1 -1
  113. package/core/shared/types/data-config.types.ts +17 -17
  114. package/core/shared/types/engine.types.ts +0 -3
  115. package/core/shared/types/event.types.ts +1 -11
  116. package/core/shared/types/generation-error.types.ts +5 -1
  117. package/core/shared/types/host-assembly.types.ts +7 -1
  118. package/core/shared/types/manifest.types.ts +0 -3
  119. package/core/shared/types/region-scope.types.ts +5 -1
  120. package/core/shared/types/scope-manifest.types.ts +0 -2
  121. package/core/shared/types/style-config.types.ts +21 -21
  122. package/core/shared/types/ui-config.types.ts +4 -5
  123. package/core/shared/types/watcher.types.ts +1 -1
  124. package/dist/browser/runtime-bundle.manifest.json +11 -13
  125. package/dist/browser/soma-runtime.js +2567 -2696
  126. package/dist/core/index.cjs +5446 -5486
  127. package/dist/host-native/aot-builder.cjs +46 -1
  128. package/dist/host-native/native-server.cjs +4879 -4505
  129. package/dist/lsp/component-tree.cjs +5814 -7042
  130. package/dist/types/build/compiler/full-manifest-builder.d.ts +0 -2
  131. package/dist/types/build/compiler/page-closure.d.ts +21 -0
  132. package/dist/types/build/compiler/page-declaration-compiler.d.ts +2 -4
  133. package/dist/types/build/compiler/soma-precompile.d.ts +1 -3
  134. package/dist/types/build/component-tree/artifact-codec.d.ts +0 -2
  135. package/dist/types/client/a11y/a11y-config.d.ts +2 -1
  136. package/dist/types/client/base/SomaHttpClient.d.ts +1 -1
  137. package/dist/types/client/base/SomaPageRootBase.d.ts +5 -0
  138. package/dist/types/client/base/defineSomaView.d.ts +46 -0
  139. package/dist/types/client/base/index.d.ts +2 -0
  140. package/dist/types/client/base/view-context.d.ts +136 -0
  141. package/dist/types/client/behavior/adapter-collection.d.ts +1 -1
  142. package/dist/types/client/compiler/manifest-compiler.d.ts +0 -3
  143. package/dist/types/client/component/component-definition.types.d.ts +2 -1
  144. package/dist/types/client/component/component-manager.d.ts +29 -0
  145. package/dist/types/client/data/data-object-resolver.d.ts +91 -31
  146. package/dist/types/client/data/format-config.d.ts +2 -1
  147. package/dist/types/client/engine/dom-renderer.d.ts +1 -2
  148. package/dist/types/client/engine/event-engine.d.ts +0 -7
  149. package/dist/types/client/engine/reactive-proxy.d.ts +11 -4
  150. package/dist/types/client/engine/runtime-builder.d.ts +0 -4
  151. package/dist/types/client/engine/soma-bootstrap.d.ts +44 -6
  152. package/dist/types/client/engine/style-binder.d.ts +8 -4
  153. package/dist/types/client/host-bridge/load-host-domain-class.d.ts +2 -1
  154. package/dist/types/client/mount/domain-rule.d.ts +2 -0
  155. package/dist/types/client/mount/mount-page.d.ts +2 -1
  156. package/dist/types/client/mount/types.d.ts +2 -0
  157. package/dist/types/client/parser/data-config-parser.d.ts +6 -5
  158. package/dist/types/client/parser/style-config-parser.d.ts +7 -3
  159. package/dist/types/client/parser/timer-parser.d.ts +5 -0
  160. package/dist/types/client/parser/ui-config-parser.d.ts +6 -2
  161. package/dist/types/client/runtime/SomaSnapshotStore.d.ts +2 -0
  162. package/dist/types/client/security/url-guard.d.ts +14 -0
  163. package/dist/types/client/validation/async-check-registry.d.ts +2 -1
  164. package/dist/types/client/validation/object-rules.d.ts +0 -5
  165. package/dist/types/index.d.ts +2 -7
  166. package/dist/types/inspect/runtime.d.ts +2 -1
  167. package/dist/types/server/api/dispatch-service-api.d.ts +5 -0
  168. package/dist/types/server/api/load-host-service.d.ts +1 -1
  169. package/dist/types/server/compile-port.d.ts +1 -1
  170. package/dist/types/server/host/host-assembly-entry.d.ts +1 -1
  171. package/dist/types/server/host/host-assembly.d.ts +2 -0
  172. package/dist/types/server/host/host-dir.d.ts +2 -0
  173. package/dist/types/server/host/invoke-host-request-hook.d.ts +10 -3
  174. package/dist/types/server/host/published-page-assets.d.ts +2 -1
  175. package/dist/types/server/host/resolve-host-request-hook.d.ts +18 -5
  176. package/dist/types/server/host/server-page-assets.d.ts +2 -1
  177. package/dist/types/server/infra/cache/ServerFileCache.d.ts +8 -0
  178. package/dist/types/server/registry/declaration-precompiler.d.ts +0 -1
  179. package/dist/types/server/registry/registry-error.d.ts +5 -1
  180. package/dist/types/server/registry/registry-file-lock.d.ts +30 -0
  181. package/dist/types/server/registry/request-body-limit.d.ts +3 -2
  182. package/dist/types/server/registry/validation/declaration-safety-scan.d.ts +3 -0
  183. package/dist/types/server/runtime-space/access-gate.d.ts +7 -0
  184. package/dist/types/server/runtime-space/bindings.d.ts +3 -2
  185. package/dist/types/server/runtime-space/dynamic-pages.d.ts +6 -1
  186. package/dist/types/server/runtime-space/errors.d.ts +1 -1
  187. package/dist/types/server/runtime-space/resolve.d.ts +2 -0
  188. package/dist/types/server/runtime-space/store.d.ts +8 -1
  189. package/dist/types/server/runtime-space/submit-steps.d.ts +2 -1
  190. package/dist/types/server/runtime-space/types.d.ts +3 -1
  191. package/dist/types/shared/component-tree-errors.d.ts +2 -1
  192. package/dist/types/shared/core-diagnostic-codes.d.ts +1 -1
  193. package/dist/types/shared/declaration-keys.d.ts +1 -1
  194. package/dist/types/shared/engines/engine-error.d.ts +2 -1
  195. package/dist/types/shared/generation-error.d.ts +2 -1
  196. package/dist/types/shared/pure-binding.d.ts +48 -0
  197. package/dist/types/shared/registry-generated/diagnostic-registry.d.ts +119 -158
  198. package/dist/types/shared/registry-generated/limits.d.ts +40 -10
  199. package/dist/types/shared/registry-generated/std-grammar-completion.d.ts +0 -30
  200. package/dist/types/shared/registry-generated/std-grammar-views.d.ts +97 -23
  201. package/dist/types/shared/registry-generated/std-grammar.d.ts +109 -241
  202. package/dist/types/shared/soma-error.d.ts +15 -0
  203. package/dist/types/shared/types/data-config.types.d.ts +14 -16
  204. package/dist/types/shared/types/engine.types.d.ts +0 -3
  205. package/dist/types/shared/types/event.types.d.ts +1 -7
  206. package/dist/types/shared/types/generation-error.types.d.ts +1 -1
  207. package/dist/types/shared/types/host-assembly.types.d.ts +2 -0
  208. package/dist/types/shared/types/manifest.types.d.ts +0 -3
  209. package/dist/types/shared/types/region-scope.types.d.ts +4 -1
  210. package/dist/types/shared/types/scope-manifest.types.d.ts +0 -2
  211. package/dist/types/shared/types/style-config.types.d.ts +17 -19
  212. package/dist/types/shared/types/ui-config.types.d.ts +4 -5
  213. package/host-native/bin/host-native.cjs +22 -1
  214. package/host-native/client/browser-entry.ts +44 -9
  215. package/host-native/src/aot-builder.ts +52 -0
  216. package/host-native/src/host-prepare.ts +39 -5
  217. package/host-native/src/manifest-http.ts +2 -3
  218. package/host-native/src/native-server.ts +812 -174
  219. package/host-native/src/page-http.ts +3 -3
  220. package/host-native/src/public-packages.cjs +0 -1
  221. package/host-native/src/registry-handler.ts +12 -5
  222. package/host-native/src/static-file.ts +203 -53
  223. package/package.json +3 -2
  224. package/core/client/engine/step-runner.ts +0 -212
  225. package/core/client/engine/trigger-engine.ts +0 -55
  226. package/core/client/format/zoned.ts +0 -10
  227. package/core/client/parser/step-parser.ts +0 -359
  228. package/core/client/parser/trigger-parser.ts +0 -90
  229. package/core/client/parser/value-lang.ts +0 -340
  230. package/core/client/time/instant.ts +0 -2
  231. package/core/shared/calc/coerce.ts +0 -2
  232. package/core/shared/calc/errors.ts +0 -40
  233. package/core/shared/calc/evaluator.ts +0 -113
  234. package/core/shared/calc/index.ts +0 -11
  235. package/core/shared/calc/lexer.ts +0 -189
  236. package/core/shared/calc/parser.ts +0 -193
  237. package/core/shared/calc/typer.ts +0 -171
  238. package/core/shared/date-parts.ts +0 -2
  239. package/core/shared/show-when.ts +0 -77
  240. package/core/shared/types/step.types.ts +0 -91
  241. package/core/shared/types/trigger.types.ts +0 -14
  242. package/dist/types/client/engine/step-runner.d.ts +0 -42
  243. package/dist/types/client/engine/trigger-engine.d.ts +0 -16
  244. package/dist/types/client/format/zoned.d.ts +0 -1
  245. package/dist/types/client/parser/step-parser.d.ts +0 -23
  246. package/dist/types/client/parser/trigger-parser.d.ts +0 -13
  247. package/dist/types/client/parser/value-lang.d.ts +0 -63
  248. package/dist/types/client/time/instant.d.ts +0 -1
  249. package/dist/types/shared/calc/coerce.d.ts +0 -1
  250. package/dist/types/shared/calc/errors.d.ts +0 -14
  251. package/dist/types/shared/calc/evaluator.d.ts +0 -2
  252. package/dist/types/shared/calc/index.d.ts +0 -6
  253. package/dist/types/shared/calc/lexer.d.ts +0 -19
  254. package/dist/types/shared/calc/parser.d.ts +0 -43
  255. package/dist/types/shared/calc/typer.d.ts +0 -11
  256. package/dist/types/shared/date-parts.d.ts +0 -1
  257. package/dist/types/shared/show-when.d.ts +0 -21
  258. package/dist/types/shared/types/step.types.d.ts +0 -76
  259. package/dist/types/shared/types/trigger.types.d.ts +0 -12
@@ -1,5 +1,5 @@
1
1
  // 写入类内置动作(MV-EVT-2):组件 emit → `ACTION | data.submit` / `data.orderMove` → 这里调写通道,
2
- // 并把结构化结果写回数据层的写入结果存储(字段错误、冲突、待确认、乐观叠层)。lite / ui 组件只发事件、只读结果。
2
+ // 并把结构化结果写回数据层的写入结果存储(字段错误、冲突、待确认、乐观叠层)。ui / kit 组件只发事件、只读结果。
3
3
  // 乐观更新与失败回滚复用写通道已有的 `runWithFeedback`(apply / rollback 回调落在存储的乐观叠层上)。
4
4
 
5
5
  import type { SomaDataSubmitResult } from '../../shared/types/data-config.types';
@@ -78,21 +78,85 @@ export function createDataWriteActions(options: {
78
78
  }
79
79
  };
80
80
 
81
+ // 在途去重(仅 data.submit):键 = scope + 提交内容(object / mode / model),同键在途时复用同一个 Promise、不再发请求。
82
+ // 不能只按 scope:表格就地编辑等同 scope 下载荷不同的提交必须各自发出。落定(成功 / 失败 / 超时 / 取消)后在 finally 解除;
83
+ // 占用还要对得上存储里的在途序号:范围被 clear / reset(页面卸载、用完即清)或被更新的 begin 顶替后视为失效,不会永久卡住。
84
+ // 键 = scope + object + mode + model + 拆分配置(split)+ 其余提交选项(信号本身不入键,另存于占用条目上)。
85
+ // 载荷里含无法可靠序列化比较的值(File / Blob / FormData / Map / Set / ArrayBuffer 及视图 / 函数)时不参与去重。
86
+ const inflight = new Map<string, { readonly seq: number; readonly promise: Promise<SomaDataSubmitResult>; readonly signal: AbortSignal | undefined }>();
87
+ // `ancestors` 只含当前递归路径上的祖先:同一对象被引用两次(非环)不误判,真正的环才算。
88
+ const hasOpaqueValue = (value: unknown, ancestors: WeakSet<object>): boolean => {
89
+ if (typeof value === 'function') return true;
90
+ if (typeof value !== 'object' || value === null) return false;
91
+ if (ancestors.has(value)) return true; // 环:不去重
92
+ if (
93
+ (typeof Blob !== 'undefined' && value instanceof Blob) // File 是 Blob 子类
94
+ || (typeof FormData !== 'undefined' && value instanceof FormData)
95
+ || value instanceof Map // Map / Set 经 JSON.stringify 都成 {},内容不同会得到相同键
96
+ || value instanceof Set
97
+ || value instanceof ArrayBuffer
98
+ || ArrayBuffer.isView(value)
99
+ ) return true;
100
+ ancestors.add(value);
101
+ try {
102
+ const children = Array.isArray(value) ? value : Object.values(value as Record<string, unknown>);
103
+ return children.some((child) => hasOpaqueValue(child, ancestors));
104
+ } finally {
105
+ ancestors.delete(value);
106
+ }
107
+ };
108
+ const submitKeyOf = (payload: Record<string, unknown>, scope: string): string | null => {
109
+ const rawOptions = typeof payload.options === 'object' && payload.options !== null ? payload.options as Record<string, unknown> : null;
110
+ const { signal: _signal, ...optionsWithoutSignal } = rawOptions ?? {};
111
+ const parts = [scope, payload.object, payload.mode === 'create' ? 'create' : 'update', payload.model ?? null, payload.split ?? null, rawOptions === null ? null : optionsWithoutSignal];
112
+ try {
113
+ if (hasOpaqueValue(parts, new WeakSet())) return null;
114
+ return JSON.stringify(parts);
115
+ } catch {
116
+ return null; // 载荷不可序列化(循环引用等):不去重
117
+ }
118
+ };
119
+ const signalOf = (payload: Record<string, unknown>): AbortSignal | undefined => {
120
+ const opts = payload.options;
121
+ const signal = typeof opts === 'object' && opts !== null ? (opts as { signal?: unknown }).signal : undefined;
122
+ return signal instanceof AbortSignal ? signal : undefined;
123
+ };
124
+
125
+ const submit = async (payload: Record<string, unknown>): Promise<SomaDataSubmitResult> => {
126
+ const result = await run(payload, async (object) => {
127
+ const resolver = options.resolver();
128
+ if (!resolver) return failure(`数据对象尚未就绪,无法提交 "${object}"`);
129
+ const mode = payload.mode === 'create' ? 'create' : 'update';
130
+ const model = typeof payload.model === 'object' && payload.model !== null ? payload.model as Record<string, unknown> : {};
131
+ type SubmitOptions = Parameters<SomaDataObjectResolver['submit']>[3];
132
+ const opts = typeof payload.options === 'object' && payload.options !== null ? payload.options as SubmitOptions : undefined;
133
+ return opts === undefined
134
+ ? resolver.submit(object, model, mode)
135
+ : resolver.submit(object, model, mode, opts);
136
+ });
137
+ splitByRow(payload, result);
138
+ return result;
139
+ };
140
+
81
141
  return {
82
- 'data.submit': async (payload) => {
83
- const result = await run(payload, async (object) => {
84
- const resolver = options.resolver();
85
- if (!resolver) return failure(`数据对象尚未就绪,无法提交 "${object}"`);
86
- const mode = payload.mode === 'create' ? 'create' : 'update';
87
- const model = typeof payload.model === 'object' && payload.model !== null ? payload.model as Record<string, unknown> : {};
88
- type SubmitOptions = Parameters<SomaDataObjectResolver['submit']>[3];
89
- const opts = typeof payload.options === 'object' && payload.options !== null ? payload.options as SubmitOptions : undefined;
90
- return opts === undefined
91
- ? resolver.submit(object, model, mode)
92
- : resolver.submit(object, model, mode, opts);
93
- });
94
- splitByRow(payload, result);
95
- return result;
142
+ 'data.submit': (payload) => {
143
+ const scope = scopeOf(payload);
144
+ const key = scope === null ? null : submitKeyOf(payload, scope);
145
+ if (scope === null || key === null) return submit(payload);
146
+ const held = inflight.get(key);
147
+ if (held !== undefined) {
148
+ const view = store.get(scope);
149
+ // 旧提交带的取消信号已 aborted(调用方取消后立刻重发):不复用已取消的那一次,丢弃占用并正常发起新请求
150
+ if (view.status === 'pending' && view.seq === held.seq && held.signal?.aborted !== true) return held.promise;
151
+ inflight.delete(key);
152
+ }
153
+ const promise = submit(payload);
154
+ // run 在第一个 await 之前已同步 begin:此刻存储里的序号就是这次提交的
155
+ const entry = { seq: store.get(scope).seq, promise, signal: signalOf(payload) };
156
+ inflight.set(key, entry);
157
+ const release = (): void => { if (inflight.get(key) === entry) inflight.delete(key); };
158
+ promise.then(release, release);
159
+ return promise;
96
160
  },
97
161
  'data.orderMove': (payload) => run(payload, async (object, scope) => {
98
162
  const resolver = options.resolver();
@@ -8,6 +8,8 @@
8
8
  // 运行期消费:管道注册表 `setFormatDefaults`、数据解析器选项 `formatDefaults`(字段 `display` 的时区缺省与占位);
9
9
  // `services.format` 工厂读它由 bootstrap 接线(不在本文件)。
10
10
 
11
+ import { SomaError } from '../../shared/soma-error';
12
+
11
13
  /** `format:` 的封闭键集 */
12
14
  export const SOMA_FORMAT_APP_CONFIG_KEYS = ['placeholder', 'time_zone'] as const;
13
15
 
@@ -16,7 +18,7 @@ export interface SomaFormatDefaults {
16
18
  readonly timeZone?: string;
17
19
  }
18
20
 
19
- export class SomaFormatConfigError extends Error {
21
+ export class SomaFormatConfigError extends SomaError {
20
22
  readonly code = 'CORE-FORMAT-CONFIG' as const;
21
23
  readonly path: string;
22
24
  constructor(message: string, path: string) {
@@ -213,6 +213,17 @@ export function createRegionScopeStore(): SomaRegionScopeStore {
213
213
  scope.semantic.add(listener);
214
214
  return () => { scope.semantic.delete(listener); };
215
215
  },
216
+ // 发语义事件:与 `SCOPE | semantic` 管道同一条通道(订阅方一致),供组件 / 展示对象在代码里按顺序编排时发出;旧代次句柄空操作
217
+ emit(name, payload) {
218
+ if (owner !== generation) return;
219
+ for (const listener of [...scope.semantic]) {
220
+ try {
221
+ listener(name, payload ?? {});
222
+ } catch (error) {
223
+ console.error('[soma-core][数据] 语义事件订阅者抛错(已隔离)', error);
224
+ }
225
+ }
226
+ },
216
227
  };
217
228
  },
218
229
  routeSet(spec, writer, payload) {
@@ -5,7 +5,7 @@ import yaml from 'js-yaml';
5
5
  import type { ICache } from '../infra/cache/ICache';
6
6
  import { MemoryCache } from '../infra/cache/MemoryCache';
7
7
  import { parseEventConfig } from '../parser/pipeline-parser';
8
- import { splitEventConfigRaw } from '../parser/trigger-parser';
8
+ import { splitEventConfigRaw } from '../parser/timer-parser';
9
9
  import { parseStyleConfig } from '../parser/style-config-parser';
10
10
  import { parseUiConfig } from '../parser/ui-config-parser';
11
11
  import { extractConfigFromDomainClass } from '../parser/annotation-extractor';
@@ -31,7 +31,6 @@ export class SomaAssetResolver {
31
31
  return {
32
32
  uiConfig: assets.uiConfig,
33
33
  eventConfig: assets.eventConfig,
34
- triggers: assets.triggerConfig ?? [],
35
34
  timers: assets.timerConfig ?? [],
36
35
  styleConfig: assets.styleConfig ?? this.parseStyleConfig(assets.styleYaml),
37
36
  locale: this.parseLocale(assets.locale),
@@ -50,7 +49,6 @@ export class SomaAssetResolver {
50
49
  return {
51
50
  uiConfig: extracted.uiConfig,
52
51
  eventConfig: extracted.eventConfig,
53
- triggers: assets.triggerConfig ?? [],
54
52
  timers: assets.timerConfig ?? [],
55
53
  styleConfig: this.parseStyleConfig(assets.styleYaml),
56
54
  locale: this.parseLocale(assets.locale),
@@ -65,12 +63,11 @@ export class SomaAssetResolver {
65
63
  }
66
64
 
67
65
  const eventRaw = eventYaml.trim() ? yaml.load(eventYaml) : {};
68
- const { eventsRaw, triggers, timers } = splitEventConfigRaw(eventRaw);
66
+ const { eventsRaw, timers } = splitEventConfigRaw(eventRaw);
69
67
 
70
68
  const result: ParsedRuntimeAssets = {
71
69
  uiConfig: parseUiConfig(yaml.load(uiYaml)),
72
70
  eventConfig: parseEventConfig(eventsRaw as any),
73
- triggers,
74
71
  timers,
75
72
  styleConfig: this.parseStyleConfig(assets.styleYaml),
76
73
  locale: this.parseLocale(assets.locale),
@@ -9,7 +9,6 @@ import type {
9
9
  } from '../../shared/types/ui-config.types';
10
10
  import type { SomaScopeResolver } from './scope-resolver';
11
11
  import { longestIncreasingSubsequence } from './lis';
12
- import { evaluateShowWhen, type SomaShowWhen } from '../../shared/show-when';
13
12
  import {
14
13
  defaultPipeRegistry,
15
14
  hasPipes,
@@ -247,8 +246,6 @@ export class SomaDomRenderer {
247
246
  itemAlias: binding.itemAlias,
248
247
  repeatPlanId: binding.repeatPlanId,
249
248
  attrName: binding.attrName,
250
- negate: binding.negate,
251
- whenTest: binding.whenTest,
252
249
  classRules: binding.classRules,
253
250
  pipes: binding.pipes,
254
251
  };
@@ -325,16 +322,8 @@ export class SomaDomRenderer {
325
322
  };
326
323
  }
327
324
 
328
- case 'when': {
329
- const whenTest = entry.whenTest;
330
- if (whenTest) {
331
- return (v) => adapter.setVisibility(el, evaluateShowWhen(whenTest, v));
332
- }
333
- if (entry.negate) {
334
- return (v) => adapter.setVisibility(el, !v);
335
- }
325
+ case 'when':
336
326
  return (v) => adapter.setVisibility(el, !!v);
337
- }
338
327
 
339
328
  case 'class': {
340
329
  if (!entry.classRules || !this.resolver) {
@@ -344,14 +333,11 @@ export class SomaDomRenderer {
344
333
  const resolver = this.resolver;
345
334
  const rules = Object.entries(entry.classRules).map(([classes, condPath]) => ({
346
335
  classList: classes.split(' ').filter(Boolean),
347
- negate: condPath.startsWith('!'),
348
- condPath: condPath.startsWith('!') ? condPath.slice(1) : condPath,
336
+ condPath,
349
337
  }));
350
338
  return () => {
351
339
  for (const rule of rules) {
352
- const raw = !!resolver.readFromRootCompiled(rule.condPath);
353
- const enabled = rule.negate ? !raw : raw;
354
- adapter.toggleClasses(el, rule.classList, enabled);
340
+ adapter.toggleClasses(el, rule.classList, !!resolver.readFromRootCompiled(rule.condPath));
355
341
  }
356
342
  };
357
343
  }
@@ -958,10 +944,7 @@ export class SomaDomRenderer {
958
944
 
959
945
  if (config.class) {
960
946
  for (const [classes, path] of Object.entries(config.class)) {
961
- const { path: condPath, negate } = this.parseConditionalPath(path);
962
- const raw = !!this.resolveShowValue(condPath, data);
963
- const enabled = negate ? !raw : raw;
964
- this.adapter?.toggleClasses(element, classes.split(' ').filter(Boolean), enabled);
947
+ this.adapter?.toggleClasses(element, classes.split(' ').filter(Boolean), !!this.resolveShowValue(path, data));
965
948
  }
966
949
  }
967
950
  }
@@ -1005,25 +988,9 @@ export class SomaDomRenderer {
1005
988
  return segments.reduce((obj: any, key: string) => obj?.[key], itemData);
1006
989
  }
1007
990
 
1008
- /** 行内 `when` 的可见性:字符串形按真值 / 取反,对象形按谓词 */
1009
- private rowWhenVisible(when: SomaShowWhen, data: any): boolean {
1010
- if (typeof when !== 'string') {
1011
- return evaluateShowWhen(
1012
- { op: when.op, ...(when.value !== undefined ? { value: when.value } : {}) },
1013
- this.resolveShowValue(when.field, data),
1014
- );
1015
- }
1016
- const { path, negate } = this.parseConditionalPath(when);
1017
- const raw = this.resolveShowValue(path, data);
1018
- return negate ? !raw : Boolean(raw);
1019
- }
1020
-
1021
- private parseConditionalPath(valuePath: string): { path: string; negate: boolean } {
1022
- const negate = valuePath.startsWith('!');
1023
- return {
1024
- path: negate ? valuePath.slice(1) : valuePath,
1025
- negate,
1026
- };
991
+ /** 行内 `when` 的可见性:纯路径真值(页面不取反) */
992
+ private rowWhenVisible(when: string, data: any): boolean {
993
+ return Boolean(this.resolveShowValue(when, data));
1027
994
  }
1028
995
 
1029
996
  private isNestedShowMapping(value: ShowValue): value is NestedShowMapping {
@@ -11,7 +11,6 @@ import { dispatchNotifyDeclaration } from '../infra/notify/notify-declaration';
11
11
  import type { INotifyService } from '../infra/notify/INotifyService';
12
12
  import type { SomaScopeResolver } from './scope-resolver';
13
13
  import { isSomaEmitEvent } from './emit-event';
14
- import { runSteps } from './step-runner';
15
14
  import { captureSomaProjectionInteraction } from '../component/projection-registry';
16
15
  import { SOMA_SELECTED_ATTR } from '../../shared/hook-attributes';
17
16
  import type { SomaScopeEventSpec } from '../../shared/types/region-scope.types';
@@ -320,7 +319,7 @@ export class SomaEventEngine<TContext extends Record<string, unknown> = Record<s
320
319
  // namedActions 里时必然解析失败)。查找序:应用具名动作(`browserMount.actions`)→ 页面 Domain 同名方法
321
320
  // → 都没有报诊断(status error + 控制台,不静默)。载荷 `{ object, field?, value?, row? }`:
322
321
  // 数据动作经 emit 带来;DOM 事件在行内时补 `row`。执行包在一次事务里,成功后 commit(与编排同口径)。
323
- if (config.type === 'ACTION' && config.steps === undefined) {
322
+ if (config.type === 'ACTION') {
324
323
  const payload = this.namedActionPayload(originalEvent, rowContext);
325
324
  this.callbacks.onBeginTransaction?.();
326
325
  try {
@@ -346,69 +345,6 @@ export class SomaEventEngine<TContext extends Record<string, unknown> = Record<s
346
345
  return;
347
346
  }
348
347
 
349
- // ── 动作编排(REQ-010 F-13)─────────────────────────────────
350
- //
351
- // 带 `steps` 的事件走编排;不带的一律照旧。这条分叉刻意放在最前面:
352
- // 编排有自己的错误语义(on_error 三档)与自己的输出槽生命周期,
353
- // 混进下面那套单管道流程只会让两边都变形。
354
- if (config.steps !== undefined) {
355
- const payload = isSomaEmitEvent(originalEvent)
356
- ? (originalEvent.payload as Record<string, unknown>)
357
- : {};
358
- this.callbacks.onBeginTransaction?.();
359
- try {
360
- const outcome = await runSteps(config.steps, {
361
- payload: { ...payload, ...((rowContext instanceof SomaRowScope ? rowContext.data : currentVar) ?? {}) },
362
- dispatch: (pipeline, scope) => this.dispatchPipeline(pipeline, element, isCurrent, scope, config.somaId),
363
- isValid: isCurrent,
364
- confirm: (spec) => this.askConfirm(spec),
365
- // 步骤尾段 permission:交给与单管道同一条 Host 事件中间件链判(用这一步的码构造最小上下文),
366
- // 不直接查 core 权限集;没配中间件就不判(与单管道一致)。confirm / roles 复用引擎的出口与角色门。
367
- permission: async (code) => {
368
- const chain = this.middleware;
369
- if (chain === null) return true;
370
- const stepContext = {
371
- ...runtime,
372
- config: { ...config, permission: code },
373
- status: 'success' as 'success' | 'blocked' | 'error',
374
- message: undefined as string | undefined,
375
- };
376
- let reached = false;
377
- await chain.execute(stepContext, async () => { reached = true; });
378
- if (reached && stepContext.status !== 'blocked') return true;
379
- runtime.status = 'blocked';
380
- runtime.message = stepContext.message ?? `Permission denied: ${code}`;
381
- return false;
382
- },
383
- roles: (roles) => {
384
- if (this.roleGate?.(roles) === true) return true;
385
- runtime.status = 'blocked';
386
- runtime.message = `role denied: ${roles.join(',')}`;
387
- return false;
388
- },
389
- ...((this.namedActions || this.builtinActions)
390
- ? { actions: { ...(this.namedActions ?? {}), ...(this.builtinActions ?? {}) } }
391
- : {}),
392
- onError: (message, detail) => {
393
- runtime.status = 'error';
394
- runtime.message = `第 ${detail.step + 1} 步:${message}`;
395
- },
396
- });
397
- if (!isCurrent()) return;
398
- if (outcome.cancelled) {
399
- runtime.status = 'blocked';
400
- runtime.message = 'pre-check rejected';
401
- }
402
- if (outcome.stopped) this.callbacks.onDiscardPending?.();
403
- else await this.callbacks.onCommit();
404
- isCurrent();
405
- } finally {
406
- if (!isValid()) this.callbacks.onDiscardPending?.();
407
- this.callbacks.onEndTransaction?.();
408
- }
409
- return;
410
- }
411
-
412
348
  let result: EventHandlerResult = true;
413
349
  const runsHandler = Boolean(config.funcPath && config.type !== 'NAV_STATIC');
414
350
  let inTransaction = false;
@@ -500,46 +436,6 @@ export class SomaEventEngine<TContext extends Record<string, unknown> = Record<s
500
436
  recordMetric(`event.${config.type}`, this.adapter.now() - startedAt);
501
437
  }
502
438
 
503
- /**
504
- * 编排里的一步:执行一条已解析的管道,返回 handler 的返回值(进输出槽)。
505
- *
506
- * 复用与单管道同一条执行路径的**语义**,但不复用 `executeNow`——那里有确认框、
507
- * 键盘修饰符、诊断打点、事务开合,都是"一次交互"级别的事情。一步不是一次交互。
508
- */
509
- private async dispatchPipeline(
510
- pipeline: { type: string; funcPath?: string | null; targetUrl?: string; targetId?: string; action?: InteractAction; scope?: SomaScopeEventSpec; notify?: NotifyDeclaration; navReplace?: boolean },
511
- element: HTMLElement,
512
- isValid: () => boolean,
513
- stepScope?: Record<string, unknown>,
514
- writer?: string,
515
- ): Promise<unknown> {
516
- if (!isValid()) return undefined;
517
- if (pipeline.type === 'SCOPE') {
518
- await this.runScopeEvent(pipeline.scope, writer ?? '', stepScope ?? {});
519
- return undefined;
520
- }
521
- if (pipeline.type === 'NOTIFY') {
522
- await this.runNotify(pipeline.notify);
523
- return undefined;
524
- }
525
- let value: unknown;
526
- if (pipeline.funcPath && pipeline.type !== 'NAV_STATIC') {
527
- const currentVar = this.getContext(element);
528
- if (currentVar instanceof SomaRowScope && !currentVar.active) return undefined;
529
- const fn = this.resolveFunction(pipeline.funcPath, currentVar);
530
- if (!isValid()) return undefined;
531
- value = await fn(currentVar instanceof SomaRowScope ? currentVar.data : currentVar, stepScope);
532
- if (!isValid()) return undefined;
533
- if (currentVar instanceof SomaRowScope && !currentVar.active) return undefined;
534
- // 一步之内就 commit:后面的步骤(和它们的 when)要看得见这一步的效果
535
- await this.callbacks.onCommit();
536
- }
537
- if (!isValid()) return undefined;
538
- await this.postAction(pipeline as unknown as SomaCompiledEvent, element);
539
- if (!isValid()) return undefined;
540
- return value;
541
- }
542
-
543
439
  /** 具名动作注册表(AO-3):由 bootstrap 注入 */
544
440
  private namedActions: Record<string, (payload: Record<string, unknown>) => Promise<unknown> | unknown> | null = null;
545
441
 
@@ -1,5 +1,5 @@
1
1
  // core/client/engine/property-watcher.ts
2
- // 属性变更观察者注册表 — RenderEngine.watch / onChange / triggers 共用
2
+ // 属性变更观察者注册表 — RenderEngine.watch / onChange 共用
3
3
 
4
4
  import type { WatchCallback, WatcherOptions } from '../../shared/types/watcher.types';
5
5
 
@@ -1,10 +1,32 @@
1
1
  // core/client/engine/reactive-proxy.ts
2
2
 
3
+ import { SomaError } from '../../shared/soma-error';
4
+ import { VIEW_ARRAY_MUTATING_METHODS } from 'soma-foundation/view-state';
3
5
  import type { SomaDiagnostics } from '../diagnostics/SomaDiagnostics';
4
6
 
5
- const ARRAY_MUTATING_METHODS = new Set([
6
- 'push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse', 'fill',
7
- ]);
7
+ /** 数组变异方法名单只在 soma-design/spec/pipeline/view-state-rules.json(经 soma-foundation/view-state 投影),本处不再手写 */
8
+ const ARRAY_MUTATING_METHODS: ReadonlySet<string> = new Set(VIEW_ARRAY_MUTATING_METHODS);
9
+
10
+ /**
11
+ * 生产构建判定:打包器替换 process.env.NODE_ENV 或 Node 环境变量为 production 时关闭 dev 拦截(行为回到静默不刷新)。
12
+ * 拿不到 process(纯浏览器无替换)视为 dev。
13
+ */
14
+ function isProductionBuild(): boolean {
15
+ try {
16
+ return typeof process !== 'undefined' && process.env?.NODE_ENV === 'production';
17
+ } catch {
18
+ return false;
19
+ }
20
+ }
21
+
22
+ /** dev 层错误:写法不会触发刷新,必须改(与 soma-foundation 检查层同一份判据) */
23
+ export class SomaReactiveWriteError extends SomaError {
24
+ readonly code = 'CORE-REACTIVE-WRITE';
25
+ constructor(message: string) {
26
+ super(`[soma-core][引擎][CORE-REACTIVE-WRITE] ${message}`);
27
+ this.name = 'SomaReactiveWriteError';
28
+ }
29
+ }
8
30
 
9
31
  /**
10
32
  * SOMA 响应式代理
@@ -13,14 +35,14 @@ const ARRAY_MUTATING_METHODS = new Set([
13
35
  * - 使用 WeakMap 缓存,同一对象只创建一个 Proxy
14
36
  * - 跳过内置类型(Set/Map/Date 等);数组通过引用替换触发更新
15
37
  * - 函数绑定到 Proxy receiver,确保 this 正确
16
- * - devMode 开启时,数组变异方法调用会发出 warn(提示改用引用替换)
38
+ * - devMode 开启时(默认:非生产构建),数组原地变异 / 下标写入 / 元素字段写入 / 同一对象挂多路径一律抛 SomaReactiveWriteError(生产不抛,行为不变)
17
39
  */
18
40
  export class SomaReactiveProxy {
19
41
  /** 原始对象 → Proxy 实例的缓存(仅用于顶层 wrap 调用) */
20
42
  private cache = new WeakMap<object, any>();
21
43
 
22
44
  /** 子对象 Proxy 缓存:避免每次 get 嵌套对象都 new Proxy() */
23
- private childProxyCache = new WeakMap<object, any>();
45
+ private childProxyCache = new WeakMap<object, { proxy: any; path: string }>();
24
46
 
25
47
  /** 变更回调(可延迟设置) */
26
48
  private onChange: ((path: string, value: any, oldValue: any) => void) | null = null;
@@ -30,7 +52,7 @@ export class SomaReactiveProxy {
30
52
  constructor(
31
53
  onChange?: (path: string, value: any, oldValue: any) => void,
32
54
  diagnostics?: SomaDiagnostics,
33
- devMode: boolean = true,
55
+ devMode: boolean = !isProductionBuild(),
34
56
  ) {
35
57
  this.onChange = onChange ?? null;
36
58
  this.diagnostics = diagnostics ?? null;
@@ -144,12 +166,21 @@ export class SomaReactiveProxy {
144
166
 
145
167
  // 嵌套对象返回 Proxy 包装版本(缓存子 Proxy 减少 GC 压力)
146
168
  if (!self.shouldSkip(value)) {
169
+ const childPath = basePath ? `${basePath}.${String(prop)}` : String(prop);
147
170
  const cachedChild = self.childProxyCache.get(value);
148
- if (cachedChild) return cachedChild;
171
+ if (cachedChild) {
172
+ // 子 Proxy 按对象缓存、路径以首次访问为准:同一对象经另一路径访问,写入会上报成第一个路径,刷新错位
173
+ if (self.devMode && cachedChild.path !== childPath) {
174
+ throw new SomaReactiveWriteError(
175
+ `同一对象同时挂在 "${cachedChild.path}" 与 "${childPath}" 两个路径下,经后者写入会上报成前者,刷新错位。` +
176
+ `每个路径放各自的对象:${childPath} = { ...${cachedChild.path} }(浅拷贝)或重新构造。`,
177
+ );
178
+ }
179
+ return cachedChild.proxy;
180
+ }
149
181
 
150
- const childPath = basePath ? `${basePath}.${String(prop)}` : String(prop);
151
182
  const childProxy = new Proxy(value, self.createHandler(childPath));
152
- self.childProxyCache.set(value, childProxy);
183
+ self.childProxyCache.set(value, { proxy: childProxy, path: childPath });
153
184
  return childProxy;
154
185
  }
155
186
 
@@ -189,25 +220,55 @@ export class SomaReactiveProxy {
189
220
  }
190
221
 
191
222
  /**
192
- * 为数组创建一个轻量 Proxy,仅在 dev 模式下拦截变异方法。
193
- * 纯读方法(map/filter/length 等)直接透传,不影响性能。
194
- * 不缓存,每次 get 都创建新 Proxy,保证 arrayPath 路径准确。
223
+ * 为数组创建 dev 守卫 Proxy:变异方法、下标 / length 写入、元素(及其嵌套对象)字段写入都不会触发刷新,一律抛错。
224
+ * 纯读方法(map/filter/length 等)直接透传,不影响性能。不缓存,每次 get 都创建新 Proxy,保证 arrayPath 路径准确。
195
225
  */
196
226
  private wrapArrayDevGuard(arr: any[], arrayPath: string): any[] {
227
+ const replaceHint = `${arrayPath} = [...${arrayPath}, 新项](或 .map / .filter 产生新数组后整体赋值)`;
197
228
  return new Proxy(arr, {
198
229
  get(target, prop) {
199
230
  const value = Reflect.get(target, prop);
200
231
  if (typeof prop === 'string' && ARRAY_MUTATING_METHODS.has(prop) && typeof value === 'function') {
201
- return (...args: any[]) => {
202
- console.warn(
203
- `[soma-core][引擎] Direct mutation "${prop}" on array at "${arrayPath}" will NOT trigger reactive updates. ` +
204
- `Use reference replacement instead: this.${arrayPath} = [...this.${arrayPath}]`,
232
+ return () => {
233
+ throw new SomaReactiveWriteError(
234
+ `对数组 "${arrayPath}" 原地调用 ${prop}() 不会触发刷新。请整体替换引用:${replaceHint};排序先拷贝:${arrayPath} = [...${arrayPath}].sort(...)`,
205
235
  );
206
- return value.apply(target, args);
207
236
  };
208
237
  }
238
+ if (typeof prop === 'string' && /^\d+$/.test(prop) && value !== null && typeof value === 'object') {
239
+ return SomaReactiveProxy.elementGuard(value, `${arrayPath}[${prop}]`, replaceHint);
240
+ }
209
241
  return value;
210
242
  },
243
+ set(_target, prop) {
244
+ throw new SomaReactiveWriteError(
245
+ `对数组 "${arrayPath}" 写 ${String(prop)} 不会触发刷新。请整体替换引用:${replaceHint}`,
246
+ );
247
+ },
248
+ deleteProperty(_target, prop) {
249
+ throw new SomaReactiveWriteError(`对数组 "${arrayPath}" 删除 ${String(prop)} 不会触发刷新。请整体替换引用:${replaceHint}`);
250
+ },
251
+ });
252
+ }
253
+
254
+ /** 数组元素(数组不代理,元素也没有被代理)的只读守卫:字段写入抛错,嵌套对象继续守 */
255
+ private static elementGuard(obj: object, at: string, _replaceHint: string): object {
256
+ return new Proxy(obj, {
257
+ get(target, prop) {
258
+ const value = Reflect.get(target, prop);
259
+ if (value !== null && typeof value === 'object' && typeof prop === 'string') {
260
+ return SomaReactiveProxy.elementGuard(value, `${at}.${prop}`, _replaceHint);
261
+ }
262
+ return value;
263
+ },
264
+ set(_target, prop) {
265
+ throw new SomaReactiveWriteError(
266
+ `写 ${at}.${String(prop)} 不会触发刷新(数组元素没有被代理)。请用新元素替换整个数组:旧数组.map(行 => 行 === 目标 ? { ...行, ${String(prop)}: 新值 } : 行),再整体赋值。`,
267
+ );
268
+ },
269
+ deleteProperty(_target, prop) {
270
+ throw new SomaReactiveWriteError(`删除 ${at}.${String(prop)} 不会触发刷新(数组元素没有被代理)。请整体替换数组引用。`);
271
+ },
211
272
  });
212
273
  }
213
274
 
@@ -8,7 +8,6 @@ import { markBootPhase } from '../diagnostics/boot-timings';
8
8
  import type { SomaMiddlewareChain } from '../middleware/SomaMiddlewareChain';
9
9
  import type { SomaScheduler } from '../scheduler/SomaScheduler';
10
10
  import type { ParsedEvent } from '../../shared/types/event.types';
11
- import type { PropertyTrigger } from '../../shared/types/trigger.types';
12
11
  import type { ParsedTimer } from '../../shared/types/timer.types';
13
12
  import type { ITimer } from '../infra/timer/ITimer';
14
13
  import type { StyleConfig } from '../../shared/types/style-config.types';
@@ -21,7 +20,6 @@ import { SomaRenderEngine } from './render-engine';
21
20
  import { SomaPropertyWatcher } from './property-watcher';
22
21
  import { SomaScopeResolver } from './scope-resolver';
23
22
  import { SomaStyleBinder } from './style-binder';
24
- import { SomaTriggerEngine } from './trigger-engine';
25
23
  import { SomaTimerEngine } from './timer-engine';
26
24
 
27
25
  export interface RuntimeBuildInput {
@@ -32,7 +30,6 @@ export interface RuntimeBuildInput {
32
30
  confirmGraded?: (spec: import('../../shared/types/event.types').SomaConfirmSpec) => boolean | Promise<boolean>;
33
31
  uiConfig: UiConfig;
34
32
  eventConfig: ParsedEvent[];
35
- triggers?: PropertyTrigger[];
36
33
  timers?: ParsedTimer[];
37
34
  timerService?: ITimer;
38
35
  styleConfig?: StyleConfig;
@@ -56,7 +53,6 @@ export interface SomaRuntime {
56
53
  styleBinder: SomaStyleBinder | null;
57
54
  propertyWatcher: SomaPropertyWatcher;
58
55
  onChangeEngine: SomaOnChangeEngine;
59
- triggerEngine: SomaTriggerEngine;
60
56
  timerEngine: SomaTimerEngine;
61
57
  resolver: SomaScopeResolver;
62
58
  /** 页面运行时清单(组件管理器标记 emit 路由用) */
@@ -154,15 +150,6 @@ export class SomaRuntimeBuilder {
154
150
  onRefresh: () => renderEngine.render(),
155
151
  });
156
152
 
157
- const triggerEngine = new SomaTriggerEngine();
158
- triggerEngine.init({
159
- propertyWatcher,
160
- resolver,
161
- container: input.container,
162
- adapter: input.adapter,
163
- triggers: input.triggers ?? [],
164
- });
165
-
166
153
  const timerEngine = new SomaTimerEngine();
167
154
 
168
155
  return {
@@ -171,7 +158,6 @@ export class SomaRuntimeBuilder {
171
158
  styleBinder,
172
159
  propertyWatcher,
173
160
  onChangeEngine,
174
- triggerEngine,
175
161
  timerEngine,
176
162
  resolver,
177
163
  manifest,