@lobb-js/studio 0.1.31
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/.env.example +1 -0
- package/.storybook/main.ts +31 -0
- package/.storybook/preview.ts +21 -0
- package/.storybook/vitest.setup.ts +7 -0
- package/README.md +47 -0
- package/components.json +16 -0
- package/docker-entrypoint.sh +7 -0
- package/dockerfile +27 -0
- package/index.html +13 -0
- package/package.json +77 -0
- package/public/lobb.svg +15 -0
- package/src/Studio.svelte +150 -0
- package/src/app.css +121 -0
- package/src/components-export.ts +21 -0
- package/src/extensions/extension.types.ts +93 -0
- package/src/extensions/extensionUtils.ts +192 -0
- package/src/lib/Lobb.ts +241 -0
- package/src/lib/components/LlmButton.svelte +136 -0
- package/src/lib/components/alertView.svelte +20 -0
- package/src/lib/components/breadCrumbs.svelte +60 -0
- package/src/lib/components/combobox.svelte +92 -0
- package/src/lib/components/confirmationDialog/confirmationDialog.svelte +33 -0
- package/src/lib/components/confirmationDialog/store.svelte.ts +28 -0
- package/src/lib/components/createManyButton.svelte +107 -0
- package/src/lib/components/dataTable/childRecords.svelte +140 -0
- package/src/lib/components/dataTable/dataTable.svelte +223 -0
- package/src/lib/components/dataTable/fieldCell.svelte +74 -0
- package/src/lib/components/dataTable/filter.svelte +282 -0
- package/src/lib/components/dataTable/filterButton.svelte +39 -0
- package/src/lib/components/dataTable/footer.svelte +84 -0
- package/src/lib/components/dataTable/header.svelte +154 -0
- package/src/lib/components/dataTable/sort.svelte +171 -0
- package/src/lib/components/dataTable/sortButton.svelte +36 -0
- package/src/lib/components/dataTable/table.svelte +337 -0
- package/src/lib/components/dataTable/utils.ts +127 -0
- package/src/lib/components/detailView/create/children.svelte +68 -0
- package/src/lib/components/detailView/create/createDetailView.svelte +226 -0
- package/src/lib/components/detailView/create/createDetailViewButton.svelte +32 -0
- package/src/lib/components/detailView/create/createManyView.svelte +250 -0
- package/src/lib/components/detailView/create/subRecords.svelte +48 -0
- package/src/lib/components/detailView/detailViewForm.svelte +104 -0
- package/src/lib/components/detailView/fieldCustomInput.svelte +23 -0
- package/src/lib/components/detailView/fieldInput.svelte +287 -0
- package/src/lib/components/detailView/fieldInputReplacement.svelte +199 -0
- package/src/lib/components/detailView/store.svelte.ts +61 -0
- package/src/lib/components/detailView/update/children.svelte +94 -0
- package/src/lib/components/detailView/update/updateDetailView.svelte +175 -0
- package/src/lib/components/detailView/update/updateDetailViewButton.svelte +32 -0
- package/src/lib/components/detailView/utils.ts +177 -0
- package/src/lib/components/diffViewer.svelte +102 -0
- package/src/lib/components/drawer.svelte +28 -0
- package/src/lib/components/extensionsComponents.svelte +31 -0
- package/src/lib/components/foreingKeyInput.svelte +80 -0
- package/src/lib/components/header.svelte +45 -0
- package/src/lib/components/loadingTypesForMonacoEditor.ts +36 -0
- package/src/lib/components/miniSidebar.svelte +238 -0
- package/src/lib/components/monacoEditor.svelte +181 -0
- package/src/lib/components/rangeCalendarButton.svelte +257 -0
- package/src/lib/components/selectRecord.svelte +126 -0
- package/src/lib/components/setServerPage.svelte +48 -0
- package/src/lib/components/sidebar/index.ts +4 -0
- package/src/lib/components/sidebar/sidebar.svelte +149 -0
- package/src/lib/components/sidebar/sidebarElements.svelte +144 -0
- package/src/lib/components/sidebar/sidebarTrigger.svelte +33 -0
- package/src/lib/components/singletone.svelte +69 -0
- package/src/lib/components/ui/accordion/accordion-content.svelte +22 -0
- package/src/lib/components/ui/accordion/accordion-item.svelte +12 -0
- package/src/lib/components/ui/accordion/accordion-trigger.svelte +31 -0
- package/src/lib/components/ui/accordion/index.ts +17 -0
- package/src/lib/components/ui/alert/alert-description.svelte +16 -0
- package/src/lib/components/ui/alert/alert-title.svelte +24 -0
- package/src/lib/components/ui/alert/alert.svelte +39 -0
- package/src/lib/components/ui/alert/index.ts +14 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte +13 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte +17 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-content.svelte +26 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-description.svelte +16 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-footer.svelte +20 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-header.svelte +20 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-overlay.svelte +19 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-title.svelte +18 -0
- package/src/lib/components/ui/alert-dialog/index.ts +40 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-ellipsis.svelte +23 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-item.svelte +16 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-link.svelte +31 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-list.svelte +23 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-page.svelte +23 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-separator.svelte +27 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb.svelte +15 -0
- package/src/lib/components/ui/breadcrumb/index.ts +25 -0
- package/src/lib/components/ui/button/button.svelte +110 -0
- package/src/lib/components/ui/button/index.ts +17 -0
- package/src/lib/components/ui/checkbox/checkbox.svelte +35 -0
- package/src/lib/components/ui/checkbox/index.ts +6 -0
- package/src/lib/components/ui/command/command-dialog.svelte +35 -0
- package/src/lib/components/ui/command/command-empty.svelte +12 -0
- package/src/lib/components/ui/command/command-group.svelte +31 -0
- package/src/lib/components/ui/command/command-input.svelte +25 -0
- package/src/lib/components/ui/command/command-item.svelte +19 -0
- package/src/lib/components/ui/command/command-link-item.svelte +19 -0
- package/src/lib/components/ui/command/command-list.svelte +16 -0
- package/src/lib/components/ui/command/command-separator.svelte +12 -0
- package/src/lib/components/ui/command/command-shortcut.svelte +20 -0
- package/src/lib/components/ui/command/command.svelte +21 -0
- package/src/lib/components/ui/command/index.ts +40 -0
- package/src/lib/components/ui/dialog/dialog-content.svelte +38 -0
- package/src/lib/components/ui/dialog/dialog-description.svelte +16 -0
- package/src/lib/components/ui/dialog/dialog-footer.svelte +20 -0
- package/src/lib/components/ui/dialog/dialog-header.svelte +20 -0
- package/src/lib/components/ui/dialog/dialog-overlay.svelte +19 -0
- package/src/lib/components/ui/dialog/dialog-title.svelte +16 -0
- package/src/lib/components/ui/dialog/index.ts +37 -0
- package/src/lib/components/ui/input/index.ts +7 -0
- package/src/lib/components/ui/input/input.svelte +46 -0
- package/src/lib/components/ui/label/index.ts +7 -0
- package/src/lib/components/ui/label/label.svelte +19 -0
- package/src/lib/components/ui/popover/index.ts +17 -0
- package/src/lib/components/ui/popover/popover-content.svelte +28 -0
- package/src/lib/components/ui/range-calendar/index.ts +30 -0
- package/src/lib/components/ui/range-calendar/range-calendar-cell.svelte +19 -0
- package/src/lib/components/ui/range-calendar/range-calendar-day.svelte +35 -0
- package/src/lib/components/ui/range-calendar/range-calendar-grid-body.svelte +12 -0
- package/src/lib/components/ui/range-calendar/range-calendar-grid-head.svelte +12 -0
- package/src/lib/components/ui/range-calendar/range-calendar-grid-row.svelte +12 -0
- package/src/lib/components/ui/range-calendar/range-calendar-grid.svelte +16 -0
- package/src/lib/components/ui/range-calendar/range-calendar-head-cell.svelte +16 -0
- package/src/lib/components/ui/range-calendar/range-calendar-header.svelte +16 -0
- package/src/lib/components/ui/range-calendar/range-calendar-heading.svelte +16 -0
- package/src/lib/components/ui/range-calendar/range-calendar-months.svelte +20 -0
- package/src/lib/components/ui/range-calendar/range-calendar-next-button.svelte +27 -0
- package/src/lib/components/ui/range-calendar/range-calendar-prev-button.svelte +27 -0
- package/src/lib/components/ui/range-calendar/range-calendar.svelte +57 -0
- package/src/lib/components/ui/select/index.ts +34 -0
- package/src/lib/components/ui/select/select-content.svelte +38 -0
- package/src/lib/components/ui/select/select-group-heading.svelte +16 -0
- package/src/lib/components/ui/select/select-item.svelte +37 -0
- package/src/lib/components/ui/select/select-scroll-down-button.svelte +19 -0
- package/src/lib/components/ui/select/select-scroll-up-button.svelte +19 -0
- package/src/lib/components/ui/select/select-separator.svelte +13 -0
- package/src/lib/components/ui/select/select-trigger.svelte +24 -0
- package/src/lib/components/ui/separator/index.ts +7 -0
- package/src/lib/components/ui/separator/separator.svelte +22 -0
- package/src/lib/components/ui/skeleton/index.ts +7 -0
- package/src/lib/components/ui/skeleton/skeleton.svelte +22 -0
- package/src/lib/components/ui/sonner/index.ts +1 -0
- package/src/lib/components/ui/sonner/sonner.svelte +20 -0
- package/src/lib/components/ui/switch/index.ts +7 -0
- package/src/lib/components/ui/switch/switch.svelte +27 -0
- package/src/lib/components/ui/textarea/index.ts +7 -0
- package/src/lib/components/ui/textarea/textarea.svelte +22 -0
- package/src/lib/components/ui/tooltip/index.ts +18 -0
- package/src/lib/components/ui/tooltip/tooltip-content.svelte +21 -0
- package/src/lib/components/workflowEditor.svelte +187 -0
- package/src/lib/eventSystem.ts +38 -0
- package/src/lib/index.ts +40 -0
- package/src/lib/store.svelte.ts +21 -0
- package/src/lib/store.types.ts +28 -0
- package/src/lib/utils.ts +84 -0
- package/src/main.ts +18 -0
- package/src/routes/collections/collection.svelte +46 -0
- package/src/routes/collections/collections.svelte +43 -0
- package/src/routes/data_model/dataModel.svelte +40 -0
- package/src/routes/data_model/flow.css +22 -0
- package/src/routes/data_model/flow.svelte +82 -0
- package/src/routes/data_model/syncManager.svelte +93 -0
- package/src/routes/data_model/utils.ts +35 -0
- package/src/routes/extensions/extension.svelte +16 -0
- package/src/routes/home.svelte +36 -0
- package/src/routes/workflows/workflows.svelte +135 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/detailView/detailViewForm.stories.svelte +79 -0
- package/src/stories/examples/Button.stories.svelte +31 -0
- package/src/stories/examples/Button.svelte +30 -0
- package/src/stories/examples/Header.stories.svelte +26 -0
- package/src/stories/examples/Header.svelte +45 -0
- package/src/stories/examples/Page.stories.svelte +29 -0
- package/src/stories/examples/Page.svelte +70 -0
- package/src/stories/examples/button.css +30 -0
- package/src/stories/examples/header.css +32 -0
- package/src/stories/examples/page.css +68 -0
- package/src/vite-env.d.ts +2 -0
- package/svelte.config.js +7 -0
- package/todo.md +24 -0
- package/tsconfig.app.json +25 -0
- package/tsconfig.json +14 -0
- package/tsconfig.node.json +24 -0
- package/vite-plugin-contextual-lib.js +66 -0
- package/vite.build.svelte.config.ts +18 -0
- package/vite.config.ts +84 -0
- package/vite.extension.config.ts +81 -0
- package/vite_utils.ts +28 -0
- package/vitest.shims.d.ts +1 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
3
|
+
import type { Snippet } from "svelte";
|
|
4
|
+
import type { WithElementRef } from "bits-ui";
|
|
5
|
+
import { cn } from "$lib/utils.js";
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
href = undefined,
|
|
11
|
+
child,
|
|
12
|
+
children,
|
|
13
|
+
...restProps
|
|
14
|
+
}: WithElementRef<HTMLAnchorAttributes> & {
|
|
15
|
+
child?: Snippet<[{ props: HTMLAnchorAttributes }]>;
|
|
16
|
+
} = $props();
|
|
17
|
+
|
|
18
|
+
const attrs = $derived({
|
|
19
|
+
class: cn("hover:text-foreground transition-colors", className),
|
|
20
|
+
href,
|
|
21
|
+
...restProps,
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
{#if child}
|
|
26
|
+
{@render child({ props: attrs })}
|
|
27
|
+
{:else}
|
|
28
|
+
<a bind:this={ref} {...attrs}>
|
|
29
|
+
{@render children?.()}
|
|
30
|
+
</a>
|
|
31
|
+
{/if}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { WithElementRef } from "bits-ui";
|
|
3
|
+
import type { HTMLOlAttributes } from "svelte/elements";
|
|
4
|
+
import { cn } from "$lib/utils.js";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithElementRef<HTMLOlAttributes> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<ol
|
|
15
|
+
bind:this={ref}
|
|
16
|
+
class={cn(
|
|
17
|
+
"text-muted-foreground flex flex-wrap items-center gap-1.5 wrap-break-word text-sm sm:gap-2.5",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...restProps}
|
|
21
|
+
>
|
|
22
|
+
{@render children?.()}
|
|
23
|
+
</ol>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { WithElementRef } from "bits-ui";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import { cn } from "$lib/utils.js";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithElementRef<HTMLAttributes<HTMLSpanElement>> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<span
|
|
15
|
+
bind:this={ref}
|
|
16
|
+
role="link"
|
|
17
|
+
aria-disabled="true"
|
|
18
|
+
aria-current="page"
|
|
19
|
+
class={cn("text-foreground font-normal", className)}
|
|
20
|
+
{...restProps}
|
|
21
|
+
>
|
|
22
|
+
{@render children?.()}
|
|
23
|
+
</span>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import ChevronRight from "@lucide/svelte/icons/chevron-right";
|
|
3
|
+
import type { WithElementRef } from "bits-ui";
|
|
4
|
+
import type { HTMLLiAttributes } from "svelte/elements";
|
|
5
|
+
import { cn } from "$lib/utils.js";
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithElementRef<HTMLLiAttributes> = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<li
|
|
16
|
+
role="presentation"
|
|
17
|
+
aria-hidden="true"
|
|
18
|
+
class={cn("[&>svg]:size-3.5", className)}
|
|
19
|
+
bind:this={ref}
|
|
20
|
+
{...restProps}
|
|
21
|
+
>
|
|
22
|
+
{#if children}
|
|
23
|
+
{@render children?.()}
|
|
24
|
+
{:else}
|
|
25
|
+
<ChevronRight />
|
|
26
|
+
{/if}
|
|
27
|
+
</li>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { WithElementRef } from "bits-ui";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<nav class={className} bind:this={ref} aria-label="breadcrumb" {...restProps}>
|
|
14
|
+
{@render children?.()}
|
|
15
|
+
</nav>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Root from "./breadcrumb.svelte";
|
|
2
|
+
import Ellipsis from "./breadcrumb-ellipsis.svelte";
|
|
3
|
+
import Item from "./breadcrumb-item.svelte";
|
|
4
|
+
import Separator from "./breadcrumb-separator.svelte";
|
|
5
|
+
import Link from "./breadcrumb-link.svelte";
|
|
6
|
+
import List from "./breadcrumb-list.svelte";
|
|
7
|
+
import Page from "./breadcrumb-page.svelte";
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
Root,
|
|
11
|
+
Ellipsis,
|
|
12
|
+
Item,
|
|
13
|
+
Separator,
|
|
14
|
+
Link,
|
|
15
|
+
List,
|
|
16
|
+
Page,
|
|
17
|
+
//
|
|
18
|
+
Root as Breadcrumb,
|
|
19
|
+
Ellipsis as BreadcrumbEllipsis,
|
|
20
|
+
Item as BreadcrumbItem,
|
|
21
|
+
Separator as BreadcrumbSeparator,
|
|
22
|
+
Link as BreadcrumbLink,
|
|
23
|
+
List as BreadcrumbList,
|
|
24
|
+
Page as BreadcrumbPage,
|
|
25
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { WithElementRef } from "bits-ui";
|
|
3
|
+
import type {
|
|
4
|
+
HTMLAnchorAttributes,
|
|
5
|
+
HTMLButtonAttributes,
|
|
6
|
+
} from "svelte/elements";
|
|
7
|
+
import { type VariantProps, tv } from "tailwind-variants";
|
|
8
|
+
|
|
9
|
+
export const buttonVariants = tv({
|
|
10
|
+
base: "focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default:
|
|
14
|
+
"bg-primary text-primary-foreground hover:bg-primary/90 shadow",
|
|
15
|
+
destructive:
|
|
16
|
+
"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm",
|
|
17
|
+
outline:
|
|
18
|
+
"border-input bg-background hover:bg-accent hover:text-accent-foreground border shadow-sm",
|
|
19
|
+
secondary:
|
|
20
|
+
"bg-secondary text-secondary-foreground hover:bg-secondary/80 shadow-sm",
|
|
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",
|
|
26
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
27
|
+
lg: "h-10 rounded-md px-8",
|
|
28
|
+
icon: "h-9 w-9",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
variant: "default",
|
|
33
|
+
size: "default",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
|
|
38
|
+
export type ButtonSize = VariantProps<typeof buttonVariants>["size"];
|
|
39
|
+
|
|
40
|
+
export type ButtonProps = WithElementRef<HTMLButtonAttributes> &
|
|
41
|
+
WithElementRef<HTMLAnchorAttributes> & {
|
|
42
|
+
variant?: ButtonVariant;
|
|
43
|
+
size?: ButtonSize;
|
|
44
|
+
Icon?: any;
|
|
45
|
+
href?: string;
|
|
46
|
+
};
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<script lang="ts">
|
|
50
|
+
import { cn } from "$lib/utils.js";
|
|
51
|
+
import { LoaderCircle } from "lucide-svelte";
|
|
52
|
+
import { Link, location } from "@wjfe/n-savant";
|
|
53
|
+
|
|
54
|
+
let {
|
|
55
|
+
class: className,
|
|
56
|
+
variant = "default",
|
|
57
|
+
size = "default",
|
|
58
|
+
ref = $bindable(null),
|
|
59
|
+
href = undefined,
|
|
60
|
+
type = "button",
|
|
61
|
+
children,
|
|
62
|
+
Icon,
|
|
63
|
+
onclick,
|
|
64
|
+
...restProps
|
|
65
|
+
}: ButtonProps = $props();
|
|
66
|
+
|
|
67
|
+
let showLoading = $state(false);
|
|
68
|
+
|
|
69
|
+
const originalOnclick = onclick;
|
|
70
|
+
const handleClick = async (e: any) => {
|
|
71
|
+
showLoading = true;
|
|
72
|
+
if (originalOnclick) {
|
|
73
|
+
try {
|
|
74
|
+
await originalOnclick(e);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
showLoading = false;
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
showLoading = false;
|
|
81
|
+
};
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
{#snippet innerPart()}
|
|
85
|
+
{#if showLoading}
|
|
86
|
+
<LoaderCircle class="animate-spin" />
|
|
87
|
+
{/if}
|
|
88
|
+
{#if Icon}
|
|
89
|
+
{#if !showLoading}
|
|
90
|
+
<Icon />
|
|
91
|
+
{/if}
|
|
92
|
+
{/if}
|
|
93
|
+
{@render children?.()}
|
|
94
|
+
{/snippet}
|
|
95
|
+
|
|
96
|
+
{#if href}
|
|
97
|
+
<Link {href} class={cn(buttonVariants({ variant, size }), className)}>
|
|
98
|
+
{@render innerPart()}
|
|
99
|
+
</Link>
|
|
100
|
+
{:else}
|
|
101
|
+
<button
|
|
102
|
+
bind:this={ref}
|
|
103
|
+
class={cn(buttonVariants({ variant, size }), className)}
|
|
104
|
+
{type}
|
|
105
|
+
onclick={handleClick}
|
|
106
|
+
{...restProps}
|
|
107
|
+
>
|
|
108
|
+
{@render innerPart()}
|
|
109
|
+
</button>
|
|
110
|
+
{/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,35 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Checkbox as CheckboxPrimitive, type WithoutChildrenOrChild } from "bits-ui";
|
|
3
|
+
import Check from "@lucide/svelte/icons/check";
|
|
4
|
+
import Minus from "@lucide/svelte/icons/minus";
|
|
5
|
+
import { cn } from "$lib/utils.js";
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
checked = $bindable(false),
|
|
11
|
+
indeterminate = $bindable(false),
|
|
12
|
+
...restProps
|
|
13
|
+
}: WithoutChildrenOrChild<CheckboxPrimitive.RootProps> = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<CheckboxPrimitive.Root
|
|
17
|
+
class={cn(
|
|
18
|
+
"border-primary focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground peer box-content size-4 shrink-0 rounded-sm border shadow focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
bind:checked
|
|
22
|
+
bind:ref
|
|
23
|
+
bind:indeterminate
|
|
24
|
+
{...restProps}
|
|
25
|
+
>
|
|
26
|
+
{#snippet children({ checked, indeterminate })}
|
|
27
|
+
<span class="flex items-center justify-center text-current">
|
|
28
|
+
{#if indeterminate}
|
|
29
|
+
<Minus class="size-4" />
|
|
30
|
+
{:else}
|
|
31
|
+
<Check class={cn("size-4", !checked && "text-transparent")} />
|
|
32
|
+
{/if}
|
|
33
|
+
</span>
|
|
34
|
+
{/snippet}
|
|
35
|
+
</CheckboxPrimitive.Root>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
Command as CommandPrimitive,
|
|
4
|
+
Dialog as DialogPrimitive,
|
|
5
|
+
type WithoutChildrenOrChild,
|
|
6
|
+
} from "bits-ui";
|
|
7
|
+
import type { Snippet } from "svelte";
|
|
8
|
+
import Command from "./command.svelte";
|
|
9
|
+
import * as Dialog from "$lib/components/ui/dialog/index.js";
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
open = $bindable(false),
|
|
13
|
+
ref = $bindable(null),
|
|
14
|
+
value = $bindable(""),
|
|
15
|
+
portalProps,
|
|
16
|
+
children,
|
|
17
|
+
...restProps
|
|
18
|
+
}: WithoutChildrenOrChild<DialogPrimitive.RootProps> &
|
|
19
|
+
WithoutChildrenOrChild<CommandPrimitive.RootProps> & {
|
|
20
|
+
portalProps?: DialogPrimitive.PortalProps;
|
|
21
|
+
children: Snippet;
|
|
22
|
+
} = $props();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<Dialog.Root bind:open {...restProps}>
|
|
26
|
+
<Dialog.Content class="overflow-hidden p-0" {portalProps}>
|
|
27
|
+
<Command
|
|
28
|
+
class="**:data-cmdk-group-heading:px-2 **:data-cmdk-group-heading:font-medium [&_[data-cmdk-group]:not([hidden])_~[data-cmdk-group]]:pt-0 **:data-cmdk-group:px-2 [&_[data-cmdk-input-wrapper]_svg]:h-5 [&_[data-cmdk-input-wrapper]_svg]:w-5 **:data-cmdk-input:h-12 **:data-cmdk-item:px-2 **:data-cmdk-item:py-3 [&_[data-cmdk-item]_svg]:h-5 [&_[data-cmdk-item]_svg]:w-5"
|
|
29
|
+
{...restProps}
|
|
30
|
+
bind:value
|
|
31
|
+
bind:ref
|
|
32
|
+
{children}
|
|
33
|
+
/>
|
|
34
|
+
</Dialog.Content>
|
|
35
|
+
</Dialog.Root>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Command as CommandPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: CommandPrimitive.EmptyProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<CommandPrimitive.Empty bind:ref class={cn("py-6 text-center text-sm", className)} {...restProps} />
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Command as CommandPrimitive, useId } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
heading,
|
|
10
|
+
value,
|
|
11
|
+
...restProps
|
|
12
|
+
}: CommandPrimitive.GroupProps & {
|
|
13
|
+
heading?: string;
|
|
14
|
+
} = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<CommandPrimitive.Group
|
|
18
|
+
class={cn("text-foreground overflow-hidden p-1", className)}
|
|
19
|
+
bind:ref
|
|
20
|
+
value={value ?? heading ?? `----${useId()}`}
|
|
21
|
+
{...restProps}
|
|
22
|
+
>
|
|
23
|
+
{#if heading}
|
|
24
|
+
<CommandPrimitive.GroupHeading
|
|
25
|
+
class="text-muted-foreground px-2 py-1.5 text-xs font-medium"
|
|
26
|
+
>
|
|
27
|
+
{heading}
|
|
28
|
+
</CommandPrimitive.GroupHeading>
|
|
29
|
+
{/if}
|
|
30
|
+
<CommandPrimitive.GroupItems {children} />
|
|
31
|
+
</CommandPrimitive.Group>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Command as CommandPrimitive } from "bits-ui";
|
|
3
|
+
import Search from "@lucide/svelte/icons/search";
|
|
4
|
+
import { cn } from "$lib/utils.js";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
value = $bindable(""),
|
|
10
|
+
...restProps
|
|
11
|
+
}: CommandPrimitive.InputProps = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div class="flex items-center border-b px-3" data-command-input-wrapper="">
|
|
15
|
+
<Search class="mr-2 size-4 shrink-0 opacity-50" />
|
|
16
|
+
<CommandPrimitive.Input
|
|
17
|
+
class={cn(
|
|
18
|
+
"placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-base outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
bind:ref
|
|
22
|
+
bind:value
|
|
23
|
+
{...restProps}
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Command as CommandPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: CommandPrimitive.ItemProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<CommandPrimitive.Item
|
|
13
|
+
class={cn(
|
|
14
|
+
"aria-selected:bg-accent aria-selected:text-accent-foreground relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
bind:ref
|
|
18
|
+
{...restProps}
|
|
19
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Command as CommandPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: CommandPrimitive.LinkItemProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<CommandPrimitive.LinkItem
|
|
13
|
+
class={cn(
|
|
14
|
+
"aria-selected:bg-accent aria-selected:text-accent-foreground relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
bind:ref
|
|
18
|
+
{...restProps}
|
|
19
|
+
/>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Command as CommandPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: CommandPrimitive.ListProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<CommandPrimitive.List
|
|
13
|
+
class={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
|
|
14
|
+
bind:ref
|
|
15
|
+
{...restProps}
|
|
16
|
+
/>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Command as CommandPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: CommandPrimitive.SeparatorProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<CommandPrimitive.Separator bind:ref class={cn("bg-border -mx-1 h-px", className)} {...restProps} />
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { WithElementRef } from "bits-ui";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import { cn } from "$lib/utils.js";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithElementRef<HTMLAttributes<HTMLSpanElement>> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<span
|
|
15
|
+
class={cn("text-muted-foreground ml-auto text-xs tracking-widest", className)}
|
|
16
|
+
{...restProps}
|
|
17
|
+
bind:this={ref}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</span>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Command as CommandPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
value = $bindable(""),
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: CommandPrimitive.RootProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<CommandPrimitive.Root
|
|
14
|
+
class={cn(
|
|
15
|
+
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
bind:ref
|
|
19
|
+
bind:value
|
|
20
|
+
{...restProps}
|
|
21
|
+
/>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Command as CommandPrimitive } from "bits-ui";
|
|
2
|
+
|
|
3
|
+
import Root from "./command.svelte";
|
|
4
|
+
import Dialog from "./command-dialog.svelte";
|
|
5
|
+
import Empty from "./command-empty.svelte";
|
|
6
|
+
import Group from "./command-group.svelte";
|
|
7
|
+
import Item from "./command-item.svelte";
|
|
8
|
+
import Input from "./command-input.svelte";
|
|
9
|
+
import List from "./command-list.svelte";
|
|
10
|
+
import Separator from "./command-separator.svelte";
|
|
11
|
+
import Shortcut from "./command-shortcut.svelte";
|
|
12
|
+
import LinkItem from "./command-link-item.svelte";
|
|
13
|
+
|
|
14
|
+
const Loading: typeof CommandPrimitive.Loading = CommandPrimitive.Loading;
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
Root,
|
|
18
|
+
Dialog,
|
|
19
|
+
Empty,
|
|
20
|
+
Group,
|
|
21
|
+
Item,
|
|
22
|
+
LinkItem,
|
|
23
|
+
Input,
|
|
24
|
+
List,
|
|
25
|
+
Separator,
|
|
26
|
+
Shortcut,
|
|
27
|
+
Loading,
|
|
28
|
+
//
|
|
29
|
+
Root as Command,
|
|
30
|
+
Dialog as CommandDialog,
|
|
31
|
+
Empty as CommandEmpty,
|
|
32
|
+
Group as CommandGroup,
|
|
33
|
+
Item as CommandItem,
|
|
34
|
+
LinkItem as CommandLinkItem,
|
|
35
|
+
Input as CommandInput,
|
|
36
|
+
List as CommandList,
|
|
37
|
+
Separator as CommandSeparator,
|
|
38
|
+
Shortcut as CommandShortcut,
|
|
39
|
+
Loading as CommandLoading,
|
|
40
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog as DialogPrimitive, type WithoutChildrenOrChild } from "bits-ui";
|
|
3
|
+
import X from "@lucide/svelte/icons/x";
|
|
4
|
+
import type { Snippet } from "svelte";
|
|
5
|
+
import * as Dialog from "./index.js";
|
|
6
|
+
import { cn } from "$lib/utils.js";
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
ref = $bindable(null),
|
|
10
|
+
class: className,
|
|
11
|
+
portalProps,
|
|
12
|
+
children,
|
|
13
|
+
...restProps
|
|
14
|
+
}: WithoutChildrenOrChild<DialogPrimitive.ContentProps> & {
|
|
15
|
+
portalProps?: DialogPrimitive.PortalProps;
|
|
16
|
+
children: Snippet;
|
|
17
|
+
} = $props();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<Dialog.Portal {...portalProps}>
|
|
21
|
+
<Dialog.Overlay />
|
|
22
|
+
<DialogPrimitive.Content
|
|
23
|
+
bind:ref
|
|
24
|
+
class={cn(
|
|
25
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...restProps}
|
|
29
|
+
>
|
|
30
|
+
{@render children?.()}
|
|
31
|
+
<DialogPrimitive.Close
|
|
32
|
+
class="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none"
|
|
33
|
+
>
|
|
34
|
+
<X class="size-4" />
|
|
35
|
+
<span class="sr-only">Close</span>
|
|
36
|
+
</DialogPrimitive.Close>
|
|
37
|
+
</DialogPrimitive.Content>
|
|
38
|
+
</Dialog.Portal>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog as DialogPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: DialogPrimitive.DescriptionProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<DialogPrimitive.Description
|
|
13
|
+
bind:ref
|
|
14
|
+
class={cn("text-muted-foreground text-sm", className)}
|
|
15
|
+
{...restProps}
|
|
16
|
+
/>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { WithElementRef } from "bits-ui";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import { cn } from "$lib/utils.js";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div
|
|
15
|
+
bind:this={ref}
|
|
16
|
+
class={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</div>
|