Comparing version 2.0.0-alpha.3 to 2.0.0-alpha.4
39
extra.js
@@ -1,5 +0,11 @@ | ||
import ease from 'rx-ease'; | ||
import { BehaviorSubject, Observable, combineLatest, from, of } from 'rxjs'; | ||
import { map } from 'rxjs/operators'; | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var ease = _interopDefault(require('rx-ease')); | ||
var rxjs = require('rxjs'); | ||
var operators = require('rxjs/operators'); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
@@ -205,3 +211,3 @@ return typeof obj; | ||
var toObservable = function toObservable(x) { | ||
return isObservable(x) ? x : of(x); | ||
return isObservable(x) ? x : rxjs.of(x); | ||
}; | ||
@@ -212,3 +218,3 @@ | ||
return new Observable(function (observer) { | ||
return new rxjs.Observable(function (observer) { | ||
var isOuterStreamComplete = false; | ||
@@ -253,3 +259,3 @@ var isInnerStreamComplete = false; | ||
var all = function all(obs) { | ||
return obs.length ? combineLatest.apply(undefined, toConsumableArray(obs.map(toObservable)).concat([function () { | ||
return obs.length ? rxjs.combineLatest.apply(undefined, toConsumableArray(obs.map(toObservable)).concat([function () { | ||
for (var _len = arguments.length, xs = Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -260,3 +266,3 @@ xs[_key] = arguments[_key]; | ||
return xs; | ||
}])) : of([]); | ||
}])) : rxjs.of([]); | ||
}; | ||
@@ -267,4 +273,4 @@ | ||
var keys = Object.keys(obj); | ||
return keys.length ? combineLatest.apply(undefined, toConsumableArray(keys.map(function (k) { | ||
return toObservable(obj[k]).pipe(map(function (v) { | ||
return keys.length ? rxjs.combineLatest.apply(undefined, toConsumableArray(keys.map(function (k) { | ||
return toObservable(obj[k]).pipe(operators.map(function (v) { | ||
return [k, v]; | ||
@@ -284,3 +290,3 @@ })); | ||
}, {}); | ||
}])) : of(obj); | ||
}])) : rxjs.of(obj); | ||
}; | ||
@@ -292,3 +298,3 @@ | ||
var raf = new Observable(function (observer) { | ||
var raf = new rxjs.Observable(function (observer) { | ||
var isSubscribed = true; | ||
@@ -329,3 +335,3 @@ | ||
return function (stream) { | ||
return new Observable(function (observer) { | ||
return new rxjs.Observable(function (observer) { | ||
var timeout = setTimeout(function () { | ||
@@ -353,3 +359,3 @@ return observer.next(value); | ||
var _flip = function _flip(ds) { | ||
return isObservable(ds) ? switchMap(compose(toObservable, _flip))(ds) : isPromise(ds) ? switchMap(compose(toObservable, _flip))(from(ds)) : Array.isArray(ds) ? allIfObservable(ds.map(compose(ifObservable(defaultWith(undefined)), _flip))) : isObject(ds) ? ds.type === 'Component' ? ds : combineLatestObjectIfObservable(mapValues(compose(ifObservable(defaultWith(undefined)), _flip), ds)) : ds; | ||
return isObservable(ds) ? switchMap(compose(toObservable, _flip))(ds) : isPromise(ds) ? switchMap(compose(toObservable, _flip))(rxjs.from(ds)) : Array.isArray(ds) ? allIfObservable(ds.map(compose(ifObservable(defaultWith(undefined)), _flip))) : isObject(ds) ? ds.type === 'Component' ? ds : combineLatestObjectIfObservable(mapValues(compose(ifObservable(defaultWith(undefined)), _flip), ds)) : ds; | ||
}; | ||
@@ -362,3 +368,3 @@ | ||
var createMutable = function createMutable(initialValue) { | ||
var sub = new BehaviorSubject(initialValue); | ||
var sub = new rxjs.BehaviorSubject(initialValue); | ||
sub.set = function (x) { | ||
@@ -374,2 +380,5 @@ return sub.next(typeof x === 'function' ? x(sub.value) : x); | ||
export { ease, createState, all, flip }; | ||
exports.ease = ease; | ||
exports.createState = createState; | ||
exports.all = all; | ||
exports.flip = flip; |
@@ -1,5 +0,11 @@ | ||
import createTag from 'vdom-tag'; | ||
import { BehaviorSubject, Observable, combineLatest, from, of } from 'rxjs'; | ||
import { filter, map, share, shareReplay, startWith } from 'rxjs/operators'; | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var createTag = _interopDefault(require('vdom-tag')); | ||
var rxjs = require('rxjs'); | ||
var operators = require('rxjs/operators'); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
@@ -291,3 +297,3 @@ return typeof obj; | ||
var toObservable = function toObservable(x) { | ||
return isObservable(x) ? x : of(x); | ||
return isObservable(x) ? x : rxjs.of(x); | ||
}; | ||
@@ -298,3 +304,3 @@ | ||
return new Observable(function (observer) { | ||
return new rxjs.Observable(function (observer) { | ||
var isOuterStreamComplete = false; | ||
@@ -339,3 +345,3 @@ var isInnerStreamComplete = false; | ||
var all = function all(obs) { | ||
return obs.length ? combineLatest.apply(undefined, toConsumableArray(obs.map(toObservable)).concat([function () { | ||
return obs.length ? rxjs.combineLatest.apply(undefined, toConsumableArray(obs.map(toObservable)).concat([function () { | ||
for (var _len = arguments.length, xs = Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -346,3 +352,3 @@ xs[_key] = arguments[_key]; | ||
return xs; | ||
}])) : of([]); | ||
}])) : rxjs.of([]); | ||
}; | ||
@@ -353,4 +359,4 @@ | ||
var keys = Object.keys(obj); | ||
return keys.length ? combineLatest.apply(undefined, toConsumableArray(keys.map(function (k) { | ||
return toObservable(obj[k]).pipe(map(function (v) { | ||
return keys.length ? rxjs.combineLatest.apply(undefined, toConsumableArray(keys.map(function (k) { | ||
return toObservable(obj[k]).pipe(operators.map(function (v) { | ||
return [k, v]; | ||
@@ -370,3 +376,3 @@ })); | ||
}, {}); | ||
}])) : of(obj); | ||
}])) : rxjs.of(obj); | ||
}; | ||
@@ -376,3 +382,3 @@ | ||
return function (stream) { | ||
return new Observable(function (observer) { | ||
return new rxjs.Observable(function (observer) { | ||
return stream.subscribe({ | ||
@@ -393,3 +399,3 @@ complete: function complete() {}, | ||
var none = Symbol('None'); | ||
return new Observable(function (observer) { | ||
return new rxjs.Observable(function (observer) { | ||
var latestValue = none; | ||
@@ -430,3 +436,3 @@ var sub = stream.subscribe({ | ||
var raf = new Observable(function (observer) { | ||
var raf = new rxjs.Observable(function (observer) { | ||
var isSubscribed = true; | ||
@@ -467,3 +473,3 @@ | ||
return function (stream) { | ||
return new Observable(function (observer) { | ||
return new rxjs.Observable(function (observer) { | ||
var timeout = setTimeout(function () { | ||
@@ -491,3 +497,3 @@ return observer.next(value); | ||
var _flip = function _flip(ds) { | ||
return isObservable(ds) ? switchMap(compose(toObservable, _flip))(ds) : isPromise(ds) ? switchMap(compose(toObservable, _flip))(from(ds)) : Array.isArray(ds) ? allIfObservable(ds.map(compose(ifObservable(defaultWith(undefined)), _flip))) : isObject(ds) ? ds.type === 'Component' ? ds : combineLatestObjectIfObservable(mapValues(compose(ifObservable(defaultWith(undefined)), _flip), ds)) : ds; | ||
return isObservable(ds) ? switchMap(compose(toObservable, _flip))(ds) : isPromise(ds) ? switchMap(compose(toObservable, _flip))(rxjs.from(ds)) : Array.isArray(ds) ? allIfObservable(ds.map(compose(ifObservable(defaultWith(undefined)), _flip))) : isObject(ds) ? ds.type === 'Component' ? ds : combineLatestObjectIfObservable(mapValues(compose(ifObservable(defaultWith(undefined)), _flip), ds)) : ds; | ||
}; | ||
@@ -545,7 +551,7 @@ | ||
name: function AnonymousComponent() { | ||
return flip(c).pipe(map(function (child) { | ||
return flip(c).pipe(operators.map(function (child) { | ||
return formatChildren([child]); | ||
}), map(function (children) { | ||
}), operators.map(function (children) { | ||
return children.length === 1 ? children[0] : children; | ||
}), filter(function (x) { | ||
}), operators.filter(function (x) { | ||
return !isEmpty(x); | ||
@@ -632,3 +638,3 @@ })); | ||
var sharedRaf = share()(raf); | ||
var sharedRaf = operators.share()(raf); | ||
@@ -1019,3 +1025,3 @@ var toStream = function toStream(component) { | ||
function createPropsStream(props) { | ||
var sub = new BehaviorSubject(props); | ||
var sub = new rxjs.BehaviorSubject(props); | ||
return { | ||
@@ -1026,6 +1032,6 @@ next: function next(props) { | ||
stream: sub.pipe(switchMap(function (props) { | ||
return combineLatestObject(pickNonObservables(props)).pipe(map(function (values) { | ||
return combineLatestObject(pickNonObservables(props)).pipe(operators.map(function (values) { | ||
return _extends({}, props, values); | ||
})); | ||
}), shareReplay(1)) | ||
}), operators.shareReplay(1)) | ||
}; | ||
@@ -1183,6 +1189,6 @@ } | ||
var flatten$1 = function flatten(variable) { | ||
return Array.isArray(variable) ? all(variable.map(compose(startWith(''), flatten))).pipe(filter(hasContent)) : isObservable(variable) ? switchMap(flatten, variable) : isPromise(variable) ? switchMap(flatten, from(variable)) : toObservable(variable); | ||
return Array.isArray(variable) ? all(variable.map(compose(operators.startWith(''), flatten))).pipe(operators.filter(hasContent)) : isObservable(variable) ? switchMap(flatten, variable) : isPromise(variable) ? switchMap(flatten, rxjs.from(variable)) : toObservable(variable); | ||
}; | ||
var sharedRaf$1 = share()(raf); | ||
var sharedRaf$1 = operators.share()(raf); | ||
@@ -1200,3 +1206,3 @@ // createReactiveTag | ||
return flatten$1(variables).pipe(blockComplete(), startWith([]), sample(sharedRaf$1), map(function (variables) { | ||
return flatten$1(variables).pipe(blockComplete(), operators.startWith([]), sample(sharedRaf$1), operators.map(function (variables) { | ||
return tagFunction.apply(undefined, [strings].concat(toConsumableArray(variables))); | ||
@@ -1221,3 +1227,5 @@ })); | ||
export { text, render, h }; | ||
export default html$1; | ||
exports['default'] = html$1; | ||
exports.text = text; | ||
exports.render = render; | ||
exports.h = h; |
@@ -1,1 +0,1 @@ | ||
import createTag from"vdom-tag";import{BehaviorSubject,Observable,combineLatest,from,of}from"rxjs";import{filter,map,share,shareReplay,startWith}from"rxjs/operators";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),defineProperty=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},slicedToArray=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),toArray=function(e){return Array.isArray(e)?e:Array.from(e)},toConsumableArray=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},compose=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}},curry=function e(t){return function(){for(var r=arguments.length,n=Array(r),o=0;o<r;o++)n[o]=arguments[o];return n.length>=t.length?t.apply(void 0,n):function(){for(var r=arguments.length,o=Array(r),i=0;i<r;i++)o[i]=arguments[i];return e(t).apply(void 0,n.concat(o))}}},flatMap=curry(function(e,t){return t.reduce(function(t,r){return t.concat(e(r))},[])}),flatten=flatMap(function(e){return e}),noOp=function(){},createDefaultLifecycle=function(){return{mount:noOp,update:noOp,unmount:noOp}},isEmpty=function(e){return 0!==e&&(!e||"string"==typeof e&&!e.trim())||Array.isArray(e)&&!e.length};function _objectEntries$1(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push([r[n],e[r[n]]]);return t}function _objectEntries$1(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push([r[n],e[r[n]]]);return t}var fromEntries=function(e){return e.reduce(function(e,t){var r=slicedToArray(t,2),n=r[0],o=r[1];return _extends({},e,defineProperty({},n,o))},{})},pickBy=curry(function(e,t){return fromEntries(_objectEntries$1(t).filter(function(t){var r=slicedToArray(t,2),n=r[0],o=r[1];return e(o,n)}))}),mapValues=curry(function(e,t){return Object.keys(t).reduce(function(r,n){return _extends({},r,defineProperty({},n,e(t[n],n)))},{})}),isObject=function(e){return"object"===(void 0===e?"undefined":_typeof(e))&&null!==e};function _objectValues(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push(e[r[n]]);return t}function _objectValues(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push(e[r[n]]);return t}var isPromise=function(e){return e&&"function"==typeof e.then},isObservable=function(e){return e&&"function"==typeof e.subscribe},toObservable=function(e){return isObservable(e)?e:of(e)},switchMap=curry(function(e,t){var r=void 0;return new Observable(function(n){var o=!1,i=!1,a=t.subscribe({next:function(t){r&&r.unsubscribe(),r=e(t).subscribe({error:function(e){return n.error(e)},next:function(e){return n.next(e)},complete:function(){i=!0,o&&n.complete()}})},error:function(e){return n.error(e)},complete:function(){o=!0,i&&n.complete()}});return{unsubscribe:function(){r&&r.unsubscribe(),a.unsubscribe()}}})}),all=function(e){return e.length?combineLatest.apply(void 0,toConsumableArray(e.map(toObservable)).concat([function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t}])):of([])},combineLatestObject=function(e){var t=Object.keys(e);return t.length?combineLatest.apply(void 0,toConsumableArray(t.map(function(t){return toObservable(e[t]).pipe(map(function(e){return[t,e]}))})).concat([function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce(function(e,t){var r=slicedToArray(t,2),n=r[0],o=r[1];return _extends({},e,defineProperty({},n,o))},{})}])):of(e)},blockComplete=function(){return function(e){return new Observable(function(t){return e.subscribe({complete:function(){},next:function(e){return t.next(e)},error:function(e){return t.error(e)}})})}},sample=curry(function(e,t){var r=Symbol("None");return new Observable(function(n){var o=r,i=t.subscribe({next:function(e){o=e},complete:function(){},error:function(e){return n.error(e)}}),a=e.subscribe({next:function(){o!==r&&(n.next(o),o=r)},complete:function(){return n.complete()},error:function(e){return n.error(e)}});return{unsubscribe:function(){i.unsubscribe(),a.unsubscribe()}}})}),raf=new Observable(function(e){var t=!0;return window.requestAnimationFrame(function r(){t&&(e.next(),window.requestAnimationFrame(r))}),{unsubscribe:function(){t=!1}}}),applyIf=curry(function(e,t,r){return e(r)?t(r):r}),ifObservable=applyIf(isObservable),allIfObservable=applyIf(function(e){return e.some(isObservable)},all),combineLatestObjectIfObservable=applyIf(function(e){return _objectValues(e).some(isObservable)},combineLatestObject),defaultWith=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32;return function(r){return new Observable(function(n){var o=setTimeout(function(){return n.next(e)},t);return r.subscribe({next:function(e){clearTimeout(o),n.next(e)},complete:function(){clearTimeout(o),n.complete()},error:function(e){clearTimeout(o),n.error(e)}})})}},_flip=function e(t){return isObservable(t)?switchMap(compose(toObservable,e))(t):isPromise(t)?switchMap(compose(toObservable,e))(from(t)):Array.isArray(t)?allIfObservable(t.map(compose(ifObservable(defaultWith(void 0)),e))):isObject(t)?"Component"===t.type?t:combineLatestObjectIfObservable(mapValues(compose(ifObservable(defaultWith(void 0)),e),t)):t},flip=function(e){return toObservable(_flip(e))};function _objectEntries(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push([r[n],e[r[n]]]);return t}function _objectEntries(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push([r[n],e[r[n]]]);return t}var isLifecycle=function(e){return["mount","update","unmount"].includes(e)},isEvent=function(e){return!!e.match(/^on/)},toEventName=function(e){return e.replace(/^on/,"").toLowerCase()},styleToObject=function(e){return e.split(";").reduce(function(e,t){var r=t.split(/:/),n=toArray(r),o=n[0],i=n.slice(1);return o.trim()&&(e[o.trim()]=i.join(":")),e},{})},formatChildren=flatMap(function(e){return Array.isArray(e)?formatChildren(e):isEmpty(e)?[]:["VNode","VText","VPatch","Component"].some(function(t){return e.type===t})?[e]:isObservable(e)||isPromise(e)?[{type:"Component",name:function(){return flip(e).pipe(map(function(e){return formatChildren([e])}),map(function(e){return 1===e.length?e[0]:e}),filter(function(e){return!isEmpty(e)}))},untouchedAttributes:{children:[]}}]:[{type:"VText",text:e}]});function h(e,t){for(var r=t||{},n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a=o.reduce(function(e,t){return e.concat(t)},[]);if("function"==typeof e)return{type:"Component",name:e,untouchedAttributes:_extends({},r,{children:a})};var u=_objectEntries(r).reduce(function(e,t){var r=slicedToArray(t,2),n=r[0],o=r[1];return"key"===n?e.key=o:isLifecycle(n)&&"function"==typeof o?e.lifecycle[n]=o:isEvent(n)&&"function"==typeof o?e.events[toEventName(n)]=o:e.attrs[n]="style"===n?"object"===(void 0===o?"undefined":_typeof(o))?o:styleToObject(o):o,e},{lifecycle:createDefaultLifecycle(),events:{},attrs:{}}),c=u.key,s=u.lifecycle,l=u.events;return{type:"VNode",name:e,attrs:u.attrs,lifecycle:s,events:l,children:formatChildren(a),key:c}}var html$1=createTag(h);function _objectEntries$2(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push([r[n],e[r[n]]]);return t}function _objectEntries$2(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push([r[n],e[r[n]]]);return t}var sharedRaf=share()(raf),toStream=function(e){return flip(e).pipe(sample(sharedRaf))},render=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n.isSvg,i=void 0!==o&&o,a=n.morphNode,u=void 0!==a&&a?t:t.firstChild,c=void 0,s="function"==typeof e?e(r):e,l=toStream(s).subscribe({next:function(e){"VPatch"===e.type?c=e.vTree:Array.isArray(e)?(updateChildren(u||(u=t),c||[],e,i,r),c=e):(u?u=patch(u,c,e,i,r):(u=_createElement(e,i,r),t.innerHTML="",t.appendChild(u)),c=e)}});return{unsubscribe:function(){c&&(Array.isArray(c)?updateChildren(u,c,[],i,r):_removeElement(c,u)),l.unsubscribe()}}},VText=function(){function e(t){var r=t.text;classCallCheck(this,e),this.type="VText",this.text=r}return createClass(e,[{key:"createElement",value:function(){return document.createTextNode(this.text)}},{key:"updateElement",value:function(e,t){t.text!==this.text&&(e.textContent=this.text)}},{key:"removeElement",value:function(){}},{key:"mount",value:function(){}}]),e}();function isShallowEqual(e,t){for(var r in e)if(!(r in t)||e[r]!==t[r])return!1;for(var n in t)if(!(n in e)||e[n]!==t[n])return!1;return!0}var updateStyle=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(var n in _extends({},t,r)){var o=r&&r[n]?r[n]:"";r[n]===t[n]||("-"===n[0]?e.style.setProperty(n,o):e.style[n]=o)}},updateEvents=function(e,t,r){var n=!0,o=!1,i=void 0;try{for(var a,u=_objectEntries$2(e.events)[Symbol.iterator]();!(n=(a=u.next()).done);n=!0){var c=a.value,s=slicedToArray(c,2),l=s[0],f=s[1];r[l]?f!==r[l]&&(t.removeEventListener(l,r[l]),t.addEventListener(l,f)):t.addEventListener(l,f)}}catch(e){o=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}var p=_objectEntries$2(r).filter(function(t){var r=slicedToArray(t,1)[0];return!e.events[r]}),v=!0,m=!1,y=void 0;try{for(var h,b=p[Symbol.iterator]();!(v=(h=b.next()).done);v=!0){var d=h.value,E=slicedToArray(d,2),A=E[0],g=E[1];t.removeEventListener(A,g)}}catch(e){m=!0,y=e}finally{try{!v&&b.return&&b.return()}finally{if(m)throw y}}},updateAttrs=function(e,t,r){for(var n in _extends({},r,e.attrs)){var o=e.attrs[n];o===r[n]||(isEmpty(o)?"value"===n&&"INPUT"===t.tagName?t.value="":t.removeAttribute(n):"style"===n?updateStyle(t,r.style,e.attrs.style):"value"===n&&"INPUT"===t.tagName?t.value=o:t.setAttribute(n,o))}},updateChildren=function(e,t,r,n,o){var i=flatten(r),a=flatten(t);for(var u in i){var c=i[u],s=a[u],l=e.childNodes[u];if(l)patch(l,s,c,n,o);else{var f=_createElement(c,n,o);e.appendChild(f),_mount(c,f)}}for(var p in[].slice.call(e.childNodes,i.length)){var v=parseInt(p)+i.length,m=a[v],y=e.childNodes[v];y&&(_removeElement(m,y),y.remove())}},VNode=function(){function e(t){var r=t.name,n=t.attrs,o=void 0===n?{}:n,i=t.lifecycle,a=void 0===i?{}:i,u=t.events,c=void 0===u?{}:u,s=t.children,l=void 0===s?{}:s,f=t.key,p=void 0===f?"":f;classCallCheck(this,e),this.type="VNode",this.name=r,this.attrs=o,this.lifecycle=a,this.events=c,this.children=l,this.key=p}return createClass(e,[{key:"createElement",value:function(e,t){var r=(e=e||"svg"===this.name)?document.createElementNS("http://www.w3.org/2000/svg",this.name):document.createElement(this.name);return updateEvents(this,r,{}),updateAttrs(this,r,{}),updateChildren(r,[],this.children,e,t),r}},{key:"updateElement",value:function(e,t,r,n){if(t.name!==this.name)return _removeElement(t,e),_createElement(this,r,n);updateEvents(this,e,t.events),updateAttrs(this,e,t.attrs),updateChildren(e,t.children,this.children,r,n),this.lifecycle.update(e)}},{key:"removeElement",value:function(e){flatten(this.children).map(function(t,r){return _removeElement(t,e.childNodes[r])}),this.lifecycle.unmount(e)}},{key:"mount",value:function(e){flatten(this.children).map(function(e){return _mount(e)}),this.lifecycle.mount(e)}}]),e}(),VPatch=function(){function e(t){var r=t.vTree;classCallCheck(this,e),this.type="VPatch",this.vTree=r}return createClass(e,[{key:"createElement",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return _createElement.apply(void 0,[this.vTree].concat(t))}},{key:"updateElement",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return _updateElement.apply(void 0,[this.vTree].concat(t))}},{key:"removeElement",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return _removeElement.apply(void 0,[this.vTree].concat(t))}},{key:"mount",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return _mount.apply(void 0,[this.vTree].concat(t))}}]),e}(),pickNonObservables=function(e){return pickBy(function(e,t){return!/\$$/.test(t)},e)};function createPropsStream(e){var t=new BehaviorSubject(e);return{next:function(e){return t.next(e)},stream:t.pipe(switchMap(function(e){return combineLatestObject(pickNonObservables(e)).pipe(map(function(t){return _extends({},e,t)}))}),shareReplay(1))}}var Component=function(){function e(t){var r=t.name,n=t.untouchedAttributes,o=t.key,i=void 0===o?"":o;classCallCheck(this,e),this.type="Component",this.name=r,this.untouchedAttributes=n,this.key=i}return createClass(e,[{key:"createElement",value:function(e,t){var r=e?document.createElementNS("http://www.w3.org/2000/svg","g"):document.createElement("div");this.state={},this.state.props=createPropsStream(this.untouchedAttributes);var n=this.name(this.state.props.stream);if(!n)throw new Error("Component "+this.name.name+" must return a stream!");return this.state.subscription=render(n,r,t,{isSvg:e,morphNode:!0}),r}},{key:"updateElement",value:function(e,t,r,n){if(this.state=t.state,t.name!==this.name)return _removeElement(t,e),_createElement(this,r,n);isShallowEqual(t.untouchedAttributes,this.untouchedAttributes)||this.state.props.next(this.untouchedAttributes)}},{key:"removeElement",value:function(){this.state.subscription.unsubscribe()}},{key:"mount",value:function(){}}]),e}(),classes={VNode:VNode,VText:VText,Component:Component},_createElement=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return classes[e.type].prototype.createElement.apply(e,r)},_mount=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return classes[e.type].prototype.mount.apply(e,r)},_updateElement=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return classes[e.type].prototype.updateElement.apply(e,r)},_removeElement=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return classes[e.type].prototype.removeElement.apply(e,r)};function createVTree(e){return{key:"INIT",type:"VNode",name:e.nodeName.toLowerCase(),lifecycle:createDefaultLifecycle(),events:{},attrs:{},untouchedAttributes:{},children:Array.prototype.map.call(e.childNodes,function(e){return 3===e.nodeType?{type:"VText",text:e.nodeValue}:createVTree(e)})}}function patch(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:createVTree(e),r=arguments[2],n=arguments[3],o=arguments[4];if(r.type!==t.type||r.key!==t.key){_removeElement(t,e);var i=_createElement(r,n,o);return e.parentNode.replaceChild(i,e),_mount(r,i,n),i}var a=_updateElement(r,e,t,n,o);return a?(e.parentNode.replaceChild(a,e),_mount(r,a,n),a):e}var hasContent=function(e){return!e.length||!e.every(isEmpty)},flatten$1=function e(t){return Array.isArray(t)?all(t.map(compose(startWith(""),e))).pipe(filter(hasContent)):isObservable(t)?switchMap(e,t):isPromise(t)?switchMap(e,from(t)):toObservable(t)},sharedRaf$1=share()(raf),createReactiveTag=function(e){return function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return flatten$1(n).pipe(blockComplete(),startWith([]),sample(sharedRaf$1),map(function(r){return e.apply(void 0,[t].concat(toConsumableArray(r)))}))}},textTag=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.reduce(function(e,t,n){return e+t+(void 0!==r[n]?r[n]:"")},"")},text=createReactiveTag(textTag);export{text,render,h};export default html$1; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var createTag=_interopDefault(require("vdom-tag")),rxjs=require("rxjs"),operators=require("rxjs/operators"),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),defineProperty=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},slicedToArray=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),toArray=function(e){return Array.isArray(e)?e:Array.from(e)},toConsumableArray=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},compose=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}},curry=function e(t){return function(){for(var r=arguments.length,n=Array(r),o=0;o<r;o++)n[o]=arguments[o];return n.length>=t.length?t.apply(void 0,n):function(){for(var r=arguments.length,o=Array(r),a=0;a<r;a++)o[a]=arguments[a];return e(t).apply(void 0,n.concat(o))}}},flatMap=curry(function(e,t){return t.reduce(function(t,r){return t.concat(e(r))},[])}),flatten=flatMap(function(e){return e}),noOp=function(){},createDefaultLifecycle=function(){return{mount:noOp,update:noOp,unmount:noOp}},isEmpty=function(e){return 0!==e&&(!e||"string"==typeof e&&!e.trim())||Array.isArray(e)&&!e.length};function _objectEntries$1(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push([r[n],e[r[n]]]);return t}function _objectEntries$1(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push([r[n],e[r[n]]]);return t}var fromEntries=function(e){return e.reduce(function(e,t){var r=slicedToArray(t,2),n=r[0],o=r[1];return _extends({},e,defineProperty({},n,o))},{})},pickBy=curry(function(e,t){return fromEntries(_objectEntries$1(t).filter(function(t){var r=slicedToArray(t,2),n=r[0],o=r[1];return e(o,n)}))}),mapValues=curry(function(e,t){return Object.keys(t).reduce(function(r,n){return _extends({},r,defineProperty({},n,e(t[n],n)))},{})}),isObject=function(e){return"object"===(void 0===e?"undefined":_typeof(e))&&null!==e};function _objectValues(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push(e[r[n]]);return t}function _objectValues(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push(e[r[n]]);return t}var isPromise=function(e){return e&&"function"==typeof e.then},isObservable=function(e){return e&&"function"==typeof e.subscribe},toObservable=function(e){return isObservable(e)?e:rxjs.of(e)},switchMap=curry(function(e,t){var r=void 0;return new rxjs.Observable(function(n){var o=!1,a=!1,i=t.subscribe({next:function(t){r&&r.unsubscribe(),r=e(t).subscribe({error:function(e){return n.error(e)},next:function(e){return n.next(e)},complete:function(){a=!0,o&&n.complete()}})},error:function(e){return n.error(e)},complete:function(){o=!0,a&&n.complete()}});return{unsubscribe:function(){r&&r.unsubscribe(),i.unsubscribe()}}})}),all=function(e){return e.length?rxjs.combineLatest.apply(void 0,toConsumableArray(e.map(toObservable)).concat([function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t}])):rxjs.of([])},combineLatestObject=function(e){var t=Object.keys(e);return t.length?rxjs.combineLatest.apply(void 0,toConsumableArray(t.map(function(t){return toObservable(e[t]).pipe(operators.map(function(e){return[t,e]}))})).concat([function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce(function(e,t){var r=slicedToArray(t,2),n=r[0],o=r[1];return _extends({},e,defineProperty({},n,o))},{})}])):rxjs.of(e)},blockComplete=function(){return function(e){return new rxjs.Observable(function(t){return e.subscribe({complete:function(){},next:function(e){return t.next(e)},error:function(e){return t.error(e)}})})}},sample=curry(function(e,t){var r=Symbol("None");return new rxjs.Observable(function(n){var o=r,a=t.subscribe({next:function(e){o=e},complete:function(){},error:function(e){return n.error(e)}}),i=e.subscribe({next:function(){o!==r&&(n.next(o),o=r)},complete:function(){return n.complete()},error:function(e){return n.error(e)}});return{unsubscribe:function(){a.unsubscribe(),i.unsubscribe()}}})}),raf=new rxjs.Observable(function(e){var t=!0;return window.requestAnimationFrame(function r(){t&&(e.next(),window.requestAnimationFrame(r))}),{unsubscribe:function(){t=!1}}}),applyIf=curry(function(e,t,r){return e(r)?t(r):r}),ifObservable=applyIf(isObservable),allIfObservable=applyIf(function(e){return e.some(isObservable)},all),combineLatestObjectIfObservable=applyIf(function(e){return _objectValues(e).some(isObservable)},combineLatestObject),defaultWith=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32;return function(r){return new rxjs.Observable(function(n){var o=setTimeout(function(){return n.next(e)},t);return r.subscribe({next:function(e){clearTimeout(o),n.next(e)},complete:function(){clearTimeout(o),n.complete()},error:function(e){clearTimeout(o),n.error(e)}})})}},_flip=function e(t){return isObservable(t)?switchMap(compose(toObservable,e))(t):isPromise(t)?switchMap(compose(toObservable,e))(rxjs.from(t)):Array.isArray(t)?allIfObservable(t.map(compose(ifObservable(defaultWith(void 0)),e))):isObject(t)?"Component"===t.type?t:combineLatestObjectIfObservable(mapValues(compose(ifObservable(defaultWith(void 0)),e),t)):t},flip=function(e){return toObservable(_flip(e))};function _objectEntries(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push([r[n],e[r[n]]]);return t}function _objectEntries(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push([r[n],e[r[n]]]);return t}var isLifecycle=function(e){return["mount","update","unmount"].includes(e)},isEvent=function(e){return!!e.match(/^on/)},toEventName=function(e){return e.replace(/^on/,"").toLowerCase()},styleToObject=function(e){return e.split(";").reduce(function(e,t){var r=t.split(/:/),n=toArray(r),o=n[0],a=n.slice(1);return o.trim()&&(e[o.trim()]=a.join(":")),e},{})},formatChildren=flatMap(function(e){return Array.isArray(e)?formatChildren(e):isEmpty(e)?[]:["VNode","VText","VPatch","Component"].some(function(t){return e.type===t})?[e]:isObservable(e)||isPromise(e)?[{type:"Component",name:function(){return flip(e).pipe(operators.map(function(e){return formatChildren([e])}),operators.map(function(e){return 1===e.length?e[0]:e}),operators.filter(function(e){return!isEmpty(e)}))},untouchedAttributes:{children:[]}}]:[{type:"VText",text:e}]});function h(e,t){for(var r=t||{},n=arguments.length,o=Array(n>2?n-2:0),a=2;a<n;a++)o[a-2]=arguments[a];var i=o.reduce(function(e,t){return e.concat(t)},[]);if("function"==typeof e)return{type:"Component",name:e,untouchedAttributes:_extends({},r,{children:i})};var u=_objectEntries(r).reduce(function(e,t){var r=slicedToArray(t,2),n=r[0],o=r[1];return"key"===n?e.key=o:isLifecycle(n)&&"function"==typeof o?e.lifecycle[n]=o:isEvent(n)&&"function"==typeof o?e.events[toEventName(n)]=o:e.attrs[n]="style"===n?"object"===(void 0===o?"undefined":_typeof(o))?o:styleToObject(o):o,e},{lifecycle:createDefaultLifecycle(),events:{},attrs:{}}),c=u.key,s=u.lifecycle,l=u.events;return{type:"VNode",name:e,attrs:u.attrs,lifecycle:s,events:l,children:formatChildren(i),key:c}}var html$1=createTag(h);function _objectEntries$2(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push([r[n],e[r[n]]]);return t}function _objectEntries$2(e){for(var t=[],r=Object.keys(e),n=0;n<r.length;++n)t.push([r[n],e[r[n]]]);return t}var sharedRaf=operators.share()(raf),toStream=function(e){return flip(e).pipe(sample(sharedRaf))},render=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n.isSvg,a=void 0!==o&&o,i=n.morphNode,u=void 0!==i&&i?t:t.firstChild,c=void 0,s="function"==typeof e?e(r):e,l=toStream(s).subscribe({next:function(e){"VPatch"===e.type?c=e.vTree:Array.isArray(e)?(updateChildren(u||(u=t),c||[],e,a,r),c=e):(u?u=patch(u,c,e,a,r):(u=_createElement(e,a,r),t.innerHTML="",t.appendChild(u)),c=e)}});return{unsubscribe:function(){c&&(Array.isArray(c)?updateChildren(u,c,[],a,r):_removeElement(c,u)),l.unsubscribe()}}},VText=function(){function e(t){var r=t.text;classCallCheck(this,e),this.type="VText",this.text=r}return createClass(e,[{key:"createElement",value:function(){return document.createTextNode(this.text)}},{key:"updateElement",value:function(e,t){t.text!==this.text&&(e.textContent=this.text)}},{key:"removeElement",value:function(){}},{key:"mount",value:function(){}}]),e}();function isShallowEqual(e,t){for(var r in e)if(!(r in t)||e[r]!==t[r])return!1;for(var n in t)if(!(n in e)||e[n]!==t[n])return!1;return!0}var updateStyle=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(var n in _extends({},t,r)){var o=r&&r[n]?r[n]:"";r[n]===t[n]||("-"===n[0]?e.style.setProperty(n,o):e.style[n]=o)}},updateEvents=function(e,t,r){var n=!0,o=!1,a=void 0;try{for(var i,u=_objectEntries$2(e.events)[Symbol.iterator]();!(n=(i=u.next()).done);n=!0){var c=i.value,s=slicedToArray(c,2),l=s[0],f=s[1];r[l]?f!==r[l]&&(t.removeEventListener(l,r[l]),t.addEventListener(l,f)):t.addEventListener(l,f)}}catch(e){o=!0,a=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw a}}var p=_objectEntries$2(r).filter(function(t){var r=slicedToArray(t,1)[0];return!e.events[r]}),v=!0,y=!1,m=void 0;try{for(var h,d=p[Symbol.iterator]();!(v=(h=d.next()).done);v=!0){var b=h.value,x=slicedToArray(b,2),E=x[0],A=x[1];t.removeEventListener(E,A)}}catch(e){y=!0,m=e}finally{try{!v&&d.return&&d.return()}finally{if(y)throw m}}},updateAttrs=function(e,t,r){for(var n in _extends({},r,e.attrs)){var o=e.attrs[n];o===r[n]||(isEmpty(o)?"value"===n&&"INPUT"===t.tagName?t.value="":t.removeAttribute(n):"style"===n?updateStyle(t,r.style,e.attrs.style):"value"===n&&"INPUT"===t.tagName?t.value=o:t.setAttribute(n,o))}},updateChildren=function(e,t,r,n,o){var a=flatten(r),i=flatten(t);for(var u in a){var c=a[u],s=i[u],l=e.childNodes[u];if(l)patch(l,s,c,n,o);else{var f=_createElement(c,n,o);e.appendChild(f),_mount(c,f)}}for(var p in[].slice.call(e.childNodes,a.length)){var v=parseInt(p)+a.length,y=i[v],m=e.childNodes[v];m&&(_removeElement(y,m),m.remove())}},VNode=function(){function e(t){var r=t.name,n=t.attrs,o=void 0===n?{}:n,a=t.lifecycle,i=void 0===a?{}:a,u=t.events,c=void 0===u?{}:u,s=t.children,l=void 0===s?{}:s,f=t.key,p=void 0===f?"":f;classCallCheck(this,e),this.type="VNode",this.name=r,this.attrs=o,this.lifecycle=i,this.events=c,this.children=l,this.key=p}return createClass(e,[{key:"createElement",value:function(e,t){var r=(e=e||"svg"===this.name)?document.createElementNS("http://www.w3.org/2000/svg",this.name):document.createElement(this.name);return updateEvents(this,r,{}),updateAttrs(this,r,{}),updateChildren(r,[],this.children,e,t),r}},{key:"updateElement",value:function(e,t,r,n){if(t.name!==this.name)return _removeElement(t,e),_createElement(this,r,n);updateEvents(this,e,t.events),updateAttrs(this,e,t.attrs),updateChildren(e,t.children,this.children,r,n),this.lifecycle.update(e)}},{key:"removeElement",value:function(e){flatten(this.children).map(function(t,r){return _removeElement(t,e.childNodes[r])}),this.lifecycle.unmount(e)}},{key:"mount",value:function(e){flatten(this.children).map(function(e){return _mount(e)}),this.lifecycle.mount(e)}}]),e}(),VPatch=function(){function e(t){var r=t.vTree;classCallCheck(this,e),this.type="VPatch",this.vTree=r}return createClass(e,[{key:"createElement",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return _createElement.apply(void 0,[this.vTree].concat(t))}},{key:"updateElement",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return _updateElement.apply(void 0,[this.vTree].concat(t))}},{key:"removeElement",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return _removeElement.apply(void 0,[this.vTree].concat(t))}},{key:"mount",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return _mount.apply(void 0,[this.vTree].concat(t))}}]),e}(),pickNonObservables=function(e){return pickBy(function(e,t){return!/\$$/.test(t)},e)};function createPropsStream(e){var t=new rxjs.BehaviorSubject(e);return{next:function(e){return t.next(e)},stream:t.pipe(switchMap(function(e){return combineLatestObject(pickNonObservables(e)).pipe(operators.map(function(t){return _extends({},e,t)}))}),operators.shareReplay(1))}}var Component=function(){function e(t){var r=t.name,n=t.untouchedAttributes,o=t.key,a=void 0===o?"":o;classCallCheck(this,e),this.type="Component",this.name=r,this.untouchedAttributes=n,this.key=a}return createClass(e,[{key:"createElement",value:function(e,t){var r=e?document.createElementNS("http://www.w3.org/2000/svg","g"):document.createElement("div");this.state={},this.state.props=createPropsStream(this.untouchedAttributes);var n=this.name(this.state.props.stream);if(!n)throw new Error("Component "+this.name.name+" must return a stream!");return this.state.subscription=render(n,r,t,{isSvg:e,morphNode:!0}),r}},{key:"updateElement",value:function(e,t,r,n){if(this.state=t.state,t.name!==this.name)return _removeElement(t,e),_createElement(this,r,n);isShallowEqual(t.untouchedAttributes,this.untouchedAttributes)||this.state.props.next(this.untouchedAttributes)}},{key:"removeElement",value:function(){this.state.subscription.unsubscribe()}},{key:"mount",value:function(){}}]),e}(),classes={VNode:VNode,VText:VText,Component:Component},_createElement=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return classes[e.type].prototype.createElement.apply(e,r)},_mount=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return classes[e.type].prototype.mount.apply(e,r)},_updateElement=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return classes[e.type].prototype.updateElement.apply(e,r)},_removeElement=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return classes[e.type].prototype.removeElement.apply(e,r)};function createVTree(e){return{key:"INIT",type:"VNode",name:e.nodeName.toLowerCase(),lifecycle:createDefaultLifecycle(),events:{},attrs:{},untouchedAttributes:{},children:Array.prototype.map.call(e.childNodes,function(e){return 3===e.nodeType?{type:"VText",text:e.nodeValue}:createVTree(e)})}}function patch(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:createVTree(e),r=arguments[2],n=arguments[3],o=arguments[4];if(r.type!==t.type||r.key!==t.key){_removeElement(t,e);var a=_createElement(r,n,o);return e.parentNode.replaceChild(a,e),_mount(r,a,n),a}var i=_updateElement(r,e,t,n,o);return i?(e.parentNode.replaceChild(i,e),_mount(r,i,n),i):e}var hasContent=function(e){return!e.length||!e.every(isEmpty)},flatten$1=function e(t){return Array.isArray(t)?all(t.map(compose(operators.startWith(""),e))).pipe(operators.filter(hasContent)):isObservable(t)?switchMap(e,t):isPromise(t)?switchMap(e,rxjs.from(t)):toObservable(t)},sharedRaf$1=operators.share()(raf),createReactiveTag=function(e){return function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return flatten$1(n).pipe(blockComplete(),operators.startWith([]),sample(sharedRaf$1),operators.map(function(r){return e.apply(void 0,[t].concat(toConsumableArray(r)))}))}},textTag=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.reduce(function(e,t,n){return e+t+(void 0!==r[n]?r[n]:"")},"")},text=createReactiveTag(textTag);exports.default=html$1,exports.text=text,exports.render=render,exports.h=h; |
{ | ||
"name": "evolui", | ||
"version": "2.0.0-alpha.03", | ||
"version": "2.0.0-alpha.04", | ||
"description": "Observable powered templates for asynchronous UIs", | ||
@@ -5,0 +5,0 @@ "main": "lib/evolui.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
69881
1314
3