dr-widget 0.1.3__py3-none-any.whl

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.
Files changed (127) hide show
  1. dr_widget/__init__.py +5 -0
  2. dr_widget/py.typed +0 -0
  3. dr_widget/widgets/__init__.py +5 -0
  4. dr_widget/widgets/config_file_manager/.gitignore +24 -0
  5. dr_widget/widgets/config_file_manager/.vscode/extensions.json +3 -0
  6. dr_widget/widgets/config_file_manager/README.md +89 -0
  7. dr_widget/widgets/config_file_manager/__init__.py +283 -0
  8. dr_widget/widgets/config_file_manager/components.json +16 -0
  9. dr_widget/widgets/config_file_manager/index.html +12 -0
  10. dr_widget/widgets/config_file_manager/jsrepo.json +18 -0
  11. dr_widget/widgets/config_file_manager/package.json +49 -0
  12. dr_widget/widgets/config_file_manager/postcss.config.js +6 -0
  13. dr_widget/widgets/config_file_manager/public/fonts/Inter-roman.var.woff2 +0 -0
  14. dr_widget/widgets/config_file_manager/public/vite.svg +1 -0
  15. dr_widget/widgets/config_file_manager/src/App.svelte +62 -0
  16. dr_widget/widgets/config_file_manager/src/ConfigFileManager.svelte +605 -0
  17. dr_widget/widgets/config_file_manager/src/app.css +134 -0
  18. dr_widget/widgets/config_file_manager/src/index.js +5 -0
  19. dr_widget/widgets/config_file_manager/src/lib/@test_state.json +20 -0
  20. dr_widget/widgets/config_file_manager/src/lib/Counter.svelte +10 -0
  21. dr_widget/widgets/config_file_manager/src/lib/components/file-drop/BrowseConfigsPanel.svelte +137 -0
  22. dr_widget/widgets/config_file_manager/src/lib/components/file-drop/ComplexJsonViewer.svelte +94 -0
  23. dr_widget/widgets/config_file_manager/src/lib/components/file-drop/ConfigViewerPanel.svelte +282 -0
  24. dr_widget/widgets/config_file_manager/src/lib/components/file-drop/LoadedConfigPreview.svelte +74 -0
  25. dr_widget/widgets/config_file_manager/src/lib/components/file-drop/SaveConfigPanel.svelte +449 -0
  26. dr_widget/widgets/config_file_manager/src/lib/components/file-drop/SelectedFileRow.svelte +38 -0
  27. dr_widget/widgets/config_file_manager/src/lib/components/file-drop/SelectedFilesList.svelte +30 -0
  28. dr_widget/widgets/config_file_manager/src/lib/components/file-drop/SimpleJsonViewer.svelte +405 -0
  29. dr_widget/widgets/config_file_manager/src/lib/components/ui/badge/badge.svelte +50 -0
  30. dr_widget/widgets/config_file_manager/src/lib/components/ui/badge/index.ts +2 -0
  31. dr_widget/widgets/config_file_manager/src/lib/components/ui/button/button.svelte +128 -0
  32. dr_widget/widgets/config_file_manager/src/lib/components/ui/button/index.ts +27 -0
  33. dr_widget/widgets/config_file_manager/src/lib/components/ui/card/card-action.svelte +20 -0
  34. dr_widget/widgets/config_file_manager/src/lib/components/ui/card/card-content.svelte +15 -0
  35. dr_widget/widgets/config_file_manager/src/lib/components/ui/card/card-description.svelte +20 -0
  36. dr_widget/widgets/config_file_manager/src/lib/components/ui/card/card-footer.svelte +20 -0
  37. dr_widget/widgets/config_file_manager/src/lib/components/ui/card/card-header.svelte +23 -0
  38. dr_widget/widgets/config_file_manager/src/lib/components/ui/card/card-title.svelte +20 -0
  39. dr_widget/widgets/config_file_manager/src/lib/components/ui/card/card.svelte +23 -0
  40. dr_widget/widgets/config_file_manager/src/lib/components/ui/card/index.ts +25 -0
  41. dr_widget/widgets/config_file_manager/src/lib/components/ui/dialog/dialog-close.svelte +11 -0
  42. dr_widget/widgets/config_file_manager/src/lib/components/ui/dialog/dialog-content.svelte +47 -0
  43. dr_widget/widgets/config_file_manager/src/lib/components/ui/dialog/dialog-description.svelte +21 -0
  44. dr_widget/widgets/config_file_manager/src/lib/components/ui/dialog/dialog-footer.svelte +24 -0
  45. dr_widget/widgets/config_file_manager/src/lib/components/ui/dialog/dialog-header.svelte +24 -0
  46. dr_widget/widgets/config_file_manager/src/lib/components/ui/dialog/dialog-overlay.svelte +24 -0
  47. dr_widget/widgets/config_file_manager/src/lib/components/ui/dialog/dialog-title.svelte +21 -0
  48. dr_widget/widgets/config_file_manager/src/lib/components/ui/dialog/dialog-trigger.svelte +11 -0
  49. dr_widget/widgets/config_file_manager/src/lib/components/ui/dialog/index.ts +41 -0
  50. dr_widget/widgets/config_file_manager/src/lib/components/ui/drawer/drawer-close.svelte +11 -0
  51. dr_widget/widgets/config_file_manager/src/lib/components/ui/drawer/drawer-content.svelte +41 -0
  52. dr_widget/widgets/config_file_manager/src/lib/components/ui/drawer/drawer-description.svelte +21 -0
  53. dr_widget/widgets/config_file_manager/src/lib/components/ui/drawer/drawer-footer.svelte +24 -0
  54. dr_widget/widgets/config_file_manager/src/lib/components/ui/drawer/drawer-header.svelte +24 -0
  55. dr_widget/widgets/config_file_manager/src/lib/components/ui/drawer/drawer-nested.svelte +16 -0
  56. dr_widget/widgets/config_file_manager/src/lib/components/ui/drawer/drawer-overlay.svelte +24 -0
  57. dr_widget/widgets/config_file_manager/src/lib/components/ui/drawer/drawer-title.svelte +21 -0
  58. dr_widget/widgets/config_file_manager/src/lib/components/ui/drawer/drawer-trigger.svelte +11 -0
  59. dr_widget/widgets/config_file_manager/src/lib/components/ui/drawer/drawer.svelte +16 -0
  60. dr_widget/widgets/config_file_manager/src/lib/components/ui/drawer/index.ts +45 -0
  61. dr_widget/widgets/config_file_manager/src/lib/components/ui/empty/empty-content.svelte +23 -0
  62. dr_widget/widgets/config_file_manager/src/lib/components/ui/empty/empty-description.svelte +23 -0
  63. dr_widget/widgets/config_file_manager/src/lib/components/ui/empty/empty-header.svelte +20 -0
  64. dr_widget/widgets/config_file_manager/src/lib/components/ui/empty/empty-media.svelte +41 -0
  65. dr_widget/widgets/config_file_manager/src/lib/components/ui/empty/empty-title.svelte +20 -0
  66. dr_widget/widgets/config_file_manager/src/lib/components/ui/empty/empty.svelte +23 -0
  67. dr_widget/widgets/config_file_manager/src/lib/components/ui/empty/index.ts +22 -0
  68. dr_widget/widgets/config_file_manager/src/lib/components/ui/field/field-content.svelte +20 -0
  69. dr_widget/widgets/config_file_manager/src/lib/components/ui/field/field-description.svelte +25 -0
  70. dr_widget/widgets/config_file_manager/src/lib/components/ui/field/field-error.svelte +58 -0
  71. dr_widget/widgets/config_file_manager/src/lib/components/ui/field/field-group.svelte +23 -0
  72. dr_widget/widgets/config_file_manager/src/lib/components/ui/field/field-label.svelte +26 -0
  73. dr_widget/widgets/config_file_manager/src/lib/components/ui/field/field-legend.svelte +29 -0
  74. dr_widget/widgets/config_file_manager/src/lib/components/ui/field/field-separator.svelte +38 -0
  75. dr_widget/widgets/config_file_manager/src/lib/components/ui/field/field-set.svelte +24 -0
  76. dr_widget/widgets/config_file_manager/src/lib/components/ui/field/field-title.svelte +23 -0
  77. dr_widget/widgets/config_file_manager/src/lib/components/ui/field/field.svelte +53 -0
  78. dr_widget/widgets/config_file_manager/src/lib/components/ui/field/index.ts +33 -0
  79. dr_widget/widgets/config_file_manager/src/lib/components/ui/file-drop-zone/file-drop-zone.svelte +178 -0
  80. dr_widget/widgets/config_file_manager/src/lib/components/ui/file-drop-zone/index.ts +29 -0
  81. dr_widget/widgets/config_file_manager/src/lib/components/ui/file-drop-zone/types.ts +51 -0
  82. dr_widget/widgets/config_file_manager/src/lib/components/ui/item/index.ts +34 -0
  83. dr_widget/widgets/config_file_manager/src/lib/components/ui/item/item-actions.svelte +20 -0
  84. dr_widget/widgets/config_file_manager/src/lib/components/ui/item/item-content.svelte +20 -0
  85. dr_widget/widgets/config_file_manager/src/lib/components/ui/item/item-description.svelte +24 -0
  86. dr_widget/widgets/config_file_manager/src/lib/components/ui/item/item-footer.svelte +20 -0
  87. dr_widget/widgets/config_file_manager/src/lib/components/ui/item/item-group.svelte +21 -0
  88. dr_widget/widgets/config_file_manager/src/lib/components/ui/item/item-header.svelte +20 -0
  89. dr_widget/widgets/config_file_manager/src/lib/components/ui/item/item-media.svelte +42 -0
  90. dr_widget/widgets/config_file_manager/src/lib/components/ui/item/item-separator.svelte +19 -0
  91. dr_widget/widgets/config_file_manager/src/lib/components/ui/item/item-title.svelte +20 -0
  92. dr_widget/widgets/config_file_manager/src/lib/components/ui/item/item.svelte +60 -0
  93. dr_widget/widgets/config_file_manager/src/lib/components/ui/label/index.ts +7 -0
  94. dr_widget/widgets/config_file_manager/src/lib/components/ui/label/label.svelte +20 -0
  95. dr_widget/widgets/config_file_manager/src/lib/components/ui/modal/index.ts +13 -0
  96. dr_widget/widgets/config_file_manager/src/lib/components/ui/modal/modal-content.svelte +29 -0
  97. dr_widget/widgets/config_file_manager/src/lib/components/ui/modal/modal-description.svelte +20 -0
  98. dr_widget/widgets/config_file_manager/src/lib/components/ui/modal/modal-footer.svelte +29 -0
  99. dr_widget/widgets/config_file_manager/src/lib/components/ui/modal/modal-header.svelte +29 -0
  100. dr_widget/widgets/config_file_manager/src/lib/components/ui/modal/modal-title.svelte +20 -0
  101. dr_widget/widgets/config_file_manager/src/lib/components/ui/modal/modal-trigger.svelte +24 -0
  102. dr_widget/widgets/config_file_manager/src/lib/components/ui/modal/modal.svelte +24 -0
  103. dr_widget/widgets/config_file_manager/src/lib/components/ui/modal/modal.svelte.ts +32 -0
  104. dr_widget/widgets/config_file_manager/src/lib/components/ui/separator/index.ts +7 -0
  105. dr_widget/widgets/config_file_manager/src/lib/components/ui/separator/separator.svelte +21 -0
  106. dr_widget/widgets/config_file_manager/src/lib/components/ui/tabs/index.ts +16 -0
  107. dr_widget/widgets/config_file_manager/src/lib/components/ui/tabs/tabs-content.svelte +17 -0
  108. dr_widget/widgets/config_file_manager/src/lib/components/ui/tabs/tabs-list.svelte +20 -0
  109. dr_widget/widgets/config_file_manager/src/lib/components/ui/tabs/tabs-trigger.svelte +20 -0
  110. dr_widget/widgets/config_file_manager/src/lib/components/ui/tabs/tabs.svelte +19 -0
  111. dr_widget/widgets/config_file_manager/src/lib/hooks/use-file-bindings.ts +189 -0
  112. dr_widget/widgets/config_file_manager/src/lib/react/JsonTreeCanvas.tsx +207 -0
  113. dr_widget/widgets/config_file_manager/src/lib/utils/config-format.ts +113 -0
  114. dr_widget/widgets/config_file_manager/src/lib/utils/utils.ts +21 -0
  115. dr_widget/widgets/config_file_manager/src/lib/utils.ts +17 -0
  116. dr_widget/widgets/config_file_manager/src/main.js +7 -0
  117. dr_widget/widgets/config_file_manager/static/fonts/Inter-roman.var.woff2 +0 -0
  118. dr_widget/widgets/config_file_manager/static/index.js +9719 -0
  119. dr_widget/widgets/config_file_manager/static/style.css +1 -0
  120. dr_widget/widgets/config_file_manager/static/vite.svg +1 -0
  121. dr_widget/widgets/config_file_manager/svelte.config.js +8 -0
  122. dr_widget/widgets/config_file_manager/tailwind.config.js +12 -0
  123. dr_widget/widgets/config_file_manager/tsconfig.json +28 -0
  124. dr_widget/widgets/config_file_manager/vite.config.js +36 -0
  125. dr_widget-0.1.3.dist-info/METADATA +62 -0
  126. dr_widget-0.1.3.dist-info/RECORD +127 -0
  127. dr_widget-0.1.3.dist-info/WHEEL +4 -0
@@ -0,0 +1,51 @@
1
+ /*
2
+ Installed from @ieedan/shadcn-svelte-extras
3
+ */
4
+
5
+ import type { WithChildren } from "bits-ui";
6
+ import type { HTMLInputAttributes } from "svelte/elements";
7
+
8
+ export type FileRejectedReason =
9
+ | "Maximum file size exceeded"
10
+ | "File type not allowed"
11
+ | "Maximum files uploaded";
12
+
13
+ export type FileDropZonePropsWithoutHTML = WithChildren<{
14
+ ref?: HTMLInputElement | null;
15
+ /** Called with the uploaded files when the user drops or clicks and selects their files.
16
+ *
17
+ * @param files
18
+ */
19
+ onUpload: (files: File[]) => Promise<void>;
20
+ /** The maximum amount files allowed to be uploaded */
21
+ maxFiles?: number;
22
+ fileCount?: number;
23
+ /** The maximum size of a file in bytes */
24
+ maxFileSize?: number;
25
+ /** Called when a file does not meet the upload criteria (size, or type) */
26
+ onFileRejected?: (opts: { reason: FileRejectedReason; file: File }) => void;
27
+
28
+ // just for extra documentation
29
+ /** Takes a comma separated list of one or more file types.
30
+ *
31
+ * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept)
32
+ *
33
+ * ### Usage
34
+ * ```svelte
35
+ * <FileDropZone
36
+ * accept=".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
37
+ * />
38
+ * ```
39
+ *
40
+ * ### Common Values
41
+ * ```svelte
42
+ * <FileDropZone accept="audio/*"/>
43
+ * <FileDropZone accept="image/*"/>
44
+ * <FileDropZone accept="video/*"/>
45
+ * ```
46
+ */
47
+ accept?: string;
48
+ }>;
49
+
50
+ export type FileDropZoneProps = FileDropZonePropsWithoutHTML &
51
+ Omit<HTMLInputAttributes, "multiple" | "files">;
@@ -0,0 +1,34 @@
1
+ import Root from "./item.svelte";
2
+ import Group from "./item-group.svelte";
3
+ import Separator from "./item-separator.svelte";
4
+ import Header from "./item-header.svelte";
5
+ import Footer from "./item-footer.svelte";
6
+ import Content from "./item-content.svelte";
7
+ import Title from "./item-title.svelte";
8
+ import Description from "./item-description.svelte";
9
+ import Actions from "./item-actions.svelte";
10
+ import Media from "./item-media.svelte";
11
+
12
+ export {
13
+ Root,
14
+ Group,
15
+ Separator,
16
+ Header,
17
+ Footer,
18
+ Content,
19
+ Title,
20
+ Description,
21
+ Actions,
22
+ Media,
23
+ //
24
+ Root as Item,
25
+ Group as ItemGroup,
26
+ Separator as ItemSeparator,
27
+ Header as ItemHeader,
28
+ Footer as ItemFooter,
29
+ Content as ItemContent,
30
+ Title as ItemTitle,
31
+ Description as ItemDescription,
32
+ Actions as ItemActions,
33
+ Media as ItemMedia,
34
+ };
@@ -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="item-actions"
16
+ class={cn("flex items-center gap-2", className)}
17
+ {...restProps}
18
+ >
19
+ {@render children?.()}
20
+ </div>
@@ -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="item-content"
16
+ class={cn("flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none", className)}
17
+ {...restProps}
18
+ >
19
+ {@render children?.()}
20
+ </div>
@@ -0,0 +1,24 @@
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<HTMLParagraphElement>> = $props();
11
+ </script>
12
+
13
+ <p
14
+ bind:this={ref}
15
+ data-slot="item-description"
16
+ class={cn(
17
+ "text-muted-foreground line-clamp-2 text-balance text-sm font-normal leading-normal",
18
+ "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
19
+ className
20
+ )}
21
+ {...restProps}
22
+ >
23
+ {@render children?.()}
24
+ </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="item-footer"
16
+ class={cn("flex basis-full items-center justify-between gap-2", className)}
17
+ {...restProps}
18
+ >
19
+ {@render children?.()}
20
+ </div>
@@ -0,0 +1,21 @@
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
+ role="list"
16
+ data-slot="item-group"
17
+ class={cn("group/item-group flex flex-col", className)}
18
+ {...restProps}
19
+ >
20
+ {@render children?.()}
21
+ </div>
@@ -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="item-header"
16
+ class={cn("flex basis-full items-center justify-between gap-2", className)}
17
+ {...restProps}
18
+ >
19
+ {@render children?.()}
20
+ </div>
@@ -0,0 +1,42 @@
1
+ <script lang="ts" module>
2
+ import { tv, type VariantProps } from "tailwind-variants";
3
+
4
+ export const itemMediaVariants = tv({
5
+ base: "flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:translate-y-0.5 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none",
6
+ variants: {
7
+ variant: {
8
+ default: "bg-transparent",
9
+ icon: "bg-muted size-8 rounded-sm border [&_svg:not([class*='size-'])]:size-4",
10
+ image: "size-10 overflow-hidden rounded-sm [&_img]:size-full [&_img]:object-cover",
11
+ },
12
+ },
13
+ defaultVariants: {
14
+ variant: "default",
15
+ },
16
+ });
17
+
18
+ export type ItemMediaVariant = VariantProps<typeof itemMediaVariants>["variant"];
19
+ </script>
20
+
21
+ <script lang="ts">
22
+ import { cn, type WithElementRef } from "$lib/utils.js";
23
+ import type { HTMLAttributes } from "svelte/elements";
24
+
25
+ let {
26
+ ref = $bindable(null),
27
+ class: className,
28
+ children,
29
+ variant = "default",
30
+ ...restProps
31
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> & { variant?: ItemMediaVariant } = $props();
32
+ </script>
33
+
34
+ <div
35
+ bind:this={ref}
36
+ data-slot="item-media"
37
+ data-variant={variant}
38
+ class={cn(itemMediaVariants({ variant }), className)}
39
+ {...restProps}
40
+ >
41
+ {@render children?.()}
42
+ </div>
@@ -0,0 +1,19 @@
1
+ <script lang="ts">
2
+ import { Separator } from "$lib/components/ui/separator/index.js";
3
+ import { cn } from "$lib/utils.js";
4
+ import type { ComponentProps } from "svelte";
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ class: className,
9
+ ...restProps
10
+ }: ComponentProps<typeof Separator> = $props();
11
+ </script>
12
+
13
+ <Separator
14
+ bind:ref
15
+ data-slot="item-separator"
16
+ orientation="horizontal"
17
+ class={cn("my-0", className)}
18
+ {...restProps}
19
+ />
@@ -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="item-title"
16
+ class={cn("flex w-fit items-center gap-2 text-sm font-medium leading-snug", className)}
17
+ {...restProps}
18
+ >
19
+ {@render children?.()}
20
+ </div>
@@ -0,0 +1,60 @@
1
+ <script lang="ts" module>
2
+ import { tv, type VariantProps } from "tailwind-variants";
3
+
4
+ export const itemVariants = tv({
5
+ base: "group/item [a]:hover:bg-accent/50 [a]:transition-colors focus-visible:border-ring focus-visible:ring-ring/50 flex flex-wrap items-center rounded-md border border-transparent text-sm outline-none transition-colors duration-100 focus-visible:ring-[3px]",
6
+ variants: {
7
+ variant: {
8
+ default: "bg-transparent",
9
+ outline: "border-border",
10
+ muted: "bg-muted/50",
11
+ },
12
+ size: {
13
+ default: "gap-4 p-4",
14
+ sm: "gap-2.5 px-4 py-3",
15
+ },
16
+ },
17
+ defaultVariants: {
18
+ variant: "default",
19
+ size: "default",
20
+ },
21
+ });
22
+
23
+ export type ItemSize = VariantProps<typeof itemVariants>["size"];
24
+ export type ItemVariant = VariantProps<typeof itemVariants>["variant"];
25
+ </script>
26
+
27
+ <script lang="ts">
28
+ import { cn, type WithElementRef } from "$lib/utils.js";
29
+ import type { HTMLAttributes } from "svelte/elements";
30
+ import type { Snippet } from "svelte";
31
+
32
+ let {
33
+ ref = $bindable(null),
34
+ class: className,
35
+ child,
36
+ variant,
37
+ size,
38
+ ...restProps
39
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
40
+ child?: Snippet<[{ props: Record<string, unknown> }]>;
41
+ variant?: ItemVariant;
42
+ size?: ItemSize;
43
+ } = $props();
44
+
45
+ const mergedProps = $derived({
46
+ class: cn(itemVariants({ variant, size }), className),
47
+ "data-slot": "item",
48
+ "data-variant": variant,
49
+ "data-size": size,
50
+ ...restProps,
51
+ });
52
+ </script>
53
+
54
+ {#if child}
55
+ {@render child({ props: mergedProps })}
56
+ {:else}
57
+ <div bind:this={ref} {...mergedProps}>
58
+ {@render mergedProps.children?.()}
59
+ </div>
60
+ {/if}
@@ -0,0 +1,7 @@
1
+ import Root from "./label.svelte";
2
+
3
+ export {
4
+ Root,
5
+ //
6
+ Root as Label,
7
+ };
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import { Label as LabelPrimitive } from "bits-ui";
3
+ import { cn } from "$lib/utils.js";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ ...restProps
9
+ }: LabelPrimitive.RootProps = $props();
10
+ </script>
11
+
12
+ <LabelPrimitive.Root
13
+ bind:ref
14
+ data-slot="label"
15
+ class={cn(
16
+ "flex select-none items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",
17
+ className
18
+ )}
19
+ {...restProps}
20
+ />
@@ -0,0 +1,13 @@
1
+ /*
2
+ Installed from @ieedan/shadcn-svelte-extras
3
+ */
4
+
5
+ import Root from "./modal.svelte";
6
+ import Trigger from "./modal-trigger.svelte";
7
+ import Content from "./modal-content.svelte";
8
+ import Footer from "./modal-footer.svelte";
9
+ import Header from "./modal-header.svelte";
10
+ import Title from "./modal-title.svelte";
11
+ import Description from "./modal-description.svelte";
12
+
13
+ export { Root, Trigger, Content, Footer, Header, Title, Description };
@@ -0,0 +1,29 @@
1
+ <!--
2
+ Installed from @ieedan/shadcn-svelte-extras
3
+ -->
4
+
5
+ <script lang="ts">
6
+ import { useModalSub } from './modal.svelte.js';
7
+ import * as Dialog from '../dialog/index.js';
8
+ import * as Drawer from '../drawer/index.js';
9
+ import type { DialogContentProps } from 'bits-ui';
10
+
11
+ const modal = useModalSub();
12
+
13
+ let {
14
+ ref = $bindable(null),
15
+ hideClose = false,
16
+ children,
17
+ ...rest
18
+ }: DialogContentProps & { hideClose?: boolean } = $props();
19
+ </script>
20
+
21
+ {#if modal.view === 'desktop'}
22
+ <Dialog.Content bind:ref {...rest} {hideClose}>
23
+ {@render children?.()}
24
+ </Dialog.Content>
25
+ {:else}
26
+ <Drawer.Content bind:ref {...rest}>
27
+ {@render children?.()}
28
+ </Drawer.Content>
29
+ {/if}
@@ -0,0 +1,20 @@
1
+ <!--
2
+ Installed from @ieedan/shadcn-svelte-extras
3
+ -->
4
+
5
+ <script lang="ts">
6
+ import { useModalSub } from './modal.svelte.js';
7
+ import * as Dialog from '../dialog/index.js';
8
+ import * as Drawer from '../drawer/index.js';
9
+ import type { DialogDescriptionProps } from 'bits-ui';
10
+
11
+ const modal = useModalSub();
12
+
13
+ let { ref = $bindable(null), ...rest }: DialogDescriptionProps = $props();
14
+ </script>
15
+
16
+ {#if modal.view === 'desktop'}
17
+ <Dialog.Description bind:ref {...rest} />
18
+ {:else}
19
+ <Drawer.Description bind:ref {...rest} />
20
+ {/if}
@@ -0,0 +1,29 @@
1
+ <!--
2
+ Installed from @ieedan/shadcn-svelte-extras
3
+ -->
4
+
5
+ <script lang="ts">
6
+ import { useModalSub } from './modal.svelte.js';
7
+ import * as Dialog from '../dialog/index.js';
8
+ import * as Drawer from '../drawer/index.js';
9
+ import type { WithElementRef } from 'bits-ui';
10
+ import type { HTMLAttributes } from 'svelte/elements';
11
+
12
+ const modal = useModalSub();
13
+
14
+ let {
15
+ ref = $bindable(null),
16
+ children,
17
+ ...rest
18
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
19
+ </script>
20
+
21
+ {#if modal.view === 'desktop'}
22
+ <Dialog.Footer bind:ref {...rest}>
23
+ {@render children?.()}
24
+ </Dialog.Footer>
25
+ {:else}
26
+ <Drawer.Footer bind:ref {...rest}>
27
+ {@render children?.()}
28
+ </Drawer.Footer>
29
+ {/if}
@@ -0,0 +1,29 @@
1
+ <!--
2
+ Installed from @ieedan/shadcn-svelte-extras
3
+ -->
4
+
5
+ <script lang="ts">
6
+ import { useModalSub } from './modal.svelte.js';
7
+ import * as Dialog from '../dialog/index.js';
8
+ import * as Drawer from '../drawer/index.js';
9
+ import type { WithElementRef } from 'bits-ui';
10
+ import type { HTMLAttributes } from 'svelte/elements';
11
+
12
+ const modal = useModalSub();
13
+
14
+ let {
15
+ ref = $bindable(null),
16
+ children,
17
+ ...rest
18
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
19
+ </script>
20
+
21
+ {#if modal.view === 'desktop'}
22
+ <Dialog.Header bind:ref {...rest}>
23
+ {@render children?.()}
24
+ </Dialog.Header>
25
+ {:else}
26
+ <Drawer.Header bind:ref {...rest}>
27
+ {@render children?.()}
28
+ </Drawer.Header>
29
+ {/if}
@@ -0,0 +1,20 @@
1
+ <!--
2
+ Installed from @ieedan/shadcn-svelte-extras
3
+ -->
4
+
5
+ <script lang="ts">
6
+ import { useModalSub } from './modal.svelte.js';
7
+ import * as Dialog from '../dialog/index.js';
8
+ import * as Drawer from '../drawer/index.js';
9
+ import type { DialogTitleProps } from 'bits-ui';
10
+
11
+ const modal = useModalSub();
12
+
13
+ let { ref = $bindable(null), ...rest }: DialogTitleProps = $props();
14
+ </script>
15
+
16
+ {#if modal.view === 'desktop'}
17
+ <Dialog.Title bind:ref {...rest} />
18
+ {:else}
19
+ <Drawer.Title bind:ref {...rest} />
20
+ {/if}
@@ -0,0 +1,24 @@
1
+ <!--
2
+ Installed from @ieedan/shadcn-svelte-extras
3
+ -->
4
+
5
+ <script lang="ts">
6
+ import { useModalSub } from './modal.svelte.js';
7
+ import * as Dialog from '../dialog/index.js';
8
+ import * as Drawer from '../drawer/index.js';
9
+ import type { DialogTriggerProps } from 'bits-ui';
10
+
11
+ const modal = useModalSub();
12
+
13
+ let { ref = $bindable(null), children, ...rest }: DialogTriggerProps = $props();
14
+ </script>
15
+
16
+ {#if modal.view === 'desktop'}
17
+ <Dialog.Trigger bind:ref {...rest}>
18
+ {@render children?.()}
19
+ </Dialog.Trigger>
20
+ {:else}
21
+ <Drawer.Trigger bind:ref {...rest}>
22
+ {@render children?.()}
23
+ </Drawer.Trigger>
24
+ {/if}
@@ -0,0 +1,24 @@
1
+ <!--
2
+ Installed from @ieedan/shadcn-svelte-extras
3
+ -->
4
+
5
+ <script lang="ts">
6
+ import * as Dialog from '../dialog/index.js';
7
+ import * as Drawer from '../drawer/index.js';
8
+ import type { DialogRootProps } from 'bits-ui';
9
+ import { useModal } from './modal.svelte.js';
10
+
11
+ let { open = $bindable(false), children, ...rest }: DialogRootProps = $props();
12
+
13
+ const modal = useModal();
14
+ </script>
15
+
16
+ {#if modal.view === 'desktop'}
17
+ <Dialog.Root bind:open {...rest}>
18
+ {@render children?.()}
19
+ </Dialog.Root>
20
+ {:else}
21
+ <Drawer.Root bind:open {...rest}>
22
+ {@render children?.()}
23
+ </Drawer.Root>
24
+ {/if}
@@ -0,0 +1,32 @@
1
+ /*
2
+ Installed from @ieedan/shadcn-svelte-extras
3
+ */
4
+
5
+ import { Context } from "runed";
6
+ import { MediaQuery } from "svelte/reactivity";
7
+
8
+ class ModalRootState {
9
+ #isDesktop = new MediaQuery("(min-width: 768px)");
10
+
11
+ get view() {
12
+ return this.#isDesktop.current ? "desktop" : "mobile";
13
+ }
14
+ }
15
+
16
+ class ModalSubState {
17
+ constructor(private root: ModalRootState) {}
18
+
19
+ get view() {
20
+ return this.root.view;
21
+ }
22
+ }
23
+
24
+ const ctx = new Context<ModalRootState>("modal-root-state");
25
+
26
+ export function useModal() {
27
+ return ctx.set(new ModalRootState());
28
+ }
29
+
30
+ export function useModalSub() {
31
+ return new ModalSubState(ctx.get());
32
+ }
@@ -0,0 +1,7 @@
1
+ import Root from "./separator.svelte";
2
+
3
+ export {
4
+ Root,
5
+ //
6
+ Root as Separator,
7
+ };
@@ -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=vertical]:h-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px",
18
+ className
19
+ )}
20
+ {...restProps}
21
+ />
@@ -0,0 +1,16 @@
1
+ import Root from "./tabs.svelte";
2
+ import Content from "./tabs-content.svelte";
3
+ import List from "./tabs-list.svelte";
4
+ import Trigger from "./tabs-trigger.svelte";
5
+
6
+ export {
7
+ Root,
8
+ Content,
9
+ List,
10
+ Trigger,
11
+ //
12
+ Root as Tabs,
13
+ Content as TabsContent,
14
+ List as TabsList,
15
+ Trigger as TabsTrigger,
16
+ };