mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-04-30 15:59:33 +08:00
merge with upsteam 2ef763fc34
This commit is contained in:
parent
94a4949f21
commit
a8a6fd43d4
6 changed files with 22 additions and 18 deletions
10
src/app.d.ts
vendored
10
src/app.d.ts
vendored
|
@ -1,6 +1,6 @@
|
||||||
/// <reference types="@sveltejs/kit" />
|
/// <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>> {
|
interface ImportMetaEnv extends Readonly<Record<string, string>> {
|
||||||
readonly URARA_SITE_PROTOCOL?: 'http://' | 'https://'
|
readonly URARA_SITE_PROTOCOL?: 'http://' | 'https://'
|
||||||
|
@ -15,8 +15,8 @@ interface ImportMeta {
|
||||||
declare global {
|
declare global {
|
||||||
namespace Urara {
|
namespace Urara {
|
||||||
namespace Post {
|
namespace Post {
|
||||||
type Frontmatter = Omit<FFFBase, 'created' | 'updated' | 'image' | 'audio' | 'video' | 'flags'> &
|
type Frontmatter = Omit<FFFBase, 'flags'> &
|
||||||
Pick<FFFExtra, 'in_reply_to'> & {
|
Pick<FFFMention, 'in_reply_to'> & {
|
||||||
/**
|
/**
|
||||||
* post type.
|
* post type.
|
||||||
* @remarks auto-generated
|
* @remarks auto-generated
|
||||||
|
@ -51,6 +51,10 @@ declare global {
|
||||||
* @remarks auto-generated or set manually
|
* @remarks auto-generated or set manually
|
||||||
*/
|
*/
|
||||||
updated: string
|
updated: string
|
||||||
|
/**
|
||||||
|
* the published date of the post.
|
||||||
|
*/
|
||||||
|
published?: string
|
||||||
/**
|
/**
|
||||||
* the featured image for article, or image for "photo" / "multi-photo" posts.
|
* the featured image for article, or image for "photo" / "multi-photo" posts.
|
||||||
* @remarks currently only supports string
|
* @remarks currently only supports string
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let id: string
|
export let id: string
|
||||||
export let list: boolean = undefined
|
export let list: boolean | undefined = undefined
|
||||||
export let playlist: string = undefined
|
export let playlist: string | undefined = undefined
|
||||||
export let start: string = undefined
|
export let start: string | undefined = undefined
|
||||||
export let autoplay: boolean = false
|
export let autoplay: boolean = false
|
||||||
export let disablekb: boolean = false
|
export let disablekb: boolean = false
|
||||||
export let controls: boolean = true
|
export let controls: boolean = true
|
||||||
export let fs = true
|
export let fs = true
|
||||||
export let loop = false
|
export let loop = false
|
||||||
const src = `https://www.youtube.com/embed/${id}?${new URLSearchParams({
|
const src = `https://www.youtube.com/embed/${id}?${new URLSearchParams({
|
||||||
...(list ? { listType: 'playlist', list } : {}),
|
...(list ? { listType: 'playlist', list: 'true' } : {}),
|
||||||
...(playlist ? { playlist } : {}),
|
...(playlist ? { playlist } : {}),
|
||||||
...(start ? { start } : {}),
|
...(start ? { start } : {}),
|
||||||
autoplay: autoplay ? '1' : '0',
|
autoplay: autoplay ? '1' : '0',
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let post: Urara.Post
|
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>
|
</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">
|
<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}
|
{#if Object.keys(actions).length}
|
||||||
{#each Object.values(actions) as action}
|
{#each Object.values(actions) as action}
|
||||||
<svelte:component this={action.default} {post} />
|
<svelte:component this={action} {post} />
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
|
@ -3,7 +3,7 @@
|
||||||
import { toSnake } from '$lib/utils/case'
|
import { toSnake } from '$lib/utils/case'
|
||||||
export let post: Urara.Post
|
export let post: Urara.Post
|
||||||
export let config: CommentConfig
|
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 currentComment: string | undefined = undefined
|
||||||
let currentConfig: unknown | undefined = undefined
|
let currentConfig: unknown | undefined = undefined
|
||||||
currentComment = localStorage.getItem('comment') ?? toSnake(config.use[0])
|
currentComment = localStorage.getItem('comment') ?? toSnake(config.use[0])
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
{#if config.use.length > 1}
|
{#if config.use.length > 1}
|
||||||
<div class="tabs w-full mb-8" class:tabs-boxed={config?.['style'] === 'boxed'}>
|
<div class="tabs w-full mb-8" class:tabs-boxed={config?.['style'] === 'boxed'}>
|
||||||
{#each config.use as name}
|
{#each config.use as name}
|
||||||
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
<span
|
<span
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
currentComment = toSnake(name)
|
currentComment = toSnake(name)
|
||||||
|
@ -33,7 +34,7 @@
|
||||||
{#if currentComment}
|
{#if currentComment}
|
||||||
{#key currentComment}
|
{#key currentComment}
|
||||||
<svelte:component
|
<svelte:component
|
||||||
this={comments[`/src/lib/components/comments/${currentComment}.svelte`].default}
|
this={comments[`/src/lib/components/comments/${currentComment}.svelte`]}
|
||||||
{post}
|
{post}
|
||||||
config={currentConfig} />
|
config={currentConfig} />
|
||||||
{/key}
|
{/key}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
<nav class="flex flex-col md:flex-row flex-warp justify-evenly">
|
<nav class="flex flex-col md:flex-row flex-warp justify-evenly">
|
||||||
{#if prev}
|
{#if prev}
|
||||||
<div
|
<div
|
||||||
href={prev.path}
|
|
||||||
class:image-full={prev['image']}
|
class:image-full={prev['image']}
|
||||||
class:md:rounded-r-box={next && !next['image']}
|
class:md:rounded-r-box={next && !next['image']}
|
||||||
class="flex-1 card group rounded-none before:!rounded-none overflow-hidden">
|
class="flex-1 card group rounded-none before:!rounded-none overflow-hidden">
|
||||||
|
@ -34,7 +33,6 @@
|
||||||
{/if}
|
{/if}
|
||||||
{#if next}
|
{#if next}
|
||||||
<div
|
<div
|
||||||
href={next.path}
|
|
||||||
class:image-full={next['image']}
|
class:image-full={next['image']}
|
||||||
class:md:rounded-l-box={prev && !prev['image']}
|
class:md:rounded-l-box={prev && !prev['image']}
|
||||||
class="flex-1 card group rounded-none before:!rounded-none overflow-hidden">
|
class="flex-1 card group rounded-none before:!rounded-none overflow-hidden">
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
<ul dir="ltr" id="toc-list-root">
|
<ul dir="ltr" id="toc-list-root">
|
||||||
{#each toc as { depth, title, slug }}
|
{#each toc as { depth, title, slug }}
|
||||||
<li id={`toc-item-${slug}`} class="flex flex-col">
|
<li id={`toc-item-${slug}`} class="flex flex-col">
|
||||||
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
<span
|
<span
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
on:click={() =>
|
on:click={() =>
|
||||||
|
|
Loading…
Reference in a new issue