@docubook/mdx-content 3.4.1 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/next/index.d.ts +54 -5
- package/dist/adapters/next/index.js +420 -4
- package/dist/adapters/next/index.js.map +1 -1
- package/dist/chunk-PSDC53TU.js +1056 -0
- package/dist/chunk-PSDC53TU.js.map +1 -0
- package/dist/client.d.ts +91 -9
- package/dist/client.js +1191 -8
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +91 -20
- package/dist/index.js +1245 -19
- package/dist/index.js.map +1 -1
- package/dist/server-BObcTM97.d.ts +100 -0
- package/dist/server.d.ts +3 -11
- package/dist/server.js +40 -10
- package/dist/server.js.map +1 -1
- package/package.json +5 -4
- package/dist/__test__/AccordionMdx.test.d.ts +0 -2
- package/dist/__test__/AccordionMdx.test.d.ts.map +0 -1
- package/dist/__test__/AccordionMdx.test.js +0 -21
- package/dist/__test__/AccordionMdx.test.js.map +0 -1
- package/dist/__test__/AccordionsMdx.test.d.ts +0 -2
- package/dist/__test__/AccordionsMdx.test.d.ts.map +0 -1
- package/dist/__test__/AccordionsMdx.test.js +0 -22
- package/dist/__test__/AccordionsMdx.test.js.map +0 -1
- package/dist/__test__/ButtonMdx.test.d.ts +0 -2
- package/dist/__test__/ButtonMdx.test.d.ts.map +0 -1
- package/dist/__test__/ButtonMdx.test.js +0 -20
- package/dist/__test__/ButtonMdx.test.js.map +0 -1
- package/dist/__test__/CardMdx.test.d.ts +0 -2
- package/dist/__test__/CardMdx.test.d.ts.map +0 -1
- package/dist/__test__/CardMdx.test.js +0 -29
- package/dist/__test__/CardMdx.test.js.map +0 -1
- package/dist/__test__/CardsMdx.test.d.ts +0 -2
- package/dist/__test__/CardsMdx.test.d.ts.map +0 -1
- package/dist/__test__/CardsMdx.test.js +0 -33
- package/dist/__test__/CardsMdx.test.js.map +0 -1
- package/dist/__test__/CodeBlockMdx.test.d.ts +0 -2
- package/dist/__test__/CodeBlockMdx.test.d.ts.map +0 -1
- package/dist/__test__/CodeBlockMdx.test.js +0 -48
- package/dist/__test__/CodeBlockMdx.test.js.map +0 -1
- package/dist/__test__/FileTreeMdx.test.d.ts +0 -2
- package/dist/__test__/FileTreeMdx.test.d.ts.map +0 -1
- package/dist/__test__/FileTreeMdx.test.js +0 -26
- package/dist/__test__/FileTreeMdx.test.js.map +0 -1
- package/dist/__test__/ImageMdx.test.d.ts +0 -2
- package/dist/__test__/ImageMdx.test.d.ts.map +0 -1
- package/dist/__test__/ImageMdx.test.js +0 -32
- package/dist/__test__/ImageMdx.test.js.map +0 -1
- package/dist/__test__/KbdMdx.test.d.ts +0 -2
- package/dist/__test__/KbdMdx.test.d.ts.map +0 -1
- package/dist/__test__/KbdMdx.test.js +0 -27
- package/dist/__test__/KbdMdx.test.js.map +0 -1
- package/dist/__test__/LinkMdx.test.d.ts +0 -2
- package/dist/__test__/LinkMdx.test.d.ts.map +0 -1
- package/dist/__test__/LinkMdx.test.js +0 -29
- package/dist/__test__/LinkMdx.test.js.map +0 -1
- package/dist/__test__/MermaidMdx.test.d.ts +0 -2
- package/dist/__test__/MermaidMdx.test.d.ts.map +0 -1
- package/dist/__test__/MermaidMdx.test.js +0 -287
- package/dist/__test__/MermaidMdx.test.js.map +0 -1
- package/dist/__test__/NoteMdx.test.d.ts +0 -2
- package/dist/__test__/NoteMdx.test.d.ts.map +0 -1
- package/dist/__test__/NoteMdx.test.js +0 -39
- package/dist/__test__/NoteMdx.test.js.map +0 -1
- package/dist/__test__/ReleaseMdx.test.d.ts +0 -2
- package/dist/__test__/ReleaseMdx.test.d.ts.map +0 -1
- package/dist/__test__/ReleaseMdx.test.js +0 -39
- package/dist/__test__/ReleaseMdx.test.js.map +0 -1
- package/dist/__test__/StepperMdx.test.d.ts +0 -2
- package/dist/__test__/StepperMdx.test.d.ts.map +0 -1
- package/dist/__test__/StepperMdx.test.js +0 -25
- package/dist/__test__/StepperMdx.test.js.map +0 -1
- package/dist/__test__/TableMdx.test.d.ts +0 -2
- package/dist/__test__/TableMdx.test.d.ts.map +0 -1
- package/dist/__test__/TableMdx.test.js +0 -25
- package/dist/__test__/TableMdx.test.js.map +0 -1
- package/dist/__test__/TabsMdx.test.d.ts +0 -2
- package/dist/__test__/TabsMdx.test.d.ts.map +0 -1
- package/dist/__test__/TabsMdx.test.js +0 -30
- package/dist/__test__/TabsMdx.test.js.map +0 -1
- package/dist/__test__/TooltipMdx.test.d.ts +0 -2
- package/dist/__test__/TooltipMdx.test.d.ts.map +0 -1
- package/dist/__test__/TooltipMdx.test.js +0 -23
- package/dist/__test__/TooltipMdx.test.js.map +0 -1
- package/dist/__test__/YoutubeMdx.test.d.ts +0 -2
- package/dist/__test__/YoutubeMdx.test.d.ts.map +0 -1
- package/dist/__test__/YoutubeMdx.test.js +0 -25
- package/dist/__test__/YoutubeMdx.test.js.map +0 -1
- package/dist/__test__/utils/ExpandableCode.test.d.ts +0 -2
- package/dist/__test__/utils/ExpandableCode.test.d.ts.map +0 -1
- package/dist/__test__/utils/ExpandableCode.test.js +0 -62
- package/dist/__test__/utils/ExpandableCode.test.js.map +0 -1
- package/dist/__test__/utils/Icon.test.d.ts +0 -2
- package/dist/__test__/utils/Icon.test.d.ts.map +0 -1
- package/dist/__test__/utils/Icon.test.js +0 -29
- package/dist/__test__/utils/Icon.test.js.map +0 -1
- package/dist/adapters/next/ButtonMdx.d.ts +0 -4
- package/dist/adapters/next/ButtonMdx.d.ts.map +0 -1
- package/dist/adapters/next/ButtonMdx.js +0 -8
- package/dist/adapters/next/ButtonMdx.js.map +0 -1
- package/dist/adapters/next/CardMdx.d.ts +0 -4
- package/dist/adapters/next/CardMdx.d.ts.map +0 -1
- package/dist/adapters/next/CardMdx.js +0 -8
- package/dist/adapters/next/CardMdx.js.map +0 -1
- package/dist/adapters/next/ImageMdx.d.ts +0 -8
- package/dist/adapters/next/ImageMdx.d.ts.map +0 -1
- package/dist/adapters/next/ImageMdx.js +0 -8
- package/dist/adapters/next/ImageMdx.js.map +0 -1
- package/dist/adapters/next/LinkMdx.d.ts +0 -3
- package/dist/adapters/next/LinkMdx.d.ts.map +0 -1
- package/dist/adapters/next/LinkMdx.js +0 -11
- package/dist/adapters/next/LinkMdx.js.map +0 -1
- package/dist/adapters/next/index.d.ts.map +0 -1
- package/dist/client.d.ts.map +0 -1
- package/dist/components/AccordionMdx.d.ts +0 -11
- package/dist/components/AccordionMdx.d.ts.map +0 -1
- package/dist/components/AccordionMdx.js +0 -64
- package/dist/components/AccordionMdx.js.map +0 -1
- package/dist/components/AccordionsMdx.d.ts +0 -7
- package/dist/components/AccordionsMdx.d.ts.map +0 -1
- package/dist/components/AccordionsMdx.js +0 -14
- package/dist/components/AccordionsMdx.js.map +0 -1
- package/dist/components/ButtonMdx.d.ts +0 -17
- package/dist/components/ButtonMdx.d.ts.map +0 -1
- package/dist/components/ButtonMdx.js +0 -57
- package/dist/components/ButtonMdx.js.map +0 -1
- package/dist/components/CardMdx.d.ts +0 -17
- package/dist/components/CardMdx.d.ts.map +0 -1
- package/dist/components/CardMdx.js +0 -52
- package/dist/components/CardMdx.js.map +0 -1
- package/dist/components/CardsMdx.d.ts +0 -9
- package/dist/components/CardsMdx.d.ts.map +0 -1
- package/dist/components/CardsMdx.js +0 -9
- package/dist/components/CardsMdx.js.map +0 -1
- package/dist/components/CodeBlockMdx.d.ts +0 -11
- package/dist/components/CodeBlockMdx.d.ts.map +0 -1
- package/dist/components/CodeBlockMdx.js +0 -135
- package/dist/components/CodeBlockMdx.js.map +0 -1
- package/dist/components/FileTreeMdx.d.ts +0 -19
- package/dist/components/FileTreeMdx.d.ts.map +0 -1
- package/dist/components/FileTreeMdx.js +0 -99
- package/dist/components/FileTreeMdx.js.map +0 -1
- package/dist/components/ImageMdx.d.ts +0 -8
- package/dist/components/ImageMdx.d.ts.map +0 -1
- package/dist/components/ImageMdx.js +0 -111
- package/dist/components/ImageMdx.js.map +0 -1
- package/dist/components/KbdMdx.d.ts +0 -9
- package/dist/components/KbdMdx.d.ts.map +0 -1
- package/dist/components/KbdMdx.js +0 -74
- package/dist/components/KbdMdx.js.map +0 -1
- package/dist/components/LinkMdx.d.ts +0 -4
- package/dist/components/LinkMdx.d.ts.map +0 -1
- package/dist/components/LinkMdx.js +0 -10
- package/dist/components/LinkMdx.js.map +0 -1
- package/dist/components/MermaidMdx.d.ts +0 -13
- package/dist/components/MermaidMdx.d.ts.map +0 -1
- package/dist/components/MermaidMdx.js +0 -241
- package/dist/components/MermaidMdx.js.map +0 -1
- package/dist/components/NoteMdx.d.ts +0 -13
- package/dist/components/NoteMdx.d.ts.map +0 -1
- package/dist/components/NoteMdx.js +0 -79
- package/dist/components/NoteMdx.js.map +0 -1
- package/dist/components/ReleaseMdx.d.ts +0 -16
- package/dist/components/ReleaseMdx.d.ts.map +0 -1
- package/dist/components/ReleaseMdx.js +0 -44
- package/dist/components/ReleaseMdx.js.map +0 -1
- package/dist/components/StepperMdx.d.ts +0 -17
- package/dist/components/StepperMdx.d.ts.map +0 -1
- package/dist/components/StepperMdx.js +0 -74
- package/dist/components/StepperMdx.js.map +0 -1
- package/dist/components/TableMdx.d.ts +0 -9
- package/dist/components/TableMdx.d.ts.map +0 -1
- package/dist/components/TableMdx.js +0 -56
- package/dist/components/TableMdx.js.map +0 -1
- package/dist/components/TabsMdx.d.ts +0 -13
- package/dist/components/TabsMdx.d.ts.map +0 -1
- package/dist/components/TabsMdx.js +0 -67
- package/dist/components/TabsMdx.js.map +0 -1
- package/dist/components/TooltipMdx.d.ts +0 -10
- package/dist/components/TooltipMdx.d.ts.map +0 -1
- package/dist/components/TooltipMdx.js +0 -36
- package/dist/components/TooltipMdx.js.map +0 -1
- package/dist/components/YoutubeMdx.d.ts +0 -7
- package/dist/components/YoutubeMdx.d.ts.map +0 -1
- package/dist/components/YoutubeMdx.js +0 -24
- package/dist/components/YoutubeMdx.js.map +0 -1
- package/dist/components/index.d.ts +0 -19
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js +0 -19
- package/dist/components/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/registry/index.d.ts +0 -4
- package/dist/registry/index.d.ts.map +0 -1
- package/dist/registry/index.js +0 -38
- package/dist/registry/index.js.map +0 -1
- package/dist/server.d.ts.map +0 -1
- package/dist/utils/AccordionGroupContext.d.ts +0 -8
- package/dist/utils/AccordionGroupContext.d.ts.map +0 -1
- package/dist/utils/AccordionGroupContext.js +0 -4
- package/dist/utils/AccordionGroupContext.js.map +0 -1
- package/dist/utils/CopyButton.d.ts +0 -6
- package/dist/utils/CopyButton.d.ts.map +0 -1
- package/dist/utils/CopyButton.js +0 -39
- package/dist/utils/CopyButton.js.map +0 -1
- package/dist/utils/ExpandableCode.d.ts +0 -11
- package/dist/utils/ExpandableCode.d.ts.map +0 -1
- package/dist/utils/ExpandableCode.js +0 -78
- package/dist/utils/ExpandableCode.js.map +0 -1
- package/dist/utils/Icon.d.ts +0 -6
- package/dist/utils/Icon.d.ts.map +0 -1
- package/dist/utils/Icon.js +0 -12
- package/dist/utils/Icon.js.map +0 -1
|
@@ -1,5 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentProps, ButtonHTMLAttributes, ComponentType, HTMLAttributes, ReactNode, CSSProperties } from 'react';
|
|
3
|
+
import * as LucideIcons from 'lucide-react';
|
|
4
|
+
import NextImage from 'next/image';
|
|
5
|
+
|
|
6
|
+
type LinkMdxProps = ComponentProps<"a">;
|
|
7
|
+
|
|
8
|
+
declare function LinkMdx({ href, rel, target, ...props }: LinkMdxProps): react.JSX.Element | null;
|
|
9
|
+
|
|
10
|
+
type IconName = keyof typeof LucideIcons;
|
|
11
|
+
type IconProp = IconName | string;
|
|
12
|
+
|
|
13
|
+
type LinkRenderer$1 = ComponentType<LinkMdxProps>;
|
|
14
|
+
type ButtonMdxProps$1 = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
15
|
+
href?: string;
|
|
16
|
+
variant?: "primary" | "secondary" | "ghost";
|
|
17
|
+
size?: "sm" | "md" | "lg";
|
|
18
|
+
icon?: IconProp;
|
|
19
|
+
text?: string;
|
|
20
|
+
target?: string;
|
|
21
|
+
/** Internal adapter hook: inject framework link component without duplicating styles. */
|
|
22
|
+
__LinkComponent?: LinkRenderer$1;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
type ButtonMdxProps = Omit<ButtonMdxProps$1, "__LinkComponent">;
|
|
26
|
+
declare function ButtonMdx(props: ButtonMdxProps): react.JSX.Element;
|
|
27
|
+
|
|
28
|
+
type LinkRenderer = ComponentType<LinkMdxProps>;
|
|
29
|
+
type CardMdxProps$1 = HTMLAttributes<HTMLDivElement> & {
|
|
30
|
+
title: string;
|
|
31
|
+
icon?: IconProp;
|
|
32
|
+
href?: string;
|
|
33
|
+
horizontal?: boolean;
|
|
34
|
+
children?: ReactNode;
|
|
35
|
+
style?: CSSProperties;
|
|
36
|
+
/** Internal adapter hook: inject framework link component without duplicating styles. */
|
|
37
|
+
__LinkComponent?: LinkRenderer;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
type CardMdxProps = Omit<CardMdxProps$1, "__LinkComponent">;
|
|
41
|
+
declare function CardMdx(props: CardMdxProps): react.JSX.Element;
|
|
42
|
+
|
|
43
|
+
type ImageMdxProps$1 = Omit<ComponentProps<"img">, "src"> & {
|
|
44
|
+
src?: any;
|
|
45
|
+
zoom?: boolean;
|
|
46
|
+
ImageComponent?: ComponentType<any>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
type ImageMdxProps = Omit<ImageMdxProps$1, "src"> & {
|
|
50
|
+
src?: ComponentProps<typeof NextImage>["src"];
|
|
51
|
+
};
|
|
52
|
+
declare function ImageMdx(props: ImageMdxProps): react.JSX.Element;
|
|
53
|
+
|
|
54
|
+
export { ButtonMdx, CardMdx, ImageMdx, type ImageMdxProps, LinkMdx };
|
|
@@ -1,5 +1,421 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/adapters/next/LinkMdx.tsx
|
|
4
|
+
import NextLink from "next/link";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
function LinkMdx({ href, rel, target, ...props }) {
|
|
7
|
+
if (!href) return null;
|
|
8
|
+
const external = /^https?:\/\//.test(href);
|
|
9
|
+
const computedTarget = target ?? (external ? "_blank" : void 0);
|
|
10
|
+
const computedRel = rel ?? (external ? "noopener noreferrer" : void 0);
|
|
11
|
+
return /* @__PURE__ */ jsx(NextLink, { href, target: computedTarget, rel: computedRel, ...props });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// src/components/LinkMdx.tsx
|
|
15
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
16
|
+
function LinkMdx2({ href, rel, target, ...props }) {
|
|
17
|
+
if (!href) return null;
|
|
18
|
+
const external = /^https?:\/\//.test(href);
|
|
19
|
+
const computedTarget = target ?? (external ? "_blank" : void 0);
|
|
20
|
+
const computedRel = rel ?? (external ? "noopener noreferrer" : void 0);
|
|
21
|
+
return /* @__PURE__ */ jsx2("a", { href, target: computedTarget, rel: computedRel, ...props });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// src/utils/Icon.tsx
|
|
25
|
+
import * as LucideIcons from "lucide-react";
|
|
26
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
27
|
+
var DEFAULT_ICON_SIZE = 20;
|
|
28
|
+
function resolveLucideIcon(icon) {
|
|
29
|
+
const normalized = typeof icon === "string" ? icon.trim() : icon;
|
|
30
|
+
if (!normalized || !Object.hasOwn(LucideIcons, normalized)) {
|
|
31
|
+
return void 0;
|
|
32
|
+
}
|
|
33
|
+
const IconComponent = LucideIcons[normalized];
|
|
34
|
+
return /* @__PURE__ */ jsx3(IconComponent, { size: DEFAULT_ICON_SIZE });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/components/ButtonMdx.tsx
|
|
38
|
+
import { Fragment, jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
39
|
+
var baseStyle = {
|
|
40
|
+
display: "inline-flex",
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
justifyContent: "center",
|
|
43
|
+
gap: "0.375rem",
|
|
44
|
+
borderRadius: 10,
|
|
45
|
+
border: "1px solid hsl(var(--border-color, 210 20% 85%))",
|
|
46
|
+
background: "hsl(var(--card, 0 0% 100%))",
|
|
47
|
+
color: "hsl(var(--foreground, 220 30% 15%))",
|
|
48
|
+
textDecoration: "none",
|
|
49
|
+
fontWeight: 600,
|
|
50
|
+
fontSize: "0.9rem",
|
|
51
|
+
lineHeight: 1,
|
|
52
|
+
padding: "0.65rem 0.85rem",
|
|
53
|
+
cursor: "pointer"
|
|
54
|
+
};
|
|
55
|
+
var variantStyles = {
|
|
56
|
+
primary: {
|
|
57
|
+
background: "hsl(var(--accent, 200 100% 40%))",
|
|
58
|
+
borderColor: "hsl(var(--accent, 200 100% 40%))",
|
|
59
|
+
color: "#ffffff"
|
|
60
|
+
},
|
|
61
|
+
secondary: {
|
|
62
|
+
background: "hsl(var(--muted, 210 20% 92%))",
|
|
63
|
+
color: "hsl(var(--foreground, 220 30% 15%))"
|
|
64
|
+
},
|
|
65
|
+
ghost: {
|
|
66
|
+
background: "transparent",
|
|
67
|
+
borderColor: "transparent",
|
|
68
|
+
color: "hsl(var(--foreground, 220 30% 15%))"
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var sizeStyles = {
|
|
72
|
+
sm: { padding: "0.45rem 0.6rem", fontSize: "0.8rem" },
|
|
73
|
+
md: { padding: "0.65rem 0.85rem", fontSize: "0.9rem" },
|
|
74
|
+
lg: { padding: "0.8rem 1rem", fontSize: "0.96rem" }
|
|
75
|
+
};
|
|
76
|
+
function ButtonMdx({
|
|
77
|
+
href,
|
|
78
|
+
variant,
|
|
79
|
+
size = "md",
|
|
80
|
+
icon,
|
|
81
|
+
text,
|
|
82
|
+
style,
|
|
83
|
+
children,
|
|
84
|
+
target,
|
|
85
|
+
__LinkComponent,
|
|
86
|
+
...props
|
|
87
|
+
}) {
|
|
88
|
+
const resolvedVariant = variant ?? "secondary";
|
|
89
|
+
const mergedStyle = {
|
|
90
|
+
...baseStyle,
|
|
91
|
+
...variantStyles[resolvedVariant],
|
|
92
|
+
...sizeStyles[size],
|
|
93
|
+
...style
|
|
94
|
+
};
|
|
95
|
+
const resolvedIcon = resolveLucideIcon(icon);
|
|
96
|
+
const LinkComponent = __LinkComponent ?? LinkMdx2;
|
|
97
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
98
|
+
resolvedIcon ? /* @__PURE__ */ jsx4(
|
|
99
|
+
"span",
|
|
100
|
+
{
|
|
101
|
+
"aria-hidden": "true",
|
|
102
|
+
style: { display: "inline-flex", alignItems: "center", justifyContent: "center" },
|
|
103
|
+
children: resolvedIcon
|
|
104
|
+
}
|
|
105
|
+
) : null,
|
|
106
|
+
text ?? children
|
|
107
|
+
] });
|
|
108
|
+
if (href) {
|
|
109
|
+
return /* @__PURE__ */ jsx4(LinkComponent, { href, target, style: mergedStyle, children: content });
|
|
110
|
+
}
|
|
111
|
+
return /* @__PURE__ */ jsx4("button", { type: props.type ?? "button", ...props, style: mergedStyle, children: content });
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// src/adapters/next/ButtonMdx.tsx
|
|
115
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
116
|
+
function ButtonMdx2(props) {
|
|
117
|
+
return /* @__PURE__ */ jsx5(ButtonMdx, { ...props, __LinkComponent: LinkMdx });
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// src/components/CardMdx.tsx
|
|
121
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
122
|
+
var baseStyle2 = {
|
|
123
|
+
display: "block",
|
|
124
|
+
border: "1px solid hsl(var(--border-color, 210 20% 85%))",
|
|
125
|
+
borderRadius: 14,
|
|
126
|
+
background: "hsl(var(--card, 0 0% 100%))",
|
|
127
|
+
color: "hsl(var(--foreground, 220 30% 15%))",
|
|
128
|
+
textDecoration: "none",
|
|
129
|
+
padding: "1rem",
|
|
130
|
+
minHeight: 120,
|
|
131
|
+
boxShadow: "0 0 0 rgba(0,0,0,0)",
|
|
132
|
+
transition: "border-color 0.2s ease, box-shadow 0.24s ease, transform 0.24s ease, color 0.2s ease",
|
|
133
|
+
overflow: "hidden"
|
|
134
|
+
};
|
|
135
|
+
function CardMdx({
|
|
136
|
+
title,
|
|
137
|
+
icon,
|
|
138
|
+
href,
|
|
139
|
+
horizontal,
|
|
140
|
+
children,
|
|
141
|
+
style,
|
|
142
|
+
className,
|
|
143
|
+
__LinkComponent,
|
|
144
|
+
...props
|
|
145
|
+
}) {
|
|
146
|
+
const resolvedIcon = resolveLucideIcon(icon);
|
|
147
|
+
const LinkComponent = __LinkComponent ?? LinkMdx2;
|
|
148
|
+
const content = /* @__PURE__ */ jsxs2(
|
|
149
|
+
"div",
|
|
150
|
+
{
|
|
151
|
+
style: {
|
|
152
|
+
display: "grid",
|
|
153
|
+
gridTemplateColumns: horizontal ? "auto 1fr" : "1fr",
|
|
154
|
+
gap: horizontal ? "0.75rem" : "0.4rem",
|
|
155
|
+
alignItems: horizontal ? "flex-start" : "flex-start"
|
|
156
|
+
},
|
|
157
|
+
children: [
|
|
158
|
+
resolvedIcon ? /* @__PURE__ */ jsx6(
|
|
159
|
+
"span",
|
|
160
|
+
{
|
|
161
|
+
"aria-hidden": "true",
|
|
162
|
+
"data-card-icon": "",
|
|
163
|
+
style: {
|
|
164
|
+
display: "block",
|
|
165
|
+
alignItems: "center",
|
|
166
|
+
justifyContent: "center",
|
|
167
|
+
width: "1rem",
|
|
168
|
+
height: "1rem",
|
|
169
|
+
color: "hsl(var(--primary, 210 81% 56%))",
|
|
170
|
+
fontSize: "2rem",
|
|
171
|
+
transition: "transform 0.2s ease, color 0.2s ease"
|
|
172
|
+
},
|
|
173
|
+
children: resolvedIcon
|
|
174
|
+
}
|
|
175
|
+
) : null,
|
|
176
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "grid", gridAutoRows: "min-content", gap: 0 }, children: [
|
|
177
|
+
/* @__PURE__ */ jsx6(
|
|
178
|
+
"div",
|
|
179
|
+
{
|
|
180
|
+
style: {
|
|
181
|
+
fontWeight: 700,
|
|
182
|
+
fontSize: "1.22rem",
|
|
183
|
+
lineHeight: 1.3,
|
|
184
|
+
color: "hsl(var(--foreground, 220 30% 15%))"
|
|
185
|
+
},
|
|
186
|
+
children: title
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
children ? /* @__PURE__ */ jsx6(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
style: {
|
|
193
|
+
color: "hsl(var(--muted-foreground, 220 15% 50%))",
|
|
194
|
+
fontSize: "0.96rem",
|
|
195
|
+
lineHeight: 1.42,
|
|
196
|
+
marginTop: "-0.5rem"
|
|
197
|
+
},
|
|
198
|
+
children
|
|
199
|
+
}
|
|
200
|
+
) : null
|
|
201
|
+
] })
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
const combinedStyle = { ...baseStyle2, ...style };
|
|
206
|
+
if (href) {
|
|
207
|
+
return /* @__PURE__ */ jsx6(
|
|
208
|
+
LinkComponent,
|
|
209
|
+
{
|
|
210
|
+
href,
|
|
211
|
+
"data-card-hover": "",
|
|
212
|
+
"data-card-link": "",
|
|
213
|
+
style: combinedStyle,
|
|
214
|
+
...className ? { className } : {},
|
|
215
|
+
...props,
|
|
216
|
+
children: content
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
return /* @__PURE__ */ jsx6("div", { style: combinedStyle, ...className ? { className } : {}, ...props, children: content });
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// src/adapters/next/CardMdx.tsx
|
|
224
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
225
|
+
function CardMdx2(props) {
|
|
226
|
+
return /* @__PURE__ */ jsx7(CardMdx, { ...props, __LinkComponent: LinkMdx });
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// src/adapters/next/ImageMdx.tsx
|
|
230
|
+
import NextImage from "next/image";
|
|
231
|
+
|
|
232
|
+
// src/components/ImageMdx.tsx
|
|
233
|
+
import { createPortal } from "react-dom";
|
|
234
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
235
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
236
|
+
function ImageMdx({
|
|
237
|
+
src,
|
|
238
|
+
alt = "image",
|
|
239
|
+
width = 800,
|
|
240
|
+
height = 350,
|
|
241
|
+
zoom = true,
|
|
242
|
+
style,
|
|
243
|
+
ImageComponent,
|
|
244
|
+
...props
|
|
245
|
+
}) {
|
|
246
|
+
const Image = ImageComponent ?? "img";
|
|
247
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
248
|
+
const scrollYRef = useRef(0);
|
|
249
|
+
const closeButtonRef = useRef(null);
|
|
250
|
+
const dialogId = useId();
|
|
251
|
+
useEffect(() => {
|
|
252
|
+
if (!isOpen) return;
|
|
253
|
+
scrollYRef.current = window.scrollY;
|
|
254
|
+
document.body.style.position = "fixed";
|
|
255
|
+
document.body.style.top = `-${scrollYRef.current}px`;
|
|
256
|
+
document.body.style.width = "100%";
|
|
257
|
+
closeButtonRef.current?.focus();
|
|
258
|
+
const onEsc = (e) => {
|
|
259
|
+
if (e.key === "Escape") setIsOpen(false);
|
|
260
|
+
};
|
|
261
|
+
const onFocusTrap = (e) => {
|
|
262
|
+
if (e.key !== "Tab") return;
|
|
263
|
+
const dialog = document.getElementById(dialogId);
|
|
264
|
+
const focusable = dialog?.querySelectorAll(
|
|
265
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
266
|
+
);
|
|
267
|
+
if (!focusable || focusable.length === 0) return;
|
|
268
|
+
const first = focusable[0];
|
|
269
|
+
const last = focusable[focusable.length - 1];
|
|
270
|
+
if (!e.shiftKey && document.activeElement === last) {
|
|
271
|
+
e.preventDefault();
|
|
272
|
+
first.focus();
|
|
273
|
+
}
|
|
274
|
+
if (e.shiftKey && document.activeElement === first) {
|
|
275
|
+
e.preventDefault();
|
|
276
|
+
last.focus();
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
window.addEventListener("keydown", onEsc);
|
|
280
|
+
window.addEventListener("keydown", onFocusTrap);
|
|
281
|
+
return () => {
|
|
282
|
+
document.body.style.position = "";
|
|
283
|
+
document.body.style.top = "";
|
|
284
|
+
document.body.style.width = "";
|
|
285
|
+
window.scrollTo(0, scrollYRef.current);
|
|
286
|
+
window.removeEventListener("keydown", onEsc);
|
|
287
|
+
window.removeEventListener("keydown", onFocusTrap);
|
|
288
|
+
};
|
|
289
|
+
}, [dialogId, isOpen]);
|
|
290
|
+
if (!src) return null;
|
|
291
|
+
const canZoom = zoom;
|
|
292
|
+
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
293
|
+
/* @__PURE__ */ jsx8(
|
|
294
|
+
"button",
|
|
295
|
+
{
|
|
296
|
+
type: "button",
|
|
297
|
+
onClick: () => canZoom && setIsOpen(true),
|
|
298
|
+
"aria-label": canZoom ? "Zoom image" : "Image",
|
|
299
|
+
style: {
|
|
300
|
+
position: "relative",
|
|
301
|
+
width: "100%",
|
|
302
|
+
border: "none",
|
|
303
|
+
background: "transparent",
|
|
304
|
+
padding: 0,
|
|
305
|
+
margin: "1rem 0",
|
|
306
|
+
cursor: canZoom ? "zoom-in" : "default"
|
|
307
|
+
},
|
|
308
|
+
children: /* @__PURE__ */ jsx8(
|
|
309
|
+
Image,
|
|
310
|
+
{
|
|
311
|
+
src,
|
|
312
|
+
alt,
|
|
313
|
+
width: typeof width === "number" ? width : parseInt(width, 10),
|
|
314
|
+
height: typeof height === "number" ? height : parseInt(height, 10),
|
|
315
|
+
style: {
|
|
316
|
+
width: "100%",
|
|
317
|
+
height: "auto",
|
|
318
|
+
borderRadius: 10,
|
|
319
|
+
objectFit: "contain",
|
|
320
|
+
...style
|
|
321
|
+
},
|
|
322
|
+
...props
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
canZoom && isOpen ? /* @__PURE__ */ jsx8(Portal, { children: /* @__PURE__ */ jsxs3(
|
|
328
|
+
"div",
|
|
329
|
+
{
|
|
330
|
+
id: dialogId,
|
|
331
|
+
role: "dialog",
|
|
332
|
+
"aria-modal": "true",
|
|
333
|
+
"aria-label": "Image preview",
|
|
334
|
+
onClick: () => setIsOpen(false),
|
|
335
|
+
style: {
|
|
336
|
+
position: "fixed",
|
|
337
|
+
inset: 0,
|
|
338
|
+
zIndex: 99999,
|
|
339
|
+
background: "rgba(0,0,0,0.88)",
|
|
340
|
+
display: "flex",
|
|
341
|
+
alignItems: "center",
|
|
342
|
+
justifyContent: "center",
|
|
343
|
+
padding: "1rem"
|
|
344
|
+
},
|
|
345
|
+
children: [
|
|
346
|
+
/* @__PURE__ */ jsx8(
|
|
347
|
+
"button",
|
|
348
|
+
{
|
|
349
|
+
ref: closeButtonRef,
|
|
350
|
+
type: "button",
|
|
351
|
+
"aria-label": "Close image preview",
|
|
352
|
+
onClick: (e) => {
|
|
353
|
+
e.stopPropagation();
|
|
354
|
+
setIsOpen(false);
|
|
355
|
+
},
|
|
356
|
+
style: {
|
|
357
|
+
position: "absolute",
|
|
358
|
+
top: 16,
|
|
359
|
+
right: 16,
|
|
360
|
+
border: "1px solid rgba(255,255,255,0.24)",
|
|
361
|
+
borderRadius: 8,
|
|
362
|
+
background: "rgba(0,0,0,0.45)",
|
|
363
|
+
color: "#fff",
|
|
364
|
+
padding: "0.4rem 0.55rem",
|
|
365
|
+
cursor: "pointer"
|
|
366
|
+
},
|
|
367
|
+
children: "Close"
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
/* @__PURE__ */ jsx8(
|
|
371
|
+
"div",
|
|
372
|
+
{
|
|
373
|
+
onClick: (e) => e.stopPropagation(),
|
|
374
|
+
style: {
|
|
375
|
+
maxWidth: "92vw",
|
|
376
|
+
maxHeight: "90vh",
|
|
377
|
+
display: "flex",
|
|
378
|
+
alignItems: "center",
|
|
379
|
+
justifyContent: "center"
|
|
380
|
+
},
|
|
381
|
+
children: /* @__PURE__ */ jsx8(
|
|
382
|
+
Image,
|
|
383
|
+
{
|
|
384
|
+
src,
|
|
385
|
+
alt,
|
|
386
|
+
width: 1920,
|
|
387
|
+
height: 1080,
|
|
388
|
+
style: {
|
|
389
|
+
width: "auto",
|
|
390
|
+
height: "auto",
|
|
391
|
+
maxWidth: "92vw",
|
|
392
|
+
maxHeight: "90vh",
|
|
393
|
+
objectFit: "contain",
|
|
394
|
+
borderRadius: 10
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
}
|
|
399
|
+
)
|
|
400
|
+
]
|
|
401
|
+
}
|
|
402
|
+
) }) : null
|
|
403
|
+
] });
|
|
404
|
+
}
|
|
405
|
+
function Portal({ children }) {
|
|
406
|
+
if (typeof window === "undefined") return null;
|
|
407
|
+
return createPortal(children, document.body);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// src/adapters/next/ImageMdx.tsx
|
|
411
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
412
|
+
function ImageMdx2(props) {
|
|
413
|
+
return /* @__PURE__ */ jsx9(ImageMdx, { ImageComponent: NextImage, ...props });
|
|
414
|
+
}
|
|
415
|
+
export {
|
|
416
|
+
ButtonMdx2 as ButtonMdx,
|
|
417
|
+
CardMdx2 as CardMdx,
|
|
418
|
+
ImageMdx2 as ImageMdx,
|
|
419
|
+
LinkMdx
|
|
420
|
+
};
|
|
5
421
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/next/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAsB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/next/LinkMdx.tsx","../../../src/components/LinkMdx.tsx","../../../src/utils/Icon.tsx","../../../src/components/ButtonMdx.tsx","../../../src/adapters/next/ButtonMdx.tsx","../../../src/components/CardMdx.tsx","../../../src/adapters/next/CardMdx.tsx","../../../src/adapters/next/ImageMdx.tsx","../../../src/components/ImageMdx.tsx"],"sourcesContent":["import NextLink from \"next/link\";\nimport type { LinkMdxProps } from \"../../components/LinkMdx\";\n\nexport function LinkMdx({ href, rel, target, ...props }: LinkMdxProps) {\n if (!href) return null;\n\n const external = /^https?:\\/\\//.test(href);\n const computedTarget = target ?? (external ? \"_blank\" : undefined);\n const computedRel = rel ?? (external ? \"noopener noreferrer\" : undefined);\n\n return <NextLink href={href} target={computedTarget} rel={computedRel} {...props} />;\n}\n","import type { ComponentProps } from \"react\";\n\nexport type LinkMdxProps = ComponentProps<\"a\">;\n\nexport function LinkMdx({ href, rel, target, ...props }: LinkMdxProps) {\n if (!href) return null;\n\n const external = /^https?:\\/\\//.test(href);\n const computedTarget = target ?? (external ? \"_blank\" : undefined);\n const computedRel = rel ?? (external ? \"noopener noreferrer\" : undefined);\n\n return <a href={href} target={computedTarget} rel={computedRel} {...props} />;\n}\n","import * as LucideIcons from \"lucide-react\";\nimport type { LucideProps } from \"lucide-react\";\nimport type { ReactNode, ComponentType } from \"react\";\n\nexport type IconName = keyof typeof LucideIcons;\nexport type IconProp = IconName | string;\n\nconst DEFAULT_ICON_SIZE = 20;\n\nexport function resolveLucideIcon(icon?: IconProp): ReactNode {\n const normalized = typeof icon === \"string\" ? icon.trim() : icon;\n if (!normalized || !Object.hasOwn(LucideIcons, normalized)) {\n return undefined;\n }\n\n const IconComponent = LucideIcons[normalized as IconName] as ComponentType<LucideProps>;\n\n return <IconComponent size={DEFAULT_ICON_SIZE} />;\n}\n","import type { ButtonHTMLAttributes, ComponentType, CSSProperties } from \"react\";\nimport { LinkMdx } from \"./LinkMdx\";\nimport { IconProp, resolveLucideIcon } from \"../utils/Icon\";\nimport type { LinkMdxProps } from \"./LinkMdx\";\n\ntype LinkRenderer = ComponentType<LinkMdxProps>;\n\nexport type ButtonMdxProps = ButtonHTMLAttributes<HTMLButtonElement> & {\n href?: string;\n variant?: \"primary\" | \"secondary\" | \"ghost\";\n size?: \"sm\" | \"md\" | \"lg\";\n icon?: IconProp;\n text?: string;\n target?: string;\n /** Internal adapter hook: inject framework link component without duplicating styles. */\n __LinkComponent?: LinkRenderer;\n};\n\nconst baseStyle: CSSProperties = {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"0.375rem\",\n borderRadius: 10,\n border: \"1px solid hsl(var(--border-color, 210 20% 85%))\",\n background: \"hsl(var(--card, 0 0% 100%))\",\n color: \"hsl(var(--foreground, 220 30% 15%))\",\n textDecoration: \"none\",\n fontWeight: 600,\n fontSize: \"0.9rem\",\n lineHeight: 1,\n padding: \"0.65rem 0.85rem\",\n cursor: \"pointer\",\n};\n\nconst variantStyles: Record<NonNullable<ButtonMdxProps[\"variant\"]>, CSSProperties> = {\n primary: {\n background: \"hsl(var(--accent, 200 100% 40%))\",\n borderColor: \"hsl(var(--accent, 200 100% 40%))\",\n color: \"#ffffff\",\n },\n secondary: {\n background: \"hsl(var(--muted, 210 20% 92%))\",\n color: \"hsl(var(--foreground, 220 30% 15%))\",\n },\n ghost: {\n background: \"transparent\",\n borderColor: \"transparent\",\n color: \"hsl(var(--foreground, 220 30% 15%))\",\n },\n};\n\nconst sizeStyles: Record<NonNullable<ButtonMdxProps[\"size\"]>, CSSProperties> = {\n sm: { padding: \"0.45rem 0.6rem\", fontSize: \"0.8rem\" },\n md: { padding: \"0.65rem 0.85rem\", fontSize: \"0.9rem\" },\n lg: { padding: \"0.8rem 1rem\", fontSize: \"0.96rem\" },\n};\n\nexport function ButtonMdx({\n href,\n variant,\n size = \"md\",\n icon,\n text,\n style,\n children,\n target,\n __LinkComponent,\n ...props\n}: ButtonMdxProps) {\n const resolvedVariant = variant ?? \"secondary\";\n const mergedStyle = {\n ...baseStyle,\n ...variantStyles[resolvedVariant],\n ...sizeStyles[size],\n ...style,\n };\n const resolvedIcon = resolveLucideIcon(icon);\n const LinkComponent = __LinkComponent ?? LinkMdx;\n const content = (\n <>\n {resolvedIcon ? (\n <span\n aria-hidden=\"true\"\n style={{ display: \"inline-flex\", alignItems: \"center\", justifyContent: \"center\" }}\n >\n {resolvedIcon}\n </span>\n ) : null}\n {text ?? children}\n </>\n );\n\n if (href) {\n return (\n <LinkComponent href={href} target={target} style={mergedStyle}>\n {content}\n </LinkComponent>\n );\n }\n\n return (\n <button type={props.type ?? \"button\"} {...props} style={mergedStyle}>\n {content}\n </button>\n );\n}\n","\"use client\";\n\nimport { ButtonMdx as CoreButtonMdx } from \"../../components/ButtonMdx\";\nimport type { ButtonMdxProps as CoreButtonMdxProps } from \"../../components/ButtonMdx\";\nimport { LinkMdx } from \"./LinkMdx\";\n\nexport type ButtonMdxProps = Omit<CoreButtonMdxProps, \"__LinkComponent\">;\n\nexport function ButtonMdx(props: ButtonMdxProps) {\n return <CoreButtonMdx {...props} __LinkComponent={LinkMdx} />;\n}\n","\"use client\";\n\nimport type { ComponentType, CSSProperties, HTMLAttributes, ReactNode } from \"react\";\nimport { LinkMdx } from \"./LinkMdx\";\nimport { IconProp, resolveLucideIcon } from \"../utils/Icon\";\nimport type { LinkMdxProps } from \"./LinkMdx\";\n\ntype LinkRenderer = ComponentType<LinkMdxProps>;\n\nexport type CardMdxProps = HTMLAttributes<HTMLDivElement> & {\n title: string;\n icon?: IconProp;\n href?: string;\n horizontal?: boolean;\n children?: ReactNode;\n style?: CSSProperties;\n /** Internal adapter hook: inject framework link component without duplicating styles. */\n __LinkComponent?: LinkRenderer;\n};\n\nconst baseStyle: CSSProperties = {\n display: \"block\",\n border: \"1px solid hsl(var(--border-color, 210 20% 85%))\",\n borderRadius: 14,\n background: \"hsl(var(--card, 0 0% 100%))\",\n color: \"hsl(var(--foreground, 220 30% 15%))\",\n textDecoration: \"none\",\n padding: \"1rem\",\n minHeight: 120,\n boxShadow: \"0 0 0 rgba(0,0,0,0)\",\n transition:\n \"border-color 0.2s ease, box-shadow 0.24s ease, transform 0.24s ease, color 0.2s ease\",\n overflow: \"hidden\",\n};\n\nexport function CardMdx({\n title,\n icon,\n href,\n horizontal,\n children,\n style,\n className,\n __LinkComponent,\n ...props\n}: CardMdxProps) {\n const resolvedIcon = resolveLucideIcon(icon);\n const LinkComponent = __LinkComponent ?? LinkMdx;\n\n const content = (\n <div\n style={{\n display: \"grid\",\n gridTemplateColumns: horizontal ? \"auto 1fr\" : \"1fr\",\n gap: horizontal ? \"0.75rem\" : \"0.4rem\",\n alignItems: horizontal ? \"flex-start\" : \"flex-start\",\n }}\n >\n {resolvedIcon ? (\n <span\n aria-hidden=\"true\"\n data-card-icon=\"\"\n style={{\n display: \"block\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: \"1rem\",\n height: \"1rem\",\n color: \"hsl(var(--primary, 210 81% 56%))\",\n fontSize: \"2rem\",\n transition: \"transform 0.2s ease, color 0.2s ease\",\n }}\n >\n {resolvedIcon}\n </span>\n ) : null}\n <div style={{ display: \"grid\", gridAutoRows: \"min-content\", gap: 0 }}>\n <div\n style={{\n fontWeight: 700,\n fontSize: \"1.22rem\",\n lineHeight: 1.3,\n color: \"hsl(var(--foreground, 220 30% 15%))\",\n }}\n >\n {title}\n </div>\n {children ? (\n <div\n style={{\n color: \"hsl(var(--muted-foreground, 220 15% 50%))\",\n fontSize: \"0.96rem\",\n lineHeight: 1.42,\n marginTop: \"-0.5rem\",\n }}\n >\n {children}\n </div>\n ) : null}\n </div>\n </div>\n );\n\n const combinedStyle = { ...baseStyle, ...style };\n\n if (href) {\n return (\n <LinkComponent\n href={href}\n data-card-hover=\"\"\n data-card-link=\"\"\n style={combinedStyle}\n {...(className ? { className } : {})}\n {...(props as React.ComponentProps<typeof LinkComponent>)}\n >\n {content}\n </LinkComponent>\n );\n }\n\n return (\n <div style={combinedStyle} {...(className ? { className } : {})} {...props}>\n {content}\n </div>\n );\n}\n","\"use client\";\n\nimport { CardMdx as CoreCardMdx } from \"../../components/CardMdx\";\nimport type { CardMdxProps as CoreCardMdxProps } from \"../../components/CardMdx\";\nimport { LinkMdx } from \"./LinkMdx\";\n\nexport type CardMdxProps = Omit<CoreCardMdxProps, \"__LinkComponent\">;\n\nexport function CardMdx(props: CardMdxProps) {\n return <CoreCardMdx {...props} __LinkComponent={LinkMdx} />;\n}\n","\"use client\";\n\nimport { type ComponentProps } from \"react\";\nimport NextImage from \"next/image\";\nimport { ImageMdx as CoreImageMdx, type ImageMdxProps as CoreImageMdxProps } from \"../../components/ImageMdx\";\n\nexport type ImageMdxProps = Omit<CoreImageMdxProps, \"src\"> & {\n src?: ComponentProps<typeof NextImage>[\"src\"];\n};\n\nexport function ImageMdx(props: ImageMdxProps) {\n return <CoreImageMdx ImageComponent={NextImage} {...props} />;\n}\n","\"use client\";\n\nimport { createPortal } from \"react-dom\";\nimport { useEffect, useId, useRef, useState, type ComponentProps, type ComponentType } from \"react\";\n\nexport type ImageMdxProps = Omit<ComponentProps<\"img\">, \"src\"> & {\n src?: any;\n zoom?: boolean;\n ImageComponent?: ComponentType<any>;\n};\n\nexport function ImageMdx({\n src,\n alt = \"image\",\n width = 800,\n height = 350,\n zoom = true,\n style,\n ImageComponent,\n ...props\n}: ImageMdxProps) {\n const Image: any = ImageComponent ?? \"img\";\n const [isOpen, setIsOpen] = useState(false);\n const scrollYRef = useRef(0);\n const closeButtonRef = useRef<HTMLButtonElement | null>(null);\n const dialogId = useId();\n\n useEffect(() => {\n if (!isOpen) return;\n\n scrollYRef.current = window.scrollY;\n document.body.style.position = \"fixed\";\n document.body.style.top = `-${scrollYRef.current}px`;\n document.body.style.width = \"100%\";\n\n closeButtonRef.current?.focus();\n\n const onEsc = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") setIsOpen(false);\n };\n\n const onFocusTrap = (e: KeyboardEvent) => {\n if (e.key !== \"Tab\") return;\n\n const dialog = document.getElementById(dialogId);\n const focusable = dialog?.querySelectorAll<HTMLElement>(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n\n if (!focusable || focusable.length === 0) return;\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n\n if (!e.shiftKey && document.activeElement === last) {\n e.preventDefault();\n first.focus();\n }\n\n if (e.shiftKey && document.activeElement === first) {\n e.preventDefault();\n last.focus();\n }\n };\n\n window.addEventListener(\"keydown\", onEsc);\n window.addEventListener(\"keydown\", onFocusTrap);\n\n return () => {\n document.body.style.position = \"\";\n document.body.style.top = \"\";\n document.body.style.width = \"\";\n window.scrollTo(0, scrollYRef.current);\n window.removeEventListener(\"keydown\", onEsc);\n window.removeEventListener(\"keydown\", onFocusTrap);\n };\n }, [dialogId, isOpen]);\n\n if (!src) return null;\n\n const canZoom = zoom;\n\n return (\n <>\n <button\n type=\"button\"\n onClick={() => canZoom && setIsOpen(true)}\n aria-label={canZoom ? \"Zoom image\" : \"Image\"}\n style={{\n position: \"relative\",\n width: \"100%\",\n border: \"none\",\n background: \"transparent\",\n padding: 0,\n margin: \"1rem 0\",\n cursor: canZoom ? \"zoom-in\" : \"default\",\n }}\n >\n <Image\n src={src}\n alt={alt}\n width={typeof width === \"number\" ? width : parseInt(width as string, 10)}\n height={typeof height === \"number\" ? height : parseInt(height as string, 10)}\n style={{\n width: \"100%\",\n height: \"auto\",\n borderRadius: 10,\n objectFit: \"contain\",\n ...style,\n }}\n {...props}\n />\n </button>\n\n {canZoom && isOpen ? (\n <Portal>\n <div\n id={dialogId}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Image preview\"\n onClick={() => setIsOpen(false)}\n style={{\n position: \"fixed\",\n inset: 0,\n zIndex: 99999,\n background: \"rgba(0,0,0,0.88)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n padding: \"1rem\",\n }}\n >\n <button\n ref={closeButtonRef}\n type=\"button\"\n aria-label=\"Close image preview\"\n onClick={(e) => {\n e.stopPropagation();\n setIsOpen(false);\n }}\n style={{\n position: \"absolute\",\n top: 16,\n right: 16,\n border: \"1px solid rgba(255,255,255,0.24)\",\n borderRadius: 8,\n background: \"rgba(0,0,0,0.45)\",\n color: \"#fff\",\n padding: \"0.4rem 0.55rem\",\n cursor: \"pointer\",\n }}\n >\n Close\n </button>\n\n <div\n onClick={(e) => e.stopPropagation()}\n style={{\n maxWidth: \"92vw\",\n maxHeight: \"90vh\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <Image\n src={src}\n alt={alt}\n width={1920}\n height={1080}\n style={{\n width: \"auto\",\n height: \"auto\",\n maxWidth: \"92vw\",\n maxHeight: \"90vh\",\n objectFit: \"contain\",\n borderRadius: 10,\n }}\n />\n </div>\n </div>\n </Portal>\n ) : null}\n </>\n );\n}\n\nfunction Portal({ children }: { children: React.ReactNode }) {\n if (typeof window === \"undefined\") return null;\n return createPortal(children, document.body);\n}\n"],"mappings":";;;AAAA,OAAO,cAAc;AAUV;AAPJ,SAAS,QAAQ,EAAE,MAAM,KAAK,QAAQ,GAAG,MAAM,GAAiB;AACnE,MAAI,CAAC,KAAM,QAAO;AAElB,QAAM,WAAW,eAAe,KAAK,IAAI;AACzC,QAAM,iBAAiB,WAAW,WAAW,WAAW;AACxD,QAAM,cAAc,QAAQ,WAAW,wBAAwB;AAE/D,SAAO,oBAAC,YAAS,MAAY,QAAQ,gBAAgB,KAAK,aAAc,GAAG,OAAO;AACtF;;;ACAW,gBAAAA,YAAA;AAPJ,SAASC,SAAQ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