@dsh-workbench/shared 1.5.4-beta.2 → 1.5.5-beta.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/api/workbench-client.d.ts +7 -0
- package/dist/components/card/Activity.d.ts +12 -12
- package/dist/components/card/Activity.js +0 -12
- package/dist/components/card/ApprovalDetail.d.ts +5 -5
- package/dist/components/card/ApprovalDetail.js +0 -5
- package/dist/components/card/ApprovalPlan.d.ts +4 -4
- package/dist/components/card/ApprovalPlan.js +0 -4
- package/dist/components/card/Card.d.ts +7 -6
- package/dist/components/card/Card.js +0 -6
- package/dist/components/card/CardAnchor.d.ts +2 -2
- package/dist/components/card/CardAnchor.js +0 -2
- package/dist/components/card/CardBoundary.d.ts +6 -6
- package/dist/components/card/CardBoundary.js +0 -6
- package/dist/components/card/CardHead.d.ts +11 -6
- package/dist/components/card/CardHead.js +0 -6
- package/dist/components/card/LongTaskRow.d.ts +20 -16
- package/dist/components/card/LongTaskRow.js +0 -16
- package/dist/components/card/board-module.d.ts +11 -2
- package/dist/components/feedback/EmptyIllustration.d.ts +1 -1
- package/dist/components/feedback/EmptyIllustration.js +0 -1
- package/dist/components/feedback/Note.d.ts +4 -4
- package/dist/components/feedback/Note.js +0 -4
- package/dist/components/feedback/ResourceStates.d.ts +22 -18
- package/dist/components/feedback/ResourceStates.js +0 -10
- package/dist/components/feedback/Spinner.d.ts +2 -2
- package/dist/components/feedback/Spinner.js +0 -2
- package/dist/components/feedback/StateBlock.d.ts +6 -6
- package/dist/components/feedback/StateBlock.js +0 -6
- package/dist/components/form/ChoiceGroup.d.ts +19 -10
- package/dist/components/form/ChoiceGroup.js +0 -8
- package/dist/components/form/ConfirmBar.d.ts +7 -7
- package/dist/components/form/ConfirmBar.js +0 -7
- package/dist/components/form/Field.d.ts +3 -3
- package/dist/components/form/Field.js +0 -3
- package/dist/components/form/Form.d.ts +0 -8
- package/dist/components/form/Form.js +0 -8
- package/dist/components/form/FormActions.d.ts +1 -1
- package/dist/components/form/FormActions.js +0 -1
- package/dist/components/form/FormRows.d.ts +7 -7
- package/dist/components/form/FormRows.js +0 -7
- package/dist/components/form/FormTypes.d.ts +8 -0
- package/dist/components/form/SaveBar.d.ts +5 -5
- package/dist/components/form/SaveBar.js +0 -5
- package/dist/components/form/SelectField.d.ts +42 -13
- package/dist/components/form/SelectField.js +0 -13
- package/dist/components/form/TextField.d.ts +1 -1
- package/dist/components/form/TextField.js +0 -1
- package/dist/components/layout/Link.d.ts +5 -5
- package/dist/components/layout/Link.js +0 -5
- package/dist/components/layout/Rows.d.ts +3 -3
- package/dist/components/layout/Rows.js +0 -3
- package/dist/components/layout/SettingsSection.d.ts +4 -4
- package/dist/components/layout/SettingsSection.js +0 -4
- package/dist/components/layout/SetupShell.d.ts +40 -5
- package/dist/components/layout/SetupShell.js +0 -5
- package/dist/components/layout/Stack.d.ts +1 -1
- package/dist/components/layout/Stack.js +0 -1
- package/dist/components/layout/icons.d.ts +1 -9
- package/dist/components/layout/icons.js +0 -9
- package/dist/contract/command.d.ts +2 -0
- package/dist/contract/data.d.ts +10 -0
- package/dist/contract/git.d.ts +4 -0
- package/dist/contract/lib.d.ts +2 -0
- package/dist/contract/module-context.d.ts +3 -0
- package/dist/contract/protocol/platform.d.ts +13 -0
- package/dist/host/adapters/toolbox-port.d.ts +0 -6
- package/dist/host/ai/port.d.ts +5 -0
- package/dist/host/ai/types.d.ts +12 -0
- package/dist/host/drafts/draft-store.d.ts +5 -0
- package/dist/host/runtime/workspace-store.d.ts +2 -0
- package/dist/host/seam/intent.d.ts +9 -0
- package/dist/host/seam/unit-seam.d.ts +2 -0
- package/dist/host/unit/host-kit.d.ts +8 -0
- package/dist/host/unit/long-task.d.ts +16 -0
- package/dist/host/unit/unit-face.d.ts +20 -0
- package/dist/host/unit/value-handoff.d.ts +3 -0
- package/package.json +1 -1
- package/src/api/workbench-client.ts +7 -0
- package/src/components/card/Activity.tsx +12 -12
- package/src/components/card/ApprovalDetail.tsx +5 -5
- package/src/components/card/ApprovalPlan.tsx +4 -4
- package/src/components/card/Card.tsx +7 -6
- package/src/components/card/CardAnchor.tsx +2 -2
- package/src/components/card/CardBoundary.tsx +6 -6
- package/src/components/card/CardHead.tsx +11 -6
- package/src/components/card/LongTaskRow.tsx +20 -16
- package/src/components/card/board-module.ts +11 -2
- package/src/components/feedback/EmptyIllustration.tsx +1 -1
- package/src/components/feedback/Note.tsx +4 -4
- package/src/components/feedback/ResourceStates.tsx +24 -16
- package/src/components/feedback/Spinner.tsx +2 -2
- package/src/components/feedback/StateBlock.tsx +6 -6
- package/src/components/form/ChoiceGroup.tsx +19 -9
- package/src/components/form/ConfirmBar.tsx +7 -7
- package/src/components/form/Field.tsx +3 -3
- package/src/components/form/Form.tsx +0 -8
- package/src/components/form/FormActions.tsx +1 -1
- package/src/components/form/FormRows.tsx +7 -7
- package/src/components/form/FormTypes.ts +8 -0
- package/src/components/form/SaveBar.tsx +5 -5
- package/src/components/form/SelectField.tsx +42 -13
- package/src/components/form/TextField.tsx +1 -1
- package/src/components/layout/Link.tsx +5 -5
- package/src/components/layout/Rows.tsx +3 -3
- package/src/components/layout/SettingsSection.tsx +4 -4
- package/src/components/layout/SetupShell.tsx +40 -5
- package/src/components/layout/Stack.tsx +1 -1
- package/src/components/layout/icons.tsx +1 -9
- package/src/contract/command.ts +2 -0
- package/src/contract/data.ts +10 -0
- package/src/contract/git.ts +4 -0
- package/src/contract/lib.ts +2 -0
- package/src/contract/module-context.ts +3 -0
- package/src/contract/protocol/platform.ts +13 -0
- package/src/host/adapters/toolbox-port.ts +0 -7
- package/src/host/ai/port.ts +5 -0
- package/src/host/ai/types.ts +12 -0
- package/src/host/drafts/draft-store.ts +5 -0
- package/src/host/runtime/workspace-store.ts +2 -0
- package/src/host/seam/intent.ts +9 -0
- package/src/host/seam/unit-seam.ts +2 -0
- package/src/host/unit/host-kit.ts +8 -0
- package/src/host/unit/long-task.ts +16 -0
- package/src/host/unit/unit-face.ts +20 -0
- package/src/host/unit/value-handoff.ts +3 -0
|
@@ -7,7 +7,9 @@ export interface UnitSeamPorts {
|
|
|
7
7
|
readonly declared?: readonly UnitWriteScope[] | undefined;
|
|
8
8
|
readonly realHome?: string | undefined;
|
|
9
9
|
}
|
|
10
|
+
/** 一次受控执行:能写哪里由清单声明,每次调用还要带 scope。 */
|
|
10
11
|
export interface UnitSeam {
|
|
12
|
+
/** 运行一条命令。scope=workspace 要先在清单声明写入域并带会话;retry 默认 'never'。 */
|
|
11
13
|
run(request: UnitSeamRequest): Promise<SeamOutcome>;
|
|
12
14
|
}
|
|
13
15
|
export declare function unitDataRoot(runtimeRoot: string, unit: string): string;
|
|
@@ -10,13 +10,21 @@ import { sessionIdOf, sessionWorkspace } from './tool-kit.js';
|
|
|
10
10
|
* 宿主 kit 的公共部分:flow、工具侧 session 读法、外部供给装法、宿主平台事实、按 unit 绑定的执行缝门面。
|
|
11
11
|
*/
|
|
12
12
|
export interface HostKit {
|
|
13
|
+
/** 流程入口:createActions / check / run。 */
|
|
13
14
|
readonly flow: FlowHost;
|
|
15
|
+
/** 从工具执行上下文读会话 id;没有会话时 null。 */
|
|
14
16
|
readonly sessionIdOf: typeof sessionIdOf;
|
|
17
|
+
/** 从工具执行上下文读当前工作区;没有会话时 null。 */
|
|
15
18
|
readonly sessionWorkspace: typeof sessionWorkspace;
|
|
19
|
+
/** 拼共用依赖的安装提示;只展示、不执行。 */
|
|
16
20
|
readonly libInstallCommand: EnvSupplyPort['libInstallCommand'];
|
|
21
|
+
/** 工作台平台信息:deployment / capabilities / toolchain。 */
|
|
17
22
|
readonly surface: HostSurface;
|
|
23
|
+
/** 按 unit 绑定的受控执行缝;清单没声明 host.writes 时是 undefined。 */
|
|
18
24
|
readonly seam?: UnitSeam | undefined;
|
|
25
|
+
/** 模块用的模型入口;这份运行时没有模型时是 undefined。 */
|
|
19
26
|
readonly ai?: AiPort | undefined;
|
|
27
|
+
/** 会话草稿库;没有它就不能把远端文件挂到本地再提交。 */
|
|
20
28
|
readonly drafts?: DraftStore | undefined;
|
|
21
29
|
}
|
|
22
30
|
/**
|
|
@@ -28,7 +28,9 @@ export interface LongTaskChange<S extends LongTaskBase> {
|
|
|
28
28
|
readonly step?: LongTaskStep | undefined;
|
|
29
29
|
readonly by?: string | undefined;
|
|
30
30
|
}
|
|
31
|
+
/** 长任务怎么跑、怎么投影成面板那一行。 */
|
|
31
32
|
export interface LongTaskDeps<S extends LongTaskBase> {
|
|
33
|
+
/** 真正执行任务:payload 来自 start,onStep 报步骤,signal 被 abort 时尽快退出。 */
|
|
32
34
|
readonly run: (options: {
|
|
33
35
|
readonly payload: unknown;
|
|
34
36
|
readonly onStep: (step: LongTaskStep) => void;
|
|
@@ -37,8 +39,11 @@ export interface LongTaskDeps<S extends LongTaskBase> {
|
|
|
37
39
|
readonly step?: ((step: LongTaskStep, current: S) => Partial<S>) | undefined;
|
|
38
40
|
readonly outcome?: ((result: unknown, current: S) => Partial<S>) | undefined;
|
|
39
41
|
readonly stopped?: ((current: S) => Partial<S>) | undefined;
|
|
42
|
+
/** 用户点「我处理完了」时调;不给行上就没这颗钮。 */
|
|
40
43
|
readonly recheck?: ((current: S) => void) | undefined;
|
|
44
|
+
/** 用户交回执时调;不给行上就没表单。 */
|
|
41
45
|
readonly answer?: ((current: S, values: Readonly<Record<string, string>>) => void) | undefined;
|
|
46
|
+
/** 把快照投影成面板那一行要的字段。 */
|
|
42
47
|
readonly view: (snapshot: S) => Readonly<Record<string, unknown>>;
|
|
43
48
|
readonly now?: (() => string) | undefined;
|
|
44
49
|
readonly nextId?: (() => string) | undefined;
|
|
@@ -50,15 +55,24 @@ export interface LongTaskDeps<S extends LongTaskBase> {
|
|
|
50
55
|
* loading 点要的(**不分工作区、不分目标**,把现在活着的每一趟交出来),`stop` 只把中断信号转给生产方。
|
|
51
56
|
*/
|
|
52
57
|
export interface LongTaskRegistry<S extends LongTaskBase> {
|
|
58
|
+
/** 行上有没有「我处理完了」;建注册表时给了 recheck 才 true。 */
|
|
53
59
|
readonly resumable: boolean;
|
|
60
|
+
/** 行上有没有结构化回执表单;建注册表时给了 answer 才 true。 */
|
|
54
61
|
readonly answerable: boolean;
|
|
62
|
+
/** 起一趟;同 workspace + target 已有活的就直接返回它,不重复起。 */
|
|
55
63
|
start(options: LongTaskStart): S;
|
|
64
|
+
/** 按 id 取快照;不在或已清掉回 null。 */
|
|
56
65
|
snapshot(id: string): S | null;
|
|
66
|
+
/** 找同 workspace + target 的活任务;没有回 null。 */
|
|
57
67
|
active(workspace: string, target: string): S | null;
|
|
68
|
+
/** 一个工作区里每个 target 最新一趟的投影;活的加最近 recentMs 内的。 */
|
|
58
69
|
current(workspace: string): readonly Readonly<Record<string, unknown>>[];
|
|
70
|
+
/** 现在活着的每一趟,不分工作区 / 目标;给侧栏状态点用。 */
|
|
59
71
|
live(): readonly S[];
|
|
72
|
+
/** 请求停止:把中断信号转给生产方;没有这趟或已经结束回 false。 */
|
|
60
73
|
stop(id: string, by?: string): boolean;
|
|
61
74
|
recheck(id: string): boolean;
|
|
75
|
+
/** 交回执:只认 intervention.fields 里的 key,必填缺失回 false。 */
|
|
62
76
|
answer(id: string, values: Readonly<Record<string, string>>): boolean;
|
|
63
77
|
onChange(listener: (change: LongTaskChange<S>) => void): () => void;
|
|
64
78
|
rebind?(deps: LongTaskDeps<S>): void;
|
|
@@ -93,7 +107,9 @@ export interface InterventionRetryOptions {
|
|
|
93
107
|
*/
|
|
94
108
|
export declare function withInterventionRetry<S extends LongTaskBase>(check: (current: S) => boolean | Promise<boolean>, options?: InterventionRetryOptions): (current: S) => void;
|
|
95
109
|
export declare function sharedLongTaskRegistry<S extends LongTaskBase>(scope: string, key: string, deps: LongTaskDeps<S>): LongTaskRegistry<S>;
|
|
110
|
+
/** 一个单元的长任务入口:按 key 建注册表。 */
|
|
96
111
|
export interface LongTaskHost {
|
|
112
|
+
/** key 是模块内稳定的标识;run / view 必给,recheck / answer 决定行上有没有恢复与回执。 */
|
|
97
113
|
create<S extends LongTaskBase>(options: {
|
|
98
114
|
readonly key: string;
|
|
99
115
|
} & LongTaskDeps<S>): LongTaskRegistry<S>;
|
|
@@ -19,28 +19,48 @@ export interface ToolScopeContext {
|
|
|
19
19
|
readonly session: string | null;
|
|
20
20
|
readonly scope?: unknown;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* mount(deps) 拿到的工作台依赖:清单、上下文、数据、执行缝、存储、长任务与供给。
|
|
24
|
+
* 可选成员缺省表示这份运行时不提供该能力。
|
|
25
|
+
*/
|
|
22
26
|
export interface UnitMountDeps extends HostKit {
|
|
27
|
+
/** 当前单元清单。 */
|
|
23
28
|
readonly manifest: UnitManifest;
|
|
29
|
+
/** 工作台上下文:取服务、登记生命周期。 */
|
|
24
30
|
readonly ctx: HostContext;
|
|
31
|
+
/** 工作台日志口;没有就不记。 */
|
|
25
32
|
readonly logger?: {
|
|
26
33
|
info?(message: string): void;
|
|
27
34
|
warn?(message: string): void;
|
|
28
35
|
} | undefined;
|
|
36
|
+
/** 读当前安装的其它单元清单。 */
|
|
29
37
|
readonly manifests: () => readonly UnitManifest[];
|
|
38
|
+
/** 读当前模块拥有的单元 id。 */
|
|
30
39
|
readonly ownedUnits: () => readonly string[];
|
|
40
|
+
/** 可安装单元 id;没有这个能力时 undefined。 */
|
|
31
41
|
readonly installable?: (() => readonly string[]) | undefined;
|
|
42
|
+
/** 站点数据读取:request / plan / submitPlan。 */
|
|
32
43
|
readonly data: DataReader;
|
|
44
|
+
/** 工作台编排出的只读环境变量;不要直接改。 */
|
|
33
45
|
readonly env?: Readonly<Record<string, string | undefined>> | undefined;
|
|
46
|
+
/** 共用依赖读取;没有时 undefined。 */
|
|
34
47
|
readonly libs?: LibReader | undefined;
|
|
48
|
+
/** 受控 git 读取;没有时 undefined。 */
|
|
35
49
|
readonly git?: GitReader | undefined;
|
|
50
|
+
/** argv 命令执行;没有时 undefined。 */
|
|
36
51
|
readonly commands?: CommandReader | undefined;
|
|
52
|
+
/** 按工作区持久化状态。 */
|
|
37
53
|
readonly store: WorkspaceStore;
|
|
54
|
+
/** 跨单元值交接;没有时 undefined。 */
|
|
38
55
|
readonly values?: ValueHandoff | undefined;
|
|
56
|
+
/** 探测单元能力;force 绕过缓存。 */
|
|
39
57
|
readonly probe?: (unit: string, options?: {
|
|
40
58
|
readonly force?: boolean;
|
|
41
59
|
readonly needs?: readonly Need[];
|
|
42
60
|
}) => Promise<UnitCapability | undefined>;
|
|
61
|
+
/** 长任务入口;没有时 undefined。 */
|
|
43
62
|
readonly longTasks?: LongTaskHost | undefined;
|
|
63
|
+
/** 读当前长任务运行表;没有时 undefined。 */
|
|
44
64
|
readonly longTaskRuns?: (() => ReadonlyMap<string, LongTaskRegistry<LongTaskBase>>) | undefined;
|
|
45
65
|
}
|
|
46
66
|
export type ContextRenderer = (ref: {
|
|
@@ -6,8 +6,11 @@ export interface HandoffValue {
|
|
|
6
6
|
readonly value: unknown;
|
|
7
7
|
readonly at: number;
|
|
8
8
|
}
|
|
9
|
+
/** 跨单元交接一个值:按 (fact, key) 放,取一次就没了,过期当没放。 */
|
|
9
10
|
export interface ValueHandoff {
|
|
11
|
+
/** 放一个值,覆盖同 (fact, key) 的旧值;now 只给测试用。 */
|
|
10
12
|
hand(entry: HandoffEntry, value: unknown, now?: number): void;
|
|
13
|
+
/** 取走同 (fact, key) 的值;取过就删,过期也返回 undefined。 */
|
|
11
14
|
take(entry: HandoffEntry, now?: number): HandoffValue | undefined;
|
|
12
15
|
}
|
|
13
16
|
export declare function handoffId(entry: HandoffEntry): string;
|
package/package.json
CHANGED
|
@@ -5,11 +5,17 @@ import type { InstallFailure } from '../contract/command.js';
|
|
|
5
5
|
* 宿主读口 / 写口回的错误:code 给判据分档,message 给人看,helpUrl 有就去点。
|
|
6
6
|
*/
|
|
7
7
|
export interface ApiError {
|
|
8
|
+
/** 错误码;判据按它分档。 */
|
|
8
9
|
readonly code: string;
|
|
10
|
+
/** 给人看的那句。 */
|
|
9
11
|
readonly message: string;
|
|
12
|
+
/** 更细的现场;可折叠。 */
|
|
10
13
|
readonly detail?: string;
|
|
14
|
+
/** 一句怎么改的提示;没有不画。 */
|
|
11
15
|
readonly hint?: string;
|
|
16
|
+
/** 文档 / 帮助页地址;有就去点。 */
|
|
12
17
|
readonly helpUrl?: string;
|
|
18
|
+
/** 安装类失败的结构化现场;界面据此给修法。 */
|
|
13
19
|
readonly failure?: InstallFailure;
|
|
14
20
|
}
|
|
15
21
|
|
|
@@ -27,6 +33,7 @@ export type Query = Record<string, string | number | boolean | undefined>;
|
|
|
27
33
|
* GET 的可选项;目前只有中止信号。
|
|
28
34
|
*/
|
|
29
35
|
export interface ApiGetOptions {
|
|
36
|
+
/** 中止这次读。 */
|
|
30
37
|
readonly signal?: AbortSignal | undefined;
|
|
31
38
|
}
|
|
32
39
|
|
|
@@ -7,14 +7,14 @@ import './Activity.css';
|
|
|
7
7
|
* `ActivityBlock` 的契约:块头与块内容。
|
|
8
8
|
*/
|
|
9
9
|
export interface ActivityBlockProps {
|
|
10
|
+
/** 块头(如"最近 10 次");不给不画那一行。 */
|
|
10
11
|
readonly head?: ReactNode | undefined;
|
|
12
|
+
/** 块内容,通常是一串 `ActivityLine`。 */
|
|
11
13
|
readonly children?: ReactNode | undefined;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* "它做过什么"那一块:上面一行块头、下面一列活动行,卡里放时间线就用它。
|
|
16
|
-
* @param props.head - 块头(如"最近 10 次");不给不画那一行。
|
|
17
|
-
* @param props.children - 块内容,通常是一串 `ActivityLine`。
|
|
18
18
|
* @returns 一个 div。
|
|
19
19
|
*/
|
|
20
20
|
export function ActivityBlock({ head, children }: ActivityBlockProps) {
|
|
@@ -30,18 +30,18 @@ export function ActivityBlock({ head, children }: ActivityBlockProps) {
|
|
|
30
30
|
* `ActivityLine` 的契约:状态点、正文、时间与行尾动作。
|
|
31
31
|
*/
|
|
32
32
|
export interface ActivityLineProps {
|
|
33
|
+
/** 行首那枚状态点;不给就只留正文。 */
|
|
33
34
|
readonly dot?: ReactNode | undefined;
|
|
35
|
+
/** 这一条干了什么。 */
|
|
34
36
|
readonly text: ReactNode;
|
|
37
|
+
/** 时间那一格(相对时间文本);不给不画。 */
|
|
35
38
|
readonly at?: ReactNode | undefined;
|
|
39
|
+
/** 行尾动作,通常是一两颗 `ActivityAction`;不给不画。 */
|
|
36
40
|
readonly actions?: ReactNode | undefined;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
/**
|
|
40
44
|
* 一条活动:状态点 + 正文 + 时间,行尾可挂动作;时间一律用它,别自己拼。
|
|
41
|
-
* @param props.dot - 行首那枚状态点;不给就只留正文。
|
|
42
|
-
* @param props.text - 这一条干了什么。
|
|
43
|
-
* @param props.at - 时间那一格(相对时间文本);不给不画。
|
|
44
|
-
* @param props.actions - 行尾动作,通常是一两颗 `ActivityAction`;不给不画。
|
|
45
45
|
* @returns 一行。
|
|
46
46
|
*/
|
|
47
47
|
export function ActivityLine({ dot, text, at, actions }: ActivityLineProps) {
|
|
@@ -59,22 +59,22 @@ export function ActivityLine({ dot, text, at, actions }: ActivityLineProps) {
|
|
|
59
59
|
* `ActivityAction` 的契约:一颗图标钮、一个外链,或一个失败态。
|
|
60
60
|
*/
|
|
61
61
|
export interface ActivityActionProps {
|
|
62
|
+
/** 读屏名,也是 `hint` 不给时的 tooltip 文案。 */
|
|
62
63
|
readonly label: string;
|
|
64
|
+
/** tooltip 上那句更细的说明;不给退化成 `label`。 */
|
|
63
65
|
readonly hint?: string | undefined;
|
|
66
|
+
/** 那颗图标。 */
|
|
64
67
|
readonly icon: ReactNode;
|
|
68
|
+
/** 给了就渲染成新窗口外链;与 `onClick` 同时给时以它为准。 */
|
|
65
69
|
readonly href?: string | undefined;
|
|
70
|
+
/** 图标钮的点击回调。 */
|
|
66
71
|
readonly onClick?: (() => void) | undefined;
|
|
72
|
+
/** 上一次动作失败了:钮换成危险色(默认 false)。 */
|
|
67
73
|
readonly failed?: boolean | undefined;
|
|
68
74
|
}
|
|
69
75
|
|
|
70
76
|
/**
|
|
71
77
|
* 活动行尾那颗动作:给 `href` 就是外链,否则是图标钮并带上 tooltip。
|
|
72
|
-
* @param props.label - 读屏名,也是 `hint` 不给时的 tooltip 文案。
|
|
73
|
-
* @param props.hint - tooltip 上那句更细的说明;不给退化成 `label`。
|
|
74
|
-
* @param props.icon - 那颗图标。
|
|
75
|
-
* @param props.href - 给了就渲染成新窗口外链;与 `onClick` 同时给时以它为准。
|
|
76
|
-
* @param props.onClick - 图标钮的点击回调。
|
|
77
|
-
* @param props.failed - 上一次动作失败了:钮换成危险色(默认 false)。
|
|
78
78
|
* @returns 一个 `<a>` 或一颗 `Button`。
|
|
79
79
|
*/
|
|
80
80
|
export function ActivityAction({ label, hint, icon, href, onClick, failed }: ActivityActionProps) {
|
|
@@ -26,10 +26,15 @@ type UseChat = <T>(selector: (snapshot: ChatSnapshot) => T) => T | undefined;
|
|
|
26
26
|
* `ApprovalDetail` 的契约:调用 id、读会话快照的钩子、已装模块与兜底渲染。
|
|
27
27
|
*/
|
|
28
28
|
export interface ApprovalDetailProps {
|
|
29
|
+
/** 这次工具调用的 id;不给就直接回退(连调用都找不到)。 */
|
|
29
30
|
readonly callId?: string;
|
|
31
|
+
/** 读会话快照的钩子(dsh 注入);不给就当作读不到调用。 */
|
|
30
32
|
readonly useChat?: UseChat;
|
|
33
|
+
/** 已装模块的面,按各自的 `approval.tools` 认领这次调用。 */
|
|
31
34
|
readonly units?: readonly UnitClientFace[];
|
|
35
|
+
/** 翻译函数;不给就用返回 key 的直通实现。 */
|
|
32
36
|
readonly t?: Translate;
|
|
37
|
+
/** 没有模块认领时工作台自己的渲染(那张表);不给且这次调用没带 `command` 时整个单元返回 `null`。 */
|
|
33
38
|
readonly renderShell?: ((input: ApprovalInput, t: Translate) => ReactNode) | undefined;
|
|
34
39
|
}
|
|
35
40
|
|
|
@@ -103,11 +108,6 @@ function planOf(
|
|
|
103
108
|
|
|
104
109
|
/**
|
|
105
110
|
* 审批屏的详情格:先画模块交的四行事实或它自己的渲染器,再退回外壳那张表或一段原始命令。
|
|
106
|
-
* @param props.callId - 这次工具调用的 id;不给就直接走兜底(连调用都找不到)。
|
|
107
|
-
* @param props.useChat - 读会话快照的钩子(dsh 注入);不给就当作读不到调用。
|
|
108
|
-
* @param props.units - 已装模块的面,按各自的 `approval.tools` 认领这次调用。
|
|
109
|
-
* @param props.t - 翻译函数;不给就用返回 key 的直通实现。
|
|
110
|
-
* @param props.renderShell - 没有模块认领时外壳自己的渲染(那张表);不给且这次调用没带 `command` 时整格返回 `null`。
|
|
111
111
|
* @returns 认领方的四行表 / 自定义渲染、外壳那张表,或一段可复制的命令。
|
|
112
112
|
*/
|
|
113
113
|
export function ApprovalDetail(props: ApprovalDetailProps) {
|
|
@@ -14,18 +14,18 @@ export interface ApprovalPlanRow {
|
|
|
14
14
|
* `ApprovalPlan` 的契约:详情行,外加附注与警告两格。
|
|
15
15
|
*/
|
|
16
16
|
export interface ApprovalPlanProps {
|
|
17
|
+
/** 详情行,按给的顺序渲染;空数组时只剩附注与警告。 */
|
|
17
18
|
readonly rows: readonly ApprovalPlanRow[];
|
|
19
|
+
/** 表上面那句说明;不给不画。 */
|
|
18
20
|
readonly hint?: ReactNode | undefined;
|
|
21
|
+
/** 表下面那句警告;不给不画。 */
|
|
19
22
|
readonly warn?: ReactNode | undefined;
|
|
23
|
+
/** 插在表与 `warn` 之间的补充内容。 */
|
|
20
24
|
readonly children?: ReactNode | undefined;
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
/**
|
|
24
28
|
* 审批屏那张"这次要做什么"的表:一行一项,上面可给一句附注、下面可给一句警告。
|
|
25
|
-
* @param props.rows - 详情行,按给的顺序渲染;空数组时只剩附注与警告。
|
|
26
|
-
* @param props.hint - 表上面那句说明;不给不画。
|
|
27
|
-
* @param props.warn - 表下面那句警告;不给不画。
|
|
28
|
-
* @param props.children - 插在表与 `warn` 之间的补充内容。
|
|
29
29
|
* @returns 一个 div。
|
|
30
30
|
*/
|
|
31
31
|
export function ApprovalPlan({ rows, hint, warn, children }: ApprovalPlanProps) {
|
|
@@ -8,23 +8,24 @@ import './Card.css';
|
|
|
8
8
|
* `Card` 的契约:标题、刷新、卡片体,以及可整块替换的卡头。
|
|
9
9
|
*/
|
|
10
10
|
export interface CardProps {
|
|
11
|
+
/** 卡头那两句文案(刷新 / 刷新中)的翻译函数。 */
|
|
11
12
|
readonly t: Translate;
|
|
13
|
+
/** 卡标题。 */
|
|
12
14
|
readonly title: string;
|
|
15
|
+
/** 正在刷新:刷新钮随之禁用并转圈;接 `resource.phase === 'loading'`。 */
|
|
13
16
|
readonly refreshing: boolean;
|
|
17
|
+
/** 点刷新钮做什么,异步由调用点自己管。 */
|
|
14
18
|
readonly onRefresh: () => void;
|
|
19
|
+
/** 标题右侧那一小段补充(条数、时间);不给不占位。 */
|
|
15
20
|
readonly meta?: ReactNode | undefined;
|
|
21
|
+
/** 整块替换卡头时给(如自带齿轮的 `CardHead`);不给用默认卡头。 */
|
|
16
22
|
readonly head?: ReactNode | undefined;
|
|
23
|
+
/** 卡片体。 */
|
|
17
24
|
readonly children?: ReactNode | undefined;
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
/**
|
|
21
28
|
* 一张卡的壳:卡头(标题 + 刷新钮)+ 卡片体,面板上每一格都是它。
|
|
22
|
-
* @param props.t - 卡头那两句文案(刷新 / 刷新中)的翻译函数。
|
|
23
|
-
* @param props.refreshing - 正在刷新:刷新钮随之禁用并转圈;接 `resource.phase === 'loading'`。
|
|
24
|
-
* @param props.onRefresh - 点刷新钮做什么,异步由调用点自己管。
|
|
25
|
-
* @param props.meta - 标题右侧那一小段补充(条数、时间);不给不占位。
|
|
26
|
-
* @param props.head - 整块替换卡头时给(如自带齿轮的 `CardHead`);不给用默认卡头。
|
|
27
|
-
* @param props.children - 卡片体。
|
|
28
29
|
* @returns 一个 `<section>`。
|
|
29
30
|
*/
|
|
30
31
|
export function Card({ t, title, refreshing, onRefresh, meta, head, children }: CardProps) {
|
|
@@ -15,14 +15,14 @@ export function cardIdOf(unit: string | null): string | undefined {
|
|
|
15
15
|
* `CardAnchor` 的契约:unit id 与它锚住的内容。
|
|
16
16
|
*/
|
|
17
17
|
export interface CardAnchorProps {
|
|
18
|
+
/** 卡的 unit id,用来算锚点 id。 */
|
|
18
19
|
readonly unit: string;
|
|
20
|
+
/** 被锚住的卡片本体;锚点自己 `display: contents`,不占布局。 */
|
|
19
21
|
readonly children?: ReactNode | undefined;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
25
|
* 外壳自己盖的卡片锚点:套在卡外面给出 `id="wb-card-<unit>"`;模块别自己写,也别删。
|
|
24
|
-
* @param props.unit - 卡的 unit id,用来算锚点 id。
|
|
25
|
-
* @param props.children - 被锚住的卡片本体;锚点自己 `display: contents`,不占布局。
|
|
26
26
|
* @returns 带 id 的占位 div。
|
|
27
27
|
*/
|
|
28
28
|
export function CardAnchor({ unit, children }: CardAnchorProps) {
|
|
@@ -14,11 +14,17 @@ const COPIED_MS = 1500;
|
|
|
14
14
|
* `CardBoundary` 的契约:被守的 unit、重来键与失败回调。
|
|
15
15
|
*/
|
|
16
16
|
export interface CardBoundaryProps {
|
|
17
|
+
/** 出事的 unit id,写进报错文案并作为上报标识。 */
|
|
17
18
|
readonly unit: string;
|
|
19
|
+
/** 重来键:它一变(如切了工作区)就自动清掉报错,把卡片重新渲染一遍。 */
|
|
18
20
|
readonly resetKey: string;
|
|
21
|
+
/** 报错那句、重试钮与「复制给 agent」的翻译函数。 */
|
|
19
22
|
readonly t: Translate;
|
|
23
|
+
/** 失败时把原因报给工作台(面板状态要用);不给就只打一条 console。 */
|
|
20
24
|
readonly onFailure?: ((reason: string) => void) | undefined;
|
|
25
|
+
/** 出错时改画这一份;不给就画卡片失败提示、可折叠的原文与两颗按钮。 */
|
|
21
26
|
readonly fallback?: ReactNode | undefined;
|
|
27
|
+
/** 正常时要渲染的卡片内容。 */
|
|
22
28
|
readonly children?: ReactNode | undefined;
|
|
23
29
|
}
|
|
24
30
|
|
|
@@ -68,12 +74,6 @@ function stateOf(reason: string | null): CardBoundaryState {
|
|
|
68
74
|
|
|
69
75
|
/**
|
|
70
76
|
* 卡片级错误边界:一张卡渲染炸了只画一条报错 + 重试,不让整块面板跟着塌。
|
|
71
|
-
* @param props.unit - 出事的 unit id,写进报错文案并作为上报标识。
|
|
72
|
-
* @param props.resetKey - 重来键:它一变(如切了工作区)就自动清掉报错,把卡片重新渲染一遍。
|
|
73
|
-
* @param props.t - 报错那句、重试钮与「复制给 agent」的翻译函数。
|
|
74
|
-
* @param props.onFailure - 失败时把原因报给宿主(面板状态要用);不给就只打一条 console。
|
|
75
|
-
* @param props.fallback - 出错时改画这一份;不给就画卡片失败提示、可折叠的原文与两颗按钮。
|
|
76
|
-
* @param props.children - 正常时要渲染的卡片内容。
|
|
77
77
|
* @returns 正常时是 `children`,炸过且还没重来之前是一条报错。
|
|
78
78
|
*/
|
|
79
79
|
export class CardBoundary extends Component<CardBoundaryProps, CardBoundaryState> {
|
|
@@ -14,27 +14,32 @@ import './CardHead.css';
|
|
|
14
14
|
* `CardHead` 的契约:标题、补充、刷新,外加齿轮与平台跳转两格。
|
|
15
15
|
*/
|
|
16
16
|
export interface CardHeadProps {
|
|
17
|
+
/** 刷新那两句文案(刷新 / 刷新中)的翻译函数。 */
|
|
17
18
|
readonly t: Translate;
|
|
19
|
+
/** 卡标题;`props.meta` 是它右侧那一小段补充,不给不占位。 */
|
|
18
20
|
readonly title: string;
|
|
21
|
+
/** 标题右侧那一小段补充(条数、时间);不给不占位。 */
|
|
19
22
|
readonly meta?: ReactNode | undefined;
|
|
23
|
+
/** 正在刷新:刷新钮禁用并转圈。 */
|
|
20
24
|
readonly refreshing: boolean;
|
|
25
|
+
/** 点刷新钮做什么。 */
|
|
21
26
|
readonly onRefresh: () => void;
|
|
27
|
+
/** 齿轮钮的读屏名;`gearOpen` 控制它高亮、`onToggleGear` 是点击回调,三者一起给才画。 */
|
|
22
28
|
readonly gear?: string | undefined;
|
|
29
|
+
/** 齿轮钮是不是打开状态;和 `gear` / `onToggleGear` 一起给才画。 */
|
|
23
30
|
readonly gearOpen?: boolean | undefined;
|
|
31
|
+
/** 点齿轮钮的回调。 */
|
|
24
32
|
readonly onToggleGear?: (() => void) | undefined;
|
|
33
|
+
/** 整张卡对应系统的地址:给了就画那颗 ↗(新窗口),tooltip 用 `platformTitle`,缺了退化用 `platform`。 */
|
|
25
34
|
readonly platformHref?: string | undefined;
|
|
35
|
+
/** 整张卡对应系统的名字;`platformTitle` 不给时当 tooltip。 */
|
|
26
36
|
readonly platform?: string | undefined;
|
|
37
|
+
/** ↗ 那颗钮的 tooltip;不给退化成 `platform`。 */
|
|
27
38
|
readonly platformTitle?: string | undefined;
|
|
28
39
|
}
|
|
29
40
|
|
|
30
41
|
/**
|
|
31
42
|
* 卡头:标题 + 补充 + 刷新钮(`Card` 内部就是它),要自己拼卡头或加齿轮 / 平台跳转时直接用。
|
|
32
|
-
* @param props.t - 刷新那两句文案(刷新 / 刷新中)的翻译函数。
|
|
33
|
-
* @param props.title - 卡标题;`props.meta` 是它右侧那一小段补充,不给不占位。
|
|
34
|
-
* @param props.refreshing - 正在刷新:刷新钮禁用并转圈。
|
|
35
|
-
* @param props.onRefresh - 点刷新钮做什么。
|
|
36
|
-
* @param props.gear - 齿轮钮的读屏名;`gearOpen` 控制它高亮、`onToggleGear` 是点击回调,三者一起给才画。
|
|
37
|
-
* @param props.platformHref - 整张卡对应系统的地址:给了就画那颗 ↗(新窗口),tooltip 用 `platformTitle`,缺了退化用 `platform`。
|
|
38
43
|
* @returns 一个 `<header>`。
|
|
39
44
|
*/
|
|
40
45
|
export function CardHead({
|
|
@@ -89,25 +89,45 @@ export interface LongTaskRowIntervention {
|
|
|
89
89
|
* `LongTaskRow` 的契约:状态、标题、问题、链接、登录钮,两处可展开的原始输出,与最右边那颗可选的停止钮。
|
|
90
90
|
*/
|
|
91
91
|
export interface LongTaskRowProps {
|
|
92
|
+
/** 六态之一,决定默认的点与「失败」那一块。 */
|
|
92
93
|
readonly status: LongTaskStatus;
|
|
94
|
+
/** 这一行在干什么(一句话)。 */
|
|
93
95
|
readonly headline: string;
|
|
96
|
+
/** 当前步骤;运行中 / 停止后给,不给不画。 */
|
|
94
97
|
readonly step?: string | undefined;
|
|
98
|
+
/** 状态词 · 耗时那一行;不给不画。 */
|
|
95
99
|
readonly meta?: string | undefined;
|
|
100
|
+
/** 点的档位覆盖;不给就用 `longTaskDot(status)`。 */
|
|
96
101
|
readonly dot?: 'done' | 'ongoing' | 'error' | 'idle' | 'warning' | undefined;
|
|
102
|
+
/** 点的读屏文案;不给就不挂 `aria-label`。 */
|
|
97
103
|
readonly dotLabel?: string | undefined;
|
|
104
|
+
/** 第几次重试那行的文案;只在 `attempt > 1` 时用,不给不画。 */
|
|
98
105
|
readonly attemptLabel?: ((attempt: number) => string) | undefined;
|
|
106
|
+
/** 紧凑档(默认 false)。 */
|
|
99
107
|
readonly dense?: boolean | undefined;
|
|
108
|
+
/** 失败原因;不给不画。 */
|
|
100
109
|
readonly problem?: string | undefined;
|
|
110
|
+
/** 行尾的链接,通常指向产物或日志。 */
|
|
101
111
|
readonly links?: readonly LongTaskRowLink[] | undefined;
|
|
112
|
+
/** 旧的纯文本步骤;只在没有 `history` 时作为回退画。 */
|
|
102
113
|
readonly steps?: readonly string[] | undefined;
|
|
114
|
+
/** 结构化步骤;有它就一行一步,每步的链接挂在行尾。 */
|
|
103
115
|
readonly history?: readonly LongTaskStepRow[] | undefined;
|
|
116
|
+
/** 原始输出;给了 `rawTitle` 才成一块可展开。 */
|
|
104
117
|
readonly raw?: string | undefined;
|
|
118
|
+
/** 步骤那块展开行的标题;`rawTitle` 同理是原始输出那块。 */
|
|
105
119
|
readonly stepsTitle?: string | undefined;
|
|
120
|
+
/** 原始输出那块展开行的标题;不给就不展开原始输出。 */
|
|
106
121
|
readonly rawTitle?: string | undefined;
|
|
122
|
+
/** 复制钮文案:给了才画复制钮;`copiedLabel` 是复制成功后那句。 */
|
|
107
123
|
readonly copyLabel?: string | undefined;
|
|
124
|
+
/** 复制成功后的文案;不给用默认。 */
|
|
108
125
|
readonly copiedLabel?: string | undefined;
|
|
126
|
+
/** `needs-login` 时那颗「去登录」;不给不画。 */
|
|
109
127
|
readonly login?: LongTaskRowLogin | undefined;
|
|
128
|
+
/** `needs-human` 时的「要人做什么」那一行与动作;不给不画。 */
|
|
110
129
|
readonly intervention?: LongTaskRowIntervention | undefined;
|
|
130
|
+
/** 给了才在最右边画那颗两按停止钮;**不给就一个像素都不变**。`pending` 是「已请求停止,等模块确认」那句。 */
|
|
111
131
|
readonly stop?: LongTaskRowStop | undefined;
|
|
112
132
|
}
|
|
113
133
|
|
|
@@ -320,22 +340,6 @@ function InterventionNeed({ intervention }: { intervention: LongTaskRowIntervent
|
|
|
320
340
|
/**
|
|
321
341
|
* 长任务那一行:点 + 标题 + 链接,可选一行当前步骤与一行状态 · 耗时;步骤收在可展开里。
|
|
322
342
|
* 发布、扫描、迁移这类跑得久的事都用它,别自己画进度。
|
|
323
|
-
* @param props.status - 六态之一,决定默认的点与「失败」那一块。
|
|
324
|
-
* @param props.headline - 这一行在干什么(一句话)。
|
|
325
|
-
* @param props.step - 当前步骤;运行中 / 停止后给,不给不画。
|
|
326
|
-
* @param props.meta - 状态词 · 耗时那一行;不给不画。
|
|
327
|
-
* @param props.dot - 点的档位覆盖;不给就用 `longTaskDot(status)`。
|
|
328
|
-
* @param props.dotLabel - 点的读屏文案;不给就不挂 `aria-label`。
|
|
329
|
-
* @param props.problem - 失败原因;不给不画。
|
|
330
|
-
* @param props.links - 行尾的链接,通常指向产物或日志。
|
|
331
|
-
* @param props.steps - 旧的纯文本步骤;只在没有 `history` 时作为回退画。
|
|
332
|
-
* @param props.history - 结构化步骤;有它就一行一步,每步的链接挂在行尾。
|
|
333
|
-
* @param props.raw - 原始输出;给了 `rawTitle` 才成一块可展开。
|
|
334
|
-
* @param props.stepsTitle - 步骤那块展开行的标题;`rawTitle` 同理是原始输出那块。
|
|
335
|
-
* @param props.copyLabel - 复制钮文案:给了才画复制钮;`copiedLabel` 是复制成功后那句。
|
|
336
|
-
* @param props.login - `needs-login` 时那颗「去登录」;不给不画。
|
|
337
|
-
* @param props.intervention - `needs-human` 时的「要人做什么」那一行与动作;不给不画。
|
|
338
|
-
* @param props.stop - 给了才在最右边画那颗两按停止钮;**不给就一个像素都不变**。`pending` 是「已请求停止,等模块确认」那句。
|
|
339
343
|
* @returns 一行长任务。
|
|
340
344
|
*/
|
|
341
345
|
export function LongTaskRow(props: LongTaskRowProps) {
|
|
@@ -13,7 +13,7 @@ export interface PanelStep {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* 交给面板渲染的工作台全局信息:工作区与会话快照、装着的 unit、面板开关、能力表与当前选中。
|
|
17
17
|
*/
|
|
18
18
|
export interface SuiteWorld {
|
|
19
19
|
readonly workspaces: WorkspaceSnapshot;
|
|
@@ -31,17 +31,24 @@ export interface SuiteWorld {
|
|
|
31
31
|
* 面板视图的统一 prop:一份世界快照 + 刷新令牌 + 四个通知回调 + 翻译函数。
|
|
32
32
|
*/
|
|
33
33
|
export interface BoardModuleProps {
|
|
34
|
+
/** 工作台全局信息:工作区、会话、已装单元、面板开关、能力与当前选中。 */
|
|
34
35
|
readonly world: SuiteWorld;
|
|
36
|
+
/** 刷新令牌;它一变就重读。 */
|
|
35
37
|
readonly refreshToken: number;
|
|
38
|
+
/** 请求刷新。 */
|
|
36
39
|
readonly onRefresh: () => void;
|
|
40
|
+
/** 跳去面板上的一格;`kind` 由各 unit 约定。 */
|
|
37
41
|
readonly onNavigate: (step: PanelStep) => void;
|
|
42
|
+
/** 打开模块市场。 */
|
|
38
43
|
readonly onOpenMarket: () => void;
|
|
44
|
+
/** 把这张卡的刷新状态与上次读到时间报给工作台。 */
|
|
39
45
|
readonly onSummary: (summary: ModuleSummary) => void;
|
|
46
|
+
/** 翻译函数。 */
|
|
40
47
|
readonly t: Translate;
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
/**
|
|
44
|
-
*
|
|
51
|
+
* 一张卡报给工作台的摘要:此刻在不在刷新、上次读到是哪个时刻。
|
|
45
52
|
*/
|
|
46
53
|
export interface ModuleSummary {
|
|
47
54
|
readonly refreshing: boolean;
|
|
@@ -110,7 +117,9 @@ export type CardViewAction =
|
|
|
110
117
|
* `custom` 槽拿到的现场:与卡片同样的世界,加上外壳归一化后的模型。
|
|
111
118
|
*/
|
|
112
119
|
export interface CardViewCustomProps<Model> extends BoardModuleProps {
|
|
120
|
+
/** 当前单元 id。 */
|
|
113
121
|
readonly unit: string;
|
|
122
|
+
/** 这张卡自己的数据模型(custom view 的返回值)。 */
|
|
114
123
|
readonly model: Model;
|
|
115
124
|
}
|
|
116
125
|
|
|
@@ -4,12 +4,12 @@ import { h } from '../../lib/react.js';
|
|
|
4
4
|
* `EmptyIllustration` 的 prop:边长。
|
|
5
5
|
*/
|
|
6
6
|
export interface EmptyIllustrationProps {
|
|
7
|
+
/** 边长,默认 110;色值全部走 `--dsw-alias-illustration-*`。 */
|
|
7
8
|
readonly size?: number;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* 空态插画:dsh 那枚 170×170 的空态图(右下角是四宫格,不是时钟)。
|
|
12
|
-
* @param props.size - 边长,默认 110;色值全部走 `--dsw-alias-illustration-*`。
|
|
13
13
|
* @returns 一个 `aria-hidden` 的 SVG。
|
|
14
14
|
*/
|
|
15
15
|
export function EmptyIllustration({ size = 110 }: EmptyIllustrationProps) {
|
|
@@ -6,18 +6,18 @@ import './Note.css';
|
|
|
6
6
|
* `Note` 的契约:语气、标签名与读屏角色。
|
|
7
7
|
*/
|
|
8
8
|
export interface NoteProps {
|
|
9
|
+
/** `problem` 是报错色;默认 `muted`,普通说明色。 */
|
|
9
10
|
readonly tone?: 'muted' | 'problem';
|
|
11
|
+
/** `span` 是跟在别的行里,`p`(默认)独占一段。 */
|
|
10
12
|
readonly as?: 'p' | 'span';
|
|
13
|
+
/** 读屏角色:变化中的提示给 `status`、报错给 `alert`;不给不设。 */
|
|
11
14
|
readonly role?: 'alert' | 'status';
|
|
15
|
+
/** 那句话本身。 */
|
|
12
16
|
readonly children?: ReactNode | undefined;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
/**
|
|
16
20
|
* 一句话说明或一句报错:卡片里的提示条用它,不承载交互。
|
|
17
|
-
* @param props.tone - `problem` 是报错色;默认 `muted`,普通说明色。
|
|
18
|
-
* @param props.as - `span` 是跟在别的行里,`p`(默认)独占一段。
|
|
19
|
-
* @param props.role - 读屏角色:变化中的提示给 `status`、报错给 `alert`;不给不设。
|
|
20
|
-
* @param props.children - 那句话本身。
|
|
21
21
|
* @returns 一个 `span` 或 `p`。
|
|
22
22
|
*/
|
|
23
23
|
export function Note({ tone = 'muted', as, role, children }: NoteProps) {
|