@teable/create-app 1.0.0 → 1.0.1
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/template/AGENTS.md +17 -4
- package/dist/template/components.json +7 -2
- package/dist/template/package.json +8 -2
- package/dist/template/src/components/ui/alert.tsx +72 -0
- package/dist/template/src/components/ui/button.tsx +52 -0
- package/dist/template/src/components/ui/input.tsx +18 -0
- package/dist/template/src/web/notes.tsx +10 -11
- package/dist/template/src/web/styles.css +19 -10
- package/package.json +1 -1
package/dist/template/AGENTS.md
CHANGED
|
@@ -17,7 +17,8 @@ user needs.
|
|
|
17
17
|
| `src/server/schema.ts` | Tables, with their rules (Drizzle). drizzle-kit loads it in Node: it imports only `drizzle-orm` and `@teable/app/schema`. |
|
|
18
18
|
| `src/server/index.ts` | Methods. `export const App = app.define({ ... })` names them; Teable runs this module. |
|
|
19
19
|
| `drizzle/` | Migrations written by `bun run db:generate`, and `migrations.js`, which lists them. |
|
|
20
|
-
| `src/web/` | Pages: React, TanStack Router and Query,
|
|
20
|
+
| `src/web/` | Pages: React, TanStack Router and Query, shadcn's components. `app.ts` holds the client and the query cache. |
|
|
21
|
+
| `src/components/ui/` | shadcn's components on UI SDK, as `bunx shadcn add <name>` writes them (`components.json`); the app's own. |
|
|
21
22
|
| `test/` | Method tests. They run in workerd, against a real SQLite database. |
|
|
22
23
|
| `src/**/*.test.tsx` | Page tests, in jsdom, against a stubbed client. |
|
|
23
24
|
| `teable.json` | `appId`: which app on Teable this is. The `teable` CLI and the pages read it; leave it as it is. |
|
|
@@ -156,10 +157,22 @@ export const App = app.define({ listInvoices, markPaid });
|
|
|
156
157
|
not callable.
|
|
157
158
|
2. Add its route in `src/web/main.tsx` (`createRoute`, then
|
|
158
159
|
`rootRoute.addChildren`).
|
|
159
|
-
3.
|
|
160
|
+
3. Build it from shadcn's components on UI SDK (style `ui-sdk-rhea`), as the
|
|
161
|
+
notes page does with `Button`, `Input` and `Alert`:
|
|
162
|
+
`bunx shadcn add <name>` writes one to `src/components/ui/`. Before using
|
|
163
|
+
one, read `node_modules/@ui-sdk/react/docs/llms.txt` and the component's
|
|
164
|
+
page next to it (`docs/components/<name>.md`), which match the installed
|
|
165
|
+
version; UI SDK's guide for agents is
|
|
166
|
+
`node_modules/@ui-sdk/core/skills/ui-sdk/SKILL.md`. Never hand-roll what
|
|
167
|
+
it ships: a `role="listbox"`, `"menu"` or `"dialog"` is a component to
|
|
168
|
+
add. UI SDK needs no providers, takes `render={<Button />}` where Radix
|
|
169
|
+
took `asChild`, and renders popups in place, in the top layer (no portals,
|
|
170
|
+
no `z-50`).
|
|
171
|
+
4. Lay it out with Tailwind classes on shadcn's tokens (`bg-primary`,
|
|
160
172
|
`text-muted-foreground`, `border-border`, `text-destructive`); they are in
|
|
161
|
-
`styles.css
|
|
162
|
-
|
|
173
|
+
`styles.css`, whose first rule stays `@layer ui-sdk;`. Write the text in
|
|
174
|
+
the user's language.
|
|
175
|
+
5. Test it next to it (`<page>.test.tsx`), with a client whose `fetch` the
|
|
163
176
|
test answers, as `notes.test.tsx` does.
|
|
164
177
|
|
|
165
178
|
### Add a task or a schedule
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
-
"style": "
|
|
3
|
+
"style": "ui-sdk-rhea",
|
|
4
4
|
"rsc": false,
|
|
5
5
|
"tsx": true,
|
|
6
6
|
"tailwind": {
|
|
7
7
|
"config": "",
|
|
8
8
|
"css": "src/web/styles.css",
|
|
9
9
|
"baseColor": "neutral",
|
|
10
|
-
"cssVariables": true
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
11
12
|
},
|
|
13
|
+
"iconLibrary": "lucide",
|
|
14
|
+
"rtl": false,
|
|
12
15
|
"aliases": {
|
|
13
16
|
"components": "@/components",
|
|
14
17
|
"utils": "@/lib/utils",
|
|
@@ -16,6 +19,8 @@
|
|
|
16
19
|
"lib": "@/lib",
|
|
17
20
|
"hooks": "@/hooks"
|
|
18
21
|
},
|
|
22
|
+
"menuColor": "default",
|
|
23
|
+
"menuAccent": "subtle",
|
|
19
24
|
"registries": {
|
|
20
25
|
"@teable": "https://teable.ai/r/{name}.json"
|
|
21
26
|
}
|
|
@@ -11,10 +11,16 @@
|
|
|
11
11
|
"test": "vitest run"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
+
"@fontsource-variable/inter": "5.3.0",
|
|
14
15
|
"@tanstack/react-query": "5.108.4",
|
|
15
16
|
"@tanstack/react-router": "1.170.46",
|
|
16
|
-
"@teable/app": "^5.0.
|
|
17
|
+
"@teable/app": "^5.0.1",
|
|
18
|
+
"@ui-sdk/core": "0.1.0-beta.24",
|
|
19
|
+
"@ui-sdk/react": "0.1.0-beta.24",
|
|
20
|
+
"class-variance-authority": "0.7.1",
|
|
21
|
+
"cn": "0.5.2",
|
|
17
22
|
"drizzle-orm": "0.45.4",
|
|
23
|
+
"lucide-react": "1.87.0",
|
|
18
24
|
"react": "19.3.1",
|
|
19
25
|
"react-dom": "19.3.1"
|
|
20
26
|
},
|
|
@@ -29,7 +35,7 @@
|
|
|
29
35
|
"@vitejs/plugin-react": "6.3.1",
|
|
30
36
|
"drizzle-kit": "0.31.11",
|
|
31
37
|
"jsdom": "31.0.1",
|
|
32
|
-
"shadcn": "4.
|
|
38
|
+
"shadcn": "4.24.0",
|
|
33
39
|
"tailwindcss": "4.3.5",
|
|
34
40
|
"tw-animate-css": "1.4.0",
|
|
35
41
|
"typescript": "7.0.2",
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import type * as React from "react";
|
|
4
|
+
|
|
5
|
+
const alertVariants = cva(
|
|
6
|
+
"group/alert relative grid w-full gap-0.5 rounded-2xl border px-4 py-3 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-card text-card-foreground",
|
|
11
|
+
destructive:
|
|
12
|
+
"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: "default",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
function Alert({
|
|
22
|
+
className,
|
|
23
|
+
variant,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
data-slot="alert"
|
|
29
|
+
role="alert"
|
|
30
|
+
className={cn(alertVariants({ variant }), className)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
data-slot="alert-title"
|
|
40
|
+
className={cn(
|
|
41
|
+
"font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function AlertDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
data-slot="alert-description"
|
|
53
|
+
className={cn(
|
|
54
|
+
"text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",
|
|
55
|
+
className,
|
|
56
|
+
)}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function AlertAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
63
|
+
return (
|
|
64
|
+
<div
|
|
65
|
+
data-slot="alert-action"
|
|
66
|
+
className={cn("absolute top-2.5 right-3", className)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { Alert, AlertAction, AlertDescription, AlertTitle };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Button as ButtonPrimitive } from "@ui-sdk/react/button";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { cn } from "cn";
|
|
4
|
+
import type * as React from "react";
|
|
5
|
+
|
|
6
|
+
const buttonVariants = cva(
|
|
7
|
+
"group/button inline-flex shrink-0 items-center justify-center rounded-2xl border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
12
|
+
outline:
|
|
13
|
+
"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-transparent dark:hover:bg-input/30",
|
|
14
|
+
secondary:
|
|
15
|
+
"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
16
|
+
ghost:
|
|
17
|
+
"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
18
|
+
destructive:
|
|
19
|
+
"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
20
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
default:
|
|
24
|
+
"h-8 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5",
|
|
25
|
+
xs: "h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3",
|
|
26
|
+
sm: "h-7 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
27
|
+
lg: "h-9 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
|
|
28
|
+
icon: "size-8",
|
|
29
|
+
"icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3",
|
|
30
|
+
"icon-sm": "size-7",
|
|
31
|
+
"icon-lg": "size-9",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
variant: "default",
|
|
36
|
+
size: "default",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
function Button({
|
|
42
|
+
className,
|
|
43
|
+
variant = "default",
|
|
44
|
+
size = "default",
|
|
45
|
+
...props
|
|
46
|
+
}: React.ComponentProps<typeof ButtonPrimitive> & VariantProps<typeof buttonVariants>) {
|
|
47
|
+
return (
|
|
48
|
+
<ButtonPrimitive className={cn(buttonVariants({ variant, size, className }))} {...props} />
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Input as InputPrimitive } from "@ui-sdk/react/input";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import type * as React from "react";
|
|
4
|
+
|
|
5
|
+
function Input({ className, type, ...props }: React.ComponentProps<typeof InputPrimitive>) {
|
|
6
|
+
return (
|
|
7
|
+
<InputPrimitive
|
|
8
|
+
type={type}
|
|
9
|
+
className={cn(
|
|
10
|
+
"h-8 w-full min-w-0 rounded-2xl border border-transparent bg-input/50 px-2.5 py-1 text-base transition-[color,box-shadow] duration-200 outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
11
|
+
className,
|
|
12
|
+
)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { Input };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
+
import { Alert, AlertDescription } from "@/components/ui/alert";
|
|
4
|
+
import { Button } from "@/components/ui/button";
|
|
5
|
+
import { Input } from "@/components/ui/input";
|
|
3
6
|
import { client, queryClient } from "./app";
|
|
4
7
|
|
|
5
8
|
/** The notes, newest first, and a box to add one. */
|
|
@@ -29,24 +32,20 @@ export function NotesPage() {
|
|
|
29
32
|
add.mutate(text);
|
|
30
33
|
}}
|
|
31
34
|
>
|
|
32
|
-
<
|
|
35
|
+
<Input
|
|
33
36
|
aria-label="New note"
|
|
34
37
|
value={text}
|
|
35
38
|
onChange={(event) => setText(event.target.value)}
|
|
36
|
-
className="flex-1
|
|
39
|
+
className="flex-1"
|
|
37
40
|
/>
|
|
38
|
-
<
|
|
39
|
-
type="submit"
|
|
40
|
-
disabled={text.trim() === "" || add.isPending}
|
|
41
|
-
className="rounded-md bg-primary px-4 py-2 text-primary-foreground text-sm disabled:opacity-50"
|
|
42
|
-
>
|
|
41
|
+
<Button type="submit" disabled={text.trim() === "" || add.isPending}>
|
|
43
42
|
Add
|
|
44
|
-
</
|
|
43
|
+
</Button>
|
|
45
44
|
</form>
|
|
46
45
|
{error && (
|
|
47
|
-
<
|
|
48
|
-
{error.message}
|
|
49
|
-
</
|
|
46
|
+
<Alert variant="destructive">
|
|
47
|
+
<AlertDescription>{error.message}</AlertDescription>
|
|
48
|
+
</Alert>
|
|
50
49
|
)}
|
|
51
50
|
{notes.data ? (
|
|
52
51
|
<ul className="divide-y divide-border rounded-md border border-border">
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
|
-
|
|
3
1
|
/*
|
|
4
|
-
* shadcn's
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* shadcn
|
|
8
|
-
*
|
|
2
|
+
* shadcn's stylesheet for style ui-sdk-rhea (components on UI SDK, the Rhea
|
|
3
|
+
* preset: base color neutral, Lucide icons, the Inter font), CSS variables,
|
|
4
|
+
* Tailwind v4 (what components.json declares), as
|
|
5
|
+
* `shadcn init --base ui-sdk --preset rhea` writes it: the ui-sdk layer,
|
|
6
|
+
* declared before everything so any class beats the few styles UI SDK adds to
|
|
7
|
+
* it at runtime (hiding closed parts); tw-animate-css (enter and exit
|
|
8
|
+
* animations); shadcn/tailwind.css (the data-open: style variants that popups
|
|
9
|
+
* use); the font; and the tokens. Registry components style themselves with
|
|
9
10
|
* these.
|
|
10
11
|
*
|
|
11
|
-
* From this comment to the end,
|
|
12
|
-
*
|
|
13
|
-
* builds.
|
|
12
|
+
* From this comment to the end, every Teable template's stylesheet and the
|
|
13
|
+
* builder's are identical, so the builder looks like the apps it builds.
|
|
14
14
|
*/
|
|
15
|
+
@layer ui-sdk;
|
|
16
|
+
|
|
17
|
+
@import "tailwindcss";
|
|
15
18
|
@import "tw-animate-css";
|
|
16
19
|
@import "shadcn/tailwind.css";
|
|
20
|
+
@import "@fontsource-variable/inter";
|
|
17
21
|
|
|
18
22
|
@custom-variant dark (&:is(.dark *));
|
|
19
23
|
|
|
@@ -125,6 +129,8 @@
|
|
|
125
129
|
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
126
130
|
--color-sidebar-border: var(--sidebar-border);
|
|
127
131
|
--color-sidebar-ring: var(--sidebar-ring);
|
|
132
|
+
--font-heading: var(--font-sans);
|
|
133
|
+
--font-sans: "Inter Variable", sans-serif;
|
|
128
134
|
}
|
|
129
135
|
|
|
130
136
|
@layer base {
|
|
@@ -134,4 +140,7 @@
|
|
|
134
140
|
body {
|
|
135
141
|
@apply bg-background text-foreground;
|
|
136
142
|
}
|
|
143
|
+
html {
|
|
144
|
+
@apply font-sans;
|
|
145
|
+
}
|
|
137
146
|
}
|
package/package.json
CHANGED