Merge remote-tracking branch 'misskey-original/develop' into develop
# Conflicts: # package.json # packages/backend/src/server/api/endpoints.ts # packages/frontend/src/components/MkButton.vue # packages/frontend/src/components/MkDrive.vue # packages/frontend/src/components/MkEmojiPicker.section.vue # packages/frontend/src/components/MkEmojiPicker.vue # packages/frontend/src/components/MkFoldableSection.vue # packages/frontend/src/components/MkInput.vue # packages/frontend/src/components/MkMenu.vue # packages/frontend/src/components/MkNote.vue # packages/frontend/src/components/MkPostForm.vue # packages/frontend/src/components/MkSignupDialog.form.vue # packages/frontend/src/components/MkSwitch.button.vue # packages/frontend/src/components/MkTab.vue # packages/frontend/src/components/MkTimeline.vue # packages/frontend/src/components/MkUserSelectDialog.vue # packages/frontend/src/components/global/MkCustomEmoji.vue # packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts # packages/frontend/src/os.ts # packages/frontend/src/pages/admin/index.vue # packages/frontend/src/pages/user/home.vue # packages/frontend/src/ui/universal.vue
This commit is contained in:
commit
942b7f1b3c
250 changed files with 2788 additions and 1788 deletions
|
|
@ -15,7 +15,7 @@ import * as os from '@/os.js';
|
|||
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
|
||||
import { url } from '@/config.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { useRouter } from '@/global/router/supplier.js';
|
||||
import { useRouter } from '@/router/supplier.js';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
to: string;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import { host as hostRaw } from '@/config.js';
|
|||
import { defaultStore } from '@/store.js';
|
||||
|
||||
defineProps<{
|
||||
user: Misskey.entities.UserDetailed;
|
||||
user: Misskey.entities.User;
|
||||
detail?: boolean;
|
||||
}>();
|
||||
|
||||
|
|
|
|||
|
|
@ -81,9 +81,11 @@ const bound = computed(() => props.link
|
|||
? { to: userPage(props.user), target: props.target }
|
||||
: {});
|
||||
|
||||
const url = computed(() => (defaultStore.state.disableShowingAnimatedImages || defaultStore.state.dataSaver.avatar)
|
||||
? getStaticImageUrl(props.user.avatarUrl)
|
||||
: props.user.avatarUrl);
|
||||
const url = computed(() => {
|
||||
if (props.user.avatarUrl == null) return null;
|
||||
if (defaultStore.state.disableShowingAnimatedImages || defaultStore.state.dataSaver.avatar) return getStaticImageUrl(props.user.avatarUrl);
|
||||
return props.user.avatarUrl;
|
||||
});
|
||||
|
||||
function onClick(ev: MouseEvent): void {
|
||||
if (props.link) return;
|
||||
|
|
@ -109,6 +111,7 @@ function getDecorationOffset(decoration: Omit<Misskey.entities.UserDetailed['ava
|
|||
const color = ref<string | undefined>();
|
||||
|
||||
watch(() => props.user.avatarBlurhash, () => {
|
||||
if (props.user.avatarBlurhash == null) return;
|
||||
color.value = extractAvgColorFromBlurhash(props.user.avatarBlurhash);
|
||||
}, {
|
||||
immediate: true,
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ const rawUrl = computed(() => {
|
|||
});
|
||||
|
||||
const url = computed(() => {
|
||||
if (rawUrl.value == null) return null;
|
||||
if (rawUrl.value == null) return undefined;
|
||||
const useOriginalSize = props.useOriginalSize;
|
||||
const enableDataSaverMode = defaultStore.state.enableUltimateDataSaverMode;
|
||||
let datasaver_result ;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import { mixEmoji } from '@/scripts/emojiKitchen/emojiMixer';
|
|||
import { nyaize as doNyaize } from '@/scripts/nyaize.js';
|
||||
import { uhoize as doUhoize } from '@/scripts/uhoize.js';
|
||||
import {ID, Instance} from "misskey-js/built/entities.js";
|
||||
import { safeParseFloat } from '@/scripts/safe-parse.js';
|
||||
|
||||
const QUOTE_STYLE = `
|
||||
display: block;
|
||||
|
|
@ -69,7 +70,7 @@ type MfmProps = {
|
|||
isBot?: boolean;};
|
||||
i?: Misskey.entities.UserLite | null;
|
||||
isNote?: boolean;
|
||||
emojiUrls?: string[];
|
||||
emojiUrls?: Record<string, string>;
|
||||
rootScale?: number;
|
||||
nyaize?: boolean | 'respect';
|
||||
uhoize: boolean | 'respect';
|
||||
|
|
@ -83,7 +84,7 @@ type MfmEvents = {
|
|||
};
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
|
||||
export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEvents>['emit'] }) {
|
||||
const isNote = props.isNote ?? true;
|
||||
const shouldNyaize = props.nyaize ? props.nyaize === 'respect' ? props.author?.isCat : false : false;
|
||||
const shouldUhoize = props.nyaize ? props.nyaize === 'respect' ? props.author?.isGorilla : false : false;
|
||||
|
|
@ -92,13 +93,14 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
|
|||
|
||||
const rootAst = props.parsedNodes ?? (props.plain ? mfm.parseSimple : mfm.parse)(props.text);
|
||||
|
||||
const validTime = (t: string | null | undefined) => {
|
||||
const validTime = (t: string | boolean | null | undefined) => {
|
||||
if (t == null || typeof t === 'boolean') return null;
|
||||
if (typeof t === 'boolean') return null;
|
||||
return t.match(/^[0-9.]+s$/) ? t : null;
|
||||
};
|
||||
|
||||
const validColor = (c: string | null | undefined): string | null => {
|
||||
if (c == null) return null;
|
||||
const validColor = (c: unknown): string | null => {
|
||||
if (typeof c !== 'string') return null;
|
||||
return c.match(/^[0-9a-f]{3,6}$/i) ? c : null;
|
||||
};
|
||||
|
||||
|
|
@ -257,7 +259,7 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
|
|||
return h(MkSparkle, {}, genEl(token.children, scale));
|
||||
}
|
||||
case 'rotate': {
|
||||
const degrees = parseFloat(token.props.args.deg ?? '90');
|
||||
const degrees = safeParseFloat(token.props.args.deg) ?? 90;
|
||||
let rotateText = `rotate(${degrees}deg)`;
|
||||
if (!token.props.args.deg && (token.props.args.x || token.props.args.y || token.props.args.z)) {
|
||||
rotateText = '';
|
||||
|
|
@ -279,8 +281,8 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
|
|||
}
|
||||
case 'position': {
|
||||
if (!defaultStore.state.advancedMfm) break;
|
||||
const x = parseFloat(token.props.args.x ?? '0');
|
||||
const y = parseFloat(token.props.args.y ?? '0');
|
||||
const x = safeParseFloat(token.props.args.x) ?? 0;
|
||||
const y = safeParseFloat(token.props.args.y) ?? 0;
|
||||
style = `transform: translateX(${x}em) translateY(${y}em);`;
|
||||
break;
|
||||
}
|
||||
|
|
@ -289,8 +291,8 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
|
|||
style = '';
|
||||
break;
|
||||
}
|
||||
const x = Math.min(parseFloat(token.props.args.x ?? '1'), 5);
|
||||
const y = Math.min(parseFloat(token.props.args.y ?? '1'), 5);
|
||||
const x = Math.min(safeParseFloat(token.props.args.x) ?? 1, 5);
|
||||
const y = Math.min(safeParseFloat(token.props.args.y) ?? 1, 5);
|
||||
style = `transform: scale(${x}, ${y});`;
|
||||
scale = scale * Math.max(x, y);
|
||||
break;
|
||||
|
|
@ -312,11 +314,12 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
|
|||
color = color ? `#${color}` : 'var(--accent)';
|
||||
let b_style = token.props.args.style;
|
||||
if (
|
||||
typeof b_style !== 'string' ||
|
||||
!['hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset']
|
||||
.includes(b_style)
|
||||
) b_style = 'solid';
|
||||
const width = parseFloat(token.props.args.width ?? '1');
|
||||
const radius = parseFloat(token.props.args.radius ?? '0');
|
||||
const width = safeParseFloat(token.props.args.width) ?? 1;
|
||||
const radius = safeParseFloat(token.props.args.radius) ?? 0;
|
||||
style = `border: ${width}px ${b_style} ${color}; border-radius: ${radius}px;${token.props.args.noclip ? '' : ' overflow: clip;'}`;
|
||||
break;
|
||||
}
|
||||
|
|
@ -381,7 +384,8 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
|
|||
return h('span', { onClick(ev: MouseEvent): void {
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
context.emit('clickEv', token.props.args.ev ?? '');
|
||||
const clickEv = typeof token.props.args.ev === 'string' ? token.props.args.ev : '';
|
||||
emit('clickEv', clickEv);
|
||||
} }, genEl(token.children, scale));
|
||||
}
|
||||
}
|
||||
|
|
@ -442,7 +446,7 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
|
|||
return [h(MkCode, {
|
||||
key: Math.random(),
|
||||
code: token.props.code,
|
||||
lang: token.props.lang,
|
||||
lang: token.props.lang ?? undefined,
|
||||
})];
|
||||
}
|
||||
|
||||
|
|
@ -485,8 +489,7 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
|
|||
return [h(MkCustomEmoji, {
|
||||
key: Math.random(),
|
||||
name: token.props.name,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
url: props.emojiUrls ? props.emojiUrls[token.props.name] : null,
|
||||
url: props.emojiUrls && props.emojiUrls[token.props.name],
|
||||
normal: props.plain,
|
||||
host: props.author.host,
|
||||
useOriginalSize: scale >= 2.5,
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<script lang="ts">
|
||||
export type Tab = {
|
||||
key: string;
|
||||
title: string;
|
||||
onClick?: (ev: MouseEvent) => void;
|
||||
} & (
|
||||
| {
|
||||
|
|
@ -122,8 +123,9 @@ function onTabWheel(ev: WheelEvent) {
|
|||
|
||||
let entering = false;
|
||||
|
||||
async function enter(el: HTMLElement) {
|
||||
async function enter(element: Element) {
|
||||
entering = true;
|
||||
const el = element as HTMLElement;
|
||||
const elementWidth = el.getBoundingClientRect().width;
|
||||
el.style.width = '0';
|
||||
el.style.paddingLeft = '0';
|
||||
|
|
@ -137,11 +139,12 @@ async function enter(el: HTMLElement) {
|
|||
setTimeout(renderTab, 170);
|
||||
}
|
||||
|
||||
function afterEnter(el: HTMLElement) {
|
||||
function afterEnter(element: Element) {
|
||||
//el.style.width = '';
|
||||
}
|
||||
|
||||
async function leave(el: HTMLElement) {
|
||||
async function leave(element: Element) {
|
||||
const el = element as HTMLElement;
|
||||
const elementWidth = el.getBoundingClientRect().width;
|
||||
el.style.width = elementWidth + 'px';
|
||||
el.style.paddingLeft = '';
|
||||
|
|
@ -150,7 +153,8 @@ async function leave(el: HTMLElement) {
|
|||
el.style.paddingLeft = '0';
|
||||
}
|
||||
|
||||
function afterLeave(el: HTMLElement) {
|
||||
function afterLeave(element: Element) {
|
||||
const el = element as HTMLElement;
|
||||
el.style.width = '';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,27 +63,32 @@ onMounted(() => {
|
|||
watch([parentStickyTop, parentStickyBottom], calc);
|
||||
|
||||
watch(childStickyTop, () => {
|
||||
if (bodyEl.value == null) return;
|
||||
bodyEl.value.style.setProperty('--stickyTop', `${childStickyTop.value}px`);
|
||||
}, {
|
||||
immediate: true,
|
||||
});
|
||||
|
||||
watch(childStickyBottom, () => {
|
||||
if (bodyEl.value == null) return;
|
||||
bodyEl.value.style.setProperty('--stickyBottom', `${childStickyBottom.value}px`);
|
||||
}, {
|
||||
immediate: true,
|
||||
});
|
||||
|
||||
headerEl.value.style.position = 'sticky';
|
||||
headerEl.value.style.top = 'var(--stickyTop, 0)';
|
||||
headerEl.value.style.zIndex = '1000';
|
||||
if (headerEl.value != null) {
|
||||
headerEl.value.style.position = 'sticky';
|
||||
headerEl.value.style.top = 'var(--stickyTop, 0)';
|
||||
headerEl.value.style.zIndex = '1000';
|
||||
observer.observe(headerEl.value);
|
||||
}
|
||||
|
||||
footerEl.value.style.position = 'sticky';
|
||||
footerEl.value.style.bottom = 'var(--stickyBottom, 0)';
|
||||
footerEl.value.style.zIndex = '1000';
|
||||
|
||||
observer.observe(headerEl.value);
|
||||
observer.observe(footerEl.value);
|
||||
if (footerEl.value != null) {
|
||||
footerEl.value.style.position = 'sticky';
|
||||
footerEl.value.style.bottom = 'var(--stickyBottom, 0)';
|
||||
footerEl.value.style.zIndex = '1000';
|
||||
observer.observe(footerEl.value);
|
||||
}
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ const props = withDefaults(defineProps<{
|
|||
mode?: 'relative' | 'absolute' | 'detail';
|
||||
colored?: boolean;
|
||||
}>(), {
|
||||
origin: isChromatic() ? new Date('2023-04-01T00:00:00Z') : null,
|
||||
origin: isChromatic() ? () => new Date('2023-04-01T00:00:00Z') : null,
|
||||
mode: 'relative',
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue