@deepseek-ai/dsh-client-ui-primitives 0.1.5-alpha.2 → 0.1.5-rc.1

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.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/client/ui-primitives/README.md
5
- README.md: aebb0be860ebaba4543a8fd262599507ead64556
6
- README.zh.md: a545aff9837036890b6250ab1aa32fb651af0a18
5
+ README.md: 1919e923c6edfae58e38849996f3979723198075
6
+ README.zh.md: e0c90fd14a284aac6a2420f5974eef6ad78138c7
package/README.md CHANGED
@@ -52,7 +52,7 @@ Check this table before writing a control in a feature package. A plugin cannot
52
52
  | `HoverCard` | Hover preview the pointer can rest on and select from; optional copy button. |
53
53
  | `Toast` | Transient top-center banner held for the owner's `holdMs`. |
54
54
  | `JsonTree`, `JsonBlock` | Read-only JSON inspection. |
55
- | `MarkdownText`, `CodeBlock` | Untrusted GFM with TeX math, and highlighted code. `CodeBlock` accepts opt-in `lineNumbers`; copied source excludes the gutter. |
55
+ | `MarkdownText`, `CodeBlock` | Untrusted GFM with TeX math, and highlighted code. `CodeBlock` accepts opt-in `lineNumbers`; copied source excludes the gutter, and `contentRef` exposes its stable source wrapper to an owner that uses it as a scrollport. |
56
56
  | `TerminalBlock`, `ReadBlock`, `DiffBlock`, `SearchBlock`, `WebBlock` | The agent-output card matching each tool-result intent. |
57
57
  | `icons/*`, `FishLogo`, `BrandWordmark`, `ReferenceIcon`, `LinkIcon` | Glyphs and brand marks. Use `LinkIcon` for 14px clickable-link categories. |
58
58
  | `FileTypeIcon`, `classifyFileType`, `fileExtension` | A category-colored 28px file or folder glyph and the shared case-insensitive filename mapping behind it. Code and configuration files use detailed full-color technology glyphs; use `LinkIcon` for link-leading glyphs and image previews for image content. |
package/README.zh.md CHANGED
@@ -52,7 +52,7 @@ kind: "package-library"
52
52
  | `HoverCard` | 指针可停留、可选中的悬停预览;可选带复制按钮。 |
53
53
  | `Toast` | 顶部居中的瞬时横幅,保持时长由所有者的 `holdMs` 决定。 |
54
54
  | `JsonTree`、`JsonBlock` | 只读 JSON 查看。 |
55
- | `MarkdownText`、`CodeBlock` | 不可信 GFM 与 TeX 数学,以及高亮代码。`CodeBlock` 可通过 `lineNumbers` 开启行号;复制的源码不含行号栏。 |
55
+ | `MarkdownText`、`CodeBlock` | 不可信 GFM 与 TeX 数学,以及高亮代码。`CodeBlock` 可通过 `lineNumbers` 开启行号;复制的源码不含行号栏,`contentRef` 则向需要把稳定源码包装节点用作滚动区的 owner 提供该节点。 |
56
56
  | `TerminalBlock`、`ReadBlock`、`DiffBlock`、`SearchBlock`、`WebBlock` | 与各类工具结果意图对应的 agent 输出卡片。 |
57
57
  | `icons/*`、`FishLogo`、`BrandWordmark`、`ReferenceIcon`、`LinkIcon` | 字形与品牌标识。`LinkIcon` 用于 14px 的可点击链接分类。 |
58
58
  | `FileTypeIcon`、`classifyFileType`、`fileExtension` | 按类别着色的 28px 文件或文件夹图形,以及它背后共享的不区分大小写文件名映射。代码与配置文件使用细分的全彩技术图形;链接前置图形使用 `LinkIcon`,图片内容使用图片预览。 |
package/lib/index.js CHANGED
@@ -7883,7 +7883,7 @@ function renderLine(line, index) {
7883
7883
  }, spanIndex))
7884
7884
  })] }, index);
7885
7885
  }
7886
- function CodeBlock({ code, lang, streaming, className, lineNumbers = false, copyLabel, copiedLabel }) {
7886
+ function CodeBlock({ code, lang, streaming, className, contentRef, lineNumbers = false, copyLabel, copiedLabel }) {
7887
7887
  const trimmed = code.endsWith("\n") ? code.slice(0, -1) : code;
7888
7888
  const sourceLines = lineNumbers ? trimmed.split("\n") : void 0;
7889
7889
  const rootRef = useRef(null);
@@ -8008,7 +8008,12 @@ function CodeBlock({ code, lang, streaming, className, lineNumbers = false, copy
8008
8008
  })
8009
8009
  })]
8010
8010
  })
8011
- }), body]
8011
+ }), jsx("div", {
8012
+ ref: contentRef,
8013
+ className: css$22.content,
8014
+ "data-code-block-content": true,
8015
+ children: body
8016
+ })]
8012
8017
  });
8013
8018
  }
8014
8019
  //#endregion
@@ -69,6 +69,12 @@
69
69
  font: inherit;
70
70
  }
71
71
 
72
+ /* Consumers may turn the stable content node into a viewport without changing
73
+ the default CodeBlock layout. */
74
+ .content {
75
+ display: contents;
76
+ }
77
+
72
78
  .block :where(pre) {
73
79
  font: var(--dsl-code-block-content-font);
74
80
  padding: 16px;
@@ -1,3 +1,4 @@
1
+ import type { Ref } from 'react';
1
2
  export interface CodeBlockProps {
2
3
  /** The source text, rendered verbatim (trailing newline trimmed for display). */
3
4
  code: string;
@@ -14,6 +15,8 @@ export interface CodeBlockProps {
14
15
  streaming?: boolean | undefined;
15
16
  /** Extra class merged onto the wrapper (callers position; this component draws). */
16
17
  className?: string | undefined;
18
+ /** Ref for the stable source-content wrapper, for owners that use it as a scrollport. */
19
+ contentRef?: Ref<HTMLDivElement> | undefined;
17
20
  /** Show a numbered gutter without adding numbers to copied source. Defaults to false. */
18
21
  lineNumbers?: boolean | undefined;
19
22
  /** Copy-button idle label; the owner passes localized copy (this package is cordis-free, so copy arrives via props). */
@@ -21,5 +24,5 @@ export interface CodeBlockProps {
21
24
  /** Copy-button label during the post-copy confirmation window. */
22
25
  copiedLabel: string;
23
26
  }
24
- export declare function CodeBlock({ code, lang, streaming, className, lineNumbers, copyLabel, copiedLabel }: CodeBlockProps): import("react").JSX.Element;
27
+ export declare function CodeBlock({ code, lang, streaming, className, contentRef, lineNumbers, copyLabel, copiedLabel }: CodeBlockProps): import("react").JSX.Element;
25
28
  //# sourceMappingURL=CodeBlock.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-client-ui-primitives",
3
3
  "description": "Pure React atoms for the dsh web UI: controls, icons, markdown, and JSON inspectors (zero cordis)",
4
- "version": "0.1.5-alpha.2",
4
+ "version": "0.1.5-rc.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },