diff --git a/packages/omis/dist/omis.d.ts b/packages/omis/dist/omis.d.ts index 2c6d11df7..b2e4f3e5e 100755 --- a/packages/omis/dist/omis.d.ts +++ b/packages/omis/dist/omis.d.ts @@ -79,9 +79,9 @@ declare namespace Omis { componentWillUnmount?(): void; getChildContext?(): object; componentWillReceiveProps?(nextProps: Readonly

, nextContext: any): void; - shouldComponentUpdate?(nextProps: Readonly

, nextState: Readonly, nextContext: any): boolean; - componentWillUpdate?(nextProps: Readonly

, nextState: Readonly, nextContext: any): void; - componentDidUpdate?(previousProps: Readonly

, previousState: Readonly, previousContext: any): void; + shouldComponentUpdate?(nextProps: Readonly

, nextContext: any): boolean; + componentWillUpdate?(nextProps: Readonly

, nextContext: any): void; + componentDidUpdate?(previousProps: Readonly

, previousContext: any): void; } abstract class Component { @@ -90,14 +90,13 @@ declare namespace Omis { static displayName?: string; static defaultProps?: any; - state: Readonly; props: RenderableProps

; context: any; base?: HTMLElement; update(callback?: () => void): void; - abstract render(props?: RenderableProps

, state?: Readonly, context?: any): ComponentChild; + abstract render(props?: RenderableProps

, context?: any): ComponentChild; // Add these variables to avoid descendants shadowing them (some from properties.json for minification) private __key; @@ -108,7 +107,6 @@ declare namespace Omis { private nextBase; private prevContext; private prevProps; - private prevState; private __d; private __x; private __l; diff --git a/packages/omis/dist/omis.dev.js b/packages/omis/dist/omis.dev.js index e446fb66c..95bb7eb00 100644 --- a/packages/omis/dist/omis.dev.js +++ b/packages/omis/dist/omis.dev.js @@ -1,5 +1,5 @@ /** - * omis v0.5.0 http://omijs.org + * omis v0.6.0 http://omijs.org * Omi === Preact + Scoped CSS + Store System + Native Support in 3kb javascript. * By dntzhang https://github.com/dntzhang * Github: https://github.com/Tencent/omis @@ -824,8 +824,8 @@ } /** The `.render()` method for a PFC backing instance. */ - function doRender(props) { - return this.constructor(props, this.store); + function doRender(props, context) { + return this.constructor(props, this.store, context); } /** @@ -845,17 +845,15 @@ delete props.ref; delete props.key; - if (typeof component.constructor.getDerivedStateFromProps === 'undefined') { - if (!component.base || mountAll) { - //if (component.componentWillMount) component.componentWillMount(); - if (component.store.install) component.store.install(); - } else { - // if (component.componentWillReceiveProps) { - // component.componentWillReceiveProps(props, context); - // } - if (component.store.receiveProps) { - component.__needUpdate_ = component.store.receiveProps(props, context); - } + if (!component.base || mountAll) { + //if (component.componentWillMount) component.componentWillMount(); + if (component.store.install) component.store.install(); + } else { + // if (component.componentWillReceiveProps) { + // component.componentWillReceiveProps(props, context); + // } + if (component.store.receiveProps) { + component.__needUpdate_ = component.store.receiveProps(props, context); } } @@ -893,10 +891,8 @@ if (component._disable) return; var props = component.props, - state = component.state, context = component.context, previousProps = component.prevProps || props, - previousState = component.prevState || state, previousContext = component.prevContext || context, isUpdate = component.base, nextBase = component.nextBase, @@ -908,21 +904,15 @@ inst, cbase; - if (component.constructor.getDerivedStateFromProps) { - state = extend(extend({}, state), component.constructor.getDerivedStateFromProps(props, state)); - component.state = state; - } - // if updating if (isUpdate) { component.props = previousProps; - component.state = previousState; component.context = previousContext; if (component.__needUpdate_ !== false) { skip = false; if (component.store.beforeUpdate) { - component.store.beforeUpdate(props, state, context); + component.store.beforeUpdate(props, context); } } else { skip = true; @@ -930,11 +920,10 @@ delete component.__needUpdate_; component.props = props; - component.state = state; component.context = context; } - component.prevProps = component.prevState = component.prevContext = component.nextBase = null; + component.prevProps = component.prevContext = component.nextBase = null; component._dirty = false; if (!skip) { @@ -942,7 +931,7 @@ if (component.store.beforeRender) { component.store.beforeRender(); } - rendered = component.render(props, state, context); + rendered = component.render(props, context); options.runTimeComponent = null; // context to pass to the child, can be updated via (grand-)parent component @@ -951,7 +940,7 @@ } if (isUpdate && component.getSnapshotBeforeUpdate) { - snapshot = component.getSnapshotBeforeUpdate(previousProps, previousState); + snapshot = component.getSnapshotBeforeUpdate(previousProps); } var childComponent = rendered && rendered.nodeName, @@ -1028,11 +1017,8 @@ // Note: disabled as it causes duplicate hooks, see https://github.com/developit/Omi/issues/750 // flushMounts(); - // if (component.componentDidUpdate) { - // component.componentDidUpdate(previousProps, previousState, snapshot); - // } if (component.store.updated) { - component.store.updated(previousProps, previousState, snapshot); + component.store.updated(previousProps, snapshot); } if (options.afterUpdate) options.afterUpdate(component); } @@ -1133,7 +1119,7 @@ * * @example * class MyFoo extends Component { - * render(props, state) { + * render(props) { * return

; * } * } @@ -1156,12 +1142,6 @@ */ this.props = props; - /** - * @public - * @type {object} - */ - this.state = this.state || {}; - this._renderCallbacks = []; } @@ -1180,11 +1160,10 @@ /** - * Accepts `props` and `state`, and returns a new Virtual DOM tree to build. + * Accepts `props`, and returns a new Virtual DOM tree to build. * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx). * @param {object} props Props (eg: JSX attributes) received from parent * element/component - * @param {object} state The component's current state * @param {object} context Context object, as returned by the nearest * ancestor's `getChildContext()` * @returns {import('./vnode').VNode | void} diff --git a/packages/omis/dist/omis.dev.js.map b/packages/omis/dist/omis.dev.js.map index 2426cb5d0..34045e6d8 100644 --- a/packages/omis/dist/omis.dev.js.map +++ b/packages/omis/dist/omis.dev.js.map @@ -1 +1 @@ -{"version":3,"file":"omis.dev.js","sources":["../src/vnode.js","../src/options.js","../src/style.js","../src/h.js","../src/util.js","../src/clone-element.js","../src/constants.js","../src/render-queue.js","../src/vdom/index.js","../src/dom/index.js","../src/vdom/diff.js","../src/vdom/component-recycler.js","../src/vdom/component.js","../src/component.js","../src/render.js","../src/omis.js","../src/omis.js"],"sourcesContent":["/**\n * Virtual DOM Node\n * @typedef VNode\n * @property {string | function} nodeName The string of the DOM node to create or Component constructor to render\n * @property {Array} children The children of node\n * @property {string | number | undefined} key The key used to identify this VNode in a list\n * @property {object} attributes The properties of this VNode\n */\nexport const VNode = function VNode() {};\n","/**\n * @typedef {import('./component').Component} Component\n * @typedef {import('./vnode').VNode} VNode\n */\n\n/**\n * Global options\n * @public\n * @typedef Options\n * @property {boolean} [syncComponentUpdates] If `true`, `prop` changes trigger synchronous component updates. Defaults to true.\n * @property {(vnode: VNode) => void} [vnode] Processes all created VNodes.\n * @property {(component: Component) => void} [afterMount] Hook invoked after a component is mounted.\n * @property {(component: Component) => void} [afterUpdate] Hook invoked after the DOM is updated with a component's latest render.\n * @property {(component: Component) => void} [beforeUnmount] Hook invoked immediately before a component is unmounted.\n * @property {(rerender: function) => void} [debounceRendering] Hook invoked whenever a rerender is requested. Can be used to debounce rerenders.\n * @property {(event: Event) => Event | void} [event] Hook invoked before any Omi event listeners. The return value (if any) replaces the native browser event given to event listeners\n */\n\n/** @type {Options} */\nconst options = {\n\trunTimeComponent: {},\n\tstyleCache: [],\n\tstaticStyleMapping: {}\n};\n\nexport default options;\n","import options from './options'\n\nlet styleId = 0\n\nexport function getCtorName(ctor) {\n for (let i = 0, len = options.styleCache.length; i < len; i++) {\n let item = options.styleCache[i]\n\n if (item.ctor === ctor) {\n return item.attrName\n }\n }\n\n let attrName = '_ss' + styleId\n options.styleCache.push({ ctor, attrName })\n styleId++\n\n return attrName\n}\n\n// many thanks to https://github.com/thomaspark/scoper/\nexport function scoper(css, prefix) {\n prefix = '[' + prefix.toLowerCase() + ']'\n // https://www.w3.org/TR/css-syntax-3/#lexical\n css = css.replace(/\\/\\*[^*]*\\*+([^/][^*]*\\*+)*\\//g, '')\n // eslint-disable-next-line\n let re = new RegExp('([^\\r\\n,{}:]+)(:[^\\r\\n,{}]+)?(,(?=[^{}]*{)|\\s*{)', 'g')\n /**\n * Example:\n *\n * .classname::pesudo { color:red }\n *\n * g1 is normal selector `.classname`\n * g2 is pesudo class or pesudo element\n * g3 is the suffix\n */\n css = css.replace(re, (g0, g1, g2, g3) => {\n if (typeof g2 === 'undefined') {\n g2 = ''\n }\n\n /* eslint-ignore-next-line */\n if (\n g1.match(\n /^\\s*(@media|\\d+%?|@-webkit-keyframes|@keyframes|to|from|@font-face)/\n )\n ) {\n return g1 + g2 + g3\n }\n\n let appendClass = g1.replace(/(\\s*)$/, '') + prefix + g2\n //let prependClass = prefix + ' ' + g1.trim() + g2;\n\n return appendClass + g3\n //return appendClass + ',' + prependClass + g3;\n })\n\n return css\n}\n\nexport function addStyle(cssText, id) {\n id = id.toLowerCase()\n let ele = document.getElementById(id)\n let head = document.getElementsByTagName('head')[0]\n if (ele && ele.parentNode === head) {\n head.removeChild(ele)\n }\n\n let someThingStyles = document.createElement('style')\n head.appendChild(someThingStyles)\n someThingStyles.setAttribute('type', 'text/css')\n someThingStyles.setAttribute('id', id)\n if (window.ActiveXObject) {\n someThingStyles.styleSheet.cssText = cssText\n } else {\n someThingStyles.textContent = cssText\n }\n}\n\nexport function addStyleToHead(style, attr) {\n\n\tif (!options.staticStyleMapping[attr]) {\n\t\taddStyle(scoper(style, attr), attr)\n\t\toptions.staticStyleMapping[attr] = true\n\t}\n}\n","import { VNode } from './vnode';\nimport options from './options';\nimport {getCtorName} from './style'\n\nconst stack = [];\n\nconst EMPTY_CHILDREN = [];\n\n/**\n * JSX/hyperscript reviver.\n * @see http://jasonformat.com/wtf-is-jsx\n * Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0\n *\n * Note: this is exported as both `h()` and `createElement()` for compatibility\n * reasons.\n *\n * Creates a VNode (virtual DOM element). A tree of VNodes can be used as a\n * lightweight representation of the structure of a DOM tree. This structure can\n * be realized by recursively comparing it against the current _actual_ DOM\n * structure, and applying only the differences.\n *\n * `h()`/`createElement()` accepts an element name, a list of attributes/props,\n * and optionally children to append to the element.\n *\n * @example The following DOM tree\n *\n * `
Hello!
`\n *\n * can be constructed using this function as:\n *\n * `h('div', { id: 'foo', name : 'bar' }, 'Hello!');`\n *\n * @param {string | function} nodeName An element name. Ex: `div`, `a`, `span`, etc.\n * @param {object | null} attributes Any attributes/props to set on the created element.\n * @param {VNode[]} [rest] Additional arguments are taken to be children to\n * append. Can be infinitely nested Arrays.\n *\n * @public\n */\nexport function h(nodeName, attributes) {\n\tlet children=EMPTY_CHILDREN, lastSimple, child, simple, i;\n\tfor (i=arguments.length; i-- > 2; ) {\n\t\tstack.push(arguments[i]);\n\t}\n\tif (attributes && attributes.children!=null) {\n\t\tif (!stack.length) stack.push(attributes.children);\n\t\tdelete attributes.children;\n\t}\n\twhile (stack.length) {\n\t\tif ((child = stack.pop()) && child.pop!==undefined) {\n\t\t\tfor (i=child.length; i--; ) stack.push(child[i]);\n\t\t}\n\t\telse {\n\t\t\tif (typeof child==='boolean') child = null;\n\n\t\t\tif ((simple = typeof nodeName!=='function')) {\n\t\t\t\tif (child==null) child = '';\n\t\t\t\telse if (typeof child==='number') child = String(child);\n\t\t\t\telse if (typeof child!=='string') simple = false;\n\t\t\t}\n\n\t\t\tif (simple && lastSimple) {\n\t\t\t\tchildren[children.length-1] += child;\n\t\t\t}\n\t\t\telse if (children===EMPTY_CHILDREN) {\n\t\t\t\tchildren = [child];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tchildren.push(child);\n\t\t\t}\n\n\t\t\tlastSimple = simple;\n\t\t}\n\t}\n\n\tlet p = new VNode();\n\tp.nodeName = nodeName;\n\tp.children = children;\n\tp.attributes = attributes==null ? {} : attributes;\n\tif(options.runTimeComponent){\n\t\tif(options.runTimeComponent.constructor.css){\n\t\t\tp.attributes[getCtorName(options.runTimeComponent.constructor)] = ''\n\t\t}\n\t\tif(options.runTimeComponent.props && options.runTimeComponent.props.css){\n\t\t\tp.attributes['_ds'+options.runTimeComponent.elementId] = ''\n\t\t}\n\t}\n\n\tp.key = p.attributes.key;\n\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\n\tif (options.vnode!==undefined) options.vnode(p);\n\n\treturn p;\n}\n","/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function extend(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\n}\n\n/** Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} [ref=null]\n * @param {any} [value]\n */\nexport function applyRef(ref, value) {\n\tif (ref) {\n\t\tif (typeof ref=='function') ref(value);\n\t\telse ref.current = value;\n\t}\n}\n\n/**\n * Call a function asynchronously, as soon as possible. Makes\n * use of HTML Promise to schedule the callback if available,\n * otherwise falling back to `setTimeout` (mainly for IE<11).\n * @type {(callback: function) => void}\n */\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;\n","import { extend } from './util';\nimport { h } from './h';\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its\n * children.\n * @param {import('./vnode').VNode} vnode The virtual DOM element to clone\n * @param {object} props Attributes/props to add when cloning\n * @param {Array} [rest] Any additional arguments will be used as replacement\n * children.\n */\nexport function cloneElement(vnode, props) {\n\treturn h(\n\t\tvnode.nodeName,\n\t\textend(extend({}, vnode.attributes), props),\n\t\targuments.length>2 ? [].slice.call(arguments, 2) : vnode.children\n\t);\n}\n","// render modes\n\n/** Do not re-render a component */\nexport const NO_RENDER = 0;\n/** Synchronously re-render a component and its children */\nexport const SYNC_RENDER = 1;\n/** Synchronously re-render a component, even if its lifecycle methods attempt to prevent it. */\nexport const FORCE_RENDER = 2;\n/** Queue asynchronous re-render of a component and it's children */\nexport const ASYNC_RENDER = 3;\n\n\nexport const ATTR_KEY = 'prevProps';\n\n/** DOM properties that should NOT have \"px\" added when numeric */\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;\n\n","import options from './options';\nimport { defer } from './util';\nimport { renderComponent } from './vdom/component';\n\n/**\n * Managed queue of dirty components to be re-rendered\n * @type {Array}\n */\nlet items = [];\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./component').Component} component The component to rerender\n */\nexport function enqueueRender(component) {\n\tif (!component._dirty && (component._dirty = true) && items.push(component)==1) {\n\t\t(options.debounceRendering || defer)(rerender);\n\t}\n}\n\n/** Rerender all enqueued dirty components */\nexport function rerender() {\n\tlet p;\n\twhile ( (p = items.pop()) ) {\n\t\tif (p._dirty) renderComponent(p);\n\t}\n}\n","import { extend } from '../util';\n\n\n/**\n * Check if two nodes are equivalent.\n * @param {import('../dom').OmiElement} node DOM Node to compare\n * @param {import('../vnode').VNode} vnode Virtual DOM node to compare\n * @param {boolean} [hydrating=false] If true, ignores component constructors\n * when comparing.\n * @private\n */\nexport function isSameNodeType(node, vnode, hydrating) {\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\t\treturn node.splitText!==undefined;\n\t}\n\tif (typeof vnode.nodeName==='string') {\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName);\n\t}\n\treturn hydrating || node._componentConstructor===vnode.nodeName;\n}\n\n\n/**\n * Check if an Element has a given nodeName, case-insensitively.\n * @param {import('../dom').OmiElement} node A DOM Element to inspect the name of.\n * @param {string} nodeName Unnormalized name to compare against.\n */\nexport function isNamedNode(node, nodeName) {\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase();\n}\n\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n * @param {import('../vnode').VNode} vnode The VNode to get props for\n * @returns {object} The props to use for this VNode\n */\nexport function getNodeProps(vnode) {\n\tlet props = extend({}, vnode.attributes);\n\tprops.children = vnode.children;\n\n\tlet defaultProps = vnode.nodeName.defaultProps;\n\tif (defaultProps!==undefined) {\n\t\tfor (let i in defaultProps) {\n\t\t\tif (props[i]===undefined) {\n\t\t\t\tprops[i] = defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn props;\n}\n","import { IS_NON_DIMENSIONAL } from '../constants';\nimport { applyRef } from '../util';\nimport options from '../options';\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Omi adds to elements it creates\n * @typedef OmiElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Omi properties\n * @typedef {Element & ElementCSSInlineStyle & OmiElementExtensions} OmiElement\n */\n\n/**\n * Create an element with the given nodeName.\n * @param {string} nodeName The DOM node to create\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\n * namespace.\n * @returns {OmiElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n\t/** @type {OmiElement} */\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);\n\tnode.normalizedNodeName = nodeName;\n\treturn node;\n}\n\n\n/**\n * Remove a child node from its parent if attached.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\n\n/**\n * Set a named attribute on the given Node, with special behavior for some names\n * and event handlers. If `value` is `null`, the attribute/handler will be\n * removed.\n * @param {OmiElement} node An element to mutate\n * @param {string} name The name/key to set, such as an event or attribute name\n * @param {*} old The last value that was set for this name/node pair\n * @param {*} value An attribute value, such as a function to be used as an\n * event handler\n * @param {boolean} isSvg Are we currently diffing inside an svg?\n * @private\n */\nexport function setAccessor(node, name, old, value, isSvg, store) {\n\tif (name==='className') name = 'class';\n\n\n\tif (name==='key') {\n\t\t// ignore\n\t}\n\telse if (name==='ref') {\n\t\tapplyRef(old, null);\n\t\tapplyRef(value, node);\n\t}\n\telse if (name==='class' && !isSvg) {\n\t\tnode.className = value || '';\n\t}\n\telse if (name==='style') {\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\n\t\t\tnode.style.cssText = value || '';\n\t\t}\n\t\tif (value && typeof value==='object') {\n\t\t\tif (typeof old!=='string') {\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = '';\n\t\t\t}\n\t\t\tfor (let i in value) {\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i];\n\t\t\t}\n\t\t}\n\t}\n\telse if (name==='dangerouslySetInnerHTML') {\n\t\tif (value) node.innerHTML = value.__html || '';\n\t}\n\telse if (name[0]=='o' && name[1]=='n') {\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''));\n\t\tname = name.toLowerCase().substring(2);\n\t\tif (value) {\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\telse {\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\t(node._listeners || (node._listeners = {}))[name] = (value && store) ? value.bind(store) : value;\n\t}\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\n\t\t// Attempt to set a DOM property to the given value.\n\t\t// IE & FF throw for certain property-value combinations.\n\t\ttry {\n\t\t\tnode[name] = value==null ? '' : value;\n\t\t} catch (e) { }\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name);\n\t}\n\telse {\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')));\n\t\t// spellcheck is treated differently than all other boolean values and\n\t\t// should not be removed when the value is `false`. See:\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\n\t\tif (value==null || value===false) {\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());\n\t\t\telse node.removeAttribute(name);\n\t\t}\n\t\telse if (typeof value!=='function') {\n\t\t\tif (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);\n\t\t\telse node.setAttribute(name, value);\n\t\t}\n\t}\n}\n\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\treturn this._listeners[e.type](options.event && options.event(e) || e);\n}\n","import { ATTR_KEY } from '../constants';\nimport { isSameNodeType, isNamedNode } from './index';\nimport { buildComponentFromVNode } from './component';\nimport { createNode, setAccessor } from '../dom/index';\nimport { unmountComponent } from './component';\nimport options from '../options';\nimport { applyRef } from '../util';\nimport { removeNode } from '../dom/index';\nimport { addStyleToHead, getCtorName } from '../style'\n\n/**\n * Queue of components that have been mounted and are awaiting componentDidMount\n * @type {Array}\n */\nexport const mounts = [];\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0;\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false;\n\n/** Global flag indicating if the diff is performing hydration */\nlet hydrating = false;\n\n/** Invoke queued componentDidMount lifecycle methods */\nexport function flushMounts() {\n\tlet c;\n\twhile ((c = mounts.shift())) {\n\t\tif (c.constructor.css) {\n addStyleToHead(c.constructor.css, getCtorName(c.constructor))\n\t\t}\n\t\tif(c.props.css){\n\t\t\taddStyleToHead(c.props.css, '_ds'+c.elementId)\n\t\t}\n\t\tif (options.afterMount) options.afterMount(c);\n\t\t//if (c.componentDidMount) c.componentDidMount();\n\t\tif (c.store.installed) c.store.installed()\n\t}\n}\n\n\n/**\n * Apply differences in a given vnode (and it's deep children) to a real DOM Node.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing\n * the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {Element} parent ?\n * @param {boolean} componentRoot ?\n * @returns {import('../dom').OmiElement} The created/mutated element\n * @private\n */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot, store) {\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n\tif (!diffLevel++) {\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined;\n\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\n\t\thydrating = dom!=null && !(ATTR_KEY in dom);\n\t}\n\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot, store);\n\n\t// append the element if its a new parent\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret);\n\n\t// diffLevel being reduced to 0 means we're exiting the diff\n\tif (!--diffLevel) {\n\t\thydrating = false;\n\t\t// invoke queued componentDidMount lifecycle methods\n\t\tif (!componentRoot) flushMounts();\n\t}\n\n\treturn ret;\n}\n\n\n/**\n * Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} [componentRoot] ?\n * @private\n */\nfunction idiff(dom, vnode, context, mountAll, componentRoot, store) {\n\tlet out = dom,\n\t\tprevSvgMode = isSvgMode;\n\n\t// empty values (null, undefined, booleans) render as empty Text nodes\n\tif (vnode==null || typeof vnode==='boolean') vnode = '';\n\n\n\t// Fast case: Strings & Numbers create/update Text nodes.\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\n\t\t// update if it's already a Text node:\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/Omi/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\n\t\t\tif (dom.nodeValue!=vnode) {\n\t\t\t\tdom.nodeValue = vnode;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\n\t\t\tout = document.createTextNode(vnode);\n\t\t\tif (dom) {\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\t\t\t\trecollectNodeTree(dom, true);\n\t\t\t}\n\t\t}\n\n\t\tout[ATTR_KEY] = true;\n\n\t\treturn out;\n\t}\n\n\n\t// If the VNode represents a Component, perform a component diff:\n\tlet vnodeName = vnode.nodeName;\n\tif (typeof vnodeName==='function') {\n\t\treturn buildComponentFromVNode(dom, vnode, context, mountAll);\n\t}\n\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode;\n\n\n\t// If there's no existing element or it's the wrong type, create a new one:\n\tvnodeName = String(vnodeName);\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\n\t\tout = createNode(vnodeName, isSvgMode);\n\n\t\tif (dom) {\n\t\t\t// move children into the replacement node\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild);\n\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\n\t\t\t// recycle the old element (skips non-Element node types)\n\t\t\trecollectNodeTree(dom, true);\n\t\t}\n\t}\n\n\n\tlet fc = out.firstChild,\n\t\tprops = out[ATTR_KEY],\n\t\tvchildren = vnode.children;\n\n\tif (props==null) {\n\t\tprops = out[ATTR_KEY] = {};\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value;\n\t}\n\n\t// Optimization: fast-path for elements containing a single TextNode:\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\n\t\tif (fc.nodeValue!=vchildren[0]) {\n\t\t\tfc.nodeValue = vchildren[0];\n\t\t}\n\t}\n\t// otherwise, if there are existing or new children, diff them:\n\telse if (vchildren && vchildren.length || fc!=null) {\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null, store);\n\t}\n\n\n\t// Apply attributes/props from VNode to the DOM Element:\n\tdiffAttributes(out, vnode.attributes, props, store);\n\n\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\n\tisSvgMode = prevSvgMode;\n\n\treturn out;\n}\n\n\n/**\n * Apply child and attribute changes between a VNode and a DOM Node to the DOM.\n * @param {import('../dom').OmiElement} dom Element whose children should be compared & mutated\n * @param {Array} vchildren Array of VNodes to compare to `dom.childNodes`\n * @param {object} context Implicitly descendant context object (from most\n * recent `getChildContext()`)\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} isHydrating if `true`, consumes externally created elements\n * similar to hydration\n */\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating, store) {\n\tlet originalChildren = dom.childNodes,\n\t\tchildren = [],\n\t\tkeyed = {},\n\t\tkeyedLen = 0,\n\t\tmin = 0,\n\t\tlen = originalChildren.length,\n\t\tchildrenLen = 0,\n\t\tvlen = vchildren ? vchildren.length : 0,\n\t\tj, c, f, vchild, child;\n\n\t// Build up a map of keyed children and an Array of unkeyed children:\n\tif (len!==0) {\n\t\tfor (let i=0; i;\n * }\n * }\n */\n\n let id = 0\n\nexport function Component(props, context) {\n\tthis._dirty = true;\n\tthis.elementId = id++\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.context = context;\n\tthis.store = {}\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.props = props;\n\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.state = this.state || {};\n\n\tthis._renderCallbacks = [];\n}\n\n\nextend(Component.prototype, {\n\n\t/**\n\t * Immediately perform a synchronous re-render of the component.\n\t * @param {() => void} callback A function to be called after component is\n\t * \tre-rendered.\n\t * @private\n\t */\n\tupdate(callback) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\trenderComponent(this, FORCE_RENDER);\n\t},\n\n\t/**\n\t * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n\t * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n\t * @param {object} props Props (eg: JSX attributes) received from parent\n\t * \telement/component\n\t * @param {object} state The component's current state\n\t * @param {object} context Context object, as returned by the nearest\n\t * ancestor's `getChildContext()`\n\t * @returns {import('./vnode').VNode | void}\n\t */\n\trender() {}\n\n});\n","import { diff } from './vdom/diff';\n\n/**\n * Render JSX into a `parent` Element.\n * @param {import('./vnode').VNode} vnode A (JSX) VNode to render\n * @param {import('./dom').OmiElement} parent DOM element to render into\n * @param {import('./dom').OmiElement} [merge] Attempt to re-use an existing DOM tree rooted at\n * `merge`\n * @public\n *\n * @example\n * // render a div into :\n * render(
hello!
, document.body);\n *\n * @example\n * // render a \"Thing\" component into #foo:\n * const Thing = ({ name }) => { name };\n * render(, document.querySelector('#foo'));\n */\nexport function render(vnode, parent, merge) {\n\treturn diff(merge, vnode, {}, false, typeof parent === 'string' ? document.querySelector(parent) : parent, false);\n}\n","import { h, h as createElement } from './h';\nimport { cloneElement } from './clone-element';\nimport { Component } from './component';\nimport { render } from './render';\nimport { rerender } from './render-queue';\nimport options from './options';\n\nfunction createRef() {\n\treturn {};\n}\n\nexport default {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nexport {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nif(typeof window !== 'undefined'){\n\twindow.Omis = {\n\t\th,\n\t\tcreateElement,\n\t\tcloneElement,\n\t\tcreateRef,\n\t\tComponent,\n\t\trender,\n\t\trerender,\n\t\toptions\n\t};\n}\n","\n\t\t\t\timport Omis from './omis';\n\t\t\t\tif (typeof module!='undefined') module.exports = Omis;\n\t\t\t\telse self.Omis = Omis;\n\t\t\t"],"names":["VNode","options","runTimeComponent","styleCache","staticStyleMapping","styleId","getCtorName","ctor","i","len","length","item","attrName","push","scoper","css","prefix","toLowerCase","replace","re","RegExp","g0","g1","g2","g3","match","appendClass","addStyle","cssText","id","ele","document","getElementById","head","getElementsByTagName","parentNode","removeChild","someThingStyles","createElement","appendChild","setAttribute","window","ActiveXObject","styleSheet","textContent","addStyleToHead","style","attr","stack","EMPTY_CHILDREN","h","nodeName","attributes","children","lastSimple","child","simple","arguments","pop","undefined","String","p","constructor","props","elementId","key","vnode","extend","obj","applyRef","ref","value","current","defer","Promise","resolve","then","bind","setTimeout","cloneElement","slice","call","NO_RENDER","SYNC_RENDER","FORCE_RENDER","ASYNC_RENDER","ATTR_KEY","IS_NON_DIMENSIONAL","items","enqueueRender","component","_dirty","debounceRendering","rerender","renderComponent","isSameNodeType","node","hydrating","splitText","_componentConstructor","isNamedNode","normalizedNodeName","getNodeProps","defaultProps","createNode","isSvg","createElementNS","removeNode","setAccessor","name","old","store","className","test","innerHTML","__html","useCapture","substring","addEventListener","eventProxy","removeEventListener","_listeners","e","removeAttribute","ns","removeAttributeNS","setAttributeNS","type","event","mounts","diffLevel","isSvgMode","flushMounts","c","shift","afterMount","installed","diff","dom","context","mountAll","parent","componentRoot","ownerSVGElement","ret","idiff","out","prevSvgMode","_component","nodeValue","createTextNode","replaceChild","recollectNodeTree","vnodeName","buildComponentFromVNode","firstChild","fc","vchildren","a","nextSibling","innerDiffNode","dangerouslySetInnerHTML","diffAttributes","isHydrating","originalChildren","childNodes","keyed","keyedLen","min","childrenLen","vlen","j","f","vchild","__key","trim","insertBefore","unmountOnly","unmountComponent","removeChildren","lastChild","next","previousSibling","attrs","recyclerComponents","createComponent","Ctor","inst","Component","render","doRender","update","nextBase","splice","setComponentProps","renderMode","_disable","__ref","getDerivedStateFromProps","base","install","receiveProps","__needUpdate_","prevContext","prevProps","syncComponentUpdates","isChild","state","previousProps","previousState","prevState","previousContext","isUpdate","initialBase","initialChildComponent","skip","snapshot","rendered","cbase","beforeUpdate","beforeRender","getChildContext","getSnapshotBeforeUpdate","childComponent","toUnmount","childProps","_parentComponent","baseParent","componentRef","t","updated","afterUpdate","_renderCallbacks","originalComponent","oldDom","isDirectOwner","isOwner","beforeUnmount","uninstall","inner","prototype","callback","merge","querySelector","createRef","Omis","module","exports","self"],"mappings":";;;;;;;;;;;CAAA;;;;;;;;AAQA,CAAO,IAAMA,QAAQ,SAASA,KAAT,GAAiB,EAA/B;;CCRP;;;;;CAKA;;;;;;;;;;;;;CAaA;CACA,IAAMC,UAAU;CACfC,oBAAkB,EADH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AKA,KAAL,IAAc,EAA3B;;CAEA,MAAKyB,gBAAL,GAAwB,EAAxB;CACA;;CAGDrK,OAAOyH,UAAUoD,SAAjB,EAA4B;;CAE3B;;;;;;CAMAjD,OAR2B,kBAQpBkD,QARoB,EAQV;CAChB,MAAIA,QAAJ,EAAc,KAAKT,gBAAL,CAAsB3N,IAAtB,CAA2BoO,QAA3B;CACdnJ,kBAAgB,IAAhB,EAAsBV,YAAtB;CACA,EAX0B;;;CAa3B;;;;;;;;;;CAUAyG,OAvB2B,oBAuBlB;CAvBkB,CAA5B;;;;;;;;;;;;;;;;;;;AC3BA,CAAO,SAASA,MAAT,CAAgB3H,KAAhB,EAAuB2E,MAAvB,EAA+BqG,KAA/B,EAAsC;CAC5C,SAAOzG,KAAKyG,KAAL,EAAYhL,KAAZ,EAAmB,EAAnB,EAAuB,KAAvB,EAA8B,OAAO2E,MAAP,KAAkB,QAAlB,GAA6B9G,SAASoN,aAAT,CAAuBtG,MAAvB,CAA7B,GAA8DA,MAA5F,EAAoG,KAApG,CAAP;CACA;;UCdQuG,SAAT,GAAqB;CACpB,QAAO,EAAP;CACA;;AAED,YAAe;CACdlM,KADc;CAEdZ,iBAFc;CAGdyC,2BAHc;CAIdqK,qBAJc;CAKdxD,qBALc;CAMdC,eANc;CAOdhG,mBAPc;CAQd5F;CARc,CAAf;;CAsBA,IAAG,OAAOwC,MAAP,KAAkB,WAArB,EAAiC;CAChCA,QAAO4M,IAAP,GAAc;CACbnM,MADa;CAEbZ,kBAFa;CAGbyC,4BAHa;CAIbqK,sBAJa;CAKbxD,sBALa;CAMbC,gBANa;CAObhG,oBAPa;CAQb5F;CARa,EAAd;CAUA;;KC1CO,OAAOqP,MAAP,IAAe,WAAnB,EAAgCA,OAAOC,OAAP,GAAiBF,IAAjB,CAAhC,KACKG,KAAKH,IAAL,GAAYA,IAAZ;;"} \ No newline at end of file +{"version":3,"file":"omis.dev.js","sources":["../src/vnode.js","../src/options.js","../src/style.js","../src/h.js","../src/util.js","../src/clone-element.js","../src/constants.js","../src/render-queue.js","../src/vdom/index.js","../src/dom/index.js","../src/vdom/diff.js","../src/vdom/component-recycler.js","../src/vdom/component.js","../src/component.js","../src/render.js","../src/omis.js","../src/omis.js"],"sourcesContent":["/**\n * Virtual DOM Node\n * @typedef VNode\n * @property {string | function} nodeName The string of the DOM node to create or Component constructor to render\n * @property {Array} children The children of node\n * @property {string | number | undefined} key The key used to identify this VNode in a list\n * @property {object} attributes The properties of this VNode\n */\nexport const VNode = function VNode() {};\n","/**\n * @typedef {import('./component').Component} Component\n * @typedef {import('./vnode').VNode} VNode\n */\n\n/**\n * Global options\n * @public\n * @typedef Options\n * @property {boolean} [syncComponentUpdates] If `true`, `prop` changes trigger synchronous component updates. Defaults to true.\n * @property {(vnode: VNode) => void} [vnode] Processes all created VNodes.\n * @property {(component: Component) => void} [afterMount] Hook invoked after a component is mounted.\n * @property {(component: Component) => void} [afterUpdate] Hook invoked after the DOM is updated with a component's latest render.\n * @property {(component: Component) => void} [beforeUnmount] Hook invoked immediately before a component is unmounted.\n * @property {(rerender: function) => void} [debounceRendering] Hook invoked whenever a rerender is requested. Can be used to debounce rerenders.\n * @property {(event: Event) => Event | void} [event] Hook invoked before any Omi event listeners. The return value (if any) replaces the native browser event given to event listeners\n */\n\n/** @type {Options} */\nconst options = {\n\trunTimeComponent: {},\n\tstyleCache: [],\n\tstaticStyleMapping: {}\n};\n\nexport default options;\n","import options from './options'\n\nlet styleId = 0\n\nexport function getCtorName(ctor) {\n for (let i = 0, len = options.styleCache.length; i < len; i++) {\n let item = options.styleCache[i]\n\n if (item.ctor === ctor) {\n return item.attrName\n }\n }\n\n let attrName = '_ss' + styleId\n options.styleCache.push({ ctor, attrName })\n styleId++\n\n return attrName\n}\n\n// many thanks to https://github.com/thomaspark/scoper/\nexport function scoper(css, prefix) {\n prefix = '[' + prefix.toLowerCase() + ']'\n // https://www.w3.org/TR/css-syntax-3/#lexical\n css = css.replace(/\\/\\*[^*]*\\*+([^/][^*]*\\*+)*\\//g, '')\n // eslint-disable-next-line\n let re = new RegExp('([^\\r\\n,{}:]+)(:[^\\r\\n,{}]+)?(,(?=[^{}]*{)|\\s*{)', 'g')\n /**\n * Example:\n *\n * .classname::pesudo { color:red }\n *\n * g1 is normal selector `.classname`\n * g2 is pesudo class or pesudo element\n * g3 is the suffix\n */\n css = css.replace(re, (g0, g1, g2, g3) => {\n if (typeof g2 === 'undefined') {\n g2 = ''\n }\n\n /* eslint-ignore-next-line */\n if (\n g1.match(\n /^\\s*(@media|\\d+%?|@-webkit-keyframes|@keyframes|to|from|@font-face)/\n )\n ) {\n return g1 + g2 + g3\n }\n\n let appendClass = g1.replace(/(\\s*)$/, '') + prefix + g2\n //let prependClass = prefix + ' ' + g1.trim() + g2;\n\n return appendClass + g3\n //return appendClass + ',' + prependClass + g3;\n })\n\n return css\n}\n\nexport function addStyle(cssText, id) {\n id = id.toLowerCase()\n let ele = document.getElementById(id)\n let head = document.getElementsByTagName('head')[0]\n if (ele && ele.parentNode === head) {\n head.removeChild(ele)\n }\n\n let someThingStyles = document.createElement('style')\n head.appendChild(someThingStyles)\n someThingStyles.setAttribute('type', 'text/css')\n someThingStyles.setAttribute('id', id)\n if (window.ActiveXObject) {\n someThingStyles.styleSheet.cssText = cssText\n } else {\n someThingStyles.textContent = cssText\n }\n}\n\nexport function addStyleToHead(style, attr) {\n\n\tif (!options.staticStyleMapping[attr]) {\n\t\taddStyle(scoper(style, attr), attr)\n\t\toptions.staticStyleMapping[attr] = true\n\t}\n}\n","import { VNode } from './vnode';\nimport options from './options';\nimport {getCtorName} from './style'\n\nconst stack = [];\n\nconst EMPTY_CHILDREN = [];\n\n/**\n * JSX/hyperscript reviver.\n * @see http://jasonformat.com/wtf-is-jsx\n * Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0\n *\n * Note: this is exported as both `h()` and `createElement()` for compatibility\n * reasons.\n *\n * Creates a VNode (virtual DOM element). A tree of VNodes can be used as a\n * lightweight representation of the structure of a DOM tree. This structure can\n * be realized by recursively comparing it against the current _actual_ DOM\n * structure, and applying only the differences.\n *\n * `h()`/`createElement()` accepts an element name, a list of attributes/props,\n * and optionally children to append to the element.\n *\n * @example The following DOM tree\n *\n * `
Hello!
`\n *\n * can be constructed using this function as:\n *\n * `h('div', { id: 'foo', name : 'bar' }, 'Hello!');`\n *\n * @param {string | function} nodeName An element name. Ex: `div`, `a`, `span`, etc.\n * @param {object | null} attributes Any attributes/props to set on the created element.\n * @param {VNode[]} [rest] Additional arguments are taken to be children to\n * append. Can be infinitely nested Arrays.\n *\n * @public\n */\nexport function h(nodeName, attributes) {\n\tlet children=EMPTY_CHILDREN, lastSimple, child, simple, i;\n\tfor (i=arguments.length; i-- > 2; ) {\n\t\tstack.push(arguments[i]);\n\t}\n\tif (attributes && attributes.children!=null) {\n\t\tif (!stack.length) stack.push(attributes.children);\n\t\tdelete attributes.children;\n\t}\n\twhile (stack.length) {\n\t\tif ((child = stack.pop()) && child.pop!==undefined) {\n\t\t\tfor (i=child.length; i--; ) stack.push(child[i]);\n\t\t}\n\t\telse {\n\t\t\tif (typeof child==='boolean') child = null;\n\n\t\t\tif ((simple = typeof nodeName!=='function')) {\n\t\t\t\tif (child==null) child = '';\n\t\t\t\telse if (typeof child==='number') child = String(child);\n\t\t\t\telse if (typeof child!=='string') simple = false;\n\t\t\t}\n\n\t\t\tif (simple && lastSimple) {\n\t\t\t\tchildren[children.length-1] += child;\n\t\t\t}\n\t\t\telse if (children===EMPTY_CHILDREN) {\n\t\t\t\tchildren = [child];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tchildren.push(child);\n\t\t\t}\n\n\t\t\tlastSimple = simple;\n\t\t}\n\t}\n\n\tlet p = new VNode();\n\tp.nodeName = nodeName;\n\tp.children = children;\n\tp.attributes = attributes==null ? {} : attributes;\n\tif(options.runTimeComponent){\n\t\tif(options.runTimeComponent.constructor.css){\n\t\t\tp.attributes[getCtorName(options.runTimeComponent.constructor)] = ''\n\t\t}\n\t\tif(options.runTimeComponent.props && options.runTimeComponent.props.css){\n\t\t\tp.attributes['_ds'+options.runTimeComponent.elementId] = ''\n\t\t}\n\t}\n\n\tp.key = p.attributes.key;\n\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\n\tif (options.vnode!==undefined) options.vnode(p);\n\n\treturn p;\n}\n","/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function extend(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\n}\n\n/** Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} [ref=null]\n * @param {any} [value]\n */\nexport function applyRef(ref, value) {\n\tif (ref) {\n\t\tif (typeof ref=='function') ref(value);\n\t\telse ref.current = value;\n\t}\n}\n\n/**\n * Call a function asynchronously, as soon as possible. Makes\n * use of HTML Promise to schedule the callback if available,\n * otherwise falling back to `setTimeout` (mainly for IE<11).\n * @type {(callback: function) => void}\n */\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;\n","import { extend } from './util';\nimport { h } from './h';\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its\n * children.\n * @param {import('./vnode').VNode} vnode The virtual DOM element to clone\n * @param {object} props Attributes/props to add when cloning\n * @param {Array} [rest] Any additional arguments will be used as replacement\n * children.\n */\nexport function cloneElement(vnode, props) {\n\treturn h(\n\t\tvnode.nodeName,\n\t\textend(extend({}, vnode.attributes), props),\n\t\targuments.length>2 ? [].slice.call(arguments, 2) : vnode.children\n\t);\n}\n","// render modes\n\n/** Do not re-render a component */\nexport const NO_RENDER = 0;\n/** Synchronously re-render a component and its children */\nexport const SYNC_RENDER = 1;\n/** Synchronously re-render a component, even if its lifecycle methods attempt to prevent it. */\nexport const FORCE_RENDER = 2;\n/** Queue asynchronous re-render of a component and it's children */\nexport const ASYNC_RENDER = 3;\n\n\nexport const ATTR_KEY = 'prevProps';\n\n/** DOM properties that should NOT have \"px\" added when numeric */\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;\n\n","import options from './options';\nimport { defer } from './util';\nimport { renderComponent } from './vdom/component';\n\n/**\n * Managed queue of dirty components to be re-rendered\n * @type {Array}\n */\nlet items = [];\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./component').Component} component The component to rerender\n */\nexport function enqueueRender(component) {\n\tif (!component._dirty && (component._dirty = true) && items.push(component)==1) {\n\t\t(options.debounceRendering || defer)(rerender);\n\t}\n}\n\n/** Rerender all enqueued dirty components */\nexport function rerender() {\n\tlet p;\n\twhile ( (p = items.pop()) ) {\n\t\tif (p._dirty) renderComponent(p);\n\t}\n}\n","import { extend } from '../util';\n\n\n/**\n * Check if two nodes are equivalent.\n * @param {import('../dom').OmiElement} node DOM Node to compare\n * @param {import('../vnode').VNode} vnode Virtual DOM node to compare\n * @param {boolean} [hydrating=false] If true, ignores component constructors\n * when comparing.\n * @private\n */\nexport function isSameNodeType(node, vnode, hydrating) {\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\t\treturn node.splitText!==undefined;\n\t}\n\tif (typeof vnode.nodeName==='string') {\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName);\n\t}\n\treturn hydrating || node._componentConstructor===vnode.nodeName;\n}\n\n\n/**\n * Check if an Element has a given nodeName, case-insensitively.\n * @param {import('../dom').OmiElement} node A DOM Element to inspect the name of.\n * @param {string} nodeName Unnormalized name to compare against.\n */\nexport function isNamedNode(node, nodeName) {\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase();\n}\n\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n * @param {import('../vnode').VNode} vnode The VNode to get props for\n * @returns {object} The props to use for this VNode\n */\nexport function getNodeProps(vnode) {\n\tlet props = extend({}, vnode.attributes);\n\tprops.children = vnode.children;\n\n\tlet defaultProps = vnode.nodeName.defaultProps;\n\tif (defaultProps!==undefined) {\n\t\tfor (let i in defaultProps) {\n\t\t\tif (props[i]===undefined) {\n\t\t\t\tprops[i] = defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn props;\n}\n","import { IS_NON_DIMENSIONAL } from '../constants';\nimport { applyRef } from '../util';\nimport options from '../options';\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Omi adds to elements it creates\n * @typedef OmiElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Omi properties\n * @typedef {Element & ElementCSSInlineStyle & OmiElementExtensions} OmiElement\n */\n\n/**\n * Create an element with the given nodeName.\n * @param {string} nodeName The DOM node to create\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\n * namespace.\n * @returns {OmiElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n\t/** @type {OmiElement} */\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);\n\tnode.normalizedNodeName = nodeName;\n\treturn node;\n}\n\n\n/**\n * Remove a child node from its parent if attached.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\n\n/**\n * Set a named attribute on the given Node, with special behavior for some names\n * and event handlers. If `value` is `null`, the attribute/handler will be\n * removed.\n * @param {OmiElement} node An element to mutate\n * @param {string} name The name/key to set, such as an event or attribute name\n * @param {*} old The last value that was set for this name/node pair\n * @param {*} value An attribute value, such as a function to be used as an\n * event handler\n * @param {boolean} isSvg Are we currently diffing inside an svg?\n * @private\n */\nexport function setAccessor(node, name, old, value, isSvg, store) {\n\tif (name==='className') name = 'class';\n\n\n\tif (name==='key') {\n\t\t// ignore\n\t}\n\telse if (name==='ref') {\n\t\tapplyRef(old, null);\n\t\tapplyRef(value, node);\n\t}\n\telse if (name==='class' && !isSvg) {\n\t\tnode.className = value || '';\n\t}\n\telse if (name==='style') {\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\n\t\t\tnode.style.cssText = value || '';\n\t\t}\n\t\tif (value && typeof value==='object') {\n\t\t\tif (typeof old!=='string') {\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = '';\n\t\t\t}\n\t\t\tfor (let i in value) {\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i];\n\t\t\t}\n\t\t}\n\t}\n\telse if (name==='dangerouslySetInnerHTML') {\n\t\tif (value) node.innerHTML = value.__html || '';\n\t}\n\telse if (name[0]=='o' && name[1]=='n') {\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''));\n\t\tname = name.toLowerCase().substring(2);\n\t\tif (value) {\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\telse {\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\t(node._listeners || (node._listeners = {}))[name] = (value && store) ? value.bind(store) : value;\n\t}\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\n\t\t// Attempt to set a DOM property to the given value.\n\t\t// IE & FF throw for certain property-value combinations.\n\t\ttry {\n\t\t\tnode[name] = value==null ? '' : value;\n\t\t} catch (e) { }\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name);\n\t}\n\telse {\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')));\n\t\t// spellcheck is treated differently than all other boolean values and\n\t\t// should not be removed when the value is `false`. See:\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\n\t\tif (value==null || value===false) {\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());\n\t\t\telse node.removeAttribute(name);\n\t\t}\n\t\telse if (typeof value!=='function') {\n\t\t\tif (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);\n\t\t\telse node.setAttribute(name, value);\n\t\t}\n\t}\n}\n\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\treturn this._listeners[e.type](options.event && options.event(e) || e);\n}\n","import { ATTR_KEY } from '../constants';\nimport { isSameNodeType, isNamedNode } from './index';\nimport { buildComponentFromVNode } from './component';\nimport { createNode, setAccessor } from '../dom/index';\nimport { unmountComponent } from './component';\nimport options from '../options';\nimport { applyRef } from '../util';\nimport { removeNode } from '../dom/index';\nimport { addStyleToHead, getCtorName } from '../style'\n\n/**\n * Queue of components that have been mounted and are awaiting componentDidMount\n * @type {Array}\n */\nexport const mounts = [];\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0;\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false;\n\n/** Global flag indicating if the diff is performing hydration */\nlet hydrating = false;\n\n/** Invoke queued componentDidMount lifecycle methods */\nexport function flushMounts() {\n\tlet c;\n\twhile ((c = mounts.shift())) {\n\t\tif (c.constructor.css) {\n addStyleToHead(c.constructor.css, getCtorName(c.constructor))\n\t\t}\n\t\tif(c.props.css){\n\t\t\taddStyleToHead(c.props.css, '_ds'+c.elementId)\n\t\t}\n\t\tif (options.afterMount) options.afterMount(c);\n\t\t//if (c.componentDidMount) c.componentDidMount();\n\t\tif (c.store.installed) c.store.installed()\n\t}\n}\n\n\n/**\n * Apply differences in a given vnode (and it's deep children) to a real DOM Node.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing\n * the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {Element} parent ?\n * @param {boolean} componentRoot ?\n * @returns {import('../dom').OmiElement} The created/mutated element\n * @private\n */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot, store) {\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n\tif (!diffLevel++) {\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined;\n\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\n\t\thydrating = dom!=null && !(ATTR_KEY in dom);\n\t}\n\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot, store);\n\n\t// append the element if its a new parent\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret);\n\n\t// diffLevel being reduced to 0 means we're exiting the diff\n\tif (!--diffLevel) {\n\t\thydrating = false;\n\t\t// invoke queued componentDidMount lifecycle methods\n\t\tif (!componentRoot) flushMounts();\n\t}\n\n\treturn ret;\n}\n\n\n/**\n * Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} [componentRoot] ?\n * @private\n */\nfunction idiff(dom, vnode, context, mountAll, componentRoot, store) {\n\tlet out = dom,\n\t\tprevSvgMode = isSvgMode;\n\n\t// empty values (null, undefined, booleans) render as empty Text nodes\n\tif (vnode==null || typeof vnode==='boolean') vnode = '';\n\n\n\t// Fast case: Strings & Numbers create/update Text nodes.\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\n\t\t// update if it's already a Text node:\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/Omi/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\n\t\t\tif (dom.nodeValue!=vnode) {\n\t\t\t\tdom.nodeValue = vnode;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\n\t\t\tout = document.createTextNode(vnode);\n\t\t\tif (dom) {\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\t\t\t\trecollectNodeTree(dom, true);\n\t\t\t}\n\t\t}\n\n\t\tout[ATTR_KEY] = true;\n\n\t\treturn out;\n\t}\n\n\n\t// If the VNode represents a Component, perform a component diff:\n\tlet vnodeName = vnode.nodeName;\n\tif (typeof vnodeName==='function') {\n\t\treturn buildComponentFromVNode(dom, vnode, context, mountAll);\n\t}\n\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode;\n\n\n\t// If there's no existing element or it's the wrong type, create a new one:\n\tvnodeName = String(vnodeName);\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\n\t\tout = createNode(vnodeName, isSvgMode);\n\n\t\tif (dom) {\n\t\t\t// move children into the replacement node\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild);\n\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\n\t\t\t// recycle the old element (skips non-Element node types)\n\t\t\trecollectNodeTree(dom, true);\n\t\t}\n\t}\n\n\n\tlet fc = out.firstChild,\n\t\tprops = out[ATTR_KEY],\n\t\tvchildren = vnode.children;\n\n\tif (props==null) {\n\t\tprops = out[ATTR_KEY] = {};\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value;\n\t}\n\n\t// Optimization: fast-path for elements containing a single TextNode:\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\n\t\tif (fc.nodeValue!=vchildren[0]) {\n\t\t\tfc.nodeValue = vchildren[0];\n\t\t}\n\t}\n\t// otherwise, if there are existing or new children, diff them:\n\telse if (vchildren && vchildren.length || fc!=null) {\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null, store);\n\t}\n\n\n\t// Apply attributes/props from VNode to the DOM Element:\n\tdiffAttributes(out, vnode.attributes, props, store);\n\n\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\n\tisSvgMode = prevSvgMode;\n\n\treturn out;\n}\n\n\n/**\n * Apply child and attribute changes between a VNode and a DOM Node to the DOM.\n * @param {import('../dom').OmiElement} dom Element whose children should be compared & mutated\n * @param {Array} vchildren Array of VNodes to compare to `dom.childNodes`\n * @param {object} context Implicitly descendant context object (from most\n * recent `getChildContext()`)\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} isHydrating if `true`, consumes externally created elements\n * similar to hydration\n */\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating, store) {\n\tlet originalChildren = dom.childNodes,\n\t\tchildren = [],\n\t\tkeyed = {},\n\t\tkeyedLen = 0,\n\t\tmin = 0,\n\t\tlen = originalChildren.length,\n\t\tchildrenLen = 0,\n\t\tvlen = vchildren ? vchildren.length : 0,\n\t\tj, c, f, vchild, child;\n\n\t// Build up a map of keyed children and an Array of unkeyed children:\n\tif (len!==0) {\n\t\tfor (let i=0; i;\n * }\n * }\n */\n\n let id = 0\n\nexport function Component(props, context) {\n\tthis._dirty = true;\n\tthis.elementId = id++\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.context = context;\n\tthis.store = {}\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.props = props;\n\n\tthis._renderCallbacks = [];\n}\n\n\nextend(Component.prototype, {\n\n\t/**\n\t * Immediately perform a synchronous re-render of the component.\n\t * @param {() => void} callback A function to be called after component is\n\t * \tre-rendered.\n\t * @private\n\t */\n\tupdate(callback) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\trenderComponent(this, FORCE_RENDER);\n\t},\n\n\t/**\n\t * Accepts `props`, and returns a new Virtual DOM tree to build.\n\t * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n\t * @param {object} props Props (eg: JSX attributes) received from parent\n\t * \telement/component\n\t * @param {object} context Context object, as returned by the nearest\n\t * ancestor's `getChildContext()`\n\t * @returns {import('./vnode').VNode | void}\n\t */\n\trender() {}\n\n});\n","import { diff } from './vdom/diff';\n\n/**\n * Render JSX into a `parent` Element.\n * @param {import('./vnode').VNode} vnode A (JSX) VNode to render\n * @param {import('./dom').OmiElement} parent DOM element to render into\n * @param {import('./dom').OmiElement} [merge] Attempt to re-use an existing DOM tree rooted at\n * `merge`\n * @public\n *\n * @example\n * // render a div into :\n * render(
hello!
, document.body);\n *\n * @example\n * // render a \"Thing\" component into #foo:\n * const Thing = ({ name }) => { name };\n * render(, document.querySelector('#foo'));\n */\nexport function render(vnode, parent, merge) {\n\treturn diff(merge, vnode, {}, false, typeof parent === 'string' ? document.querySelector(parent) : parent, false);\n}\n","import { h, h as createElement } from './h';\nimport { cloneElement } from './clone-element';\nimport { Component } from './component';\nimport { render } from './render';\nimport { rerender } from './render-queue';\nimport options from './options';\n\nfunction createRef() {\n\treturn {};\n}\n\nexport default {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nexport {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nif(typeof window !== 'undefined'){\n\twindow.Omis = {\n\t\th,\n\t\tcreateElement,\n\t\tcloneElement,\n\t\tcreateRef,\n\t\tComponent,\n\t\trender,\n\t\trerender,\n\t\toptions\n\t};\n}\n","\n\t\t\t\timport Omis from './omis';\n\t\t\t\tif (typeof module!='undefined') module.exports = Omis;\n\t\t\t\telse self.Omis = Omis;\n\t\t\t"],"names":["VNode","options","runTimeComponent","styleCache","staticStyleMapping","styleId","getCtorName","ctor","i","len","length","item","attrName","push","scoper","css","prefix","toLowerCase","replace","re","RegExp","g0","g1","g2","g3","match","appendClass","addStyle","cssText","id","ele","document","getElementById","head","getElementsByTagName","parentNode","removeChild","someThingStyles","createElement","appendChild","setAttribute","window","ActiveXObject","styleSheet","textContent","addStyleToHead","style","attr","stack","EMPTY_CHILDREN","h","nodeName","attributes","children","lastSimple","child","simple","arguments","pop","undefined","String","p","constructor","props","elementId","key","vnode","extend","obj","applyRef","ref","value","current","defer","Promise","resolve","then","bind","setTimeout","cloneElement","slice","call","NO_RENDER","SYNC_RENDER","FORCE_RENDER","ASYNC_RENDER","ATTR_KEY","IS_NON_DIMENSIONAL","items","enqueueRender","component","_dirty","debounceRendering","rerender","renderComponent","isSameNodeType","node","hydrating","splitText","_componentConstructor","isNamedNode","normalizedNodeName","getNodeProps","defaultProps","createNode","isSvg","createElementNS","removeNode","setAccessor","name","old","store","className","test","innerHTML","__html","useCapture","substring","addEventListener","eventProxy","removeEventListener","_listeners","e","removeAttribute","ns","removeAttributeNS","setAttributeNS","type","event","mounts","diffLevel","isSvgMode","flushMounts","c","shift","afterMount","installed","diff","dom","context","mountAll","parent","componentRoot","ownerSVGElement","ret","idiff","out","prevSvgMode","_component","nodeValue","createTextNode","replaceChild","recollectNodeTree","vnodeName","buildComponentFromVNode","firstChild","fc","vchildren","a","nextSibling","innerDiffNode","dangerouslySetInnerHTML","diffAttributes","isHydrating","originalChildren","childNodes","keyed","keyedLen","min","childrenLen","vlen","j","f","vchild","__key","trim","insertBefore","unmountOnly","unmountComponent","removeChildren","lastChild","next","previousSibling","attrs","recyclerComponents","createComponent","Ctor","inst","Component","render","doRender","update","nextBase","splice","setComponentProps","renderMode","_disable","__ref","base","install","receiveProps","__needUpdate_","prevContext","prevProps","syncComponentUpdates","isChild","previousProps","previousContext","isUpdate","initialBase","initialChildComponent","skip","snapshot","rendered","cbase","beforeUpdate","beforeRender","getChildContext","getSnapshotBeforeUpdate","childComponent","toUnmount","childProps","_parentComponent","baseParent","componentRef","t","updated","afterUpdate","_renderCallbacks","originalComponent","oldDom","isDirectOwner","isOwner","beforeUnmount","uninstall","inner","prototype","callback","merge","querySelector","createRef","Omis","module","exports","self"],"mappings":";;;;;;;;;;;CAAA;;;;;;;;AAQA,CAAO,IAAMA,QAAQ,SAASA,KAAT,GAAiB,EAA/B;;CCRP;;;;;CAKA;;;;;;;;;;;;;CAaA;CACA,IAAMC,UAAU;CACfC,oBAAkB,EADH;CAEfC,cAAY,EAFG;CAGfC,sBAAoB;CAHL,CAAhB;;CCjBA,IAAIC,UAAU,CAAd;;AAEA,CAAO,SAASC,WAAT,CAAqBC,IAArB,EAA2B;CAChC,OAAK,IAAIC,IAAI,CAAR,EAAWC,MAAMR,QAAQE,UAAR,CAAmBO,MAAzC,EAAiDF,IAAIC,GAArD,EAA0DD,GAA1D,EAA+D;CAC7D,QAAIG,OAAOV,QAAQE,UAAR,CAAmBK,CAAnB,CAAX;;CAEA,QAAIG,KAAKJ,IAAL,KAAcA,IAAlB,EAAwB;CACtB,aAAOI,KAAKC,QAAZ;CACD;CACF;;CAED,MAAIA,WAAW,QAAQP,OAAvB;CACAJ,UAAQE,UAAR,CAAmBU,IAAnB,CAAwB,EAAEN,UAAF,EAAQK,kBAAR,EAAxB;CACAP;;CAEA,SAAOO,QAAP;CACD;;CAED;AACA,CAAO,SAASE,MAAT,CAAgBC,GAAhB,EAAqBC,MAArB,EAA6B;CAClCA,WAAS,MAAMA,OAAOC,WAAP,EAAN,GAA6B,GAAtC;CACA;CACAF,QAAMA,IAAIG,OAAJ,CAAY,gCAAZ,EAA8C,EAA9C,CAAN;CACA;CACE,MAAIC,KAAK,IAAIC,MAAJ,CAAW,kDAAX,EAA+D,GAA/D,CAAT;CACF;;;;;;;;;CASAL,QAAMA,IAAIG,OAAJ,CAAYC,EAAZ,EAAgB,UAACE,EA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EAX0B;;;CAa3B;;;;;;;;;CASAyG,OAtB2B,oBAsBlB;CAtBkB,CAA5B;;;;;;;;;;;;;;;;;;;ACrBA,CAAO,SAASA,MAAT,CAAgB3H,KAAhB,EAAuB2E,MAAvB,EAA+BiG,KAA/B,EAAsC;CAC5C,SAAOrG,KAAKqG,KAAL,EAAY5K,KAAZ,EAAmB,EAAnB,EAAuB,KAAvB,EAA8B,OAAO2E,MAAP,KAAkB,QAAlB,GAA6B9G,SAASgN,aAAT,CAAuBlG,MAAvB,CAA7B,GAA8DA,MAA5F,EAAoG,KAApG,CAAP;CACA;;UCdQmG,SAAT,GAAqB;CACpB,QAAO,EAAP;CACA;;AAED,YAAe;CACd9L,KADc;CAEdZ,iBAFc;CAGdyC,2BAHc;CAIdiK,qBAJc;CAKdpD,qBALc;CAMdC,eANc;CAOdhG,mBAPc;CAQd5F;CARc,CAAf;;CAsBA,IAAG,OAAOwC,MAAP,KAAkB,WAArB,EAAiC;CAChCA,QAAOwM,IAAP,GAAc;CACb/L,MADa;CAEbZ,kBAFa;CAGbyC,4BAHa;CAIbiK,sBAJa;CAKbpD,sBALa;CAMbC,gBANa;CAObhG,oBAPa;CAQb5F;CARa,EAAd;CAUA;;KC1CO,OAAOiP,MAAP,IAAe,WAAnB,EAAgCA,OAAOC,OAAP,GAAiBF,IAAjB,CAAhC,KACKG,KAAKH,IAAL,GAAYA,IAAZ;;"} \ No newline at end of file diff --git a/packages/omis/dist/omis.esm.js b/packages/omis/dist/omis.esm.js index 8cbd954d5..4be703911 100644 --- a/packages/omis/dist/omis.esm.js +++ b/packages/omis/dist/omis.esm.js @@ -1,5 +1,5 @@ /** - * omis v0.5.0 http://omijs.org + * omis v0.6.0 http://omijs.org * Omi === Preact + Scoped CSS + Store System + Native Support in 3kb javascript. * By dntzhang https://github.com/dntzhang * Github: https://github.com/Tencent/omis @@ -821,8 +821,8 @@ function createComponent(Ctor, props, context) { } /** The `.render()` method for a PFC backing instance. */ -function doRender(props) { - return this.constructor(props, this.store); +function doRender(props, context) { + return this.constructor(props, this.store, context); } /** @@ -842,17 +842,15 @@ function setComponentProps(component, props, renderMode, context, mountAll) { delete props.ref; delete props.key; - if (typeof component.constructor.getDerivedStateFromProps === 'undefined') { - if (!component.base || mountAll) { - //if (component.componentWillMount) component.componentWillMount(); - if (component.store.install) component.store.install(); - } else { - // if (component.componentWillReceiveProps) { - // component.componentWillReceiveProps(props, context); - // } - if (component.store.receiveProps) { - component.__needUpdate_ = component.store.receiveProps(props, context); - } + if (!component.base || mountAll) { + //if (component.componentWillMount) component.componentWillMount(); + if (component.store.install) component.store.install(); + } else { + // if (component.componentWillReceiveProps) { + // component.componentWillReceiveProps(props, context); + // } + if (component.store.receiveProps) { + component.__needUpdate_ = component.store.receiveProps(props, context); } } @@ -890,10 +888,8 @@ function renderComponent(component, renderMode, mountAll, isChild) { if (component._disable) return; var props = component.props, - state = component.state, context = component.context, previousProps = component.prevProps || props, - previousState = component.prevState || state, previousContext = component.prevContext || context, isUpdate = component.base, nextBase = component.nextBase, @@ -905,21 +901,15 @@ function renderComponent(component, renderMode, mountAll, isChild) { inst, cbase; - if (component.constructor.getDerivedStateFromProps) { - state = extend(extend({}, state), component.constructor.getDerivedStateFromProps(props, state)); - component.state = state; - } - // if updating if (isUpdate) { component.props = previousProps; - component.state = previousState; component.context = previousContext; if (component.__needUpdate_ !== false) { skip = false; if (component.store.beforeUpdate) { - component.store.beforeUpdate(props, state, context); + component.store.beforeUpdate(props, context); } } else { skip = true; @@ -927,11 +917,10 @@ function renderComponent(component, renderMode, mountAll, isChild) { delete component.__needUpdate_; component.props = props; - component.state = state; component.context = context; } - component.prevProps = component.prevState = component.prevContext = component.nextBase = null; + component.prevProps = component.prevContext = component.nextBase = null; component._dirty = false; if (!skip) { @@ -939,7 +928,7 @@ function renderComponent(component, renderMode, mountAll, isChild) { if (component.store.beforeRender) { component.store.beforeRender(); } - rendered = component.render(props, state, context); + rendered = component.render(props, context); options.runTimeComponent = null; // context to pass to the child, can be updated via (grand-)parent component @@ -948,7 +937,7 @@ function renderComponent(component, renderMode, mountAll, isChild) { } if (isUpdate && component.getSnapshotBeforeUpdate) { - snapshot = component.getSnapshotBeforeUpdate(previousProps, previousState); + snapshot = component.getSnapshotBeforeUpdate(previousProps); } var childComponent = rendered && rendered.nodeName, @@ -1025,11 +1014,8 @@ function renderComponent(component, renderMode, mountAll, isChild) { // Note: disabled as it causes duplicate hooks, see https://github.com/developit/Omi/issues/750 // flushMounts(); - // if (component.componentDidUpdate) { - // component.componentDidUpdate(previousProps, previousState, snapshot); - // } if (component.store.updated) { - component.store.updated(previousProps, previousState, snapshot); + component.store.updated(previousProps, snapshot); } if (options.afterUpdate) options.afterUpdate(component); } @@ -1130,7 +1116,7 @@ function unmountComponent(component) { * * @example * class MyFoo extends Component { - * render(props, state) { + * render(props) { * return
; * } * } @@ -1153,12 +1139,6 @@ function Component(props, context) { */ this.props = props; - /** - * @public - * @type {object} - */ - this.state = this.state || {}; - this._renderCallbacks = []; } @@ -1177,11 +1157,10 @@ extend(Component.prototype, { /** - * Accepts `props` and `state`, and returns a new Virtual DOM tree to build. + * Accepts `props`, and returns a new Virtual DOM tree to build. * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx). * @param {object} props Props (eg: JSX attributes) received from parent * element/component - * @param {object} state The component's current state * @param {object} context Context object, as returned by the nearest * ancestor's `getChildContext()` * @returns {import('./vnode').VNode | void} diff --git a/packages/omis/dist/omis.esm.js.map b/packages/omis/dist/omis.esm.js.map index 1277c3eaf..d57813615 100644 --- a/packages/omis/dist/omis.esm.js.map +++ b/packages/omis/dist/omis.esm.js.map @@ -1 +1 @@ -{"version":3,"file":"omis.esm.js","sources":["../src/vnode.js","../src/options.js","../src/style.js","../src/h.js","../src/util.js","../src/clone-element.js","../src/constants.js","../src/render-queue.js","../src/vdom/index.js","../src/dom/index.js","../src/vdom/diff.js","../src/vdom/component-recycler.js","../src/vdom/component.js","../src/component.js","../src/render.js","../src/omis.js"],"sourcesContent":["/**\n * Virtual DOM Node\n * @typedef VNode\n * @property {string | function} nodeName The string of the DOM node to create or Component constructor to render\n * @property {Array} children The children of node\n * @property {string | number | undefined} key The key used to identify this VNode in a list\n * @property {object} attributes The properties of this VNode\n */\nexport const VNode = function VNode() {};\n","/**\n * @typedef {import('./component').Component} Component\n * @typedef {import('./vnode').VNode} VNode\n */\n\n/**\n * Global options\n * @public\n * @typedef Options\n * @property {boolean} [syncComponentUpdates] If `true`, `prop` changes trigger synchronous component updates. Defaults to true.\n * @property {(vnode: VNode) => void} [vnode] Processes all created VNodes.\n * @property {(component: Component) => void} [afterMount] Hook invoked after a component is mounted.\n * @property {(component: Component) => void} [afterUpdate] Hook invoked after the DOM is updated with a component's latest render.\n * @property {(component: Component) => void} [beforeUnmount] Hook invoked immediately before a component is unmounted.\n * @property {(rerender: function) => void} [debounceRendering] Hook invoked whenever a rerender is requested. Can be used to debounce rerenders.\n * @property {(event: Event) => Event | void} [event] Hook invoked before any Omi event listeners. The return value (if any) replaces the native browser event given to event listeners\n */\n\n/** @type {Options} */\nconst options = {\n\trunTimeComponent: {},\n\tstyleCache: [],\n\tstaticStyleMapping: {}\n};\n\nexport default options;\n","import options from './options'\n\nlet styleId = 0\n\nexport function getCtorName(ctor) {\n for (let i = 0, len = options.styleCache.length; i < len; i++) {\n let item = options.styleCache[i]\n\n if (item.ctor === ctor) {\n return item.attrName\n }\n }\n\n let attrName = '_ss' + styleId\n options.styleCache.push({ ctor, attrName })\n styleId++\n\n return attrName\n}\n\n// many thanks to https://github.com/thomaspark/scoper/\nexport function scoper(css, prefix) {\n prefix = '[' + prefix.toLowerCase() + ']'\n // https://www.w3.org/TR/css-syntax-3/#lexical\n css = css.replace(/\\/\\*[^*]*\\*+([^/][^*]*\\*+)*\\//g, '')\n // eslint-disable-next-line\n let re = new RegExp('([^\\r\\n,{}:]+)(:[^\\r\\n,{}]+)?(,(?=[^{}]*{)|\\s*{)', 'g')\n /**\n * Example:\n *\n * .classname::pesudo { color:red }\n *\n * g1 is normal selector `.classname`\n * g2 is pesudo class or pesudo element\n * g3 is the suffix\n */\n css = css.replace(re, (g0, g1, g2, g3) => {\n if (typeof g2 === 'undefined') {\n g2 = ''\n }\n\n /* eslint-ignore-next-line */\n if (\n g1.match(\n /^\\s*(@media|\\d+%?|@-webkit-keyframes|@keyframes|to|from|@font-face)/\n )\n ) {\n return g1 + g2 + g3\n }\n\n let appendClass = g1.replace(/(\\s*)$/, '') + prefix + g2\n //let prependClass = prefix + ' ' + g1.trim() + g2;\n\n return appendClass + g3\n //return appendClass + ',' + prependClass + g3;\n })\n\n return css\n}\n\nexport function addStyle(cssText, id) {\n id = id.toLowerCase()\n let ele = document.getElementById(id)\n let head = document.getElementsByTagName('head')[0]\n if (ele && ele.parentNode === head) {\n head.removeChild(ele)\n }\n\n let someThingStyles = document.createElement('style')\n head.appendChild(someThingStyles)\n someThingStyles.setAttribute('type', 'text/css')\n someThingStyles.setAttribute('id', id)\n if (window.ActiveXObject) {\n someThingStyles.styleSheet.cssText = cssText\n } else {\n someThingStyles.textContent = cssText\n }\n}\n\nexport function addStyleToHead(style, attr) {\n\n\tif (!options.staticStyleMapping[attr]) {\n\t\taddStyle(scoper(style, attr), attr)\n\t\toptions.staticStyleMapping[attr] = true\n\t}\n}\n","import { VNode } from './vnode';\nimport options from './options';\nimport {getCtorName} from './style'\n\nconst stack = [];\n\nconst EMPTY_CHILDREN = [];\n\n/**\n * JSX/hyperscript reviver.\n * @see http://jasonformat.com/wtf-is-jsx\n * Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0\n *\n * Note: this is exported as both `h()` and `createElement()` for compatibility\n * reasons.\n *\n * Creates a VNode (virtual DOM element). A tree of VNodes can be used as a\n * lightweight representation of the structure of a DOM tree. This structure can\n * be realized by recursively comparing it against the current _actual_ DOM\n * structure, and applying only the differences.\n *\n * `h()`/`createElement()` accepts an element name, a list of attributes/props,\n * and optionally children to append to the element.\n *\n * @example The following DOM tree\n *\n * `
Hello!
`\n *\n * can be constructed using this function as:\n *\n * `h('div', { id: 'foo', name : 'bar' }, 'Hello!');`\n *\n * @param {string | function} nodeName An element name. Ex: `div`, `a`, `span`, etc.\n * @param {object | null} attributes Any attributes/props to set on the created element.\n * @param {VNode[]} [rest] Additional arguments are taken to be children to\n * append. Can be infinitely nested Arrays.\n *\n * @public\n */\nexport function h(nodeName, attributes) {\n\tlet children=EMPTY_CHILDREN, lastSimple, child, simple, i;\n\tfor (i=arguments.length; i-- > 2; ) {\n\t\tstack.push(arguments[i]);\n\t}\n\tif (attributes && attributes.children!=null) {\n\t\tif (!stack.length) stack.push(attributes.children);\n\t\tdelete attributes.children;\n\t}\n\twhile (stack.length) {\n\t\tif ((child = stack.pop()) && child.pop!==undefined) {\n\t\t\tfor (i=child.length; i--; ) stack.push(child[i]);\n\t\t}\n\t\telse {\n\t\t\tif (typeof child==='boolean') child = null;\n\n\t\t\tif ((simple = typeof nodeName!=='function')) {\n\t\t\t\tif (child==null) child = '';\n\t\t\t\telse if (typeof child==='number') child = String(child);\n\t\t\t\telse if (typeof child!=='string') simple = false;\n\t\t\t}\n\n\t\t\tif (simple && lastSimple) {\n\t\t\t\tchildren[children.length-1] += child;\n\t\t\t}\n\t\t\telse if (children===EMPTY_CHILDREN) {\n\t\t\t\tchildren = [child];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tchildren.push(child);\n\t\t\t}\n\n\t\t\tlastSimple = simple;\n\t\t}\n\t}\n\n\tlet p = new VNode();\n\tp.nodeName = nodeName;\n\tp.children = children;\n\tp.attributes = attributes==null ? {} : attributes;\n\tif(options.runTimeComponent){\n\t\tif(options.runTimeComponent.constructor.css){\n\t\t\tp.attributes[getCtorName(options.runTimeComponent.constructor)] = ''\n\t\t}\n\t\tif(options.runTimeComponent.props && options.runTimeComponent.props.css){\n\t\t\tp.attributes['_ds'+options.runTimeComponent.elementId] = ''\n\t\t}\n\t}\n\n\tp.key = p.attributes.key;\n\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\n\tif (options.vnode!==undefined) options.vnode(p);\n\n\treturn p;\n}\n","/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function extend(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\n}\n\n/** Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} [ref=null]\n * @param {any} [value]\n */\nexport function applyRef(ref, value) {\n\tif (ref) {\n\t\tif (typeof ref=='function') ref(value);\n\t\telse ref.current = value;\n\t}\n}\n\n/**\n * Call a function asynchronously, as soon as possible. Makes\n * use of HTML Promise to schedule the callback if available,\n * otherwise falling back to `setTimeout` (mainly for IE<11).\n * @type {(callback: function) => void}\n */\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;\n","import { extend } from './util';\nimport { h } from './h';\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its\n * children.\n * @param {import('./vnode').VNode} vnode The virtual DOM element to clone\n * @param {object} props Attributes/props to add when cloning\n * @param {Array} [rest] Any additional arguments will be used as replacement\n * children.\n */\nexport function cloneElement(vnode, props) {\n\treturn h(\n\t\tvnode.nodeName,\n\t\textend(extend({}, vnode.attributes), props),\n\t\targuments.length>2 ? [].slice.call(arguments, 2) : vnode.children\n\t);\n}\n","// render modes\n\n/** Do not re-render a component */\nexport const NO_RENDER = 0;\n/** Synchronously re-render a component and its children */\nexport const SYNC_RENDER = 1;\n/** Synchronously re-render a component, even if its lifecycle methods attempt to prevent it. */\nexport const FORCE_RENDER = 2;\n/** Queue asynchronous re-render of a component and it's children */\nexport const ASYNC_RENDER = 3;\n\n\nexport const ATTR_KEY = 'prevProps';\n\n/** DOM properties that should NOT have \"px\" added when numeric */\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;\n\n","import options from './options';\nimport { defer } from './util';\nimport { renderComponent } from './vdom/component';\n\n/**\n * Managed queue of dirty components to be re-rendered\n * @type {Array}\n */\nlet items = [];\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./component').Component} component The component to rerender\n */\nexport function enqueueRender(component) {\n\tif (!component._dirty && (component._dirty = true) && items.push(component)==1) {\n\t\t(options.debounceRendering || defer)(rerender);\n\t}\n}\n\n/** Rerender all enqueued dirty components */\nexport function rerender() {\n\tlet p;\n\twhile ( (p = items.pop()) ) {\n\t\tif (p._dirty) renderComponent(p);\n\t}\n}\n","import { extend } from '../util';\n\n\n/**\n * Check if two nodes are equivalent.\n * @param {import('../dom').OmiElement} node DOM Node to compare\n * @param {import('../vnode').VNode} vnode Virtual DOM node to compare\n * @param {boolean} [hydrating=false] If true, ignores component constructors\n * when comparing.\n * @private\n */\nexport function isSameNodeType(node, vnode, hydrating) {\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\t\treturn node.splitText!==undefined;\n\t}\n\tif (typeof vnode.nodeName==='string') {\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName);\n\t}\n\treturn hydrating || node._componentConstructor===vnode.nodeName;\n}\n\n\n/**\n * Check if an Element has a given nodeName, case-insensitively.\n * @param {import('../dom').OmiElement} node A DOM Element to inspect the name of.\n * @param {string} nodeName Unnormalized name to compare against.\n */\nexport function isNamedNode(node, nodeName) {\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase();\n}\n\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n * @param {import('../vnode').VNode} vnode The VNode to get props for\n * @returns {object} The props to use for this VNode\n */\nexport function getNodeProps(vnode) {\n\tlet props = extend({}, vnode.attributes);\n\tprops.children = vnode.children;\n\n\tlet defaultProps = vnode.nodeName.defaultProps;\n\tif (defaultProps!==undefined) {\n\t\tfor (let i in defaultProps) {\n\t\t\tif (props[i]===undefined) {\n\t\t\t\tprops[i] = defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn props;\n}\n","import { IS_NON_DIMENSIONAL } from '../constants';\nimport { applyRef } from '../util';\nimport options from '../options';\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Omi adds to elements it creates\n * @typedef OmiElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Omi properties\n * @typedef {Element & ElementCSSInlineStyle & OmiElementExtensions} OmiElement\n */\n\n/**\n * Create an element with the given nodeName.\n * @param {string} nodeName The DOM node to create\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\n * namespace.\n * @returns {OmiElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n\t/** @type {OmiElement} */\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);\n\tnode.normalizedNodeName = nodeName;\n\treturn node;\n}\n\n\n/**\n * Remove a child node from its parent if attached.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\n\n/**\n * Set a named attribute on the given Node, with special behavior for some names\n * and event handlers. If `value` is `null`, the attribute/handler will be\n * removed.\n * @param {OmiElement} node An element to mutate\n * @param {string} name The name/key to set, such as an event or attribute name\n * @param {*} old The last value that was set for this name/node pair\n * @param {*} value An attribute value, such as a function to be used as an\n * event handler\n * @param {boolean} isSvg Are we currently diffing inside an svg?\n * @private\n */\nexport function setAccessor(node, name, old, value, isSvg, store) {\n\tif (name==='className') name = 'class';\n\n\n\tif (name==='key') {\n\t\t// ignore\n\t}\n\telse if (name==='ref') {\n\t\tapplyRef(old, null);\n\t\tapplyRef(value, node);\n\t}\n\telse if (name==='class' && !isSvg) {\n\t\tnode.className = value || '';\n\t}\n\telse if (name==='style') {\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\n\t\t\tnode.style.cssText = value || '';\n\t\t}\n\t\tif (value && typeof value==='object') {\n\t\t\tif (typeof old!=='string') {\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = '';\n\t\t\t}\n\t\t\tfor (let i in value) {\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i];\n\t\t\t}\n\t\t}\n\t}\n\telse if (name==='dangerouslySetInnerHTML') {\n\t\tif (value) node.innerHTML = value.__html || '';\n\t}\n\telse if (name[0]=='o' && name[1]=='n') {\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''));\n\t\tname = name.toLowerCase().substring(2);\n\t\tif (value) {\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\telse {\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\t(node._listeners || (node._listeners = {}))[name] = (value && store) ? value.bind(store) : value;\n\t}\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\n\t\t// Attempt to set a DOM property to the given value.\n\t\t// IE & FF throw for certain property-value combinations.\n\t\ttry {\n\t\t\tnode[name] = value==null ? '' : value;\n\t\t} catch (e) { }\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name);\n\t}\n\telse {\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')));\n\t\t// spellcheck is treated differently than all other boolean values and\n\t\t// should not be removed when the value is `false`. See:\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\n\t\tif (value==null || value===false) {\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());\n\t\t\telse node.removeAttribute(name);\n\t\t}\n\t\telse if (typeof value!=='function') {\n\t\t\tif (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);\n\t\t\telse node.setAttribute(name, value);\n\t\t}\n\t}\n}\n\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\treturn this._listeners[e.type](options.event && options.event(e) || e);\n}\n","import { ATTR_KEY } from '../constants';\nimport { isSameNodeType, isNamedNode } from './index';\nimport { buildComponentFromVNode } from './component';\nimport { createNode, setAccessor } from '../dom/index';\nimport { unmountComponent } from './component';\nimport options from '../options';\nimport { applyRef } from '../util';\nimport { removeNode } from '../dom/index';\nimport { addStyleToHead, getCtorName } from '../style'\n\n/**\n * Queue of components that have been mounted and are awaiting componentDidMount\n * @type {Array}\n */\nexport const mounts = [];\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0;\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false;\n\n/** Global flag indicating if the diff is performing hydration */\nlet hydrating = false;\n\n/** Invoke queued componentDidMount lifecycle methods */\nexport function flushMounts() {\n\tlet c;\n\twhile ((c = mounts.shift())) {\n\t\tif (c.constructor.css) {\n addStyleToHead(c.constructor.css, getCtorName(c.constructor))\n\t\t}\n\t\tif(c.props.css){\n\t\t\taddStyleToHead(c.props.css, '_ds'+c.elementId)\n\t\t}\n\t\tif (options.afterMount) options.afterMount(c);\n\t\t//if (c.componentDidMount) c.componentDidMount();\n\t\tif (c.store.installed) c.store.installed()\n\t}\n}\n\n\n/**\n * Apply differences in a given vnode (and it's deep children) to a real DOM Node.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing\n * the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {Element} parent ?\n * @param {boolean} componentRoot ?\n * @returns {import('../dom').OmiElement} The created/mutated element\n * @private\n */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot, store) {\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n\tif (!diffLevel++) {\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined;\n\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\n\t\thydrating = dom!=null && !(ATTR_KEY in dom);\n\t}\n\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot, store);\n\n\t// append the element if its a new parent\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret);\n\n\t// diffLevel being reduced to 0 means we're exiting the diff\n\tif (!--diffLevel) {\n\t\thydrating = false;\n\t\t// invoke queued componentDidMount lifecycle methods\n\t\tif (!componentRoot) flushMounts();\n\t}\n\n\treturn ret;\n}\n\n\n/**\n * Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} [componentRoot] ?\n * @private\n */\nfunction idiff(dom, vnode, context, mountAll, componentRoot, store) {\n\tlet out = dom,\n\t\tprevSvgMode = isSvgMode;\n\n\t// empty values (null, undefined, booleans) render as empty Text nodes\n\tif (vnode==null || typeof vnode==='boolean') vnode = '';\n\n\n\t// Fast case: Strings & Numbers create/update Text nodes.\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\n\t\t// update if it's already a Text node:\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/Omi/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\n\t\t\tif (dom.nodeValue!=vnode) {\n\t\t\t\tdom.nodeValue = vnode;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\n\t\t\tout = document.createTextNode(vnode);\n\t\t\tif (dom) {\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\t\t\t\trecollectNodeTree(dom, true);\n\t\t\t}\n\t\t}\n\n\t\tout[ATTR_KEY] = true;\n\n\t\treturn out;\n\t}\n\n\n\t// If the VNode represents a Component, perform a component diff:\n\tlet vnodeName = vnode.nodeName;\n\tif (typeof vnodeName==='function') {\n\t\treturn buildComponentFromVNode(dom, vnode, context, mountAll);\n\t}\n\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode;\n\n\n\t// If there's no existing element or it's the wrong type, create a new one:\n\tvnodeName = String(vnodeName);\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\n\t\tout = createNode(vnodeName, isSvgMode);\n\n\t\tif (dom) {\n\t\t\t// move children into the replacement node\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild);\n\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\n\t\t\t// recycle the old element (skips non-Element node types)\n\t\t\trecollectNodeTree(dom, true);\n\t\t}\n\t}\n\n\n\tlet fc = out.firstChild,\n\t\tprops = out[ATTR_KEY],\n\t\tvchildren = vnode.children;\n\n\tif (props==null) {\n\t\tprops = out[ATTR_KEY] = {};\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value;\n\t}\n\n\t// Optimization: fast-path for elements containing a single TextNode:\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\n\t\tif (fc.nodeValue!=vchildren[0]) {\n\t\t\tfc.nodeValue = vchildren[0];\n\t\t}\n\t}\n\t// otherwise, if there are existing or new children, diff them:\n\telse if (vchildren && vchildren.length || fc!=null) {\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null, store);\n\t}\n\n\n\t// Apply attributes/props from VNode to the DOM Element:\n\tdiffAttributes(out, vnode.attributes, props, store);\n\n\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\n\tisSvgMode = prevSvgMode;\n\n\treturn out;\n}\n\n\n/**\n * Apply child and attribute changes between a VNode and a DOM Node to the DOM.\n * @param {import('../dom').OmiElement} dom Element whose children should be compared & mutated\n * @param {Array} vchildren Array of VNodes to compare to `dom.childNodes`\n * @param {object} context Implicitly descendant context object (from most\n * recent `getChildContext()`)\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} isHydrating if `true`, consumes externally created elements\n * similar to hydration\n */\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating, store) {\n\tlet originalChildren = dom.childNodes,\n\t\tchildren = [],\n\t\tkeyed = {},\n\t\tkeyedLen = 0,\n\t\tmin = 0,\n\t\tlen = originalChildren.length,\n\t\tchildrenLen = 0,\n\t\tvlen = vchildren ? vchildren.length : 0,\n\t\tj, c, f, vchild, child;\n\n\t// Build up a map of keyed children and an Array of unkeyed children:\n\tif (len!==0) {\n\t\tfor (let i=0; i;\n * }\n * }\n */\n\n let id = 0\n\nexport function Component(props, context) {\n\tthis._dirty = true;\n\tthis.elementId = id++\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.context = context;\n\tthis.store = {}\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.props = props;\n\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.state = this.state || {};\n\n\tthis._renderCallbacks = [];\n}\n\n\nextend(Component.prototype, {\n\n\t/**\n\t * Immediately perform a synchronous re-render of the component.\n\t * @param {() => void} callback A function to be called after component is\n\t * \tre-rendered.\n\t * @private\n\t */\n\tupdate(callback) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\trenderComponent(this, FORCE_RENDER);\n\t},\n\n\t/**\n\t * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n\t * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n\t * @param {object} props Props (eg: JSX attributes) received from parent\n\t * \telement/component\n\t * @param {object} state The component's current state\n\t * @param {object} context Context object, as returned by the nearest\n\t * ancestor's `getChildContext()`\n\t * @returns {import('./vnode').VNode | void}\n\t */\n\trender() {}\n\n});\n","import { diff } from './vdom/diff';\n\n/**\n * Render JSX into a `parent` Element.\n * @param {import('./vnode').VNode} vnode A (JSX) VNode to render\n * @param {import('./dom').OmiElement} parent DOM element to render into\n * @param {import('./dom').OmiElement} [merge] Attempt to re-use an existing DOM tree rooted at\n * `merge`\n * @public\n *\n * @example\n * // render a div into :\n * render(
hello!
, document.body);\n *\n * @example\n * // render a \"Thing\" component into #foo:\n * const Thing = ({ name }) => { name };\n * render(, document.querySelector('#foo'));\n */\nexport function render(vnode, parent, merge) {\n\treturn diff(merge, vnode, {}, false, typeof parent === 'string' ? document.querySelector(parent) : parent, false);\n}\n","import { h, h as createElement } from './h';\nimport { cloneElement } from './clone-element';\nimport { Component } from './component';\nimport { render } from './render';\nimport { rerender } from './render-queue';\nimport options from './options';\n\nfunction createRef() {\n\treturn {};\n}\n\nexport default {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nexport {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nif(typeof window !== 'undefined'){\n\twindow.Omis = {\n\t\th,\n\t\tcreateElement,\n\t\tcloneElement,\n\t\tcreateRef,\n\t\tComponent,\n\t\trender,\n\t\trerender,\n\t\toptions\n\t};\n}\n"],"names":["VNode","options","styleId","getCtorName","ctor","i","len","styleCache","length","item","attrName","push","scoper","css","prefix","toLowerCase","replace","re","RegExp","g0","g1","g2","g3","match","appendClass","addStyle","cssText","id","ele","document","getElementById","head","getElementsByTagName","parentNode","removeChild","someThingStyles","createElement","appendChild","setAttribute","window","ActiveXObject","styleSheet","textContent","addStyleToHead","style","attr","staticStyleMapping","stack","EMPTY_CHILDREN","h","nodeName","attributes","children","lastSimple","child","simple","arguments","pop","undefined","String","p","runTimeComponent","constructor","props","elementId","key","vnode","extend","obj","applyRef","ref","value","current","defer","Promise","resolve","then","bind","setTimeout","cloneElement","slice","call","NO_RENDER","SYNC_RENDER","FORCE_RENDER","ASYNC_RENDER","ATTR_KEY","IS_NON_DIMENSIONAL","items","enqueueRender","component","_dirty","debounceRendering","rerender","renderComponent","isSameNodeType","node","hydrating","splitText","_componentConstructor","isNamedNode","normalizedNodeName","getNodeProps","defaultProps","createNode","isSvg","createElementNS","removeNode","setAccessor","name","old","store","className","test","innerHTML","__html","useCapture","substring","addEventListener","eventProxy","removeEventListener","_listeners","e","removeAttribute","ns","removeAttributeNS","setAttributeNS","type","event","mounts","diffLevel","isSvgMode","flushMounts","c","shift","afterMount","installed","diff","dom","context","mountAll","parent","componentRoot","ownerSVGElement","ret","idiff","out","prevSvgMode","_component","nodeValue","createTextNode","replaceChild","vnodeName","buildComponentFromVNode","firstChild","fc","vchildren","a","nextSibling","dangerouslySetInnerHTML","innerDiffNode","isHydrating","originalChildren","childNodes","keyed","keyedLen","min","childrenLen","vlen","j","f","vchild","__key","trim","insertBefore","recollectNodeTree","unmountOnly","removeChildren","lastChild","next","previousSibling","diffAttributes","attrs","recyclerComponents","createComponent","Ctor","inst","Component","render","doRender","update","nextBase","splice","setComponentProps","renderMode","_disable","__ref","getDerivedStateFromProps","base","install","receiveProps","__needUpdate_","prevContext","prevProps","syncComponentUpdates","isChild","state","previousProps","previousState","prevState","previousContext","isUpdate","initialBase","initialChildComponent","skip","snapshot","rendered","cbase","beforeUpdate","beforeRender","getChildContext","getSnapshotBeforeUpdate","childComponent","toUnmount","childProps","_parentComponent","baseParent","componentRef","t","updated","afterUpdate","_renderCallbacks","originalComponent","oldDom","isDirectOwner","isOwner","unmountComponent","beforeUnmount","uninstall","inner","prototype","callback","merge","querySelector","createRef","Omis"],"mappings":";;;;;;;;AAAA;;;;;;;;AAQA,IAAaA,QAAQ,SAASA,KAAT,GAAiB,EAA/B;;ACRP;;;;;;;;;;;;;;;;;;;AAmBA,IAAMC,UAAU;oBACG,EADH;cAEH,EAFG;sBAGK;CAHrB;;ACjBA,IAAIC,UAAU,CAAd;;AAEA,SAAgBC,WAAT,CAAqBC,IAArB,EAA2B;OAC3B,IAAIC,IAAI,CAAR,EAAWC,MAAML,QAAQM,UAAR,CAAmBC,MAAzC,EAAiDH,IAAIC,GAArD,EAA0DD,GAA1D,EAA+D;QACzDI,OAAOR,QAAQM,UAAR,CAAmBF,CAAnB,CAAX;;QAEII,KAAKL,IAAL,KAAcA,IAAlB,EAAwB;aACfK,KAAKC,QAAZ;;;;MAIAA,WAAW,QAAQR,OAAvB;UACQK,UAAR,CAAmBI,IAAnB,CAAwB,EAAEP,UAAF,EAAQM,kBAAR,EAAxB;;;SAGOA,QAAP;;;;AAIF,SAAgBE,MAAT,CAAgBC,GAAhB,EAAqBC,MAArB,EAA6B;WACzB,MAAMA,OAAOC,WAAP,EAAN,GAA6B,GAAtC;;QAEMF,IAAIG,OAAJ,CAAY,gCAAZ,EAA8C,EAA9C,CAAN;;MAEMC,KAAK,IAAIC,MAAJ,CAAW,kDAAX,EAA+D,GAA/D,CAAT;;;;;;;;;;QAUIL,IAAIG,OAAJ,CAAYC,EAAZ,EAAgB,UAACE,EAAD,EAAKC,EAAL,EAASC,EAAT,EAAaC,EAAb,EAAoB;QACpC,OAAOD,EAAP,KAAc,WAAlB,EAA+B;WACxB,EAAL;;;;QAKAD,GAAGG,KAAH,CACE,qEADF,CADF,EAIE;aACOH,KAAKC,EAAL,GAAUC,EAAjB;;;QAGEE,cAAcJ,GAAGJ,OAAH,CAAW,QAAX,EAAqB,EAArB,IAA2BF,MAA3B,GAAoCO,EAAtD;;;WAGOG,cAAcF,EAArB;;GAjB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,gBAAL,CAAsB5N,IAAtB,CAA2BsO,QAA3B;kBACE,IAAhB,EAAsB7J,YAAtB;EAV0B;;;;;;;;;;;;;OAAA,oBAuBlB;CAvBV;;;;;;;;;;;;;;;;;;;AC3BA,SAAgBwG,MAAT,CAAgB1H,KAAhB,EAAuB2E,MAAvB,EAA+BqG,KAA/B,EAAsC;SACrCzG,KAAKyG,KAAL,EAAYhL,KAAZ,EAAmB,EAAnB,EAAuB,KAAvB,EAA8B,OAAO2E,MAAP,KAAkB,QAAlB,GAA6BhH,SAASsN,aAAT,CAAuBtG,MAAvB,CAA7B,GAA8DA,MAA5F,EAAoG,KAApG,CAAP;;;SCbQuG,SAAT,GAAqB;QACb,EAAP;;;AAGD,WAAe;KAAA;iBAAA;2BAAA;qBAAA;qBAAA;eAAA;mBAAA;;CAAf;;AAsBA,IAAG,OAAO7M,MAAP,KAAkB,WAArB,EAAiC;QACzB8M,IAAP,GAAc;MAAA;kBAAA;4BAAA;sBAAA;sBAAA;gBAAA;oBAAA;;EAAd;;;;"} \ No newline at end of file +{"version":3,"file":"omis.esm.js","sources":["../src/vnode.js","../src/options.js","../src/style.js","../src/h.js","../src/util.js","../src/clone-element.js","../src/constants.js","../src/render-queue.js","../src/vdom/index.js","../src/dom/index.js","../src/vdom/diff.js","../src/vdom/component-recycler.js","../src/vdom/component.js","../src/component.js","../src/render.js","../src/omis.js"],"sourcesContent":["/**\n * Virtual DOM Node\n * @typedef VNode\n * @property {string | function} nodeName The string of the DOM node to create or Component constructor to render\n * @property {Array} children The children of node\n * @property {string | number | undefined} key The key used to identify this VNode in a list\n * @property {object} attributes The properties of this VNode\n */\nexport const VNode = function VNode() {};\n","/**\n * @typedef {import('./component').Component} Component\n * @typedef {import('./vnode').VNode} VNode\n */\n\n/**\n * Global options\n * @public\n * @typedef Options\n * @property {boolean} [syncComponentUpdates] If `true`, `prop` changes trigger synchronous component updates. Defaults to true.\n * @property {(vnode: VNode) => void} [vnode] Processes all created VNodes.\n * @property {(component: Component) => void} [afterMount] Hook invoked after a component is mounted.\n * @property {(component: Component) => void} [afterUpdate] Hook invoked after the DOM is updated with a component's latest render.\n * @property {(component: Component) => void} [beforeUnmount] Hook invoked immediately before a component is unmounted.\n * @property {(rerender: function) => void} [debounceRendering] Hook invoked whenever a rerender is requested. Can be used to debounce rerenders.\n * @property {(event: Event) => Event | void} [event] Hook invoked before any Omi event listeners. The return value (if any) replaces the native browser event given to event listeners\n */\n\n/** @type {Options} */\nconst options = {\n\trunTimeComponent: {},\n\tstyleCache: [],\n\tstaticStyleMapping: {}\n};\n\nexport default options;\n","import options from './options'\n\nlet styleId = 0\n\nexport function getCtorName(ctor) {\n for (let i = 0, len = options.styleCache.length; i < len; i++) {\n let item = options.styleCache[i]\n\n if (item.ctor === ctor) {\n return item.attrName\n }\n }\n\n let attrName = '_ss' + styleId\n options.styleCache.push({ ctor, attrName })\n styleId++\n\n return attrName\n}\n\n// many thanks to https://github.com/thomaspark/scoper/\nexport function scoper(css, prefix) {\n prefix = '[' + prefix.toLowerCase() + ']'\n // https://www.w3.org/TR/css-syntax-3/#lexical\n css = css.replace(/\\/\\*[^*]*\\*+([^/][^*]*\\*+)*\\//g, '')\n // eslint-disable-next-line\n let re = new RegExp('([^\\r\\n,{}:]+)(:[^\\r\\n,{}]+)?(,(?=[^{}]*{)|\\s*{)', 'g')\n /**\n * Example:\n *\n * .classname::pesudo { color:red }\n *\n * g1 is normal selector `.classname`\n * g2 is pesudo class or pesudo element\n * g3 is the suffix\n */\n css = css.replace(re, (g0, g1, g2, g3) => {\n if (typeof g2 === 'undefined') {\n g2 = ''\n }\n\n /* eslint-ignore-next-line */\n if (\n g1.match(\n /^\\s*(@media|\\d+%?|@-webkit-keyframes|@keyframes|to|from|@font-face)/\n )\n ) {\n return g1 + g2 + g3\n }\n\n let appendClass = g1.replace(/(\\s*)$/, '') + prefix + g2\n //let prependClass = prefix + ' ' + g1.trim() + g2;\n\n return appendClass + g3\n //return appendClass + ',' + prependClass + g3;\n })\n\n return css\n}\n\nexport function addStyle(cssText, id) {\n id = id.toLowerCase()\n let ele = document.getElementById(id)\n let head = document.getElementsByTagName('head')[0]\n if (ele && ele.parentNode === head) {\n head.removeChild(ele)\n }\n\n let someThingStyles = document.createElement('style')\n head.appendChild(someThingStyles)\n someThingStyles.setAttribute('type', 'text/css')\n someThingStyles.setAttribute('id', id)\n if (window.ActiveXObject) {\n someThingStyles.styleSheet.cssText = cssText\n } else {\n someThingStyles.textContent = cssText\n }\n}\n\nexport function addStyleToHead(style, attr) {\n\n\tif (!options.staticStyleMapping[attr]) {\n\t\taddStyle(scoper(style, attr), attr)\n\t\toptions.staticStyleMapping[attr] = true\n\t}\n}\n","import { VNode } from './vnode';\nimport options from './options';\nimport {getCtorName} from './style'\n\nconst stack = [];\n\nconst EMPTY_CHILDREN = [];\n\n/**\n * JSX/hyperscript reviver.\n * @see http://jasonformat.com/wtf-is-jsx\n * Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0\n *\n * Note: this is exported as both `h()` and `createElement()` for compatibility\n * reasons.\n *\n * Creates a VNode (virtual DOM element). A tree of VNodes can be used as a\n * lightweight representation of the structure of a DOM tree. This structure can\n * be realized by recursively comparing it against the current _actual_ DOM\n * structure, and applying only the differences.\n *\n * `h()`/`createElement()` accepts an element name, a list of attributes/props,\n * and optionally children to append to the element.\n *\n * @example The following DOM tree\n *\n * `
Hello!
`\n *\n * can be constructed using this function as:\n *\n * `h('div', { id: 'foo', name : 'bar' }, 'Hello!');`\n *\n * @param {string | function} nodeName An element name. Ex: `div`, `a`, `span`, etc.\n * @param {object | null} attributes Any attributes/props to set on the created element.\n * @param {VNode[]} [rest] Additional arguments are taken to be children to\n * append. Can be infinitely nested Arrays.\n *\n * @public\n */\nexport function h(nodeName, attributes) {\n\tlet children=EMPTY_CHILDREN, lastSimple, child, simple, i;\n\tfor (i=arguments.length; i-- > 2; ) {\n\t\tstack.push(arguments[i]);\n\t}\n\tif (attributes && attributes.children!=null) {\n\t\tif (!stack.length) stack.push(attributes.children);\n\t\tdelete attributes.children;\n\t}\n\twhile (stack.length) {\n\t\tif ((child = stack.pop()) && child.pop!==undefined) {\n\t\t\tfor (i=child.length; i--; ) stack.push(child[i]);\n\t\t}\n\t\telse {\n\t\t\tif (typeof child==='boolean') child = null;\n\n\t\t\tif ((simple = typeof nodeName!=='function')) {\n\t\t\t\tif (child==null) child = '';\n\t\t\t\telse if (typeof child==='number') child = String(child);\n\t\t\t\telse if (typeof child!=='string') simple = false;\n\t\t\t}\n\n\t\t\tif (simple && lastSimple) {\n\t\t\t\tchildren[children.length-1] += child;\n\t\t\t}\n\t\t\telse if (children===EMPTY_CHILDREN) {\n\t\t\t\tchildren = [child];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tchildren.push(child);\n\t\t\t}\n\n\t\t\tlastSimple = simple;\n\t\t}\n\t}\n\n\tlet p = new VNode();\n\tp.nodeName = nodeName;\n\tp.children = children;\n\tp.attributes = attributes==null ? {} : attributes;\n\tif(options.runTimeComponent){\n\t\tif(options.runTimeComponent.constructor.css){\n\t\t\tp.attributes[getCtorName(options.runTimeComponent.constructor)] = ''\n\t\t}\n\t\tif(options.runTimeComponent.props && options.runTimeComponent.props.css){\n\t\t\tp.attributes['_ds'+options.runTimeComponent.elementId] = ''\n\t\t}\n\t}\n\n\tp.key = p.attributes.key;\n\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\n\tif (options.vnode!==undefined) options.vnode(p);\n\n\treturn p;\n}\n","/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function extend(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\n}\n\n/** Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} [ref=null]\n * @param {any} [value]\n */\nexport function applyRef(ref, value) {\n\tif (ref) {\n\t\tif (typeof ref=='function') ref(value);\n\t\telse ref.current = value;\n\t}\n}\n\n/**\n * Call a function asynchronously, as soon as possible. Makes\n * use of HTML Promise to schedule the callback if available,\n * otherwise falling back to `setTimeout` (mainly for IE<11).\n * @type {(callback: function) => void}\n */\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;\n","import { extend } from './util';\nimport { h } from './h';\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its\n * children.\n * @param {import('./vnode').VNode} vnode The virtual DOM element to clone\n * @param {object} props Attributes/props to add when cloning\n * @param {Array} [rest] Any additional arguments will be used as replacement\n * children.\n */\nexport function cloneElement(vnode, props) {\n\treturn h(\n\t\tvnode.nodeName,\n\t\textend(extend({}, vnode.attributes), props),\n\t\targuments.length>2 ? [].slice.call(arguments, 2) : vnode.children\n\t);\n}\n","// render modes\n\n/** Do not re-render a component */\nexport const NO_RENDER = 0;\n/** Synchronously re-render a component and its children */\nexport const SYNC_RENDER = 1;\n/** Synchronously re-render a component, even if its lifecycle methods attempt to prevent it. */\nexport const FORCE_RENDER = 2;\n/** Queue asynchronous re-render of a component and it's children */\nexport const ASYNC_RENDER = 3;\n\n\nexport const ATTR_KEY = 'prevProps';\n\n/** DOM properties that should NOT have \"px\" added when numeric */\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;\n\n","import options from './options';\nimport { defer } from './util';\nimport { renderComponent } from './vdom/component';\n\n/**\n * Managed queue of dirty components to be re-rendered\n * @type {Array}\n */\nlet items = [];\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./component').Component} component The component to rerender\n */\nexport function enqueueRender(component) {\n\tif (!component._dirty && (component._dirty = true) && items.push(component)==1) {\n\t\t(options.debounceRendering || defer)(rerender);\n\t}\n}\n\n/** Rerender all enqueued dirty components */\nexport function rerender() {\n\tlet p;\n\twhile ( (p = items.pop()) ) {\n\t\tif (p._dirty) renderComponent(p);\n\t}\n}\n","import { extend } from '../util';\n\n\n/**\n * Check if two nodes are equivalent.\n * @param {import('../dom').OmiElement} node DOM Node to compare\n * @param {import('../vnode').VNode} vnode Virtual DOM node to compare\n * @param {boolean} [hydrating=false] If true, ignores component constructors\n * when comparing.\n * @private\n */\nexport function isSameNodeType(node, vnode, hydrating) {\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\t\treturn node.splitText!==undefined;\n\t}\n\tif (typeof vnode.nodeName==='string') {\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName);\n\t}\n\treturn hydrating || node._componentConstructor===vnode.nodeName;\n}\n\n\n/**\n * Check if an Element has a given nodeName, case-insensitively.\n * @param {import('../dom').OmiElement} node A DOM Element to inspect the name of.\n * @param {string} nodeName Unnormalized name to compare against.\n */\nexport function isNamedNode(node, nodeName) {\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase();\n}\n\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n * @param {import('../vnode').VNode} vnode The VNode to get props for\n * @returns {object} The props to use for this VNode\n */\nexport function getNodeProps(vnode) {\n\tlet props = extend({}, vnode.attributes);\n\tprops.children = vnode.children;\n\n\tlet defaultProps = vnode.nodeName.defaultProps;\n\tif (defaultProps!==undefined) {\n\t\tfor (let i in defaultProps) {\n\t\t\tif (props[i]===undefined) {\n\t\t\t\tprops[i] = defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn props;\n}\n","import { IS_NON_DIMENSIONAL } from '../constants';\nimport { applyRef } from '../util';\nimport options from '../options';\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Omi adds to elements it creates\n * @typedef OmiElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Omi properties\n * @typedef {Element & ElementCSSInlineStyle & OmiElementExtensions} OmiElement\n */\n\n/**\n * Create an element with the given nodeName.\n * @param {string} nodeName The DOM node to create\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\n * namespace.\n * @returns {OmiElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n\t/** @type {OmiElement} */\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);\n\tnode.normalizedNodeName = nodeName;\n\treturn node;\n}\n\n\n/**\n * Remove a child node from its parent if attached.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\n\n/**\n * Set a named attribute on the given Node, with special behavior for some names\n * and event handlers. If `value` is `null`, the attribute/handler will be\n * removed.\n * @param {OmiElement} node An element to mutate\n * @param {string} name The name/key to set, such as an event or attribute name\n * @param {*} old The last value that was set for this name/node pair\n * @param {*} value An attribute value, such as a function to be used as an\n * event handler\n * @param {boolean} isSvg Are we currently diffing inside an svg?\n * @private\n */\nexport function setAccessor(node, name, old, value, isSvg, store) {\n\tif (name==='className') name = 'class';\n\n\n\tif (name==='key') {\n\t\t// ignore\n\t}\n\telse if (name==='ref') {\n\t\tapplyRef(old, null);\n\t\tapplyRef(value, node);\n\t}\n\telse if (name==='class' && !isSvg) {\n\t\tnode.className = value || '';\n\t}\n\telse if (name==='style') {\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\n\t\t\tnode.style.cssText = value || '';\n\t\t}\n\t\tif (value && typeof value==='object') {\n\t\t\tif (typeof old!=='string') {\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = '';\n\t\t\t}\n\t\t\tfor (let i in value) {\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i];\n\t\t\t}\n\t\t}\n\t}\n\telse if (name==='dangerouslySetInnerHTML') {\n\t\tif (value) node.innerHTML = value.__html || '';\n\t}\n\telse if (name[0]=='o' && name[1]=='n') {\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''));\n\t\tname = name.toLowerCase().substring(2);\n\t\tif (value) {\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\telse {\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\t(node._listeners || (node._listeners = {}))[name] = (value && store) ? value.bind(store) : value;\n\t}\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\n\t\t// Attempt to set a DOM property to the given value.\n\t\t// IE & FF throw for certain property-value combinations.\n\t\ttry {\n\t\t\tnode[name] = value==null ? '' : value;\n\t\t} catch (e) { }\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name);\n\t}\n\telse {\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')));\n\t\t// spellcheck is treated differently than all other boolean values and\n\t\t// should not be removed when the value is `false`. See:\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\n\t\tif (value==null || value===false) {\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());\n\t\t\telse node.removeAttribute(name);\n\t\t}\n\t\telse if (typeof value!=='function') {\n\t\t\tif (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);\n\t\t\telse node.setAttribute(name, value);\n\t\t}\n\t}\n}\n\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\treturn this._listeners[e.type](options.event && options.event(e) || e);\n}\n","import { ATTR_KEY } from '../constants';\nimport { isSameNodeType, isNamedNode } from './index';\nimport { buildComponentFromVNode } from './component';\nimport { createNode, setAccessor } from '../dom/index';\nimport { unmountComponent } from './component';\nimport options from '../options';\nimport { applyRef } from '../util';\nimport { removeNode } from '../dom/index';\nimport { addStyleToHead, getCtorName } from '../style'\n\n/**\n * Queue of components that have been mounted and are awaiting componentDidMount\n * @type {Array}\n */\nexport const mounts = [];\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0;\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false;\n\n/** Global flag indicating if the diff is performing hydration */\nlet hydrating = false;\n\n/** Invoke queued componentDidMount lifecycle methods */\nexport function flushMounts() {\n\tlet c;\n\twhile ((c = mounts.shift())) {\n\t\tif (c.constructor.css) {\n addStyleToHead(c.constructor.css, getCtorName(c.constructor))\n\t\t}\n\t\tif(c.props.css){\n\t\t\taddStyleToHead(c.props.css, '_ds'+c.elementId)\n\t\t}\n\t\tif (options.afterMount) options.afterMount(c);\n\t\t//if (c.componentDidMount) c.componentDidMount();\n\t\tif (c.store.installed) c.store.installed()\n\t}\n}\n\n\n/**\n * Apply differences in a given vnode (and it's deep children) to a real DOM Node.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing\n * the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {Element} parent ?\n * @param {boolean} componentRoot ?\n * @returns {import('../dom').OmiElement} The created/mutated element\n * @private\n */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot, store) {\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n\tif (!diffLevel++) {\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined;\n\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\n\t\thydrating = dom!=null && !(ATTR_KEY in dom);\n\t}\n\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot, store);\n\n\t// append the element if its a new parent\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret);\n\n\t// diffLevel being reduced to 0 means we're exiting the diff\n\tif (!--diffLevel) {\n\t\thydrating = false;\n\t\t// invoke queued componentDidMount lifecycle methods\n\t\tif (!componentRoot) flushMounts();\n\t}\n\n\treturn ret;\n}\n\n\n/**\n * Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} [componentRoot] ?\n * @private\n */\nfunction idiff(dom, vnode, context, mountAll, componentRoot, store) {\n\tlet out = dom,\n\t\tprevSvgMode = isSvgMode;\n\n\t// empty values (null, undefined, booleans) render as empty Text nodes\n\tif (vnode==null || typeof vnode==='boolean') vnode = '';\n\n\n\t// Fast case: Strings & Numbers create/update Text nodes.\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\n\t\t// update if it's already a Text node:\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/Omi/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\n\t\t\tif (dom.nodeValue!=vnode) {\n\t\t\t\tdom.nodeValue = vnode;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\n\t\t\tout = document.createTextNode(vnode);\n\t\t\tif (dom) {\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\t\t\t\trecollectNodeTree(dom, true);\n\t\t\t}\n\t\t}\n\n\t\tout[ATTR_KEY] = true;\n\n\t\treturn out;\n\t}\n\n\n\t// If the VNode represents a Component, perform a component diff:\n\tlet vnodeName = vnode.nodeName;\n\tif (typeof vnodeName==='function') {\n\t\treturn buildComponentFromVNode(dom, vnode, context, mountAll);\n\t}\n\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode;\n\n\n\t// If there's no existing element or it's the wrong type, create a new one:\n\tvnodeName = String(vnodeName);\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\n\t\tout = createNode(vnodeName, isSvgMode);\n\n\t\tif (dom) {\n\t\t\t// move children into the replacement node\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild);\n\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\n\t\t\t// recycle the old element (skips non-Element node types)\n\t\t\trecollectNodeTree(dom, true);\n\t\t}\n\t}\n\n\n\tlet fc = out.firstChild,\n\t\tprops = out[ATTR_KEY],\n\t\tvchildren = vnode.children;\n\n\tif (props==null) {\n\t\tprops = out[ATTR_KEY] = {};\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value;\n\t}\n\n\t// Optimization: fast-path for elements containing a single TextNode:\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\n\t\tif (fc.nodeValue!=vchildren[0]) {\n\t\t\tfc.nodeValue = vchildren[0];\n\t\t}\n\t}\n\t// otherwise, if there are existing or new children, diff them:\n\telse if (vchildren && vchildren.length || fc!=null) {\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null, store);\n\t}\n\n\n\t// Apply attributes/props from VNode to the DOM Element:\n\tdiffAttributes(out, vnode.attributes, props, store);\n\n\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\n\tisSvgMode = prevSvgMode;\n\n\treturn out;\n}\n\n\n/**\n * Apply child and attribute changes between a VNode and a DOM Node to the DOM.\n * @param {import('../dom').OmiElement} dom Element whose children should be compared & mutated\n * @param {Array} vchildren Array of VNodes to compare to `dom.childNodes`\n * @param {object} context Implicitly descendant context object (from most\n * recent `getChildContext()`)\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} isHydrating if `true`, consumes externally created elements\n * similar to hydration\n */\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating, store) {\n\tlet originalChildren = dom.childNodes,\n\t\tchildren = [],\n\t\tkeyed = {},\n\t\tkeyedLen = 0,\n\t\tmin = 0,\n\t\tlen = originalChildren.length,\n\t\tchildrenLen = 0,\n\t\tvlen = vchildren ? vchildren.length : 0,\n\t\tj, c, f, vchild, child;\n\n\t// Build up a map of keyed children and an Array of unkeyed children:\n\tif (len!==0) {\n\t\tfor (let i=0; i;\n * }\n * }\n */\n\n let id = 0\n\nexport function Component(props, context) {\n\tthis._dirty = true;\n\tthis.elementId = id++\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.context = context;\n\tthis.store = {}\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.props = props;\n\n\tthis._renderCallbacks = [];\n}\n\n\nextend(Component.prototype, {\n\n\t/**\n\t * Immediately perform a synchronous re-render of the component.\n\t * @param {() => void} callback A function to be called after component is\n\t * \tre-rendered.\n\t * @private\n\t */\n\tupdate(callback) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\trenderComponent(this, FORCE_RENDER);\n\t},\n\n\t/**\n\t * Accepts `props`, and returns a new Virtual DOM tree to build.\n\t * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n\t * @param {object} props Props (eg: JSX attributes) received from parent\n\t * \telement/component\n\t * @param {object} context Context object, as returned by the nearest\n\t * ancestor's `getChildContext()`\n\t * @returns {import('./vnode').VNode | void}\n\t */\n\trender() {}\n\n});\n","import { diff } from './vdom/diff';\n\n/**\n * Render JSX into a `parent` Element.\n * @param {import('./vnode').VNode} vnode A (JSX) VNode to render\n * @param {import('./dom').OmiElement} parent DOM element to render into\n * @param {import('./dom').OmiElement} [merge] Attempt to re-use an existing DOM tree rooted at\n * `merge`\n * @public\n *\n * @example\n * // render a div into :\n * render(
hello!
, document.body);\n *\n * @example\n * // render a \"Thing\" component into #foo:\n * const Thing = ({ name }) => { name };\n * render(, document.querySelector('#foo'));\n */\nexport function render(vnode, parent, merge) {\n\treturn diff(merge, vnode, {}, false, typeof parent === 'string' ? document.querySelector(parent) : parent, false);\n}\n","import { h, h as createElement } from './h';\nimport { cloneElement } from './clone-element';\nimport { Component } from './component';\nimport { render } from './render';\nimport { rerender } from './render-queue';\nimport options from './options';\n\nfunction createRef() {\n\treturn {};\n}\n\nexport default {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nexport {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nif(typeof window !== 'undefined'){\n\twindow.Omis = {\n\t\th,\n\t\tcreateElement,\n\t\tcloneElement,\n\t\tcreateRef,\n\t\tComponent,\n\t\trender,\n\t\trerender,\n\t\toptions\n\t};\n}\n"],"names":["VNode","options","styleId","getCtorName","ctor","i","len","styleCache","length","item","attrName","push","scoper","css","prefix","toLowerCase","replace","re","RegExp","g0","g1","g2","g3","match","appendClass","addStyle","cssText","id","ele","document","getElementById","head","getElementsByTagName","parentNode","removeChild","someThingStyles","createElement","appendChild","setAttribute","window","ActiveXObject","styleSheet","textContent","addStyleToHead","style","attr","staticStyleMapping","stack","EMPTY_CHILDREN","h","nodeName","attributes","children","lastSimple","child","simple","arguments","pop","undefined","String","p","runTimeComponent","constructor","props","elementId","key","vnode","extend","obj","applyRef","ref","value","current","defer","Promise","resolve","then","bind","setTimeout","cloneElement","slice","call","NO_RENDER","SYNC_RENDER","FORCE_RENDER","ASYNC_RENDER","ATTR_KEY","IS_NON_DIMENSIONAL","items","enqueueRender","component","_dirty","debounceRendering","rerender","renderComponent","isSameNodeType","node","hydrating","splitText","_componentConstructor","isNamedNode","normalizedNodeName","getNodeProps","defaultProps","createNode","isSvg","createElementNS","removeNode","setAccessor","name","old","store","className","test","innerHTML","__html","useCapture","substring","addEventListener","eventProxy","removeEventListener","_listeners","e","removeAttribute","ns","removeAttributeNS","setAttributeNS","type","event","mounts","diffLevel","isSvgMode","flushMounts","c","shift","afterMount","installed","diff","dom","context","mountAll","parent","componentRoot","ownerSVGElement","ret","idiff","out","prevSvgMode","_component","nodeValue","createTextNode","replaceChild","vnodeName","buildComponentFromVNode","firstChild","fc","vchildren","a","nextSibling","dangerouslySetInnerHTML","innerDiffNode","isHydrating","originalChildren","childNodes","keyed","keyedLen","min","childrenLen","vlen","j","f","vchild","__key","trim","insertBefore","recollectNodeTree","unmountOnly","removeChildren","lastChild","next","previousSibling","diffAttributes","attrs","recyclerComponents","createComponent","Ctor","inst","Component","render","doRender","update","nextBase","splice","setComponentProps","renderMode","_disable","__ref","base","install","receiveProps","__needUpdate_","prevContext","prevProps","syncComponentUpdates","isChild","previousProps","previousContext","isUpdate","initialBase","initialChildComponent","skip","snapshot","rendered","cbase","beforeUpdate","beforeRender","getChildContext","getSnapshotBeforeUpdate","childComponent","toUnmount","childProps","_parentComponent","baseParent","componentRef","t","updated","afterUpdate","_renderCallbacks","originalComponent","oldDom","isDirectOwner","isOwner","unmountComponent","beforeUnmount","uninstall","inner","prototype","callback","merge","querySelector","createRef","Omis"],"mappings":";;;;;;;;AAAA;;;;;;;;AAQA,IAAaA,QAAQ,SAASA,KAAT,GAAiB,EAA/B;;ACRP;;;;;;;;;;;;;;;;;;;AAmBA,IAAMC,UAAU;oBACG,EADH;cAEH,EAFG;sBAGK;CAHrB;;ACjBA,IAAIC,UAAU,CAAd;;AAEA,SAAgBC,WAAT,CAAqBC,IAArB,EAA2B;OAC3B,IAAIC,IAAI,CAAR,EAAWC,MAAML,QAAQM,UAAR,CAAmBC,MAAzC,EAAiDH,IAAIC,GAArD,EAA0DD,GAA1D,EAA+D;QACzDI,OAAOR,QAAQM,UAAR,CAAmBF,CAAnB,CAAX;;QAEII,KAAKL,IA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AAeA,OAAf;MACK5B,KAAL,GAAa,EAAb;;;;;MAKKhD,KAAL,GAAaA,KAAb;;MAEKoK,gBAAL,GAAwB,EAAxB;;;AAIDhK,OAAOwH,UAAUiD,SAAjB,EAA4B;;;;;;;;OAAA,kBAQpBC,QARoB,EAQV;MACZA,QAAJ,EAAc,KAAKV,gBAAL,CAAsBxN,IAAtB,CAA2BkO,QAA3B;kBACE,IAAhB,EAAsBzJ,YAAtB;EAV0B;;;;;;;;;;;;OAAA,oBAsBlB;CAtBV;;;;;;;;;;;;;;;;;;;ACrBA,SAAgBwG,MAAT,CAAgB1H,KAAhB,EAAuB2E,MAAvB,EAA+BiG,KAA/B,EAAsC;SACrCrG,KAAKqG,KAAL,EAAY5K,KAAZ,EAAmB,EAAnB,EAAuB,KAAvB,EAA8B,OAAO2E,MAAP,KAAkB,QAAlB,GAA6BhH,SAASkN,aAAT,CAAuBlG,MAAvB,CAA7B,GAA8DA,MAA5F,EAAoG,KAApG,CAAP;;;SCbQmG,SAAT,GAAqB;QACb,EAAP;;;AAGD,WAAe;KAAA;iBAAA;2BAAA;qBAAA;qBAAA;eAAA;mBAAA;;CAAf;;AAsBA,IAAG,OAAOzM,MAAP,KAAkB,WAArB,EAAiC;QACzB0M,IAAP,GAAc;MAAA;kBAAA;4BAAA;sBAAA;sBAAA;gBAAA;oBAAA;;EAAd;;;;"} \ No newline at end of file diff --git a/packages/omis/dist/omis.js b/packages/omis/dist/omis.js index 172cb1454..899a9cfd4 100644 --- a/packages/omis/dist/omis.js +++ b/packages/omis/dist/omis.js @@ -272,8 +272,8 @@ } return inst; } - function doRender(props) { - return this.constructor(props, this.store); + function doRender(props, context) { + return this.constructor(props, this.store, context); } function setComponentProps(component, props, renderMode, context, mountAll) { if (!component.__x) { @@ -282,7 +282,7 @@ component.__k = props.key; delete props.ref; delete props.key; - if (void 0 === component.constructor.getDerivedStateFromProps) if (!component.base || mountAll) { + if (!component.base || mountAll) { if (component.store.install) component.store.install(); } else if (component.store.receiveProps) component.R = component.store.receiveProps(props, context); if (context && context !== component.context) { @@ -298,33 +298,27 @@ } function renderComponent(component, renderMode, mountAll, isChild) { if (!component.__x) { - var rendered, inst, cbase, props = component.props, state = component.state, context = component.context, previousProps = component.__p || props, previousState = component.__s || state, previousContext = component.__c || context, isUpdate = component.base, nextBase = component.__b, initialBase = isUpdate || nextBase, initialChildComponent = component._component, skip = !1, snapshot = previousContext; - if (component.constructor.getDerivedStateFromProps) { - state = extend(extend({}, state), component.constructor.getDerivedStateFromProps(props, state)); - component.state = state; - } + var rendered, inst, cbase, props = component.props, context = component.context, previousProps = component.__p || props, previousContext = component.__c || context, isUpdate = component.base, nextBase = component.__b, initialBase = isUpdate || nextBase, initialChildComponent = component._component, skip = !1, snapshot = previousContext; if (isUpdate) { component.props = previousProps; - component.state = previousState; component.context = previousContext; if (!1 !== component.R) { skip = !1; - if (component.store.beforeUpdate) component.store.beforeUpdate(props, state, context); + if (component.store.beforeUpdate) component.store.beforeUpdate(props, context); } else skip = !0; delete component.R; component.props = props; - component.state = state; component.context = context; } - component.__p = component.__s = component.__c = component.__b = null; + component.__p = component.__c = component.__b = null; component.__d = !1; if (!skip) { options.runTimeComponent = component; if (component.store.beforeRender) component.store.beforeRender(); - rendered = component.render(props, state, context); + rendered = component.render(props, context); options.runTimeComponent = null; if (component.getChildContext) context = extend(extend({}, context), component.getChildContext()); - if (isUpdate && component.getSnapshotBeforeUpdate) snapshot = component.getSnapshotBeforeUpdate(previousProps, previousState); + if (isUpdate && component.getSnapshotBeforeUpdate) snapshot = component.getSnapshotBeforeUpdate(previousProps); var toUnmount, base, childComponent = rendered && rendered.nodeName; if ('function' == typeof childComponent) { var childProps = getNodeProps(rendered); @@ -367,7 +361,7 @@ } } if (!isUpdate || mountAll) mounts.push(component); else if (!skip) { - if (component.store.updated) component.store.updated(previousProps, previousState, snapshot); + if (component.store.updated) component.store.updated(previousProps, snapshot); if (options.afterUpdate) options.afterUpdate(component); } while (component.__h.length) component.__h.pop().call(component); @@ -421,7 +415,6 @@ this.context = context; this.store = {}; this.props = props; - this.state = this.state || {}; this.__h = []; } function render(vnode, parent, merge) { diff --git a/packages/omis/dist/omis.js.map b/packages/omis/dist/omis.js.map index e0cfb97d1..6af5664d7 100644 --- a/packages/omis/dist/omis.js.map +++ b/packages/omis/dist/omis.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/style.js","../src/h.js","../src/util.js","../src/clone-element.js","../src/constants.js","../src/render-queue.js","../src/vdom/index.js","../src/dom/index.js","../src/vdom/diff.js","../src/vdom/component-recycler.js","../src/vdom/component.js","../src/component.js","../src/vnode.js","../src/options.js","../src/render.js","../src/omis.js"],"names":["getCtorName","ctor","i","len","options","styleCache","length","item","attrName","styleId","push","scoper","css","prefix","toLowerCase","replace","re","RegExp","g0","g1","g2","g3","match","appendClass","addStyle","cssText","id","ele","document","getElementById","head","getElementsByTagName","parentNode","removeChild","someThingStyles","createElement","appendChild","setAttribute","window","ActiveXObject","styleSheet","textContent","addStyleToHead","style","attr","staticStyleMapping","nodeName","attributes","lastSimple","child","simple","children","EMPTY_CHILDREN","arguments","stack","pop","undefined","String","p","VNode","runTimeComponent","constructor","props","elementId","key","vnode","extend","obj","applyRef","ref","value","current","cloneElement","h","slice","call","enqueueRender","component","IS_NON_DIMENSIONAL","_dirty","items","rerender","node","hydrating","renderComponent","splitText","normalizedNodeName","isNamedNode","defaultProps","createNode","name","old","isSvg","test","__html","substring","eventProxy","useCapture","removeEventListener","bind","store","removeAttribute","ns","addEventListener","_listeners","setAttributeNS","removeAttributeNS","event","e","mounts","c","afterMount","parent","dom","mountAll","componentRoot","diffLevel","isSvgMode","flushMounts","out","prevSvgMode","idiff","createTextNode","replaceChild","recollectNodeTree","nodeValue","vnodeName","buildComponentFromVNode","firstChild","vchildren","fc","ATTR_KEY","innerDiffNode","dangerouslySetInnerHTML","context","isHydrating","originalChildren","childNodes","keyed","keyedLen","min","childrenLen","_child","_component","__key","vlen","f","trim","vchild","j","removeNode","insertBefore","unmountOnly","unmountComponent","removeChildren","next","previousSibling","setAccessor","diffAttributes","attrs","inst","Ctor","recyclerComponents","nextBase","this","setComponentProps","renderMode","doRender","_disable","receiveProps","prevContext","prevProps","__needUpdate_","syncComponentUpdates","base","state","skip","previousProps","previousState","prevState","getDerivedStateFromProps","previousContext","initialChildComponent","snapshot","rendered","cbase","isUpdate","beforeUpdate","beforeRender","getSnapshotBeforeUpdate","childComponent","childProps","getNodeProps","toUnmount","createComponent","_parentComponent","baseParent","initialBase","componentRef","t","isChild","updated","afterUpdate","_renderCallbacks","originalComponent","isDirectOwner","_componentConstructor","isOwner","oldDom","beforeUnmount","uninstall","inner","__ref","Component","defer","Promise","resolve","then","setTimeout","FORCE_RENDER","update","callback","render","diff","createRef","module","exports","Omis","self"],"mappings":";;IAIO,SAASA,YAAYC;QAC1B,KAAK,IAAIC,IAAI,GAAGC,MAAMC,QAAQC,WAAWC,QAAQJ,IAAIC,KAAKD,KAAK;YAC7D,IAAIK,OAAOH,QAAQC,WAAWH;YAE9B,IAAIK,KAAKN,SAASA,MAChB,OAAOM,KAAKC;;QAIhB,IAAIA,WAAW,QAAQC;QACvBL,QAAQC,WAAWK;YAAOT,MAAAA;YAAMO,UAAAA;;QAChCC;QAEA,OAAOD;;IAIF,SAASG,OAATC,KAAqBC;QAC1BA,SAAS,MAAMA,OAAOC,gBAAgB;QAEtCF,MAAMA,IAAIG,QAAQ,mCAAkC;QAElD,IAAIC,KAAK,IAAIC,OAAO,mDAAoD;QAU1EL,MAAMA,IAAIG,QAAQC,IAAI,SAACE,IAAIC,IAAIC,IAAIC;YACjC,SAAkB,MAAPD,IACTA,KAAK;YAIP,IACED,GAAGG,MACD,wEAGF,OAAOH,KAAKC,KAAKC;YAGnB,IAAIE,cAAcJ,GAAGJ,QAAQ,UAAU,MAAMF,SAASO;YAGtD,OAAOG,cAAcF;;QAIvB,OAAOT;;IAGF,SAASY,SAASC,SAAlBC;QACLA,KAAKA,GAAGZ;QACR,IAAIa,MAAMC,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AsBA,QAAQC,UAAUC,KAAKtH,KAAKoH,QAAQC,aAAaE;;IEtB5F,IAAMC;IG4Hb,IAAA9G;;IAMC,IAAAQ,aAAYb;;ICyMZ,IAAA0D;;;QG1SA0D,QAAK7C,SAAQ8C;;YAEbzI,gBAAKuH,MAAL;;QAeCmB,QAX0B;;;;;;;QG3BrBT,WAASS;QACfA,QAAOC;QACP9I,UAAAA;;;ICZA,IAAA,sBAAA3C;QAEDmC,GAAAA;QACCA,eADcA;QAEdtC,cAAAA;QACAqC,WAAAA;QACAwJ,WAAAA;QACAX,QAAAA;QACAS,UAAAA;QACA7I,SAAAA;;IAeD,IAAqB,sBAAX3C,QAAuB2L,OAAAC,UAAAC,WAAAC,KAAAD,OAAAA","file":"omis.js","sourcesContent":["import options from './options'\n\nlet styleId = 0\n\nexport function getCtorName(ctor) {\n for (let i = 0, len = options.styleCache.length; i < len; i++) {\n let item = options.styleCache[i]\n\n if (item.ctor === ctor) {\n return item.attrName\n }\n }\n\n let attrName = '_ss' + styleId\n options.styleCache.push({ ctor, attrName })\n styleId++\n\n return attrName\n}\n\n// many thanks to https://github.com/thomaspark/scoper/\nexport function scoper(css, prefix) {\n prefix = '[' + prefix.toLowerCase() + ']'\n // https://www.w3.org/TR/css-syntax-3/#lexical\n css = css.replace(/\\/\\*[^*]*\\*+([^/][^*]*\\*+)*\\//g, '')\n // eslint-disable-next-line\n let re = new RegExp('([^\\r\\n,{}:]+)(:[^\\r\\n,{}]+)?(,(?=[^{}]*{)|\\s*{)', 'g')\n /**\n * Example:\n *\n * .classname::pesudo { color:red }\n *\n * g1 is normal selector `.classname`\n * g2 is pesudo class or pesudo element\n * g3 is the suffix\n */\n css = css.replace(re, (g0, g1, g2, g3) => {\n if (typeof g2 === 'undefined') {\n g2 = ''\n }\n\n /* eslint-ignore-next-line */\n if (\n g1.match(\n /^\\s*(@media|\\d+%?|@-webkit-keyframes|@keyframes|to|from|@font-face)/\n )\n ) {\n return g1 + g2 + g3\n }\n\n let appendClass = g1.replace(/(\\s*)$/, '') + prefix + g2\n //let prependClass = prefix + ' ' + g1.trim() + g2;\n\n return appendClass + g3\n //return appendClass + ',' + prependClass + g3;\n })\n\n return css\n}\n\nexport function addStyle(cssText, id) {\n id = id.toLowerCase()\n let ele = document.getElementById(id)\n let head = document.getElementsByTagName('head')[0]\n if (ele && ele.parentNode === head) {\n head.removeChild(ele)\n }\n\n let someThingStyles = document.createElement('style')\n head.appendChild(someThingStyles)\n someThingStyles.setAttribute('type', 'text/css')\n someThingStyles.setAttribute('id', id)\n if (window.ActiveXObject) {\n someThingStyles.styleSheet.cssText = cssText\n } else {\n someThingStyles.textContent = cssText\n }\n}\n\nexport function addStyleToHead(style, attr) {\n\n\tif (!options.staticStyleMapping[attr]) {\n\t\taddStyle(scoper(style, attr), attr)\n\t\toptions.staticStyleMapping[attr] = true\n\t}\n}\n","import { VNode } from './vnode';\nimport options from './options';\nimport {getCtorName} from './style'\n\nconst stack = [];\n\nconst EMPTY_CHILDREN = [];\n\n/**\n * JSX/hyperscript reviver.\n * @see http://jasonformat.com/wtf-is-jsx\n * Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0\n *\n * Note: this is exported as both `h()` and `createElement()` for compatibility\n * reasons.\n *\n * Creates a VNode (virtual DOM element). A tree of VNodes can be used as a\n * lightweight representation of the structure of a DOM tree. This structure can\n * be realized by recursively comparing it against the current _actual_ DOM\n * structure, and applying only the differences.\n *\n * `h()`/`createElement()` accepts an element name, a list of attributes/props,\n * and optionally children to append to the element.\n *\n * @example The following DOM tree\n *\n * `
Hello!
`\n *\n * can be constructed using this function as:\n *\n * `h('div', { id: 'foo', name : 'bar' }, 'Hello!');`\n *\n * @param {string | function} nodeName An element name. Ex: `div`, `a`, `span`, etc.\n * @param {object | null} attributes Any attributes/props to set on the created element.\n * @param {VNode[]} [rest] Additional arguments are taken to be children to\n * append. Can be infinitely nested Arrays.\n *\n * @public\n */\nexport function h(nodeName, attributes) {\n\tlet children=EMPTY_CHILDREN, lastSimple, child, simple, i;\n\tfor (i=arguments.length; i-- > 2; ) {\n\t\tstack.push(arguments[i]);\n\t}\n\tif (attributes && attributes.children!=null) {\n\t\tif (!stack.length) stack.push(attributes.children);\n\t\tdelete attributes.children;\n\t}\n\twhile (stack.length) {\n\t\tif ((child = stack.pop()) && child.pop!==undefined) {\n\t\t\tfor (i=child.length; i--; ) stack.push(child[i]);\n\t\t}\n\t\telse {\n\t\t\tif (typeof child==='boolean') child = null;\n\n\t\t\tif ((simple = typeof nodeName!=='function')) {\n\t\t\t\tif (child==null) child = '';\n\t\t\t\telse if (typeof child==='number') child = String(child);\n\t\t\t\telse if (typeof child!=='string') simple = false;\n\t\t\t}\n\n\t\t\tif (simple && lastSimple) {\n\t\t\t\tchildren[children.length-1] += child;\n\t\t\t}\n\t\t\telse if (children===EMPTY_CHILDREN) {\n\t\t\t\tchildren = [child];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tchildren.push(child);\n\t\t\t}\n\n\t\t\tlastSimple = simple;\n\t\t}\n\t}\n\n\tlet p = new VNode();\n\tp.nodeName = nodeName;\n\tp.children = children;\n\tp.attributes = attributes==null ? {} : attributes;\n\tif(options.runTimeComponent){\n\t\tif(options.runTimeComponent.constructor.css){\n\t\t\tp.attributes[getCtorName(options.runTimeComponent.constructor)] = ''\n\t\t}\n\t\tif(options.runTimeComponent.props && options.runTimeComponent.props.css){\n\t\t\tp.attributes['_ds'+options.runTimeComponent.elementId] = ''\n\t\t}\n\t}\n\n\tp.key = p.attributes.key;\n\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\n\tif (options.vnode!==undefined) options.vnode(p);\n\n\treturn p;\n}\n","/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function extend(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\n}\n\n/** Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} [ref=null]\n * @param {any} [value]\n */\nexport function applyRef(ref, value) {\n\tif (ref) {\n\t\tif (typeof ref=='function') ref(value);\n\t\telse ref.current = value;\n\t}\n}\n\n/**\n * Call a function asynchronously, as soon as possible. Makes\n * use of HTML Promise to schedule the callback if available,\n * otherwise falling back to `setTimeout` (mainly for IE<11).\n * @type {(callback: function) => void}\n */\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;\n","import { extend } from './util';\nimport { h } from './h';\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its\n * children.\n * @param {import('./vnode').VNode} vnode The virtual DOM element to clone\n * @param {object} props Attributes/props to add when cloning\n * @param {Array} [rest] Any additional arguments will be used as replacement\n * children.\n */\nexport function cloneElement(vnode, props) {\n\treturn h(\n\t\tvnode.nodeName,\n\t\textend(extend({}, vnode.attributes), props),\n\t\targuments.length>2 ? [].slice.call(arguments, 2) : vnode.children\n\t);\n}\n","// render modes\n\n/** Do not re-render a component */\nexport const NO_RENDER = 0;\n/** Synchronously re-render a component and its children */\nexport const SYNC_RENDER = 1;\n/** Synchronously re-render a component, even if its lifecycle methods attempt to prevent it. */\nexport const FORCE_RENDER = 2;\n/** Queue asynchronous re-render of a component and it's children */\nexport const ASYNC_RENDER = 3;\n\n\nexport const ATTR_KEY = 'prevProps';\n\n/** DOM properties that should NOT have \"px\" added when numeric */\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;\n\n","import options from './options';\nimport { defer } from './util';\nimport { renderComponent } from './vdom/component';\n\n/**\n * Managed queue of dirty components to be re-rendered\n * @type {Array}\n */\nlet items = [];\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./component').Component} component The component to rerender\n */\nexport function enqueueRender(component) {\n\tif (!component._dirty && (component._dirty = true) && items.push(component)==1) {\n\t\t(options.debounceRendering || defer)(rerender);\n\t}\n}\n\n/** Rerender all enqueued dirty components */\nexport function rerender() {\n\tlet p;\n\twhile ( (p = items.pop()) ) {\n\t\tif (p._dirty) renderComponent(p);\n\t}\n}\n","import { extend } from '../util';\n\n\n/**\n * Check if two nodes are equivalent.\n * @param {import('../dom').OmiElement} node DOM Node to compare\n * @param {import('../vnode').VNode} vnode Virtual DOM node to compare\n * @param {boolean} [hydrating=false] If true, ignores component constructors\n * when comparing.\n * @private\n */\nexport function isSameNodeType(node, vnode, hydrating) {\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\t\treturn node.splitText!==undefined;\n\t}\n\tif (typeof vnode.nodeName==='string') {\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName);\n\t}\n\treturn hydrating || node._componentConstructor===vnode.nodeName;\n}\n\n\n/**\n * Check if an Element has a given nodeName, case-insensitively.\n * @param {import('../dom').OmiElement} node A DOM Element to inspect the name of.\n * @param {string} nodeName Unnormalized name to compare against.\n */\nexport function isNamedNode(node, nodeName) {\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase();\n}\n\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n * @param {import('../vnode').VNode} vnode The VNode to get props for\n * @returns {object} The props to use for this VNode\n */\nexport function getNodeProps(vnode) {\n\tlet props = extend({}, vnode.attributes);\n\tprops.children = vnode.children;\n\n\tlet defaultProps = vnode.nodeName.defaultProps;\n\tif (defaultProps!==undefined) {\n\t\tfor (let i in defaultProps) {\n\t\t\tif (props[i]===undefined) {\n\t\t\t\tprops[i] = defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn props;\n}\n","import { IS_NON_DIMENSIONAL } from '../constants';\nimport { applyRef } from '../util';\nimport options from '../options';\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Omi adds to elements it creates\n * @typedef OmiElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Omi properties\n * @typedef {Element & ElementCSSInlineStyle & OmiElementExtensions} OmiElement\n */\n\n/**\n * Create an element with the given nodeName.\n * @param {string} nodeName The DOM node to create\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\n * namespace.\n * @returns {OmiElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n\t/** @type {OmiElement} */\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);\n\tnode.normalizedNodeName = nodeName;\n\treturn node;\n}\n\n\n/**\n * Remove a child node from its parent if attached.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\n\n/**\n * Set a named attribute on the given Node, with special behavior for some names\n * and event handlers. If `value` is `null`, the attribute/handler will be\n * removed.\n * @param {OmiElement} node An element to mutate\n * @param {string} name The name/key to set, such as an event or attribute name\n * @param {*} old The last value that was set for this name/node pair\n * @param {*} value An attribute value, such as a function to be used as an\n * event handler\n * @param {boolean} isSvg Are we currently diffing inside an svg?\n * @private\n */\nexport function setAccessor(node, name, old, value, isSvg, store) {\n\tif (name==='className') name = 'class';\n\n\n\tif (name==='key') {\n\t\t// ignore\n\t}\n\telse if (name==='ref') {\n\t\tapplyRef(old, null);\n\t\tapplyRef(value, node);\n\t}\n\telse if (name==='class' && !isSvg) {\n\t\tnode.className = value || '';\n\t}\n\telse if (name==='style') {\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\n\t\t\tnode.style.cssText = value || '';\n\t\t}\n\t\tif (value && typeof value==='object') {\n\t\t\tif (typeof old!=='string') {\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = '';\n\t\t\t}\n\t\t\tfor (let i in value) {\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i];\n\t\t\t}\n\t\t}\n\t}\n\telse if (name==='dangerouslySetInnerHTML') {\n\t\tif (value) node.innerHTML = value.__html || '';\n\t}\n\telse if (name[0]=='o' && name[1]=='n') {\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''));\n\t\tname = name.toLowerCase().substring(2);\n\t\tif (value) {\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\telse {\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\t(node._listeners || (node._listeners = {}))[name] = (value && store) ? value.bind(store) : value;\n\t}\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\n\t\t// Attempt to set a DOM property to the given value.\n\t\t// IE & FF throw for certain property-value combinations.\n\t\ttry {\n\t\t\tnode[name] = value==null ? '' : value;\n\t\t} catch (e) { }\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name);\n\t}\n\telse {\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')));\n\t\t// spellcheck is treated differently than all other boolean values and\n\t\t// should not be removed when the value is `false`. See:\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\n\t\tif (value==null || value===false) {\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());\n\t\t\telse node.removeAttribute(name);\n\t\t}\n\t\telse if (typeof value!=='function') {\n\t\t\tif (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);\n\t\t\telse node.setAttribute(name, value);\n\t\t}\n\t}\n}\n\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\treturn this._listeners[e.type](options.event && options.event(e) || e);\n}\n","import { ATTR_KEY } from '../constants';\nimport { isSameNodeType, isNamedNode } from './index';\nimport { buildComponentFromVNode } from './component';\nimport { createNode, setAccessor } from '../dom/index';\nimport { unmountComponent } from './component';\nimport options from '../options';\nimport { applyRef } from '../util';\nimport { removeNode } from '../dom/index';\nimport { addStyleToHead, getCtorName } from '../style'\n\n/**\n * Queue of components that have been mounted and are awaiting componentDidMount\n * @type {Array}\n */\nexport const mounts = [];\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0;\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false;\n\n/** Global flag indicating if the diff is performing hydration */\nlet hydrating = false;\n\n/** Invoke queued componentDidMount lifecycle methods */\nexport function flushMounts() {\n\tlet c;\n\twhile ((c = mounts.shift())) {\n\t\tif (c.constructor.css) {\n addStyleToHead(c.constructor.css, getCtorName(c.constructor))\n\t\t}\n\t\tif(c.props.css){\n\t\t\taddStyleToHead(c.props.css, '_ds'+c.elementId)\n\t\t}\n\t\tif (options.afterMount) options.afterMount(c);\n\t\t//if (c.componentDidMount) c.componentDidMount();\n\t\tif (c.store.installed) c.store.installed()\n\t}\n}\n\n\n/**\n * Apply differences in a given vnode (and it's deep children) to a real DOM Node.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing\n * the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {Element} parent ?\n * @param {boolean} componentRoot ?\n * @returns {import('../dom').OmiElement} The created/mutated element\n * @private\n */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot, store) {\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n\tif (!diffLevel++) {\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined;\n\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\n\t\thydrating = dom!=null && !(ATTR_KEY in dom);\n\t}\n\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot, store);\n\n\t// append the element if its a new parent\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret);\n\n\t// diffLevel being reduced to 0 means we're exiting the diff\n\tif (!--diffLevel) {\n\t\thydrating = false;\n\t\t// invoke queued componentDidMount lifecycle methods\n\t\tif (!componentRoot) flushMounts();\n\t}\n\n\treturn ret;\n}\n\n\n/**\n * Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} [componentRoot] ?\n * @private\n */\nfunction idiff(dom, vnode, context, mountAll, componentRoot, store) {\n\tlet out = dom,\n\t\tprevSvgMode = isSvgMode;\n\n\t// empty values (null, undefined, booleans) render as empty Text nodes\n\tif (vnode==null || typeof vnode==='boolean') vnode = '';\n\n\n\t// Fast case: Strings & Numbers create/update Text nodes.\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\n\t\t// update if it's already a Text node:\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/Omi/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\n\t\t\tif (dom.nodeValue!=vnode) {\n\t\t\t\tdom.nodeValue = vnode;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\n\t\t\tout = document.createTextNode(vnode);\n\t\t\tif (dom) {\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\t\t\t\trecollectNodeTree(dom, true);\n\t\t\t}\n\t\t}\n\n\t\tout[ATTR_KEY] = true;\n\n\t\treturn out;\n\t}\n\n\n\t// If the VNode represents a Component, perform a component diff:\n\tlet vnodeName = vnode.nodeName;\n\tif (typeof vnodeName==='function') {\n\t\treturn buildComponentFromVNode(dom, vnode, context, mountAll);\n\t}\n\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode;\n\n\n\t// If there's no existing element or it's the wrong type, create a new one:\n\tvnodeName = String(vnodeName);\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\n\t\tout = createNode(vnodeName, isSvgMode);\n\n\t\tif (dom) {\n\t\t\t// move children into the replacement node\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild);\n\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\n\t\t\t// recycle the old element (skips non-Element node types)\n\t\t\trecollectNodeTree(dom, true);\n\t\t}\n\t}\n\n\n\tlet fc = out.firstChild,\n\t\tprops = out[ATTR_KEY],\n\t\tvchildren = vnode.children;\n\n\tif (props==null) {\n\t\tprops = out[ATTR_KEY] = {};\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value;\n\t}\n\n\t// Optimization: fast-path for elements containing a single TextNode:\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\n\t\tif (fc.nodeValue!=vchildren[0]) {\n\t\t\tfc.nodeValue = vchildren[0];\n\t\t}\n\t}\n\t// otherwise, if there are existing or new children, diff them:\n\telse if (vchildren && vchildren.length || fc!=null) {\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null, store);\n\t}\n\n\n\t// Apply attributes/props from VNode to the DOM Element:\n\tdiffAttributes(out, vnode.attributes, props, store);\n\n\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\n\tisSvgMode = prevSvgMode;\n\n\treturn out;\n}\n\n\n/**\n * Apply child and attribute changes between a VNode and a DOM Node to the DOM.\n * @param {import('../dom').OmiElement} dom Element whose children should be compared & mutated\n * @param {Array} vchildren Array of VNodes to compare to `dom.childNodes`\n * @param {object} context Implicitly descendant context object (from most\n * recent `getChildContext()`)\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} isHydrating if `true`, consumes externally created elements\n * similar to hydration\n */\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating, store) {\n\tlet originalChildren = dom.childNodes,\n\t\tchildren = [],\n\t\tkeyed = {},\n\t\tkeyedLen = 0,\n\t\tmin = 0,\n\t\tlen = originalChildren.length,\n\t\tchildrenLen = 0,\n\t\tvlen = vchildren ? vchildren.length : 0,\n\t\tj, c, f, vchild, child;\n\n\t// Build up a map of keyed children and an Array of unkeyed children:\n\tif (len!==0) {\n\t\tfor (let i=0; i;\n * }\n * }\n */\n\n let id = 0\n\nexport function Component(props, context) {\n\tthis._dirty = true;\n\tthis.elementId = id++\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.context = context;\n\tthis.store = {}\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.props = props;\n\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.state = this.state || {};\n\n\tthis._renderCallbacks = [];\n}\n\n\nextend(Component.prototype, {\n\n\t/**\n\t * Immediately perform a synchronous re-render of the component.\n\t * @param {() => void} callback A function to be called after component is\n\t * \tre-rendered.\n\t * @private\n\t */\n\tupdate(callback) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\trenderComponent(this, FORCE_RENDER);\n\t},\n\n\t/**\n\t * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n\t * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n\t * @param {object} props Props (eg: JSX attributes) received from parent\n\t * \telement/component\n\t * @param {object} state The component's current state\n\t * @param {object} context Context object, as returned by the nearest\n\t * ancestor's `getChildContext()`\n\t * @returns {import('./vnode').VNode | void}\n\t */\n\trender() {}\n\n});\n","/**\n * Virtual DOM Node\n * @typedef VNode\n * @property {string | function} nodeName The string of the DOM node to create or Component constructor to render\n * @property {Array} children The children of node\n * @property {string | number | undefined} key The key used to identify this VNode in a list\n * @property {object} attributes The properties of this VNode\n */\nexport const VNode = function VNode() {};\n","/**\n * @typedef {import('./component').Component} Component\n * @typedef {import('./vnode').VNode} VNode\n */\n\n/**\n * Global options\n * @public\n * @typedef Options\n * @property {boolean} [syncComponentUpdates] If `true`, `prop` changes trigger synchronous component updates. Defaults to true.\n * @property {(vnode: VNode) => void} [vnode] Processes all created VNodes.\n * @property {(component: Component) => void} [afterMount] Hook invoked after a component is mounted.\n * @property {(component: Component) => void} [afterUpdate] Hook invoked after the DOM is updated with a component's latest render.\n * @property {(component: Component) => void} [beforeUnmount] Hook invoked immediately before a component is unmounted.\n * @property {(rerender: function) => void} [debounceRendering] Hook invoked whenever a rerender is requested. Can be used to debounce rerenders.\n * @property {(event: Event) => Event | void} [event] Hook invoked before any Omi event listeners. The return value (if any) replaces the native browser event given to event listeners\n */\n\n/** @type {Options} */\nconst options = {\n\trunTimeComponent: {},\n\tstyleCache: [],\n\tstaticStyleMapping: {}\n};\n\nexport default options;\n","import { diff } from './vdom/diff';\n\n/**\n * Render JSX into a `parent` Element.\n * @param {import('./vnode').VNode} vnode A (JSX) VNode to render\n * @param {import('./dom').OmiElement} parent DOM element to render into\n * @param {import('./dom').OmiElement} [merge] Attempt to re-use an existing DOM tree rooted at\n * `merge`\n * @public\n *\n * @example\n * // render a div into :\n * render(
hello!
, document.body);\n *\n * @example\n * // render a \"Thing\" component into #foo:\n * const Thing = ({ name }) => { name };\n * render(, document.querySelector('#foo'));\n */\nexport function render(vnode, parent, merge) {\n\treturn diff(merge, vnode, {}, false, typeof parent === 'string' ? document.querySelector(parent) : parent, false);\n}\n","import { h, h as createElement } from './h';\nimport { cloneElement } from './clone-element';\nimport { Component } from './component';\nimport { render } from './render';\nimport { rerender } from './render-queue';\nimport options from './options';\n\nfunction createRef() {\n\treturn {};\n}\n\nexport default {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nexport {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nif(typeof window !== 'undefined'){\n\twindow.Omis = {\n\t\th,\n\t\tcreateElement,\n\t\tcloneElement,\n\t\tcreateRef,\n\t\tComponent,\n\t\trender,\n\t\trerender,\n\t\toptions\n\t};\n}\n"]} \ No newline at end of file +{"version":3,"sources":["../src/style.js","../src/h.js","../src/util.js","../src/clone-element.js","../src/constants.js","../src/render-queue.js","../src/vdom/index.js","../src/dom/index.js","../src/vdom/diff.js","../src/vdom/component-recycler.js","../src/vdom/component.js","../src/component.js","../src/vnode.js","../src/options.js","../src/render.js","../src/omis.js"],"names":["getCtorName","ctor","i","len","options","styleCache","length","item","attrName","styleId","push","scoper","css","prefix","toLowerCase","replace","re","RegExp","g0","g1","g2","g3","match","appendClass","addStyle","cssText","id","ele","document","getElementById","head","getElementsByTagName","parentNode","removeChild","someThingStyles","createElement","appendChild","setAttribute","window","ActiveXObject","styleSheet","textContent","addStyleToHead","style","attr","staticStyleMapping","nodeName","attributes","lastSimple","child","simple","children","EMPTY_CHILDREN","arguments","stack","pop","undefined","String","p","VNode","runTimeComponent","constructor","props","elementId","key","vnode","extend","obj","applyRef","ref","value","current","cloneElement","h","slice","call","enqueueRender","component","IS_NON_DIMENSIONAL","_dirty","items","rerender","node","hydrating","renderComponent","splitText","normalizedNodeName","isNamedNode","defaultProps","createNode","name","old","isSvg","test","__html","substring","eventProxy","useCapture","removeEventListener","bind","store","removeAttribute","ns","addEventListener","_listeners","setAttributeNS","removeAttributeNS","event","e","mounts","c","afterMount","parent","dom","mountAll","componentRoot","diffLevel","isSvgMode","flushMounts","out","prevSvgMode","idiff","createTextNode","replaceChild","recollectNodeTree","nodeValue","vnodeName","buildComponentFromVNode","firstChild","vchildren","fc","ATTR_KEY","innerDiffNode","dangerouslySetInnerHTML","context","isHydrating","originalChildren","childNodes","keyed","keyedLen","min","childrenLen","_child","_component","__key","vlen","f","trim","vchild","j","removeNode","insertBefore","unmountOnly","unmountComponent","removeChildren","next","previousSibling","setAccessor","diffAttributes","attrs","inst","Ctor","recyclerComponents","nextBase","this","setComponentProps","renderMode","doRender","_disable","__ref","receiveProps","base","prevContext","prevProps","syncComponentUpdates","rendered","previousProps","previousContext","isUpdate","initialBase","skip","initialChildComponent","beforeUpdate","snapshot","cbase","__needUpdate_","beforeRender","getSnapshotBeforeUpdate","childComponent","childProps","getNodeProps","toUnmount","createComponent","_parentComponent","baseParent","componentRef","t","isChild","_componentConstructor","afterUpdate","_renderCallbacks","originalComponent","isDirectOwner","isOwner","oldDom","beforeUnmount","uninstall","inner","Component","defer","Promise","resolve","then","setTimeout","FORCE_RENDER","update","callback","render","diff","createRef","module","exports","Omis","self"],"mappings":";;IAIO,SAASA,YAAYC;QAC1B,KAAK,IAAIC,IAAI,GAAGC,MAAMC,QAAQC,WAAWC,QAAQJ,IAAIC,KAAKD,KAAK;YAC7D,IAAIK,OAAOH,QAAQC,WAAWH;YAE9B,IAAIK,KAAKN,SAASA,MAChB,OAAOM,KAAKC;;QAIhB,IAAIA,WAAW,QAAQC;QACvBL,QAAQC,WAAWK;YAAOT,MAAAA;YAAMO,UAAAA;;QAChCC;QAEA,OAAOD;;IAIF,SAASG,OAATC,KAAqBC;QAC1BA,SAAS,MAAMA,OAAOC,gBAAgB;QAEtCF,MAAMA,IAAIG,QAAQ,mCAAkC;QAElD,IAAIC,KAAK,IAAIC,OAAO,mDAAoD;QAU1EL,MAAMA,IAAIG,QAAQC,IAAI,SAACE,IAAIC,IAAIC,IAAIC;YACjC,SAAkB,MAAPD,IACTA,KAAK;YAIP,IACED,GAAGG,MACD,wEAGF,OAAOH,KAAKC,KAAKC;YAGnB,IAAIE,cAAcJ,GAAGJ,QAAQ,UAAU,MAAMF,SAASO;YA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J,SAAL0J;;YAEApI,gBAAKoH,MAAL;;QAcCpH,QAAAA;;;;;;;QG/BK4H,WAASS;QACfA,QAAOC;QACPzI,UAAAA;;;ICZA,IAAA,sBAAA3C;QAEDmC,GAAAA;QACCA,eADcA;QAEdtC,cAAAA;QACAqC,WAAAA;QACAmJ,WAAAA;QACAX,QAAAA;QACAS,UAAAA;QACAxI,SAAAA;;IAeD,IAAqB,sBAAX3C,QAAuBsL,OAAAC,UAAAC,WAAAC,KAAAD,OAAAA","file":"omis.js","sourcesContent":["import options from './options'\n\nlet styleId = 0\n\nexport function getCtorName(ctor) {\n for (let i = 0, len = options.styleCache.length; i < len; i++) {\n let item = options.styleCache[i]\n\n if (item.ctor === ctor) {\n return item.attrName\n }\n }\n\n let attrName = '_ss' + styleId\n options.styleCache.push({ ctor, attrName })\n styleId++\n\n return attrName\n}\n\n// many thanks to https://github.com/thomaspark/scoper/\nexport function scoper(css, prefix) {\n prefix = '[' + prefix.toLowerCase() + ']'\n // https://www.w3.org/TR/css-syntax-3/#lexical\n css = css.replace(/\\/\\*[^*]*\\*+([^/][^*]*\\*+)*\\//g, '')\n // eslint-disable-next-line\n let re = new RegExp('([^\\r\\n,{}:]+)(:[^\\r\\n,{}]+)?(,(?=[^{}]*{)|\\s*{)', 'g')\n /**\n * Example:\n *\n * .classname::pesudo { color:red }\n *\n * g1 is normal selector `.classname`\n * g2 is pesudo class or pesudo element\n * g3 is the suffix\n */\n css = css.replace(re, (g0, g1, g2, g3) => {\n if (typeof g2 === 'undefined') {\n g2 = ''\n }\n\n /* eslint-ignore-next-line */\n if (\n g1.match(\n /^\\s*(@media|\\d+%?|@-webkit-keyframes|@keyframes|to|from|@font-face)/\n )\n ) {\n return g1 + g2 + g3\n }\n\n let appendClass = g1.replace(/(\\s*)$/, '') + prefix + g2\n //let prependClass = prefix + ' ' + g1.trim() + g2;\n\n return appendClass + g3\n //return appendClass + ',' + prependClass + g3;\n })\n\n return css\n}\n\nexport function addStyle(cssText, id) {\n id = id.toLowerCase()\n let ele = document.getElementById(id)\n let head = document.getElementsByTagName('head')[0]\n if (ele && ele.parentNode === head) {\n head.removeChild(ele)\n }\n\n let someThingStyles = document.createElement('style')\n head.appendChild(someThingStyles)\n someThingStyles.setAttribute('type', 'text/css')\n someThingStyles.setAttribute('id', id)\n if (window.ActiveXObject) {\n someThingStyles.styleSheet.cssText = cssText\n } else {\n someThingStyles.textContent = cssText\n }\n}\n\nexport function addStyleToHead(style, attr) {\n\n\tif (!options.staticStyleMapping[attr]) {\n\t\taddStyle(scoper(style, attr), attr)\n\t\toptions.staticStyleMapping[attr] = true\n\t}\n}\n","import { VNode } from './vnode';\nimport options from './options';\nimport {getCtorName} from './style'\n\nconst stack = [];\n\nconst EMPTY_CHILDREN = [];\n\n/**\n * JSX/hyperscript reviver.\n * @see http://jasonformat.com/wtf-is-jsx\n * Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0\n *\n * Note: this is exported as both `h()` and `createElement()` for compatibility\n * reasons.\n *\n * Creates a VNode (virtual DOM element). A tree of VNodes can be used as a\n * lightweight representation of the structure of a DOM tree. This structure can\n * be realized by recursively comparing it against the current _actual_ DOM\n * structure, and applying only the differences.\n *\n * `h()`/`createElement()` accepts an element name, a list of attributes/props,\n * and optionally children to append to the element.\n *\n * @example The following DOM tree\n *\n * `
Hello!
`\n *\n * can be constructed using this function as:\n *\n * `h('div', { id: 'foo', name : 'bar' }, 'Hello!');`\n *\n * @param {string | function} nodeName An element name. Ex: `div`, `a`, `span`, etc.\n * @param {object | null} attributes Any attributes/props to set on the created element.\n * @param {VNode[]} [rest] Additional arguments are taken to be children to\n * append. Can be infinitely nested Arrays.\n *\n * @public\n */\nexport function h(nodeName, attributes) {\n\tlet children=EMPTY_CHILDREN, lastSimple, child, simple, i;\n\tfor (i=arguments.length; i-- > 2; ) {\n\t\tstack.push(arguments[i]);\n\t}\n\tif (attributes && attributes.children!=null) {\n\t\tif (!stack.length) stack.push(attributes.children);\n\t\tdelete attributes.children;\n\t}\n\twhile (stack.length) {\n\t\tif ((child = stack.pop()) && child.pop!==undefined) {\n\t\t\tfor (i=child.length; i--; ) stack.push(child[i]);\n\t\t}\n\t\telse {\n\t\t\tif (typeof child==='boolean') child = null;\n\n\t\t\tif ((simple = typeof nodeName!=='function')) {\n\t\t\t\tif (child==null) child = '';\n\t\t\t\telse if (typeof child==='number') child = String(child);\n\t\t\t\telse if (typeof child!=='string') simple = false;\n\t\t\t}\n\n\t\t\tif (simple && lastSimple) {\n\t\t\t\tchildren[children.length-1] += child;\n\t\t\t}\n\t\t\telse if (children===EMPTY_CHILDREN) {\n\t\t\t\tchildren = [child];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tchildren.push(child);\n\t\t\t}\n\n\t\t\tlastSimple = simple;\n\t\t}\n\t}\n\n\tlet p = new VNode();\n\tp.nodeName = nodeName;\n\tp.children = children;\n\tp.attributes = attributes==null ? {} : attributes;\n\tif(options.runTimeComponent){\n\t\tif(options.runTimeComponent.constructor.css){\n\t\t\tp.attributes[getCtorName(options.runTimeComponent.constructor)] = ''\n\t\t}\n\t\tif(options.runTimeComponent.props && options.runTimeComponent.props.css){\n\t\t\tp.attributes['_ds'+options.runTimeComponent.elementId] = ''\n\t\t}\n\t}\n\n\tp.key = p.attributes.key;\n\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\n\tif (options.vnode!==undefined) options.vnode(p);\n\n\treturn p;\n}\n","/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function extend(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\n}\n\n/** Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} [ref=null]\n * @param {any} [value]\n */\nexport function applyRef(ref, value) {\n\tif (ref) {\n\t\tif (typeof ref=='function') ref(value);\n\t\telse ref.current = value;\n\t}\n}\n\n/**\n * Call a function asynchronously, as soon as possible. Makes\n * use of HTML Promise to schedule the callback if available,\n * otherwise falling back to `setTimeout` (mainly for IE<11).\n * @type {(callback: function) => void}\n */\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;\n","import { extend } from './util';\nimport { h } from './h';\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its\n * children.\n * @param {import('./vnode').VNode} vnode The virtual DOM element to clone\n * @param {object} props Attributes/props to add when cloning\n * @param {Array} [rest] Any additional arguments will be used as replacement\n * children.\n */\nexport function cloneElement(vnode, props) {\n\treturn h(\n\t\tvnode.nodeName,\n\t\textend(extend({}, vnode.attributes), props),\n\t\targuments.length>2 ? [].slice.call(arguments, 2) : vnode.children\n\t);\n}\n","// render modes\n\n/** Do not re-render a component */\nexport const NO_RENDER = 0;\n/** Synchronously re-render a component and its children */\nexport const SYNC_RENDER = 1;\n/** Synchronously re-render a component, even if its lifecycle methods attempt to prevent it. */\nexport const FORCE_RENDER = 2;\n/** Queue asynchronous re-render of a component and it's children */\nexport const ASYNC_RENDER = 3;\n\n\nexport const ATTR_KEY = 'prevProps';\n\n/** DOM properties that should NOT have \"px\" added when numeric */\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;\n\n","import options from './options';\nimport { defer } from './util';\nimport { renderComponent } from './vdom/component';\n\n/**\n * Managed queue of dirty components to be re-rendered\n * @type {Array}\n */\nlet items = [];\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./component').Component} component The component to rerender\n */\nexport function enqueueRender(component) {\n\tif (!component._dirty && (component._dirty = true) && items.push(component)==1) {\n\t\t(options.debounceRendering || defer)(rerender);\n\t}\n}\n\n/** Rerender all enqueued dirty components */\nexport function rerender() {\n\tlet p;\n\twhile ( (p = items.pop()) ) {\n\t\tif (p._dirty) renderComponent(p);\n\t}\n}\n","import { extend } from '../util';\n\n\n/**\n * Check if two nodes are equivalent.\n * @param {import('../dom').OmiElement} node DOM Node to compare\n * @param {import('../vnode').VNode} vnode Virtual DOM node to compare\n * @param {boolean} [hydrating=false] If true, ignores component constructors\n * when comparing.\n * @private\n */\nexport function isSameNodeType(node, vnode, hydrating) {\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\t\treturn node.splitText!==undefined;\n\t}\n\tif (typeof vnode.nodeName==='string') {\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName);\n\t}\n\treturn hydrating || node._componentConstructor===vnode.nodeName;\n}\n\n\n/**\n * Check if an Element has a given nodeName, case-insensitively.\n * @param {import('../dom').OmiElement} node A DOM Element to inspect the name of.\n * @param {string} nodeName Unnormalized name to compare against.\n */\nexport function isNamedNode(node, nodeName) {\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase();\n}\n\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n * @param {import('../vnode').VNode} vnode The VNode to get props for\n * @returns {object} The props to use for this VNode\n */\nexport function getNodeProps(vnode) {\n\tlet props = extend({}, vnode.attributes);\n\tprops.children = vnode.children;\n\n\tlet defaultProps = vnode.nodeName.defaultProps;\n\tif (defaultProps!==undefined) {\n\t\tfor (let i in defaultProps) {\n\t\t\tif (props[i]===undefined) {\n\t\t\t\tprops[i] = defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn props;\n}\n","import { IS_NON_DIMENSIONAL } from '../constants';\nimport { applyRef } from '../util';\nimport options from '../options';\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Omi adds to elements it creates\n * @typedef OmiElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Omi properties\n * @typedef {Element & ElementCSSInlineStyle & OmiElementExtensions} OmiElement\n */\n\n/**\n * Create an element with the given nodeName.\n * @param {string} nodeName The DOM node to create\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\n * namespace.\n * @returns {OmiElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n\t/** @type {OmiElement} */\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);\n\tnode.normalizedNodeName = nodeName;\n\treturn node;\n}\n\n\n/**\n * Remove a child node from its parent if attached.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\n\n/**\n * Set a named attribute on the given Node, with special behavior for some names\n * and event handlers. If `value` is `null`, the attribute/handler will be\n * removed.\n * @param {OmiElement} node An element to mutate\n * @param {string} name The name/key to set, such as an event or attribute name\n * @param {*} old The last value that was set for this name/node pair\n * @param {*} value An attribute value, such as a function to be used as an\n * event handler\n * @param {boolean} isSvg Are we currently diffing inside an svg?\n * @private\n */\nexport function setAccessor(node, name, old, value, isSvg, store) {\n\tif (name==='className') name = 'class';\n\n\n\tif (name==='key') {\n\t\t// ignore\n\t}\n\telse if (name==='ref') {\n\t\tapplyRef(old, null);\n\t\tapplyRef(value, node);\n\t}\n\telse if (name==='class' && !isSvg) {\n\t\tnode.className = value || '';\n\t}\n\telse if (name==='style') {\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\n\t\t\tnode.style.cssText = value || '';\n\t\t}\n\t\tif (value && typeof value==='object') {\n\t\t\tif (typeof old!=='string') {\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = '';\n\t\t\t}\n\t\t\tfor (let i in value) {\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i];\n\t\t\t}\n\t\t}\n\t}\n\telse if (name==='dangerouslySetInnerHTML') {\n\t\tif (value) node.innerHTML = value.__html || '';\n\t}\n\telse if (name[0]=='o' && name[1]=='n') {\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''));\n\t\tname = name.toLowerCase().substring(2);\n\t\tif (value) {\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\telse {\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\t(node._listeners || (node._listeners = {}))[name] = (value && store) ? value.bind(store) : value;\n\t}\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\n\t\t// Attempt to set a DOM property to the given value.\n\t\t// IE & FF throw for certain property-value combinations.\n\t\ttry {\n\t\t\tnode[name] = value==null ? '' : value;\n\t\t} catch (e) { }\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name);\n\t}\n\telse {\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')));\n\t\t// spellcheck is treated differently than all other boolean values and\n\t\t// should not be removed when the value is `false`. See:\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\n\t\tif (value==null || value===false) {\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());\n\t\t\telse node.removeAttribute(name);\n\t\t}\n\t\telse if (typeof value!=='function') {\n\t\t\tif (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);\n\t\t\telse node.setAttribute(name, value);\n\t\t}\n\t}\n}\n\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\treturn this._listeners[e.type](options.event && options.event(e) || e);\n}\n","import { ATTR_KEY } from '../constants';\nimport { isSameNodeType, isNamedNode } from './index';\nimport { buildComponentFromVNode } from './component';\nimport { createNode, setAccessor } from '../dom/index';\nimport { unmountComponent } from './component';\nimport options from '../options';\nimport { applyRef } from '../util';\nimport { removeNode } from '../dom/index';\nimport { addStyleToHead, getCtorName } from '../style'\n\n/**\n * Queue of components that have been mounted and are awaiting componentDidMount\n * @type {Array}\n */\nexport const mounts = [];\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0;\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false;\n\n/** Global flag indicating if the diff is performing hydration */\nlet hydrating = false;\n\n/** Invoke queued componentDidMount lifecycle methods */\nexport function flushMounts() {\n\tlet c;\n\twhile ((c = mounts.shift())) {\n\t\tif (c.constructor.css) {\n addStyleToHead(c.constructor.css, getCtorName(c.constructor))\n\t\t}\n\t\tif(c.props.css){\n\t\t\taddStyleToHead(c.props.css, '_ds'+c.elementId)\n\t\t}\n\t\tif (options.afterMount) options.afterMount(c);\n\t\t//if (c.componentDidMount) c.componentDidMount();\n\t\tif (c.store.installed) c.store.installed()\n\t}\n}\n\n\n/**\n * Apply differences in a given vnode (and it's deep children) to a real DOM Node.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing\n * the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {Element} parent ?\n * @param {boolean} componentRoot ?\n * @returns {import('../dom').OmiElement} The created/mutated element\n * @private\n */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot, store) {\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n\tif (!diffLevel++) {\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined;\n\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\n\t\thydrating = dom!=null && !(ATTR_KEY in dom);\n\t}\n\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot, store);\n\n\t// append the element if its a new parent\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret);\n\n\t// diffLevel being reduced to 0 means we're exiting the diff\n\tif (!--diffLevel) {\n\t\thydrating = false;\n\t\t// invoke queued componentDidMount lifecycle methods\n\t\tif (!componentRoot) flushMounts();\n\t}\n\n\treturn ret;\n}\n\n\n/**\n * Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} [componentRoot] ?\n * @private\n */\nfunction idiff(dom, vnode, context, mountAll, componentRoot, store) {\n\tlet out = dom,\n\t\tprevSvgMode = isSvgMode;\n\n\t// empty values (null, undefined, booleans) render as empty Text nodes\n\tif (vnode==null || typeof vnode==='boolean') vnode = '';\n\n\n\t// Fast case: Strings & Numbers create/update Text nodes.\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\n\t\t// update if it's already a Text node:\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/Omi/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\n\t\t\tif (dom.nodeValue!=vnode) {\n\t\t\t\tdom.nodeValue = vnode;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\n\t\t\tout = document.createTextNode(vnode);\n\t\t\tif (dom) {\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\t\t\t\trecollectNodeTree(dom, true);\n\t\t\t}\n\t\t}\n\n\t\tout[ATTR_KEY] = true;\n\n\t\treturn out;\n\t}\n\n\n\t// If the VNode represents a Component, perform a component diff:\n\tlet vnodeName = vnode.nodeName;\n\tif (typeof vnodeName==='function') {\n\t\treturn buildComponentFromVNode(dom, vnode, context, mountAll);\n\t}\n\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode;\n\n\n\t// If there's no existing element or it's the wrong type, create a new one:\n\tvnodeName = String(vnodeName);\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\n\t\tout = createNode(vnodeName, isSvgMode);\n\n\t\tif (dom) {\n\t\t\t// move children into the replacement node\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild);\n\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\n\t\t\t// recycle the old element (skips non-Element node types)\n\t\t\trecollectNodeTree(dom, true);\n\t\t}\n\t}\n\n\n\tlet fc = out.firstChild,\n\t\tprops = out[ATTR_KEY],\n\t\tvchildren = vnode.children;\n\n\tif (props==null) {\n\t\tprops = out[ATTR_KEY] = {};\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value;\n\t}\n\n\t// Optimization: fast-path for elements containing a single TextNode:\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\n\t\tif (fc.nodeValue!=vchildren[0]) {\n\t\t\tfc.nodeValue = vchildren[0];\n\t\t}\n\t}\n\t// otherwise, if there are existing or new children, diff them:\n\telse if (vchildren && vchildren.length || fc!=null) {\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null, store);\n\t}\n\n\n\t// Apply attributes/props from VNode to the DOM Element:\n\tdiffAttributes(out, vnode.attributes, props, store);\n\n\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\n\tisSvgMode = prevSvgMode;\n\n\treturn out;\n}\n\n\n/**\n * Apply child and attribute changes between a VNode and a DOM Node to the DOM.\n * @param {import('../dom').OmiElement} dom Element whose children should be compared & mutated\n * @param {Array} vchildren Array of VNodes to compare to `dom.childNodes`\n * @param {object} context Implicitly descendant context object (from most\n * recent `getChildContext()`)\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} isHydrating if `true`, consumes externally created elements\n * similar to hydration\n */\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating, store) {\n\tlet originalChildren = dom.childNodes,\n\t\tchildren = [],\n\t\tkeyed = {},\n\t\tkeyedLen = 0,\n\t\tmin = 0,\n\t\tlen = originalChildren.length,\n\t\tchildrenLen = 0,\n\t\tvlen = vchildren ? vchildren.length : 0,\n\t\tj, c, f, vchild, child;\n\n\t// Build up a map of keyed children and an Array of unkeyed children:\n\tif (len!==0) {\n\t\tfor (let i=0; i;\n * }\n * }\n */\n\n let id = 0\n\nexport function Component(props, context) {\n\tthis._dirty = true;\n\tthis.elementId = id++\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.context = context;\n\tthis.store = {}\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.props = props;\n\n\tthis._renderCallbacks = [];\n}\n\n\nextend(Component.prototype, {\n\n\t/**\n\t * Immediately perform a synchronous re-render of the component.\n\t * @param {() => void} callback A function to be called after component is\n\t * \tre-rendered.\n\t * @private\n\t */\n\tupdate(callback) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\trenderComponent(this, FORCE_RENDER);\n\t},\n\n\t/**\n\t * Accepts `props`, and returns a new Virtual DOM tree to build.\n\t * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n\t * @param {object} props Props (eg: JSX attributes) received from parent\n\t * \telement/component\n\t * @param {object} context Context object, as returned by the nearest\n\t * ancestor's `getChildContext()`\n\t * @returns {import('./vnode').VNode | void}\n\t */\n\trender() {}\n\n});\n","/**\n * Virtual DOM Node\n * @typedef VNode\n * @property {string | function} nodeName The string of the DOM node to create or Component constructor to render\n * @property {Array} children The children of node\n * @property {string | number | undefined} key The key used to identify this VNode in a list\n * @property {object} attributes The properties of this VNode\n */\nexport const VNode = function VNode() {};\n","/**\n * @typedef {import('./component').Component} Component\n * @typedef {import('./vnode').VNode} VNode\n */\n\n/**\n * Global options\n * @public\n * @typedef Options\n * @property {boolean} [syncComponentUpdates] If `true`, `prop` changes trigger synchronous component updates. Defaults to true.\n * @property {(vnode: VNode) => void} [vnode] Processes all created VNodes.\n * @property {(component: Component) => void} [afterMount] Hook invoked after a component is mounted.\n * @property {(component: Component) => void} [afterUpdate] Hook invoked after the DOM is updated with a component's latest render.\n * @property {(component: Component) => void} [beforeUnmount] Hook invoked immediately before a component is unmounted.\n * @property {(rerender: function) => void} [debounceRendering] Hook invoked whenever a rerender is requested. Can be used to debounce rerenders.\n * @property {(event: Event) => Event | void} [event] Hook invoked before any Omi event listeners. The return value (if any) replaces the native browser event given to event listeners\n */\n\n/** @type {Options} */\nconst options = {\n\trunTimeComponent: {},\n\tstyleCache: [],\n\tstaticStyleMapping: {}\n};\n\nexport default options;\n","import { diff } from './vdom/diff';\n\n/**\n * Render JSX into a `parent` Element.\n * @param {import('./vnode').VNode} vnode A (JSX) VNode to render\n * @param {import('./dom').OmiElement} parent DOM element to render into\n * @param {import('./dom').OmiElement} [merge] Attempt to re-use an existing DOM tree rooted at\n * `merge`\n * @public\n *\n * @example\n * // render a div into :\n * render(
hello!
, document.body);\n *\n * @example\n * // render a \"Thing\" component into #foo:\n * const Thing = ({ name }) => { name };\n * render(, document.querySelector('#foo'));\n */\nexport function render(vnode, parent, merge) {\n\treturn diff(merge, vnode, {}, false, typeof parent === 'string' ? document.querySelector(parent) : parent, false);\n}\n","import { h, h as createElement } from './h';\nimport { cloneElement } from './clone-element';\nimport { Component } from './component';\nimport { render } from './render';\nimport { rerender } from './render-queue';\nimport options from './options';\n\nfunction createRef() {\n\treturn {};\n}\n\nexport default {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nexport {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nif(typeof window !== 'undefined'){\n\twindow.Omis = {\n\t\th,\n\t\tcreateElement,\n\t\tcloneElement,\n\t\tcreateRef,\n\t\tComponent,\n\t\trender,\n\t\trerender,\n\t\toptions\n\t};\n}\n"]} \ No newline at end of file diff --git a/packages/omis/dist/omis.min.js b/packages/omis/dist/omis.min.js index 8b9299049..97b1f5fc2 100644 --- a/packages/omis/dist/omis.min.js +++ b/packages/omis/dist/omis.min.js @@ -1,2 +1,2 @@ -!function(){"use strict";function e(e){for(var t=0,n=A.styleCache.length;t2;)V.push(arguments[l]);n&&null!=n.children&&(V.length||V.push(n.children),delete n.children);while(V.length)if((r=V.pop())&&void 0!==r.pop)for(l=r.length;l--;)V.push(r[l]);else"boolean"==typeof r&&(r=null),(i="function"!=typeof t)&&(null==r?r="":"number"==typeof r?r+="":"string"!=typeof r&&(i=!1)),i&&o?s[s.length-1]+=r:s===B?s=[r]:s.push(r),o=i;var u=new U;return u.nodeName=t,u.children=s,u.attributes=null==n?{}:n,A.runTimeComponent&&(A.runTimeComponent.constructor.css&&(u.attributes[e(A.runTimeComponent.constructor)]=""),A.runTimeComponent.props&&A.runTimeComponent.props.css&&(u.attributes["_ds"+A.runTimeComponent.elementId]="")),u.key=u.attributes.key,void 0!==A.vnode&&A.vnode(u),u}function i(e,t){for(var n in t)e[n]=t[n];return e}function l(e,t){e&&("function"==typeof e?e(t):e.current=t)}function s(e,t){return r(e.nodeName,i(i({},e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)}function u(e){!e.__d&&(e.__d=!0)&&1==j.push(e)&&(A.debounceRendering||H)(a)}function a(){var e;while(e=j.pop())e.__d&&S(e)}function c(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&p(e,t.nodeName):n||e._componentConstructor===t.nodeName}function p(e,t){return e.normalizedNodeName===t||e.nodeName.toLowerCase()===t.toLowerCase()}function d(e){var t=i({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var o in n)void 0===t[o]&&(t[o]=n[o]);return t}function f(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.normalizedNodeName=e,n}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function m(e,t,n,o,r,i){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)l(n,null),l(o,e);else if("class"!==t||r)if("style"===t){if(o&&"string"!=typeof o&&"string"!=typeof n||(e.style.cssText=o||""),o&&"object"==typeof o){if("string"!=typeof n)for(var s in n)s in o||(e.style[s]="");for(var s in o)e.style[s]="number"==typeof o[s]&&!1===O.test(s)?o[s]+"px":o[s]}}else if("dangerouslySetInnerHTML"===t)o&&(e.innerHTML=o.__html||"");else if("o"==t[0]&&"n"==t[1]){var u=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),o?n||e.addEventListener(t,h,u):e.removeEventListener(t,h,u),(e.__l||(e.__l={}))[t]=o&&i?o.bind(i):o}else if("list"!==t&&"type"!==t&&!r&&t in e){try{e[t]=null==o?"":o}catch(e){}null!=o&&!1!==o||"spellcheck"==t||e.removeAttribute(t)}else{var a=r&&t!==(t=t.replace(/^xlink:?/,""));null==o||!1===o?a?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof o&&(a?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),o):e.setAttribute(t,o))}else e.className=o||""}function h(e){return this.__l[e.type](A.event&&A.event(e)||e)}function v(){var t;while(t=z.shift())t.constructor.css&&o(t.constructor.css,e(t.constructor)),t.props.css&&o(t.props.css,"_ds"+t.elementId),A.afterMount&&A.afterMount(t),t.store.installed&&t.store.installed()}function b(e,t,n,o,r,i,l){D++||(F=null!=r&&void 0!==r.ownerSVGElement,$=null!=e&&!("prevProps"in e));var s=y(e,t,n,o,i,l);return r&&s.parentNode!==r&&r.appendChild(s),--D||($=!1,i||v()),s}function y(e,t,n,o,r,i){var l=e,s=F;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||r)?e.nodeValue!=t&&(e.nodeValue=t):(l=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(l,e),C(e,!0))),l.__p=!0,l;var u=t.nodeName;if("function"==typeof u)return E(e,t,n,o);if(F="svg"===u||"foreignObject"!==u&&F,u+="",(!e||!p(e,u))&&(l=f(u,F),e)){while(e.firstChild)l.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(l,e),C(e,!0)}var a=l.firstChild,c=l.__p,d=t.children;if(null==c){c=l.__p={};for(var _=l.attributes,m=_.length;m--;)c[_[m].name]=_[m].value}return!$&&d&&1===d.length&&"string"==typeof d[0]&&null!=a&&void 0!==a.splitText&&null==a.nextSibling?a.nodeValue!=d[0]&&(a.nodeValue=d[0]):(d&&d.length||null!=a)&&g(l,d,n,o,$||null!=c.dangerouslySetInnerHTML,i),N(l,t.attributes,c,i),F=s,l}function g(e,t,n,o,r,i){var l,s,u,a,p,d=e.childNodes,f=[],m={},h=0,v=0,b=d.length,g=0,w=t?t.length:0;if(0!==b)for(var N=0;N2;)V.push(arguments[l]);n&&null!=n.children&&(V.length||V.push(n.children),delete n.children);while(V.length)if((r=V.pop())&&void 0!==r.pop)for(l=r.length;l--;)V.push(r[l]);else"boolean"==typeof r&&(r=null),(i="function"!=typeof t)&&(null==r?r="":"number"==typeof r?r+="":"string"!=typeof r&&(i=!1)),i&&o?s[s.length-1]+=r:s===B?s=[r]:s.push(r),o=i;var u=new A;return u.nodeName=t,u.children=s,u.attributes=null==n?{}:n,P.runTimeComponent&&(P.runTimeComponent.constructor.css&&(u.attributes[e(P.runTimeComponent.constructor)]=""),P.runTimeComponent.props&&P.runTimeComponent.props.css&&(u.attributes["_ds"+P.runTimeComponent.elementId]="")),u.key=u.attributes.key,void 0!==P.vnode&&P.vnode(u),u}function i(e,t){for(var n in t)e[n]=t[n];return e}function l(e,t){e&&("function"==typeof e?e(t):e.current=t)}function s(e,t){return r(e.nodeName,i(i({},e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)}function u(e){!e.__d&&(e.__d=!0)&&1==j.push(e)&&(P.debounceRendering||H)(a)}function a(){var e;while(e=j.pop())e.__d&&S(e)}function c(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&p(e,t.nodeName):n||e._componentConstructor===t.nodeName}function p(e,t){return e.normalizedNodeName===t||e.nodeName.toLowerCase()===t.toLowerCase()}function d(e){var t=i({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var o in n)void 0===t[o]&&(t[o]=n[o]);return t}function f(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.normalizedNodeName=e,n}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function m(e,t,n,o,r,i){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)l(n,null),l(o,e);else if("class"!==t||r)if("style"===t){if(o&&"string"!=typeof o&&"string"!=typeof n||(e.style.cssText=o||""),o&&"object"==typeof o){if("string"!=typeof n)for(var s in n)s in o||(e.style[s]="");for(var s in o)e.style[s]="number"==typeof o[s]&&!1===O.test(s)?o[s]+"px":o[s]}}else if("dangerouslySetInnerHTML"===t)o&&(e.innerHTML=o.__html||"");else if("o"==t[0]&&"n"==t[1]){var u=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),o?n||e.addEventListener(t,h,u):e.removeEventListener(t,h,u),(e.__l||(e.__l={}))[t]=o&&i?o.bind(i):o}else if("list"!==t&&"type"!==t&&!r&&t in e){try{e[t]=null==o?"":o}catch(e){}null!=o&&!1!==o||"spellcheck"==t||e.removeAttribute(t)}else{var a=r&&t!==(t=t.replace(/^xlink:?/,""));null==o||!1===o?a?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof o&&(a?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),o):e.setAttribute(t,o))}else e.className=o||""}function h(e){return this.__l[e.type](P.event&&P.event(e)||e)}function v(){var t;while(t=z.shift())t.constructor.css&&o(t.constructor.css,e(t.constructor)),t.props.css&&o(t.props.css,"_ds"+t.elementId),P.afterMount&&P.afterMount(t),t.store.installed&&t.store.installed()}function b(e,t,n,o,r,i,l){$++||(q=null!=r&&void 0!==r.ownerSVGElement,G=null!=e&&!("prevProps"in e));var s=y(e,t,n,o,i,l);return r&&s.parentNode!==r&&r.appendChild(s),--$||(G=!1,i||v()),s}function y(e,t,n,o,r,i){var l=e,s=q;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||r)?e.nodeValue!=t&&(e.nodeValue=t):(l=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(l,e),C(e,!0))),l.__p=!0,l;var u=t.nodeName;if("function"==typeof u)return E(e,t,n,o);if(q="svg"===u||"foreignObject"!==u&&q,u+="",(!e||!p(e,u))&&(l=f(u,q),e)){while(e.firstChild)l.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(l,e),C(e,!0)}var a=l.firstChild,c=l.__p,d=t.children;if(null==c){c=l.__p={};for(var _=l.attributes,m=_.length;m--;)c[_[m].name]=_[m].value}return!G&&d&&1===d.length&&"string"==typeof d[0]&&null!=a&&void 0!==a.splitText&&null==a.nextSibling?a.nodeValue!=d[0]&&(a.nodeValue=d[0]):(d&&d.length||null!=a)&&g(l,d,n,o,G||null!=c.dangerouslySetInnerHTML,i),N(l,t.attributes,c,i),q=s,l}function g(e,t,n,o,r,i){var l,s,u,a,p,d=e.childNodes,f=[],m={},h=0,v=0,b=d.length,g=0,w=t?t.length:0;if(0!==b)for(var N=0;N {\n if (typeof g2 === 'undefined') {\n g2 = ''\n }\n\n /* eslint-ignore-next-line */\n if (\n g1.match(\n /^\\s*(@media|\\d+%?|@-webkit-keyframes|@keyframes|to|from|@font-face)/\n )\n ) {\n return g1 + g2 + g3\n }\n\n let appendClass = g1.replace(/(\\s*)$/, '') + prefix + g2\n //let prependClass = prefix + ' ' + g1.trim() + g2;\n\n return appendClass + g3\n //return appendClass + ',' + prependClass + g3;\n })\n\n return css\n}\n\nexport function addStyle(cssText, id) {\n id = id.toLowerCase()\n let ele = document.getElementById(id)\n let head = document.getElementsByTagName('head')[0]\n if (ele && ele.parentNode === head) {\n head.removeChild(ele)\n }\n\n let someThingStyles = document.createElement('style')\n head.appendChild(someThingStyles)\n someThingStyles.setAttribute('type', 'text/css')\n someThingStyles.setAttribute('id', id)\n if (window.ActiveXObject) {\n someThingStyles.styleSheet.cssText = cssText\n } else {\n someThingStyles.textContent = cssText\n }\n}\n\nexport function addStyleToHead(style, attr) {\n\n\tif (!options.staticStyleMapping[attr]) {\n\t\taddStyle(scoper(style, attr), attr)\n\t\toptions.staticStyleMapping[attr] = true\n\t}\n}\n","import { VNode } from './vnode';\nimport options from './options';\nimport {getCtorName} from './style'\n\nconst stack = [];\n\nconst EMPTY_CHILDREN = [];\n\n/**\n * JSX/hyperscript reviver.\n * @see http://jasonformat.com/wtf-is-jsx\n * Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0\n *\n * Note: this is exported as both `h()` and `createElement()` for compatibility\n * reasons.\n *\n * Creates a VNode (virtual DOM element). A tree of VNodes can be used as a\n * lightweight representation of the structure of a DOM tree. This structure can\n * be realized by recursively comparing it against the current _actual_ DOM\n * structure, and applying only the differences.\n *\n * `h()`/`createElement()` accepts an element name, a list of attributes/props,\n * and optionally children to append to the element.\n *\n * @example The following DOM tree\n *\n * `
Hello!
`\n *\n * can be constructed using this function as:\n *\n * `h('div', { id: 'foo', name : 'bar' }, 'Hello!');`\n *\n * @param {string | function} nodeName An element name. Ex: `div`, `a`, `span`, etc.\n * @param {object | null} attributes Any attributes/props to set on the created element.\n * @param {VNode[]} [rest] Additional arguments are taken to be children to\n * append. Can be infinitely nested Arrays.\n *\n * @public\n */\nexport function h(nodeName, attributes) {\n\tlet children=EMPTY_CHILDREN, lastSimple, child, simple, i;\n\tfor (i=arguments.length; i-- > 2; ) {\n\t\tstack.push(arguments[i]);\n\t}\n\tif (attributes && attributes.children!=null) {\n\t\tif (!stack.length) stack.push(attributes.children);\n\t\tdelete attributes.children;\n\t}\n\twhile (stack.length) {\n\t\tif ((child = stack.pop()) && child.pop!==undefined) {\n\t\t\tfor (i=child.length; i--; ) stack.push(child[i]);\n\t\t}\n\t\telse {\n\t\t\tif (typeof child==='boolean') child = null;\n\n\t\t\tif ((simple = typeof nodeName!=='function')) {\n\t\t\t\tif (child==null) child = '';\n\t\t\t\telse if (typeof child==='number') child = String(child);\n\t\t\t\telse if (typeof child!=='string') simple = false;\n\t\t\t}\n\n\t\t\tif (simple && lastSimple) {\n\t\t\t\tchildren[children.length-1] += child;\n\t\t\t}\n\t\t\telse if (children===EMPTY_CHILDREN) {\n\t\t\t\tchildren = [child];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tchildren.push(child);\n\t\t\t}\n\n\t\t\tlastSimple = simple;\n\t\t}\n\t}\n\n\tlet p = new VNode();\n\tp.nodeName = nodeName;\n\tp.children = children;\n\tp.attributes = attributes==null ? {} : attributes;\n\tif(options.runTimeComponent){\n\t\tif(options.runTimeComponent.constructor.css){\n\t\t\tp.attributes[getCtorName(options.runTimeComponent.constructor)] = ''\n\t\t}\n\t\tif(options.runTimeComponent.props && options.runTimeComponent.props.css){\n\t\t\tp.attributes['_ds'+options.runTimeComponent.elementId] = ''\n\t\t}\n\t}\n\n\tp.key = p.attributes.key;\n\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\n\tif (options.vnode!==undefined) options.vnode(p);\n\n\treturn p;\n}\n","/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function extend(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\n}\n\n/** Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} [ref=null]\n * @param {any} [value]\n */\nexport function applyRef(ref, value) {\n\tif (ref) {\n\t\tif (typeof ref=='function') ref(value);\n\t\telse ref.current = value;\n\t}\n}\n\n/**\n * Call a function asynchronously, as soon as possible. Makes\n * use of HTML Promise to schedule the callback if available,\n * otherwise falling back to `setTimeout` (mainly for IE<11).\n * @type {(callback: function) => void}\n */\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;\n","import { extend } from './util';\nimport { h } from './h';\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its\n * children.\n * @param {import('./vnode').VNode} vnode The virtual DOM element to clone\n * @param {object} props Attributes/props to add when cloning\n * @param {Array} [rest] Any additional arguments will be used as replacement\n * children.\n */\nexport function cloneElement(vnode, props) {\n\treturn h(\n\t\tvnode.nodeName,\n\t\textend(extend({}, vnode.attributes), props),\n\t\targuments.length>2 ? [].slice.call(arguments, 2) : vnode.children\n\t);\n}\n","// render modes\n\n/** Do not re-render a component */\nexport const NO_RENDER = 0;\n/** Synchronously re-render a component and its children */\nexport const SYNC_RENDER = 1;\n/** Synchronously re-render a component, even if its lifecycle methods attempt to prevent it. */\nexport const FORCE_RENDER = 2;\n/** Queue asynchronous re-render of a component and it's children */\nexport const ASYNC_RENDER = 3;\n\n\nexport const ATTR_KEY = 'prevProps';\n\n/** DOM properties that should NOT have \"px\" added when numeric */\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;\n\n","import options from './options';\nimport { defer } from './util';\nimport { renderComponent } from './vdom/component';\n\n/**\n * Managed queue of dirty components to be re-rendered\n * @type {Array}\n */\nlet items = [];\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./component').Component} component The component to rerender\n */\nexport function enqueueRender(component) {\n\tif (!component._dirty && (component._dirty = true) && items.push(component)==1) {\n\t\t(options.debounceRendering || defer)(rerender);\n\t}\n}\n\n/** Rerender all enqueued dirty components */\nexport function rerender() {\n\tlet p;\n\twhile ( (p = items.pop()) ) {\n\t\tif (p._dirty) renderComponent(p);\n\t}\n}\n","import { extend } from '../util';\n\n\n/**\n * Check if two nodes are equivalent.\n * @param {import('../dom').OmiElement} node DOM Node to compare\n * @param {import('../vnode').VNode} vnode Virtual DOM node to compare\n * @param {boolean} [hydrating=false] If true, ignores component constructors\n * when comparing.\n * @private\n */\nexport function isSameNodeType(node, vnode, hydrating) {\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\t\treturn node.splitText!==undefined;\n\t}\n\tif (typeof vnode.nodeName==='string') {\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName);\n\t}\n\treturn hydrating || node._componentConstructor===vnode.nodeName;\n}\n\n\n/**\n * Check if an Element has a given nodeName, case-insensitively.\n * @param {import('../dom').OmiElement} node A DOM Element to inspect the name of.\n * @param {string} nodeName Unnormalized name to compare against.\n */\nexport function isNamedNode(node, nodeName) {\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase();\n}\n\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n * @param {import('../vnode').VNode} vnode The VNode to get props for\n * @returns {object} The props to use for this VNode\n */\nexport function getNodeProps(vnode) {\n\tlet props = extend({}, vnode.attributes);\n\tprops.children = vnode.children;\n\n\tlet defaultProps = vnode.nodeName.defaultProps;\n\tif (defaultProps!==undefined) {\n\t\tfor (let i in defaultProps) {\n\t\t\tif (props[i]===undefined) {\n\t\t\t\tprops[i] = defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn props;\n}\n","import { IS_NON_DIMENSIONAL } from '../constants';\nimport { applyRef } from '../util';\nimport options from '../options';\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Omi adds to elements it creates\n * @typedef OmiElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Omi properties\n * @typedef {Element & ElementCSSInlineStyle & OmiElementExtensions} OmiElement\n */\n\n/**\n * Create an element with the given nodeName.\n * @param {string} nodeName The DOM node to create\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\n * namespace.\n * @returns {OmiElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n\t/** @type {OmiElement} */\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);\n\tnode.normalizedNodeName = nodeName;\n\treturn node;\n}\n\n\n/**\n * Remove a child node from its parent if attached.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\n\n/**\n * Set a named attribute on the given Node, with special behavior for some names\n * and event handlers. If `value` is `null`, the attribute/handler will be\n * removed.\n * @param {OmiElement} node An element to mutate\n * @param {string} name The name/key to set, such as an event or attribute name\n * @param {*} old The last value that was set for this name/node pair\n * @param {*} value An attribute value, such as a function to be used as an\n * event handler\n * @param {boolean} isSvg Are we currently diffing inside an svg?\n * @private\n */\nexport function setAccessor(node, name, old, value, isSvg, store) {\n\tif (name==='className') name = 'class';\n\n\n\tif (name==='key') {\n\t\t// ignore\n\t}\n\telse if (name==='ref') {\n\t\tapplyRef(old, null);\n\t\tapplyRef(value, node);\n\t}\n\telse if (name==='class' && !isSvg) {\n\t\tnode.className = value || '';\n\t}\n\telse if (name==='style') {\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\n\t\t\tnode.style.cssText = value || '';\n\t\t}\n\t\tif (value && typeof value==='object') {\n\t\t\tif (typeof old!=='string') {\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = '';\n\t\t\t}\n\t\t\tfor (let i in value) {\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i];\n\t\t\t}\n\t\t}\n\t}\n\telse if (name==='dangerouslySetInnerHTML') {\n\t\tif (value) node.innerHTML = value.__html || '';\n\t}\n\telse if (name[0]=='o' && name[1]=='n') {\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''));\n\t\tname = name.toLowerCase().substring(2);\n\t\tif (value) {\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\telse {\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\t(node._listeners || (node._listeners = {}))[name] = (value && store) ? value.bind(store) : value;\n\t}\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\n\t\t// Attempt to set a DOM property to the given value.\n\t\t// IE & FF throw for certain property-value combinations.\n\t\ttry {\n\t\t\tnode[name] = value==null ? '' : value;\n\t\t} catch (e) { }\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name);\n\t}\n\telse {\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')));\n\t\t// spellcheck is treated differently than all other boolean values and\n\t\t// should not be removed when the value is `false`. See:\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\n\t\tif (value==null || value===false) {\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());\n\t\t\telse node.removeAttribute(name);\n\t\t}\n\t\telse if (typeof value!=='function') {\n\t\t\tif (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);\n\t\t\telse node.setAttribute(name, value);\n\t\t}\n\t}\n}\n\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\treturn this._listeners[e.type](options.event && options.event(e) || e);\n}\n","import { ATTR_KEY } from '../constants';\nimport { isSameNodeType, isNamedNode } from './index';\nimport { buildComponentFromVNode } from './component';\nimport { createNode, setAccessor } from '../dom/index';\nimport { unmountComponent } from './component';\nimport options from '../options';\nimport { applyRef } from '../util';\nimport { removeNode } from '../dom/index';\nimport { addStyleToHead, getCtorName } from '../style'\n\n/**\n * Queue of components that have been mounted and are awaiting componentDidMount\n * @type {Array}\n */\nexport const mounts = [];\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0;\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false;\n\n/** Global flag indicating if the diff is performing hydration */\nlet hydrating = false;\n\n/** Invoke queued componentDidMount lifecycle methods */\nexport function flushMounts() {\n\tlet c;\n\twhile ((c = mounts.shift())) {\n\t\tif (c.constructor.css) {\n addStyleToHead(c.constructor.css, getCtorName(c.constructor))\n\t\t}\n\t\tif(c.props.css){\n\t\t\taddStyleToHead(c.props.css, '_ds'+c.elementId)\n\t\t}\n\t\tif (options.afterMount) options.afterMount(c);\n\t\t//if (c.componentDidMount) c.componentDidMount();\n\t\tif (c.store.installed) c.store.installed()\n\t}\n}\n\n\n/**\n * Apply differences in a given vnode (and it's deep children) to a real DOM Node.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing\n * the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {Element} parent ?\n * @param {boolean} componentRoot ?\n * @returns {import('../dom').OmiElement} The created/mutated element\n * @private\n */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot, store) {\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n\tif (!diffLevel++) {\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined;\n\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\n\t\thydrating = dom!=null && !(ATTR_KEY in dom);\n\t}\n\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot, store);\n\n\t// append the element if its a new parent\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret);\n\n\t// diffLevel being reduced to 0 means we're exiting the diff\n\tif (!--diffLevel) {\n\t\thydrating = false;\n\t\t// invoke queued componentDidMount lifecycle methods\n\t\tif (!componentRoot) flushMounts();\n\t}\n\n\treturn ret;\n}\n\n\n/**\n * Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} [componentRoot] ?\n * @private\n */\nfunction idiff(dom, vnode, context, mountAll, componentRoot, store) {\n\tlet out = dom,\n\t\tprevSvgMode = isSvgMode;\n\n\t// empty values (null, undefined, booleans) render as empty Text nodes\n\tif (vnode==null || typeof vnode==='boolean') vnode = '';\n\n\n\t// Fast case: Strings & Numbers create/update Text nodes.\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\n\t\t// update if it's already a Text node:\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/Omi/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\n\t\t\tif (dom.nodeValue!=vnode) {\n\t\t\t\tdom.nodeValue = vnode;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\n\t\t\tout = document.createTextNode(vnode);\n\t\t\tif (dom) {\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\t\t\t\trecollectNodeTree(dom, true);\n\t\t\t}\n\t\t}\n\n\t\tout[ATTR_KEY] = true;\n\n\t\treturn out;\n\t}\n\n\n\t// If the VNode represents a Component, perform a component diff:\n\tlet vnodeName = vnode.nodeName;\n\tif (typeof vnodeName==='function') {\n\t\treturn buildComponentFromVNode(dom, vnode, context, mountAll);\n\t}\n\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode;\n\n\n\t// If there's no existing element or it's the wrong type, create a new one:\n\tvnodeName = String(vnodeName);\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\n\t\tout = createNode(vnodeName, isSvgMode);\n\n\t\tif (dom) {\n\t\t\t// move children into the replacement node\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild);\n\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\n\t\t\t// recycle the old element (skips non-Element node types)\n\t\t\trecollectNodeTree(dom, true);\n\t\t}\n\t}\n\n\n\tlet fc = out.firstChild,\n\t\tprops = out[ATTR_KEY],\n\t\tvchildren = vnode.children;\n\n\tif (props==null) {\n\t\tprops = out[ATTR_KEY] = {};\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value;\n\t}\n\n\t// Optimization: fast-path for elements containing a single TextNode:\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\n\t\tif (fc.nodeValue!=vchildren[0]) {\n\t\t\tfc.nodeValue = vchildren[0];\n\t\t}\n\t}\n\t// otherwise, if there are existing or new children, diff them:\n\telse if (vchildren && vchildren.length || fc!=null) {\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null, store);\n\t}\n\n\n\t// Apply attributes/props from VNode to the DOM Element:\n\tdiffAttributes(out, vnode.attributes, props, store);\n\n\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\n\tisSvgMode = prevSvgMode;\n\n\treturn out;\n}\n\n\n/**\n * Apply child and attribute changes between a VNode and a DOM Node to the DOM.\n * @param {import('../dom').OmiElement} dom Element whose children should be compared & mutated\n * @param {Array} vchildren Array of VNodes to compare to `dom.childNodes`\n * @param {object} context Implicitly descendant context object (from most\n * recent `getChildContext()`)\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} isHydrating if `true`, consumes externally created elements\n * similar to hydration\n */\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating, store) {\n\tlet originalChildren = dom.childNodes,\n\t\tchildren = [],\n\t\tkeyed = {},\n\t\tkeyedLen = 0,\n\t\tmin = 0,\n\t\tlen = originalChildren.length,\n\t\tchildrenLen = 0,\n\t\tvlen = vchildren ? vchildren.length : 0,\n\t\tj, c, f, vchild, child;\n\n\t// Build up a map of keyed children and an Array of unkeyed children:\n\tif (len!==0) {\n\t\tfor (let i=0; i;\n * }\n * }\n */\n\n let id = 0\n\nexport function Component(props, context) {\n\tthis._dirty = true;\n\tthis.elementId = id++\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.context = context;\n\tthis.store = {}\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.props = props;\n\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.state = this.state || {};\n\n\tthis._renderCallbacks = [];\n}\n\n\nextend(Component.prototype, {\n\n\t/**\n\t * Immediately perform a synchronous re-render of the component.\n\t * @param {() => void} callback A function to be called after component is\n\t * \tre-rendered.\n\t * @private\n\t */\n\tupdate(callback) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\trenderComponent(this, FORCE_RENDER);\n\t},\n\n\t/**\n\t * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n\t * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n\t * @param {object} props Props (eg: JSX attributes) received from parent\n\t * \telement/component\n\t * @param {object} state The component's current state\n\t * @param {object} context Context object, as returned by the nearest\n\t * ancestor's `getChildContext()`\n\t * @returns {import('./vnode').VNode | void}\n\t */\n\trender() {}\n\n});\n","/**\n * Virtual DOM Node\n * @typedef VNode\n * @property {string | function} nodeName The string of the DOM node to create or Component constructor to render\n * @property {Array} children The children of node\n * @property {string | number | undefined} key The key used to identify this VNode in a list\n * @property {object} attributes The properties of this VNode\n */\nexport const VNode = function VNode() {};\n","/**\n * @typedef {import('./component').Component} Component\n * @typedef {import('./vnode').VNode} VNode\n */\n\n/**\n * Global options\n * @public\n * @typedef Options\n * @property {boolean} [syncComponentUpdates] If `true`, `prop` changes trigger synchronous component updates. Defaults to true.\n * @property {(vnode: VNode) => void} [vnode] Processes all created VNodes.\n * @property {(component: Component) => void} [afterMount] Hook invoked after a component is mounted.\n * @property {(component: Component) => void} [afterUpdate] Hook invoked after the DOM is updated with a component's latest render.\n * @property {(component: Component) => void} [beforeUnmount] Hook invoked immediately before a component is unmounted.\n * @property {(rerender: function) => void} [debounceRendering] Hook invoked whenever a rerender is requested. Can be used to debounce rerenders.\n * @property {(event: Event) => Event | void} [event] Hook invoked before any Omi event listeners. The return value (if any) replaces the native browser event given to event listeners\n */\n\n/** @type {Options} */\nconst options = {\n\trunTimeComponent: {},\n\tstyleCache: [],\n\tstaticStyleMapping: {}\n};\n\nexport default options;\n","import { diff } from './vdom/diff';\n\n/**\n * Render JSX into a `parent` Element.\n * @param {import('./vnode').VNode} vnode A (JSX) VNode to render\n * @param {import('./dom').OmiElement} parent DOM element to render into\n * @param {import('./dom').OmiElement} [merge] Attempt to re-use an existing DOM tree rooted at\n * `merge`\n * @public\n *\n * @example\n * // render a div into :\n * render(
hello!
, document.body);\n *\n * @example\n * // render a \"Thing\" component into #foo:\n * const Thing = ({ name }) => { name };\n * render(, document.querySelector('#foo'));\n */\nexport function render(vnode, parent, merge) {\n\treturn diff(merge, vnode, {}, false, typeof parent === 'string' ? document.querySelector(parent) : parent, false);\n}\n","import { h, h as createElement } from './h';\nimport { cloneElement } from './clone-element';\nimport { Component } from './component';\nimport { render } from './render';\nimport { rerender } from './render-queue';\nimport options from './options';\n\nfunction createRef() {\n\treturn {};\n}\n\nexport default {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nexport {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nif(typeof window !== 'undefined'){\n\twindow.Omis = {\n\t\th,\n\t\tcreateElement,\n\t\tcloneElement,\n\t\tcreateRef,\n\t\tComponent,\n\t\trender,\n\t\trerender,\n\t\toptions\n\t};\n}\n"]} \ No newline at end of file +{"version":3,"sources":["../src/style.js","../src/h.js","../src/util.js","../src/clone-element.js","../src/constants.js","../src/render-queue.js","../src/vdom/index.js","../src/dom/index.js","../src/vdom/diff.js","../src/vdom/component-recycler.js","../src/vdom/component.js","../src/component.js","../src/vnode.js","../src/options.js","../src/render.js","../src/omis.js"],"names":["getCtorName","ctor","i","len","options","styleCache","length","item","attrName","styleId","push","scoper","css","prefix","toLowerCase","replace","RegExp","g0","g1","g2","g3","match","addStyle","cssText","id","ele","document","getElementById","head","getElementsByTagName","parentNode","removeChild","someThingStyles","createElement","appendChild","setAttribute","window","ActiveXObject","styleSheet","textContent","addStyleToHead","style","attr","staticStyleMapping","nodeName","attributes","lastSimple","child","simple","children","EMPTY_CHILDREN","arguments","stack","pop","String","p","VNode","runTimeComponent","constructor","props","elementId","key","vnode","extend","obj","applyRef","ref","value","current","cloneElement","h","slice","call","enqueueRender","component","IS_NON_DIMENSIONAL","_dirty","items","rerender","node","hydrating","renderComponent","splitText","undefined","normalizedNodeName","isNamedNode","defaultProps","createNode","name","old","isSvg","test","__html","substring","eventProxy","useCapture","removeEventListener","bind","store","removeAttribute","ns","addEventListener","_listeners","setAttributeNS","removeAttributeNS","event","e","mounts","c","afterMount","parent","dom","mountAll","componentRoot","diffLevel","isSvgMode","flushMounts","out","prevSvgMode","idiff","createTextNode","replaceChild","recollectNodeTree","__p","nodeValue","vnodeName","buildComponentFromVNode","firstChild","vchildren","fc","ATTR_KEY","innerDiffNode","dangerouslySetInnerHTML","context","isHydrating","j","f","vchild","originalChildren","childNodes","keyed","keyedLen","min","childrenLen","_child","_component","__key","vlen","trim","removeNode","insertBefore","unmountOnly","unmountComponent","removeChildren","next","previousSibling","setAccessor","diffAttributes","attrs","inst","Ctor","recyclerComponents","nextBase","this","setComponentProps","renderMode","doRender","_disable","__ref","receiveProps","base","prevContext","prevProps","syncComponentUpdates","rendered","previousProps","previousContext","isUpdate","initialBase","skip","beforeUpdate","snapshot","__needUpdate_","beforeRender","getSnapshotBeforeUpdate","childComponent","childProps","getNodeProps","toUnmount","createComponent","_parentComponent","cbase","baseParent","initialChildComponent","componentRef","t","_componentConstructor","afterUpdate","_renderCallbacks","isChild","originalComponent","isDirectOwner","isOwner","oldDom","beforeUnmount","uninstall","inner","Component","defer","Promise","resolve","then","setTimeout","FORCE_RENDER","update","callback","render","diff","createRef","module","exports","Omis","self"],"mappings":"wBAIO,SAASA,GAAYC,GAC1B,IAAK,GAAIC,GAAI,EAAGC,EAAMC,EAAQC,WAAWC,OAAQJ,EAAIC,EAAKD,IAAK,CAC7D,GAAIK,GAAOH,EAAQC,WAAWH,EAE9B,IAAIK,EAAKN,OAASA,EAChB,MAAOM,GAAKC,SAIhB,GAAIA,GAAW,MAAQC,CAIvB,OAHAL,GAAQC,WAAWK,MAAOT,KAAAA,EAAMO,SAAAA,IAChCC,IAEOD,EAIF,QAASG,GAATC,EAAqBC,GAoC1B,MAnCAA,GAAS,IAAMA,EAAOC,cAAgB,IAEtCF,EAAMA,EAAIG,QAAQ,kCAAkC,IAYpDH,EAAMA,EAAIG,QAVKC,OAAO,kDAAoD,KAUpD,SAACC,EAAIC,EAAIC,EAAIC,GAMjC,WALA,KAAWD,IACTA,EAAK,IAKLD,EAAGG,MACD,uEAGKH,EAAKC,EAAKC,EAGDF,EAAGH,QAAQ,SAAU,IAAMF,EAASM,EAGjCC,IAOlB,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) {\n for (let i = 0, len = options.styleCache.length; i < len; i++) {\n let item = options.styleCache[i]\n\n if (item.ctor === ctor) {\n return item.attrName\n }\n }\n\n let attrName = '_ss' + styleId\n options.styleCache.push({ ctor, attrName })\n styleId++\n\n return attrName\n}\n\n// many thanks to https://github.com/thomaspark/scoper/\nexport function scoper(css, prefix) {\n prefix = '[' + prefix.toLowerCase() + ']'\n // https://www.w3.org/TR/css-syntax-3/#lexical\n css = css.replace(/\\/\\*[^*]*\\*+([^/][^*]*\\*+)*\\//g, '')\n // eslint-disable-next-line\n let re = new RegExp('([^\\r\\n,{}:]+)(:[^\\r\\n,{}]+)?(,(?=[^{}]*{)|\\s*{)', 'g')\n /**\n * Example:\n *\n * .classname::pesudo { color:red }\n *\n * g1 is normal selector `.classname`\n * g2 is pesudo class or pesudo element\n * g3 is the suffix\n */\n css = css.replace(re, (g0, g1, g2, g3) => {\n if (typeof g2 === 'undefined') {\n g2 = ''\n }\n\n /* eslint-ignore-next-line */\n if (\n g1.match(\n /^\\s*(@media|\\d+%?|@-webkit-keyframes|@keyframes|to|from|@font-face)/\n )\n ) {\n return g1 + g2 + g3\n }\n\n let appendClass = g1.replace(/(\\s*)$/, '') + prefix + g2\n //let prependClass = prefix + ' ' + g1.trim() + g2;\n\n return appendClass + g3\n //return appendClass + ',' + prependClass + g3;\n })\n\n return css\n}\n\nexport function addStyle(cssText, id) {\n id = id.toLowerCase()\n let ele = document.getElementById(id)\n let head = document.getElementsByTagName('head')[0]\n if (ele && ele.parentNode === head) {\n head.removeChild(ele)\n }\n\n let someThingStyles = document.createElement('style')\n head.appendChild(someThingStyles)\n someThingStyles.setAttribute('type', 'text/css')\n someThingStyles.setAttribute('id', id)\n if (window.ActiveXObject) {\n someThingStyles.styleSheet.cssText = cssText\n } else {\n someThingStyles.textContent = cssText\n }\n}\n\nexport function addStyleToHead(style, attr) {\n\n\tif (!options.staticStyleMapping[attr]) {\n\t\taddStyle(scoper(style, attr), attr)\n\t\toptions.staticStyleMapping[attr] = true\n\t}\n}\n","import { VNode } from './vnode';\nimport options from './options';\nimport {getCtorName} from './style'\n\nconst stack = [];\n\nconst EMPTY_CHILDREN = [];\n\n/**\n * JSX/hyperscript reviver.\n * @see http://jasonformat.com/wtf-is-jsx\n * Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0\n *\n * Note: this is exported as both `h()` and `createElement()` for compatibility\n * reasons.\n *\n * Creates a VNode (virtual DOM element). A tree of VNodes can be used as a\n * lightweight representation of the structure of a DOM tree. This structure can\n * be realized by recursively comparing it against the current _actual_ DOM\n * structure, and applying only the differences.\n *\n * `h()`/`createElement()` accepts an element name, a list of attributes/props,\n * and optionally children to append to the element.\n *\n * @example The following DOM tree\n *\n * `
Hello!
`\n *\n * can be constructed using this function as:\n *\n * `h('div', { id: 'foo', name : 'bar' }, 'Hello!');`\n *\n * @param {string | function} nodeName An element name. Ex: `div`, `a`, `span`, etc.\n * @param {object | null} attributes Any attributes/props to set on the created element.\n * @param {VNode[]} [rest] Additional arguments are taken to be children to\n * append. Can be infinitely nested Arrays.\n *\n * @public\n */\nexport function h(nodeName, attributes) {\n\tlet children=EMPTY_CHILDREN, lastSimple, child, simple, i;\n\tfor (i=arguments.length; i-- > 2; ) {\n\t\tstack.push(arguments[i]);\n\t}\n\tif (attributes && attributes.children!=null) {\n\t\tif (!stack.length) stack.push(attributes.children);\n\t\tdelete attributes.children;\n\t}\n\twhile (stack.length) {\n\t\tif ((child = stack.pop()) && child.pop!==undefined) {\n\t\t\tfor (i=child.length; i--; ) stack.push(child[i]);\n\t\t}\n\t\telse {\n\t\t\tif (typeof child==='boolean') child = null;\n\n\t\t\tif ((simple = typeof nodeName!=='function')) {\n\t\t\t\tif (child==null) child = '';\n\t\t\t\telse if (typeof child==='number') child = String(child);\n\t\t\t\telse if (typeof child!=='string') simple = false;\n\t\t\t}\n\n\t\t\tif (simple && lastSimple) {\n\t\t\t\tchildren[children.length-1] += child;\n\t\t\t}\n\t\t\telse if (children===EMPTY_CHILDREN) {\n\t\t\t\tchildren = [child];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tchildren.push(child);\n\t\t\t}\n\n\t\t\tlastSimple = simple;\n\t\t}\n\t}\n\n\tlet p = new VNode();\n\tp.nodeName = nodeName;\n\tp.children = children;\n\tp.attributes = attributes==null ? {} : attributes;\n\tif(options.runTimeComponent){\n\t\tif(options.runTimeComponent.constructor.css){\n\t\t\tp.attributes[getCtorName(options.runTimeComponent.constructor)] = ''\n\t\t}\n\t\tif(options.runTimeComponent.props && options.runTimeComponent.props.css){\n\t\t\tp.attributes['_ds'+options.runTimeComponent.elementId] = ''\n\t\t}\n\t}\n\n\tp.key = p.attributes.key;\n\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\n\tif (options.vnode!==undefined) options.vnode(p);\n\n\treturn p;\n}\n","/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function extend(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\n}\n\n/** Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} [ref=null]\n * @param {any} [value]\n */\nexport function applyRef(ref, value) {\n\tif (ref) {\n\t\tif (typeof ref=='function') ref(value);\n\t\telse ref.current = value;\n\t}\n}\n\n/**\n * Call a function asynchronously, as soon as possible. Makes\n * use of HTML Promise to schedule the callback if available,\n * otherwise falling back to `setTimeout` (mainly for IE<11).\n * @type {(callback: function) => void}\n */\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;\n","import { extend } from './util';\nimport { h } from './h';\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its\n * children.\n * @param {import('./vnode').VNode} vnode The virtual DOM element to clone\n * @param {object} props Attributes/props to add when cloning\n * @param {Array} [rest] Any additional arguments will be used as replacement\n * children.\n */\nexport function cloneElement(vnode, props) {\n\treturn h(\n\t\tvnode.nodeName,\n\t\textend(extend({}, vnode.attributes), props),\n\t\targuments.length>2 ? [].slice.call(arguments, 2) : vnode.children\n\t);\n}\n","// render modes\n\n/** Do not re-render a component */\nexport const NO_RENDER = 0;\n/** Synchronously re-render a component and its children */\nexport const SYNC_RENDER = 1;\n/** Synchronously re-render a component, even if its lifecycle methods attempt to prevent it. */\nexport const FORCE_RENDER = 2;\n/** Queue asynchronous re-render of a component and it's children */\nexport const ASYNC_RENDER = 3;\n\n\nexport const ATTR_KEY = 'prevProps';\n\n/** DOM properties that should NOT have \"px\" added when numeric */\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;\n\n","import options from './options';\nimport { defer } from './util';\nimport { renderComponent } from './vdom/component';\n\n/**\n * Managed queue of dirty components to be re-rendered\n * @type {Array}\n */\nlet items = [];\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./component').Component} component The component to rerender\n */\nexport function enqueueRender(component) {\n\tif (!component._dirty && (component._dirty = true) && items.push(component)==1) {\n\t\t(options.debounceRendering || defer)(rerender);\n\t}\n}\n\n/** Rerender all enqueued dirty components */\nexport function rerender() {\n\tlet p;\n\twhile ( (p = items.pop()) ) {\n\t\tif (p._dirty) renderComponent(p);\n\t}\n}\n","import { extend } from '../util';\n\n\n/**\n * Check if two nodes are equivalent.\n * @param {import('../dom').OmiElement} node DOM Node to compare\n * @param {import('../vnode').VNode} vnode Virtual DOM node to compare\n * @param {boolean} [hydrating=false] If true, ignores component constructors\n * when comparing.\n * @private\n */\nexport function isSameNodeType(node, vnode, hydrating) {\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\t\treturn node.splitText!==undefined;\n\t}\n\tif (typeof vnode.nodeName==='string') {\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName);\n\t}\n\treturn hydrating || node._componentConstructor===vnode.nodeName;\n}\n\n\n/**\n * Check if an Element has a given nodeName, case-insensitively.\n * @param {import('../dom').OmiElement} node A DOM Element to inspect the name of.\n * @param {string} nodeName Unnormalized name to compare against.\n */\nexport function isNamedNode(node, nodeName) {\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase();\n}\n\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n * @param {import('../vnode').VNode} vnode The VNode to get props for\n * @returns {object} The props to use for this VNode\n */\nexport function getNodeProps(vnode) {\n\tlet props = extend({}, vnode.attributes);\n\tprops.children = vnode.children;\n\n\tlet defaultProps = vnode.nodeName.defaultProps;\n\tif (defaultProps!==undefined) {\n\t\tfor (let i in defaultProps) {\n\t\t\tif (props[i]===undefined) {\n\t\t\t\tprops[i] = defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn props;\n}\n","import { IS_NON_DIMENSIONAL } from '../constants';\nimport { applyRef } from '../util';\nimport options from '../options';\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Omi adds to elements it creates\n * @typedef OmiElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Omi properties\n * @typedef {Element & ElementCSSInlineStyle & OmiElementExtensions} OmiElement\n */\n\n/**\n * Create an element with the given nodeName.\n * @param {string} nodeName The DOM node to create\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\n * namespace.\n * @returns {OmiElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n\t/** @type {OmiElement} */\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);\n\tnode.normalizedNodeName = nodeName;\n\treturn node;\n}\n\n\n/**\n * Remove a child node from its parent if attached.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\n\n/**\n * Set a named attribute on the given Node, with special behavior for some names\n * and event handlers. If `value` is `null`, the attribute/handler will be\n * removed.\n * @param {OmiElement} node An element to mutate\n * @param {string} name The name/key to set, such as an event or attribute name\n * @param {*} old The last value that was set for this name/node pair\n * @param {*} value An attribute value, such as a function to be used as an\n * event handler\n * @param {boolean} isSvg Are we currently diffing inside an svg?\n * @private\n */\nexport function setAccessor(node, name, old, value, isSvg, store) {\n\tif (name==='className') name = 'class';\n\n\n\tif (name==='key') {\n\t\t// ignore\n\t}\n\telse if (name==='ref') {\n\t\tapplyRef(old, null);\n\t\tapplyRef(value, node);\n\t}\n\telse if (name==='class' && !isSvg) {\n\t\tnode.className = value || '';\n\t}\n\telse if (name==='style') {\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\n\t\t\tnode.style.cssText = value || '';\n\t\t}\n\t\tif (value && typeof value==='object') {\n\t\t\tif (typeof old!=='string') {\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = '';\n\t\t\t}\n\t\t\tfor (let i in value) {\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i];\n\t\t\t}\n\t\t}\n\t}\n\telse if (name==='dangerouslySetInnerHTML') {\n\t\tif (value) node.innerHTML = value.__html || '';\n\t}\n\telse if (name[0]=='o' && name[1]=='n') {\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''));\n\t\tname = name.toLowerCase().substring(2);\n\t\tif (value) {\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\telse {\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\t(node._listeners || (node._listeners = {}))[name] = (value && store) ? value.bind(store) : value;\n\t}\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\n\t\t// Attempt to set a DOM property to the given value.\n\t\t// IE & FF throw for certain property-value combinations.\n\t\ttry {\n\t\t\tnode[name] = value==null ? '' : value;\n\t\t} catch (e) { }\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name);\n\t}\n\telse {\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')));\n\t\t// spellcheck is treated differently than all other boolean values and\n\t\t// should not be removed when the value is `false`. See:\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\n\t\tif (value==null || value===false) {\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());\n\t\t\telse node.removeAttribute(name);\n\t\t}\n\t\telse if (typeof value!=='function') {\n\t\t\tif (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);\n\t\t\telse node.setAttribute(name, value);\n\t\t}\n\t}\n}\n\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\treturn this._listeners[e.type](options.event && options.event(e) || e);\n}\n","import { ATTR_KEY } from '../constants';\nimport { isSameNodeType, isNamedNode } from './index';\nimport { buildComponentFromVNode } from './component';\nimport { createNode, setAccessor } from '../dom/index';\nimport { unmountComponent } from './component';\nimport options from '../options';\nimport { applyRef } from '../util';\nimport { removeNode } from '../dom/index';\nimport { addStyleToHead, getCtorName } from '../style'\n\n/**\n * Queue of components that have been mounted and are awaiting componentDidMount\n * @type {Array}\n */\nexport const mounts = [];\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0;\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false;\n\n/** Global flag indicating if the diff is performing hydration */\nlet hydrating = false;\n\n/** Invoke queued componentDidMount lifecycle methods */\nexport function flushMounts() {\n\tlet c;\n\twhile ((c = mounts.shift())) {\n\t\tif (c.constructor.css) {\n addStyleToHead(c.constructor.css, getCtorName(c.constructor))\n\t\t}\n\t\tif(c.props.css){\n\t\t\taddStyleToHead(c.props.css, '_ds'+c.elementId)\n\t\t}\n\t\tif (options.afterMount) options.afterMount(c);\n\t\t//if (c.componentDidMount) c.componentDidMount();\n\t\tif (c.store.installed) c.store.installed()\n\t}\n}\n\n\n/**\n * Apply differences in a given vnode (and it's deep children) to a real DOM Node.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing\n * the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {Element} parent ?\n * @param {boolean} componentRoot ?\n * @returns {import('../dom').OmiElement} The created/mutated element\n * @private\n */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot, store) {\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n\tif (!diffLevel++) {\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined;\n\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\n\t\thydrating = dom!=null && !(ATTR_KEY in dom);\n\t}\n\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot, store);\n\n\t// append the element if its a new parent\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret);\n\n\t// diffLevel being reduced to 0 means we're exiting the diff\n\tif (!--diffLevel) {\n\t\thydrating = false;\n\t\t// invoke queued componentDidMount lifecycle methods\n\t\tif (!componentRoot) flushMounts();\n\t}\n\n\treturn ret;\n}\n\n\n/**\n * Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} [componentRoot] ?\n * @private\n */\nfunction idiff(dom, vnode, context, mountAll, componentRoot, store) {\n\tlet out = dom,\n\t\tprevSvgMode = isSvgMode;\n\n\t// empty values (null, undefined, booleans) render as empty Text nodes\n\tif (vnode==null || typeof vnode==='boolean') vnode = '';\n\n\n\t// Fast case: Strings & Numbers create/update Text nodes.\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\n\t\t// update if it's already a Text node:\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/Omi/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\n\t\t\tif (dom.nodeValue!=vnode) {\n\t\t\t\tdom.nodeValue = vnode;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\n\t\t\tout = document.createTextNode(vnode);\n\t\t\tif (dom) {\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\t\t\t\trecollectNodeTree(dom, true);\n\t\t\t}\n\t\t}\n\n\t\tout[ATTR_KEY] = true;\n\n\t\treturn out;\n\t}\n\n\n\t// If the VNode represents a Component, perform a component diff:\n\tlet vnodeName = vnode.nodeName;\n\tif (typeof vnodeName==='function') {\n\t\treturn buildComponentFromVNode(dom, vnode, context, mountAll);\n\t}\n\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode;\n\n\n\t// If there's no existing element or it's the wrong type, create a new one:\n\tvnodeName = String(vnodeName);\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\n\t\tout = createNode(vnodeName, isSvgMode);\n\n\t\tif (dom) {\n\t\t\t// move children into the replacement node\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild);\n\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\n\t\t\t// recycle the old element (skips non-Element node types)\n\t\t\trecollectNodeTree(dom, true);\n\t\t}\n\t}\n\n\n\tlet fc = out.firstChild,\n\t\tprops = out[ATTR_KEY],\n\t\tvchildren = vnode.children;\n\n\tif (props==null) {\n\t\tprops = out[ATTR_KEY] = {};\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value;\n\t}\n\n\t// Optimization: fast-path for elements containing a single TextNode:\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\n\t\tif (fc.nodeValue!=vchildren[0]) {\n\t\t\tfc.nodeValue = vchildren[0];\n\t\t}\n\t}\n\t// otherwise, if there are existing or new children, diff them:\n\telse if (vchildren && vchildren.length || fc!=null) {\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null, store);\n\t}\n\n\n\t// Apply attributes/props from VNode to the DOM Element:\n\tdiffAttributes(out, vnode.attributes, props, store);\n\n\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\n\tisSvgMode = prevSvgMode;\n\n\treturn out;\n}\n\n\n/**\n * Apply child and attribute changes between a VNode and a DOM Node to the DOM.\n * @param {import('../dom').OmiElement} dom Element whose children should be compared & mutated\n * @param {Array} vchildren Array of VNodes to compare to `dom.childNodes`\n * @param {object} context Implicitly descendant context object (from most\n * recent `getChildContext()`)\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} isHydrating if `true`, consumes externally created elements\n * similar to hydration\n */\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating, store) {\n\tlet originalChildren = dom.childNodes,\n\t\tchildren = [],\n\t\tkeyed = {},\n\t\tkeyedLen = 0,\n\t\tmin = 0,\n\t\tlen = originalChildren.length,\n\t\tchildrenLen = 0,\n\t\tvlen = vchildren ? vchildren.length : 0,\n\t\tj, c, f, vchild, child;\n\n\t// Build up a map of keyed children and an Array of unkeyed children:\n\tif (len!==0) {\n\t\tfor (let i=0; i;\n * }\n * }\n */\n\n let id = 0\n\nexport function Component(props, context) {\n\tthis._dirty = true;\n\tthis.elementId = id++\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.context = context;\n\tthis.store = {}\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.props = props;\n\n\tthis._renderCallbacks = [];\n}\n\n\nextend(Component.prototype, {\n\n\t/**\n\t * Immediately perform a synchronous re-render of the component.\n\t * @param {() => void} callback A function to be called after component is\n\t * \tre-rendered.\n\t * @private\n\t */\n\tupdate(callback) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\trenderComponent(this, FORCE_RENDER);\n\t},\n\n\t/**\n\t * Accepts `props`, and returns a new Virtual DOM tree to build.\n\t * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n\t * @param {object} props Props (eg: JSX attributes) received from parent\n\t * \telement/component\n\t * @param {object} context Context object, as returned by the nearest\n\t * ancestor's `getChildContext()`\n\t * @returns {import('./vnode').VNode | void}\n\t */\n\trender() {}\n\n});\n","/**\n * Virtual DOM Node\n * @typedef VNode\n * @property {string | function} nodeName The string of the DOM node to create or Component constructor to render\n * @property {Array} children The children of node\n * @property {string | number | undefined} key The key used to identify this VNode in a list\n * @property {object} attributes The properties of this VNode\n */\nexport const VNode = function VNode() {};\n","/**\n * @typedef {import('./component').Component} Component\n * @typedef {import('./vnode').VNode} VNode\n */\n\n/**\n * Global options\n * @public\n * @typedef Options\n * @property {boolean} [syncComponentUpdates] If `true`, `prop` changes trigger synchronous component updates. Defaults to true.\n * @property {(vnode: VNode) => void} [vnode] Processes all created VNodes.\n * @property {(component: Component) => void} [afterMount] Hook invoked after a component is mounted.\n * @property {(component: Component) => void} [afterUpdate] Hook invoked after the DOM is updated with a component's latest render.\n * @property {(component: Component) => void} [beforeUnmount] Hook invoked immediately before a component is unmounted.\n * @property {(rerender: function) => void} [debounceRendering] Hook invoked whenever a rerender is requested. Can be used to debounce rerenders.\n * @property {(event: Event) => Event | void} [event] Hook invoked before any Omi event listeners. The return value (if any) replaces the native browser event given to event listeners\n */\n\n/** @type {Options} */\nconst options = {\n\trunTimeComponent: {},\n\tstyleCache: [],\n\tstaticStyleMapping: {}\n};\n\nexport default options;\n","import { diff } from './vdom/diff';\n\n/**\n * Render JSX into a `parent` Element.\n * @param {import('./vnode').VNode} vnode A (JSX) VNode to render\n * @param {import('./dom').OmiElement} parent DOM element to render into\n * @param {import('./dom').OmiElement} [merge] Attempt to re-use an existing DOM tree rooted at\n * `merge`\n * @public\n *\n * @example\n * // render a div into :\n * render(
hello!
, document.body);\n *\n * @example\n * // render a \"Thing\" component into #foo:\n * const Thing = ({ name }) => { name };\n * render(, document.querySelector('#foo'));\n */\nexport function render(vnode, parent, merge) {\n\treturn diff(merge, vnode, {}, false, typeof parent === 'string' ? document.querySelector(parent) : parent, false);\n}\n","import { h, h as createElement } from './h';\nimport { cloneElement } from './clone-element';\nimport { Component } from './component';\nimport { render } from './render';\nimport { rerender } from './render-queue';\nimport options from './options';\n\nfunction createRef() {\n\treturn {};\n}\n\nexport default {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nexport {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nif(typeof window !== 'undefined'){\n\twindow.Omis = {\n\t\th,\n\t\tcreateElement,\n\t\tcloneElement,\n\t\tcreateRef,\n\t\tComponent,\n\t\trender,\n\t\trerender,\n\t\toptions\n\t};\n}\n"]} \ No newline at end of file diff --git a/packages/omis/examples/context/b.js b/packages/omis/examples/context/b.js new file mode 100644 index 000000000..7cf4c8c28 --- /dev/null +++ b/packages/omis/examples/context/b.js @@ -0,0 +1,1291 @@ +(function () { + 'use strict'; + + /** + * Virtual DOM Node + * @typedef VNode + * @property {string | function} nodeName The string of the DOM node to create or Component constructor to render + * @property {Array} children The children of node + * @property {string | number | undefined} key The key used to identify this VNode in a list + * @property {object} attributes The properties of this VNode + */ + var VNode = function VNode() {}; + + /** + * @typedef {import('./component').Component} Component + * @typedef {import('./vnode').VNode} VNode + */ + + /** + * Global options + * @public + * @typedef Options + * @property {boolean} [syncComponentUpdates] If `true`, `prop` changes trigger synchronous component updates. Defaults to true. + * @property {(vnode: VNode) => void} [vnode] Processes all created VNodes. + * @property {(component: Component) => void} [afterMount] Hook invoked after a component is mounted. + * @property {(component: Component) => void} [afterUpdate] Hook invoked after the DOM is updated with a component's latest render. + * @property {(component: Component) => void} [beforeUnmount] Hook invoked immediately before a component is unmounted. + * @property {(rerender: function) => void} [debounceRendering] Hook invoked whenever a rerender is requested. Can be used to debounce rerenders. + * @property {(event: Event) => Event | void} [event] Hook invoked before any Omi event listeners. The return value (if any) replaces the native browser event given to event listeners + */ + + /** @type {Options} */ + var options = { + runTimeComponent: {}, + styleCache: [], + staticStyleMapping: {} + }; + + var styleId = 0; + + function getCtorName(ctor) { + for (var i = 0, len = options.styleCache.length; i < len; i++) { + var item = options.styleCache[i]; + + if (item.ctor === ctor) { + return item.attrName; + } + } + + var attrName = '_ss' + styleId; + options.styleCache.push({ ctor: ctor, attrName: attrName }); + styleId++; + + return attrName; + } + + // many thanks to https://github.com/thomaspark/scoper/ + function scoper(css, prefix) { + prefix = '[' + prefix.toLowerCase() + ']'; + // https://www.w3.org/TR/css-syntax-3/#lexical + css = css.replace(/\/\*[^*]*\*+([^/][^*]*\*+)*\//g, ''); + // eslint-disable-next-line + var re = new RegExp('([^\r\n,{}:]+)(:[^\r\n,{}]+)?(,(?=[^{}]*{)|\s*{)', 'g'); + /** + * Example: + * + * .classname::pesudo { color:red } + * + * g1 is normal selector `.classname` + * g2 is pesudo class or pesudo element + * g3 is the suffix + */ + css = css.replace(re, function (g0, g1, g2, g3) { + if (typeof g2 === 'undefined') { + g2 = ''; + } + + /* eslint-ignore-next-line */ + if (g1.match(/^\s*(@media|\d+%?|@-webkit-keyframes|@keyframes|to|from|@font-face)/)) { + return g1 + g2 + g3; + } + + var appendClass = g1.replace(/(\s*)$/, '') + prefix + g2; + //let prependClass = prefix + ' ' + g1.trim() + g2; + + return appendClass + g3; + //return appendClass + ',' + prependClass + g3; + }); + + return css; + } + + function addStyle(cssText, id) { + id = id.toLowerCase(); + var ele = document.getElementById(id); + var head = document.getElementsByTagName('head')[0]; + if (ele && ele.parentNode === head) { + head.removeChild(ele); + } + + var someThingStyles = document.createElement('style'); + head.appendChild(someThingStyles); + someThingStyles.setAttribute('type', 'text/css'); + someThingStyles.setAttribute('id', id); + if (window.ActiveXObject) { + someThingStyles.styleSheet.cssText = cssText; + } else { + someThingStyles.textContent = cssText; + } + } + + function addStyleToHead(style, attr) { + + if (!options.staticStyleMapping[attr]) { + addStyle(scoper(style, attr), attr); + options.staticStyleMapping[attr] = true; + } + } + + var stack = []; + + var EMPTY_CHILDREN = []; + + /** + * JSX/hyperscript reviver. + * @see http://jasonformat.com/wtf-is-jsx + * Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0 + * + * Note: this is exported as both `h()` and `createElement()` for compatibility + * reasons. + * + * Creates a VNode (virtual DOM element). A tree of VNodes can be used as a + * lightweight representation of the structure of a DOM tree. This structure can + * be realized by recursively comparing it against the current _actual_ DOM + * structure, and applying only the differences. + * + * `h()`/`createElement()` accepts an element name, a list of attributes/props, + * and optionally children to append to the element. + * + * @example The following DOM tree + * + * `
Hello!
` + * + * can be constructed using this function as: + * + * `h('div', { id: 'foo', name : 'bar' }, 'Hello!');` + * + * @param {string | function} nodeName An element name. Ex: `div`, `a`, `span`, etc. + * @param {object | null} attributes Any attributes/props to set on the created element. + * @param {VNode[]} [rest] Additional arguments are taken to be children to + * append. Can be infinitely nested Arrays. + * + * @public + */ + function h(nodeName, attributes) { + var children = EMPTY_CHILDREN, + lastSimple = void 0, + child = void 0, + simple = void 0, + i = void 0; + for (i = arguments.length; i-- > 2;) { + stack.push(arguments[i]); + } + if (attributes && attributes.children != null) { + if (!stack.length) stack.push(attributes.children); + delete attributes.children; + } + while (stack.length) { + if ((child = stack.pop()) && child.pop !== undefined) { + for (i = child.length; i--;) { + stack.push(child[i]); + } + } else { + if (typeof child === 'boolean') child = null; + + if (simple = typeof nodeName !== 'function') { + if (child == null) child = '';else if (typeof child === 'number') child = String(child);else if (typeof child !== 'string') simple = false; + } + + if (simple && lastSimple) { + children[children.length - 1] += child; + } else if (children === EMPTY_CHILDREN) { + children = [child]; + } else { + children.push(child); + } + + lastSimple = simple; + } + } + + var p = new VNode(); + p.nodeName = nodeName; + p.children = children; + p.attributes = attributes == null ? {} : attributes; + if (options.runTimeComponent) { + if (options.runTimeComponent.constructor.css) { + p.attributes[getCtorName(options.runTimeComponent.constructor)] = ''; + } + if (options.runTimeComponent.props && options.runTimeComponent.props.css) { + p.attributes['_ds' + options.runTimeComponent.elementId] = ''; + } + } + + p.key = p.attributes.key; + + // if a "vnode hook" is defined, pass every created VNode to it + if (options.vnode !== undefined) options.vnode(p); + + return p; + } + + /** + * Copy all properties from `props` onto `obj`. + * @param {object} obj Object onto which properties should be copied. + * @param {object} props Object from which to copy properties. + * @returns {object} + * @private + */ + function extend(obj, props) { + for (var i in props) { + obj[i] = props[i]; + }return obj; + } + + /** Invoke or update a ref, depending on whether it is a function or object ref. + * @param {object|function} [ref=null] + * @param {any} [value] + */ + function applyRef(ref, value) { + if (ref) { + if (typeof ref == 'function') ref(value);else ref.current = value; + } + } + + /** + * Call a function asynchronously, as soon as possible. Makes + * use of HTML Promise to schedule the callback if available, + * otherwise falling back to `setTimeout` (mainly for IE<11). + * @type {(callback: function) => void} + */ + var defer = typeof Promise == 'function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout; + + /** + * Clones the given VNode, optionally adding attributes/props and replacing its + * children. + * @param {import('./vnode').VNode} vnode The virtual DOM element to clone + * @param {object} props Attributes/props to add when cloning + * @param {Array} [rest] Any additional arguments will be used as replacement + * children. + */ + function cloneElement(vnode, props) { + return h(vnode.nodeName, extend(extend({}, vnode.attributes), props), arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children); + } + + // render modes + + /** Do not re-render a component */ + var NO_RENDER = 0; + /** Synchronously re-render a component and its children */ + var SYNC_RENDER = 1; + /** Synchronously re-render a component, even if its lifecycle methods attempt to prevent it. */ + var FORCE_RENDER = 2; + /** Queue asynchronous re-render of a component and it's children */ + var ASYNC_RENDER = 3; + + var ATTR_KEY = 'prevProps'; + + /** DOM properties that should NOT have "px" added when numeric */ + var IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i; + + /** + * Managed queue of dirty components to be re-rendered + * @type {Array} + */ + var items = []; + + /** + * Enqueue a rerender of a component + * @param {import('./component').Component} component The component to rerender + */ + function enqueueRender(component) { + if (!component._dirty && (component._dirty = true) && items.push(component) == 1) { + (options.debounceRendering || defer)(rerender); + } + } + + /** Rerender all enqueued dirty components */ + function rerender() { + var p = void 0; + while (p = items.pop()) { + if (p._dirty) renderComponent(p); + } + } + + /** + * Check if two nodes are equivalent. + * @param {import('../dom').OmiElement} node DOM Node to compare + * @param {import('../vnode').VNode} vnode Virtual DOM node to compare + * @param {boolean} [hydrating=false] If true, ignores component constructors + * when comparing. + * @private + */ + function isSameNodeType(node, vnode, hydrating) { + if (typeof vnode === 'string' || typeof vnode === 'number') { + return node.splitText !== undefined; + } + if (typeof vnode.nodeName === 'string') { + return !node._componentConstructor && isNamedNode(node, vnode.nodeName); + } + return hydrating || node._componentConstructor === vnode.nodeName; + } + + /** + * Check if an Element has a given nodeName, case-insensitively. + * @param {import('../dom').OmiElement} node A DOM Element to inspect the name of. + * @param {string} nodeName Unnormalized name to compare against. + */ + function isNamedNode(node, nodeName) { + return node.normalizedNodeName === nodeName || node.nodeName.toLowerCase() === nodeName.toLowerCase(); + } + + /** + * Reconstruct Component-style `props` from a VNode. + * Ensures default/fallback values from `defaultProps`: + * Own-properties of `defaultProps` not present in `vnode.attributes` are added. + * @param {import('../vnode').VNode} vnode The VNode to get props for + * @returns {object} The props to use for this VNode + */ + function getNodeProps(vnode) { + var props = extend({}, vnode.attributes); + props.children = vnode.children; + + var defaultProps = vnode.nodeName.defaultProps; + if (defaultProps !== undefined) { + for (var i in defaultProps) { + if (props[i] === undefined) { + props[i] = defaultProps[i]; + } + } + } + + return props; + } + + /** + * A DOM event listener + * @typedef {(e: Event) => void} EventListner + */ + + /** + * A mapping of event types to event listeners + * @typedef {Object.} EventListenerMap + */ + + /** + * Properties Omi adds to elements it creates + * @typedef OmiElementExtensions + * @property {string} [normalizedNodeName] A normalized node name to use in diffing + * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node + * @property {import('../component').Component} [_component] The component that rendered this DOM node + * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node + */ + + /** + * A DOM element that has been extended with Omi properties + * @typedef {Element & ElementCSSInlineStyle & OmiElementExtensions} OmiElement + */ + + /** + * Create an element with the given nodeName. + * @param {string} nodeName The DOM node to create + * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG + * namespace. + * @returns {OmiElement} The created DOM node + */ + function createNode(nodeName, isSvg) { + /** @type {OmiElement} */ + var node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName); + node.normalizedNodeName = nodeName; + return node; + } + + /** + * Remove a child node from its parent if attached. + * @param {Node} node The node to remove + */ + function removeNode(node) { + var parentNode = node.parentNode; + if (parentNode) parentNode.removeChild(node); + } + + /** + * Set a named attribute on the given Node, with special behavior for some names + * and event handlers. If `value` is `null`, the attribute/handler will be + * removed. + * @param {OmiElement} node An element to mutate + * @param {string} name The name/key to set, such as an event or attribute name + * @param {*} old The last value that was set for this name/node pair + * @param {*} value An attribute value, such as a function to be used as an + * event handler + * @param {boolean} isSvg Are we currently diffing inside an svg? + * @private + */ + function setAccessor(node, name, old, value, isSvg, store) { + if (name === 'className') name = 'class'; + + if (name === 'key') { + // ignore + } else if (name === 'ref') { + applyRef(old, null); + applyRef(value, node); + } else if (name === 'class' && !isSvg) { + node.className = value || ''; + } else if (name === 'style') { + if (!value || typeof value === 'string' || typeof old === 'string') { + node.style.cssText = value || ''; + } + if (value && typeof value === 'object') { + if (typeof old !== 'string') { + for (var i in old) { + if (!(i in value)) node.style[i] = ''; + } + } + for (var _i in value) { + node.style[_i] = typeof value[_i] === 'number' && IS_NON_DIMENSIONAL.test(_i) === false ? value[_i] + 'px' : value[_i]; + } + } + } else if (name === 'dangerouslySetInnerHTML') { + if (value) node.innerHTML = value.__html || ''; + } else if (name[0] == 'o' && name[1] == 'n') { + var useCapture = name !== (name = name.replace(/Capture$/, '')); + name = name.toLowerCase().substring(2); + if (value) { + if (!old) node.addEventListener(name, eventProxy, useCapture); + } else { + node.removeEventListener(name, eventProxy, useCapture); + } + (node._listeners || (node._listeners = {}))[name] = value && store ? value.bind(store) : value; + } else if (name !== 'list' && name !== 'type' && !isSvg && name in node) { + // Attempt to set a DOM property to the given value. + // IE & FF throw for certain property-value combinations. + try { + node[name] = value == null ? '' : value; + } catch (e) {} + if ((value == null || value === false) && name != 'spellcheck') node.removeAttribute(name); + } else { + var ns = isSvg && name !== (name = name.replace(/^xlink:?/, '')); + // spellcheck is treated differently than all other boolean values and + // should not be removed when the value is `false`. See: + // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck + if (value == null || value === false) { + if (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());else node.removeAttribute(name); + } else if (typeof value !== 'function') { + if (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);else node.setAttribute(name, value); + } + } + } + + /** + * Proxy an event to hooked event handlers + * @param {Event} e The event object from the browser + * @private + */ + function eventProxy(e) { + return this._listeners[e.type](options.event && options.event(e) || e); + } + + /** + * Queue of components that have been mounted and are awaiting componentDidMount + * @type {Array} + */ + var mounts = []; + + /** Diff recursion count, used to track the end of the diff cycle. */ + var diffLevel = 0; + + /** Global flag indicating if the diff is currently within an SVG */ + var isSvgMode = false; + + /** Global flag indicating if the diff is performing hydration */ + var hydrating = false; + + /** Invoke queued componentDidMount lifecycle methods */ + function flushMounts() { + var c = void 0; + while (c = mounts.shift()) { + if (c.constructor.css) { + addStyleToHead(c.constructor.css, getCtorName(c.constructor)); + } + if (c.props.css) { + addStyleToHead(c.props.css, '_ds' + c.elementId); + } + if (options.afterMount) options.afterMount(c); + //if (c.componentDidMount) c.componentDidMount(); + if (c.store.installed) c.store.installed(); + } + } + + /** + * Apply differences in a given vnode (and it's deep children) to a real DOM Node. + * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode` + * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing + * the desired DOM structure + * @param {object} context The current context + * @param {boolean} mountAll Whether or not to immediately mount all components + * @param {Element} parent ? + * @param {boolean} componentRoot ? + * @returns {import('../dom').OmiElement} The created/mutated element + * @private + */ + function diff(dom, vnode, context, mountAll, parent, componentRoot, store) { + // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff) + if (!diffLevel++) { + // when first starting the diff, check if we're diffing an SVG or within an SVG + isSvgMode = parent != null && parent.ownerSVGElement !== undefined; + + // hydration is indicated by the existing element to be diffed not having a prop cache + hydrating = dom != null && !(ATTR_KEY in dom); + } + + var ret = idiff(dom, vnode, context, mountAll, componentRoot, store); + + // append the element if its a new parent + if (parent && ret.parentNode !== parent) parent.appendChild(ret); + + // diffLevel being reduced to 0 means we're exiting the diff + if (! --diffLevel) { + hydrating = false; + // invoke queued componentDidMount lifecycle methods + if (!componentRoot) flushMounts(); + } + + return ret; + } + + /** + * Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. + * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode` + * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing the desired DOM structure + * @param {object} context The current context + * @param {boolean} mountAll Whether or not to immediately mount all components + * @param {boolean} [componentRoot] ? + * @private + */ + function idiff(dom, vnode, context, mountAll, componentRoot, store) { + var out = dom, + prevSvgMode = isSvgMode; + + // empty values (null, undefined, booleans) render as empty Text nodes + if (vnode == null || typeof vnode === 'boolean') vnode = ''; + + // Fast case: Strings & Numbers create/update Text nodes. + if (typeof vnode === 'string' || typeof vnode === 'number') { + + // update if it's already a Text node: + if (dom && dom.splitText !== undefined && dom.parentNode && (!dom._component || componentRoot)) { + /* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/Omi/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */ + if (dom.nodeValue != vnode) { + dom.nodeValue = vnode; + } + } else { + // it wasn't a Text node: replace it with one and recycle the old Element + out = document.createTextNode(vnode); + if (dom) { + if (dom.parentNode) dom.parentNode.replaceChild(out, dom); + recollectNodeTree(dom, true); + } + } + + out[ATTR_KEY] = true; + + return out; + } + + // If the VNode represents a Component, perform a component diff: + var vnodeName = vnode.nodeName; + if (typeof vnodeName === 'function') { + return buildComponentFromVNode(dom, vnode, context, mountAll); + } + + // Tracks entering and exiting SVG namespace when descending through the tree. + isSvgMode = vnodeName === 'svg' ? true : vnodeName === 'foreignObject' ? false : isSvgMode; + + // If there's no existing element or it's the wrong type, create a new one: + vnodeName = String(vnodeName); + if (!dom || !isNamedNode(dom, vnodeName)) { + out = createNode(vnodeName, isSvgMode); + + if (dom) { + // move children into the replacement node + while (dom.firstChild) { + out.appendChild(dom.firstChild); + } // if the previous Element was mounted into the DOM, replace it inline + if (dom.parentNode) dom.parentNode.replaceChild(out, dom); + + // recycle the old element (skips non-Element node types) + recollectNodeTree(dom, true); + } + } + + var fc = out.firstChild, + props = out[ATTR_KEY], + vchildren = vnode.children; + + if (props == null) { + props = out[ATTR_KEY] = {}; + for (var a = out.attributes, i = a.length; i--;) { + props[a[i].name] = a[i].value; + } + } + + // Optimization: fast-path for elements containing a single TextNode: + if (!hydrating && vchildren && vchildren.length === 1 && typeof vchildren[0] === 'string' && fc != null && fc.splitText !== undefined && fc.nextSibling == null) { + if (fc.nodeValue != vchildren[0]) { + fc.nodeValue = vchildren[0]; + } + } + // otherwise, if there are existing or new children, diff them: + else if (vchildren && vchildren.length || fc != null) { + innerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML != null, store); + } + + // Apply attributes/props from VNode to the DOM Element: + diffAttributes(out, vnode.attributes, props, store); + + // restore previous SVG mode: (in case we're exiting an SVG namespace) + isSvgMode = prevSvgMode; + + return out; + } + + /** + * Apply child and attribute changes between a VNode and a DOM Node to the DOM. + * @param {import('../dom').OmiElement} dom Element whose children should be compared & mutated + * @param {Array} vchildren Array of VNodes to compare to `dom.childNodes` + * @param {object} context Implicitly descendant context object (from most + * recent `getChildContext()`) + * @param {boolean} mountAll Whether or not to immediately mount all components + * @param {boolean} isHydrating if `true`, consumes externally created elements + * similar to hydration + */ + function innerDiffNode(dom, vchildren, context, mountAll, isHydrating, store) { + var originalChildren = dom.childNodes, + children = [], + keyed = {}, + keyedLen = 0, + min = 0, + len = originalChildren.length, + childrenLen = 0, + vlen = vchildren ? vchildren.length : 0, + j = void 0, + c = void 0, + f = void 0, + vchild = void 0, + child = void 0; + + // Build up a map of keyed children and an Array of unkeyed children: + if (len !== 0) { + for (var i = 0; i < len; i++) { + var _child = originalChildren[i], + props = _child[ATTR_KEY], + key = vlen && props ? _child._component ? _child._component.__key : props.key : null; + if (key != null) { + keyedLen++; + keyed[key] = _child; + } else if (props || (_child.splitText !== undefined ? isHydrating ? _child.nodeValue.trim() : true : isHydrating)) { + children[childrenLen++] = _child; + } + } + } + + if (vlen !== 0) { + for (var _i = 0; _i < vlen; _i++) { + vchild = vchildren[_i]; + child = null; + + // attempt to find a node based on key matching + var _key = vchild.key; + if (_key != null) { + if (keyedLen && keyed[_key] !== undefined) { + child = keyed[_key]; + keyed[_key] = undefined; + keyedLen--; + } + } + // attempt to pluck a node of the same type from the existing children + else if (min < childrenLen) { + for (j = min; j < childrenLen; j++) { + if (children[j] !== undefined && isSameNodeType(c = children[j], vchild, isHydrating)) { + child = c; + children[j] = undefined; + if (j === childrenLen - 1) childrenLen--; + if (j === min) min++; + break; + } + } + } + + // morph the matched/found/created DOM child to match vchild (deep) + child = idiff(child, vchild, context, mountAll, null, store); + + f = originalChildren[_i]; + if (child && child !== dom && child !== f) { + if (f == null) { + dom.appendChild(child); + } else if (child === f.nextSibling) { + removeNode(f); + } else { + dom.insertBefore(child, f); + } + } + } + } + + // remove unused keyed children: + if (keyedLen) { + for (var _i2 in keyed) { + if (keyed[_i2] !== undefined) recollectNodeTree(keyed[_i2], false); + } + } + + // remove orphaned unkeyed children: + while (min <= childrenLen) { + if ((child = children[childrenLen--]) !== undefined) recollectNodeTree(child, false); + } + } + + /** + * Recursively recycle (or just unmount) a node and its descendants. + * @param {import('../dom').OmiElement} node DOM node to start + * unmount/removal from + * @param {boolean} [unmountOnly=false] If `true`, only triggers unmount + * lifecycle, skips removal + */ + function recollectNodeTree(node, unmountOnly) { + var component = node._component; + if (component) { + // if node is owned by a Component, unmount that component (ends up recursing back here) + unmountComponent(component); + } else { + // If the node's VNode had a ref function, invoke it with null here. + // (this is part of the React spec, and smart for unsetting references) + if (node[ATTR_KEY] != null) applyRef(node[ATTR_KEY].ref, null); + + if (unmountOnly === false || node[ATTR_KEY] == null) { + removeNode(node); + } + + removeChildren(node); + } + } + + /** + * Recollect/unmount all children. + * - we use .lastChild here because it causes less reflow than .firstChild + * - it's also cheaper than accessing the .childNodes Live NodeList + */ + function removeChildren(node) { + node = node.lastChild; + while (node) { + var next = node.previousSibling; + recollectNodeTree(node, true); + node = next; + } + } + + /** + * Apply differences in attributes from a VNode to the given DOM Element. + * @param {import('../dom').OmiElement} dom Element with attributes to diff `attrs` against + * @param {object} attrs The desired end-state key-value attribute pairs + * @param {object} old Current/previous attributes (from previous VNode or + * element's prop cache) + */ + function diffAttributes(dom, attrs, old, store) { + var name = void 0; + + // remove attributes no longer present on the vnode by setting them to undefined + for (name in old) { + if (!(attrs && attrs[name] != null) && old[name] != null) { + setAccessor(dom, name, old[name], old[name] = undefined, isSvgMode, store); + } + } + + // add new & update changed attributes + for (name in attrs) { + if (name !== 'children' && name !== 'innerHTML' && (!(name in old) || attrs[name] !== (name === 'value' || name === 'checked' ? dom[name] : old[name]))) { + setAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode, store); + } + } + } + + /** + * Retains a pool of Components for re-use. + * @type {Component[]} + * @private + */ + var recyclerComponents = []; + + /** + * Create a component. Normalizes differences between PFC's and classful + * Components. + * @param {function} Ctor The constructor of the component to create + * @param {object} props The initial props of the component + * @param {object} context The initial context of the component + * @returns {import('../component').Component} + */ + function createComponent(Ctor, props, context) { + var inst = void 0, + i = recyclerComponents.length; + + inst = new Component(props, context); + inst.constructor = Ctor; + inst.render = doRender; + if (Ctor.store) { + inst.store = Ctor.store(inst); + inst.store.update = inst.update.bind(inst); + } + + while (i--) { + if (recyclerComponents[i].constructor === Ctor) { + inst.nextBase = recyclerComponents[i].nextBase; + recyclerComponents.splice(i, 1); + return inst; + } + } + + return inst; + } + + /** The `.render()` method for a PFC backing instance. */ + function doRender(props, context) { + return this.constructor(props, this.store, context); + } + + /** + * Set a component's `props` and possibly re-render the component + * @param {import('../component').Component} component The Component to set props on + * @param {object} props The new props + * @param {number} renderMode Render options - specifies how to re-render the component + * @param {object} context The new context + * @param {boolean} mountAll Whether or not to immediately mount all components + */ + function setComponentProps(component, props, renderMode, context, mountAll) { + if (component._disable) return; + component._disable = true; + + component.__ref = props.ref; + component.__key = props.key; + delete props.ref; + delete props.key; + + if (!component.base || mountAll) { + //if (component.componentWillMount) component.componentWillMount(); + if (component.store.install) component.store.install(); + } else { + // if (component.componentWillReceiveProps) { + // component.componentWillReceiveProps(props, context); + // } + if (component.store.receiveProps) { + component.__needUpdate_ = component.store.receiveProps(props, context); + } + } + + if (context && context !== component.context) { + if (!component.prevContext) component.prevContext = component.context; + component.context = context; + } + + if (!component.prevProps) component.prevProps = component.props; + component.props = props; + + component._disable = false; + + if (renderMode !== NO_RENDER) { + if (renderMode === SYNC_RENDER || options.syncComponentUpdates !== false || !component.base) { + renderComponent(component, SYNC_RENDER, mountAll); + } else { + enqueueRender(component); + } + } + + applyRef(component.__ref, component); + } + + /** + * Render a Component, triggering necessary lifecycle events and taking + * High-Order Components into account. + * @param {import('../component').Component} component The component to render + * @param {number} [renderMode] render mode, see constants.js for available options. + * @param {boolean} [mountAll] Whether or not to immediately mount all components + * @param {boolean} [isChild] ? + * @private + */ + function renderComponent(component, renderMode, mountAll, isChild) { + if (component._disable) return; + + var props = component.props, + context = component.context, + previousProps = component.prevProps || props, + previousContext = component.prevContext || context, + isUpdate = component.base, + nextBase = component.nextBase, + initialBase = isUpdate || nextBase, + initialChildComponent = component._component, + skip = false, + snapshot = previousContext, + rendered = void 0, + inst = void 0, + cbase = void 0; + + // if updating + if (isUpdate) { + component.props = previousProps; + component.context = previousContext; + + if (component.__needUpdate_ !== false) { + skip = false; + if (component.store.beforeUpdate) { + component.store.beforeUpdate(props, context); + } + } else { + skip = true; + } + delete component.__needUpdate_; + + component.props = props; + component.context = context; + } + + component.prevProps = component.prevContext = component.nextBase = null; + component._dirty = false; + + if (!skip) { + options.runTimeComponent = component; + if (component.store.beforeRender) { + component.store.beforeRender(); + } + rendered = component.render(props, context); + options.runTimeComponent = null; + + // context to pass to the child, can be updated via (grand-)parent component + if (component.getChildContext) { + context = extend(extend({}, context), component.getChildContext()); + } + + if (isUpdate && component.getSnapshotBeforeUpdate) { + snapshot = component.getSnapshotBeforeUpdate(previousProps); + } + + var childComponent = rendered && rendered.nodeName, + toUnmount = void 0, + base = void 0; + + if (typeof childComponent === 'function') { + // set up high order component link + + var childProps = getNodeProps(rendered); + inst = initialChildComponent; + + if (inst && inst.constructor === childComponent && childProps.key == inst.__key) { + setComponentProps(inst, childProps, SYNC_RENDER, context, false); + } else { + toUnmount = inst; + + component._component = inst = createComponent(childComponent, childProps, context); + inst.nextBase = inst.nextBase || nextBase; + inst._parentComponent = component; + setComponentProps(inst, childProps, NO_RENDER, context, false); + renderComponent(inst, SYNC_RENDER, mountAll, true); + } + + base = inst.base; + } else { + cbase = initialBase; + + // destroy high order component link + toUnmount = initialChildComponent; + if (toUnmount) { + cbase = component._component = null; + } + + if (initialBase || renderMode === SYNC_RENDER) { + if (cbase) cbase._component = null; + base = diff(cbase, rendered, context, mountAll || !isUpdate, initialBase && initialBase.parentNode, true, component.store); + } + } + + if (initialBase && base !== initialBase && inst !== initialChildComponent) { + var baseParent = initialBase.parentNode; + if (baseParent && base !== baseParent) { + baseParent.replaceChild(base, initialBase); + + if (!toUnmount) { + initialBase._component = null; + recollectNodeTree(initialBase, false); + } + } + } + + if (toUnmount) { + unmountComponent(toUnmount); + } + + component.base = base; + if (base && !isChild) { + var componentRef = component, + t = component; + while (t = t._parentComponent) { + (componentRef = t).base = base; + } + base._component = componentRef; + base._componentConstructor = componentRef.constructor; + } + } + + if (!isUpdate || mountAll) { + mounts.push(component); + } else if (!skip) { + // Ensure that pending componentDidMount() hooks of child components + // are called before the componentDidUpdate() hook in the parent. + // Note: disabled as it causes duplicate hooks, see https://github.com/developit/Omi/issues/750 + // flushMounts(); + + if (component.store.updated) { + component.store.updated(previousProps, snapshot); + } + if (options.afterUpdate) options.afterUpdate(component); + } + + while (component._renderCallbacks.length) { + component._renderCallbacks.pop().call(component); + }if (!diffLevel && !isChild) flushMounts(); + } + + /** + * Apply the Component referenced by a VNode to the DOM. + * @param {import('../dom').OmiElement} dom The DOM node to mutate + * @param {import('../vnode').VNode} vnode A Component-referencing VNode + * @param {object} context The current context + * @param {boolean} mountAll Whether or not to immediately mount all components + * @returns {import('../dom').OmiElement} The created/mutated element + * @private + */ + function buildComponentFromVNode(dom, vnode, context, mountAll) { + var c = dom && dom._component, + originalComponent = c, + oldDom = dom, + isDirectOwner = c && dom._componentConstructor === vnode.nodeName, + isOwner = isDirectOwner, + props = getNodeProps(vnode); + while (c && !isOwner && (c = c._parentComponent)) { + isOwner = c.constructor === vnode.nodeName; + } + + if (c && isOwner && (!mountAll || c._component)) { + setComponentProps(c, props, ASYNC_RENDER, context, mountAll); + dom = c.base; + } else { + if (originalComponent && !isDirectOwner) { + unmountComponent(originalComponent); + dom = oldDom = null; + } + + c = createComponent(vnode.nodeName, props, context); + if (dom && !c.nextBase) { + c.nextBase = dom; + // passing dom/oldDom as nextBase will recycle it if unused, so bypass recycling on L229: + oldDom = null; + } + setComponentProps(c, props, SYNC_RENDER, context, mountAll); + dom = c.base; + + if (oldDom && dom !== oldDom) { + oldDom._component = null; + recollectNodeTree(oldDom, false); + } + } + + return dom; + } + + /** + * Remove a component from the DOM and recycle it. + * @param {import('../component').Component} component The Component instance to unmount + * @private + */ + function unmountComponent(component) { + if (options.beforeUnmount) options.beforeUnmount(component); + + var base = component.base; + + component._disable = true; + + //if (component.componentWillUnmount) component.componentWillUnmount(); + if (component.store.uninstall) component.store.uninstall(); + component.base = null; + + // recursively tear down & recollect high-order component children: + var inner = component._component; + if (inner) { + unmountComponent(inner); + } else if (base) { + if (base[ATTR_KEY] != null) applyRef(base[ATTR_KEY].ref, null); + + component.nextBase = base; + + removeNode(base); + recyclerComponents.push(component); + + removeChildren(base); + } + + applyRef(component.__ref, null); + } + + /** + * Base Component class. + * Provides `update()`, which trigger rendering. + * @typedef {object} Component + * @param {object} props The initial component props + * @param {object} context The initial context from parent components' getChildContext + * @public + * + * @example + * class MyFoo extends Component { + * render(props) { + * return
; + * } + * } + */ + + var id = 0; + + function Component(props, context) { + this._dirty = true; + this.elementId = id++; + /** + * @public + * @type {object} + */ + this.context = context; + this.store = {}; + /** + * @public + * @type {object} + */ + this.props = props; + + this._renderCallbacks = []; + } + + extend(Component.prototype, { + + /** + * Immediately perform a synchronous re-render of the component. + * @param {() => void} callback A function to be called after component is + * re-rendered. + * @private + */ + update: function update(callback) { + if (callback) this._renderCallbacks.push(callback); + renderComponent(this, FORCE_RENDER); + }, + + + /** + * Accepts `props`, and returns a new Virtual DOM tree to build. + * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx). + * @param {object} props Props (eg: JSX attributes) received from parent + * element/component + * @param {object} context Context object, as returned by the nearest + * ancestor's `getChildContext()` + * @returns {import('./vnode').VNode | void} + */ + render: function render() {} + }); + + /** + * Render JSX into a `parent` Element. + * @param {import('./vnode').VNode} vnode A (JSX) VNode to render + * @param {import('./dom').OmiElement} parent DOM element to render into + * @param {import('./dom').OmiElement} [merge] Attempt to re-use an existing DOM tree rooted at + * `merge` + * @public + * + * @example + * // render a div into : + * render(
hello!
, document.body); + * + * @example + * // render a "Thing" component into #foo: + * const Thing = ({ name }) => { name }; + * render(, document.querySelector('#foo')); + */ + function render(vnode, parent, merge) { + return diff(merge, vnode, {}, false, typeof parent === 'string' ? document.querySelector(parent) : parent, false); + } + + function createRef() { + return {}; + } + + if (typeof window !== 'undefined') { + window.Omis = { + h: h, + createElement: h, + cloneElement: cloneElement, + createRef: createRef, + Component: Component, + render: render, + rerender: rerender, + options: options + }; + } + + var Counter = function Counter(props, store, context) { + console.log(context); + return Omis.h( + 'div', + null, + Omis.h( + 'button', + { onClick: store.sub }, + '-' + ), + Omis.h( + 'span', + null, + store.count + ), + Omis.h( + 'button', + { onClick: store.add }, + '+' + ) + ); + }; + + Counter.store = function (_) { + return { + count: 1, + add: function add(e) { + this.count++; + this.update(); + _.props.onChange(this.count); + }, + sub: function sub() { + this.count--; + this.update(); + _.props.onChange(this.count); + } + }; + }; + + var App = function App(props, store) { + return Omis.h( + 'div', + null, + Omis.h( + 'div', + null, + 'Count from child event: ', + store.context.a + ), + Omis.h(Counter, { onChange: store.changeHandle }) + ); + }; + + App.store = function (_) { + return { + count: null, + context: { a: 111 }, + install: function install() { + var _this = this; + + _.getChildContext = function () { + return _this.context; + }; + }, + changeHandle: function changeHandle(count) { + _.store.count = count; + _.update(); + } + }; + }; + + render(Omis.h(App, null), 'body'); + +}()); +//# sourceMappingURL=b.js.map diff --git a/packages/omis/examples/context/b.js.map b/packages/omis/examples/context/b.js.map new file mode 100644 index 000000000..1ce590b32 --- /dev/null +++ b/packages/omis/examples/context/b.js.map @@ -0,0 +1 @@ +{"version":3,"file":"b.js","sources":["../../src/vnode.js","../../src/options.js","../../src/style.js","../../src/h.js","../../src/util.js","../../src/clone-element.js","../../src/constants.js","../../src/render-queue.js","../../src/vdom/index.js","../../src/dom/index.js","../../src/vdom/diff.js","../../src/vdom/component-recycler.js","../../src/vdom/component.js","../../src/component.js","../../src/render.js","../../src/omis.js","main.js"],"sourcesContent":["/**\n * Virtual DOM Node\n * @typedef VNode\n * @property {string | function} nodeName The string of the DOM node to create or Component constructor to render\n * @property {Array} children The children of node\n * @property {string | number | undefined} key The key used to identify this VNode in a list\n * @property {object} attributes The properties of this VNode\n */\nexport const VNode = function VNode() {};\n","/**\n * @typedef {import('./component').Component} Component\n * @typedef {import('./vnode').VNode} VNode\n */\n\n/**\n * Global options\n * @public\n * @typedef Options\n * @property {boolean} [syncComponentUpdates] If `true`, `prop` changes trigger synchronous component updates. Defaults to true.\n * @property {(vnode: VNode) => void} [vnode] Processes all created VNodes.\n * @property {(component: Component) => void} [afterMount] Hook invoked after a component is mounted.\n * @property {(component: Component) => void} [afterUpdate] Hook invoked after the DOM is updated with a component's latest render.\n * @property {(component: Component) => void} [beforeUnmount] Hook invoked immediately before a component is unmounted.\n * @property {(rerender: function) => void} [debounceRendering] Hook invoked whenever a rerender is requested. Can be used to debounce rerenders.\n * @property {(event: Event) => Event | void} [event] Hook invoked before any Omi event listeners. The return value (if any) replaces the native browser event given to event listeners\n */\n\n/** @type {Options} */\nconst options = {\n\trunTimeComponent: {},\n\tstyleCache: [],\n\tstaticStyleMapping: {}\n};\n\nexport default options;\n","import options from './options'\n\nlet styleId = 0\n\nexport function getCtorName(ctor) {\n for (let i = 0, len = options.styleCache.length; i < len; i++) {\n let item = options.styleCache[i]\n\n if (item.ctor === ctor) {\n return item.attrName\n }\n }\n\n let attrName = '_ss' + styleId\n options.styleCache.push({ ctor, attrName })\n styleId++\n\n return attrName\n}\n\n// many thanks to https://github.com/thomaspark/scoper/\nexport function scoper(css, prefix) {\n prefix = '[' + prefix.toLowerCase() + ']'\n // https://www.w3.org/TR/css-syntax-3/#lexical\n css = css.replace(/\\/\\*[^*]*\\*+([^/][^*]*\\*+)*\\//g, '')\n // eslint-disable-next-line\n let re = new RegExp('([^\\r\\n,{}:]+)(:[^\\r\\n,{}]+)?(,(?=[^{}]*{)|\\s*{)', 'g')\n /**\n * Example:\n *\n * .classname::pesudo { color:red }\n *\n * g1 is normal selector `.classname`\n * g2 is pesudo class or pesudo element\n * g3 is the suffix\n */\n css = css.replace(re, (g0, g1, g2, g3) => {\n if (typeof g2 === 'undefined') {\n g2 = ''\n }\n\n /* eslint-ignore-next-line */\n if (\n g1.match(\n /^\\s*(@media|\\d+%?|@-webkit-keyframes|@keyframes|to|from|@font-face)/\n )\n ) {\n return g1 + g2 + g3\n }\n\n let appendClass = g1.replace(/(\\s*)$/, '') + prefix + g2\n //let prependClass = prefix + ' ' + g1.trim() + g2;\n\n return appendClass + g3\n //return appendClass + ',' + prependClass + g3;\n })\n\n return css\n}\n\nexport function addStyle(cssText, id) {\n id = id.toLowerCase()\n let ele = document.getElementById(id)\n let head = document.getElementsByTagName('head')[0]\n if (ele && ele.parentNode === head) {\n head.removeChild(ele)\n }\n\n let someThingStyles = document.createElement('style')\n head.appendChild(someThingStyles)\n someThingStyles.setAttribute('type', 'text/css')\n someThingStyles.setAttribute('id', id)\n if (window.ActiveXObject) {\n someThingStyles.styleSheet.cssText = cssText\n } else {\n someThingStyles.textContent = cssText\n }\n}\n\nexport function addStyleToHead(style, attr) {\n\n\tif (!options.staticStyleMapping[attr]) {\n\t\taddStyle(scoper(style, attr), attr)\n\t\toptions.staticStyleMapping[attr] = true\n\t}\n}\n","import { VNode } from './vnode';\nimport options from './options';\nimport {getCtorName} from './style'\n\nconst stack = [];\n\nconst EMPTY_CHILDREN = [];\n\n/**\n * JSX/hyperscript reviver.\n * @see http://jasonformat.com/wtf-is-jsx\n * Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0\n *\n * Note: this is exported as both `h()` and `createElement()` for compatibility\n * reasons.\n *\n * Creates a VNode (virtual DOM element). A tree of VNodes can be used as a\n * lightweight representation of the structure of a DOM tree. This structure can\n * be realized by recursively comparing it against the current _actual_ DOM\n * structure, and applying only the differences.\n *\n * `h()`/`createElement()` accepts an element name, a list of attributes/props,\n * and optionally children to append to the element.\n *\n * @example The following DOM tree\n *\n * `
Hello!
`\n *\n * can be constructed using this function as:\n *\n * `h('div', { id: 'foo', name : 'bar' }, 'Hello!');`\n *\n * @param {string | function} nodeName An element name. Ex: `div`, `a`, `span`, etc.\n * @param {object | null} attributes Any attributes/props to set on the created element.\n * @param {VNode[]} [rest] Additional arguments are taken to be children to\n * append. Can be infinitely nested Arrays.\n *\n * @public\n */\nexport function h(nodeName, attributes) {\n\tlet children=EMPTY_CHILDREN, lastSimple, child, simple, i;\n\tfor (i=arguments.length; i-- > 2; ) {\n\t\tstack.push(arguments[i]);\n\t}\n\tif (attributes && attributes.children!=null) {\n\t\tif (!stack.length) stack.push(attributes.children);\n\t\tdelete attributes.children;\n\t}\n\twhile (stack.length) {\n\t\tif ((child = stack.pop()) && child.pop!==undefined) {\n\t\t\tfor (i=child.length; i--; ) stack.push(child[i]);\n\t\t}\n\t\telse {\n\t\t\tif (typeof child==='boolean') child = null;\n\n\t\t\tif ((simple = typeof nodeName!=='function')) {\n\t\t\t\tif (child==null) child = '';\n\t\t\t\telse if (typeof child==='number') child = String(child);\n\t\t\t\telse if (typeof child!=='string') simple = false;\n\t\t\t}\n\n\t\t\tif (simple && lastSimple) {\n\t\t\t\tchildren[children.length-1] += child;\n\t\t\t}\n\t\t\telse if (children===EMPTY_CHILDREN) {\n\t\t\t\tchildren = [child];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tchildren.push(child);\n\t\t\t}\n\n\t\t\tlastSimple = simple;\n\t\t}\n\t}\n\n\tlet p = new VNode();\n\tp.nodeName = nodeName;\n\tp.children = children;\n\tp.attributes = attributes==null ? {} : attributes;\n\tif(options.runTimeComponent){\n\t\tif(options.runTimeComponent.constructor.css){\n\t\t\tp.attributes[getCtorName(options.runTimeComponent.constructor)] = ''\n\t\t}\n\t\tif(options.runTimeComponent.props && options.runTimeComponent.props.css){\n\t\t\tp.attributes['_ds'+options.runTimeComponent.elementId] = ''\n\t\t}\n\t}\n\n\tp.key = p.attributes.key;\n\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\n\tif (options.vnode!==undefined) options.vnode(p);\n\n\treturn p;\n}\n","/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function extend(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\n}\n\n/** Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} [ref=null]\n * @param {any} [value]\n */\nexport function applyRef(ref, value) {\n\tif (ref) {\n\t\tif (typeof ref=='function') ref(value);\n\t\telse ref.current = value;\n\t}\n}\n\n/**\n * Call a function asynchronously, as soon as possible. Makes\n * use of HTML Promise to schedule the callback if available,\n * otherwise falling back to `setTimeout` (mainly for IE<11).\n * @type {(callback: function) => void}\n */\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;\n","import { extend } from './util';\nimport { h } from './h';\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its\n * children.\n * @param {import('./vnode').VNode} vnode The virtual DOM element to clone\n * @param {object} props Attributes/props to add when cloning\n * @param {Array} [rest] Any additional arguments will be used as replacement\n * children.\n */\nexport function cloneElement(vnode, props) {\n\treturn h(\n\t\tvnode.nodeName,\n\t\textend(extend({}, vnode.attributes), props),\n\t\targuments.length>2 ? [].slice.call(arguments, 2) : vnode.children\n\t);\n}\n","// render modes\n\n/** Do not re-render a component */\nexport const NO_RENDER = 0;\n/** Synchronously re-render a component and its children */\nexport const SYNC_RENDER = 1;\n/** Synchronously re-render a component, even if its lifecycle methods attempt to prevent it. */\nexport const FORCE_RENDER = 2;\n/** Queue asynchronous re-render of a component and it's children */\nexport const ASYNC_RENDER = 3;\n\n\nexport const ATTR_KEY = 'prevProps';\n\n/** DOM properties that should NOT have \"px\" added when numeric */\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;\n\n","import options from './options';\nimport { defer } from './util';\nimport { renderComponent } from './vdom/component';\n\n/**\n * Managed queue of dirty components to be re-rendered\n * @type {Array}\n */\nlet items = [];\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./component').Component} component The component to rerender\n */\nexport function enqueueRender(component) {\n\tif (!component._dirty && (component._dirty = true) && items.push(component)==1) {\n\t\t(options.debounceRendering || defer)(rerender);\n\t}\n}\n\n/** Rerender all enqueued dirty components */\nexport function rerender() {\n\tlet p;\n\twhile ( (p = items.pop()) ) {\n\t\tif (p._dirty) renderComponent(p);\n\t}\n}\n","import { extend } from '../util';\n\n\n/**\n * Check if two nodes are equivalent.\n * @param {import('../dom').OmiElement} node DOM Node to compare\n * @param {import('../vnode').VNode} vnode Virtual DOM node to compare\n * @param {boolean} [hydrating=false] If true, ignores component constructors\n * when comparing.\n * @private\n */\nexport function isSameNodeType(node, vnode, hydrating) {\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\t\treturn node.splitText!==undefined;\n\t}\n\tif (typeof vnode.nodeName==='string') {\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName);\n\t}\n\treturn hydrating || node._componentConstructor===vnode.nodeName;\n}\n\n\n/**\n * Check if an Element has a given nodeName, case-insensitively.\n * @param {import('../dom').OmiElement} node A DOM Element to inspect the name of.\n * @param {string} nodeName Unnormalized name to compare against.\n */\nexport function isNamedNode(node, nodeName) {\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase();\n}\n\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n * @param {import('../vnode').VNode} vnode The VNode to get props for\n * @returns {object} The props to use for this VNode\n */\nexport function getNodeProps(vnode) {\n\tlet props = extend({}, vnode.attributes);\n\tprops.children = vnode.children;\n\n\tlet defaultProps = vnode.nodeName.defaultProps;\n\tif (defaultProps!==undefined) {\n\t\tfor (let i in defaultProps) {\n\t\t\tif (props[i]===undefined) {\n\t\t\t\tprops[i] = defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn props;\n}\n","import { IS_NON_DIMENSIONAL } from '../constants';\nimport { applyRef } from '../util';\nimport options from '../options';\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Omi adds to elements it creates\n * @typedef OmiElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Omi properties\n * @typedef {Element & ElementCSSInlineStyle & OmiElementExtensions} OmiElement\n */\n\n/**\n * Create an element with the given nodeName.\n * @param {string} nodeName The DOM node to create\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\n * namespace.\n * @returns {OmiElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n\t/** @type {OmiElement} */\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);\n\tnode.normalizedNodeName = nodeName;\n\treturn node;\n}\n\n\n/**\n * Remove a child node from its parent if attached.\n * @param {Node} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\n\n/**\n * Set a named attribute on the given Node, with special behavior for some names\n * and event handlers. If `value` is `null`, the attribute/handler will be\n * removed.\n * @param {OmiElement} node An element to mutate\n * @param {string} name The name/key to set, such as an event or attribute name\n * @param {*} old The last value that was set for this name/node pair\n * @param {*} value An attribute value, such as a function to be used as an\n * event handler\n * @param {boolean} isSvg Are we currently diffing inside an svg?\n * @private\n */\nexport function setAccessor(node, name, old, value, isSvg, store) {\n\tif (name==='className') name = 'class';\n\n\n\tif (name==='key') {\n\t\t// ignore\n\t}\n\telse if (name==='ref') {\n\t\tapplyRef(old, null);\n\t\tapplyRef(value, node);\n\t}\n\telse if (name==='class' && !isSvg) {\n\t\tnode.className = value || '';\n\t}\n\telse if (name==='style') {\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\n\t\t\tnode.style.cssText = value || '';\n\t\t}\n\t\tif (value && typeof value==='object') {\n\t\t\tif (typeof old!=='string') {\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = '';\n\t\t\t}\n\t\t\tfor (let i in value) {\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i];\n\t\t\t}\n\t\t}\n\t}\n\telse if (name==='dangerouslySetInnerHTML') {\n\t\tif (value) node.innerHTML = value.__html || '';\n\t}\n\telse if (name[0]=='o' && name[1]=='n') {\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''));\n\t\tname = name.toLowerCase().substring(2);\n\t\tif (value) {\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\telse {\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\t(node._listeners || (node._listeners = {}))[name] = (value && store) ? value.bind(store) : value;\n\t}\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\n\t\t// Attempt to set a DOM property to the given value.\n\t\t// IE & FF throw for certain property-value combinations.\n\t\ttry {\n\t\t\tnode[name] = value==null ? '' : value;\n\t\t} catch (e) { }\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name);\n\t}\n\telse {\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')));\n\t\t// spellcheck is treated differently than all other boolean values and\n\t\t// should not be removed when the value is `false`. See:\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\n\t\tif (value==null || value===false) {\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());\n\t\t\telse node.removeAttribute(name);\n\t\t}\n\t\telse if (typeof value!=='function') {\n\t\t\tif (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);\n\t\t\telse node.setAttribute(name, value);\n\t\t}\n\t}\n}\n\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\treturn this._listeners[e.type](options.event && options.event(e) || e);\n}\n","import { ATTR_KEY } from '../constants';\nimport { isSameNodeType, isNamedNode } from './index';\nimport { buildComponentFromVNode } from './component';\nimport { createNode, setAccessor } from '../dom/index';\nimport { unmountComponent } from './component';\nimport options from '../options';\nimport { applyRef } from '../util';\nimport { removeNode } from '../dom/index';\nimport { addStyleToHead, getCtorName } from '../style'\n\n/**\n * Queue of components that have been mounted and are awaiting componentDidMount\n * @type {Array}\n */\nexport const mounts = [];\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0;\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false;\n\n/** Global flag indicating if the diff is performing hydration */\nlet hydrating = false;\n\n/** Invoke queued componentDidMount lifecycle methods */\nexport function flushMounts() {\n\tlet c;\n\twhile ((c = mounts.shift())) {\n\t\tif (c.constructor.css) {\n addStyleToHead(c.constructor.css, getCtorName(c.constructor))\n\t\t}\n\t\tif(c.props.css){\n\t\t\taddStyleToHead(c.props.css, '_ds'+c.elementId)\n\t\t}\n\t\tif (options.afterMount) options.afterMount(c);\n\t\t//if (c.componentDidMount) c.componentDidMount();\n\t\tif (c.store.installed) c.store.installed()\n\t}\n}\n\n\n/**\n * Apply differences in a given vnode (and it's deep children) to a real DOM Node.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing\n * the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {Element} parent ?\n * @param {boolean} componentRoot ?\n * @returns {import('../dom').OmiElement} The created/mutated element\n * @private\n */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot, store) {\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n\tif (!diffLevel++) {\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined;\n\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\n\t\thydrating = dom!=null && !(ATTR_KEY in dom);\n\t}\n\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot, store);\n\n\t// append the element if its a new parent\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret);\n\n\t// diffLevel being reduced to 0 means we're exiting the diff\n\tif (!--diffLevel) {\n\t\thydrating = false;\n\t\t// invoke queued componentDidMount lifecycle methods\n\t\tif (!componentRoot) flushMounts();\n\t}\n\n\treturn ret;\n}\n\n\n/**\n * Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing.\n * @param {import('../dom').OmiElement} dom A DOM node to mutate into the shape of a `vnode`\n * @param {import('../vnode').VNode} vnode A VNode (with descendants forming a tree) representing the desired DOM structure\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} [componentRoot] ?\n * @private\n */\nfunction idiff(dom, vnode, context, mountAll, componentRoot, store) {\n\tlet out = dom,\n\t\tprevSvgMode = isSvgMode;\n\n\t// empty values (null, undefined, booleans) render as empty Text nodes\n\tif (vnode==null || typeof vnode==='boolean') vnode = '';\n\n\n\t// Fast case: Strings & Numbers create/update Text nodes.\n\tif (typeof vnode==='string' || typeof vnode==='number') {\n\n\t\t// update if it's already a Text node:\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/Omi/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\n\t\t\tif (dom.nodeValue!=vnode) {\n\t\t\t\tdom.nodeValue = vnode;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\n\t\t\tout = document.createTextNode(vnode);\n\t\t\tif (dom) {\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\t\t\t\trecollectNodeTree(dom, true);\n\t\t\t}\n\t\t}\n\n\t\tout[ATTR_KEY] = true;\n\n\t\treturn out;\n\t}\n\n\n\t// If the VNode represents a Component, perform a component diff:\n\tlet vnodeName = vnode.nodeName;\n\tif (typeof vnodeName==='function') {\n\t\treturn buildComponentFromVNode(dom, vnode, context, mountAll);\n\t}\n\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode;\n\n\n\t// If there's no existing element or it's the wrong type, create a new one:\n\tvnodeName = String(vnodeName);\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\n\t\tout = createNode(vnodeName, isSvgMode);\n\n\t\tif (dom) {\n\t\t\t// move children into the replacement node\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild);\n\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\n\t\t\t// recycle the old element (skips non-Element node types)\n\t\t\trecollectNodeTree(dom, true);\n\t\t}\n\t}\n\n\n\tlet fc = out.firstChild,\n\t\tprops = out[ATTR_KEY],\n\t\tvchildren = vnode.children;\n\n\tif (props==null) {\n\t\tprops = out[ATTR_KEY] = {};\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value;\n\t}\n\n\t// Optimization: fast-path for elements containing a single TextNode:\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\n\t\tif (fc.nodeValue!=vchildren[0]) {\n\t\t\tfc.nodeValue = vchildren[0];\n\t\t}\n\t}\n\t// otherwise, if there are existing or new children, diff them:\n\telse if (vchildren && vchildren.length || fc!=null) {\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null, store);\n\t}\n\n\n\t// Apply attributes/props from VNode to the DOM Element:\n\tdiffAttributes(out, vnode.attributes, props, store);\n\n\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\n\tisSvgMode = prevSvgMode;\n\n\treturn out;\n}\n\n\n/**\n * Apply child and attribute changes between a VNode and a DOM Node to the DOM.\n * @param {import('../dom').OmiElement} dom Element whose children should be compared & mutated\n * @param {Array} vchildren Array of VNodes to compare to `dom.childNodes`\n * @param {object} context Implicitly descendant context object (from most\n * recent `getChildContext()`)\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @param {boolean} isHydrating if `true`, consumes externally created elements\n * similar to hydration\n */\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating, store) {\n\tlet originalChildren = dom.childNodes,\n\t\tchildren = [],\n\t\tkeyed = {},\n\t\tkeyedLen = 0,\n\t\tmin = 0,\n\t\tlen = originalChildren.length,\n\t\tchildrenLen = 0,\n\t\tvlen = vchildren ? vchildren.length : 0,\n\t\tj, c, f, vchild, child;\n\n\t// Build up a map of keyed children and an Array of unkeyed children:\n\tif (len!==0) {\n\t\tfor (let i=0; i;\n * }\n * }\n */\n\n let id = 0\n\nexport function Component(props, context) {\n\tthis._dirty = true;\n\tthis.elementId = id++\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.context = context;\n\tthis.store = {}\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.props = props;\n\n\tthis._renderCallbacks = [];\n}\n\n\nextend(Component.prototype, {\n\n\t/**\n\t * Immediately perform a synchronous re-render of the component.\n\t * @param {() => void} callback A function to be called after component is\n\t * \tre-rendered.\n\t * @private\n\t */\n\tupdate(callback) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\trenderComponent(this, FORCE_RENDER);\n\t},\n\n\t/**\n\t * Accepts `props`, and returns a new Virtual DOM tree to build.\n\t * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n\t * @param {object} props Props (eg: JSX attributes) received from parent\n\t * \telement/component\n\t * @param {object} context Context object, as returned by the nearest\n\t * ancestor's `getChildContext()`\n\t * @returns {import('./vnode').VNode | void}\n\t */\n\trender() {}\n\n});\n","import { diff } from './vdom/diff';\n\n/**\n * Render JSX into a `parent` Element.\n * @param {import('./vnode').VNode} vnode A (JSX) VNode to render\n * @param {import('./dom').OmiElement} parent DOM element to render into\n * @param {import('./dom').OmiElement} [merge] Attempt to re-use an existing DOM tree rooted at\n * `merge`\n * @public\n *\n * @example\n * // render a div into :\n * render(
hello!
, document.body);\n *\n * @example\n * // render a \"Thing\" component into #foo:\n * const Thing = ({ name }) => { name };\n * render(, document.querySelector('#foo'));\n */\nexport function render(vnode, parent, merge) {\n\treturn diff(merge, vnode, {}, false, typeof parent === 'string' ? document.querySelector(parent) : parent, false);\n}\n","import { h, h as createElement } from './h';\nimport { cloneElement } from './clone-element';\nimport { Component } from './component';\nimport { render } from './render';\nimport { rerender } from './render-queue';\nimport options from './options';\n\nfunction createRef() {\n\treturn {};\n}\n\nexport default {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nexport {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tcreateRef,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nif(typeof window !== 'undefined'){\n\twindow.Omis = {\n\t\th,\n\t\tcreateElement,\n\t\tcloneElement,\n\t\tcreateRef,\n\t\tComponent,\n\t\trender,\n\t\trerender,\n\t\toptions\n\t};\n}\n","import { render, h } from '../../src/omis'\n\nconst Counter = (props, store, context) => {\n console.log(context)\n return (\n
\n \n {store.count}\n \n
\n )\n}\n\nCounter.store = _ => {\n return {\n count: 1,\n add(e) {\n this.count++\n this.update()\n _.props.onChange(this.count)\n \n },\n sub() {\n this.count--\n this.update()\n _.props.onChange(this.count)\n }\n }\n}\n\nconst App = (props, store) => {\n return (\n
\n
Count from child event: {store.context.a}
\n \n
\n )\n}\n\n\nApp.store = _ => ({\n count: null,\n context: { a: 111 },\n install(){\n _.getChildContext = ()=>{\n return this.context\n }\n },\n changeHandle(count) {\n _.store.count = count\n _.update()\n }\n})\n\nrender(, 'body')"],"names":["VNode","options","runTimeComponent","styleCache","staticStyleMapping","styleId","getCtorName","ctor","i","len","length","item","attrName","push","scoper","css","prefix","toLowerCase","replace","re","RegExp","g0","g1","g2","g3","match","appendClass","addStyle","cssText","id","ele","document","getElementById","head","getElementsByTagName","parentNode","removeChild","someThingStyles","createElement","appendChild","setAttribute","window","ActiveXObject","styleSheet","textContent","addStyleToHead","style","attr","stack","EMPTY_CHILDREN","h","nodeName","attributes","children","lastSimple","child","simple","arguments","pop","undefined","String","p","constructor","props","elementId","key","vnode","extend","obj","applyRef","ref","value","current","defer","Promise","resolve","then","bind","setTimeout","cloneElement","slice","call","NO_RENDER","SYNC_RENDER","FORCE_RENDER","ASYNC_RENDER","ATTR_KEY","IS_NON_DIMENSIONAL","items","enqueueRender","component","_dirty","debounceRendering","rerender","renderComponent","isSameNodeType","node","hydrating","splitText","_componentConstructor","isNamedNode","normalizedNodeName","getNodeProps","defaultProps","createNode","isSvg","createElementNS","removeNode","setAccessor","name","old","store","className","test","innerHTML","__html","useCapture","substring","addEventListener","eventProxy","removeEventListener","_listeners","e","removeAttribute","ns","removeAttributeNS","setAttributeNS","type","event","mounts","diffLevel","isSvgMode","flushMounts","c","shift","afterMount","installed","diff","dom","context","mountAll","parent","componentRoot","ownerSVGElement","ret","idiff","out","prevSvgMode","_component","nodeValue","createTextNode","replaceChild","recollectNodeTree","vnodeName","buildComponentFromVNode","firstChild","fc","vchildren","a","nextSibling","innerDiffNode","dangerouslySetInnerHTML","diffAttributes","isHydrating","originalChildren","childNodes","keyed","keyedLen","min","childrenLen","vlen","j","f","vchild","__key","trim","insertBefore","unmountOnly","unmountComponent","removeChildren","lastChild","next","previousSibling","attrs","recyclerComponents","createComponent","Ctor","inst","Component","render","doRender","update","nextBase","splice","setComponentProps","renderMode","_disable","__ref","base","install","receiveProps","__needUpdate_","prevContext","prevProps","syncComponentUpdates","isChild","previousProps","previousContext","isUpdate","initialBase","initialChildComponent","skip","snapshot","rendered","cbase","beforeUpdate","beforeRender","getChildContext","getSnapshotBeforeUpdate","childComponent","toUnmount","childProps","_parentComponent","baseParent","componentRef","t","updated","afterUpdate","_renderCallbacks","originalComponent","oldDom","isDirectOwner","isOwner","beforeUnmount","uninstall","inner","prototype","callback","merge","querySelector","createRef","Omis","Counter","console","log","sub","count","add","_","onChange","App","changeHandle"],"mappings":";;;CAAA;;;;;;;;AAQA,CAAO,IAAMA,QAAQ,SAASA,KAAT,GAAiB,EAA/B;;CCRP;;;;;CAKA;;;;;;;;;;;;;CAaA;CACA,IAAMC,UAAU;CACfC,oBAAkB,EADH;CAEfC,cAAY,EAFG;CAGfC,sBAAoB;CAHL,CAAhB;;CCjBA,IAAIC,UAAU,CAAd;;AAEA,CAAO,SAASC,WAAT,CAAqBC,IAArB,EAA2B;CAChC,OAAK,IAAIC,IAAI,CAAR,EAAWC,MAAMR,QAAQE,UAAR,CAAmBO,MAAzC,EAAiDF,IAAIC,GAArD,EAA0DD,GAA1D,EAA+D;CAC7D,QAAIG,OAAOV,QAAQE,UAAR,CAAmBK,CAAnB,CAAX;;CAEA,QAAIG,KAAKJ,IAAL,KAAcA,IAAlB,EAAwB;CACtB,aAAOI,KAAKC,QAAZ;CACD;CACF;;CAED,MAAIA,WAAW,QAAQP,OAAvB;CACAJ,UAAQE,UAAR,CAAm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/examples/context/index.html new file mode 100644 index 000000000..46bbb4d59 --- /dev/null +++ b/packages/omis/examples/context/index.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/omis/examples/context/main.js b/packages/omis/examples/context/main.js new file mode 100644 index 000000000..f01a15016 --- /dev/null +++ b/packages/omis/examples/context/main.js @@ -0,0 +1,55 @@ +import { render, h } from '../../src/omis' + +const Counter = (props, store, context) => { + console.log(context) + return ( +
+ + {store.count} + +
+ ) +} + +Counter.store = _ => { + return { + count: 1, + add(e) { + this.count++ + this.update() + _.props.onChange(this.count) + + }, + sub() { + this.count-- + this.update() + _.props.onChange(this.count) + } + } +} + +const App = (props, store) => { + return ( +
+
Count from child event: {store.context.a}
+ +
+ ) +} + + +App.store = _ => ({ + count: null, + context: { a: 111 }, + install(){ + _.getChildContext = ()=>{ + return this.context + } + }, + changeHandle(count) { + _.store.count = count + _.update() + } +}) + +render(, 'body') \ No newline at end of file diff --git a/packages/omis/package.json b/packages/omis/package.json index 7aa034ba7..ccd2bfe48 100644 --- a/packages/omis/package.json +++ b/packages/omis/package.json @@ -1,6 +1,6 @@ { "name": "omis", - "version": "0.5.0", + "version": "0.6.0", "description": "Functional Component with store, scoped css and easy hyperscript.", "main": "dist/omis.js", "jsnext:main": "dist/omis.esm.js", diff --git a/packages/omis/src/component.js b/packages/omis/src/component.js index 01fc25a91..eaae32347 100755 --- a/packages/omis/src/component.js +++ b/packages/omis/src/component.js @@ -11,7 +11,7 @@ import { renderComponent } from './vdom/component'; * * @example * class MyFoo extends Component { - * render(props, state) { + * render(props) { * return
; * } * } @@ -34,12 +34,6 @@ export function Component(props, context) { */ this.props = props; - /** - * @public - * @type {object} - */ - this.state = this.state || {}; - this._renderCallbacks = []; } @@ -58,11 +52,10 @@ extend(Component.prototype, { }, /** - * Accepts `props` and `state`, and returns a new Virtual DOM tree to build. + * Accepts `props`, and returns a new Virtual DOM tree to build. * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx). * @param {object} props Props (eg: JSX attributes) received from parent * element/component - * @param {object} state The component's current state * @param {object} context Context object, as returned by the nearest * ancestor's `getChildContext()` * @returns {import('./vnode').VNode | void} diff --git a/packages/omis/src/omis.d.ts b/packages/omis/src/omis.d.ts index 2c6d11df7..b2e4f3e5e 100755 --- a/packages/omis/src/omis.d.ts +++ b/packages/omis/src/omis.d.ts @@ -79,9 +79,9 @@ declare namespace Omis { componentWillUnmount?(): void; getChildContext?(): object; componentWillReceiveProps?(nextProps: Readonly

, nextContext: any): void; - shouldComponentUpdate?(nextProps: Readonly

, nextState: Readonly, nextContext: any): boolean; - componentWillUpdate?(nextProps: Readonly

, nextState: Readonly, nextContext: any): void; - componentDidUpdate?(previousProps: Readonly

, previousState: Readonly, previousContext: any): void; + shouldComponentUpdate?(nextProps: Readonly

, nextContext: any): boolean; + componentWillUpdate?(nextProps: Readonly

, nextContext: any): void; + componentDidUpdate?(previousProps: Readonly

, previousContext: any): void; } abstract class Component { @@ -90,14 +90,13 @@ declare namespace Omis { static displayName?: string; static defaultProps?: any; - state: Readonly; props: RenderableProps

; context: any; base?: HTMLElement; update(callback?: () => void): void; - abstract render(props?: RenderableProps

, state?: Readonly, context?: any): ComponentChild; + abstract render(props?: RenderableProps

, context?: any): ComponentChild; // Add these variables to avoid descendants shadowing them (some from properties.json for minification) private __key; @@ -108,7 +107,6 @@ declare namespace Omis { private nextBase; private prevContext; private prevProps; - private prevState; private __d; private __x; private __l; diff --git a/packages/omis/src/vdom/component-recycler.js b/packages/omis/src/vdom/component-recycler.js index cf452412b..c2550575d 100755 --- a/packages/omis/src/vdom/component-recycler.js +++ b/packages/omis/src/vdom/component-recycler.js @@ -40,6 +40,6 @@ export function createComponent(Ctor, props, context) { /** The `.render()` method for a PFC backing instance. */ -function doRender(props) { - return this.constructor(props, this.store); +function doRender(props, context) { + return this.constructor(props, this.store, context); } diff --git a/packages/omis/src/vdom/component.js b/packages/omis/src/vdom/component.js index b4717ae69..7acd8dffc 100755 --- a/packages/omis/src/vdom/component.js +++ b/packages/omis/src/vdom/component.js @@ -24,21 +24,19 @@ export function setComponentProps(component, props, renderMode, context, mountAl delete props.ref; delete props.key; - if (typeof component.constructor.getDerivedStateFromProps === 'undefined') { - if (!component.base || mountAll) { - //if (component.componentWillMount) component.componentWillMount(); - if (component.store.install) component.store.install() - } - else { - // if (component.componentWillReceiveProps) { - // component.componentWillReceiveProps(props, context); - // } - if (component.store.receiveProps) { - component.__needUpdate_ = component.store.receiveProps(props, context) - } + if (!component.base || mountAll) { + //if (component.componentWillMount) component.componentWillMount(); + if (component.store.install) component.store.install() + } + else { + // if (component.componentWillReceiveProps) { + // component.componentWillReceiveProps(props, context); + // } + if (component.store.receiveProps) { + component.__needUpdate_ = component.store.receiveProps(props, context) } } - + if (context && context!==component.context) { if (!component.prevContext) component.prevContext = component.context; component.context = context; @@ -76,10 +74,8 @@ export function renderComponent(component, renderMode, mountAll, isChild) { if (component._disable) return; let props = component.props, - state = component.state, context = component.context, previousProps = component.prevProps || props, - previousState = component.prevState || state, previousContext = component.prevContext || context, isUpdate = component.base, nextBase = component.nextBase, @@ -89,21 +85,15 @@ export function renderComponent(component, renderMode, mountAll, isChild) { snapshot = previousContext, rendered, inst, cbase; - if (component.constructor.getDerivedStateFromProps) { - state = extend(extend({}, state), component.constructor.getDerivedStateFromProps(props, state)); - component.state = state; - } - // if updating if (isUpdate) { component.props = previousProps; - component.state = previousState; component.context = previousContext; if (component.__needUpdate_ !== false) { skip = false if (component.store.beforeUpdate) { - component.store.beforeUpdate(props, state, context) + component.store.beforeUpdate(props, context) } } else { skip = true @@ -111,11 +101,10 @@ export function renderComponent(component, renderMode, mountAll, isChild) { delete component.__needUpdate_ component.props = props; - component.state = state; component.context = context; } - component.prevProps = component.prevState = component.prevContext = component.nextBase = null; + component.prevProps = component.prevContext = component.nextBase = null; component._dirty = false; if (!skip) { @@ -123,7 +112,7 @@ export function renderComponent(component, renderMode, mountAll, isChild) { if(component.store.beforeRender){ component.store.beforeRender() } - rendered = component.render(props, state, context); + rendered = component.render(props, context); options.runTimeComponent = null // context to pass to the child, can be updated via (grand-)parent component @@ -132,7 +121,7 @@ export function renderComponent(component, renderMode, mountAll, isChild) { } if (isUpdate && component.getSnapshotBeforeUpdate) { - snapshot = component.getSnapshotBeforeUpdate(previousProps, previousState); + snapshot = component.getSnapshotBeforeUpdate(previousProps); } let childComponent = rendered && rendered.nodeName, @@ -211,11 +200,8 @@ export function renderComponent(component, renderMode, mountAll, isChild) { // Note: disabled as it causes duplicate hooks, see https://github.com/developit/Omi/issues/750 // flushMounts(); - // if (component.componentDidUpdate) { - // component.componentDidUpdate(previousProps, previousState, snapshot); - // } if (component.store.updated) { - component.store.updated(previousProps, previousState, snapshot); + component.store.updated(previousProps, snapshot); } if (options.afterUpdate) options.afterUpdate(component); } diff --git a/packages/omis/test/browser/context.js b/packages/omis/test/browser/context.js new file mode 100644 index 000000000..6a3876a6e --- /dev/null +++ b/packages/omis/test/browser/context.js @@ -0,0 +1,30 @@ +import { + render, h +} from '../../src/omis' + +describe('context', () => { + let scratch + //const Empty = () => null + + before(() => { + scratch = document.createElement('div') + ; (document.body || document.documentElement).appendChild(scratch) + }) + + beforeEach(() => { + //let c = scratch.firstElementChild; + //if (c) render(, scratch, { merge: c }) + scratch.innerHTML = '' + }) + + after(() => { + scratch.parentNode.removeChild(scratch) + scratch = null + }) + + it('simple test', () => { + + expect(1).to.deep.equal(1) + }) + +})