opentwig 1.0.7 → 1.1.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/AGENTS.md +172 -0
- package/API.md +582 -0
- package/CODE_OF_CONDUCT.md +91 -0
- package/CONTRIBUTING.md +312 -0
- package/README.md +164 -7
- package/SECURITY.md +56 -0
- package/THEME_DEVELOPMENT.md +388 -0
- package/package.json +19 -4
- package/src/constants.js +14 -2
- package/src/index.js +14 -2
- package/src/live-ui/editor.js +174 -0
- package/src/live-ui/preview.js +77 -0
- package/src/live-ui/sidebar.js +525 -0
- package/src/utils/escapeHTML.js +10 -0
- package/src/utils/favicon.js +20 -0
- package/src/utils/generateOGImage.js +51 -10
- package/src/utils/loadConfig.js +3 -1
- package/src/utils/parseArgs.js +33 -2
- package/src/utils/readImageAsBase64.js +16 -4
- package/src/utils/setupWatcher.js +69 -0
- package/src/utils/showHelp.js +15 -2
- package/src/utils/startLiveServer.js +221 -0
- package/src/utils/websocketServer.js +53 -0
- package/theme/dark/style.css +1 -0
- package/theme/default/index.js +12 -8
- package/validateConfig.js +59 -0
- package/vitest.config.js +20 -0
- package/website/README.md +42 -0
- package/website/components.json +16 -0
- package/website/eslint.config.js +36 -0
- package/website/package-lock.json +4136 -0
- package/website/package.json +41 -0
- package/website/shadcn-svelte.md +118 -0
- package/website/src/app.d.ts +13 -0
- package/website/src/lib/components/ui/badge/badge.svelte +50 -0
- package/website/src/lib/components/ui/badge/index.ts +2 -0
- package/website/src/lib/components/ui/button/button.svelte +82 -0
- package/website/src/lib/components/ui/button/index.ts +17 -0
- package/website/src/lib/components/ui/card/card-action.svelte +20 -0
- package/website/src/lib/components/ui/card/card-content.svelte +15 -0
- package/website/src/lib/components/ui/card/card-description.svelte +20 -0
- package/website/src/lib/components/ui/card/card-footer.svelte +20 -0
- package/website/src/lib/components/ui/card/card-header.svelte +23 -0
- package/website/src/lib/components/ui/card/card-title.svelte +20 -0
- package/website/src/lib/components/ui/card/card.svelte +23 -0
- package/website/src/lib/components/ui/card/index.ts +25 -0
- package/website/src/lib/components/ui/separator/index.ts +7 -0
- package/website/src/lib/components/ui/separator/separator.svelte +21 -0
- package/website/src/lib/components/ui/tooltip/index.ts +19 -0
- package/website/src/lib/components/ui/tooltip/tooltip-content.svelte +52 -0
- package/website/src/lib/components/ui/tooltip/tooltip-portal.svelte +7 -0
- package/website/src/lib/components/ui/tooltip/tooltip-provider.svelte +7 -0
- package/website/src/lib/components/ui/tooltip/tooltip-trigger.svelte +7 -0
- package/website/src/lib/components/ui/tooltip/tooltip.svelte +7 -0
- package/website/src/lib/index.ts +1 -0
- package/website/src/lib/utils.ts +13 -0
- package/website/src/routes/+layout.svelte +23 -0
- package/website/src/routes/+page.server.ts +82 -0
- package/website/src/routes/+page.svelte +892 -0
- package/website/static/robots.txt +3 -0
- package/website/svelte.config.js +31 -0
- package/website/vite.config.ts +5 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "website",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite dev",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"prepare": "svelte-kit sync || echo ''",
|
|
11
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
12
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
13
|
+
"lint": "eslint ."
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@eslint/compat": "^2.0.1",
|
|
17
|
+
"@eslint/js": "^9.39.2",
|
|
18
|
+
"@internationalized/date": "^3.10.1",
|
|
19
|
+
"@lucide/svelte": "^0.563.1",
|
|
20
|
+
"@sveltejs/adapter-static": "^3.0.10",
|
|
21
|
+
"@sveltejs/kit": "^2.50.1",
|
|
22
|
+
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
23
|
+
"@tailwindcss/typography": "^0.5.19",
|
|
24
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
25
|
+
"@types/node": "^24",
|
|
26
|
+
"bits-ui": "^2.15.5",
|
|
27
|
+
"clsx": "^2.1.1",
|
|
28
|
+
"eslint": "^9.39.2",
|
|
29
|
+
"eslint-plugin-svelte": "^3.14.0",
|
|
30
|
+
"globals": "^17.1.0",
|
|
31
|
+
"svelte": "^5.48.2",
|
|
32
|
+
"svelte-check": "^4.3.5",
|
|
33
|
+
"tailwind-merge": "^3.4.0",
|
|
34
|
+
"tailwind-variants": "^3.2.2",
|
|
35
|
+
"tailwindcss": "^4.1.18",
|
|
36
|
+
"tw-animate-css": "^1.4.0",
|
|
37
|
+
"typescript": "^5.9.3",
|
|
38
|
+
"typescript-eslint": "^8.53.1",
|
|
39
|
+
"vite": "^7.3.1"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# shadcn-svelte
|
|
2
|
+
|
|
3
|
+
> shadcn-svelte is a collection of beautifully-designed, accessible components for Svelte and SvelteKit. It is built with TypeScript, Tailwind CSS, and Bits UI primitives. Open Source. Open Code. AI-Ready. It also comes with a command-line tool to install and manage components and a registry system to publish and distribute code.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
- [About](https://shadcn-svelte.com/docs/about.md): Powered by amazing open source projects.
|
|
8
|
+
- [Changelog](https://shadcn-svelte.com/docs/changelog.md): Latest updates and announcements.
|
|
9
|
+
- [shadcn-svelte](https://shadcn-svelte.com/docs/cli.md): Use the shadcn-svelte CLI to add components to your project.
|
|
10
|
+
- [components.json](https://shadcn-svelte.com/docs/components-json.md): Configuration for your project.
|
|
11
|
+
- [JavaScript](https://shadcn-svelte.com/docs/javascript.md): How to use shadcn-svelte with JavaScript.
|
|
12
|
+
- [Legacy Docs](https://shadcn-svelte.com/docs/legacy.md): View the legacy docs for shadcn-svelte and Tailwind v3.
|
|
13
|
+
- [Theming](https://shadcn-svelte.com/docs/theming.md): Use CSS Variables to customize the look and feel of your application.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
- [Astro](https://shadcn-svelte.com/docs/installation/astro.md): How to setup shadcn-svelte in an Astro project.
|
|
18
|
+
- [Manual Installation](https://shadcn-svelte.com/docs/installation/manual.md): How to setup shadcn-svelte manually.
|
|
19
|
+
- [SvelteKit](https://shadcn-svelte.com/docs/installation/sveltekit.md): How to setup shadcn-svelte in a SvelteKit project.
|
|
20
|
+
- [Vite](https://shadcn-svelte.com/docs/installation/vite.md): How to setup shadcn-svelte in a Vite project.
|
|
21
|
+
|
|
22
|
+
## Components
|
|
23
|
+
|
|
24
|
+
### Form & Input
|
|
25
|
+
|
|
26
|
+
- [Button](https://shadcn-svelte.com/docs/components/button.md): Displays a button or a component that looks like a button.
|
|
27
|
+
- [Button Group](https://shadcn-svelte.com/docs/components/button-group.md): A container that groups related buttons together with consistent styling.
|
|
28
|
+
- [Calendar](https://shadcn-svelte.com/docs/components/calendar.md): A calendar component that allows users to select dates.
|
|
29
|
+
- [Checkbox](https://shadcn-svelte.com/docs/components/checkbox.md): A control that allows the user to toggle between checked and not checked.
|
|
30
|
+
- [Combobox](https://shadcn-svelte.com/docs/components/combobox.md): Autocomplete input and command palette with a list of suggestions.
|
|
31
|
+
- [Date Picker](https://shadcn-svelte.com/docs/components/date-picker.md): A date picker component with range and presets.
|
|
32
|
+
- [Field](https://shadcn-svelte.com/docs/components/field.md): Combine labels, controls, and help text to compose accessible form fields and grouped inputs.
|
|
33
|
+
- [Formsnap](https://shadcn-svelte.com/docs/components/form.md): Building forms with Formsnap, Superforms, & Zod.
|
|
34
|
+
- [Input](https://shadcn-svelte.com/docs/components/input.md): Displays a form input field or a component that looks like an input field.
|
|
35
|
+
- [Input Group](https://shadcn-svelte.com/docs/components/input-group.md): Display additional information or actions to an input or textarea.
|
|
36
|
+
- [Input OTP](https://shadcn-svelte.com/docs/components/input-otp.md): Accessible one-time password component with copy paste functionality.
|
|
37
|
+
- [Label](https://shadcn-svelte.com/docs/components/label.md): Renders an accessible label associated with controls.
|
|
38
|
+
- [Native Select](https://shadcn-svelte.com/docs/components/native-select.md): A styled native HTML select element with consistent design system integration.
|
|
39
|
+
- [Radio Group](https://shadcn-svelte.com/docs/components/radio-group.md): A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.
|
|
40
|
+
- [Select](https://shadcn-svelte.com/docs/components/select.md): Displays a list of options for the user to pick from—triggered by a button.
|
|
41
|
+
- [Slider](https://shadcn-svelte.com/docs/components/slider.md): An input where the user selects a value from within a given range.
|
|
42
|
+
- [Switch](https://shadcn-svelte.com/docs/components/switch.md): A control that allows the user to toggle between checked and not checked.
|
|
43
|
+
- [Textarea](https://shadcn-svelte.com/docs/components/textarea.md): Displays a form textarea or a component that looks like a textarea.
|
|
44
|
+
|
|
45
|
+
### Layout & Navigation
|
|
46
|
+
|
|
47
|
+
- [Accordion](https://shadcn-svelte.com/docs/components/accordion.md): A vertically stacked set of interactive headings that each reveal a section of content.
|
|
48
|
+
- [Breadcrumb](https://shadcn-svelte.com/docs/components/breadcrumb.md): Displays the path to the current resource using a hierarchy of links.
|
|
49
|
+
- [Navigation Menu](https://shadcn-svelte.com/docs/components/navigation-menu.md): A collection of links for navigating websites.
|
|
50
|
+
- [Resizable](https://shadcn-svelte.com/docs/components/resizable.md): Accessible resizable panel groups and layouts with keyboard support.
|
|
51
|
+
- [Scroll Area](https://shadcn-svelte.com/docs/components/scroll-area.md): Augments native scroll functionality for custom, cross-browser styling.
|
|
52
|
+
- [Separator](https://shadcn-svelte.com/docs/components/separator.md): Visually or semantically separates content.
|
|
53
|
+
- [Sidebar](https://shadcn-svelte.com/docs/components/sidebar.md): A composable, themeable and customizable sidebar component.
|
|
54
|
+
- [Tabs](https://shadcn-svelte.com/docs/components/tabs.md): A set of layered sections of content—known as tab panels—that are displayed one at a time.
|
|
55
|
+
|
|
56
|
+
### Overlays & Dialogs
|
|
57
|
+
|
|
58
|
+
- [Alert Dialog](https://shadcn-svelte.com/docs/components/alert-dialog.md): A modal dialog that interrupts the user with important content and expects a response.
|
|
59
|
+
- [Command](https://shadcn-svelte.com/docs/components/command.md): Fast, composable, unstyled command menu for Svelte.
|
|
60
|
+
- [Context Menu](https://shadcn-svelte.com/docs/components/context-menu.md): Displays a menu to the user — such as a set of actions or functions — triggered by right click.
|
|
61
|
+
- [Dialog](https://shadcn-svelte.com/docs/components/dialog.md): A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.
|
|
62
|
+
- [Drawer](https://shadcn-svelte.com/docs/components/drawer.md): A drawer component for Svelte.
|
|
63
|
+
- [Dropdown Menu](https://shadcn-svelte.com/docs/components/dropdown-menu.md): Displays a menu to the user — such as a set of actions or functions — triggered by a button.
|
|
64
|
+
- [Hover Card](https://shadcn-svelte.com/docs/components/hover-card.md): For sighted users to preview content available behind a link.
|
|
65
|
+
- [Menubar](https://shadcn-svelte.com/docs/components/menubar.md): A visually persistent menu common in desktop applications that provides quick access to a consistent set of commands.
|
|
66
|
+
- [Popover](https://shadcn-svelte.com/docs/components/popover.md): Displays rich content in a portal, triggered by a button.
|
|
67
|
+
- [Sheet](https://shadcn-svelte.com/docs/components/sheet.md): Extends the Dialog component to display content that complements the main content of the screen.
|
|
68
|
+
- [Tooltip](https://shadcn-svelte.com/docs/components/tooltip.md): A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
|
|
69
|
+
|
|
70
|
+
### Feedback & Status
|
|
71
|
+
|
|
72
|
+
- [Alert](https://shadcn-svelte.com/docs/components/alert.md): Displays a callout for user attention.
|
|
73
|
+
- [Badge](https://shadcn-svelte.com/docs/components/badge.md): Displays a badge or a component that looks like a badge.
|
|
74
|
+
- [Empty](https://shadcn-svelte.com/docs/components/empty.md): Use the Empty component to display a empty state.
|
|
75
|
+
- [Progress](https://shadcn-svelte.com/docs/components/progress.md): Displays an indicator showing the completion progress of a task, typically displayed as a progress bar.
|
|
76
|
+
- [Skeleton](https://shadcn-svelte.com/docs/components/skeleton.md): Use to show a placeholder while content is loading.
|
|
77
|
+
- [Sonner](https://shadcn-svelte.com/docs/components/sonner.md): An opinionated toast component for Svelte.
|
|
78
|
+
- [Spinner](https://shadcn-svelte.com/docs/components/spinner.md): An indicator that can be used to show a loading state.
|
|
79
|
+
|
|
80
|
+
### Display & Media
|
|
81
|
+
|
|
82
|
+
- [Aspect Ratio](https://shadcn-svelte.com/docs/components/aspect-ratio.md): Displays content within a desired ratio.
|
|
83
|
+
- [Avatar](https://shadcn-svelte.com/docs/components/avatar.md): An image element with a fallback for representing the user.
|
|
84
|
+
- [Card](https://shadcn-svelte.com/docs/components/card.md): Displays a card with header, content, and footer.
|
|
85
|
+
- [Carousel](https://shadcn-svelte.com/docs/components/carousel.md): A carousel with motion and swipe built using Embla.
|
|
86
|
+
- [Chart](https://shadcn-svelte.com/docs/components/chart.md): Beautiful charts. Built using LayerChart. Copy and paste into your apps.
|
|
87
|
+
- [Data Table](https://shadcn-svelte.com/docs/components/data-table.md): Powerful table and datagrids built using TanStack Table.
|
|
88
|
+
- [Item](https://shadcn-svelte.com/docs/components/item.md): A versatile component that you can use to display any content.
|
|
89
|
+
- [Kbd](https://shadcn-svelte.com/docs/components/kbd.md): Used to display textual user input from keyboard.
|
|
90
|
+
- [Table](https://shadcn-svelte.com/docs/components/table.md): A responsive table component.
|
|
91
|
+
- [Typography](https://shadcn-svelte.com/docs/components/typography.md): Styles for headings, paragraphs, lists...etc
|
|
92
|
+
|
|
93
|
+
### Misc
|
|
94
|
+
|
|
95
|
+
- [Collapsible](https://shadcn-svelte.com/docs/components/collapsible.md): An interactive component which expands/collapses a panel.
|
|
96
|
+
- [Pagination](https://shadcn-svelte.com/docs/components/pagination.md): Pagination with page navigation, next and previous links.
|
|
97
|
+
- [Range Calendar](https://shadcn-svelte.com/docs/components/range-calendar.md): A calendar component that allows users to select a range of dates.
|
|
98
|
+
- [Toggle](https://shadcn-svelte.com/docs/components/toggle.md): A two-state button that can be either on or off.
|
|
99
|
+
- [Toggle Group](https://shadcn-svelte.com/docs/components/toggle-group.md): A set of two-state buttons that can be toggled on or off.
|
|
100
|
+
|
|
101
|
+
## Dark Mode
|
|
102
|
+
|
|
103
|
+
- [Astro](https://shadcn-svelte.com/docs/dark-mode/astro.md): Adding dark mode to your Astro site.
|
|
104
|
+
- [Svelte](https://shadcn-svelte.com/docs/dark-mode/svelte.md): Adding dark mode to your Svelte site.
|
|
105
|
+
|
|
106
|
+
## Migration
|
|
107
|
+
|
|
108
|
+
- [Svelte 5](https://shadcn-svelte.com/docs/migration/svelte-5.md): How to migrate from Svelte 4 and Tailwind 3 to Svelte 5.
|
|
109
|
+
- [Tailwind v4](https://shadcn-svelte.com/docs/migration/tailwind-v4.md): How to use shadcn-svelte with Tailwind v4 and Svelte 5.
|
|
110
|
+
|
|
111
|
+
## Registry
|
|
112
|
+
|
|
113
|
+
- [Examples](https://shadcn-svelte.com/docs/registry/examples.md): Examples of registry items: styles, components, css vars, etc.
|
|
114
|
+
- [FAQ](https://shadcn-svelte.com/docs/registry/faq.md): Frequently asked questions about running a registry.
|
|
115
|
+
- [Getting Started](https://shadcn-svelte.com/docs/registry/getting-started.md): Learn how to get setup and run your own component registry.
|
|
116
|
+
- [registry-item.json](https://shadcn-svelte.com/docs/registry/registry-item-json.md): Specification for registry items.
|
|
117
|
+
- [registry.json](https://shadcn-svelte.com/docs/registry/registry-json.md): Schema for running your own component registry.
|
|
118
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// See https://svelte.dev/docs/kit/types#app.d.ts
|
|
2
|
+
// for information about these interfaces
|
|
3
|
+
declare global {
|
|
4
|
+
namespace App {
|
|
5
|
+
// interface Error {}
|
|
6
|
+
// interface Locals {}
|
|
7
|
+
// interface PageData {}
|
|
8
|
+
// interface PageState {}
|
|
9
|
+
// interface Platform {}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { type VariantProps, tv } from "tailwind-variants";
|
|
3
|
+
|
|
4
|
+
export const badgeVariants = tv({
|
|
5
|
+
base: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none [&>svg]:size-3",
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default:
|
|
9
|
+
"bg-primary text-primary-foreground [a&]:hover:bg-primary/90 border-transparent",
|
|
10
|
+
secondary:
|
|
11
|
+
"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90 border-transparent",
|
|
12
|
+
destructive:
|
|
13
|
+
"bg-destructive [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/70 border-transparent text-white",
|
|
14
|
+
outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
variant: "default",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export type BadgeVariant = VariantProps<typeof badgeVariants>["variant"];
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
27
|
+
import { cn, type WithElementRef } from "$lib/utils.js";
|
|
28
|
+
|
|
29
|
+
let {
|
|
30
|
+
ref = $bindable(null),
|
|
31
|
+
href,
|
|
32
|
+
class: className,
|
|
33
|
+
variant = "default",
|
|
34
|
+
children,
|
|
35
|
+
...restProps
|
|
36
|
+
}: WithElementRef<HTMLAnchorAttributes> & {
|
|
37
|
+
variant?: BadgeVariant;
|
|
38
|
+
} = $props();
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<svelte:element
|
|
42
|
+
this={href ? "a" : "span"}
|
|
43
|
+
bind:this={ref}
|
|
44
|
+
data-slot="badge"
|
|
45
|
+
{href}
|
|
46
|
+
class={cn(badgeVariants({ variant }), className)}
|
|
47
|
+
{...restProps}
|
|
48
|
+
>
|
|
49
|
+
{@render children?.()}
|
|
50
|
+
</svelte:element>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { cn, type WithElementRef } from "$lib/utils.js";
|
|
3
|
+
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from "svelte/elements";
|
|
4
|
+
import { type VariantProps, tv } from "tailwind-variants";
|
|
5
|
+
|
|
6
|
+
export const buttonVariants = tv({
|
|
7
|
+
base: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90 shadow-xs",
|
|
11
|
+
destructive:
|
|
12
|
+
"bg-destructive hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white shadow-xs",
|
|
13
|
+
outline:
|
|
14
|
+
"bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border shadow-xs",
|
|
15
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 shadow-xs",
|
|
16
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
17
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
21
|
+
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
|
22
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
23
|
+
icon: "size-9",
|
|
24
|
+
"icon-sm": "size-8",
|
|
25
|
+
"icon-lg": "size-10",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
variant: "default",
|
|
30
|
+
size: "default",
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
|
|
35
|
+
export type ButtonSize = VariantProps<typeof buttonVariants>["size"];
|
|
36
|
+
|
|
37
|
+
export type ButtonProps = WithElementRef<HTMLButtonAttributes> &
|
|
38
|
+
WithElementRef<HTMLAnchorAttributes> & {
|
|
39
|
+
variant?: ButtonVariant;
|
|
40
|
+
size?: ButtonSize;
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<script lang="ts">
|
|
45
|
+
let {
|
|
46
|
+
class: className,
|
|
47
|
+
variant = "default",
|
|
48
|
+
size = "default",
|
|
49
|
+
ref = $bindable(null),
|
|
50
|
+
href = undefined,
|
|
51
|
+
type = "button",
|
|
52
|
+
disabled,
|
|
53
|
+
children,
|
|
54
|
+
...restProps
|
|
55
|
+
}: ButtonProps = $props();
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
{#if href}
|
|
59
|
+
<a
|
|
60
|
+
bind:this={ref}
|
|
61
|
+
data-slot="button"
|
|
62
|
+
class={cn(buttonVariants({ variant, size }), className)}
|
|
63
|
+
href={disabled ? undefined : href}
|
|
64
|
+
aria-disabled={disabled}
|
|
65
|
+
role={disabled ? "link" : undefined}
|
|
66
|
+
tabindex={disabled ? -1 : undefined}
|
|
67
|
+
{...restProps}
|
|
68
|
+
>
|
|
69
|
+
{@render children?.()}
|
|
70
|
+
</a>
|
|
71
|
+
{:else}
|
|
72
|
+
<button
|
|
73
|
+
bind:this={ref}
|
|
74
|
+
data-slot="button"
|
|
75
|
+
class={cn(buttonVariants({ variant, size }), className)}
|
|
76
|
+
{type}
|
|
77
|
+
{disabled}
|
|
78
|
+
{...restProps}
|
|
79
|
+
>
|
|
80
|
+
{@render children?.()}
|
|
81
|
+
</button>
|
|
82
|
+
{/if}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Root, {
|
|
2
|
+
type ButtonProps,
|
|
3
|
+
type ButtonSize,
|
|
4
|
+
type ButtonVariant,
|
|
5
|
+
buttonVariants,
|
|
6
|
+
} from "./button.svelte";
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
Root,
|
|
10
|
+
type ButtonProps as Props,
|
|
11
|
+
//
|
|
12
|
+
Root as Button,
|
|
13
|
+
buttonVariants,
|
|
14
|
+
type ButtonProps,
|
|
15
|
+
type ButtonSize,
|
|
16
|
+
type ButtonVariant,
|
|
17
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from "$lib/utils.js";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="card-action"
|
|
16
|
+
class={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { cn, type WithElementRef } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div bind:this={ref} data-slot="card-content" class={cn("px-6", className)} {...restProps}>
|
|
14
|
+
{@render children?.()}
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { cn, type WithElementRef } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLParagraphElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<p
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="card-description"
|
|
16
|
+
class={cn("text-muted-foreground text-sm", className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</p>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from "$lib/utils.js";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="card-footer"
|
|
16
|
+
class={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from "$lib/utils.js";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="card-header"
|
|
16
|
+
class={cn(
|
|
17
|
+
"@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",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...restProps}
|
|
21
|
+
>
|
|
22
|
+
{@render children?.()}
|
|
23
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { cn, type WithElementRef } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="card-title"
|
|
16
|
+
class={cn("leading-none font-semibold", className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { cn, type WithElementRef } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="card"
|
|
16
|
+
class={cn(
|
|
17
|
+
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...restProps}
|
|
21
|
+
>
|
|
22
|
+
{@render children?.()}
|
|
23
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Root from "./card.svelte";
|
|
2
|
+
import Content from "./card-content.svelte";
|
|
3
|
+
import Description from "./card-description.svelte";
|
|
4
|
+
import Footer from "./card-footer.svelte";
|
|
5
|
+
import Header from "./card-header.svelte";
|
|
6
|
+
import Title from "./card-title.svelte";
|
|
7
|
+
import Action from "./card-action.svelte";
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
Root,
|
|
11
|
+
Content,
|
|
12
|
+
Description,
|
|
13
|
+
Footer,
|
|
14
|
+
Header,
|
|
15
|
+
Title,
|
|
16
|
+
Action,
|
|
17
|
+
//
|
|
18
|
+
Root as Card,
|
|
19
|
+
Content as CardContent,
|
|
20
|
+
Description as CardDescription,
|
|
21
|
+
Footer as CardFooter,
|
|
22
|
+
Header as CardHeader,
|
|
23
|
+
Title as CardTitle,
|
|
24
|
+
Action as CardAction,
|
|
25
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Separator as SeparatorPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
"data-slot": dataSlot = "separator",
|
|
9
|
+
...restProps
|
|
10
|
+
}: SeparatorPrimitive.RootProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<SeparatorPrimitive.Root
|
|
14
|
+
bind:ref
|
|
15
|
+
data-slot={dataSlot}
|
|
16
|
+
class={cn(
|
|
17
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:min-h-full data-[orientation=vertical]:w-px",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...restProps}
|
|
21
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Root from "./tooltip.svelte";
|
|
2
|
+
import Trigger from "./tooltip-trigger.svelte";
|
|
3
|
+
import Content from "./tooltip-content.svelte";
|
|
4
|
+
import Provider from "./tooltip-provider.svelte";
|
|
5
|
+
import Portal from "./tooltip-portal.svelte";
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
Root,
|
|
9
|
+
Trigger,
|
|
10
|
+
Content,
|
|
11
|
+
Provider,
|
|
12
|
+
Portal,
|
|
13
|
+
//
|
|
14
|
+
Root as Tooltip,
|
|
15
|
+
Content as TooltipContent,
|
|
16
|
+
Trigger as TooltipTrigger,
|
|
17
|
+
Provider as TooltipProvider,
|
|
18
|
+
Portal as TooltipPortal,
|
|
19
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Tooltip as TooltipPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
import TooltipPortal from "./tooltip-portal.svelte";
|
|
5
|
+
import type { ComponentProps } from "svelte";
|
|
6
|
+
import type { WithoutChildrenOrChild } from "$lib/utils.js";
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
ref = $bindable(null),
|
|
10
|
+
class: className,
|
|
11
|
+
sideOffset = 0,
|
|
12
|
+
side = "top",
|
|
13
|
+
children,
|
|
14
|
+
arrowClasses,
|
|
15
|
+
portalProps,
|
|
16
|
+
...restProps
|
|
17
|
+
}: TooltipPrimitive.ContentProps & {
|
|
18
|
+
arrowClasses?: string;
|
|
19
|
+
portalProps?: WithoutChildrenOrChild<ComponentProps<typeof TooltipPortal>>;
|
|
20
|
+
} = $props();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<TooltipPortal {...portalProps}>
|
|
24
|
+
<TooltipPrimitive.Content
|
|
25
|
+
bind:ref
|
|
26
|
+
data-slot="tooltip-content"
|
|
27
|
+
{sideOffset}
|
|
28
|
+
{side}
|
|
29
|
+
class={cn(
|
|
30
|
+
"bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-end-2 data-[side=right]:slide-in-from-start-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--bits-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
|
|
31
|
+
className
|
|
32
|
+
)}
|
|
33
|
+
{...restProps}
|
|
34
|
+
>
|
|
35
|
+
{@render children?.()}
|
|
36
|
+
<TooltipPrimitive.Arrow>
|
|
37
|
+
{#snippet child({ props })}
|
|
38
|
+
<div
|
|
39
|
+
class={cn(
|
|
40
|
+
"bg-foreground z-50 size-2.5 rotate-45 rounded-[2px]",
|
|
41
|
+
"data-[side=top]:translate-x-1/2 data-[side=top]:translate-y-[calc(-50%_+_2px)]",
|
|
42
|
+
"data-[side=bottom]:-translate-x-1/2 data-[side=bottom]:-translate-y-[calc(-50%_+_1px)]",
|
|
43
|
+
"data-[side=right]:translate-x-[calc(50%_+_2px)] data-[side=right]:translate-y-1/2",
|
|
44
|
+
"data-[side=left]:-translate-y-[calc(50%_-_3px)]",
|
|
45
|
+
arrowClasses
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
></div>
|
|
49
|
+
{/snippet}
|
|
50
|
+
</TooltipPrimitive.Arrow>
|
|
51
|
+
</TooltipPrimitive.Content>
|
|
52
|
+
</TooltipPortal>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// place files you want to import through the `$lib` alias in this folder.
|