cdp-material-sdk 0.0.10 → 0.1.1

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.
@@ -19,4 +19,5 @@ export declare const ENGINE_EVENT_TYPE: {
19
19
  readonly ITEM_RIGHT_CLICK: "itemRightClick";
20
20
  readonly ITEM_LONG_PRESS: "itemLongPress";
21
21
  readonly DATA_FETCH: "dataFetch";
22
+ readonly OPTIONS_FETCH: "optionsFetch";
22
23
  };
package/dist/index.js CHANGED
@@ -1,43 +1,44 @@
1
- import { C as e, a as t, b as n, c as i, D as o, E, I as T, d as _, L as O, e as N, f as R, N as r, g as A, O as C, h as l, R as S, S as u, i as D, j as d, k as m, l as I, m as P, n as p, o as Y, p as M, q as g, u as c, r as L, v as G, s as v } from "./validateManifest-CYqjvQe_.js";
2
- import { D as K, a as h, b as x, P as V, r as y, s as F, u as b, c as k, d as z } from "./useFieldRegistry-CwjlA-ja.js";
1
+ import { C as e, a as t, b as n, c as i, D as E, d as o, E as T, F as _, I as O, e as N, L as A, f as R, g as r, N as C, h as D, O as l, i as u, S as I, j as S, k as d, l as P, m as L, n as Y, o as m, p, q as M, r as g, u as c, s as G, v, t as K } from "./validateManifest-ZPFDq790.js";
2
+ import { D as f, a as x, b as V, P as h, r as y, s as b, u as k, c as z, d as H } from "./useFieldRegistry-CwjlA-ja.js";
3
3
  export {
4
4
  e as CATEGORY_LABELS,
5
5
  t as COMPONENT_CATEGORY,
6
6
  n as COMPONENT_STATE_KEY,
7
7
  i as COMPONENT_TRAIT,
8
+ E as DATA_FIELD_ROLE,
8
9
  o as DYNAMIC_ENUM_KEY,
9
- K as DataContainerRuntimeContext,
10
- h as DataScope,
11
- x as DataScopeContext,
12
- E as ENGINE_EVENT_TYPE,
13
- T as INJECT_PATH_ROOT,
14
- _ as INJECT_PATH_SLOT_PROPS,
15
- O as LOADING_PROP_NAME,
16
- N as LOADING_STRATEGY,
17
- R as LOADING_WRAPPER_TYPE,
18
- r as NOTIFY_ERROR_STRATEGY,
19
- A as NOTIFY_TIMING,
20
- C as OptionItemSchema,
21
- l as OptionsSchema,
22
- V as PageContext,
23
- S as RemoteOptionConfigSchema,
24
- u as SLOT_KEY,
25
- D as STANDARD_EVENT_KEYS,
10
+ f as DataContainerRuntimeContext,
11
+ x as DataScope,
12
+ V as DataScopeContext,
13
+ T as ENGINE_EVENT_TYPE,
14
+ _ as FIELD_ROLE_KEY,
15
+ O as INJECT_PATH_ROOT,
16
+ N as INJECT_PATH_SLOT_PROPS,
17
+ A as LOADING_PROP_NAME,
18
+ R as LOADING_STRATEGY,
19
+ r as LOADING_WRAPPER_TYPE,
20
+ C as NOTIFY_ERROR_STRATEGY,
21
+ D as NOTIFY_TIMING,
22
+ l as OptionItemSchema,
23
+ u as OptionsSchema,
24
+ h as PageContext,
25
+ I as SLOT_KEY,
26
+ S as STANDARD_EVENT_KEYS,
26
27
  d as diagnoseMissingActionImpls,
27
- m as diagnoseMissingStateKeys,
28
- I as isCustomEventKey,
29
- P as isStandardEventKey,
30
- p as normalizeAdapterEvents,
31
- Y as normalizeManifestEvents,
28
+ P as diagnoseMissingStateKeys,
29
+ L as isCustomEventKey,
30
+ Y as isStandardEventKey,
31
+ m as normalizeAdapterEvents,
32
+ p as normalizeManifestEvents,
32
33
  M as printSingleValidationResult,
33
34
  g as printValidationResult,
34
35
  y as resolveDataContainerRuntimeValue,
35
- F as shouldUseDataContainerRuntimeFallback,
36
+ b as shouldUseDataContainerRuntimeFallback,
36
37
  c as useConcurrentLoading,
37
- b as useDataContainer,
38
- k as useDataContainerApi,
39
- L as useDualLoading,
40
- z as useFieldRegistry,
41
- G as validateManifest,
42
- v as validateManifests
38
+ k as useDataContainer,
39
+ z as useDataContainerApi,
40
+ G as useDualLoading,
41
+ H as useFieldRegistry,
42
+ v as validateManifest,
43
+ K as validateManifests
43
44
  };
package/dist/portable.js CHANGED
@@ -1,33 +1,34 @@
1
- import { C as e, a as E, b as i, c as n, D as t, E as T, I as _, d as O, L as N, e as o, f as A, N as R, g as S, O as I, h as P, R as Y, S as d, i as l, j as C, k as M, l as m, m as r, n as L, o as g, p, q as G, u, r as D, v, s as K } from "./validateManifest-CYqjvQe_.js";
1
+ import { C as E, a as e, b as T, c as _, D as i, d as n, E as t, F as O, I as N, e as A, L as R, f as I, g as o, N as S, h as L, O as Y, i as P, S as d, j as l, k as M, l as r, m as C, n as D, o as m, p as G, q as g, r as p, u, s as K, v, t as c } from "./validateManifest-ZPFDq790.js";
2
2
  export {
3
- e as CATEGORY_LABELS,
4
- E as COMPONENT_CATEGORY,
5
- i as COMPONENT_STATE_KEY,
6
- n as COMPONENT_TRAIT,
7
- t as DYNAMIC_ENUM_KEY,
8
- T as ENGINE_EVENT_TYPE,
9
- _ as INJECT_PATH_ROOT,
10
- O as INJECT_PATH_SLOT_PROPS,
11
- N as LOADING_PROP_NAME,
12
- o as LOADING_STRATEGY,
13
- A as LOADING_WRAPPER_TYPE,
14
- R as NOTIFY_ERROR_STRATEGY,
15
- S as NOTIFY_TIMING,
16
- I as OptionItemSchema,
3
+ E as CATEGORY_LABELS,
4
+ e as COMPONENT_CATEGORY,
5
+ T as COMPONENT_STATE_KEY,
6
+ _ as COMPONENT_TRAIT,
7
+ i as DATA_FIELD_ROLE,
8
+ n as DYNAMIC_ENUM_KEY,
9
+ t as ENGINE_EVENT_TYPE,
10
+ O as FIELD_ROLE_KEY,
11
+ N as INJECT_PATH_ROOT,
12
+ A as INJECT_PATH_SLOT_PROPS,
13
+ R as LOADING_PROP_NAME,
14
+ I as LOADING_STRATEGY,
15
+ o as LOADING_WRAPPER_TYPE,
16
+ S as NOTIFY_ERROR_STRATEGY,
17
+ L as NOTIFY_TIMING,
18
+ Y as OptionItemSchema,
17
19
  P as OptionsSchema,
18
- Y as RemoteOptionConfigSchema,
19
20
  d as SLOT_KEY,
20
21
  l as STANDARD_EVENT_KEYS,
21
- C as diagnoseMissingActionImpls,
22
- M as diagnoseMissingStateKeys,
23
- m as isCustomEventKey,
24
- r as isStandardEventKey,
25
- L as normalizeAdapterEvents,
26
- g as normalizeManifestEvents,
27
- p as printSingleValidationResult,
28
- G as printValidationResult,
22
+ M as diagnoseMissingActionImpls,
23
+ r as diagnoseMissingStateKeys,
24
+ C as isCustomEventKey,
25
+ D as isStandardEventKey,
26
+ m as normalizeAdapterEvents,
27
+ G as normalizeManifestEvents,
28
+ g as printSingleValidationResult,
29
+ p as printValidationResult,
29
30
  u as useConcurrentLoading,
30
- D as useDualLoading,
31
+ K as useDualLoading,
31
32
  v as validateManifest,
32
- K as validateManifests
33
+ c as validateManifests
33
34
  };
@@ -37,28 +37,5 @@ export declare const OptionsSchema: {
37
37
  };
38
38
  };
39
39
  };
40
- export declare const RemoteOptionConfigSchema: {
41
- readonly type: "object";
42
- readonly title: "远程选项配置";
43
- readonly properties: {
44
- readonly panelCode: {
45
- readonly type: "string";
46
- readonly title: "面板代码";
47
- };
48
- readonly fieldName: {
49
- readonly type: "string";
50
- readonly title: "字段名称";
51
- };
52
- readonly condition: {
53
- readonly type: "object";
54
- readonly title: "查询条件";
55
- readonly description: "声明式查询条件,支持表达式绑定。";
56
- readonly additionalProperties: {
57
- readonly type: "string";
58
- };
59
- };
60
- };
61
- };
62
40
  export type OptionItem = FromSchema<typeof OptionItemSchema>;
63
41
  export type Options = FromSchema<typeof OptionsSchema>;
64
- export type RemoteOptionConfig = FromSchema<typeof RemoteOptionConfigSchema>;
@@ -33,6 +33,18 @@ export interface EngineEventProtocol {
33
33
  pageSize?: number;
34
34
  orderBy?: Array<Record<string, unknown>>;
35
35
  advancedConditions?: Record<string, unknown>;
36
+ };
37
+ [ENGINE_EVENT_TYPE.OPTIONS_FETCH]: {
38
+ panelCode: string;
39
+ fieldName: string;
40
+ condition?: Record<string, any>;
41
+ keyword?: string;
42
+ extraFieldNames?: string[];
43
+ /**
44
+ * @deprecated 历史字段,等价于 `{ fieldName }`。早期此事件挂在 DATA_FETCH 下,
45
+ * 老的事件指令脚本可能从 payload.fieldInfo.fieldName 取值。
46
+ * 运行时会与 `fieldName` 一并发送以保证向后兼容,新代码请直接读取顶层 `fieldName`。
47
+ */
36
48
  fieldInfo?: {
37
49
  fieldName: string;
38
50
  };
@@ -8,6 +8,14 @@ export declare const SLOT_KEY = "x-slot";
8
8
  export declare const INJECT_PATH_ROOT = "$root";
9
9
  /** useImperativeHandle 中用于暴露组件运行时状态的保留 key */
10
10
  export declare const COMPONENT_STATE_KEY: "__state";
11
+ export declare const FIELD_ROLE_KEY = "x-fieldRole";
12
+ export declare const DATA_FIELD_ROLE: {
13
+ readonly ATTRIBUTE: "attribute";
14
+ readonly DIMENSION: "dimension";
15
+ readonly MEASURE: "measure";
16
+ };
17
+ export type DataFieldRole = typeof DATA_FIELD_ROLE[keyof typeof DATA_FIELD_ROLE];
18
+ export type DataSourceFieldRoleFilter = typeof DATA_FIELD_ROLE.DIMENSION | typeof DATA_FIELD_ROLE.MEASURE;
11
19
  export interface DynamicEnumConfig {
12
20
  source: string;
13
21
  valueKey: string;
@@ -22,6 +30,7 @@ export interface ExtendedJSONSchema7 extends JSONSchema7 {
22
30
  label: string;
23
31
  }>;
24
32
  placeholder?: string;
33
+ [FIELD_ROLE_KEY]?: DataSourceFieldRoleFilter;
25
34
  }
26
35
  export interface StandardEventDeclaration {
27
36
  title?: string;
@@ -1,16 +1,16 @@
1
- import { useState as m, useRef as A, useEffect as h, useCallback as u, useMemo as g } from "react";
2
- const S = () => {
3
- const [t, e] = m(0), [o, n] = m(void 0), c = A(0);
1
+ import { useState as m, useRef as g, useEffect as h, useCallback as E, useMemo as T } from "react";
2
+ const _ = () => {
3
+ const [t, e] = m(0), [o, n] = m(void 0), c = g(0);
4
4
  h(() => {
5
5
  c.current = t;
6
6
  }, [t]);
7
- const a = u(() => c.current > 0, []), s = u((l) => (e((y) => y + 1), l && n(l), a()), [a]), p = u(() => (e((l) => {
8
- const y = Math.max(0, l - 1);
9
- return y === 0 && n(void 0), y;
10
- }), a()), [a]), r = u(() => {
7
+ const a = E(() => c.current > 0, []), s = E((l) => (e((u) => u + 1), l && n(l), a()), [a]), p = E(() => (e((l) => {
8
+ const u = Math.max(0, l - 1);
9
+ return u === 0 && n(void 0), u;
10
+ }), a()), [a]), r = E(() => {
11
11
  e(0), n(void 0);
12
12
  }, []);
13
- return g(() => ({
13
+ return T(() => ({
14
14
  isLoading: t > 0,
15
15
  loadingText: o,
16
16
  startLoading: s,
@@ -18,7 +18,7 @@ const S = () => {
18
18
  getLoading: a,
19
19
  resetLoading: r
20
20
  }), [a, t, o, r, s, p]);
21
- }, V = () => {
21
+ }, x = () => {
22
22
  const {
23
23
  isLoading: t,
24
24
  loadingText: e,
@@ -26,10 +26,10 @@ const S = () => {
26
26
  stopLoading: n,
27
27
  getLoading: c,
28
28
  resetLoading: a
29
- } = S(), [s, p] = m(!1), r = g(() => t || s, [t, s]), l = A(!1);
29
+ } = _(), [s, p] = m(!1), r = T(() => t || s, [t, s]), l = g(!1);
30
30
  return h(() => {
31
31
  l.current = r;
32
- }, [r]), g(() => ({
32
+ }, [r]), T(() => ({
33
33
  actionLoading: t,
34
34
  actionLoadingText: e,
35
35
  startActionLoading: o,
@@ -51,7 +51,7 @@ const S = () => {
51
51
  n
52
52
  ]);
53
53
  };
54
- function O(t) {
54
+ function N(t) {
55
55
  if (!t)
56
56
  return [];
57
57
  const e = [];
@@ -62,7 +62,7 @@ function O(t) {
62
62
  });
63
63
  return e;
64
64
  }
65
- function _(t) {
65
+ function S(t) {
66
66
  if (!t)
67
67
  return [];
68
68
  const e = [];
@@ -74,7 +74,7 @@ function _(t) {
74
74
  return e;
75
75
  }
76
76
  function v(t) {
77
- const e = O(t?.events), o = _(t?.customEvents);
77
+ const e = N(t?.events), o = S(t?.customEvents);
78
78
  return {
79
79
  standard: e,
80
80
  custom: o,
@@ -89,28 +89,15 @@ const $ = {
89
89
  value: { type: "string", title: "选项值" },
90
90
  disabled: { type: "boolean", title: "是否禁用" }
91
91
  }
92
- }, x = {
92
+ }, V = {
93
93
  type: "array",
94
94
  title: "选项列表",
95
95
  items: $
96
96
  }, J = {
97
- type: "object",
98
- title: "远程选项配置",
99
- properties: {
100
- panelCode: { type: "string", title: "面板代码" },
101
- fieldName: { type: "string", title: "字段名称" },
102
- condition: {
103
- type: "object",
104
- title: "查询条件",
105
- description: "声明式查询条件,支持表达式绑定。",
106
- additionalProperties: { type: "string" }
107
- }
108
- }
109
- }, W = {
110
97
  BEFORE: "before",
111
98
  AFTER: "after",
112
99
  BOTH: "both"
113
- }, q = {
100
+ }, W = {
114
101
  IGNORE: "ignore",
115
102
  STOP: "stop"
116
103
  }, C = {
@@ -124,16 +111,21 @@ const $ = {
124
111
  ITEM_DOUBLE_CLICK: "itemDoubleClick",
125
112
  ITEM_RIGHT_CLICK: "itemRightClick",
126
113
  ITEM_LONG_PRESS: "itemLongPress",
127
- DATA_FETCH: "dataFetch"
114
+ DATA_FETCH: "dataFetch",
115
+ OPTIONS_FETCH: "optionsFetch"
128
116
  }, I = Object.values(C), L = new Set(I), R = /^[^:\s]+:[^:\s]+$/;
129
117
  function f(t) {
130
118
  return L.has(t);
131
119
  }
132
- function E(t) {
120
+ function y(t) {
133
121
  return R.test(t) && !L.has(t);
134
122
  }
135
- const Q = "x-dynamic-enum", X = "x-slot", P = "$root", Z = "__state";
136
- function D(t) {
123
+ const q = "x-dynamic-enum", Q = "x-slot", D = "$root", X = "__state", Z = "x-fieldRole", tt = {
124
+ ATTRIBUTE: "attribute",
125
+ DIMENSION: "dimension",
126
+ MEASURE: "measure"
127
+ };
128
+ function P(t) {
137
129
  if (!t)
138
130
  return [];
139
131
  const e = [];
@@ -156,7 +148,7 @@ function M(t) {
156
148
  return e;
157
149
  }
158
150
  function w(t) {
159
- const e = D(t?.events), o = M(t?.customEvents);
151
+ const e = P(t?.events), o = M(t?.customEvents);
160
152
  return {
161
153
  standard: e,
162
154
  custom: o,
@@ -164,15 +156,15 @@ function w(t) {
164
156
  allKeys: [...e.map((n) => n.type), ...o.map((n) => n.type)]
165
157
  };
166
158
  }
167
- const tt = {
159
+ const et = {
168
160
  NATIVE: "native",
169
161
  WRAPPER: "wrapper",
170
162
  NONE: "none"
171
- }, et = {
163
+ }, nt = {
172
164
  SPIN: "spin",
173
165
  SKELETON: "skeleton",
174
166
  WAVE: "wave"
175
- }, nt = "loading", T = {
167
+ }, ot = "loading", A = {
176
168
  DATA_FIELD: "Data.Field",
177
169
  DATA_CONTAINER: "Data.Container",
178
170
  LAYOUT_CONTAINER: "Layout.Container",
@@ -189,7 +181,7 @@ const tt = {
189
181
  PAGE: "Page",
190
182
  DEV: "Dev",
191
183
  HTML_TEMPLATE: "HtmlTemplate"
192
- }, ot = {
184
+ }, at = {
193
185
  [d.GENERAL]: "通用",
194
186
  [d.FLOAT]: "悬浮",
195
187
  [d.LAYOUT]: "布局",
@@ -201,17 +193,17 @@ const tt = {
201
193
  [d.PAGE]: "页面",
202
194
  [d.DEV]: "调试",
203
195
  [d.HTML_TEMPLATE]: "HTML 模板"
204
- }, b = "slotProps.root", Y = [T.DATA_FIELD, T.DATA_CONTAINER], j = [P, b], N = ["string", "number", "boolean", "array", "object", "integer", "null"];
196
+ }, b = "slotProps.root", Y = [A.DATA_FIELD, A.DATA_CONTAINER], K = [D, b], O = ["string", "number", "boolean", "array", "object", "integer", "null"];
205
197
  function i(t, e, o, n, c) {
206
198
  t.push({ type: e, field: o, message: n, severity: c });
207
199
  }
208
- function K(t, e, o) {
200
+ function F(t, e, o) {
209
201
  const n = t.type;
210
202
  if (!t.meta)
211
203
  return i(e, n, "meta", "meta 字段是必填的", "error"), !1;
212
204
  if (t.meta.title || i(e, n, "meta.title", "title 是必填的", "error"), t.meta.category ? Object.values(d).includes(t.meta.category) || i(e, n, "meta.category", `无效的 category: ${t.meta.category}`, "error") : i(e, n, "meta.category", "category 是必填的", "error"), t.meta.valueSchema) {
213
205
  const a = t.meta.valueSchema.type;
214
- a && typeof a == "string" && !N.includes(a) && i(e, n, "meta.valueSchema.type", `无效的 valueSchema type: ${a}`, "error");
206
+ a && typeof a == "string" && !O.includes(a) && i(e, n, "meta.valueSchema.type", `无效的 valueSchema type: ${a}`, "error");
215
207
  }
216
208
  return t.traits?.some((a) => Y.includes(a)) && !t.meta.valueSchema && i(
217
209
  o,
@@ -221,30 +213,30 @@ function K(t, e, o) {
221
213
  "warning"
222
214
  ), !0;
223
215
  }
224
- function G(t, e, o) {
216
+ function j(t, e, o) {
225
217
  const n = t.type, c = w(t), a = new Set(c.standard.map((p) => p.type)), s = new Set(c.custom.map((p) => p.type));
226
218
  if (c.all.length > 0 && (c.standard.forEach((p, r) => {
227
219
  p.type || i(e, n, `events[${r}].type`, "事件类型不能为空", "error"), p.type && !f(p.type) && i(e, n, `events[${r}].type`, `标准事件类型必须属于 EngineEventProtocol: ${p.type}`, "error");
228
220
  }), c.custom.forEach((p) => {
229
- p.type || i(e, n, "customEvents.type", "自定义事件类型不能为空", "error"), p.type && !E(p.type) && i(e, n, `customEvents.${p.type}`, `自定义事件类型必须是 namespaced 形态: ${p.type}`, "error"), p.payloadSchema || i(e, n, `customEvents.${p.type}.payloadSchema`, "自定义事件必须声明 payloadSchema", "error");
221
+ p.type || i(e, n, "customEvents.type", "自定义事件类型不能为空", "error"), p.type && !y(p.type) && i(e, n, `customEvents.${p.type}`, `自定义事件类型必须是 namespaced 形态: ${p.type}`, "error"), p.payloadSchema || i(e, n, `customEvents.${p.type}.payloadSchema`, "自定义事件必须声明 payloadSchema", "error");
230
222
  })), t.adapter) {
231
223
  const p = v(t.adapter);
232
224
  p.standard.forEach((r, l) => {
233
225
  r.type || i(e, n, `adapter.events[${l}].type`, "Adapter 事件类型不能为空", "error"), r.type && !f(r.type) && i(e, n, `adapter.events[${l}].type`, `Adapter 标准事件类型必须属于 EngineEventProtocol: ${r.type}`, "error"), r.type && f(r.type) && !a.has(r.type) && i(e, n, `adapter.events[${l}].type`, `Adapter 标准事件必须先在 manifest.events 中声明: ${r.type}`, "error"), r.propName || i(e, n, `adapter.events[${l}].propName`, "Adapter propName 不能为空", "error");
234
226
  }), p.custom.forEach((r) => {
235
- r.type || i(e, n, "adapter.customEvents.type", "Adapter 自定义事件类型不能为空", "error"), r.type && !E(r.type) && i(e, n, `adapter.customEvents.${r.type}`, `Adapter 自定义事件类型必须是 namespaced 形态: ${r.type}`, "error"), r.type && E(r.type) && !s.has(r.type) && i(e, n, `adapter.customEvents.${r.type}`, `Adapter 自定义事件必须先在 manifest.customEvents 中声明: ${r.type}`, "error"), r.propName || i(e, n, `adapter.customEvents.${r.type}.propName`, "Adapter customEvents propName 不能为空", "error");
227
+ r.type || i(e, n, "adapter.customEvents.type", "Adapter 自定义事件类型不能为空", "error"), r.type && !y(r.type) && i(e, n, `adapter.customEvents.${r.type}`, `Adapter 自定义事件类型必须是 namespaced 形态: ${r.type}`, "error"), r.type && y(r.type) && !s.has(r.type) && i(e, n, `adapter.customEvents.${r.type}`, `Adapter 自定义事件必须先在 manifest.customEvents 中声明: ${r.type}`, "error"), r.propName || i(e, n, `adapter.customEvents.${r.type}.propName`, "Adapter customEvents propName 不能为空", "error");
236
228
  });
237
229
  }
238
230
  }
239
- function H(t, e, o) {
231
+ function G(t, e, o) {
240
232
  const n = t.type, c = t.actions;
241
233
  if (c)
242
234
  for (const [a, s] of Object.entries(c))
243
235
  s && (s.title || i(e, n, `actions.${a}.title`, `动作 "${a}" 缺少 title`, "error"), s.returns || i(o, n, `actions.${a}.returns`, `动作 "${a}" 未声明 returns schema,建议补充`, "warning"), s.params && s.params.type !== "object" && i(e, n, `actions.${a}.params.type`, '动作参数 schema 的 type 必须为 "object"', "error"));
244
236
  }
245
- function U(t, e, o) {
237
+ function H(t, e, o) {
246
238
  const n = t.type, c = t.engine?.render?.injection?.rootPath;
247
- c ? typeof c == "string" && !j.includes(c) && i(
239
+ c ? typeof c == "string" && !K.includes(c) && i(
248
240
  o,
249
241
  n,
250
242
  "engine.render.injection.rootPath",
@@ -258,7 +250,7 @@ function U(t, e, o) {
258
250
  "warning"
259
251
  );
260
252
  }
261
- function k(t, e, o) {
253
+ function U(t, e, o) {
262
254
  const n = t.type, c = t.slots;
263
255
  if (c)
264
256
  for (const [a, s] of Object.entries(c))
@@ -270,21 +262,21 @@ function k(t, e, o) {
270
262
  "warning"
271
263
  ), s.allowedChildren !== void 0 && !Array.isArray(s.allowedChildren) && i(e, n, `slots.${a}.allowedChildren`, `插槽 "${a}" 的 allowedChildren 必须是字符串数组`, "error"));
272
264
  }
273
- function F(t, e, o) {
265
+ function k(t, e, o) {
274
266
  const n = t.type, c = t.state;
275
267
  if (c)
276
268
  for (const [a, s] of Object.entries(c))
277
- s && (s.title || i(e, n, `state.${a}.title`, `状态 "${a}" 缺少 title`, "error"), s.schema ? s.schema.type && typeof s.schema.type == "string" && !N.includes(s.schema.type) && i(e, n, `state.${a}.schema.type`, `状态 "${a}" 的 schema.type 无效: ${s.schema.type}`, "error") : i(e, n, `state.${a}.schema`, `状态 "${a}" 缺少 schema`, "error"));
269
+ s && (s.title || i(e, n, `state.${a}.title`, `状态 "${a}" 缺少 title`, "error"), s.schema ? s.schema.type && typeof s.schema.type == "string" && !O.includes(s.schema.type) && i(e, n, `state.${a}.schema.type`, `状态 "${a}" 的 schema.type 无效: ${s.schema.type}`, "error") : i(e, n, `state.${a}.schema`, `状态 "${a}" 缺少 schema`, "error"));
278
270
  }
279
271
  function z(t) {
280
272
  const e = [], o = [];
281
- return t.type || i(e, t.type || "Unknown", "type", "type 字段是必填的", "error"), K(t, e, o) ? (G(t, e), H(t, e, o), F(t, e), k(t, e, o), U(t, e, o), {
273
+ return t.type || i(e, t.type || "Unknown", "type", "type 字段是必填的", "error"), F(t, e, o) ? (j(t, e), G(t, e, o), k(t, e), U(t, e, o), H(t, e, o), {
282
274
  valid: e.length === 0,
283
275
  errors: e,
284
276
  warnings: o
285
277
  }) : { valid: !1, errors: e, warnings: o };
286
278
  }
287
- function at(t) {
279
+ function st(t) {
288
280
  const e = [], o = [];
289
281
  for (const n of t) {
290
282
  const c = z(n);
@@ -296,13 +288,13 @@ function at(t) {
296
288
  warnings: o
297
289
  };
298
290
  }
299
- function st(t, e) {
291
+ function rt(t, e) {
300
292
  return !t || !e ? [] : t.filter((o) => typeof e[o] != "function");
301
293
  }
302
- function rt(t, e) {
294
+ function it(t, e) {
303
295
  return !t?.state || !e ? [] : Object.keys(t.state).filter((o) => !(o in e));
304
296
  }
305
- function it(t) {
297
+ function ct(t) {
306
298
  t.valid ? console.log("✅ 所有 Manifest 验证通过") : console.error(`❌ 发现 ${t.errors.length} 个错误`), t.errors.length > 0 && (console.error(`
307
299
  错误列表:`), t.errors.forEach((e) => {
308
300
  console.error(` ❌ [${e.type}] ${e.field}: ${e.message}`);
@@ -311,7 +303,7 @@ function it(t) {
311
303
  console.warn(` ⚠️ [${e.type}] ${e.field}: ${e.message}`);
312
304
  }));
313
305
  }
314
- function ct(t, e = "[Registry]") {
306
+ function pt(t, e = "[Registry]") {
315
307
  if (!t.valid && t.errors.length > 0) {
316
308
  const o = t.errors[0]?.type || "Unknown";
317
309
  console.error(`${e} ❌ Manifest validation failed for '${o}':`), t.errors.forEach((n) => console.error(` - ${n.field}: ${n.message}`));
@@ -322,34 +314,35 @@ function ct(t, e = "[Registry]") {
322
314
  }
323
315
  }
324
316
  export {
325
- ot as C,
326
- Q as D,
317
+ at as C,
318
+ tt as D,
327
319
  C as E,
328
- P as I,
329
- nt as L,
330
- q as N,
320
+ Z as F,
321
+ D as I,
322
+ ot as L,
323
+ W as N,
331
324
  $ as O,
332
- J as R,
333
- X as S,
325
+ Q as S,
334
326
  d as a,
335
- Z as b,
336
- T as c,
337
- b as d,
338
- tt as e,
327
+ X as b,
328
+ A as c,
329
+ q as d,
330
+ b as e,
339
331
  et as f,
340
- W as g,
341
- x as h,
342
- I as i,
343
- st as j,
332
+ nt as g,
333
+ J as h,
334
+ V as i,
335
+ I as j,
344
336
  rt as k,
345
- E as l,
346
- f as m,
347
- v as n,
348
- w as o,
349
- ct as p,
350
- it as q,
351
- V as r,
352
- at as s,
353
- S as u,
337
+ it as l,
338
+ y as m,
339
+ f as n,
340
+ v as o,
341
+ w as p,
342
+ pt as q,
343
+ ct as r,
344
+ x as s,
345
+ st as t,
346
+ _ as u,
354
347
  z as v
355
348
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cdp-material-sdk",
3
- "version": "0.0.10",
3
+ "version": "0.1.1",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public",