Skip to content

Commit a8ffd28

Browse files
Ji KimJi Kim
authored andcommitted
Merge branch 'typescript' of https://github.com/oslabs-beta/OverVue into typescript
2 parents 281c866 + 1cfc533 commit a8ffd28

File tree

11 files changed

+44
-38
lines changed

11 files changed

+44
-38
lines changed

src/App.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
/>
1010
</template>
1111

12-
<script>
13-
export default {
14-
name: "App",
15-
};
16-
</script>
17-
1812
<script setup>
1913
// import { defineComponent } from "vue";
2014
// import ElementPlus from 'element-plus'; // importing element plus component library

src/components/Canvas.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,9 @@ import { useStore } from "../store/main.js";
516516
import { ref, computed, onMounted, watch } from "vue";
517517
import * as fs from "fs";
518518
import { ResizePayload, Component } from "../../types";
519-
const { ipcRenderer } = window;
519+
// @ts-ignore
520+
// const { ipcRenderer } = window;
521+
// ipcRenderer is not used
520522
521523
const cloneDeep = require("lodash.clonedeep");
522524

src/components/left-sidebar/ComponentTab/CreateMenuHTMLQueue.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ const setLayer = (element: { text: string; id: string }) => {
147147
148148
const setParentLayer = () => {
149149
if (activeLayer.value.id !== "") {
150-
upOneLayer(activeLayer.value.id);
150+
upOneLayer(activeLayer.value.id as string);
151151
}
152152
};
153153
@@ -183,13 +183,13 @@ const endDrag = (event: Event) => {
183183
else dragDropSortHtmlElements();
184184
};
185185
186-
watch(activeComponent, () => {
187-
if (activeComponent.value !== "") {
188-
(store.componentMap[activeComponent.value] as Component).isActive = true;
189-
} else {
190-
(store.componentMap[activeComponent.value] as Component).isActive = false;
191-
}
192-
});
186+
// watch(activeComponent, () => {
187+
// if (activeComponent.value !== "") {
188+
// (store.componentMap[activeComponent.value] as Component).isActive = true;
189+
// } else {
190+
// (store.componentMap[activeComponent.value] as Component).isActive = false;
191+
// }
192+
// });
193193
</script>
194194

195195
<!-- <script>

src/components/left-sidebar/ComponentTab/ImportComponent.vue

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
import { computed } from "vue";
1414
import { useStore } from "../../../store/main.js";
1515
import { useCreateComponent } from "../../composables/useCreateComponent.js";
16-
import * as fs from "fs";
16+
// import * as fs from "fs";
1717
import { Component, HtmlElement, HtmlElementMap } from "../../../../types";
18-
const { ipcRenderer } = window.require("electron");
18+
// @ts-ignore
19+
const { fs, ipcRenderer } = window as any;
1920
const store = useStore();
2021
2122
const props = defineProps(["title"]);
@@ -71,7 +72,7 @@ const importComponent = () => {
7172
},
7273
],
7374
})
74-
.then((res: { filePaths: fs.PathOrFileDescriptor }) => {
75+
.then((res: { filePaths }) => {
7576
openVueFile(res.filePaths);
7677
alert("Successfully Imported");
7778
})
@@ -80,7 +81,7 @@ const importComponent = () => {
8081
8182
//parses script tag string for props
8283
const parsingStringToProps = (str: string) => {
83-
let props = [];
84+
let props: string[] = [];
8485
let split = str.split(" ");
8586
for (let i = 0; i < split.length; i++) {
8687
if (
@@ -140,6 +141,7 @@ const parsingStringToState = (str: string) => {
140141
};
141142
142143
//the bulk of the work for this component
144+
// @ts-ignore
143145
const openVueFile = (data) => {
144146
if (data === undefined) return;
145147
@@ -265,8 +267,8 @@ const openVueFile = (data) => {
265267
//OverVue adds a <div></div> wrapper to all components. remove this before importing.
266268
267269
let groupings = findGroupings(htmlList);
268-
let groupingObj: { [key: string]: string[] } = objectGenerator(groupings);
269-
let groupingArray = [];
270+
let groupingObj: { [key: string]: HtmlElement } = objectGenerator(groupings);
271+
let groupingArray: HtmlElement[] = [];
270272
for (const key in groupingObj) {
271273
groupingArray.push(groupingObj[key]);
272274
}
@@ -336,7 +338,7 @@ const openVueFile = (data) => {
336338
337339
function findGroupings(array: string[]) {
338340
let count = 0; //tracks where the parent ends
339-
let stopIndexes = []; //an array that will be used to slice out the parent/child relationships
341+
let stopIndexes: number[] = []; //an array that will be used to slice out the parent/child relationships
340342
for (let i = 0; i < array.length; i++) {
341343
if (array[i][1] !== "/") {
342344
if (
@@ -358,7 +360,7 @@ const openVueFile = (data) => {
358360
stopIndexes.push(i);
359361
}
360362
}
361-
let groupings = [];
363+
let groupings: string[][] = [];
362364
let startIndex = 0;
363365
for (let i = 0; i < stopIndexes.length; i++) {
364366
groupings.push(array.slice(startIndex, stopIndexes[i] + 1));
@@ -388,7 +390,7 @@ const openVueFile = (data) => {
388390
if (array[i].length > 0) {
389391
const childGroupings = findGroupings(array[i]);
390392
const childrenObj = objectGenerator(childGroupings);
391-
const childrenArray = [];
393+
const childrenArray: any[] = [];
392394
for (const key in childrenObj) {
393395
childrenArray.push(childrenObj[key]);
394396
}

src/components/nav-buttons/ExportMenu.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ Description:
3434
import { computed } from "vue";
3535
import { useStore } from "../../store/main";
3636
import { useExportComponent } from "../composables/useExportComponent";
37-
import * as fs from "fs";
38-
import path from "path";
37+
// import * as fs from "fs";
38+
// import path from "path";
3939
import {
4040
Component,
4141
HtmlElement,
@@ -44,7 +44,8 @@ import {
4444
} from "../../../types";
4545
4646
const store = useStore();
47-
const { ipcRenderer } = window;
47+
// @ts-ignore
48+
const { fs, ipcRenderer, path } = window;
4849
4950
const componentMap = computed(() => store.componentMap);
5051
const imagePath = computed(() => store.imagePath);

src/components/nav-buttons/ImportMenu.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ Description:
3131
import { useStore } from "../../store/main";
3232
import ImportComponent from "../left-sidebar/ComponentTab/ImportComponent.vue";
3333
import { Component } from "../../../types";
34-
import * as fs from "fs";
34+
// import * as fs from "fs";
3535
const Mousetrap = require("mousetrap");
36-
const { ipcRenderer } = window;
36+
// @ts-ignore
37+
const { fs, ipcRenderer } = window;
3738
3839
const store = useStore();
3940

src/components/nav-buttons/SaveProject.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ import localforage from "localforage";
2121
import { useStore } from "../../store/main";
2222
import { computed } from "vue";
2323
import { HtmlElement } from "app/types";
24-
import * as fs from "fs";
24+
// import * as fs from "fs";
2525
const Mousetrap = require("mousetrap");
2626
// @ts-ignore
27-
const { ipcRenderer } = window;
27+
const { fs, ipcRenderer } = window;
2828
2929
const store = useStore();
3030

src/components/right-sidebar/HTMLQueue.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ const moreExceptions = () => {
136136
return childComponent;
137137
};
138138
139-
const parentSelected: typeof store.parentSelected = (payload: any) =>
140-
store.parentSelected(payload);
139+
// const parentSelected: typeof store.parentSelected = (payload: any) =>
140+
// store.parentSelected(payload);
141141
142142
const setActiveHTML: typeof store.setActiveHTML = (payload) =>
143143
store.setActiveHTML(payload);
@@ -187,12 +187,12 @@ const setActiveElement = (element: string[]) => {
187187
188188
const setLayer = (element: { text: string; id: string }) => {
189189
setActiveLayer(element);
190-
element.id = activeHTML.value;
190+
element.id = activeHTML.value as string;
191191
};
192192
193193
const setParentLayer = () => {
194194
if (activeLayer.value.id !== "") {
195-
upOneLayer(activeLayer.value.id);
195+
upOneLayer(activeLayer.value.id as string);
196196
}
197197
};
198198
@@ -228,7 +228,7 @@ const endDrag = (event: MouseEvent) => {
228228
else dragDropSortHtmlElements();
229229
};
230230
231-
const submitClass = (element: string, idNum: string) => {
231+
const submitClass = (element: string, idNum: number) => {
232232
if (element === "") {
233233
return;
234234
}
@@ -237,6 +237,7 @@ const submitClass = (element: string, idNum: string) => {
237237
class: element,
238238
id: idNum,
239239
};
240+
240241
addActiveComponentClass(payload);
241242
classText.value = "";
242243
};

src/components/right-sidebar/Tree.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import VueTree from "@ssthouse/vue3-tree-chart";
3636
import "@ssthouse/vue3-tree-chart/dist/vue3-tree-chart.css";
3737
import { useStore } from "../../store/main.js";
3838
import { ref, computed, watch } from "vue";
39+
import { Component, RouteComponentMap } from "../../../types";
3940
4041
const store = useStore();
4142
@@ -118,7 +119,7 @@ const activateNode = (nodeToActivate: string) => {
118119
119120
const buildTree = (componentData: typeof VueTree.treeData) => {
120121
//App is always the root of the tree.
121-
const treeData = {
122+
const treeData : {value: string; children:{value: string; children: string[]}[]} = {
122123
value: "App",
123124
children: [],
124125
};
@@ -152,7 +153,7 @@ function buildTreeChildren(array: string[]) {
152153
}
153154
}
154155
}
155-
outputArray.push(outputObj);
156+
(outputArray as { value: string; children: string[]}[]).push(outputObj);
156157
});
157158
return outputArray;
158159
}

src/components/right-sidebar/tutorial/Landing.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333

3434
<!-- COMPOSITION API SYNTAX -->
3535
<script setup lang="ts">
36+
// @ts-nocheck
37+
// No check for the shell
3638
import { useStore } from "../../../store/main.js";
39+
3740
const { shell } = window;
3841
3942
const store = useStore();

0 commit comments

Comments
 (0)