@stream-mdx/react 0.1.1 → 0.2.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-D0akq48G.d.cts} +24 -2
- package/dist/{index-Bt1opGCs.d.ts → index-D0akq48G.d.ts} +24 -2
- package/dist/index.cjs +3761 -2043
- package/dist/index.d.cts +43 -5
- package/dist/index.d.ts +43 -5
- package/dist/index.mjs +3985 -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 +3193 -2208
- package/dist/renderer.d.cts +4 -2
- package/dist/renderer.d.ts +4 -2
- package/dist/renderer.mjs +2950 -1957
- package/dist/streaming-markdown-Ch6PwjAa.d.cts +154 -0
- package/dist/streaming-markdown-tca-Mf8D.d.ts +154 -0
- package/dist/streaming-markdown.cjs +3944 -2248
- package/dist/streaming-markdown.d.cts +6 -95
- package/dist/streaming-markdown.d.ts +6 -95
- package/dist/streaming-markdown.mjs +3956 -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,6 +128,8 @@ interface RendererConfig {
|
|
|
125
128
|
callouts?: boolean;
|
|
126
129
|
math?: boolean;
|
|
127
130
|
formatAnticipation?: FormatAnticipationConfig;
|
|
131
|
+
codeHighlighting?: CodeHighlightingMode;
|
|
132
|
+
outputMode?: CodeHighlightOutputMode;
|
|
128
133
|
liveCodeHighlighting?: boolean;
|
|
129
134
|
};
|
|
130
135
|
performance?: {
|
|
@@ -144,6 +149,12 @@ interface RendererStore {
|
|
|
144
149
|
getVersion(): number;
|
|
145
150
|
subscribe(listener: () => void): () => void;
|
|
146
151
|
}
|
|
152
|
+
type CodeHighlightRangeRequest = {
|
|
153
|
+
blockId: string;
|
|
154
|
+
startLine: number;
|
|
155
|
+
endLine: number;
|
|
156
|
+
priority?: LazyTokenizationPriority;
|
|
157
|
+
};
|
|
147
158
|
interface Renderer {
|
|
148
159
|
attachWorker(worker: Worker, options?: {
|
|
149
160
|
skipInit?: boolean;
|
|
@@ -156,8 +167,19 @@ interface Renderer {
|
|
|
156
167
|
setMdxComponents(map: Record<string, GenericComponent>): void;
|
|
157
168
|
getComponentRegistry(): ComponentRegistry;
|
|
158
169
|
getStore(): RendererStore;
|
|
170
|
+
requestCodeHighlightRange(request: CodeHighlightRangeRequest): void;
|
|
159
171
|
}
|
|
160
172
|
|
|
173
|
+
type LinkSafetyModalProps = {
|
|
174
|
+
url: string;
|
|
175
|
+
isOpen: boolean;
|
|
176
|
+
isChecking?: boolean;
|
|
177
|
+
onClose: () => void;
|
|
178
|
+
onConfirm: () => void;
|
|
179
|
+
onCopy: () => void;
|
|
180
|
+
};
|
|
181
|
+
declare const DefaultLinkSafetyModal: React.FC<LinkSafetyModalProps>;
|
|
182
|
+
|
|
161
183
|
/**
|
|
162
184
|
* Render inline nodes to React elements
|
|
163
185
|
*/
|
|
@@ -220,4 +242,4 @@ declare class ComponentRegistry {
|
|
|
220
242
|
declare function mapHtmlToReact(html: string, elements: HtmlElements): React.ReactNode;
|
|
221
243
|
declare function renderParagraphMixedSegments(segments: MixedContentSegment[], inlineComponents: InlineComponents, inlineHtmlRenderers: InlineHtmlRendererMap): React.ReactNode[];
|
|
222
244
|
|
|
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
|
|
245
|
+
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,6 +128,8 @@ interface RendererConfig {
|
|
|
125
128
|
callouts?: boolean;
|
|
126
129
|
math?: boolean;
|
|
127
130
|
formatAnticipation?: FormatAnticipationConfig;
|
|
131
|
+
codeHighlighting?: CodeHighlightingMode;
|
|
132
|
+
outputMode?: CodeHighlightOutputMode;
|
|
128
133
|
liveCodeHighlighting?: boolean;
|
|
129
134
|
};
|
|
130
135
|
performance?: {
|
|
@@ -144,6 +149,12 @@ interface RendererStore {
|
|
|
144
149
|
getVersion(): number;
|
|
145
150
|
subscribe(listener: () => void): () => void;
|
|
146
151
|
}
|
|
152
|
+
type CodeHighlightRangeRequest = {
|
|
153
|
+
blockId: string;
|
|
154
|
+
startLine: number;
|
|
155
|
+
endLine: number;
|
|
156
|
+
priority?: LazyTokenizationPriority;
|
|
157
|
+
};
|
|
147
158
|
interface Renderer {
|
|
148
159
|
attachWorker(worker: Worker, options?: {
|
|
149
160
|
skipInit?: boolean;
|
|
@@ -156,8 +167,19 @@ interface Renderer {
|
|
|
156
167
|
setMdxComponents(map: Record<string, GenericComponent>): void;
|
|
157
168
|
getComponentRegistry(): ComponentRegistry;
|
|
158
169
|
getStore(): RendererStore;
|
|
170
|
+
requestCodeHighlightRange(request: CodeHighlightRangeRequest): void;
|
|
159
171
|
}
|
|
160
172
|
|
|
173
|
+
type LinkSafetyModalProps = {
|
|
174
|
+
url: string;
|
|
175
|
+
isOpen: boolean;
|
|
176
|
+
isChecking?: boolean;
|
|
177
|
+
onClose: () => void;
|
|
178
|
+
onConfirm: () => void;
|
|
179
|
+
onCopy: () => void;
|
|
180
|
+
};
|
|
181
|
+
declare const DefaultLinkSafetyModal: React.FC<LinkSafetyModalProps>;
|
|
182
|
+
|
|
161
183
|
/**
|
|
162
184
|
* Render inline nodes to React elements
|
|
163
185
|
*/
|
|
@@ -220,4 +242,4 @@ declare class ComponentRegistry {
|
|
|
220
242
|
declare function mapHtmlToReact(html: string, elements: HtmlElements): React.ReactNode;
|
|
221
243
|
declare function renderParagraphMixedSegments(segments: MixedContentSegment[], inlineComponents: InlineComponents, inlineHtmlRenderers: InlineHtmlRendererMap): React.ReactNode[];
|
|
222
244
|
|
|
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
|
|
245
|
+
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 };
|