Merge branch 'develop' into redis

This commit is contained in:
naskya 2024-04-20 10:17:11 +09:00
commit 77ded03330
No known key found for this signature in database
GPG Key ID: 712D413B3A9FED5C
13 changed files with 28 additions and 41 deletions

View File

@ -1,6 +1,6 @@
import type * as http from "node:http";
import { EventEmitter } from "events";
import type { ParsedUrlQuery } from "querystring";
import { EventEmitter } from "node:events";
import type { ParsedUrlQuery } from "node:querystring";
import * as websocket from "websocket";
import { subscriber as redisClient } from "@/db/redis.js";

View File

@ -28,11 +28,10 @@
</template>
<script lang="ts" setup>
import type { Ref } from "vue";
import MkTooltip from "./MkTooltip.vue";
const props = defineProps<{
showing: Ref<boolean>;
showing: boolean;
x: number;
y: number;
title?: string;

View File

@ -231,15 +231,9 @@ const unicodeEmojiSkinToneLabels = [
i18n.ts._skinTones?.dark ?? "Dark",
];
const size = computed(() =>
props.asReactionPicker ? reactionPickerSize.value : 1,
);
const width = computed(() =>
props.asReactionPicker ? reactionPickerWidth.value : 3,
);
const height = computed(() =>
props.asReactionPicker ? reactionPickerHeight.value : 2,
);
const size = reactionPickerSize;
const width = reactionPickerWidth;
const height = reactionPickerHeight;
const customEmojiCategories = emojiCategories;
const customEmojis = instance.emojis;
const q = ref<string | null>(null);

View File

@ -39,7 +39,7 @@ import { defaultStore } from "@/store";
withDefaults(
defineProps<{
manualShowing?: boolean | null;
src?: HTMLElement;
src?: HTMLElement | null;
showPinned?: boolean;
asReactionPicker?: boolean;
}>(),

View File

@ -42,7 +42,7 @@ useTooltip(el, (showing) => {
os.popup(
defineAsyncComponent(() => import("@/components/MkUrlPreviewPopup.vue")),
{
showing: showing.value,
showing,
url: props.url,
source: el.value,
},

View File

@ -1188,7 +1188,7 @@ async function insertEmoji(ev: MouseEvent) {
os.openEmojiPicker(
(ev.currentTarget ?? ev.target) as HTMLElement,
{},
textareaEl.value,
textareaEl.value!,
);
}

View File

@ -19,13 +19,12 @@
</template>
<script lang="ts" setup>
import type { Ref } from "vue";
import type { entities } from "firefish-js";
import MkTooltip from "./MkTooltip.vue";
import XReactionIcon from "@/components/MkReactionIcon.vue";
defineProps<{
showing: Ref<boolean>;
showing: boolean;
reaction: string;
emojis: entities.EmojiLite[];
targetElement: HTMLElement;

View File

@ -30,13 +30,12 @@
</template>
<script lang="ts" setup>
import type { Ref } from "vue";
import type { entities } from "firefish-js";
import MkTooltip from "./MkTooltip.vue";
import XReactionIcon from "@/components/MkReactionIcon.vue";
defineProps<{
showing: Ref<boolean>;
showing: boolean;
reaction: string;
users: entities.User[]; // TODO
count: number;

View File

@ -5,7 +5,7 @@
@after-leave="emit('closed')"
>
<div
v-show="unref(showing)"
v-show="showing"
ref="el"
class="buebdbiu _acrylic _shadow"
:style="{ zIndex, maxWidth: maxWidth + 'px' }"
@ -19,21 +19,14 @@
</template>
<script lang="ts" setup>
import {
type MaybeRef,
nextTick,
onMounted,
onUnmounted,
ref,
unref,
} from "vue";
import { nextTick, onMounted, onUnmounted, ref } from "vue";
import * as os from "@/os";
import { calcPopupPosition } from "@/scripts/popup-position";
import { defaultStore } from "@/store";
const props = withDefaults(
defineProps<{
showing: MaybeRef<boolean>;
showing: boolean;
targetElement?: HTMLElement | null;
x?: number;
y?: number;

View File

@ -19,12 +19,11 @@
</template>
<script lang="ts" setup>
import type { Ref } from "vue";
import type { entities } from "firefish-js";
import MkTooltip from "./MkTooltip.vue";
defineProps<{
showing: Ref<boolean>;
showing: boolean;
users: entities.User[];
count: number;
targetElement?: HTMLElement;

View File

@ -13,7 +13,7 @@
]"
>
<i
v-if="unref(success)"
v-if="success"
:class="[$style.icon, $style.success, iconify('ph-check')]"
></i>
<MkLoading
@ -29,16 +29,15 @@
</template>
<script lang="ts" setup>
import type { MaybeRef } from "vue";
import { shallowRef, unref, watch } from "vue";
import { shallowRef, watch } from "vue";
import MkModal from "@/components/MkModal.vue";
import iconify from "@/scripts/icon";
const modal = shallowRef<InstanceType<typeof MkModal>>();
const props = defineProps<{
success: MaybeRef<boolean>;
showing: MaybeRef<boolean>;
success: boolean;
showing: boolean;
text?: string;
}>();

View File

@ -3,7 +3,7 @@
import { EventEmitter } from "eventemitter3";
import { type Endpoints, type entities, api as firefishApi } from "firefish-js";
import insertTextAtCursor from "insert-text-at-cursor";
import type { Component, Ref } from "vue";
import type { Component, MaybeRef, Ref } from "vue";
import { defineAsyncComponent, markRaw, ref } from "vue";
import { i18n } from "./i18n";
import MkDialog from "@/components/MkDialog.vue";
@ -213,9 +213,13 @@ interface VueComponentConstructor<P, E> {
type NonArrayAble<A> = A extends Array<unknown> ? never : A;
type CanUseRef<T> = {
[K in keyof T]: MaybeRef<T[K]>;
};
export async function popup<Props, Emits>(
component: VueComponentConstructor<Props, Emits>,
props: Props,
props: CanUseRef<Props>,
events: Partial<NonArrayAble<NonNullable<Emits>>> = {},
disposeEvent?: keyof Partial<NonArrayAble<NonNullable<Emits>>>,
) {
@ -240,6 +244,7 @@ export async function popup<Props, Emits>(
id,
};
// Hint: Vue will automatically resolve ref here, so it is safe to use ref in props
popups.value.push(state);
return {

View File

@ -24,14 +24,14 @@ class ReactionPicker {
},
{
done: (reaction) => {
this.onChosen!(reaction);
this.onChosen?.(reaction);
},
close: () => {
this.manualShowing.value = false;
},
closed: () => {
this.src.value = null;
this.onClosed!();
this.onClosed?.();
},
},
);