create-sordo 0.4.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -119
- package/README.md +3 -49
- package/bin/create-sordo.ts +1 -10
- package/package.json +7 -13
- package/src/index.ts +0 -667
- package/src/probes.ts +0 -28
- package/src/prompts.ts +0 -141
- package/src/readme.ts +0 -74
- package/src/ui.ts +0 -151
- package/src/versions.ts +0 -3
- package/templates/_backend/app/routes/api/todos.ts +0 -27
- package/templates/_claude/.claude/commands/sordo-init.md +0 -64
- package/templates/_claude/.claude/hooks/biome-check.sh +0 -17
- package/templates/_claude/.claude/rules/build-time-discovery.md +0 -17
- package/templates/_claude/.claude/rules/bun-native.md +0 -28
- package/templates/_claude/.claude/rules/filesystem-routing.md +0 -31
- package/templates/_claude/.claude/rules/islands.md +0 -46
- package/templates/_claude/.claude/rules/optional-ai.md +0 -16
- package/templates/_claude/.claude/rules/web-standards-boundary.md +0 -25
- package/templates/_claude/.claude/settings.json +0 -22
- package/templates/_claude/.claude/skills/sordo/SKILL.md +0 -120
- package/templates/_claude/.claude/skills/sordo-cli/SKILL.md +0 -112
- package/templates/_claude/CLAUDE.md +0 -28
- package/templates/_codex/.codex/README.md +0 -10
- package/templates/_codex/.codex/rules/build-time-discovery.md +0 -17
- package/templates/_codex/.codex/rules/bun-native.md +0 -28
- package/templates/_codex/.codex/rules/filesystem-routing.md +0 -31
- package/templates/_codex/.codex/rules/islands.md +0 -46
- package/templates/_codex/.codex/rules/optional-ai.md +0 -15
- package/templates/_codex/.codex/rules/sordo-cli.md +0 -108
- package/templates/_codex/.codex/rules/sordo-patterns.md +0 -121
- package/templates/_codex/.codex/rules/web-standards-boundary.md +0 -25
- package/templates/_codex/AGENTS.md +0 -27
- package/templates/_container/.dockerignore +0 -7
- package/templates/_container/Dockerfile +0 -27
- package/templates/_monorepo/packages/README.md +0 -18
- package/templates/_shared/sordo-patterns.md +0 -121
- package/templates/default/README-template.md +0 -172
- package/templates/default/app/islands/TodoApp.tsx +0 -83
- package/templates/default/app/routes/api/health.ts +0 -8
- package/templates/default/app/routes/index.tsx +0 -29
- package/templates/default/app/server.ts +0 -28
- package/templates/default/gitignore +0 -8
- package/templates/default/sordo.config.ts +0 -5
- package/templates/default/tsconfig.json +0 -14
- package/templates/ui-shadcn/components/button.tsx +0 -63
- package/templates/ui-shadcn/components/dialog.tsx +0 -158
- package/templates/ui-shadcn/demo/index.tsx +0 -58
- package/templates/ui-starter/_internal/cn.ts +0 -6
- package/templates/ui-starter/_internal/slot.ts +0 -50
- package/templates/ui-starter/_internal/variants.ts +0 -1
- package/templates/ui-starter/button.tsx +0 -60
- package/templates/ui-starter/card.tsx +0 -92
- package/templates/ui-starter/demo/TodoApp.tsx +0 -86
- package/templates/ui-starter/demo/index.tsx +0 -41
- package/templates/ui-starter/input.tsx +0 -20
- package/templates/ui-starter/label.tsx +0 -18
- package/templates/ui-starter/themes/neutral/tokens.css +0 -46
- package/templates/ui-starter/themes/slate/tokens.css +0 -46
- package/templates/ui-starter/themes/stone/tokens.css +0 -46
- package/templates/ui-starter/themes/zinc/tokens.css +0 -46
- package/templates/ui-starter/tokens.css +0 -46
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { cn } from "cn"
|
|
5
|
-
import { XIcon } from "lucide-react"
|
|
6
|
-
import { Dialog as DialogPrimitive } from "radix-ui"
|
|
7
|
-
|
|
8
|
-
import { Button } from "@/components/ui/button"
|
|
9
|
-
|
|
10
|
-
function Dialog({
|
|
11
|
-
...props
|
|
12
|
-
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
13
|
-
return <DialogPrimitive.Root data-slot="dialog" {...props} />
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function DialogTrigger({
|
|
17
|
-
...props
|
|
18
|
-
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
19
|
-
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function DialogPortal({
|
|
23
|
-
...props
|
|
24
|
-
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
25
|
-
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function DialogClose({
|
|
29
|
-
...props
|
|
30
|
-
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
31
|
-
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function DialogOverlay({
|
|
35
|
-
className,
|
|
36
|
-
...props
|
|
37
|
-
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
38
|
-
return (
|
|
39
|
-
<DialogPrimitive.Overlay
|
|
40
|
-
data-slot="dialog-overlay"
|
|
41
|
-
className={cn(
|
|
42
|
-
"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",
|
|
43
|
-
className
|
|
44
|
-
)}
|
|
45
|
-
{...props}
|
|
46
|
-
/>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function DialogContent({
|
|
51
|
-
className,
|
|
52
|
-
children,
|
|
53
|
-
showCloseButton = true,
|
|
54
|
-
...props
|
|
55
|
-
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
56
|
-
showCloseButton?: boolean
|
|
57
|
-
}) {
|
|
58
|
-
return (
|
|
59
|
-
<DialogPortal data-slot="dialog-portal">
|
|
60
|
-
<DialogOverlay />
|
|
61
|
-
<DialogPrimitive.Content
|
|
62
|
-
data-slot="dialog-content"
|
|
63
|
-
className={cn(
|
|
64
|
-
"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",
|
|
65
|
-
className
|
|
66
|
-
)}
|
|
67
|
-
{...props}
|
|
68
|
-
>
|
|
69
|
-
{children}
|
|
70
|
-
{showCloseButton && (
|
|
71
|
-
<DialogPrimitive.Close
|
|
72
|
-
data-slot="dialog-close"
|
|
73
|
-
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"
|
|
74
|
-
>
|
|
75
|
-
<XIcon />
|
|
76
|
-
<span className="sr-only">Close</span>
|
|
77
|
-
</DialogPrimitive.Close>
|
|
78
|
-
)}
|
|
79
|
-
</DialogPrimitive.Content>
|
|
80
|
-
</DialogPortal>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
85
|
-
return (
|
|
86
|
-
<div
|
|
87
|
-
data-slot="dialog-header"
|
|
88
|
-
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
89
|
-
{...props}
|
|
90
|
-
/>
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function DialogFooter({
|
|
95
|
-
className,
|
|
96
|
-
showCloseButton = false,
|
|
97
|
-
children,
|
|
98
|
-
...props
|
|
99
|
-
}: React.ComponentProps<"div"> & {
|
|
100
|
-
showCloseButton?: boolean
|
|
101
|
-
}) {
|
|
102
|
-
return (
|
|
103
|
-
<div
|
|
104
|
-
data-slot="dialog-footer"
|
|
105
|
-
className={cn(
|
|
106
|
-
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
107
|
-
className
|
|
108
|
-
)}
|
|
109
|
-
{...props}
|
|
110
|
-
>
|
|
111
|
-
{children}
|
|
112
|
-
{showCloseButton && (
|
|
113
|
-
<DialogPrimitive.Close asChild>
|
|
114
|
-
<Button variant="outline">Close</Button>
|
|
115
|
-
</DialogPrimitive.Close>
|
|
116
|
-
)}
|
|
117
|
-
</div>
|
|
118
|
-
)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function DialogTitle({
|
|
122
|
-
className,
|
|
123
|
-
...props
|
|
124
|
-
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
125
|
-
return (
|
|
126
|
-
<DialogPrimitive.Title
|
|
127
|
-
data-slot="dialog-title"
|
|
128
|
-
className={cn("text-lg leading-none font-semibold", className)}
|
|
129
|
-
{...props}
|
|
130
|
-
/>
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function DialogDescription({
|
|
135
|
-
className,
|
|
136
|
-
...props
|
|
137
|
-
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
138
|
-
return (
|
|
139
|
-
<DialogPrimitive.Description
|
|
140
|
-
data-slot="dialog-description"
|
|
141
|
-
className={cn("text-sm text-muted-foreground", className)}
|
|
142
|
-
{...props}
|
|
143
|
-
/>
|
|
144
|
-
)
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export {
|
|
148
|
-
Dialog,
|
|
149
|
-
DialogClose,
|
|
150
|
-
DialogContent,
|
|
151
|
-
DialogDescription,
|
|
152
|
-
DialogFooter,
|
|
153
|
-
DialogHeader,
|
|
154
|
-
DialogOverlay,
|
|
155
|
-
DialogPortal,
|
|
156
|
-
DialogTitle,
|
|
157
|
-
DialogTrigger,
|
|
158
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Button } from "@/components/ui/button";
|
|
3
|
-
import {
|
|
4
|
-
Dialog,
|
|
5
|
-
DialogClose,
|
|
6
|
-
DialogContent,
|
|
7
|
-
DialogDescription,
|
|
8
|
-
DialogFooter,
|
|
9
|
-
DialogHeader,
|
|
10
|
-
DialogTitle,
|
|
11
|
-
DialogTrigger,
|
|
12
|
-
} from "@/components/ui/dialog";
|
|
13
|
-
|
|
14
|
-
// Whole-tree hydration: this page's entire React tree hydrates in the browser,
|
|
15
|
-
// so upstream shadcn/ui components work as written — function props, shared
|
|
16
|
-
// context, no island wrappers. Pages without this export ship zero JS.
|
|
17
|
-
export const hydrate = true;
|
|
18
|
-
|
|
19
|
-
export const meta = {
|
|
20
|
-
title: "Welcome to Sordo",
|
|
21
|
-
description: "A Bun-native full-stack meta-framework.",
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default function Index() {
|
|
25
|
-
const [saved, setSaved] = React.useState(0);
|
|
26
|
-
return (
|
|
27
|
-
<main className="mx-auto max-w-2xl space-y-4 p-8">
|
|
28
|
-
<h1 className="font-semibold text-2xl">Welcome to Sordo</h1>
|
|
29
|
-
<p className="text-muted-foreground">
|
|
30
|
-
This page is server-rendered, then hydrated as one React tree. The
|
|
31
|
-
dialog below is upstream shadcn/ui, stamped verbatim into{" "}
|
|
32
|
-
<code>app/components/ui/</code>.
|
|
33
|
-
</p>
|
|
34
|
-
<Dialog>
|
|
35
|
-
<DialogTrigger asChild>
|
|
36
|
-
<Button>Open dialog</Button>
|
|
37
|
-
</DialogTrigger>
|
|
38
|
-
<DialogContent>
|
|
39
|
-
<DialogHeader>
|
|
40
|
-
<DialogTitle>Hello from shadcn/ui</DialogTitle>
|
|
41
|
-
<DialogDescription>
|
|
42
|
-
Function props and shared context cross no island boundary here.
|
|
43
|
-
</DialogDescription>
|
|
44
|
-
</DialogHeader>
|
|
45
|
-
<DialogFooter>
|
|
46
|
-
<DialogClose asChild>
|
|
47
|
-
<Button onClick={() => setSaved((n) => n + 1)}>Save</Button>
|
|
48
|
-
</DialogClose>
|
|
49
|
-
</DialogFooter>
|
|
50
|
-
</DialogContent>
|
|
51
|
-
</Dialog>
|
|
52
|
-
<p className="text-muted-foreground text-sm">Saved {saved} time(s).</p>
|
|
53
|
-
<p className="text-muted-foreground text-sm">
|
|
54
|
-
Add more with <code>bunx sordo add @shadcn/<name></code>.
|
|
55
|
-
</p>
|
|
56
|
-
</main>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Children,
|
|
3
|
-
cloneElement,
|
|
4
|
-
isValidElement,
|
|
5
|
-
type ReactElement,
|
|
6
|
-
type ReactNode,
|
|
7
|
-
} from "react";
|
|
8
|
-
|
|
9
|
-
interface SlotProps {
|
|
10
|
-
children?: ReactNode;
|
|
11
|
-
[key: string]: unknown;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function Slot({
|
|
15
|
-
children,
|
|
16
|
-
...slotProps
|
|
17
|
-
}: SlotProps): ReactElement | null {
|
|
18
|
-
const child = Children.only(children);
|
|
19
|
-
if (!isValidElement(child)) return null;
|
|
20
|
-
const childEl = child as ReactElement<Record<string, unknown>>;
|
|
21
|
-
return cloneElement(childEl, mergeProps(slotProps, childEl.props));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function mergeProps(
|
|
25
|
-
parent: Record<string, unknown>,
|
|
26
|
-
child: Record<string, unknown>,
|
|
27
|
-
): Record<string, unknown> {
|
|
28
|
-
const merged: Record<string, unknown> = { ...parent };
|
|
29
|
-
for (const key of Object.keys(child)) {
|
|
30
|
-
const parentVal = parent[key];
|
|
31
|
-
const childVal = child[key];
|
|
32
|
-
if (
|
|
33
|
-
key.startsWith("on") &&
|
|
34
|
-
typeof parentVal === "function" &&
|
|
35
|
-
typeof childVal === "function"
|
|
36
|
-
) {
|
|
37
|
-
merged[key] = (...args: unknown[]) => {
|
|
38
|
-
(childVal as (...a: unknown[]) => unknown)(...args);
|
|
39
|
-
(parentVal as (...a: unknown[]) => unknown)(...args);
|
|
40
|
-
};
|
|
41
|
-
} else if (key === "className") {
|
|
42
|
-
merged[key] = [parentVal, childVal].filter(Boolean).join(" ");
|
|
43
|
-
} else if (key === "style") {
|
|
44
|
-
merged[key] = { ...(parentVal as object), ...(childVal as object) };
|
|
45
|
-
} else {
|
|
46
|
-
merged[key] = childVal;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return merged;
|
|
50
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { cva, type VariantProps } from "class-variance-authority";
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps } from "react";
|
|
2
|
-
import { cn } from "./_internal/cn.ts";
|
|
3
|
-
import { Slot } from "./_internal/slot.ts";
|
|
4
|
-
import { cva, type VariantProps } from "./_internal/variants.ts";
|
|
5
|
-
|
|
6
|
-
export const island = "subtree" as const;
|
|
7
|
-
|
|
8
|
-
export const buttonVariants = cva(
|
|
9
|
-
"inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium text-sm outline-none transition-all 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 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0",
|
|
10
|
-
{
|
|
11
|
-
variants: {
|
|
12
|
-
variant: {
|
|
13
|
-
default:
|
|
14
|
-
"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
15
|
-
destructive:
|
|
16
|
-
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20",
|
|
17
|
-
outline:
|
|
18
|
-
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",
|
|
19
|
-
secondary:
|
|
20
|
-
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
21
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
22
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
23
|
-
},
|
|
24
|
-
size: {
|
|
25
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
26
|
-
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
|
27
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
28
|
-
icon: "size-9",
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
defaultVariants: { variant: "default", size: "default" },
|
|
32
|
-
},
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
export type ButtonVariant = NonNullable<
|
|
36
|
-
VariantProps<typeof buttonVariants>["variant"]
|
|
37
|
-
>;
|
|
38
|
-
export type ButtonSize = NonNullable<
|
|
39
|
-
VariantProps<typeof buttonVariants>["size"]
|
|
40
|
-
>;
|
|
41
|
-
|
|
42
|
-
type ButtonProps = ComponentProps<"button"> &
|
|
43
|
-
VariantProps<typeof buttonVariants> & { asChild?: boolean };
|
|
44
|
-
|
|
45
|
-
export function Button({
|
|
46
|
-
className,
|
|
47
|
-
variant,
|
|
48
|
-
size,
|
|
49
|
-
asChild = false,
|
|
50
|
-
...props
|
|
51
|
-
}: ButtonProps) {
|
|
52
|
-
const Comp = asChild ? Slot : "button";
|
|
53
|
-
return (
|
|
54
|
-
<Comp
|
|
55
|
-
data-slot="button"
|
|
56
|
-
className={cn(buttonVariants({ variant, size }), className)}
|
|
57
|
-
{...props}
|
|
58
|
-
/>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps } from "react";
|
|
2
|
-
import { cn } from "./_internal/cn.ts";
|
|
3
|
-
import { Slot } from "./_internal/slot.ts";
|
|
4
|
-
|
|
5
|
-
export const island = false as const;
|
|
6
|
-
|
|
7
|
-
export function Card({ className, ...props }: ComponentProps<"div">) {
|
|
8
|
-
return (
|
|
9
|
-
<div
|
|
10
|
-
data-slot="card"
|
|
11
|
-
className={cn(
|
|
12
|
-
"flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",
|
|
13
|
-
className,
|
|
14
|
-
)}
|
|
15
|
-
{...props}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function CardHeader({ className, ...props }: ComponentProps<"div">) {
|
|
21
|
-
return (
|
|
22
|
-
<div
|
|
23
|
-
data-slot="card-header"
|
|
24
|
-
className={cn(
|
|
25
|
-
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto]",
|
|
26
|
-
className,
|
|
27
|
-
)}
|
|
28
|
-
{...props}
|
|
29
|
-
/>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function CardTitle({
|
|
34
|
-
className,
|
|
35
|
-
asChild = false,
|
|
36
|
-
...props
|
|
37
|
-
}: ComponentProps<"div"> & { asChild?: boolean }) {
|
|
38
|
-
const Comp = asChild ? Slot : "div";
|
|
39
|
-
return (
|
|
40
|
-
<Comp
|
|
41
|
-
data-slot="card-title"
|
|
42
|
-
className={cn("font-semibold leading-none", className)}
|
|
43
|
-
{...props}
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function CardDescription({
|
|
49
|
-
className,
|
|
50
|
-
...props
|
|
51
|
-
}: ComponentProps<"div">) {
|
|
52
|
-
return (
|
|
53
|
-
<div
|
|
54
|
-
data-slot="card-description"
|
|
55
|
-
className={cn("text-muted-foreground text-sm", className)}
|
|
56
|
-
{...props}
|
|
57
|
-
/>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function CardAction({ className, ...props }: ComponentProps<"div">) {
|
|
62
|
-
return (
|
|
63
|
-
<div
|
|
64
|
-
data-slot="card-action"
|
|
65
|
-
className={cn(
|
|
66
|
-
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
67
|
-
className,
|
|
68
|
-
)}
|
|
69
|
-
{...props}
|
|
70
|
-
/>
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function CardContent({ className, ...props }: ComponentProps<"div">) {
|
|
75
|
-
return (
|
|
76
|
-
<div
|
|
77
|
-
data-slot="card-content"
|
|
78
|
-
className={cn("px-6", className)}
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function CardFooter({ className, ...props }: ComponentProps<"div">) {
|
|
85
|
-
return (
|
|
86
|
-
<div
|
|
87
|
-
data-slot="card-footer"
|
|
88
|
-
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
|
89
|
-
{...props}
|
|
90
|
-
/>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { Button } from "../components/ui/button.tsx";
|
|
5
|
-
import { Input } from "../components/ui/input.tsx";
|
|
6
|
-
|
|
7
|
-
interface Todo {
|
|
8
|
-
id: number;
|
|
9
|
-
text: string;
|
|
10
|
-
done: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default function TodoApp() {
|
|
14
|
-
const [todos, setTodos] = useState<Todo[]>([
|
|
15
|
-
{ id: 1, text: "edit app/routes/index.tsx", done: false },
|
|
16
|
-
{ id: 2, text: "edit app/islands/TodoApp.tsx", done: false },
|
|
17
|
-
{ id: 3, text: "add a component with `sordo add`", done: false },
|
|
18
|
-
]);
|
|
19
|
-
const [draft, setDraft] = useState("");
|
|
20
|
-
|
|
21
|
-
function add(): void {
|
|
22
|
-
const text = draft.trim();
|
|
23
|
-
if (!text) return;
|
|
24
|
-
setTodos([...todos, { id: Date.now(), text, done: false }]);
|
|
25
|
-
setDraft("");
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function toggle(id: number): void {
|
|
29
|
-
setTodos(todos.map((t) => (t.id === id ? { ...t, done: !t.done } : t)));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function remove(id: number): void {
|
|
33
|
-
setTodos(todos.filter((t) => t.id !== id));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<section aria-label="Todo demo" className="flex flex-col gap-3">
|
|
38
|
-
<form
|
|
39
|
-
className="flex gap-2"
|
|
40
|
-
onSubmit={(e) => {
|
|
41
|
-
e.preventDefault();
|
|
42
|
-
add();
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
<Input
|
|
46
|
-
type="text"
|
|
47
|
-
value={draft}
|
|
48
|
-
onChange={(e) => setDraft(e.target.value)}
|
|
49
|
-
placeholder="What needs doing?"
|
|
50
|
-
aria-label="New todo"
|
|
51
|
-
/>
|
|
52
|
-
<Button type="submit">Add</Button>
|
|
53
|
-
</form>
|
|
54
|
-
<ul className="flex flex-col gap-2">
|
|
55
|
-
{todos.map((t) => (
|
|
56
|
-
<li key={t.id} className="flex items-center gap-2">
|
|
57
|
-
<label className="flex flex-1 items-center gap-2">
|
|
58
|
-
<input
|
|
59
|
-
type="checkbox"
|
|
60
|
-
checked={t.done}
|
|
61
|
-
onChange={() => toggle(t.id)}
|
|
62
|
-
/>
|
|
63
|
-
<span
|
|
64
|
-
className={t.done ? "text-muted-foreground line-through" : ""}
|
|
65
|
-
>
|
|
66
|
-
{t.text}
|
|
67
|
-
</span>
|
|
68
|
-
</label>
|
|
69
|
-
<Button
|
|
70
|
-
type="button"
|
|
71
|
-
variant="ghost"
|
|
72
|
-
size="sm"
|
|
73
|
-
onClick={() => remove(t.id)}
|
|
74
|
-
aria-label="Remove"
|
|
75
|
-
>
|
|
76
|
-
×
|
|
77
|
-
</Button>
|
|
78
|
-
</li>
|
|
79
|
-
))}
|
|
80
|
-
</ul>
|
|
81
|
-
<p className="text-muted-foreground text-sm">
|
|
82
|
-
{todos.filter((t) => !t.done).length} of {todos.length} remaining
|
|
83
|
-
</p>
|
|
84
|
-
</section>
|
|
85
|
-
);
|
|
86
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Island } from "sordo/render";
|
|
2
|
-
import {
|
|
3
|
-
Card,
|
|
4
|
-
CardContent,
|
|
5
|
-
CardDescription,
|
|
6
|
-
CardHeader,
|
|
7
|
-
CardTitle,
|
|
8
|
-
} from "../components/ui/card.tsx";
|
|
9
|
-
import TodoApp from "../islands/TodoApp.tsx";
|
|
10
|
-
|
|
11
|
-
export const meta = {
|
|
12
|
-
title: "Welcome to Sordo",
|
|
13
|
-
description: "A Bun-native full-stack meta-framework.",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default function Index() {
|
|
17
|
-
return (
|
|
18
|
-
<main className="mx-auto max-w-2xl p-8">
|
|
19
|
-
<Card>
|
|
20
|
-
<CardHeader>
|
|
21
|
-
<CardTitle>Welcome to Sordo</CardTitle>
|
|
22
|
-
<CardDescription>
|
|
23
|
-
This page is server-rendered with UI components. The list below is a
|
|
24
|
-
client island — <code>app/islands/TodoApp.tsx</code> — hydrated in
|
|
25
|
-
the browser.
|
|
26
|
-
</CardDescription>
|
|
27
|
-
</CardHeader>
|
|
28
|
-
<CardContent>
|
|
29
|
-
<Island name="TodoApp">
|
|
30
|
-
<TodoApp />
|
|
31
|
-
</Island>
|
|
32
|
-
</CardContent>
|
|
33
|
-
</Card>
|
|
34
|
-
<p className="mt-4 text-muted-foreground text-sm">
|
|
35
|
-
Components live in <code>app/components/ui/</code>. Add more with
|
|
36
|
-
<code>sordo add</code>, or ask your coding agent via <code>/sordo</code>
|
|
37
|
-
.
|
|
38
|
-
</p>
|
|
39
|
-
</main>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps } from "react";
|
|
2
|
-
import { cn } from "./_internal/cn.ts";
|
|
3
|
-
|
|
4
|
-
export const island = true as const;
|
|
5
|
-
|
|
6
|
-
export function Input({ className, type, ...props }: ComponentProps<"input">) {
|
|
7
|
-
return (
|
|
8
|
-
<input
|
|
9
|
-
type={type}
|
|
10
|
-
data-slot="input"
|
|
11
|
-
className={cn(
|
|
12
|
-
"flex h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
13
|
-
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
14
|
-
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
|
15
|
-
className,
|
|
16
|
-
)}
|
|
17
|
-
{...props}
|
|
18
|
-
/>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Root } from "@radix-ui/react-label";
|
|
2
|
-
import type { ComponentProps } from "react";
|
|
3
|
-
import { cn } from "./_internal/cn.ts";
|
|
4
|
-
|
|
5
|
-
export const island = false as const;
|
|
6
|
-
|
|
7
|
-
export function Label({ className, ...props }: ComponentProps<typeof Root>) {
|
|
8
|
-
return (
|
|
9
|
-
<Root
|
|
10
|
-
data-slot="label"
|
|
11
|
-
className={cn(
|
|
12
|
-
"flex select-none items-center gap-2 font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",
|
|
13
|
-
className,
|
|
14
|
-
)}
|
|
15
|
-
{...props}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/* @sordo:tokens base */
|
|
2
|
-
:root {
|
|
3
|
-
--background: oklch(1 0 0);
|
|
4
|
-
--foreground: oklch(0.145 0 0);
|
|
5
|
-
--card: oklch(1 0 0);
|
|
6
|
-
--card-foreground: oklch(0.145 0 0);
|
|
7
|
-
--popover: oklch(1 0 0);
|
|
8
|
-
--popover-foreground: oklch(0.145 0 0);
|
|
9
|
-
--primary: oklch(0.205 0 0);
|
|
10
|
-
--primary-foreground: oklch(0.985 0 0);
|
|
11
|
-
--secondary: oklch(0.97 0 0);
|
|
12
|
-
--secondary-foreground: oklch(0.205 0 0);
|
|
13
|
-
--muted: oklch(0.97 0 0);
|
|
14
|
-
--muted-foreground: oklch(0.556 0 0);
|
|
15
|
-
--accent: oklch(0.97 0 0);
|
|
16
|
-
--accent-foreground: oklch(0.205 0 0);
|
|
17
|
-
--destructive: oklch(0.577 0.245 27.325);
|
|
18
|
-
--destructive-foreground: oklch(0.985 0 0);
|
|
19
|
-
--border: oklch(0.922 0 0);
|
|
20
|
-
--input: oklch(0.922 0 0);
|
|
21
|
-
--ring: oklch(0.708 0 0);
|
|
22
|
-
--radius: 0.625rem;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.dark {
|
|
26
|
-
--background: oklch(0.145 0 0);
|
|
27
|
-
--foreground: oklch(0.985 0 0);
|
|
28
|
-
--card: oklch(0.205 0 0);
|
|
29
|
-
--card-foreground: oklch(0.985 0 0);
|
|
30
|
-
--popover: oklch(0.205 0 0);
|
|
31
|
-
--popover-foreground: oklch(0.985 0 0);
|
|
32
|
-
--primary: oklch(0.985 0 0);
|
|
33
|
-
--primary-foreground: oklch(0.205 0 0);
|
|
34
|
-
--secondary: oklch(0.269 0 0);
|
|
35
|
-
--secondary-foreground: oklch(0.985 0 0);
|
|
36
|
-
--muted: oklch(0.269 0 0);
|
|
37
|
-
--muted-foreground: oklch(0.708 0 0);
|
|
38
|
-
--accent: oklch(0.269 0 0);
|
|
39
|
-
--accent-foreground: oklch(0.985 0 0);
|
|
40
|
-
--destructive: oklch(0.704 0.191 22.216);
|
|
41
|
-
--destructive-foreground: oklch(0.985 0 0);
|
|
42
|
-
--border: oklch(0.269 0 0);
|
|
43
|
-
--input: oklch(0.269 0 0);
|
|
44
|
-
--ring: oklch(0.556 0 0);
|
|
45
|
-
}
|
|
46
|
-
/* @sordo:end base */
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/* @sordo:tokens base */
|
|
2
|
-
:root {
|
|
3
|
-
--background: oklch(1 0 0);
|
|
4
|
-
--foreground: oklch(0.129 0.042 264.695);
|
|
5
|
-
--card: oklch(1 0 0);
|
|
6
|
-
--card-foreground: oklch(0.129 0.042 264.695);
|
|
7
|
-
--popover: oklch(1 0 0);
|
|
8
|
-
--popover-foreground: oklch(0.129 0.042 264.695);
|
|
9
|
-
--primary: oklch(0.208 0.042 265.755);
|
|
10
|
-
--primary-foreground: oklch(0.984 0.003 247.858);
|
|
11
|
-
--secondary: oklch(0.968 0.007 247.896);
|
|
12
|
-
--secondary-foreground: oklch(0.208 0.042 265.755);
|
|
13
|
-
--muted: oklch(0.968 0.007 247.896);
|
|
14
|
-
--muted-foreground: oklch(0.554 0.046 257.417);
|
|
15
|
-
--accent: oklch(0.968 0.007 247.896);
|
|
16
|
-
--accent-foreground: oklch(0.208 0.042 265.755);
|
|
17
|
-
--destructive: oklch(0.577 0.245 27.325);
|
|
18
|
-
--destructive-foreground: oklch(0.984 0.003 247.858);
|
|
19
|
-
--border: oklch(0.929 0.013 255.508);
|
|
20
|
-
--input: oklch(0.929 0.013 255.508);
|
|
21
|
-
--ring: oklch(0.704 0.04 256.788);
|
|
22
|
-
--radius: 0.625rem;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.dark {
|
|
26
|
-
--background: oklch(0.129 0.042 264.695);
|
|
27
|
-
--foreground: oklch(0.984 0.003 247.858);
|
|
28
|
-
--card: oklch(0.208 0.042 265.755);
|
|
29
|
-
--card-foreground: oklch(0.984 0.003 247.858);
|
|
30
|
-
--popover: oklch(0.208 0.042 265.755);
|
|
31
|
-
--popover-foreground: oklch(0.984 0.003 247.858);
|
|
32
|
-
--primary: oklch(0.929 0.013 255.508);
|
|
33
|
-
--primary-foreground: oklch(0.208 0.042 265.755);
|
|
34
|
-
--secondary: oklch(0.279 0.041 260.031);
|
|
35
|
-
--secondary-foreground: oklch(0.984 0.003 247.858);
|
|
36
|
-
--muted: oklch(0.279 0.041 260.031);
|
|
37
|
-
--muted-foreground: oklch(0.704 0.04 256.788);
|
|
38
|
-
--accent: oklch(0.279 0.041 260.031);
|
|
39
|
-
--accent-foreground: oklch(0.984 0.003 247.858);
|
|
40
|
-
--destructive: oklch(0.704 0.191 22.216);
|
|
41
|
-
--destructive-foreground: oklch(0.984 0.003 247.858);
|
|
42
|
-
--border: oklch(0.279 0.041 260.031);
|
|
43
|
-
--input: oklch(0.279 0.041 260.031);
|
|
44
|
-
--ring: oklch(0.551 0.027 264.364);
|
|
45
|
-
}
|
|
46
|
-
/* @sordo:end base */
|