Skip to content

Commit 53b6613

Browse files
committed
resloving merge conflicts
Co-authored-by: Daniel Garan <[email protected]> Co-authored-by: Kevin Can <[email protected]> Co-authored-by: Anthony Herrera <[email protected]> Co-authored-by: Rob Sinzieri <[email protected]> Co-authored-by: Roderick de Leon <[email protected]>
1 parent 1c40508 commit 53b6613

File tree

1 file changed

+106
-116
lines changed

1 file changed

+106
-116
lines changed

src/components/right-sidebar/createBoilerFuncs.ts

Lines changed: 106 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ const exportAsTypescript = computed(() => store.exportAsTypescript);
1111
const activeRoute = computed(() => store.activeRoute);
1212

1313

14-
export const createBoilerOptions = (componentName: string, children: string[] | {
15-
[key: string]: RouteComponentMap | Component;
16-
App: RouteComponentMap;
17-
HomeView: RouteComponentMap;
18-
}) => {
1914
export const createBoilerOptions = (componentName: string, children: string[] | {
2015
[key: string]: RouteComponentMap | Component;
2116
App: RouteComponentMap;
@@ -24,7 +19,6 @@ export const createBoilerOptions = (componentName: string, children: string[] |
2419
// add import mapstate and mapactions if they exist
2520
let imports = "";
2621
const activeComp = componentMap.value[activeComponent.value] as Component;
27-
// console.log('activeComp in Options is ',activeComp)
2822
// if (checked.value === false) {
2923
if (activeComp.actions.length || activeComp.state.length) {
3024
imports += "import { ";
@@ -75,7 +69,7 @@ export const createBoilerOptions = (componentName: string, children: string[] |
7569

7670
const vtComponents: string[] = [];
7771

78-
htmlBinding.forEach((el: { text: string; }) => {
72+
htmlBinding.forEach((el) => {
7973
if (vuetensilsSet.has(el.text)) {
8074
// Add import statement for Vuetensils components
8175
vtComponents.push(el.text);
@@ -89,7 +83,7 @@ export const createBoilerOptions = (componentName: string, children: string[] |
8983
}
9084

9185
data += " data() {\n return {\n";
92-
htmlBinding.forEach((el: { binding: string }) => {
86+
htmlBinding.forEach((el) => {
9387
if (el.binding !== "") {
9488
data += ` ${el.binding}: "PLACEHOLDER FOR VALUE", `;
9589
data += "\n";
@@ -204,9 +198,6 @@ export const createBoilerComposition = (componentName: string, children: string[
204198
imports += 'import { defineComponent } from "vue";\n';
205199
}
206200

207-
let childrenComponentNames = "\n";
208-
209-
if (Array.isArray(children)){
210201
// add imports for children
211202
let childrenComponentNames = "\n";
212203
if (Array.isArray(children)) {
@@ -220,137 +211,136 @@ if (Array.isArray(children)){
220211
});
221212
}
222213

223-
// if true add data section and populate with props
224-
let data = "";
225-
if (activeComp.props.length) {
226-
data += " props: {";
227-
activeComp.props.forEach((prop) => {
228-
data += `\n ${prop}: "PLACEHOLDER FOR VALUE",`;
229-
});
230-
data += "\n";
231-
//data += " }\n";
232-
data += " },\n";
233-
}
214+
// if true add data section and populate with props
215+
let data = "";
216+
if (activeComp.props.length) {
217+
data += " props: {";
218+
activeComp.props.forEach((prop) => {
219+
data += `\n ${prop}: "PLACEHOLDER FOR VALUE",`;
220+
});
221+
data += "\n";
222+
//data += " }\n";
223+
data += " },\n";
224+
}
234225

235226

236-
const htmlBinding = componentMap.value[activeComponent.value].htmlList;
227+
const htmlBinding = componentMap.value[activeComponent.value].htmlList;
237228

238-
// [OverVue v.10.0] add Vuetensils import statements to <script setup>
229+
// [OverVue v.10.0] add Vuetensils import statements to <script setup>
239230

240-
const vuetensilsSet = new Set(Object.keys(vtIcons));
231+
const vuetensilsSet = new Set(Object.keys(vtIcons));
241232

242-
let vuetensilsImports = "";
233+
let vuetensilsImports = "";
243234

244-
const vtComponents: string[] = [];
235+
const vtComponents: string[] = [];
245236

246-
htmlBinding.forEach((el: { text: string }) => {
247-
if (vuetensilsSet.has(el.text)) {
248-
// Add import statement for Vuetensils components
249-
vtComponents.push(el.text);
250-
}
251-
});
237+
htmlBinding.forEach((el) => {
238+
if (vuetensilsSet.has(el.text)) {
239+
// Add import statement for Vuetensils components
240+
vtComponents.push(el.text);
241+
}
242+
});
252243

253-
if (vtComponents.length) {
254-
vuetensilsImports += `import { ${vtComponents.join(
255-
", "
256-
)} } from 'vuetensils/src/components';\n`;
257-
}
244+
if (vtComponents.length) {
245+
vuetensilsImports += `import { ${vtComponents.join(
246+
", "
247+
)} } from 'vuetensils/src/components';\n`;
248+
}
258249
/*------------- setup() function -------------*/
259250
data += " setup() {"
260-
data += " setup() {"
261251
if(activeComp.state.length || activeComp.actions.length){
262-
data += " \n const /* testStore */ = useStore(); ";
252+
data += " \n const /* testStore */ = useStore(); ";
263253
}
264-
htmlBinding.forEach((el: { binding: string }) => {
265-
if (el.binding !== "") {
266-
data += ` ${el.binding}: "PLACEHOLDER FOR VALUE", `;
267-
data += "\n";
268-
}
269-
});
254+
htmlBinding.forEach((el) => {
255+
if (el.binding !== "") {
256+
data += ` ${el.binding}: "PLACEHOLDER FOR VALUE", `;
257+
data += "\n";
258+
}
259+
});
270260

271-
let returnStatement = "";
261+
let returnStatement = "";
272262

273-
if (activeComp.state.length || activeComp.actions.length) {
274-
returnStatement = "\n return { \n";
275-
}
263+
if (activeComp.state.length || activeComp.actions.length) {
264+
returnStatement = "\n return { \n";
265+
}
276266

277267

278-
// if true add computed section and populate with state
279-
let computed = "";
280-
if (activeComp.state.length) {
281-
const currState =
282-
activeComp.state.forEach((state) => {
283-
data += `\n const ${state} = computed(() => /* testStore */.${state}); `;
284-
returnStatement += ` ${state}, \n`
268+
// if true add computed section and populate with state
269+
let computed = "";
270+
if (activeComp.state.length) {
271+
const currState =
272+
activeComp.state.forEach((state) => {
273+
data += `\n const ${state} = computed(() => /* testStore */.${state}); `;
274+
returnStatement += ` ${state}, \n`
285275

286-
});
287-
}
276+
});
277+
}
288278

289-
data += '\n'
279+
data += '\n'
290280

291-
// if true add methods section and populate with actions
292-
let methods = "";
293-
if (activeComp.actions.length) {
294-
activeComp.actions.forEach((action) => {
295-
methods += `\n const ${action} = () => /* testStore */.${action}();`;
296-
returnStatement += ` ${action}, \n`
297-
});
298-
}
281+
// if true add methods section and populate with actions
282+
let methods = "";
283+
if (activeComp.actions.length) {
284+
activeComp.actions.forEach((action) => {
285+
methods += `\n const ${action} = () => /* testStore */.${action}();`;
286+
returnStatement += ` ${action}, \n`
287+
});
288+
}
299289

300-
let htmlArray = componentMap.value[componentName].htmlList;
301-
let styleString = "";
302-
const activeCompObj = activeComponentObj.value as Component; // typed this to fix activeComponentObj.value "is possibly null" error
303-
if (
304-
activeComponentObj.value &&
305-
(activeComponentObj.value as Component).htmlAttributes.class !== ""
306-
) {
307-
styleString += `.${
308-
(activeComponentObj.value as Component).htmlAttributes.class
309-
} { \n\tbackground-color: ${(activeComponentObj.value as Component).color};
290+
let htmlArray = componentMap.value[componentName].htmlList;
291+
let styleString = "";
292+
const activeCompObj = activeComponentObj.value as Component; // typed this to fix activeComponentObj.value "is possibly null" error
293+
if (
294+
activeComponentObj.value &&
295+
(activeComponentObj.value as Component).htmlAttributes.class !== ""
296+
) {
297+
styleString += `.${
298+
(activeComponentObj.value as Component).htmlAttributes.class
299+
} { \n\tbackground-color: ${(activeComponentObj.value as Component).color};
310300
\tgrid-area: ${
311-
(activeComponentObj.value as Component).htmlAttributes.gridArea[0]
312-
} / ${
313-
(activeComponentObj.value as Component).htmlAttributes.gridArea[1]
314-
} / ${
315-
(activeComponentObj.value as Component).htmlAttributes.gridArea[2]
316-
} / ${(activeComponentObj.value as Component).htmlAttributes.gridArea[3]};
301+
(activeComponentObj.value as Component).htmlAttributes.gridArea[0]
302+
} / ${
303+
(activeComponentObj.value as Component).htmlAttributes.gridArea[1]
304+
} / ${
305+
(activeComponentObj.value as Component).htmlAttributes.gridArea[2]
306+
} / ${(activeComponentObj.value as Component).htmlAttributes.gridArea[3]};
317307
\tz-index: ${(activeComponentObj.value as Component).z};
318308
} \n`;
319-
}
309+
}
320310

321-
for (const html of htmlArray) {
322-
if (html.class === " ") styleString = "";
323-
if (html.class) {
324-
styleString += `.${html.class} {\n height: ${html.h}%; \n width: ${html.w}%; \n top: ${html.x}%;
325-
\n left: ${html.y}%; \n z-index: ${html.z};}\n`;
311+
for (const html of htmlArray) {
312+
if (html.class === " ") styleString = "";
313+
if (html.class) {
314+
styleString += `.${html.class} {\n height: ${html.h}%; \n width: ${html.w}%; \n top: ${html.x}%;
315+
\n left: ${html.y}%; \n z-index: ${html.z};}\n`;
316+
}
326317
}
327-
}
328318

329-
// concat all code within script tags
330-
// if exportAsTypescript is on, out should be <script lang="ts">
331-
let output;
332-
if (exportAsTypescript.value === "on") {
333-
output = "\n\n<script lang='ts'>\n";
334-
output +=
335-
vuetensilsImports +
336-
imports +
337-
"\nexport default defineComponent ({\n name: '" +
338-
componentName +
339-
"';";
340-
} else {
341-
output = "\n\n<script>\n";
342-
output +=
343-
vuetensilsImports +
344-
imports +
345-
"\nexport default {\n name: '" +
346-
componentName +
347-
"'";
348-
}
349-
output += ",\n components: {";
350-
output += childrenComponentNames + " },\n";
351-
output += data;
352-
output += computed;
353-
output += methods;
319+
// concat all code within script tags
320+
// if exportAsTypescript is on, out should be <script lang="ts">
321+
let output;
322+
if (exportAsTypescript.value === "on") {
323+
output = "\n\n<script lang='ts'>\n";
324+
output +=
325+
vuetensilsImports +
326+
imports +
327+
"\nexport default defineComponent ({\n name: '" +
328+
componentName +
329+
"';";
330+
} else {
331+
output = "\n\n<script>\n";
332+
output +=
333+
vuetensilsImports +
334+
imports +
335+
"\nexport default {\n name: '" +
336+
componentName +
337+
"'";
338+
}
339+
output += ",\n components: {";
340+
output += childrenComponentNames + " },\n";
341+
output += data;
342+
output += computed;
343+
output += methods;
354344

355345
if (exportAsTypescript.value === "on") {
356346
if (activeComp.state.length || activeComp.actions.length) {

0 commit comments

Comments
 (0)