@docubook/mdx 1.0.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 +118 -0
- package/dist/Card-L5O7G4xG.d.cts +33 -0
- package/dist/Card-L5O7G4xG.d.ts +33 -0
- package/dist/Image-DZPezRHi.d.cts +7 -0
- package/dist/Image-DZPezRHi.d.ts +7 -0
- package/dist/Stepper-B7xt0Dyr.d.cts +53 -0
- package/dist/Stepper-B7xt0Dyr.d.ts +53 -0
- package/dist/adapters/next/index.cjs +204 -0
- package/dist/adapters/next/index.d.cts +15 -0
- package/dist/adapters/next/index.d.ts +15 -0
- package/dist/adapters/next/index.js +166 -0
- package/dist/adapters/react-router/index.cjs +290 -0
- package/dist/adapters/react-router/index.d.cts +11 -0
- package/dist/adapters/react-router/index.d.ts +11 -0
- package/dist/adapters/react-router/index.js +252 -0
- package/dist/core/index.cjs +909 -0
- package/dist/core/index.d.cts +75 -0
- package/dist/core/index.d.ts +75 -0
- package/dist/core/index.js +896 -0
- package/dist/core/server.cjs +465 -0
- package/dist/core/server.d.cts +26 -0
- package/dist/core/server.d.ts +26 -0
- package/dist/core/server.js +428 -0
- package/dist/index.cjs +465 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +428 -0
- package/package.json +98 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Wildan Nursahidan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# @docubook/mdx
|
|
2
|
+
|
|
3
|
+
Framework-agnostic MDX components for React with adapter entrypoints.
|
|
4
|
+
|
|
5
|
+
## Entrypoints
|
|
6
|
+
|
|
7
|
+
- `@docubook/mdx`: server-safe convenience export (alias to subset `core/server`).
|
|
8
|
+
- `@docubook/mdx/core/server`: core components safe for React Server Components.
|
|
9
|
+
- `@docubook/mdx/core/client`: interactive core components (client-only).
|
|
10
|
+
- `@docubook/mdx/next`: Next.js adapters for Link, Image, Button, and Card.
|
|
11
|
+
- `@docubook/mdx/react-router`: React Router DOM adapters.
|
|
12
|
+
|
|
13
|
+
Note: in the current `nextjs app router` integration, the helper uses direct split imports from `core/server` and `core/client` (not the root `@docubook/mdx`).
|
|
14
|
+
|
|
15
|
+
## Adapter Dependency Notes
|
|
16
|
+
|
|
17
|
+
- `@docubook/mdx/next` expects `next` as optional peer dependency.
|
|
18
|
+
- `@docubook/mdx/react-router` expects `react-router-dom` as optional peer dependency.
|
|
19
|
+
- Root and `core/server` entrypoints do not require framework adapters.
|
|
20
|
+
|
|
21
|
+
## Recommended Pattern
|
|
22
|
+
|
|
23
|
+
For app-level MDX registration, use a helper function in app layer (for example `createDocsMdxComponents` in `mdx-components.ts`) and keep framework-specific wiring there.
|
|
24
|
+
|
|
25
|
+
This keeps `lib/markdown.ts` small, avoids repeated component maps, and keeps RSC boundaries explicit.
|
|
26
|
+
|
|
27
|
+
## Next.js App Router
|
|
28
|
+
|
|
29
|
+
Use split imports to avoid Turbopack/RSC errors:
|
|
30
|
+
|
|
31
|
+
- Import server-safe components from `@docubook/mdx/core/server`.
|
|
32
|
+
- Import client-only components from `@docubook/mdx/core/client`.
|
|
33
|
+
- Import Next adapters from `@docubook/mdx/next`.
|
|
34
|
+
- `@docubook/mdx/core` is intentionally not exported; use `@docubook/mdx/core/server` or `@docubook/mdx/core/client` explicitly.
|
|
35
|
+
|
|
36
|
+
### 1) Helper in mdx-components.ts
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import dynamic from "next/dynamic";
|
|
40
|
+
import {
|
|
41
|
+
NextImageMdx as Image,
|
|
42
|
+
NextLinkMdx as Link,
|
|
43
|
+
} from "@docubook/mdx/next";
|
|
44
|
+
import { Pre } from "@docubook/mdx/core/client";
|
|
45
|
+
|
|
46
|
+
const Button = dynamic(() => import("@docubook/mdx/next").then((m) => ({ default: m.NextButtonMdx })));
|
|
47
|
+
const Card = dynamic(() => import("@docubook/mdx/next").then((m) => ({ default: m.NextCardMdx })));
|
|
48
|
+
const Note = dynamic(() => import("@docubook/mdx/core/server").then((m) => ({ default: m.Note })));
|
|
49
|
+
const Tooltip = dynamic(() => import("@docubook/mdx/core/client").then((m) => ({ default: m.Tooltip })));
|
|
50
|
+
const Accordion = dynamic(() => import("@docubook/mdx/core/client").then((m) => ({ default: m.Accordion })));
|
|
51
|
+
|
|
52
|
+
export function createDocsMdxComponents(): Record<string, unknown> {
|
|
53
|
+
return {
|
|
54
|
+
Note,
|
|
55
|
+
Tooltip,
|
|
56
|
+
Accordion,
|
|
57
|
+
Card,
|
|
58
|
+
Button,
|
|
59
|
+
pre: Pre,
|
|
60
|
+
img: Image,
|
|
61
|
+
a: Link,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 2) Service integration in markdown.ts
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import { createMdxContentService } from "@docubook/core";
|
|
70
|
+
import { createDocsMdxComponents } from "@/mdx-components";
|
|
71
|
+
import Outlet from "@/lib/markdown/OutletMdx";
|
|
72
|
+
|
|
73
|
+
const components = {
|
|
74
|
+
...createDocsMdxComponents(),
|
|
75
|
+
Outlet,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const docsService = createMdxContentService({
|
|
79
|
+
parseOptions: { components },
|
|
80
|
+
});
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Component Split Reference
|
|
84
|
+
|
|
85
|
+
Use this as practical guidance for helper imports:
|
|
86
|
+
|
|
87
|
+
| Component | Runtime | Import Path | Notes |
|
|
88
|
+
| -------------- | ----------------- | --------------------------- | -------------------------------------------------------------- |
|
|
89
|
+
| CardGroup | Server-safe | `@docubook/mdx/core/server` | Non-interactive layout component. |
|
|
90
|
+
| Changes | Server-safe | `@docubook/mdx/core/server` | Used together with `Release`. |
|
|
91
|
+
| Kbd | Server-safe | `@docubook/mdx/core/server` | The markdown alias `kbd` is also available in helper mapping. |
|
|
92
|
+
| Note | Server-safe | `@docubook/mdx/core/server` | Can be used in the helper without a dedicated client boundary. |
|
|
93
|
+
| Release | Server-safe | `@docubook/mdx/core/server` | Changelog component without React client hooks. |
|
|
94
|
+
| Stepper | Server-safe | `@docubook/mdx/core/server` | Pairs with `StepperItem`. |
|
|
95
|
+
| StepperItem | Server-safe | `@docubook/mdx/core/server` | Used inside `Stepper`. |
|
|
96
|
+
| Youtube | Server-safe | `@docubook/mdx/core/server` | Iframe embed without React client hooks. |
|
|
97
|
+
| Accordion | Client-only | `@docubook/mdx/core/client` | Uses state/context. |
|
|
98
|
+
| AccordionGroup | Client-only | `@docubook/mdx/core/client` | Context provider for `Accordion`. |
|
|
99
|
+
| Tooltip | Client-only | `@docubook/mdx/core/client` | Uses hover state. |
|
|
100
|
+
| File | Client-only | `@docubook/mdx/core/client` | Interactive tree item (hover/toggle). |
|
|
101
|
+
| Files | Client-only | `@docubook/mdx/core/client` | Interactive tree container. |
|
|
102
|
+
| Folder | Client-only | `@docubook/mdx/core/client` | Expand/collapse state. |
|
|
103
|
+
| Pre | Client-only | `@docubook/mdx/core/client` | Uses interactive copy action. |
|
|
104
|
+
| NextButtonMdx | Adapter (Next.js) | `@docubook/mdx/next` | `Button` wrapper with Next Link behavior. |
|
|
105
|
+
| NextCardMdx | Adapter (Next.js) | `@docubook/mdx/next` | `Card` wrapper with Next Link behavior. |
|
|
106
|
+
| NextImageMdx | Adapter (Next.js) | `@docubook/mdx/next` | For `img` mapping in Next App Router. |
|
|
107
|
+
| NextLinkMdx | Adapter (Next.js) | `@docubook/mdx/next` | For `a` mapping in Next App Router. |
|
|
108
|
+
|
|
109
|
+
## Loading Strategy (Helper)
|
|
110
|
+
|
|
111
|
+
- Prefer static import for high-frequency primitives: `a`, `img`, `pre`.
|
|
112
|
+
- Prefer dynamic import for heavier or less-frequent interactive components.
|
|
113
|
+
- Keep route/data-coupled components (like `Outlet`) in app layer instead of package core.
|
|
114
|
+
- Keep the helper in app layer and keep markdown service focused on content compile/read logic only.
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
MIT
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as Icons from 'lucide-react';
|
|
3
|
+
import { ComponentType, ComponentProps, ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
type LinkLikeProps = Omit<ComponentProps<"a">, "href"> & {
|
|
6
|
+
href: string;
|
|
7
|
+
};
|
|
8
|
+
type LinkRenderer = ComponentType<LinkLikeProps>;
|
|
9
|
+
|
|
10
|
+
type ButtonProps = {
|
|
11
|
+
icon?: keyof typeof Icons;
|
|
12
|
+
text?: string;
|
|
13
|
+
href: string;
|
|
14
|
+
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
15
|
+
size?: "sm" | "md" | "lg";
|
|
16
|
+
variation?: "primary" | "accent" | "outline";
|
|
17
|
+
LinkComponent?: LinkRenderer;
|
|
18
|
+
};
|
|
19
|
+
declare function Button({ icon, text, href, target, size, variation, LinkComponent, }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
20
|
+
|
|
21
|
+
type IconName = keyof typeof Icons;
|
|
22
|
+
interface CardProps {
|
|
23
|
+
title: string;
|
|
24
|
+
icon?: IconName;
|
|
25
|
+
href?: string;
|
|
26
|
+
horizontal?: boolean;
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
className?: string;
|
|
29
|
+
LinkComponent?: LinkRenderer;
|
|
30
|
+
}
|
|
31
|
+
declare function Card({ title, icon, href, horizontal, children, className, LinkComponent, }: CardProps): react_jsx_runtime.JSX.Element;
|
|
32
|
+
|
|
33
|
+
export { Button as B, Card as C, type LinkLikeProps as L, type LinkRenderer as a };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as Icons from 'lucide-react';
|
|
3
|
+
import { ComponentType, ComponentProps, ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
type LinkLikeProps = Omit<ComponentProps<"a">, "href"> & {
|
|
6
|
+
href: string;
|
|
7
|
+
};
|
|
8
|
+
type LinkRenderer = ComponentType<LinkLikeProps>;
|
|
9
|
+
|
|
10
|
+
type ButtonProps = {
|
|
11
|
+
icon?: keyof typeof Icons;
|
|
12
|
+
text?: string;
|
|
13
|
+
href: string;
|
|
14
|
+
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
15
|
+
size?: "sm" | "md" | "lg";
|
|
16
|
+
variation?: "primary" | "accent" | "outline";
|
|
17
|
+
LinkComponent?: LinkRenderer;
|
|
18
|
+
};
|
|
19
|
+
declare function Button({ icon, text, href, target, size, variation, LinkComponent, }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
20
|
+
|
|
21
|
+
type IconName = keyof typeof Icons;
|
|
22
|
+
interface CardProps {
|
|
23
|
+
title: string;
|
|
24
|
+
icon?: IconName;
|
|
25
|
+
href?: string;
|
|
26
|
+
horizontal?: boolean;
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
className?: string;
|
|
29
|
+
LinkComponent?: LinkRenderer;
|
|
30
|
+
}
|
|
31
|
+
declare function Card({ title, icon, href, horizontal, children, className, LinkComponent, }: CardProps): react_jsx_runtime.JSX.Element;
|
|
32
|
+
|
|
33
|
+
export { Button as B, Card as C, type LinkLikeProps as L, type LinkRenderer as a };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
|
|
4
|
+
type ImageProps = ComponentProps<"img">;
|
|
5
|
+
declare function Image({ src, alt, width, height, ...props }: ImageProps): react_jsx_runtime.JSX.Element | null;
|
|
6
|
+
|
|
7
|
+
export { Image as I };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
|
|
4
|
+
type ImageProps = ComponentProps<"img">;
|
|
5
|
+
declare function Image({ src, alt, width, height, ...props }: ImageProps): react_jsx_runtime.JSX.Element | null;
|
|
6
|
+
|
|
7
|
+
export { Image as I };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React__default, { FC, ReactNode, ComponentProps, PropsWithChildren } from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
interface YoutubeProps {
|
|
7
|
+
videoId: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Youtube: FC<YoutubeProps>;
|
|
11
|
+
|
|
12
|
+
interface CardGroupProps {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
cols?: number;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
declare function CardGroup({ children, cols, className }: CardGroupProps): react_jsx_runtime.JSX.Element;
|
|
18
|
+
|
|
19
|
+
interface KbdProps extends React__default.HTMLAttributes<HTMLElement> {
|
|
20
|
+
show?: string;
|
|
21
|
+
type?: "window" | "mac";
|
|
22
|
+
children?: React__default.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
declare function Kbd({ show: keyProp, type, children, ...props }: KbdProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
declare function Link({ href, target, rel, ...props }: ComponentProps<"a">): react_jsx_runtime.JSX.Element | null;
|
|
27
|
+
|
|
28
|
+
declare const noteVariants: (props?: ({
|
|
29
|
+
variant?: "note" | "danger" | "warning" | "success" | null | undefined;
|
|
30
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
31
|
+
interface NoteProps extends React__default.HTMLAttributes<HTMLDivElement>, VariantProps<typeof noteVariants> {
|
|
32
|
+
title?: string;
|
|
33
|
+
type?: "note" | "danger" | "warning" | "success";
|
|
34
|
+
}
|
|
35
|
+
declare function Note({ className, title, type, children, ...props }: NoteProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
|
|
37
|
+
interface ReleaseProps extends PropsWithChildren {
|
|
38
|
+
version: string;
|
|
39
|
+
title: string;
|
|
40
|
+
date?: string;
|
|
41
|
+
}
|
|
42
|
+
declare function Release({ version, title, date, children }: ReleaseProps): react_jsx_runtime.JSX.Element;
|
|
43
|
+
interface ChangesProps extends PropsWithChildren {
|
|
44
|
+
type: "added" | "fixed" | "improved" | "deprecated" | "removed";
|
|
45
|
+
}
|
|
46
|
+
declare function Changes({ type, children }: ChangesProps): react_jsx_runtime.JSX.Element;
|
|
47
|
+
|
|
48
|
+
declare function Stepper({ children }: PropsWithChildren): react_jsx_runtime.JSX.Element;
|
|
49
|
+
declare function StepperItem({ children, title, }: PropsWithChildren & {
|
|
50
|
+
title?: string;
|
|
51
|
+
}): react_jsx_runtime.JSX.Element;
|
|
52
|
+
|
|
53
|
+
export { CardGroup as C, Kbd as K, Link as L, Note as N, Release as R, Stepper as S, type YoutubeProps as Y, StepperItem as a, Changes as b, Youtube as c };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React__default, { FC, ReactNode, ComponentProps, PropsWithChildren } from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
interface YoutubeProps {
|
|
7
|
+
videoId: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Youtube: FC<YoutubeProps>;
|
|
11
|
+
|
|
12
|
+
interface CardGroupProps {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
cols?: number;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
declare function CardGroup({ children, cols, className }: CardGroupProps): react_jsx_runtime.JSX.Element;
|
|
18
|
+
|
|
19
|
+
interface KbdProps extends React__default.HTMLAttributes<HTMLElement> {
|
|
20
|
+
show?: string;
|
|
21
|
+
type?: "window" | "mac";
|
|
22
|
+
children?: React__default.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
declare function Kbd({ show: keyProp, type, children, ...props }: KbdProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
declare function Link({ href, target, rel, ...props }: ComponentProps<"a">): react_jsx_runtime.JSX.Element | null;
|
|
27
|
+
|
|
28
|
+
declare const noteVariants: (props?: ({
|
|
29
|
+
variant?: "note" | "danger" | "warning" | "success" | null | undefined;
|
|
30
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
31
|
+
interface NoteProps extends React__default.HTMLAttributes<HTMLDivElement>, VariantProps<typeof noteVariants> {
|
|
32
|
+
title?: string;
|
|
33
|
+
type?: "note" | "danger" | "warning" | "success";
|
|
34
|
+
}
|
|
35
|
+
declare function Note({ className, title, type, children, ...props }: NoteProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
|
|
37
|
+
interface ReleaseProps extends PropsWithChildren {
|
|
38
|
+
version: string;
|
|
39
|
+
title: string;
|
|
40
|
+
date?: string;
|
|
41
|
+
}
|
|
42
|
+
declare function Release({ version, title, date, children }: ReleaseProps): react_jsx_runtime.JSX.Element;
|
|
43
|
+
interface ChangesProps extends PropsWithChildren {
|
|
44
|
+
type: "added" | "fixed" | "improved" | "deprecated" | "removed";
|
|
45
|
+
}
|
|
46
|
+
declare function Changes({ type, children }: ChangesProps): react_jsx_runtime.JSX.Element;
|
|
47
|
+
|
|
48
|
+
declare function Stepper({ children }: PropsWithChildren): react_jsx_runtime.JSX.Element;
|
|
49
|
+
declare function StepperItem({ children, title, }: PropsWithChildren & {
|
|
50
|
+
title?: string;
|
|
51
|
+
}): react_jsx_runtime.JSX.Element;
|
|
52
|
+
|
|
53
|
+
export { CardGroup as C, Kbd as K, Link as L, Note as N, Release as R, Stepper as S, type YoutubeProps as Y, StepperItem as a, Changes as b, Youtube as c };
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/adapters/next/index.tsx
|
|
31
|
+
var next_exports = {};
|
|
32
|
+
__export(next_exports, {
|
|
33
|
+
NextButtonMdx: () => NextButtonMdx,
|
|
34
|
+
NextCardMdx: () => NextCardMdx,
|
|
35
|
+
NextImageMdx: () => NextImageMdx,
|
|
36
|
+
NextLinkMdx: () => NextLinkMdx
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(next_exports);
|
|
39
|
+
var import_link = __toESM(require("next/link"), 1);
|
|
40
|
+
var import_image = __toESM(require("next/image"), 1);
|
|
41
|
+
|
|
42
|
+
// src/core/components/Button.tsx
|
|
43
|
+
var Icons = __toESM(require("lucide-react"), 1);
|
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
+
function Button({
|
|
46
|
+
icon,
|
|
47
|
+
text,
|
|
48
|
+
href,
|
|
49
|
+
target,
|
|
50
|
+
size = "md",
|
|
51
|
+
variation = "primary",
|
|
52
|
+
LinkComponent
|
|
53
|
+
}) {
|
|
54
|
+
const baseStyles = "inline-flex items-center justify-center rounded font-medium focus:outline-none transition no-underline";
|
|
55
|
+
const sizeStyles = {
|
|
56
|
+
sm: "px-3 py-1 my-6 text-sm",
|
|
57
|
+
md: "px-4 py-2 my-6 text-base",
|
|
58
|
+
lg: "px-5 py-3 my-6 text-lg"
|
|
59
|
+
};
|
|
60
|
+
const variationStyles = {
|
|
61
|
+
primary: "bg-primary text-white hover:bg-primary/90",
|
|
62
|
+
accent: "bg-accent text-white hover:bg-accent/90",
|
|
63
|
+
outline: "border border-accent text-accent hover:bg-accent/10"
|
|
64
|
+
};
|
|
65
|
+
const Icon = icon ? Icons[icon] : null;
|
|
66
|
+
const className = `${baseStyles} ${sizeStyles[size]} ${variationStyles[variation]}`;
|
|
67
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
68
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: text }),
|
|
69
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { className: "mr-2 h-5 w-5" })
|
|
70
|
+
] });
|
|
71
|
+
if (LinkComponent) {
|
|
72
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
73
|
+
LinkComponent,
|
|
74
|
+
{
|
|
75
|
+
href,
|
|
76
|
+
target,
|
|
77
|
+
rel: target === "_blank" ? "noopener noreferrer" : void 0,
|
|
78
|
+
className,
|
|
79
|
+
children: inner
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
+
"a",
|
|
85
|
+
{
|
|
86
|
+
href,
|
|
87
|
+
target,
|
|
88
|
+
rel: target === "_blank" ? "noopener noreferrer" : void 0,
|
|
89
|
+
className,
|
|
90
|
+
children: inner
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// src/core/components/Card.tsx
|
|
96
|
+
var Icons2 = __toESM(require("lucide-react"), 1);
|
|
97
|
+
var import_clsx = __toESM(require("clsx"), 1);
|
|
98
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
99
|
+
function Card({
|
|
100
|
+
title,
|
|
101
|
+
icon,
|
|
102
|
+
href,
|
|
103
|
+
horizontal,
|
|
104
|
+
children,
|
|
105
|
+
className,
|
|
106
|
+
LinkComponent
|
|
107
|
+
}) {
|
|
108
|
+
const Icon = icon ? Icons2[icon] : null;
|
|
109
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
className: (0, import_clsx.default)(
|
|
113
|
+
"border rounded-lg shadow-sm p-4 transition-all duration-200",
|
|
114
|
+
"bg-card text-card-foreground border-border",
|
|
115
|
+
"hover:bg-accent/5 hover:border-accent/30",
|
|
116
|
+
"flex gap-2",
|
|
117
|
+
horizontal ? "flex-row items-start gap-1" : "flex-col space-y-1",
|
|
118
|
+
className
|
|
119
|
+
),
|
|
120
|
+
children: [
|
|
121
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: (0, import_clsx.default)("w-5 h-5 text-primary shrink-0", horizontal && "mt-0.5") }),
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
123
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-base font-semibold text-foreground leading-6", children: title }),
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-sm text-muted-foreground -mt-3", children })
|
|
125
|
+
] })
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
if (!href) return content;
|
|
130
|
+
if (LinkComponent) {
|
|
131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LinkComponent, { href, className: "no-underline block", children: content });
|
|
132
|
+
}
|
|
133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { className: "no-underline block", href, children: content });
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// src/adapters/next/index.tsx
|
|
137
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
138
|
+
function isExternalHref(href) {
|
|
139
|
+
return /^(https?:|mailto:|tel:)/i.test(href);
|
|
140
|
+
}
|
|
141
|
+
function NextLinkMdx({ href, ...props }) {
|
|
142
|
+
if (!href) return null;
|
|
143
|
+
if (isExternalHref(href)) {
|
|
144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
145
|
+
"a",
|
|
146
|
+
{
|
|
147
|
+
href,
|
|
148
|
+
...props,
|
|
149
|
+
target: props.target ?? "_blank",
|
|
150
|
+
rel: props.rel ?? "noopener noreferrer"
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_link.default, { href, ...props });
|
|
155
|
+
}
|
|
156
|
+
var NextLinkRenderer = ({ href, ...props }) => {
|
|
157
|
+
if (isExternalHref(href)) {
|
|
158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
159
|
+
"a",
|
|
160
|
+
{
|
|
161
|
+
href,
|
|
162
|
+
...props,
|
|
163
|
+
target: props.target ?? "_blank",
|
|
164
|
+
rel: props.rel ?? "noopener noreferrer"
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_link.default, { href, ...props });
|
|
169
|
+
};
|
|
170
|
+
function NextButtonMdx(props) {
|
|
171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { ...props, LinkComponent: NextLinkRenderer });
|
|
172
|
+
}
|
|
173
|
+
function NextCardMdx(props) {
|
|
174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Card, { ...props, LinkComponent: NextLinkRenderer });
|
|
175
|
+
}
|
|
176
|
+
function NextImageMdx({
|
|
177
|
+
src,
|
|
178
|
+
alt = "alt",
|
|
179
|
+
width = 800,
|
|
180
|
+
height = 350,
|
|
181
|
+
...props
|
|
182
|
+
}) {
|
|
183
|
+
if (!src) return null;
|
|
184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
185
|
+
import_image.default,
|
|
186
|
+
{
|
|
187
|
+
src,
|
|
188
|
+
alt,
|
|
189
|
+
width,
|
|
190
|
+
height,
|
|
191
|
+
quality: 85,
|
|
192
|
+
sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 800px",
|
|
193
|
+
className: "w-full h-auto rounded-lg transition-transform duration-300 group-hover:scale-[1.01]",
|
|
194
|
+
...props
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
199
|
+
0 && (module.exports = {
|
|
200
|
+
NextButtonMdx,
|
|
201
|
+
NextCardMdx,
|
|
202
|
+
NextImageMdx,
|
|
203
|
+
NextLinkMdx
|
|
204
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import NextImage from 'next/image';
|
|
3
|
+
import { ComponentProps } from 'react';
|
|
4
|
+
import { B as Button, C as Card } from '../../Card-L5O7G4xG.cjs';
|
|
5
|
+
import 'lucide-react';
|
|
6
|
+
|
|
7
|
+
declare function NextLinkMdx({ href, ...props }: ComponentProps<"a">): react_jsx_runtime.JSX.Element | null;
|
|
8
|
+
declare function NextButtonMdx(props: ComponentProps<typeof Button>): react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare function NextCardMdx(props: ComponentProps<typeof Card>): react_jsx_runtime.JSX.Element;
|
|
10
|
+
type NextImageMdxProps = Omit<ComponentProps<"img">, "src"> & {
|
|
11
|
+
src?: ComponentProps<typeof NextImage>["src"];
|
|
12
|
+
};
|
|
13
|
+
declare function NextImageMdx({ src, alt, width, height, ...props }: NextImageMdxProps): react_jsx_runtime.JSX.Element | null;
|
|
14
|
+
|
|
15
|
+
export { NextButtonMdx, NextCardMdx, NextImageMdx, NextLinkMdx };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import NextImage from 'next/image';
|
|
3
|
+
import { ComponentProps } from 'react';
|
|
4
|
+
import { B as Button, C as Card } from '../../Card-L5O7G4xG.js';
|
|
5
|
+
import 'lucide-react';
|
|
6
|
+
|
|
7
|
+
declare function NextLinkMdx({ href, ...props }: ComponentProps<"a">): react_jsx_runtime.JSX.Element | null;
|
|
8
|
+
declare function NextButtonMdx(props: ComponentProps<typeof Button>): react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare function NextCardMdx(props: ComponentProps<typeof Card>): react_jsx_runtime.JSX.Element;
|
|
10
|
+
type NextImageMdxProps = Omit<ComponentProps<"img">, "src"> & {
|
|
11
|
+
src?: ComponentProps<typeof NextImage>["src"];
|
|
12
|
+
};
|
|
13
|
+
declare function NextImageMdx({ src, alt, width, height, ...props }: NextImageMdxProps): react_jsx_runtime.JSX.Element | null;
|
|
14
|
+
|
|
15
|
+
export { NextButtonMdx, NextCardMdx, NextImageMdx, NextLinkMdx };
|