@deepseek-ai/dsh-client-ui-primitives 0.2.1-rc.5 → 0.2.2-alpha.3

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.
Files changed (67) hide show
  1. package/README.i18n.yaml +18 -18
  2. package/README.md +45 -15
  3. package/README.zh.md +45 -15
  4. package/lib/AnimatedRows.module.css +7 -0
  5. package/lib/Button.module.css +18 -11
  6. package/lib/CodeCard.module.css +4 -2
  7. package/lib/ConnectionIndicator.module.css +8 -6
  8. package/lib/DetailDocument.module.css +67 -0
  9. package/lib/DiffBlock.module.css +4 -2
  10. package/lib/DisclosureRow.module.css +11 -7
  11. package/lib/HoverCard.module.css +13 -0
  12. package/lib/JsonTree.module.css +45 -9
  13. package/lib/Menu.module.css +55 -17
  14. package/lib/MenuSurface.module.css +16 -0
  15. package/lib/Modal.module.css +4 -2
  16. package/lib/Pill.module.css +4 -2
  17. package/lib/QuotePreview.module.css +101 -0
  18. package/lib/ReadBlock.module.css +4 -2
  19. package/lib/RowDragPreview.module.css +12 -0
  20. package/lib/SearchBlock.module.css +4 -2
  21. package/lib/SegmentedControl.module.css +6 -1
  22. package/lib/SegmentedTabs.module.css +25 -3
  23. package/lib/TerminalBlock.module.css +4 -2
  24. package/lib/Toast.module.css +4 -2
  25. package/lib/UserMessageBubble.module.css +11 -0
  26. package/lib/WebBlock.module.css +14 -2
  27. package/lib/ZoomControls.module.css +54 -0
  28. package/lib/index.js +3923 -4809
  29. package/lib/markdown/JsonBlock.module.css +4 -2
  30. package/lib/markdown/MarkdownText.module.css +37 -12
  31. package/lib/settings-form/fields.module.css +11 -3
  32. package/lib/types/AnimatedRows.d.ts +46 -0
  33. package/lib/types/Button.d.ts +1 -1
  34. package/lib/types/DetailDocument.d.ts +78 -0
  35. package/lib/types/DraggableImage.d.ts +19 -0
  36. package/lib/types/HoverCard.d.ts +7 -2
  37. package/lib/types/HoverCardGroup.d.ts +4 -2
  38. package/lib/types/ImageLightbox.d.ts +4 -1
  39. package/lib/types/Menu.d.ts +25 -9
  40. package/lib/types/MenuSurface.d.ts +9 -0
  41. package/lib/types/QuotePreview.d.ts +24 -0
  42. package/lib/types/SegmentedTabs.d.ts +3 -1
  43. package/lib/types/Tooltip.d.ts +13 -7
  44. package/lib/types/UserMessageBubble.d.ts +11 -0
  45. package/lib/types/ZoomControls.d.ts +27 -0
  46. package/lib/types/document-zoom.d.ts +17 -0
  47. package/lib/types/file-drag-actions.d.ts +32 -0
  48. package/lib/types/focus.d.ts +7 -0
  49. package/lib/types/icons/artwork.d.ts +422 -0
  50. package/lib/types/icons/index.d.ts +199 -194
  51. package/lib/types/icons/shared-artwork.d.ts +6 -12
  52. package/lib/types/image-drag.d.ts +17 -0
  53. package/lib/types/index.d.ts +23 -3
  54. package/lib/types/markdown/MarkdownDelegate.d.ts +26 -3
  55. package/lib/types/markdown/MarkdownText.d.ts +12 -5
  56. package/lib/types/markdown/file-link.d.ts +13 -3
  57. package/lib/types/markdown/highlight.d.ts +22 -0
  58. package/lib/types/markdown/quote-text.d.ts +8 -0
  59. package/lib/types/markdown/render.d.ts +9 -4
  60. package/lib/types/markdown/windows-path-destinations.d.ts +11 -0
  61. package/lib/types/overlay-top-margin.d.ts +9 -2
  62. package/lib/types/use-clipboard-copy.d.ts +14 -0
  63. package/lib/types/useAnchoredPosition.d.ts +22 -22
  64. package/lib/types/useRowDragPreview.d.ts +20 -0
  65. package/lib/types/user-text.d.ts +4 -1
  66. package/package.json +9 -7
  67. package/lib/types/use-copy-feedback.d.ts +0 -14
@@ -3,38 +3,32 @@ interface WeightedArtworkProps extends IconProps {
3
3
  strokeWidth: number;
4
4
  }
5
5
  /**
6
- * Render new-conversation geometry — the bubble around a plus — for product icons.
7
- * @param props - Size, optional CSS class, and inherited stroke width.
8
- * @returns The decorative SVG artwork.
9
- */
10
- export declare const NewChatOutlineArtwork: ({ size, className, strokeWidth }: WeightedArtworkProps) => import("react").JSX.Element;
11
- /**
12
- * Render shared conversation geometry — the chat bubble around two text
13
- * lines — for the queue product icon and session reference icons.
6
+ * Render conversation geometry — the chat bubble around two text lines —
7
+ * for session reference icons; it matches the `queue-outline` product glyph.
14
8
  * @param props - Size, optional CSS class, and inherited stroke width.
15
9
  * @returns The decorative SVG artwork.
16
10
  */
17
11
  export declare const ChatLinesOutlineArtwork: ({ size, className, strokeWidth }: WeightedArtworkProps) => import("react").JSX.Element;
18
12
  /**
19
- * Render shared globe geometry for product and link icons.
13
+ * Render globe geometry for link icons; it matches the `globe-outline` product glyph.
20
14
  * @param props - Size, optional CSS class, and inherited stroke width.
21
15
  * @returns The decorative SVG artwork.
22
16
  */
23
17
  export declare const GlobeOutlineArtwork: ({ size, className, strokeWidth }: WeightedArtworkProps) => import("react").JSX.Element;
24
18
  /**
25
- * Render shared code-bracket geometry for product and link icons.
19
+ * Render code-bracket geometry for link icons; it matches the `inspect-outline` product glyph.
26
20
  * @param props - Size, optional CSS class, and inherited stroke width.
27
21
  * @returns The decorative SVG artwork.
28
22
  */
29
23
  export declare const CodeBracketsArtwork: ({ size, className, strokeWidth }: WeightedArtworkProps) => import("react").JSX.Element;
30
24
  /**
31
- * Render shared document-browse geometry for product and reference icons.
25
+ * Render document-browse geometry for reference icons; it matches the `browse-outline` product glyph.
32
26
  * @param props - Size, optional CSS class, and inherited stroke width.
33
27
  * @returns The decorative SVG artwork.
34
28
  */
35
29
  export declare const BrowseOutlineArtwork: ({ size, className, strokeWidth }: WeightedArtworkProps) => import("react").JSX.Element;
36
30
  /**
37
- * Render shared closed-folder geometry for product, reference, and link icons.
31
+ * Render closed-folder geometry for reference and link icons; it matches the `folder-close` product glyph.
38
32
  * @param props - Size, optional CSS class, and inherited stroke width.
39
33
  * @returns The decorative SVG artwork.
40
34
  */
@@ -0,0 +1,17 @@
1
+ /** Image gestures delegate file preparation and transport to the owning feature. */
2
+ import { type ImgHTMLAttributes } from 'react';
3
+ import type { FileDragActions } from './file-drag-actions.ts';
4
+ type ImageGestures = Required<Pick<ImgHTMLAttributes<HTMLImageElement>, 'onPointerEnter' | 'onPointerDown' | 'onPointerLeave' | 'onDragStart' | 'onDragEnd' | 'onClickCapture'>>;
5
+ /**
6
+ * Prepare resource-backed images on primary press, other images also on hover; release on leave.
7
+ * Releasing inside the image retains preparation for the next gesture; cancelled drags never start late.
8
+ * @param actions - stable file preparation and error callbacks.
9
+ * @param src - displayed image URL.
10
+ * @param name - proposed export name.
11
+ * @param original - already loaded original bytes.
12
+ * @param resourceAddress - verifiable reference to an unmodified local original.
13
+ * @returns image gesture handlers; overflowing images remain owned by their pan handler.
14
+ */
15
+ export declare function useImageDrag(actions: FileDragActions, src: string, name: string, original?: File, resourceAddress?: string): ImageGestures;
16
+ export {};
17
+ //# sourceMappingURL=image-drag.d.ts.map
@@ -2,14 +2,23 @@
2
2
  * Cordis-free React primitives styled only through `--dsw-*` tokens.
3
3
  */
4
4
  export type { CodeToolbarLabels } from './CodeToolbar.tsx';
5
+ export { UserMessageBubble } from './UserMessageBubble.tsx';
6
+ export type { UserMessageBubbleProps } from './UserMessageBubble.tsx';
5
7
  export { StateDot } from './StateDot.tsx';
6
8
  export type { StateDotState } from './StateDot.tsx';
7
9
  export { DisclosureRow } from './DisclosureRow.tsx';
8
10
  export type { DisclosureRowProps } from './DisclosureRow.tsx';
11
+ export { AnimatedRows } from './AnimatedRows.tsx';
12
+ export type { AnimatedRowsProps } from './AnimatedRows.tsx';
13
+ export { useRowDragPreview } from './useRowDragPreview.ts';
9
14
  export { TextShimmer } from './TextShimmer.tsx';
10
15
  export type { TextShimmerProps } from './TextShimmer.tsx';
11
16
  export { Button } from './Button.tsx';
12
17
  export type { ButtonVariant } from './Button.tsx';
18
+ export { ZoomControls } from './ZoomControls.tsx';
19
+ export type { ZoomControlsHandle } from './ZoomControls.tsx';
20
+ export { DOCUMENT_ZOOM } from './document-zoom.ts';
21
+ export type { DocumentZoomLabels } from './document-zoom.ts';
13
22
  export { Pill } from './Pill.tsx';
14
23
  export { SegmentedTabs } from './SegmentedTabs.tsx';
15
24
  export type { SegmentedTab } from './SegmentedTabs.tsx';
@@ -23,7 +32,7 @@ export { Checkbox } from './Checkbox.tsx';
23
32
  export { Input } from './Input.tsx';
24
33
  export { InlineEditor } from './InlineEditor.tsx';
25
34
  export { Menu, MenuItemButton } from './Menu.tsx';
26
- export { MenuSurface } from './MenuSurface.tsx';
35
+ export { MenuSurface, MENU_TRANSITION_MS } from './MenuSurface.tsx';
27
36
  export type { MenuSurfaceProps } from './MenuSurface.tsx';
28
37
  export { MenuGroup, observeStickyMenuGroups } from './MenuGroup.tsx';
29
38
  export type { MenuItemButtonProps, MenuEntry, MenuItem, MenuSeparator, MenuLabel } from './Menu.tsx';
@@ -35,7 +44,7 @@ export { HoverCard } from './HoverCard.tsx';
35
44
  export { HoverCardGroup } from './HoverCardGroup.tsx';
36
45
  export { ShortcutKeys } from './ShortcutKeys.tsx';
37
46
  export { observeComposition } from './keyboard-composition.ts';
38
- export { focusWithoutRing } from './focus.ts';
47
+ export { focusWithoutRing, isMobileDevice } from './focus.ts';
39
48
  export { closeTopModal, isBehindModal, modalSelector, useModalLayer } from './useModalLayer.ts';
40
49
  export { Modal } from './Modal.tsx';
41
50
  export { RiskConfirmation } from './RiskConfirmation.tsx';
@@ -59,6 +68,11 @@ export { pointerModality } from './input-modality.ts';
59
68
  export { Toast } from './Toast.tsx';
60
69
  export { fileSizeText } from './file-size.ts';
61
70
  export { writeClipboard } from './clipboard.ts';
71
+ export type { FileDragActions, FileDragSource, PreparedFileDrag } from './file-drag-actions.ts';
72
+ export { DraggableImage } from './DraggableImage.tsx';
73
+ export type { DraggableImageProps } from './DraggableImage.tsx';
74
+ export { useClipboardCopy } from './use-clipboard-copy.ts';
75
+ export type { ClipboardCopyState } from './use-clipboard-copy.ts';
62
76
  export { SettingsForm } from './settings-form/SettingsForm.tsx';
63
77
  export type { SettingsFormLabels, SettingsFormProps } from './settings-form/SettingsForm.tsx';
64
78
  export { SettingsSecretField, SettingsValueField } from './settings-form/fields.tsx';
@@ -88,8 +102,10 @@ export type { WebBlockProps, WebSearchBlockProps, WebFetchBlockProps, WebSourceV
88
102
  export { CodeBlock } from './markdown/CodeBlock.tsx';
89
103
  export type { CodeBlockProps } from './markdown/CodeBlock.tsx';
90
104
  export { JsonBlock } from './markdown/JsonBlock.tsx';
91
- export { MarkdownDelegateProvider } from './markdown/MarkdownDelegate.tsx';
105
+ export { MarkdownDelegateProvider, useMarkdownDelegate } from './markdown/MarkdownDelegate.tsx';
92
106
  export type { MarkdownDelegate, MarkdownDelegateProviderProps, MarkdownExternalLinkHandler } from './markdown/MarkdownDelegate.tsx';
107
+ export { DetailDocument, detailDocumentState, useDetailDocumentLabels } from './DetailDocument.tsx';
108
+ export type { DetailDocumentCopy, DetailDocumentLabels, DetailDocumentRead, DetailDocumentState } from './DetailDocument.tsx';
93
109
  export { MarkdownText } from './markdown/MarkdownText.tsx';
94
110
  export type { MarkdownCodeLabels, MarkdownFileMentions, MarkdownLabels, MarkdownPathImages } from './markdown/MarkdownText.tsx';
95
111
  export { extractMarkdownPlainText } from './markdown/plain-text.ts';
@@ -99,4 +115,8 @@ export { PluginArtworkTerminal, PluginArtworkLoop, PluginArtworkSubagent, Plugin
99
115
  export { GuideArtworkBrowser, GuideArtworkFiles } from './guide-artwork.tsx';
100
116
  export { ImageLightbox } from './ImageLightbox.tsx';
101
117
  export type { ImageLightboxLabels } from './ImageLightbox.tsx';
118
+ export { QuotePreview } from './QuotePreview.tsx';
119
+ export type { QuotePreviewProps, QuotePreviewRemoval } from './QuotePreview.tsx';
120
+ export { formatQuoteText } from './markdown/quote-text.ts';
121
+ export type { MarkdownMenuTarget } from './markdown/MarkdownDelegate.tsx';
102
122
  //# sourceMappingURL=index.d.ts.map
@@ -1,15 +1,38 @@
1
- import type { ReactNode } from 'react';
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
+ import type { FileDragActions } from '../file-drag-actions.ts';
2
3
  import type { ImageLightboxLabels } from '../ImageLightbox.tsx';
3
4
  /**
4
5
  * Handle one sanitized absolute HTTP(S) URL selected from Markdown.
5
6
  * @param href - destination URL.
6
7
  */
7
8
  export type MarkdownExternalLinkHandler = (href: string) => void;
9
+ /** Explicit object and viewport coordinates from the element owning a context gesture. */
10
+ export type MarkdownMenuTarget = {
11
+ kind: 'file';
12
+ path: string;
13
+ line?: number;
14
+ } | {
15
+ kind: 'url';
16
+ url: string;
17
+ } | {
18
+ kind: 'image';
19
+ url: string;
20
+ path?: string;
21
+ name?: string;
22
+ mediaType?: string;
23
+ };
8
24
  /** Navigation capabilities supplied by the nearest Markdown owner. */
9
25
  export interface MarkdownDelegate {
10
- /** Image previews for decoded local paths in this owner's workspace. */
26
+ /** Open an object menu without executing its normal activation. */
27
+ readonly getTriggerProps?: ((target: MarkdownMenuTarget) => Pick<HTMLAttributes<HTMLElement>, 'onContextMenu' | 'onKeyDown' | 'tabIndex'>) | undefined;
28
+ /**
29
+ * Image previews for decoded local paths in this owner's workspace. The renderer
30
+ * appends a per-mount `load` query parameter to `api/file` route URLs.
31
+ */
11
32
  readonly fileImages?: {
33
+ fileDrag: FileDragActions;
12
34
  resolve: (path: string) => string | undefined;
35
+ resourceAddress?: ((path: string) => string) | undefined;
13
36
  labels: ImageLightboxLabels & {
14
37
  open: string;
15
38
  loading: string;
@@ -37,7 +60,7 @@ export interface MarkdownDelegateProviderProps extends MarkdownDelegate {
37
60
  * @param props - Child tree and its file and HTTP(S) link handlers.
38
61
  * @returns the scoped child tree.
39
62
  */
40
- export declare function MarkdownDelegateProvider({ children, openExternalLink, openFile, fileImages, }: MarkdownDelegateProviderProps): ReactNode;
63
+ export declare function MarkdownDelegateProvider({ children, openExternalLink, openFile, fileImages, getTriggerProps, }: MarkdownDelegateProviderProps): ReactNode;
41
64
  /**
42
65
  * Read the nearest Markdown navigation capabilities.
43
66
  * @returns Owner callbacks, or an empty delegate outside a provider.
@@ -31,19 +31,26 @@ export type { MarkdownCodeLabels, MarkdownFileMentions, MarkdownLabels, Markdown
31
31
  * `MarkdownDelegateProvider` can delegate ordinary HTTP(S) activation while
32
32
  * modified clicks retain native behavior. `variant="compact"` uses secondary
33
33
  * text sizing, uniform bold headings, and tight block spacing; the default
34
- * `body` variant uses the full document typography.
34
+ * `body` variant uses the full document typography. `omitHtml` renders raw
35
+ * HTML as nothing instead of literal text, for documents written for HTML
36
+ * renderers, such as package READMEs. `textInteractionSource` marks the
37
+ * existing root as a source for text selection interactions.
35
38
  * The provider's `openFile` enables local Markdown links in settled messages,
36
- * including `#L24` and `#L24-L30` destinations (ranges open at their first line).
37
- * @returns A GFM document with TeX math rendered through KaTeX; raw HTML and
38
- * unsafe protocols are disabled. Local links without an opener remain text;
39
+ * including `#L24` / `#L24-L30` fragments and `:24` / `:24-30` / `:24:5` suffixes
40
+ * (ranges open at their first line, columns are ignored, and invalid locations
41
+ * open only the file; see the README for URL/path classification).
42
+ * @returns A GFM document with TeX math rendered through KaTeX; raw HTML never
43
+ * renders as markup, and unsafe protocols are disabled. Local links without an opener remain text;
39
44
  * absolute HTTP(S) images render directly.
40
45
  */
41
- export declare const MarkdownText: import("react").MemoExoticComponent<({ text, streaming, labels, fileMentions, pathImages, variant, }: {
46
+ export declare const MarkdownText: import("react").MemoExoticComponent<({ text, streaming, labels, fileMentions, pathImages, variant, omitHtml, textInteractionSource, }: {
42
47
  text: string;
43
48
  streaming?: boolean;
44
49
  labels: MarkdownLabels;
45
50
  fileMentions?: MarkdownFileMentions | undefined;
46
51
  pathImages?: MarkdownPathImages | undefined;
47
52
  variant?: "body" | "compact";
53
+ omitHtml?: boolean;
54
+ textInteractionSource?: boolean;
48
55
  }) => import("react").JSX.Element>;
49
56
  //# sourceMappingURL=MarkdownText.d.ts.map
@@ -1,10 +1,20 @@
1
1
  /** Local Markdown destinations accepted by the file-preview callback. */
2
2
  /**
3
- * Decode a file destination and its optional GitHub-style line fragment.
4
- * Literal `?` and `#` in filenames must be percent-encoded.
3
+ * Recognize a relative, rooted, or absolute Windows path before URL parsing.
4
+ * @param value - A decoded or URI-normalized destination.
5
+ * @returns Whether a filesystem prefix makes the destination unambiguous.
6
+ */
7
+ export declare function isExplicitFilePath(value: string): boolean;
8
+ /**
9
+ * Decode a file destination with a fragment, line range, or line/column suffix.
10
+ * Explicit relative, slash/backslash-rooted, and Windows drive paths take
11
+ * precedence over URLs. Other parseable absolute URLs are not file links.
12
+ * Fragments take precedence over colon suffixes; invalid locations open the
13
+ * file without selecting a line. Columns are consumed but not selected.
14
+ * Percent-encode literal `?`, `#`, and numeric colon suffixes in filenames.
5
15
  * @param value - Parsed Markdown link destination.
6
16
  * @returns A local path and optional first line, or undefined for URLs,
7
- * fragment-only links, queries, malformed escapes, or invalid line ranges.
17
+ * fragment-only links, queries, malformed escapes, or control characters.
8
18
  */
9
19
  export declare function parseFileLink(value: string): {
10
20
  path: string;
@@ -17,7 +17,28 @@
17
17
  * An unknown or absent language falls back to plain text (no highlighting, still
18
18
  * monospace) — never an error.
19
19
  */
20
+ import langTs from '@shikijs/langs/typescript';
20
21
  import type { CSSProperties } from 'react';
22
+ /** A shiki grammar module's default export (a `LanguageRegistration[]`), taken
23
+ * from a boot grammar so no direct `@shikijs/types` dependency is needed. */
24
+ type LangModule = {
25
+ default: typeof langTs;
26
+ };
27
+ /**
28
+ * Replace the Go grammar's repeated one-line struct-field rule with the rule
29
+ * worlpaker/go-syntax merged in 4a9b120a52c (https://github.com/worlpaker/go-syntax/pull/25):
30
+ * the repeated rule backtracks exponentially on lines such as a brace-bearing
31
+ * comment after `struct {`. Delete this patch once `@shikijs/langs` ships that
32
+ * commit; 4.5.0 does not. The rule is located as the only rule in
33
+ * `struct_variables_types_fields` containing the field-token literal below,
34
+ * taken from `@shikijs/langs` 4.4.3.
35
+ * @param grammars - the `@shikijs/langs/go` default export, left unmodified.
36
+ * @returns copies of `grammars` with that rule's match replaced in the `go` grammar.
37
+ * @throws When the module has no `go` grammar, the grammar lacks
38
+ * `struct_variables_types_fields`, or that entry has no or several such rules.
39
+ * The lazy load then rejects unhandled and Go code renders as plain text.
40
+ */
41
+ export declare function patchGoGrammar(grammars: LangModule['default']): LangModule['default'];
21
42
  /**
22
43
  * Resolve a language hint to the grammar id {@link LANG_ALIASES} selects.
23
44
  * @param lang - Language hint from a code surface: a canonical grammar id or the read card's persisted short id.
@@ -145,4 +166,5 @@ export interface StreamingHighlightFrame {
145
166
  * @returns one entry per source line (each an array of runs), or `undefined` for unknown or not-yet-loaded languages.
146
167
  */
147
168
  export declare function highlightLines(code: string, lang: string | undefined): HighlightSpan[][] | undefined;
169
+ export {};
148
170
  //# sourceMappingURL=highlight.d.ts.map
@@ -0,0 +1,8 @@
1
+ /** Shared Markdown blockquote formatting for browser text. */
2
+ /**
3
+ * Project selected visible text as an ordinary Markdown blockquote.
4
+ * @param text - selected visible text without quote markers.
5
+ * @returns one `> `-prefixed line per normalized input line.
6
+ */
7
+ export declare function formatQuoteText(text: string): string;
8
+ //# sourceMappingURL=quote-text.d.ts.map
@@ -4,17 +4,18 @@
4
4
  * cache frozen blocks as React elements; the rendered DOM is pinned
5
5
  * byte-for-byte by `tests/fixtures/markdown-dom` and must not drift.
6
6
  *
7
- * External link and image destinations pass a protocol allowlist; settled
7
+ * External links reject executable and embedded-document protocols; settled
8
8
  * local file links use an explicit owner callback. Images additionally require
9
9
  * absolute HTTP(S), raw HTML renders as literal text (no HTML enters the
10
- * DOM), and KaTeX runs without trusted commands. Fragment-anchor URLs fail
11
- * the allowlist, so footnote references and back-references render as plain
10
+ * DOM), and KaTeX runs without trusted commands. Fragment-only URLs are not
11
+ * absolute, so footnote references and back-references render as plain
12
12
  * text rather than in-page links.
13
13
  *
14
14
  * Merge-extensible node unions fall through the documented default (render
15
15
  * nothing) rather than ending in assertNever: grammars registered elsewhere
16
16
  * may add node types this renderer has no mapping for.
17
17
  */
18
+ import type { HTMLAttributes } from 'react';
18
19
  import type { ReactNode } from 'react';
19
20
  import type * as Md from 'mdast';
20
21
  import type { CodeToolbarLabels } from '../CodeToolbar.tsx';
@@ -65,7 +66,8 @@ export interface MarkdownPathImages {
65
66
  * Resolve one authored image destination.
66
67
  * @param value - The destination exactly as the markdown author wrote it.
67
68
  * @returns A displayable absolute URL, or undefined when the destination
68
- * names no displayable image — it then stays inert alt text.
69
+ * names no displayable image — it then stays inert alt text. The renderer
70
+ * appends a per-mount `load` query parameter to `api/file` route results.
69
71
  */
70
72
  resolve(value: string): string | undefined;
71
73
  }
@@ -83,6 +85,7 @@ export interface MarkdownFileMentions {
83
85
  */
84
86
  resolve(value: string): {
85
87
  open: () => void;
88
+ contextMenuProps?: Pick<HTMLAttributes<HTMLElement>, 'onContextMenu' | 'onKeyDown' | 'tabIndex'>;
86
89
  label: string;
87
90
  title: string;
88
91
  } | undefined;
@@ -102,6 +105,8 @@ export interface MarkdownRenderContext {
102
105
  readonly fileMentions: MarkdownFileMentions | undefined;
103
106
  /** Local-path image vocabulary; absent wherever no rewriting owner exists. */
104
107
  readonly pathImages: MarkdownPathImages | undefined;
108
+ /** Raw HTML renders nothing instead of literal text. */
109
+ readonly omitHtml: boolean;
105
110
  /** Inside an anchor's children: interactive mentions must not nest there. */
106
111
  readonly inLink?: boolean;
107
112
  /** Reference targets visible to this pass. */
@@ -0,0 +1,11 @@
1
+ import type { Extension } from 'mdast-util-from-markdown';
2
+ /**
3
+ * CommonMark reads `\.` or `\_` in a destination as an escaped character, so
4
+ * `D:\repo\.github` would parse as `D:\repo.github`. For a destination that
5
+ * is a Windows path, this `fromMarkdown` extension keeps every backslash
6
+ * literally, including one before punctuation such as `\(`, while character
7
+ * references such as `&amp;` still decode; other destinations parse unchanged.
8
+ * @returns The mdast extension.
9
+ */
10
+ export declare function windowsPathDestinations(): Extension;
11
+ //# sourceMappingURL=windows-path-destinations.d.ts.map
@@ -2,7 +2,14 @@
2
2
  /**
3
3
  * Resolve the top margin an overlay keeps from the viewport edge.
4
4
  * @param min - the overlay's own viewport margin in px, used as the floor.
5
- * @returns the larger of `min` and the frame clearance plus 20px; fullscreen keeps only the 20px gap.
5
+ * @param anchor - the overlay's anchor rect in viewport coordinates. While the anchor's top edge is inside the
6
+ * viewport, the margin never exceeds `anchor.bottom + gap`, so an overlay opened from a control inside the top strip
7
+ * stays next to it.
8
+ * @param gap - the distance the overlay keeps below `anchor`.
9
+ * @returns the frame clearance plus 20px (20px in fullscreen), capped by a visible `anchor`, but never below `min`.
6
10
  */
7
- export declare function overlayTopMargin(min: number): number;
11
+ export declare function overlayTopMargin(min: number, anchor?: {
12
+ readonly top: number;
13
+ readonly bottom: number;
14
+ }, gap?: number): number;
8
15
  //# sourceMappingURL=overlay-top-margin.d.ts.map
@@ -0,0 +1,14 @@
1
+ /** Clipboard action and its temporary success state. */
2
+ export interface ClipboardCopyState {
3
+ /** True for one second after an accepted clipboard write. */
4
+ readonly copied: boolean;
5
+ /** Write the current text unless a write or success indication is already active. */
6
+ readonly onCopy: () => void;
7
+ }
8
+ /**
9
+ * Keep clipboard feedback local to the mounted control and release its reset timer on unmount.
10
+ * @param text - Exact text to copy when the action is invoked.
11
+ * @returns Success feedback and a callback stable while text and feedback are unchanged.
12
+ */
13
+ export declare function useClipboardCopy(text: string): ClipboardCopyState;
14
+ //# sourceMappingURL=use-clipboard-copy.d.ts.map
@@ -1,36 +1,36 @@
1
- /**
2
- * Keep a fixed-position floating element anchored to a trigger.
3
- *
4
- * A portaled panel is positioned from its anchor's viewport rect, which stops
5
- * being true the moment anything scrolls or the window resizes. This owns that
6
- * one concern: measure the anchor, offset the panel below or above it, clamp
7
- * the result inside the viewport, and re-run on scroll (capture phase, so
8
- * scrollers nested inside the page are caught too), on resize, and on the
9
- * panel's own size changes while the element is open.
10
- * @module @deepseek-ai/dsh-client-ui-primitives/useAnchoredPosition
11
- */
1
+ /** Synchronous placement for body-portaled panels with a viewport fixed-position containing block. */
12
2
  import { type CSSProperties, type RefObject } from 'react';
13
3
  /** Inputs for {@link useAnchoredPosition}. */
14
4
  export interface AnchoredPositionOptions {
15
- /** Whether the floating element is mounted and should track its anchor. */
5
+ /** Whether the panel is mounted and should track its anchor. */
16
6
  open: boolean;
17
- /** The element the panel is placed from. */
7
+ /** Element whose viewport rect anchors the panel. */
18
8
  anchorRef: RefObject<HTMLElement | null>;
19
- /** The floating element, measured so the clamp uses real dimensions. */
9
+ /** Body-portaled, fixed-position panel; its ancestors must not establish a containing block. */
20
10
  panelRef: RefObject<HTMLElement | null>;
21
- /** Which anchor edge the panel hangs from: below it (`bottom`, the default) or above it (`top`). */
22
- side?: 'top' | 'bottom';
23
- /** Which anchor edge the panel lines up with: its left edge (`start`, the default) or its right edge (`end`). */
11
+ /** Preferred anchor edge; right-side panels align their top edges. */
12
+ side?: 'top' | 'bottom' | 'right';
13
+ /** Horizontal alignment for panels above or below the anchor. */
24
14
  align?: 'start' | 'end';
25
- /** Distance kept between the anchor edge named by `side` and the panel. */
15
+ /** Distance from the preferred anchor edge, in CSS pixels. */
26
16
  gap: number;
27
- /** Distance kept between the panel and each viewport edge; the frame's overlay inset widens the top margin. */
17
+ /** Minimum viewport inset; desktop frame clearance can increase the top inset. */
28
18
  margin: number;
19
+ /** Reserve desktop frame clearance in addition to the margin; false keeps only the viewport margin. Defaults to true. */
20
+ frameClearance?: boolean;
21
+ /** Host-supplied client rect; null hides the panel until the anchor is available. */
22
+ getAnchorRect?: () => DOMRect | null;
23
+ /** Re-measure a committed content change before paint. */
24
+ layoutKey?: string | number;
25
+ /** Minimum panel width follows the anchor, bounded by the visible viewport. */
26
+ minWidthFromAnchor?: boolean;
29
27
  }
30
28
  /**
31
- * Track an anchor and return the panel's fixed coordinates.
32
- * @param options - the open state, the two refs, the placement side and alignment, and the gap/margin distances.
33
- * @returns `left`/`top` for the panel, or `null` before the first measurement.
29
+ * Keep a fixed panel aligned and constrained to the visible viewport.
30
+ * Panel CSS consumes `--dsh-anchored-max-width` and `--dsh-anchored-max-height` for size limits.
31
+ * The hook owns those inline variables and optional min-width while open, restoring them on cleanup.
32
+ * @param options - Open state, element refs, placement, and optional host rect or content change key.
33
+ * @returns Fixed left/top coordinates, or null while closed or awaiting an anchor; the first measurement completes before paint.
34
34
  */
35
35
  export declare function useAnchoredPosition(options: AnchoredPositionOptions): CSSProperties | null;
36
36
  //# sourceMappingURL=useAnchoredPosition.d.ts.map
@@ -0,0 +1,20 @@
1
+ import type { DragEvent } from 'react';
2
+ /**
3
+ * Own a row's inert drag preview until drag end, replacement, or unmount.
4
+ * The offscreen copy keeps WebKit snapshots separate from overlapping panels.
5
+ * The wrapper copies only explicitly requested computed custom properties.
6
+ * Its cloned slot DOM remains in document.body for that lifetime; query live rows
7
+ * within their list to exclude duplicate text and element IDs.
8
+ * @param className - preview background matching the row's surface; WebKit fills
9
+ * transparent snapshot pixels white, including rounded corners.
10
+ * @param inheritedProperties - custom-property names whose computed values the preview needs.
11
+ * Omit to copy none. Keep the list reference stable; replacing it clears the active preview.
12
+ * @returns preview callbacks; cleanup reports whether this row started a drag,
13
+ * even when its preview failed or the row became non-draggable before drag end.
14
+ * Start accepts the source row when a child handle owns the drag event.
15
+ */
16
+ export declare function useRowDragPreview(className: string, inheritedProperties?: readonly `--${string}`[]): {
17
+ start: (event: DragEvent<HTMLElement>, row?: HTMLElement) => void;
18
+ clear: () => boolean;
19
+ };
20
+ //# sourceMappingURL=useRowDragPreview.d.ts.map
@@ -1,4 +1,5 @@
1
1
  /** Inline text and reference presentation; business rules supply resolved JSON data and actions. */
2
+ import type { HTMLAttributes } from 'react';
2
3
  import type { ReactNode } from 'react';
3
4
  import { type ReferenceIconKind } from './ReferenceIcon.tsx';
4
5
  /** Plain text follows the wrapping and typography of its host. */
@@ -14,6 +15,8 @@ export declare function UserTextRun({ text }: UserTextRunProps): ReactNode;
14
15
  /** Presentation selected by a reference renderer, independent of its matching grammar. */
15
16
  export interface ReferenceChipProps {
16
17
  readonly appearance: ReferenceIconKind | 'skill' | 'command';
18
+ /** Explicit object-menu gesture bindings; absent for display-only references. */
19
+ readonly contextMenuProps?: Pick<HTMLAttributes<HTMLElement>, 'onContextMenu' | 'onKeyDown' | 'tabIndex'>;
17
20
  readonly label: string;
18
21
  readonly title: string;
19
22
  /** Absent for display-only references and previews. */
@@ -25,5 +28,5 @@ export interface ReferenceChipProps {
25
28
  * @param props - resolved visual fields and optional action from the owning renderer.
26
29
  * @returns an inline label, or a keyboard-accessible button when activation is supplied.
27
30
  */
28
- export declare function ReferenceChip({ appearance, label, title, onActivate }: ReferenceChipProps): ReactNode;
31
+ export declare function ReferenceChip({ appearance, label, title, onActivate, contextMenuProps, }: ReferenceChipProps): ReactNode;
29
32
  //# sourceMappingURL=user-text.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.2.1-rc.5",
4
+ "version": "0.2.2-alpha.3",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -23,9 +23,9 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@deepseek-ai/dsh-client-store": "0.2.1-rc.5",
27
- "@deepseek-ai/cordis": "~4.0.5",
28
- "@deepseek-ai/dsh-util-code-language": "0.2.1-rc.5",
26
+ "@deepseek-ai/dsh-client-store": "0.2.2-alpha.3",
27
+ "@deepseek-ai/cordis": "~4.0.6-alpha.2",
28
+ "@deepseek-ai/dsh-util-code-language": "0.2.2-alpha.3",
29
29
  "react": "^18.2.0",
30
30
  "clsx": "^2.0.0",
31
31
  "diff": "^9.0.0",
@@ -34,11 +34,12 @@
34
34
  "katex": "^0.18.7",
35
35
  "micromark-core-commonmark": "^2.0.3",
36
36
  "micromark-util-character": "^2.1.1",
37
+ "micromark-util-decode-string": "^2.0.1",
37
38
  "micromark-util-classify-character": "^2.0.1",
38
39
  "micromark-util-symbol": "^2.0.1",
39
40
  "micromark-util-types": "^2.0.2",
40
41
  "shiki": "^4.4.3",
41
- "@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.5",
42
+ "@deepseek-ai/dsh-util-workspace-path": "0.2.2-alpha.3",
42
43
  "@shikijs/langs": "^4.4.3",
43
44
  "@types/mdast": "^4.0.4",
44
45
  "micromark-factory-space": "^2.0.1",
@@ -48,7 +49,8 @@
48
49
  "mdast-util-math": "^3.0.0",
49
50
  "micromark-extension-gfm": "^3.0.0",
50
51
  "micromark-util-sanitize-uri": "^2.0.1",
51
- "simple-icons": "16.31.0"
52
+ "simple-icons": "16.31.0",
53
+ "@deepseek-ai/dsh-util-file-drag": "0.2.2-alpha.3"
52
54
  },
53
55
  "files": [
54
56
  "lib/index.js",
@@ -56,6 +58,6 @@
56
58
  "lib/types/**/*.d.ts"
57
59
  ],
58
60
  "peerDependencies": {
59
- "@deepseek-ai/cordis": "~4.0.5"
61
+ "@deepseek-ai/cordis": "~4.0.6-alpha.2"
60
62
  }
61
63
  }
@@ -1,14 +0,0 @@
1
- /** The copy-feedback hook's return: the transient flag and the copy handler. */
2
- export interface CopyFeedback {
3
- /** True for {@link COPIED_FEEDBACK_MS} after a successful write; render the success label off it. */
4
- copied: boolean;
5
- /** Copy the hook's text; no-op while `copied` is still true, silent on a refused write. */
6
- onCopy: () => void;
7
- }
8
- /**
9
- * Copy `text` to the clipboard with one-second success feedback.
10
- * @param text - the text to write on copy.
11
- * @returns the `copied` flag and the `onCopy` handler.
12
- */
13
- export declare function useCopyFeedback(text: string): CopyFeedback;
14
- //# sourceMappingURL=use-copy-feedback.d.ts.map