@suzumiyaaoba/mdxr 0.1.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/LICENSE +21 -0
- package/README.md +56 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +2902 -0
- package/dist/components.d.mts +791 -0
- package/dist/components.mjs +2 -0
- package/dist/config-SI9IyFiC.mjs +184 -0
- package/dist/doc-context-CEqzMYKv.d.mts +568 -0
- package/dist/index.d.mts +20 -0
- package/dist/index.mjs +4 -0
- package/dist/ui-GKFD0mx5.mjs +15986 -0
- package/package.json +131 -0
- package/skill/SKILL.md +49 -0
- package/skill/references/components/charts.md +172 -0
- package/skill/references/components/document.md +98 -0
- package/skill/references/components/forms.md +35 -0
- package/skill/references/components/investigation.md +198 -0
- package/skill/references/components/layout.md +68 -0
- package/skill/references/components/output.md +158 -0
- package/skill/references/components/planning.md +155 -0
- package/skill/references/components/reports.md +252 -0
- package/skill/references/components/shadcn.md +19 -0
- package/skill/references/components.md +186 -0
- package/skill/references/extending.md +48 -0
- package/src/ask-sheet.ts +40 -0
- package/src/assets/css.ts +392 -0
- package/src/assets/scripts.ts +78 -0
- package/src/catalog.ts +287 -0
- package/src/cli.ts +178 -0
- package/src/client/doc-events.ts +1108 -0
- package/src/client/entry.ts +27 -0
- package/src/client-js.ts +47 -0
- package/src/component-map.ts +47 -0
- package/src/components/ui/accordion.tsx +77 -0
- package/src/components/ui/alert-dialog.tsx +185 -0
- package/src/components/ui/alert.tsx +76 -0
- package/src/components/ui/aspect-ratio.tsx +22 -0
- package/src/components/ui/attachment.tsx +208 -0
- package/src/components/ui/avatar.tsx +106 -0
- package/src/components/ui/badge.tsx +52 -0
- package/src/components/ui/breadcrumb.tsx +121 -0
- package/src/components/ui/bubble.tsx +128 -0
- package/src/components/ui/button-group.tsx +88 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/calendar.tsx +226 -0
- package/src/components/ui/card.tsx +102 -0
- package/src/components/ui/carousel.tsx +246 -0
- package/src/components/ui/chart.tsx +379 -0
- package/src/components/ui/checkbox.tsx +27 -0
- package/src/components/ui/collapsible.tsx +19 -0
- package/src/components/ui/combobox.tsx +298 -0
- package/src/components/ui/command.tsx +193 -0
- package/src/components/ui/context-menu.tsx +271 -0
- package/src/components/ui/dialog.tsx +159 -0
- package/src/components/ui/direction.tsx +4 -0
- package/src/components/ui/drawer.tsx +227 -0
- package/src/components/ui/dropdown-menu.tsx +269 -0
- package/src/components/ui/empty.tsx +104 -0
- package/src/components/ui/field.tsx +237 -0
- package/src/components/ui/fieldset.tsx +32 -0
- package/src/components/ui/frame.tsx +87 -0
- package/src/components/ui/hover-card.tsx +50 -0
- package/src/components/ui/input-group.tsx +159 -0
- package/src/components/ui/input-otp.tsx +83 -0
- package/src/components/ui/input.tsx +19 -0
- package/src/components/ui/item.tsx +202 -0
- package/src/components/ui/kbd.tsx +26 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/marker.tsx +71 -0
- package/src/components/ui/menubar.tsx +284 -0
- package/src/components/ui/message-scroller.tsx +128 -0
- package/src/components/ui/message.tsx +91 -0
- package/src/components/ui/meter.tsx +80 -0
- package/src/components/ui/native-select.tsx +64 -0
- package/src/components/ui/navigation-menu.tsx +170 -0
- package/src/components/ui/pagination.tsx +133 -0
- package/src/components/ui/popover.tsx +87 -0
- package/src/components/ui/progress.tsx +82 -0
- package/src/components/ui/questionnaire.tsx +328 -0
- package/src/components/ui/radio-group.tsx +35 -0
- package/src/components/ui/resizable.tsx +49 -0
- package/src/components/ui/scroll-area.tsx +50 -0
- package/src/components/ui/select.tsx +201 -0
- package/src/components/ui/separator.tsx +22 -0
- package/src/components/ui/sheet.tsx +135 -0
- package/src/components/ui/sidebar.tsx +730 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/slider.tsx +51 -0
- package/src/components/ui/spinner.tsx +16 -0
- package/src/components/ui/switch.tsx +31 -0
- package/src/components/ui/table.tsx +113 -0
- package/src/components/ui/tabs.tsx +82 -0
- package/src/components/ui/textarea.tsx +17 -0
- package/src/components/ui/toast.tsx +229 -0
- package/src/components/ui/toggle-group.tsx +87 -0
- package/src/components/ui/toggle.tsx +43 -0
- package/src/components/ui/tooltip.tsx +65 -0
- package/src/components.ts +78 -0
- package/src/config.ts +56 -0
- package/src/define.ts +122 -0
- package/src/doc-context.ts +20 -0
- package/src/editor.ts +94 -0
- package/src/format-error.ts +78 -0
- package/src/guards.ts +84 -0
- package/src/hooks/use-mobile.ts +21 -0
- package/src/html.ts +91 -0
- package/src/hydrate/export-index.ts +232 -0
- package/src/hydrate/import-scan.ts +169 -0
- package/src/hydrate/plugins.ts +118 -0
- package/src/hydrate/runtime-module.ts +145 -0
- package/src/hydrate-runtime.ts +67 -0
- package/src/hydrate.ts +147 -0
- package/src/index.ts +16 -0
- package/src/init.ts +57 -0
- package/src/langs.ts +148 -0
- package/src/lines.ts +53 -0
- package/src/load-user-module.ts +191 -0
- package/src/mdx.ts +248 -0
- package/src/paths.ts +36 -0
- package/src/rehype/shiki.ts +533 -0
- package/src/remark/alerts.ts +53 -0
- package/src/remark/ast.ts +96 -0
- package/src/remark/callouts.ts +25 -0
- package/src/remark/code-file.ts +85 -0
- package/src/remark/code-meta.ts +21 -0
- package/src/remark/directives.ts +170 -0
- package/src/remark/file-paths.ts +64 -0
- package/src/remark/headings.ts +131 -0
- package/src/remark/no-js.ts +40 -0
- package/src/render.ts +337 -0
- package/src/serve.ts +322 -0
- package/src/styles/globals.css +134 -0
- package/src/styles/shadcn.css +641 -0
- package/src/tailwind.ts +119 -0
- package/src/ui/approvals.tsx +76 -0
- package/src/ui/ask-question.tsx +386 -0
- package/src/ui/ask.tsx +206 -0
- package/src/ui/attrs.ts +51 -0
- package/src/ui/audit.tsx +139 -0
- package/src/ui/bar-chart.tsx +334 -0
- package/src/ui/benchmarks.tsx +143 -0
- package/src/ui/bits.tsx +537 -0
- package/src/ui/board.tsx +173 -0
- package/src/ui/bridge.tsx +207 -0
- package/src/ui/bumps.tsx +178 -0
- package/src/ui/callout.tsx +106 -0
- package/src/ui/changes.tsx +89 -0
- package/src/ui/chart-bits.tsx +52 -0
- package/src/ui/chart.ts +577 -0
- package/src/ui/checks.tsx +203 -0
- package/src/ui/child-index.tsx +44 -0
- package/src/ui/children.ts +43 -0
- package/src/ui/chips.tsx +49 -0
- package/src/ui/cmd.tsx +27 -0
- package/src/ui/columns.tsx +31 -0
- package/src/ui/comments.tsx +544 -0
- package/src/ui/compare.tsx +67 -0
- package/src/ui/decision.tsx +79 -0
- package/src/ui/deps.tsx +78 -0
- package/src/ui/details.tsx +43 -0
- package/src/ui/diff-parse.ts +307 -0
- package/src/ui/diff.tsx +458 -0
- package/src/ui/diffstat.tsx +58 -0
- package/src/ui/due.tsx +65 -0
- package/src/ui/effort.tsx +29 -0
- package/src/ui/endpoints.tsx +118 -0
- package/src/ui/envvars.tsx +96 -0
- package/src/ui/figure.tsx +37 -0
- package/src/ui/file-icon.ts +1020 -0
- package/src/ui/file-link.ts +32 -0
- package/src/ui/file-ref.tsx +39 -0
- package/src/ui/files.tsx +112 -0
- package/src/ui/findings.tsx +85 -0
- package/src/ui/flow.tsx +73 -0
- package/src/ui/funnel.tsx +121 -0
- package/src/ui/gantt.tsx +443 -0
- package/src/ui/gauges.tsx +135 -0
- package/src/ui/glossary.tsx +29 -0
- package/src/ui/graph-layout.ts +149 -0
- package/src/ui/graph-specs.tsx +102 -0
- package/src/ui/graph.tsx +278 -0
- package/src/ui/grid.tsx +119 -0
- package/src/ui/hypothesis.tsx +94 -0
- package/src/ui/icon.tsx +80 -0
- package/src/ui/incident.tsx +130 -0
- package/src/ui/index.ts +342 -0
- package/src/ui/ins-del.tsx +41 -0
- package/src/ui/json.tsx +190 -0
- package/src/ui/layout.ts +9 -0
- package/src/ui/line-chart.tsx +251 -0
- package/src/ui/matrix.tsx +208 -0
- package/src/ui/meta.tsx +73 -0
- package/src/ui/option.tsx +64 -0
- package/src/ui/owner.tsx +40 -0
- package/src/ui/packages.tsx +104 -0
- package/src/ui/pathway.tsx +96 -0
- package/src/ui/phase.tsx +41 -0
- package/src/ui/pie-chart.tsx +170 -0
- package/src/ui/plan.tsx +77 -0
- package/src/ui/pre.tsx +175 -0
- package/src/ui/priority.tsx +51 -0
- package/src/ui/props.tsx +77 -0
- package/src/ui/quadrant.tsx +172 -0
- package/src/ui/radar.tsx +200 -0
- package/src/ui/ref.tsx +160 -0
- package/src/ui/release.tsx +178 -0
- package/src/ui/req.tsx +42 -0
- package/src/ui/review.tsx +133 -0
- package/src/ui/risk.tsx +67 -0
- package/src/ui/sankey.tsx +287 -0
- package/src/ui/scatter.tsx +237 -0
- package/src/ui/schema.tsx +113 -0
- package/src/ui/score.tsx +105 -0
- package/src/ui/search.tsx +120 -0
- package/src/ui/series.tsx +38 -0
- package/src/ui/severity.tsx +69 -0
- package/src/ui/shadcn.tsx +216 -0
- package/src/ui/spark.tsx +86 -0
- package/src/ui/stack.tsx +57 -0
- package/src/ui/stats.tsx +63 -0
- package/src/ui/status-badge.tsx +66 -0
- package/src/ui/statuspage.tsx +238 -0
- package/src/ui/steps.tsx +74 -0
- package/src/ui/summary.tsx +41 -0
- package/src/ui/symbol-ref.tsx +73 -0
- package/src/ui/terminal.tsx +117 -0
- package/src/ui/tests.tsx +218 -0
- package/src/ui/timeline.tsx +63 -0
- package/src/ui/toc.tsx +56 -0
- package/src/ui/tones.ts +187 -0
- package/src/ui/trace.tsx +69 -0
- package/src/ui/tree.tsx +281 -0
- package/src/ui/treemap.tsx +128 -0
- package/src/ui/venn.tsx +258 -0
- package/src/ui/verdict.tsx +78 -0
- package/src/ui/waterfall.tsx +142 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
|
|
4
|
+
import { defineComponent } from "../define.js";
|
|
5
|
+
import { nonEmpty } from "../guards.js";
|
|
6
|
+
import { attrTrue, BOOLISH_PROP } from "./attrs.js";
|
|
7
|
+
import { CaptionBar, ListPanel, ListRow, RowNote } from "./bits.js";
|
|
8
|
+
import { Icon } from "./icon.js";
|
|
9
|
+
import {
|
|
10
|
+
CAPTION_TITLE_CLS,
|
|
11
|
+
MINI_CHIP_CLS,
|
|
12
|
+
MONO_CLS,
|
|
13
|
+
TEXT,
|
|
14
|
+
TEXT_MICRO,
|
|
15
|
+
TEXT_SUB,
|
|
16
|
+
TONE,
|
|
17
|
+
TRIM_CLS,
|
|
18
|
+
} from "./tones.js";
|
|
19
|
+
|
|
20
|
+
/** Tiny rounded chip (Deprecated/auth) inside an endpoint row. */
|
|
21
|
+
const MINI_CHIP = `${MINI_CHIP_CLS} ${TONE.neutral}`;
|
|
22
|
+
|
|
23
|
+
export const HTTP_METHODS = [
|
|
24
|
+
"GET",
|
|
25
|
+
"POST",
|
|
26
|
+
"PUT",
|
|
27
|
+
"PATCH",
|
|
28
|
+
"DELETE",
|
|
29
|
+
"HEAD",
|
|
30
|
+
"OPTIONS",
|
|
31
|
+
] as const;
|
|
32
|
+
|
|
33
|
+
const METHODS: Record<string, string> = {
|
|
34
|
+
DELETE: TONE.red,
|
|
35
|
+
GET: TONE.emerald,
|
|
36
|
+
HEAD: TONE.neutral,
|
|
37
|
+
OPTIONS: TONE.neutral,
|
|
38
|
+
PATCH: TONE.amber,
|
|
39
|
+
POST: TONE.sky,
|
|
40
|
+
PUT: TONE.violet,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** `base` prefix from <Endpoints>, prepended (muted) to each endpoint path. */
|
|
44
|
+
const BaseCtx = createContext("");
|
|
45
|
+
|
|
46
|
+
export const Endpoint = defineComponent(
|
|
47
|
+
{
|
|
48
|
+
description:
|
|
49
|
+
"API エンドポイント1行。method は HTTP メソッド (大小無視、色付きチップ)、path は必須。auth に認可名 (admin|token …)、deprecated で打ち消し+ピル。<Endpoints> の base がパスに前置される。children は説明文",
|
|
50
|
+
schema: v.looseObject({
|
|
51
|
+
auth: v.optional(v.string()),
|
|
52
|
+
deprecated: BOOLISH_PROP,
|
|
53
|
+
method: v.optional(
|
|
54
|
+
v.pipe(v.string(), v.toUpperCase(), v.picklist(HTTP_METHODS)),
|
|
55
|
+
"GET"
|
|
56
|
+
),
|
|
57
|
+
path: v.string(),
|
|
58
|
+
}),
|
|
59
|
+
},
|
|
60
|
+
({ method, path, auth, deprecated, children }) => {
|
|
61
|
+
const base = useContext(BaseCtx);
|
|
62
|
+
const isDeprecated = attrTrue(deprecated);
|
|
63
|
+
return (
|
|
64
|
+
<ListRow>
|
|
65
|
+
<span
|
|
66
|
+
className={`inline-flex w-15 shrink-0 items-center justify-center rounded px-1 py-0.5 font-mono ${TEXT_MICRO} font-bold tracking-wide ${METHODS[method] ?? METHODS.GET}`}
|
|
67
|
+
>
|
|
68
|
+
{method}
|
|
69
|
+
</span>
|
|
70
|
+
<code
|
|
71
|
+
className={`${MONO_CLS} ${isDeprecated ? "line-through opacity-60" : ""}`}
|
|
72
|
+
>
|
|
73
|
+
{nonEmpty(base) ? <span className={TEXT.faint}>{base}</span> : null}
|
|
74
|
+
{path}
|
|
75
|
+
</code>
|
|
76
|
+
{isDeprecated ? <span className={MINI_CHIP}>Deprecated</span> : null}
|
|
77
|
+
{nonEmpty(auth) ? (
|
|
78
|
+
<span className={MINI_CHIP}>
|
|
79
|
+
<Icon className="h-2.5 w-2.5" name="lucide:lock" />
|
|
80
|
+
{auth}
|
|
81
|
+
</span>
|
|
82
|
+
) : null}
|
|
83
|
+
<RowNote className={TRIM_CLS}>{children}</RowNote>
|
|
84
|
+
</ListRow>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
export const Endpoints = defineComponent(
|
|
90
|
+
{
|
|
91
|
+
description:
|
|
92
|
+
"API エンドポイント一覧のコンテナ。<Endpoint> を並べる。title でキャプション、base で全行に付く共通パスプレフィックス",
|
|
93
|
+
schema: v.looseObject({
|
|
94
|
+
base: v.optional(v.string()),
|
|
95
|
+
title: v.optional(v.string()),
|
|
96
|
+
}),
|
|
97
|
+
},
|
|
98
|
+
({ title, base, children }) => (
|
|
99
|
+
<ListPanel>
|
|
100
|
+
{nonEmpty(title) || nonEmpty(base) ? (
|
|
101
|
+
<CaptionBar className={CAPTION_TITLE_CLS}>
|
|
102
|
+
<Icon className="h-3.5 w-3.5" name="lucide:route" />
|
|
103
|
+
{nonEmpty(title) ? title : "Endpoints"}
|
|
104
|
+
{nonEmpty(base) ? (
|
|
105
|
+
<code
|
|
106
|
+
className={`ml-auto font-mono ${TEXT_SUB} font-normal ${TEXT.faint}`}
|
|
107
|
+
>
|
|
108
|
+
{base}
|
|
109
|
+
</code>
|
|
110
|
+
) : null}
|
|
111
|
+
</CaptionBar>
|
|
112
|
+
) : null}
|
|
113
|
+
<BaseCtx.Provider value={nonEmpty(base) ? base : ""}>
|
|
114
|
+
{children}
|
|
115
|
+
</BaseCtx.Provider>
|
|
116
|
+
</ListPanel>
|
|
117
|
+
)
|
|
118
|
+
);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
|
|
3
|
+
import { defineComponent, flattenChildren } from "../define.js";
|
|
4
|
+
import { nonEmpty } from "../guards.js";
|
|
5
|
+
import { attrTrue, BOOLISH_PROP } from "./attrs.js";
|
|
6
|
+
import { CaptionBar, CopyButton, ListPanel, ListRow, RowNote } from "./bits.js";
|
|
7
|
+
import { isEl, propOf } from "./children.js";
|
|
8
|
+
import { Icon } from "./icon.js";
|
|
9
|
+
import {
|
|
10
|
+
CAPTION_TITLE_CLS,
|
|
11
|
+
COUNT_CHIP_CLS,
|
|
12
|
+
MINI_CHIP_CLS,
|
|
13
|
+
MONO_CLS,
|
|
14
|
+
TEXT,
|
|
15
|
+
TONE,
|
|
16
|
+
TRIM_CLS,
|
|
17
|
+
} from "./tones.js";
|
|
18
|
+
|
|
19
|
+
const MASK = "••••••••";
|
|
20
|
+
|
|
21
|
+
export const EnvVar = defineComponent(
|
|
22
|
+
{
|
|
23
|
+
description:
|
|
24
|
+
"環境変数1行。name は必須。required で必須チップ、value/default で値表示、secret で値をマスク (value 未指定でも secret 指定で MASK 表示)。children は説明文",
|
|
25
|
+
schema: v.looseObject({
|
|
26
|
+
default: v.optional(v.string()),
|
|
27
|
+
name: v.string(),
|
|
28
|
+
required: BOOLISH_PROP,
|
|
29
|
+
secret: BOOLISH_PROP,
|
|
30
|
+
value: v.optional(v.string()),
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
({ name, required, value, default: def, secret, children }) => {
|
|
34
|
+
const isSecret = attrTrue(secret);
|
|
35
|
+
const shown = isSecret ? MASK : (value ?? def);
|
|
36
|
+
return (
|
|
37
|
+
<ListRow>
|
|
38
|
+
<code className={`${MONO_CLS} font-medium`}>{name}</code>
|
|
39
|
+
{attrTrue(required) ? (
|
|
40
|
+
<span className={`${MINI_CHIP_CLS} ${TONE.amber}`}>required</span>
|
|
41
|
+
) : null}
|
|
42
|
+
{shown === undefined || shown === "" ? null : (
|
|
43
|
+
<code className={`font-mono text-xs ${TEXT.muted}`}>
|
|
44
|
+
{nonEmpty(value) || isSecret ? "" : "default: "}
|
|
45
|
+
{shown}
|
|
46
|
+
</code>
|
|
47
|
+
)}
|
|
48
|
+
{isSecret ? (
|
|
49
|
+
<span className={`${MINI_CHIP_CLS} ${TONE.violet}`}>
|
|
50
|
+
<Icon className="h-2.5 w-2.5" name="lucide:key-round" />
|
|
51
|
+
secret
|
|
52
|
+
</span>
|
|
53
|
+
) : null}
|
|
54
|
+
<RowNote className={TRIM_CLS}>{children}</RowNote>
|
|
55
|
+
</ListRow>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
export const EnvVars = defineComponent(
|
|
61
|
+
{
|
|
62
|
+
description:
|
|
63
|
+
"環境変数一覧のコンテナ。<EnvVar> を並べる。title はキャプション、コピーボタンで変数名一覧をクリップボードにコピー可。セットアップ/デプロイ手順書向け",
|
|
64
|
+
schema: v.looseObject({
|
|
65
|
+
title: v.optional(v.string()),
|
|
66
|
+
}),
|
|
67
|
+
},
|
|
68
|
+
({ title, children }) => {
|
|
69
|
+
const names = flattenChildren(children)
|
|
70
|
+
.filter((n) => isEl(n, EnvVar))
|
|
71
|
+
.map((n) => propOf(n, "name"))
|
|
72
|
+
.filter((x): x is string => typeof x === "string");
|
|
73
|
+
return (
|
|
74
|
+
<ListPanel>
|
|
75
|
+
{nonEmpty(title) || names.length > 0 ? (
|
|
76
|
+
<CaptionBar className={CAPTION_TITLE_CLS}>
|
|
77
|
+
<Icon className="h-3.5 w-3.5" name="lucide:settings-2" />
|
|
78
|
+
{nonEmpty(title) ? title : "Environment variables"}
|
|
79
|
+
<span className="ml-auto flex items-center gap-2">
|
|
80
|
+
{names.length > 0 ? (
|
|
81
|
+
<span className={COUNT_CHIP_CLS}>{names.length}</span>
|
|
82
|
+
) : null}
|
|
83
|
+
{names.length > 0 ? (
|
|
84
|
+
<CopyButton
|
|
85
|
+
copy={names.join("\n")}
|
|
86
|
+
title="Copy variable names"
|
|
87
|
+
/>
|
|
88
|
+
) : null}
|
|
89
|
+
</span>
|
|
90
|
+
</CaptionBar>
|
|
91
|
+
) : null}
|
|
92
|
+
{children}
|
|
93
|
+
</ListPanel>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
|
|
3
|
+
import { defineComponent } from "../define.js";
|
|
4
|
+
import { nonEmpty } from "../guards.js";
|
|
5
|
+
import { BORDER_CLS, TEXT, TRIM_CLS } from "./tones.js";
|
|
6
|
+
|
|
7
|
+
export const Figure = defineComponent(
|
|
8
|
+
{
|
|
9
|
+
description:
|
|
10
|
+
"キャプション付き画像。src は必須。caption 属性または children がキャプションになる",
|
|
11
|
+
schema: v.looseObject({
|
|
12
|
+
alt: v.optional(v.string()),
|
|
13
|
+
caption: v.optional(v.string()),
|
|
14
|
+
src: v.string(),
|
|
15
|
+
}),
|
|
16
|
+
},
|
|
17
|
+
({ src, alt, caption, children }) => {
|
|
18
|
+
const cap = nonEmpty(caption) ? caption : children;
|
|
19
|
+
return (
|
|
20
|
+
<figure className="not-prose my-6">
|
|
21
|
+
<img
|
|
22
|
+
src={src}
|
|
23
|
+
alt={alt ?? ""}
|
|
24
|
+
loading="lazy"
|
|
25
|
+
className={`w-full rounded-lg border ${BORDER_CLS}`}
|
|
26
|
+
/>
|
|
27
|
+
{cap === undefined ? null : (
|
|
28
|
+
<figcaption
|
|
29
|
+
className={`mt-2 text-center text-sm ${TEXT.muted} ${TRIM_CLS}`}
|
|
30
|
+
>
|
|
31
|
+
{cap}
|
|
32
|
+
</figcaption>
|
|
33
|
+
)}
|
|
34
|
+
</figure>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
);
|