diff --git a/changelog.json b/changelog.json index d76299a..6505305 100644 --- a/changelog.json +++ b/changelog.json @@ -1,5 +1,11 @@ { "releases": { + "0.4.1": [ + "[Added] Events `onMount` and `onDestroy` to DOM nodes", + "[Fixed] Modal now destroys correctly", + "[Fixed] Attribute `loadfocus` now uses correct event", + "[Improved] Input types `radio` and `checkbox` now works well with `model` attribute" + ], "0.4.0": [ "[New] Deprecates usage of on.event, instead use onEvent for components", "[Improved] Rename of `$events` and `$privateStore`" diff --git a/dist/radi.es.js b/dist/radi.es.js index b8d7c0f..88c86bc 100644 --- a/dist/radi.es.js +++ b/dist/radi.es.js @@ -1,7 +1,7 @@ var GLOBALS = { HEADLESS_COMPONENTS: {}, FROZEN_STATE: false, - VERSION: '0.4.0', + VERSION: '0.4.1', // TODO: Collect active components ACTIVE_COMPONENTS: {}, CUSTOM_ATTRIBUTES: {}, @@ -383,6 +383,12 @@ Listener.prototype.deattach = function deattach () { this.processValue = () => {}; }; +var onMountEvent = document.createEvent('Event'); +onMountEvent.initEvent('mount', true, true); + +var onLoadEvent = document.createEvent('Event'); +onLoadEvent.initEvent('load', true, true); + /** * Append dom node to dom tree (after - (true) should append after 'to' element * or (false) inside it) @@ -392,9 +398,16 @@ Listener.prototype.deattach = function deattach () { * @returns {HTMLElement} */ var append = (node, to, after) => { + if (typeof node.dispatchEvent === 'function') { + node.dispatchEvent(onLoadEvent); + } + if (after && to) { if (to.parentNode) { to.parentNode.insertBefore(node, to); + if (typeof node.dispatchEvent === 'function') { + node.dispatchEvent(onMountEvent); + } // if (!to.nextSibling) { // to.parentNode.appendChild(node); // } else { @@ -404,7 +417,13 @@ var append = (node, to, after) => { return node; } - return to.appendChild(node); + to.appendChild(node); + + if (typeof node.dispatchEvent === 'function') { + node.dispatchEvent(onMountEvent); + } + + return node; }; var getLast = (child) => { @@ -714,44 +733,61 @@ var setAttributes = (structure, propsSource, oldPropsSource) => { // Skip if proprs are the same if (typeof oldProps !== 'undefined' && oldProps[prop] === props[prop]) { return; } + if (prop === 'checked') { + element.checked = props[prop]; + } + // Need to remove falsy attribute - if (!props[prop] && typeof props[prop] !== 'number') { + if (!props[prop] && typeof props[prop] !== 'number' && typeof props[prop] !== 'string') { element.removeAttribute(prop); return; } - if ((prop === 'value' || prop === 'model') && !(props[prop] instanceof Listener)) { - if (/(checkbox|radio)/.test(element.getAttribute('type'))) { - element.checked = props[prop]; - } else { - element.value = props[prop]; - } - } - // Handle Listeners if (props[prop] instanceof Listener) { if (typeof structure.$attrListeners[prop] !== 'undefined') { return; } structure.$attrListeners[prop] = props[prop]; props[prop].applyDepth(structure.depth).init(); - if (prop.toLowerCase() === 'model') { - if (/(checkbox|radio)/.test(element.getAttribute('type'))) { - element.addEventListener('change', (e) => { - structure.$attrListeners[prop].updateValue(e.target.checked); + if (prop.toLowerCase() === 'model' || prop.toLowerCase() === 'checked') { + if (element.getAttribute('type') === 'radio') { + element.addEventListener('input', (e) => { + structure.$attrListeners[prop].updateValue( + (e.target.checked && e.target.value) + || e.target.checked + ); + }, false); + structure.$attrListeners[prop].onValueChange(value => { + setAttributes(structure, { + checked: element.value === value && Boolean(value), + }, {}); + }); + } else + if (element.getAttribute('type') === 'checkbox') { + element.addEventListener('input', (e) => { + structure.$attrListeners[prop].updateValue( + Boolean(e.target.checked) + ); + }, false); + structure.$attrListeners[prop].onValueChange(value => { + setAttributes(structure, { + checked: Boolean(value), + }, {}); }); } else { element.addEventListener('input', (e) => { structure.$attrListeners[prop].updateValue(e.target.value); - }); + }, false); } } - structure.$attrListeners[prop].onValueChange(value => { - setAttributes(structure, { - [prop]: value, - }, {}); - // props[prop] = value; - }); + if (!/(checkbox|radio)/.test(element.getAttribute('type'))) { + structure.$attrListeners[prop].onValueChange(value => { + setAttributes(structure, { + [prop]: value, + }, {}); + }); + } // structure.setProps(Object.assign(structure.data.props, { // [prop]: props[prop].value, @@ -760,6 +796,10 @@ var setAttributes = (structure, propsSource, oldPropsSource) => { return; } + if (prop === 'value' || prop === 'model') { + element.value = props[prop]; + } + if (typeof GLOBALS.CUSTOM_ATTRIBUTES[prop] !== 'undefined') { var ref = GLOBALS.CUSTOM_ATTRIBUTES[prop]; var allowedTags = ref.allowedTags; @@ -793,11 +833,9 @@ var setAttributes = (structure, propsSource, oldPropsSource) => { } if (prop.toLowerCase() === 'loadfocus') { - element.onload = (el) => { - setTimeout(() => { - el.focus(); - }, 10); - }; + element.addEventListener('mount', () => { + element.focus(); + }, false); return; } @@ -879,7 +917,6 @@ var Structure = function Structure(query, props, children, depth) { if ( props === void 0 ) props = {}; if ( depth === void 0 ) depth = 0; - // console.log('H', query, children) this.query = query; this.props = Boolean !== props ? props : {}; if (isComponent(query) || query instanceof Component) { @@ -903,18 +940,20 @@ var Structure = function Structure(query, props, children, depth) { Structure.prototype.mount = function mount () { this.$destroyed = false; - // console.warn('[mounted]', this) if (this.$component instanceof Component) { this.$component.mount(); } + + if (typeof this.onMount === 'function') { + this.onMount(); + } }; Structure.prototype.destroy = function destroy (childrenToo) { if ( childrenToo === void 0 ) childrenToo = true; if (this.$destroyed) { return false; } - // console.warn('[destroyed]', this, this.html, this.$redirect) for (var l in this.$styleListeners) { if (this.$styleListeners[l] @@ -973,6 +1012,11 @@ Structure.prototype.destroy = function destroy (childrenToo) { if (this.$pointer && this.$pointer.parentNode) { this.$pointer.parentNode.removeChild(this.$pointer); } + + if (typeof this.onDestroy === 'function') { + this.onDestroy(); + } + this.$pointer = null; this.$redirect = null; this.$component = null; @@ -1439,7 +1483,7 @@ Component.prototype.setState = function setState (newState, actionName) { } if (typeof actionName === 'string' && typeof this[actionName] === 'function') { - this.trigger(`after${actionName[0].toUpperCase()}${actionName.substr(1)}`); + this.trigger(`after${capitalise(actionName)}`, newState); } // if (typeof newState === 'object') { @@ -1787,7 +1831,7 @@ var Modal = (function (Component$$1) { element, }, }), - }); + }, 'register'); }; Modal.prototype.exists = function exists (name) { @@ -1809,7 +1853,7 @@ var Modal = (function (Component$$1) { element: this.state.registry[name].element, }, }), - }); + }, 'open'); }; Modal.prototype.close = function close (name) { @@ -1822,7 +1866,7 @@ var Modal = (function (Component$$1) { element: this.state.registry[name].element, }, }), - }); + }, 'close'); }; Modal.prototype.closeAll = function closeAll () { @@ -1836,7 +1880,7 @@ var Modal = (function (Component$$1) { return this.setState({ registry, - }); + }, 'closeAll'); }; return Modal; @@ -1854,7 +1898,7 @@ customTag('modal', console.warn('[Radi.js] Warn: Every tag needs to have `name` attribute!'); } - mount(listen($modal, 'registry', name) + var mounted = mount(listen($modal, 'registry', name) .process(v => ( v.status && r('div', { class: 'radi-modal', name }, @@ -1869,7 +1913,15 @@ customTag('modal', ) )), document.body); - return buildNode(null); + var treeSitter = buildNode(null); + + treeSitter.onDestroy = () => { + for (var i = 0; i < mounted.length; i++) { + if (typeof mounted[i].destroy === 'function') { mounted[i].destroy(); } + } + }; + + return treeSitter; }, () => { // Destroyed `element` } diff --git a/dist/radi.es.js.map b/dist/radi.es.js.map index 39046bf..4e6be0d 100644 --- a/dist/radi.es.js.map +++ b/dist/radi.es.js.map @@ -1 +1 @@ -{"version":3,"file":"radi.es.js","sources":["../src/consts/GLOBALS.js","../src/utils/flatten.js","../src/utils/generateId.js","../src/component/utils/PrivateStore.js","../src/utils/clone.js","../src/utils/skipInProductionAndTest.js","../src/listen/Listener.js","../src/r/utils/append.js","../src/r/mountChildren.js","../src/r/utils/textNode.js","../src/mount.js","../src/r/utils/getElementFromQuery.js","../src/r/utils/explode.js","../src/r/utils/parseValue.js","../src/r/setStyles.js","../src/r/utils/parseClass.js","../src/r/setAttributes.js","../src/r/Structure.js","../src/r/patch.js","../src/component/Component.js","../src/component/utils/isComponent.js","../src/r/utils/filterNode.js","../src/r/index.js","../src/listen/index.js","../src/component/headless.js","../src/action/index.js","../src/action/worker.js","../src/action/subscribe.js","../src/r/customTag.js","../src/r/customAttribute.js","../src/utils/remountActiveComponents.js","../src/custom/attributes/animation.js","../src/custom/modal.js","../src/index.js"],"sourcesContent":["const GLOBALS = {\n HEADLESS_COMPONENTS: {},\n FROZEN_STATE: false,\n VERSION: '0.4.0',\n // TODO: Collect active components\n ACTIVE_COMPONENTS: {},\n CUSTOM_ATTRIBUTES: {},\n CUSTOM_TAGS: {},\n};\n\nexport default GLOBALS;\n","\n/**\n * @param {*[]} list\n * @returns {*[]}\n */\nconst flatten = function flatten(list) {\n return list.reduce((a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), []);\n};\n\nexport default flatten;\n","/**\n * UUID v4 generator\n * https://gist.github.com/jcxplorer/823878\n * @returns {string}\n */\nconst generateId = () => {\n let uuid = '';\n for (let i = 0; i < 32; i++) {\n const random = (Math.random() * 16) | 0; // eslint-disable-line\n\n if (i === 8 || i === 12 || i === 16 || i === 20) {\n uuid += '-';\n }\n uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16); // eslint-disable-line\n }\n return uuid;\n};\n\nexport default generateId;\n","export default class PrivateStore {\n constructor() {\n this.store = {};\n }\n\n /**\n * @param {string} key\n * @param {Listener} listener\n * @param {number} depth\n */\n addListener(key, listener, depth) {\n if (typeof this.store[key] === 'undefined') {\n this.createItemWrapper(key);\n }\n this.store[key].listeners[depth] = (this.store[key].listeners[depth] || []).filter(item => (\n item.attached\n ));\n this.store[key].listeners[depth].push(listener);\n\n return listener;\n }\n\n /**\n * Removes all listeners for all keys\n */\n removeListeners() {\n let o = Object.keys(this.store);\n for (var i = 0; i < o.length; i++) {\n this.store[o[i]].listeners = {};\n this.store[o[i]].value = null;\n }\n }\n\n /**\n * setState\n * @param {*} newState\n * @returns {*}\n */\n setState(newState) {\n // Find and trigger changes for listeners\n for (const key of Object.keys(newState)) {\n if (typeof this.store[key] === 'undefined') {\n this.createItemWrapper(key);\n }\n this.store[key].value = newState[key];\n\n this.triggerListeners(key);\n }\n return newState;\n }\n\n /**\n * createItemWrapper\n * @private\n * @param {string} key\n * @returns {object}\n */\n createItemWrapper(key) {\n return this.store[key] = {\n listeners: {},\n value: null,\n };\n }\n\n /**\n * triggerListeners\n * @private\n * @param {string} key\n */\n triggerListeners(key) {\n const item = this.store[key];\n if (item) {\n let clone = Object.keys(item.listeners)\n .sort()\n .map(key => (\n item.listeners[key].map(listener => listener)\n ));\n\n for (var i = 0; i < clone.length; i++) {\n for (var n = clone[i].length - 1; n >= 0; n--) {\n if (clone[i][n].attached) clone[i][n].handleUpdate(item.value)\n }\n }\n }\n }\n}\n","/**\n * @param {*} obj\n * @returns {*}\n */\nconst clone = obj => {\n if (typeof obj !== 'object') return obj;\n if (obj === null) return obj;\n if (Array.isArray(obj)) return obj.map(clone);\n\n /*eslint-disable*/\n // Reverted as currently throws some errors\n const cloned = {};\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n cloned[key] = clone(obj[key]);\n }\n }\n /* eslint-enable */\n\n return cloned;\n};\n\nexport default clone;\n","const skipInProductionAndTest = fn => {\n if (typeof process === 'undefined'\n || (process.env.NODE_ENV === 'production'\n || process.env.NODE_ENV === 'test')) {\n return false;\n }\n return fn && fn();\n};\n\nexport default skipInProductionAndTest;\n","/* eslint-disable no-param-reassign */\n/* eslint-disable no-shadow */\n/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\n// import fuseDom from '../r/utils/fuseDom';\n\nexport default class Listener {\n /**\n * @param {Component} component\n * @param {...string} path\n */\n constructor(component, ...path) {\n this.component = component;\n [this.key] = path;\n this.path = path.slice(1, path.length);\n this.depth = 0;\n this.attached = true;\n this.processValue = value => value;\n this.changeListener = () => {};\n this.addedListeners = [];\n }\n\n /**\n * Applies values and events to listener\n */\n init() {\n this.value = this.getValue(this.component.state[this.key]);\n this.component.addListener(this.key, this, this.depth);\n this.handleUpdate(this.component.state[this.key]);\n return this;\n }\n\n /**\n * Removes last active value with destroying listeners and\n * @param {*} value\n */\n unlink() {\n if (this.value instanceof Node) {\n // Destroy this Node\n // fuseDom.destroy(this.value);\n } else\n if (this.value instanceof Listener) {\n // Deattach this Listener\n this.value.deattach();\n }\n }\n\n\n clone(target, source) {\n const out = {};\n\n for (const i in target) {\n out[i] = target[i];\n }\n for (const i in source) {\n out[i] = source[i];\n }\n\n return out;\n }\n\n setPartialState(path, value, source) {\n const target = {};\n if (path.length) {\n target[path[0]] =\n path.length > 1\n ? this.setPartialState(path.slice(1), value, source[path[0]])\n : value;\n return this.clone(source, target);\n }\n return value;\n }\n\n /**\n * Updates state value\n * @param {*} value\n */\n updateValue(value) {\n const source = this.component.state[this.key];\n return this.component.setState({\n [this.key]: this.setPartialState(this.path, value, source),\n });\n }\n\n extractListeners(value) {\n // if (this.value instanceof Listener && value instanceof Listener) {\n // console.log('middle')\n // } else\n if (value instanceof Listener) {\n // if (this.value instanceof Listener) {\n // this.value.processValue = value.processValue;\n // // this.value = value;\n // this.handleUpdate(value.getValue(value.component.state[value.key]));\n // console.log(value, value.getValue(value.component.state[value.key]));\n // value.deattach();\n // }\n // value.component.addListener(value.key, value, value.depth);\n // value.handleUpdate = () => {\n // console.log('inner handler')\n // }\n const tempListener = {\n depth: value.depth,\n attached: true,\n processValue: value => value,\n handleUpdate: () => {\n if (this.component) {\n this.handleUpdate(this.getValue(this.component.state[this.key]));\n }\n tempListener.attached = false;\n },\n changeListener: () => {},\n };\n this.addedListeners.push(tempListener);\n value.component.addListener(value.key, tempListener, value.depth);\n // value.init()\n // value.handleUpdate = () => {\n // console.log('inner handler')\n // }\n // value.onValueChange((v) => {\n // this.handleUpdate(this.getValue(this.component.state[this.key]));\n // console.log('me got changed', v)\n // });\n const newValue = value.processValue(\n value.getValue(value.component.state[value.key])\n );\n value.deattach();\n return this.extractListeners(newValue);\n }\n return value;\n\n // return this.processValue(this.getValue(value));\n }\n\n /**\n * @param {*} value\n */\n handleUpdate(value) {\n const newValue = this.processValue(this.getValue(value));\n // if (this.value instanceof Listener && newValue instanceof Listener) {\n // this.value.processValue = newValue.processValue;\n // // this.value = newValue;\n // this.value.handleUpdate(newValue.component.state[newValue.key]);\n // console.log(newValue, newValue.getValue(newValue.component.state[newValue.key]));\n // newValue.deattach();\n // } else\n if (newValue instanceof Listener) {\n // if (this.value instanceof Listener) {\n // this.value.processValue = newValue.processValue;\n // // this.value = newValue;\n // this.value.handleUpdate(newValue.component.state[newValue.key]);\n // console.log(newValue, newValue.getValue(newValue.component.state[newValue.key]));\n // newValue.deattach();\n // } else {\n for (let i = 0; i < this.addedListeners.length; i++) {\n this.addedListeners[i].attached = false;\n }\n this.addedListeners = [];\n this.value = this.extractListeners(newValue);\n this.changeListener(this.value);\n // }\n // // console.log(this.value.processValue('P'), newValue.processValue('A'));\n // // console.log(this.extractListeners(newValue));\n // // newValue.handleUpdate(newValue.component.state[newValue.key]);\n // // this.value = newValue;\n // // this.value.processValue = newValue.processValue;\n // this.value = this.extractListeners(newValue);\n // this.changeListener(this.value);\n // // this.value.processValue = newValue.processValue;\n // // // this.value = newValue;\n // // this.value.handleUpdate(newValue.component.state[newValue.key]);\n // // console.log(newValue, newValue.getValue(newValue.component.state[newValue.key]));\n // // newValue.deattach();\n } else {\n this.unlink();\n this.value = newValue;\n this.changeListener(this.value);\n }\n }\n\n /**\n * @param {*} source\n * @returns {*}\n */\n getValue(source) {\n let i = 0;\n while (i < this.path.length) {\n if (source === null\n || (!source[this.path[i]]\n && typeof source[this.path[i]] !== 'number')) {\n source = null;\n } else {\n source = source[this.path[i]];\n }\n i += 1;\n }\n return source;\n }\n\n /**\n * @param {number} depth\n * @returns {Listener}\n */\n applyDepth(depth) {\n this.depth = depth;\n return this;\n }\n\n /**\n * @param {function(*)} changeListener\n */\n onValueChange(changeListener) {\n this.changeListener = changeListener;\n this.changeListener(this.value);\n }\n\n /**\n * @param {function(*): *} processValue\n * @returns {function(*): *}\n */\n process(processValue) {\n this.processValue = processValue;\n return this;\n }\n\n deattach() {\n this.component = null;\n this.attached = false;\n this.key = null;\n this.childPath = null;\n this.path = null;\n this.unlink();\n this.value = null;\n this.changeListener = () => {};\n this.processValue = () => {};\n }\n}\n","\n/**\n * Append dom node to dom tree (after - (true) should append after 'to' element\n * or (false) inside it)\n * @param {HTMLElement} node\n * @param {HTMLElement} to\n * @param {Boolean} after\n * @returns {HTMLElement}\n */\nconst append = (node, to, after) => {\n if (after && to) {\n if (to.parentNode) {\n to.parentNode.insertBefore(node, to);\n // if (!to.nextSibling) {\n // to.parentNode.appendChild(node);\n // } else {\n // to.parentNode.insertBefore(node, to.nextSibling || to);\n // }\n }\n return node;\n }\n\n return to.appendChild(node);\n};\n\nexport default append;\n","import mount from '../mount';\n\nconst getLast = (child) => {\n if (child.$redirect && child.$redirect[child.$redirect.length - 1]) {\n return getLast(child.$redirect[child.$redirect.length - 1]);\n }\n\n // if (child.children && child.children.length > 0) {\n // return child.children;\n // }\n\n return child;\n};\n\n/**\n * @param {Structure} child\n */\nconst mountChildren = (child, isSvg, depth = 0) => {\n if (!child) return;\n\n if (child.$redirect && child.$redirect.length > 0) {\n mountChildren(getLast(child), isSvg, depth + 1);\n } else if (child.children && child.children.length > 0) {\n if (child.html && child.html.length === 1) {\n mount(child.children,\n child.html[0],\n child.html[0].nodeType !== 1,\n child.$isSvg,\n child.$depth);\n } else {\n mount(child.children,\n child.$pointer,\n true,\n child.$isSvg,\n child.$depth);\n }\n }\n};\n\nexport default mountChildren;\n","\n/**\n * @param {string} value\n * @returns {HTMLElement}\n */\nconst textNode = value => (\n document.createTextNode(\n (typeof value === 'object'\n ? JSON.stringify(value)\n : value)\n )\n);\n\nexport default textNode;\n","// import Component from './component/Component';\nimport Listener from './listen/Listener';\nimport flatten from './utils/flatten';\nimport filterNode from './r/utils/filterNode';\nimport append from './r/utils/append';\nimport mountChildren from './r/mountChildren';\nimport textNode from './r/utils/textNode';\nimport patch from './r/patch';\n\n/**\n * Appends structure[] to dom node\n * @param {*} component\n * @param {string} id\n * @param {boolean} isSvg\n * @param {number} depth\n * @returns {HTMLElement|Node}\n */\nconst mount = (raw, parent, after = false, isSvg = false, depth = 0) => {\n parent = typeof parent === 'string' ? document.getElementById(parent) : parent;\n let nodes = flatten([raw]).map(filterNode);\n\n // console.log(1, 'MOUNT')\n\n for (var i = 0; i < nodes.length; i++) {\n const ni = i;\n const nn = nodes[i];\n\n // console.log(2, nodes[i])\n if (nn instanceof Node) {\n append(nn, parent, after);\n } else\n if (nn && typeof nn.render === 'function') {\n // nn.$pointer = text('[pointer]');\n nn.$pointer = textNode('');\n append(nn.$pointer, parent, after);\n\n nodes[i].render(rendered => {\n // console.log(3, rendered)\n\n // Abort! Pointer was destroyed\n if (nn.$pointer === false) return false;\n\n for (var n = 0; n < rendered.length; n++) {\n if (nn.$pointer) {\n append(rendered[n], nn.$pointer, true);\n } else {\n append(rendered[n], parent, after);\n }\n }\n\n mountChildren(nn, nn.$isSvg, depth + 1);\n }, nn, depth, isSvg);\n }\n\n // if (!nn.html) {\n // nn.$pointer = text('[pointer]');\n // append(nn.$pointer, parent, after);\n // }\n }\n\n return nodes;\n}\n\nexport default mount;\n","/**\n * @param {*} query\n * @returns {Node}\n */\nconst getElementFromQuery = (query, isSvg) => {\n if (typeof query === 'string' || typeof query === 'number')\n return query !== 'template'\n ? isSvg || query === 'svg'\n ? document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n query\n )\n : document.createElement(query)\n : document.createDocumentFragment();\n console.warn(\n '[Radi.js] Warn: Creating a JSX element whose query is not of type string, automatically converting query to string.'\n );\n return document.createElement(query.toString());\n};\n\nexport default getElementFromQuery;\n","import filterNode from './filterNode';\nimport Structure from '../Structure';\nimport flatten from '../../utils/flatten';\n\n/**\n * @param {*[]} raw\n * @param {HTMLElement} parent\n * @param {string} raw\n * @returns {HTMLElement}\n */\nconst explode = (raw, parent, next, depth = 0, isSvg) => {\n let nodes = flatten([raw]).map(filterNode);\n // console.log('EXPLODE', nodes)\n\n // console.log('explode', {parent, nodes})\n\n for (var i = 0; i < nodes.length; i++) {\n if ((nodes[i] instanceof Structure || nodes[i].isStructure) && !nodes[i].html) {\n // let pp = depth === 0 ? parent : nodes[i];\n // let pp = parent;\n // console.log('EXPLODE 1', parent.$depth, depth, parent.$redirect, nodes[i].$redirect)\n if (parent.children.length <= 0) {\n if (!parent.$redirect) {\n parent.$redirect = [nodes[i]];\n } else {\n parent.$redirect.push(nodes[i]);\n }\n }\n\n if (!parent.$redirect && nodes[i].children) {\n parent.children = parent.children.concat(nodes[i].children);\n }\n\n if (typeof nodes[i].render === 'function') {\n const n = i;\n nodes[i].render(v => {\n // if (parent.children.length <= 0) {\n // if (!parent.$redirect) {\n // parent.$redirect = [nodes[n]];\n // } else {\n // parent.$redirect.push(nodes[n]);\n // }\n // }\n // console.log('EXPLODE 2', nodes[n], v, parent.$depth, nodes[n].$depth)\n next(v);\n // nodes[n].mount();\n }, nodes[i], depth + 1, isSvg);\n }\n }\n }\n\n return;\n}\n\nexport default explode;\n","/**\n * @param {*} value\n * @return {*}\n */\nconst parseValue = value =>\n typeof value === 'number' && !Number.isNaN(value) ? `${value}px` : value;\n\nexport default parseValue;\n","/* eslint-disable no-continue */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-param-reassign */\n/* eslint-disable no-multi-assign */\n\nimport Listener from '../listen/Listener';\nimport parseValue from './utils/parseValue';\n\n/**\n * @param {Structure} structure\n * @param {object} styles\n * @param {object} oldStyles\n * @returns {object}\n */\nconst setStyles = (structure, styles = {}, oldStyles = {}) => {\n if (!structure.html || !structure.html[0]) return styles;\n const element = structure.html[0];\n\n // Handle Listeners\n if (styles instanceof Listener) {\n if (typeof structure.$styleListeners.general !== 'undefined') {\n return element.style;\n }\n structure.$styleListeners.general = styles;\n structure.$styleListeners.general.applyDepth(structure.depth).init();\n\n structure.$styleListeners.general.onValueChange(value => {\n setStyles(structure, value, {});\n });\n\n return element.style;\n }\n\n if (typeof styles === 'string') {\n element.style = styles;\n return element.style;\n }\n\n const toRemove = Object.keys(oldStyles)\n .filter(key => typeof styles[key] === 'undefined');\n\n for (const style in styles) {\n if (styles.hasOwnProperty(style)) {\n // Skip if styles are the same\n if (typeof oldStyles !== 'undefined' && oldStyles[style] === styles[style]) continue;\n\n // Need to remove falsy style\n if (!styles[style] && typeof styles[style] !== 'number') {\n element.style[style] = null;\n continue;\n }\n\n // Handle Listeners\n if (styles[style] instanceof Listener) {\n if (typeof structure.$styleListeners[style] !== 'undefined') continue;\n structure.$styleListeners[style] = styles[style];\n structure.$styleListeners[style].applyDepth(structure.depth).init();\n\n structure.$styleListeners[style].onValueChange(value => {\n setStyles(structure, {\n [style]: value,\n }, {});\n });\n\n styles[style] = structure.$styleListeners[style].value;\n continue;\n }\n\n element.style[style] = parseValue(styles[style]);\n }\n }\n\n for (let i = 0; i < toRemove.length; i++) {\n element.style[toRemove[i]] = null;\n }\n\n return element.style;\n};\n\nexport default setStyles;\n","/**\n * @param {*} value\n * @return {*}\n */\nconst parseClass = value => {\n if (Array.isArray(value)) {\n return value.filter(item => item).join(' ')\n }\n return value;\n}\n\nexport default parseClass;\n","/* eslint-disable no-continue */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-param-reassign */\n\nimport setStyles from './setStyles';\nimport Listener from '../listen/Listener';\nimport parseClass from './utils/parseClass';\nimport GLOBALS from '../consts/GLOBALS';\n// import AttributeListener from './utils/AttributeListener';\n\n/**\n * @param {Structure} structure\n * @param {object} propsSource\n * @param {object} oldPropsSource\n */\nconst setAttributes = (structure, propsSource = {}, oldPropsSource = {}) => {\n const props = propsSource || {};\n const oldProps = oldPropsSource || {};\n\n if (!structure.html || !structure.html[0]) return structure;\n const element = structure.html[0];\n\n if (!(element instanceof Node && element.nodeType !== 3)) return structure;\n\n const toRemove = Object.keys(oldProps)\n .filter(key => typeof props[key] === 'undefined');\n\n for (const prop in props) {\n if (props.hasOwnProperty(prop)) {\n // Skip if proprs are the same\n if (typeof oldProps !== 'undefined' && oldProps[prop] === props[prop]) continue;\n\n // Need to remove falsy attribute\n if (!props[prop] && typeof props[prop] !== 'number') {\n element.removeAttribute(prop);\n continue;\n }\n\n if ((prop === 'value' || prop === 'model') && !(props[prop] instanceof Listener)) {\n if (/(checkbox|radio)/.test(element.getAttribute('type'))) {\n element.checked = props[prop];\n } else {\n element.value = props[prop];\n }\n }\n\n // Handle Listeners\n if (props[prop] instanceof Listener) {\n if (typeof structure.$attrListeners[prop] !== 'undefined') continue;\n structure.$attrListeners[prop] = props[prop];\n props[prop].applyDepth(structure.depth).init();\n\n if (prop.toLowerCase() === 'model') {\n if (/(checkbox|radio)/.test(element.getAttribute('type'))) {\n element.addEventListener('change', (e) => {\n structure.$attrListeners[prop].updateValue(e.target.checked);\n });\n } else {\n element.addEventListener('input', (e) => {\n structure.$attrListeners[prop].updateValue(e.target.value);\n });\n }\n }\n\n structure.$attrListeners[prop].onValueChange(value => {\n setAttributes(structure, {\n [prop]: value,\n }, {});\n // props[prop] = value;\n });\n\n // structure.setProps(Object.assign(structure.data.props, {\n // [prop]: props[prop].value,\n // }));\n props[prop] = structure.$attrListeners[prop].value;\n continue;\n }\n\n if (typeof GLOBALS.CUSTOM_ATTRIBUTES[prop] !== 'undefined') {\n const { allowedTags } = GLOBALS.CUSTOM_ATTRIBUTES[prop];\n\n if (!allowedTags || (\n allowedTags\n && allowedTags.length > 0\n && allowedTags.indexOf(element.localName) >= 0\n )) {\n if (typeof GLOBALS.CUSTOM_ATTRIBUTES[prop].caller === 'function') {\n GLOBALS.CUSTOM_ATTRIBUTES[prop].caller(element, props[prop]);\n }\n if (!GLOBALS.CUSTOM_ATTRIBUTES[prop].addToElement) continue;\n }\n }\n\n\n if (prop.toLowerCase() === 'style') {\n if (typeof props[prop] === 'object') {\n setStyles(structure, props[prop], (oldProps && oldProps.style) || {});\n // props[prop] = structure.setStyles(props[prop], (oldProps && oldProps.style) || {});\n } else {\n element.style = props[prop];\n }\n continue;\n }\n\n if (prop.toLowerCase() === 'class' || prop.toLowerCase() === 'classname') {\n element.setAttribute('class', parseClass(props[prop]));\n continue;\n }\n\n if (prop.toLowerCase() === 'loadfocus') {\n element.onload = (el) => {\n setTimeout(() => {\n el.focus();\n }, 10);\n };\n continue;\n }\n\n if (prop.toLowerCase() === 'html') {\n element.innerHTML = props[prop];\n continue;\n }\n\n // Handles events 'on'\n if (prop.substring(0, 2).toLowerCase() === 'on' && typeof props[prop] === 'function') {\n const fn = props[prop];\n if (prop.substring(0, 8).toLowerCase() === 'onsubmit') {\n element[prop] = (e) => {\n if (props.prevent) {\n e.preventDefault();\n }\n\n const data = [];\n const inputs = e.target.elements || [];\n for (const input of inputs) {\n if ((input.name !== ''\n && (input.type !== 'radio' && input.type !== 'checkbox'))\n || input.checked) {\n const item = {\n name: input.name,\n el: input,\n type: input.type,\n default: input.defaultValue,\n value: input.value,\n set(val) {\n structure.el.value = val;\n },\n reset(val) {\n structure.el.value = val;\n structure.el.defaultValue = val;\n },\n };\n data.push(item);\n if (!data[item.name]) {\n Object.defineProperty(data, item.name, {\n value: item,\n });\n }\n }\n }\n\n return fn(e, data);\n };\n } else {\n element[prop] = (e, ...args) => fn(e, ...args);\n }\n continue;\n }\n\n element.setAttribute(prop, props[prop]);\n }\n }\n\n for (let i = 0; i < toRemove.length; i++) {\n element.removeAttribute(toRemove[i]);\n }\n\n structure.props = props;\n\n return structure;\n};\n\nexport default setAttributes;\n","/* eslint-disable no-restricted-syntax */\n\n// import GLOBALS from '../consts/GLOBALS';\nimport Component from '../component/Component';\nimport flatten from '../utils/flatten';\nimport patch from './patch';\nimport getElementFromQuery from './utils/getElementFromQuery';\nimport textNode from './utils/textNode';\nimport explode from './utils/explode';\nimport filterNode from './utils/filterNode';\nimport isComponent from '../component/utils/isComponent';\nimport Listener from '../listen/Listener';\nimport setAttributes from './setAttributes';\n\n/**\n * @param {*} query\n * @param {object} props\n * @param {...*} children\n * @param {number} depth\n */\nclass Structure {\n constructor(query, props = {}, children, depth = 0) {\n // console.log('H', query, children)\n this.query = query;\n this.props = Boolean !== props ? props : {};\n if (isComponent(query) || query instanceof Component) {\n this.$compChildren = flatten(children || []).map(filterNode);\n this.children = [];\n } else {\n this.children = flatten(children || []).map(filterNode);\n this.$compChildren = [];\n }\n this.html = null;\n this.$attrListeners = [];\n this.$styleListeners = [];\n this.$pointer = null;\n this.$component = null;\n this.$listener = null;\n this.$redirect = null;\n this.$destroyed = false;\n this.$isSvg = query === 'svg';\n this.$depth = depth;\n }\n\n mount() {\n this.$destroyed = false;\n // console.warn('[mounted]', this)\n\n if (this.$component instanceof Component) {\n this.$component.mount();\n }\n }\n\n destroy(childrenToo = true) {\n if (this.$destroyed) return false;\n // console.warn('[destroyed]', this, this.html, this.$redirect)\n\n for (const l in this.$styleListeners) {\n if (this.$styleListeners[l]\n && typeof this.$styleListeners[l].deattach === 'function') {\n this.$styleListeners[l].deattach();\n }\n }\n\n for (const l in this.$attrListeners) {\n if (this.$attrListeners[l]\n && typeof this.$attrListeners[l].deattach === 'function') {\n this.$attrListeners[l].deattach();\n }\n }\n\n if (this.$redirect) {\n for (let i = 0; i < this.$redirect.length; i++) {\n if (typeof this.$redirect[i].destroy === 'function') {\n this.$redirect[i].destroy();\n }\n }\n }\n\n if (childrenToo && this.children) {\n for (let i = 0; i < this.children.length; i++) {\n if (typeof this.children[i].destroy === 'function') {\n this.children[i].destroy();\n }\n }\n }\n\n if (this.html) {\n const items = this.html;\n for (let i = 0; i < this.html.length; i++) {\n if (items[i].parentNode) {\n const destroyHTML = () => items[i].parentNode.removeChild(items[i]);\n if (typeof items[i].beforedestroy === 'function') {\n items[i].beforedestroy(destroyHTML);\n } else {\n destroyHTML();\n }\n }\n }\n }\n\n if (this.$component instanceof Component) {\n this.$component.destroy();\n }\n\n if (this.$listener instanceof Listener) {\n this.$listener.deattach();\n }\n\n if (this.$pointer && this.$pointer.parentNode) {\n this.$pointer.parentNode.removeChild(this.$pointer);\n }\n this.$pointer = null;\n this.$redirect = null;\n this.$component = null;\n this.render = () => {};\n this.html = null;\n this.$destroyed = true;\n return true;\n }\n\n render(next, parent, depth = 0, isSvg = false) {\n // console.log('RENDER', isSvg, parent, parent && parent.$isSvg)\n this.$depth = Math.max(this.$depth, depth);\n this.$isSvg = isSvg || (parent && parent.$isSvg) || this.query === 'svg';\n\n if (this.query === '#text') {\n this.html = [textNode(this.props)];\n return next(this.html);\n }\n\n if (typeof this.query === 'string' || typeof this.query === 'number') {\n this.html = [getElementFromQuery(this.query, this.$isSvg)];\n\n setAttributes(this, this.props, {});\n\n return next(this.html);\n }\n\n if (this.query instanceof Listener) {\n if (!this.$listener) {\n this.$listener = this.query.applyDepth(this.$depth).init();\n this.mount();\n }\n return this.query.onValueChange(v => {\n if (this.html) {\n const tempParent = this.html[0];\n\n if (this.$pointer) {\n this.$redirect = patch(this.$redirect, v, this.$pointer,\n true, this.$isSvg, this.$depth + 1);\n } else {\n this.$redirect = patch(this.$redirect, v, tempParent,\n true, this.$isSvg, this.$depth + 1);\n }\n\n // let a = {\n // $redirect: [],\n // children: [],\n // };\n //\n // explode(v, a, output => {\n // // this.html = output;\n // if (this.$pointer) {\n // this.$redirect = patch(this.$redirect, a.$redirect,\n // this.$pointer, true, this.$isSvg, this.$depth + 1);\n // } else {\n // this.$redirect = patch(this.$redirect, a.$redirect,\n // tempParent, true, this.$isSvg, this.$depth + 1);\n // }\n // // next(output);\n // }, this.$depth + 1, this.$isSvg);\n } else {\n explode(v, parent || this, output => {\n // console.warn('change HTML', this.html)\n this.html = output;\n next(output);\n }, this.$depth + 1, this.$isSvg);\n }\n });\n }\n\n if (this.query instanceof Promise\n || this.query.constructor.name === 'LazyPromise') {\n return this.query.then(v => {\n const normalisedValue = v.default || v;\n explode(normalisedValue, parent || this, output => {\n this.html = output;\n next(output);\n }, this.$depth, this.$isSvg);\n });\n }\n\n if (this.query instanceof Component\n && typeof this.query.render === 'function') {\n this.$component = this.query;\n return explode(this.$component.render(), parent || this, v => {\n this.html = v;\n next(v);\n this.mount();\n }, this.$depth, this.$isSvg);\n }\n\n if (isComponent(this.query)) {\n if (!this.$component) {\n this.$component =\n new this.query(this.$compChildren).setProps(this.props); // eslint-disable-line\n }\n if (typeof this.$component.render === 'function') {\n explode(this.$component.render(), parent || this, v => {\n this.html = v;\n next(v);\n }, this.$depth, this.$isSvg);\n this.mount();\n }\n return null;\n }\n\n if (typeof this.query === 'function') {\n return explode(this.query(this.props), parent || this, v => {\n this.html = v;\n next(v);\n }, this.$depth, this.$isSvg);\n }\n\n return next(textNode(this.query));\n }\n\n isStructure() {\n return true;\n }\n}\n\nexport default Structure;\n","/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-continue */\n/* eslint-disable no-multi-assign */\n\nimport flatten from '../utils/flatten';\nimport filterNode from './utils/filterNode';\n// import Listener from '../listen/Listener';\n// import Component from '../component/Component';\nimport mount from '../mount';\nimport append from './utils/append';\n// import replaceWith from './utils/replaceWith';\nimport textNode from './utils/textNode';\nimport mountChildren from './mountChildren';\nimport Structure from './Structure';\nimport setAttributes from './setAttributes';\n\n// const hasRedirect = item => (\n// item && item.$redirect\n// );\n\nconst patch = (rawfirst, rawsecond, parent,\n after = false, isSvg = false, depth = 0) => {\n const first = flatten([rawfirst]);\n const second = flatten([rawsecond]).map(filterNode);\n\n const length = Math.max(first.length, second.length);\n\n for (let i = 0; i < length; i++) {\n // debugger\n // const nn = i;\n // first[i] = first[i].$redirect || first[i];\n if (typeof first[i] === 'undefined') {\n // mount\n mount(second[i], parent, after, isSvg, depth);\n continue;\n }\n\n if (typeof second[i] === 'undefined') {\n // remove\n if (typeof first[i].destroy === 'function') {\n first[i].destroy();\n }\n continue;\n }\n\n second[i].$depth = depth;\n\n if ((first[i] instanceof Structure || first[i].isStructure)\n && (second[i] instanceof Structure || second[i].isStructure)\n && first[i] !== second[i]) {\n // if (second[i].$redirect2) {\n // second[i] = patch(\n // // first[i].$redirect || first[i],\n // hasRedirect(first[i]) || first[i],\n // second[i].$redirect[second[i].$redirect.length - 1] || second[i],\n // parent,\n // after,\n // isSvg,\n // depth\n // );\n // continue;\n // }\n\n if (first[i].html\n && first[i].query === '#text'\n && second[i].query === '#text') {\n for (let n = 0; n < first[i].html.length; n++) {\n if (first[i].props !== second[i].props) {\n first[i].html[n].textContent = first[i].props = second[i].props;\n }\n }\n\n second[i].html = first[i].html;\n first[i].html = null;\n\n if (first[i].$pointer) {\n if (second[i].$pointer && second[i].$pointer.parentNode) {\n second[i].$pointer.parentNode.removeChild(second[i].$pointer);\n }\n second[i].$pointer = first[i].$pointer;\n first[i].$pointer = null;\n }\n\n first[i].destroy();\n continue;\n }\n\n\n if (first[i].html\n && typeof first[i].query === 'string'\n && typeof second[i].query === 'string'\n && first[i].query === second[i].query) {\n // for (var n = 0; n < first[i].html.length; n++) {\n // if (first[i].props !== second[i].props) {\n // // first[i].html[n].textContent = second[i].props;\n // }\n // }\n\n second[i].html = first[i].html;\n first[i].html = null;\n\n if (first[i].$pointer) {\n if (second[i].$pointer && second[i].$pointer.parentNode) {\n second[i].$pointer.parentNode.removeChild(second[i].$pointer);\n }\n second[i].$pointer = first[i].$pointer;\n first[i].$pointer = null;\n }\n\n setAttributes(second[i], second[i].props, first[i].props);\n // mountChildren(second[i], second[i].$isSvg, second[i].$depth + 1);\n\n if (second[i].html[0]\n && second[i].children\n && second[i].children.length > 0) {\n second[i].children = patch(first[i].children,\n second[i].children,\n second[i].html[0],\n false,\n second[i].$isSvg,\n second[i].$depth + 1);\n }\n first[i].destroy();\n\n continue;\n }\n\n // maybe merge\n const n1 = first[i];\n const n2 = second[i];\n\n // n2.$pointer = textNode('[pointer2]');\n n2.$pointer = textNode('');\n append(n2.$pointer, parent, after);\n\n n2.render(rendered => {\n if (n1.$pointer) {\n if (n2.$pointer && n2.$pointer.parentNode) {\n n2.$pointer.parentNode.removeChild(n2.$pointer);\n }\n n2.$pointer = n1.$pointer;\n n1.$pointer = null;\n }\n\n for (let n = 0; n < rendered.length; n++) {\n if ((n1.html && !n1.html[i]) || !n1.html) {\n append(rendered[n], n2.$pointer, true);\n } else {\n append(rendered[n], n1.html[i], true);\n }\n }\n\n mountChildren(n2, isSvg, depth + 1);\n\n n1.destroy(false);\n }, n2, depth, isSvg);\n }\n }\n\n return second;\n};\n\nexport default patch;\n","/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-continue */\n/* eslint-disable no-param-reassign */\n// -- we need those for..in loops for now!\n\nimport GLOBALS from '../consts/GLOBALS';\nimport generateId from '../utils/generateId';\nimport PrivateStore from './utils/PrivateStore';\n// import fuseDom from '../r/utils/fuseDom';\nimport clone from '../utils/clone';\nimport skipInProductionAndTest from '../utils/skipInProductionAndTest';\nimport Listener from '../listen/Listener';\n// import mount from '../mount';\nimport patch from '../r/patch';\n\nconst capitalise = lower => lower.charAt(0).toUpperCase() + lower.substr(1);\n\nexport default class Component {\n /**\n * @param {Node[]|*[]} [children]\n * @param {object} [o.props]\n */\n constructor(children, props) {\n this.addNonEnumerableProperties({\n $id: generateId(),\n $name: this.constructor.name,\n $config: (typeof this.config === 'function') ? this.config() : {\n listen: true,\n },\n __$events: {},\n __$privateStore: new PrivateStore(),\n });\n\n // TODO: Remove this! Deprecated!\n if (typeof this.on !== 'function'\n || (typeof this.on === 'function' && typeof this.on() === 'object')) {\n throw new Error('[Radi.js] Using `on.eventName()` is deprecated. Please use `onEventName()`.');\n }\n\n this.children = [];\n\n // Links headless components\n for (const key in GLOBALS.HEADLESS_COMPONENTS) {\n if (this[key] && typeof this[key].on === 'function') {\n this[key].on('update', () => this.setState());\n }\n }\n\n this.state = typeof this.state === 'function'\n ? this.state()\n : (this.state || {});\n\n skipInProductionAndTest(() => Object.freeze(this.state));\n\n if (children) this.setChildren(children);\n if (props) this.setProps(props);\n }\n\n /**\n * @returns {HTMLElement}\n */\n render() {\n if (typeof this.view !== 'function') return null;\n return this.html = this.view();\n }\n\n /**\n * @param {object} props\n * @returns {Component}\n */\n setProps(props) {\n const newState = {};\n // Self is needed cause of compilation\n const self = this;\n\n for (const key in props) {\n if (typeof props[key] === 'function' && key.substr(0, 2) === 'on') {\n self.on(key.substring(2, key.length), props[key]);\n } else\n if (props[key] instanceof Listener) {\n newState[key] = props[key].init().value;\n props[key].changeListener = (value => {\n self.setState({\n [key]: value,\n });\n });\n } else {\n newState[key] = props[key];\n }\n }\n this.setState(newState);\n return this;\n }\n\n /**\n * @param {Node[]|*[]} children\n */\n setChildren(children) {\n this.children = children;\n this.setState();\n for (let i = 0; i < this.children.length; i++) {\n if (typeof this.children[i].on === 'function') {\n this.children[i].on('update', () => this.setState());\n }\n }\n return this;\n }\n\n /**\n * @private\n * @param {object} obj\n */\n addNonEnumerableProperties(obj) {\n for (const key in obj) {\n if (typeof this[key] !== 'undefined') continue;\n Object.defineProperty(this, key, {\n value: obj[key],\n });\n }\n }\n\n /**\n * @param {string} key\n * @param {Listener} listener\n * @param {number} depth\n */\n addListener(key, listener, depth) {\n this.__$privateStore.addListener(key, listener, depth);\n }\n\n mount() {\n this.trigger('mount');\n }\n\n destroy() {\n // if (this.html) {\n // for (var i = 0; i < this.html.length; i++) {\n // if (this.html[i].parentNode) {\n // this.html[i].parentNode.removeChild(this.html[i]);\n // }\n // }\n // }\n this.html = null;\n this.trigger('destroy');\n this.__$privateStore.removeListeners();\n }\n\n // TODO: Remove this! Deprecated!\n when() {\n throw new Error('[Radi.js] Using `.when(\\'Event\\')` is deprecated. Use `.on(\\'Event\\')` instead.');\n }\n\n /**\n * @param {string} key\n * @param {function} fn\n * @returns {function}\n */\n on(key, fn) {\n if (typeof this.__$events[key] === 'undefined') this.__$events[key] = [];\n this.__$events[key].push(fn);\n return fn;\n }\n\n /**\n * @param {string} key\n * @param {*} value\n */\n trigger(key, ...args) {\n const event = this[`on${capitalise(key)}`];\n\n if (typeof event === 'function') {\n event.call(this, ...args);\n }\n\n if (typeof this.__$events[key] !== 'undefined') {\n for (const i in this.__$events[key]) {\n this.__$events[key][i].call(this, ...args);\n }\n }\n }\n\n /**\n * @param {object} newState\n * @param {string} actionName\n */\n setState(newState, actionName) {\n if (typeof newState === 'object') {\n let oldstate = this.state;\n\n skipInProductionAndTest(() => oldstate = clone(this.state));\n\n this.state = Object.assign(oldstate, newState);\n\n skipInProductionAndTest(() => Object.freeze(this.state));\n\n if (this.$config.listen) {\n this.__$privateStore.setState(newState);\n }\n }\n\n if (!this.$config.listen && typeof this.view === 'function' && this.html) {\n this.html = patch(this.html, this.view());\n }\n\n if (typeof actionName === 'string' && typeof this[actionName] === 'function') {\n this.trigger(`after${actionName[0].toUpperCase()}${actionName.substr(1)}`);\n }\n\n // if (typeof newState === 'object') {\n // let oldstate = this.state;\n //\n // skipInProductionAndTest(() => oldstate = clone(this.state));\n //\n // this.state = Object.assign(oldstate, newState);\n //\n // skipInProductionAndTest(() => Object.freeze(this.state));\n //\n // if (this.$config.listen) {\n // this.__$privateStore.setState(newState);\n // }\n // }\n //\n // if (!this.$config.listen && typeof this.view === 'function' && this.html) {\n // fuseDom.fuse(this.html, this.view());\n // }\n this.trigger('update');\n\n return newState;\n }\n\n /**\n * @returns {boolean}\n */\n static isComponent() {\n return true;\n }\n}\n","import Component from '../Component';\n\n/**\n * @param {*} value\n * @returns {Boolean}\n */\nconst isComponent = value => {\n if (value) {\n if (value.prototype instanceof Component) {\n return true;\n }\n\n if (value.isComponent) {\n return true;\n }\n }\n\n return false;\n}\n\nexport default isComponent;\n","import flatten from '../../utils/flatten';\nimport isComponent from '../../component/utils/isComponent';\nimport Component from '../../component/Component';\nimport r from '../index.js';\nimport Listener from '../../listen/Listener';\n\n/**\n * @param {function} value\n * @returns {object}\n */\nconst filterNode = value => {\n\n if (Array.isArray(value)) {\n return value.map(filterNode);\n }\n\n if (typeof value === 'string' || typeof value === 'number') {\n return r('#text', value);\n }\n\n if (!value || typeof value === 'boolean') {\n return r('#text', '');\n }\n\n if (value instanceof Listener) {\n return r(value);\n }\n\n if (isComponent(value) || value instanceof Component) {\n return r(value);\n }\n\n if (typeof value === 'function') {\n return r(value);\n }\n\n if (value instanceof Promise || value.constructor.name === 'LazyPromise') {\n return r(value);\n }\n\n return value;\n}\n\nexport default filterNode;\n","// import Component from '../component/Component';\nimport GLOBALS from '../consts/GLOBALS';\nimport flatten from '../utils/flatten';\nimport filterNode from './utils/filterNode';\nimport Structure from './Structure';\nimport patch from './patch';\n\n/**\n * @param {*} query\n * @param {object} props\n * @param {...*} children\n * @returns {object}\n */\nconst r = (query, props, ...children) => {\n if (typeof GLOBALS.CUSTOM_TAGS[query] !== 'undefined') {\n return GLOBALS.CUSTOM_TAGS[query].onmount(\n props || {},\n (children && flatten([children]).map(filterNode)) || [],\n filterNode,\n v => (GLOBALS.CUSTOM_TAGS[query].saved = v),\n ) || null;\n }\n\n if (query === 'await') {\n let output = null;\n\n if (props.src && props.src instanceof Promise) {\n props.src.then(v => {\n const nomalizedData = filterNode(\n typeof props.transform === 'function'\n ? props.transform(v)\n : v\n );\n\n if (output) {\n output = patch(output, nomalizedData, output.html[0].parentNode);\n } else {\n output = nomalizedData;\n }\n }).catch(error => {\n const placerror = filterNode(\n typeof props.error === 'function'\n ? props.error(error)\n : props.error\n );\n\n if (output) {\n output = patch(output, placerror, output.html[0].parentNode);\n } else {\n output = placerror;\n }\n });\n }\n\n if (!output) {\n output = filterNode(props.placeholder);\n }\n\n return output;\n }\n\n if (query === 'template') {\n // return flatten([children]).map(filterNode);\n return new Structure('section', props, flatten([children]).map(filterNode));\n }\n\n return new Structure(query, props, flatten([children]).map(filterNode));\n};\n\nexport default r;\n","import Listener from './Listener';\n\n/**\n * The listen function is used for dynamically binding a component property\n * to the DOM. Also commonly imported as 'l'.\n * @param {Component} component\n * @param {...string} path\n * @returns {Listener}\n */\nconst listen = (component, ...path) =>\n new Listener(component, ...path);\n\nexport default listen;\n","import Component from './Component';\nimport GLOBALS from '../consts/GLOBALS';\n\nconst headless = (key, Comp) => {\n // TODO: Validate component and key\n const name = '$'.concat(key);\n const mountedComponent = new Comp();\n mountedComponent.mount();\n Component.prototype[name] = mountedComponent;\n return GLOBALS.HEADLESS_COMPONENTS[name] = mountedComponent;\n};\n\nexport default headless;\n","// Decorator for actions\nconst action = (target, key, descriptor) => {\n const fn = descriptor.value;\n return {\n configurable: true,\n value(...args) {\n return this.setState.call(this, fn.call(this, ...args), key);\n },\n };\n};\n\nexport default action;\n","/* eslint-disable func-names */\n\nconst createWorker = fn => {\n let fire = () => {};\n\n const blob = new window.Blob([`self.onmessage = function(e) {\n self.postMessage((${fn.toString()})(e.data));\n }`], { type: 'text/javascript' });\n\n const url = window.URL.createObjectURL(blob);\n const myWorker = new window.Worker(url);\n\n myWorker.onmessage = e => { fire(e.data, null); };\n myWorker.onerror = e => { fire(null, e.data); };\n\n return arg => new Promise((resolve, reject) => {\n fire = (data, err) => !err ? resolve(data) : reject(data);\n myWorker.postMessage(arg);\n });\n};\n\n// Descriptor for worker\nconst worker = (target, key, descriptor) => {\n const act = descriptor.value;\n\n const promisedWorker = createWorker(act);\n\n descriptor.value = function (...args) {\n promisedWorker(...args).then(newState => {\n this.setState.call(this, newState);\n });\n };\n return descriptor;\n};\n\nexport default worker;\n","\n// Descriptor for subscriptions\nconst subscribe = (container, eventName/* , triggerMount */) =>\n (target, key, descriptor) => {\n let fn = descriptor.value;\n let boundFn = () => {};\n\n if (typeof fn !== 'function') {\n throw new Error(`@subscribe decorator can only be applied to methods not: ${typeof fn}`);\n }\n\n // In IE11 calling Object.defineProperty has a side-effect of evaluating the\n // getter for the property which is being replaced. This causes infinite\n // recursion and an \"Out of stack space\" error.\n let definingProperty = false;\n\n container[eventName] = (...args) => boundFn(...args);\n\n return {\n configurable: true,\n get() {\n if (definingProperty || this === target.prototype || this.hasOwnProperty(key)\n || typeof fn !== 'function') {\n return fn;\n }\n\n boundFn = fn.bind(this);\n\n definingProperty = true;\n Object.defineProperty(this, key, {\n configurable: true,\n get() {\n return boundFn;\n },\n set(value) {\n fn = value;\n delete this[key];\n },\n });\n definingProperty = false;\n return boundFn;\n },\n set(value) {\n fn = value;\n },\n };\n };\n\nexport default subscribe;\n","import GLOBALS from '../consts/GLOBALS';\n\n/**\n * @param {string} tagName\n * @param {function} onmount\n * @param {function} ondestroy\n * @returns {object}\n */\nconst customTag = (tagName, onmount, ondestroy) => GLOBALS.CUSTOM_TAGS[tagName] = {\n name: tagName,\n onmount: onmount || (() => {}),\n ondestroy: ondestroy || (() => {}),\n saved: null,\n};\n\nexport default customTag;\n","import GLOBALS from '../consts/GLOBALS';\n\n/**\n * @param {string} attributeName\n * @param {function} caller\n * @param {object} object\n * @returns {object}\n */\nconst customAttribute = (attributeName, caller, {\n allowedTags,\n addToElement,\n} = {}) => GLOBALS.CUSTOM_ATTRIBUTES[attributeName] = {\n name: attributeName,\n caller,\n allowedTags: allowedTags || null,\n addToElement,\n};\n\nexport default customAttribute;\n","import GLOBALS from '../consts/GLOBALS';\n\nconst remountActiveComponents = () => {\n Object.values(GLOBALS.ACTIVE_COMPONENTS).forEach(component => {\n if (typeof component.onMount === 'function') {\n component.onMount(component);\n }\n });\n};\n\nexport default remountActiveComponents;\n","import customAttribute from '../../r/customAttribute';\n\nconst animate = (target, type, opts, done) => {\n const direct = opts[type];\n if (typeof direct !== 'function') {\n console.warn(`[Radi.js] Animation \\`${type}\\` for node \\`${target.nodeName.toLowerCase}\\` should be function`);\n return;\n }\n\n return direct(target, done);\n};\n\ncustomAttribute('animation', (el, props) => {\n animate(el, 'in', props, () => {});\n el.beforedestroy = done => animate(el, 'out', props, done);\n});\n","/* eslint-disable consistent-return */\n/* eslint-disable no-console */\n\nimport Component from '../component/Component';\nimport headless from '../component/headless';\nimport customTag from '../r/customTag';\nimport mount from '../mount';\nimport listen from '../listen';\nimport r from '../r';\n\nclass Modal extends Component {\n state() {\n return {\n registry: {},\n };\n }\n\n register(name, element) {\n if (typeof this.state.registry[name] !== 'undefined') {\n console.warn(`[Radi.js] Warn: Modal with name \"${name}\" is already registerd!`);\n return;\n }\n\n this.setState({\n registry: Object.assign({}, this.state.registry, {\n [name]: {\n status: false,\n element,\n },\n }),\n });\n }\n\n exists(name) {\n if (typeof this.state.registry[name] === 'undefined') {\n console.warn(`[Radi.js] Warn: Modal with name \"${name}\" is not registerd!`);\n return false;\n }\n\n return true;\n }\n\n open(name) {\n if (!this.exists(name) || this.state.registry[name].status) return;\n\n return this.setState({\n registry: Object.assign({}, this.state.registry, {\n [name]: {\n status: true,\n element: this.state.registry[name].element,\n },\n }),\n });\n }\n\n close(name) {\n if (!this.exists(name) || !this.state.registry[name].status) return;\n\n return this.setState({\n registry: Object.assign({}, this.state.registry, {\n [name]: {\n status: false,\n element: this.state.registry[name].element,\n },\n }),\n });\n }\n\n closeAll() {\n const keys = Object.keys(this.state.registry);\n const registry = keys.reduce((acc, name) => Object.assign(acc, {\n [name]: {\n status: false,\n element: this.state.registry[name].element,\n },\n }), {});\n\n return this.setState({\n registry,\n });\n }\n}\n\nconst $modal = headless('modal', Modal);\n\ncustomTag('modal',\n (props, children, buildNode) => {\n const name = props.name || 'default';\n\n $modal.register(name, null);\n\n if (typeof props.name === 'undefined') {\n console.warn('[Radi.js] Warn: Every tag needs to have `name` attribute!');\n }\n\n mount(listen($modal, 'registry', name)\n .process(v => (\n v.status && r('div',\n { class: 'radi-modal', name },\n r('div', {\n class: 'radi-modal-backdrop',\n onclick: () => $modal.close(name),\n }),\n r('div',\n { class: 'radi-modal-content' },\n ...(children.slice())\n )\n )\n )), document.body);\n\n return buildNode(null);\n }, () => {\n // Destroyed `element`\n }\n);\n","import GLOBALS from './consts/GLOBALS';\nimport r from './r';\nimport listen from './listen';\nimport Component from './component';\nimport headless from './component/headless';\nimport generateId from './utils/generateId';\nimport mount from './mount';\nimport patch from './r/patch';\nimport action from './action';\nimport worker from './action/worker';\nimport subscribe from './action/subscribe';\nimport customTag from './r/customTag';\nimport customAttribute from './r/customAttribute';\nimport remountActiveComponents from './utils/remountActiveComponents';\nimport {} from './custom';\n\nconst Radi = {\n version: GLOBALS.VERSION,\n activeComponents: GLOBALS.ACTIVE_COMPONENTS,\n r,\n listen,\n l: listen,\n worker,\n Component,\n component: Component,\n action,\n subscribe,\n customTag,\n customAttribute,\n headless,\n update: patch,\n patch,\n mount,\n freeze: () => {\n GLOBALS.FROZEN_STATE = true;\n },\n unfreeze: () => {\n GLOBALS.FROZEN_STATE = false;\n remountActiveComponents();\n },\n};\n\n// Pass Radi instance to plugins\nRadi.plugin = (fn, ...args) => fn(Radi, ...args);\n\nif (window) window.Radi = Radi;\nexport default Radi;\n// module.exports = Radi;\n"],"names":["const","let","i","l"],"mappings":"AAAAA,IAAM,OAAO,GAAG;EACd,mBAAmB,EAAE,EAAE;EACvB,YAAY,EAAE,KAAK;EACnB,OAAO,EAAE,OAAO;;EAEhB,iBAAiB,EAAE,EAAE;EACrB,iBAAiB,EAAE,EAAE;EACrB,WAAW,EAAE,EAAE;CAChB,CAAC;;;;;;ACHFA,IAAM,OAAO,GAAG,SAAS,OAAO,CAAC,IAAI,EAAE;EACrC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;CAC/E,CAAC;;ACPF;;;;;AAKAA,IAAM,UAAU,GAAG,MAAM;EACvBC,IAAI,IAAI,GAAG,EAAE,CAAC;EACd,KAAKA,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;IAC3BD,IAAM,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;;IAExC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE;MAC/C,IAAI,IAAI,GAAG,CAAC;KACb;IACD,IAAI,IAAI,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;GAC5E;EACD,OAAO,IAAI,CAAC;CACb,CAAC;;AChBa,IAAM,YAAY,GAC/B,qBAAW,GAAG;EACd,IA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AO,EAAE,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;WAClC,CAAC;UACF,CAAC,CAAC,KAAK;YACL,EAAE,KAAK,EAAE,oBAAoB,EAAE;YAC/B,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;WACtB;SACF;OACF,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;;IAErB,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;GACxB,EAAE,MAAM;;GAER;CACF,CAAC;;AClGFA,IAAM,IAAI,GAAG;EACX,OAAO,EAAE,OAAO,CAAC,OAAO;EACxB,gBAAgB,EAAE,OAAO,CAAC,iBAAiB;EAC3C,CAAC;EACD,MAAM;EACN,CAAC,EAAE,MAAM;EACT,MAAM;EACN,SAAS;EACT,SAAS,EAAE,SAAS;EACpB,MAAM;EACN,SAAS;EACT,SAAS;EACT,eAAe;EACf,QAAQ;EACR,MAAM,EAAE,KAAK;EACb,KAAK;EACL,KAAK;EACL,MAAM,EAAE,MAAM;IACZ,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;GAC7B;EACD,QAAQ,EAAE,MAAM;IACd,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC;IAC7B,uBAAuB,EAAE,CAAC;GAC3B;CACF,CAAC;;;AAGF,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,KAAK,EAAE,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;;AAEjD,IAAI,MAAM,IAAE,MAAM,CAAC,IAAI,GAAG,IAAI,GAAC;AAC/B;;;;"} \ No newline at end of file +{"version":3,"file":"radi.es.js","sources":["../src/consts/GLOBALS.js","../src/utils/flatten.js","../src/utils/generateId.js","../src/component/utils/PrivateStore.js","../src/utils/clone.js","../src/utils/skipInProductionAndTest.js","../src/listen/Listener.js","../src/r/utils/append.js","../src/r/mountChildren.js","../src/r/utils/textNode.js","../src/mount.js","../src/r/utils/getElementFromQuery.js","../src/r/utils/explode.js","../src/r/utils/parseValue.js","../src/r/setStyles.js","../src/r/utils/parseClass.js","../src/r/setAttributes.js","../src/r/Structure.js","../src/r/patch.js","../src/component/Component.js","../src/component/utils/isComponent.js","../src/r/utils/filterNode.js","../src/r/index.js","../src/listen/index.js","../src/component/headless.js","../src/action/index.js","../src/action/worker.js","../src/action/subscribe.js","../src/r/customTag.js","../src/r/customAttribute.js","../src/utils/remountActiveComponents.js","../src/custom/attributes/animation.js","../src/custom/modal.js","../src/index.js"],"sourcesContent":["const GLOBALS = {\n HEADLESS_COMPONENTS: {},\n FROZEN_STATE: false,\n VERSION: '0.4.1',\n // TODO: Collect active components\n ACTIVE_COMPONENTS: {},\n CUSTOM_ATTRIBUTES: {},\n CUSTOM_TAGS: {},\n};\n\nexport default GLOBALS;\n","\n/**\n * @param {*[]} list\n * @returns {*[]}\n */\nconst flatten = function flatten(list) {\n return list.reduce((a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), []);\n};\n\nexport default flatten;\n","/**\n * UUID v4 generator\n * https://gist.github.com/jcxplorer/823878\n * @returns {string}\n */\nconst generateId = () => {\n let uuid = '';\n for (let i = 0; i < 32; i++) {\n const random = (Math.random() * 16) | 0; // eslint-disable-line\n\n if (i === 8 || i === 12 || i === 16 || i === 20) {\n uuid += '-';\n }\n uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16); // eslint-disable-line\n }\n return uuid;\n};\n\nexport default generateId;\n","export default class PrivateStore {\n constructor() {\n this.store = {};\n }\n\n /**\n * @param {string} key\n * @param {Listener} listener\n * @param {number} depth\n */\n addListener(key, listener, depth) {\n if (typeof this.store[key] === 'undefined') {\n this.createItemWrapper(key);\n }\n this.store[key].listeners[depth] = (this.store[key].listeners[depth] || []).filter(item => (\n item.attached\n ));\n this.store[key].listeners[depth].push(listener);\n\n return listener;\n }\n\n /**\n * Removes all listeners for all keys\n */\n removeListeners() {\n let o = Object.keys(this.store);\n for (var i = 0; i < o.length; i++) {\n this.store[o[i]].listeners = {};\n this.store[o[i]].value = null;\n }\n }\n\n /**\n * setState\n * @param {*} newState\n * @returns {*}\n */\n setState(newState) {\n // Find and trigger changes for listeners\n for (const key of Object.keys(newState)) {\n if (typeof this.store[key] === 'undefined') {\n this.createItemWrapper(key);\n }\n this.store[key].value = newState[key];\n\n this.triggerListeners(key);\n }\n return newState;\n }\n\n /**\n * createItemWrapper\n * @private\n * @param {string} key\n * @returns {object}\n */\n createItemWrapper(key) {\n return this.store[key] = {\n listeners: {},\n value: null,\n };\n }\n\n /**\n * triggerListeners\n * @private\n * @param {string} key\n */\n triggerListeners(key) {\n const item = this.store[key];\n if (item) {\n let clone = Object.keys(item.listeners)\n .sort()\n .map(key => (\n item.listeners[key].map(listener => listener)\n ));\n\n for (var i = 0; i < clone.length; i++) {\n for (var n = clone[i].length - 1; n >= 0; n--) {\n if (clone[i][n].attached) clone[i][n].handleUpdate(item.value)\n }\n }\n }\n }\n}\n","/**\n * @param {*} obj\n * @returns {*}\n */\nconst clone = obj => {\n if (typeof obj !== 'object') return obj;\n if (obj === null) return obj;\n if (Array.isArray(obj)) return obj.map(clone);\n\n /*eslint-disable*/\n // Reverted as currently throws some errors\n const cloned = {};\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n cloned[key] = clone(obj[key]);\n }\n }\n /* eslint-enable */\n\n return cloned;\n};\n\nexport default clone;\n","const skipInProductionAndTest = fn => {\n if (typeof process === 'undefined'\n || (process.env.NODE_ENV === 'production'\n || process.env.NODE_ENV === 'test')) {\n return false;\n }\n return fn && fn();\n};\n\nexport default skipInProductionAndTest;\n","/* eslint-disable no-param-reassign */\n/* eslint-disable no-shadow */\n/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\n// import fuseDom from '../r/utils/fuseDom';\n\nexport default class Listener {\n /**\n * @param {Component} component\n * @param {...string} path\n */\n constructor(component, ...path) {\n this.component = component;\n [this.key] = path;\n this.path = path.slice(1, path.length);\n this.depth = 0;\n this.attached = true;\n this.processValue = value => value;\n this.changeListener = () => {};\n this.addedListeners = [];\n }\n\n /**\n * Applies values and events to listener\n */\n init() {\n this.value = this.getValue(this.component.state[this.key]);\n this.component.addListener(this.key, this, this.depth);\n this.handleUpdate(this.component.state[this.key]);\n return this;\n }\n\n /**\n * Removes last active value with destroying listeners and\n * @param {*} value\n */\n unlink() {\n if (this.value instanceof Node) {\n // Destroy this Node\n // fuseDom.destroy(this.value);\n } else\n if (this.value instanceof Listener) {\n // Deattach this Listener\n this.value.deattach();\n }\n }\n\n\n clone(target, source) {\n const out = {};\n\n for (const i in target) {\n out[i] = target[i];\n }\n for (const i in source) {\n out[i] = source[i];\n }\n\n return out;\n }\n\n setPartialState(path, value, source) {\n const target = {};\n if (path.length) {\n target[path[0]] =\n path.length > 1\n ? this.setPartialState(path.slice(1), value, source[path[0]])\n : value;\n return this.clone(source, target);\n }\n return value;\n }\n\n /**\n * Updates state value\n * @param {*} value\n */\n updateValue(value) {\n const source = this.component.state[this.key];\n return this.component.setState({\n [this.key]: this.setPartialState(this.path, value, source),\n });\n }\n\n extractListeners(value) {\n // if (this.value instanceof Listener && value instanceof Listener) {\n // console.log('middle')\n // } else\n if (value instanceof Listener) {\n // if (this.value instanceof Listener) {\n // this.value.processValue = value.processValue;\n // // this.value = value;\n // this.handleUpdate(value.getValue(value.component.state[value.key]));\n // console.log(value, value.getValue(value.component.state[value.key]));\n // value.deattach();\n // }\n // value.component.addListener(value.key, value, value.depth);\n // value.handleUpdate = () => {\n // console.log('inner handler')\n // }\n const tempListener = {\n depth: value.depth,\n attached: true,\n processValue: value => value,\n handleUpdate: () => {\n if (this.component) {\n this.handleUpdate(this.getValue(this.component.state[this.key]));\n }\n tempListener.attached = false;\n },\n changeListener: () => {},\n };\n this.addedListeners.push(tempListener);\n value.component.addListener(value.key, tempListener, value.depth);\n // value.init()\n // value.handleUpdate = () => {\n // console.log('inner handler')\n // }\n // value.onValueChange((v) => {\n // this.handleUpdate(this.getValue(this.component.state[this.key]));\n // console.log('me got changed', v)\n // });\n const newValue = value.processValue(\n value.getValue(value.component.state[value.key])\n );\n value.deattach();\n return this.extractListeners(newValue);\n }\n return value;\n\n // return this.processValue(this.getValue(value));\n }\n\n /**\n * @param {*} value\n */\n handleUpdate(value) {\n const newValue = this.processValue(this.getValue(value));\n // if (this.value instanceof Listener && newValue instanceof Listener) {\n // this.value.processValue = newValue.processValue;\n // // this.value = newValue;\n // this.value.handleUpdate(newValue.component.state[newValue.key]);\n // console.log(newValue, newValue.getValue(newValue.component.state[newValue.key]));\n // newValue.deattach();\n // } else\n if (newValue instanceof Listener) {\n // if (this.value instanceof Listener) {\n // this.value.processValue = newValue.processValue;\n // // this.value = newValue;\n // this.value.handleUpdate(newValue.component.state[newValue.key]);\n // console.log(newValue, newValue.getValue(newValue.component.state[newValue.key]));\n // newValue.deattach();\n // } else {\n for (let i = 0; i < this.addedListeners.length; i++) {\n this.addedListeners[i].attached = false;\n }\n this.addedListeners = [];\n this.value = this.extractListeners(newValue);\n this.changeListener(this.value);\n // }\n // // console.log(this.value.processValue('P'), newValue.processValue('A'));\n // // console.log(this.extractListeners(newValue));\n // // newValue.handleUpdate(newValue.component.state[newValue.key]);\n // // this.value = newValue;\n // // this.value.processValue = newValue.processValue;\n // this.value = this.extractListeners(newValue);\n // this.changeListener(this.value);\n // // this.value.processValue = newValue.processValue;\n // // // this.value = newValue;\n // // this.value.handleUpdate(newValue.component.state[newValue.key]);\n // // console.log(newValue, newValue.getValue(newValue.component.state[newValue.key]));\n // // newValue.deattach();\n } else {\n this.unlink();\n this.value = newValue;\n this.changeListener(this.value);\n }\n }\n\n /**\n * @param {*} source\n * @returns {*}\n */\n getValue(source) {\n let i = 0;\n while (i < this.path.length) {\n if (source === null\n || (!source[this.path[i]]\n && typeof source[this.path[i]] !== 'number')) {\n source = null;\n } else {\n source = source[this.path[i]];\n }\n i += 1;\n }\n return source;\n }\n\n /**\n * @param {number} depth\n * @returns {Listener}\n */\n applyDepth(depth) {\n this.depth = depth;\n return this;\n }\n\n /**\n * @param {function(*)} changeListener\n */\n onValueChange(changeListener) {\n this.changeListener = changeListener;\n this.changeListener(this.value);\n }\n\n /**\n * @param {function(*): *} processValue\n * @returns {function(*): *}\n */\n process(processValue) {\n this.processValue = processValue;\n return this;\n }\n\n deattach() {\n this.component = null;\n this.attached = false;\n this.key = null;\n this.childPath = null;\n this.path = null;\n this.unlink();\n this.value = null;\n this.changeListener = () => {};\n this.processValue = () => {};\n }\n}\n","\nconst onMountEvent = document.createEvent('Event');\nonMountEvent.initEvent('mount', true, true);\n\nconst onLoadEvent = document.createEvent('Event');\nonLoadEvent.initEvent('load', true, true);\n\n/**\n * Append dom node to dom tree (after - (true) should append after 'to' element\n * or (false) inside it)\n * @param {HTMLElement} node\n * @param {HTMLElement} to\n * @param {Boolean} after\n * @returns {HTMLElement}\n */\nconst append = (node, to, after) => {\n if (typeof node.dispatchEvent === 'function') {\n node.dispatchEvent(onLoadEvent);\n }\n\n if (after && to) {\n if (to.parentNode) {\n to.parentNode.insertBefore(node, to);\n if (typeof node.dispatchEvent === 'function') {\n node.dispatchEvent(onMountEvent);\n }\n // if (!to.nextSibling) {\n // to.parentNode.appendChild(node);\n // } else {\n // to.parentNode.insertBefore(node, to.nextSibling || to);\n // }\n }\n return node;\n }\n\n to.appendChild(node);\n\n if (typeof node.dispatchEvent === 'function') {\n node.dispatchEvent(onMountEvent);\n }\n\n return node;\n};\n\nexport default append;\n","import mount from '../mount';\n\nconst getLast = (child) => {\n if (child.$redirect && child.$redirect[child.$redirect.length - 1]) {\n return getLast(child.$redirect[child.$redirect.length - 1]);\n }\n\n // if (child.children && child.children.length > 0) {\n // return child.children;\n // }\n\n return child;\n};\n\n/**\n * @param {Structure} child\n */\nconst mountChildren = (child, isSvg, depth = 0) => {\n if (!child) return;\n\n if (child.$redirect && child.$redirect.length > 0) {\n mountChildren(getLast(child), isSvg, depth + 1);\n } else if (child.children && child.children.length > 0) {\n if (child.html && child.html.length === 1) {\n mount(child.children,\n child.html[0],\n child.html[0].nodeType !== 1,\n child.$isSvg,\n child.$depth);\n } else {\n mount(child.children,\n child.$pointer,\n true,\n child.$isSvg,\n child.$depth);\n }\n }\n};\n\nexport default mountChildren;\n","\n/**\n * @param {string} value\n * @returns {HTMLElement}\n */\nconst textNode = value => (\n document.createTextNode(\n (typeof value === 'object'\n ? JSON.stringify(value)\n : value)\n )\n);\n\nexport default textNode;\n","// import Component from './component/Component';\nimport Listener from './listen/Listener';\nimport flatten from './utils/flatten';\nimport filterNode from './r/utils/filterNode';\nimport append from './r/utils/append';\nimport mountChildren from './r/mountChildren';\nimport textNode from './r/utils/textNode';\nimport patch from './r/patch';\n\n/**\n * Appends structure[] to dom node\n * @param {*} component\n * @param {string} id\n * @param {boolean} isSvg\n * @param {number} depth\n * @returns {HTMLElement|Node}\n */\nconst mount = (raw, parent, after = false, isSvg = false, depth = 0) => {\n parent = typeof parent === 'string' ? document.getElementById(parent) : parent;\n let nodes = flatten([raw]).map(filterNode);\n\n // console.log(1, 'MOUNT')\n\n for (var i = 0; i < nodes.length; i++) {\n const ni = i;\n const nn = nodes[i];\n\n // console.log(2, nodes[i])\n if (nn instanceof Node) {\n append(nn, parent, after);\n } else\n if (nn && typeof nn.render === 'function') {\n // nn.$pointer = text('[pointer]');\n nn.$pointer = textNode('');\n append(nn.$pointer, parent, after);\n\n nodes[i].render(rendered => {\n // console.log(3, rendered)\n\n // Abort! Pointer was destroyed\n if (nn.$pointer === false) return false;\n\n for (var n = 0; n < rendered.length; n++) {\n if (nn.$pointer) {\n append(rendered[n], nn.$pointer, true);\n } else {\n append(rendered[n], parent, after);\n }\n }\n\n mountChildren(nn, nn.$isSvg, depth + 1);\n }, nn, depth, isSvg);\n }\n\n // if (!nn.html) {\n // nn.$pointer = text('[pointer]');\n // append(nn.$pointer, parent, after);\n // }\n }\n\n return nodes;\n}\n\nexport default mount;\n","/**\n * @param {*} query\n * @returns {Node}\n */\nconst getElementFromQuery = (query, isSvg) => {\n if (typeof query === 'string' || typeof query === 'number')\n return query !== 'template'\n ? isSvg || query === 'svg'\n ? document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n query\n )\n : document.createElement(query)\n : document.createDocumentFragment();\n console.warn(\n '[Radi.js] Warn: Creating a JSX element whose query is not of type string, automatically converting query to string.'\n );\n return document.createElement(query.toString());\n};\n\nexport default getElementFromQuery;\n","import filterNode from './filterNode';\nimport Structure from '../Structure';\nimport flatten from '../../utils/flatten';\n\n/**\n * @param {*[]} raw\n * @param {HTMLElement} parent\n * @param {string} raw\n * @returns {HTMLElement}\n */\nconst explode = (raw, parent, next, depth = 0, isSvg) => {\n let nodes = flatten([raw]).map(filterNode);\n // console.log('EXPLODE', nodes)\n\n // console.log('explode', {parent, nodes})\n\n for (var i = 0; i < nodes.length; i++) {\n if ((nodes[i] instanceof Structure || nodes[i].isStructure) && !nodes[i].html) {\n // let pp = depth === 0 ? parent : nodes[i];\n // let pp = parent;\n // console.log('EXPLODE 1', parent.$depth, depth, parent.$redirect, nodes[i].$redirect)\n if (parent.children.length <= 0) {\n if (!parent.$redirect) {\n parent.$redirect = [nodes[i]];\n } else {\n parent.$redirect.push(nodes[i]);\n }\n }\n\n if (!parent.$redirect && nodes[i].children) {\n parent.children = parent.children.concat(nodes[i].children);\n }\n\n if (typeof nodes[i].render === 'function') {\n const n = i;\n nodes[i].render(v => {\n // if (parent.children.length <= 0) {\n // if (!parent.$redirect) {\n // parent.$redirect = [nodes[n]];\n // } else {\n // parent.$redirect.push(nodes[n]);\n // }\n // }\n // console.log('EXPLODE 2', nodes[n], v, parent.$depth, nodes[n].$depth)\n next(v);\n // nodes[n].mount();\n }, nodes[i], depth + 1, isSvg);\n }\n }\n }\n\n return;\n}\n\nexport default explode;\n","/**\n * @param {*} value\n * @return {*}\n */\nconst parseValue = value =>\n typeof value === 'number' && !Number.isNaN(value) ? `${value}px` : value;\n\nexport default parseValue;\n","/* eslint-disable no-continue */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-param-reassign */\n/* eslint-disable no-multi-assign */\n\nimport Listener from '../listen/Listener';\nimport parseValue from './utils/parseValue';\n\n/**\n * @param {Structure} structure\n * @param {object} styles\n * @param {object} oldStyles\n * @returns {object}\n */\nconst setStyles = (structure, styles = {}, oldStyles = {}) => {\n if (!structure.html || !structure.html[0]) return styles;\n const element = structure.html[0];\n\n // Handle Listeners\n if (styles instanceof Listener) {\n if (typeof structure.$styleListeners.general !== 'undefined') {\n return element.style;\n }\n structure.$styleListeners.general = styles;\n structure.$styleListeners.general.applyDepth(structure.depth).init();\n\n structure.$styleListeners.general.onValueChange(value => {\n setStyles(structure, value, {});\n });\n\n return element.style;\n }\n\n if (typeof styles === 'string') {\n element.style = styles;\n return element.style;\n }\n\n const toRemove = Object.keys(oldStyles)\n .filter(key => typeof styles[key] === 'undefined');\n\n for (const style in styles) {\n if (styles.hasOwnProperty(style)) {\n // Skip if styles are the same\n if (typeof oldStyles !== 'undefined' && oldStyles[style] === styles[style]) continue;\n\n // Need to remove falsy style\n if (!styles[style] && typeof styles[style] !== 'number') {\n element.style[style] = null;\n continue;\n }\n\n // Handle Listeners\n if (styles[style] instanceof Listener) {\n if (typeof structure.$styleListeners[style] !== 'undefined') continue;\n structure.$styleListeners[style] = styles[style];\n structure.$styleListeners[style].applyDepth(structure.depth).init();\n\n structure.$styleListeners[style].onValueChange(value => {\n setStyles(structure, {\n [style]: value,\n }, {});\n });\n\n styles[style] = structure.$styleListeners[style].value;\n continue;\n }\n\n element.style[style] = parseValue(styles[style]);\n }\n }\n\n for (let i = 0; i < toRemove.length; i++) {\n element.style[toRemove[i]] = null;\n }\n\n return element.style;\n};\n\nexport default setStyles;\n","/**\n * @param {*} value\n * @return {*}\n */\nconst parseClass = value => {\n if (Array.isArray(value)) {\n return value.filter(item => item).join(' ')\n }\n return value;\n}\n\nexport default parseClass;\n","/* eslint-disable no-continue */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-param-reassign */\n\nimport setStyles from './setStyles';\nimport Listener from '../listen/Listener';\nimport parseClass from './utils/parseClass';\nimport GLOBALS from '../consts/GLOBALS';\n// import AttributeListener from './utils/AttributeListener';\n\n/**\n * @param {Structure} structure\n * @param {object} propsSource\n * @param {object} oldPropsSource\n */\nconst setAttributes = (structure, propsSource = {}, oldPropsSource = {}) => {\n const props = propsSource || {};\n const oldProps = oldPropsSource || {};\n\n if (!structure.html || !structure.html[0]) return structure;\n const element = structure.html[0];\n\n if (!(element instanceof Node && element.nodeType !== 3)) return structure;\n\n const toRemove = Object.keys(oldProps)\n .filter(key => typeof props[key] === 'undefined');\n\n for (const prop in props) {\n if (props.hasOwnProperty(prop)) {\n // Skip if proprs are the same\n if (typeof oldProps !== 'undefined' && oldProps[prop] === props[prop]) continue;\n\n if (prop === 'checked') {\n element.checked = props[prop];\n }\n\n // Need to remove falsy attribute\n if (!props[prop] && typeof props[prop] !== 'number' && typeof props[prop] !== 'string') {\n element.removeAttribute(prop);\n continue;\n }\n\n // Handle Listeners\n if (props[prop] instanceof Listener) {\n if (typeof structure.$attrListeners[prop] !== 'undefined') continue;\n structure.$attrListeners[prop] = props[prop];\n props[prop].applyDepth(structure.depth).init();\n\n if (prop.toLowerCase() === 'model' || prop.toLowerCase() === 'checked') {\n if (element.getAttribute('type') === 'radio') {\n element.addEventListener('input', (e) => {\n structure.$attrListeners[prop].updateValue(\n (e.target.checked && e.target.value)\n || e.target.checked\n );\n }, false);\n structure.$attrListeners[prop].onValueChange(value => {\n setAttributes(structure, {\n checked: element.value === value && Boolean(value),\n }, {});\n });\n } else\n if (element.getAttribute('type') === 'checkbox') {\n element.addEventListener('input', (e) => {\n structure.$attrListeners[prop].updateValue(\n Boolean(e.target.checked)\n );\n }, false);\n structure.$attrListeners[prop].onValueChange(value => {\n setAttributes(structure, {\n checked: Boolean(value),\n }, {});\n });\n } else {\n element.addEventListener('input', (e) => {\n structure.$attrListeners[prop].updateValue(e.target.value);\n }, false);\n }\n }\n\n if (!/(checkbox|radio)/.test(element.getAttribute('type'))) {\n structure.$attrListeners[prop].onValueChange(value => {\n setAttributes(structure, {\n [prop]: value,\n }, {});\n });\n }\n\n // structure.setProps(Object.assign(structure.data.props, {\n // [prop]: props[prop].value,\n // }));\n props[prop] = structure.$attrListeners[prop].value;\n continue;\n }\n\n if (prop === 'value' || prop === 'model') {\n element.value = props[prop];\n }\n\n if (typeof GLOBALS.CUSTOM_ATTRIBUTES[prop] !== 'undefined') {\n const { allowedTags } = GLOBALS.CUSTOM_ATTRIBUTES[prop];\n\n if (!allowedTags || (\n allowedTags\n && allowedTags.length > 0\n && allowedTags.indexOf(element.localName) >= 0\n )) {\n if (typeof GLOBALS.CUSTOM_ATTRIBUTES[prop].caller === 'function') {\n GLOBALS.CUSTOM_ATTRIBUTES[prop].caller(element, props[prop]);\n }\n if (!GLOBALS.CUSTOM_ATTRIBUTES[prop].addToElement) continue;\n }\n }\n\n\n if (prop.toLowerCase() === 'style') {\n if (typeof props[prop] === 'object') {\n setStyles(structure, props[prop], (oldProps && oldProps.style) || {});\n // props[prop] = structure.setStyles(props[prop], (oldProps && oldProps.style) || {});\n } else {\n element.style = props[prop];\n }\n continue;\n }\n\n if (prop.toLowerCase() === 'class' || prop.toLowerCase() === 'classname') {\n element.setAttribute('class', parseClass(props[prop]));\n continue;\n }\n\n if (prop.toLowerCase() === 'loadfocus') {\n element.addEventListener('mount', () => {\n element.focus();\n }, false);\n continue;\n }\n\n if (prop.toLowerCase() === 'html') {\n element.innerHTML = props[prop];\n continue;\n }\n\n // Handles events 'on'\n if (prop.substring(0, 2).toLowerCase() === 'on' && typeof props[prop] === 'function') {\n const fn = props[prop];\n if (prop.substring(0, 8).toLowerCase() === 'onsubmit') {\n element[prop] = (e) => {\n if (props.prevent) {\n e.preventDefault();\n }\n\n const data = [];\n const inputs = e.target.elements || [];\n for (const input of inputs) {\n if ((input.name !== ''\n && (input.type !== 'radio' && input.type !== 'checkbox'))\n || input.checked) {\n const item = {\n name: input.name,\n el: input,\n type: input.type,\n default: input.defaultValue,\n value: input.value,\n set(val) {\n structure.el.value = val;\n },\n reset(val) {\n structure.el.value = val;\n structure.el.defaultValue = val;\n },\n };\n data.push(item);\n if (!data[item.name]) {\n Object.defineProperty(data, item.name, {\n value: item,\n });\n }\n }\n }\n\n return fn(e, data);\n };\n } else {\n element[prop] = (e, ...args) => fn(e, ...args);\n }\n continue;\n }\n\n element.setAttribute(prop, props[prop]);\n }\n }\n\n for (let i = 0; i < toRemove.length; i++) {\n element.removeAttribute(toRemove[i]);\n }\n\n structure.props = props;\n\n return structure;\n};\n\nexport default setAttributes;\n","/* eslint-disable no-restricted-syntax */\n\n// import GLOBALS from '../consts/GLOBALS';\nimport Component from '../component/Component';\nimport flatten from '../utils/flatten';\nimport patch from './patch';\nimport getElementFromQuery from './utils/getElementFromQuery';\nimport textNode from './utils/textNode';\nimport explode from './utils/explode';\nimport filterNode from './utils/filterNode';\nimport isComponent from '../component/utils/isComponent';\nimport Listener from '../listen/Listener';\nimport setAttributes from './setAttributes';\n\n/**\n * @param {*} query\n * @param {object} props\n * @param {...*} children\n * @param {number} depth\n */\nclass Structure {\n constructor(query, props = {}, children, depth = 0) {\n this.query = query;\n this.props = Boolean !== props ? props : {};\n if (isComponent(query) || query instanceof Component) {\n this.$compChildren = flatten(children || []).map(filterNode);\n this.children = [];\n } else {\n this.children = flatten(children || []).map(filterNode);\n this.$compChildren = [];\n }\n this.html = null;\n this.$attrListeners = [];\n this.$styleListeners = [];\n this.$pointer = null;\n this.$component = null;\n this.$listener = null;\n this.$redirect = null;\n this.$destroyed = false;\n this.$isSvg = query === 'svg';\n this.$depth = depth;\n }\n\n mount() {\n this.$destroyed = false;\n\n if (this.$component instanceof Component) {\n this.$component.mount();\n }\n\n if (typeof this.onMount === 'function') {\n this.onMount();\n }\n }\n\n destroy(childrenToo = true) {\n if (this.$destroyed) return false;\n\n for (const l in this.$styleListeners) {\n if (this.$styleListeners[l]\n && typeof this.$styleListeners[l].deattach === 'function') {\n this.$styleListeners[l].deattach();\n }\n }\n\n for (const l in this.$attrListeners) {\n if (this.$attrListeners[l]\n && typeof this.$attrListeners[l].deattach === 'function') {\n this.$attrListeners[l].deattach();\n }\n }\n\n if (this.$redirect) {\n for (let i = 0; i < this.$redirect.length; i++) {\n if (typeof this.$redirect[i].destroy === 'function') {\n this.$redirect[i].destroy();\n }\n }\n }\n\n if (childrenToo && this.children) {\n for (let i = 0; i < this.children.length; i++) {\n if (typeof this.children[i].destroy === 'function') {\n this.children[i].destroy();\n }\n }\n }\n\n if (this.html) {\n const items = this.html;\n for (let i = 0; i < this.html.length; i++) {\n if (items[i].parentNode) {\n const destroyHTML = () => items[i].parentNode.removeChild(items[i]);\n if (typeof items[i].beforedestroy === 'function') {\n items[i].beforedestroy(destroyHTML);\n } else {\n destroyHTML();\n }\n }\n }\n }\n\n if (this.$component instanceof Component) {\n this.$component.destroy();\n }\n\n if (this.$listener instanceof Listener) {\n this.$listener.deattach();\n }\n\n if (this.$pointer && this.$pointer.parentNode) {\n this.$pointer.parentNode.removeChild(this.$pointer);\n }\n\n if (typeof this.onDestroy === 'function') {\n this.onDestroy();\n }\n\n this.$pointer = null;\n this.$redirect = null;\n this.$component = null;\n this.render = () => {};\n this.html = null;\n this.$destroyed = true;\n return true;\n }\n\n render(next, parent, depth = 0, isSvg = false) {\n // console.log('RENDER', isSvg, parent, parent && parent.$isSvg)\n this.$depth = Math.max(this.$depth, depth);\n this.$isSvg = isSvg || (parent && parent.$isSvg) || this.query === 'svg';\n\n if (this.query === '#text') {\n this.html = [textNode(this.props)];\n return next(this.html);\n }\n\n if (typeof this.query === 'string' || typeof this.query === 'number') {\n this.html = [getElementFromQuery(this.query, this.$isSvg)];\n\n setAttributes(this, this.props, {});\n\n return next(this.html);\n }\n\n if (this.query instanceof Listener) {\n if (!this.$listener) {\n this.$listener = this.query.applyDepth(this.$depth).init();\n this.mount();\n }\n return this.query.onValueChange(v => {\n if (this.html) {\n const tempParent = this.html[0];\n\n if (this.$pointer) {\n this.$redirect = patch(this.$redirect, v, this.$pointer,\n true, this.$isSvg, this.$depth + 1);\n } else {\n this.$redirect = patch(this.$redirect, v, tempParent,\n true, this.$isSvg, this.$depth + 1);\n }\n\n // let a = {\n // $redirect: [],\n // children: [],\n // };\n //\n // explode(v, a, output => {\n // // this.html = output;\n // if (this.$pointer) {\n // this.$redirect = patch(this.$redirect, a.$redirect,\n // this.$pointer, true, this.$isSvg, this.$depth + 1);\n // } else {\n // this.$redirect = patch(this.$redirect, a.$redirect,\n // tempParent, true, this.$isSvg, this.$depth + 1);\n // }\n // // next(output);\n // }, this.$depth + 1, this.$isSvg);\n } else {\n explode(v, parent || this, output => {\n // console.warn('change HTML', this.html)\n this.html = output;\n next(output);\n }, this.$depth + 1, this.$isSvg);\n }\n });\n }\n\n if (this.query instanceof Promise\n || this.query.constructor.name === 'LazyPromise') {\n return this.query.then(v => {\n const normalisedValue = v.default || v;\n explode(normalisedValue, parent || this, output => {\n this.html = output;\n next(output);\n }, this.$depth, this.$isSvg);\n });\n }\n\n if (this.query instanceof Component\n && typeof this.query.render === 'function') {\n this.$component = this.query;\n return explode(this.$component.render(), parent || this, v => {\n this.html = v;\n next(v);\n this.mount();\n }, this.$depth, this.$isSvg);\n }\n\n if (isComponent(this.query)) {\n if (!this.$component) {\n this.$component =\n new this.query(this.$compChildren).setProps(this.props); // eslint-disable-line\n }\n if (typeof this.$component.render === 'function') {\n explode(this.$component.render(), parent || this, v => {\n this.html = v;\n next(v);\n }, this.$depth, this.$isSvg);\n this.mount();\n }\n return null;\n }\n\n if (typeof this.query === 'function') {\n return explode(this.query(this.props), parent || this, v => {\n this.html = v;\n next(v);\n }, this.$depth, this.$isSvg);\n }\n\n return next(textNode(this.query));\n }\n\n isStructure() {\n return true;\n }\n}\n\nexport default Structure;\n","/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-continue */\n/* eslint-disable no-multi-assign */\n\nimport flatten from '../utils/flatten';\nimport filterNode from './utils/filterNode';\n// import Listener from '../listen/Listener';\n// import Component from '../component/Component';\nimport mount from '../mount';\nimport append from './utils/append';\n// import replaceWith from './utils/replaceWith';\nimport textNode from './utils/textNode';\nimport mountChildren from './mountChildren';\nimport Structure from './Structure';\nimport setAttributes from './setAttributes';\n\n// const hasRedirect = item => (\n// item && item.$redirect\n// );\n\nconst patch = (rawfirst, rawsecond, parent,\n after = false, isSvg = false, depth = 0) => {\n const first = flatten([rawfirst]);\n const second = flatten([rawsecond]).map(filterNode);\n\n const length = Math.max(first.length, second.length);\n\n for (let i = 0; i < length; i++) {\n // debugger\n // const nn = i;\n // first[i] = first[i].$redirect || first[i];\n if (typeof first[i] === 'undefined') {\n // mount\n mount(second[i], parent, after, isSvg, depth);\n continue;\n }\n\n if (typeof second[i] === 'undefined') {\n // remove\n if (typeof first[i].destroy === 'function') {\n first[i].destroy();\n }\n continue;\n }\n\n second[i].$depth = depth;\n\n if ((first[i] instanceof Structure || first[i].isStructure)\n && (second[i] instanceof Structure || second[i].isStructure)\n && first[i] !== second[i]) {\n // if (second[i].$redirect2) {\n // second[i] = patch(\n // // first[i].$redirect || first[i],\n // hasRedirect(first[i]) || first[i],\n // second[i].$redirect[second[i].$redirect.length - 1] || second[i],\n // parent,\n // after,\n // isSvg,\n // depth\n // );\n // continue;\n // }\n\n if (first[i].html\n && first[i].query === '#text'\n && second[i].query === '#text') {\n for (let n = 0; n < first[i].html.length; n++) {\n if (first[i].props !== second[i].props) {\n first[i].html[n].textContent = first[i].props = second[i].props;\n }\n }\n\n second[i].html = first[i].html;\n first[i].html = null;\n\n if (first[i].$pointer) {\n if (second[i].$pointer && second[i].$pointer.parentNode) {\n second[i].$pointer.parentNode.removeChild(second[i].$pointer);\n }\n second[i].$pointer = first[i].$pointer;\n first[i].$pointer = null;\n }\n\n first[i].destroy();\n continue;\n }\n\n\n if (first[i].html\n && typeof first[i].query === 'string'\n && typeof second[i].query === 'string'\n && first[i].query === second[i].query) {\n // for (var n = 0; n < first[i].html.length; n++) {\n // if (first[i].props !== second[i].props) {\n // // first[i].html[n].textContent = second[i].props;\n // }\n // }\n\n second[i].html = first[i].html;\n first[i].html = null;\n\n if (first[i].$pointer) {\n if (second[i].$pointer && second[i].$pointer.parentNode) {\n second[i].$pointer.parentNode.removeChild(second[i].$pointer);\n }\n second[i].$pointer = first[i].$pointer;\n first[i].$pointer = null;\n }\n\n setAttributes(second[i], second[i].props, first[i].props);\n // mountChildren(second[i], second[i].$isSvg, second[i].$depth + 1);\n\n if (second[i].html[0]\n && second[i].children\n && second[i].children.length > 0) {\n second[i].children = patch(first[i].children,\n second[i].children,\n second[i].html[0],\n false,\n second[i].$isSvg,\n second[i].$depth + 1);\n }\n first[i].destroy();\n\n continue;\n }\n\n // maybe merge\n const n1 = first[i];\n const n2 = second[i];\n\n // n2.$pointer = textNode('[pointer2]');\n n2.$pointer = textNode('');\n append(n2.$pointer, parent, after);\n\n n2.render(rendered => {\n if (n1.$pointer) {\n if (n2.$pointer && n2.$pointer.parentNode) {\n n2.$pointer.parentNode.removeChild(n2.$pointer);\n }\n n2.$pointer = n1.$pointer;\n n1.$pointer = null;\n }\n\n for (let n = 0; n < rendered.length; n++) {\n if ((n1.html && !n1.html[i]) || !n1.html) {\n append(rendered[n], n2.$pointer, true);\n } else {\n append(rendered[n], n1.html[i], true);\n }\n }\n\n mountChildren(n2, isSvg, depth + 1);\n\n n1.destroy(false);\n }, n2, depth, isSvg);\n }\n }\n\n return second;\n};\n\nexport default patch;\n","/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-continue */\n/* eslint-disable no-param-reassign */\n// -- we need those for..in loops for now!\n\nimport GLOBALS from '../consts/GLOBALS';\nimport generateId from '../utils/generateId';\nimport PrivateStore from './utils/PrivateStore';\n// import fuseDom from '../r/utils/fuseDom';\nimport clone from '../utils/clone';\nimport skipInProductionAndTest from '../utils/skipInProductionAndTest';\nimport Listener from '../listen/Listener';\n// import mount from '../mount';\nimport patch from '../r/patch';\n\nconst capitalise = lower => lower.charAt(0).toUpperCase() + lower.substr(1);\n\nexport default class Component {\n /**\n * @param {Node[]|*[]} [children]\n * @param {object} [o.props]\n */\n constructor(children, props) {\n this.addNonEnumerableProperties({\n $id: generateId(),\n $name: this.constructor.name,\n $config: (typeof this.config === 'function') ? this.config() : {\n listen: true,\n },\n __$events: {},\n __$privateStore: new PrivateStore(),\n });\n\n // TODO: Remove this! Deprecated!\n if (typeof this.on !== 'function'\n || (typeof this.on === 'function' && typeof this.on() === 'object')) {\n throw new Error('[Radi.js] Using `on.eventName()` is deprecated. Please use `onEventName()`.');\n }\n\n this.children = [];\n\n // Links headless components\n for (const key in GLOBALS.HEADLESS_COMPONENTS) {\n if (this[key] && typeof this[key].on === 'function') {\n this[key].on('update', () => this.setState());\n }\n }\n\n this.state = typeof this.state === 'function'\n ? this.state()\n : (this.state || {});\n\n skipInProductionAndTest(() => Object.freeze(this.state));\n\n if (children) this.setChildren(children);\n if (props) this.setProps(props);\n }\n\n /**\n * @returns {HTMLElement}\n */\n render() {\n if (typeof this.view !== 'function') return null;\n return this.html = this.view();\n }\n\n /**\n * @param {object} props\n * @returns {Component}\n */\n setProps(props) {\n const newState = {};\n // Self is needed cause of compilation\n const self = this;\n\n for (const key in props) {\n if (typeof props[key] === 'function' && key.substr(0, 2) === 'on') {\n self.on(key.substring(2, key.length), props[key]);\n } else\n if (props[key] instanceof Listener) {\n newState[key] = props[key].init().value;\n props[key].changeListener = (value => {\n self.setState({\n [key]: value,\n });\n });\n } else {\n newState[key] = props[key];\n }\n }\n this.setState(newState);\n return this;\n }\n\n /**\n * @param {Node[]|*[]} children\n */\n setChildren(children) {\n this.children = children;\n this.setState();\n for (let i = 0; i < this.children.length; i++) {\n if (typeof this.children[i].on === 'function') {\n this.children[i].on('update', () => this.setState());\n }\n }\n return this;\n }\n\n /**\n * @private\n * @param {object} obj\n */\n addNonEnumerableProperties(obj) {\n for (const key in obj) {\n if (typeof this[key] !== 'undefined') continue;\n Object.defineProperty(this, key, {\n value: obj[key],\n });\n }\n }\n\n /**\n * @param {string} key\n * @param {Listener} listener\n * @param {number} depth\n */\n addListener(key, listener, depth) {\n this.__$privateStore.addListener(key, listener, depth);\n }\n\n mount() {\n this.trigger('mount');\n }\n\n destroy() {\n // if (this.html) {\n // for (var i = 0; i < this.html.length; i++) {\n // if (this.html[i].parentNode) {\n // this.html[i].parentNode.removeChild(this.html[i]);\n // }\n // }\n // }\n this.html = null;\n this.trigger('destroy');\n this.__$privateStore.removeListeners();\n }\n\n // TODO: Remove this! Deprecated!\n when() {\n throw new Error('[Radi.js] Using `.when(\\'Event\\')` is deprecated. Use `.on(\\'Event\\')` instead.');\n }\n\n /**\n * @param {string} key\n * @param {function} fn\n * @returns {function}\n */\n on(key, fn) {\n if (typeof this.__$events[key] === 'undefined') this.__$events[key] = [];\n this.__$events[key].push(fn);\n return fn;\n }\n\n /**\n * @param {string} key\n * @param {*} value\n */\n trigger(key, ...args) {\n const event = this[`on${capitalise(key)}`];\n\n if (typeof event === 'function') {\n event.call(this, ...args);\n }\n\n if (typeof this.__$events[key] !== 'undefined') {\n for (const i in this.__$events[key]) {\n this.__$events[key][i].call(this, ...args);\n }\n }\n }\n\n /**\n * @param {object} newState\n * @param {string} actionName\n */\n setState(newState, actionName) {\n if (typeof newState === 'object') {\n let oldstate = this.state;\n\n skipInProductionAndTest(() => oldstate = clone(this.state));\n\n this.state = Object.assign(oldstate, newState);\n\n skipInProductionAndTest(() => Object.freeze(this.state));\n\n if (this.$config.listen) {\n this.__$privateStore.setState(newState);\n }\n }\n\n if (!this.$config.listen && typeof this.view === 'function' && this.html) {\n this.html = patch(this.html, this.view());\n }\n\n if (typeof actionName === 'string' && typeof this[actionName] === 'function') {\n this.trigger(`after${capitalise(actionName)}`, newState);\n }\n\n // if (typeof newState === 'object') {\n // let oldstate = this.state;\n //\n // skipInProductionAndTest(() => oldstate = clone(this.state));\n //\n // this.state = Object.assign(oldstate, newState);\n //\n // skipInProductionAndTest(() => Object.freeze(this.state));\n //\n // if (this.$config.listen) {\n // this.__$privateStore.setState(newState);\n // }\n // }\n //\n // if (!this.$config.listen && typeof this.view === 'function' && this.html) {\n // fuseDom.fuse(this.html, this.view());\n // }\n this.trigger('update');\n\n return newState;\n }\n\n /**\n * @returns {boolean}\n */\n static isComponent() {\n return true;\n }\n}\n","import Component from '../Component';\n\n/**\n * @param {*} value\n * @returns {Boolean}\n */\nconst isComponent = value => {\n if (value) {\n if (value.prototype instanceof Component) {\n return true;\n }\n\n if (value.isComponent) {\n return true;\n }\n }\n\n return false;\n}\n\nexport default isComponent;\n","import flatten from '../../utils/flatten';\nimport isComponent from '../../component/utils/isComponent';\nimport Component from '../../component/Component';\nimport r from '../index.js';\nimport Listener from '../../listen/Listener';\n\n/**\n * @param {function} value\n * @returns {object}\n */\nconst filterNode = value => {\n\n if (Array.isArray(value)) {\n return value.map(filterNode);\n }\n\n if (typeof value === 'string' || typeof value === 'number') {\n return r('#text', value);\n }\n\n if (!value || typeof value === 'boolean') {\n return r('#text', '');\n }\n\n if (value instanceof Listener) {\n return r(value);\n }\n\n if (isComponent(value) || value instanceof Component) {\n return r(value);\n }\n\n if (typeof value === 'function') {\n return r(value);\n }\n\n if (value instanceof Promise || value.constructor.name === 'LazyPromise') {\n return r(value);\n }\n\n return value;\n}\n\nexport default filterNode;\n","// import Component from '../component/Component';\nimport GLOBALS from '../consts/GLOBALS';\nimport flatten from '../utils/flatten';\nimport filterNode from './utils/filterNode';\nimport Structure from './Structure';\nimport patch from './patch';\n\n/**\n * @param {*} query\n * @param {object} props\n * @param {...*} children\n * @returns {object}\n */\nconst r = (query, props, ...children) => {\n if (typeof GLOBALS.CUSTOM_TAGS[query] !== 'undefined') {\n return GLOBALS.CUSTOM_TAGS[query].onmount(\n props || {},\n (children && flatten([children]).map(filterNode)) || [],\n filterNode,\n v => (GLOBALS.CUSTOM_TAGS[query].saved = v),\n ) || null;\n }\n\n if (query === 'await') {\n let output = null;\n\n if (props.src && props.src instanceof Promise) {\n props.src.then(v => {\n const nomalizedData = filterNode(\n typeof props.transform === 'function'\n ? props.transform(v)\n : v\n );\n\n if (output) {\n output = patch(output, nomalizedData, output.html[0].parentNode);\n } else {\n output = nomalizedData;\n }\n }).catch(error => {\n const placerror = filterNode(\n typeof props.error === 'function'\n ? props.error(error)\n : props.error\n );\n\n if (output) {\n output = patch(output, placerror, output.html[0].parentNode);\n } else {\n output = placerror;\n }\n });\n }\n\n if (!output) {\n output = filterNode(props.placeholder);\n }\n\n return output;\n }\n\n if (query === 'template') {\n // return flatten([children]).map(filterNode);\n return new Structure('section', props, flatten([children]).map(filterNode));\n }\n\n return new Structure(query, props, flatten([children]).map(filterNode));\n};\n\nexport default r;\n","import Listener from './Listener';\n\n/**\n * The listen function is used for dynamically binding a component property\n * to the DOM. Also commonly imported as 'l'.\n * @param {Component} component\n * @param {...string} path\n * @returns {Listener}\n */\nconst listen = (component, ...path) =>\n new Listener(component, ...path);\n\nexport default listen;\n","import Component from './Component';\nimport GLOBALS from '../consts/GLOBALS';\n\nconst headless = (key, Comp) => {\n // TODO: Validate component and key\n const name = '$'.concat(key);\n const mountedComponent = new Comp();\n mountedComponent.mount();\n Component.prototype[name] = mountedComponent;\n return GLOBALS.HEADLESS_COMPONENTS[name] = mountedComponent;\n};\n\nexport default headless;\n","// Decorator for actions\nconst action = (target, key, descriptor) => {\n const fn = descriptor.value;\n return {\n configurable: true,\n value(...args) {\n return this.setState.call(this, fn.call(this, ...args), key);\n },\n };\n};\n\nexport default action;\n","/* eslint-disable func-names */\n\nconst createWorker = fn => {\n let fire = () => {};\n\n const blob = new window.Blob([`self.onmessage = function(e) {\n self.postMessage((${fn.toString()})(e.data));\n }`], { type: 'text/javascript' });\n\n const url = window.URL.createObjectURL(blob);\n const myWorker = new window.Worker(url);\n\n myWorker.onmessage = e => { fire(e.data, null); };\n myWorker.onerror = e => { fire(null, e.data); };\n\n return arg => new Promise((resolve, reject) => {\n fire = (data, err) => !err ? resolve(data) : reject(data);\n myWorker.postMessage(arg);\n });\n};\n\n// Descriptor for worker\nconst worker = (target, key, descriptor) => {\n const act = descriptor.value;\n\n const promisedWorker = createWorker(act);\n\n descriptor.value = function (...args) {\n promisedWorker(...args).then(newState => {\n this.setState.call(this, newState);\n });\n };\n return descriptor;\n};\n\nexport default worker;\n","\n// Descriptor for subscriptions\nconst subscribe = (container, eventName/* , triggerMount */) =>\n (target, key, descriptor) => {\n let fn = descriptor.value;\n let boundFn = () => {};\n\n if (typeof fn !== 'function') {\n throw new Error(`@subscribe decorator can only be applied to methods not: ${typeof fn}`);\n }\n\n // In IE11 calling Object.defineProperty has a side-effect of evaluating the\n // getter for the property which is being replaced. This causes infinite\n // recursion and an \"Out of stack space\" error.\n let definingProperty = false;\n\n container[eventName] = (...args) => boundFn(...args);\n\n return {\n configurable: true,\n get() {\n if (definingProperty || this === target.prototype || this.hasOwnProperty(key)\n || typeof fn !== 'function') {\n return fn;\n }\n\n boundFn = fn.bind(this);\n\n definingProperty = true;\n Object.defineProperty(this, key, {\n configurable: true,\n get() {\n return boundFn;\n },\n set(value) {\n fn = value;\n delete this[key];\n },\n });\n definingProperty = false;\n return boundFn;\n },\n set(value) {\n fn = value;\n },\n };\n };\n\nexport default subscribe;\n","import GLOBALS from '../consts/GLOBALS';\n\n/**\n * @param {string} tagName\n * @param {function} onmount\n * @param {function} ondestroy\n * @returns {object}\n */\nconst customTag = (tagName, onmount, ondestroy) => GLOBALS.CUSTOM_TAGS[tagName] = {\n name: tagName,\n onmount: onmount || (() => {}),\n ondestroy: ondestroy || (() => {}),\n saved: null,\n};\n\nexport default customTag;\n","import GLOBALS from '../consts/GLOBALS';\n\n/**\n * @param {string} attributeName\n * @param {function} caller\n * @param {object} object\n * @returns {object}\n */\nconst customAttribute = (attributeName, caller, {\n allowedTags,\n addToElement,\n} = {}) => GLOBALS.CUSTOM_ATTRIBUTES[attributeName] = {\n name: attributeName,\n caller,\n allowedTags: allowedTags || null,\n addToElement,\n};\n\nexport default customAttribute;\n","import GLOBALS from '../consts/GLOBALS';\n\nconst remountActiveComponents = () => {\n Object.values(GLOBALS.ACTIVE_COMPONENTS).forEach(component => {\n if (typeof component.onMount === 'function') {\n component.onMount(component);\n }\n });\n};\n\nexport default remountActiveComponents;\n","import customAttribute from '../../r/customAttribute';\n\nconst animate = (target, type, opts, done) => {\n const direct = opts[type];\n if (typeof direct !== 'function') {\n console.warn(`[Radi.js] Animation \\`${type}\\` for node \\`${target.nodeName.toLowerCase}\\` should be function`);\n return;\n }\n\n return direct(target, done);\n};\n\ncustomAttribute('animation', (el, props) => {\n animate(el, 'in', props, () => {});\n el.beforedestroy = done => animate(el, 'out', props, done);\n});\n","/* eslint-disable consistent-return */\n/* eslint-disable no-console */\n\nimport Component from '../component/Component';\nimport headless from '../component/headless';\nimport customTag from '../r/customTag';\nimport mount from '../mount';\nimport listen from '../listen';\nimport r from '../r';\n\nclass Modal extends Component {\n state() {\n return {\n registry: {},\n };\n }\n\n register(name, element) {\n if (typeof this.state.registry[name] !== 'undefined') {\n console.warn(`[Radi.js] Warn: Modal with name \"${name}\" is already registerd!`);\n return;\n }\n\n this.setState({\n registry: Object.assign({}, this.state.registry, {\n [name]: {\n status: false,\n element,\n },\n }),\n }, 'register');\n }\n\n exists(name) {\n if (typeof this.state.registry[name] === 'undefined') {\n console.warn(`[Radi.js] Warn: Modal with name \"${name}\" is not registerd!`);\n return false;\n }\n\n return true;\n }\n\n open(name) {\n if (!this.exists(name) || this.state.registry[name].status) return;\n\n return this.setState({\n registry: Object.assign({}, this.state.registry, {\n [name]: {\n status: true,\n element: this.state.registry[name].element,\n },\n }),\n }, 'open');\n }\n\n close(name) {\n if (!this.exists(name) || !this.state.registry[name].status) return;\n\n return this.setState({\n registry: Object.assign({}, this.state.registry, {\n [name]: {\n status: false,\n element: this.state.registry[name].element,\n },\n }),\n }, 'close');\n }\n\n closeAll() {\n const keys = Object.keys(this.state.registry);\n const registry = keys.reduce((acc, name) => Object.assign(acc, {\n [name]: {\n status: false,\n element: this.state.registry[name].element,\n },\n }), {});\n\n return this.setState({\n registry,\n }, 'closeAll');\n }\n}\n\nconst $modal = headless('modal', Modal);\n\ncustomTag('modal',\n (props, children, buildNode) => {\n const name = props.name || 'default';\n\n $modal.register(name, null);\n\n if (typeof props.name === 'undefined') {\n console.warn('[Radi.js] Warn: Every tag needs to have `name` attribute!');\n }\n\n const mounted = mount(listen($modal, 'registry', name)\n .process(v => (\n v.status && r('div',\n { class: 'radi-modal', name },\n r('div', {\n class: 'radi-modal-backdrop',\n onclick: () => $modal.close(name),\n }),\n r('div',\n { class: 'radi-modal-content' },\n ...(children.slice())\n )\n )\n )), document.body);\n\n const treeSitter = buildNode(null);\n\n treeSitter.onDestroy = () => {\n for (let i = 0; i < mounted.length; i++) {\n if (typeof mounted[i].destroy === 'function') mounted[i].destroy();\n }\n };\n\n return treeSitter;\n }, () => {\n // Destroyed `element`\n }\n);\n","import GLOBALS from './consts/GLOBALS';\nimport r from './r';\nimport listen from './listen';\nimport Component from './component';\nimport headless from './component/headless';\nimport generateId from './utils/generateId';\nimport mount from './mount';\nimport patch from './r/patch';\nimport action from './action';\nimport worker from './action/worker';\nimport subscribe from './action/subscribe';\nimport customTag from './r/customTag';\nimport customAttribute from './r/customAttribute';\nimport remountActiveComponents from './utils/remountActiveComponents';\nimport {} from './custom';\n\nconst Radi = {\n version: GLOBALS.VERSION,\n activeComponents: GLOBALS.ACTIVE_COMPONENTS,\n r,\n listen,\n l: listen,\n worker,\n Component,\n component: Component,\n action,\n subscribe,\n customTag,\n customAttribute,\n headless,\n update: patch,\n patch,\n mount,\n freeze: () => {\n GLOBALS.FROZEN_STATE = true;\n },\n unfreeze: () => {\n GLOBALS.FROZEN_STATE = false;\n remountActiveComponents();\n },\n};\n\n// Pass Radi instance to plugins\nRadi.plugin = (fn, ...args) => fn(Radi, ...args);\n\nif (window) window.Radi = Radi;\nexport default Radi;\n// module.exports = Radi;\n"],"names":["const","let","i","l"],"mappings":"AAAAA,IAAM,OAAO,GAAG;EACd,mBAAmB,EAAE,EAAE;EACvB,YAAY,EAAE,KAAK;EACn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Q,EAAE,MAAM;IACd,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC;IAC7B,uBAAuB,EAAE,CAAC;GAC3B;CACF,CAAC;;;AAGF,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,KAAK,EAAE,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;;AAEjD,IAAI,MAAM,IAAE,MAAM,CAAC,IAAI,GAAG,IAAI,GAAC;AAC/B;;;;"} \ No newline at end of file diff --git a/dist/radi.es.min.js b/dist/radi.es.min.js index 968d595..41071d6 100644 --- a/dist/radi.es.min.js +++ b/dist/radi.es.min.js @@ -1,3 +1,3 @@ -var GLOBALS={HEADLESS_COMPONENTS:{},FROZEN_STATE:!1,VERSION:'0.4.0',ACTIVE_COMPONENTS:{},CUSTOM_ATTRIBUTES:{},CUSTOM_TAGS:{}},flatten=function e(t){return t.reduce((t,r)=>t.concat(Array.isArray(r)?e(r):r),[])},generateId=()=>{var e='';for(var t=0;t<32;t++){var r=Math.random()*16|0;(t===8||t===12||t===16||t===20)&&(e+='-');e+=(t===12?4:t===16?r&3|8:r).toString(16)}return e},PrivateStore=function(){this.store={}};PrivateStore.prototype.addListener=function(e,t,r){typeof this.store[e]==='undefined'&&this.createItemWrapper(e);this.store[e].listeners[r]=(this.store[e].listeners[r]||[]).filter(e=>e.attached);this.store[e].listeners[r].push(t);return t};PrivateStore.prototype.removeListeners=function(){var e=Object.keys(this.store);for(var t=0;t(t.listeners[e].map(e=>e)));for(var n=0;n=0;o--)r[n][o].attached&&r[n][o].handleUpdate(t.value)}}};var clone=e=>{if(typeof e!=='object'){return e}if(e===null){return e}if(Array.isArray(e)){return e.map(clone)}var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=clone(e[r]));return t},skipInProductionAndTest=e=>{if(typeof process==='undefined'||(process.env.NODE_ENV==='production'||process.env.NODE_ENV==='test')){return!1}return e&&e()},Listener=function(e,...t){var r;this.component=e;(r=t, this.key=r[0]);this.path=t.slice(1,t.length);this.depth=0;this.attached=!0;this.processValue=e=>e;this.changeListener=()=>{};this.addedListeners=[]};Listener.prototype.init=function(){this.value=this.getValue(this.component.state[this.key]);this.component.addListener(this.key,this,this.depth);this.handleUpdate(this.component.state[this.key]);return this};Listener.prototype.unlink=function(){this.value instanceof Node||this.value instanceof Listener&&this.value.deattach()};Listener.prototype.clone=function(e,t){var r={};for(var n in e)r[n]=e[n];for(var o in t)r[o]=t[o];return r};Listener.prototype.setPartialState=function(e,t,r){var n={};if(e.length){n[e[0]]=e.length>1?this.setPartialState(e.slice(1),t,r[e[0]]):t;return this.clone(r,n)}return t};Listener.prototype.updateValue=function(e){var t=this.component.state[this.key];return this.component.setState({[this.key]:this.setPartialState(this.path,e,t)})};Listener.prototype.extractListeners=function(e){if(e instanceof Listener){var t={depth:e.depth,attached:!0,processValue:e=>e,handleUpdate:()=>{this.component&&this.handleUpdate(this.getValue(this.component.state[this.key])),t.attached=!1},changeListener:()=>{}};this.addedListeners.push(t);e.component.addListener(e.key,t,e.depth);var r=e.processValue(e.getValue(e.component.state[e.key]));e.deattach();return this.extractListeners(r)}return e};Listener.prototype.handleUpdate=function(e){var t=this.processValue(this.getValue(e));if(t instanceof Listener){for(var r=0;r{};this.processValue=()=>{}};var append=(e,t,r)=>{if(r&&t){t.parentNode&&t.parentNode.insertBefore(e,t);return e}return t.appendChild(e)},getLast=e=>{if(e.$redirect&&e.$redirect[e.$redirect.length-1]){return getLast(e.$redirect[e.$redirect.length-1])}return e},mountChildren=(e,t,r)=>{r===void 0&&(r=0);if(!e){return}e.$redirect&&e.$redirect.length>0?mountChildren(getLast(e),t,r+1):e.children&&e.children.length>0&&(e.html&&e.html.length===1?mount(e.children,e.html[0],e.html[0].nodeType!==1,e.$isSvg,e.$depth):mount(e.children,e.$pointer,!0,e.$isSvg,e.$depth))},textNode=e=>(document.createTextNode((typeof e==='object'?JSON.stringify(e):e))),mount=(e,t,r,n,o)=>{r===void 0&&(r=!1);n===void 0&&(n=!1);o===void 0&&(o=0);t=typeof t==='string'?document.getElementById(t):t;var i=flatten([e]).map(filterNode),s=function(e){var s=i[e];s instanceof Node?append(s,t,r):s&&typeof s.render==='function'&&(s.$pointer=textNode(''),append(s.$pointer,t,r),i[e].render(e=>{if(s.$pointer===!1){return!1}for(var n=0;n{if(typeof e==='string'||typeof e==='number'){return e!=='template'?t||e==='svg'?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e):document.createDocumentFragment()}console.warn('[Radi.js] Warn: Creating a JSX element whose query is not of type string, automatically converting query to string.');return document.createElement(e.toString())},explode=(e,t,r,n,o)=>{n===void 0&&(n=0);var i=flatten([e]).map(filterNode);for(var s=0;s{r(e)},i[s],n+1,o));return},parseValue=e=>typeof e==='number'&&!Number.isNaN(e)?`${e}px`:e,setStyles=(e,t,r)=>{t===void 0&&(t={});r===void 0&&(r={});if(!e.html||!e.html[0]){return t}var n=e.html[0];if(t instanceof Listener){if(typeof e.$styleListeners.general!=='undefined'){return n.style}e.$styleListeners.general=t;e.$styleListeners.general.applyDepth(e.depth).init();e.$styleListeners.general.onValueChange(t=>{setStyles(e,t,{})});return n.style}if(typeof t==='string'){n.style=t;return n.style}var o=Object.keys(r).filter(e=>typeof t[e]==='undefined'),i=function(o){if(t.hasOwnProperty(o)){if(typeof r!=='undefined'&&r[o]===t[o]){return}if(!t[o]&&typeof t[o]!=='number'){n.style[o]=null;return}if(t[o] instanceof Listener){if(typeof e.$styleListeners[o]!=='undefined'){return}e.$styleListeners[o]=t[o];e.$styleListeners[o].applyDepth(e.depth).init();e.$styleListeners[o].onValueChange(t=>{setStyles(e,{[o]:t},{})});t[o]=e.$styleListeners[o].value;return}n.style[o]=parseValue(t[o])}};for(var s in t)i(s);for(var u=0;u{if(Array.isArray(e)){return e.filter(e=>e).join(' ')}return e},setAttributes=(e,t,r)=>{t===void 0&&(t={});r===void 0&&(r={});var n=t||{},o=r||{};if(!e.html||!e.html[0]){return e}var i=e.html[0];if(!(i instanceof Node&&i.nodeType!==3)){return e}var s=Object.keys(o).filter(e=>typeof n[e]==='undefined'),u=function(t){if(n.hasOwnProperty(t)){if(typeof o!=='undefined'&&o[t]===n[t]){return}if(!n[t]&&typeof n[t]!=='number'){i.removeAttribute(t);return}(t==='value'||t==='model')&&!(n[t] instanceof Listener)&&(/(checkbox|radio)/.test(i.getAttribute('type'))?(i.checked=n[t]):(i.value=n[t]));if(n[t] instanceof Listener){if(typeof e.$attrListeners[t]!=='undefined'){return}e.$attrListeners[t]=n[t];n[t].applyDepth(e.depth).init();t.toLowerCase()==='model'&&(/(checkbox|radio)/.test(i.getAttribute('type'))?i.addEventListener('change',r=>{e.$attrListeners[t].updateValue(r.target.checked)}):i.addEventListener('input',r=>{e.$attrListeners[t].updateValue(r.target.value)}));e.$attrListeners[t].onValueChange(r=>{setAttributes(e,{[t]:r},{})});n[t]=e.$attrListeners[t].value;return}if(typeof GLOBALS.CUSTOM_ATTRIBUTES[t]!=='undefined'){var r=GLOBALS.CUSTOM_ATTRIBUTES[t],s=r.allowedTags;if(!s||s&&s.length>0&&s.indexOf(i.localName)>=0){typeof GLOBALS.CUSTOM_ATTRIBUTES[t].caller==='function'&&GLOBALS.CUSTOM_ATTRIBUTES[t].caller(i,n[t]);if(!GLOBALS.CUSTOM_ATTRIBUTES[t].addToElement){return}}}if(t.toLowerCase()==='style'){typeof n[t]==='object'?setStyles(e,n[t],o&&o.style||{}):(i.style=n[t]);return}if(t.toLowerCase()==='class'||t.toLowerCase()==='classname'){i.setAttribute('class',parseClass(n[t]));return}if(t.toLowerCase()==='loadfocus'){i.onload=e=>{setTimeout(()=>{e.focus()},10)};return}if(t.toLowerCase()==='html'){i.innerHTML=n[t];return}if(t.substring(0,2).toLowerCase()==='on'&&typeof n[t]==='function'){var u=n[t];t.substring(0,8).toLowerCase()==='onsubmit'?(i[t]=t=>{n.prevent&&t.preventDefault();var r=[],o=t.target.elements||[];for(var i of o){if(i.name!==''&&(i.type!=='radio'&&i.type!=='checkbox')||i.checked){var s={name:i.name,el:i,type:i.type,default:i.defaultValue,value:i.value,set(t){e.el.value=t},reset(t){e.el.value=t;e.el.defaultValue=t}};r.push(s);r[s.name]||Object.defineProperty(r,s.name,{value:s})}}return u(t,r)}):(i[t]=(e,...t)=>u(e,...t));return}i.setAttribute(t,n[t])}};for(var l in n)u(l);for(var a=0;ai[e].parentNode.removeChild(i[e]);typeof i[e].beforedestroy==='function'?i[e].beforedestroy(t):t()}};for(var u=0;u{};this.html=null;this.$destroyed=!0;return!0};Structure.prototype.render=function(e,t,r,n){r===void 0&&(r=0);n===void 0&&(n=!1);this.$depth=Math.max(this.$depth,r);this.$isSvg=n||t&&t.$isSvg||this.query==='svg';if(this.query==='#text'){this.html=[textNode(this.props)];return e(this.html)}if(typeof this.query==='string'||typeof this.query==='number'){this.html=[getElementFromQuery(this.query,this.$isSvg)];setAttributes(this,this.props,{});return e(this.html)}if(this.query instanceof Listener){this.$listener||(this.$listener=this.query.applyDepth(this.$depth).init(),this.mount());return this.query.onValueChange(r=>{if(this.html){var n=this.html[0];this.$pointer?(this.$redirect=patch(this.$redirect,r,this.$pointer,!0,this.$isSvg,this.$depth+1)):(this.$redirect=patch(this.$redirect,r,n,!0,this.$isSvg,this.$depth+1))}else explode(r,t||this,t=>{this.html=t,e(t)},this.$depth+1,this.$isSvg)})}if(this.query instanceof Promise||this.query.constructor.name==='LazyPromise'){return this.query.then(r=>{var n=r.default||r;explode(n,t||this,t=>{this.html=t,e(t)},this.$depth,this.$isSvg)})}if(this.query instanceof Component&&typeof this.query.render==='function'){this.$component=this.query;return explode(this.$component.render(),t||this,t=>{this.html=t,e(t),this.mount()},this.$depth,this.$isSvg)}if(isComponent(this.query)){this.$component||(this.$component=new this.query(this.$compChildren).setProps(this.props));typeof this.$component.render==='function'&&(explode(this.$component.render(),t||this,t=>{this.html=t,e(t)},this.$depth,this.$isSvg),this.mount());return null}if(typeof this.query==='function'){return explode(this.query(this.props),t||this,t=>{this.html=t,e(t)},this.$depth,this.$isSvg)}return e(textNode(this.query))};Structure.prototype.isStructure=function(){return!0};var patch=(e,t,r,n,o,i)=>{n===void 0&&(n=!1);o===void 0&&(o=!1);i===void 0&&(i=0);var s=flatten([e]),u=flatten([t]).map(filterNode),l=Math.max(s.length,u.length),a=function(e){if(typeof s[e]==='undefined'){mount(u[e],r,n,o,i);return}if(typeof u[e]==='undefined'){typeof s[e].destroy==='function'&&s[e].destroy();return}u[e].$depth=i;if((s[e] instanceof Structure||s[e].isStructure)&&(u[e] instanceof Structure||u[e].isStructure)&&s[e]!==u[e]){if(s[e].html&&s[e].query==='#text'&&u[e].query==='#text'){for(var t=0;t0&&(u[e].children=patch(s[e].children,u[e].children,u[e].html[0],!1,u[e].$isSvg,u[e].$depth+1));s[e].destroy();return}var l=s[e],a=u[e];a.$pointer=textNode('');append(a.$pointer,r,n);a.render(t=>{l.$pointer&&(a.$pointer&&a.$pointer.parentNode&&a.$pointer.parentNode.removeChild(a.$pointer),a.$pointer=l.$pointer,l.$pointer=null);for(var r=0;re.charAt(0).toUpperCase()+e.substr(1),Component=function(e,t){this.addNonEnumerableProperties({$id:generateId(),$name:this.constructor.name,$config:typeof this.config==='function'?this.config():{listen:!0},__$events:{},__$privateStore:new PrivateStore});if(typeof this.on!=='function'||typeof this.on==='function'&&typeof this.on()==='object'){throw new Error('[Radi.js] Using `on.eventName()` is deprecated. Please use `onEventName()`.')}this.children=[];for(var r in GLOBALS.HEADLESS_COMPONENTS)this[r]&&typeof this[r].on==='function'&&this[r].on('update',()=>this.setState());this.state=typeof this.state==='function'?this.state():(this.state||{});skipInProductionAndTest(()=>Object.freeze(this.state));e&&this.setChildren(e);t&&this.setProps(t)};Component.prototype.render=function(){if(typeof this.view!=='function'){return null}return this.html=this.view()};Component.prototype.setProps=function(e){var t={},r=this,n=function(n){typeof e[n]==='function'&&n.substr(0,2)==='on'?r.on(n.substring(2,n.length),e[n]):e[n] instanceof Listener?(t[n]=e[n].init().value,e[n].changeListener=(e=>{r.setState({[n]:e})})):(t[n]=e[n])};for(var o in e)n(o);this.setState(t);return this};Component.prototype.setChildren=function(e){this.children=e;this.setState();for(var t=0;tthis.setState());return this};Component.prototype.addNonEnumerableProperties=function(e){for(var t in e){if(typeof this[t]!=='undefined'){continue}Object.defineProperty(this,t,{value:e[t]})}};Component.prototype.addListener=function(e,t,r){this.__$privateStore.addListener(e,t,r)};Component.prototype.mount=function(){this.trigger('mount')};Component.prototype.destroy=function(){this.html=null;this.trigger('destroy');this.__$privateStore.removeListeners()};Component.prototype.when=function(){throw new Error('[Radi.js] Using `.when(\'Event\')` is deprecated. Use `.on(\'Event\')` instead.')};Component.prototype.on=function(e,t){typeof this.__$events[e]==='undefined'&&(this.__$events[e]=[]);this.__$events[e].push(t);return t};Component.prototype.trigger=function(e,...t){var r=this[`on${capitalise(e)}`];typeof r==='function'&&r.call(this,...t);if(typeof this.__$events[e]!=='undefined'){for(var n in this.__$events[e])this.__$events[e][n].call(this,...t)}};Component.prototype.setState=function(e,t){if(typeof e==='object'){var r=this.state;skipInProductionAndTest(()=>r=clone(this.state));this.state=Object.assign(r,e);skipInProductionAndTest(()=>Object.freeze(this.state));this.$config.listen&&this.__$privateStore.setState(e)}!this.$config.listen&&typeof this.view==='function'&&this.html&&(this.html=patch(this.html,this.view()));typeof t==='string'&&typeof this[t]==='function'&&this.trigger(`after${t[0].toUpperCase()}${t.substr(1)}`);this.trigger('update');return e};Component.isComponent=function(){return!0};var isComponent=e=>{if(e){if(e.prototype instanceof Component){return!0}if(e.isComponent){return!0}}return!1},filterNode=e=>{if(Array.isArray(e)){return e.map(filterNode)}if(typeof e==='string'||typeof e==='number'){return r('#text',e)}if(!e||typeof e==='boolean'){return r('#text','')}if(e instanceof Listener){return r(e)}if(isComponent(e)||e instanceof Component){return r(e)}if(typeof e==='function'){return r(e)}if(e instanceof Promise||e.constructor.name==='LazyPromise'){return r(e)}return e},r=(e,t,...r)=>{if(typeof GLOBALS.CUSTOM_TAGS[e]!=='undefined'){return GLOBALS.CUSTOM_TAGS[e].onmount(t||{},r&&flatten([r]).map(filterNode)||[],filterNode,t=>GLOBALS.CUSTOM_TAGS[e].saved=t)||null}if(e==='await'){var n=null;t.src&&t.src instanceof Promise&&t.src.then(e=>{var r=filterNode(typeof t.transform==='function'?t.transform(e):e);n?(n=patch(n,r,n.html[0].parentNode)):(n=r)}).catch(e=>{var r=filterNode(typeof t.error==='function'?t.error(e):t.error);n?(n=patch(n,r,n.html[0].parentNode)):(n=r)});n||(n=filterNode(t.placeholder));return n}if(e==='template'){return new Structure('section',t,flatten([r]).map(filterNode))}return new Structure(e,t,flatten([r]).map(filterNode))},listen=(e,...t)=>new Listener(e,...t),headless=(e,t)=>{var r='$'.concat(e),n=new t;n.mount();Component.prototype[r]=n;return GLOBALS.HEADLESS_COMPONENTS[r]=n},action=(e,t,r)=>{var n=r.value;return{configurable:!0,value(...e){return this.setState.call(this,n.call(this,...e),t)}}},createWorker=e=>{var t=()=>{},r=new window.Blob([`self.onmessage = function(e) { +var GLOBALS={HEADLESS_COMPONENTS:{},FROZEN_STATE:!1,VERSION:'0.4.1',ACTIVE_COMPONENTS:{},CUSTOM_ATTRIBUTES:{},CUSTOM_TAGS:{}},flatten=function e(t){return t.reduce((t,n)=>t.concat(Array.isArray(n)?e(n):n),[])},generateId=()=>{var e='';for(var t=0;t<32;t++){var n=Math.random()*16|0;(t===8||t===12||t===16||t===20)&&(e+='-');e+=(t===12?4:t===16?n&3|8:n).toString(16)}return e},PrivateStore=function(){this.store={}};PrivateStore.prototype.addListener=function(e,t,n){typeof this.store[e]==='undefined'&&this.createItemWrapper(e);this.store[e].listeners[n]=(this.store[e].listeners[n]||[]).filter(e=>e.attached);this.store[e].listeners[n].push(t);return t};PrivateStore.prototype.removeListeners=function(){var e=Object.keys(this.store);for(var t=0;t(t.listeners[e].map(e=>e)));for(var r=0;r=0;o--)n[r][o].attached&&n[r][o].handleUpdate(t.value)}}};var clone=e=>{if(typeof e!=='object'){return e}if(e===null){return e}if(Array.isArray(e)){return e.map(clone)}var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=clone(e[n]));return t},skipInProductionAndTest=e=>{if(typeof process==='undefined'||(process.env.NODE_ENV==='production'||process.env.NODE_ENV==='test')){return!1}return e&&e()},Listener=function(e,...t){var n;this.component=e;(n=t, this.key=n[0]);this.path=t.slice(1,t.length);this.depth=0;this.attached=!0;this.processValue=e=>e;this.changeListener=()=>{};this.addedListeners=[]};Listener.prototype.init=function(){this.value=this.getValue(this.component.state[this.key]);this.component.addListener(this.key,this,this.depth);this.handleUpdate(this.component.state[this.key]);return this};Listener.prototype.unlink=function(){this.value instanceof Node||this.value instanceof Listener&&this.value.deattach()};Listener.prototype.clone=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var o in t)n[o]=t[o];return n};Listener.prototype.setPartialState=function(e,t,n){var r={};if(e.length){r[e[0]]=e.length>1?this.setPartialState(e.slice(1),t,n[e[0]]):t;return this.clone(n,r)}return t};Listener.prototype.updateValue=function(e){var t=this.component.state[this.key];return this.component.setState({[this.key]:this.setPartialState(this.path,e,t)})};Listener.prototype.extractListeners=function(e){if(e instanceof Listener){var t={depth:e.depth,attached:!0,processValue:e=>e,handleUpdate:()=>{this.component&&this.handleUpdate(this.getValue(this.component.state[this.key])),t.attached=!1},changeListener:()=>{}};this.addedListeners.push(t);e.component.addListener(e.key,t,e.depth);var n=e.processValue(e.getValue(e.component.state[e.key]));e.deattach();return this.extractListeners(n)}return e};Listener.prototype.handleUpdate=function(e){var t=this.processValue(this.getValue(e));if(t instanceof Listener){for(var n=0;n{};this.processValue=()=>{}};var onMountEvent=document.createEvent('Event');onMountEvent.initEvent('mount',!0,!0);var onLoadEvent=document.createEvent('Event');onLoadEvent.initEvent('load',!0,!0);var append=(e,t,n)=>{typeof e.dispatchEvent==='function'&&e.dispatchEvent(onLoadEvent);if(n&&t){t.parentNode&&(t.parentNode.insertBefore(e,t),typeof e.dispatchEvent==='function'&&e.dispatchEvent(onMountEvent));return e}t.appendChild(e);typeof e.dispatchEvent==='function'&&e.dispatchEvent(onMountEvent);return e},getLast=e=>{if(e.$redirect&&e.$redirect[e.$redirect.length-1]){return getLast(e.$redirect[e.$redirect.length-1])}return e},mountChildren=(e,t,n)=>{n===void 0&&(n=0);if(!e){return}e.$redirect&&e.$redirect.length>0?mountChildren(getLast(e),t,n+1):e.children&&e.children.length>0&&(e.html&&e.html.length===1?mount(e.children,e.html[0],e.html[0].nodeType!==1,e.$isSvg,e.$depth):mount(e.children,e.$pointer,!0,e.$isSvg,e.$depth))},textNode=e=>(document.createTextNode((typeof e==='object'?JSON.stringify(e):e))),mount=(e,t,n,r,o)=>{n===void 0&&(n=!1);r===void 0&&(r=!1);o===void 0&&(o=0);t=typeof t==='string'?document.getElementById(t):t;var i=flatten([e]).map(filterNode),s=function(e){var s=i[e];s instanceof Node?append(s,t,n):s&&typeof s.render==='function'&&(s.$pointer=textNode(''),append(s.$pointer,t,n),i[e].render(e=>{if(s.$pointer===!1){return!1}for(var r=0;r{if(typeof e==='string'||typeof e==='number'){return e!=='template'?t||e==='svg'?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e):document.createDocumentFragment()}console.warn('[Radi.js] Warn: Creating a JSX element whose query is not of type string, automatically converting query to string.');return document.createElement(e.toString())},explode=(e,t,n,r,o)=>{r===void 0&&(r=0);var i=flatten([e]).map(filterNode);for(var s=0;s{n(e)},i[s],r+1,o));return},parseValue=e=>typeof e==='number'&&!Number.isNaN(e)?`${e}px`:e,setStyles=(e,t,n)=>{t===void 0&&(t={});n===void 0&&(n={});if(!e.html||!e.html[0]){return t}var r=e.html[0];if(t instanceof Listener){if(typeof e.$styleListeners.general!=='undefined'){return r.style}e.$styleListeners.general=t;e.$styleListeners.general.applyDepth(e.depth).init();e.$styleListeners.general.onValueChange(t=>{setStyles(e,t,{})});return r.style}if(typeof t==='string'){r.style=t;return r.style}var o=Object.keys(n).filter(e=>typeof t[e]==='undefined'),i=function(o){if(t.hasOwnProperty(o)){if(typeof n!=='undefined'&&n[o]===t[o]){return}if(!t[o]&&typeof t[o]!=='number'){r.style[o]=null;return}if(t[o] instanceof Listener){if(typeof e.$styleListeners[o]!=='undefined'){return}e.$styleListeners[o]=t[o];e.$styleListeners[o].applyDepth(e.depth).init();e.$styleListeners[o].onValueChange(t=>{setStyles(e,{[o]:t},{})});t[o]=e.$styleListeners[o].value;return}r.style[o]=parseValue(t[o])}};for(var s in t)i(s);for(var u=0;u{if(Array.isArray(e)){return e.filter(e=>e).join(' ')}return e},setAttributes=(e,t,n)=>{t===void 0&&(t={});n===void 0&&(n={});var r=t||{},o=n||{};if(!e.html||!e.html[0]){return e}var i=e.html[0];if(!(i instanceof Node&&i.nodeType!==3)){return e}var s=Object.keys(o).filter(e=>typeof r[e]==='undefined'),u=function(t){if(r.hasOwnProperty(t)){if(typeof o!=='undefined'&&o[t]===r[t]){return}t==='checked'&&(i.checked=r[t]);if(!r[t]&&typeof r[t]!=='number'&&typeof r[t]!=='string'){i.removeAttribute(t);return}if(r[t] instanceof Listener){if(typeof e.$attrListeners[t]!=='undefined'){return}e.$attrListeners[t]=r[t];r[t].applyDepth(e.depth).init();(t.toLowerCase()==='model'||t.toLowerCase()==='checked')&&(i.getAttribute('type')==='radio'?(i.addEventListener('input',n=>{e.$attrListeners[t].updateValue(n.target.checked&&n.target.value||n.target.checked)},!1),e.$attrListeners[t].onValueChange(t=>{setAttributes(e,{checked:i.value===t&&Boolean(t)},{})})):i.getAttribute('type')==='checkbox'?(i.addEventListener('input',n=>{e.$attrListeners[t].updateValue(Boolean(n.target.checked))},!1),e.$attrListeners[t].onValueChange(t=>{setAttributes(e,{checked:Boolean(t)},{})})):i.addEventListener('input',n=>{e.$attrListeners[t].updateValue(n.target.value)},!1));/(checkbox|radio)/.test(i.getAttribute('type'))||e.$attrListeners[t].onValueChange(n=>{setAttributes(e,{[t]:n},{})});r[t]=e.$attrListeners[t].value;return}(t==='value'||t==='model')&&(i.value=r[t]);if(typeof GLOBALS.CUSTOM_ATTRIBUTES[t]!=='undefined'){var n=GLOBALS.CUSTOM_ATTRIBUTES[t],s=n.allowedTags;if(!s||s&&s.length>0&&s.indexOf(i.localName)>=0){typeof GLOBALS.CUSTOM_ATTRIBUTES[t].caller==='function'&&GLOBALS.CUSTOM_ATTRIBUTES[t].caller(i,r[t]);if(!GLOBALS.CUSTOM_ATTRIBUTES[t].addToElement){return}}}if(t.toLowerCase()==='style'){typeof r[t]==='object'?setStyles(e,r[t],o&&o.style||{}):(i.style=r[t]);return}if(t.toLowerCase()==='class'||t.toLowerCase()==='classname'){i.setAttribute('class',parseClass(r[t]));return}if(t.toLowerCase()==='loadfocus'){i.addEventListener('mount',()=>{i.focus()},!1);return}if(t.toLowerCase()==='html'){i.innerHTML=r[t];return}if(t.substring(0,2).toLowerCase()==='on'&&typeof r[t]==='function'){var u=r[t];t.substring(0,8).toLowerCase()==='onsubmit'?(i[t]=t=>{r.prevent&&t.preventDefault();var n=[],o=t.target.elements||[];for(var i of o){if(i.name!==''&&(i.type!=='radio'&&i.type!=='checkbox')||i.checked){var s={name:i.name,el:i,type:i.type,default:i.defaultValue,value:i.value,set(t){e.el.value=t},reset(t){e.el.value=t;e.el.defaultValue=t}};n.push(s);n[s.name]||Object.defineProperty(n,s.name,{value:s})}}return u(t,n)}):(i[t]=(e,...t)=>u(e,...t));return}i.setAttribute(t,r[t])}};for(var a in r)u(a);for(var l=0;li[e].parentNode.removeChild(i[e]);typeof i[e].beforedestroy==='function'?i[e].beforedestroy(t):t()}};for(var u=0;u{};this.html=null;this.$destroyed=!0;return!0};Structure.prototype.render=function(e,t,n,r){n===void 0&&(n=0);r===void 0&&(r=!1);this.$depth=Math.max(this.$depth,n);this.$isSvg=r||t&&t.$isSvg||this.query==='svg';if(this.query==='#text'){this.html=[textNode(this.props)];return e(this.html)}if(typeof this.query==='string'||typeof this.query==='number'){this.html=[getElementFromQuery(this.query,this.$isSvg)];setAttributes(this,this.props,{});return e(this.html)}if(this.query instanceof Listener){this.$listener||(this.$listener=this.query.applyDepth(this.$depth).init(),this.mount());return this.query.onValueChange(n=>{if(this.html){var r=this.html[0];this.$pointer?(this.$redirect=patch(this.$redirect,n,this.$pointer,!0,this.$isSvg,this.$depth+1)):(this.$redirect=patch(this.$redirect,n,r,!0,this.$isSvg,this.$depth+1))}else explode(n,t||this,t=>{this.html=t,e(t)},this.$depth+1,this.$isSvg)})}if(this.query instanceof Promise||this.query.constructor.name==='LazyPromise'){return this.query.then(n=>{var r=n.default||n;explode(r,t||this,t=>{this.html=t,e(t)},this.$depth,this.$isSvg)})}if(this.query instanceof Component&&typeof this.query.render==='function'){this.$component=this.query;return explode(this.$component.render(),t||this,t=>{this.html=t,e(t),this.mount()},this.$depth,this.$isSvg)}if(isComponent(this.query)){this.$component||(this.$component=new this.query(this.$compChildren).setProps(this.props));typeof this.$component.render==='function'&&(explode(this.$component.render(),t||this,t=>{this.html=t,e(t)},this.$depth,this.$isSvg),this.mount());return null}if(typeof this.query==='function'){return explode(this.query(this.props),t||this,t=>{this.html=t,e(t)},this.$depth,this.$isSvg)}return e(textNode(this.query))};Structure.prototype.isStructure=function(){return!0};var patch=(e,t,n,r,o,i)=>{r===void 0&&(r=!1);o===void 0&&(o=!1);i===void 0&&(i=0);var s=flatten([e]),u=flatten([t]).map(filterNode),a=Math.max(s.length,u.length),l=function(e){if(typeof s[e]==='undefined'){mount(u[e],n,r,o,i);return}if(typeof u[e]==='undefined'){typeof s[e].destroy==='function'&&s[e].destroy();return}u[e].$depth=i;if((s[e] instanceof Structure||s[e].isStructure)&&(u[e] instanceof Structure||u[e].isStructure)&&s[e]!==u[e]){if(s[e].html&&s[e].query==='#text'&&u[e].query==='#text'){for(var t=0;t0&&(u[e].children=patch(s[e].children,u[e].children,u[e].html[0],!1,u[e].$isSvg,u[e].$depth+1));s[e].destroy();return}var a=s[e],l=u[e];l.$pointer=textNode('');append(l.$pointer,n,r);l.render(t=>{a.$pointer&&(l.$pointer&&l.$pointer.parentNode&&l.$pointer.parentNode.removeChild(l.$pointer),l.$pointer=a.$pointer,a.$pointer=null);for(var n=0;ne.charAt(0).toUpperCase()+e.substr(1),Component=function(e,t){this.addNonEnumerableProperties({$id:generateId(),$name:this.constructor.name,$config:typeof this.config==='function'?this.config():{listen:!0},__$events:{},__$privateStore:new PrivateStore});if(typeof this.on!=='function'||typeof this.on==='function'&&typeof this.on()==='object'){throw new Error('[Radi.js] Using `on.eventName()` is deprecated. Please use `onEventName()`.')}this.children=[];for(var n in GLOBALS.HEADLESS_COMPONENTS)this[n]&&typeof this[n].on==='function'&&this[n].on('update',()=>this.setState());this.state=typeof this.state==='function'?this.state():(this.state||{});skipInProductionAndTest(()=>Object.freeze(this.state));e&&this.setChildren(e);t&&this.setProps(t)};Component.prototype.render=function(){if(typeof this.view!=='function'){return null}return this.html=this.view()};Component.prototype.setProps=function(e){var t={},n=this,r=function(r){typeof e[r]==='function'&&r.substr(0,2)==='on'?n.on(r.substring(2,r.length),e[r]):e[r] instanceof Listener?(t[r]=e[r].init().value,e[r].changeListener=(e=>{n.setState({[r]:e})})):(t[r]=e[r])};for(var o in e)r(o);this.setState(t);return this};Component.prototype.setChildren=function(e){this.children=e;this.setState();for(var t=0;tthis.setState());return this};Component.prototype.addNonEnumerableProperties=function(e){for(var t in e){if(typeof this[t]!=='undefined'){continue}Object.defineProperty(this,t,{value:e[t]})}};Component.prototype.addListener=function(e,t,n){this.__$privateStore.addListener(e,t,n)};Component.prototype.mount=function(){this.trigger('mount')};Component.prototype.destroy=function(){this.html=null;this.trigger('destroy');this.__$privateStore.removeListeners()};Component.prototype.when=function(){throw new Error('[Radi.js] Using `.when(\'Event\')` is deprecated. Use `.on(\'Event\')` instead.')};Component.prototype.on=function(e,t){typeof this.__$events[e]==='undefined'&&(this.__$events[e]=[]);this.__$events[e].push(t);return t};Component.prototype.trigger=function(e,...t){var n=this[`on${capitalise(e)}`];typeof n==='function'&&n.call(this,...t);if(typeof this.__$events[e]!=='undefined'){for(var r in this.__$events[e])this.__$events[e][r].call(this,...t)}};Component.prototype.setState=function(e,t){if(typeof e==='object'){var n=this.state;skipInProductionAndTest(()=>n=clone(this.state));this.state=Object.assign(n,e);skipInProductionAndTest(()=>Object.freeze(this.state));this.$config.listen&&this.__$privateStore.setState(e)}!this.$config.listen&&typeof this.view==='function'&&this.html&&(this.html=patch(this.html,this.view()));typeof t==='string'&&typeof this[t]==='function'&&this.trigger(`after${capitalise(t)}`,e);this.trigger('update');return e};Component.isComponent=function(){return!0};var isComponent=e=>{if(e){if(e.prototype instanceof Component){return!0}if(e.isComponent){return!0}}return!1},filterNode=e=>{if(Array.isArray(e)){return e.map(filterNode)}if(typeof e==='string'||typeof e==='number'){return r('#text',e)}if(!e||typeof e==='boolean'){return r('#text','')}if(e instanceof Listener){return r(e)}if(isComponent(e)||e instanceof Component){return r(e)}if(typeof e==='function'){return r(e)}if(e instanceof Promise||e.constructor.name==='LazyPromise'){return r(e)}return e},r=(e,t,...n)=>{if(typeof GLOBALS.CUSTOM_TAGS[e]!=='undefined'){return GLOBALS.CUSTOM_TAGS[e].onmount(t||{},n&&flatten([n]).map(filterNode)||[],filterNode,t=>GLOBALS.CUSTOM_TAGS[e].saved=t)||null}if(e==='await'){var r=null;t.src&&t.src instanceof Promise&&t.src.then(e=>{var n=filterNode(typeof t.transform==='function'?t.transform(e):e);r?(r=patch(r,n,r.html[0].parentNode)):(r=n)}).catch(e=>{var n=filterNode(typeof t.error==='function'?t.error(e):t.error);r?(r=patch(r,n,r.html[0].parentNode)):(r=n)});r||(r=filterNode(t.placeholder));return r}if(e==='template'){return new Structure('section',t,flatten([n]).map(filterNode))}return new Structure(e,t,flatten([n]).map(filterNode))},listen=(e,...t)=>new Listener(e,...t),headless=(e,t)=>{var n='$'.concat(e),r=new t;r.mount();Component.prototype[n]=r;return GLOBALS.HEADLESS_COMPONENTS[n]=r},action=(e,t,n)=>{var r=n.value;return{configurable:!0,value(...e){return this.setState.call(this,r.call(this,...e),t)}}},createWorker=e=>{var t=()=>{},n=new window.Blob([`self.onmessage = function(e) { self.postMessage((${e.toString()})(e.data)); - }`],{type:'text/javascript'}),n=window.URL.createObjectURL(r),o=new window.Worker(n);o.onmessage=e=>{t(e.data,null)};o.onerror=e=>{t(null,e.data)};return e=>new Promise((r,n)=>{t=(e,t)=>!t?r(e):n(e),o.postMessage(e)})},worker=(e,t,r)=>{var n=r.value,o=createWorker(n);r.value=function(...e){o(...e).then(e=>{this.setState.call(this,e)})};return r},subscribe=(e,t)=>(r,n,o)=>{var i=o.value,s=()=>{};if(typeof i!=='function'){throw new Error(`@subscribe decorator can only be applied to methods not: ${typeof i}`)}var u=!1;e[t]=(...e)=>s(...e);return{configurable:!0,get(){if(u||this===r.prototype||this.hasOwnProperty(n)||typeof i!=='function'){return i}s=i.bind(this);u=!0;Object.defineProperty(this,n,{configurable:!0,get(){return s},set(e){i=e;delete this[n]}});u=!1;return s},set(e){i=e}}},customTag=(e,t,r)=>GLOBALS.CUSTOM_TAGS[e]={name:e,onmount:t||(()=>{}),ondestroy:r||(()=>{}),saved:null},customAttribute=(e,t,r)=>{r===void 0&&(r={});var n=r.allowedTags,o=r.addToElement;return GLOBALS.CUSTOM_ATTRIBUTES[e]={name:e,caller:t,allowedTags:n||null,addToElement:o}},remountActiveComponents=()=>{Object.values(GLOBALS.ACTIVE_COMPONENTS).forEach(e=>{typeof e.onMount==='function'&&e.onMount(e)})},animate=(e,t,r,n)=>{var o=r[t];if(typeof o!=='function'){console.warn(`[Radi.js] Animation \`${t}\` for node \`${e.nodeName.toLowerCase}\` should be function`);return}return o(e,n)};customAttribute('animation',(e,t)=>{animate(e,'in',t,()=>{}),e.beforedestroy=r=>animate(e,'out',t,r)});var Modal=(function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e);t.prototype=Object.create(e&&e.prototype);t.prototype.constructor=t;t.prototype.state=function(){return{registry:{}}};t.prototype.register=function(e,t){if(typeof this.state.registry[e]!=='undefined'){console.warn(`[Radi.js] Warn: Modal with name "${e}" is already registerd!`);return}this.setState({registry:Object.assign({},this.state.registry,{[e]:{status:!1,element:t}})})};t.prototype.exists=function(e){if(typeof this.state.registry[e]==='undefined'){console.warn(`[Radi.js] Warn: Modal with name "${e}" is not registerd!`);return!1}return!0};t.prototype.open=function(e){if(!this.exists(e)||this.state.registry[e].status){return}return this.setState({registry:Object.assign({},this.state.registry,{[e]:{status:!0,element:this.state.registry[e].element}})})};t.prototype.close=function(e){if(!this.exists(e)||!this.state.registry[e].status){return}return this.setState({registry:Object.assign({},this.state.registry,{[e]:{status:!1,element:this.state.registry[e].element}})})};t.prototype.closeAll=function(){var e=Object.keys(this.state.registry),t=e.reduce((e,t)=>Object.assign(e,{[t]:{status:!1,element:this.state.registry[t].element}}),{});return this.setState({registry:t})};return t}(Component)),$modal=headless('modal',Modal);customTag('modal',(e,t,n)=>{var o=e.name||'default';$modal.register(o,null);typeof e.name==='undefined'&&console.warn('[Radi.js] Warn: Every tag needs to have `name` attribute!');mount(listen($modal,'registry',o).process(e=>e.status&&r('div',{class:'radi-modal',name:o},r('div',{class:'radi-modal-backdrop',onclick:()=>$modal.close(o)}),r('div',{class:'radi-modal-content'},...(t.slice())))),document.body);return n(null)},()=>{});var Radi={version:GLOBALS.VERSION,activeComponents:GLOBALS.ACTIVE_COMPONENTS,r,listen,l:listen,worker,Component,component:Component,action,subscribe,customTag,customAttribute,headless,update:patch,patch,mount,freeze:()=>{GLOBALS.FROZEN_STATE=!0},unfreeze:()=>{GLOBALS.FROZEN_STATE=!1,remountActiveComponents()}};Radi.plugin=(e,...t)=>e(Radi,...t);window&&(window.Radi=Radi);export default Radi \ No newline at end of file + }`],{type:'text/javascript'}),r=window.URL.createObjectURL(n),o=new window.Worker(r);o.onmessage=e=>{t(e.data,null)};o.onerror=e=>{t(null,e.data)};return e=>new Promise((n,r)=>{t=(e,t)=>!t?n(e):r(e),o.postMessage(e)})},worker=(e,t,n)=>{var r=n.value,o=createWorker(r);n.value=function(...e){o(...e).then(e=>{this.setState.call(this,e)})};return n},subscribe=(e,t)=>(n,r,o)=>{var i=o.value,s=()=>{};if(typeof i!=='function'){throw new Error(`@subscribe decorator can only be applied to methods not: ${typeof i}`)}var u=!1;e[t]=(...e)=>s(...e);return{configurable:!0,get(){if(u||this===n.prototype||this.hasOwnProperty(r)||typeof i!=='function'){return i}s=i.bind(this);u=!0;Object.defineProperty(this,r,{configurable:!0,get(){return s},set(e){i=e;delete this[r]}});u=!1;return s},set(e){i=e}}},customTag=(e,t,n)=>GLOBALS.CUSTOM_TAGS[e]={name:e,onmount:t||(()=>{}),ondestroy:n||(()=>{}),saved:null},customAttribute=(e,t,n)=>{n===void 0&&(n={});var r=n.allowedTags,o=n.addToElement;return GLOBALS.CUSTOM_ATTRIBUTES[e]={name:e,caller:t,allowedTags:r||null,addToElement:o}},remountActiveComponents=()=>{Object.values(GLOBALS.ACTIVE_COMPONENTS).forEach(e=>{typeof e.onMount==='function'&&e.onMount(e)})},animate=(e,t,n,r)=>{var o=n[t];if(typeof o!=='function'){console.warn(`[Radi.js] Animation \`${t}\` for node \`${e.nodeName.toLowerCase}\` should be function`);return}return o(e,r)};customAttribute('animation',(e,t)=>{animate(e,'in',t,()=>{}),e.beforedestroy=n=>animate(e,'out',t,n)});var Modal=(function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e);t.prototype=Object.create(e&&e.prototype);t.prototype.constructor=t;t.prototype.state=function(){return{registry:{}}};t.prototype.register=function(e,t){if(typeof this.state.registry[e]!=='undefined'){console.warn(`[Radi.js] Warn: Modal with name "${e}" is already registerd!`);return}this.setState({registry:Object.assign({},this.state.registry,{[e]:{status:!1,element:t}})},'register')};t.prototype.exists=function(e){if(typeof this.state.registry[e]==='undefined'){console.warn(`[Radi.js] Warn: Modal with name "${e}" is not registerd!`);return!1}return!0};t.prototype.open=function(e){if(!this.exists(e)||this.state.registry[e].status){return}return this.setState({registry:Object.assign({},this.state.registry,{[e]:{status:!0,element:this.state.registry[e].element}})},'open')};t.prototype.close=function(e){if(!this.exists(e)||!this.state.registry[e].status){return}return this.setState({registry:Object.assign({},this.state.registry,{[e]:{status:!1,element:this.state.registry[e].element}})},'close')};t.prototype.closeAll=function(){var e=Object.keys(this.state.registry),t=e.reduce((e,t)=>Object.assign(e,{[t]:{status:!1,element:this.state.registry[t].element}}),{});return this.setState({registry:t},'closeAll')};return t}(Component)),$modal=headless('modal',Modal);customTag('modal',(e,t,n)=>{var o=e.name||'default';$modal.register(o,null);typeof e.name==='undefined'&&console.warn('[Radi.js] Warn: Every tag needs to have `name` attribute!');var i=mount(listen($modal,'registry',o).process(e=>e.status&&r('div',{class:'radi-modal',name:o},r('div',{class:'radi-modal-backdrop',onclick:()=>$modal.close(o)}),r('div',{class:'radi-modal-content'},...(t.slice())))),document.body),s=n(null);s.onDestroy=()=>{for(var e=0;e{});var Radi={version:GLOBALS.VERSION,activeComponents:GLOBALS.ACTIVE_COMPONENTS,r,listen,l:listen,worker,Component,component:Component,action,subscribe,customTag,customAttribute,headless,update:patch,patch,mount,freeze:()=>{GLOBALS.FROZEN_STATE=!0},unfreeze:()=>{GLOBALS.FROZEN_STATE=!1,remountActiveComponents()}};Radi.plugin=(e,...t)=>e(Radi,...t);window&&(window.Radi=Radi);export default Radi \ No newline at end of file diff --git a/dist/radi.js b/dist/radi.js index 78b617d..55d3969 100644 --- a/dist/radi.js +++ b/dist/radi.js @@ -7,7 +7,7 @@ var GLOBALS = { HEADLESS_COMPONENTS: {}, FROZEN_STATE: false, - VERSION: '0.4.0', + VERSION: '0.4.1', // TODO: Collect active components ACTIVE_COMPONENTS: {}, CUSTOM_ATTRIBUTES: {}, @@ -389,6 +389,12 @@ this.processValue = () => {}; }; + var onMountEvent = document.createEvent('Event'); + onMountEvent.initEvent('mount', true, true); + + var onLoadEvent = document.createEvent('Event'); + onLoadEvent.initEvent('load', true, true); + /** * Append dom node to dom tree (after - (true) should append after 'to' element * or (false) inside it) @@ -398,9 +404,16 @@ * @returns {HTMLElement} */ var append = (node, to, after) => { + if (typeof node.dispatchEvent === 'function') { + node.dispatchEvent(onLoadEvent); + } + if (after && to) { if (to.parentNode) { to.parentNode.insertBefore(node, to); + if (typeof node.dispatchEvent === 'function') { + node.dispatchEvent(onMountEvent); + } // if (!to.nextSibling) { // to.parentNode.appendChild(node); // } else { @@ -410,7 +423,13 @@ return node; } - return to.appendChild(node); + to.appendChild(node); + + if (typeof node.dispatchEvent === 'function') { + node.dispatchEvent(onMountEvent); + } + + return node; }; var getLast = (child) => { @@ -720,44 +739,61 @@ // Skip if proprs are the same if (typeof oldProps !== 'undefined' && oldProps[prop] === props[prop]) { return; } + if (prop === 'checked') { + element.checked = props[prop]; + } + // Need to remove falsy attribute - if (!props[prop] && typeof props[prop] !== 'number') { + if (!props[prop] && typeof props[prop] !== 'number' && typeof props[prop] !== 'string') { element.removeAttribute(prop); return; } - if ((prop === 'value' || prop === 'model') && !(props[prop] instanceof Listener)) { - if (/(checkbox|radio)/.test(element.getAttribute('type'))) { - element.checked = props[prop]; - } else { - element.value = props[prop]; - } - } - // Handle Listeners if (props[prop] instanceof Listener) { if (typeof structure.$attrListeners[prop] !== 'undefined') { return; } structure.$attrListeners[prop] = props[prop]; props[prop].applyDepth(structure.depth).init(); - if (prop.toLowerCase() === 'model') { - if (/(checkbox|radio)/.test(element.getAttribute('type'))) { - element.addEventListener('change', (e) => { - structure.$attrListeners[prop].updateValue(e.target.checked); + if (prop.toLowerCase() === 'model' || prop.toLowerCase() === 'checked') { + if (element.getAttribute('type') === 'radio') { + element.addEventListener('input', (e) => { + structure.$attrListeners[prop].updateValue( + (e.target.checked && e.target.value) + || e.target.checked + ); + }, false); + structure.$attrListeners[prop].onValueChange(value => { + setAttributes(structure, { + checked: element.value === value && Boolean(value), + }, {}); + }); + } else + if (element.getAttribute('type') === 'checkbox') { + element.addEventListener('input', (e) => { + structure.$attrListeners[prop].updateValue( + Boolean(e.target.checked) + ); + }, false); + structure.$attrListeners[prop].onValueChange(value => { + setAttributes(structure, { + checked: Boolean(value), + }, {}); }); } else { element.addEventListener('input', (e) => { structure.$attrListeners[prop].updateValue(e.target.value); - }); + }, false); } } - structure.$attrListeners[prop].onValueChange(value => { - setAttributes(structure, { - [prop]: value, - }, {}); - // props[prop] = value; - }); + if (!/(checkbox|radio)/.test(element.getAttribute('type'))) { + structure.$attrListeners[prop].onValueChange(value => { + setAttributes(structure, { + [prop]: value, + }, {}); + }); + } // structure.setProps(Object.assign(structure.data.props, { // [prop]: props[prop].value, @@ -766,6 +802,10 @@ return; } + if (prop === 'value' || prop === 'model') { + element.value = props[prop]; + } + if (typeof GLOBALS.CUSTOM_ATTRIBUTES[prop] !== 'undefined') { var ref = GLOBALS.CUSTOM_ATTRIBUTES[prop]; var allowedTags = ref.allowedTags; @@ -799,11 +839,9 @@ } if (prop.toLowerCase() === 'loadfocus') { - element.onload = (el) => { - setTimeout(() => { - el.focus(); - }, 10); - }; + element.addEventListener('mount', () => { + element.focus(); + }, false); return; } @@ -885,7 +923,6 @@ if ( props === void 0 ) props = {}; if ( depth === void 0 ) depth = 0; - // console.log('H', query, children) this.query = query; this.props = Boolean !== props ? props : {}; if (isComponent(query) || query instanceof Component) { @@ -909,18 +946,20 @@ Structure.prototype.mount = function mount () { this.$destroyed = false; - // console.warn('[mounted]', this) if (this.$component instanceof Component) { this.$component.mount(); } + + if (typeof this.onMount === 'function') { + this.onMount(); + } }; Structure.prototype.destroy = function destroy (childrenToo) { if ( childrenToo === void 0 ) childrenToo = true; if (this.$destroyed) { return false; } - // console.warn('[destroyed]', this, this.html, this.$redirect) for (var l in this.$styleListeners) { if (this.$styleListeners[l] @@ -979,6 +1018,11 @@ if (this.$pointer && this.$pointer.parentNode) { this.$pointer.parentNode.removeChild(this.$pointer); } + + if (typeof this.onDestroy === 'function') { + this.onDestroy(); + } + this.$pointer = null; this.$redirect = null; this.$component = null; @@ -1445,7 +1489,7 @@ } if (typeof actionName === 'string' && typeof this[actionName] === 'function') { - this.trigger(`after${actionName[0].toUpperCase()}${actionName.substr(1)}`); + this.trigger(`after${capitalise(actionName)}`, newState); } // if (typeof newState === 'object') { @@ -1793,7 +1837,7 @@ element, }, }), - }); + }, 'register'); }; Modal.prototype.exists = function exists (name) { @@ -1815,7 +1859,7 @@ element: this.state.registry[name].element, }, }), - }); + }, 'open'); }; Modal.prototype.close = function close (name) { @@ -1828,7 +1872,7 @@ element: this.state.registry[name].element, }, }), - }); + }, 'close'); }; Modal.prototype.closeAll = function closeAll () { @@ -1842,7 +1886,7 @@ return this.setState({ registry, - }); + }, 'closeAll'); }; return Modal; @@ -1860,7 +1904,7 @@ console.warn('[Radi.js] Warn: Every tag needs to have `name` attribute!'); } - mount(listen($modal, 'registry', name) + var mounted = mount(listen($modal, 'registry', name) .process(v => ( v.status && r('div', { class: 'radi-modal', name }, @@ -1875,7 +1919,15 @@ ) )), document.body); - return buildNode(null); + var treeSitter = buildNode(null); + + treeSitter.onDestroy = () => { + for (var i = 0; i < mounted.length; i++) { + if (typeof mounted[i].destroy === 'function') { mounted[i].destroy(); } + } + }; + + return treeSitter; }, () => { // Destroyed `element` } diff --git a/dist/radi.js.map b/dist/radi.js.map index 9c3980f..abc7d10 100644 --- a/dist/radi.js.map +++ b/dist/radi.js.map @@ -1 +1 @@ -{"version":3,"file":"radi.js","sources":["../src/consts/GLOBALS.js","../src/utils/flatten.js","../src/utils/generateId.js","../src/component/utils/PrivateStore.js","../src/utils/clone.js","../src/utils/skipInProductionAndTest.js","../src/listen/Listener.js","../src/r/utils/append.js","../src/r/mountChildren.js","../src/r/utils/textNode.js","../src/mount.js","../src/r/utils/getElementFromQuery.js","../src/r/utils/explode.js","../src/r/utils/parseValue.js","../src/r/setStyles.js","../src/r/utils/parseClass.js","../src/r/setAttributes.js","../src/r/Structure.js","../src/r/patch.js","../src/component/Component.js","../src/component/utils/isComponent.js","../src/r/utils/filterNode.js","../src/r/index.js","../src/listen/index.js","../src/component/headless.js","../src/action/index.js","../src/action/worker.js","../src/action/subscribe.js","../src/r/customTag.js","../src/r/customAttribute.js","../src/utils/remountActiveComponents.js","../src/custom/attributes/animation.js","../src/custom/modal.js","../src/index.js"],"sourcesContent":["const GLOBALS = {\n HEADLESS_COMPONENTS: {},\n FROZEN_STATE: false,\n VERSION: '0.4.0',\n // TODO: Collect active components\n ACTIVE_COMPONENTS: {},\n CUSTOM_ATTRIBUTES: {},\n CUSTOM_TAGS: {},\n};\n\nexport default GLOBALS;\n","\n/**\n * @param {*[]} list\n * @returns {*[]}\n */\nconst flatten = function flatten(list) {\n return list.reduce((a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), []);\n};\n\nexport default flatten;\n","/**\n * UUID v4 generator\n * https://gist.github.com/jcxplorer/823878\n * @returns {string}\n */\nconst generateId = () => {\n let uuid = '';\n for (let i = 0; i < 32; i++) {\n const random = (Math.random() * 16) | 0; // eslint-disable-line\n\n if (i === 8 || i === 12 || i === 16 || i === 20) {\n uuid += '-';\n }\n uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16); // eslint-disable-line\n }\n return uuid;\n};\n\nexport default generateId;\n","export default class PrivateStore {\n constructor() {\n this.store = {};\n }\n\n /**\n * @param {string} key\n * @param {Listener} listener\n * @param {number} depth\n */\n addListener(key, listener, depth) {\n if (typeof this.store[key] === 'undefined') {\n this.createItemWrapper(key);\n }\n this.store[key].listeners[depth] = (this.store[key].listeners[depth] || []).filter(item => (\n item.attached\n ));\n this.store[key].listeners[depth].push(listener);\n\n return listener;\n }\n\n /**\n * Removes all listeners for all keys\n */\n removeListeners() {\n let o = Object.keys(this.store);\n for (var i = 0; i < o.length; i++) {\n this.store[o[i]].listeners = {};\n this.store[o[i]].value = null;\n }\n }\n\n /**\n * setState\n * @param {*} newState\n * @returns {*}\n */\n setState(newState) {\n // Find and trigger changes for listeners\n for (const key of Object.keys(newState)) {\n if (typeof this.store[key] === 'undefined') {\n this.createItemWrapper(key);\n }\n this.store[key].value = newState[key];\n\n this.triggerListeners(key);\n }\n return newState;\n }\n\n /**\n * createItemWrapper\n * @private\n * @param {string} key\n * @returns {object}\n */\n createItemWrapper(key) {\n return this.store[key] = {\n listeners: {},\n value: null,\n };\n }\n\n /**\n * triggerListeners\n * @private\n * @param {string} key\n */\n triggerListeners(key) {\n const item = this.store[key];\n if (item) {\n let clone = Object.keys(item.listeners)\n .sort()\n .map(key => (\n item.listeners[key].map(listener => listener)\n ));\n\n for (var i = 0; i < clone.length; i++) {\n for (var n = clone[i].length - 1; n >= 0; n--) {\n if (clone[i][n].attached) clone[i][n].handleUpdate(item.value)\n }\n }\n }\n }\n}\n","/**\n * @param {*} obj\n * @returns {*}\n */\nconst clone = obj => {\n if (typeof obj !== 'object') return obj;\n if (obj === null) return obj;\n if (Array.isArray(obj)) return obj.map(clone);\n\n /*eslint-disable*/\n // Reverted as currently throws some errors\n const cloned = {};\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n cloned[key] = clone(obj[key]);\n }\n }\n /* eslint-enable */\n\n return cloned;\n};\n\nexport default clone;\n","const skipInProductionAndTest = fn => {\n if (typeof process === 'undefined'\n || (process.env.NODE_ENV === 'production'\n || process.env.NODE_ENV === 'test')) {\n return false;\n }\n return fn && fn();\n};\n\nexport default skipInProductionAndTest;\n","/* eslint-disable no-param-reassign */\n/* eslint-disable no-shadow */\n/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\n// import fuseDom from '../r/utils/fuseDom';\n\nexport default class Listener {\n /**\n * @param {Component} component\n * @param {...string} path\n */\n constructor(component, ...path) {\n this.component = component;\n [this.key] = path;\n this.path = path.slice(1, path.length);\n this.depth = 0;\n this.attached = true;\n this.processValue = value => value;\n this.changeListener = () => {};\n this.addedListeners = [];\n }\n\n /**\n * Applies values and events to listener\n */\n init() {\n this.value = this.getValue(this.component.state[this.key]);\n this.component.addListener(this.key, this, this.depth);\n this.handleUpdate(this.component.state[this.key]);\n return this;\n }\n\n /**\n * Removes last active value with destroying listeners and\n * @param {*} value\n */\n unlink() {\n if (this.value instanceof Node) {\n // Destroy this Node\n // fuseDom.destroy(this.value);\n } else\n if (this.value instanceof Listener) {\n // Deattach this Listener\n this.value.deattach();\n }\n }\n\n\n clone(target, source) {\n const out = {};\n\n for (const i in target) {\n out[i] = target[i];\n }\n for (const i in source) {\n out[i] = source[i];\n }\n\n return out;\n }\n\n setPartialState(path, value, source) {\n const target = {};\n if (path.length) {\n target[path[0]] =\n path.length > 1\n ? this.setPartialState(path.slice(1), value, source[path[0]])\n : value;\n return this.clone(source, target);\n }\n return value;\n }\n\n /**\n * Updates state value\n * @param {*} value\n */\n updateValue(value) {\n const source = this.component.state[this.key];\n return this.component.setState({\n [this.key]: this.setPartialState(this.path, value, source),\n });\n }\n\n extractListeners(value) {\n // if (this.value instanceof Listener && value instanceof Listener) {\n // console.log('middle')\n // } else\n if (value instanceof Listener) {\n // if (this.value instanceof Listener) {\n // this.value.processValue = value.processValue;\n // // this.value = value;\n // this.handleUpdate(value.getValue(value.component.state[value.key]));\n // console.log(value, value.getValue(value.component.state[value.key]));\n // value.deattach();\n // }\n // value.component.addListener(value.key, value, value.depth);\n // value.handleUpdate = () => {\n // console.log('inner handler')\n // }\n const tempListener = {\n depth: value.depth,\n attached: true,\n processValue: value => value,\n handleUpdate: () => {\n if (this.component) {\n this.handleUpdate(this.getValue(this.component.state[this.key]));\n }\n tempListener.attached = false;\n },\n changeListener: () => {},\n };\n this.addedListeners.push(tempListener);\n value.component.addListener(value.key, tempListener, value.depth);\n // value.init()\n // value.handleUpdate = () => {\n // console.log('inner handler')\n // }\n // value.onValueChange((v) => {\n // this.handleUpdate(this.getValue(this.component.state[this.key]));\n // console.log('me got changed', v)\n // });\n const newValue = value.processValue(\n value.getValue(value.component.state[value.key])\n );\n value.deattach();\n return this.extractListeners(newValue);\n }\n return value;\n\n // return this.processValue(this.getValue(value));\n }\n\n /**\n * @param {*} value\n */\n handleUpdate(value) {\n const newValue = this.processValue(this.getValue(value));\n // if (this.value instanceof Listener && newValue instanceof Listener) {\n // this.value.processValue = newValue.processValue;\n // // this.value = newValue;\n // this.value.handleUpdate(newValue.component.state[newValue.key]);\n // console.log(newValue, newValue.getValue(newValue.component.state[newValue.key]));\n // newValue.deattach();\n // } else\n if (newValue instanceof Listener) {\n // if (this.value instanceof Listener) {\n // this.value.processValue = newValue.processValue;\n // // this.value = newValue;\n // this.value.handleUpdate(newValue.component.state[newValue.key]);\n // console.log(newValue, newValue.getValue(newValue.component.state[newValue.key]));\n // newValue.deattach();\n // } else {\n for (let i = 0; i < this.addedListeners.length; i++) {\n this.addedListeners[i].attached = false;\n }\n this.addedListeners = [];\n this.value = this.extractListeners(newValue);\n this.changeListener(this.value);\n // }\n // // console.log(this.value.processValue('P'), newValue.processValue('A'));\n // // console.log(this.extractListeners(newValue));\n // // newValue.handleUpdate(newValue.component.state[newValue.key]);\n // // this.value = newValue;\n // // this.value.processValue = newValue.processValue;\n // this.value = this.extractListeners(newValue);\n // this.changeListener(this.value);\n // // this.value.processValue = newValue.processValue;\n // // // this.value = newValue;\n // // this.value.handleUpdate(newValue.component.state[newValue.key]);\n // // console.log(newValue, newValue.getValue(newValue.component.state[newValue.key]));\n // // newValue.deattach();\n } else {\n this.unlink();\n this.value = newValue;\n this.changeListener(this.value);\n }\n }\n\n /**\n * @param {*} source\n * @returns {*}\n */\n getValue(source) {\n let i = 0;\n while (i < this.path.length) {\n if (source === null\n || (!source[this.path[i]]\n && typeof source[this.path[i]] !== 'number')) {\n source = null;\n } else {\n source = source[this.path[i]];\n }\n i += 1;\n }\n return source;\n }\n\n /**\n * @param {number} depth\n * @returns {Listener}\n */\n applyDepth(depth) {\n this.depth = depth;\n return this;\n }\n\n /**\n * @param {function(*)} changeListener\n */\n onValueChange(changeListener) {\n this.changeListener = changeListener;\n this.changeListener(this.value);\n }\n\n /**\n * @param {function(*): *} processValue\n * @returns {function(*): *}\n */\n process(processValue) {\n this.processValue = processValue;\n return this;\n }\n\n deattach() {\n this.component = null;\n this.attached = false;\n this.key = null;\n this.childPath = null;\n this.path = null;\n this.unlink();\n this.value = null;\n this.changeListener = () => {};\n this.processValue = () => {};\n }\n}\n","\n/**\n * Append dom node to dom tree (after - (true) should append after 'to' element\n * or (false) inside it)\n * @param {HTMLElement} node\n * @param {HTMLElement} to\n * @param {Boolean} after\n * @returns {HTMLElement}\n */\nconst append = (node, to, after) => {\n if (after && to) {\n if (to.parentNode) {\n to.parentNode.insertBefore(node, to);\n // if (!to.nextSibling) {\n // to.parentNode.appendChild(node);\n // } else {\n // to.parentNode.insertBefore(node, to.nextSibling || to);\n // }\n }\n return node;\n }\n\n return to.appendChild(node);\n};\n\nexport default append;\n","import mount from '../mount';\n\nconst getLast = (child) => {\n if (child.$redirect && child.$redirect[child.$redirect.length - 1]) {\n return getLast(child.$redirect[child.$redirect.length - 1]);\n }\n\n // if (child.children && child.children.length > 0) {\n // return child.children;\n // }\n\n return child;\n};\n\n/**\n * @param {Structure} child\n */\nconst mountChildren = (child, isSvg, depth = 0) => {\n if (!child) return;\n\n if (child.$redirect && child.$redirect.length > 0) {\n mountChildren(getLast(child), isSvg, depth + 1);\n } else if (child.children && child.children.length > 0) {\n if (child.html && child.html.length === 1) {\n mount(child.children,\n child.html[0],\n child.html[0].nodeType !== 1,\n child.$isSvg,\n child.$depth);\n } else {\n mount(child.children,\n child.$pointer,\n true,\n child.$isSvg,\n child.$depth);\n }\n }\n};\n\nexport default mountChildren;\n","\n/**\n * @param {string} value\n * @returns {HTMLElement}\n */\nconst textNode = value => (\n document.createTextNode(\n (typeof value === 'object'\n ? JSON.stringify(value)\n : value)\n )\n);\n\nexport default textNode;\n","// import Component from './component/Component';\nimport Listener from './listen/Listener';\nimport flatten from './utils/flatten';\nimport filterNode from './r/utils/filterNode';\nimport append from './r/utils/append';\nimport mountChildren from './r/mountChildren';\nimport textNode from './r/utils/textNode';\nimport patch from './r/patch';\n\n/**\n * Appends structure[] to dom node\n * @param {*} component\n * @param {string} id\n * @param {boolean} isSvg\n * @param {number} depth\n * @returns {HTMLElement|Node}\n */\nconst mount = (raw, parent, after = false, isSvg = false, depth = 0) => {\n parent = typeof parent === 'string' ? document.getElementById(parent) : parent;\n let nodes = flatten([raw]).map(filterNode);\n\n // console.log(1, 'MOUNT')\n\n for (var i = 0; i < nodes.length; i++) {\n const ni = i;\n const nn = nodes[i];\n\n // console.log(2, nodes[i])\n if (nn instanceof Node) {\n append(nn, parent, after);\n } else\n if (nn && typeof nn.render === 'function') {\n // nn.$pointer = text('[pointer]');\n nn.$pointer = textNode('');\n append(nn.$pointer, parent, after);\n\n nodes[i].render(rendered => {\n // console.log(3, rendered)\n\n // Abort! Pointer was destroyed\n if (nn.$pointer === false) return false;\n\n for (var n = 0; n < rendered.length; n++) {\n if (nn.$pointer) {\n append(rendered[n], nn.$pointer, true);\n } else {\n append(rendered[n], parent, after);\n }\n }\n\n mountChildren(nn, nn.$isSvg, depth + 1);\n }, nn, depth, isSvg);\n }\n\n // if (!nn.html) {\n // nn.$pointer = text('[pointer]');\n // append(nn.$pointer, parent, after);\n // }\n }\n\n return nodes;\n}\n\nexport default mount;\n","/**\n * @param {*} query\n * @returns {Node}\n */\nconst getElementFromQuery = (query, isSvg) => {\n if (typeof query === 'string' || typeof query === 'number')\n return query !== 'template'\n ? isSvg || query === 'svg'\n ? document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n query\n )\n : document.createElement(query)\n : document.createDocumentFragment();\n console.warn(\n '[Radi.js] Warn: Creating a JSX element whose query is not of type string, automatically converting query to string.'\n );\n return document.createElement(query.toString());\n};\n\nexport default getElementFromQuery;\n","import filterNode from './filterNode';\nimport Structure from '../Structure';\nimport flatten from '../../utils/flatten';\n\n/**\n * @param {*[]} raw\n * @param {HTMLElement} parent\n * @param {string} raw\n * @returns {HTMLElement}\n */\nconst explode = (raw, parent, next, depth = 0, isSvg) => {\n let nodes = flatten([raw]).map(filterNode);\n // console.log('EXPLODE', nodes)\n\n // console.log('explode', {parent, nodes})\n\n for (var i = 0; i < nodes.length; i++) {\n if ((nodes[i] instanceof Structure || nodes[i].isStructure) && !nodes[i].html) {\n // let pp = depth === 0 ? parent : nodes[i];\n // let pp = parent;\n // console.log('EXPLODE 1', parent.$depth, depth, parent.$redirect, nodes[i].$redirect)\n if (parent.children.length <= 0) {\n if (!parent.$redirect) {\n parent.$redirect = [nodes[i]];\n } else {\n parent.$redirect.push(nodes[i]);\n }\n }\n\n if (!parent.$redirect && nodes[i].children) {\n parent.children = parent.children.concat(nodes[i].children);\n }\n\n if (typeof nodes[i].render === 'function') {\n const n = i;\n nodes[i].render(v => {\n // if (parent.children.length <= 0) {\n // if (!parent.$redirect) {\n // parent.$redirect = [nodes[n]];\n // } else {\n // parent.$redirect.push(nodes[n]);\n // }\n // }\n // console.log('EXPLODE 2', nodes[n], v, parent.$depth, nodes[n].$depth)\n next(v);\n // nodes[n].mount();\n }, nodes[i], depth + 1, isSvg);\n }\n }\n }\n\n return;\n}\n\nexport default explode;\n","/**\n * @param {*} value\n * @return {*}\n */\nconst parseValue = value =>\n typeof value === 'number' && !Number.isNaN(value) ? `${value}px` : value;\n\nexport default parseValue;\n","/* eslint-disable no-continue */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-param-reassign */\n/* eslint-disable no-multi-assign */\n\nimport Listener from '../listen/Listener';\nimport parseValue from './utils/parseValue';\n\n/**\n * @param {Structure} structure\n * @param {object} styles\n * @param {object} oldStyles\n * @returns {object}\n */\nconst setStyles = (structure, styles = {}, oldStyles = {}) => {\n if (!structure.html || !structure.html[0]) return styles;\n const element = structure.html[0];\n\n // Handle Listeners\n if (styles instanceof Listener) {\n if (typeof structure.$styleListeners.general !== 'undefined') {\n return element.style;\n }\n structure.$styleListeners.general = styles;\n structure.$styleListeners.general.applyDepth(structure.depth).init();\n\n structure.$styleListeners.general.onValueChange(value => {\n setStyles(structure, value, {});\n });\n\n return element.style;\n }\n\n if (typeof styles === 'string') {\n element.style = styles;\n return element.style;\n }\n\n const toRemove = Object.keys(oldStyles)\n .filter(key => typeof styles[key] === 'undefined');\n\n for (const style in styles) {\n if (styles.hasOwnProperty(style)) {\n // Skip if styles are the same\n if (typeof oldStyles !== 'undefined' && oldStyles[style] === styles[style]) continue;\n\n // Need to remove falsy style\n if (!styles[style] && typeof styles[style] !== 'number') {\n element.style[style] = null;\n continue;\n }\n\n // Handle Listeners\n if (styles[style] instanceof Listener) {\n if (typeof structure.$styleListeners[style] !== 'undefined') continue;\n structure.$styleListeners[style] = styles[style];\n structure.$styleListeners[style].applyDepth(structure.depth).init();\n\n structure.$styleListeners[style].onValueChange(value => {\n setStyles(structure, {\n [style]: value,\n }, {});\n });\n\n styles[style] = structure.$styleListeners[style].value;\n continue;\n }\n\n element.style[style] = parseValue(styles[style]);\n }\n }\n\n for (let i = 0; i < toRemove.length; i++) {\n element.style[toRemove[i]] = null;\n }\n\n return element.style;\n};\n\nexport default setStyles;\n","/**\n * @param {*} value\n * @return {*}\n */\nconst parseClass = value => {\n if (Array.isArray(value)) {\n return value.filter(item => item).join(' ')\n }\n return value;\n}\n\nexport default parseClass;\n","/* eslint-disable no-continue */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-param-reassign */\n\nimport setStyles from './setStyles';\nimport Listener from '../listen/Listener';\nimport parseClass from './utils/parseClass';\nimport GLOBALS from '../consts/GLOBALS';\n// import AttributeListener from './utils/AttributeListener';\n\n/**\n * @param {Structure} structure\n * @param {object} propsSource\n * @param {object} oldPropsSource\n */\nconst setAttributes = (structure, propsSource = {}, oldPropsSource = {}) => {\n const props = propsSource || {};\n const oldProps = oldPropsSource || {};\n\n if (!structure.html || !structure.html[0]) return structure;\n const element = structure.html[0];\n\n if (!(element instanceof Node && element.nodeType !== 3)) return structure;\n\n const toRemove = Object.keys(oldProps)\n .filter(key => typeof props[key] === 'undefined');\n\n for (const prop in props) {\n if (props.hasOwnProperty(prop)) {\n // Skip if proprs are the same\n if (typeof oldProps !== 'undefined' && oldProps[prop] === props[prop]) continue;\n\n // Need to remove falsy attribute\n if (!props[prop] && typeof props[prop] !== 'number') {\n element.removeAttribute(prop);\n continue;\n }\n\n if ((prop === 'value' || prop === 'model') && !(props[prop] instanceof Listener)) {\n if (/(checkbox|radio)/.test(element.getAttribute('type'))) {\n element.checked = props[prop];\n } else {\n element.value = props[prop];\n }\n }\n\n // Handle Listeners\n if (props[prop] instanceof Listener) {\n if (typeof structure.$attrListeners[prop] !== 'undefined') continue;\n structure.$attrListeners[prop] = props[prop];\n props[prop].applyDepth(structure.depth).init();\n\n if (prop.toLowerCase() === 'model') {\n if (/(checkbox|radio)/.test(element.getAttribute('type'))) {\n element.addEventListener('change', (e) => {\n structure.$attrListeners[prop].updateValue(e.target.checked);\n });\n } else {\n element.addEventListener('input', (e) => {\n structure.$attrListeners[prop].updateValue(e.target.value);\n });\n }\n }\n\n structure.$attrListeners[prop].onValueChange(value => {\n setAttributes(structure, {\n [prop]: value,\n }, {});\n // props[prop] = value;\n });\n\n // structure.setProps(Object.assign(structure.data.props, {\n // [prop]: props[prop].value,\n // }));\n props[prop] = structure.$attrListeners[prop].value;\n continue;\n }\n\n if (typeof GLOBALS.CUSTOM_ATTRIBUTES[prop] !== 'undefined') {\n const { allowedTags } = GLOBALS.CUSTOM_ATTRIBUTES[prop];\n\n if (!allowedTags || (\n allowedTags\n && allowedTags.length > 0\n && allowedTags.indexOf(element.localName) >= 0\n )) {\n if (typeof GLOBALS.CUSTOM_ATTRIBUTES[prop].caller === 'function') {\n GLOBALS.CUSTOM_ATTRIBUTES[prop].caller(element, props[prop]);\n }\n if (!GLOBALS.CUSTOM_ATTRIBUTES[prop].addToElement) continue;\n }\n }\n\n\n if (prop.toLowerCase() === 'style') {\n if (typeof props[prop] === 'object') {\n setStyles(structure, props[prop], (oldProps && oldProps.style) || {});\n // props[prop] = structure.setStyles(props[prop], (oldProps && oldProps.style) || {});\n } else {\n element.style = props[prop];\n }\n continue;\n }\n\n if (prop.toLowerCase() === 'class' || prop.toLowerCase() === 'classname') {\n element.setAttribute('class', parseClass(props[prop]));\n continue;\n }\n\n if (prop.toLowerCase() === 'loadfocus') {\n element.onload = (el) => {\n setTimeout(() => {\n el.focus();\n }, 10);\n };\n continue;\n }\n\n if (prop.toLowerCase() === 'html') {\n element.innerHTML = props[prop];\n continue;\n }\n\n // Handles events 'on'\n if (prop.substring(0, 2).toLowerCase() === 'on' && typeof props[prop] === 'function') {\n const fn = props[prop];\n if (prop.substring(0, 8).toLowerCase() === 'onsubmit') {\n element[prop] = (e) => {\n if (props.prevent) {\n e.preventDefault();\n }\n\n const data = [];\n const inputs = e.target.elements || [];\n for (const input of inputs) {\n if ((input.name !== ''\n && (input.type !== 'radio' && input.type !== 'checkbox'))\n || input.checked) {\n const item = {\n name: input.name,\n el: input,\n type: input.type,\n default: input.defaultValue,\n value: input.value,\n set(val) {\n structure.el.value = val;\n },\n reset(val) {\n structure.el.value = val;\n structure.el.defaultValue = val;\n },\n };\n data.push(item);\n if (!data[item.name]) {\n Object.defineProperty(data, item.name, {\n value: item,\n });\n }\n }\n }\n\n return fn(e, data);\n };\n } else {\n element[prop] = (e, ...args) => fn(e, ...args);\n }\n continue;\n }\n\n element.setAttribute(prop, props[prop]);\n }\n }\n\n for (let i = 0; i < toRemove.length; i++) {\n element.removeAttribute(toRemove[i]);\n }\n\n structure.props = props;\n\n return structure;\n};\n\nexport default setAttributes;\n","/* eslint-disable no-restricted-syntax */\n\n// import GLOBALS from '../consts/GLOBALS';\nimport Component from '../component/Component';\nimport flatten from '../utils/flatten';\nimport patch from './patch';\nimport getElementFromQuery from './utils/getElementFromQuery';\nimport textNode from './utils/textNode';\nimport explode from './utils/explode';\nimport filterNode from './utils/filterNode';\nimport isComponent from '../component/utils/isComponent';\nimport Listener from '../listen/Listener';\nimport setAttributes from './setAttributes';\n\n/**\n * @param {*} query\n * @param {object} props\n * @param {...*} children\n * @param {number} depth\n */\nclass Structure {\n constructor(query, props = {}, children, depth = 0) {\n // console.log('H', query, children)\n this.query = query;\n this.props = Boolean !== props ? props : {};\n if (isComponent(query) || query instanceof Component) {\n this.$compChildren = flatten(children || []).map(filterNode);\n this.children = [];\n } else {\n this.children = flatten(children || []).map(filterNode);\n this.$compChildren = [];\n }\n this.html = null;\n this.$attrListeners = [];\n this.$styleListeners = [];\n this.$pointer = null;\n this.$component = null;\n this.$listener = null;\n this.$redirect = null;\n this.$destroyed = false;\n this.$isSvg = query === 'svg';\n this.$depth = depth;\n }\n\n mount() {\n this.$destroyed = false;\n // console.warn('[mounted]', this)\n\n if (this.$component instanceof Component) {\n this.$component.mount();\n }\n }\n\n destroy(childrenToo = true) {\n if (this.$destroyed) return false;\n // console.warn('[destroyed]', this, this.html, this.$redirect)\n\n for (const l in this.$styleListeners) {\n if (this.$styleListeners[l]\n && typeof this.$styleListeners[l].deattach === 'function') {\n this.$styleListeners[l].deattach();\n }\n }\n\n for (const l in this.$attrListeners) {\n if (this.$attrListeners[l]\n && typeof this.$attrListeners[l].deattach === 'function') {\n this.$attrListeners[l].deattach();\n }\n }\n\n if (this.$redirect) {\n for (let i = 0; i < this.$redirect.length; i++) {\n if (typeof this.$redirect[i].destroy === 'function') {\n this.$redirect[i].destroy();\n }\n }\n }\n\n if (childrenToo && this.children) {\n for (let i = 0; i < this.children.length; i++) {\n if (typeof this.children[i].destroy === 'function') {\n this.children[i].destroy();\n }\n }\n }\n\n if (this.html) {\n const items = this.html;\n for (let i = 0; i < this.html.length; i++) {\n if (items[i].parentNode) {\n const destroyHTML = () => items[i].parentNode.removeChild(items[i]);\n if (typeof items[i].beforedestroy === 'function') {\n items[i].beforedestroy(destroyHTML);\n } else {\n destroyHTML();\n }\n }\n }\n }\n\n if (this.$component instanceof Component) {\n this.$component.destroy();\n }\n\n if (this.$listener instanceof Listener) {\n this.$listener.deattach();\n }\n\n if (this.$pointer && this.$pointer.parentNode) {\n this.$pointer.parentNode.removeChild(this.$pointer);\n }\n this.$pointer = null;\n this.$redirect = null;\n this.$component = null;\n this.render = () => {};\n this.html = null;\n this.$destroyed = true;\n return true;\n }\n\n render(next, parent, depth = 0, isSvg = false) {\n // console.log('RENDER', isSvg, parent, parent && parent.$isSvg)\n this.$depth = Math.max(this.$depth, depth);\n this.$isSvg = isSvg || (parent && parent.$isSvg) || this.query === 'svg';\n\n if (this.query === '#text') {\n this.html = [textNode(this.props)];\n return next(this.html);\n }\n\n if (typeof this.query === 'string' || typeof this.query === 'number') {\n this.html = [getElementFromQuery(this.query, this.$isSvg)];\n\n setAttributes(this, this.props, {});\n\n return next(this.html);\n }\n\n if (this.query instanceof Listener) {\n if (!this.$listener) {\n this.$listener = this.query.applyDepth(this.$depth).init();\n this.mount();\n }\n return this.query.onValueChange(v => {\n if (this.html) {\n const tempParent = this.html[0];\n\n if (this.$pointer) {\n this.$redirect = patch(this.$redirect, v, this.$pointer,\n true, this.$isSvg, this.$depth + 1);\n } else {\n this.$redirect = patch(this.$redirect, v, tempParent,\n true, this.$isSvg, this.$depth + 1);\n }\n\n // let a = {\n // $redirect: [],\n // children: [],\n // };\n //\n // explode(v, a, output => {\n // // this.html = output;\n // if (this.$pointer) {\n // this.$redirect = patch(this.$redirect, a.$redirect,\n // this.$pointer, true, this.$isSvg, this.$depth + 1);\n // } else {\n // this.$redirect = patch(this.$redirect, a.$redirect,\n // tempParent, true, this.$isSvg, this.$depth + 1);\n // }\n // // next(output);\n // }, this.$depth + 1, this.$isSvg);\n } else {\n explode(v, parent || this, output => {\n // console.warn('change HTML', this.html)\n this.html = output;\n next(output);\n }, this.$depth + 1, this.$isSvg);\n }\n });\n }\n\n if (this.query instanceof Promise\n || this.query.constructor.name === 'LazyPromise') {\n return this.query.then(v => {\n const normalisedValue = v.default || v;\n explode(normalisedValue, parent || this, output => {\n this.html = output;\n next(output);\n }, this.$depth, this.$isSvg);\n });\n }\n\n if (this.query instanceof Component\n && typeof this.query.render === 'function') {\n this.$component = this.query;\n return explode(this.$component.render(), parent || this, v => {\n this.html = v;\n next(v);\n this.mount();\n }, this.$depth, this.$isSvg);\n }\n\n if (isComponent(this.query)) {\n if (!this.$component) {\n this.$component =\n new this.query(this.$compChildren).setProps(this.props); // eslint-disable-line\n }\n if (typeof this.$component.render === 'function') {\n explode(this.$component.render(), parent || this, v => {\n this.html = v;\n next(v);\n }, this.$depth, this.$isSvg);\n this.mount();\n }\n return null;\n }\n\n if (typeof this.query === 'function') {\n return explode(this.query(this.props), parent || this, v => {\n this.html = v;\n next(v);\n }, this.$depth, this.$isSvg);\n }\n\n return next(textNode(this.query));\n }\n\n isStructure() {\n return true;\n }\n}\n\nexport default Structure;\n","/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-continue */\n/* eslint-disable no-multi-assign */\n\nimport flatten from '../utils/flatten';\nimport filterNode from './utils/filterNode';\n// import Listener from '../listen/Listener';\n// import Component from '../component/Component';\nimport mount from '../mount';\nimport append from './utils/append';\n// import replaceWith from './utils/replaceWith';\nimport textNode from './utils/textNode';\nimport mountChildren from './mountChildren';\nimport Structure from './Structure';\nimport setAttributes from './setAttributes';\n\n// const hasRedirect = item => (\n// item && item.$redirect\n// );\n\nconst patch = (rawfirst, rawsecond, parent,\n after = false, isSvg = false, depth = 0) => {\n const first = flatten([rawfirst]);\n const second = flatten([rawsecond]).map(filterNode);\n\n const length = Math.max(first.length, second.length);\n\n for (let i = 0; i < length; i++) {\n // debugger\n // const nn = i;\n // first[i] = first[i].$redirect || first[i];\n if (typeof first[i] === 'undefined') {\n // mount\n mount(second[i], parent, after, isSvg, depth);\n continue;\n }\n\n if (typeof second[i] === 'undefined') {\n // remove\n if (typeof first[i].destroy === 'function') {\n first[i].destroy();\n }\n continue;\n }\n\n second[i].$depth = depth;\n\n if ((first[i] instanceof Structure || first[i].isStructure)\n && (second[i] instanceof Structure || second[i].isStructure)\n && first[i] !== second[i]) {\n // if (second[i].$redirect2) {\n // second[i] = patch(\n // // first[i].$redirect || first[i],\n // hasRedirect(first[i]) || first[i],\n // second[i].$redirect[second[i].$redirect.length - 1] || second[i],\n // parent,\n // after,\n // isSvg,\n // depth\n // );\n // continue;\n // }\n\n if (first[i].html\n && first[i].query === '#text'\n && second[i].query === '#text') {\n for (let n = 0; n < first[i].html.length; n++) {\n if (first[i].props !== second[i].props) {\n first[i].html[n].textContent = first[i].props = second[i].props;\n }\n }\n\n second[i].html = first[i].html;\n first[i].html = null;\n\n if (first[i].$pointer) {\n if (second[i].$pointer && second[i].$pointer.parentNode) {\n second[i].$pointer.parentNode.removeChild(second[i].$pointer);\n }\n second[i].$pointer = first[i].$pointer;\n first[i].$pointer = null;\n }\n\n first[i].destroy();\n continue;\n }\n\n\n if (first[i].html\n && typeof first[i].query === 'string'\n && typeof second[i].query === 'string'\n && first[i].query === second[i].query) {\n // for (var n = 0; n < first[i].html.length; n++) {\n // if (first[i].props !== second[i].props) {\n // // first[i].html[n].textContent = second[i].props;\n // }\n // }\n\n second[i].html = first[i].html;\n first[i].html = null;\n\n if (first[i].$pointer) {\n if (second[i].$pointer && second[i].$pointer.parentNode) {\n second[i].$pointer.parentNode.removeChild(second[i].$pointer);\n }\n second[i].$pointer = first[i].$pointer;\n first[i].$pointer = null;\n }\n\n setAttributes(second[i], second[i].props, first[i].props);\n // mountChildren(second[i], second[i].$isSvg, second[i].$depth + 1);\n\n if (second[i].html[0]\n && second[i].children\n && second[i].children.length > 0) {\n second[i].children = patch(first[i].children,\n second[i].children,\n second[i].html[0],\n false,\n second[i].$isSvg,\n second[i].$depth + 1);\n }\n first[i].destroy();\n\n continue;\n }\n\n // maybe merge\n const n1 = first[i];\n const n2 = second[i];\n\n // n2.$pointer = textNode('[pointer2]');\n n2.$pointer = textNode('');\n append(n2.$pointer, parent, after);\n\n n2.render(rendered => {\n if (n1.$pointer) {\n if (n2.$pointer && n2.$pointer.parentNode) {\n n2.$pointer.parentNode.removeChild(n2.$pointer);\n }\n n2.$pointer = n1.$pointer;\n n1.$pointer = null;\n }\n\n for (let n = 0; n < rendered.length; n++) {\n if ((n1.html && !n1.html[i]) || !n1.html) {\n append(rendered[n], n2.$pointer, true);\n } else {\n append(rendered[n], n1.html[i], true);\n }\n }\n\n mountChildren(n2, isSvg, depth + 1);\n\n n1.destroy(false);\n }, n2, depth, isSvg);\n }\n }\n\n return second;\n};\n\nexport default patch;\n","/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-continue */\n/* eslint-disable no-param-reassign */\n// -- we need those for..in loops for now!\n\nimport GLOBALS from '../consts/GLOBALS';\nimport generateId from '../utils/generateId';\nimport PrivateStore from './utils/PrivateStore';\n// import fuseDom from '../r/utils/fuseDom';\nimport clone from '../utils/clone';\nimport skipInProductionAndTest from '../utils/skipInProductionAndTest';\nimport Listener from '../listen/Listener';\n// import mount from '../mount';\nimport patch from '../r/patch';\n\nconst capitalise = lower => lower.charAt(0).toUpperCase() + lower.substr(1);\n\nexport default class Component {\n /**\n * @param {Node[]|*[]} [children]\n * @param {object} [o.props]\n */\n constructor(children, props) {\n this.addNonEnumerableProperties({\n $id: generateId(),\n $name: this.constructor.name,\n $config: (typeof this.config === 'function') ? this.config() : {\n listen: true,\n },\n __$events: {},\n __$privateStore: new PrivateStore(),\n });\n\n // TODO: Remove this! Deprecated!\n if (typeof this.on !== 'function'\n || (typeof this.on === 'function' && typeof this.on() === 'object')) {\n throw new Error('[Radi.js] Using `on.eventName()` is deprecated. Please use `onEventName()`.');\n }\n\n this.children = [];\n\n // Links headless components\n for (const key in GLOBALS.HEADLESS_COMPONENTS) {\n if (this[key] && typeof this[key].on === 'function') {\n this[key].on('update', () => this.setState());\n }\n }\n\n this.state = typeof this.state === 'function'\n ? this.state()\n : (this.state || {});\n\n skipInProductionAndTest(() => Object.freeze(this.state));\n\n if (children) this.setChildren(children);\n if (props) this.setProps(props);\n }\n\n /**\n * @returns {HTMLElement}\n */\n render() {\n if (typeof this.view !== 'function') return null;\n return this.html = this.view();\n }\n\n /**\n * @param {object} props\n * @returns {Component}\n */\n setProps(props) {\n const newState = {};\n // Self is needed cause of compilation\n const self = this;\n\n for (const key in props) {\n if (typeof props[key] === 'function' && key.substr(0, 2) === 'on') {\n self.on(key.substring(2, key.length), props[key]);\n } else\n if (props[key] instanceof Listener) {\n newState[key] = props[key].init().value;\n props[key].changeListener = (value => {\n self.setState({\n [key]: value,\n });\n });\n } else {\n newState[key] = props[key];\n }\n }\n this.setState(newState);\n return this;\n }\n\n /**\n * @param {Node[]|*[]} children\n */\n setChildren(children) {\n this.children = children;\n this.setState();\n for (let i = 0; i < this.children.length; i++) {\n if (typeof this.children[i].on === 'function') {\n this.children[i].on('update', () => this.setState());\n }\n }\n return this;\n }\n\n /**\n * @private\n * @param {object} obj\n */\n addNonEnumerableProperties(obj) {\n for (const key in obj) {\n if (typeof this[key] !== 'undefined') continue;\n Object.defineProperty(this, key, {\n value: obj[key],\n });\n }\n }\n\n /**\n * @param {string} key\n * @param {Listener} listener\n * @param {number} depth\n */\n addListener(key, listener, depth) {\n this.__$privateStore.addListener(key, listener, depth);\n }\n\n mount() {\n this.trigger('mount');\n }\n\n destroy() {\n // if (this.html) {\n // for (var i = 0; i < this.html.length; i++) {\n // if (this.html[i].parentNode) {\n // this.html[i].parentNode.removeChild(this.html[i]);\n // }\n // }\n // }\n this.html = null;\n this.trigger('destroy');\n this.__$privateStore.removeListeners();\n }\n\n // TODO: Remove this! Deprecated!\n when() {\n throw new Error('[Radi.js] Using `.when(\\'Event\\')` is deprecated. Use `.on(\\'Event\\')` instead.');\n }\n\n /**\n * @param {string} key\n * @param {function} fn\n * @returns {function}\n */\n on(key, fn) {\n if (typeof this.__$events[key] === 'undefined') this.__$events[key] = [];\n this.__$events[key].push(fn);\n return fn;\n }\n\n /**\n * @param {string} key\n * @param {*} value\n */\n trigger(key, ...args) {\n const event = this[`on${capitalise(key)}`];\n\n if (typeof event === 'function') {\n event.call(this, ...args);\n }\n\n if (typeof this.__$events[key] !== 'undefined') {\n for (const i in this.__$events[key]) {\n this.__$events[key][i].call(this, ...args);\n }\n }\n }\n\n /**\n * @param {object} newState\n * @param {string} actionName\n */\n setState(newState, actionName) {\n if (typeof newState === 'object') {\n let oldstate = this.state;\n\n skipInProductionAndTest(() => oldstate = clone(this.state));\n\n this.state = Object.assign(oldstate, newState);\n\n skipInProductionAndTest(() => Object.freeze(this.state));\n\n if (this.$config.listen) {\n this.__$privateStore.setState(newState);\n }\n }\n\n if (!this.$config.listen && typeof this.view === 'function' && this.html) {\n this.html = patch(this.html, this.view());\n }\n\n if (typeof actionName === 'string' && typeof this[actionName] === 'function') {\n this.trigger(`after${actionName[0].toUpperCase()}${actionName.substr(1)}`);\n }\n\n // if (typeof newState === 'object') {\n // let oldstate = this.state;\n //\n // skipInProductionAndTest(() => oldstate = clone(this.state));\n //\n // this.state = Object.assign(oldstate, newState);\n //\n // skipInProductionAndTest(() => Object.freeze(this.state));\n //\n // if (this.$config.listen) {\n // this.__$privateStore.setState(newState);\n // }\n // }\n //\n // if (!this.$config.listen && typeof this.view === 'function' && this.html) {\n // fuseDom.fuse(this.html, this.view());\n // }\n this.trigger('update');\n\n return newState;\n }\n\n /**\n * @returns {boolean}\n */\n static isComponent() {\n return true;\n }\n}\n","import Component from '../Component';\n\n/**\n * @param {*} value\n * @returns {Boolean}\n */\nconst isComponent = value => {\n if (value) {\n if (value.prototype instanceof Component) {\n return true;\n }\n\n if (value.isComponent) {\n return true;\n }\n }\n\n return false;\n}\n\nexport default isComponent;\n","import flatten from '../../utils/flatten';\nimport isComponent from '../../component/utils/isComponent';\nimport Component from '../../component/Component';\nimport r from '../index.js';\nimport Listener from '../../listen/Listener';\n\n/**\n * @param {function} value\n * @returns {object}\n */\nconst filterNode = value => {\n\n if (Array.isArray(value)) {\n return value.map(filterNode);\n }\n\n if (typeof value === 'string' || typeof value === 'number') {\n return r('#text', value);\n }\n\n if (!value || typeof value === 'boolean') {\n return r('#text', '');\n }\n\n if (value instanceof Listener) {\n return r(value);\n }\n\n if (isComponent(value) || value instanceof Component) {\n return r(value);\n }\n\n if (typeof value === 'function') {\n return r(value);\n }\n\n if (value instanceof Promise || value.constructor.name === 'LazyPromise') {\n return r(value);\n }\n\n return value;\n}\n\nexport default filterNode;\n","// import Component from '../component/Component';\nimport GLOBALS from '../consts/GLOBALS';\nimport flatten from '../utils/flatten';\nimport filterNode from './utils/filterNode';\nimport Structure from './Structure';\nimport patch from './patch';\n\n/**\n * @param {*} query\n * @param {object} props\n * @param {...*} children\n * @returns {object}\n */\nconst r = (query, props, ...children) => {\n if (typeof GLOBALS.CUSTOM_TAGS[query] !== 'undefined') {\n return GLOBALS.CUSTOM_TAGS[query].onmount(\n props || {},\n (children && flatten([children]).map(filterNode)) || [],\n filterNode,\n v => (GLOBALS.CUSTOM_TAGS[query].saved = v),\n ) || null;\n }\n\n if (query === 'await') {\n let output = null;\n\n if (props.src && props.src instanceof Promise) {\n props.src.then(v => {\n const nomalizedData = filterNode(\n typeof props.transform === 'function'\n ? props.transform(v)\n : v\n );\n\n if (output) {\n output = patch(output, nomalizedData, output.html[0].parentNode);\n } else {\n output = nomalizedData;\n }\n }).catch(error => {\n const placerror = filterNode(\n typeof props.error === 'function'\n ? props.error(error)\n : props.error\n );\n\n if (output) {\n output = patch(output, placerror, output.html[0].parentNode);\n } else {\n output = placerror;\n }\n });\n }\n\n if (!output) {\n output = filterNode(props.placeholder);\n }\n\n return output;\n }\n\n if (query === 'template') {\n // return flatten([children]).map(filterNode);\n return new Structure('section', props, flatten([children]).map(filterNode));\n }\n\n return new Structure(query, props, flatten([children]).map(filterNode));\n};\n\nexport default r;\n","import Listener from './Listener';\n\n/**\n * The listen function is used for dynamically binding a component property\n * to the DOM. Also commonly imported as 'l'.\n * @param {Component} component\n * @param {...string} path\n * @returns {Listener}\n */\nconst listen = (component, ...path) =>\n new Listener(component, ...path);\n\nexport default listen;\n","import Component from './Component';\nimport GLOBALS from '../consts/GLOBALS';\n\nconst headless = (key, Comp) => {\n // TODO: Validate component and key\n const name = '$'.concat(key);\n const mountedComponent = new Comp();\n mountedComponent.mount();\n Component.prototype[name] = mountedComponent;\n return GLOBALS.HEADLESS_COMPONENTS[name] = mountedComponent;\n};\n\nexport default headless;\n","// Decorator for actions\nconst action = (target, key, descriptor) => {\n const fn = descriptor.value;\n return {\n configurable: true,\n value(...args) {\n return this.setState.call(this, fn.call(this, ...args), key);\n },\n };\n};\n\nexport default action;\n","/* eslint-disable func-names */\n\nconst createWorker = fn => {\n let fire = () => {};\n\n const blob = new window.Blob([`self.onmessage = function(e) {\n self.postMessage((${fn.toString()})(e.data));\n }`], { type: 'text/javascript' });\n\n const url = window.URL.createObjectURL(blob);\n const myWorker = new window.Worker(url);\n\n myWorker.onmessage = e => { fire(e.data, null); };\n myWorker.onerror = e => { fire(null, e.data); };\n\n return arg => new Promise((resolve, reject) => {\n fire = (data, err) => !err ? resolve(data) : reject(data);\n myWorker.postMessage(arg);\n });\n};\n\n// Descriptor for worker\nconst worker = (target, key, descriptor) => {\n const act = descriptor.value;\n\n const promisedWorker = createWorker(act);\n\n descriptor.value = function (...args) {\n promisedWorker(...args).then(newState => {\n this.setState.call(this, newState);\n });\n };\n return descriptor;\n};\n\nexport default worker;\n","\n// Descriptor for subscriptions\nconst subscribe = (container, eventName/* , triggerMount */) =>\n (target, key, descriptor) => {\n let fn = descriptor.value;\n let boundFn = () => {};\n\n if (typeof fn !== 'function') {\n throw new Error(`@subscribe decorator can only be applied to methods not: ${typeof fn}`);\n }\n\n // In IE11 calling Object.defineProperty has a side-effect of evaluating the\n // getter for the property which is being replaced. This causes infinite\n // recursion and an \"Out of stack space\" error.\n let definingProperty = false;\n\n container[eventName] = (...args) => boundFn(...args);\n\n return {\n configurable: true,\n get() {\n if (definingProperty || this === target.prototype || this.hasOwnProperty(key)\n || typeof fn !== 'function') {\n return fn;\n }\n\n boundFn = fn.bind(this);\n\n definingProperty = true;\n Object.defineProperty(this, key, {\n configurable: true,\n get() {\n return boundFn;\n },\n set(value) {\n fn = value;\n delete this[key];\n },\n });\n definingProperty = false;\n return boundFn;\n },\n set(value) {\n fn = value;\n },\n };\n };\n\nexport default subscribe;\n","import GLOBALS from '../consts/GLOBALS';\n\n/**\n * @param {string} tagName\n * @param {function} onmount\n * @param {function} ondestroy\n * @returns {object}\n */\nconst customTag = (tagName, onmount, ondestroy) => GLOBALS.CUSTOM_TAGS[tagName] = {\n name: tagName,\n onmount: onmount || (() => {}),\n ondestroy: ondestroy || (() => {}),\n saved: null,\n};\n\nexport default customTag;\n","import GLOBALS from '../consts/GLOBALS';\n\n/**\n * @param {string} attributeName\n * @param {function} caller\n * @param {object} object\n * @returns {object}\n */\nconst customAttribute = (attributeName, caller, {\n allowedTags,\n addToElement,\n} = {}) => GLOBALS.CUSTOM_ATTRIBUTES[attributeName] = {\n name: attributeName,\n caller,\n allowedTags: allowedTags || null,\n addToElement,\n};\n\nexport default customAttribute;\n","import GLOBALS from '../consts/GLOBALS';\n\nconst remountActiveComponents = () => {\n Object.values(GLOBALS.ACTIVE_COMPONENTS).forEach(component => {\n if (typeof component.onMount === 'function') {\n component.onMount(component);\n }\n });\n};\n\nexport default remountActiveComponents;\n","import customAttribute from '../../r/customAttribute';\n\nconst animate = (target, type, opts, done) => {\n const direct = opts[type];\n if (typeof direct !== 'function') {\n console.warn(`[Radi.js] Animation \\`${type}\\` for node \\`${target.nodeName.toLowerCase}\\` should be function`);\n return;\n }\n\n return direct(target, done);\n};\n\ncustomAttribute('animation', (el, props) => {\n animate(el, 'in', props, () => {});\n el.beforedestroy = done => animate(el, 'out', props, done);\n});\n","/* eslint-disable consistent-return */\n/* eslint-disable no-console */\n\nimport Component from '../component/Component';\nimport headless from '../component/headless';\nimport customTag from '../r/customTag';\nimport mount from '../mount';\nimport listen from '../listen';\nimport r from '../r';\n\nclass Modal extends Component {\n state() {\n return {\n registry: {},\n };\n }\n\n register(name, element) {\n if (typeof this.state.registry[name] !== 'undefined') {\n console.warn(`[Radi.js] Warn: Modal with name \"${name}\" is already registerd!`);\n return;\n }\n\n this.setState({\n registry: Object.assign({}, this.state.registry, {\n [name]: {\n status: false,\n element,\n },\n }),\n });\n }\n\n exists(name) {\n if (typeof this.state.registry[name] === 'undefined') {\n console.warn(`[Radi.js] Warn: Modal with name \"${name}\" is not registerd!`);\n return false;\n }\n\n return true;\n }\n\n open(name) {\n if (!this.exists(name) || this.state.registry[name].status) return;\n\n return this.setState({\n registry: Object.assign({}, this.state.registry, {\n [name]: {\n status: true,\n element: this.state.registry[name].element,\n },\n }),\n });\n }\n\n close(name) {\n if (!this.exists(name) || !this.state.registry[name].status) return;\n\n return this.setState({\n registry: Object.assign({}, this.state.registry, {\n [name]: {\n status: false,\n element: this.state.registry[name].element,\n },\n }),\n });\n }\n\n closeAll() {\n const keys = Object.keys(this.state.registry);\n const registry = keys.reduce((acc, name) => Object.assign(acc, {\n [name]: {\n status: false,\n element: this.state.registry[name].element,\n },\n }), {});\n\n return this.setState({\n registry,\n });\n }\n}\n\nconst $modal = headless('modal', Modal);\n\ncustomTag('modal',\n (props, children, buildNode) => {\n const name = props.name || 'default';\n\n $modal.register(name, null);\n\n if (typeof props.name === 'undefined') {\n console.warn('[Radi.js] Warn: Every tag needs to have `name` attribute!');\n }\n\n mount(listen($modal, 'registry', name)\n .process(v => (\n v.status && r('div',\n { class: 'radi-modal', name },\n r('div', {\n class: 'radi-modal-backdrop',\n onclick: () => $modal.close(name),\n }),\n r('div',\n { class: 'radi-modal-content' },\n ...(children.slice())\n )\n )\n )), document.body);\n\n return buildNode(null);\n }, () => {\n // Destroyed `element`\n }\n);\n","import GLOBALS from './consts/GLOBALS';\nimport r from './r';\nimport listen from './listen';\nimport Component from './component';\nimport headless from './component/headless';\nimport generateId from './utils/generateId';\nimport mount from './mount';\nimport patch from './r/patch';\nimport action from './action';\nimport worker from './action/worker';\nimport subscribe from './action/subscribe';\nimport customTag from './r/customTag';\nimport customAttribute from './r/customAttribute';\nimport remountActiveComponents from './utils/remountActiveComponents';\nimport {} from './custom';\n\nconst Radi = {\n version: GLOBALS.VERSION,\n activeComponents: GLOBALS.ACTIVE_COMPONENTS,\n r,\n listen,\n l: listen,\n worker,\n Component,\n component: Component,\n action,\n subscribe,\n customTag,\n customAttribute,\n headless,\n update: patch,\n patch,\n mount,\n freeze: () => {\n GLOBALS.FROZEN_STATE = true;\n },\n unfreeze: () => {\n GLOBALS.FROZEN_STATE = false;\n remountActiveComponents();\n },\n};\n\n// Pass Radi instance to plugins\nRadi.plugin = (fn, ...args) => fn(Radi, ...args);\n\nif (window) window.Radi = Radi;\nexport default Radi;\n// module.exports = Radi;\n"],"names":["const","let","i","l"],"mappings":";;;;;;EAAAA,IAAM,OAAO,GAAG;IACd,mBAAmB,EAAE,EAAE;IACvB,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,OAAO;;IAEhB,iBAAiB,EAAE,EAAE;IACrB,iBAAiB,EAAE,EAAE;IACrB,WAAW,EAAE,EAAE;GAChB,CAAC;;;;;;ECHFA,IAAM,OAAO,GAAG,SAAS,OAAO,CAAC,IAAI,EAAE;IACrC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;GAC/E,CAAC;;ECPF;;;;;EAKAA,IAAM,UAAU,GAAG,MAAM;IACvBC,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,KAAKA,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;MAC3BD,IAAM,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;;MAExC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE;QAC/C,IAAI,IAAI,GAAG,CAAC;OACb;MACD,IAAI,IAAI,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;KAC5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GF,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,KAAK,EAAE,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;;EAEjD,IAAI,MAAM,IAAE,MAAM,CAAC,IAAI,GAAG,IAAI,GAAC;AAC/B;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"radi.js","sources":["../src/consts/GLOBALS.js","../src/utils/flatten.js","../src/utils/generateId.js","../src/component/utils/PrivateStore.js","../src/utils/clone.js","../src/utils/skipInProductionAndTest.js","../src/listen/Listener.js","../src/r/utils/append.js","../src/r/mountChildren.js","../src/r/utils/textNode.js","../src/mount.js","../src/r/utils/getElementFromQuery.js","../src/r/utils/explode.js","../src/r/utils/parseValue.js","../src/r/setStyles.js","../src/r/utils/parseClass.js","../src/r/setAttributes.js","../src/r/Structure.js","../src/r/patch.js","../src/component/Component.js","../src/component/utils/isComponent.js","../src/r/utils/filterNode.js","../src/r/index.js","../src/listen/index.js","../src/component/headless.js","../src/action/index.js","../src/action/worker.js","../src/action/subscribe.js","../src/r/customTag.js","../src/r/customAttribute.js","../src/utils/remountActiveComponents.js","../src/custom/attributes/animation.js","../src/custom/modal.js","../src/index.js"],"sourcesContent":["const GLOBALS = {\n HEADLESS_COMPONENTS: {},\n FROZEN_STATE: false,\n VERSION: '0.4.1',\n // TODO: Collect active components\n ACTIVE_COMPONENTS: {},\n CUSTOM_ATTRIBUTES: {},\n CUSTOM_TAGS: {},\n};\n\nexport default GLOBALS;\n","\n/**\n * @param {*[]} list\n * @returns {*[]}\n */\nconst flatten = function flatten(list) {\n return list.reduce((a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), []);\n};\n\nexport default flatten;\n","/**\n * UUID v4 generator\n * https://gist.github.com/jcxplorer/823878\n * @returns {string}\n */\nconst generateId = () => {\n let uuid = '';\n for (let i = 0; i < 32; i++) {\n const random = (Math.random() * 16) | 0; // eslint-disable-line\n\n if (i === 8 || i === 12 || i === 16 || i === 20) {\n uuid += '-';\n }\n uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16); // eslint-disable-line\n }\n return uuid;\n};\n\nexport default generateId;\n","export default class PrivateStore {\n constructor() {\n this.store = {};\n }\n\n /**\n * @param {string} key\n * @param {Listener} listener\n * @param {number} depth\n */\n addListener(key, listener, depth) {\n if (typeof this.store[key] === 'undefined') {\n this.createItemWrapper(key);\n }\n this.store[key].listeners[depth] = (this.store[key].listeners[depth] || []).filter(item => (\n item.attached\n ));\n this.store[key].listeners[depth].push(listener);\n\n return listener;\n }\n\n /**\n * Removes all listeners for all keys\n */\n removeListeners() {\n let o = Object.keys(this.store);\n for (var i = 0; i < o.length; i++) {\n this.store[o[i]].listeners = {};\n this.store[o[i]].value = null;\n }\n }\n\n /**\n * setState\n * @param {*} newState\n * @returns {*}\n */\n setState(newState) {\n // Find and trigger changes for listeners\n for (const key of Object.keys(newState)) {\n if (typeof this.store[key] === 'undefined') {\n this.createItemWrapper(key);\n }\n this.store[key].value = newState[key];\n\n this.triggerListeners(key);\n }\n return newState;\n }\n\n /**\n * createItemWrapper\n * @private\n * @param {string} key\n * @returns {object}\n */\n createItemWrapper(key) {\n return this.store[key] = {\n listeners: {},\n value: null,\n };\n }\n\n /**\n * triggerListeners\n * @private\n * @param {string} key\n */\n triggerListeners(key) {\n const item = this.store[key];\n if (item) {\n let clone = Object.keys(item.listeners)\n .sort()\n .map(key => (\n item.listeners[key].map(listener => listener)\n ));\n\n for (var i = 0; i < clone.length; i++) {\n for (var n = clone[i].length - 1; n >= 0; n--) {\n if (clone[i][n].attached) clone[i][n].handleUpdate(item.value)\n }\n }\n }\n }\n}\n","/**\n * @param {*} obj\n * @returns {*}\n */\nconst clone = obj => {\n if (typeof obj !== 'object') return obj;\n if (obj === null) return obj;\n if (Array.isArray(obj)) return obj.map(clone);\n\n /*eslint-disable*/\n // Reverted as currently throws some errors\n const cloned = {};\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n cloned[key] = clone(obj[key]);\n }\n }\n /* eslint-enable */\n\n return cloned;\n};\n\nexport default clone;\n","const skipInProductionAndTest = fn => {\n if (typeof process === 'undefined'\n || (process.env.NODE_ENV === 'production'\n || process.env.NODE_ENV === 'test')) {\n return false;\n }\n return fn && fn();\n};\n\nexport default skipInProductionAndTest;\n","/* eslint-disable no-param-reassign */\n/* eslint-disable no-shadow */\n/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\n// import fuseDom from '../r/utils/fuseDom';\n\nexport default class Listener {\n /**\n * @param {Component} component\n * @param {...string} path\n */\n constructor(component, ...path) {\n this.component = component;\n [this.key] = path;\n this.path = path.slice(1, path.length);\n this.depth = 0;\n this.attached = true;\n this.processValue = value => value;\n this.changeListener = () => {};\n this.addedListeners = [];\n }\n\n /**\n * Applies values and events to listener\n */\n init() {\n this.value = this.getValue(this.component.state[this.key]);\n this.component.addListener(this.key, this, this.depth);\n this.handleUpdate(this.component.state[this.key]);\n return this;\n }\n\n /**\n * Removes last active value with destroying listeners and\n * @param {*} value\n */\n unlink() {\n if (this.value instanceof Node) {\n // Destroy this Node\n // fuseDom.destroy(this.value);\n } else\n if (this.value instanceof Listener) {\n // Deattach this Listener\n this.value.deattach();\n }\n }\n\n\n clone(target, source) {\n const out = {};\n\n for (const i in target) {\n out[i] = target[i];\n }\n for (const i in source) {\n out[i] = source[i];\n }\n\n return out;\n }\n\n setPartialState(path, value, source) {\n const target = {};\n if (path.length) {\n target[path[0]] =\n path.length > 1\n ? this.setPartialState(path.slice(1), value, source[path[0]])\n : value;\n return this.clone(source, target);\n }\n return value;\n }\n\n /**\n * Updates state value\n * @param {*} value\n */\n updateValue(value) {\n const source = this.component.state[this.key];\n return this.component.setState({\n [this.key]: this.setPartialState(this.path, value, source),\n });\n }\n\n extractListeners(value) {\n // if (this.value instanceof Listener && value instanceof Listener) {\n // console.log('middle')\n // } else\n if (value instanceof Listener) {\n // if (this.value instanceof Listener) {\n // this.value.processValue = value.processValue;\n // // this.value = value;\n // this.handleUpdate(value.getValue(value.component.state[value.key]));\n // console.log(value, value.getValue(value.component.state[value.key]));\n // value.deattach();\n // }\n // value.component.addListener(value.key, value, value.depth);\n // value.handleUpdate = () => {\n // console.log('inner handler')\n // }\n const tempListener = {\n depth: value.depth,\n attached: true,\n processValue: value => value,\n handleUpdate: () => {\n if (this.component) {\n this.handleUpdate(this.getValue(this.component.state[this.key]));\n }\n tempListener.attached = false;\n },\n changeListener: () => {},\n };\n this.addedListeners.push(tempListener);\n value.component.addListener(value.key, tempListener, value.depth);\n // value.init()\n // value.handleUpdate = () => {\n // console.log('inner handler')\n // }\n // value.onValueChange((v) => {\n // this.handleUpdate(this.getValue(this.component.state[this.key]));\n // console.log('me got changed', v)\n // });\n const newValue = value.processValue(\n value.getValue(value.component.state[value.key])\n );\n value.deattach();\n return this.extractListeners(newValue);\n }\n return value;\n\n // return this.processValue(this.getValue(value));\n }\n\n /**\n * @param {*} value\n */\n handleUpdate(value) {\n const newValue = this.processValue(this.getValue(value));\n // if (this.value instanceof Listener && newValue instanceof Listener) {\n // this.value.processValue = newValue.processValue;\n // // this.value = newValue;\n // this.value.handleUpdate(newValue.component.state[newValue.key]);\n // console.log(newValue, newValue.getValue(newValue.component.state[newValue.key]));\n // newValue.deattach();\n // } else\n if (newValue instanceof Listener) {\n // if (this.value instanceof Listener) {\n // this.value.processValue = newValue.processValue;\n // // this.value = newValue;\n // this.value.handleUpdate(newValue.component.state[newValue.key]);\n // console.log(newValue, newValue.getValue(newValue.component.state[newValue.key]));\n // newValue.deattach();\n // } else {\n for (let i = 0; i < this.addedListeners.length; i++) {\n this.addedListeners[i].attached = false;\n }\n this.addedListeners = [];\n this.value = this.extractListeners(newValue);\n this.changeListener(this.value);\n // }\n // // console.log(this.value.processValue('P'), newValue.processValue('A'));\n // // console.log(this.extractListeners(newValue));\n // // newValue.handleUpdate(newValue.component.state[newValue.key]);\n // // this.value = newValue;\n // // this.value.processValue = newValue.processValue;\n // this.value = this.extractListeners(newValue);\n // this.changeListener(this.value);\n // // this.value.processValue = newValue.processValue;\n // // // this.value = newValue;\n // // this.value.handleUpdate(newValue.component.state[newValue.key]);\n // // console.log(newValue, newValue.getValue(newValue.component.state[newValue.key]));\n // // newValue.deattach();\n } else {\n this.unlink();\n this.value = newValue;\n this.changeListener(this.value);\n }\n }\n\n /**\n * @param {*} source\n * @returns {*}\n */\n getValue(source) {\n let i = 0;\n while (i < this.path.length) {\n if (source === null\n || (!source[this.path[i]]\n && typeof source[this.path[i]] !== 'number')) {\n source = null;\n } else {\n source = source[this.path[i]];\n }\n i += 1;\n }\n return source;\n }\n\n /**\n * @param {number} depth\n * @returns {Listener}\n */\n applyDepth(depth) {\n this.depth = depth;\n return this;\n }\n\n /**\n * @param {function(*)} changeListener\n */\n onValueChange(changeListener) {\n this.changeListener = changeListener;\n this.changeListener(this.value);\n }\n\n /**\n * @param {function(*): *} processValue\n * @returns {function(*): *}\n */\n process(processValue) {\n this.processValue = processValue;\n return this;\n }\n\n deattach() {\n this.component = null;\n this.attached = false;\n this.key = null;\n this.childPath = null;\n this.path = null;\n this.unlink();\n this.value = null;\n this.changeListener = () => {};\n this.processValue = () => {};\n }\n}\n","\nconst onMountEvent = document.createEvent('Event');\nonMountEvent.initEvent('mount', true, true);\n\nconst onLoadEvent = document.createEvent('Event');\nonLoadEvent.initEvent('load', true, true);\n\n/**\n * Append dom node to dom tree (after - (true) should append after 'to' element\n * or (false) inside it)\n * @param {HTMLElement} node\n * @param {HTMLElement} to\n * @param {Boolean} after\n * @returns {HTMLElement}\n */\nconst append = (node, to, after) => {\n if (typeof node.dispatchEvent === 'function') {\n node.dispatchEvent(onLoadEvent);\n }\n\n if (after && to) {\n if (to.parentNode) {\n to.parentNode.insertBefore(node, to);\n if (typeof node.dispatchEvent === 'function') {\n node.dispatchEvent(onMountEvent);\n }\n // if (!to.nextSibling) {\n // to.parentNode.appendChild(node);\n // } else {\n // to.parentNode.insertBefore(node, to.nextSibling || to);\n // }\n }\n return node;\n }\n\n to.appendChild(node);\n\n if (typeof node.dispatchEvent === 'function') {\n node.dispatchEvent(onMountEvent);\n }\n\n return node;\n};\n\nexport default append;\n","import mount from '../mount';\n\nconst getLast = (child) => {\n if (child.$redirect && child.$redirect[child.$redirect.length - 1]) {\n return getLast(child.$redirect[child.$redirect.length - 1]);\n }\n\n // if (child.children && child.children.length > 0) {\n // return child.children;\n // }\n\n return child;\n};\n\n/**\n * @param {Structure} child\n */\nconst mountChildren = (child, isSvg, depth = 0) => {\n if (!child) return;\n\n if (child.$redirect && child.$redirect.length > 0) {\n mountChildren(getLast(child), isSvg, depth + 1);\n } else if (child.children && child.children.length > 0) {\n if (child.html && child.html.length === 1) {\n mount(child.children,\n child.html[0],\n child.html[0].nodeType !== 1,\n child.$isSvg,\n child.$depth);\n } else {\n mount(child.children,\n child.$pointer,\n true,\n child.$isSvg,\n child.$depth);\n }\n }\n};\n\nexport default mountChildren;\n","\n/**\n * @param {string} value\n * @returns {HTMLElement}\n */\nconst textNode = value => (\n document.createTextNode(\n (typeof value === 'object'\n ? JSON.stringify(value)\n : value)\n )\n);\n\nexport default textNode;\n","// import Component from './component/Component';\nimport Listener from './listen/Listener';\nimport flatten from './utils/flatten';\nimport filterNode from './r/utils/filterNode';\nimport append from './r/utils/append';\nimport mountChildren from './r/mountChildren';\nimport textNode from './r/utils/textNode';\nimport patch from './r/patch';\n\n/**\n * Appends structure[] to dom node\n * @param {*} component\n * @param {string} id\n * @param {boolean} isSvg\n * @param {number} depth\n * @returns {HTMLElement|Node}\n */\nconst mount = (raw, parent, after = false, isSvg = false, depth = 0) => {\n parent = typeof parent === 'string' ? document.getElementById(parent) : parent;\n let nodes = flatten([raw]).map(filterNode);\n\n // console.log(1, 'MOUNT')\n\n for (var i = 0; i < nodes.length; i++) {\n const ni = i;\n const nn = nodes[i];\n\n // console.log(2, nodes[i])\n if (nn instanceof Node) {\n append(nn, parent, after);\n } else\n if (nn && typeof nn.render === 'function') {\n // nn.$pointer = text('[pointer]');\n nn.$pointer = textNode('');\n append(nn.$pointer, parent, after);\n\n nodes[i].render(rendered => {\n // console.log(3, rendered)\n\n // Abort! Pointer was destroyed\n if (nn.$pointer === false) return false;\n\n for (var n = 0; n < rendered.length; n++) {\n if (nn.$pointer) {\n append(rendered[n], nn.$pointer, true);\n } else {\n append(rendered[n], parent, after);\n }\n }\n\n mountChildren(nn, nn.$isSvg, depth + 1);\n }, nn, depth, isSvg);\n }\n\n // if (!nn.html) {\n // nn.$pointer = text('[pointer]');\n // append(nn.$pointer, parent, after);\n // }\n }\n\n return nodes;\n}\n\nexport default mount;\n","/**\n * @param {*} query\n * @returns {Node}\n */\nconst getElementFromQuery = (query, isSvg) => {\n if (typeof query === 'string' || typeof query === 'number')\n return query !== 'template'\n ? isSvg || query === 'svg'\n ? document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n query\n )\n : document.createElement(query)\n : document.createDocumentFragment();\n console.warn(\n '[Radi.js] Warn: Creating a JSX element whose query is not of type string, automatically converting query to string.'\n );\n return document.createElement(query.toString());\n};\n\nexport default getElementFromQuery;\n","import filterNode from './filterNode';\nimport Structure from '../Structure';\nimport flatten from '../../utils/flatten';\n\n/**\n * @param {*[]} raw\n * @param {HTMLElement} parent\n * @param {string} raw\n * @returns {HTMLElement}\n */\nconst explode = (raw, parent, next, depth = 0, isSvg) => {\n let nodes = flatten([raw]).map(filterNode);\n // console.log('EXPLODE', nodes)\n\n // console.log('explode', {parent, nodes})\n\n for (var i = 0; i < nodes.length; i++) {\n if ((nodes[i] instanceof Structure || nodes[i].isStructure) && !nodes[i].html) {\n // let pp = depth === 0 ? parent : nodes[i];\n // let pp = parent;\n // console.log('EXPLODE 1', parent.$depth, depth, parent.$redirect, nodes[i].$redirect)\n if (parent.children.length <= 0) {\n if (!parent.$redirect) {\n parent.$redirect = [nodes[i]];\n } else {\n parent.$redirect.push(nodes[i]);\n }\n }\n\n if (!parent.$redirect && nodes[i].children) {\n parent.children = parent.children.concat(nodes[i].children);\n }\n\n if (typeof nodes[i].render === 'function') {\n const n = i;\n nodes[i].render(v => {\n // if (parent.children.length <= 0) {\n // if (!parent.$redirect) {\n // parent.$redirect = [nodes[n]];\n // } else {\n // parent.$redirect.push(nodes[n]);\n // }\n // }\n // console.log('EXPLODE 2', nodes[n], v, parent.$depth, nodes[n].$depth)\n next(v);\n // nodes[n].mount();\n }, nodes[i], depth + 1, isSvg);\n }\n }\n }\n\n return;\n}\n\nexport default explode;\n","/**\n * @param {*} value\n * @return {*}\n */\nconst parseValue = value =>\n typeof value === 'number' && !Number.isNaN(value) ? `${value}px` : value;\n\nexport default parseValue;\n","/* eslint-disable no-continue */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-param-reassign */\n/* eslint-disable no-multi-assign */\n\nimport Listener from '../listen/Listener';\nimport parseValue from './utils/parseValue';\n\n/**\n * @param {Structure} structure\n * @param {object} styles\n * @param {object} oldStyles\n * @returns {object}\n */\nconst setStyles = (structure, styles = {}, oldStyles = {}) => {\n if (!structure.html || !structure.html[0]) return styles;\n const element = structure.html[0];\n\n // Handle Listeners\n if (styles instanceof Listener) {\n if (typeof structure.$styleListeners.general !== 'undefined') {\n return element.style;\n }\n structure.$styleListeners.general = styles;\n structure.$styleListeners.general.applyDepth(structure.depth).init();\n\n structure.$styleListeners.general.onValueChange(value => {\n setStyles(structure, value, {});\n });\n\n return element.style;\n }\n\n if (typeof styles === 'string') {\n element.style = styles;\n return element.style;\n }\n\n const toRemove = Object.keys(oldStyles)\n .filter(key => typeof styles[key] === 'undefined');\n\n for (const style in styles) {\n if (styles.hasOwnProperty(style)) {\n // Skip if styles are the same\n if (typeof oldStyles !== 'undefined' && oldStyles[style] === styles[style]) continue;\n\n // Need to remove falsy style\n if (!styles[style] && typeof styles[style] !== 'number') {\n element.style[style] = null;\n continue;\n }\n\n // Handle Listeners\n if (styles[style] instanceof Listener) {\n if (typeof structure.$styleListeners[style] !== 'undefined') continue;\n structure.$styleListeners[style] = styles[style];\n structure.$styleListeners[style].applyDepth(structure.depth).init();\n\n structure.$styleListeners[style].onValueChange(value => {\n setStyles(structure, {\n [style]: value,\n }, {});\n });\n\n styles[style] = structure.$styleListeners[style].value;\n continue;\n }\n\n element.style[style] = parseValue(styles[style]);\n }\n }\n\n for (let i = 0; i < toRemove.length; i++) {\n element.style[toRemove[i]] = null;\n }\n\n return element.style;\n};\n\nexport default setStyles;\n","/**\n * @param {*} value\n * @return {*}\n */\nconst parseClass = value => {\n if (Array.isArray(value)) {\n return value.filter(item => item).join(' ')\n }\n return value;\n}\n\nexport default parseClass;\n","/* eslint-disable no-continue */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-param-reassign */\n\nimport setStyles from './setStyles';\nimport Listener from '../listen/Listener';\nimport parseClass from './utils/parseClass';\nimport GLOBALS from '../consts/GLOBALS';\n// import AttributeListener from './utils/AttributeListener';\n\n/**\n * @param {Structure} structure\n * @param {object} propsSource\n * @param {object} oldPropsSource\n */\nconst setAttributes = (structure, propsSource = {}, oldPropsSource = {}) => {\n const props = propsSource || {};\n const oldProps = oldPropsSource || {};\n\n if (!structure.html || !structure.html[0]) return structure;\n const element = structure.html[0];\n\n if (!(element instanceof Node && element.nodeType !== 3)) return structure;\n\n const toRemove = Object.keys(oldProps)\n .filter(key => typeof props[key] === 'undefined');\n\n for (const prop in props) {\n if (props.hasOwnProperty(prop)) {\n // Skip if proprs are the same\n if (typeof oldProps !== 'undefined' && oldProps[prop] === props[prop]) continue;\n\n if (prop === 'checked') {\n element.checked = props[prop];\n }\n\n // Need to remove falsy attribute\n if (!props[prop] && typeof props[prop] !== 'number' && typeof props[prop] !== 'string') {\n element.removeAttribute(prop);\n continue;\n }\n\n // Handle Listeners\n if (props[prop] instanceof Listener) {\n if (typeof structure.$attrListeners[prop] !== 'undefined') continue;\n structure.$attrListeners[prop] = props[prop];\n props[prop].applyDepth(structure.depth).init();\n\n if (prop.toLowerCase() === 'model' || prop.toLowerCase() === 'checked') {\n if (element.getAttribute('type') === 'radio') {\n element.addEventListener('input', (e) => {\n structure.$attrListeners[prop].updateValue(\n (e.target.checked && e.target.value)\n || e.target.checked\n );\n }, false);\n structure.$attrListeners[prop].onValueChange(value => {\n setAttributes(structure, {\n checked: element.value === value && Boolean(value),\n }, {});\n });\n } else\n if (element.getAttribute('type') === 'checkbox') {\n element.addEventListener('input', (e) => {\n structure.$attrListeners[prop].updateValue(\n Boolean(e.target.checked)\n );\n }, false);\n structure.$attrListeners[prop].onValueChange(value => {\n setAttributes(structure, {\n checked: Boolean(value),\n }, {});\n });\n } else {\n element.addEventListener('input', (e) => {\n structure.$attrListeners[prop].updateValue(e.target.value);\n }, false);\n }\n }\n\n if (!/(checkbox|radio)/.test(element.getAttribute('type'))) {\n structure.$attrListeners[prop].onValueChange(value => {\n setAttributes(structure, {\n [prop]: value,\n }, {});\n });\n }\n\n // structure.setProps(Object.assign(structure.data.props, {\n // [prop]: props[prop].value,\n // }));\n props[prop] = structure.$attrListeners[prop].value;\n continue;\n }\n\n if (prop === 'value' || prop === 'model') {\n element.value = props[prop];\n }\n\n if (typeof GLOBALS.CUSTOM_ATTRIBUTES[prop] !== 'undefined') {\n const { allowedTags } = GLOBALS.CUSTOM_ATTRIBUTES[prop];\n\n if (!allowedTags || (\n allowedTags\n && allowedTags.length > 0\n && allowedTags.indexOf(element.localName) >= 0\n )) {\n if (typeof GLOBALS.CUSTOM_ATTRIBUTES[prop].caller === 'function') {\n GLOBALS.CUSTOM_ATTRIBUTES[prop].caller(element, props[prop]);\n }\n if (!GLOBALS.CUSTOM_ATTRIBUTES[prop].addToElement) continue;\n }\n }\n\n\n if (prop.toLowerCase() === 'style') {\n if (typeof props[prop] === 'object') {\n setStyles(structure, props[prop], (oldProps && oldProps.style) || {});\n // props[prop] = structure.setStyles(props[prop], (oldProps && oldProps.style) || {});\n } else {\n element.style = props[prop];\n }\n continue;\n }\n\n if (prop.toLowerCase() === 'class' || prop.toLowerCase() === 'classname') {\n element.setAttribute('class', parseClass(props[prop]));\n continue;\n }\n\n if (prop.toLowerCase() === 'loadfocus') {\n element.addEventListener('mount', () => {\n element.focus();\n }, false);\n continue;\n }\n\n if (prop.toLowerCase() === 'html') {\n element.innerHTML = props[prop];\n continue;\n }\n\n // Handles events 'on'\n if (prop.substring(0, 2).toLowerCase() === 'on' && typeof props[prop] === 'function') {\n const fn = props[prop];\n if (prop.substring(0, 8).toLowerCase() === 'onsubmit') {\n element[prop] = (e) => {\n if (props.prevent) {\n e.preventDefault();\n }\n\n const data = [];\n const inputs = e.target.elements || [];\n for (const input of inputs) {\n if ((input.name !== ''\n && (input.type !== 'radio' && input.type !== 'checkbox'))\n || input.checked) {\n const item = {\n name: input.name,\n el: input,\n type: input.type,\n default: input.defaultValue,\n value: input.value,\n set(val) {\n structure.el.value = val;\n },\n reset(val) {\n structure.el.value = val;\n structure.el.defaultValue = val;\n },\n };\n data.push(item);\n if (!data[item.name]) {\n Object.defineProperty(data, item.name, {\n value: item,\n });\n }\n }\n }\n\n return fn(e, data);\n };\n } else {\n element[prop] = (e, ...args) => fn(e, ...args);\n }\n continue;\n }\n\n element.setAttribute(prop, props[prop]);\n }\n }\n\n for (let i = 0; i < toRemove.length; i++) {\n element.removeAttribute(toRemove[i]);\n }\n\n structure.props = props;\n\n return structure;\n};\n\nexport default setAttributes;\n","/* eslint-disable no-restricted-syntax */\n\n// import GLOBALS from '../consts/GLOBALS';\nimport Component from '../component/Component';\nimport flatten from '../utils/flatten';\nimport patch from './patch';\nimport getElementFromQuery from './utils/getElementFromQuery';\nimport textNode from './utils/textNode';\nimport explode from './utils/explode';\nimport filterNode from './utils/filterNode';\nimport isComponent from '../component/utils/isComponent';\nimport Listener from '../listen/Listener';\nimport setAttributes from './setAttributes';\n\n/**\n * @param {*} query\n * @param {object} props\n * @param {...*} children\n * @param {number} depth\n */\nclass Structure {\n constructor(query, props = {}, children, depth = 0) {\n this.query = query;\n this.props = Boolean !== props ? props : {};\n if (isComponent(query) || query instanceof Component) {\n this.$compChildren = flatten(children || []).map(filterNode);\n this.children = [];\n } else {\n this.children = flatten(children || []).map(filterNode);\n this.$compChildren = [];\n }\n this.html = null;\n this.$attrListeners = [];\n this.$styleListeners = [];\n this.$pointer = null;\n this.$component = null;\n this.$listener = null;\n this.$redirect = null;\n this.$destroyed = false;\n this.$isSvg = query === 'svg';\n this.$depth = depth;\n }\n\n mount() {\n this.$destroyed = false;\n\n if (this.$component instanceof Component) {\n this.$component.mount();\n }\n\n if (typeof this.onMount === 'function') {\n this.onMount();\n }\n }\n\n destroy(childrenToo = true) {\n if (this.$destroyed) return false;\n\n for (const l in this.$styleListeners) {\n if (this.$styleListeners[l]\n && typeof this.$styleListeners[l].deattach === 'function') {\n this.$styleListeners[l].deattach();\n }\n }\n\n for (const l in this.$attrListeners) {\n if (this.$attrListeners[l]\n && typeof this.$attrListeners[l].deattach === 'function') {\n this.$attrListeners[l].deattach();\n }\n }\n\n if (this.$redirect) {\n for (let i = 0; i < this.$redirect.length; i++) {\n if (typeof this.$redirect[i].destroy === 'function') {\n this.$redirect[i].destroy();\n }\n }\n }\n\n if (childrenToo && this.children) {\n for (let i = 0; i < this.children.length; i++) {\n if (typeof this.children[i].destroy === 'function') {\n this.children[i].destroy();\n }\n }\n }\n\n if (this.html) {\n const items = this.html;\n for (let i = 0; i < this.html.length; i++) {\n if (items[i].parentNode) {\n const destroyHTML = () => items[i].parentNode.removeChild(items[i]);\n if (typeof items[i].beforedestroy === 'function') {\n items[i].beforedestroy(destroyHTML);\n } else {\n destroyHTML();\n }\n }\n }\n }\n\n if (this.$component instanceof Component) {\n this.$component.destroy();\n }\n\n if (this.$listener instanceof Listener) {\n this.$listener.deattach();\n }\n\n if (this.$pointer && this.$pointer.parentNode) {\n this.$pointer.parentNode.removeChild(this.$pointer);\n }\n\n if (typeof this.onDestroy === 'function') {\n this.onDestroy();\n }\n\n this.$pointer = null;\n this.$redirect = null;\n this.$component = null;\n this.render = () => {};\n this.html = null;\n this.$destroyed = true;\n return true;\n }\n\n render(next, parent, depth = 0, isSvg = false) {\n // console.log('RENDER', isSvg, parent, parent && parent.$isSvg)\n this.$depth = Math.max(this.$depth, depth);\n this.$isSvg = isSvg || (parent && parent.$isSvg) || this.query === 'svg';\n\n if (this.query === '#text') {\n this.html = [textNode(this.props)];\n return next(this.html);\n }\n\n if (typeof this.query === 'string' || typeof this.query === 'number') {\n this.html = [getElementFromQuery(this.query, this.$isSvg)];\n\n setAttributes(this, this.props, {});\n\n return next(this.html);\n }\n\n if (this.query instanceof Listener) {\n if (!this.$listener) {\n this.$listener = this.query.applyDepth(this.$depth).init();\n this.mount();\n }\n return this.query.onValueChange(v => {\n if (this.html) {\n const tempParent = this.html[0];\n\n if (this.$pointer) {\n this.$redirect = patch(this.$redirect, v, this.$pointer,\n true, this.$isSvg, this.$depth + 1);\n } else {\n this.$redirect = patch(this.$redirect, v, tempParent,\n true, this.$isSvg, this.$depth + 1);\n }\n\n // let a = {\n // $redirect: [],\n // children: [],\n // };\n //\n // explode(v, a, output => {\n // // this.html = output;\n // if (this.$pointer) {\n // this.$redirect = patch(this.$redirect, a.$redirect,\n // this.$pointer, true, this.$isSvg, this.$depth + 1);\n // } else {\n // this.$redirect = patch(this.$redirect, a.$redirect,\n // tempParent, true, this.$isSvg, this.$depth + 1);\n // }\n // // next(output);\n // }, this.$depth + 1, this.$isSvg);\n } else {\n explode(v, parent || this, output => {\n // console.warn('change HTML', this.html)\n this.html = output;\n next(output);\n }, this.$depth + 1, this.$isSvg);\n }\n });\n }\n\n if (this.query instanceof Promise\n || this.query.constructor.name === 'LazyPromise') {\n return this.query.then(v => {\n const normalisedValue = v.default || v;\n explode(normalisedValue, parent || this, output => {\n this.html = output;\n next(output);\n }, this.$depth, this.$isSvg);\n });\n }\n\n if (this.query instanceof Component\n && typeof this.query.render === 'function') {\n this.$component = this.query;\n return explode(this.$component.render(), parent || this, v => {\n this.html = v;\n next(v);\n this.mount();\n }, this.$depth, this.$isSvg);\n }\n\n if (isComponent(this.query)) {\n if (!this.$component) {\n this.$component =\n new this.query(this.$compChildren).setProps(this.props); // eslint-disable-line\n }\n if (typeof this.$component.render === 'function') {\n explode(this.$component.render(), parent || this, v => {\n this.html = v;\n next(v);\n }, this.$depth, this.$isSvg);\n this.mount();\n }\n return null;\n }\n\n if (typeof this.query === 'function') {\n return explode(this.query(this.props), parent || this, v => {\n this.html = v;\n next(v);\n }, this.$depth, this.$isSvg);\n }\n\n return next(textNode(this.query));\n }\n\n isStructure() {\n return true;\n }\n}\n\nexport default Structure;\n","/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-continue */\n/* eslint-disable no-multi-assign */\n\nimport flatten from '../utils/flatten';\nimport filterNode from './utils/filterNode';\n// import Listener from '../listen/Listener';\n// import Component from '../component/Component';\nimport mount from '../mount';\nimport append from './utils/append';\n// import replaceWith from './utils/replaceWith';\nimport textNode from './utils/textNode';\nimport mountChildren from './mountChildren';\nimport Structure from './Structure';\nimport setAttributes from './setAttributes';\n\n// const hasRedirect = item => (\n// item && item.$redirect\n// );\n\nconst patch = (rawfirst, rawsecond, parent,\n after = false, isSvg = false, depth = 0) => {\n const first = flatten([rawfirst]);\n const second = flatten([rawsecond]).map(filterNode);\n\n const length = Math.max(first.length, second.length);\n\n for (let i = 0; i < length; i++) {\n // debugger\n // const nn = i;\n // first[i] = first[i].$redirect || first[i];\n if (typeof first[i] === 'undefined') {\n // mount\n mount(second[i], parent, after, isSvg, depth);\n continue;\n }\n\n if (typeof second[i] === 'undefined') {\n // remove\n if (typeof first[i].destroy === 'function') {\n first[i].destroy();\n }\n continue;\n }\n\n second[i].$depth = depth;\n\n if ((first[i] instanceof Structure || first[i].isStructure)\n && (second[i] instanceof Structure || second[i].isStructure)\n && first[i] !== second[i]) {\n // if (second[i].$redirect2) {\n // second[i] = patch(\n // // first[i].$redirect || first[i],\n // hasRedirect(first[i]) || first[i],\n // second[i].$redirect[second[i].$redirect.length - 1] || second[i],\n // parent,\n // after,\n // isSvg,\n // depth\n // );\n // continue;\n // }\n\n if (first[i].html\n && first[i].query === '#text'\n && second[i].query === '#text') {\n for (let n = 0; n < first[i].html.length; n++) {\n if (first[i].props !== second[i].props) {\n first[i].html[n].textContent = first[i].props = second[i].props;\n }\n }\n\n second[i].html = first[i].html;\n first[i].html = null;\n\n if (first[i].$pointer) {\n if (second[i].$pointer && second[i].$pointer.parentNode) {\n second[i].$pointer.parentNode.removeChild(second[i].$pointer);\n }\n second[i].$pointer = first[i].$pointer;\n first[i].$pointer = null;\n }\n\n first[i].destroy();\n continue;\n }\n\n\n if (first[i].html\n && typeof first[i].query === 'string'\n && typeof second[i].query === 'string'\n && first[i].query === second[i].query) {\n // for (var n = 0; n < first[i].html.length; n++) {\n // if (first[i].props !== second[i].props) {\n // // first[i].html[n].textContent = second[i].props;\n // }\n // }\n\n second[i].html = first[i].html;\n first[i].html = null;\n\n if (first[i].$pointer) {\n if (second[i].$pointer && second[i].$pointer.parentNode) {\n second[i].$pointer.parentNode.removeChild(second[i].$pointer);\n }\n second[i].$pointer = first[i].$pointer;\n first[i].$pointer = null;\n }\n\n setAttributes(second[i], second[i].props, first[i].props);\n // mountChildren(second[i], second[i].$isSvg, second[i].$depth + 1);\n\n if (second[i].html[0]\n && second[i].children\n && second[i].children.length > 0) {\n second[i].children = patch(first[i].children,\n second[i].children,\n second[i].html[0],\n false,\n second[i].$isSvg,\n second[i].$depth + 1);\n }\n first[i].destroy();\n\n continue;\n }\n\n // maybe merge\n const n1 = first[i];\n const n2 = second[i];\n\n // n2.$pointer = textNode('[pointer2]');\n n2.$pointer = textNode('');\n append(n2.$pointer, parent, after);\n\n n2.render(rendered => {\n if (n1.$pointer) {\n if (n2.$pointer && n2.$pointer.parentNode) {\n n2.$pointer.parentNode.removeChild(n2.$pointer);\n }\n n2.$pointer = n1.$pointer;\n n1.$pointer = null;\n }\n\n for (let n = 0; n < rendered.length; n++) {\n if ((n1.html && !n1.html[i]) || !n1.html) {\n append(rendered[n], n2.$pointer, true);\n } else {\n append(rendered[n], n1.html[i], true);\n }\n }\n\n mountChildren(n2, isSvg, depth + 1);\n\n n1.destroy(false);\n }, n2, depth, isSvg);\n }\n }\n\n return second;\n};\n\nexport default patch;\n","/* eslint-disable guard-for-in */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable no-continue */\n/* eslint-disable no-param-reassign */\n// -- we need those for..in loops for now!\n\nimport GLOBALS from '../consts/GLOBALS';\nimport generateId from '../utils/generateId';\nimport PrivateStore from './utils/PrivateStore';\n// import fuseDom from '../r/utils/fuseDom';\nimport clone from '../utils/clone';\nimport skipInProductionAndTest from '../utils/skipInProductionAndTest';\nimport Listener from '../listen/Listener';\n// import mount from '../mount';\nimport patch from '../r/patch';\n\nconst capitalise = lower => lower.charAt(0).toUpperCase() + lower.substr(1);\n\nexport default class Component {\n /**\n * @param {Node[]|*[]} [children]\n * @param {object} [o.props]\n */\n constructor(children, props) {\n this.addNonEnumerableProperties({\n $id: generateId(),\n $name: this.constructor.name,\n $config: (typeof this.config === 'function') ? this.config() : {\n listen: true,\n },\n __$events: {},\n __$privateStore: new PrivateStore(),\n });\n\n // TODO: Remove this! Deprecated!\n if (typeof this.on !== 'function'\n || (typeof this.on === 'function' && typeof this.on() === 'object')) {\n throw new Error('[Radi.js] Using `on.eventName()` is deprecated. Please use `onEventName()`.');\n }\n\n this.children = [];\n\n // Links headless components\n for (const key in GLOBALS.HEADLESS_COMPONENTS) {\n if (this[key] && typeof this[key].on === 'function') {\n this[key].on('update', () => this.setState());\n }\n }\n\n this.state = typeof this.state === 'function'\n ? this.state()\n : (this.state || {});\n\n skipInProductionAndTest(() => Object.freeze(this.state));\n\n if (children) this.setChildren(children);\n if (props) this.setProps(props);\n }\n\n /**\n * @returns {HTMLElement}\n */\n render() {\n if (typeof this.view !== 'function') return null;\n return this.html = this.view();\n }\n\n /**\n * @param {object} props\n * @returns {Component}\n */\n setProps(props) {\n const newState = {};\n // Self is needed cause of compilation\n const self = this;\n\n for (const key in props) {\n if (typeof props[key] === 'function' && key.substr(0, 2) === 'on') {\n self.on(key.substring(2, key.length), props[key]);\n } else\n if (props[key] instanceof Listener) {\n newState[key] = props[key].init().value;\n props[key].changeListener = (value => {\n self.setState({\n [key]: value,\n });\n });\n } else {\n newState[key] = props[key];\n }\n }\n this.setState(newState);\n return this;\n }\n\n /**\n * @param {Node[]|*[]} children\n */\n setChildren(children) {\n this.children = children;\n this.setState();\n for (let i = 0; i < this.children.length; i++) {\n if (typeof this.children[i].on === 'function') {\n this.children[i].on('update', () => this.setState());\n }\n }\n return this;\n }\n\n /**\n * @private\n * @param {object} obj\n */\n addNonEnumerableProperties(obj) {\n for (const key in obj) {\n if (typeof this[key] !== 'undefined') continue;\n Object.defineProperty(this, key, {\n value: obj[key],\n });\n }\n }\n\n /**\n * @param {string} key\n * @param {Listener} listener\n * @param {number} depth\n */\n addListener(key, listener, depth) {\n this.__$privateStore.addListener(key, listener, depth);\n }\n\n mount() {\n this.trigger('mount');\n }\n\n destroy() {\n // if (this.html) {\n // for (var i = 0; i < this.html.length; i++) {\n // if (this.html[i].parentNode) {\n // this.html[i].parentNode.removeChild(this.html[i]);\n // }\n // }\n // }\n this.html = null;\n this.trigger('destroy');\n this.__$privateStore.removeListeners();\n }\n\n // TODO: Remove this! Deprecated!\n when() {\n throw new Error('[Radi.js] Using `.when(\\'Event\\')` is deprecated. Use `.on(\\'Event\\')` instead.');\n }\n\n /**\n * @param {string} key\n * @param {function} fn\n * @returns {function}\n */\n on(key, fn) {\n if (typeof this.__$events[key] === 'undefined') this.__$events[key] = [];\n this.__$events[key].push(fn);\n return fn;\n }\n\n /**\n * @param {string} key\n * @param {*} value\n */\n trigger(key, ...args) {\n const event = this[`on${capitalise(key)}`];\n\n if (typeof event === 'function') {\n event.call(this, ...args);\n }\n\n if (typeof this.__$events[key] !== 'undefined') {\n for (const i in this.__$events[key]) {\n this.__$events[key][i].call(this, ...args);\n }\n }\n }\n\n /**\n * @param {object} newState\n * @param {string} actionName\n */\n setState(newState, actionName) {\n if (typeof newState === 'object') {\n let oldstate = this.state;\n\n skipInProductionAndTest(() => oldstate = clone(this.state));\n\n this.state = Object.assign(oldstate, newState);\n\n skipInProductionAndTest(() => Object.freeze(this.state));\n\n if (this.$config.listen) {\n this.__$privateStore.setState(newState);\n }\n }\n\n if (!this.$config.listen && typeof this.view === 'function' && this.html) {\n this.html = patch(this.html, this.view());\n }\n\n if (typeof actionName === 'string' && typeof this[actionName] === 'function') {\n this.trigger(`after${capitalise(actionName)}`, newState);\n }\n\n // if (typeof newState === 'object') {\n // let oldstate = this.state;\n //\n // skipInProductionAndTest(() => oldstate = clone(this.state));\n //\n // this.state = Object.assign(oldstate, newState);\n //\n // skipInProductionAndTest(() => Object.freeze(this.state));\n //\n // if (this.$config.listen) {\n // this.__$privateStore.setState(newState);\n // }\n // }\n //\n // if (!this.$config.listen && typeof this.view === 'function' && this.html) {\n // fuseDom.fuse(this.html, this.view());\n // }\n this.trigger('update');\n\n return newState;\n }\n\n /**\n * @returns {boolean}\n */\n static isComponent() {\n return true;\n }\n}\n","import Component from '../Component';\n\n/**\n * @param {*} value\n * @returns {Boolean}\n */\nconst isComponent = value => {\n if (value) {\n if (value.prototype instanceof Component) {\n return true;\n }\n\n if (value.isComponent) {\n return true;\n }\n }\n\n return false;\n}\n\nexport default isComponent;\n","import flatten from '../../utils/flatten';\nimport isComponent from '../../component/utils/isComponent';\nimport Component from '../../component/Component';\nimport r from '../index.js';\nimport Listener from '../../listen/Listener';\n\n/**\n * @param {function} value\n * @returns {object}\n */\nconst filterNode = value => {\n\n if (Array.isArray(value)) {\n return value.map(filterNode);\n }\n\n if (typeof value === 'string' || typeof value === 'number') {\n return r('#text', value);\n }\n\n if (!value || typeof value === 'boolean') {\n return r('#text', '');\n }\n\n if (value instanceof Listener) {\n return r(value);\n }\n\n if (isComponent(value) || value instanceof Component) {\n return r(value);\n }\n\n if (typeof value === 'function') {\n return r(value);\n }\n\n if (value instanceof Promise || value.constructor.name === 'LazyPromise') {\n return r(value);\n }\n\n return value;\n}\n\nexport default filterNode;\n","// import Component from '../component/Component';\nimport GLOBALS from '../consts/GLOBALS';\nimport flatten from '../utils/flatten';\nimport filterNode from './utils/filterNode';\nimport Structure from './Structure';\nimport patch from './patch';\n\n/**\n * @param {*} query\n * @param {object} props\n * @param {...*} children\n * @returns {object}\n */\nconst r = (query, props, ...children) => {\n if (typeof GLOBALS.CUSTOM_TAGS[query] !== 'undefined') {\n return GLOBALS.CUSTOM_TAGS[query].onmount(\n props || {},\n (children && flatten([children]).map(filterNode)) || [],\n filterNode,\n v => (GLOBALS.CUSTOM_TAGS[query].saved = v),\n ) || null;\n }\n\n if (query === 'await') {\n let output = null;\n\n if (props.src && props.src instanceof Promise) {\n props.src.then(v => {\n const nomalizedData = filterNode(\n typeof props.transform === 'function'\n ? props.transform(v)\n : v\n );\n\n if (output) {\n output = patch(output, nomalizedData, output.html[0].parentNode);\n } else {\n output = nomalizedData;\n }\n }).catch(error => {\n const placerror = filterNode(\n typeof props.error === 'function'\n ? props.error(error)\n : props.error\n );\n\n if (output) {\n output = patch(output, placerror, output.html[0].parentNode);\n } else {\n output = placerror;\n }\n });\n }\n\n if (!output) {\n output = filterNode(props.placeholder);\n }\n\n return output;\n }\n\n if (query === 'template') {\n // return flatten([children]).map(filterNode);\n return new Structure('section', props, flatten([children]).map(filterNode));\n }\n\n return new Structure(query, props, flatten([children]).map(filterNode));\n};\n\nexport default r;\n","import Listener from './Listener';\n\n/**\n * The listen function is used for dynamically binding a component property\n * to the DOM. Also commonly imported as 'l'.\n * @param {Component} component\n * @param {...string} path\n * @returns {Listener}\n */\nconst listen = (component, ...path) =>\n new Listener(component, ...path);\n\nexport default listen;\n","import Component from './Component';\nimport GLOBALS from '../consts/GLOBALS';\n\nconst headless = (key, Comp) => {\n // TODO: Validate component and key\n const name = '$'.concat(key);\n const mountedComponent = new Comp();\n mountedComponent.mount();\n Component.prototype[name] = mountedComponent;\n return GLOBALS.HEADLESS_COMPONENTS[name] = mountedComponent;\n};\n\nexport default headless;\n","// Decorator for actions\nconst action = (target, key, descriptor) => {\n const fn = descriptor.value;\n return {\n configurable: true,\n value(...args) {\n return this.setState.call(this, fn.call(this, ...args), key);\n },\n };\n};\n\nexport default action;\n","/* eslint-disable func-names */\n\nconst createWorker = fn => {\n let fire = () => {};\n\n const blob = new window.Blob([`self.onmessage = function(e) {\n self.postMessage((${fn.toString()})(e.data));\n }`], { type: 'text/javascript' });\n\n const url = window.URL.createObjectURL(blob);\n const myWorker = new window.Worker(url);\n\n myWorker.onmessage = e => { fire(e.data, null); };\n myWorker.onerror = e => { fire(null, e.data); };\n\n return arg => new Promise((resolve, reject) => {\n fire = (data, err) => !err ? resolve(data) : reject(data);\n myWorker.postMessage(arg);\n });\n};\n\n// Descriptor for worker\nconst worker = (target, key, descriptor) => {\n const act = descriptor.value;\n\n const promisedWorker = createWorker(act);\n\n descriptor.value = function (...args) {\n promisedWorker(...args).then(newState => {\n this.setState.call(this, newState);\n });\n };\n return descriptor;\n};\n\nexport default worker;\n","\n// Descriptor for subscriptions\nconst subscribe = (container, eventName/* , triggerMount */) =>\n (target, key, descriptor) => {\n let fn = descriptor.value;\n let boundFn = () => {};\n\n if (typeof fn !== 'function') {\n throw new Error(`@subscribe decorator can only be applied to methods not: ${typeof fn}`);\n }\n\n // In IE11 calling Object.defineProperty has a side-effect of evaluating the\n // getter for the property which is being replaced. This causes infinite\n // recursion and an \"Out of stack space\" error.\n let definingProperty = false;\n\n container[eventName] = (...args) => boundFn(...args);\n\n return {\n configurable: true,\n get() {\n if (definingProperty || this === target.prototype || this.hasOwnProperty(key)\n || typeof fn !== 'function') {\n return fn;\n }\n\n boundFn = fn.bind(this);\n\n definingProperty = true;\n Object.defineProperty(this, key, {\n configurable: true,\n get() {\n return boundFn;\n },\n set(value) {\n fn = value;\n delete this[key];\n },\n });\n definingProperty = false;\n return boundFn;\n },\n set(value) {\n fn = value;\n },\n };\n };\n\nexport default subscribe;\n","import GLOBALS from '../consts/GLOBALS';\n\n/**\n * @param {string} tagName\n * @param {function} onmount\n * @param {function} ondestroy\n * @returns {object}\n */\nconst customTag = (tagName, onmount, ondestroy) => GLOBALS.CUSTOM_TAGS[tagName] = {\n name: tagName,\n onmount: onmount || (() => {}),\n ondestroy: ondestroy || (() => {}),\n saved: null,\n};\n\nexport default customTag;\n","import GLOBALS from '../consts/GLOBALS';\n\n/**\n * @param {string} attributeName\n * @param {function} caller\n * @param {object} object\n * @returns {object}\n */\nconst customAttribute = (attributeName, caller, {\n allowedTags,\n addToElement,\n} = {}) => GLOBALS.CUSTOM_ATTRIBUTES[attributeName] = {\n name: attributeName,\n caller,\n allowedTags: allowedTags || null,\n addToElement,\n};\n\nexport default customAttribute;\n","import GLOBALS from '../consts/GLOBALS';\n\nconst remountActiveComponents = () => {\n Object.values(GLOBALS.ACTIVE_COMPONENTS).forEach(component => {\n if (typeof component.onMount === 'function') {\n component.onMount(component);\n }\n });\n};\n\nexport default remountActiveComponents;\n","import customAttribute from '../../r/customAttribute';\n\nconst animate = (target, type, opts, done) => {\n const direct = opts[type];\n if (typeof direct !== 'function') {\n console.warn(`[Radi.js] Animation \\`${type}\\` for node \\`${target.nodeName.toLowerCase}\\` should be function`);\n return;\n }\n\n return direct(target, done);\n};\n\ncustomAttribute('animation', (el, props) => {\n animate(el, 'in', props, () => {});\n el.beforedestroy = done => animate(el, 'out', props, done);\n});\n","/* eslint-disable consistent-return */\n/* eslint-disable no-console */\n\nimport Component from '../component/Component';\nimport headless from '../component/headless';\nimport customTag from '../r/customTag';\nimport mount from '../mount';\nimport listen from '../listen';\nimport r from '../r';\n\nclass Modal extends Component {\n state() {\n return {\n registry: {},\n };\n }\n\n register(name, element) {\n if (typeof this.state.registry[name] !== 'undefined') {\n console.warn(`[Radi.js] Warn: Modal with name \"${name}\" is already registerd!`);\n return;\n }\n\n this.setState({\n registry: Object.assign({}, this.state.registry, {\n [name]: {\n status: false,\n element,\n },\n }),\n }, 'register');\n }\n\n exists(name) {\n if (typeof this.state.registry[name] === 'undefined') {\n console.warn(`[Radi.js] Warn: Modal with name \"${name}\" is not registerd!`);\n return false;\n }\n\n return true;\n }\n\n open(name) {\n if (!this.exists(name) || this.state.registry[name].status) return;\n\n return this.setState({\n registry: Object.assign({}, this.state.registry, {\n [name]: {\n status: true,\n element: this.state.registry[name].element,\n },\n }),\n }, 'open');\n }\n\n close(name) {\n if (!this.exists(name) || !this.state.registry[name].status) return;\n\n return this.setState({\n registry: Object.assign({}, this.state.registry, {\n [name]: {\n status: false,\n element: this.state.registry[name].element,\n },\n }),\n }, 'close');\n }\n\n closeAll() {\n const keys = Object.keys(this.state.registry);\n const registry = keys.reduce((acc, name) => Object.assign(acc, {\n [name]: {\n status: false,\n element: this.state.registry[name].element,\n },\n }), {});\n\n return this.setState({\n registry,\n }, 'closeAll');\n }\n}\n\nconst $modal = headless('modal', Modal);\n\ncustomTag('modal',\n (props, children, buildNode) => {\n const name = props.name || 'default';\n\n $modal.register(name, null);\n\n if (typeof props.name === 'undefined') {\n console.warn('[Radi.js] Warn: Every tag needs to have `name` attribute!');\n }\n\n const mounted = mount(listen($modal, 'registry', name)\n .process(v => (\n v.status && r('div',\n { class: 'radi-modal', name },\n r('div', {\n class: 'radi-modal-backdrop',\n onclick: () => $modal.close(name),\n }),\n r('div',\n { class: 'radi-modal-content' },\n ...(children.slice())\n )\n )\n )), document.body);\n\n const treeSitter = buildNode(null);\n\n treeSitter.onDestroy = () => {\n for (let i = 0; i < mounted.length; i++) {\n if (typeof mounted[i].destroy === 'function') mounted[i].destroy();\n }\n };\n\n return treeSitter;\n }, () => {\n // Destroyed `element`\n }\n);\n","import GLOBALS from './consts/GLOBALS';\nimport r from './r';\nimport listen from './listen';\nimport Component from './component';\nimport headless from './component/headless';\nimport generateId from './utils/generateId';\nimport mount from './mount';\nimport patch from './r/patch';\nimport action from './action';\nimport worker from './action/worker';\nimport subscribe from './action/subscribe';\nimport customTag from './r/customTag';\nimport customAttribute from './r/customAttribute';\nimport remountActiveComponents from './utils/remountActiveComponents';\nimport {} from './custom';\n\nconst Radi = {\n version: GLOBALS.VERSION,\n activeComponents: GLOBALS.ACTIVE_COMPONENTS,\n r,\n listen,\n l: listen,\n worker,\n Component,\n component: Component,\n action,\n subscribe,\n customTag,\n customAttribute,\n headless,\n update: patch,\n patch,\n mount,\n freeze: () => {\n GLOBALS.FROZEN_STATE = true;\n },\n unfreeze: () => {\n GLOBALS.FROZEN_STATE = false;\n remountActiveComponents();\n },\n};\n\n// Pass Radi instance to plugins\nRadi.plugin = (fn, ...args) => fn(Radi, ...args);\n\nif (window) window.Radi = Radi;\nexport default Radi;\n// module.exports = Radi;\n"],"names":["const","let","i","l"],"mappings":";;;;;;EAAAA,IAAM,OAAO,GAAG;IACd,mBAAmB,EAAE,EAAE;IACvB,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,OAAO;;IAEhB,iBAAiB,EAAE,EAAE;IACrB,iBAAiB,EAAE,EAAE;IACrB,WAAW,EAAE,EAAE;GAChB,CAAC;;;;;;ECHFA,IAAM,OAAO,GAAG,SAAS,OAAO,CAAC,IAAI,EAAE;IACrC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;GAC/E,CAAC;;ECPF;;;;;EAKAA,IAAM,UAAU,GAAG,MAAM;IACvBC,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,KAAKA,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;MAC3BD,IAAM,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;;MAExC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE;QAC/C,IAAI,IAAI,GAAG,CAAC;OAC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 @@ -var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,g,m){c!=Array.prototype&&c!=Object.prototype&&(c[g]=m.value)};$jscomp.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_"; +var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,g,n){c!=Array.prototype&&c!=Object.prototype&&(c[g]=n.value)};$jscomp.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_"; $jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.Symbol=function(){var c=0;return function(g){return $jscomp.SYMBOL_PREFIX+(g||"")+c++}}(); $jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var c=$jscomp.global.Symbol.iterator;c||(c=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[c]&&$jscomp.defineProperty(Array.prototype,c,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(c){var g=0;return $jscomp.iteratorPrototype(function(){return gb;b++){var d=16*Math.random()|0;if(8===b||12===b||16===b||20===b)a+="-";a+=(12===b?4:16===b?d&3|8:d).toString(16)}return a},r=function(){this.store={}};r.prototype.addListener=function(a, -b,d){"undefined"===typeof this.store[a]&&this.createItemWrapper(a);this.store[a].listeners[d]=(this.store[a].listeners[d]||[]).filter(function(a){return a.attached});this.store[a].listeners[d].push(b);return b};r.prototype.removeListeners=function(){for(var a=Object.keys(this.store),b=0;b=b.children.length&&(b.$redirect?b.$redirect.push(a[d]):b.$redirect=[a[d]]),!b.$redirect&&a[d].children&&(b.children=b.children.concat(a[d].children)),"function"===typeof a[d].render&&a[d].render(function(a){c(a)},a[d],f+1,A))},S=function(a){return"number"!==typeof a||Number.isNaN(a)?a:a+"px"},H=function(a,b,c){void 0===b&&(b={});void 0===c&&(c={});if(!a.html||!a.html[0])return b;var f=a.html[0];if(b instanceof l){if("undefined"!==typeof a.$styleListeners.general)return f.style;a.$styleListeners.general= -b;a.$styleListeners.general.applyDepth(a.depth).init();a.$styleListeners.general.onValueChange(function(b){H(a,b,{})});return f.style}if("string"===typeof b)return f.style=b,f.style;var d=Object.keys(c).filter(function(a){return"undefined"===typeof b[a]}),n=function(d){!b.hasOwnProperty(d)||"undefined"!==typeof c&&c[d]===b[d]||(b[d]||"number"===typeof b[d]?b[d]instanceof l?"undefined"===typeof a.$styleListeners[d]&&(a.$styleListeners[d]=b[d],a.$styleListeners[d].applyDepth(a.depth).init(),a.$styleListeners[d].onValueChange(function(b){var c= -{};H(a,(c[d]=b,c),{})}),b[d]=a.$styleListeners[d].value):f.style[d]=S(b[d]):f.style[d]=null)},e;for(e in b)n(e);for(n=0;nb;b++){var d=16*Math.random()|0;if(8===b||12===b||16===b||20===b)a+="-";a+=(12===b?4:16===b?d&3|8:d).toString(16)}return a},q=function(){this.store={}};q.prototype.addListener=function(a, +b,d){"undefined"===typeof this.store[a]&&this.createItemWrapper(a);this.store[a].listeners[d]=(this.store[a].listeners[d]||[]).filter(function(a){return a.attached});this.store[a].listeners[d].push(b);return b};q.prototype.removeListeners=function(){for(var a=Object.keys(this.store),b=0;b=b.children.length&&(b.$redirect?b.$redirect.push(a[k]):b.$redirect=[a[k]]),!b.$redirect&&a[k].children&&(b.children=b.children.concat(a[k].children)),"function"===typeof a[k].render&&a[k].render(function(a){c(a)},a[k],e+1,z))},U=function(a){return"number"!==typeof a||Number.isNaN(a)?a:a+"px"},H=function(a,b,c){void 0=== +b&&(b={});void 0===c&&(c={});if(!a.html||!a.html[0])return b;var e=a.html[0];if(b instanceof m){if("undefined"!==typeof a.$styleListeners.general)return e.style;a.$styleListeners.general=b;a.$styleListeners.general.applyDepth(a.depth).init();a.$styleListeners.general.onValueChange(function(b){H(a,b,{})});return e.style}if("string"===typeof b)return e.style=b,e.style;var d=Object.keys(c).filter(function(a){return"undefined"===typeof b[a]}),k=function(h){!b.hasOwnProperty(h)||"undefined"!==typeof c&& +c[h]===b[h]||(b[h]||"number"===typeof b[h]?b[h]instanceof m?"undefined"===typeof a.$styleListeners[h]&&(a.$styleListeners[h]=b[h],a.$styleListeners[h].applyDepth(a.depth).init(),a.$styleListeners[h].onValueChange(function(b){var c={};H(a,(c[h]=b,c),{})}),b[h]=a.$styleListeners[h].value):e.style[h]=U(b[h]):e.style[h]=null)},f;for(f in b)k(f);for(k=0;k tag needs to have `name` attribute!'); } - mount(listen($modal, 'registry', name) + const mounted = mount(listen($modal, 'registry', name) .process(v => ( v.status && r('div', { class: 'radi-modal', name }, @@ -108,7 +108,15 @@ customTag('modal', ) )), document.body); - return buildNode(null); + const treeSitter = buildNode(null); + + treeSitter.onDestroy = () => { + for (let i = 0; i < mounted.length; i++) { + if (typeof mounted[i].destroy === 'function') mounted[i].destroy(); + } + }; + + return treeSitter; }, () => { // Destroyed `element` } diff --git a/src/r/Structure.js b/src/r/Structure.js index 0e24222..4057602 100644 --- a/src/r/Structure.js +++ b/src/r/Structure.js @@ -20,7 +20,6 @@ import setAttributes from './setAttributes'; */ class Structure { constructor(query, props = {}, children, depth = 0) { - // console.log('H', query, children) this.query = query; this.props = Boolean !== props ? props : {}; if (isComponent(query) || query instanceof Component) { @@ -44,16 +43,18 @@ class Structure { mount() { this.$destroyed = false; - // console.warn('[mounted]', this) if (this.$component instanceof Component) { this.$component.mount(); } + + if (typeof this.onMount === 'function') { + this.onMount(); + } } destroy(childrenToo = true) { if (this.$destroyed) return false; - // console.warn('[destroyed]', this, this.html, this.$redirect) for (const l in this.$styleListeners) { if (this.$styleListeners[l] @@ -110,6 +111,11 @@ class Structure { if (this.$pointer && this.$pointer.parentNode) { this.$pointer.parentNode.removeChild(this.$pointer); } + + if (typeof this.onDestroy === 'function') { + this.onDestroy(); + } + this.$pointer = null; this.$redirect = null; this.$component = null; diff --git a/src/r/setAttributes.js b/src/r/setAttributes.js index 511cc37..e2e48f2 100644 --- a/src/r/setAttributes.js +++ b/src/r/setAttributes.js @@ -30,44 +30,61 @@ const setAttributes = (structure, propsSource = {}, oldPropsSource = {}) => { // Skip if proprs are the same if (typeof oldProps !== 'undefined' && oldProps[prop] === props[prop]) continue; + if (prop === 'checked') { + element.checked = props[prop]; + } + // Need to remove falsy attribute - if (!props[prop] && typeof props[prop] !== 'number') { + if (!props[prop] && typeof props[prop] !== 'number' && typeof props[prop] !== 'string') { element.removeAttribute(prop); continue; } - if ((prop === 'value' || prop === 'model') && !(props[prop] instanceof Listener)) { - if (/(checkbox|radio)/.test(element.getAttribute('type'))) { - element.checked = props[prop]; - } else { - element.value = props[prop]; - } - } - // Handle Listeners if (props[prop] instanceof Listener) { if (typeof structure.$attrListeners[prop] !== 'undefined') continue; structure.$attrListeners[prop] = props[prop]; props[prop].applyDepth(structure.depth).init(); - if (prop.toLowerCase() === 'model') { - if (/(checkbox|radio)/.test(element.getAttribute('type'))) { - element.addEventListener('change', (e) => { - structure.$attrListeners[prop].updateValue(e.target.checked); + if (prop.toLowerCase() === 'model' || prop.toLowerCase() === 'checked') { + if (element.getAttribute('type') === 'radio') { + element.addEventListener('input', (e) => { + structure.$attrListeners[prop].updateValue( + (e.target.checked && e.target.value) + || e.target.checked + ); + }, false); + structure.$attrListeners[prop].onValueChange(value => { + setAttributes(structure, { + checked: element.value === value && Boolean(value), + }, {}); + }); + } else + if (element.getAttribute('type') === 'checkbox') { + element.addEventListener('input', (e) => { + structure.$attrListeners[prop].updateValue( + Boolean(e.target.checked) + ); + }, false); + structure.$attrListeners[prop].onValueChange(value => { + setAttributes(structure, { + checked: Boolean(value), + }, {}); }); } else { element.addEventListener('input', (e) => { structure.$attrListeners[prop].updateValue(e.target.value); - }); + }, false); } } - structure.$attrListeners[prop].onValueChange(value => { - setAttributes(structure, { - [prop]: value, - }, {}); - // props[prop] = value; - }); + if (!/(checkbox|radio)/.test(element.getAttribute('type'))) { + structure.$attrListeners[prop].onValueChange(value => { + setAttributes(structure, { + [prop]: value, + }, {}); + }); + } // structure.setProps(Object.assign(structure.data.props, { // [prop]: props[prop].value, @@ -76,6 +93,10 @@ const setAttributes = (structure, propsSource = {}, oldPropsSource = {}) => { continue; } + if (prop === 'value' || prop === 'model') { + element.value = props[prop]; + } + if (typeof GLOBALS.CUSTOM_ATTRIBUTES[prop] !== 'undefined') { const { allowedTags } = GLOBALS.CUSTOM_ATTRIBUTES[prop]; @@ -108,11 +129,9 @@ const setAttributes = (structure, propsSource = {}, oldPropsSource = {}) => { } if (prop.toLowerCase() === 'loadfocus') { - element.onload = (el) => { - setTimeout(() => { - el.focus(); - }, 10); - }; + element.addEventListener('mount', () => { + element.focus(); + }, false); continue; } diff --git a/src/r/utils/append.js b/src/r/utils/append.js index f7bdfb8..4bd5c27 100644 --- a/src/r/utils/append.js +++ b/src/r/utils/append.js @@ -1,4 +1,10 @@ +const onMountEvent = document.createEvent('Event'); +onMountEvent.initEvent('mount', true, true); + +const onLoadEvent = document.createEvent('Event'); +onLoadEvent.initEvent('load', true, true); + /** * Append dom node to dom tree (after - (true) should append after 'to' element * or (false) inside it) @@ -8,9 +14,16 @@ * @returns {HTMLElement} */ const append = (node, to, after) => { + if (typeof node.dispatchEvent === 'function') { + node.dispatchEvent(onLoadEvent); + } + if (after && to) { if (to.parentNode) { to.parentNode.insertBefore(node, to); + if (typeof node.dispatchEvent === 'function') { + node.dispatchEvent(onMountEvent); + } // if (!to.nextSibling) { // to.parentNode.appendChild(node); // } else { @@ -20,7 +33,13 @@ const append = (node, to, after) => { return node; } - return to.appendChild(node); + to.appendChild(node); + + if (typeof node.dispatchEvent === 'function') { + node.dispatchEvent(onMountEvent); + } + + return node; }; export default append;