@djvlc/runtime-core 1.2.0 → 1.2.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/dist/index.cjs +1 -1
- package/dist/index.d.cts +108 -82
- package/dist/index.d.ts +108 -82
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _djvlc_contracts_types from '@djvlc/contracts-types';
|
|
2
|
-
import { PageResolveResponse, ActionResult, ExpressionContext, Expression, ExpressionValidationResult,
|
|
3
|
-
export { ActionExecuteRequest, ActionExecuteResponse,
|
|
2
|
+
import { PageResolveResponse, ActionResult, ExpressionContext, Expression, ExpressionValidationResult, EventBinding, HostApi, NavigateOptions, TrackEvent as TrackEvent$1, DialogOptions, DialogResult, ToastOptions, ClipboardApi, StorageApi, ShareOptions, ShareResult, ConfirmOptions, ActionSheetOptions, ActionSheetResult, PreviewImageOptions, ScanCodeResult, ComponentContext, ErrorCode, ManifestItem, PageManifest, PageSchema, CapabilityName, PageLifecycle } from '@djvlc/contracts-types';
|
|
3
|
+
export { ACTION_STEP_DEFAULTS, ActionExecuteRequest, ActionExecuteResponse, ActionRef, ActionResult, ActionStep, AnyValueOrExpression, BlockedComponentInfo, BuiltinActionRef, BuiltinActionType, CapabilityDeclaration, CompatInfo, ComponentContext, ComponentMeta, ComponentNode, CustomActionRef, DataBinding, DataLoadStrategy, DataQueryRequest, DataQueryResponse, DialogOptions, DialogResult, EVENT_BINDING_DEFAULTS, ErrorCode, ErrorMessages, EventBinding, EventDeclaration, EventErrorStrategy, EventStep, EventStrategy, Expression, ExpressionContext, ExpressionLocal, ExpressionMeta, ExpressionType, ExpressionValidationResult, HostApi as HostAPI, HostApi, JsonValue, LayoutConfig, LayoutValues, LoopConfig, ManifestItem, NavigateOptions, NodeStyleConfig, PageConfig, PageLifecycle, PageManifest, PageMeta, PageSEO, PageSchema, PageState, PropDefinition, PropsSchema, RateLimitConfig, RuntimeSpec, SchemaVersion, SemVer, StateFieldDefinition, StepOutputConfig, StepRunMode, ToastOptions, TrackEvent, UniqueId, VersionedActionRef } from '@djvlc/contracts-types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* User API Adapter(端口接口)
|
|
@@ -850,28 +850,30 @@ declare class EventBus {
|
|
|
850
850
|
*/
|
|
851
851
|
interface ActionExecutor {
|
|
852
852
|
/** 执行自定义动作(通过 Action Gateway) */
|
|
853
|
-
executeAction<T = unknown>(
|
|
853
|
+
executeAction<T = unknown>(actionKey: string, params: Record<string, unknown>, meta?: {
|
|
854
|
+
version?: string;
|
|
855
|
+
actionDefinitionVersionId?: string;
|
|
856
|
+
}): Promise<{
|
|
854
857
|
success: boolean;
|
|
855
858
|
data?: T;
|
|
856
859
|
errorCode?: string;
|
|
857
860
|
errorMessage?: string;
|
|
858
861
|
}>;
|
|
859
|
-
/** 执行数据查询(通过 Data Proxy) */
|
|
860
|
-
requestData<T = unknown>(queryId: string, params?: Record<string, unknown>): Promise<{
|
|
861
|
-
success: boolean;
|
|
862
|
-
data?: T;
|
|
863
|
-
message?: string;
|
|
864
|
-
}>;
|
|
865
862
|
/** 导航 */
|
|
866
863
|
navigate(options: _djvlc_contracts_types.NavigateOptions): void;
|
|
867
|
-
/**
|
|
868
|
-
|
|
864
|
+
/**
|
|
865
|
+
* 显示系统级对话框(DOM 浮层,复用 djvlc-dialog 视觉风格)
|
|
866
|
+
*
|
|
867
|
+
* @description
|
|
868
|
+
* 仅用于"系统对话框"模式(无 dialogId 时)。
|
|
869
|
+
* "组件弹窗"模式由 ActionBridge 内部通过 DOM 直接操作,不走此接口。
|
|
870
|
+
* 弹窗关闭时 resolve,不返回确认/取消结果。
|
|
871
|
+
*/
|
|
872
|
+
showSystemDialog(options: {
|
|
869
873
|
type: string;
|
|
870
|
-
content: string;
|
|
871
874
|
title?: string;
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
closeDialog(dialogId?: string): void;
|
|
875
|
+
content: string;
|
|
876
|
+
}): Promise<void>;
|
|
875
877
|
/** 显示 Toast */
|
|
876
878
|
showToast(options: {
|
|
877
879
|
message: string;
|
|
@@ -906,51 +908,41 @@ interface ActionBridgeOptions {
|
|
|
906
908
|
debug?: boolean;
|
|
907
909
|
/** 日志器 */
|
|
908
910
|
logger?: Logger;
|
|
909
|
-
/** 动作执行前回调 */
|
|
910
|
-
onActionStart?: (actionRef: ActionRef, params: Record<string, unknown>) => void;
|
|
911
|
-
/** 动作执行后回调 */
|
|
912
|
-
onActionComplete?: (actionRef: ActionRef, result: {
|
|
913
|
-
success: boolean;
|
|
914
|
-
data?: unknown;
|
|
915
|
-
error?: Error;
|
|
916
|
-
}) => void;
|
|
917
|
-
}
|
|
918
|
-
/**
|
|
919
|
-
* 动作执行上下文
|
|
920
|
-
*/
|
|
921
|
-
interface ActionExecutionContext {
|
|
922
|
-
/** 事件数据 */
|
|
923
|
-
$event: unknown;
|
|
924
|
-
/** 上一个动作的结果 */
|
|
925
|
-
$prevResult: unknown;
|
|
926
|
-
/** 所有动作的结果 */
|
|
927
|
-
$results: Record<string, unknown>;
|
|
928
911
|
}
|
|
929
912
|
/**
|
|
930
913
|
* 动作桥接器
|
|
931
|
-
*
|
|
914
|
+
*
|
|
915
|
+
* 统一入口:executeEventBinding
|
|
916
|
+
* 将 EventBinding 的声明式配置转换为实际执行。
|
|
932
917
|
*/
|
|
933
918
|
declare class ActionBridge {
|
|
934
919
|
private options;
|
|
935
920
|
private debounceTimers;
|
|
936
921
|
private throttleTimers;
|
|
922
|
+
private concurrentCount;
|
|
923
|
+
/** 记录 rateLimit.once 已触发的 binding */
|
|
924
|
+
private onceFired;
|
|
937
925
|
constructor(options: ActionBridgeOptions);
|
|
938
926
|
/**
|
|
939
|
-
*
|
|
927
|
+
* 执行事件绑定
|
|
928
|
+
*
|
|
929
|
+
* 统一入口,严格按 contracts EventBinding 语义执行。
|
|
940
930
|
*/
|
|
941
|
-
|
|
931
|
+
executeEventBinding(binding: EventBinding, eventData: unknown, baseContext: ExpressionContext): Promise<void>;
|
|
932
|
+
private executeSequential;
|
|
933
|
+
private executeParallel;
|
|
942
934
|
/**
|
|
943
|
-
*
|
|
935
|
+
* 准备并执行单个步骤(sequential 模式专用,处理 runMode)
|
|
944
936
|
*/
|
|
945
|
-
|
|
937
|
+
private prepareAndExecuteStep;
|
|
946
938
|
/**
|
|
947
|
-
*
|
|
939
|
+
* 安全执行单个步骤(捕获错误,返回 StepResult)
|
|
948
940
|
*/
|
|
949
|
-
private
|
|
941
|
+
private executeStepSafe;
|
|
950
942
|
/**
|
|
951
|
-
*
|
|
943
|
+
* 根据 ActionRef 分发到具体执行器
|
|
952
944
|
*/
|
|
953
|
-
private
|
|
945
|
+
private dispatchAction;
|
|
954
946
|
/**
|
|
955
947
|
* 执行内置动作
|
|
956
948
|
*/
|
|
@@ -960,56 +952,41 @@ declare class ActionBridge {
|
|
|
960
952
|
*/
|
|
961
953
|
private executeCustomAction;
|
|
962
954
|
/**
|
|
963
|
-
*
|
|
955
|
+
* 设置画布上弹窗组件的可见性
|
|
956
|
+
*
|
|
957
|
+
* @param dialogId - 组件 data-component-id
|
|
958
|
+
* @param visible - true 打开 / false 关闭
|
|
959
|
+
* @returns 执行结果
|
|
960
|
+
* @throws ActionError 如果组件不存在
|
|
964
961
|
*/
|
|
962
|
+
private setDialogVisibility;
|
|
963
|
+
/** Expression.type 列表(用于识别 Expression 对象) */
|
|
965
964
|
private static readonly EXPRESSION_TYPES;
|
|
966
965
|
/**
|
|
967
966
|
* 解析参数中的表达式
|
|
968
|
-
*
|
|
969
|
-
* @param params - ActionRef.params,类型为 Record<string, AnyValueOrExpression>
|
|
970
967
|
*/
|
|
971
968
|
private resolveParams;
|
|
972
969
|
/**
|
|
973
970
|
* 解析单个值(支持 AnyValueOrExpression)
|
|
974
|
-
*
|
|
975
|
-
* AnyValueOrExpression 可以是:
|
|
976
|
-
* - Expression 对象:{ type: 'state' | 'binding' | 'local' | 'template' | 'computed', value: string, fallback?: any }
|
|
977
|
-
* - 原始值:string | number | boolean | null
|
|
978
|
-
* - 嵌套数组:AnyValueOrExpression[]
|
|
979
|
-
* - 嵌套对象:{ [key: string]: AnyValueOrExpression }
|
|
980
971
|
*/
|
|
981
972
|
private resolveValue;
|
|
982
973
|
/**
|
|
983
974
|
* 求值条件表达式
|
|
984
|
-
* 将事件数据注入到 local 上下文中(对齐 contracts 的 ExpressionContext)
|
|
985
|
-
*
|
|
986
|
-
* @param condition - Expression 对象,包含 type、value、fallback
|
|
987
975
|
*/
|
|
988
976
|
private evaluateCondition;
|
|
989
977
|
/**
|
|
990
|
-
*
|
|
991
|
-
* 将事件数据和动作结果注入到 local 上下文中
|
|
992
|
-
*/
|
|
993
|
-
private buildActionContext;
|
|
994
|
-
/**
|
|
995
|
-
* 带超时的 Promise
|
|
978
|
+
* 构建步骤执行上下文
|
|
996
979
|
*/
|
|
980
|
+
private buildStepContext;
|
|
981
|
+
/** 描述 ActionRef(日志用) */
|
|
982
|
+
private describeRef;
|
|
983
|
+
/** 带超时的 Promise */
|
|
997
984
|
private withTimeout;
|
|
998
|
-
/**
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
private
|
|
1002
|
-
/**
|
|
1003
|
-
* 节流
|
|
1004
|
-
*/
|
|
1005
|
-
private throttle;
|
|
1006
|
-
/**
|
|
1007
|
-
* 延迟
|
|
1008
|
-
*/
|
|
1009
|
-
private delay;
|
|
1010
|
-
/**
|
|
1011
|
-
* 销毁
|
|
1012
|
-
*/
|
|
985
|
+
/** 节流检查 */
|
|
986
|
+
private checkThrottle;
|
|
987
|
+
/** 防抖 */
|
|
988
|
+
private applyDebounce;
|
|
989
|
+
/** 销毁 */
|
|
1013
990
|
destroy(): void;
|
|
1014
991
|
private log;
|
|
1015
992
|
}
|
|
@@ -1068,6 +1045,10 @@ declare class HostAPIImpl implements HostApi {
|
|
|
1068
1045
|
private storageNamespace;
|
|
1069
1046
|
private loadingCount;
|
|
1070
1047
|
private loadingElement;
|
|
1048
|
+
/** 当前活跃的系统弹窗元素(同一时间只显示一个,新弹窗替换旧弹窗) */
|
|
1049
|
+
private systemDialogOverlay;
|
|
1050
|
+
/** 当前系统弹窗的 resolve 回调 */
|
|
1051
|
+
private systemDialogResolve;
|
|
1071
1052
|
constructor(options: HostAPIOptions);
|
|
1072
1053
|
navigate(options: NavigateOptions): Promise<void>;
|
|
1073
1054
|
track(event: TrackEvent$1): void;
|
|
@@ -1078,6 +1059,26 @@ declare class HostAPIImpl implements HostApi {
|
|
|
1078
1059
|
showToast(options: ToastOptions): void;
|
|
1079
1060
|
showLoading(message?: string): void;
|
|
1080
1061
|
hideLoading(): void;
|
|
1062
|
+
/**
|
|
1063
|
+
* 显示系统级对话框(DOM 浮层)
|
|
1064
|
+
*
|
|
1065
|
+
* 与 showToast / showLoading 同级,直接用 DOM 创建弹窗浮层,
|
|
1066
|
+
* 复用 djvlc-dialog 的视觉风格(遮罩 + 居中卡片 + 标题 + 内容 + 确认按钮)。
|
|
1067
|
+
*
|
|
1068
|
+
* - 同一时间只显示一个系统弹窗(新弹窗替换旧弹窗)
|
|
1069
|
+
* - 点击"我知道了"按钮或遮罩 → 关闭弹窗 → resolve
|
|
1070
|
+
* - type 映射按钮颜色:info/confirm/alert=蓝色,warning=橙色,error=红色
|
|
1071
|
+
*
|
|
1072
|
+
* @param options.type - 弹窗类型:info / warning / error / confirm / alert
|
|
1073
|
+
* @param options.title - 标题(可选)
|
|
1074
|
+
* @param options.content - 内容
|
|
1075
|
+
* @returns Promise<void> — 弹窗关闭时 resolve(不返回确认/取消结果)
|
|
1076
|
+
*/
|
|
1077
|
+
showSystemDialog(options: {
|
|
1078
|
+
type: string;
|
|
1079
|
+
title?: string;
|
|
1080
|
+
content: string;
|
|
1081
|
+
}): Promise<void>;
|
|
1081
1082
|
clipboard: ClipboardApi;
|
|
1082
1083
|
storage: StorageApi;
|
|
1083
1084
|
share(options: ShareOptions): Promise<ShareResult>;
|
|
@@ -1091,6 +1092,7 @@ declare class HostAPIImpl implements HostApi {
|
|
|
1091
1092
|
private generateIdempotencyKey;
|
|
1092
1093
|
private simpleHash;
|
|
1093
1094
|
private fallbackCopy;
|
|
1095
|
+
private escapeHtml;
|
|
1094
1096
|
private log;
|
|
1095
1097
|
}
|
|
1096
1098
|
|
|
@@ -1935,7 +1937,7 @@ interface BaseRendererOptions {
|
|
|
1935
1937
|
/** Host API 注入函数 */
|
|
1936
1938
|
injectHostApi: (element: HTMLElement, componentId: string) => void;
|
|
1937
1939
|
/** 事件处理器 */
|
|
1938
|
-
onComponentEvent?: (componentId: string, eventName: string,
|
|
1940
|
+
onComponentEvent?: (componentId: string, eventName: string, bindings: EventBinding[], eventData: unknown) => void;
|
|
1939
1941
|
/** 调试模式 */
|
|
1940
1942
|
debug?: boolean;
|
|
1941
1943
|
/** 日志器 */
|
|
@@ -2014,7 +2016,7 @@ declare class BaseRenderer implements Renderer {
|
|
|
2014
2016
|
*/
|
|
2015
2017
|
private createSlotContainer;
|
|
2016
2018
|
/**
|
|
2017
|
-
*
|
|
2019
|
+
* 绑定事件处理器(新 EventBinding 结构)
|
|
2018
2020
|
*/
|
|
2019
2021
|
private bindEventHandlers;
|
|
2020
2022
|
/**
|
|
@@ -2080,6 +2082,30 @@ declare class BaseRenderer implements Renderer {
|
|
|
2080
2082
|
* 将布局值转换为 CSS
|
|
2081
2083
|
*/
|
|
2082
2084
|
private layoutToCSS;
|
|
2085
|
+
/**
|
|
2086
|
+
* 应用 SEO 配置
|
|
2087
|
+
*
|
|
2088
|
+
* 按照 PageSEO 定义设置 document.title / <meta> / Open Graph / JSON-LD:
|
|
2089
|
+
* - title → document.title + <meta property="og:title">
|
|
2090
|
+
* - description → <meta name="description"> + <meta property="og:description">
|
|
2091
|
+
* - keywords → <meta name="keywords">
|
|
2092
|
+
* - canonicalUrl → <link rel="canonical">
|
|
2093
|
+
* - ogImage → <meta property="og:image">
|
|
2094
|
+
* - ogType → <meta property="og:type">
|
|
2095
|
+
* - indexable → <meta name="robots">
|
|
2096
|
+
* - structuredData → <script type="application/ld+json">
|
|
2097
|
+
*
|
|
2098
|
+
* 优先级:seo.title > meta.title(seo 是面向搜索引擎的,meta 是面向编辑器的)
|
|
2099
|
+
*/
|
|
2100
|
+
private applySEO;
|
|
2101
|
+
/** 设置或更新 <meta name="..."> 标签 */
|
|
2102
|
+
private _setMeta;
|
|
2103
|
+
/** 设置或更新 <meta property="..."> 标签(Open Graph) */
|
|
2104
|
+
private _setMetaProperty;
|
|
2105
|
+
/** 设置或更新 <link rel="..."> 标签 */
|
|
2106
|
+
private _setLink;
|
|
2107
|
+
/** 注入 JSON-LD 结构化数据 */
|
|
2108
|
+
private _injectJsonLd;
|
|
2083
2109
|
/**
|
|
2084
2110
|
* 应用页面配置(PageConfig 结构)
|
|
2085
2111
|
*
|
|
@@ -2463,13 +2489,13 @@ declare class LifecycleManager {
|
|
|
2463
2489
|
*/
|
|
2464
2490
|
private setupVisibilityListener;
|
|
2465
2491
|
/**
|
|
2466
|
-
*
|
|
2492
|
+
* 执行生命周期步骤
|
|
2467
2493
|
*/
|
|
2468
|
-
private
|
|
2494
|
+
private executeLifecycleSteps;
|
|
2469
2495
|
/**
|
|
2470
|
-
*
|
|
2496
|
+
* 使用指定上下文执行生命周期步骤
|
|
2471
2497
|
*/
|
|
2472
|
-
private
|
|
2498
|
+
private executeLifecycleStepsWithContext;
|
|
2473
2499
|
private log;
|
|
2474
2500
|
}
|
|
2475
2501
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _djvlc_contracts_types from '@djvlc/contracts-types';
|
|
2
|
-
import { PageResolveResponse, ActionResult, ExpressionContext, Expression, ExpressionValidationResult,
|
|
3
|
-
export { ActionExecuteRequest, ActionExecuteResponse,
|
|
2
|
+
import { PageResolveResponse, ActionResult, ExpressionContext, Expression, ExpressionValidationResult, EventBinding, HostApi, NavigateOptions, TrackEvent as TrackEvent$1, DialogOptions, DialogResult, ToastOptions, ClipboardApi, StorageApi, ShareOptions, ShareResult, ConfirmOptions, ActionSheetOptions, ActionSheetResult, PreviewImageOptions, ScanCodeResult, ComponentContext, ErrorCode, ManifestItem, PageManifest, PageSchema, CapabilityName, PageLifecycle } from '@djvlc/contracts-types';
|
|
3
|
+
export { ACTION_STEP_DEFAULTS, ActionExecuteRequest, ActionExecuteResponse, ActionRef, ActionResult, ActionStep, AnyValueOrExpression, BlockedComponentInfo, BuiltinActionRef, BuiltinActionType, CapabilityDeclaration, CompatInfo, ComponentContext, ComponentMeta, ComponentNode, CustomActionRef, DataBinding, DataLoadStrategy, DataQueryRequest, DataQueryResponse, DialogOptions, DialogResult, EVENT_BINDING_DEFAULTS, ErrorCode, ErrorMessages, EventBinding, EventDeclaration, EventErrorStrategy, EventStep, EventStrategy, Expression, ExpressionContext, ExpressionLocal, ExpressionMeta, ExpressionType, ExpressionValidationResult, HostApi as HostAPI, HostApi, JsonValue, LayoutConfig, LayoutValues, LoopConfig, ManifestItem, NavigateOptions, NodeStyleConfig, PageConfig, PageLifecycle, PageManifest, PageMeta, PageSEO, PageSchema, PageState, PropDefinition, PropsSchema, RateLimitConfig, RuntimeSpec, SchemaVersion, SemVer, StateFieldDefinition, StepOutputConfig, StepRunMode, ToastOptions, TrackEvent, UniqueId, VersionedActionRef } from '@djvlc/contracts-types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* User API Adapter(端口接口)
|
|
@@ -850,28 +850,30 @@ declare class EventBus {
|
|
|
850
850
|
*/
|
|
851
851
|
interface ActionExecutor {
|
|
852
852
|
/** 执行自定义动作(通过 Action Gateway) */
|
|
853
|
-
executeAction<T = unknown>(
|
|
853
|
+
executeAction<T = unknown>(actionKey: string, params: Record<string, unknown>, meta?: {
|
|
854
|
+
version?: string;
|
|
855
|
+
actionDefinitionVersionId?: string;
|
|
856
|
+
}): Promise<{
|
|
854
857
|
success: boolean;
|
|
855
858
|
data?: T;
|
|
856
859
|
errorCode?: string;
|
|
857
860
|
errorMessage?: string;
|
|
858
861
|
}>;
|
|
859
|
-
/** 执行数据查询(通过 Data Proxy) */
|
|
860
|
-
requestData<T = unknown>(queryId: string, params?: Record<string, unknown>): Promise<{
|
|
861
|
-
success: boolean;
|
|
862
|
-
data?: T;
|
|
863
|
-
message?: string;
|
|
864
|
-
}>;
|
|
865
862
|
/** 导航 */
|
|
866
863
|
navigate(options: _djvlc_contracts_types.NavigateOptions): void;
|
|
867
|
-
/**
|
|
868
|
-
|
|
864
|
+
/**
|
|
865
|
+
* 显示系统级对话框(DOM 浮层,复用 djvlc-dialog 视觉风格)
|
|
866
|
+
*
|
|
867
|
+
* @description
|
|
868
|
+
* 仅用于"系统对话框"模式(无 dialogId 时)。
|
|
869
|
+
* "组件弹窗"模式由 ActionBridge 内部通过 DOM 直接操作,不走此接口。
|
|
870
|
+
* 弹窗关闭时 resolve,不返回确认/取消结果。
|
|
871
|
+
*/
|
|
872
|
+
showSystemDialog(options: {
|
|
869
873
|
type: string;
|
|
870
|
-
content: string;
|
|
871
874
|
title?: string;
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
closeDialog(dialogId?: string): void;
|
|
875
|
+
content: string;
|
|
876
|
+
}): Promise<void>;
|
|
875
877
|
/** 显示 Toast */
|
|
876
878
|
showToast(options: {
|
|
877
879
|
message: string;
|
|
@@ -906,51 +908,41 @@ interface ActionBridgeOptions {
|
|
|
906
908
|
debug?: boolean;
|
|
907
909
|
/** 日志器 */
|
|
908
910
|
logger?: Logger;
|
|
909
|
-
/** 动作执行前回调 */
|
|
910
|
-
onActionStart?: (actionRef: ActionRef, params: Record<string, unknown>) => void;
|
|
911
|
-
/** 动作执行后回调 */
|
|
912
|
-
onActionComplete?: (actionRef: ActionRef, result: {
|
|
913
|
-
success: boolean;
|
|
914
|
-
data?: unknown;
|
|
915
|
-
error?: Error;
|
|
916
|
-
}) => void;
|
|
917
|
-
}
|
|
918
|
-
/**
|
|
919
|
-
* 动作执行上下文
|
|
920
|
-
*/
|
|
921
|
-
interface ActionExecutionContext {
|
|
922
|
-
/** 事件数据 */
|
|
923
|
-
$event: unknown;
|
|
924
|
-
/** 上一个动作的结果 */
|
|
925
|
-
$prevResult: unknown;
|
|
926
|
-
/** 所有动作的结果 */
|
|
927
|
-
$results: Record<string, unknown>;
|
|
928
911
|
}
|
|
929
912
|
/**
|
|
930
913
|
* 动作桥接器
|
|
931
|
-
*
|
|
914
|
+
*
|
|
915
|
+
* 统一入口:executeEventBinding
|
|
916
|
+
* 将 EventBinding 的声明式配置转换为实际执行。
|
|
932
917
|
*/
|
|
933
918
|
declare class ActionBridge {
|
|
934
919
|
private options;
|
|
935
920
|
private debounceTimers;
|
|
936
921
|
private throttleTimers;
|
|
922
|
+
private concurrentCount;
|
|
923
|
+
/** 记录 rateLimit.once 已触发的 binding */
|
|
924
|
+
private onceFired;
|
|
937
925
|
constructor(options: ActionBridgeOptions);
|
|
938
926
|
/**
|
|
939
|
-
*
|
|
927
|
+
* 执行事件绑定
|
|
928
|
+
*
|
|
929
|
+
* 统一入口,严格按 contracts EventBinding 语义执行。
|
|
940
930
|
*/
|
|
941
|
-
|
|
931
|
+
executeEventBinding(binding: EventBinding, eventData: unknown, baseContext: ExpressionContext): Promise<void>;
|
|
932
|
+
private executeSequential;
|
|
933
|
+
private executeParallel;
|
|
942
934
|
/**
|
|
943
|
-
*
|
|
935
|
+
* 准备并执行单个步骤(sequential 模式专用,处理 runMode)
|
|
944
936
|
*/
|
|
945
|
-
|
|
937
|
+
private prepareAndExecuteStep;
|
|
946
938
|
/**
|
|
947
|
-
*
|
|
939
|
+
* 安全执行单个步骤(捕获错误,返回 StepResult)
|
|
948
940
|
*/
|
|
949
|
-
private
|
|
941
|
+
private executeStepSafe;
|
|
950
942
|
/**
|
|
951
|
-
*
|
|
943
|
+
* 根据 ActionRef 分发到具体执行器
|
|
952
944
|
*/
|
|
953
|
-
private
|
|
945
|
+
private dispatchAction;
|
|
954
946
|
/**
|
|
955
947
|
* 执行内置动作
|
|
956
948
|
*/
|
|
@@ -960,56 +952,41 @@ declare class ActionBridge {
|
|
|
960
952
|
*/
|
|
961
953
|
private executeCustomAction;
|
|
962
954
|
/**
|
|
963
|
-
*
|
|
955
|
+
* 设置画布上弹窗组件的可见性
|
|
956
|
+
*
|
|
957
|
+
* @param dialogId - 组件 data-component-id
|
|
958
|
+
* @param visible - true 打开 / false 关闭
|
|
959
|
+
* @returns 执行结果
|
|
960
|
+
* @throws ActionError 如果组件不存在
|
|
964
961
|
*/
|
|
962
|
+
private setDialogVisibility;
|
|
963
|
+
/** Expression.type 列表(用于识别 Expression 对象) */
|
|
965
964
|
private static readonly EXPRESSION_TYPES;
|
|
966
965
|
/**
|
|
967
966
|
* 解析参数中的表达式
|
|
968
|
-
*
|
|
969
|
-
* @param params - ActionRef.params,类型为 Record<string, AnyValueOrExpression>
|
|
970
967
|
*/
|
|
971
968
|
private resolveParams;
|
|
972
969
|
/**
|
|
973
970
|
* 解析单个值(支持 AnyValueOrExpression)
|
|
974
|
-
*
|
|
975
|
-
* AnyValueOrExpression 可以是:
|
|
976
|
-
* - Expression 对象:{ type: 'state' | 'binding' | 'local' | 'template' | 'computed', value: string, fallback?: any }
|
|
977
|
-
* - 原始值:string | number | boolean | null
|
|
978
|
-
* - 嵌套数组:AnyValueOrExpression[]
|
|
979
|
-
* - 嵌套对象:{ [key: string]: AnyValueOrExpression }
|
|
980
971
|
*/
|
|
981
972
|
private resolveValue;
|
|
982
973
|
/**
|
|
983
974
|
* 求值条件表达式
|
|
984
|
-
* 将事件数据注入到 local 上下文中(对齐 contracts 的 ExpressionContext)
|
|
985
|
-
*
|
|
986
|
-
* @param condition - Expression 对象,包含 type、value、fallback
|
|
987
975
|
*/
|
|
988
976
|
private evaluateCondition;
|
|
989
977
|
/**
|
|
990
|
-
*
|
|
991
|
-
* 将事件数据和动作结果注入到 local 上下文中
|
|
992
|
-
*/
|
|
993
|
-
private buildActionContext;
|
|
994
|
-
/**
|
|
995
|
-
* 带超时的 Promise
|
|
978
|
+
* 构建步骤执行上下文
|
|
996
979
|
*/
|
|
980
|
+
private buildStepContext;
|
|
981
|
+
/** 描述 ActionRef(日志用) */
|
|
982
|
+
private describeRef;
|
|
983
|
+
/** 带超时的 Promise */
|
|
997
984
|
private withTimeout;
|
|
998
|
-
/**
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
private
|
|
1002
|
-
/**
|
|
1003
|
-
* 节流
|
|
1004
|
-
*/
|
|
1005
|
-
private throttle;
|
|
1006
|
-
/**
|
|
1007
|
-
* 延迟
|
|
1008
|
-
*/
|
|
1009
|
-
private delay;
|
|
1010
|
-
/**
|
|
1011
|
-
* 销毁
|
|
1012
|
-
*/
|
|
985
|
+
/** 节流检查 */
|
|
986
|
+
private checkThrottle;
|
|
987
|
+
/** 防抖 */
|
|
988
|
+
private applyDebounce;
|
|
989
|
+
/** 销毁 */
|
|
1013
990
|
destroy(): void;
|
|
1014
991
|
private log;
|
|
1015
992
|
}
|
|
@@ -1068,6 +1045,10 @@ declare class HostAPIImpl implements HostApi {
|
|
|
1068
1045
|
private storageNamespace;
|
|
1069
1046
|
private loadingCount;
|
|
1070
1047
|
private loadingElement;
|
|
1048
|
+
/** 当前活跃的系统弹窗元素(同一时间只显示一个,新弹窗替换旧弹窗) */
|
|
1049
|
+
private systemDialogOverlay;
|
|
1050
|
+
/** 当前系统弹窗的 resolve 回调 */
|
|
1051
|
+
private systemDialogResolve;
|
|
1071
1052
|
constructor(options: HostAPIOptions);
|
|
1072
1053
|
navigate(options: NavigateOptions): Promise<void>;
|
|
1073
1054
|
track(event: TrackEvent$1): void;
|
|
@@ -1078,6 +1059,26 @@ declare class HostAPIImpl implements HostApi {
|
|
|
1078
1059
|
showToast(options: ToastOptions): void;
|
|
1079
1060
|
showLoading(message?: string): void;
|
|
1080
1061
|
hideLoading(): void;
|
|
1062
|
+
/**
|
|
1063
|
+
* 显示系统级对话框(DOM 浮层)
|
|
1064
|
+
*
|
|
1065
|
+
* 与 showToast / showLoading 同级,直接用 DOM 创建弹窗浮层,
|
|
1066
|
+
* 复用 djvlc-dialog 的视觉风格(遮罩 + 居中卡片 + 标题 + 内容 + 确认按钮)。
|
|
1067
|
+
*
|
|
1068
|
+
* - 同一时间只显示一个系统弹窗(新弹窗替换旧弹窗)
|
|
1069
|
+
* - 点击"我知道了"按钮或遮罩 → 关闭弹窗 → resolve
|
|
1070
|
+
* - type 映射按钮颜色:info/confirm/alert=蓝色,warning=橙色,error=红色
|
|
1071
|
+
*
|
|
1072
|
+
* @param options.type - 弹窗类型:info / warning / error / confirm / alert
|
|
1073
|
+
* @param options.title - 标题(可选)
|
|
1074
|
+
* @param options.content - 内容
|
|
1075
|
+
* @returns Promise<void> — 弹窗关闭时 resolve(不返回确认/取消结果)
|
|
1076
|
+
*/
|
|
1077
|
+
showSystemDialog(options: {
|
|
1078
|
+
type: string;
|
|
1079
|
+
title?: string;
|
|
1080
|
+
content: string;
|
|
1081
|
+
}): Promise<void>;
|
|
1081
1082
|
clipboard: ClipboardApi;
|
|
1082
1083
|
storage: StorageApi;
|
|
1083
1084
|
share(options: ShareOptions): Promise<ShareResult>;
|
|
@@ -1091,6 +1092,7 @@ declare class HostAPIImpl implements HostApi {
|
|
|
1091
1092
|
private generateIdempotencyKey;
|
|
1092
1093
|
private simpleHash;
|
|
1093
1094
|
private fallbackCopy;
|
|
1095
|
+
private escapeHtml;
|
|
1094
1096
|
private log;
|
|
1095
1097
|
}
|
|
1096
1098
|
|
|
@@ -1935,7 +1937,7 @@ interface BaseRendererOptions {
|
|
|
1935
1937
|
/** Host API 注入函数 */
|
|
1936
1938
|
injectHostApi: (element: HTMLElement, componentId: string) => void;
|
|
1937
1939
|
/** 事件处理器 */
|
|
1938
|
-
onComponentEvent?: (componentId: string, eventName: string,
|
|
1940
|
+
onComponentEvent?: (componentId: string, eventName: string, bindings: EventBinding[], eventData: unknown) => void;
|
|
1939
1941
|
/** 调试模式 */
|
|
1940
1942
|
debug?: boolean;
|
|
1941
1943
|
/** 日志器 */
|
|
@@ -2014,7 +2016,7 @@ declare class BaseRenderer implements Renderer {
|
|
|
2014
2016
|
*/
|
|
2015
2017
|
private createSlotContainer;
|
|
2016
2018
|
/**
|
|
2017
|
-
*
|
|
2019
|
+
* 绑定事件处理器(新 EventBinding 结构)
|
|
2018
2020
|
*/
|
|
2019
2021
|
private bindEventHandlers;
|
|
2020
2022
|
/**
|
|
@@ -2080,6 +2082,30 @@ declare class BaseRenderer implements Renderer {
|
|
|
2080
2082
|
* 将布局值转换为 CSS
|
|
2081
2083
|
*/
|
|
2082
2084
|
private layoutToCSS;
|
|
2085
|
+
/**
|
|
2086
|
+
* 应用 SEO 配置
|
|
2087
|
+
*
|
|
2088
|
+
* 按照 PageSEO 定义设置 document.title / <meta> / Open Graph / JSON-LD:
|
|
2089
|
+
* - title → document.title + <meta property="og:title">
|
|
2090
|
+
* - description → <meta name="description"> + <meta property="og:description">
|
|
2091
|
+
* - keywords → <meta name="keywords">
|
|
2092
|
+
* - canonicalUrl → <link rel="canonical">
|
|
2093
|
+
* - ogImage → <meta property="og:image">
|
|
2094
|
+
* - ogType → <meta property="og:type">
|
|
2095
|
+
* - indexable → <meta name="robots">
|
|
2096
|
+
* - structuredData → <script type="application/ld+json">
|
|
2097
|
+
*
|
|
2098
|
+
* 优先级:seo.title > meta.title(seo 是面向搜索引擎的,meta 是面向编辑器的)
|
|
2099
|
+
*/
|
|
2100
|
+
private applySEO;
|
|
2101
|
+
/** 设置或更新 <meta name="..."> 标签 */
|
|
2102
|
+
private _setMeta;
|
|
2103
|
+
/** 设置或更新 <meta property="..."> 标签(Open Graph) */
|
|
2104
|
+
private _setMetaProperty;
|
|
2105
|
+
/** 设置或更新 <link rel="..."> 标签 */
|
|
2106
|
+
private _setLink;
|
|
2107
|
+
/** 注入 JSON-LD 结构化数据 */
|
|
2108
|
+
private _injectJsonLd;
|
|
2083
2109
|
/**
|
|
2084
2110
|
* 应用页面配置(PageConfig 结构)
|
|
2085
2111
|
*
|
|
@@ -2463,13 +2489,13 @@ declare class LifecycleManager {
|
|
|
2463
2489
|
*/
|
|
2464
2490
|
private setupVisibilityListener;
|
|
2465
2491
|
/**
|
|
2466
|
-
*
|
|
2492
|
+
* 执行生命周期步骤
|
|
2467
2493
|
*/
|
|
2468
|
-
private
|
|
2494
|
+
private executeLifecycleSteps;
|
|
2469
2495
|
/**
|
|
2470
|
-
*
|
|
2496
|
+
* 使用指定上下文执行生命周期步骤
|
|
2471
2497
|
*/
|
|
2472
|
-
private
|
|
2498
|
+
private executeLifecycleStepsWithContext;
|
|
2473
2499
|
private log;
|
|
2474
2500
|
}
|
|
2475
2501
|
|