Merge branch 'develop' into redis
This commit is contained in:
commit
77ded03330
13 changed files with 28 additions and 41 deletions
|
@ -1,6 +1,6 @@
|
||||||
import type * as http from "node:http";
|
import type * as http from "node:http";
|
||||||
import { EventEmitter } from "events";
|
import { EventEmitter } from "node:events";
|
||||||
import type { ParsedUrlQuery } from "querystring";
|
import type { ParsedUrlQuery } from "node:querystring";
|
||||||
import * as websocket from "websocket";
|
import * as websocket from "websocket";
|
||||||
|
|
||||||
import { subscriber as redisClient } from "@/db/redis.js";
|
import { subscriber as redisClient } from "@/db/redis.js";
|
||||||
|
|
|
@ -28,11 +28,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { Ref } from "vue";
|
|
||||||
import MkTooltip from "./MkTooltip.vue";
|
import MkTooltip from "./MkTooltip.vue";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
showing: Ref<boolean>;
|
showing: boolean;
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
title?: string;
|
title?: string;
|
||||||
|
|
|
@ -231,15 +231,9 @@ const unicodeEmojiSkinToneLabels = [
|
||||||
i18n.ts._skinTones?.dark ?? "Dark",
|
i18n.ts._skinTones?.dark ?? "Dark",
|
||||||
];
|
];
|
||||||
|
|
||||||
const size = computed(() =>
|
const size = reactionPickerSize;
|
||||||
props.asReactionPicker ? reactionPickerSize.value : 1,
|
const width = reactionPickerWidth;
|
||||||
);
|
const height = reactionPickerHeight;
|
||||||
const width = computed(() =>
|
|
||||||
props.asReactionPicker ? reactionPickerWidth.value : 3,
|
|
||||||
);
|
|
||||||
const height = computed(() =>
|
|
||||||
props.asReactionPicker ? reactionPickerHeight.value : 2,
|
|
||||||
);
|
|
||||||
const customEmojiCategories = emojiCategories;
|
const customEmojiCategories = emojiCategories;
|
||||||
const customEmojis = instance.emojis;
|
const customEmojis = instance.emojis;
|
||||||
const q = ref<string | null>(null);
|
const q = ref<string | null>(null);
|
||||||
|
|
|
@ -39,7 +39,7 @@ import { defaultStore } from "@/store";
|
||||||
withDefaults(
|
withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
manualShowing?: boolean | null;
|
manualShowing?: boolean | null;
|
||||||
src?: HTMLElement;
|
src?: HTMLElement | null;
|
||||||
showPinned?: boolean;
|
showPinned?: boolean;
|
||||||
asReactionPicker?: boolean;
|
asReactionPicker?: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
|
|
|
@ -42,7 +42,7 @@ useTooltip(el, (showing) => {
|
||||||
os.popup(
|
os.popup(
|
||||||
defineAsyncComponent(() => import("@/components/MkUrlPreviewPopup.vue")),
|
defineAsyncComponent(() => import("@/components/MkUrlPreviewPopup.vue")),
|
||||||
{
|
{
|
||||||
showing: showing.value,
|
showing,
|
||||||
url: props.url,
|
url: props.url,
|
||||||
source: el.value,
|
source: el.value,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1188,7 +1188,7 @@ async function insertEmoji(ev: MouseEvent) {
|
||||||
os.openEmojiPicker(
|
os.openEmojiPicker(
|
||||||
(ev.currentTarget ?? ev.target) as HTMLElement,
|
(ev.currentTarget ?? ev.target) as HTMLElement,
|
||||||
{},
|
{},
|
||||||
textareaEl.value,
|
textareaEl.value!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { Ref } from "vue";
|
|
||||||
import type { entities } from "firefish-js";
|
import type { entities } from "firefish-js";
|
||||||
import MkTooltip from "./MkTooltip.vue";
|
import MkTooltip from "./MkTooltip.vue";
|
||||||
import XReactionIcon from "@/components/MkReactionIcon.vue";
|
import XReactionIcon from "@/components/MkReactionIcon.vue";
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
showing: Ref<boolean>;
|
showing: boolean;
|
||||||
reaction: string;
|
reaction: string;
|
||||||
emojis: entities.EmojiLite[];
|
emojis: entities.EmojiLite[];
|
||||||
targetElement: HTMLElement;
|
targetElement: HTMLElement;
|
||||||
|
|
|
@ -30,13 +30,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { Ref } from "vue";
|
|
||||||
import type { entities } from "firefish-js";
|
import type { entities } from "firefish-js";
|
||||||
import MkTooltip from "./MkTooltip.vue";
|
import MkTooltip from "./MkTooltip.vue";
|
||||||
import XReactionIcon from "@/components/MkReactionIcon.vue";
|
import XReactionIcon from "@/components/MkReactionIcon.vue";
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
showing: Ref<boolean>;
|
showing: boolean;
|
||||||
reaction: string;
|
reaction: string;
|
||||||
users: entities.User[]; // TODO
|
users: entities.User[]; // TODO
|
||||||
count: number;
|
count: number;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
@after-leave="emit('closed')"
|
@after-leave="emit('closed')"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-show="unref(showing)"
|
v-show="showing"
|
||||||
ref="el"
|
ref="el"
|
||||||
class="buebdbiu _acrylic _shadow"
|
class="buebdbiu _acrylic _shadow"
|
||||||
:style="{ zIndex, maxWidth: maxWidth + 'px' }"
|
:style="{ zIndex, maxWidth: maxWidth + 'px' }"
|
||||||
|
@ -19,21 +19,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {
|
import { nextTick, onMounted, onUnmounted, ref } from "vue";
|
||||||
type MaybeRef,
|
|
||||||
nextTick,
|
|
||||||
onMounted,
|
|
||||||
onUnmounted,
|
|
||||||
ref,
|
|
||||||
unref,
|
|
||||||
} from "vue";
|
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import { calcPopupPosition } from "@/scripts/popup-position";
|
import { calcPopupPosition } from "@/scripts/popup-position";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
showing: MaybeRef<boolean>;
|
showing: boolean;
|
||||||
targetElement?: HTMLElement | null;
|
targetElement?: HTMLElement | null;
|
||||||
x?: number;
|
x?: number;
|
||||||
y?: number;
|
y?: number;
|
||||||
|
|
|
@ -19,12 +19,11 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { Ref } from "vue";
|
|
||||||
import type { entities } from "firefish-js";
|
import type { entities } from "firefish-js";
|
||||||
import MkTooltip from "./MkTooltip.vue";
|
import MkTooltip from "./MkTooltip.vue";
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
showing: Ref<boolean>;
|
showing: boolean;
|
||||||
users: entities.User[];
|
users: entities.User[];
|
||||||
count: number;
|
count: number;
|
||||||
targetElement?: HTMLElement;
|
targetElement?: HTMLElement;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
v-if="unref(success)"
|
v-if="success"
|
||||||
:class="[$style.icon, $style.success, iconify('ph-check')]"
|
:class="[$style.icon, $style.success, iconify('ph-check')]"
|
||||||
></i>
|
></i>
|
||||||
<MkLoading
|
<MkLoading
|
||||||
|
@ -29,16 +29,15 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { MaybeRef } from "vue";
|
import { shallowRef, watch } from "vue";
|
||||||
import { shallowRef, unref, watch } from "vue";
|
|
||||||
import MkModal from "@/components/MkModal.vue";
|
import MkModal from "@/components/MkModal.vue";
|
||||||
import iconify from "@/scripts/icon";
|
import iconify from "@/scripts/icon";
|
||||||
|
|
||||||
const modal = shallowRef<InstanceType<typeof MkModal>>();
|
const modal = shallowRef<InstanceType<typeof MkModal>>();
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
success: MaybeRef<boolean>;
|
success: boolean;
|
||||||
showing: MaybeRef<boolean>;
|
showing: boolean;
|
||||||
text?: string;
|
text?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import { EventEmitter } from "eventemitter3";
|
import { EventEmitter } from "eventemitter3";
|
||||||
import { type Endpoints, type entities, api as firefishApi } from "firefish-js";
|
import { type Endpoints, type entities, api as firefishApi } from "firefish-js";
|
||||||
import insertTextAtCursor from "insert-text-at-cursor";
|
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 { defineAsyncComponent, markRaw, ref } from "vue";
|
||||||
import { i18n } from "./i18n";
|
import { i18n } from "./i18n";
|
||||||
import MkDialog from "@/components/MkDialog.vue";
|
import MkDialog from "@/components/MkDialog.vue";
|
||||||
|
@ -213,9 +213,13 @@ interface VueComponentConstructor<P, E> {
|
||||||
|
|
||||||
type NonArrayAble<A> = A extends Array<unknown> ? never : A;
|
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>(
|
export async function popup<Props, Emits>(
|
||||||
component: VueComponentConstructor<Props, Emits>,
|
component: VueComponentConstructor<Props, Emits>,
|
||||||
props: Props,
|
props: CanUseRef<Props>,
|
||||||
events: Partial<NonArrayAble<NonNullable<Emits>>> = {},
|
events: Partial<NonArrayAble<NonNullable<Emits>>> = {},
|
||||||
disposeEvent?: keyof Partial<NonArrayAble<NonNullable<Emits>>>,
|
disposeEvent?: keyof Partial<NonArrayAble<NonNullable<Emits>>>,
|
||||||
) {
|
) {
|
||||||
|
@ -240,6 +244,7 @@ export async function popup<Props, Emits>(
|
||||||
id,
|
id,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Hint: Vue will automatically resolve ref here, so it is safe to use ref in props
|
||||||
popups.value.push(state);
|
popups.value.push(state);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -24,14 +24,14 @@ class ReactionPicker {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
done: (reaction) => {
|
done: (reaction) => {
|
||||||
this.onChosen!(reaction);
|
this.onChosen?.(reaction);
|
||||||
},
|
},
|
||||||
close: () => {
|
close: () => {
|
||||||
this.manualShowing.value = false;
|
this.manualShowing.value = false;
|
||||||
},
|
},
|
||||||
closed: () => {
|
closed: () => {
|
||||||
this.src.value = null;
|
this.src.value = null;
|
||||||
this.onClosed!();
|
this.onClosed?.();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue