govuk_publishing_components 12.13.0 → 12.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/components/accessible-autocomplete.js +37 -0
- data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +6 -5
- data/app/assets/javascripts/govuk_publishing_components/components/copy-to-clipboard.js +15 -15
- data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +2 -4
- data/app/assets/javascripts/govuk_publishing_components/components/initial-focus.js +8 -8
- data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_accessible-autocomplete.scss +16 -0
- data/app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb +24 -0
- data/app/views/govuk_publishing_components/components/docs/accessible_autocomplete.yml +42 -0
- data/config/initializers/assets.rb +1 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/accessible-autocomplete/CHANGELOG.md +269 -0
- data/node_modules/accessible-autocomplete/CONTRIBUTING.md +150 -0
- data/node_modules/accessible-autocomplete/LICENSE.txt +20 -0
- data/node_modules/accessible-autocomplete/Procfile +1 -0
- data/node_modules/accessible-autocomplete/README.md +416 -0
- data/node_modules/accessible-autocomplete/accessibility-criteria.md +42 -0
- data/node_modules/accessible-autocomplete/app.json +15 -0
- data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.css +1 -0
- data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js +2 -0
- data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js.map +1 -0
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.preact.min.js +2 -0
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.preact.min.js.map +1 -0
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.react.min.js +2 -0
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.react.min.js.map +1 -0
- data/node_modules/accessible-autocomplete/examples/form.html +671 -0
- data/node_modules/accessible-autocomplete/examples/index.html +616 -0
- data/node_modules/accessible-autocomplete/examples/preact/index.html +346 -0
- data/node_modules/accessible-autocomplete/examples/react/index.html +347 -0
- data/node_modules/accessible-autocomplete/package.json +192 -0
- data/node_modules/accessible-autocomplete/preact.js +1 -0
- data/node_modules/accessible-autocomplete/react.js +1 -0
- data/node_modules/accessible-autocomplete/scripts/check-staged.js +14 -0
- data/node_modules/accessible-autocomplete/src/autocomplete.css +141 -0
- data/node_modules/accessible-autocomplete/src/autocomplete.js +524 -0
- data/node_modules/accessible-autocomplete/src/dropdown-arrow-down.js +11 -0
- data/node_modules/accessible-autocomplete/src/status.js +80 -0
- data/node_modules/accessible-autocomplete/src/wrapper.js +60 -0
- data/node_modules/accessible-autocomplete/test/functional/dropdown-arrow-down.js +44 -0
- data/node_modules/accessible-autocomplete/test/functional/index.js +485 -0
- data/node_modules/accessible-autocomplete/test/functional/wrapper.js +267 -0
- data/node_modules/accessible-autocomplete/test/integration/index.js +188 -0
- data/node_modules/accessible-autocomplete/test/karma.config.js +42 -0
- data/node_modules/accessible-autocomplete/test/wdio.config.js +80 -0
- data/node_modules/accessible-autocomplete/webpack.config.babel.js +193 -0
- data/node_modules/preact/LICENSE +21 -0
- data/node_modules/preact/README.md +580 -0
- data/node_modules/preact/debug.js +112 -0
- data/node_modules/preact/debug.js.map +1 -0
- data/node_modules/preact/debug/index.js +121 -0
- data/node_modules/preact/devtools.js +403 -0
- data/node_modules/preact/devtools.js.map +1 -0
- data/node_modules/preact/devtools/devtools.js +395 -0
- data/node_modules/preact/devtools/index.js +4 -0
- data/node_modules/preact/dist/preact.d.ts +891 -0
- data/node_modules/preact/dist/preact.dev.js +718 -0
- data/node_modules/preact/dist/preact.dev.js.map +1 -0
- data/node_modules/preact/dist/preact.js +408 -0
- data/node_modules/preact/dist/preact.js.flow +13 -0
- data/node_modules/preact/dist/preact.js.map +1 -0
- data/node_modules/preact/dist/preact.min.js +2 -0
- data/node_modules/preact/dist/preact.min.js.map +1 -0
- data/node_modules/preact/dist/preact.mjs +715 -0
- data/node_modules/preact/dist/preact.mjs.map +1 -0
- data/node_modules/preact/package.json +218 -0
- data/node_modules/preact/src/clone-element.js +18 -0
- data/node_modules/preact/src/component.js +90 -0
- data/node_modules/preact/src/constants.js +17 -0
- data/node_modules/preact/src/dom/index.js +138 -0
- data/node_modules/preact/src/h.js +86 -0
- data/node_modules/preact/src/options.js +22 -0
- data/node_modules/preact/src/preact.d.ts +891 -0
- data/node_modules/preact/src/preact.js +26 -0
- data/node_modules/preact/src/preact.js.flow +13 -0
- data/node_modules/preact/src/render-queue.js +28 -0
- data/node_modules/preact/src/render.js +22 -0
- data/node_modules/preact/src/util.js +19 -0
- data/node_modules/preact/src/vdom/component-recycler.js +48 -0
- data/node_modules/preact/src/vdom/component.js +296 -0
- data/node_modules/preact/src/vdom/diff.js +336 -0
- data/node_modules/preact/src/vdom/index.js +54 -0
- data/node_modules/preact/src/vnode.js +9 -0
- data/node_modules/preact/typings.json +5 -0
- metadata +78 -2
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"preact.dev.js","sources":["../src/vnode.js","../src/options.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/preact.js","../src/preact.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<VNode | string>} 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 Preact event listeners. The return value (if any) replaces the native browser event given to event listeners\n */\n\n/** @type {Options} */\nconst options = {};\n\nexport default options;\n","import { VNode } from './vnode';\nimport options from './options';\n\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 * `<div id=\"foo\" name=\"bar\">Hello!</div>`\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 ? undefined : attributes;\n\tp.key = attributes==null ? undefined : 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/**\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<import('./vnode').VNode>} [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 = '__preactattr_';\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<import('./component').Component>}\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, list = items;\n\titems = [];\n\twhile ( (p = list.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').PreactElement} 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').PreactElement} 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 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.<string, EventListener>} EventListenerMap\n */\n\n/**\n * Properties Preact adds to elements it creates\n * @typedef PreactElementExtensions\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 Preact properties\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\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 {PreactElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n\t/** @type {PreactElement} */\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 {PreactElement} 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) {\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\tif (old) old(null);\n\t\tif (value) 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;\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 { removeNode } from '../dom/index';\n\n/**\n * Queue of components that have been mounted and are awaiting componentDidMount\n * @type {Array<import('../component').Component>}\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.pop())) {\n\t\tif (options.afterMount) options.afterMount(c);\n\t\tif (c.componentDidMount) c.componentDidMount();\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').PreactElement} 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').PreactElement} The created/mutated element\n * @private\n */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\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);\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').PreactElement} 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) {\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/preact/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);\n\t}\n\n\n\t// Apply attributes/props from VNode to the DOM Element:\n\tdiffAttributes(out, vnode.attributes, props);\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').PreactElement} dom Element whose children should be compared & mutated\n * @param {Array<import('../vnode').VNode>} 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) {\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<len; i++) {\n\t\t\tlet child = originalChildren[i],\n\t\t\t\tprops = child[ATTR_KEY],\n\t\t\t\tkey = vlen && props ? child._component ? child._component.__key : props.key : null;\n\t\t\tif (key!=null) {\n\t\t\t\tkeyedLen++;\n\t\t\t\tkeyed[key] = child;\n\t\t\t}\n\t\t\telse if (props || (child.splitText!==undefined ? (isHydrating ? child.nodeValue.trim() : true) : isHydrating)) {\n\t\t\t\tchildren[childrenLen++] = child;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (vlen!==0) {\n\t\tfor (let i=0; i<vlen; i++) {\n\t\t\tvchild = vchildren[i];\n\t\t\tchild = null;\n\n\t\t\t// attempt to find a node based on key matching\n\t\t\tlet key = vchild.key;\n\t\t\tif (key!=null) {\n\t\t\t\tif (keyedLen && keyed[key]!==undefined) {\n\t\t\t\t\tchild = keyed[key];\n\t\t\t\t\tkeyed[key] = undefined;\n\t\t\t\t\tkeyedLen--;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// attempt to pluck a node of the same type from the existing children\n\t\t\telse if (min<childrenLen) {\n\t\t\t\tfor (j=min; j<childrenLen; j++) {\n\t\t\t\t\tif (children[j]!==undefined && isSameNodeType(c = children[j], vchild, isHydrating)) {\n\t\t\t\t\t\tchild = c;\n\t\t\t\t\t\tchildren[j] = undefined;\n\t\t\t\t\t\tif (j===childrenLen-1) childrenLen--;\n\t\t\t\t\t\tif (j===min) min++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// morph the matched/found/created DOM child to match vchild (deep)\n\t\t\tchild = idiff(child, vchild, context, mountAll);\n\n\t\t\tf = originalChildren[i];\n\t\t\tif (child && child!==dom && child!==f) {\n\t\t\t\tif (f==null) {\n\t\t\t\t\tdom.appendChild(child);\n\t\t\t\t}\n\t\t\t\telse if (child===f.nextSibling) {\n\t\t\t\t\tremoveNode(f);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdom.insertBefore(child, f);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\t// remove unused keyed children:\n\tif (keyedLen) {\n\t\tfor (let i in keyed) if (keyed[i]!==undefined) recollectNodeTree(keyed[i], false);\n\t}\n\n\t// remove orphaned unkeyed children:\n\twhile (min<=childrenLen) {\n\t\tif ((child = children[childrenLen--])!==undefined) recollectNodeTree(child, false);\n\t}\n}\n\n\n\n/**\n * Recursively recycle (or just unmount) a node and its descendants.\n * @param {import('../dom').PreactElement} node DOM node to start\n * unmount/removal from\n * @param {boolean} [unmountOnly=false] If `true`, only triggers unmount\n * lifecycle, skips removal\n */\nexport function recollectNodeTree(node, unmountOnly) {\n\tlet component = node._component;\n\tif (component) {\n\t\t// if node is owned by a Component, unmount that component (ends up recursing back here)\n\t\tunmountComponent(component);\n\t}\n\telse {\n\t\t// If the node's VNode had a ref function, invoke it with null here.\n\t\t// (this is part of the React spec, and smart for unsetting references)\n\t\tif (node[ATTR_KEY]!=null && node[ATTR_KEY].ref) node[ATTR_KEY].ref(null);\n\n\t\tif (unmountOnly===false || node[ATTR_KEY]==null) {\n\t\t\tremoveNode(node);\n\t\t}\n\n\t\tremoveChildren(node);\n\t}\n}\n\n\n/**\n * Recollect/unmount all children.\n *\t- we use .lastChild here because it causes less reflow than .firstChild\n *\t- it's also cheaper than accessing the .childNodes Live NodeList\n */\nexport function removeChildren(node) {\n\tnode = node.lastChild;\n\twhile (node) {\n\t\tlet next = node.previousSibling;\n\t\trecollectNodeTree(node, true);\n\t\tnode = next;\n\t}\n}\n\n\n/**\n * Apply differences in attributes from a VNode to the given DOM Element.\n * @param {import('../dom').PreactElement} dom Element with attributes to diff `attrs` against\n * @param {object} attrs The desired end-state key-value attribute pairs\n * @param {object} old Current/previous attributes (from previous VNode or\n * element's prop cache)\n */\nfunction diffAttributes(dom, attrs, old) {\n\tlet name;\n\n\t// remove attributes no longer present on the vnode by setting them to undefined\n\tfor (name in old) {\n\t\tif (!(attrs && attrs[name]!=null) && old[name]!=null) {\n\t\t\tsetAccessor(dom, name, old[name], old[name] = undefined, isSvgMode);\n\t\t}\n\t}\n\n\t// add new & update changed attributes\n\tfor (name in attrs) {\n\t\tif (name!=='children' && name!=='innerHTML' && (!(name in old) || attrs[name]!==(name==='value' || name==='checked' ? dom[name] : old[name]))) {\n\t\t\tsetAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode);\n\t\t}\n\t}\n}\n","import { Component } from '../component';\n\n/**\n * Retains a pool of Components for re-use.\n * @type {Component[]}\n * @private\n */\nexport const recyclerComponents = [];\n\n\n/**\n * Create a component. Normalizes differences between PFC's and classful\n * Components.\n * @param {function} Ctor The constructor of the component to create\n * @param {object} props The initial props of the component\n * @param {object} context The initial context of the component\n * @returns {import('../component').Component}\n */\nexport function createComponent(Ctor, props, context) {\n\tlet inst, i = recyclerComponents.length;\n\n\tif (Ctor.prototype && Ctor.prototype.render) {\n\t\tinst = new Ctor(props, context);\n\t\tComponent.call(inst, props, context);\n\t}\n\telse {\n\t\tinst = new Component(props, context);\n\t\tinst.constructor = Ctor;\n\t\tinst.render = doRender;\n\t}\n\n\n\twhile (i--) {\n\t\tif (recyclerComponents[i].constructor===Ctor) {\n\t\t\tinst.nextBase = recyclerComponents[i].nextBase;\n\t\t\trecyclerComponents.splice(i, 1);\n\t\t\treturn inst;\n\t\t}\n\t}\n\n\treturn inst;\n}\n\n\n/** The `.render()` method for a PFC backing instance. */\nfunction doRender(props, state, context) {\n\treturn this.constructor(props, context);\n}\n","import { SYNC_RENDER, NO_RENDER, FORCE_RENDER, ASYNC_RENDER, ATTR_KEY } from '../constants';\nimport options from '../options';\nimport { extend } from '../util';\nimport { enqueueRender } from '../render-queue';\nimport { getNodeProps } from './index';\nimport { diff, mounts, diffLevel, flushMounts, recollectNodeTree, removeChildren } from './diff';\nimport { createComponent, recyclerComponents } from './component-recycler';\nimport { removeNode } from '../dom/index';\n\n/**\n * Set a component's `props` and possibly re-render the component\n * @param {import('../component').Component} component The Component to set props on\n * @param {object} props The new props\n * @param {number} renderMode Render options - specifies how to re-render the component\n * @param {object} context The new context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n */\nexport function setComponentProps(component, props, renderMode, context, mountAll) {\n\tif (component._disable) return;\n\tcomponent._disable = true;\n\n\tcomponent.__ref = props.ref;\n\tcomponent.__key = props.key;\n\tdelete props.ref;\n\tdelete props.key;\n\n\tif (typeof component.constructor.getDerivedStateFromProps === 'undefined') {\n\t\tif (!component.base || mountAll) {\n\t\t\tif (component.componentWillMount) component.componentWillMount();\n\t\t}\n\t\telse if (component.componentWillReceiveProps) {\n\t\t\tcomponent.componentWillReceiveProps(props, context);\n\t\t}\n\t}\n\n\tif (context && context!==component.context) {\n\t\tif (!component.prevContext) component.prevContext = component.context;\n\t\tcomponent.context = context;\n\t}\n\n\tif (!component.prevProps) component.prevProps = component.props;\n\tcomponent.props = props;\n\n\tcomponent._disable = false;\n\n\tif (renderMode!==NO_RENDER) {\n\t\tif (renderMode===SYNC_RENDER || options.syncComponentUpdates!==false || !component.base) {\n\t\t\trenderComponent(component, SYNC_RENDER, mountAll);\n\t\t}\n\t\telse {\n\t\t\tenqueueRender(component);\n\t\t}\n\t}\n\n\tif (component.__ref) component.__ref(component);\n}\n\n\n\n/**\n * Render a Component, triggering necessary lifecycle events and taking\n * High-Order Components into account.\n * @param {import('../component').Component} component The component to render\n * @param {number} [renderMode] render mode, see constants.js for available options.\n * @param {boolean} [mountAll] Whether or not to immediately mount all components\n * @param {boolean} [isChild] ?\n * @private\n */\nexport function renderComponent(component, renderMode, mountAll, isChild) {\n\tif (component._disable) return;\n\n\tlet props = component.props,\n\t\tstate = component.state,\n\t\tcontext = component.context,\n\t\tpreviousProps = component.prevProps || props,\n\t\tpreviousState = component.prevState || state,\n\t\tpreviousContext = component.prevContext || context,\n\t\tisUpdate = component.base,\n\t\tnextBase = component.nextBase,\n\t\tinitialBase = isUpdate || nextBase,\n\t\tinitialChildComponent = component._component,\n\t\tskip = false,\n\t\tsnapshot = previousContext,\n\t\trendered, inst, cbase;\n\n\tif (component.constructor.getDerivedStateFromProps) {\n\t\tstate = extend(extend({}, state), component.constructor.getDerivedStateFromProps(props, state));\n\t\tcomponent.state = state;\n\t}\n\n\t// if updating\n\tif (isUpdate) {\n\t\tcomponent.props = previousProps;\n\t\tcomponent.state = previousState;\n\t\tcomponent.context = previousContext;\n\t\tif (renderMode!==FORCE_RENDER\n\t\t\t&& component.shouldComponentUpdate\n\t\t\t&& component.shouldComponentUpdate(props, state, context) === false) {\n\t\t\tskip = true;\n\t\t}\n\t\telse if (component.componentWillUpdate) {\n\t\t\tcomponent.componentWillUpdate(props, state, context);\n\t\t}\n\t\tcomponent.props = props;\n\t\tcomponent.state = state;\n\t\tcomponent.context = context;\n\t}\n\n\tcomponent.prevProps = component.prevState = component.prevContext = component.nextBase = null;\n\tcomponent._dirty = false;\n\n\tif (!skip) {\n\t\trendered = component.render(props, state, context);\n\n\t\t// context to pass to the child, can be updated via (grand-)parent component\n\t\tif (component.getChildContext) {\n\t\t\tcontext = extend(extend({}, context), component.getChildContext());\n\t\t}\n\n\t\tif (isUpdate && component.getSnapshotBeforeUpdate) {\n\t\t\tsnapshot = component.getSnapshotBeforeUpdate(previousProps, previousState);\n\t\t}\n\n\t\tlet childComponent = rendered && rendered.nodeName,\n\t\t\ttoUnmount, base;\n\n\t\tif (typeof childComponent==='function') {\n\t\t\t// set up high order component link\n\n\t\t\tlet childProps = getNodeProps(rendered);\n\t\t\tinst = initialChildComponent;\n\n\t\t\tif (inst && inst.constructor===childComponent && childProps.key==inst.__key) {\n\t\t\t\tsetComponentProps(inst, childProps, SYNC_RENDER, context, false);\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttoUnmount = inst;\n\n\t\t\t\tcomponent._component = inst = createComponent(childComponent, childProps, context);\n\t\t\t\tinst.nextBase = inst.nextBase || nextBase;\n\t\t\t\tinst._parentComponent = component;\n\t\t\t\tsetComponentProps(inst, childProps, NO_RENDER, context, false);\n\t\t\t\trenderComponent(inst, SYNC_RENDER, mountAll, true);\n\t\t\t}\n\n\t\t\tbase = inst.base;\n\t\t}\n\t\telse {\n\t\t\tcbase = initialBase;\n\n\t\t\t// destroy high order component link\n\t\t\ttoUnmount = initialChildComponent;\n\t\t\tif (toUnmount) {\n\t\t\t\tcbase = component._component = null;\n\t\t\t}\n\n\t\t\tif (initialBase || renderMode===SYNC_RENDER) {\n\t\t\t\tif (cbase) cbase._component = null;\n\t\t\t\tbase = diff(cbase, rendered, context, mountAll || !isUpdate, initialBase && initialBase.parentNode, true);\n\t\t\t}\n\t\t}\n\n\t\tif (initialBase && base!==initialBase && inst!==initialChildComponent) {\n\t\t\tlet baseParent = initialBase.parentNode;\n\t\t\tif (baseParent && base!==baseParent) {\n\t\t\t\tbaseParent.replaceChild(base, initialBase);\n\n\t\t\t\tif (!toUnmount) {\n\t\t\t\t\tinitialBase._component = null;\n\t\t\t\t\trecollectNodeTree(initialBase, false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (toUnmount) {\n\t\t\tunmountComponent(toUnmount);\n\t\t}\n\n\t\tcomponent.base = base;\n\t\tif (base && !isChild) {\n\t\t\tlet componentRef = component,\n\t\t\t\tt = component;\n\t\t\twhile ((t=t._parentComponent)) {\n\t\t\t\t(componentRef = t).base = base;\n\t\t\t}\n\t\t\tbase._component = componentRef;\n\t\t\tbase._componentConstructor = componentRef.constructor;\n\t\t}\n\t}\n\n\tif (!isUpdate || mountAll) {\n\t\tmounts.unshift(component);\n\t}\n\telse if (!skip) {\n\t\t// Ensure that pending componentDidMount() hooks of child components\n\t\t// are called before the componentDidUpdate() hook in the parent.\n\t\t// Note: disabled as it causes duplicate hooks, see https://github.com/developit/preact/issues/750\n\t\t// flushMounts();\n\n\t\tif (component.componentDidUpdate) {\n\t\t\tcomponent.componentDidUpdate(previousProps, previousState, snapshot);\n\t\t}\n\t\tif (options.afterUpdate) options.afterUpdate(component);\n\t}\n\n\twhile (component._renderCallbacks.length) component._renderCallbacks.pop().call(component);\n\n\tif (!diffLevel && !isChild) flushMounts();\n}\n\n\n\n/**\n * Apply the Component referenced by a VNode to the DOM.\n * @param {import('../dom').PreactElement} dom The DOM node to mutate\n * @param {import('../vnode').VNode} vnode A Component-referencing VNode\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @returns {import('../dom').PreactElement} The created/mutated element\n * @private\n */\nexport function buildComponentFromVNode(dom, vnode, context, mountAll) {\n\tlet c = dom && dom._component,\n\t\toriginalComponent = c,\n\t\toldDom = dom,\n\t\tisDirectOwner = c && dom._componentConstructor===vnode.nodeName,\n\t\tisOwner = isDirectOwner,\n\t\tprops = getNodeProps(vnode);\n\twhile (c && !isOwner && (c=c._parentComponent)) {\n\t\tisOwner = c.constructor===vnode.nodeName;\n\t}\n\n\tif (c && isOwner && (!mountAll || c._component)) {\n\t\tsetComponentProps(c, props, ASYNC_RENDER, context, mountAll);\n\t\tdom = c.base;\n\t}\n\telse {\n\t\tif (originalComponent && !isDirectOwner) {\n\t\t\tunmountComponent(originalComponent);\n\t\t\tdom = oldDom = null;\n\t\t}\n\n\t\tc = createComponent(vnode.nodeName, props, context);\n\t\tif (dom && !c.nextBase) {\n\t\t\tc.nextBase = dom;\n\t\t\t// passing dom/oldDom as nextBase will recycle it if unused, so bypass recycling on L229:\n\t\t\toldDom = null;\n\t\t}\n\t\tsetComponentProps(c, props, SYNC_RENDER, context, mountAll);\n\t\tdom = c.base;\n\n\t\tif (oldDom && dom!==oldDom) {\n\t\t\toldDom._component = null;\n\t\t\trecollectNodeTree(oldDom, false);\n\t\t}\n\t}\n\n\treturn dom;\n}\n\n\n\n/**\n * Remove a component from the DOM and recycle it.\n * @param {import('../component').Component} component The Component instance to unmount\n * @private\n */\nexport function unmountComponent(component) {\n\tif (options.beforeUnmount) options.beforeUnmount(component);\n\n\tlet base = component.base;\n\n\tcomponent._disable = true;\n\n\tif (component.componentWillUnmount) component.componentWillUnmount();\n\n\tcomponent.base = null;\n\n\t// recursively tear down & recollect high-order component children:\n\tlet inner = component._component;\n\tif (inner) {\n\t\tunmountComponent(inner);\n\t}\n\telse if (base) {\n\t\tif (base[ATTR_KEY] && base[ATTR_KEY].ref) base[ATTR_KEY].ref(null);\n\n\t\tcomponent.nextBase = base;\n\n\t\tremoveNode(base);\n\t\trecyclerComponents.push(component);\n\n\t\tremoveChildren(base);\n\t}\n\n\tif (component.__ref) component.__ref(null);\n}\n","import { FORCE_RENDER } from './constants';\nimport { extend } from './util';\nimport { renderComponent } from './vdom/component';\nimport { enqueueRender } from './render-queue';\n/**\n * Base Component class.\n * Provides `setState()` and `forceUpdate()`, which trigger rendering.\n * @typedef {object} Component\n * @param {object} props The initial component props\n * @param {object} context The initial context from parent components' getChildContext\n * @public\n *\n * @example\n * class MyFoo extends Component {\n * render(props, state) {\n * return <div />;\n * }\n * }\n */\nexport function Component(props, context) {\n\tthis._dirty = true;\n\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.context = context;\n\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 * Update component state and schedule a re-render.\n\t * @param {object} state A dict of state properties to be shallowly merged\n\t * \tinto the current state, or a function that will produce such a dict. The\n\t * \tfunction is called with the current state and props.\n\t * @param {() => void} callback A function to be called once component state is\n\t * \tupdated\n\t */\n\tsetState(state, callback) {\n\t\tif (!this.prevState) this.prevState = this.state;\n\t\tthis.state = extend(\n\t\t\textend({}, this.state),\n\t\t\ttypeof state === 'function' ? state(this.state, this.props) : state\n\t\t);\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t},\n\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\tforceUpdate(callback) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\trenderComponent(this, FORCE_RENDER);\n\t},\n\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').PreactElement} parent DOM element to render into\n * @param {import('./dom').PreactElement} [merge] Attempt to re-use an existing DOM tree rooted at\n * `merge`\n * @public\n *\n * @example\n * // render a div into <body>:\n * render(<div id=\"hello\">hello!</div>, document.body);\n *\n * @example\n * // render a \"Thing\" component into #foo:\n * const Thing = ({ name }) => <span>{ name }</span>;\n * render(<Thing name=\"one\" />, document.querySelector('#foo'));\n */\nexport function render(vnode, parent, merge) {\n\treturn diff(merge, vnode, {}, false, 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\nexport default {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nexport {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n","\n\t\t\t\timport preact from './preact';\n\t\t\t\tif (typeof module!='undefined') module.exports = preact;\n\t\t\t\telse self.preact = preact;\n\t\t\t"],"names":["VNode","options","stack","EMPTY_CHILDREN","h","nodeName","attributes","children","lastSimple","child","simple","i","arguments","length","push","pop","undefined","String","p","key","vnode","extend","obj","props","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","list","renderComponent","isSameNodeType","node","hydrating","splitText","_componentConstructor","isNamedNode","normalizedNodeName","toLowerCase","getNodeProps","defaultProps","createNode","isSvg","document","createElementNS","createElement","removeNode","parentNode","removeChild","setAccessor","name","old","value","className","style","cssText","test","innerHTML","__html","useCapture","replace","substring","addEventListener","eventProxy","removeEventListener","_listeners","e","removeAttribute","ns","removeAttributeNS","setAttributeNS","setAttribute","type","event","mounts","diffLevel","isSvgMode","flushMounts","c","afterMount","componentDidMount","diff","dom","context","mountAll","parent","componentRoot","ownerSVGElement","ret","idiff","appendChild","out","prevSvgMode","_component","nodeValue","createTextNode","replaceChild","recollectNodeTree","vnodeName","buildComponentFromVNode","firstChild","fc","vchildren","a","nextSibling","innerDiffNode","dangerouslySetInnerHTML","diffAttributes","isHydrating","originalChildren","childNodes","keyed","keyedLen","min","len","childrenLen","vlen","j","f","vchild","__key","trim","insertBefore","unmountOnly","unmountComponent","ref","removeChildren","lastChild","next","previousSibling","attrs","recyclerComponents","createComponent","Ctor","inst","prototype","render","Component","constructor","doRender","nextBase","splice","state","setComponentProps","renderMode","_disable","__ref","getDerivedStateFromProps","base","componentWillMount","componentWillReceiveProps","prevContext","prevProps","syncComponentUpdates","isChild","previousProps","previousState","prevState","previousContext","isUpdate","initialBase","initialChildComponent","skip","snapshot","rendered","cbase","shouldComponentUpdate","componentWillUpdate","getChildContext","getSnapshotBeforeUpdate","childComponent","toUnmount","childProps","_parentComponent","baseParent","componentRef","t","unshift","componentDidUpdate","afterUpdate","_renderCallbacks","originalComponent","oldDom","isDirectOwner","isOwner","beforeUnmount","componentWillUnmount","inner","setState","callback","forceUpdate","merge","module","exports","preact","self"],"mappings":";;;CAQO,IAAMA,QAAQ,SAASA,KAAT,GAAiB,EAA/B;;CCWP,IAAMC,UAAU,EAAhB;;CCfA,IAAMC,QAAQ,EAAd;;CAEA,IAAMC,iBAAiB,EAAvB;;AAiCA,CAAO,SAASC,CAAT,CAAWC,QAAX,EAAqBC,UAArB,EAAiC;CACvC,KAAIC,WAASJ,cAAb;CAAA,KAA6BK,mBAA7B;CAAA,KAAyCC,cAAzC;CAAA,KAAgDC,eAAhD;CAAA,K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;ACdD,cAAe;CACdjG,KADc;CAEdyD,iBAFc;CAGd/B,2BAHc;CAId2H,qBAJc;CAKdD,eALc;CAMd5G,mBANc;CAOd3C;CAPc,CAAf;;CCLI,IAAI,OAAO+M,MAAP,IAAe,WAAnB,EAAgCA,OAAOC,OAAP,GAAiBC,MAAjB,CAAhC,KACKC,KAAKD,MAAL,GAAcA,MAAd;;;;"}
|
@@ -0,0 +1,408 @@
|
|
1
|
+
!function() {
|
2
|
+
'use strict';
|
3
|
+
function h(nodeName, attributes) {
|
4
|
+
var lastSimple, child, simple, i, children = EMPTY_CHILDREN;
|
5
|
+
for (i = arguments.length; i-- > 2; ) stack.push(arguments[i]);
|
6
|
+
if (attributes && null != attributes.children) {
|
7
|
+
if (!stack.length) stack.push(attributes.children);
|
8
|
+
delete attributes.children;
|
9
|
+
}
|
10
|
+
while (stack.length) if ((child = stack.pop()) && void 0 !== child.pop) for (i = child.length; i--; ) stack.push(child[i]); else {
|
11
|
+
if ('boolean' == typeof child) child = null;
|
12
|
+
if (simple = 'function' != typeof nodeName) if (null == child) child = ''; else if ('number' == typeof child) child = String(child); else if ('string' != typeof child) simple = !1;
|
13
|
+
if (simple && lastSimple) children[children.length - 1] += child; else if (children === EMPTY_CHILDREN) children = [ child ]; else children.push(child);
|
14
|
+
lastSimple = simple;
|
15
|
+
}
|
16
|
+
var p = new VNode();
|
17
|
+
p.nodeName = nodeName;
|
18
|
+
p.children = children;
|
19
|
+
p.attributes = null == attributes ? void 0 : attributes;
|
20
|
+
p.key = null == attributes ? void 0 : attributes.key;
|
21
|
+
if (void 0 !== options.vnode) options.vnode(p);
|
22
|
+
return p;
|
23
|
+
}
|
24
|
+
function extend(obj, props) {
|
25
|
+
for (var i in props) obj[i] = props[i];
|
26
|
+
return obj;
|
27
|
+
}
|
28
|
+
function cloneElement(vnode, props) {
|
29
|
+
return h(vnode.nodeName, extend(extend({}, vnode.attributes), props), arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children);
|
30
|
+
}
|
31
|
+
function enqueueRender(component) {
|
32
|
+
if (!component.__d && (component.__d = !0) && 1 == items.push(component)) (options.debounceRendering || defer)(rerender);
|
33
|
+
}
|
34
|
+
function rerender() {
|
35
|
+
var p, list = items;
|
36
|
+
items = [];
|
37
|
+
while (p = list.pop()) if (p.__d) renderComponent(p);
|
38
|
+
}
|
39
|
+
function isSameNodeType(node, vnode, hydrating) {
|
40
|
+
if ('string' == typeof vnode || 'number' == typeof vnode) return void 0 !== node.splitText;
|
41
|
+
if ('string' == typeof vnode.nodeName) return !node._componentConstructor && isNamedNode(node, vnode.nodeName); else return hydrating || node._componentConstructor === vnode.nodeName;
|
42
|
+
}
|
43
|
+
function isNamedNode(node, nodeName) {
|
44
|
+
return node.__n === nodeName || node.nodeName.toLowerCase() === nodeName.toLowerCase();
|
45
|
+
}
|
46
|
+
function getNodeProps(vnode) {
|
47
|
+
var props = extend({}, vnode.attributes);
|
48
|
+
props.children = vnode.children;
|
49
|
+
var defaultProps = vnode.nodeName.defaultProps;
|
50
|
+
if (void 0 !== defaultProps) for (var i in defaultProps) if (void 0 === props[i]) props[i] = defaultProps[i];
|
51
|
+
return props;
|
52
|
+
}
|
53
|
+
function createNode(nodeName, isSvg) {
|
54
|
+
var node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);
|
55
|
+
node.__n = nodeName;
|
56
|
+
return node;
|
57
|
+
}
|
58
|
+
function removeNode(node) {
|
59
|
+
var parentNode = node.parentNode;
|
60
|
+
if (parentNode) parentNode.removeChild(node);
|
61
|
+
}
|
62
|
+
function setAccessor(node, name, old, value, isSvg) {
|
63
|
+
if ('className' === name) name = 'class';
|
64
|
+
if ('key' === name) ; else if ('ref' === name) {
|
65
|
+
if (old) old(null);
|
66
|
+
if (value) value(node);
|
67
|
+
} else if ('class' === name && !isSvg) node.className = value || ''; else if ('style' === name) {
|
68
|
+
if (!value || 'string' == typeof value || 'string' == typeof old) node.style.cssText = value || '';
|
69
|
+
if (value && 'object' == typeof value) {
|
70
|
+
if ('string' != typeof old) for (var i in old) if (!(i in value)) node.style[i] = '';
|
71
|
+
for (var i in value) node.style[i] = 'number' == typeof value[i] && !1 === IS_NON_DIMENSIONAL.test(i) ? value[i] + 'px' : value[i];
|
72
|
+
}
|
73
|
+
} else if ('dangerouslySetInnerHTML' === name) {
|
74
|
+
if (value) node.innerHTML = value.__html || '';
|
75
|
+
} else if ('o' == name[0] && 'n' == name[1]) {
|
76
|
+
var useCapture = name !== (name = name.replace(/Capture$/, ''));
|
77
|
+
name = name.toLowerCase().substring(2);
|
78
|
+
if (value) {
|
79
|
+
if (!old) node.addEventListener(name, eventProxy, useCapture);
|
80
|
+
} else node.removeEventListener(name, eventProxy, useCapture);
|
81
|
+
(node.__l || (node.__l = {}))[name] = value;
|
82
|
+
} else if ('list' !== name && 'type' !== name && !isSvg && name in node) {
|
83
|
+
try {
|
84
|
+
node[name] = null == value ? '' : value;
|
85
|
+
} catch (e) {}
|
86
|
+
if ((null == value || !1 === value) && 'spellcheck' != name) node.removeAttribute(name);
|
87
|
+
} else {
|
88
|
+
var ns = isSvg && name !== (name = name.replace(/^xlink:?/, ''));
|
89
|
+
if (null == value || !1 === value) if (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase()); else node.removeAttribute(name); else if ('function' != typeof value) if (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value); else node.setAttribute(name, value);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
function eventProxy(e) {
|
93
|
+
return this.__l[e.type](options.event && options.event(e) || e);
|
94
|
+
}
|
95
|
+
function flushMounts() {
|
96
|
+
var c;
|
97
|
+
while (c = mounts.pop()) {
|
98
|
+
if (options.afterMount) options.afterMount(c);
|
99
|
+
if (c.componentDidMount) c.componentDidMount();
|
100
|
+
}
|
101
|
+
}
|
102
|
+
function diff(dom, vnode, context, mountAll, parent, componentRoot) {
|
103
|
+
if (!diffLevel++) {
|
104
|
+
isSvgMode = null != parent && void 0 !== parent.ownerSVGElement;
|
105
|
+
hydrating = null != dom && !('__preactattr_' in dom);
|
106
|
+
}
|
107
|
+
var ret = idiff(dom, vnode, context, mountAll, componentRoot);
|
108
|
+
if (parent && ret.parentNode !== parent) parent.appendChild(ret);
|
109
|
+
if (!--diffLevel) {
|
110
|
+
hydrating = !1;
|
111
|
+
if (!componentRoot) flushMounts();
|
112
|
+
}
|
113
|
+
return ret;
|
114
|
+
}
|
115
|
+
function idiff(dom, vnode, context, mountAll, componentRoot) {
|
116
|
+
var out = dom, prevSvgMode = isSvgMode;
|
117
|
+
if (null == vnode || 'boolean' == typeof vnode) vnode = '';
|
118
|
+
if ('string' == typeof vnode || 'number' == typeof vnode) {
|
119
|
+
if (dom && void 0 !== dom.splitText && dom.parentNode && (!dom._component || componentRoot)) {
|
120
|
+
if (dom.nodeValue != vnode) dom.nodeValue = vnode;
|
121
|
+
} else {
|
122
|
+
out = document.createTextNode(vnode);
|
123
|
+
if (dom) {
|
124
|
+
if (dom.parentNode) dom.parentNode.replaceChild(out, dom);
|
125
|
+
recollectNodeTree(dom, !0);
|
126
|
+
}
|
127
|
+
}
|
128
|
+
out.__preactattr_ = !0;
|
129
|
+
return out;
|
130
|
+
}
|
131
|
+
var vnodeName = vnode.nodeName;
|
132
|
+
if ('function' == typeof vnodeName) return buildComponentFromVNode(dom, vnode, context, mountAll);
|
133
|
+
isSvgMode = 'svg' === vnodeName ? !0 : 'foreignObject' === vnodeName ? !1 : isSvgMode;
|
134
|
+
vnodeName = String(vnodeName);
|
135
|
+
if (!dom || !isNamedNode(dom, vnodeName)) {
|
136
|
+
out = createNode(vnodeName, isSvgMode);
|
137
|
+
if (dom) {
|
138
|
+
while (dom.firstChild) out.appendChild(dom.firstChild);
|
139
|
+
if (dom.parentNode) dom.parentNode.replaceChild(out, dom);
|
140
|
+
recollectNodeTree(dom, !0);
|
141
|
+
}
|
142
|
+
}
|
143
|
+
var fc = out.firstChild, props = out.__preactattr_, vchildren = vnode.children;
|
144
|
+
if (null == props) {
|
145
|
+
props = out.__preactattr_ = {};
|
146
|
+
for (var a = out.attributes, i = a.length; i--; ) props[a[i].name] = a[i].value;
|
147
|
+
}
|
148
|
+
if (!hydrating && vchildren && 1 === vchildren.length && 'string' == typeof vchildren[0] && null != fc && void 0 !== fc.splitText && null == fc.nextSibling) {
|
149
|
+
if (fc.nodeValue != vchildren[0]) fc.nodeValue = vchildren[0];
|
150
|
+
} else if (vchildren && vchildren.length || null != fc) innerDiffNode(out, vchildren, context, mountAll, hydrating || null != props.dangerouslySetInnerHTML);
|
151
|
+
diffAttributes(out, vnode.attributes, props);
|
152
|
+
isSvgMode = prevSvgMode;
|
153
|
+
return out;
|
154
|
+
}
|
155
|
+
function innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {
|
156
|
+
var j, c, f, vchild, child, originalChildren = dom.childNodes, children = [], keyed = {}, keyedLen = 0, min = 0, len = originalChildren.length, childrenLen = 0, vlen = vchildren ? vchildren.length : 0;
|
157
|
+
if (0 !== len) for (var i = 0; i < len; i++) {
|
158
|
+
var _child = originalChildren[i], props = _child.__preactattr_, key = vlen && props ? _child._component ? _child._component.__k : props.key : null;
|
159
|
+
if (null != key) {
|
160
|
+
keyedLen++;
|
161
|
+
keyed[key] = _child;
|
162
|
+
} else if (props || (void 0 !== _child.splitText ? isHydrating ? _child.nodeValue.trim() : !0 : isHydrating)) children[childrenLen++] = _child;
|
163
|
+
}
|
164
|
+
if (0 !== vlen) for (var i = 0; i < vlen; i++) {
|
165
|
+
vchild = vchildren[i];
|
166
|
+
child = null;
|
167
|
+
var key = vchild.key;
|
168
|
+
if (null != key) {
|
169
|
+
if (keyedLen && void 0 !== keyed[key]) {
|
170
|
+
child = keyed[key];
|
171
|
+
keyed[key] = void 0;
|
172
|
+
keyedLen--;
|
173
|
+
}
|
174
|
+
} else if (min < childrenLen) for (j = min; j < childrenLen; j++) if (void 0 !== children[j] && isSameNodeType(c = children[j], vchild, isHydrating)) {
|
175
|
+
child = c;
|
176
|
+
children[j] = void 0;
|
177
|
+
if (j === childrenLen - 1) childrenLen--;
|
178
|
+
if (j === min) min++;
|
179
|
+
break;
|
180
|
+
}
|
181
|
+
child = idiff(child, vchild, context, mountAll);
|
182
|
+
f = originalChildren[i];
|
183
|
+
if (child && child !== dom && child !== f) if (null == f) dom.appendChild(child); else if (child === f.nextSibling) removeNode(f); else dom.insertBefore(child, f);
|
184
|
+
}
|
185
|
+
if (keyedLen) for (var i in keyed) if (void 0 !== keyed[i]) recollectNodeTree(keyed[i], !1);
|
186
|
+
while (min <= childrenLen) if (void 0 !== (child = children[childrenLen--])) recollectNodeTree(child, !1);
|
187
|
+
}
|
188
|
+
function recollectNodeTree(node, unmountOnly) {
|
189
|
+
var component = node._component;
|
190
|
+
if (component) unmountComponent(component); else {
|
191
|
+
if (null != node.__preactattr_ && node.__preactattr_.ref) node.__preactattr_.ref(null);
|
192
|
+
if (!1 === unmountOnly || null == node.__preactattr_) removeNode(node);
|
193
|
+
removeChildren(node);
|
194
|
+
}
|
195
|
+
}
|
196
|
+
function removeChildren(node) {
|
197
|
+
node = node.lastChild;
|
198
|
+
while (node) {
|
199
|
+
var next = node.previousSibling;
|
200
|
+
recollectNodeTree(node, !0);
|
201
|
+
node = next;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
function diffAttributes(dom, attrs, old) {
|
205
|
+
var name;
|
206
|
+
for (name in old) if ((!attrs || null == attrs[name]) && null != old[name]) setAccessor(dom, name, old[name], old[name] = void 0, isSvgMode);
|
207
|
+
for (name in attrs) if (!('children' === name || 'innerHTML' === name || name in old && attrs[name] === ('value' === name || 'checked' === name ? dom[name] : old[name]))) setAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode);
|
208
|
+
}
|
209
|
+
function createComponent(Ctor, props, context) {
|
210
|
+
var inst, i = recyclerComponents.length;
|
211
|
+
if (Ctor.prototype && Ctor.prototype.render) {
|
212
|
+
inst = new Ctor(props, context);
|
213
|
+
Component.call(inst, props, context);
|
214
|
+
} else {
|
215
|
+
inst = new Component(props, context);
|
216
|
+
inst.constructor = Ctor;
|
217
|
+
inst.render = doRender;
|
218
|
+
}
|
219
|
+
while (i--) if (recyclerComponents[i].constructor === Ctor) {
|
220
|
+
inst.__b = recyclerComponents[i].__b;
|
221
|
+
recyclerComponents.splice(i, 1);
|
222
|
+
return inst;
|
223
|
+
}
|
224
|
+
return inst;
|
225
|
+
}
|
226
|
+
function doRender(props, state, context) {
|
227
|
+
return this.constructor(props, context);
|
228
|
+
}
|
229
|
+
function setComponentProps(component, props, renderMode, context, mountAll) {
|
230
|
+
if (!component.__x) {
|
231
|
+
component.__x = !0;
|
232
|
+
component.__r = props.ref;
|
233
|
+
component.__k = props.key;
|
234
|
+
delete props.ref;
|
235
|
+
delete props.key;
|
236
|
+
if (void 0 === component.constructor.getDerivedStateFromProps) if (!component.base || mountAll) {
|
237
|
+
if (component.componentWillMount) component.componentWillMount();
|
238
|
+
} else if (component.componentWillReceiveProps) component.componentWillReceiveProps(props, context);
|
239
|
+
if (context && context !== component.context) {
|
240
|
+
if (!component.__c) component.__c = component.context;
|
241
|
+
component.context = context;
|
242
|
+
}
|
243
|
+
if (!component.__p) component.__p = component.props;
|
244
|
+
component.props = props;
|
245
|
+
component.__x = !1;
|
246
|
+
if (0 !== renderMode) if (1 === renderMode || !1 !== options.syncComponentUpdates || !component.base) renderComponent(component, 1, mountAll); else enqueueRender(component);
|
247
|
+
if (component.__r) component.__r(component);
|
248
|
+
}
|
249
|
+
}
|
250
|
+
function renderComponent(component, renderMode, mountAll, isChild) {
|
251
|
+
if (!component.__x) {
|
252
|
+
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;
|
253
|
+
if (component.constructor.getDerivedStateFromProps) {
|
254
|
+
state = extend(extend({}, state), component.constructor.getDerivedStateFromProps(props, state));
|
255
|
+
component.state = state;
|
256
|
+
}
|
257
|
+
if (isUpdate) {
|
258
|
+
component.props = previousProps;
|
259
|
+
component.state = previousState;
|
260
|
+
component.context = previousContext;
|
261
|
+
if (2 !== renderMode && component.shouldComponentUpdate && !1 === component.shouldComponentUpdate(props, state, context)) skip = !0; else if (component.componentWillUpdate) component.componentWillUpdate(props, state, context);
|
262
|
+
component.props = props;
|
263
|
+
component.state = state;
|
264
|
+
component.context = context;
|
265
|
+
}
|
266
|
+
component.__p = component.__s = component.__c = component.__b = null;
|
267
|
+
component.__d = !1;
|
268
|
+
if (!skip) {
|
269
|
+
rendered = component.render(props, state, context);
|
270
|
+
if (component.getChildContext) context = extend(extend({}, context), component.getChildContext());
|
271
|
+
if (isUpdate && component.getSnapshotBeforeUpdate) snapshot = component.getSnapshotBeforeUpdate(previousProps, previousState);
|
272
|
+
var toUnmount, base, childComponent = rendered && rendered.nodeName;
|
273
|
+
if ('function' == typeof childComponent) {
|
274
|
+
var childProps = getNodeProps(rendered);
|
275
|
+
inst = initialChildComponent;
|
276
|
+
if (inst && inst.constructor === childComponent && childProps.key == inst.__k) setComponentProps(inst, childProps, 1, context, !1); else {
|
277
|
+
toUnmount = inst;
|
278
|
+
component._component = inst = createComponent(childComponent, childProps, context);
|
279
|
+
inst.__b = inst.__b || nextBase;
|
280
|
+
inst.__u = component;
|
281
|
+
setComponentProps(inst, childProps, 0, context, !1);
|
282
|
+
renderComponent(inst, 1, mountAll, !0);
|
283
|
+
}
|
284
|
+
base = inst.base;
|
285
|
+
} else {
|
286
|
+
cbase = initialBase;
|
287
|
+
toUnmount = initialChildComponent;
|
288
|
+
if (toUnmount) cbase = component._component = null;
|
289
|
+
if (initialBase || 1 === renderMode) {
|
290
|
+
if (cbase) cbase._component = null;
|
291
|
+
base = diff(cbase, rendered, context, mountAll || !isUpdate, initialBase && initialBase.parentNode, !0);
|
292
|
+
}
|
293
|
+
}
|
294
|
+
if (initialBase && base !== initialBase && inst !== initialChildComponent) {
|
295
|
+
var baseParent = initialBase.parentNode;
|
296
|
+
if (baseParent && base !== baseParent) {
|
297
|
+
baseParent.replaceChild(base, initialBase);
|
298
|
+
if (!toUnmount) {
|
299
|
+
initialBase._component = null;
|
300
|
+
recollectNodeTree(initialBase, !1);
|
301
|
+
}
|
302
|
+
}
|
303
|
+
}
|
304
|
+
if (toUnmount) unmountComponent(toUnmount);
|
305
|
+
component.base = base;
|
306
|
+
if (base && !isChild) {
|
307
|
+
var componentRef = component, t = component;
|
308
|
+
while (t = t.__u) (componentRef = t).base = base;
|
309
|
+
base._component = componentRef;
|
310
|
+
base._componentConstructor = componentRef.constructor;
|
311
|
+
}
|
312
|
+
}
|
313
|
+
if (!isUpdate || mountAll) mounts.unshift(component); else if (!skip) {
|
314
|
+
if (component.componentDidUpdate) component.componentDidUpdate(previousProps, previousState, snapshot);
|
315
|
+
if (options.afterUpdate) options.afterUpdate(component);
|
316
|
+
}
|
317
|
+
while (component.__h.length) component.__h.pop().call(component);
|
318
|
+
if (!diffLevel && !isChild) flushMounts();
|
319
|
+
}
|
320
|
+
}
|
321
|
+
function buildComponentFromVNode(dom, vnode, context, mountAll) {
|
322
|
+
var c = dom && dom._component, originalComponent = c, oldDom = dom, isDirectOwner = c && dom._componentConstructor === vnode.nodeName, isOwner = isDirectOwner, props = getNodeProps(vnode);
|
323
|
+
while (c && !isOwner && (c = c.__u)) isOwner = c.constructor === vnode.nodeName;
|
324
|
+
if (c && isOwner && (!mountAll || c._component)) {
|
325
|
+
setComponentProps(c, props, 3, context, mountAll);
|
326
|
+
dom = c.base;
|
327
|
+
} else {
|
328
|
+
if (originalComponent && !isDirectOwner) {
|
329
|
+
unmountComponent(originalComponent);
|
330
|
+
dom = oldDom = null;
|
331
|
+
}
|
332
|
+
c = createComponent(vnode.nodeName, props, context);
|
333
|
+
if (dom && !c.__b) {
|
334
|
+
c.__b = dom;
|
335
|
+
oldDom = null;
|
336
|
+
}
|
337
|
+
setComponentProps(c, props, 1, context, mountAll);
|
338
|
+
dom = c.base;
|
339
|
+
if (oldDom && dom !== oldDom) {
|
340
|
+
oldDom._component = null;
|
341
|
+
recollectNodeTree(oldDom, !1);
|
342
|
+
}
|
343
|
+
}
|
344
|
+
return dom;
|
345
|
+
}
|
346
|
+
function unmountComponent(component) {
|
347
|
+
if (options.beforeUnmount) options.beforeUnmount(component);
|
348
|
+
var base = component.base;
|
349
|
+
component.__x = !0;
|
350
|
+
if (component.componentWillUnmount) component.componentWillUnmount();
|
351
|
+
component.base = null;
|
352
|
+
var inner = component._component;
|
353
|
+
if (inner) unmountComponent(inner); else if (base) {
|
354
|
+
if (base.__preactattr_ && base.__preactattr_.ref) base.__preactattr_.ref(null);
|
355
|
+
component.__b = base;
|
356
|
+
removeNode(base);
|
357
|
+
recyclerComponents.push(component);
|
358
|
+
removeChildren(base);
|
359
|
+
}
|
360
|
+
if (component.__r) component.__r(null);
|
361
|
+
}
|
362
|
+
function Component(props, context) {
|
363
|
+
this.__d = !0;
|
364
|
+
this.context = context;
|
365
|
+
this.props = props;
|
366
|
+
this.state = this.state || {};
|
367
|
+
this.__h = [];
|
368
|
+
}
|
369
|
+
function render(vnode, parent, merge) {
|
370
|
+
return diff(merge, vnode, {}, !1, parent, !1);
|
371
|
+
}
|
372
|
+
var VNode = function() {};
|
373
|
+
var options = {};
|
374
|
+
var stack = [];
|
375
|
+
var EMPTY_CHILDREN = [];
|
376
|
+
var defer = 'function' == typeof Promise ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;
|
377
|
+
var IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;
|
378
|
+
var items = [];
|
379
|
+
var mounts = [];
|
380
|
+
var diffLevel = 0;
|
381
|
+
var isSvgMode = !1;
|
382
|
+
var hydrating = !1;
|
383
|
+
var recyclerComponents = [];
|
384
|
+
extend(Component.prototype, {
|
385
|
+
setState: function(state, callback) {
|
386
|
+
if (!this.__s) this.__s = this.state;
|
387
|
+
this.state = extend(extend({}, this.state), 'function' == typeof state ? state(this.state, this.props) : state);
|
388
|
+
if (callback) this.__h.push(callback);
|
389
|
+
enqueueRender(this);
|
390
|
+
},
|
391
|
+
forceUpdate: function(callback) {
|
392
|
+
if (callback) this.__h.push(callback);
|
393
|
+
renderComponent(this, 2);
|
394
|
+
},
|
395
|
+
render: function() {}
|
396
|
+
});
|
397
|
+
var preact = {
|
398
|
+
h: h,
|
399
|
+
createElement: h,
|
400
|
+
cloneElement: cloneElement,
|
401
|
+
Component: Component,
|
402
|
+
render: render,
|
403
|
+
rerender: rerender,
|
404
|
+
options: options
|
405
|
+
};
|
406
|
+
if ('undefined' != typeof module) module.exports = preact; else self.preact = preact;
|
407
|
+
}();
|
408
|
+
//# sourceMappingURL=preact.js.map
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/* @flow */
|
2
|
+
|
3
|
+
import { createElement, cloneElement, Component, type Node } from 'react';
|
4
|
+
|
5
|
+
declare var h: createElement;
|
6
|
+
|
7
|
+
declare function render(vnode: Node, parent: Element, toReplace?: Element): Element;
|
8
|
+
|
9
|
+
export { h, createElement, cloneElement, Component, render };
|
10
|
+
export default { h, createElement, cloneElement, Component, render };
|
11
|
+
|
12
|
+
declare export function rerender(): void;
|
13
|
+
declare export var options: Object;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../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/preact.js"],"names":["nodeName","attributes","lastSimple","child","simple","i","children","EMPTY_CHILDREN","arguments","length","stack","push","pop","undefined","String","p","VNode","key","options","vnode","extend","obj","props","cloneElement","h","slice","call","FORCE_RENDER","component","ASYNC_RENDER","defer","rerender","IS_NON_DIMENSIONAL","items","enqueueRender","_dirty","list","isNamedNode","node","hydrating","_componentConstructor","isSameNodeType","toLowerCase","defaultProps","normalizedNodeName","createNode","isSvg","createElementNS","document","createElement","parentNode","removeChild","name","value","removeNode","style","setAccessor","old","test","innerHTML","__html","useCapture","replace","substring","eventProxy","removeEventListener","_listeners","removeAttribute","ns","setAttributeNS","setAttribute","flushMounts","mounts","diffLevel","c","componentDidMount","dom","context","mountAll","parent","componentRoot","isSvgMode","ownerSVGElement","ret","idiff","out","splitText","_component","nodeValue","prevSvgMode","replaceChild","vnodeName","recollectNodeTree","buildComponentFromVNode","ATTR_KEY","appendChild","firstChild","fc","a","vchildren","nextSibling","innerDiffNode","dangerouslySetInnerHTML","diffAttributes","originalChildren","keyed","childNodes","childrenLen","vlen","min","len","j","_child","__key","keyedLen","vchild","isHydrating","trim","f","unmountOnly","unmountComponent","ref","removeChildren","previousSibling","next","attrs","inst","Ctor","prototype","render","Component","recyclerComponents","createComponent","nextBase","splice","constructor","setComponentProps","renderMode","_disable","__ref","doRender","componentWillMount","componentWillReceiveProps","prevContext","base","SYNC_RENDER","syncComponentUpdates","renderComponent","previousProps","previousState","state","previousContext","isUpdate","getDerivedStateFromProps","initialBase","snapshot","rendered","cbase","skip","prevState","shouldComponentUpdate","getChildContext","prevProps","getSnapshotBeforeUpdate","childComponent","toUnmount","childProps","getNodeProps","initialChildComponent","diff","baseParent","componentRef","t","_parentComponent","componentDidUpdate","afterUpdate","unshift","isChild","originalComponent","oldDom","isOwner","_renderCallbacks","isDirectOwner","beforeUnmount","componentWillUnmount","this","callback","Promise","resolve","then","bind","setTimeout","NO_RENDER","setState","forceUpdate","module","exports","preact","self"],"mappings":";;IAuCO,SAAWA,EAAAA,UAAUC;QAC3B,IAA6BC,YAAYC,OAAOC,QAAQC,GAApDC,WAASC;QACb,KAAKF,IAAEG,UAAUC,QAAQJ,MAAM,KAC9BK,MAAMC,KAAKH,UAAUH;QAEtB,IAAIJ,cAAmC,QAArBA,WAAWK,UAAgB;YAC5C,KAAKI,MAAMD,QAAQC,MAAMC,KAAKV,W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kG;QACf/G,SAAOuJ;;ICbR,IAAe,sBAAA0B,QAAAA,OAAAC,UAAAC,aAAAC,KAAAD,SAAAA","file":"preact.js","sourcesContent":["import { VNode } from './vnode';\nimport options from './options';\n\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 * `<div id=\"foo\" name=\"bar\">Hello!</div>`\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 ? undefined : attributes;\n\tp.key = attributes==null ? undefined : 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/**\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<import('./vnode').VNode>} [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 = '__preactattr_';\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<import('./component').Component>}\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, list = items;\n\titems = [];\n\twhile ( (p = list.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').PreactElement} 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').PreactElement} 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 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.<string, EventListener>} EventListenerMap\n */\n\n/**\n * Properties Preact adds to elements it creates\n * @typedef PreactElementExtensions\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 Preact properties\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\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 {PreactElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n\t/** @type {PreactElement} */\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 {PreactElement} 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) {\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\tif (old) old(null);\n\t\tif (value) 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;\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 { removeNode } from '../dom/index';\n\n/**\n * Queue of components that have been mounted and are awaiting componentDidMount\n * @type {Array<import('../component').Component>}\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.pop())) {\n\t\tif (options.afterMount) options.afterMount(c);\n\t\tif (c.componentDidMount) c.componentDidMount();\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').PreactElement} 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').PreactElement} The created/mutated element\n * @private\n */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\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);\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').PreactElement} 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) {\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/preact/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);\n\t}\n\n\n\t// Apply attributes/props from VNode to the DOM Element:\n\tdiffAttributes(out, vnode.attributes, props);\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').PreactElement} dom Element whose children should be compared & mutated\n * @param {Array<import('../vnode').VNode>} 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) {\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<len; i++) {\n\t\t\tlet child = originalChildren[i],\n\t\t\t\tprops = child[ATTR_KEY],\n\t\t\t\tkey = vlen && props ? child._component ? child._component.__key : props.key : null;\n\t\t\tif (key!=null) {\n\t\t\t\tkeyedLen++;\n\t\t\t\tkeyed[key] = child;\n\t\t\t}\n\t\t\telse if (props || (child.splitText!==undefined ? (isHydrating ? child.nodeValue.trim() : true) : isHydrating)) {\n\t\t\t\tchildren[childrenLen++] = child;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (vlen!==0) {\n\t\tfor (let i=0; i<vlen; i++) {\n\t\t\tvchild = vchildren[i];\n\t\t\tchild = null;\n\n\t\t\t// attempt to find a node based on key matching\n\t\t\tlet key = vchild.key;\n\t\t\tif (key!=null) {\n\t\t\t\tif (keyedLen && keyed[key]!==undefined) {\n\t\t\t\t\tchild = keyed[key];\n\t\t\t\t\tkeyed[key] = undefined;\n\t\t\t\t\tkeyedLen--;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// attempt to pluck a node of the same type from the existing children\n\t\t\telse if (min<childrenLen) {\n\t\t\t\tfor (j=min; j<childrenLen; j++) {\n\t\t\t\t\tif (children[j]!==undefined && isSameNodeType(c = children[j], vchild, isHydrating)) {\n\t\t\t\t\t\tchild = c;\n\t\t\t\t\t\tchildren[j] = undefined;\n\t\t\t\t\t\tif (j===childrenLen-1) childrenLen--;\n\t\t\t\t\t\tif (j===min) min++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// morph the matched/found/created DOM child to match vchild (deep)\n\t\t\tchild = idiff(child, vchild, context, mountAll);\n\n\t\t\tf = originalChildren[i];\n\t\t\tif (child && child!==dom && child!==f) {\n\t\t\t\tif (f==null) {\n\t\t\t\t\tdom.appendChild(child);\n\t\t\t\t}\n\t\t\t\telse if (child===f.nextSibling) {\n\t\t\t\t\tremoveNode(f);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdom.insertBefore(child, f);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\t// remove unused keyed children:\n\tif (keyedLen) {\n\t\tfor (let i in keyed) if (keyed[i]!==undefined) recollectNodeTree(keyed[i], false);\n\t}\n\n\t// remove orphaned unkeyed children:\n\twhile (min<=childrenLen) {\n\t\tif ((child = children[childrenLen--])!==undefined) recollectNodeTree(child, false);\n\t}\n}\n\n\n\n/**\n * Recursively recycle (or just unmount) a node and its descendants.\n * @param {import('../dom').PreactElement} node DOM node to start\n * unmount/removal from\n * @param {boolean} [unmountOnly=false] If `true`, only triggers unmount\n * lifecycle, skips removal\n */\nexport function recollectNodeTree(node, unmountOnly) {\n\tlet component = node._component;\n\tif (component) {\n\t\t// if node is owned by a Component, unmount that component (ends up recursing back here)\n\t\tunmountComponent(component);\n\t}\n\telse {\n\t\t// If the node's VNode had a ref function, invoke it with null here.\n\t\t// (this is part of the React spec, and smart for unsetting references)\n\t\tif (node[ATTR_KEY]!=null && node[ATTR_KEY].ref) node[ATTR_KEY].ref(null);\n\n\t\tif (unmountOnly===false || node[ATTR_KEY]==null) {\n\t\t\tremoveNode(node);\n\t\t}\n\n\t\tremoveChildren(node);\n\t}\n}\n\n\n/**\n * Recollect/unmount all children.\n *\t- we use .lastChild here because it causes less reflow than .firstChild\n *\t- it's also cheaper than accessing the .childNodes Live NodeList\n */\nexport function removeChildren(node) {\n\tnode = node.lastChild;\n\twhile (node) {\n\t\tlet next = node.previousSibling;\n\t\trecollectNodeTree(node, true);\n\t\tnode = next;\n\t}\n}\n\n\n/**\n * Apply differences in attributes from a VNode to the given DOM Element.\n * @param {import('../dom').PreactElement} dom Element with attributes to diff `attrs` against\n * @param {object} attrs The desired end-state key-value attribute pairs\n * @param {object} old Current/previous attributes (from previous VNode or\n * element's prop cache)\n */\nfunction diffAttributes(dom, attrs, old) {\n\tlet name;\n\n\t// remove attributes no longer present on the vnode by setting them to undefined\n\tfor (name in old) {\n\t\tif (!(attrs && attrs[name]!=null) && old[name]!=null) {\n\t\t\tsetAccessor(dom, name, old[name], old[name] = undefined, isSvgMode);\n\t\t}\n\t}\n\n\t// add new & update changed attributes\n\tfor (name in attrs) {\n\t\tif (name!=='children' && name!=='innerHTML' && (!(name in old) || attrs[name]!==(name==='value' || name==='checked' ? dom[name] : old[name]))) {\n\t\t\tsetAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode);\n\t\t}\n\t}\n}\n","import { Component } from '../component';\n\n/**\n * Retains a pool of Components for re-use.\n * @type {Component[]}\n * @private\n */\nexport const recyclerComponents = [];\n\n\n/**\n * Create a component. Normalizes differences between PFC's and classful\n * Components.\n * @param {function} Ctor The constructor of the component to create\n * @param {object} props The initial props of the component\n * @param {object} context The initial context of the component\n * @returns {import('../component').Component}\n */\nexport function createComponent(Ctor, props, context) {\n\tlet inst, i = recyclerComponents.length;\n\n\tif (Ctor.prototype && Ctor.prototype.render) {\n\t\tinst = new Ctor(props, context);\n\t\tComponent.call(inst, props, context);\n\t}\n\telse {\n\t\tinst = new Component(props, context);\n\t\tinst.constructor = Ctor;\n\t\tinst.render = doRender;\n\t}\n\n\n\twhile (i--) {\n\t\tif (recyclerComponents[i].constructor===Ctor) {\n\t\t\tinst.nextBase = recyclerComponents[i].nextBase;\n\t\t\trecyclerComponents.splice(i, 1);\n\t\t\treturn inst;\n\t\t}\n\t}\n\n\treturn inst;\n}\n\n\n/** The `.render()` method for a PFC backing instance. */\nfunction doRender(props, state, context) {\n\treturn this.constructor(props, context);\n}\n","import { SYNC_RENDER, NO_RENDER, FORCE_RENDER, ASYNC_RENDER, ATTR_KEY } from '../constants';\nimport options from '../options';\nimport { extend } from '../util';\nimport { enqueueRender } from '../render-queue';\nimport { getNodeProps } from './index';\nimport { diff, mounts, diffLevel, flushMounts, recollectNodeTree, removeChildren } from './diff';\nimport { createComponent, recyclerComponents } from './component-recycler';\nimport { removeNode } from '../dom/index';\n\n/**\n * Set a component's `props` and possibly re-render the component\n * @param {import('../component').Component} component The Component to set props on\n * @param {object} props The new props\n * @param {number} renderMode Render options - specifies how to re-render the component\n * @param {object} context The new context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n */\nexport function setComponentProps(component, props, renderMode, context, mountAll) {\n\tif (component._disable) return;\n\tcomponent._disable = true;\n\n\tcomponent.__ref = props.ref;\n\tcomponent.__key = props.key;\n\tdelete props.ref;\n\tdelete props.key;\n\n\tif (typeof component.constructor.getDerivedStateFromProps === 'undefined') {\n\t\tif (!component.base || mountAll) {\n\t\t\tif (component.componentWillMount) component.componentWillMount();\n\t\t}\n\t\telse if (component.componentWillReceiveProps) {\n\t\t\tcomponent.componentWillReceiveProps(props, context);\n\t\t}\n\t}\n\n\tif (context && context!==component.context) {\n\t\tif (!component.prevContext) component.prevContext = component.context;\n\t\tcomponent.context = context;\n\t}\n\n\tif (!component.prevProps) component.prevProps = component.props;\n\tcomponent.props = props;\n\n\tcomponent._disable = false;\n\n\tif (renderMode!==NO_RENDER) {\n\t\tif (renderMode===SYNC_RENDER || options.syncComponentUpdates!==false || !component.base) {\n\t\t\trenderComponent(component, SYNC_RENDER, mountAll);\n\t\t}\n\t\telse {\n\t\t\tenqueueRender(component);\n\t\t}\n\t}\n\n\tif (component.__ref) component.__ref(component);\n}\n\n\n\n/**\n * Render a Component, triggering necessary lifecycle events and taking\n * High-Order Components into account.\n * @param {import('../component').Component} component The component to render\n * @param {number} [renderMode] render mode, see constants.js for available options.\n * @param {boolean} [mountAll] Whether or not to immediately mount all components\n * @param {boolean} [isChild] ?\n * @private\n */\nexport function renderComponent(component, renderMode, mountAll, isChild) {\n\tif (component._disable) return;\n\n\tlet props = component.props,\n\t\tstate = component.state,\n\t\tcontext = component.context,\n\t\tpreviousProps = component.prevProps || props,\n\t\tpreviousState = component.prevState || state,\n\t\tpreviousContext = component.prevContext || context,\n\t\tisUpdate = component.base,\n\t\tnextBase = component.nextBase,\n\t\tinitialBase = isUpdate || nextBase,\n\t\tinitialChildComponent = component._component,\n\t\tskip = false,\n\t\tsnapshot = previousContext,\n\t\trendered, inst, cbase;\n\n\tif (component.constructor.getDerivedStateFromProps) {\n\t\tstate = extend(extend({}, state), component.constructor.getDerivedStateFromProps(props, state));\n\t\tcomponent.state = state;\n\t}\n\n\t// if updating\n\tif (isUpdate) {\n\t\tcomponent.props = previousProps;\n\t\tcomponent.state = previousState;\n\t\tcomponent.context = previousContext;\n\t\tif (renderMode!==FORCE_RENDER\n\t\t\t&& component.shouldComponentUpdate\n\t\t\t&& component.shouldComponentUpdate(props, state, context) === false) {\n\t\t\tskip = true;\n\t\t}\n\t\telse if (component.componentWillUpdate) {\n\t\t\tcomponent.componentWillUpdate(props, state, context);\n\t\t}\n\t\tcomponent.props = props;\n\t\tcomponent.state = state;\n\t\tcomponent.context = context;\n\t}\n\n\tcomponent.prevProps = component.prevState = component.prevContext = component.nextBase = null;\n\tcomponent._dirty = false;\n\n\tif (!skip) {\n\t\trendered = component.render(props, state, context);\n\n\t\t// context to pass to the child, can be updated via (grand-)parent component\n\t\tif (component.getChildContext) {\n\t\t\tcontext = extend(extend({}, context), component.getChildContext());\n\t\t}\n\n\t\tif (isUpdate && component.getSnapshotBeforeUpdate) {\n\t\t\tsnapshot = component.getSnapshotBeforeUpdate(previousProps, previousState);\n\t\t}\n\n\t\tlet childComponent = rendered && rendered.nodeName,\n\t\t\ttoUnmount, base;\n\n\t\tif (typeof childComponent==='function') {\n\t\t\t// set up high order component link\n\n\t\t\tlet childProps = getNodeProps(rendered);\n\t\t\tinst = initialChildComponent;\n\n\t\t\tif (inst && inst.constructor===childComponent && childProps.key==inst.__key) {\n\t\t\t\tsetComponentProps(inst, childProps, SYNC_RENDER, context, false);\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttoUnmount = inst;\n\n\t\t\t\tcomponent._component = inst = createComponent(childComponent, childProps, context);\n\t\t\t\tinst.nextBase = inst.nextBase || nextBase;\n\t\t\t\tinst._parentComponent = component;\n\t\t\t\tsetComponentProps(inst, childProps, NO_RENDER, context, false);\n\t\t\t\trenderComponent(inst, SYNC_RENDER, mountAll, true);\n\t\t\t}\n\n\t\t\tbase = inst.base;\n\t\t}\n\t\telse {\n\t\t\tcbase = initialBase;\n\n\t\t\t// destroy high order component link\n\t\t\ttoUnmount = initialChildComponent;\n\t\t\tif (toUnmount) {\n\t\t\t\tcbase = component._component = null;\n\t\t\t}\n\n\t\t\tif (initialBase || renderMode===SYNC_RENDER) {\n\t\t\t\tif (cbase) cbase._component = null;\n\t\t\t\tbase = diff(cbase, rendered, context, mountAll || !isUpdate, initialBase && initialBase.parentNode, true);\n\t\t\t}\n\t\t}\n\n\t\tif (initialBase && base!==initialBase && inst!==initialChildComponent) {\n\t\t\tlet baseParent = initialBase.parentNode;\n\t\t\tif (baseParent && base!==baseParent) {\n\t\t\t\tbaseParent.replaceChild(base, initialBase);\n\n\t\t\t\tif (!toUnmount) {\n\t\t\t\t\tinitialBase._component = null;\n\t\t\t\t\trecollectNodeTree(initialBase, false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (toUnmount) {\n\t\t\tunmountComponent(toUnmount);\n\t\t}\n\n\t\tcomponent.base = base;\n\t\tif (base && !isChild) {\n\t\t\tlet componentRef = component,\n\t\t\t\tt = component;\n\t\t\twhile ((t=t._parentComponent)) {\n\t\t\t\t(componentRef = t).base = base;\n\t\t\t}\n\t\t\tbase._component = componentRef;\n\t\t\tbase._componentConstructor = componentRef.constructor;\n\t\t}\n\t}\n\n\tif (!isUpdate || mountAll) {\n\t\tmounts.unshift(component);\n\t}\n\telse if (!skip) {\n\t\t// Ensure that pending componentDidMount() hooks of child components\n\t\t// are called before the componentDidUpdate() hook in the parent.\n\t\t// Note: disabled as it causes duplicate hooks, see https://github.com/developit/preact/issues/750\n\t\t// flushMounts();\n\n\t\tif (component.componentDidUpdate) {\n\t\t\tcomponent.componentDidUpdate(previousProps, previousState, snapshot);\n\t\t}\n\t\tif (options.afterUpdate) options.afterUpdate(component);\n\t}\n\n\twhile (component._renderCallbacks.length) component._renderCallbacks.pop().call(component);\n\n\tif (!diffLevel && !isChild) flushMounts();\n}\n\n\n\n/**\n * Apply the Component referenced by a VNode to the DOM.\n * @param {import('../dom').PreactElement} dom The DOM node to mutate\n * @param {import('../vnode').VNode} vnode A Component-referencing VNode\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @returns {import('../dom').PreactElement} The created/mutated element\n * @private\n */\nexport function buildComponentFromVNode(dom, vnode, context, mountAll) {\n\tlet c = dom && dom._component,\n\t\toriginalComponent = c,\n\t\toldDom = dom,\n\t\tisDirectOwner = c && dom._componentConstructor===vnode.nodeName,\n\t\tisOwner = isDirectOwner,\n\t\tprops = getNodeProps(vnode);\n\twhile (c && !isOwner && (c=c._parentComponent)) {\n\t\tisOwner = c.constructor===vnode.nodeName;\n\t}\n\n\tif (c && isOwner && (!mountAll || c._component)) {\n\t\tsetComponentProps(c, props, ASYNC_RENDER, context, mountAll);\n\t\tdom = c.base;\n\t}\n\telse {\n\t\tif (originalComponent && !isDirectOwner) {\n\t\t\tunmountComponent(originalComponent);\n\t\t\tdom = oldDom = null;\n\t\t}\n\n\t\tc = createComponent(vnode.nodeName, props, context);\n\t\tif (dom && !c.nextBase) {\n\t\t\tc.nextBase = dom;\n\t\t\t// passing dom/oldDom as nextBase will recycle it if unused, so bypass recycling on L229:\n\t\t\toldDom = null;\n\t\t}\n\t\tsetComponentProps(c, props, SYNC_RENDER, context, mountAll);\n\t\tdom = c.base;\n\n\t\tif (oldDom && dom!==oldDom) {\n\t\t\toldDom._component = null;\n\t\t\trecollectNodeTree(oldDom, false);\n\t\t}\n\t}\n\n\treturn dom;\n}\n\n\n\n/**\n * Remove a component from the DOM and recycle it.\n * @param {import('../component').Component} component The Component instance to unmount\n * @private\n */\nexport function unmountComponent(component) {\n\tif (options.beforeUnmount) options.beforeUnmount(component);\n\n\tlet base = component.base;\n\n\tcomponent._disable = true;\n\n\tif (component.componentWillUnmount) component.componentWillUnmount();\n\n\tcomponent.base = null;\n\n\t// recursively tear down & recollect high-order component children:\n\tlet inner = component._component;\n\tif (inner) {\n\t\tunmountComponent(inner);\n\t}\n\telse if (base) {\n\t\tif (base[ATTR_KEY] && base[ATTR_KEY].ref) base[ATTR_KEY].ref(null);\n\n\t\tcomponent.nextBase = base;\n\n\t\tremoveNode(base);\n\t\trecyclerComponents.push(component);\n\n\t\tremoveChildren(base);\n\t}\n\n\tif (component.__ref) component.__ref(null);\n}\n","import { FORCE_RENDER } from './constants';\nimport { extend } from './util';\nimport { renderComponent } from './vdom/component';\nimport { enqueueRender } from './render-queue';\n/**\n * Base Component class.\n * Provides `setState()` and `forceUpdate()`, which trigger rendering.\n * @typedef {object} Component\n * @param {object} props The initial component props\n * @param {object} context The initial context from parent components' getChildContext\n * @public\n *\n * @example\n * class MyFoo extends Component {\n * render(props, state) {\n * return <div />;\n * }\n * }\n */\nexport function Component(props, context) {\n\tthis._dirty = true;\n\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.context = context;\n\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 * Update component state and schedule a re-render.\n\t * @param {object} state A dict of state properties to be shallowly merged\n\t * \tinto the current state, or a function that will produce such a dict. The\n\t * \tfunction is called with the current state and props.\n\t * @param {() => void} callback A function to be called once component state is\n\t * \tupdated\n\t */\n\tsetState(state, callback) {\n\t\tif (!this.prevState) this.prevState = this.state;\n\t\tthis.state = extend(\n\t\t\textend({}, this.state),\n\t\t\ttypeof state === 'function' ? state(this.state, this.props) : state\n\t\t);\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t},\n\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\tforceUpdate(callback) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\trenderComponent(this, FORCE_RENDER);\n\t},\n\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<VNode | string>} 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 Preact event listeners. The return value (if any) replaces the native browser event given to event listeners\n */\n\n/** @type {Options} */\nconst options = {};\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').PreactElement} parent DOM element to render into\n * @param {import('./dom').PreactElement} [merge] Attempt to re-use an existing DOM tree rooted at\n * `merge`\n * @public\n *\n * @example\n * // render a div into <body>:\n * render(<div id=\"hello\">hello!</div>, document.body);\n *\n * @example\n * // render a \"Thing\" component into #foo:\n * const Thing = ({ name }) => <span>{ name }</span>;\n * render(<Thing name=\"one\" />, document.querySelector('#foo'));\n */\nexport function render(vnode, parent, merge) {\n\treturn diff(merge, vnode, {}, false, 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\nexport default {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nexport {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n"]}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
!function(){"use strict";function e(e,t){var n,o,r,i,l=M;for(i=arguments.length;i-- >2;)T.push(arguments[i]);t&&null!=t.children&&(T.length||T.push(t.children),delete t.children);while(T.length)if((o=T.pop())&&void 0!==o.pop)for(i=o.length;i--;)T.push(o[i]);else"boolean"==typeof o&&(o=null),(r="function"!=typeof e)&&(null==o?o="":"number"==typeof o?o+="":"string"!=typeof o&&(r=!1)),r&&n?l[l.length-1]+=o:l===M?l=[o]:l.push(o),n=r;var a=new S;return a.nodeName=e,a.children=l,a.attributes=null==t?void 0:t,a.key=null==t?void 0:t.key,void 0!==L.vnode&&L.vnode(a),a}function t(e,t){for(var n in t)e[n]=t[n];return e}function n(n,o){return e(n.nodeName,t(t({},n.attributes),o),arguments.length>2?[].slice.call(arguments,2):n.children)}function o(e){!e.__d&&(e.__d=!0)&&1==D.push(e)&&(L.debounceRendering||P)(r)}function r(){var e,t=D;D=[];while(e=t.pop())e.__d&&C(e)}function i(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&l(e,t.nodeName):n||e._componentConstructor===t.nodeName}function l(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function a(e){var n=t({},e.attributes);n.children=e.children;var o=e.nodeName.defaultProps;if(void 0!==o)for(var r in o)void 0===n[r]&&(n[r]=o[r]);return n}function p(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.__n=e,n}function s(e){var t=e.parentNode;t&&t.removeChild(e)}function u(e,t,n,o,r){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),o&&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 i in n)i in o||(e.style[i]="");for(var i in o)e.style[i]="number"==typeof o[i]&&!1===W.test(i)?o[i]+"px":o[i]}}else if("dangerouslySetInnerHTML"===t)o&&(e.innerHTML=o.__html||"");else if("o"==t[0]&&"n"==t[1]){var l=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),o?n||e.addEventListener(t,c,l):e.removeEventListener(t,c,l),(e.__l||(e.__l={}))[t]=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 c(e){return this.__l[e.type](L.event&&L.event(e)||e)}function _(){var e;while(e=E.pop())L.afterMount&&L.afterMount(e),e.componentDidMount&&e.componentDidMount()}function d(e,t,n,o,r,i){V++||(A=null!=r&&void 0!==r.ownerSVGElement,H=null!=e&&!("__preactattr_"in e));var l=f(e,t,n,o,i);return r&&l.parentNode!==r&&r.appendChild(l),--V||(H=!1,i||_()),l}function f(e,t,n,o,r){var i=e,a=A;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):(i=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(i,e),m(e,!0))),i.__preactattr_=!0,i;var s=t.nodeName;if("function"==typeof s)return x(e,t,n,o);if(A="svg"===s||"foreignObject"!==s&&A,s+="",(!e||!l(e,s))&&(i=p(s,A),e)){while(e.firstChild)i.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(i,e),m(e,!0)}var u=i.firstChild,c=i.__preactattr_,_=t.children;if(null==c){c=i.__preactattr_={};for(var d=i.attributes,f=d.length;f--;)c[d[f].name]=d[f].value}return!H&&_&&1===_.length&&"string"==typeof _[0]&&null!=u&&void 0!==u.splitText&&null==u.nextSibling?u.nodeValue!=_[0]&&(u.nodeValue=_[0]):(_&&_.length||null!=u)&&h(i,_,n,o,H||null!=c.dangerouslySetInnerHTML),b(i,t.attributes,c),A=a,i}function h(e,t,n,o,r){var l,a,p,u,c,_=e.childNodes,d=[],h={},v=0,b=0,y=_.length,g=0,w=t?t.length:0;if(0!==y)for(var C=0;C<y;C++){var x=_[C],N=x.__preactattr_,k=w&&N?x._component?x._component.__k:N.key:null;null!=k?(v++,h[k]=x):(N||(void 0!==x.splitText?!r||x.nodeValue.trim():r))&&(d[g++]=x)}if(0!==w)for(var C=0;C<w;C++){u=t[C],c=null;var k=u.key;if(null!=k)v&&void 0!==h[k]&&(c=h[k],h[k]=void 0,v--);else if(b<g)for(l=b;l<g;l++)if(void 0!==d[l]&&i(a=d[l],u,r)){c=a,d[l]=void 0,l===g-1&&g--,l===b&&b++;break}c=f(c,u,n,o),p=_[C],c&&c!==e&&c!==p&&(null==p?e.appendChild(c):c===p.nextSibling?s(p):e.insertBefore(c,p))}if(v)for(var C in h)void 0!==h[C]&&m(h[C],!1);while(b<=g)void 0!==(c=d[g--])&&m(c,!1)}function m(e,t){var n=e._component;n?N(n):(null!=e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),!1!==t&&null!=e.__preactattr_||s(e),v(e))}function v(e){e=e.lastChild;while(e){var t=e.previousSibling;m(e,!0),e=t}}function b(e,t,n){var o;for(o in n)t&&null!=t[o]||null==n[o]||u(e,o,n[o],n[o]=void 0,A);for(o in t)"children"===o||"innerHTML"===o||o in n&&t[o]===("value"===o||"checked"===o?e[o]:n[o])||u(e,o,n[o],n[o]=t[o],A)}function y(e,t,n){var o,r=B.length;e.prototype&&e.prototype.render?(o=new e(t,n),k.call(o,t,n)):(o=new k(t,n),o.constructor=e,o.render=g);while(r--)if(B[r].constructor===e)return o.__b=B[r].__b,B.splice(r,1),o;return o}function g(e,t,n){return this.constructor(e,n)}function w(e,t,n,r,i){e.__x||(e.__x=!0,e.__r=t.ref,e.__k=t.key,delete t.ref,delete t.key,void 0===e.constructor.getDerivedStateFromProps&&(!e.base||i?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,r)),r&&r!==e.context&&(e.__c||(e.__c=e.context),e.context=r),e.__p||(e.__p=e.props),e.props=t,e.__x=!1,0!==n&&(1!==n&&!1===L.syncComponentUpdates&&e.base?o(e):C(e,1,i)),e.__r&&e.__r(e))}function C(e,n,o,r){if(!e.__x){var i,l,p,s=e.props,u=e.state,c=e.context,f=e.__p||s,h=e.__s||u,v=e.__c||c,b=e.base,g=e.__b,x=b||g,k=e._component,U=!1,S=v;if(e.constructor.getDerivedStateFromProps&&(u=t(t({},u),e.constructor.getDerivedStateFromProps(s,u)),e.state=u),b&&(e.props=f,e.state=h,e.context=v,2!==n&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(s,u,c)?U=!0:e.componentWillUpdate&&e.componentWillUpdate(s,u,c),e.props=s,e.state=u,e.context=c),e.__p=e.__s=e.__c=e.__b=null,e.__d=!1,!U){i=e.render(s,u,c),e.getChildContext&&(c=t(t({},c),e.getChildContext())),b&&e.getSnapshotBeforeUpdate&&(S=e.getSnapshotBeforeUpdate(f,h));var T,M,P=i&&i.nodeName;if("function"==typeof P){var W=a(i);l=k,l&&l.constructor===P&&W.key==l.__k?w(l,W,1,c,!1):(T=l,e._component=l=y(P,W,c),l.__b=l.__b||g,l.__u=e,w(l,W,0,c,!1),C(l,1,o,!0)),M=l.base}else p=x,T=k,T&&(p=e._component=null),(x||1===n)&&(p&&(p._component=null),M=d(p,i,c,o||!b,x&&x.parentNode,!0));if(x&&M!==x&&l!==k){var D=x.parentNode;D&&M!==D&&(D.replaceChild(M,x),T||(x._component=null,m(x,!1)))}if(T&&N(T),e.base=M,M&&!r){var A=e,H=e;while(H=H.__u)(A=H).base=M;M._component=A,M._componentConstructor=A.constructor}}!b||o?E.unshift(e):U||(e.componentDidUpdate&&e.componentDidUpdate(f,h,S),L.afterUpdate&&L.afterUpdate(e));while(e.__h.length)e.__h.pop().call(e);V||r||_()}}function x(e,t,n,o){var r=e&&e._component,i=r,l=e,p=r&&e._componentConstructor===t.nodeName,s=p,u=a(t);while(r&&!s&&(r=r.__u))s=r.constructor===t.nodeName;return r&&s&&(!o||r._component)?(w(r,u,3,n,o),e=r.base):(i&&!p&&(N(i),e=l=null),r=y(t.nodeName,u,n),e&&!r.__b&&(r.__b=e,l=null),w(r,u,1,n,o),e=r.base,l&&e!==l&&(l._component=null,m(l,!1))),e}function N(e){L.beforeUnmount&&L.beforeUnmount(e);var t=e.base;e.__x=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var n=e._component;n?N(n):t&&(t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),e.__b=t,s(t),B.push(e),v(t)),e.__r&&e.__r(null)}function k(e,t){this.__d=!0,this.context=t,this.props=e,this.state=this.state||{},this.__h=[]}function U(e,t,n){return d(n,e,{},!1,t,!1)}var S=function(){},L={},T=[],M=[],P="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout,W=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,D=[],E=[],V=0,A=!1,H=!1,B=[];t(k.prototype,{setState:function(e,n){this.__s||(this.__s=this.state),this.state=t(t({},this.state),"function"==typeof e?e(this.state,this.props):e),n&&this.__h.push(n),o(this)},forceUpdate:function(e){e&&this.__h.push(e),C(this,2)},render:function(){}});var F={h:e,createElement:e,cloneElement:n,Component:k,render:U,rerender:r,options:L};"undefined"!=typeof module?module.exports=F:self.preact=F}();
|
2
|
+
//# sourceMappingURL=preact.min.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../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/preact.js"],"names":["nodeName","attributes","lastSimple","child","simple","i","children","EMPTY_CHILDREN","arguments","length","stack","push","pop","String","p","VNode","key","options","vnode","extend","obj","props","cloneElement","h","slice","call","FORCE_RENDER","component","ASYNC_RENDER","defer","rerender","IS_NON_DIMENSIONAL","items","enqueueRender","_dirty","list","isNamedNode","node","hydrating","_componentConstructor","isSameNodeType","toLowerCase","defaultProps","normalizedNodeName","createNode","isSvg","undefined","createElementNS","document","createElement","parentNode","removeChild","name","value","removeNode","style","setAccessor","old","test","innerHTML","__html","useCapture","replace","substring","eventProxy","removeEventListener","_listeners","removeAttribute","ns","setAttributeNS","setAttribute","flushMounts","mounts","diffLevel","c","componentDidMount","dom","context","mountAll","parent","componentRoot","isSvgMode","ownerSVGElement","ret","idiff","out","splitText","_component","nodeValue","prevSvgMode","replaceChild","vnodeName","recollectNodeTree","buildComponentFromVNode","ATTR_KEY","appendChild","firstChild","fc","__preactattr_","a","vchildren","nextSibling","innerDiffNode","dangerouslySetInnerHTML","diffAttributes","j","originalChildren","keyed","childNodes","childrenLen","vlen","min","len","_child","__key","keyedLen","vchild","isHydrating","trim","f","unmountOnly","unmountComponent","ref","removeChildren","previousSibling","next","attrs","inst","Ctor","prototype","render","Component","recyclerComponents","createComponent","nextBase","splice","constructor","setComponentProps","renderMode","_disable","__ref","doRender","componentWillMount","componentWillReceiveProps","prevContext","base","SYNC_RENDER","syncComponentUpdates","renderComponent","previousProps","previousState","state","previousContext","isUpdate","getDerivedStateFromProps","initialBase","snapshot","rendered","cbase","skip","prevState","shouldComponentUpdate","getChildContext","prevProps","getSnapshotBeforeUpdate","childComponent","toUnmount","childProps","getNodeProps","initialChildComponent","diff","baseParent","componentRef","t","_parentComponent","componentDidUpdate","afterUpdate","unshift","isChild","originalComponent","oldDom","isOwner","_renderCallbacks","isDirectOwner","beforeUnmount","componentWillUnmount","this","callback","Promise","resolve","then","bind","setTimeout","NO_RENDER","setState","forceUpdate","module","exports","preact","self"],"mappings":"wBA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EAAA/C,cAAAwB,IAAA,MAEA/F,EAAIA,IAAU8J,EAEd9J,EAAUsH,aAIVtB,EAAWsB,IAIVtH,EAASmE,KAALnE,EAAuBmE,IAAL,sBAItBxC,KAAAA,KAAAA,iBAIAoI,KAAArK,MAAAA,EAEDqK,KAAI/J,MAAAA,KAAUiH,sBC1Ob,QAAI+C,GAAUzK,EAAKoK,EAAAA,GACnBrJ,MAAAA,GAAAA,EAAAf,MAAAA,EAAA6D,GAAAA,GCrDK,GAAMhE,GAAQ,aCWfE,KZfAP,KAEAH,KCYOsB,EAAwB,kBAAT+J,SAAsBA,QAAQC,UAAUC,KAAKC,KAAKH,QAAQC,WAAaG,WEftFC,EAAN,yDAEM/C,KGiHX1E,KAOCC,EAAA,EAEFQ,GAAAA,EAQD3C,GAAAA,EC+LG8F,oBG5SF8D,SAAKrH,SAAL0E,EAAAoC,mCAMAD,KAAKrK,MAAQA,EAAbF,KAAAuK,KAAAnC,OAAA,kBAAAA,GAAAA,EAAAmC,KAAAnC,MAAAmC,KAAArK,OAAAkI,uBAMAtH,EAAayJ,OAEbS,YAAKb,SAALK,GACAA,GAAAD,KAAAJ,IAAA3K,KAAAgL,cAaAO,OAV2B,cA4B1B,IAAIP,IACJvC,EAAAA,EACAnG,cA9B0B1B,EA2C3B2G,aA3C2B5G,EAA5B6G,UAAAA,WGzBOrG,SAASoG,EACfjH,QAAOyJ,ECbO,oBAAA0B,QAAAA,OAAAC,QAAAC,EAAAC,KAAAD,OAAAA","file":"preact.min.js","sourcesContent":["import { VNode } from './vnode';\nimport options from './options';\n\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 * `<div id=\"foo\" name=\"bar\">Hello!</div>`\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 ? undefined : attributes;\n\tp.key = attributes==null ? undefined : 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/**\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<import('./vnode').VNode>} [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 = '__preactattr_';\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<import('./component').Component>}\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, list = items;\n\titems = [];\n\twhile ( (p = list.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').PreactElement} 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').PreactElement} 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 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.<string, EventListener>} EventListenerMap\n */\n\n/**\n * Properties Preact adds to elements it creates\n * @typedef PreactElementExtensions\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 Preact properties\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\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 {PreactElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n\t/** @type {PreactElement} */\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 {PreactElement} 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) {\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\tif (old) old(null);\n\t\tif (value) 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;\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 { removeNode } from '../dom/index';\n\n/**\n * Queue of components that have been mounted and are awaiting componentDidMount\n * @type {Array<import('../component').Component>}\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.pop())) {\n\t\tif (options.afterMount) options.afterMount(c);\n\t\tif (c.componentDidMount) c.componentDidMount();\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').PreactElement} 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').PreactElement} The created/mutated element\n * @private\n */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\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);\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').PreactElement} 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) {\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/preact/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);\n\t}\n\n\n\t// Apply attributes/props from VNode to the DOM Element:\n\tdiffAttributes(out, vnode.attributes, props);\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').PreactElement} dom Element whose children should be compared & mutated\n * @param {Array<import('../vnode').VNode>} 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) {\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<len; i++) {\n\t\t\tlet child = originalChildren[i],\n\t\t\t\tprops = child[ATTR_KEY],\n\t\t\t\tkey = vlen && props ? child._component ? child._component.__key : props.key : null;\n\t\t\tif (key!=null) {\n\t\t\t\tkeyedLen++;\n\t\t\t\tkeyed[key] = child;\n\t\t\t}\n\t\t\telse if (props || (child.splitText!==undefined ? (isHydrating ? child.nodeValue.trim() : true) : isHydrating)) {\n\t\t\t\tchildren[childrenLen++] = child;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (vlen!==0) {\n\t\tfor (let i=0; i<vlen; i++) {\n\t\t\tvchild = vchildren[i];\n\t\t\tchild = null;\n\n\t\t\t// attempt to find a node based on key matching\n\t\t\tlet key = vchild.key;\n\t\t\tif (key!=null) {\n\t\t\t\tif (keyedLen && keyed[key]!==undefined) {\n\t\t\t\t\tchild = keyed[key];\n\t\t\t\t\tkeyed[key] = undefined;\n\t\t\t\t\tkeyedLen--;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// attempt to pluck a node of the same type from the existing children\n\t\t\telse if (min<childrenLen) {\n\t\t\t\tfor (j=min; j<childrenLen; j++) {\n\t\t\t\t\tif (children[j]!==undefined && isSameNodeType(c = children[j], vchild, isHydrating)) {\n\t\t\t\t\t\tchild = c;\n\t\t\t\t\t\tchildren[j] = undefined;\n\t\t\t\t\t\tif (j===childrenLen-1) childrenLen--;\n\t\t\t\t\t\tif (j===min) min++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// morph the matched/found/created DOM child to match vchild (deep)\n\t\t\tchild = idiff(child, vchild, context, mountAll);\n\n\t\t\tf = originalChildren[i];\n\t\t\tif (child && child!==dom && child!==f) {\n\t\t\t\tif (f==null) {\n\t\t\t\t\tdom.appendChild(child);\n\t\t\t\t}\n\t\t\t\telse if (child===f.nextSibling) {\n\t\t\t\t\tremoveNode(f);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdom.insertBefore(child, f);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\t// remove unused keyed children:\n\tif (keyedLen) {\n\t\tfor (let i in keyed) if (keyed[i]!==undefined) recollectNodeTree(keyed[i], false);\n\t}\n\n\t// remove orphaned unkeyed children:\n\twhile (min<=childrenLen) {\n\t\tif ((child = children[childrenLen--])!==undefined) recollectNodeTree(child, false);\n\t}\n}\n\n\n\n/**\n * Recursively recycle (or just unmount) a node and its descendants.\n * @param {import('../dom').PreactElement} node DOM node to start\n * unmount/removal from\n * @param {boolean} [unmountOnly=false] If `true`, only triggers unmount\n * lifecycle, skips removal\n */\nexport function recollectNodeTree(node, unmountOnly) {\n\tlet component = node._component;\n\tif (component) {\n\t\t// if node is owned by a Component, unmount that component (ends up recursing back here)\n\t\tunmountComponent(component);\n\t}\n\telse {\n\t\t// If the node's VNode had a ref function, invoke it with null here.\n\t\t// (this is part of the React spec, and smart for unsetting references)\n\t\tif (node[ATTR_KEY]!=null && node[ATTR_KEY].ref) node[ATTR_KEY].ref(null);\n\n\t\tif (unmountOnly===false || node[ATTR_KEY]==null) {\n\t\t\tremoveNode(node);\n\t\t}\n\n\t\tremoveChildren(node);\n\t}\n}\n\n\n/**\n * Recollect/unmount all children.\n *\t- we use .lastChild here because it causes less reflow than .firstChild\n *\t- it's also cheaper than accessing the .childNodes Live NodeList\n */\nexport function removeChildren(node) {\n\tnode = node.lastChild;\n\twhile (node) {\n\t\tlet next = node.previousSibling;\n\t\trecollectNodeTree(node, true);\n\t\tnode = next;\n\t}\n}\n\n\n/**\n * Apply differences in attributes from a VNode to the given DOM Element.\n * @param {import('../dom').PreactElement} dom Element with attributes to diff `attrs` against\n * @param {object} attrs The desired end-state key-value attribute pairs\n * @param {object} old Current/previous attributes (from previous VNode or\n * element's prop cache)\n */\nfunction diffAttributes(dom, attrs, old) {\n\tlet name;\n\n\t// remove attributes no longer present on the vnode by setting them to undefined\n\tfor (name in old) {\n\t\tif (!(attrs && attrs[name]!=null) && old[name]!=null) {\n\t\t\tsetAccessor(dom, name, old[name], old[name] = undefined, isSvgMode);\n\t\t}\n\t}\n\n\t// add new & update changed attributes\n\tfor (name in attrs) {\n\t\tif (name!=='children' && name!=='innerHTML' && (!(name in old) || attrs[name]!==(name==='value' || name==='checked' ? dom[name] : old[name]))) {\n\t\t\tsetAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode);\n\t\t}\n\t}\n}\n","import { Component } from '../component';\n\n/**\n * Retains a pool of Components for re-use.\n * @type {Component[]}\n * @private\n */\nexport const recyclerComponents = [];\n\n\n/**\n * Create a component. Normalizes differences between PFC's and classful\n * Components.\n * @param {function} Ctor The constructor of the component to create\n * @param {object} props The initial props of the component\n * @param {object} context The initial context of the component\n * @returns {import('../component').Component}\n */\nexport function createComponent(Ctor, props, context) {\n\tlet inst, i = recyclerComponents.length;\n\n\tif (Ctor.prototype && Ctor.prototype.render) {\n\t\tinst = new Ctor(props, context);\n\t\tComponent.call(inst, props, context);\n\t}\n\telse {\n\t\tinst = new Component(props, context);\n\t\tinst.constructor = Ctor;\n\t\tinst.render = doRender;\n\t}\n\n\n\twhile (i--) {\n\t\tif (recyclerComponents[i].constructor===Ctor) {\n\t\t\tinst.nextBase = recyclerComponents[i].nextBase;\n\t\t\trecyclerComponents.splice(i, 1);\n\t\t\treturn inst;\n\t\t}\n\t}\n\n\treturn inst;\n}\n\n\n/** The `.render()` method for a PFC backing instance. */\nfunction doRender(props, state, context) {\n\treturn this.constructor(props, context);\n}\n","import { SYNC_RENDER, NO_RENDER, FORCE_RENDER, ASYNC_RENDER, ATTR_KEY } from '../constants';\nimport options from '../options';\nimport { extend } from '../util';\nimport { enqueueRender } from '../render-queue';\nimport { getNodeProps } from './index';\nimport { diff, mounts, diffLevel, flushMounts, recollectNodeTree, removeChildren } from './diff';\nimport { createComponent, recyclerComponents } from './component-recycler';\nimport { removeNode } from '../dom/index';\n\n/**\n * Set a component's `props` and possibly re-render the component\n * @param {import('../component').Component} component The Component to set props on\n * @param {object} props The new props\n * @param {number} renderMode Render options - specifies how to re-render the component\n * @param {object} context The new context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n */\nexport function setComponentProps(component, props, renderMode, context, mountAll) {\n\tif (component._disable) return;\n\tcomponent._disable = true;\n\n\tcomponent.__ref = props.ref;\n\tcomponent.__key = props.key;\n\tdelete props.ref;\n\tdelete props.key;\n\n\tif (typeof component.constructor.getDerivedStateFromProps === 'undefined') {\n\t\tif (!component.base || mountAll) {\n\t\t\tif (component.componentWillMount) component.componentWillMount();\n\t\t}\n\t\telse if (component.componentWillReceiveProps) {\n\t\t\tcomponent.componentWillReceiveProps(props, context);\n\t\t}\n\t}\n\n\tif (context && context!==component.context) {\n\t\tif (!component.prevContext) component.prevContext = component.context;\n\t\tcomponent.context = context;\n\t}\n\n\tif (!component.prevProps) component.prevProps = component.props;\n\tcomponent.props = props;\n\n\tcomponent._disable = false;\n\n\tif (renderMode!==NO_RENDER) {\n\t\tif (renderMode===SYNC_RENDER || options.syncComponentUpdates!==false || !component.base) {\n\t\t\trenderComponent(component, SYNC_RENDER, mountAll);\n\t\t}\n\t\telse {\n\t\t\tenqueueRender(component);\n\t\t}\n\t}\n\n\tif (component.__ref) component.__ref(component);\n}\n\n\n\n/**\n * Render a Component, triggering necessary lifecycle events and taking\n * High-Order Components into account.\n * @param {import('../component').Component} component The component to render\n * @param {number} [renderMode] render mode, see constants.js for available options.\n * @param {boolean} [mountAll] Whether or not to immediately mount all components\n * @param {boolean} [isChild] ?\n * @private\n */\nexport function renderComponent(component, renderMode, mountAll, isChild) {\n\tif (component._disable) return;\n\n\tlet props = component.props,\n\t\tstate = component.state,\n\t\tcontext = component.context,\n\t\tpreviousProps = component.prevProps || props,\n\t\tpreviousState = component.prevState || state,\n\t\tpreviousContext = component.prevContext || context,\n\t\tisUpdate = component.base,\n\t\tnextBase = component.nextBase,\n\t\tinitialBase = isUpdate || nextBase,\n\t\tinitialChildComponent = component._component,\n\t\tskip = false,\n\t\tsnapshot = previousContext,\n\t\trendered, inst, cbase;\n\n\tif (component.constructor.getDerivedStateFromProps) {\n\t\tstate = extend(extend({}, state), component.constructor.getDerivedStateFromProps(props, state));\n\t\tcomponent.state = state;\n\t}\n\n\t// if updating\n\tif (isUpdate) {\n\t\tcomponent.props = previousProps;\n\t\tcomponent.state = previousState;\n\t\tcomponent.context = previousContext;\n\t\tif (renderMode!==FORCE_RENDER\n\t\t\t&& component.shouldComponentUpdate\n\t\t\t&& component.shouldComponentUpdate(props, state, context) === false) {\n\t\t\tskip = true;\n\t\t}\n\t\telse if (component.componentWillUpdate) {\n\t\t\tcomponent.componentWillUpdate(props, state, context);\n\t\t}\n\t\tcomponent.props = props;\n\t\tcomponent.state = state;\n\t\tcomponent.context = context;\n\t}\n\n\tcomponent.prevProps = component.prevState = component.prevContext = component.nextBase = null;\n\tcomponent._dirty = false;\n\n\tif (!skip) {\n\t\trendered = component.render(props, state, context);\n\n\t\t// context to pass to the child, can be updated via (grand-)parent component\n\t\tif (component.getChildContext) {\n\t\t\tcontext = extend(extend({}, context), component.getChildContext());\n\t\t}\n\n\t\tif (isUpdate && component.getSnapshotBeforeUpdate) {\n\t\t\tsnapshot = component.getSnapshotBeforeUpdate(previousProps, previousState);\n\t\t}\n\n\t\tlet childComponent = rendered && rendered.nodeName,\n\t\t\ttoUnmount, base;\n\n\t\tif (typeof childComponent==='function') {\n\t\t\t// set up high order component link\n\n\t\t\tlet childProps = getNodeProps(rendered);\n\t\t\tinst = initialChildComponent;\n\n\t\t\tif (inst && inst.constructor===childComponent && childProps.key==inst.__key) {\n\t\t\t\tsetComponentProps(inst, childProps, SYNC_RENDER, context, false);\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttoUnmount = inst;\n\n\t\t\t\tcomponent._component = inst = createComponent(childComponent, childProps, context);\n\t\t\t\tinst.nextBase = inst.nextBase || nextBase;\n\t\t\t\tinst._parentComponent = component;\n\t\t\t\tsetComponentProps(inst, childProps, NO_RENDER, context, false);\n\t\t\t\trenderComponent(inst, SYNC_RENDER, mountAll, true);\n\t\t\t}\n\n\t\t\tbase = inst.base;\n\t\t}\n\t\telse {\n\t\t\tcbase = initialBase;\n\n\t\t\t// destroy high order component link\n\t\t\ttoUnmount = initialChildComponent;\n\t\t\tif (toUnmount) {\n\t\t\t\tcbase = component._component = null;\n\t\t\t}\n\n\t\t\tif (initialBase || renderMode===SYNC_RENDER) {\n\t\t\t\tif (cbase) cbase._component = null;\n\t\t\t\tbase = diff(cbase, rendered, context, mountAll || !isUpdate, initialBase && initialBase.parentNode, true);\n\t\t\t}\n\t\t}\n\n\t\tif (initialBase && base!==initialBase && inst!==initialChildComponent) {\n\t\t\tlet baseParent = initialBase.parentNode;\n\t\t\tif (baseParent && base!==baseParent) {\n\t\t\t\tbaseParent.replaceChild(base, initialBase);\n\n\t\t\t\tif (!toUnmount) {\n\t\t\t\t\tinitialBase._component = null;\n\t\t\t\t\trecollectNodeTree(initialBase, false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (toUnmount) {\n\t\t\tunmountComponent(toUnmount);\n\t\t}\n\n\t\tcomponent.base = base;\n\t\tif (base && !isChild) {\n\t\t\tlet componentRef = component,\n\t\t\t\tt = component;\n\t\t\twhile ((t=t._parentComponent)) {\n\t\t\t\t(componentRef = t).base = base;\n\t\t\t}\n\t\t\tbase._component = componentRef;\n\t\t\tbase._componentConstructor = componentRef.constructor;\n\t\t}\n\t}\n\n\tif (!isUpdate || mountAll) {\n\t\tmounts.unshift(component);\n\t}\n\telse if (!skip) {\n\t\t// Ensure that pending componentDidMount() hooks of child components\n\t\t// are called before the componentDidUpdate() hook in the parent.\n\t\t// Note: disabled as it causes duplicate hooks, see https://github.com/developit/preact/issues/750\n\t\t// flushMounts();\n\n\t\tif (component.componentDidUpdate) {\n\t\t\tcomponent.componentDidUpdate(previousProps, previousState, snapshot);\n\t\t}\n\t\tif (options.afterUpdate) options.afterUpdate(component);\n\t}\n\n\twhile (component._renderCallbacks.length) component._renderCallbacks.pop().call(component);\n\n\tif (!diffLevel && !isChild) flushMounts();\n}\n\n\n\n/**\n * Apply the Component referenced by a VNode to the DOM.\n * @param {import('../dom').PreactElement} dom The DOM node to mutate\n * @param {import('../vnode').VNode} vnode A Component-referencing VNode\n * @param {object} context The current context\n * @param {boolean} mountAll Whether or not to immediately mount all components\n * @returns {import('../dom').PreactElement} The created/mutated element\n * @private\n */\nexport function buildComponentFromVNode(dom, vnode, context, mountAll) {\n\tlet c = dom && dom._component,\n\t\toriginalComponent = c,\n\t\toldDom = dom,\n\t\tisDirectOwner = c && dom._componentConstructor===vnode.nodeName,\n\t\tisOwner = isDirectOwner,\n\t\tprops = getNodeProps(vnode);\n\twhile (c && !isOwner && (c=c._parentComponent)) {\n\t\tisOwner = c.constructor===vnode.nodeName;\n\t}\n\n\tif (c && isOwner && (!mountAll || c._component)) {\n\t\tsetComponentProps(c, props, ASYNC_RENDER, context, mountAll);\n\t\tdom = c.base;\n\t}\n\telse {\n\t\tif (originalComponent && !isDirectOwner) {\n\t\t\tunmountComponent(originalComponent);\n\t\t\tdom = oldDom = null;\n\t\t}\n\n\t\tc = createComponent(vnode.nodeName, props, context);\n\t\tif (dom && !c.nextBase) {\n\t\t\tc.nextBase = dom;\n\t\t\t// passing dom/oldDom as nextBase will recycle it if unused, so bypass recycling on L229:\n\t\t\toldDom = null;\n\t\t}\n\t\tsetComponentProps(c, props, SYNC_RENDER, context, mountAll);\n\t\tdom = c.base;\n\n\t\tif (oldDom && dom!==oldDom) {\n\t\t\toldDom._component = null;\n\t\t\trecollectNodeTree(oldDom, false);\n\t\t}\n\t}\n\n\treturn dom;\n}\n\n\n\n/**\n * Remove a component from the DOM and recycle it.\n * @param {import('../component').Component} component The Component instance to unmount\n * @private\n */\nexport function unmountComponent(component) {\n\tif (options.beforeUnmount) options.beforeUnmount(component);\n\n\tlet base = component.base;\n\n\tcomponent._disable = true;\n\n\tif (component.componentWillUnmount) component.componentWillUnmount();\n\n\tcomponent.base = null;\n\n\t// recursively tear down & recollect high-order component children:\n\tlet inner = component._component;\n\tif (inner) {\n\t\tunmountComponent(inner);\n\t}\n\telse if (base) {\n\t\tif (base[ATTR_KEY] && base[ATTR_KEY].ref) base[ATTR_KEY].ref(null);\n\n\t\tcomponent.nextBase = base;\n\n\t\tremoveNode(base);\n\t\trecyclerComponents.push(component);\n\n\t\tremoveChildren(base);\n\t}\n\n\tif (component.__ref) component.__ref(null);\n}\n","import { FORCE_RENDER } from './constants';\nimport { extend } from './util';\nimport { renderComponent } from './vdom/component';\nimport { enqueueRender } from './render-queue';\n/**\n * Base Component class.\n * Provides `setState()` and `forceUpdate()`, which trigger rendering.\n * @typedef {object} Component\n * @param {object} props The initial component props\n * @param {object} context The initial context from parent components' getChildContext\n * @public\n *\n * @example\n * class MyFoo extends Component {\n * render(props, state) {\n * return <div />;\n * }\n * }\n */\nexport function Component(props, context) {\n\tthis._dirty = true;\n\n\t/**\n\t * @public\n\t * @type {object}\n\t */\n\tthis.context = context;\n\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 * Update component state and schedule a re-render.\n\t * @param {object} state A dict of state properties to be shallowly merged\n\t * \tinto the current state, or a function that will produce such a dict. The\n\t * \tfunction is called with the current state and props.\n\t * @param {() => void} callback A function to be called once component state is\n\t * \tupdated\n\t */\n\tsetState(state, callback) {\n\t\tif (!this.prevState) this.prevState = this.state;\n\t\tthis.state = extend(\n\t\t\textend({}, this.state),\n\t\t\ttypeof state === 'function' ? state(this.state, this.props) : state\n\t\t);\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t},\n\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\tforceUpdate(callback) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\trenderComponent(this, FORCE_RENDER);\n\t},\n\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<VNode | string>} 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 Preact event listeners. The return value (if any) replaces the native browser event given to event listeners\n */\n\n/** @type {Options} */\nconst options = {};\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').PreactElement} parent DOM element to render into\n * @param {import('./dom').PreactElement} [merge] Attempt to re-use an existing DOM tree rooted at\n * `merge`\n * @public\n *\n * @example\n * // render a div into <body>:\n * render(<div id=\"hello\">hello!</div>, document.body);\n *\n * @example\n * // render a \"Thing\" component into #foo:\n * const Thing = ({ name }) => <span>{ name }</span>;\n * render(<Thing name=\"one\" />, document.querySelector('#foo'));\n */\nexport function render(vnode, parent, merge) {\n\treturn diff(merge, vnode, {}, false, 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\nexport default {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n\nexport {\n\th,\n\tcreateElement,\n\tcloneElement,\n\tComponent,\n\trender,\n\trerender,\n\toptions\n};\n"]}
|
@@ -0,0 +1,715 @@
|
|
1
|
+
var VNode = function VNode() {};
|
2
|
+
|
3
|
+
var options = {};
|
4
|
+
|
5
|
+
var stack = [];
|
6
|
+
|
7
|
+
var EMPTY_CHILDREN = [];
|
8
|
+
|
9
|
+
function h(nodeName, attributes) {
|
10
|
+
var children = EMPTY_CHILDREN,
|
11
|
+
lastSimple,
|
12
|
+
child,
|
13
|
+
simple,
|
14
|
+
i;
|
15
|
+
for (i = arguments.length; i-- > 2;) {
|
16
|
+
stack.push(arguments[i]);
|
17
|
+
}
|
18
|
+
if (attributes && attributes.children != null) {
|
19
|
+
if (!stack.length) stack.push(attributes.children);
|
20
|
+
delete attributes.children;
|
21
|
+
}
|
22
|
+
while (stack.length) {
|
23
|
+
if ((child = stack.pop()) && child.pop !== undefined) {
|
24
|
+
for (i = child.length; i--;) {
|
25
|
+
stack.push(child[i]);
|
26
|
+
}
|
27
|
+
} else {
|
28
|
+
if (typeof child === 'boolean') child = null;
|
29
|
+
|
30
|
+
if (simple = typeof nodeName !== 'function') {
|
31
|
+
if (child == null) child = '';else if (typeof child === 'number') child = String(child);else if (typeof child !== 'string') simple = false;
|
32
|
+
}
|
33
|
+
|
34
|
+
if (simple && lastSimple) {
|
35
|
+
children[children.length - 1] += child;
|
36
|
+
} else if (children === EMPTY_CHILDREN) {
|
37
|
+
children = [child];
|
38
|
+
} else {
|
39
|
+
children.push(child);
|
40
|
+
}
|
41
|
+
|
42
|
+
lastSimple = simple;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
var p = new VNode();
|
47
|
+
p.nodeName = nodeName;
|
48
|
+
p.children = children;
|
49
|
+
p.attributes = attributes == null ? undefined : attributes;
|
50
|
+
p.key = attributes == null ? undefined : attributes.key;
|
51
|
+
|
52
|
+
if (options.vnode !== undefined) options.vnode(p);
|
53
|
+
|
54
|
+
return p;
|
55
|
+
}
|
56
|
+
|
57
|
+
function extend(obj, props) {
|
58
|
+
for (var i in props) {
|
59
|
+
obj[i] = props[i];
|
60
|
+
}return obj;
|
61
|
+
}
|
62
|
+
|
63
|
+
var defer = typeof Promise == 'function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;
|
64
|
+
|
65
|
+
function cloneElement(vnode, props) {
|
66
|
+
return h(vnode.nodeName, extend(extend({}, vnode.attributes), props), arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children);
|
67
|
+
}
|
68
|
+
|
69
|
+
var IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;
|
70
|
+
|
71
|
+
var items = [];
|
72
|
+
|
73
|
+
function enqueueRender(component) {
|
74
|
+
if (!component._dirty && (component._dirty = true) && items.push(component) == 1) {
|
75
|
+
(options.debounceRendering || defer)(rerender);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
function rerender() {
|
80
|
+
var p,
|
81
|
+
list = items;
|
82
|
+
items = [];
|
83
|
+
while (p = list.pop()) {
|
84
|
+
if (p._dirty) renderComponent(p);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
function isSameNodeType(node, vnode, hydrating) {
|
89
|
+
if (typeof vnode === 'string' || typeof vnode === 'number') {
|
90
|
+
return node.splitText !== undefined;
|
91
|
+
}
|
92
|
+
if (typeof vnode.nodeName === 'string') {
|
93
|
+
return !node._componentConstructor && isNamedNode(node, vnode.nodeName);
|
94
|
+
}
|
95
|
+
return hydrating || node._componentConstructor === vnode.nodeName;
|
96
|
+
}
|
97
|
+
|
98
|
+
function isNamedNode(node, nodeName) {
|
99
|
+
return node.normalizedNodeName === nodeName || node.nodeName.toLowerCase() === nodeName.toLowerCase();
|
100
|
+
}
|
101
|
+
|
102
|
+
function getNodeProps(vnode) {
|
103
|
+
var props = extend({}, vnode.attributes);
|
104
|
+
props.children = vnode.children;
|
105
|
+
|
106
|
+
var defaultProps = vnode.nodeName.defaultProps;
|
107
|
+
if (defaultProps !== undefined) {
|
108
|
+
for (var i in defaultProps) {
|
109
|
+
if (props[i] === undefined) {
|
110
|
+
props[i] = defaultProps[i];
|
111
|
+
}
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
return props;
|
116
|
+
}
|
117
|
+
|
118
|
+
function createNode(nodeName, isSvg) {
|
119
|
+
var node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);
|
120
|
+
node.normalizedNodeName = nodeName;
|
121
|
+
return node;
|
122
|
+
}
|
123
|
+
|
124
|
+
function removeNode(node) {
|
125
|
+
var parentNode = node.parentNode;
|
126
|
+
if (parentNode) parentNode.removeChild(node);
|
127
|
+
}
|
128
|
+
|
129
|
+
function setAccessor(node, name, old, value, isSvg) {
|
130
|
+
if (name === 'className') name = 'class';
|
131
|
+
|
132
|
+
if (name === 'key') {} else if (name === 'ref') {
|
133
|
+
if (old) old(null);
|
134
|
+
if (value) value(node);
|
135
|
+
} else if (name === 'class' && !isSvg) {
|
136
|
+
node.className = value || '';
|
137
|
+
} else if (name === 'style') {
|
138
|
+
if (!value || typeof value === 'string' || typeof old === 'string') {
|
139
|
+
node.style.cssText = value || '';
|
140
|
+
}
|
141
|
+
if (value && typeof value === 'object') {
|
142
|
+
if (typeof old !== 'string') {
|
143
|
+
for (var i in old) {
|
144
|
+
if (!(i in value)) node.style[i] = '';
|
145
|
+
}
|
146
|
+
}
|
147
|
+
for (var i in value) {
|
148
|
+
node.style[i] = typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false ? value[i] + 'px' : value[i];
|
149
|
+
}
|
150
|
+
}
|
151
|
+
} else if (name === 'dangerouslySetInnerHTML') {
|
152
|
+
if (value) node.innerHTML = value.__html || '';
|
153
|
+
} else if (name[0] == 'o' && name[1] == 'n') {
|
154
|
+
var useCapture = name !== (name = name.replace(/Capture$/, ''));
|
155
|
+
name = name.toLowerCase().substring(2);
|
156
|
+
if (value) {
|
157
|
+
if (!old) node.addEventListener(name, eventProxy, useCapture);
|
158
|
+
} else {
|
159
|
+
node.removeEventListener(name, eventProxy, useCapture);
|
160
|
+
}
|
161
|
+
(node._listeners || (node._listeners = {}))[name] = value;
|
162
|
+
} else if (name !== 'list' && name !== 'type' && !isSvg && name in node) {
|
163
|
+
try {
|
164
|
+
node[name] = value == null ? '' : value;
|
165
|
+
} catch (e) {}
|
166
|
+
if ((value == null || value === false) && name != 'spellcheck') node.removeAttribute(name);
|
167
|
+
} else {
|
168
|
+
var ns = isSvg && name !== (name = name.replace(/^xlink:?/, ''));
|
169
|
+
|
170
|
+
if (value == null || value === false) {
|
171
|
+
if (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());else node.removeAttribute(name);
|
172
|
+
} else if (typeof value !== 'function') {
|
173
|
+
if (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);else node.setAttribute(name, value);
|
174
|
+
}
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
function eventProxy(e) {
|
179
|
+
return this._listeners[e.type](options.event && options.event(e) || e);
|
180
|
+
}
|
181
|
+
|
182
|
+
var mounts = [];
|
183
|
+
|
184
|
+
var diffLevel = 0;
|
185
|
+
|
186
|
+
var isSvgMode = false;
|
187
|
+
|
188
|
+
var hydrating = false;
|
189
|
+
|
190
|
+
function flushMounts() {
|
191
|
+
var c;
|
192
|
+
while (c = mounts.pop()) {
|
193
|
+
if (options.afterMount) options.afterMount(c);
|
194
|
+
if (c.componentDidMount) c.componentDidMount();
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
function diff(dom, vnode, context, mountAll, parent, componentRoot) {
|
199
|
+
if (!diffLevel++) {
|
200
|
+
isSvgMode = parent != null && parent.ownerSVGElement !== undefined;
|
201
|
+
|
202
|
+
hydrating = dom != null && !('__preactattr_' in dom);
|
203
|
+
}
|
204
|
+
|
205
|
+
var ret = idiff(dom, vnode, context, mountAll, componentRoot);
|
206
|
+
|
207
|
+
if (parent && ret.parentNode !== parent) parent.appendChild(ret);
|
208
|
+
|
209
|
+
if (! --diffLevel) {
|
210
|
+
hydrating = false;
|
211
|
+
|
212
|
+
if (!componentRoot) flushMounts();
|
213
|
+
}
|
214
|
+
|
215
|
+
return ret;
|
216
|
+
}
|
217
|
+
|
218
|
+
function idiff(dom, vnode, context, mountAll, componentRoot) {
|
219
|
+
var out = dom,
|
220
|
+
prevSvgMode = isSvgMode;
|
221
|
+
|
222
|
+
if (vnode == null || typeof vnode === 'boolean') vnode = '';
|
223
|
+
|
224
|
+
if (typeof vnode === 'string' || typeof vnode === 'number') {
|
225
|
+
if (dom && dom.splitText !== undefined && dom.parentNode && (!dom._component || componentRoot)) {
|
226
|
+
if (dom.nodeValue != vnode) {
|
227
|
+
dom.nodeValue = vnode;
|
228
|
+
}
|
229
|
+
} else {
|
230
|
+
out = document.createTextNode(vnode);
|
231
|
+
if (dom) {
|
232
|
+
if (dom.parentNode) dom.parentNode.replaceChild(out, dom);
|
233
|
+
recollectNodeTree(dom, true);
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
out['__preactattr_'] = true;
|
238
|
+
|
239
|
+
return out;
|
240
|
+
}
|
241
|
+
|
242
|
+
var vnodeName = vnode.nodeName;
|
243
|
+
if (typeof vnodeName === 'function') {
|
244
|
+
return buildComponentFromVNode(dom, vnode, context, mountAll);
|
245
|
+
}
|
246
|
+
|
247
|
+
isSvgMode = vnodeName === 'svg' ? true : vnodeName === 'foreignObject' ? false : isSvgMode;
|
248
|
+
|
249
|
+
vnodeName = String(vnodeName);
|
250
|
+
if (!dom || !isNamedNode(dom, vnodeName)) {
|
251
|
+
out = createNode(vnodeName, isSvgMode);
|
252
|
+
|
253
|
+
if (dom) {
|
254
|
+
while (dom.firstChild) {
|
255
|
+
out.appendChild(dom.firstChild);
|
256
|
+
}
|
257
|
+
if (dom.parentNode) dom.parentNode.replaceChild(out, dom);
|
258
|
+
|
259
|
+
recollectNodeTree(dom, true);
|
260
|
+
}
|
261
|
+
}
|
262
|
+
|
263
|
+
var fc = out.firstChild,
|
264
|
+
props = out['__preactattr_'],
|
265
|
+
vchildren = vnode.children;
|
266
|
+
|
267
|
+
if (props == null) {
|
268
|
+
props = out['__preactattr_'] = {};
|
269
|
+
for (var a = out.attributes, i = a.length; i--;) {
|
270
|
+
props[a[i].name] = a[i].value;
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
if (!hydrating && vchildren && vchildren.length === 1 && typeof vchildren[0] === 'string' && fc != null && fc.splitText !== undefined && fc.nextSibling == null) {
|
275
|
+
if (fc.nodeValue != vchildren[0]) {
|
276
|
+
fc.nodeValue = vchildren[0];
|
277
|
+
}
|
278
|
+
} else if (vchildren && vchildren.length || fc != null) {
|
279
|
+
innerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML != null);
|
280
|
+
}
|
281
|
+
|
282
|
+
diffAttributes(out, vnode.attributes, props);
|
283
|
+
|
284
|
+
isSvgMode = prevSvgMode;
|
285
|
+
|
286
|
+
return out;
|
287
|
+
}
|
288
|
+
|
289
|
+
function innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {
|
290
|
+
var originalChildren = dom.childNodes,
|
291
|
+
children = [],
|
292
|
+
keyed = {},
|
293
|
+
keyedLen = 0,
|
294
|
+
min = 0,
|
295
|
+
len = originalChildren.length,
|
296
|
+
childrenLen = 0,
|
297
|
+
vlen = vchildren ? vchildren.length : 0,
|
298
|
+
j,
|
299
|
+
c,
|
300
|
+
f,
|
301
|
+
vchild,
|
302
|
+
child;
|
303
|
+
|
304
|
+
if (len !== 0) {
|
305
|
+
for (var i = 0; i < len; i++) {
|
306
|
+
var _child = originalChildren[i],
|
307
|
+
props = _child['__preactattr_'],
|
308
|
+
key = vlen && props ? _child._component ? _child._component.__key : props.key : null;
|
309
|
+
if (key != null) {
|
310
|
+
keyedLen++;
|
311
|
+
keyed[key] = _child;
|
312
|
+
} else if (props || (_child.splitText !== undefined ? isHydrating ? _child.nodeValue.trim() : true : isHydrating)) {
|
313
|
+
children[childrenLen++] = _child;
|
314
|
+
}
|
315
|
+
}
|
316
|
+
}
|
317
|
+
|
318
|
+
if (vlen !== 0) {
|
319
|
+
for (var i = 0; i < vlen; i++) {
|
320
|
+
vchild = vchildren[i];
|
321
|
+
child = null;
|
322
|
+
|
323
|
+
var key = vchild.key;
|
324
|
+
if (key != null) {
|
325
|
+
if (keyedLen && keyed[key] !== undefined) {
|
326
|
+
child = keyed[key];
|
327
|
+
keyed[key] = undefined;
|
328
|
+
keyedLen--;
|
329
|
+
}
|
330
|
+
} else if (min < childrenLen) {
|
331
|
+
for (j = min; j < childrenLen; j++) {
|
332
|
+
if (children[j] !== undefined && isSameNodeType(c = children[j], vchild, isHydrating)) {
|
333
|
+
child = c;
|
334
|
+
children[j] = undefined;
|
335
|
+
if (j === childrenLen - 1) childrenLen--;
|
336
|
+
if (j === min) min++;
|
337
|
+
break;
|
338
|
+
}
|
339
|
+
}
|
340
|
+
}
|
341
|
+
|
342
|
+
child = idiff(child, vchild, context, mountAll);
|
343
|
+
|
344
|
+
f = originalChildren[i];
|
345
|
+
if (child && child !== dom && child !== f) {
|
346
|
+
if (f == null) {
|
347
|
+
dom.appendChild(child);
|
348
|
+
} else if (child === f.nextSibling) {
|
349
|
+
removeNode(f);
|
350
|
+
} else {
|
351
|
+
dom.insertBefore(child, f);
|
352
|
+
}
|
353
|
+
}
|
354
|
+
}
|
355
|
+
}
|
356
|
+
|
357
|
+
if (keyedLen) {
|
358
|
+
for (var i in keyed) {
|
359
|
+
if (keyed[i] !== undefined) recollectNodeTree(keyed[i], false);
|
360
|
+
}
|
361
|
+
}
|
362
|
+
|
363
|
+
while (min <= childrenLen) {
|
364
|
+
if ((child = children[childrenLen--]) !== undefined) recollectNodeTree(child, false);
|
365
|
+
}
|
366
|
+
}
|
367
|
+
|
368
|
+
function recollectNodeTree(node, unmountOnly) {
|
369
|
+
var component = node._component;
|
370
|
+
if (component) {
|
371
|
+
unmountComponent(component);
|
372
|
+
} else {
|
373
|
+
if (node['__preactattr_'] != null && node['__preactattr_'].ref) node['__preactattr_'].ref(null);
|
374
|
+
|
375
|
+
if (unmountOnly === false || node['__preactattr_'] == null) {
|
376
|
+
removeNode(node);
|
377
|
+
}
|
378
|
+
|
379
|
+
removeChildren(node);
|
380
|
+
}
|
381
|
+
}
|
382
|
+
|
383
|
+
function removeChildren(node) {
|
384
|
+
node = node.lastChild;
|
385
|
+
while (node) {
|
386
|
+
var next = node.previousSibling;
|
387
|
+
recollectNodeTree(node, true);
|
388
|
+
node = next;
|
389
|
+
}
|
390
|
+
}
|
391
|
+
|
392
|
+
function diffAttributes(dom, attrs, old) {
|
393
|
+
var name;
|
394
|
+
|
395
|
+
for (name in old) {
|
396
|
+
if (!(attrs && attrs[name] != null) && old[name] != null) {
|
397
|
+
setAccessor(dom, name, old[name], old[name] = undefined, isSvgMode);
|
398
|
+
}
|
399
|
+
}
|
400
|
+
|
401
|
+
for (name in attrs) {
|
402
|
+
if (name !== 'children' && name !== 'innerHTML' && (!(name in old) || attrs[name] !== (name === 'value' || name === 'checked' ? dom[name] : old[name]))) {
|
403
|
+
setAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode);
|
404
|
+
}
|
405
|
+
}
|
406
|
+
}
|
407
|
+
|
408
|
+
var recyclerComponents = [];
|
409
|
+
|
410
|
+
function createComponent(Ctor, props, context) {
|
411
|
+
var inst,
|
412
|
+
i = recyclerComponents.length;
|
413
|
+
|
414
|
+
if (Ctor.prototype && Ctor.prototype.render) {
|
415
|
+
inst = new Ctor(props, context);
|
416
|
+
Component.call(inst, props, context);
|
417
|
+
} else {
|
418
|
+
inst = new Component(props, context);
|
419
|
+
inst.constructor = Ctor;
|
420
|
+
inst.render = doRender;
|
421
|
+
}
|
422
|
+
|
423
|
+
while (i--) {
|
424
|
+
if (recyclerComponents[i].constructor === Ctor) {
|
425
|
+
inst.nextBase = recyclerComponents[i].nextBase;
|
426
|
+
recyclerComponents.splice(i, 1);
|
427
|
+
return inst;
|
428
|
+
}
|
429
|
+
}
|
430
|
+
|
431
|
+
return inst;
|
432
|
+
}
|
433
|
+
|
434
|
+
function doRender(props, state, context) {
|
435
|
+
return this.constructor(props, context);
|
436
|
+
}
|
437
|
+
|
438
|
+
function setComponentProps(component, props, renderMode, context, mountAll) {
|
439
|
+
if (component._disable) return;
|
440
|
+
component._disable = true;
|
441
|
+
|
442
|
+
component.__ref = props.ref;
|
443
|
+
component.__key = props.key;
|
444
|
+
delete props.ref;
|
445
|
+
delete props.key;
|
446
|
+
|
447
|
+
if (typeof component.constructor.getDerivedStateFromProps === 'undefined') {
|
448
|
+
if (!component.base || mountAll) {
|
449
|
+
if (component.componentWillMount) component.componentWillMount();
|
450
|
+
} else if (component.componentWillReceiveProps) {
|
451
|
+
component.componentWillReceiveProps(props, context);
|
452
|
+
}
|
453
|
+
}
|
454
|
+
|
455
|
+
if (context && context !== component.context) {
|
456
|
+
if (!component.prevContext) component.prevContext = component.context;
|
457
|
+
component.context = context;
|
458
|
+
}
|
459
|
+
|
460
|
+
if (!component.prevProps) component.prevProps = component.props;
|
461
|
+
component.props = props;
|
462
|
+
|
463
|
+
component._disable = false;
|
464
|
+
|
465
|
+
if (renderMode !== 0) {
|
466
|
+
if (renderMode === 1 || options.syncComponentUpdates !== false || !component.base) {
|
467
|
+
renderComponent(component, 1, mountAll);
|
468
|
+
} else {
|
469
|
+
enqueueRender(component);
|
470
|
+
}
|
471
|
+
}
|
472
|
+
|
473
|
+
if (component.__ref) component.__ref(component);
|
474
|
+
}
|
475
|
+
|
476
|
+
function renderComponent(component, renderMode, mountAll, isChild) {
|
477
|
+
if (component._disable) return;
|
478
|
+
|
479
|
+
var props = component.props,
|
480
|
+
state = component.state,
|
481
|
+
context = component.context,
|
482
|
+
previousProps = component.prevProps || props,
|
483
|
+
previousState = component.prevState || state,
|
484
|
+
previousContext = component.prevContext || context,
|
485
|
+
isUpdate = component.base,
|
486
|
+
nextBase = component.nextBase,
|
487
|
+
initialBase = isUpdate || nextBase,
|
488
|
+
initialChildComponent = component._component,
|
489
|
+
skip = false,
|
490
|
+
snapshot = previousContext,
|
491
|
+
rendered,
|
492
|
+
inst,
|
493
|
+
cbase;
|
494
|
+
|
495
|
+
if (component.constructor.getDerivedStateFromProps) {
|
496
|
+
state = extend(extend({}, state), component.constructor.getDerivedStateFromProps(props, state));
|
497
|
+
component.state = state;
|
498
|
+
}
|
499
|
+
|
500
|
+
if (isUpdate) {
|
501
|
+
component.props = previousProps;
|
502
|
+
component.state = previousState;
|
503
|
+
component.context = previousContext;
|
504
|
+
if (renderMode !== 2 && component.shouldComponentUpdate && component.shouldComponentUpdate(props, state, context) === false) {
|
505
|
+
skip = true;
|
506
|
+
} else if (component.componentWillUpdate) {
|
507
|
+
component.componentWillUpdate(props, state, context);
|
508
|
+
}
|
509
|
+
component.props = props;
|
510
|
+
component.state = state;
|
511
|
+
component.context = context;
|
512
|
+
}
|
513
|
+
|
514
|
+
component.prevProps = component.prevState = component.prevContext = component.nextBase = null;
|
515
|
+
component._dirty = false;
|
516
|
+
|
517
|
+
if (!skip) {
|
518
|
+
rendered = component.render(props, state, context);
|
519
|
+
|
520
|
+
if (component.getChildContext) {
|
521
|
+
context = extend(extend({}, context), component.getChildContext());
|
522
|
+
}
|
523
|
+
|
524
|
+
if (isUpdate && component.getSnapshotBeforeUpdate) {
|
525
|
+
snapshot = component.getSnapshotBeforeUpdate(previousProps, previousState);
|
526
|
+
}
|
527
|
+
|
528
|
+
var childComponent = rendered && rendered.nodeName,
|
529
|
+
toUnmount,
|
530
|
+
base;
|
531
|
+
|
532
|
+
if (typeof childComponent === 'function') {
|
533
|
+
|
534
|
+
var childProps = getNodeProps(rendered);
|
535
|
+
inst = initialChildComponent;
|
536
|
+
|
537
|
+
if (inst && inst.constructor === childComponent && childProps.key == inst.__key) {
|
538
|
+
setComponentProps(inst, childProps, 1, context, false);
|
539
|
+
} else {
|
540
|
+
toUnmount = inst;
|
541
|
+
|
542
|
+
component._component = inst = createComponent(childComponent, childProps, context);
|
543
|
+
inst.nextBase = inst.nextBase || nextBase;
|
544
|
+
inst._parentComponent = component;
|
545
|
+
setComponentProps(inst, childProps, 0, context, false);
|
546
|
+
renderComponent(inst, 1, mountAll, true);
|
547
|
+
}
|
548
|
+
|
549
|
+
base = inst.base;
|
550
|
+
} else {
|
551
|
+
cbase = initialBase;
|
552
|
+
|
553
|
+
toUnmount = initialChildComponent;
|
554
|
+
if (toUnmount) {
|
555
|
+
cbase = component._component = null;
|
556
|
+
}
|
557
|
+
|
558
|
+
if (initialBase || renderMode === 1) {
|
559
|
+
if (cbase) cbase._component = null;
|
560
|
+
base = diff(cbase, rendered, context, mountAll || !isUpdate, initialBase && initialBase.parentNode, true);
|
561
|
+
}
|
562
|
+
}
|
563
|
+
|
564
|
+
if (initialBase && base !== initialBase && inst !== initialChildComponent) {
|
565
|
+
var baseParent = initialBase.parentNode;
|
566
|
+
if (baseParent && base !== baseParent) {
|
567
|
+
baseParent.replaceChild(base, initialBase);
|
568
|
+
|
569
|
+
if (!toUnmount) {
|
570
|
+
initialBase._component = null;
|
571
|
+
recollectNodeTree(initialBase, false);
|
572
|
+
}
|
573
|
+
}
|
574
|
+
}
|
575
|
+
|
576
|
+
if (toUnmount) {
|
577
|
+
unmountComponent(toUnmount);
|
578
|
+
}
|
579
|
+
|
580
|
+
component.base = base;
|
581
|
+
if (base && !isChild) {
|
582
|
+
var componentRef = component,
|
583
|
+
t = component;
|
584
|
+
while (t = t._parentComponent) {
|
585
|
+
(componentRef = t).base = base;
|
586
|
+
}
|
587
|
+
base._component = componentRef;
|
588
|
+
base._componentConstructor = componentRef.constructor;
|
589
|
+
}
|
590
|
+
}
|
591
|
+
|
592
|
+
if (!isUpdate || mountAll) {
|
593
|
+
mounts.unshift(component);
|
594
|
+
} else if (!skip) {
|
595
|
+
|
596
|
+
if (component.componentDidUpdate) {
|
597
|
+
component.componentDidUpdate(previousProps, previousState, snapshot);
|
598
|
+
}
|
599
|
+
if (options.afterUpdate) options.afterUpdate(component);
|
600
|
+
}
|
601
|
+
|
602
|
+
while (component._renderCallbacks.length) {
|
603
|
+
component._renderCallbacks.pop().call(component);
|
604
|
+
}if (!diffLevel && !isChild) flushMounts();
|
605
|
+
}
|
606
|
+
|
607
|
+
function buildComponentFromVNode(dom, vnode, context, mountAll) {
|
608
|
+
var c = dom && dom._component,
|
609
|
+
originalComponent = c,
|
610
|
+
oldDom = dom,
|
611
|
+
isDirectOwner = c && dom._componentConstructor === vnode.nodeName,
|
612
|
+
isOwner = isDirectOwner,
|
613
|
+
props = getNodeProps(vnode);
|
614
|
+
while (c && !isOwner && (c = c._parentComponent)) {
|
615
|
+
isOwner = c.constructor === vnode.nodeName;
|
616
|
+
}
|
617
|
+
|
618
|
+
if (c && isOwner && (!mountAll || c._component)) {
|
619
|
+
setComponentProps(c, props, 3, context, mountAll);
|
620
|
+
dom = c.base;
|
621
|
+
} else {
|
622
|
+
if (originalComponent && !isDirectOwner) {
|
623
|
+
unmountComponent(originalComponent);
|
624
|
+
dom = oldDom = null;
|
625
|
+
}
|
626
|
+
|
627
|
+
c = createComponent(vnode.nodeName, props, context);
|
628
|
+
if (dom && !c.nextBase) {
|
629
|
+
c.nextBase = dom;
|
630
|
+
|
631
|
+
oldDom = null;
|
632
|
+
}
|
633
|
+
setComponentProps(c, props, 1, context, mountAll);
|
634
|
+
dom = c.base;
|
635
|
+
|
636
|
+
if (oldDom && dom !== oldDom) {
|
637
|
+
oldDom._component = null;
|
638
|
+
recollectNodeTree(oldDom, false);
|
639
|
+
}
|
640
|
+
}
|
641
|
+
|
642
|
+
return dom;
|
643
|
+
}
|
644
|
+
|
645
|
+
function unmountComponent(component) {
|
646
|
+
if (options.beforeUnmount) options.beforeUnmount(component);
|
647
|
+
|
648
|
+
var base = component.base;
|
649
|
+
|
650
|
+
component._disable = true;
|
651
|
+
|
652
|
+
if (component.componentWillUnmount) component.componentWillUnmount();
|
653
|
+
|
654
|
+
component.base = null;
|
655
|
+
|
656
|
+
var inner = component._component;
|
657
|
+
if (inner) {
|
658
|
+
unmountComponent(inner);
|
659
|
+
} else if (base) {
|
660
|
+
if (base['__preactattr_'] && base['__preactattr_'].ref) base['__preactattr_'].ref(null);
|
661
|
+
|
662
|
+
component.nextBase = base;
|
663
|
+
|
664
|
+
removeNode(base);
|
665
|
+
recyclerComponents.push(component);
|
666
|
+
|
667
|
+
removeChildren(base);
|
668
|
+
}
|
669
|
+
|
670
|
+
if (component.__ref) component.__ref(null);
|
671
|
+
}
|
672
|
+
|
673
|
+
function Component(props, context) {
|
674
|
+
this._dirty = true;
|
675
|
+
|
676
|
+
this.context = context;
|
677
|
+
|
678
|
+
this.props = props;
|
679
|
+
|
680
|
+
this.state = this.state || {};
|
681
|
+
|
682
|
+
this._renderCallbacks = [];
|
683
|
+
}
|
684
|
+
|
685
|
+
extend(Component.prototype, {
|
686
|
+
setState: function setState(state, callback) {
|
687
|
+
if (!this.prevState) this.prevState = this.state;
|
688
|
+
this.state = extend(extend({}, this.state), typeof state === 'function' ? state(this.state, this.props) : state);
|
689
|
+
if (callback) this._renderCallbacks.push(callback);
|
690
|
+
enqueueRender(this);
|
691
|
+
},
|
692
|
+
forceUpdate: function forceUpdate(callback) {
|
693
|
+
if (callback) this._renderCallbacks.push(callback);
|
694
|
+
renderComponent(this, 2);
|
695
|
+
},
|
696
|
+
render: function render() {}
|
697
|
+
});
|
698
|
+
|
699
|
+
function render(vnode, parent, merge) {
|
700
|
+
return diff(merge, vnode, {}, false, parent, false);
|
701
|
+
}
|
702
|
+
|
703
|
+
var preact = {
|
704
|
+
h: h,
|
705
|
+
createElement: h,
|
706
|
+
cloneElement: cloneElement,
|
707
|
+
Component: Component,
|
708
|
+
render: render,
|
709
|
+
rerender: rerender,
|
710
|
+
options: options
|
711
|
+
};
|
712
|
+
|
713
|
+
export default preact;
|
714
|
+
export { h, h as createElement, cloneElement, Component, render, rerender, options };
|
715
|
+
//# sourceMappingURL=preact.mjs.map
|