@foxui/social 0.4.0
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/LICENSE +21 -0
- package/README.md +20 -0
- package/dist/components/blog-entry/BlogEntry.svelte +80 -0
- package/dist/components/blog-entry/BlogEntry.svelte.d.ts +14 -0
- package/dist/components/blog-entry/index.d.ts +1 -0
- package/dist/components/blog-entry/index.js +1 -0
- package/dist/components/bluesky-login/BlueskyLogin.svelte +23 -0
- package/dist/components/bluesky-login/BlueskyLogin.svelte.d.ts +4 -0
- package/dist/components/bluesky-login/BlueskyLoginModal.svelte +141 -0
- package/dist/components/bluesky-login/BlueskyLoginModal.svelte.d.ts +9 -0
- package/dist/components/bluesky-login/index.d.ts +8 -0
- package/dist/components/bluesky-login/index.js +3 -0
- package/dist/components/bluesky-post/BlueskyPost.svelte +36 -0
- package/dist/components/bluesky-post/BlueskyPost.svelte.d.ts +10 -0
- package/dist/components/bluesky-post/index.d.ts +5 -0
- package/dist/components/bluesky-post/index.js +110 -0
- package/dist/components/chat/Chat.svelte +0 -0
- package/dist/components/chat/Chat.svelte.d.ts +26 -0
- package/dist/components/chat/ChatMessage.svelte +0 -0
- package/dist/components/chat/ChatMessage.svelte.d.ts +26 -0
- package/dist/components/chat/index.d.ts +1 -0
- package/dist/components/chat/index.js +1 -0
- package/dist/components/emoji-picker/EmojiPicker.svelte +91 -0
- package/dist/components/emoji-picker/EmojiPicker.svelte.d.ts +11 -0
- package/dist/components/emoji-picker/PopoverEmojiPicker.svelte +24 -0
- package/dist/components/emoji-picker/PopoverEmojiPicker.svelte.d.ts +11 -0
- package/dist/components/emoji-picker/emoji.d.ts +7 -0
- package/dist/components/emoji-picker/emoji.js +56 -0
- package/dist/components/emoji-picker/index.d.ts +2 -0
- package/dist/components/emoji-picker/index.js +2 -0
- package/dist/components/github-corner/GithubCorner.svelte +62 -0
- package/dist/components/github-corner/GithubCorner.svelte.d.ts +4 -0
- package/dist/components/github-corner/index.d.ts +1 -0
- package/dist/components/github-corner/index.js +1 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/index.js +20 -0
- package/dist/components/nested-comments/Comment.svelte +151 -0
- package/dist/components/nested-comments/Comment.svelte.d.ts +9 -0
- package/dist/components/nested-comments/NestedComments.svelte +14 -0
- package/dist/components/nested-comments/NestedComments.svelte.d.ts +7 -0
- package/dist/components/nested-comments/index.d.ts +1 -0
- package/dist/components/nested-comments/index.js +1 -0
- package/dist/components/post/Post.svelte +294 -0
- package/dist/components/post/Post.svelte.d.ts +23 -0
- package/dist/components/post/PostAction.svelte +27 -0
- package/dist/components/post/PostAction.svelte.d.ts +9 -0
- package/dist/components/post/embeds/Embed.svelte +24 -0
- package/dist/components/post/embeds/Embed.svelte.d.ts +7 -0
- package/dist/components/post/embeds/External.svelte +39 -0
- package/dist/components/post/embeds/External.svelte.d.ts +7 -0
- package/dist/components/post/embeds/Images.svelte +38 -0
- package/dist/components/post/embeds/Images.svelte.d.ts +7 -0
- package/dist/components/post/embeds/Video.svelte +45 -0
- package/dist/components/post/embeds/Video.svelte.d.ts +7 -0
- package/dist/components/post/index.d.ts +63 -0
- package/dist/components/post/index.js +1 -0
- package/dist/components/social-icons/All.svelte +47 -0
- package/dist/components/social-icons/All.svelte.d.ts +12 -0
- package/dist/components/social-icons/Bluesky.svelte +37 -0
- package/dist/components/social-icons/Bluesky.svelte.d.ts +8 -0
- package/dist/components/social-icons/Discord.svelte +37 -0
- package/dist/components/social-icons/Discord.svelte.d.ts +8 -0
- package/dist/components/social-icons/Facebook.svelte +37 -0
- package/dist/components/social-icons/Facebook.svelte.d.ts +8 -0
- package/dist/components/social-icons/Github.svelte +38 -0
- package/dist/components/social-icons/Github.svelte.d.ts +8 -0
- package/dist/components/social-icons/Twitter.svelte +37 -0
- package/dist/components/social-icons/Twitter.svelte.d.ts +8 -0
- package/dist/components/social-icons/Youtube.svelte +36 -0
- package/dist/components/social-icons/Youtube.svelte.d.ts +8 -0
- package/dist/components/social-icons/index.d.ts +7 -0
- package/dist/components/social-icons/index.js +8 -0
- package/dist/components/star-rating/StarRating.svelte +104 -0
- package/dist/components/star-rating/StarRating.svelte.d.ts +13 -0
- package/dist/components/star-rating/index.d.ts +1 -0
- package/dist/components/star-rating/index.js +1 -0
- package/dist/components/swiper-cards/CardSwiper.svelte +235 -0
- package/dist/components/swiper-cards/CardSwiper.svelte.d.ts +18 -0
- package/dist/components/swiper-cards/index.d.ts +14 -0
- package/dist/components/swiper-cards/index.js +1 -0
- package/dist/components/user-profile/UserProfile.svelte +60 -0
- package/dist/components/user-profile/UserProfile.svelte.d.ts +13 -0
- package/dist/components/user-profile/index.d.ts +1 -0
- package/dist/components/user-profile/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types.d.ts +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NativeEmoji } from 'emoji-picker-element/shared';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
onpicked?: (emoji: NativeEmoji) => void;
|
|
4
|
+
height?: number;
|
|
5
|
+
width?: number;
|
|
6
|
+
columns?: number;
|
|
7
|
+
class?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const EmojiPicker: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
10
|
+
type EmojiPicker = ReturnType<typeof EmojiPicker>;
|
|
11
|
+
export default EmojiPicker;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Popover, type PopoverProps, cn } from '@foxui/core';
|
|
3
|
+
import EmojiPicker from './EmojiPicker.svelte';
|
|
4
|
+
import type { NativeEmoji } from './emoji';
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
onpicked,
|
|
9
|
+
children,
|
|
10
|
+
class: className,
|
|
11
|
+
open = $bindable(false),
|
|
12
|
+
triggerRef = $bindable(null),
|
|
13
|
+
...props
|
|
14
|
+
}: {
|
|
15
|
+
onpicked?: (emoji: NativeEmoji) => void;
|
|
16
|
+
children?: Snippet;
|
|
17
|
+
class?: string;
|
|
18
|
+
} & PopoverProps = $props();
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Popover {...props} bind:triggerRef bind:open class={cn('p-0', className)}>
|
|
22
|
+
{@render children?.()}
|
|
23
|
+
<EmojiPicker {onpicked} />
|
|
24
|
+
</Popover>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type PopoverProps } from '@foxui/core';
|
|
2
|
+
import type { NativeEmoji } from './emoji';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
type $$ComponentProps = {
|
|
5
|
+
onpicked?: (emoji: NativeEmoji) => void;
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
class?: string;
|
|
8
|
+
} & PopoverProps;
|
|
9
|
+
declare const PopoverEmojiPicker: import("svelte").Component<$$ComponentProps, {}, "open" | "triggerRef">;
|
|
10
|
+
type PopoverEmojiPicker = ReturnType<typeof PopoverEmojiPicker>;
|
|
11
|
+
export default PopoverEmojiPicker;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export const allGroups = [
|
|
2
|
+
[
|
|
3
|
+
0,
|
|
4
|
+
'😀',
|
|
5
|
+
'smileys-emotion',
|
|
6
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/></svg>`
|
|
7
|
+
],
|
|
8
|
+
[
|
|
9
|
+
1,
|
|
10
|
+
'👋',
|
|
11
|
+
'people-body',
|
|
12
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-hand-icon lucide-hand"><path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/></svg>`
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
3,
|
|
16
|
+
'🐱',
|
|
17
|
+
'animals-nature',
|
|
18
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-dog-icon lucide-dog"><path d="M11.25 16.25h1.5L12 17z"/><path d="M16 14v.5"/><path d="M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309"/><path d="M8 14v.5"/><path d="M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5"/></svg>`
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
4,
|
|
22
|
+
'🍎',
|
|
23
|
+
'food-drink',
|
|
24
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-apple-icon lucide-apple"><path d="M12 20.94c1.5 0 2.75 1.06 4 1.06 3 0 6-8 6-12.22A4.91 4.91 0 0 0 17 5c-2.22 0-4 1.44-5 2-1-.56-2.78-2-5-2a4.9 4.9 0 0 0-5 4.78C2 14 5 22 8 22c1.25 0 2.5-1.06 4-1.06Z"/><path d="M10 2c1 .5 2 2 2 5"/></svg> `
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
5,
|
|
28
|
+
'🏠️',
|
|
29
|
+
'travel-places',
|
|
30
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-house-icon lucide-house"><path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg>`
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
6,
|
|
34
|
+
'⚽',
|
|
35
|
+
'activities',
|
|
36
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-volleyball-icon lucide-volleyball"><path d="M11.1 7.1a16.55 16.55 0 0 1 10.9 4"/><path d="M12 12a12.6 12.6 0 0 1-8.7 5"/><path d="M16.8 13.6a16.55 16.55 0 0 1-9 7.5"/><path d="M20.7 17a12.8 12.8 0 0 0-8.7-5 13.3 13.3 0 0 1 0-10"/><path d="M6.3 3.8a16.55 16.55 0 0 0 1.9 11.5"/><circle cx="12" cy="12" r="10"/></svg>`
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
7,
|
|
40
|
+
'📝',
|
|
41
|
+
'objects',
|
|
42
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-lightbulb-icon lucide-lightbulb"><path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/></svg>`
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
8,
|
|
46
|
+
'⛔️',
|
|
47
|
+
'symbols',
|
|
48
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-pi-icon lucide-square-pi"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M7 7h10"/><path d="M10 7v10"/><path d="M16 17a2 2 0 0 1-2-2V7"/></svg>`
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
9,
|
|
52
|
+
'🏁',
|
|
53
|
+
'flags',
|
|
54
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-flag-icon lucide-flag"><path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"/><line x1="4" x2="4" y1="22" y2="15"/></svg>`
|
|
55
|
+
]
|
|
56
|
+
].map(([id, emoji, name, svg]) => ({ id, emoji, name, svg }));
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '@foxui/core';
|
|
3
|
+
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
type Props = HTMLAnchorAttributes;
|
|
6
|
+
let { target = '_blank', class: className, ...restProps }: Props = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<a
|
|
10
|
+
{target}
|
|
11
|
+
class={cn(
|
|
12
|
+
'github-corner fill-accent-600 text-base-50 dark:fill-accent-500 dark:text-base-950 fixed -top-1 -right-1 z-50',
|
|
13
|
+
className
|
|
14
|
+
)}
|
|
15
|
+
{...restProps}
|
|
16
|
+
>
|
|
17
|
+
<svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true">
|
|
18
|
+
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
|
|
19
|
+
<path
|
|
20
|
+
d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
|
|
21
|
+
fill="currentColor"
|
|
22
|
+
style="transform-origin: 130px 106px;"
|
|
23
|
+
class="octo-arm"
|
|
24
|
+
></path>
|
|
25
|
+
<path
|
|
26
|
+
d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
|
|
27
|
+
fill="currentColor"
|
|
28
|
+
class="octo-body"
|
|
29
|
+
></path>
|
|
30
|
+
</svg>
|
|
31
|
+
<span class="sr-only">View source on GitHub</span>
|
|
32
|
+
</a>
|
|
33
|
+
|
|
34
|
+
<style>
|
|
35
|
+
.github-corner:hover .octo-arm {
|
|
36
|
+
animation: octocat-wave 560ms ease-in-out;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@keyframes octocat-wave {
|
|
40
|
+
0%,
|
|
41
|
+
100% {
|
|
42
|
+
transform: rotate(0);
|
|
43
|
+
}
|
|
44
|
+
20%,
|
|
45
|
+
60% {
|
|
46
|
+
transform: rotate(-25deg);
|
|
47
|
+
}
|
|
48
|
+
40%,
|
|
49
|
+
80% {
|
|
50
|
+
transform: rotate(10deg);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media (max-width: 500px) {
|
|
55
|
+
.github-corner:hover .octo-arm {
|
|
56
|
+
animation: none;
|
|
57
|
+
}
|
|
58
|
+
.github-corner .octo-arm {
|
|
59
|
+
animation: octocat-wave 560ms ease-in-out;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as GithubCorner } from './GithubCorner.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as GithubCorner } from './GithubCorner.svelte';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './bluesky-login';
|
|
2
|
+
export * from './post';
|
|
3
|
+
export * from './star-rating';
|
|
4
|
+
export * from './social-icons';
|
|
5
|
+
export * from './swiper-cards';
|
|
6
|
+
export * from './user-profile';
|
|
7
|
+
export * from './github-corner';
|
|
8
|
+
export * from './chat';
|
|
9
|
+
export * from './emoji-picker';
|
|
10
|
+
export * from './bluesky-post';
|
|
11
|
+
export * from './nested-comments';
|
|
12
|
+
export declare function numberToHumanReadable(number: number): string | number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from './bluesky-login';
|
|
2
|
+
export * from './post';
|
|
3
|
+
export * from './star-rating';
|
|
4
|
+
export * from './social-icons';
|
|
5
|
+
export * from './swiper-cards';
|
|
6
|
+
export * from './user-profile';
|
|
7
|
+
export * from './github-corner';
|
|
8
|
+
export * from './chat';
|
|
9
|
+
export * from './emoji-picker';
|
|
10
|
+
export * from './bluesky-post';
|
|
11
|
+
export * from './nested-comments';
|
|
12
|
+
export function numberToHumanReadable(number) {
|
|
13
|
+
if (number < 1000) {
|
|
14
|
+
return number;
|
|
15
|
+
}
|
|
16
|
+
if (number < 1000000) {
|
|
17
|
+
return `${(number / 1000).toFixed(1)}k`;
|
|
18
|
+
}
|
|
19
|
+
return `${(number / 1000000).toFixed(1)}m`;
|
|
20
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { numberToHumanReadable } from '../';
|
|
3
|
+
import Comment from './Comment.svelte';
|
|
4
|
+
import { Avatar, Prose } from '@foxui/core';
|
|
5
|
+
import { RelativeTime } from '@foxui/time';
|
|
6
|
+
import type { PostData } from '../post';
|
|
7
|
+
import Embed from '../post/embeds/Embed.svelte';
|
|
8
|
+
|
|
9
|
+
const { comment, depth = 0 }: { comment: PostData; depth: number } = $props();
|
|
10
|
+
|
|
11
|
+
let expanded = $state(true);
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
{#snippet top(expand: boolean)}
|
|
15
|
+
<div class="text-base-600 dark:text-base-500 -ml-6 flex items-center text-sm">
|
|
16
|
+
<div class="relative size-6">
|
|
17
|
+
<Avatar src={comment.author.avatar} class="size-6" />
|
|
18
|
+
{#if expand}
|
|
19
|
+
<button
|
|
20
|
+
class="absolute inset-0 flex size-6 cursor-pointer items-center justify-center rounded-full bg-black/50 text-white"
|
|
21
|
+
onclick={() => (expanded = !expanded)}
|
|
22
|
+
>
|
|
23
|
+
<svg
|
|
24
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
25
|
+
fill="none"
|
|
26
|
+
viewBox="0 0 24 24"
|
|
27
|
+
stroke-width="2"
|
|
28
|
+
stroke="currentColor"
|
|
29
|
+
class="size-3"
|
|
30
|
+
>
|
|
31
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
|
|
32
|
+
</svg>
|
|
33
|
+
|
|
34
|
+
<span class="sr-only">expand comment</span>
|
|
35
|
+
</button>
|
|
36
|
+
{:else}
|
|
37
|
+
<button
|
|
38
|
+
class="absolute inset-0 flex size-6 cursor-pointer items-center justify-center rounded-full"
|
|
39
|
+
onclick={() => (expanded = !expanded)}
|
|
40
|
+
>
|
|
41
|
+
<span class="sr-only">collapse comment</span>
|
|
42
|
+
</button>
|
|
43
|
+
{/if}
|
|
44
|
+
</div>
|
|
45
|
+
<a
|
|
46
|
+
target="_blank"
|
|
47
|
+
rel="noopener noreferrer nofollow"
|
|
48
|
+
class="dark:text-base-400 hover:text-base-500 hover:dark:text-base-300 ml-2"
|
|
49
|
+
href={comment.author.href}
|
|
50
|
+
>
|
|
51
|
+
{comment.author.displayName || comment.author.handle}
|
|
52
|
+
</a>
|
|
53
|
+
|
|
54
|
+
<div class="text-base-500 ml-2 text-xs">
|
|
55
|
+
<RelativeTime date={new Date(comment.createdAt)} locale="en" />
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
{/snippet}
|
|
59
|
+
|
|
60
|
+
<div class="relative pl-3">
|
|
61
|
+
<button
|
|
62
|
+
class="group absolute -left-1.5 top-0 flex h-full w-3 cursor-pointer items-center"
|
|
63
|
+
onclick={() => (expanded = !expanded)}
|
|
64
|
+
>
|
|
65
|
+
<div
|
|
66
|
+
class="bg-base-200 dark:bg-base-800 group-hover:bg-base-300 dark:group-hover:bg-base-700 mx-auto h-full w-0.5"
|
|
67
|
+
></div>
|
|
68
|
+
<span class="sr-only">collapse comment</span>
|
|
69
|
+
</button>
|
|
70
|
+
|
|
71
|
+
<div class="mt-2 pb-2">
|
|
72
|
+
{#if expanded}
|
|
73
|
+
{@render top(false)}
|
|
74
|
+
<Prose>{@html comment.htmlContent}</Prose>
|
|
75
|
+
|
|
76
|
+
{#if comment.embed}
|
|
77
|
+
<Embed embed={comment.embed} />
|
|
78
|
+
{/if}
|
|
79
|
+
|
|
80
|
+
<div class="text-base-500 dark:text-base-400 mt-2 flex gap-8">
|
|
81
|
+
<a
|
|
82
|
+
href={comment.href}
|
|
83
|
+
target="_blank"
|
|
84
|
+
rel="noopener noreferrer nofollow"
|
|
85
|
+
class="group inline-flex items-center gap-2 text-sm"
|
|
86
|
+
>
|
|
87
|
+
<svg
|
|
88
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
89
|
+
fill="none"
|
|
90
|
+
viewBox="0 0 24 24"
|
|
91
|
+
stroke-width="1.5"
|
|
92
|
+
stroke="currentColor"
|
|
93
|
+
class="group-hover:bg-accent-500/10 group-hover:text-accent-700 dark:group-hover:text-accent-400 -m-1.5 size-7 rounded-full p-1.5 transition-all duration-100"
|
|
94
|
+
>
|
|
95
|
+
<path
|
|
96
|
+
stroke-linecap="round"
|
|
97
|
+
stroke-linejoin="round"
|
|
98
|
+
d="M12 20.25c4.97 0 9-3.694 9-8.25s-4.03-8.25-9-8.25S3 7.444 3 12c0 2.104.859 4.023 2.273 5.48.432.447.74 1.04.586 1.641a4.483 4.483 0 0 1-.923 1.785A5.969 5.969 0 0 0 6 21c1.282 0 2.47-.402 3.445-1.087.81.22 1.668.337 2.555.337Z"
|
|
99
|
+
/>
|
|
100
|
+
</svg>
|
|
101
|
+
<span class="sr-only">Replies</span>
|
|
102
|
+
{numberToHumanReadable(comment.replyCount)}
|
|
103
|
+
</a>
|
|
104
|
+
|
|
105
|
+
<a
|
|
106
|
+
href={comment.href}
|
|
107
|
+
target="_blank"
|
|
108
|
+
rel="noopener noreferrer nofollow"
|
|
109
|
+
class="group inline-flex items-center gap-2 text-sm"
|
|
110
|
+
>
|
|
111
|
+
<svg
|
|
112
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
113
|
+
fill="none"
|
|
114
|
+
viewBox="0 0 24 24"
|
|
115
|
+
stroke-width="1.5"
|
|
116
|
+
stroke="currentColor"
|
|
117
|
+
class="group-hover:bg-accent-500/10 group-hover:text-accent-700 dark:group-hover:text-accent-400 -m-1.5 size-7 rounded-full p-1.5 transition-all duration-100"
|
|
118
|
+
>
|
|
119
|
+
<path
|
|
120
|
+
stroke-linecap="round"
|
|
121
|
+
stroke-linejoin="round"
|
|
122
|
+
d="M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z"
|
|
123
|
+
/>
|
|
124
|
+
</svg>
|
|
125
|
+
<span class="sr-only">Likes</span>
|
|
126
|
+
{numberToHumanReadable(comment.likeCount)}
|
|
127
|
+
</a>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<!-- {#if comment.replies?.length && depth > 4}
|
|
131
|
+
<a
|
|
132
|
+
href={atUriToPostUri(comment.uri)}
|
|
133
|
+
target="_blank"
|
|
134
|
+
rel="noopener noreferrer nofollow"
|
|
135
|
+
class="text-base-500 dark:text-base-400 hover:dark:text-base-300 hover:text-base-600 text-sm font-medium"
|
|
136
|
+
>View more replies on bluesky</a
|
|
137
|
+
>
|
|
138
|
+
{/if} -->
|
|
139
|
+
{:else}
|
|
140
|
+
<button onclick={() => (expanded = true)}>
|
|
141
|
+
{@render top(true)}
|
|
142
|
+
</button>
|
|
143
|
+
{/if}
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
{#if comment.replies?.length && depth <= 4 && expanded}
|
|
147
|
+
{#each comment.replies.toSorted((a: any, b: any) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()) as reply}
|
|
148
|
+
<Comment comment={reply} depth={depth + 1} />
|
|
149
|
+
{/each}
|
|
150
|
+
{/if}
|
|
151
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Comment from './Comment.svelte';
|
|
2
|
+
import type { PostData } from '../post';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
comment: PostData;
|
|
5
|
+
depth: number;
|
|
6
|
+
};
|
|
7
|
+
declare const Comment: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type Comment = ReturnType<typeof Comment>;
|
|
9
|
+
export default Comment;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { PostData } from '../post';
|
|
3
|
+
import Comment from './Comment.svelte';
|
|
4
|
+
|
|
5
|
+
let { comments }: { comments: PostData[] } = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
{#if comments.length > 0}
|
|
9
|
+
<div class="pl-3 pt-4">
|
|
10
|
+
{#each comments as comment}
|
|
11
|
+
<Comment {comment} depth={0} />
|
|
12
|
+
{/each}
|
|
13
|
+
</div>
|
|
14
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PostData } from '../post';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
comments: PostData[];
|
|
4
|
+
};
|
|
5
|
+
declare const NestedComments: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type NestedComments = ReturnType<typeof NestedComments>;
|
|
7
|
+
export default NestedComments;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NestedComments } from './NestedComments.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NestedComments } from './NestedComments.svelte';
|