@ampless/runtime 0.2.0-alpha.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.
@@ -0,0 +1,92 @@
1
+ // src/routes/og.ts
2
+ import { ImageResponse } from "next/og";
3
+ import { loadImageForOg } from "@ampless/plugin-og-image/load-image";
4
+ function hasOgImage(p) {
5
+ return typeof p === "object" && p !== null && "ogImage" in p && p.ogImage != null;
6
+ }
7
+ function createOgRouteHandler(ampless) {
8
+ return async function GET(_req, { params }) {
9
+ const { siteId, slug } = await params;
10
+ const cleanSlug = slug.replace(/\.png$/, "");
11
+ const post = await ampless.getPublishedPost(cleanSlug, { siteId });
12
+ if (!post) return new Response("not found", { status: 404 });
13
+ const plugin = (ampless.cmsConfig.plugins ?? []).find(hasOgImage);
14
+ if (!plugin) return new Response("og not configured", { status: 404 });
15
+ const settings = await ampless.loadSiteSettings(siteId);
16
+ const fonts = await Promise.all(
17
+ plugin.ogImage.fonts.map(async (f) => ({
18
+ name: f.name,
19
+ data: typeof f.data === "function" ? await f.data() : f.data,
20
+ weight: f.weight,
21
+ style: f.style
22
+ }))
23
+ );
24
+ const element = await plugin.ogImage.render({
25
+ post,
26
+ site: settings.site,
27
+ image: loadImageForOg
28
+ });
29
+ const options = {
30
+ width: plugin.ogImage.size?.width ?? 1200,
31
+ height: plugin.ogImage.size?.height ?? 630,
32
+ fonts,
33
+ headers: {
34
+ // Short browser TTL, long CDN TTL: when a post is edited the
35
+ // browser refetches within an hour but the Amplify-fronted
36
+ // CloudFront stays warm for a day.
37
+ "Cache-Control": "public, max-age=3600, s-maxage=86400, stale-while-revalidate=86400"
38
+ }
39
+ };
40
+ return new ImageResponse(element, options);
41
+ };
42
+ }
43
+
44
+ // src/routes/sitemap.ts
45
+ function createSitemapRouteHandler(ampless) {
46
+ return async function GET(request, { params }) {
47
+ const { siteId } = await params;
48
+ const { module } = await ampless.resolveActiveTheme(siteId);
49
+ const handler = module.routes?.sitemap;
50
+ if (!handler) {
51
+ return new Response("sitemap not implemented for this theme", { status: 404 });
52
+ }
53
+ return handler({ siteId, request });
54
+ };
55
+ }
56
+
57
+ // src/routes/feed.ts
58
+ function createFeedRouteHandler(ampless) {
59
+ return async function GET(request, { params }) {
60
+ const { siteId } = await params;
61
+ const { module } = await ampless.resolveActiveTheme(siteId);
62
+ const handler = module.routes?.feed;
63
+ if (!handler) {
64
+ return new Response("feed not implemented for this theme", { status: 404 });
65
+ }
66
+ return handler({ siteId, request });
67
+ };
68
+ }
69
+
70
+ // src/routes/raw.ts
71
+ function createRawRouteHandler(ampless) {
72
+ return async function GET(_request, { params }) {
73
+ const { siteId, slug } = await params;
74
+ const post = await ampless.getPublishedPost(slug, { siteId });
75
+ if (!post) {
76
+ return new Response("Not Found", { status: 404 });
77
+ }
78
+ return new Response(ampless.renderBody(post), {
79
+ status: 200,
80
+ headers: {
81
+ "Content-Type": "text/html; charset=utf-8",
82
+ "Cache-Control": "public, max-age=300"
83
+ }
84
+ });
85
+ };
86
+ }
87
+ export {
88
+ createFeedRouteHandler,
89
+ createOgRouteHandler,
90
+ createRawRouteHandler,
91
+ createSitemapRouteHandler
92
+ };
@@ -0,0 +1,73 @@
1
+ import { ClassValue } from 'clsx';
2
+ import * as class_variance_authority_types from 'class-variance-authority/types';
3
+ import * as React from 'react';
4
+ import { VariantProps } from 'class-variance-authority';
5
+ import * as react_jsx_runtime from 'react/jsx-runtime';
6
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
7
+ import * as LabelPrimitive from '@radix-ui/react-label';
8
+
9
+ declare function cn(...inputs: ClassValue[]): string;
10
+
11
+ declare const buttonVariants: (props?: ({
12
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
13
+ size?: "default" | "sm" | "lg" | "icon" | null | undefined;
14
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
15
+ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
16
+ asChild?: boolean;
17
+ }
18
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
19
+
20
+ declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
21
+ declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
22
+ declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
23
+ declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
24
+ declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
25
+ declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
26
+
27
+ declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
28
+ declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
29
+ declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
30
+ declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
31
+ declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
32
+ declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
33
+ declare const DialogHeader: {
34
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
35
+ displayName: string;
36
+ };
37
+ declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
38
+ declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
39
+
40
+ declare const Input: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
41
+
42
+ declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_types.ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
43
+
44
+ declare const Sheet: React.FC<DialogPrimitive.DialogProps>;
45
+ declare const SheetTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
46
+ declare const SheetClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
47
+ declare const SheetPortal: React.FC<DialogPrimitive.DialogPortalProps>;
48
+ declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
49
+ declare const sheetVariants: (props?: ({
50
+ side?: "top" | "bottom" | "left" | "right" | null | undefined;
51
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
52
+ interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheetVariants> {
53
+ /** Hide the built-in × close button (useful when the parent provides one). */
54
+ hideCloseButton?: boolean;
55
+ }
56
+ declare const SheetContent: React.ForwardRefExoticComponent<SheetContentProps & React.RefAttributes<HTMLDivElement>>;
57
+ declare const SheetHeader: {
58
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
59
+ displayName: string;
60
+ };
61
+ declare const SheetTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
62
+ declare const SheetDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
63
+
64
+ declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
65
+ declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
66
+ declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
67
+ declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
68
+ declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
69
+ declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
70
+
71
+ declare const Textarea: React.ForwardRefExoticComponent<React.TextareaHTMLAttributes<HTMLTextAreaElement> & React.RefAttributes<HTMLTextAreaElement>>;
72
+
73
+ export { Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Dialog, DialogClose, DialogContent, DialogDescription, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Input, Label, Sheet, SheetClose, SheetContent, SheetDescription, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Textarea, buttonVariants, cn };
@@ -0,0 +1,362 @@
1
+ // src/ui/cn.ts
2
+ import { clsx } from "clsx";
3
+ import { twMerge } from "tailwind-merge";
4
+ function cn(...inputs) {
5
+ return twMerge(clsx(inputs));
6
+ }
7
+
8
+ // src/ui/button.tsx
9
+ import * as React from "react";
10
+ import { Slot } from "@radix-ui/react-slot";
11
+ import { cva } from "class-variance-authority";
12
+ import { jsx } from "react/jsx-runtime";
13
+ var buttonVariants = cva(
14
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
15
+ {
16
+ variants: {
17
+ variant: {
18
+ default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
19
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
20
+ outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
21
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
22
+ ghost: "hover:bg-accent hover:text-accent-foreground",
23
+ link: "text-primary underline-offset-4 hover:underline"
24
+ },
25
+ size: {
26
+ default: "h-9 px-4 py-2",
27
+ sm: "h-8 rounded-md px-3 text-xs",
28
+ lg: "h-10 rounded-md px-8",
29
+ icon: "h-9 w-9"
30
+ }
31
+ },
32
+ defaultVariants: {
33
+ variant: "default",
34
+ size: "default"
35
+ }
36
+ }
37
+ );
38
+ var Button = React.forwardRef(
39
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
40
+ const Comp = asChild ? Slot : "button";
41
+ return /* @__PURE__ */ jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref, ...props });
42
+ }
43
+ );
44
+ Button.displayName = "Button";
45
+
46
+ // src/ui/card.tsx
47
+ import * as React2 from "react";
48
+ import { jsx as jsx2 } from "react/jsx-runtime";
49
+ var Card = React2.forwardRef(
50
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
51
+ "div",
52
+ {
53
+ ref,
54
+ className: cn("rounded-xl border bg-card text-card-foreground shadow", className),
55
+ ...props
56
+ }
57
+ )
58
+ );
59
+ Card.displayName = "Card";
60
+ var CardHeader = React2.forwardRef(
61
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx2("div", { ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })
62
+ );
63
+ CardHeader.displayName = "CardHeader";
64
+ var CardTitle = React2.forwardRef(
65
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx2("div", { ref, className: cn("font-semibold leading-none tracking-tight", className), ...props })
66
+ );
67
+ CardTitle.displayName = "CardTitle";
68
+ var CardDescription = React2.forwardRef(
69
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx2("div", { ref, className: cn("text-sm text-muted-foreground", className), ...props })
70
+ );
71
+ CardDescription.displayName = "CardDescription";
72
+ var CardContent = React2.forwardRef(
73
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx2("div", { ref, className: cn("p-6 pt-0", className), ...props })
74
+ );
75
+ CardContent.displayName = "CardContent";
76
+ var CardFooter = React2.forwardRef(
77
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx2("div", { ref, className: cn("flex items-center p-6 pt-0", className), ...props })
78
+ );
79
+ CardFooter.displayName = "CardFooter";
80
+
81
+ // src/ui/dialog.tsx
82
+ import * as React3 from "react";
83
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
84
+ import { X } from "lucide-react";
85
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
86
+ var Dialog = DialogPrimitive.Root;
87
+ var DialogTrigger = DialogPrimitive.Trigger;
88
+ var DialogPortal = DialogPrimitive.Portal;
89
+ var DialogClose = DialogPrimitive.Close;
90
+ var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
91
+ DialogPrimitive.Overlay,
92
+ {
93
+ ref,
94
+ className: cn("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm", className),
95
+ ...props
96
+ }
97
+ ));
98
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
99
+ var DialogContent = React3.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
100
+ /* @__PURE__ */ jsx3(DialogOverlay, {}),
101
+ /* @__PURE__ */ jsxs(
102
+ DialogPrimitive.Content,
103
+ {
104
+ ref,
105
+ className: cn(
106
+ "fixed left-1/2 top-1/2 z-50 grid w-full max-w-3xl -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background p-6 shadow-lg sm:rounded-lg",
107
+ className
108
+ ),
109
+ ...props,
110
+ children: [
111
+ children,
112
+ /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none", children: [
113
+ /* @__PURE__ */ jsx3(X, { className: "h-4 w-4" }),
114
+ /* @__PURE__ */ jsx3("span", { className: "sr-only", children: "Close" })
115
+ ] })
116
+ ]
117
+ }
118
+ )
119
+ ] }));
120
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
121
+ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx3("div", { className: cn("flex flex-col space-y-1.5 text-left", className), ...props });
122
+ DialogHeader.displayName = "DialogHeader";
123
+ var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
124
+ DialogPrimitive.Title,
125
+ {
126
+ ref,
127
+ className: cn("text-lg font-semibold leading-none", className),
128
+ ...props
129
+ }
130
+ ));
131
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
132
+ var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
133
+ DialogPrimitive.Description,
134
+ {
135
+ ref,
136
+ className: cn("text-sm text-muted-foreground", className),
137
+ ...props
138
+ }
139
+ ));
140
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
141
+
142
+ // src/ui/input.tsx
143
+ import * as React4 from "react";
144
+ import { jsx as jsx4 } from "react/jsx-runtime";
145
+ var Input = React4.forwardRef(
146
+ ({ className, type, ...props }, ref) => {
147
+ return /* @__PURE__ */ jsx4(
148
+ "input",
149
+ {
150
+ type,
151
+ className: cn(
152
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
153
+ className
154
+ ),
155
+ ref,
156
+ ...props
157
+ }
158
+ );
159
+ }
160
+ );
161
+ Input.displayName = "Input";
162
+
163
+ // src/ui/label.tsx
164
+ import * as React5 from "react";
165
+ import * as LabelPrimitive from "@radix-ui/react-label";
166
+ import { cva as cva2 } from "class-variance-authority";
167
+ import { jsx as jsx5 } from "react/jsx-runtime";
168
+ var labelVariants = cva2(
169
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
170
+ );
171
+ var Label = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx5(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
172
+ Label.displayName = LabelPrimitive.Root.displayName;
173
+
174
+ // src/ui/sheet.tsx
175
+ import * as React6 from "react";
176
+ import * as DialogPrimitive2 from "@radix-ui/react-dialog";
177
+ import { X as X2 } from "lucide-react";
178
+ import { cva as cva3 } from "class-variance-authority";
179
+ import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
180
+ var Sheet = DialogPrimitive2.Root;
181
+ var SheetTrigger = DialogPrimitive2.Trigger;
182
+ var SheetClose = DialogPrimitive2.Close;
183
+ var SheetPortal = DialogPrimitive2.Portal;
184
+ var SheetOverlay = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
185
+ DialogPrimitive2.Overlay,
186
+ {
187
+ ref,
188
+ className: cn(
189
+ "fixed inset-0 z-50 bg-black/60 backdrop-blur-sm transition-opacity duration-200",
190
+ "data-[state=open]:opacity-100 data-[state=closed]:opacity-0",
191
+ className
192
+ ),
193
+ ...props
194
+ }
195
+ ));
196
+ SheetOverlay.displayName = DialogPrimitive2.Overlay.displayName;
197
+ var sheetVariants = cva3(
198
+ "fixed z-50 gap-4 bg-[var(--background)] shadow-lg transition-transform duration-200 ease-out",
199
+ {
200
+ variants: {
201
+ side: {
202
+ top: "inset-x-0 top-0 border-b data-[state=closed]:-translate-y-full data-[state=open]:translate-y-0",
203
+ bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:translate-y-full data-[state=open]:translate-y-0",
204
+ left: "inset-y-0 left-0 h-full w-3/4 max-w-sm border-r data-[state=closed]:-translate-x-full data-[state=open]:translate-x-0",
205
+ right: "inset-y-0 right-0 h-full w-3/4 max-w-sm border-l data-[state=closed]:translate-x-full data-[state=open]:translate-x-0"
206
+ }
207
+ },
208
+ defaultVariants: {
209
+ side: "right"
210
+ }
211
+ }
212
+ );
213
+ var SheetContent = React6.forwardRef(({ side = "right", hideCloseButton, className, children, ...props }, ref) => /* @__PURE__ */ jsxs2(SheetPortal, { children: [
214
+ /* @__PURE__ */ jsx6(SheetOverlay, {}),
215
+ /* @__PURE__ */ jsxs2(
216
+ DialogPrimitive2.Content,
217
+ {
218
+ ref,
219
+ className: cn(sheetVariants({ side }), className),
220
+ ...props,
221
+ children: [
222
+ children,
223
+ !hideCloseButton && /* @__PURE__ */ jsxs2(DialogPrimitive2.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none", children: [
224
+ /* @__PURE__ */ jsx6(X2, { className: "h-4 w-4" }),
225
+ /* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Close" })
226
+ ] })
227
+ ]
228
+ }
229
+ )
230
+ ] }));
231
+ SheetContent.displayName = DialogPrimitive2.Content.displayName;
232
+ var SheetHeader = ({ className, ...props }) => /* @__PURE__ */ jsx6("div", { className: cn("flex flex-col gap-1 px-6 py-4 text-left", className), ...props });
233
+ SheetHeader.displayName = "SheetHeader";
234
+ var SheetTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
235
+ DialogPrimitive2.Title,
236
+ {
237
+ ref,
238
+ className: cn("text-base font-semibold leading-none", className),
239
+ ...props
240
+ }
241
+ ));
242
+ SheetTitle.displayName = DialogPrimitive2.Title.displayName;
243
+ var SheetDescription = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
244
+ DialogPrimitive2.Description,
245
+ {
246
+ ref,
247
+ className: cn("text-sm text-muted-foreground", className),
248
+ ...props
249
+ }
250
+ ));
251
+ SheetDescription.displayName = DialogPrimitive2.Description.displayName;
252
+
253
+ // src/ui/table.tsx
254
+ import * as React7 from "react";
255
+ import { jsx as jsx7 } from "react/jsx-runtime";
256
+ var Table = React7.forwardRef(
257
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx7("table", { ref, className: cn("w-full caption-bottom text-sm", className), ...props }) })
258
+ );
259
+ Table.displayName = "Table";
260
+ var TableHeader = React7.forwardRef(
261
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx7("thead", { ref, className: cn("[&_tr]:border-b", className), ...props })
262
+ );
263
+ TableHeader.displayName = "TableHeader";
264
+ var TableBody = React7.forwardRef(
265
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx7("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props })
266
+ );
267
+ TableBody.displayName = "TableBody";
268
+ var TableRow = React7.forwardRef(
269
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
270
+ "tr",
271
+ {
272
+ ref,
273
+ className: cn(
274
+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
275
+ className
276
+ ),
277
+ ...props
278
+ }
279
+ )
280
+ );
281
+ TableRow.displayName = "TableRow";
282
+ var TableHead = React7.forwardRef(
283
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
284
+ "th",
285
+ {
286
+ ref,
287
+ className: cn(
288
+ "h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
289
+ className
290
+ ),
291
+ ...props
292
+ }
293
+ )
294
+ );
295
+ TableHead.displayName = "TableHead";
296
+ var TableCell = React7.forwardRef(
297
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
298
+ "td",
299
+ {
300
+ ref,
301
+ className: cn("p-2 align-middle [&:has([role=checkbox])]:pr-0", className),
302
+ ...props
303
+ }
304
+ )
305
+ );
306
+ TableCell.displayName = "TableCell";
307
+
308
+ // src/ui/textarea.tsx
309
+ import * as React8 from "react";
310
+ import { jsx as jsx8 } from "react/jsx-runtime";
311
+ var Textarea = React8.forwardRef(({ className, ...props }, ref) => {
312
+ return /* @__PURE__ */ jsx8(
313
+ "textarea",
314
+ {
315
+ className: cn(
316
+ "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
317
+ className
318
+ ),
319
+ ref,
320
+ ...props
321
+ }
322
+ );
323
+ });
324
+ Textarea.displayName = "Textarea";
325
+ export {
326
+ Button,
327
+ Card,
328
+ CardContent,
329
+ CardDescription,
330
+ CardFooter,
331
+ CardHeader,
332
+ CardTitle,
333
+ Dialog,
334
+ DialogClose,
335
+ DialogContent,
336
+ DialogDescription,
337
+ DialogHeader,
338
+ DialogOverlay,
339
+ DialogPortal,
340
+ DialogTitle,
341
+ DialogTrigger,
342
+ Input,
343
+ Label,
344
+ Sheet,
345
+ SheetClose,
346
+ SheetContent,
347
+ SheetDescription,
348
+ SheetHeader,
349
+ SheetOverlay,
350
+ SheetPortal,
351
+ SheetTitle,
352
+ SheetTrigger,
353
+ Table,
354
+ TableBody,
355
+ TableCell,
356
+ TableHead,
357
+ TableHeader,
358
+ TableRow,
359
+ Textarea,
360
+ buttonVariants,
361
+ cn
362
+ };
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@ampless/runtime",
3
+ "version": "0.2.0-alpha.0",
4
+ "description": "Public-side runtime for ampless: post fetching, theme dispatch, middleware, public route handlers",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ },
12
+ "./middleware": {
13
+ "import": "./dist/middleware.js",
14
+ "types": "./dist/middleware.d.ts"
15
+ },
16
+ "./routes": {
17
+ "import": "./dist/routes/index.js",
18
+ "types": "./dist/routes/index.d.ts"
19
+ },
20
+ "./dispatchers": {
21
+ "import": "./dist/dispatchers/index.js",
22
+ "types": "./dist/dispatchers/index.d.ts"
23
+ },
24
+ "./ui": {
25
+ "import": "./dist/ui/index.js",
26
+ "types": "./dist/ui/index.d.ts"
27
+ }
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "README.md"
32
+ ],
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/heavymoons/ampless.git",
39
+ "directory": "packages/runtime"
40
+ },
41
+ "homepage": "https://github.com/heavymoons/ampless/tree/main/packages/runtime#readme",
42
+ "bugs": "https://github.com/heavymoons/ampless/issues",
43
+ "dependencies": {
44
+ "@radix-ui/react-dialog": "^1.1.4",
45
+ "@radix-ui/react-label": "^2.1.1",
46
+ "@radix-ui/react-slot": "^1.1.1",
47
+ "class-variance-authority": "^0.7.1",
48
+ "clsx": "^2.1.1",
49
+ "lucide-react": "^0.469.0",
50
+ "tailwind-merge": "^2.6.0",
51
+ "ampless": "0.2.0-alpha.0",
52
+ "@ampless/plugin-og-image": "0.2.0-alpha.0"
53
+ },
54
+ "peerDependencies": {
55
+ "next": "^15",
56
+ "react": "^18 || ^19",
57
+ "react-dom": "^18 || ^19",
58
+ "aws-amplify": "^6",
59
+ "@aws-amplify/adapter-nextjs": "^1"
60
+ },
61
+ "devDependencies": {
62
+ "@types/react": "^19.0.0",
63
+ "next": "^15.1.0",
64
+ "react": "^19.0.0"
65
+ },
66
+ "keywords": [
67
+ "ampless",
68
+ "runtime",
69
+ "cms"
70
+ ],
71
+ "scripts": {
72
+ "build": "tsup",
73
+ "dev": "tsup --watch",
74
+ "lint": "tsc --noEmit",
75
+ "test": "vitest run --passWithNoTests"
76
+ }
77
+ }