markstream-octane 0.0.56-beta.3 → 0.1.0-beta.2
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.md +10 -3
- package/dist/client/index.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +68 -120
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +37 -173
- package/dist/server/index.js +1 -1
- package/dist/server.d.ts +67 -120
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.js +1 -1
- package/dist/types/components/CodeBlockNode/monaco.d.ts +1 -1
- package/dist/types/components/{NodeRenderer/preloadMonaco.d.ts → CodeBlockNode/streamDiffs.d.ts} +1 -1
- package/dist/types/components/NodeRenderer/preloadStreamDiffs.d.ts +2 -0
- package/dist/types/index.d.ts +1 -3
- package/dist/types/server-renderer/index.d.ts +1 -3
- package/dist/types/server.d.ts +0 -2
- package/dist/types/types/component-props.d.ts +53 -65
- package/dist/types/types.d.ts +13 -22
- package/dist/types/utils/languageIcon.d.ts +2 -1
- package/package.json +8 -14
- package/dist/types/components/CodeBlockNode/monacoThemeRegistry.d.ts +0 -8
- package/dist/types/components/CodeBlockNode/monacoThemeScheduler.d.ts +0 -5
- package/dist/types/components/MarkdownCodeBlockNode/MarkdownCodeBlockNode.d.ts +0 -34
|
@@ -1,29 +1,13 @@
|
|
|
1
1
|
// Generated by scripts/generate-tsrx-types.mjs for the built package.
|
|
2
2
|
import type { CodeBlockNode } from 'stream-markdown-parser';
|
|
3
3
|
import type { OctaneStyle } from './octane';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
base?: string;
|
|
7
|
-
inherit?: boolean;
|
|
8
|
-
colors?: Record<string, string>;
|
|
9
|
-
rules?: Array<Record<string, unknown>>;
|
|
10
|
-
[key: string]: unknown;
|
|
11
|
-
}
|
|
12
|
-
export type CodeBlockMonacoTheme = string | CodeBlockMonacoThemeObject;
|
|
13
|
-
export type CodeBlockMonacoLanguage = string | ((...args: unknown[]) => unknown);
|
|
4
|
+
export type CodeBlockTheme = string;
|
|
5
|
+
export type CodeBlockThemes = readonly [dark: string, light: string];
|
|
14
6
|
export interface CommonCodeBlockProps {
|
|
15
7
|
showHeader?: boolean;
|
|
16
8
|
showCopyButton?: boolean;
|
|
17
9
|
showExpandButton?: boolean;
|
|
18
10
|
}
|
|
19
|
-
export interface ShikiCodeBlockProps extends CommonCodeBlockProps {
|
|
20
|
-
themes?: readonly string[];
|
|
21
|
-
/**
|
|
22
|
-
* Shiki language preload request forwarded to stream-markdown's registerHighlight().
|
|
23
|
-
* This is not a rendering allow-list; already available Shiki languages may still highlight.
|
|
24
|
-
*/
|
|
25
|
-
langs?: readonly string[];
|
|
26
|
-
}
|
|
27
11
|
export interface CodeBlockDiffHideUnchangedRegionsOptions {
|
|
28
12
|
enabled?: boolean;
|
|
29
13
|
contextLineCount?: number;
|
|
@@ -31,67 +15,71 @@ export interface CodeBlockDiffHideUnchangedRegionsOptions {
|
|
|
31
15
|
revealLineCount?: number;
|
|
32
16
|
}
|
|
33
17
|
export type CodeBlockDiffHideUnchangedRegions = boolean | CodeBlockDiffHideUnchangedRegionsOptions;
|
|
34
|
-
export
|
|
35
|
-
export type CodeBlockDiffAppearance = 'auto' | 'light' | 'dark';
|
|
36
|
-
export type CodeBlockDiffUnchangedRegionStyle = 'line-info' | 'line-info-basic' | 'metadata' | 'simple';
|
|
37
|
-
export type CodeBlockDiffHunkActionKind = 'revert' | 'stage';
|
|
38
|
-
export type CodeBlockDiffHunkSide = 'upper' | 'lower';
|
|
39
|
-
export interface CodeBlockDiffHunkActionContext {
|
|
40
|
-
action: CodeBlockDiffHunkActionKind;
|
|
41
|
-
side: CodeBlockDiffHunkSide;
|
|
42
|
-
lineChange: unknown;
|
|
43
|
-
originalModel: unknown;
|
|
44
|
-
modifiedModel: unknown;
|
|
45
|
-
}
|
|
46
|
-
export interface CodeBlockMonacoOptions {
|
|
47
|
-
MAX_HEIGHT?: number | string;
|
|
18
|
+
export interface CodeBlockOptions {
|
|
48
19
|
fontSize?: number;
|
|
49
20
|
lineHeight?: number;
|
|
50
21
|
fontFamily?: string;
|
|
22
|
+
maxHeight?: number;
|
|
23
|
+
padding?: number;
|
|
51
24
|
tabSize?: number;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
25
|
+
disableLineNumbers?: boolean;
|
|
26
|
+
overflow?: 'scroll' | 'wrap';
|
|
27
|
+
disableVirtualizationBuffers?: boolean;
|
|
28
|
+
preferredHighlighter?: 'shiki-js' | 'shiki-wasm';
|
|
29
|
+
useCSSClasses?: boolean;
|
|
30
|
+
useTokenTransformer?: boolean;
|
|
31
|
+
tokenizeMaxLineLength?: number;
|
|
32
|
+
tokenizeMaxLength?: number;
|
|
33
|
+
unsafeCSS?: string;
|
|
34
|
+
diffStyle?: 'unified' | 'split';
|
|
35
|
+
diffIndicators?: 'classic' | 'bars' | 'none';
|
|
36
|
+
disableBackground?: boolean;
|
|
37
|
+
hunkSeparators?: 'simple' | 'metadata' | 'line-info' | 'line-info-basic';
|
|
38
|
+
expandUnchanged?: boolean;
|
|
39
|
+
collapsedContextThreshold?: number;
|
|
40
|
+
lineDiffType?: 'word-alt' | 'word' | 'char' | 'none';
|
|
41
|
+
maxLineDiffLength?: number;
|
|
42
|
+
expansionLineCount?: number;
|
|
43
|
+
parseDiffOptions?: Record<string, unknown>;
|
|
44
|
+
lineHoverHighlight?: 'disabled' | 'both' | 'number' | 'line';
|
|
45
|
+
enableTokenInteractionsOnWhitespace?: boolean;
|
|
46
|
+
enableGutterUtility?: boolean;
|
|
47
|
+
enableLineSelection?: boolean;
|
|
48
|
+
controlledSelection?: boolean;
|
|
49
|
+
onGutterUtilityClick?: (...args: any[]) => unknown;
|
|
50
|
+
onLineClick?: (...args: any[]) => unknown;
|
|
51
|
+
onLineNumberClick?: (...args: any[]) => unknown;
|
|
52
|
+
onLineEnter?: (...args: any[]) => unknown;
|
|
53
|
+
onLineLeave?: (...args: any[]) => unknown;
|
|
54
|
+
onTokenClick?: (...args: any[]) => unknown;
|
|
55
|
+
onTokenEnter?: (...args: any[]) => unknown;
|
|
56
|
+
onTokenLeave?: (...args: any[]) => unknown;
|
|
57
|
+
onLineSelected?: (...args: any[]) => unknown;
|
|
58
|
+
onLineSelectionStart?: (...args: any[]) => unknown;
|
|
59
|
+
onLineSelectionChange?: (...args: any[]) => unknown;
|
|
60
|
+
onLineSelectionEnd?: (...args: any[]) => unknown;
|
|
61
|
+
getLineIndex?: (...args: any[]) => unknown;
|
|
62
|
+
renderAnnotation?: (...args: any[]) => unknown;
|
|
63
|
+
renderGutterUtility?: (...args: any[]) => unknown;
|
|
64
|
+
onPostRender?: (...args: any[]) => unknown;
|
|
65
|
+
mergeConflict?: boolean;
|
|
66
|
+
lineAnnotations?: unknown[];
|
|
67
|
+
onController?: (controller: any) => void;
|
|
68
|
+
workerManager?: unknown;
|
|
81
69
|
}
|
|
82
70
|
export interface CodeBlockNodeProps extends CommonCodeBlockProps {
|
|
83
71
|
node: CodeBlockNode;
|
|
72
|
+
codeBlockOptions?: CodeBlockOptions;
|
|
84
73
|
isDark?: boolean;
|
|
85
74
|
loading?: boolean;
|
|
86
75
|
stream?: boolean;
|
|
87
|
-
darkTheme?:
|
|
88
|
-
lightTheme?:
|
|
76
|
+
darkTheme?: CodeBlockTheme;
|
|
77
|
+
lightTheme?: CodeBlockTheme;
|
|
89
78
|
isShowPreview?: boolean;
|
|
90
|
-
monacoOptions?: CodeBlockMonacoOptions;
|
|
91
79
|
enableFontSizeControl?: boolean;
|
|
92
80
|
minWidth?: string | number;
|
|
93
81
|
maxWidth?: string | number;
|
|
94
|
-
themes?:
|
|
82
|
+
themes?: CodeBlockThemes;
|
|
95
83
|
showPreviewButton?: boolean;
|
|
96
84
|
showCollapseButton?: boolean;
|
|
97
85
|
showFontSizeButtons?: boolean;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -4,10 +4,11 @@ import type { ComponentBody } from 'octane';
|
|
|
4
4
|
import type { BaseNode, HtmlPolicy, MarkdownIt, ParsedNode, ParseOptions } from 'stream-markdown-parser';
|
|
5
5
|
import type { CustomComponentMap, HtmlComponentDefinitions, HtmlComponentMap, StreamingComponentDefinitions, StreamingComponentMap } from './customComponents';
|
|
6
6
|
import type { SmoothMarkdownStreamOptions } from './hooks/useSmoothMarkdownStream';
|
|
7
|
-
import type {
|
|
8
|
-
type NodeRendererCodeBlockThemes = CodeBlockNodeProps['themes']
|
|
9
|
-
export type NodeRendererCodeBlockProps = Partial<Omit<CodeBlockNodeProps, 'node' | 'themes'
|
|
7
|
+
import type { CodeBlockNodeProps, CodeBlockOptions, CodeBlockPreviewPayload, CodeBlockTheme, CodeBlockThemes, D2BlockNodeProps, InfographicBlockNodeProps, MermaidBlockNodeProps } from './types/component-props';
|
|
8
|
+
type NodeRendererCodeBlockThemes = CodeBlockNodeProps['themes'];
|
|
9
|
+
export type NodeRendererCodeBlockProps = Partial<Omit<CodeBlockNodeProps, 'node' | 'themes' | 'codeBlockOptions'>> & {
|
|
10
10
|
themes?: NodeRendererCodeBlockThemes;
|
|
11
|
+
codeBlockOptions?: never;
|
|
11
12
|
} & Record<string, unknown>;
|
|
12
13
|
export interface NodeRendererProps<TStreamingComponents extends Record<string, ComponentBody<any>> = StreamingComponentMap, THtmlComponents extends Record<string, any> = HtmlComponentMap> {
|
|
13
14
|
content?: string;
|
|
@@ -31,30 +32,21 @@ export interface NodeRendererProps<TStreamingComponents extends Record<string, C
|
|
|
31
32
|
htmlPolicy?: HtmlPolicy;
|
|
32
33
|
viewportPriority?: boolean;
|
|
33
34
|
codeBlockStream?: boolean;
|
|
34
|
-
codeBlockDarkTheme?:
|
|
35
|
-
codeBlockLightTheme?:
|
|
36
|
-
codeBlockMonacoOptions?: CodeBlockMonacoOptions;
|
|
35
|
+
codeBlockDarkTheme?: CodeBlockTheme;
|
|
36
|
+
codeBlockLightTheme?: CodeBlockTheme;
|
|
37
37
|
renderCodeBlocksAsPre?: boolean;
|
|
38
38
|
codeBlockMinWidth?: string | number;
|
|
39
39
|
codeBlockMaxWidth?: string | number;
|
|
40
|
+
codeBlockOptions?: CodeBlockOptions;
|
|
40
41
|
codeBlockProps?: NodeRendererCodeBlockProps;
|
|
41
42
|
mermaidProps?: Partial<Omit<MermaidBlockNodeProps, 'node' | 'loading' | 'isDark'>>;
|
|
42
43
|
d2Props?: Partial<Omit<D2BlockNodeProps, 'node' | 'loading' | 'isDark'>>;
|
|
43
44
|
infographicProps?: Partial<Omit<InfographicBlockNodeProps, 'node' | 'loading' | 'isDark'>>;
|
|
44
45
|
showTooltips?: boolean;
|
|
45
46
|
/**
|
|
46
|
-
*
|
|
47
|
-
* When Shiki code blocks are used, only string theme names are forwarded to
|
|
48
|
-
* MarkdownCodeBlockNode / stream-markdown; theme objects are ignored.
|
|
47
|
+
* Dark/light theme names used by stream-diffs backed code blocks.
|
|
49
48
|
*/
|
|
50
|
-
themes?:
|
|
51
|
-
/**
|
|
52
|
-
* Shiki language preload list forwarded to MarkdownCodeBlockNode.
|
|
53
|
-
*
|
|
54
|
-
* The default Octane code block renderer is Monaco-backed. This prop is used
|
|
55
|
-
* when a custom `code_block` or language renderer uses MarkdownCodeBlockNode.
|
|
56
|
-
*/
|
|
57
|
-
langs?: readonly string[];
|
|
49
|
+
themes?: CodeBlockThemes;
|
|
58
50
|
isDark?: boolean;
|
|
59
51
|
customId?: string;
|
|
60
52
|
indexKey?: number | string;
|
|
@@ -102,6 +94,7 @@ export interface RenderContext {
|
|
|
102
94
|
htmlComponents?: HtmlComponentMap;
|
|
103
95
|
customHtmlTags?: readonly string[];
|
|
104
96
|
htmlPolicy?: HtmlPolicy;
|
|
97
|
+
codeBlockOptions?: CodeBlockOptions;
|
|
105
98
|
codeBlockProps?: NodeRendererCodeBlockProps;
|
|
106
99
|
mermaidProps?: Partial<Omit<MermaidBlockNodeProps, 'node' | 'loading' | 'isDark'>>;
|
|
107
100
|
d2Props?: Partial<Omit<D2BlockNodeProps, 'node' | 'loading' | 'isDark'>>;
|
|
@@ -110,13 +103,11 @@ export interface RenderContext {
|
|
|
110
103
|
codeBlockStream?: boolean;
|
|
111
104
|
renderCodeBlocksAsPre?: boolean;
|
|
112
105
|
codeBlockThemes?: {
|
|
113
|
-
themes?:
|
|
114
|
-
darkTheme?:
|
|
115
|
-
lightTheme?:
|
|
116
|
-
monacoOptions?: CodeBlockMonacoOptions;
|
|
106
|
+
themes?: CodeBlockThemes;
|
|
107
|
+
darkTheme?: CodeBlockTheme;
|
|
108
|
+
lightTheme?: CodeBlockTheme;
|
|
117
109
|
minWidth?: string | number;
|
|
118
110
|
maxWidth?: string | number;
|
|
119
|
-
langs?: readonly string[];
|
|
120
111
|
};
|
|
121
112
|
events: {
|
|
122
113
|
onCopy?: (code: string) => void;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
export type LanguageIconResolver = (lang: string) => string | undefined | null;
|
|
3
3
|
export declare function setLanguageIconResolver(resolver?: LanguageIconResolver | null): void;
|
|
4
4
|
export declare function normalizeLanguageIdentifier(lang?: string | null): string;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function resolveLanguageId(lang?: string | null): string;
|
|
6
6
|
export declare function preloadExtendedLanguageIcons(): Promise<void>;
|
|
7
7
|
export declare function subscribeLanguageIconsRevision(listener: () => void): () => void;
|
|
8
8
|
export declare function getLanguageIcon(lang: string): string;
|
|
9
9
|
export declare const languageMap: Record<string, string>;
|
|
10
|
+
export declare function isLikelyIncompleteLanguageIdentifier(lang?: string | null): boolean;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markstream-octane",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
5
|
-
"description": "Octane streaming Markdown renderer for AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown, long documents, Mermaid, KaTeX,
|
|
4
|
+
"version": "0.1.0-beta.2",
|
|
5
|
+
"description": "Octane streaming Markdown renderer for AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown, long documents, Mermaid, KaTeX, stream-diffs powered code blocks, and custom Octane components.",
|
|
6
6
|
"author": "Simon He",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"homepage": "https://markstream.simonhe.me",
|
|
@@ -35,9 +35,7 @@
|
|
|
35
35
|
"streaming-mermaid",
|
|
36
36
|
"katex",
|
|
37
37
|
"streaming-katex",
|
|
38
|
-
"
|
|
39
|
-
"monaco",
|
|
40
|
-
"monaco-editor",
|
|
38
|
+
"stream-diffs",
|
|
41
39
|
"streaming-code-blocks",
|
|
42
40
|
"large-documents",
|
|
43
41
|
"safe-html",
|
|
@@ -84,8 +82,7 @@
|
|
|
84
82
|
"katex": ">=0.16.22",
|
|
85
83
|
"mermaid": ">=11",
|
|
86
84
|
"octane": "^0.1.21",
|
|
87
|
-
"stream-
|
|
88
|
-
"stream-monaco": ">=0.0.48"
|
|
85
|
+
"stream-diffs": ">=0.0.2"
|
|
89
86
|
},
|
|
90
87
|
"peerDependenciesMeta": {
|
|
91
88
|
"@antv/infographic": {
|
|
@@ -100,18 +97,15 @@
|
|
|
100
97
|
"mermaid": {
|
|
101
98
|
"optional": true
|
|
102
99
|
},
|
|
103
|
-
"stream-
|
|
104
|
-
"optional": true
|
|
105
|
-
},
|
|
106
|
-
"stream-monaco": {
|
|
100
|
+
"stream-diffs": {
|
|
107
101
|
"optional": true
|
|
108
102
|
}
|
|
109
103
|
},
|
|
110
104
|
"dependencies": {
|
|
111
105
|
"@floating-ui/dom": "^1.8.0",
|
|
112
106
|
"clsx": "^2.1.1",
|
|
113
|
-
"markstream-core": "1.0.
|
|
114
|
-
"stream-markdown-parser": "1.2.1"
|
|
107
|
+
"markstream-core": "1.1.0-beta.1",
|
|
108
|
+
"stream-markdown-parser": "1.2.5-beta.1"
|
|
115
109
|
},
|
|
116
110
|
"devDependencies": {
|
|
117
111
|
"@octanejs/testing-library": "^0.1.18",
|
|
@@ -144,6 +138,6 @@
|
|
|
144
138
|
"size:check": "node ../../scripts/check-package-size.mjs",
|
|
145
139
|
"check:core-published": "node ../../scripts/check-core-published.mjs --package-json package.json --core-package-json ../markstream-core/package.json",
|
|
146
140
|
"check:workspace-deps-published": "node ../../scripts/check-workspace-deps-published.mjs --package-json package.json",
|
|
147
|
-
"release": "pnpm run check:workspace-deps-published && bumpp --all --commit --no-tag --no-push --execute 'pnpm --workspace-root run docs:llms:generate' &&
|
|
141
|
+
"release": "pnpm run check:workspace-deps-published && bumpp --all --commit --no-tag --no-push --execute 'pnpm --workspace-root run docs:llms:generate' && DIST_TAG=\"$(node ../../scripts/dist-tag.mjs)\" && pnpm publish --access public --tag \"${DIST_TAG}\" && node ../../scripts/tag-package.mjs --package-json package.json --push"
|
|
148
142
|
}
|
|
149
143
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Generated by scripts/generate-tsrx-types.mjs for the built package.
|
|
2
|
-
type MonacoTheme = any;
|
|
3
|
-
type SetThemeFn = (theme: MonacoTheme, force?: boolean) => Promise<void> | void;
|
|
4
|
-
export declare function subscribeMonacoThemeApplied(listener: () => void): () => void;
|
|
5
|
-
export declare function registerMonacoThemeSetter(setTheme: SetThemeFn | null | undefined): void;
|
|
6
|
-
export declare function setDesiredMonacoTheme(theme: MonacoTheme | null | undefined): void;
|
|
7
|
-
export declare function getDesiredMonacoTheme(): MonacoTheme | null;
|
|
8
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// Generated by scripts/generate-tsrx-types.mjs for the built package.
|
|
2
|
-
type MonacoTheme = any;
|
|
3
|
-
type SetThemeFn = (theme: MonacoTheme, force?: boolean) => Promise<void> | void;
|
|
4
|
-
export declare function scheduleMonacoThemeUpdate(theme: MonacoTheme, setTheme: SetThemeFn): Promise<void>;
|
|
5
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// Generated by scripts/generate-tsrx-types.mjs for the built package.
|
|
2
|
-
import type { ShikiCodeBlockProps } from '../../types/component-props';
|
|
3
|
-
export interface MarkdownCodeBlockNodeProps extends ShikiCodeBlockProps {
|
|
4
|
-
node: {
|
|
5
|
-
type: 'code_block';
|
|
6
|
-
language: string;
|
|
7
|
-
code: string;
|
|
8
|
-
raw: string;
|
|
9
|
-
diff?: boolean;
|
|
10
|
-
originalCode?: string;
|
|
11
|
-
updatedCode?: string;
|
|
12
|
-
};
|
|
13
|
-
loading?: boolean;
|
|
14
|
-
stream?: boolean;
|
|
15
|
-
darkTheme?: string;
|
|
16
|
-
lightTheme?: string;
|
|
17
|
-
isDark?: boolean;
|
|
18
|
-
isShowPreview?: boolean;
|
|
19
|
-
enableFontSizeControl?: boolean;
|
|
20
|
-
minWidth?: string | number;
|
|
21
|
-
maxWidth?: string | number;
|
|
22
|
-
showPreviewButton?: boolean;
|
|
23
|
-
showCollapseButton?: boolean;
|
|
24
|
-
showFontSizeButtons?: boolean;
|
|
25
|
-
showTooltips?: boolean;
|
|
26
|
-
onCopy?: (code: string) => void;
|
|
27
|
-
onPreviewCode?: (payload: {
|
|
28
|
-
type: string;
|
|
29
|
-
content: string;
|
|
30
|
-
title: string;
|
|
31
|
-
}) => void;
|
|
32
|
-
}
|
|
33
|
-
export declare function MarkdownCodeBlockNode(rawProps: MarkdownCodeBlockNodeProps): import("octane/jsx-runtime").Octane.JSX.Element;
|
|
34
|
-
export default MarkdownCodeBlockNode;
|