Skip to content

Commit 9b36e6a

Browse files
committed
Fix all remaining Vue/TS errors flagged in Volar
1 parent 2cc39cd commit 9b36e6a

14 files changed

Lines changed: 49 additions & 32 deletions

File tree

frontend/src/components/panels/Document.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</div>
1111
<div class="spacer"></div>
1212
<div class="right side">
13-
<OptionalInput v-model:checked="snappingEnabled" @update:checked="(newStatus) => setSnap(newStatus)" :icon="'Snapping'" title="Snapping" />
13+
<OptionalInput v-model:checked="snappingEnabled" @update:checked="(newStatus: boolean) => setSnap(newStatus)" :icon="'Snapping'" title="Snapping" />
1414
<PopoverButton>
1515
<h3>Snapping</h3>
1616
<p>The contents of this popover menu are coming soon</p>
@@ -42,7 +42,7 @@
4242

4343
<Separator :type="'Section'" />
4444

45-
<NumberInput @update:value="(newRotation) => setRotation(newRotation)" v-model:value="documentRotation" :incrementFactor="15" :unit="'°'" />
45+
<NumberInput @update:value="(newRotation: number) => setRotation(newRotation)" v-model:value="documentRotation" :incrementFactor="15" :unit="'°'" />
4646

4747
<Separator :type="'Section'" />
4848

@@ -54,7 +54,7 @@
5454

5555
<NumberInput
5656
v-model:value="documentZoom"
57-
@update:value="(newZoom) => setCanvasZoom(newZoom)"
57+
@update:value="(newZoom: number) => setCanvasZoom(newZoom)"
5858
:min="0.000001"
5959
:max="1000000"
6060
:incrementBehavior="'Callback'"
@@ -133,9 +133,9 @@
133133
<PersistentScrollbar
134134
:direction="'Vertical'"
135135
:handlePosition="scrollbarPos.y"
136-
@update:handlePosition="(newValue) => translateCanvasY(newValue)"
136+
@update:handlePosition="(newValue: number) => translateCanvasY(newValue)"
137137
v-model:handleLength="scrollbarSize.y"
138-
@pressTrack="(delta) => pageY(delta)"
138+
@pressTrack="(delta: number) => pageY(delta)"
139139
:class="'right-scrollbar'"
140140
/>
141141
</LayoutCol>
@@ -144,9 +144,9 @@
144144
<PersistentScrollbar
145145
:direction="'Horizontal'"
146146
:handlePosition="scrollbarPos.x"
147-
@update:handlePosition="(newValue) => translateCanvasX(newValue)"
147+
@update:handlePosition="(newValue: number) => translateCanvasX(newValue)"
148148
v-model:handleLength="scrollbarSize.x"
149-
@pressTrack="(delta) => pageX(delta)"
149+
@pressTrack="(delta: number) => pageX(delta)"
150150
:class="'bottom-scrollbar'"
151151
/>
152152
</LayoutRow>

frontend/src/components/panels/LayerTree.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<LayoutRow :class="'options-bar'">
44
<DropdownInput
55
v-model:selectedIndex="blendModeSelectedIndex"
6-
@update:selectedIndex="(newSelectedIndex) => setLayerBlendMode(newSelectedIndex)"
6+
@update:selectedIndex="(newSelectedIndex: number) => setLayerBlendMode(newSelectedIndex)"
77
:menuEntries="blendModeEntries"
88
:disabled="blendModeDropdownDisabled"
99
/>
@@ -12,7 +12,7 @@
1212

1313
<NumberInput
1414
v-model:value="opacity"
15-
@update:value="(newOpacity) => setLayerOpacity(newOpacity)"
15+
@update:value="(newOpacity: number) => setLayerOpacity(newOpacity)"
1616
:min="0"
1717
:max="100"
1818
:unit="'%'"
@@ -29,7 +29,7 @@
2929
</PopoverButton>
3030
</LayoutRow>
3131
<LayoutRow :class="'layer-tree scrollable-y'">
32-
<LayoutCol :class="'list'" ref="layerTreeList" @click="() => deselectAllLayers()" @dragover="updateInsertLine($event)" @dragend="drop($event)">
32+
<LayoutCol :class="'list'" ref="layerTreeList" @click="() => deselectAllLayers()" @dragover="updateInsertLine($event)" @dragend="drop()">
3333
<div class="layer-row" v-for="({ entry: layer }, index) in layers" :key="String(layer.path.slice(-1))">
3434
<div class="visibility">
3535
<IconButton
@@ -51,7 +51,7 @@
5151
:data-index="index"
5252
draggable="true"
5353
@dragstart="dragStart($event, layer)"
54-
:title="layer.path"
54+
:title="String(layer.path)"
5555
>
5656
<div class="layer-type-icon">
5757
<IconLabel v-if="layer.layer_type === 'Folder'" :icon="'NodeTypeFolder'" title="Folder" />

frontend/src/components/widgets/buttons/IconButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<button class="icon-button" :class="`size-${size}`" @click="(e) => action(e)">
2+
<button class="icon-button" :class="`size-${size}`" @click="(e: MouseEvent) => action(e)">
33
<IconLabel :icon="icon" />
44
</button>
55
</template>

frontend/src/components/widgets/buttons/PopoverButton.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
<script lang="ts">
5050
import { defineComponent, PropType } from "vue";
5151
52+
import { PopoverButtonIcon } from "@/utilities/widgets";
53+
5254
import IconButton from "@/components/widgets/buttons/IconButton.vue";
5355
import FloatingMenu from "@/components/widgets/floating-menus/FloatingMenu.vue";
5456
55-
export type PopoverButtonIcon = "DropdownArrow" | "VerticalEllipsis";
56-
5757
export default defineComponent({
5858
components: {
5959
FloatingMenu,

frontend/src/components/widgets/buttons/TextButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<button class="text-button" :class="{ emphasized, disabled }" :style="minWidth > 0 ? `min-width: ${minWidth}px` : ''" @click="(e) => action(e)">
2+
<button class="text-button" :class="{ emphasized, disabled }" :style="minWidth > 0 ? `min-width: ${minWidth}px` : ''" @click="(e: MouseEvent) => action(e)">
33
<TextLabel>{{ label }}</TextLabel>
44
</button>
55
</template>

frontend/src/components/widgets/floating-menus/ColorPicker.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<template>
22
<div class="color-picker">
3-
<div class="saturation-picker" ref="saturationPicker" @pointerdown="(e) => onPointerDown(e)">
3+
<div class="saturation-picker" ref="saturationPicker" @pointerdown="(e: PointerEvent) => onPointerDown(e)">
44
<div ref="saturationCursor" class="selection-circle"></div>
55
</div>
6-
<div class="hue-picker" ref="huePicker" @pointerdown="(e) => onPointerDown(e)">
6+
<div class="hue-picker" ref="huePicker" @pointerdown="(e: PointerEvent) => onPointerDown(e)">
77
<div ref="hueCursor" class="selection-pincers"></div>
88
</div>
9-
<div class="opacity-picker" ref="opacityPicker" @pointerdown="(e) => onPointerDown(e)">
9+
<div class="opacity-picker" ref="opacityPicker" @pointerdown="(e: PointerEvent) => onPointerDown(e)">
1010
<div ref="opacityCursor" class="selection-pincers"></div>
1111
</div>
1212
</div>

frontend/src/components/widgets/floating-menus/MenuList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
:direction="'TopRight'"
3030
:menuEntries="entry.children"
3131
v-bind="{ defaultAction, minWidth, drawIcon, scrollable }"
32-
:ref="(ref) => setEntryRefs(entry, ref)"
32+
:ref="(ref: any) => setEntryRefs(entry, ref)"
3333
/>
3434
</div>
3535
</template>

frontend/src/components/widgets/inputs/CheckboxInput.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default defineComponent({
9898
},
9999
},
100100
props: {
101-
checked: { type: Boolean as PropType<boolean>, required: true },
101+
checked: { type: Boolean as PropType<boolean>, default: false },
102102
icon: { type: String as PropType<IconName>, default: "Checkmark" },
103103
outlineStyle: { type: Boolean as PropType<boolean>, default: false },
104104
},

frontend/src/components/widgets/inputs/DropdownInput.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</div>
88
<MenuList
99
v-model:activeEntry="activeEntry"
10-
@update:activeEntry="(newActiveEntry: typeof MenuListEntry) => activeEntryChanged(newActiveEntry)"
10+
@update:activeEntry="(newActiveEntry: typeof MENU_LIST_ENTRY) => activeEntryChanged(newActiveEntry)"
1111
@widthChanged="(newWidth: number) => onWidthChanged(newWidth)"
1212
:menuEntries="menuEntries"
1313
:direction="'Bottom'"
@@ -93,6 +93,11 @@ import { defineComponent, PropType } from "vue";
9393
import MenuList, { MenuListEntry, SectionsOfMenuListEntries } from "@/components/widgets/floating-menus/MenuList.vue";
9494
import IconLabel from "@/components/widgets/labels/IconLabel.vue";
9595
96+
// Satisfies Volar (https://github.com/johnsoncodehk/volar/issues/596)
97+
declare global {
98+
const MENU_LIST_ENTRY: MenuListEntry;
99+
}
100+
96101
export default defineComponent({
97102
props: {
98103
menuEntries: { type: Array as PropType<SectionsOfMenuListEntries>, required: true },

frontend/src/components/widgets/inputs/MenuBarInput.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<IconLabel :icon="entry.icon" v-if="entry.icon" />
1111
<span v-if="entry.label">{{ entry.label }}</span>
1212
</div>
13-
<MenuList :menuEntries="entry.children || []" :direction="'Bottom'" :minWidth="240" :drawIcon="true" :defaultAction="comingSoon" :ref="(ref) => setEntryRefs(entry, ref)" />
13+
<MenuList :menuEntries="entry.children || []" :direction="'Bottom'" :minWidth="240" :drawIcon="true" :defaultAction="comingSoon" :ref="(ref: any) => setEntryRefs(entry, ref)" />
1414
</div>
1515
</div>
1616
</template>

0 commit comments

Comments
 (0)