Merge remote-tracking branch 'origin/optimization/markdown-etc' into optimize-css

This commit is contained in:
Xylight committed 2025-09-22 18:35:16 -07:00
commit c91d9c993e
163 files changed
+5518 -598

No files matched your search

+1 -4
View File
@@ -1,9 +1,6 @@
import { browser } from '$app/environment'
import { env } from '$env/dynamic/public'
import {
amModOfAny,
isAdmin,
} from '$lib/components/lemmy/moderation/moderation.js'
import { amModOfAny, isAdmin } from '$comp/lemmy/moderation/moderation.js'
import { DEFAULT_INSTANCE_URL } from '$lib/instance.svelte.js'
import { client, getClient, site } from '$lib/client/lemmy.svelte'
import { instanceToURL, moveItem } from '$lib/util.svelte'
+2 -2
View File
@@ -232,11 +232,11 @@ export function toFeedView(
// Query calls
export function fromGetPosts(
getPosts: GetPosts,
): components['schemas']['GetPosts'] {
): components['parameters']['GetPosts'] {
return {
...getPosts,
sort: toSortType(getPosts.sort),
page_cursor: Number(getPosts.page_cursor),
page: Number(getPosts.page_cursor),
}
}
+475 -45
View File
@@ -260,6 +260,7 @@ export interface paths {
| 'Subscribed'
| 'Popular'
| 'Moderating'
| 'ModeratorView'
page?: number
sort?:
| 'Active'
@@ -277,6 +278,7 @@ export interface paths {
| 'TopYear'
| 'TopAll'
| 'Scaled'
| 'Old'
community_name?: string
community_id?: number
}
@@ -1301,6 +1303,7 @@ export interface paths {
| 'TopYear'
| 'TopAll'
| 'Scaled'
| 'Old'
page?: number
limit?: number
/** @description Limit posts/comments to just a single community */
@@ -2685,6 +2688,7 @@ export interface paths {
| 'TopSixHour'
| 'TopTwelveHour'
| 'TopWeek'
| 'TopDay'
| 'TopMonth'
| 'TopThreeMonths'
| 'TopSixMonths'
@@ -2694,7 +2698,13 @@ export interface paths {
| 'New'
| 'Scaled'
| 'Active'
type_?: 'All' | 'Local' | 'Subscribed'
type_?:
| 'All'
| 'Local'
| 'Subscribed'
| 'Popular'
| 'Moderating'
| 'ModeratorView'
community_name?: string
community_id?: number
saved_only?: boolean
@@ -3645,6 +3655,349 @@ export interface paths {
patch?: never
trace?: never
}
'/api/alpha/private_message/list': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
/** List private messages. */
get: {
parameters: {
query?: {
page?: number
limit?: number
unread_only?: boolean
}
header?: never
path?: never
cookie?: never
}
requestBody?: never
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['ListPrivateMessagesResponse']
}
}
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
422: components['responses']['UNPROCESSABLE_CONTENT']
}
}
put?: never
post?: never
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/api/alpha/private_message/conversation': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
/** Get conversation with a specific person. */
get: {
parameters: {
query: {
person_id: number
page?: number
limit?: number
}
header?: never
path?: never
cookie?: never
}
requestBody?: never
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['GetPrivateMessageConversationResponse']
}
}
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
422: components['responses']['UNPROCESSABLE_CONTENT']
}
}
put?: never
post?: never
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/api/alpha/private_message': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
/** Edit a private message. */
put: {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
requestBody: {
content: {
'application/json': components['schemas']['EditPrivateMessageRequest']
}
}
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['PrivateMessageResponse']
}
}
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
422: components['responses']['UNPROCESSABLE_CONTENT']
}
}
/** Create a new private message. */
post: {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
requestBody: {
content: {
'application/json': components['schemas']['CreatePrivateMessageRequest']
}
}
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['PrivateMessageResponse']
}
}
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
422: components['responses']['UNPROCESSABLE_CONTENT']
/** @description Too Many Requests */
429: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
}
}
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/api/alpha/private_message/mark_as_read': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/** Mark a private message as read or unread. */
post: {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
requestBody: {
content: {
'application/json': components['schemas']['MarkPrivateMessageAsReadRequest']
}
}
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['PrivateMessageResponse']
}
}
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
422: components['responses']['UNPROCESSABLE_CONTENT']
}
}
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/api/alpha/private_message/delete': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/** Delete or restore a private message. */
post: {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
requestBody: {
content: {
'application/json': components['schemas']['DeletePrivateMessageRequest']
}
}
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['PrivateMessageResponse']
}
}
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
422: components['responses']['UNPROCESSABLE_CONTENT']
}
}
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
'/api/alpha/private_message/report': {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
get?: never
put?: never
/** Report a private message. */
post: {
parameters: {
query?: never
header?: never
path?: never
cookie?: never
}
requestBody: {
content: {
'application/json': components['schemas']['ReportPrivateMessageRequest']
}
}
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['PrivateMessageResponse']
}
}
/** @description Bad Request */
400: {
headers: {
[name: string]: unknown
}
content: {
'application/json': components['schemas']['DefaultError']
}
}
422: components['responses']['UNPROCESSABLE_CONTENT']
}
}
delete?: never
options?: never
head?: never
patch?: never
trace?: never
}
}
export type webhooks = Record<string, never>
export interface components {
@@ -3696,12 +4049,16 @@ export interface components {
/** Format: html */
about_html?: string
/** Format: url */
avatar?: string
avatar?: string | null
/** Format: url */
banner?: string
banner?: string | null
flair?: string
published: string
title?: string
/**
* Format: datetime
* @example 2025-06-07T02:29:07.980084Z
*/
published?: string
title?: string | null
}
PersonView: {
activity_alert: boolean
@@ -3762,12 +4119,12 @@ export interface components {
title: string
banned?: boolean
/** Format: url */
banner?: string
banner?: string | null
/** Format: markdown */
description?: string
/** Format: url */
icon?: string
posting_warning?: string
icon?: string | null
posting_warning?: string | null
/**
* Format: datetime
* @example 2025-06-07T02:29:07.980084Z
@@ -3775,8 +4132,8 @@ export interface components {
updated?: string
}
CommunityBlockView: {
community: components['schemas']['Community']
person: components['schemas']['Person']
community?: components['schemas']['Community']
person?: components['schemas']['Person']
}
CommunityFollowerView: {
community: components['schemas']['Community']
@@ -3813,8 +4170,9 @@ export interface components {
| 'Subscribed'
| 'Popular'
| 'Moderating'
| 'ModeratorView'
/** @enum {string} */
default_sort_type:
default_sort_type?:
| 'Active'
| 'Hot'
| 'New'
@@ -3830,6 +4188,7 @@ export interface components {
| 'TopYear'
| 'TopAll'
| 'Scaled'
| 'Old'
show_bot_accounts: boolean
show_nsfl: boolean
show_nsfw: boolean
@@ -3948,7 +4307,7 @@ export interface components {
* Format: url
* @description Legacy tags that existed prior to 1.2 and some tags for remote communities might not have a defined ap_id
*/
ap_id: string
ap_id: string | null
}
CommunityView: {
activity_alert: boolean
@@ -3975,6 +4334,16 @@ export interface components {
published: string
score: number
upvotes: number
cross_posts: number
}
WidthHeight: {
width?: number
height?: number
}
MiniCrossPosts: {
post_id?: number
reply_count?: number
community_name?: string
}
Post: {
/** Format: url */
@@ -4009,6 +4378,8 @@ export interface components {
updated?: string
/** Format: url */
url?: string
image_details?: components['schemas']['WidthHeight']
cross_posts?: components['schemas']['MiniCrossPosts'][]
}
PostView: {
banned_from_community: boolean
@@ -4130,7 +4501,7 @@ export interface components {
}
ListCommunitiesResponse: {
communities: components['schemas']['CommunityView'][]
next_page?: string
next_page?: string | null
}
FollowCommunityRequest: {
community_id: number
@@ -4152,12 +4523,12 @@ export interface components {
name: string
title: string
/** Format: url */
banner_url?: string
banner_url?: string | null
/** Format: markdown */
description?: string
discussion_languages?: number[]
/** Format: url */
icon_url?: string
icon_url?: string | null
local_only?: boolean
nsfw?: boolean
restricted_to_mods?: boolean
@@ -4167,12 +4538,12 @@ export interface components {
community_id: number
title?: string
/** Format: url */
banner_url?: string
banner_url?: string | null
/** Format: markdown */
description?: string
discussion_languages?: number[]
/** Format: url */
icon_url?: string
icon_url?: string | null
local_only?: boolean
nsfw?: boolean
restricted_to_mods?: boolean
@@ -4203,17 +4574,17 @@ export interface components {
* Format: datetime
* @example 2025-06-07T02:29:07.980084Z, null=permanent ban
*/
expired_at?: string
expired_at?: string | null
/**
* Format: datetime
* @example 2025-06-07T02:29:07.980084Z, null=permanent ban
*/
expires_at?: string
expires_at?: string | null
reason?: string
}
CommunityModerationBansListResponse: {
items?: components['schemas']['CommunityModerationBanItem'][]
next_page?: string
next_page?: string | null
}
CommunityModerationUnbanRequest: {
community_id: number
@@ -4271,7 +4642,7 @@ export interface components {
* Format: url
* @description Legacy tags that existed prior to 1.2 and some tags for remote communities might not have a defined ap_id
*/
ap_id: string
ap_id: string | null
}
CommunityFlairEditRequest: {
flair_id: number
@@ -4307,7 +4678,7 @@ export interface components {
* Format: url
* @description Legacy tags that existed prior to 1.2 and some tags for remote communities might not have a defined ap_id
*/
ap_id: string
ap_id: string | null
}
CommunityFlairDeleteRequest: {
flair_id: number
@@ -4351,14 +4722,14 @@ export interface components {
/** @description user_id of the feed creator/owner */
user_id: number
/** Format: url */
banner?: string
banner?: string | null
/** Format: markdown */
description?: string
description?: string | null
/** Format: html */
description_html?: string
description_html?: string | null
/** Format: url */
icon?: string
parent_feed_id?: number
icon?: string | null
parent_feed_id?: number | null
}
FeedListResponse: {
feeds: components['schemas']['FeedView'][]
@@ -4371,7 +4742,7 @@ export interface components {
name: string
show_posts_from_children: boolean
title: string
parent_topic_id?: number
parent_topic_id?: number | null
}
TopicListResponse: {
topics: components['schemas']['TopicView'][]
@@ -4429,11 +4800,11 @@ export interface components {
subscribed: 'Subscribed' | 'NotSubscribed' | 'Pending'
}
UserRepliesResponse: {
next_page: number
next_page?: string | null
replies: components['schemas']['CommentReplyView'][]
}
UserMentionsResponse: {
next_page: number
next_page?: string | null
replies: components['schemas']['CommentReplyView'][]
}
UserBlockRequest: {
@@ -4461,14 +4832,14 @@ export interface components {
* Format: url
* @description Pass a null value to remove the image
*/
avatar?: string
avatar?: string | null
/** Format: markdown */
bio?: string
/**
* Format: url
* @description Pass a null value to remove the image
*/
cover?: string
cover?: string | null
/** @enum {string} */
default_comment_sort_type?: 'Hot' | 'Top' | 'New' | 'Old'
/** @enum {string} */
@@ -4518,7 +4889,7 @@ export interface components {
/** @enum {string} */
status: 'All' | 'Unread' | 'Read'
username: string
next_page: number
next_page?: string | null
}
UserNotificationStateRequest: {
notif_id: number
@@ -4535,14 +4906,14 @@ export interface components {
UserSetFlairRequest: {
community_id: number
/** @description Either omit or set to null to remove existing flair */
flair_text?: string
flair_text?: string | null
}
UserSetFlairResponse: {
person_view: components['schemas']['PersonView']
}
ListCommentsResponse: {
comments: components['schemas']['CommentView'][]
next_page?: string
next_page?: string | null
}
LikeCommentRequest: {
comment_id: number
@@ -4578,7 +4949,11 @@ export interface components {
body: string
comment_id: number
language_id?: number
distinguished?: boolean
/**
* @description Visibly mark reply as from a moderator in the web UI
* @default false
*/
distinguished: boolean
}
DeleteCommentRequest: {
comment_id: number
@@ -4598,7 +4973,7 @@ export interface components {
id: number
creator_id: number
comment_id: number
original_comment_text: string
original_comment_text?: string
reason?: string
resolved: boolean
/**
@@ -4657,12 +5032,12 @@ export interface components {
creator: components['schemas']['Person']
}
ListCommentLikesResponse: {
comment_likes?: components['schemas']['CommentLikeView'][]
next_page?: string
comment_likes: components['schemas']['CommentLikeView'][]
next_page?: string | null
}
ListPostsResponse: {
posts: components['schemas']['PostView'][]
next_page?: string
next_page?: string | null
}
GetPostResponse: {
post_view: components['schemas']['PostView']
@@ -4690,12 +5065,13 @@ export interface components {
}
GetPostRepliesResponse: {
comments?: components['schemas']['PostReplyView'][]
next_page?: string
next_page?: string | null
}
LikePostRequest: {
post_id: number
score: number
private?: boolean
auth?: string
}
SavePostRequest: {
post_id: number
@@ -4739,7 +5115,11 @@ export interface components {
original_post_body: string
reason: string
resolved: boolean
published: string
/**
* Format: datetime
* @example 2025-06-07T02:29:07.980084Z
*/
published?: string
}
PostReportView: {
post_report: components['schemas']['PostReport']
@@ -4788,13 +5168,13 @@ export interface components {
creator: components['schemas']['Person']
}
ListPostLikesResponse: {
post_likes?: components['schemas']['PostLikeView'][]
next_page?: string
post_likes: components['schemas']['PostLikeView'][]
next_page?: string | null
}
PostSetFlairRequest: {
post_id: number
/** @description A list of all the flair id to assign to the post. Either pass an empty list or null to remove flair */
flair_id_list?: number[]
flair_id_list?: number[] | null
}
PostSetFlairResponse: {
banned_from_community: boolean
@@ -4826,6 +5206,56 @@ export interface components {
saved_only?: boolean
q?: string
}
PrivateMessage: {
id: number
creator_id: number
recipient_id: number
content: string
deleted: boolean
read: boolean
/**
* Format: datetime
* @example 2025-06-07T02:29:07.980084Z
*/
published: string
/** Format: url */
ap_id: string
local: boolean
}
PrivateMessageView: {
private_message: components['schemas']['PrivateMessage']
creator: components['schemas']['Person']
recipient: components['schemas']['Person']
}
ListPrivateMessagesResponse: {
private_messages: components['schemas']['PrivateMessageView'][]
}
GetPrivateMessageConversationResponse: {
private_messages: components['schemas']['PrivateMessageView'][]
}
CreatePrivateMessageRequest: {
content: string
recipient_id: number
}
PrivateMessageResponse: {
private_message_view: components['schemas']['PrivateMessageView']
}
EditPrivateMessageRequest: {
private_message_id: number
content: string
}
MarkPrivateMessageAsReadRequest: {
private_message_id: number
read: boolean
}
DeletePrivateMessageRequest: {
private_message_id: number
deleted: boolean
}
ReportPrivateMessageRequest: {
private_message_id: number
reason: string
}
}
responses: {
/** @description Unprocessable Content */
@@ -2,5 +2,5 @@ import type { PaginationCursor } from './schemas'
import type { PostView } from './schemas'
export interface GetPostsResponse {
posts: Array<PostView>
next_page?: PaginationCursor
next_page: PaginationCursor
}
@@ -1,6 +1,6 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte.js'
import ProgressBar from '$lib/components/ui/ProgressBar.svelte'
import ProgressBar from '$comp/ui/ProgressBar.svelte'
import { t } from '$lib/i18n/translations'
import { errorMessage } from '$lib/lemmy/error'
import { uploadImage } from '$lib/util.svelte.js'
@@ -1,5 +1,5 @@
<script lang="ts">
import Avatar from '$lib/components/ui/Avatar.svelte'
import Avatar from '$comp/ui/Avatar.svelte'
import { getClient } from '$lib/client/lemmy.svelte'
import type { Community, ListingType } from '$lib/client/types'
import { MenuButton, Search } from 'mono-svelte'
+3 -3
View File
@@ -2,9 +2,9 @@
import { profile } from '$lib/auth.svelte'
import { client } from '$lib/client/lemmy.svelte'
import type { LocalImage, Person } from '$lib/client/types'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import { publishedToDate } from '$lib/components/util/date'
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
import UserLink from '$comp/lemmy/user/UserLink.svelte'
import { publishedToDate } from '$comp/util/date'
import RelativeDate from '$comp/util/RelativeDate.svelte'
import { t } from '$lib/i18n/translations'
import { instance } from '$lib/instance.svelte'
import { instanceToURL } from '$lib/util.svelte'
@@ -1,12 +1,12 @@
<script lang="ts">
import { page } from '$app/state'
import { profile } from '$lib/auth.svelte.js'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import Markdown from '$lib/components/markdown/Markdown.svelte'
import { publishedToDate } from '$lib/components/util/date.js'
import UserLink from '$comp/lemmy/user/UserLink.svelte'
import Markdown from '$comp/markdown/Markdown.svelte'
import { publishedToDate } from '$comp/util/date.js'
import RelativeDate, {
formatRelativeDate,
} from '$lib/components/util/RelativeDate.svelte'
} from '$comp/util/RelativeDate.svelte'
import { t } from '$lib/i18n/translations'
import { getClient } from '$lib/client/lemmy.svelte'
import { errorMessage } from '$lib/lemmy/error'
@@ -26,7 +26,8 @@
import type { ClassValue } from 'svelte/elements'
import { slide } from 'svelte/transition'
import type { CommentNodeI } from './comments.svelte'
import { CommentActions, CommentForm } from '.'
import CommentForm from './CommentForm.svelte'
import CommentActions from './CommentActions.svelte'
interface Props {
node: CommentNodeI
@@ -1,12 +1,8 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte.js'
import type { CommentView } from '$lib/client/types'
import CommentModerationMenu from '$lib/components/lemmy/moderation/CommentModerationMenu.svelte'
import {
amMod,
isAdmin,
report,
} from '$lib/components/lemmy/moderation/moderation.js'
import CommentModerationMenu from '$comp/lemmy/moderation/CommentModerationMenu.svelte'
import { amMod, isAdmin, report } from '$comp/lemmy/moderation/moderation.js'
import { t } from '$lib/i18n/translations'
import { deleteItem, save } from '$lib/lemmy/contentview.js'
import { settings } from '$lib/settings.svelte'
@@ -21,7 +17,7 @@
Share,
Trash,
} from 'svelte-hero-icons'
import { CommentVote } from '.'
import CommentVote from './CommentVote.svelte'
interface Props {
comment: CommentView
@@ -1,7 +1,7 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte.js'
import Markdown from '$lib/components/markdown/Markdown.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import Markdown from '$comp/markdown/Markdown.svelte'
import MarkdownEditor from '$comp/markdown/MarkdownEditor.svelte'
import { t } from '$lib/i18n/translations'
import { client, site } from '$lib/client/lemmy.svelte'
import { errorMessage } from '$lib/lemmy/error'
@@ -1,12 +1,12 @@
<script lang="ts">
import { publishedToDate } from '$lib/components/util/date.js'
import { publishedToDate } from '$comp/util/date.js'
import { t } from '$lib/i18n/translations'
import type { CommentView } from '$lib/client/types'
import { Button, Material } from 'mono-svelte'
import { ArrowUturnUp, Icon } from 'svelte-hero-icons'
import type { ClassValue } from 'svelte/elements'
import { PostMeta } from '../post'
import { Comment } from '.'
import Comment from './Comment.svelte'
interface Props {
comment: CommentView
@@ -1,5 +1,5 @@
<script lang="ts">
import VirtualList from '$lib/components/render/VirtualList.svelte'
import VirtualList from '$comp/render/VirtualList.svelte'
import type { Post } from '$lib/client/types'
import type { CommentNodeI } from './comments.svelte'
import Comments from './CommentTree.svelte'
@@ -1,7 +1,7 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte.js'
import { site } from '$lib/client/lemmy.svelte'
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import FormattedNumber from '$comp/util/FormattedNumber.svelte'
import { t } from '$lib/i18n/translations'
import { errorMessage } from '$lib/lemmy/error'
import { settings } from '$lib/settings.svelte'
@@ -121,9 +121,3 @@ export function insertCommentIntoTree(
tree.unshift(node)
}
}
export async function buildCommentsTreeAsync(comments: CommentView[]) {
const result = buildCommentsTree(comments)
return result
}
@@ -1,9 +0,0 @@
export { default as Comment } from './Comment.svelte'
export { default as CommentActions } from './CommentActions.svelte'
export { default as CommentForm } from './CommentForm.svelte'
export { default as CommentItem } from './CommentItem.svelte'
export { default as CommentListVirtualizer } from './CommentListVirtualizer.svelte'
export { default as CommentTree } from './CommentTree.svelte'
export { default as CommentVote } from './CommentVote.svelte'
export * from './comments.svelte'
@@ -69,17 +69,14 @@
import { profile } from '$lib/auth.svelte.js'
import { client, getClient } from '$lib/client/lemmy.svelte'
import type { CommunityModeratorView, CommunityView } from '$lib/client/types'
import {
amMod,
isAdmin,
} from '$lib/components/lemmy/moderation/moderation.js'
import Markdown from '$lib/components/markdown/Markdown.svelte'
import Avatar from '$lib/components/ui/Avatar.svelte'
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
import Entity from '$lib/components/ui/Entity.svelte'
import Expandable from '$lib/components/ui/Expandable.svelte'
import LabelStat from '$lib/components/ui/LabelStat.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import { amMod, isAdmin } from '$comp/lemmy/moderation/moderation.js'
import Markdown from '$comp/markdown/Markdown.svelte'
import Avatar from '$comp/ui/Avatar.svelte'
import EndPlaceholder from '$comp/ui/EndPlaceholder.svelte'
import Entity from '$comp/ui/Entity.svelte'
import Expandable from '$comp/ui/Expandable.svelte'
import LabelStat from '$comp/ui/LabelStat.svelte'
import SidebarButton from '$comp/ui/sidebar/SidebarButton.svelte'
import { t } from '$lib/i18n/translations'
import { errorMessage } from '$lib/lemmy/error'
import { userLink } from '$lib/util.svelte'
@@ -1,8 +1,8 @@
<script lang="ts">
import { goto } from '$app/navigation'
import { profile } from '$lib/auth.svelte.js'
import ImageInputUpload from '$lib/components/form/ImageInputUpload.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import ImageInputUpload from '$comp/form/ImageInputUpload.svelte'
import MarkdownEditor from '$comp/markdown/MarkdownEditor.svelte'
import { t } from '$lib/i18n/translations'
import { client, site } from '$lib/client/lemmy.svelte'
import { errorMessage } from '$lib/lemmy/error'
@@ -21,7 +21,7 @@
Menu,
} from 'mono-svelte'
import { GlobeAlt, Icon, MapPin, Plus } from 'svelte-hero-icons'
import { Header } from '$lib/components/ui/layout'
import { Header } from '$comp/ui/layout'
interface Props {
/**
@@ -1,9 +1,9 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte'
import EntityHeader from '$lib/components/ui/EntityHeader.svelte'
import Expandable from '$lib/components/ui/Expandable.svelte'
import { formatRelativeDate } from '$lib/components/util/RelativeDate.svelte'
import { publishedToDate } from '$lib/components/util/date'
import EntityHeader from '$comp/ui/EntityHeader.svelte'
import Expandable from '$comp/ui/Expandable.svelte'
import { formatRelativeDate } from '$comp/util/RelativeDate.svelte'
import { publishedToDate } from '$comp/util/date'
import { t } from '$lib/i18n/translations'
import { userLink } from '$lib/util.svelte'
import { settings } from '$lib/settings.svelte'
@@ -1,13 +1,12 @@
<script lang="ts">
import CommonItem from '$comp/ui/layout/CommonItem.svelte'
import { profile } from '$lib/auth.svelte.js'
import { client } from '$lib/client/lemmy.svelte'
import type { CommunityView } from '$lib/client/types'
import CommonItem from '$lib/components/ui/layout/CommonItem.svelte'
import { locale, t } from '$lib/i18n/translations'
import { addSubscription } from '$lib/lemmy/user.js'
import { fullCommunityName } from '$lib/util.svelte.js'
import { Button, modal } from 'mono-svelte'
import type { Snippet } from 'svelte'
import {
Check,
ExclamationTriangle,
@@ -19,14 +18,13 @@
Trash,
} from 'svelte-hero-icons'
import { SvelteURL } from 'svelte/reactivity'
import { CommunityCard } from '.'
import Subscribe from '../../../../routes/communities/Subscribe.svelte'
import CommunityCard from './CommunityCard.svelte'
interface Props {
community: CommunityView
view?: 'cozy' | 'compact'
showCounts?: boolean
children?: Snippet
resolveObject?: boolean
}
@@ -1,6 +1,6 @@
<script lang="ts">
import type { Community } from '$lib/client/types'
import Avatar from '$lib/components/ui/Avatar.svelte'
import Avatar from '$comp/ui/Avatar.svelte'
import { t } from '$lib/i18n/translations'
import { settings } from '$lib/settings.svelte.js'
import { communityLink } from '$lib/util.svelte'
@@ -1,5 +1,5 @@
<script lang="ts">
import Avatar from '$lib/components/ui/Avatar.svelte'
import Avatar from '$comp/ui/Avatar.svelte'
import type { Community } from '$lib/client/types'
interface Props {
@@ -1,7 +0,0 @@
export { default as CommunityCard } from './CommunityCard.svelte'
export { default as CommunityFlair } from './CommunityFlair.svelte'
export { default as CommunityForm } from './CommunityForm.svelte'
export { default as CommunityHeader } from './CommunityHeader.svelte'
export { default as CommunityItem } from './CommunityItem.svelte'
export { default as CommunityLink } from './CommunityLink.svelte'
export { default as CommunityTitle } from './CommunityTitle.svelte'
@@ -1,6 +1,6 @@
<script lang="ts">
import Avatar from '$lib/components/ui/Avatar.svelte'
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
import Avatar from '$comp/ui/Avatar.svelte'
import CommonList from '$comp/ui/layout/CommonList.svelte'
import { Button } from 'mono-svelte'
interface Props {
@@ -1,7 +1,7 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte.js'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import Markdown from '$lib/components/markdown/Markdown.svelte'
import UserLink from '$comp/lemmy/user/UserLink.svelte'
import Markdown from '$comp/markdown/Markdown.svelte'
import type { PrivateMessageView } from '$lib/client/types'
interface Props {
@@ -60,7 +60,7 @@
<div class="flex flex-col gap-1">
{#if taglines && taglines.length > 0}
<Markdown
class="pt-0! mx-3"
class="px-3"
source={taglines[Math.floor(Math.random() * taglines.length)].content}
/>
{/if}
@@ -1,8 +1,8 @@
<script lang="ts">
import { preventDefault } from 'svelte/legacy'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import UserLink from '$comp/lemmy/user/UserLink.svelte'
import MarkdownEditor from '$comp/markdown/MarkdownEditor.svelte'
import { t } from '$lib/i18n/translations'
import type { Person } from '$lib/client/types'
import { Button, Modal } from 'mono-svelte'
@@ -1,14 +1,14 @@
<script lang="ts">
import Avatar from '$lib/components/ui/Avatar.svelte'
import Avatar from '$comp/ui/Avatar.svelte'
import type { Community, Person } from '$lib/client/types'
import { client } from '$lib/client/lemmy.svelte'
import { Label, toast, Button, Modal, Switch } from 'mono-svelte'
import { profile } from '$lib/auth.svelte.js'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import MarkdownEditor from '$comp/markdown/MarkdownEditor.svelte'
import { t } from '$lib/i18n/translations'
import Duration from '$lib/components/form/Duration.svelte'
import Duration from '$comp/form/Duration.svelte'
import { errorMessage } from '$lib/lemmy/error'
import { CommunityLink } from '../community'
import CommunityLink from '../community/CommunityLink.svelte'
interface Props {
open?: boolean
@@ -1,6 +1,6 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte.js'
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
import ShieldIcon from '$comp/lemmy/moderation/ShieldIcon.svelte'
import { t } from '$lib/i18n/translations'
import { isCommentView } from '$lib/lemmy/item.js'
import type { CommentView } from '$lib/client/types'
@@ -1,10 +1,10 @@
<script lang="ts">
import { modals } from '$lib/components/lemmy/moderation/moderation.js'
import { modals } from '$comp/lemmy/moderation/moderation.js'
</script>
<!--These weird await hacks are for lazy loading, better network performance-->
{#if $modals.reporting.open}
{#await import('$lib/components/lemmy/moderation/ReportModal.svelte') then { default: ReportModal }}
{#await import('$comp/lemmy/moderation/ReportModal.svelte') then { default: ReportModal }}
<ReportModal
bind:open={$modals.reporting.open}
bind:item={$modals.reporting.item}
@@ -12,7 +12,7 @@
{/await}
{/if}
{#if $modals.removing.open}
{#await import('$lib/components/lemmy/moderation/RemoveModal.svelte') then { default: RemoveModal }}
{#await import('$comp/lemmy/moderation/RemoveModal.svelte') then { default: RemoveModal }}
<RemoveModal
bind:open={$modals.removing.open}
item={$modals.removing.item}
@@ -21,7 +21,7 @@
{/await}
{/if}
{#if $modals.banning.open}
{#await import('$lib/components/lemmy/moderation/BanModal.svelte') then { default: BanModal }}
{#await import('$comp/lemmy/moderation/BanModal.svelte') then { default: BanModal }}
<BanModal
bind:open={$modals.banning.open}
banned={$modals.banning.banned}
@@ -32,7 +32,7 @@
{/if}
{#if $modals.votes.open}
{#await import('$lib/components/lemmy/moderation/ViewVotesModal.svelte') then { default: VotesModal }}
{#await import('$comp/lemmy/moderation/ViewVotesModal.svelte') then { default: VotesModal }}
<VotesModal bind:open={$modals.votes.open} item={$modals.votes.item} />
{/await}
{/if}
@@ -1,12 +1,12 @@
<script lang="ts">
import { preventDefault, run } from 'svelte/legacy'
import MultiSelect from '$comp/input/Switch.svelte'
import { removalTemplate } from '$comp/lemmy/moderation/moderation.js'
import MarkdownEditor from '$comp/markdown/MarkdownEditor.svelte'
import { profile } from '$lib/auth.svelte.js'
import { getClient } from '$lib/client/lemmy.svelte'
import type { CommentView, PostView } from '$lib/client/types'
import MultiSelect from '$lib/components/input/Switch.svelte'
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import { t } from '$lib/i18n/translations'
import { errorMessage } from '$lib/lemmy/error'
import { isCommentView, isPostView } from '$lib/lemmy/item.js'
@@ -15,7 +15,7 @@
import { Button, Modal, Select, Switch, toast } from 'mono-svelte'
import Option from 'mono-svelte/forms/select/Option.svelte'
import { Fire, Trash } from 'svelte-hero-icons'
import { Comment } from '../comment'
import Comment from '../comment/Comment.svelte'
import { Post } from '../post'
import { amMod, isAdmin } from './moderation'
@@ -2,7 +2,7 @@
import { preventDefault, run } from 'svelte/legacy'
import { profile } from '$lib/auth.svelte.js'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import MarkdownEditor from '$comp/markdown/MarkdownEditor.svelte'
import { t } from '$lib/i18n/translations'
import { getClient } from '$lib/client/lemmy.svelte'
import type {
@@ -14,7 +14,7 @@
import PrivateMessage from '../inbox/PrivateMessage.svelte'
import { errorMessage } from '$lib/lemmy/error'
import { Post } from '../post'
import { Comment } from '../comment'
import Comment from '../comment/Comment.svelte'
interface Props {
open: boolean
@@ -1,4 +1,4 @@
import { publishedToDate } from '$lib/components/util/date.js'
import { publishedToDate } from '$comp/util/date.js'
import type {
CommentReportView,
CommentView,
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte'
import { publishedToDate } from '$lib/components/util/date.js'
import { publishedToDate } from '$comp/util/date.js'
import { settings, type View } from '$lib/settings.svelte.js'
import type { PostView } from '$lib/client/types'
import type { ClassValue } from 'svelte/elements'
@@ -1,5 +1,5 @@
<script lang="ts">
import Markdown from '$lib/components/markdown/Markdown.svelte'
import Markdown from '$comp/markdown/Markdown.svelte'
import { Button } from 'mono-svelte'
import { ChevronDown, Icon } from 'svelte-hero-icons'
@@ -41,14 +41,14 @@
this={htmlElement}
{style}
class="{!expanded
? ` overflow-hidden
? `overflow-hidden
bg-linear-to-b text-transparent from-slate-600 via-slate-600
dark:from-zinc-400 dark:via-zinc-400 bg-clip-text z-0 max-h-36`
: 'text-slate-600 dark:text-zinc-400 max-h-full'} text-base {clazz}"
class:pointer-events-none={!clickThrough}
bind:this={element}
>
<Markdown inline={!expanded} source={expanded ? body : body.slice(0, 1000)} />
<Markdown inline source={expanded ? body : body.slice(0, 1000)} />
{#if overflows}
<Button
onclick={() => (expanded = !expanded)}
@@ -57,13 +57,13 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte'
import type { Community, Person, SubscribedType } from '$lib/client/types'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import Markdown from '$lib/components/markdown/Markdown.svelte'
import Avatar from '$lib/components/ui/Avatar.svelte'
import { publishedToDate } from '$lib/components/util/date'
import UserLink from '$comp/lemmy/user/UserLink.svelte'
import Markdown from '$comp/markdown/Markdown.svelte'
import Avatar from '$comp/ui/Avatar.svelte'
import { publishedToDate } from '$comp/util/date'
import RelativeDate, {
formatRelativeDate,
} from '$lib/components/util/RelativeDate.svelte'
} from '$comp/util/RelativeDate.svelte'
import { t } from '$lib/i18n/translations'
import { settings, type View } from '$lib/settings.svelte'
import { Badge, Material, modal, Popover } from 'mono-svelte'
@@ -80,8 +80,8 @@
Trash,
type IconSource,
} from 'svelte-hero-icons'
import { CommunityLink } from '../community'
import { SvelteMap } from 'svelte/reactivity'
import CommunityLink from '../community/CommunityLink.svelte'
interface Props {
community?: Community
@@ -17,7 +17,7 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte.js'
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import FormattedNumber from '$comp/util/FormattedNumber.svelte'
import { t } from '$lib/i18n/translations'
import { site } from '$lib/client/lemmy.svelte'
import { vote as voteItem } from '$lib/lemmy/contentview.js'
@@ -1,11 +1,8 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte.js'
import {
amMod,
isAdmin,
} from '$lib/components/lemmy/moderation/moderation.js'
import { publishedToDate } from '$lib/components/util/date'
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import { amMod, isAdmin } from '$comp/lemmy/moderation/moderation.js'
import { publishedToDate } from '$comp/util/date'
import FormattedNumber from '$comp/util/FormattedNumber.svelte'
import { t } from '$lib/i18n/translations'
import { save } from '$lib/lemmy/contentview.js'
import { settings, type View } from '$lib/settings.svelte.js'
@@ -122,7 +119,7 @@
<div class="flex-1"></div>
{#if settings.debugInfo}
{#if debug}
{#await import('$lib/components/util/debug/DebugObject.svelte') then { default: DebugObject }}
{#await import('$comp/util/debug/DebugObject.svelte') then { default: DebugObject }}
<DebugObject object={post} bind:open={debug} />
{/await}
{/if}
@@ -137,7 +134,7 @@
></Button>
{/if}
{#if profile.current?.user && (amMod(profile.current.user, post.community) || isAdmin(profile.current.user))}
{#await import('$lib/components/lemmy/moderation/ModerationMenu.svelte') then { default: ModerationMenu }}
{#await import('$comp/lemmy/moderation/ModerationMenu.svelte') then { default: ModerationMenu }}
<ModerationMenu bind:item={post}>
{#snippet target(attachment, acting)}
<Button
@@ -1,6 +1,6 @@
<script lang="ts">
import type { PostView } from '$lib/client/types'
import Placeholder from '$lib/components/ui/Placeholder.svelte'
import Placeholder from '$comp/ui/Placeholder.svelte'
import { settings } from '$lib/settings.svelte.js'
import { Button } from 'mono-svelte'
import type { Snippet } from 'svelte'
@@ -2,9 +2,9 @@
import { browser } from '$app/environment'
import { client } from '$lib/client/lemmy.svelte'
import type { GetPosts } from '$lib/client/types'
import VirtualList from '$lib/components/render/VirtualList.svelte'
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte'
import VirtualList from '$comp/render/VirtualList.svelte'
import EndPlaceholder from '$comp/ui/EndPlaceholder.svelte'
import Placeholder from '$comp/ui/Placeholder.svelte'
import { t } from '$lib/i18n/translations'
import { settings } from '$lib/settings.svelte.js'
import type { PostView } from 'lemmy-js-client'
@@ -13,12 +13,12 @@
import ErrorContainer, {
clearErrorScope,
pushError,
} from '$lib/components/error/ErrorContainer.svelte'
import FreeTextInput from '$lib/components/input/FreeTextInput.svelte'
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import Avatar from '$lib/components/ui/Avatar.svelte'
import { Header } from '$lib/components/ui/layout'
} from '$comp/error/ErrorContainer.svelte'
import FreeTextInput from '$comp/input/FreeTextInput.svelte'
import ObjectAutocomplete from '$comp/lemmy/ObjectAutocomplete.svelte'
import MarkdownEditor from '$comp/markdown/MarkdownEditor.svelte'
import Avatar from '$comp/ui/Avatar.svelte'
import { Header } from '$comp/ui/layout'
import { t } from '$lib/i18n/translations'
import { errorMessage } from '$lib/lemmy/error'
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
@@ -252,7 +252,7 @@
</script>
{#if uploadingImage}
{#await import('$lib/components/form/ImageInputModal.svelte') then { default: UploadModal }}
{#await import('$comp/form/ImageInputModal.svelte') then { default: UploadModal }}
<UploadModal
bind:open={uploadingImage}
bind:imageUrl={() => '', (v) => (data.url = v)}
-3
View File
@@ -8,9 +8,6 @@ export { default as PostMediaCompact } from './media/PostMediaCompact.svelte'
export { default as PostImage } from './media/PostImage.svelte'
export { default as PostIframe } from './media/PostIframe.svelte'
export { default as PostLink } from './link/PostLink.svelte'
export { default as VirtualFeed } from './feed/VirtualFeed.svelte'
export { default as PostFeed } from './feed/PostFeed.svelte'
export { default as PostForm } from './form/PostForm.svelte'
export { default as PostActions } from './actions/PostActions.svelte'
export {
@@ -1,5 +1,5 @@
<script lang="ts">
import { parseURL } from '$lib/components/input/Link.svelte'
import { parseURL } from '$comp/input/Link.svelte'
import type { View } from '$lib/settings.svelte'
import { Material } from 'mono-svelte'
import { optimizeImageURL } from '../helpers'
@@ -1,5 +1,5 @@
<script lang="ts">
import { showImage } from '$lib/components/ui/ExpandableImage.svelte'
import { showImage } from '$comp/ui/ExpandableImage.svelte'
import { settings } from '$lib/settings.svelte'
import type { Post } from '$lib/client/types'
import { Button, modal } from 'mono-svelte'
@@ -1,6 +1,6 @@
<script lang="ts">
import { bestImageURL, postLink, type MediaType } from '..'
import { showImage } from '$lib/components/ui/ExpandableImage.svelte'
import { showImage } from '$comp/ui/ExpandableImage.svelte'
import { t } from '$lib/i18n/translations'
import { settings, type View } from '$lib/settings.svelte.js'
import type { Post } from '$lib/client/types'
@@ -1,6 +1,6 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte'
import Avatar from '$lib/components/ui/Avatar.svelte'
import Avatar from '$comp/ui/Avatar.svelte'
import { getClient } from '$lib/client/lemmy.svelte'
import type { ListingType, Person } from '$lib/client/types'
import { MenuButton, Search } from 'mono-svelte'
@@ -1,6 +1,6 @@
<script lang="ts">
import Avatar from '$lib/components/ui/Avatar.svelte'
import LabelStat from '$lib/components/ui/LabelStat.svelte'
import Avatar from '$comp/ui/Avatar.svelte'
import LabelStat from '$comp/ui/LabelStat.svelte'
import { userLink } from '$lib/util.svelte'
import type { PersonView } from '$lib/client/types'
@@ -48,8 +48,8 @@
</script>
<script lang="ts">
import Avatar from '$lib/components/ui/Avatar.svelte'
import Logo from '$lib/components/ui/Logo.svelte'
import Avatar from '$comp/ui/Avatar.svelte'
import Logo from '$comp/ui/Logo.svelte'
import { settings } from '$lib/settings.svelte.js'
import type { Person } from '$lib/client/types'
import { Icon, Language, NoSymbol } from 'svelte-hero-icons'
+16 -36
View File
@@ -24,14 +24,10 @@
import { linkify, subSupscriptExtension } from './renderers/plugins.js'
import containerExtension from './renderers/spoiler/spoiler.js'
export const options = {
mangle: false,
headerIds: false,
pedantic: false,
inline: false,
}
marked.setOptions(options)
marked.setOptions({
gfm: true,
breaks: false,
})
marked.use(linkify, {
extensions: [
@@ -87,34 +83,26 @@
listitem: MdListItem,
subscript: MdSubscript,
superscript: MdSuperscript,
space: MdParagraph,
list_item: MdListItem,
text: MdText,
}
export const inlineRenderers = {
heading: MdText,
image: MdText,
link: MdText,
blockquote: MdText,
hr: MdText,
html: MdText,
code: MdText,
list: MdText,
spoiler: MdText,
table: MdText,
tablebody: MdText,
tablecell: MdText,
tablehead: MdText,
tablerow: MdTableRow,
paragraph: MdParagraph,
listitem: MdText,
subscript: MdSubscript,
superscript: MdSuperscript,
text: MdText,
link: MdLink,
}
export type Renderer = keyof typeof renderers
</script>
<script lang="ts">
import SvelteMarkdown from 'svelte-markdown'
import { setContext } from 'svelte'
import type { ClassValue } from 'svelte/elements'
import MdTree from './MdTree.svelte'
interface RendererOptions {
autoloadImages: boolean
@@ -142,21 +130,13 @@
setContext('options', rendererOptions)
options.inline = inline
let tokens = $derived.by(() => marked.lexer(source))
let tokens = $derived(marked.lexer(source))
</script>
<svelte:element
this={inline ? 'div' : 'article'}
<article
dir="auto"
class={[!noStyle && 'break-words space-y-4 leading-normal', clazz]}
{style}
>
<SvelteMarkdown
source={tokens}
renderers={inline ? inlineRenderers : renderers}
{options}
isInline={inline || undefined}
/>
</svelte:element>
<MdTree {tokens} renderers={inline ? inlineRenderers : renderers} />
</article>
@@ -1,6 +1,6 @@
<script lang="ts">
import MultiSelect from '$lib/components/input/Switch.svelte'
import Markdown from '$lib/components/markdown/Markdown.svelte'
import MultiSelect from '$comp/input/Switch.svelte'
import Markdown from '$comp/markdown/Markdown.svelte'
import { t } from '$lib/i18n/translations'
import { Button, Label, Modal, TextArea } from 'mono-svelte'
import type { TextAreaProps } from 'mono-svelte/forms/TextArea.svelte'
+54
View File
@@ -0,0 +1,54 @@
<script lang="ts">
import { type Token } from 'marked'
import type { Renderer } from './Markdown.svelte'
import Self from './MdTree.svelte'
interface Props {
type?: Renderer
raw?: string
renderers: any
tokens?: (Token & { tokens?: Token[]; text?: string })[]
text?: string
}
let { type, tokens = [], renderers, raw, text, ...rest }: Props = $props()
function decodeHtmlEntities(input: string) {
return input
.replace(/&#39;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&amp;/g, '&')
}
</script>
{#if type}
{#if renderers[type]}
{@const Renderer = renderers[type]}
<Renderer {...rest} {raw} {text}>
{#each tokens as token}
{#if token.tokens && token.tokens.length > 0}
<Self tokens={token.tokens} {renderers} {...rest} />
{:else if token.text}
{decodeHtmlEntities(token.text)}
{:else if text}
{text}
{/if}
{/each}
</Renderer>
{/if}
{:else}
{#each tokens as token}
<Self
{...token}
tokens={[token]}
type={token.type as Renderer}
{renderers}
raw={token.raw}
text={token.text}
{...rest}
/>
{/each}
{/if}
@@ -4,8 +4,8 @@
mediaType,
optimizeImageURL,
PostIframe,
} from '$lib/components/lemmy/post'
import { showImage } from '$lib/components/ui/ExpandableImage.svelte'
} from '$comp/lemmy/post'
import { showImage } from '$comp/ui/ExpandableImage.svelte'
import { t } from '$lib/i18n/translations'
import { getContext } from 'svelte'
import { ArrowDownTray, Icon } from 'svelte-hero-icons'
@@ -1,15 +1,8 @@
<script>
import { options } from '../Markdown.svelte'
/**
* @typedef {Object} Props
* @property {import('svelte').Snippet} [children]
*/
/** @type {Props} */
let { children } = $props()
</script>
<p class="leading-[1.7] break-words {options.inline ? '' : 'max-w'}">
<p class="leading-[1.7] break-words max-w">
{@render children?.()}
</p>
@@ -1,13 +1,13 @@
<script lang="ts">
import SvelteMarkdown from 'svelte-markdown'
import { options, renderers } from '../Markdown.svelte'
import Expandable from '$lib/components/ui/Expandable.svelte'
import Expandable from '$comp/ui/Expandable.svelte'
import type { Snippet } from 'svelte'
interface Props {
raw: string
children?: Snippet
}
let { raw }: Props = $props()
let { raw, children }: Props = $props()
function extractTitle(text: string) {
const spoilerRegex = /^::: ?spoiler (.+)\n([\s\S]+?)\n:::/gm
@@ -32,8 +32,8 @@
<Expandable class="border-y border-slate-200 dark:border-zinc-800 py-2">
{#snippet title()}
<div class="text-left">
<SvelteMarkdown source={data.title} {renderers} {options} isInline />
{data.title}
</div>
{/snippet}
<SvelteMarkdown source={data.content} {renderers} {options} />
{@render children?.()}
</Expandable>
@@ -2,12 +2,13 @@
import { browser } from '$app/environment'
import { page } from '$app/state'
import type { GetPosts, ListingType, PostView } from '$lib/client/types'
import Location from '$lib/components/lemmy/dropdowns/Location.svelte'
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
import { PostFeed, VirtualFeed } from '$lib/components/lemmy/post'
import { Header } from '$lib/components/ui/layout'
import Pageination from '$lib/components/ui/layout/Pageination.svelte'
import Location from '$comp/lemmy/dropdowns/Location.svelte'
import Sort from '$comp/lemmy/dropdowns/Sort.svelte'
import ViewSelect from '$comp/lemmy/dropdowns/ViewSelect.svelte'
import PostFeed from '$comp/lemmy/post/feed/PostFeed.svelte'
import VirtualFeed from '$comp/lemmy/post/feed/VirtualFeed.svelte'
import { Header } from '$comp/ui/layout'
import Pageination from '$comp/ui/layout/Pageination.svelte'
import { settings } from '$lib/settings.svelte.js'
import type { SortType } from 'lemmy-js-client'
import Button from 'mono-svelte/button/Button.svelte'
@@ -1,7 +1,7 @@
<script lang="ts">
import { invalidateAll } from '$app/navigation'
import { page } from '$app/state'
import TabButton from '$lib/components/input/switch/TabButton.svelte'
import TabButton from '$comp/input/switch/TabButton.svelte'
import { SvelteURL } from 'svelte/reactivity'
interface Props {
+2 -5
View File
@@ -1,11 +1,8 @@
<script lang="ts">
import { notifications, profile } from '$lib/auth.svelte.js'
import { site } from '$lib/client/lemmy.svelte'
import {
amModOfAny,
isAdmin,
} from '$lib/components/lemmy/moderation/moderation.js'
import Avatar from '$lib/components/ui/Avatar.svelte'
import { amModOfAny, isAdmin } from '$comp/lemmy/moderation/moderation.js'
import Avatar from '$comp/ui/Avatar.svelte'
import { t } from '$lib/i18n/translations'
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
import { Menu, Spinner } from 'mono-svelte'
+2 -5
View File
@@ -1,12 +1,9 @@
<script lang="ts">
import { env } from '$env/dynamic/public'
import { notifications, profile } from '$lib/auth.svelte'
import {
amModOfAny,
isAdmin,
} from '$lib/components/lemmy/moderation/moderation'
import { amModOfAny, isAdmin } from '$comp/lemmy/moderation/moderation'
import SiteCard from '$lib/components/lemmy/instance/InstanceCard.svelte'
import SiteCard from '$comp/lemmy/instance/InstanceCard.svelte'
import { t } from '$lib/i18n/translations'
import { site } from '$lib/client/lemmy.svelte'
import { settings } from '$lib/settings.svelte'
@@ -1,10 +1,7 @@
import { goto } from '$app/navigation'
import { page } from '$app/state'
import { profile as currentProfile, type ProfileInfo } from '$lib/auth.svelte'
import {
amModOfAny,
isAdmin,
} from '$lib/components/lemmy/moderation/moderation'
import { amModOfAny, isAdmin } from '$comp/lemmy/moderation/moderation'
import { t } from '$lib/i18n/translations'
import { type ResumableItem } from '$lib/lemmy/item'
import { settings } from '$lib/settings.svelte'
@@ -1,7 +1,7 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte'
import Avatar from '$lib/components/ui/Avatar.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import Avatar from '$comp/ui/Avatar.svelte'
import SidebarButton from '$comp/ui/sidebar/SidebarButton.svelte'
import { addFavorite } from '$lib/lemmy/item'
import { hasFavorite } from '$lib/lemmy/user'
import type { Community } from '$lib/client/types'
@@ -2,7 +2,7 @@
import { goto } from '$app/navigation'
import { page } from '$app/state'
import { profile, type ProfileInfo } from '$lib/auth.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import SidebarButton from '$comp/ui/sidebar/SidebarButton.svelte'
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte'
import { Icon, QuestionMarkCircle } from 'svelte-hero-icons'
+4 -4
View File
@@ -1,8 +1,8 @@
<script lang="ts">
import { notifications, profile } from '$lib/auth.svelte.js'
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
import Expandable from '$lib/components/ui/Expandable.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import ItemList from '$comp/lemmy/generic/ItemList.svelte'
import Expandable from '$comp/ui/Expandable.svelte'
import SidebarButton from '$comp/ui/sidebar/SidebarButton.svelte'
import { t } from '$lib/i18n/translations'
import { communityLink } from '$lib/util.svelte'
import { settings } from '$lib/settings.svelte.js'
@@ -28,7 +28,7 @@
import ProfileSelection from './ProfileSelection.svelte'
import Logo from '../Logo.svelte'
import { env } from '$env/dynamic/public'
import Link from '$lib/components/input/Link.svelte'
import Link from '$comp/input/Link.svelte'
interface Props {
style?: string
@@ -1,5 +1,5 @@
<script lang="ts">
import DebugTree from '$lib/components/util/debug/DebugTree.svelte'
import DebugTree from '$comp/util/debug/DebugTree.svelte'
import { Modal } from 'mono-svelte'
interface Props {
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import type { Profile } from '$lib/auth.svelte.js'
import Avatar from '$lib/components/ui/Avatar.svelte'
import Avatar from '$comp/ui/Avatar.svelte'
import { Icon, UserCircle } from 'svelte-hero-icons'
interface Props {
+4 -4
View File
@@ -56,7 +56,7 @@ export interface FeedTypes {
{
posts: PostView[]
next_page?: string
params: GetPosts
params: GetPostss & { page_cursor: string }
client: {
itemHeights?: (number | null)[]
lastSeen?: number
@@ -69,7 +69,7 @@ export interface FeedTypes {
posts: PostView[]
community: GetCommunityResponse
next_page?: string
params: GetPosts
params: GetPosts & { page_cursor: string }
client: { itemHeights?: (number | null)[]; lastSeen?: number }
},
]
@@ -110,7 +110,7 @@ export interface FeedTypes {
{
posts: PostView[]
next_page?: string
params: GetPosts
params: GetPosts & { page_cursor: string }
feed: Promise<FeedView | undefined>
client: {
itemHeights?: (number | null)[]
@@ -123,7 +123,7 @@ export interface FeedTypes {
{
posts: PostView[]
next_page?: string
params: GetPosts
params: GetPosts & { page_cursor: string }
topic: Promise<TopicView | undefined>
client: {
itemHeights?: (number | null)[]
+10 -19
View File
@@ -1,23 +1,14 @@
<script lang="ts">
const badgeColor = {
red: 'bg-red-500 text-white ring-transparent',
green: 'bg-green-500 text-white dark:text-black ring-transparent',
yellow: 'bg-yellow-500 text-black ring-transparent',
gray: 'bg-gray-600 text-white ring-transparent',
blue: 'bg-blue-500 text-white ring-transparent',
purple: 'bg-purple-500 text-white ring-transparent',
'red-subtle': `bg-red-100 dark:bg-red-500/20 text-red-600 dark:text-red-400
ring-red-400 dark:ring-red-500/30`,
'green-subtle': `bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400
ring-green-400 dark:ring-green-500/30`,
'yellow-subtle': `bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400
ring-yellow-400 dark:ring-yellow-500/30`,
'gray-subtle': `bg-gray-100 dark:bg-gray-500/20 text-gray-700 dark:text-gray-300
ring-gray-400 dark:ring-gray-400/30`,
'blue-subtle': `bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-300
ring-blue-400 dark:ring-blue-400/30`,
'purple-subtle': `bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400
ring-purple-400 dark:ring-purple-500/30`,
'red-subtle':
'bg-red-100 dark:bg-red-500/20 text-red-600 dark:text-red-400',
'green-subtle': `bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`,
'yellow-subtle':
'bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400',
'gray-subtle':
'bg-gray-100 dark:bg-gray-500/20 text-gray-700 dark:text-gray-300',
'blue-subtle':
'bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-300',
custom: '',
}
@@ -56,7 +47,7 @@
{...rest}
class={[
allowIconOnly && 'max-md:px-1.5 max-md:py-1.5',
'text-xs font-medium flex items-center gap-1 ring-1 ring-inset px-2 py-1',
'text-xs font-medium flex items-center gap-1 ring-1 ring-black/20 dark:ring-white/20 ring-inset px-2 py-1',
badgeRoundness[rounding],
badgeColor[color],
clazz,
+1 -1
View File
@@ -12,7 +12,7 @@
Check,
} from 'svelte-hero-icons'
import { fly } from 'svelte/transition'
import Markdown from '$lib/components/markdown/Markdown.svelte'
import Markdown from '$comp/markdown/Markdown.svelte'
interface Props {
toast: Toast
View File
Whitespace-only changes.