1
0
Fork 1
mirror of https://example.com synced 2024-11-22 11:06:38 +09:00

chore: lint

This commit is contained in:
naskya 2024-01-13 15:28:17 +09:00
parent 61ab0e8093
commit 8a7fd6b593
Signed by: naskya
GPG key ID: 712D413B3A9FED5C
58 changed files with 136 additions and 144 deletions

View file

@ -21,7 +21,7 @@ const TIME_2000: i64 = 946_684_800_000;
const TIMESTAMP_LENGTH: u16 = 8;
/// Initializes Cuid2 generator. Must be called before any [create_id].
pub fn init_id<'a>(length: u16, fingerprint: &'a str) {
pub fn init_id(length: u16, fingerprint: &str) {
FINGERPRINT.get_or_init(move || format!("{}{}", fingerprint, cuid2::create_id()));
GENERATOR.get_or_init(move || {
cuid2::CuidConstructor::new()

View file

@ -968,8 +968,8 @@
a = c.documentElement,
d = c.body,
e = window,
h = e.pageXOffset || a.scrollLeft,
i = e.pageYOffset || a.scrollTop,
h = e.scrollX || a.scrollLeft,
i = e.scrollY || a.scrollTop,
j = a.clientLeft || d.clientLeft,
k = a.clientTop || d.clientTop;
return { x: b.left + h - j, y: b.top + i - k };

View file

@ -33,18 +33,18 @@ const rootEl = ref<HTMLDivElement>();
const zIndex = ref<number>(os.claimZIndex("high"));
onMounted(() => {
let left = props.ev.pageX + 1, // + 1
top = props.ev.pageY + 1; // + 1
let left = props.ev.pageX + 1; // + 1
let top = props.ev.pageY + 1; // + 1
const width = rootEl.value.offsetWidth;
const height = rootEl.value.offsetHeight;
if (left + width - window.pageXOffset > window.innerWidth) {
left = window.innerWidth - width + window.pageXOffset;
if (left + width - window.scrollX > window.innerWidth) {
left = window.innerWidth - width + window.scrollX;
}
if (top + height - window.pageYOffset > window.innerHeight) {
top = window.innerHeight - height + window.pageYOffset;
if (top + height - window.scrollY > window.innerHeight) {
top = window.innerHeight - height + window.scrollY;
}
if (top < 0) {

View file

@ -237,8 +237,8 @@ const align = () => {
let left, top;
const x = srcRect.left + (fixed.value ? 0 : window.pageXOffset);
const y = srcRect.top + (fixed.value ? 0 : window.pageYOffset);
const x = srcRect.left + (fixed.value ? 0 : window.scrollX);
const y = srcRect.top + (fixed.value ? 0 : window.scrollY);
if (props.anchor.x === "center") {
left = x + props.src.offsetWidth / 2 - width / 2;
@ -286,8 +286,7 @@ const align = () => {
left = window.innerWidth - width + window.scrollX - 1;
}
const underSpace =
window.innerHeight - MARGIN - (top - window.pageYOffset);
const underSpace = window.innerHeight - MARGIN - (top - window.scrollY);
const upperSpace = srcRect.top - MARGIN;
//
@ -300,12 +299,7 @@ const align = () => {
top = window.scrollY + (upperSpace + MARGIN - height);
}
} else {
top =
window.innerHeight -
MARGIN -
height +
window.pageYOffset -
1;
top = window.innerHeight - MARGIN - height + window.scrollY - 1;
}
} else {
maxHeight.value = underSpace;
@ -327,12 +321,12 @@ const align = () => {
top >=
srcRect.top +
props.src.offsetHeight +
(fixed.value ? 0 : window.pageYOffset)
(fixed.value ? 0 : window.scrollY)
) {
transformOriginY = "top";
} else if (
top + height <=
srcRect.top + (fixed.value ? 0 : window.pageYOffset)
srcRect.top + (fixed.value ? 0 : window.scrollY)
) {
transformOriginY = "bottom";
}
@ -341,12 +335,12 @@ const align = () => {
left >=
srcRect.left +
props.src.offsetWidth +
(fixed.value ? 0 : window.pageXOffset)
(fixed.value ? 0 : window.scrollX)
) {
transformOriginX = "left";
} else if (
left + width <=
srcRect.left + (fixed.value ? 0 : window.pageXOffset)
srcRect.left + (fixed.value ? 0 : window.scrollX)
) {
transformOriginX = "right";
}

View file

@ -309,7 +309,7 @@ import { deepClone } from "@/scripts/clone";
import preprocess from "@/scripts/preprocess";
import { vibrate } from "@/scripts/vibrate";
import { langmap } from "@/scripts/langmap";
import { MenuItem } from "@/types/menu";
import type { MenuItem } from "@/types/menu";
import detectLanguage from "@/scripts/detect-language";
import icon from "@/scripts/icon";
@ -747,8 +747,8 @@ function filterLangmapByPrefix(
if (prefix === "zh")
to_return = to_return.concat([
{ langCode: "yue", nativeName: langmap["yue"].nativeName },
{ langCode: "nan", nativeName: langmap["nan"].nativeName },
{ langCode: "yue", nativeName: langmap.yue.nativeName },
{ langCode: "nan", nativeName: langmap.nan.nativeName },
]);
return to_return;

View file

@ -45,7 +45,6 @@ const isRefreshing = ref(false);
const pullDistance = ref(0);
let disabled = false;
let supportPointerDesktop = false;
let startScreenY: number | null = null;
@ -94,7 +93,7 @@ function moveBySystem(to: number): Promise<void> {
return;
}
const startTime = Date.now();
let intervalId = setInterval(() => {
const intervalId = setInterval(() => {
const time = Date.now() - startTime;
if (time > RELEASE_TRANSITION_DURATION) {
pullDistance.value = to;

View file

@ -4,8 +4,8 @@
:can-resize="true"
:front="true"
:buttons-right="buttonsRight"
@closed="emit('closed')"
class="oxzftdfc"
@closed="emit('closed')"
>
<template #header>
{{ i18n.ts.releaseNotes }}

View file

@ -3,8 +3,8 @@
:initial-width="800"
:can-resize="true"
:front="true"
@closed="emit('closed')"
class="thppypvi"
@closed="emit('closed')"
>
<template #header>
{{ title }}

View file

@ -44,6 +44,7 @@
<script lang="ts" setup>
import { computed, onUnmounted, provide, ref } from "vue";
import type { Endpoints } from "firefish-js";
import XNotes from "@/components/MkNotes.vue";
import MkPullToRefresh from "@/components/MkPullToRefresh.vue";
import MkInfo from "@/components/MkInfo.vue";
@ -54,7 +55,6 @@ import { i18n } from "@/i18n";
import { defaultStore } from "@/store";
import icon from "@/scripts/icon";
import type { Paging } from "@/components/MkPagination.vue";
import { Endpoints } from "firefish-js";
const props = defineProps<{
src: string;
@ -71,7 +71,9 @@ const emit = defineEmits<{
}>();
let endpoint = ""; // keyof Endpoints
let query, connection, connection2;
let query;
let connection;
let connection2;
let tlHint: string;
let tlHintClosed: boolean;
let tlNotesCount = 0;

View file

@ -36,8 +36,8 @@ onMounted(() => {
const rect = props.source.getBoundingClientRect();
const x =
Math.max(rect.left + props.source.offsetWidth / 2 - 300 / 2, 6) +
window.pageXOffset;
const y = rect.top + props.source.offsetHeight + window.pageYOffset;
window.scrollX;
const y = rect.top + props.source.offsetHeight + window.scrollY;
top.value = y;
left.value = x;

View file

@ -68,8 +68,8 @@ onMounted(() => {
const rect = props.source.getBoundingClientRect();
const x =
rect.left + props.source.offsetWidth / 2 - 300 / 2 + window.pageXOffset;
const y = rect.top + props.source.offsetHeight + window.pageYOffset;
rect.left + props.source.offsetWidth / 2 - 300 / 2 + window.scrollX;
const y = rect.top + props.source.offsetHeight + window.scrollY;
top.value = y;
left.value = x;

View file

@ -20,6 +20,7 @@
</span>
<span
v-else-if="showLightBox"
ref="gallery"
v-user-preview="disablePreview ? undefined : user.id"
class="eiwwqkts _noSelect showLightBox"
:class="{
@ -28,7 +29,6 @@
}"
:style="{ color }"
:title="acct(user)"
ref="gallery"
@click.stop
>
<img class="inner avatar" :src="url" decoding="async" />
@ -64,14 +64,14 @@
<script lang="ts" setup>
import { computed, onMounted, ref, watch } from "vue";
import type * as firefish from "firefish-js";
import PhotoSwipeLightbox from "photoswipe/lightbox";
import PhotoSwipe from "photoswipe";
import { getStaticImageUrl } from "@/scripts/get-static-image-url";
import { extractAvgColorFromBlurhash } from "@/scripts/extract-avg-color-from-blurhash";
import { acct, userPage } from "@/filters/user";
import MkUserOnlineIndicator from "@/components/MkUserOnlineIndicator.vue";
import { defaultStore } from "@/store";
import { $i } from "@/reactiveAccount";
import PhotoSwipeLightbox from "photoswipe/lightbox";
import PhotoSwipe from "photoswipe";
import "photoswipe/style.css";
const props = withDefaults(

View file

@ -1,3 +1,6 @@
import * as mfm from "mfm-js";
import { defineComponent, h } from "vue";
import type { VNode } from "vue";
import MkCode from "@/components/MkCode.vue";
import MkFormula from "@/components/MkFormula.vue";
import MkGoogle from "@/components/MkGoogle.vue";
@ -10,10 +13,6 @@ import MkUrl from "@/components/global/MkUrl.vue";
import { host } from "@/config";
import { concat } from "@/scripts/array";
import { reducedMotion } from "@/scripts/reduced-motion";
import { defaultStore } from "@/store";
import * as mfm from "mfm-js";
import { defineComponent, h } from "vue";
import type { VNode } from "vue";
export default defineComponent({
props: {

View file

@ -1,5 +1,5 @@
import { getScrollContainer, getScrollPosition } from "@/scripts/scroll";
import type { Directive } from "vue";
import { getScrollContainer, getScrollPosition } from "@/scripts/scroll";
export default {
mounted(src, binding, vn) {

View file

@ -1,5 +1,5 @@
import { makeHotkey } from "@/scripts/hotkey";
import type { Directive } from "vue";
import { makeHotkey } from "@/scripts/hotkey";
export default {
mounted(el, binding) {

View file

@ -1,6 +1,6 @@
import type { Ref } from "vue";
import Ripple from "@/components/MkRipple.vue";
import { popup } from "@/os";
import type { Ref } from "vue";
export default {
mounted(el: HTMLElement, binding: Ref<boolean>) {

View file

@ -1,11 +1,11 @@
// TODO: useTooltip関数使うようにしたい
// ただディレクティブ内でonUnmountedなどのcomposition api使えるのか不明
import type { Directive } from "vue";
import { defineAsyncComponent, ref } from "vue";
import { alert, popup } from "@/os";
import { mainRouter } from "@/router";
import { isTouchUsing } from "@/scripts/touch";
import type { Directive } from "vue";
import { defineAsyncComponent, ref } from "vue";
const start = isTouchUsing ? "touchstart" : "mouseover";
const end = isTouchUsing ? "touchend" : "mouseleave";

View file

@ -1,6 +1,6 @@
import { popup } from "@/os";
import type { Directive } from "vue";
import { defineAsyncComponent, ref } from "vue";
import { popup } from "@/os";
export class UserPreview {
private el;

View file

@ -1,5 +1,5 @@
import { vibrate } from "@/scripts/vibrate";
import type { Directive } from "vue";
import { vibrate } from "@/scripts/vibrate";
export default {
mounted(el, binding) {

View file

@ -1,6 +1,6 @@
import { url } from "@/config";
import type * as firefish from "firefish-js";
import * as Acct from "firefish-js/built/acct";
import { url } from "@/config";
export const acct = (user: firefish.Acct) => {
return Acct.toString(user);

View file

@ -22,7 +22,6 @@ if (accounts) {
}
// #endregion
// import { compareVersions } from "compare-versions";
import {
computed,
createApp,
@ -32,10 +31,10 @@ import {
watch,
} from "vue";
import { set } from "@/scripts/idb-proxy";
// import { compareVersions } from "compare-versions";
import { login, refreshAccount, signout, updateAccount } from "@/account";
import components from "@/components";
import { langmap } from "@/scripts/langmap";
import { lang, ui, version } from "@/config";
import directives from "@/directives";
import { i18n } from "@/i18n";
@ -47,6 +46,7 @@ import { getAccountFromId } from "@/scripts/get-account-from-id";
import { makeHotkey } from "@/scripts/hotkey";
import { initializeSw } from "@/scripts/initialize-sw";
import { isDeviceDarkmode } from "@/scripts/is-device-darkmode";
import { langmap } from "@/scripts/langmap";
import { getUrlWithoutLoginId } from "@/scripts/login-id";
import { reactionPicker } from "@/scripts/reaction-picker";
import { search } from "@/scripts/search";
@ -54,7 +54,7 @@ import * as sound from "@/scripts/sound";
import { applyTheme } from "@/scripts/theme";
import { reloadChannel } from "@/scripts/unison-reload";
import { ColdDeviceStorage, defaultStore } from "@/store";
import { useStream, isReloading } from "@/stream";
import { isReloading, useStream } from "@/stream";
import widgets from "@/widgets";
function checkForSplash() {
@ -125,7 +125,7 @@ function checkForSplash() {
const html = document.documentElement;
html.setAttribute("lang", lang ?? "en-US");
html.setAttribute("dir", langmap[lang].rtl === true ? "rtl" : "ltr");
//#endregion
// #endregion
// #region loginId
const params = new URLSearchParams(location.search);

View file

@ -216,7 +216,7 @@ import MkLink from "@/components/MkLink.vue";
import MkSparkle from "@/components/MkSparkle.vue";
import { physics } from "@/scripts/physics";
import { i18n } from "@/i18n";
import { defaultStore, defaultReactions } from "@/store";
import { defaultReactions, defaultStore } from "@/store";
import * as os from "@/os";
import { definePageMetadata } from "@/scripts/page-metadata";
import icon from "@/scripts/icon";

View file

@ -1,6 +1,10 @@
<template>
<div>
<XDrive ref="drive" @cd="(x) => (folder = x)" :fullPageHeader="true" />
<XDrive
ref="drive"
:full-page-header="true"
@cd="(x) => (folder = x)"
/>
</div>
</template>

View file

@ -43,6 +43,7 @@
import { computed, onMounted, ref, watch } from "vue";
import { Virtual } from "swiper/modules";
import { Swiper, SwiperSlide } from "swiper/vue";
import moment from "moment";
import XNotes from "@/components/MkNotes.vue";
import XUserList from "@/components/MkUserList.vue";
import { i18n } from "@/i18n";
@ -53,7 +54,6 @@ import icon from "@/scripts/icon";
import { $i } from "@/reactiveAccount";
import "swiper/scss";
import "swiper/scss/virtual";
import moment from "moment";
import { api } from "@/os";
const props = defineProps<{

View file

@ -75,7 +75,7 @@ import * as os from "@/os";
import { defaultStore } from "@/store";
import { i18n } from "@/i18n";
import { instance } from "@/instance";
import { $i, isSignedIn, isModerator } from "@/reactiveAccount";
import { isModerator, isSignedIn } from "@/reactiveAccount";
import { definePageMetadata } from "@/scripts/page-metadata";
import { deviceKind } from "@/scripts/device-kind";
import icon from "@/scripts/icon";

View file

@ -121,7 +121,7 @@
</div>
<MkAvatar
class="avatar"
:showLightBox="true"
:show-light-box="true"
:user="user"
:disable-preview="true"
:show-indicator="true"
@ -390,7 +390,7 @@ import { userPage } from "@/filters/user";
import { defaultStore } from "@/store";
import * as os from "@/os";
import { i18n } from "@/i18n";
import { $i, isSignedIn, isModerator } from "@/reactiveAccount";
import { $i, isModerator, isSignedIn } from "@/reactiveAccount";
import { host } from "@/config";
import icon from "@/scripts/icon";

View file

@ -1,10 +1,9 @@
import type { AsyncComponentLoader } from "vue";
import { defineAsyncComponent, inject } from "vue";
import { isModerator, isEmojiMod } from "@/reactiveAccount";
import { Router } from "@/nirax";
import MkError from "@/pages/_error_.vue";
import MkLoading from "@/pages/_loading_.vue";
import { $i, isSignedIn } from "@/reactiveAccount";
import { $i, isEmojiMod, isModerator, isSignedIn } from "@/reactiveAccount";
const page = (loader: AsyncComponentLoader<any>) =>
defineAsyncComponent({

View file

@ -1,6 +1,6 @@
import { utils, values } from "@syuilo/aiscript";
import * as os from "@/os";
import { $i } from "@/reactiveAccount";
import { utils, values } from "@syuilo/aiscript";
export function createAiScriptEnv(opts) {
let apiRequests = 0;

View file

@ -1,8 +1,8 @@
import { popup } from "@/os";
import { toASCII } from "punycode/";
import getCaretCoordinates from "textarea-caret";
import type { Ref } from "vue";
import { defineAsyncComponent, nextTick, ref } from "vue";
import { popup } from "@/os";
export class Autocomplete {
private suggestion: {

View file

@ -1,8 +1,8 @@
import { defaultStore } from "@/store";
import keywordSet from "emojilib";
import individualData from "unicode-emoji-json/data-by-emoji.json";
import data from "unicode-emoji-json/data-by-group.json";
import emojiComponents from "unicode-emoji-json/data-emoji-components.json";
import { defaultStore } from "@/store";
export interface UnicodeEmojiDef {
emoji: string;

View file

@ -1,5 +1,5 @@
import { unique } from "@/scripts/array";
import * as mfm from "mfm-js";
import { unique } from "@/scripts/array";
// unique without hash
// [ http://a/#1, http://a/#2, http://b/#3 ] => [ http://a/#1, http://b/#3 ]

View file

@ -1,5 +1,5 @@
import { host as localHost } from "@/config";
import * as Acct from "firefish-js/built/acct";
import { host as localHost } from "@/config";
export async function genSearchQuery(v: any, q: string) {
let host: string;

View file

@ -1,16 +1,16 @@
import type * as firefish from "firefish-js";
import type { Ref } from "vue";
import { defineAsyncComponent } from "vue";
import { url } from "@/config";
import { i18n } from "@/i18n";
import { instance } from "@/instance";
import * as os from "@/os";
import { $i, isSignedIn, isModerator } from "@/reactiveAccount";
import { $i, isModerator, isSignedIn } from "@/reactiveAccount";
import copyToClipboard from "@/scripts/copy-to-clipboard";
import { getUserMenu } from "@/scripts/get-user-menu";
import icon from "@/scripts/icon";
import { shareAvailable } from "@/scripts/share-available";
import { noteActions } from "@/store";
import type * as firefish from "firefish-js";
import type { Ref } from "vue";
import { defineAsyncComponent } from "vue";
export function getNoteMenu(props: {
note: firefish.entities.Note;

View file

@ -1,3 +1,5 @@
import * as Acct from "firefish-js/built/acct";
import { defineAsyncComponent } from "vue";
import { $i, isModerator, isSignedIn } from "@/reactiveAccount";
import { host } from "@/config";
import { i18n } from "@/i18n";
@ -7,8 +9,6 @@ import { mainRouter } from "@/router";
import copyToClipboard from "@/scripts/copy-to-clipboard";
import icon from "@/scripts/icon";
import { userActions } from "@/store";
import * as Acct from "firefish-js/built/acct";
import { defineAsyncComponent } from "vue";
export function getUserMenu(user, router: Router = mainRouter) {
async function pushList() {

View file

@ -1,16 +1,16 @@
import { version } from "@/config";
import * as os from "@/os";
import { Interpreter, utils, values } from "@syuilo/aiscript";
import autobind from "autobind-decorator";
import type { Ref } from "vue";
import { markRaw, ref, unref } from "vue";
import { HpmlError, HpmlScope } from ".";
import type { Fn, PageVar, envVarsDef } from ".";
import { createAiScriptEnv } from "../aiscript/api";
import { collectPageVars } from "../collect-page-vars";
import type { Expr, Variable } from "./expr";
import { isLiteralValue } from "./expr";
import { initAiLib, initHpmlLib } from "./lib";
import type { Fn, PageVar, envVarsDef } from ".";
import { HpmlError, HpmlScope } from ".";
import * as os from "@/os";
import { version } from "@/config";
/**
* Hpml evaluator

View file

@ -2,10 +2,10 @@
* Hpml
*/
import icon from "@/scripts/icon";
import autobind from "autobind-decorator";
import type { Hpml } from "./evaluator";
import { funcDefs } from "./lib";
import icon from "@/scripts/icon";
export interface Fn {
slots: string[];

View file

@ -1,9 +1,9 @@
import icon from "@/scripts/icon";
import { utils, values } from "@syuilo/aiscript";
import seedrandom from "seedrandom";
import type { Fn, HpmlScope } from ".";
import type { Hpml } from "./evaluator";
import type { Expr } from "./expr";
import type { Fn, HpmlScope } from ".";
import icon from "@/scripts/icon";
/* TODO: https://www.chartjs.org/docs/latest/configuration/canvas-background.html#color
// https://stackoverflow.com/questions/38493564/chart-area-background-color-chartjs

View file

@ -1,9 +1,9 @@
import autobind from "autobind-decorator";
import { envVarsDef } from ".";
import type { PageVar, Type } from ".";
import type { Expr, Variable } from "./expr";
import { isLiteralValue } from "./expr";
import { funcDefs } from "./lib";
import type { PageVar, Type } from ".";
import { envVarsDef } from ".";
interface TypeError {
arg: number;

View file

@ -1,6 +1,6 @@
import * as Acct from "firefish-js/built/acct";
import { i18n } from "@/i18n";
import * as os from "@/os";
import * as Acct from "firefish-js/built/acct";
export async function lookupUser() {
const { canceled, result } = await os.inputText({

View file

@ -1,8 +1,8 @@
import { defineAsyncComponent } from "vue";
import { i18n } from "@/i18n";
import { popup } from "@/os";
import { isSignedIn } from "@/reactiveAccount";
import { vibrate } from "@/scripts/vibrate";
import { defineAsyncComponent } from "vue";
export function pleaseLogin(path?: string) {
if (isSignedIn) return;

View file

@ -1,5 +1,5 @@
import * as config from "@/config";
import { appendQuery } from "./url";
import * as config from "@/config";
export function popout(path: string, w?: HTMLElement) {
let url =

View file

@ -24,9 +24,8 @@ export function calcPopupPosition(
let top: number;
if (props.anchorElement) {
left =
rect.left + window.pageXOffset + props.anchorElement.offsetWidth / 2;
top = rect.top + window.pageYOffset - contentHeight - props.innerMargin;
left = rect.left + window.scrollX + props.anchorElement.offsetWidth / 2;
top = rect.top + window.scrollY - contentHeight - props.innerMargin;
} else {
left = props.x;
top = props.y - contentHeight - props.innerMargin;
@ -34,23 +33,21 @@ export function calcPopupPosition(
left -= el.offsetWidth / 2;
if (left + contentWidth - window.pageXOffset > window.innerWidth) {
left = window.innerWidth - contentWidth + window.pageXOffset - 1;
if (left + contentWidth - window.scrollX > window.innerWidth) {
left = window.innerWidth - contentWidth + window.scrollX - 1;
}
return [left, top];
};
const calcPosWhenBottom = () => {
let left: number;
let top: number;
let left: number, top: number;
if (props.anchorElement) {
left =
rect.left + window.pageXOffset + props.anchorElement.offsetWidth / 2;
left = rect.left + window.scrollX + props.anchorElement.offsetWidth / 2;
top =
rect.top +
window.pageYOffset +
window.scrollY +
props.anchorElement.offsetHeight +
props.innerMargin;
} else {
@ -60,8 +57,8 @@ export function calcPopupPosition(
left -= el.offsetWidth / 2;
if (left + contentWidth - window.pageXOffset > window.innerWidth) {
left = window.innerWidth - contentWidth + window.pageXOffset - 1;
if (left + contentWidth - window.scrollX > window.innerWidth) {
left = window.innerWidth - contentWidth + window.scrollX - 1;
}
return [left, top];
@ -72,9 +69,8 @@ export function calcPopupPosition(
let top: number;
if (props.anchorElement) {
left = rect.left + window.pageXOffset - contentWidth - props.innerMargin;
top =
rect.top + window.pageYOffset + props.anchorElement.offsetHeight / 2;
left = rect.left + window.scrollX - contentWidth - props.innerMargin;
top = rect.top + window.scrollY + props.anchorElement.offsetHeight / 2;
} else {
left = props.x - contentWidth - props.innerMargin;
top = props.y;
@ -82,8 +78,8 @@ export function calcPopupPosition(
top -= el.offsetHeight / 2;
if (top + contentHeight - window.pageYOffset > window.innerHeight) {
top = window.innerHeight - contentHeight + window.pageYOffset - 1;
if (top + contentHeight - window.scrollY > window.innerHeight) {
top = window.innerHeight - contentHeight + window.scrollY - 1;
}
return [left, top];
@ -97,18 +93,17 @@ export function calcPopupPosition(
left =
rect.left +
props.anchorElement.offsetWidth +
window.pageXOffset +
window.scrollX +
props.innerMargin;
if (props.align === "top") {
top = rect.top + window.pageYOffset;
top = rect.top + window.scrollY;
if (props.alignOffset != null) top += props.alignOffset;
} else if (props.align === "bottom") {
// TODO
} else {
// center
top =
rect.top + window.pageYOffset + props.anchorElement.offsetHeight / 2;
top = rect.top + window.scrollY + props.anchorElement.offsetHeight / 2;
top -= el.offsetHeight / 2;
}
} else {
@ -117,8 +112,8 @@ export function calcPopupPosition(
top -= el.offsetHeight / 2;
}
if (top + contentHeight - window.pageYOffset > window.innerHeight) {
top = window.innerHeight - contentHeight + window.pageYOffset - 1;
if (top + contentHeight - window.scrollY > window.innerHeight) {
top = window.innerHeight - contentHeight + window.scrollY - 1;
}
return [left, top];
@ -134,7 +129,7 @@ export function calcPopupPosition(
const [left, top] = calcPosWhenTop();
// ツールチップを上に向かって表示するスペースがなければ下に向かって出す
if (top - window.pageYOffset < 0) {
if (top - window.scrollY < 0) {
const [left, top] = calcPosWhenBottom();
return { left, top, transformOrigin: "center top" };
}
@ -152,7 +147,7 @@ export function calcPopupPosition(
const [left, top] = calcPosWhenLeft();
// ツールチップを左に向かって表示するスペースがなければ右に向かって出す
if (left - window.pageXOffset < 0) {
if (left - window.scrollX < 0) {
const [left, top] = calcPosWhenRight();
return { left, top, transformOrigin: "left center" };
}

View file

@ -1,6 +1,6 @@
import * as mfm from "mfm-js";
import { expandKaTeXMacro } from "@/scripts/katex-macro";
import { defaultStore } from "@/store";
import * as mfm from "mfm-js";
export default function (text: string): string {
if (defaultStore.state.enableCustomKaTeXMacro) {

View file

@ -1,6 +1,6 @@
import { popup } from "@/os";
import type { Ref } from "vue";
import { defineAsyncComponent, ref } from "vue";
import { popup } from "@/os";
class ReactionPicker {
private src: Ref<HTMLElement | null> = ref(null);

View file

@ -1,11 +1,11 @@
import type { DriveFile } from "firefish-js/built/entities";
import { ref } from "vue";
import { i18n } from "@/i18n";
import * as os from "@/os";
import icon from "@/scripts/icon";
import { uploadFile } from "@/scripts/upload";
import { defaultStore } from "@/store";
import { useStream } from "@/stream";
import type { DriveFile } from "firefish-js/built/entities";
import { ref } from "vue";
const stream = useStream();

View file

@ -3,7 +3,7 @@
*/
export function shuffle<T extends any[]>(array: T): T {
let currentIndex = array.length;
let randomIndex;
let randomIndex: number;
// While there remain elements to shuffle.
while (currentIndex !== 0) {

View file

@ -1,6 +1,6 @@
import { globalEvents } from "@/events";
import tinycolor from "tinycolor2";
import { ref } from "vue";
import { globalEvents } from "@/events";
export interface Theme {
id: string;

View file

@ -1,11 +1,11 @@
import { readAndCompressImage } from "browser-image-resizer";
import type * as firefish from "firefish-js";
import { reactive, ref } from "vue";
import { apiUrl } from "@/config";
import { i18n } from "@/i18n";
import { alert } from "@/os";
import { $i } from "@/reactiveAccount";
import { defaultStore } from "@/store";
import { readAndCompressImage } from "browser-image-resizer";
import type * as firefish from "firefish-js";
import { reactive, ref } from "vue";
interface Uploading {
id: string;

View file

@ -1,6 +1,6 @@
import { onDeactivated, onUnmounted, ref } from "vue";
import MkChartTooltip from "@/components/MkChartTooltip.vue";
import * as os from "@/os";
import { onDeactivated, onUnmounted, ref } from "vue";
export function useChartTooltip(
opts: { position: "top" | "middle" } = { position: "top" },
@ -50,11 +50,11 @@ export function useChartTooltip(
const rect = context.chart.canvas.getBoundingClientRect();
tooltipShowing.value = true;
tooltipX.value = rect.left + window.pageXOffset + context.tooltip.caretX;
tooltipX.value = rect.left + window.scrollX + context.tooltip.caretX;
if (opts.position === "top") {
tooltipY.value = rect.top + window.pageYOffset;
tooltipY.value = rect.top + window.scrollY;
} else if (opts.position === "middle") {
tooltipY.value = rect.top + window.pageYOffset + context.tooltip.caretY;
tooltipY.value = rect.top + window.scrollY + context.tooltip.caretY;
}
}

View file

@ -1,9 +1,9 @@
import * as os from "@/os";
import { $i, isSignedIn } from "@/reactiveAccount";
import { useStream } from "@/stream";
import type * as firefish from "firefish-js";
import type { Ref } from "vue";
import { onUnmounted } from "vue";
import * as os from "@/os";
import { $i, isSignedIn } from "@/reactiveAccount";
import { useStream } from "@/stream";
export function useNoteCapture(props: {
rootEl: Ref<HTMLElement>;

View file

@ -5,7 +5,7 @@ import { $i } from "@/reactiveAccount";
let stream: firefish.Stream | null = null;
let timeoutHeartBeat: number | null = null;
export let isReloading: boolean = false;
export let isReloading = false;
export function useStream() {
if (stream != null) return stream;

View file

@ -19,7 +19,7 @@
<script lang="ts" setup>
import { onUnmounted, ref } from "vue";
import { useStream, isReloading } from "@/stream";
import { isReloading, useStream } from "@/stream";
import { i18n } from "@/i18n";
import { defaultStore } from "@/store";

View file

@ -1,9 +1,9 @@
import { api } from "@/os";
import { deepClone } from "@/scripts/clone";
import type { notificationTypes } from "firefish-js";
import { throttle } from "throttle-debounce";
import { markRaw } from "vue";
import { Storage } from "../../pizzax";
import { deepClone } from "@/scripts/clone";
import { api } from "@/os";
interface ColumnWidget {
name: string;

View file

@ -50,7 +50,7 @@ import type { Column } from "./deck-store";
import { removeColumn, updateColumn } from "./deck-store";
import XTimeline from "@/components/MkTimeline.vue";
import * as os from "@/os";
import { isSignedIn, isModerator } from "@/reactiveAccount";
import { isModerator, isSignedIn } from "@/reactiveAccount";
import { instance } from "@/instance";
import { i18n } from "@/i18n";
import icon from "@/scripts/icon";

View file

@ -1,8 +1,8 @@
import { throttle } from "throttle-debounce";
import { reactive, watch } from "vue";
import * as os from "@/os";
import { deepClone } from "@/scripts/clone";
import type { Form, GetFormResultType } from "@/scripts/form";
import { throttle } from "throttle-debounce";
import { reactive, watch } from "vue";
export interface Widget<P extends Record<string, unknown>> {
id: string;

View file

@ -11,30 +11,30 @@ import {
DetailedInstanceMetadata,
DriveFile,
DriveFolder,
FollowRequest,
Following,
FollowingFolloweePopulated,
FollowingFollowerPopulated,
FollowRequest,
GalleryPost,
Instance,
InstanceMetadata,
LiteInstanceMetadata,
MeDetailed,
MessagingMessage,
Note,
NoteFavorite,
NoteReaction,
Notification,
OriginType,
Page,
ServerInfo,
Signin,
Stats,
User,
UserDetailed,
UserGroup,
UserList,
UserSorting,
Notification,
NoteReaction,
Signin,
MessagingMessage,
} from "./entities";
type TODO = Record<string, any> | null;

View file

@ -1,8 +1,8 @@
import { Acct } from "./acct";
import { Endpoints } from "./api.types";
import * as consts from "./consts";
import Stream, { Connection } from "./streaming";
import { Channels } from "./streaming.types";
import { Acct } from "./acct";
import * as consts from "./consts";
export { Endpoints, Stream, Connection as ChannelConnection, Channels, Acct };

View file

@ -27,9 +27,9 @@ export function urlQuery(
const params = Object.entries(obj)
.filter(([, v]) => (Array.isArray(v) ? v.length : v !== undefined))
.reduce(
// rome-ignore lint/suspicious/noAssignInExpressions: <Used for key assigning>
// rome-ignore lint/style/noNonNullAssertion: <>
// rome-ignore lint/style/noCommaOperator: <>
// biome-ignore lint/suspicious/noAssignInExpressions: <Used for key assigning>
// biome-ignore lint/style/noNonNullAssertion: <>
// biome-ignore lint/style/noCommaOperator: <>
(a, [k, v]) => ((a[k] = v!), a),
{} as Record<string, string | number | boolean>,
);