@ouraihub/aether-ui 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/LICENSE +789 -0
  2. package/fixtures/model-classify.json +42 -0
  3. package/fixtures/pricing-cost.json +56 -0
  4. package/fixtures/reasoning-infer.json +44 -0
  5. package/fixtures/sse/anthropic-messages/chinese.sse +24 -0
  6. package/fixtures/sse/anthropic-messages/multi-tool.sse +33 -0
  7. package/fixtures/sse/anthropic-messages/single-tool.sse +39 -0
  8. package/fixtures/sse/anthropic-messages/text.sse +27 -0
  9. package/fixtures/sse/anthropic-messages/truncated.sse +21 -0
  10. package/fixtures/sse/anthropic-messages/upstream-error.sse +12 -0
  11. package/fixtures/sse/expect.json +20 -0
  12. package/fixtures/sse/openai-chat/chinese.sse +14 -0
  13. package/fixtures/sse/openai-chat/multi-tool.sse +18 -0
  14. package/fixtures/sse/openai-chat/single-tool.sse +22 -0
  15. package/fixtures/sse/openai-chat/text.sse +14 -0
  16. package/fixtures/sse/openai-chat/truncated.sse +12 -0
  17. package/fixtures/sse/openai-chat/upstream-error.sse +6 -0
  18. package/fixtures/sse/openai-responses/chinese.sse +33 -0
  19. package/fixtures/sse/openai-responses/multi-tool.sse +36 -0
  20. package/fixtures/sse/openai-responses/single-tool.sse +27 -0
  21. package/fixtures/sse/openai-responses/text.sse +33 -0
  22. package/fixtures/sse/openai-responses/truncated.sse +30 -0
  23. package/fixtures/sse/openai-responses/upstream-error.sse +9 -0
  24. package/package.json +71 -3
  25. package/src/CopyInput.svelte +33 -0
  26. package/src/KitNotifier.svelte +33 -0
  27. package/src/chat/ApprovalCard.svelte +29 -0
  28. package/src/chat/ChatComposer.svelte +277 -0
  29. package/src/chat/ChatMessage.svelte +262 -0
  30. package/src/chat/ChatPanel.css +386 -0
  31. package/src/chat/ChatPanel.svelte +496 -0
  32. package/src/chat/ChatPanelApprovals.svelte +28 -0
  33. package/src/chat/ChatPanelComposer.svelte +317 -0
  34. package/src/chat/ChatPanelDialogs.svelte +242 -0
  35. package/src/chat/ChatPanelHeader.svelte +132 -0
  36. package/src/chat/ChatPanelMessages.svelte +166 -0
  37. package/src/chat/ChatPanelMode.svelte +190 -0
  38. package/src/chat/ChatPanelState.svelte.ts +1 -0
  39. package/src/chat/ChatPanelToolbar.svelte +425 -0
  40. package/src/chat/ChatSurface.svelte +168 -0
  41. package/src/chat/MessageItem.svelte +480 -0
  42. package/src/chat/ReasoningControl.svelte +286 -0
  43. package/src/chat/SkillPicker.svelte +133 -0
  44. package/src/chat/ToolCallItem.svelte +23 -0
  45. package/src/chat/UsageControl.svelte +216 -0
  46. package/src/chat/UsageDetails.svelte +76 -0
  47. package/src/chat/chat-attachments.svelte.ts +74 -0
  48. package/src/chat/chat-panel-history.svelte.ts +430 -0
  49. package/src/chat/chat-panel-props.ts +32 -0
  50. package/src/chat/index.ts +6 -0
  51. package/src/chat/run-session-history.ts +56 -0
  52. package/src/chat/run-session-types.ts +69 -0
  53. package/src/chat/run-session.svelte.ts +494 -0
  54. package/src/chat/test-support/chat-fixture.ts +178 -0
  55. package/src/chat/test-support/conversation-fixtures.ts +32 -0
  56. package/src/chat/test-support/run-session-fixture.ts +112 -0
  57. package/src/components/ui/alert/alert-action.svelte +20 -0
  58. package/src/components/ui/alert/alert-description.svelte +23 -0
  59. package/src/components/ui/alert/alert-title.svelte +23 -0
  60. package/src/components/ui/alert/alert.svelte +43 -0
  61. package/src/components/ui/alert/index.ts +17 -0
  62. package/src/components/ui/alert-dialog/alert-dialog-action.svelte +27 -0
  63. package/src/components/ui/alert-dialog/alert-dialog-cancel.svelte +27 -0
  64. package/src/components/ui/alert-dialog/alert-dialog-content.svelte +32 -0
  65. package/src/components/ui/alert-dialog/alert-dialog-description.svelte +17 -0
  66. package/src/components/ui/alert-dialog/alert-dialog-footer.svelte +23 -0
  67. package/src/components/ui/alert-dialog/alert-dialog-header.svelte +20 -0
  68. package/src/components/ui/alert-dialog/alert-dialog-media.svelte +20 -0
  69. package/src/components/ui/alert-dialog/alert-dialog-overlay.svelte +17 -0
  70. package/src/components/ui/alert-dialog/alert-dialog-portal.svelte +7 -0
  71. package/src/components/ui/alert-dialog/alert-dialog-title.svelte +17 -0
  72. package/src/components/ui/alert-dialog/alert-dialog-trigger.svelte +7 -0
  73. package/src/components/ui/alert-dialog/alert-dialog.svelte +7 -0
  74. package/src/components/ui/alert-dialog/index.ts +40 -0
  75. package/src/components/ui/button/button.svelte +81 -0
  76. package/src/components/ui/button/index.ts +17 -0
  77. package/src/components/ui/dialog/dialog-close.svelte +11 -0
  78. package/src/components/ui/dialog/dialog-content.svelte +48 -0
  79. package/src/components/ui/dialog/dialog-description.svelte +17 -0
  80. package/src/components/ui/dialog/dialog-footer.svelte +32 -0
  81. package/src/components/ui/dialog/dialog-header.svelte +20 -0
  82. package/src/components/ui/dialog/dialog-overlay.svelte +17 -0
  83. package/src/components/ui/dialog/dialog-portal.svelte +7 -0
  84. package/src/components/ui/dialog/dialog-title.svelte +17 -0
  85. package/src/components/ui/dialog/dialog-trigger.svelte +11 -0
  86. package/src/components/ui/dialog/dialog.svelte +7 -0
  87. package/src/components/ui/dialog/index.ts +34 -0
  88. package/src/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte +16 -0
  89. package/src/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +46 -0
  90. package/src/components/ui/dropdown-menu/dropdown-menu-content.svelte +31 -0
  91. package/src/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +22 -0
  92. package/src/components/ui/dropdown-menu/dropdown-menu-group.svelte +7 -0
  93. package/src/components/ui/dropdown-menu/dropdown-menu-item.svelte +27 -0
  94. package/src/components/ui/dropdown-menu/dropdown-menu-label.svelte +24 -0
  95. package/src/components/ui/dropdown-menu/dropdown-menu-portal.svelte +7 -0
  96. package/src/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte +17 -0
  97. package/src/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +36 -0
  98. package/src/components/ui/dropdown-menu/dropdown-menu-separator.svelte +17 -0
  99. package/src/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +20 -0
  100. package/src/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +31 -0
  101. package/src/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +29 -0
  102. package/src/components/ui/dropdown-menu/dropdown-menu-sub.svelte +7 -0
  103. package/src/components/ui/dropdown-menu/dropdown-menu-trigger.svelte +7 -0
  104. package/src/components/ui/dropdown-menu/dropdown-menu.svelte +7 -0
  105. package/src/components/ui/dropdown-menu/index.ts +54 -0
  106. package/src/components/ui/empty/empty-content.svelte +23 -0
  107. package/src/components/ui/empty/empty-description.svelte +23 -0
  108. package/src/components/ui/empty/empty-header.svelte +20 -0
  109. package/src/components/ui/empty/empty-media.svelte +41 -0
  110. package/src/components/ui/empty/empty-title.svelte +20 -0
  111. package/src/components/ui/empty/empty.svelte +23 -0
  112. package/src/components/ui/empty/index.ts +22 -0
  113. package/src/components/ui/field/field-content.svelte +20 -0
  114. package/src/components/ui/field/field-description.svelte +25 -0
  115. package/src/components/ui/field/field-error.svelte +58 -0
  116. package/src/components/ui/field/field-group.svelte +23 -0
  117. package/src/components/ui/field/field-label.svelte +25 -0
  118. package/src/components/ui/field/field-legend.svelte +24 -0
  119. package/src/components/ui/field/field-separator.svelte +35 -0
  120. package/src/components/ui/field/field-set.svelte +20 -0
  121. package/src/components/ui/field/field-title.svelte +20 -0
  122. package/src/components/ui/field/field.svelte +47 -0
  123. package/src/components/ui/field/index.ts +33 -0
  124. package/src/components/ui/input/index.ts +7 -0
  125. package/src/components/ui/input/input.svelte +48 -0
  126. package/src/components/ui/label/index.ts +7 -0
  127. package/src/components/ui/label/label.svelte +20 -0
  128. package/src/components/ui/select/index.ts +40 -0
  129. package/src/components/ui/select/select-content.svelte +45 -0
  130. package/src/components/ui/select/select-group-heading.svelte +21 -0
  131. package/src/components/ui/select/select-group.svelte +17 -0
  132. package/src/components/ui/select/select-item.svelte +43 -0
  133. package/src/components/ui/select/select-label.svelte +20 -0
  134. package/src/components/ui/select/select-portal.svelte +7 -0
  135. package/src/components/ui/select/select-scroll-down-button.svelte +20 -0
  136. package/src/components/ui/select/select-scroll-up-button.svelte +20 -0
  137. package/src/components/ui/select/select-separator.svelte +18 -0
  138. package/src/components/ui/select/select-trigger.svelte +29 -0
  139. package/src/components/ui/select/select-value.svelte +7 -0
  140. package/src/components/ui/select/select.svelte +11 -0
  141. package/src/components/ui/separator/index.ts +7 -0
  142. package/src/components/ui/separator/separator.svelte +21 -0
  143. package/src/components/ui/sonner/index.ts +1 -0
  144. package/src/components/ui/sonner/sonner.svelte +40 -0
  145. package/src/components/ui/switch/index.ts +7 -0
  146. package/src/components/ui/switch/switch.svelte +34 -0
  147. package/src/components/ui/textarea/index.ts +7 -0
  148. package/src/components/ui/textarea/textarea.svelte +22 -0
  149. package/src/context.ts +34 -0
  150. package/src/dev/Demo.svelte +47 -0
  151. package/src/dev/main.ts +7 -0
  152. package/src/i18n/en.ts +645 -0
  153. package/src/i18n/index.ts +28 -0
  154. package/src/i18n/zh-CN.ts +610 -0
  155. package/src/index.ts +10 -0
  156. package/src/logs/LogPanel.svelte +103 -0
  157. package/src/logs/LogSettings.svelte +58 -0
  158. package/src/logs/index.ts +5 -0
  159. package/src/logs/logger.ts +96 -0
  160. package/src/markdown.ts +8 -0
  161. package/src/mcp/McpClientEditor.svelte +204 -0
  162. package/src/mcp/McpClientSettings.svelte +418 -0
  163. package/src/mcp/McpServerSettings.svelte +363 -0
  164. package/src/mcp/config.ts +26 -0
  165. package/src/mcp/index.ts +3 -0
  166. package/src/mcp/input.ts +74 -0
  167. package/src/notify.svelte.ts +43 -0
  168. package/src/ports/contract.ts +174 -0
  169. package/src/ports/fake-optional.ts +81 -0
  170. package/src/ports/fake.ts +488 -0
  171. package/src/ports/index.ts +7 -0
  172. package/src/ports/search.ts +56 -0
  173. package/src/ports/skill-sources.ts +45 -0
  174. package/src/ports/test-support/fake-fixture.ts +63 -0
  175. package/src/providers/EndpointKeysDialog.svelte +357 -0
  176. package/src/providers/EndpointModels.svelte +311 -0
  177. package/src/providers/EndpointPanel.svelte +266 -0
  178. package/src/providers/ModelPickerDialog.svelte +230 -0
  179. package/src/providers/ModelPricing.svelte +125 -0
  180. package/src/providers/ModelSelect.svelte +448 -0
  181. package/src/providers/ModelSettingsDialog.svelte +388 -0
  182. package/src/providers/ProviderDialogs.svelte +120 -0
  183. package/src/providers/ProviderList.svelte +159 -0
  184. package/src/providers/ProvidersSettings.svelte +491 -0
  185. package/src/providers/RequestConfigDialog.svelte +278 -0
  186. package/src/providers/SecretInput.svelte +284 -0
  187. package/src/providers/draft.ts +355 -0
  188. package/src/providers/edit-session.ts +170 -0
  189. package/src/providers/index.ts +5 -0
  190. package/src/providers/reasoning.ts +55 -0
  191. package/src/providers/revision.svelte.ts +6 -0
  192. package/src/providers/test-support/providers-fixture.ts +120 -0
  193. package/src/search/SearchAdvancedTools.svelte +182 -0
  194. package/src/search/SearchProviderCard.svelte +195 -0
  195. package/src/search/SearchSettings.svelte +500 -0
  196. package/src/search/index.ts +13 -0
  197. package/src/search/settings-flow.ts +67 -0
  198. package/src/session.ts +20 -0
  199. package/src/skills/SkillAdd.svelte +380 -0
  200. package/src/skills/SkillAuthoring.svelte +430 -0
  201. package/src/skills/SkillEditor.svelte +104 -0
  202. package/src/skills/SkillPreviewDialog.svelte +136 -0
  203. package/src/skills/SkillsSettings.svelte +147 -0
  204. package/src/skills/error.ts +32 -0
  205. package/src/skills/index.ts +4 -0
  206. package/src/skills/test-support/skills-fixture.ts +139 -0
  207. package/src/styles/kit.css +137 -0
  208. package/src/styles/tokens.css +22 -0
  209. package/src/tauri/index.ts +298 -0
  210. package/src/utils.ts +22 -0
  211. package/src/web/index.ts +441 -0
  212. package/README.md +0 -3
@@ -0,0 +1,7 @@
1
+ <script lang="ts">
2
+ import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
3
+
4
+ let { open = $bindable(false), ...restProps }: AlertDialogPrimitive.RootProps = $props();
5
+ </script>
6
+
7
+ <AlertDialogPrimitive.Root bind:open {...restProps} />
@@ -0,0 +1,40 @@
1
+ import Action from "./alert-dialog-action.svelte";
2
+ import Cancel from "./alert-dialog-cancel.svelte";
3
+ import Content from "./alert-dialog-content.svelte";
4
+ import Description from "./alert-dialog-description.svelte";
5
+ import Footer from "./alert-dialog-footer.svelte";
6
+ import Header from "./alert-dialog-header.svelte";
7
+ import Media from "./alert-dialog-media.svelte";
8
+ import Overlay from "./alert-dialog-overlay.svelte";
9
+ import Portal from "./alert-dialog-portal.svelte";
10
+ import Title from "./alert-dialog-title.svelte";
11
+ import Trigger from "./alert-dialog-trigger.svelte";
12
+ import Root from "./alert-dialog.svelte";
13
+
14
+ export {
15
+ Root,
16
+ Title,
17
+ Action,
18
+ Cancel,
19
+ Portal,
20
+ Footer,
21
+ Header,
22
+ Trigger,
23
+ Overlay,
24
+ Content,
25
+ Description,
26
+ Media,
27
+ //
28
+ Root as AlertDialog,
29
+ Title as AlertDialogTitle,
30
+ Action as AlertDialogAction,
31
+ Cancel as AlertDialogCancel,
32
+ Portal as AlertDialogPortal,
33
+ Footer as AlertDialogFooter,
34
+ Header as AlertDialogHeader,
35
+ Trigger as AlertDialogTrigger,
36
+ Overlay as AlertDialogOverlay,
37
+ Content as AlertDialogContent,
38
+ Description as AlertDialogDescription,
39
+ Media as AlertDialogMedia,
40
+ };
@@ -0,0 +1,81 @@
1
+ <script lang="ts" module>
2
+ import { cn, tv, type VariantProps, type WithElementRef } from "#lib/utils.js";
3
+ import type { HTMLAnchorAttributes, HTMLButtonAttributes } from "svelte/elements";
4
+
5
+ export const buttonVariants = tv({
6
+ base: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-kit border border-transparent bg-clip-padding text-kit-base font-medium focus-visible:ring-3 aria-invalid:ring-3 active:not-aria-[haspopup]:translate-y-px [&_svg:not([class*='size-'])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-[color,background-color,border-color,box-shadow,translate] outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
7
+ variants: {
8
+ variant: {
9
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
10
+ outline: "border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground",
11
+ secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
12
+ ghost: "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",
13
+ destructive: "bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",
14
+ link: "text-primary underline-offset-4 hover:underline",
15
+ },
16
+ size: {
17
+ default: "h-kit-control gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
18
+ xs: "h-6 gap-1 rounded-kit-sm px-2 text-kit-xs in-data-[slot=button-group]:rounded-kit has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
19
+ sm: "h-kit-control-sm gap-1 rounded-kit-sm px-2.5 text-kit-base in-data-[slot=button-group]:rounded-kit has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
20
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
21
+ icon: "size-kit-control",
22
+ "icon-xs": "size-6 rounded-kit-sm in-data-[slot=button-group]:rounded-kit [&_svg:not([class*='size-'])]:size-3",
23
+ "icon-sm": "size-kit-control-sm rounded-kit-sm in-data-[slot=button-group]:rounded-kit",
24
+ "icon-lg": "size-9",
25
+ },
26
+ },
27
+ defaultVariants: {
28
+ variant: "default",
29
+ size: "default",
30
+ },
31
+ });
32
+
33
+ export type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
34
+ export type ButtonSize = VariantProps<typeof buttonVariants>["size"];
35
+
36
+ export type ButtonProps = WithElementRef<HTMLButtonAttributes> &
37
+ WithElementRef<HTMLAnchorAttributes> & {
38
+ variant?: ButtonVariant;
39
+ size?: ButtonSize;
40
+ };
41
+ </script>
42
+
43
+ <script lang="ts">
44
+ let {
45
+ class: className,
46
+ variant = "default",
47
+ size = "default",
48
+ ref = $bindable(null),
49
+ href = undefined,
50
+ type = "button",
51
+ disabled,
52
+ children,
53
+ ...restProps
54
+ }: ButtonProps = $props();
55
+ </script>
56
+
57
+ {#if href}
58
+ <a
59
+ bind:this={ref}
60
+ data-slot="button"
61
+ class={cn(buttonVariants({ variant, size }), className)}
62
+ href={disabled ? undefined : href}
63
+ aria-disabled={disabled}
64
+ role={disabled ? "link" : undefined}
65
+ tabindex={disabled ? -1 : undefined}
66
+ {...restProps}
67
+ >
68
+ {@render children?.()}
69
+ </a>
70
+ {:else}
71
+ <button
72
+ bind:this={ref}
73
+ data-slot="button"
74
+ class={cn(buttonVariants({ variant, size }), className)}
75
+ {type}
76
+ {disabled}
77
+ {...restProps}
78
+ >
79
+ {@render children?.()}
80
+ </button>
81
+ {/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,11 @@
1
+ <script lang="ts">
2
+ import { Dialog as DialogPrimitive } from "bits-ui";
3
+
4
+ let {
5
+ ref = $bindable(null),
6
+ type = "button",
7
+ ...restProps
8
+ }: DialogPrimitive.CloseProps = $props();
9
+ </script>
10
+
11
+ <DialogPrimitive.Close bind:ref data-slot="dialog-close" {type} {...restProps} />
@@ -0,0 +1,48 @@
1
+ <script lang="ts">
2
+ import { Dialog as DialogPrimitive } from "bits-ui";
3
+ import XIcon from '@lucide/svelte/icons/x';
4
+ import { Button } from "#lib/components/ui/button/index.js";
5
+ import { cn, type WithoutChildrenOrChild } from "#lib/utils.js";
6
+ import * as Dialog from "./index.js";
7
+ import DialogPortal from "./dialog-portal.svelte";
8
+ import type { Snippet } from "svelte";
9
+ import type { ComponentProps } from "svelte";
10
+
11
+ let {
12
+ ref = $bindable(null),
13
+ class: className,
14
+ portalProps,
15
+ children,
16
+ showCloseButton = true,
17
+ ...restProps
18
+ }: WithoutChildrenOrChild<DialogPrimitive.ContentProps> & {
19
+ portalProps?: WithoutChildrenOrChild<ComponentProps<typeof DialogPortal>>;
20
+ children: Snippet;
21
+ showCloseButton?: boolean;
22
+ } = $props();
23
+ </script>
24
+
25
+ <DialogPortal {...portalProps}>
26
+ <Dialog.Overlay />
27
+ <DialogPrimitive.Content
28
+ bind:ref
29
+ data-slot="dialog-content"
30
+ class={cn(
31
+ "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%_-_2rem)] gap-4 rounded-xl p-4 text-kit-base ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none",
32
+ className
33
+ )}
34
+ {...restProps}
35
+ >
36
+ {@render children?.()}
37
+ {#if showCloseButton}
38
+ <DialogPrimitive.Close data-slot="dialog-close">
39
+ {#snippet child({ props })}
40
+ <Button variant="ghost" class="absolute top-2 right-2" size="icon-sm" {...props}>
41
+ <XIcon />
42
+ <span class="sr-only">Close</span>
43
+ </Button>
44
+ {/snippet}
45
+ </DialogPrimitive.Close>
46
+ {/if}
47
+ </DialogPrimitive.Content>
48
+ </DialogPortal>
@@ -0,0 +1,17 @@
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
+ data-slot="dialog-description"
15
+ class={cn("text-muted-foreground *:[a]:hover:text-foreground text-kit-sm *:[a]:underline *:[a]:underline-offset-3", className)}
16
+ {...restProps}
17
+ />
@@ -0,0 +1,32 @@
1
+ <script lang="ts">
2
+ import { Dialog as DialogPrimitive } from "bits-ui";
3
+ import { Button } from "#lib/components/ui/button/index.js";
4
+ import { cn, type WithElementRef } from "#lib/utils.js";
5
+ import type { HTMLAttributes } from "svelte/elements";
6
+
7
+ let {
8
+ ref = $bindable(null),
9
+ class: className,
10
+ children,
11
+ showCloseButton = false,
12
+ ...restProps
13
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
14
+ showCloseButton?: boolean;
15
+ } = $props();
16
+ </script>
17
+
18
+ <div
19
+ bind:this={ref}
20
+ data-slot="dialog-footer"
21
+ class={cn("bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)}
22
+ {...restProps}
23
+ >
24
+ {@render children?.()}
25
+ {#if showCloseButton}
26
+ <DialogPrimitive.Close>
27
+ {#snippet child({ props })}
28
+ <Button variant="outline" {...props}>Close</Button>
29
+ {/snippet}
30
+ </DialogPrimitive.Close>
31
+ {/if}
32
+ </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="dialog-header"
16
+ class={cn("gap-2 flex flex-col", className)}
17
+ {...restProps}
18
+ >
19
+ {@render children?.()}
20
+ </div>
@@ -0,0 +1,17 @@
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.OverlayProps = $props();
10
+ </script>
11
+
12
+ <DialogPrimitive.Overlay
13
+ bind:ref
14
+ data-slot="dialog-overlay"
15
+ class={cn("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50", className)}
16
+ {...restProps}
17
+ />
@@ -0,0 +1,7 @@
1
+ <script lang="ts">
2
+ import { Dialog as DialogPrimitive } from "bits-ui";
3
+
4
+ let { ...restProps }: DialogPrimitive.PortalProps = $props();
5
+ </script>
6
+
7
+ <DialogPrimitive.Portal {...restProps} />
@@ -0,0 +1,17 @@
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.TitleProps = $props();
10
+ </script>
11
+
12
+ <DialogPrimitive.Title
13
+ bind:ref
14
+ data-slot="dialog-title"
15
+ class={cn("text-kit-lg leading-none font-semibold", className)}
16
+ {...restProps}
17
+ />
@@ -0,0 +1,11 @@
1
+ <script lang="ts">
2
+ import { Dialog as DialogPrimitive } from "bits-ui";
3
+
4
+ let {
5
+ ref = $bindable(null),
6
+ type = "button",
7
+ ...restProps
8
+ }: DialogPrimitive.TriggerProps = $props();
9
+ </script>
10
+
11
+ <DialogPrimitive.Trigger bind:ref data-slot="dialog-trigger" {type} {...restProps} />
@@ -0,0 +1,7 @@
1
+ <script lang="ts">
2
+ import { Dialog as DialogPrimitive } from "bits-ui";
3
+
4
+ let { open = $bindable(false), ...restProps }: DialogPrimitive.RootProps = $props();
5
+ </script>
6
+
7
+ <DialogPrimitive.Root bind:open {...restProps} />
@@ -0,0 +1,34 @@
1
+ import Close from "./dialog-close.svelte";
2
+ import Content from "./dialog-content.svelte";
3
+ import Description from "./dialog-description.svelte";
4
+ import Footer from "./dialog-footer.svelte";
5
+ import Header from "./dialog-header.svelte";
6
+ import Overlay from "./dialog-overlay.svelte";
7
+ import Portal from "./dialog-portal.svelte";
8
+ import Title from "./dialog-title.svelte";
9
+ import Trigger from "./dialog-trigger.svelte";
10
+ import Root from "./dialog.svelte";
11
+
12
+ export {
13
+ Root,
14
+ Title,
15
+ Portal,
16
+ Footer,
17
+ Header,
18
+ Trigger,
19
+ Overlay,
20
+ Content,
21
+ Description,
22
+ Close,
23
+ //
24
+ Root as Dialog,
25
+ Title as DialogTitle,
26
+ Portal as DialogPortal,
27
+ Footer as DialogFooter,
28
+ Header as DialogHeader,
29
+ Trigger as DialogTrigger,
30
+ Overlay as DialogOverlay,
31
+ Content as DialogContent,
32
+ Description as DialogDescription,
33
+ Close as DialogClose,
34
+ };
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
3
+
4
+ let {
5
+ ref = $bindable(null),
6
+ value = $bindable([]),
7
+ ...restProps
8
+ }: DropdownMenuPrimitive.CheckboxGroupProps = $props();
9
+ </script>
10
+
11
+ <DropdownMenuPrimitive.CheckboxGroup
12
+ bind:ref
13
+ bind:value
14
+ data-slot="dropdown-menu-checkbox-group"
15
+ {...restProps}
16
+ />
@@ -0,0 +1,46 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
3
+ import MinusIcon from '@lucide/svelte/icons/minus';
4
+ import CheckIcon from '@lucide/svelte/icons/check';
5
+ import { cn, type WithoutChildrenOrChild } from "#lib/utils.js";
6
+ import type { Snippet } from "svelte";
7
+
8
+ let {
9
+ ref = $bindable(null),
10
+ checked = $bindable(false),
11
+ indeterminate = $bindable(false),
12
+ class: className,
13
+ children: childrenProp,
14
+ closeOnSelect = false,
15
+ ...restProps
16
+ }: WithoutChildrenOrChild<DropdownMenuPrimitive.CheckboxItemProps> & {
17
+ children?: Snippet;
18
+ } = $props();
19
+ </script>
20
+
21
+ <DropdownMenuPrimitive.CheckboxItem
22
+ bind:ref
23
+ {closeOnSelect}
24
+ bind:checked
25
+ bind:indeterminate
26
+ data-slot="dropdown-menu-checkbox-item"
27
+ class={cn(
28
+ "focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
29
+ className
30
+ )}
31
+ {...restProps}
32
+ >
33
+ {#snippet children({ checked, indeterminate })}
34
+ <span
35
+ class="absolute right-2 flex items-center justify-center pointer-events-none"
36
+ data-slot="dropdown-menu-checkbox-item-indicator"
37
+ >
38
+ {#if indeterminate}
39
+ <MinusIcon />
40
+ {:else if checked}
41
+ <CheckIcon />
42
+ {/if}
43
+ </span>
44
+ {@render childrenProp?.()}
45
+ {/snippet}
46
+ </DropdownMenuPrimitive.CheckboxItem>
@@ -0,0 +1,31 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
3
+ import { cn, type WithoutChildrenOrChild } from "#lib/utils.js";
4
+ import DropdownMenuPortal from "./dropdown-menu-portal.svelte";
5
+ import type { ComponentProps } from "svelte";
6
+
7
+ let {
8
+ ref = $bindable(null),
9
+ sideOffset = 4,
10
+ align = "start",
11
+ portalProps,
12
+ class: className,
13
+ ...restProps
14
+ }: DropdownMenuPrimitive.ContentProps & {
15
+ portalProps?: WithoutChildrenOrChild<ComponentProps<typeof DropdownMenuPortal>>;
16
+ } = $props();
17
+ </script>
18
+
19
+ <DropdownMenuPortal {...portalProps}>
20
+ <DropdownMenuPrimitive.Content
21
+ bind:ref
22
+ data-slot="dropdown-menu-content"
23
+ {sideOffset}
24
+ {align}
25
+ class={cn(
26
+ "data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--bits-dropdown-menu-content-available-height) w-(--bits-dropdown-menu-anchor-width) origin-(--bits-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto data-closed:overflow-hidden",
27
+ className
28
+ )}
29
+ {...restProps}
30
+ />
31
+ </DropdownMenuPortal>
@@ -0,0 +1,22 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
3
+ import { cn } from "#lib/utils.js";
4
+ import type { ComponentProps } from "svelte";
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ class: className,
9
+ inset,
10
+ ...restProps
11
+ }: ComponentProps<typeof DropdownMenuPrimitive.GroupHeading> & {
12
+ inset?: boolean;
13
+ } = $props();
14
+ </script>
15
+
16
+ <DropdownMenuPrimitive.GroupHeading
17
+ bind:ref
18
+ data-slot="dropdown-menu-group-heading"
19
+ data-inset={inset}
20
+ class={cn("text-muted-foreground px-1.5 py-1 text-xs font-medium data-inset:pl-7", className)}
21
+ {...restProps}
22
+ />
@@ -0,0 +1,7 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
3
+
4
+ let { ref = $bindable(null), ...restProps }: DropdownMenuPrimitive.GroupProps = $props();
5
+ </script>
6
+
7
+ <DropdownMenuPrimitive.Group bind:ref data-slot="dropdown-menu-group" {...restProps} />
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
3
+ import { cn } from "#lib/utils.js";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ inset,
9
+ variant = "default",
10
+ ...restProps
11
+ }: DropdownMenuPrimitive.ItemProps & {
12
+ inset?: boolean;
13
+ variant?: "default" | "destructive";
14
+ } = $props();
15
+ </script>
16
+
17
+ <DropdownMenuPrimitive.Item
18
+ bind:ref
19
+ data-slot="dropdown-menu-item"
20
+ data-inset={inset}
21
+ data-variant={variant}
22
+ class={cn(
23
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
24
+ className
25
+ )}
26
+ {...restProps}
27
+ />
@@ -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
+ inset,
9
+ children,
10
+ ...restProps
11
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
12
+ inset?: boolean;
13
+ } = $props();
14
+ </script>
15
+
16
+ <div
17
+ bind:this={ref}
18
+ data-slot="dropdown-menu-label"
19
+ data-inset={inset}
20
+ class={cn("text-muted-foreground px-1.5 py-1 text-xs font-medium data-inset:pl-7", className)}
21
+ {...restProps}
22
+ >
23
+ {@render children?.()}
24
+ </div>
@@ -0,0 +1,7 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
3
+
4
+ let { ...restProps }: DropdownMenuPrimitive.PortalProps = $props();
5
+ </script>
6
+
7
+ <DropdownMenuPrimitive.Portal {...restProps} />
@@ -0,0 +1,17 @@
1
+ <!-- Local change: `value as never` like select.svelte, as exactOptionalPropertyTypes rejects the bound `string | undefined` (docs/04 §4). -->
2
+ <script lang="ts">
3
+ import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ value = $bindable(),
8
+ ...restProps
9
+ }: DropdownMenuPrimitive.RadioGroupProps = $props();
10
+ </script>
11
+
12
+ <DropdownMenuPrimitive.RadioGroup
13
+ bind:ref
14
+ bind:value={value as never}
15
+ data-slot="dropdown-menu-radio-group"
16
+ {...restProps}
17
+ />
@@ -0,0 +1,36 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
3
+ import CheckIcon from '@lucide/svelte/icons/check';
4
+ import { cn, type WithoutChild } from "#lib/utils.js";
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ class: className,
9
+ children: childrenProp,
10
+ closeOnSelect = false,
11
+ ...restProps
12
+ }: WithoutChild<DropdownMenuPrimitive.RadioItemProps> = $props();
13
+ </script>
14
+
15
+ <DropdownMenuPrimitive.RadioItem
16
+ bind:ref
17
+ {closeOnSelect}
18
+ data-slot="dropdown-menu-radio-item"
19
+ class={cn(
20
+ "focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
21
+ className
22
+ )}
23
+ {...restProps}
24
+ >
25
+ {#snippet children({ checked })}
26
+ <span
27
+ class="absolute right-2 flex items-center justify-center pointer-events-none"
28
+ data-slot="dropdown-menu-radio-item-indicator"
29
+ >
30
+ {#if checked}
31
+ <CheckIcon />
32
+ {/if}
33
+ </span>
34
+ {@render childrenProp?.({ checked })}
35
+ {/snippet}
36
+ </DropdownMenuPrimitive.RadioItem>
@@ -0,0 +1,17 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
3
+ import { cn } from "#lib/utils.js";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ ...restProps
9
+ }: DropdownMenuPrimitive.SeparatorProps = $props();
10
+ </script>
11
+
12
+ <DropdownMenuPrimitive.Separator
13
+ bind:ref
14
+ data-slot="dropdown-menu-separator"
15
+ class={cn("bg-border -mx-1 my-1 h-px", className)}
16
+ {...restProps}
17
+ />