@morlay/dsh-client-ui-primitives 0.0.2-alpha.8 → 0.0.2-alpha.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/dist/client.d.mts CHANGED
@@ -1,8 +1,11 @@
1
1
  import { a as formatReferenceMention, c as parseReferenceToken, i as formatReference, n as ReferenceSpan, o as isLocalReference, r as findReferences, s as parseReference, t as Reference } from "./reference-BX54bj6_.mjs";
2
- import { ComponentProps, ComponentPropsWithRef, ElementType, ForwardRefExoticComponent, ReactNode, Ref, RefAttributes } from "react";
3
2
  import { SnapshotStore } from "@deepseek-ai/dsh-client-store";
4
- import { MarkdownFileMentions, MarkdownLabels, MarkdownLabels as MarkdownLabels$1, MarkdownPathImages } from "@deepseek-ai/dsh-client-ui-primitives";
5
- import { Context } from "@deepseek-ai/cordis";
3
+ import { Context, Service } from "@deepseek-ai/cordis";
4
+ import { ComponentProps, ComponentPropsWithRef, ElementType, ForwardRefExoticComponent, ReactNode, Ref, RefAttributes } from "react";
5
+ import { MarkdownFileMentions, MarkdownLabels, MarkdownLabels as MarkdownLabels$1, MarkdownPathImages, SettingsFormShell as SettingsFormShell$1 } from "@deepseek-ai/dsh-client-ui-primitives";
6
+ import { PropsRuntime, TranslateNS } from "@deepseek-ai/dsh-client-ui-slots";
7
+ import { BundleInfo, SettingsNamespaceView } from "@deepseek-ai/dsh-api-remotes/client";
8
+ import { ConfigForm, SchemaNode, SettingsDescribeFace } from "@deepseek-ai/dsh-client-ui-settings/client";
6
9
  //#region ../../../node_modules/.pnpm/csstype@3.2.3/node_modules/csstype/index.d.ts
7
10
  interface StandardLonghandProperties<TLength = (string & {}) | 0, TTime = string & {}> {
8
11
  /**
@@ -9415,7 +9418,7 @@ declare function styleOf(component: StyledComponent<ElementType>): CSSProps;
9415
9418
  //#endregion
9416
9419
  //#region src/client/theme.generated.d.ts
9417
9420
  /**
9418
- * 官方主题的 `--dsw-*` token 全集(373 个),由 packages/client/ui-primitives/scripts/gen-design-tokens.mts 生成,勿手改。
9421
+ * 官方主题的 `--dsw-*` token 全集(395 个),由 packages/client/ui-primitives/scripts/gen-design-tokens.mts 生成,勿手改。
9419
9422
  *
9420
9423
  * 叶子是该变量的**默认值**(官方 light 主题里首次出现的定义):既是类型推导的来源,也可作 fallback。
9421
9424
  * `"$"` 键出现在「自身也是 token 的分支」上(命名体系里有 40 个短名同时是长名前缀的 token)。
@@ -9426,7 +9429,7 @@ declare const designTokens: {
9426
9429
  readonly bg: {
9427
9430
  readonly base: "var(--dsw-static-neutral-bluish-00)";
9428
9431
  readonly document: {
9429
- readonly preview: "var(--dsw-static-neutral-bluish-750)";
9432
+ readonly preview: "var(--dsw-static-neutral-bluish-100)";
9430
9433
  };
9431
9434
  readonly layer: {
9432
9435
  readonly "1": "var(--dsw-static-neutral-bluish-00)";
@@ -9548,7 +9551,7 @@ declare const designTokens: {
9548
9551
  readonly caption: "var(--dsw-static-neutral-bluish-400)";
9549
9552
  readonly dimmed: "var(--dsw-static-neutral-bluish-200)";
9550
9553
  readonly document: {
9551
- readonly preview: "var(--dsw-static-neutral-bluish-200)";
9554
+ readonly preview: "var(--dsw-static-neutral-bluish-700)";
9552
9555
  };
9553
9556
  readonly primary: {
9554
9557
  readonly $: "var(--dsw-static-neutral-bluish-1000)";
@@ -9579,6 +9582,21 @@ declare const designTokens: {
9579
9582
  readonly placeholder: "var(--dsw-static-neutral-bluish-60)";
9580
9583
  readonly tag: "var(--dsw-static-neutral-bluish-75)";
9581
9584
  };
9585
+ readonly menu: {
9586
+ readonly icon: "var(--dsw-static-neutral-bluish-800)";
9587
+ };
9588
+ readonly onboarding: {
9589
+ readonly accent: "rgb(57, 100, 254)";
9590
+ readonly card: {
9591
+ readonly fill: "color-mix(in srgb, var(--dsw-static-neutral-bluish-00) 80%, transparent)";
9592
+ };
9593
+ readonly checkbox: {
9594
+ readonly border: "color-mix(in srgb, var(--dsw-static-neutral-bluish-1000) 20%, transparent)";
9595
+ };
9596
+ readonly secondary: {
9597
+ readonly fill: "var(--dsw-static-neutral-bluish-00)";
9598
+ };
9599
+ };
9582
9600
  readonly scrollbar: {
9583
9601
  readonly bg: {
9584
9602
  readonly l1: "var(--dsw-static-neutral-200)";
@@ -9589,6 +9607,12 @@ declare const designTokens: {
9589
9607
  readonly l2: "var(--dsw-static-neutral-300)";
9590
9608
  };
9591
9609
  };
9610
+ readonly settings: {
9611
+ readonly card: {
9612
+ readonly fill: "var(--dsw-alias-bg-layer-2)";
9613
+ readonly stroke: "var(--dsw-alias-border-l4)";
9614
+ };
9615
+ };
9592
9616
  readonly state: {
9593
9617
  readonly business: {
9594
9618
  readonly primary: "var(--dsw-static-deepseek-500)";
@@ -9615,9 +9639,13 @@ declare const designTokens: {
9615
9639
  };
9616
9640
  readonly toast: {
9617
9641
  readonly bg: "var(--dsw-static-neutral-bluish-800)";
9642
+ readonly label: "var(--dsw-static-neutral-bluish-00)";
9618
9643
  };
9619
9644
  readonly tooltip: {
9620
9645
  readonly bg: "var(--dsw-static-neutral-bluish-850)";
9646
+ readonly key: {
9647
+ readonly bg: "color-mix(in srgb, var(--dsw-alias-tooltip-bg), white 18%)";
9648
+ };
9621
9649
  };
9622
9650
  };
9623
9651
  readonly corner: {
@@ -9632,6 +9660,12 @@ declare const designTokens: {
9632
9660
  readonly color: "var(--dsw-alias-border-l4)";
9633
9661
  };
9634
9662
  };
9663
+ readonly focus: {
9664
+ readonly ring: {
9665
+ readonly color: "transparent";
9666
+ readonly width: "2px";
9667
+ };
9668
+ };
9635
9669
  readonly font: {
9636
9670
  readonly base: {
9637
9671
  readonly "16": {
@@ -9661,7 +9695,10 @@ declare const designTokens: {
9661
9695
  };
9662
9696
  };
9663
9697
  };
9664
- readonly family: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',\n 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif";
9698
+ readonly family: {
9699
+ readonly $: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',\n 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif";
9700
+ readonly brand: "'Montserrat', var(--dsw-font-family)";
9701
+ };
9665
9702
  readonly l: {
9666
9703
  readonly "20": {
9667
9704
  readonly $: "500 20px/28px var(--dsw-font-family)";
@@ -10023,6 +10060,19 @@ declare const designTokens: {
10023
10060
  };
10024
10061
  };
10025
10062
  };
10063
+ readonly gradient: {
10064
+ readonly onboarding: {
10065
+ readonly blue: {
10066
+ readonly stops: "#3964fe 18.75%, #398efe 51.78%, #6dccff 86.252%, #3964fe";
10067
+ };
10068
+ readonly cyan: {
10069
+ readonly stops: "#0293b4 21.154%, #2dc8eb 50.954%, #aff0ff 85.326%, #0293b4";
10070
+ };
10071
+ readonly violet: {
10072
+ readonly stops: "#2a2fb6 33.102%, #8b76f6 50.954%, #c5c0ff 85.326%, #2a2fb6";
10073
+ };
10074
+ };
10075
+ };
10026
10076
  readonly linear: {
10027
10077
  readonly gradient: {
10028
10078
  readonly think: "linear-gradient(180deg, #fff 20.19%, rgba(255, 255, 255, 0) 100%)";
@@ -10032,12 +10082,23 @@ declare const designTokens: {
10032
10082
  };
10033
10083
  };
10034
10084
  readonly mask: {
10035
- readonly blur: "blur(2px)";
10085
+ readonly blur: "none";
10036
10086
  };
10037
10087
  readonly menu: {
10038
10088
  readonly backdrop: {
10039
10089
  readonly filter: "blur(40px) saturate(150%)";
10040
10090
  };
10091
+ readonly surface: {
10092
+ readonly fill: "rgba(248, 249, 250, 0.58)";
10093
+ };
10094
+ };
10095
+ readonly radius: {
10096
+ readonly lg: "16px";
10097
+ readonly md: "12px";
10098
+ readonly panel: "28px";
10099
+ readonly sm: "8px";
10100
+ readonly xl: "20px";
10101
+ readonly xs: "4px";
10041
10102
  };
10042
10103
  readonly shadow: {
10043
10104
  readonly lv1: {
@@ -10058,7 +10119,7 @@ declare const designTokens: {
10058
10119
  readonly login: {
10059
10120
  readonly input: "var(--dsw-static-neutral-bluish-50)";
10060
10121
  };
10061
- readonly menu: "rgba(248, 249, 250, 0.58)";
10122
+ readonly menu: "var(--dsw-menu-surface-fill)";
10062
10123
  readonly selector: "var(--dsw-static-neutral-bluish-60)";
10063
10124
  readonly sidebar: {
10064
10125
  readonly fill: "var(--dsw-static-neutral-bluish-50)";
@@ -10183,7 +10244,7 @@ declare const dsw: TokenVars<{
10183
10244
  readonly bg: {
10184
10245
  readonly base: "var(--dsw-static-neutral-bluish-00)";
10185
10246
  readonly document: {
10186
- readonly preview: "var(--dsw-static-neutral-bluish-750)";
10247
+ readonly preview: "var(--dsw-static-neutral-bluish-100)";
10187
10248
  };
10188
10249
  readonly layer: {
10189
10250
  readonly "1": "var(--dsw-static-neutral-bluish-00)";
@@ -10305,7 +10366,7 @@ declare const dsw: TokenVars<{
10305
10366
  readonly caption: "var(--dsw-static-neutral-bluish-400)";
10306
10367
  readonly dimmed: "var(--dsw-static-neutral-bluish-200)";
10307
10368
  readonly document: {
10308
- readonly preview: "var(--dsw-static-neutral-bluish-200)";
10369
+ readonly preview: "var(--dsw-static-neutral-bluish-700)";
10309
10370
  };
10310
10371
  readonly primary: {
10311
10372
  readonly $: "var(--dsw-static-neutral-bluish-1000)";
@@ -10336,6 +10397,21 @@ declare const dsw: TokenVars<{
10336
10397
  readonly placeholder: "var(--dsw-static-neutral-bluish-60)";
10337
10398
  readonly tag: "var(--dsw-static-neutral-bluish-75)";
10338
10399
  };
10400
+ readonly menu: {
10401
+ readonly icon: "var(--dsw-static-neutral-bluish-800)";
10402
+ };
10403
+ readonly onboarding: {
10404
+ readonly accent: "rgb(57, 100, 254)";
10405
+ readonly card: {
10406
+ readonly fill: "color-mix(in srgb, var(--dsw-static-neutral-bluish-00) 80%, transparent)";
10407
+ };
10408
+ readonly checkbox: {
10409
+ readonly border: "color-mix(in srgb, var(--dsw-static-neutral-bluish-1000) 20%, transparent)";
10410
+ };
10411
+ readonly secondary: {
10412
+ readonly fill: "var(--dsw-static-neutral-bluish-00)";
10413
+ };
10414
+ };
10339
10415
  readonly scrollbar: {
10340
10416
  readonly bg: {
10341
10417
  readonly l1: "var(--dsw-static-neutral-200)";
@@ -10346,6 +10422,12 @@ declare const dsw: TokenVars<{
10346
10422
  readonly l2: "var(--dsw-static-neutral-300)";
10347
10423
  };
10348
10424
  };
10425
+ readonly settings: {
10426
+ readonly card: {
10427
+ readonly fill: "var(--dsw-alias-bg-layer-2)";
10428
+ readonly stroke: "var(--dsw-alias-border-l4)";
10429
+ };
10430
+ };
10349
10431
  readonly state: {
10350
10432
  readonly business: {
10351
10433
  readonly primary: "var(--dsw-static-deepseek-500)";
@@ -10372,9 +10454,13 @@ declare const dsw: TokenVars<{
10372
10454
  };
10373
10455
  readonly toast: {
10374
10456
  readonly bg: "var(--dsw-static-neutral-bluish-800)";
10457
+ readonly label: "var(--dsw-static-neutral-bluish-00)";
10375
10458
  };
10376
10459
  readonly tooltip: {
10377
10460
  readonly bg: "var(--dsw-static-neutral-bluish-850)";
10461
+ readonly key: {
10462
+ readonly bg: "color-mix(in srgb, var(--dsw-alias-tooltip-bg), white 18%)";
10463
+ };
10378
10464
  };
10379
10465
  };
10380
10466
  readonly corner: {
@@ -10389,6 +10475,12 @@ declare const dsw: TokenVars<{
10389
10475
  readonly color: "var(--dsw-alias-border-l4)";
10390
10476
  };
10391
10477
  };
10478
+ readonly focus: {
10479
+ readonly ring: {
10480
+ readonly color: "transparent";
10481
+ readonly width: "2px";
10482
+ };
10483
+ };
10392
10484
  readonly font: {
10393
10485
  readonly base: {
10394
10486
  readonly "16": {
@@ -10418,7 +10510,10 @@ declare const dsw: TokenVars<{
10418
10510
  };
10419
10511
  };
10420
10512
  };
10421
- readonly family: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',\n 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif";
10513
+ readonly family: {
10514
+ readonly $: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',\n 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif";
10515
+ readonly brand: "'Montserrat', var(--dsw-font-family)";
10516
+ };
10422
10517
  readonly l: {
10423
10518
  readonly "20": {
10424
10519
  readonly $: "500 20px/28px var(--dsw-font-family)";
@@ -10780,6 +10875,19 @@ declare const dsw: TokenVars<{
10780
10875
  };
10781
10876
  };
10782
10877
  };
10878
+ readonly gradient: {
10879
+ readonly onboarding: {
10880
+ readonly blue: {
10881
+ readonly stops: "#3964fe 18.75%, #398efe 51.78%, #6dccff 86.252%, #3964fe";
10882
+ };
10883
+ readonly cyan: {
10884
+ readonly stops: "#0293b4 21.154%, #2dc8eb 50.954%, #aff0ff 85.326%, #0293b4";
10885
+ };
10886
+ readonly violet: {
10887
+ readonly stops: "#2a2fb6 33.102%, #8b76f6 50.954%, #c5c0ff 85.326%, #2a2fb6";
10888
+ };
10889
+ };
10890
+ };
10783
10891
  readonly linear: {
10784
10892
  readonly gradient: {
10785
10893
  readonly think: "linear-gradient(180deg, #fff 20.19%, rgba(255, 255, 255, 0) 100%)";
@@ -10789,12 +10897,23 @@ declare const dsw: TokenVars<{
10789
10897
  };
10790
10898
  };
10791
10899
  readonly mask: {
10792
- readonly blur: "blur(2px)";
10900
+ readonly blur: "none";
10793
10901
  };
10794
10902
  readonly menu: {
10795
10903
  readonly backdrop: {
10796
10904
  readonly filter: "blur(40px) saturate(150%)";
10797
10905
  };
10906
+ readonly surface: {
10907
+ readonly fill: "rgba(248, 249, 250, 0.58)";
10908
+ };
10909
+ };
10910
+ readonly radius: {
10911
+ readonly lg: "16px";
10912
+ readonly md: "12px";
10913
+ readonly panel: "28px";
10914
+ readonly sm: "8px";
10915
+ readonly xl: "20px";
10916
+ readonly xs: "4px";
10798
10917
  };
10799
10918
  readonly shadow: {
10800
10919
  readonly lv1: {
@@ -10815,7 +10934,7 @@ declare const dsw: TokenVars<{
10815
10934
  readonly login: {
10816
10935
  readonly input: "var(--dsw-static-neutral-bluish-50)";
10817
10936
  };
10818
- readonly menu: "rgba(248, 249, 250, 0.58)";
10937
+ readonly menu: "var(--dsw-menu-surface-fill)";
10819
10938
  readonly selector: "var(--dsw-static-neutral-bluish-60)";
10820
10939
  readonly sidebar: {
10821
10940
  readonly fill: "var(--dsw-static-neutral-bluish-50)";
@@ -11190,6 +11309,7 @@ declare function SettingsValueField(props: Omit<SettingsFieldProps, "hint"> & {
11190
11309
  * A write-only credential control. The value never rides a response, so the
11191
11310
  * control reports only whether one is configured and starts blank; a blank
11192
11311
  * draft writes nothing, which keeps the stored key rather than clearing it.
11312
+ * 控件要求浏览器不要把已存的登录密码自动填进来(上游 11c0511271)。
11193
11313
  * @param props - the field's copy, its staged text, and the configured state.
11194
11314
  * @returns the labelled control.
11195
11315
  */
@@ -11234,6 +11354,901 @@ interface SettingsFormProps {
11234
11354
  */
11235
11355
  declare function SettingsForm(props: SettingsFormProps): import("react/jsx-runtime").JSX.Element;
11236
11356
  //#endregion
11357
+ //#region src/client/schema-form/schema-node.d.ts
11358
+ /** 节点不可编辑的原因;`null` 表示可编辑。 */
11359
+ type ReadOnlyReason = "transform" | "function" | "constructor";
11360
+ /** 归一化后的字段元数据(schemastery `meta` 的可用子集)。 */
11361
+ interface FieldMeta {
11362
+ /** `description`(可能是本地化字典):渲染时经 locale 解析。 */
11363
+ description: string | Readonly<Record<string, string>> | undefined;
11364
+ /** `comment`:纯文本补充说明。 */
11365
+ comment: string | undefined;
11366
+ /** `link`:外部文档。 */
11367
+ link: string | undefined;
11368
+ /** `role`:控件提示(`secret` / `slider` / `datetime` …)。 */
11369
+ role: string | undefined;
11370
+ /** `role === 'secret'`:值不回传,只能写。 */
11371
+ secret: boolean;
11372
+ /** `required()`。 */
11373
+ required: boolean;
11374
+ /** `disabled()`:控件禁用。 */
11375
+ disabled: boolean;
11376
+ /** `collapse()`:嵌套分组默认折叠。 */
11377
+ collapse: boolean;
11378
+ /** `deprecated()` / `experimental()` 的徽标文本。 */
11379
+ badges: readonly string[];
11380
+ /** `pattern()` 的正则来源。 */
11381
+ pattern: string | undefined;
11382
+ /** `min()`。 */
11383
+ min: number | undefined;
11384
+ /** `max()`。 */
11385
+ max: number | undefined;
11386
+ /** `step()`:`1` 表示整数。 */
11387
+ step: number | undefined;
11388
+ /** 是否声明了默认值(与「默认值是 undefined」区分开)。 */
11389
+ hasDefault: boolean;
11390
+ /** 声明的默认值。 */
11391
+ defaultValue: unknown;
11392
+ /** `extra()`:角色附带的任意数据,字段槽的自定义控件可用。 */
11393
+ extra: unknown;
11394
+ }
11395
+ /** 每种节点共有的部分。 */
11396
+ interface FieldNodeBase {
11397
+ /** 这一层的名字:对象字段名、tuple 的索引、动态子节点的占位段。 */
11398
+ key: string;
11399
+ /** 从段根起的路径;动态段是 {@link DYNAMIC_SEGMENT}。 */
11400
+ path: readonly string[];
11401
+ /**
11402
+ * 按值展开时算好的显示名:数组成员的**项身份**(见 {@link FieldNodeBase} 所在的 array 节点)。
11403
+ * 投影时没有(`undefined`),渲染层用它优先于字段名。
11404
+ */
11405
+ label: string | undefined;
11406
+ /** 归一化后的元数据。 */
11407
+ meta: FieldMeta;
11408
+ /** 不可编辑的原因;`null` 表示可编辑。 */
11409
+ readOnly: ReadOnlyReason | null;
11410
+ }
11411
+ /** 位集的一位。 */
11412
+ interface BitsEntry {
11413
+ name: string;
11414
+ bit: number;
11415
+ }
11416
+ /** 渲染层要的一个字段节点。 */
11417
+ type FieldNode = (FieldNodeBase & {
11418
+ type: "object";
11419
+ fields: readonly FieldNode[];
11420
+ }) | (FieldNodeBase & {
11421
+ type: "dict";
11422
+ keyNode: FieldNode;
11423
+ valueNode: FieldNode;
11424
+ }) | (FieldNodeBase & {
11425
+ type: "array";
11426
+ item: FieldNode;
11427
+ /**
11428
+ * 项的**身份键**:这一项的「名字」取自它自己的哪个字段。显式声明优先
11429
+ * (`z.array(inner).role('items', { mergeKey: 'id' })`),否则 item 上有 `id` 字段就用 `id`。
11430
+ * 它只决定显示名与「同名即冲突」的判据——写盘仍按索引(host 的 path op 就是索引语义)。
11431
+ */
11432
+ mergeKey: string | undefined;
11433
+ }) | (FieldNodeBase & {
11434
+ type: "tuple";
11435
+ items: readonly FieldNode[];
11436
+ }) | (FieldNodeBase & {
11437
+ type: "union";
11438
+ /** 成员全是字面量时的可选项;否则 `undefined`。 */
11439
+ choices: readonly unknown[] | undefined;
11440
+ variants: readonly FieldNode[];
11441
+ /**
11442
+ * 判别标签:按哪个字段的值挑变体。显式声明优先
11443
+ * (`z.union([...]).role('union', { tag: 'kind' })`),否则取所有对象成员共有的**唯一**常量字段。
11444
+ * schemastery 本身没有 tag 机制(union 按声明顺序逐个试),所以这只是渲染与校验的选支依据。
11445
+ */
11446
+ tagKey: string | undefined;
11447
+ }) | (FieldNodeBase & {
11448
+ type: "intersect";
11449
+ members: readonly FieldNode[];
11450
+ }) | (FieldNodeBase & {
11451
+ type: "bitset";
11452
+ bits: readonly BitsEntry[];
11453
+ }) | (FieldNodeBase & {
11454
+ type: "const";
11455
+ value: unknown;
11456
+ }) | (FieldNodeBase & {
11457
+ type: "lazy";
11458
+ inner: FieldNode;
11459
+ }) | (FieldNodeBase & {
11460
+ type: "string" | "number" | "boolean" | "any" | "never" | "function";
11461
+ }) |
11462
+ /** 自引用 schema 回到祖先处:值这一层以下不再描述,由渲染层展开或只读呈现。 */
11463
+ (FieldNodeBase & {
11464
+ type: "recursive";
11465
+ origin: string;
11466
+ });
11467
+ /**
11468
+ * 投影一个 schema 节点。
11469
+ * @param schema - rehydrate 之后的 volatile 表单 schema(或它的子节点)。
11470
+ * @param path - 该节点相对段根的路径;动态子节点由调用方给占位段。
11471
+ * @returns 渲染层要的字段树。
11472
+ */
11473
+ declare function projectNode(schema: SchemaNode, path?: readonly string[]): FieldNode;
11474
+ /** 按当前值展开出的一个字段:路径与名字已按真实键与索引替换。 */
11475
+ interface WalkedField {
11476
+ path: readonly string[];
11477
+ node: FieldNode;
11478
+ /**
11479
+ * 这一行是某个动态容器的**成员本身**(dict 的键 / array 的项)时给出它的身份:容器路径、键、以及数组
11480
+ * 项的位置。渲染层用它画成员行(名字 + 移除);成员的子字段不带这个标记。
11481
+ */
11482
+ member?: {
11483
+ parent: readonly string[];
11484
+ key: string;
11485
+ index: number | undefined;
11486
+ };
11487
+ }
11488
+ /** 候选键的来源(业务注册;见 `hints.ts`):dict 的「可以加哪些键」。 */
11489
+ interface SuggestedKeys {
11490
+ /**
11491
+ * 读某个 dict 字段的候选键。
11492
+ * @param path - 该字段的具体路径。
11493
+ * @returns 候选键;没有就是空数组。
11494
+ */
11495
+ keysFor(path: readonly string[]): readonly string[];
11496
+ }
11497
+ /**
11498
+ * 按当前值把字段树展开成渲染顺序的扁平列表(前序):容器在前、子项紧随其后。
11499
+ *
11500
+ * 出现的**只有值里有的东西,加上必填的**:对象的必填字段始终占行(值是空的也要让用户看见"必须填"),非必填的
11501
+ * 按值出现——值里没有就不占行,它在这一层的「添加属性」候选里,选中才加。数组按索引、字典按键展开;字面量
11502
+ * union 是叶子控件,对象 union 只展开与当前值匹配的那个变体,intersect 的各成员在同一层展开。
11503
+ * @param root - 段根的字段树。
11504
+ * @param value - 生效值(或草稿后的值)。
11505
+ * @returns 渲染顺序的字段列表。
11506
+ */
11507
+ declare function walkFields(root: FieldNode, value: unknown): WalkedField[];
11508
+ /** union 的变体切换:一个选项要写的值。 */
11509
+ interface VariantChoice {
11510
+ /** 页面上显示的名字:判别标签的值,或变体的形状。 */
11511
+ label: string;
11512
+ /** 写这个值就等于选中这一支。 */
11513
+ value: unknown;
11514
+ }
11515
+ //#endregion
11516
+ //#region src/client/schema-form/draft.d.ts
11517
+ /** 命名空间段(一段配置)的值。 */
11518
+ type Section = Record<string, unknown>;
11519
+ /** 文本草稿的解析结果:控件把用户输入交给保存那一刻解析。 */
11520
+ type TextParseResult =
11521
+ /** 得到一个值。 */
11522
+ {
11523
+ kind: "value";
11524
+ value: unknown;
11525
+ } |
11526
+ /** 这段文本不产生写(例如 secret 留空=保留已存的值)。 */
11527
+ {
11528
+ kind: "skip";
11529
+ } |
11530
+ /** 不是这个字段接受的值:留在屏幕上并挡住保存。 */
11531
+ {
11532
+ kind: "invalid";
11533
+ message: string;
11534
+ };
11535
+ /** 控件给文本草稿的解析规则。 */
11536
+ type TextParse = (text: string) => TextParseResult;
11537
+ /** 整段校验失败:消息 + 它落在哪一层(页面把消息画在**出错的那一行**上)。 */
11538
+ interface ValidationFailure {
11539
+ /** 面向用户的消息(已去掉 schemastery 拼的 `$…` 位置前缀)。 */
11540
+ message: string;
11541
+ /** 具体路径(段根起);空数组表示错误在整段上。 */
11542
+ path: readonly string[];
11543
+ }
11544
+ /**
11545
+ * 把校验器抛出的错误收成一条失败。
11546
+ *
11547
+ * schemastery 的 `ValidationError` 把路径留在 `options.path` 上(消息里的 `$…` 前缀是给命令行看的),所以这里
11548
+ * 取路径、去前缀——行内报错据此知道挂在哪一行。
11549
+ * @param error - 校验器抛出的错误。
11550
+ * @returns 消息与路径。
11551
+ */
11552
+ declare function failureOf(error: unknown): ValidationFailure;
11553
+ /** 一字段渲染时要读的状态。 */
11554
+ interface DraftFieldState {
11555
+ /** 控件要显示的值:草稿优先,否则生效层。 */
11556
+ value: unknown;
11557
+ /** 文本草稿(文本控件显示它而不是重新格式化值)。 */
11558
+ text: string | undefined;
11559
+ /** 草稿不合法时的消息(控件显示,同时挡住保存)。 */
11560
+ invalid: string | undefined;
11561
+ /** 保存后这一字段是否会留下用户层条目。 */
11562
+ overridden: boolean;
11563
+ /** 这一字段在本页有还没保存的编辑(页面上给它一处高亮与一个「撤回」)。 */
11564
+ staged: boolean;
11565
+ }
11566
+ /** 模型要读要写的那个命名空间。 */
11567
+ type DraftScope = ConfigForm<Section>;
11568
+ //#endregion
11569
+ //#region src/client/schema-form/hints.d.ts
11570
+ /** 一个 dict 字段的候选键读数。 */
11571
+ type SuggestedKeysReader = () => readonly string[];
11572
+ /** 一个字段的文案(业务知道的说法;schema 上没有 title 这种位)。 */
11573
+ interface FieldText {
11574
+ /** 短名字(行式视图里当注释的抬头)。 */
11575
+ label?: string | undefined;
11576
+ /** 一句话说明。 */
11577
+ hint?: string | undefined;
11578
+ }
11579
+ /** 一个字段的文案读数。 */
11580
+ type FieldTextReader = () => FieldText;
11581
+ /** 一个可选项:要写进去的值,以及页面上显示的名字。 */
11582
+ interface SelectOption {
11583
+ /** 选中时写进配置的值。 */
11584
+ value: unknown;
11585
+ /** 显示名;省略就用值本身。 */
11586
+ label?: string | undefined;
11587
+ }
11588
+ /** 一个字段的候选值读数。 */
11589
+ interface SelectSpec {
11590
+ /**
11591
+ * 候选依赖哪些**兄弟字段**(相对该字段所在对象的路径)。
11592
+ *
11593
+ * 依赖只声明"什么时候要重算":读侧在投影时按当前读数(草稿优先)求一次候选,所以声明了依赖的字段会随着
11594
+ * 兄弟字段的编辑立刻换候选——「选完服务商才列它有哪些模型」就是这么来的。
11595
+ */
11596
+ dependsOn?: readonly (readonly string[])[] | undefined;
11597
+ /**
11598
+ * 求候选。
11599
+ * @param read - 按依赖路径(相对该字段所在对象)读当前值:草稿优先。
11600
+ * @returns 可选项,顺序即页面上的顺序。
11601
+ */
11602
+ options: (read: (path: readonly string[]) => unknown) => readonly SelectOption[];
11603
+ }
11604
+ /** 一个命名空间里各字段的候选键、文案与候选值。 */
11605
+ interface SchemaFormHintsFace {
11606
+ /**
11607
+ * 注册一个 dict 字段的候选键读数(重复注册同一处会覆盖,并通知一次)。
11608
+ * @param ns - settings 命名空间(行 id)。
11609
+ * @param path - 该 dict 字段的具体路径(顶层字段就是 `['models']`)。
11610
+ * @param read - 同步读数:当前候选键(顺序即页面上的顺序)。
11611
+ * @returns 注销函数。
11612
+ */
11613
+ suggestKeys(ns: string, path: readonly string[], read: SuggestedKeysReader): () => void;
11614
+ /**
11615
+ * 读某处当前声明的候选键。
11616
+ * @param ns - settings 命名空间。
11617
+ * @param path - 该字段的路径。
11618
+ * @returns 候选键;没注册过就是空数组。
11619
+ */
11620
+ keysFor(ns: string, path: readonly string[]): readonly string[];
11621
+ /**
11622
+ * 注册一个字段的文案(短名 + 一句话说明)。行式视图把它画成注释行;schema 的 `description` 是兜底。
11623
+ * @param ns - settings 命名空间。
11624
+ * @param path - 该字段的路径。
11625
+ * @param read - 同步读数。
11626
+ * @returns 注销函数。
11627
+ */
11628
+ describe(ns: string, path: readonly string[], read: FieldTextReader): () => void;
11629
+ /**
11630
+ * 读某处当前注册的文案。
11631
+ * @param ns - settings 命名空间。
11632
+ * @param path - 该字段的路径。
11633
+ * @returns 文案;没注册过就是空对象。
11634
+ */
11635
+ textFor(ns: string, path: readonly string[]): FieldText;
11636
+ /**
11637
+ * 注册一个字段的候选值读数(页面据此把字段画成选择器,并随依赖字段变化重算)。
11638
+ * @param ns - settings 命名空间。
11639
+ * @param path - 该字段的路径。
11640
+ * @param spec - 候选取法与它依赖的兄弟字段。
11641
+ * @returns 注销函数。
11642
+ */
11643
+ select(ns: string, path: readonly string[], spec: SelectSpec): () => void;
11644
+ /**
11645
+ * 注册一个**具名候选源**:schema 上用 `role('select', { source })` 认领它,字段因此不必在客户端按 ns/path
11646
+ * 登记——同一个源可以被多行、多个字段复用(「服务商」「模型」就是这种)。
11647
+ * @param name - 源的名字(schema 的 `role` extra 里写的那一个)。
11648
+ * @param spec - 候选取法与它依赖的兄弟字段。
11649
+ * @returns 注销函数。
11650
+ */
11651
+ source(name: string, spec: SelectSpec): () => void;
11652
+ /**
11653
+ * 读一个具名候选源。
11654
+ * @param name - 源的名字。
11655
+ * @returns 该源的读数;没注册过就是 `undefined`。
11656
+ */
11657
+ sourceFor(name: string): SelectSpec | undefined;
11658
+ /**
11659
+ * 读某处当前声明的候选值读数。
11660
+ * @param ns - settings 命名空间。
11661
+ * @param path - 该字段的路径。
11662
+ * @returns 候选读数;没注册过就是 `undefined`。
11663
+ */
11664
+ selectFor(ns: string, path: readonly string[]): SelectSpec | undefined;
11665
+ }
11666
+ /** 提示面的完整服务(业务用注册侧,表单一侧用读侧)。 */
11667
+ declare class SchemaFormHints extends Service implements SchemaFormHintsFace {
11668
+ #private;
11669
+ /** @param ctx - 提供本服务的插件上下文。 */
11670
+ constructor(ctx: Context);
11671
+ /** @param ns - settings 命名空间。 @param path - 字段路径。 @returns 该处的键。 */
11672
+ keysFor(ns: string, path: readonly string[]): readonly string[];
11673
+ /** @param ns - settings 命名空间。 @param path - 字段路径。 @returns 该处注册的文案。 */
11674
+ textFor(ns: string, path: readonly string[]): FieldText;
11675
+ /**
11676
+ * @param ns - settings 命名空间。
11677
+ * @param path - 字段路径。
11678
+ * @param spec - 候选取法与依赖。
11679
+ * @returns 注销函数。
11680
+ */
11681
+ select(ns: string, path: readonly string[], spec: SelectSpec): () => void;
11682
+ /** @param ns - settings 命名空间。 @param path - 字段路径。 @returns 该处注册的候选读数。 */
11683
+ selectFor(ns: string, path: readonly string[]): SelectSpec | undefined;
11684
+ /**
11685
+ * @param name - 源的名字。
11686
+ * @param spec - 候选取法与依赖。
11687
+ * @returns 注销函数。
11688
+ */
11689
+ source(name: string, spec: SelectSpec): () => void;
11690
+ /** @param name - 源的名字。 @returns 该源注册的候选读数。 */
11691
+ sourceFor(name: string): SelectSpec | undefined;
11692
+ /**
11693
+ * @param ns - settings 命名空间。
11694
+ * @param path - 字段路径。
11695
+ * @param read - 同步读数。
11696
+ * @returns 注销函数。
11697
+ */
11698
+ describe(ns: string, path: readonly string[], read: FieldTextReader): () => void;
11699
+ /**
11700
+ * @param ns - settings 命名空间。
11701
+ * @param path - 字段路径。
11702
+ * @param read - 同步读数。
11703
+ * @returns 注销函数。
11704
+ */
11705
+ suggestKeys(ns: string, path: readonly string[], read: SuggestedKeysReader): () => void;
11706
+ /**
11707
+ * 观察候选键的变化(注册与注销)。
11708
+ * @param listener - 变更回调。
11709
+ * @returns 取消订阅。
11710
+ */
11711
+ subscribe(listener: () => void): () => void;
11712
+ /**
11713
+ * 重新通知一次:读数背后的数据变了(业务自己知道),页面据此重算候选行。
11714
+ */
11715
+ refresh(): void;
11716
+ }
11717
+ declare module "@deepseek-ai/cordis" {
11718
+ interface Context {
11719
+ /** 通用表单的提示面(dict 的候选键)。 */
11720
+ schemaFormHints: SchemaFormHints;
11721
+ }
11722
+ }
11723
+ //#endregion
11724
+ //#region src/client/schema-form/controller.d.ts
11725
+ /**
11726
+ * rehydrate 一段配置 schema,并判它能不能当页面的根。
11727
+ *
11728
+ * 能当根的形状有三种:对象段、**相交段**(共享判别字段 + 各分支的 `const` 标记,段值仍是对象)、以及带判别
11729
+ * 标签的 `union`(成员都是对象)。字面量 `union`(整段就是一个标量)不行:那一行的写盘会变成整段替换。
11730
+ * @param serialized - host 发来的 `schema.toJSON()`。
11731
+ * @param rehydrate - host schema 的 rehydrate。
11732
+ * @returns schema 与它的字段树,或 `undefined`(不能当页面根)。
11733
+ */
11734
+ declare function projectRoot(serialized: unknown, rehydrate: (serialized: unknown) => SchemaNode): {
11735
+ schema: SchemaNode;
11736
+ root: FieldNode;
11737
+ } | undefined;
11738
+ /**
11739
+ * 一行能否自动生成配置页:它的 schema 能 rehydrate 且根是 {@link projectRoot} 认的形状。
11740
+ * @param view - host 发来的命名空间视图。
11741
+ * @param rehydrate - host schema 的 rehydrate。
11742
+ * @returns 是否可以渲染。
11743
+ */
11744
+ declare function canRender(view: SettingsNamespaceView | undefined, rehydrate: (serialized: unknown) => SchemaNode): boolean;
11745
+ /** 提示面在控制器里的读法:候选键 + 字段文案 + 候选值。 */
11746
+ interface HintSources extends SuggestedKeys {
11747
+ /**
11748
+ * 读某个字段的文案。
11749
+ * @param path - 该字段的具体路径。
11750
+ * @returns 业务注册的文案;没有就是空对象。
11751
+ */
11752
+ textFor: (path: readonly string[]) => FieldText;
11753
+ /**
11754
+ * 读某个字段的候选值读数;不接提示面的装配可以不给(字段就还是文本编辑)。
11755
+ * @param path - 该字段的具体路径。
11756
+ * @returns 业务注册的候选读数;没有就是 `undefined`。
11757
+ */
11758
+ selectFor?: ((path: readonly string[]) => SelectSpec | undefined) | undefined;
11759
+ /**
11760
+ * 读一个**具名候选源**(schema 的 `role('select', { source })` 认领它)。
11761
+ * @param name - 源的名字。
11762
+ * @returns 该源的读数;没注册过就是 `undefined`。
11763
+ */
11764
+ sourceFor?: ((name: string) => SelectSpec | undefined) | undefined;
11765
+ }
11766
+ /** 控制器要的外部面(`apply` 里从 cordis ctx 组装;测试直接给替身)。 */
11767
+ interface SchemaFormDeps {
11768
+ /** 本命名空间的共享配置表单(读 + 带栅栏的写)。 */
11769
+ form: DraftScope;
11770
+ /** describe mirror 的读面:本行的 schema、autoGenerate 与 secret 槽。 */
11771
+ describe: SettingsDescribeFace;
11772
+ /** rehydrate host 发来的 `schema.toJSON()`。 */
11773
+ rehydrate: (serialized: unknown) => SchemaNode;
11774
+ /** 整段校验;失败时连路径一起给(页面把消息画在那一行)。 */
11775
+ validate: (schema: SchemaNode, value: unknown) => ValidationFailure | undefined;
11776
+ /** 本包字典(项身份冲突这类本地校验的消息)。 */
11777
+ t: SchemaFormTranslate;
11778
+ /**
11779
+ * dict 字段的候选键(业务注册,见 `hints.ts`):候选里有、值里没有的键会补成一行「未配置」,
11780
+ * 用户填了才算写。
11781
+ */
11782
+ hints?: HintSources | undefined;
11783
+ }
11784
+ /**
11785
+ * 这一层「能加进来」的一项:schema 里声明、值里还没有的字段,或业务注册的候选键。
11786
+ *
11787
+ * 页面上不占行——它们出现在容器的闭合行那个「添加属性 / 添加键」输入框的候选里,选中才加。
11788
+ */
11789
+ interface AddableProperty {
11790
+ /** 加进来的键名。 */
11791
+ key: string;
11792
+ /** 说明(schema 的 `description` / `comment`,可能是本地化字典):渲染层解析后当候选的副标题。 */
11793
+ description: string | Readonly<Record<string, string>> | undefined;
11794
+ }
11795
+ /** 页面级状态:表单壳 + 字段树 + 每字段草稿状态。 */
11796
+ interface SchemaFormState extends SettingsFormShell$1 {
11797
+ /** 这一行的 schema 是否可渲染(否则页面只显示一行说明)。 */
11798
+ configured: boolean;
11799
+ /** 字段树;未 configured 时是空对象树。 */
11800
+ root: FieldNode;
11801
+ /** 按草稿后的值展开的字段列表(渲染顺序):追加的数组项与新增的字典键立刻出现。 */
11802
+ walked: readonly WalkedField[];
11803
+ /** 每个具体路径的草稿状态,键见 {@link fieldKey}。 */
11804
+ fields: ReadonlyMap<string, DraftFieldState>;
11805
+ /** secret 槽是否已配置,键见 {@link fieldKey}。 */
11806
+ secrets: ReadonlyMap<string, boolean>;
11807
+ /** 每个字段的文案(提示面注册的),键见 {@link fieldKey};渲染层把它画成注释行。 */
11808
+ texts: ReadonlyMap<string, FieldText>;
11809
+ /**
11810
+ * 每个字段的可选项,键见 {@link fieldKey}:字面量集合的 union 自带候选,其余来自提示面。
11811
+ * 候选依赖的兄弟字段一改,这里就跟着变(投影时按草稿后的值求一次)。
11812
+ */
11813
+ options: ReadonlyMap<string, readonly SelectOption[]>;
11814
+ /**
11815
+ * 每个容器能加进来的项,键见 {@link fieldKey}(容器自己的路径)。没有条目就是加不了东西——对象层的输入框
11816
+ * 因此只在还有声明字段没配时出现。
11817
+ */
11818
+ addable: ReadonlyMap<string, readonly AddableProperty[]>;
11819
+ /** 保存被 schema 挡下时的消息与它的位置。 */
11820
+ violation: ValidationFailure | undefined;
11821
+ /** 每行的校验消息(键见 {@link fieldKey}):行内报错,与底部的整段提示同源。 */
11822
+ invalidAt: ReadonlyMap<string, string>;
11823
+ }
11824
+ /** 控件的写动作:全部落在草稿上,`save` 是唯一的写盘点。 */
11825
+ interface SchemaFormActions {
11826
+ /** 暂存一个合法值。 */
11827
+ set: (path: readonly string[], value: unknown) => void;
11828
+ /** 暂存一段文本(保存时解析)。 */
11829
+ setText: (path: readonly string[], text: string, parse: TextParse) => void;
11830
+ /** 暂存「恢复默认」。 */
11831
+ clear: (path: readonly string[]) => void;
11832
+ /** 追加一个数组项。 */
11833
+ appendItem: (path: readonly string[]) => void;
11834
+ /** 移除一个数组项。 */
11835
+ removeItem: (path: readonly string[], index: number) => void;
11836
+ /** 加一个字典键。 */
11837
+ addKey: (path: readonly string[], key: string) => void;
11838
+ /** 删一个字典键。 */
11839
+ removeKey: (path: readonly string[], key: string) => void;
11840
+ /** 写盘。 */
11841
+ save: () => void;
11842
+ /** 撤销一个字段的草稿(行内编辑取消)。 */
11843
+ revert: (path: readonly string[]) => void;
11844
+ /** 丢弃草稿。 */
11845
+ discard: () => void;
11846
+ }
11847
+ /** 槽位渲染器绑定的动作与可观察状态。 */
11848
+ interface SchemaFormFace extends SchemaFormActions {
11849
+ hooks: {
11850
+ schemaForm: SnapshotStore<SchemaFormState>;
11851
+ };
11852
+ }
11853
+ /**
11854
+ * 一个字段的可选项。
11855
+ *
11856
+ * 字面量集合的 union(`z.union(["wal", "delete"])`)自己就带着候选;其余看提示面注册的读数——读的时候把依赖的
11857
+ * 兄弟字段值喂进去,所以「选完服务商才列它有哪些模型」是投影的一部分,不是额外的一次订阅。
11858
+ * @param node - 字段节点。
11859
+ * @param path - 该字段的具体路径。
11860
+ * @param value - 段值(草稿后的)。
11861
+ * @param hints - 提示面。
11862
+ * @returns 可选项;没有候选就是 `undefined`。
11863
+ */
11864
+ declare function optionsFor(node: FieldNode, path: readonly string[], value: unknown, hints: HintSources | undefined): readonly SelectOption[] | undefined;
11865
+ /**
11866
+ * 一行配置页的控制器。
11867
+ */
11868
+ declare class SchemaFormController {
11869
+ #private;
11870
+ /**
11871
+ * @param ns - settings 命名空间(行 id)。
11872
+ * @param deps - 该行的共享表单与 schema 面。
11873
+ */
11874
+ constructor(ns: string, deps: SchemaFormDeps);
11875
+ /** 槽位渲染器要的动作与状态。 */
11876
+ face(): SchemaFormFace;
11877
+ /** 本行的 settings 命名空间。 */
11878
+ namespace(): string;
11879
+ /** 外部提示(候选键这类)变了:重新投影一次,字段树与草稿都不动。 */
11880
+ refresh(): void;
11881
+ /** 释放订阅。 */
11882
+ dispose(): void;
11883
+ }
11884
+ //#endregion
11885
+ //#region src/client/schema-form/labels.d.ts
11886
+ /** 把 schema 里的本地化文本解析成当前语言;由 locale 服务提供。 */
11887
+ type ResolveText = (text: string | Readonly<Record<string, string>>) => string;
11888
+ //#endregion
11889
+ //#region src/client/schema-form/locales.d.ts
11890
+ /**
11891
+ * 本包字典(命名空间 `settings.schema-form`):表单壳、字段控件与只读呈现的文案。
11892
+ *
11893
+ * 字段自身的人话标签不在这里(那是业务方经字段槽或 schema `description` 给的),这里只放**机制**文案。
11894
+ */
11895
+ /** 中文文案(部署语言偏好是 zh)。 */
11896
+ declare const zh: {
11897
+ readonly unavailable: "该插件当前未加载,暂时无法配置。";
11898
+ readonly readOnly: "本部署的设置为只读。";
11899
+ readonly save: "保存";
11900
+ readonly confirmEdit: "确认";
11901
+ readonly cancelEdit: "取消";
11902
+ readonly saving: "保存中…";
11903
+ readonly saveFailed: "本部署没有接受这些值,已保留供你修改。";
11904
+ readonly notSaved: "没有保存:{message}";
11905
+ readonly noSchema: "这一行没有可自动生成的配置项。";
11906
+ readonly reset: "恢复默认";
11907
+ readonly revert: "撤回";
11908
+ readonly invalid: "这个值不被接受。";
11909
+ readonly invalidNumber: "需要一个数字。";
11910
+ readonly invalidInteger: "需要一个整数。";
11911
+ readonly invalidJson: "需要一段合法的 JSON。";
11912
+ readonly invalidBoolean: "需要 true 或 false。";
11913
+ readonly invalidConst: "这个字段只接受固定值。";
11914
+ readonly invalidPattern: "要匹配 {pattern}。";
11915
+ readonly invalidRange: "要在 {min} 与 {max} 之间。";
11916
+ readonly invalidMin: "不能小于 {min}。";
11917
+ readonly invalidMax: "不能大于 {max}。";
11918
+ readonly invalidChoice: "只能是 {choices} 之一。";
11919
+ readonly unknownProperty: "这一层没有这个字段:从上面的候选里选,或换个键名。";
11920
+ readonly empty: "(空)";
11921
+ readonly toggleGroup: "展开 / 收起这一层";
11922
+ readonly switchVariant: "切换这一层的形状或分支";
11923
+ readonly copyValue: "复制值";
11924
+ readonly copied: "已复制";
11925
+ readonly addProperty: "添加属性";
11926
+ readonly addItemPaste: "添加数组项(可粘贴 JSON 字符串)";
11927
+ readonly addItem: "添加一项";
11928
+ readonly removeItem: "移除";
11929
+ readonly addKey: "添加键(可粘贴 JSON 字符串)";
11930
+ readonly keyName: "键名";
11931
+ readonly noKeys: "还没有键。";
11932
+ readonly noItems: "还没有项。";
11933
+ readonly deprecated: "已废弃";
11934
+ readonly experimental: "试验中";
11935
+ readonly secretSet: "已配置";
11936
+ readonly secretUnset: "未配置";
11937
+ readonly secretHint: "留空即保留已存的值。";
11938
+ readonly constValue: "固定值";
11939
+ readonly notEditable: "这一项由插件在运行时提供,不能在页面上编辑。";
11940
+ readonly recursive: "递归结构:展开到这一层为止。";
11941
+ readonly fixedLength: "固定长度";
11942
+ readonly bitsetHint: "可多选。";
11943
+ readonly unconfigured: "未配置";
11944
+ readonly readOnlyField: "只读";
11945
+ readonly noDescription: "(无说明)";
11946
+ readonly required: "必填";
11947
+ readonly duplicateItem: "重复的 {key}:{value}";
11948
+ readonly missingItem: "每一项都需要一个 {key}";
11949
+ };
11950
+ /** 本命名空间的字典键。 */
11951
+ type SchemaFormLocaleKey = keyof typeof zh;
11952
+ //#endregion
11953
+ //#region src/client/schema-form/slot-contract.d.ts
11954
+ /** 字段槽的 owner props:路由输入 + 显示状态 + 受控动作(默认控件要的一切都在这里)。 */
11955
+ interface SchemaFieldOwnerProps {
11956
+ /** settings 命名空间(行 id)。 */
11957
+ ns: string;
11958
+ /** 字段的具体路径(动态段已按真实键或索引替换)。 */
11959
+ path: readonly string[];
11960
+ /** 字段节点(类型、`role`、`extra`、界限、只读原因)。 */
11961
+ node: FieldNode;
11962
+ /** 显示标签:默认是字段名拆词,业务方经槽给时会覆盖。 */
11963
+ label: string;
11964
+ /** 显示说明(`description` 本地化 + `comment`)。 */
11965
+ hint: string | undefined;
11966
+ /** 当前生效值(草稿优先)。 */
11967
+ value: unknown;
11968
+ /**
11969
+ * 这个字段的可选项:给了就是选择器(点值不再进文本编辑)。来源是字面量集合的 union,或业务经提示面注册的
11970
+ * 候选——候选依赖的兄弟字段一变,这里就换一批。
11971
+ */
11972
+ options: readonly SelectOption[] | undefined;
11973
+ /** 文本草稿:文本控件显示它,而不是重新格式化生效值。 */
11974
+ text: string | undefined;
11975
+ /** secret 槽是否已配置(值本身不回传)。 */
11976
+ secretConfigured: boolean;
11977
+ /** 嵌套深度:默认控件按它缩进。 */
11978
+ depth: number;
11979
+ /** 保存后这一字段是否会留下用户层条目。 */
11980
+ overridden: boolean;
11981
+ /** 草稿不合法时的消息。 */
11982
+ invalid: string | undefined;
11983
+ /** 只读部署或不可用命名空间时为 true。 */
11984
+ disabled: boolean;
11985
+ /** 本包字典(复刻或包装默认控件时用)。 */
11986
+ t: SchemaFormTranslate;
11987
+ /** 容器动作(增删数组项、字典键、丢弃、保存)。 */
11988
+ actions: SchemaFormActions;
11989
+ /**
11990
+ * 分组节点的折叠交互(object / dict / array / tuple);叶子节点是 `undefined`。
11991
+ * 默认折叠与否由 schema 的 `collapse()` 决定,用户点一下就是反转。
11992
+ */
11993
+ group: {
11994
+ collapsed: boolean;
11995
+ toggle: () => void;
11996
+ } | undefined;
11997
+ /**
11998
+ * 这一行是动态容器的成员本身(dict 的键 / array 的项)时的身份:容器路径、键、数组项的位置。容器成员把它画进
11999
+ * 标题行(名字 + 移除),叶子成员由渲染层另起一行——所以「哪个字段属于哪个键/哪一项」在页面上一眼可见。
12000
+ */
12001
+ member: {
12002
+ parent: readonly string[];
12003
+ key: string;
12004
+ index: number | undefined;
12005
+ pending?: boolean;
12006
+ } | undefined;
12007
+ /** 暂存一个合法值。 */
12008
+ onChange: (value: unknown) => void;
12009
+ /**
12010
+ * 暂存一段文本:按字段类型的默认规则解析;给了 `parse` 就用它(例如 secret 留空=不写)。
12011
+ * @param text - 用户输入。
12012
+ * @param parse - 覆盖默认解析规则。
12013
+ */
12014
+ onEditText: (text: string, parse?: TextParse) => void;
12015
+ /** 暂存「恢复默认」。 */
12016
+ onReset: () => void;
12017
+ }
12018
+ /**
12019
+ * 字段槽注册项的完整 props:框架注入的 owner props({@link SchemaFieldOwnerProps})+它的 `select` 结果。
12020
+ *
12021
+ * 注册方的组件按这个类型声明参数(**不要**自己重写 owner props 的类型:注册时框架会把它读成 inject 面)。
12022
+ */
12023
+ type SchemaFieldComponentProps<M extends SchemaFieldMatch = SchemaFieldMatch> = PropsRuntime<"settings.schema-form.field"> & {
12024
+ matched: M;
12025
+ };
12026
+ /**
12027
+ * 字段槽注册项的 `select`:返回认领结果,或 `null` 表示不认领(chain 槽的约定是 `null` 放行给下一项,
12028
+ * `undefined` 不会被当成"不认领")。
12029
+ */
12030
+ type SchemaFieldSelect = (field: SchemaFieldOwnerProps) => SchemaFieldMatch | null;
12031
+ /** 字段槽 `select` 可以只给文案:控件仍由注册方渲染(拿本包的默认控件包一层即可)。 */
12032
+ interface SchemaFieldMatch {
12033
+ /** 覆盖显示标签。 */
12034
+ label?: string;
12035
+ /** 覆盖显示说明。 */
12036
+ hint?: string;
12037
+ }
12038
+ /** Factory 的输入 props:一行的配置页。 */
12039
+ interface SchemaFormProps {
12040
+ /** settings 命名空间(行 id)。 */
12041
+ ns: string;
12042
+ /** 该行的控制器动作与状态。 */
12043
+ face: SchemaFormFace;
12044
+ /** schema 里的本地化文本(`description`)按当前语言解析。 */
12045
+ resolveText: ResolveText;
12046
+ }
12047
+ /** 本包字典的翻译函数(默认控件与表单壳使用)。 */
12048
+ type SchemaFormTranslate = TranslateNS<"settings.schema-form">;
12049
+ declare module "@deepseek-ai/dsh-client-ui-slots" {
12050
+ interface LocaleNamespaceMap {
12051
+ /** 表单壳、字段控件与只读呈现的文案。 */
12052
+ "settings.schema-form": SchemaFormLocaleKey;
12053
+ }
12054
+ interface SlotMap {
12055
+ /**
12056
+ * 字段级自定义输入与文案:按 `role` 或 `ns + path` 认领一个字段,命中即渲染注册方的组件(未命中落到默认
12057
+ * 控件)。注册项由业务插件用 `ctx.slots.inject('settings.schema-form.field', …)` 注册,声明由本包的
12058
+ * Factory 给出。
12059
+ */
12060
+ "settings.schema-form.field": {
12061
+ kind: "chain";
12062
+ scope: "root";
12063
+ owner: SchemaFieldOwnerProps;
12064
+ };
12065
+ }
12066
+ interface SlotFactoryMap {
12067
+ /**
12068
+ * 一行配置页的渲染体:每个可渲染的行注册项经 `renderFactorySlot` 渲染同一个 Factory,字段槽因此只需声明
12069
+ * 一次(slots 的 children 声明 per key 唯一)。
12070
+ */
12071
+ "settings.schema-form.form": {
12072
+ scope: "root";
12073
+ props: SchemaFormProps;
12074
+ locale: "settings.schema-form";
12075
+ children: {
12076
+ "settings.schema-form.field": {
12077
+ kind: "chain";
12078
+ scope: "root";
12079
+ };
12080
+ };
12081
+ };
12082
+ }
12083
+ }
12084
+ //#endregion
12085
+ //#region src/client/schema-form/rows.d.ts
12086
+ /** 一个该自动长出配置页的行。 */
12087
+ interface RowRegistrationPlan {
12088
+ /** `plugins.row.config` 的 key:`<bundle 包名>#<行 id>`。 */
12089
+ key: string;
12090
+ /** settings 命名空间(行 id)。 */
12091
+ ns: string;
12092
+ }
12093
+ /**
12094
+ * 配对命名空间与 bundle 行清单。
12095
+ * @param namespaces - host 发来的命名空间视图。
12096
+ * @param bundles - host 的 bundle 清单(含各 bundle 声明的行 id)。
12097
+ * @returns 该自动注册的行,按命名空间视图的顺序。
12098
+ */
12099
+ declare function rowRegistrations(namespaces: readonly SettingsNamespaceView[], bundles: readonly BundleInfo[]): RowRegistrationPlan[];
12100
+ //#endregion
12101
+ //#region src/client/schema-form/value.d.ts
12102
+ /** 编辑态文本:字符串就是原文(换行照旧),其余按 JSON 写。 */
12103
+ declare function valueText(value: unknown): string;
12104
+ /** 显示态文本:字符串带引号;多行与特殊字符都按 JSON 的写法收在一行里。 */
12105
+ declare function tokenText(value: unknown): string;
12106
+ /** 值的语法色分组。 */
12107
+ declare function tokenTone(value: unknown): "string" | "number" | "boolean" | "empty";
12108
+ /**
12109
+ * 行内值的默认呈现(显示态 token)。
12110
+ * @param props.owner - 字段上下文(值、是否 secret、只读原因)。
12111
+ * @returns 一行里的值节点。
12112
+ */
12113
+ declare function InlineValue({ owner }: {
12114
+ owner: SchemaFieldOwnerProps;
12115
+ }): ReactNode;
12116
+ /**
12117
+ * 字段槽注册方复用的默认值:只改文案时拿它包一层即可(`owner` 上覆盖 `label`/`hint`)。
12118
+ *
12119
+ * 注意行式视图里键名来自配置键本身、注释来自 `hint`,所以 `label` 只在业务自写控件时才需要。
12120
+ */
12121
+ declare function SchemaFieldDefault({ owner }: {
12122
+ owner: SchemaFieldOwnerProps;
12123
+ }): ReactNode;
12124
+ //#endregion
12125
+ //#region src/client/schema-form/fields.d.ts
12126
+ /**
12127
+ * 各类型的文本解析规则(消息来自本包字典)。
12128
+ *
12129
+ * 解析不只看类型:schema 上声明的界限(`pattern` / `min` / `max` / `step`)与字面量集合都在这里说话——
12130
+ * 用户敲完当场就知道对不对,而不是等保存时被整段校验退回。
12131
+ * @param node - 字段节点(`meta` 是约束的来源)。
12132
+ * @param t - 本包字典。
12133
+ * @returns 这段文本的解析规则。
12134
+ */
12135
+ declare function parseFor(node: FieldNode, t: SchemaFormTranslate): TextParse;
12136
+ //#endregion
12137
+ //#region src/client/schema-form/lines.d.ts
12138
+ /** 一个容器的闭合行后面能加什么。 */
12139
+ type AddLineSpec =
12140
+ /** 数组:追加一个空项。 */
12141
+ {
12142
+ kind: "item";
12143
+ } |
12144
+ /** 字典:敲键名,或从候选键里选(业务注册的读数)。 */
12145
+ {
12146
+ kind: "key";
12147
+ options: readonly AddableProperty[];
12148
+ } |
12149
+ /** 对象:从「schema 声明了、值里还没有」的字段里选(没有候选项时不给输入框)。 */
12150
+ {
12151
+ kind: "prop";
12152
+ options: readonly AddableProperty[];
12153
+ };
12154
+ /** 一行上的变体切换控件。 */
12155
+ interface VariantControl {
12156
+ /** 可以切到哪几支;顺序即声明顺序。 */
12157
+ choices: readonly VariantChoice[];
12158
+ /** 当前落在第几支。 */
12159
+ selected: number;
12160
+ }
12161
+ /** 容器类型:结构行用 `{` 还是 `[`。 */
12162
+ type ContainerShape = "object" | "array";
12163
+ /** 一行。 */
12164
+ type EditorLine =
12165
+ /** 容器的开启行:`key: {` 或 `[`。 */
12166
+ {
12167
+ kind: "open";
12168
+ path: readonly string[];
12169
+ node: FieldNode;
12170
+ shape: ContainerShape;
12171
+ depth: number;
12172
+ collapsed: boolean;
12173
+ member: WalkedField["member"];
12174
+ /** 这一层是 union 时,可以在哪几支之间切(写哪个值)。 */
12175
+ variants: VariantControl | undefined;
12176
+ } |
12177
+ /** 容器的关闭行:`}` / `]`(添加行挂在它后面同一行)。 */
12178
+ {
12179
+ kind: "close";
12180
+ path: readonly string[];
12181
+ node: FieldNode;
12182
+ shape: ContainerShape;
12183
+ depth: number;
12184
+ /** 这一层能加什么;`undefined` 表示加不了(对象的声明字段都配齐了)。 */
12185
+ add: AddLineSpec | undefined;
12186
+ member: WalkedField["member"];
12187
+ } |
12188
+ /** 字段行:`key: value`。 */
12189
+ {
12190
+ kind: "field";
12191
+ path: readonly string[];
12192
+ node: FieldNode;
12193
+ depth: number;
12194
+ field: DraftFieldState;
12195
+ member: WalkedField["member"];
12196
+ /** 这个字段是 union 时,可以在哪几支之间切。 */
12197
+ variants: VariantControl | undefined;
12198
+ /**
12199
+ * 变体触发**代替这一行的值**:判别式 union 的标签行就是这样——`type: "sqlite" ▾` 里的值就是那个触发,
12200
+ * 不再另画一份值。
12201
+ */
12202
+ variantsStandIn: boolean;
12203
+ } |
12204
+ /** 注释行:schema 的说明与业务给的文案,画在字段行上方;这一行有问题时它装的是那条消息。 */
12205
+ {
12206
+ kind: "comment";
12207
+ path: readonly string[];
12208
+ depth: number;
12209
+ text: string;
12210
+ /** 这一行有校验消息(草稿解析失败或整段校验落下来):画成错误,而不是普通说明。 */
12211
+ invalid: boolean;
12212
+ };
12213
+ /**
12214
+ * 容器的形状:对象类用 `{}`,序列类用 `[]`。
12215
+ *
12216
+ * union 没有自己的形状——它跟着**当前选中那一支**走(`access` 是数组就在页面上画 `[`),这也是
12217
+ * `access: string | string[]` 这类字段以前被画成对象容器的原因。
12218
+ * @param node - 字段节点。
12219
+ * @param value - 这一层的值(选支判据)。
12220
+ * @returns 形状;叶子节点是 `undefined`。
12221
+ */
12222
+ declare function containerShape(node: FieldNode, value?: unknown): ContainerShape | undefined;
12223
+ /** 折叠状态与可见性:记「用户切换过的路径」,开合 = 切换过就反转 schema 的默认值。 */
12224
+ interface FoldState {
12225
+ collapsed(path: readonly string[]): boolean;
12226
+ toggle(path: readonly string[]): void;
12227
+ }
12228
+ /** 渲染顺序里可见的字段:折叠的容器把整棵子树滤掉,只留它自己的开启行。 */
12229
+ declare function visibleFields(state: SchemaFormState, fold: FoldState): readonly WalkedField[];
12230
+ /**
12231
+ * 排成行序列。
12232
+ * @param state - 页面读数。
12233
+ * @param fold - 折叠状态。
12234
+ * @param resolveText - `description` 的本地化。
12235
+ * @param t - 本包字典。
12236
+ * @returns 行序列(行号即下标)。
12237
+ */
12238
+ declare function editorLines(state: SchemaFormState, fold: FoldState, resolveText: ResolveText, t: SchemaFormTranslate): EditorLine[];
12239
+ declare namespace index_d_exports {
12240
+ export { EditorLine, FieldMeta, FieldNode, FieldText, FoldState, InlineValue, NS, RowRegistrationPlan, SchemaFieldComponentProps, SchemaFieldDefault, SchemaFieldMatch, SchemaFieldOwnerProps, SchemaFieldSelect, SchemaFormActions, SchemaFormController, SchemaFormFace, SchemaFormHints, SchemaFormHintsFace, SchemaFormLocaleKey, SchemaFormProps, SchemaFormState, SelectOption, SelectSpec, SuggestedKeys, SuggestedKeysReader, ValidationFailure, WalkedField, apply$1 as apply, canRender, containerShape, editorLines, failureOf, inject$1 as inject, optionsFor, parseFor, projectNode, projectRoot, rowRegistrations, tokenText, tokenTone, valueText, visibleFields, walkFields };
12241
+ }
12242
+ /** 本包字典与槽位文案的命名空间。 */
12243
+ declare const NS = "settings.schema-form";
12244
+ /** 需要的服务:槽位、字典、共享配置表单、schema 服务与插件管理(bundle 行清单)。 */
12245
+ declare const inject$1: string[];
12246
+ /**
12247
+ * 装上本包:字典、Factory(字段槽的声明者)与按行自动注册。
12248
+ * @param ctx - 浏览器插件上下文。
12249
+ */
12250
+ declare function apply$1(ctx: Context): void;
12251
+ //#endregion
11237
12252
  //#region src/reference-markdown.d.ts
11238
12253
  interface ReferenceActions {
11239
12254
  readonly openFile: (path: string) => void;
@@ -11250,7 +12265,16 @@ declare function referenceMentions(actions?: ReferenceActions, tokens?: Readonly
11250
12265
  declare const ReferenceMarkdown: import("react").MemoExoticComponent<({ text, labels, actions, streaming, pathImages }: ReferenceMarkdownProps) => import("react/jsx-runtime").JSX.Element>;
11251
12266
  //#endregion
11252
12267
  //#region src/client/index.d.ts
12268
+ /**
12269
+ * 需要的**服务名**:样式与引用那半不要服务,schema 表单那半要槽位、字典与配置表单。
12270
+ *
12271
+ * 与包清单里的 `dsh.client.inject` 不是一回事:那份是**装配行 id**(谁先到),交给模块系统排 arrival 顺序;
12272
+ * 这里读的是 cordis 服务名(谁已 provide),Loader 拿它决定这一行何时才算 active。写错成包名,这一行就永远
12273
+ * pending(`web boot: ... waiting for services`)。
12274
+ *
12275
+ * 值直接取自 schema 表单那一面,不另抄一份清单。
12276
+ */
11253
12277
  declare const inject: readonly string[];
11254
- declare function apply(_ctx: Context): void;
12278
+ declare function apply(ctx: Context): void;
11255
12279
  //#endregion
11256
- export { type CSSObject, type CSSProps, type CSSSelector, type CSSValue, type CSSVar, type CSSVarRef, MarkdownCopySeat, type Reference, type ReferenceActions, ReferenceMarkdown, type ReferenceMarkdownProps, type ReferenceSpan, type SettingsFieldProps, type SettingsFieldSpec, type SettingsFieldState, type SettingsFieldWrite, SettingsForm, type SettingsFormActions, type SettingsFormLabels, SettingsFormModel, type SettingsFormPathOp, type SettingsFormProps, type SettingsFormScope, type SettingsFormScopeSnapshot, type SettingsFormShell, SettingsSecretField, type SettingsSecretSpec, SettingsValueField, type StyledComponent, Styling, Token, type TokenVars, type Tokens, apply, designTokens, dsw, findReferences, formatReference, formatReferenceMention, inject, isLocalReference, markdownLabels, parseReference, parseReferenceToken, referenceMentions, settingsNumberField, settingsTextField, styleOf, styled, styling };
12280
+ export { type CSSObject, type CSSProps, type CSSSelector, type CSSValue, type CSSVar, type CSSVarRef, type FieldMeta, type FieldNode, MarkdownCopySeat, type Reference, type ReferenceActions, ReferenceMarkdown, type ReferenceMarkdownProps, type ReferenceSpan, NS as SCHEMA_FORM_NS, type SchemaFormActions, SchemaFormController, type SchemaFormFace, SchemaFormHints, type SchemaFormLocaleKey, type SchemaFormState, type SelectOption, type SelectSpec, type SettingsFieldProps, type SettingsFieldSpec, type SettingsFieldState, type SettingsFieldWrite, SettingsForm, type SettingsFormActions, type SettingsFormLabels, SettingsFormModel, type SettingsFormPathOp, type SettingsFormProps, type SettingsFormScope, type SettingsFormScopeSnapshot, type SettingsFormShell, SettingsSecretField, type SettingsSecretSpec, SettingsValueField, type StyledComponent, Styling, type SuggestedKeys, Token, type TokenVars, type Tokens, type ValidationFailure, type WalkedField, apply, designTokens, dsw, failureOf, findReferences, formatReference, formatReferenceMention, inject, isLocalReference, markdownLabels, parseReference, parseReferenceToken, projectRoot, referenceMentions, rowRegistrations, index_d_exports as schemaForm, settingsNumberField, settingsTextField, styleOf, styled, styling, walkFields };