From 3fa31086d53bf2d53b02b95e2fea9ea5011847dc Mon Sep 17 00:00:00 2001 From: Matt Keas Date: Tue, 3 Jan 2017 13:17:17 -0600 Subject: [PATCH] comitting and pushing new patch version --- build/index.js | 18 ------------------ build/index.js.map | 2 +- fuse.js | 2 +- package.json | 3 +++ yarn.lock | 36 +++++++++++++++++++++++++++++++----- 5 files changed, 36 insertions(+), 25 deletions(-) diff --git a/build/index.js b/build/index.js index 54bc228..a927b2e 100644 --- a/build/index.js +++ b/build/index.js @@ -2,8 +2,6 @@ FuseBox.pkg("clan-fp", {}, function(___scope___){ ___scope___.file("index.js", function(exports, require, module, __filename, __dirname){ -'use strict'; - Object.defineProperty(exports, "__esModule", { value: true }); @@ -68,8 +66,6 @@ module.exports = Object.assign({}, fp, { }); ___scope___.file("batch.js", function(exports, require, module, __filename, __dirname){ -'use strict'; - Object.defineProperty(exports, "__esModule", { value: true }); @@ -112,8 +108,6 @@ exports.default = batch; }); ___scope___.file("vdom.js", function(exports, require, module, __filename, __dirname){ -'use strict'; - var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -678,8 +672,6 @@ html(x).then(x => log(x)).catch(e => log(e+'')) }); ___scope___.file("fp.js", function(exports, require, module, __filename, __dirname){ -"use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); @@ -782,8 +774,6 @@ var concatter = exports.concatter = function concatter(thing, value) { }); ___scope___.file("mixin.js", function(exports, require, module, __filename, __dirname){ -"use strict"; - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var mixin = function mixin() { @@ -816,8 +806,6 @@ module.exports = mixin; }); ___scope___.file("model.js", function(exports, require, module, __filename, __dirname){ -'use strict'; - Object.defineProperty(exports, "__esModule", { value: true }); @@ -956,8 +944,6 @@ Activity.whenValid(a).then(log).catch(e => log(e+'')) }); ___scope___.file("observable.js", function(exports, require, module, __filename, __dirname){ -"use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); @@ -1107,8 +1093,6 @@ exports.default = obs; }); ___scope___.file("hamt.js", function(exports, require, module, __filename, __dirname){ -'use strict'; - Object.defineProperty(exports, "__esModule", { value: true }); @@ -1476,8 +1460,6 @@ var hamt = exports.hamt = node; }); ___scope___.file("worker.js", function(exports, require, module, __filename, __dirname){ -'use strict'; - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/build/index.js.map b/build/index.js.map index c09d332..b80832d 100644 --- a/build/index.js.map +++ b/build/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.js","batch.js","vdom.js","fp.js","mixin.js","model.js","observable.js","hamt.js","worker.js"],"names":["hamt","worker","fp","hash","v","_v","JSON","stringify","i","len","length","c","charCodeAt","module","exports","Object","assign","batch","vdom","mixin","model","obs","inflight","url","options","method","key","toLowerCase","f","compress","Promise","res","rej","then","d","catch","e","undefined","data","console","error","class_id_regex","tagName_regex","parseSelector","test","tagreg","exec","s","tag","slice","reg","create","substr","className","trim","id","debounce","func","wait","immediate","timeout","args","later","callNow","clearTimeout","setTimeout","m","selector","children","attrs","Array","Function","unshift","shouldUpdate","unload","config","__hash","stripEvents","a","name","applyEvents","events","el","strip_existing","removeEvents","flatten","arr","push","EVENTS","split","map","x","mnt","mount","fn","render","applyUpdates","update","stylify","style","setAttrs","attr","innerHTML","value","setAttribute","_id","_className","createTag","parent","parentElement","__vdom","t","document","createTextNode","insertBefore","removeEl","appendChild","shouldExchange","tagName","_shouldUpdate","createElement","removeChild","insertAt","next_sib","resolve","_el","vdom_children","el_children","childNodes","qs","querySelector","resolver","states","promises","done","_await","_promises","finish","ms","isDone","total","all","props","keys","forEach","getState","gs","view","state","r","instance","container","queries","wrapper_view","reservedAttrs","toHTML","_vdom","html","_class","_attrs","inner","indexOf","str","filter","join","log","rAF","global","requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","cb","g","cof","fns","reduce","acc","cob","reverse","pf","apply","curry","bind","mapping","mapper","reducer","result","filtering","predicate","concatter","thing","concat","classes","_mixin","proto","prototype","p","getOwnPropertyNames","oldFn","call","arguments","is","type","isValid","String","Number","Boolean","check","types","required","_type","MODEL","init","logic","pipe","whenValid","ArrayOf","M","subscribers","val","o","take","n","values","delete","takeWhile","maybe","success","stop","ts","Date","now","from","union","fs","hamming","popcount","root","sum","comp","b","HMAP_SIZE","MAX_DEPTH","vec","h","range","shallowClone","y","cloneNode","node","numChildren","set","newroot","bits","cp","cn","rh","j","__r","__n","vecr","vecn","_r","get","first","unset","_n","item","toList","toOrderedList","toJSON","toJson","pop","shift","k","supports","q","window","supportsWorkers","supportsBlobs","supportsURLs","supportsBuilders","code","B","U","W","blob","append","getBlob","encodeURIComponent","createObjectURL","Worker","farm","workers","fill","current","iter","onerror","w","onmessage","postMessage"],"mappings":";;;;;;;;;;;AAAA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;IAAYA;;AACZ;;IAAYC;;AACZ;;IAAYC;;;;;;AAEL,IAAMC,sBAAO,cAACC,CAAD,EAA4B;AAAA,QAAzBC,EAAyB,uEAAtBC,KAAKC,SAAL,CAAeH,CAAf,CAAsB;;AAC5C,QAAID,OAAO,CAAX;AACA,SAAK,IAAIK,IAAI,CAAR,EAAWC,MAAMJ,GAAGK,MAAzB,EAAiCF,IAAIC,GAArC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,IAAP;AACH,KAHD;AAIA,WAAOA,IAAP;AACH,CA9BM","file":"","sourcesContent":["import batch from './batch'\nimport vdom from './vdom'\nimport mixin from './mixin'\nimport model from './model'\nimport obs from './observable'\nimport * as hamt from './hamt'\nimport * as worker from './worker'\nimport * as fp from './fp'\n\nexport const hash = (v,_v=JSON.stringify(v)) => {\n let hash = 0\n for (let i = 0, len = _v.length; i < len; ++i) {\n const c = _v.charCodeAt(i)\n hash = (((hash << 5) - hash) + c) | 0\n }\n return hash\n}\n\nmodule.exports = Object.assign({}, fp, {\n\tbatch\n\t, vdom\n\t, mixin\n\t, model\n\t, obs\n\t, hamt\n\t, worker\n})\n","\n// batched requests\n// The `fetch()` module batches in-flight requests, so if at any point in time, anywhere in my front-end or\n// back-end application I have a calls occur to `fetch('http://api.github.com/users/matthiasak')` while another\n// to that URL is \"in-flight\", the Promise returned by both of those calls will be resolved by a single network request.\n\n// f :: (url -> options) -> Promise\nconst batch = f => {\n let inflight = {}\n\n return (url, options={}) => {\n let {method} = options,\n key = `${url}:${JSON.stringify(options)}`\n\n if((method || '').toLowerCase() === 'post')\n return f(url, Object.assign({}, options, {compress: false}))\n\n return inflight[key] ||\n (inflight[key] =\n new Promise((res,rej) => {\n f(url, Object.assign({}, options, {compress: false}))\n .then(d => res(d))\n .catch(e => rej(e))\n })\n .then(data => {\n inflight = Object.assign({}, inflight, {[key]: undefined})\n return data\n })\n .catch(e =>\n console.error(e, url)))\n }\n}\n\nexport default batch","import {rAF} from './fp'\n\n// Virtual DOMs\nconst vdom = () => {\n const class_id_regex = () => {\n return /[#\\.][^#\\.]+/ig\n },\n tagName_regex = () => {\n return /^([^\\.#]+)\\b/i\n }\n\n const parseSelector = s => {\n let test = null,\n tagreg = tagName_regex().exec(s),\n tag = tagreg && tagreg.slice(1)[0],\n reg = class_id_regex(),\n vdom = Object.create(null)\n\n if(tag) s = s.substr(tag.length)\n vdom.className = ''\n vdom.tag = tag || 'div'\n\n while((test = reg.exec(s)) !== null){\n test = test[0]\n if(test[0] === '.')\n vdom.className = (vdom.className+' '+test.substr(1)).trim()\n else if(test[0] === '#')\n vdom.id = test.substr(1)\n }\n return vdom\n }\n\n const debounce = (func, wait, immediate, timeout) =>\n (...args) => {\n let later = () => {\n timeout = null\n !immediate && func(...args)\n }\n var callNow = immediate && !timeout\n clearTimeout(timeout)\n timeout = setTimeout(later, wait || 0)\n callNow && func(...args)\n }\n\n const hash = (v,_v=JSON.stringify(v)) => {\n let hash = 0\n for (let i = 0, len = _v.length; i < len; ++i) {\n const c = _v.charCodeAt(i)\n hash = (((hash << 5) - hash) + c) | 0\n }\n return hash\n }\n\n const m = (selector, attrs=Object.create(null), ...children) => {\n if(attrs.tag || !(typeof attrs === 'object') || attrs instanceof Array || attrs instanceof Function){\n if(attrs instanceof Array) children.unshift(...attrs)\n else children.unshift(attrs)\n attrs = Object.create(null)\n }\n let vdom = parseSelector(selector)\n if(children.length)\n vdom.children = children\n vdom.attrs = attrs\n vdom.shouldUpdate = attrs.shouldUpdate\n vdom.unload = attrs.unload\n vdom.config = attrs.config\n vdom.__hash = hash(vdom)\n delete attrs.unload\n delete attrs.shouldUpdate\n delete attrs.config\n return vdom\n }\n\n // creatign html, strip events from DOM element... for now just deleting\n const stripEvents = ({attrs}) => {\n let a = Object.create(null)\n\n if(attrs){\n for(var name in attrs){\n if(name[0]==='o'&&name[1]==='n') {\n a[name] = attrs[name]\n delete attrs[name]\n }\n }\n }\n\n return a\n }\n\n const applyEvents = (events, el, strip_existing=true) => {\n strip_existing && removeEvents(el)\n for(var name in events){\n el[name] = events[name]\n }\n }\n\n const flatten = (arr, a=[]) => {\n for(var i=0,len=arr.length; i 'on'+x)\n\n const removeEvents = el => {\n // strip away event handlers on el, if it exists\n if(!el) return;\n for(var i in EVENTS){\n el[i] = null\n }\n }\n\n let mnt\n\n const mount = (fn, el) => {\n mnt = [el, fn]\n render(fn, el)\n }\n\n const render = debounce((fn, el) => rAF(_ => {\n applyUpdates(fn, el.children[0], el)\n }))\n\n const update = () => {\n if(!mnt) return\n let [el, fn] = mnt\n render(fn, el)\n }\n\n const stylify = style => {\n let s = ''\n for(var i in style){\n s+=`${i}:${style[i]};`\n }\n return s\n }\n\n const setAttrs = ({attrs, id, className, __hash},el) => {\n \tel.className = ''\n \tel.style = ''\n\n if(attrs){\n for(var attr in attrs){\n if(attr === 'style') {\n el.style = stylify(attrs[attr])\n } else if(attr === 'innerHTML'){\n rAF(() => el.innerHTML = attrs[attr])\n } else if(attr === 'value'){\n rAF(() => el.value = attrs[attr])\n } else {\n el.setAttribute(attr, attrs[attr])\n }\n }\n }\n let _id = attrs.id || id\n if(_id) el.id = _id\n let _className = ((attrs.className || '') + ' ' + (className || '')).trim()\n if(_className) el.className = _className\n el.__hash = __hash\n }\n\n // recycle or create a new el\n const createTag = (vdom=Object.create(null), el, parent=el&&el.parentElement) => {\n let __vdom = vdom\n // make text nodes from primitive types\n if(typeof vdom !== 'object'){\n let t = document.createTextNode(vdom)\n if(el){\n parent.insertBefore(t,el)\n removeEl(el)\n } else {\n parent.appendChild(t)\n }\n return t\n }\n\n // else make an HTMLElement from \"tag\" types\n let {tag, attrs, id, className, unload, shouldUpdate, config, __hash} = vdom,\n shouldExchange = !el || !el.tagName || (tag && el.tagName.toLowerCase() !== tag.toLowerCase()),\n _shouldUpdate = !(shouldUpdate instanceof Function) || shouldUpdate(el)\n\n if(!attrs) return\n if(el && (!_shouldUpdate || ((!vdom instanceof Function) && el.__hash === __hash))) {\n return\n }\n\n if(shouldExchange){\n let t = document.createElement(tag)\n el ? (parent.insertBefore(t, el), removeEl(el)) : parent.appendChild(t)\n el = t\n }\n\n setAttrs(vdom, el)\n if(el.unload instanceof Function) {\n rAF(el.unload)\n }\n if(unload instanceof Function) {\n el.unload = unload\n }\n applyEvents(stripEvents(vdom), el)\n config && rAF(_ => config(el))\n return el\n }\n\n // find parent element, and remove the input element\n const removeEl = el => {\n if(!el) return\n el.parentElement.removeChild(el)\n removeEvents(el)\n // removed for now, added unload logic to the immediate draw()s\n if(el.unload instanceof Function)\n el.unload()\n }\n\n const insertAt = (el, parent, i) => {\n if(parent.children.length > i) {\n let next_sib = parent.children[i]\n parent.insertBefore(el, next_sib)\n } else {\n parent.appendChild(el)\n }\n }\n\n const applyUpdates = (vdom, el, parent=el&&el.parentElement) => {\n let v = vdom\n // if vdom is a function, execute it until it isn't\n while(vdom instanceof Function)\n vdom = vdom()\n\n if(!vdom) return\n\n if(vdom.resolve instanceof Function){\n let i = parent.children.length\n return vdom.resolve().then(v => {\n if(!el) {\n let x = createTag(v, null, parent)\n insertAt(x, parent, i)\n applyUpdates(v, x, parent)\n } else {\n applyUpdates(v, el, parent)\n }\n })\n }\n\n // create/edit el under parent\n let _el = vdom instanceof Array ? parent : createTag(vdom, el, parent)\n\n if(!_el) return\n\n if(vdom instanceof Array || vdom.children){\n let vdom_children = flatten(vdom instanceof Array ? vdom : vdom.children),\n el_children = vdom instanceof Array ? parent.childNodes : _el.childNodes\n\n while(el_children.length > vdom_children.length){\n removeEl(el_children[el_children.length-1])\n }\n\n for(let i=0; i 0){\n removeEl(_el.childNodes[_el.childNodes.length-1])\n }\n }\n }\n\n const qs = (s='body', el=document) => el.querySelector(s)\n\n const resolver = (states = {}) => {\n let promises = [],\n done = false\n\n const _await = (_promises = []) => {\n promises = [...promises, ..._promises]\n return finish()\n }\n\n const wait = (ms=0) => new Promise(res => setTimeout(res, ms))\n\n const isDone = () => done\n\n const finish = () => {\n const total = promises.length\n return wait().then(_ => Promise.all(promises)).then(values => {\n if(promises.length > total){\n return finish()\n }\n done = true\n return states\n })\n }\n\n const resolve = (props) => {\n const keys = Object.keys(props)\n if (!keys.length)\n return Promise.resolve(true)\n\n let f = []\n keys.forEach(name => {\n let x = props[name]\n\n while(x instanceof Function)\n x = x()\n\n if(x && x.then instanceof Function)\n f.push(x.then(d => states[name] = d))\n })\n\n return _await(f)\n }\n\n const getState = () => states\n\n return { finish, resolve, getState, promises, isDone }\n }\n\n const gs = (view, state) => {\n let r = view(state)\n while(r instanceof Function)\n r = view(instance.getState())\n return r\n }\n\n const container = (view, queries={}, instance=resolver()) => {\n let wrapper_view = state =>\n instance.isDone() ? view(state) : m('span')\n\n return () => {\n let r = gs(wrapper_view, instance.getState())\n instance.resolve(queries)\n\n if(r instanceof Array) {\n let d = instance.finish().then(_ =>\n gs(wrapper_view, instance.getState()))\n\n return r.map((x,i) => {\n x.resolve = _ => d.then(vdom => vdom[i])\n return x\n })\n }\n\n r.resolve = _ => instance.finish().then(_ =>\n gs(wrapper_view, instance.getState()))\n\n return r\n }\n }\n\n const reservedAttrs = ['className','id']\n\n const toHTML = _vdom => {\n while(_vdom instanceof Function) _vdom = _vdom()\n if(_vdom instanceof Array) return new Promise(r => r(html(..._vdom)))\n if(!_vdom) return new Promise(r => r(''))\n if(typeof _vdom !== 'object') return new Promise(r => r(_vdom))\n return (_vdom.resolve ? _vdom.resolve() : Promise.resolve()).then(vdom => {\n if(!vdom) vdom = _vdom\n\n if(vdom instanceof Array) return new Promise(r => r(html(...vdom)))\n\n const {tag, id, className, attrs, children, instance} = vdom,\n _id = (id || (attrs && attrs.id)) ? ` id=\"${(id || (attrs && attrs.id) || '')}\"` : '',\n _class = (className || (attrs && attrs.className)) ? ` class=\"${((className||'') + ' ' + (attrs.className||'')).trim()}\"` : ''\n\n const events = stripEvents(vdom)\n let _attrs = '',\n inner = ''\n for(var i in (attrs || Object.create(null))){\n if(i === 'style'){\n _attrs += ` style=\"${stylify(attrs[i])}\"`\n } else if(i === 'innerHTML') {\n inner = attrs[i]\n } else if(reservedAttrs.indexOf(i) === -1){\n _attrs += ` ${i}=\"${attrs[i]}\"`\n }\n }\n\n if(!inner && children)\n return html(...children).then(str =>\n `<${tag}${_id}${_class}${_attrs}>${str}`)\n\n if('br,input,img'.split(',').filter(x => x===tag).length === 0)\n return new Promise(r => r(`<${tag}${_id}${_class}${_attrs}>${inner}`))\n\n return new Promise(r => r(`<${tag}${_id}${_class}${_attrs} />`))\n })\n }\n\n const html = (...v) => Promise.all(v.map(toHTML)).then(x => x.filter(x => !!x).join(''))\n\n return {container, html, qs, update, mount, m, debounce}\n}\n\nmodule.exports = vdom()\n\n/*\nusage:\n\nlet component = () =>\n new Array(20).fill(true).map(x =>\n m('div', {onMouseOver: e => log(e.target.innerHTML)}, range(1,100)))\n\nclient-side\n-----\nmount(component, qs())\n\nclient-side constant re-rendering\n-----\nconst run = () => {\n setTimeout(run, 20)\n update()\n}\nrun()\n*/\n\n/* CONTAINER / HTML USAGE (Server-side rendering)\n\nconst name = _ => new Promise(res => setTimeout(_ => res('matt'), 1500))\n\nlet x = container(data => [\n m('div.test.row', {className:'hola', 'data-name':data.name, style:{border:'1px solid black'}}),\n m('div', data.name),\n ],\n {name}\n)\n\nhtml(x).then(x => log(x)).catch(e => log(e+''))\n*/\n","export const log = (...a) => console.log(...a)\n\n// rAF\nexport const rAF =\n !!global.document &&\n (global.requestAnimationFrame ||\n global.webkitRequestAnimationFrame ||\n global.mozRequestAnimationFrame) ||\n (cb => setTimeout(cb, 16.6))\n\n// composition\n// c :: (T -> U) -> (U -> V) -> (T -> V)\nexport const c = (f,g) => x => f(g(x))\n\n// cof :: [(an -> bn)] -> a0 -> bn\n// compose forward\nexport const cof = (...fns) => fns.reduce((acc,fn) => c(acc, fn))\n\n// cob :: [(an -> bn)] -> b0 -> an\n// compose backwards\nexport const cob = (...fns) => cof(...fns.reverse())\n\n// functional utilities\n// pointfree\nexport const pf = fn => (...args) => x => fn.apply(x, args)\n\n// curry\n// curry :: (T -> U) -> [args] -> ( -> U)\nexport const curry = (fn, ...args) =>\n\tfn.bind(undefined, ...args)\n\n\n// Transducers\nexport const mapping = (mapper) => // mapper: x -> y\n (reducer) => // reducer: (state, value) -> new state\n (result, value) =>\n reducer(result, mapper(value))\n\nexport const filtering = (predicate) => // predicate: x -> true/false\n (reducer) => // reducer: (state, value) -> new state\n (result, value) =>\n predicate(value) ? reducer(result, value) : result\n\nexport const concatter = (thing, value) =>\n thing.concat([value])\n","\nconst mixin = (...classes) => {\n class _mixin {}\n\n let proto = _mixin.prototype\n\n classes.map(({prototype:p}) => {\n Object.getOwnPropertyNames(p).map(key => {\n let oldFn = proto[key] || ($ => {})\n proto[key] = function() {\n oldFn.apply(null, [].slice.call(arguments))\n return p[key].apply(null, [].slice.call(arguments))\n }\n })\n })\n\n return _mixin\n}\n\nmodule.exports = mixin","// Validate JS objects for their \"shape\"\nconst model = {\n is(type, value) {\n if(type && type.isValid instanceof Function){\n return type.isValid(value)\n } else if((type === String && ((value instanceof String) || typeof value === 'string'))\n || (type === Number && ((value instanceof Number) || typeof value === 'number'))\n || (type === Boolean && ((value instanceof Boolean) || typeof value === 'boolean'))\n || (type === Function && ((value instanceof Function) || typeof value === 'function'))\n || (type === Object && ((value instanceof Object) || typeof value === 'object'))\n || (type === undefined)\n ){\n return true\n }\n\n return false\n },\n check(types, required, data) {\n Object.keys(types).forEach(key => {\n let t = types[key],\n value = data[key]\n\n if(required[key] || value !== undefined){\n if(!(t instanceof Array)) t = [t]\n\n let i = t.reduce((a,_type) => a || MODEL.is(_type, value), false)\n if(!i) {\n throw `{${key}: ${JSON.stringify(value)}} is not one of ${t.map(x => `\\n - ${x}`)}`\n }\n }\n })\n\n return true\n },\n init(...args) {\n let types, required, logic\n args.map(x => {\n if(x instanceof Function && !logic){ logic = x }\n else if(typeof x === 'object') {\n if(!types){ types = x }\n else if(!required){ required = x }\n }\n })\n\n const isValid = (data) => {\n const pipe = logic ? [check, logic] : [check]\n return pipe.reduce((a,v) => a && v(types||{},required||{},data), true)\n }\n\n const whenValid = (data) => new Promise((res,rej) => isValid(data) && res(data))\n\n return {isValid, whenValid}\n },\n ArrayOf(M) {\n return MODEL.init((t,r,data) => {\n if(!(data instanceof Array)) throw `${data} not an Array`\n data.map(x => {\n if(!MODEL.is(M, x))\n throw `${x} is not a model instance`\n })\n return true\n })\n }\n}\n\nexport default model\n\n/**\nUse it\n\n// create a Name model with required first/last,\n// but optional middle\nlet Name = MODEL.init({\n first: String,\n middle: String,\n last: String\n}, {first:true, last:true})\n\n// create a Tags model with extra checks\nlet Tags = MODEL.init((types,required,data) => {\n if(!(data instanceof Array)) throw `${data} not an Array`\n data.map(x => {\n if(!is(String, x))\n throw `[${data}] contains non-String`\n })\n return true\n})\n\n// create a Price model that just has a business logic fn\nlet Price = MODEL.init((t,r,d) => {\n return (d instanceof Number || typeof d === 'number') && d !== 0\n})\n\n// create an Activity model with a required type and name,\n// all others optional\nlet Activity = MODEL.init({\n type: [String, Function, Number],\n latlng: Array,\n title: String,\n tags: Tags,\n name: Name,\n price: Price\n}, {name:true, price: true})\n\n// create a new Activity instance, throwing errors if there are\n// any invalid fields.\nlet a = {\n tags: ['1','2'],\n type: 1,\n name: {first:'matt',last:'keas'},\n price: 100.43,\n url: 'http://www.google.com'\n}\nActivity.whenValid(a).then(log).catch(e => log(e+''))\n**/\n","// async-supporting-observables\nconst obs = (state) => {\n let subscribers = []\n\n const fn = (val) => {\n if(val !== undefined){\n state = val\n for(let i = 0, len = subscribers.length; i {\n const o = obs()\n subscribers.push(val => o(f(val)))\n return o\n }\n\n fn.filter = f => {\n const o = obs()\n subscribers.push(val => f(val) && o(val))\n return o\n }\n\n fn.then = f => {\n subscribers.push(val => f(val))\n return fn\n }\n\n fn.take = (n) => {\n const values = [],\n \to = obs()\n\n const cb = val => {\n if(values.length < n)\n values.push(val)\n\n if(values.length === n) {\n subscribers.delete(cb)\n return o(values)\n }\n }\n\n subscribers.push(cb)\n\n return o\n }\n\n fn.takeWhile = f => {\n const values = [],\n \to = obs()\n\n const cb = val => {\n if(!f(val)) {\n subscribers = subscribers.filter(x => x !== cb)\n return o(values)\n }\n\n\t\t\tvalues.push(val)\n }\n\n subscribers.push(cb)\n\n return o\n }\n\n fn.reduce = (f,acc) => {\n const o = obs()\n\n subscribers.push(val => {\n acc = f(acc,val)\n o(acc)\n })\n\n return o\n }\n\n fn.maybe = f => {\n const success = obs(),\n error = obs(),\n cb = val =>\n \t\tf(val)\n\t\t\t\t .then(d => success(d))\n .catch(e => error(e))\n\n subscribers.push(cb)\n\n return [ success, error ]\n }\n\n fn.stop = () => subscribers = []\n\n fn.debounce = ms => {\n const o = obs()\n let ts = +new Date\n subscribers.push(val => {\n const now = +new Date\n if(now - ts >= ms){\n ts = +new Date\n o(val)\n }\n })\n return o\n }\n\n return fn\n}\n\nobs.from = f => {\n const o = obs()\n f(x => o(x))\n return o\n}\n\nobs.union = (...fs) => {\n const o = obs()\n fs.map(f => f.then(o))\n return o\n}\n\nexport default obs","// compute the hamming weight\nexport const hamming = x => {\n x -= ((x >> 1) & 0x55555555)\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n x = (x + (x >> 4)) & 0x0f0f0f0f\n x += (x >> 8)\n x += (x >> 16)\n return (x & 0x7f)\n}\n\nexport const popcount = root => {\n if(root.key)\n return 1\n\n let c = root.children\n if(c) {\n var sum = 0\n for(var i in c) sum += popcount(c[i])\n return sum\n }\n}\n\n// hash fn\nexport const hash = (v='') => {\n v = JSON.stringify(v)\n var hash = 5381\n for (let i = 0; i < v.length; i++)\n hash = ((hash << 5) + hash) + v.charCodeAt(i)\n return hash\n}\n\n// compare two hashes\nexport const comp = (a,b) => hash(a) === hash(b)\n\n// get a bit vector\nexport const HMAP_SIZE = 8\nexport const MAX_DEPTH = 32 / HMAP_SIZE - 1\nexport const vec = (h=0, i=0, range=HMAP_SIZE) => (h >>> (range*i)) & ((1 << range) - 1)\n\nexport const shallowClone = x => {\n let y = Object.create(null)\n for(let i in x)\n y[i] = x[i]\n return y\n}\n\nexport const cloneNode = x => {\n let y = node()\n if(!x) return y\n\n if(x.children) {\n y.children = shallowClone(x.children)\n } else if(x.key !== undefined) {\n y.key = x.key\n y.val = x.val\n y.hash = x.hash\n }\n\n return y\n}\n\nexport const numChildren = x => {\n let c = 0\n for(var i in x) ++c\n return c\n}\n\nexport const set = (root, key, val) => {\n if((root.key === undefined) && !root.children) return node(key, val)\n\n const newroot = cloneNode(root), h = hash(key)\n\n // walk the tree\n for(var i = 3, r = root, n = newroot; i >= 0; --i){\n let bits = vec(h, i)\n\n if(r.key !== undefined){\n // if we have a collision\n if(r.key === key || i === 0) {\n // if keys match or is leaf, just overwrite n's val\n n.val = val\n } else if(i !== 0) {\n // else if r is not at max depth and keys don't match\n // add levels to both trees, new tree must be able\n // to access old data\n\n // 0. create makeshift value node for r\n // and new value node for n\n let cp = node(r.key, r.val, r.hash)\n let cn = node(key, val, h)\n let rh = r.hash\n\n // 1. delete value props from nodes\n delete r.key\n delete r.val\n delete r.hash\n delete n.key\n delete n.val\n delete n.hash\n\n // 2. create layers until bit-vectors don't collide\n for(let j = i, __r = r, __n = n; j >= 0; j--){\n let vecr = vec(rh, j),\n vecn = vec(h, j)\n\n // create new layer for c and r\n let c = __r.children = Object.create(null)\n let d = __n.children = shallowClone(c)\n\n if(vecr !== vecn) {\n c[vecr] = cp\n d[vecr] = cp\n d[vecn] = cn\n break\n } else {\n __r = c[vecr] = node()\n __n = d[vecn] = cloneNode(__r)\n }\n }\n }\n break\n } else if(r.children) {\n let _r = r.children[bits]\n if(!_r) {\n n = n.children[bits] = node(key, val)\n break\n } else {\n r = _r\n n = n.children[bits] = cloneNode(r)\n }\n }\n }\n\n return newroot\n}\n\nexport const get = (root, key) => {\n if(root.key === key) return root.val\n const h = hash(key)\n for(let i = 3, r = root; i >= 0; --i){\n if(!r.children) return undefined\n r = r.children[vec(h, i)]\n if(!r) return undefined\n if(r.key !== undefined) return r.val\n }\n\n return undefined\n}\n\nexport const first = root => {\n let c = root.children\n for(let i in c) return c[i]\n}\n\nexport const unset = (root, key) => {\n const n = cloneNode(root),\n h = hash(key)\n\n for(var i = 3, _n = n, p = n; i >= -1; --i) {\n if(_n.key) {\n delete _n.key\n delete _n.val\n delete _n.hash\n return n\n\n// let c = numChildren(p)\n\n// if(c === 1) {\n// // if only child, delete child and parent?\n// delete p.children\n// } else if(c===2){\n// // if 2 children, promote sibling as parent value nod\n// delete p.children[bits]\n// let sibling = first(p)\n// delete p.children\n// if(sibling.children){\n// p.children = sibling.children\n// } else if(p.key) {\n// p.val = sibling.val\n// p.hash = sibling.hash\n// p.key = sibling.key\n// }\n// } else {\n// // if more than 2 children, just delete the one\n// delete p.children[bits]\n// }\n// return n\n }\n\n const bits = vec(h, i)\n _n = _n && _n.children && _n.children[bits]\n if(!_n) return n\n p = _n\n }\n return n\n}\n\nexport const node = (key,val,h= key !== undefined && hash(key)) => {\n /*\n potential props of a tree node\n - key - hashkey\n - val - value\n - children - { ... } -> points to other nodes (List children)\n */\n\n let item = Object.create(null)\n if(key !== undefined){\n item.key = key\n item.hash = h\n item.val = val\n }\n return item\n}\n\nexport const map = (root, fn) => {\n if(root.key !== undefined)\n return node(root.key, fn(root.val, root.key), root.hash)\n\n let d = cloneNode(root),\n c = d.children\n\n if(c) {\n for(var i in c){\n c[i] = map(c[i], fn)\n }\n }\n\n return d\n}\n\nexport const filter = (root, fn) => {\n if(root.key !== undefined)\n return fn(root.val, root.key) ? root : undefined\n\n let d = cloneNode(root),\n c = d.children\n\n if(c) {\n for(var i in c){\n if(!filter(c[i], fn))\n delete c[i]\n }\n }\n\n return d\n}\n\nexport const reduce = (root, fn, acc) => {\n if(root.key !== undefined)\n return fn(acc, root.val, root.key)\n\n let c = root.children\n if(c) {\n for(var i in c)\n acc = reduce(c[i], fn, acc)\n\n return acc\n }\n}\n\nexport const toList = (root, r=[]) => {\n if(root.key !== undefined) r.push(root.val)\n\n let c = root.children\n if(c) {\n for(var i in c) {\n toList(c[i], r)\n }\n }\n\n return r\n}\n\nexport const toOrderedList = (root, r=[]) => {\n let i = 0,\n n\n\n do {\n n = get(root, i++)\n n !== undefined && r.push(n)\n } while(n)\n\n return r\n}\n\nexport const toJSON = (root, r={}) => {\n if(root.key !== undefined)\n r[root.key] = root.val\n\n let c = root.children\n if(c) {\n for(var i in c) {\n toJson(c[i], r)\n }\n }\n\n return r\n}\n\nexport const push = (root, val) => set(root, popcount(root), val)\n\nexport const pop = root => unset(root, popcount(root)-1)\n\nexport const shift = root => reduce(\n unset(root, 0),\n (acc,v,k) => set(acc, k-1, v),\n node())\n\nexport const unshift = (root, val) =>\n set(\n reduce(\n root,\n (acc,v,k) => set(acc, k+1, v),\n node()),\n 0,\n val)\n\nexport const hamt = node\n\n// console.clear()\n// const l = (...args) => console.log(...args)\n// const j = (...a) => console.log(JSON.stringify(a))\n\n// let x = hamt()\n// let s = 20\n\n// Array(s).fill(1).map((v,i) => {\n// x = set(x, i, i)\n// })\n\n// l(toList(x))\n// l(toJson(x))\n\n// x = map(x, x => log(x*x) || x*x)\n// l(get(x, 19))\n\n// l(x)\n// l(reduce(x, (acc, x) => acc+x, 0))\n\n// x = unset(x, 1)\n// Array(s).fill(1).map((_,i) => {\n// if(!get(x, i)) l(i)\n// // l(get(x, i))\n// })","const supports = (...q) => () =>\n q.reduce((acc,s) =>\n acc\n || (window[s] !== undefined)\n && /[native code]/.test(window[s]+'')\n && window[s]\n , false)\n\nconst supportsWorkers = supports('Worker')\n\nconst supportsBlobs = supports('Blob')\n\nconst supportsURLs = supports('URL', 'webkitURL')\n\nconst supportsBuilders = supports('BlobBuilder', 'WebKitBlobBuilder', 'MozBlobBuilder')\n\n/*\nworker:: [X] -> Worker where X : Function | String\n\nthe last X provided in the arguments will be setup as the handler for self.onmessage()\n*/\nexport const worker = (...code) => {\n if(!supportsWorkers()) throw 'WebWorkers not supported'\n\n code[code.length-1] = `self.onmessage=${code[code.length-1]}`\n\n const B = supportsBlobs()\n , U = supportsBuilders()\n , W = supportsURLs()\n\n let blob\n\n if(supportsBlobs()) {\n blob =\n new B(code.map(c => c+''),\n {type: 'application/javascript'})\n\n } else if(U){\n blob = new U\n code.map(c => blob.append(c+''))\n blob = blob.getBlob()\n } else {\n blob = `data:application/javascript,`\n +`${encodeURIComponent(\n code.reduce((acc,c) => acc+c, '')\n )}`\n }\n\n let url = W.createObjectURL(blob)\n return new Worker(url)\n}\n\nexport const farm = (n, ...code) => {\n let workers = Array(n).fill(1).map(x => worker(...code))\n , current = 0\n , iter = () => {\n let _n = current\n ++current >= n && (current = 0)\n return current\n }\n , pipe\n , onerror\n\n workers.map(w => {\n w.onmessage = e => pipe instanceof Function && pipe(e.data)\n w.onerror = e => onerror instanceof Function && onerror(e)\n })\n\n const exec = (...args) => {\n let w = workers[iter()]\n w && w.postMessage(args)\n }\n\n exec.pipe = fn => {\n pipe = fn\n return exec\n }\n exec.error = fn => {\n onerror = fn\n return exec\n }\n return exec\n}\n"]} \ No newline at end of file +{"version":3,"sources":["index.js","batch.js","vdom.js","fp.js","mixin.js","model.js","observable.js","hamt.js","worker.js"],"names":["hamt","worker","fp","hash","v","_v","JSON","stringify","i","len","length","c","charCodeAt","module","exports","Object","assign","batch","vdom","mixin","model","obs","inflight","url","options","method","key","toLowerCase","f","compress","Promise","res","rej","then","d","catch","e","undefined","data","console","error","class_id_regex","tagName_regex","parseSelector","test","tagreg","exec","s","tag","slice","reg","create","substr","className","trim","id","debounce","func","wait","immediate","timeout","args","later","callNow","clearTimeout","setTimeout","m","selector","children","attrs","Array","Function","unshift","shouldUpdate","unload","config","__hash","stripEvents","a","name","applyEvents","events","el","strip_existing","removeEvents","flatten","arr","push","EVENTS","split","map","x","mnt","mount","fn","render","applyUpdates","update","stylify","style","setAttrs","attr","innerHTML","value","setAttribute","_id","_className","createTag","parent","parentElement","__vdom","t","document","createTextNode","insertBefore","removeEl","appendChild","shouldExchange","tagName","_shouldUpdate","createElement","removeChild","insertAt","next_sib","resolve","_el","vdom_children","el_children","childNodes","qs","querySelector","resolver","states","promises","done","_await","_promises","finish","ms","isDone","total","all","props","keys","forEach","getState","gs","view","state","r","instance","container","queries","wrapper_view","reservedAttrs","toHTML","_vdom","html","_class","_attrs","inner","indexOf","str","filter","join","log","rAF","global","requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","cb","g","cof","fns","reduce","acc","cob","reverse","pf","apply","curry","bind","mapping","mapper","reducer","result","filtering","predicate","concatter","thing","concat","classes","_mixin","proto","prototype","p","getOwnPropertyNames","oldFn","call","arguments","is","type","isValid","String","Number","Boolean","check","types","required","_type","MODEL","init","logic","pipe","whenValid","ArrayOf","M","subscribers","val","o","take","n","values","delete","takeWhile","maybe","success","stop","ts","Date","now","from","union","fs","hamming","popcount","root","sum","comp","b","HMAP_SIZE","MAX_DEPTH","vec","h","range","shallowClone","y","cloneNode","node","numChildren","set","newroot","bits","cp","cn","rh","j","__r","__n","vecr","vecn","_r","get","first","unset","_n","item","toList","toOrderedList","toJSON","toJson","pop","shift","k","supports","q","window","supportsWorkers","supportsBlobs","supportsURLs","supportsBuilders","code","B","U","W","blob","append","getBlob","encodeURIComponent","createObjectURL","Worker","farm","workers","fill","current","iter","onerror","w","onmessage","postMessage"],"mappings":";;;;;;;;;AAAA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;IAAYA;;AACZ;;IAAYC;;AACZ;;IAAYC;;;;;;AAEL,IAAMC,sBAAO,cAACC,CAAD,EAA4B;AAAA,QAAzBC,EAAyB,uEAAtBC,KAAKC,SAAL,CAAeH,CAAf,CAAsB;;AAC5C,QAAID,OAAO,CAAX;AACA,SAAK,IAAIK,IAAI,CAAR,EAAWC,MAAMJ,GAAGK,MAAzB,EAAiCF,IAAIC,GAArC,EAA0C,EAAED,CAA5C,EAA+C;AAC3C,YAAMG,IAAIN,GAAGO,UAAH,CAAcJ,CAAd,CAAV;AACAL,eAAS,CAACA,QAAQ,CAAT,IAAcA,IAAf,GAAuBQ,CAAxB,GAA6B,CAApC;AACH;AACD,WAAOR,IAAP;AACH,CAPM;;AASPU,OAAOC,OAAP,GAAiBC,OAAOC,MAAP,CAAc,EAAd,EAAkBd,EAAlB,EAAsB;AACtCe,0BADsC;AAEpCC,wBAFoC;AAGpCC,0BAHoC;AAIpCC,0BAJoC;AAKpCC,6BALoC;AAMpCrB,cANoC;AAOpCC;AAPoC,CAAtB,CAAjB;;;;;;;;;;ACjBA;AACA;AACA;AACA;;AAEA;AACA,IAAMgB,Q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SAAPA,IAAO,GAAM;AACX,YAAI9B,KAAK6B,OAAT;AACA,UAAEA,OAAF,IAAazE,CAAb,KAAmByE,UAAU,CAA7B;AACA,eAAOA,OAAP;AACH,KANL;AAAA,QAOMjF,aAPN;AAAA,QAQMmF,gBARN;;AAUAJ,YAAQ3M,GAAR,CAAY,aAAK;AACbgN,UAAEC,SAAF,GAAc;AAAA,mBAAKrF,gBAAgB/I,QAAhB,IAA4B+I,KAAKlL,EAAEE,IAAP,CAAjC;AAAA,SAAd;AACAoQ,UAAED,OAAF,GAAY;AAAA,mBAAKA,mBAAmBlO,QAAnB,IAA+BkO,QAAQrQ,CAAR,CAApC;AAAA,SAAZ;AACH,KAHD;;AAKA,QAAMU,OAAO,SAAPA,IAAO,GAAa;AAAA,2CAATe,IAAS;AAATA,gBAAS;AAAA;;AACtB,YAAI6O,IAAIL,QAAQG,MAAR,CAAR;AACAE,aAAKA,EAAEE,WAAF,CAAc/O,IAAd,CAAL;AACH,KAHD;;AAKAf,SAAKwK,IAAL,GAAY,cAAM;AACdA,eAAOxH,EAAP;AACA,eAAOhD,IAAP;AACH,KAHD;AAIAA,SAAKN,KAAL,GAAa,cAAM;AACfiQ,kBAAU3M,EAAV;AACA,eAAOhD,IAAP;AACH,KAHD;AAIA,WAAOA,IAAP;AACH,CA9BM","file":"","sourcesContent":["import batch from './batch'\nimport vdom from './vdom'\nimport mixin from './mixin'\nimport model from './model'\nimport obs from './observable'\nimport * as hamt from './hamt'\nimport * as worker from './worker'\nimport * as fp from './fp'\n\nexport const hash = (v,_v=JSON.stringify(v)) => {\n let hash = 0\n for (let i = 0, len = _v.length; i < len; ++i) {\n const c = _v.charCodeAt(i)\n hash = (((hash << 5) - hash) + c) | 0\n }\n return hash\n}\n\nmodule.exports = Object.assign({}, fp, {\n\tbatch\n\t, vdom\n\t, mixin\n\t, model\n\t, obs\n\t, hamt\n\t, worker\n})\n","\n// batched requests\n// The `fetch()` module batches in-flight requests, so if at any point in time, anywhere in my front-end or\n// back-end application I have a calls occur to `fetch('http://api.github.com/users/matthiasak')` while another\n// to that URL is \"in-flight\", the Promise returned by both of those calls will be resolved by a single network request.\n\n// f :: (url -> options) -> Promise\nconst batch = f => {\n let inflight = {}\n\n return (url, options={}) => {\n let {method} = options,\n key = `${url}:${JSON.stringify(options)}`\n\n if((method || '').toLowerCase() === 'post')\n return f(url, Object.assign({}, options, {compress: false}))\n\n return inflight[key] ||\n (inflight[key] =\n new Promise((res,rej) => {\n f(url, Object.assign({}, options, {compress: false}))\n .then(d => res(d))\n .catch(e => rej(e))\n })\n .then(data => {\n inflight = Object.assign({}, inflight, {[key]: undefined})\n return data\n })\n .catch(e =>\n console.error(e, url)))\n }\n}\n\nexport default batch","import {rAF} from './fp'\n\n// Virtual DOMs\nconst vdom = () => {\n const class_id_regex = () => {\n return /[#\\.][^#\\.]+/ig\n },\n tagName_regex = () => {\n return /^([^\\.#]+)\\b/i\n }\n\n const parseSelector = s => {\n let test = null,\n tagreg = tagName_regex().exec(s),\n tag = tagreg && tagreg.slice(1)[0],\n reg = class_id_regex(),\n vdom = Object.create(null)\n\n if(tag) s = s.substr(tag.length)\n vdom.className = ''\n vdom.tag = tag || 'div'\n\n while((test = reg.exec(s)) !== null){\n test = test[0]\n if(test[0] === '.')\n vdom.className = (vdom.className+' '+test.substr(1)).trim()\n else if(test[0] === '#')\n vdom.id = test.substr(1)\n }\n return vdom\n }\n\n const debounce = (func, wait, immediate, timeout) =>\n (...args) => {\n let later = () => {\n timeout = null\n !immediate && func(...args)\n }\n var callNow = immediate && !timeout\n clearTimeout(timeout)\n timeout = setTimeout(later, wait || 0)\n callNow && func(...args)\n }\n\n const hash = (v,_v=JSON.stringify(v)) => {\n let hash = 0\n for (let i = 0, len = _v.length; i < len; ++i) {\n const c = _v.charCodeAt(i)\n hash = (((hash << 5) - hash) + c) | 0\n }\n return hash\n }\n\n const m = (selector, attrs=Object.create(null), ...children) => {\n if(attrs.tag || !(typeof attrs === 'object') || attrs instanceof Array || attrs instanceof Function){\n if(attrs instanceof Array) children.unshift(...attrs)\n else children.unshift(attrs)\n attrs = Object.create(null)\n }\n let vdom = parseSelector(selector)\n if(children.length)\n vdom.children = children\n vdom.attrs = attrs\n vdom.shouldUpdate = attrs.shouldUpdate\n vdom.unload = attrs.unload\n vdom.config = attrs.config\n vdom.__hash = hash(vdom)\n delete attrs.unload\n delete attrs.shouldUpdate\n delete attrs.config\n return vdom\n }\n\n // creatign html, strip events from DOM element... for now just deleting\n const stripEvents = ({attrs}) => {\n let a = Object.create(null)\n\n if(attrs){\n for(var name in attrs){\n if(name[0]==='o'&&name[1]==='n') {\n a[name] = attrs[name]\n delete attrs[name]\n }\n }\n }\n\n return a\n }\n\n const applyEvents = (events, el, strip_existing=true) => {\n strip_existing && removeEvents(el)\n for(var name in events){\n el[name] = events[name]\n }\n }\n\n const flatten = (arr, a=[]) => {\n for(var i=0,len=arr.length; i 'on'+x)\n\n const removeEvents = el => {\n // strip away event handlers on el, if it exists\n if(!el) return;\n for(var i in EVENTS){\n el[i] = null\n }\n }\n\n let mnt\n\n const mount = (fn, el) => {\n mnt = [el, fn]\n render(fn, el)\n }\n\n const render = debounce((fn, el) => rAF(_ => {\n applyUpdates(fn, el.children[0], el)\n }))\n\n const update = () => {\n if(!mnt) return\n let [el, fn] = mnt\n render(fn, el)\n }\n\n const stylify = style => {\n let s = ''\n for(var i in style){\n s+=`${i}:${style[i]};`\n }\n return s\n }\n\n const setAttrs = ({attrs, id, className, __hash},el) => {\n \tel.className = ''\n \tel.style = ''\n\n if(attrs){\n for(var attr in attrs){\n if(attr === 'style') {\n el.style = stylify(attrs[attr])\n } else if(attr === 'innerHTML'){\n rAF(() => el.innerHTML = attrs[attr])\n } else if(attr === 'value'){\n rAF(() => el.value = attrs[attr])\n } else {\n el.setAttribute(attr, attrs[attr])\n }\n }\n }\n let _id = attrs.id || id\n if(_id) el.id = _id\n let _className = ((attrs.className || '') + ' ' + (className || '')).trim()\n if(_className) el.className = _className\n el.__hash = __hash\n }\n\n // recycle or create a new el\n const createTag = (vdom=Object.create(null), el, parent=el&&el.parentElement) => {\n let __vdom = vdom\n // make text nodes from primitive types\n if(typeof vdom !== 'object'){\n let t = document.createTextNode(vdom)\n if(el){\n parent.insertBefore(t,el)\n removeEl(el)\n } else {\n parent.appendChild(t)\n }\n return t\n }\n\n // else make an HTMLElement from \"tag\" types\n let {tag, attrs, id, className, unload, shouldUpdate, config, __hash} = vdom,\n shouldExchange = !el || !el.tagName || (tag && el.tagName.toLowerCase() !== tag.toLowerCase()),\n _shouldUpdate = !(shouldUpdate instanceof Function) || shouldUpdate(el)\n\n if(!attrs) return\n if(el && (!_shouldUpdate || ((!vdom instanceof Function) && el.__hash === __hash))) {\n return\n }\n\n if(shouldExchange){\n let t = document.createElement(tag)\n el ? (parent.insertBefore(t, el), removeEl(el)) : parent.appendChild(t)\n el = t\n }\n\n setAttrs(vdom, el)\n if(el.unload instanceof Function) {\n rAF(el.unload)\n }\n if(unload instanceof Function) {\n el.unload = unload\n }\n applyEvents(stripEvents(vdom), el)\n config && rAF(_ => config(el))\n return el\n }\n\n // find parent element, and remove the input element\n const removeEl = el => {\n if(!el) return\n el.parentElement.removeChild(el)\n removeEvents(el)\n // removed for now, added unload logic to the immediate draw()s\n if(el.unload instanceof Function)\n el.unload()\n }\n\n const insertAt = (el, parent, i) => {\n if(parent.children.length > i) {\n let next_sib = parent.children[i]\n parent.insertBefore(el, next_sib)\n } else {\n parent.appendChild(el)\n }\n }\n\n const applyUpdates = (vdom, el, parent=el&&el.parentElement) => {\n let v = vdom\n // if vdom is a function, execute it until it isn't\n while(vdom instanceof Function)\n vdom = vdom()\n\n if(!vdom) return\n\n if(vdom.resolve instanceof Function){\n let i = parent.children.length\n return vdom.resolve().then(v => {\n if(!el) {\n let x = createTag(v, null, parent)\n insertAt(x, parent, i)\n applyUpdates(v, x, parent)\n } else {\n applyUpdates(v, el, parent)\n }\n })\n }\n\n // create/edit el under parent\n let _el = vdom instanceof Array ? parent : createTag(vdom, el, parent)\n\n if(!_el) return\n\n if(vdom instanceof Array || vdom.children){\n let vdom_children = flatten(vdom instanceof Array ? vdom : vdom.children),\n el_children = vdom instanceof Array ? parent.childNodes : _el.childNodes\n\n while(el_children.length > vdom_children.length){\n removeEl(el_children[el_children.length-1])\n }\n\n for(let i=0; i 0){\n removeEl(_el.childNodes[_el.childNodes.length-1])\n }\n }\n }\n\n const qs = (s='body', el=document) => el.querySelector(s)\n\n const resolver = (states = {}) => {\n let promises = [],\n done = false\n\n const _await = (_promises = []) => {\n promises = [...promises, ..._promises]\n return finish()\n }\n\n const wait = (ms=0) => new Promise(res => setTimeout(res, ms))\n\n const isDone = () => done\n\n const finish = () => {\n const total = promises.length\n return wait().then(_ => Promise.all(promises)).then(values => {\n if(promises.length > total){\n return finish()\n }\n done = true\n return states\n })\n }\n\n const resolve = (props) => {\n const keys = Object.keys(props)\n if (!keys.length)\n return Promise.resolve(true)\n\n let f = []\n keys.forEach(name => {\n let x = props[name]\n\n while(x instanceof Function)\n x = x()\n\n if(x && x.then instanceof Function)\n f.push(x.then(d => states[name] = d))\n })\n\n return _await(f)\n }\n\n const getState = () => states\n\n return { finish, resolve, getState, promises, isDone }\n }\n\n const gs = (view, state) => {\n let r = view(state)\n while(r instanceof Function)\n r = view(instance.getState())\n return r\n }\n\n const container = (view, queries={}, instance=resolver()) => {\n let wrapper_view = state =>\n instance.isDone() ? view(state) : m('span')\n\n return () => {\n let r = gs(wrapper_view, instance.getState())\n instance.resolve(queries)\n\n if(r instanceof Array) {\n let d = instance.finish().then(_ =>\n gs(wrapper_view, instance.getState()))\n\n return r.map((x,i) => {\n x.resolve = _ => d.then(vdom => vdom[i])\n return x\n })\n }\n\n r.resolve = _ => instance.finish().then(_ =>\n gs(wrapper_view, instance.getState()))\n\n return r\n }\n }\n\n const reservedAttrs = ['className','id']\n\n const toHTML = _vdom => {\n while(_vdom instanceof Function) _vdom = _vdom()\n if(_vdom instanceof Array) return new Promise(r => r(html(..._vdom)))\n if(!_vdom) return new Promise(r => r(''))\n if(typeof _vdom !== 'object') return new Promise(r => r(_vdom))\n return (_vdom.resolve ? _vdom.resolve() : Promise.resolve()).then(vdom => {\n if(!vdom) vdom = _vdom\n\n if(vdom instanceof Array) return new Promise(r => r(html(...vdom)))\n\n const {tag, id, className, attrs, children, instance} = vdom,\n _id = (id || (attrs && attrs.id)) ? ` id=\"${(id || (attrs && attrs.id) || '')}\"` : '',\n _class = (className || (attrs && attrs.className)) ? ` class=\"${((className||'') + ' ' + (attrs.className||'')).trim()}\"` : ''\n\n const events = stripEvents(vdom)\n let _attrs = '',\n inner = ''\n for(var i in (attrs || Object.create(null))){\n if(i === 'style'){\n _attrs += ` style=\"${stylify(attrs[i])}\"`\n } else if(i === 'innerHTML') {\n inner = attrs[i]\n } else if(reservedAttrs.indexOf(i) === -1){\n _attrs += ` ${i}=\"${attrs[i]}\"`\n }\n }\n\n if(!inner && children)\n return html(...children).then(str =>\n `<${tag}${_id}${_class}${_attrs}>${str}`)\n\n if('br,input,img'.split(',').filter(x => x===tag).length === 0)\n return new Promise(r => r(`<${tag}${_id}${_class}${_attrs}>${inner}`))\n\n return new Promise(r => r(`<${tag}${_id}${_class}${_attrs} />`))\n })\n }\n\n const html = (...v) => Promise.all(v.map(toHTML)).then(x => x.filter(x => !!x).join(''))\n\n return {container, html, qs, update, mount, m, debounce}\n}\n\nmodule.exports = vdom()\n\n/*\nusage:\n\nlet component = () =>\n new Array(20).fill(true).map(x =>\n m('div', {onMouseOver: e => log(e.target.innerHTML)}, range(1,100)))\n\nclient-side\n-----\nmount(component, qs())\n\nclient-side constant re-rendering\n-----\nconst run = () => {\n setTimeout(run, 20)\n update()\n}\nrun()\n*/\n\n/* CONTAINER / HTML USAGE (Server-side rendering)\n\nconst name = _ => new Promise(res => setTimeout(_ => res('matt'), 1500))\n\nlet x = container(data => [\n m('div.test.row', {className:'hola', 'data-name':data.name, style:{border:'1px solid black'}}),\n m('div', data.name),\n ],\n {name}\n)\n\nhtml(x).then(x => log(x)).catch(e => log(e+''))\n*/\n","export const log = (...a) => console.log(...a)\n\n// rAF\nexport const rAF =\n !!global.document &&\n (global.requestAnimationFrame ||\n global.webkitRequestAnimationFrame ||\n global.mozRequestAnimationFrame) ||\n (cb => setTimeout(cb, 16.6))\n\n// composition\n// c :: (T -> U) -> (U -> V) -> (T -> V)\nexport const c = (f,g) => x => f(g(x))\n\n// cof :: [(an -> bn)] -> a0 -> bn\n// compose forward\nexport const cof = (...fns) => fns.reduce((acc,fn) => c(acc, fn))\n\n// cob :: [(an -> bn)] -> b0 -> an\n// compose backwards\nexport const cob = (...fns) => cof(...fns.reverse())\n\n// functional utilities\n// pointfree\nexport const pf = fn => (...args) => x => fn.apply(x, args)\n\n// curry\n// curry :: (T -> U) -> [args] -> ( -> U)\nexport const curry = (fn, ...args) =>\n\tfn.bind(undefined, ...args)\n\n\n// Transducers\nexport const mapping = (mapper) => // mapper: x -> y\n (reducer) => // reducer: (state, value) -> new state\n (result, value) =>\n reducer(result, mapper(value))\n\nexport const filtering = (predicate) => // predicate: x -> true/false\n (reducer) => // reducer: (state, value) -> new state\n (result, value) =>\n predicate(value) ? reducer(result, value) : result\n\nexport const concatter = (thing, value) =>\n thing.concat([value])\n","\nconst mixin = (...classes) => {\n class _mixin {}\n\n let proto = _mixin.prototype\n\n classes.map(({prototype:p}) => {\n Object.getOwnPropertyNames(p).map(key => {\n let oldFn = proto[key] || ($ => {})\n proto[key] = function() {\n oldFn.apply(null, [].slice.call(arguments))\n return p[key].apply(null, [].slice.call(arguments))\n }\n })\n })\n\n return _mixin\n}\n\nmodule.exports = mixin","// Validate JS objects for their \"shape\"\nconst model = {\n is(type, value) {\n if(type && type.isValid instanceof Function){\n return type.isValid(value)\n } else if((type === String && ((value instanceof String) || typeof value === 'string'))\n || (type === Number && ((value instanceof Number) || typeof value === 'number'))\n || (type === Boolean && ((value instanceof Boolean) || typeof value === 'boolean'))\n || (type === Function && ((value instanceof Function) || typeof value === 'function'))\n || (type === Object && ((value instanceof Object) || typeof value === 'object'))\n || (type === undefined)\n ){\n return true\n }\n\n return false\n },\n check(types, required, data) {\n Object.keys(types).forEach(key => {\n let t = types[key],\n value = data[key]\n\n if(required[key] || value !== undefined){\n if(!(t instanceof Array)) t = [t]\n\n let i = t.reduce((a,_type) => a || MODEL.is(_type, value), false)\n if(!i) {\n throw `{${key}: ${JSON.stringify(value)}} is not one of ${t.map(x => `\\n - ${x}`)}`\n }\n }\n })\n\n return true\n },\n init(...args) {\n let types, required, logic\n args.map(x => {\n if(x instanceof Function && !logic){ logic = x }\n else if(typeof x === 'object') {\n if(!types){ types = x }\n else if(!required){ required = x }\n }\n })\n\n const isValid = (data) => {\n const pipe = logic ? [check, logic] : [check]\n return pipe.reduce((a,v) => a && v(types||{},required||{},data), true)\n }\n\n const whenValid = (data) => new Promise((res,rej) => isValid(data) && res(data))\n\n return {isValid, whenValid}\n },\n ArrayOf(M) {\n return MODEL.init((t,r,data) => {\n if(!(data instanceof Array)) throw `${data} not an Array`\n data.map(x => {\n if(!MODEL.is(M, x))\n throw `${x} is not a model instance`\n })\n return true\n })\n }\n}\n\nexport default model\n\n/**\nUse it\n\n// create a Name model with required first/last,\n// but optional middle\nlet Name = MODEL.init({\n first: String,\n middle: String,\n last: String\n}, {first:true, last:true})\n\n// create a Tags model with extra checks\nlet Tags = MODEL.init((types,required,data) => {\n if(!(data instanceof Array)) throw `${data} not an Array`\n data.map(x => {\n if(!is(String, x))\n throw `[${data}] contains non-String`\n })\n return true\n})\n\n// create a Price model that just has a business logic fn\nlet Price = MODEL.init((t,r,d) => {\n return (d instanceof Number || typeof d === 'number') && d !== 0\n})\n\n// create an Activity model with a required type and name,\n// all others optional\nlet Activity = MODEL.init({\n type: [String, Function, Number],\n latlng: Array,\n title: String,\n tags: Tags,\n name: Name,\n price: Price\n}, {name:true, price: true})\n\n// create a new Activity instance, throwing errors if there are\n// any invalid fields.\nlet a = {\n tags: ['1','2'],\n type: 1,\n name: {first:'matt',last:'keas'},\n price: 100.43,\n url: 'http://www.google.com'\n}\nActivity.whenValid(a).then(log).catch(e => log(e+''))\n**/\n","// async-supporting-observables\nconst obs = (state) => {\n let subscribers = []\n\n const fn = (val) => {\n if(val !== undefined){\n state = val\n for(let i = 0, len = subscribers.length; i {\n const o = obs()\n subscribers.push(val => o(f(val)))\n return o\n }\n\n fn.filter = f => {\n const o = obs()\n subscribers.push(val => f(val) && o(val))\n return o\n }\n\n fn.then = f => {\n subscribers.push(val => f(val))\n return fn\n }\n\n fn.take = (n) => {\n const values = [],\n \to = obs()\n\n const cb = val => {\n if(values.length < n)\n values.push(val)\n\n if(values.length === n) {\n subscribers.delete(cb)\n return o(values)\n }\n }\n\n subscribers.push(cb)\n\n return o\n }\n\n fn.takeWhile = f => {\n const values = [],\n \to = obs()\n\n const cb = val => {\n if(!f(val)) {\n subscribers = subscribers.filter(x => x !== cb)\n return o(values)\n }\n\n\t\t\tvalues.push(val)\n }\n\n subscribers.push(cb)\n\n return o\n }\n\n fn.reduce = (f,acc) => {\n const o = obs()\n\n subscribers.push(val => {\n acc = f(acc,val)\n o(acc)\n })\n\n return o\n }\n\n fn.maybe = f => {\n const success = obs(),\n error = obs(),\n cb = val =>\n \t\tf(val)\n\t\t\t\t .then(d => success(d))\n .catch(e => error(e))\n\n subscribers.push(cb)\n\n return [ success, error ]\n }\n\n fn.stop = () => subscribers = []\n\n fn.debounce = ms => {\n const o = obs()\n let ts = +new Date\n subscribers.push(val => {\n const now = +new Date\n if(now - ts >= ms){\n ts = +new Date\n o(val)\n }\n })\n return o\n }\n\n return fn\n}\n\nobs.from = f => {\n const o = obs()\n f(x => o(x))\n return o\n}\n\nobs.union = (...fs) => {\n const o = obs()\n fs.map(f => f.then(o))\n return o\n}\n\nexport default obs","// compute the hamming weight\nexport const hamming = x => {\n x -= ((x >> 1) & 0x55555555)\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n x = (x + (x >> 4)) & 0x0f0f0f0f\n x += (x >> 8)\n x += (x >> 16)\n return (x & 0x7f)\n}\n\nexport const popcount = root => {\n if(root.key)\n return 1\n\n let c = root.children\n if(c) {\n var sum = 0\n for(var i in c) sum += popcount(c[i])\n return sum\n }\n}\n\n// hash fn\nexport const hash = (v='') => {\n v = JSON.stringify(v)\n var hash = 5381\n for (let i = 0; i < v.length; i++)\n hash = ((hash << 5) + hash) + v.charCodeAt(i)\n return hash\n}\n\n// compare two hashes\nexport const comp = (a,b) => hash(a) === hash(b)\n\n// get a bit vector\nexport const HMAP_SIZE = 8\nexport const MAX_DEPTH = 32 / HMAP_SIZE - 1\nexport const vec = (h=0, i=0, range=HMAP_SIZE) => (h >>> (range*i)) & ((1 << range) - 1)\n\nexport const shallowClone = x => {\n let y = Object.create(null)\n for(let i in x)\n y[i] = x[i]\n return y\n}\n\nexport const cloneNode = x => {\n let y = node()\n if(!x) return y\n\n if(x.children) {\n y.children = shallowClone(x.children)\n } else if(x.key !== undefined) {\n y.key = x.key\n y.val = x.val\n y.hash = x.hash\n }\n\n return y\n}\n\nexport const numChildren = x => {\n let c = 0\n for(var i in x) ++c\n return c\n}\n\nexport const set = (root, key, val) => {\n if((root.key === undefined) && !root.children) return node(key, val)\n\n const newroot = cloneNode(root), h = hash(key)\n\n // walk the tree\n for(var i = 3, r = root, n = newroot; i >= 0; --i){\n let bits = vec(h, i)\n\n if(r.key !== undefined){\n // if we have a collision\n if(r.key === key || i === 0) {\n // if keys match or is leaf, just overwrite n's val\n n.val = val\n } else if(i !== 0) {\n // else if r is not at max depth and keys don't match\n // add levels to both trees, new tree must be able\n // to access old data\n\n // 0. create makeshift value node for r\n // and new value node for n\n let cp = node(r.key, r.val, r.hash)\n let cn = node(key, val, h)\n let rh = r.hash\n\n // 1. delete value props from nodes\n delete r.key\n delete r.val\n delete r.hash\n delete n.key\n delete n.val\n delete n.hash\n\n // 2. create layers until bit-vectors don't collide\n for(let j = i, __r = r, __n = n; j >= 0; j--){\n let vecr = vec(rh, j),\n vecn = vec(h, j)\n\n // create new layer for c and r\n let c = __r.children = Object.create(null)\n let d = __n.children = shallowClone(c)\n\n if(vecr !== vecn) {\n c[vecr] = cp\n d[vecr] = cp\n d[vecn] = cn\n break\n } else {\n __r = c[vecr] = node()\n __n = d[vecn] = cloneNode(__r)\n }\n }\n }\n break\n } else if(r.children) {\n let _r = r.children[bits]\n if(!_r) {\n n = n.children[bits] = node(key, val)\n break\n } else {\n r = _r\n n = n.children[bits] = cloneNode(r)\n }\n }\n }\n\n return newroot\n}\n\nexport const get = (root, key) => {\n if(root.key === key) return root.val\n const h = hash(key)\n for(let i = 3, r = root; i >= 0; --i){\n if(!r.children) return undefined\n r = r.children[vec(h, i)]\n if(!r) return undefined\n if(r.key !== undefined) return r.val\n }\n\n return undefined\n}\n\nexport const first = root => {\n let c = root.children\n for(let i in c) return c[i]\n}\n\nexport const unset = (root, key) => {\n const n = cloneNode(root),\n h = hash(key)\n\n for(var i = 3, _n = n, p = n; i >= -1; --i) {\n if(_n.key) {\n delete _n.key\n delete _n.val\n delete _n.hash\n return n\n\n// let c = numChildren(p)\n\n// if(c === 1) {\n// // if only child, delete child and parent?\n// delete p.children\n// } else if(c===2){\n// // if 2 children, promote sibling as parent value nod\n// delete p.children[bits]\n// let sibling = first(p)\n// delete p.children\n// if(sibling.children){\n// p.children = sibling.children\n// } else if(p.key) {\n// p.val = sibling.val\n// p.hash = sibling.hash\n// p.key = sibling.key\n// }\n// } else {\n// // if more than 2 children, just delete the one\n// delete p.children[bits]\n// }\n// return n\n }\n\n const bits = vec(h, i)\n _n = _n && _n.children && _n.children[bits]\n if(!_n) return n\n p = _n\n }\n return n\n}\n\nexport const node = (key,val,h= key !== undefined && hash(key)) => {\n /*\n potential props of a tree node\n - key - hashkey\n - val - value\n - children - { ... } -> points to other nodes (List children)\n */\n\n let item = Object.create(null)\n if(key !== undefined){\n item.key = key\n item.hash = h\n item.val = val\n }\n return item\n}\n\nexport const map = (root, fn) => {\n if(root.key !== undefined)\n return node(root.key, fn(root.val, root.key), root.hash)\n\n let d = cloneNode(root),\n c = d.children\n\n if(c) {\n for(var i in c){\n c[i] = map(c[i], fn)\n }\n }\n\n return d\n}\n\nexport const filter = (root, fn) => {\n if(root.key !== undefined)\n return fn(root.val, root.key) ? root : undefined\n\n let d = cloneNode(root),\n c = d.children\n\n if(c) {\n for(var i in c){\n if(!filter(c[i], fn))\n delete c[i]\n }\n }\n\n return d\n}\n\nexport const reduce = (root, fn, acc) => {\n if(root.key !== undefined)\n return fn(acc, root.val, root.key)\n\n let c = root.children\n if(c) {\n for(var i in c)\n acc = reduce(c[i], fn, acc)\n\n return acc\n }\n}\n\nexport const toList = (root, r=[]) => {\n if(root.key !== undefined) r.push(root.val)\n\n let c = root.children\n if(c) {\n for(var i in c) {\n toList(c[i], r)\n }\n }\n\n return r\n}\n\nexport const toOrderedList = (root, r=[]) => {\n let i = 0,\n n\n\n do {\n n = get(root, i++)\n n !== undefined && r.push(n)\n } while(n)\n\n return r\n}\n\nexport const toJSON = (root, r={}) => {\n if(root.key !== undefined)\n r[root.key] = root.val\n\n let c = root.children\n if(c) {\n for(var i in c) {\n toJson(c[i], r)\n }\n }\n\n return r\n}\n\nexport const push = (root, val) => set(root, popcount(root), val)\n\nexport const pop = root => unset(root, popcount(root)-1)\n\nexport const shift = root => reduce(\n unset(root, 0),\n (acc,v,k) => set(acc, k-1, v),\n node())\n\nexport const unshift = (root, val) =>\n set(\n reduce(\n root,\n (acc,v,k) => set(acc, k+1, v),\n node()),\n 0,\n val)\n\nexport const hamt = node\n\n// console.clear()\n// const l = (...args) => console.log(...args)\n// const j = (...a) => console.log(JSON.stringify(a))\n\n// let x = hamt()\n// let s = 20\n\n// Array(s).fill(1).map((v,i) => {\n// x = set(x, i, i)\n// })\n\n// l(toList(x))\n// l(toJson(x))\n\n// x = map(x, x => log(x*x) || x*x)\n// l(get(x, 19))\n\n// l(x)\n// l(reduce(x, (acc, x) => acc+x, 0))\n\n// x = unset(x, 1)\n// Array(s).fill(1).map((_,i) => {\n// if(!get(x, i)) l(i)\n// // l(get(x, i))\n// })","const supports = (...q) => () =>\n q.reduce((acc,s) =>\n acc\n || (window[s] !== undefined)\n && /[native code]/.test(window[s]+'')\n && window[s]\n , false)\n\nconst supportsWorkers = supports('Worker')\n\nconst supportsBlobs = supports('Blob')\n\nconst supportsURLs = supports('URL', 'webkitURL')\n\nconst supportsBuilders = supports('BlobBuilder', 'WebKitBlobBuilder', 'MozBlobBuilder')\n\n/*\nworker:: [X] -> Worker where X : Function | String\n\nthe last X provided in the arguments will be setup as the handler for self.onmessage()\n*/\nexport const worker = (...code) => {\n if(!supportsWorkers()) throw 'WebWorkers not supported'\n\n code[code.length-1] = `self.onmessage=${code[code.length-1]}`\n\n const B = supportsBlobs()\n , U = supportsBuilders()\n , W = supportsURLs()\n\n let blob\n\n if(supportsBlobs()) {\n blob =\n new B(code.map(c => c+''),\n {type: 'application/javascript'})\n\n } else if(U){\n blob = new U\n code.map(c => blob.append(c+''))\n blob = blob.getBlob()\n } else {\n blob = `data:application/javascript,`\n +`${encodeURIComponent(\n code.reduce((acc,c) => acc+c, '')\n )}`\n }\n\n let url = W.createObjectURL(blob)\n return new Worker(url)\n}\n\nexport const farm = (n, ...code) => {\n let workers = Array(n).fill(1).map(x => worker(...code))\n , current = 0\n , iter = () => {\n let _n = current\n ++current >= n && (current = 0)\n return current\n }\n , pipe\n , onerror\n\n workers.map(w => {\n w.onmessage = e => pipe instanceof Function && pipe(e.data)\n w.onerror = e => onerror instanceof Function && onerror(e)\n })\n\n const exec = (...args) => {\n let w = workers[iter()]\n w && w.postMessage(args)\n }\n\n exec.pipe = fn => {\n pipe = fn\n return exec\n }\n exec.error = fn => {\n onerror = fn\n return exec\n }\n return exec\n}\n"]} \ No newline at end of file diff --git a/fuse.js b/fuse.js index e855046..b5205f5 100644 --- a/fuse.js +++ b/fuse.js @@ -18,7 +18,7 @@ let c = { f.BabelPlugin({ config: { sourceMaps: true - , presets: ['latest'] + , presets: ['es2015-without-strict', 'es2016', 'es2017'] // , env: { production: {presets: ['babili'] }} , plugins: ["fast-async"] } diff --git a/package.json b/package.json index 56b52eb..87e7a3e 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,9 @@ "babel-core": "^6.21.0", "babel-preset-babili": "^0.0.9", "babel-preset-env": "^1.1.4", + "babel-preset-es2015-without-strict": "^0.0.4", + "babel-preset-es2016": "^6.16.0", + "babel-preset-es2017": "^6.16.0", "babel-preset-latest": "^6.16.0", "babel-preset-react": "^6.16.0", "babel-preset-stage-0": "^6.16.0", diff --git a/yarn.lock b/yarn.lock index fc20e63..80e7d02 100644 --- a/yarn.lock +++ b/yarn.lock @@ -592,7 +592,7 @@ babel-plugin-transform-es2015-block-scoped-functions@^6.3.13: dependencies: babel-runtime "^6.0.0" -babel-plugin-transform-es2015-block-scoping@^6.18.0, babel-plugin-transform-es2015-block-scoping@^6.6.0: +babel-plugin-transform-es2015-block-scoping@^6.18.0, babel-plugin-transform-es2015-block-scoping@^6.6.0, babel-plugin-transform-es2015-block-scoping@^6.9.0: version "6.21.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.21.0.tgz#e840687f922e70fb2c42bb13501838c174a115ed" dependencies: @@ -602,7 +602,7 @@ babel-plugin-transform-es2015-block-scoping@^6.18.0, babel-plugin-transform-es20 babel-types "^6.21.0" lodash "^4.2.0" -babel-plugin-transform-es2015-classes@^6.18.0, babel-plugin-transform-es2015-classes@^6.6.0: +babel-plugin-transform-es2015-classes@^6.18.0, babel-plugin-transform-es2015-classes@^6.6.0, babel-plugin-transform-es2015-classes@^6.9.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.18.0.tgz#ffe7a17321bf83e494dcda0ae3fc72df48ffd1d9" dependencies: @@ -624,7 +624,7 @@ babel-plugin-transform-es2015-computed-properties@^6.3.13: babel-runtime "^6.0.0" babel-template "^6.8.0" -babel-plugin-transform-es2015-destructuring@^6.18.0, babel-plugin-transform-es2015-destructuring@^6.6.0: +babel-plugin-transform-es2015-destructuring@^6.18.0, babel-plugin-transform-es2015-destructuring@^6.6.0, babel-plugin-transform-es2015-destructuring@^6.9.0: version "6.19.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.19.0.tgz#ff1d911c4b3f4cab621bd66702a869acd1900533" dependencies: @@ -697,7 +697,7 @@ babel-plugin-transform-es2015-object-super@^6.3.13: babel-helper-replace-supers "^6.8.0" babel-runtime "^6.0.0" -babel-plugin-transform-es2015-parameters@^6.18.0, babel-plugin-transform-es2015-parameters@^6.6.0: +babel-plugin-transform-es2015-parameters@^6.18.0, babel-plugin-transform-es2015-parameters@^6.6.0, babel-plugin-transform-es2015-parameters@^6.9.0: version "6.21.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.21.0.tgz#46a655e6864ef984091448cdf024d87b60b2a7d8" dependencies: @@ -837,7 +837,7 @@ babel-plugin-transform-react-jsx@^6.3.13: babel-plugin-syntax-jsx "^6.8.0" babel-runtime "^6.0.0" -babel-plugin-transform-regenerator@^6.16.0, babel-plugin-transform-regenerator@^6.6.0: +babel-plugin-transform-regenerator@^6.16.0, babel-plugin-transform-regenerator@^6.6.0, babel-plugin-transform-regenerator@^6.9.0: version "6.21.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.21.0.tgz#75d0c7e7f84f379358f508451c68a2c5fa5a9703" dependencies: @@ -926,6 +926,32 @@ babel-preset-env@^1.1.4: babel-plugin-transform-regenerator "^6.6.0" browserslist "^1.4.0" +babel-preset-es2015-without-strict@^0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/babel-preset-es2015-without-strict/-/babel-preset-es2015-without-strict-0.0.4.tgz#88c9f36e79d4762c58347b1a698a07c35b6bda5d" + dependencies: + babel-plugin-check-es2015-constants "^6.3.13" + babel-plugin-transform-es2015-arrow-functions "^6.3.13" + babel-plugin-transform-es2015-block-scoped-functions "^6.3.13" + babel-plugin-transform-es2015-block-scoping "^6.9.0" + babel-plugin-transform-es2015-classes "^6.9.0" + babel-plugin-transform-es2015-computed-properties "^6.3.13" + babel-plugin-transform-es2015-destructuring "^6.9.0" + babel-plugin-transform-es2015-duplicate-keys "^6.6.0" + babel-plugin-transform-es2015-for-of "^6.6.0" + babel-plugin-transform-es2015-function-name "^6.9.0" + babel-plugin-transform-es2015-literals "^6.3.13" + babel-plugin-transform-es2015-modules-commonjs "^6.6.0" + babel-plugin-transform-es2015-object-super "^6.3.13" + babel-plugin-transform-es2015-parameters "^6.9.0" + babel-plugin-transform-es2015-shorthand-properties "^6.3.13" + babel-plugin-transform-es2015-spread "^6.3.13" + babel-plugin-transform-es2015-sticky-regex "^6.3.13" + babel-plugin-transform-es2015-template-literals "^6.6.0" + babel-plugin-transform-es2015-typeof-symbol "^6.6.0" + babel-plugin-transform-es2015-unicode-regex "^6.3.13" + babel-plugin-transform-regenerator "^6.9.0" + babel-preset-es2015@^6.16.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babel-preset-es2015/-/babel-preset-es2015-6.18.0.tgz#b8c70df84ec948c43dcf2bf770e988eb7da88312"