base-screen 0.3.0 → 0.4.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/_internal/contracts/document/schema.d.ts +7 -0
- package/dist/_internal/contracts/document/schema.js +1 -1
- package/dist/_internal/contracts/document/validate-value-ref.js +6 -1
- package/dist/_internal/contracts/screen-document.schema.json +15 -3
- package/dist/_internal/contracts/types/diagnostics.d.ts +1 -1
- package/dist/_internal/contracts/types/document.d.ts +3 -1
- package/dist/_internal/core/blueprint/runtime-simulate.d.ts +57 -0
- package/dist/_internal/core/blueprint/runtime-simulate.js +177 -0
- package/dist/_internal/core/blueprint/runtime.d.ts +1 -0
- package/dist/_internal/core/blueprint/runtime.js +1 -0
- package/dist/_internal/core/commands/apply-collection-commands.d.ts +32 -0
- package/dist/_internal/core/commands/apply-collection-commands.js +174 -0
- package/dist/_internal/core/commands/apply.js +13 -0
- package/dist/_internal/core/commands/parse-command.js +12 -0
- package/dist/_internal/core/commands/types.d.ts +29 -1
- package/dist/_internal/core/data/data-candidates.d.ts +38 -0
- package/dist/_internal/core/data/data-candidates.js +186 -0
- package/dist/_internal/core/data/dataset-profile.d.ts +71 -0
- package/dist/_internal/core/data/dataset-profile.js +170 -0
- package/dist/_internal/core/data/sample-values.d.ts +25 -0
- package/dist/_internal/core/data/sample-values.js +45 -0
- package/dist/_internal/core/diff/screen-diff.js +6 -0
- package/dist/_internal/core/index.d.ts +7 -1
- package/dist/_internal/core/index.js +7 -1
- package/dist/_internal/core/state/state-preset.d.ts +32 -0
- package/dist/_internal/core/state/state-preset.js +37 -0
- package/dist/_internal/core/validation/layout-audit.d.ts +17 -0
- package/dist/_internal/core/validation/layout-audit.js +228 -0
- package/dist/_internal/core/validation/legibility.d.ts +9 -0
- package/dist/_internal/core/validation/legibility.js +33 -0
- package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-draft-controller.d.ts +6 -1
- package/dist/_internal/engine/browser/controllers/designer-change-controller.d.ts +27 -0
- package/dist/_internal/engine/browser/dom/change/designer-change-dom.d.ts +21 -5
- package/dist/_internal/engine/browser/dom/dataset/designer-data-section-diff.d.ts +4 -6
- package/dist/_internal/engine/browser/dom/value-ref/designer-value-ref-types.d.ts +2 -0
- package/dist/_internal/engine/browser/viewport/designer-canvas-aids-types.d.ts +3 -3
- package/dist/_internal/engine/browser/viewport/designer-canvas-aids.d.ts +5 -3
- package/dist/_internal/engine/browser/viewport/designer-canvas-measurements.d.ts +2 -14
- package/dist/_internal/engine/browser/viewport/designer-guide-overlay-nodes.d.ts +2 -0
- package/dist/_internal/engine/browser/viewport/designer-snap-tuning.d.ts +14 -0
- package/dist/_internal/engine/common/operations/change/designer-change-events.d.ts +2 -0
- package/dist/_internal/engine/common/operations/change/designer-change-proposal.d.ts +35 -2
- package/dist/_internal/engine/common/operations/display/designer-target-display.d.ts +2 -2
- package/dist/_internal/engine/common/operations/style/designer-component-states.d.ts +7 -2
- package/dist/_internal/engine/common/ui-text/designer-ui-text.d.ts +42 -2
- package/dist/_internal/engine/{designer-blueprint-workbench-panel-CJ3iZo5v.js → designer-blueprint-workbench-panel-BWSglfAb.js} +210 -290
- package/dist/_internal/engine/{designer-dataset-controller-CrfOg2Ys.js → designer-dataset-controller-DdbY4ILC.js} +619 -561
- package/dist/_internal/engine/designer-element/api/designer-element-change.d.ts +24 -0
- package/dist/_internal/engine/designer-element/base-screen-designer-element.d.ts +12 -0
- package/dist/_internal/engine/designer-element/designer-element-public-api.d.ts +2 -1
- package/dist/_internal/engine/designer-element/runtime/designer-element-rendering.d.ts +1 -1
- package/dist/_internal/engine/designer-element/runtime/designer-element-runtime.d.ts +4 -1
- package/dist/_internal/engine/designer-element/runtime/designer-element-sample-data.d.ts +23 -0
- package/dist/_internal/engine/{designer-field-primitives-KBZuWN_D.js → designer-field-primitives-Crn464Qg.js} +44 -3
- package/dist/_internal/engine/{designer-left-panel-groups-dom-N2OHOWjl.js → designer-left-panel-groups-dom-DFdLWxxY.js} +2 -2
- package/dist/_internal/engine/{host-resource-selection-xo2mLCD4.js → host-resource-selection-CWrPLVOc.js} +2 -2
- package/dist/_internal/engine/index.js +4742 -4360
- package/dist/_internal/host-kit/index.d.ts +1 -0
- package/dist/_internal/host-kit/index.js +1 -0
- package/dist/_internal/host-kit/intent/index.d.ts +16 -0
- package/dist/_internal/host-kit/intent/index.js +13 -0
- package/dist/_internal/host-kit/intent/intent-behavior.d.ts +59 -0
- package/dist/_internal/host-kit/intent/intent-behavior.js +812 -0
- package/dist/_internal/host-kit/intent/intent-block.d.ts +59 -0
- package/dist/_internal/host-kit/intent/intent-block.js +359 -0
- package/dist/_internal/host-kit/intent/intent-catalog.d.ts +105 -0
- package/dist/_internal/host-kit/intent/intent-catalog.js +60 -0
- package/dist/_internal/host-kit/intent/intent-compile-types.d.ts +222 -0
- package/dist/_internal/host-kit/intent/intent-compile-types.js +10 -0
- package/dist/_internal/host-kit/intent/intent-compile.d.ts +35 -0
- package/dist/_internal/host-kit/intent/intent-compile.js +465 -0
- package/dist/_internal/host-kit/intent/intent-data-check.d.ts +50 -0
- package/dist/_internal/host-kit/intent/intent-data-check.js +163 -0
- package/dist/_internal/host-kit/intent/intent-data-context.d.ts +53 -0
- package/dist/_internal/host-kit/intent/intent-data-context.js +200 -0
- package/dist/_internal/host-kit/intent/intent-dataset.d.ts +52 -0
- package/dist/_internal/host-kit/intent/intent-dataset.js +125 -0
- package/dist/_internal/host-kit/intent/intent-format.d.ts +33 -0
- package/dist/_internal/host-kit/intent/intent-format.js +94 -0
- package/dist/_internal/host-kit/intent/intent-kpi-bind.d.ts +29 -0
- package/dist/_internal/host-kit/intent/intent-kpi-bind.js +59 -0
- package/dist/_internal/host-kit/intent/intent-layout.d.ts +102 -0
- package/dist/_internal/host-kit/intent/intent-layout.js +264 -0
- package/dist/_internal/host-kit/intent/intent-parse.d.ts +39 -0
- package/dist/_internal/host-kit/intent/intent-parse.js +930 -0
- package/dist/_internal/host-kit/intent/intent-prepare.d.ts +52 -0
- package/dist/_internal/host-kit/intent/intent-prepare.js +104 -0
- package/dist/_internal/host-kit/intent/intent-session.d.ts +202 -0
- package/dist/_internal/host-kit/intent/intent-session.js +1001 -0
- package/dist/_internal/host-kit/intent/intent-stream.d.ts +28 -0
- package/dist/_internal/host-kit/intent/intent-stream.js +183 -0
- package/dist/_internal/host-kit/intent/intent-style.d.ts +37 -0
- package/dist/_internal/host-kit/intent/intent-style.js +77 -0
- package/dist/_internal/host-kit/intent/intent-types.d.ts +234 -0
- package/dist/_internal/host-kit/intent/intent-types.js +10 -0
- package/dist/_internal/material/chart.js +34 -12
- package/dist/_internal/material/table.js +52 -21
- package/dist/_internal/plugin-sdk/index.d.ts +6 -0
- package/dist/_internal/plugin-sdk/index.js +6 -0
- package/dist/_internal/plugin-sdk/material-isolated-csp.d.ts +38 -0
- package/dist/_internal/plugin-sdk/material-isolated-csp.js +67 -0
- package/dist/_internal/plugin-sdk/material-isolated-runtime.d.ts +22 -0
- package/dist/_internal/plugin-sdk/material-isolated-runtime.js +262 -0
- package/dist/_internal/plugin-sdk/material-isolated.d.ts +94 -0
- package/dist/_internal/plugin-sdk/material-isolated.js +1024 -0
- package/dist/_internal/plugin-sdk/material-rendered-element.d.ts +10 -2
- package/dist/_internal/plugin-sdk/material-rendered-element.js +71 -7
- package/dist/_internal/plugin-sdk/material-spec-audit.d.ts +2 -0
- package/dist/_internal/plugin-sdk/material-spec-audit.js +26 -6
- package/dist/_internal/plugin-sdk/material-spec.d.ts +20 -0
- package/dist/_internal/plugin-sdk/material-spec.js +78 -3
- package/dist/_internal/plugin-sdk/material-template-audit.d.ts +12 -0
- package/dist/_internal/plugin-sdk/material-template-audit.js +302 -0
- package/dist/_internal/plugin-sdk/material-template-expression.d.ts +98 -0
- package/dist/_internal/plugin-sdk/material-template-expression.js +549 -0
- package/dist/_internal/plugin-sdk/material-template-render.d.ts +32 -0
- package/dist/_internal/plugin-sdk/material-template-render.js +579 -0
- package/dist/_internal/plugin-sdk/material-template.d.ts +185 -0
- package/dist/_internal/plugin-sdk/material-template.js +879 -0
- package/dist/auto-register.js +10 -10
- package/dist/contracts.js +5 -5
- package/dist/contrast-DRPezUIl.js +131 -0
- package/dist/contrast-DRPezUIl.js.map +1 -0
- package/dist/core.js +156 -136
- package/dist/core.js.map +1 -1
- package/dist/dataset-profile-Dk6xdtsM.js +261 -0
- package/dist/dataset-profile-Dk6xdtsM.js.map +1 -0
- package/dist/{designer-3Tb0EIDV.js → designer-CFOvOmLn.js} +2 -2
- package/dist/{designer-3Tb0EIDV.js.map → designer-CFOvOmLn.js.map} +1 -1
- package/dist/designer-auto-register.js +5 -5
- package/dist/{designer-blueprint-workbench-panel-CJ3iZo5v-BebifP4x.js → designer-blueprint-workbench-panel-BWSglfAb-ktaj6Ci9.js} +452 -531
- package/dist/designer-blueprint-workbench-panel-BWSglfAb-ktaj6Ci9.js.map +1 -0
- package/dist/{designer-dataset-controller-CrfOg2Ys-DhKUEJJe.js → designer-dataset-controller-DdbY4ILC-CMdGdGbr.js} +862 -804
- package/dist/designer-dataset-controller-DdbY4ILC-CMdGdGbr.js.map +1 -0
- package/dist/{designer-field-primitives-KBZuWN_D-B3h4jpYe.js → designer-field-primitives-Crn464Qg-Bi7q8s5J.js} +45 -4
- package/dist/designer-field-primitives-Crn464Qg-Bi7q8s5J.js.map +1 -0
- package/dist/{designer-left-panel-groups-dom-N2OHOWjl-D8CzGwbF.js → designer-left-panel-groups-dom-DFdLWxxY-BarlWMLY.js} +4 -4
- package/dist/{designer-left-panel-groups-dom-N2OHOWjl-D8CzGwbF.js.map → designer-left-panel-groups-dom-DFdLWxxY-BarlWMLY.js.map} +1 -1
- package/dist/designer.js +5 -5
- package/dist/{dist-6GRboBs-.js → dist-B2bW2Tru.js} +4 -4
- package/dist/{dist-6GRboBs-.js.map → dist-B2bW2Tru.js.map} +1 -1
- package/dist/{dist-BjLjFUy1.js → dist-CHK9BTXX.js} +3833 -3453
- package/dist/dist-CHK9BTXX.js.map +1 -0
- package/dist/engine.js +5 -5
- package/dist/{fragment-Y6YnW6wy.js → fragment-B-oP0Fru.js} +3 -3
- package/dist/{fragment-Y6YnW6wy.js.map → fragment-B-oP0Fru.js.map} +1 -1
- package/dist/host-kit.js +3963 -187
- package/dist/host-kit.js.map +1 -1
- package/dist/{host-resource-selection-xo2mLCD4-BR5XCcim.js → host-resource-selection-CWrPLVOc-DPDq3jau.js} +5 -5
- package/dist/{host-resource-selection-xo2mLCD4-BR5XCcim.js.map → host-resource-selection-CWrPLVOc-DPDq3jau.js.map} +1 -1
- package/dist/index.js +10 -10
- package/dist/legibility-CS28ivEz.js +12 -0
- package/dist/legibility-CS28ivEz.js.map +1 -0
- package/dist/{level-scale-BzUjE31V.js → level-scale-CwHqFEVd.js} +2 -2
- package/dist/{level-scale-BzUjE31V.js.map → level-scale-CwHqFEVd.js.map} +1 -1
- package/dist/{manager-Ch0RTu_i.js → manager-CeB4Jnr9.js} +3 -3
- package/dist/{manager-Ch0RTu_i.js.map → manager-CeB4Jnr9.js.map} +1 -1
- package/dist/{material-UbSfiuZq.js → material-DeVkzSoT.js} +2 -2
- package/dist/{material-UbSfiuZq.js.map → material-DeVkzSoT.js.map} +1 -1
- package/dist/material-auto-register.js +1 -1
- package/dist/material.js +2 -2
- package/dist/{migrate-document-D3HhCVlZ.js → migrate-document-BM888PtC.js} +2 -2
- package/dist/{migrate-document-D3HhCVlZ.js.map → migrate-document-BM888PtC.js.map} +1 -1
- package/dist/{parse-AOTE9WnD.js → parse-Ji7kE9ZT.js} +9 -4
- package/dist/parse-Ji7kE9ZT.js.map +1 -0
- package/dist/{parse-B1OD1teS.js → parse-aZat9tAS.js} +3 -3
- package/dist/{parse-B1OD1teS.js.map → parse-aZat9tAS.js.map} +1 -1
- package/dist/{parse-parts-BNrpdG5o.js → parse-parts-qzl4suzk.js} +2 -2
- package/dist/{parse-parts-BNrpdG5o.js.map → parse-parts-qzl4suzk.js.map} +1 -1
- package/dist/{plugin-DHgh9uHh.js → plugin-CstHQ5ws.js} +4 -4
- package/dist/{plugin-DHgh9uHh.js.map → plugin-CstHQ5ws.js.map} +1 -1
- package/dist/plugin-core.js +2 -2
- package/dist/plugin-manager.js +1 -1
- package/dist/plugin-package-DWifuHi1.js +4206 -0
- package/dist/plugin-package-DWifuHi1.js.map +1 -0
- package/dist/{plugin-registration-rsmb4GvS.js → plugin-registration-DTwBvnHX.js} +2 -2
- package/dist/{plugin-registration-rsmb4GvS.js.map → plugin-registration-DTwBvnHX.js.map} +1 -1
- package/dist/plugin-sdk.js +6 -6
- package/dist/{plugins-DGRHgREK.js → plugins-QDL0yIql.js} +2 -2
- package/dist/{plugins-DGRHgREK.js.map → plugins-QDL0yIql.js.map} +1 -1
- package/dist/plugins.js +8 -8
- package/dist/renderer.js +1 -1
- package/dist/{runtime-dispatch-BfnRDtMe.js → runtime-dispatch-C0gyIrTv.js} +2 -2
- package/dist/{runtime-dispatch-BfnRDtMe.js.map → runtime-dispatch-C0gyIrTv.js.map} +1 -1
- package/dist/runtime-simulate-aSYO9yDX.js +147 -0
- package/dist/runtime-simulate-aSYO9yDX.js.map +1 -0
- package/dist/{src-Bm7u11mN-_0u6cMEw.js → src-Bm7u11mN-Bi1hDVkh.js} +39 -39
- package/dist/{src-Bm7u11mN-_0u6cMEw.js.map → src-Bm7u11mN-Bi1hDVkh.js.map} +1 -1
- package/dist/state-preset-DtpygJOH.js +22 -0
- package/dist/state-preset-DtpygJOH.js.map +1 -0
- package/dist/{text-BNksUr5J.js → text-BSTz0pFQ.js} +87 -34
- package/dist/text-BSTz0pFQ.js.map +1 -0
- package/dist/{value-ref-BG_MV9C-.js → value-ref-XkLuckGV.js} +2 -2
- package/dist/{value-ref-BG_MV9C-.js.map → value-ref-XkLuckGV.js.map} +1 -1
- package/dist/{viewer-CrJupI8I-D9dVcNw4.js → viewer-CrJupI8I-BJiz1cvW.js} +4 -4
- package/dist/{viewer-CrJupI8I-D9dVcNw4.js.map → viewer-CrJupI8I-BJiz1cvW.js.map} +1 -1
- package/dist/viewer-auto-register.js +2 -2
- package/dist/viewer.js +2 -2
- package/dist/{viewport-CiCKeAQH.js → viewport-BNIRWjiT.js} +354 -155
- package/dist/viewport-BNIRWjiT.js.map +1 -0
- package/package.json +12 -12
- package/dist/designer-blueprint-workbench-panel-CJ3iZo5v-BebifP4x.js.map +0 -1
- package/dist/designer-dataset-controller-CrfOg2Ys-DhKUEJJe.js.map +0 -1
- package/dist/designer-field-primitives-KBZuWN_D-B3h4jpYe.js.map +0 -1
- package/dist/dist-BjLjFUy1.js.map +0 -1
- package/dist/parse-AOTE9WnD.js.map +0 -1
- package/dist/plugin-package-Dr5ro6h6.js +0 -1221
- package/dist/plugin-package-Dr5ro6h6.js.map +0 -1
- package/dist/text-BNksUr5J.js.map +0 -1
- package/dist/viewport-CiCKeAQH.js.map +0 -1
|
@@ -1,1221 +0,0 @@
|
|
|
1
|
-
import { r as e } from "./image-url-D6mUcjY1.js";
|
|
2
|
-
import { t } from "./equality-DjZ9cv4u.js";
|
|
3
|
-
import { t as n } from "./material-schema-CLoDx-Tl.js";
|
|
4
|
-
import { r, t as i } from "./fragment-Y6YnW6wy.js";
|
|
5
|
-
import { i as a } from "./material-theme-C91eus78.js";
|
|
6
|
-
import { r as o, t as s } from "./material-manifest-B1XatGPx.js";
|
|
7
|
-
import { a as c, i as l, n as u, r as d } from "./material-definition-BeW34dJr.js";
|
|
8
|
-
import { n as f, r as ee, t as te } from "./material-state-view-Bw7xIkEg.js";
|
|
9
|
-
import { n as ne } from "./plugin-registration-rsmb4GvS.js";
|
|
10
|
-
//#region ../plugin-sdk/dist/authoring-finding.js
|
|
11
|
-
function p(e) {
|
|
12
|
-
return [...e.filter((e) => e.severity === "error"), ...e.filter((e) => e.severity === "warning")];
|
|
13
|
-
}
|
|
14
|
-
function re(e) {
|
|
15
|
-
return e.some((e) => e.severity === "error");
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region ../plugin-sdk/dist/fragment-audit.js
|
|
19
|
-
var ie = 8, m = 2, ae = .9, oe = /* @__PURE__ */ new Set(["base.rectangle", "base.container"]);
|
|
20
|
-
function se(e, t) {
|
|
21
|
-
let n = r(e);
|
|
22
|
-
if (!n.ok) return n.diagnostics.map((e) => ({
|
|
23
|
-
rule: "SPEC",
|
|
24
|
-
severity: "error",
|
|
25
|
-
message: e.message,
|
|
26
|
-
path: e.path
|
|
27
|
-
}));
|
|
28
|
-
let i = n.value, a = [];
|
|
29
|
-
return t !== void 0 && ce(i, t, a), le(i, a), ue(i, a), de(i, a), i.nodes.forEach((e, t) => {
|
|
30
|
-
(e.name === void 0 || e.name.trim() === "") && a.push({
|
|
31
|
-
rule: "F9",
|
|
32
|
-
severity: "warning",
|
|
33
|
-
message: `节点 ${e.key} 没有名称:插入后图层里只显示物料名。`,
|
|
34
|
-
path: [
|
|
35
|
-
"nodes",
|
|
36
|
-
t,
|
|
37
|
-
"name"
|
|
38
|
-
]
|
|
39
|
-
});
|
|
40
|
-
}), p(a);
|
|
41
|
-
}
|
|
42
|
-
function ce(e, t, n) {
|
|
43
|
-
let r = [...e.shell === void 0 ? [] : [[e.shell, ["shell"]]], ...e.nodes.map((e, t) => [e, ["nodes", t]])];
|
|
44
|
-
for (let [i, a] of r) {
|
|
45
|
-
let r = t.get(i.materialType)?.manifest;
|
|
46
|
-
if (r === void 0) {
|
|
47
|
-
n.push({
|
|
48
|
-
rule: "F8",
|
|
49
|
-
severity: "error",
|
|
50
|
-
message: `引用的物料 ${i.materialType} 不在物料目录里。`,
|
|
51
|
-
path: [...a, "materialType"]
|
|
52
|
-
});
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
r.libraryVisible === !1 && n.push({
|
|
56
|
-
rule: "F8",
|
|
57
|
-
severity: "warning",
|
|
58
|
-
message: `「${r.name}」已下架:已有组合仍可插入,但新作者在物料库里找不到它。`,
|
|
59
|
-
path: [...a, "materialType"]
|
|
60
|
-
}), i === e.shell && r.designCapabilities.children !== !0 && n.push({
|
|
61
|
-
rule: "F8",
|
|
62
|
-
severity: "error",
|
|
63
|
-
message: `外壳「${r.name}」不接受子节点,改用容器。`,
|
|
64
|
-
path: [...a, "materialType"]
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function le(e, t) {
|
|
69
|
-
if (e.shell !== void 0 || e.nodes.length < 2) return;
|
|
70
|
-
let [n, ...r] = e.nodes;
|
|
71
|
-
if (n === void 0 || !oe.has(n.materialType)) return;
|
|
72
|
-
let i = h(n), a = r.map(h).filter((e) => e !== void 0);
|
|
73
|
-
i !== void 0 && a.length !== 0 && a.filter((e) => fe(e, i) >= ae).length === a.length && t.push({
|
|
74
|
-
rule: "F2",
|
|
75
|
-
severity: "warning",
|
|
76
|
-
message: "底板由外壳承担:把这块矩形换成容器,其余节点放进容器后整体存为组合,卡片才能整体移动、缩放。",
|
|
77
|
-
path: ["nodes", 0]
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
function ue(e, n) {
|
|
81
|
-
let r = e.nodes.flatMap((e) => e.dataSource === void 0 || e.dataSource === null ? [] : [e.dataSource]);
|
|
82
|
-
for (let e = 0; e < r.length; e += 1) {
|
|
83
|
-
let i = r[e];
|
|
84
|
-
if (i.type !== "dataset" && i.type !== "host-resource") continue;
|
|
85
|
-
let a = (e) => e.type === i.type && t(g(e), g(i));
|
|
86
|
-
if (!r.slice(0, e).some(a) && r.slice(e + 1).some(a)) {
|
|
87
|
-
n.push({
|
|
88
|
-
rule: "F4",
|
|
89
|
-
severity: "warning",
|
|
90
|
-
message: "多个节点各自查询同一个数据源:改为共享文档级数据源,一次查询、多处读取。",
|
|
91
|
-
path: ["nodes"]
|
|
92
|
-
});
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function de(e, t) {
|
|
98
|
-
e.nodes.length > ie && t.push({
|
|
99
|
-
rule: "F6",
|
|
100
|
-
severity: "warning",
|
|
101
|
-
message: `组合有 ${e.nodes.length} 个节点(建议不超过 ${ie} 个):更像页面模板,考虑拆成几个组合。`,
|
|
102
|
-
path: ["nodes"]
|
|
103
|
-
});
|
|
104
|
-
let n = new Map(e.nodes.map((e) => [e.key, e.parent])), r = (e, t = 0) => e === void 0 || t > 64 ? t : r(n.get(e), t + 1), i = Math.max(0, ...e.nodes.map((e) => r(e.key)));
|
|
105
|
-
i > m && t.push({
|
|
106
|
-
rule: "F6",
|
|
107
|
-
severity: "warning",
|
|
108
|
-
message: `组合嵌套 ${i} 层(建议不超过 ${m} 层)。`,
|
|
109
|
-
path: ["nodes"]
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
function h(e) {
|
|
113
|
-
if (e.size !== void 0) return {
|
|
114
|
-
x: e.offset?.x ?? 0,
|
|
115
|
-
y: e.offset?.y ?? 0,
|
|
116
|
-
width: e.size.width,
|
|
117
|
-
height: e.size.height
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function fe(e, t) {
|
|
121
|
-
let n = Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x), r = Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y), i = e.width * e.height;
|
|
122
|
-
return n <= 0 || r <= 0 || i <= 0 ? 0 : n * r / i;
|
|
123
|
-
}
|
|
124
|
-
function g(e) {
|
|
125
|
-
let { binding: t, ...n } = e;
|
|
126
|
-
return n;
|
|
127
|
-
}
|
|
128
|
-
//#endregion
|
|
129
|
-
//#region ../plugin-sdk/dist/fragment-definition.js
|
|
130
|
-
function pe(e) {
|
|
131
|
-
let t = r(e);
|
|
132
|
-
if (!t.ok) return t;
|
|
133
|
-
let n = {
|
|
134
|
-
kind: "fragment",
|
|
135
|
-
...t.value
|
|
136
|
-
};
|
|
137
|
-
return {
|
|
138
|
-
ok: !0,
|
|
139
|
-
value: Object.freeze(n),
|
|
140
|
-
diagnostics: []
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
//#endregion
|
|
144
|
-
//#region ../plugin-sdk/dist/material-config-groups.js
|
|
145
|
-
var _ = 16, me = 6;
|
|
146
|
-
function v(e = {}) {
|
|
147
|
-
let t = Math.min(Math.max(Math.trunc(e.maxDecimals ?? 4), 0), me), n = Math.min(Math.max(Math.trunc(e.decimals ?? 0), 0), t), r = {}, i = {}, a = [], o = ["decimals"], s = y(e.prefix);
|
|
148
|
-
s !== void 0 && (r.prefix = {
|
|
149
|
-
kind: "string",
|
|
150
|
-
maxLength: _
|
|
151
|
-
}, i.prefix = s, a.push(S("prefix", "前缀")));
|
|
152
|
-
let c = y(e.unit);
|
|
153
|
-
return c !== void 0 && (r.unit = {
|
|
154
|
-
kind: "string",
|
|
155
|
-
maxLength: _
|
|
156
|
-
}, i.unit = c, a.push(S("unit", "单位"))), r.decimals = {
|
|
157
|
-
kind: "number",
|
|
158
|
-
minimum: 0,
|
|
159
|
-
maximum: t
|
|
160
|
-
}, i.decimals = n, a.push(S("decimals", "小数位")), e.thousandsSeparator !== void 0 && (r.thousandsSeparator = { kind: "boolean" }, i.thousandsSeparator = e.thousandsSeparator, o.push("thousandsSeparator"), a.push(S("thousandsSeparator", "显示千分位"))), {
|
|
161
|
-
id: "number-format",
|
|
162
|
-
properties: r,
|
|
163
|
-
required: o,
|
|
164
|
-
defaults: i,
|
|
165
|
-
fields: a
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
function y(e) {
|
|
169
|
-
return typeof e == "string" ? [...e].slice(0, _).join("") : e === !0 ? "" : void 0;
|
|
170
|
-
}
|
|
171
|
-
function b() {
|
|
172
|
-
return {
|
|
173
|
-
id: "chart-title",
|
|
174
|
-
properties: { titleText: { kind: "string" } },
|
|
175
|
-
required: ["titleText"],
|
|
176
|
-
defaults: { titleText: "" },
|
|
177
|
-
fields: [S("titleText", "标题", { placeholder: "留空不显示" })]
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
function x(e = {}) {
|
|
181
|
-
return {
|
|
182
|
-
id: "chart-legend",
|
|
183
|
-
properties: { showLegend: { kind: "boolean" } },
|
|
184
|
-
required: ["showLegend"],
|
|
185
|
-
defaults: { showLegend: e.showLegend ?? !0 },
|
|
186
|
-
fields: [S("showLegend", "显示图例")]
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
function he(e) {
|
|
190
|
-
let t = {}, n = {}, r = [];
|
|
191
|
-
for (let i of e) {
|
|
192
|
-
for (let [e, n] of Object.entries(i.properties)) {
|
|
193
|
-
if (Object.hasOwn(t, e)) throw Error(`Material config groups overlap on props key "${e}".`);
|
|
194
|
-
t[e] = n;
|
|
195
|
-
}
|
|
196
|
-
Object.assign(n, i.defaults), r.push(...i.required);
|
|
197
|
-
}
|
|
198
|
-
return {
|
|
199
|
-
properties: t,
|
|
200
|
-
required: r,
|
|
201
|
-
defaults: n
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
function S(e, t, n = {}) {
|
|
205
|
-
return {
|
|
206
|
-
id: e,
|
|
207
|
-
target: "props",
|
|
208
|
-
path: [e],
|
|
209
|
-
label: t,
|
|
210
|
-
...n
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
//#endregion
|
|
214
|
-
//#region ../plugin-sdk/dist/material-editor-audit.js
|
|
215
|
-
var C = 12, ge = 12, _e = /* @__PURE__ */ new Set([
|
|
216
|
-
"array",
|
|
217
|
-
"repeatable-array",
|
|
218
|
-
"reorderable-array"
|
|
219
|
-
]);
|
|
220
|
-
function w(e) {
|
|
221
|
-
let t = [], n = (n, r, i) => {
|
|
222
|
-
t.push({
|
|
223
|
-
rule: n,
|
|
224
|
-
materialType: e.type,
|
|
225
|
-
...i === void 0 ? {} : { field: i.id },
|
|
226
|
-
message: r
|
|
227
|
-
});
|
|
228
|
-
};
|
|
229
|
-
((e.propertyPanel ?? []).length > 0 || (e.stylePanel ?? []).length > 0) && n("R12", "仍声明扁平 propertyPanel / stylePanel;改为 editorDescriptor。");
|
|
230
|
-
let r = e.editorDescriptor;
|
|
231
|
-
for (let e of r?.appearance ?? []) e.id === "motion" && e.advanced !== !0 && n("R15", "「动效」分区应标 advanced:动效属于仅全量可见的效果类设置。"), e.id !== "motion" && e.advanced === !0 && n("R15", `分区「${e.label}」不能标 advanced:物料分区里只有动效仅全量可见。`);
|
|
232
|
-
let i = [
|
|
233
|
-
r?.appearance,
|
|
234
|
-
r?.data,
|
|
235
|
-
r?.interaction
|
|
236
|
-
];
|
|
237
|
-
for (let t of i) for (let r of t ?? []) for (let t of r.fields) {
|
|
238
|
-
T(t, E(e, t), n);
|
|
239
|
-
let r = xe(e, t);
|
|
240
|
-
for (let i of t.itemFields ?? []) T(i, i.target === "interaction" ? i.projection === "style" ? e.styleSchema : e.propsSchema : i.target === "props" || i.target === "style" ? r : void 0, n);
|
|
241
|
-
}
|
|
242
|
-
let a = (r?.appearance ?? []).flatMap((e) => Se(e));
|
|
243
|
-
return a.length > C && n("R9", `基础密度下可见字段 ${a.length} 个,超过 ${C} 个。`), ye(e, n), t;
|
|
244
|
-
}
|
|
245
|
-
function T(e, t, n) {
|
|
246
|
-
let r = t === void 0 ? void 0 : a(e.path, t);
|
|
247
|
-
e.advanced === !0 && n("R15", `字段「${e.label}」不能单独标 advanced;整段隐藏或保持可见。`, e);
|
|
248
|
-
let i = o(e, r);
|
|
249
|
-
i !== void 0 && !ve(e.control, i, r) && n("R11", `控件是 ${e.control},按字段语义应为 ${i}(可省略 control)。`, e);
|
|
250
|
-
let s = e.label;
|
|
251
|
-
Ce(s) > ge && n("R13", `标签「${s}」超过 6 个汉字。`, e), s.includes("是否") && n("R13", `标签「${s}」不写「是否」。`, e), /[(())]|\b(?:px|ms)\b|%/.test(s) && n("R13", `标签「${s}」不带括号或单位,单位写进 unit。`, e), e.control === "color" && !s.endsWith("色") && n("R13", `颜色字段「${s}」应以「色」结尾。`, e), e.control === "boolean" && /^(?:不|禁用|隐藏)/.test(s) && n("R13", `开关「${s}」用正向表述。`, e);
|
|
252
|
-
}
|
|
253
|
-
function ve(e, t, n) {
|
|
254
|
-
return e === t || e === "custom" || e === "json" || e === "group" || _e.has(e) && n?.kind === "array" || n?.kind === "string" && (e === "text" || e === "color" || e === "field-selector") ? !0 : n?.kind === "enum" && e === "segmented" && n.values.length <= 3;
|
|
255
|
-
}
|
|
256
|
-
function ye(e, t) {
|
|
257
|
-
let n = (e.editorDescriptor?.appearance ?? []).flatMap((e) => e.fields);
|
|
258
|
-
for (let [r, i] of be) {
|
|
259
|
-
let a = e.propsSchema.properties[r];
|
|
260
|
-
if (a === void 0) continue;
|
|
261
|
-
if (a.kind !== i.schema.kind) {
|
|
262
|
-
t("R14", `props.${r} 是配置组「${i.group}」的键,类型应为 ${i.schema.kind}。`);
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
let o = n.find((e) => e.target === "props" && e.path.length === 1 && e.path[0] === r);
|
|
266
|
-
o === void 0 ? t("R14", `props.${r} 属于配置组「${i.group}」,检查器里缺少该字段。`) : o.label !== i.label && t("R14", `props.${r} 的标签应为配置组的「${i.label}」。`, o);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
var be = new Map([
|
|
270
|
-
v({
|
|
271
|
-
prefix: !0,
|
|
272
|
-
unit: !0,
|
|
273
|
-
thousandsSeparator: !0
|
|
274
|
-
}),
|
|
275
|
-
b(),
|
|
276
|
-
x()
|
|
277
|
-
].flatMap((e) => e.fields.map((t) => {
|
|
278
|
-
let n = String(t.path[0]), r = e.properties[n];
|
|
279
|
-
return [n, {
|
|
280
|
-
group: e.id,
|
|
281
|
-
label: t.label,
|
|
282
|
-
schema: r
|
|
283
|
-
}];
|
|
284
|
-
})));
|
|
285
|
-
function E(e, t) {
|
|
286
|
-
let n = t.target === "interaction" ? t.projection : t.target;
|
|
287
|
-
if (n === "props") return e.propsSchema;
|
|
288
|
-
if (n === "style") return e.styleSchema;
|
|
289
|
-
}
|
|
290
|
-
function xe(e, t) {
|
|
291
|
-
let n = E(e, t), r = n === void 0 ? void 0 : a(t.path, n);
|
|
292
|
-
return r?.kind === "array" && r.items.kind === "object" ? r.items : void 0;
|
|
293
|
-
}
|
|
294
|
-
function Se(e) {
|
|
295
|
-
return e.collapsed === !0 || e.advanced === !0 ? [] : e.fields.filter((e) => e.advanced !== !0);
|
|
296
|
-
}
|
|
297
|
-
function Ce(e) {
|
|
298
|
-
let t = 0;
|
|
299
|
-
for (let n of e) t += (n.codePointAt(0) ?? 0) > 11904 ? 2 : 1;
|
|
300
|
-
return t;
|
|
301
|
-
}
|
|
302
|
-
//#endregion
|
|
303
|
-
//#region ../plugin-sdk/dist/material-package.js
|
|
304
|
-
var we = 512;
|
|
305
|
-
function D(e) {
|
|
306
|
-
let t = e;
|
|
307
|
-
if (typeof t != "object" || !t || Array.isArray(t)) return d("PLUGIN_CORE_MANIFEST_NOT_OBJECT", [], "Material package options must be an object.");
|
|
308
|
-
let n = t, r, i;
|
|
309
|
-
try {
|
|
310
|
-
r = n.id, i = n.materials;
|
|
311
|
-
} catch {
|
|
312
|
-
return d("PLUGIN_CORE_MANIFEST_FIELD_INVALID", [], "Material package options cannot be safely read.");
|
|
313
|
-
}
|
|
314
|
-
if (!De(r)) return d("PLUGIN_CORE_IDENTITY_INVALID", ["id"], "Material package id must be an ASCII identifier.");
|
|
315
|
-
if (!Array.isArray(i) || i.length === 0) return d("PLUGIN_CORE_MANIFEST_FIELD_INVALID", ["materials"], "Material package must declare at least one material.");
|
|
316
|
-
if (i.length > we) return d("PLUGIN_CORE_MANIFEST_FIELD_INVALID", ["materials"], "Material package exceeds the material count limit.");
|
|
317
|
-
let a = [], o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
318
|
-
for (let e = 0; e < i.length; e++) {
|
|
319
|
-
let t;
|
|
320
|
-
try {
|
|
321
|
-
let n = i[e];
|
|
322
|
-
if (typeof n != "object" || !n || Array.isArray(n)) return d("PLUGIN_CORE_MANIFEST_NOT_OBJECT", ["materials", e], "Material package entry must be an object.");
|
|
323
|
-
t = u(n);
|
|
324
|
-
} catch {
|
|
325
|
-
return d("PLUGIN_CORE_MANIFEST_FIELD_INVALID", ["materials", e], "Material package entry cannot be safely read.");
|
|
326
|
-
}
|
|
327
|
-
if (!t.ok) return l(t.diagnostics, ["materials", e]);
|
|
328
|
-
let n = t.value.manifest;
|
|
329
|
-
if (o.has(n.type)) return d("PLUGIN_CORE_IDENTITY_CONFLICT", [
|
|
330
|
-
"materials",
|
|
331
|
-
e,
|
|
332
|
-
"type"
|
|
333
|
-
], "Material package contains a duplicate material type.");
|
|
334
|
-
if (s.has(n.tagName)) return d("PLUGIN_CORE_IDENTITY_CONFLICT", [
|
|
335
|
-
"materials",
|
|
336
|
-
e,
|
|
337
|
-
"tagName"
|
|
338
|
-
], "Material package contains a duplicate tag name.");
|
|
339
|
-
o.add(n.type), s.add(n.tagName), a.push(t.value);
|
|
340
|
-
}
|
|
341
|
-
let c = Object.freeze(a);
|
|
342
|
-
return {
|
|
343
|
-
ok: !0,
|
|
344
|
-
value: {
|
|
345
|
-
id: n.id,
|
|
346
|
-
materials: c,
|
|
347
|
-
define: () => Te(c)
|
|
348
|
-
},
|
|
349
|
-
diagnostics: []
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
function Te(e) {
|
|
353
|
-
let t = [];
|
|
354
|
-
for (let n = 0; n < e.length; n++) {
|
|
355
|
-
let r = Ee(e[n]);
|
|
356
|
-
r !== void 0 && t.push({
|
|
357
|
-
...r,
|
|
358
|
-
path: [
|
|
359
|
-
"materials",
|
|
360
|
-
n,
|
|
361
|
-
"tagName"
|
|
362
|
-
]
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
if (t.length > 0) return {
|
|
366
|
-
ok: !1,
|
|
367
|
-
diagnostics: c(t)
|
|
368
|
-
};
|
|
369
|
-
let n = [];
|
|
370
|
-
for (let t = 0; t < e.length; t++) {
|
|
371
|
-
let r = e[t].define();
|
|
372
|
-
if (!r.ok) return {
|
|
373
|
-
ok: !1,
|
|
374
|
-
diagnostics: c(r.diagnostics.map((e) => ({
|
|
375
|
-
...e,
|
|
376
|
-
path: [
|
|
377
|
-
"materials",
|
|
378
|
-
t,
|
|
379
|
-
...e.path
|
|
380
|
-
]
|
|
381
|
-
})))
|
|
382
|
-
};
|
|
383
|
-
n.push(r.value);
|
|
384
|
-
}
|
|
385
|
-
return {
|
|
386
|
-
ok: !0,
|
|
387
|
-
value: Object.freeze(n),
|
|
388
|
-
diagnostics: []
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
function Ee(e) {
|
|
392
|
-
let t = globalThis.customElements;
|
|
393
|
-
if (t === void 0) return;
|
|
394
|
-
let n;
|
|
395
|
-
try {
|
|
396
|
-
n = t.get(e.manifest.tagName);
|
|
397
|
-
} catch {
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
if (n !== void 0 && n !== e.element) return {
|
|
401
|
-
severity: "error",
|
|
402
|
-
code: "PLUGIN_CORE_IDENTITY_CONFLICT",
|
|
403
|
-
path: [],
|
|
404
|
-
message: "Tag name is already bound to a different constructor."
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
function De(e) {
|
|
408
|
-
return typeof e == "string" && e.length > 0 && e.length <= 128 && /^[A-Za-z0-9][A-Za-z0-9._:-]*$/.test(e);
|
|
409
|
-
}
|
|
410
|
-
//#endregion
|
|
411
|
-
//#region ../plugin-sdk/dist/material-spec.js
|
|
412
|
-
var O = [
|
|
413
|
-
{
|
|
414
|
-
id: "format",
|
|
415
|
-
label: "读数格式",
|
|
416
|
-
target: "props"
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
id: "structure",
|
|
420
|
-
label: "结构",
|
|
421
|
-
target: "props"
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
id: "text",
|
|
425
|
-
label: "文字",
|
|
426
|
-
target: "style"
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
id: "surface",
|
|
430
|
-
label: "填充与描边",
|
|
431
|
-
target: "style"
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
id: "semantic",
|
|
435
|
-
label: "语义色",
|
|
436
|
-
target: "style",
|
|
437
|
-
collapsed: !0
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
id: "motion",
|
|
441
|
-
label: "动效",
|
|
442
|
-
target: "props",
|
|
443
|
-
advanced: !0
|
|
444
|
-
}
|
|
445
|
-
], Oe = new Set(O.map((e) => e.id)), ke = /* @__PURE__ */ new Set([
|
|
446
|
-
"number",
|
|
447
|
-
"text",
|
|
448
|
-
"boolean",
|
|
449
|
-
"color",
|
|
450
|
-
"choice"
|
|
451
|
-
]), Ae = /* @__PURE__ */ new Set([
|
|
452
|
-
"type",
|
|
453
|
-
"name",
|
|
454
|
-
"category",
|
|
455
|
-
"keywords",
|
|
456
|
-
"defaultSize",
|
|
457
|
-
"rotate",
|
|
458
|
-
"numberFormat",
|
|
459
|
-
"fields",
|
|
460
|
-
"data"
|
|
461
|
-
]), je = /* @__PURE__ */ new Set([
|
|
462
|
-
"key",
|
|
463
|
-
"label",
|
|
464
|
-
"section",
|
|
465
|
-
"kind",
|
|
466
|
-
"default",
|
|
467
|
-
"min",
|
|
468
|
-
"max",
|
|
469
|
-
"step",
|
|
470
|
-
"unit",
|
|
471
|
-
"options",
|
|
472
|
-
"allowGradient",
|
|
473
|
-
"visibleWhen",
|
|
474
|
-
"help"
|
|
475
|
-
]), Me = /* @__PURE__ */ new Set([
|
|
476
|
-
"decimals",
|
|
477
|
-
"maxDecimals",
|
|
478
|
-
"thousandsSeparator",
|
|
479
|
-
"prefix",
|
|
480
|
-
"unit",
|
|
481
|
-
"visibleWhen"
|
|
482
|
-
]), Ne = /* @__PURE__ */ new Set([
|
|
483
|
-
"decimals",
|
|
484
|
-
"prefix",
|
|
485
|
-
"unit",
|
|
486
|
-
"thousandsSeparator"
|
|
487
|
-
]), k = /^[a-z][A-Za-z0-9]{0,39}$/, A = 24, j = 16, M = 6, N = 200, P = 12, F = 64, I = 32, L = 200, R = 8, z = 512, B = 8, V = 4096;
|
|
488
|
-
function H(t) {
|
|
489
|
-
let n = [], r = (e, t) => {
|
|
490
|
-
n.push({
|
|
491
|
-
severity: "error",
|
|
492
|
-
code: "PLUGIN_CORE_MANIFEST_FIELD_INVALID",
|
|
493
|
-
path: e,
|
|
494
|
-
message: t
|
|
495
|
-
});
|
|
496
|
-
};
|
|
497
|
-
if (!$(t)) return r([], "组件规格必须是对象。"), {
|
|
498
|
-
ok: !1,
|
|
499
|
-
diagnostics: n
|
|
500
|
-
};
|
|
501
|
-
for (let e of Object.keys(t)) Ae.has(e) || r([e], `未知字段 ${e}。`);
|
|
502
|
-
e(t.type) || r(["type"], "物料类型不合法(形如 host.online.gauge-1a2b)。"), i(t.name, F) || r(["name"], `名称为 1–${F} 个字符。`), i(t.category, F) || r(["category"], `分类为 1–${F} 个字符。`), (!Array.isArray(t.keywords) || t.keywords.length > j || t.keywords.some((e) => !i(e, I))) && r(["keywords"], `关键词最多 ${j} 个,每个 1–${I} 个字符。`);
|
|
503
|
-
let a = t.defaultSize;
|
|
504
|
-
(!$(a) || !Z(a.width) || !Z(a.height) || Object.keys(a).some((e) => e !== "width" && e !== "height")) && r(["defaultSize"], `默认尺寸的宽高为 ${B}–${V} 的数字。`), t.rotate !== void 0 && typeof t.rotate != "boolean" && r(["rotate"], "rotate 必须是布尔值。");
|
|
505
|
-
let o = Array.isArray(t.fields) ? t.fields : void 0;
|
|
506
|
-
return o === void 0 ? r(["fields"], "fields 必须是数组。") : o.length > A ? r(["fields"], `字段最多 ${A} 个。`) : Fe(o, r), t.numberFormat !== void 0 && Pe(t.numberFormat, o ?? [], r), Le(t.data, r), n.length > 0 ? {
|
|
507
|
-
ok: !1,
|
|
508
|
-
diagnostics: n
|
|
509
|
-
} : {
|
|
510
|
-
ok: !0,
|
|
511
|
-
value: t,
|
|
512
|
-
diagnostics: []
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
function Pe(e, t, n) {
|
|
516
|
-
if (!$(e)) {
|
|
517
|
-
n(["numberFormat"], "numberFormat 必须是对象。");
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
if (e.visibleWhen !== void 0) {
|
|
521
|
-
let r = e.visibleWhen, i = t.find((e) => $(e) && $(r) && e.key === r.key);
|
|
522
|
-
(!$(r) || Object.keys(r).some((e) => e !== "key" && e !== "equals") || i === void 0 || i.section !== "format" || i.kind !== "boolean" && i.kind !== "choice" || !X(i, r.equals)) && n(["numberFormat", "visibleWhen"], "visibleWhen 只能引用读数格式分区里的开关或选项字段,equals 取该字段的合法值。");
|
|
523
|
-
}
|
|
524
|
-
for (let t of Object.keys(e)) Me.has(t) || n(["numberFormat", t], `未知字段 ${t}。`);
|
|
525
|
-
for (let t of ["decimals", "maxDecimals"]) {
|
|
526
|
-
let r = e[t];
|
|
527
|
-
r !== void 0 && (!Number.isInteger(r) || r < 0 || r > 6) && n(["numberFormat", t], `${t} 是 0–6 的整数。`);
|
|
528
|
-
}
|
|
529
|
-
e.thousandsSeparator !== void 0 && typeof e.thousandsSeparator != "boolean" && n(["numberFormat", "thousandsSeparator"], "thousandsSeparator 必须是布尔值。");
|
|
530
|
-
for (let t of ["prefix", "unit"]) {
|
|
531
|
-
let r = e[t];
|
|
532
|
-
r !== void 0 && typeof r != "boolean" && (typeof r != "string" || [...r].length > 16) && n(["numberFormat", t], `${t} 是布尔值,或不超过 16 个字符的默认值。`);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
function Fe(e, t) {
|
|
536
|
-
let r = /* @__PURE__ */ new Map(), a = new Set(Object.keys(n));
|
|
537
|
-
e.forEach((e, n) => {
|
|
538
|
-
let o = ["fields", n];
|
|
539
|
-
if (!$(e)) {
|
|
540
|
-
t(o, "字段必须是对象。");
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
|
-
for (let n of Object.keys(e)) je.has(n) || t([...o, n], `未知字段 ${n}。`);
|
|
544
|
-
let s = e.key;
|
|
545
|
-
typeof s != "string" || !k.test(s) ? t([...o, "key"], "键名为小驼峰 ASCII(字母开头,最多 40 个字符)。") : r.has(s) ? t([...o, "key"], `键名 ${s} 重复。`) : a.has(s) ? t([...o, "key"], `${s} 是引擎保留样式(公共区统一提供),物料不再声明(ADR-0099 R6)。`) : Ne.has(s) && t([...o, "key"], `${s} 属于读数格式配置组:开启 numberFormat,不要手写同名字段(ADR-0102 R14)。`), i(e.label, I) || t([...o, "label"], "标签为 1–32 个字符。"), (typeof e.section != "string" || !Oe.has(e.section)) && t([...o, "section"], "分区只能是 format / structure / text / surface / semantic / motion。");
|
|
546
|
-
let c = e.kind;
|
|
547
|
-
if (typeof c != "string" || !ke.has(c) ? t([...o, "kind"], "类型只能是 number / text / boolean / color / choice。") : Ie(e, c, o, t), e.help !== void 0 && !i(e.help, L) && t([...o, "help"], `说明最多 ${L} 个字符。`), e.visibleWhen !== void 0) {
|
|
548
|
-
let n = e.visibleWhen, i = $(n) && typeof n.key == "string" ? r.get(n.key) : void 0;
|
|
549
|
-
(!$(n) || Object.keys(n).some((e) => e !== "key" && e !== "equals") || i === void 0 || i.kind !== "boolean" && i.kind !== "choice" || !X(i, n.equals)) && t([...o, "visibleWhen"], "visibleWhen 只能引用更早声明的开关或选项字段,equals 取该字段的合法值。");
|
|
550
|
-
}
|
|
551
|
-
typeof s == "string" && !r.has(s) && r.set(s, e);
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
function Ie(e, t, n, r) {
|
|
555
|
-
let a = e.default, o = (i, a) => {
|
|
556
|
-
for (let o of i) e[o] !== void 0 && t !== a && r([...n, o], `${o} 只用于 ${a} 字段。`);
|
|
557
|
-
};
|
|
558
|
-
switch (o([
|
|
559
|
-
"min",
|
|
560
|
-
"max",
|
|
561
|
-
"step",
|
|
562
|
-
"unit"
|
|
563
|
-
], "number"), o(["options"], "choice"), o(["allowGradient"], "color"), t) {
|
|
564
|
-
case "number": {
|
|
565
|
-
for (let t of [
|
|
566
|
-
"min",
|
|
567
|
-
"max",
|
|
568
|
-
"step"
|
|
569
|
-
]) e[t] !== void 0 && !Q(e[t]) && r([...n, t], `${t} 必须是数字。`);
|
|
570
|
-
let t = e.min, o = e.max;
|
|
571
|
-
t !== void 0 && o !== void 0 && t >= o && r([...n, "max"], "max 必须大于 min。"), e.step !== void 0 && e.step <= 0 && r([...n, "step"], "step 必须大于 0。"), e.unit !== void 0 && !i(e.unit, R) && r([...n, "unit"], `单位最多 ${R} 个字符。`), (!Q(a) || t !== void 0 && a < t || o !== void 0 && a > o) && r([...n, "default"], "默认值必须是范围内的数字。");
|
|
572
|
-
return;
|
|
573
|
-
}
|
|
574
|
-
case "boolean":
|
|
575
|
-
typeof a != "boolean" && r([...n, "default"], "默认值必须是布尔值。");
|
|
576
|
-
return;
|
|
577
|
-
case "text":
|
|
578
|
-
case "color":
|
|
579
|
-
(typeof a != "string" || [...a].length > z) && r([...n, "default"], `默认值必须是不超过 ${z} 个字符的字符串。`), e.allowGradient !== void 0 && typeof e.allowGradient != "boolean" && r([...n, "allowGradient"], "allowGradient 必须是布尔值。");
|
|
580
|
-
return;
|
|
581
|
-
case "choice": {
|
|
582
|
-
let t = e.options;
|
|
583
|
-
!Array.isArray(t) || t.length < 2 || t.length > P || t.some((e) => !i(e, I)) || new Set(t).size !== t.length ? r([...n, "options"], `选项为 2–${P} 个互不相同的字符串。`) : (typeof a != "string" || !t.includes(a)) && r([...n, "default"], "默认值必须是选项之一。");
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
function Le(e, t) {
|
|
588
|
-
if (!$(e)) {
|
|
589
|
-
t(["data"], "data 必须是对象。");
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
let n = (n) => {
|
|
593
|
-
for (let r of Object.keys(e)) n.includes(r) || t(["data", r], `未知字段 ${r}。`);
|
|
594
|
-
};
|
|
595
|
-
switch (e.kind) {
|
|
596
|
-
case "none":
|
|
597
|
-
n(["kind"]);
|
|
598
|
-
return;
|
|
599
|
-
case "scalar":
|
|
600
|
-
n([
|
|
601
|
-
"kind",
|
|
602
|
-
"valueType",
|
|
603
|
-
"sample"
|
|
604
|
-
]), e.valueType !== "number" && e.valueType !== "string" ? t(["data", "valueType"], "单值类型只能是 number 或 string。") : (e.valueType === "number" ? !Q(e.sample) : typeof e.sample != "string") && t(["data", "sample"], "示例值的类型须与单值类型一致。");
|
|
605
|
-
return;
|
|
606
|
-
case "rows": {
|
|
607
|
-
n([
|
|
608
|
-
"kind",
|
|
609
|
-
"roles",
|
|
610
|
-
"sample"
|
|
611
|
-
]);
|
|
612
|
-
let r = e.roles, a = /* @__PURE__ */ new Set();
|
|
613
|
-
!Array.isArray(r) || r.length === 0 || r.length > M ? t(["data", "roles"], `角色为 1–${M} 个。`) : (r.forEach((e, n) => {
|
|
614
|
-
let r = [
|
|
615
|
-
"data",
|
|
616
|
-
"roles",
|
|
617
|
-
n
|
|
618
|
-
];
|
|
619
|
-
if (!$(e) || Object.keys(e).some((e) => ![
|
|
620
|
-
"id",
|
|
621
|
-
"label",
|
|
622
|
-
"valueType",
|
|
623
|
-
"optional"
|
|
624
|
-
].includes(e))) {
|
|
625
|
-
t(r, "角色只包含 id / label / valueType / optional。");
|
|
626
|
-
return;
|
|
627
|
-
}
|
|
628
|
-
typeof e.id != "string" || !k.test(e.id) || a.has(e.id) ? t([...r, "id"], "角色 id 为互不相同的小驼峰 ASCII。") : a.add(e.id), i(e.label, I) || t([...r, "label"], "角色名为 1–32 个字符。"), e.valueType !== "number" && e.valueType !== "string" && t([...r, "valueType"], "角色类型只能是 number 或 string。"), e.optional !== void 0 && typeof e.optional != "boolean" && t([...r, "optional"], "optional 必须是布尔值。");
|
|
629
|
-
}), r.every((e) => $(e) && e.optional === !0) && t(["data", "roles"], "至少有一个必填角色。"));
|
|
630
|
-
let o = e.sample;
|
|
631
|
-
!Array.isArray(o) || o.length > N || o.some((e) => !$(e)) ? t(["data", "sample"], `示例行是最多 ${N} 个对象的数组。`) : o.forEach((e, n) => {
|
|
632
|
-
for (let [r, i] of Object.entries(e)) a.has(r) ? i !== null && typeof i != "string" && !Q(i) && t([
|
|
633
|
-
"data",
|
|
634
|
-
"sample",
|
|
635
|
-
n,
|
|
636
|
-
r
|
|
637
|
-
], "示例单元格只能是字符串、数字或 null。") : t([
|
|
638
|
-
"data",
|
|
639
|
-
"sample",
|
|
640
|
-
n,
|
|
641
|
-
r
|
|
642
|
-
], `示例行的键 ${r} 不是角色 id。`);
|
|
643
|
-
});
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
|
-
default: t(["data", "kind"], "数据形状只能是 none / scalar / rows。");
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
function U(e, t) {
|
|
650
|
-
let n = H(e);
|
|
651
|
-
if (!n.ok) return n;
|
|
652
|
-
let r = n.value, i = r.numberFormat === void 0 ? void 0 : v(Re(r.numberFormat)), a = { ...i?.properties }, o = {}, c = { ...i?.defaults }, l = {}, u = /* @__PURE__ */ new Map();
|
|
653
|
-
for (let e of r.fields) {
|
|
654
|
-
let t = Be(e.section);
|
|
655
|
-
u.set(e.key, t), (t === "props" ? a : o)[e.key] = Ve(e), (t === "props" ? c : l)[e.key] = e.default;
|
|
656
|
-
}
|
|
657
|
-
let d = [];
|
|
658
|
-
for (let e of O) {
|
|
659
|
-
let t = [...r.fields.filter((t) => t.section === e.id).map((t) => He(t, e.target, u)), ...e.id === "format" ? ze(i?.fields ?? [], r.numberFormat) : []];
|
|
660
|
-
t.length !== 0 && d.push({
|
|
661
|
-
id: e.id,
|
|
662
|
-
label: e.label,
|
|
663
|
-
fields: t,
|
|
664
|
-
...e.collapsed === !0 ? { collapsed: !0 } : {},
|
|
665
|
-
...e.advanced === !0 ? { advanced: !0 } : {}
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
let f = {
|
|
669
|
-
type: r.type,
|
|
670
|
-
tagName: t.tagName,
|
|
671
|
-
name: r.name,
|
|
672
|
-
category: r.category,
|
|
673
|
-
keywords: [...r.keywords],
|
|
674
|
-
defaultSize: {
|
|
675
|
-
width: r.defaultSize.width,
|
|
676
|
-
height: r.defaultSize.height
|
|
677
|
-
},
|
|
678
|
-
defaultProps: c,
|
|
679
|
-
defaultStyle: l,
|
|
680
|
-
propsSchema: {
|
|
681
|
-
kind: "object",
|
|
682
|
-
properties: a,
|
|
683
|
-
required: Object.keys(a)
|
|
684
|
-
},
|
|
685
|
-
propertyPanel: [],
|
|
686
|
-
styleSchema: {
|
|
687
|
-
kind: "object",
|
|
688
|
-
properties: o,
|
|
689
|
-
required: Object.keys(o)
|
|
690
|
-
},
|
|
691
|
-
stylePanel: [],
|
|
692
|
-
...d.length === 0 ? {} : { editorDescriptor: { appearance: d } },
|
|
693
|
-
events: [],
|
|
694
|
-
designCapabilities: {
|
|
695
|
-
resize: !0,
|
|
696
|
-
rotate: r.rotate ?? !0,
|
|
697
|
-
children: !1
|
|
698
|
-
},
|
|
699
|
-
...Ue(r.data),
|
|
700
|
-
...t.libraryVisible === !1 ? { libraryVisible: !1 } : {},
|
|
701
|
-
...t.cover === void 0 ? {} : { cover: t.cover }
|
|
702
|
-
};
|
|
703
|
-
return s(f);
|
|
704
|
-
}
|
|
705
|
-
function Re(e) {
|
|
706
|
-
let { visibleWhen: t, ...n } = e;
|
|
707
|
-
return n;
|
|
708
|
-
}
|
|
709
|
-
function ze(e, t) {
|
|
710
|
-
let n = t?.visibleWhen;
|
|
711
|
-
return n === void 0 ? e : e.map((e) => ({
|
|
712
|
-
...e,
|
|
713
|
-
when: [{
|
|
714
|
-
path: [n.key],
|
|
715
|
-
operator: "eq",
|
|
716
|
-
value: n.equals
|
|
717
|
-
}]
|
|
718
|
-
}));
|
|
719
|
-
}
|
|
720
|
-
function Be(e) {
|
|
721
|
-
return O.find((t) => t.id === e)?.target ?? "props";
|
|
722
|
-
}
|
|
723
|
-
function Ve(e) {
|
|
724
|
-
switch (e.kind) {
|
|
725
|
-
case "number": return {
|
|
726
|
-
kind: "number",
|
|
727
|
-
...e.min === void 0 ? {} : { minimum: e.min },
|
|
728
|
-
...e.max === void 0 ? {} : { maximum: e.max }
|
|
729
|
-
};
|
|
730
|
-
case "boolean": return { kind: "boolean" };
|
|
731
|
-
case "choice": return {
|
|
732
|
-
kind: "enum",
|
|
733
|
-
values: [...e.options ?? []]
|
|
734
|
-
};
|
|
735
|
-
case "text":
|
|
736
|
-
case "color": return {
|
|
737
|
-
kind: "string",
|
|
738
|
-
maxLength: z
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
function He(e, t, n) {
|
|
743
|
-
let r = e.visibleWhen, i = r === void 0 ? void 0 : n.get(r.key);
|
|
744
|
-
return {
|
|
745
|
-
id: e.key,
|
|
746
|
-
target: t,
|
|
747
|
-
path: [e.key],
|
|
748
|
-
label: e.label,
|
|
749
|
-
...e.kind === "color" ? { control: "color" } : {},
|
|
750
|
-
...e.kind === "color" && e.allowGradient === !0 ? { allowGradient: !0 } : {},
|
|
751
|
-
...e.unit === void 0 ? {} : { unit: e.unit },
|
|
752
|
-
...e.step === void 0 ? {} : { step: e.step },
|
|
753
|
-
...e.help === void 0 ? {} : { help: e.help },
|
|
754
|
-
...r === void 0 ? {} : { when: [{
|
|
755
|
-
...i !== void 0 && i !== t ? { target: i } : {},
|
|
756
|
-
path: [r.key],
|
|
757
|
-
operator: "eq",
|
|
758
|
-
value: r.equals
|
|
759
|
-
}] }
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
function Ue(e) {
|
|
763
|
-
switch (e.kind) {
|
|
764
|
-
case "none": return { dataCapabilities: [] };
|
|
765
|
-
case "scalar": return {
|
|
766
|
-
dataCapabilities: [
|
|
767
|
-
"static",
|
|
768
|
-
"variable",
|
|
769
|
-
"dataset"
|
|
770
|
-
],
|
|
771
|
-
staticData: {
|
|
772
|
-
kind: "scalar",
|
|
773
|
-
valueType: e.valueType
|
|
774
|
-
},
|
|
775
|
-
defaultData: e.sample,
|
|
776
|
-
dataBinding: { roles: [{
|
|
777
|
-
id: W,
|
|
778
|
-
minFields: 1,
|
|
779
|
-
maxFields: 1,
|
|
780
|
-
valueTypes: e.valueType === "number" ? ["number", "string"] : [
|
|
781
|
-
"string",
|
|
782
|
-
"number",
|
|
783
|
-
"date"
|
|
784
|
-
]
|
|
785
|
-
}] }
|
|
786
|
-
};
|
|
787
|
-
case "rows": return {
|
|
788
|
-
dataCapabilities: ["static", "dataset"],
|
|
789
|
-
staticData: {
|
|
790
|
-
kind: "tabular",
|
|
791
|
-
defaultBinding: { fields: Object.fromEntries(e.roles.map((e) => [e.id, [e.id]])) }
|
|
792
|
-
},
|
|
793
|
-
defaultData: G(e),
|
|
794
|
-
dataBinding: { roles: e.roles.map((e) => ({
|
|
795
|
-
id: e.id,
|
|
796
|
-
minFields: e.optional === !0 ? 0 : 1,
|
|
797
|
-
maxFields: 1,
|
|
798
|
-
valueTypes: e.valueType === "number" ? ["number"] : [
|
|
799
|
-
"string",
|
|
800
|
-
"number",
|
|
801
|
-
"date",
|
|
802
|
-
"boolean"
|
|
803
|
-
]
|
|
804
|
-
})) }
|
|
805
|
-
};
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
var W = "value";
|
|
809
|
-
function G(e) {
|
|
810
|
-
return {
|
|
811
|
-
fields: e.roles.map((e) => ({
|
|
812
|
-
id: e.id,
|
|
813
|
-
label: e.label,
|
|
814
|
-
valueType: e.valueType,
|
|
815
|
-
nullable: e.optional === !0
|
|
816
|
-
})),
|
|
817
|
-
rows: e.sample.map((t) => Object.fromEntries(e.roles.map((e) => [e.id, t[e.id] ?? null])))
|
|
818
|
-
};
|
|
819
|
-
}
|
|
820
|
-
function K(e) {
|
|
821
|
-
if (e.kind !== "none") return e.kind === "scalar" ? { adapt({ dataset: t, fields: n }) {
|
|
822
|
-
let r = n[W]?.[0], i = t.rows[0];
|
|
823
|
-
return r === void 0 ? Y("单值组件需要绑定一列。") : i === void 0 ? {
|
|
824
|
-
ok: !0,
|
|
825
|
-
value: null,
|
|
826
|
-
diagnostics: []
|
|
827
|
-
} : {
|
|
828
|
-
ok: !0,
|
|
829
|
-
value: J(i[r.id], e.valueType),
|
|
830
|
-
diagnostics: []
|
|
831
|
-
};
|
|
832
|
-
} } : { adapt({ dataset: t, fields: n }) {
|
|
833
|
-
for (let t of e.roles) if (t.optional !== !0 && (n[t.id]?.length ?? 0) === 0) return Y(`角色「${t.label}」需要绑定一列。`);
|
|
834
|
-
let r = t.rows.map((t) => Object.fromEntries(e.roles.map((e) => {
|
|
835
|
-
let r = n[e.id]?.[0];
|
|
836
|
-
return [e.id, r === void 0 ? null : J(t[r.id], e.valueType)];
|
|
837
|
-
})));
|
|
838
|
-
return {
|
|
839
|
-
ok: !0,
|
|
840
|
-
value: {
|
|
841
|
-
rows: r,
|
|
842
|
-
total: r.length
|
|
843
|
-
},
|
|
844
|
-
diagnostics: []
|
|
845
|
-
};
|
|
846
|
-
} };
|
|
847
|
-
}
|
|
848
|
-
function q(e, t) {
|
|
849
|
-
return e.kind === "none" ? {
|
|
850
|
-
value: null,
|
|
851
|
-
rows: []
|
|
852
|
-
} : e.kind === "scalar" ? {
|
|
853
|
-
value: J(t, e.valueType),
|
|
854
|
-
rows: []
|
|
855
|
-
} : {
|
|
856
|
-
value: null,
|
|
857
|
-
rows: ($(t) && Array.isArray(t.rows) ? t.rows : Array.isArray(t) ? t : []).filter($).map((t) => Object.fromEntries(e.roles.map((e) => [e.id, J(t[e.id], e.valueType)])))
|
|
858
|
-
};
|
|
859
|
-
}
|
|
860
|
-
function J(e, t) {
|
|
861
|
-
if (e == null) return null;
|
|
862
|
-
if (t === "number") {
|
|
863
|
-
let t = typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
|
|
864
|
-
return Number.isFinite(t) ? t : null;
|
|
865
|
-
}
|
|
866
|
-
return typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : null;
|
|
867
|
-
}
|
|
868
|
-
function Y(e) {
|
|
869
|
-
return {
|
|
870
|
-
ok: !1,
|
|
871
|
-
diagnostics: [{
|
|
872
|
-
severity: "error",
|
|
873
|
-
code: "HOST_DATASET_BINDING_INVALID",
|
|
874
|
-
path: [],
|
|
875
|
-
message: e
|
|
876
|
-
}]
|
|
877
|
-
};
|
|
878
|
-
}
|
|
879
|
-
function X(e, t) {
|
|
880
|
-
return e.kind === "boolean" ? typeof t == "boolean" : Array.isArray(e.options) && typeof t == "string" && e.options.includes(t);
|
|
881
|
-
}
|
|
882
|
-
function Z(e) {
|
|
883
|
-
return Q(e) && e >= B && e <= V;
|
|
884
|
-
}
|
|
885
|
-
function Q(e) {
|
|
886
|
-
return typeof e == "number" && Number.isFinite(e);
|
|
887
|
-
}
|
|
888
|
-
function $(e) {
|
|
889
|
-
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
890
|
-
}
|
|
891
|
-
//#endregion
|
|
892
|
-
//#region ../plugin-sdk/dist/material-rendered-element.js
|
|
893
|
-
var We = ":host{contain:content}.frame{position:relative;box-sizing:border-box;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden}.frame>*{box-sizing:border-box;width:100%;height:100%;min-width:0;min-height:0}", Ge = 160;
|
|
894
|
-
function Ke(e, t) {
|
|
895
|
-
let n = e.ownerDocument, r = n.createElement("style");
|
|
896
|
-
r.textContent = We;
|
|
897
|
-
let i = n.createElement("div");
|
|
898
|
-
i.className = "frame", i.setAttribute("part", "frame"), e.replaceChildren(r, i);
|
|
899
|
-
let a = !1, o = (e, t) => {
|
|
900
|
-
i.replaceChildren(...e === void 0 ? [] : [e]), a = t;
|
|
901
|
-
}, s = (e, r) => {
|
|
902
|
-
let i = q(t.data, r);
|
|
903
|
-
if (t.data.kind === "rows" && i.rows.length === 0) {
|
|
904
|
-
o(te(n), !1);
|
|
905
|
-
return;
|
|
906
|
-
}
|
|
907
|
-
let a = n.createElement("div");
|
|
908
|
-
a.setAttribute("data-base-screen-material-root", "");
|
|
909
|
-
try {
|
|
910
|
-
t.render({
|
|
911
|
-
document: n,
|
|
912
|
-
root: a,
|
|
913
|
-
props: e.props,
|
|
914
|
-
style: e.style,
|
|
915
|
-
size: e.size,
|
|
916
|
-
mode: e.mode,
|
|
917
|
-
value: i.value,
|
|
918
|
-
rows: i.rows,
|
|
919
|
-
formatNumber: (t) => qe(t, e.props)
|
|
920
|
-
});
|
|
921
|
-
} catch (e) {
|
|
922
|
-
let t = e instanceof Error ? e.message : String(e);
|
|
923
|
-
o(f(n, "HOST_DATASET_INVALID", `组件渲染失败:${t}`.slice(0, Ge)), !1);
|
|
924
|
-
return;
|
|
925
|
-
}
|
|
926
|
-
o(a, !0);
|
|
927
|
-
};
|
|
928
|
-
return { update(e) {
|
|
929
|
-
let r = e.dataState;
|
|
930
|
-
if (t.data.kind === "none") {
|
|
931
|
-
s(e, void 0);
|
|
932
|
-
return;
|
|
933
|
-
}
|
|
934
|
-
if (r.status === "ready") {
|
|
935
|
-
s(e, r.value);
|
|
936
|
-
return;
|
|
937
|
-
}
|
|
938
|
-
if (a && r.status !== "error") return;
|
|
939
|
-
let i = ee(n, r);
|
|
940
|
-
o(i, !1);
|
|
941
|
-
} };
|
|
942
|
-
}
|
|
943
|
-
function qe(e, t) {
|
|
944
|
-
let n = typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
|
|
945
|
-
if (!Number.isFinite(n)) return "--";
|
|
946
|
-
let r = typeof t.decimals == "number" ? t.decimals : 0, i = Math.min(6, Math.max(0, Math.trunc(r))), a = t.thousandsSeparator === !0 ? n.toLocaleString("en-US", {
|
|
947
|
-
minimumFractionDigits: i,
|
|
948
|
-
maximumFractionDigits: i
|
|
949
|
-
}) : n.toFixed(i);
|
|
950
|
-
return `${typeof t.prefix == "string" ? t.prefix : ""}${a}${typeof t.unit == "string" ? t.unit : ""}`;
|
|
951
|
-
}
|
|
952
|
-
function Je(e) {
|
|
953
|
-
let t = globalThis.HTMLElement ?? class {}, n = {
|
|
954
|
-
data: e.data,
|
|
955
|
-
render: e.render
|
|
956
|
-
};
|
|
957
|
-
class r extends t {
|
|
958
|
-
#e;
|
|
959
|
-
#t;
|
|
960
|
-
get model() {
|
|
961
|
-
if (this.#e === void 0) throw Error("Material model has not been set.");
|
|
962
|
-
return this.#e;
|
|
963
|
-
}
|
|
964
|
-
set model(e) {
|
|
965
|
-
this.#e = e, this.setAttribute("data-base-screen-data-state", e.dataState.status), this.#n();
|
|
966
|
-
}
|
|
967
|
-
connectedCallback() {
|
|
968
|
-
this.#n();
|
|
969
|
-
}
|
|
970
|
-
#n() {
|
|
971
|
-
let e = this.#e;
|
|
972
|
-
e === void 0 || !this.isConnected || (this.#t ??= Ke(this.shadowRoot ?? this.attachShadow({ mode: "open" }), n), this.#t.update(e));
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
Object.defineProperty(r, "manifest", {
|
|
976
|
-
value: e.manifest,
|
|
977
|
-
configurable: !0
|
|
978
|
-
});
|
|
979
|
-
let i = K(e.data);
|
|
980
|
-
return i !== void 0 && Object.defineProperty(r, "tabularDataAdapter", { value: i }), r;
|
|
981
|
-
}
|
|
982
|
-
function Ye(e) {
|
|
983
|
-
if (typeof e.render != "function") return d("PLUGIN_CORE_LIFECYCLE_INVALID", ["render"], "渲染函数必须是函数。");
|
|
984
|
-
let t = H(e.spec);
|
|
985
|
-
if (!t.ok) return t;
|
|
986
|
-
let n = U(t.value, {
|
|
987
|
-
tagName: e.tagName,
|
|
988
|
-
...e.libraryVisible === void 0 ? {} : { libraryVisible: e.libraryVisible },
|
|
989
|
-
...e.cover === void 0 ? {} : { cover: e.cover }
|
|
990
|
-
});
|
|
991
|
-
if (!n.ok) return n;
|
|
992
|
-
let r = Je({
|
|
993
|
-
manifest: n.value,
|
|
994
|
-
data: t.value.data,
|
|
995
|
-
render: e.render
|
|
996
|
-
});
|
|
997
|
-
return u({
|
|
998
|
-
manifest: n.value,
|
|
999
|
-
element: r
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
|
-
//#endregion
|
|
1003
|
-
//#region ../plugin-sdk/dist/material-style-keys.js
|
|
1004
|
-
var Xe = /* @__PURE__ */ new Set(/* @__PURE__ */ "fill.backgroundColor.color.labelColor.accentColor.fontSize.labelFontSize.borderColor.borderWidth.borderRadius.strokeColor.strokeWidth.fontWeight.textAlign.verticalAlign.letterSpacing.lineHeight.lineSpacing.shadowColor.shadowBlur.shadowOffsetX.shadowOffsetY.criticalColor.warningColor.infoColor.runningColor.standbyColor.faultColor.offlineColor.unknownColor.positiveColor.negativeColor".split(".")), Ze = /* @__PURE__ */ new Set([
|
|
1005
|
-
"accent",
|
|
1006
|
-
"background",
|
|
1007
|
-
"connectorColor",
|
|
1008
|
-
"connectorWidth",
|
|
1009
|
-
"dash",
|
|
1010
|
-
"fillColor",
|
|
1011
|
-
"fillGlow",
|
|
1012
|
-
"gridColor",
|
|
1013
|
-
"headerBackgroundColor",
|
|
1014
|
-
"headerColor",
|
|
1015
|
-
"lineWidth",
|
|
1016
|
-
"nodeBackground",
|
|
1017
|
-
"nodeBorderColor",
|
|
1018
|
-
"objectFit",
|
|
1019
|
-
"rowHeight",
|
|
1020
|
-
"seriesColor",
|
|
1021
|
-
"thickness",
|
|
1022
|
-
"tileGap",
|
|
1023
|
-
"tileRadius",
|
|
1024
|
-
"trackColor",
|
|
1025
|
-
"valueColor",
|
|
1026
|
-
"waterColor",
|
|
1027
|
-
"waveColor"
|
|
1028
|
-
]), Qe = [
|
|
1029
|
-
"title",
|
|
1030
|
-
"caption",
|
|
1031
|
-
"description",
|
|
1032
|
-
"subtitle",
|
|
1033
|
-
"showTitle",
|
|
1034
|
-
"titleText"
|
|
1035
|
-
], $e = "base-screen-spec-audit", et = /* @__PURE__ */ new Set([...Qe, "label"]), tt = /标题|副标题|说明|描述|备注|注释/, nt = /^(?:empty|loading|error)(?:Text|Label|Message)$/, rt = 1920, it = 1080;
|
|
1036
|
-
function at(e, t = {}) {
|
|
1037
|
-
let n = H(e);
|
|
1038
|
-
if (!n.ok) return n.diagnostics.map((e) => ({
|
|
1039
|
-
rule: "SPEC",
|
|
1040
|
-
severity: "error",
|
|
1041
|
-
message: e.message,
|
|
1042
|
-
path: e.path
|
|
1043
|
-
}));
|
|
1044
|
-
let r = n.value, i = [];
|
|
1045
|
-
r.fields.forEach((e, t) => ot(e, t, i));
|
|
1046
|
-
let a = U(r, { tagName: $e });
|
|
1047
|
-
if (a.ok) for (let e of w(a.value)) i.push({
|
|
1048
|
-
rule: e.rule,
|
|
1049
|
-
severity: e.rule === "R9" ? "warning" : "error",
|
|
1050
|
-
message: e.message,
|
|
1051
|
-
...e.field === void 0 ? {} : { path: ut(r, e.field) }
|
|
1052
|
-
});
|
|
1053
|
-
else for (let e of a.diagnostics) i.push({
|
|
1054
|
-
rule: "SPEC",
|
|
1055
|
-
severity: "error",
|
|
1056
|
-
message: e.message,
|
|
1057
|
-
path: e.path
|
|
1058
|
-
});
|
|
1059
|
-
return r.data.kind === "rows" && r.data.sample.length === 0 && i.push({
|
|
1060
|
-
rule: "D1",
|
|
1061
|
-
severity: "warning",
|
|
1062
|
-
message: "多行组件没有示例行:预览与新插入的组件只能显示空态。",
|
|
1063
|
-
path: ["data", "sample"]
|
|
1064
|
-
}), (r.defaultSize.width > rt || r.defaultSize.height > it) && i.push({
|
|
1065
|
-
rule: "S1",
|
|
1066
|
-
severity: "warning",
|
|
1067
|
-
message: "默认尺寸超过一整屏:组件是设计稿上的一块,通常在 600×300 以内。",
|
|
1068
|
-
path: ["defaultSize"]
|
|
1069
|
-
}), t.renderSource !== void 0 && ct(t.renderSource, r, i), p(i);
|
|
1070
|
-
}
|
|
1071
|
-
function ot(e, t, n) {
|
|
1072
|
-
let r = ["fields", t];
|
|
1073
|
-
(et.has(e.key) || tt.test(e.label)) && n.push({
|
|
1074
|
-
rule: "T4",
|
|
1075
|
-
severity: "error",
|
|
1076
|
-
message: `「${e.label}」是描述性文案:组件只呈现读数,标题与说明用相邻的文本组件组合。`,
|
|
1077
|
-
path: r
|
|
1078
|
-
}), /(?:Column|Field)$/.test(e.key) && n.push({
|
|
1079
|
-
rule: "R7",
|
|
1080
|
-
severity: "error",
|
|
1081
|
-
message: `${e.key} 像是在手填列名:改成多行数据的一个角色,由数据面板绑定列。`,
|
|
1082
|
-
path: [...r, "key"]
|
|
1083
|
-
}), nt.test(e.key) && n.push({
|
|
1084
|
-
rule: "R8",
|
|
1085
|
-
severity: "error",
|
|
1086
|
-
message: `${e.key} 是状态文案:空态 / 加载态 / 错误态由 SDK 状态视图统一提供。`,
|
|
1087
|
-
path: [...r, "key"]
|
|
1088
|
-
});
|
|
1089
|
-
let i = O.find((t) => t.id === e.section)?.target;
|
|
1090
|
-
e.kind === "color" && i === "props" && n.push({
|
|
1091
|
-
rule: "P2",
|
|
1092
|
-
severity: "error",
|
|
1093
|
-
message: `颜色「${e.label}」是视觉量,放进文字 / 填充与描边 / 语义色分区,告警与主题才能改变它。`,
|
|
1094
|
-
path: [...r, "section"]
|
|
1095
|
-
}), i === "style" && !Xe.has(e.key) && !Ze.has(e.key) && n.push({
|
|
1096
|
-
rule: "R4",
|
|
1097
|
-
severity: "warning",
|
|
1098
|
-
message: `${e.key} 不在样式键词典里:能复用 color / fillColor / trackColor 等通用键时优先复用。`,
|
|
1099
|
-
path: [...r, "key"]
|
|
1100
|
-
});
|
|
1101
|
-
}
|
|
1102
|
-
var st = [
|
|
1103
|
-
{
|
|
1104
|
-
pattern: /\bfetch\s*\(|\bXMLHttpRequest\b|\bWebSocket\b|\bEventSource\b|\bsendBeacon\b|\bimport\s*\(/,
|
|
1105
|
-
severity: "error",
|
|
1106
|
-
message: "渲染代码不自行取数或加载代码:数据经数据源进入 value / rows。"
|
|
1107
|
-
},
|
|
1108
|
-
{
|
|
1109
|
-
pattern: /\blocalStorage\b|\bsessionStorage\b|\bindexedDB\b|document\.cookie/,
|
|
1110
|
-
severity: "error",
|
|
1111
|
-
message: "渲染代码不读写浏览器存储:组件状态只来自 props / style / 数据。"
|
|
1112
|
-
},
|
|
1113
|
-
{
|
|
1114
|
-
pattern: /getRootNode\s*\(|\.host\b|ownerDocument\.body|document\.(?:body|head|documentElement)/,
|
|
1115
|
-
severity: "error",
|
|
1116
|
-
message: "只在 root 里绘制:宿主元素与页面归渲染器所有(物料渲染盒不变式)。"
|
|
1117
|
-
},
|
|
1118
|
-
{
|
|
1119
|
-
pattern: /\bsetInterval\s*\(|\brequestAnimationFrame\s*\(/,
|
|
1120
|
-
severity: "warning",
|
|
1121
|
-
message: "每次数据或配置变化都会整体重绘:定时器与动画帧不会随之清理,动画请用 CSS。"
|
|
1122
|
-
},
|
|
1123
|
-
{
|
|
1124
|
-
pattern: /\b(?:innerHTML|outerHTML)\s*=|insertAdjacentHTML\s*\(/,
|
|
1125
|
-
severity: "warning",
|
|
1126
|
-
message: "用 textContent 呈现数据,避免把读数当作 HTML 解释。"
|
|
1127
|
-
}
|
|
1128
|
-
];
|
|
1129
|
-
function ct(e, t, n) {
|
|
1130
|
-
let r = lt(e);
|
|
1131
|
-
for (let e of st) e.pattern.test(r) && n.push({
|
|
1132
|
-
rule: "RENDER",
|
|
1133
|
-
severity: e.severity,
|
|
1134
|
-
message: e.message
|
|
1135
|
-
});
|
|
1136
|
-
r.trim() === "" && n.push({
|
|
1137
|
-
rule: "RENDER",
|
|
1138
|
-
severity: "error",
|
|
1139
|
-
message: "渲染代码为空。"
|
|
1140
|
-
}), t.data.kind === "none" && /\b(?:value|rows)\b/.test(r) && n.push({
|
|
1141
|
-
rule: "RENDER",
|
|
1142
|
-
severity: "warning",
|
|
1143
|
-
message: "组件声明为无数据,渲染代码却读了 value / rows:它们恒为空。"
|
|
1144
|
-
}), t.numberFormat !== void 0 && !/\bformatNumber\b/.test(r) && n.push({
|
|
1145
|
-
rule: "RENDER",
|
|
1146
|
-
severity: "warning",
|
|
1147
|
-
message: "开启了读数格式,但渲染代码没有调用 formatNumber:检查器里的小数位、单位不会生效。"
|
|
1148
|
-
});
|
|
1149
|
-
}
|
|
1150
|
-
function lt(e) {
|
|
1151
|
-
return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1");
|
|
1152
|
-
}
|
|
1153
|
-
function ut(e, t) {
|
|
1154
|
-
let n = e.fields.findIndex((e) => e.key === t);
|
|
1155
|
-
return n < 0 ? ["numberFormat"] : ["fields", n];
|
|
1156
|
-
}
|
|
1157
|
-
//#endregion
|
|
1158
|
-
//#region ../plugin-sdk/dist/plugin-package.js
|
|
1159
|
-
function dt(e) {
|
|
1160
|
-
let t = e;
|
|
1161
|
-
if (typeof t != "object" || !t || Array.isArray(t)) return d("PLUGIN_CORE_MANIFEST_NOT_OBJECT", [], "Plugin package options must be an object.");
|
|
1162
|
-
let n, r, i;
|
|
1163
|
-
try {
|
|
1164
|
-
n = t.id, r = t.plugin, i = t.materials;
|
|
1165
|
-
} catch {
|
|
1166
|
-
return d("PLUGIN_CORE_MANIFEST_FIELD_INVALID", [], "Plugin package options cannot be safely read.");
|
|
1167
|
-
}
|
|
1168
|
-
if (!pt(n)) return d("PLUGIN_CORE_IDENTITY_INVALID", ["id"], "Plugin package id must be an ASCII identifier.");
|
|
1169
|
-
if (typeof r != "object" || !r || Array.isArray(r)) return d("PLUGIN_CORE_MANIFEST_NOT_OBJECT", ["plugin"], "Plugin package runtime must be an object.");
|
|
1170
|
-
let a = ne(r);
|
|
1171
|
-
if (!a.ok) return l(a.diagnostics, ["plugin"]);
|
|
1172
|
-
let o;
|
|
1173
|
-
if (i !== void 0) {
|
|
1174
|
-
if (!Array.isArray(i)) return d("PLUGIN_CORE_MANIFEST_FIELD_INVALID", ["materials"], "Plugin package materials must be an array.");
|
|
1175
|
-
if (i.length > 0) {
|
|
1176
|
-
let e = D({
|
|
1177
|
-
id: n,
|
|
1178
|
-
materials: i
|
|
1179
|
-
});
|
|
1180
|
-
if (!e.ok) return e;
|
|
1181
|
-
o = e.value;
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
let s = o?.materials ?? Object.freeze([]);
|
|
1185
|
-
return {
|
|
1186
|
-
ok: !0,
|
|
1187
|
-
value: {
|
|
1188
|
-
id: n,
|
|
1189
|
-
plugin: a.value,
|
|
1190
|
-
materials: s,
|
|
1191
|
-
define: () => ft(a.value, o)
|
|
1192
|
-
},
|
|
1193
|
-
diagnostics: []
|
|
1194
|
-
};
|
|
1195
|
-
}
|
|
1196
|
-
function ft(e, t) {
|
|
1197
|
-
if (t === void 0) return {
|
|
1198
|
-
ok: !0,
|
|
1199
|
-
value: {
|
|
1200
|
-
runtime: e,
|
|
1201
|
-
materials: Object.freeze([])
|
|
1202
|
-
},
|
|
1203
|
-
diagnostics: []
|
|
1204
|
-
};
|
|
1205
|
-
let n = t.define();
|
|
1206
|
-
return n.ok ? {
|
|
1207
|
-
ok: !0,
|
|
1208
|
-
value: {
|
|
1209
|
-
runtime: e,
|
|
1210
|
-
materials: n.value
|
|
1211
|
-
},
|
|
1212
|
-
diagnostics: []
|
|
1213
|
-
} : n;
|
|
1214
|
-
}
|
|
1215
|
-
function pt(e) {
|
|
1216
|
-
return typeof e == "string" && e.length > 0 && e.length <= 128 && /^[A-Za-z0-9][A-Za-z0-9._:-]*$/.test(e);
|
|
1217
|
-
}
|
|
1218
|
-
//#endregion
|
|
1219
|
-
export { se as C, pe as S, p as T, w as _, Xe as a, v as b, Ye as c, U as d, K as f, D as g, H as h, Ze as i, qe as l, q as m, at as n, Je as o, G as p, Qe as r, Ke as s, dt as t, O as u, x as v, re as w, he as x, b as y };
|
|
1220
|
-
|
|
1221
|
-
//# sourceMappingURL=plugin-package-Dr5ro6h6.js.map
|