@wingleeio/mugen-markdown 0.2.0 → 0.4.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/index.cjs +441 -120
- package/dist/index.d.cts +93 -11
- package/dist/index.d.mts +93 -11
- package/dist/index.mjs +441 -122
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, JSX, ReactElement, ReactNode } from "react";
|
|
2
2
|
import { ParserOptions } from "@incremark/core";
|
|
3
|
-
import { Blockquote, Blockquote as Blockquote$1, Code, Code as Code$1, Heading, Heading as Heading$1, Html, Html as Html$1, Image, Image as Image$1, Link, List, List as List$1, ListItem, Paragraph, Paragraph as Paragraph$1, PhrasingContent, PhrasingContent as PhrasingContent$1, Root, Root as Root$1, RootContent, RootContent as RootContent$1, Table, Table as Table$1, TableCell, TableRow, ThematicBreak, ThematicBreak as ThematicBreak$1 } from "mdast";
|
|
3
|
+
import { Blockquote, Blockquote as Blockquote$1, Code, Code as Code$1, Delete, Emphasis, Heading, Heading as Heading$1, Html, Html as Html$1, Image, Image as Image$1, InlineCode, Link, Link as Link$1, List, List as List$1, ListItem, Paragraph, Paragraph as Paragraph$1, PhrasingContent, PhrasingContent as PhrasingContent$1, Root, Root as Root$1, RootContent, RootContent as RootContent$1, Strong, Table, Table as Table$1, TableCell, TableRow, Text as Text$1, ThematicBreak, ThematicBreak as ThematicBreak$1 } from "mdast";
|
|
4
4
|
import { BoxProps, Font, Font as Font$1, HStack, HStackProps, MeasurableStyle, PrimitiveComponent, SafeClassName, Text, TextProps, VStack, VStackProps, definePrimitive } from "@wingleeio/mugen";
|
|
5
5
|
|
|
6
6
|
//#region src/parse.d.ts
|
|
@@ -175,8 +175,19 @@ declare function resolveTheme(theme?: DeepPartial<MarkdownTheme>): MarkdownTheme
|
|
|
175
175
|
* rich-inline layout) and the painted spans use the identical fonts.
|
|
176
176
|
*/
|
|
177
177
|
interface RichTextRun {
|
|
178
|
-
/** The run's text. Ignored when `break` is set. */
|
|
179
|
-
text
|
|
178
|
+
/** The run's text. Ignored when `break` or `advance` is set. */
|
|
179
|
+
text?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Render this run as an **inline box** — the inline analogue of mugen's
|
|
182
|
+
* `Escape`: it reserves exactly `advance` px in the flow (via pretext's
|
|
183
|
+
* `extraWidth`) and paints {@link content}, whatever it is, without measuring
|
|
184
|
+
* its insides. The flow wraps it as one non-breaking atom. The caller owns the
|
|
185
|
+
* contract: `content` must render exactly `advance` px wide and no taller than
|
|
186
|
+
* the line (use the exported `measureInline` to size text-based boxes).
|
|
187
|
+
*/
|
|
188
|
+
advance?: number;
|
|
189
|
+
/** The painted content of an inline box (see {@link advance}). */
|
|
190
|
+
content?: ReactNode;
|
|
180
191
|
/** Measurable font for this run; falls back to the `<RichText font>` prop. */
|
|
181
192
|
font?: Font$1;
|
|
182
193
|
color?: string;
|
|
@@ -217,6 +228,12 @@ interface RichTextProps<C extends string = string> {
|
|
|
217
228
|
* performs over the rendered spans, so the analytic height matches the paint.
|
|
218
229
|
*/
|
|
219
230
|
declare const RichText: <C extends string = string>(props: RichTextProps<C>) => ReactElement;
|
|
231
|
+
/**
|
|
232
|
+
* Measure a string's rendered advance in px for a given measurable font — the
|
|
233
|
+
* same ruler `RichText` measures with. Use it to size an inline box: a text
|
|
234
|
+
* "pill" reserves `measureInline(label, font) + horizontalPadding`.
|
|
235
|
+
*/
|
|
236
|
+
declare function measureInline(text: string, font: Font$1): number;
|
|
220
237
|
/** Drop the rich-inline prepare cache (tests / memory pressure). */
|
|
221
238
|
declare function clearRichTextCache(): void;
|
|
222
239
|
//#endregion
|
|
@@ -252,9 +269,11 @@ declare function composeFont(fmt: InlineFormat): Font$1;
|
|
|
252
269
|
/**
|
|
253
270
|
* Flatten phrasing content into styled runs. Recursive over the inline marks;
|
|
254
271
|
* the result feeds a single `<RichText>` so the whole paragraph wraps as one
|
|
255
|
-
* flow and measures exactly.
|
|
272
|
+
* flow and measures exactly. An `inline` override map can replace how any node
|
|
273
|
+
* type flattens — returning its own runs (e.g. a measured inline box) or `null`
|
|
274
|
+
* to fall through to the default.
|
|
256
275
|
*/
|
|
257
|
-
declare function flattenInline(nodes: readonly PhrasingContent$1[], fmt: InlineFormat, theme: MarkdownTheme, out: RichTextRun[]): void;
|
|
276
|
+
declare function flattenInline(nodes: readonly PhrasingContent$1[], fmt: InlineFormat, theme: MarkdownTheme, out: RichTextRun[], inline?: InlineComponents): void;
|
|
258
277
|
//#endregion
|
|
259
278
|
//#region src/types.d.ts
|
|
260
279
|
/** Options for building a body/heading inline-text (`RichText`) element. */
|
|
@@ -315,10 +334,49 @@ interface MarkdownComponentProps<N> {
|
|
|
315
334
|
*/
|
|
316
335
|
type MarkdownComponent<N> = (props: MarkdownComponentProps<N>) => ReactNode;
|
|
317
336
|
/**
|
|
318
|
-
* The
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
|
|
337
|
+
* The context passed to an inline override. It carries the active inline format
|
|
338
|
+
* (so an override can match the surrounding type) and the helpers to build runs
|
|
339
|
+
* that stay exactly measurable.
|
|
340
|
+
*/
|
|
341
|
+
interface InlineRenderContext {
|
|
342
|
+
readonly theme: MarkdownTheme;
|
|
343
|
+
/** The composed inline format at this node (family, size, weight, colour…). */
|
|
344
|
+
readonly fmt: InlineFormat;
|
|
345
|
+
/** Compose a measurable `Font` from the current format plus overrides. */
|
|
346
|
+
font(overrides?: Partial<InlineFormat>): Font$1;
|
|
347
|
+
/**
|
|
348
|
+
* Measure a string's rendered advance in px for a font — to size an inline
|
|
349
|
+
* box. A text pill reserves `measure(label, font) + horizontalPadding`.
|
|
350
|
+
*/
|
|
351
|
+
measure(text: string, font: Font$1): number;
|
|
352
|
+
/** Default-flatten phrasing children into runs, to compose with your own. */
|
|
353
|
+
runs(nodes: readonly PhrasingContent$1[], fmtOverrides?: Partial<InlineFormat>): RichTextRun[];
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* An inline-node override: given the mdast node and the inline context, return
|
|
357
|
+
* the runs it should flatten to — styled text, an inline box (`{ advance,
|
|
358
|
+
* content }`), or a mix — or `null` to fall back to the default styling.
|
|
359
|
+
*/
|
|
360
|
+
type InlineComponent<N> = (node: N, ctx: InlineRenderContext) => RichTextRun[] | null;
|
|
361
|
+
/**
|
|
362
|
+
* Inline-node overrides, keyed by mdast inline type. The index signature admits
|
|
363
|
+
* custom inline tokens (from a remark plugin) beyond the named ones.
|
|
364
|
+
*/
|
|
365
|
+
interface InlineComponents {
|
|
366
|
+
text?: InlineComponent<Text$1>;
|
|
367
|
+
strong?: InlineComponent<Strong>;
|
|
368
|
+
emphasis?: InlineComponent<Emphasis>;
|
|
369
|
+
delete?: InlineComponent<Delete>;
|
|
370
|
+
inlineCode?: InlineComponent<InlineCode>;
|
|
371
|
+
link?: InlineComponent<Link$1>;
|
|
372
|
+
[type: string]: InlineComponent<any> | undefined;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* The overridable components. Block-level marks are keyed by mdast node type and
|
|
376
|
+
* typed to the matching node. Inline marks (bold, italic, code, links) are
|
|
377
|
+
* styled through the {@link MarkdownTheme} by default, but `inline` lets you
|
|
378
|
+
* override how an inline node flattens into runs — including a measured inline
|
|
379
|
+
* box (`{ advance, content }`), the inline twin of mugen's `Escape`.
|
|
322
380
|
*/
|
|
323
381
|
interface MarkdownComponents {
|
|
324
382
|
paragraph?: MarkdownComponent<Paragraph$1>;
|
|
@@ -330,8 +388,13 @@ interface MarkdownComponents {
|
|
|
330
388
|
table?: MarkdownComponent<Table$1>;
|
|
331
389
|
image?: MarkdownComponent<Image$1>;
|
|
332
390
|
html?: MarkdownComponent<Html$1>;
|
|
391
|
+
/** Inline-node overrides (see {@link InlineComponents}). */
|
|
392
|
+
inline?: InlineComponents;
|
|
333
393
|
}
|
|
334
|
-
|
|
394
|
+
/** Block components resolve to defaults; `inline` stays optional. */
|
|
395
|
+
type ResolvedMarkdownComponents = Required<Omit<MarkdownComponents, 'inline'>> & {
|
|
396
|
+
inline?: InlineComponents;
|
|
397
|
+
};
|
|
335
398
|
/**
|
|
336
399
|
* Identity helper for authoring a typed component set with full inference and
|
|
337
400
|
* `node` narrowing per key:
|
|
@@ -369,6 +432,13 @@ declare function renderMarkdown(source: string, options?: RenderMarkdownOptions)
|
|
|
369
432
|
interface MarkdownProps extends RenderMarkdownOptions {
|
|
370
433
|
/** The markdown source to render. */
|
|
371
434
|
source: string;
|
|
435
|
+
/**
|
|
436
|
+
* Fade just-arrived text in as the source streams. The DOM still commits and
|
|
437
|
+
* lays out instantly (heights stay exact); a veil over new characters
|
|
438
|
+
* dissolves, which reads as a fade-in. Leaving it on for a settled block is
|
|
439
|
+
* free. Honours `prefers-reduced-motion`.
|
|
440
|
+
*/
|
|
441
|
+
fade?: boolean;
|
|
372
442
|
}
|
|
373
443
|
/**
|
|
374
444
|
* Render markdown as a tree of mugen primitives.
|
|
@@ -496,6 +566,18 @@ interface TableBlockProps<C extends string = string> {
|
|
|
496
566
|
/** A measurable GFM-table primitive with aligned, content-proportional columns. */
|
|
497
567
|
declare const TableBlock: <C extends string = string>(props: TableBlockProps<C>) => ReactElement;
|
|
498
568
|
//#endregion
|
|
569
|
+
//#region src/primitives/fade.d.ts
|
|
570
|
+
interface FadeMarkdownProps {
|
|
571
|
+
/** The rendered markdown subtree to veil. */
|
|
572
|
+
children?: ReactNode;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Wraps a measured markdown subtree with a streaming fade-in canvas. Its height
|
|
576
|
+
* is exactly the subtree's height — the canvas overlay is out of flow and never
|
|
577
|
+
* measured.
|
|
578
|
+
*/
|
|
579
|
+
declare const FadeMarkdown: (props: FadeMarkdownProps) => ReactElement;
|
|
580
|
+
//#endregion
|
|
499
581
|
//#region src/highlight/languages.d.ts
|
|
500
582
|
/**
|
|
501
583
|
* Language profiles for the built-in tokenizer. A profile is a small data
|
|
@@ -537,4 +619,4 @@ declare function registerLanguage(names: string | readonly string[], p: Language
|
|
|
537
619
|
/** The profile for a fence language, or `null` when the language is unknown. */
|
|
538
620
|
declare function profileFor(lang: string | undefined): LanguageProfile | null;
|
|
539
621
|
//#endregion
|
|
540
|
-
export { type Blockquote, type BoxProps, type Code, CodeBlock, type CodeBlockHeader, type CodeBlockProps, type CodeTokenColors, type DeepPartial, type Font, HStack, type HStackProps, type Heading, type Html, type Image, type InlineFormat, type InlineTextOptions, type LanguageProfile, type Link, type List, type ListItem, Markdown, type MarkdownComponent, type MarkdownComponentProps, type MarkdownComponents, type MarkdownParseOptions, type MarkdownProps, type MarkdownRenderContext, type MarkdownTheme, type Paragraph, type PhrasingContent, type PrimitiveComponent, type RenderMarkdownOptions, type ResolvedMarkdownComponents, RichText, type RichTextProps, type RichTextRun, type Root, type RootContent, type Table, TableBlock, type TableBlockProps, type TableCell, type TableRow, Text, type TextProps, type ThematicBreak, type TokenType, VStack, type VStackProps, baseFormat, clearParseCache, clearRichTextCache, composeFont, defaultComponents, defaultTheme, defaultTokenColors, defineMarkdownComponents, definePrimitive, flattenInline, parseMarkdown, profileFor, registerLanguage, renderMarkdown, resolveTheme };
|
|
622
|
+
export { type Blockquote, type BoxProps, type Code, CodeBlock, type CodeBlockHeader, type CodeBlockProps, type CodeTokenColors, type DeepPartial, FadeMarkdown, type Font, HStack, type HStackProps, type Heading, type Html, type Image, type InlineComponent, type InlineComponents, type InlineFormat, type InlineRenderContext, type InlineTextOptions, type LanguageProfile, type Link, type List, type ListItem, Markdown, type MarkdownComponent, type MarkdownComponentProps, type MarkdownComponents, type MarkdownParseOptions, type MarkdownProps, type MarkdownRenderContext, type MarkdownTheme, type Paragraph, type PhrasingContent, type PrimitiveComponent, type RenderMarkdownOptions, type ResolvedMarkdownComponents, RichText, type RichTextProps, type RichTextRun, type Root, type RootContent, type Table, TableBlock, type TableBlockProps, type TableCell, type TableRow, Text, type TextProps, type ThematicBreak, type TokenType, VStack, type VStackProps, baseFormat, clearParseCache, clearRichTextCache, composeFont, defaultComponents, defaultTheme, defaultTokenColors, defineMarkdownComponents, definePrimitive, flattenInline, measureInline, parseMarkdown, profileFor, registerLanguage, renderMarkdown, resolveTheme };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, JSX, ReactElement, ReactNode } from "react";
|
|
2
2
|
import { BoxProps, Font, Font as Font$1, HStack, HStackProps, MeasurableStyle, PrimitiveComponent, SafeClassName, Text, TextProps, VStack, VStackProps, definePrimitive } from "@wingleeio/mugen";
|
|
3
3
|
import { ParserOptions } from "@incremark/core";
|
|
4
|
-
import { Blockquote, Blockquote as Blockquote$1, Code, Code as Code$1, Heading, Heading as Heading$1, Html, Html as Html$1, Image, Image as Image$1, Link, List, List as List$1, ListItem, Paragraph, Paragraph as Paragraph$1, PhrasingContent, PhrasingContent as PhrasingContent$1, Root, Root as Root$1, RootContent, RootContent as RootContent$1, Table, Table as Table$1, TableCell, TableRow, ThematicBreak, ThematicBreak as ThematicBreak$1 } from "mdast";
|
|
4
|
+
import { Blockquote, Blockquote as Blockquote$1, Code, Code as Code$1, Delete, Emphasis, Heading, Heading as Heading$1, Html, Html as Html$1, Image, Image as Image$1, InlineCode, Link, Link as Link$1, List, List as List$1, ListItem, Paragraph, Paragraph as Paragraph$1, PhrasingContent, PhrasingContent as PhrasingContent$1, Root, Root as Root$1, RootContent, RootContent as RootContent$1, Strong, Table, Table as Table$1, TableCell, TableRow, Text as Text$1, ThematicBreak, ThematicBreak as ThematicBreak$1 } from "mdast";
|
|
5
5
|
|
|
6
6
|
//#region src/parse.d.ts
|
|
7
7
|
/**
|
|
@@ -175,8 +175,19 @@ declare function resolveTheme(theme?: DeepPartial<MarkdownTheme>): MarkdownTheme
|
|
|
175
175
|
* rich-inline layout) and the painted spans use the identical fonts.
|
|
176
176
|
*/
|
|
177
177
|
interface RichTextRun {
|
|
178
|
-
/** The run's text. Ignored when `break` is set. */
|
|
179
|
-
text
|
|
178
|
+
/** The run's text. Ignored when `break` or `advance` is set. */
|
|
179
|
+
text?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Render this run as an **inline box** — the inline analogue of mugen's
|
|
182
|
+
* `Escape`: it reserves exactly `advance` px in the flow (via pretext's
|
|
183
|
+
* `extraWidth`) and paints {@link content}, whatever it is, without measuring
|
|
184
|
+
* its insides. The flow wraps it as one non-breaking atom. The caller owns the
|
|
185
|
+
* contract: `content` must render exactly `advance` px wide and no taller than
|
|
186
|
+
* the line (use the exported `measureInline` to size text-based boxes).
|
|
187
|
+
*/
|
|
188
|
+
advance?: number;
|
|
189
|
+
/** The painted content of an inline box (see {@link advance}). */
|
|
190
|
+
content?: ReactNode;
|
|
180
191
|
/** Measurable font for this run; falls back to the `<RichText font>` prop. */
|
|
181
192
|
font?: Font$1;
|
|
182
193
|
color?: string;
|
|
@@ -217,6 +228,12 @@ interface RichTextProps<C extends string = string> {
|
|
|
217
228
|
* performs over the rendered spans, so the analytic height matches the paint.
|
|
218
229
|
*/
|
|
219
230
|
declare const RichText: <C extends string = string>(props: RichTextProps<C>) => ReactElement;
|
|
231
|
+
/**
|
|
232
|
+
* Measure a string's rendered advance in px for a given measurable font — the
|
|
233
|
+
* same ruler `RichText` measures with. Use it to size an inline box: a text
|
|
234
|
+
* "pill" reserves `measureInline(label, font) + horizontalPadding`.
|
|
235
|
+
*/
|
|
236
|
+
declare function measureInline(text: string, font: Font$1): number;
|
|
220
237
|
/** Drop the rich-inline prepare cache (tests / memory pressure). */
|
|
221
238
|
declare function clearRichTextCache(): void;
|
|
222
239
|
//#endregion
|
|
@@ -252,9 +269,11 @@ declare function composeFont(fmt: InlineFormat): Font$1;
|
|
|
252
269
|
/**
|
|
253
270
|
* Flatten phrasing content into styled runs. Recursive over the inline marks;
|
|
254
271
|
* the result feeds a single `<RichText>` so the whole paragraph wraps as one
|
|
255
|
-
* flow and measures exactly.
|
|
272
|
+
* flow and measures exactly. An `inline` override map can replace how any node
|
|
273
|
+
* type flattens — returning its own runs (e.g. a measured inline box) or `null`
|
|
274
|
+
* to fall through to the default.
|
|
256
275
|
*/
|
|
257
|
-
declare function flattenInline(nodes: readonly PhrasingContent$1[], fmt: InlineFormat, theme: MarkdownTheme, out: RichTextRun[]): void;
|
|
276
|
+
declare function flattenInline(nodes: readonly PhrasingContent$1[], fmt: InlineFormat, theme: MarkdownTheme, out: RichTextRun[], inline?: InlineComponents): void;
|
|
258
277
|
//#endregion
|
|
259
278
|
//#region src/types.d.ts
|
|
260
279
|
/** Options for building a body/heading inline-text (`RichText`) element. */
|
|
@@ -315,10 +334,49 @@ interface MarkdownComponentProps<N> {
|
|
|
315
334
|
*/
|
|
316
335
|
type MarkdownComponent<N> = (props: MarkdownComponentProps<N>) => ReactNode;
|
|
317
336
|
/**
|
|
318
|
-
* The
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
|
|
337
|
+
* The context passed to an inline override. It carries the active inline format
|
|
338
|
+
* (so an override can match the surrounding type) and the helpers to build runs
|
|
339
|
+
* that stay exactly measurable.
|
|
340
|
+
*/
|
|
341
|
+
interface InlineRenderContext {
|
|
342
|
+
readonly theme: MarkdownTheme;
|
|
343
|
+
/** The composed inline format at this node (family, size, weight, colour…). */
|
|
344
|
+
readonly fmt: InlineFormat;
|
|
345
|
+
/** Compose a measurable `Font` from the current format plus overrides. */
|
|
346
|
+
font(overrides?: Partial<InlineFormat>): Font$1;
|
|
347
|
+
/**
|
|
348
|
+
* Measure a string's rendered advance in px for a font — to size an inline
|
|
349
|
+
* box. A text pill reserves `measure(label, font) + horizontalPadding`.
|
|
350
|
+
*/
|
|
351
|
+
measure(text: string, font: Font$1): number;
|
|
352
|
+
/** Default-flatten phrasing children into runs, to compose with your own. */
|
|
353
|
+
runs(nodes: readonly PhrasingContent$1[], fmtOverrides?: Partial<InlineFormat>): RichTextRun[];
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* An inline-node override: given the mdast node and the inline context, return
|
|
357
|
+
* the runs it should flatten to — styled text, an inline box (`{ advance,
|
|
358
|
+
* content }`), or a mix — or `null` to fall back to the default styling.
|
|
359
|
+
*/
|
|
360
|
+
type InlineComponent<N> = (node: N, ctx: InlineRenderContext) => RichTextRun[] | null;
|
|
361
|
+
/**
|
|
362
|
+
* Inline-node overrides, keyed by mdast inline type. The index signature admits
|
|
363
|
+
* custom inline tokens (from a remark plugin) beyond the named ones.
|
|
364
|
+
*/
|
|
365
|
+
interface InlineComponents {
|
|
366
|
+
text?: InlineComponent<Text$1>;
|
|
367
|
+
strong?: InlineComponent<Strong>;
|
|
368
|
+
emphasis?: InlineComponent<Emphasis>;
|
|
369
|
+
delete?: InlineComponent<Delete>;
|
|
370
|
+
inlineCode?: InlineComponent<InlineCode>;
|
|
371
|
+
link?: InlineComponent<Link$1>;
|
|
372
|
+
[type: string]: InlineComponent<any> | undefined;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* The overridable components. Block-level marks are keyed by mdast node type and
|
|
376
|
+
* typed to the matching node. Inline marks (bold, italic, code, links) are
|
|
377
|
+
* styled through the {@link MarkdownTheme} by default, but `inline` lets you
|
|
378
|
+
* override how an inline node flattens into runs — including a measured inline
|
|
379
|
+
* box (`{ advance, content }`), the inline twin of mugen's `Escape`.
|
|
322
380
|
*/
|
|
323
381
|
interface MarkdownComponents {
|
|
324
382
|
paragraph?: MarkdownComponent<Paragraph$1>;
|
|
@@ -330,8 +388,13 @@ interface MarkdownComponents {
|
|
|
330
388
|
table?: MarkdownComponent<Table$1>;
|
|
331
389
|
image?: MarkdownComponent<Image$1>;
|
|
332
390
|
html?: MarkdownComponent<Html$1>;
|
|
391
|
+
/** Inline-node overrides (see {@link InlineComponents}). */
|
|
392
|
+
inline?: InlineComponents;
|
|
333
393
|
}
|
|
334
|
-
|
|
394
|
+
/** Block components resolve to defaults; `inline` stays optional. */
|
|
395
|
+
type ResolvedMarkdownComponents = Required<Omit<MarkdownComponents, 'inline'>> & {
|
|
396
|
+
inline?: InlineComponents;
|
|
397
|
+
};
|
|
335
398
|
/**
|
|
336
399
|
* Identity helper for authoring a typed component set with full inference and
|
|
337
400
|
* `node` narrowing per key:
|
|
@@ -369,6 +432,13 @@ declare function renderMarkdown(source: string, options?: RenderMarkdownOptions)
|
|
|
369
432
|
interface MarkdownProps extends RenderMarkdownOptions {
|
|
370
433
|
/** The markdown source to render. */
|
|
371
434
|
source: string;
|
|
435
|
+
/**
|
|
436
|
+
* Fade just-arrived text in as the source streams. The DOM still commits and
|
|
437
|
+
* lays out instantly (heights stay exact); a veil over new characters
|
|
438
|
+
* dissolves, which reads as a fade-in. Leaving it on for a settled block is
|
|
439
|
+
* free. Honours `prefers-reduced-motion`.
|
|
440
|
+
*/
|
|
441
|
+
fade?: boolean;
|
|
372
442
|
}
|
|
373
443
|
/**
|
|
374
444
|
* Render markdown as a tree of mugen primitives.
|
|
@@ -496,6 +566,18 @@ interface TableBlockProps<C extends string = string> {
|
|
|
496
566
|
/** A measurable GFM-table primitive with aligned, content-proportional columns. */
|
|
497
567
|
declare const TableBlock: <C extends string = string>(props: TableBlockProps<C>) => ReactElement;
|
|
498
568
|
//#endregion
|
|
569
|
+
//#region src/primitives/fade.d.ts
|
|
570
|
+
interface FadeMarkdownProps {
|
|
571
|
+
/** The rendered markdown subtree to veil. */
|
|
572
|
+
children?: ReactNode;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Wraps a measured markdown subtree with a streaming fade-in canvas. Its height
|
|
576
|
+
* is exactly the subtree's height — the canvas overlay is out of flow and never
|
|
577
|
+
* measured.
|
|
578
|
+
*/
|
|
579
|
+
declare const FadeMarkdown: (props: FadeMarkdownProps) => ReactElement;
|
|
580
|
+
//#endregion
|
|
499
581
|
//#region src/highlight/languages.d.ts
|
|
500
582
|
/**
|
|
501
583
|
* Language profiles for the built-in tokenizer. A profile is a small data
|
|
@@ -537,4 +619,4 @@ declare function registerLanguage(names: string | readonly string[], p: Language
|
|
|
537
619
|
/** The profile for a fence language, or `null` when the language is unknown. */
|
|
538
620
|
declare function profileFor(lang: string | undefined): LanguageProfile | null;
|
|
539
621
|
//#endregion
|
|
540
|
-
export { type Blockquote, type BoxProps, type Code, CodeBlock, type CodeBlockHeader, type CodeBlockProps, type CodeTokenColors, type DeepPartial, type Font, HStack, type HStackProps, type Heading, type Html, type Image, type InlineFormat, type InlineTextOptions, type LanguageProfile, type Link, type List, type ListItem, Markdown, type MarkdownComponent, type MarkdownComponentProps, type MarkdownComponents, type MarkdownParseOptions, type MarkdownProps, type MarkdownRenderContext, type MarkdownTheme, type Paragraph, type PhrasingContent, type PrimitiveComponent, type RenderMarkdownOptions, type ResolvedMarkdownComponents, RichText, type RichTextProps, type RichTextRun, type Root, type RootContent, type Table, TableBlock, type TableBlockProps, type TableCell, type TableRow, Text, type TextProps, type ThematicBreak, type TokenType, VStack, type VStackProps, baseFormat, clearParseCache, clearRichTextCache, composeFont, defaultComponents, defaultTheme, defaultTokenColors, defineMarkdownComponents, definePrimitive, flattenInline, parseMarkdown, profileFor, registerLanguage, renderMarkdown, resolveTheme };
|
|
622
|
+
export { type Blockquote, type BoxProps, type Code, CodeBlock, type CodeBlockHeader, type CodeBlockProps, type CodeTokenColors, type DeepPartial, FadeMarkdown, type Font, HStack, type HStackProps, type Heading, type Html, type Image, type InlineComponent, type InlineComponents, type InlineFormat, type InlineRenderContext, type InlineTextOptions, type LanguageProfile, type Link, type List, type ListItem, Markdown, type MarkdownComponent, type MarkdownComponentProps, type MarkdownComponents, type MarkdownParseOptions, type MarkdownProps, type MarkdownRenderContext, type MarkdownTheme, type Paragraph, type PhrasingContent, type PrimitiveComponent, type RenderMarkdownOptions, type ResolvedMarkdownComponents, RichText, type RichTextProps, type RichTextRun, type Root, type RootContent, type Table, TableBlock, type TableBlockProps, type TableCell, type TableRow, Text, type TextProps, type ThematicBreak, type TokenType, VStack, type VStackProps, baseFormat, clearParseCache, clearRichTextCache, composeFont, defaultComponents, defaultTheme, defaultTokenColors, defineMarkdownComponents, definePrimitive, flattenInline, measureInline, parseMarkdown, profileFor, registerLanguage, renderMarkdown, resolveTheme };
|