toolcraft 0.0.1
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 +91 -0
- package/dist/cli.compile-check.d.ts +1 -0
- package/dist/cli.compile-check.js +26 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.js +1312 -0
- package/dist/index.compile-check.d.ts +1 -0
- package/dist/index.compile-check.js +50 -0
- package/dist/index.d.ts +164 -0
- package/dist/index.js +366 -0
- package/dist/mcp.compile-check.d.ts +1 -0
- package/dist/mcp.compile-check.js +26 -0
- package/dist/mcp.d.ts +31 -0
- package/dist/mcp.js +354 -0
- package/dist/number-schema.d.ts +3 -0
- package/dist/number-schema.js +8 -0
- package/dist/renderer.d.ts +5 -0
- package/dist/renderer.js +148 -0
- package/dist/schema-scope.d.ts +4 -0
- package/dist/schema-scope.js +34 -0
- package/dist/sdk.compile-check.d.ts +1 -0
- package/dist/sdk.compile-check.js +79 -0
- package/dist/sdk.d.ts +63 -0
- package/dist/sdk.js +218 -0
- package/node_modules/@poe-code/design-system/dist/acp/components.d.ts +11 -0
- package/node_modules/@poe-code/design-system/dist/acp/components.js +121 -0
- package/node_modules/@poe-code/design-system/dist/acp/index.d.ts +3 -0
- package/node_modules/@poe-code/design-system/dist/acp/index.js +2 -0
- package/node_modules/@poe-code/design-system/dist/acp/writer.d.ts +13 -0
- package/node_modules/@poe-code/design-system/dist/acp/writer.js +21 -0
- package/node_modules/@poe-code/design-system/dist/components/command-errors.d.ts +16 -0
- package/node_modules/@poe-code/design-system/dist/components/command-errors.js +22 -0
- package/node_modules/@poe-code/design-system/dist/components/help-formatter.d.ts +20 -0
- package/node_modules/@poe-code/design-system/dist/components/help-formatter.js +27 -0
- package/node_modules/@poe-code/design-system/dist/components/index.d.ts +10 -0
- package/node_modules/@poe-code/design-system/dist/components/index.js +7 -0
- package/node_modules/@poe-code/design-system/dist/components/logger.d.ts +11 -0
- package/node_modules/@poe-code/design-system/dist/components/logger.js +60 -0
- package/node_modules/@poe-code/design-system/dist/components/symbols.d.ts +12 -0
- package/node_modules/@poe-code/design-system/dist/components/symbols.js +71 -0
- package/node_modules/@poe-code/design-system/dist/components/table.d.ts +13 -0
- package/node_modules/@poe-code/design-system/dist/components/table.js +74 -0
- package/node_modules/@poe-code/design-system/dist/components/text.d.ts +14 -0
- package/node_modules/@poe-code/design-system/dist/components/text.js +104 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/ansi.d.ts +18 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/ansi.js +298 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/buffer.d.ts +25 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/buffer.js +189 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/components/border.d.ts +9 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/components/border.js +123 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/components/footer.d.ts +8 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/components/footer.js +57 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/components/output-pane.d.ts +12 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/components/output-pane.js +254 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/components/stats-pane.d.ts +7 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/components/stats-pane.js +121 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/dashboard.d.ts +20 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/dashboard.js +167 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/demo.d.ts +13 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/demo.js +145 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/index.d.ts +8 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/index.js +4 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/keymap.d.ts +3 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/keymap.js +99 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/layout.d.ts +25 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/layout.js +79 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/should-use-dashboard.d.ts +10 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/should-use-dashboard.js +7 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/snapshot.d.ts +10 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/snapshot.js +68 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/store.d.ts +8 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/store.js +51 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/terminal.d.ts +37 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/terminal.js +233 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/types.d.ts +36 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/types.js +1 -0
- package/node_modules/@poe-code/design-system/dist/index.d.ts +33 -0
- package/node_modules/@poe-code/design-system/dist/index.js +31 -0
- package/node_modules/@poe-code/design-system/dist/internal/output-format.d.ts +6 -0
- package/node_modules/@poe-code/design-system/dist/internal/output-format.js +22 -0
- package/node_modules/@poe-code/design-system/dist/internal/strip-ansi.d.ts +1 -0
- package/node_modules/@poe-code/design-system/dist/internal/strip-ansi.js +3 -0
- package/node_modules/@poe-code/design-system/dist/internal/theme-detect.d.ts +11 -0
- package/node_modules/@poe-code/design-system/dist/internal/theme-detect.js +49 -0
- package/node_modules/@poe-code/design-system/dist/prompts/index.d.ts +66 -0
- package/node_modules/@poe-code/design-system/dist/prompts/index.js +132 -0
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/cancel.d.ts +2 -0
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/cancel.js +9 -0
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/intro.d.ts +1 -0
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/intro.js +15 -0
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/log.d.ts +18 -0
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/log.js +101 -0
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/note.d.ts +1 -0
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/note.js +39 -0
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/outro.d.ts +1 -0
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/outro.js +16 -0
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/spinner.d.ts +6 -0
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/spinner.js +74 -0
- package/node_modules/@poe-code/design-system/dist/prompts/theme.d.ts +11 -0
- package/node_modules/@poe-code/design-system/dist/prompts/theme.js +12 -0
- package/node_modules/@poe-code/design-system/dist/static/index.d.ts +4 -0
- package/node_modules/@poe-code/design-system/dist/static/index.js +2 -0
- package/node_modules/@poe-code/design-system/dist/static/menu.d.ts +11 -0
- package/node_modules/@poe-code/design-system/dist/static/menu.js +36 -0
- package/node_modules/@poe-code/design-system/dist/static/spinner.d.ts +14 -0
- package/node_modules/@poe-code/design-system/dist/static/spinner.js +46 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/ast.d.ts +92 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/ast.js +1 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/demo-content.d.ts +2 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/demo-content.js +139 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/index.d.ts +6 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/index.js +8 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/parser/block.d.ts +7 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/parser/block.js +1495 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/parser/frontmatter.d.ts +8 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/parser/frontmatter.js +412 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/parser/inline.d.ts +10 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/parser/inline.js +1166 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/parser.d.ts +5 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/parser.js +42 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/renderer.d.ts +6 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/renderer.js +572 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/testing/theme-render-fixture.d.ts +1 -0
- package/node_modules/@poe-code/design-system/dist/terminal-markdown/testing/theme-render-fixture.js +27 -0
- package/node_modules/@poe-code/design-system/dist/tokens/colors.d.ts +35 -0
- package/node_modules/@poe-code/design-system/dist/tokens/colors.js +34 -0
- package/node_modules/@poe-code/design-system/dist/tokens/index.d.ts +4 -0
- package/node_modules/@poe-code/design-system/dist/tokens/index.js +4 -0
- package/node_modules/@poe-code/design-system/dist/tokens/spacing.d.ts +6 -0
- package/node_modules/@poe-code/design-system/dist/tokens/spacing.js +6 -0
- package/node_modules/@poe-code/design-system/dist/tokens/typography.d.ts +7 -0
- package/node_modules/@poe-code/design-system/dist/tokens/typography.js +8 -0
- package/node_modules/@poe-code/design-system/dist/tokens/widths.d.ts +5 -0
- package/node_modules/@poe-code/design-system/dist/tokens/widths.js +5 -0
- package/node_modules/@poe-code/design-system/package.json +25 -0
- package/package.json +57 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { parseBlockDocument } from "./parser/block.js";
|
|
2
|
+
export function parse(markdown) {
|
|
3
|
+
const { frontmatter, frontmatterRange, children } = parseBlockDocument(markdown);
|
|
4
|
+
const ast = withRange({
|
|
5
|
+
type: "root",
|
|
6
|
+
children: frontmatter === undefined
|
|
7
|
+
? children
|
|
8
|
+
: [createFrontmatterNode(frontmatter, frontmatterRange), ...children]
|
|
9
|
+
}, {
|
|
10
|
+
start: 0,
|
|
11
|
+
end: Buffer.byteLength(markdown, "utf8")
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
...(frontmatter === undefined ? {} : { frontmatter }),
|
|
15
|
+
ast
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function createFrontmatterNode(data, range) {
|
|
19
|
+
const node = {
|
|
20
|
+
type: "frontmatter",
|
|
21
|
+
data
|
|
22
|
+
};
|
|
23
|
+
if (range === undefined) {
|
|
24
|
+
return node;
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(node, "range", {
|
|
27
|
+
value: range,
|
|
28
|
+
enumerable: false,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true
|
|
31
|
+
});
|
|
32
|
+
return node;
|
|
33
|
+
}
|
|
34
|
+
function withRange(node, range) {
|
|
35
|
+
Object.defineProperty(node, "range", {
|
|
36
|
+
value: range,
|
|
37
|
+
enumerable: false,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true
|
|
40
|
+
});
|
|
41
|
+
return node;
|
|
42
|
+
}
|
|
@@ -0,0 +1,572 @@
|
|
|
1
|
+
import { symbols } from "../components/symbols.js";
|
|
2
|
+
import { getTheme } from "../internal/theme-detect.js";
|
|
3
|
+
import { stripAnsi } from "../internal/strip-ansi.js";
|
|
4
|
+
import { spacing } from "../tokens/spacing.js";
|
|
5
|
+
import { typography } from "../tokens/typography.js";
|
|
6
|
+
import { widths } from "../tokens/widths.js";
|
|
7
|
+
const lineChar = "─";
|
|
8
|
+
export function render(ast, options = {}) {
|
|
9
|
+
const width = Math.max(1, options.width ?? process.stdout.columns ?? widths.maxLine);
|
|
10
|
+
const context = {
|
|
11
|
+
width,
|
|
12
|
+
showFrontmatter: options.showFrontmatter ?? false,
|
|
13
|
+
theme: getTheme(),
|
|
14
|
+
footnotes: ast.type === "root" ? createFootnoteState(ast.children) : undefined
|
|
15
|
+
};
|
|
16
|
+
return renderNode(ast, context);
|
|
17
|
+
}
|
|
18
|
+
function renderNode(node, context) {
|
|
19
|
+
switch (node.type) {
|
|
20
|
+
case "root":
|
|
21
|
+
return renderRoot(node, context);
|
|
22
|
+
case "heading":
|
|
23
|
+
return renderHeading(node, context);
|
|
24
|
+
case "paragraph":
|
|
25
|
+
return renderParagraph(node, context);
|
|
26
|
+
case "blockquote":
|
|
27
|
+
return renderBlockquote(node, context);
|
|
28
|
+
case "alert":
|
|
29
|
+
return renderAlert(node, context);
|
|
30
|
+
case "code":
|
|
31
|
+
return renderCodeBlock(node, context);
|
|
32
|
+
case "list":
|
|
33
|
+
return renderList(node, context);
|
|
34
|
+
case "table":
|
|
35
|
+
return renderTable(node, context);
|
|
36
|
+
case "html":
|
|
37
|
+
return renderHtml(node, context);
|
|
38
|
+
case "text":
|
|
39
|
+
case "strong":
|
|
40
|
+
case "emphasis":
|
|
41
|
+
case "strikethrough":
|
|
42
|
+
case "inlineCode":
|
|
43
|
+
case "link":
|
|
44
|
+
case "image":
|
|
45
|
+
case "break":
|
|
46
|
+
case "footnoteReference":
|
|
47
|
+
return renderInline([node], context).join("\n");
|
|
48
|
+
case "thematicBreak":
|
|
49
|
+
return `${context.theme.divider(lineChar.repeat(context.width))}\n\n`;
|
|
50
|
+
case "frontmatter":
|
|
51
|
+
return context.showFrontmatter ? renderFrontmatter(node.data, context) : "";
|
|
52
|
+
case "footnoteDefinition":
|
|
53
|
+
return "";
|
|
54
|
+
default:
|
|
55
|
+
return "children" in node ? renderChildren(node.children, context) : "";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function renderRoot(node, context) {
|
|
59
|
+
const mainOutput = renderChildren(node.children.filter((child) => child.type !== "footnoteDefinition"), context);
|
|
60
|
+
const footnotesOutput = renderReferencedFootnotes(context);
|
|
61
|
+
return `${mainOutput}${footnotesOutput}`;
|
|
62
|
+
}
|
|
63
|
+
function renderChildren(children, context) {
|
|
64
|
+
return children.map((child) => renderNode(child, context)).join("");
|
|
65
|
+
}
|
|
66
|
+
function renderParagraph(node, context) {
|
|
67
|
+
const lines = renderInline(node.children, context);
|
|
68
|
+
if (lines.length === 0) {
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
return `${lines.join("\n")}\n\n`;
|
|
72
|
+
}
|
|
73
|
+
function renderHeading(node, context) {
|
|
74
|
+
const lines = renderInline(node.children, context);
|
|
75
|
+
if (lines.length === 0) {
|
|
76
|
+
return "";
|
|
77
|
+
}
|
|
78
|
+
const styledLines = lines.map((line) => styleHeading(line, node.depth, context));
|
|
79
|
+
if (node.depth === 1) {
|
|
80
|
+
const underlineWidth = Math.max(...lines.map((line) => stripAnsi(line).length));
|
|
81
|
+
return `${styledLines.join("\n")}\n${context.theme.header(lineChar.repeat(underlineWidth))}\n\n`;
|
|
82
|
+
}
|
|
83
|
+
return `${styledLines.join("\n")}\n\n`;
|
|
84
|
+
}
|
|
85
|
+
function renderBlockquote(node, context) {
|
|
86
|
+
const prefix = `${symbols.bar} `;
|
|
87
|
+
const body = renderBlockChildren(node.children, reduceWidth(context, prefix));
|
|
88
|
+
if (body.length === 0) {
|
|
89
|
+
return `${symbols.bar}\n\n`;
|
|
90
|
+
}
|
|
91
|
+
const lines = body
|
|
92
|
+
.split("\n")
|
|
93
|
+
.map((line) => (line.length > 0 ? `${prefix}${typography.dim(line)}` : symbols.bar));
|
|
94
|
+
return `${lines.join("\n")}\n\n`;
|
|
95
|
+
}
|
|
96
|
+
function renderAlert(node, context) {
|
|
97
|
+
const prefix = `${symbols.bar} `;
|
|
98
|
+
const labelLine = `${prefix}${formatAlertLabel(node.kind, context)}`;
|
|
99
|
+
const body = renderBlockChildren(node.children, reduceWidth(context, prefix));
|
|
100
|
+
if (body.length === 0) {
|
|
101
|
+
return `${labelLine}\n\n`;
|
|
102
|
+
}
|
|
103
|
+
const lines = body
|
|
104
|
+
.split("\n")
|
|
105
|
+
.map((line) => (line.length > 0 ? `${prefix}${line}` : symbols.bar));
|
|
106
|
+
return `${labelLine}\n${lines.join("\n")}\n\n`;
|
|
107
|
+
}
|
|
108
|
+
function renderCodeBlock(node, context) {
|
|
109
|
+
const indent = " ".repeat(spacing.sm);
|
|
110
|
+
const lines = node.value.split("\n");
|
|
111
|
+
const longestLine = lines.reduce((max, line) => Math.max(max, line.length), 0);
|
|
112
|
+
const borderWidth = Math.max(3, Math.min(context.width - indent.length, longestLine));
|
|
113
|
+
const border = context.theme.muted(`${indent}${lineChar.repeat(borderWidth)}`);
|
|
114
|
+
const content = lines.map((line) => `${indent}${line}`).join("\n");
|
|
115
|
+
return `${border}\n${content}\n${border}\n\n`;
|
|
116
|
+
}
|
|
117
|
+
function renderList(node, context) {
|
|
118
|
+
const items = node.children
|
|
119
|
+
.map((child, index) => {
|
|
120
|
+
if (child.type !== "listItem") {
|
|
121
|
+
return renderNode(child, context).trimEnd();
|
|
122
|
+
}
|
|
123
|
+
return renderListItem(child, node, index, context);
|
|
124
|
+
})
|
|
125
|
+
.filter((item) => item.length > 0);
|
|
126
|
+
if (items.length === 0) {
|
|
127
|
+
return "";
|
|
128
|
+
}
|
|
129
|
+
return `${items.join("\n")}\n\n`;
|
|
130
|
+
}
|
|
131
|
+
function renderTable(node, context) {
|
|
132
|
+
const rows = node.children.filter((child) => child.type === "tableRow");
|
|
133
|
+
if (rows.length === 0) {
|
|
134
|
+
return "";
|
|
135
|
+
}
|
|
136
|
+
const columnCount = Math.max(node.align.length, ...rows.map((row) => row.children.length));
|
|
137
|
+
if (columnCount === 0) {
|
|
138
|
+
return "";
|
|
139
|
+
}
|
|
140
|
+
const renderedRows = rows.map((row) => Array.from({ length: columnCount }, (_, columnIndex) => {
|
|
141
|
+
const cell = row.children[columnIndex];
|
|
142
|
+
return cell?.type === "tableCell" ? renderTableCell(cell, context) : "";
|
|
143
|
+
}));
|
|
144
|
+
const columnWidths = Array.from({ length: columnCount }, (_, columnIndex) => Math.max(...renderedRows.map((row) => stripAnsi(row[columnIndex] ?? "").length), 0));
|
|
145
|
+
if (getRenderedTableWidth(columnWidths) > context.width) {
|
|
146
|
+
return renderStackedTable(rows, columnCount, context);
|
|
147
|
+
}
|
|
148
|
+
const lines = renderedRows.map((row, rowIndex) => row.map((cell, columnIndex) => alignTableCell(rowIndex === 0 ? context.theme.header(typography.bold(cell)) : cell, columnWidths[columnIndex] ?? 0, node.align[columnIndex] ?? null)));
|
|
149
|
+
const outputLines = lines.map((row, rowIndex) => {
|
|
150
|
+
const line = `${symbols.bar}${row
|
|
151
|
+
.map((cell) => `${" ".repeat(spacing.sm)}${cell}${" ".repeat(spacing.sm)}`)
|
|
152
|
+
.join(symbols.bar)}${symbols.bar}`;
|
|
153
|
+
if (rowIndex !== 0 || lines.length === 1) {
|
|
154
|
+
return line;
|
|
155
|
+
}
|
|
156
|
+
const divider = context.theme.muted(`├${columnWidths
|
|
157
|
+
.map((width) => lineChar.repeat(width + spacing.sm * 2))
|
|
158
|
+
.join("┼")}┤`);
|
|
159
|
+
return `${line}\n${divider}`;
|
|
160
|
+
});
|
|
161
|
+
return `${outputLines.join("\n")}\n\n`;
|
|
162
|
+
}
|
|
163
|
+
function renderStackedTable(rows, columnCount, context) {
|
|
164
|
+
const headerRow = rows[0];
|
|
165
|
+
if (headerRow === undefined) {
|
|
166
|
+
return "";
|
|
167
|
+
}
|
|
168
|
+
const dataRows = rows.slice(1);
|
|
169
|
+
if (dataRows.length === 0) {
|
|
170
|
+
const headerLines = Array.from({ length: columnCount }, (_, columnIndex) => tokenizeText(getStackedTableLabel(headerRow.children[columnIndex], columnIndex, context), [typography.bold])).flatMap((tokens) => wrapTokens(tokens, context.width));
|
|
171
|
+
return headerLines.length === 0 ? "" : `${headerLines.join("\n")}\n\n`;
|
|
172
|
+
}
|
|
173
|
+
const blocks = dataRows
|
|
174
|
+
.map((row) => Array.from({ length: columnCount }, (_, columnIndex) => renderStackedTableField(headerRow.children[columnIndex], row.children[columnIndex], columnIndex, context))
|
|
175
|
+
.filter((field) => field.length > 0)
|
|
176
|
+
.join("\n"))
|
|
177
|
+
.filter((block) => block.length > 0);
|
|
178
|
+
return blocks.length === 0 ? "" : `${blocks.join("\n\n")}\n\n`;
|
|
179
|
+
}
|
|
180
|
+
function renderListItem(node, list, index, context) {
|
|
181
|
+
const marker = getListMarker(node, list, index);
|
|
182
|
+
const indent = " ".repeat(spacing.sm);
|
|
183
|
+
const firstPrefix = `${indent}${marker} `;
|
|
184
|
+
const body = renderBlockChildren(node.children, reduceWidth(context, firstPrefix));
|
|
185
|
+
const continuationPrefix = `${indent}${" ".repeat(marker.length + 1)}`;
|
|
186
|
+
if (body.length === 0) {
|
|
187
|
+
return firstPrefix.trimEnd();
|
|
188
|
+
}
|
|
189
|
+
return prefixBlock(body, firstPrefix, continuationPrefix);
|
|
190
|
+
}
|
|
191
|
+
function styleHeading(value, depth, context) {
|
|
192
|
+
if (depth <= 2) {
|
|
193
|
+
return context.theme.header(typography.bold(value));
|
|
194
|
+
}
|
|
195
|
+
if (depth <= 4) {
|
|
196
|
+
return typography.bold(value);
|
|
197
|
+
}
|
|
198
|
+
return context.theme.muted(typography.bold(value));
|
|
199
|
+
}
|
|
200
|
+
function renderFrontmatter(data, context) {
|
|
201
|
+
const entries = Object.entries(data);
|
|
202
|
+
if (entries.length === 0) {
|
|
203
|
+
return "";
|
|
204
|
+
}
|
|
205
|
+
const lines = entries.flatMap(([key, value]) => wrapText(`${key}: ${formatFrontmatterValue(value)}`, context.width).map((line) => typography.dim(line)));
|
|
206
|
+
return `${lines.join("\n")}\n\n`;
|
|
207
|
+
}
|
|
208
|
+
function formatFrontmatterValue(value) {
|
|
209
|
+
if (value === null) {
|
|
210
|
+
return "null";
|
|
211
|
+
}
|
|
212
|
+
if (typeof value === "string") {
|
|
213
|
+
return value;
|
|
214
|
+
}
|
|
215
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
216
|
+
return String(value);
|
|
217
|
+
}
|
|
218
|
+
return JSON.stringify(value);
|
|
219
|
+
}
|
|
220
|
+
function renderHtml(node, context) {
|
|
221
|
+
const value = stripHtmlTags(node.value).trim();
|
|
222
|
+
if (value.length === 0) {
|
|
223
|
+
return "";
|
|
224
|
+
}
|
|
225
|
+
const lines = wrapText(value, context.width);
|
|
226
|
+
if (lines.length === 0) {
|
|
227
|
+
return "";
|
|
228
|
+
}
|
|
229
|
+
return `${lines.join("\n")}\n\n`;
|
|
230
|
+
}
|
|
231
|
+
function renderBlockChildren(children, context) {
|
|
232
|
+
const renderedChildren = children
|
|
233
|
+
.map((child) => ({
|
|
234
|
+
type: child.type,
|
|
235
|
+
value: renderNode(child, context).trimEnd()
|
|
236
|
+
}))
|
|
237
|
+
.filter((child) => child.value.length > 0);
|
|
238
|
+
if (renderedChildren.length === 0) {
|
|
239
|
+
return "";
|
|
240
|
+
}
|
|
241
|
+
let output = renderedChildren[0].value;
|
|
242
|
+
for (let index = 1; index < renderedChildren.length; index += 1) {
|
|
243
|
+
const previous = renderedChildren[index - 1];
|
|
244
|
+
const current = renderedChildren[index];
|
|
245
|
+
const separator = previous.type === "paragraph" && current.type === "list" ? "\n" : "\n\n";
|
|
246
|
+
output += `${separator}${current.value}`;
|
|
247
|
+
}
|
|
248
|
+
return output;
|
|
249
|
+
}
|
|
250
|
+
function renderReferencedFootnotes(context) {
|
|
251
|
+
const footnotes = context.footnotes;
|
|
252
|
+
if (footnotes === undefined || footnotes.labelsInOrder.length === 0) {
|
|
253
|
+
return "";
|
|
254
|
+
}
|
|
255
|
+
const rendered = [];
|
|
256
|
+
for (let index = 0; index < footnotes.labelsInOrder.length; index += 1) {
|
|
257
|
+
const label = footnotes.labelsInOrder[index];
|
|
258
|
+
const definition = footnotes.definitions.get(label);
|
|
259
|
+
const number = footnotes.numbers.get(label);
|
|
260
|
+
if (definition !== undefined && number !== undefined) {
|
|
261
|
+
rendered.push(renderFootnoteDefinition(definition, number, context));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (rendered.length === 0) {
|
|
265
|
+
return "";
|
|
266
|
+
}
|
|
267
|
+
return `${rendered.join("\n")}\n\n`;
|
|
268
|
+
}
|
|
269
|
+
function renderFootnoteDefinition(node, number, context) {
|
|
270
|
+
const marker = typography.dim(`[${number}]`);
|
|
271
|
+
const firstPrefix = `${" ".repeat(spacing.sm)}${marker} `;
|
|
272
|
+
const continuationPrefix = `${" ".repeat(spacing.sm + stripAnsi(`[${number}] `).length)}`;
|
|
273
|
+
const body = renderBlockChildren(node.children, reduceWidth(context, firstPrefix));
|
|
274
|
+
if (body.length === 0) {
|
|
275
|
+
return firstPrefix.trimEnd();
|
|
276
|
+
}
|
|
277
|
+
return prefixBlock(body, firstPrefix, continuationPrefix);
|
|
278
|
+
}
|
|
279
|
+
function getListMarker(node, list, index) {
|
|
280
|
+
if (node.checked === true) {
|
|
281
|
+
return symbols.active;
|
|
282
|
+
}
|
|
283
|
+
if (node.checked === false) {
|
|
284
|
+
return symbols.inactive;
|
|
285
|
+
}
|
|
286
|
+
if (list.ordered) {
|
|
287
|
+
return `${(list.start ?? 1) + index}.`;
|
|
288
|
+
}
|
|
289
|
+
return "•";
|
|
290
|
+
}
|
|
291
|
+
function prefixBlock(rendered, firstPrefix, restPrefix) {
|
|
292
|
+
return rendered
|
|
293
|
+
.split("\n")
|
|
294
|
+
.map((line, index) => {
|
|
295
|
+
const prefix = index === 0 ? firstPrefix : restPrefix;
|
|
296
|
+
return line.length > 0 ? `${prefix}${line}` : prefix.trimEnd();
|
|
297
|
+
})
|
|
298
|
+
.join("\n");
|
|
299
|
+
}
|
|
300
|
+
function reduceWidth(context, prefix) {
|
|
301
|
+
return {
|
|
302
|
+
...context,
|
|
303
|
+
width: Math.max(1, context.width - stripAnsi(prefix).length)
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
function renderInline(nodes, context) {
|
|
307
|
+
const tokens = tokenizeInline(nodes, context);
|
|
308
|
+
return wrapTokens(tokens, context.width);
|
|
309
|
+
}
|
|
310
|
+
function tokenizeInline(nodes, context) {
|
|
311
|
+
const tokens = [];
|
|
312
|
+
for (const node of nodes) {
|
|
313
|
+
collectInlineTokens(node, [], context, tokens);
|
|
314
|
+
}
|
|
315
|
+
return tokens;
|
|
316
|
+
}
|
|
317
|
+
function collectInlineTokens(node, formatters, context, tokens) {
|
|
318
|
+
switch (node.type) {
|
|
319
|
+
case "text":
|
|
320
|
+
tokens.push(...tokenizeText(node.value, formatters));
|
|
321
|
+
return;
|
|
322
|
+
case "strong":
|
|
323
|
+
collectChildren(node.children, [...formatters, typography.bold], context, tokens);
|
|
324
|
+
return;
|
|
325
|
+
case "emphasis":
|
|
326
|
+
collectChildren(node.children, [...formatters, typography.italic], context, tokens);
|
|
327
|
+
return;
|
|
328
|
+
case "strikethrough":
|
|
329
|
+
collectChildren(node.children, [...formatters, typography.strikethrough], context, tokens);
|
|
330
|
+
return;
|
|
331
|
+
case "inlineCode":
|
|
332
|
+
tokens.push(...tokenizeText(node.value, [...formatters, context.theme.accent]));
|
|
333
|
+
return;
|
|
334
|
+
case "link":
|
|
335
|
+
collectLinkTokens(node, formatters, context, tokens);
|
|
336
|
+
return;
|
|
337
|
+
case "image":
|
|
338
|
+
tokens.push(createWordToken(formatImagePlaceholder(node.alt), [...formatters, context.theme.muted]));
|
|
339
|
+
return;
|
|
340
|
+
case "footnoteReference": {
|
|
341
|
+
const footnoteNumber = resolveFootnoteNumber(node.label, context);
|
|
342
|
+
if (footnoteNumber !== null) {
|
|
343
|
+
tokens.push(createWordToken(`[${footnoteNumber}]`, [...formatters, typography.dim]));
|
|
344
|
+
}
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
case "html": {
|
|
348
|
+
const value = stripHtmlTags(node.value);
|
|
349
|
+
if (value.length > 0) {
|
|
350
|
+
tokens.push(...tokenizeText(value, formatters));
|
|
351
|
+
}
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
case "break":
|
|
355
|
+
tokens.push({ type: "break" });
|
|
356
|
+
return;
|
|
357
|
+
default:
|
|
358
|
+
if ("children" in node) {
|
|
359
|
+
collectChildren(node.children, formatters, context, tokens);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
function collectChildren(children, formatters, context, tokens) {
|
|
364
|
+
for (const child of children) {
|
|
365
|
+
collectInlineTokens(child, formatters, context, tokens);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
function collectLinkTokens(node, formatters, context, tokens) {
|
|
369
|
+
if (isAutolink(node)) {
|
|
370
|
+
tokens.push(createWordToken(node.url, [...formatters, context.theme.accent]));
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
const childTokens = [];
|
|
374
|
+
collectChildren(node.children, formatters, context, childTokens);
|
|
375
|
+
const trimmedChildTokens = trimTrailingSpaces(childTokens);
|
|
376
|
+
tokens.push(...trimmedChildTokens);
|
|
377
|
+
if (trimmedChildTokens.some((token) => token.type === "word")) {
|
|
378
|
+
tokens.push({ type: "space", value: " " });
|
|
379
|
+
}
|
|
380
|
+
tokens.push(createWordToken(`(${node.url})`, [...formatters, context.theme.accent]));
|
|
381
|
+
}
|
|
382
|
+
function isAutolink(node) {
|
|
383
|
+
if (node.children.length !== 1 || node.children[0]?.type !== "text") {
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
const label = node.children[0].value;
|
|
387
|
+
return (label === node.url ||
|
|
388
|
+
(node.url.startsWith("http://") && label === node.url.slice("http://".length)) ||
|
|
389
|
+
(node.url.startsWith("mailto:") && label === node.url.slice("mailto:".length)));
|
|
390
|
+
}
|
|
391
|
+
function formatImagePlaceholder(alt) {
|
|
392
|
+
return alt.length > 0 ? `[image: ${alt}]` : "[image]";
|
|
393
|
+
}
|
|
394
|
+
function createWordToken(value, formatters) {
|
|
395
|
+
return { type: "word", value, formatters };
|
|
396
|
+
}
|
|
397
|
+
function trimTrailingSpaces(tokens) {
|
|
398
|
+
let end = tokens.length;
|
|
399
|
+
while (end > 0 && tokens[end - 1]?.type === "space") {
|
|
400
|
+
end -= 1;
|
|
401
|
+
}
|
|
402
|
+
return tokens.slice(0, end);
|
|
403
|
+
}
|
|
404
|
+
function tokenizeText(value, formatters) {
|
|
405
|
+
const lines = value.split("\n");
|
|
406
|
+
return lines.flatMap((line, lineIndex) => {
|
|
407
|
+
const pieces = line
|
|
408
|
+
.split(/([ \t]+)/)
|
|
409
|
+
.filter((piece) => piece.length > 0)
|
|
410
|
+
.map((piece) => /^[ \t]+$/.test(piece) ? { type: "space", value: piece } : { type: "word", value: piece, formatters });
|
|
411
|
+
return lineIndex < lines.length - 1 ? [...pieces, { type: "break" }] : pieces;
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
function wrapTokens(tokens, width) {
|
|
415
|
+
const lines = [];
|
|
416
|
+
let currentLine = "";
|
|
417
|
+
let currentWidth = 0;
|
|
418
|
+
let pendingSpace = "";
|
|
419
|
+
const flushLine = () => {
|
|
420
|
+
lines.push(currentLine);
|
|
421
|
+
currentLine = "";
|
|
422
|
+
currentWidth = 0;
|
|
423
|
+
pendingSpace = "";
|
|
424
|
+
};
|
|
425
|
+
for (const token of tokens) {
|
|
426
|
+
if (token.type === "break") {
|
|
427
|
+
flushLine();
|
|
428
|
+
continue;
|
|
429
|
+
}
|
|
430
|
+
if (token.type === "space") {
|
|
431
|
+
if (currentWidth > 0) {
|
|
432
|
+
pendingSpace += token.value;
|
|
433
|
+
}
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
const chunks = splitWord(token.value, width);
|
|
437
|
+
for (let index = 0; index < chunks.length; index++) {
|
|
438
|
+
const chunk = chunks[index];
|
|
439
|
+
const gap = index === 0 ? pendingSpace : "";
|
|
440
|
+
const gapWidth = gap.length;
|
|
441
|
+
if (currentWidth > 0 && currentWidth + chunk.length + gapWidth > width) {
|
|
442
|
+
flushLine();
|
|
443
|
+
}
|
|
444
|
+
if (currentWidth > 0 && gapWidth > 0) {
|
|
445
|
+
currentLine += gap;
|
|
446
|
+
currentWidth += gapWidth;
|
|
447
|
+
}
|
|
448
|
+
currentLine += applyFormatters(chunk, token.formatters);
|
|
449
|
+
currentWidth += chunk.length;
|
|
450
|
+
pendingSpace = "";
|
|
451
|
+
if (index < chunks.length - 1) {
|
|
452
|
+
flushLine();
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (currentLine.length > 0) {
|
|
457
|
+
lines.push(currentLine);
|
|
458
|
+
}
|
|
459
|
+
return lines;
|
|
460
|
+
}
|
|
461
|
+
function splitWord(value, width) {
|
|
462
|
+
if (value.length <= width) {
|
|
463
|
+
return [value];
|
|
464
|
+
}
|
|
465
|
+
const chunks = [];
|
|
466
|
+
for (let index = 0; index < value.length; index += width) {
|
|
467
|
+
chunks.push(value.slice(index, index + width));
|
|
468
|
+
}
|
|
469
|
+
return chunks;
|
|
470
|
+
}
|
|
471
|
+
function applyFormatters(value, formatters) {
|
|
472
|
+
return formatters.reduce((text, formatter) => formatter(text), value);
|
|
473
|
+
}
|
|
474
|
+
function wrapText(value, width) {
|
|
475
|
+
const tokens = tokenizeText(value, []);
|
|
476
|
+
return wrapTokens(tokens, Math.max(1, width));
|
|
477
|
+
}
|
|
478
|
+
function createFootnoteState(children) {
|
|
479
|
+
return {
|
|
480
|
+
definitions: new Map(children.flatMap((child) => child.type === "footnoteDefinition" ? [[child.label, child]] : [])),
|
|
481
|
+
labelsInOrder: [],
|
|
482
|
+
numbers: new Map()
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
function resolveFootnoteNumber(label, context) {
|
|
486
|
+
const footnotes = context.footnotes;
|
|
487
|
+
if (footnotes === undefined || !footnotes.definitions.has(label)) {
|
|
488
|
+
return null;
|
|
489
|
+
}
|
|
490
|
+
const existing = footnotes.numbers.get(label);
|
|
491
|
+
if (existing !== undefined) {
|
|
492
|
+
return existing;
|
|
493
|
+
}
|
|
494
|
+
const number = footnotes.numbers.size + 1;
|
|
495
|
+
footnotes.numbers.set(label, number);
|
|
496
|
+
footnotes.labelsInOrder.push(label);
|
|
497
|
+
return number;
|
|
498
|
+
}
|
|
499
|
+
function formatAlertLabel(kind, context) {
|
|
500
|
+
switch (kind) {
|
|
501
|
+
case "NOTE":
|
|
502
|
+
return context.theme.info("Note");
|
|
503
|
+
case "TIP":
|
|
504
|
+
return context.theme.success("Tip");
|
|
505
|
+
case "IMPORTANT":
|
|
506
|
+
return context.theme.info("Important");
|
|
507
|
+
case "WARNING":
|
|
508
|
+
return context.theme.warning("Warning");
|
|
509
|
+
case "CAUTION":
|
|
510
|
+
return context.theme.error("Caution");
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
function renderTableCell(node, context) {
|
|
514
|
+
return wrapTokens(tokenizeInline(node.children, context), Number.MAX_SAFE_INTEGER).join(" ");
|
|
515
|
+
}
|
|
516
|
+
function renderStackedTableField(headerCell, cell, columnIndex, context) {
|
|
517
|
+
const tokens = [
|
|
518
|
+
...tokenizeText(getStackedTableLabel(headerCell, columnIndex, context), [typography.bold]),
|
|
519
|
+
createWordToken(":", [typography.bold]),
|
|
520
|
+
{ type: "space", value: " " },
|
|
521
|
+
...getStackedTableValueTokens(cell, context)
|
|
522
|
+
];
|
|
523
|
+
return wrapTokens(tokens, context.width).join("\n");
|
|
524
|
+
}
|
|
525
|
+
function getStackedTableLabel(headerCell, columnIndex, context) {
|
|
526
|
+
if (headerCell?.type !== "tableCell") {
|
|
527
|
+
return `Column ${columnIndex + 1}`;
|
|
528
|
+
}
|
|
529
|
+
const label = stripAnsi(renderTableCell(headerCell, context)).trim();
|
|
530
|
+
return label.length > 0 ? label : `Column ${columnIndex + 1}`;
|
|
531
|
+
}
|
|
532
|
+
function getStackedTableValueTokens(cell, context) {
|
|
533
|
+
if (cell?.type !== "tableCell") {
|
|
534
|
+
return [createWordToken("—", [context.theme.muted])];
|
|
535
|
+
}
|
|
536
|
+
const tokens = trimTrailingSpaces(tokenizeInline(cell.children, context));
|
|
537
|
+
return tokens.length > 0 ? tokens : [createWordToken("—", [context.theme.muted])];
|
|
538
|
+
}
|
|
539
|
+
function getRenderedTableWidth(columnWidths) {
|
|
540
|
+
return columnWidths.reduce((totalWidth, width) => totalWidth + width + spacing.sm * 2, columnWidths.length + 1);
|
|
541
|
+
}
|
|
542
|
+
function alignTableCell(value, width, align) {
|
|
543
|
+
const visibleWidth = stripAnsi(value).length;
|
|
544
|
+
const extraSpace = Math.max(0, width - visibleWidth);
|
|
545
|
+
if (align === "right") {
|
|
546
|
+
return `${" ".repeat(extraSpace)}${value}`;
|
|
547
|
+
}
|
|
548
|
+
if (align === "center") {
|
|
549
|
+
const leftPadding = Math.floor(extraSpace / 2);
|
|
550
|
+
const rightPadding = extraSpace - leftPadding;
|
|
551
|
+
return `${" ".repeat(leftPadding)}${value}${" ".repeat(rightPadding)}`;
|
|
552
|
+
}
|
|
553
|
+
return `${value}${" ".repeat(extraSpace)}`;
|
|
554
|
+
}
|
|
555
|
+
function stripHtmlTags(value) {
|
|
556
|
+
let output = "";
|
|
557
|
+
let inTag = false;
|
|
558
|
+
for (const char of value) {
|
|
559
|
+
if (char === "<") {
|
|
560
|
+
inTag = true;
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
if (char === ">" && inTag) {
|
|
564
|
+
inTag = false;
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
if (!inTag) {
|
|
568
|
+
output += char;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
return output;
|
|
572
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/node_modules/@poe-code/design-system/dist/terminal-markdown/testing/theme-render-fixture.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { renderMarkdown, resetThemeCache } from "../../index.js";
|
|
2
|
+
const MARKDOWN_DARK = "# Dark Theme\n\n**Bold** and *italic* with `code` and a [link](https://example.com)\n\n> [!NOTE]\n> This is a note\n\n| Col1 | Col2 |\n|------|------|\n| a | b |";
|
|
3
|
+
const MARKDOWN_LIGHT = "# Light Theme\n\n**Bold** and *italic* with `code` and a [link](https://example.com)\n\n> [!WARNING]\n> This is a warning\n\n- Item 1\n- [x] Done\n- [ ] Todo";
|
|
4
|
+
const hasAnsi = (s) => s.includes("\x1b[");
|
|
5
|
+
process.env.FORCE_COLOR = "1";
|
|
6
|
+
process.env.POE_THEME = "dark";
|
|
7
|
+
delete process.env.POE_CODE_THEME;
|
|
8
|
+
resetThemeCache();
|
|
9
|
+
const darkOutput = renderMarkdown(MARKDOWN_DARK);
|
|
10
|
+
process.stdout.write(darkOutput);
|
|
11
|
+
process.env.POE_THEME = "light";
|
|
12
|
+
resetThemeCache();
|
|
13
|
+
const lightOutput = renderMarkdown(MARKDOWN_LIGHT);
|
|
14
|
+
process.stdout.write(lightOutput);
|
|
15
|
+
if (!hasAnsi(darkOutput)) {
|
|
16
|
+
process.stderr.write("DARK_THEME_NO_ANSI\n");
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
if (!hasAnsi(lightOutput)) {
|
|
20
|
+
process.stderr.write("LIGHT_THEME_NO_ANSI\n");
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
if (darkOutput === lightOutput) {
|
|
24
|
+
process.stderr.write("THEMES_NOT_DISTINCT\n");
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
process.stdout.write("THEMES_VALIDATED\n");
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const brand = "#a200ff";
|
|
2
|
+
export declare const dark: {
|
|
3
|
+
header: (text: string) => string;
|
|
4
|
+
divider: (text: string) => string;
|
|
5
|
+
prompt: (text: string) => string;
|
|
6
|
+
number: (text: string) => string;
|
|
7
|
+
intro: (text: string) => string;
|
|
8
|
+
resolvedSymbol: string;
|
|
9
|
+
errorSymbol: string;
|
|
10
|
+
accent: (text: string) => string;
|
|
11
|
+
muted: (text: string) => string;
|
|
12
|
+
success: (text: string) => string;
|
|
13
|
+
warning: (text: string) => string;
|
|
14
|
+
error: (text: string) => string;
|
|
15
|
+
info: (text: string) => string;
|
|
16
|
+
badge: (text: string) => string;
|
|
17
|
+
};
|
|
18
|
+
export declare const light: {
|
|
19
|
+
header: (text: string) => string;
|
|
20
|
+
divider: (text: string) => string;
|
|
21
|
+
prompt: (text: string) => string;
|
|
22
|
+
number: (text: string) => string;
|
|
23
|
+
intro: (text: string) => string;
|
|
24
|
+
resolvedSymbol: string;
|
|
25
|
+
errorSymbol: string;
|
|
26
|
+
accent: (text: string) => string;
|
|
27
|
+
muted: (text: string) => string;
|
|
28
|
+
success: (text: string) => string;
|
|
29
|
+
warning: (text: string) => string;
|
|
30
|
+
error: (text: string) => string;
|
|
31
|
+
info: (text: string) => string;
|
|
32
|
+
badge: (text: string) => string;
|
|
33
|
+
};
|
|
34
|
+
export type ThemeName = "dark" | "light";
|
|
35
|
+
export type ThemePalette = typeof dark;
|