material 0.7.4 → 0.7.5

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.
package/index.js CHANGED
@@ -29,6 +29,7 @@ import Text from './src/text'
29
29
  import Textfield from './src/textfield'
30
30
  import Toolbar from './src/toolbar'
31
31
  import Tooltip from './src/tooltip'
32
+ import View from './src/view'
32
33
  import attach from './src/module/attach'
33
34
  import attributes from './src/module/attributes'
34
35
  import build from './src/module/build'
@@ -45,6 +46,6 @@ export {
45
46
  AppBar, Button, Card, Checkbox, Component, DateHour, Dialog, Drawer, Element,
46
47
  File, Form, Image, Layout, List, Loading, Menu, Navigation, Progress, Select,
47
48
  Selecter, Slider, Snackbar, Switch, Switcher, Tabs, TabView, Text, Textfield, Toolbar, Tooltip,
48
- attach, attributes, build, dataset, display, events, emitter, jsonToHTML, mediator,
49
+ View, attach, attributes, build, dataset, display, events, emitter, jsonToHTML, mediator,
49
50
  observer, smoothscroll
50
51
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "material",
3
- "version": "0.7.4",
4
- "description": "A lightweight implementation of Material Design Components - ES6",
3
+ "version": "0.7.5",
4
+ "description": "A lightweight implementation of Material Design Components for the web - ES6",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "repository": {
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "homepage": "https://gitlab.com/alkaloid/material",
17
17
  "keywords": [
18
- "lightweight material design ui component es6 vanilla javascript"
18
+ "lightweight material design ui component web es6 vanilla javascript"
19
19
  ],
20
20
  "devDependencies": {
21
21
  "standard": "^10.0.3"
package/src/card.js CHANGED
@@ -11,11 +11,6 @@ const defaults = {
11
11
  }
12
12
 
13
13
  class Card {
14
- /**
15
- * Constructor
16
- * @param {Object} options - Component options
17
- * @return {Object} Class instance
18
- */
19
14
  constructor (options) {
20
15
  this.init(options)
21
16
  this.build()
@@ -1,9 +1,11 @@
1
1
  import dom from '../module/dom'
2
2
 
3
3
  const insert = (component, container, context = 'bottom') => {
4
+ // console.log('insert', component, container, context)
5
+
4
6
  if (!component || !container) return
5
7
 
6
- element = component.element || component
8
+ const element = component.element || component
7
9
  container = container.element || container
8
10
 
9
11
  const contexts = ['top', 'bottom', 'after', 'before']
package/src/loader.js ADDED
@@ -0,0 +1,88 @@
1
+ class Loader {
2
+ static defaults = {
3
+ class: 'loader'
4
+ }
5
+
6
+ constructor (options) {
7
+ this.options = Object.assign({}, Loader.defaults, options || {})
8
+
9
+ // Object.assign(this, attach, mediator, build)
10
+
11
+ this.build()
12
+
13
+ return this
14
+ }
15
+
16
+ build () {
17
+ this.element = document.createElement(this.options.tag || 'div')
18
+ this.element.classList.add(this.options.class || 'loader')
19
+
20
+ this.container = document.createElement('div')
21
+ this.container.classList.add('container')
22
+ this.element.appendChild(this.container)
23
+
24
+ const svg = `
25
+ <svg
26
+ version="1.1"
27
+ id="dc-spinner"
28
+ xmlns="http://www.w3.org/2000/svg"
29
+ x="0px" y="0px"
30
+ width:"38"
31
+ height:"38"
32
+ viewBox="0 0 38 38"
33
+ preserveAspectRatio="xMinYMin meet"
34
+ >
35
+ <path class="circles" d="M20,35c-8.271,0-15-6.729-15-15S11.729,5,20,5s15,6.729,15,15S28.271,35,20,35z M20,5.203
36
+ C11.841,5.203,5.203,11.841,5.203,20c0,8.159,6.638,14.797,14.797,14.797S34.797,28.159,34.797,20
37
+ C34.797,11.841,28.159,5.203,20,5.203z">
38
+ </path>
39
+
40
+ <path class="circles" d="M20,33.125c-7.237,0-13.125-5.888-13.125-13.125S12.763,6.875,20,6.875S33.125,12.763,33.125,20
41
+ S27.237,33.125,20,33.125z M20,7.078C12.875,7.078,7.078,12.875,7.078,20c0,7.125,5.797,12.922,12.922,12.922
42
+ S32.922,27.125,32.922,20C32.922,12.875,27.125,7.078,20,7.078z">
43
+ </path>
44
+
45
+ <path class="circletwo" stroke-width="0.6027" stroke-miterlimit="10" d="M5.203,20
46
+ c0-8.159,6.638-14.797,14.797-14.797V5C11.729,5,5,11.729,5,20s6.729,15,15,15v-0.203C11.841,34.797,5.203,28.159,5.203,20z">
47
+ <animateTransform
48
+ attributeName="transform"
49
+ type="rotate"
50
+ from="0 20 20"
51
+ to="360 20 20"
52
+ calcMode="spline"
53
+ keySplines="0.4, 0, 0.2, 1"
54
+ keyTimes="0;1"
55
+ dur="2s"
56
+ repeatCount="indefinite" />
57
+ </path>
58
+
59
+ <path class="circleone" stroke-width="0.2027" stroke-miterlimit="10" d="M7.078,20
60
+ c0-7.125,5.797-12.922,12.922-12.922V6.875C12.763,6.875,6.875,12.763,6.875,20S12.763,33.125,20,33.125v-0.203
61
+ C12.875,32.922,7.078,27.125,7.078,20z">
62
+ <animateTransform
63
+ attributeName="transform"
64
+ type="rotate"
65
+ from="0 20 20"
66
+ to="360 20 20"
67
+ dur="1.8s"
68
+ repeatCount="indefinite" />
69
+ </path>
70
+ </svg>`
71
+
72
+ this.container.innerHTML = svg
73
+ this.text = document.createElement(this.options.tag || 'span')
74
+ this.text.classList.add('text')
75
+ this.text.innerHTML = this.options.text
76
+ this.container.appendChild(this.text)
77
+ }
78
+
79
+ show () {
80
+ this.element.classList.add('show')
81
+ }
82
+
83
+ hide () {
84
+ this.element.classList.remove('show')
85
+ }
86
+ }
87
+
88
+ export default Loader
@@ -1,5 +1,5 @@
1
- // Assuming extract is imported or defined elsewhere
2
1
  import extract from './extract'
2
+ import last from './last'
3
3
 
4
4
  const attachModule = {
5
5
  attach (events) {
@@ -18,7 +18,7 @@ const attachModule = {
18
18
  keys.pop()
19
19
  }
20
20
 
21
- const bound = this.last(keys.join('.'))
21
+ const bound = last(keys.join('.'), this)
22
22
 
23
23
  let handler = null
24
24
 
@@ -45,14 +45,8 @@ const attachModule = {
45
45
  })
46
46
 
47
47
  return this
48
- },
49
-
50
- last (str) {
51
- if (!str) return this
52
- if (!str.includes('.')) return this[str]
53
-
54
- return str.split('.').reduce((acc, key) => acc[key], this)
55
48
  }
49
+
56
50
  }
57
51
 
58
52
  export default attachModule
@@ -1,21 +1,14 @@
1
1
  const special = ['required', 'disabled', 'multiple', 'checked']
2
2
 
3
- function attributes (element, o) {
4
- // console.log('attributes', o.attributes, element)
3
+ const attributes = (element, options) => {
4
+ if (!element || !options.attributes) return
5
5
 
6
- if (!element) return
7
-
8
- for (let i = 0; i < o.attributes.length; i++) {
9
- const attribute = o.attributes[i]
10
-
11
- if (o[attribute] && o[attribute] !== 'undefined') {
12
- if (special.indexOf(attribute) > -1) {
13
- element.setAttribute(attribute, attribute)
14
- } else {
15
- element.setAttribute(attribute, o[attribute])
16
- }
6
+ options.attributes.forEach(attribute => {
7
+ if (options[attribute] && String(options[attribute]) !== 'undefined') {
8
+ const value = special.includes(attribute) ? attribute : options[attribute]
9
+ element.setAttribute(attribute, value)
17
10
  }
18
- }
11
+ })
19
12
  }
20
13
 
21
14
  export default attributes
@@ -0,0 +1,24 @@
1
+ const cookie = {
2
+ set: (name, value, expire = 365) => {
3
+ const d = new Date()
4
+ d.setTime(d.getTime() + (expire * 24 * 60 * 60 * 1000))
5
+ const expires = `expires=${d.toUTCString()}`
6
+ document.cookie = `${name}=${value};${expires};path=/`
7
+ },
8
+ get: name => {
9
+ const nameEQ = `${name}=`
10
+ const ca = decodeURIComponent(document.cookie).split(';')
11
+
12
+ for (let c of ca) {
13
+ while (c.charAt(0) === ' ') c = c.substring(1)
14
+ if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length)
15
+ }
16
+
17
+ return ''
18
+ },
19
+ del: name => {
20
+ document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`
21
+ }
22
+ }
23
+
24
+ export default cookie
@@ -1,18 +1,8 @@
1
- export default {
2
- (str) => {
3
- // console.log('_path', str)
4
- if (!str) return this
5
- else if (!str.match(/\./)) return this[str]
6
- var last
1
+ const last = (str, that) => {
2
+ if (!str) return that
3
+ if (!str.includes('.')) return that[str]
7
4
 
8
- var keys = str.split('.')
9
- for (var i = 0, l = keys.length; i < l; i++) {
10
- var key = keys[i]
11
-
12
- last = last || this
13
- last = last[key]
14
- }
15
-
16
- return last
17
- }
5
+ return str.split('.').reduce((acc, key) => acc[key], that)
18
6
  }
7
+
8
+ export default last
@@ -0,0 +1,24 @@
1
+ const numabbr = (number, decimals = 2) => {
2
+ const factor = Math.pow(10, decimals)
3
+ const abbrev = ['k', 'm', 'b', 't']
4
+
5
+ for (let i = abbrev.length - 1; i >= 0; i--) {
6
+ const size = Math.pow(10, (i + 1) * 3)
7
+
8
+ if (size <= number) {
9
+ let num = Math.round(number * factor / size) / factor
10
+
11
+ // Handle special case where we round up to the next abbreviation
12
+ if (num === 1000 && i < abbrev.length - 1) {
13
+ num = 1
14
+ i++
15
+ }
16
+
17
+ return `${num}${abbrev[i]}`
18
+ }
19
+ }
20
+
21
+ return number.toString()
22
+ }
23
+
24
+ export default numabbr
@@ -1,11 +1,11 @@
1
1
 
2
- function is (object) {
2
+ const is = (object) => {
3
3
  return object &&
4
4
  typeof object === 'object' &&
5
5
  Object.getPrototypeOf(object) === Object.getPrototypeOf({})
6
6
  }
7
7
 
8
- function byString (o, s) {
8
+ const byString = (o, s) => {
9
9
  s = s.replace(/\[(\w+)\]/g, '.$1') // convert indexes to properties
10
10
  s = s.replace(/^\./, '') // strip a leading dot
11
11
  const a = s.split('.')
@@ -1,4 +1,4 @@
1
- function passiveEvents () {
1
+ const passiveEvents = () => {
2
2
  let supportsPassive = false
3
3
 
4
4
  try {
@@ -1,19 +1,7 @@
1
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
- */
2
+ import last from './last'
15
3
  export default {
16
- remove: function (events) {
4
+ remove: (events) => {
17
5
  // console.log('attach', events)
18
6
  events = events || this.options.events
19
7
  if (!events) return
@@ -42,33 +30,10 @@ export default {
42
30
  } else if (e && e.element && e.element.off && f && bound) {
43
31
  e.element.off(e.name, f.bind(bound))
44
32
  } else {
45
- console.trace('can\'t attach', def[0])
46
- console.log('can\'t attach', def[0])
33
+ console.trace('can\'t be removed', def[0])
47
34
  }
48
35
  })
49
36
 
50
37
  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
- let last
63
-
64
- const keys = str.split('.')
65
- for (let i = 0, l = keys.length; i < l; i++) {
66
- const key = keys[i]
67
-
68
- last = last || this
69
- last = last[key]
70
- }
71
-
72
- return last
73
38
  }
74
39
  }
@@ -1,4 +1,3 @@
1
- // request.js
2
1
  const request = async (url, method = 'GET', body = null, headers = {}, signal = null) => {
3
2
  const defaultHeaders = {
4
3
  Accept: 'application/json',
@@ -2,7 +2,8 @@ import insert from '../element/insert'
2
2
  import offset from '../element/offset'
3
3
 
4
4
  const defaults = {
5
- transition: '.5s cubic-bezier(0.4, 0.0, 0.2, 1)',
5
+ // transition: '.375s cubic-bezier(0.4, 0.0, 0.2, 1)',
6
+ transition: '.375s linear',
6
7
  opacity: ['1', '.3']
7
8
  }
8
9
 
@@ -1,4 +1,4 @@
1
- export default function () {
1
+ export default () => {
2
2
  try {
3
3
  document.createEvent('TouchEvent')
4
4
  return true
@@ -1,31 +1,11 @@
1
- /**
2
- * Utility functions
3
- * @module module/utils
4
- */
5
-
6
- /**
7
- * Checks if given value is an array
8
- * @param {*} object
9
- * @returns {boolean}
10
- */
11
1
  const isArray = (object) => {
12
2
  return Object.prototype.toString.call(object) === '[object Array]'
13
3
  }
14
4
 
15
- /**
16
- * Checks if JavaScript object is a plain object
17
- * @param {Object} object
18
- * @returns {*|boolean}
19
- */
20
5
  const isLiteralObject = (object) => {
21
6
  return object && typeof object === 'object' && Object.getPrototypeOf(object) === Object.getPrototypeOf({})
22
7
  }
23
8
 
24
- /**
25
- * Checks if object is iterable
26
- * @param {Object} object
27
- * @returns {boolean}
28
- */
29
9
  const isIterable = (object) => {
30
10
  return isLiteralObject(object) ||
31
11
  isArray(object) ||
@@ -34,11 +14,6 @@ const isIterable = (object) => {
34
14
  object.length !== undefined)
35
15
  }
36
16
 
37
- /**
38
- *
39
- * @param {Object} object
40
- * @param {Function} callback
41
- */
42
17
  const each = (object, callback) => {
43
18
  if (isArray(object) || (typeof object === 'object' && object.length !== undefined)) {
44
19
  for (let i = 0, l = object.length; i < l; i++) {
@@ -54,12 +29,6 @@ const each = (object, callback) => {
54
29
  }
55
30
  }
56
31
 
57
- /**
58
- * Array.indexOf support
59
- * @param {Array} array
60
- * @param {*} obj
61
- * @returns {number}
62
- */
63
32
  const indexOf = (array, obj) => {
64
33
  if (Array.prototype.indexOf) {
65
34
  return Array.prototype.indexOf.call(array, obj)
@@ -1,19 +1,13 @@
1
-
2
- function viewport (el) {
1
+ const viewport = el => {
3
2
  if (!el) return
4
3
 
5
- const rect = el.getBoundingClientRect()
6
-
7
- const top = rect.top
8
- const left = rect.left
9
- const width = rect.width
10
- const height = rect.height
4
+ const { top, left, width, height } = el.getBoundingClientRect()
11
5
 
12
6
  return (
13
7
  top >= window.pageYOffset &&
14
8
  left >= window.pageXOffset &&
15
- (top + height) <= (window.pageYOffset + window.innerHeight) &&
16
- (left + width) <= (window.pageXOffset + window.innerWidth)
9
+ top + height <= window.pageYOffset + window.innerHeight &&
10
+ left + width <= window.pageXOffset + window.innerWidth
17
11
  )
18
12
  }
19
13
 
package/src/navigation.js CHANGED
@@ -1,24 +1,67 @@
1
+ import EventEmitter from './mixin/emitter'
2
+
1
3
  import * as css from './module/css'
2
4
  import build from './module/build'
5
+ import attach from './module/attach'
6
+ import display from './mixin/display'
7
+ import Element from './element'
8
+ import Button from './button'
3
9
 
4
- class Navigation {
10
+ class Navigation extends EventEmitter {
5
11
  static defaults = {
6
- class: 'navigation'
12
+ class: 'navigation',
13
+ tag: 'nav',
14
+ events: [
15
+ ['element.click', 'toggle']
16
+ ]
7
17
  }
8
18
 
9
19
  constructor (options) {
20
+ super()
21
+
10
22
  this.init(options)
11
23
  this.build()
24
+ this.attach()
12
25
  this.setup()
13
26
  }
14
27
 
15
28
  init (options) {
16
29
  this.options = { ...Navigation.defaults, ...options }
17
- Object.assign(this, build)
30
+ Object.assign(this, build, attach, display)
31
+ }
32
+
33
+ setup () {
34
+ console.log('setup', this.options)
35
+ if (this.options.type) css.add(this.element, 'type-' + this.options.type)
36
+ if (this.options.type === 'rail') this.show()
37
+ if (this.options.items) this.render(this.options.items)
18
38
  }
19
39
 
20
- setup() {
21
- if (this.options.type) css.add(this.element, 'type-', this.options.type)
40
+ render (items) {
41
+ if (items && Array.isArray(items)) {
42
+ for (let i = 0; i < items.length; i++) {
43
+ this.add(items[i])
44
+ }
45
+ }
46
+ }
47
+
48
+ add (obj) {
49
+ if (typeof obj !== 'object') return this
50
+ let item
51
+ if (obj.type === 'divider') {
52
+ item = new Element({ tag: 'li', class: 'divider' })
53
+ } else if (obj.type === 'divider') {
54
+ item = new Element({ tag: 'li', class: 'divider' })
55
+ } else {
56
+ obj.container = this.ui.list
57
+ obj.class = 'item'
58
+ item = new Button(obj).on('click', (ev) => {
59
+ // console.log('select', ev.target.name)
60
+ this.emit('select', ev.target.name)
61
+ })
62
+ }
63
+
64
+ return this
22
65
  }
23
66
  }
24
67
 
@@ -0,0 +1,19 @@
1
+ html
2
+ font-size: 100%
3
+ line-height: 1.15
4
+ width: 100%
5
+ height: 100%
6
+
7
+ body
8
+ color: rgba(0, 0, 0, 0.67)
9
+ font-family: Roboto, arial, serif
10
+ font-size: 100%
11
+ display: flex
12
+ // position: relative
13
+ // display: block
14
+ // height: 100%
15
+ // width: 100%
16
+ // overflow: hidden
17
+ margin: 0
18
+ padding: 0
19
+ // user-select: none
@@ -0,0 +1,55 @@
1
+
2
+ // HTML Tags General Defintion
3
+ html
4
+ font-size: 100%
5
+ line-height: 1.15
6
+ width: 100%
7
+ height: 100%
8
+
9
+ body
10
+ color: rgba(0, 0, 0, 0.67)
11
+ font-family: Roboto, arial, serif
12
+ font-size: 100%
13
+ // position: relative
14
+ // display: block
15
+ // height: 100%
16
+ // width: 100%
17
+ // overflow: hidden
18
+ margin: 0
19
+ padding: 0
20
+ // user-select: none
21
+
22
+ input,
23
+ textarea,
24
+ keygen,
25
+ select,
26
+ button
27
+ font-size: 1em
28
+ font-family: Roboto, arial, serif
29
+ color: rgb(51, 51, 51)
30
+
31
+ p
32
+ line-height: 20px
33
+ padding-top: 6px
34
+ margin-bottom: 14px
35
+ letter-spacing: 0
36
+ font-weight: 400
37
+
38
+ // get rid of outline
39
+ select,
40
+ input,
41
+ textarea,
42
+ button
43
+ outline: none
44
+ &:hover
45
+ outline: none
46
+
47
+ button
48
+ user-select: none
49
+
50
+ // set all container boder-box
51
+ *
52
+ box-sizing: border-box
53
+
54
+ a
55
+ color: rgba(0, 0, 0, 0.7)
@@ -0,0 +1,50 @@
1
+ .elevation-z0
2
+ box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12)
3
+ .elevation-z1
4
+ box-shadow: 0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0, 0, 0, 0.12)
5
+ .elevation-z2
6
+ box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)
7
+ .elevation-z3
8
+ box-shadow: 0px 3px 3px -2px rgba(0, 0, 0, 0.2), 0px 3px 4px 0px rgba(0, 0, 0, 0.14), 0px 1px 8px 0px rgba(0, 0, 0, 0.12)
9
+ .elevation-z4
10
+ box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12)
11
+ .elevation-z5
12
+ box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.2), 0px 5px 8px 0px rgba(0, 0, 0, 0.14), 0px 1px 14px 0px rgba(0, 0, 0, 0.12)
13
+ .elevation-z6
14
+ box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.2), 0px 6px 10px 0px rgba(0, 0, 0, 0.14), 0px 1px 18px 0px rgba(0, 0, 0, 0.12)
15
+ .elevation-z7
16
+ box-shadow: 0px 4px 5px -2px rgba(0, 0, 0, 0.2), 0px 7px 10px 1px rgba(0, 0, 0, 0.14), 0px 2px 16px 1px rgba(0, 0, 0, 0.12)
17
+ .elevation-z8
18
+ box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12)
19
+ .elevation-z9
20
+ box-shadow: 0px 5px 6px -3px rgba(0, 0, 0, 0.2), 0px 9px 12px 1px rgba(0, 0, 0, 0.14), 0px 3px 16px 2px rgba(0, 0, 0, 0.12)
21
+ .elevation-z10
22
+ box-shadow: 0px 6px 6px -3px rgba(0, 0, 0, 0.2), 0px 10px 14px 1px rgba(0, 0, 0, 0.14), 0px 4px 18px 3px rgba(0, 0, 0, 0.12)
23
+ .elevation-z11
24
+ box-shadow: 0px 6px 7px -4px rgba(0, 0, 0, 0.2), 0px 11px 15px 1px rgba(0, 0, 0, 0.14), 0px 4px 20px 3px rgba(0, 0, 0, 0.12)
25
+ .elevation-z12
26
+ box-shadow: 0px 7px 8px -4px rgba(0, 0, 0, 0.2), 0px 12px 17px 2px rgba(0, 0, 0, 0.14), 0px 5px 22px 4px rgba(0, 0, 0, 0.12)
27
+ .elevation-z13
28
+ box-shadow: 0px 7px 8px -4px rgba(0, 0, 0, 0.2), 0px 13px 19px 2px rgba(0, 0, 0, 0.14), 0px 5px 24px 4px rgba(0, 0, 0, 0.12)
29
+ .elevation-z14
30
+ box-shadow: 0px 7px 9px -4px rgba(0, 0, 0, 0.2), 0px 14px 21px 2px rgba(0, 0, 0, 0.14), 0px 5px 26px 4px rgba(0, 0, 0, 0.12)
31
+ .elevation-z15
32
+ box-shadow: 0px 8px 9px -5px rgba(0, 0, 0, 0.2), 0px 15px 22px 2px rgba(0, 0, 0, 0.14), 0px 6px 28px 5px rgba(0, 0, 0, 0.12)
33
+ .elevation-z16
34
+ box-shadow: 0px 8px 10px -5px rgba(0, 0, 0, 0.2), 0px 16px 24px 2px rgba(0, 0, 0, 0.14), 0px 6px 30px 5px rgba(0, 0, 0, 0.12)
35
+ .elevation-z17
36
+ box-shadow: 0px 8px 11px -5px rgba(0, 0, 0, 0.2), 0px 17px 26px 2px rgba(0, 0, 0, 0.14), 0px 6px 32px 5px rgba(0, 0, 0, 0.12)
37
+ .elevation-z18
38
+ box-shadow: 0px 9px 11px -5px rgba(0, 0, 0, 0.2), 0px 18px 28px 2px rgba(0, 0, 0, 0.14), 0px 7px 34px 6px rgba(0, 0, 0, 0.12)
39
+ .elevation-z19
40
+ box-shadow: 0px 9px 12px -6px rgba(0, 0, 0, 0.2), 0px 19px 29px 2px rgba(0, 0, 0, 0.14), 0px 7px 36px 6px rgba(0, 0, 0, 0.12)
41
+ .elevation-z20
42
+ box-shadow: 0px 10px 13px -6px rgba(0, 0, 0, 0.2), 0px 20px 31px 3px rgba(0, 0, 0, 0.14), 0px 8px 38px 7px rgba(0, 0, 0, 0.12)
43
+ .elevation-z21
44
+ box-shadow: 0px 10px 13px -6px rgba(0, 0, 0, 0.2), 0px 21px 33px 3px rgba(0, 0, 0, 0.14), 0px 8px 40px 7px rgba(0, 0, 0, 0.12)
45
+ .elevation-z22
46
+ box-shadow: 0px 10px 14px -6px rgba(0, 0, 0, 0.2), 0px 22px 35px 3px rgba(0, 0, 0, 0.14), 0px 8px 42px 7px rgba(0, 0, 0, 0.12)
47
+ .elevation-z23
48
+ box-shadow: 0px 11px 14px -7px rgba(0, 0, 0, 0.2), 0px 23px 36px 3px rgba(0, 0, 0, 0.14), 0px 9px 44px 8px rgba(0, 0, 0, 0.12)
49
+ .elevation-z24
50
+ 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)
@@ -0,0 +1,63 @@
1
+ /////////////////
2
+ // Semantic.gs // for SCSS: http://sass-lang.com/
3
+ /////////////////
4
+
5
+ // Defaults which you can freely override
6
+ $column-width: 60px
7
+ $gutter-width: 20px
8
+ $columns: 12
9
+
10
+ // Utility function — you should never need to modify this
11
+ @function gridsystem-width($columns:$columns)
12
+ @return ($column-width * $columns) + ($gutter-width * $columns)
13
+
14
+
15
+ // Set $total-width to 100% for a fluid layout
16
+ $total-width: gridsystem-width($columns)
17
+
18
+ // Uncomment these two lines and the star-hack width/margin lines below to enable sub-pixel fix for IE6 & 7. See http://tylertate.com/blog/2012/01/05/subpixel-rounding.html
19
+ // $min-width: 999999
20
+ // $correction: 0.5 / $min-width * 100
21
+
22
+ // The micro clearfix http://nicolasgallagher.com/micro-clearfix-hack/
23
+ @mixin clearfix()
24
+ *zoom:1
25
+
26
+ &:before,
27
+ &:after
28
+ content:""
29
+ display:table
30
+
31
+ &:after
32
+ clear:both
33
+
34
+ //////////
35
+ // GRID //
36
+ //////////
37
+
38
+ body
39
+ width: 100%
40
+ @include clearfix()
41
+
42
+
43
+ @mixin row($columns:$columns)
44
+ display: block
45
+ width: $total-width*(($gutter-width + gridsystem-width($columns))/gridsystem-width($columns))
46
+ margin: 0 $total-width*((($gutter-width*.5)/gridsystem-width($columns))*-1)
47
+ // *width: $total-width*(($gutter-width + gridsystem-width($columns))/gridsystem-width($columns))-$correction
48
+ // *margin: 0 $total-width*((($gutter-width*.5)/gridsystem-width($columns))*-1)-$correction
49
+ @include clearfix()
50
+
51
+ @mixin column($x,$columns:$columns)
52
+ display: inline
53
+ float: left
54
+ width: $total-width*(((($gutter-width+$column-width)*$x)-$gutter-width) / gridsystem-width($columns))
55
+ margin: 0 $total-width*(($gutter-width*.5)/gridsystem-width($columns))
56
+ // *width: $total-width*(((($gutter-width+$column-width)*$x)-$gutter-width) / gridsystem-width($columns))-$correction
57
+ // *margin: 0 $total-width*(($gutter-width*.5)/gridsystem-width($columns))-$correction
58
+
59
+ @mixin push($offset:1)
60
+ margin-left: $total-width*((($gutter-width+$column-width)*$offset) / gridsystem-width($columns)) + $total-width*(($gutter-width*.5)/gridsystem-width($columns))
61
+
62
+ @mixin pull($offset:1)
63
+ margin-right: $total-width*((($gutter-width+$column-width)*$offset) / gridsystem-width($columns)) + $total-width*(($gutter-width*.5)/gridsystem-width($columns))
@@ -0,0 +1,107 @@
1
+ .material-text
2
+ &.type-display4
3
+ font-size: 7rem
4
+ font-weight: 300
5
+ letter-spacing: -0.04em
6
+ line-height: 7rem
7
+
8
+ &.type-display3
9
+ font-size: 3.5rem
10
+ font-weight: 400
11
+ letter-spacing: -0.02em
12
+ line-height: 3.5rem
13
+
14
+ &.type-display2
15
+ font-size: 2.813rem
16
+ font-weight: 400
17
+ letter-spacing: normal
18
+ line-height: 3rem
19
+
20
+ &.type-display1
21
+ font-size: 2.125rem
22
+ font-weight: 400
23
+ letter-spacing: normal
24
+ line-height: 2.5rem
25
+
26
+ &.type-headline
27
+ font-size: 1.5rem
28
+ font-weight: 400
29
+ letter-spacing: normal
30
+ line-height: 2rem
31
+
32
+ &.type-title
33
+ font-size: 1.25rem
34
+ font-weight: 500
35
+ letter-spacing: 0.02em
36
+ line-height: 2rem
37
+
38
+ &.type-subheading2
39
+ font-size: 1rem
40
+ font-weight: 400
41
+ letter-spacing: 0.04em
42
+ line-height: 1.75rem
43
+
44
+ &.type-subheading1
45
+ font-size: 0.938rem
46
+ font-weight: 400
47
+ letter-spacing: 0.04em
48
+ line-height: 1.5rem
49
+
50
+ &.type-body1
51
+ font-size: 0.875rem
52
+ font-weight: 400
53
+ letter-spacing: 0.04em
54
+ line-height: 1.25rem
55
+
56
+ &.type-body2
57
+ font-size: 0.875rem
58
+ font-weight: 500
59
+ letter-spacing: 0.04em
60
+ line-height: 1.5rem
61
+
62
+ &.type-caption
63
+ font-size: 0.75rem
64
+ font-weight: 400
65
+ letter-spacing: 0.08em
66
+ line-height: 1.25rem
67
+
68
+ &.type-button
69
+ font-size: 14px
70
+ font-weight: 500
71
+
72
+ // margin-bottom: 30px;
73
+ margin-left: 8px
74
+
75
+ &.style-adjust
76
+ &.type-display4
77
+ margin: -1rem 0 3.5rem -0.085em
78
+
79
+ &.type-display3
80
+ margin: -8px 0 64px -0.07em
81
+
82
+ &.type-display2
83
+ margin: -0.5rem 0 4rem -0.07em
84
+
85
+ &.type-display1
86
+ margin: -0.5rem 0 4rem -0.07em
87
+
88
+ &.type-headline
89
+ margin: -0.5rem 0 1rem -0.06em
90
+
91
+ &.type-title
92
+ margin: -0.5rem 0 1rem -0.05em
93
+
94
+ &.type-subheading2
95
+ margin: -0.5rem 0 1rem -0.06em
96
+
97
+ &.type-subheading1
98
+ margin: -0.313rem 0 0.813rem -0.06em
99
+
100
+ &.type-body1
101
+ margin: -0.25rem 0 0.75rem 0
102
+
103
+ &.type-body2
104
+ margin: -0.25rem 0 0.75rem 0
105
+
106
+ &.type-caption
107
+ line-height: 1.25rem
@@ -2,10 +2,16 @@
2
2
  font-size: 0.875rem
3
3
  font-weight: 500
4
4
  color: $text-on-primary
5
+ line-height: 20px
5
6
  height: 40px
7
+ display: inline-flex
8
+ align-items: center
9
+ justify-content: center
10
+ position: relative
6
11
  background-color: $color-primary
7
12
  padding-left: 24px
8
13
  padding-right: 24px
14
+ margin: 0 4px
9
15
  border-radius: 20px
10
16
  border: none
11
17
  overflow: hidden
@@ -17,10 +23,17 @@
17
23
  background-color: $color-tonal
18
24
  &.style-elevated
19
25
  background-color: $color-primary
20
- box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12)
26
+ box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 3px 0 rgba(0, 0, 0, 0.12)
27
+ &:active
28
+ box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 3px 0 rgba(0, 0, 0, 0.12)
21
29
  &.style-outlined
22
30
  color: $color-primary
23
31
  background-color: transparent
24
- border-color: 2px solid #72776C
32
+ border: 1px solid #72776C
33
+ &:hover
34
+ background-color: $color-tonal
25
35
  &.style-text
26
36
  color: $color-primary
37
+ background-color: transparent
38
+ &:hover
39
+ background-color: $color-tonal
@@ -0,0 +1,93 @@
1
+ .navigation.type-rail
2
+ flex: none
3
+ display: flex
4
+ flex-direction: column
5
+ width: 12px
6
+ background-color: #2D2F31
7
+ padding-top: 56px
8
+ margin: 0
9
+ overflow: hidden
10
+ transition: .1s linear width
11
+
12
+ &.show
13
+ width: 92px
14
+ .headmenu
15
+ display: flex
16
+ .bodymenu
17
+ display: flex
18
+ &.first
19
+ transition: none
20
+
21
+ .head
22
+ flex: none
23
+ display: none
24
+ flex-direction: column
25
+ width: 92px
26
+ height: 56px
27
+ padding: 0 0
28
+ margin: 0
29
+ .button.apps
30
+ height: 56px
31
+ width: 56px
32
+ padding: 16px 10px
33
+ margin: 0 auto
34
+ align-items: center
35
+ justify-content: center
36
+ transition: .3s linear opacity
37
+ .body
38
+ display: none
39
+ flex: 1
40
+ flex-direction: column
41
+ width: 92px
42
+ padding: 0 0
43
+ margin: 0
44
+ .item
45
+ flex: none
46
+ display: flex
47
+ flex-direction: column
48
+ height: 64px
49
+ margin: 0
50
+ border-radius: 0
51
+ text-align: center
52
+ padding: 10px 0 6px
53
+ // border-radius: 4px
54
+ font-size: 0.8rem
55
+ text-transform: none
56
+ text-align: center
57
+ // background-color: rgba(0, 0, 0, 0.3)
58
+ align-items: center
59
+ justify-content: center
60
+ &.selected, &.selected:hover
61
+ background-color: transparent
62
+ .icon
63
+ background-color: #004A77
64
+ svg
65
+ fill: #C2E8FF
66
+ i.icon
67
+ width: 60px
68
+ pointer-events: none
69
+ padding: 0
70
+ border-radius: 21px
71
+ margin: 0
72
+ height: 32px
73
+ padding: 4px 0
74
+ align-items: center
75
+ justify-content: center
76
+ svg
77
+ fill: rgba(255,255,255,.7)
78
+ label.label
79
+ pointer-events: none
80
+ align-items: center
81
+ justify-content: center
82
+ text-align: center
83
+ flex: 1
84
+ color: rgba(255, 255, 255, 1)
85
+ text-transform: capitalize
86
+ font-size: .9em
87
+ text-align: center
88
+ padding: 0
89
+ margin: 0
90
+ &:hover
91
+ background-color: transaprent
92
+ i.icon
93
+ background-color: rgba(255,255,255,.05)
@@ -0,0 +1,2 @@
1
+ .view
2
+ pointer-events: none
package/src/view.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import EventEmitter from './mixin/emitter'
2
-
3
2
  import build from './module/build'
4
3
 
5
4
  class View extends EventEmitter {
@@ -16,7 +15,7 @@ class View extends EventEmitter {
16
15
  }
17
16
 
18
17
  init (options) {
19
- this.options = Object.assign({}, defaults, options || {})
18
+ this.options = Object.assign({}, View.defaults, options || {})
20
19
  Object.assign(this, build)
21
20
  }
22
21
  }