@aphexcms/ui 0.8.3 → 0.8.5

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 (90) hide show
  1. package/dist/components/ui/attachment/attachment-action.svelte +7 -0
  2. package/dist/components/ui/attachment/attachment-action.svelte.d.ts +4 -0
  3. package/dist/components/ui/attachment/attachment-actions.svelte +19 -0
  4. package/dist/components/ui/attachment/attachment-actions.svelte.d.ts +5 -0
  5. package/dist/components/ui/attachment/attachment-content.svelte +19 -0
  6. package/dist/components/ui/attachment/attachment-content.svelte.d.ts +5 -0
  7. package/dist/components/ui/attachment/attachment-context.svelte.d.ts +10 -0
  8. package/dist/components/ui/attachment/attachment-context.svelte.js +13 -0
  9. package/dist/components/ui/attachment/attachment-description.svelte +19 -0
  10. package/dist/components/ui/attachment/attachment-description.svelte.d.ts +5 -0
  11. package/dist/components/ui/attachment/attachment-group.svelte +22 -0
  12. package/dist/components/ui/attachment/attachment-group.svelte.d.ts +5 -0
  13. package/dist/components/ui/attachment/attachment-media.svelte +26 -0
  14. package/dist/components/ui/attachment/attachment-media.svelte.d.ts +8 -0
  15. package/dist/components/ui/attachment/attachment-title.svelte +25 -0
  16. package/dist/components/ui/attachment/attachment-title.svelte.d.ts +5 -0
  17. package/dist/components/ui/attachment/attachment-trigger.svelte +34 -0
  18. package/dist/components/ui/attachment/attachment-trigger.svelte.d.ts +6 -0
  19. package/dist/components/ui/attachment/attachment.svelte +56 -0
  20. package/dist/components/ui/attachment/attachment.svelte.d.ts +11 -0
  21. package/dist/components/ui/attachment/index.d.ts +10 -0
  22. package/dist/components/ui/attachment/index.js +9 -0
  23. package/dist/components/ui/avatar/avatar-fallback.svelte +4 -1
  24. package/dist/components/ui/avatar/avatar-image.svelte +1 -1
  25. package/dist/components/ui/avatar/avatar.svelte +9 -2
  26. package/dist/components/ui/avatar/avatar.svelte.d.ts +4 -1
  27. package/dist/components/ui/bubble/bubble-content.svelte +22 -0
  28. package/dist/components/ui/bubble/bubble-content.svelte.d.ts +5 -0
  29. package/dist/components/ui/bubble/bubble-group.svelte +19 -0
  30. package/dist/components/ui/bubble/bubble-group.svelte.d.ts +5 -0
  31. package/dist/components/ui/bubble/bubble-reactions.svelte +32 -0
  32. package/dist/components/ui/bubble/bubble-reactions.svelte.d.ts +9 -0
  33. package/dist/components/ui/bubble/bubble.svelte +48 -0
  34. package/dist/components/ui/bubble/bubble.svelte.d.ts +43 -0
  35. package/dist/components/ui/bubble/index.d.ts +5 -0
  36. package/dist/components/ui/bubble/index.js +5 -0
  37. package/dist/components/ui/input-otp/index.d.ts +5 -0
  38. package/dist/components/ui/input-otp/index.js +7 -0
  39. package/dist/components/ui/input-otp/input-otp-group.svelte +23 -0
  40. package/dist/components/ui/input-otp/input-otp-group.svelte.d.ts +5 -0
  41. package/dist/components/ui/input-otp/input-otp-separator.svelte +26 -0
  42. package/dist/components/ui/input-otp/input-otp-separator.svelte.d.ts +5 -0
  43. package/dist/components/ui/input-otp/input-otp-slot.svelte +47 -0
  44. package/dist/components/ui/input-otp/input-otp-slot.svelte.d.ts +4 -0
  45. package/dist/components/ui/input-otp/input-otp.svelte +23 -0
  46. package/dist/components/ui/input-otp/input-otp.svelte.d.ts +4 -0
  47. package/dist/components/ui/marker/index.d.ts +4 -0
  48. package/dist/components/ui/marker/index.js +4 -0
  49. package/dist/components/ui/marker/marker-content.svelte +17 -0
  50. package/dist/components/ui/marker/marker-content.svelte.d.ts +5 -0
  51. package/dist/components/ui/marker/marker-icon.svelte +18 -0
  52. package/dist/components/ui/marker/marker-icon.svelte.d.ts +5 -0
  53. package/dist/components/ui/marker/marker.svelte +38 -0
  54. package/dist/components/ui/marker/marker.svelte.d.ts +29 -0
  55. package/dist/components/ui/message/index.d.ts +7 -0
  56. package/dist/components/ui/message/index.js +6 -0
  57. package/dist/components/ui/message/message-avatar.svelte +22 -0
  58. package/dist/components/ui/message/message-avatar.svelte.d.ts +5 -0
  59. package/dist/components/ui/message/message-content.svelte +19 -0
  60. package/dist/components/ui/message/message-content.svelte.d.ts +5 -0
  61. package/dist/components/ui/message/message-context.d.ts +3 -0
  62. package/dist/components/ui/message/message-context.js +8 -0
  63. package/dist/components/ui/message/message-footer.svelte +22 -0
  64. package/dist/components/ui/message/message-footer.svelte.d.ts +5 -0
  65. package/dist/components/ui/message/message-group.svelte +19 -0
  66. package/dist/components/ui/message/message-group.svelte.d.ts +5 -0
  67. package/dist/components/ui/message/message-header.svelte +19 -0
  68. package/dist/components/ui/message/message-header.svelte.d.ts +5 -0
  69. package/dist/components/ui/message/message.svelte +27 -0
  70. package/dist/components/ui/message/message.svelte.d.ts +9 -0
  71. package/dist/components/ui/message-scroller/index.d.ts +7 -0
  72. package/dist/components/ui/message-scroller/index.js +7 -0
  73. package/dist/components/ui/message-scroller/message-scroller-button.svelte +51 -0
  74. package/dist/components/ui/message-scroller/message-scroller-button.svelte.d.ts +11 -0
  75. package/dist/components/ui/message-scroller/message-scroller-content.svelte +35 -0
  76. package/dist/components/ui/message-scroller/message-scroller-content.svelte.d.ts +5 -0
  77. package/dist/components/ui/message-scroller/message-scroller-context.svelte.d.ts +39 -0
  78. package/dist/components/ui/message-scroller/message-scroller-context.svelte.js +161 -0
  79. package/dist/components/ui/message-scroller/message-scroller-item.svelte +51 -0
  80. package/dist/components/ui/message-scroller/message-scroller-item.svelte.d.ts +9 -0
  81. package/dist/components/ui/message-scroller/message-scroller-provider.svelte +40 -0
  82. package/dist/components/ui/message-scroller/message-scroller-provider.svelte.d.ts +12 -0
  83. package/dist/components/ui/message-scroller/message-scroller-viewport.svelte +46 -0
  84. package/dist/components/ui/message-scroller/message-scroller-viewport.svelte.d.ts +5 -0
  85. package/dist/components/ui/message-scroller/message-scroller.svelte +27 -0
  86. package/dist/components/ui/message-scroller/message-scroller.svelte.d.ts +5 -0
  87. package/dist/components/ui/tooltip/index.d.ts +7 -0
  88. package/dist/components/ui/tooltip/index.js +7 -0
  89. package/package.json +36 -6
  90. package/src/app.css +400 -18
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import { cn, type WithElementRef } from '../../../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="input-otp-group"
16
+ class={cn(
17
+ 'has-aria-invalid:border-destructive has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40 flex items-center gap-2 rounded-lg has-aria-invalid:ring-[3px]',
18
+ className
19
+ )}
20
+ {...restProps}
21
+ >
22
+ {@render children?.()}
23
+ </div>
@@ -0,0 +1,5 @@
1
+ import { type WithElementRef } from '../../../utils.js';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ declare const InputOtpGroup: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
4
+ type InputOtpGroup = ReturnType<typeof InputOtpGroup>;
5
+ export default InputOtpGroup;
@@ -0,0 +1,26 @@
1
+ <script lang="ts">
2
+ import MinusIcon from '@lucide/svelte/icons/minus';
3
+ import { cn, type WithElementRef } from '../../../utils.js';
4
+ import type { HTMLAttributes } from 'svelte/elements';
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ class: className,
9
+ children,
10
+ ...restProps
11
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
12
+ </script>
13
+
14
+ <div
15
+ bind:this={ref}
16
+ data-slot="input-otp-separator"
17
+ role="separator"
18
+ class={cn("flex items-center [&_svg:not([class*='size-'])]:size-4", className)}
19
+ {...restProps}
20
+ >
21
+ {#if children}
22
+ {@render children?.()}
23
+ {:else}
24
+ <MinusIcon />
25
+ {/if}
26
+ </div>
@@ -0,0 +1,5 @@
1
+ import { type WithElementRef } from '../../../utils.js';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ declare const InputOtpSeparator: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
4
+ type InputOtpSeparator = ReturnType<typeof InputOtpSeparator>;
5
+ export default InputOtpSeparator;
@@ -0,0 +1,47 @@
1
+ <script lang="ts">
2
+ import { PinInput as InputOTPPrimitive } from 'bits-ui';
3
+ import { cn } from '../../../utils.js';
4
+
5
+ // Deliberately diverges from upstream shadcn, which joins the slots into one
6
+ // segmented control (`border-y border-r`, rounded only at the ends). Each slot
7
+ // here is a standalone rounded box, so the group reads as "one character per
8
+ // box" at a glance. If this component is ever re-added via `pnpm shadcn`, the
9
+ // generated file will revert to the joined look.
10
+ //
11
+ // The size is `h-11 w-11`, not `size-11`: tailwind-merge only lets a later
12
+ // `size-*` override an earlier `w-*`/`h-*`, never the reverse, so a caller
13
+ // passing `h-12` would end up with both declarations and whichever the
14
+ // stylesheet happened to order last. Spelling the axes out keeps overrides
15
+ // per-axis and predictable.
16
+ let {
17
+ ref = $bindable(null),
18
+ cell,
19
+ class: className,
20
+ ...restProps
21
+ }: InputOTPPrimitive.CellProps = $props();
22
+ </script>
23
+
24
+ <InputOTPPrimitive.Cell
25
+ {cell}
26
+ bind:ref
27
+ data-slot="input-otp-slot"
28
+ class={cn(
29
+ // `h-11 w-11` rather than `size-11`: tailwind-merge only lets a later
30
+ // `size-*` override an earlier `w-*`/`h-*`, never the reverse, so a caller
31
+ // passing `h-12` would end up with both declarations and whichever the
32
+ // stylesheet happened to order last. Spelling the axes out keeps overrides
33
+ // per-axis and predictable.
34
+ 'border-input dark:bg-input/30 relative flex h-11 w-11 items-center justify-center rounded-lg border text-base font-medium transition-all outline-none',
35
+ 'data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:z-10 data-[active=true]:ring-[3px]',
36
+ 'aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40',
37
+ className
38
+ )}
39
+ {...restProps}
40
+ >
41
+ {cell.char}
42
+ {#if cell.hasFakeCaret}
43
+ <div class="pointer-events-none absolute inset-0 flex items-center justify-center">
44
+ <div class="animate-caret-blink bg-foreground h-5 w-px duration-1000"></div>
45
+ </div>
46
+ {/if}
47
+ </InputOTPPrimitive.Cell>
@@ -0,0 +1,4 @@
1
+ import { PinInput as InputOTPPrimitive } from 'bits-ui';
2
+ declare const InputOtpSlot: import("svelte").Component<InputOTPPrimitive.CellProps, {}, "ref">;
3
+ type InputOtpSlot = ReturnType<typeof InputOtpSlot>;
4
+ export default InputOtpSlot;
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import { PinInput as InputOTPPrimitive } from 'bits-ui';
3
+ import { cn } from '../../../utils.js';
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ value = $bindable(''),
9
+ ...restProps
10
+ }: InputOTPPrimitive.RootProps = $props();
11
+ </script>
12
+
13
+ <InputOTPPrimitive.Root
14
+ bind:ref
15
+ bind:value
16
+ data-slot="input-otp"
17
+ spellcheck={false}
18
+ class={cn(
19
+ 'flex items-center gap-2 disabled:cursor-not-allowed has-disabled:opacity-50',
20
+ className
21
+ )}
22
+ {...restProps}
23
+ />
@@ -0,0 +1,4 @@
1
+ import { PinInput as InputOTPPrimitive } from 'bits-ui';
2
+ declare const InputOtp: import("svelte").Component<InputOTPPrimitive.RootProps, {}, "ref" | "value">;
3
+ type InputOtp = ReturnType<typeof InputOtp>;
4
+ export default InputOtp;
@@ -0,0 +1,4 @@
1
+ export { default as Marker } from './marker.svelte';
2
+ export { markerVariants, type MarkerVariant } from './marker.svelte';
3
+ export { default as MarkerIcon } from './marker-icon.svelte';
4
+ export { default as MarkerContent } from './marker-content.svelte';
@@ -0,0 +1,4 @@
1
+ export { default as Marker } from './marker.svelte';
2
+ export { markerVariants } from './marker.svelte';
3
+ export { default as MarkerIcon } from './marker-icon.svelte';
4
+ export { default as MarkerContent } from './marker-content.svelte';
@@ -0,0 +1,17 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { cn, type WithElementRef } from '../../../utils.js';
4
+ let {
5
+ ref = $bindable(null),
6
+ class: className,
7
+ children,
8
+ ...restProps
9
+ }: WithElementRef<HTMLAttributes<HTMLSpanElement>> = $props();
10
+ </script>
11
+
12
+ <span
13
+ bind:this={ref}
14
+ data-slot="marker-content"
15
+ class={cn('cn-marker-content min-w-0 wrap-break-word', className)}
16
+ {...restProps}>{@render children?.()}</span
17
+ >
@@ -0,0 +1,5 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import { type WithElementRef } from '../../../utils.js';
3
+ declare const MarkerContent: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLSpanElement>>, {}, "ref">;
4
+ type MarkerContent = ReturnType<typeof MarkerContent>;
5
+ export default MarkerContent;
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { cn, type WithElementRef } from '../../../utils.js';
4
+ let {
5
+ ref = $bindable(null),
6
+ class: className,
7
+ children,
8
+ ...restProps
9
+ }: WithElementRef<HTMLAttributes<HTMLSpanElement>> = $props();
10
+ </script>
11
+
12
+ <span
13
+ bind:this={ref}
14
+ data-slot="marker-icon"
15
+ class={cn('cn-marker-icon shrink-0', className)}
16
+ aria-hidden="true"
17
+ {...restProps}>{@render children?.()}</span
18
+ >
@@ -0,0 +1,5 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import { type WithElementRef } from '../../../utils.js';
3
+ declare const MarkerIcon: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLSpanElement>>, {}, "ref">;
4
+ type MarkerIcon = ReturnType<typeof MarkerIcon>;
5
+ export default MarkerIcon;
@@ -0,0 +1,38 @@
1
+ <script lang="ts" module>
2
+ import { tv, type VariantProps } from 'tailwind-variants';
3
+ export const markerVariants = tv({
4
+ base: 'cn-marker group/marker relative flex w-full items-center',
5
+ variants: {
6
+ variant: {
7
+ default: 'cn-marker-variant-default',
8
+ border: 'cn-marker-variant-border',
9
+ separator: 'cn-marker-variant-separator'
10
+ }
11
+ },
12
+ defaultVariants: { variant: 'default' }
13
+ });
14
+ export type MarkerVariant = VariantProps<typeof markerVariants>['variant'];
15
+ </script>
16
+
17
+ <script lang="ts">
18
+ import type { HTMLAttributes } from 'svelte/elements';
19
+ import { cn, type WithElementRef } from '../../../utils.js';
20
+ type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & { variant?: MarkerVariant };
21
+ let {
22
+ ref = $bindable(null),
23
+ class: className,
24
+ variant = 'default',
25
+ children,
26
+ ...restProps
27
+ }: Props = $props();
28
+ </script>
29
+
30
+ <div
31
+ bind:this={ref}
32
+ data-slot="marker"
33
+ data-variant={variant}
34
+ class={cn(markerVariants({ variant }), className)}
35
+ {...restProps}
36
+ >
37
+ {@render children?.()}
38
+ </div>
@@ -0,0 +1,29 @@
1
+ import { type VariantProps } from 'tailwind-variants';
2
+ export declare const markerVariants: import("tailwind-variants").TVReturnType<{
3
+ variant: {
4
+ default: string;
5
+ border: string;
6
+ separator: string;
7
+ };
8
+ }, undefined, "cn-marker group/marker relative flex w-full items-center", {
9
+ variant: {
10
+ default: string;
11
+ border: string;
12
+ separator: string;
13
+ };
14
+ }, undefined, import("tailwind-variants").TVReturnType<{
15
+ variant: {
16
+ default: string;
17
+ border: string;
18
+ separator: string;
19
+ };
20
+ }, undefined, "cn-marker group/marker relative flex w-full items-center", unknown, unknown, undefined>>;
21
+ export type MarkerVariant = VariantProps<typeof markerVariants>['variant'];
22
+ import type { HTMLAttributes } from 'svelte/elements';
23
+ import { type WithElementRef } from '../../../utils.js';
24
+ type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
25
+ variant?: MarkerVariant;
26
+ };
27
+ declare const Marker: import("svelte").Component<Props, {}, "ref">;
28
+ type Marker = ReturnType<typeof Marker>;
29
+ export default Marker;
@@ -0,0 +1,7 @@
1
+ export { default as Message } from './message.svelte';
2
+ export { default as MessageAvatar } from './message-avatar.svelte';
3
+ export { default as MessageContent } from './message-content.svelte';
4
+ export { default as MessageHeader } from './message-header.svelte';
5
+ export { default as MessageFooter } from './message-footer.svelte';
6
+ export { default as MessageGroup } from './message-group.svelte';
7
+ export type { MessageAlign } from './message-context.js';
@@ -0,0 +1,6 @@
1
+ export { default as Message } from './message.svelte';
2
+ export { default as MessageAvatar } from './message-avatar.svelte';
3
+ export { default as MessageContent } from './message-content.svelte';
4
+ export { default as MessageHeader } from './message-header.svelte';
5
+ export { default as MessageFooter } from './message-footer.svelte';
6
+ export { default as MessageGroup } from './message-group.svelte';
@@ -0,0 +1,22 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { cn, type WithElementRef } from '../../../utils.js';
4
+ let {
5
+ ref = $bindable(null),
6
+ class: className,
7
+ children,
8
+ ...restProps
9
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
10
+ </script>
11
+
12
+ <div
13
+ bind:this={ref}
14
+ data-slot="message-avatar"
15
+ class={cn(
16
+ 'cn-message-avatar bg-muted flex w-fit shrink-0 items-center justify-center self-end overflow-hidden rounded-full',
17
+ className
18
+ )}
19
+ {...restProps}
20
+ >
21
+ {@render children?.()}
22
+ </div>
@@ -0,0 +1,5 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import { type WithElementRef } from '../../../utils.js';
3
+ declare const MessageAvatar: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
4
+ type MessageAvatar = ReturnType<typeof MessageAvatar>;
5
+ export default MessageAvatar;
@@ -0,0 +1,19 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { cn, type WithElementRef } from '../../../utils.js';
4
+ let {
5
+ ref = $bindable(null),
6
+ class: className,
7
+ children,
8
+ ...restProps
9
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
10
+ </script>
11
+
12
+ <div
13
+ bind:this={ref}
14
+ data-slot="message-content"
15
+ class={cn('cn-message-content flex w-full min-w-0 flex-col wrap-break-word', className)}
16
+ {...restProps}
17
+ >
18
+ {@render children?.()}
19
+ </div>
@@ -0,0 +1,5 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import { type WithElementRef } from '../../../utils.js';
3
+ declare const MessageContent: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
4
+ type MessageContent = ReturnType<typeof MessageContent>;
5
+ export default MessageContent;
@@ -0,0 +1,3 @@
1
+ export type MessageAlign = 'start' | 'end';
2
+ export declare function setMessageContext(align: () => MessageAlign): void;
3
+ export declare function getMessageContext(): () => MessageAlign;
@@ -0,0 +1,8 @@
1
+ import { getContext, setContext } from 'svelte';
2
+ const MESSAGE = Symbol.for('aphexcms.ui.message');
3
+ export function setMessageContext(align) {
4
+ setContext(MESSAGE, align);
5
+ }
6
+ export function getMessageContext() {
7
+ return getContext(MESSAGE) ?? (() => 'start');
8
+ }
@@ -0,0 +1,22 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { cn, type WithElementRef } from '../../../utils.js';
4
+ let {
5
+ ref = $bindable(null),
6
+ class: className,
7
+ children,
8
+ ...restProps
9
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
10
+ </script>
11
+
12
+ <div
13
+ bind:this={ref}
14
+ data-slot="message-footer"
15
+ class={cn(
16
+ 'cn-message-footer flex max-w-full min-w-0 items-center group-data-[align=end]/message:justify-end',
17
+ className
18
+ )}
19
+ {...restProps}
20
+ >
21
+ {@render children?.()}
22
+ </div>
@@ -0,0 +1,5 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import { type WithElementRef } from '../../../utils.js';
3
+ declare const MessageFooter: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
4
+ type MessageFooter = ReturnType<typeof MessageFooter>;
5
+ export default MessageFooter;
@@ -0,0 +1,19 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { cn, type WithElementRef } from '../../../utils.js';
4
+ let {
5
+ ref = $bindable(null),
6
+ class: className,
7
+ children,
8
+ ...restProps
9
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
10
+ </script>
11
+
12
+ <div
13
+ bind:this={ref}
14
+ data-slot="message-group"
15
+ class={cn('cn-message-group flex min-w-0 flex-col', className)}
16
+ {...restProps}
17
+ >
18
+ {@render children?.()}
19
+ </div>
@@ -0,0 +1,5 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import { type WithElementRef } from '../../../utils.js';
3
+ declare const MessageGroup: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
4
+ type MessageGroup = ReturnType<typeof MessageGroup>;
5
+ export default MessageGroup;
@@ -0,0 +1,19 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { cn, type WithElementRef } from '../../../utils.js';
4
+ let {
5
+ ref = $bindable(null),
6
+ class: className,
7
+ children,
8
+ ...restProps
9
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
10
+ </script>
11
+
12
+ <div
13
+ bind:this={ref}
14
+ data-slot="message-header"
15
+ class={cn('cn-message-header flex max-w-full min-w-0 items-center', className)}
16
+ {...restProps}
17
+ >
18
+ {@render children?.()}
19
+ </div>
@@ -0,0 +1,5 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import { type WithElementRef } from '../../../utils.js';
3
+ declare const MessageHeader: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
4
+ type MessageHeader = ReturnType<typeof MessageHeader>;
5
+ export default MessageHeader;
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { cn, type WithElementRef } from '../../../utils.js';
4
+ import type { MessageAlign } from './message-context.js';
5
+
6
+ type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & { align?: MessageAlign };
7
+ let {
8
+ ref = $bindable(null),
9
+ class: className,
10
+ align = 'start',
11
+ children,
12
+ ...restProps
13
+ }: Props = $props();
14
+ </script>
15
+
16
+ <div
17
+ bind:this={ref}
18
+ data-slot="message"
19
+ data-align={align}
20
+ class={cn(
21
+ 'cn-message group/message relative flex w-full min-w-0 data-[align=end]:flex-row-reverse',
22
+ className
23
+ )}
24
+ {...restProps}
25
+ >
26
+ {@render children?.()}
27
+ </div>
@@ -0,0 +1,9 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import { type WithElementRef } from '../../../utils.js';
3
+ import type { MessageAlign } from './message-context.js';
4
+ type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
5
+ align?: MessageAlign;
6
+ };
7
+ declare const Message: import("svelte").Component<Props, {}, "ref">;
8
+ type Message = ReturnType<typeof Message>;
9
+ export default Message;
@@ -0,0 +1,7 @@
1
+ export { default as MessageScrollerProvider } from './message-scroller-provider.svelte';
2
+ export { default as MessageScroller } from './message-scroller.svelte';
3
+ export { default as MessageScrollerViewport } from './message-scroller-viewport.svelte';
4
+ export { default as MessageScrollerContent } from './message-scroller-content.svelte';
5
+ export { default as MessageScrollerItem } from './message-scroller-item.svelte';
6
+ export { default as MessageScrollerButton } from './message-scroller-button.svelte';
7
+ export { useMessageScroller, useMessageScrollerVisibility, useMessageScrollerScrollable, type ScrollPosition } from './message-scroller-context.svelte.js';
@@ -0,0 +1,7 @@
1
+ export { default as MessageScrollerProvider } from './message-scroller-provider.svelte';
2
+ export { default as MessageScroller } from './message-scroller.svelte';
3
+ export { default as MessageScrollerViewport } from './message-scroller-viewport.svelte';
4
+ export { default as MessageScrollerContent } from './message-scroller-content.svelte';
5
+ export { default as MessageScrollerItem } from './message-scroller-item.svelte';
6
+ export { default as MessageScrollerButton } from './message-scroller-button.svelte';
7
+ export { useMessageScroller, useMessageScrollerVisibility, useMessageScrollerScrollable } from './message-scroller-context.svelte.js';
@@ -0,0 +1,51 @@
1
+ <script lang="ts">
2
+ import { ArrowDown } from '@lucide/svelte';
3
+ import type { HTMLButtonAttributes } from 'svelte/elements';
4
+ import { cn, type WithElementRef } from '../../../utils.js';
5
+ import { buttonVariants, type ButtonSize, type ButtonVariant } from '../button/index.js';
6
+ import { useMessageScroller } from './message-scroller-context.svelte.js';
7
+
8
+ type Props = WithElementRef<HTMLButtonAttributes> & {
9
+ direction?: 'start' | 'end';
10
+ variant?: ButtonVariant;
11
+ size?: ButtonSize;
12
+ };
13
+ let {
14
+ ref = $bindable(null),
15
+ class: className,
16
+ direction = 'end',
17
+ variant = 'secondary',
18
+ size = 'icon-sm',
19
+ children,
20
+ ...restProps
21
+ }: Props = $props();
22
+ const state = useMessageScroller();
23
+ let active = $derived(direction === 'end' ? state.canScrollEnd : state.canScrollStart);
24
+ </script>
25
+
26
+ <button
27
+ bind:this={ref}
28
+ type="button"
29
+ data-slot="message-scroller-button"
30
+ data-active={active}
31
+ data-direction={direction}
32
+ data-variant={variant}
33
+ data-size={size}
34
+ class={cn(
35
+ buttonVariants({ variant, size }),
36
+ 'cn-message-scroller-button border-border bg-background text-foreground hover:bg-muted hover:text-foreground absolute inset-s-1/2 -translate-x-1/2 transition-[translate,scale,opacity] duration-200 data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180',
37
+ className
38
+ )}
39
+ disabled={!active}
40
+ tabindex={active ? 0 : -1}
41
+ onclick={() => (direction === 'end' ? state.scrollToEnd() : state.scrollToStart())}
42
+ aria-label={direction === 'end' ? 'Jump to latest message' : 'Jump to first message'}
43
+ {...restProps}
44
+ >
45
+ {#if children}
46
+ {@render children()}
47
+ {:else}
48
+ <ArrowDown class="size-4" />
49
+ <span class="sr-only">{direction === 'end' ? 'Scroll to end' : 'Scroll to start'}</span>
50
+ {/if}
51
+ </button>
@@ -0,0 +1,11 @@
1
+ import type { HTMLButtonAttributes } from 'svelte/elements';
2
+ import { type WithElementRef } from '../../../utils.js';
3
+ import { type ButtonSize, type ButtonVariant } from '../button/index.js';
4
+ type Props = WithElementRef<HTMLButtonAttributes> & {
5
+ direction?: 'start' | 'end';
6
+ variant?: ButtonVariant;
7
+ size?: ButtonSize;
8
+ };
9
+ declare const MessageScrollerButton: import("svelte").Component<Props, {}, "ref">;
10
+ type MessageScrollerButton = ReturnType<typeof MessageScrollerButton>;
11
+ export default MessageScrollerButton;
@@ -0,0 +1,35 @@
1
+ <script lang="ts">
2
+ import { onMount } from 'svelte';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+ import { cn, type WithElementRef } from '../../../utils.js';
5
+ import { useMessageScroller } from './message-scroller-context.svelte.js';
6
+
7
+ let {
8
+ ref = $bindable(null),
9
+ class: className,
10
+ children,
11
+ ...restProps
12
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>, HTMLDivElement> = $props();
13
+ const state = useMessageScroller();
14
+
15
+ onMount(() => {
16
+ state.setContent(ref);
17
+ const observer = new ResizeObserver(() => state.scheduleLayout());
18
+ if (ref) observer.observe(ref);
19
+ return () => {
20
+ observer.disconnect();
21
+ state.setContent(null);
22
+ };
23
+ });
24
+ </script>
25
+
26
+ <div
27
+ bind:this={ref}
28
+ data-slot="message-scroller-content"
29
+ class={cn('cn-message-scroller-content flex h-max min-h-full flex-col', className)}
30
+ role="log"
31
+ aria-relevant="additions"
32
+ {...restProps}
33
+ >
34
+ {@render children?.()}
35
+ </div>
@@ -0,0 +1,5 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import { type WithElementRef } from '../../../utils.js';
3
+ declare const MessageScrollerContent: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}, "ref">;
4
+ type MessageScrollerContent = ReturnType<typeof MessageScrollerContent>;
5
+ export default MessageScrollerContent;