refactor: manually write like 3,000 import statements because i must test my willpower
This commit is contained in:
274 files changed
+1222
-1702
No files matched your search
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { TextInput, Select, Option } from 'mono-svelte'
|
||||
import { Option, Select, TextInput } from 'mono-svelte'
|
||||
|
||||
const multipliers = {
|
||||
minute: 60,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/app/auth.svelte.js'
|
||||
import ProgressBar from '$lib/ui/info/ProgressBar.svelte'
|
||||
import { profile } from '$lib/app/auth.svelte'
|
||||
import { errorMessage } from '$lib/app/error'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { uploadImage } from '$lib/util.svelte.js'
|
||||
import { uploadImage } from '$lib/app/util.svelte'
|
||||
import { Button, toast } from 'mono-svelte'
|
||||
import { DocumentPlus, Icon } from 'svelte-hero-icons'
|
||||
import { DocumentPlus, Icon } from 'svelte-hero-icons/dist'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { slide } from 'svelte/transition'
|
||||
import ProgressBar from '../info/ProgressBar.svelte'
|
||||
|
||||
interface Props {
|
||||
image?: FileList | null
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { Button, Modal, TextInput } from 'mono-svelte'
|
||||
import Switch from '../input/Switch.svelte'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { Button, Modal, TextInput } from 'mono-svelte'
|
||||
import ImageAttachForm from './ImageAttachForm.svelte'
|
||||
import Switch from './Switch.svelte'
|
||||
|
||||
let {
|
||||
open = $bindable(),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { Label } from 'mono-svelte'
|
||||
import { DocumentPlus, Icon, Plus } from 'svelte-hero-icons'
|
||||
import { DocumentPlus, Icon, Plus } from 'svelte-hero-icons/dist'
|
||||
import ImageInputModal from './ImageInputModal.svelte'
|
||||
|
||||
let {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { DocumentPlus, Icon } from 'svelte-hero-icons'
|
||||
import { Label, TextInput } from 'mono-svelte'
|
||||
import { DocumentPlus, Icon } from 'svelte-hero-icons/dist'
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
interface Props {
|
||||
accept?: string
|
||||
@@ -52,7 +51,7 @@
|
||||
class="w-full max-w-sm h-full rounded-lg"
|
||||
/>
|
||||
{:else if url}
|
||||
<img src={url} />
|
||||
<img src={url} alt="" />
|
||||
{:else}
|
||||
<Icon src={DocumentPlus} class="opacity-50" size="36" />
|
||||
<p class="text-sm opacity-50">Attach a file</p>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script lang="ts">
|
||||
import Avatar from '$lib/ui/generic/Avatar.svelte'
|
||||
import { getClient } from '$lib/api/client.svelte'
|
||||
import type { Community, ListingType } from '$lib/api/types'
|
||||
import { MenuButton, Search } from 'mono-svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { Icon, ServerStack, XCircle } from 'svelte-hero-icons'
|
||||
import { Icon, ServerStack, XCircle } from 'svelte-hero-icons/dist'
|
||||
import { fly } from 'svelte/transition'
|
||||
import Avatar from '../generic/Avatar.svelte'
|
||||
|
||||
interface Props {
|
||||
type?: 'community' | 'instance'
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { findClosestNumber } from '$lib/util.svelte.js'
|
||||
import { createAvatar } from '@dicebear/core'
|
||||
import * as initials from '@dicebear/initials'
|
||||
import { findClosestNumber } from '$lib/app/util.svelte'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
|
||||
const sizes = [16, 24, 32, 48, 64, 96, 128, 256, 512]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/app/i18n'
|
||||
import Markdown from '$lib/app/markdown/Markdown.svelte'
|
||||
import { Expandable } from 'mono-svelte'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import Markdown from '../../app/markdown/Markdown.svelte'
|
||||
import FormattedNumber from '../../components/util/FormattedNumber.svelte'
|
||||
import FormattedNumber from '../util/FormattedNumber.svelte'
|
||||
import Avatar from './Avatar.svelte'
|
||||
import Expandable from '../shared/disclosure/Expandable.svelte'
|
||||
|
||||
interface Props {
|
||||
avatar?: string | undefined
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<script lang="ts" module>
|
||||
import { pushState } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { Button, Material, toast } from 'mono-svelte'
|
||||
import { Share, XMark } from 'svelte-hero-icons/dist'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { fade, scale } from 'svelte/transition'
|
||||
import { trapFocus } from 'trap-focus-svelte'
|
||||
|
||||
export function showImage(url: string) {
|
||||
pushState('', {
|
||||
@@ -9,14 +16,6 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { Button, Material, toast } from 'mono-svelte'
|
||||
import { Share, XMark } from 'svelte-hero-icons'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { fade, scale } from 'svelte/transition'
|
||||
import { trapFocus } from 'trap-focus-svelte'
|
||||
|
||||
interface Props {
|
||||
/**
|
||||
* The full-resolution image URL
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import Avatar from '$lib/ui/generic/Avatar.svelte'
|
||||
import CommonList from '$comp/ui/layout/CommonList.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { CommonList } from '../layout'
|
||||
import Avatar from './Avatar.svelte'
|
||||
|
||||
interface Props {
|
||||
items: {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { onDestroy } from 'svelte'
|
||||
import { ExclamationTriangle, Icon } from 'svelte-hero-icons'
|
||||
import { ExclamationTriangle, Icon } from 'svelte-hero-icons/dist'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { fly, slide } from 'svelte/transition'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import FormattedNumber from '../../components/util/FormattedNumber.svelte'
|
||||
import FormattedNumber from '../util/FormattedNumber.svelte'
|
||||
|
||||
interface Props {
|
||||
label: string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
import { type IconSource, Icon } from 'svelte-hero-icons/dist'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte'
|
||||
import Avatar from '../Avatar.svelte'
|
||||
import Avatar from '../generic/Avatar.svelte'
|
||||
|
||||
interface Props {
|
||||
href?: string
|
||||
icon?: string
|
||||
title: string
|
||||
detail?: string
|
||||
orientation: 'vertical' | 'horizontal'
|
||||
orientation?: 'vertical' | 'horizontal'
|
||||
children?: Snippet
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script lang="ts" generics="T">
|
||||
import type { Snippet } from 'svelte'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
|
||||
const sizeDelay: Record<'lg' | 'md' | 'sm' | 'xs', number> = {
|
||||
lg: 120,
|
||||
md: 80,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation'
|
||||
import { page as pageData } from '$app/state'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { ChevronLeft, ChevronRight, Icon } from 'svelte-hero-icons'
|
||||
import { ChevronLeft, ChevronRight, Icon } from 'svelte-hero-icons/dist'
|
||||
import { backOut } from 'svelte/easing'
|
||||
import { fly } from 'svelte/transition'
|
||||
import { page as pageData } from '$app/state'
|
||||
import { invalidate } from '$app/navigation'
|
||||
import { SvelteURLSearchParams } from 'svelte/reactivity'
|
||||
import { fly } from 'svelte/transition'
|
||||
|
||||
interface Props {
|
||||
page?: number
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { navigating, page } from '$app/state'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { MagnifyingGlass } from 'svelte-hero-icons'
|
||||
import { MagnifyingGlass } from 'svelte-hero-icons/dist'
|
||||
|
||||
interface Props {
|
||||
query?: string | null
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { settings } from '$lib/app/settings.svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import type {
|
||||
ClassValue,
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
<script lang="ts">
|
||||
import { browser } from '$app/environment'
|
||||
import { page } from '$app/state'
|
||||
import type { GetPosts, ListingType, PostView } from '$lib/api/types'
|
||||
import type {
|
||||
GetPosts,
|
||||
ListingType,
|
||||
PostView,
|
||||
SortType,
|
||||
} from '$lib/api/types'
|
||||
import { settings } from '$lib/app/settings.svelte'
|
||||
import Location from '$lib/feature/filter/Location.svelte'
|
||||
import Sort from '$lib/feature/filter/Sort.svelte'
|
||||
import ViewSelect from '$lib/feature/filter/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'
|
||||
import PostFeed from '$lib/feature/post/feed/PostFeed.svelte'
|
||||
import VirtualFeed from '$lib/feature/post/feed/VirtualFeed.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import { ArrowRight, Icon } from 'svelte-hero-icons'
|
||||
import { ArrowRight, Icon } from 'svelte-hero-icons/dist'
|
||||
import { Header, Pageination } from '..'
|
||||
|
||||
interface Props {
|
||||
posts: PostView[]
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { invalidateAll } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import TabButton from '$comp/input/TabButton.svelte'
|
||||
import { SvelteURL } from 'svelte/reactivity'
|
||||
|
||||
interface Props {
|
||||
routes: {
|
||||
href: string
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { Button } from 'mono-svelte'
|
||||
import type { ButtonProps } from 'mono-svelte/button/Button.svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons/dist'
|
||||
|
||||
interface Props extends ButtonProps {
|
||||
label: string
|
||||
@@ -66,7 +66,7 @@
|
||||
</Button>
|
||||
|
||||
<style>
|
||||
@reference '../../../../app.css';
|
||||
@reference '../../../app.css';
|
||||
|
||||
:global {
|
||||
.prefix {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { notifications, profile } from '$lib/app/auth.svelte.js'
|
||||
import { site } from '$lib/api/client.svelte'
|
||||
import { amModOfAny, isAdmin } from '$comp/lemmy/moderation/moderation.js'
|
||||
import Avatar from '$lib/ui/generic/Avatar.svelte'
|
||||
import { notifications, profile } from '$lib/app/auth.svelte'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte'
|
||||
import { amModOfAny, isAdmin } from '$lib/feature/moderation/moderation'
|
||||
import { Menu, Spinner } from 'mono-svelte'
|
||||
import {
|
||||
Bars3,
|
||||
@@ -15,9 +14,10 @@
|
||||
PencilSquare,
|
||||
ServerStack,
|
||||
ShieldCheck,
|
||||
} from 'svelte-hero-icons'
|
||||
} from 'svelte-hero-icons/dist'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import Logo from '../Logo.svelte'
|
||||
import Avatar from '../generic/Avatar.svelte'
|
||||
import Logo from '../generic/Logo.svelte'
|
||||
import CommandsWrapper from './commands/CommandsWrapper.svelte'
|
||||
import NavButton from './NavButton.svelte'
|
||||
|
||||
@@ -108,7 +108,6 @@
|
||||
isSelectedFilter={(path) => path.startsWith('/create')}
|
||||
icon={PencilSquare}
|
||||
class="order-2 md:order-3 nav-btn-sm-primary"
|
||||
alwaysShowIcon
|
||||
/>
|
||||
<Menu placement="bottom">
|
||||
{#snippet target(attachment)}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { notifications, profile } from '$lib/app/auth.svelte'
|
||||
import { amModOfAny, isAdmin } from '$comp/lemmy/moderation/moderation'
|
||||
|
||||
import SiteCard from '$comp/lemmy/instance/InstanceCard.svelte'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { site } from '$lib/api/client.svelte'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { notifications, profile } from '$lib/app/auth.svelte'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { settings } from '$lib/app/settings.svelte'
|
||||
import { theme } from '$lib/app/theme/theme.svelte'
|
||||
import InstanceCard from '$lib/feature/instance/InstanceCard.svelte'
|
||||
import { amModOfAny, isAdmin } from '$lib/feature/moderation/moderation'
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
@@ -36,12 +35,12 @@
|
||||
Swatch,
|
||||
UserCircle,
|
||||
UserGroup,
|
||||
} from 'svelte-hero-icons'
|
||||
} from 'svelte-hero-icons/dist'
|
||||
</script>
|
||||
|
||||
{#snippet siteSnippet()}
|
||||
{#if site.data}
|
||||
<SiteCard
|
||||
<InstanceCard
|
||||
site={site.data.site_view}
|
||||
admins={site.data.admins}
|
||||
taglines={site.data.taglines}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
<script lang="ts">
|
||||
import Avatar from '$lib/ui/generic/Avatar.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { ArrowUturnDown, Icon, QuestionMarkCircle } from 'svelte-hero-icons'
|
||||
import type { HTMLButtonAttributes } from 'svelte/elements'
|
||||
import Avatar from '../../Avatar.svelte'
|
||||
import type { Action } from './actions.svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import {
|
||||
ArrowUturnDown,
|
||||
Icon,
|
||||
QuestionMarkCircle,
|
||||
} from 'svelte-hero-icons/dist'
|
||||
import type { HTMLButtonAttributes } from 'svelte/elements'
|
||||
import type { Action } from './actions.svelte'
|
||||
|
||||
interface Props {
|
||||
action: Action
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
import { page } from '$app/state'
|
||||
import { profile } from '$lib/app/auth.svelte'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { resumables } from '$lib/lemmy/item'
|
||||
import { theme } from '$lib/app/theme/theme.svelte'
|
||||
import { fuzzySearch } from '$lib/util.svelte'
|
||||
import { fuzzySearch } from '$lib/app/util.svelte'
|
||||
import { resumables } from '$lib/feature/legacy/item'
|
||||
import { CommonList } from '$lib/ui/layout'
|
||||
import EndPlaceholder from '$lib/ui/layout/EndPlaceholder.svelte'
|
||||
import { TextInput } from 'mono-svelte'
|
||||
import { createEventDispatcher, onMount } from 'svelte'
|
||||
import { Home, Icon, MagnifyingGlass } from 'svelte-hero-icons'
|
||||
import EndPlaceholder from '../../EndPlaceholder.svelte'
|
||||
import CommonList from '../../layout/CommonList.svelte'
|
||||
import { getGroups, type Action, type Group } from './actions.svelte'
|
||||
import { Home, Icon, MagnifyingGlass } from 'svelte-hero-icons/dist'
|
||||
import { type Action, type Group, getGroups } from './actions.svelte'
|
||||
import CommandItem from './CommandItem.svelte'
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -4,12 +4,12 @@ import {
|
||||
profile as currentProfile,
|
||||
type ProfileInfo,
|
||||
} from '$lib/app/auth.svelte'
|
||||
import { amModOfAny, isAdmin } from '$comp/lemmy/moderation/moderation'
|
||||
import { t } from '$lib/app/i18n/translations'
|
||||
import { type ResumableItem } from '$lib/lemmy/item'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { settings } from '$lib/app/settings.svelte'
|
||||
import { theme, type ThemeData } from '$lib/app/theme/theme.svelte'
|
||||
import { fullCommunityName } from '$lib/util.svelte'
|
||||
import { fullCommunityName } from '$lib/app/util.svelte'
|
||||
import type { ResumableItem } from '$lib/feature/legacy/item'
|
||||
import { amModOfAny, isAdmin } from '$lib/feature/moderation/moderation'
|
||||
import {
|
||||
ArrowRightOnRectangle,
|
||||
ArrowTrendingDown,
|
||||
@@ -44,7 +44,7 @@ import {
|
||||
UserGroup,
|
||||
ViewColumns,
|
||||
type IconSource,
|
||||
} from 'svelte-hero-icons'
|
||||
} from '@xylightdev/svelte-hero-icons'
|
||||
import { SvelteURL } from 'svelte/reactivity'
|
||||
|
||||
export interface Group {
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
import { t } from '$lib/app/i18n/translations'
|
||||
import {
|
||||
type IconSource,
|
||||
Home,
|
||||
ChartBar,
|
||||
Cog6Tooth,
|
||||
Newspaper,
|
||||
GlobeAmericas,
|
||||
GlobeAlt,
|
||||
MagnifyingGlass,
|
||||
ShieldCheck,
|
||||
ServerStack,
|
||||
PencilSquare,
|
||||
MapPin,
|
||||
Fire,
|
||||
ArrowTrendingUp,
|
||||
Star,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
export interface Link {
|
||||
url: string
|
||||
label?: string
|
||||
}
|
||||
|
||||
export const getDefaultLinks = (): Link[] => [
|
||||
{
|
||||
url: '/',
|
||||
label: t.get('nav.home'),
|
||||
},
|
||||
{
|
||||
url: '/?type=All',
|
||||
label: t.get('filter.location.all'),
|
||||
},
|
||||
{
|
||||
url: '/?type=Local',
|
||||
label: t.get('filter.location.local'),
|
||||
},
|
||||
{
|
||||
url: '/?type=Subscribed',
|
||||
label: t.get('filter.location.subscribed'),
|
||||
},
|
||||
{
|
||||
url: '/?type=All&sort=Hot',
|
||||
label: t.get('filter.sort.hot'),
|
||||
},
|
||||
{
|
||||
url: '/?type=All&sort=Active',
|
||||
label: t.get('filter.sort.active'),
|
||||
},
|
||||
{
|
||||
url: '/?type=All&sort=TopDay',
|
||||
label: t.get('filter.sort.top.time.day'),
|
||||
},
|
||||
{
|
||||
url: '/?type=All&sort=New',
|
||||
label: t.get('filter.sort.new'),
|
||||
},
|
||||
{
|
||||
url: '/communities',
|
||||
label: t.get('nav.communities'),
|
||||
},
|
||||
{
|
||||
url: '/search',
|
||||
label: t.get('nav.search'),
|
||||
},
|
||||
{
|
||||
url: '/moderation',
|
||||
label: t.get('moderation.label'),
|
||||
},
|
||||
{
|
||||
url: '/admin',
|
||||
label: t.get('admin.label'),
|
||||
},
|
||||
{
|
||||
url: '/settings',
|
||||
label: t.get('nav.menu.settings'),
|
||||
},
|
||||
{
|
||||
url: '/create/post',
|
||||
label: t.get('form.post.create'),
|
||||
},
|
||||
]
|
||||
|
||||
export const iconOfLink = (url: string): IconSource => {
|
||||
switch (url) {
|
||||
case '/':
|
||||
return Home
|
||||
case '/?type=All':
|
||||
return GlobeAmericas
|
||||
case '/?type=Subscribed':
|
||||
return Newspaper
|
||||
case '/?type=Local':
|
||||
return MapPin
|
||||
case '/?type=All&sort=Hot':
|
||||
return Fire
|
||||
case '/?type=All&sort=Active':
|
||||
return ArrowTrendingUp
|
||||
case '/?type=All&sort=TopDay':
|
||||
return ChartBar
|
||||
case '/?type=All&sort=New':
|
||||
return Star
|
||||
case '/communities':
|
||||
return GlobeAlt
|
||||
case '/search':
|
||||
return MagnifyingGlass
|
||||
case '/moderation':
|
||||
return ShieldCheck
|
||||
case '/admin':
|
||||
return ServerStack
|
||||
case '/settings':
|
||||
return Cog6Tooth
|
||||
case '/create/post':
|
||||
return PencilSquare
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,13 @@
|
||||
<script module lang="ts">
|
||||
import { Spinner } from 'mono-svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import { type IconSource, Icon } from 'svelte-hero-icons/dist'
|
||||
import type {
|
||||
ClassValue,
|
||||
HTMLAnchorAttributes,
|
||||
HTMLButtonAttributes,
|
||||
} from 'svelte/elements'
|
||||
|
||||
export type ButtonColor = keyof typeof buttonColor
|
||||
export type ButtonAlignment = keyof typeof buttonAlignment
|
||||
export type ButtonShadow = keyof typeof buttonShadow
|
||||
@@ -83,16 +92,6 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import type {
|
||||
ClassValue,
|
||||
HTMLAnchorAttributes,
|
||||
HTMLButtonAttributes,
|
||||
} from 'svelte/elements'
|
||||
|
||||
import Spinner from '../loader/Spinner.svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
|
||||
let {
|
||||
loading = false,
|
||||
submit = false,
|
||||
@@ -163,7 +162,7 @@
|
||||
-->
|
||||
|
||||
<style>
|
||||
@reference "../../../app.css";
|
||||
@reference "../../../../app.css";
|
||||
|
||||
:global {
|
||||
.btn {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { Disclosure } from 'mono-svelte'
|
||||
import { Minus, Plus, Icon } from 'svelte-hero-icons'
|
||||
import { Icon, Minus, Plus } from 'svelte-hero-icons/dist'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
|
||||
interface Props {
|
||||
open?: boolean
|
||||
icon?: boolean
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import Button from '../button/Button.svelte'
|
||||
import { generateID } from '../forms/helper.js'
|
||||
import { Label } from '../index.js'
|
||||
import { Button, Label } from 'mono-svelte'
|
||||
import { generateID } from './helper'
|
||||
|
||||
interface Props {
|
||||
accept?: string
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<script module lang="ts">
|
||||
import { Label } from 'mono-svelte'
|
||||
import type { ClassValue, HTMLTextareaAttributes } from 'svelte/elements'
|
||||
import { generateID } from './helper'
|
||||
|
||||
export type Size = keyof typeof sizeClass
|
||||
|
||||
export const sizeClass = {
|
||||
@@ -27,11 +31,6 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import type { ClassValue, HTMLTextareaAttributes } from 'svelte/elements'
|
||||
|
||||
import Label from '../forms/Label.svelte'
|
||||
import { generateID } from '../forms/helper.js'
|
||||
|
||||
const borderClass = `
|
||||
border border-slate-200 dark:border-zinc-800
|
||||
`
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<script module lang="ts">
|
||||
import { Label } from 'mono-svelte'
|
||||
import type { HTMLInputAttributes } from 'svelte/elements'
|
||||
import { generateID } from './helper'
|
||||
|
||||
export type Size = keyof typeof sizeClass
|
||||
export type Shadow = keyof typeof shadowClass
|
||||
|
||||
@@ -34,11 +38,6 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import type { HTMLInputAttributes } from 'svelte/elements'
|
||||
|
||||
import Label from '../forms/Label.svelte'
|
||||
import { generateID } from '../forms/helper.js'
|
||||
|
||||
const borderClass = `border border-slate-200 border-b-slate-300 dark:border-zinc-800`
|
||||
|
||||
let {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { locale } from '$lib/app/i18n'
|
||||
import { getContext, onDestroy, type Snippet } from 'svelte'
|
||||
import type { IconSource } from 'svelte-hero-icons'
|
||||
import { type Snippet, getContext, onDestroy } from 'svelte'
|
||||
import type { IconSource } from 'svelte-hero-icons/dist'
|
||||
import type { HTMLOptionAttributes } from 'svelte/elements'
|
||||
|
||||
interface Props extends Omit<HTMLOptionAttributes, 'prefix'> {
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
<script lang="ts" module>
|
||||
import { Label, Menu, MenuButton } from 'mono-svelte'
|
||||
import { buttonSize } from 'mono-svelte/button/Button.svelte'
|
||||
import { type Snippet, setContext, tick } from 'svelte'
|
||||
import type { Placement } from 'svelte-floating-ui/dom'
|
||||
import {
|
||||
CheckCircle,
|
||||
ChevronUpDown,
|
||||
Icon,
|
||||
type IconSource,
|
||||
} from 'svelte-hero-icons/dist'
|
||||
import type { Attachment } from 'svelte/attachments'
|
||||
import type { ClassValue, HTMLSelectAttributes } from 'svelte/elements'
|
||||
|
||||
interface Props<T> extends Omit<HTMLSelectAttributes, 'size'> {
|
||||
value?: T | string | undefined
|
||||
placeholder?: string | undefined
|
||||
@@ -33,21 +46,6 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" generics="T">
|
||||
import { setContext, tick, type Snippet } from 'svelte'
|
||||
import type { Placement } from 'svelte-floating-ui/dom'
|
||||
import {
|
||||
CheckCircle,
|
||||
ChevronUpDown,
|
||||
Icon,
|
||||
type IconSource,
|
||||
} from 'svelte-hero-icons'
|
||||
import type { Attachment } from 'svelte/attachments'
|
||||
import type { ClassValue, HTMLSelectAttributes } from 'svelte/elements'
|
||||
import { buttonSize } from '../../button/Button.svelte'
|
||||
import Menu from '../../popover/Menu.svelte'
|
||||
import MenuButton from '../../popover/MenuButton.svelte'
|
||||
import Label from '../Label.svelte'
|
||||
|
||||
let open = $state(false)
|
||||
let element: HTMLSelectElement | undefined = $state()
|
||||
|
||||
@@ -176,7 +174,3 @@
|
||||
{/if}
|
||||
{/each}
|
||||
</Menu>
|
||||
|
||||
<style>
|
||||
@reference '../../../../app.css';
|
||||
</style>
|
||||
@@ -1,14 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { pushState, replaceState } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { Button } from 'mono-svelte'
|
||||
import Portal from 'mono-svelte/popover/Portal.svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import { XMark } from 'svelte-hero-icons'
|
||||
import { XMark } from 'svelte-hero-icons/dist'
|
||||
import { backOut } from 'svelte/easing'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import { fade, scale } from 'svelte/transition'
|
||||
import { trapFocus } from 'trap-focus-svelte'
|
||||
import { Button } from '../index.js'
|
||||
import Portal from '../popover/Portal.svelte'
|
||||
|
||||
interface Props {
|
||||
action?: string | undefined
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import Button from '../button/Button.svelte'
|
||||
import Modal from '../modal/Modal.svelte'
|
||||
import { Icon } from 'svelte-hero-icons'
|
||||
import { shownModal } from './modal.js'
|
||||
|
||||
let open = $state(false)
|
||||
|
||||
// reactivity hack
|
||||
run(() => {
|
||||
open = $shownModal ? true : false
|
||||
})
|
||||
import { Button, Modal } from 'mono-svelte'
|
||||
import { Icon } from 'svelte-hero-icons/dist'
|
||||
import { shownModal } from './modal'
|
||||
</script>
|
||||
|
||||
{#if $shownModal}
|
||||
@@ -19,7 +9,7 @@
|
||||
title={$shownModal.title}
|
||||
dismissable={$shownModal.dismissable}
|
||||
ondismissed={() => shownModal.set(undefined)}
|
||||
bind:open
|
||||
bind:open={$shownModal}
|
||||
>
|
||||
{#if $shownModal.snippet}
|
||||
{@render $shownModal.snippet()}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { t } from '$lib/app/i18n/translations'
|
||||
import { type Snippet } from 'svelte'
|
||||
import type { IconSource } from 'svelte-hero-icons'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import type { IconSource } from '@xylightdev/svelte-hero-icons'
|
||||
import type { Snippet } from 'svelte'
|
||||
import { writable } from 'svelte/store'
|
||||
|
||||
export const shownModal = writable<Modal | undefined>()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Material } from 'mono-svelte'
|
||||
import { Icon, InformationCircle } from 'svelte-hero-icons/dist'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import { Material } from '../index.js'
|
||||
import { Icon, InformationCircle } from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
content?: string | undefined
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
flip,
|
||||
offset,
|
||||
shift,
|
||||
type Middleware,
|
||||
type Placement,
|
||||
type Strategy,
|
||||
} from '@floating-ui/core'
|
||||
import Popover from '../popover/Popover.svelte'
|
||||
flip,
|
||||
offset,
|
||||
shift,
|
||||
} from '@floating-ui/dom'
|
||||
import { Popover } from 'mono-svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import type { Attachment } from 'svelte/attachments'
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte'
|
||||
import Button, {
|
||||
import { Button } from 'mono-svelte'
|
||||
import {
|
||||
type ButtonAlignment,
|
||||
type ButtonColor,
|
||||
type ButtonProps,
|
||||
} from '../button/Button.svelte'
|
||||
import { ChevronRight, Icon, type IconSource } from 'svelte-hero-icons'
|
||||
} from 'mono-svelte/button/Button.svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import { ChevronRight, Icon, type IconSource } from 'svelte-hero-icons/dist'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
|
||||
interface Props extends ButtonProps {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
flip,
|
||||
offset,
|
||||
shift,
|
||||
type Middleware,
|
||||
type Placement,
|
||||
type Strategy,
|
||||
} from '@floating-ui/core'
|
||||
flip,
|
||||
offset,
|
||||
shift,
|
||||
} from '@floating-ui/dom'
|
||||
import { Material } from 'mono-svelte'
|
||||
import { createFloatingActions } from 'svelte-floating-ui'
|
||||
import type { Attachment } from 'svelte/attachments'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { scale } from 'svelte/transition'
|
||||
import { trapFocus } from 'trap-focus-svelte'
|
||||
import { Material } from '../index'
|
||||
import Portal from './Portal.svelte'
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { browser } from '$app/environment'
|
||||
import { createEventDispatcher, onDestroy, onMount } from 'svelte'
|
||||
|
||||
// https://github.com/sveltejs/svelte/issues/3088#issuecomment-505785516
|
||||
import { onMount, onDestroy, createEventDispatcher } from 'svelte'
|
||||
|
||||
let slottedElements = $state<HTMLDivElement>(),
|
||||
portal: HTMLDivElement
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<script lang="ts" module>
|
||||
import { Menu, MenuButton, Spinner, TextInput } from 'mono-svelte'
|
||||
import type { TextInputProps } from 'mono-svelte/forms/TextInput.svelte'
|
||||
import { debounce } from 'mono-svelte/util/time'
|
||||
import { Icon, MagnifyingGlass } from 'svelte-hero-icons/dist'
|
||||
|
||||
interface Props<T> extends Omit<TextInputProps, 'onselect' | 'children'> {
|
||||
query?: string
|
||||
selected?: T | undefined
|
||||
@@ -24,11 +29,6 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" generics="T">
|
||||
import type { TextInputProps } from 'mono-svelte/forms/TextInput.svelte'
|
||||
import { Menu, TextInput, Spinner, MenuButton } from '../index.js'
|
||||
import { debounce } from '../util/time.js'
|
||||
import { Icon, MagnifyingGlass } from 'svelte-hero-icons'
|
||||
|
||||
let items: T[] = $state([])
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<script lang="ts">
|
||||
import { Spinner } from '../index.js'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { type Toast, toasts, toastColors } from './toasts.js'
|
||||
import {
|
||||
InformationCircle,
|
||||
ExclamationTriangle,
|
||||
ExclamationCircle,
|
||||
CheckCircle,
|
||||
Icon,
|
||||
XMark,
|
||||
Check,
|
||||
} from 'svelte-hero-icons'
|
||||
import { fly } from 'svelte/transition'
|
||||
import Markdown from '$lib/app/markdown/Markdown.svelte'
|
||||
import { Spinner } from 'mono-svelte'
|
||||
import {
|
||||
Check,
|
||||
CheckCircle,
|
||||
ExclamationCircle,
|
||||
ExclamationTriangle,
|
||||
Icon,
|
||||
InformationCircle,
|
||||
XMark,
|
||||
} from 'svelte-hero-icons/dist'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { fly } from 'svelte/transition'
|
||||
import { type Toast, toastColors, toasts } from './toasts'
|
||||
|
||||
interface Props {
|
||||
toast: Toast
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import Toast from './Toast.svelte'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { toasts } from './toasts.js'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import Toast from './Toast.svelte'
|
||||
import { toasts } from './toasts'
|
||||
</script>
|
||||
|
||||
<div
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<script lang="ts" module>
|
||||
import { locale } from '$lib/app/i18n'
|
||||
import { settings } from '$lib/app/settings.svelte'
|
||||
|
||||
export function formatRelativeDate(
|
||||
date: Date,
|
||||
options: Intl.RelativeTimeFormatOptions,
|
||||
locale?: string,
|
||||
relativeTo?: Date,
|
||||
) {
|
||||
try {
|
||||
const now = relativeTo?.getTime() ?? Date.now()
|
||||
|
||||
const diffInMillis = now - date.getTime()
|
||||
|
||||
const thresholds = [
|
||||
{ unit: 'second', threshold: 1000 },
|
||||
{ unit: 'minute', threshold: 60 * 1000 },
|
||||
{ unit: 'hour', threshold: 60 * 60 * 1000 },
|
||||
{ unit: 'day', threshold: 24 * 60 * 60 * 1000 },
|
||||
{ unit: 'week', threshold: 7 * 24 * 60 * 60 * 1000 },
|
||||
{ unit: 'month', threshold: 30 * 24 * 60 * 60 * 1000 },
|
||||
{ unit: 'year', threshold: 365 * 24 * 60 * 60 * 1000 },
|
||||
]
|
||||
|
||||
for (let i = thresholds.length - 1; i >= 0; i--) {
|
||||
if (diffInMillis >= thresholds[i].threshold) {
|
||||
const value = Math.round(diffInMillis / thresholds[i].threshold)
|
||||
|
||||
let language = locale ?? 'en'
|
||||
|
||||
if (settings.absoluteDates) {
|
||||
const rtf = new Intl.DateTimeFormat(language, {
|
||||
...options,
|
||||
timeStyle: 'short',
|
||||
dateStyle: 'short',
|
||||
})
|
||||
return rtf.format(date)
|
||||
} else {
|
||||
const rtf = new Intl.RelativeTimeFormat(language, options)
|
||||
return rtf.format(-value, thresholds[i].unit as 'second')
|
||||
}
|
||||
}
|
||||
}
|
||||
return 'Now'
|
||||
} catch {
|
||||
return 'Invalid Date'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
const toLocaleDateString = (date: Date): string => {
|
||||
try {
|
||||
return date.toLocaleString()
|
||||
} catch {
|
||||
return 'Invalid Date'
|
||||
}
|
||||
}
|
||||
|
||||
interface Props {
|
||||
date: Date
|
||||
relativeTo?: Date | undefined
|
||||
options?: Intl.RelativeTimeFormatOptions
|
||||
style?: string
|
||||
class?: string
|
||||
}
|
||||
|
||||
let {
|
||||
date,
|
||||
relativeTo = undefined,
|
||||
options = {
|
||||
numeric: 'always',
|
||||
style: 'narrow',
|
||||
},
|
||||
style = '',
|
||||
class: clazz = '',
|
||||
}: Props = $props()
|
||||
|
||||
let dateTime = $derived(toLocaleDateString(date))
|
||||
</script>
|
||||
|
||||
<time datetime={dateTime} title={dateTime} class={clazz} {style}>
|
||||
{formatRelativeDate(date, options, $locale, relativeTo)}
|
||||
</time>
|
||||
@@ -1,13 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { notifications, profile } from '$lib/app/auth.svelte.js'
|
||||
import ItemList from '$lib/ui/generic/ItemList.svelte'
|
||||
import Expandable from 'mono-svelte/disclosure/Expandable.svelte'
|
||||
import SidebarButton from '$comp/ui/sidebar/SidebarButton.svelte'
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { notifications, profile } from '$lib/app/auth.svelte'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { communityLink } from '$lib/util.svelte'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { settings } from '$lib/app/settings.svelte'
|
||||
import { theme } from '$lib/app/theme/theme.svelte'
|
||||
import { Badge, Option, Select } from 'mono-svelte'
|
||||
import { communityLink } from '$lib/app/util.svelte'
|
||||
import ProfileSelection from '$lib/feature/user/ProfileSelection.svelte'
|
||||
import { Badge, Expandable, Option, Select } from 'mono-svelte'
|
||||
import {
|
||||
ArrowLeftOnRectangle,
|
||||
Bookmark,
|
||||
@@ -22,13 +21,12 @@
|
||||
Swatch,
|
||||
UserCircle,
|
||||
UserGroup,
|
||||
} from 'svelte-hero-icons'
|
||||
} from 'svelte-hero-icons/dist'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import EndPlaceholder from '../EndPlaceholder.svelte'
|
||||
import ProfileSelection from './ProfileSelection.svelte'
|
||||
import Logo from '../Logo.svelte'
|
||||
import { env } from '$env/dynamic/public'
|
||||
import Link from '$comp/input/Link.svelte'
|
||||
import ItemList from '../generic/ItemList.svelte'
|
||||
import Logo from '../generic/Logo.svelte'
|
||||
import EndPlaceholder from '../layout/EndPlaceholder.svelte'
|
||||
import SidebarButton from './SidebarButton.svelte'
|
||||
|
||||
interface Props {
|
||||
style?: string
|
||||
@@ -182,12 +180,18 @@
|
||||
</span>
|
||||
</div>
|
||||
{#if env.PUBLIC_XYLIGHT_MODE?.toLowerCase() == 'true'}
|
||||
<Link highlight href="https://github.com/xyphyn/photon">
|
||||
<a
|
||||
class="text-blue-600 dark:text-blue-400"
|
||||
href="https://github.com/xyphyn/photon"
|
||||
>
|
||||
{$t('nav.menu.source')}
|
||||
</Link>
|
||||
<Link highlight href="https://buymeacoffee.com/xylight">
|
||||
</a>
|
||||
<a
|
||||
class="text-blue-600 dark:text-blue-400"
|
||||
href="https://buymeacoffee.com/xylight"
|
||||
>
|
||||
{$t('nav.menu.donate')}
|
||||
</Link>
|
||||
</a>
|
||||
{/if}
|
||||
</footer>
|
||||
</nav>
|
||||
@@ -1,4 +1,7 @@
|
||||
<script lang="ts" module>
|
||||
import { locale } from '$lib/app/i18n'
|
||||
import { settings } from '$lib/app/settings.svelte'
|
||||
|
||||
export function formatRelativeDate(
|
||||
date: Date,
|
||||
options: Intl.RelativeTimeFormatOptions,
|
||||
@@ -47,9 +50,6 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { locale } from '$lib/app/i18n'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
|
||||
const toLocaleDateString = (date: Date): string => {
|
||||
try {
|
||||
return date.toLocaleString()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import DebugTree from '$lib/ui/util/debug/DebugTree.svelte'
|
||||
import { Modal } from 'mono-svelte'
|
||||
import DebugTree from './DebugTree.svelte'
|
||||
|
||||
interface Props {
|
||||
object: any
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import DebugTree from './DebugTree.svelte'
|
||||
|
||||
interface Props {
|
||||
object: any
|
||||
isParent?: boolean
|
||||
|
||||
Reference in new issue
Block a user