@morlay/dsh-client-ui-primitives 0.0.7 → 0.0.9
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/README.md +32 -9
- package/dist/client-DYp99CgT.mjs +3730 -0
- package/dist/client-uyVkC7mu.cjs +17197 -0
- package/dist/client.cjs +54 -0
- package/dist/client.d.cts +4 -0
- package/dist/client.d.mts +3 -11680
- package/dist/client.mjs +3 -4575
- package/dist/index-AMHtcyMt.d.mts +647 -0
- package/dist/index.cjs +54 -0
- package/dist/index.d.mts +4 -5
- package/dist/index.mjs +4 -5
- package/dist/reference-hchCWm3z.cjs +482 -0
- package/dist/reference.cjs +4 -0
- package/dist/reference.d.mts +3 -0
- package/dist/reference.mjs +1 -0
- package/package.json +31 -35
- package/src/client/controls/Bubble.module.css +17 -0
- package/src/client/controls/Bubble.tsx +17 -0
- package/src/client/controls/Button.module.css +10 -0
- package/src/client/controls/Button.tsx +29 -0
- package/src/client/controls/DisclosureRow.module.css +22 -0
- package/src/client/controls/DisclosureRow.tsx +20 -0
- package/src/client/controls/IconButton.module.css +50 -0
- package/src/client/controls/IconButton.tsx +47 -0
- package/src/client/controls/ModelRouteList.module.css +100 -0
- package/src/client/controls/ModelRouteList.tsx +118 -0
- package/src/client/controls/MultilineField.module.css +26 -0
- package/src/client/controls/MultilineField.tsx +19 -0
- package/src/client/controls/SearchSelect.module.css +34 -0
- package/src/client/controls/SearchSelect.tsx +138 -0
- package/src/client/controls/SeatButton.module.css +53 -0
- package/src/client/controls/SeatButton.tsx +39 -0
- package/src/client/controls/Spinner.module.css +18 -0
- package/src/client/controls/Spinner.tsx +14 -0
- package/src/client/controls/TagInput.module.css +105 -0
- package/src/client/controls/TagInput.tsx +152 -0
- package/src/client/controls/TimeLabel.module.css +16 -0
- package/src/client/controls/TimeLabel.tsx +15 -0
- package/src/client/controls/VisuallyHidden.module.css +9 -0
- package/src/client/controls/VisuallyHidden.tsx +16 -0
- package/src/client/controls/classes.ts +5 -0
- package/src/client/controls/index.ts +24 -0
- package/src/client/controls/tags.ts +24 -0
- package/src/client/index.ts +16 -2
- package/src/client/layout/Row.tsx +89 -0
- package/src/client/layout/Stack.tsx +82 -0
- package/src/client/layout/Text.tsx +61 -0
- package/src/client/layout/index.ts +16 -0
- package/src/client/layout/layout.module.css +217 -0
- package/src/client/layout/scales.ts +91 -0
- package/src/client/schema-form/Editor.tsx +65 -65
- package/src/client/schema-form/SchemaForm.tsx +9 -4
- package/src/client/schema-form/controller.ts +5 -2
- package/src/client/schema-form/geometry.ts +3 -0
- package/src/client/schema-form/index.ts +5 -0
- package/src/client/schema-form/schema-form.module.css +335 -0
- package/src/client/schema-form/testing/fake-scope.ts +0 -1
- package/src/client/schema-form/value.tsx +15 -9
- package/src/client/settings-form/SettingsFieldRow.module.css +93 -0
- package/src/client/settings-form/SettingsFieldRow.tsx +105 -0
- package/src/client/settings-form/index.ts +5 -18
- package/src/css-modules.d.ts +6 -0
- package/src/index.ts +6 -2
- package/src/reference-markdown.tsx +2 -6
- package/dist/rolldown-runtime-EAsCxrDo.mjs +0 -14
- package/locale/en.json +0 -6
- package/locale/zh.json +0 -6
- package/src/client/schema-form/styles.ts +0 -321
- package/src/client/settings-form/SettingsForm.styles.ts +0 -58
- package/src/client/settings-form/SettingsForm.tsx +0 -68
- package/src/client/settings-form/fields.styles.ts +0 -158
- package/src/client/settings-form/fields.tsx +0 -184
- package/src/client/settings-form/form-model.ts +0 -339
- package/src/client/styling/css.ts +0 -27
- package/src/client/styling/focus.ts +0 -9
- package/src/client/styling/index.ts +0 -6
- package/src/client/styling/styled.tsx +0 -54
- package/src/client/styling/styling.ts +0 -142
- package/src/client/styling/token.ts +0 -275
- package/src/client/styling/toolkit.ts +0 -37
- package/src/client/theme.generated.ts +0 -846
- package/src/client/theme.ts +0 -5
- /package/src/{client/markdown-text.ts → markdown-text.ts} +0 -0
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
import { t as Reference } from "./reference-BX54bj6_.mjs";
|
|
2
|
+
import { Context, Service } from "@deepseek-ai/cordis";
|
|
3
|
+
import { Button, DisclosureRow, MarkdownFileMentions, MarkdownLabels, MarkdownLabels as MarkdownLabels$1, MarkdownPathImages, SettingsFormShell } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
4
|
+
import { ButtonHTMLAttributes, ComponentProps, ElementType, HTMLAttributes, ReactNode, TextareaHTMLAttributes } from "react";
|
|
5
|
+
import { PropsRuntime, TranslateNS } from "@deepseek-ai/dsh-client-ui-slots";
|
|
6
|
+
import { BundleInfo, SettingsNamespaceView } from "@deepseek-ai/dsh-api-remotes/client";
|
|
7
|
+
import { SnapshotStore } from "@deepseek-ai/dsh-client-store";
|
|
8
|
+
import { ConfigForm, SchemaNode, SettingsDescribeFace } from "@deepseek-ai/dsh-client-ui-settings/client";
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/client/markdown-labels.d.ts
|
|
11
|
+
type MarkdownCopySeat = (key: "copy" | "copied" | "markdown.footnotes") => string;
|
|
12
|
+
declare function markdownLabels(t: MarkdownCopySeat): MarkdownLabels;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/client/layout/scales.d.ts
|
|
15
|
+
type LayoutGap = 0 | 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | "wide";
|
|
16
|
+
type LayoutAlign = "stretch" | "start" | "center" | "end";
|
|
17
|
+
type LayoutJustify = "start" | "center" | "between" | "end";
|
|
18
|
+
type LayoutPad = "none" | "card" | "body" | "page" | "row" | "blocking";
|
|
19
|
+
type TextSize = "xs" | "sm" | "md" | "base" | "lg";
|
|
20
|
+
type TextTone = "primary" | "secondary" | "tertiary" | "danger";
|
|
21
|
+
type TextWeight = "medium" | "strong";
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/client/layout/Row.d.ts
|
|
24
|
+
interface RowProps extends HTMLAttributes<HTMLDivElement> {
|
|
25
|
+
as?: ElementType;
|
|
26
|
+
gap?: LayoutGap;
|
|
27
|
+
align?: LayoutAlign;
|
|
28
|
+
justify?: LayoutJustify;
|
|
29
|
+
wrap?: boolean;
|
|
30
|
+
grow?: boolean;
|
|
31
|
+
boxed?: boolean;
|
|
32
|
+
fixed?: boolean;
|
|
33
|
+
narrow?: boolean;
|
|
34
|
+
push?: boolean;
|
|
35
|
+
plain?: boolean;
|
|
36
|
+
pad?: LayoutPad;
|
|
37
|
+
}
|
|
38
|
+
declare const Row: import("react").ForwardRefExoticComponent<RowProps & import("react").RefAttributes<HTMLElement>>;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/client/layout/Stack.d.ts
|
|
41
|
+
interface StackProps extends HTMLAttributes<HTMLDivElement> {
|
|
42
|
+
as?: ElementType;
|
|
43
|
+
gap?: LayoutGap;
|
|
44
|
+
align?: LayoutAlign;
|
|
45
|
+
pad?: LayoutPad;
|
|
46
|
+
grow?: boolean;
|
|
47
|
+
boxed?: boolean;
|
|
48
|
+
fixed?: boolean;
|
|
49
|
+
narrow?: boolean;
|
|
50
|
+
fill?: boolean;
|
|
51
|
+
scroll?: boolean;
|
|
52
|
+
plain?: boolean;
|
|
53
|
+
}
|
|
54
|
+
declare const Stack: import("react").ForwardRefExoticComponent<StackProps & import("react").RefAttributes<HTMLElement>>;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/client/layout/Text.d.ts
|
|
57
|
+
interface TextProps extends Omit<HTMLAttributes<HTMLElement>, "children" | "color"> {
|
|
58
|
+
as?: ElementType;
|
|
59
|
+
size?: TextSize;
|
|
60
|
+
tone?: TextTone;
|
|
61
|
+
weight?: TextWeight;
|
|
62
|
+
mono?: boolean;
|
|
63
|
+
truncate?: boolean;
|
|
64
|
+
tabular?: boolean;
|
|
65
|
+
children?: ReactNode;
|
|
66
|
+
}
|
|
67
|
+
declare function Text({ as: Element, size, tone, weight, mono, truncate, tabular, className, children }: TextProps): ReactNode;
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/client/settings-form/SettingsFieldRow.d.ts
|
|
70
|
+
interface SettingsFieldRowProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "color"> {
|
|
71
|
+
label: string;
|
|
72
|
+
hint: string;
|
|
73
|
+
layout?: "stack" | "inline";
|
|
74
|
+
divider?: boolean;
|
|
75
|
+
overriddenLabel?: string;
|
|
76
|
+
resetLabel?: string;
|
|
77
|
+
onReset?: () => void;
|
|
78
|
+
invalid?: string;
|
|
79
|
+
children: ReactNode;
|
|
80
|
+
}
|
|
81
|
+
declare function SettingsFieldRow({ label, hint, layout, divider, overriddenLabel, resetLabel, onReset, invalid, children, className, ...rest }: SettingsFieldRowProps): ReactNode;
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/client/controls/Bubble.d.ts
|
|
84
|
+
type BubbleProps = HTMLAttributes<HTMLDivElement>;
|
|
85
|
+
declare function Bubble({ className, children, ...rest }: BubbleProps): ReactNode;
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/client/controls/Button.d.ts
|
|
88
|
+
type ButtonTone = "danger";
|
|
89
|
+
type ButtonProps = ComponentProps<typeof Button> & {
|
|
90
|
+
tone?: ButtonTone;
|
|
91
|
+
};
|
|
92
|
+
declare const Button$1: import("react").ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/client/controls/DisclosureRow.d.ts
|
|
95
|
+
type DisclosureRowProps = ComponentProps<typeof DisclosureRow>;
|
|
96
|
+
declare function DisclosureRow$1(props: DisclosureRowProps): ReactNode;
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/client/controls/SeatButton.d.ts
|
|
99
|
+
interface SeatButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
100
|
+
icon: ReactNode;
|
|
101
|
+
label: string;
|
|
102
|
+
expanded?: boolean;
|
|
103
|
+
chevron?: ReactNode;
|
|
104
|
+
}
|
|
105
|
+
declare function SeatButton({ icon, label, expanded, chevron, type, className, ...rest }: SeatButtonProps): ReactNode;
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/client/controls/Spinner.d.ts
|
|
108
|
+
interface SpinnerProps {
|
|
109
|
+
label: string;
|
|
110
|
+
}
|
|
111
|
+
declare function Spinner({ label }: SpinnerProps): ReactNode;
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/client/controls/TimeLabel.d.ts
|
|
114
|
+
type TimeLabelProps = HTMLAttributes<HTMLSpanElement>;
|
|
115
|
+
declare function TimeLabel({ className, children, ...rest }: TimeLabelProps): ReactNode;
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/client/controls/VisuallyHidden.d.ts
|
|
118
|
+
interface VisuallyHiddenProps extends HTMLAttributes<HTMLSpanElement> {
|
|
119
|
+
children: ReactNode;
|
|
120
|
+
}
|
|
121
|
+
declare function VisuallyHidden({ children, ...rest }: VisuallyHiddenProps): ReactNode;
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/client/controls/IconButton.d.ts
|
|
124
|
+
interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "aria-label"> {
|
|
125
|
+
label: string;
|
|
126
|
+
children: ReactNode;
|
|
127
|
+
shape?: "square" | "circle";
|
|
128
|
+
size?: "md" | "sm";
|
|
129
|
+
}
|
|
130
|
+
declare function IconButton({ label, children, type, shape, size, className, ...rest }: IconButtonProps): ReactNode;
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/client/controls/ModelRouteList.d.ts
|
|
133
|
+
interface ModelRouteCandidate {
|
|
134
|
+
readonly key: string;
|
|
135
|
+
readonly provider: string;
|
|
136
|
+
readonly providerName: string;
|
|
137
|
+
readonly model: string;
|
|
138
|
+
readonly modelName: string;
|
|
139
|
+
}
|
|
140
|
+
interface ModelRouteListProps {
|
|
141
|
+
label: string;
|
|
142
|
+
candidates: readonly ModelRouteCandidate[];
|
|
143
|
+
selectedKey: string | undefined;
|
|
144
|
+
disabled?: boolean;
|
|
145
|
+
status: "loading" | "ready" | "error";
|
|
146
|
+
loadingLabel: string;
|
|
147
|
+
errorLabel: string;
|
|
148
|
+
emptyLabel: string;
|
|
149
|
+
onSelect: (candidate: ModelRouteCandidate) => void;
|
|
150
|
+
}
|
|
151
|
+
declare function ModelRouteList({ label, candidates, selectedKey, disabled, status, loadingLabel, errorLabel, emptyLabel, onSelect }: ModelRouteListProps): ReactNode;
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/client/controls/MultilineField.d.ts
|
|
154
|
+
type MultilineFieldProps = TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
155
|
+
declare function MultilineField({ rows, className, ...rest }: MultilineFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/client/controls/SearchSelect.d.ts
|
|
158
|
+
interface SearchSelectOption {
|
|
159
|
+
readonly value: string;
|
|
160
|
+
readonly label?: string | undefined;
|
|
161
|
+
}
|
|
162
|
+
interface SearchSelectProps {
|
|
163
|
+
label: string;
|
|
164
|
+
value: string;
|
|
165
|
+
emptyLabel: string;
|
|
166
|
+
options: readonly SearchSelectOption[];
|
|
167
|
+
disabled?: boolean;
|
|
168
|
+
searchLabel: string;
|
|
169
|
+
noMatchLabel: string;
|
|
170
|
+
onSelect: (next: string) => void;
|
|
171
|
+
}
|
|
172
|
+
declare function SearchSelect({ label, value, emptyLabel, options, disabled, searchLabel, noMatchLabel, onSelect }: SearchSelectProps): ReactNode;
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/client/controls/TagInput.d.ts
|
|
175
|
+
interface TagInputProps {
|
|
176
|
+
value: readonly string[];
|
|
177
|
+
onChange: (next: string[]) => void;
|
|
178
|
+
options?: readonly SearchSelectOption[] | undefined;
|
|
179
|
+
placeholder: string;
|
|
180
|
+
label: string;
|
|
181
|
+
disabled?: boolean;
|
|
182
|
+
noMatchLabel?: string;
|
|
183
|
+
removeLabel: (name: string) => string;
|
|
184
|
+
}
|
|
185
|
+
declare function TagInput({ value, onChange, options, placeholder, label, disabled, noMatchLabel, removeLabel }: TagInputProps): ReactNode;
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/client/controls/tags.d.ts
|
|
188
|
+
declare function parseTagList(text: string): string[];
|
|
189
|
+
declare function mergeTags(current: readonly string[], incoming: readonly string[]): string[];
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/client/schema-form/schema-node.d.ts
|
|
192
|
+
type ReadOnlyReason = "transform" | "function" | "constructor";
|
|
193
|
+
interface FieldMeta {
|
|
194
|
+
description: string | Readonly<Record<string, string>> | undefined;
|
|
195
|
+
comment: string | undefined;
|
|
196
|
+
link: string | undefined;
|
|
197
|
+
role: string | undefined;
|
|
198
|
+
secret: boolean;
|
|
199
|
+
required: boolean;
|
|
200
|
+
disabled: boolean;
|
|
201
|
+
collapse: boolean;
|
|
202
|
+
badges: readonly string[];
|
|
203
|
+
pattern: string | undefined;
|
|
204
|
+
min: number | undefined;
|
|
205
|
+
max: number | undefined;
|
|
206
|
+
step: number | undefined;
|
|
207
|
+
hasDefault: boolean;
|
|
208
|
+
defaultValue: unknown;
|
|
209
|
+
extra: unknown;
|
|
210
|
+
}
|
|
211
|
+
interface FieldNodeBase {
|
|
212
|
+
key: string;
|
|
213
|
+
path: readonly string[];
|
|
214
|
+
label: string | undefined;
|
|
215
|
+
meta: FieldMeta;
|
|
216
|
+
readOnly: ReadOnlyReason | null;
|
|
217
|
+
}
|
|
218
|
+
interface BitsEntry {
|
|
219
|
+
name: string;
|
|
220
|
+
bit: number;
|
|
221
|
+
}
|
|
222
|
+
type FieldNode = (FieldNodeBase & {
|
|
223
|
+
type: "object";
|
|
224
|
+
fields: readonly FieldNode[];
|
|
225
|
+
}) | (FieldNodeBase & {
|
|
226
|
+
type: "dict";
|
|
227
|
+
keyNode: FieldNode;
|
|
228
|
+
valueNode: FieldNode;
|
|
229
|
+
}) | (FieldNodeBase & {
|
|
230
|
+
type: "array";
|
|
231
|
+
item: FieldNode;
|
|
232
|
+
mergeKey: string | undefined;
|
|
233
|
+
}) | (FieldNodeBase & {
|
|
234
|
+
type: "tuple";
|
|
235
|
+
items: readonly FieldNode[];
|
|
236
|
+
}) | (FieldNodeBase & {
|
|
237
|
+
type: "union";
|
|
238
|
+
choices: readonly unknown[] | undefined;
|
|
239
|
+
variants: readonly FieldNode[];
|
|
240
|
+
tagKey: string | undefined;
|
|
241
|
+
}) | (FieldNodeBase & {
|
|
242
|
+
type: "intersect";
|
|
243
|
+
members: readonly FieldNode[];
|
|
244
|
+
}) | (FieldNodeBase & {
|
|
245
|
+
type: "bitset";
|
|
246
|
+
bits: readonly BitsEntry[];
|
|
247
|
+
}) | (FieldNodeBase & {
|
|
248
|
+
type: "const";
|
|
249
|
+
value: unknown;
|
|
250
|
+
}) | (FieldNodeBase & {
|
|
251
|
+
type: "lazy";
|
|
252
|
+
inner: FieldNode;
|
|
253
|
+
}) | (FieldNodeBase & {
|
|
254
|
+
type: "string" | "number" | "boolean" | "any" | "never" | "function";
|
|
255
|
+
}) | (FieldNodeBase & {
|
|
256
|
+
type: "recursive";
|
|
257
|
+
origin: string;
|
|
258
|
+
});
|
|
259
|
+
declare function projectNode(schema: SchemaNode, path?: readonly string[]): FieldNode;
|
|
260
|
+
interface WalkedField {
|
|
261
|
+
path: readonly string[];
|
|
262
|
+
node: FieldNode;
|
|
263
|
+
member?: {
|
|
264
|
+
parent: readonly string[];
|
|
265
|
+
key: string;
|
|
266
|
+
index: number | undefined;
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
interface SuggestedKeys {
|
|
270
|
+
keysFor(path: readonly string[]): readonly string[];
|
|
271
|
+
}
|
|
272
|
+
declare function walkFields(root: FieldNode, value: unknown): WalkedField[];
|
|
273
|
+
interface VariantChoice {
|
|
274
|
+
label: string;
|
|
275
|
+
value: unknown;
|
|
276
|
+
}
|
|
277
|
+
declare function readPath(root: unknown, path: readonly string[]): unknown;
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/client/schema-form/draft.d.ts
|
|
280
|
+
type Section = Record<string, unknown>;
|
|
281
|
+
type TextParseResult = {
|
|
282
|
+
kind: "value";
|
|
283
|
+
value: unknown;
|
|
284
|
+
} | {
|
|
285
|
+
kind: "skip";
|
|
286
|
+
} | {
|
|
287
|
+
kind: "invalid";
|
|
288
|
+
message: string;
|
|
289
|
+
};
|
|
290
|
+
type TextParse = (text: string) => TextParseResult;
|
|
291
|
+
interface ValidationFailure {
|
|
292
|
+
message: string;
|
|
293
|
+
path: readonly string[];
|
|
294
|
+
}
|
|
295
|
+
declare function failureOf(error: unknown): ValidationFailure;
|
|
296
|
+
interface DraftFieldState {
|
|
297
|
+
value: unknown;
|
|
298
|
+
text: string | undefined;
|
|
299
|
+
invalid: string | undefined;
|
|
300
|
+
overridden: boolean;
|
|
301
|
+
staged: boolean;
|
|
302
|
+
}
|
|
303
|
+
type DraftScope = ConfigForm<Section>;
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/client/schema-form/hints.d.ts
|
|
306
|
+
type SuggestedKeysReader = () => readonly string[];
|
|
307
|
+
interface FieldText {
|
|
308
|
+
label?: string | undefined;
|
|
309
|
+
hint?: string | undefined;
|
|
310
|
+
}
|
|
311
|
+
type FieldTextReader = () => FieldText;
|
|
312
|
+
interface SelectOption {
|
|
313
|
+
value: unknown;
|
|
314
|
+
label?: string | undefined;
|
|
315
|
+
}
|
|
316
|
+
interface SelectSpec {
|
|
317
|
+
dependsOn?: readonly (readonly string[])[] | undefined;
|
|
318
|
+
options: (read: (path: readonly string[]) => unknown) => readonly SelectOption[];
|
|
319
|
+
}
|
|
320
|
+
interface SchemaFormHintsFace {
|
|
321
|
+
suggestKeys(ns: string, path: readonly string[], read: SuggestedKeysReader): () => void;
|
|
322
|
+
keysFor(ns: string, path: readonly string[]): readonly string[];
|
|
323
|
+
describe(ns: string, path: readonly string[], read: FieldTextReader): () => void;
|
|
324
|
+
textFor(ns: string, path: readonly string[]): FieldText;
|
|
325
|
+
select(ns: string, path: readonly string[], spec: SelectSpec): () => void;
|
|
326
|
+
source(name: string, spec: SelectSpec): () => void;
|
|
327
|
+
sourceFor(name: string): SelectSpec | undefined;
|
|
328
|
+
selectFor(ns: string, path: readonly string[]): SelectSpec | undefined;
|
|
329
|
+
}
|
|
330
|
+
declare class SchemaFormHints extends Service implements SchemaFormHintsFace {
|
|
331
|
+
#private;
|
|
332
|
+
constructor(ctx: Context);
|
|
333
|
+
keysFor(ns: string, path: readonly string[]): readonly string[];
|
|
334
|
+
textFor(ns: string, path: readonly string[]): FieldText;
|
|
335
|
+
select(ns: string, path: readonly string[], spec: SelectSpec): () => void;
|
|
336
|
+
selectFor(ns: string, path: readonly string[]): SelectSpec | undefined;
|
|
337
|
+
source(name: string, spec: SelectSpec): () => void;
|
|
338
|
+
sourceFor(name: string): SelectSpec | undefined;
|
|
339
|
+
describe(ns: string, path: readonly string[], read: FieldTextReader): () => void;
|
|
340
|
+
suggestKeys(ns: string, path: readonly string[], read: SuggestedKeysReader): () => void;
|
|
341
|
+
subscribe(listener: () => void): () => void;
|
|
342
|
+
refresh(): void;
|
|
343
|
+
}
|
|
344
|
+
declare module "@deepseek-ai/cordis" {
|
|
345
|
+
interface Context {
|
|
346
|
+
schemaFormHints: SchemaFormHints;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/client/schema-form/controller.d.ts
|
|
351
|
+
declare function fieldKey(path: readonly string[]): string;
|
|
352
|
+
declare function projectRoot(serialized: unknown, rehydrate: (serialized: unknown) => SchemaNode): {
|
|
353
|
+
schema: SchemaNode;
|
|
354
|
+
root: FieldNode;
|
|
355
|
+
} | undefined;
|
|
356
|
+
declare function canRender(view: SettingsNamespaceView | undefined, rehydrate: (serialized: unknown) => SchemaNode): boolean;
|
|
357
|
+
interface HintSources extends SuggestedKeys {
|
|
358
|
+
textFor: (path: readonly string[]) => FieldText;
|
|
359
|
+
selectFor?: ((path: readonly string[]) => SelectSpec | undefined) | undefined;
|
|
360
|
+
sourceFor?: ((name: string) => SelectSpec | undefined) | undefined;
|
|
361
|
+
}
|
|
362
|
+
interface SchemaFormDeps {
|
|
363
|
+
form: DraftScope;
|
|
364
|
+
describe: SettingsDescribeFace;
|
|
365
|
+
rehydrate: (serialized: unknown) => SchemaNode;
|
|
366
|
+
validate: (schema: SchemaNode, value: unknown) => ValidationFailure | undefined;
|
|
367
|
+
t: SchemaFormTranslate;
|
|
368
|
+
hints?: HintSources | undefined;
|
|
369
|
+
}
|
|
370
|
+
interface AddableProperty {
|
|
371
|
+
key: string;
|
|
372
|
+
description: string | Readonly<Record<string, string>> | undefined;
|
|
373
|
+
}
|
|
374
|
+
declare function addableAt(node: FieldNode, path: readonly string[], value: unknown, hints: SuggestedKeys | undefined): readonly AddableProperty[];
|
|
375
|
+
interface SchemaFormState extends SettingsFormShell {
|
|
376
|
+
configured: boolean;
|
|
377
|
+
root: FieldNode;
|
|
378
|
+
walked: readonly WalkedField[];
|
|
379
|
+
fields: ReadonlyMap<string, DraftFieldState>;
|
|
380
|
+
secrets: ReadonlyMap<string, boolean>;
|
|
381
|
+
texts: ReadonlyMap<string, FieldText>;
|
|
382
|
+
options: ReadonlyMap<string, readonly SelectOption[]>;
|
|
383
|
+
addable: ReadonlyMap<string, readonly AddableProperty[]>;
|
|
384
|
+
violation: ValidationFailure | undefined;
|
|
385
|
+
invalidAt: ReadonlyMap<string, string>;
|
|
386
|
+
}
|
|
387
|
+
interface SchemaFormActions {
|
|
388
|
+
set: (path: readonly string[], value: unknown) => void;
|
|
389
|
+
setText: (path: readonly string[], text: string, parse: TextParse) => void;
|
|
390
|
+
clear: (path: readonly string[]) => void;
|
|
391
|
+
appendItem: (path: readonly string[]) => void;
|
|
392
|
+
removeItem: (path: readonly string[], index: number) => void;
|
|
393
|
+
addKey: (path: readonly string[], key: string) => void;
|
|
394
|
+
removeKey: (path: readonly string[], key: string) => void;
|
|
395
|
+
save: () => void;
|
|
396
|
+
revert: (path: readonly string[]) => void;
|
|
397
|
+
discard: () => void;
|
|
398
|
+
}
|
|
399
|
+
interface SchemaFormFace extends SchemaFormActions {
|
|
400
|
+
hooks: {
|
|
401
|
+
schemaForm: SnapshotStore<SchemaFormState>;
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
declare function optionsFor(node: FieldNode, path: readonly string[], value: unknown, hints: HintSources | undefined): readonly SelectOption[] | undefined;
|
|
405
|
+
declare class SchemaFormController {
|
|
406
|
+
#private;
|
|
407
|
+
constructor(ns: string, deps: SchemaFormDeps);
|
|
408
|
+
face(): SchemaFormFace;
|
|
409
|
+
namespace(): string;
|
|
410
|
+
refresh(): void;
|
|
411
|
+
dispose(): void;
|
|
412
|
+
}
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/client/schema-form/labels.d.ts
|
|
415
|
+
type ResolveText = (text: string | Readonly<Record<string, string>>) => string;
|
|
416
|
+
//#endregion
|
|
417
|
+
//#region src/client/schema-form/locales.d.ts
|
|
418
|
+
declare const zh: {
|
|
419
|
+
readonly unavailable: "该插件当前未加载,暂时无法配置。";
|
|
420
|
+
readonly readOnly: "本部署的设置为只读。";
|
|
421
|
+
readonly save: "保存";
|
|
422
|
+
readonly confirmEdit: "确认";
|
|
423
|
+
readonly cancelEdit: "取消";
|
|
424
|
+
readonly saving: "保存中…";
|
|
425
|
+
readonly saveFailed: "本部署没有接受这些值,已保留供你修改。";
|
|
426
|
+
readonly notSaved: "没有保存:{message}";
|
|
427
|
+
readonly noSchema: "这一行没有可自动生成的配置项。";
|
|
428
|
+
readonly reset: "恢复默认";
|
|
429
|
+
readonly revert: "撤回";
|
|
430
|
+
readonly invalid: "这个值不被接受。";
|
|
431
|
+
readonly invalidNumber: "需要一个数字。";
|
|
432
|
+
readonly invalidInteger: "需要一个整数。";
|
|
433
|
+
readonly invalidJson: "需要一段合法的 JSON。";
|
|
434
|
+
readonly invalidBoolean: "需要 true 或 false。";
|
|
435
|
+
readonly invalidConst: "这个字段只接受固定值。";
|
|
436
|
+
readonly invalidPattern: "要匹配 {pattern}。";
|
|
437
|
+
readonly invalidRange: "要在 {min} 与 {max} 之间。";
|
|
438
|
+
readonly invalidMin: "不能小于 {min}。";
|
|
439
|
+
readonly invalidMax: "不能大于 {max}。";
|
|
440
|
+
readonly invalidChoice: "只能是 {choices} 之一。";
|
|
441
|
+
readonly unknownProperty: "这一层没有这个字段:从上面的候选里选,或换个键名。";
|
|
442
|
+
readonly empty: "(空)";
|
|
443
|
+
readonly toggleGroup: "展开 / 收起这一层";
|
|
444
|
+
readonly switchVariant: "切换这一层的形状或分支";
|
|
445
|
+
readonly copyValue: "复制值";
|
|
446
|
+
readonly copied: "已复制";
|
|
447
|
+
readonly addProperty: "添加属性";
|
|
448
|
+
readonly addItemPaste: "添加数组项(可粘贴 JSON 字符串)";
|
|
449
|
+
readonly addItem: "添加一项";
|
|
450
|
+
readonly removeItem: "移除";
|
|
451
|
+
readonly addKey: "添加键(可粘贴 JSON 字符串)";
|
|
452
|
+
readonly keyName: "键名";
|
|
453
|
+
readonly noKeys: "还没有键。";
|
|
454
|
+
readonly noItems: "还没有项。";
|
|
455
|
+
readonly deprecated: "已废弃";
|
|
456
|
+
readonly experimental: "试验中";
|
|
457
|
+
readonly secretSet: "已配置";
|
|
458
|
+
readonly secretUnset: "未配置";
|
|
459
|
+
readonly secretHint: "留空即保留已存的值。";
|
|
460
|
+
readonly constValue: "固定值";
|
|
461
|
+
readonly notEditable: "这一项由插件在运行时提供,不能在页面上编辑。";
|
|
462
|
+
readonly recursive: "递归结构:展开到这一层为止。";
|
|
463
|
+
readonly fixedLength: "固定长度";
|
|
464
|
+
readonly bitsetHint: "可多选。";
|
|
465
|
+
readonly unconfigured: "未配置";
|
|
466
|
+
readonly readOnlyField: "只读";
|
|
467
|
+
readonly noDescription: "(无说明)";
|
|
468
|
+
readonly required: "必填";
|
|
469
|
+
readonly duplicateItem: "重复的 {key}:{value}";
|
|
470
|
+
readonly missingItem: "每一项都需要一个 {key}";
|
|
471
|
+
};
|
|
472
|
+
type SchemaFormLocaleKey = keyof typeof zh;
|
|
473
|
+
//#endregion
|
|
474
|
+
//#region src/client/schema-form/slot-contract.d.ts
|
|
475
|
+
interface SchemaFieldOwnerProps {
|
|
476
|
+
ns: string;
|
|
477
|
+
path: readonly string[];
|
|
478
|
+
node: FieldNode;
|
|
479
|
+
label: string;
|
|
480
|
+
hint: string | undefined;
|
|
481
|
+
value: unknown;
|
|
482
|
+
options: readonly SelectOption[] | undefined;
|
|
483
|
+
text: string | undefined;
|
|
484
|
+
secretConfigured: boolean;
|
|
485
|
+
depth: number;
|
|
486
|
+
overridden: boolean;
|
|
487
|
+
invalid: string | undefined;
|
|
488
|
+
disabled: boolean;
|
|
489
|
+
t: SchemaFormTranslate;
|
|
490
|
+
actions: SchemaFormActions;
|
|
491
|
+
group: {
|
|
492
|
+
collapsed: boolean;
|
|
493
|
+
toggle: () => void;
|
|
494
|
+
} | undefined;
|
|
495
|
+
member: {
|
|
496
|
+
parent: readonly string[];
|
|
497
|
+
key: string;
|
|
498
|
+
index: number | undefined;
|
|
499
|
+
pending?: boolean;
|
|
500
|
+
} | undefined;
|
|
501
|
+
onChange: (value: unknown) => void;
|
|
502
|
+
onEditText: (text: string, parse?: TextParse) => void;
|
|
503
|
+
onReset: () => void;
|
|
504
|
+
}
|
|
505
|
+
type SchemaFieldComponentProps<M extends SchemaFieldMatch = SchemaFieldMatch> = PropsRuntime<"settings.schema-form.field"> & {
|
|
506
|
+
matched: M;
|
|
507
|
+
};
|
|
508
|
+
type SchemaFieldSelect = (field: SchemaFieldOwnerProps) => SchemaFieldMatch | null;
|
|
509
|
+
interface SchemaFieldMatch {
|
|
510
|
+
label?: string;
|
|
511
|
+
hint?: string;
|
|
512
|
+
}
|
|
513
|
+
interface SchemaFormProps {
|
|
514
|
+
ns: string;
|
|
515
|
+
face: SchemaFormFace;
|
|
516
|
+
resolveText: ResolveText;
|
|
517
|
+
}
|
|
518
|
+
type SchemaFormTranslate = TranslateNS<"settings.schema-form">;
|
|
519
|
+
declare module "@deepseek-ai/dsh-client-ui-slots" {
|
|
520
|
+
interface LocaleNamespaceMap {
|
|
521
|
+
"settings.schema-form": SchemaFormLocaleKey;
|
|
522
|
+
}
|
|
523
|
+
interface SlotMap {
|
|
524
|
+
"settings.schema-form.field": {
|
|
525
|
+
kind: "chain";
|
|
526
|
+
scope: "root";
|
|
527
|
+
owner: SchemaFieldOwnerProps;
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
interface SlotFactoryMap {
|
|
531
|
+
"settings.schema-form.form": {
|
|
532
|
+
scope: "root";
|
|
533
|
+
props: SchemaFormProps;
|
|
534
|
+
locale: "settings.schema-form";
|
|
535
|
+
children: {
|
|
536
|
+
"settings.schema-form.field": {
|
|
537
|
+
kind: "chain";
|
|
538
|
+
scope: "root";
|
|
539
|
+
};
|
|
540
|
+
};
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
//#endregion
|
|
545
|
+
//#region src/client/schema-form/rows.d.ts
|
|
546
|
+
interface RowRegistrationPlan {
|
|
547
|
+
key: string;
|
|
548
|
+
ns: string;
|
|
549
|
+
}
|
|
550
|
+
declare function rowRegistrations(namespaces: readonly SettingsNamespaceView[], bundles: readonly BundleInfo[]): RowRegistrationPlan[];
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/client/schema-form/value.d.ts
|
|
553
|
+
declare function valueText(value: unknown): string;
|
|
554
|
+
declare function tokenText(value: unknown): string;
|
|
555
|
+
declare function tokenTone(value: unknown): "string" | "number" | "boolean" | "empty";
|
|
556
|
+
declare function InlineValue({ owner }: {
|
|
557
|
+
owner: SchemaFieldOwnerProps;
|
|
558
|
+
}): ReactNode;
|
|
559
|
+
declare function SchemaFieldDefault({ owner }: {
|
|
560
|
+
owner: SchemaFieldOwnerProps;
|
|
561
|
+
}): ReactNode;
|
|
562
|
+
//#endregion
|
|
563
|
+
//#region src/client/schema-form/fields.d.ts
|
|
564
|
+
declare function parseFor(node: FieldNode, t: SchemaFormTranslate): TextParse;
|
|
565
|
+
//#endregion
|
|
566
|
+
//#region src/client/schema-form/lines.d.ts
|
|
567
|
+
type AddLineSpec = {
|
|
568
|
+
kind: "item";
|
|
569
|
+
} | {
|
|
570
|
+
kind: "key";
|
|
571
|
+
options: readonly AddableProperty[];
|
|
572
|
+
} | {
|
|
573
|
+
kind: "prop";
|
|
574
|
+
options: readonly AddableProperty[];
|
|
575
|
+
};
|
|
576
|
+
interface VariantControl {
|
|
577
|
+
choices: readonly VariantChoice[];
|
|
578
|
+
selected: number;
|
|
579
|
+
}
|
|
580
|
+
type ContainerShape = "object" | "array";
|
|
581
|
+
type EditorLine = {
|
|
582
|
+
kind: "open";
|
|
583
|
+
path: readonly string[];
|
|
584
|
+
node: FieldNode;
|
|
585
|
+
shape: ContainerShape;
|
|
586
|
+
depth: number;
|
|
587
|
+
collapsed: boolean;
|
|
588
|
+
member: WalkedField["member"];
|
|
589
|
+
variants: VariantControl | undefined;
|
|
590
|
+
} | {
|
|
591
|
+
kind: "close";
|
|
592
|
+
path: readonly string[];
|
|
593
|
+
node: FieldNode;
|
|
594
|
+
shape: ContainerShape;
|
|
595
|
+
depth: number;
|
|
596
|
+
add: AddLineSpec | undefined;
|
|
597
|
+
member: WalkedField["member"];
|
|
598
|
+
} | {
|
|
599
|
+
kind: "field";
|
|
600
|
+
path: readonly string[];
|
|
601
|
+
node: FieldNode;
|
|
602
|
+
depth: number;
|
|
603
|
+
field: DraftFieldState;
|
|
604
|
+
member: WalkedField["member"];
|
|
605
|
+
variants: VariantControl | undefined;
|
|
606
|
+
variantsStandIn: boolean;
|
|
607
|
+
} | {
|
|
608
|
+
kind: "comment";
|
|
609
|
+
path: readonly string[];
|
|
610
|
+
depth: number;
|
|
611
|
+
text: string;
|
|
612
|
+
invalid: boolean;
|
|
613
|
+
};
|
|
614
|
+
declare function containerShape(node: FieldNode, value?: unknown): ContainerShape | undefined;
|
|
615
|
+
interface FoldState {
|
|
616
|
+
collapsed(path: readonly string[]): boolean;
|
|
617
|
+
toggle(path: readonly string[]): void;
|
|
618
|
+
}
|
|
619
|
+
declare function visibleFields(state: SchemaFormState, fold: FoldState): readonly WalkedField[];
|
|
620
|
+
declare function editorLines(state: SchemaFormState, fold: FoldState, resolveText: ResolveText, t: SchemaFormTranslate): EditorLine[];
|
|
621
|
+
declare namespace index_d_exports {
|
|
622
|
+
export { EditorLine, FieldMeta, FieldNode, FieldText, FoldState, InlineValue, NS, RowRegistrationPlan, SchemaFieldComponentProps, SchemaFieldDefault, SchemaFieldMatch, SchemaFieldOwnerProps, SchemaFieldSelect, SchemaFormActions, SchemaFormController, SchemaFormFace, SchemaFormHints, SchemaFormHintsFace, SchemaFormLocaleKey, SchemaFormProps, SchemaFormState, SchemaFormTranslate, SelectOption, SelectSpec, SuggestedKeys, SuggestedKeysReader, ValidationFailure, WalkedField, addableAt, apply$1 as apply, canRender, containerShape, editorLines, failureOf, fieldKey, inject$1 as inject, optionsFor, parseFor, projectNode, projectRoot, readPath, rowRegistrations, tokenText, tokenTone, valueText, visibleFields, walkFields, zh };
|
|
623
|
+
}
|
|
624
|
+
declare const NS = "settings.schema-form";
|
|
625
|
+
declare const inject$1: string[];
|
|
626
|
+
declare function apply$1(ctx: Context): void;
|
|
627
|
+
//#endregion
|
|
628
|
+
//#region src/reference-markdown.d.ts
|
|
629
|
+
interface ReferenceActions {
|
|
630
|
+
readonly openFile: (path: string) => void;
|
|
631
|
+
readonly openSkill: (name: string) => void;
|
|
632
|
+
}
|
|
633
|
+
interface ReferenceMarkdownProps {
|
|
634
|
+
readonly text: string;
|
|
635
|
+
readonly labels: MarkdownLabels$1;
|
|
636
|
+
readonly actions?: ReferenceActions | undefined;
|
|
637
|
+
readonly streaming?: boolean | undefined;
|
|
638
|
+
readonly pathImages?: MarkdownPathImages | undefined;
|
|
639
|
+
}
|
|
640
|
+
declare function referenceMentions(actions?: ReferenceActions, tokens?: ReadonlyMap<string, Reference>): MarkdownFileMentions;
|
|
641
|
+
declare const ReferenceMarkdown: import("react").MemoExoticComponent<({ text, labels, actions, streaming, pathImages }: ReferenceMarkdownProps) => import("react/jsx-runtime").JSX.Element>;
|
|
642
|
+
//#endregion
|
|
643
|
+
//#region src/client/index.d.ts
|
|
644
|
+
declare const inject: readonly string[];
|
|
645
|
+
declare function apply(ctx: Context): void;
|
|
646
|
+
//#endregion
|
|
647
|
+
export { Bubble as $, SearchSelect as A, VisuallyHidden as B, SuggestedKeys as C, parseTagList as D, mergeTags as E, ModelRouteCandidate as F, SpinnerProps as G, TimeLabel as H, ModelRouteList as I, DisclosureRow$1 as J, SeatButton as K, ModelRouteListProps as L, SearchSelectProps as M, MultilineField as N, TagInput as O, MultilineFieldProps as P, ButtonTone as Q, IconButton as R, FieldNode as S, walkFields as T, TimeLabelProps as U, VisuallyHiddenProps as V, Spinner as W, Button$1 as X, DisclosureRowProps as Y, ButtonProps as Z, SelectOption as _, ReferenceMarkdownProps as a, Stack as at, failureOf as b, index_d_exports as c, RowProps as ct, SchemaFormActions as d, LayoutJustify as dt, BubbleProps as et, SchemaFormController as f, LayoutPad as ft, SchemaFormHints as g, markdownLabels as gt, projectRoot as h, MarkdownCopySeat as ht, ReferenceMarkdown as i, TextProps as it, SearchSelectOption as j, TagInputProps as k, rowRegistrations as l, LayoutAlign as lt, SchemaFormState as m, TextTone as mt, inject as n, SettingsFieldRowProps as nt, referenceMentions as o, StackProps as ot, SchemaFormFace as p, TextSize as pt, SeatButtonProps as q, ReferenceActions as r, Text as rt, NS as s, Row as st, apply as t, SettingsFieldRow as tt, SchemaFormLocaleKey as u, LayoutGap as ut, SelectSpec as v, WalkedField as w, FieldMeta as x, ValidationFailure as y, IconButtonProps as z };
|