Comparing version 5.0.0-alpha.4 to 5.0.0-alpha.5
import { customElements } from './util'; | ||
export function define(Ctor) { | ||
var is = Ctor.is; | ||
const { is } = Ctor; | ||
if (!customElements.get(is)) { | ||
@@ -7,0 +6,0 @@ customElements.define(is, Ctor); |
@@ -5,3 +5,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var defs = { | ||
const defs = { | ||
bubbles: true, | ||
@@ -14,3 +14,3 @@ cancelable: true, | ||
opts = _extends({}, defs, opts); | ||
var e = document.createEvent('CustomEvent'); | ||
const e = document.createEvent('CustomEvent'); | ||
e.initCustomEvent(name, opts.bubbles, opts.cancelable, opts.detail); | ||
@@ -17,0 +17,0 @@ defineProperty(e, 'composed', { value: opts.composed }); |
function getValue(elem) { | ||
var checked = elem.checked, | ||
type = elem.type, | ||
value = elem.value; | ||
const { checked, type, value } = elem; | ||
if (type === 'checkbox' || type === 'radio') { | ||
@@ -13,3 +10,3 @@ return checked ? value || true : false; | ||
export function link(elem, target) { | ||
return function (e) { | ||
return e => { | ||
// We fallback to checking the composed path. Unfortunately this behaviour | ||
@@ -20,13 +17,11 @@ // is difficult to impossible to reproduce as it seems to be a possible | ||
// TODO revisit once all browsers have native support. | ||
var localTarget = e.target || e.composedPath()[0]; | ||
var value = getValue(localTarget); | ||
var localTargetName = target || localTarget.name || 'value'; | ||
const localTarget = e.target || e.composedPath()[0]; | ||
const value = getValue(localTarget); | ||
const localTargetName = target || localTarget.name || 'value'; | ||
if (localTargetName.indexOf('.') > -1) { | ||
var parts = localTargetName.split('.'); | ||
var firstPart = parts[0]; | ||
var propName = parts.pop(); | ||
var obj = parts.reduce(function (prev, curr) { | ||
return prev && prev[curr]; | ||
}, elem); | ||
const parts = localTargetName.split('.'); | ||
const firstPart = parts[0]; | ||
const propName = parts.pop(); | ||
const obj = parts.reduce((prev, curr) => prev && prev[curr], elem); | ||
@@ -33,0 +28,0 @@ obj[propName || e.target.name] = value; |
@@ -1,21 +0,24 @@ | ||
export var root = typeof window === 'undefined' ? global : window; | ||
var customElements = root.customElements; | ||
var _root$HTMLElement = root.HTMLElement; | ||
var HTMLElement = _root$HTMLElement === undefined ? null : _root$HTMLElement, | ||
MutationObserver = root.MutationObserver; | ||
export { customElements, MutationObserver, HTMLElement }; | ||
var _root$Object = root.Object; | ||
var defineProperty = _root$Object.defineProperty, | ||
defineProperties = _root$Object.defineProperties, | ||
getOwnPropertyNames = _root$Object.getOwnPropertyNames, | ||
getOwnPropertySymbols = _root$Object.getOwnPropertySymbols, | ||
freeze = _root$Object.freeze; | ||
export { defineProperty, defineProperties, getOwnPropertyNames, getOwnPropertySymbols, freeze }; | ||
export const root = typeof window === 'undefined' ? global : window; | ||
export const { customElements, HTMLElement = null, MutationObserver: RealMutationObserver } = root; | ||
export const { defineProperty, defineProperties, getOwnPropertyNames, getOwnPropertySymbols, freeze } = root.Object; | ||
function FakeMutationObserver(func) { | ||
this.func = func; | ||
} | ||
FakeMutationObserver.prototype.observe = function (node) { | ||
const { func } = this; | ||
defineProperty(node, 'textContent', { | ||
set() { | ||
setTimeout(func); | ||
} | ||
}); | ||
}; | ||
const MutationObserver = RealMutationObserver || FakeMutationObserver; | ||
export function dashCase(str) { | ||
return str.split(/([_A-Z])/).reduce(function (one, two, idx) { | ||
var dash = !one || idx % 2 === 0 ? '' : '-'; | ||
return str.split(/([_A-Z])/).reduce((one, two, idx) => { | ||
const dash = !one || idx % 2 === 0 ? '' : '-'; | ||
two = two === '_' ? '' : two; | ||
return '' + one + dash + two.toLowerCase(); | ||
return `${one}${dash}${two.toLowerCase()}`; | ||
}); | ||
@@ -25,8 +28,8 @@ } | ||
export function debounce(cbFunc) { | ||
var scheduled = false; | ||
var i = 0; | ||
var cbArgs = []; | ||
var elem = document.createElement('span'); | ||
var observer = new MutationObserver(function () { | ||
cbFunc.apply(undefined, cbArgs); | ||
let scheduled = false; | ||
let i = 0; | ||
let cbArgs = []; | ||
const elem = document.createElement('span'); | ||
const observer = new MutationObserver(() => { | ||
cbFunc(...cbArgs); | ||
scheduled = false; | ||
@@ -38,11 +41,7 @@ cbArgs = null; | ||
return function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return (...args) => { | ||
cbArgs = args; | ||
if (!scheduled) { | ||
scheduled = true; | ||
elem.textContent = '' + i; | ||
elem.textContent = `${i}`; | ||
i += 1; | ||
@@ -53,10 +52,6 @@ } | ||
export var empty = function empty(val) { | ||
return val == null; | ||
}; | ||
export const empty = val => val == null; | ||
export function keys() { | ||
var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var names = getOwnPropertyNames(obj); | ||
export function keys(obj = {}) { | ||
const names = getOwnPropertyNames(obj); | ||
return getOwnPropertySymbols ? names.concat(getOwnPropertySymbols(obj)) : names; | ||
@@ -70,7 +65,7 @@ } | ||
export function uniqueId(description) { | ||
return (description ? String(description) : '') + 'xxxxxxxx'.replace(/[xy]/g, function (c) { | ||
var r = Math.random() * 16 | 0; | ||
var v = c === 'x' ? r : r & 0x3 | 0x8; | ||
return (description ? String(description) : '') + 'xxxxxxxx'.replace(/[xy]/g, c => { | ||
const r = Math.random() * 16 | 0; | ||
const v = c === 'x' ? r : r & 0x3 | 0x8; | ||
return v.toString(16); | ||
}); | ||
} |
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
import { dashCase, defineProperties, keys, sym } from '.'; | ||
var _definedProps = sym('_definedProps'); | ||
var _normPropDef = sym('_normPropDef'); | ||
var _syncingAttributeToProperty = sym('_syncingAttributeToProperty'); | ||
var _syncingPropertyToAttribute = sym('_syncingPropertyToAttribute'); | ||
const _definedProps = sym('_definedProps'); | ||
const _normPropDef = sym('_normPropDef'); | ||
const _syncingAttributeToProperty = sym('_syncingAttributeToProperty'); | ||
const _syncingPropertyToAttribute = sym('_syncingPropertyToAttribute'); | ||
export var _updateDebounced = sym('_updateDebounced'); | ||
export const _updateDebounced = sym('_updateDebounced'); | ||
@@ -20,21 +18,15 @@ export function defineProps(Ctor) { | ||
var prototype = Ctor.prototype; | ||
const { prototype } = Ctor; | ||
const props = normPropDefs(Ctor); | ||
var props = normPropDefs(Ctor); | ||
defineProperties(prototype, keys(props).reduce(function (prev, curr) { | ||
var _props$curr = props[curr], | ||
target = _props$curr.attribute.target, | ||
coerce = _props$curr.coerce, | ||
def = _props$curr.default, | ||
serialize = _props$curr.serialize; | ||
var _value = sym(curr); | ||
defineProperties(prototype, keys(props).reduce((prev, curr) => { | ||
const { attribute: { target }, coerce, default: def, serialize } = props[curr]; | ||
const _value = sym(curr); | ||
prev[curr] = { | ||
configurable: true, | ||
get: function get() { | ||
var val = this[_value]; | ||
get() { | ||
const val = this[_value]; | ||
return val == null ? def : val; | ||
}, | ||
set: function set(val) { | ||
set(val) { | ||
this[_value] = coerce(val); | ||
@@ -50,5 +42,4 @@ syncPropertyToAttribute(this, target, serialize, val); | ||
export function normAttribute(name, prop) { | ||
var attribute = prop.attribute; | ||
var obj = (typeof attribute === 'undefined' ? 'undefined' : _typeof(attribute)) === 'object' ? _extends({}, attribute) : { | ||
const { attribute } = prop; | ||
const obj = typeof attribute === 'object' ? _extends({}, attribute) : { | ||
source: attribute, | ||
@@ -67,19 +58,9 @@ target: attribute | ||
export function normPropDef(name, prop) { | ||
var coerce = prop.coerce, | ||
def = prop.default, | ||
deserialize = prop.deserialize, | ||
serialize = prop.serialize; | ||
const { coerce, default: def, deserialize, serialize } = prop; | ||
return { | ||
attribute: normAttribute(name, prop), | ||
coerce: coerce || function (v) { | ||
return v; | ||
}, | ||
coerce: coerce || (v => v), | ||
default: def, | ||
deserialize: deserialize || function (v) { | ||
return v; | ||
}, | ||
serialize: serialize || function (v) { | ||
return v; | ||
} | ||
deserialize: deserialize || (v => v), | ||
serialize: serialize || (v => v) | ||
}; | ||
@@ -89,3 +70,3 @@ } | ||
export function normPropDefs(Ctor) { | ||
return Ctor[_normPropDef] || (Ctor[_normPropDef] = keys(Ctor.props).reduce(function (prev, curr) { | ||
return Ctor[_normPropDef] || (Ctor[_normPropDef] = keys(Ctor.props).reduce((prev, curr) => { | ||
prev[curr] = normPropDef(curr, Ctor.props[curr] || {}); | ||
@@ -100,8 +81,5 @@ return prev; | ||
} | ||
var propDefs = normPropDefs(elem.constructor); | ||
for (var propName in propDefs) { | ||
var _propDefs$propName = propDefs[propName], | ||
source = _propDefs$propName.attribute.source, | ||
deserialize = _propDefs$propName.deserialize; | ||
const propDefs = normPropDefs(elem.constructor); | ||
for (let propName in propDefs) { | ||
const { attribute: { source }, deserialize } = propDefs[propName]; | ||
if (source === name) { | ||
@@ -117,3 +95,3 @@ elem[_syncingAttributeToProperty] = propName; | ||
if (target && elem[_syncingAttributeToProperty] !== target) { | ||
var serialized = serialize(val); | ||
const serialized = serialize(val); | ||
elem[_syncingPropertyToAttribute] = true; | ||
@@ -120,0 +98,0 @@ if (serialized == null) { |
import { customElements, dashCase } from '.'; | ||
var suffix = 0; | ||
let suffix = 0; | ||
export function formatName(prefix, suffix) { | ||
prefix = prefix || 'element'; | ||
return (prefix.indexOf('-') === -1 ? 'x-' + prefix : prefix) + (suffix ? '-' + suffix : ''); | ||
return (prefix.indexOf('-') === -1 ? `x-${prefix}` : prefix) + (suffix ? `-${suffix}` : ''); | ||
} | ||
export function generateName(Ctor) { | ||
var prefix = dashCase(Ctor.name); | ||
const prefix = dashCase(Ctor.name); | ||
while (customElements.get(formatName(prefix, suffix))) { | ||
@@ -13,0 +13,0 @@ suffix++; |
@@ -1,7 +0,1 @@ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
import { h, render } from 'preact'; | ||
@@ -14,24 +8,11 @@ | ||
var _preactDom = sym('_preactDom'); | ||
const _preactDom = sym('_preactDom'); | ||
export var withComponent = function withComponent() { | ||
var Base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : HTMLElement; | ||
return function (_withUnique) { | ||
_inherits(_class, _withUnique); | ||
function _class() { | ||
_classCallCheck(this, _class); | ||
return _possibleConstructorReturn(this, _withUnique.apply(this, arguments)); | ||
} | ||
_class.prototype.rendererCallback = function rendererCallback(shadowRoot, renderCallback) { | ||
this[_preactDom] = render(renderCallback(), shadowRoot, this[_preactDom]); | ||
}; | ||
return _class; | ||
}(withUnique(withRender(withProps(Base)))); | ||
export const withComponent = (Base = HTMLElement) => class extends withUnique(withRender(withProps(Base))) { | ||
rendererCallback(shadowRoot, renderCallback) { | ||
this[_preactDom] = render(renderCallback(), shadowRoot, this[_preactDom]); | ||
} | ||
}; | ||
export var Component = withComponent(); | ||
export const Component = withComponent(); | ||
export { h }; |
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
import { debounce, empty, freeze, HTMLElement, keys, sym } from './util'; | ||
@@ -17,64 +9,47 @@ import { _updateDebounced, defineProps, normPropDefs, syncAttributeToProperty } from './util/with-props'; | ||
// more than once for a given state. | ||
var _connected = sym('_connected'); | ||
var _constructed = sym('_constructed'); | ||
const _connected = sym('_connected'); | ||
const _constructed = sym('_constructed'); | ||
var _observedAttributes = sym('_observedAttributes'); | ||
var _prevProps = sym('_prevProps'); | ||
var _props = sym('_props'); | ||
var _updateCallback = sym('_updateCallback'); | ||
var _updating = sym('_updating'); | ||
const _observedAttributes = sym('_observedAttributes'); | ||
const _prevProps = sym('_prevProps'); | ||
const _props = sym('_props'); | ||
const _updateCallback = sym('_updateCallback'); | ||
const _updating = sym('_updating'); | ||
export var withProps = function withProps() { | ||
var Base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : HTMLElement; | ||
return function (_Base) { | ||
_inherits(_class2, _Base); | ||
export const withProps = (Base = HTMLElement) => { | ||
return class extends Base { | ||
static get observedAttributes() { | ||
const props = normPropDefs(this); | ||
return keys(props).map(k => props[k].attribute).filter(Boolean).map(a => a.source).concat(this[_observedAttributes] || []); | ||
} | ||
_createClass(_class2, [{ | ||
key: 'props', | ||
get: function get() { | ||
var _this2 = this; | ||
static set observedAttributes(attrs) { | ||
this[_observedAttributes] = attrs; | ||
} | ||
return keys(this.constructor.props).reduce(function (prev, curr) { | ||
prev[curr] = _this2[curr]; | ||
return prev; | ||
}, {}); | ||
}, | ||
set: function set(props) { | ||
var _this3 = this; | ||
static get props() { | ||
return this[_props]; | ||
} | ||
var ctorProps = this.constructor.props; | ||
keys(props).forEach(function (k) { | ||
return k in ctorProps && (_this3[k] = props[k]); | ||
}); | ||
} | ||
}], [{ | ||
key: 'observedAttributes', | ||
get: function get() { | ||
var props = normPropDefs(this); | ||
return keys(props).map(function (k) { | ||
return props[k].attribute; | ||
}).filter(Boolean).map(function (a) { | ||
return a.source; | ||
}).concat(this[_observedAttributes] || []); | ||
}, | ||
set: function set(attrs) { | ||
this[_observedAttributes] = attrs; | ||
} | ||
}, { | ||
key: 'props', | ||
get: function get() { | ||
return this[_props]; | ||
}, | ||
set: function set(props) { | ||
this[_props] = props; | ||
} | ||
}]); | ||
static set props(props) { | ||
this[_props] = props; | ||
} | ||
function _class2() { | ||
_classCallCheck(this, _class2); | ||
get props() { | ||
return keys(this.constructor.props).reduce((prev, curr) => { | ||
prev[curr] = this[curr]; | ||
return prev; | ||
}, {}); | ||
} | ||
var _this = _possibleConstructorReturn(this, _Base.call(this)); | ||
set props(props) { | ||
const ctorProps = this.constructor.props; | ||
keys(props).forEach(k => k in ctorProps && (this[k] = props[k])); | ||
} | ||
_this[_updateCallback] = function () { | ||
if (_this[_updating] || !_this[_connected]) { | ||
constructor() { | ||
super(); | ||
this[_updateCallback] = () => { | ||
if (this[_updating] || !this[_connected]) { | ||
return; | ||
@@ -85,68 +60,55 @@ } | ||
// queueing a render - while there is a pending render. | ||
_this[_updating] = true; | ||
this[_updating] = true; | ||
// Prev / next props for prop lifecycle callbacks. | ||
var prev = _this[_prevProps]; | ||
var next = _this[_prevProps] = _this.props; | ||
const prev = this[_prevProps]; | ||
const next = this[_prevProps] = this.props; | ||
// Always call set, but only call changed if the props updated. | ||
_this.propsSetCallback(next, prev); | ||
if (_this.propsUpdatedCallback(next, prev)) { | ||
_this.propsChangedCallback(next, prev); | ||
this.propsSetCallback(next, prev); | ||
if (this.propsUpdatedCallback(next, prev)) { | ||
this.propsChangedCallback(next, prev); | ||
} | ||
_this[_updating] = false; | ||
this[_updating] = false; | ||
}; | ||
if (_this[_constructed]) return _possibleConstructorReturn(_this); | ||
_this[_constructed] = true; | ||
var constructor = _this.constructor; | ||
if (this[_constructed]) return; | ||
this[_constructed] = true; | ||
const { constructor } = this; | ||
defineProps(constructor); | ||
_this[_updateDebounced] = debounce(_this[_updateCallback]); | ||
return _this; | ||
this[_updateDebounced] = debounce(this[_updateCallback]); | ||
} | ||
_class2.prototype.connectedCallback = function connectedCallback() { | ||
connectedCallback() { | ||
if (this[_connected]) return; | ||
this[_connected] = true; | ||
if (_Base.prototype.connectedCallback) _Base.prototype.connectedCallback.call(this); | ||
if (super.connectedCallback) super.connectedCallback(); | ||
this[_updateDebounced](); | ||
}; | ||
} | ||
_class2.prototype.disconnectedCallback = function disconnectedCallback() { | ||
disconnectedCallback() { | ||
if (!this[_connected]) return; | ||
this[_connected] = false; | ||
if (_Base.prototype.disconnectedCallback) _Base.prototype.disconnectedCallback.call(this); | ||
}; | ||
if (super.disconnectedCallback) super.disconnectedCallback(); | ||
} | ||
// Called when props actually change. | ||
propsChangedCallback() {} | ||
_class2.prototype.propsChangedCallback = function propsChangedCallback() {}; | ||
// Called whenever props are set, even if they don't change. | ||
propsSetCallback() {} | ||
_class2.prototype.propsSetCallback = function propsSetCallback() {}; | ||
// Called to see if the props changed. | ||
propsUpdatedCallback(next, prev) { | ||
return !prev || keys(prev).some(k => prev[k] !== next[k]); | ||
} | ||
_class2.prototype.propsUpdatedCallback = function propsUpdatedCallback(next, prev) { | ||
return !prev || keys(prev).some(function (k) { | ||
return prev[k] !== next[k]; | ||
}); | ||
}; | ||
_class2.prototype.attributeChangedCallback = function attributeChangedCallback(name, oldValue, newValue) { | ||
if (_Base.prototype.attributeChangedCallback) _Base.prototype.attributeChangedCallback.call(this, name, oldValue, newValue); | ||
attributeChangedCallback(name, oldValue, newValue) { | ||
if (super.attributeChangedCallback) super.attributeChangedCallback(name, oldValue, newValue); | ||
syncAttributeToProperty(this, name, newValue); | ||
}; | ||
} | ||
// Invokes the complete render lifecycle. | ||
return _class2; | ||
}(Base); | ||
}; | ||
}; | ||
@@ -156,22 +118,10 @@ | ||
var parse = JSON.parse, | ||
stringify = JSON.stringify; | ||
const { parse, stringify } = JSON; | ||
const attribute = freeze({ source: true }); | ||
const createProp = obj => freeze(_extends({ attribute }, obj)); | ||
const nullOrType = type => val => empty(val) ? null : type(val); | ||
const zeroOrNumber = val => empty(val) ? 0 : Number(val); | ||
var attribute = freeze({ source: true }); | ||
var createProp = function createProp(obj) { | ||
return freeze(_extends({ attribute: attribute }, obj)); | ||
}; | ||
var nullOrType = function nullOrType(type) { | ||
return function (val) { | ||
return empty(val) ? null : type(val); | ||
}; | ||
}; | ||
var zeroOrNumber = function zeroOrNumber(val) { | ||
return empty(val) ? 0 : Number(val); | ||
}; | ||
var array = createProp({ | ||
coerce: function coerce(val) { | ||
return Array.isArray(val) ? val : empty(val) ? null : [val]; | ||
}, | ||
const array = createProp({ | ||
coerce: val => Array.isArray(val) ? val : empty(val) ? null : [val], | ||
default: freeze([]), | ||
@@ -182,14 +132,10 @@ deserialize: parse, | ||
var boolean = createProp({ | ||
const boolean = createProp({ | ||
coerce: Boolean, | ||
default: false, | ||
deserialize: function deserialize(val) { | ||
return !empty(val); | ||
}, | ||
serialize: function serialize(val) { | ||
return val ? '' : null; | ||
} | ||
deserialize: val => !empty(val), | ||
serialize: val => val ? '' : null | ||
}); | ||
var number = createProp({ | ||
const number = createProp({ | ||
default: 0, | ||
@@ -201,3 +147,3 @@ coerce: zeroOrNumber, | ||
var object = createProp({ | ||
const object = createProp({ | ||
default: freeze({}), | ||
@@ -208,3 +154,3 @@ deserialize: parse, | ||
var string = createProp({ | ||
const string = createProp({ | ||
default: '', | ||
@@ -215,8 +161,8 @@ coerce: String, | ||
export var props = { | ||
array: array, | ||
boolean: boolean, | ||
number: number, | ||
object: object, | ||
string: string | ||
export const props = { | ||
array, | ||
boolean, | ||
number, | ||
object, | ||
string | ||
}; |
@@ -1,14 +0,6 @@ | ||
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
import { HTMLElement, sym } from './util'; | ||
var _shadowRoot = sym(); | ||
const _shadowRoot = sym(); | ||
var attachShadowOptions = { mode: 'open' }; | ||
const attachShadowOptions = { mode: 'open' }; | ||
@@ -19,42 +11,18 @@ function attachShadow(elem) { | ||
export var withRender = function withRender() { | ||
var Base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : HTMLElement; | ||
return function (_Base) { | ||
_inherits(_class, _Base); | ||
export const withRender = (Base = HTMLElement) => class extends Base { | ||
get renderRoot() { | ||
this[_shadowRoot] = this[_shadowRoot] || (this[_shadowRoot] = this.shadowRoot || attachShadow(this)); | ||
return this[_shadowRoot]; | ||
} | ||
function _class() { | ||
_classCallCheck(this, _class); | ||
propsChangedCallback() { | ||
this.rendererCallback(this.renderRoot, () => this.renderCallback(this)); | ||
this.renderedCallback(); | ||
} | ||
return _possibleConstructorReturn(this, _Base.apply(this, arguments)); | ||
} | ||
// Called to render the component. | ||
renderCallback() {} | ||
_class.prototype.propsChangedCallback = function propsChangedCallback() { | ||
var _this2 = this; | ||
this.rendererCallback(this.renderRoot, function () { | ||
return _this2.renderCallback(_this2); | ||
}); | ||
this.renderedCallback(); | ||
}; | ||
// Called to render the component. | ||
_class.prototype.renderCallback = function renderCallback() {}; | ||
// Called after the component has rendered. | ||
_class.prototype.renderedCallback = function renderedCallback() {}; | ||
_createClass(_class, [{ | ||
key: 'renderRoot', | ||
get: function get() { | ||
this[_shadowRoot] = this[_shadowRoot] || (this[_shadowRoot] = this.shadowRoot || attachShadow(this)); | ||
return this[_shadowRoot]; | ||
} | ||
}]); | ||
return _class; | ||
}(Base); | ||
// Called after the component has rendered. | ||
renderedCallback() {} | ||
}; |
@@ -1,37 +0,13 @@ | ||
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
import { HTMLElement, sym } from './util'; | ||
import { generateName } from './util/with-unique'; | ||
var _is = sym('_is'); | ||
const _is = sym('_is'); | ||
export var withUnique = function withUnique() { | ||
var Base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : HTMLElement; | ||
return function (_Base) { | ||
_inherits(_class, _Base); | ||
function _class() { | ||
_classCallCheck(this, _class); | ||
return _possibleConstructorReturn(this, _Base.apply(this, arguments)); | ||
} | ||
_createClass(_class, null, [{ | ||
key: 'is', | ||
get: function get() { | ||
return this[_is] || (this[_is] = generateName(this)); | ||
}, | ||
set: function set(is) { | ||
this[_is] = is; | ||
} | ||
}]); | ||
return _class; | ||
}(Base); | ||
export const withUnique = (Base = HTMLElement) => class extends Base { | ||
static get is() { | ||
return this[_is] || (this[_is] = generateName(this)); | ||
} | ||
static set is(is) { | ||
this[_is] = is; | ||
} | ||
}; |
{ | ||
"name": "skatejs", | ||
"version": "5.0.0-alpha.4", | ||
"version": "5.0.0-alpha.5", | ||
"description": "Skate is a library built on top of the W3C web component specs that enables you to write functional and performant web components with a very small footprint.", | ||
@@ -12,3 +12,2 @@ "license": "MIT", | ||
"main": "umd/skatejs.js", | ||
"module": "es/index.js", | ||
"types": "src/index.d.ts", | ||
@@ -32,18 +31,24 @@ "keywords": [ | ||
"devDependencies": { | ||
"@skatejs/web-components": "^1.0.0", | ||
"@treshugart/nwb": "^0.17.1", | ||
"babel-eslint": "^7.1.1", | ||
"bore": "^1.1.0", | ||
"commitizen": "^2.8.2", | ||
"@skatejs/web-components": "1.0.0", | ||
"@treshugart/nwb": "0.17.1", | ||
"babel-cli": "6.24.1", | ||
"babel-eslint": "7.2.1", | ||
"babel-preset-es2016": "6.24.1", | ||
"babel-preset-es2017": "6.24.1", | ||
"babel-preset-stage-0": "6.24.1", | ||
"bore": "1.1.0", | ||
"commitizen": "2.9.6", | ||
"cz-conventional-changelog": "2.0.0", | ||
"gitbook-cli": "^2.3.0", | ||
"gitbook-cli": "2.3.0", | ||
"husky": "0.13.3", | ||
"karma-chrome-launcher": "2.0.0", | ||
"karma-sauce-launcher": "^1.1.0", | ||
"karma-sauce-launcher": "1.1.0", | ||
"preact": "*", | ||
"semantic-release": "^6.3.2", | ||
"semistandard": "^9.0.0", | ||
"typescript": "^2.1.4", | ||
"typescript-formatter": "^5.0.0", | ||
"webpack-node-externals": "^1.6.0", | ||
"yargs": "^8.0.1" | ||
"semantic-release": "6.3.2", | ||
"semistandard": "10.0.0", | ||
"typescript": "2.2.2", | ||
"typescript-formatter": "5.1.2", | ||
"validate-commit-msg": "2.12.1", | ||
"webpack-node-externals": "1.6.0", | ||
"yargs": "8.0.1" | ||
}, | ||
@@ -56,8 +61,22 @@ "peerDependencies": { | ||
"docs:watch": "gitbook install && gitbook serve", | ||
"prepublish": "nwb build", | ||
"prepublish": "nwb build && babel src --out-dir es --presets=stage-0,es2017,es2016", | ||
"prerelease": "npm version prerelease && git push && git push --tags && npm publish", | ||
"release": "semantic-release pre && npm publish && semantic-release post", | ||
"test": "node umd/skatejs.js && semistandard && npm run test:ts && nwb test -- --ci", | ||
"test:ts": "tsfmt -r && tsc -p ./", | ||
"test:watch": "nwb test --server" | ||
"pretest": "npm run style && npm run test:node && npm run test:ts", | ||
"test": "nwb test", | ||
"test:watch": "npm test -- --server", | ||
"test:coverage": "npm test -- --coverage", | ||
"test:ci": "npm test -- --ci", | ||
"test:node": "node umd/skatejs.js", | ||
"test:ts": "tsc -p ./", | ||
"style": "npm run style:ts && npm run style:js", | ||
"style:fix": "npm run style:ts:fix && npm run style:js:fix", | ||
"style:ts": "tsfmt --verify", | ||
"style:ts:fix": "tsfmt -r", | ||
"style:js": "semistandard", | ||
"style:js:fix": "semistandard --fix", | ||
"verify": "npm run style && npm test", | ||
"commit": "git-cz", | ||
"commitmsg": "validate-commit-msg", | ||
"prepush": "npm run verify" | ||
}, | ||
@@ -64,0 +83,0 @@ "config": { |
export const root = typeof window === 'undefined' ? global : window; | ||
export const { customElements, HTMLElement = null, MutationObserver } = root; | ||
export const { customElements, HTMLElement = null, MutationObserver: RealMutationObserver } = root; | ||
export const { defineProperty, defineProperties, getOwnPropertyNames, getOwnPropertySymbols, freeze } = root.Object; | ||
function FakeMutationObserver (func) { | ||
this.func = func; | ||
} | ||
FakeMutationObserver.prototype.observe = function (node) { | ||
const { func } = this; | ||
defineProperty(node, 'textContent', { | ||
set () { setTimeout(func); } | ||
}); | ||
}; | ||
const MutationObserver = RealMutationObserver || FakeMutationObserver; | ||
export function dashCase (str) { | ||
@@ -6,0 +18,0 @@ return str.split(/([_A-Z])/).reduce((one, two, idx) => { |
/*! | ||
* skatejs v5.0.0-alpha.4 | ||
* skatejs v5.0.0-alpha.5 | ||
* MIT Licensed | ||
@@ -90,3 +90,3 @@ */ | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return customElements; }); | ||
/* unused harmony export MutationObserver */ | ||
/* unused harmony export RealMutationObserver */ | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return HTMLElement; }); | ||
@@ -108,3 +108,3 @@ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return defineProperty; }); | ||
var HTMLElement = _root$HTMLElement === undefined ? null : _root$HTMLElement, | ||
MutationObserver = root.MutationObserver; | ||
RealMutationObserver = root.MutationObserver; | ||
@@ -120,2 +120,17 @@ var _root$Object = root.Object; | ||
function FakeMutationObserver(func) { | ||
this.func = func; | ||
} | ||
FakeMutationObserver.prototype.observe = function (node) { | ||
var func = this.func; | ||
defineProperty(node, 'textContent', { | ||
set: function set() { | ||
setTimeout(func); | ||
} | ||
}); | ||
}; | ||
var MutationObserver = RealMutationObserver || FakeMutationObserver; | ||
function dashCase(str) { | ||
@@ -122,0 +137,0 @@ return str.split(/([_A-Z])/).reduce(function (one, two, idx) { |
/*! | ||
* skatejs v5.0.0-alpha.4 | ||
* skatejs v5.0.0-alpha.5 | ||
* MIT Licensed | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("preact")):"function"==typeof define&&define.amd?define(["preact"],e):"object"==typeof exports?exports.skate=e(require("preact")):t.skate=e(t.preact)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=13)}([function(t,e,n){"use strict";(function(t){function r(t){return t.split(/([_A-Z])/).reduce(function(t,e,n){var r=t&&n%2!=0?"-":"";return e="_"===e?"":e,""+t+r+e.toLowerCase()})}function o(t){var e=!1,n=0,r=[],o=document.createElement("span");return new p(function(){t.apply(void 0,r),e=!1,r=null}).observe(o,{childList:!0}),function(){for(var t=arguments.length,i=Array(t),u=0;u<t;u++)i[u]=arguments[u];r=i,e||(e=!0,o.textContent=""+n,n+=1)}}function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=y(t);return v?e.concat(v(t)):e}function u(t){return"function"==typeof Symbol?Symbol(t?String(t):void 0):c(t)}function c(t){return(t?String(t):"")+"xxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}n.d(e,"d",function(){return f}),n.d(e,"b",function(){return l}),n.d(e,"j",function(){return b}),n.d(e,"i",function(){return h}),n.d(e,"g",function(){return g}),e.c=r,e.f=o,n.d(e,"h",function(){return m}),e.e=i,e.a=u;var a="undefined"==typeof window?t:window,f=a.customElements,s=a.HTMLElement,l=void 0===s?null:s,p=a.MutationObserver,d=a.Object,b=d.defineProperty,h=d.defineProperties,y=d.getOwnPropertyNames,v=d.getOwnPropertySymbols,g=d.freeze,m=function(t){return null==t}}).call(e,n(11))},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=n(0),c=n(8);n.d(e,"a",function(){return v}),n.d(e,"b",function(){return E});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},f=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=n.i(u.a)("_connected"),l=n.i(u.a)("_constructed"),p=n.i(u.a)("_observedAttributes"),d=n.i(u.a)("_prevProps"),b=n.i(u.a)("_props"),h=n.i(u.a)("_updateCallback"),y=n.i(u.a)("_updating"),v=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.b;return function(t){function e(){r(this,e);var i=o(this,t.call(this));if(i[h]=function(){if(!i[y]&&i[s]){i[y]=!0;var t=i[d],e=i[d]=i.props;i.propsSetCallback(e,t),i.propsUpdatedCallback(e,t)&&i.propsChangedCallback(e,t),i[y]=!1}},i[l])return o(i);i[l]=!0;var a=i.constructor;return n.i(c.b)(a),i[c.c]=n.i(u.f)(i[h]),i}return i(e,t),f(e,[{key:"props",get:function(){var t=this;return n.i(u.e)(this.constructor.props).reduce(function(e,n){return e[n]=t[n],e},{})},set:function(t){var e=this,r=this.constructor.props;n.i(u.e)(t).forEach(function(n){return n in r&&(e[n]=t[n])})}}],[{key:"observedAttributes",get:function(){var t=n.i(c.a)(this);return n.i(u.e)(t).map(function(e){return t[e].attribute}).filter(Boolean).map(function(t){return t.source}).concat(this[p]||[])},set:function(t){this[p]=t}},{key:"props",get:function(){return this[b]},set:function(t){this[b]=t}}]),e.prototype.connectedCallback=function(){this[s]||(this[s]=!0,t.prototype.connectedCallback&&t.prototype.connectedCallback.call(this),this[c.c]())},e.prototype.disconnectedCallback=function(){this[s]&&(this[s]=!1,t.prototype.disconnectedCallback&&t.prototype.disconnectedCallback.call(this))},e.prototype.propsChangedCallback=function(){},e.prototype.propsSetCallback=function(){},e.prototype.propsUpdatedCallback=function(t,e){return!e||n.i(u.e)(e).some(function(n){return e[n]!==t[n]})},e.prototype.attributeChangedCallback=function(e,r,o){t.prototype.attributeChangedCallback&&t.prototype.attributeChangedCallback.call(this,e,r,o),n.i(c.d)(this,e,o)},e}(t)},g=JSON.parse,m=JSON.stringify,w=n.i(u.g)({source:!0}),O=function(t){return n.i(u.g)(a({attribute:w},t))},C=function(t){return function(e){return n.i(u.h)(e)?null:t(e)}},j=function(t){return n.i(u.h)(t)?0:Number(t)},k=O({coerce:function(t){return Array.isArray(t)?t:n.i(u.h)(t)?null:[t]},default:n.i(u.g)([]),deserialize:g,serialize:m}),_=O({coerce:Boolean,default:!1,deserialize:function(t){return!n.i(u.h)(t)},serialize:function(t){return t?"":null}}),x=O({default:0,coerce:j,deserialize:j,serialize:C(Number)}),P=O({default:n.i(u.g)({}),deserialize:g,serialize:m}),S=O({default:"",coerce:String,serialize:C(String)}),E={array:k,boolean:_,number:x,object:P,string:S}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t){return t.attachShadow?t.attachShadow(s):t}var c=n(0);n.d(e,"a",function(){return l});var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),f=n.i(c.a)(),s={mode:"open"},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.b;return function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.propsChangedCallback=function(){var t=this;this.rendererCallback(this.renderRoot,function(){return t.renderCallback(t)}),this.renderedCallback()},e.prototype.renderCallback=function(){},e.prototype.renderedCallback=function(){},a(e,[{key:"renderRoot",get:function(){return this[f]=this[f]||(this[f]=this.shadowRoot||u(this)),this[f]}}]),e}(t)}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=n(0),c=n(9);n.d(e,"a",function(){return s});var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),f=n.i(u.a)("_is"),s=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.b;return function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),a(e,null,[{key:"is",get:function(){return this[f]||(this[f]=n.i(c.a)(this))},set:function(t){this[f]=t}}]),e}(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(5);n.d(e,"define",function(){return r.a});var o=n(6);n.d(e,"emit",function(){return o.a});var i=n(7);n.d(e,"link",function(){return i.a});var u=n(10);n.d(e,"withComponent",function(){return u.a}),n.d(e,"Component",function(){return u.b}),n.d(e,"h",function(){return u.c});var c=n(1);n.d(e,"withProps",function(){return c.a}),n.d(e,"props",function(){return c.b});var a=n(2);n.d(e,"withRender",function(){return a.a});var f=n(3);n.d(e,"withUnique",function(){return f.a})},function(t,e,n){"use strict";function r(t){var e=t.is;return o.d.get(e)||o.d.define(e,t),t}var o=n(0);e.a=r},function(t,e,n){"use strict";function r(t,e,r){r=i({},u,r);var c=document.createEvent("CustomEvent");return c.initCustomEvent(e,r.bubbles,r.cancelable,r.detail),n.i(o.j)(c,"composed",{value:r.composed}),t.dispatchEvent(c)}var o=n(0);e.a=r;var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u={bubbles:!0,cancelable:!0,composed:!1}},function(t,e,n){"use strict";function r(t){var e=t.checked,n=t.type,r=t.value;return"checkbox"===n||"radio"===n?!!e&&(r||!0):r}function o(t,e){return function(n){var o=n.target||n.composedPath()[0],i=r(o),u=e||o.name||"value";if(u.indexOf(".")>-1){var c=u.split("."),a=c[0],f=c.pop();c.reduce(function(t,e){return t&&t[e]},t)[f||n.target.name]=i,t[a]=t[a]}else t[u]=i}}e.a=o},function(t,e,n){"use strict";function r(t){if(!t[p]){t[p]=!0;var e=t.prototype,r=u(t);n.i(f.i)(e,n.i(f.e)(r).reduce(function(t,e){var o=r[e],i=o.attribute.target,u=o.coerce,c=o.default,s=o.serialize,l=n.i(f.a)(e);return t[e]={configurable:!0,get:function(){var t=this[l];return null==t?c:t},set:function(t){this[l]=u(t),a(this,i,s,t),this[y]()}},t},{}))}}function o(t,e){var r=e.attribute,o="object"===(void 0===r?"undefined":l(r))?s({},r):{source:r,target:r};return!0===o.source&&(o.source=n.i(f.c)(t)),!0===o.target&&(o.target=n.i(f.c)(t)),o}function i(t,e){var n=e.coerce,r=e.default,i=e.deserialize,u=e.serialize;return{attribute:o(t,e),coerce:n||function(t){return t},default:r,deserialize:i||function(t){return t},serialize:u||function(t){return t}}}function u(t){return t[d]||(t[d]=n.i(f.e)(t.props).reduce(function(e,n){return e[n]=i(n,t.props[n]||{}),e},{}))}function c(t,e,n){if(!t[h]){var r=u(t.constructor);for(var o in r){var i=r[o],c=i.attribute.source,a=i.deserialize;c===e&&(t[b]=o,t[o]=null==n?n:a(n),t[b]=null)}}}function a(t,e,n,r){if(e&&t[b]!==e){var o=n(r);t[h]=!0,null==o?t.removeAttribute(e):t.setAttribute(e,o),t[h]=!1}}var f=n(0);n.d(e,"c",function(){return y}),e.b=r,e.a=u,e.d=c;var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p=n.i(f.a)("_definedProps"),d=n.i(f.a)("_normPropDef"),b=n.i(f.a)("_syncingAttributeToProperty"),h=n.i(f.a)("_syncingPropertyToAttribute"),y=n.i(f.a)("_updateDebounced")},function(t,e,n){"use strict";function r(t,e){return t=t||"element",(-1===t.indexOf("-")?"x-"+t:t)+(e?"-"+e:"")}function o(t){for(var e=n.i(i.c)(t.name);i.d.get(r(e,u));)u++;return r(e,u++)}var i=n(0);e.a=o;var u=0},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=n(12),c=(n.n(u),n(0)),a=n(1),f=n(2),s=n(3);n.o(u,"h")&&n.d(e,"c",function(){return u.h}),n.d(e,"a",function(){return p}),n.d(e,"b",function(){return d});var l=n.i(c.a)("_preactDom"),p=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.b;return function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.rendererCallback=function(t,e){this[l]=n.i(u.render)(e(),t,this[l])},e}(n.i(s.a)(n.i(f.a)(n.i(a.a)(t))))},d=p()},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){t.exports=require("preact")},function(t,e,n){t.exports=n(4)}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("preact")):"function"==typeof define&&define.amd?define(["preact"],e):"object"==typeof exports?exports.skate=e(require("preact")):t.skate=e(t.preact)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=13)}([function(t,e,n){"use strict";(function(t){function r(t){this.func=t}function o(t){return t.split(/([_A-Z])/).reduce(function(t,e,n){var r=t&&n%2!=0?"-":"";return e="_"===e?"":e,""+t+r+e.toLowerCase()})}function i(t){var e=!1,n=0,r=[],o=document.createElement("span");return new w(function(){t.apply(void 0,r),e=!1,r=null}).observe(o,{childList:!0}),function(){for(var t=arguments.length,i=Array(t),u=0;u<t;u++)i[u]=arguments[u];r=i,e||(e=!0,o.textContent=""+n,n+=1)}}function u(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=v(t);return g?e.concat(g(t)):e}function c(t){return"function"==typeof Symbol?Symbol(t?String(t):void 0):a(t)}function a(t){return(t?String(t):"")+"xxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}n.d(e,"d",function(){return s}),n.d(e,"b",function(){return p}),n.d(e,"j",function(){return h}),n.d(e,"i",function(){return y}),n.d(e,"g",function(){return m}),e.c=o,e.f=i,n.d(e,"h",function(){return O}),e.e=u,e.a=c;var f="undefined"==typeof window?t:window,s=f.customElements,l=f.HTMLElement,p=void 0===l?null:l,d=f.MutationObserver,b=f.Object,h=b.defineProperty,y=b.defineProperties,v=b.getOwnPropertyNames,g=b.getOwnPropertySymbols,m=b.freeze;r.prototype.observe=function(t){var e=this.func;h(t,"textContent",{set:function(){setTimeout(e)}})};var w=d||r,O=function(t){return null==t}}).call(e,n(11))},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=n(0),c=n(8);n.d(e,"a",function(){return v}),n.d(e,"b",function(){return E});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},f=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=n.i(u.a)("_connected"),l=n.i(u.a)("_constructed"),p=n.i(u.a)("_observedAttributes"),d=n.i(u.a)("_prevProps"),b=n.i(u.a)("_props"),h=n.i(u.a)("_updateCallback"),y=n.i(u.a)("_updating"),v=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.b;return function(t){function e(){r(this,e);var i=o(this,t.call(this));if(i[h]=function(){if(!i[y]&&i[s]){i[y]=!0;var t=i[d],e=i[d]=i.props;i.propsSetCallback(e,t),i.propsUpdatedCallback(e,t)&&i.propsChangedCallback(e,t),i[y]=!1}},i[l])return o(i);i[l]=!0;var a=i.constructor;return n.i(c.b)(a),i[c.c]=n.i(u.f)(i[h]),i}return i(e,t),f(e,[{key:"props",get:function(){var t=this;return n.i(u.e)(this.constructor.props).reduce(function(e,n){return e[n]=t[n],e},{})},set:function(t){var e=this,r=this.constructor.props;n.i(u.e)(t).forEach(function(n){return n in r&&(e[n]=t[n])})}}],[{key:"observedAttributes",get:function(){var t=n.i(c.a)(this);return n.i(u.e)(t).map(function(e){return t[e].attribute}).filter(Boolean).map(function(t){return t.source}).concat(this[p]||[])},set:function(t){this[p]=t}},{key:"props",get:function(){return this[b]},set:function(t){this[b]=t}}]),e.prototype.connectedCallback=function(){this[s]||(this[s]=!0,t.prototype.connectedCallback&&t.prototype.connectedCallback.call(this),this[c.c]())},e.prototype.disconnectedCallback=function(){this[s]&&(this[s]=!1,t.prototype.disconnectedCallback&&t.prototype.disconnectedCallback.call(this))},e.prototype.propsChangedCallback=function(){},e.prototype.propsSetCallback=function(){},e.prototype.propsUpdatedCallback=function(t,e){return!e||n.i(u.e)(e).some(function(n){return e[n]!==t[n]})},e.prototype.attributeChangedCallback=function(e,r,o){t.prototype.attributeChangedCallback&&t.prototype.attributeChangedCallback.call(this,e,r,o),n.i(c.d)(this,e,o)},e}(t)},g=JSON.parse,m=JSON.stringify,w=n.i(u.g)({source:!0}),O=function(t){return n.i(u.g)(a({attribute:w},t))},C=function(t){return function(e){return n.i(u.h)(e)?null:t(e)}},j=function(t){return n.i(u.h)(t)?0:Number(t)},k=O({coerce:function(t){return Array.isArray(t)?t:n.i(u.h)(t)?null:[t]},default:n.i(u.g)([]),deserialize:g,serialize:m}),_=O({coerce:Boolean,default:!1,deserialize:function(t){return!n.i(u.h)(t)},serialize:function(t){return t?"":null}}),x=O({default:0,coerce:j,deserialize:j,serialize:C(Number)}),P=O({default:n.i(u.g)({}),deserialize:g,serialize:m}),S=O({default:"",coerce:String,serialize:C(String)}),E={array:k,boolean:_,number:x,object:P,string:S}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t){return t.attachShadow?t.attachShadow(s):t}var c=n(0);n.d(e,"a",function(){return l});var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),f=n.i(c.a)(),s={mode:"open"},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.b;return function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.propsChangedCallback=function(){var t=this;this.rendererCallback(this.renderRoot,function(){return t.renderCallback(t)}),this.renderedCallback()},e.prototype.renderCallback=function(){},e.prototype.renderedCallback=function(){},a(e,[{key:"renderRoot",get:function(){return this[f]=this[f]||(this[f]=this.shadowRoot||u(this)),this[f]}}]),e}(t)}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=n(0),c=n(9);n.d(e,"a",function(){return s});var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),f=n.i(u.a)("_is"),s=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.b;return function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),a(e,null,[{key:"is",get:function(){return this[f]||(this[f]=n.i(c.a)(this))},set:function(t){this[f]=t}}]),e}(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(5);n.d(e,"define",function(){return r.a});var o=n(6);n.d(e,"emit",function(){return o.a});var i=n(7);n.d(e,"link",function(){return i.a});var u=n(10);n.d(e,"withComponent",function(){return u.a}),n.d(e,"Component",function(){return u.b}),n.d(e,"h",function(){return u.c});var c=n(1);n.d(e,"withProps",function(){return c.a}),n.d(e,"props",function(){return c.b});var a=n(2);n.d(e,"withRender",function(){return a.a});var f=n(3);n.d(e,"withUnique",function(){return f.a})},function(t,e,n){"use strict";function r(t){var e=t.is;return o.d.get(e)||o.d.define(e,t),t}var o=n(0);e.a=r},function(t,e,n){"use strict";function r(t,e,r){r=i({},u,r);var c=document.createEvent("CustomEvent");return c.initCustomEvent(e,r.bubbles,r.cancelable,r.detail),n.i(o.j)(c,"composed",{value:r.composed}),t.dispatchEvent(c)}var o=n(0);e.a=r;var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u={bubbles:!0,cancelable:!0,composed:!1}},function(t,e,n){"use strict";function r(t){var e=t.checked,n=t.type,r=t.value;return"checkbox"===n||"radio"===n?!!e&&(r||!0):r}function o(t,e){return function(n){var o=n.target||n.composedPath()[0],i=r(o),u=e||o.name||"value";if(u.indexOf(".")>-1){var c=u.split("."),a=c[0],f=c.pop();c.reduce(function(t,e){return t&&t[e]},t)[f||n.target.name]=i,t[a]=t[a]}else t[u]=i}}e.a=o},function(t,e,n){"use strict";function r(t){if(!t[p]){t[p]=!0;var e=t.prototype,r=u(t);n.i(f.i)(e,n.i(f.e)(r).reduce(function(t,e){var o=r[e],i=o.attribute.target,u=o.coerce,c=o.default,s=o.serialize,l=n.i(f.a)(e);return t[e]={configurable:!0,get:function(){var t=this[l];return null==t?c:t},set:function(t){this[l]=u(t),a(this,i,s,t),this[y]()}},t},{}))}}function o(t,e){var r=e.attribute,o="object"===(void 0===r?"undefined":l(r))?s({},r):{source:r,target:r};return!0===o.source&&(o.source=n.i(f.c)(t)),!0===o.target&&(o.target=n.i(f.c)(t)),o}function i(t,e){var n=e.coerce,r=e.default,i=e.deserialize,u=e.serialize;return{attribute:o(t,e),coerce:n||function(t){return t},default:r,deserialize:i||function(t){return t},serialize:u||function(t){return t}}}function u(t){return t[d]||(t[d]=n.i(f.e)(t.props).reduce(function(e,n){return e[n]=i(n,t.props[n]||{}),e},{}))}function c(t,e,n){if(!t[h]){var r=u(t.constructor);for(var o in r){var i=r[o],c=i.attribute.source,a=i.deserialize;c===e&&(t[b]=o,t[o]=null==n?n:a(n),t[b]=null)}}}function a(t,e,n,r){if(e&&t[b]!==e){var o=n(r);t[h]=!0,null==o?t.removeAttribute(e):t.setAttribute(e,o),t[h]=!1}}var f=n(0);n.d(e,"c",function(){return y}),e.b=r,e.a=u,e.d=c;var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p=n.i(f.a)("_definedProps"),d=n.i(f.a)("_normPropDef"),b=n.i(f.a)("_syncingAttributeToProperty"),h=n.i(f.a)("_syncingPropertyToAttribute"),y=n.i(f.a)("_updateDebounced")},function(t,e,n){"use strict";function r(t,e){return t=t||"element",(-1===t.indexOf("-")?"x-"+t:t)+(e?"-"+e:"")}function o(t){for(var e=n.i(i.c)(t.name);i.d.get(r(e,u));)u++;return r(e,u++)}var i=n(0);e.a=o;var u=0},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=n(12),c=(n.n(u),n(0)),a=n(1),f=n(2),s=n(3);n.o(u,"h")&&n.d(e,"c",function(){return u.h}),n.d(e,"a",function(){return p}),n.d(e,"b",function(){return d});var l=n.i(c.a)("_preactDom"),p=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.b;return function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.rendererCallback=function(t,e){this[l]=n.i(u.render)(e(),t,this[l])},e}(n.i(s.a)(n.i(f.a)(n.i(a.a)(t))))},d=p()},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){t.exports=require("preact")},function(t,e,n){t.exports=n(4)}])}); | ||
//# sourceMappingURL=skatejs.min.js.map |
Sorry, the diff of this file is not supported yet
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
176206
22
1656