From 7bc45ec561c44fa07bc4ed17b5c4d5240cdad8ce Mon Sep 17 00:00:00 2001 From: Jorge Bucaran Date: Sat, 11 Feb 2017 01:25:58 +0900 Subject: [PATCH] Support nodes whose tag is a function. This makes it possible to create jsx components in this way: --- dist/hyperapp.hx.js | 2 +- dist/hyperapp.hx.js.map | 2 +- dist/hyperapp.js | 2 +- dist/hyperapp.js.map | 2 +- src/h.js | 9 ++++++++- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dist/hyperapp.hx.js b/dist/hyperapp.hx.js index 5b19e686e..88f54814d 100644 --- a/dist/hyperapp.hx.js +++ b/dist/hyperapp.hx.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.hyperapp=t()}(this,function(){"use strict";function e(t,n,r){n.ns="http://www.w3.org/2000/svg";for(var o=0;o"!==o||n(s)?s===u?A+=o:s===l&&/\s/.test(o)?(t.push([l,A]),A="",s=h):s===l?A+=o:s===h&&/[\w-]/.test(o)?(s=c,A=o):s===h&&/\s/.test(o)?(A.length&&t.push([c,A]),t.push([w])):s===c&&/\s/.test(o)?(t.push([c,A]),A="",s=d):s===c&&"="===o?(t.push([c,A],[b]),A="",s=g):s===c?A+=o:s!==d&&s!==h||"="!==o?s!==d&&s!==h||/\s/.test(o)?s===g&&'"'===o?s=m:s===g&&"'"===o?s=y:s===m&&'"'===o?(t.push([v,A],[w]),A="",s=h):s===y&&"'"===o?(t.push([v,A],[w]),A="",s=h):s!==g||/\s/.test(o)?s===v&&/\s/.test(o)?(t.push([v,A],[w]),A="",s=h):s!==v&&s!==y&&s!==m||(A+=o):(s=v,r--):(t.push([w]),/[\w-]/.test(o)?(A+=o,s=c):s=h):(t.push([b]),s=g):(s===l?t.push([l,A]):s===c?t.push([c,A]):s===v&&A.length&&t.push([v,A]),t.push([p]),A="",s=u)}return s===u&&A.length?(t.push([u,A]),A=""):s===v&&A.length?(t.push([v,A]),A=""):s===m&&A.length?(t.push([v,A]),A=""):s===y&&A.length?(t.push([v,A]),A=""):s===c&&(t.push([c,A]),A=""),t}for(var s=u,A="",E=arguments.length,L=[],k=0;k1&&(F.pop(),F[F.length-1][0][2][T]=e(M[0],M[1],M[2].length?M[2]:void 0))}else if(D===l){var j=[C[1],{},[]];M[2].push(j),F.push([j,M[2].length-1])}else if(D===c||D===f&&C[1]===c){for(var K,R="";k1&&/^\s*$/.test(x[2][0])&&x[2].shift(),x[2].length>2||2===x[2].length&&/\S/.test(x[2][1]))throw new Error("multiple root elements must be wrapped in an enclosing tag");return Array.isArray(x[2][0])&&"string"==typeof x[2][0][0]&&Array.isArray(x[2][0][2])&&(x[2][0]=e(x[2][0][0],x[2][0][1],x[2][0][2])),x[2][0]}},E=RegExp("^("+["area","base","basefont","bgsound","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr","animate","animateTransform","circle","cursor","desc","ellipse","feBlend","feColorMatrix","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","font-face-format","font-face-name","font-face-uri","glyph","glyphRef","hkern","image","line","missing-glyph","mpath","path","polygon","polyline","rect","set","stop","tref","use","view","vkern"].join("|")+")(?:[.#][a-zA-Z0-9-￿_:-]+)*$"),L=function(e){function t(e,t,n){h(w,c=t(e,d),n,0)}function n(e,t){for(var n in e){var o,a=r(n),i={};if(t.replace(new RegExp(a.re,"g"),function(){for(var t=1;t0&&!e.childNodes[r];)r--;if(r>=0){var o=e.childNodes[r];if(n&&n.data){var i=n.data.onremove;i&&a(i,o)}e.removeChild(o)}}else if(s(t,n))e.replaceChild(f(t),e.childNodes[r]);else if(t.tag){var o=e.childNodes[r];p(o,t.data,n.data);for(var u=t.tree.length,l=n.tree.length,c=0;c"!==o||n(f)?f===u?A+=o:f===l&&/\s/.test(o)?(t.push([l,A]),A="",f=h):f===l?A+=o:f===h&&/[\w-]/.test(o)?(f=c,A=o):f===h&&/\s/.test(o)?(A.length&&t.push([c,A]),t.push([w])):f===c&&/\s/.test(o)?(t.push([c,A]),A="",f=d):f===c&&"="===o?(t.push([c,A],[b]),A="",f=g):f===c?A+=o:f!==d&&f!==h||"="!==o?f!==d&&f!==h||/\s/.test(o)?f===g&&'"'===o?f=m:f===g&&"'"===o?f=y:f===m&&'"'===o?(t.push([v,A],[w]),A="",f=h):f===y&&"'"===o?(t.push([v,A],[w]),A="",f=h):f!==g||/\s/.test(o)?f===v&&/\s/.test(o)?(t.push([v,A],[w]),A="",f=h):f!==v&&f!==y&&f!==m||(A+=o):(f=v,r--):(t.push([w]),/[\w-]/.test(o)?(A+=o,f=c):f=h):(t.push([b]),f=g):(f===l?t.push([l,A]):f===c?t.push([c,A]):f===v&&A.length&&t.push([v,A]),t.push([p]),A="",f=u)}return f===u&&A.length?(t.push([u,A]),A=""):f===v&&A.length?(t.push([v,A]),A=""):f===m&&A.length?(t.push([v,A]),A=""):f===y&&A.length?(t.push([v,A]),A=""):f===c&&(t.push([c,A]),A=""),t}for(var f=u,A="",E=arguments.length,L=[],k=0;k1&&(F.pop(),F[F.length-1][0][2][T]=e(M[0],M[1],M[2].length?M[2]:void 0))}else if(D===l){var j=[C[1],{},[]];M[2].push(j),F.push([j,M[2].length-1])}else if(D===c||D===s&&C[1]===c){for(var K,R="";k1&&/^\s*$/.test(x[2][0])&&x[2].shift(),x[2].length>2||2===x[2].length&&/\S/.test(x[2][1]))throw new Error("multiple root elements must be wrapped in an enclosing tag");return Array.isArray(x[2][0])&&"string"==typeof x[2][0][0]&&Array.isArray(x[2][0][2])&&(x[2][0]=e(x[2][0][0],x[2][0][1],x[2][0][2])),x[2][0]}},E=RegExp("^("+["area","base","basefont","bgsound","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr","animate","animateTransform","circle","cursor","desc","ellipse","feBlend","feColorMatrix","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","font-face-format","font-face-name","font-face-uri","glyph","glyphRef","hkern","image","line","missing-glyph","mpath","path","polygon","polyline","rect","set","stop","tref","use","view","vkern"].join("|")+")(?:[.#][a-zA-Z0-9-￿_:-]+)*$"),L=function(e){function t(e,t,n){h(w,c=t(e,d),n,0)}function n(e,t){for(var n in e){var o,a=r(n),i={};if(t.replace(new RegExp(a.re,"g"),function(){for(var t=1;t0&&!e.childNodes[r];)r--;if(r>=0){var o=e.childNodes[r];if(n&&n.data){var i=n.data.onremove;i&&a(i,o)}e.removeChild(o)}}else if(f(t,n))e.replaceChild(s(t),e.childNodes[r]);else if(t.tag){var o=e.childNodes[r];p(o,t.data,n.data);for(var u=t.tree.length,l=n.tree.length,c=0;c 1) {\n stack.pop()\n stack[stack.length-1][0][2][ix] = h(\n cur[0], cur[1], cur[2].length ? cur[2] : undefined\n )\n }\n } else if (s === OPEN) {\n var c = [p[1],{},[]]\n cur[2].push(c)\n stack.push([c,cur[2].length-1])\n } else if (s === ATTR_KEY || (s === VAR && p[1] === ATTR_KEY)) {\n var key = ''\n var copyKey\n for (; i < parts.length; i++) {\n if (parts[i][0] === ATTR_KEY) {\n key = concat(key, parts[i][1])\n } else if (parts[i][0] === VAR && parts[i][1] === ATTR_KEY) {\n if (typeof parts[i][2] === 'object' && !key) {\n for (copyKey in parts[i][2]) {\n if (parts[i][2].hasOwnProperty(copyKey) && !cur[1][copyKey]) {\n cur[1][copyKey] = parts[i][2][copyKey]\n }\n }\n } else {\n key = concat(key, parts[i][2])\n }\n } else break\n }\n if (parts[i][0] === ATTR_EQ) i++\n var j = i\n for (; i < parts.length; i++) {\n if (parts[i][0] === ATTR_VALUE || parts[i][0] === ATTR_KEY) {\n if (!cur[1][key]) cur[1][key] = strfn(parts[i][1])\n else cur[1][key] = concat(cur[1][key], parts[i][1])\n } else if (parts[i][0] === VAR\n && (parts[i][1] === ATTR_VALUE || parts[i][1] === ATTR_KEY)) {\n if (!cur[1][key]) cur[1][key] = strfn(parts[i][2])\n else cur[1][key] = concat(cur[1][key], parts[i][2])\n } else {\n if (key.length && !cur[1][key] && i === j\n && (parts[i][0] === CLOSE || parts[i][0] === ATTR_BREAK)) {\n // https://html.spec.whatwg.org/multipage/infrastructure.html#boolean-attributes\n // empty string is falsy, not well behaved value in browser\n cur[1][key] = key.toLowerCase()\n }\n break\n }\n }\n } else if (s === ATTR_KEY) {\n cur[1][p[1]] = true\n } else if (s === VAR && p[1] === ATTR_KEY) {\n cur[1][p[2]] = true\n } else if (s === CLOSE) {\n if (selfClosing(cur[0]) && stack.length) {\n var ix = stack[stack.length-1][1]\n stack.pop()\n stack[stack.length-1][0][2][ix] = h(\n cur[0], cur[1], cur[2].length ? cur[2] : undefined\n )\n }\n } else if (s === VAR && p[1] === TEXT) {\n if (p[2] === undefined || p[2] === null) p[2] = ''\n else if (!p[2]) p[2] = concat('', p[2])\n if (Array.isArray(p[2][0])) {\n cur[2].push.apply(cur[2], p[2])\n } else {\n cur[2].push(p[2])\n }\n } else if (s === TEXT) {\n cur[2].push(p[1])\n } else if (s === ATTR_EQ || s === ATTR_BREAK) {\n // no-op\n } else {\n throw new Error('unhandled: ' + s)\n }\n }\n\n if (tree[2].length > 1 && /^\\s*$/.test(tree[2][0])) {\n tree[2].shift()\n }\n\n if (tree[2].length > 2\n || (tree[2].length === 2 && /\\S/.test(tree[2][1]))) {\n throw new Error(\n 'multiple root elements must be wrapped in an enclosing tag'\n )\n }\n if (Array.isArray(tree[2][0]) && typeof tree[2][0][0] === 'string'\n && Array.isArray(tree[2][0][2])) {\n tree[2][0] = h(tree[2][0][0], tree[2][0][1], tree[2][0][2])\n }\n return tree[2][0]\n\n function parse (str) {\n var res = []\n if (state === ATTR_VALUE_W) state = ATTR\n for (var i = 0; i < str.length; i++) {\n var c = str.charAt(i)\n if (state === TEXT && c === '<') {\n if (reg.length) res.push([TEXT, reg])\n reg = ''\n state = OPEN\n } else if (c === '>' && !quot(state)) {\n if (state === OPEN) {\n res.push([OPEN,reg])\n } else if (state === ATTR_KEY) {\n res.push([ATTR_KEY,reg])\n } else if (state === ATTR_VALUE && reg.length) {\n res.push([ATTR_VALUE,reg])\n }\n res.push([CLOSE])\n reg = ''\n state = TEXT\n } else if (state === TEXT) {\n reg += c\n } else if (state === OPEN && /\\s/.test(c)) {\n res.push([OPEN, reg])\n reg = ''\n state = ATTR\n } else if (state === OPEN) {\n reg += c\n } else if (state === ATTR && /[\\w-]/.test(c)) {\n state = ATTR_KEY\n reg = c\n } else if (state === ATTR && /\\s/.test(c)) {\n if (reg.length) res.push([ATTR_KEY,reg])\n res.push([ATTR_BREAK])\n } else if (state === ATTR_KEY && /\\s/.test(c)) {\n res.push([ATTR_KEY,reg])\n reg = ''\n state = ATTR_KEY_W\n } else if (state === ATTR_KEY && c === '=') {\n res.push([ATTR_KEY,reg],[ATTR_EQ])\n reg = ''\n state = ATTR_VALUE_W\n } else if (state === ATTR_KEY) {\n reg += c\n } else if ((state === ATTR_KEY_W || state === ATTR) && c === '=') {\n res.push([ATTR_EQ])\n state = ATTR_VALUE_W\n } else if ((state === ATTR_KEY_W || state === ATTR) && !/\\s/.test(c)) {\n res.push([ATTR_BREAK])\n if (/[\\w-]/.test(c)) {\n reg += c\n state = ATTR_KEY\n } else state = ATTR\n } else if (state === ATTR_VALUE_W && c === '\"') {\n state = ATTR_VALUE_DQ\n } else if (state === ATTR_VALUE_W && c === \"'\") {\n state = ATTR_VALUE_SQ\n } else if (state === ATTR_VALUE_DQ && c === '\"') {\n res.push([ATTR_VALUE,reg],[ATTR_BREAK])\n reg = ''\n state = ATTR\n } else if (state === ATTR_VALUE_SQ && c === \"'\") {\n res.push([ATTR_VALUE,reg],[ATTR_BREAK])\n reg = ''\n state = ATTR\n } else if (state === ATTR_VALUE_W && !/\\s/.test(c)) {\n state = ATTR_VALUE\n i--\n } else if (state === ATTR_VALUE && /\\s/.test(c)) {\n res.push([ATTR_VALUE,reg],[ATTR_BREAK])\n reg = ''\n state = ATTR\n } else if (state === ATTR_VALUE || state === ATTR_VALUE_SQ\n || state === ATTR_VALUE_DQ) {\n reg += c\n }\n }\n if (state === TEXT && reg.length) {\n res.push([TEXT,reg])\n reg = ''\n } else if (state === ATTR_VALUE && reg.length) {\n res.push([ATTR_VALUE,reg])\n reg = ''\n } else if (state === ATTR_VALUE_DQ && reg.length) {\n res.push([ATTR_VALUE,reg])\n reg = ''\n } else if (state === ATTR_VALUE_SQ && reg.length) {\n res.push([ATTR_VALUE,reg])\n reg = ''\n } else if (state === ATTR_KEY) {\n res.push([ATTR_KEY,reg])\n reg = ''\n }\n return res\n }\n }\n\n function strfn (x) {\n if (typeof x === 'function') return x\n else if (typeof x === 'string') return x\n else if (x && typeof x === 'object') return x\n else return concat('', x)\n }\n}\n\nfunction quot (state) {\n return state === ATTR_VALUE_SQ || state === ATTR_VALUE_DQ\n}\n\nvar hasOwn = Object.prototype.hasOwnProperty\nfunction has (obj, key) { return hasOwn.call(obj, key) }\n\nvar closeRE = RegExp('^(' + [\n 'area', 'base', 'basefont', 'bgsound', 'br', 'col', 'command', 'embed',\n 'frame', 'hr', 'img', 'input', 'isindex', 'keygen', 'link', 'meta', 'param',\n 'source', 'track', 'wbr',\n // SVG TAGS\n 'animate', 'animateTransform', 'circle', 'cursor', 'desc', 'ellipse',\n 'feBlend', 'feColorMatrix', 'feComposite',\n 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap',\n 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR',\n 'feGaussianBlur', 'feImage', 'feMergeNode', 'feMorphology',\n 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile',\n 'feTurbulence', 'font-face-format', 'font-face-name', 'font-face-uri',\n 'glyph', 'glyphRef', 'hkern', 'image', 'line', 'missing-glyph', 'mpath',\n 'path', 'polygon', 'polyline', 'rect', 'set', 'stop', 'tref', 'use', 'view',\n 'vkern'\n].join('|') + ')(?:[\\.#][a-zA-Z0-9\\u007F-\\uFFFF_:-]+)*$')\nfunction selfClosing (tag) { return closeRE.test(tag) }\n","module.exports = function (options) {\n\tvar msg = {}\n\n\tvar model = options.model\n\tvar reducers = options.update || {}\n\tvar effects = options.effects || {}\n\n\tvar subscriptions = function (subs) {\n\t\t// `subs` will be deprecated in favor of only `subscriptions` >= 0.0.13\n\t\tsubs = options.subscriptions || options.subs\n\t\tfor (var key in subs) {\n\t\t\tsubs[key](model, msg, hooks.onError)\n\t\t}\n\t}\n\n\tvar hooks = merge({\n\t\tonAction: Function.prototype,\n\t\tonUpdate: Function.prototype,\n\t\tonError: function (err) {\n\t\t\tthrow err\n\t\t}\n\t}, options.hooks)\n\n\tvar node\n\tvar root = options.root || document.body.appendChild(document.createElement(\"div\"))\n\tvar view = options.view || function () {\n\t\treturn root\n\t}\n\tvar routes = typeof view === \"function\" ? undefined : view\n\n\tif (routes) {\n\t\tview = route(routes, location.pathname)\n\n\t\tmsg.setLocation = function (data) {\n\t\t\trender(model, view = route(routes, data), node)\n\t\t\thistory.pushState({}, \"\", data)\n\t\t}\n\n\t\twindow.addEventListener(\"popstate\", function () {\n\t\t\trender(model, view = route(routes, location.pathname), node)\n\t\t})\n\n\t\twindow.onclick = function (e) {\n\t\t\tif (e.metaKey || e.shiftKey || e.ctrlKey || e.altKey) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar target = e.target\n\n\t\t\twhile (target && target.localName !== \"a\") {\n\t\t\t\ttarget = target.parentNode\n\t\t\t}\n\n\t\t\tif (target && target.host === location.host\n\t\t\t\t&& !target.hasAttribute(\"data-no-routing\")) {\n\n\t\t\t\tvar element = target.hash === \"\" ? element : document.querySelector(target.hash)\n\t\t\t\tif (element) {\n\t\t\t\t\telement.scrollIntoView(true)\n\n\t\t\t\t} else {\n\t\t\t\t\tmsg.setLocation(target.pathname)\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (var name in merge(reducers, effects)) {\n\t\t(function (name) {\n\t\t\tmsg[name] = function (data) {\n\t\t\t\thooks.onAction(name, data)\n\n\t\t\t\tvar effect = effects[name]\n\t\t\t\tif (effect) {\n\t\t\t\t\treturn effect(model, msg, data, hooks.onError)\n\t\t\t\t}\n\n\t\t\t\tvar update = reducers[name], _model = model\n\t\t\t\trender(model = merge(model, update(model, data)), view, node)\n\n\t\t\t\thooks.onUpdate(_model, model, data)\n\t\t\t}\n\t\t}(name))\n\t}\n\n\tif (document.readyState !== \"loading\") {\n\t\tsubscriptions()\n\t} else {\n\t\tdocument.addEventListener(\"DOMContentLoaded\", subscriptions)\n\t}\n\n\trender(model, view)\n\n\tfunction render(model, view, lastNode) {\n\t\tpatch(root, node = view(model, msg), lastNode, 0)\n\t}\n\n\tfunction route(routes, path) {\n\t\tfor (var route in routes) {\n\t\t\tvar re = regexify(route), params = {}, match\n\n\t\t\tpath.replace(new RegExp(re.re, \"g\"), function () {\n\t\t\t\tfor (var i = 1; i < arguments.length - 2; i++) {\n\t\t\t\t\tparams[re.keys.shift()] = arguments[i]\n\t\t\t\t}\n\n\t\t\t\tmatch = function (model, msg) {\n\t\t\t\t\treturn routes[route](model, msg, params)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tif (match) {\n\t\t\t\treturn match\n\t\t\t}\n\t\t}\n\n\t\treturn routes[\"/\"]\n\t}\n\n\tfunction regexify(path) {\n\t\tvar keys = [], re = \"^\" + path\n\t\t\t.replace(/\\//g, \"\\\\/\")\n\t\t\t.replace(/:([A-Za-z0-9_]+)/g, function (_, key) {\n\t\t\t\tkeys.push(key)\n\t\t\t\treturn \"([A-Za-z0-9_]+)\"\n\t\t\t}) + \"/?$\"\n\n\t\treturn { re: re, keys: keys }\n\t}\n\n\tfunction isPrimitive(type) {\n\t\treturn type === \"string\" || type === \"number\" || type === \"boolean\"\n\t}\n\n\tfunction defer(fn, data) {\n\t\tsetTimeout(function () {\n\t\t\tfn(data)\n\t\t}, 0)\n\t}\n\n\tfunction merge(a, b) {\n\t\tvar obj = {}, key\n\n\t\tif (isPrimitive(typeof b) || Array.isArray(b)) {\n\t\t\treturn b\n\t\t}\n\n\t\tfor (key in a) {\n\t\t\tobj[key] = a[key]\n\t\t}\n\t\tfor (key in b) {\n\t\t\tobj[key] = b[key]\n\t\t}\n\n\t\treturn obj\n\t}\n\n\tfunction shouldUpdate(a, b) {\n\t\treturn a.tag !== b.tag\n\t\t\t|| typeof a !== typeof b\n\t\t\t|| isPrimitive(typeof a) && a !== b\n\t}\n\n\tfunction createElementFrom(node) {\n\t\tvar element\n\t\tif (isPrimitive(typeof node)) {\n\t\t\telement = document.createTextNode(node)\n\n\t\t} else {\n\t\t\telement = node.data && node.data.ns\n\t\t\t\t? document.createElementNS(node.data.ns, node.tag)\n\t\t\t\t: document.createElement(node.tag)\n\n\t\t\tfor (var name in node.data) {\n\t\t\t\tif (name === \"oncreate\") {\n\t\t\t\t\tdefer(node.data[name], element)\n\t\t\t\t} else {\n\t\t\t\t\tsetElementData(element, name, node.data[name])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (var i = 0; i < node.tree.length; i++) {\n\t\t\t\telement.appendChild(createElementFrom(node.tree[i]))\n\t\t\t}\n\t\t}\n\n\t\treturn element\n\t}\n\n\tfunction removeElementData(element, name, value) {\n\t\telement.removeAttribute(name === \"className\" ? \"class\" : name)\n\n\t\tif (typeof value === \"boolean\" || value === \"true\" || value === \"false\") {\n\t\t\telement[name] = false\n\t\t}\n\t}\n\n\tfunction setElementData(element, name, value, oldValue) {\n\t\tif (name === \"style\") {\n\t\t\tfor (var i in value) {\n\t\t\t\telement.style[i] = value[i]\n\t\t\t}\n\n\t\t} else if (name.substr(0, 2) === \"on\") {\n\t\t\tvar event = name.substr(2)\n\t\t\telement.removeEventListener(event, oldValue)\n\t\t\telement.addEventListener(event, value)\n\n\t\t} else {\n\t\t\tif (value === \"false\" || value === false) {\n\t\t\t\telement.removeAttribute(name)\n\t\t\t\telement[name] = false\n\t\t\t} else {\n\t\t\t\telement.setAttribute(name, value)\n\t\t\t\telement[name] = value\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction updateElementData(element, data, oldData) {\n\t\tfor (var name in merge(oldData, data)) {\n\t\t\tvar value = data[name], oldValue = oldData[name]\n\n\t\t\tif (value === undefined) {\n\t\t\t\tremoveElementData(element, name, oldValue)\n\n\t\t\t} else if (value !== oldValue) {\n\t\t\t\tname === \"onupdate\"\n\t\t\t\t\t? defer(value, element)\n\t\t\t\t\t: setElementData(element, name, value, oldValue)\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction patch(parent, node, oldNode, index) {\n\t\tif (oldNode === undefined) {\n\t\t\tparent.appendChild(createElementFrom(node))\n\n\t\t} else if (node === undefined) {\n\t\t\twhile (index > 0 && !parent.childNodes[index]) {\n\t\t\t\tindex--\n\t\t\t}\n\n\t\t\tif (index >= 0) {\n\t\t\t\tvar element = parent.childNodes[index]\n\n\t\t\t\tif (oldNode && oldNode.data) {\n\t\t\t\t\tvar hook = oldNode.data.onremove\n\t\t\t\t\tif (hook) {\n\t\t\t\t\t\tdefer(hook, element)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tparent.removeChild(element)\n\t\t\t}\n\n\t\t} else if (shouldUpdate(node, oldNode)) {\n\t\t\tparent.replaceChild(createElementFrom(node), parent.childNodes[index])\n\n\t\t} else if (node.tag) {\n\t\t\tvar element = parent.childNodes[index]\n\n\t\t\tupdateElementData(element, node.data, oldNode.data)\n\n\t\t\tvar len = node.tree.length, oldLen = oldNode.tree.length\n\n\t\t\tfor (var i = 0; i < len || i < oldLen; i++) {\n\t\t\t\tpatch(element, node.tree[i], oldNode.tree[i], i)\n\t\t\t}\n\t\t}\n\t}\n}","var h = require(\"./h\")\n\nmodule.exports = {\n html: require(\"hyperx\")(h),\n app: require(\"./app\"),\n h: h\n}\n"],"names":["svg","tag","data","tree","ns","i","length","node","attributeToProperty","h","tagName","attrs","children","attr","transform","quot","state","ATTR_VALUE_SQ","ATTR_VALUE_DQ","selfClosing","closeRE","test","push","apply","arguments","shift","head","Array","isArray","undefined","concat","class","for","http-equiv","attrToProp","require$$0","VAR","TEXT","OPEN","CLOSE","ATTR","ATTR_KEY","ATTR_KEY_W","ATTR_VALUE_W","ATTR_VALUE","ATTR_EQ","ATTR_BREAK","opts","strfn","x","a","b","String","strings","parse","str","res","c","charAt","reg","arglen","parts","arg","p","xstate","stack","cur","s","ix","pop","copyKey","key","hasOwnProperty","j","toLowerCase","Error","RegExp","join","options","render","model","view","lastNode","patch","root","msg","route","routes","path","match","re","regexify","params","replace","keys","_","isPrimitive","type","defer","fn","setTimeout","merge","obj","shouldUpdate","createElementFrom","element","document","createTextNode","createElementNS","createElement","name","setElementData","appendChild","removeElementData","value","removeAttribute","oldValue","style","substr","event","removeEventListener","addEventListener","setAttribute","updateElementData","oldData","parent","oldNode","index","childNodes","hook","onremove","removeChild","replaceChild","len","oldLen","reducers","update","effects","subscriptions","subs","hooks","onError","onAction","Function","prototype","onUpdate","err","body","location","pathname","setLocation","history","pushState","window","onclick","e","metaKey","shiftKey","ctrlKey","altKey","target","localName","parentNode","host","hasAttribute","hash","querySelector","scrollIntoView","preventDefault","effect","_model","readyState","html","require$$1","app","require$$2"],"mappings":"mLAoBA,SAASA,GAAIC,EAAKC,EAAMC,GACvBD,EAAKE,GAAK,4BAEV,KAAK,GAAIC,GAAI,EAAGA,EAAIF,EAAKG,OAAQD,IAAK,CACrC,GAAIE,GAAOJ,EAAKE,EACZE,GAAKL,MACRF,EAAIO,EAAKN,IAAKM,EAAKL,KAAMK,EAAKJ,OClBjC,QAASK,GAAqBC,GAC5B,MAAO,UAAUC,EAASC,EAAOC,GAC/B,IAAK,GAAIC,KAAQF,GACXE,IAAQC,KACVH,EAAMG,E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E,EAAI0B,KAGJyI,KAAMC,EAAkBpK,GACxBqK,IAAKC,EACLtK,EAAGA"} \ No newline at end of file +{"version":3,"file":"hyperapp.hx.js","sources":["../src/h.js","../node_modules/hyperscript-attribute-to-property/index.js","../node_modules/hyperx/index.js","../src/app.js","../src/index.js"],"sourcesContent":["module.exports = function (tag, data) {\n\tvar tree = []\n\ttree.push.apply(tree, arguments)\n\ttree.shift()\n\ttree.shift()\n\tvar head = tree[0]\n\n\ttree = Array.isArray(head) || head === undefined ? head : tree\n\n\tif (typeof tag === \"function\") {\n\t\treturn tag({\n\t\t\tprops: data,\n\t\t\tchildren: tree || []\n\t\t})\n\t}\n\n\tif (tag === \"svg\") {\n\t\tsvg(tag, data, tree)\n\t}\n\n\treturn {\n\t\ttag: tag,\n\t\tdata: data || {},\n\t\ttree: [].concat.apply([], tree)\n\t}\n}\n\nfunction svg(tag, data, tree) {\n\tdata.ns = \"http://www.w3.org/2000/svg\"\n\n\tfor (var i = 0; i < tree.length; i++) {\n\t\tvar node = tree[i]\n\t\tif (node.data) {\n\t\t\tsvg(node.tag, node.data, node.tree)\n\t\t}\n\t}\n}\n\n","module.exports = attributeToProperty\n\nvar transform = {\n 'class': 'className',\n 'for': 'htmlFor',\n 'http-equiv': 'httpEquiv'\n}\n\nfunction attributeToProperty (h) {\n return function (tagName, attrs, children) {\n for (var attr in attrs) {\n if (attr in transform) {\n attrs[transform[attr]] = attrs[attr]\n delete attrs[attr]\n }\n }\n return h(tagName, attrs, children)\n }\n}\n","var attrToProp = require('hyperscript-attribute-to-property')\n\nvar VAR = 0, TEXT = 1, OPEN = 2, CLOSE = 3, ATTR = 4\nvar ATTR_KEY = 5, ATTR_KEY_W = 6\nvar ATTR_VALUE_W = 7, ATTR_VALUE = 8\nvar ATTR_VALUE_SQ = 9, ATTR_VALUE_DQ = 10\nvar ATTR_EQ = 11, ATTR_BREAK = 12\n\nmodule.exports = function (h, opts) {\n h = attrToProp(h)\n if (!opts) opts = {}\n var concat = opts.concat || function (a, b) {\n return String(a) + String(b)\n }\n\n return function (strings) {\n var state = TEXT, reg = ''\n var arglen = arguments.length\n var parts = []\n\n for (var i = 0; i < strings.length; i++) {\n if (i < arglen - 1) {\n var arg = arguments[i+1]\n var p = parse(strings[i])\n var xstate = state\n if (xstate === ATTR_VALUE_DQ) xstate = ATTR_VALUE\n if (xstate === ATTR_VALUE_SQ) xstate = ATTR_VALUE\n if (xstate === ATTR_VALUE_W) xstate = ATTR_VALUE\n if (xstate === ATTR) xstate = ATTR_KEY\n p.push([ VAR, xstate, arg ])\n parts.push.apply(parts, p)\n } else parts.push.apply(parts, parse(strings[i]))\n }\n\n var tree = [null,{},[]]\n var stack = [[tree,-1]]\n for (var i = 0; i < parts.length; i++) {\n var cur = stack[stack.length-1][0]\n var p = parts[i], s = p[0]\n if (s === OPEN && /^\\//.test(p[1])) {\n var ix = stack[stack.length-1][1]\n if (stack.length > 1) {\n stack.pop()\n stack[stack.length-1][0][2][ix] = h(\n cur[0], cur[1], cur[2].length ? cur[2] : undefined\n )\n }\n } else if (s === OPEN) {\n var c = [p[1],{},[]]\n cur[2].push(c)\n stack.push([c,cur[2].length-1])\n } else if (s === ATTR_KEY || (s === VAR && p[1] === ATTR_KEY)) {\n var key = ''\n var copyKey\n for (; i < parts.length; i++) {\n if (parts[i][0] === ATTR_KEY) {\n key = concat(key, parts[i][1])\n } else if (parts[i][0] === VAR && parts[i][1] === ATTR_KEY) {\n if (typeof parts[i][2] === 'object' && !key) {\n for (copyKey in parts[i][2]) {\n if (parts[i][2].hasOwnProperty(copyKey) && !cur[1][copyKey]) {\n cur[1][copyKey] = parts[i][2][copyKey]\n }\n }\n } else {\n key = concat(key, parts[i][2])\n }\n } else break\n }\n if (parts[i][0] === ATTR_EQ) i++\n var j = i\n for (; i < parts.length; i++) {\n if (parts[i][0] === ATTR_VALUE || parts[i][0] === ATTR_KEY) {\n if (!cur[1][key]) cur[1][key] = strfn(parts[i][1])\n else cur[1][key] = concat(cur[1][key], parts[i][1])\n } else if (parts[i][0] === VAR\n && (parts[i][1] === ATTR_VALUE || parts[i][1] === ATTR_KEY)) {\n if (!cur[1][key]) cur[1][key] = strfn(parts[i][2])\n else cur[1][key] = concat(cur[1][key], parts[i][2])\n } else {\n if (key.length && !cur[1][key] && i === j\n && (parts[i][0] === CLOSE || parts[i][0] === ATTR_BREAK)) {\n // https://html.spec.whatwg.org/multipage/infrastructure.html#boolean-attributes\n // empty string is falsy, not well behaved value in browser\n cur[1][key] = key.toLowerCase()\n }\n break\n }\n }\n } else if (s === ATTR_KEY) {\n cur[1][p[1]] = true\n } else if (s === VAR && p[1] === ATTR_KEY) {\n cur[1][p[2]] = true\n } else if (s === CLOSE) {\n if (selfClosing(cur[0]) && stack.length) {\n var ix = stack[stack.length-1][1]\n stack.pop()\n stack[stack.length-1][0][2][ix] = h(\n cur[0], cur[1], cur[2].length ? cur[2] : undefined\n )\n }\n } else if (s === VAR && p[1] === TEXT) {\n if (p[2] === undefined || p[2] === null) p[2] = ''\n else if (!p[2]) p[2] = concat('', p[2])\n if (Array.isArray(p[2][0])) {\n cur[2].push.apply(cur[2], p[2])\n } else {\n cur[2].push(p[2])\n }\n } else if (s === TEXT) {\n cur[2].push(p[1])\n } else if (s === ATTR_EQ || s === ATTR_BREAK) {\n // no-op\n } else {\n throw new Error('unhandled: ' + s)\n }\n }\n\n if (tree[2].length > 1 && /^\\s*$/.test(tree[2][0])) {\n tree[2].shift()\n }\n\n if (tree[2].length > 2\n || (tree[2].length === 2 && /\\S/.test(tree[2][1]))) {\n throw new Error(\n 'multiple root elements must be wrapped in an enclosing tag'\n )\n }\n if (Array.isArray(tree[2][0]) && typeof tree[2][0][0] === 'string'\n && Array.isArray(tree[2][0][2])) {\n tree[2][0] = h(tree[2][0][0], tree[2][0][1], tree[2][0][2])\n }\n return tree[2][0]\n\n function parse (str) {\n var res = []\n if (state === ATTR_VALUE_W) state = ATTR\n for (var i = 0; i < str.length; i++) {\n var c = str.charAt(i)\n if (state === TEXT && c === '<') {\n if (reg.length) res.push([TEXT, reg])\n reg = ''\n state = OPEN\n } else if (c === '>' && !quot(state)) {\n if (state === OPEN) {\n res.push([OPEN,reg])\n } else if (state === ATTR_KEY) {\n res.push([ATTR_KEY,reg])\n } else if (state === ATTR_VALUE && reg.length) {\n res.push([ATTR_VALUE,reg])\n }\n res.push([CLOSE])\n reg = ''\n state = TEXT\n } else if (state === TEXT) {\n reg += c\n } else if (state === OPEN && /\\s/.test(c)) {\n res.push([OPEN, reg])\n reg = ''\n state = ATTR\n } else if (state === OPEN) {\n reg += c\n } else if (state === ATTR && /[\\w-]/.test(c)) {\n state = ATTR_KEY\n reg = c\n } else if (state === ATTR && /\\s/.test(c)) {\n if (reg.length) res.push([ATTR_KEY,reg])\n res.push([ATTR_BREAK])\n } else if (state === ATTR_KEY && /\\s/.test(c)) {\n res.push([ATTR_KEY,reg])\n reg = ''\n state = ATTR_KEY_W\n } else if (state === ATTR_KEY && c === '=') {\n res.push([ATTR_KEY,reg],[ATTR_EQ])\n reg = ''\n state = ATTR_VALUE_W\n } else if (state === ATTR_KEY) {\n reg += c\n } else if ((state === ATTR_KEY_W || state === ATTR) && c === '=') {\n res.push([ATTR_EQ])\n state = ATTR_VALUE_W\n } else if ((state === ATTR_KEY_W || state === ATTR) && !/\\s/.test(c)) {\n res.push([ATTR_BREAK])\n if (/[\\w-]/.test(c)) {\n reg += c\n state = ATTR_KEY\n } else state = ATTR\n } else if (state === ATTR_VALUE_W && c === '\"') {\n state = ATTR_VALUE_DQ\n } else if (state === ATTR_VALUE_W && c === \"'\") {\n state = ATTR_VALUE_SQ\n } else if (state === ATTR_VALUE_DQ && c === '\"') {\n res.push([ATTR_VALUE,reg],[ATTR_BREAK])\n reg = ''\n state = ATTR\n } else if (state === ATTR_VALUE_SQ && c === \"'\") {\n res.push([ATTR_VALUE,reg],[ATTR_BREAK])\n reg = ''\n state = ATTR\n } else if (state === ATTR_VALUE_W && !/\\s/.test(c)) {\n state = ATTR_VALUE\n i--\n } else if (state === ATTR_VALUE && /\\s/.test(c)) {\n res.push([ATTR_VALUE,reg],[ATTR_BREAK])\n reg = ''\n state = ATTR\n } else if (state === ATTR_VALUE || state === ATTR_VALUE_SQ\n || state === ATTR_VALUE_DQ) {\n reg += c\n }\n }\n if (state === TEXT && reg.length) {\n res.push([TEXT,reg])\n reg = ''\n } else if (state === ATTR_VALUE && reg.length) {\n res.push([ATTR_VALUE,reg])\n reg = ''\n } else if (state === ATTR_VALUE_DQ && reg.length) {\n res.push([ATTR_VALUE,reg])\n reg = ''\n } else if (state === ATTR_VALUE_SQ && reg.length) {\n res.push([ATTR_VALUE,reg])\n reg = ''\n } else if (state === ATTR_KEY) {\n res.push([ATTR_KEY,reg])\n reg = ''\n }\n return res\n }\n }\n\n function strfn (x) {\n if (typeof x === 'function') return x\n else if (typeof x === 'string') return x\n else if (x && typeof x === 'object') return x\n else return concat('', x)\n }\n}\n\nfunction quot (state) {\n return state === ATTR_VALUE_SQ || state === ATTR_VALUE_DQ\n}\n\nvar hasOwn = Object.prototype.hasOwnProperty\nfunction has (obj, key) { return hasOwn.call(obj, key) }\n\nvar closeRE = RegExp('^(' + [\n 'area', 'base', 'basefont', 'bgsound', 'br', 'col', 'command', 'embed',\n 'frame', 'hr', 'img', 'input', 'isindex', 'keygen', 'link', 'meta', 'param',\n 'source', 'track', 'wbr',\n // SVG TAGS\n 'animate', 'animateTransform', 'circle', 'cursor', 'desc', 'ellipse',\n 'feBlend', 'feColorMatrix', 'feComposite',\n 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap',\n 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR',\n 'feGaussianBlur', 'feImage', 'feMergeNode', 'feMorphology',\n 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile',\n 'feTurbulence', 'font-face-format', 'font-face-name', 'font-face-uri',\n 'glyph', 'glyphRef', 'hkern', 'image', 'line', 'missing-glyph', 'mpath',\n 'path', 'polygon', 'polyline', 'rect', 'set', 'stop', 'tref', 'use', 'view',\n 'vkern'\n].join('|') + ')(?:[\\.#][a-zA-Z0-9\\u007F-\\uFFFF_:-]+)*$')\nfunction selfClosing (tag) { return closeRE.test(tag) }\n","module.exports = function (options) {\n\tvar msg = {}\n\n\tvar model = options.model\n\tvar reducers = options.update || {}\n\tvar effects = options.effects || {}\n\n\tvar subscriptions = function (subs) {\n\t\t// `subs` will be deprecated in favor of only `subscriptions` >= 0.0.13\n\t\tsubs = options.subscriptions || options.subs\n\t\tfor (var key in subs) {\n\t\t\tsubs[key](model, msg, hooks.onError)\n\t\t}\n\t}\n\n\tvar hooks = merge({\n\t\tonAction: Function.prototype,\n\t\tonUpdate: Function.prototype,\n\t\tonError: function (err) {\n\t\t\tthrow err\n\t\t}\n\t}, options.hooks)\n\n\tvar node\n\tvar root = options.root || document.body.appendChild(document.createElement(\"div\"))\n\tvar view = options.view || function () {\n\t\treturn root\n\t}\n\tvar routes = typeof view === \"function\" ? undefined : view\n\n\tif (routes) {\n\t\tview = route(routes, location.pathname)\n\n\t\tmsg.setLocation = function (data) {\n\t\t\trender(model, view = route(routes, data), node)\n\t\t\thistory.pushState({}, \"\", data)\n\t\t}\n\n\t\twindow.addEventListener(\"popstate\", function () {\n\t\t\trender(model, view = route(routes, location.pathname), node)\n\t\t})\n\n\t\twindow.onclick = function (e) {\n\t\t\tif (e.metaKey || e.shiftKey || e.ctrlKey || e.altKey) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar target = e.target\n\n\t\t\twhile (target && target.localName !== \"a\") {\n\t\t\t\ttarget = target.parentNode\n\t\t\t}\n\n\t\t\tif (target && target.host === location.host\n\t\t\t\t&& !target.hasAttribute(\"data-no-routing\")) {\n\n\t\t\t\tvar element = target.hash === \"\" ? element : document.querySelector(target.hash)\n\t\t\t\tif (element) {\n\t\t\t\t\telement.scrollIntoView(true)\n\n\t\t\t\t} else {\n\t\t\t\t\tmsg.setLocation(target.pathname)\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (var name in merge(reducers, effects)) {\n\t\t(function (name) {\n\t\t\tmsg[name] = function (data) {\n\t\t\t\thooks.onAction(name, data)\n\n\t\t\t\tvar effect = effects[name]\n\t\t\t\tif (effect) {\n\t\t\t\t\treturn effect(model, msg, data, hooks.onError)\n\t\t\t\t}\n\n\t\t\t\tvar update = reducers[name], _model = model\n\t\t\t\trender(model = merge(model, update(model, data)), view, node)\n\n\t\t\t\thooks.onUpdate(_model, model, data)\n\t\t\t}\n\t\t}(name))\n\t}\n\n\tif (document.readyState !== \"loading\") {\n\t\tsubscriptions()\n\t} else {\n\t\tdocument.addEventListener(\"DOMContentLoaded\", subscriptions)\n\t}\n\n\trender(model, view)\n\n\tfunction render(model, view, lastNode) {\n\t\tpatch(root, node = view(model, msg), lastNode, 0)\n\t}\n\n\tfunction route(routes, path) {\n\t\tfor (var route in routes) {\n\t\t\tvar re = regexify(route), params = {}, match\n\n\t\t\tpath.replace(new RegExp(re.re, \"g\"), function () {\n\t\t\t\tfor (var i = 1; i < arguments.length - 2; i++) {\n\t\t\t\t\tparams[re.keys.shift()] = arguments[i]\n\t\t\t\t}\n\n\t\t\t\tmatch = function (model, msg) {\n\t\t\t\t\treturn routes[route](model, msg, params)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tif (match) {\n\t\t\t\treturn match\n\t\t\t}\n\t\t}\n\n\t\treturn routes[\"/\"]\n\t}\n\n\tfunction regexify(path) {\n\t\tvar keys = [], re = \"^\" + path\n\t\t\t.replace(/\\//g, \"\\\\/\")\n\t\t\t.replace(/:([A-Za-z0-9_]+)/g, function (_, key) {\n\t\t\t\tkeys.push(key)\n\t\t\t\treturn \"([A-Za-z0-9_]+)\"\n\t\t\t}) + \"/?$\"\n\n\t\treturn { re: re, keys: keys }\n\t}\n\n\tfunction isPrimitive(type) {\n\t\treturn type === \"string\" || type === \"number\" || type === \"boolean\"\n\t}\n\n\tfunction defer(fn, data) {\n\t\tsetTimeout(function () {\n\t\t\tfn(data)\n\t\t}, 0)\n\t}\n\n\tfunction merge(a, b) {\n\t\tvar obj = {}, key\n\n\t\tif (isPrimitive(typeof b) || Array.isArray(b)) {\n\t\t\treturn b\n\t\t}\n\n\t\tfor (key in a) {\n\t\t\tobj[key] = a[key]\n\t\t}\n\t\tfor (key in b) {\n\t\t\tobj[key] = b[key]\n\t\t}\n\n\t\treturn obj\n\t}\n\n\tfunction shouldUpdate(a, b) {\n\t\treturn a.tag !== b.tag\n\t\t\t|| typeof a !== typeof b\n\t\t\t|| isPrimitive(typeof a) && a !== b\n\t}\n\n\tfunction createElementFrom(node) {\n\t\tvar element\n\t\tif (isPrimitive(typeof node)) {\n\t\t\telement = document.createTextNode(node)\n\n\t\t} else {\n\t\t\telement = node.data && node.data.ns\n\t\t\t\t? document.createElementNS(node.data.ns, node.tag)\n\t\t\t\t: document.createElement(node.tag)\n\n\t\t\tfor (var name in node.data) {\n\t\t\t\tif (name === \"oncreate\") {\n\t\t\t\t\tdefer(node.data[name], element)\n\t\t\t\t} else {\n\t\t\t\t\tsetElementData(element, name, node.data[name])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (var i = 0; i < node.tree.length; i++) {\n\t\t\t\telement.appendChild(createElementFrom(node.tree[i]))\n\t\t\t}\n\t\t}\n\n\t\treturn element\n\t}\n\n\tfunction removeElementData(element, name, value) {\n\t\telement.removeAttribute(name === \"className\" ? \"class\" : name)\n\n\t\tif (typeof value === \"boolean\" || value === \"true\" || value === \"false\") {\n\t\t\telement[name] = false\n\t\t}\n\t}\n\n\tfunction setElementData(element, name, value, oldValue) {\n\t\tif (name === \"style\") {\n\t\t\tfor (var i in value) {\n\t\t\t\telement.style[i] = value[i]\n\t\t\t}\n\n\t\t} else if (name.substr(0, 2) === \"on\") {\n\t\t\tvar event = name.substr(2)\n\t\t\telement.removeEventListener(event, oldValue)\n\t\t\telement.addEventListener(event, value)\n\n\t\t} else {\n\t\t\tif (value === \"false\" || value === false) {\n\t\t\t\telement.removeAttribute(name)\n\t\t\t\telement[name] = false\n\t\t\t} else {\n\t\t\t\telement.setAttribute(name, value)\n\t\t\t\telement[name] = value\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction updateElementData(element, data, oldData) {\n\t\tfor (var name in merge(oldData, data)) {\n\t\t\tvar value = data[name], oldValue = oldData[name]\n\n\t\t\tif (value === undefined) {\n\t\t\t\tremoveElementData(element, name, oldValue)\n\n\t\t\t} else if (value !== oldValue) {\n\t\t\t\tname === \"onupdate\"\n\t\t\t\t\t? defer(value, element)\n\t\t\t\t\t: setElementData(element, name, value, oldValue)\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction patch(parent, node, oldNode, index) {\n\t\tif (oldNode === undefined) {\n\t\t\tparent.appendChild(createElementFrom(node))\n\n\t\t} else if (node === undefined) {\n\t\t\twhile (index > 0 && !parent.childNodes[index]) {\n\t\t\t\tindex--\n\t\t\t}\n\n\t\t\tif (index >= 0) {\n\t\t\t\tvar element = parent.childNodes[index]\n\n\t\t\t\tif (oldNode && oldNode.data) {\n\t\t\t\t\tvar hook = oldNode.data.onremove\n\t\t\t\t\tif (hook) {\n\t\t\t\t\t\tdefer(hook, element)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tparent.removeChild(element)\n\t\t\t}\n\n\t\t} else if (shouldUpdate(node, oldNode)) {\n\t\t\tparent.replaceChild(createElementFrom(node), parent.childNodes[index])\n\n\t\t} else if (node.tag) {\n\t\t\tvar element = parent.childNodes[index]\n\n\t\t\tupdateElementData(element, node.data, oldNode.data)\n\n\t\t\tvar len = node.tree.length, oldLen = oldNode.tree.length\n\n\t\t\tfor (var i = 0; i < len || i < oldLen; i++) {\n\t\t\t\tpatch(element, node.tree[i], oldNode.tree[i], i)\n\t\t\t}\n\t\t}\n\t}\n}","var h = require(\"./h\")\n\nmodule.exports = {\n html: require(\"hyperx\")(h),\n app: require(\"./app\"),\n h: h\n}\n"],"names":["svg","tag","data","tree","ns","i","length","node","attributeToProperty","h","tagName","attrs","children","attr","transform","quot","state","ATTR_VALUE_SQ","ATTR_VALUE_DQ","selfClosing","closeRE","test","push","apply","arguments","shift","head","Array","isArray","undefined","props","concat","class","for","http-equiv","attrToProp","require$$0","VAR","TEXT","OPEN","CLOSE","ATTR","ATTR_KEY","ATTR_KEY_W","ATTR_VALUE_W","ATTR_VALUE","ATTR_EQ","ATTR_BREAK","opts","strfn","x","a","b","String","strings","parse","str","res","c","charAt","reg","arglen","parts","arg","p","xstate","stack","cur","s","ix","pop","copyKey","key","hasOwnProperty","j","toLowerCase","Error","RegExp","join","options","render","model","view","lastNode","patch","root","msg","route","routes","path","match","re","regexify","params","replace","keys","_","isPrimitive","type","defer","fn","setTimeout","merge","obj","shouldUpdate","createElementFrom","element","document","createTextNode","createElementNS","createElement","name","setElementData","appendChild","removeElementData","value","removeAttribute","oldValue","style","substr","event","removeEventListener","addEventListener","setAttribute","updateElementData","oldData","parent","oldNode","index","childNodes","hook","onremove","removeChild","replaceChild","len","oldLen","reducers","update","effects","subscriptions","subs","hooks","onError","onAction","Function","prototype","onUpdate","err","body","location","pathname","setLocation","history","pushState","window","onclick","e","metaKey","shiftKey","ctrlKey","altKey","target","localName","parentNode","host","hasAttribute","hash","querySelector","scrollIntoView","preventDefault","effect","_model","readyState","html","require$$1","app","require$$2"],"mappings":"mLA2BA,SAASA,GAAIC,EAAKC,EAAMC,GACvBD,EAAKE,GAAK,4BAEV,KAAK,GAAIC,GAAI,EAAGA,EAAIF,EAAKG,OAAQD,IAAK,CACrC,GAAIE,GAAOJ,EAAKE,EACZE,GAAKL,MACRF,EAAIO,EAAKN,IAAKM,EAAKL,KAAMK,EAAKJ,OCzBjC,QAASK,GAAqBC,GAC5B,MAAO,UAAUC,EAASC,EAAOC,GAC/B,IAAK,GAAIC,KAAQF,GACXE,IAAQC,KACVH,EAAMG,EAAUD,IAASF,EAAME,SACxBF,GAAME,GAGjB,OAAOJ,GAAEC,EAAS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GACxBsK,IAAKC,EACLvK,EAAGA"} \ No newline at end of file diff --git a/dist/hyperapp.js b/dist/hyperapp.js index ff83d5758..5d21b0ce6 100644 --- a/dist/hyperapp.js +++ b/dist/hyperapp.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.hyperapp=e()}(this,function(){"use strict";function t(e,n,o){n.ns="http://www.w3.org/2000/svg";for(var r=0;r0&&!t.childNodes[o];)o--;if(o>=0){var r=t.childNodes[o];if(n&&n.data){var i=n.data.onremove;i&&a(i,r)}t.removeChild(r)}}else if(f(e,n))t.replaceChild(u(e),t.childNodes[o]);else if(e.tag){var r=t.childNodes[o];s(r,e.data,n.data);for(var c=e.tree.length,d=n.tree.length,p=0;p0&&!t.childNodes[o];)o--;if(o>=0){var r=t.childNodes[o];if(n&&n.data){var i=n.data.onremove;i&&a(i,r)}t.removeChild(r)}}else if(f(e,n))t.replaceChild(u(e),t.childNodes[o]);else if(e.tag){var r=t.childNodes[o];s(r,e.data,n.data);for(var c=e.tree.length,d=n.tree.length,l=0;l= 0.0.13\n\t\tsubs = options.subscriptions || options.subs\n\t\tfor (var key in subs) {\n\t\t\tsubs[key](model, msg, hooks.onError)\n\t\t}\n\t}\n\n\tvar hooks = merge({\n\t\tonAction: Function.prototype,\n\t\tonUpdate: Function.prototype,\n\t\tonError: function (err) {\n\t\t\tthrow err\n\t\t}\n\t}, options.hooks)\n\n\tvar node\n\tvar root = options.root || document.body.appendChild(document.createElement(\"div\"))\n\tvar view = options.view || function () {\n\t\treturn root\n\t}\n\tvar routes = typeof view === \"function\" ? undefined : view\n\n\tif (routes) {\n\t\tview = route(routes, location.pathname)\n\n\t\tmsg.setLocation = function (data) {\n\t\t\trender(model, view = route(routes, data), node)\n\t\t\thistory.pushState({}, \"\", data)\n\t\t}\n\n\t\twindow.addEventListener(\"popstate\", function () {\n\t\t\trender(model, view = route(routes, location.pathname), node)\n\t\t})\n\n\t\twindow.onclick = function (e) {\n\t\t\tif (e.metaKey || e.shiftKey || e.ctrlKey || e.altKey) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar target = e.target\n\n\t\t\twhile (target && target.localName !== \"a\") {\n\t\t\t\ttarget = target.parentNode\n\t\t\t}\n\n\t\t\tif (target && target.host === location.host\n\t\t\t\t&& !target.hasAttribute(\"data-no-routing\")) {\n\n\t\t\t\tvar element = target.hash === \"\" ? element : document.querySelector(target.hash)\n\t\t\t\tif (element) {\n\t\t\t\t\telement.scrollIntoView(true)\n\n\t\t\t\t} else {\n\t\t\t\t\tmsg.setLocation(target.pathname)\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (var name in merge(reducers, effects)) {\n\t\t(function (name) {\n\t\t\tmsg[name] = function (data) {\n\t\t\t\thooks.onAction(name, data)\n\n\t\t\t\tvar effect = effects[name]\n\t\t\t\tif (effect) {\n\t\t\t\t\treturn effect(model, msg, data, hooks.onError)\n\t\t\t\t}\n\n\t\t\t\tvar update = reducers[name], _model = model\n\t\t\t\trender(model = merge(model, update(model, data)), view, node)\n\n\t\t\t\thooks.onUpdate(_model, model, data)\n\t\t\t}\n\t\t}(name))\n\t}\n\n\tif (document.readyState !== \"loading\") {\n\t\tsubscriptions()\n\t} else {\n\t\tdocument.addEventListener(\"DOMContentLoaded\", subscriptions)\n\t}\n\n\trender(model, view)\n\n\tfunction render(model, view, lastNode) {\n\t\tpatch(root, node = view(model, msg), lastNode, 0)\n\t}\n\n\tfunction route(routes, path) {\n\t\tfor (var route in routes) {\n\t\t\tvar re = regexify(route), params = {}, match\n\n\t\t\tpath.replace(new RegExp(re.re, \"g\"), function () {\n\t\t\t\tfor (var i = 1; i < arguments.length - 2; i++) {\n\t\t\t\t\tparams[re.keys.shift()] = arguments[i]\n\t\t\t\t}\n\n\t\t\t\tmatch = function (model, msg) {\n\t\t\t\t\treturn routes[route](model, msg, params)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tif (match) {\n\t\t\t\treturn match\n\t\t\t}\n\t\t}\n\n\t\treturn routes[\"/\"]\n\t}\n\n\tfunction regexify(path) {\n\t\tvar keys = [], re = \"^\" + path\n\t\t\t.replace(/\\//g, \"\\\\/\")\n\t\t\t.replace(/:([A-Za-z0-9_]+)/g, function (_, key) {\n\t\t\t\tkeys.push(key)\n\t\t\t\treturn \"([A-Za-z0-9_]+)\"\n\t\t\t}) + \"/?$\"\n\n\t\treturn { re: re, keys: keys }\n\t}\n\n\tfunction isPrimitive(type) {\n\t\treturn type === \"string\" || type === \"number\" || type === \"boolean\"\n\t}\n\n\tfunction defer(fn, data) {\n\t\tsetTimeout(function () {\n\t\t\tfn(data)\n\t\t}, 0)\n\t}\n\n\tfunction merge(a, b) {\n\t\tvar obj = {}, key\n\n\t\tif (isPrimitive(typeof b) || Array.isArray(b)) {\n\t\t\treturn b\n\t\t}\n\n\t\tfor (key in a) {\n\t\t\tobj[key] = a[key]\n\t\t}\n\t\tfor (key in b) {\n\t\t\tobj[key] = b[key]\n\t\t}\n\n\t\treturn obj\n\t}\n\n\tfunction shouldUpdate(a, b) {\n\t\treturn a.tag !== b.tag\n\t\t\t|| typeof a !== typeof b\n\t\t\t|| isPrimitive(typeof a) && a !== b\n\t}\n\n\tfunction createElementFrom(node) {\n\t\tvar element\n\t\tif (isPrimitive(typeof node)) {\n\t\t\telement = document.createTextNode(node)\n\n\t\t} else {\n\t\t\telement = node.data && node.data.ns\n\t\t\t\t? document.createElementNS(node.data.ns, node.tag)\n\t\t\t\t: document.createElement(node.tag)\n\n\t\t\tfor (var name in node.data) {\n\t\t\t\tif (name === \"oncreate\") {\n\t\t\t\t\tdefer(node.data[name], element)\n\t\t\t\t} else {\n\t\t\t\t\tsetElementData(element, name, node.data[name])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (var i = 0; i < node.tree.length; i++) {\n\t\t\t\telement.appendChild(createElementFrom(node.tree[i]))\n\t\t\t}\n\t\t}\n\n\t\treturn element\n\t}\n\n\tfunction removeElementData(element, name, value) {\n\t\telement.removeAttribute(name === \"className\" ? \"class\" : name)\n\n\t\tif (typeof value === \"boolean\" || value === \"true\" || value === \"false\") {\n\t\t\telement[name] = false\n\t\t}\n\t}\n\n\tfunction setElementData(element, name, value, oldValue) {\n\t\tif (name === \"style\") {\n\t\t\tfor (var i in value) {\n\t\t\t\telement.style[i] = value[i]\n\t\t\t}\n\n\t\t} else if (name.substr(0, 2) === \"on\") {\n\t\t\tvar event = name.substr(2)\n\t\t\telement.removeEventListener(event, oldValue)\n\t\t\telement.addEventListener(event, value)\n\n\t\t} else {\n\t\t\tif (value === \"false\" || value === false) {\n\t\t\t\telement.removeAttribute(name)\n\t\t\t\telement[name] = false\n\t\t\t} else {\n\t\t\t\telement.setAttribute(name, value)\n\t\t\t\telement[name] = value\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction updateElementData(element, data, oldData) {\n\t\tfor (var name in merge(oldData, data)) {\n\t\t\tvar value = data[name], oldValue = oldData[name]\n\n\t\t\tif (value === undefined) {\n\t\t\t\tremoveElementData(element, name, oldValue)\n\n\t\t\t} else if (value !== oldValue) {\n\t\t\t\tname === \"onupdate\"\n\t\t\t\t\t? defer(value, element)\n\t\t\t\t\t: setElementData(element, name, value, oldValue)\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction patch(parent, node, oldNode, index) {\n\t\tif (oldNode === undefined) {\n\t\t\tparent.appendChild(createElementFrom(node))\n\n\t\t} else if (node === undefined) {\n\t\t\twhile (index > 0 && !parent.childNodes[index]) {\n\t\t\t\tindex--\n\t\t\t}\n\n\t\t\tif (index >= 0) {\n\t\t\t\tvar element = parent.childNodes[index]\n\n\t\t\t\tif (oldNode && oldNode.data) {\n\t\t\t\t\tvar hook = oldNode.data.onremove\n\t\t\t\t\tif (hook) {\n\t\t\t\t\t\tdefer(hook, element)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tparent.removeChild(element)\n\t\t\t}\n\n\t\t} else if (shouldUpdate(node, oldNode)) {\n\t\t\tparent.replaceChild(createElementFrom(node), parent.childNodes[index])\n\n\t\t} else if (node.tag) {\n\t\t\tvar element = parent.childNodes[index]\n\n\t\t\tupdateElementData(element, node.data, oldNode.data)\n\n\t\t\tvar len = node.tree.length, oldLen = oldNode.tree.length\n\n\t\t\tfor (var i = 0; i < len || i < oldLen; i++) {\n\t\t\t\tpatch(element, node.tree[i], oldNode.tree[i], i)\n\t\t\t}\n\t\t}\n\t}\n}","module.exports = {\n app: require(\"./app\"),\n h: require(\"./h\")\n}\n"],"names":["svg","tag","data","tree","ns","i","length","node","options","render","model","view","lastNode","patch","root","msg","route","routes","path","match","re","regexify","params","replace","RegExp","arguments","keys","shift","_","key","push","isPrimitive","type","defer","fn","setTimeout","merge","a","b","obj","Array","isArray","shouldUpdate","createElementFrom","element","document","createTextNode","createElementNS","createElement","name","setElementData","appendChild","removeElementData","value","removeAttribute","oldValue","style","substr","event","removeEventListener","addEventListener","setAttribute","updateElementData","oldData","undefined","parent","oldNode","index","childNodes","hook","onremove","removeChild","replaceChild","len","oldLen","reducers","update","effects","subscriptions","subs","hooks","onError","onAction","Function","prototype","onUpdate","err","body","location","pathname","setLocation","history","pushState","window","onclick","e","metaKey","shiftKey","ctrlKey","altKey","target","localName","parentNode","host","hasAttribute","hash","querySelector","scrollIntoView","preventDefault","effect","_model","readyState","apply","head","concat","app","require$$0","h","require$$1"],"mappings":"mLAoBA,SAASA,GAAIC,EAAKC,EAAMC,GACvBD,EAAKE,GAAK,4BAEV,KAAK,GAAIC,GAAI,EAAGA,EAAIF,EAAKG,OAAQD,IAAK,CACrC,GAAIE,GAAOJ,EAAKE,EACZE,GAAKL,MACRF,EAAIO,EAAKN,IAAKM,EAAKL,KAAMK,EAAKJ,OC1BjC,MAAiB,SAAUK,GA8F1B,QAASC,GAAOC,EAAOC,EAAMC,GAC5BC,EAAMC,EAAMP,EAAOI,EAAKD,EAAOK,GAAMH,EAAU,GAGhD,QA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O9G,EAE9C,QAARF,GACHD,EAAIC,EAAKC,EAAMC,IAIfF,IAAKA,EACLC,KAAMA,MACNC,QAAS+G,OAAOF,SAAU7G,QEfxBgH,IAAKC,EACLC,EAAGC"} \ No newline at end of file +{"version":3,"file":"hyperapp.js","sources":["../src/h.js","../src/app.js","../src/hyperapp.js"],"sourcesContent":["module.exports = function (tag, data) {\n\tvar tree = []\n\ttree.push.apply(tree, arguments)\n\ttree.shift()\n\ttree.shift()\n\tvar head = tree[0]\n\n\ttree = Array.isArray(head) || head === undefined ? head : tree\n\n\tif (typeof tag === \"function\") {\n\t\treturn tag({\n\t\t\tprops: data,\n\t\t\tchildren: tree || []\n\t\t})\n\t}\n\n\tif (tag === \"svg\") {\n\t\tsvg(tag, data, tree)\n\t}\n\n\treturn {\n\t\ttag: tag,\n\t\tdata: data || {},\n\t\ttree: [].concat.apply([], tree)\n\t}\n}\n\nfunction svg(tag, data, tree) {\n\tdata.ns = \"http://www.w3.org/2000/svg\"\n\n\tfor (var i = 0; i < tree.length; i++) {\n\t\tvar node = tree[i]\n\t\tif (node.data) {\n\t\t\tsvg(node.tag, node.data, node.tree)\n\t\t}\n\t}\n}\n\n","module.exports = function (options) {\n\tvar msg = {}\n\n\tvar model = options.model\n\tvar reducers = options.update || {}\n\tvar effects = options.effects || {}\n\n\tvar subscriptions = function (subs) {\n\t\t// `subs` will be deprecated in favor of only `subscriptions` >= 0.0.13\n\t\tsubs = options.subscriptions || options.subs\n\t\tfor (var key in subs) {\n\t\t\tsubs[key](model, msg, hooks.onError)\n\t\t}\n\t}\n\n\tvar hooks = merge({\n\t\tonAction: Function.prototype,\n\t\tonUpdate: Function.prototype,\n\t\tonError: function (err) {\n\t\t\tthrow err\n\t\t}\n\t}, options.hooks)\n\n\tvar node\n\tvar root = options.root || document.body.appendChild(document.createElement(\"div\"))\n\tvar view = options.view || function () {\n\t\treturn root\n\t}\n\tvar routes = typeof view === \"function\" ? undefined : view\n\n\tif (routes) {\n\t\tview = route(routes, location.pathname)\n\n\t\tmsg.setLocation = function (data) {\n\t\t\trender(model, view = route(routes, data), node)\n\t\t\thistory.pushState({}, \"\", data)\n\t\t}\n\n\t\twindow.addEventListener(\"popstate\", function () {\n\t\t\trender(model, view = route(routes, location.pathname), node)\n\t\t})\n\n\t\twindow.onclick = function (e) {\n\t\t\tif (e.metaKey || e.shiftKey || e.ctrlKey || e.altKey) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar target = e.target\n\n\t\t\twhile (target && target.localName !== \"a\") {\n\t\t\t\ttarget = target.parentNode\n\t\t\t}\n\n\t\t\tif (target && target.host === location.host\n\t\t\t\t&& !target.hasAttribute(\"data-no-routing\")) {\n\n\t\t\t\tvar element = target.hash === \"\" ? element : document.querySelector(target.hash)\n\t\t\t\tif (element) {\n\t\t\t\t\telement.scrollIntoView(true)\n\n\t\t\t\t} else {\n\t\t\t\t\tmsg.setLocation(target.pathname)\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (var name in merge(reducers, effects)) {\n\t\t(function (name) {\n\t\t\tmsg[name] = function (data) {\n\t\t\t\thooks.onAction(name, data)\n\n\t\t\t\tvar effect = effects[name]\n\t\t\t\tif (effect) {\n\t\t\t\t\treturn effect(model, msg, data, hooks.onError)\n\t\t\t\t}\n\n\t\t\t\tvar update = reducers[name], _model = model\n\t\t\t\trender(model = merge(model, update(model, data)), view, node)\n\n\t\t\t\thooks.onUpdate(_model, model, data)\n\t\t\t}\n\t\t}(name))\n\t}\n\n\tif (document.readyState !== \"loading\") {\n\t\tsubscriptions()\n\t} else {\n\t\tdocument.addEventListener(\"DOMContentLoaded\", subscriptions)\n\t}\n\n\trender(model, view)\n\n\tfunction render(model, view, lastNode) {\n\t\tpatch(root, node = view(model, msg), lastNode, 0)\n\t}\n\n\tfunction route(routes, path) {\n\t\tfor (var route in routes) {\n\t\t\tvar re = regexify(route), params = {}, match\n\n\t\t\tpath.replace(new RegExp(re.re, \"g\"), function () {\n\t\t\t\tfor (var i = 1; i < arguments.length - 2; i++) {\n\t\t\t\t\tparams[re.keys.shift()] = arguments[i]\n\t\t\t\t}\n\n\t\t\t\tmatch = function (model, msg) {\n\t\t\t\t\treturn routes[route](model, msg, params)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tif (match) {\n\t\t\t\treturn match\n\t\t\t}\n\t\t}\n\n\t\treturn routes[\"/\"]\n\t}\n\n\tfunction regexify(path) {\n\t\tvar keys = [], re = \"^\" + path\n\t\t\t.replace(/\\//g, \"\\\\/\")\n\t\t\t.replace(/:([A-Za-z0-9_]+)/g, function (_, key) {\n\t\t\t\tkeys.push(key)\n\t\t\t\treturn \"([A-Za-z0-9_]+)\"\n\t\t\t}) + \"/?$\"\n\n\t\treturn { re: re, keys: keys }\n\t}\n\n\tfunction isPrimitive(type) {\n\t\treturn type === \"string\" || type === \"number\" || type === \"boolean\"\n\t}\n\n\tfunction defer(fn, data) {\n\t\tsetTimeout(function () {\n\t\t\tfn(data)\n\t\t}, 0)\n\t}\n\n\tfunction merge(a, b) {\n\t\tvar obj = {}, key\n\n\t\tif (isPrimitive(typeof b) || Array.isArray(b)) {\n\t\t\treturn b\n\t\t}\n\n\t\tfor (key in a) {\n\t\t\tobj[key] = a[key]\n\t\t}\n\t\tfor (key in b) {\n\t\t\tobj[key] = b[key]\n\t\t}\n\n\t\treturn obj\n\t}\n\n\tfunction shouldUpdate(a, b) {\n\t\treturn a.tag !== b.tag\n\t\t\t|| typeof a !== typeof b\n\t\t\t|| isPrimitive(typeof a) && a !== b\n\t}\n\n\tfunction createElementFrom(node) {\n\t\tvar element\n\t\tif (isPrimitive(typeof node)) {\n\t\t\telement = document.createTextNode(node)\n\n\t\t} else {\n\t\t\telement = node.data && node.data.ns\n\t\t\t\t? document.createElementNS(node.data.ns, node.tag)\n\t\t\t\t: document.createElement(node.tag)\n\n\t\t\tfor (var name in node.data) {\n\t\t\t\tif (name === \"oncreate\") {\n\t\t\t\t\tdefer(node.data[name], element)\n\t\t\t\t} else {\n\t\t\t\t\tsetElementData(element, name, node.data[name])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (var i = 0; i < node.tree.length; i++) {\n\t\t\t\telement.appendChild(createElementFrom(node.tree[i]))\n\t\t\t}\n\t\t}\n\n\t\treturn element\n\t}\n\n\tfunction removeElementData(element, name, value) {\n\t\telement.removeAttribute(name === \"className\" ? \"class\" : name)\n\n\t\tif (typeof value === \"boolean\" || value === \"true\" || value === \"false\") {\n\t\t\telement[name] = false\n\t\t}\n\t}\n\n\tfunction setElementData(element, name, value, oldValue) {\n\t\tif (name === \"style\") {\n\t\t\tfor (var i in value) {\n\t\t\t\telement.style[i] = value[i]\n\t\t\t}\n\n\t\t} else if (name.substr(0, 2) === \"on\") {\n\t\t\tvar event = name.substr(2)\n\t\t\telement.removeEventListener(event, oldValue)\n\t\t\telement.addEventListener(event, value)\n\n\t\t} else {\n\t\t\tif (value === \"false\" || value === false) {\n\t\t\t\telement.removeAttribute(name)\n\t\t\t\telement[name] = false\n\t\t\t} else {\n\t\t\t\telement.setAttribute(name, value)\n\t\t\t\telement[name] = value\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction updateElementData(element, data, oldData) {\n\t\tfor (var name in merge(oldData, data)) {\n\t\t\tvar value = data[name], oldValue = oldData[name]\n\n\t\t\tif (value === undefined) {\n\t\t\t\tremoveElementData(element, name, oldValue)\n\n\t\t\t} else if (value !== oldValue) {\n\t\t\t\tname === \"onupdate\"\n\t\t\t\t\t? defer(value, element)\n\t\t\t\t\t: setElementData(element, name, value, oldValue)\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction patch(parent, node, oldNode, index) {\n\t\tif (oldNode === undefined) {\n\t\t\tparent.appendChild(createElementFrom(node))\n\n\t\t} else if (node === undefined) {\n\t\t\twhile (index > 0 && !parent.childNodes[index]) {\n\t\t\t\tindex--\n\t\t\t}\n\n\t\t\tif (index >= 0) {\n\t\t\t\tvar element = parent.childNodes[index]\n\n\t\t\t\tif (oldNode && oldNode.data) {\n\t\t\t\t\tvar hook = oldNode.data.onremove\n\t\t\t\t\tif (hook) {\n\t\t\t\t\t\tdefer(hook, element)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tparent.removeChild(element)\n\t\t\t}\n\n\t\t} else if (shouldUpdate(node, oldNode)) {\n\t\t\tparent.replaceChild(createElementFrom(node), parent.childNodes[index])\n\n\t\t} else if (node.tag) {\n\t\t\tvar element = parent.childNodes[index]\n\n\t\t\tupdateElementData(element, node.data, oldNode.data)\n\n\t\t\tvar len = node.tree.length, oldLen = oldNode.tree.length\n\n\t\t\tfor (var i = 0; i < len || i < oldLen; i++) {\n\t\t\t\tpatch(element, node.tree[i], oldNode.tree[i], i)\n\t\t\t}\n\t\t}\n\t}\n}","module.exports = {\n app: require(\"./app\"),\n h: require(\"./h\")\n}\n"],"names":["svg","tag","data","tree","ns","i","length","node","options","render","model","view","lastNode","patch","root","msg","route","routes","path","match","re","regexify","params","replace","RegExp","arguments","keys","shift","_","key","push","isPrimitive","type","defer","fn","setTimeout","merge","a","b","obj","Array","isArray","shouldUpdate","createElementFrom","element","document","createTextNode","createElementNS","createElement","name","setElementData","appendChild","removeElementData","value","removeAttribute","oldValue","style","substr","event","removeEventListener","addEventListener","setAttribute","updateElementData","oldData","undefined","parent","oldNode","index","childNodes","hook","onremove","removeChild","replaceChild","len","oldLen","reducers","update","effects","subscriptions","subs","hooks","onError","onAction","Function","prototype","onUpdate","err","body","location","pathname","setLocation","history","pushState","window","onclick","e","metaKey","shiftKey","ctrlKey","altKey","target","localName","parentNode","host","hasAttribute","hash","querySelector","scrollIntoView","preventDefault","effect","_model","readyState","apply","head","props","children","concat","app","require$$0","h","require$$1"],"mappings":"mLA2BA,SAASA,GAAIC,EAAKC,EAAMC,GACvBD,EAAKE,GAAK,4BAEV,KAAK,GAAIC,GAAI,EAAGA,EAAIF,EAAKG,OAAQD,IAAK,CACrC,GAAIE,GAAOJ,EAAKE,EACZE,GA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,GAC/B,GAAIC,KACJA,GAAK2B,KAAKkF,MAAM7G,EAAMsB,WACtBtB,EAAKwB,QACLxB,EAAKwB,OACL,IAAIsF,GAAO9G,EAAK,EAIhB,OAFAA,GAAOqC,MAAMC,QAAQwE,IAAkBjD,SAATiD,EAAqBA,EAAO9G,EAEvC,kBAARF,GACHA,GACNiH,MAAOhH,EACPiH,SAAUhH,SAIA,QAARF,GACHD,EAAIC,EAAKC,EAAMC,IAIfF,IAAKA,EACLC,KAAMA,MACNC,QAASiH,OAAOJ,SAAU7G,SEtBxBkH,IAAKC,EACLC,EAAGC"} \ No newline at end of file diff --git a/src/h.js b/src/h.js index 16b27b2f5..122f3166b 100644 --- a/src/h.js +++ b/src/h.js @@ -1,5 +1,5 @@ module.exports = function (tag, data) { - var tree = [] + var tree = [] tree.push.apply(tree, arguments) tree.shift() tree.shift() @@ -7,6 +7,13 @@ module.exports = function (tag, data) { tree = Array.isArray(head) || head === undefined ? head : tree + if (typeof tag === "function") { + return tag({ + props: data, + children: tree || [] + }) + } + if (tag === "svg") { svg(tag, data, tree) }