mdx-artifacts 0.1.2 → 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/README.md +211 -59
- package/README.zh-CN.md +299 -42
- package/agents/AGENTS.snippet.md +21 -10
- package/artifact-docs/examples/commentable-feedback.mdx +76 -70
- package/artifact-docs/examples/decision-matrix.mdx +122 -50
- package/artifact-docs/examples/layout-composition.mdx +106 -128
- package/artifact-docs/examples/streamlit-style-mixed.mdx +100 -85
- package/dist/lib/cli/{build.js → commands/build.js} +2 -2
- package/dist/lib/cli/{components.js → commands/components.js} +19 -3
- package/dist/lib/cli/{dev.js → commands/dev.js} +2 -2
- package/dist/lib/cli/commands/interactions.d.ts +2 -0
- package/dist/lib/cli/commands/interactions.js +280 -0
- package/dist/lib/cli/commands/review.d.ts +1 -0
- package/dist/lib/cli/commands/review.js +171 -0
- package/dist/lib/cli/commands/scaffold.d.ts +16 -0
- package/dist/lib/cli/commands/scaffold.js +440 -0
- package/dist/lib/cli/commands/validate.d.ts +18 -0
- package/dist/lib/cli/commands/validate.js +311 -0
- package/dist/lib/cli/config/config.d.ts +2 -0
- package/dist/lib/cli/{config.js → config/config.js} +3 -2
- package/dist/lib/cli/{types.d.ts → config/types.d.ts} +2 -1
- package/dist/lib/cli/{vite-artifact.d.ts → dev-server/vite-artifact.d.ts} +3 -3
- package/dist/lib/cli/{vite-artifact.js → dev-server/vite-artifact.js} +170 -10
- package/dist/lib/cli/diagnostics/diagnostics.d.ts +11 -0
- package/dist/lib/cli/diagnostics/diagnostics.js +1 -0
- package/dist/lib/cli/index.js +39 -18
- package/dist/lib/cli/mdx/sortable-list.d.ts +14 -0
- package/dist/lib/cli/mdx/sortable-list.js +520 -0
- package/dist/lib/cli/resources/resource-policy.d.ts +15 -0
- package/dist/lib/cli/resources/resource-policy.js +46 -0
- package/dist/lib/cli/resources/safe-path.d.ts +13 -0
- package/dist/lib/cli/resources/safe-path.js +55 -0
- package/dist/lib/cli/services/interaction-service.d.ts +40 -0
- package/dist/lib/cli/services/interaction-service.js +226 -0
- package/dist/lib/cli/services/review.d.ts +43 -0
- package/dist/lib/cli/{review.js → services/review.js} +34 -172
- package/dist/lib/react/{components → composites/comparison-set}/ComparisonSet.d.ts +1 -1
- package/dist/lib/react/{components → composites/comparison-set}/ComparisonSet.js +3 -3
- package/dist/lib/react/composites/comparison-set/index.d.ts +2 -0
- package/dist/lib/react/composites/comparison-set/index.js +1 -0
- package/dist/lib/react/composites/content-set/ContentItem.d.ts +37 -0
- package/dist/lib/react/composites/content-set/ContentItem.js +49 -0
- package/dist/lib/react/composites/content-set/index.d.ts +2 -0
- package/dist/lib/react/composites/content-set/index.js +1 -0
- package/dist/lib/react/{components → composites/export-panel}/ExportPanel.js +2 -2
- package/dist/lib/react/composites/export-panel/index.d.ts +2 -0
- package/dist/lib/react/composites/export-panel/index.js +1 -0
- package/dist/lib/react/{components → composites/section}/Section.js +1 -1
- package/dist/lib/react/composites/section/index.d.ts +2 -0
- package/dist/lib/react/composites/section/index.js +1 -0
- package/dist/lib/react/index.d.ts +36 -31
- package/dist/lib/react/index.js +18 -15
- package/dist/lib/react/interactions/artifact-state/index.d.ts +1 -0
- package/dist/lib/react/interactions/artifact-state/index.js +1 -0
- package/dist/lib/react/{components → interactions/comments}/Comments.d.ts +2 -2
- package/dist/lib/react/{components → interactions/comments}/Comments.js +3 -3
- package/dist/lib/react/interactions/comments/index.d.ts +1 -0
- package/dist/lib/react/interactions/comments/index.js +1 -0
- package/dist/lib/react/interactions/sortable-list/SortableList.d.ts +29 -0
- package/dist/lib/react/interactions/sortable-list/SortableList.js +282 -0
- package/dist/lib/react/interactions/sortable-list/index.d.ts +1 -0
- package/dist/lib/react/interactions/sortable-list/index.js +1 -0
- package/dist/lib/react/layout/layout-primitives/index.d.ts +2 -0
- package/dist/lib/react/layout/layout-primitives/index.js +1 -0
- package/dist/lib/react/legacy/LegacyContentComponents.d.ts +65 -0
- package/dist/lib/react/legacy/LegacyContentComponents.js +26 -0
- package/dist/lib/react/mdx-components.d.ts +5 -0
- package/dist/lib/react/mdx-components.js +38 -0
- package/dist/lib/react/{components → primitives/annotated-code}/AnnotatedCode.d.ts +1 -1
- package/dist/lib/react/{components → primitives/annotated-code}/AnnotatedCode.js +5 -5
- package/dist/lib/react/primitives/annotated-code/index.d.ts +2 -0
- package/dist/lib/react/primitives/annotated-code/index.js +1 -0
- package/dist/lib/react/primitives/callout/Callout.d.ts +11 -0
- package/dist/lib/react/{components → primitives/callout}/Callout.js +9 -6
- package/dist/lib/react/primitives/callout/index.d.ts +2 -0
- package/dist/lib/react/primitives/callout/index.js +1 -0
- package/dist/lib/react/primitives/code-block/CodeBlock.d.ts +20 -0
- package/dist/lib/react/primitives/code-block/CodeBlock.js +32 -0
- package/dist/lib/react/primitives/code-block/index.d.ts +2 -0
- package/dist/lib/react/primitives/code-block/index.js +1 -0
- package/dist/lib/react/primitives/code-surface/CodeSurface.d.ts +11 -0
- package/dist/lib/react/primitives/code-surface/CodeSurface.js +34 -0
- package/dist/lib/react/primitives/code-surface/index.d.ts +2 -0
- package/dist/lib/react/primitives/code-surface/index.js +1 -0
- package/dist/lib/react/primitives/diff-block/DiffBlock.js +25 -0
- package/dist/lib/react/primitives/diff-block/index.d.ts +2 -0
- package/dist/lib/react/primitives/diff-block/index.js +1 -0
- package/dist/lib/react/{components → primitives/inline-text}/InlineText.d.ts +4 -2
- package/dist/lib/react/primitives/inline-text/InlineText.js +28 -0
- package/dist/lib/react/primitives/inline-text/index.d.ts +2 -0
- package/dist/lib/react/primitives/inline-text/index.js +1 -0
- package/dist/lib/react/primitives/markdown-body/MarkdownBody.d.ts +9 -0
- package/dist/lib/react/primitives/markdown-body/MarkdownBody.js +49 -0
- package/dist/lib/react/primitives/markdown-body/index.d.ts +2 -0
- package/dist/lib/react/primitives/markdown-body/index.js +1 -0
- package/dist/lib/react/primitives/severity-badge/index.d.ts +2 -0
- package/dist/lib/react/primitives/severity-badge/index.js +1 -0
- package/dist/lib/react/registry.d.ts +10 -0
- package/dist/lib/react/registry.js +505 -210
- package/dist/lib/react/styles.css +490 -38
- package/docs/cli-structure.md +141 -0
- package/docs/component-protocol.md +199 -33
- package/docs/component-taxonomy.md +40 -4
- package/docs/design.md +42 -21
- package/docs/design.zh-CN.md +41 -21
- package/docs/naming.md +17 -7
- package/docs/releasing.md +132 -0
- package/docs/testing.md +35 -10
- package/package.json +9 -7
- package/dist/lib/cli/config.d.ts +0 -2
- package/dist/lib/cli/review.d.ts +0 -33
- package/dist/lib/cli/scaffold.d.ts +0 -1
- package/dist/lib/cli/scaffold.js +0 -56
- package/dist/lib/cli/validate.d.ts +0 -6
- package/dist/lib/cli/validate.js +0 -79
- package/dist/lib/react/components/Callout.d.ts +0 -9
- package/dist/lib/react/components/CodeBlock.d.ts +0 -10
- package/dist/lib/react/components/CodeBlock.js +0 -28
- package/dist/lib/react/components/DecisionMatrix.d.ts +0 -16
- package/dist/lib/react/components/DecisionMatrix.js +0 -27
- package/dist/lib/react/components/DiffBlock.js +0 -24
- package/dist/lib/react/components/InlineText.js +0 -18
- package/dist/lib/react/components/MarkdownBody.d.ts +0 -7
- package/dist/lib/react/components/MarkdownBody.js +0 -36
- package/dist/lib/react/components/OptionGrid.d.ts +0 -13
- package/dist/lib/react/components/OptionGrid.js +0 -21
- /package/dist/lib/cli/{build.d.ts → commands/build.d.ts} +0 -0
- /package/dist/lib/cli/{components.d.ts → commands/components.d.ts} +0 -0
- /package/dist/lib/cli/{dev.d.ts → commands/dev.d.ts} +0 -0
- /package/dist/lib/cli/{types.js → config/types.js} +0 -0
- /package/dist/lib/cli/{artifact-state.d.ts → state/artifact-state.d.ts} +0 -0
- /package/dist/lib/cli/{artifact-state.js → state/artifact-state.js} +0 -0
- /package/dist/lib/react/{components → composites/export-panel}/ExportPanel.d.ts +0 -0
- /package/dist/lib/react/{components → composites/section}/Section.d.ts +0 -0
- /package/dist/lib/react/{components → interactions/artifact-state}/ArtifactState.d.ts +0 -0
- /package/dist/lib/react/{components → interactions/artifact-state}/ArtifactState.js +0 -0
- /package/dist/lib/react/{components → layout/layout-primitives}/Layout.d.ts +0 -0
- /package/dist/lib/react/{components → layout/layout-primitives}/Layout.js +0 -0
- /package/dist/lib/react/{components → primitives/diff-block}/DiffBlock.d.ts +0 -0
- /package/dist/lib/react/{components → primitives/severity-badge}/SeverityBadge.d.ts +0 -0
- /package/dist/lib/react/{components → primitives/severity-badge}/SeverityBadge.js +0 -0
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CommentTarget } from "./Comments.js";
|
|
3
|
-
export function CodeBlock({ id, code, language, filename, showLineNumbers = false, highlightLines = [], className }) {
|
|
4
|
-
const lines = splitCodeLines(code);
|
|
5
|
-
const highlighted = new Set(highlightLines);
|
|
6
|
-
const title = filename ?? (language ? `${language} code block` : "Code block");
|
|
7
|
-
const targetId = id ?? `code:${slugify(filename ?? language ?? code)}`;
|
|
8
|
-
return (_jsx(CommentTarget, { className: classNames("ak-comment-target-section", className), description: "CodeBlock component", targetId: targetId, title: title, children: _jsxs("figure", { className: "ak-code-block", children: [(filename || language) && (_jsxs("figcaption", { className: "ak-code-header", children: [filename && _jsx("span", { className: "ak-code-filename", children: filename }), language && _jsx("span", { className: "ak-code-language", children: language })] })), _jsx("pre", { className: "ak-code-pre", children: _jsx("code", { className: language ? `language-${language}` : undefined, children: lines.map((line, index) => {
|
|
9
|
-
const lineNumber = index + 1;
|
|
10
|
-
return (_jsxs("span", { className: classNames("ak-code-line", showLineNumbers ? "ak-code-line-numbered" : undefined, highlighted.has(lineNumber) ? "ak-code-line-highlighted" : undefined), "data-line": lineNumber, children: [showLineNumbers && _jsx("span", { className: "ak-code-line-number", children: lineNumber }), _jsx("span", { className: "ak-code-line-content", children: line || "\u00a0" })] }, lineNumber));
|
|
11
|
-
}) }) })] }) }));
|
|
12
|
-
}
|
|
13
|
-
function splitCodeLines(code) {
|
|
14
|
-
const normalized = code.endsWith("\n") ? code.slice(0, -1) : code;
|
|
15
|
-
return normalized.split("\n");
|
|
16
|
-
}
|
|
17
|
-
function classNames(...values) {
|
|
18
|
-
return values.filter(Boolean).join(" ");
|
|
19
|
-
}
|
|
20
|
-
function slugify(value) {
|
|
21
|
-
const slug = value
|
|
22
|
-
.toLowerCase()
|
|
23
|
-
.replace(/[`*_~[\]()]/g, "")
|
|
24
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
25
|
-
.replace(/^-+|-+$/g, "")
|
|
26
|
-
.slice(0, 64);
|
|
27
|
-
return slug || "item";
|
|
28
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export type DecisionMatrixOption = {
|
|
2
|
-
id?: string;
|
|
3
|
-
name: string;
|
|
4
|
-
summary?: string;
|
|
5
|
-
pros?: string[];
|
|
6
|
-
cons?: string[];
|
|
7
|
-
risks?: string[];
|
|
8
|
-
confidence?: "low" | "medium" | "high";
|
|
9
|
-
verdict?: string;
|
|
10
|
-
};
|
|
11
|
-
export type DecisionMatrixProps = {
|
|
12
|
-
id?: string;
|
|
13
|
-
question: string;
|
|
14
|
-
options: DecisionMatrixOption[];
|
|
15
|
-
};
|
|
16
|
-
export declare function DecisionMatrix({ id, question, options }: DecisionMatrixProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CommentTarget } from "./Comments.js";
|
|
3
|
-
import { InlineText } from "./InlineText.js";
|
|
4
|
-
export function DecisionMatrix({ id, question, options }) {
|
|
5
|
-
const targetId = id ?? `decision:${slugify(question)}`;
|
|
6
|
-
return (_jsx(CommentTarget, { className: "ak-comment-target-section", description: "DecisionMatrix component", targetId: targetId, title: question, children: _jsxs("section", { className: "ak-section ak-decision-matrix", children: [_jsxs("div", { className: "ak-section-header", children: [_jsx("p", { className: "ak-eyebrow", children: "Decision Matrix" }), _jsx(InlineText, { as: "h2", text: question, variant: "title" })] }), _jsx("div", { className: "ak-decision-grid", children: options.map((option, index) => {
|
|
7
|
-
const optionTargetId = id
|
|
8
|
-
? `${id}.${option.id ?? `${index + 1}`}`
|
|
9
|
-
: `decision:${slugify(question)}:${index + 1}:${slugify(option.name)}`;
|
|
10
|
-
return (_jsx(CommentTarget, { className: "ak-comment-target-card", description: `DecisionMatrix option in ${question}`, targetId: optionTargetId, title: option.name, children: _jsxs("article", { className: "ak-card", children: [_jsxs("div", { className: "ak-card-header", children: [_jsx(InlineText, { as: "h3", text: option.name, variant: "subtitle" }), option.confidence ? (_jsx("span", { className: `ak-badge ak-badge-${option.confidence}`, children: option.confidence })) : null] }), option.summary ? _jsx(InlineText, { as: "p", className: "ak-muted", text: option.summary }) : null, _jsx(ListBlock, { title: "Pros", items: option.pros }), _jsx(ListBlock, { title: "Cons", items: option.cons }), _jsx(ListBlock, { title: "Risks", items: option.risks }), option.verdict ? _jsx(InlineText, { as: "p", className: "ak-verdict", text: option.verdict }) : null] }) }, option.name));
|
|
11
|
-
}) })] }) }));
|
|
12
|
-
}
|
|
13
|
-
function ListBlock({ title, items }) {
|
|
14
|
-
if (!items?.length) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
return (_jsxs("div", { className: "ak-list-block", children: [_jsx("h4", { children: title }), _jsx("ul", { children: items.map((item) => (_jsx("li", { children: _jsx(InlineText, { text: item }) }, item))) })] }));
|
|
18
|
-
}
|
|
19
|
-
function slugify(value) {
|
|
20
|
-
const slug = value
|
|
21
|
-
.toLowerCase()
|
|
22
|
-
.replace(/[`*_~[\]()]/g, "")
|
|
23
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
24
|
-
.replace(/^-+|-+$/g, "")
|
|
25
|
-
.slice(0, 64);
|
|
26
|
-
return slug || "item";
|
|
27
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CommentTarget } from "./Comments.js";
|
|
3
|
-
const markers = {
|
|
4
|
-
add: "+",
|
|
5
|
-
remove: "-",
|
|
6
|
-
context: " "
|
|
7
|
-
};
|
|
8
|
-
export function DiffBlock({ id, lines, filename, language, className }) {
|
|
9
|
-
const title = filename ?? (language ? `${language} diff block` : "Diff block");
|
|
10
|
-
const targetId = id ?? `diff:${slugify(filename ?? language ?? lines.map((line) => line.content).join("-"))}`;
|
|
11
|
-
return (_jsx(CommentTarget, { className: classNames("ak-comment-target-section", className), description: "DiffBlock component", targetId: targetId, title: title, children: _jsxs("figure", { className: "ak-code-block ak-diff-block", children: [(filename || language) && (_jsxs("figcaption", { className: "ak-code-header", children: [filename && _jsx("span", { className: "ak-code-filename", children: filename }), language && _jsx("span", { className: "ak-code-language", children: language })] })), _jsx("pre", { className: "ak-code-pre", children: _jsx("code", { className: language ? `language-${language}` : undefined, children: lines.map((line, index) => (_jsxs("span", { className: classNames("ak-diff-line", `ak-diff-line-${line.type}`), children: [_jsx("span", { className: "ak-diff-line-number", children: line.newLine ?? line.oldLine ?? "" }), _jsx("span", { className: "ak-diff-marker", children: markers[line.type] }), _jsx("span", { className: "ak-diff-line-content", children: line.content || "\u00a0" })] }, `${line.type}-${index}`))) }) })] }) }));
|
|
12
|
-
}
|
|
13
|
-
function classNames(...values) {
|
|
14
|
-
return values.filter(Boolean).join(" ");
|
|
15
|
-
}
|
|
16
|
-
function slugify(value) {
|
|
17
|
-
const slug = value
|
|
18
|
-
.toLowerCase()
|
|
19
|
-
.replace(/[`*_~[\]()]/g, "")
|
|
20
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
21
|
-
.replace(/^-+|-+$/g, "")
|
|
22
|
-
.slice(0, 64);
|
|
23
|
-
return slug || "item";
|
|
24
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import ReactMarkdown from "react-markdown";
|
|
3
|
-
import remarkGfm from "remark-gfm";
|
|
4
|
-
const inlineAllowedElements = ["p", "strong", "em", "del", "code", "a", "br"];
|
|
5
|
-
const inlineComponents = {
|
|
6
|
-
p({ children }) {
|
|
7
|
-
return _jsx(_Fragment, { children: children });
|
|
8
|
-
},
|
|
9
|
-
a({ children, href }) {
|
|
10
|
-
return (_jsx("a", { href: href, rel: "noreferrer", target: "_blank", children: children }));
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
export function InlineText({ text, as: Component = "span", variant = "default", className }) {
|
|
14
|
-
return (_jsx(Component, { className: classNames("ak-inline-text", `ak-inline-text--${variant}`, className), children: _jsx(ReactMarkdown, { allowedElements: inlineAllowedElements, components: inlineComponents, remarkPlugins: [remarkGfm], skipHtml: true, unwrapDisallowed: true, children: text }) }));
|
|
15
|
-
}
|
|
16
|
-
function classNames(...values) {
|
|
17
|
-
return values.filter(Boolean).join(" ");
|
|
18
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type MarkdownBodyVariant = "default" | "compact";
|
|
2
|
-
export type MarkdownBodyProps = {
|
|
3
|
-
body: string;
|
|
4
|
-
variant?: MarkdownBodyVariant;
|
|
5
|
-
className?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function MarkdownBody({ body, variant, className }: MarkdownBodyProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import ReactMarkdown from "react-markdown";
|
|
3
|
-
import remarkGfm from "remark-gfm";
|
|
4
|
-
const blockAllowedElements = [
|
|
5
|
-
"p",
|
|
6
|
-
"h1",
|
|
7
|
-
"h2",
|
|
8
|
-
"h3",
|
|
9
|
-
"h4",
|
|
10
|
-
"h5",
|
|
11
|
-
"h6",
|
|
12
|
-
"strong",
|
|
13
|
-
"em",
|
|
14
|
-
"del",
|
|
15
|
-
"code",
|
|
16
|
-
"a",
|
|
17
|
-
"br",
|
|
18
|
-
"ul",
|
|
19
|
-
"ol",
|
|
20
|
-
"li",
|
|
21
|
-
"blockquote"
|
|
22
|
-
];
|
|
23
|
-
const blockComponents = {
|
|
24
|
-
a({ children, href }) {
|
|
25
|
-
return (_jsx("a", { href: href, rel: "noreferrer", target: "_blank", children: children }));
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
export function MarkdownBody({ body, variant = "default", className }) {
|
|
29
|
-
if (!body.trim()) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
return (_jsx("div", { className: classNames("ak-markdown-body", `ak-markdown-body--${variant}`, className), children: _jsx(ReactMarkdown, { allowedElements: blockAllowedElements, components: blockComponents, remarkPlugins: [remarkGfm], skipHtml: true, unwrapDisallowed: true, children: body }) }));
|
|
33
|
-
}
|
|
34
|
-
function classNames(...values) {
|
|
35
|
-
return values.filter(Boolean).join(" ");
|
|
36
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type OptionGridItem = {
|
|
2
|
-
id?: string;
|
|
3
|
-
name: string;
|
|
4
|
-
intent?: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
tradeoffs?: string[];
|
|
7
|
-
};
|
|
8
|
-
export type OptionGridProps = {
|
|
9
|
-
id?: string;
|
|
10
|
-
title: string;
|
|
11
|
-
options: OptionGridItem[];
|
|
12
|
-
};
|
|
13
|
-
export declare function OptionGrid({ id, title, options }: OptionGridProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CommentTarget } from "./Comments.js";
|
|
3
|
-
import { InlineText } from "./InlineText.js";
|
|
4
|
-
export function OptionGrid({ id, title, options }) {
|
|
5
|
-
const targetId = id ?? `option:${slugify(title)}`;
|
|
6
|
-
return (_jsx(CommentTarget, { className: "ak-comment-target-section", description: "OptionGrid component", targetId: targetId, title: title, children: _jsxs("section", { className: "ak-section", children: [_jsxs("div", { className: "ak-section-header", children: [_jsx("p", { className: "ak-eyebrow", children: "Option Grid" }), _jsx(InlineText, { as: "h2", text: title, variant: "title" })] }), _jsx("div", { className: "ak-option-grid", children: options.map((option, index) => {
|
|
7
|
-
const optionTargetId = id
|
|
8
|
-
? `${id}.${option.id ?? `${index + 1}`}`
|
|
9
|
-
: `option:${slugify(title)}:${index + 1}:${slugify(option.name)}`;
|
|
10
|
-
return (_jsx(CommentTarget, { className: "ak-comment-target-card", description: `OptionGrid item in ${title}`, targetId: optionTargetId, title: option.name, children: _jsxs("article", { className: "ak-card", children: [_jsx(InlineText, { as: "h3", text: option.name, variant: "subtitle" }), option.intent ? _jsx(InlineText, { as: "p", className: "ak-intent", text: option.intent }) : null, option.description ? _jsx(InlineText, { as: "p", text: option.description }) : null, option.tradeoffs?.length ? (_jsx("ul", { children: option.tradeoffs.map((tradeoff) => (_jsx("li", { children: _jsx(InlineText, { text: tradeoff }) }, tradeoff))) })) : null] }) }, option.name));
|
|
11
|
-
}) })] }) }));
|
|
12
|
-
}
|
|
13
|
-
function slugify(value) {
|
|
14
|
-
const slug = value
|
|
15
|
-
.toLowerCase()
|
|
16
|
-
.replace(/[`*_~[\]()]/g, "")
|
|
17
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
18
|
-
.replace(/^-+|-+$/g, "")
|
|
19
|
-
.slice(0, 64);
|
|
20
|
-
return slug || "item";
|
|
21
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|