material 0.8.3 → 0.8.4

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
@@ -30,12 +30,12 @@ import Textfield from './src/textfield'
30
30
  import Toolbar from './src/toolbar'
31
31
  import Tooltip from './src/tooltip'
32
32
  import View from './src/view'
33
- import events from './src/module/events'
34
33
  import attributes from './src/module/attributes'
35
34
  import build from './src/module/build'
36
35
  import dataset from './src/module/dataset'
36
+ import device from './src/module/device'
37
37
  import display from './src/mixin/display'
38
- import events from './src/module/attach'
38
+ import events from './src/module/events'
39
39
  import emitter from './src/module/emitter'
40
40
  import jsonToHTML from './src/module/jsontohtml'
41
41
  import mediator from './src/module/mediator'
@@ -46,6 +46,6 @@ export {
46
46
  AppBar, Button, Card, Checkbox, Component, DateHour, Dialog, Drawer, Element,
47
47
  File, Form, Image, Layout, List, Loading, Menu, Navigation, Progress, Select,
48
48
  Selecter, Slider, Snackbar, Switch, Switcher, Tabs, TabView, Text, Textfield, Toolbar, Tooltip,
49
- View, events, attributes, build, dataset, display, events, emitter, jsonToHTML, mediator,
49
+ View, attributes, build, dataset, device, display, events, emitter, jsonToHTML, mediator,
50
50
  observer, smoothscroll
51
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "material",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "description": "A lightweight implementation of Material Design Components for the web - ES6",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -4,7 +4,8 @@
4
4
  const previousDevice = window.device
5
5
 
6
6
  const device = {}
7
-
7
+ const os = ['ios', 'iphone', 'ipad', 'ipod', 'android', 'blackberry', 'macos', 'windows', 'fxos', 'meego', 'television']
8
+ const type = ['mobile', 'tablet', 'desktop']
8
9
  const changeOrientationList = []
9
10
 
10
11
  // Add device as a global object.
@@ -237,7 +238,7 @@ function removeClass (className) {
237
238
  }
238
239
 
239
240
  function cleanClasses () {
240
- const classes = ['mobile', 'tablet', 'desktop', 'ios', 'iphone', 'ipad', 'ipod', 'android', 'blackberry', 'macos', 'windows', 'fxos', 'meego', 'television']
241
+ const classes = [...os, ...type]
241
242
  for (let i = 0; i < classes.length; i++) {
242
243
  removeClass(classes[i])
243
244
  }
@@ -362,20 +363,8 @@ function findMatch (arr) {
362
363
  return 'unknown'
363
364
  }
364
365
 
365
- device.type = findMatch(['mobile', 'tablet', 'desktop'])
366
- device.os = findMatch([
367
- 'ios',
368
- 'iphone',
369
- 'ipad',
370
- 'ipod',
371
- 'android',
372
- 'blackberry',
373
- 'macos',
374
- 'windows',
375
- 'fxos',
376
- 'meego',
377
- 'television'
378
- ])
366
+ device.type = findMatch(type)
367
+ device.os = findMatch(os)
379
368
 
380
369
  function setOrientationCache () {
381
370
  device.orientation = findMatch(['portrait', 'landscape'])
@@ -388,9 +377,8 @@ device.onDeviceChange = null
388
377
 
389
378
  function updateDeviceDetection () {
390
379
  userAgent = window.navigator.userAgent.toLowerCase()
391
- console.log('UA', userAgent)
392
- device.type = findMatch(['mobile', 'tablet', 'desktop'])
393
- device.os = findMatch(['ios', 'iphone', 'ipad', 'ipod', 'android', 'blackberry', 'macos', 'windows', 'fxos', 'meego', 'television'])
380
+ device.type = findMatch(type)
381
+ device.os = findMatch(os)
394
382
  setOrientationCache()
395
383
  applyClass()
396
384
  checkAndHandleDeviceChange()