merge: upstream

This commit is contained in:
Marie 2023-12-23 02:09:23 +01:00
commit 5db583a3eb
701 changed files with 50809 additions and 13660 deletions

View file

@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { onMounted } from 'vue';
import { onMounted, shallowRef } from 'vue';
import XColumn from './column.vue';
import { updateColumn, Column } from './deck-store.js';
import MkTimeline from '@/components/MkTimeline.vue';
@ -26,7 +26,7 @@ const props = defineProps<{
isStacked: boolean;
}>();
let timeline = $shallowRef<InstanceType<typeof MkTimeline>>();
const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
onMounted(() => {
if (props.column.antennaId == null) {

View file

@ -19,6 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { shallowRef } from 'vue';
import * as Misskey from 'misskey-js';
import XColumn from './column.vue';
import { updateColumn, Column } from './deck-store.js';
@ -32,8 +33,8 @@ const props = defineProps<{
isStacked: boolean;
}>();
let timeline = $shallowRef<InstanceType<typeof MkTimeline>>();
let channel = $shallowRef<Misskey.entities.Channel>();
const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
const channel = shallowRef<Misskey.entities.Channel>();
if (props.column.channelId == null) {
setChannel();
@ -58,14 +59,14 @@ async function setChannel() {
}
async function post() {
if (!channel || channel.id !== props.column.channelId) {
channel = await os.api('channels/show', {
if (!channel.value || channel.value.id !== props.column.channelId) {
channel.value = await os.api('channels/show', {
channelId: props.column.channelId,
});
}
os.post({
channel,
channel: channel.value,
});
}

View file

@ -42,7 +42,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { onBeforeUnmount, onMounted, provide, watch } from 'vue';
import { onBeforeUnmount, onMounted, provide, watch, shallowRef, ref, computed } from 'vue';
import { updateColumn, swapLeftColumn, swapRightColumn, swapUpColumn, swapDownColumn, stackLeftColumn, popRightColumn, removeColumn, swapColumn, Column } from './deck-store';
import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
@ -67,16 +67,16 @@ const emit = defineEmits<{
(ev: 'headerWheel', ctx: WheelEvent): void;
}>();
let body = $shallowRef<HTMLDivElement | null>();
const body = shallowRef<HTMLDivElement | null>();
let dragging = $ref(false);
watch($$(dragging), v => os.deckGlobalEvents.emit(v ? 'column.dragStart' : 'column.dragEnd'));
const dragging = ref(false);
watch(dragging, v => os.deckGlobalEvents.emit(v ? 'column.dragStart' : 'column.dragEnd'));
let draghover = $ref(false);
let dropready = $ref(false);
const draghover = ref(false);
const dropready = ref(false);
const isMainColumn = $computed(() => props.column.type === 'main');
const active = $computed(() => props.column.active !== false);
const isMainColumn = computed(() => props.column.type === 'main');
const active = computed(() => props.column.active !== false);
onMounted(() => {
os.deckGlobalEvents.on('column.dragStart', onOtherDragStart);
@ -89,11 +89,11 @@ onBeforeUnmount(() => {
});
function onOtherDragStart() {
dropready = true;
dropready.value = true;
}
function onOtherDragEnd() {
dropready = false;
dropready.value = false;
}
function toggleActive() {
@ -104,7 +104,7 @@ function toggleActive() {
}
function getMenu() {
let items = [{
let items: MenuItem[] = [{
icon: 'ph-gear ph-bold ph-lg',
text: i18n.ts._deck.configureColumn,
action: async () => {
@ -170,7 +170,7 @@ function getMenu() {
action: () => {
popRightColumn(props.column.id);
},
} : undefined, null, {
} : undefined, { type: 'divider' }, {
icon: 'ph-trash ph-bold ph-lg',
text: i18n.ts.remove,
danger: true,
@ -180,7 +180,7 @@ function getMenu() {
}];
if (props.menu) {
items.unshift(null);
items.unshift({ type: 'divider' });
items = props.menu.concat(items);
}
@ -208,8 +208,8 @@ function onContextmenu(ev: MouseEvent) {
}
function goTop() {
if (body) {
body.scrollTo({
if (body.value) {
body.value.scrollTo({
top: 0,
behavior: 'smooth',
});
@ -223,17 +223,17 @@ function onDragstart(ev) {
// ChromeDragstartDOM(=)Drag
// SEE: https://stackoverflow.com/questions/19639969/html5-dragend-event-firing-immediately
window.setTimeout(() => {
dragging = true;
dragging.value = true;
}, 10);
}
function onDragend(ev) {
dragging = false;
dragging.value = false;
}
function onDragover(ev) {
//
if (dragging) {
if (dragging.value) {
//
ev.dataTransfer.dropEffect = 'none';
} else {
@ -241,16 +241,16 @@ function onDragover(ev) {
ev.dataTransfer.dropEffect = isDeckColumn ? 'move' : 'none';
if (isDeckColumn) draghover = true;
if (isDeckColumn) draghover.value = true;
}
}
function onDragleave() {
draghover = false;
draghover.value = false;
}
function onDrop(ev) {
draghover = false;
draghover.value = false;
os.deckGlobalEvents.emit('column.dragEnd');
const id = ev.dataTransfer.getData(_DATA_TRANSFER_DECK_COLUMN_);

View file

@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { } from 'vue';
import { ref } from 'vue';
import XColumn from './column.vue';
import { Column } from './deck-store.js';
import MkNotes from '@/components/MkNotes.vue';
@ -30,11 +30,11 @@ const pagination = {
},
};
const tlComponent: InstanceType<typeof MkNotes> = $ref();
const tlComponent = ref<InstanceType<typeof MkNotes>>();
function reloadTimeline() {
return new Promise<void>((res) => {
tlComponent.pagingComponent?.reload().then(() => {
tlComponent.value.pagingComponent?.reload().then(() => {
res();
});
});

View file

@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { watch } from 'vue';
import { watch, shallowRef, ref } from 'vue';
import XColumn from './column.vue';
import { updateColumn, Column } from './deck-store';
import MkTimeline from '@/components/MkTimeline.vue';
@ -26,14 +26,14 @@ const props = defineProps<{
isStacked: boolean;
}>();
let timeline = $shallowRef<InstanceType<typeof MkTimeline>>();
const withRenotes = $ref(props.column.withRenotes ?? true);
const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
const withRenotes = ref(props.column.withRenotes ?? true);
if (props.column.listId == null) {
setList();
}
watch($$(withRenotes), v => {
watch(withRenotes, v => {
updateColumn(props.column.id, {
withRenotes: v,
});
@ -72,7 +72,7 @@ const menu = [
{
type: 'switch',
text: i18n.ts.showRenotes,
ref: $$(withRenotes),
ref: withRenotes,
},
];
</script>

View file

@ -19,7 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { ComputedRef, provide, shallowRef } from 'vue';
import { ComputedRef, provide, shallowRef, ref } from 'vue';
import XColumn from './column.vue';
import { deckStore, Column } from '@/ui/deck/deck-store.js';
import * as os from '@/os.js';
@ -35,11 +35,11 @@ defineProps<{
}>();
const contents = shallowRef<HTMLElement>();
let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
const pageMetadata = ref<null | ComputedRef<PageMetadata>>();
provide('router', mainRouter);
provideMetadataReceiver((info) => {
pageMetadata = info;
pageMetadata.value = info;
});
/*

View file

@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { } from 'vue';
import { ref } from 'vue';
import XColumn from './column.vue';
import { Column } from './deck-store.js';
import MkNotes from '@/components/MkNotes.vue';
@ -22,11 +22,11 @@ defineProps<{
isStacked: boolean;
}>();
const tlComponent: InstanceType<typeof MkNotes> = $ref();
const tlComponent = ref<InstanceType<typeof MkNotes>>();
function reloadTimeline() {
return new Promise<void>((res) => {
tlComponent.pagingComponent?.reload().then(() => {
tlComponent.value.pagingComponent?.reload().then(() => {
res();
});
});

View file

@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { defineAsyncComponent } from 'vue';
import { defineAsyncComponent, shallowRef } from 'vue';
import XColumn from './column.vue';
import { updateColumn, Column } from './deck-store.js';
import XNotifications from '@/components/MkNotifications.vue';
@ -24,7 +24,7 @@ const props = defineProps<{
isStacked: boolean;
}>();
let notificationsComponent = $shallowRef<InstanceType<typeof XNotifications>>();
const notificationsComponent = shallowRef<InstanceType<typeof XNotifications>>();
function func() {
os.popup(defineAsyncComponent(() => import('@/components/MkNotificationSelectWindow.vue')), {

View file

@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { onMounted } from 'vue';
import { onMounted, shallowRef } from 'vue';
import XColumn from './column.vue';
import { updateColumn, Column } from './deck-store.js';
import MkTimeline from '@/components/MkTimeline.vue';
@ -26,7 +26,7 @@ const props = defineProps<{
isStacked: boolean;
}>();
let timeline = $shallowRef<InstanceType<typeof MkTimeline>>();
const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
onMounted(() => {
if (props.column.roleId == null) {

View file

@ -34,7 +34,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { onMounted, watch } from 'vue';
import { onMounted, watch, ref, shallowRef } from 'vue';
import XColumn from './column.vue';
import { removeColumn, updateColumn, Column } from './deck-store.js';
import MkTimeline from '@/components/MkTimeline.vue';
@ -48,29 +48,29 @@ const props = defineProps<{
isStacked: boolean;
}>();
let disabled = $ref(false);
let timeline = $shallowRef<InstanceType<typeof MkTimeline>>();
const disabled = ref(false);
const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
const isLocalTimelineAvailable = (($i == null && instance.policies.ltlAvailable) || ($i != null && $i.policies.ltlAvailable));
const isGlobalTimelineAvailable = (($i == null && instance.policies.gtlAvailable) || ($i != null && $i.policies.gtlAvailable));
const isBubbleTimelineAvailable = ($i == null && instance.policies.btlAvailable) || ($i != null && $i.policies.btlAvailable);
const withRenotes = $ref(props.column.withRenotes ?? true);
const withReplies = $ref(props.column.withReplies ?? false);
const onlyFiles = $ref(props.column.onlyFiles ?? false);
const withRenotes = ref(props.column.withRenotes ?? true);
const withReplies = ref(props.column.withReplies ?? false);
const onlyFiles = ref(props.column.onlyFiles ?? false);
watch($$(withRenotes), v => {
watch(withRenotes, v => {
updateColumn(props.column.id, {
withRenotes: v,
});
});
watch($$(withReplies), v => {
watch(withReplies, v => {
updateColumn(props.column.id, {
withReplies: v,
});
});
watch($$(onlyFiles), v => {
watch(onlyFiles, v => {
updateColumn(props.column.id, {
onlyFiles: v,
});
@ -80,7 +80,7 @@ onMounted(() => {
if (props.column.tl == null) {
setType();
} else if ($i) {
disabled = (
disabled.value = (
(!((instance.policies.ltlAvailable) || ($i.policies.ltlAvailable)) && ['local', 'social'].includes(props.column.tl)) ||
(!((instance.policies.gtlAvailable) || ($i.policies.gtlAvailable)) && ['global'].includes(props.column.tl)) ||
(!((instance.policies.btlAvailable) || ($i.policies.btlAvailable)) && ['bubble'].includes(props.column.tl)));
@ -120,15 +120,17 @@ const menu = [{
}, {
type: 'switch',
text: i18n.ts.showRenotes,
ref: $$(withRenotes),
ref: withRenotes,
}, props.column.tl === 'local' || props.column.tl === 'social' ? {
type: 'switch',
text: i18n.ts.showRepliesToOthersInTimeline,
ref: $$(withReplies),
ref: withReplies,
disabled: onlyFiles,
} : undefined, {
type: 'switch',
text: i18n.ts.fileAttachedOnly,
ref: $$(onlyFiles),
ref: onlyFiles,
disabled: props.column.tl === 'local' || props.column.tl === 'social' ? withReplies : false,
}];
</script>

View file

@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { } from 'vue';
import { ref } from 'vue';
import XColumn from './column.vue';
import { addColumnWidget, Column, removeColumnWidget, setColumnWidgets, updateColumnWidget } from './deck-store.js';
import XWidgets from '@/components/MkWidgets.vue';
@ -26,7 +26,7 @@ const props = defineProps<{
isStacked: boolean;
}>();
let edit = $ref(false);
const edit = ref(false);
function addWidget(widget) {
addColumnWidget(props.column.id, widget);
@ -45,7 +45,7 @@ function updateWidgets(widgets) {
}
function func() {
edit = !edit;
edit.value = !edit.value;
}
const menu = [{