From 6a4f580fe11db8345f173facb51ea43c1a0dea4c Mon Sep 17 00:00:00 2001 From: uni-kakurenbo <64454054+uni-kakurenbo@users.noreply.github.com> Date: Sat, 14 Nov 2026 17:56:39 +0900 Subject: [PATCH 1/2] perf(stamps): reduce dark-mode rendering cost --- src/components/UI/AStamp.vue | 7 +------ src/styles/_emoji.scss | 5 +++++ src/styles/_markdown.scss | 9 --------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/components/UI/AStamp.vue b/src/components/UI/AStamp.vue index 264837e2fd..ddb3cd7834 100644 --- a/src/components/UI/AStamp.vue +++ b/src/components/UI/AStamp.vue @@ -2,6 +2,7 @@
({ .img { max-height: 100%; margin: auto; - html[data-stamp-edge='true'] & { - filter: drop-shadow(0.1px 0.1px 0 rgb(255, 255, 255, 0.1)) - drop-shadow(0.1px -0.1px 0 rgb(255, 255, 255, 0.1)) - drop-shadow(-0.1px 0.1px 0 rgb(255, 255, 255, 0.1)) - drop-shadow(-0.1px -0.1px 0 rgb(255, 255, 255, 0.1)); - } } diff --git a/src/styles/_emoji.scss b/src/styles/_emoji.scss index 696d8c8bd1..f6f3b4b60c 100644 --- a/src/styles/_emoji.scss +++ b/src/styles/_emoji.scss @@ -1,6 +1,11 @@ @use 'sass:meta'; + @include meta.load-css('@traptitech/traq-markdown-it/src/css/stamp'); +html[data-stamp-edge='true'] :is(.emoji, .stamp-image) { + filter: drop-shadow(0 0 0.5px rgb(255 255 255 / 60%)); +} + html[data-eco-mode='false'] { @include meta.load-css('@traptitech/traq-markdown-it/src/css/stampEffect'); } diff --git a/src/styles/_markdown.scss b/src/styles/_markdown.scss index d1a878fe8c..946758f755 100644 --- a/src/styles/_markdown.scss +++ b/src/styles/_markdown.scss @@ -33,15 +33,6 @@ html[data-code-highlight='dark'] { // KaTeXのCSSは遅延読み込みするのでmain.tsを参照 -html[data-stamp-edge='true'] { - .emoji { - filter: drop-shadow(0.1px 0.1px 0 rgb(255, 255, 255, 0.1)) - drop-shadow(0.1px -0.1px 0 rgb(255, 255, 255, 0.1)) - drop-shadow(-0.1px 0.1px 0 rgb(255, 255, 255, 0.1)) - drop-shadow(-0.1px -0.1px 0 rgb(255, 255, 255, 0.1)); - } -} - .markdown-body .katex { display: inline-flex; max-width: 100%; From 637737817e28b0dc90cd1b08d21ffb7860ed289f Mon Sep 17 00:00:00 2001 From: uni-kakurenbo <64454054+uni-kakurenbo@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:00:28 +0900 Subject: [PATCH 2/2] perf(stamps): adapt shadows to background contrast --- src/App.vue | 7 + .../DraftListDetailsPanelChannel.vue | 4 +- src/components/UI/AStamp.vue | 10 +- src/components/UI/MarkdownContent.vue | 2 + src/components/UI/MarkdownPreview.vue | 3 + .../UI/MessagePanel/RenderContent.vue | 2 + src/lib/stampShadow.ts | 149 +++++++++++++ src/lib/stampShadowDirective.ts | 209 ++++++++++++++++++ src/styles/_emoji.scss | 12 + 9 files changed, 393 insertions(+), 5 deletions(-) create mode 100644 src/lib/stampShadow.ts create mode 100644 src/lib/stampShadowDirective.ts diff --git a/src/App.vue b/src/App.vue index 644d80a737..e68d1a22b7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -20,6 +20,7 @@ import useHtmlDataset from '/@/composables/document/useHtmlDataset' import { useThemeVariables } from '/@/composables/document/useThemeVariables' import { useBeforeUnload } from '/@/composables/dom/useBeforeUnload' import useResponsive from '/@/composables/useResponsive' +import { updateStampShadowTheme } from '/@/lib/stampShadowDirective' import { useBrowserSettings } from '/@/store/app/browserSettings' import { useThemeSettings } from '/@/store/app/themeSettings' import { useTts } from '/@/store/app/tts' @@ -54,6 +55,12 @@ const useThemeObserver = () => { const stampEdge = computed(() => currentTheme.value.specific.stampEdgeEnable) useHtmlDataset('stampEdge', stampEdge) + + watch( + currentTheme, + theme => updateStampShadowTheme(theme.specific.stampEdgeEnable), + { immediate: true, flush: 'post' } + ) } const useEcoModeObserver = () => { diff --git a/src/components/Main/NavigationBar/EphemeralNavigationContent/DraftList/DraftListDetailsPanelChannel.vue b/src/components/Main/NavigationBar/EphemeralNavigationContent/DraftList/DraftListDetailsPanelChannel.vue index 7a42f862c4..9567b8244f 100644 --- a/src/components/Main/NavigationBar/EphemeralNavigationContent/DraftList/DraftListDetailsPanelChannel.vue +++ b/src/components/Main/NavigationBar/EphemeralNavigationContent/DraftList/DraftListDetailsPanelChannel.vue @@ -4,6 +4,7 @@
channelIdToLink(props.channelId) ?? '') const hasAttachments = computed(() => props.state.attachments.length > 0) -const renderedContent = ref() +const renderedContent = ref() watchEffect(async () => { const { renderedText } = await renderInline(props.state.text) renderedContent.value = renderedText diff --git a/src/components/UI/AStamp.vue b/src/components/UI/AStamp.vue index ddb3cd7834..2bc15ad771 100644 --- a/src/components/UI/AStamp.vue +++ b/src/components/UI/AStamp.vue @@ -2,8 +2,10 @@
stampsMap.value.get(props.stampId)?.name ?? 'unknown stamp' -) +const stamp = computed(() => stampsMap.value.get(props.stampId)) +const name = computed(() => stamp.value?.name ?? 'unknown stamp') const imageUrl = computed(() => { - const fileId = stampsMap.value.get(props.stampId)?.fileId + const fileId = stamp.value?.fileId return fileId ? buildFilePath(fileId) : '' }) diff --git a/src/components/UI/MarkdownContent.vue b/src/components/UI/MarkdownContent.vue index 8b63786af7..5794589d82 100644 --- a/src/components/UI/MarkdownContent.vue +++ b/src/components/UI/MarkdownContent.vue @@ -1,6 +1,7 @@