astro-awesomeness 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-pbuEa-1d.js +13 -0
- package/dist/cn-B3UhF_Ec.js +8 -0
- package/dist/cn-B3UhF_Ec.js.map +1 -0
- package/dist/components/index.d.ts +111 -0
- package/dist/components/index.js +281 -0
- package/dist/components/index.js.map +1 -0
- package/dist/content/index.d.ts +72 -0
- package/dist/content/index.js +34 -0
- package/dist/content/index.js.map +1 -0
- package/dist/index-BAPPsft-.d.ts +31 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.js +3 -0
- package/dist/lib-DRaCmJ7r.js +50 -0
- package/dist/lib-DRaCmJ7r.js.map +1 -0
- package/dist/styles/globals.css +209 -0
- package/dist/tailwind-preset.d.ts +5 -0
- package/dist/tailwind-preset.js +13 -0
- package/dist/tailwind-preset.js.map +1 -0
- package/package.json +81 -0
- package/src/astro/code-block.astro +14 -0
- package/src/astro/footer.astro +15 -0
- package/src/astro/formatted-date.astro +14 -0
- package/src/astro/header.astro +22 -0
- package/src/astro/pagination.astro +35 -0
- package/src/astro/post-card.astro +28 -0
- package/src/astro/prose.astro +10 -0
- package/src/astro/reading-time.astro +12 -0
- package/src/astro/seo.astro +26 -0
- package/src/astro/table-of-contents.astro +35 -0
- package/src/astro/tag-list.astro +23 -0
- package/src/layouts/base-layout.astro +50 -0
- package/src/layouts/list-layout.astro +37 -0
- package/src/layouts/post-layout.astro +41 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn-B3UhF_Ec.js","names":[],"sources":["../src/lib/cn.ts"],"sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nconst cn = (...inputs: Array<ClassValue>) => twMerge(clsx(inputs));\n\nexport { cn };\n"],"mappings":";;;AAGA,MAAM,MAAM,GAAG,WAA8B,QAAQ,KAAK,MAAM,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Dialog as Dialog$1 } from "radix-ui";
|
|
4
|
+
import { Command as Command$1 } from "cmdk";
|
|
5
|
+
|
|
6
|
+
//#region src/components/ui/button.d.ts
|
|
7
|
+
declare const buttonVariants: (props?: ({
|
|
8
|
+
size?: "default" | "icon" | "icon-lg" | "icon-sm" | "icon-xs" | "lg" | "sm" | "xs" | null | undefined;
|
|
9
|
+
variant?: "default" | "destructive" | "ghost" | "link" | "outline" | "secondary" | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
+
declare const Button: ({
|
|
12
|
+
asChild,
|
|
13
|
+
className,
|
|
14
|
+
size,
|
|
15
|
+
variant,
|
|
16
|
+
...props
|
|
17
|
+
}: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
18
|
+
asChild?: boolean;
|
|
19
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/components/ui/dialog.d.ts
|
|
22
|
+
declare function Dialog({
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof Dialog$1.Root>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
declare function DialogTrigger({
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof Dialog$1.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare function DialogContent({
|
|
29
|
+
children,
|
|
30
|
+
className,
|
|
31
|
+
showCloseButton,
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<typeof Dialog$1.Content> & {
|
|
34
|
+
showCloseButton?: boolean;
|
|
35
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
declare function DialogHeader({
|
|
37
|
+
className,
|
|
38
|
+
...props
|
|
39
|
+
}: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
declare function DialogFooter({
|
|
41
|
+
children,
|
|
42
|
+
className,
|
|
43
|
+
showCloseButton,
|
|
44
|
+
...props
|
|
45
|
+
}: React.ComponentProps<"div"> & {
|
|
46
|
+
showCloseButton?: boolean;
|
|
47
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
declare function DialogTitle({
|
|
49
|
+
className,
|
|
50
|
+
...props
|
|
51
|
+
}: React.ComponentProps<typeof Dialog$1.Title>): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
declare function DialogDescription({
|
|
53
|
+
className,
|
|
54
|
+
...props
|
|
55
|
+
}: React.ComponentProps<typeof Dialog$1.Description>): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/components/ui/command.d.ts
|
|
58
|
+
declare function Command({
|
|
59
|
+
className,
|
|
60
|
+
...props
|
|
61
|
+
}: React.ComponentProps<typeof Command$1>): import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
declare function CommandInput({
|
|
63
|
+
className,
|
|
64
|
+
...props
|
|
65
|
+
}: React.ComponentProps<typeof Command$1.Input>): import("react/jsx-runtime").JSX.Element;
|
|
66
|
+
declare function CommandList({
|
|
67
|
+
className,
|
|
68
|
+
...props
|
|
69
|
+
}: React.ComponentProps<typeof Command$1.List>): import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
declare function CommandEmpty({
|
|
71
|
+
...props
|
|
72
|
+
}: React.ComponentProps<typeof Command$1.Empty>): import("react/jsx-runtime").JSX.Element;
|
|
73
|
+
declare function CommandGroup({
|
|
74
|
+
className,
|
|
75
|
+
...props
|
|
76
|
+
}: React.ComponentProps<typeof Command$1.Group>): import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
declare function CommandSeparator({
|
|
78
|
+
className,
|
|
79
|
+
...props
|
|
80
|
+
}: React.ComponentProps<typeof Command$1.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
declare function CommandItem({
|
|
82
|
+
className,
|
|
83
|
+
...props
|
|
84
|
+
}: React.ComponentProps<typeof Command$1.Item>): import("react/jsx-runtime").JSX.Element;
|
|
85
|
+
declare function CommandShortcut({
|
|
86
|
+
className,
|
|
87
|
+
...props
|
|
88
|
+
}: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/components/command-menu.d.ts
|
|
91
|
+
type CommandMenuItem = {
|
|
92
|
+
description?: string;
|
|
93
|
+
title: string;
|
|
94
|
+
url: string;
|
|
95
|
+
};
|
|
96
|
+
type CommandMenuProps = {
|
|
97
|
+
emptyMessage?: string;
|
|
98
|
+
items: Array<CommandMenuItem>;
|
|
99
|
+
placeholder?: string;
|
|
100
|
+
};
|
|
101
|
+
declare const CommandMenu: ({
|
|
102
|
+
emptyMessage,
|
|
103
|
+
items,
|
|
104
|
+
placeholder
|
|
105
|
+
}: CommandMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/components/theme-toggle.d.ts
|
|
108
|
+
declare const ThemeToggle: () => import("react/jsx-runtime").JSX.Element;
|
|
109
|
+
//#endregion
|
|
110
|
+
export { Button, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandMenu, type CommandMenuItem, type CommandMenuProps, CommandSeparator, CommandShortcut, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, ThemeToggle, buttonVariants };
|
|
111
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { t as cn } from "../cn-B3UhF_Ec.js";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { useEffect, useState, useSyncExternalStore } from "react";
|
|
4
|
+
import { Dialog as Dialog$1, Slot } from "radix-ui";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Command as Command$1 } from "cmdk";
|
|
7
|
+
import { Moon, Search, SearchIcon, Sun, XIcon } from "lucide-react";
|
|
8
|
+
//#region src/components/ui/button.tsx
|
|
9
|
+
const buttonVariants = cva("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
10
|
+
defaultVariants: {
|
|
11
|
+
size: "default",
|
|
12
|
+
variant: "default"
|
|
13
|
+
},
|
|
14
|
+
variants: {
|
|
15
|
+
size: {
|
|
16
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
17
|
+
icon: "size-9",
|
|
18
|
+
"icon-lg": "size-10",
|
|
19
|
+
"icon-sm": "size-8",
|
|
20
|
+
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
21
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
22
|
+
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
|
23
|
+
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3"
|
|
24
|
+
},
|
|
25
|
+
variant: {
|
|
26
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
27
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
|
|
28
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
29
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
30
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
31
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const Button = ({ asChild = false, className, size = "default", variant = "default", ...props }) => {
|
|
36
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
37
|
+
className: cn(buttonVariants({
|
|
38
|
+
className,
|
|
39
|
+
size,
|
|
40
|
+
variant
|
|
41
|
+
})),
|
|
42
|
+
"data-size": size,
|
|
43
|
+
"data-slot": "button",
|
|
44
|
+
"data-variant": variant,
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/components/ui/dialog.tsx
|
|
50
|
+
function Dialog({ ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx(Dialog$1.Root, {
|
|
52
|
+
"data-slot": "dialog",
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function DialogTrigger({ ...props }) {
|
|
57
|
+
return /* @__PURE__ */ jsx(Dialog$1.Trigger, {
|
|
58
|
+
"data-slot": "dialog-trigger",
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function DialogPortal({ ...props }) {
|
|
63
|
+
return /* @__PURE__ */ jsx(Dialog$1.Portal, {
|
|
64
|
+
"data-slot": "dialog-portal",
|
|
65
|
+
...props
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function DialogOverlay({ className, ...props }) {
|
|
69
|
+
return /* @__PURE__ */ jsx(Dialog$1.Overlay, {
|
|
70
|
+
className: cn("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", className),
|
|
71
|
+
"data-slot": "dialog-overlay",
|
|
72
|
+
...props
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function DialogContent({ children, className, showCloseButton = true, ...props }) {
|
|
76
|
+
return /* @__PURE__ */ jsxs(DialogPortal, {
|
|
77
|
+
"data-slot": "dialog-portal",
|
|
78
|
+
children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Dialog$1.Content, {
|
|
79
|
+
className: cn("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg", className),
|
|
80
|
+
"data-slot": "dialog-content",
|
|
81
|
+
...props,
|
|
82
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsxs(Dialog$1.Close, {
|
|
83
|
+
className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
84
|
+
"data-slot": "dialog-close",
|
|
85
|
+
children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
86
|
+
className: "sr-only",
|
|
87
|
+
children: "Close"
|
|
88
|
+
})]
|
|
89
|
+
})]
|
|
90
|
+
})]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function DialogHeader({ className, ...props }) {
|
|
94
|
+
return /* @__PURE__ */ jsx("div", {
|
|
95
|
+
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
96
|
+
"data-slot": "dialog-header",
|
|
97
|
+
...props
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function DialogFooter({ children, className, showCloseButton = false, ...props }) {
|
|
101
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
102
|
+
className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
|
|
103
|
+
"data-slot": "dialog-footer",
|
|
104
|
+
...props,
|
|
105
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
106
|
+
asChild: true,
|
|
107
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
108
|
+
variant: "outline",
|
|
109
|
+
children: "Close"
|
|
110
|
+
})
|
|
111
|
+
})]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function DialogTitle({ className, ...props }) {
|
|
115
|
+
return /* @__PURE__ */ jsx(Dialog$1.Title, {
|
|
116
|
+
className: cn("text-lg leading-none font-semibold", className),
|
|
117
|
+
"data-slot": "dialog-title",
|
|
118
|
+
...props
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function DialogDescription({ className, ...props }) {
|
|
122
|
+
return /* @__PURE__ */ jsx(Dialog$1.Description, {
|
|
123
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
124
|
+
"data-slot": "dialog-description",
|
|
125
|
+
...props
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/components/ui/command.tsx
|
|
130
|
+
function Command({ className, ...props }) {
|
|
131
|
+
return /* @__PURE__ */ jsx(Command$1, {
|
|
132
|
+
className: cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground", className),
|
|
133
|
+
"data-slot": "command",
|
|
134
|
+
...props
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function CommandInput({ className, ...props }) {
|
|
138
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
139
|
+
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
140
|
+
"data-slot": "command-input-wrapper",
|
|
141
|
+
children: [/* @__PURE__ */ jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }), /* @__PURE__ */ jsx(Command$1.Input, {
|
|
142
|
+
className: cn("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
143
|
+
"data-slot": "command-input",
|
|
144
|
+
...props
|
|
145
|
+
})]
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function CommandList({ className, ...props }) {
|
|
149
|
+
return /* @__PURE__ */ jsx(Command$1.List, {
|
|
150
|
+
className: cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", className),
|
|
151
|
+
"data-slot": "command-list",
|
|
152
|
+
...props
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function CommandEmpty({ ...props }) {
|
|
156
|
+
return /* @__PURE__ */ jsx(Command$1.Empty, {
|
|
157
|
+
className: "py-6 text-center text-sm",
|
|
158
|
+
"data-slot": "command-empty",
|
|
159
|
+
...props
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function CommandGroup({ className, ...props }) {
|
|
163
|
+
return /* @__PURE__ */ jsx(Command$1.Group, {
|
|
164
|
+
className: cn("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground", className),
|
|
165
|
+
"data-slot": "command-group",
|
|
166
|
+
...props
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function CommandSeparator({ className, ...props }) {
|
|
170
|
+
return /* @__PURE__ */ jsx(Command$1.Separator, {
|
|
171
|
+
className: cn("-mx-1 h-px bg-border", className),
|
|
172
|
+
"data-slot": "command-separator",
|
|
173
|
+
...props
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function CommandItem({ className, ...props }) {
|
|
177
|
+
return /* @__PURE__ */ jsx(Command$1.Item, {
|
|
178
|
+
className: cn("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground", className),
|
|
179
|
+
"data-slot": "command-item",
|
|
180
|
+
...props
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function CommandShortcut({ className, ...props }) {
|
|
184
|
+
return /* @__PURE__ */ jsx("span", {
|
|
185
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className),
|
|
186
|
+
"data-slot": "command-shortcut",
|
|
187
|
+
...props
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/components/command-menu.tsx
|
|
192
|
+
const CommandMenu = ({ emptyMessage = "No results.", items, placeholder = "Search posts…" }) => {
|
|
193
|
+
const [open, setOpen] = useState(false);
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
const handleKeyDown = (event) => {
|
|
196
|
+
if (event.key === "k" && (event.metaKey || event.ctrlKey)) {
|
|
197
|
+
event.preventDefault();
|
|
198
|
+
setOpen((value) => !value);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
202
|
+
return () => {
|
|
203
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
204
|
+
};
|
|
205
|
+
}, []);
|
|
206
|
+
return /* @__PURE__ */ jsxs(Dialog, {
|
|
207
|
+
onOpenChange: setOpen,
|
|
208
|
+
open,
|
|
209
|
+
children: [/* @__PURE__ */ jsx(DialogTrigger, {
|
|
210
|
+
asChild: true,
|
|
211
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
212
|
+
"aria-label": "Open search",
|
|
213
|
+
size: "icon",
|
|
214
|
+
variant: "ghost",
|
|
215
|
+
children: /* @__PURE__ */ jsx(Search, {})
|
|
216
|
+
})
|
|
217
|
+
}), /* @__PURE__ */ jsx(DialogContent, {
|
|
218
|
+
className: "p-0",
|
|
219
|
+
children: /* @__PURE__ */ jsxs(Command, { children: [/* @__PURE__ */ jsx(CommandInput, { placeholder }), /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: emptyMessage }), /* @__PURE__ */ jsx(CommandGroup, {
|
|
220
|
+
heading: "Posts",
|
|
221
|
+
children: items.map((item) => /* @__PURE__ */ jsx(CommandItem, {
|
|
222
|
+
onSelect: () => {
|
|
223
|
+
window.location.href = item.url;
|
|
224
|
+
},
|
|
225
|
+
value: item.title,
|
|
226
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
227
|
+
className: "flex flex-col",
|
|
228
|
+
children: [/* @__PURE__ */ jsx("span", { children: item.title }), item.description ? /* @__PURE__ */ jsx("span", {
|
|
229
|
+
className: "text-muted-foreground text-xs",
|
|
230
|
+
children: item.description
|
|
231
|
+
}) : null]
|
|
232
|
+
})
|
|
233
|
+
}, item.url))
|
|
234
|
+
})] })] })
|
|
235
|
+
})]
|
|
236
|
+
});
|
|
237
|
+
};
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/components/theme-toggle.tsx
|
|
240
|
+
const getStoredTheme = () => {
|
|
241
|
+
if (typeof window === "undefined") return null;
|
|
242
|
+
const stored = window.localStorage.getItem("theme");
|
|
243
|
+
if (stored === "light" || stored === "dark") return stored;
|
|
244
|
+
return null;
|
|
245
|
+
};
|
|
246
|
+
const getPrefersDark = () => {
|
|
247
|
+
if (typeof window === "undefined") return false;
|
|
248
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
249
|
+
};
|
|
250
|
+
const subscribePrefersDark = (callback) => {
|
|
251
|
+
if (typeof window === "undefined") return () => {};
|
|
252
|
+
const media = window.matchMedia("(prefers-color-scheme: dark)");
|
|
253
|
+
media.addEventListener("change", callback);
|
|
254
|
+
return () => {
|
|
255
|
+
media.removeEventListener("change", callback);
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
const ThemeToggle = () => {
|
|
259
|
+
const prefersDark = useSyncExternalStore(subscribePrefersDark, getPrefersDark, () => false);
|
|
260
|
+
const [override, setOverride] = useState(() => getStoredTheme());
|
|
261
|
+
const theme = override ?? (prefersDark ? "dark" : "light");
|
|
262
|
+
useEffect(() => {
|
|
263
|
+
document.documentElement.classList.toggle("dark", theme === "dark");
|
|
264
|
+
}, [theme]);
|
|
265
|
+
const handleClick = () => {
|
|
266
|
+
const next = theme === "dark" ? "light" : "dark";
|
|
267
|
+
window.localStorage.setItem("theme", next);
|
|
268
|
+
setOverride(next);
|
|
269
|
+
};
|
|
270
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
271
|
+
"aria-label": "Toggle theme",
|
|
272
|
+
onClick: handleClick,
|
|
273
|
+
size: "icon",
|
|
274
|
+
variant: "ghost",
|
|
275
|
+
children: theme === "dark" ? /* @__PURE__ */ jsx(Sun, {}) : /* @__PURE__ */ jsx(Moon, {})
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
//#endregion
|
|
279
|
+
export { Button, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandMenu, CommandSeparator, CommandShortcut, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, ThemeToggle, buttonVariants };
|
|
280
|
+
|
|
281
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["DialogPrimitive","CommandPrimitive"],"sources":["../../src/components/ui/button.tsx","../../src/components/ui/dialog.tsx","../../src/components/ui/command.tsx","../../src/components/command-menu.tsx","../../src/components/theme-toggle.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\nimport { Slot } from \"radix-ui\";\n\nimport { cn } from \"../../lib/cn\";\n\nconst buttonVariants = cva(\n \"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n defaultVariants: {\n size: \"default\",\n variant: \"default\",\n },\n variants: {\n size: {\n default: \"h-9 px-4 py-2 has-[>svg]:px-3\",\n icon: \"size-9\",\n \"icon-lg\": \"size-10\",\n \"icon-sm\": \"size-8\",\n \"icon-xs\": \"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3\",\n lg: \"h-10 rounded-md px-6 has-[>svg]:px-4\",\n sm: \"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5\",\n xs: \"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3\",\n },\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40\",\n ghost: \"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50\",\n link: \"text-primary underline-offset-4 hover:underline\",\n outline:\n \"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n },\n },\n },\n);\n\nconst Button = ({\n asChild = false,\n className,\n size = \"default\",\n variant = \"default\",\n ...props\n}: React.ComponentProps<\"button\"> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n }) => {\n const Comp = asChild ? Slot.Root : \"button\";\n\n return (\n <Comp\n className={cn(buttonVariants({ className, size, variant }))}\n data-size={size}\n data-slot=\"button\"\n data-variant={variant}\n {...props}\n />\n );\n};\n\nexport { Button, buttonVariants };\n","import * as React from \"react\";\nimport { XIcon } from \"lucide-react\";\nimport { Dialog as DialogPrimitive } from \"radix-ui\";\n\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"./button\";\n\nfunction Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />;\n}\n\nfunction DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nfunction DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nfunction DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n className={cn(\n \"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0\",\n className,\n )}\n data-slot=\"dialog-overlay\"\n {...props}\n />\n );\n}\n\nfunction DialogContent({\n children,\n className,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean;\n}) {\n return (\n <DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay />\n <DialogPrimitive.Content\n className={cn(\n \"fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg\",\n className,\n )}\n data-slot=\"dialog-content\"\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close\n className=\"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\"\n data-slot=\"dialog-close\"\n >\n <XIcon />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\"flex flex-col gap-2 text-center sm:text-left\", className)}\n data-slot=\"dialog-header\"\n {...props}\n />\n );\n}\n\nfunction DialogFooter({\n children,\n className,\n showCloseButton = false,\n ...props\n}: React.ComponentProps<\"div\"> & {\n showCloseButton?: boolean;\n}) {\n return (\n <div\n className={cn(\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\", className)}\n data-slot=\"dialog-footer\"\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close asChild>\n <Button variant=\"outline\">Close</Button>\n </DialogPrimitive.Close>\n )}\n </div>\n );\n}\n\nfunction DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n className={cn(\"text-lg leading-none font-semibold\", className)}\n data-slot=\"dialog-title\"\n {...props}\n />\n );\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n className={cn(\"text-sm text-muted-foreground\", className)}\n data-slot=\"dialog-description\"\n {...props}\n />\n );\n}\n\nexport {\n Dialog,\n // fallow-ignore-next-line unused-export\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n // fallow-ignore-next-line unused-export\n DialogOverlay,\n // fallow-ignore-next-line unused-export\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { SearchIcon } from \"lucide-react\";\n\nimport { cn } from \"../../lib/cn\";\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from \"./dialog\";\n\nfunction Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n className={cn(\n \"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n className,\n )}\n data-slot=\"command\"\n {...props}\n />\n );\n}\n\nfunction CommandDialog({\n children,\n className,\n description = \"Search for a command to run...\",\n showCloseButton = true,\n title = \"Command Palette\",\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n className?: string;\n description?: string;\n showCloseButton?: boolean;\n title?: string;\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn(\"overflow-hidden p-0\", className)}\n showCloseButton={showCloseButton}\n >\n <Command className=\"**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction CommandInput({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div className=\"flex h-9 items-center gap-2 border-b px-3\" data-slot=\"command-input-wrapper\">\n <SearchIcon className=\"size-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n className={cn(\n \"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n data-slot=\"command-input\"\n {...props}\n />\n </div>\n );\n}\n\nfunction CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n className={cn(\"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto\", className)}\n data-slot=\"command-list\"\n {...props}\n />\n );\n}\n\nfunction CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n className=\"py-6 text-center text-sm\"\n data-slot=\"command-empty\"\n {...props}\n />\n );\n}\n\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n className={cn(\n \"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground\",\n className,\n )}\n data-slot=\"command-group\"\n {...props}\n />\n );\n}\n\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n className={cn(\"-mx-1 h-px bg-border\", className)}\n data-slot=\"command-separator\"\n {...props}\n />\n );\n}\n\nfunction CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n className={cn(\n \"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\",\n className,\n )}\n data-slot=\"command-item\"\n {...props}\n />\n );\n}\n\nfunction CommandShortcut({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n className={cn(\"ml-auto text-xs tracking-widest text-muted-foreground\", className)}\n data-slot=\"command-shortcut\"\n {...props}\n />\n );\n}\n\nexport {\n Command,\n // fallow-ignore-next-line unused-export\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n};\n","import { Search } from \"lucide-react\";\nimport { useEffect, useState } from \"react\";\n\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"./ui/command\";\nimport { Dialog, DialogContent, DialogTrigger } from \"./ui/dialog\";\nimport { Button } from \"./ui/button\";\n\ntype CommandMenuItem = { description?: string; title: string; url: string };\n\ntype CommandMenuProps = {\n emptyMessage?: string;\n items: Array<CommandMenuItem>;\n placeholder?: string;\n};\n\nconst CommandMenu = ({\n emptyMessage = \"No results.\",\n items,\n placeholder = \"Search posts…\",\n}: CommandMenuProps) => {\n const [open, setOpen] = useState(false);\n\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"k\" && (event.metaKey || event.ctrlKey)) {\n event.preventDefault();\n setOpen((value) => !value);\n }\n };\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, []);\n\n return (\n <Dialog onOpenChange={setOpen} open={open}>\n <DialogTrigger asChild>\n <Button aria-label=\"Open search\" size=\"icon\" variant=\"ghost\">\n <Search />\n </Button>\n </DialogTrigger>\n <DialogContent className=\"p-0\">\n <Command>\n <CommandInput placeholder={placeholder} />\n <CommandList>\n <CommandEmpty>{emptyMessage}</CommandEmpty>\n <CommandGroup heading=\"Posts\">\n {items.map((item) => (\n <CommandItem\n key={item.url}\n onSelect={() => {\n window.location.href = item.url;\n }}\n value={item.title}\n >\n <div className=\"flex flex-col\">\n <span>{item.title}</span>\n {item.description ? (\n <span className=\"text-muted-foreground text-xs\">{item.description}</span>\n ) : null}\n </div>\n </CommandItem>\n ))}\n </CommandGroup>\n </CommandList>\n </Command>\n </DialogContent>\n </Dialog>\n );\n};\n\nexport { CommandMenu };\nexport type { CommandMenuItem, CommandMenuProps };\n","import { Moon, Sun } from \"lucide-react\";\nimport { useEffect, useState, useSyncExternalStore } from \"react\";\n\nimport { Button } from \"./ui/button\";\n\ntype Theme = \"light\" | \"dark\";\n\nconst getStoredTheme = (): Theme | null => {\n if (typeof window === \"undefined\") {\n return null;\n }\n const stored = window.localStorage.getItem(\"theme\");\n if (stored === \"light\" || stored === \"dark\") {\n return stored;\n }\n return null;\n};\n\nconst getPrefersDark = (): boolean => {\n if (typeof window === \"undefined\") {\n return false;\n }\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches;\n};\n\nconst subscribePrefersDark = (callback: () => void) => {\n if (typeof window === \"undefined\") {\n return () => {};\n }\n const media = window.matchMedia(\"(prefers-color-scheme: dark)\");\n media.addEventListener(\"change\", callback);\n return () => {\n media.removeEventListener(\"change\", callback);\n };\n};\n\nconst ThemeToggle = () => {\n // useSyncExternalStore avoids hydration mismatch warnings while still letting\n // us read the actual system preference on the client.\n const prefersDark = useSyncExternalStore(subscribePrefersDark, getPrefersDark, () => false);\n const [override, setOverride] = useState<Theme | null>(() => getStoredTheme());\n const theme: Theme = override ?? (prefersDark ? \"dark\" : \"light\");\n\n useEffect(() => {\n document.documentElement.classList.toggle(\"dark\", theme === \"dark\");\n }, [theme]);\n\n const handleClick = () => {\n const next: Theme = theme === \"dark\" ? \"light\" : \"dark\";\n window.localStorage.setItem(\"theme\", next);\n setOverride(next);\n };\n\n return (\n <Button aria-label=\"Toggle theme\" onClick={handleClick} size=\"icon\" variant=\"ghost\">\n {theme === \"dark\" ? <Sun /> : <Moon />}\n </Button>\n );\n};\n\nexport { ThemeToggle };\n"],"mappings":";;;;;;;;AAMA,MAAM,iBAAiB,IACrB,+bACA;CACE,iBAAiB;EACf,MAAM;EACN,SAAS;CACX;CACA,UAAU;EACR,MAAM;GACJ,SAAS;GACT,MAAM;GACN,WAAW;GACX,WAAW;GACX,WAAW;GACX,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EACA,SAAS;GACP,SAAS;GACT,aACE;GACF,OAAO;GACP,MAAM;GACN,SACE;GACF,WAAW;EACb;CACF;AACF,CACF;AAEA,MAAM,UAAU,EACd,UAAU,OACV,WACA,OAAO,WACP,UAAU,WACV,GAAG,YAIG;CAGN,OACE,oBAHW,UAAU,KAAK,OAAO,UAGjC;EACE,WAAW,GAAG,eAAe;GAAE;GAAW;GAAM;EAAQ,CAAC,CAAC;EAC1D,aAAW;EACX,aAAU;EACV,gBAAc;EACd,GAAI;CACL,CAAA;AAEL;;;ACpDA,SAAS,OAAO,EAAE,GAAG,SAA4D;CAC/E,OAAO,oBAACA,SAAgB,MAAjB;EAAsB,aAAU;EAAS,GAAI;CAAQ,CAAA;AAC9D;AAEA,SAAS,cAAc,EAAE,GAAG,SAA+D;CACzF,OAAO,oBAACA,SAAgB,SAAjB;EAAyB,aAAU;EAAiB,GAAI;CAAQ,CAAA;AACzE;AAEA,SAAS,aAAa,EAAE,GAAG,SAA8D;CACvF,OAAO,oBAACA,SAAgB,QAAjB;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAMA,SAAS,cAAc,EACrB,WACA,GAAG,SACoD;CACvD,OACE,oBAACA,SAAgB,SAAjB;EACE,WAAW,GACT,0JAC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;CAET,OAAO,OAAO,WAAW,8BAA8B,EAAE;AAC3D;AAEA,MAAM,wBAAwB,aAAyB;CACrD,IAAI,OAAO,WAAW,aACpB,aAAa,CAAC;CAEhB,MAAM,QAAQ,OAAO,WAAW,8BAA8B;CAC9D,MAAM,iBAAiB,UAAU,QAAQ;CACzC,aAAa;EACX,MAAM,oBAAoB,UAAU,QAAQ;CAC9C;AACF;AAEA,MAAM,oBAAoB;CAGxB,MAAM,cAAc,qBAAqB,sBAAsB,sBAAsB,KAAK;CAC1F,MAAM,CAAC,UAAU,eAAe,eAA6B,eAAe,CAAC;CAC7E,MAAM,QAAe,aAAa,cAAc,SAAS;CAEzD,gBAAgB;EACd,SAAS,gBAAgB,UAAU,OAAO,QAAQ,UAAU,MAAM;CACpE,GAAG,CAAC,KAAK,CAAC;CAEV,MAAM,oBAAoB;EACxB,MAAM,OAAc,UAAU,SAAS,UAAU;EACjD,OAAO,aAAa,QAAQ,SAAS,IAAI;EACzC,YAAY,IAAI;CAClB;CAEA,OACE,oBAAC,QAAD;EAAQ,cAAW;EAAe,SAAS;EAAa,MAAK;EAAO,SAAQ;YACzE,UAAU,SAAS,oBAAC,KAAD,CAAM,CAAA,IAAI,oBAAC,MAAD,CAAO,CAAA;CAC/B,CAAA;AAEZ"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/content/index.d.ts
|
|
4
|
+
declare namespace index_d_exports {
|
|
5
|
+
export { Author, Post, Tag, authorSchema, postSchema, tagSchema };
|
|
6
|
+
}
|
|
7
|
+
declare const postSchema: z.ZodObject<{
|
|
8
|
+
author: z.ZodOptional<z.ZodString>;
|
|
9
|
+
cover: z.ZodOptional<z.ZodString>;
|
|
10
|
+
coverAlt: z.ZodOptional<z.ZodString>;
|
|
11
|
+
description: z.ZodString;
|
|
12
|
+
draft: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
+
pubDate: z.ZodDate;
|
|
14
|
+
series: z.ZodOptional<z.ZodString>;
|
|
15
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
16
|
+
title: z.ZodString;
|
|
17
|
+
updatedDate: z.ZodOptional<z.ZodDate>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
description: string;
|
|
20
|
+
draft: boolean;
|
|
21
|
+
pubDate: Date;
|
|
22
|
+
tags: string[];
|
|
23
|
+
title: string;
|
|
24
|
+
author?: string | undefined;
|
|
25
|
+
cover?: string | undefined;
|
|
26
|
+
coverAlt?: string | undefined;
|
|
27
|
+
series?: string | undefined;
|
|
28
|
+
updatedDate?: Date | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
description: string;
|
|
31
|
+
pubDate: Date;
|
|
32
|
+
title: string;
|
|
33
|
+
author?: string | undefined;
|
|
34
|
+
cover?: string | undefined;
|
|
35
|
+
coverAlt?: string | undefined;
|
|
36
|
+
draft?: boolean | undefined;
|
|
37
|
+
series?: string | undefined;
|
|
38
|
+
tags?: string[] | undefined;
|
|
39
|
+
updatedDate?: Date | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
declare const tagSchema: z.ZodObject<{
|
|
42
|
+
description: z.ZodOptional<z.ZodString>;
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
name: string;
|
|
46
|
+
description?: string | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
name: string;
|
|
49
|
+
description?: string | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
declare const authorSchema: z.ZodObject<{
|
|
52
|
+
avatar: z.ZodOptional<z.ZodString>;
|
|
53
|
+
bio: z.ZodOptional<z.ZodString>;
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
url: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
name: string;
|
|
58
|
+
avatar?: string | undefined;
|
|
59
|
+
bio?: string | undefined;
|
|
60
|
+
url?: string | undefined;
|
|
61
|
+
}, {
|
|
62
|
+
name: string;
|
|
63
|
+
avatar?: string | undefined;
|
|
64
|
+
bio?: string | undefined;
|
|
65
|
+
url?: string | undefined;
|
|
66
|
+
}>;
|
|
67
|
+
type Post = z.infer<typeof postSchema>;
|
|
68
|
+
type Tag = z.infer<typeof tagSchema>;
|
|
69
|
+
type Author = z.infer<typeof authorSchema>;
|
|
70
|
+
//#endregion
|
|
71
|
+
export { type Author, type Post, type Tag, authorSchema, postSchema, index_d_exports as t, tagSchema };
|
|
72
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { t as __exportAll } from "../chunk-pbuEa-1d.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/content/index.ts
|
|
4
|
+
var content_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
authorSchema: () => authorSchema,
|
|
6
|
+
postSchema: () => postSchema,
|
|
7
|
+
tagSchema: () => tagSchema
|
|
8
|
+
});
|
|
9
|
+
const postSchema = z.object({
|
|
10
|
+
author: z.string().optional(),
|
|
11
|
+
cover: z.string().optional(),
|
|
12
|
+
coverAlt: z.string().optional(),
|
|
13
|
+
description: z.string().min(1),
|
|
14
|
+
draft: z.boolean().default(false),
|
|
15
|
+
pubDate: z.coerce.date(),
|
|
16
|
+
series: z.string().optional(),
|
|
17
|
+
tags: z.array(z.string()).default([]),
|
|
18
|
+
title: z.string().min(1),
|
|
19
|
+
updatedDate: z.coerce.date().optional()
|
|
20
|
+
});
|
|
21
|
+
const tagSchema = z.object({
|
|
22
|
+
description: z.string().optional(),
|
|
23
|
+
name: z.string().min(1)
|
|
24
|
+
});
|
|
25
|
+
const authorSchema = z.object({
|
|
26
|
+
avatar: z.string().optional(),
|
|
27
|
+
bio: z.string().optional(),
|
|
28
|
+
name: z.string().min(1),
|
|
29
|
+
url: z.string().url().optional()
|
|
30
|
+
});
|
|
31
|
+
//#endregion
|
|
32
|
+
export { authorSchema, postSchema, content_exports as t, tagSchema };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/content/index.ts"],"sourcesContent":["import { z } from \"zod\";\n\nconst postSchema = z.object({\n author: z.string().optional(),\n cover: z.string().optional(),\n coverAlt: z.string().optional(),\n description: z.string().min(1),\n draft: z.boolean().default(false),\n pubDate: z.coerce.date(),\n series: z.string().optional(),\n tags: z.array(z.string()).default([]),\n title: z.string().min(1),\n updatedDate: z.coerce.date().optional(),\n});\n\nconst tagSchema = z.object({\n description: z.string().optional(),\n name: z.string().min(1),\n});\n\nconst authorSchema = z.object({\n avatar: z.string().optional(),\n bio: z.string().optional(),\n name: z.string().min(1),\n url: z.string().url().optional(),\n});\n\ntype Post = z.infer<typeof postSchema>;\ntype Tag = z.infer<typeof tagSchema>;\ntype Author = z.infer<typeof authorSchema>;\n\nexport { authorSchema, postSchema, tagSchema };\nexport type { Author, Post, Tag };\n"],"mappings":";;;;;;;;AAEA,MAAM,aAAa,EAAE,OAAO;CAC1B,QAAQ,EAAE,OAAO,EAAE,SAAS;CAC5B,OAAO,EAAE,OAAO,EAAE,SAAS;CAC3B,UAAU,EAAE,OAAO,EAAE,SAAS;CAC9B,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC;CAC7B,OAAO,EAAE,QAAQ,EAAE,QAAQ,KAAK;CAChC,SAAS,EAAE,OAAO,KAAK;CACvB,QAAQ,EAAE,OAAO,EAAE,SAAS;CAC5B,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;CACpC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC;CACvB,aAAa,EAAE,OAAO,KAAK,EAAE,SAAS;AACxC,CAAC;AAED,MAAM,YAAY,EAAE,OAAO;CACzB,aAAa,EAAE,OAAO,EAAE,SAAS;CACjC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AACxB,CAAC;AAED,MAAM,eAAe,EAAE,OAAO;CAC5B,QAAQ,EAAE,OAAO,EAAE,SAAS;CAC5B,KAAK,EAAE,OAAO,EAAE,SAAS;CACzB,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;CACtB,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AACjC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ClassValue } from "clsx";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/cn.d.ts
|
|
4
|
+
declare const cn: (...inputs: Array<ClassValue>) => string;
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/lib/format-date.d.ts
|
|
7
|
+
declare const formatDate: (date: Date, locale?: string, options?: Intl.DateTimeFormatOptions) => string;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/lib/get-related-posts.d.ts
|
|
10
|
+
type HasTags = {
|
|
11
|
+
data: {
|
|
12
|
+
tags: Array<string>;
|
|
13
|
+
};
|
|
14
|
+
slug: string;
|
|
15
|
+
};
|
|
16
|
+
declare const getRelatedPosts: <T extends HasTags>(current: T, all: Array<T>, n: number) => T[];
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/lib/reading-time.d.ts
|
|
19
|
+
declare const readingTime: (input: string) => {
|
|
20
|
+
minutes: number;
|
|
21
|
+
words: number;
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/lib/slugify.d.ts
|
|
25
|
+
declare const slugify: (input: string) => string;
|
|
26
|
+
declare namespace index_d_exports {
|
|
27
|
+
export { cn, formatDate, getRelatedPosts, readingTime, slugify };
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { formatDate as a, getRelatedPosts as i, slugify as n, cn as o, readingTime as r, index_d_exports as t };
|
|
31
|
+
//# sourceMappingURL=index-BAPPsft-.d.ts.map
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED