diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/blog/InfoCard.svelte | 0 | ||||
| -rw-r--r-- | src/lib/blog/Post.svelte | 45 | ||||
| -rw-r--r-- | src/lib/blog/Post.ts | 28 | ||||
| -rw-r--r-- | src/lib/blog/TableWrapper.svelte | 15 | ||||
| -rw-r--r-- | src/lib/fonts/Ac437_IBM_EGA_8x14.css | 8 | ||||
| -rw-r--r-- | src/lib/fonts/Px437_DOS-V_re_JPN12.css | 8 | ||||
| -rw-r--r-- | src/lib/fonts/PxPlus_IBM_EGA_8x14.css | 8 | ||||
| -rw-r--r-- | src/lib/fonts/all-local-after-woff2.css | 10 | ||||
| -rw-r--r-- | src/lib/fonts/all.css | 10 | ||||
| -rw-r--r-- | src/lib/index.ts | 10 | ||||
| -rw-r--r-- | src/lib/styles.ts | 8 |
11 files changed, 122 insertions, 28 deletions
diff --git a/src/lib/blog/InfoCard.svelte b/src/lib/blog/InfoCard.svelte new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/lib/blog/InfoCard.svelte diff --git a/src/lib/blog/Post.svelte b/src/lib/blog/Post.svelte new file mode 100644 index 0000000..2c61621 --- /dev/null +++ b/src/lib/blog/Post.svelte @@ -0,0 +1,45 @@ +<script lang="ts" module> + export * from './Post'; +</script> + +<script lang="ts"> + import { parsePostMetadata, type Post } from './Post'; + + let { + post, + filename, + }: { + post: Post; + filename?: string; + } = $props(); + + let meta = $derived(parsePostMetadata(post.metadata)); + + let PostComp = $derived(post.default); +</script> + +<div class="flex justify-center"> + <div class="max-w-2xl w-full"> + <h1 class="font-space-grotesk text-5xl mt-8 mb-4"> + <span class="text-accent-primary select-none">: </span + >{meta.title}<span class="text-accent-primary select-none">;</span> + </h1> + <p class="my-4 font-genericmono"> + ctime: {meta.created.toISOString().split('T')[0]}<span class="select-none" + > ▒ </span + >mtime: {meta.updated.toISOString().split('T')[0]}{#if filename}<span + class="select-none"> ▒ </span + ><a + href={encodeURI( + `https://codeberg.org/dmpmem/tilde/src/branch/master/src/routes/blog/${filename}`, + )} + class="quicklink" + target="_blank" + rel="noopener noreferrer">src</a + >{/if} + </p> + <article id="postmd"> + <PostComp /> + </article> + </div> +</div> diff --git a/src/lib/blog/Post.ts b/src/lib/blog/Post.ts new file mode 100644 index 0000000..440dffa --- /dev/null +++ b/src/lib/blog/Post.ts @@ -0,0 +1,28 @@ + +import type { Component } from 'svelte'; + +export type PostMetadata<Parsed extends boolean = false> = { + title: string; + blurb: string; + author: string | null; + slug: string; + id: string | number; + created: Parsed extends true ? Date : string; + updated: Parsed extends true ? Date : string; +}; +export type Post<MetadataParsed extends boolean = false> = { + metadata: PostMetadata<MetadataParsed>; + default: Component; +}; + +export const parsePostMetadata = ( + m: PostMetadata<boolean>, +): PostMetadata<true> => ({ + ...m, + created: new Date(m.created), + updated: new Date(m.updated), +}); +export const parsePost = (p: Post<boolean>): Post<true> => ({ + ...p, + metadata: parsePostMetadata(p.metadata), +}); diff --git a/src/lib/blog/TableWrapper.svelte b/src/lib/blog/TableWrapper.svelte new file mode 100644 index 0000000..ddf3d73 --- /dev/null +++ b/src/lib/blog/TableWrapper.svelte @@ -0,0 +1,15 @@ +<script lang="ts"> + import type { Snippet } from 'svelte'; + + const { + children, + maxwidth = false, + }: { + children: Snippet; + maxwidth?: boolean; + } = $props(); +</script> + +<div class={{ 'formatted-table my-1': true, 'w-max': !maxwidth }}> + {@render children()} +</div> diff --git a/src/lib/fonts/Ac437_IBM_EGA_8x14.css b/src/lib/fonts/Ac437_IBM_EGA_8x14.css index 01a053b..519fc96 100644 --- a/src/lib/fonts/Ac437_IBM_EGA_8x14.css +++ b/src/lib/fonts/Ac437_IBM_EGA_8x14.css @@ -1,11 +1,11 @@ /* - Copyright (C) 2024 memdmp + Copyright (C) 2024-2026 memdmp - This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by Affero, Inc., at version 1. - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the Affero General Public License along with this program. If not, see <https://spdx.org/licenses/AGPL-1.0-only>. */ @font-face { font-family: "Ac437 IBM EGA 8x14"; diff --git a/src/lib/fonts/Px437_DOS-V_re_JPN12.css b/src/lib/fonts/Px437_DOS-V_re_JPN12.css index 410e9de..9a628de 100644 --- a/src/lib/fonts/Px437_DOS-V_re_JPN12.css +++ b/src/lib/fonts/Px437_DOS-V_re_JPN12.css @@ -1,11 +1,11 @@ /* - Copyright (C) 2024 memdmp + Copyright (C) 2024-2026 memdmp - This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by Affero, Inc., at version 1. - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the Affero General Public License along with this program. If not, see <https://spdx.org/licenses/AGPL-1.0-only>. */ @font-face { font-family: "Px437 DOS/V re. JPN12"; diff --git a/src/lib/fonts/PxPlus_IBM_EGA_8x14.css b/src/lib/fonts/PxPlus_IBM_EGA_8x14.css index d1a3a97..7f3dbda 100644 --- a/src/lib/fonts/PxPlus_IBM_EGA_8x14.css +++ b/src/lib/fonts/PxPlus_IBM_EGA_8x14.css @@ -1,11 +1,11 @@ /* - Copyright (C) 2024 memdmp + Copyright (C) 2024-2026 memdmp - This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by Affero, Inc., at version 1. - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the Affero General Public License along with this program. If not, see <https://spdx.org/licenses/AGPL-1.0-only>. */ @font-face { font-family: "PxPlus IBM EGA 8x14"; diff --git a/src/lib/fonts/all-local-after-woff2.css b/src/lib/fonts/all-local-after-woff2.css index 9bc8d65..deb4acf 100644 --- a/src/lib/fonts/all-local-after-woff2.css +++ b/src/lib/fonts/all-local-after-woff2.css @@ -1,11 +1,11 @@ /* - Copyright (C) 2024 memdmp + Copyright (C) 2024-2026 memdmp - This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by Affero, Inc., at version 1. - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the Affero General Public License along with this program. If not, see <https://spdx.org/licenses/AGPL-1.0-only>. */ @font-face { font-family: "Ac437 IBM EGA 8x14"; @@ -16,6 +16,7 @@ url("./Ac437_IBM_EGA_8x14.ttf") format("opentype"); font-display: swap; } + @font-face { font-family: "PxPlus IBM EGA 8x14"; src: @@ -25,6 +26,7 @@ url("./PxPlus_IBM_EGA_8x14.ttf") format("opentype"); font-display: swap; } + @font-face { font-family: "Px437 DOS/V re. JPN12"; src: diff --git a/src/lib/fonts/all.css b/src/lib/fonts/all.css index 7b30c9a..ef83aaf 100644 --- a/src/lib/fonts/all.css +++ b/src/lib/fonts/all.css @@ -1,11 +1,11 @@ /* - Copyright (C) 2024 memdmp + Copyright (C) 2024-2026 memdmp - This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by Affero, Inc., at version 1. - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the Affero General Public License along with this program. If not, see <https://spdx.org/licenses/AGPL-1.0-only>. */ @font-face { font-family: "Ac437 IBM EGA 8x14"; @@ -16,6 +16,7 @@ url("./Ac437_IBM_EGA_8x14.ttf") format("opentype"); font-display: swap; } + @font-face { font-family: "PxPlus IBM EGA 8x14"; src: @@ -25,6 +26,7 @@ url("./PxPlus_IBM_EGA_8x14.ttf") format("opentype"); font-display: swap; } + @font-face { font-family: "Px437 DOS/V re. JPN12"; src: diff --git a/src/lib/index.ts b/src/lib/index.ts index 13c5889..c83493b 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -1,10 +1,12 @@ /* - Copyright (C) 2024 memdmp + Copyright (C) 2024-2026 memdmp - This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by Affero, Inc., at version 1. - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the Affero General Public License along with this program. If not, see <https://spdx.org/licenses/AGPL-1.0-only>. */ export * as styles from "./styles.ts"; + +export const forceTrailingSlash = (v: string) => v.endsWith('/') ? v : `${v}/`; diff --git a/src/lib/styles.ts b/src/lib/styles.ts index 02f3805..0c60aa0 100644 --- a/src/lib/styles.ts +++ b/src/lib/styles.ts @@ -1,10 +1,10 @@ /* - Copyright (C) 2024 memdmp + Copyright (C) 2024-2026 memdmp - This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by Affero, Inc., at version 1. - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Affero General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the Affero General Public License along with this program. If not, see <https://spdx.org/licenses/AGPL-1.0-only>. */ export const button = "bg-white/10 text-white p-4 rounded-xl"; |