zudoku 0.48.0 → 0.48.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/config/loader.js +1 -1
- package/dist/config/loader.js.map +1 -1
- package/dist/flat-config.d.ts +320 -0
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js +3 -2
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
- package/dist/lib/plugins/api-keys/index.js +23 -2
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/ui/Alert.d.ts +5 -4
- package/dist/lib/ui/Alert.js +12 -10
- package/dist/lib/ui/Alert.js.map +1 -1
- package/dist/lib/ui/CodeBlock.d.ts +1 -2
- package/dist/lib/ui/CodeBlock.js +9 -9
- package/dist/lib/ui/CodeBlock.js.map +1 -1
- package/dist/lib/ui/EmbeddedCodeBlock.d.ts +15 -0
- package/dist/lib/ui/EmbeddedCodeBlock.js +18 -0
- package/dist/lib/ui/EmbeddedCodeBlock.js.map +1 -0
- package/dist/lib/ui/SyntaxHighlight.d.ts +3 -1
- package/dist/lib/ui/SyntaxHighlight.js +3 -2
- package/dist/lib/ui/SyntaxHighlight.js.map +1 -1
- package/dist/lib/util/MdxComponents.d.ts +3 -1
- package/dist/vite/config.js +11 -2
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/plugin-frontmatter.js +2 -0
- package/dist/vite/plugin-frontmatter.js.map +1 -1
- package/lib/{Markdown-DCAIYXF5.js → Markdown-BQ8YqLsz.js} +80 -88
- package/lib/{Markdown-DCAIYXF5.js.map → Markdown-BQ8YqLsz.js.map} +1 -1
- package/lib/{MdxPage-Cf9YXWoC.js → MdxPage-DJvKmI-r.js} +3 -3
- package/lib/{MdxPage-Cf9YXWoC.js.map → MdxPage-DJvKmI-r.js.map} +1 -1
- package/lib/{OasProvider-JMVTfG6_.js → OasProvider-BC0q5m3u.js} +2 -2
- package/lib/{OasProvider-JMVTfG6_.js.map → OasProvider-BC0q5m3u.js.map} +1 -1
- package/lib/{OperationList-m4tFCI4S.js → OperationList-Dpip6ozi.js} +6 -5
- package/lib/{OperationList-m4tFCI4S.js.map → OperationList-Dpip6ozi.js.map} +1 -1
- package/lib/{SchemaList-_wRy4aQ0.js → SchemaList-t4BIfh6Z.js} +5 -5
- package/lib/{SchemaList-_wRy4aQ0.js.map → SchemaList-t4BIfh6Z.js.map} +1 -1
- package/lib/{SchemaView-CRl_cQYH.js → SchemaView-CLxthVcA.js} +3 -3
- package/lib/{SchemaView-CRl_cQYH.js.map → SchemaView-CLxthVcA.js.map} +1 -1
- package/lib/{Slot-BkYrj_uC.js → Slot-CSEIvwwO.js} +57 -56
- package/lib/Slot-CSEIvwwO.js.map +1 -0
- package/lib/{SyntaxHighlight-CH9OUJre.js → SyntaxHighlight-C5ja40ix.js} +715 -714
- package/lib/{SyntaxHighlight-CH9OUJre.js.map → SyntaxHighlight-C5ja40ix.js.map} +1 -1
- package/lib/{Toc-DRxqEsFc.js → Toc-BS0f4GTe.js} +2 -2
- package/lib/{Toc-DRxqEsFc.js.map → Toc-BS0f4GTe.js.map} +1 -1
- package/lib/{circular-wJaV4vh_.js → circular-DfOaDE_x.js} +2 -2
- package/lib/{circular-wJaV4vh_.js.map → circular-DfOaDE_x.js.map} +1 -1
- package/lib/{createServer-DN5AJLcN.js → createServer-DjOMygls.js} +3 -3
- package/lib/{createServer-DN5AJLcN.js.map → createServer-DjOMygls.js.map} +1 -1
- package/lib/{index-DJVaRmzI.js → index-DW2qmCJa.js} +7 -7
- package/lib/{index-DJVaRmzI.js.map → index-DW2qmCJa.js.map} +1 -1
- package/lib/ui/Alert.js +54 -38
- package/lib/ui/Alert.js.map +1 -1
- package/lib/ui/CodeBlock.js +54 -62
- package/lib/ui/CodeBlock.js.map +1 -1
- package/lib/ui/EmbeddedCodeBlock.js +80 -0
- package/lib/ui/EmbeddedCodeBlock.js.map +1 -0
- package/lib/ui/SyntaxHighlight.js +3 -2
- package/lib/ui/SyntaxHighlight.js.map +1 -1
- package/lib/zudoku.components.js +2 -2
- package/lib/zudoku.plugin-api-catalog.js +1 -1
- package/lib/zudoku.plugin-api-keys.js +268 -200
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +1 -1
- package/package.json +1 -1
- package/src/app/main.css +4 -1
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +22 -3
- package/src/lib/plugins/api-keys/index.tsx +26 -4
- package/src/lib/plugins/openapi/Sidecar.tsx +1 -0
- package/src/lib/ui/Alert.tsx +44 -38
- package/src/lib/ui/CodeBlock.tsx +39 -53
- package/src/lib/ui/EmbeddedCodeBlock.tsx +94 -0
- package/src/lib/ui/SyntaxHighlight.tsx +11 -3
- package/lib/Slot-BkYrj_uC.js.map +0 -1
package/src/lib/ui/Alert.tsx
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
|
|
4
3
|
import { cn } from "../util/cn.js";
|
|
5
4
|
|
|
6
5
|
const alertVariants = cva(
|
|
7
|
-
"relative w-full rounded-lg border
|
|
6
|
+
"relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
8
7
|
{
|
|
9
8
|
variants: {
|
|
10
9
|
variant: {
|
|
11
|
-
default: "bg-
|
|
10
|
+
default: "bg-card text-card-foreground",
|
|
12
11
|
destructive:
|
|
13
|
-
"
|
|
12
|
+
"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",
|
|
14
13
|
},
|
|
15
14
|
},
|
|
16
15
|
defaultVariants: {
|
|
@@ -19,41 +18,48 @@ const alertVariants = cva(
|
|
|
19
18
|
},
|
|
20
19
|
);
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
function Alert({
|
|
22
|
+
className,
|
|
23
|
+
variant,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
data-slot="alert"
|
|
29
|
+
role="alert"
|
|
30
|
+
className={cn(alertVariants({ variant }), className)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
data-slot="alert-title"
|
|
40
|
+
className={cn(
|
|
41
|
+
"col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
function AlertDescription({
|
|
50
|
+
className,
|
|
51
|
+
...props
|
|
52
|
+
}: React.ComponentProps<"div">) {
|
|
53
|
+
return (
|
|
54
|
+
<div
|
|
55
|
+
data-slot="alert-description"
|
|
56
|
+
className={cn(
|
|
57
|
+
"text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
|
|
58
|
+
className,
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
58
64
|
|
|
59
65
|
export { Alert, AlertDescription, AlertTitle };
|
package/src/lib/ui/CodeBlock.tsx
CHANGED
|
@@ -13,18 +13,16 @@ export type CodeBlockProps = {
|
|
|
13
13
|
children?: ReactNode;
|
|
14
14
|
code?: ReactNode;
|
|
15
15
|
showCopy?: "hover" | "always" | "never";
|
|
16
|
-
showCopyText?: boolean;
|
|
17
16
|
disabled?: boolean;
|
|
18
17
|
showLineNumbers?: boolean;
|
|
19
18
|
};
|
|
20
19
|
|
|
21
20
|
export const CodeBlock = ({
|
|
22
21
|
children,
|
|
23
|
-
title,
|
|
22
|
+
title = "Code",
|
|
24
23
|
language,
|
|
25
24
|
showCopy = "hover",
|
|
26
|
-
|
|
27
|
-
showLanguageIndicator = true,
|
|
25
|
+
showLanguageIndicator = false,
|
|
28
26
|
showLineNumbers,
|
|
29
27
|
...props
|
|
30
28
|
}: CodeBlockProps) => {
|
|
@@ -36,15 +34,47 @@ export const CodeBlock = ({
|
|
|
36
34
|
return (
|
|
37
35
|
<div
|
|
38
36
|
className={cn(
|
|
39
|
-
"code-block-wrapper relative group bg-muted/50 rounded-md",
|
|
37
|
+
"border code-block-wrapper relative group bg-muted/50 rounded-md overflow-hidden",
|
|
40
38
|
showLineNumbers && "line-numbers",
|
|
41
39
|
)}
|
|
42
40
|
>
|
|
43
|
-
|
|
44
|
-
<div className="
|
|
41
|
+
<div className="border-b flex items-center h-10 font-sans bg-black/2">
|
|
42
|
+
<div className="flex-1 text-sm w-full px-4">
|
|
45
43
|
{title}
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
{showLanguageIndicator && (
|
|
45
|
+
<span className="text-muted-foreground ml-2">({language})</span>
|
|
46
|
+
)}
|
|
47
|
+
</div>{" "}
|
|
48
|
+
{showCopy !== "never" && (
|
|
49
|
+
<button
|
|
50
|
+
type="button"
|
|
51
|
+
aria-label="Copy code"
|
|
52
|
+
title="Copy code"
|
|
53
|
+
className={cn(
|
|
54
|
+
"cursor:pointer h-full hover:border-l-border active:shadow-none active:inset-shadow-xs hover:inset-shadow-xs flex items-center gap-2 px-4 outline-border text-sm hover:bg-black/5 transition-all",
|
|
55
|
+
)}
|
|
56
|
+
disabled={isCopied}
|
|
57
|
+
onClick={() => {
|
|
58
|
+
if (!ref.current?.textContent) return;
|
|
59
|
+
|
|
60
|
+
setIsCopied(true);
|
|
61
|
+
void navigator.clipboard.writeText(ref.current.textContent);
|
|
62
|
+
setTimeout(() => setIsCopied(false), 2000);
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
{isCopied ? (
|
|
66
|
+
<CheckIcon
|
|
67
|
+
className="text-emerald-600"
|
|
68
|
+
size={14}
|
|
69
|
+
strokeWidth={2.5}
|
|
70
|
+
absoluteStrokeWidth
|
|
71
|
+
/>
|
|
72
|
+
) : (
|
|
73
|
+
<CopyIcon size={14} />
|
|
74
|
+
)}
|
|
75
|
+
</button>
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
48
78
|
<div
|
|
49
79
|
className={cn(
|
|
50
80
|
"code-block text-sm not-prose scrollbar overflow-x-auto scrollbar p-4",
|
|
@@ -54,50 +84,6 @@ export const CodeBlock = ({
|
|
|
54
84
|
>
|
|
55
85
|
{children}
|
|
56
86
|
</div>
|
|
57
|
-
{showLanguageIndicator && (
|
|
58
|
-
<span
|
|
59
|
-
className={cn(
|
|
60
|
-
"absolute top-1.5 end-3 !text-[11px] font-mono text-muted-foreground transition group-hover:opacity-0",
|
|
61
|
-
title && "top-12",
|
|
62
|
-
showCopy === "always" && "hidden",
|
|
63
|
-
)}
|
|
64
|
-
>
|
|
65
|
-
{language}
|
|
66
|
-
</span>
|
|
67
|
-
)}
|
|
68
|
-
{showCopy !== "never" && (
|
|
69
|
-
<button
|
|
70
|
-
type="button"
|
|
71
|
-
aria-label="Copy code"
|
|
72
|
-
title="Copy code"
|
|
73
|
-
className={cn(
|
|
74
|
-
"absolute top-2 end-2 p-2 transition hover:shadow-xs active:shadow-none active:inset-shadow-xs hover:outline outline-border rounded-md text-sm text-muted-foreground",
|
|
75
|
-
title && "top-10",
|
|
76
|
-
showCopy === "hover" && "opacity-0 group-hover:opacity-100",
|
|
77
|
-
showCopyText && "flex gap-2 items-center font-medium",
|
|
78
|
-
)}
|
|
79
|
-
disabled={isCopied}
|
|
80
|
-
onClick={() => {
|
|
81
|
-
if (!ref.current?.textContent) return;
|
|
82
|
-
|
|
83
|
-
setIsCopied(true);
|
|
84
|
-
void navigator.clipboard.writeText(ref.current.textContent);
|
|
85
|
-
setTimeout(() => setIsCopied(false), 2000);
|
|
86
|
-
}}
|
|
87
|
-
>
|
|
88
|
-
{isCopied ? (
|
|
89
|
-
<CheckIcon
|
|
90
|
-
className="text-emerald-600"
|
|
91
|
-
size={16}
|
|
92
|
-
strokeWidth={2.5}
|
|
93
|
-
absoluteStrokeWidth
|
|
94
|
-
/>
|
|
95
|
-
) : (
|
|
96
|
-
<CopyIcon size={16} />
|
|
97
|
-
)}
|
|
98
|
-
{showCopyText && "Copy"}
|
|
99
|
-
</button>
|
|
100
|
-
)}
|
|
101
87
|
</div>
|
|
102
88
|
);
|
|
103
89
|
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import { cn } from "../util/cn.js";
|
|
5
|
+
|
|
6
|
+
export type CodeBlockProps = {
|
|
7
|
+
className?: string;
|
|
8
|
+
noBackground?: boolean;
|
|
9
|
+
wrapLines?: boolean;
|
|
10
|
+
showLanguageIndicator?: boolean;
|
|
11
|
+
language?: string;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
code?: ReactNode;
|
|
14
|
+
showCopy?: "hover" | "always" | "never";
|
|
15
|
+
showCopyText?: boolean;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
showLineNumbers?: boolean;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const EmbeddedCodeBlock = ({
|
|
21
|
+
children,
|
|
22
|
+
language,
|
|
23
|
+
showCopy = "hover",
|
|
24
|
+
showCopyText,
|
|
25
|
+
showLanguageIndicator = true,
|
|
26
|
+
showLineNumbers,
|
|
27
|
+
...props
|
|
28
|
+
}: CodeBlockProps) => {
|
|
29
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
30
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
31
|
+
|
|
32
|
+
if (!children) return null;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
className={cn(
|
|
37
|
+
"code-block-wrapper relative group bg-muted/50 rounded-md",
|
|
38
|
+
showLineNumbers && "line-numbers",
|
|
39
|
+
)}
|
|
40
|
+
>
|
|
41
|
+
<div
|
|
42
|
+
className={cn(
|
|
43
|
+
"code-block text-sm not-prose scrollbar overflow-x-auto scrollbar p-4",
|
|
44
|
+
props.className,
|
|
45
|
+
)}
|
|
46
|
+
ref={ref}
|
|
47
|
+
>
|
|
48
|
+
{children}
|
|
49
|
+
</div>
|
|
50
|
+
{showLanguageIndicator && (
|
|
51
|
+
<span
|
|
52
|
+
className={cn(
|
|
53
|
+
"absolute top-1.5 end-3 !text-[11px] font-mono text-muted-foreground transition group-hover:opacity-0",
|
|
54
|
+
showCopy === "always" && "hidden",
|
|
55
|
+
)}
|
|
56
|
+
>
|
|
57
|
+
{language}
|
|
58
|
+
</span>
|
|
59
|
+
)}
|
|
60
|
+
{showCopy !== "never" && (
|
|
61
|
+
<button
|
|
62
|
+
type="button"
|
|
63
|
+
aria-label="Copy code"
|
|
64
|
+
title="Copy code"
|
|
65
|
+
className={cn(
|
|
66
|
+
"absolute top-2 end-2 p-2 transition hover:shadow-xs active:shadow-none active:inset-shadow-xs hover:outline outline-border rounded-md text-sm text-muted-foreground",
|
|
67
|
+
showCopy === "hover" && "opacity-0 group-hover:opacity-100",
|
|
68
|
+
showCopyText && "flex gap-2 items-center font-medium",
|
|
69
|
+
)}
|
|
70
|
+
disabled={isCopied}
|
|
71
|
+
onClick={() => {
|
|
72
|
+
if (!ref.current?.textContent) return;
|
|
73
|
+
|
|
74
|
+
setIsCopied(true);
|
|
75
|
+
void navigator.clipboard.writeText(ref.current.textContent);
|
|
76
|
+
setTimeout(() => setIsCopied(false), 2000);
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
{isCopied ? (
|
|
80
|
+
<CheckIcon
|
|
81
|
+
className="text-emerald-600"
|
|
82
|
+
size={16}
|
|
83
|
+
strokeWidth={2.5}
|
|
84
|
+
absoluteStrokeWidth
|
|
85
|
+
/>
|
|
86
|
+
) : (
|
|
87
|
+
<CopyIcon size={16} />
|
|
88
|
+
)}
|
|
89
|
+
{showCopyText && "Copy"}
|
|
90
|
+
</button>
|
|
91
|
+
)}
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
@@ -3,12 +3,16 @@ import { useZudoku } from "../components/context/ZudokuContext.js";
|
|
|
3
3
|
import { highlight } from "../shiki.js";
|
|
4
4
|
import invariant from "../util/invariant.js";
|
|
5
5
|
import { CodeBlock, type CodeBlockProps } from "./CodeBlock.js";
|
|
6
|
+
import { EmbeddedCodeBlock } from "./EmbeddedCodeBlock.js";
|
|
6
7
|
|
|
7
8
|
type SyntaxHighlightProps = CodeBlockProps &
|
|
8
|
-
(
|
|
9
|
+
(
|
|
10
|
+
| { code: string; embedded?: boolean; children?: never }
|
|
11
|
+
| { code?: never; children: string; embedded?: boolean }
|
|
12
|
+
);
|
|
9
13
|
|
|
10
14
|
export const SyntaxHighlight = memo(
|
|
11
|
-
({ code, children, ...props }: SyntaxHighlightProps) => {
|
|
15
|
+
({ code, children, embedded, ...props }: SyntaxHighlightProps) => {
|
|
12
16
|
const { syntaxHighlighting } = useZudoku().options;
|
|
13
17
|
|
|
14
18
|
invariant(syntaxHighlighting?.highlighter, "Highlighter not found");
|
|
@@ -20,7 +24,11 @@ export const SyntaxHighlight = memo(
|
|
|
20
24
|
syntaxHighlighting.themes,
|
|
21
25
|
);
|
|
22
26
|
|
|
23
|
-
return
|
|
27
|
+
return embedded ? (
|
|
28
|
+
<EmbeddedCodeBlock {...props}>{highlightedCode}</EmbeddedCodeBlock>
|
|
29
|
+
) : (
|
|
30
|
+
<CodeBlock {...props}>{highlightedCode}</CodeBlock>
|
|
31
|
+
);
|
|
24
32
|
},
|
|
25
33
|
);
|
|
26
34
|
|
package/lib/Slot-BkYrj_uC.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Slot-BkYrj_uC.js","sources":["../src/lib/components/DeveloperHint.tsx","../src/lib/components/NotFoundPage.tsx","../src/lib/ui/SyntaxHighlight.tsx","../src/lib/errors/ErrorAlert.tsx","../src/lib/errors/RouterError.tsx","../src/lib/components/context/SlotProvider.tsx","../src/lib/components/Slot.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Callout } from \"../ui/Callout.js\";\nimport { Markdown } from \"./Markdown.js\";\n\nexport const DeveloperHint = ({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) => {\n if (process.env.NODE_ENV !== \"development\") return;\n\n return (\n <Callout type=\"caution\" title=\"Developer hint\" className={className}>\n <div className=\"flex flex-col gap-2\">\n {typeof children === \"string\" ? (\n <Markdown content={children} />\n ) : (\n <div>{children}</div>\n )}\n <small className=\"italic\">\n Note: This hint is only shown in development mode.\n </small>\n </div>\n </Callout>\n );\n};\n","import { UnlinkIcon } from \"lucide-react\";\nimport { Link, useParams } from \"react-router\";\nimport { CategoryHeading } from \"./CategoryHeading.js\";\nimport { DeveloperHint } from \"./DeveloperHint.js\";\nimport { Heading } from \"./Heading.js\";\nimport { ProseClasses } from \"./Markdown.js\";\n\nexport const NotFoundPage = () => {\n const params = useParams();\n\n return (\n <div className={ProseClasses + \" h-full pt-(--padding-content-top)\"}>\n <CategoryHeading>404</CategoryHeading>\n <Heading level={1} className=\"flex gap-3.5 items-center\">\n Page not found\n <UnlinkIcon size={24} />\n </Heading>\n <DeveloperHint>\n Start by adding a file at{\" \"}\n <code>\n {\"{PROJECT_ROOT}\"}/{params[\"*\"]}.mdx\n </code>{\" \"}\n and add some content to make this error go away.\n </DeveloperHint>\n <p>\n It seems that the page you are looking for does not exist or may have\n been moved. Please check the URL for any typos or use the navigation\n menu to find the correct page.\n </p>\n <Link to=\"/\">Go back home</Link>\n </div>\n );\n};\n","import { memo } from \"react\";\nimport { useZudoku } from \"../components/context/ZudokuContext.js\";\nimport { highlight } from \"../shiki.js\";\nimport invariant from \"../util/invariant.js\";\nimport { CodeBlock, type CodeBlockProps } from \"./CodeBlock.js\";\n\ntype SyntaxHighlightProps = CodeBlockProps &\n ({ code: string; children?: never } | { code?: never; children: string });\n\nexport const SyntaxHighlight = memo(\n ({ code, children, ...props }: SyntaxHighlightProps) => {\n const { syntaxHighlighting } = useZudoku().options;\n\n invariant(syntaxHighlighting?.highlighter, \"Highlighter not found\");\n\n const highlightedCode = highlight(\n syntaxHighlighting.highlighter,\n code ?? children,\n props.language,\n syntaxHighlighting.themes,\n );\n\n return <CodeBlock {...props}>{highlightedCode}</CodeBlock>;\n },\n);\n\nSyntaxHighlight.displayName = \"SyntaxHighlight\";\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\nimport { SyntaxHighlight } from \"zudoku/ui/SyntaxHighlight.js\";\nimport { DeveloperHint } from \"../components/DeveloperHint.js\";\nimport { Heading } from \"../components/Heading.js\";\nimport { ProseClasses } from \"../components/Markdown.js\";\nimport { cn } from \"../util/cn.js\";\nimport { ZudokuError } from \"../util/invariant.js\";\n\nexport function ErrorAlert({ error }: { error: unknown }) {\n const message =\n error instanceof Error ? error.message : \"Something went wrong\";\n\n const hint = error instanceof ZudokuError ? error.developerHint : undefined;\n const title =\n error instanceof ZudokuError ? error.title : \"Something went wrong\";\n const stack = error instanceof Error ? error.stack : undefined;\n const cause = error instanceof Error ? error.cause : undefined;\n\n const stringError = cause instanceof Error ? String(cause.stack) : stack;\n\n return (\n <div\n className={cn(\n ProseClasses,\n \"grid grid-cols-1 !max-w-none pt-(--padding-content-top)\",\n )}\n >\n <Heading level={1}>{title}</Heading>\n Error: {message}\n {hint && <DeveloperHint className=\"mb-4\">{hint}</DeveloperHint>}\n {stringError && (\n <div>\n <SyntaxHighlight\n className=\"max-h-[400px] border mt-2\"\n language=\"js\"\n code={stringError}\n />\n </div>\n )}\n </div>\n );\n}\n","import { isRouteErrorResponse, useRouteError } from \"react-router\";\nimport { NotFoundPage } from \"../components/NotFoundPage.js\";\nimport { ErrorAlert } from \"./ErrorAlert.js\";\n\nexport function RouterError() {\n const error = useRouteError();\n\n if (isRouteErrorResponse(error) && error.status === 404) {\n return <NotFoundPage />;\n }\n\n return <ErrorAlert error={error} />;\n}\n","import {\n createContext,\n Fragment,\n use,\n useMemo,\n useRef,\n type ComponentType,\n type PropsWithChildren,\n type ReactNode,\n} from \"react\";\nimport { createStore, useStore } from \"zustand\";\nimport {\n useExposedProps,\n type ExposedComponentProps,\n} from \"../../util/useExposedProps.js\";\n\nexport type SlotType = ReactNode | ComponentType<ExposedComponentProps>;\n\ntype SlotItem = {\n id: string;\n content: SlotType;\n type: \"prepend\" | \"replace\" | \"append\";\n sequence: number;\n};\n\ntype SlotStoreState = {\n items: Map<string, SlotItem[]>;\n // to guarantee the order of the items when appending/prepending\n sequences: Map<string, number>;\n getItems: (name: string) => SlotItem[];\n setSlot: (\n id: string,\n name: string,\n content: SlotType,\n type: \"prepend\" | \"replace\" | \"append\",\n ) => void;\n clearSlot: (id: string, name: string) => void;\n};\n\nexport type SlotStore = ReturnType<typeof createSlotStore>;\n\nconst createSlotStore = ({\n slots = {},\n}: {\n slots?: Record<string, SlotType>;\n} = {}) => {\n const initialItems = new Map(\n Object.entries(slots).map(([id, content]) => [\n id,\n [{ id, content, type: \"replace\", sequence: 0 } satisfies SlotItem],\n ]),\n );\n const EMPTY_ITEMS: SlotItem[] = [];\n\n return createStore<SlotStoreState>()((set, get) => ({\n items: initialItems,\n sequences: new Map(),\n getItems: (name) => get().items.get(name) ?? EMPTY_ITEMS,\n setSlot: (id, name, content, type) =>\n set((state) => {\n if (content == null) return state;\n\n const items = new Map(state.items);\n const sequences = new Map(state.sequences);\n const existing = items.get(name) ?? [];\n const filtered = existing.filter((item) => item.id !== id);\n\n const currentSequence = sequences.get(name) ?? 0;\n const newSequence = currentSequence + 1;\n sequences.set(name, newSequence);\n\n const newItem = {\n id,\n content,\n type,\n // Use negative sequence values for \"prepend\" to ensure they are sorted before positive values for \"append\".\n sequence: type === \"prepend\" ? -newSequence : newSequence,\n } satisfies SlotItem;\n\n if (type === \"replace\") {\n const nonReplaceItems = filtered.filter(\n (item) => item.type !== \"replace\",\n );\n items.set(name, [...nonReplaceItems, newItem]);\n } else {\n items.set(name, [...filtered, newItem]);\n }\n\n return { items, sequences };\n }),\n clearSlot: (id, name) =>\n set((state) => {\n const items = new Map(state.items);\n const sequences = new Map(state.sequences);\n const existing = items.get(name) ?? [];\n const filtered = existing.filter((item) => item.id !== id);\n\n if (filtered.length === 0) {\n items.delete(name);\n sequences.delete(name);\n } else {\n items.set(name, filtered);\n }\n return { items, sequences };\n }),\n }));\n};\n\nconst SlotContext = createContext(createSlotStore());\n\nexport const SlotProvider = ({\n children,\n slots,\n}: PropsWithChildren<{\n slots?: Record<string, SlotType>;\n}>) => {\n const store = useRef<SlotStore>(createSlotStore({ slots })).current;\n return <SlotContext value={store}>{children}</SlotContext>;\n};\n\nexport function useSlotContext<T>(selector: (state: SlotStoreState) => T): T {\n const store = use(SlotContext);\n return useStore(store, selector);\n}\n\nconst ORDER = [\"prepend\", \"replace\", \"append\"] as const;\n\nexport const useRenderSlot = (name: string) => {\n const exposedProps = useExposedProps();\n const items = useSlotContext((s) => s.getItems(name));\n\n return useMemo(() => {\n if (items.length === 0) return [];\n\n return items\n .toSorted((a, b) => {\n const typeOrder = ORDER.indexOf(a.type) - ORDER.indexOf(b.type);\n if (typeOrder !== 0) return typeOrder;\n return a.sequence - b.sequence;\n })\n .map((item) =>\n typeof item.content === \"function\" ? (\n <item.content key={item.id} {...exposedProps} />\n ) : (\n <Fragment key={item.id}>{item.content}</Fragment>\n ),\n );\n }, [items, exposedProps]);\n};\n","import { useId, useLayoutEffect, type ReactNode } from \"react\";\nimport {\n useRenderSlot,\n useSlotContext,\n type SlotType,\n} from \"./context/SlotProvider.js\";\n\n// This is to augment the type of the Slot component with custom slot names\n// This is useful for plugins to add custom slots to the Zudoku context\n// and for the user to use them in their own components\nexport type CustomSlotNames = never;\n\ntype PredefinedSlotNames =\n | \"api-keys-list-page\"\n | \"api-keys-list-page-before-keys\"\n | \"footer-after\"\n | \"footer-before\"\n | \"head-navigation-end\"\n | \"head-navigation-start\"\n | \"layout-after-head\"\n | \"layout-before-head\"\n | \"top-navigation-after\"\n | \"top-navigation-before\"\n | \"top-navigation-side\"\n | \"content-before\"\n | \"content-after\"\n | \"navigation-after\"\n | \"navigation-before\";\n\nexport type SlotName = PredefinedSlotNames | CustomSlotNames;\n\nexport const Slot = {\n Source: ({\n name,\n children,\n type = \"replace\",\n }: {\n name: SlotName;\n type?: \"prepend\" | \"replace\" | \"append\";\n children: SlotType;\n }) => {\n const id = useId();\n const setSlot = useSlotContext((s) => s.setSlot);\n const clearSlot = useSlotContext((s) => s.clearSlot);\n\n if (import.meta.env.SSR) {\n setSlot(id, name, children, type);\n }\n\n useLayoutEffect(() => {\n setSlot(id, name, children, type);\n return () => clearSlot(id, name);\n }, [id, name, children, type, setSlot, clearSlot]);\n\n return null;\n },\n\n Target: ({ name, fallback }: { name: string; fallback?: ReactNode }) => {\n const slot = useRenderSlot(name);\n\n if (slot.length === 0) return fallback;\n return slot;\n },\n};\n"],"names":["DeveloperHint","children","className","jsx","Callout","jsxs","Markdown","NotFoundPage","params","useParams","ProseClasses","CategoryHeading","Heading","UnlinkIcon","Link","SyntaxHighlight","memo","code","props","syntaxHighlighting","useZudoku","invariant","highlightedCode","highlight","CodeBlock","ErrorAlert","error","message","hint","ZudokuError","title","stack","cause","stringError","cn","RouterError","useRouteError","isRouteErrorResponse","createSlotStore","slots","initialItems","id","content","EMPTY_ITEMS","createStore","set","get","name","type","state","items","sequences","filtered","item","newSequence","newItem","nonReplaceItems","SlotContext","createContext","SlotProvider","store","useRef","useSlotContext","selector","use","useStore","ORDER","useRenderSlot","exposedProps","useExposedProps","useMemo","a","b","typeOrder","Fragment","Slot","fallback","slot"],"mappings":";;;;;;;;;;;;;AAIO,MAAMA,IAAgB,CAAC;AAAA,EAC5B,UAAAC;AAAA,EACA,WAAAC;AACF,MAGM;AACA,MAAA,QAAQ,IAAI,aAAa;AAG3B,WAAAC,gBAAAA,EAAAA,IAACC,GAAQ,EAAA,MAAK,WAAU,OAAM,kBAAiB,WAAAF,GAC7C,UAAAG,gBAAAA,EAAA,KAAC,OAAI,EAAA,WAAU,uBACZ,UAAA;AAAA,MAAO,OAAAJ,KAAa,WAClBE,gBAAAA,EAAA,IAAAG,GAAA,EAAS,SAASL,EAAU,CAAA,IAE5BE,gBAAAA,EAAA,IAAA,OAAA,EAAK,UAAAF,EAAS,CAAA;AAAA,MAEhBE,gBAAAA,EAAA,IAAA,SAAA,EAAM,WAAU,UAAS,UAE1B,qDAAA,CAAA;AAAA,IAAA,EAAA,CACF,EACF,CAAA;AAEJ,GCpBaI,IAAe,MAAM;AAChC,QAAMC,IAASC,EAAU;AAEzB,SACGJ,gBAAAA,EAAAA,KAAA,OAAA,EAAI,WAAWK,IAAe,sCAC7B,UAAA;AAAA,IAAAP,gBAAAA,EAAAA,IAACQ,KAAgB,UAAG,MAAA,CAAA;AAAA,IACnBN,gBAAAA,EAAA,KAAAO,GAAA,EAAQ,OAAO,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