@danxbot/ui 7.9.8 → 8.0.0

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.
@@ -0,0 +1,35 @@
1
+ import type { MdCodeRenderer } from "../lib/syntax/markdown";
2
+ export interface CodeBlockProps {
3
+ code: string;
4
+ language?: string | null;
5
+ filename?: string;
6
+ /** Still filling — suppresses the copy button, which would copy a fragment. */
7
+ streaming?: boolean;
8
+ className?: string;
9
+ }
10
+ /**
11
+ * A fenced code block, rendered through the shared `CodeEditor` viewer.
12
+ *
13
+ * `view="source"` is pinned rather than left to `CodeEditor`'s own default:
14
+ * left alone, a fence whose language is literally `markdown` would flip
15
+ * `CodeEditor` into ITS OWN rendered-preview mode, so a ```markdown block
16
+ * quoted inside a document would render as prose nested inside prose instead
17
+ * of the literal source the author fenced off. Every other language already
18
+ * defaults to `"source"`, so this only changes behaviour for that one case.
19
+ */
20
+ export declare function CodeBlock({ code, language, filename, streaming, className }: CodeBlockProps): import("react").JSX.Element;
21
+ export interface MarkdownProps {
22
+ children: string;
23
+ className?: string;
24
+ /** Defaults to a `CodeEditor`-backed viewer with a copy button. */
25
+ renderCode?: MdCodeRenderer;
26
+ }
27
+ /**
28
+ * Renders a complete markdown string as a document.
29
+ *
30
+ * This is the general-purpose entry point — the one nearly every consumer
31
+ * wants: a card description, a comment, a retro field, a plan record. It
32
+ * parses ONCE per `children` change and hands the tree straight to
33
+ * `MarkdownNodes`; there is no second parser, no block-splitting of its own.
34
+ */
35
+ export declare const Markdown: import("react").NamedExoticComponent<MarkdownProps>;
@@ -0,0 +1,11 @@
1
+ import { type MarkdownProps } from "../Markdown";
2
+ export interface StreamingMarkdownProps extends Omit<MarkdownProps, "children"> {
3
+ children: string;
4
+ }
5
+ /**
6
+ * Blocks are memoised individually by `MarkdownNodes`' own reconciliation —
7
+ * see `Markdown`. What THIS wrapper adds is memoising the balance pass itself,
8
+ * so a re-render that does not change `children` (a sibling state update
9
+ * elsewhere in the message list) never re-scans the text.
10
+ */
11
+ export declare const StreamingMarkdown: import("react").NamedExoticComponent<StreamingMarkdownProps>;
@@ -64,6 +64,7 @@ export { Progress, Meter, ProgressRing, type ProgressProps, type MeterProps, typ
64
64
  export { Stat, StatRow, Sparkline, type StatProps, type StatRowProps, type SparklineProps, type StatSize, type StatTrend, type StatSentiment, } from "./components/Stat";
65
65
  export { DataTable, TableEmptyState, CellStack, type DataTableProps, type TableDensity, } from "./components/Table";
66
66
  export { CodeEditor, CodeEditorToolbar, CodeEditorCaption, CodeEditorCopyButton, CodeEditorWrapToggle, CodeEditorViewSwitch, type CodeEditorProps, type CodeEditorToolbarProps, type CodeEditorView, } from "./components/CodeEditor";
67
+ export { Markdown, CodeBlock, type MarkdownProps, type CodeBlockProps } from "./components/Markdown";
67
68
  export { MarkdownEditor, type MarkdownEditorProps, type MarkdownEditorHandle, } from "./components/MarkdownEditor";
68
69
  export { ReadMore, readMoreVariants, type ReadMoreProps } from "./components/ReadMore";
69
70
  export { MarkdownSurface, type SurfaceOptions, type Splice } from "./lib/markdown/surface";
@@ -97,7 +98,7 @@ export { Chat, ChatPopover, type ChatProps, type ChatPopoverProps, type ChatSurf
97
98
  export { Message, MessagePartView, ToolCall, ChatMarker, type MessageProps, type MessageAction, type MessagePartViewProps, type ToolCallProps, type ChatMarkerProps, } from "./components/chat/Message";
98
99
  export { MessageScroller, type MessageScrollerProps, } from "./components/chat/MessageScroller";
99
100
  export { Composer, type ComposerProps } from "./components/chat/Composer";
100
- export { Markdown, CodeBlock, type MarkdownProps, type CodeBlockProps } from "./components/chat/Markdown";
101
+ export { StreamingMarkdown, type StreamingMarkdownProps, } from "./components/chat/StreamingMarkdown";
101
102
  export { Attachment, AttachmentAction, AttachmentList, AttachmentPreview, type AttachmentProps, type AttachmentActionProps, type AttachmentListProps, type AttachmentPreviewProps, type AttachmentLayout, } from "./components/chat/Attachment";
102
103
  export { ModelSelector, type ModelSelectorProps, type ChatModel, } from "./components/chat/ModelSelector";
103
104
  export { EffortControl, DEFAULT_EFFORT_LEVELS, type EffortControlProps, type EffortLevel, } from "./components/chat/EffortControl";
@@ -1,4 +1,4 @@
1
1
  export { parseMarkdown } from "./parse";
2
2
  export { markdown } from "./grammar";
3
- export { MarkdownNodes, MarkdownImage, sanitizeHref } from "./render";
3
+ export { MarkdownNodes, sanitizeHref } from "./render";
4
4
  export type { MdNode, MdInline, MdListItem, MdCell, MdAlign, MdCodeRenderer } from "./types";
@@ -6,33 +6,6 @@ export interface MarkdownNodesProps {
6
6
  renderCode: MdCodeRenderer;
7
7
  }
8
8
  export declare function MarkdownNodes({ nodes, renderCode }: MarkdownNodesProps): ReactNode;
9
- /**
10
- * An inline image, capped to a compact thumbnail and click-to-enlarge.
11
- *
12
- * A screenshot dropped into a markdown field (a card comment, a problem
13
- * statement, a plan record) is the most common image this renders, and an
14
- * uncapped one would blow past the width of any of those surfaces and,
15
- * worse, a TALL one (a full-page screenshot) would still run on forever even
16
- * with a width cap alone — hence a HEIGHT cap here, not a width cap, with
17
- * `w-auto` left free to shrink for a narrow source image.
18
- *
19
- * Clicking opens the full-resolution image in a `Dialog` rather than
20
- * navigating or replacing the thumbnail in place, so the surrounding prose
21
- * never loses its layout while the image is being inspected.
22
- */
23
- /**
24
- * Exported so `components/chat/Markdown.tsx` — the streaming chat renderer,
25
- * which does NOT go through this file's node tree/parser — can reuse the
26
- * exact same capped, click-to-enlarge treatment instead of forking it. Two
27
- * markdown renderers exist in this package on purpose (streaming vs.
28
- * document); a shared leaf component is how they stay visually identical
29
- * without duplicating the cap/dialog logic.
30
- */
31
- export declare function MarkdownImage({ src, alt, title }: {
32
- src: string;
33
- alt: string;
34
- title?: string;
35
- }): ReactNode;
36
9
  /**
37
10
  * RULE TWO, the implementation: a link's scheme is checked before it is
38
11
  * rendered.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "7.9.8",
3
+ "version": "8.0.0",
4
4
  "type": "module",
5
5
  "description": "Danxbot — a domain-agnostic React design system with motion as a first-class primitive.",
6
6
  "license": "MIT",
@@ -1,22 +0,0 @@
1
- export interface CodeBlockProps {
2
- code: string;
3
- language?: string;
4
- filename?: string;
5
- /** Still filling — suppresses the copy button, which would copy a fragment. */
6
- streaming?: boolean;
7
- className?: string;
8
- }
9
- export declare function CodeBlock({ code, language, filename, streaming, className }: CodeBlockProps): import("react").JSX.Element;
10
- export interface MarkdownProps {
11
- children: string;
12
- className?: string;
13
- }
14
- /**
15
- * Blocks are memoised individually.
16
- *
17
- * A response is re-parsed on every token, so without this the reconciler
18
- * rebuilds every finished paragraph each time a word lands at the bottom —
19
- * which is both wasteful and visible, because re-created DOM loses selection.
20
- * Someone highlighting a sentence while the answer continues keeps it.
21
- */
22
- export declare const Markdown: import("react").NamedExoticComponent<MarkdownProps>;