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.195 to 0.0.196

6

dist/typed-dom.js

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

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

@@ -1077,5 +1077,5 @@ function r(e, n, t) {

const sourceLength = newChild.childNodes.length;
targetLength += newChild !== node ? sourceLength : 0;
node.insertBefore(newChild, targetNodes[count] || null);
count += sourceLength;
targetLength += sourceLength;
continue;

@@ -1095,4 +1095,4 @@ }

if (targetLength < children.length - i + count) {
targetLength += typeof newChild === 'string' || newChild.parentNode !== node ? 1 : 0;
node.insertBefore(typeof newChild === 'string' ? text(newChild) : newChild, oldChild);
++targetLength;
} else {

@@ -1099,0 +1099,0 @@ node.replaceChild(typeof newChild === 'string' ? text(newChild) : newChild, oldChild);

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

/*! typed-dom v0.0.195 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 u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){return i(t[o][1][e]||e)},l,l.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(e,t,n){"use strict";const r="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||Function("return this")();r.global=r,t.exports=r},{}],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 u;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(l(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(!l(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(l(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 u{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(!l(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 l(e){return null!==e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then}function f(e){return c in e}n.Internal=u,n.isPromiseLike=l},{"./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(u,l,f){if("function"==typeof u)return a(r.undefined,r.undefined,u);if("function"==typeof l)return a(u,r.undefined,l);if(u!==r.undefined&&function(e){return"object"!=typeof e||i.ObjectValues(e).slice(-1).every(e=>"object"==typeof e)}(u))return a(r.undefined,u,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,u,l));return 1===d.nodeType?new s.Elem(d,l):new s.Elem(d.host,l,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 u(e){const t=a.get(e);if(t)return t;throw new Error("TypedDOM: This element has no proxy.")}n.proxy=u;Symbol.for("typed-dom/tag");function l({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(l(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];l(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&&l(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(u(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&&l(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(u,(e,t,n)=>`${t}:${n}`);return(r,i,s)=>{const o=r.includes("-")?u(e,t,r):n(e,t,r).cloneNode(!0);return d(i)?f(o,i):f(l(o,i),s)}}function u(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 l(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;e.insertBefore(o,n[s]||null),s+=t,r+=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?(e.insertBefore("string"==typeof o?c(o):o,a),++r):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(l(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 u=s.noop;return a(e,n,e=>{var s,a;u();const l=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 l?u=o(l,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}),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.196 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 u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){return i(t[o][1][e]||e)},l,l.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(e,t,n){"use strict";const r="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||Function("return this")();r.global=r,t.exports=r},{}],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 u;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(l(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(!l(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(l(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 u{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(!l(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 l(e){return null!==e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then}function f(e){return c in e}n.Internal=u,n.isPromiseLike=l},{"./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(u,l,f){if("function"==typeof u)return a(r.undefined,r.undefined,u);if("function"==typeof l)return a(u,r.undefined,l);if(u!==r.undefined&&function(e){return"object"!=typeof e||i.ObjectValues(e).slice(-1).every(e=>"object"==typeof e)}(u))return a(r.undefined,u,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,u,l));return 1===d.nodeType?new s.Elem(d,l):new s.Elem(d.host,l,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 u(e){const t=a.get(e);if(t)return t;throw new Error("TypedDOM: This element has no proxy.")}n.proxy=u;Symbol.for("typed-dom/tag");function l({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(l(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];l(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&&l(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(u(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&&l(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(u,(e,t,n)=>`${t}:${n}`);return(r,i,s)=>{const o=r.includes("-")?u(e,t,r):n(e,t,r).cloneNode(!0);return d(i)?f(o,i):f(l(o,i),s)}}function u(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 l(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(l(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 u=s.noop;return a(e,n,e=>{var s,a;u();const l=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 l?u=o(l,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}),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.195",
"version": "0.0.196",
"description": "A DOM component builder creating type-level DOM structures.",

@@ -51,3 +51,3 @@ "private": false,

"karma-coverage-istanbul-instrumenter": "^1.0.3",
"karma-coverage-istanbul-reporter": "^3.0.2",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-coveralls": "^2.1.0",

@@ -63,3 +63,3 @@ "karma-espower-preprocessor": "^1.2.0",

"tsify": "^4.0.1",
"typescript": "4.0.0-dev.20200526",
"typescript": "4.0.0-dev.20200530",
"vinyl-buffer": "^1.0.1",

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

import { shadow, frag, html, svg, text, define } from './dom';
import { HTML, SVG } from '../builder';
import { Sequence } from 'spica/sequence';

@@ -65,4 +66,16 @@ describe('Unit: util/dom', () => {

it('update', () => {
const el = html('span');
const es = Sequence.from([html('span', '1'), html('span', '2'), html('span', '3')]);
Sequence.from([
...es.permutations(),
...es.permutations().bind(es => Sequence.from(es).subsequences()),
])
.extract()
.forEach(es =>
assert.deepStrictEqual([...define(el, es).children], es));
});
});
});

@@ -148,5 +148,7 @@ import { undefined, Symbol, document } from 'spica/global';

const sourceLength = newChild.childNodes.length;
targetLength += newChild !== node
? sourceLength
: 0;
node.insertBefore(newChild, targetNodes[count] || null);
count += sourceLength;
targetLength += sourceLength;
continue;

@@ -164,4 +166,6 @@ }

if (targetLength < children.length - i + count) {
targetLength += typeof newChild === 'string' || newChild.parentNode !== node
? 1
: 0;
node.insertBefore(typeof newChild === 'string' ? text(newChild) : newChild, oldChild);
++targetLength;
}

@@ -168,0 +172,0 @@ else {

@@ -104,28 +104,14 @@ import { Shadow, HTML, SVG, API, El, proxy, shadow, frag, html, define } from '../../index';

// property test
const ss = Array(3).fill(0).map(() => HTML.li(``));
void Sequence.zip(
Sequence.cycle([[...Array(3).fill(0).map(() => HTML.li(``)), ...ss]]),
Sequence.cycle([[...Array(3).fill(0).map(() => HTML.li(``)), ...ss]]))
.take(1000)
.map(lss =>
lss
.map(ls =>
_.shuffle(ls.slice(-ls.length % (Math.random() * ls.length | 0)))))
// exhaustive test
const el = HTML.ul([HTML.li('')]);
const es = Sequence.from([HTML.li('1'), HTML.li('2'), HTML.li('3')]);
el.children = [];
Sequence.from([
...es.permutations(),
...es.permutations().bind(es => Sequence.from(es).subsequences()),
])
.extract()
.forEach(([os, ns]) => {
dom.children = os;
Sequence.zip(
Sequence.from(Array.from(dom.element.children)),
Sequence.from(os.map(({ element }) => element)))
.extract()
.forEach(([a, b]) =>
void assert(a === b));
dom.children = ns;
Sequence.zip(
Sequence.from(Array.from(dom.element.children)),
Sequence.from(ns.map(({ element }) => element)))
.extract()
.forEach(([a, b]) =>
void assert(a === b));
.forEach(es => {
el.children = es;
assert.deepStrictEqual(el.children, es);
});

@@ -132,0 +118,0 @@ });

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