material 0.4.2 → 0.5.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 (168) hide show
  1. package/dist/tracks.svg +10 -0
  2. package/package.json +1 -1
  3. package/src/appbar.js +1 -2
  4. package/src/control/button.js +263 -0
  5. package/src/control/button.new.js +190 -0
  6. package/src/control/datehour.js +65 -0
  7. package/src/control/dialog.js +174 -0
  8. package/src/control/file.js +123 -0
  9. package/src/control/image.js +92 -0
  10. package/src/control/link.js +61 -0
  11. package/src/control/list.js +77 -0
  12. package/src/control/loading.js +128 -0
  13. package/src/control/module/addclass.js +16 -0
  14. package/src/control/module/attributes.js +21 -0
  15. package/src/control/search.js +98 -0
  16. package/src/control/select.js +130 -0
  17. package/src/control/selecter.js +246 -0
  18. package/src/control/switch.js +272 -0
  19. package/src/control/switcher.js +245 -0
  20. package/src/control/text.js +66 -0
  21. package/src/control/textfield.js +177 -0
  22. package/src/field/image.js +9 -3
  23. package/src/form/build.js +60 -6
  24. package/src/form/cancel.js +7 -3
  25. package/src/form/controller.js +90 -0
  26. package/src/form/create.js +12 -6
  27. package/src/form/data.js +82 -0
  28. package/src/form/delete.js +2 -1
  29. package/src/form/fetch.js +30 -0
  30. package/src/form/render.js +14 -19
  31. package/src/form/set.js +27 -12
  32. package/src/form/submit.js +24 -49
  33. package/src/form/update.js +46 -0
  34. package/src/layout.js +26 -22
  35. package/src/list/add.js +34 -0
  36. package/src/list/build.js +100 -6
  37. package/src/list/click.js +10 -5
  38. package/src/list/collection.js +187 -0
  39. package/src/list/create.js +21 -11
  40. package/src/list/display.js +78 -0
  41. package/src/list/empty.js +4 -1
  42. package/src/list/filter.js +114 -0
  43. package/src/list/load.js +2 -2
  44. package/src/list/remove.js +17 -4
  45. package/src/list/render.js +32 -9
  46. package/src/list/request.js +182 -0
  47. package/src/list/search.js +118 -35
  48. package/src/list/select.js +151 -30
  49. package/src/list/status.js +10 -3
  50. package/src/list/update.js +49 -8
  51. package/src/list/virtual.js +195 -127
  52. package/src/map/build.js +103 -0
  53. package/src/map/countries.js +114 -0
  54. package/src/map/display.js +135 -0
  55. package/src/map/focus.js +39 -0
  56. package/src/map/init.js +24 -0
  57. package/src/map/label.js +0 -0
  58. package/src/map/mode.js +44 -0
  59. package/src/map/mouse.js +65 -0
  60. package/src/map/select.js +68 -0
  61. package/src/map/set.js +71 -0
  62. package/src/map/viewport.js +46 -0
  63. package/src/map.js +71 -0
  64. package/src/module/attach.js +15 -16
  65. package/src/module/extract.js +35 -28
  66. package/src/module/mediator.js +56 -0
  67. package/src/module/object.js +17 -1
  68. package/src/module/observer.js +1 -1
  69. package/src/module/passive.js +17 -0
  70. package/src/module/remove.js +74 -0
  71. package/src/module/scrollbar.js +48 -0
  72. package/src/module/smoothscroll.js +20 -0
  73. package/src/module/viewport.js +20 -0
  74. package/src/selector.js +239 -0
  75. package/src/skin/material/base/body.sass +3 -0
  76. package/src/skin/material/button/file.sass +1 -1
  77. package/src/skin/material/container/container.sass +1 -1
  78. package/src/skin/material/container/dialog.sass +57 -1
  79. package/src/skin/material/container/drawer.sass +3 -3
  80. package/src/skin/material/control/button.sass +125 -0
  81. package/src/skin/material/control/dialog.sass +0 -0
  82. package/src/skin/material/control/progress.sass +136 -0
  83. package/src/skin/material/control/search.sass +40 -0
  84. package/src/skin/material/control/selecter.sass +131 -0
  85. package/src/skin/material/control/selector.sass +38 -0
  86. package/src/skin/material/control/slider.sass +2 -2
  87. package/src/skin/material/control/switch.sass +146 -3
  88. package/src/skin/material/control/switcher.sass +41 -0
  89. package/src/skin/material/control/textfield.sass +2 -1
  90. package/src/skin/material/icon/cancel.svg +1 -0
  91. package/src/skin/material/material.sass +3 -0
  92. package/src/skin/material/view/list.sass +81 -188
  93. package/src/skin/material/view/listview.sass +187 -96
  94. package/src/skin/material/view/tabview.sass +7 -5
  95. package/src/skin/material.bak/base/body.sass +52 -0
  96. package/src/skin/material.bak/base/elevation.sass +50 -0
  97. package/src/skin/material.bak/base/grid.sass +63 -0
  98. package/src/skin/material.bak/base/typo.sass +107 -0
  99. package/src/skin/material.bak/button/action.sass +89 -0
  100. package/src/skin/material.bak/button/button.sass +183 -0
  101. package/src/skin/material.bak/button/file.sass +24 -0
  102. package/src/skin/material.bak/button/floating.sass +113 -0
  103. package/src/skin/material.bak/button/raised.sass +101 -0
  104. package/src/skin/material.bak/button/stroked.sass +71 -0
  105. package/src/skin/material.bak/component/component.sass +7 -0
  106. package/src/skin/material.bak/component/divider.sass +17 -0
  107. package/src/skin/material.bak/component/image.sass +6 -0
  108. package/src/skin/material.bak/component/label.sass +2 -0
  109. package/src/skin/material.bak/component/progress.sass +138 -0
  110. package/src/skin/material.bak/component/subheader.sass +3 -0
  111. package/src/skin/material.bak/component/text.sass +85 -0
  112. package/src/skin/material.bak/container/appbar.sass +167 -0
  113. package/src/skin/material.bak/container/banner.sass +38 -0
  114. package/src/skin/material.bak/container/card.sass +18 -0
  115. package/src/skin/material.bak/container/container.sass +1 -0
  116. package/src/skin/material.bak/container/dialog.sass +184 -0
  117. package/src/skin/material.bak/container/drawer.sass +159 -0
  118. package/src/skin/material.bak/container/drawernew.sass +159 -0
  119. package/src/skin/material.bak/container/menu.sass +58 -0
  120. package/src/skin/material.bak/container/snackbar.sass +18 -0
  121. package/src/skin/material.bak/container/tabs.sass +75 -0
  122. package/src/skin/material.bak/container/toolbar.sass +161 -0
  123. package/src/skin/material.bak/control/button.sass +125 -0
  124. package/src/skin/material.bak/control/checkbox.sass +105 -0
  125. package/src/skin/material.bak/control/dialog.sass +0 -0
  126. package/src/skin/material.bak/control/search.sass +40 -0
  127. package/src/skin/material.bak/control/selecter.sass +128 -0
  128. package/src/skin/material.bak/control/slider.sass +181 -0
  129. package/src/skin/material.bak/control/switch.sass +284 -0
  130. package/src/skin/material.bak/control/switcher.sass +35 -0
  131. package/src/skin/material.bak/control/textfield.sass +126 -0
  132. package/src/skin/material.bak/control/tooltip.sass +36 -0
  133. package/src/skin/material.bak/icon/back.svg +5 -0
  134. package/src/skin/material.bak/icon/cancel.svg +1 -0
  135. package/src/skin/material.bak/icon/checkbox.svg +4 -0
  136. package/src/skin/material.bak/icon/forward.svg +5 -0
  137. package/src/skin/material.bak/icon/menu.svg +4 -0
  138. package/src/skin/material.bak/icon/pin.svg +4 -0
  139. package/src/skin/material.bak/layout/layout.sass +69 -0
  140. package/src/skin/material.bak/layout/resizer.sass +69 -0
  141. package/src/skin/material.bak/material.css +2042 -0
  142. package/src/skin/material.bak/material.css.map +7 -0
  143. package/src/skin/material.bak/material.sass +65 -0
  144. package/src/skin/material.bak/module/ripple.sass +9 -0
  145. package/src/skin/material.bak/theme/default.sass +50 -0
  146. package/src/skin/material.bak/theme/ocean.sass +29 -0
  147. package/src/skin/material.bak/theme/theme.sass +3 -0
  148. package/src/skin/material.bak/view/calendar.sass +193 -0
  149. package/src/skin/material.bak/view/form.sass +15 -0
  150. package/src/skin/material.bak/view/grid.sass +116 -0
  151. package/src/skin/material.bak/view/list.sass +89 -0
  152. package/src/skin/material.bak/view/listview.sass +195 -0
  153. package/src/skin/material.bak/view/map.sass +6 -0
  154. package/src/skin/material.bak/view/page.sass +4 -0
  155. package/src/skin/material.bak/view/tabview-bak.sass +40 -0
  156. package/src/skin/material.bak/view/tabview.sass +55 -0
  157. package/src/skin/material.bak/view/tree.sass +73 -0
  158. package/src/skin/material.bak/view/view.sass +7 -0
  159. package/src/switch.js +1 -1
  160. package/src/tabs/setup.js +0 -0
  161. package/src/tabview.js +64 -14
  162. package/src/tooltip.js +23 -5
  163. package/src/view/build.js +15 -3
  164. package/src/view/display.js +79 -7
  165. package/src/form/clean.js +0 -6
  166. package/src/form/mode.js +0 -16
  167. package/src/form/setup.js +0 -30
  168. package/src/list/fetch.js +0 -66
@@ -1,43 +1,26 @@
1
- /**
2
- * extract.f extract a function from a string using dot
3
- * @param {string} func A string representing a function accessible in dot notation
4
- * @return {function} The function
5
- */
6
- function f(instance, func) {
7
- if (!func) return
8
-
9
- if (typeof func === 'function') {
10
- return func
11
- } else if (!func.match(/\./)) return instance[func]
12
- var iteration
13
-
14
- var keys = func.split('.')
15
- for (var i = 0, l = keys.length; i < l; i++) {
16
- var key = keys[i]
17
-
18
- iteration = iteration || instance
19
- iteration = iteration[key]
20
- }
21
-
22
- return iteration
23
- }
24
1
 
25
2
  /**
26
3
  * extract.e extract a event and the context
27
4
  * @param {[type]} str [description]
28
5
  * @return {[type]} [description]
29
6
  */
30
- function e(instance, ev) {
7
+ function e (instance, ev) {
31
8
  if (!ev) return instance
32
- else if (!ev.match(/\./)) return instance[ev]
9
+ else if (!ev.match(/\./)) {
10
+ return {
11
+ element: instance,
12
+ name: ev
13
+ }
14
+ }
15
+
33
16
  var iteration
34
17
  var obj = {}
35
18
  var element
36
19
 
37
20
  var keys = ev.split('.')
38
- for (var i = 0, l = keys.length; i < l; i++) {
39
- var key = keys[i]
40
21
 
22
+ for (var i = 0, l = keys.length; i <= l; i++) {
23
+ var key = keys[i]
41
24
  iteration = iteration || instance
42
25
  iteration = iteration[key]
43
26
 
@@ -51,4 +34,28 @@ function e(instance, ev) {
51
34
  return obj
52
35
  }
53
36
 
54
- export default { e, f }
37
+ /**
38
+ * extract.f extract a function from a string using dot
39
+ * @param {string} func A string representing a function accessible in dot notation
40
+ * @return {function} The function
41
+ */
42
+ function f (instance, func) {
43
+ if (!func) return
44
+
45
+ if (typeof func === 'function') {
46
+ return func
47
+ } else if (!func.match(/\./)) return instance[func]
48
+ var iteration
49
+
50
+ var keys = func.split('.')
51
+ for (var i = 0, l = keys.length; i < l; i++) {
52
+ var key = keys[i]
53
+
54
+ iteration = iteration || instance
55
+ iteration = iteration[key]
56
+ }
57
+
58
+ return iteration
59
+ }
60
+
61
+ export default { e, f }
@@ -0,0 +1,56 @@
1
+ const mediator = ((() => {
2
+ /**
3
+ * @description Subscribe to an event, supply a callback to be executed when that event is broadcast
4
+ * @param store {string}
5
+ * @param fn {function}
6
+ * @returns {subscribe} {object}
7
+ */
8
+ const subscribe = function (store, fn) {
9
+ if (!mediator.stores[store]) {
10
+ mediator.stores[store] = []
11
+ }
12
+
13
+ mediator.stores[store].push({
14
+ context: this,
15
+ callback: fn
16
+ })
17
+
18
+ return this
19
+ }
20
+
21
+ /**
22
+ * @description Publish/broadcast an event to the rest of the application
23
+ * @param store {string}
24
+ * @param args {object}
25
+ * @returns {*||boolean}
26
+ */
27
+ const publish = function (store, ...args) {
28
+ // console.log('publish', store, args)
29
+ if (!mediator.stores[store]) {
30
+ return false
31
+ }
32
+
33
+ for (let value of mediator.stores[store]) {
34
+ const subscription = value
35
+ subscription.callback.apply(subscription.context, args)
36
+ }
37
+
38
+ return this
39
+ }
40
+
41
+ return {
42
+ stores: {},
43
+ publish,
44
+ subscribe,
45
+ installTo: function (obj) {
46
+ obj.subscribe = subscribe
47
+ obj.publish = publish
48
+ },
49
+ init: function (obj) {
50
+ obj.subscribe = subscribe
51
+ obj.publish = publish
52
+ }
53
+ }
54
+ })())
55
+
56
+ export default mediator
@@ -1,7 +1,23 @@
1
+
1
2
  function is (object) {
2
3
  return object &&
3
4
  typeof object === 'object' &&
4
5
  Object.getPrototypeOf(object) === Object.getPrototypeOf({})
5
6
  }
6
7
 
7
- export { is }
8
+ function byString (o, s) {
9
+ s = s.replace(/\[(\w+)\]/g, '.$1') // convert indexes to properties
10
+ s = s.replace(/^\./, '') // strip a leading dot
11
+ var a = s.split('.')
12
+ for (var i = 0, n = a.length; i < n; ++i) {
13
+ var k = a[i]
14
+ if (k in o) {
15
+ o = o[k]
16
+ } else {
17
+ return
18
+ }
19
+ }
20
+ return o
21
+ }
22
+
23
+ export { is, byString }
@@ -3,7 +3,7 @@ const observer = {
3
3
  insert: (element, cb) => {
4
4
  var observer = new MutationObserver((mutations) => {
5
5
  if (document.contains(element)) {
6
- if (typeof cb === 'function') {
6
+ if (typeof cb === 'function' && !element.classList.contains('inserted')) {
7
7
  cb()
8
8
  }
9
9
 
@@ -0,0 +1,17 @@
1
+
2
+ function passive () {
3
+ var supportsPassive = false
4
+ try {
5
+ var opts = Object.defineProperty({}, 'passive', {
6
+ get: function () {
7
+ supportsPassive = true
8
+ }
9
+ })
10
+ window.addEventListener('testPassive', null, opts)
11
+ window.removeEventListener('testPassive', null, opts)
12
+ } catch (e) {}
13
+
14
+ return supportsPassive
15
+ }
16
+
17
+ export default passive
@@ -0,0 +1,74 @@
1
+ import extract from './extract'
2
+
3
+ /**
4
+ * attach function to events
5
+ * @module module/attach
6
+ * @category module
7
+ */
8
+
9
+ /**
10
+ * [attach description]
11
+ * @param {object} component [description]
12
+ * @param {[type]} events [description]
13
+ * @return {[type]} [description]
14
+ */
15
+ export default {
16
+ remove: function (events) {
17
+ // console.log('attach', events)
18
+ events = events || this.options.events
19
+ if (!events) return
20
+
21
+ // console.log('attach', events, this)
22
+ var instance = this
23
+ events.map((def) => {
24
+ var e = extract.e(instance, def[0])
25
+ var f = extract.f(instance, def[1])
26
+ var option = def[2]
27
+
28
+ var keys = def[1].split('.')
29
+
30
+ keys.pop()
31
+ var bound = this.last(keys.join('.'))
32
+
33
+ if (f && bound && e && e.element && e.element.addEventListener) {
34
+ if (!f) { console.log('error') }
35
+
36
+ if (option) {
37
+ e.element.removeEventListener(e.name, f.bind(bound), option)
38
+ } else {
39
+ console.log('removeEventListener', e.name, f.bind(bound))
40
+ e.element.removeEventListener(e.name, f.bind(bound), false)
41
+ }
42
+ } else if (e && e.element && e.element.off && f && bound) {
43
+ e.element.off(e.name, f.bind(bound))
44
+ } else {
45
+ console.trace('can\'t attach', def[0])
46
+ console.log('can\'t attach', def[0])
47
+ }
48
+ })
49
+
50
+ return this
51
+ },
52
+
53
+ /**
54
+ * Return the last reference from an object
55
+ * @param {string} str Object path for example key1.key2.key3
56
+ * @return {value} The value of the last reference
57
+ */
58
+ last: function (str) {
59
+ // console.log('_path', str)
60
+ if (!str) return this
61
+ else if (!str.match(/\./)) return this[str]
62
+ var last
63
+
64
+ var keys = str.split('.')
65
+ for (var i = 0, l = keys.length; i < l; i++) {
66
+ var key = keys[i]
67
+
68
+ last = last || this
69
+ last = last[key]
70
+ }
71
+
72
+ return last
73
+ }
74
+ }
@@ -0,0 +1,48 @@
1
+
2
+ window._scrollbar = {}
3
+
4
+ function scrollbar () {
5
+ // if (window._scrollbar.checked) return
6
+
7
+ var list = document.createElement('div')
8
+ list.classList.add('list')
9
+ list.style['z-index'] = '1000'
10
+ list.style.display = 'block'
11
+ list.style.width = '300px'
12
+ list.style['minWidth'] = '300px'
13
+ list.style.height = '20px'
14
+ list.style.position = 'absolute'
15
+ list.style.top = '-200px'
16
+ list.style.right = 'initial'
17
+ list.style.bottom = 'initial'
18
+ list.style.left = '200px'
19
+ list.style['overflowY'] = 'hidden'
20
+ document.body.appendChild(list)
21
+
22
+ var body = document.createElement('div')
23
+ body.classList.add('body')
24
+ body.style['overflowY'] = 'scroll'
25
+ list.appendChild(body)
26
+
27
+ var item = document.createElement('div')
28
+ item.classList.add('item')
29
+ item.style.height = '40px'
30
+ item.style.margin = '0'
31
+ item.style.padding = '0'
32
+ item.style.border = '0'
33
+ item.style['backgroundColor'] = 'green'
34
+ body.appendChild(item)
35
+
36
+ var info = item.getBoundingClientRect()
37
+ // console.log('width', 300 - info.width)
38
+
39
+ // console.log('list', list)
40
+
41
+ document.body.removeChild(list)
42
+
43
+ window._scrollbar.checked = true
44
+
45
+ return 300 - info.width
46
+ }
47
+
48
+ export default scrollbar
@@ -0,0 +1,20 @@
1
+ function smoothscroll (e, top, time) {
2
+ // console.log('smoothscroll', top, e.scrollTop)
3
+
4
+ var start = top - e.scrollTop
5
+
6
+ time = time || 275
7
+ var step = start / 100
8
+ var current = 0
9
+ while (current <= time) {
10
+ window.setTimeout(scrolling, current, e, step)
11
+ current += time / 100
12
+ }
13
+ }
14
+
15
+ function scrolling (e, step) {
16
+ // console.log('scrolling', step, e.scrollTop)
17
+ e.scrollBy(0, step)
18
+ }
19
+
20
+ export default smoothscroll
@@ -0,0 +1,20 @@
1
+
2
+ function viewport (el) {
3
+ if (!el) return
4
+
5
+ var rect = el.getBoundingClientRect()
6
+
7
+ var top = rect.top
8
+ var left = rect.left
9
+ var width = rect.width
10
+ var height = rect.height
11
+
12
+ return (
13
+ top >= window.pageYOffset &&
14
+ left >= window.pageXOffset &&
15
+ (top + height) <= (window.pageYOffset + window.innerHeight) &&
16
+ (left + width) <= (window.pageXOffset + window.innerWidth)
17
+ )
18
+ }
19
+
20
+ export default viewport
@@ -0,0 +1,239 @@
1
+ import emitter from './module/emitter'
2
+ import attach from './module/attach'
3
+
4
+ const defaults = {
5
+ class: 'selector',
6
+ tag: 'div',
7
+ styles: ['style', 'color'],
8
+ modules: ['border', 'label', 'resizer'],
9
+ resizer: {
10
+ keepRatio: true,
11
+ minWidth: 10,
12
+ minHeight: 10
13
+ },
14
+ events: [
15
+ ['resizer.pointerdown', 'onPointerDown']
16
+ ]
17
+
18
+ }
19
+
20
+ class Selector {
21
+ static isComponent () {
22
+ return true
23
+ }
24
+
25
+ /**
26
+ * Constructor
27
+ * @param {Object} options - Component options
28
+ * @return {Object} Class instance
29
+ */
30
+ constructor (options) {
31
+ // console.log('constructor')
32
+ this.options = Object.assign({}, defaults, options || {})
33
+ Object.assign(this, emitter, attach)
34
+ // console.log('options', options)
35
+
36
+ this.init()
37
+
38
+ return this
39
+ }
40
+
41
+ init () {
42
+ this.build()
43
+ this.setup()
44
+ this.attach()
45
+
46
+ if (this.options.container) {
47
+ this.options.container.appendChild(this.root)
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Build Method
53
+ * @return {Object} This class instance
54
+ */
55
+ build () {
56
+ this.root = document.createElement(this.options.tag)
57
+
58
+ this.root.classList.add('selector')
59
+
60
+ if (this.options.class !== 'selector') {
61
+ this.root.setAttribute('class', this.options.class)
62
+ }
63
+
64
+ if (this.options.modules.indexOf('border') > -1) {
65
+ this.border = document.createElement('div')
66
+ this.border.classList.add('border')
67
+ this.root.appendChild(this.border)
68
+ }
69
+
70
+ if (this.options.modules.indexOf('label') > -1) {
71
+ this.label = document.createElement('div')
72
+ this.label.classList.add('label')
73
+ this.root.appendChild(this.label)
74
+ }
75
+
76
+ if (this.options.modules.indexOf('resizer') > -1) {
77
+ this.resizer = document.createElement('div')
78
+ this.resizer.classList.add('resizer')
79
+ this.root.appendChild(this.resizer)
80
+ }
81
+
82
+ return this
83
+ }
84
+
85
+ setup () {
86
+ if (!this.options.src) return
87
+
88
+ this.setTarget(this.options.element)
89
+ }
90
+
91
+ /**
92
+ * Setter
93
+ * @param {string} prop
94
+ * @param {string} value
95
+ * @return {Object} The class instance
96
+ */
97
+ set (prop, value) {
98
+ // console.log('set', this.root, prop, value)
99
+ switch (prop) {
100
+ case 'target':
101
+ this.setTarget(value)
102
+ break
103
+ default:
104
+ // console.log('prop', prop)
105
+ this.setTarget(prop)
106
+ }
107
+
108
+ return this
109
+ }
110
+
111
+ setTarget (target) {
112
+ this.target = target
113
+
114
+ this.update(this.target)
115
+
116
+ this.root.classList.remove('hide')
117
+
118
+ // console.log('target', this.root, this.target)
119
+ }
120
+
121
+ update (target) {
122
+ target = target || this.target
123
+ if (!target) return
124
+ var coords = target.getBoundingClientRect()
125
+ var pcoords = this.root.parentNode.getBoundingClientRect()
126
+
127
+ this.root.style.top = coords.top - pcoords.top + 'px'
128
+ this.root.style.left = coords.left - pcoords.left + 'px'
129
+ this.root.style.width = coords.width + 'px'
130
+ this.root.style.height = coords.height + 'px'
131
+ }
132
+
133
+ /**
134
+ * Setter
135
+ * @param {string} prop
136
+ * @param {string} value
137
+ * @return {Object} The class instance
138
+ */
139
+ get (prop, value) {
140
+ switch (prop) {
141
+ case 'value':
142
+ return this.root.value
143
+ case 'label':
144
+ return this.label.innerHTML
145
+ default:
146
+ return this.root.value
147
+ }
148
+ }
149
+
150
+ onPointerDown (ev) {
151
+ // console.log('pointerdown', ev.target)
152
+ ev = ev || window.event
153
+
154
+ let width = 0
155
+ let height = 0
156
+
157
+ const offsetX = this.root.getBoundingClientRect().x
158
+ const offsetY = this.root.getBoundingClientRect().y
159
+ const element = document.body
160
+
161
+ var ratio = parseInt(this.root.style.width, 10) / parseInt(this.root.style.height, 10)
162
+
163
+ this.border.setPointerCapture(ev.pointerId)
164
+
165
+ element.onpointermove = (e) => {
166
+ // console.log('pointermove')
167
+
168
+ e.stopPropagation()
169
+
170
+ e = e || window.event
171
+
172
+ if (e.pageX) width = e.pageX - offsetX
173
+ else if (e.clientX) width = e.clientX - offsetX
174
+
175
+ if (e.pageY) height = e.pageY - offsetY
176
+ else if (e.clientY) height = e.clientY - offsetY
177
+
178
+ if (width < this.options.resizer.minWidth) width = this.options.resizer.minWidth
179
+
180
+ if (this.options.resizer.keepRatio) {
181
+ // console.log('keepRatio', width, ratio)
182
+ height = width / ratio
183
+ } else {
184
+ if (height < this.options.resizer.minHeight) height = this.options.resizer.minHeight
185
+ }
186
+
187
+ this.root.style.width = width + 'px'
188
+ this.root.style.height = height + 'px'
189
+
190
+ this.emit('resize', width, height)
191
+ }
192
+
193
+ element.onpointerup = (e) => {
194
+ // console.log('pointerup', e.target)
195
+
196
+ element.onpointermove = null
197
+ element.onpointerup = null
198
+ this.root.releasePointerCapture(e.pointerId)
199
+
200
+ // if (e.target !== this.root) return
201
+ }
202
+ }
203
+
204
+ disable () {
205
+ this.root.disabled = true
206
+ }
207
+
208
+ enable () {
209
+ this.root.disabled = false
210
+ }
211
+
212
+ hide () {
213
+ this.root.classList.add('hide')
214
+ }
215
+
216
+ show () {
217
+ this.root.classList.remove('hide')
218
+ }
219
+
220
+ destroy () {
221
+ if (this.root && this.root.parentNode) {
222
+ this.root.parentNode.removeChild(this.root)
223
+ }
224
+ }
225
+
226
+ click (ev) {
227
+ this.emit('click', ev)
228
+ }
229
+
230
+ mousedown (ev) {
231
+ this.root.classList.add('pushed')
232
+ }
233
+
234
+ mouseup (ev) {
235
+ this.root.classList.remove('pushed')
236
+ }
237
+ }
238
+
239
+ export default Selector
@@ -44,6 +44,9 @@ button
44
44
  &:hover
45
45
  outline: none
46
46
 
47
+ button
48
+ user-select: none
49
+
47
50
  // set all container boder-box
48
51
  *
49
52
  box-sizing: border-box
@@ -1,6 +1,6 @@
1
1
 
2
2
  // type file
3
- .material-button.type-file,
3
+ .material-button.type-file
4
4
  overflow: hidden
5
5
  position: relative
6
6
  vertical-align: middle
@@ -1 +1 @@
1
- .material-container
1
+
@@ -1,3 +1,60 @@
1
+ .dialog
2
+ position: fixed
3
+ top: 0
4
+ left: 0
5
+ bottom: 0
6
+ right: 0
7
+ background-color: rgba(0, 0, 0, 0.5)
8
+ display: flex
9
+ align-items: center
10
+ justify-content: center
11
+ overflow: hidden
12
+
13
+ //display: none;
14
+ //visibility: hidden;
15
+ opacity: 0
16
+
17
+ //z-index: -1;
18
+ transition: .2s
19
+
20
+ &.show
21
+ // display: flex;
22
+ // width: 10;
23
+ // height: 0;
24
+ //transition: .2s;
25
+ transition: .1s
26
+ opacity: 1
27
+
28
+ .surface
29
+ transform: translateY(0) scale(1)
30
+ opacity: 1
31
+ margin-top: 0
32
+ transition: .1s
33
+
34
+ .surface
35
+ transition: .1s
36
+ max-height: 600px
37
+ display: flex
38
+ flex-direction: column
39
+ flex-wrap: nowrap
40
+ opacity: 0
41
+ border-radius: 2px
42
+ background-color: $background-color
43
+ box-shadow: 0px 11px 15px -7px rgba(0, 0, 0, 0.2), 0px 24px 38px 3px rgba(0, 0, 0, 0.14), 0px 9px 46px 8px rgba(0, 0, 0, 0.12)
44
+ transform: translateY(150px) scale(0.8)
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
1
58
  .material-dialog
2
59
  position: fixed
3
60
  top: 0
@@ -59,7 +116,6 @@
59
116
  text-align: right
60
117
  overflow: hidden
61
118
  //padding: 8px
62
- .material-button
63
119
 
64
120
  .material-toolbar
65
121
  position: relative