@aphexcms/ui 0.8.2 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/attachment/attachment-action.svelte +7 -0
- package/dist/components/ui/attachment/attachment-action.svelte.d.ts +4 -0
- package/dist/components/ui/attachment/attachment-actions.svelte +19 -0
- package/dist/components/ui/attachment/attachment-actions.svelte.d.ts +5 -0
- package/dist/components/ui/attachment/attachment-content.svelte +19 -0
- package/dist/components/ui/attachment/attachment-content.svelte.d.ts +5 -0
- package/dist/components/ui/attachment/attachment-context.svelte.d.ts +10 -0
- package/dist/components/ui/attachment/attachment-context.svelte.js +13 -0
- package/dist/components/ui/attachment/attachment-description.svelte +19 -0
- package/dist/components/ui/attachment/attachment-description.svelte.d.ts +5 -0
- package/dist/components/ui/attachment/attachment-group.svelte +22 -0
- package/dist/components/ui/attachment/attachment-group.svelte.d.ts +5 -0
- package/dist/components/ui/attachment/attachment-media.svelte +26 -0
- package/dist/components/ui/attachment/attachment-media.svelte.d.ts +8 -0
- package/dist/components/ui/attachment/attachment-title.svelte +25 -0
- package/dist/components/ui/attachment/attachment-title.svelte.d.ts +5 -0
- package/dist/components/ui/attachment/attachment-trigger.svelte +34 -0
- package/dist/components/ui/attachment/attachment-trigger.svelte.d.ts +6 -0
- package/dist/components/ui/attachment/attachment.svelte +56 -0
- package/dist/components/ui/attachment/attachment.svelte.d.ts +11 -0
- package/dist/components/ui/attachment/index.d.ts +10 -0
- package/dist/components/ui/attachment/index.js +9 -0
- package/dist/components/ui/avatar/avatar-fallback.svelte +4 -1
- package/dist/components/ui/avatar/avatar-image.svelte +1 -1
- package/dist/components/ui/avatar/avatar.svelte +9 -2
- package/dist/components/ui/avatar/avatar.svelte.d.ts +4 -1
- package/dist/components/ui/bubble/bubble-content.svelte +22 -0
- package/dist/components/ui/bubble/bubble-content.svelte.d.ts +5 -0
- package/dist/components/ui/bubble/bubble-group.svelte +19 -0
- package/dist/components/ui/bubble/bubble-group.svelte.d.ts +5 -0
- package/dist/components/ui/bubble/bubble-reactions.svelte +32 -0
- package/dist/components/ui/bubble/bubble-reactions.svelte.d.ts +9 -0
- package/dist/components/ui/bubble/bubble.svelte +48 -0
- package/dist/components/ui/bubble/bubble.svelte.d.ts +43 -0
- package/dist/components/ui/bubble/index.d.ts +5 -0
- package/dist/components/ui/bubble/index.js +5 -0
- package/dist/components/ui/button-group/button-group-separator.svelte +23 -0
- package/dist/components/ui/button-group/button-group-separator.svelte.d.ts +13 -0
- package/dist/components/ui/button-group/button-group-text.svelte +31 -0
- package/dist/components/ui/button-group/button-group-text.svelte.d.ts +11 -0
- package/dist/components/ui/button-group/button-group.svelte +46 -0
- package/dist/components/ui/button-group/button-group.svelte.d.ts +26 -0
- package/dist/components/ui/button-group/index.d.ts +4 -0
- package/dist/components/ui/button-group/index.js +6 -0
- package/dist/components/ui/marker/index.d.ts +4 -0
- package/dist/components/ui/marker/index.js +4 -0
- package/dist/components/ui/marker/marker-content.svelte +17 -0
- package/dist/components/ui/marker/marker-content.svelte.d.ts +5 -0
- package/dist/components/ui/marker/marker-icon.svelte +18 -0
- package/dist/components/ui/marker/marker-icon.svelte.d.ts +5 -0
- package/dist/components/ui/marker/marker.svelte +38 -0
- package/dist/components/ui/marker/marker.svelte.d.ts +29 -0
- package/dist/components/ui/message/index.d.ts +7 -0
- package/dist/components/ui/message/index.js +6 -0
- package/dist/components/ui/message/message-avatar.svelte +22 -0
- package/dist/components/ui/message/message-avatar.svelte.d.ts +5 -0
- package/dist/components/ui/message/message-content.svelte +19 -0
- package/dist/components/ui/message/message-content.svelte.d.ts +5 -0
- package/dist/components/ui/message/message-context.d.ts +3 -0
- package/dist/components/ui/message/message-context.js +8 -0
- package/dist/components/ui/message/message-footer.svelte +22 -0
- package/dist/components/ui/message/message-footer.svelte.d.ts +5 -0
- package/dist/components/ui/message/message-group.svelte +19 -0
- package/dist/components/ui/message/message-group.svelte.d.ts +5 -0
- package/dist/components/ui/message/message-header.svelte +19 -0
- package/dist/components/ui/message/message-header.svelte.d.ts +5 -0
- package/dist/components/ui/message/message.svelte +27 -0
- package/dist/components/ui/message/message.svelte.d.ts +9 -0
- package/dist/components/ui/message-scroller/index.d.ts +7 -0
- package/dist/components/ui/message-scroller/index.js +7 -0
- package/dist/components/ui/message-scroller/message-scroller-button.svelte +51 -0
- package/dist/components/ui/message-scroller/message-scroller-button.svelte.d.ts +11 -0
- package/dist/components/ui/message-scroller/message-scroller-content.svelte +35 -0
- package/dist/components/ui/message-scroller/message-scroller-content.svelte.d.ts +5 -0
- package/dist/components/ui/message-scroller/message-scroller-context.svelte.d.ts +39 -0
- package/dist/components/ui/message-scroller/message-scroller-context.svelte.js +161 -0
- package/dist/components/ui/message-scroller/message-scroller-item.svelte +51 -0
- package/dist/components/ui/message-scroller/message-scroller-item.svelte.d.ts +9 -0
- package/dist/components/ui/message-scroller/message-scroller-provider.svelte +40 -0
- package/dist/components/ui/message-scroller/message-scroller-provider.svelte.d.ts +12 -0
- package/dist/components/ui/message-scroller/message-scroller-viewport.svelte +46 -0
- package/dist/components/ui/message-scroller/message-scroller-viewport.svelte.d.ts +5 -0
- package/dist/components/ui/message-scroller/message-scroller.svelte +27 -0
- package/dist/components/ui/message-scroller/message-scroller.svelte.d.ts +5 -0
- package/dist/components/ui/sidebar/context.svelte.js +9 -0
- package/dist/components/ui/sidebar/sidebar-input.svelte.d.ts +1 -1
- package/package.json +35 -5
- package/src/app.css +451 -174
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const ButtonGroupSeparator: import("svelte").Component<Omit<{
|
|
2
|
+
orientation?: import("bits-ui").Orientation;
|
|
3
|
+
decorative?: boolean;
|
|
4
|
+
}, "child" | "children"> & {
|
|
5
|
+
child?: import("svelte").Snippet<[{
|
|
6
|
+
props: Record<string, unknown>;
|
|
7
|
+
}]> | undefined;
|
|
8
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
9
|
+
style?: import("bits-ui").StyleProperties | string | null | undefined;
|
|
10
|
+
ref?: HTMLElement | null | undefined;
|
|
11
|
+
} & import("bits-ui").Without<import("bits-ui").BitsPrimitiveDivAttributes, import("bits-ui").SeparatorRootPropsWithoutHTML>, {}, "ref">;
|
|
12
|
+
type ButtonGroupSeparator = ReturnType<typeof ButtonGroupSeparator>;
|
|
13
|
+
export default ButtonGroupSeparator;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '../../../utils.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
child,
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
12
|
+
child?: Snippet<[{ props: Record<string, unknown> }]>;
|
|
13
|
+
} = $props();
|
|
14
|
+
|
|
15
|
+
const mergedProps = $derived({
|
|
16
|
+
...restProps,
|
|
17
|
+
class: cn(
|
|
18
|
+
"bg-muted gap-2 rounded-lg border px-2.5 text-sm font-medium [&_svg:not([class*='size-'])]:size-4 flex items-center [&_svg]:pointer-events-none",
|
|
19
|
+
className
|
|
20
|
+
),
|
|
21
|
+
'data-slot': 'button-group-text'
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
{#if child}
|
|
26
|
+
{@render child({ props: mergedProps })}
|
|
27
|
+
{:else}
|
|
28
|
+
<div bind:this={ref} {...mergedProps}>
|
|
29
|
+
{@render mergedProps.children?.()}
|
|
30
|
+
</div>
|
|
31
|
+
{/if}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type WithElementRef } from '../../../utils.js';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
5
|
+
child?: Snippet<[{
|
|
6
|
+
props: Record<string, unknown>;
|
|
7
|
+
}]>;
|
|
8
|
+
};
|
|
9
|
+
declare const ButtonGroupText: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
10
|
+
type ButtonGroupText = ReturnType<typeof ButtonGroupText>;
|
|
11
|
+
export default ButtonGroupText;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
3
|
+
|
|
4
|
+
export const buttonGroupVariants = tv({
|
|
5
|
+
base: "has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg flex w-fit items-stretch [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
|
|
6
|
+
variants: {
|
|
7
|
+
orientation: {
|
|
8
|
+
horizontal:
|
|
9
|
+
'[&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg! [&>[data-slot]]:rounded-r-none [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0',
|
|
10
|
+
vertical:
|
|
11
|
+
'[&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! flex-col [&>[data-slot]]:rounded-b-none [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
orientation: 'horizontal'
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type ButtonGroupOrientation = VariantProps<typeof buttonGroupVariants>['orientation'];
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import { cn, type WithElementRef } from '../../../utils.js';
|
|
24
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
25
|
+
|
|
26
|
+
let {
|
|
27
|
+
ref = $bindable(null),
|
|
28
|
+
class: className,
|
|
29
|
+
children,
|
|
30
|
+
orientation = 'horizontal',
|
|
31
|
+
...restProps
|
|
32
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
33
|
+
orientation?: ButtonGroupOrientation;
|
|
34
|
+
} = $props();
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<div
|
|
38
|
+
bind:this={ref}
|
|
39
|
+
role="group"
|
|
40
|
+
data-slot="button-group"
|
|
41
|
+
data-orientation={orientation}
|
|
42
|
+
class={cn(buttonGroupVariants({ orientation }), className)}
|
|
43
|
+
{...restProps}
|
|
44
|
+
>
|
|
45
|
+
{@render children?.()}
|
|
46
|
+
</div>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const buttonGroupVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
orientation: {
|
|
4
|
+
horizontal: string;
|
|
5
|
+
vertical: string;
|
|
6
|
+
};
|
|
7
|
+
}, undefined, "has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg flex w-fit items-stretch [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
|
|
8
|
+
orientation: {
|
|
9
|
+
horizontal: string;
|
|
10
|
+
vertical: string;
|
|
11
|
+
};
|
|
12
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
13
|
+
orientation: {
|
|
14
|
+
horizontal: string;
|
|
15
|
+
vertical: string;
|
|
16
|
+
};
|
|
17
|
+
}, undefined, "has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg flex w-fit items-stretch [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", unknown, unknown, undefined>>;
|
|
18
|
+
export type ButtonGroupOrientation = VariantProps<typeof buttonGroupVariants>['orientation'];
|
|
19
|
+
import { type WithElementRef } from '../../../utils.js';
|
|
20
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
21
|
+
type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
22
|
+
orientation?: ButtonGroupOrientation;
|
|
23
|
+
};
|
|
24
|
+
declare const ButtonGroup: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
25
|
+
type ButtonGroup = ReturnType<typeof ButtonGroup>;
|
|
26
|
+
export default ButtonGroup;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import Root, { buttonGroupVariants, type ButtonGroupOrientation } from './button-group.svelte';
|
|
2
|
+
import Text from './button-group-text.svelte';
|
|
3
|
+
import Separator from './button-group-separator.svelte';
|
|
4
|
+
export { Root, Text, Separator, buttonGroupVariants, type ButtonGroupOrientation, Root as ButtonGroup, Text as ButtonGroupText, Separator as ButtonGroupSeparator };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import Root, { buttonGroupVariants } from './button-group.svelte';
|
|
2
|
+
import Text from './button-group-text.svelte';
|
|
3
|
+
import Separator from './button-group-separator.svelte';
|
|
4
|
+
export { Root, Text, Separator, buttonGroupVariants,
|
|
5
|
+
//
|
|
6
|
+
Root as ButtonGroup, Text as ButtonGroupText, Separator as ButtonGroupSeparator };
|
|
@@ -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,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;
|