@stream-mdx/react 0.1.1 → 0.3.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.
- package/dist/components/index.cjs +497 -163
- package/dist/components/index.d.cts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.mjs +496 -163
- package/dist/{index-Bt1opGCs.d.cts → index-D7px9jug.d.cts} +27 -2
- package/dist/{index-Bt1opGCs.d.ts → index-D7px9jug.d.ts} +27 -2
- package/dist/index.cjs +3767 -2043
- package/dist/index.d.cts +43 -5
- package/dist/index.d.ts +43 -5
- package/dist/index.mjs +3991 -2265
- package/dist/mdx-client.cjs +60 -18
- package/dist/mdx-client.d.cts +11 -0
- package/dist/mdx-client.d.ts +11 -0
- package/dist/mdx-client.mjs +60 -18
- package/dist/mdx-coordinator.cjs +60 -18
- package/dist/mdx-coordinator.mjs +60 -18
- package/dist/renderer/node-views.cjs +466 -133
- package/dist/renderer/node-views.d.cts +1 -1
- package/dist/renderer/node-views.d.ts +1 -1
- package/dist/renderer/node-views.mjs +409 -68
- package/dist/renderer/patch-commit-scheduler.cjs +68 -7
- package/dist/renderer/patch-commit-scheduler.d.cts +6 -5
- package/dist/renderer/patch-commit-scheduler.d.ts +6 -5
- package/dist/renderer/patch-commit-scheduler.mjs +68 -7
- package/dist/renderer/store.cjs +481 -56
- package/dist/renderer/store.d.cts +2 -1
- package/dist/renderer/store.d.ts +2 -1
- package/dist/renderer/store.mjs +479 -47
- package/dist/renderer/virtualized-code.cjs +8 -2
- package/dist/renderer/virtualized-code.d.cts +4 -0
- package/dist/renderer/virtualized-code.d.ts +4 -0
- package/dist/renderer/virtualized-code.mjs +8 -2
- package/dist/renderer.cjs +3199 -2208
- package/dist/renderer.d.cts +4 -2
- package/dist/renderer.d.ts +4 -2
- package/dist/renderer.mjs +2956 -1957
- package/dist/streaming-markdown-DSC4L0xR.d.cts +157 -0
- package/dist/streaming-markdown-Dp1IDgMT.d.ts +157 -0
- package/dist/streaming-markdown.cjs +3950 -2248
- package/dist/streaming-markdown.d.cts +6 -95
- package/dist/streaming-markdown.d.ts +6 -95
- package/dist/streaming-markdown.mjs +3962 -2252
- package/dist/utils/inline-html.d.cts +1 -1
- package/dist/utils/inline-html.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InlineNode, CompiledMdxModule, InlineHtmlDescriptor, Block, FormatAnticipationConfig, MixedContentSegment } from '@stream-mdx/core';
|
|
1
|
+
import { InlineNode, TokenLineV1, CompiledMdxModule, InlineHtmlDescriptor, Block, LazyTokenizationPriority, FormatAnticipationConfig, CodeHighlightingMode, CodeHighlightOutputMode, MixedContentSegment } from '@stream-mdx/core';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
type GenericComponent = React.ComponentType<any>;
|
|
@@ -37,6 +37,7 @@ interface BlockComponents {
|
|
|
37
37
|
index: number;
|
|
38
38
|
text: string;
|
|
39
39
|
html?: string | null;
|
|
40
|
+
tokens?: TokenLineV1 | null;
|
|
40
41
|
}>;
|
|
41
42
|
lang?: string;
|
|
42
43
|
preAttrs?: Record<string, string>;
|
|
@@ -61,7 +62,9 @@ interface BlockComponents {
|
|
|
61
62
|
compiledModule?: CompiledMdxModule | null;
|
|
62
63
|
status?: "pending" | "compiled" | "error";
|
|
63
64
|
errorMessage?: string;
|
|
65
|
+
raw?: string;
|
|
64
66
|
}>;
|
|
67
|
+
hr: React.FC<React.HTMLAttributes<HTMLHRElement>>;
|
|
65
68
|
table: React.FC<{
|
|
66
69
|
header?: InlineNode[][];
|
|
67
70
|
rows: InlineNode[][][];
|
|
@@ -125,7 +128,12 @@ interface RendererConfig {
|
|
|
125
128
|
callouts?: boolean;
|
|
126
129
|
math?: boolean;
|
|
127
130
|
formatAnticipation?: FormatAnticipationConfig;
|
|
131
|
+
codeHighlighting?: CodeHighlightingMode;
|
|
132
|
+
outputMode?: CodeHighlightOutputMode;
|
|
128
133
|
liveCodeHighlighting?: boolean;
|
|
134
|
+
liveTokenization?: boolean;
|
|
135
|
+
emitHighlightTokens?: boolean;
|
|
136
|
+
emitDiffBlocks?: boolean;
|
|
129
137
|
};
|
|
130
138
|
performance?: {
|
|
131
139
|
frameBudgetMs?: number;
|
|
@@ -144,6 +152,12 @@ interface RendererStore {
|
|
|
144
152
|
getVersion(): number;
|
|
145
153
|
subscribe(listener: () => void): () => void;
|
|
146
154
|
}
|
|
155
|
+
type CodeHighlightRangeRequest = {
|
|
156
|
+
blockId: string;
|
|
157
|
+
startLine: number;
|
|
158
|
+
endLine: number;
|
|
159
|
+
priority?: LazyTokenizationPriority;
|
|
160
|
+
};
|
|
147
161
|
interface Renderer {
|
|
148
162
|
attachWorker(worker: Worker, options?: {
|
|
149
163
|
skipInit?: boolean;
|
|
@@ -156,8 +170,19 @@ interface Renderer {
|
|
|
156
170
|
setMdxComponents(map: Record<string, GenericComponent>): void;
|
|
157
171
|
getComponentRegistry(): ComponentRegistry;
|
|
158
172
|
getStore(): RendererStore;
|
|
173
|
+
requestCodeHighlightRange(request: CodeHighlightRangeRequest): void;
|
|
159
174
|
}
|
|
160
175
|
|
|
176
|
+
type LinkSafetyModalProps = {
|
|
177
|
+
url: string;
|
|
178
|
+
isOpen: boolean;
|
|
179
|
+
isChecking?: boolean;
|
|
180
|
+
onClose: () => void;
|
|
181
|
+
onConfirm: () => void;
|
|
182
|
+
onCopy: () => void;
|
|
183
|
+
};
|
|
184
|
+
declare const DefaultLinkSafetyModal: React.FC<LinkSafetyModalProps>;
|
|
185
|
+
|
|
161
186
|
/**
|
|
162
187
|
* Render inline nodes to React elements
|
|
163
188
|
*/
|
|
@@ -220,4 +245,4 @@ declare class ComponentRegistry {
|
|
|
220
245
|
declare function mapHtmlToReact(html: string, elements: HtmlElements): React.ReactNode;
|
|
221
246
|
declare function renderParagraphMixedSegments(segments: MixedContentSegment[], inlineComponents: InlineComponents, inlineHtmlRenderers: InlineHtmlRendererMap): React.ReactNode[];
|
|
222
247
|
|
|
223
|
-
export { type BlockComponents as B, ComponentRegistry as C, type HtmlElements as H, type InlineComponents as I, type Renderer as R, type TableElements as T, type
|
|
248
|
+
export { type BlockComponents as B, ComponentRegistry as C, DefaultLinkSafetyModal as D, type HtmlElements as H, type InlineComponents as I, type LinkSafetyModalProps as L, type Renderer as R, type TableElements as T, type RendererConfig as a, type CodeHighlightRangeRequest as b, type InlineHtmlRendererMap as c, type InlineHtmlRenderer as d, defaultInlineComponents as e, defaultBlockComponents as f, renderParagraphMixedSegments as g, mapHtmlToReact as m, renderInlineNodes as r };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InlineNode, CompiledMdxModule, InlineHtmlDescriptor, Block, FormatAnticipationConfig, MixedContentSegment } from '@stream-mdx/core';
|
|
1
|
+
import { InlineNode, TokenLineV1, CompiledMdxModule, InlineHtmlDescriptor, Block, LazyTokenizationPriority, FormatAnticipationConfig, CodeHighlightingMode, CodeHighlightOutputMode, MixedContentSegment } from '@stream-mdx/core';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
type GenericComponent = React.ComponentType<any>;
|
|
@@ -37,6 +37,7 @@ interface BlockComponents {
|
|
|
37
37
|
index: number;
|
|
38
38
|
text: string;
|
|
39
39
|
html?: string | null;
|
|
40
|
+
tokens?: TokenLineV1 | null;
|
|
40
41
|
}>;
|
|
41
42
|
lang?: string;
|
|
42
43
|
preAttrs?: Record<string, string>;
|
|
@@ -61,7 +62,9 @@ interface BlockComponents {
|
|
|
61
62
|
compiledModule?: CompiledMdxModule | null;
|
|
62
63
|
status?: "pending" | "compiled" | "error";
|
|
63
64
|
errorMessage?: string;
|
|
65
|
+
raw?: string;
|
|
64
66
|
}>;
|
|
67
|
+
hr: React.FC<React.HTMLAttributes<HTMLHRElement>>;
|
|
65
68
|
table: React.FC<{
|
|
66
69
|
header?: InlineNode[][];
|
|
67
70
|
rows: InlineNode[][][];
|
|
@@ -125,7 +128,12 @@ interface RendererConfig {
|
|
|
125
128
|
callouts?: boolean;
|
|
126
129
|
math?: boolean;
|
|
127
130
|
formatAnticipation?: FormatAnticipationConfig;
|
|
131
|
+
codeHighlighting?: CodeHighlightingMode;
|
|
132
|
+
outputMode?: CodeHighlightOutputMode;
|
|
128
133
|
liveCodeHighlighting?: boolean;
|
|
134
|
+
liveTokenization?: boolean;
|
|
135
|
+
emitHighlightTokens?: boolean;
|
|
136
|
+
emitDiffBlocks?: boolean;
|
|
129
137
|
};
|
|
130
138
|
performance?: {
|
|
131
139
|
frameBudgetMs?: number;
|
|
@@ -144,6 +152,12 @@ interface RendererStore {
|
|
|
144
152
|
getVersion(): number;
|
|
145
153
|
subscribe(listener: () => void): () => void;
|
|
146
154
|
}
|
|
155
|
+
type CodeHighlightRangeRequest = {
|
|
156
|
+
blockId: string;
|
|
157
|
+
startLine: number;
|
|
158
|
+
endLine: number;
|
|
159
|
+
priority?: LazyTokenizationPriority;
|
|
160
|
+
};
|
|
147
161
|
interface Renderer {
|
|
148
162
|
attachWorker(worker: Worker, options?: {
|
|
149
163
|
skipInit?: boolean;
|
|
@@ -156,8 +170,19 @@ interface Renderer {
|
|
|
156
170
|
setMdxComponents(map: Record<string, GenericComponent>): void;
|
|
157
171
|
getComponentRegistry(): ComponentRegistry;
|
|
158
172
|
getStore(): RendererStore;
|
|
173
|
+
requestCodeHighlightRange(request: CodeHighlightRangeRequest): void;
|
|
159
174
|
}
|
|
160
175
|
|
|
176
|
+
type LinkSafetyModalProps = {
|
|
177
|
+
url: string;
|
|
178
|
+
isOpen: boolean;
|
|
179
|
+
isChecking?: boolean;
|
|
180
|
+
onClose: () => void;
|
|
181
|
+
onConfirm: () => void;
|
|
182
|
+
onCopy: () => void;
|
|
183
|
+
};
|
|
184
|
+
declare const DefaultLinkSafetyModal: React.FC<LinkSafetyModalProps>;
|
|
185
|
+
|
|
161
186
|
/**
|
|
162
187
|
* Render inline nodes to React elements
|
|
163
188
|
*/
|
|
@@ -220,4 +245,4 @@ declare class ComponentRegistry {
|
|
|
220
245
|
declare function mapHtmlToReact(html: string, elements: HtmlElements): React.ReactNode;
|
|
221
246
|
declare function renderParagraphMixedSegments(segments: MixedContentSegment[], inlineComponents: InlineComponents, inlineHtmlRenderers: InlineHtmlRendererMap): React.ReactNode[];
|
|
222
247
|
|
|
223
|
-
export { type BlockComponents as B, ComponentRegistry as C, type HtmlElements as H, type InlineComponents as I, type Renderer as R, type TableElements as T, type
|
|
248
|
+
export { type BlockComponents as B, ComponentRegistry as C, DefaultLinkSafetyModal as D, type HtmlElements as H, type InlineComponents as I, type LinkSafetyModalProps as L, type Renderer as R, type TableElements as T, type RendererConfig as a, type CodeHighlightRangeRequest as b, type InlineHtmlRendererMap as c, type InlineHtmlRenderer as d, defaultInlineComponents as e, defaultBlockComponents as f, renderParagraphMixedSegments as g, mapHtmlToReact as m, renderInlineNodes as r };
|