svelora 3.0.6 → 3.0.8

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 (161) hide show
  1. package/dist/BentoGrid/BentoCard.svelte +45 -0
  2. package/dist/BentoGrid/BentoCard.svelte.d.ts +4 -0
  3. package/dist/BentoGrid/BentoGrid.svelte +9 -0
  4. package/dist/BentoGrid/BentoGrid.svelte.d.ts +4 -0
  5. package/dist/BentoGrid/bento-grid.types.d.ts +47 -0
  6. package/dist/BentoGrid/bento-grid.types.js +1 -0
  7. package/dist/BentoGrid/bento-grid.variants.d.ts +30 -0
  8. package/dist/BentoGrid/bento-grid.variants.js +16 -0
  9. package/dist/BentoGrid/index.d.ts +5 -0
  10. package/dist/BentoGrid/index.js +5 -0
  11. package/dist/Chart/Chart.svelte +48 -0
  12. package/dist/Chart/Chart.svelte.d.ts +4 -0
  13. package/dist/Chart/chart.types.d.ts +16 -0
  14. package/dist/Chart/chart.types.js +1 -0
  15. package/dist/Chart/index.d.ts +2 -0
  16. package/dist/Chart/index.js +2 -0
  17. package/dist/Chat/ChatBubble.svelte +30 -0
  18. package/dist/Chat/ChatBubble.svelte.d.ts +4 -0
  19. package/dist/Chat/ChatInput.svelte +50 -0
  20. package/dist/Chat/ChatInput.svelte.d.ts +4 -0
  21. package/dist/Chat/ChatMessage.svelte +15 -0
  22. package/dist/Chat/ChatMessage.svelte.d.ts +4 -0
  23. package/dist/Chat/chat.types.d.ts +63 -0
  24. package/dist/Chat/chat.types.js +1 -0
  25. package/dist/Chat/chat.variants.d.ts +117 -0
  26. package/dist/Chat/chat.variants.js +47 -0
  27. package/dist/Chat/index.d.ts +6 -0
  28. package/dist/Chat/index.js +6 -0
  29. package/dist/ColorPicker/ColorPicker.svelte +109 -0
  30. package/dist/ColorPicker/ColorPicker.svelte.d.ts +4 -0
  31. package/dist/ColorPicker/color-picker.types.d.ts +26 -0
  32. package/dist/ColorPicker/color-picker.types.js +1 -0
  33. package/dist/ColorPicker/color-picker.variants.d.ts +69 -0
  34. package/dist/ColorPicker/color-picker.variants.js +13 -0
  35. package/dist/ColorPicker/index.d.ts +4 -0
  36. package/dist/ColorPicker/index.js +4 -0
  37. package/dist/DateRangePicker/DateRangePicker.svelte +59 -0
  38. package/dist/DateRangePicker/DateRangePicker.svelte.d.ts +4 -0
  39. package/dist/DateRangePicker/date-range-picker.types.d.ts +34 -0
  40. package/dist/DateRangePicker/date-range-picker.types.js +1 -0
  41. package/dist/DateRangePicker/date-range-picker.variants.d.ts +39 -0
  42. package/dist/DateRangePicker/date-range-picker.variants.js +20 -0
  43. package/dist/DateRangePicker/index.d.ts +4 -0
  44. package/dist/DateRangePicker/index.js +4 -0
  45. package/dist/List/List.svelte +14 -0
  46. package/dist/List/List.svelte.d.ts +4 -0
  47. package/dist/List/ListItem.svelte +64 -0
  48. package/dist/List/ListItem.svelte.d.ts +4 -0
  49. package/dist/List/index.d.ts +5 -0
  50. package/dist/List/index.js +5 -0
  51. package/dist/List/list.types.d.ts +62 -0
  52. package/dist/List/list.types.js +1 -0
  53. package/dist/List/list.variants.d.ts +99 -0
  54. package/dist/List/list.variants.js +42 -0
  55. package/dist/Marquee/Marquee.svelte +50 -0
  56. package/dist/Marquee/Marquee.svelte.d.ts +4 -0
  57. package/dist/Marquee/index.d.ts +4 -0
  58. package/dist/Marquee/index.js +4 -0
  59. package/dist/Marquee/marquee.types.d.ts +38 -0
  60. package/dist/Marquee/marquee.types.js +1 -0
  61. package/dist/Marquee/marquee.variants.d.ts +78 -0
  62. package/dist/Marquee/marquee.variants.js +28 -0
  63. package/dist/NavigationMenu/NavigationMenu.svelte +212 -0
  64. package/dist/NavigationMenu/NavigationMenu.svelte.d.ts +4 -0
  65. package/dist/NavigationMenu/index.d.ts +3 -0
  66. package/dist/NavigationMenu/index.js +3 -0
  67. package/dist/NavigationMenu/navigation-menu.types.d.ts +104 -0
  68. package/dist/NavigationMenu/navigation-menu.types.js +1 -0
  69. package/dist/NavigationMenu/navigation-menu.variants.d.ts +121 -0
  70. package/dist/NavigationMenu/navigation-menu.variants.js +64 -0
  71. package/dist/NumberTicker/NumberTicker.svelte +59 -0
  72. package/dist/NumberTicker/NumberTicker.svelte.d.ts +4 -0
  73. package/dist/NumberTicker/index.d.ts +4 -0
  74. package/dist/NumberTicker/index.js +4 -0
  75. package/dist/NumberTicker/number-ticker.types.d.ts +26 -0
  76. package/dist/NumberTicker/number-ticker.types.js +1 -0
  77. package/dist/NumberTicker/number-ticker.variants.d.ts +27 -0
  78. package/dist/NumberTicker/number-ticker.variants.js +6 -0
  79. package/dist/PasswordInput/PasswordInput.svelte +74 -0
  80. package/dist/PasswordInput/PasswordInput.svelte.d.ts +4 -0
  81. package/dist/PasswordInput/index.d.ts +4 -0
  82. package/dist/PasswordInput/index.js +4 -0
  83. package/dist/PasswordInput/password-input.types.d.ts +18 -0
  84. package/dist/PasswordInput/password-input.types.js +1 -0
  85. package/dist/PasswordInput/password-input.variants.d.ts +57 -0
  86. package/dist/PasswordInput/password-input.variants.js +11 -0
  87. package/dist/Prose/Prose.svelte +13 -0
  88. package/dist/Prose/Prose.svelte.d.ts +4 -0
  89. package/dist/Prose/index.d.ts +4 -0
  90. package/dist/Prose/index.js +4 -0
  91. package/dist/Prose/prose.types.d.ts +22 -0
  92. package/dist/Prose/prose.types.js +1 -0
  93. package/dist/Prose/prose.variants.d.ts +45 -0
  94. package/dist/Prose/prose.variants.js +45 -0
  95. package/dist/Rating/Rating.svelte +93 -0
  96. package/dist/Rating/Rating.svelte.d.ts +4 -0
  97. package/dist/Rating/index.d.ts +4 -0
  98. package/dist/Rating/index.js +4 -0
  99. package/dist/Rating/rating.types.d.ts +59 -0
  100. package/dist/Rating/rating.types.js +1 -0
  101. package/dist/Rating/rating.variants.d.ts +93 -0
  102. package/dist/Rating/rating.variants.js +32 -0
  103. package/dist/Resizable/Resizable.svelte +9 -0
  104. package/dist/Resizable/Resizable.svelte.d.ts +4 -0
  105. package/dist/Resizable/index.d.ts +4 -0
  106. package/dist/Resizable/index.js +4 -0
  107. package/dist/Resizable/resizable.types.d.ts +18 -0
  108. package/dist/Resizable/resizable.types.js +1 -0
  109. package/dist/Resizable/resizable.variants.d.ts +48 -0
  110. package/dist/Resizable/resizable.variants.js +17 -0
  111. package/dist/ScrollArea/ScrollArea.svelte +54 -0
  112. package/dist/ScrollArea/ScrollArea.svelte.d.ts +4 -0
  113. package/dist/ScrollArea/index.d.ts +4 -0
  114. package/dist/ScrollArea/index.js +4 -0
  115. package/dist/ScrollArea/scroll-area.types.d.ts +27 -0
  116. package/dist/ScrollArea/scroll-area.types.js +1 -0
  117. package/dist/ScrollArea/scroll-area.variants.d.ts +45 -0
  118. package/dist/ScrollArea/scroll-area.variants.js +27 -0
  119. package/dist/Search/Search.svelte +94 -0
  120. package/dist/Search/Search.svelte.d.ts +4 -0
  121. package/dist/Search/index.d.ts +2 -0
  122. package/dist/Search/index.js +1 -0
  123. package/dist/Search/search.types.d.ts +40 -0
  124. package/dist/Search/search.types.js +1 -0
  125. package/dist/Sidebar/Sidebar.svelte +30 -0
  126. package/dist/Sidebar/Sidebar.svelte.d.ts +4 -0
  127. package/dist/Sidebar/index.d.ts +4 -0
  128. package/dist/Sidebar/index.js +4 -0
  129. package/dist/Sidebar/sidebar.types.d.ts +31 -0
  130. package/dist/Sidebar/sidebar.types.js +1 -0
  131. package/dist/Sidebar/sidebar.variants.d.ts +69 -0
  132. package/dist/Sidebar/sidebar.variants.js +23 -0
  133. package/dist/Spotlight/Spotlight.svelte +31 -0
  134. package/dist/Spotlight/Spotlight.svelte.d.ts +4 -0
  135. package/dist/Spotlight/index.d.ts +4 -0
  136. package/dist/Spotlight/index.js +4 -0
  137. package/dist/Spotlight/spotlight.types.d.ts +22 -0
  138. package/dist/Spotlight/spotlight.types.js +1 -0
  139. package/dist/Spotlight/spotlight.variants.d.ts +39 -0
  140. package/dist/Spotlight/spotlight.variants.js +8 -0
  141. package/dist/TagsInput/TagsInput.svelte +100 -0
  142. package/dist/TagsInput/TagsInput.svelte.d.ts +4 -0
  143. package/dist/TagsInput/index.d.ts +4 -0
  144. package/dist/TagsInput/index.js +4 -0
  145. package/dist/TagsInput/tags-input.types.d.ts +32 -0
  146. package/dist/TagsInput/tags-input.types.js +1 -0
  147. package/dist/TagsInput/tags-input.variants.d.ts +45 -0
  148. package/dist/TagsInput/tags-input.variants.js +22 -0
  149. package/dist/TreeView/TreeView.svelte +95 -0
  150. package/dist/TreeView/TreeView.svelte.d.ts +4 -0
  151. package/dist/TreeView/index.d.ts +4 -0
  152. package/dist/TreeView/index.js +4 -0
  153. package/dist/TreeView/tree-view.types.d.ts +68 -0
  154. package/dist/TreeView/tree-view.types.js +1 -0
  155. package/dist/TreeView/tree-view.variants.d.ts +69 -0
  156. package/dist/TreeView/tree-view.variants.js +30 -0
  157. package/dist/docs/navigation.js +119 -0
  158. package/dist/index.d.ts +19 -2
  159. package/dist/index.js +19 -1
  160. package/dist/mcp/svelora-docs.data.json +44 -6
  161. package/package.json +9 -8
@@ -0,0 +1,45 @@
1
+ <script lang="ts">import { twMerge } from "tailwind-merge";
2
+ import Icon from "../Icon/Icon.svelte";
3
+ import Button from "../Button/Button.svelte";
4
+ import { bentoGridVariants } from "./bento-grid.variants.js";
5
+ let { name, description, icon, href, cta = "Learn more", class: className, background, actionSnippet, ...restProps } = $props();
6
+ let styles = $derived(bentoGridVariants());
7
+ </script>
8
+
9
+ <div class={twMerge(styles.cardBase(), className)} {...restProps}>
10
+ <div class={styles.cardBackground()}>
11
+ {#if background}
12
+ {@render background()}
13
+ {/if}
14
+ </div>
15
+
16
+ <!-- Push content up slightly on hover by adjusting group styles or locally -->
17
+ <div class={twMerge(styles.cardContent(), href && 'group-hover:-translate-y-4')}>
18
+ {#if icon}
19
+ <div class={styles.cardIconWrapper()}>
20
+ <Icon {name} class="w-6 h-6" />
21
+ </div>
22
+ {/if}
23
+
24
+ <h3 class={styles.cardTitle()}>{name}</h3>
25
+
26
+ {#if description}
27
+ <p class={styles.cardDescription()}>{description}</p>
28
+ {/if}
29
+ </div>
30
+
31
+ {#if href || actionSnippet}
32
+ <div class={twMerge(styles.cardAction(), !href && !actionSnippet && 'hidden')}>
33
+ {#if actionSnippet}
34
+ {@render actionSnippet()}
35
+ {:else if href}
36
+ <Button {href} variant="ghost" size="sm" class="pl-0 hover:bg-transparent">
37
+ {cta}
38
+ {#snippet trailingSlot()}
39
+ <Icon name="lucide:arrow-right" class="w-4 h-4 ml-1" />
40
+ {/snippet}
41
+ </Button>
42
+ {/if}
43
+ </div>
44
+ {/if}
45
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { BentoCardProps } from './bento-grid.types.js';
2
+ declare const BentoCard: import("svelte").Component<BentoCardProps, {}, "">;
3
+ type BentoCard = ReturnType<typeof BentoCard>;
4
+ export default BentoCard;
@@ -0,0 +1,9 @@
1
+ <script lang="ts">import { twMerge } from "tailwind-merge";
2
+ import { bentoGridVariants } from "./bento-grid.variants.js";
3
+ let { class: className, children, ...restProps } = $props();
4
+ let styles = $derived(bentoGridVariants());
5
+ </script>
6
+
7
+ <div class={twMerge(styles.gridBase(), className)} {...restProps}>
8
+ {@render children?.()}
9
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { BentoGridProps } from './bento-grid.types.js';
2
+ declare const BentoGrid: import("svelte").Component<BentoGridProps, {}, "">;
3
+ type BentoGrid = ReturnType<typeof BentoGrid>;
4
+ export default BentoGrid;
@@ -0,0 +1,47 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ export interface BentoGridProps extends HTMLAttributes<HTMLDivElement> {
4
+ /**
5
+ * Additional CSS classes.
6
+ */
7
+ class?: string;
8
+ /**
9
+ * The cards to render inside the grid.
10
+ */
11
+ children?: Snippet;
12
+ }
13
+ export interface BentoCardProps extends HTMLAttributes<HTMLDivElement> {
14
+ /**
15
+ * Title of the card.
16
+ */
17
+ name: string;
18
+ /**
19
+ * Description text.
20
+ */
21
+ description?: string;
22
+ /**
23
+ * Icon name.
24
+ */
25
+ icon?: string;
26
+ /**
27
+ * The href to navigate to when the call-to-action is clicked.
28
+ */
29
+ href?: string;
30
+ /**
31
+ * Text for the call-to-action button.
32
+ * @default 'Learn more'
33
+ */
34
+ cta?: string;
35
+ /**
36
+ * Additional CSS classes. Useful for setting grid column/row spans (e.g. `col-span-2`).
37
+ */
38
+ class?: string;
39
+ /**
40
+ * Snippet for background visual elements (e.g. gradients, images).
41
+ */
42
+ background?: Snippet;
43
+ /**
44
+ * Snippet for overriding or extending the action area.
45
+ */
46
+ actionSnippet?: Snippet;
47
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ import { type VariantProps } from 'tailwind-variants';
2
+ export declare const bentoGridVariants: import("tailwind-variants").TVReturnType<{}, {
3
+ gridBase: string;
4
+ cardBase: string;
5
+ cardBackground: string;
6
+ cardContent: string;
7
+ cardIconWrapper: string;
8
+ cardTitle: string;
9
+ cardDescription: string;
10
+ cardAction: string;
11
+ }, undefined, {}, {
12
+ gridBase: string;
13
+ cardBase: string;
14
+ cardBackground: string;
15
+ cardContent: string;
16
+ cardIconWrapper: string;
17
+ cardTitle: string;
18
+ cardDescription: string;
19
+ cardAction: string;
20
+ }, import("tailwind-variants").TVReturnType<{}, {
21
+ gridBase: string;
22
+ cardBase: string;
23
+ cardBackground: string;
24
+ cardContent: string;
25
+ cardIconWrapper: string;
26
+ cardTitle: string;
27
+ cardDescription: string;
28
+ cardAction: string;
29
+ }, undefined, unknown, unknown, undefined>>;
30
+ export type BentoGridVariantProps = VariantProps<typeof bentoGridVariants>;
@@ -0,0 +1,16 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const bentoGridVariants = tv({
3
+ slots: {
4
+ gridBase: 'grid grid-cols-1 md:grid-cols-3 gap-4 max-w-7xl mx-auto w-full',
5
+ cardBase: 'group relative flex flex-col justify-between overflow-hidden rounded-xl bg-surface-50 dark:bg-surface-900 border border-outline-variant transition-all hover:shadow-md dark:hover:shadow-surface-800/50',
6
+ cardBackground: 'absolute inset-0 transition-all duration-300 pointer-events-none',
7
+ cardContent: 'pointer-events-none z-10 flex transform-gpu flex-col gap-1 p-6 transition-all duration-300',
8
+ cardIconWrapper: 'mb-2 w-10 h-10 flex items-center justify-center rounded-lg bg-primary-100 dark:bg-primary-900/30 text-primary-600 dark:text-primary-400',
9
+ cardTitle: 'text-lg font-semibold text-surface-900 dark:text-surface-50',
10
+ cardDescription: 'text-sm text-surface-500 dark:text-surface-400',
11
+ cardAction: 'pointer-events-auto absolute bottom-0 left-0 w-full p-6 opacity-0 translate-y-4 transition-all duration-300 group-hover:opacity-100 group-hover:translate-y-0'
12
+ },
13
+ variants: {
14
+ // Variants can be added if we want different styles of grids
15
+ }
16
+ });
@@ -0,0 +1,5 @@
1
+ import BentoGrid from './BentoGrid.svelte';
2
+ import BentoCard from './BentoCard.svelte';
3
+ export { BentoGrid, BentoCard };
4
+ export * from './bento-grid.types.js';
5
+ export * from './bento-grid.variants.js';
@@ -0,0 +1,5 @@
1
+ import BentoGrid from './BentoGrid.svelte';
2
+ import BentoCard from './BentoCard.svelte';
3
+ export { BentoGrid, BentoCard };
4
+ export * from './bento-grid.types.js';
5
+ export * from './bento-grid.variants.js';
@@ -0,0 +1,48 @@
1
+ <script lang="ts">import { onMount, onDestroy } from "svelte";
2
+ import { twMerge } from "tailwind-merge";
3
+ let { options, series, class: className } = $props();
4
+ let chartContainer;
5
+ let chartInstance = null;
6
+ // Helper to dynamically load apexcharts only on the client
7
+ onMount(async () => {
8
+ // Dynamic import so it doesn't break SSR
9
+ const ApexCharts = (await import("apexcharts")).default;
10
+ // Inject series if provided separately
11
+ const initialOptions = series ? {
12
+ ...options,
13
+ series
14
+ } : options;
15
+ // Default styling to match theme
16
+ const mergedOptions = {
17
+ chart: {
18
+ background: "transparent",
19
+ toolbar: { show: false },
20
+ fontFamily: "inherit",
21
+ ...initialOptions.chart
22
+ },
23
+ theme: { ...initialOptions.theme },
24
+ tooltip: {
25
+ theme: "dark",
26
+ ...initialOptions.tooltip
27
+ },
28
+ ...initialOptions
29
+ };
30
+ chartInstance = new ApexCharts(chartContainer, mergedOptions);
31
+ chartInstance.render();
32
+ });
33
+ onDestroy(() => {
34
+ if (chartInstance) {
35
+ chartInstance.destroy();
36
+ }
37
+ });
38
+ // React to options/series changes
39
+ $effect(() => {
40
+ if (chartInstance) {
41
+ if (series) {
42
+ chartInstance.updateSeries(series);
43
+ }
44
+ }
45
+ });
46
+ </script>
47
+
48
+ <div class={twMerge('w-full', className)} bind:this={chartContainer}></div>
@@ -0,0 +1,4 @@
1
+ import type { ChartProps } from './chart.types.js';
2
+ declare const Chart: import("svelte").Component<ChartProps, {}, "">;
3
+ type Chart = ReturnType<typeof Chart>;
4
+ export default Chart;
@@ -0,0 +1,16 @@
1
+ import type { ApexOptions } from 'apexcharts';
2
+ import type { ClassNameValue } from 'tailwind-merge';
3
+ export interface ChartProps {
4
+ /**
5
+ * Configuration options for ApexCharts.
6
+ */
7
+ options: ApexOptions;
8
+ /**
9
+ * Series data. If provided, overrides options.series.
10
+ */
11
+ series?: ApexOptions['series'];
12
+ /**
13
+ * Tailwind class to apply to the chart container wrapper.
14
+ */
15
+ class?: ClassNameValue;
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as Chart } from './Chart.svelte';
2
+ export * from './chart.types.js';
@@ -0,0 +1,2 @@
1
+ export { default as Chart } from './Chart.svelte';
2
+ export * from './chart.types.js';
@@ -0,0 +1,30 @@
1
+ <script lang="ts">import { twMerge } from "tailwind-merge";
2
+ import { setContext } from "svelte";
3
+ import { chatVariants } from "./chat.variants.js";
4
+ let { position = "start", name, time, class: className, avatar, children, ...restProps } = $props();
5
+ let styles = $derived(chatVariants({ position }));
6
+ // Provide position context to child ChatMessage components for proper rounded corners
7
+ setContext("chat-bubble-position", () => position);
8
+ </script>
9
+
10
+ <div class={twMerge(styles.bubbleBase() as string, className as string)} {...restProps}>
11
+ {#if avatar}
12
+ <div class={styles.bubbleAvatar()}>
13
+ {@render avatar()}
14
+ </div>
15
+ {/if}
16
+
17
+ <div class={styles.bubbleContent()}>
18
+ {#if name || time}
19
+ <div class={styles.bubbleHeader()}>
20
+ {#if name}
21
+ <span class={styles.bubbleName()}>{name}</span>
22
+ {/if}
23
+ {#if time}
24
+ <span class={styles.bubbleTime()}>{time}</span>
25
+ {/if}
26
+ </div>
27
+ {/if}
28
+ {@render children?.()}
29
+ </div>
30
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { ChatBubbleProps } from './chat.types.js';
2
+ declare const ChatBubble: import("svelte").Component<ChatBubbleProps, {}, "">;
3
+ type ChatBubble = ReturnType<typeof ChatBubble>;
4
+ export default ChatBubble;
@@ -0,0 +1,50 @@
1
+ <script lang="ts">import { twMerge } from "tailwind-merge";
2
+ import { chatVariants } from "./chat.variants.js";
3
+ let { value = $bindable(""), placeholder = "Type a message...", disabled = false, class: className, leading, trailing, ...restProps } = $props();
4
+ let styles = $derived(chatVariants());
5
+ // Auto-resize textarea function could be added here
6
+ function autoResize(node) {
7
+ function resize() {
8
+ node.style.height = "auto";
9
+ node.style.height = node.scrollHeight + "px";
10
+ }
11
+ node.addEventListener("input", resize);
12
+ // Initial resize
13
+ setTimeout(resize, 0);
14
+ return { destroy() {
15
+ node.removeEventListener("input", resize);
16
+ } };
17
+ }
18
+ </script>
19
+
20
+ <div class={twMerge(styles.inputBase() as string, className as string)} {...restProps}>
21
+ {#if leading}
22
+ <div class={styles.inputActions()}>
23
+ {@render leading()}
24
+ </div>
25
+ {/if}
26
+
27
+ <div class={styles.inputFieldWrapper()}>
28
+ <textarea
29
+ bind:value
30
+ {placeholder}
31
+ {disabled}
32
+ rows="1"
33
+ use:autoResize
34
+ class={styles.inputField()}
35
+ onkeydown={(e) => {
36
+ // If you want Shift+Enter for new line, and Enter to submit:
37
+ // if (e.key === 'Enter' && !e.shiftKey) {
38
+ // e.preventDefault()
39
+ // // Dispatch submit event
40
+ // }
41
+ }}
42
+ ></textarea>
43
+ </div>
44
+
45
+ {#if trailing}
46
+ <div class={styles.inputActions()}>
47
+ {@render trailing()}
48
+ </div>
49
+ {/if}
50
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { ChatInputProps } from './chat.types.js';
2
+ declare const ChatInput: import("svelte").Component<ChatInputProps, {}, "value">;
3
+ type ChatInput = ReturnType<typeof ChatInput>;
4
+ export default ChatInput;
@@ -0,0 +1,15 @@
1
+ <script lang="ts">import { twMerge } from "tailwind-merge";
2
+ import { getContext } from "svelte";
3
+ import { chatVariants } from "./chat.variants.js";
4
+ let { variant = "surface", position: propPosition, class: className, children, ...restProps } = $props();
5
+ const getPositionContext = getContext("chat-bubble-position");
6
+ let position = $derived(propPosition ?? (getPositionContext ? getPositionContext() : "start"));
7
+ let styles = $derived(chatVariants({
8
+ variant,
9
+ position
10
+ }));
11
+ </script>
12
+
13
+ <div class={twMerge(styles.messageBase() as string, className as string)} {...restProps}>
14
+ {@render children?.()}
15
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { ChatMessageProps } from './chat.types.js';
2
+ declare const ChatMessage: import("svelte").Component<ChatMessageProps, {}, "">;
3
+ type ChatMessage = ReturnType<typeof ChatMessage>;
4
+ export default ChatMessage;
@@ -0,0 +1,63 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { ChatVariantProps } from './chat.variants.js';
4
+ export interface ChatBubbleProps extends HTMLAttributes<HTMLDivElement> {
5
+ /**
6
+ * Position of the chat bubble (start for receiver, end for sender).
7
+ * @default 'start'
8
+ */
9
+ position?: ChatVariantProps['position'];
10
+ /**
11
+ * Name of the sender.
12
+ */
13
+ name?: string;
14
+ /**
15
+ * Timestamp of the message.
16
+ */
17
+ time?: string;
18
+ /**
19
+ * Snippet for the avatar element.
20
+ */
21
+ avatar?: Snippet;
22
+ /**
23
+ * The actual chat messages.
24
+ */
25
+ children?: Snippet;
26
+ }
27
+ export interface ChatMessageProps extends HTMLAttributes<HTMLDivElement> {
28
+ /**
29
+ * Style variant of the message bubble.
30
+ */
31
+ variant?: ChatVariantProps['variant'];
32
+ /**
33
+ * Position inheritance (used internally for rounded corners).
34
+ * Automatically inherited from ChatBubble if used within it.
35
+ */
36
+ position?: ChatVariantProps['position'];
37
+ /**
38
+ * The message text or content.
39
+ */
40
+ children?: Snippet;
41
+ }
42
+ export interface ChatInputProps extends HTMLAttributes<HTMLDivElement> {
43
+ /**
44
+ * Value of the input field.
45
+ */
46
+ value?: string;
47
+ /**
48
+ * Placeholder text.
49
+ */
50
+ placeholder?: string;
51
+ /**
52
+ * Whether the input is disabled.
53
+ */
54
+ disabled?: boolean;
55
+ /**
56
+ * Snippet for leading actions (e.g. attachment button).
57
+ */
58
+ leading?: Snippet;
59
+ /**
60
+ * Snippet for trailing actions (e.g. send button).
61
+ */
62
+ trailing?: Snippet;
63
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,117 @@
1
+ import { type VariantProps } from 'tailwind-variants';
2
+ export declare const chatVariants: import("tailwind-variants").TVReturnType<{
3
+ position: {
4
+ start: {
5
+ bubbleBase: string;
6
+ bubbleContent: string;
7
+ bubbleHeader: string;
8
+ messageBase: string;
9
+ };
10
+ end: {
11
+ bubbleBase: string;
12
+ bubbleContent: string;
13
+ bubbleHeader: string;
14
+ messageBase: string;
15
+ };
16
+ };
17
+ variant: {
18
+ primary: {
19
+ messageBase: string;
20
+ };
21
+ surface: {
22
+ messageBase: string;
23
+ };
24
+ outline: {
25
+ messageBase: string;
26
+ };
27
+ };
28
+ }, {
29
+ bubbleBase: string;
30
+ bubbleAvatar: string;
31
+ bubbleContent: string;
32
+ bubbleHeader: string;
33
+ bubbleName: string;
34
+ bubbleTime: string;
35
+ messageBase: string;
36
+ inputBase: string;
37
+ inputFieldWrapper: string;
38
+ inputField: string;
39
+ inputActions: string;
40
+ }, undefined, {
41
+ position: {
42
+ start: {
43
+ bubbleBase: string;
44
+ bubbleContent: string;
45
+ bubbleHeader: string;
46
+ messageBase: string;
47
+ };
48
+ end: {
49
+ bubbleBase: string;
50
+ bubbleContent: string;
51
+ bubbleHeader: string;
52
+ messageBase: string;
53
+ };
54
+ };
55
+ variant: {
56
+ primary: {
57
+ messageBase: string;
58
+ };
59
+ surface: {
60
+ messageBase: string;
61
+ };
62
+ outline: {
63
+ messageBase: string;
64
+ };
65
+ };
66
+ }, {
67
+ bubbleBase: string;
68
+ bubbleAvatar: string;
69
+ bubbleContent: string;
70
+ bubbleHeader: string;
71
+ bubbleName: string;
72
+ bubbleTime: string;
73
+ messageBase: string;
74
+ inputBase: string;
75
+ inputFieldWrapper: string;
76
+ inputField: string;
77
+ inputActions: string;
78
+ }, import("tailwind-variants").TVReturnType<{
79
+ position: {
80
+ start: {
81
+ bubbleBase: string;
82
+ bubbleContent: string;
83
+ bubbleHeader: string;
84
+ messageBase: string;
85
+ };
86
+ end: {
87
+ bubbleBase: string;
88
+ bubbleContent: string;
89
+ bubbleHeader: string;
90
+ messageBase: string;
91
+ };
92
+ };
93
+ variant: {
94
+ primary: {
95
+ messageBase: string;
96
+ };
97
+ surface: {
98
+ messageBase: string;
99
+ };
100
+ outline: {
101
+ messageBase: string;
102
+ };
103
+ };
104
+ }, {
105
+ bubbleBase: string;
106
+ bubbleAvatar: string;
107
+ bubbleContent: string;
108
+ bubbleHeader: string;
109
+ bubbleName: string;
110
+ bubbleTime: string;
111
+ messageBase: string;
112
+ inputBase: string;
113
+ inputFieldWrapper: string;
114
+ inputField: string;
115
+ inputActions: string;
116
+ }, undefined, unknown, unknown, undefined>>;
117
+ export type ChatVariantProps = VariantProps<typeof chatVariants>;
@@ -0,0 +1,47 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const chatVariants = tv({
3
+ slots: {
4
+ bubbleBase: 'flex w-full gap-3 py-2',
5
+ bubbleAvatar: 'shrink-0 mt-1',
6
+ bubbleContent: 'flex flex-col gap-1 min-w-0 max-w-[80%]',
7
+ bubbleHeader: 'flex items-center gap-2 text-xs text-surface-500 dark:text-surface-400',
8
+ bubbleName: 'font-semibold text-surface-900 dark:text-surface-50',
9
+ bubbleTime: '',
10
+ messageBase: 'px-4 py-2.5 rounded-2xl text-sm break-words',
11
+ inputBase: 'flex items-end gap-2 p-3 bg-surface-50 dark:bg-surface-900 border-t border-outline-variant',
12
+ inputFieldWrapper: 'flex-1 relative bg-surface-100 dark:bg-surface-800 rounded-2xl border border-outline-variant focus-within:border-primary focus-within:ring-1 focus-within:ring-primary transition-colors',
13
+ inputField: 'w-full bg-transparent border-0 px-4 py-3 min-h-[44px] max-h-32 resize-none focus:ring-0 text-sm outline-none',
14
+ inputActions: 'shrink-0 flex items-center gap-1'
15
+ },
16
+ variants: {
17
+ position: {
18
+ start: {
19
+ bubbleBase: 'justify-start',
20
+ bubbleContent: 'items-start',
21
+ bubbleHeader: 'flex-row',
22
+ messageBase: 'rounded-tl-sm'
23
+ },
24
+ end: {
25
+ bubbleBase: 'justify-end flex-row-reverse',
26
+ bubbleContent: 'items-end',
27
+ bubbleHeader: 'flex-row-reverse',
28
+ messageBase: 'rounded-tr-sm'
29
+ }
30
+ },
31
+ variant: {
32
+ primary: {
33
+ messageBase: 'bg-primary text-on-primary'
34
+ },
35
+ surface: {
36
+ messageBase: 'bg-surface-200 dark:bg-surface-800 text-surface-900 dark:text-surface-50'
37
+ },
38
+ outline: {
39
+ messageBase: 'bg-transparent border border-outline-variant text-surface-900 dark:text-surface-50'
40
+ }
41
+ }
42
+ },
43
+ defaultVariants: {
44
+ position: 'start',
45
+ variant: 'surface'
46
+ }
47
+ });
@@ -0,0 +1,6 @@
1
+ import ChatBubble from './ChatBubble.svelte';
2
+ import ChatMessage from './ChatMessage.svelte';
3
+ import ChatInput from './ChatInput.svelte';
4
+ export { ChatBubble, ChatMessage, ChatInput };
5
+ export * from './chat.types.js';
6
+ export * from './chat.variants.js';
@@ -0,0 +1,6 @@
1
+ import ChatBubble from './ChatBubble.svelte';
2
+ import ChatMessage from './ChatMessage.svelte';
3
+ import ChatInput from './ChatInput.svelte';
4
+ export { ChatBubble, ChatMessage, ChatInput };
5
+ export * from './chat.types.js';
6
+ export * from './chat.variants.js';