From 11343724322ccf9a5ca21ef865e69aced80139a3 Mon Sep 17 00:00:00 2001 From: thislight Date: Tue, 22 Oct 2024 22:55:53 +0800 Subject: [PATCH 1/3] i18n: chunk strings based on the key --- vite.config.ts | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/vite.config.ts b/vite.config.ts index ae43ff6..7881869 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,6 +5,50 @@ import suid from "@suid/vite-plugin"; import { VitePWA } from "vite-plugin-pwa"; import version from "vite-plugin-package-version"; import manifest from "./manifest.config"; +import { GetManualChunk } from "rollup"; + +/** + * Put all strings (/i18n/{key}.) into separated chunks based on the key. + */ +const chunkStrs: GetManualChunk = (id, { getModuleInfo }) => { + const match = /.*\/i18n\/(.*)\.[jt]s.*$/.exec(id); + if (match) { + const key = match[1]; + + const dependentEntryPoints = []; + + // we use a Set here so we handle each module at most once. This + // prevents infinite loops in case of circular dependencies + const idsToHandle = new Set(getModuleInfo(id)!.dynamicImporters); + + for (const moduleId of idsToHandle) { + const { isEntry, dynamicImporters, importers } = getModuleInfo(moduleId)!; + if (isEntry || dynamicImporters.length > 0) + dependentEntryPoints.push(moduleId); + + // The Set iterator is intelligent enough to iterate over + // elements that are added during iteration + for (const importerId of importers) idsToHandle.add(importerId); + } + + // If there is a unique entry, we put it into a chunk based on the + // entry name + if (dependentEntryPoints.length === 1) { + return `${key}.${ + dependentEntryPoints[0].split("/").slice(-1)[0].split(".")[0] + }.strings`; + } + // For multiple entries, we put it into a "shared" chunk + if (dependentEntryPoints.length > 1) { + return `${key}.shared.strings`; + } + } +}; + + +const manualChunks: GetManualChunk = (id, meta) => { + return chunkStrs(id, meta); +}; export default defineConfig(({ mode }) => ({ plugins: [ @@ -48,5 +92,10 @@ export default defineConfig(({ mode }) => ({ build: { target: ["firefox98", "safari15.4", "ios15.4", "chrome84", "edge87"], sourcemap: true, + rollupOptions: { + output: { + manualChunks, + }, + }, }, })); From faf0700f0c6a7de5dcbee9aa676e214e88162499 Mon Sep 17 00:00:00 2001 From: thislight Date: Tue, 22 Oct 2024 23:24:31 +0800 Subject: [PATCH 2/3] Toot: fix expansion animation on WebKit (fix #29) --- docs/devnotes.md | 6 ++++++ src/timelines/toot.module.css | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/devnotes.md b/docs/devnotes.md index bd97c7b..31f8cb9 100644 --- a/docs/devnotes.md +++ b/docs/devnotes.md @@ -41,3 +41,9 @@ export function updateAcctInf(idx: number) { ``` Ja, the code is weird, but that's the best we know. Anyway, you need new object on the path of your changed value. + +## `transition: *-block or *-inline` does not work on WebKit + +Idk why, but transition on logical directions may not work on WebKit - sometimes they work. + +Use physical directions to avoid trouble, like "margin-top, margin-bottom". diff --git a/src/timelines/toot.module.css b/src/timelines/toot.module.css index 56b4d73..e58f602 100644 --- a/src/timelines/toot.module.css +++ b/src/timelines/toot.module.css @@ -8,7 +8,8 @@ &.toot { /* fix composition ordering: I think the css module processor should aware the overriding and behaves, but no */ transition: - margin-block 125ms var(--tutu-anim-curve-std), + margin-top 125ms var(--tutu-anim-curve-std), + margin-bottom 125ms var(--tutu-anim-curve-std), height 225ms var(--tutu-anim-curve-std), var(--tutu-transition-shadow); border-radius: 0; From e08c978b105e5f2662499d878500fac9ce10bfe5 Mon Sep 17 00:00:00 2001 From: thislight Date: Tue, 22 Oct 2024 23:25:13 +0800 Subject: [PATCH 3/3] update logo --- public/logo.svg | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/public/logo.svg b/public/logo.svg index c3b58f5..9f9c9c6 100644 --- a/public/logo.svg +++ b/public/logo.svg @@ -2,9 +2,9 @@