merge with upsteam 2ef763fc34

This commit is contained in:
sevichecc 2023-01-26 00:15:28 +08:00
parent 94a4949f21
commit a8a6fd43d4
6 changed files with 22 additions and 18 deletions

10
src/app.d.ts vendored
View file

@ -1,6 +1,6 @@
/// <reference types="@sveltejs/kit" />
import { FFFBase, FFFExtra } from 'fff-flavored-frontmatter'
import type { FFFBase, FFFMention } from 'fff-flavored-frontmatter'
interface ImportMetaEnv extends Readonly<Record<string, string>> {
readonly URARA_SITE_PROTOCOL?: 'http://' | 'https://'
@ -15,8 +15,8 @@ interface ImportMeta {
declare global {
namespace Urara {
namespace Post {
type Frontmatter = Omit<FFFBase, 'created' | 'updated' | 'image' | 'audio' | 'video' | 'flags'> &
Pick<FFFExtra, 'in_reply_to'> & {
type Frontmatter = Omit<FFFBase, 'flags'> &
Pick<FFFMention, 'in_reply_to'> & {
/**
* post type.
* @remarks auto-generated
@ -51,6 +51,10 @@ declare global {
* @remarks auto-generated or set manually
*/
updated: string
/**
* the published date of the post.
*/
published?: string
/**
* the featured image for article, or image for "photo" / "multi-photo" posts.
* @remarks currently only supports string

View file

@ -1,15 +1,15 @@
<script lang="ts">
export let id: string
export let list: boolean = undefined
export let playlist: string = undefined
export let start: string = undefined
export let list: boolean | undefined = undefined
export let playlist: string | undefined = undefined
export let start: string | undefined = undefined
export let autoplay: boolean = false
export let disablekb: boolean = false
export let controls: boolean = true
export let fs = true
export let loop = false
const src = `https://www.youtube.com/embed/${id}?${new URLSearchParams({
...(list ? { listType: 'playlist', list } : {}),
...(list ? { listType: 'playlist', list: 'true' } : {}),
...(playlist ? { playlist } : {}),
...(start ? { start } : {}),
autoplay: autoplay ? '1' : '0',
@ -29,4 +29,4 @@
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
loading="lazy"
allowfullscreen />
</div>
</div>

View file

@ -1,12 +1,12 @@
<script lang="ts">
export let post: Urara.Post
const actions = import.meta.glob<{ default: unknown }>('/src/lib/components/actions/*.svelte', { eager: true })
const actions = import.meta.glob<any>('/src/lib/components/actions/*.svelte', { eager: true, import: 'default' })
</script>
<div class="sticky top-24 hidden xl:flex flex-col gap-4 w-fit h-[calc(100vh-12rem)] ml-auto mr-8 my-8 justify-center">
{#if Object.keys(actions).length}
{#each Object.values(actions) as action}
<svelte:component this={action.default} {post} />
<svelte:component this={action} {post} />
{/each}
{/if}
</div>
</div>

View file

@ -3,7 +3,7 @@
import { toSnake } from '$lib/utils/case'
export let post: Urara.Post
export let config: CommentConfig
const comments = import.meta.glob<{ default: unknown }>('/src/lib/components/comments/*.svelte', { eager: true })
const comments = import.meta.glob<any>('/src/lib/components/comments/*.svelte', { eager: true, import: 'default' })
let currentComment: string | undefined = undefined
let currentConfig: unknown | undefined = undefined
currentComment = localStorage.getItem('comment') ?? toSnake(config.use[0])
@ -16,6 +16,7 @@
{#if config.use.length > 1}
<div class="tabs w-full mb-8" class:tabs-boxed={config?.['style'] === 'boxed'}>
{#each config.use as name}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<span
on:click={() => {
currentComment = toSnake(name)
@ -33,10 +34,10 @@
{#if currentComment}
{#key currentComment}
<svelte:component
this={comments[`/src/lib/components/comments/${currentComment}.svelte`].default}
this={comments[`/src/lib/components/comments/${currentComment}.svelte`]}
{post}
config={currentConfig} />
{/key}
{/if}
</div>
{/if}
{/if}

View file

@ -7,7 +7,6 @@
<nav class="flex flex-col md:flex-row flex-warp justify-evenly">
{#if prev}
<div
href={prev.path}
class:image-full={prev['image']}
class:md:rounded-r-box={next && !next['image']}
class="flex-1 card group rounded-none before:!rounded-none overflow-hidden">
@ -34,7 +33,6 @@
{/if}
{#if next}
<div
href={next.path}
class:image-full={next['image']}
class:md:rounded-l-box={prev && !prev['image']}
class="flex-1 card group rounded-none before:!rounded-none overflow-hidden">
@ -56,4 +54,4 @@
</div>
</div>
{/if}
</nav>
</nav>

View file

@ -55,6 +55,7 @@
<ul dir="ltr" id="toc-list-root">
{#each toc as { depth, title, slug }}
<li id={`toc-item-${slug}`} class="flex flex-col">
<!-- svelte-ignore a11y-click-events-have-key-events -->
<span
dir="ltr"
on:click={() =>
@ -76,4 +77,4 @@
{/each}
</ul>
</nav>
</aside>
</aside>