@@ -2,36 +2,10 @@ import icons from './icons'
2
2
import htmlElementMap from './htmlElementMap'
3
3
const cloneDeep = require ( 'lodash.clonedeep' )
4
4
5
- // let hardA = {
6
- // componentName: "a",
7
- // x: 0,
8
- // y: 20,
9
- // z: 0,
10
- // w: 200,
11
- // h: 200,
12
- // htmlList: [{
13
- // children:[{
14
- // children:[{
15
- // text: 'button',
16
- // children:[],
17
- // id:0
18
- // }],
19
- // text:'form',
20
- // id:2
21
- // }],
22
- // text: "div",
23
- // id:1
24
- // }],
25
- // children: [],
26
- // parent: {},
27
- // isActive: false
28
- // }
29
-
30
5
const newState = {
31
6
icons,
32
7
htmlElementMap,
33
- // every single time we create a component
34
- // sent to export project component
8
+ // state below is what is used when exporting a project
35
9
componentMap : {
36
10
App : {
37
11
componentName : 'App' ,
@@ -40,53 +14,46 @@ const newState = {
40
14
} ,
41
15
HomeView : {
42
16
componentName : 'HomeView' ,
43
- // children: ['a'],
44
17
children : [ ] ,
45
18
htmlList : [ ]
46
19
}
47
- // NewView: {}
48
- // a: hardA
49
20
} ,
50
21
routes : {
51
- // HomeView: [hardA]
52
22
HomeView : [ ]
53
- // NewView: []
54
23
} ,
55
24
userActions : [ ] ,
56
25
userState : { } ,
57
- /**
58
- *
59
- */
26
+ imagePath : {
27
+ HomeView : ''
28
+ } ,
29
+ // state below is not used when exporting a project
60
30
componentNameInputValue : '' ,
61
31
projects : [ { filename : 'Untitled-1' , lastSavedLocation : '' } ] ,
62
32
63
33
activeRoute : 'HomeView' ,
64
34
activeComponent : '' ,
65
35
activeHTML : '' ,
66
36
activeLayer : {
67
- id :'' ,
68
- lineage :[ ]
37
+ id : '' ,
38
+ lineage : [ ]
69
39
} ,
70
40
71
41
selectedElementList : [ ] ,
72
42
projectNumber : 2 ,
73
43
activeTab : 0 ,
74
44
componentChildrenMultiselectValue : [ ] ,
75
45
modalOpen : false ,
76
- parentSelected : false ,
77
- imagePath : {
78
- HomeView : ''
79
- }
46
+ parentSelected : false
80
47
}
81
48
82
- //closured method to ensure we only ever write the default state ONCE
49
+ // closured method to ensure we only ever write the default state ONCE
83
50
const writeTheDefault = ( ) => {
84
51
let initial = { }
85
- let needsToRun = true ;
86
- function onced ( payload ) {
87
- if ( needsToRun ) {
52
+ let needsToRun = true
53
+ function onced ( payload ) {
54
+ if ( needsToRun ) {
88
55
initial = cloneDeep ( payload )
89
- needsToRun = false ;
56
+ needsToRun = false
90
57
}
91
58
return initial
92
59
}
@@ -95,52 +62,5 @@ const writeTheDefault = () => {
95
62
96
63
const defaultState = writeTheDefault ( )
97
64
98
- // const defaultState =
99
- // {
100
- // icons,
101
- // htmlElementMap,
102
- // // every single time we create a component
103
- // // sent to export project component
104
- // componentMap: {
105
- // App: {
106
- // componentName: 'App',
107
- // children: ['HomeView'],
108
- // htmlList: []
109
- // },
110
- // HomeView: {
111
- // componentName: 'HomeView',
112
- // children: [],
113
- // htmlList: []
114
- // }
115
- // // NewView: {}
116
- // },
117
- // routes: {
118
- // HomeView: []
119
- // // NewView: []
120
- // },
121
- // userActions: [],
122
- // userState: {},
123
- // /**
124
- // *
125
- // */
126
- // componentNameInputValue: '',
127
- // projects: [{ filename: 'Untitled-1', lastSavedLocation: '' }],
128
- // activeRoute: 'HomeView',
129
- // activeComponent: '',
130
- // selectedElementList: [],
131
- // projectNumber: 2,
132
- // activeTab: 0,
133
- // componentChildrenMultiselectValue: [],
134
- // modalOpen: false,
135
- // parentSelected: false,
136
- // imagePath: ''
137
- // }
138
-
139
- // const getDefault = ()=>{
140
- // return {...defaultState}
141
- // }
142
-
143
-
144
-
145
65
export default newState
146
- export { defaultState }
66
+ export { defaultState }
0 commit comments