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

@ -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_);