Comparing version 5.0.0 to 5.1.0
import { name } from './name'; | ||
export function define(Ctor) { | ||
customElements.define(Ctor.is, Ctor); | ||
customElements.define(Ctor.is || name(), Ctor); | ||
return Ctor; | ||
} |
@@ -15,2 +15,14 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function defineProps(constructor) { | ||
if (!('_props' in constructor)) { | ||
var _props = constructor.props; | ||
keys(_props).forEach(function (name) { | ||
var func = _props[name]; | ||
if (typeof func !== 'function') func = prop(func); | ||
func({ constructor: constructor }, name); | ||
}); | ||
} | ||
} | ||
function delay(fn) { | ||
@@ -163,2 +175,6 @@ if (window.Promise) { | ||
get: function get() { | ||
// We have to define props here because observedAttributes are retrieved | ||
// only once when the custom element is defined. If we did this only in | ||
// the constructor, then props would not link to attributes. | ||
defineProps(this); | ||
return this._observedAttributes || []; | ||
@@ -165,0 +181,0 @@ }, |
import { name } from './name'; | ||
export function define(Ctor) { | ||
customElements.define(Ctor.is, Ctor); | ||
customElements.define(Ctor.is || name(), Ctor); | ||
return Ctor; | ||
} |
@@ -7,2 +7,13 @@ | ||
function defineProps(constructor) { | ||
if (!('_props' in constructor)) { | ||
const { props } = constructor; | ||
keys(props).forEach(name => { | ||
let func = props[name]; | ||
if (typeof func !== 'function') func = prop(func); | ||
func({ constructor }, name); | ||
}); | ||
} | ||
} | ||
function delay(fn) { | ||
@@ -66,2 +77,6 @@ if (window.Promise) { | ||
static get observedAttributes() { | ||
// We have to define props here because observedAttributes are retrieved | ||
// only once when the custom element is defined. If we did this only in | ||
// the constructor, then props would not link to attributes. | ||
defineProps(this); | ||
return this._observedAttributes || []; | ||
@@ -68,0 +83,0 @@ } |
@@ -7,5 +7,8 @@ 'use strict'; | ||
exports.define = define; | ||
var _name = require('./name'); | ||
function define(Ctor) { | ||
customElements.define(Ctor.is, Ctor); | ||
customElements.define(Ctor.is || (0, _name.name)(), Ctor); | ||
return Ctor; | ||
} |
@@ -13,2 +13,14 @@ 'use strict'; | ||
function defineProps(constructor) { | ||
if (!('_props' in constructor)) { | ||
const props = constructor.props; | ||
(0, _index.keys)(props).forEach(name => { | ||
let func = props[name]; | ||
if (typeof func !== 'function') func = prop(func); | ||
func({ constructor }, name); | ||
}); | ||
} | ||
} | ||
function delay(fn) { | ||
@@ -72,2 +84,6 @@ if (window.Promise) { | ||
static get observedAttributes() { | ||
// We have to define props here because observedAttributes are retrieved | ||
// only once when the custom element is defined. If we did this only in | ||
// the constructor, then props would not link to attributes. | ||
defineProps(this); | ||
return this._observedAttributes || []; | ||
@@ -74,0 +90,0 @@ } |
@@ -26,3 +26,3 @@ { | ||
"types": "src/index.d.ts", | ||
"version": "5.0.0" | ||
"version": "5.1.0" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
60982
46
1497