material 0.9.5 → 0.9.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "material",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "A lightweight implementation of Material Design Components for the web - ES6",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/badge.js CHANGED
@@ -1,17 +1,11 @@
1
- import { Component, build, display } from '../index'
1
+ import { Component, display } from '../index'
2
2
 
3
3
  const isStringNumber = (str) => !isNaN(parseFloat(str)) && isFinite(str)
4
4
 
5
5
  class Badge extends Component {
6
6
  static defaults = {
7
7
  class: 'badge',
8
- mixins: [build, display]
9
- }
10
-
11
- constructor (options) {
12
- super(options)
13
-
14
- this.build()
8
+ mixins: [display]
15
9
  }
16
10
 
17
11
  set (text) {
@@ -7,9 +7,14 @@ import { create } from '../module/layout'
7
7
  * @param {object} instance - The component instance to build.
8
8
  */
9
9
  const build = (instance) => {
10
- const { tag = 'div', class: customClass, data, base, container, schema, icon, label, show } = instance.options
10
+ // console.log('name', instance.constructor.defaults)
11
+ const { tag = 'div', class: customClass, data, base, container, layout, icon, label, show } = instance.options
11
12
  const { defaults = {} } = instance.constructor
12
13
 
14
+ if (instance.constructor?.defaults.class === 'length') {
15
+ console.log('---', instance.constructor.defaults)
16
+ }
17
+
13
18
  instance.element = document.createElement(tag)
14
19
 
15
20
  if (defaults.base) css.add(instance.element, defaults.base)
@@ -25,8 +30,8 @@ const build = (instance) => {
25
30
 
26
31
  setupContainer(instance, base, container)
27
32
 
28
- if (schema) {
29
- setupLayout(instance, schema)
33
+ if (layout) {
34
+ setupLayout(instance, layout)
30
35
  }
31
36
 
32
37
  instance.ui = instance.ui || {}
@@ -42,9 +47,13 @@ const setupContainer = (instance, base, container) => {
42
47
  if (instance.container) instance.container.appendChild(instance.element)
43
48
  }
44
49
 
45
- const setupLayout = (instance, schema) => {
46
- instance.layout = create(schema, instance.element)
50
+ const setupLayout = (instance, layout) => {
51
+ instance.layout = create(layout, instance.element)
47
52
  instance.ui = instance.layout.component
53
+
54
+ if (instance.constructor.name === 'Length') {
55
+ console.log(instance.ui)
56
+ }
48
57
  }
49
58
 
50
59
  function buildLabel ({ ui, options, element }) {