@rezi-ui/core 0.1.0-beta.1 → 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/dist/abi.d.ts +1 -1
- package/dist/abi.js +1 -1
- package/dist/app/createApp.js +32 -2
- package/dist/app/createApp.js.map +1 -1
- package/dist/app/inspectorOverlayHelper.d.ts.map +1 -1
- package/dist/app/inspectorOverlayHelper.js +3 -0
- package/dist/app/inspectorOverlayHelper.js.map +1 -1
- package/dist/app/types.d.ts +6 -0
- package/dist/app/types.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/renderer/renderToDrawlist/boxBorder.d.ts.map +1 -1
- package/dist/renderer/renderToDrawlist/boxBorder.js +5 -2
- package/dist/renderer/renderToDrawlist/boxBorder.js.map +1 -1
- package/dist/widgets/markdown/ast.d.ts +71 -0
- package/dist/widgets/markdown/ast.d.ts.map +1 -0
- package/dist/widgets/markdown/ast.js +10 -0
- package/dist/widgets/markdown/ast.js.map +1 -0
- package/dist/widgets/markdown/index.d.ts +25 -0
- package/dist/widgets/markdown/index.d.ts.map +1 -0
- package/dist/widgets/markdown/index.js +32 -0
- package/dist/widgets/markdown/index.js.map +1 -0
- package/dist/widgets/markdown/parse.d.ts +39 -0
- package/dist/widgets/markdown/parse.d.ts.map +1 -0
- package/dist/widgets/markdown/parse.js +791 -0
- package/dist/widgets/markdown/parse.js.map +1 -0
- package/dist/widgets/markdown/render.d.ts +33 -0
- package/dist/widgets/markdown/render.d.ts.map +1 -0
- package/dist/widgets/markdown/render.js +308 -0
- package/dist/widgets/markdown/render.js.map +1 -0
- package/dist/widgets/markdown/stream.d.ts +46 -0
- package/dist/widgets/markdown/stream.d.ts.map +1 -0
- package/dist/widgets/markdown/stream.js +124 -0
- package/dist/widgets/markdown/stream.js.map +1 -0
- package/dist/widgets/types/base.d.ts +11 -0
- package/dist/widgets/types/base.d.ts.map +1 -1
- package/dist/widgets/types.d.ts +1 -1
- package/dist/widgets/types.d.ts.map +1 -1
- package/dist/widgets/ui.d.ts +2 -0
- package/dist/widgets/ui.d.ts.map +1 -1
- package/dist/widgets/ui.js +2 -0
- package/dist/widgets/ui.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* packages/core/src/widgets/markdown/ast.ts — Markdown AST node types.
|
|
3
|
+
*
|
|
4
|
+
* Why: ui.markdown() parses a GitHub-Flavored-Markdown subset into this small
|
|
5
|
+
* block/inline tree before rendering it onto existing widgets. The AST is
|
|
6
|
+
* public so applications can pre-parse, cache, or transform documents
|
|
7
|
+
* (for example block-cached streaming transcripts).
|
|
8
|
+
*/
|
|
9
|
+
/** Inline markdown content node. */
|
|
10
|
+
export type MarkdownInline = Readonly<{
|
|
11
|
+
kind: "text";
|
|
12
|
+
text: string;
|
|
13
|
+
}> | Readonly<{
|
|
14
|
+
kind: "code";
|
|
15
|
+
text: string;
|
|
16
|
+
}> | Readonly<{
|
|
17
|
+
kind: "strong";
|
|
18
|
+
children: readonly MarkdownInline[];
|
|
19
|
+
}> | Readonly<{
|
|
20
|
+
kind: "em";
|
|
21
|
+
children: readonly MarkdownInline[];
|
|
22
|
+
}> | Readonly<{
|
|
23
|
+
kind: "del";
|
|
24
|
+
children: readonly MarkdownInline[];
|
|
25
|
+
}> | Readonly<{
|
|
26
|
+
kind: "link";
|
|
27
|
+
href: string;
|
|
28
|
+
children: readonly MarkdownInline[];
|
|
29
|
+
}> | Readonly<{
|
|
30
|
+
kind: "break";
|
|
31
|
+
}>;
|
|
32
|
+
/** Column alignment parsed from a table delimiter row. */
|
|
33
|
+
export type MarkdownTableAlign = "left" | "center" | "right";
|
|
34
|
+
/** One list item; `checked` is null for plain items and boolean for task items. */
|
|
35
|
+
export type MarkdownListItem = Readonly<{
|
|
36
|
+
checked: boolean | null;
|
|
37
|
+
blocks: readonly MarkdownBlock[];
|
|
38
|
+
}>;
|
|
39
|
+
/** Block-level markdown node. */
|
|
40
|
+
export type MarkdownBlock = Readonly<{
|
|
41
|
+
kind: "heading";
|
|
42
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
43
|
+
children: readonly MarkdownInline[];
|
|
44
|
+
}> | Readonly<{
|
|
45
|
+
kind: "paragraph";
|
|
46
|
+
children: readonly MarkdownInline[];
|
|
47
|
+
}> | Readonly<{
|
|
48
|
+
kind: "codeBlock";
|
|
49
|
+
language: string;
|
|
50
|
+
text: string;
|
|
51
|
+
}> | Readonly<{
|
|
52
|
+
kind: "blockquote";
|
|
53
|
+
children: readonly MarkdownBlock[];
|
|
54
|
+
}> | Readonly<{
|
|
55
|
+
kind: "list";
|
|
56
|
+
ordered: boolean;
|
|
57
|
+
start: number;
|
|
58
|
+
items: readonly MarkdownListItem[];
|
|
59
|
+
}> | Readonly<{
|
|
60
|
+
kind: "hr";
|
|
61
|
+
}> | Readonly<{
|
|
62
|
+
kind: "table";
|
|
63
|
+
align: readonly MarkdownTableAlign[];
|
|
64
|
+
head: readonly (readonly MarkdownInline[])[];
|
|
65
|
+
rows: readonly (readonly (readonly MarkdownInline[])[])[];
|
|
66
|
+
}>;
|
|
67
|
+
/** Parsed markdown document. */
|
|
68
|
+
export type MarkdownDocument = Readonly<{
|
|
69
|
+
blocks: readonly MarkdownBlock[];
|
|
70
|
+
}>;
|
|
71
|
+
//# sourceMappingURL=ast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../../src/widgets/markdown/ast.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oCAAoC;AACpC,MAAM,MAAM,cAAc,GACtB,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GACxC,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CA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C;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAC/D,QAAQ,CAAC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,CAAC,GACpE,QAAQ,CAAC;IACP,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACpC,CAAC,GACF,QAAQ,CAAC;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,GACxB,QAAQ,CAAC;IACP,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACrC,IAAI,EAAE,SAAS,CAAC,SAAS,cAAc,EAAE,CAAC,EAAE,CAAC;IAC7C,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,SAAS,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;CAC3D,CAAC,CAAC;AAEP,gCAAgC;AAChC,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IAAE,MAAM,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* packages/core/src/widgets/markdown/ast.ts — Markdown AST node types.
|
|
3
|
+
*
|
|
4
|
+
* Why: ui.markdown() parses a GitHub-Flavored-Markdown subset into this small
|
|
5
|
+
* block/inline tree before rendering it onto existing widgets. The AST is
|
|
6
|
+
* public so applications can pre-parse, cache, or transform documents
|
|
7
|
+
* (for example block-cached streaming transcripts).
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=ast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../../src/widgets/markdown/ast.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* packages/core/src/widgets/markdown/index.ts — Markdown module surface.
|
|
3
|
+
*/
|
|
4
|
+
import type { MarkdownProps, VNode } from "../types.js";
|
|
5
|
+
export type { MarkdownBlock, MarkdownDocument, MarkdownInline, MarkdownListItem, MarkdownTableAlign, } from "./ast.js";
|
|
6
|
+
export { parseMarkdown } from "./parse.js";
|
|
7
|
+
export { type MarkdownRenderOptions, renderMarkdown, renderMarkdownBlock } from "./render.js";
|
|
8
|
+
export { createMarkdownStream, type MarkdownStream, type MarkdownStreamOptions, } from "./stream.js";
|
|
9
|
+
/**
|
|
10
|
+
* Renders a GitHub-Flavored-Markdown subset onto existing widgets.
|
|
11
|
+
*
|
|
12
|
+
* Supported blocks: headings, paragraphs, fenced/indented code, blockquotes,
|
|
13
|
+
* nested ordered/unordered lists, task items, thematic breaks, and pipe
|
|
14
|
+
* tables. Inline: bold, italic, strikethrough, code, links, autolinks, hard
|
|
15
|
+
* breaks, escapes, and basic entities. Raw HTML renders as literal text.
|
|
16
|
+
* Parsing never throws; malformed input degrades to plain text.
|
|
17
|
+
*
|
|
18
|
+
* For streamed or frequently re-rendered documents, pre-parse with
|
|
19
|
+
* parseMarkdown() and render cached blocks with renderMarkdown().
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ui.markdown("# Release\n\nShips `ui.markdown` with **GFM subset** support.")
|
|
23
|
+
*/
|
|
24
|
+
export declare function markdown(source: string, props?: Omit<MarkdownProps, "source">): VNode;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/widgets/markdown/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIxD,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,KAAK,qBAAqB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC9F,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,GAC3B,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAM,GAAG,KAAK,CAOzF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* packages/core/src/widgets/markdown/index.ts — Markdown module surface.
|
|
3
|
+
*/
|
|
4
|
+
import { parseMarkdown } from "./parse.js";
|
|
5
|
+
import { renderMarkdown } from "./render.js";
|
|
6
|
+
export { parseMarkdown } from "./parse.js";
|
|
7
|
+
export { renderMarkdown, renderMarkdownBlock } from "./render.js";
|
|
8
|
+
export { createMarkdownStream, } from "./stream.js";
|
|
9
|
+
/**
|
|
10
|
+
* Renders a GitHub-Flavored-Markdown subset onto existing widgets.
|
|
11
|
+
*
|
|
12
|
+
* Supported blocks: headings, paragraphs, fenced/indented code, blockquotes,
|
|
13
|
+
* nested ordered/unordered lists, task items, thematic breaks, and pipe
|
|
14
|
+
* tables. Inline: bold, italic, strikethrough, code, links, autolinks, hard
|
|
15
|
+
* breaks, escapes, and basic entities. Raw HTML renders as literal text.
|
|
16
|
+
* Parsing never throws; malformed input degrades to plain text.
|
|
17
|
+
*
|
|
18
|
+
* For streamed or frequently re-rendered documents, pre-parse with
|
|
19
|
+
* parseMarkdown() and render cached blocks with renderMarkdown().
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ui.markdown("# Release\n\nShips `ui.markdown` with **GFM subset** support.")
|
|
23
|
+
*/
|
|
24
|
+
export function markdown(source, props = {}) {
|
|
25
|
+
const { blockGap, key } = props;
|
|
26
|
+
const options = {
|
|
27
|
+
...(blockGap === undefined ? {} : { blockGap }),
|
|
28
|
+
...(key === undefined ? {} : { key }),
|
|
29
|
+
};
|
|
30
|
+
return renderMarkdown(parseMarkdown(source), options);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/widgets/markdown/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAA8B,cAAc,EAAE,MAAM,aAAa,CAAC;AASzE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAA8B,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC9F,OAAO,EACL,oBAAoB,GAGrB,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc,EAAE,QAAuC,EAAE;IAChF,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;IAChC,MAAM,OAAO,GAA0B;QACrC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;QAC/C,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;KACtC,CAAC;IACF,OAAO,cAAc,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* packages/core/src/widgets/markdown/parse.ts — GFM-subset markdown parser.
|
|
3
|
+
*
|
|
4
|
+
* Why: ui.markdown() needs a dependency-free, deterministic parser that is
|
|
5
|
+
* safe on untrusted input (PR bodies, agent output). The grammar is a
|
|
6
|
+
* pragmatic GitHub-Flavored-Markdown subset:
|
|
7
|
+
*
|
|
8
|
+
* blocks: ATX headings, paragraphs, fenced code, indented code,
|
|
9
|
+
* blockquotes, ordered/unordered lists (nested), task items,
|
|
10
|
+
* thematic breaks, pipe tables
|
|
11
|
+
* inlines: **strong**, *em*, ~~del~~, `code`, [text](url), <autolinks>,
|
|
12
|
+
* bare http(s) URLs, hard breaks, backslash escapes, and basic
|
|
13
|
+
* HTML entities
|
|
14
|
+
*
|
|
15
|
+
* Intentional divergences from full GFM, kept simple on purpose:
|
|
16
|
+
* - no setext headings, reference links, images, footnotes, or raw HTML
|
|
17
|
+
* (HTML tags render as literal text)
|
|
18
|
+
* - no lazy paragraph continuation inside blockquotes or list items
|
|
19
|
+
* - the CommonMark emphasis algorithm is approximated with flanking checks
|
|
20
|
+
* - table delimiter rows must contain at least one `|`
|
|
21
|
+
*
|
|
22
|
+
* The parser never throws. Malformed constructs degrade to literal text,
|
|
23
|
+
* nesting depth is bounded, and inline scanning runs on a work budget so
|
|
24
|
+
* adversarial input (for example long runs of `*` or `[`) cannot trigger
|
|
25
|
+
* quadratic blowups.
|
|
26
|
+
*/
|
|
27
|
+
import type { MarkdownBlock, MarkdownDocument } from "./ast.js";
|
|
28
|
+
/**
|
|
29
|
+
* Parses pre-normalized lines into deeply frozen top-level blocks. Internal
|
|
30
|
+
* surface shared by parseMarkdown() and the streaming parser; when `starts`
|
|
31
|
+
* is provided it receives the source line index of every top-level block.
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseMarkdownLines(lines: readonly string[], starts?: number[]): MarkdownBlock[];
|
|
34
|
+
/**
|
|
35
|
+
* Parses a GFM-subset markdown document. Never throws: malformed constructs
|
|
36
|
+
* degrade to literal text and the result is deeply frozen.
|
|
37
|
+
*/
|
|
38
|
+
export declare function parseMarkdown(source: string): MarkdownDocument;
|
|
39
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/widgets/markdown/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAIjB,MAAM,UAAU,CAAC;AAiwBlB;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,CAI/F;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAK9D"}
|