material 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/index.js +11 -2
  2. package/package.json +1 -1
  3. package/src/appbar.js +28 -28
  4. package/src/banner.js +20 -20
  5. package/src/button.js +18 -19
  6. package/src/calendar.js +8 -8
  7. package/src/card.js +4 -4
  8. package/src/checkbox.js +8 -8
  9. package/src/component.js +4 -4
  10. package/src/container.js +4 -4
  11. package/src/control/button.js +64 -88
  12. package/src/control/button.new.js +25 -25
  13. package/src/control/datehour.js +4 -4
  14. package/src/control/dialog.js +12 -11
  15. package/src/control/file.js +8 -8
  16. package/src/control/image.js +6 -6
  17. package/src/control/link.js +9 -9
  18. package/src/control/list.js +25 -35
  19. package/src/control/loading.js +10 -10
  20. package/src/control/menu.js +85 -0
  21. package/src/control/search.js +9 -9
  22. package/src/control/select.js +6 -6
  23. package/src/control/selecter.js +15 -15
  24. package/src/control/snackbar.js +91 -0
  25. package/src/control/switch.js +18 -18
  26. package/src/control/switcher.js +16 -16
  27. package/src/control/text.js +11 -7
  28. package/src/control/textfield.js +12 -12
  29. package/src/dialog.js +19 -19
  30. package/src/divider.js +4 -4
  31. package/src/drawer.js +11 -11
  32. package/src/element.js +6 -31
  33. package/src/field/email.js +5 -5
  34. package/src/field/image.js +4 -4
  35. package/src/form/build.js +7 -7
  36. package/src/form.js +6 -6
  37. package/src/icon.js +8 -8
  38. package/src/image.js +14 -14
  39. package/src/item.js +7 -7
  40. package/src/layout.js +10 -10
  41. package/src/list/add.js +1 -1
  42. package/src/list/build.js +7 -7
  43. package/src/list/display.js +10 -10
  44. package/src/list/search.js +2 -2
  45. package/src/list.js +13 -13
  46. package/src/map/build.js +6 -6
  47. package/src/map/display.js +8 -8
  48. package/src/menu.js +15 -15
  49. package/src/{component → mixin}/control.js +10 -10
  50. package/src/{component → mixin}/create.js +1 -1
  51. package/src/mixin/display.js +76 -0
  52. package/src/mixin/emitter.js +23 -0
  53. package/src/{component → mixin}/events.js +2 -2
  54. package/src/{component → mixin}/focus.js +2 -3
  55. package/src/{component → mixin}/insert.js +1 -1
  56. package/src/module/build.js +44 -0
  57. package/src/{component → module}/classify.js +0 -13
  58. package/src/module/dataset.js +12 -0
  59. package/src/module/dom.js +1 -57
  60. package/src/module/events.js +57 -0
  61. package/src/module/jsontohtml.js +20 -0
  62. package/src/module/last.js +0 -0
  63. package/src/{component → module}/ripple.js +15 -42
  64. package/src/progress.js +7 -7
  65. package/src/select.js +16 -16
  66. package/src/selector.js +32 -32
  67. package/src/skin/material/control/menu.sass +29 -0
  68. package/src/skin/material/control/snackbar.sass +65 -0
  69. package/src/slider.js +32 -32
  70. package/src/snackbar.js +8 -8
  71. package/src/switch.js +9 -9
  72. package/src/tabs.js +8 -8
  73. package/src/tabview.js +8 -8
  74. package/src/text.js +5 -5
  75. package/src/textfield.js +16 -16
  76. package/src/toolbar.js +28 -28
  77. package/src/tooltip.js +11 -11
  78. package/src/tree.js +12 -16
  79. package/src/view/build.js +7 -7
  80. package/src/view/display.js +16 -16
  81. package/src/view.js +5 -5
  82. package/src/component/click.js +0 -17
  83. /package/src/{component → mixin}/controller.js +0 -0
  84. /package/src/{component → mixin}/icon.js +0 -0
  85. /package/src/{component → mixin}/init.js +0 -0
  86. /package/src/{component → mixin}/label.js +0 -0
  87. /package/src/{component → mixin}/settings.js +0 -0
@@ -30,26 +30,26 @@ class Switcher {
30
30
  }
31
31
 
32
32
  build () {
33
- this.root = document.createElement(this.options.tag)
33
+ this.element = document.createElement(this.options.tag)
34
34
 
35
35
  if (this.options.class !== 'button') {
36
- this.root.setAttribute('class', 'switcher ' + this.options.class)
36
+ this.element.setAttribute('class', 'switcher ' + this.options.class)
37
37
  } else {
38
- this.root.classList.add('switcher')
38
+ this.element.classList.add('switcher')
39
39
  }
40
40
 
41
41
  if (this.options.label) {
42
42
  this.label = document.createElement('label')
43
43
  this.label.innerHTML = this.options.label
44
- this.root.appendChild(this.label)
44
+ this.element.appendChild(this.label)
45
45
  }
46
46
 
47
47
  this.knob = document.createElement('span')
48
48
  this.knob.classList.add('knob')
49
- this.root.appendChild(this.knob)
49
+ this.element.appendChild(this.knob)
50
50
 
51
51
  if (this.options.size) {
52
- this.root.classList.add(this.options.size + '-size')
52
+ this.element.classList.add(this.options.size + '-size')
53
53
  }
54
54
 
55
55
  this.buildList(this.options.list)
@@ -59,17 +59,17 @@ class Switcher {
59
59
  }
60
60
 
61
61
  if (this.options.container) {
62
- this.options.container.appendChild(this.root)
62
+ this.options.container.appendChild(this.element)
63
63
  }
64
64
  }
65
65
 
66
66
  buildList (list) {
67
67
  this.list = document.createElement('ul')
68
- this.root.appendChild(this.list)
68
+ this.element.appendChild(this.list)
69
69
  }
70
70
 
71
71
  attach () {
72
- this.root.addEventListener('click', (event) => {
72
+ this.element.addEventListener('click', (event) => {
73
73
  if (!event.target.dataset.switcher) return
74
74
  this.select(event.target)
75
75
  })
@@ -97,7 +97,7 @@ class Switcher {
97
97
 
98
98
  selectByName (name) {
99
99
  // console.log('selectByName', name)
100
- var item = this.root.querySelector('[data-switcher="' + name + '"]')
100
+ var item = this.element.querySelector('[data-switcher="' + name + '"]')
101
101
  // console.log('item', item)
102
102
  if (item) {
103
103
  this.select(item)
@@ -106,7 +106,7 @@ class Switcher {
106
106
 
107
107
  preSelectByName (name) {
108
108
  // console.log('selectByName', name)
109
- var item = this.root.querySelector('[data-switcher="' + name + '"]')
109
+ var item = this.element.querySelector('[data-switcher="' + name + '"]')
110
110
  // console.log('item', item)
111
111
  this.preselect(item)
112
112
  }
@@ -165,24 +165,24 @@ class Switcher {
165
165
  }
166
166
 
167
167
  setValue (value) {
168
- // console.log('value', value, this.options.list, this.root)
168
+ // console.log('value', value, this.options.list, this.element)
169
169
  var list = this.options.list
170
170
  if (this.options.mode === 'unique') {
171
171
  for (var i = 0; i < list.length; i++) {
172
- this.root.querySelector('[data-switcher="' + list[i] + '"]').classList.remove('selected')
172
+ this.element.querySelector('[data-switcher="' + list[i] + '"]').classList.remove('selected')
173
173
  if (list[i] == value) {
174
174
  this.selected = [value]
175
- this.root.querySelector('[data-switcher="' + list[i] + '"]').classList.add('selected')
175
+ this.element.querySelector('[data-switcher="' + list[i] + '"]').classList.add('selected')
176
176
  }
177
177
  }
178
178
  } else {
179
179
  value = value || []
180
180
  this.selected = []
181
181
  for (var i = 0; i < list.length; i++) {
182
- this.root.querySelector('[data-switcher="' + list[i] + '"]').classList.remove('selected')
182
+ this.element.querySelector('[data-switcher="' + list[i] + '"]').classList.remove('selected')
183
183
  if (value.indexOf(list[i]) !== -1) {
184
184
  this.selected.push(list[i])
185
- this.root.querySelector('[data-switcher="' + list[i] + '"]').classList.add('selected')
185
+ this.element.querySelector('[data-switcher="' + list[i] + '"]').classList.add('selected')
186
186
  }
187
187
  }
188
188
  }
@@ -26,11 +26,11 @@ class Text {
26
26
  * @return {Object} This class instance
27
27
  */
28
28
  build () {
29
- this.root = document.createElement(this.options.tag)
30
- addClass(this.root, this.options.class)
29
+ this.element = document.createElement(this.options.tag)
30
+ addClass(this.element, this.options.class)
31
31
 
32
32
  if (this.options.class !== 'text') {
33
- this.root.classList.add('text')
33
+ this.element.classList.add('text')
34
34
  }
35
35
 
36
36
  if (this.options.text) {
@@ -38,7 +38,7 @@ class Text {
38
38
  }
39
39
 
40
40
  if (this.options.container) {
41
- this.options.container.appendChild(this.root)
41
+ this.options.container.appendChild(this.element)
42
42
  }
43
43
 
44
44
  return this
@@ -50,16 +50,20 @@ class Text {
50
50
 
51
51
  var label = this.options.label || ''
52
52
 
53
- this.root.innerHTML = label + text
53
+ if (this.options.textFirst) {
54
+ this.element.innerHTML = text + label
55
+ } else {
56
+ this.element.innerHTML = label + text
57
+ }
54
58
 
55
59
  if (this.options.spaceAfter) {
56
- this.root.innerHTML = this.root.innerHTML + ' '
60
+ this.element.innerHTML = this.element.innerHTML + ' '
57
61
  }
58
62
  }
59
63
 
60
64
  setText (text) {
61
65
  // console.log('setText', text)
62
- this.root.innerHTML = text
66
+ this.element.innerHTML = text
63
67
  }
64
68
  }
65
69
 
@@ -42,11 +42,11 @@ class Text {
42
42
  build () {
43
43
  var tag = this.options.tag || 'div'
44
44
 
45
- this.root = document.createElement(tag)
46
- this.root.classList.add('textfield')
45
+ this.element = document.createElement(tag)
46
+ this.element.classList.add('textfield')
47
47
 
48
48
  if (this.options.class !== 'textfield') {
49
- this.root.classList.add(this.options.class)
49
+ this.element.classList.add(this.options.class)
50
50
  }
51
51
 
52
52
  this.buildLabel()
@@ -57,11 +57,11 @@ class Text {
57
57
  }
58
58
 
59
59
  if (this.options.data) {
60
- dataset(this.root, this.options.data)
60
+ dataset(this.element, this.options.data)
61
61
  }
62
62
 
63
63
  if (this.container) {
64
- this.container.appendChild(this.root)
64
+ this.container.appendChild(this.element)
65
65
  }
66
66
 
67
67
  return this
@@ -72,7 +72,7 @@ class Text {
72
72
  this.label = document.createElement('label')
73
73
  this.label.classList.add('label')
74
74
  this.label.innerHTML = this.options.label
75
- this.root.appendChild(this.label)
75
+ this.element.appendChild(this.label)
76
76
  }
77
77
  }
78
78
 
@@ -83,7 +83,7 @@ class Text {
83
83
  }
84
84
  this.input = document.createElement(tag)
85
85
  this.input.classList.add('input')
86
- this.root.appendChild(this.input)
86
+ this.element.appendChild(this.input)
87
87
 
88
88
  attributes(this.input, this.options)
89
89
 
@@ -99,12 +99,12 @@ class Text {
99
99
  }
100
100
 
101
101
  onFocus (ev) {
102
- this.root.classList.add('focused')
102
+ this.element.classList.add('focused')
103
103
  this.emit('focus', ev)
104
104
  }
105
105
 
106
106
  onBlur (ev) {
107
- this.root.classList.remove('focused')
107
+ this.element.classList.remove('focused')
108
108
  this.emit('blur', ev)
109
109
  }
110
110
 
@@ -120,7 +120,7 @@ class Text {
120
120
  * @return {Object} The class instance
121
121
  */
122
122
  set (prop, value) {
123
- // console.log('set', this.root, prop, value)
123
+ // console.log('set', this.element, prop, value)
124
124
  switch (prop) {
125
125
  case 'value':
126
126
  this.setValue(value)
@@ -162,11 +162,11 @@ class Text {
162
162
  }
163
163
 
164
164
  hide () {
165
- this.root.classList.add('hide')
165
+ this.element.classList.add('hide')
166
166
  }
167
167
 
168
168
  show () {
169
- this.root.classList.remove('hide')
169
+ this.element.classList.remove('hide')
170
170
  }
171
171
 
172
172
  get () {
package/src/dialog.js CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict'
2
2
 
3
3
  // dialog related modules
4
- import events from './component/events'
4
+ import events from './mixin/events'
5
5
  import emitter from './module/emitter'
6
- import controller from './component/controller'
6
+ import controller from './mixin/controller'
7
7
  import attach from './module/attach'
8
- import insert from './component/insert'
8
+ import insert from './mixin/insert'
9
9
  import event from './element/event.js'
10
10
  import css from './module/css'
11
11
 
@@ -34,7 +34,7 @@ class Dialog {
34
34
  this.build()
35
35
  this.attach()
36
36
 
37
- this.root.style.display = 'none'
37
+ this.element.style.display = 'none'
38
38
 
39
39
  return this
40
40
  }
@@ -65,27 +65,27 @@ class Dialog {
65
65
  * @return {Object} The class instance
66
66
  */
67
67
  build () {
68
- this.root = document.createElement('div')
68
+ this.element = document.createElement('div')
69
69
 
70
- css.add(this.root, 'material-dialog')
70
+ css.add(this.element, 'material-dialog')
71
71
 
72
72
  if (this.options.name) {
73
- css.add(this.root, 'dialog-' + this.options.name)
73
+ css.add(this.element, 'dialog-' + this.options.name)
74
74
  }
75
75
 
76
76
  if (this.options.css) {
77
- css.add(this.root, this.options.css)
77
+ css.add(this.element, this.options.css)
78
78
  }
79
79
 
80
80
  if (this.options.theme) {
81
- css.add(this.root, this.options.theme + '-theme')
81
+ css.add(this.element, this.options.theme + '-theme')
82
82
  }
83
83
 
84
84
  this.surface = document.createElement('div')
85
85
 
86
86
  css.add(this.surface, 'dialog-surface')
87
87
 
88
- this.insertElement(this.surface, this.root)
88
+ this.insertElement(this.surface, this.element)
89
89
 
90
90
  if (this.options.title) {
91
91
  this.buildTitle()
@@ -176,13 +176,13 @@ class Dialog {
176
176
  }
177
177
 
178
178
  close () {
179
- css.add(this.root, 'dialog-closing')
179
+ css.add(this.element, 'dialog-closing')
180
180
 
181
181
  var delayMillis = 200 // 1 second
182
182
  setTimeout(() => {
183
- this.root.style.display = 'none'
184
- css.remove(this.root, 'dialog-closing')
185
- css.remove(this.root, 'dialog-show')
183
+ this.element.style.display = 'none'
184
+ css.remove(this.element, 'dialog-closing')
185
+ css.remove(this.element, 'dialog-show')
186
186
  }, delayMillis)
187
187
 
188
188
  this.previousActive.focus()
@@ -193,19 +193,19 @@ class Dialog {
193
193
  show () {
194
194
  this.previousActive = document.activeElement
195
195
 
196
- this.root.style.display = 'flex'
197
- // css.add(this.root, 'dialog-showing');
196
+ this.element.style.display = 'flex'
197
+ // css.add(this.element, 'dialog-showing');
198
198
 
199
199
  var delayMillis = 100 // 1 second
200
200
 
201
201
  setTimeout(() => {
202
- css.add(this.root, 'dialog-show')
203
- // css.remove(this.root, 'dialog-showing');
202
+ css.add(this.element, 'dialog-show')
203
+ // css.remove(this.element, 'dialog-showing');
204
204
  }, delayMillis)
205
205
 
206
206
  return this
207
207
 
208
- // var button = this.root.querySelector('button')
208
+ // var button = this.element.querySelector('button')
209
209
 
210
210
  // if (button) button.focus()
211
211
  }
package/src/divider.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
- import create from './component/create'
4
- import insert from './component/insert'
3
+ import create from './mixin/create'
4
+ import insert from './mixin/insert'
5
5
 
6
6
  var defaults = {
7
7
  prefix: 'material',
@@ -45,10 +45,10 @@ class Divider {
45
45
  * @return {Object} This class instance
46
46
  */
47
47
  build () {
48
- this.root = create(this.options)
48
+ this.element = create(this.options)
49
49
 
50
50
  if (this.options.text) {
51
- this.root.textContent = this.options.text
51
+ this.element.textContent = this.options.text
52
52
  }
53
53
 
54
54
  if (this.options.container) {
package/src/drawer.js CHANGED
@@ -1,10 +1,10 @@
1
1
  'use strict'
2
2
 
3
- import init from './component/init'
3
+ import init from './mixin/init'
4
4
  import insert from './element/insert'
5
- import classify from './component/classify'
5
+ import classify from './module/classify'
6
6
  import css from './module/css'
7
- import events from './component/events'
7
+ import events from './mixin/events'
8
8
  import create from './element/create'
9
9
  import emitter from './module/emitter'
10
10
 
@@ -57,14 +57,14 @@ class Drawer {
57
57
 
58
58
  classify(this.wrapper, this.options)
59
59
 
60
- this.root = create('aside')
60
+ this.element = create('aside')
61
61
 
62
- css.add(this.root, 'drawer-panel')
62
+ css.add(this.element, 'drawer-panel')
63
63
 
64
- insert(this.root, this.wrapper)
64
+ insert(this.element, this.wrapper)
65
65
 
66
66
  if (this.options.position) {
67
- css.add(this.root, 'position-' + this.options.position)
67
+ css.add(this.element, 'position-' + this.options.position)
68
68
  }
69
69
 
70
70
  if (this.options.fixed) {
@@ -73,9 +73,9 @@ class Drawer {
73
73
 
74
74
  if (this.options.size) {
75
75
  if (this.options.position === 'top' || this.options.position === 'bottom') {
76
- this.root.style = 'height: ' + this.options.size + 'px;'
76
+ this.element.style = 'height: ' + this.options.size + 'px;'
77
77
  } else {
78
- this.root.style = 'width: ' + this.options.size + 'px;'
78
+ this.element.style = 'width: ' + this.options.size + 'px;'
79
79
  }
80
80
  }
81
81
 
@@ -85,7 +85,7 @@ class Drawer {
85
85
 
86
86
  if (this.options.container) { insert(this.wrapper, this.options.container) }
87
87
 
88
- this.emit('built', this.root)
88
+ this.emit('built', this.element)
89
89
 
90
90
  return this
91
91
  }
@@ -109,7 +109,7 @@ class Drawer {
109
109
  */
110
110
 
111
111
  toggle () {
112
- // console.log('toggle', this.root);
112
+ // console.log('toggle', this.element);
113
113
  if (this.wrapper.classList.contains('show')) {
114
114
  this.close()
115
115
  } else {
package/src/element.js CHANGED
@@ -1,46 +1,21 @@
1
-
2
- /**
3
- * Class Element
4
- * @class
5
- * @since 0.0.1
6
- * @example
7
- * var div = new Element({
8
- * tag: 'div',
9
- * class: 'mydiv',
10
- * })
11
- */
12
-
13
1
  class Element {
14
2
  static isElement () {
15
3
  return true
16
4
  }
17
5
 
18
- /**
19
- * The init method of the Button class
20
- * @param {Object} The element attributes
21
- * @private
22
- * @return {DOMElement} The dom element
23
- */
24
6
  constructor (options) {
25
7
  this.options = Object.assign({}, options || {})
26
8
  // console.log('element options', options)
27
9
  var element = document.createElement(this.options.tag || 'div')
10
+ delete this.options.tag
28
11
 
29
- if (options.html) {
30
- element.innerHTML = this.options.html
31
- }
32
-
33
- if (options.text) {
34
- element.textContent = this.options.text
35
- }
36
-
37
- if (options.id) {
38
- element.setAttribute('id', options.id)
39
- }
12
+ if (options.html) element.innerHTML = this.options.html
13
+ delete this.options.html
40
14
 
41
- delete this.options.tag
15
+ if (options.text) element.textContent = this.options.text
42
16
  delete this.options.text
43
- delete this.options.html
17
+
18
+ if (options.id) element.setAttribute('id', options.id)
44
19
 
45
20
  for (var property in this.options) {
46
21
  if (this.options.hasOwnProperty(property)) {
@@ -40,19 +40,19 @@ class EmailLink {
40
40
  * @return {Object} This class instance
41
41
  */
42
42
  build () {
43
- this.root = document.createElement('a')
44
- this.root.classList.add('email')
43
+ this.element = document.createElement('a')
44
+ this.element.classList.add('email')
45
45
 
46
46
  if (this.options.container) {
47
- this.options.container.appendChild(this.root)
47
+ this.options.container.appendChild(this.element)
48
48
  }
49
49
 
50
50
  return this
51
51
  }
52
52
 
53
53
  set (email) {
54
- this.root.innerHTML = email
55
- this.root.setAttribute('href', 'mailto:' + email)
54
+ this.element.innerHTML = email
55
+ this.element.setAttribute('href', 'mailto:' + email)
56
56
  }
57
57
  }
58
58
 
@@ -42,11 +42,11 @@ class Image {
42
42
  * @return {Object} This class instance
43
43
  */
44
44
  build () {
45
- this.root = document.createElement('div')
46
- this.root.classList.add(this.options.class)
45
+ this.element = document.createElement('div')
46
+ this.element.classList.add(this.options.class)
47
47
 
48
48
  if (this.options.container) {
49
- this.options.container.appendChild(this.root)
49
+ this.options.container.appendChild(this.element)
50
50
  }
51
51
 
52
52
  return this
@@ -76,7 +76,7 @@ class Image {
76
76
  url = url + format
77
77
  }
78
78
 
79
- this.root.style.backgroundImage = 'url(' + asset.url + src.path + 'thumb/' + src.filename + ')'
79
+ this.element.style.backgroundImage = 'url(' + asset.url + src.path + 'thumb/' + src.filename + ')'
80
80
  }
81
81
 
82
82
  sanitize (formats) {
package/src/form/build.js CHANGED
@@ -5,19 +5,19 @@ import Layout from '../layout'
5
5
  export default {
6
6
  build () {
7
7
  // console.log('build', this.options.layout)
8
- this.root = document.createElement('div')
9
- this.root.classList.add('form')
8
+ this.element = document.createElement('div')
9
+ this.element.classList.add('form')
10
10
 
11
11
  if (this.options.class !== 'form') {
12
- this.root.classList.add(this.options.class)
12
+ this.element.classList.add(this.options.class)
13
13
  }
14
14
 
15
15
  if (this.options.form) {
16
- this.root.classList.add(this.options.form)
16
+ this.element.classList.add(this.options.form)
17
17
  }
18
18
 
19
19
  if (this.options.data) {
20
- dataset(this.root, this.options.data)
20
+ dataset(this.element, this.options.data)
21
21
  }
22
22
 
23
23
  this.buildForm(this.options.form)
@@ -25,13 +25,13 @@ export default {
25
25
  this.buildLayout()
26
26
 
27
27
  if (this.options.container) {
28
- this.options.container.appendChild(this.root)
28
+ this.options.container.appendChild(this.element)
29
29
  }
30
30
  },
31
31
 
32
32
  buildForm (form) {
33
33
  this.form = document.createElement('form')
34
- this.root.appendChild(this.form)
34
+ this.element.appendChild(this.form)
35
35
 
36
36
  if (form && form.method) {
37
37
  this.form.setAttribute('method', form.method)
package/src/form.js CHANGED
@@ -4,7 +4,7 @@ import insert from './element/insert'
4
4
  import css from './module/css'
5
5
  import emitter from './module/emitter'
6
6
  import attach from './module/attach'
7
- import controller from './component/controller'
7
+ import controller from './mixin/controller'
8
8
 
9
9
  // import component
10
10
  import Layout from './layout'
@@ -72,13 +72,13 @@ class Form {
72
72
  build () {
73
73
  var tag = this.options.tag || 'div'
74
74
 
75
- this.root = document.createElement(tag)
76
- css.add(this.root, this.options.prefix + '-' + this.options.class)
75
+ this.element = document.createElement(tag)
76
+ css.add(this.element, this.options.prefix + '-' + this.options.class)
77
77
 
78
78
  // complete layout options
79
- this.options.root = this.root
79
+ this.options.root = this.element
80
80
 
81
- this.layout = new Layout(this.options.layout, this.root)
81
+ this.layout = new Layout(this.options.layout, this.element)
82
82
 
83
83
  this._initControls(this.layout.controls)
84
84
 
@@ -86,7 +86,7 @@ class Form {
86
86
  }
87
87
 
88
88
  insert (container, context) {
89
- insert(this.root, container, context)
89
+ insert(this.element, container, context)
90
90
 
91
91
  return this
92
92
  }
package/src/icon.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import insert from './component/insert'
3
+ import insert from './mixin/insert'
4
4
  import css from './module/css'
5
5
 
6
6
  var defaults = {
@@ -55,11 +55,11 @@ class Icon {
55
55
 
56
56
  this.element = this.element || {}
57
57
 
58
- this.root = document.createElement(tag)
59
- css.add(this.root, this.options.prefix + '-' + this.options.class)
58
+ this.element = document.createElement(tag)
59
+ css.add(this.element, this.options.prefix + '-' + this.options.class)
60
60
 
61
- if (options.css) { css.add(this.root, options.css) }
62
- // css.add(this.root, this.options.class + '-adjust');
61
+ if (options.css) { css.add(this.element, options.css) }
62
+ // css.add(this.element, this.options.class + '-adjust');
63
63
 
64
64
  if (this.options.container) {
65
65
  this.insert(this.options.container)
@@ -73,10 +73,10 @@ class Icon {
73
73
  */
74
74
  set (value) {
75
75
  if (value) {
76
- if (this.root.innerText) {
77
- this.root.innerText = value
76
+ if (this.element.innerText) {
77
+ this.element.innerText = value
78
78
  } else {
79
- this.root.textContent = value
79
+ this.element.textContent = value
80
80
  }
81
81
 
82
82
  return this