Skip to content

Commit

Permalink
Merge pull request #124 from eugene-serb/#121
Browse files Browse the repository at this point in the history
SFC and JSDoc update
  • Loading branch information
eugene-serb authored Jun 20, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents ed9c819 + 242ec91 commit 0c42d68
Showing 47 changed files with 343 additions and 374 deletions.
11 changes: 10 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -17,6 +17,15 @@
"Wavemaster",
"webvisor",
"Вибро",
"геймпада"
"геймпада",
"геймпадами",
"геймпадов",
"Десериализатор",
"Композабл",
"композабла",
"лейаута",
"лейаутов",
"Лейауты",
"Сериализатор"
]
}
6 changes: 1 addition & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
<script setup lang="ts">
import { defineComponent, onMounted, onUnmounted } from 'vue';
import { onMounted, onUnmounted } from 'vue';
import { RouterView } from 'vue-router';
import { useLayouts } from '@/composables';
import { useGamepadsStore } from '@/store';
defineComponent({
name: 'App',
});
const { layout } = useLayouts();
const { initialize, terminate } = useGamepadsStore();
63 changes: 38 additions & 25 deletions src/components/atoms/AAnnouncement.vue
Original file line number Diff line number Diff line change
@@ -1,45 +1,58 @@
<script setup lang="ts">
import { defineComponent, defineProps, defineEmits } from 'vue';
defineComponent({
name: 'AAnnouncement',
});
/**
* Входные параметры компонента.
* Интерфейс входных параметров компонента.
*/
const props = defineProps({
interface Props {
/**
* Идентификатор анонса.
*/
id: {
type: String,
required: true,
},
id: string;
/**
* Включён ли анонс.
*/
enabled: {
type: Boolean,
required: true,
},
enabled: boolean;
/**
* Можно ли закрыть.
*/
closable: {
type: Boolean,
default: false,
},
closable?: boolean;
}
/**
* Интерфейс событий, которые может сгенерировать компонент.
*/
interface Emits {
/**
* Закрытие анонса.
*
* @param e - Имя события.
* @param id - ID анонса.
*/
(e: 'close', id: string): void;
}
/**
* Интерфейс слотов, который содержит компонент.
*/
interface Slots {
/**
* Слот по умолчанию.
*/
default(): any;
}
/**
* Входные параметры компонента.
*/
const props = withDefaults(defineProps<Props>(), {
closable: false,
});
/**
* События, которые может сгенерировать компонент.
*/
const emits = defineEmits({
close(id: string): boolean {
return typeof id === 'string' && id.length > 0;
},
});
const emits = defineEmits<Emits>();
defineSlots<Slots>();
/**
* Закрыть анонс.
14 changes: 10 additions & 4 deletions src/components/atoms/AGamepad.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<script setup lang="ts">
import { defineComponent } from 'vue';
/**
* Интерфейс слотов, который содержит компонент.
*/
interface Slots {
/**
* Слот по умолчанию.
*/
default(): any;
}
defineComponent({
name: 'AGamepad',
});
defineSlots<Slots>();
</script>

<template>
14 changes: 10 additions & 4 deletions src/components/atoms/AMessage.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<script setup lang="ts">
import { defineComponent } from 'vue';
/**
* Интерфейс слотов, который содержит компонент.
*/
interface Slots {
/**
* Слот по умолчанию.
*/
default(): any;
}
defineComponent({
name: 'AMessage',
});
defineSlots<Slots>();
</script>

<template>
37 changes: 14 additions & 23 deletions src/components/atoms/ATextLogo.vue
Original file line number Diff line number Diff line change
@@ -1,43 +1,34 @@
<script setup lang="ts">
import { defineComponent, defineProps } from 'vue';
import { RouterLink } from 'vue-router';
import { LinkTargetVariants } from '@/models';
import type { PropType } from 'vue';
import type { LinkTarget } from '@/models';
defineComponent({
name: 'ATextLogo',
});
defineProps({
/**
* Интерфейс входных параметров компонента.
*/
interface Props {
/**
* Текст.
*/
text: {
type: String,
required: true,
},
text: string;
/**
* Ссылка, куда ведёт лого.
*/
link: {
type: String,
required: true,
},
link: string;
/**
* Как переходить по ссылке.
*/
target: {
type: String as PropType<LinkTarget>,
default: '_self',
},
target?: LinkTarget;
/**
* Разрешать переводить текст лого при запросе пользователя?
*/
translate: {
type: Boolean,
default: false,
},
translate?: boolean;
}
withDefaults(defineProps<Props>(), {
target: LinkTargetVariants.SELF,
translate: false,
});
</script>

23 changes: 11 additions & 12 deletions src/components/molecules/MAnnouncement.vue
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
<script setup lang="ts">
import { defineComponent, defineProps, computed, toRefs } from 'vue';
import { computed, toRefs } from 'vue';
import { useRouter } from 'vue-router';
import { AAnnouncement } from '@/components/atoms';
import { useAnnouncements } from '@/composables';
import type { PropType } from 'vue';
import type { Announcement } from '@/models';
defineComponent({
name: 'MAnnouncement',
});
/**
* Входные параметры компонента.
* Интерфейс входных параметров компонента.
*/
const props = defineProps({
interface Props {
/**
* Анонсы.
*/
announcements: {
type: Array as PropType<Announcement[]>,
default: () => [],
},
announcements?: Announcement[];
}
/**
* Входные параметры компонента.
*/
const props = withDefaults(defineProps<Props>(), {
announcements: () => [],
});
const { currentRoute } = useRouter();
37 changes: 19 additions & 18 deletions src/components/molecules/MDiagnosticPanel.vue
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
<script setup lang="ts">
import { defineComponent, defineProps, computed } from 'vue';
import type { PropType } from 'vue';
defineComponent({
name: 'MDiagnosticPanel',
});
import { computed } from 'vue';
/**
* Входные параметры компонента.
* Интерфейс входных параметров компонента.
*/
const props = defineProps({
interface Props {
/**
* Геймпад.
*/
gamepad: {
type: Object as PropType<Gamepad | null>,
default: null,
},
gamepad?: Gamepad | null;
/**
* Временная метка.
*
* @description Нужна для обновления состояния геймпадов и компонента,
* Нужна для обновления состояния геймпадов и компонента,
* т.к. сами они это не делают.
*/
timestamp: {
type: Number,
required: true,
},
timestamp: number;
}
/**
* Входные параметры компонента.
*/
const props = withDefaults(defineProps<Props>(), {
gamepad: null,
});
/**
* Статус отражающий доступность.
*
* @constant
*/
const STATUS_AVAILABLE = 'Available';
/**
* Статус отражающий недоступность.
*
* @constant
*/
const STATUS_MISSING = 'Missing';
/**
* Класс отражающий нажатие.
*
* @constant
*/
const CLASS_PRESSED = 'pressed';
6 changes: 1 addition & 5 deletions src/components/molecules/MFooter.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<script setup lang="ts">
import { defineComponent, computed } from 'vue';
import { computed } from 'vue';
import { PERSONAL_PAGE } from '@/constants';
defineComponent({
name: 'MFooter',
});
/**
* Текущий год.
*/
20 changes: 8 additions & 12 deletions src/components/molecules/MGamepadList.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
<script setup lang="ts">
import { defineComponent, defineProps } from 'vue';
import { AGamepad } from '@/components/atoms';
import type { PropType } from 'vue';
import type { TVibrator } from '@/models';
defineComponent({
name: 'MGamepadList',
});
defineProps({
/**
* Интерфейс входных параметров компонента.
*/
interface Props {
/**
* Все геймпады.
*/
gamepads: {
type: Array as PropType<TVibrator[]>,
required: true,
},
});
gamepads: TVibrator[];
}
defineProps<Props>();
</script>

<template>
Loading

0 comments on commit 0c42d68

Please sign in to comment.