closures 0.7.9 → 0.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/closures.cjs CHANGED
@@ -37,15 +37,16 @@ let NIL = void 0,
37
37
  REF_ARRAY = 4, // ref with array of nodes
38
38
  REF_PARENT = 8, // ref with a child ref
39
39
  RETAIN_KEY = '=',
40
- hasKey = vnode => vnode && vnode.key !== NIL && vnode.key !== null,
41
- haveMatchingKeys = (x, y) => (x === null || x === NIL ? NIL : x.key) === (y === null || y === NIL ? NIL : y.key),
40
+ exists = x => x !== null && x !== undefined,
41
+ hasKey = vnode => vnode && exists(vnode.key),
42
+ haveMatchingKeys = (x, y) => (!exists(x) ? NIL : x.key) === (!exists(y) ? NIL : y.key),
42
43
  generateClosureId = _ => NUM++,
43
44
  isFn = x => typeof x === 'function',
44
45
  isStr = x => typeof x === 'string',
45
46
  isObj = x => x !== null && typeof x === 'object',
46
47
  isArr = x => Array.isArray(x),
47
48
  toJson = v => JSON.stringify(v),
48
- isEmpty = c => c === null || c === false || c === NIL || (isArr(c) && c.length === 0) || (c && c._t === RETAIN_KEY),
49
+ isEmpty = c => !exists(c) || c === false || (isArr(c) && c.length === 0) || (c && c._t === RETAIN_KEY),
49
50
  isNonEmptyArray = c => isArr(c) && c.length > 0,
50
51
  isLeaf = c => isStr(c) || typeof c === 'number',
51
52
  isElement = c => c && c.vtype === VTYPE_ELEMENT,
@@ -93,8 +94,7 @@ let replaceDom = (parent, newRef, oldRef) => {
93
94
  };
94
95
 
95
96
  let setDomAttribute = (el, attr, value, isSVG) => {
96
- if (attr === 'className') attr = 'class';
97
- if (value === NIL) value = '';
97
+ if (!exists(value)) value = '';
98
98
  if (value === true) el.setAttribute(attr, '');
99
99
  else if (value === false) el.removeAttribute(attr);
100
100
  else (isSVG && NS_ATTRS[attr])
@@ -515,13 +515,30 @@ function h(_t, ...children) {
515
515
  ? { ...props, children: children[0] }
516
516
  : props;
517
517
 
518
- // inline class parsing
519
- if (isStr(_t) && ~(idx = _t.indexOf('.'))) {
520
- let classProp = props.class || props.className,
521
- className = _t.slice(idx + 1).replace(/\./g, ' ') + (classProp ? ' ' + classProp : '');
518
+ if (isStr(_t)) {
519
+ if (props.className && !props.class) {
520
+ props.class = props.className;
521
+ delete props.className;
522
+ }
523
+
524
+ // class parsing
525
+ if (isObj(props.class)) {
526
+ let k, tmp = '';
527
+
528
+ for (k in props.class)
529
+ if (props.class[k]) {
530
+ tmp && (tmp += ' ');
531
+ tmp += k
532
+ }
522
533
 
523
- if (className) props.class = className;
524
- _t = _t.slice(0, idx);
534
+ props.class = tmp;
535
+ }
536
+
537
+ if (~(idx = _t.indexOf('.'))) {
538
+ let className = _t.slice(idx + 1).replace(/\./g, ' ') + (props.class ? ' ' + props.class : '');
539
+ if (className) props.class = className;
540
+ _t = _t.slice(0, idx);
541
+ }
525
542
  }
526
543
 
527
544
  if (props.key !== props.key) throw new Error("Invalid NaN key");
package/dist/closures.js CHANGED
@@ -37,15 +37,16 @@ let NIL = void 0,
37
37
  REF_ARRAY = 4, // ref with array of nodes
38
38
  REF_PARENT = 8, // ref with a child ref
39
39
  RETAIN_KEY = '=',
40
- hasKey = vnode => vnode && vnode.key !== NIL && vnode.key !== null,
41
- haveMatchingKeys = (x, y) => (x === null || x === NIL ? NIL : x.key) === (y === null || y === NIL ? NIL : y.key),
40
+ exists = x => x !== null && x !== undefined,
41
+ hasKey = vnode => vnode && exists(vnode.key),
42
+ haveMatchingKeys = (x, y) => (!exists(x) ? NIL : x.key) === (!exists(y) ? NIL : y.key),
42
43
  generateClosureId = _ => NUM++,
43
44
  isFn = x => typeof x === 'function',
44
45
  isStr = x => typeof x === 'string',
45
46
  isObj = x => x !== null && typeof x === 'object',
46
47
  isArr = x => Array.isArray(x),
47
48
  toJson = v => JSON.stringify(v),
48
- isEmpty = c => c === null || c === false || c === NIL || (isArr(c) && c.length === 0) || (c && c._t === RETAIN_KEY),
49
+ isEmpty = c => !exists(c) || c === false || (isArr(c) && c.length === 0) || (c && c._t === RETAIN_KEY),
49
50
  isNonEmptyArray = c => isArr(c) && c.length > 0,
50
51
  isLeaf = c => isStr(c) || typeof c === 'number',
51
52
  isElement = c => c && c.vtype === VTYPE_ELEMENT,
@@ -93,8 +94,7 @@ let replaceDom = (parent, newRef, oldRef) => {
93
94
  };
94
95
 
95
96
  let setDomAttribute = (el, attr, value, isSVG) => {
96
- if (attr === 'className') attr = 'class';
97
- if (value === NIL) value = '';
97
+ if (!exists(value)) value = '';
98
98
  if (value === true) el.setAttribute(attr, '');
99
99
  else if (value === false) el.removeAttribute(attr);
100
100
  else (isSVG && NS_ATTRS[attr])
@@ -515,13 +515,30 @@ export function h(_t, ...children) {
515
515
  ? { ...props, children: children[0] }
516
516
  : props;
517
517
 
518
- // inline class parsing
519
- if (isStr(_t) && ~(idx = _t.indexOf('.'))) {
520
- let classProp = props.class || props.className,
521
- className = _t.slice(idx + 1).replace(/\./g, ' ') + (classProp ? ' ' + classProp : '');
518
+ if (isStr(_t)) {
519
+ if (props.className && !props.class) {
520
+ props.class = props.className;
521
+ delete props.className;
522
+ }
523
+
524
+ // class parsing
525
+ if (isObj(props.class)) {
526
+ let k, tmp = '';
527
+
528
+ for (k in props.class)
529
+ if (props.class[k]) {
530
+ tmp && (tmp += ' ');
531
+ tmp += k
532
+ }
522
533
 
523
- if (className) props.class = className;
524
- _t = _t.slice(0, idx);
534
+ props.class = tmp;
535
+ }
536
+
537
+ if (~(idx = _t.indexOf('.'))) {
538
+ let className = _t.slice(idx + 1).replace(/\./g, ' ') + (props.class ? ' ' + props.class : '');
539
+ if (className) props.class = className;
540
+ _t = _t.slice(0, idx);
541
+ }
525
542
  }
526
543
 
527
544
  if (props.key !== props.key) throw new Error("Invalid NaN key");
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.closures={})}(this,(function(e){let t=void 0,r=e=>{},n=e=>({mount(t,r=""){t[e]=r},patch(t,r="",n){r!==n&&(t[e]=r)},unmount(r){r[e]=t}}),i={isSVG:!1,redraw:r,directives:{selected:n("selected"),checked:n("checked"),value:n("value"),innerHTML:n("innerHTML")}},o=[],l=[],d=new WeakMap,c=1,s={},f="http://www.w3.org/1999/xlink",h={show:f,actuate:f,href:f},u=e=>e&&e.key!==t&&null!==e.key,p=(e,r)=>(null===e||e===t?t:e.key)===(null===r||r===t?t:r.key),a=e=>"function"==typeof e,y=e=>"string"==typeof e,v=e=>null!==e&&"object"==typeof e,w=e=>Array.isArray(e),m=e=>JSON.stringify(e),g=e=>null===e||!1===e||e===t||w(e)&&0===e.length||e&&"="===e._t,k=e=>w(e)&&e.length>0,R=e=>y(e)||"number"==typeof e,_=e=>e&&1===e.vtype,S=e=>e&&2===e.vtype,E=e=>{let t=e.type;if(1===t)return e.node;if(8===t)return E(e.childRef);if(4===t)return E(e.children[0]);throw Error("Unknown ref type "+m(e))},N=e=>{let t=e.type;if(1===t)return e.node.nextSibling;if(8===t)return N(e.childRef);if(4===t)return N(e.children[e.children.length-1]);throw Error("Unknown ref type "+m(e))},x=(e,t,r)=>{let n=t.type;if(1===n)e.insertBefore(t.node,r);else if(8===n)x(e,t.childRef,r);else{if(4!==n)throw Error("Unknown ref type "+m(t));for(let n=0;n<t.children.length;n++)x(e,t.children[n],r)}},V=(e,t)=>{let r=t.type;if(1===r)e.removeChild(t.node);else if(8===r)V(e,t.childRef);else{if(4!==r)throw Error("Unknown ref type "+m(t));for(let r=0;r<t.children.length;r++)V(e,t.children[r])}},b=(e,r,n,i)=>{"className"===r&&(r="class"),n===t&&(n=""),!0===n?e.setAttribute(r,""):!1===n?e.removeAttribute(r):i&&h[r]?e.setAttributeNS(h[r],r,n):e.setAttribute(r,n)},A=(e,n,i,o,s=r)=>{let f={closureId:i,closure:o,onRemove:s};if(g(e))return{...f,type:1,node:document.createTextNode("")};if(R(e))return{...f,type:1,node:document.createTextNode(e)};if(_(e)){let r,{_t:i,props:o}=e;"svg"!==i||n.isSVG||(n={...n,isSVG:!0}),r=n.isSVG?document.createElementNS("http://www.w3.org/2000/svg",i):document.createElement(i),a(o.oncreate)&&o.oncreate(r),((e,t,r)=>{for(let n in t)"key"===n||"children"===n||"oncreate"===n||n in r.directives||(n.startsWith("on")?e[n.toLowerCase()]=e=>{t[n](e),!r.manualRedraw&&r.rerender()}:b(e,n,t[n],r.isSVG))})(r,o,n);let l=o.children===t?o.children:A(o.children,n);return l!==t&&x(r,l),((e,t,r)=>{for(let n in t)n in r.directives&&r.directives[n].mount(e,t[n])})(r,o,n),{...f,type:1,node:r,children:l}}if(k(e)){let t=0,r=[];for(;t<e.length;t++)r.push(A(e[t],n));return{...f,type:4,children:r}}if(S(e)){let t=e._t(e.props);if(a(t)){let i=c++,o=d.get(e._t)||new Map,s=l.pop()||r;o.set(i,t),d.set(e._t,o);let f=e._t;return e._t=t,A(e,n,i,f,s)}return{...f,type:8,childRef:A(t,n),childState:t}}if(e instanceof Node)return{...f,type:1,node:e};if(e===t)throw Error("mount: vnode is undefined");throw Error("mount: Invalid vnode")},G=(e,r,n)=>{if(_(e))((e,t,r)=>{for(let n in t)n in r.directives&&r.directives[n].unmount(e,t[n])})(r.node,e.props,n),e.props.children!==t&&G(e.props.children,r.children,n);else if(k(e))for(let t=0;t<e.length;t++)G(e[t],r.children[t],n);else if(S(e)){let e=r.closure,t=r.closureId,i=r.onRemove,o=d.get(e);o&&t&&o.get(t)&&(o.delete(t),!o.size&&d.delete(e),i()),G(r.childState,r.childRef,n)}},C=(e,t,r,n,i)=>{let o=I(e,t,r,n,i);return o!==n&&(((e,t,r)=>{x(e,t,E(r)),V(e,r)})(e,o,n),G(r,n,i)),o},I=(e,r,n,o,l={...i})=>{if(r&&"="===r._t)return o;let c,s;if(v(o)&&(c=o.closure,s=o.closureId),S(r)&&S(n)&&(r._t===n._t||c&&s)){let t,n=r._t,i=d.get(c);i&&s&&(t=i.get(s))&&(n=t);let f=n(r.props),h=I(e,f,o.childState,o.childRef,l);return h!==o.childRef?{type:8,childRef:h,childState:f}:(o.childState=f,o)}if(n===r||g(r)&&g(n))return o;if(R(r)&&R(n))return o.node.nodeValue=r,o;if(_(r)&&_(n)&&r._t===n._t){"svg"!==r._t||l.isSVG||(l={...l,isSVG:!0}),((e,r,n,i)=>{let o;for(o in r){if("key"===o||"children"===o||"oncreate"===o||o in i.directives)continue;let t=n[o],l=r[o];t!==l&&(o.startsWith("on")?e[o.toLowerCase()]=e=>{l(e),!i.manualRedraw&&i.rerender()}:b(e,o,l,i.isSVG))}for(o in n)"key"===o||"children"===o||o in r||o in i.directives||(o.startsWith("on")?e[o.toLowerCase()]=t:e.removeAttribute(o))})(o.node,r.props,n.props,l);let e=n.props.children,i=r.props.children;return e===t?i!==t&&(o.children=A(i,l),x(o.node,o.children)):i===t?(o.node.textContent="",G(e,o.children,l),o.children=t):o.children=C(o.node,i,e,o.children,l),((e,t,r,n)=>{let i;for(i in t)i in n.directives&&n.directives[i].patch(e,t[i],r[i]);for(i in r)i in n.directives&&!(i in t)&&n.directives[i].unmount(e,r[i])})(o.node,r.props,n.props,l),o}return k(r)&&k(n)?(((e,r,n,i,o)=>{let l,d,c,s,f,h=N(i),a=Array(r.length),y=i.children,v=0,w=0,m=r.length-1,g=n.length-1;for(;v<=m&&w<=g;){if(y[w]===t){w++;continue}if(y[g]===t){g--;continue}if(l=n[w],d=r[v],p(d,l)){c=y[w],s=a[v]=C(e,d,l,c,o),v++,w++;continue}if(l=n[g],d=r[m],p(d,l)){c=y[g],s=a[m]=C(e,d,l,c,o),m--,g--;continue}if(!f){f={};for(let e=w;e<=g;e++)l=n[e],u(l)&&(f[l.key]=e)}d=r[v];let i=u(d)?f[d.key]:t;i!==t?(l=n[i],c=y[i],s=a[v]=I(e,d,l,c,o),x(e,s,E(y[w])),s!==c&&(V(e,c),G(l,c,o)),y[i]=t):(s=a[v]=A(d,o),x(e,s,E(y[w]))),v++}let k=m<r.length-1?E(a[m+1]):h;for(;v<=m;){let t=A(r[v],o);a[v]=t,x(e,t,k),v++}for(;w<=g;)c=y[w],c!==t&&(V(e,c),G(n[w],c,o)),w++;i.children=a})(e,r,n,o,l),o):r instanceof Node&&n instanceof Node?(o.node=r,o):A(r,l)};function L(e,...r){let n,i=r[0];if(!i||!v(i)||w(i)||i._t||i.props?i=s:r.shift(),i=r.length>1?{...i,children:r}:1===r.length?{...i,children:r[0]}:i,y(e)&&~(n=e.indexOf("."))){let t=i.class||i.className,r=e.slice(n+1).replace(/\./g," ")+(t?" "+t:"");r&&(i.class=r),e=e.slice(0,n)}if(i.key!=i.key)throw new Error("Invalid NaN key");let o=y(e)?1:a(e)?2:t;if(o===t)throw new Error("Invalid VNode type");return{vtype:o,_t:e,key:i.key,props:i}}L.retain=e=>L("=");const M=L;e.Fragment=e=>e.children,e.app=function(e,r,n={}){let l,d={...i,manualRedraw:n.manualRedraw},c=r.$_REF;if(d.directives={...d.directives,...n.directives||{}},c!==t)throw Error("App already mounted on this node");return l=A(e,d),c=r.$_REF={ref:l,vnode:e},r.textContent="",x(r,l,t),o.push(d.rerender=(t=e)=>{c.ref=C(r,t,c.vnode,c.ref,d),c.vnode=t})&&d.rerender},e.h=L,e.m=M,e.onRemove=e=>l.push(e),e.redraw=e=>{for(let e=0;e<o.length;e++)o[e]()}}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.closures={})}(this,(function(e){let t=void 0,r=e=>{},n=e=>({mount(t,r=""){t[e]=r},patch(t,r="",n){r!==n&&(t[e]=r)},unmount(r){r[e]=t}}),i={isSVG:!1,redraw:r,directives:{selected:n("selected"),checked:n("checked"),value:n("value"),innerHTML:n("innerHTML")}},o=[],l=[],d=new WeakMap,c=1,s={},f="http://www.w3.org/1999/xlink",h={show:f,actuate:f,href:f},u=e=>null!=e,a=e=>e&&u(e.key),p=(e,r)=>(u(e)?e.key:t)===(u(r)?r.key:t),y=e=>"function"==typeof e,v=e=>"string"==typeof e,w=e=>null!==e&&"object"==typeof e,m=e=>Array.isArray(e),g=e=>JSON.stringify(e),k=e=>!u(e)||!1===e||m(e)&&0===e.length||e&&"="===e._t,R=e=>m(e)&&e.length>0,_=e=>v(e)||"number"==typeof e,S=e=>e&&1===e.vtype,N=e=>e&&2===e.vtype,E=e=>{let t=e.type;if(1===t)return e.node;if(8===t)return E(e.childRef);if(4===t)return E(e.children[0]);throw Error("Unknown ref type "+g(e))},x=e=>{let t=e.type;if(1===t)return e.node.nextSibling;if(8===t)return x(e.childRef);if(4===t)return x(e.children[e.children.length-1]);throw Error("Unknown ref type "+g(e))},V=(e,t,r)=>{let n=t.type;if(1===n)e.insertBefore(t.node,r);else if(8===n)V(e,t.childRef,r);else{if(4!==n)throw Error("Unknown ref type "+g(t));for(let n=0;n<t.children.length;n++)V(e,t.children[n],r)}},b=(e,t)=>{let r=t.type;if(1===r)e.removeChild(t.node);else if(8===r)b(e,t.childRef);else{if(4!==r)throw Error("Unknown ref type "+g(t));for(let r=0;r<t.children.length;r++)b(e,t.children[r])}},A=(e,t,r,n)=>{u(r)||(r=""),!0===r?e.setAttribute(t,""):!1===r?e.removeAttribute(t):n&&h[t]?e.setAttributeNS(h[t],t,r):e.setAttribute(t,r)},G=(e,n,i,o,s=r)=>{let f={closureId:i,closure:o,onRemove:s};if(k(e))return{...f,type:1,node:document.createTextNode("")};if(_(e))return{...f,type:1,node:document.createTextNode(e)};if(S(e)){let r,{_t:i,props:o}=e;"svg"!==i||n.isSVG||(n={...n,isSVG:!0}),r=n.isSVG?document.createElementNS("http://www.w3.org/2000/svg",i):document.createElement(i),y(o.oncreate)&&o.oncreate(r),((e,t,r)=>{for(let n in t)"key"===n||"children"===n||"oncreate"===n||n in r.directives||(n.startsWith("on")?e[n.toLowerCase()]=e=>{t[n](e),!r.manualRedraw&&r.rerender()}:A(e,n,t[n],r.isSVG))})(r,o,n);let l=o.children===t?o.children:G(o.children,n);return l!==t&&V(r,l),((e,t,r)=>{for(let n in t)n in r.directives&&r.directives[n].mount(e,t[n])})(r,o,n),{...f,type:1,node:r,children:l}}if(R(e)){let t=0,r=[];for(;t<e.length;t++)r.push(G(e[t],n));return{...f,type:4,children:r}}if(N(e)){let t=e._t(e.props);if(y(t)){let i=c++,o=d.get(e._t)||new Map,s=l.pop()||r;o.set(i,t),d.set(e._t,o);let f=e._t;return e._t=t,G(e,n,i,f,s)}return{...f,type:8,childRef:G(t,n),childState:t}}if(e instanceof Node)return{...f,type:1,node:e};if(e===t)throw Error("mount: vnode is undefined");throw Error("mount: Invalid vnode")},C=(e,r,n)=>{if(S(e))((e,t,r)=>{for(let n in t)n in r.directives&&r.directives[n].unmount(e,t[n])})(r.node,e.props,n),e.props.children!==t&&C(e.props.children,r.children,n);else if(R(e))for(let t=0;t<e.length;t++)C(e[t],r.children[t],n);else if(N(e)){let e=r.closure,t=r.closureId,i=r.onRemove,o=d.get(e);o&&t&&o.get(t)&&(o.delete(t),!o.size&&d.delete(e),i()),C(r.childState,r.childRef,n)}},I=(e,t,r,n,i)=>{let o=L(e,t,r,n,i);return o!==n&&(((e,t,r)=>{V(e,t,E(r)),b(e,r)})(e,o,n),C(r,n,i)),o},L=(e,r,n,o,l={...i})=>{if(r&&"="===r._t)return o;let c,s;if(w(o)&&(c=o.closure,s=o.closureId),N(r)&&N(n)&&(r._t===n._t||c&&s)){let t,n=r._t,i=d.get(c);i&&s&&(t=i.get(s))&&(n=t);let f=n(r.props),h=L(e,f,o.childState,o.childRef,l);return h!==o.childRef?{type:8,childRef:h,childState:f}:(o.childState=f,o)}if(n===r||k(r)&&k(n))return o;if(_(r)&&_(n))return o.node.nodeValue=r,o;if(S(r)&&S(n)&&r._t===n._t){"svg"!==r._t||l.isSVG||(l={...l,isSVG:!0}),((e,r,n,i)=>{let o;for(o in r){if("key"===o||"children"===o||"oncreate"===o||o in i.directives)continue;let t=n[o],l=r[o];t!==l&&(o.startsWith("on")?e[o.toLowerCase()]=e=>{l(e),!i.manualRedraw&&i.rerender()}:A(e,o,l,i.isSVG))}for(o in n)"key"===o||"children"===o||o in r||o in i.directives||(o.startsWith("on")?e[o.toLowerCase()]=t:e.removeAttribute(o))})(o.node,r.props,n.props,l);let e=n.props.children,i=r.props.children;return e===t?i!==t&&(o.children=G(i,l),V(o.node,o.children)):i===t?(o.node.textContent="",C(e,o.children,l),o.children=t):o.children=I(o.node,i,e,o.children,l),((e,t,r,n)=>{let i;for(i in t)i in n.directives&&n.directives[i].patch(e,t[i],r[i]);for(i in r)i in n.directives&&!(i in t)&&n.directives[i].unmount(e,r[i])})(o.node,r.props,n.props,l),o}return R(r)&&R(n)?(((e,r,n,i,o)=>{let l,d,c,s,f,h=x(i),u=Array(r.length),y=i.children,v=0,w=0,m=r.length-1,g=n.length-1;for(;v<=m&&w<=g;){if(y[w]===t){w++;continue}if(y[g]===t){g--;continue}if(l=n[w],d=r[v],p(d,l)){c=y[w],s=u[v]=I(e,d,l,c,o),v++,w++;continue}if(l=n[g],d=r[m],p(d,l)){c=y[g],s=u[m]=I(e,d,l,c,o),m--,g--;continue}if(!f){f={};for(let e=w;e<=g;e++)l=n[e],a(l)&&(f[l.key]=e)}d=r[v];let i=a(d)?f[d.key]:t;i!==t?(l=n[i],c=y[i],s=u[v]=L(e,d,l,c,o),V(e,s,E(y[w])),s!==c&&(b(e,c),C(l,c,o)),y[i]=t):(s=u[v]=G(d,o),V(e,s,E(y[w]))),v++}let k=m<r.length-1?E(u[m+1]):h;for(;v<=m;){let t=G(r[v],o);u[v]=t,V(e,t,k),v++}for(;w<=g;)c=y[w],c!==t&&(b(e,c),C(n[w],c,o)),w++;i.children=u})(e,r,n,o,l),o):r instanceof Node&&n instanceof Node?(o.node=r,o):G(r,l)};function M(e,...r){let n,i=r[0];if(!i||!w(i)||m(i)||i._t||i.props?i=s:r.shift(),i=r.length>1?{...i,children:r}:1===r.length?{...i,children:r[0]}:i,v(e)){if(i.className&&!i.class&&(i.class=i.className,delete i.className),w(i.class)){let e,t="";for(e in i.class)i.class[e]&&(t&&(t+=" "),t+=e);i.class=t}if(~(n=e.indexOf("."))){let t=e.slice(n+1).replace(/\./g," ")+(i.class?" "+i.class:"");t&&(i.class=t),e=e.slice(0,n)}}if(i.key!=i.key)throw new Error("Invalid NaN key");let o=v(e)?1:y(e)?2:t;if(o===t)throw new Error("Invalid VNode type");return{vtype:o,_t:e,key:i.key,props:i}}M.retain=e=>M("=");const T=M;e.Fragment=e=>e.children,e.app=function(e,r,n={}){let l,d={...i,manualRedraw:n.manualRedraw},c=r.$_REF;if(d.directives={...d.directives,...n.directives||{}},c!==t)throw Error("App already mounted on this node");return l=G(e,d),c=r.$_REF={ref:l,vnode:e},r.textContent="",V(r,l,t),o.push(d.rerender=(t=e)=>{c.ref=I(r,t,c.vnode,c.ref,d),c.vnode=t})&&d.rerender},e.h=M,e.m=T,e.onRemove=e=>l.push(e),e.redraw=e=>{for(let e=0;e<o.length;e++)o[e]()}}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "closures",
3
- "version": "0.7.9",
3
+ "version": "0.7.10",
4
4
  "description": "Minimalist virtual dom library",
5
5
  "type": "module",
6
6
  "main": "dist/closures.cjs",