@dsh-workbench/shared 1.5.2-alpha.3 → 1.5.2-alpha.5
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/components/Activity.css +69 -0
- package/dist/components/Activity.d.ts +56 -0
- package/dist/components/Activity.js +47 -0
- package/dist/components/ApprovalDetail.css +3 -0
- package/dist/components/ApprovalDetail.d.ts +42 -0
- package/dist/components/ApprovalDetail.js +53 -0
- package/dist/components/ApprovalPlan.css +39 -0
- package/dist/components/ApprovalPlan.d.ts +27 -0
- package/dist/components/ApprovalPlan.js +19 -0
- package/dist/components/Card.css +19 -0
- package/dist/components/Card.d.ts +26 -0
- package/dist/components/Card.js +18 -0
- package/dist/components/CardAnchor.d.ts +21 -0
- package/dist/components/CardAnchor.js +19 -0
- package/dist/components/CardAnchor.module.css +3 -0
- package/dist/components/CardBoundary.d.ts +42 -0
- package/dist/components/CardBoundary.js +58 -0
- package/dist/components/CardBoundary.module.css +5 -0
- package/dist/components/CardHead.css +87 -0
- package/dist/components/CardHead.d.ts +30 -0
- package/dist/components/CardHead.js +27 -0
- package/dist/components/ChoiceGroup.css +182 -0
- package/dist/components/ChoiceGroup.d.ts +54 -0
- package/dist/components/ChoiceGroup.js +63 -0
- package/dist/components/ConfirmBar.css +26 -0
- package/dist/components/ConfirmBar.d.ts +36 -0
- package/dist/components/ConfirmBar.js +26 -0
- package/dist/components/EmptyIllustration.d.ts +12 -0
- package/dist/components/EmptyIllustration.js +32 -0
- package/dist/components/Field.css +20 -0
- package/dist/components/Field.d.ts +18 -0
- package/dist/components/Field.js +15 -0
- package/dist/components/Form.css +6 -0
- package/dist/components/Form.d.ts +22 -0
- package/dist/components/Form.js +60 -0
- package/dist/components/FormActions.css +13 -0
- package/dist/components/FormActions.d.ts +29 -0
- package/dist/components/FormActions.js +43 -0
- package/dist/components/FormNodes.d.ts +107 -0
- package/dist/components/FormNodes.js +165 -0
- package/dist/components/FormRows.css +107 -0
- package/dist/components/FormRows.d.ts +36 -0
- package/dist/components/FormRows.js +26 -0
- package/dist/components/FormTypes.d.ts +84 -0
- package/dist/components/FormTypes.js +1 -0
- package/dist/components/Link.css +22 -0
- package/dist/components/Link.d.ts +22 -0
- package/dist/components/Link.js +17 -0
- package/dist/components/LongTaskRow.css +171 -0
- package/dist/components/LongTaskRow.d.ts +94 -0
- package/dist/components/LongTaskRow.js +103 -0
- package/dist/components/Note.css +13 -0
- package/dist/components/Note.d.ts +20 -0
- package/dist/components/Note.js +14 -0
- package/dist/components/ResourceStates.css +114 -0
- package/dist/components/ResourceStates.d.ts +44 -0
- package/dist/components/ResourceStates.js +41 -0
- package/dist/components/Rows.css +42 -0
- package/dist/components/Rows.d.ts +28 -0
- package/dist/components/Rows.js +21 -0
- package/dist/components/SaveBar.d.ts +24 -0
- package/dist/components/SaveBar.js +25 -0
- package/dist/components/SelectField.css +182 -0
- package/dist/components/SelectField.d.ts +89 -0
- package/dist/components/SelectField.js +260 -0
- package/dist/components/SelectFieldNodes.d.ts +49 -0
- package/dist/components/SelectFieldNodes.js +43 -0
- package/dist/components/SettingsSection.css +25 -0
- package/dist/components/SettingsSection.d.ts +20 -0
- package/dist/components/SettingsSection.js +17 -0
- package/dist/components/SetupShell.d.ts +93 -0
- package/dist/components/SetupShell.js +64 -0
- package/dist/components/SetupShell.module.css +81 -0
- package/dist/components/Spinner.css +5 -0
- package/dist/components/Spinner.d.ts +15 -0
- package/dist/components/Spinner.js +13 -0
- package/dist/components/Stack.css +6 -0
- package/dist/components/Stack.d.ts +14 -0
- package/dist/components/Stack.js +10 -0
- package/dist/components/StateBlock.css +38 -0
- package/dist/components/StateBlock.d.ts +24 -0
- package/dist/components/StateBlock.js +22 -0
- package/dist/components/TextField.css +32 -0
- package/dist/components/TextField.d.ts +14 -0
- package/dist/components/TextField.js +10 -0
- package/dist/components/board-module.d.ts +307 -0
- package/dist/components/board-module.js +1 -0
- package/dist/components/card-view-validate.d.ts +5 -0
- package/dist/components/card-view-validate.js +256 -0
- package/dist/components/icons.d.ts +63 -0
- package/dist/components/icons.js +107 -0
- package/dist/components/layout/icon-command.d.ts +8 -0
- package/dist/components/layout/icon-command.js +21 -0
- package/dist/contract/capture.d.ts +16 -0
- package/dist/contract/capture.js +1 -0
- package/dist/contract/diagnostics.d.ts +34 -0
- package/dist/contract/diagnostics.js +124 -0
- package/dist/contract/protocol/unit-manager.d.ts +50 -0
- package/dist/contract/protocol/unit-manager.js +2 -0
- package/dist/host/adapter-contract.d.ts +3 -0
- package/dist/host/adapter-contract.js +95 -0
- package/dist/host/adapter-set.d.ts +27 -0
- package/dist/host/adapter-set.js +258 -0
- package/dist/host/adapter-types.d.ts +87 -0
- package/dist/host/adapter-types.js +23 -0
- package/dist/host/adapters/platform.d.ts +14 -0
- package/dist/host/adapters/platform.js +40 -0
- package/dist/host/adapters.d.ts +28 -0
- package/dist/host/adapters.js +9 -0
- package/dist/host/auth-loss.d.ts +33 -0
- package/dist/host/auth-loss.js +107 -0
- package/dist/host/board-fact.d.ts +8 -0
- package/dist/host/board-fact.js +16 -0
- package/dist/host/boot-record.d.ts +11 -0
- package/dist/host/boot-record.js +31 -0
- package/dist/host/browser.d.ts +3 -0
- package/dist/host/browser.js +3 -0
- package/dist/host/bundle-manager.d.ts +4 -0
- package/dist/host/bundle-manager.js +338 -0
- package/dist/host/changelog.d.ts +28 -0
- package/dist/host/changelog.js +201 -0
- package/dist/host/cli-error.d.ts +8 -0
- package/dist/host/cli-error.js +70 -0
- package/dist/host/cli.d.ts +4 -0
- package/dist/host/cli.js +9 -0
- package/dist/host/config-sync.d.ts +40 -0
- package/dist/host/config-sync.js +267 -0
- package/dist/host/context-ref.d.ts +13 -0
- package/dist/host/context-ref.js +41 -0
- package/dist/host/data-error.d.ts +15 -0
- package/dist/host/data-error.js +23 -0
- package/dist/host/data-plan-check.d.ts +10 -0
- package/dist/host/data-plan-check.js +315 -0
- package/dist/host/data-plan.d.ts +15 -0
- package/dist/host/data-plan.js +283 -0
- package/dist/host/data-root.d.ts +5 -0
- package/dist/host/data-root.js +23 -0
- package/dist/host/diy-debug.d.ts +80 -0
- package/dist/host/diy-debug.js +89 -0
- package/dist/host/diy-preset.d.ts +26 -0
- package/dist/host/diy-preset.js +115 -0
- package/dist/host/diy-record.d.ts +135 -0
- package/dist/host/diy-record.js +163 -0
- package/dist/host/dsh-compat.d.ts +27 -0
- package/dist/host/dsh-compat.js +75 -0
- package/dist/host/dsh-plugins.d.ts +5 -0
- package/dist/host/dsh-plugins.js +51 -0
- package/dist/host/env-policy.d.ts +82 -0
- package/dist/host/env-policy.js +181 -0
- package/dist/host/extension.d.ts +7 -0
- package/dist/host/extension.js +40 -0
- package/dist/host/facts.d.ts +31 -0
- package/dist/host/facts.js +58 -0
- package/dist/host/fs-write.d.ts +96 -0
- package/dist/host/fs-write.js +183 -0
- package/dist/host/git.d.ts +5 -0
- package/dist/host/git.js +1 -0
- package/dist/host/host-actions.d.ts +2 -0
- package/dist/host/host-actions.js +5 -0
- package/dist/host/host-kit.d.ts +37 -0
- package/dist/host/host-kit.js +27 -0
- package/dist/host/http.d.ts +47 -0
- package/dist/host/http.js +289 -0
- package/dist/host/install-failure.d.ts +50 -0
- package/dist/host/install-failure.js +184 -0
- package/dist/host/installed-module.d.ts +25 -0
- package/dist/host/installed-module.js +289 -0
- package/dist/host/installed-sources.d.ts +10 -0
- package/dist/host/installed-sources.js +63 -0
- package/dist/host/lease.d.ts +70 -0
- package/dist/host/lease.js +264 -0
- package/dist/host/lib-capabilities.d.ts +22 -0
- package/dist/host/lib-capabilities.js +37 -0
- package/dist/host/lib-install.d.ts +19 -0
- package/dist/host/lib-install.js +40 -0
- package/dist/host/lib-runners.d.ts +18 -0
- package/dist/host/lib-runners.js +46 -0
- package/dist/host/local-declaration.d.ts +7 -0
- package/dist/host/local-declaration.js +33 -0
- package/dist/host/long-task.d.ts +97 -0
- package/dist/host/long-task.js +297 -0
- package/dist/host/market-index-claim.d.ts +19 -0
- package/dist/host/market-index-claim.js +87 -0
- package/dist/host/market-index-doc.d.ts +12 -0
- package/dist/host/market-index-doc.js +1 -0
- package/dist/host/market-index-parse.d.ts +28 -0
- package/dist/host/market-index-parse.js +413 -0
- package/dist/host/market-index.d.ts +13 -0
- package/dist/host/market-index.js +105 -0
- package/dist/host/module-root.d.ts +1 -0
- package/dist/host/module-root.js +5 -0
- package/dist/host/needs.d.ts +4 -0
- package/dist/host/needs.js +2 -0
- package/dist/host/npm-registry.d.ts +10 -0
- package/dist/host/npm-registry.js +16 -0
- package/dist/host/package-content.d.ts +8 -0
- package/dist/host/package-content.js +90 -0
- package/dist/host/package-kind.d.ts +13 -0
- package/dist/host/package-kind.js +51 -0
- package/dist/host/package-route.d.ts +33 -0
- package/dist/host/package-route.js +68 -0
- package/dist/host/panel-state.d.ts +120 -0
- package/dist/host/panel-state.js +177 -0
- package/dist/host/patch-blocks.d.ts +13 -0
- package/dist/host/patch-blocks.js +52 -0
- package/dist/host/patch.d.ts +4 -0
- package/dist/host/patch.js +7 -0
- package/dist/host/paths.d.ts +12 -0
- package/dist/host/paths.js +20 -0
- package/dist/host/payload.d.ts +12 -0
- package/dist/host/payload.js +16 -0
- package/dist/host/plan-results.d.ts +5 -0
- package/dist/host/plan-results.js +71 -0
- package/dist/host/plan-run.d.ts +41 -0
- package/dist/host/plan-run.js +87 -0
- package/dist/host/platform.d.ts +14 -0
- package/dist/host/platform.js +40 -0
- package/dist/host/plugin-ledger.d.ts +32 -0
- package/dist/host/plugin-ledger.js +106 -0
- package/dist/host/plugin.d.ts +3 -0
- package/dist/host/plugin.js +38 -0
- package/dist/host/port-types.d.ts +233 -0
- package/dist/host/port-types.js +1 -0
- package/dist/host/preflight.d.ts +32 -0
- package/dist/host/preflight.js +1 -0
- package/dist/host/process-alive.d.ts +6 -0
- package/dist/host/process-alive.js +16 -0
- package/dist/host/profile-bundles.d.ts +20 -0
- package/dist/host/profile-bundles.js +48 -0
- package/dist/host/profile-create.d.ts +19 -0
- package/dist/host/profile-create.js +124 -0
- package/dist/host/profile-port.d.ts +4 -0
- package/dist/host/profile-port.js +4 -0
- package/dist/host/profile-registries.d.ts +10 -0
- package/dist/host/profile-registries.js +149 -0
- package/dist/host/provision.d.ts +32 -0
- package/dist/host/provision.js +105 -0
- package/dist/host/read-json.d.ts +1 -0
- package/dist/host/read-json.js +11 -0
- package/dist/host/recipe-rules.d.ts +5 -0
- package/dist/host/recipe-rules.js +412 -0
- package/dist/host/recipe.d.ts +14 -0
- package/dist/host/recipe.js +332 -0
- package/dist/host/registry-declaration.d.ts +21 -0
- package/dist/host/registry-declaration.js +42 -0
- package/dist/host/reinstall-record.d.ts +16 -0
- package/dist/host/reinstall-record.js +54 -0
- package/dist/host/release-age.d.ts +24 -0
- package/dist/host/release-age.js +92 -0
- package/dist/host/release-packages.generated.d.ts +1 -0
- package/dist/host/release-packages.generated.js +10 -0
- package/dist/host/release-probe.d.ts +37 -0
- package/dist/host/release-probe.js +156 -0
- package/dist/host/runtime/browser-argv.d.ts +1 -0
- package/dist/host/runtime/browser-argv.js +9 -0
- package/dist/host/runtime/dsh-compat.d.ts +1 -1
- package/dist/host/runtime/dsh-compat.js +4 -1
- package/dist/host/runtime/front-app.d.ts +6 -0
- package/dist/host/runtime/front-app.js +70 -0
- package/dist/host/shell-render.d.ts +52 -0
- package/dist/host/shell-render.js +117 -0
- package/dist/host/shell-text.d.ts +30 -0
- package/dist/host/shell-text.js +40 -0
- package/dist/host/shell.d.ts +25 -0
- package/dist/host/shell.js +55 -0
- package/dist/host/site.d.ts +45 -0
- package/dist/host/site.js +182 -0
- package/dist/host/spec.d.ts +8 -0
- package/dist/host/spec.js +24 -0
- package/dist/host/submit-confirm.d.ts +19 -0
- package/dist/host/submit-confirm.js +45 -0
- package/dist/host/supply-index.d.ts +38 -0
- package/dist/host/supply-index.js +209 -0
- package/dist/host/supply-port.d.ts +5 -0
- package/dist/host/supply-port.js +50 -0
- package/dist/host/time.d.ts +22 -0
- package/dist/host/time.js +33 -0
- package/dist/host/tokens.d.ts +26 -0
- package/dist/host/tokens.js +154 -0
- package/dist/host/tool-approval.d.ts +86 -0
- package/dist/host/tool-approval.js +118 -0
- package/dist/host/tool-kit.d.ts +8 -0
- package/dist/host/tool-kit.js +22 -0
- package/dist/host/toolbox-port.d.ts +16 -0
- package/dist/host/toolbox-port.js +1 -0
- package/dist/host/unit-config.d.ts +34 -0
- package/dist/host/unit-config.js +28 -0
- package/dist/host/unit-data.d.ts +3 -0
- package/dist/host/unit-data.js +127 -0
- package/dist/host/unit-face.d.ts +95 -0
- package/dist/host/unit-face.js +1 -0
- package/dist/host/unit-plugin.d.ts +24 -0
- package/dist/host/unit-plugin.js +25 -0
- package/dist/host/update-journal-manifest.d.ts +19 -0
- package/dist/host/update-journal-manifest.js +134 -0
- package/dist/host/update-journal-types.d.ts +33 -0
- package/dist/host/update-journal-types.js +2 -0
- package/dist/host/update-journal.d.ts +43 -0
- package/dist/host/update-journal.js +409 -0
- package/dist/host/value-handoff.d.ts +16 -0
- package/dist/host/value-handoff.js +22 -0
- package/dist/host/version-range.d.ts +2 -0
- package/dist/host/version-range.js +13 -0
- package/dist/host/version.d.ts +4 -0
- package/dist/host/version.js +32 -0
- package/dist/host/workspace-store.d.ts +19 -0
- package/dist/host/workspace-store.js +133 -0
- package/dist/host/write-result.d.ts +1 -0
- package/dist/host/write-result.js +18 -0
- package/dist/lib/dsh-client.d.ts +1 -1
- package/package.json +51 -47
- package/src/host/runtime/__tests__/dsh-compat.test.ts +10 -2
- package/src/host/runtime/dsh-compat.ts +4 -2
- package/src/lib/dsh-client.ts +2 -1
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 跑一遍 schema 卡的运行时形状检查:空数组 = 可用;否则是给人看的原因。
|
|
3
|
+
* 模块产物是 JS,类型挡不住漏字段或拼错的 section,外壳在挂卡之前用这条挡一次。
|
|
4
|
+
*/
|
|
5
|
+
export function cardViewProblemsOf(value) {
|
|
6
|
+
const reasons = [];
|
|
7
|
+
if (!isRecord(value))
|
|
8
|
+
return ['CardView 必须是对象'];
|
|
9
|
+
if (value.version !== 1)
|
|
10
|
+
reasons.push('CardView.version 必须是 1');
|
|
11
|
+
if (!isText(value.titleKey))
|
|
12
|
+
reasons.push('titleKey 必须是非空字符串');
|
|
13
|
+
if (value.idleKey !== undefined && typeof value.idleKey !== 'string') {
|
|
14
|
+
reasons.push('idleKey 必须是字符串');
|
|
15
|
+
}
|
|
16
|
+
if (value.meta !== undefined && typeof value.meta !== 'function') {
|
|
17
|
+
reasons.push('meta 必须是函数');
|
|
18
|
+
}
|
|
19
|
+
checkPlatform(value.platform, reasons);
|
|
20
|
+
if (value.platformOf !== undefined && typeof value.platformOf !== 'function') {
|
|
21
|
+
reasons.push('platformOf 必须是函数');
|
|
22
|
+
}
|
|
23
|
+
if (value.refreshMs !== undefined && !(typeof value.refreshMs === 'number' && value.refreshMs > 0)) {
|
|
24
|
+
reasons.push('refreshMs 必须是正数');
|
|
25
|
+
}
|
|
26
|
+
checkRead(value.read, reasons);
|
|
27
|
+
checkSections(value.sections, reasons);
|
|
28
|
+
checkSettings(value.settings, reasons);
|
|
29
|
+
checkActions(value.actions, reasons);
|
|
30
|
+
if (value.custom !== undefined && typeof value.custom !== 'function') {
|
|
31
|
+
reasons.push('custom 必须是函数');
|
|
32
|
+
}
|
|
33
|
+
if (value.customBody !== undefined && typeof value.customBody !== 'function') {
|
|
34
|
+
reasons.push('customBody 必须是函数');
|
|
35
|
+
}
|
|
36
|
+
if (value.customLongTask !== undefined && typeof value.customLongTask !== 'function') {
|
|
37
|
+
reasons.push('customLongTask 必须是函数');
|
|
38
|
+
}
|
|
39
|
+
return reasons;
|
|
40
|
+
}
|
|
41
|
+
function isRecord(value) {
|
|
42
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
43
|
+
}
|
|
44
|
+
function isText(value) {
|
|
45
|
+
return typeof value === 'string' && value !== '';
|
|
46
|
+
}
|
|
47
|
+
function checkPlatform(value, reasons) {
|
|
48
|
+
if (value === undefined)
|
|
49
|
+
return;
|
|
50
|
+
if (!isRecord(value)) {
|
|
51
|
+
reasons.push('platform 必须是对象');
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (!isText(value.href))
|
|
55
|
+
reasons.push('platform.href 必须是非空字符串');
|
|
56
|
+
if (!isText(value.labelKey))
|
|
57
|
+
reasons.push('platform.labelKey 必须是非空字符串');
|
|
58
|
+
}
|
|
59
|
+
function checkRead(value, reasons) {
|
|
60
|
+
if (!isRecord(value)) {
|
|
61
|
+
reasons.push('read 必须是对象');
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (!isText(value.route))
|
|
65
|
+
reasons.push('read.route 必须是非空字符串');
|
|
66
|
+
if (value.query !== undefined &&
|
|
67
|
+
!isRecord(value.query) &&
|
|
68
|
+
typeof value.query !== 'function') {
|
|
69
|
+
reasons.push('read.query 必须是对象或函数');
|
|
70
|
+
}
|
|
71
|
+
if (value.fact !== undefined && typeof value.fact !== 'string') {
|
|
72
|
+
reasons.push('read.fact 必须是字符串');
|
|
73
|
+
}
|
|
74
|
+
if (value.enabled !== undefined && typeof value.enabled !== 'function') {
|
|
75
|
+
reasons.push('read.enabled 必须是函数');
|
|
76
|
+
}
|
|
77
|
+
if (typeof value.map !== 'function')
|
|
78
|
+
reasons.push('read.map 必须是函数');
|
|
79
|
+
}
|
|
80
|
+
function checkSections(value, reasons) {
|
|
81
|
+
if (value === undefined)
|
|
82
|
+
return;
|
|
83
|
+
if (!isRecord(value)) {
|
|
84
|
+
reasons.push('sections 必须是对象');
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const known = new Set(['metrics', 'rows', 'activity', 'longTask']);
|
|
88
|
+
for (const [key, section] of Object.entries(value)) {
|
|
89
|
+
if (!known.has(key)) {
|
|
90
|
+
reasons.push(`不认识的 section:${key}`);
|
|
91
|
+
}
|
|
92
|
+
else if (typeof section !== 'function') {
|
|
93
|
+
reasons.push(`sections.${key} 必须是函数`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function checkSettings(value, reasons) {
|
|
98
|
+
if (value === undefined)
|
|
99
|
+
return;
|
|
100
|
+
if (!isRecord(value)) {
|
|
101
|
+
reasons.push('settings 必须是对象');
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (!isText(value.gearKey))
|
|
105
|
+
reasons.push('settings.gearKey 必须是非空字符串');
|
|
106
|
+
if (value.labelKey !== undefined && typeof value.labelKey !== 'string') {
|
|
107
|
+
reasons.push('settings.labelKey 必须是字符串');
|
|
108
|
+
}
|
|
109
|
+
if (!isText(value.titleKey))
|
|
110
|
+
reasons.push('settings.titleKey 必须是非空字符串');
|
|
111
|
+
checkFields(value.fields, reasons);
|
|
112
|
+
if (typeof value.values !== 'function')
|
|
113
|
+
reasons.push('settings.values 必须是函数');
|
|
114
|
+
checkSave(value.save, reasons);
|
|
115
|
+
checkLabels(value.labels, reasons);
|
|
116
|
+
}
|
|
117
|
+
function checkFields(value, reasons) {
|
|
118
|
+
if (!Array.isArray(value)) {
|
|
119
|
+
reasons.push('settings.fields 必须是数组');
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
value.forEach((field, index) => {
|
|
123
|
+
if (!isRecord(field)) {
|
|
124
|
+
reasons.push(`settings.fields[${String(index)}] 必须是对象`);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (!isText(field.key))
|
|
128
|
+
reasons.push(`settings.fields[${String(index)}].key 必须是非空字符串`);
|
|
129
|
+
if (!isText(field.labelKey)) {
|
|
130
|
+
reasons.push(`settings.fields[${String(index)}].labelKey 必须是非空字符串`);
|
|
131
|
+
}
|
|
132
|
+
if (field.hintKey !== undefined && typeof field.hintKey !== 'string') {
|
|
133
|
+
reasons.push(`settings.fields[${String(index)}].hintKey 必须是字符串`);
|
|
134
|
+
}
|
|
135
|
+
if (field.kind === 'select') {
|
|
136
|
+
if (field.options === undefined &&
|
|
137
|
+
field.optionsOf === undefined &&
|
|
138
|
+
field.load === undefined) {
|
|
139
|
+
reasons.push(`settings.fields[${String(index)}] 要有 options / optionsOf / load`);
|
|
140
|
+
}
|
|
141
|
+
if (field.options !== undefined)
|
|
142
|
+
checkOptions(field.options, index, reasons);
|
|
143
|
+
if (field.optionsOf !== undefined && typeof field.optionsOf !== 'function') {
|
|
144
|
+
reasons.push(`settings.fields[${String(index)}].optionsOf 必须是函数`);
|
|
145
|
+
}
|
|
146
|
+
if (field.load !== undefined)
|
|
147
|
+
checkLoad(field.load, index, reasons);
|
|
148
|
+
if (field.search !== undefined && typeof field.search !== 'boolean') {
|
|
149
|
+
reasons.push(`settings.fields[${String(index)}].search 必须是布尔值`);
|
|
150
|
+
}
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (field.kind !== 'text') {
|
|
154
|
+
reasons.push(`settings.fields[${String(index)}].kind 只支持 select / text`);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (field.placeholderKey !== undefined && typeof field.placeholderKey !== 'string') {
|
|
158
|
+
reasons.push(`settings.fields[${String(index)}].placeholderKey 必须是字符串`);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function checkOptions(value, index, reasons) {
|
|
163
|
+
if (!Array.isArray(value)) {
|
|
164
|
+
reasons.push(`settings.fields[${String(index)}].options 必须是数组`);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
value.forEach((option, optionIndex) => {
|
|
168
|
+
if (!isRecord(option)) {
|
|
169
|
+
reasons.push(`settings.fields[${String(index)}].options[${String(optionIndex)}] 必须是对象`);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (!isText(option.value)) {
|
|
173
|
+
reasons.push(`settings.fields[${String(index)}].options[${String(optionIndex)}].value 必须是非空字符串`);
|
|
174
|
+
}
|
|
175
|
+
if (!isText(option.labelKey) && !isText(option.label)) {
|
|
176
|
+
reasons.push(`settings.fields[${String(index)}].options[${String(optionIndex)}] 要有 label 或 labelKey`);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function checkLoad(value, index, reasons) {
|
|
181
|
+
if (!isRecord(value)) {
|
|
182
|
+
reasons.push(`settings.fields[${String(index)}].load 必须是对象`);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (!isText(value.route)) {
|
|
186
|
+
reasons.push(`settings.fields[${String(index)}].load.route 必须是非空字符串`);
|
|
187
|
+
}
|
|
188
|
+
if (value.query !== undefined &&
|
|
189
|
+
!isRecord(value.query) &&
|
|
190
|
+
typeof value.query !== 'function') {
|
|
191
|
+
reasons.push(`settings.fields[${String(index)}].load.query 必须是对象或函数`);
|
|
192
|
+
}
|
|
193
|
+
if (typeof value.pick !== 'function') {
|
|
194
|
+
reasons.push(`settings.fields[${String(index)}].load.pick 必须是函数`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function checkSave(value, reasons) {
|
|
198
|
+
if (!isRecord(value)) {
|
|
199
|
+
reasons.push('settings.save 必须是对象');
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (!isText(value.route))
|
|
203
|
+
reasons.push('settings.save.route 必须是非空字符串');
|
|
204
|
+
if (typeof value.body !== 'function')
|
|
205
|
+
reasons.push('settings.save.body 必须是函数');
|
|
206
|
+
if (value.openWhen !== undefined && typeof value.openWhen !== 'function') {
|
|
207
|
+
reasons.push('settings.openWhen 必须是函数');
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function checkLabels(value, reasons) {
|
|
211
|
+
if (!isRecord(value)) {
|
|
212
|
+
reasons.push('settings.labels 必须是对象');
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
for (const key of ['cancelKey', 'saveKey', 'savingKey', 'failedKey']) {
|
|
216
|
+
if (!isText(value[key]))
|
|
217
|
+
reasons.push(`settings.labels.${key} 必须是非空字符串`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function checkActions(value, reasons) {
|
|
221
|
+
if (value === undefined)
|
|
222
|
+
return;
|
|
223
|
+
if (!Array.isArray(value)) {
|
|
224
|
+
reasons.push('actions 必须是数组');
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
value.forEach((action, index) => {
|
|
228
|
+
if (!isRecord(action)) {
|
|
229
|
+
reasons.push(`actions[${String(index)}] 必须是对象`);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (!isText(action.labelKey) && !isText(action.label)) {
|
|
233
|
+
reasons.push(`actions[${String(index)}] 要有 label 或 labelKey`);
|
|
234
|
+
}
|
|
235
|
+
if (action.kind === 'open-url') {
|
|
236
|
+
if (!isText(action.href))
|
|
237
|
+
reasons.push(`actions[${String(index)}].href 必须是非空字符串`);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if (action.kind === 'chat') {
|
|
241
|
+
if (!isRecord(action.chip) || !isText(action.chip.kind) || !Array.isArray(action.chip.parts)) {
|
|
242
|
+
reasons.push(`actions[${String(index)}].chip 要有 kind 与 parts`);
|
|
243
|
+
}
|
|
244
|
+
if (action.chip !== undefined &&
|
|
245
|
+
isRecord(action.chip) &&
|
|
246
|
+
action.chip.label !== undefined &&
|
|
247
|
+
typeof action.chip.label !== 'string') {
|
|
248
|
+
reasons.push(`actions[${String(index)}].chip.label 必须是字符串`);
|
|
249
|
+
}
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (action.kind !== 'retry') {
|
|
253
|
+
reasons.push(`actions[${String(index)}].kind 只支持 open-url / retry / chat`);
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 自绘图标的契约:只给边长像素。
|
|
3
|
+
*/
|
|
4
|
+
export interface IconProps {
|
|
5
|
+
size?: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 会话图标:一枚对话气泡,dsh 的图标表里没有,留给我们自己用;默认 16px。
|
|
9
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
10
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
11
|
+
*/
|
|
12
|
+
export declare function IconConversation({ size }: IconProps): JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* 品牌标的几何:显示器框、脖子、底座、鲸鱼,四条 path,64 网格。
|
|
15
|
+
*/
|
|
16
|
+
export declare const BRAND_MARK_GEOMETRY: {
|
|
17
|
+
readonly body: "M15 6H49A9 9 0 0 1 58 15V38A9 9 0 0 1 49 47H15A9 9 0 0 1 6 38V15A9 9 0 0 1 15 6Z";
|
|
18
|
+
readonly neck: "M29 47H35L36.5 52H27.5Z";
|
|
19
|
+
readonly base: "M19 52H45A3 3 0 0 1 48 55V55A3 3 0 0 1 45 58H19A3 3 0 0 1 16 55V55A3 3 0 0 1 19 52Z";
|
|
20
|
+
readonly whale: "M 49.01 15.87 C 48.64 15.69 48.48 16.03 48.26 16.2 C 48.19 16.26 48.13 16.33 48.07 16.4 C 47.53 16.97 46.9 17.35 46.08 17.31 C 44.88 17.24 43.85 17.62 42.95 18.53 C 42.76 17.4 42.12 16.73 41.14 16.29 C 40.63 16.07 40.12 15.84 39.76 15.35 C 39.51 15 39.44 14.62 39.32 14.23 C 39.24 14 39.16 13.77 38.89 13.73 C 38.61 13.68 38.49 13.92 38.38 14.13 C 37.93 14.95 37.75 15.87 37.77 16.79 C 37.81 18.87 38.68 20.52 40.43 21.7 C 40.63 21.84 40.68 21.97 40.62 22.17 C 40.5 22.57 40.36 22.97 40.23 23.37 C 40.15 23.63 40.03 23.69 39.76 23.58 C 38.8 23.18 37.97 22.58 37.24 21.87 C 36 20.67 34.88 19.35 33.48 18.31 C 33.15 18.07 32.83 17.84 32.49 17.63 C 31.06 16.24 32.67 15.1 33.05 14.97 C 33.44 14.83 33.18 14.34 31.92 14.35 C 30.66 14.36 29.5 14.78 28.03 15.34 C 27.81 15.43 27.59 15.49 27.36 15.54 C 26.02 15.29 24.63 15.23 23.18 15.39 C 20.45 15.7 18.28 16.99 16.67 19.19 C 14.75 21.84 14.3 24.84 14.85 27.98 C 15.43 31.29 17.12 34.02 19.71 36.16 C 22.4 38.38 25.5 39.47 29.03 39.26 C 31.18 39.14 33.57 38.85 36.26 36.57 C 36.94 36.91 37.65 37.04 38.84 37.14 C 39.75 37.23 40.63 37.1 41.31 36.96 C 42.37 36.73 42.3 35.75 41.91 35.57 C 38.79 34.11 39.48 34.7 38.85 34.23 C 40.44 32.35 42.86 29.02 43.61 24.48 C 43.68 23.98 43.77 23.27 43.76 22.87 C 43.76 22.62 43.81 22.52 44.1 22.49 C 44.88 22.4 45.64 22.19 46.33 21.81 C 48.35 20.7 49.17 18.89 49.36 16.72 C 49.39 16.38 49.36 16.04 49.01 15.87 Z M 31.39 35.43 C 28.37 33.05 26.9 32.27 26.3 32.3 C 25.73 32.34 25.83 32.99 25.96 33.41 C 26.09 33.83 26.26 34.11 26.5 34.48 C 26.66 34.72 26.77 35.08 26.33 35.35 C 25.36 35.95 23.66 35.15 23.59 35.11 C 21.62 33.95 19.97 32.42 18.81 30.32 C 17.69 28.31 17.03 26.14 16.93 23.84 C 16.9 23.28 17.06 23.08 17.62 22.98 C 18.35 22.84 19.1 22.82 19.83 22.92 C 22.92 23.37 25.54 24.75 27.75 26.94 C 29 28.18 29.95 29.67 30.93 31.12 C 31.98 32.67 33.1 34.14 34.52 35.34 C 35.03 35.76 35.43 36.09 35.81 36.32 C 34.65 36.45 32.72 36.48 31.39 35.43 L 31.39 35.43 Z M 32.84 26.11 C 32.84 25.86 33.04 25.67 33.29 25.67 C 33.34 25.67 33.4 25.68 33.44 25.69 C 33.5 25.72 33.56 25.75 33.61 25.8 C 33.69 25.88 33.73 25.99 33.73 26.11 C 33.73 26.36 33.53 26.55 33.28 26.55 C 33.03 26.55 32.84 26.36 32.84 26.11 Z M 37.34 28.42 C 37.05 28.54 36.76 28.64 36.49 28.65 C 36.06 28.67 35.59 28.5 35.33 28.28 C 34.94 27.95 34.65 27.77 34.53 27.19 C 34.48 26.94 34.51 26.55 34.56 26.33 C 34.66 25.86 34.55 25.56 34.21 25.28 C 33.94 25.06 33.59 24.99 33.22 24.99 C 33.07 24.99 32.94 24.93 32.85 24.88 C 32.69 24.8 32.56 24.61 32.68 24.36 C 32.72 24.29 32.91 24.09 32.96 24.06 C 33.48 23.77 34.07 23.86 34.62 24.08 C 35.13 24.29 35.51 24.67 36.07 25.21 C 36.63 25.87 36.74 26.05 37.06 26.54 C 37.31 26.92 37.55 27.32 37.7 27.77 C 37.8 28.05 37.68 28.28 37.34 28.42 Z";
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* 品牌标的彩色:整枚标一个实心蓝,不跟主题走。
|
|
24
|
+
*/
|
|
25
|
+
export declare const BRAND_MARK_COLORS: {
|
|
26
|
+
readonly mark: "#658EFF";
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* 品牌标:一台显示器,屏幕里放着 dsh 官方的鲸鱼标;默认 24px(它是品牌物,别拿它当通用图标)。
|
|
30
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
31
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
32
|
+
*/
|
|
33
|
+
export declare function IconBrandMark({ size }: IconProps): JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* 品牌标的彩色版:市场里工作台那一行用;颜色写死,不跟主题走。默认 24px。
|
|
36
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
37
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
38
|
+
*/
|
|
39
|
+
export declare function IconBrandMarkColor({ size }: IconProps): JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* opencli 的标:包类型那一格用它;颜色写死的品牌物,不跟主题走。默认 16px。
|
|
42
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
43
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
44
|
+
*/
|
|
45
|
+
export declare function IconOpencli({ size }: IconProps): JSX.Element;
|
|
46
|
+
/**
|
|
47
|
+
* npm 的标:包类型那一格用它;保留品牌红,不跟主题走。默认 16px。
|
|
48
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
49
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
50
|
+
*/
|
|
51
|
+
export declare function IconNpm({ size }: IconProps): JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* 模块类型标:渐变方块 + 白四宫格,用在"这是个模块"的行首;品牌物,颜色不跟主题走。默认 16px。
|
|
54
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
55
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
56
|
+
*/
|
|
57
|
+
export declare function IconModuleMark({ size }: IconProps): JSX.Element;
|
|
58
|
+
/**
|
|
59
|
+
* 面板 / 卡片那类的图标:整屏与柱状那种形状,给"面板"这一档用;默认 16px。
|
|
60
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
61
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
62
|
+
*/
|
|
63
|
+
export declare function IconPanelScreen({ size }: IconProps): JSX.Element;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { h } from '../lib/react.js';
|
|
2
|
+
function Shell({ size, strokeWidth = 1, viewBox = '0 0 16 16', children, }) {
|
|
3
|
+
return (h("svg", { width: size, height: size, viewBox: viewBox, fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", strokeWidth: strokeWidth, style: { display: 'block' } }, children));
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* 会话图标:一枚对话气泡,dsh 的图标表里没有,留给我们自己用;默认 16px。
|
|
7
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
8
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
9
|
+
*/
|
|
10
|
+
export function IconConversation({ size = 16 }) {
|
|
11
|
+
return (h(Shell, { size: size, strokeWidth: 1.3 },
|
|
12
|
+
h("path", { d: "M2.5 7.2c0-2.3 2.1-4.2 4.8-4.2h1.4c2.7 0 4.8 1.9 4.8 4.2s-2.1 4.2-4.8 4.2H7.5l-3.2 2v-2.3c-1.1-.8-1.8-2-1.8-3.9Z", stroke: "currentColor", strokeLinejoin: "round" })));
|
|
13
|
+
}
|
|
14
|
+
const BRAND_BODY = 'M15 6H49A9 9 0 0 1 58 15V38A9 9 0 0 1 49 47H15A9 9 0 0 1 6 38V15A9 9 0 0 1 15 6Z';
|
|
15
|
+
const BRAND_NECK = 'M29 47H35L36.5 52H27.5Z';
|
|
16
|
+
const BRAND_BASE = 'M19 52H45A3 3 0 0 1 48 55V55A3 3 0 0 1 45 58H19A3 3 0 0 1 16 55V55A3 3 0 0 1 19 52Z';
|
|
17
|
+
const BRAND_WHALE = 'M 49.01 15.87 C 48.64 15.69 48.48 16.03 48.26 16.2 C 48.19 16.26 48.13 16.33 48.07 16.4 C 47.53 16.97 46.9 17.35 46.08 17.31 C 44.88 17.24 43.85 17.62 42.95 18.53 C 42.76 17.4 42.12 16.73 41.14 16.29 C 40.63 16.07 40.12 15.84 39.76 15.35 C 39.51 15 39.44 14.62 39.32 14.23 C 39.24 14 39.16 13.77 38.89 13.73 C 38.61 13.68 38.49 13.92 38.38 14.13 C 37.93 14.95 37.75 15.87 37.77 16.79 C 37.81 18.87 38.68 20.52 40.43 21.7 C 40.63 21.84 40.68 21.97 40.62 22.17 C 40.5 22.57 40.36 22.97 40.23 23.37 C 40.15 23.63 40.03 23.69 39.76 23.58 C 38.8 23.18 37.97 22.58 37.24 21.87 C 36 20.67 34.88 19.35 33.48 18.31 C 33.15 18.07 32.83 17.84 32.49 17.63 C 31.06 16.24 32.67 15.1 33.05 14.97 C 33.44 14.83 33.18 14.34 31.92 14.35 C 30.66 14.36 29.5 14.78 28.03 15.34 C 27.81 15.43 27.59 15.49 27.36 15.54 C 26.02 15.29 24.63 15.23 23.18 15.39 C 20.45 15.7 18.28 16.99 16.67 19.19 C 14.75 21.84 14.3 24.84 14.85 27.98 C 15.43 31.29 17.12 34.02 19.71 36.16 C 22.4 38.38 25.5 39.47 29.03 39.26 C 31.18 39.14 33.57 38.85 36.26 36.57 C 36.94 36.91 37.65 37.04 38.84 37.14 C 39.75 37.23 40.63 37.1 41.31 36.96 C 42.37 36.73 42.3 35.75 41.91 35.57 C 38.79 34.11 39.48 34.7 38.85 34.23 C 40.44 32.35 42.86 29.02 43.61 24.48 C 43.68 23.98 43.77 23.27 43.76 22.87 C 43.76 22.62 43.81 22.52 44.1 22.49 C 44.88 22.4 45.64 22.19 46.33 21.81 C 48.35 20.7 49.17 18.89 49.36 16.72 C 49.39 16.38 49.36 16.04 49.01 15.87 Z M 31.39 35.43 C 28.37 33.05 26.9 32.27 26.3 32.3 C 25.73 32.34 25.83 32.99 25.96 33.41 C 26.09 33.83 26.26 34.11 26.5 34.48 C 26.66 34.72 26.77 35.08 26.33 35.35 C 25.36 35.95 23.66 35.15 23.59 35.11 C 21.62 33.95 19.97 32.42 18.81 30.32 C 17.69 28.31 17.03 26.14 16.93 23.84 C 16.9 23.28 17.06 23.08 17.62 22.98 C 18.35 22.84 19.1 22.82 19.83 22.92 C 22.92 23.37 25.54 24.75 27.75 26.94 C 29 28.18 29.95 29.67 30.93 31.12 C 31.98 32.67 33.1 34.14 34.52 35.34 C 35.03 35.76 35.43 36.09 35.81 36.32 C 34.65 36.45 32.72 36.48 31.39 35.43 L 31.39 35.43 Z M 32.84 26.11 C 32.84 25.86 33.04 25.67 33.29 25.67 C 33.34 25.67 33.4 25.68 33.44 25.69 C 33.5 25.72 33.56 25.75 33.61 25.8 C 33.69 25.88 33.73 25.99 33.73 26.11 C 33.73 26.36 33.53 26.55 33.28 26.55 C 33.03 26.55 32.84 26.36 32.84 26.11 Z M 37.34 28.42 C 37.05 28.54 36.76 28.64 36.49 28.65 C 36.06 28.67 35.59 28.5 35.33 28.28 C 34.94 27.95 34.65 27.77 34.53 27.19 C 34.48 26.94 34.51 26.55 34.56 26.33 C 34.66 25.86 34.55 25.56 34.21 25.28 C 33.94 25.06 33.59 24.99 33.22 24.99 C 33.07 24.99 32.94 24.93 32.85 24.88 C 32.69 24.8 32.56 24.61 32.68 24.36 C 32.72 24.29 32.91 24.09 32.96 24.06 C 33.48 23.77 34.07 23.86 34.62 24.08 C 35.13 24.29 35.51 24.67 36.07 25.21 C 36.63 25.87 36.74 26.05 37.06 26.54 C 37.31 26.92 37.55 27.32 37.7 27.77 C 37.8 28.05 37.68 28.28 37.34 28.42 Z';
|
|
18
|
+
/**
|
|
19
|
+
* 品牌标的几何:显示器框、脖子、底座、鲸鱼,四条 path,64 网格。
|
|
20
|
+
*/
|
|
21
|
+
export const BRAND_MARK_GEOMETRY = {
|
|
22
|
+
body: BRAND_BODY,
|
|
23
|
+
neck: BRAND_NECK,
|
|
24
|
+
base: BRAND_BASE,
|
|
25
|
+
whale: BRAND_WHALE,
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* 品牌标的彩色:整枚标一个实心蓝,不跟主题走。
|
|
29
|
+
*/
|
|
30
|
+
export const BRAND_MARK_COLORS = {
|
|
31
|
+
mark: '#658EFF',
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* 品牌标:一台显示器,屏幕里放着 dsh 官方的鲸鱼标;默认 24px(它是品牌物,别拿它当通用图标)。
|
|
35
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
36
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
37
|
+
*/
|
|
38
|
+
export function IconBrandMark({ size = 24 }) {
|
|
39
|
+
return (h(Shell, { size: size, viewBox: "0 0 64 64" },
|
|
40
|
+
h("path", { d: BRAND_BODY, stroke: "currentColor", strokeWidth: 4 }),
|
|
41
|
+
h("path", { d: BRAND_NECK, fill: "currentColor" }),
|
|
42
|
+
h("path", { d: BRAND_BASE, fill: "currentColor" }),
|
|
43
|
+
h("path", { d: BRAND_WHALE, fill: "currentColor" })));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 品牌标的彩色版:市场里工作台那一行用;颜色写死,不跟主题走。默认 24px。
|
|
47
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
48
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
49
|
+
*/
|
|
50
|
+
export function IconBrandMarkColor({ size = 24 }) {
|
|
51
|
+
return (h(Shell, { size: size, viewBox: "0 0 64 64" },
|
|
52
|
+
h("path", { d: BRAND_BODY, stroke: BRAND_MARK_COLORS.mark, strokeWidth: 4 }),
|
|
53
|
+
h("path", { d: BRAND_NECK, fill: BRAND_MARK_COLORS.mark }),
|
|
54
|
+
h("path", { d: BRAND_BASE, fill: BRAND_MARK_COLORS.mark }),
|
|
55
|
+
h("path", { d: BRAND_WHALE, fill: BRAND_MARK_COLORS.mark })));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* opencli 的标:包类型那一格用它;颜色写死的品牌物,不跟主题走。默认 16px。
|
|
59
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
60
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
61
|
+
*/
|
|
62
|
+
export function IconOpencli({ size = 16 }) {
|
|
63
|
+
return (h(Shell, { size: size, viewBox: "0 0 64 64" },
|
|
64
|
+
h("defs", null,
|
|
65
|
+
h("linearGradient", { id: "opencli-mark", x1: "0%", y1: "0%", x2: "100%", y2: "100%" },
|
|
66
|
+
h("stop", { offset: "0%", stopColor: "#00e5a0" }),
|
|
67
|
+
h("stop", { offset: "50%", stopColor: "#00b4d8" }),
|
|
68
|
+
h("stop", { offset: "100%", stopColor: "#7b61ff" }))),
|
|
69
|
+
h("rect", { width: 64, height: 64, rx: 14, fill: "#0a0a0f" }),
|
|
70
|
+
h("text", { x: "50%", y: "54%", dominantBaseline: "middle", textAnchor: "middle", fontFamily: "monospace", fontWeight: 700, fontSize: 28, fill: "url(#opencli-mark)" }, ">_")));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* npm 的标:包类型那一格用它;保留品牌红,不跟主题走。默认 16px。
|
|
74
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
75
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
76
|
+
*/
|
|
77
|
+
export function IconNpm({ size = 16 }) {
|
|
78
|
+
return (h(Shell, { size: size, viewBox: "0 0 1024 1024" },
|
|
79
|
+
h("path", { d: "M64 337.76h896v298.72H512v49.792H312.896v-49.824H64z m49.792 248.928h99.552v-149.376h49.76v149.344h49.792v-199.104H113.792z m248.896-199.136v248.928h99.552v-49.792h99.552v-199.136z m99.552 49.792H512v99.584h-49.792z m149.344-49.792v199.136h99.552v-149.376h49.792v149.344h49.792v-149.344h49.792v149.344h49.792v-199.104z", fill: "#CB3837" })));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 模块类型标:渐变方块 + 白四宫格,用在"这是个模块"的行首;品牌物,颜色不跟主题走。默认 16px。
|
|
83
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
84
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
85
|
+
*/
|
|
86
|
+
export function IconModuleMark({ size = 16 }) {
|
|
87
|
+
return (h(Shell, { size: size, viewBox: "0 0 24 24" },
|
|
88
|
+
h("defs", null,
|
|
89
|
+
h("linearGradient", { id: "workbench-module-mark", x1: "0%", y1: "0%", x2: "100%", y2: "100%" },
|
|
90
|
+
h("stop", { offset: "0%", stopColor: "#3b82f6" }),
|
|
91
|
+
h("stop", { offset: "55%", stopColor: "#8b5cf6" }),
|
|
92
|
+
h("stop", { offset: "100%", stopColor: "#14b8a6" }))),
|
|
93
|
+
h("rect", { width: 24, height: 24, rx: 7, fill: "url(#workbench-module-mark)" }),
|
|
94
|
+
h("rect", { x: "4.6", y: "4.6", width: "6.2", height: "6.2", rx: "1.9", fill: "#ffffff" }),
|
|
95
|
+
h("rect", { x: "13.2", y: "4.6", width: "6.2", height: "6.2", rx: "1.9", fill: "#ffffff", fillOpacity: 0.78 }),
|
|
96
|
+
h("rect", { x: "4.6", y: "13.2", width: "6.2", height: "6.2", rx: "1.9", fill: "#ffffff", fillOpacity: 0.78 }),
|
|
97
|
+
h("rect", { x: "13.2", y: "13.2", width: "6.2", height: "6.2", rx: "1.9", fill: "#ffffff" })));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 面板 / 卡片那类的图标:整屏与柱状那种形状,给"面板"这一档用;默认 16px。
|
|
101
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
102
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
103
|
+
*/
|
|
104
|
+
export function IconPanelScreen({ size = 16 }) {
|
|
105
|
+
return (h("svg", { width: size, height: size, viewBox: "0 0 1024 1024", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", style: { display: 'block', overflow: 'hidden' } },
|
|
106
|
+
h("path", { d: "M939 112c17.673 0 32 14.327 32 32v554.667c0 17.673-14.327 32-32 32l-394.5-0.001v96c0 3.74-0.642 7.331-1.82 10.668H768.4c17.673 0 32 14.326 32 32 0 17.496-14.042 31.712-31.47 31.995l-0.53 0.004H256.6c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.995l0.53-0.005h225.721a31.923 31.923 0 0 1-1.817-10.137l-0.004-0.53v-96H86c-17.496 0-31.713-14.041-31.996-31.47l-0.004-0.53V144c0-17.673 14.327-32 32-32z m-32 64H118v490.666h789V176zM341.9 432c17.496 0 31.713 14.042 31.996 31.47l0.004 0.53v85.333c0 17.673-14.327 32-32 32-17.496 0-31.713-14.041-31.996-31.47l-0.004-0.53V464c0-17.673 14.327-32 32-32z m170.6-85.333c17.496 0 31.713 14.041 31.996 31.47l0.004 0.53v170.666c0 17.673-14.327 32-32 32-17.496 0-31.713-14.041-31.996-31.47l-0.004-0.53V378.667c0-17.673 14.327-32 32-32z m170.6-85.334c17.496 0 31.713 14.042 31.996 31.471l0.004 0.53v256c0 17.672-14.327 32-32 32-17.496 0-31.713-14.042-31.996-31.471l-0.004-0.53v-256c0-17.673 14.327-32 32-32z" })));
|
|
107
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 命令类型标:一枚终端窗口(第三方图标,配色固定、不跟主题走,出处见 THIRD-PARTY-NOTICES)。默认 16px。
|
|
3
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
4
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
5
|
+
*/
|
|
6
|
+
export declare function IconCommand({ size }: {
|
|
7
|
+
readonly size?: number | undefined;
|
|
8
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { h } from '../../lib/react.js';
|
|
2
|
+
/**
|
|
3
|
+
* 命令类型标:一枚终端窗口(第三方图标,配色固定、不跟主题走,出处见 THIRD-PARTY-NOTICES)。默认 16px。
|
|
4
|
+
* @param props.size - 边长像素,同时给 `width` 与 `height`。
|
|
5
|
+
* @returns 一枚 `aria-hidden` 的 svg。
|
|
6
|
+
*/
|
|
7
|
+
export function IconCommand({ size = 16 }) {
|
|
8
|
+
return (h("svg", { width: size, height: size, viewBox: "0 0 50 50", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", style: { display: 'block' } },
|
|
9
|
+
h("path", { fill: "#df4bb1", d: "M17.87,6.493c-2.228,0.341-4.516,0.741-6.651,1.481c-1.643,0.57-3.221,1.459-4.131,2.978 c-0.043,0.057-0.092,0.105-0.133,0.165c-1.022,1.494-1.334,3.36-1.505,5.124c-0.224,2.313-0.299,4.648-0.298,6.971 c0.002,4.563,0.413,9.118,1.164,13.618c0.011,0.152,0.018,0.304,0.03,0.456c0.054,0.661,0.147,1.343,0.387,1.964 c0.003,0.014,0.005,0.028,0.007,0.042c0.006,0.031,0.022,0.05,0.032,0.077c0.006,0.013,0.011,0.026,0.017,0.039 c0.017,0.035,0.032,0.071,0.055,0.098c0.084,0.177,0.174,0.353,0.292,0.514c0.623,0.854,1.629,1.186,2.628,1.368 c1.189,0.216,2.396,0.36,3.601,0.453c0.36,0.028,0.721,0.038,1.082,0.056c1.572,0.138,3.149,0.221,4.725,0.252 c5.325,0.108,10.653-0.292,15.957-0.723c2.123-0.173,4.206-0.584,5.494-2.446c0.38-0.55,0.637-1.146,0.819-1.766 c0.729-1.332,1.315-4.534,1.326-4.654c0.231-2.66-0.081-14.279-0.4-16.421c-0.293-1.973-0.647-4.062-1.482-5.889 c-0.764-1.67-2.109-2.77-3.845-3.326c-1.888-0.605-3.972-0.753-5.938-0.913C26.692,5.655,22.245,5.824,17.87,6.493z" }),
|
|
10
|
+
h("path", { fill: "#429ad4", d: "M47.525,8.302c-0.509,0.044-1.02,0.031-1.527-0.037c0.089,0.012,0.177,0.024,0.266,0.036 c-0.348-0.049-0.691-0.123-1.027-0.223c-0.501-0.148-1.112,0.179-1.23,0.698c-0.122,0.537,0.161,1.071,0.698,1.23 c0.906,0.268,1.878,0.376,2.82,0.295c0.27-0.023,0.51-0.096,0.707-0.293c0.173-0.173,0.304-0.458,0.293-0.707 c-0.012-0.259-0.097-0.527-0.293-0.707C48.046,8.425,47.786,8.28,47.525,8.302L47.525,8.302z" }),
|
|
11
|
+
h("path", { fill: "#429ad4", d: "M43.397,6.716c0.772-0.995,1.478-2.031,2.088-3.133c0.253-0.458,0.126-1.112-0.359-1.368 c-0.47-0.248-1.098-0.13-1.368,0.359c-0.559,1.01-1.193,1.975-1.898,2.888c0.052-0.067,0.104-0.135,0.156-0.202 c-0.011,0.014-0.022,0.028-0.033,0.043c-0.17,0.219-0.293,0.417-0.293,0.707c0,0.245,0.109,0.538,0.293,0.707 c0.191,0.175,0.441,0.305,0.707,0.293C42.935,6.998,43.239,6.92,43.397,6.716L43.397,6.716z" }),
|
|
12
|
+
h("path", { fill: "#429ad4", d: "M40.69,4.106c-0.108-0.281-0.216-0.562-0.325-0.842c-0.031-0.13-0.091-0.243-0.179-0.34 c-0.071-0.109-0.164-0.195-0.281-0.258c-0.115-0.073-0.239-0.113-0.372-0.119c-0.133-0.03-0.266-0.024-0.399,0.018 c-0.08,0.034-0.159,0.067-0.239,0.101c-0.15,0.089-0.27,0.208-0.359,0.359c-0.034,0.08-0.067,0.159-0.101,0.239 c-0.048,0.177-0.048,0.354,0,0.532c0.108,0.281,0.216,0.562,0.325,0.842c0.031,0.13,0.091,0.243,0.179,0.34 c0.071,0.109,0.164,0.195,0.281,0.258c0.115,0.073,0.239,0.113,0.372,0.119c0.133,0.03,0.266,0.024,0.399-0.018 c0.08-0.034,0.159-0.067,0.239-0.101c0.15-0.089,0.27-0.208,0.359-0.359c0.034-0.08,0.067-0.159,0.101-0.239 C40.737,4.46,40.737,4.283,40.69,4.106L40.69,4.106z" }),
|
|
13
|
+
h("path", { fill: "#231f20", d: "M8.905,14.313c9.749-0.63,19.525-0.798,29.291-0.502c0.644,0.019,0.643-0.981,0-1 c-9.765-0.295-19.541-0.128-29.291,0.502C8.266,13.355,8.261,14.355,8.905,14.313L8.905,14.313z" }),
|
|
14
|
+
h("path", { fill: "#231f20", d: "M16.529,9.632c-0.779-0.71-2.002-0.983-2.973-0.511c-0.218,0.106-0.406,0.274-0.569,0.451 c-0.12,0.13-0.267,0.283-0.357,0.436c-0.248,0.422-0.247,1.027-0.178,1.493c0.149,0.996,0.884,1.828,1.857,2.092 c0.977,0.265,1.985-0.113,2.574-0.927C17.564,11.724,17.342,10.419,16.529,9.632c-0.463-0.448-1.171,0.259-0.707,0.707 c0.242,0.234,0.37,0.479,0.452,0.813c0.061,0.248-0.001,0.576-0.114,0.786c-0.147,0.274-0.323,0.448-0.596,0.595 c-0.031,0.017-0.063,0.033-0.095,0.048c0.065-0.03-0.036,0.014-0.052,0.019c-0.075,0.026-0.152,0.045-0.23,0.063 c-0.098,0.023-0.057,0.011-0.032,0.007c-0.046,0.006-0.092,0.008-0.138,0.009c-0.046,0.001-0.092,0.001-0.138-0.001 c-0.014-0.001-0.161-0.014-0.087-0.004c-0.073-0.01-0.146-0.027-0.217-0.046c-0.045-0.012-0.089-0.026-0.133-0.041 c-0.012-0.004-0.119-0.046-0.062-0.021c-0.068-0.029-0.134-0.065-0.198-0.102c-0.071-0.042-0.167-0.109-0.193-0.131 c-0.26-0.22-0.418-0.47-0.508-0.783c-0.085-0.3-0.092-0.628-0.017-0.922c0.012-0.046,0.033-0.094,0.041-0.141 c0.017-0.094-0.037,0.068-0.013,0.025c0.03-0.053-0.037,0.049-0.036,0.046c0.016-0.026,0.039-0.049,0.058-0.073 c0.104-0.128,0.213-0.252,0.335-0.364c0.238-0.219,0.634-0.261,0.997-0.22c0.327,0.036,0.716,0.201,0.975,0.438 c0.2,0.182,0.51,0.197,0.707,0C16.713,10.155,16.729,9.815,16.529,9.632z" }),
|
|
15
|
+
h("path", { fill: "#231f20", d: "M22.529,9.632c-0.779-0.71-2.002-0.983-2.973-0.511c-0.218,0.106-0.406,0.274-0.569,0.451 c-0.12,0.13-0.267,0.283-0.357,0.436c-0.248,0.422-0.247,1.027-0.178,1.493c0.149,0.996,0.884,1.828,1.857,2.092 c0.977,0.265,1.985-0.113,2.574-0.927C23.564,11.724,23.342,10.419,22.529,9.632c-0.463-0.448-1.171,0.259-0.707,0.707 c0.242,0.234,0.37,0.479,0.452,0.813c0.061,0.248-0.001,0.576-0.114,0.786c-0.147,0.274-0.323,0.448-0.596,0.595 c-0.031,0.017-0.063,0.033-0.095,0.048c0.065-0.03-0.036,0.014-0.052,0.019c-0.075,0.026-0.152,0.045-0.23,0.063 c-0.098,0.023-0.057,0.011-0.032,0.007c-0.046,0.006-0.092,0.008-0.138,0.009c-0.046,0.001-0.092,0.001-0.138-0.001 c-0.014-0.001-0.161-0.014-0.087-0.004c-0.073-0.01-0.146-0.027-0.217-0.046c-0.045-0.012-0.089-0.026-0.133-0.041 c-0.012-0.004-0.119-0.046-0.062-0.021c-0.068-0.029-0.134-0.065-0.198-0.102c-0.071-0.042-0.167-0.109-0.193-0.131 c-0.26-0.22-0.418-0.47-0.508-0.783c-0.085-0.3-0.092-0.628-0.017-0.922c0.012-0.046,0.033-0.094,0.041-0.141 c0.017-0.094-0.037,0.068-0.013,0.025c0.03-0.053-0.037,0.049-0.036,0.046c0.016-0.026,0.039-0.049,0.058-0.073 c0.104-0.128,0.213-0.252,0.335-0.364c0.238-0.219,0.634-0.261,0.997-0.22c0.327,0.036,0.716,0.201,0.975,0.438 c0.2,0.182,0.51,0.197,0.707,0C22.713,10.155,22.729,9.815,22.529,9.632z" }),
|
|
16
|
+
h("path", { fill: "#ff9600", d: "M7.411,44.087c0.139,1.224,1.005,2.144,2.233,2.366c1.383,0.25,2.602-0.479,3.677-1.262 c-0.456-0.456-0.912-0.912-1.368-1.368c-0.605,1.34,0.111,2.861,1.569,3.209c1.598,0.381,2.908-0.741,3.885-1.848 c-0.471,0-0.943,0-1.414,0c1.459,1.54,4.01,1.216,5.192-0.469c-0.609-0.257-1.219-0.514-1.828-0.771 c-0.277,1.07,0.564,1.941,1.62,1.951c1.081,0.01,2.231-0.27,3.302-0.408c0.536-0.069,1-0.41,1-1c0-0.487-0.461-1.07-1-1 c-0.608,0.079-1.217,0.157-1.825,0.236c-0.284,0.037-0.568,0.074-0.852,0.11c-0.144,0.02-0.289,0.038-0.434,0.053 c-0.291-0.025-0.264,0.041,0.081,0.199c0,0.177,0,0.354,0,0.532c0.012-0.047,0.024-0.094,0.036-0.141 c0.295-1.14-1.192-1.677-1.828-0.771c-0.467,0.666-1.534,0.611-2.051,0.065c-0.355-0.375-1.063-0.398-1.414,0 c-0.421,0.477-0.884,1.082-1.518,1.275c-0.184,0.056-0.48,0.117-0.645-0.018c-0.093-0.075-0.125-0.252-0.151-0.195 c0.186-0.411,0.181-0.875-0.156-1.212c-0.292-0.292-0.858-0.414-1.212-0.156c-0.564,0.411-1.202,0.937-1.916,1.041 c-0.255,0.037-0.943-0.059-0.983-0.418c-0.061-0.537-0.416-1-1-1C7.918,43.087,7.35,43.547,7.411,44.087L7.411,44.087z" }),
|
|
17
|
+
h("path", { fill: "#fff", d: "M20.491,20.186c-0.376-1.249-1.284-2.265-2.533-2.688c-1.271-0.431-2.641-0.109-3.823,0.431 c-2.079,0.95-3.616,2.908-4.308,5.057c-1.408,4.372,0.797,11.998,6.556,11.043c2.851-0.473,4.463-3.355,3.959-6.069 c-0.148-0.797-1.112-1.249-1.845-1.048c-0.837,0.23-1.196,1.046-1.048,1.845c0.232,1.251-0.92,2.563-2.326,2.349 c-1.815-0.276-2.514-2.85-2.682-4.384c-0.201-1.84,0.259-3.722,1.567-5.065c0.704-0.723,3.096-2.31,3.589-0.673 C18.154,22.827,21.051,22.042,20.491,20.186L20.491,20.186z" }),
|
|
18
|
+
h("path", { fill: "#fff", d: "M25.479,25.33c1.93,0,1.934-3,0-3C23.548,22.33,23.545,25.33,25.479,25.33L25.479,25.33z" }),
|
|
19
|
+
h("path", { fill: "#fff", d: "M25.287,31.84c1.93,0,1.934-3,0-3C23.357,28.84,23.354,31.84,25.287,31.84L25.287,31.84z" }),
|
|
20
|
+
h("path", { fill: "#fff", d: "M27.554,19.502c2.301,4.241,4.433,8.571,6.394,12.979c0.329,0.74,1.408,0.915,2.052,0.538 c0.763-0.446,0.869-1.309,0.538-2.052c-1.96-4.409-4.093-8.738-6.394-12.979C29.224,16.29,26.633,17.803,27.554,19.502 L27.554,19.502z" })));
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface BrowserCaptureRow {
|
|
2
|
+
readonly key: string;
|
|
3
|
+
readonly at: number;
|
|
4
|
+
readonly method: string;
|
|
5
|
+
readonly url: string;
|
|
6
|
+
readonly status: number;
|
|
7
|
+
readonly ct: string;
|
|
8
|
+
readonly size: number;
|
|
9
|
+
readonly request: string;
|
|
10
|
+
readonly response: string;
|
|
11
|
+
readonly requestFullSize: number;
|
|
12
|
+
readonly responseFullSize: number;
|
|
13
|
+
readonly requestSizeExact: boolean;
|
|
14
|
+
readonly responseSizeExact: boolean;
|
|
15
|
+
readonly headers: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { BlockerAction } from './blocker.js';
|
|
2
|
+
export type DiagClass = 'user' | 'env' | 'bug';
|
|
3
|
+
export type DiagArea = 'panels' | 'market' | 'supply' | 'preflight' | 'self-update' | 'settings' | 'diag';
|
|
4
|
+
export type DiagActionKind = BlockerAction['kind'] | 'open-settings' | 'export-diagnostics';
|
|
5
|
+
export type DiagLevel = 'info' | 'warn' | 'error';
|
|
6
|
+
export interface DiagCodeSpec {
|
|
7
|
+
readonly code: string;
|
|
8
|
+
readonly class: DiagClass;
|
|
9
|
+
readonly area: DiagArea;
|
|
10
|
+
readonly action: DiagActionKind;
|
|
11
|
+
readonly messageKey: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const DIAG_CLASSES: readonly DiagClass[];
|
|
14
|
+
export declare const DIAG_AREAS: readonly DiagArea[];
|
|
15
|
+
export declare const DIAG_ACTIONS: readonly DiagActionKind[];
|
|
16
|
+
export declare const DIAG_LEVELS: readonly DiagLevel[];
|
|
17
|
+
export declare const DIAG_CODES: readonly DiagCodeSpec[];
|
|
18
|
+
export interface DiagFilter {
|
|
19
|
+
readonly since?: number;
|
|
20
|
+
readonly until?: number;
|
|
21
|
+
readonly area?: DiagArea;
|
|
22
|
+
readonly class?: DiagClass;
|
|
23
|
+
readonly code?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function diagMatches(record: {
|
|
26
|
+
readonly ts: number;
|
|
27
|
+
readonly area: DiagArea;
|
|
28
|
+
readonly class: DiagClass;
|
|
29
|
+
readonly code: string;
|
|
30
|
+
}, filter: DiagFilter): boolean;
|
|
31
|
+
export declare const DIAG_FALLBACK_CODE = "DIAG_UNKNOWN_CODE";
|
|
32
|
+
export declare function diagSpecOf(code: string): DiagCodeSpec | undefined;
|
|
33
|
+
export declare function isDiagCode(code: string): boolean;
|
|
34
|
+
export declare const DIAG_DETAIL_KEYS: readonly string[];
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export const DIAG_CLASSES = ['user', 'env', 'bug'];
|
|
2
|
+
export const DIAG_AREAS = [
|
|
3
|
+
'panels',
|
|
4
|
+
'market',
|
|
5
|
+
'supply',
|
|
6
|
+
'preflight',
|
|
7
|
+
'self-update',
|
|
8
|
+
'settings',
|
|
9
|
+
'diag',
|
|
10
|
+
];
|
|
11
|
+
export const DIAG_ACTIONS = [
|
|
12
|
+
'open-url',
|
|
13
|
+
'copy',
|
|
14
|
+
'retry',
|
|
15
|
+
'run-fix',
|
|
16
|
+
'open-market',
|
|
17
|
+
'open-settings',
|
|
18
|
+
'export-diagnostics',
|
|
19
|
+
];
|
|
20
|
+
export const DIAG_LEVELS = ['info', 'warn', 'error'];
|
|
21
|
+
export const DIAG_CODES = [
|
|
22
|
+
{
|
|
23
|
+
code: 'READ_FAILED',
|
|
24
|
+
class: 'env',
|
|
25
|
+
area: 'panels',
|
|
26
|
+
action: 'retry',
|
|
27
|
+
messageKey: 'diag.code.readFailed',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
code: 'CONFIG_CORRUPT',
|
|
31
|
+
class: 'user',
|
|
32
|
+
area: 'settings',
|
|
33
|
+
action: 'open-settings',
|
|
34
|
+
messageKey: 'diag.code.configCorrupt',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
code: 'MODULE_UNREADABLE',
|
|
38
|
+
class: 'user',
|
|
39
|
+
area: 'market',
|
|
40
|
+
action: 'open-settings',
|
|
41
|
+
messageKey: 'diag.code.moduleUnreadable',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
code: 'MANIFESTS_GAVE_UP',
|
|
45
|
+
class: 'env',
|
|
46
|
+
area: 'panels',
|
|
47
|
+
action: 'retry',
|
|
48
|
+
messageKey: 'diag.code.manifestsGaveUp',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
code: 'SELF_UPDATE_FAILED',
|
|
52
|
+
class: 'env',
|
|
53
|
+
area: 'self-update',
|
|
54
|
+
action: 'retry',
|
|
55
|
+
messageKey: 'diag.code.selfUpdateFailed',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
code: 'SUPPLY_INSTALL_FAILED',
|
|
59
|
+
class: 'env',
|
|
60
|
+
area: 'supply',
|
|
61
|
+
action: 'retry',
|
|
62
|
+
messageKey: 'diag.code.supplyInstallFailed',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
code: 'DIAG_BAD_PARAM',
|
|
66
|
+
class: 'user',
|
|
67
|
+
area: 'diag',
|
|
68
|
+
action: 'retry',
|
|
69
|
+
messageKey: 'diag.code.badParam',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
code: 'DIAG_SINK_FAILED',
|
|
73
|
+
class: 'bug',
|
|
74
|
+
area: 'diag',
|
|
75
|
+
action: 'export-diagnostics',
|
|
76
|
+
messageKey: 'diag.code.sinkFailed',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
code: 'DIAG_UNKNOWN_CODE',
|
|
80
|
+
class: 'bug',
|
|
81
|
+
area: 'diag',
|
|
82
|
+
action: 'export-diagnostics',
|
|
83
|
+
messageKey: 'diag.code.unknownCode',
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
export function diagMatches(record, filter) {
|
|
87
|
+
return ((filter.since === undefined || record.ts >= filter.since) &&
|
|
88
|
+
(filter.until === undefined || record.ts <= filter.until) &&
|
|
89
|
+
(filter.area === undefined || record.area === filter.area) &&
|
|
90
|
+
(filter.class === undefined || record.class === filter.class) &&
|
|
91
|
+
(filter.code === undefined || record.code === filter.code));
|
|
92
|
+
}
|
|
93
|
+
export const DIAG_FALLBACK_CODE = 'DIAG_UNKNOWN_CODE';
|
|
94
|
+
const BY_CODE = new Map(DIAG_CODES.map((spec) => [spec.code, spec]));
|
|
95
|
+
export function diagSpecOf(code) {
|
|
96
|
+
return BY_CODE.get(code);
|
|
97
|
+
}
|
|
98
|
+
export function isDiagCode(code) {
|
|
99
|
+
return BY_CODE.has(code);
|
|
100
|
+
}
|
|
101
|
+
export const DIAG_DETAIL_KEYS = [
|
|
102
|
+
'attempt',
|
|
103
|
+
'cacheAgeMs',
|
|
104
|
+
'count',
|
|
105
|
+
'durationMs',
|
|
106
|
+
'fromVersion',
|
|
107
|
+
'os',
|
|
108
|
+
'path',
|
|
109
|
+
'phase',
|
|
110
|
+
'pid',
|
|
111
|
+
'pkg',
|
|
112
|
+
'reason',
|
|
113
|
+
'requestedCode',
|
|
114
|
+
'route',
|
|
115
|
+
'since',
|
|
116
|
+
'sink',
|
|
117
|
+
'stage',
|
|
118
|
+
'toVersion',
|
|
119
|
+
'truncated',
|
|
120
|
+
'unit',
|
|
121
|
+
'version',
|
|
122
|
+
'workspace',
|
|
123
|
+
'wroteBytes',
|
|
124
|
+
];
|