This commit is contained in:
parent
c9819babfe
commit
1679a40c76
|
@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :class="[hide ? $style.hidden : $style.visible]" :style="darkMode ? '--c: rgb(255 255 255 / 2%);' : '--c: rgb(0 0 0 / 2%);'" @click="onclick">
|
<div :class="[hide ? $style.hidden : $style.visible]" @click="onclick">
|
||||||
<a
|
<a
|
||||||
:title="image.name"
|
:title="image.name"
|
||||||
:class="$style.imageContainer"
|
:class="$style.imageContainer"
|
||||||
|
@ -58,7 +58,6 @@ const props = withDefaults(defineProps<{
|
||||||
});
|
});
|
||||||
|
|
||||||
const hide = ref(props.image.isSensitive);
|
const hide = ref(props.image.isSensitive);
|
||||||
const darkMode = ref<boolean>(false); // TODO
|
|
||||||
|
|
||||||
const url = computed(() => (props.raw)
|
const url = computed(() => (props.raw)
|
||||||
? props.image.url
|
? props.image.url
|
||||||
|
@ -117,10 +116,19 @@ async function onclick(ev: MouseEvent) {
|
||||||
position: relative;
|
position: relative;
|
||||||
//box-shadow: 0 0 0 1px var(--divider) inset;
|
//box-shadow: 0 0 0 1px var(--divider) inset;
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
background-image: linear-gradient(45deg, var(--c) 16.67%, var(--bg) 16.67%, var(--bg) 50%, var(--c) 50%, var(--c) 66.67%, var(--bg) 66.67%, var(--bg) 100%);
|
|
||||||
background-size: 16px 16px;
|
background-size: 16px 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html[data-color-scheme=dark] .visible {
|
||||||
|
--c: rgb(255 255 255 / 2%);
|
||||||
|
background-image: linear-gradient(45deg, var(--c) 16.67%, var(--bg) 16.67%, var(--bg) 50%, var(--c) 50%, var(--c) 66.67%, var(--bg) 66.67%, var(--bg) 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
html[data-color-scheme=light] .visible {
|
||||||
|
--c: rgb(0 0 0 / 2%);
|
||||||
|
background-image: linear-gradient(45deg, var(--c) 16.67%, var(--bg) 16.67%, var(--bg) 50%, var(--c) 50%, var(--c) 66.67%, var(--bg) 66.67%, var(--bg) 100%);
|
||||||
|
}
|
||||||
|
|
||||||
.imageContainer {
|
.imageContainer {
|
||||||
display: block;
|
display: block;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
@ -39,6 +39,10 @@ export function applyTheme(theme: Theme, persist = true) {
|
||||||
document.documentElement.classList.remove('_themeChanging_');
|
document.documentElement.classList.remove('_themeChanging_');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
|
const colorScheme = theme.base === 'dark' ? 'dark' : 'light';
|
||||||
|
|
||||||
|
document.documentElement.dataset.colorScheme = colorScheme;
|
||||||
|
|
||||||
// Deep copy
|
// Deep copy
|
||||||
const _theme = JSON.parse(JSON.stringify(theme));
|
const _theme = JSON.parse(JSON.stringify(theme));
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
|
|
||||||
import { computed, watch, version as vueVersion, App } from 'vue';
|
import { computed, watch, version as vueVersion, App } from 'vue';
|
||||||
import { compareVersions } from 'compare-versions';
|
import { compareVersions } from 'compare-versions';
|
||||||
|
import { version, lang, updateLocale, locale } from '@@/js/config.js';
|
||||||
import widgets from '@/widgets/index.js';
|
import widgets from '@/widgets/index.js';
|
||||||
import directives from '@/directives/index.js';
|
import directives from '@/directives/index.js';
|
||||||
import components from '@/components/index.js';
|
import components from '@/components/index.js';
|
||||||
import { version, lang, updateLocale, locale } from '@@/js/config.js';
|
|
||||||
import { applyTheme } from '@/scripts/theme.js';
|
import { applyTheme } from '@/scripts/theme.js';
|
||||||
import { isDeviceDarkmode } from '@/scripts/is-device-darkmode.js';
|
import { isDeviceDarkmode } from '@/scripts/is-device-darkmode.js';
|
||||||
import { updateI18n } from '@/i18n.js';
|
import { updateI18n } from '@/i18n.js';
|
||||||
|
@ -146,10 +146,9 @@ export async function common(createVue: () => App<Element>) {
|
||||||
// NOTE: この処理は必ずクライアント更新チェック処理より後に来ること(テーマ再構築のため)
|
// NOTE: この処理は必ずクライアント更新チェック処理より後に来ること(テーマ再構築のため)
|
||||||
watch(defaultStore.reactiveState.darkMode, (darkMode) => {
|
watch(defaultStore.reactiveState.darkMode, (darkMode) => {
|
||||||
applyTheme(darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'));
|
applyTheme(darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'));
|
||||||
document.documentElement.dataset.colorMode = darkMode ? 'dark' : 'light';
|
|
||||||
}, { immediate: miLocalStorage.getItem('theme') == null });
|
}, { immediate: miLocalStorage.getItem('theme') == null });
|
||||||
|
|
||||||
document.documentElement.dataset.colorMode = defaultStore.state.darkMode ? 'dark' : 'light';
|
document.documentElement.dataset.colorScheme = defaultStore.state.darkMode ? 'dark' : 'light';
|
||||||
|
|
||||||
const darkTheme = computed(ColdDeviceStorage.makeGetterSetter('darkTheme'));
|
const darkTheme = computed(ColdDeviceStorage.makeGetterSetter('darkTheme'));
|
||||||
const lightTheme = computed(ColdDeviceStorage.makeGetterSetter('lightTheme'));
|
const lightTheme = computed(ColdDeviceStorage.makeGetterSetter('lightTheme'));
|
||||||
|
|
|
@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :class="[hide ? $style.hidden : $style.visible, (image.isSensitive && defaultStore.state.highlightSensitiveMedia) && $style.sensitive]" :style="darkMode ? '--c: rgb(255 255 255 / 2%);' : '--c: rgb(0 0 0 / 2%);'" @click="onclick">
|
<div :class="[hide ? $style.hidden : $style.visible, (image.isSensitive && defaultStore.state.highlightSensitiveMedia) && $style.sensitive]" @click="onclick">
|
||||||
<component
|
<component
|
||||||
:is="disableImageLink ? 'div' : 'a'"
|
:is="disableImageLink ? 'div' : 'a'"
|
||||||
v-bind="disableImageLink ? {
|
v-bind="disableImageLink ? {
|
||||||
|
@ -53,6 +53,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { watch, ref, computed } from 'vue';
|
import { watch, ref, computed } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
|
import type { MenuItem } from '@/types/menu.js';
|
||||||
import { getStaticImageUrl } from '@/scripts/media-proxy.js';
|
import { getStaticImageUrl } from '@/scripts/media-proxy.js';
|
||||||
import bytes from '@/filters/bytes.js';
|
import bytes from '@/filters/bytes.js';
|
||||||
import ImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
|
import ImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
|
||||||
|
@ -60,7 +61,6 @@ import { defaultStore } from '@/store.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { $i, iAmModerator } from '@/account.js';
|
import { $i, iAmModerator } from '@/account.js';
|
||||||
import type { MenuItem } from '@/types/menu.js';
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
image: Misskey.entities.DriveFile;
|
image: Misskey.entities.DriveFile;
|
||||||
|
@ -75,7 +75,6 @@ const props = withDefaults(defineProps<{
|
||||||
});
|
});
|
||||||
|
|
||||||
const hide = ref(true);
|
const hide = ref(true);
|
||||||
const darkMode = ref<boolean>(defaultStore.state.darkMode);
|
|
||||||
|
|
||||||
const url = computed(() => (props.raw || defaultStore.state.loadRawImages)
|
const url = computed(() => (props.raw || defaultStore.state.loadRawImages)
|
||||||
? props.image.url
|
? props.image.url
|
||||||
|
@ -209,10 +208,19 @@ function showMenu(ev: MouseEvent) {
|
||||||
position: relative;
|
position: relative;
|
||||||
//box-shadow: 0 0 0 1px var(--divider) inset;
|
//box-shadow: 0 0 0 1px var(--divider) inset;
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
background-image: linear-gradient(45deg, var(--c) 16.67%, var(--bg) 16.67%, var(--bg) 50%, var(--c) 50%, var(--c) 66.67%, var(--bg) 66.67%, var(--bg) 100%);
|
|
||||||
background-size: 16px 16px;
|
background-size: 16px 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html[data-color-scheme=dark] .visible {
|
||||||
|
--c: rgb(255 255 255 / 2%);
|
||||||
|
background-image: linear-gradient(45deg, var(--c) 16.67%, var(--bg) 16.67%, var(--bg) 50%, var(--c) 50%, var(--c) 66.67%, var(--bg) 66.67%, var(--bg) 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
html[data-color-scheme=light] .visible {
|
||||||
|
--c: rgb(0 0 0 / 2%);
|
||||||
|
background-image: linear-gradient(45deg, var(--c) 16.67%, var(--bg) 16.67%, var(--bg) 50%, var(--c) 50%, var(--c) 66.67%, var(--bg) 66.67%, var(--bg) 100%);
|
||||||
|
}
|
||||||
|
|
||||||
.menu {
|
.menu {
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -105,11 +105,11 @@ import * as mfm from 'mfm-js';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import insertTextAtCursor from 'insert-text-at-cursor';
|
import insertTextAtCursor from 'insert-text-at-cursor';
|
||||||
import { toASCII } from 'punycode/';
|
import { toASCII } from 'punycode/';
|
||||||
|
import { host, url } from '@@/js/config.js';
|
||||||
import MkNoteSimple from '@/components/MkNoteSimple.vue';
|
import MkNoteSimple from '@/components/MkNoteSimple.vue';
|
||||||
import MkNotePreview from '@/components/MkNotePreview.vue';
|
import MkNotePreview from '@/components/MkNotePreview.vue';
|
||||||
import XPostFormAttaches from '@/components/MkPostFormAttaches.vue';
|
import XPostFormAttaches from '@/components/MkPostFormAttaches.vue';
|
||||||
import MkPollEditor, { type PollEditorModelValue } from '@/components/MkPollEditor.vue';
|
import MkPollEditor, { type PollEditorModelValue } from '@/components/MkPollEditor.vue';
|
||||||
import { host, url } from '@@/js/config.js';
|
|
||||||
import { erase, unique } from '@/scripts/array.js';
|
import { erase, unique } from '@/scripts/array.js';
|
||||||
import { extractMentions } from '@/scripts/extract-mentions.js';
|
import { extractMentions } from '@/scripts/extract-mentions.js';
|
||||||
import { formatTimeString } from '@/scripts/format-time-string.js';
|
import { formatTimeString } from '@/scripts/format-time-string.js';
|
||||||
|
@ -1201,6 +1201,15 @@ defineExpose({
|
||||||
min-height: 75px;
|
min-height: 75px;
|
||||||
max-height: 150px;
|
max-height: 150px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
background-size: auto auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
html[data-color-scheme=dark] .preview {
|
||||||
|
background-image: repeating-linear-gradient(135deg, transparent, transparent 5px, #0005 5px, #0005 10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
html[data-color-scheme=light] .preview {
|
||||||
|
background-image: repeating-linear-gradient(135deg, transparent, transparent 5px, #0001 5px, #0001 10px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.targetNote {
|
.targetNote {
|
||||||
|
|
|
@ -74,6 +74,8 @@ export function applyTheme(theme: Theme, persist = true) {
|
||||||
|
|
||||||
const colorScheme = theme.base === 'dark' ? 'dark' : 'light';
|
const colorScheme = theme.base === 'dark' ? 'dark' : 'light';
|
||||||
|
|
||||||
|
document.documentElement.dataset.colorScheme = colorScheme;
|
||||||
|
|
||||||
// Deep copy
|
// Deep copy
|
||||||
const _theme = deepClone(theme);
|
const _theme = deepClone(theme);
|
||||||
|
|
||||||
|
|
|
@ -457,7 +457,7 @@ rt {
|
||||||
--fg: #693410;
|
--fg: #693410;
|
||||||
}
|
}
|
||||||
|
|
||||||
html[data-color-mode=dark] ._woodenFrame {
|
html[data-color-scheme=dark] ._woodenFrame {
|
||||||
--bg: #1d0c02;
|
--bg: #1d0c02;
|
||||||
--fg: #F1E8DC;
|
--fg: #F1E8DC;
|
||||||
--panel: #192320;
|
--panel: #192320;
|
||||||
|
|
Loading…
Reference in New Issue