@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,15 @@
|
|
|
1
|
+
import './Spinner.css';
|
|
2
|
+
/**
|
|
3
|
+
* `Spinner` 的契约:直径像素与可选的读屏标签。
|
|
4
|
+
*/
|
|
5
|
+
export interface SpinnerProps {
|
|
6
|
+
readonly size?: number;
|
|
7
|
+
readonly label?: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 转圈:加载态一律用它(`FormActions` 与 `ChoiceGroup` 内部也是它),别自己写动画。
|
|
11
|
+
* @param props.size - 直径像素(默认 14,与 dsh 紧凑控件同高)。
|
|
12
|
+
* @param props.label - 给了才读屏可见(`role="status"`);不给整颗 `aria-hidden`,此时旁边必须有文字。
|
|
13
|
+
* @returns 一枚 `StateDot state="ongoing"`,自身不带文字。
|
|
14
|
+
*/
|
|
15
|
+
export declare function Spinner({ size, label }: SpinnerProps): JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StateDot } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
2
|
+
import { h } from '../lib/react.js';
|
|
3
|
+
import './Spinner.css';
|
|
4
|
+
/**
|
|
5
|
+
* 转圈:加载态一律用它(`FormActions` 与 `ChoiceGroup` 内部也是它),别自己写动画。
|
|
6
|
+
* @param props.size - 直径像素(默认 14,与 dsh 紧凑控件同高)。
|
|
7
|
+
* @param props.label - 给了才读屏可见(`role="status"`);不给整颗 `aria-hidden`,此时旁边必须有文字。
|
|
8
|
+
* @returns 一枚 `StateDot state="ongoing"`,自身不带文字。
|
|
9
|
+
*/
|
|
10
|
+
export function Spinner({ size = 14, label }) {
|
|
11
|
+
return (h("span", { className: "wb-spinner", ...(label === undefined ? { 'aria-hidden': true } : { role: 'status', 'aria-label': label }) },
|
|
12
|
+
h(StateDot, { state: "ongoing", size: size })));
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from '../lib/react.js';
|
|
2
|
+
import './Stack.css';
|
|
3
|
+
/**
|
|
4
|
+
* `Stack` 的契约:只带一个竖排内容槽。
|
|
5
|
+
*/
|
|
6
|
+
export interface StackProps {
|
|
7
|
+
readonly children?: ReactNode | undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 竖排容器:把相邻内容按统一间距摞起来,懒得自己分组时的默认外包装。
|
|
11
|
+
* @param props.children - 要竖排的内容;不给就渲染一个空容器。
|
|
12
|
+
* @returns 竖排的 div。
|
|
13
|
+
*/
|
|
14
|
+
export declare function Stack({ children }: StackProps): JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { h } from '../lib/react.js';
|
|
2
|
+
import './Stack.css';
|
|
3
|
+
/**
|
|
4
|
+
* 竖排容器:把相邻内容按统一间距摞起来,懒得自己分组时的默认外包装。
|
|
5
|
+
* @param props.children - 要竖排的内容;不给就渲染一个空容器。
|
|
6
|
+
* @returns 竖排的 div。
|
|
7
|
+
*/
|
|
8
|
+
export function Stack({ children }) {
|
|
9
|
+
return h("div", { className: "wb-stack" }, children);
|
|
10
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.wb-stateBlock {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--wb-len-6);
|
|
5
|
+
}
|
|
6
|
+
.wb-stateBlockTitle {
|
|
7
|
+
margin: 0;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: var(--wb-len-6);
|
|
11
|
+
font-size: var(--wb-font-12-5);
|
|
12
|
+
line-height: var(--wb-line-18);
|
|
13
|
+
font-weight: 600;
|
|
14
|
+
color: var(--dsw-alias-label-primary);
|
|
15
|
+
}
|
|
16
|
+
.wb-stateBlockHint {
|
|
17
|
+
margin: 0;
|
|
18
|
+
font-size: var(--wb-font-11-5);
|
|
19
|
+
line-height: var(--wb-line-17);
|
|
20
|
+
color: var(--dsw-alias-label-tertiary);
|
|
21
|
+
}
|
|
22
|
+
.wb-stateBlockActions {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-wrap: wrap;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: flex-end;
|
|
27
|
+
gap: var(--wb-len-8);
|
|
28
|
+
margin-top: var(--wb-len-8);
|
|
29
|
+
}
|
|
30
|
+
.wb-stateBlockResolving {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: var(--wb-len-8);
|
|
34
|
+
margin: 0;
|
|
35
|
+
font-size: var(--dsw-font-xxs-12-font-size);
|
|
36
|
+
line-height: var(--wb-line-18);
|
|
37
|
+
color: var(--dsw-alias-label-secondary);
|
|
38
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactNode } from '../lib/react.js';
|
|
2
|
+
import './StateBlock.css';
|
|
3
|
+
/**
|
|
4
|
+
* `StateBlock` 的契约:标题、状态点、提示、正文与行尾动作。
|
|
5
|
+
*/
|
|
6
|
+
export interface StateBlockProps {
|
|
7
|
+
readonly title?: ReactNode | undefined;
|
|
8
|
+
readonly dot?: ReactNode | undefined;
|
|
9
|
+
readonly hint?: ReactNode | undefined;
|
|
10
|
+
readonly actions?: ReactNode | undefined;
|
|
11
|
+
readonly resolving?: ReactNode | undefined;
|
|
12
|
+
readonly children?: ReactNode | undefined;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 有内容那一段:一个标题 + 一行提示 + 正文,卡里已经读到东西时用它开头。
|
|
16
|
+
* @param props.title - 标题那行;它与 `dot` 都不给时整行不画。
|
|
17
|
+
* @param props.dot - 标题前那枚状态点。
|
|
18
|
+
* @param props.hint - 标题下那行小字(如"3 条 · 刚刚");不给不画。
|
|
19
|
+
* @param props.resolving - "正在读"那行,读数期间挂上去;不给不画。
|
|
20
|
+
* @param props.actions - 底部动作区;给了才画那一条。
|
|
21
|
+
* @param props.children - 正文。
|
|
22
|
+
* @returns 一个 div。
|
|
23
|
+
*/
|
|
24
|
+
export declare function StateBlock({ title, dot, hint, actions, resolving, children }: StateBlockProps): JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { h } from '../lib/react.js';
|
|
2
|
+
import './StateBlock.css';
|
|
3
|
+
/**
|
|
4
|
+
* 有内容那一段:一个标题 + 一行提示 + 正文,卡里已经读到东西时用它开头。
|
|
5
|
+
* @param props.title - 标题那行;它与 `dot` 都不给时整行不画。
|
|
6
|
+
* @param props.dot - 标题前那枚状态点。
|
|
7
|
+
* @param props.hint - 标题下那行小字(如"3 条 · 刚刚");不给不画。
|
|
8
|
+
* @param props.resolving - "正在读"那行,读数期间挂上去;不给不画。
|
|
9
|
+
* @param props.actions - 底部动作区;给了才画那一条。
|
|
10
|
+
* @param props.children - 正文。
|
|
11
|
+
* @returns 一个 div。
|
|
12
|
+
*/
|
|
13
|
+
export function StateBlock({ title, dot, hint, actions, resolving, children }) {
|
|
14
|
+
return (h("div", { className: "wb-stateBlock" },
|
|
15
|
+
title === undefined && dot === undefined ? null : (h("p", { className: "wb-stateBlockTitle" },
|
|
16
|
+
dot,
|
|
17
|
+
title)),
|
|
18
|
+
resolving === undefined ? null : h("p", { className: "wb-stateBlockResolving" }, resolving),
|
|
19
|
+
hint === undefined ? null : h("p", { className: "wb-stateBlockHint" }, hint),
|
|
20
|
+
children,
|
|
21
|
+
actions === undefined ? null : h("div", { className: "wb-stateBlockActions" }, actions)));
|
|
22
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.wb-textField {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
border: 0.5px solid var(--dsw-alias-border-l4);
|
|
4
|
+
border-radius: var(--dsw-radius-md);
|
|
5
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
6
|
+
font: var(--dsw-font-xs-13);
|
|
7
|
+
color: var(--dsw-alias-label-primary);
|
|
8
|
+
outline: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.wb-textField:focus {
|
|
12
|
+
border-color: var(--dsw-alias-state-business-primary);
|
|
13
|
+
box-shadow: inset 0 0 0 0.5px var(--dsw-alias-state-business-primary);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.wb-textField:disabled {
|
|
17
|
+
cursor: not-allowed;
|
|
18
|
+
opacity: 0.4;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.wb-textField[aria-invalid='true'] {
|
|
22
|
+
border-color: var(--dsw-alias-state-error-primary);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.wb-textField[aria-invalid='true']:focus {
|
|
26
|
+
box-shadow: inset 0 0 0 0.5px var(--dsw-alias-state-error-primary);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:where(.wb-textField) {
|
|
30
|
+
min-height: var(--wb-len-28);
|
|
31
|
+
padding: var(--wb-len-4) var(--wb-len-10);
|
|
32
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { InputHTMLAttributes } from 'react';
|
|
2
|
+
import './TextField.css';
|
|
3
|
+
/**
|
|
4
|
+
* `TextField` 的契约:原生 input 属性,外加一个标红开关。
|
|
5
|
+
*/
|
|
6
|
+
export interface TextFieldProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
7
|
+
readonly invalid?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 单行文本输入:设置面与筛选框都用它,`invalid` 之外的属性全部透传给原生 `<input>`。
|
|
11
|
+
* @param props.invalid - 置真标红并写 `aria-invalid`(默认 false);错在哪一句归 `FormRow.problem`。
|
|
12
|
+
* @returns 输入框元素;`className` 是追加在基础类名之后,而不是替换它。
|
|
13
|
+
*/
|
|
14
|
+
export declare function TextField({ invalid, className, ...rest }: TextFieldProps): JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import './TextField.css';
|
|
2
|
+
import { h } from '../lib/react.js';
|
|
3
|
+
/**
|
|
4
|
+
* 单行文本输入:设置面与筛选框都用它,`invalid` 之外的属性全部透传给原生 `<input>`。
|
|
5
|
+
* @param props.invalid - 置真标红并写 `aria-invalid`(默认 false);错在哪一句归 `FormRow.problem`。
|
|
6
|
+
* @returns 输入框元素;`className` 是追加在基础类名之后,而不是替换它。
|
|
7
|
+
*/
|
|
8
|
+
export function TextField({ invalid = false, className, ...rest }) {
|
|
9
|
+
return (h("input", { ...rest, className: className === undefined ? 'wb-textField' : `wb-textField ${className}`, "aria-invalid": invalid || undefined }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { SessionsSnapshot, Translate, WorkspaceSnapshot, WorkspaceView } from '../lib/dsh-client.js';
|
|
3
|
+
import type { UnitManifest } from '../contract/unit.js';
|
|
4
|
+
import type { CapabilityPayload } from '../contract/workbench-contract.js';
|
|
5
|
+
import type { Dictionaries } from '../i18n/index.js';
|
|
6
|
+
import type { ShellLongTaskRow } from '../contract/protocol/long-tasks.js';
|
|
7
|
+
/**
|
|
8
|
+
* 面板要跳去的一格:只用 `kind` 说去哪,具体负载由各 unit 自己约定。
|
|
9
|
+
*/
|
|
10
|
+
export interface PanelStep {
|
|
11
|
+
readonly kind: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 交给面板渲染的宿主世界:工作区与会话快照、装着的 unit、面板开关、能力表与当前选中。
|
|
15
|
+
*/
|
|
16
|
+
export interface SuiteWorld {
|
|
17
|
+
readonly workspaces: WorkspaceSnapshot;
|
|
18
|
+
readonly sessions: SessionsSnapshot;
|
|
19
|
+
readonly manifests: readonly UnitManifest[];
|
|
20
|
+
readonly panelConfig: {
|
|
21
|
+
readonly shown: Readonly<Record<string, boolean>>;
|
|
22
|
+
} | null;
|
|
23
|
+
readonly capabilities: Readonly<Record<string, CapabilityPayload>> | null;
|
|
24
|
+
readonly current: {
|
|
25
|
+
readonly sessionId: string | null;
|
|
26
|
+
readonly workspace: WorkspaceView | null;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 面板视图的统一 prop:一份世界快照 + 刷新令牌 + 四个通知回调 + 翻译函数。
|
|
31
|
+
*/
|
|
32
|
+
export interface BoardModuleProps {
|
|
33
|
+
readonly world: SuiteWorld;
|
|
34
|
+
readonly refreshToken: number;
|
|
35
|
+
readonly onRefresh: () => void;
|
|
36
|
+
readonly onNavigate: (step: PanelStep) => void;
|
|
37
|
+
readonly onOpenMarket: () => void;
|
|
38
|
+
readonly onSummary: (summary: ModuleSummary) => void;
|
|
39
|
+
readonly t: Translate;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 一张卡报给宿主的摘要:此刻在不在刷新、上次读到是哪个时刻。
|
|
43
|
+
*/
|
|
44
|
+
export interface ModuleSummary {
|
|
45
|
+
readonly refreshing: boolean;
|
|
46
|
+
readonly at: number | null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 卡片 view model 的一格:读到内容,或读到了但没有内容。
|
|
50
|
+
*/
|
|
51
|
+
export type CardViewModel<Model> = {
|
|
52
|
+
readonly phase: 'empty';
|
|
53
|
+
readonly hintKey: string;
|
|
54
|
+
} | {
|
|
55
|
+
readonly phase: 'ready';
|
|
56
|
+
readonly model: Model;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* schema 卡的读口:由外壳发请求,模块只负责把响应映射成 view model。
|
|
60
|
+
*/
|
|
61
|
+
export type CardViewQuery = Readonly<Record<string, string | number | boolean | undefined>> | ((props: BoardModuleProps) => Readonly<Record<string, string | number | boolean | undefined>>);
|
|
62
|
+
export interface CardViewRead<Model> {
|
|
63
|
+
readonly route: string;
|
|
64
|
+
readonly query?: CardViewQuery | undefined;
|
|
65
|
+
readonly fact?: string | undefined;
|
|
66
|
+
readonly enabled?: ((props: BoardModuleProps) => boolean) | undefined;
|
|
67
|
+
readonly map: (payload: unknown) => CardViewModel<Model>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* schema 卡的头部动作;`labelKey` 从模块字典取。
|
|
71
|
+
*/
|
|
72
|
+
export interface CardViewActionBase {
|
|
73
|
+
readonly label?: string | undefined;
|
|
74
|
+
readonly labelKey?: string | undefined;
|
|
75
|
+
readonly icon?: 'open' | 'chat' | 'retry' | undefined;
|
|
76
|
+
readonly iconOnly?: boolean | undefined;
|
|
77
|
+
}
|
|
78
|
+
export type CardViewAction = (CardViewActionBase & {
|
|
79
|
+
readonly kind: 'open-url';
|
|
80
|
+
readonly href: string;
|
|
81
|
+
}) | (CardViewActionBase & {
|
|
82
|
+
readonly kind: 'retry';
|
|
83
|
+
}) | (CardViewActionBase & {
|
|
84
|
+
readonly kind: 'chat';
|
|
85
|
+
readonly title?: string | undefined;
|
|
86
|
+
readonly titleKey?: string | undefined;
|
|
87
|
+
readonly chip: {
|
|
88
|
+
readonly kind: string;
|
|
89
|
+
readonly parts: readonly string[];
|
|
90
|
+
readonly label?: string | undefined;
|
|
91
|
+
readonly labelKey?: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
/**
|
|
95
|
+
* `custom` 槽拿到的现场:与卡片同样的世界,加上外壳归一化后的模型。
|
|
96
|
+
*/
|
|
97
|
+
export interface CardViewCustomProps<Model> extends BoardModuleProps {
|
|
98
|
+
readonly unit: string;
|
|
99
|
+
readonly model: Model;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* schema 卡的一档状态色:中性 / 正常 / 警告 / 失败 / 进行中。
|
|
103
|
+
*/
|
|
104
|
+
export type CardViewTone = 'neutral' | 'ok' | 'warn' | 'bad' | 'busy';
|
|
105
|
+
/**
|
|
106
|
+
* `metrics` section 的一格:标签、值、可选状态点。
|
|
107
|
+
*/
|
|
108
|
+
export interface CardViewMetric {
|
|
109
|
+
readonly key?: string | undefined;
|
|
110
|
+
readonly label?: string | undefined;
|
|
111
|
+
readonly labelKey?: string | undefined;
|
|
112
|
+
readonly value: string;
|
|
113
|
+
readonly tone?: CardViewTone | undefined;
|
|
114
|
+
readonly percent?: number | undefined;
|
|
115
|
+
readonly actions?: readonly CardViewAction[] | undefined;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* `rows` section 的一行:标题、补充、状态点、标题链接与行尾动作。
|
|
119
|
+
*/
|
|
120
|
+
export interface CardViewRow {
|
|
121
|
+
readonly key: string;
|
|
122
|
+
readonly layout?: 'row' | 'activity' | undefined;
|
|
123
|
+
readonly title?: string | undefined;
|
|
124
|
+
readonly titleKey?: string | undefined;
|
|
125
|
+
readonly meta?: string | undefined;
|
|
126
|
+
readonly at?: string | undefined;
|
|
127
|
+
readonly atTone?: CardViewTone | undefined;
|
|
128
|
+
readonly atTitle?: string | undefined;
|
|
129
|
+
readonly tone?: CardViewTone | undefined;
|
|
130
|
+
readonly href?: string | undefined;
|
|
131
|
+
readonly action?: {
|
|
132
|
+
readonly labelKey: string;
|
|
133
|
+
readonly href: string;
|
|
134
|
+
} | undefined;
|
|
135
|
+
readonly actions?: readonly CardViewAction[] | undefined;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* `activity` section 的一行:文案、时间、可选状态点。
|
|
139
|
+
*/
|
|
140
|
+
export interface CardViewActivity {
|
|
141
|
+
readonly key: string;
|
|
142
|
+
readonly text?: string | undefined;
|
|
143
|
+
readonly textKey?: string | undefined;
|
|
144
|
+
readonly at: string;
|
|
145
|
+
readonly tone?: CardViewTone | undefined;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* `longTask` section 对一个 run 的覆盖:标题与行尾链接。
|
|
149
|
+
* 函数返回的数组只列要画的 run;返回 `undefined` 表示这一节不覆盖、全部照画;空数组表示这一节不画。
|
|
150
|
+
*/
|
|
151
|
+
export interface CardViewLongTask {
|
|
152
|
+
readonly id: string;
|
|
153
|
+
readonly headline?: string | undefined;
|
|
154
|
+
readonly links?: readonly {
|
|
155
|
+
readonly href: string;
|
|
156
|
+
readonly labelKey: string;
|
|
157
|
+
}[] | undefined;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* schema 卡的通用 section:模块从模型里取出外壳能画的行,外壳负责排版与状态点。
|
|
161
|
+
*/
|
|
162
|
+
export interface CardViewSections<Model> {
|
|
163
|
+
order?: readonly ('rows' | 'metrics' | 'activity')[] | undefined;
|
|
164
|
+
frame?: boolean | undefined;
|
|
165
|
+
metrics?(model: Model, t: Translate): readonly CardViewMetric[] | undefined;
|
|
166
|
+
rows?(model: Model, t: Translate): readonly CardViewRow[] | undefined;
|
|
167
|
+
activity?(model: Model, t: Translate): readonly CardViewActivity[] | undefined;
|
|
168
|
+
longTask?(model: Model, t: Translate): readonly CardViewLongTask[] | undefined;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* `settings` section 的一个候选项。
|
|
172
|
+
*/
|
|
173
|
+
export interface CardViewSettingOption {
|
|
174
|
+
readonly value: string;
|
|
175
|
+
readonly label?: string | undefined;
|
|
176
|
+
readonly labelKey?: string | undefined;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* `settings` section 的一个字段:下拉或单行文本。
|
|
180
|
+
*/
|
|
181
|
+
export interface CardViewSettingLoad {
|
|
182
|
+
readonly route: string;
|
|
183
|
+
readonly query?: CardViewQuery | undefined;
|
|
184
|
+
pick(payload: unknown): readonly CardViewSettingOption[];
|
|
185
|
+
}
|
|
186
|
+
export type CardViewSettingField<Model = unknown> = {
|
|
187
|
+
readonly kind: 'select';
|
|
188
|
+
readonly key: string;
|
|
189
|
+
readonly labelKey: string;
|
|
190
|
+
readonly hintKey?: string | undefined;
|
|
191
|
+
readonly options?: readonly CardViewSettingOption[] | undefined;
|
|
192
|
+
optionsOf?(model: Model): readonly CardViewSettingOption[];
|
|
193
|
+
readonly load?: CardViewSettingLoad | undefined;
|
|
194
|
+
readonly search?: boolean | undefined;
|
|
195
|
+
readonly placeholderKey?: string | undefined;
|
|
196
|
+
} | {
|
|
197
|
+
readonly kind: 'text';
|
|
198
|
+
readonly key: string;
|
|
199
|
+
readonly labelKey: string;
|
|
200
|
+
readonly hintKey?: string | undefined;
|
|
201
|
+
readonly placeholderKey?: string | undefined;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* schema 卡的设置面板:字段、当前值、保存路由与三句保存文案。
|
|
205
|
+
*/
|
|
206
|
+
export interface CardViewSettings<Model> {
|
|
207
|
+
readonly gearKey: string;
|
|
208
|
+
readonly labelKey?: string | undefined;
|
|
209
|
+
readonly titleKey: string;
|
|
210
|
+
readonly fields: readonly CardViewSettingField<Model>[];
|
|
211
|
+
values(model: Model): Readonly<Record<string, string>>;
|
|
212
|
+
openWhen?(model: Model): boolean;
|
|
213
|
+
readonly save: {
|
|
214
|
+
readonly route: string;
|
|
215
|
+
body(values: Readonly<Record<string, string>>, model: Model, props: BoardModuleProps): Record<string, unknown>;
|
|
216
|
+
};
|
|
217
|
+
readonly labels: {
|
|
218
|
+
readonly cancelKey: string;
|
|
219
|
+
readonly saveKey: string;
|
|
220
|
+
readonly savingKey: string;
|
|
221
|
+
readonly failedKey: string;
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* 模块交给外壳的卡片视图(v1):读口、view model、卡头、通用 sections、设置、动作,以及一个业务自定义槽。
|
|
226
|
+
* 卡框、状态、阻断、动作排法由外壳负责;模块不再写这部分 React。
|
|
227
|
+
*/
|
|
228
|
+
export interface CardView<Model = unknown> {
|
|
229
|
+
readonly version: 1;
|
|
230
|
+
readonly titleKey: string;
|
|
231
|
+
readonly idleKey?: string | undefined;
|
|
232
|
+
meta?(model: Model, t: Translate): string | undefined;
|
|
233
|
+
readonly platform?: {
|
|
234
|
+
readonly href: string;
|
|
235
|
+
readonly labelKey: string;
|
|
236
|
+
} | undefined;
|
|
237
|
+
platformOf?(model: Model): {
|
|
238
|
+
readonly href: string;
|
|
239
|
+
readonly labelKey: string;
|
|
240
|
+
} | undefined;
|
|
241
|
+
readonly refreshMs?: number | undefined;
|
|
242
|
+
readonly customBody?: ((props: BoardModuleProps, frame: {
|
|
243
|
+
readonly settingsOpen: boolean;
|
|
244
|
+
readonly onSettingsOpenChange: (open: boolean) => void;
|
|
245
|
+
}) => ReactNode) | undefined;
|
|
246
|
+
readonly settingsGearKey?: string | undefined;
|
|
247
|
+
readonly customLongTask?: ((rows: readonly ShellLongTaskRow[], t: Translate) => readonly CardViewLongTask[] | undefined) | undefined;
|
|
248
|
+
readonly read: CardViewRead<Model>;
|
|
249
|
+
readonly sections?: CardViewSections<Model> | undefined;
|
|
250
|
+
readonly settings?: CardViewSettings<Model> | undefined;
|
|
251
|
+
readonly actions?: readonly CardViewAction[] | undefined;
|
|
252
|
+
custom?(props: CardViewCustomProps<Model>): ReactNode;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* unit 的一个子步骤:标题文案键 + 渲染这件视图的组件。
|
|
256
|
+
*/
|
|
257
|
+
export interface UnitStep {
|
|
258
|
+
readonly titleKey: string;
|
|
259
|
+
readonly View: (props: BoardModuleProps) => ReactNode;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* 一个面板单元的注册面:id、标题键、排序、视图,可带一组子步骤。
|
|
263
|
+
*/
|
|
264
|
+
export interface BoardModule {
|
|
265
|
+
readonly id: string;
|
|
266
|
+
readonly titleKey: string;
|
|
267
|
+
readonly order: number;
|
|
268
|
+
readonly View: (props: BoardModuleProps) => ReactNode;
|
|
269
|
+
readonly steps?: Readonly<Record<string, UnitStep>>;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* 模块在浏览器侧交出来的那份面:卡片、子步骤、自己的字典,以及审批渲染。
|
|
273
|
+
*/
|
|
274
|
+
export interface UnitClientFace {
|
|
275
|
+
readonly unit: string;
|
|
276
|
+
readonly card?: (props: BoardModuleProps) => ReactNode;
|
|
277
|
+
readonly view?: CardView;
|
|
278
|
+
readonly steps?: Readonly<Record<string, UnitStep>>;
|
|
279
|
+
readonly messages?: Dictionaries;
|
|
280
|
+
readonly approval?: {
|
|
281
|
+
readonly tools: readonly string[];
|
|
282
|
+
readonly render: (props: {
|
|
283
|
+
readonly input: ApprovalInput;
|
|
284
|
+
readonly t: Translate;
|
|
285
|
+
}) => ReactNode;
|
|
286
|
+
} | undefined;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* 带着自己 manifest 的模块面(外壳按 unit 认领时用)。
|
|
290
|
+
*/
|
|
291
|
+
export interface UnitOwnedClientFace extends UnitClientFace {
|
|
292
|
+
readonly manifest: UnitManifest;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* 一次审批要看的输入:工具名,与它这次收到的参数。
|
|
296
|
+
*/
|
|
297
|
+
export interface ApprovalInput {
|
|
298
|
+
readonly tool: string;
|
|
299
|
+
readonly args: Readonly<Record<string, unknown>>;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* 模块注册进外壳的那个口:注册一份面(拿回注销函数)、列出已装 unit。
|
|
303
|
+
*/
|
|
304
|
+
export interface UnitClientApi {
|
|
305
|
+
registerUnit(face: UnitClientFace): () => void;
|
|
306
|
+
manifests(): readonly UnitManifest[];
|
|
307
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|