@atom63/mdx 0.4.0-beta.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/API.md +47 -0
- package/CONTRIBUTING.md +58 -0
- package/LICENSE +21 -0
- package/README.md +190 -0
- package/dist/article/index.d.ts +32 -0
- package/dist/article/index.js +38 -0
- package/dist/article/index.js.map +1 -0
- package/dist/blocks/credits-block-entry.d.ts +14 -0
- package/dist/blocks/credits-block-entry.js +4 -0
- package/dist/blocks/credits-block-entry.js.map +1 -0
- package/dist/blocks/index.d.ts +175 -0
- package/dist/blocks/index.js +9 -0
- package/dist/blocks/index.js.map +1 -0
- package/dist/blocks/media-caption-entry.d.ts +11 -0
- package/dist/blocks/media-caption-entry.js +4 -0
- package/dist/blocks/media-caption-entry.js.map +1 -0
- package/dist/chunk-2RCEDZBB.js +11 -0
- package/dist/chunk-2RCEDZBB.js.map +1 -0
- package/dist/chunk-34B2U2Y2.js +59 -0
- package/dist/chunk-34B2U2Y2.js.map +1 -0
- package/dist/chunk-A3NG5VKX.js +169 -0
- package/dist/chunk-A3NG5VKX.js.map +1 -0
- package/dist/chunk-CSXZ2XEN.js +479 -0
- package/dist/chunk-CSXZ2XEN.js.map +1 -0
- package/dist/chunk-DJSENA7Q.js +63 -0
- package/dist/chunk-DJSENA7Q.js.map +1 -0
- package/dist/chunk-EIY6ZR6T.js +2471 -0
- package/dist/chunk-EIY6ZR6T.js.map +1 -0
- package/dist/chunk-EPSRYU5X.js +61 -0
- package/dist/chunk-EPSRYU5X.js.map +1 -0
- package/dist/chunk-FVCE4FER.js +132 -0
- package/dist/chunk-FVCE4FER.js.map +1 -0
- package/dist/chunk-IART7J2U.js +101 -0
- package/dist/chunk-IART7J2U.js.map +1 -0
- package/dist/chunk-OUEW54AC.js +144 -0
- package/dist/chunk-OUEW54AC.js.map +1 -0
- package/dist/chunk-WZ6US342.js +231 -0
- package/dist/chunk-WZ6US342.js.map +1 -0
- package/dist/constants-CuaBcwMe.d.ts +4 -0
- package/dist/editor/index.d.ts +47 -0
- package/dist/editor/index.js +118 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/framed-block-DM5LLxO7.d.ts +87 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/lightbox/index.d.ts +44 -0
- package/dist/lightbox/index.js +5 -0
- package/dist/lightbox/index.js.map +1 -0
- package/dist/mdx-provider-6gOypsy5.d.ts +185 -0
- package/dist/photo-swipe-CwzAHpP-.d.ts +66 -0
- package/dist/primitives/index.d.ts +130 -0
- package/dist/primitives/index.js +132 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/runtime/index.d.ts +39 -0
- package/dist/runtime/index.js +4 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/slots-BvPdUMdY.d.ts +23 -0
- package/dist/video-block-C0a5Yx9x.d.ts +468 -0
- package/package.json +139 -0
- package/src/blocks/callout/callout.css +37 -0
- package/src/blocks/code-block/code-block.css +40 -0
- package/src/blocks/color-swatch-item/color-swatch-item.css +36 -0
- package/src/blocks/compare/compare.css +14 -0
- package/src/blocks/comparison-pair/comparison-pair.css +27 -0
- package/src/blocks/credits-block/credits-block.css +16 -0
- package/src/blocks/demo-stage/demo-stage.css +50 -0
- package/src/blocks/doc-example/doc-example.css +44 -0
- package/src/blocks/image-compare/image-compare.css +45 -0
- package/src/blocks/layer-stack/layer-stack.css +28 -0
- package/src/blocks/media-placeholder/media-placeholder.css +11 -0
- package/src/blocks/mermaid-diagram/mermaid-diagram.css +52 -0
- package/src/blocks/page-meta/page-meta.css +7 -0
- package/src/blocks/page-table-of-contents/page-table-of-contents.css +73 -0
- package/src/blocks/resource-list/resource-list.css +138 -0
- package/src/blocks/scroll-stage/scroll-stage.css +12 -0
- package/src/blocks/stat-card/stat-card.css +18 -0
- package/src/blocks/steps/steps.css +20 -0
- package/src/blocks/timeline/timeline.css +12 -0
- package/src/blocks/video-block/video-block.css +11 -0
- package/src/primitives/motion-tokens.css +16 -0
- package/src/styles/a63.css +13 -0
- package/src/styles/base.css +362 -0
- package/src/styles/block-recipes.css +21 -0
- package/src/styles/consumer.css +7 -0
- package/src/styles/index.css +12 -0
- package/src/styles/mdx-blocks.css +9 -0
- package/src/styles/shadcn.css +12 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type SlotComponent = ((props: {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}) => null) & {
|
|
6
|
+
slotName: string;
|
|
7
|
+
};
|
|
8
|
+
/** Create a named marker component. It renders nothing on its own; its parent
|
|
9
|
+
* extracts its children via `pickSlot`. */
|
|
10
|
+
declare function createSlot(name: string): SlotComponent;
|
|
11
|
+
/** Whether any child is an element for the given slot, regardless of its
|
|
12
|
+
* content. Use this to detect slot *presence* — `pickSlot` returning null is
|
|
13
|
+
* ambiguous (a present-but-empty slot also yields null). */
|
|
14
|
+
declare function hasSlot(children: ReactNode, slot: SlotComponent): boolean;
|
|
15
|
+
/** Return the children of the first element matching `slot`, or null when the
|
|
16
|
+
* slot is absent OR present-but-empty. Pair with `hasSlot` when the distinction
|
|
17
|
+
* matters. */
|
|
18
|
+
declare function pickSlot(children: ReactNode, slot: SlotComponent): ReactNode | null;
|
|
19
|
+
/** Return the children that are NOT one of the given slots (loose content),
|
|
20
|
+
* re-keyed via `Children.toArray` so the result is safe to render as a list. */
|
|
21
|
+
declare function pickRest(children: ReactNode, slots: SlotComponent[]): ReactNode[];
|
|
22
|
+
|
|
23
|
+
export { type SlotComponent as S, pickSlot as a, createSlot as c, hasSlot as h, pickRest as p };
|
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { ReactNode, ComponentProps, ReactElement } from 'react';
|
|
3
|
+
import { S as SlotComponent } from './slots-BvPdUMdY.js';
|
|
4
|
+
import { Accordion as Accordion$1, AccordionItem, AccordionTrigger, AccordionContent, Tabs as Tabs$1, TabsList, TabsTab, TabsPanel } from '@atom63/ui-react';
|
|
5
|
+
|
|
6
|
+
type DemoStageProps = {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
headerEnd?: ReactNode;
|
|
10
|
+
headerStart?: ReactNode;
|
|
11
|
+
panelClassName?: string;
|
|
12
|
+
};
|
|
13
|
+
declare const DemoStage: React.ForwardRefExoticComponent<DemoStageProps & React.RefAttributes<HTMLElement>>;
|
|
14
|
+
|
|
15
|
+
declare const mdxStyles: {
|
|
16
|
+
readonly root: string;
|
|
17
|
+
readonly spacing: {
|
|
18
|
+
readonly block: "my-6 first:mt-0 last:mb-0 sm:my-8";
|
|
19
|
+
readonly component: "my-5 first:mt-0 last:mb-0";
|
|
20
|
+
readonly media: "my-8 first:mt-0 last:mb-0 sm:my-10";
|
|
21
|
+
readonly mediaLg: "my-12 first:mt-0 last:mb-0 sm:my-16";
|
|
22
|
+
readonly mediaSm: "my-6 first:mt-0 last:mb-0";
|
|
23
|
+
};
|
|
24
|
+
readonly headings: {
|
|
25
|
+
readonly h1: "text-4xl font-semibold tracking-tight scroll-mt-24 mt-10 first:mt-0 sm:text-5xl";
|
|
26
|
+
readonly h2: "text-2xl font-semibold tracking-tight scroll-mt-24 mt-10 first:mt-0 sm:text-3xl";
|
|
27
|
+
readonly h3: "text-xl font-semibold tracking-tight scroll-mt-24 mt-8 first:mt-0 sm:text-2xl";
|
|
28
|
+
readonly h4: "text-lg font-semibold tracking-tight scroll-mt-24 mt-6 first:mt-0";
|
|
29
|
+
readonly h5: "text-base font-semibold scroll-mt-24 mt-6 first:mt-0";
|
|
30
|
+
readonly h6: "mdx-h6 text-sm font-semibold scroll-mt-24 mt-6 first:mt-0";
|
|
31
|
+
};
|
|
32
|
+
readonly text: {
|
|
33
|
+
readonly paragraph: "text-base leading-relaxed text-secondary-foreground mt-4 first:mt-0 last:mb-0 [&_a]:underline [&_a]:underline-offset-4";
|
|
34
|
+
readonly lead: "mdx-text-secondary text-lg leading-relaxed mt-4 first:mt-0";
|
|
35
|
+
readonly small: "mdx-text-secondary text-sm leading-relaxed";
|
|
36
|
+
};
|
|
37
|
+
readonly content: {
|
|
38
|
+
readonly link: "font-normal underline underline-offset-4 decoration-2 decoration-foreground/30 hover:decoration-foreground/70 transition-colors";
|
|
39
|
+
readonly strong: "font-semibold";
|
|
40
|
+
readonly em: "italic";
|
|
41
|
+
readonly del: "line-through";
|
|
42
|
+
readonly ins: "mdx-ins underline";
|
|
43
|
+
readonly inlineCode: "mdx-inline-code px-1 py-0.5 font-mono text-xs leading-snug font-medium";
|
|
44
|
+
readonly pre: "mdx-pre overflow-x-auto p-4 text-sm leading-relaxed [&_code]:bg-transparent [&_code]:border-0 [&_code]:p-0 [&_code]:font-normal [&_code]:leading-relaxed [&_code]:ring-0 [&_code]:text-sm";
|
|
45
|
+
readonly code: "font-mono text-sm leading-relaxed font-normal";
|
|
46
|
+
readonly blockquote: "mdx-blockquote mt-6 px-4 py-3 text-base italic rounded-e [&_p]:mt-2 [&_p:first-child]:mt-0";
|
|
47
|
+
readonly ul: "mt-4 list-disc space-y-2 ps-4 [&_ul]:mt-2 [&_ul]:space-y-2 [&_ul]:ps-4 [&_a]:underline [&_a]:underline-offset-4";
|
|
48
|
+
readonly ol: "mt-4 list-decimal space-y-2 ps-4 [&_ol]:mt-2 [&_ol]:space-y-2 [&_ol]:ps-4 [&_a]:underline [&_a]:underline-offset-4";
|
|
49
|
+
readonly li: "text-base leading-relaxed text-secondary-foreground";
|
|
50
|
+
readonly hr: "mdx-hr my-8 sm:my-10";
|
|
51
|
+
readonly kbd: "mdx-kbd inline-flex h-6 select-none items-center gap-1 px-2 font-mono text-xs font-medium";
|
|
52
|
+
readonly tableWrapper: "mdx-table-wrapper mt-6 w-full overflow-hidden sm:mt-8";
|
|
53
|
+
readonly table: "w-full border-collapse text-sm [&_code]:text-xs";
|
|
54
|
+
readonly thead: "mdx-thead";
|
|
55
|
+
readonly tbody: "[&_tr:last-child]:border-0";
|
|
56
|
+
readonly tr: "mdx-tr transition-colors";
|
|
57
|
+
readonly th: "mdx-th h-9 px-3 text-start align-middle font-semibold";
|
|
58
|
+
readonly td: "mdx-td px-3 py-2 align-middle";
|
|
59
|
+
readonly caption: "mdx-caption mt-3 text-balance text-xs";
|
|
60
|
+
readonly img: "my-8 rounded-xl first:mt-0 last:mb-0 sm:my-10";
|
|
61
|
+
readonly figure: "my-8 first:mt-0 last:mb-0 sm:my-10";
|
|
62
|
+
readonly figcaption: "mdx-figcaption mx-auto mt-2 max-w-[var(--mdx-measure,42rem)] text-center text-xs leading-snug text-balance";
|
|
63
|
+
readonly iframe: "mdx-media-framed my-8 first:mt-0 last:mb-0 w-full rounded-xl sm:my-10";
|
|
64
|
+
readonly video: "mdx-media-framed my-8 first:mt-0 last:mb-0 w-full rounded-xl sm:my-10";
|
|
65
|
+
readonly audio: "my-8 first:mt-0 last:mb-0 w-full sm:my-10";
|
|
66
|
+
readonly details: "mdx-details mt-6 p-4 [&>*:first-child:not(summary)]:mt-0 [&>summary+*]:mt-3";
|
|
67
|
+
readonly summary: "mdx-summary cursor-pointer select-none font-semibold [&::-webkit-details-marker]:hidden";
|
|
68
|
+
readonly mark: "mdx-mark rounded-sm px-1";
|
|
69
|
+
readonly sub: "text-xs align-sub";
|
|
70
|
+
readonly sup: "text-xs align-super";
|
|
71
|
+
readonly abbr: "mdx-abbr cursor-help";
|
|
72
|
+
readonly cite: "mdx-cite italic";
|
|
73
|
+
readonly dfn: "font-semibold";
|
|
74
|
+
readonly time: "mdx-time";
|
|
75
|
+
readonly var: "font-mono italic";
|
|
76
|
+
readonly samp: "mdx-samp px-1 font-mono text-xs";
|
|
77
|
+
readonly output: "mdx-output px-2 py-1 font-mono text-xs";
|
|
78
|
+
};
|
|
79
|
+
readonly layout: {
|
|
80
|
+
readonly callout: {
|
|
81
|
+
readonly base: "my-4 rounded-lg border p-4 text-base leading-relaxed first:mt-0 last:mb-0 sm:my-5 [&_p]:mt-1.5 [&_p]:text-base [&_p]:leading-relaxed [&_p:first-child]:mt-0 [&_ul]:mt-1.5 [&_ul]:space-y-1 [&_ol]:mt-1.5 [&_ol]:space-y-1 [&_li]:text-base [&_li]:leading-relaxed [&_li]:text-inherit";
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
type CalloutType = 'info' | 'warning' | 'error' | 'success';
|
|
86
|
+
|
|
87
|
+
type CalloutProps = {
|
|
88
|
+
children: ReactNode;
|
|
89
|
+
className?: string;
|
|
90
|
+
type?: CalloutType;
|
|
91
|
+
};
|
|
92
|
+
declare function Callout({ children, type, className }: CalloutProps): React.JSX.Element;
|
|
93
|
+
declare namespace Callout {
|
|
94
|
+
var Icon: SlotComponent;
|
|
95
|
+
var Title: SlotComponent;
|
|
96
|
+
var Body: SlotComponent;
|
|
97
|
+
var Actions: SlotComponent;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
declare const mediaSpacingClasses: {
|
|
101
|
+
readonly none: "";
|
|
102
|
+
readonly sm: "my-6 first:mt-0 last:mb-0";
|
|
103
|
+
readonly default: "my-8 first:mt-0 last:mb-0 sm:my-10";
|
|
104
|
+
readonly lg: "my-12 first:mt-0 last:mb-0 sm:my-16";
|
|
105
|
+
};
|
|
106
|
+
type MediaSpacing = keyof typeof mediaSpacingClasses;
|
|
107
|
+
|
|
108
|
+
declare const aspectRatioClasses: {
|
|
109
|
+
readonly '1/1': "aspect-square object-cover";
|
|
110
|
+
readonly '4/3': "aspect-[4/3] object-cover";
|
|
111
|
+
readonly '3/4': "aspect-[3/4] object-cover";
|
|
112
|
+
readonly '16/9': "aspect-video object-cover";
|
|
113
|
+
readonly '9/16': "aspect-[9/16] object-cover";
|
|
114
|
+
};
|
|
115
|
+
type FigureBlockProps = {
|
|
116
|
+
alt: string;
|
|
117
|
+
aspectRatio?: keyof typeof aspectRatioClasses;
|
|
118
|
+
bordered?: boolean;
|
|
119
|
+
caption?: string;
|
|
120
|
+
className?: string;
|
|
121
|
+
/** Click-to-zoom; multiple figures on a page share one connected gallery. */
|
|
122
|
+
enableLightbox?: boolean;
|
|
123
|
+
/** Gallery id for connected lightbox (default: all FigureBlocks on the page). */
|
|
124
|
+
lightboxGalleryId?: string;
|
|
125
|
+
loading?: 'eager' | 'lazy';
|
|
126
|
+
spacing?: MediaSpacing;
|
|
127
|
+
src: string;
|
|
128
|
+
children?: ReactNode;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Portable figure + image for MDX content.
|
|
132
|
+
* Requires FigureLightboxHost on the MDX provider (included in MDXContentProvider).
|
|
133
|
+
*/
|
|
134
|
+
declare function FigureBlock({ src, alt, caption, aspectRatio, bordered, spacing, loading, enableLightbox, lightboxGalleryId, className, children, }: FigureBlockProps): React.JSX.Element;
|
|
135
|
+
declare namespace FigureBlock {
|
|
136
|
+
var Caption: SlotComponent;
|
|
137
|
+
var Aside: SlotComponent;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
type AccordionProps = ComponentProps<typeof Accordion$1>;
|
|
141
|
+
/**
|
|
142
|
+
* MDX `Accordion` block — a thin wrapper around the `@atom63/ui-react` `Accordion`
|
|
143
|
+
* that adds prose-context block spacing. Accessibility, keyboard navigation and
|
|
144
|
+
* single/multiple modes are inherited from `@atom63/ui-react`. Authors compose it as
|
|
145
|
+
* `<Accordion>` + `<Accordion.Item>` / `<Accordion.Trigger>` / `<Accordion.Content>`.
|
|
146
|
+
*/
|
|
147
|
+
declare function Accordion({ className, ...props }: AccordionProps): React.JSX.Element;
|
|
148
|
+
declare namespace Accordion {
|
|
149
|
+
var Item: typeof AccordionItem;
|
|
150
|
+
var Trigger: typeof AccordionTrigger;
|
|
151
|
+
var Content: typeof AccordionContent;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Internal-only styling channel for embedded code blocks. Not part of the
|
|
156
|
+
* public `@atom63/mdx/blocks` API — only `CodeBlock` (reader) and `Compare`
|
|
157
|
+
* (writer) consume it in-package. See P2 Batch A: the provider was retired from the
|
|
158
|
+
* public exports because no app consumed it.
|
|
159
|
+
*/
|
|
160
|
+
type CodeBlockVariant = 'article' | 'embedded';
|
|
161
|
+
|
|
162
|
+
type CodeBlockProps = {
|
|
163
|
+
children?: ReactNode;
|
|
164
|
+
className?: string;
|
|
165
|
+
code: string;
|
|
166
|
+
copyLabel?: string;
|
|
167
|
+
/** Label shown in place of an unknown language in the article header. */
|
|
168
|
+
fallbackLangLabel?: string;
|
|
169
|
+
lang?: string;
|
|
170
|
+
/** Visually-hidden status text announced while syntax highlighting runs. */
|
|
171
|
+
loadingLabel?: string;
|
|
172
|
+
maxHeight?: string;
|
|
173
|
+
/**
|
|
174
|
+
* Show a numbered gutter. Defaults to a smart heuristic: on for `article`
|
|
175
|
+
* blocks longer than 6 lines, off for short snippets and embedded blocks.
|
|
176
|
+
*/
|
|
177
|
+
showLineNumbers?: boolean;
|
|
178
|
+
showCopyButton?: boolean;
|
|
179
|
+
spacing?: 'component' | 'none';
|
|
180
|
+
variant?: CodeBlockVariant;
|
|
181
|
+
};
|
|
182
|
+
declare function CodeBlock({ children, code, lang, loadingLabel, showLineNumbers, variant, ...props }: CodeBlockProps): React.JSX.Element;
|
|
183
|
+
|
|
184
|
+
type ColorSwatchItemProps = {
|
|
185
|
+
name: string;
|
|
186
|
+
variable: string;
|
|
187
|
+
};
|
|
188
|
+
/** Single semantic color swatch for token documentation in MDX. */
|
|
189
|
+
declare function ColorSwatchItem({ name, variable }: ColorSwatchItemProps): React.JSX.Element;
|
|
190
|
+
|
|
191
|
+
type ComparisonPairProps = {
|
|
192
|
+
children: ReactNode;
|
|
193
|
+
className?: string;
|
|
194
|
+
label?: string;
|
|
195
|
+
slowMotionLabel?: string;
|
|
196
|
+
speedControl?: boolean;
|
|
197
|
+
};
|
|
198
|
+
type ComparisonSlotProps = {
|
|
199
|
+
children: ReactNode;
|
|
200
|
+
className?: string;
|
|
201
|
+
label?: string;
|
|
202
|
+
};
|
|
203
|
+
declare function ComparisonPair({ children, className, label, slowMotionLabel, speedControl, }: ComparisonPairProps): React__default.JSX.Element;
|
|
204
|
+
declare namespace ComparisonPair {
|
|
205
|
+
var Before: ({ children, className, label }: ComparisonSlotProps) => React__default.JSX.Element;
|
|
206
|
+
var After: ({ children, className, label }: ComparisonSlotProps) => React__default.JSX.Element;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
interface ExampleContainerProps {
|
|
210
|
+
align?: 'left' | 'center';
|
|
211
|
+
children: React__default.ReactNode;
|
|
212
|
+
className?: string;
|
|
213
|
+
description?: string;
|
|
214
|
+
/** Nested inside DocExample — drops outer margin and border (parent supplies chrome). */
|
|
215
|
+
embedded?: boolean;
|
|
216
|
+
spec?: React__default.ReactNode;
|
|
217
|
+
title?: string;
|
|
218
|
+
/** Use wide layout to break out of narrow prose constraints */
|
|
219
|
+
wide?: boolean;
|
|
220
|
+
}
|
|
221
|
+
declare function ExampleContainer({ children, align, description, spec, title, className, embedded, wide, }: ExampleContainerProps): React__default.JSX.Element;
|
|
222
|
+
|
|
223
|
+
type MediaPlaceholderKind = 'image' | 'video' | 'diagram';
|
|
224
|
+
type MediaPlaceholderProps = {
|
|
225
|
+
/** What the real asset should show — surfaced as the frame's caption. */
|
|
226
|
+
label?: string;
|
|
227
|
+
/** Picks the icon + kind tag. Defaults to `image`. */
|
|
228
|
+
kind?: MediaPlaceholderKind;
|
|
229
|
+
/** CSS aspect-ratio for the frame (e.g. `16 / 9`, `4 / 3`, `1 / 1`). */
|
|
230
|
+
aspectRatio?: string;
|
|
231
|
+
className?: string;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* A labeled dashed frame that marks where a real image, video, or diagram will
|
|
235
|
+
* go. Sits in the reading column with media spacing, so it previews the content
|
|
236
|
+
* rhythm before assets exist — swap it for an ImageBlock / AutoplayVideoBlock later.
|
|
237
|
+
*/
|
|
238
|
+
declare function MediaPlaceholder({ label, kind, aspectRatio, className, }: MediaPlaceholderProps): ReactElement;
|
|
239
|
+
|
|
240
|
+
type MermaidDiagramLabels = {
|
|
241
|
+
diagram: string;
|
|
242
|
+
zoomOut: string;
|
|
243
|
+
zoomOutTitle: string;
|
|
244
|
+
resetZoom: string;
|
|
245
|
+
resetZoomTitle: string;
|
|
246
|
+
zoomIn: string;
|
|
247
|
+
zoomInTitle: string;
|
|
248
|
+
rendering: string;
|
|
249
|
+
errorMessage: string;
|
|
250
|
+
};
|
|
251
|
+
declare const defaultMermaidDiagramLabels: MermaidDiagramLabels;
|
|
252
|
+
interface MermaidDiagramProps {
|
|
253
|
+
/** When true, animate the diagram's paths with a stroke draw-on-reveal. Off by default. */
|
|
254
|
+
animated?: boolean;
|
|
255
|
+
chart: string;
|
|
256
|
+
labels?: Partial<MermaidDiagramLabels>;
|
|
257
|
+
title?: string;
|
|
258
|
+
}
|
|
259
|
+
declare function MermaidDiagram({ animated, chart, labels, title }: MermaidDiagramProps): React.JSX.Element;
|
|
260
|
+
|
|
261
|
+
type PageMetaProps = {
|
|
262
|
+
children?: ReactNode;
|
|
263
|
+
className?: string;
|
|
264
|
+
description?: ReactNode;
|
|
265
|
+
eyebrow?: ReactNode;
|
|
266
|
+
meta?: ReactNode;
|
|
267
|
+
title: ReactNode;
|
|
268
|
+
};
|
|
269
|
+
/** Page-level title, description, and metadata that follows MDX provider variants. */
|
|
270
|
+
declare function PageMeta({ title, description, eyebrow, meta, children, className, }: PageMetaProps): React.JSX.Element;
|
|
271
|
+
|
|
272
|
+
type TableOfContentsVariant = 'embedded' | 'inline' | 'menu' | 'rail';
|
|
273
|
+
interface PageTableOfContentsProps {
|
|
274
|
+
activeOffset?: number;
|
|
275
|
+
className?: string;
|
|
276
|
+
containerSelector?: string;
|
|
277
|
+
headingSelector?: string;
|
|
278
|
+
inlinePositionClassName?: string;
|
|
279
|
+
label?: string;
|
|
280
|
+
onActiveLabelChange?: (label: string) => void;
|
|
281
|
+
onNavigate?: () => void;
|
|
282
|
+
scrollOffset?: number;
|
|
283
|
+
showProgress?: boolean;
|
|
284
|
+
smoothScrollDuration?: number;
|
|
285
|
+
variant?: TableOfContentsVariant;
|
|
286
|
+
}
|
|
287
|
+
/** Responsive article page navigation for MDX headings. */
|
|
288
|
+
declare function PageTableOfContents({ activeOffset, className, containerSelector, headingSelector, inlinePositionClassName, label, onActiveLabelChange, onNavigate, scrollOffset, showProgress, smoothScrollDuration, variant, }: PageTableOfContentsProps): React.JSX.Element | null;
|
|
289
|
+
|
|
290
|
+
type ResourceItem = {
|
|
291
|
+
name: string;
|
|
292
|
+
url: string;
|
|
293
|
+
/** Optional one-line descriptor shown before the domain. */
|
|
294
|
+
note?: string;
|
|
295
|
+
};
|
|
296
|
+
type ResourceListProps = {
|
|
297
|
+
items: ResourceItem[];
|
|
298
|
+
className?: string;
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* A compact list of external resources — people, sites, references — to follow.
|
|
302
|
+
* Each row shows a favicon, name, an optional one-line note, and the domain.
|
|
303
|
+
*/
|
|
304
|
+
declare function ResourceList({ items, className }: ResourceListProps): React.JSX.Element | null;
|
|
305
|
+
|
|
306
|
+
type ScrollStageStepProps = {
|
|
307
|
+
/**
|
|
308
|
+
* The visual (image, diagram, JSX) shown for this step. Keep it cheap — in the
|
|
309
|
+
* pinned path it re-renders whenever the active step changes, so prefer static
|
|
310
|
+
* images/JSX over heavy live components. Avoid putting anchor `id`s inside
|
|
311
|
+
* `media` or the prose: both the pinned (`lg+`) and stacked (below `lg`) copies
|
|
312
|
+
* render into the DOM, so an `id` would be duplicated.
|
|
313
|
+
*/
|
|
314
|
+
media: ReactNode;
|
|
315
|
+
children: ReactNode;
|
|
316
|
+
className?: string;
|
|
317
|
+
};
|
|
318
|
+
type ScrollStageProps = {
|
|
319
|
+
children: ReactNode;
|
|
320
|
+
className?: string;
|
|
321
|
+
};
|
|
322
|
+
/**
|
|
323
|
+
* A single scrollytelling step. Renders as a real subcomponent so the parent
|
|
324
|
+
* `ScrollStage` can read its `media` and `children` (Compare.Item precedent).
|
|
325
|
+
* The visual rendering is handled by `ScrollStage`; this component is only a
|
|
326
|
+
* data carrier when used inside the stage.
|
|
327
|
+
*/
|
|
328
|
+
declare function ScrollStageStep(_props: ScrollStageStepProps): null;
|
|
329
|
+
/**
|
|
330
|
+
* MDX `ScrollStage` block — a scrollytelling section. On `lg+` with motion
|
|
331
|
+
* allowed, the reading column scrolls while a sticky media pane crossfades to
|
|
332
|
+
* the step centered in the viewport. Reduced-motion and mobile render a static
|
|
333
|
+
* stacked layout (media inline above prose). SSR-safe: no window access during
|
|
334
|
+
* render; the IntersectionObserver is set up in `useEffect`.
|
|
335
|
+
*/
|
|
336
|
+
declare function ScrollStage({ children, className }: ScrollStageProps): React.JSX.Element;
|
|
337
|
+
declare namespace ScrollStage {
|
|
338
|
+
var Step: typeof ScrollStageStep;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
type StatTrend = 'up' | 'down' | 'neutral';
|
|
342
|
+
type StatCardProps = {
|
|
343
|
+
/** Small muted caption above the value. */
|
|
344
|
+
label: string;
|
|
345
|
+
/** The prominent metric. */
|
|
346
|
+
value: ReactNode;
|
|
347
|
+
/** Optional secondary change indicator, colored by `trend`. */
|
|
348
|
+
change?: ReactNode;
|
|
349
|
+
/** Semantic direction of `change`; drives the token color. */
|
|
350
|
+
trend?: StatTrend;
|
|
351
|
+
className?: string;
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* MDX `StatCard` block — a static, SSR-safe metric card built on the
|
|
355
|
+
* `@atom63/ui-react` `Card`. Renders a muted label, a prominent value, and an
|
|
356
|
+
* optional change indicator colored by `trend` using semantic tokens.
|
|
357
|
+
*/
|
|
358
|
+
declare function StatCard({ label, value, change, trend, className }: StatCardProps): React.JSX.Element;
|
|
359
|
+
|
|
360
|
+
type StatGridProps = {
|
|
361
|
+
children: ReactNode;
|
|
362
|
+
className?: string;
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* MDX `StatGrid` block — a static, SSR-safe responsive grid for laying out
|
|
366
|
+
* `StatCard`s (or any children). Adds prose-context block spacing.
|
|
367
|
+
*/
|
|
368
|
+
declare function StatGrid({ children, className }: StatGridProps): React.JSX.Element;
|
|
369
|
+
|
|
370
|
+
type StepsProps = {
|
|
371
|
+
children: ReactNode;
|
|
372
|
+
className?: string;
|
|
373
|
+
};
|
|
374
|
+
type StepsStepProps = {
|
|
375
|
+
/** Bold heading for the step. */
|
|
376
|
+
title: ReactNode;
|
|
377
|
+
children: ReactNode;
|
|
378
|
+
className?: string;
|
|
379
|
+
/** Injected by `Steps` — the 1-indexed position in document order. */
|
|
380
|
+
index?: number;
|
|
381
|
+
};
|
|
382
|
+
/**
|
|
383
|
+
* A single step row: a numbered badge on the connector spine (left) plus the
|
|
384
|
+
* title and content (right). Static/SSR-safe. `index` is injected by the parent
|
|
385
|
+
* `Steps` so authors never number steps by hand.
|
|
386
|
+
*/
|
|
387
|
+
declare function StepsStep({ title, children, className, index }: StepsStepProps): React.JSX.Element;
|
|
388
|
+
/**
|
|
389
|
+
* MDX `Steps` block — a numbered stepper. Wraps `Steps.Step` children in an
|
|
390
|
+
* ordered list with a connector spine, auto-numbering each step 1..n in
|
|
391
|
+
* document order. Static/SSR-safe (no client interactivity or motion).
|
|
392
|
+
*/
|
|
393
|
+
declare function Steps({ children, className }: StepsProps): React.JSX.Element;
|
|
394
|
+
declare namespace Steps {
|
|
395
|
+
var Step: typeof StepsStep;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
type TabsProps = ComponentProps<typeof Tabs$1>;
|
|
399
|
+
/**
|
|
400
|
+
* MDX `Tabs` block — a thin wrapper around the `@atom63/ui-react` `Tabs` that adds
|
|
401
|
+
* prose-context block spacing. All accessibility and keyboard navigation is
|
|
402
|
+
* inherited from `@atom63/ui-react`. Authors compose it as
|
|
403
|
+
* `<Tabs>` + `<Tabs.List>` / `<Tabs.Tab>` / `<Tabs.Panel>`.
|
|
404
|
+
*/
|
|
405
|
+
declare function Tabs({ className, ...props }: TabsProps): React.JSX.Element;
|
|
406
|
+
declare namespace Tabs {
|
|
407
|
+
var List: typeof TabsList;
|
|
408
|
+
var Tab: typeof TabsTab;
|
|
409
|
+
var Panel: typeof TabsPanel;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
type TimelineProps = {
|
|
413
|
+
children: ReactNode;
|
|
414
|
+
className?: string;
|
|
415
|
+
};
|
|
416
|
+
type TimelineItemProps = {
|
|
417
|
+
/** Date or label shown in the left column (e.g. a year). */
|
|
418
|
+
date: ReactNode;
|
|
419
|
+
/** Bold heading for the event. */
|
|
420
|
+
title: ReactNode;
|
|
421
|
+
children: ReactNode;
|
|
422
|
+
className?: string;
|
|
423
|
+
};
|
|
424
|
+
/**
|
|
425
|
+
* A single timeline event: date/label (left), a spine with a dot marker
|
|
426
|
+
* (center), and the event card — title plus content (right). Static/SSR-safe.
|
|
427
|
+
*/
|
|
428
|
+
declare function TimelineItem({ date, title, children, className }: TimelineItemProps): React.JSX.Element;
|
|
429
|
+
/**
|
|
430
|
+
* MDX `Timeline` block — a vertical event timeline. Wraps `Timeline.Item`
|
|
431
|
+
* children in an ordered list with a date column, a dotted spine, and an event
|
|
432
|
+
* card per item. Static/SSR-safe (no client interactivity or motion).
|
|
433
|
+
*/
|
|
434
|
+
declare function Timeline({ children, className }: TimelineProps): React.JSX.Element;
|
|
435
|
+
declare namespace Timeline {
|
|
436
|
+
var Item: typeof TimelineItem;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
declare const fitClasses: {
|
|
440
|
+
readonly contain: "object-contain";
|
|
441
|
+
readonly cover: "object-cover";
|
|
442
|
+
};
|
|
443
|
+
type VideoCaptionPolicy = {
|
|
444
|
+
/** Video has spoken or meaningful audio and must provide captions. */
|
|
445
|
+
captionPolicy?: 'required';
|
|
446
|
+
trackSrc: string;
|
|
447
|
+
} | {
|
|
448
|
+
/** Video is decorative or purely visual; no caption track is required. */
|
|
449
|
+
captionPolicy: 'decorative';
|
|
450
|
+
trackSrc?: string;
|
|
451
|
+
};
|
|
452
|
+
type VideoBlockProps = {
|
|
453
|
+
autoPlay?: boolean;
|
|
454
|
+
caption?: string;
|
|
455
|
+
className?: string;
|
|
456
|
+
controls?: boolean;
|
|
457
|
+
fit?: keyof typeof fitClasses;
|
|
458
|
+
loop?: boolean;
|
|
459
|
+
muted?: boolean;
|
|
460
|
+
showCaption?: boolean;
|
|
461
|
+
spacing?: MediaSpacing;
|
|
462
|
+
src: string;
|
|
463
|
+
title: string;
|
|
464
|
+
} & VideoCaptionPolicy;
|
|
465
|
+
/** Portable video player for MDX lessons and docs. */
|
|
466
|
+
declare function VideoBlock({ title, autoPlay, caption, className, controls, fit, loop, muted, showCaption, spacing, src, trackSrc, }: VideoBlockProps): React.JSX.Element;
|
|
467
|
+
|
|
468
|
+
export { Accordion as A, type ResourceItem as B, type CalloutType as C, type DemoStageProps as D, ExampleContainer as E, FigureBlock as F, type ResourceListProps as G, type ScrollStageProps as H, type ScrollStageStepProps as I, type StatCardProps as J, type StatGridProps as K, type StatTrend as L, MediaPlaceholder as M, type StepsProps as N, type StepsStepProps as O, PageMeta as P, type TabsProps as Q, ResourceList as R, ScrollStage as S, Tabs as T, type TimelineItemProps as U, VideoBlock as V, type TimelineProps as W, type VideoBlockProps as X, defaultMermaidDiagramLabels as Y, Callout as a, CodeBlock as b, ColorSwatchItem as c, ComparisonPair as d, MermaidDiagram as e, PageTableOfContents as f, StatCard as g, StatGrid as h, Steps as i, Timeline as j, type AccordionProps as k, type CalloutProps as l, mdxStyles as m, type CodeBlockProps as n, type ColorSwatchItemProps as o, type ComparisonPairProps as p, type ComparisonSlotProps as q, DemoStage as r, type ExampleContainerProps as s, type FigureBlockProps as t, type MediaPlaceholderKind as u, type MediaPlaceholderProps as v, type MermaidDiagramLabels as w, type MermaidDiagramProps as x, type PageMetaProps as y, type PageTableOfContentsProps as z };
|
package/package.json
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atom63/mdx",
|
|
3
|
+
"version": "0.4.0-beta.0",
|
|
4
|
+
"description": "MDX prose components, blocks, layout primitives and article styles for the Atom63 design system",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/atom63/atom63-design-system.git",
|
|
9
|
+
"directory": "packages/mdx"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/atom63/atom63-design-system/tree/main/packages/mdx#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/atom63/atom63-design-system/issues"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"atom63",
|
|
20
|
+
"design-system",
|
|
21
|
+
"mdx",
|
|
22
|
+
"react",
|
|
23
|
+
"prose"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"module": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"@atom63/source": "./src/index.ts",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./blocks": {
|
|
36
|
+
"@atom63/source": "./src/blocks/index.ts",
|
|
37
|
+
"types": "./dist/blocks/index.d.ts",
|
|
38
|
+
"import": "./dist/blocks/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./blocks/credits-block": {
|
|
41
|
+
"@atom63/source": "./src/blocks/credits-block-entry.ts",
|
|
42
|
+
"types": "./dist/blocks/credits-block-entry.d.ts",
|
|
43
|
+
"import": "./dist/blocks/credits-block-entry.js"
|
|
44
|
+
},
|
|
45
|
+
"./blocks/media-caption": {
|
|
46
|
+
"@atom63/source": "./src/blocks/media-caption-entry.ts",
|
|
47
|
+
"types": "./dist/blocks/media-caption-entry.d.ts",
|
|
48
|
+
"import": "./dist/blocks/media-caption-entry.js"
|
|
49
|
+
},
|
|
50
|
+
"./article": {
|
|
51
|
+
"@atom63/source": "./src/article/index.ts",
|
|
52
|
+
"types": "./dist/article/index.d.ts",
|
|
53
|
+
"import": "./dist/article/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./editor": {
|
|
56
|
+
"@atom63/source": "./src/editor/index.ts",
|
|
57
|
+
"types": "./dist/editor/index.d.ts",
|
|
58
|
+
"import": "./dist/editor/index.js"
|
|
59
|
+
},
|
|
60
|
+
"./lightbox": {
|
|
61
|
+
"@atom63/source": "./src/lightbox/index.ts",
|
|
62
|
+
"types": "./dist/lightbox/index.d.ts",
|
|
63
|
+
"import": "./dist/lightbox/index.js"
|
|
64
|
+
},
|
|
65
|
+
"./runtime": {
|
|
66
|
+
"@atom63/source": "./src/runtime/index.ts",
|
|
67
|
+
"types": "./dist/runtime/index.d.ts",
|
|
68
|
+
"import": "./dist/runtime/index.js"
|
|
69
|
+
},
|
|
70
|
+
"./primitives": {
|
|
71
|
+
"@atom63/source": "./src/primitives/index.ts",
|
|
72
|
+
"types": "./dist/primitives/index.d.ts",
|
|
73
|
+
"import": "./dist/primitives/index.js"
|
|
74
|
+
},
|
|
75
|
+
"./styles/index.css": "./src/styles/index.css",
|
|
76
|
+
"./styles/a63.css": "./src/styles/a63.css",
|
|
77
|
+
"./styles/shadcn.css": "./src/styles/shadcn.css",
|
|
78
|
+
"./styles/mdx-blocks.css": "./src/styles/mdx-blocks.css",
|
|
79
|
+
"./styles/consumer.css": "./src/styles/consumer.css"
|
|
80
|
+
},
|
|
81
|
+
"sideEffects": [
|
|
82
|
+
"*.css",
|
|
83
|
+
"**/*.css"
|
|
84
|
+
],
|
|
85
|
+
"files": [
|
|
86
|
+
"API.md",
|
|
87
|
+
"CONTRIBUTING.md",
|
|
88
|
+
"dist",
|
|
89
|
+
"src/**/*.css"
|
|
90
|
+
],
|
|
91
|
+
"dependencies": {
|
|
92
|
+
"@base-ui/react": "1.6.0",
|
|
93
|
+
"@mdx-js/mdx": "^3.1.0",
|
|
94
|
+
"@mdx-js/react": "^3.1.1",
|
|
95
|
+
"beautiful-mermaid": "^1.1.3",
|
|
96
|
+
"clsx": "^2.1.1",
|
|
97
|
+
"lucide-react": "^1.34.0",
|
|
98
|
+
"motion": "^13.1.1",
|
|
99
|
+
"react-compare-slider": "^4.0.0",
|
|
100
|
+
"react-simple-code-editor": "^0.14.1",
|
|
101
|
+
"shiki": "^4.3.1",
|
|
102
|
+
"@atom63/styles": "0.1.0-beta.5",
|
|
103
|
+
"@atom63/ui-react": "0.2.0-beta.9"
|
|
104
|
+
},
|
|
105
|
+
"peerDependencies": {
|
|
106
|
+
"react": "^19.1.0",
|
|
107
|
+
"react-dom": "^19.1.0"
|
|
108
|
+
},
|
|
109
|
+
"devDependencies": {
|
|
110
|
+
"@storybook/addon-docs": "^10.6.0",
|
|
111
|
+
"@storybook/react-vite": "^10.6.0",
|
|
112
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
113
|
+
"@testing-library/react": "16.3.2",
|
|
114
|
+
"@types/node": "^26.3.0",
|
|
115
|
+
"@types/react": "^19.2.17",
|
|
116
|
+
"@types/react-dom": "^19.1.9",
|
|
117
|
+
"@vitejs/plugin-react": "^6.1.0",
|
|
118
|
+
"axe-core": "^4.12.1",
|
|
119
|
+
"eslint": "10.7.0",
|
|
120
|
+
"jsdom": "29.1.1",
|
|
121
|
+
"react": "^19.2.7",
|
|
122
|
+
"react-dom": "^19.2.7",
|
|
123
|
+
"storybook": "^10.6.0",
|
|
124
|
+
"tsup": "^8.3.5",
|
|
125
|
+
"typescript": "~5.8.3",
|
|
126
|
+
"vitest": "4.1.11",
|
|
127
|
+
"vitest-axe": "^0.1.0",
|
|
128
|
+
"@atom63/eslint-config": "0.1.0",
|
|
129
|
+
"@atom63/tsconfig": "0.1.0"
|
|
130
|
+
},
|
|
131
|
+
"scripts": {
|
|
132
|
+
"build": "tsup",
|
|
133
|
+
"dev": "tsup --watch",
|
|
134
|
+
"typecheck": "tsc --noEmit",
|
|
135
|
+
"lint": "eslint . --cache --max-warnings 0",
|
|
136
|
+
"test": "vitest run",
|
|
137
|
+
"test:watch": "vitest"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Callout recipe — status-callout chrome on --a63-* tokens (in @layer
|
|
3
|
+
* components so consumer utilities override). Each tone tints the border,
|
|
4
|
+
* fill and icon with its status color, the same mix ui-react's Alert uses;
|
|
5
|
+
* the text stays on the primary text token so it keeps its contrast.
|
|
6
|
+
*/
|
|
7
|
+
@layer components {
|
|
8
|
+
.callout {
|
|
9
|
+
--callout-tone: var(--a63-status-info);
|
|
10
|
+
|
|
11
|
+
border-radius: var(--radius-lg);
|
|
12
|
+
border-width: 1px;
|
|
13
|
+
border-color: color-mix(in oklch, var(--callout-tone) 32%, transparent);
|
|
14
|
+
background-color: color-mix(in oklch, var(--callout-tone) 4%, transparent);
|
|
15
|
+
color: var(--a63-text-primary);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.callout[data-tone='warning'] {
|
|
19
|
+
--callout-tone: var(--a63-status-warning);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.callout[data-tone='error'] {
|
|
23
|
+
--callout-tone: var(--a63-action-danger);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.callout[data-tone='success'] {
|
|
27
|
+
--callout-tone: var(--a63-status-success);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.callout [data-slot='icon'] {
|
|
31
|
+
color: var(--callout-tone);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.mdx-callout-title {
|
|
35
|
+
color: var(--a63-text-primary);
|
|
36
|
+
}
|
|
37
|
+
}
|