New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

typed-dom

Package Overview
Dependencies
Maintainers
1
Versions
350
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typed-dom - npm Package Compare versions

Comparing version 0.0.202 to 0.0.203

57

dist/typed-dom.js

@@ -1,2 +0,2 @@

/*! typed-dom v0.0.202 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
/*! typed-dom v0.0.203 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
require = function () {

@@ -243,3 +243,2 @@ function r(e, n, t) {

function noop() {
return;
}

@@ -562,15 +561,8 @@ exports.noop = noop;

exports.uuid = void 0;
const global_1 = _dereq_('./global');
const FORMAT_V4 = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
const {random} = Math;
function uuid() {
let acc = '';
for (let i = 0; i < FORMAT_V4.length; ++i) {
const c = FORMAT_V4[i];
if (c === 'x' || c === 'y') {
const r = random() * 16 | 0;
const v = c == 'x' ? r : r & 3 | 8;
acc += v.toString(16);
} else {
acc += c;
}
acc += calc(FORMAT_V4[i]);
}

@@ -580,4 +572,33 @@ return acc;

exports.uuid = uuid;
function calc(c) {
if (c === 'x' || c === 'y') {
const r = rnd16();
const v = c === 'x' ? r : r & 3 | 8;
return hex[v];
} else {
return c;
}
}
const buffer = new Uint16Array(256);
const scale = 1 << 16;
let index = buffer.length;
let denom = scale;
function rnd16() {
if (index === buffer.length) {
global_1.crypto.getRandomValues(buffer);
index = 0;
}
if (denom > 16) {
denom = denom / 16;
const rnd = buffer[index];
buffer[index] = rnd % denom;
return rnd / denom | 0;
} else {
denom = scale;
return buffer[index++] % 16;
}
}
const hex = [...Array(16)].map((_, i) => i.toString(16));
},
{}
{ './global': 5 }
],

@@ -654,10 +675,10 @@ 10: [

Object.defineProperty(exports, '__esModule', { value: true });
exports.uid = void 0;
exports.id = void 0;
const uuid_1 = _dereq_('spica/uuid');
const id = uuid_1.uuid().split('-').pop();
const unique = uuid_1.uuid().split('-').pop();
let counter = 0;
function uid() {
return `id-${ id }-${ ++counter }`;
function id() {
return `id-${ unique }-${ ++counter }`;
}
exports.uid = uid;
exports.id = id;
},

@@ -744,3 +765,3 @@ { 'spica/uuid': 9 }

return this.id_;
this.id_ = identity_1.uid();
this.id_ = identity_1.id();
this.element.classList.add(this.id_);

@@ -747,0 +768,0 @@ return this.id_;

@@ -1,2 +0,2 @@

/*! typed-dom v0.0.202 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
require=function(){return function e(t,n,r){function i(o,c){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!c&&a)return a(o,!0);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[o]={exports:{}};t[o][0].call(u.exports,function(e){return i(t[o][1][e]||e)},u,u.exports,e,t,n,r)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o<r.length;o++)i(r[o]);return i}}()({1:[function(e,t,n){},{}],2:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0})},{}],3:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isArray=n.ObjectValues=n.ObjectSetPrototypeOf=n.ObjectSeal=n.ObjectPreventExtensions=n.ObjectKeys=n.isSealed=n.isFrozen=n.isExtensible=n.ObjectIs=n.ObjectGetPrototypeOf=n.ObjectGetOwnPropertySymbols=n.ObjectGetOwnPropertyNames=n.ObjectGetOwnPropertyDescriptors=n.ObjectGetOwnPropertyDescriptor=n.ObjectFreeze=n.ObjectEntries=n.ObjectDefineProperty=n.ObjectDefineProperties=n.ObjectCreate=n.ObjectAssign=n.toString=n.isEnumerable=n.isPrototypeOf=n.hasOwnProperty=n.SymbolKeyFor=n.SymbolFor=n.parseInt=n.parseFloat=n.isSafeInteger=n.isNaN=n.isInteger=n.isFinite=n.NaN=void 0,n.NaN=Number.NaN,n.isFinite=Number.isFinite,n.isInteger=Number.isInteger,n.isNaN=Number.isNaN,n.isSafeInteger=Number.isSafeInteger,n.parseFloat=Number.parseFloat,n.parseInt=Number.parseInt,n.SymbolFor=Symbol.for,n.SymbolKeyFor=Symbol.keyFor,n.hasOwnProperty=Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty),n.isPrototypeOf=Object.prototype.isPrototypeOf.call.bind(Object.prototype.isPrototypeOf),n.isEnumerable=Object.prototype.propertyIsEnumerable.call.bind(Object.prototype.propertyIsEnumerable),n.toString=Object.prototype.toString.call.bind(Object.prototype.toString),n.ObjectAssign=Object.assign,n.ObjectCreate=Object.create,n.ObjectDefineProperties=Object.defineProperties,n.ObjectDefineProperty=Object.defineProperty,n.ObjectEntries=Object.entries,n.ObjectFreeze=Object.freeze,n.ObjectGetOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,n.ObjectGetOwnPropertyDescriptors=Object.getOwnPropertyDescriptors,n.ObjectGetOwnPropertyNames=Object.getOwnPropertyNames,n.ObjectGetOwnPropertySymbols=Object.getOwnPropertySymbols,n.ObjectGetPrototypeOf=Object.getPrototypeOf,n.ObjectIs=Object.is,n.isExtensible=Object.isExtensible,n.isFrozen=Object.isFrozen,n.isSealed=Object.isSealed,n.ObjectKeys=Object.keys,n.ObjectPreventExtensions=Object.preventExtensions,n.ObjectSeal=Object.seal,n.ObjectSetPrototypeOf=Object.setPrototypeOf,n.ObjectValues=Object.values,n.isArray=Array.isArray},{}],4:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.join=n.splice=n.push=n.pop=n.unshift=n.shift=n.indexOf=void 0;const r=e("./global"),i=e("./alias");function s(e,t){if(i.isArray(e))for(let n=e.length-1;n>=0;--n)t.unshift(e[n]);else t.unshift(...e);return t}function o(e,t){if(i.isArray(t))for(let n=0;n<t.length;++n)e.push(t[n]);else e.push(...t);return e}function c(e,t,n,...i){if(0===n&&0===i.length)return[];switch(n=n>e.length?e.length:n,t){case 0:switch(n){case 0:return[[],s(i,e)][0];case 1:return 0===e.length?[[],s(i,e)][0]:[[e.shift()],s(i,e)][0];case r.undefined:if(e.length>1||arguments.length>2)break;return 0===e.length?[]:c(e,t,1)}break;case-1:case e.length-1:case r.Infinity:switch(n){case 0:return[[],o(e,i)][0];case 1:return 0===e.length?[[],o(e,i)][0]:[[e.pop()],o(e,i)][0];case r.undefined:if(e.length>1||arguments.length>2)break;return 0===e.length?[]:c(e,t,1)}}return arguments.length>2?e.splice(t,n,...i):e.splice(t)}n.indexOf=function(e,t){return t==t?e.indexOf(t):e.findIndex(e=>e!=e)},n.shift=function(e,t){if(t<0)throw new Error("Unexpected negative number");return t===r.undefined?[e.shift(),e]:[c(e,0,t),e]},n.unshift=s,n.pop=function(e,t){if(t<0)throw new Error("Unexpected negative number");return t===r.undefined?[e,e.pop()]:[e,c(e,e.length-t,t)]},n.push=o,n.splice=c,n.join=function(e,t=""){let n="";for(let r=0;r<e.length;++r)n+=0===r?e[r]:t+e[r];return n}},{"./alias":3,"./global":5}],5:[function(_dereq_,module,exports){"use strict";const global="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||Function("return this")();eval("global.global = global"),module.exports=global},{}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.memoize=void 0;const r=e("./global");n.memoize=function e(t,n=((...e)=>e[0]),i){if("object"==typeof n)return e(t,r.undefined,n);if(i===r.undefined)return e(t,n,new r.Map);let s=!1;return(...e)=>{const o=n(...e);let c=i.get(o);return c!==r.undefined||s&&i.has(o)?c:(c=t(...e),s=s||c===r.undefined,i.set(o,c),c)}}},{"./global":5}],7:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.noop=void 0,n.noop=function(){}},{}],8:[function(e,t,n){"use strict";var r;Object.defineProperty(n,"__esModule",{value:!0}),n.isPromiseLike=n.Internal=n.AtomicPromise=void 0;const i=e("./global"),s=e("./alias"),o=e("./array"),c=Symbol.for("spica/promise::internal");class a{constructor(e){this[Symbol.toStringTag]="Promise",this[r]=new l;try{e(e=>this[c].resolve(e),e=>this[c].reject(e))}catch(e){this[c].reject(e)}}static get[Symbol.species](){return a}static all(e){return new a((t,n)=>{const r=s.isArray(e)?e:[...e],o=i.Array(r.length);let a=0;for(let e=0;e<r.length;++e){const i=r[e];if(u(i)){if(f(i)){const{status:t}=i[c];switch(t.state){case 2:o[e]=t.value,++a;continue;case 3:n(t.reason),e=r.length;continue}}i.then(n=>{o[e]=n,++a===r.length&&t(o)},t=>{n(t),e=r.length})}else o[e]=i,++a}a===r.length&&t(o)})}static race(e){return new a((t,n)=>{const r=s.isArray(e)?e:[...e];for(let e=0;e<r.length;++e){const i=r[e];if(!u(i))return t(i);if(f(i)){const{status:e}=i[c];switch(e.state){case 2:return t(e.value);case 3:return n(e.reason)}}}let i=!1;for(let e=0;e<r.length;++e){if(r[e].then(e=>{t(e),i=!0},e=>{n(e),i=!0}),i)return}})}static allSettled(e){return new a(t=>{const n=s.isArray(e)?e:[...e],r=i.Array(n.length);let o=0;for(let e=0;e<n.length;++e){const i=n[e];if(u(i)){if(f(i)){const{status:t}=i[c];switch(t.state){case 2:r[e]={status:"fulfilled",value:t.value},++o;continue;case 3:r[e]={status:"rejected",reason:t.reason},++o;continue}}i.then(i=>{r[e]={status:"fulfilled",value:i},++o===n.length&&t(r)},i=>{r[e]={status:"rejected",reason:i},++o===n.length&&t(r)})}else r[e]={status:"fulfilled",value:i},++o}o===n.length&&t(r)})}static resolve(e){return new a(t=>t(e))}static reject(e){return new a((t,n)=>n(e))}then(e,t){return new a((n,r)=>this[c].then(e,t,n,r))}catch(e){return this.then(i.undefined,e)}finally(e){return this.then(e,e).then(()=>this)}}n.AtomicPromise=a,r=c;class l{constructor(){this.status={state:0},this.reactable=!0,this.fulfillReactions=[],this.rejectReactions=[],this.isHandled=!1}get isPending(){return 0===this.status.state}resolve(e){if(0===this.status.state){if(!u(e))return this.status={state:2,value:e},this.resume();this.status={state:1,promise:e},e.then(e=>{this.status={state:2,value:e},this.resume()},e=>{this.status={state:3,reason:e},this.resume()})}}reject(e){if(0===this.status.state)return this.status={state:3,reason:e},this.resume()}then(e,t,n,r){const{status:i,fulfillReactions:s,rejectReactions:o}=this;switch(i.state){case 2:if(s.length>0)break;try{return n(e?e(i.value):i.value)}catch(e){return r(e)}case 3:if(o.length>0)break;try{return t?n(t(i.reason)):r(i.reason)}catch(e){return r(e)}default:return s.push(t=>{try{n(e?e(t):t)}catch(e){r(e)}}),o.push(e=>{try{t?n(t(e)):r(e)}catch(e){r(e)}}),this.resume()}}resume(){if(!this.reactable)return;const{status:e,fulfillReactions:t,rejectReactions:n}=this;switch(e.state){case 0:case 1:return;case 2:if(this.isHandled&&n.length>0&&o.splice(n,0),0===t.length)return;return this.isHandled=!0,void this.react(t,e.value);case 3:if(this.isHandled&&t.length>0&&o.splice(t,0),0===n.length)return;return this.isHandled=!0,void this.react(n,e.reason)}}react(e,t){if(this.reactable=!1,e.length<5)for(;e.length>0;)e.shift()(t);else{for(let n=0;n<e.length;++n)e[n](t);o.splice(e,0)}this.reactable=!0}}function u(e){return null!==e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then}function f(e){return c in e}n.Internal=l,n.isPromiseLike=u},{"./alias":3,"./array":4,"./global":5}],9:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.uuid=void 0;const r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",{random:i}=Math;n.uuid=function(){let e="";for(let t=0;t<r.length;++t){const n=r[t];if("x"===n||"y"===n){const t=16*i()|0;e+=("x"==n?t:3&t|8).toString(16)}else e+=n}return e}},{}],10:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.SVG=n.HTML=n.Shadow=n.API=void 0;const r=e("spica/global"),i=e("spica/alias"),s=e("./proxy"),o=e("./util/dom");function c(e,t=(e=>e)){return new Proxy(()=>r.undefined,function(e,t){return{apply(e,t,[n,...r]){return this.get(e,n,e)(...r)},get:(n,c)=>n[c]||c in n||"string"!=typeof c?n[c]:n[c]=function(e,n){return function a(l,u,f){if("function"==typeof l)return a(r.undefined,r.undefined,l);if("function"==typeof u)return a(l,r.undefined,u);if(l!==r.undefined&&function(e){return"object"!=typeof e||i.ObjectValues(e).slice(-1).every(e=>"object"==typeof e)}(l))return a(r.undefined,l,f);const d=t(function(t,r,s){const a=t(n,e,r||{},s);if(e!==a.tagName.toLowerCase())throw new Error(`TypedDOM: Expected tag name is "${e}" but actually "${a.tagName.toLowerCase()}".`);if(t!==c){if(r)for(const e of i.ObjectKeys(r)){const t=r[e];"function"==typeof t&&a.removeEventListener(e,t)}o.define(a,r)}return a}(f||c,l,u));return 1===d.nodeType?new s.Elem(d,u):new s.Elem(d.host,u,d)};function c(e,t,n){return e(t,n)}}(c,e)}}(e,t))}n.API=c,n.Shadow=c(o.html,o.shadow),n.HTML=c(o.html),n.SVG=c(o.svg)},{"./proxy":12,"./util/dom":13,"spica/alias":3,"spica/global":5}],11:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.uid=void 0;const r=e("spica/uuid").uuid().split("-").pop();let i=0;n.uid=function(){return`id-${r}-${++i}`}},{"spica/uuid":9}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Elem=n.proxy=void 0;const r=e("spica/global"),i=e("spica/alias"),s=e("./identity"),o=e("./util/dom"),c=e("spica/array"),a=new r.WeakMap;function l(e){const t=a.get(e);if(t)return t;throw new Error("TypedDOM: This element has no proxy.")}n.proxy=l;Symbol.for("typed-dom/tag");function u({element:e}){if(e.parentElement&&a.has(e.parentElement))throw new Error("TypedDOM: Typed DOM children must not be used to another typed DOM.")}n.Elem=class{constructor(e,t,n=e){switch(this.element=e,this.children_=t,this.container=n,this.id_="",this.query_="",this.isPartialUpdate=!1,this.isInit=!0,!0){case t===r.undefined:this.type=0;break;case"string"==typeof t:this.type=1;break;case i.isArray(t):this.type=2;break;case t&&"object"==typeof t:this.type=3;break;default:throw new Error("TypedDOM: Invalid type children.")}switch(u(this),a.set(this.element,this),this.type){case 0:return void(this.isInit=!1);case 1:return o.define(this.container,[]),this.children_=this.container.appendChild(o.text("")),this.children=t,void(this.isInit=!1);case 2:return o.define(this.container,[]),this.children_=[],this.children=t,void(this.isInit=!1);case 3:return o.define(this.container,[]),this.children_=this.observe({...t}),this.children=t,void(this.isInit=!1);default:throw new Error("TypedDOM: Unreachable code.")}}get id(){return this.id_?this.id_:(this.id_=this.element.id.trim(),this.id_?this.id_:(this.id_=s.uid(),this.element.classList.add(this.id_),this.id_))}get query(){if(this.query_)return this.query_;switch(!0){case this.element!==this.container:return this.query_=":host";case this.id===this.element.id.trim():return this.query_=`#${this.id}`;default:return this.query_=`.${this.id}`}}observe(e){const t={};for(const n of i.ObjectKeys(e)){if(n in{})continue;let r=e[n];u(r),this.container.appendChild(r.element),t[n]={configurable:!0,enumerable:!0,get:()=>r,set:e=>{const t=r;if(e!==t)if(this.isPartialUpdate)if(r=e,e.element.parentNode===t.element.parentNode){const n=e.element.nextSibling!==t.element?e.element.nextSibling:t.element.nextSibling;this.container.replaceChild(e.element,t.element),this.container.insertBefore(t.element,n)}else this.container.insertBefore(e.element,t.element),this.container.removeChild(t.element);else this.children={...this.children_,[n]:e}}}}return i.ObjectDefineProperties(e,t)}scope(e){const t=e.element;switch(!1){case"type"in t:case"media"in t:case"STYLE"===t.tagName:return}const n=/(^|[,}])(\s*)\$scope(?![\w-])(?=[^;{}]*{)/g,r=t.innerHTML;if(-1===r.search(n))return;const i=this.query;if(/^[:#.][\w-]+$/.test(i)&&(t.innerHTML=r.replace(n,(e,t,n)=>`${t}${n}${i}`),t.firstElementChild))for(let e=t.children,n=0,r=e.length;n<r;++n)e[0].remove()}get children(){switch(this.type){case 1:if(this.children_.parentNode!==this.container){this.children_=r.undefined;for(let e=this.container.childNodes,t=0,n=e.length;t<n;++t){const n=e[t];if("wholeText"in n!=0){this.children_=n;break}}}return this.children_.data;default:return this.children_}}set children(e){const t=[],n=[];let s=!1;switch(this.type){case 0:return;case 1:{if(!this.isInit&&e===this.children)return;const t=this.children_,n=t.data,i=e;if(t.data=i,i===n)return;return void this.element.dispatchEvent(new r.Event("change",{bubbles:!1,cancelable:!0}))}case 2:{const r=e,i=[];this.children_=i;const o=this.container.children;for(let e=0;e<r.length;++e){const t=r[e],c=o[e];t.element.parentNode!==this.container&&u(t),t.element!==c&&(t.element.parentNode!==this.container&&(this.scope(t),n.push(t)),this.container.insertBefore(t.element,c),s=!0),i.push(t)}for(let e=o.length;r.length<e--;){const e=o[r.length];a.has(e)&&(t.push(l(this.container.removeChild(e))),s=!0)}break}case 3:{const r=e,o=this.children_;for(const e of i.ObjectKeys(o)){const i=o[e],a=r[e];if(this.isInit||a!==i){if(a.element.parentNode!==this.container&&u(a),(this.isInit||a!==i&&a.element.parentNode!==i.element.parentNode)&&(this.scope(a),n.push(a),!this.isInit)){let e=0;(e=t.lastIndexOf(a))>-1&&c.splice(t,e,1),t.push(i),(e=n.lastIndexOf(i))>-1&&c.splice(n,e,1)}this.isPartialUpdate=!0,o[e]=r[e],this.isPartialUpdate=!1,s=!0}}break}}if(t.length){const e=new r.Event("disconnect",{bubbles:!1,cancelable:!0});for(const{element:n}of t)n.dispatchEvent(e)}if(n.length){const e=new r.Event("connect",{bubbles:!1,cancelable:!0});for(const{element:t}of n)t.dispatchEvent(e)}s&&this.element.dispatchEvent(new r.Event("change",{bubbles:!1,cancelable:!0}))}}},{"./identity":11,"./util/dom":13,"spica/alias":3,"spica/array":4,"spica/global":5}],13:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.define=n.element=n.text=n.svg=n.html=n.frag=n.shadow=void 0;const r=e("spica/global"),i=e("spica/alias"),s=e("spica/memoize");var o;function c(e){return r.document.createTextNode(e)}function a(e,t){const n=s.memoize(l,(e,t,n)=>`${t}:${n}`);return(r,i,s)=>{const o=r.includes("-")?l(e,t,r):n(e,t,r).cloneNode(!0);return d(i)?f(o,i):f(u(o,i),s)}}function l(e,t,n){if(!("createElement"in e))throw new Error("TypedDOM: Scoped custom elements are not supported on this browser.");switch(t){case"HTML":return e.createElement(n);case"SVG":return e.createElementNS("http://www.w3.org/2000/svg",n)}}function u(e,t){if(!t)return e;for(const n of i.ObjectKeys(t)){const r=t[n];switch(typeof r){case"string":e.setAttribute(n,r);continue;case"function":if(n.length<3)throw new Error(`TypedDOM: Attribute names for event listeners must have an event name but got "${n}".`);if("on"!==n.slice(0,2))throw new Error(`TypedDOM: Attribute names for event listeners must start with "on" but got "${n}".`);e.addEventListener(n.slice(2),r,{passive:["wheel","mousewheel","touchstart","touchmove"].includes(n.slice(2))});continue;case"object":e.removeAttribute(n);continue;default:continue}}return e}function f(e,t){switch(typeof t){case"undefined":return e;case"string":return f(e,[t])}if(!i.isArray(t)){if(!("length"in t))return f(e,[...t]);const n=[];for(let e=0,r=t.length;e<r;++e)n.push(t[e]);return f(e,n)}const n=e.firstChild?e.childNodes:[];let r=n.length;if(0===r)return e.append(...t),e;let s=0;e:for(let i=0;i<t.length;++i){if(s===r)return e.append(...t.slice(i)),e;const o=t[i];if("object"==typeof o&&11===o.nodeType){const t=o.childNodes.length;r+=o!==e?t:0,e.insertBefore(o,n[s]||null),s+=t;continue}for(++s;r>t.length;){const e=n[s-1];if(h(e,o))continue e;e.remove(),--r}const a=n[s-1];h(a,o)||(r<t.length-i+s?(r+="string"==typeof o||o.parentNode!==e?1:0,e.insertBefore("string"==typeof o?c(o):o,a)):e.replaceChild("string"==typeof o?c(o):o,a))}for(;s<r;)n[s].remove(),--r;return e}function d(e){return!!(null==e?void 0:e[r.Symbol.iterator])}function h(e,t){return"string"==typeof t?"wholeText"in e&&e.data===t:e===t}!function(e){e.shadows=new WeakMap,e.fragment=r.document.createDocumentFragment()}(o||(o={})),n.shadow=function e(t,i,s){if("string"==typeof t)return e(n.html(t),i,s);if(i&&!d(i))return e(t,r.undefined,i);const c=s===r.undefined?t.shadowRoot||o.shadows.get(t):"open"===s.mode?t.shadowRoot||r.undefined:o.shadows.get(t);return f(s&&"open"!==s.mode?c||o.shadows.set(t,t.attachShadow(s)).get(t):c||t.attachShadow(s||{mode:"open"}),c||i!=r.undefined?i:t.childNodes)},n.frag=function(e){return f(o.fragment.cloneNode(!0),e)},n.html=a(r.document,"HTML"),n.svg=a(r.document,"SVG"),n.text=c,n.element=a,n.define=function(e,t,n){return d(t)?f(e,t):f(u(e,t),n)}},{"spica/alias":3,"spica/global":5,"spica/memoize":6}],14:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.bind=n.delegate=n.wait=n.once=n.listen=n.currentTarget=void 0;const r=e("spica/global"),i=e("spica/promise"),s=e("spica/noop");function o(e,t,n,r=!1,i={}){return"string"==typeof n?c(e,t,n,r,{..."boolean"==typeof i?{capture:i}:i,once:!0}):a(e,t,n,{..."boolean"==typeof r?{capture:r}:r,once:!0})}function c(e,t,n,i,c={}){let l=s.noop;return a(e,n,e=>{var s,a;l();const u=e.target.shadowRoot?null===(s=e.composedPath()[0])||void 0===s?void 0:s.closest(t):null===(a=e.target)||void 0===a?void 0:a.closest(t);return u?l=o(u,n,i,c):r.undefined,e.returnValue},{...c,capture:!0})}function a(e,t,i,o=!1){e.addEventListener(t,a,o);let c=()=>void e.removeEventListener(t,a,o);return()=>void(c=c()||s.noop);function a(e){return n.currentTarget in e&&!e[n.currentTarget]?r.undefined:e[n.currentTarget]=e.currentTarget,i(e)}}n.currentTarget=Symbol.for("currentTarget"),n.listen=function(e,t,n,r=!1,i={}){return"string"==typeof n?c(e,t,n,r,i):a(e,t,n,r)},n.once=o,n.wait=function(e,t,n=!1,r={}){return new i.AtomicPromise(i=>"string"==typeof n?o(e,t,n,i,r):o(e,t,i,n))},n.delegate=c,n.bind=a},{"spica/global":5,"spica/noop":7,"spica/promise":8}],15:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.apply=void 0;const r=e("./dom");n.apply=function(e,t,n){const i=e.querySelectorAll(t);for(let e=0,t=i.length;e<t;++e)r.define(i[e],n);return i}},{"./dom":13}],"typed-dom":[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.apply=n.currentTarget=n.bind=n.delegate=n.wait=n.once=n.listen=n.define=n.element=n.text=n.svg=n.html=n.frag=n.shadow=n.proxy=n.API=n.SVG=n.HTML=n.Shadow=void 0,e("spica/global");var r=e("./src/builder");Object.defineProperty(n,"Shadow",{enumerable:!0,get:function(){return r.Shadow}}),Object.defineProperty(n,"HTML",{enumerable:!0,get:function(){return r.HTML}}),Object.defineProperty(n,"SVG",{enumerable:!0,get:function(){return r.SVG}}),Object.defineProperty(n,"API",{enumerable:!0,get:function(){return r.API}});var i=e("./src/proxy");Object.defineProperty(n,"proxy",{enumerable:!0,get:function(){return i.proxy}});var s=e("./src/util/dom");Object.defineProperty(n,"shadow",{enumerable:!0,get:function(){return s.shadow}}),Object.defineProperty(n,"frag",{enumerable:!0,get:function(){return s.frag}}),Object.defineProperty(n,"html",{enumerable:!0,get:function(){return s.html}}),Object.defineProperty(n,"svg",{enumerable:!0,get:function(){return s.svg}}),Object.defineProperty(n,"text",{enumerable:!0,get:function(){return s.text}}),Object.defineProperty(n,"element",{enumerable:!0,get:function(){return s.element}}),Object.defineProperty(n,"define",{enumerable:!0,get:function(){return s.define}});var o=e("./src/util/listener");Object.defineProperty(n,"listen",{enumerable:!0,get:function(){return o.listen}}),Object.defineProperty(n,"once",{enumerable:!0,get:function(){return o.once}}),Object.defineProperty(n,"wait",{enumerable:!0,get:function(){return o.wait}}),Object.defineProperty(n,"delegate",{enumerable:!0,get:function(){return o.delegate}}),Object.defineProperty(n,"bind",{enumerable:!0,get:function(){return o.bind}}),Object.defineProperty(n,"currentTarget",{enumerable:!0,get:function(){return o.currentTarget}});var c=e("./src/util/query");Object.defineProperty(n,"apply",{enumerable:!0,get:function(){return c.apply}})},{"./src/builder":10,"./src/proxy":12,"./src/util/dom":13,"./src/util/listener":14,"./src/util/query":15,"spica/global":5}]},{},[1,"typed-dom",2]),function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof module&&module.exports&&(module.exports=t())}("undefined"!=typeof self&&self,function(){return require("typed-dom")});
/*! typed-dom v0.0.203 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
require=function(){return function e(t,n,r){function i(o,c){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!c&&a)return a(o,!0);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[o]={exports:{}};t[o][0].call(u.exports,function(e){return i(t[o][1][e]||e)},u,u.exports,e,t,n,r)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o<r.length;o++)i(r[o]);return i}}()({1:[function(e,t,n){},{}],2:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0})},{}],3:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isArray=n.ObjectValues=n.ObjectSetPrototypeOf=n.ObjectSeal=n.ObjectPreventExtensions=n.ObjectKeys=n.isSealed=n.isFrozen=n.isExtensible=n.ObjectIs=n.ObjectGetPrototypeOf=n.ObjectGetOwnPropertySymbols=n.ObjectGetOwnPropertyNames=n.ObjectGetOwnPropertyDescriptors=n.ObjectGetOwnPropertyDescriptor=n.ObjectFreeze=n.ObjectEntries=n.ObjectDefineProperty=n.ObjectDefineProperties=n.ObjectCreate=n.ObjectAssign=n.toString=n.isEnumerable=n.isPrototypeOf=n.hasOwnProperty=n.SymbolKeyFor=n.SymbolFor=n.parseInt=n.parseFloat=n.isSafeInteger=n.isNaN=n.isInteger=n.isFinite=n.NaN=void 0,n.NaN=Number.NaN,n.isFinite=Number.isFinite,n.isInteger=Number.isInteger,n.isNaN=Number.isNaN,n.isSafeInteger=Number.isSafeInteger,n.parseFloat=Number.parseFloat,n.parseInt=Number.parseInt,n.SymbolFor=Symbol.for,n.SymbolKeyFor=Symbol.keyFor,n.hasOwnProperty=Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty),n.isPrototypeOf=Object.prototype.isPrototypeOf.call.bind(Object.prototype.isPrototypeOf),n.isEnumerable=Object.prototype.propertyIsEnumerable.call.bind(Object.prototype.propertyIsEnumerable),n.toString=Object.prototype.toString.call.bind(Object.prototype.toString),n.ObjectAssign=Object.assign,n.ObjectCreate=Object.create,n.ObjectDefineProperties=Object.defineProperties,n.ObjectDefineProperty=Object.defineProperty,n.ObjectEntries=Object.entries,n.ObjectFreeze=Object.freeze,n.ObjectGetOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,n.ObjectGetOwnPropertyDescriptors=Object.getOwnPropertyDescriptors,n.ObjectGetOwnPropertyNames=Object.getOwnPropertyNames,n.ObjectGetOwnPropertySymbols=Object.getOwnPropertySymbols,n.ObjectGetPrototypeOf=Object.getPrototypeOf,n.ObjectIs=Object.is,n.isExtensible=Object.isExtensible,n.isFrozen=Object.isFrozen,n.isSealed=Object.isSealed,n.ObjectKeys=Object.keys,n.ObjectPreventExtensions=Object.preventExtensions,n.ObjectSeal=Object.seal,n.ObjectSetPrototypeOf=Object.setPrototypeOf,n.ObjectValues=Object.values,n.isArray=Array.isArray},{}],4:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.join=n.splice=n.push=n.pop=n.unshift=n.shift=n.indexOf=void 0;const r=e("./global"),i=e("./alias");function s(e,t){if(i.isArray(e))for(let n=e.length-1;n>=0;--n)t.unshift(e[n]);else t.unshift(...e);return t}function o(e,t){if(i.isArray(t))for(let n=0;n<t.length;++n)e.push(t[n]);else e.push(...t);return e}function c(e,t,n,...i){if(0===n&&0===i.length)return[];switch(n=n>e.length?e.length:n,t){case 0:switch(n){case 0:return[[],s(i,e)][0];case 1:return 0===e.length?[[],s(i,e)][0]:[[e.shift()],s(i,e)][0];case r.undefined:if(e.length>1||arguments.length>2)break;return 0===e.length?[]:c(e,t,1)}break;case-1:case e.length-1:case r.Infinity:switch(n){case 0:return[[],o(e,i)][0];case 1:return 0===e.length?[[],o(e,i)][0]:[[e.pop()],o(e,i)][0];case r.undefined:if(e.length>1||arguments.length>2)break;return 0===e.length?[]:c(e,t,1)}}return arguments.length>2?e.splice(t,n,...i):e.splice(t)}n.indexOf=function(e,t){return t==t?e.indexOf(t):e.findIndex(e=>e!=e)},n.shift=function(e,t){if(t<0)throw new Error("Unexpected negative number");return t===r.undefined?[e.shift(),e]:[c(e,0,t),e]},n.unshift=s,n.pop=function(e,t){if(t<0)throw new Error("Unexpected negative number");return t===r.undefined?[e,e.pop()]:[e,c(e,e.length-t,t)]},n.push=o,n.splice=c,n.join=function(e,t=""){let n="";for(let r=0;r<e.length;++r)n+=0===r?e[r]:t+e[r];return n}},{"./alias":3,"./global":5}],5:[function(_dereq_,module,exports){"use strict";const global="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||Function("return this")();eval("global.global = global"),module.exports=global},{}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.memoize=void 0;const r=e("./global");n.memoize=function e(t,n=((...e)=>e[0]),i){if("object"==typeof n)return e(t,r.undefined,n);if(i===r.undefined)return e(t,n,new r.Map);let s=!1;return(...e)=>{const o=n(...e);let c=i.get(o);return c!==r.undefined||s&&i.has(o)?c:(c=t(...e),s=s||c===r.undefined,i.set(o,c),c)}}},{"./global":5}],7:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.noop=void 0,n.noop=function(){}},{}],8:[function(e,t,n){"use strict";var r;Object.defineProperty(n,"__esModule",{value:!0}),n.isPromiseLike=n.Internal=n.AtomicPromise=void 0;const i=e("./global"),s=e("./alias"),o=e("./array"),c=Symbol.for("spica/promise::internal");class a{constructor(e){this[Symbol.toStringTag]="Promise",this[r]=new l;try{e(e=>this[c].resolve(e),e=>this[c].reject(e))}catch(e){this[c].reject(e)}}static get[Symbol.species](){return a}static all(e){return new a((t,n)=>{const r=s.isArray(e)?e:[...e],o=i.Array(r.length);let a=0;for(let e=0;e<r.length;++e){const i=r[e];if(u(i)){if(f(i)){const{status:t}=i[c];switch(t.state){case 2:o[e]=t.value,++a;continue;case 3:n(t.reason),e=r.length;continue}}i.then(n=>{o[e]=n,++a===r.length&&t(o)},t=>{n(t),e=r.length})}else o[e]=i,++a}a===r.length&&t(o)})}static race(e){return new a((t,n)=>{const r=s.isArray(e)?e:[...e];for(let e=0;e<r.length;++e){const i=r[e];if(!u(i))return t(i);if(f(i)){const{status:e}=i[c];switch(e.state){case 2:return t(e.value);case 3:return n(e.reason)}}}let i=!1;for(let e=0;e<r.length;++e){if(r[e].then(e=>{t(e),i=!0},e=>{n(e),i=!0}),i)return}})}static allSettled(e){return new a(t=>{const n=s.isArray(e)?e:[...e],r=i.Array(n.length);let o=0;for(let e=0;e<n.length;++e){const i=n[e];if(u(i)){if(f(i)){const{status:t}=i[c];switch(t.state){case 2:r[e]={status:"fulfilled",value:t.value},++o;continue;case 3:r[e]={status:"rejected",reason:t.reason},++o;continue}}i.then(i=>{r[e]={status:"fulfilled",value:i},++o===n.length&&t(r)},i=>{r[e]={status:"rejected",reason:i},++o===n.length&&t(r)})}else r[e]={status:"fulfilled",value:i},++o}o===n.length&&t(r)})}static resolve(e){return new a(t=>t(e))}static reject(e){return new a((t,n)=>n(e))}then(e,t){return new a((n,r)=>this[c].then(e,t,n,r))}catch(e){return this.then(i.undefined,e)}finally(e){return this.then(e,e).then(()=>this)}}n.AtomicPromise=a,r=c;class l{constructor(){this.status={state:0},this.reactable=!0,this.fulfillReactions=[],this.rejectReactions=[],this.isHandled=!1}get isPending(){return 0===this.status.state}resolve(e){if(0===this.status.state){if(!u(e))return this.status={state:2,value:e},this.resume();this.status={state:1,promise:e},e.then(e=>{this.status={state:2,value:e},this.resume()},e=>{this.status={state:3,reason:e},this.resume()})}}reject(e){if(0===this.status.state)return this.status={state:3,reason:e},this.resume()}then(e,t,n,r){const{status:i,fulfillReactions:s,rejectReactions:o}=this;switch(i.state){case 2:if(s.length>0)break;try{return n(e?e(i.value):i.value)}catch(e){return r(e)}case 3:if(o.length>0)break;try{return t?n(t(i.reason)):r(i.reason)}catch(e){return r(e)}default:return s.push(t=>{try{n(e?e(t):t)}catch(e){r(e)}}),o.push(e=>{try{t?n(t(e)):r(e)}catch(e){r(e)}}),this.resume()}}resume(){if(!this.reactable)return;const{status:e,fulfillReactions:t,rejectReactions:n}=this;switch(e.state){case 0:case 1:return;case 2:if(this.isHandled&&n.length>0&&o.splice(n,0),0===t.length)return;return this.isHandled=!0,void this.react(t,e.value);case 3:if(this.isHandled&&t.length>0&&o.splice(t,0),0===n.length)return;return this.isHandled=!0,void this.react(n,e.reason)}}react(e,t){if(this.reactable=!1,e.length<5)for(;e.length>0;)e.shift()(t);else{for(let n=0;n<e.length;++n)e[n](t);o.splice(e,0)}this.reactable=!0}}function u(e){return null!==e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then}function f(e){return c in e}n.Internal=l,n.isPromiseLike=u},{"./alias":3,"./array":4,"./global":5}],9:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.uuid=void 0;const r=e("./global"),i="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";function s(e){if("x"===e||"y"===e){const t=function(){a===o.length&&(r.crypto.getRandomValues(o),a=0);if(l>16){l/=16;const e=o[a];return o[a]=e%l,e/l|0}return l=c,o[a++]%16}();return u["x"===e?t:3&t|8]}return e}n.uuid=function(){let e="";for(let t=0;t<i.length;++t)e+=s(i[t]);return e};const o=new Uint16Array(256),c=65536;let a=o.length,l=c;const u=[...Array(16)].map((e,t)=>t.toString(16))},{"./global":5}],10:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.SVG=n.HTML=n.Shadow=n.API=void 0;const r=e("spica/global"),i=e("spica/alias"),s=e("./proxy"),o=e("./util/dom");function c(e,t=(e=>e)){return new Proxy(()=>r.undefined,function(e,t){return{apply(e,t,[n,...r]){return this.get(e,n,e)(...r)},get:(n,c)=>n[c]||c in n||"string"!=typeof c?n[c]:n[c]=function(e,n){return function a(l,u,f){if("function"==typeof l)return a(r.undefined,r.undefined,l);if("function"==typeof u)return a(l,r.undefined,u);if(l!==r.undefined&&function(e){return"object"!=typeof e||i.ObjectValues(e).slice(-1).every(e=>"object"==typeof e)}(l))return a(r.undefined,l,f);const d=t(function(t,r,s){const a=t(n,e,r||{},s);if(e!==a.tagName.toLowerCase())throw new Error(`TypedDOM: Expected tag name is "${e}" but actually "${a.tagName.toLowerCase()}".`);if(t!==c){if(r)for(const e of i.ObjectKeys(r)){const t=r[e];"function"==typeof t&&a.removeEventListener(e,t)}o.define(a,r)}return a}(f||c,l,u));return 1===d.nodeType?new s.Elem(d,u):new s.Elem(d.host,u,d)};function c(e,t,n){return e(t,n)}}(c,e)}}(e,t))}n.API=c,n.Shadow=c(o.html,o.shadow),n.HTML=c(o.html),n.SVG=c(o.svg)},{"./proxy":12,"./util/dom":13,"spica/alias":3,"spica/global":5}],11:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.id=void 0;const r=e("spica/uuid").uuid().split("-").pop();let i=0;n.id=function(){return`id-${r}-${++i}`}},{"spica/uuid":9}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Elem=n.proxy=void 0;const r=e("spica/global"),i=e("spica/alias"),s=e("./identity"),o=e("./util/dom"),c=e("spica/array"),a=new r.WeakMap;function l(e){const t=a.get(e);if(t)return t;throw new Error("TypedDOM: This element has no proxy.")}n.proxy=l;Symbol.for("typed-dom/tag");function u({element:e}){if(e.parentElement&&a.has(e.parentElement))throw new Error("TypedDOM: Typed DOM children must not be used to another typed DOM.")}n.Elem=class{constructor(e,t,n=e){switch(this.element=e,this.children_=t,this.container=n,this.id_="",this.query_="",this.isPartialUpdate=!1,this.isInit=!0,!0){case t===r.undefined:this.type=0;break;case"string"==typeof t:this.type=1;break;case i.isArray(t):this.type=2;break;case t&&"object"==typeof t:this.type=3;break;default:throw new Error("TypedDOM: Invalid type children.")}switch(u(this),a.set(this.element,this),this.type){case 0:return void(this.isInit=!1);case 1:return o.define(this.container,[]),this.children_=this.container.appendChild(o.text("")),this.children=t,void(this.isInit=!1);case 2:return o.define(this.container,[]),this.children_=[],this.children=t,void(this.isInit=!1);case 3:return o.define(this.container,[]),this.children_=this.observe({...t}),this.children=t,void(this.isInit=!1);default:throw new Error("TypedDOM: Unreachable code.")}}get id(){return this.id_?this.id_:(this.id_=this.element.id.trim(),this.id_?this.id_:(this.id_=s.id(),this.element.classList.add(this.id_),this.id_))}get query(){if(this.query_)return this.query_;switch(!0){case this.element!==this.container:return this.query_=":host";case this.id===this.element.id.trim():return this.query_=`#${this.id}`;default:return this.query_=`.${this.id}`}}observe(e){const t={};for(const n of i.ObjectKeys(e)){if(n in{})continue;let r=e[n];u(r),this.container.appendChild(r.element),t[n]={configurable:!0,enumerable:!0,get:()=>r,set:e=>{const t=r;if(e!==t)if(this.isPartialUpdate)if(r=e,e.element.parentNode===t.element.parentNode){const n=e.element.nextSibling!==t.element?e.element.nextSibling:t.element.nextSibling;this.container.replaceChild(e.element,t.element),this.container.insertBefore(t.element,n)}else this.container.insertBefore(e.element,t.element),this.container.removeChild(t.element);else this.children={...this.children_,[n]:e}}}}return i.ObjectDefineProperties(e,t)}scope(e){const t=e.element;switch(!1){case"type"in t:case"media"in t:case"STYLE"===t.tagName:return}const n=/(^|[,}])(\s*)\$scope(?![\w-])(?=[^;{}]*{)/g,r=t.innerHTML;if(-1===r.search(n))return;const i=this.query;if(/^[:#.][\w-]+$/.test(i)&&(t.innerHTML=r.replace(n,(e,t,n)=>`${t}${n}${i}`),t.firstElementChild))for(let e=t.children,n=0,r=e.length;n<r;++n)e[0].remove()}get children(){switch(this.type){case 1:if(this.children_.parentNode!==this.container){this.children_=r.undefined;for(let e=this.container.childNodes,t=0,n=e.length;t<n;++t){const n=e[t];if("wholeText"in n!=0){this.children_=n;break}}}return this.children_.data;default:return this.children_}}set children(e){const t=[],n=[];let s=!1;switch(this.type){case 0:return;case 1:{if(!this.isInit&&e===this.children)return;const t=this.children_,n=t.data,i=e;if(t.data=i,i===n)return;return void this.element.dispatchEvent(new r.Event("change",{bubbles:!1,cancelable:!0}))}case 2:{const r=e,i=[];this.children_=i;const o=this.container.children;for(let e=0;e<r.length;++e){const t=r[e],c=o[e];t.element.parentNode!==this.container&&u(t),t.element!==c&&(t.element.parentNode!==this.container&&(this.scope(t),n.push(t)),this.container.insertBefore(t.element,c),s=!0),i.push(t)}for(let e=o.length;r.length<e--;){const e=o[r.length];a.has(e)&&(t.push(l(this.container.removeChild(e))),s=!0)}break}case 3:{const r=e,o=this.children_;for(const e of i.ObjectKeys(o)){const i=o[e],a=r[e];if(this.isInit||a!==i){if(a.element.parentNode!==this.container&&u(a),(this.isInit||a!==i&&a.element.parentNode!==i.element.parentNode)&&(this.scope(a),n.push(a),!this.isInit)){let e=0;(e=t.lastIndexOf(a))>-1&&c.splice(t,e,1),t.push(i),(e=n.lastIndexOf(i))>-1&&c.splice(n,e,1)}this.isPartialUpdate=!0,o[e]=r[e],this.isPartialUpdate=!1,s=!0}}break}}if(t.length){const e=new r.Event("disconnect",{bubbles:!1,cancelable:!0});for(const{element:n}of t)n.dispatchEvent(e)}if(n.length){const e=new r.Event("connect",{bubbles:!1,cancelable:!0});for(const{element:t}of n)t.dispatchEvent(e)}s&&this.element.dispatchEvent(new r.Event("change",{bubbles:!1,cancelable:!0}))}}},{"./identity":11,"./util/dom":13,"spica/alias":3,"spica/array":4,"spica/global":5}],13:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.define=n.element=n.text=n.svg=n.html=n.frag=n.shadow=void 0;const r=e("spica/global"),i=e("spica/alias"),s=e("spica/memoize");var o;function c(e){return r.document.createTextNode(e)}function a(e,t){const n=s.memoize(l,(e,t,n)=>`${t}:${n}`);return(r,i,s)=>{const o=r.includes("-")?l(e,t,r):n(e,t,r).cloneNode(!0);return d(i)?f(o,i):f(u(o,i),s)}}function l(e,t,n){if(!("createElement"in e))throw new Error("TypedDOM: Scoped custom elements are not supported on this browser.");switch(t){case"HTML":return e.createElement(n);case"SVG":return e.createElementNS("http://www.w3.org/2000/svg",n)}}function u(e,t){if(!t)return e;for(const n of i.ObjectKeys(t)){const r=t[n];switch(typeof r){case"string":e.setAttribute(n,r);continue;case"function":if(n.length<3)throw new Error(`TypedDOM: Attribute names for event listeners must have an event name but got "${n}".`);if("on"!==n.slice(0,2))throw new Error(`TypedDOM: Attribute names for event listeners must start with "on" but got "${n}".`);e.addEventListener(n.slice(2),r,{passive:["wheel","mousewheel","touchstart","touchmove"].includes(n.slice(2))});continue;case"object":e.removeAttribute(n);continue;default:continue}}return e}function f(e,t){switch(typeof t){case"undefined":return e;case"string":return f(e,[t])}if(!i.isArray(t)){if(!("length"in t))return f(e,[...t]);const n=[];for(let e=0,r=t.length;e<r;++e)n.push(t[e]);return f(e,n)}const n=e.firstChild?e.childNodes:[];let r=n.length;if(0===r)return e.append(...t),e;let s=0;e:for(let i=0;i<t.length;++i){if(s===r)return e.append(...t.slice(i)),e;const o=t[i];if("object"==typeof o&&11===o.nodeType){const t=o.childNodes.length;r+=o!==e?t:0,e.insertBefore(o,n[s]||null),s+=t;continue}for(++s;r>t.length;){const e=n[s-1];if(h(e,o))continue e;e.remove(),--r}const a=n[s-1];h(a,o)||(r<t.length-i+s?(r+="string"==typeof o||o.parentNode!==e?1:0,e.insertBefore("string"==typeof o?c(o):o,a)):e.replaceChild("string"==typeof o?c(o):o,a))}for(;s<r;)n[s].remove(),--r;return e}function d(e){return!!(null==e?void 0:e[r.Symbol.iterator])}function h(e,t){return"string"==typeof t?"wholeText"in e&&e.data===t:e===t}!function(e){e.shadows=new WeakMap,e.fragment=r.document.createDocumentFragment()}(o||(o={})),n.shadow=function e(t,i,s){if("string"==typeof t)return e(n.html(t),i,s);if(i&&!d(i))return e(t,r.undefined,i);const c=s===r.undefined?t.shadowRoot||o.shadows.get(t):"open"===s.mode?t.shadowRoot||r.undefined:o.shadows.get(t);return f(s&&"open"!==s.mode?c||o.shadows.set(t,t.attachShadow(s)).get(t):c||t.attachShadow(s||{mode:"open"}),c||i!=r.undefined?i:t.childNodes)},n.frag=function(e){return f(o.fragment.cloneNode(!0),e)},n.html=a(r.document,"HTML"),n.svg=a(r.document,"SVG"),n.text=c,n.element=a,n.define=function(e,t,n){return d(t)?f(e,t):f(u(e,t),n)}},{"spica/alias":3,"spica/global":5,"spica/memoize":6}],14:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.bind=n.delegate=n.wait=n.once=n.listen=n.currentTarget=void 0;const r=e("spica/global"),i=e("spica/promise"),s=e("spica/noop");function o(e,t,n,r=!1,i={}){return"string"==typeof n?c(e,t,n,r,{..."boolean"==typeof i?{capture:i}:i,once:!0}):a(e,t,n,{..."boolean"==typeof r?{capture:r}:r,once:!0})}function c(e,t,n,i,c={}){let l=s.noop;return a(e,n,e=>{var s,a;l();const u=e.target.shadowRoot?null===(s=e.composedPath()[0])||void 0===s?void 0:s.closest(t):null===(a=e.target)||void 0===a?void 0:a.closest(t);return u?l=o(u,n,i,c):r.undefined,e.returnValue},{...c,capture:!0})}function a(e,t,i,o=!1){e.addEventListener(t,a,o);let c=()=>void e.removeEventListener(t,a,o);return()=>void(c=c()||s.noop);function a(e){return n.currentTarget in e&&!e[n.currentTarget]?r.undefined:e[n.currentTarget]=e.currentTarget,i(e)}}n.currentTarget=Symbol.for("currentTarget"),n.listen=function(e,t,n,r=!1,i={}){return"string"==typeof n?c(e,t,n,r,i):a(e,t,n,r)},n.once=o,n.wait=function(e,t,n=!1,r={}){return new i.AtomicPromise(i=>"string"==typeof n?o(e,t,n,i,r):o(e,t,i,n))},n.delegate=c,n.bind=a},{"spica/global":5,"spica/noop":7,"spica/promise":8}],15:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.apply=void 0;const r=e("./dom");n.apply=function(e,t,n){const i=e.querySelectorAll(t);for(let e=0,t=i.length;e<t;++e)r.define(i[e],n);return i}},{"./dom":13}],"typed-dom":[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.apply=n.currentTarget=n.bind=n.delegate=n.wait=n.once=n.listen=n.define=n.element=n.text=n.svg=n.html=n.frag=n.shadow=n.proxy=n.API=n.SVG=n.HTML=n.Shadow=void 0,e("spica/global");var r=e("./src/builder");Object.defineProperty(n,"Shadow",{enumerable:!0,get:function(){return r.Shadow}}),Object.defineProperty(n,"HTML",{enumerable:!0,get:function(){return r.HTML}}),Object.defineProperty(n,"SVG",{enumerable:!0,get:function(){return r.SVG}}),Object.defineProperty(n,"API",{enumerable:!0,get:function(){return r.API}});var i=e("./src/proxy");Object.defineProperty(n,"proxy",{enumerable:!0,get:function(){return i.proxy}});var s=e("./src/util/dom");Object.defineProperty(n,"shadow",{enumerable:!0,get:function(){return s.shadow}}),Object.defineProperty(n,"frag",{enumerable:!0,get:function(){return s.frag}}),Object.defineProperty(n,"html",{enumerable:!0,get:function(){return s.html}}),Object.defineProperty(n,"svg",{enumerable:!0,get:function(){return s.svg}}),Object.defineProperty(n,"text",{enumerable:!0,get:function(){return s.text}}),Object.defineProperty(n,"element",{enumerable:!0,get:function(){return s.element}}),Object.defineProperty(n,"define",{enumerable:!0,get:function(){return s.define}});var o=e("./src/util/listener");Object.defineProperty(n,"listen",{enumerable:!0,get:function(){return o.listen}}),Object.defineProperty(n,"once",{enumerable:!0,get:function(){return o.once}}),Object.defineProperty(n,"wait",{enumerable:!0,get:function(){return o.wait}}),Object.defineProperty(n,"delegate",{enumerable:!0,get:function(){return o.delegate}}),Object.defineProperty(n,"bind",{enumerable:!0,get:function(){return o.bind}}),Object.defineProperty(n,"currentTarget",{enumerable:!0,get:function(){return o.currentTarget}});var c=e("./src/util/query");Object.defineProperty(n,"apply",{enumerable:!0,get:function(){return c.apply}})},{"./src/builder":10,"./src/proxy":12,"./src/util/dom":13,"./src/util/listener":14,"./src/util/query":15,"spica/global":5}]},{},[1,"typed-dom",2]),function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof module&&module.exports&&(module.exports=t())}("undefined"!=typeof self&&self,function(){return require("typed-dom")});
{
"name": "typed-dom",
"version": "0.0.202",
"version": "0.0.203",
"description": "A DOM component builder creating type-level DOM structures.",

@@ -12,9 +12,9 @@ "private": false,

"keywords": [
"type",
"dom",
"component",
"html",
"shadow dom",
"custom element",
"css",
"css-in-js",
"typed",
"typing"
"web component"
],

@@ -36,3 +36,3 @@ "files": [

"@types/i18next": "^13.0.0",
"@types/mocha": "^8.0.3",
"@types/mocha": "^8.2.0",
"@types/power-assert": "1.5.3",

@@ -45,3 +45,3 @@ "browserify": "^17.0.0",

"gulp-header": "^2.0.9",
"gulp-load-plugins": "^2.0.5",
"gulp-load-plugins": "^2.0.6",
"gulp-minify": "^3.1.0",

@@ -61,7 +61,7 @@ "gulp-mocha": "^7.0.2",

"mocha": "^8.2.1",
"npm-check-updates": "^10.0.0",
"npm-check-updates": "^10.2.5",
"power-assert": "^1.6.1",
"spica": "0.0.382",
"spica": "0.0.404",
"tsify": "^5.0.2",
"typescript": "4.2.0-dev.20201109",
"typescript": "4.2.0-dev.20201222",
"vinyl-buffer": "^1.0.1",

@@ -68,0 +68,0 @@ "vinyl-source-stream": "^2.0.0"

import { uuid } from 'spica/uuid';
const id = uuid().split('-').pop()!;
const unique = uuid().split('-').pop()!;
let counter = 0;
export function uid(): string {
return `id-${id}-${++counter}`;
export function id(): string {
return `id-${unique}-${++counter}`;
}
import { undefined, WeakMap, Event } from 'spica/global';
import { isArray, ObjectDefineProperties, ObjectKeys } from 'spica/alias';
import { uid } from './identity';
import { id } from './identity';
import { text, define } from './util/dom';

@@ -111,3 +111,3 @@ import { Mutable } from 'spica/type';

if (this.id_) return this.id_;
this.id_ = uid();
this.id_ = id();
assert(!this.element.classList.contains(this.id_));

@@ -114,0 +114,0 @@ this.element.classList.add(this.id_);

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc