client: fix various lints
This commit is contained in:
parent
6c4655693e
commit
d1f3353771
5 changed files with 44 additions and 41 deletions
|
@ -1,12 +1,12 @@
|
|||
<template>
|
||||
<MkContainer :naked="widgetProps.transparent" :show-header="false" class="mkw-aichan">
|
||||
<iframe ref="live2d" class="dedjhjmo" src="https://misskey-dev.github.io/mascot-web/?scale=1.5&y=1.1&eyeY=100" @click="touched"></iframe>
|
||||
<iframe ref="live2d" class="dedjhjmo" src="https://misskey-dev.github.io/mascot-web/?scale=1.5&y=1.1&eyeY=100"></iframe>
|
||||
</MkContainer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, reactive, ref } from 'vue';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
|
||||
import { onMounted, onUnmounted } from 'vue';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget';
|
||||
import { GetFormResultType } from '@/scripts/form';
|
||||
|
||||
const name = 'ai';
|
||||
|
@ -23,8 +23,12 @@ type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
|
|||
// 現時点ではvueの制限によりimportしたtypeをジェネリックに渡せない
|
||||
//const props = defineProps<WidgetComponentProps<WidgetProps>>();
|
||||
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
|
||||
const props = defineProps<{ widget?: Widget<WidgetProps>; }>();
|
||||
const emit = defineEmits<{ (ev: 'updateProps', props: WidgetProps); }>();
|
||||
const props = defineProps<{
|
||||
widget?: Widget<WidgetProps>;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(ev: 'updateProps', widgetProps: WidgetProps);
|
||||
}>();
|
||||
|
||||
const { widgetProps, configure } = useWidgetPropsManager(name,
|
||||
widgetPropsDef,
|
||||
|
@ -32,15 +36,11 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
|
|||
emit,
|
||||
);
|
||||
|
||||
const live2d = ref<HTMLIFrameElement>();
|
||||
const live2d: HTMLIFrameElement = $ref();
|
||||
|
||||
const touched = () => {
|
||||
//if (this.live2d) this.live2d.changeExpression('gurugurume');
|
||||
};
|
||||
|
||||
const onMousemove = (ev: MouseEvent) => {
|
||||
const iframeRect = live2d.value.getBoundingClientRect();
|
||||
live2d.value.contentWindow.postMessage({
|
||||
const onMousemove = (ev: MouseEvent): void => {
|
||||
const iframeRect = live2d.getBoundingClientRect();
|
||||
live2d.contentWindow?.postMessage({
|
||||
type: 'moveCursor',
|
||||
body: {
|
||||
x: ev.clientX - iframeRect.left,
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, ref, watch } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
import { AiScript, parse, utils } from '@syuilo/aiscript';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget';
|
||||
import { GetFormResultType } from '@/scripts/form';
|
||||
import * as os from '@/os';
|
||||
import MkContainer from '@/components/ui/container.vue';
|
||||
|
@ -43,8 +43,12 @@ type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
|
|||
// 現時点ではvueの制限によりimportしたtypeをジェネリックに渡せない
|
||||
//const props = defineProps<WidgetComponentProps<WidgetProps>>();
|
||||
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
|
||||
const props = defineProps<{ widget?: Widget<WidgetProps>; }>();
|
||||
const emit = defineEmits<{ (ev: 'updateProps', props: WidgetProps); }>();
|
||||
const props = defineProps<{
|
||||
widget?: Widget<WidgetProps>;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(ev: 'updateProps', widgetProps: WidgetProps): void;
|
||||
}>();
|
||||
|
||||
const { widgetProps, configure } = useWidgetPropsManager(name,
|
||||
widgetPropsDef,
|
||||
|
@ -58,7 +62,7 @@ const logs = ref<{
|
|||
print: boolean;
|
||||
}[]>([]);
|
||||
|
||||
const run = async () => {
|
||||
const run = async (): Promise<void> => {
|
||||
logs.value = [];
|
||||
const aiscript = new AiScript(createAiScriptEnv({
|
||||
storageKey: 'widget',
|
||||
|
@ -68,7 +72,7 @@ const run = async () => {
|
|||
return new Promise(ok => {
|
||||
os.inputText({
|
||||
title: q,
|
||||
}).then(({ canceled, result: a }) => {
|
||||
}).then(({ result: a }) => {
|
||||
ok(a);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, ref, watch } from 'vue';
|
||||
import { AiScript, parse, utils } from '@syuilo/aiscript';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
|
||||
import { AiScript, parse } from '@syuilo/aiscript';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget';
|
||||
import { GetFormResultType } from '@/scripts/form';
|
||||
import * as os from '@/os';
|
||||
import { createAiScriptEnv } from '@/scripts/aiscript/api';
|
||||
|
@ -39,8 +38,12 @@ type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
|
|||
// 現時点ではvueの制限によりimportしたtypeをジェネリックに渡せない
|
||||
//const props = defineProps<WidgetComponentProps<WidgetProps>>();
|
||||
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
|
||||
const props = defineProps<{ widget?: Widget<WidgetProps>; }>();
|
||||
const emit = defineEmits<{ (ev: 'updateProps', props: WidgetProps); }>();
|
||||
const props = defineProps<{
|
||||
widget?: Widget<WidgetProps>;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(ev: 'updateProps', widgetProps: WidgetProps): void;
|
||||
}>();
|
||||
|
||||
const { widgetProps, configure } = useWidgetPropsManager(name,
|
||||
widgetPropsDef,
|
||||
|
@ -48,7 +51,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
|
|||
emit,
|
||||
);
|
||||
|
||||
const run = async () => {
|
||||
const run = async (): Promise<void> => {
|
||||
const aiscript = new AiScript(createAiScriptEnv({
|
||||
storageKey: 'widget',
|
||||
token: $i?.token,
|
||||
|
@ -57,15 +60,15 @@ const run = async () => {
|
|||
return new Promise(ok => {
|
||||
os.inputText({
|
||||
title: q,
|
||||
}).then(({ canceled, result: a }) => {
|
||||
}).then(({ result: a }) => {
|
||||
ok(a);
|
||||
});
|
||||
});
|
||||
},
|
||||
out: (value) => {
|
||||
out: (_value) => {
|
||||
// nop
|
||||
},
|
||||
log: (type, params) => {
|
||||
log: (_type, _params) => {
|
||||
// nop
|
||||
},
|
||||
});
|
||||
|
@ -96,8 +99,3 @@ defineExpose<WidgetComponentExpose>({
|
|||
id: props.widget ? props.widget.id : null,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.mkw-button {
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -10,10 +10,9 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, reactive, ref, watch } from 'vue';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
|
||||
import { ref, watch } from 'vue';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget';
|
||||
import { GetFormResultType } from '@/scripts/form';
|
||||
import * as os from '@/os';
|
||||
import MkContainer from '@/components/ui/container.vue';
|
||||
import { defaultStore } from '@/store';
|
||||
import { i18n } from '@/i18n';
|
||||
|
@ -33,7 +32,9 @@ type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
|
|||
//const props = defineProps<WidgetComponentProps<WidgetProps>>();
|
||||
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
|
||||
const props = defineProps<{ widget?: Widget<WidgetProps>; }>();
|
||||
const emit = defineEmits<{ (ev: 'updateProps', props: WidgetProps); }>();
|
||||
const emit = defineEmits<{
|
||||
(ev: 'updateProps', widgetProps: WidgetProps): void;
|
||||
}>();
|
||||
|
||||
const { widgetProps, configure } = useWidgetPropsManager(name,
|
||||
widgetPropsDef,
|
||||
|
@ -43,14 +44,14 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
|
|||
|
||||
const text = ref<string | null>(defaultStore.state.memo);
|
||||
const changed = ref(false);
|
||||
let timeoutId;
|
||||
let timeoutId: number;
|
||||
|
||||
const saveMemo = () => {
|
||||
const saveMemo = (): void => {
|
||||
defaultStore.set('memo', text.value);
|
||||
changed.value = false;
|
||||
};
|
||||
|
||||
const onChange = () => {
|
||||
const onChange = (): void => {
|
||||
changed.value = true;
|
||||
window.clearTimeout(timeoutId);
|
||||
timeoutId = window.setTimeout(saveMemo, 1000);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { defineAsyncComponent } from 'vue';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
|
||||
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget';
|
||||
import { GetFormResultType } from '@/scripts/form';
|
||||
import MkContainer from '@/components/ui/container.vue';
|
||||
import XNotifications from '@/components/notifications.vue';
|
||||
|
|
Loading…
Reference in a new issue