Merge branch 'develop' into mfm-rainbow-fallback

This commit is contained in:
かっこかり 2023-08-13 09:49:58 +09:00 committed by GitHub
commit f100fb2dd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 134 additions and 80 deletions

View File

@ -6,7 +6,7 @@
"features": {
"ghcr.io/devcontainers-contrib/features/pnpm:2": {},
"ghcr.io/devcontainers/features/node:1": {
"version": "20.3.1"
"version": "20.5.0"
}
},
"forwardPorts": [3000],

View File

@ -9,24 +9,24 @@ updates:
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 0
open-pull-requests-limit: 100
# Add only the root, not each workspace item
# https://github.com/dependabot/dependabot-core/issues/4993#issuecomment-1289133027
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
# PNPM has an issue with dependabot. See:
# https://github.com/dependabot/dependabot-core/issues/7258
# https://github.com/pnpm/pnpm/issues/6530
# TODO: Restore this when the issue is solved
open-pull-requests-limit: 0
- package-ecosystem: npm
directory: "/packages/backend"
schedule:
interval: daily
open-pull-requests-limit: 0
- package-ecosystem: npm
directory: "/packages/frontend"
schedule:
interval: daily
open-pull-requests-limit: 0
- package-ecosystem: npm
directory: "/packages/sw"
schedule:
interval: daily
open-pull-requests-limit: 0
groups:
swc:
patterns:
- "@swc/*"
storybook:
patterns:
- "storybook*"
- "@storybook/*"

View File

@ -9,12 +9,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
- run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v3.7.0
with:
node-version-file: '.node-version'
cache: 'pnpm'

View File

@ -10,7 +10,7 @@ jobs:
check_copyright_year:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.2.0
- uses: actions/checkout@v3.5.3
- run: |
if [ "$(grep Copyright COPYING | sed -e 's/.*2014-\([0-9]*\) .*/\1/g')" -ne "$(date +%Y)" ]; then
echo "Please change copyright year!"

View File

@ -13,7 +13,7 @@ jobs:
if: github.repository == 'misskey-dev/misskey'
steps:
- name: Check out the repo
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2.3.0

View File

@ -12,7 +12,7 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2.3.0

View File

@ -14,7 +14,7 @@ jobs:
env:
DOCKER_CONTENT_TRUST: 1
steps:
- uses: actions/checkout@v3.2.0
- uses: actions/checkout@v3.5.3
- run: |
curl -L -o dockle.deb "https://github.com/goodwithtech/dockle/releases/download/v0.4.10/dockle_0.4.10_Linux-64bit.deb"
sudo dpkg -i dockle.deb

View File

@ -11,7 +11,7 @@ jobs:
pnpm_install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.3.0
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 0
submodules: true
@ -19,7 +19,7 @@ jobs:
with:
version: 8
run_install: false
- uses: actions/setup-node@v3.6.0
- uses: actions/setup-node@v3.7.0
with:
node-version-file: '.node-version'
cache: 'pnpm'
@ -38,7 +38,7 @@ jobs:
- sw
- misskey-js
steps:
- uses: actions/checkout@v3.3.0
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 0
submodules: true
@ -46,7 +46,7 @@ jobs:
with:
version: 7
run_install: false
- uses: actions/setup-node@v3.6.0
- uses: actions/setup-node@v3.7.0
with:
node-version-file: '.node-version'
cache: 'pnpm'
@ -64,7 +64,7 @@ jobs:
- backend
- misskey-js
steps:
- uses: actions/checkout@v3.3.0
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 0
submodules: true
@ -72,7 +72,7 @@ jobs:
with:
version: 7
run_install: false
- uses: actions/setup-node@v3.6.0
- uses: actions/setup-node@v3.7.0
with:
node-version-file: '.node-version'
cache: 'pnpm'

View File

@ -53,7 +53,7 @@ jobs:
# Check out merge commit
- name: Fork based /deploy checkout
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
with:
ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge'

View File

@ -7,7 +7,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3.5.3
- uses: uesteibar/reviewer-lottery@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -15,12 +15,12 @@ jobs:
NODE_OPTIONS: "--max_old_space_size=7168"
steps:
- uses: actions/checkout@v3.3.0
- uses: actions/checkout@v3.5.3
if: github.event_name != 'pull_request_target'
with:
fetch-depth: 0
submodules: true
- uses: actions/checkout@v3.3.0
- uses: actions/checkout@v3.5.3
if: github.event_name == 'pull_request_target'
with:
fetch-depth: 0
@ -38,7 +38,7 @@ jobs:
version: 8
run_install: false
- name: Use Node.js 20.x
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v3.7.0
with:
node-version-file: '.node-version'
cache: 'pnpm'

View File

@ -29,7 +29,7 @@ jobs:
- 56312:6379
steps:
- uses: actions/checkout@v3.3.0
- uses: actions/checkout@v3.5.3
with:
submodules: true
- name: Install pnpm
@ -38,7 +38,7 @@ jobs:
version: 8
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v3.7.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

View File

@ -16,7 +16,7 @@ jobs:
node-version: [20.x]
steps:
- uses: actions/checkout@v3.3.0
- uses: actions/checkout@v3.5.3
with:
submodules: true
- name: Install pnpm
@ -25,7 +25,7 @@ jobs:
version: 8
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v3.7.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
@ -68,7 +68,7 @@ jobs:
- 56312:6379
steps:
- uses: actions/checkout@v3.3.0
- uses: actions/checkout@v3.5.3
with:
submodules: true
# https://github.com/cypress-io/cypress-docker-images/issues/150
@ -83,7 +83,7 @@ jobs:
version: 7
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v3.7.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

View File

@ -21,12 +21,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.3
- run: corepack enable
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v3.7.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

View File

@ -19,7 +19,7 @@ jobs:
node-version: [20.x]
steps:
- uses: actions/checkout@v3.3.0
- uses: actions/checkout@v3.5.3
with:
submodules: true
- name: Install pnpm
@ -28,7 +28,7 @@ jobs:
version: 8
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v3.7.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

View File

@ -1 +1 @@
20.3.1
20.5.0

View File

@ -1,6 +1,6 @@
# syntax = docker/dockerfile:1.4
ARG NODE_VERSION=20.3.1-bullseye
ARG NODE_VERSION=20.5.0-bullseye
# build assets & compile TypeScript

View File

@ -43,6 +43,8 @@ export function correctFilename(filename: string, ext: string | null) {
// jpeg, tiffを同一視
dotExt === '.jpg' && filenameExt === '.jpeg' ||
dotExt === '.tif' && filenameExt === '.tiff' ||
// dllもexeもportable executableなので判定が正しく行われない
dotExt === '.exe' && filenameExt === '.dll' ||
// 圧縮形式っぽければ下手に拡張子を変えない
// https://github.com/misskey-dev/misskey/issues/11482

View File

@ -39,11 +39,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitchButton :class="$style.switchButton" :checked="item.ref" :disabled="item.disabled" @toggle="switchItem(item)" />
<span :class="$style.switchText">{{ item.text }}</span>
</button>
<button v-else-if="item.type === 'parent'" role="menuitem" :tabindex="i" class="_button" :class="[$style.item, $style.parent, { [$style.childShowing]: childShowingItem === item }]" @mouseenter="showChildren(item, $event)">
<div v-else-if="item.type === 'parent'" role="menuitem" :tabindex="i" :class="[$style.item, $style.parent, { [$style.childShowing]: childShowingItem === item }]" @mouseenter="preferClick ? null : showChildren(item, $event)" @click="!preferClick ? null : showChildren(item, $event)">
<i v-if="item.icon" class="ti-fw" :class="[$style.icon, item.icon]"></i>
<span>{{ item.text }}</span>
<span :class="$style.caret"><i class="ti ti-chevron-right ti-fw"></i></span>
</button>
</div>
<button v-else :tabindex="i" class="_button" role="menuitem" :class="[$style.item, { [$style.danger]: item.danger, [$style.active]: item.active }]" :disabled="item.active" @click="clicked(item.action, $event)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
<i v-if="item.icon" class="ti-fw" :class="[$style.icon, item.icon]"></i>
<MkAvatar v-if="item.avatar" :user="item.avatar" :class="$style.avatar"/>
@ -56,19 +56,24 @@ SPDX-License-Identifier: AGPL-3.0-only
</span>
</div>
<div v-if="childMenu">
<XChild ref="child" :items="childMenu" :targetElement="childTarget" :rootElement="itemsEl" showing @actioned="childActioned"/>
<XChild ref="child" :items="childMenu" :targetElement="childTarget" :rootElement="itemsEl" showing @actioned="childActioned" @close="close(false)"/>
</div>
</div>
</template>
<script lang="ts" setup>
import { defineAsyncComponent, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
<script lang="ts">
import { Ref, defineAsyncComponent, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { focusPrev, focusNext } from '@/scripts/focus';
import MkSwitchButton from '@/components/MkSwitch.button.vue';
import { MenuItem, InnerMenuItem, OuterMenuItem, MenuPending, MenuAction, MenuSwitch, MenuParent } from '@/types/menu';
import { MenuItem, InnerMenuItem, MenuPending, MenuAction, MenuSwitch, MenuParent } from '@/types/menu';
import * as os from '@/os';
import { i18n } from '@/i18n';
import { isTouchUsing } from '@/scripts/touch';
const childrenCache = new WeakMap<MenuParent, MenuItem[]>();
</script>
<script lang="ts" setup>
const XChild = defineAsyncComponent(() => import('./MkMenu.child.vue'));
const props = defineProps<{
@ -82,6 +87,7 @@ const props = defineProps<{
const emit = defineEmits<{
(ev: 'close', actioned?: boolean): void;
(ev: 'hide'): void;
}>();
let itemsEl = $shallowRef<HTMLDivElement>();
@ -98,6 +104,8 @@ let keymap = $computed(() => ({
let childShowingItem = $ref<MenuItem | null>();
let preferClick = isTouchUsing || props.asDrawer;
watch(() => props.items, () => {
const items: (MenuItem | MenuPending)[] = [...props.items].filter(item => item !== undefined);
@ -117,7 +125,7 @@ watch(() => props.items, () => {
immediate: true,
});
let childMenu = ref<MenuItem[] | null>();
const childMenu = ref<MenuItem[] | null>();
let childTarget = $shallowRef<HTMLElement | null>();
function closeChild() {
@ -130,11 +138,11 @@ function childActioned() {
close(true);
}
function onGlobalMousedown(event: MouseEvent) {
const onGlobalMousedown = (event: MouseEvent) => {
if (childTarget && (event.target === childTarget || childTarget.contains(event.target))) return;
if (child && child.checkHit(event)) return;
closeChild();
}
};
let childCloseTimer: null | number = null;
function onItemMouseEnter(item) {
@ -146,31 +154,30 @@ function onItemMouseLeave(item) {
if (childCloseTimer) window.clearTimeout(childCloseTimer);
}
let childrenCache = new WeakMap<MenuParent, OuterMenuItem[]>();
async function showChildren(item: MenuParent, ev: MouseEvent) {
const children = ref<OuterMenuItem[]>([]);
if (childrenCache.has(item)) {
children.value = childrenCache.get(item)!;
} else {
if (typeof item.children === 'function') {
children.value = [{
type: 'pending',
}];
Promise.resolve(item.children()).then(x => {
children.value = x;
childrenCache.set(item, x);
});
const children = await (async () => {
if (childrenCache.has(item)) {
return childrenCache.get(item)!;
} else {
children.value = item.children;
if (typeof item.children === 'function') {
return Promise.resolve(item.children());
} else {
return item.children;
}
}
}
})();
childrenCache.set(item, children);
if (props.asDrawer) {
os.popupMenu(children, ev.currentTarget ?? ev.target);
close();
os.popupMenu(children, ev.currentTarget ?? ev.target).finally(() => {
emit('close');
});
emit('hide');
} else {
childTarget = ev.currentTarget ?? ev.target;
childMenu = children;
//
childMenu.value = children;
childShowingItem = item;
}
}
@ -200,7 +207,7 @@ function switchItem(item: MenuSwitch & { ref: any }) {
onMounted(() => {
if (props.viaKeyboard) {
nextTick(() => {
focusNext(itemsEl.children[0], true, false);
if (itemsEl) focusNext(itemsEl.children[0], true, false);
});
}
@ -348,6 +355,7 @@ onBeforeUnmount(() => {
}
&.parent {
pointer-events: auto;
display: flex;
align-items: center;
cursor: default;

View File

@ -4,13 +4,13 @@ SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<MkModal ref="modal" v-slot="{ type, maxHeight }" :zPriority="'high'" :src="src" :transparentBg="true" @click="modal.close()" @close="emit('closing')" @closed="emit('closed')">
<MkMenu :items="items" :align="align" :width="width" :max-height="maxHeight" :asDrawer="type === 'drawer'" :class="{ [$style.drawer]: type === 'drawer' }" @close="modal.close()"/>
<MkModal ref="modal" v-slot="{ type, maxHeight }" :manualShowing="manualShowing" :zPriority="'high'" :src="src" :transparentBg="true" @click="click" @close="onModalClose" @closed="onModalClosed">
<MkMenu :items="items" :align="align" :width="width" :max-height="maxHeight" :asDrawer="type === 'drawer'" :class="{ [$style.drawer]: type === 'drawer' }" @close="onMenuClose" @hide="hide"/>
</MkModal>
</template>
<script lang="ts" setup>
import { } from 'vue';
import { ref } from 'vue';
import MkModal from './MkModal.vue';
import MkMenu from './MkMenu.vue';
import { MenuItem } from '@/types/menu';
@ -29,6 +29,46 @@ const emit = defineEmits<{
}>();
let modal = $shallowRef<InstanceType<typeof MkModal>>();
const manualShowing = ref(true);
const hiding = ref(false);
function click() {
close();
}
function onModalClose() {
emit('closing');
}
function onMenuClose() {
close();
if (hiding.value) {
// hidingclosed
emit('closed');
}
}
function onModalClosed() {
if (!hiding.value) {
// hidingclosed
emit('closed');
}
}
function hide() {
manualShowing.value = false;
hiding.value = true;
// close
modal?.close();
}
function close() {
manualShowing.value = false;
// close
modal?.close();
}
</script>
<style lang="scss" module>

View File

@ -418,7 +418,9 @@ export function getNoteMenu(props: {
const cleanup = () => {
if (_DEV_) console.log('note menu cleanup', cleanups);
cleanups.forEach(cleanup => cleanup());
for (const cl of cleanups) {
cl();
}
};
return {

View File

@ -330,7 +330,9 @@ export function getUserMenu(user: misskey.entities.UserDetailed, router: Router
const cleanup = () => {
if (_DEV_) console.log('user menu cleanup', cleanups);
cleanups.forEach(cleanup => cleanup());
for (const cl of cleanups) {
cl();
}
};
return {

View File

@ -16,7 +16,7 @@ export type MenuA = { type: 'a', href: string, target?: string, download?: strin
export type MenuUser = { type: 'user', user: Misskey.entities.User, active?: boolean, indicate?: boolean, action: MenuAction };
export type MenuSwitch = { type: 'switch', ref: Ref<boolean>, text: string, disabled?: boolean };
export type MenuButton = { type?: 'button', text: string, icon?: string, indicate?: boolean, danger?: boolean, active?: boolean, avatar?: Misskey.entities.User; action: MenuAction };
export type MenuParent = { type: 'parent', text: string, icon?: string, children: OuterMenuItem[] | (() => Promise<OuterMenuItem[]> | OuterMenuItem[]) };
export type MenuParent = { type: 'parent', text: string, icon?: string, children: MenuItem[] | (() => Promise<MenuItem[]> | MenuItem[]) };
export type MenuPending = { type: 'pending' };