Files
apes-sidebar/src/client/markdown-labels.tsx
T
Menghuan1918 07eebbbad0 feat!: move to the alpha track — DSH 0.1.2-alpha.x only (v0.18.0-alpha.0)
DSH itself is still on its 0.1.2-alpha line (npm `alpha` dist-tag), so the
plugin mirrors it: v0.18.0-alpha.0 publishes under the npm `alpha`
dist-tag and supports DSH 0.1.2-alpha.x only. Stable-DSH (0.1.0-rc.8 ~
0.1.1-rc.2) users stay on v0.17.1 (npm `latest`). Verified end-to-end
against a real 0.1.2-alpha.2 host: full vitest suite, typecheck,
build/pack, consumer type surface, and the headless mount smoke 14/14
(the prerelease version also passes `dsh plugin add file:`).

- peer floor raised `^0.1.0-rc.8` -> `^0.1.2-alpha.2` (the mount install
  no longer warns: the old floor could not semver-match a prerelease
  host); dsh.plugin.json engines.dsh `>=0.1.2-alpha.2`.
- Dropped the pre-alpha compatibility layer:
  - e2e host RPC collapsed from the dot/slash dual dialect to slash-only
    (rpcAttempt; the 404-probe negotiation and its cache are gone), and
    parseLaunchUrl now requires the ?token= launch URL;
  - MarkdownText labels collapsed to the nested single shape (the cast
    became unnecessary against the alpha.2 declarations);
  - the defunct `@deepseek-ai/dsh-client-runtime` row is gone from the
    chunk externals allowlist (chunk-loader / tsdown / two specs) and
    from dsh.client.inject.
- market-manifest guard now allows an exact prerelease version (alpha
  cuts are not the market's verified `latest` target); release.yml picks
  the npm dist-tag from the version (prerelease -> `alpha`, else
  `latest`) so an alpha can never hijack `latest`.
- Docs retargeted: AGENTS.md §2/§3, README/README_EN badges + v0.18.0
  -alpha.0 section + install note (`dsh-better-sidebar@alpha`), guide.
2026-08-30 23:42:16 +08:00

32 lines
1.3 KiB
TypeScript

/**
* Copy-button / chrome labels for DSH's shared `MarkdownText` (DSH
* 0.1.2-alpha contract): the renderer takes a REQUIRED nested `labels` prop
* — `labels.code.copyLabel` / `labels.code.copiedLabel` for the fence copy
* buttons plus a screen-reader-only `labels.footnotes` heading — and the
* MarkdownText/CodeBlock are cordis-free, falling back to HARDCODED Chinese
* when the labels are omitted, so every render site threads the plugin
* dictionary's localized pair through here (re-evaluated per render).
* `footnotes` is left empty (the heading is sr-only; give it a real string
* only if a locale key ever earns its place in all 19 dictionaries).
*/
import type { ComponentProps } from 'react'
import { MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives'
/** The flat copy-button pair the plugin threads through its own props (e.g.
* MermaidMarkdownProps.codeLabels — the chunk contract stays put). */
export interface MarkdownCopyLabels {
copyLabel: string
copiedLabel: string
}
/** MarkdownText props carrying the nested chrome labels. */
export function markdownTextProps(text: string, labels: MarkdownCopyLabels): ComponentProps<typeof MarkdownText> {
return {
text,
labels: {
code: { copyLabel: labels.copyLabel, copiedLabel: labels.copiedLabel },
footnotes: '',
},
}
}