From 61ab0e8093bd98fdb4abec28c16688e786c3f62f Mon Sep 17 00:00:00 2001 From: naskya Date: Sat, 13 Jan 2024 14:07:29 +0900 Subject: [PATCH] chore: format --- packages/client/src/components/MkPostForm.vue | 5 +++-- .../client/src/directives/adaptive-border.ts | 4 ++-- packages/client/src/directives/anim.ts | 4 ++-- packages/client/src/directives/appear.ts | 4 ++-- packages/client/src/directives/click-anime.ts | 4 ++-- packages/client/src/directives/follow-append.ts | 4 ++-- packages/client/src/directives/get-size.ts | 4 ++-- packages/client/src/directives/hotkey.ts | 4 ++-- packages/client/src/directives/panel.ts | 4 ++-- packages/client/src/directives/size.ts | 4 ++-- packages/client/src/directives/tooltip.ts | 4 ++-- packages/client/src/directives/user-preview.ts | 4 ++-- packages/client/src/directives/vibrate.ts | 4 ++-- packages/client/src/plugin.ts | 16 +++++++--------- .../client/src/scripts/extract-url-from-mfm.ts | 15 ++++++--------- 15 files changed, 40 insertions(+), 44 deletions(-) diff --git a/packages/client/src/components/MkPostForm.vue b/packages/client/src/components/MkPostForm.vue index 9f4db8b5..db1c964c 100644 --- a/packages/client/src/components/MkPostForm.vue +++ b/packages/client/src/components/MkPostForm.vue @@ -1048,8 +1048,9 @@ async function post() { if (postAccount.value) { const storedAccounts = await getAccounts(); - token = storedAccounts.find((x) => x.id === postAccount.value.id) - ?.token; + token = storedAccounts.find( + (x) => x.id === postAccount.value.id, + )?.token; } posting.value = true; diff --git a/packages/client/src/directives/adaptive-border.ts b/packages/client/src/directives/adaptive-border.ts index 888fd2ad..a5a7ddbd 100644 --- a/packages/client/src/directives/adaptive-border.ts +++ b/packages/client/src/directives/adaptive-border.ts @@ -1,6 +1,6 @@ import type { Directive } from "vue"; -export default ({ +export default { mounted(src, binding, vn) { const getBgColor = (el: HTMLElement) => { const style = window.getComputedStyle(el); @@ -26,4 +26,4 @@ export default ({ src.style.borderColor = myBg; } }, -} as Directive); +} as Directive; diff --git a/packages/client/src/directives/anim.ts b/packages/client/src/directives/anim.ts index 12936399..b738f6c4 100644 --- a/packages/client/src/directives/anim.ts +++ b/packages/client/src/directives/anim.ts @@ -1,6 +1,6 @@ import type { Directive } from "vue"; -export default ({ +export default { beforeMount(src, binding, vn) { src.style.opacity = "0"; src.style.transform = "scale(0.9)"; @@ -15,4 +15,4 @@ export default ({ src.style.transform = "none"; }, 1); }, -} as Directive); +} as Directive; diff --git a/packages/client/src/directives/appear.ts b/packages/client/src/directives/appear.ts index 30074337..8e93ebd2 100644 --- a/packages/client/src/directives/appear.ts +++ b/packages/client/src/directives/appear.ts @@ -1,6 +1,6 @@ import type { Directive } from "vue"; -export default ({ +export default { mounted(src, binding, vn) { const fn = binding.value; if (fn == null) return; @@ -19,4 +19,4 @@ export default ({ unmounted(src, binding, vn) { if (src._observer_) src._observer_.disconnect(); }, -} as Directive); +} as Directive; diff --git a/packages/client/src/directives/click-anime.ts b/packages/client/src/directives/click-anime.ts index 4ae4c88e..cca10c82 100644 --- a/packages/client/src/directives/click-anime.ts +++ b/packages/client/src/directives/click-anime.ts @@ -1,7 +1,7 @@ import type { Directive } from "vue"; // import { defaultStore } from "@/store"; -export default ({ +export default { mounted(el, binding, vn) { /* if (!defaultStore.state.animation) return; @@ -28,4 +28,4 @@ export default ({ }); */ }, -} as Directive); +} as Directive; diff --git a/packages/client/src/directives/follow-append.ts b/packages/client/src/directives/follow-append.ts index 444f4ac6..bf7223b8 100644 --- a/packages/client/src/directives/follow-append.ts +++ b/packages/client/src/directives/follow-append.ts @@ -1,7 +1,7 @@ import { getScrollContainer, getScrollPosition } from "@/scripts/scroll"; import type { Directive } from "vue"; -export default ({ +export default { mounted(src, binding, vn) { if (binding.value === false) return; @@ -36,4 +36,4 @@ export default ({ unmounted(src, binding, vn) { if (src._ro_) src._ro_.unobserve(src); }, -} as Directive); +} as Directive; diff --git a/packages/client/src/directives/get-size.ts b/packages/client/src/directives/get-size.ts index 13de3d55..e30eac75 100644 --- a/packages/client/src/directives/get-size.ts +++ b/packages/client/src/directives/get-size.ts @@ -35,7 +35,7 @@ function calc(src: Element) { info.fn(width, height); } -export default ({ +export default { mounted(src, binding, vn) { const resize = new ResizeObserver((entries, observer) => { calc(src); @@ -54,4 +54,4 @@ export default ({ if (info.intersection) info.intersection.disconnect(); mountings.delete(src); }, -} as Directive void>); +} as Directive void>; diff --git a/packages/client/src/directives/hotkey.ts b/packages/client/src/directives/hotkey.ts index 975b4e26..9bdfe476 100644 --- a/packages/client/src/directives/hotkey.ts +++ b/packages/client/src/directives/hotkey.ts @@ -1,7 +1,7 @@ import { makeHotkey } from "@/scripts/hotkey"; import type { Directive } from "vue"; -export default ({ +export default { mounted(el, binding) { el._hotkey_global = binding.modifiers.global === true; @@ -21,4 +21,4 @@ export default ({ el.removeEventListener("keydown", el._keyHandler); } }, -} as Directive); +} as Directive; diff --git a/packages/client/src/directives/panel.ts b/packages/client/src/directives/panel.ts index b7be721a..f1328fa3 100644 --- a/packages/client/src/directives/panel.ts +++ b/packages/client/src/directives/panel.ts @@ -1,6 +1,6 @@ import type { Directive } from "vue"; -export default ({ +export default { mounted(src, binding, vn) { const getBgColor = (el: HTMLElement) => { const style = window.getComputedStyle(el); @@ -28,4 +28,4 @@ export default ({ src.style.backgroundColor = "var(--panel)"; } }, -} as Directive); +} as Directive; diff --git a/packages/client/src/directives/size.ts b/packages/client/src/directives/size.ts index 5c0268e9..466fd7bb 100644 --- a/packages/client/src/directives/size.ts +++ b/packages/client/src/directives/size.ts @@ -88,7 +88,7 @@ function calc(el: Element) { } } -export default ({ +export default { mounted(src, binding, vn) { const resize = new ResizeObserver((entries, observer) => { calc(src); @@ -119,4 +119,4 @@ export default ({ if (info.intersection) info.intersection.disconnect(); mountings.delete(src); }, -} as Directive); +} as Directive; diff --git a/packages/client/src/directives/tooltip.ts b/packages/client/src/directives/tooltip.ts index 8d123f14..5ee29be7 100644 --- a/packages/client/src/directives/tooltip.ts +++ b/packages/client/src/directives/tooltip.ts @@ -10,7 +10,7 @@ import { defineAsyncComponent, ref } from "vue"; const start = isTouchUsing ? "touchstart" : "mouseover"; const end = isTouchUsing ? "touchend" : "mouseleave"; -export default ({ +export default { mounted(el: HTMLElement, binding, vn) { const delay = binding.modifiers.noDelay ? 0 : 100; @@ -119,4 +119,4 @@ export default ({ window.clearInterval(self.checkTimer); self.close(); }, -} as Directive); +} as Directive; diff --git a/packages/client/src/directives/user-preview.ts b/packages/client/src/directives/user-preview.ts index d5898db1..6cbe97d9 100644 --- a/packages/client/src/directives/user-preview.ts +++ b/packages/client/src/directives/user-preview.ts @@ -104,7 +104,7 @@ export class UserPreview { } } -export default ({ +export default { mounted(el: HTMLElement, binding, vn) { if (binding.value == null) return; @@ -121,4 +121,4 @@ export default ({ const self = el._userPreviewDirective_; self.preview.detach(); }, -} as Directive); +} as Directive; diff --git a/packages/client/src/directives/vibrate.ts b/packages/client/src/directives/vibrate.ts index 24ed8322..f62e2a74 100644 --- a/packages/client/src/directives/vibrate.ts +++ b/packages/client/src/directives/vibrate.ts @@ -1,11 +1,11 @@ import { vibrate } from "@/scripts/vibrate"; import type { Directive } from "vue"; -export default ({ +export default { mounted(el, binding) { const pattern = (binding.value as VibratePattern) ?? 20; el.addEventListener("mousedown", () => { vibrate(pattern); }); }, -} as Directive); +} as Directive; diff --git a/packages/client/src/plugin.ts b/packages/client/src/plugin.ts index 933333fb..5d182cdf 100644 --- a/packages/client/src/plugin.ts +++ b/packages/client/src/plugin.ts @@ -80,15 +80,13 @@ function createPluginEnv(opts) { }); }), // #endregion - "Plugin:register_post_form_action": values.FN_NATIVE( - ([title, handler]) => { - registerPostFormAction({ - pluginId: opts.plugin.id, - title: title.value, - handler, - }); - }, - ), + "Plugin:register_post_form_action": values.FN_NATIVE(([title, handler]) => { + registerPostFormAction({ + pluginId: opts.plugin.id, + title: title.value, + handler, + }); + }), "Plugin:register_user_action": values.FN_NATIVE(([title, handler]) => { registerUserAction({ pluginId: opts.plugin.id, diff --git a/packages/client/src/scripts/extract-url-from-mfm.ts b/packages/client/src/scripts/extract-url-from-mfm.ts index 1845f3a6..0c32e81b 100644 --- a/packages/client/src/scripts/extract-url-from-mfm.ts +++ b/packages/client/src/scripts/extract-url-from-mfm.ts @@ -17,13 +17,10 @@ export function extractUrlFromMfm( }); const urls: string[] = unique(urlNodes.map((x) => x.props.url)); - return urls.reduce( - (array, url) => { - const urlWithoutHash = removeHash(url); - if (!array.map((x) => removeHash(x)).includes(urlWithoutHash)) - array.push(url); - return array; - }, - [] as string[], - ); + return urls.reduce((array, url) => { + const urlWithoutHash = removeHash(url); + if (!array.map((x) => removeHash(x)).includes(urlWithoutHash)) + array.push(url); + return array; + }, [] as string[]); }