@octanejs/streamdown 0.1.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.
Files changed (69) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +39 -0
  3. package/UPSTREAM.md +15 -0
  4. package/dist/client/chunks/chunk-6IDAODM4.js +4809 -0
  5. package/dist/client/chunks/highlighted-body-PYQZ7NZ4.js +69 -0
  6. package/dist/client/chunks/mermaid-I6WR5JDC.js +7 -0
  7. package/dist/client/cjk.js +104 -0
  8. package/dist/client/code.js +115 -0
  9. package/dist/client/index.js +57 -0
  10. package/dist/client/math.js +30 -0
  11. package/dist/client/mermaid.js +46 -0
  12. package/dist/server/chunks/chunk-55X6YY2C.js +4526 -0
  13. package/dist/server/chunks/highlighted-body-NLELYOBH.js +60 -0
  14. package/dist/server/chunks/mermaid-SICAYVAP.js +7 -0
  15. package/dist/server/cjk.js +104 -0
  16. package/dist/server/code.js +115 -0
  17. package/dist/server/index.js +57 -0
  18. package/dist/server/math.js +30 -0
  19. package/dist/server/mermaid.js +46 -0
  20. package/dist/styles.css +35 -0
  21. package/dist/types/cjk.d.ts +32 -0
  22. package/dist/types/code.d.ts +58 -0
  23. package/dist/types/hooks/use-deferred-render.d.ts +60 -0
  24. package/dist/types/index.d.ts +161 -0
  25. package/dist/types/lib/animate.d.ts +33 -0
  26. package/dist/types/lib/block-incomplete-context.d.ts +15 -0
  27. package/dist/types/lib/code-block/body.d.ts +12 -0
  28. package/dist/types/lib/code-block/container.d.ts +10 -0
  29. package/dist/types/lib/code-block/context.d.ts +7 -0
  30. package/dist/types/lib/code-block/copy-button.d.ts +10 -0
  31. package/dist/types/lib/code-block/download-button.d.ts +10 -0
  32. package/dist/types/lib/code-block/header.d.ts +6 -0
  33. package/dist/types/lib/code-block/highlighted-body.d.ts +12 -0
  34. package/dist/types/lib/code-block/index.d.ts +14 -0
  35. package/dist/types/lib/code-block/skeleton.d.ts +2 -0
  36. package/dist/types/lib/components.d.ts +3 -0
  37. package/dist/types/lib/detect-direction.d.ts +14 -0
  38. package/dist/types/lib/icon-context.d.ts +25 -0
  39. package/dist/types/lib/icons.d.ts +17 -0
  40. package/dist/types/lib/image.d.ts +6 -0
  41. package/dist/types/lib/incomplete-code-utils.d.ts +25 -0
  42. package/dist/types/lib/link-modal.d.ts +9 -0
  43. package/dist/types/lib/markdown.d.ts +33 -0
  44. package/dist/types/lib/mermaid/download-button.d.ts +13 -0
  45. package/dist/types/lib/mermaid/fullscreen-button.d.ts +11 -0
  46. package/dist/types/lib/mermaid/index.d.ts +11 -0
  47. package/dist/types/lib/mermaid/pan-zoom.d.ts +14 -0
  48. package/dist/types/lib/mermaid/utils.d.ts +7 -0
  49. package/dist/types/lib/parse-blocks.d.ts +2 -0
  50. package/dist/types/lib/plugin-context.d.ts +30 -0
  51. package/dist/types/lib/plugin-types.d.ts +151 -0
  52. package/dist/types/lib/prefix-context.d.ts +13 -0
  53. package/dist/types/lib/preprocess-custom-tags.d.ts +20 -0
  54. package/dist/types/lib/preprocess-literal-tag-content.d.ts +25 -0
  55. package/dist/types/lib/rehype/literal-tag-content.d.ts +13 -0
  56. package/dist/types/lib/remark/code-meta.d.ts +10 -0
  57. package/dist/types/lib/remark/escape-html.d.ts +4 -0
  58. package/dist/types/lib/scroll-lock.d.ts +3 -0
  59. package/dist/types/lib/table/copy-dropdown.d.ts +10 -0
  60. package/dist/types/lib/table/download-dropdown.d.ts +18 -0
  61. package/dist/types/lib/table/fullscreen-button.d.ts +10 -0
  62. package/dist/types/lib/table/index.d.ts +10 -0
  63. package/dist/types/lib/table/utils.d.ts +11 -0
  64. package/dist/types/lib/translations-context.d.ts +35 -0
  65. package/dist/types/lib/types.d.ts +17 -0
  66. package/dist/types/lib/utils.d.ts +19 -0
  67. package/dist/types/math.d.ts +44 -0
  68. package/dist/types/mermaid-plugin.d.ts +44 -0
  69. package/package.json +121 -0
@@ -0,0 +1,161 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { MermaidConfig } from 'mermaid';
3
+ import { type ComponentBody, type OctaneNode } from 'octane';
4
+ import { type RemendOptions } from 'remend';
5
+ import type { Pluggable } from 'unified';
6
+ import { type AnimateOptions, type AnimatePlugin } from './lib/animate';
7
+ import { type IconMap } from './lib/icon-context.js';
8
+ import { type Options } from './lib/markdown.js';
9
+ import type { PluginConfig, ThemeInput } from './lib/plugin-types';
10
+ import { type StreamdownTranslations } from './lib/translations-context.js';
11
+ export type { BundledLanguage, BundledTheme, ThemeRegistrationAny } from 'shiki';
12
+ export type { AnimateOptions } from './lib/animate';
13
+ export { createAnimatePlugin } from './lib/animate';
14
+ export { useIsCodeFenceIncomplete } from './lib/block-incomplete-context';
15
+ export { CodeBlock } from './lib/code-block/index.js';
16
+ export { CodeBlockContainer } from './lib/code-block/container.js';
17
+ export { CodeBlockCopyButton } from './lib/code-block/copy-button.js';
18
+ export { CodeBlockDownloadButton } from './lib/code-block/download-button.js';
19
+ export { CodeBlockHeader } from './lib/code-block/header.js';
20
+ export { CodeBlockSkeleton } from './lib/code-block/skeleton.js';
21
+ export { detectTextDirection } from './lib/detect-direction';
22
+ export type { IconMap } from './lib/icon-context.js';
23
+ export type { AllowElement, Components, ExtraProps, UrlTransform } from './lib/markdown.js';
24
+ export { defaultUrlTransform } from './lib/markdown.js';
25
+ export { parseMarkdownIntoBlocks } from './lib/parse-blocks.js';
26
+ export type { CjkPlugin, CodeHighlighterPlugin, CustomRenderer, CustomRendererProps, DiagramPlugin, HighlightOptions, MathPlugin, PluginConfig, ThemeInput } from './lib/plugin-types';
27
+ export { TableCopyDropdown, type TableCopyDropdownProps } from './lib/table/copy-dropdown.js';
28
+ export { TableDownloadButton, type TableDownloadButtonProps, TableDownloadDropdown, type TableDownloadDropdownProps } from './lib/table/download-dropdown.js';
29
+ export { escapeMarkdownTableCell, extractTableDataFromElement, type TableData, tableDataToCSV, tableDataToMarkdown, tableDataToTSV } from './lib/table/utils';
30
+ export type { StreamdownTranslations } from './lib/translations-context.js';
31
+ export { defaultTranslations } from './lib/translations-context.js';
32
+ /**
33
+ * Normalizes indentation in HTML blocks to prevent Markdown parsers from
34
+ * treating indented HTML tags as code blocks (4+ spaces = code in Markdown).
35
+ *
36
+ * Useful when rendering AI-generated HTML content with nested tags that
37
+ * are indented for readability.
38
+ *
39
+ * @param content - The raw HTML/Markdown string to normalize
40
+ * @returns The normalized string with reduced indentation before HTML tags
41
+ */
42
+ export declare const normalizeHtmlIndentation: (content: string) => string;
43
+ export type ControlsConfig = boolean | {
44
+ table?: boolean | {
45
+ copy?: boolean;
46
+ download?: boolean;
47
+ fullscreen?: boolean;
48
+ };
49
+ code?: boolean | {
50
+ copy?: boolean;
51
+ download?: boolean;
52
+ };
53
+ mermaid?: boolean | {
54
+ download?: boolean;
55
+ copy?: boolean;
56
+ fullscreen?: boolean;
57
+ panZoom?: boolean;
58
+ };
59
+ };
60
+ export interface LinkSafetyModalProps {
61
+ isOpen: boolean;
62
+ onClose: () => void;
63
+ onConfirm: () => void;
64
+ url: string;
65
+ }
66
+ export interface LinkSafetyConfig {
67
+ enabled: boolean;
68
+ onLinkCheck?: (url: string) => Promise<boolean> | boolean;
69
+ renderModal?: (props: LinkSafetyModalProps) => OctaneNode;
70
+ }
71
+ export interface MermaidErrorComponentProps {
72
+ chart: string;
73
+ error: string;
74
+ retry: () => void;
75
+ }
76
+ export interface MermaidOptions {
77
+ config?: MermaidConfig;
78
+ errorComponent?: ComponentBody<MermaidErrorComponentProps>;
79
+ }
80
+ export type AllowedTags = Record<string, string[]>;
81
+ export type StreamdownProps = Options & {
82
+ mode?: 'static' | 'streaming';
83
+ /** Text direction for blocks. "auto" detects per-block using first strong character algorithm. */
84
+ dir?: 'auto' | 'ltr' | 'rtl';
85
+ BlockComponent?: ComponentBody<BlockProps>;
86
+ parseMarkdownIntoBlocksFn?: (markdown: string) => string[];
87
+ parseIncompleteMarkdown?: boolean;
88
+ /** Normalize HTML block indentation to prevent 4+ spaces being treated as code blocks. @default false */
89
+ normalizeHtmlIndentation?: boolean;
90
+ className?: string;
91
+ shikiTheme?: [ThemeInput, ThemeInput];
92
+ mermaid?: MermaidOptions;
93
+ controls?: ControlsConfig;
94
+ isAnimating?: boolean;
95
+ animated?: boolean | AnimateOptions;
96
+ caret?: keyof typeof carets;
97
+ plugins?: PluginConfig;
98
+ remend?: RemendOptions;
99
+ linkSafety?: LinkSafetyConfig;
100
+ /** Custom tags to allow through sanitization with their permitted attributes */
101
+ allowedTags?: AllowedTags;
102
+ /**
103
+ * Tags whose children should be treated as plain text (no markdown parsing).
104
+ * Useful for mention/entity tags in AI UIs where child content is a data
105
+ * label rather than prose. Requires the tag to also be listed in `allowedTags`.
106
+ *
107
+ * @example
108
+ * ```tsx
109
+ * <Streamdown
110
+ * allowedTags={{ mention: ['user_id'] }}
111
+ * literalTagContent={['mention']}
112
+ * >
113
+ * {`<mention user_id="123">@_some_username_</mention>`}
114
+ * </Streamdown>
115
+ * ```
116
+ */
117
+ literalTagContent?: string[];
118
+ /** Override UI strings for i18n / custom labels */
119
+ translations?: Partial<StreamdownTranslations>;
120
+ /** Custom icons to override the default icons used in controls */
121
+ icons?: Partial<IconMap>;
122
+ /** Tailwind CSS prefix to prepend to all utility classes (e.g. `"tw"` produces `tw:flex` instead of `flex`). Enables Tailwind v4's `prefix()` support. Note: user-supplied `className` values are also prefixed. */
123
+ prefix?: string;
124
+ /** Show line numbers in code blocks. @default true */
125
+ lineNumbers?: boolean;
126
+ /** Called when isAnimating transitions from false to true. Suppressed in mode="static". */
127
+ onAnimationStart?: () => void;
128
+ /** Called when isAnimating transitions from true to false. Suppressed in mode="static". */
129
+ onAnimationEnd?: () => void;
130
+ };
131
+ export declare const defaultRehypePlugins: Record<string, Pluggable>;
132
+ export declare const defaultRemarkPlugins: Record<string, Pluggable>;
133
+ declare const carets: {
134
+ block: string;
135
+ circle: string;
136
+ };
137
+ export interface StreamdownContextType {
138
+ controls: ControlsConfig;
139
+ isAnimating: boolean;
140
+ /** Show line numbers in code blocks. @default true */
141
+ lineNumbers: boolean;
142
+ linkSafety?: LinkSafetyConfig;
143
+ mermaid?: MermaidOptions;
144
+ mode: 'static' | 'streaming';
145
+ shikiTheme: [ThemeInput, ThemeInput];
146
+ }
147
+ export declare const StreamdownContext: import("octane").Context<StreamdownContextType>;
148
+ export type BlockProps = Options & {
149
+ content: string;
150
+ shouldParseIncompleteMarkdown: boolean;
151
+ shouldNormalizeHtmlIndentation: boolean;
152
+ index: number;
153
+ /** Whether this block is incomplete (still being streamed) */
154
+ isIncomplete: boolean;
155
+ /** Resolved text direction for this block */
156
+ dir?: 'ltr' | 'rtl';
157
+ /** Animate plugin instance for tracking previous content length */
158
+ animatePlugin?: AnimatePlugin | null;
159
+ };
160
+ export declare const Block: ComponentBody<BlockProps, any>;
161
+ export declare const Streamdown: ComponentBody<StreamdownProps, any>;
@@ -0,0 +1,33 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { Pluggable } from 'unified';
3
+ export interface AnimatePlugin {
4
+ /**
5
+ * Selects the isolated render state used by the next synchronous rehype run.
6
+ * Streamdown calls this before rendering each block.
7
+ */
8
+ setActiveBlock: (key: string | number) => void;
9
+ /**
10
+ * Returns the total HAST text node character count from the last
11
+ * rehype run, then resets to 0. Use this value as the argument to
12
+ * setPrevContentLength on the next render.
13
+ */
14
+ getLastRenderCharCount: () => number;
15
+ name: 'animate';
16
+ rehypePlugin: Pluggable;
17
+ /**
18
+ * Set the number of HAST text characters from a previous render.
19
+ * Characters up to this count will get duration=0ms, preventing
20
+ * re-animation of already-visible content during streaming updates.
21
+ */
22
+ setPrevContentLength: (length: number) => void;
23
+ type: 'animate';
24
+ }
25
+ export interface AnimateOptions {
26
+ animation?: 'fadeIn' | 'blurIn' | 'slideUp' | (string & {});
27
+ duration?: number;
28
+ easing?: string;
29
+ sep?: 'word' | 'char';
30
+ stagger?: number;
31
+ }
32
+ export declare function createAnimatePlugin(options?: AnimateOptions): AnimatePlugin;
33
+ export declare const animate: AnimatePlugin;
@@ -0,0 +1,15 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ /**
3
+ * Context that indicates whether the current block has an incomplete code fence.
4
+ * True when: streaming is active AND this is the last block AND it has an unclosed code fence.
5
+ */
6
+ declare const BlockIncompleteContext: import("octane").Context<boolean>;
7
+ /**
8
+ * Hook to check if the current block has an incomplete (unclosed) code fence.
9
+ *
10
+ * Returns `true` when the code fence in this block is still being streamed.
11
+ * Useful for deferring expensive renders (syntax highlighting, Mermaid diagrams)
12
+ * until the code block is complete.
13
+ */
14
+ export declare const useIsCodeFenceIncomplete: () => boolean;
15
+ export { BlockIncompleteContext };
@@ -0,0 +1,12 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { HighlightResult } from '../plugin-types';
3
+ import type { ComponentProps } from '../types';
4
+ type CodeBlockBodyProps = ComponentProps<'div'> & {
5
+ result: HighlightResult;
6
+ language: string;
7
+ startLine?: number;
8
+ /** Show line numbers in code blocks. @default true */
9
+ lineNumbers?: boolean;
10
+ };
11
+ export declare const CodeBlockBody: import("octane").ComponentBody<CodeBlockBodyProps, any>;
12
+ export {};
@@ -0,0 +1,10 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { ComponentProps, CSSProperties } from '../types';
3
+ type CodeBlockContainerProps = Omit<ComponentProps<'div'>, 'style'> & {
4
+ language: string;
5
+ style?: CSSProperties;
6
+ /** Whether the code block is still being streamed (incomplete) */
7
+ isIncomplete?: boolean;
8
+ };
9
+ export declare const CodeBlockContainer: ({ className, language, style, isIncomplete, ...props }: CodeBlockContainerProps) => import("octane/jsx-runtime").Octane.JSX.Element;
10
+ export {};
@@ -0,0 +1,7 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ interface CodeBlockContextType {
3
+ code: string;
4
+ }
5
+ export declare const CodeBlockContext: import("octane").Context<CodeBlockContextType>;
6
+ export declare const useCodeBlockContext: () => CodeBlockContextType;
7
+ export {};
@@ -0,0 +1,10 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { ComponentProps } from '../types';
3
+ export type CodeBlockCopyButtonProps = ComponentProps<'button'> & {
4
+ onCopy?: () => void;
5
+ onError?: (error: Error) => void;
6
+ timeout?: number;
7
+ };
8
+ export declare const CodeBlockCopyButton: ({ onCopy, onError, timeout, children, className, code: propCode, ...props }: CodeBlockCopyButtonProps & {
9
+ code?: string;
10
+ }) => import("octane/jsx-runtime").Octane.JSX.Element;
@@ -0,0 +1,10 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { ComponentProps } from '../types';
3
+ export type CodeBlockDownloadButtonProps = ComponentProps<'button'> & {
4
+ onDownload?: () => void;
5
+ onError?: (error: Error) => void;
6
+ };
7
+ export declare const CodeBlockDownloadButton: ({ onDownload, onError, language, children, className, code: propCode, ...props }: CodeBlockDownloadButtonProps & {
8
+ code?: string;
9
+ language?: string;
10
+ }) => import("octane/jsx-runtime").Octane.JSX.Element;
@@ -0,0 +1,6 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ interface CodeBlockHeaderProps {
3
+ language: string;
4
+ }
5
+ export declare const CodeBlockHeader: ({ language }: CodeBlockHeaderProps) => import("octane/jsx-runtime").Octane.JSX.Element;
6
+ export {};
@@ -0,0 +1,12 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { HighlightResult } from '../plugin-types';
3
+ import type { HTMLAttributes } from '../types';
4
+ type HighlightedCodeBlockBodyProps = HTMLAttributes<HTMLDivElement> & {
5
+ code: string;
6
+ language: string;
7
+ raw: HighlightResult;
8
+ startLine?: number;
9
+ lineNumbers?: boolean;
10
+ };
11
+ export declare const HighlightedCodeBlockBody: ({ code, language, raw, className, startLine, lineNumbers, ...rest }: HighlightedCodeBlockBodyProps) => import("octane/jsx-runtime").Octane.JSX.Element;
12
+ export {};
@@ -0,0 +1,14 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { HTMLAttributes } from '../types';
3
+ type CodeBlockProps = HTMLAttributes<HTMLDivElement> & {
4
+ code: string;
5
+ language: string;
6
+ /** Whether the code block is still being streamed (incomplete) */
7
+ isIncomplete?: boolean;
8
+ /** Custom starting line number for line numbering (default: 1) */
9
+ startLine?: number;
10
+ /** Show line numbers in code blocks. @default true */
11
+ lineNumbers?: boolean;
12
+ };
13
+ export declare const CodeBlock: ({ code, language, className, children, isIncomplete, startLine, lineNumbers, ...rest }: CodeBlockProps) => import("octane/jsx-runtime").Octane.JSX.Element;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ export declare const CodeBlockSkeleton: () => import("octane/jsx-runtime").Octane.JSX.Element;
@@ -0,0 +1,3 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { Options } from './markdown.js';
3
+ export declare const components: Options["components"];
@@ -0,0 +1,14 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ /**
3
+ * Detect text direction using the "first strong character" algorithm.
4
+ * Strips common markdown syntax then finds the first Unicode letter
5
+ * with strong directionality.
6
+ *
7
+ * Note: markdown stripping is best-effort — nested formatting,
8
+ * multi-line fenced code blocks, and raw HTML are not fully handled.
9
+ * This is acceptable since the algorithm only needs to reach the first
10
+ * strong character, which is almost always in plain prose.
11
+ *
12
+ * @returns "rtl" if first strong char is RTL, "ltr" otherwise
13
+ */
14
+ export declare function detectTextDirection(text: string): 'ltr' | 'rtl';
@@ -0,0 +1,25 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import { type ComponentBody, type OctaneNode } from 'octane';
3
+ import type { SVGProps } from './types';
4
+ export type IconComponent = ComponentBody<SVGProps<SVGSVGElement> & {
5
+ size?: number;
6
+ }>;
7
+ export interface IconMap {
8
+ CheckIcon: IconComponent;
9
+ CopyIcon: IconComponent;
10
+ DownloadIcon: IconComponent;
11
+ ExternalLinkIcon: IconComponent;
12
+ Loader2Icon: IconComponent;
13
+ Maximize2Icon: IconComponent;
14
+ RotateCcwIcon: IconComponent;
15
+ XIcon: IconComponent;
16
+ ZoomInIcon: IconComponent;
17
+ ZoomOutIcon: IconComponent;
18
+ }
19
+ export declare const defaultIcons: IconMap;
20
+ export declare const IconContext: import("octane").Context<IconMap>;
21
+ export declare const IconProvider: ({ icons, children, }: {
22
+ icons?: Partial<IconMap>;
23
+ children: OctaneNode;
24
+ }) => import("octane/jsx-runtime").Octane.JSX.Element;
25
+ export declare const useIcons: () => IconMap;
@@ -0,0 +1,17 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ /** biome-ignore-all lint/a11y/noSvgWithoutTitle: "Streamdown icons" */
3
+ import type { SVGProps } from './types';
4
+ type IconProps = SVGProps<SVGSVGElement> & {
5
+ size?: number;
6
+ };
7
+ export declare const CheckIcon: ({ size, ...props }: IconProps) => import("octane/jsx-runtime").Octane.JSX.Element;
8
+ export declare const CopyIcon: ({ size, ...props }: IconProps) => import("octane/jsx-runtime").Octane.JSX.Element;
9
+ export declare const DownloadIcon: ({ size, ...props }: IconProps) => import("octane/jsx-runtime").Octane.JSX.Element;
10
+ export declare const Loader2Icon: ({ size, ...props }: IconProps) => import("octane/jsx-runtime").Octane.JSX.Element;
11
+ export declare const Maximize2Icon: ({ size, ...props }: IconProps) => import("octane/jsx-runtime").Octane.JSX.Element;
12
+ export declare const RotateCcwIcon: ({ size, ...props }: IconProps) => import("octane/jsx-runtime").Octane.JSX.Element;
13
+ export declare const XIcon: ({ size, ...props }: IconProps) => import("octane/jsx-runtime").Octane.JSX.Element;
14
+ export declare const ExternalLinkIcon: ({ size, ...props }: IconProps) => import("octane/jsx-runtime").Octane.JSX.Element;
15
+ export declare const ZoomInIcon: ({ size, ...props }: IconProps) => import("octane/jsx-runtime").Octane.JSX.Element;
16
+ export declare const ZoomOutIcon: ({ size, ...props }: IconProps) => import("octane/jsx-runtime").Octane.JSX.Element;
17
+ export {};
@@ -0,0 +1,6 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { ExtraProps } from './markdown.js';
3
+ import type { DetailedHTMLProps, ImgHTMLAttributes } from './types';
4
+ type ImageComponentProps = DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> & ExtraProps;
5
+ export declare const ImageComponent: ({ node, className, src, alt, onLoad: onLoadProp, onError: onErrorProp, ...props }: ImageComponentProps) => import("octane/jsx-runtime").Octane.JSX.Element | null;
6
+ export {};
@@ -0,0 +1,25 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ /**
3
+ * Checks if a markdown string contains an incomplete (unclosed) code fence
4
+ * by walking line-by-line per the CommonMark spec.
5
+ *
6
+ * Only counts fences that start at the beginning of a line (with up to 3
7
+ * spaces of indentation). This avoids false positives from inline backticks
8
+ * and correctly handles fences of any length (3+).
9
+ *
10
+ * A closing fence must use the same character as the opening fence and be
11
+ * at least as long.
12
+ *
13
+ * @param markdown - The markdown string to check
14
+ * @returns true if there's an unclosed code fence
15
+ */
16
+ export declare const hasIncompleteCodeFence: (markdown: string) => boolean;
17
+ /**
18
+ * Checks if a markdown block contains a GFM table by looking for a
19
+ * delimiter row (e.g., `| --- | --- |`). A delimiter row confirms that
20
+ * the preceding header row forms a table.
21
+ *
22
+ * @param markdown - The markdown string to check
23
+ * @returns true if the block contains a table
24
+ */
25
+ export declare const hasTable: (markdown: string) => boolean;
@@ -0,0 +1,9 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ interface LinkSafetyModalProps {
3
+ isOpen: boolean;
4
+ onClose: () => void;
5
+ onConfirm: () => void;
6
+ url: string;
7
+ }
8
+ export declare const LinkSafetyModal: ({ url, isOpen, onClose, onConfirm }: LinkSafetyModalProps) => import("octane/jsx-runtime").Octane.JSX.Element | null;
9
+ export {};
@@ -0,0 +1,33 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { Element, Parents } from 'hast';
3
+ import type { Octane } from 'octane/jsx-runtime';
4
+ import { type ComponentBody, type ElementDescriptor } from 'octane';
5
+ import type { Options as RemarkRehypeOptions } from 'remark-rehype';
6
+ import type { PluggableList } from 'unified';
7
+ import type { ComponentProps } from './types';
8
+ export interface ExtraProps {
9
+ node?: Element | undefined;
10
+ }
11
+ export type AllowElement = (element: Readonly<Element>, index: number, parent: Readonly<Parents> | undefined) => boolean | null | undefined;
12
+ export type UrlTransform = (url: string, key: string, node: Readonly<Element>) => string | null | undefined;
13
+ export type Components = {
14
+ [Key in keyof Octane.JSX.IntrinsicElements]?: ComponentBody<Octane.JSX.IntrinsicElements[Key] & ExtraProps> | keyof Octane.JSX.IntrinsicElements;
15
+ } & {
16
+ inlineCode?: ComponentBody<ComponentProps<'code'> & ExtraProps>;
17
+ [key: string]: ComponentBody<Record<string, unknown> & ExtraProps> | keyof Octane.JSX.IntrinsicElements | undefined;
18
+ };
19
+ export interface Options {
20
+ allowElement?: AllowElement;
21
+ allowedElements?: readonly string[];
22
+ children?: string;
23
+ components?: Components;
24
+ disallowedElements?: readonly string[];
25
+ rehypePlugins?: PluggableList;
26
+ remarkPlugins?: PluggableList;
27
+ remarkRehypeOptions?: Readonly<RemarkRehypeOptions>;
28
+ skipHtml?: boolean;
29
+ unwrapDisallowed?: boolean;
30
+ urlTransform?: UrlTransform;
31
+ }
32
+ export declare const Markdown: (options: Readonly<Options>) => ElementDescriptor<any>;
33
+ export declare const defaultUrlTransform: UrlTransform;
@@ -0,0 +1,13 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { MermaidConfig } from 'mermaid';
3
+ import type { OctaneNode } from 'octane';
4
+ interface MermaidDownloadDropdownProps {
5
+ chart: string;
6
+ children?: OctaneNode;
7
+ className?: string;
8
+ config?: MermaidConfig;
9
+ onDownload?: (format: 'mmd' | 'png' | 'svg') => void;
10
+ onError?: (error: Error) => void;
11
+ }
12
+ export declare const MermaidDownloadDropdown: ({ chart, children, className, onDownload, config, onError, }: MermaidDownloadDropdownProps) => import("octane/jsx-runtime").Octane.JSX.Element;
13
+ export {};
@@ -0,0 +1,11 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { MermaidConfig } from 'mermaid';
3
+ import type { ComponentProps } from '../types';
4
+ type MermaidFullscreenButtonProps = ComponentProps<'button'> & {
5
+ chart: string;
6
+ config?: MermaidConfig;
7
+ onFullscreen?: () => void;
8
+ onExit?: () => void;
9
+ };
10
+ export declare const MermaidFullscreenButton: ({ chart, config, onFullscreen, onExit, className, ...props }: MermaidFullscreenButtonProps) => import("octane/jsx-runtime").Octane.JSX.Element;
11
+ export {};
@@ -0,0 +1,11 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { MermaidConfig } from 'mermaid';
3
+ interface MermaidProps {
4
+ chart: string;
5
+ className?: string;
6
+ config?: MermaidConfig;
7
+ fullscreen?: boolean;
8
+ showControls?: boolean;
9
+ }
10
+ export declare const Mermaid: ({ chart, className, config, fullscreen, showControls, }: MermaidProps) => import("octane/jsx-runtime").Octane.JSX.Element;
11
+ export {};
@@ -0,0 +1,14 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { OctaneNode } from 'octane';
3
+ interface PanZoomProps {
4
+ children: OctaneNode;
5
+ className?: string;
6
+ fullscreen?: boolean;
7
+ initialZoom?: number;
8
+ maxZoom?: number;
9
+ minZoom?: number;
10
+ showControls?: boolean;
11
+ zoomStep?: number;
12
+ }
13
+ export declare const PanZoom: ({ children, className, minZoom, maxZoom, zoomStep, showControls, initialZoom, fullscreen, }: PanZoomProps) => import("octane/jsx-runtime").Octane.JSX.Element;
14
+ export {};
@@ -0,0 +1,7 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ /**
3
+ * Convert SVG string to PNG blob for export
4
+ */
5
+ export declare const svgToPngBlob: (svgString: string, options?: {
6
+ scale?: number;
7
+ }) => Promise<Blob>;
@@ -0,0 +1,2 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ export declare const parseMarkdownIntoBlocks: (markdown: string) => string[];
@@ -0,0 +1,30 @@
1
+ // Generated by scripts/generate-tsrx-types.mjs for the built package.
2
+ import type { PluginConfig } from './plugin-types';
3
+ /**
4
+ * Context for Streamdown plugins
5
+ */
6
+ export declare const PluginContext: import("octane").Context<PluginConfig | null>;
7
+ /**
8
+ * Hook to access all plugins
9
+ */
10
+ export declare const usePlugins: () => PluginConfig | null;
11
+ /**
12
+ * Hook to access the code plugin
13
+ */
14
+ export declare const useCodePlugin: () => import("./plugin-types").CodeHighlighterPlugin | null;
15
+ /**
16
+ * Hook to access the mermaid plugin
17
+ */
18
+ export declare const useMermaidPlugin: () => import("./plugin-types").DiagramPlugin | null;
19
+ /**
20
+ * Hook to access the math plugin
21
+ */
22
+ export declare const useMathPlugin: () => import("./plugin-types").MathPlugin | null;
23
+ /**
24
+ * Hook to access the cjk plugin
25
+ */
26
+ export declare const useCjkPlugin: () => import("./plugin-types").CjkPlugin | null;
27
+ /**
28
+ * Hook to find a custom renderer for a given language
29
+ */
30
+ export declare const useCustomRenderer: (language: string) => import("./plugin-types").CustomRenderer | null;