@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,144 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export interface SideBarElement {
|
|
3
|
+
name: string;
|
|
4
|
+
onclick?: () => Promise<void> | void;
|
|
5
|
+
href?: string;
|
|
6
|
+
icon?: any;
|
|
7
|
+
path?: string;
|
|
8
|
+
meta?: Record<string, any>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type SideBarData = Array<SideBarElement>;
|
|
12
|
+
|
|
13
|
+
export interface SidebarElementsProps {
|
|
14
|
+
data: SideBarData;
|
|
15
|
+
path?: string[];
|
|
16
|
+
elementRightSide?: Snippet<[SideBarElement]>;
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import { Ban } from "lucide-svelte";
|
|
22
|
+
import type { Snippet } from "svelte";
|
|
23
|
+
import SidebarElements from "./sidebarElements.svelte";
|
|
24
|
+
import Button from "../ui/button/button.svelte";
|
|
25
|
+
import { location } from "@wjfe/n-savant";
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
data = $bindable(),
|
|
29
|
+
path = [],
|
|
30
|
+
elementRightSide,
|
|
31
|
+
}: SidebarElementsProps = $props();
|
|
32
|
+
|
|
33
|
+
const elementsToShow = data.reduce<Array<string | SideBarElement>>(
|
|
34
|
+
(acc, item, index) => {
|
|
35
|
+
const firstPath = item.path?.split("/")[0];
|
|
36
|
+
if (firstPath && item.path && !acc.includes(firstPath)) {
|
|
37
|
+
acc.push(firstPath);
|
|
38
|
+
} else if (!item.path) {
|
|
39
|
+
acc.push(item);
|
|
40
|
+
}
|
|
41
|
+
return acc;
|
|
42
|
+
},
|
|
43
|
+
[],
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
let expandedHeights: number[] = $state(Array(data?.length).fill(0));
|
|
47
|
+
|
|
48
|
+
async function handleElementClick(element: SideBarElement) {
|
|
49
|
+
if (element.onclick) {
|
|
50
|
+
await element.onclick();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function getDirElements(dirName: string) {
|
|
55
|
+
let elements = data.filter((item) => item.path?.startsWith(dirName));
|
|
56
|
+
elements = elements.map((item) => {
|
|
57
|
+
return {
|
|
58
|
+
...item,
|
|
59
|
+
path: item.path?.split("/").slice(1).join("/"),
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
return elements;
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<div class="flex flex-col">
|
|
67
|
+
{#if elementsToShow.length}
|
|
68
|
+
{#each elementsToShow as element, index}
|
|
69
|
+
{#if typeof element === "string"}
|
|
70
|
+
{@const directoryName = element.split("/")[0]}
|
|
71
|
+
<button
|
|
72
|
+
class="
|
|
73
|
+
flex items-center justify-between p-2 gap-2 text-muted-foreground
|
|
74
|
+
rounded-md cursor-default
|
|
75
|
+
"
|
|
76
|
+
>
|
|
77
|
+
<div class="flex items-center gap-2">
|
|
78
|
+
<div class="text-xs">
|
|
79
|
+
{directoryName}
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</button>
|
|
83
|
+
{#if getDirElements(directoryName)}
|
|
84
|
+
<div
|
|
85
|
+
class="overflow-hidden"
|
|
86
|
+
style="
|
|
87
|
+
height: {true ? expandedHeights[index] : 0}px;
|
|
88
|
+
"
|
|
89
|
+
>
|
|
90
|
+
<div
|
|
91
|
+
bind:clientHeight={expandedHeights[index]}
|
|
92
|
+
class="border-l ml-4 pl-2"
|
|
93
|
+
>
|
|
94
|
+
<SidebarElements
|
|
95
|
+
data={getDirElements(element)}
|
|
96
|
+
path={[...path, element]}
|
|
97
|
+
{elementRightSide}
|
|
98
|
+
/>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
{/if}
|
|
102
|
+
{:else}
|
|
103
|
+
{@const elementPath = [...path, element]}
|
|
104
|
+
{@const isselected = location.url.pathname === element.href}
|
|
105
|
+
<Button
|
|
106
|
+
onclick={() => handleElementClick(element)}
|
|
107
|
+
href={element.href}
|
|
108
|
+
variant="ghost"
|
|
109
|
+
class="
|
|
110
|
+
flex items-center justify-between p-2 gap-2 hover:bg-soft text-muted-foreground
|
|
111
|
+
rounded-md {isselected ? 'bg-muted' : ''}
|
|
112
|
+
"
|
|
113
|
+
title={element.name}
|
|
114
|
+
>
|
|
115
|
+
<div class="flex items-center gap-2 truncate">
|
|
116
|
+
{#if element.icon}
|
|
117
|
+
<element.icon size="17.5" />
|
|
118
|
+
{/if}
|
|
119
|
+
<div
|
|
120
|
+
class="
|
|
121
|
+
text-xs
|
|
122
|
+
{isselected ? 'text-primary font-medium' : ''}
|
|
123
|
+
"
|
|
124
|
+
>
|
|
125
|
+
{element.name}
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
<div class="flex gap-2 items-center">
|
|
129
|
+
{#if elementRightSide}
|
|
130
|
+
{@render elementRightSide(element)}
|
|
131
|
+
{/if}
|
|
132
|
+
</div>
|
|
133
|
+
</Button>
|
|
134
|
+
{/if}
|
|
135
|
+
{/each}
|
|
136
|
+
{:else}
|
|
137
|
+
<div
|
|
138
|
+
class="flex justify-center items-center gap-2 text-muted-foreground"
|
|
139
|
+
>
|
|
140
|
+
<Ban size="17.5" />
|
|
141
|
+
<div class="text-xs text-center">No result</div>
|
|
142
|
+
</div>
|
|
143
|
+
{/if}
|
|
144
|
+
</div>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SidebarProperties } from "./sidebar.svelte";
|
|
3
|
+
import { PanelLeftClose, PanelLeftOpen } from "lucide-svelte";
|
|
4
|
+
import { getContext } from "svelte";
|
|
5
|
+
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
class?: HTMLButtonAttributes["class"];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { class: className }: Props = $props();
|
|
12
|
+
|
|
13
|
+
const sidebarProperties: SidebarProperties =
|
|
14
|
+
getContext("sidebarProperties");
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
{#if sidebarProperties.collapsed}
|
|
18
|
+
<PanelLeftOpen
|
|
19
|
+
class="text-muted-foreground hover:bg-transparent cursor-pointer hover:text-foreground {className}"
|
|
20
|
+
size="18"
|
|
21
|
+
onclick={() => {
|
|
22
|
+
sidebarProperties.collapsed = !sidebarProperties.collapsed;
|
|
23
|
+
}}
|
|
24
|
+
/>
|
|
25
|
+
{:else}
|
|
26
|
+
<PanelLeftClose
|
|
27
|
+
class="text-muted-foreground hover:bg-transparent cursor-pointer hover:text-foreground {className}"
|
|
28
|
+
size="18"
|
|
29
|
+
onclick={() => {
|
|
30
|
+
sidebarProperties.collapsed = !sidebarProperties.collapsed;
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
{/if}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Save } from "lucide-svelte";
|
|
3
|
+
import DetailViewForm from "./detailView/detailViewForm.svelte";
|
|
4
|
+
import { getCollectionFields } from "./detailView/utils";
|
|
5
|
+
import SidebarTrigger from "./sidebar/sidebarTrigger.svelte";
|
|
6
|
+
import Button from "./ui/button/button.svelte";
|
|
7
|
+
import { onMount } from "svelte";
|
|
8
|
+
import { lobb } from "$lib";
|
|
9
|
+
import { toast } from "svelte-sonner";
|
|
10
|
+
import Skeleton from "./ui/skeleton/skeleton.svelte";
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
collectionName: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
collectionName,
|
|
18
|
+
}: Props = $props();
|
|
19
|
+
|
|
20
|
+
let entry = $state({});
|
|
21
|
+
let loading = $state(true);
|
|
22
|
+
let singletonExists = $state(true);
|
|
23
|
+
const formFields = getCollectionFields(collectionName);
|
|
24
|
+
|
|
25
|
+
onMount(async () => {
|
|
26
|
+
const result = await lobb.readSingleton(collectionName);
|
|
27
|
+
const json = await result.json();
|
|
28
|
+
if (result.status === 404) {
|
|
29
|
+
singletonExists = false;
|
|
30
|
+
} else {
|
|
31
|
+
entry = json.data;
|
|
32
|
+
}
|
|
33
|
+
loading = false;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
async function handleSave() {
|
|
37
|
+
const response = await lobb.updateSingleton(collectionName, entry);
|
|
38
|
+
if (response.status < 400) {
|
|
39
|
+
toast.success("The Singleton was updated successfully");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<div>
|
|
45
|
+
<div class="flex justify-between items-center gap-2 p-2 border-b bg-background h-10">
|
|
46
|
+
<div class="flex items-center gap-1">
|
|
47
|
+
<SidebarTrigger />
|
|
48
|
+
</div>
|
|
49
|
+
<div>
|
|
50
|
+
<Button
|
|
51
|
+
class="h-7 px-2 font-normal text-xs"
|
|
52
|
+
Icon={Save}
|
|
53
|
+
onclick={handleSave}
|
|
54
|
+
>
|
|
55
|
+
Save
|
|
56
|
+
</Button>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
{#if loading}
|
|
61
|
+
<div class="flex flex-col gap-2 p-2 w-full">
|
|
62
|
+
<Skeleton class="h-8 w-full" />
|
|
63
|
+
<Skeleton class="h-8 w-[80%]" />
|
|
64
|
+
<Skeleton class="h-8 w-[60%]" />
|
|
65
|
+
</div>
|
|
66
|
+
{:else}
|
|
67
|
+
<DetailViewForm bind:value={entry} fields={formFields} />
|
|
68
|
+
{/if}
|
|
69
|
+
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Accordion as AccordionPrimitive, type WithoutChild } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithoutChild<AccordionPrimitive.ContentProps> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<AccordionPrimitive.Content
|
|
14
|
+
bind:ref
|
|
15
|
+
class={cn(
|
|
16
|
+
"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...restProps}
|
|
20
|
+
>
|
|
21
|
+
{@render children?.()}
|
|
22
|
+
</AccordionPrimitive.Content>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Accordion as AccordionPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: AccordionPrimitive.ItemProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<AccordionPrimitive.Item bind:ref class={cn("border-b", className)} {...restProps} />
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Accordion as AccordionPrimitive, type WithoutChild } from "bits-ui";
|
|
3
|
+
import ChevronDown from "@lucide/svelte/icons/chevron-down";
|
|
4
|
+
import { cn } from "$lib/utils.js";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
level = 3,
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithoutChild<AccordionPrimitive.TriggerProps> & {
|
|
13
|
+
level?: AccordionPrimitive.HeaderProps["level"];
|
|
14
|
+
} = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<AccordionPrimitive.Header {level} class="flex">
|
|
18
|
+
<AccordionPrimitive.Trigger
|
|
19
|
+
bind:ref
|
|
20
|
+
class={cn(
|
|
21
|
+
"flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...restProps}
|
|
25
|
+
>
|
|
26
|
+
{@render children?.()}
|
|
27
|
+
<ChevronDown
|
|
28
|
+
class="text-muted-foreground size-4 shrink-0 transition-transform duration-200"
|
|
29
|
+
/>
|
|
30
|
+
</AccordionPrimitive.Trigger>
|
|
31
|
+
</AccordionPrimitive.Header>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Accordion as AccordionPrimitive } from "bits-ui";
|
|
2
|
+
import Content from "./accordion-content.svelte";
|
|
3
|
+
import Item from "./accordion-item.svelte";
|
|
4
|
+
import Trigger from "./accordion-trigger.svelte";
|
|
5
|
+
|
|
6
|
+
const Root = AccordionPrimitive.Root;
|
|
7
|
+
export {
|
|
8
|
+
Root,
|
|
9
|
+
Content,
|
|
10
|
+
Item,
|
|
11
|
+
Trigger,
|
|
12
|
+
//
|
|
13
|
+
Root as Accordion,
|
|
14
|
+
Content as AccordionContent,
|
|
15
|
+
Item as AccordionItem,
|
|
16
|
+
Trigger as AccordionTrigger,
|
|
17
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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 bind:this={ref} class={cn("text-sm [&_p]:leading-relaxed", className)} {...restProps}>
|
|
15
|
+
{@render children?.()}
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import type { WithElementRef } from "bits-ui";
|
|
4
|
+
import { cn } from "$lib/utils.js";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
level = 5,
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
13
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
14
|
+
} = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div
|
|
18
|
+
bind:this={ref}
|
|
19
|
+
aria-level={level}
|
|
20
|
+
class={cn("mb-1 font-medium leading-none tracking-tight", className)}
|
|
21
|
+
{...restProps}
|
|
22
|
+
>
|
|
23
|
+
{@render children?.()}
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { type VariantProps, tv } from "tailwind-variants";
|
|
3
|
+
|
|
4
|
+
export const alertVariants = tv({
|
|
5
|
+
base: "[&>svg]:text-foreground relative w-full rounded-lg border px-4 py-3 text-sm [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg~*]:pl-7",
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "bg-background text-foreground",
|
|
9
|
+
destructive:
|
|
10
|
+
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
variant: "default",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export type AlertVariant = VariantProps<typeof alertVariants>["variant"];
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
23
|
+
import type { WithElementRef } from "bits-ui";
|
|
24
|
+
import { cn } from "$lib/utils.js";
|
|
25
|
+
|
|
26
|
+
let {
|
|
27
|
+
ref = $bindable(null),
|
|
28
|
+
class: className,
|
|
29
|
+
variant = "default",
|
|
30
|
+
children,
|
|
31
|
+
...restProps
|
|
32
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
33
|
+
variant?: AlertVariant;
|
|
34
|
+
} = $props();
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<div bind:this={ref} class={cn(alertVariants({ variant }), className)} {...restProps} role="alert">
|
|
38
|
+
{@render children?.()}
|
|
39
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Root from "./alert.svelte";
|
|
2
|
+
import Description from "./alert-description.svelte";
|
|
3
|
+
import Title from "./alert-title.svelte";
|
|
4
|
+
export { alertVariants, type AlertVariant } from "./alert.svelte";
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
Root,
|
|
8
|
+
Description,
|
|
9
|
+
Title,
|
|
10
|
+
//
|
|
11
|
+
Root as Alert,
|
|
12
|
+
Description as AlertDescription,
|
|
13
|
+
Title as AlertTitle,
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
|
|
3
|
+
import { buttonVariants } from "$lib/components/ui/button/index.js";
|
|
4
|
+
import { cn } from "$lib/utils.js";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
class: className,
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
...restProps
|
|
10
|
+
}: AlertDialogPrimitive.ActionProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<AlertDialogPrimitive.Action bind:ref class={cn(buttonVariants(), className)} {...restProps} />
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
|
|
3
|
+
import { buttonVariants } from "$lib/components/ui/button/index.js";
|
|
4
|
+
import { cn } from "$lib/utils.js";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
class: className,
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
...restProps
|
|
10
|
+
}: AlertDialogPrimitive.CancelProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<AlertDialogPrimitive.Cancel
|
|
14
|
+
bind:ref
|
|
15
|
+
class={cn(buttonVariants({ variant: "outline" }), "mt-2 sm:mt-0", className)}
|
|
16
|
+
{...restProps}
|
|
17
|
+
/>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { AlertDialog as AlertDialogPrimitive, type WithoutChild } from "bits-ui";
|
|
3
|
+
import AlertDialogOverlay from "./alert-dialog-overlay.svelte";
|
|
4
|
+
import { cn } from "$lib/utils.js";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
portalProps,
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithoutChild<AlertDialogPrimitive.ContentProps> & {
|
|
12
|
+
portalProps?: AlertDialogPrimitive.PortalProps;
|
|
13
|
+
} = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<AlertDialogPrimitive.Portal {...portalProps}>
|
|
17
|
+
<AlertDialogOverlay />
|
|
18
|
+
<AlertDialogPrimitive.Content
|
|
19
|
+
bind:ref
|
|
20
|
+
class={cn(
|
|
21
|
+
"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",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...restProps}
|
|
25
|
+
/>
|
|
26
|
+
</AlertDialogPrimitive.Portal>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
class: className,
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
...restProps
|
|
9
|
+
}: AlertDialogPrimitive.DescriptionProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<AlertDialogPrimitive.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>
|
|
@@ -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 space-y-2 text-center sm:text-left", className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
class: className,
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
...restProps
|
|
9
|
+
}: AlertDialogPrimitive.OverlayProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<AlertDialogPrimitive.Overlay
|
|
13
|
+
bind:ref
|
|
14
|
+
class={cn(
|
|
15
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
/>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
|
|
3
|
+
import { cn } from "$lib/utils.js";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
class: className,
|
|
7
|
+
level = 3,
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
...restProps
|
|
10
|
+
}: AlertDialogPrimitive.TitleProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<AlertDialogPrimitive.Title
|
|
14
|
+
bind:ref
|
|
15
|
+
class={cn("text-lg font-semibold", className)}
|
|
16
|
+
{level}
|
|
17
|
+
{...restProps}
|
|
18
|
+
/>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
|
|
2
|
+
|
|
3
|
+
import Title from "./alert-dialog-title.svelte";
|
|
4
|
+
import Action from "./alert-dialog-action.svelte";
|
|
5
|
+
import Cancel from "./alert-dialog-cancel.svelte";
|
|
6
|
+
import Footer from "./alert-dialog-footer.svelte";
|
|
7
|
+
import Header from "./alert-dialog-header.svelte";
|
|
8
|
+
import Overlay from "./alert-dialog-overlay.svelte";
|
|
9
|
+
import Content from "./alert-dialog-content.svelte";
|
|
10
|
+
import Description from "./alert-dialog-description.svelte";
|
|
11
|
+
|
|
12
|
+
const Root = AlertDialogPrimitive.Root;
|
|
13
|
+
const Trigger = AlertDialogPrimitive.Trigger;
|
|
14
|
+
const Portal = AlertDialogPrimitive.Portal;
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
Root,
|
|
18
|
+
Title,
|
|
19
|
+
Action,
|
|
20
|
+
Cancel,
|
|
21
|
+
Portal,
|
|
22
|
+
Footer,
|
|
23
|
+
Header,
|
|
24
|
+
Trigger,
|
|
25
|
+
Overlay,
|
|
26
|
+
Content,
|
|
27
|
+
Description,
|
|
28
|
+
//
|
|
29
|
+
Root as AlertDialog,
|
|
30
|
+
Title as AlertDialogTitle,
|
|
31
|
+
Action as AlertDialogAction,
|
|
32
|
+
Cancel as AlertDialogCancel,
|
|
33
|
+
Portal as AlertDialogPortal,
|
|
34
|
+
Footer as AlertDialogFooter,
|
|
35
|
+
Header as AlertDialogHeader,
|
|
36
|
+
Trigger as AlertDialogTrigger,
|
|
37
|
+
Overlay as AlertDialogOverlay,
|
|
38
|
+
Content as AlertDialogContent,
|
|
39
|
+
Description as AlertDialogDescription,
|
|
40
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Ellipsis from "@lucide/svelte/icons/ellipsis";
|
|
3
|
+
import type { WithElementRef, WithoutChildren } from "bits-ui";
|
|
4
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
5
|
+
import { cn } from "$lib/utils.js";
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithoutChildren<WithElementRef<HTMLAttributes<HTMLSpanElement>>> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<span
|
|
15
|
+
bind:this={ref}
|
|
16
|
+
role="presentation"
|
|
17
|
+
aria-hidden="true"
|
|
18
|
+
class={cn("flex size-9 items-center justify-center", className)}
|
|
19
|
+
{...restProps}
|
|
20
|
+
>
|
|
21
|
+
<Ellipsis class="size-4" />
|
|
22
|
+
<span class="sr-only">More</span>
|
|
23
|
+
</span>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { WithElementRef } from "bits-ui";
|
|
3
|
+
import type { HTMLLiAttributes } 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<HTMLLiAttributes> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<li bind:this={ref} class={cn("inline-flex items-center gap-1.5", className)} {...restProps}>
|
|
15
|
+
{@render children?.()}
|
|
16
|
+
</li>
|