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.
- package/dist/constants/event.d.ts +1 -0
- package/dist/index.js +32 -31
- package/dist/portable.js +27 -26
- package/dist/protocol/common-schemas.d.ts +0 -23
- package/dist/protocol/events.d.ts +12 -0
- package/dist/protocol/manifest.d.ts +9 -0
- package/dist/{validateManifest-CYqjvQe_.js → validateManifest-ZPFDq790.js} +73 -80
- package/package.json +1 -1
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
|
|
2
|
-
import { D as
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
R as
|
|
18
|
-
r as
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
l as
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
36
|
+
b as shouldUseDataContainerRuntimeFallback,
|
|
36
37
|
c as useConcurrentLoading,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
O as
|
|
11
|
-
N as
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
31
|
+
K as useDualLoading,
|
|
31
32
|
v as validateManifest,
|
|
32
|
-
|
|
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
|
|
2
|
-
const
|
|
3
|
-
const [t, e] = m(0), [o, n] = m(void 0), c =
|
|
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 =
|
|
8
|
-
const
|
|
9
|
-
return
|
|
10
|
-
}), a()), [a]), r =
|
|
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
|
|
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
|
-
},
|
|
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
|
-
} =
|
|
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]),
|
|
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
|
|
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
|
|
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 =
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
|
120
|
+
function y(t) {
|
|
133
121
|
return R.test(t) && !L.has(t);
|
|
134
122
|
}
|
|
135
|
-
const
|
|
136
|
-
|
|
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 =
|
|
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
|
|
159
|
+
const et = {
|
|
168
160
|
NATIVE: "native",
|
|
169
161
|
WRAPPER: "wrapper",
|
|
170
162
|
NONE: "none"
|
|
171
|
-
},
|
|
163
|
+
}, nt = {
|
|
172
164
|
SPIN: "spin",
|
|
173
165
|
SKELETON: "skeleton",
|
|
174
166
|
WAVE: "wave"
|
|
175
|
-
},
|
|
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
|
-
},
|
|
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 = [
|
|
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
|
|
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" && !
|
|
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
|
|
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 && !
|
|
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 && !
|
|
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
|
|
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
|
|
237
|
+
function H(t, e, o) {
|
|
246
238
|
const n = t.type, c = t.engine?.render?.injection?.rootPath;
|
|
247
|
-
c ? typeof c == "string" && !
|
|
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
|
|
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
|
|
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" && !
|
|
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"),
|
|
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
|
|
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
|
|
291
|
+
function rt(t, e) {
|
|
300
292
|
return !t || !e ? [] : t.filter((o) => typeof e[o] != "function");
|
|
301
293
|
}
|
|
302
|
-
function
|
|
294
|
+
function it(t, e) {
|
|
303
295
|
return !t?.state || !e ? [] : Object.keys(t.state).filter((o) => !(o in e));
|
|
304
296
|
}
|
|
305
|
-
function
|
|
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
|
|
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
|
-
|
|
326
|
-
|
|
317
|
+
at as C,
|
|
318
|
+
tt as D,
|
|
327
319
|
C as E,
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
320
|
+
Z as F,
|
|
321
|
+
D as I,
|
|
322
|
+
ot as L,
|
|
323
|
+
W as N,
|
|
331
324
|
$ as O,
|
|
332
|
-
|
|
333
|
-
X as S,
|
|
325
|
+
Q as S,
|
|
334
326
|
d as a,
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
327
|
+
X as b,
|
|
328
|
+
A as c,
|
|
329
|
+
q as d,
|
|
330
|
+
b as e,
|
|
339
331
|
et as f,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
332
|
+
nt as g,
|
|
333
|
+
J as h,
|
|
334
|
+
V as i,
|
|
335
|
+
I as j,
|
|
344
336
|
rt as k,
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
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
|
};
|