@pactor-app/core 1.51.0 → 1.53.0

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 CHANGED
@@ -23,6 +23,7 @@ __export(index_exports, {
23
23
  RUNTIME_SCOPES: () => RUNTIME_SCOPES,
24
24
  Registry: () => Registry,
25
25
  createI18nContext: () => createI18nContext,
26
+ isDslFragmentPayload: () => isDslFragmentPayload,
26
27
  isDslSourceRef: () => isDslSourceRef,
27
28
  resolveRootNodes: () => resolveRootNodes
28
29
  });
@@ -47,6 +48,9 @@ function resolveRootNodes(pageDsl) {
47
48
  }
48
49
  return [];
49
50
  }
51
+ function isDslFragmentPayload(value) {
52
+ return typeof value === "object" && value !== null && !Array.isArray(value) && Array.isArray(value.children);
53
+ }
50
54
 
51
55
  // src/scope.ts
52
56
  var RUNTIME_SCOPES = [
@@ -146,6 +150,7 @@ function createI18nContext(options = {}) {
146
150
  RUNTIME_SCOPES,
147
151
  Registry,
148
152
  createI18nContext,
153
+ isDslFragmentPayload,
149
154
  isDslSourceRef,
150
155
  resolveRootNodes
151
156
  });
package/dist/index.d.cts CHANGED
@@ -213,6 +213,18 @@ interface FragmentDsl {
213
213
  };
214
214
  body: DslNode;
215
215
  }
216
+ /**
217
+ * 片段载荷:DslSourceRef 动态引用除裸 DslNode 数组外可返回的扩展形态——
218
+ * 除 `children` 子树外可携带 `dataSources` 与 `state`,由渲染边界在解析成功后
219
+ * 注册到当前页面运行时(数据源运行时注册、state 合并),卸载时注销其注册的数据源
220
+ */
221
+ interface DslFragmentPayload {
222
+ children: DslChildren;
223
+ dataSources?: Record<string, DataSourceConfig>;
224
+ state?: Record<string, unknown>;
225
+ }
226
+ /** DslFragmentPayload 类型守卫:记录形态且 `children` 为数组 */
227
+ declare function isDslFragmentPayload(value: unknown): value is DslFragmentPayload;
216
228
  /** Application DSL(第 9.1 节) */
217
229
  interface ApplicationDsl {
218
230
  dsl: DslVersion;
@@ -303,4 +315,4 @@ interface CreateI18nOptions {
303
315
  */
304
316
  declare function createI18nContext(options?: CreateI18nOptions): I18nContext;
305
317
 
306
- export { type ActionConfig, type ApplicationDsl, type ConditionConfig, type CreateI18nOptions, type DataSourceConfig, type DataSourceType, type DslChildren, type DslChildrenItem, type DslComponentNode, type DslNode, type DslNodeBase, type DslReferenceNode, type DslSourceRef, type DslVersion, type EventMap, type ExpressionString, type FragmentDsl, type I18nContext, type I18nMessages, type I18nParams, type LifecycleConfig, type LifecycleEventName, type Locale, type PageDsl, type PageMeta, type PermissionConfig, type PermissionDeniedStrategy, RUNTIME_SCOPES, Registry, type RequiresConfig, type RuntimeScope, createI18nContext, isDslSourceRef, resolveRootNodes };
318
+ export { type ActionConfig, type ApplicationDsl, type ConditionConfig, type CreateI18nOptions, type DataSourceConfig, type DataSourceType, type DslChildren, type DslChildrenItem, type DslComponentNode, type DslFragmentPayload, type DslNode, type DslNodeBase, type DslReferenceNode, type DslSourceRef, type DslVersion, type EventMap, type ExpressionString, type FragmentDsl, type I18nContext, type I18nMessages, type I18nParams, type LifecycleConfig, type LifecycleEventName, type Locale, type PageDsl, type PageMeta, type PermissionConfig, type PermissionDeniedStrategy, RUNTIME_SCOPES, Registry, type RequiresConfig, type RuntimeScope, createI18nContext, isDslFragmentPayload, isDslSourceRef, resolveRootNodes };
package/dist/index.d.ts CHANGED
@@ -213,6 +213,18 @@ interface FragmentDsl {
213
213
  };
214
214
  body: DslNode;
215
215
  }
216
+ /**
217
+ * 片段载荷:DslSourceRef 动态引用除裸 DslNode 数组外可返回的扩展形态——
218
+ * 除 `children` 子树外可携带 `dataSources` 与 `state`,由渲染边界在解析成功后
219
+ * 注册到当前页面运行时(数据源运行时注册、state 合并),卸载时注销其注册的数据源
220
+ */
221
+ interface DslFragmentPayload {
222
+ children: DslChildren;
223
+ dataSources?: Record<string, DataSourceConfig>;
224
+ state?: Record<string, unknown>;
225
+ }
226
+ /** DslFragmentPayload 类型守卫:记录形态且 `children` 为数组 */
227
+ declare function isDslFragmentPayload(value: unknown): value is DslFragmentPayload;
216
228
  /** Application DSL(第 9.1 节) */
217
229
  interface ApplicationDsl {
218
230
  dsl: DslVersion;
@@ -303,4 +315,4 @@ interface CreateI18nOptions {
303
315
  */
304
316
  declare function createI18nContext(options?: CreateI18nOptions): I18nContext;
305
317
 
306
- export { type ActionConfig, type ApplicationDsl, type ConditionConfig, type CreateI18nOptions, type DataSourceConfig, type DataSourceType, type DslChildren, type DslChildrenItem, type DslComponentNode, type DslNode, type DslNodeBase, type DslReferenceNode, type DslSourceRef, type DslVersion, type EventMap, type ExpressionString, type FragmentDsl, type I18nContext, type I18nMessages, type I18nParams, type LifecycleConfig, type LifecycleEventName, type Locale, type PageDsl, type PageMeta, type PermissionConfig, type PermissionDeniedStrategy, RUNTIME_SCOPES, Registry, type RequiresConfig, type RuntimeScope, createI18nContext, isDslSourceRef, resolveRootNodes };
318
+ export { type ActionConfig, type ApplicationDsl, type ConditionConfig, type CreateI18nOptions, type DataSourceConfig, type DataSourceType, type DslChildren, type DslChildrenItem, type DslComponentNode, type DslFragmentPayload, type DslNode, type DslNodeBase, type DslReferenceNode, type DslSourceRef, type DslVersion, type EventMap, type ExpressionString, type FragmentDsl, type I18nContext, type I18nMessages, type I18nParams, type LifecycleConfig, type LifecycleEventName, type Locale, type PageDsl, type PageMeta, type PermissionConfig, type PermissionDeniedStrategy, RUNTIME_SCOPES, Registry, type RequiresConfig, type RuntimeScope, createI18nContext, isDslFragmentPayload, isDslSourceRef, resolveRootNodes };
package/dist/index.js CHANGED
@@ -17,6 +17,9 @@ function resolveRootNodes(pageDsl) {
17
17
  }
18
18
  return [];
19
19
  }
20
+ function isDslFragmentPayload(value) {
21
+ return typeof value === "object" && value !== null && !Array.isArray(value) && Array.isArray(value.children);
22
+ }
20
23
 
21
24
  // src/scope.ts
22
25
  var RUNTIME_SCOPES = [
@@ -115,6 +118,7 @@ export {
115
118
  RUNTIME_SCOPES,
116
119
  Registry,
117
120
  createI18nContext,
121
+ isDslFragmentPayload,
118
122
  isDslSourceRef,
119
123
  resolveRootNodes
120
124
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pactor-app/core",
3
- "version": "1.51.0",
3
+ "version": "1.53.0",
4
4
  "description": "Pactor core: DSL protocol types and generic Registry (React-free, zero dependencies)",
5
5
  "keywords": [
6
6
  "pactor",