soma-core 1.0.1 → 1.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/app/SomaPageClient.tsx +336 -0
- package/app/api/[...path]/route.ts +9 -85
- package/app/api/page/route.ts +18 -16
- package/app/api/soma-manifest/route.ts +39 -0
- package/app/components/SomaHydrationShell.tsx +23 -0
- package/app/layout.tsx +2 -2
- package/app/loading.tsx +5 -0
- package/app/page.tsx +19 -128
- package/bin/soma-lsp.cjs +195 -0
- package/bin/soma-sync.cjs +3 -0
- package/bin/soma.cjs +14 -2
- package/core/api/IService.ts +6 -10
- package/core/api/load-host-service.ts +72 -0
- package/core/api/service-path.ts +39 -0
- package/core/base/SomaEntity.ts +3 -10
- package/core/base/SomaLocaleOnlyPageRoot.ts +3 -4
- package/core/base/SomaPageRootBase.ts +20 -3
- package/core/base/decorators/Event.ts +23 -0
- package/core/base/decorators/Locale.ts +35 -0
- package/core/base/decorators/Page.ts +16 -0
- package/core/base/decorators/Show.ts +20 -0
- package/core/base/decorators/ShowList.ts +34 -0
- package/core/base/decorators/index.ts +5 -0
- package/core/base/index.ts +2 -0
- package/core/base/runAsync.ts +32 -0
- package/core/compiler/full-manifest-builder.ts +33 -7
- package/core/compiler/host-config-sync.cjs +38 -0
- package/core/compiler/manifest-compiler.ts +3 -2
- package/core/compiler/page-base-resolver.ts +23 -0
- package/core/compiler/precompiled-manifest-loader.ts +34 -0
- package/core/compiler/rollup-plugin-soma.ts +45 -0
- package/core/compiler/rspack-plugin-soma.js +33 -0
- package/core/compiler/soma-manifest-webpack-plugin.js +72 -0
- package/core/compiler/soma-precompile.js +3513 -0
- package/core/compiler/soma-precompile.ts +52 -6
- package/core/compiler/soma-rspack-yaml-loader.js +22 -0
- package/core/compiler/soma-webpack-loader.js +7 -1
- package/core/compiler/vite-plugin-soma.ts +11 -1
- package/core/container/IContainerAdapter.ts +36 -0
- package/core/container/MiniProgramContainerAdapter.ts +190 -0
- package/core/container/ReactNativeContainerAdapter.ts +189 -0
- package/core/container/SomaContainerAdapter.ts +17 -6
- package/core/diagnostics/SomaDiagnostics.ts +1 -1
- package/core/diagnostics/SomaTelemetry.ts +100 -0
- package/core/diagnostics/telemetry-context.ts +15 -0
- package/core/engine/asset-resolver.ts +39 -4
- package/core/engine/dom-renderer.ts +9 -11
- package/core/engine/event-engine.ts +110 -41
- package/core/engine/on-change-engine.ts +71 -0
- package/core/engine/property-watcher.ts +117 -0
- package/core/engine/reactive-proxy.ts +11 -5
- package/core/engine/render-engine.ts +97 -11
- package/core/engine/runtime-builder.ts +88 -11
- package/core/engine/scope-resolver.ts +65 -9
- package/core/engine/soma-bootstrap.ts +448 -244
- package/core/engine/style-binder.ts +423 -0
- package/core/engine/theme-variables.ts +37 -0
- package/core/engine/timer-engine.ts +92 -0
- package/core/engine/trigger-engine.ts +55 -0
- package/core/host/resolve-host-bootstrap.ts +28 -0
- package/core/host/soma-bootstrap-host.stub.ts +4 -0
- package/core/index.ts +33 -2
- package/core/infra/auth/TokenAuthService.ts +17 -3
- package/core/infra/http/IHttpClient.ts +11 -1
- package/core/infra/http/SomaHttpService.ts +89 -31
- package/core/infra/i18n/DefaultI18n.ts +6 -18
- package/core/infra/i18n/II18n.ts +2 -3
- package/core/infra/notify/DomNotifyService.ts +98 -0
- package/core/infra/notify/INotifyTheme.ts +22 -0
- package/core/infra/realtime/IRealtimeService.ts +23 -0
- package/core/infra/realtime/IRealtimeTransport.ts +9 -0
- package/core/infra/realtime/SomaRealtimeService.ts +95 -0
- package/core/infra/realtime/SseRealtimeTransport.ts +36 -0
- package/core/infra/realtime/WebSocketRealtimeTransport.ts +102 -0
- package/core/infra/router/router-path.ts +28 -0
- package/core/infra/storage/SessionStorageService.ts +59 -0
- package/core/lsp/cross-file-diagnostics.cjs +160 -0
- package/core/lsp/event-yaml-completion.cjs +106 -0
- package/core/lsp/extra-completion.cjs +64 -0
- package/core/lsp/lsp-navigation.cjs +191 -0
- package/core/lsp/ui-yaml-completion.cjs +170 -0
- package/core/manifest/manifest-contract.ts +12 -0
- package/core/middleware/createPermissionMiddleware.ts +37 -0
- package/core/parser/annotation-extractor.ts +113 -0
- package/core/parser/pipeline-parser.ts +344 -276
- package/core/parser/style-config-parser.ts +340 -0
- package/core/parser/timer-parser.ts +70 -0
- package/core/parser/trigger-parser.ts +90 -0
- package/core/parser/ui-config-parser.ts +73 -1
- package/core/quality/SomaQualityRegistry.ts +68 -0
- package/core/runtime/SomaRuntimeServices.ts +100 -0
- package/core/runtime/SomaSnapshotStore.ts +5 -3
- package/core/types/domain.types.ts +5 -2
- package/core/types/event.types.ts +82 -57
- package/core/types/manifest.types.ts +2 -0
- package/core/types/style-config.types.ts +76 -0
- package/core/types/timer.types.ts +23 -0
- package/core/types/trigger.types.ts +14 -0
- package/core/types/ui-config.types.ts +9 -0
- package/core/types/watcher.types.ts +29 -0
- package/dist/cli/soma.js +23 -23
- package/dist/core/index.cjs +8968 -0
- package/dist/diagnostics/telemetry.cjs +105 -0
- package/dist/preview-export.cjs +3401 -0
- package/dist/tsconfig.types.tsbuildinfo +1 -0
- package/dist/types/api/IService.d.ts +28 -0
- package/dist/types/api/load-host-service.d.ts +5 -0
- package/dist/types/api/service-path.d.ts +13 -0
- package/dist/types/base/SomaApi.d.ts +5 -0
- package/dist/types/base/SomaDict.d.ts +89 -0
- package/dist/types/base/SomaEntity.d.ts +15 -0
- package/dist/types/base/SomaHttpClient.d.ts +66 -0
- package/dist/types/base/SomaLocaleOnlyPageRoot.d.ts +3 -0
- package/dist/types/base/SomaPageRootBase.d.ts +49 -0
- package/dist/types/base/SomaValidator.d.ts +55 -0
- package/dist/types/base/decorators/Event.d.ts +10 -0
- package/dist/types/base/decorators/Locale.d.ts +9 -0
- package/dist/types/base/decorators/Page.d.ts +4 -0
- package/dist/types/base/decorators/Show.d.ts +7 -0
- package/dist/types/base/decorators/ShowList.d.ts +12 -0
- package/dist/types/base/decorators/index.d.ts +5 -0
- package/dist/types/base/index.d.ts +9 -0
- package/dist/types/base/runAsync.d.ts +12 -0
- package/dist/types/compiler/full-manifest-builder.d.ts +35 -0
- package/dist/types/compiler/manifest-compiler.d.ts +29 -0
- package/dist/types/compiler/page-base-resolver.d.ts +6 -0
- package/dist/types/compiler/precompiled-manifest-loader.d.ts +5 -0
- package/dist/types/compiler/rollup-plugin-soma.d.ts +14 -0
- package/dist/types/compiler/route-builder.d.ts +12 -0
- package/dist/types/compiler/soma-precompile.d.ts +40 -0
- package/dist/types/compiler/vite-plugin-soma.d.ts +34 -0
- package/dist/types/container/IContainerAdapter.d.ts +30 -0
- package/dist/types/container/MiniProgramContainerAdapter.d.ts +52 -0
- package/dist/types/container/ReactNativeContainerAdapter.d.ts +47 -0
- package/dist/types/container/SomaContainerAdapter.d.ts +30 -0
- package/dist/types/diagnostics/SomaDiagnostics.d.ts +64 -0
- package/dist/types/diagnostics/SomaTelemetry.d.ts +32 -0
- package/dist/types/diagnostics/telemetry-context.d.ts +4 -0
- package/dist/types/engine/asset-resolver.d.ts +17 -0
- package/dist/types/engine/dom-renderer.d.ts +35 -0
- package/dist/types/engine/event-engine.d.ts +64 -0
- package/dist/types/engine/lis.d.ts +10 -0
- package/dist/types/engine/on-change-engine.d.ts +16 -0
- package/dist/types/engine/property-watcher.d.ts +18 -0
- package/dist/types/engine/reactive-proxy.d.ts +58 -0
- package/dist/types/engine/render-engine.d.ts +73 -0
- package/dist/types/engine/runtime-builder.d.ts +58 -0
- package/dist/types/engine/scope-resolver.d.ts +90 -0
- package/dist/types/engine/soma-bootstrap.d.ts +112 -0
- package/dist/types/engine/style-binder.d.ts +81 -0
- package/dist/types/engine/theme-variables.d.ts +3 -0
- package/dist/types/engine/timer-engine.d.ts +19 -0
- package/dist/types/engine/trigger-engine.d.ts +16 -0
- package/dist/types/host/resolve-host-bootstrap.d.ts +11 -0
- package/dist/types/host/soma-bootstrap-host.stub.d.ts +3 -0
- package/dist/types/index.d.ts +35 -0
- package/dist/types/infra/auth/IAuthService.d.ts +12 -0
- package/dist/types/infra/auth/TokenAuthService.d.ts +26 -0
- package/dist/types/infra/cache/ICache.d.ts +12 -0
- package/dist/types/infra/cache/MemoryCache.d.ts +14 -0
- package/dist/types/infra/cache/ServerFileCache.d.ts +37 -0
- package/dist/types/infra/config/IConfig.d.ts +9 -0
- package/dist/types/infra/config/SomaConfig.d.ts +21 -0
- package/dist/types/infra/event-bus/IEventBus.d.ts +8 -0
- package/dist/types/infra/event-bus/SomaEventBus.d.ts +9 -0
- package/dist/types/infra/http/IHttpClient.d.ts +28 -0
- package/dist/types/infra/http/SomaHttpService.d.ts +27 -0
- package/dist/types/infra/i18n/DefaultI18n.d.ts +7 -0
- package/dist/types/infra/i18n/II18n.d.ts +6 -0
- package/dist/types/infra/logger/ConsoleLogger.d.ts +14 -0
- package/dist/types/infra/logger/ILogger.d.ts +17 -0
- package/dist/types/infra/notify/DefaultNotifyService.d.ts +16 -0
- package/dist/types/infra/notify/DomNotifyService.d.ts +16 -0
- package/dist/types/infra/notify/INotifyService.d.ts +12 -0
- package/dist/types/infra/notify/INotifyTheme.d.ts +12 -0
- package/dist/types/infra/permission/IPermission.d.ts +10 -0
- package/dist/types/infra/permission/SomaPermission.d.ts +19 -0
- package/dist/types/infra/realtime/IRealtimeService.d.ts +13 -0
- package/dist/types/infra/realtime/IRealtimeTransport.d.ts +8 -0
- package/dist/types/infra/realtime/SomaRealtimeService.d.ts +20 -0
- package/dist/types/infra/realtime/SseRealtimeTransport.d.ts +11 -0
- package/dist/types/infra/realtime/WebSocketRealtimeTransport.d.ts +30 -0
- package/dist/types/infra/router/IRouter.d.ts +16 -0
- package/dist/types/infra/router/SomaRouter.d.ts +18 -0
- package/dist/types/infra/router/router-path.d.ts +6 -0
- package/dist/types/infra/storage/IStorageService.d.ts +7 -0
- package/dist/types/infra/storage/MemoryStorageService.d.ts +15 -0
- package/dist/types/infra/storage/SessionStorageService.d.ts +14 -0
- package/dist/types/infra/timer/ITimer.d.ts +13 -0
- package/dist/types/infra/timer/SomaTimer.d.ts +21 -0
- package/dist/types/manifest/manifest-contract.d.ts +4 -0
- package/dist/types/middleware/SomaMiddlewareChain.d.ts +6 -0
- package/dist/types/middleware/createPermissionMiddleware.d.ts +14 -0
- package/dist/types/parser/annotation-extractor.d.ts +12 -0
- package/dist/types/parser/pipeline-parser.d.ts +62 -0
- package/dist/types/parser/style-config-parser.d.ts +20 -0
- package/dist/types/parser/timer-parser.d.ts +6 -0
- package/dist/types/parser/trigger-parser.d.ts +13 -0
- package/dist/types/parser/ui-config-parser.d.ts +34 -0
- package/dist/types/parser/yaml-loader.d.ts +21 -0
- package/dist/types/quality/SomaQualityRegistry.d.ts +31 -0
- package/dist/types/runtime/SomaRuntimeServices.d.ts +35 -0
- package/dist/types/runtime/SomaSnapshotStore.d.ts +13 -0
- package/dist/types/scheduler/SomaScheduler.d.ts +25 -0
- package/dist/types/types/domain.types.d.ts +82 -0
- package/dist/types/types/engine.types.d.ts +22 -0
- package/dist/types/types/event.types.d.ts +61 -0
- package/dist/types/types/keyboard.types.d.ts +4 -0
- package/dist/types/types/manifest.types.d.ts +29 -0
- package/dist/types/types/scheduler.types.d.ts +8 -0
- package/dist/types/types/style-config.types.d.ts +62 -0
- package/dist/types/types/timer.types.d.ts +19 -0
- package/dist/types/types/trigger.types.d.ts +12 -0
- package/dist/types/types/ui-config.types.d.ts +85 -0
- package/dist/types/types/watcher.types.d.ts +24 -0
- package/dist/types/validation/contract-validator.d.ts +40 -0
- package/editor/vscode/extension.js +39 -0
- package/editor/vscode/language-configuration.json +17 -0
- package/editor/vscode/package.json +98 -0
- package/editor/vscode/syntaxes/soma-event-yaml.tmLanguage.json +30 -0
- package/editor/vscode/syntaxes/soma-ui-yaml.tmLanguage.json +42 -0
- package/global.d.ts +19 -0
- package/next.config.js +9 -4
- package/package.json +53 -16
- package/tailwind.config.ts +26 -7
- package/tsconfig.json +6 -2
- package/core/router/RouteHandler.ts +0 -93
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SomaEventMiddlewareContext } from '../engine/event-engine';
|
|
2
|
+
import type { SomaRuntimeServices } from '../runtime/SomaRuntimeServices';
|
|
3
|
+
/**
|
|
4
|
+
* Opt-in event middleware: blocks handler execution when the event declares
|
|
5
|
+
* `permission:code` in _event.yaml and `_services.permission.check(code)` is false.
|
|
6
|
+
*
|
|
7
|
+
* Wire via `SomaBootstrapOptions.eventMiddleware` — framework does not mount this by default.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const chain = new SomaMiddlewareChain<SomaEventMiddlewareContext>();
|
|
11
|
+
* chain.use(createPermissionMiddleware(() => bootstrap.getDomainInstance()?._services));
|
|
12
|
+
* new SomaBootstrap({ eventMiddleware: chain });
|
|
13
|
+
*/
|
|
14
|
+
export declare function createPermissionMiddleware(getServices: () => SomaRuntimeServices | undefined): (context: SomaEventMiddlewareContext, next: () => Promise<void>) => Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { UiConfig } from '../types/ui-config.types';
|
|
2
|
+
import type { ParsedEvent } from '../types/event.types';
|
|
3
|
+
export interface AnnotationExtractOptions {
|
|
4
|
+
/** 顶级 bind.var,默认 page */
|
|
5
|
+
pageVar?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AnnotationExtractResult {
|
|
8
|
+
uiConfig: UiConfig;
|
|
9
|
+
eventConfig: ParsedEvent[];
|
|
10
|
+
}
|
|
11
|
+
/** 从 Domain Class 装饰器元数据生成等价于 YAML 的配置 */
|
|
12
|
+
export declare function extractConfigFromDomainClass(DomainClass: new (...args: unknown[]) => object, options?: AnnotationExtractOptions): AnnotationExtractResult;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ParsedEvent, EventConfigRaw } from '../types/event.types';
|
|
2
|
+
/**
|
|
3
|
+
* Pipeline DSL 解析错误
|
|
4
|
+
* 携带原始表达式以便调试
|
|
5
|
+
*/
|
|
6
|
+
export declare class SomaEventParseError extends Error {
|
|
7
|
+
readonly rawExpression: string;
|
|
8
|
+
constructor(message: string, rawExpression: string);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 解析事件选择器字符串
|
|
12
|
+
*
|
|
13
|
+
* 支持两种格式:
|
|
14
|
+
* - 两段式:`btn.click`(somaId.domEvent)
|
|
15
|
+
* - 三段式:`input.keydown.enter`(somaId.domEvent.keyModifier)
|
|
16
|
+
*
|
|
17
|
+
* @param selector - 选择器字符串
|
|
18
|
+
* @returns 解析后的 somaId、domEvent 和可选的 keyModifier
|
|
19
|
+
* @throws SomaEventParseError 选择器格式不合法时抛出
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseSelector(selector: string): {
|
|
22
|
+
somaId: string;
|
|
23
|
+
domEvent: string;
|
|
24
|
+
keyModifier?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* 解析 Pipeline 表达式体(不含 DOM 选择器,供 timers 块使用)
|
|
28
|
+
*/
|
|
29
|
+
export declare function parsePipelineBody(expression: string): Omit<ParsedEvent, 'somaId' | 'domEvent'>;
|
|
30
|
+
/**
|
|
31
|
+
* 解析单行 Pipeline 表达式
|
|
32
|
+
*
|
|
33
|
+
* 格式:`[节点ID].[DOM事件]: [枚举类型] | [参数1] | [参数2] | [参数3] | confirm:消息`
|
|
34
|
+
*
|
|
35
|
+
* 各类型管道签名:
|
|
36
|
+
* - NAV_STATIC | targetUrl
|
|
37
|
+
* - NAV_ACTION | funcPath | targetUrl
|
|
38
|
+
* - UI_REFRESH | funcPath [| force]
|
|
39
|
+
* - UI_INTERACT | targetId | funcPath | action
|
|
40
|
+
* - 任意类型均可在末尾追加可选段 confirm:确认文案
|
|
41
|
+
*
|
|
42
|
+
* @param selector - 事件选择器(如 "btn.click")
|
|
43
|
+
* @param expression - Pipeline 表达式(如 "NAV_STATIC | /home.html")
|
|
44
|
+
* @returns 类型安全的 ParsedEvent 对象
|
|
45
|
+
* @throws SomaEventParseError 表达式不合法时抛出
|
|
46
|
+
*/
|
|
47
|
+
export declare function parsePipeline(selector: string, expression: string): ParsedEvent;
|
|
48
|
+
/**
|
|
49
|
+
* 递归解析事件配置(YAML 反序列化后的对象)
|
|
50
|
+
*
|
|
51
|
+
* 处理嵌套层级结构:
|
|
52
|
+
* - 叶节点(值为 string):视为事件声明,调用 parsePipeline 解析
|
|
53
|
+
* - 嵌套节点(值为 object):视为嵌套层级,递归解析
|
|
54
|
+
*
|
|
55
|
+
* 嵌套层级与 _ui.yaml 的 bind 层级一一对应。
|
|
56
|
+
*
|
|
57
|
+
* @param config - YAML 反序列化后的原始对象
|
|
58
|
+
* @param parentPath - 当前嵌套路径(用于调试和错误追踪)
|
|
59
|
+
* @returns 扁平化的 ParsedEvent 数组
|
|
60
|
+
* @throws SomaEventParseError 表达式不合法时抛出
|
|
61
|
+
*/
|
|
62
|
+
export declare function parseEventConfig(config: EventConfigRaw | null | undefined, parentPath?: string[]): ParsedEvent[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { StyleConfig } from '../types/style-config.types';
|
|
2
|
+
export declare class SomaStyleConfigError extends Error {
|
|
3
|
+
readonly path: string;
|
|
4
|
+
constructor(message: string, path?: string);
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 将 YAML 解析后的原始对象转换为类型安全的 StyleConfig
|
|
8
|
+
*
|
|
9
|
+
* 校验规则:
|
|
10
|
+
* - host 必须是非空字符串
|
|
11
|
+
* - base 的值必须是纯 Tailwind 类名字符串
|
|
12
|
+
* - states 的 condition 必须是纯属性路径,value 必须是基础类型
|
|
13
|
+
* - transitions 的 trigger 必须是有效枚举值
|
|
14
|
+
* - themes 仅允许覆盖视觉类名,不可引入新的布局类
|
|
15
|
+
*
|
|
16
|
+
* @param raw - YAML 解析后的原始对象
|
|
17
|
+
* @returns 类型安全的 StyleConfig
|
|
18
|
+
* @throws SomaStyleConfigError 格式不合法时抛出
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseStyleConfig(raw: unknown): StyleConfig;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ParsedTimer } from '../types/timer.types';
|
|
2
|
+
export declare class SomaTimerParseError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
export declare function parseTimers(raw: unknown): ParsedTimer[];
|
|
6
|
+
export declare function compileTimer(timer: ParsedTimer): import('../types/timer.types').SomaCompiledTimer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PropertyTrigger } from '../types/trigger.types';
|
|
2
|
+
import type { ParsedTimer } from '../types/timer.types';
|
|
3
|
+
export declare class SomaTriggerParseError extends Error {
|
|
4
|
+
constructor(message: string);
|
|
5
|
+
}
|
|
6
|
+
/** 解析 triggers 数组(YAML 中 triggers: [...]) */
|
|
7
|
+
export declare function parseTriggers(raw: unknown): PropertyTrigger[];
|
|
8
|
+
/** 从 event 配置根对象分离 triggers / timers 与事件声明 */
|
|
9
|
+
export declare function splitEventConfigRaw(raw: unknown): {
|
|
10
|
+
eventsRaw: Record<string, unknown>;
|
|
11
|
+
triggers: PropertyTrigger[];
|
|
12
|
+
timers: ParsedTimer[];
|
|
13
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { UiConfig, ShowMapping, ParsedShowEntry } from '../types/ui-config.types';
|
|
2
|
+
/**
|
|
3
|
+
* UI 配置解析错误
|
|
4
|
+
* 携带错误路径信息以便定位问题
|
|
5
|
+
*/
|
|
6
|
+
export declare class SomaUiConfigError extends Error {
|
|
7
|
+
readonly path: string;
|
|
8
|
+
constructor(message: string, path?: string);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 将 YAML 解析后的原始对象转换为类型安全的 UiConfig
|
|
12
|
+
*
|
|
13
|
+
* 校验规则:
|
|
14
|
+
* - 顶层必须包含 bind 和 show
|
|
15
|
+
* - bind 必须有 obj 和 var(均为非空字符串)
|
|
16
|
+
* - show 键不能为空
|
|
17
|
+
* - 嵌套绑定的 bind 和 show 必须成对出现
|
|
18
|
+
* - 处理 somaId@attr 扩展语法
|
|
19
|
+
*
|
|
20
|
+
* @param raw - YAML 解析后的原始对象(通常来自 yaml-loader)
|
|
21
|
+
* @returns 类型安全的 UiConfig 对象
|
|
22
|
+
* @throws SomaUiConfigError 格式不合法时抛出
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseUiConfig(raw: any): UiConfig;
|
|
25
|
+
/**
|
|
26
|
+
* 解析 show 键中的 somaId@attr 语法
|
|
27
|
+
*
|
|
28
|
+
* 遍历 ShowMapping 中的所有键,将 `somaId@attr` 拆分为 somaId + attrName。
|
|
29
|
+
* 用于引擎在绑定时判断是设置 textContent 还是 setAttribute。
|
|
30
|
+
*
|
|
31
|
+
* @param show - 已解析的 ShowMapping
|
|
32
|
+
* @returns ParsedShowEntry 数组
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseShowKeys(show: ShowMapping): ParsedShowEntry[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 异步加载并解析 YAML 文件
|
|
3
|
+
*
|
|
4
|
+
* 使用 fetch API 获取文件内容,然后通过 js-yaml 解析为 JavaScript 对象。
|
|
5
|
+
* 适用于浏览器环境中加载 YAML 配置文件。
|
|
6
|
+
*
|
|
7
|
+
* @param path - YAML 文件的 URL 路径
|
|
8
|
+
* @returns 解析后的 JavaScript 对象
|
|
9
|
+
* @throws Error 文件加载失败或 YAML 解析错误时抛出
|
|
10
|
+
*/
|
|
11
|
+
export declare function loadYamlFile(path: string): Promise<any>;
|
|
12
|
+
/**
|
|
13
|
+
* 同步解析 YAML 字符串
|
|
14
|
+
*
|
|
15
|
+
* 将 YAML 格式的文本直接解析为 JavaScript 对象。
|
|
16
|
+
*
|
|
17
|
+
* @param text - YAML 格式的字符串
|
|
18
|
+
* @returns 解析后的 JavaScript 对象
|
|
19
|
+
* @throws YAMLException YAML 语法错误时抛出
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseYamlString(text: string): any;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { SomaDiagnosticsSnapshot } from '../diagnostics/SomaDiagnostics';
|
|
2
|
+
export interface QualityPillar {
|
|
3
|
+
id: 'contract' | 'diagnostics' | 'snapshot' | 'dev-guard';
|
|
4
|
+
name: string;
|
|
5
|
+
carrier: string;
|
|
6
|
+
description: string;
|
|
7
|
+
}
|
|
8
|
+
export interface PerformanceLayer {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
carrier: string;
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ExtensibilityDimension {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
carrier: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}
|
|
20
|
+
/** Registry of quality, performance, and extensibility capabilities */
|
|
21
|
+
export declare class SomaQualityRegistry {
|
|
22
|
+
static readonly qualityPillars: QualityPillar[];
|
|
23
|
+
static readonly performanceLayers: PerformanceLayer[];
|
|
24
|
+
static readonly extensibilityDimensions: ExtensibilityDimension[];
|
|
25
|
+
getSummary(): {
|
|
26
|
+
quality: QualityPillar[];
|
|
27
|
+
performance: PerformanceLayer[];
|
|
28
|
+
extensibility: ExtensibilityDimension[];
|
|
29
|
+
};
|
|
30
|
+
computeHealthScore(snapshot: SomaDiagnosticsSnapshot): number;
|
|
31
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TokenAuthService } from '../infra/auth/TokenAuthService';
|
|
2
|
+
import { MemoryCache } from '../infra/cache/MemoryCache';
|
|
3
|
+
import { SomaConfig } from '../infra/config/SomaConfig';
|
|
4
|
+
import { SomaEventBus } from '../infra/event-bus/SomaEventBus';
|
|
5
|
+
import { SomaHttpService } from '../infra/http/SomaHttpService';
|
|
6
|
+
import { DefaultI18n } from '../infra/i18n/DefaultI18n';
|
|
7
|
+
import { ConsoleLogger } from '../infra/logger/ConsoleLogger';
|
|
8
|
+
import { DefaultNotifyService } from '../infra/notify/DefaultNotifyService';
|
|
9
|
+
import { DomNotifyService } from '../infra/notify/DomNotifyService';
|
|
10
|
+
import { SomaPermission } from '../infra/permission/SomaPermission';
|
|
11
|
+
import { SomaRouter } from '../infra/router/SomaRouter';
|
|
12
|
+
import type { IStorageService } from '../infra/storage/IStorageService';
|
|
13
|
+
import { SomaTimer } from '../infra/timer/SomaTimer';
|
|
14
|
+
import type { IRealtimeService } from '../infra/realtime/IRealtimeService';
|
|
15
|
+
/** Runtime infrastructure injected into domain instances by bootstrap */
|
|
16
|
+
export interface SomaRuntimeServices {
|
|
17
|
+
router: SomaRouter;
|
|
18
|
+
notify: DefaultNotifyService | DomNotifyService;
|
|
19
|
+
logger: ConsoleLogger;
|
|
20
|
+
http: SomaHttpService;
|
|
21
|
+
storage: IStorageService;
|
|
22
|
+
timer: SomaTimer;
|
|
23
|
+
eventBus: SomaEventBus;
|
|
24
|
+
cache: MemoryCache<unknown>;
|
|
25
|
+
config: SomaConfig;
|
|
26
|
+
auth: TokenAuthService;
|
|
27
|
+
permission: SomaPermission;
|
|
28
|
+
i18n: DefaultI18n;
|
|
29
|
+
realtime: IRealtimeService;
|
|
30
|
+
}
|
|
31
|
+
export declare function createDefaultRuntimeServices(options?: {
|
|
32
|
+
appConfig?: unknown;
|
|
33
|
+
locale?: Record<string, unknown>;
|
|
34
|
+
initialPath?: string;
|
|
35
|
+
}): SomaRuntimeServices;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class SomaSnapshotStore {
|
|
2
|
+
private readonly maxEntries;
|
|
3
|
+
private nextId;
|
|
4
|
+
private snapshots;
|
|
5
|
+
constructor(maxEntries?: number);
|
|
6
|
+
capture(root: object, options?: {
|
|
7
|
+
exclude?: string[];
|
|
8
|
+
}): number;
|
|
9
|
+
restore(id: number, root: Record<string, any>): void;
|
|
10
|
+
private cloneState;
|
|
11
|
+
private cloneValue;
|
|
12
|
+
private applyState;
|
|
13
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SomaDiagnostics } from '../diagnostics/SomaDiagnostics';
|
|
2
|
+
import type { SomaSchedulerOptions, SomaSchedulerTaskOptions } from '../types/scheduler.types';
|
|
3
|
+
export declare class SomaScheduler {
|
|
4
|
+
private readonly autoFlush;
|
|
5
|
+
private readonly queues;
|
|
6
|
+
private diagnostics;
|
|
7
|
+
private flushQueued;
|
|
8
|
+
private flushing;
|
|
9
|
+
constructor(options?: SomaSchedulerOptions & {
|
|
10
|
+
diagnostics?: SomaDiagnostics;
|
|
11
|
+
});
|
|
12
|
+
setDiagnostics(diagnostics: SomaDiagnostics | null): void;
|
|
13
|
+
schedule<T>(run: () => T | Promise<T>, options?: SomaSchedulerTaskOptions): Promise<T>;
|
|
14
|
+
cancelAll(reason?: string): void;
|
|
15
|
+
flush(): Promise<void>;
|
|
16
|
+
private hasPendingTasks;
|
|
17
|
+
private queueFlush;
|
|
18
|
+
private getHighestPendingPriority;
|
|
19
|
+
/**
|
|
20
|
+
* 检测是否在真实浏览器环境中(非 jsdom/Node)。
|
|
21
|
+
* jsdom 的 rAF 是简单的 setTimeout polyfill,时序不可靠。
|
|
22
|
+
*/
|
|
23
|
+
private hasTrueRAF;
|
|
24
|
+
private now;
|
|
25
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 页面聚合根接口
|
|
3
|
+
* 展示对象必须实现此接口,提供页面生命周期钩子
|
|
4
|
+
*/
|
|
5
|
+
export interface SomaPageRoot {
|
|
6
|
+
/** Content strings from locale.yaml (injected by bootstrap) */
|
|
7
|
+
_locale?: Record<string, unknown>;
|
|
8
|
+
/** 应用配置(引擎在 mount 时注入) */
|
|
9
|
+
_config?: unknown;
|
|
10
|
+
/** 运行时基础设施(引擎在 mount 时注入) */
|
|
11
|
+
_services?: import('../runtime/SomaRuntimeServices').SomaRuntimeServices;
|
|
12
|
+
/** 页面初始化(引擎在渲染完成后调用) */
|
|
13
|
+
onMount?(): void | Promise<void>;
|
|
14
|
+
/** 页面销毁前(引擎在卸载时调用) */
|
|
15
|
+
onUnmount?(): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 应用配置接口
|
|
19
|
+
* 外部配置通过引擎注入到 Class 的 _config 属性。
|
|
20
|
+
* 业务扩展字段(auth、realtime、notify 等)通过 SomaConfig.get() 读取,不在框架层强类型约束。
|
|
21
|
+
*/
|
|
22
|
+
export interface SomaAppConfig {
|
|
23
|
+
/** API 基础地址 */
|
|
24
|
+
apiBaseUrl: string;
|
|
25
|
+
/** 默认分页大小 */
|
|
26
|
+
defaultPageSize: number;
|
|
27
|
+
/** 请求超时时间(毫秒) */
|
|
28
|
+
requestTimeout: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 校验规则
|
|
32
|
+
* 定义单个字段的校验条件
|
|
33
|
+
*/
|
|
34
|
+
export interface ValidationRule {
|
|
35
|
+
/** 是否必填 */
|
|
36
|
+
required?: boolean;
|
|
37
|
+
/** 最小长度(字符串) */
|
|
38
|
+
minLength?: number;
|
|
39
|
+
/** 最大长度(字符串) */
|
|
40
|
+
maxLength?: number;
|
|
41
|
+
/** 最小值(数字) */
|
|
42
|
+
min?: number;
|
|
43
|
+
/** 最大值(数字) */
|
|
44
|
+
max?: number;
|
|
45
|
+
/** 正则表达式匹配 */
|
|
46
|
+
pattern?: RegExp;
|
|
47
|
+
/** 校验失败时的错误消息 */
|
|
48
|
+
message: string;
|
|
49
|
+
/** 自定义校验函数,返回 true 表示通过 */
|
|
50
|
+
custom?: (value: any) => boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* 校验结果
|
|
54
|
+
* validate 方法返回的结构化结果
|
|
55
|
+
*/
|
|
56
|
+
export interface ValidationResult {
|
|
57
|
+
/** 整体校验是否通过 */
|
|
58
|
+
valid: boolean;
|
|
59
|
+
/** 各字段的错误消息集合 */
|
|
60
|
+
errors: Record<string, string[]>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 业务事件处理函数签名
|
|
64
|
+
* 所有被 _event.yaml 引用的方法必须符合此签名
|
|
65
|
+
*/
|
|
66
|
+
export interface SomaEventHandler {
|
|
67
|
+
(...args: any[]): Promise<boolean> | boolean | void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 常量对象接口
|
|
71
|
+
* 提供静态枚举值或配置项
|
|
72
|
+
*/
|
|
73
|
+
export interface SomaConstant {
|
|
74
|
+
readonly [key: string]: any;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 可加载常量接口
|
|
78
|
+
* 支持从后端加载动态字典数据
|
|
79
|
+
*/
|
|
80
|
+
export interface SomaLoadableConstant extends SomaConstant {
|
|
81
|
+
loadFromAPI(): Promise<void>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ShowMapping } from './ui-config.types';
|
|
2
|
+
export type BindingType = 'text' | 'attr' | 'html' | 'list' | 'obj' | 'model' | 'when' | 'class';
|
|
3
|
+
export interface BindingEntry {
|
|
4
|
+
somaId?: string;
|
|
5
|
+
dataPath: string;
|
|
6
|
+
watchPaths?: string[];
|
|
7
|
+
element: HTMLElement;
|
|
8
|
+
type: BindingType;
|
|
9
|
+
templateCache?: DocumentFragment;
|
|
10
|
+
childShowConfig?: ShowMapping;
|
|
11
|
+
attrName?: string;
|
|
12
|
+
negate?: boolean;
|
|
13
|
+
classRules?: Record<string, string>;
|
|
14
|
+
/** 预编译的属性访问器:消除 path.split + 循环 */
|
|
15
|
+
compiledGetter?: (root: any) => any;
|
|
16
|
+
/** 预编译的渲染函数:消除 switch 分支 + 类型判断 */
|
|
17
|
+
compiledRender?: (value: any) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface PendingPatch {
|
|
20
|
+
path: string;
|
|
21
|
+
value: any;
|
|
22
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 事件类型枚举
|
|
3
|
+
* 定义 Pipeline DSL 支持的四种事件处理类型
|
|
4
|
+
*/
|
|
5
|
+
export type EventType = 'NAV_STATIC' | 'NAV_ACTION' | 'UI_REFRESH' | 'UI_INTERACT';
|
|
6
|
+
/**
|
|
7
|
+
* UI 交互动作枚举
|
|
8
|
+
* 用于 UI_INTERACT 类型的动作指令
|
|
9
|
+
*/
|
|
10
|
+
export type InteractAction = 'open' | 'close' | 'toggle';
|
|
11
|
+
/**
|
|
12
|
+
* 解析后的事件配置
|
|
13
|
+
* Pipeline DSL 解析器将 YAML 中的事件声明解析为此结构
|
|
14
|
+
*/
|
|
15
|
+
export interface ParsedEvent {
|
|
16
|
+
/** 目标元素的 data-soma-id 值 */
|
|
17
|
+
somaId: string;
|
|
18
|
+
/** DOM 事件类型(click, input, change, keydown 等) */
|
|
19
|
+
domEvent: string;
|
|
20
|
+
/** Pipeline 类型 */
|
|
21
|
+
type: EventType;
|
|
22
|
+
/** 业务逻辑函数路径(如 "boardCard.funcName1"),null 表示不执行逻辑 */
|
|
23
|
+
funcPath?: string | null;
|
|
24
|
+
/** 目标页面 URL(NAV_STATIC / NAV_ACTION 使用) */
|
|
25
|
+
targetUrl?: string;
|
|
26
|
+
/** 操作目标的 data-soma-id(UI_INTERACT 使用),undefined 时默认 self */
|
|
27
|
+
targetId?: string;
|
|
28
|
+
/** UI 动作指令(UI_INTERACT 使用),默认 toggle */
|
|
29
|
+
action?: InteractAction;
|
|
30
|
+
/**
|
|
31
|
+
* 键盘事件修饰符(如 "enter", "escape", "tab")
|
|
32
|
+
* 仅用于 keydown/keyup 事件,引擎在触发时检查 event.key 是否匹配
|
|
33
|
+
*/
|
|
34
|
+
keyModifier?: string;
|
|
35
|
+
/**
|
|
36
|
+
* 执行前确认对话框文案(Pipeline 可选段 `confirm:消息`)
|
|
37
|
+
* 用户取消则中止事件,不调用业务方法
|
|
38
|
+
*/
|
|
39
|
+
confirm?: string;
|
|
40
|
+
/**
|
|
41
|
+
* UI_REFRESH 显式全量渲染(Pipeline 可选段 `| force`)
|
|
42
|
+
*/
|
|
43
|
+
refreshForce?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* 执行前权限码(Pipeline 可选段 `| permission:code`)
|
|
46
|
+
* 需宿主挂载 createPermissionMiddleware 后生效
|
|
47
|
+
*/
|
|
48
|
+
permission?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 事件 handler 返回值:仅表示业务成功/失败(流程是否继续)。
|
|
52
|
+
* - `true` / `undefined`:成功,继续 post-action(跳转、显隐等)
|
|
53
|
+
* - `false`:失败,中断 post-action
|
|
54
|
+
* 与 DOM 刷新/commit 无关(改字段后引擎自动 commit)。
|
|
55
|
+
*/
|
|
56
|
+
export type EventHandlerResult = boolean | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* 事件配置原始结构
|
|
59
|
+
* YAML 反序列化后的嵌套对象,叶节点为 Pipeline 表达式字符串
|
|
60
|
+
*/
|
|
61
|
+
export type EventConfigRaw = Record<string, string | Record<string, any>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { BindingType } from './engine.types';
|
|
2
|
+
import type { ParsedEvent } from './event.types';
|
|
3
|
+
import type { SomaTaskPriority } from './scheduler.types';
|
|
4
|
+
import type { ShowMapping } from './ui-config.types';
|
|
5
|
+
export interface SomaCompiledBinding {
|
|
6
|
+
id: string;
|
|
7
|
+
somaId: string;
|
|
8
|
+
type: BindingType;
|
|
9
|
+
dataPath: string;
|
|
10
|
+
watchPaths: string[];
|
|
11
|
+
attrName?: string;
|
|
12
|
+
negate?: boolean;
|
|
13
|
+
classRules?: Record<string, string>;
|
|
14
|
+
childShowConfig?: ShowMapping;
|
|
15
|
+
/** 静态提升标记:值在初始化后不会变化,不需要注册 watchPaths */
|
|
16
|
+
static?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface SomaCompiledEvent extends ParsedEvent {
|
|
19
|
+
eventKey: string;
|
|
20
|
+
priority: SomaTaskPriority;
|
|
21
|
+
}
|
|
22
|
+
export interface SomaRuntimeManifest {
|
|
23
|
+
bindings: SomaCompiledBinding[];
|
|
24
|
+
bindingIndex: Map<string, SomaCompiledBinding[]>;
|
|
25
|
+
events: SomaCompiledEvent[];
|
|
26
|
+
eventIndex: Map<string, SomaCompiledEvent>;
|
|
27
|
+
/** 启动时一次性初始化的属性(来自 _ui.yaml initProps) */
|
|
28
|
+
initProps?: Record<string, unknown>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 状态驱动的样式规则
|
|
3
|
+
* 当 condition 路径的值等于 value 时,将 apply 中的类名应用到对应 DOM 节点
|
|
4
|
+
*/
|
|
5
|
+
export interface StyleStateRule {
|
|
6
|
+
/** 数据路径(纯属性路径,禁止逻辑表达式) */
|
|
7
|
+
condition: string;
|
|
8
|
+
/** 目标值(基础类型:string | number | boolean | null) */
|
|
9
|
+
value: string | number | boolean | null;
|
|
10
|
+
/** 匹配时应用的 Tailwind 类名 */
|
|
11
|
+
apply: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 过渡/动画触发器类型
|
|
15
|
+
*/
|
|
16
|
+
export type TransitionTrigger = 'hover' | 'focus' | 'active' | 'enter' | 'leave' | 'active_state';
|
|
17
|
+
/**
|
|
18
|
+
* 过渡/动画配置
|
|
19
|
+
*/
|
|
20
|
+
export interface StyleTransition {
|
|
21
|
+
/** 触发方式 */
|
|
22
|
+
trigger: TransitionTrigger;
|
|
23
|
+
/** 应用的 Tailwind 动画/过渡类名 */
|
|
24
|
+
apply: string;
|
|
25
|
+
/** active_state 类型时的条件路径 */
|
|
26
|
+
condition?: string;
|
|
27
|
+
/** active_state 类型时的目标值 */
|
|
28
|
+
value?: string | number | boolean | null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 主题内的状态覆盖
|
|
32
|
+
*/
|
|
33
|
+
export interface ThemeStatesOverride {
|
|
34
|
+
[somaId: string]: StyleStateRule[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 单个主题配置
|
|
38
|
+
*/
|
|
39
|
+
export interface ThemeConfig {
|
|
40
|
+
/** 基础类名覆盖:somaId → Tailwind 类名 */
|
|
41
|
+
base: Record<string, string>;
|
|
42
|
+
/** 状态规则覆盖 */
|
|
43
|
+
states: ThemeStatesOverride;
|
|
44
|
+
/** 运行时 CSS 变量(ThemeMaster 注入 document) */
|
|
45
|
+
vars?: Record<string, string>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 样式配置顶层结构
|
|
49
|
+
* 对应 _style.yaml 文件的完整结构
|
|
50
|
+
*/
|
|
51
|
+
export interface StyleConfig {
|
|
52
|
+
/** 所属的业务对象标识(对应 data-soma-host) */
|
|
53
|
+
host: string;
|
|
54
|
+
/** 基础静态样式映射:somaId → Tailwind 类名 */
|
|
55
|
+
base: Record<string, string>;
|
|
56
|
+
/** 状态驱动样式:somaId → 规则数组 */
|
|
57
|
+
states: Record<string, StyleStateRule[]>;
|
|
58
|
+
/** 动态交互与动画:somaId → 过渡配置 */
|
|
59
|
+
transitions: Record<string, StyleTransition>;
|
|
60
|
+
/** 多主题覆盖配置 */
|
|
61
|
+
themes: Record<string, ThemeConfig>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ParsedEvent } from './event.types';
|
|
2
|
+
/** 解析后的定时器配置 */
|
|
3
|
+
export interface ParsedTimer {
|
|
4
|
+
/** 唯一标识(用于日志与调试) */
|
|
5
|
+
id: string;
|
|
6
|
+
/** 周期间隔(毫秒),interval 模式必填 */
|
|
7
|
+
intervalMs: number;
|
|
8
|
+
/** 首次触发延迟(毫秒),默认 0 */
|
|
9
|
+
delayMs: number;
|
|
10
|
+
/** true 时仅触发一次(setTimeout),否则 setInterval */
|
|
11
|
+
once: boolean;
|
|
12
|
+
/** Pipeline 解析结果(不含 DOM 选择器) */
|
|
13
|
+
pipeline: Omit<ParsedEvent, 'somaId' | 'domEvent'>;
|
|
14
|
+
}
|
|
15
|
+
export interface SomaCompiledTimer extends ParsedTimer {
|
|
16
|
+
somaId: string;
|
|
17
|
+
domEvent: 'tick';
|
|
18
|
+
eventKey: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface PropertyTrigger {
|
|
2
|
+
/** 监听的数据路径(含 var 别名,如 page.isLoading) */
|
|
3
|
+
condition: string;
|
|
4
|
+
/** 触发条件:属性值等于此值时执行 */
|
|
5
|
+
value: string | number | boolean | null;
|
|
6
|
+
/** 目标元素的 data-soma-id */
|
|
7
|
+
target: string;
|
|
8
|
+
/** 分发的 DOM 事件名(如 soma:show、click) */
|
|
9
|
+
event: string;
|
|
10
|
+
/** 自定义事件 detail 载荷 */
|
|
11
|
+
detail?: Record<string, unknown>;
|
|
12
|
+
}
|