@owlmeans/create-app 0.1.10
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/README.md +59 -0
- package/build/args.d.ts +21 -0
- package/build/args.d.ts.map +1 -0
- package/build/args.js +96 -0
- package/build/args.js.map +1 -0
- package/build/bin.d.ts +3 -0
- package/build/bin.d.ts.map +1 -0
- package/build/bin.js +21 -0
- package/build/bin.js.map +1 -0
- package/build/index.d.ts +6 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +4 -0
- package/build/index.js.map +1 -0
- package/build/run.d.ts +3 -0
- package/build/run.d.ts.map +1 -0
- package/build/run.js +81 -0
- package/build/run.js.map +1 -0
- package/build/template.d.ts +17 -0
- package/build/template.d.ts.map +1 -0
- package/build/template.js +49 -0
- package/build/template.js.map +1 -0
- package/package.json +43 -0
- package/template/README.md +51 -0
- package/template/_gitignore +7 -0
- package/template/package.json +21 -0
- package/template/sources/api/package.json +23 -0
- package/template/sources/api/src/app/session/add.ts +20 -0
- package/template/sources/api/src/app/session/index.ts +3 -0
- package/template/sources/api/src/app/session/list.ts +15 -0
- package/template/sources/api/src/app/session/remove.ts +18 -0
- package/template/sources/api/src/config.ts +8 -0
- package/template/sources/api/src/consts.ts +2 -0
- package/template/sources/api/src/context.ts +14 -0
- package/template/sources/api/src/index.ts +9 -0
- package/template/sources/api/src/modules.ts +11 -0
- package/template/sources/api/src/types.ts +6 -0
- package/template/sources/api/tsconfig.json +11 -0
- package/template/sources/common/package.json +34 -0
- package/template/sources/common/src/config.ts +24 -0
- package/template/sources/common/src/consts.ts +21 -0
- package/template/sources/common/src/index.ts +5 -0
- package/template/sources/common/src/modules.ts +26 -0
- package/template/sources/common/src/schemas.ts +30 -0
- package/template/sources/common/src/types.ts +19 -0
- package/template/sources/common/tsconfig.json +8 -0
- package/template/sources/web/index.html +15 -0
- package/template/sources/web/package.json +49 -0
- package/template/sources/web/src/components/nav/main.tsx +15 -0
- package/template/sources/web/src/components/ui/alert.tsx +70 -0
- package/template/sources/web/src/components/ui/button.tsx +60 -0
- package/template/sources/web/src/components/ui/card.tsx +93 -0
- package/template/sources/web/src/components/ui/input.tsx +22 -0
- package/template/sources/web/src/components/ui/label.tsx +23 -0
- package/template/sources/web/src/components/ui/progress.tsx +44 -0
- package/template/sources/web/src/config.ts +7 -0
- package/template/sources/web/src/context.ts +7 -0
- package/template/sources/web/src/index.css +77 -0
- package/template/sources/web/src/index.tsx +15 -0
- package/template/sources/web/src/layout/main.tsx +21 -0
- package/template/sources/web/src/lib/utils.ts +6 -0
- package/template/sources/web/src/modules.ts +20 -0
- package/template/sources/web/src/render.tsx +8 -0
- package/template/sources/web/src/screens/home.tsx +24 -0
- package/template/sources/web/src/screens/session.tsx +94 -0
- package/template/sources/web/src/types.ts +5 -0
- package/template/sources/web/tsconfig.json +17 -0
- package/template/sources/web/vite.config.ts +29 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { makeContext as makeBasicContext } from '@owlmeans/server-app'
|
|
2
|
+
import { appendStaticResource } from '@owlmeans/static-resource'
|
|
3
|
+
import { SESSION_ITEMS } from './consts.js'
|
|
4
|
+
import type { Config, Context } from './types.js'
|
|
5
|
+
|
|
6
|
+
export const makeContext = <C extends Config, T extends Context<C>>(cfg: C): T => {
|
|
7
|
+
const context = makeBasicContext<C, T>(cfg, true)
|
|
8
|
+
|
|
9
|
+
// Register an in-memory resource for session items. No database required —
|
|
10
|
+
// data lives in process memory and is cleared when the api restarts.
|
|
11
|
+
appendStaticResource<C, T>(context, SESSION_ITEMS)
|
|
12
|
+
|
|
13
|
+
return context
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { main } from '@owlmeans/server-app'
|
|
2
|
+
import config from './config.js'
|
|
3
|
+
import { makeContext } from './context.js'
|
|
4
|
+
import { appModules } from './modules.js'
|
|
5
|
+
import type { Config, Context } from './types.js'
|
|
6
|
+
|
|
7
|
+
const context = makeContext<Config, Context>(config)
|
|
8
|
+
|
|
9
|
+
main<{}, Config, Context>(context, appModules)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { elevate, modules } from '@owlmeans/server-app'
|
|
2
|
+
import { session, sessionModules } from '__APP_SLUG__-common'
|
|
3
|
+
import * as handlers from './app/session/index.js'
|
|
4
|
+
|
|
5
|
+
// Attach handler implementations to the shared entrypoint declarations.
|
|
6
|
+
elevate(sessionModules, session.base)
|
|
7
|
+
elevate(sessionModules, session.list, handlers.list)
|
|
8
|
+
elevate(sessionModules, session.add, handlers.add)
|
|
9
|
+
elevate(sessionModules, session.remove, handlers.remove)
|
|
10
|
+
|
|
11
|
+
export const appModules = [...modules, ...sessionModules]
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AppConfig, AppContext } from '@owlmeans/server-app'
|
|
2
|
+
import type { StaticResourceAppend } from '@owlmeans/static-resource'
|
|
3
|
+
|
|
4
|
+
export interface Config extends AppConfig {}
|
|
5
|
+
|
|
6
|
+
export interface Context<C extends Config = Config> extends AppContext<C>, StaticResourceAppend {}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__APP_SLUG__-common",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "build/index.js",
|
|
7
|
+
"module": "build/index.js",
|
|
8
|
+
"types": "build/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./build/index.js",
|
|
12
|
+
"types": "./build/index.d.ts",
|
|
13
|
+
"default": "./build/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"dev": "tsc -b -w --preserveWatchOutput --pretty",
|
|
18
|
+
"build": "tsc -b",
|
|
19
|
+
"typecheck": "tsc -b"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@owlmeans/config": "^0.1.9",
|
|
23
|
+
"@owlmeans/entrypoint": "^0.1.9",
|
|
24
|
+
"@owlmeans/error": "^0.1.9",
|
|
25
|
+
"@owlmeans/resource": "^0.1.9",
|
|
26
|
+
"@owlmeans/route": "^0.1.9",
|
|
27
|
+
"ajv": "^8.17.1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@owlmeans/dep-config": "^0.1.9",
|
|
31
|
+
"@types/node": "^24.10.1",
|
|
32
|
+
"typescript": "^5.9.2"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AppType, service } from '@owlmeans/config'
|
|
2
|
+
import { API_PORT, APP, APP_API, APP_WEB, WEB_PORT } from './consts.js'
|
|
3
|
+
|
|
4
|
+
// The web (frontend) service this config belongs to by default.
|
|
5
|
+
const cfg = service({
|
|
6
|
+
type: AppType.Frontend,
|
|
7
|
+
service: APP_WEB,
|
|
8
|
+
host: 'localhost',
|
|
9
|
+
port: WEB_PORT,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
// The api (backend) service the web calls. `base: 'api'` prefixes every API route with `/api`.
|
|
13
|
+
service({
|
|
14
|
+
type: AppType.Backend,
|
|
15
|
+
service: APP_API,
|
|
16
|
+
host: 'localhost',
|
|
17
|
+
port: API_PORT,
|
|
18
|
+
base: 'api',
|
|
19
|
+
}, cfg)
|
|
20
|
+
|
|
21
|
+
cfg.debug = { all: true }
|
|
22
|
+
cfg.alias = APP
|
|
23
|
+
|
|
24
|
+
export const commonConfig = cfg
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Service aliases shared between web and api. */
|
|
2
|
+
export const APP = '__APP_SLUG__'
|
|
3
|
+
export const APP_WEB = '__APP_SLUG__-web'
|
|
4
|
+
export const APP_API = '__APP_SLUG__-api'
|
|
5
|
+
|
|
6
|
+
/** Local development ports. */
|
|
7
|
+
export const WEB_PORT = 3001
|
|
8
|
+
export const API_PORT = 3000
|
|
9
|
+
|
|
10
|
+
/** Backend (API) entrypoint identifiers. */
|
|
11
|
+
export const session = {
|
|
12
|
+
base: '__APP_SLUG__:api:session',
|
|
13
|
+
list: '__APP_SLUG__:api:session:list',
|
|
14
|
+
add: '__APP_SLUG__:api:session:add',
|
|
15
|
+
remove: '__APP_SLUG__:api:session:remove',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Frontend (web) entrypoint identifiers. */
|
|
19
|
+
export const web = {
|
|
20
|
+
session: '__APP_SLUG__:web:session',
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { body, entrypoint, filter, params } from '@owlmeans/entrypoint'
|
|
2
|
+
import { route, RouteMethod } from '@owlmeans/route'
|
|
3
|
+
import { session } from './consts.js'
|
|
4
|
+
import { AddItemSchema, ItemParamsSchema, SessionParamsSchema } from './schemas.js'
|
|
5
|
+
import type { AddItemPayload, ItemParams, SessionParams } from './types.js'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Shared entrypoint declarations. The api elevates these with handlers; the web
|
|
9
|
+
* elevates them with screen components and calls them. Routes resolve under the
|
|
10
|
+
* api service `base` (`/api`), so e.g. `session.list` → `GET /api/session/:sid/items`.
|
|
11
|
+
*/
|
|
12
|
+
export const sessionModules = [
|
|
13
|
+
entrypoint(route(session.base, '/session')),
|
|
14
|
+
entrypoint(
|
|
15
|
+
route(session.list, '/:sid/items', { parent: session.base, method: RouteMethod.GET }),
|
|
16
|
+
filter(params<SessionParams>(SessionParamsSchema)),
|
|
17
|
+
),
|
|
18
|
+
entrypoint(
|
|
19
|
+
route(session.add, '/:sid/items', { parent: session.base, method: RouteMethod.POST }),
|
|
20
|
+
filter(params<SessionParams>(SessionParamsSchema, body<AddItemPayload>(AddItemSchema))),
|
|
21
|
+
),
|
|
22
|
+
entrypoint(
|
|
23
|
+
route(session.remove, '/:sid/items/:id', { parent: session.base, method: RouteMethod.DELETE }),
|
|
24
|
+
filter(params<ItemParams>(ItemParamsSchema)),
|
|
25
|
+
),
|
|
26
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { JSONSchemaType } from 'ajv'
|
|
2
|
+
import type { AddItemPayload, ItemParams, SessionParams } from './types.js'
|
|
3
|
+
|
|
4
|
+
export const AddItemSchema: JSONSchemaType<AddItemPayload> = {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
text: { type: 'string', minLength: 1, maxLength: 280 },
|
|
8
|
+
},
|
|
9
|
+
required: ['text'],
|
|
10
|
+
additionalProperties: false,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const SessionParamsSchema: JSONSchemaType<SessionParams> = {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
sid: { type: 'string', minLength: 1 },
|
|
17
|
+
},
|
|
18
|
+
required: ['sid'],
|
|
19
|
+
additionalProperties: false,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const ItemParamsSchema: JSONSchemaType<ItemParams> = {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {
|
|
25
|
+
sid: { type: 'string', minLength: 1 },
|
|
26
|
+
id: { type: 'string', minLength: 1 },
|
|
27
|
+
},
|
|
28
|
+
required: ['sid', 'id'],
|
|
29
|
+
additionalProperties: false,
|
|
30
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface SessionItem {
|
|
2
|
+
id: string
|
|
3
|
+
sessionId: string
|
|
4
|
+
text: string
|
|
5
|
+
createdAt: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface AddItemPayload {
|
|
9
|
+
text: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface SessionParams {
|
|
13
|
+
sid: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ItemParams {
|
|
17
|
+
sid: string
|
|
18
|
+
id: string
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>__APP_NAME__</title>
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body>
|
|
11
|
+
<div id="root"></div>
|
|
12
|
+
<script type="module" src="./src/index.tsx"></script>
|
|
13
|
+
</body>
|
|
14
|
+
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__APP_SLUG__-web",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "sleep 3 && vite",
|
|
8
|
+
"start": "vite",
|
|
9
|
+
"build": "vite build",
|
|
10
|
+
"typecheck": "tsc --noEmit",
|
|
11
|
+
"preview": "vite preview"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@owlmeans/client": "^0.1.9",
|
|
15
|
+
"@owlmeans/client-config": "^0.1.9",
|
|
16
|
+
"@owlmeans/client-context": "^0.1.9",
|
|
17
|
+
"@owlmeans/client-entrypoint": "^0.1.9",
|
|
18
|
+
"@owlmeans/client-i18n": "^0.1.9",
|
|
19
|
+
"@owlmeans/entrypoint": "^0.1.9",
|
|
20
|
+
"@owlmeans/route": "^0.1.9",
|
|
21
|
+
"@owlmeans/web-client": "^0.1.9",
|
|
22
|
+
"@owlmeans/web-panel": "^0.1.9",
|
|
23
|
+
"__APP_SLUG__-common": "workspace:^",
|
|
24
|
+
"@radix-ui/react-label": "^2.1.0",
|
|
25
|
+
"@radix-ui/react-progress": "^1.1.0",
|
|
26
|
+
"@radix-ui/react-slot": "^1.1.0",
|
|
27
|
+
"ajv": "^8.17.1",
|
|
28
|
+
"class-variance-authority": "^0.7.0",
|
|
29
|
+
"clsx": "^2.1.0",
|
|
30
|
+
"i18next": "^23.16.8",
|
|
31
|
+
"lucide-react": "^0.460.0",
|
|
32
|
+
"react": "19.1.1",
|
|
33
|
+
"react-dom": "19.1.1",
|
|
34
|
+
"react-hook-form": "^7.62.0",
|
|
35
|
+
"react-i18next": "^15.7.4",
|
|
36
|
+
"tailwind-merge": "^2.5.0",
|
|
37
|
+
"tailwindcss": "^4.1.13"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@owlmeans/dep-config": "^0.1.9",
|
|
41
|
+
"@tailwindcss/vite": "^4.1.13",
|
|
42
|
+
"@types/react": "^19.2.7",
|
|
43
|
+
"@types/react-dom": "^19.2.3",
|
|
44
|
+
"@vitejs/plugin-react": "^5.0.2",
|
|
45
|
+
"typescript": "^5.9.2",
|
|
46
|
+
"vite": "^7.1.5",
|
|
47
|
+
"vite-tsconfig-paths": "^5.1.4"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FC } from 'react'
|
|
2
|
+
import { HOME, useNavigate } from '@owlmeans/web-panel'
|
|
3
|
+
import { web } from '__APP_SLUG__-common'
|
|
4
|
+
import { Button } from '@/components/ui/button'
|
|
5
|
+
|
|
6
|
+
export const MainNavigation: FC = () => {
|
|
7
|
+
const nav = useNavigate()
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<nav className="flex items-center gap-1">
|
|
11
|
+
<Button variant="ghost" size="sm" onClick={nav.press(HOME)}>Home</Button>
|
|
12
|
+
<Button variant="ghost" size="sm" onClick={nav.press(web.session)}>Session</Button>
|
|
13
|
+
</nav>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// shadcn alert — sourced from shadcn (new-york)
|
|
2
|
+
// Extended with a `success` variant on top of the default `default` / `destructive`.
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/lib/utils'
|
|
7
|
+
|
|
8
|
+
const alertVariants = cva(
|
|
9
|
+
"relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default: "bg-card text-card-foreground",
|
|
14
|
+
destructive:
|
|
15
|
+
"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",
|
|
16
|
+
success:
|
|
17
|
+
"text-success bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-success/90",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
variant: "default",
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
function Alert({
|
|
27
|
+
className,
|
|
28
|
+
variant,
|
|
29
|
+
...props
|
|
30
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
data-slot="alert"
|
|
34
|
+
role="alert"
|
|
35
|
+
className={cn(alertVariants({ variant }), className)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
data-slot="alert-title"
|
|
45
|
+
className={cn(
|
|
46
|
+
"col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
|
|
47
|
+
className
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function AlertDescription({
|
|
55
|
+
className,
|
|
56
|
+
...props
|
|
57
|
+
}: React.ComponentProps<"div">) {
|
|
58
|
+
return (
|
|
59
|
+
<div
|
|
60
|
+
data-slot="alert-description"
|
|
61
|
+
className={cn(
|
|
62
|
+
"text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
|
|
63
|
+
className
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { Alert, AlertTitle, AlertDescription }
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// shadcn button — sourced from shadcn (new-york)
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
import { Slot } from '@radix-ui/react-slot'
|
|
4
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/lib/utils'
|
|
7
|
+
|
|
8
|
+
const buttonVariants = cva(
|
|
9
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer",
|
|
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 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
17
|
+
outline:
|
|
18
|
+
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
19
|
+
secondary:
|
|
20
|
+
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
21
|
+
ghost:
|
|
22
|
+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
23
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
27
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
28
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
29
|
+
icon: "size-9",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
variant: "default",
|
|
34
|
+
size: "default",
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
function Button({
|
|
40
|
+
className,
|
|
41
|
+
variant,
|
|
42
|
+
size,
|
|
43
|
+
asChild = false,
|
|
44
|
+
...props
|
|
45
|
+
}: React.ComponentProps<"button"> &
|
|
46
|
+
VariantProps<typeof buttonVariants> & {
|
|
47
|
+
asChild?: boolean
|
|
48
|
+
}) {
|
|
49
|
+
const Comp = asChild ? Slot : "button"
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Comp
|
|
53
|
+
data-slot="button"
|
|
54
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { Button, buttonVariants }
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// shadcn card — sourced from shadcn (new-york)
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
data-slot="card"
|
|
10
|
+
className={cn(
|
|
11
|
+
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
12
|
+
className
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
data-slot="card-header"
|
|
23
|
+
className={cn(
|
|
24
|
+
"@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] [.border-b]:pb-6",
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
data-slot="card-title"
|
|
36
|
+
className={cn("leading-none font-semibold", className)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
data-slot="card-description"
|
|
46
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
53
|
+
return (
|
|
54
|
+
<div
|
|
55
|
+
data-slot="card-action"
|
|
56
|
+
className={cn(
|
|
57
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
58
|
+
className
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
66
|
+
return (
|
|
67
|
+
<div
|
|
68
|
+
data-slot="card-content"
|
|
69
|
+
className={cn("px-6", className)}
|
|
70
|
+
{...props}
|
|
71
|
+
/>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
76
|
+
return (
|
|
77
|
+
<div
|
|
78
|
+
data-slot="card-footer"
|
|
79
|
+
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export {
|
|
86
|
+
Card,
|
|
87
|
+
CardHeader,
|
|
88
|
+
CardFooter,
|
|
89
|
+
CardTitle,
|
|
90
|
+
CardAction,
|
|
91
|
+
CardDescription,
|
|
92
|
+
CardContent,
|
|
93
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// shadcn input — sourced from shadcn (new-york)
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
7
|
+
return (
|
|
8
|
+
<input
|
|
9
|
+
type={type}
|
|
10
|
+
data-slot="input"
|
|
11
|
+
className={cn(
|
|
12
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
13
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
14
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { Input }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// shadcn label — sourced from shadcn (new-york)
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
import * as LabelPrimitive from '@radix-ui/react-label'
|
|
4
|
+
|
|
5
|
+
import { cn } from '@/lib/utils'
|
|
6
|
+
|
|
7
|
+
function Label({
|
|
8
|
+
className,
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
11
|
+
return (
|
|
12
|
+
<LabelPrimitive.Root
|
|
13
|
+
data-slot="label"
|
|
14
|
+
className={cn(
|
|
15
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { Label }
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// shadcn progress — sourced from shadcn (new-york)
|
|
2
|
+
// Extended with `indeterminate` mode: when `value === undefined` (or not passed),
|
|
3
|
+
// the indicator animates left-to-right continuously via the
|
|
4
|
+
// `--animate-progress-indeterminate` token defined in index.css.
|
|
5
|
+
import * as React from 'react'
|
|
6
|
+
import * as ProgressPrimitive from '@radix-ui/react-progress'
|
|
7
|
+
|
|
8
|
+
import { cn } from '@/lib/utils'
|
|
9
|
+
|
|
10
|
+
function Progress({
|
|
11
|
+
className,
|
|
12
|
+
value,
|
|
13
|
+
...props
|
|
14
|
+
}: React.ComponentProps<typeof ProgressPrimitive.Root>) {
|
|
15
|
+
const indeterminate = value == null
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<ProgressPrimitive.Root
|
|
19
|
+
data-slot="progress"
|
|
20
|
+
className={cn(
|
|
21
|
+
"bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
value={indeterminate ? undefined : value}
|
|
25
|
+
{...props}
|
|
26
|
+
>
|
|
27
|
+
<ProgressPrimitive.Indicator
|
|
28
|
+
data-slot="progress-indicator"
|
|
29
|
+
data-state={indeterminate ? 'indeterminate' : 'determinate'}
|
|
30
|
+
className={cn(
|
|
31
|
+
"bg-primary h-full w-full flex-1 transition-all",
|
|
32
|
+
indeterminate && "absolute inset-y-0 left-0 w-1/3 animate-[progress-indeterminate_1.5s_linear_infinite]"
|
|
33
|
+
)}
|
|
34
|
+
style={
|
|
35
|
+
indeterminate
|
|
36
|
+
? undefined
|
|
37
|
+
: { transform: `translateX(-${100 - (value || 0)}%)` }
|
|
38
|
+
}
|
|
39
|
+
/>
|
|
40
|
+
</ProgressPrimitive.Root>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { Progress }
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { makeContext as makeBasicContext, useContext as useBasicContext } from '@owlmeans/web-panel'
|
|
2
|
+
import type { Config, Context } from './types.js'
|
|
3
|
+
|
|
4
|
+
export const useContext = (): Context => useBasicContext<Config, Context>()
|
|
5
|
+
|
|
6
|
+
export const makeContext = <C extends Config, T extends Context<C>>(cfg: C): T =>
|
|
7
|
+
makeBasicContext<C, T>(cfg)
|