From 1066f9b9960748949ef76eef53c57a11ec270a95 Mon Sep 17 00:00:00 2001 From: Paul Shannon Date: Sun, 6 Aug 2017 22:32:29 -0700 Subject: [PATCH 1/5] Add a beforeAttach event that allows a listener to delay or prevent DOM attachment --- package.json | 2 +- src/maquette.ts | 37 +++++++++++++++++++++++++++---------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index bb65326..8b1666e 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "animation", "transitions" ], - "version": "2.5.3", + "version": "2.5.4-pre.1", "author": "Johan Gorter ", "repository": { "type": "git", diff --git a/src/maquette.ts b/src/maquette.ts index d188678..9a37441 100644 --- a/src/maquette.ts +++ b/src/maquette.ts @@ -240,6 +240,14 @@ export interface VNodeProperties { */ afterUpdate?(element: Element, projectionOptions: ProjectionOptions, vnodeSelector: string, properties: VNodeProperties, children: VNode[]): void; + /** + * Callback that is executed after this node has been created, but before it is added to the DOM. Child nodes and + * properties have not yet been applied. + * @param element - The element that was added to the DOM. + * @param parentNode - The parent the element will be added to this node + * @param beforeNode - The node that the element will be inserted before + */ + beforeAttach?(element: Element, parentNode: Node, beforeNode?: Node): boolean; /** * When specified, the event handlers will be invoked with 'this' pointing to the value. * This is useful when using the prototype/class based implementation of Components. @@ -749,17 +757,30 @@ let initPropertiesAndChildren = function(domNode: Node, vnode: VNode, projection } }; +let insertNode = function (parentNode: Node, domNode: Node, vnode: VNode, beforeNode?: Node | null) { + let attach = true; + if (vnode.properties && vnode.properties.beforeAttach) { + attach = vnode.properties.beforeAttach.apply(vnode.properties.bind || vnode.properties, [ + parentNode, + domNode as Element + ]); + } + if (attach !== false) { + if (beforeNode) { + parentNode.insertBefore(domNode, beforeNode); + } else if (domNode.parentNode !== parentNode) { + parentNode.appendChild(domNode); + } + } +}; + createDom = function(vnode, parentNode, insertBefore, projectionOptions) { let domNode: Node | undefined, i: number, c: string, start = 0, type: string, found: string; let vnodeSelector = vnode.vnodeSelector; let doc = parentNode.ownerDocument; if (vnodeSelector === '') { domNode = vnode.domNode = doc.createTextNode(vnode.text!); - if (insertBefore !== undefined) { - parentNode.insertBefore(domNode, insertBefore); - } else { - parentNode.appendChild(domNode); - } + insertNode(parentNode, domNode, vnode, insertBefore); } else { for (i = 0; i <= vnodeSelector.length; ++i) { c = vnodeSelector.charAt(i); @@ -783,11 +804,7 @@ createDom = function(vnode, parentNode, insertBefore, projectionOptions) { (domNode as Element).setAttribute("type", vnode.properties.type); } } - if (insertBefore !== undefined) { - parentNode.insertBefore(domNode, insertBefore); - } else if (domNode.parentNode !== parentNode) { - parentNode.appendChild(domNode); - } + insertNode(parentNode, domNode, vnode, insertBefore); } start = i + 1; } From fd16bde92e5727664878a769c09a945949fabba9 Mon Sep 17 00:00:00 2001 From: Paul Shannon Date: Fri, 18 Aug 2017 21:59:41 -0700 Subject: [PATCH 2/5] Add a delayAttach property that will delay attaching a node to the dom until attributes have been attached --- dist/maquette.d.ts | 9 +++++++++ dist/maquette.js | 29 +++++++++++++++++++++-------- dist/maquette.js.map | 2 +- dist/maquette.min.js | 2 +- dist/maquette.min.js.map | 2 +- src/maquette.ts | 30 +++++++++++++++++++----------- 6 files changed, 52 insertions(+), 22 deletions(-) diff --git a/dist/maquette.d.ts b/dist/maquette.d.ts index be6886c..b1079f9 100644 --- a/dist/maquette.d.ts +++ b/dist/maquette.d.ts @@ -231,6 +231,14 @@ export interface VNodeProperties { * @param children - The children for this node. */ afterUpdate?(element: Element, projectionOptions: ProjectionOptions, vnodeSelector: string, properties: VNodeProperties, children: VNode[]): void; + /** + * Callback that is executed after this node has been created, but before it is added to the DOM. Child nodes and + * properties have not yet been applied. + * @param element - The element that was added to the DOM. + * @param parentNode - The parent the element will be added to this node + * @param beforeNode - The node that the element will be inserted before + */ + beforeAttach?(element: Element, parentNode: Node, beforeNode?: Node): boolean; /** * When specified, the event handlers will be invoked with 'this' pointing to the value. * This is useful when using the prototype/class based implementation of Components. @@ -310,6 +318,7 @@ export interface VNodeProperties { * Note: if you use innerHTML, maquette cannot protect you from XSS vulnerabilities and you must make sure that the innerHTML value is safe. */ readonly innerHTML?: string; + readonly delayAttach?: boolean; /** * Everything that is not explicitly listed (properties and attributes that are either uncommon or custom). */ diff --git a/dist/maquette.js b/dist/maquette.js index 865e3b8..3af22d9 100644 --- a/dist/maquette.js +++ b/dist/maquette.js @@ -407,16 +407,28 @@ ]); } }; + var insertNode = function (parentNode, domNode, vnode, beforeNode) { + if (vnode.properties && vnode.properties.beforeAttach) { + vnode.properties.beforeAttach.apply(vnode.properties.bind || vnode.properties, [ + parentNode, + domNode + ]); + } + if (beforeNode) { + parentNode.insertBefore(domNode, beforeNode); + } else if (domNode.parentNode !== parentNode) { + parentNode.appendChild(domNode); + } + }; createDom = function (vnode, parentNode, insertBefore, projectionOptions) { + var delayAttach = !!(vnode.properties && vnode.properties.delayAttach); var domNode, i, c, start = 0, type, found; var vnodeSelector = vnode.vnodeSelector; var doc = parentNode.ownerDocument; if (vnodeSelector === '') { domNode = vnode.domNode = doc.createTextNode(vnode.text); - if (insertBefore !== undefined) { - parentNode.insertBefore(domNode, insertBefore); - } else { - parentNode.appendChild(domNode); + if (!delayAttach) { + insertNode(parentNode, domNode, vnode, insertBefore); } } else { for (i = 0; i <= vnodeSelector.length; ++i) { @@ -441,16 +453,17 @@ domNode.setAttribute('type', vnode.properties.type); } } - if (insertBefore !== undefined) { - parentNode.insertBefore(domNode, insertBefore); - } else if (domNode.parentNode !== parentNode) { - parentNode.appendChild(domNode); + if (!delayAttach) { + insertNode(parentNode, domNode, vnode, insertBefore); } } start = i + 1; } } initPropertiesAndChildren(domNode, vnode, projectionOptions); + if (delayAttach) { + insertNode(parentNode, domNode, vnode, insertBefore); + } } }; updateDom = function (previous, vnode, projectionOptions) { diff --git a/dist/maquette.js.map b/dist/maquette.js.map index 089b638..c635431 100644 --- a/dist/maquette.js.map +++ b/dist/maquette.js.map @@ -1 +1 @@ -{"version":3,"sources":["maquette.js","../../../../src/maquette.ts"],"names":["Object","defineProperty","exports","value","NAMESPACE_W3","NAMESPACE_SVG","NAMESPACE_XLINK","emptyArray","extend","base","overrides","result","keys","forEach","key","same","vnode1","vnode2","vnodeSelector","properties","bind","toTextVNode","data","undefined","children","text","toString","domNode","appendChildren","parentSelector","insertions","main","i","length_1","length","item","Array","isArray","hasOwnProperty","push","missingTransition","Error","DEFAULT_PROJECTION_OPTIONS","namespace","eventHandlerInterceptor","styleApplyer","styleName","style","transitions","enter","exit","applyDefaultProjectionOptions","projectorOptions","checkStyleValue","styleValue","setProperties","projectionOptions","propNames","propCount","_loop_1","propName","propValue","split","token","classList","add","classNames","classNameCount","j","className","styleNames","styleCount","type","lastIndexOf","oldPropValue","evt","apply","target","setAttributeNS","setAttribute","updateProperties","previousProperties","propertiesUpdated","previousValue","on","previousOn","remove","newStyleValue","oldStyleValue","domValue","removeAttribute","findIndexOfChild","sameAs","start","nodeAdded","vNode","enterAnimation","nodeToRemove","exitAnimation","pointerEvents","removeDomNode","parentNode","removeChild","checkDistinguishable","childNodes","indexToCheck","parentVNode","operation","childNode","node","createDom","updateDom","updateChildren","vnode","oldChildren","newChildren","oldChildrenLength","newChildrenLength","oldIndex","newIndex","textUpdated","oldChild","newChild","findOldIndex","addChildren","initPropertiesAndChildren","textContent","afterCreate","insertBefore","c","found","doc","ownerDocument","createTextNode","appendChild","charAt","slice","id","createElementNS","createElement","previous","updated","newVNode","replaceChild","firstChild","afterUpdate","updateAnimation","createProjection","update","updatedVnode","h","selector","arguments","childIndex","argsLength","onlyChild","child","dom","create","document","append","beforeNode","merge","element","replace","createCache","cachedInputs","cachedOutcome","invalidate","inputs","calculation","createMapping","getSourceKey","createResult","updateResult","results","map","newSources","newKeys","oldTargets","source","sourceKey","searchIndex","createProjector","projector","propertyName","eventHandler","scheduleRender","renderCompleted","scheduled","stopped","projections","renderFunctions","doRender","renderNow","requestAnimationFrame","stop","cancelAnimationFrame","resume","renderMaquetteFunction","detach","splice"],"mappings":";;;;;;;;;;;;IAAA,a;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CF,CAAA,EAA5C,EAAiD;AAAA,oBAC/C,IAAIgK,eAAA,CAAgBhK,CAAhB,MAAuBuK,sBAA3B,EAAmD;AAAA,wBACjDP,eAAA,CAAgBS,MAAhB,CAAuBzK,CAAvB,EAA0B,CAA1B,EADiD;AAAA,wBAEjD,OAAO+J,WAAA,CAAYU,MAAZ,CAAmBzK,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CAAP,CAFiD;AAAA,qBADJ;AAAA,iBADZ;AAAA,gBAOrC,MAAM,IAAIS,KAAJ,CAAU,sCAAV,CAAN,CAPqC;AAAA,aAzC7B;AAAA,SAAZ,CA7BuE;AAAA,QAiFvE,OAAO+I,SAAP,CAjFuE;AAAA,KAA9D,C","file":"maquette.js","sourcesContent":["\"use strict\";\n// Comment that is displayed in the API documentation for the maquette module:\n/**\n * Welcome to the API documentation of the **maquette** library.\n *\n * [[http://maquettejs.org/|To the maquette homepage]]\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar NAMESPACE_W3 = 'http://www.w3.org/';\nvar NAMESPACE_SVG = NAMESPACE_W3 + '2000/svg';\nvar NAMESPACE_XLINK = NAMESPACE_W3 + '1999/xlink';\n// Utilities\nvar emptyArray = [];\nvar extend = function (base, overrides) {\n var result = {};\n Object.keys(base).forEach(function (key) {\n result[key] = base[key];\n });\n if (overrides) {\n Object.keys(overrides).forEach(function (key) {\n result[key] = overrides[key];\n });\n }\n return result;\n};\n// Hyperscript helper functions\nvar same = function (vnode1, vnode2) {\n if (vnode1.vnodeSelector !== vnode2.vnodeSelector) {\n return false;\n }\n if (vnode1.properties && vnode2.properties) {\n if (vnode1.properties.key !== vnode2.properties.key) {\n return false;\n }\n return vnode1.properties.bind === vnode2.properties.bind;\n }\n return !vnode1.properties && !vnode2.properties;\n};\nvar toTextVNode = function (data) {\n return {\n vnodeSelector: '',\n properties: undefined,\n children: undefined,\n text: data.toString(),\n domNode: null\n };\n};\nvar appendChildren = function (parentSelector, insertions, main) {\n for (var i = 0, length_1 = insertions.length; i < length_1; i++) {\n var item = insertions[i];\n if (Array.isArray(item)) {\n appendChildren(parentSelector, item, main);\n }\n else {\n if (item !== null && item !== undefined) {\n if (!item.hasOwnProperty('vnodeSelector')) {\n item = toTextVNode(item);\n }\n main.push(item);\n }\n }\n }\n};\n// Render helper functions\nvar missingTransition = function () {\n throw new Error('Provide a transitions object to the projectionOptions to do animations');\n};\nvar DEFAULT_PROJECTION_OPTIONS = {\n namespace: undefined,\n eventHandlerInterceptor: undefined,\n styleApplyer: function (domNode, styleName, value) {\n // Provides a hook to add vendor prefixes for browsers that still need it.\n domNode.style[styleName] = value;\n },\n transitions: {\n enter: missingTransition,\n exit: missingTransition\n }\n};\nvar applyDefaultProjectionOptions = function (projectorOptions) {\n return extend(DEFAULT_PROJECTION_OPTIONS, projectorOptions);\n};\nvar checkStyleValue = function (styleValue) {\n if (typeof styleValue !== 'string') {\n throw new Error('Style values must be strings');\n }\n};\nvar setProperties = function (domNode, properties, projectionOptions) {\n if (!properties) {\n return;\n }\n var eventHandlerInterceptor = projectionOptions.eventHandlerInterceptor;\n var propNames = Object.keys(properties);\n var propCount = propNames.length;\n var _loop_1 = function (i) {\n var propName = propNames[i];\n /* tslint:disable:no-var-keyword: edge case */\n var propValue = properties[propName];\n /* tslint:enable:no-var-keyword */\n if (propName === 'className') {\n throw new Error('Property \"className\" is not supported, use \"class\".');\n }\n else if (propName === 'class') {\n propValue.split(/\\s+/).forEach(function (token) { return domNode.classList.add(token); });\n }\n else if (propName === 'classes') {\n // object with string keys and boolean values\n var classNames = Object.keys(propValue);\n var classNameCount = classNames.length;\n for (var j = 0; j < classNameCount; j++) {\n var className = classNames[j];\n if (propValue[className]) {\n domNode.classList.add(className);\n }\n }\n }\n else if (propName === 'styles') {\n // object with string keys and string (!) values\n var styleNames = Object.keys(propValue);\n var styleCount = styleNames.length;\n for (var j = 0; j < styleCount; j++) {\n var styleName = styleNames[j];\n var styleValue = propValue[styleName];\n if (styleValue) {\n checkStyleValue(styleValue);\n projectionOptions.styleApplyer(domNode, styleName, styleValue);\n }\n }\n }\n else if (propName !== 'key' && propValue !== null && propValue !== undefined) {\n var type = typeof propValue;\n if (type === 'function') {\n if (propName.lastIndexOf('on', 0) === 0) {\n if (eventHandlerInterceptor) {\n propValue = eventHandlerInterceptor(propName, propValue, domNode, properties); // intercept eventhandlers\n }\n if (propName === 'oninput') {\n (function () {\n // record the evt.target.value, because IE and Edge sometimes do a requestAnimationFrame between changing value and running oninput\n var oldPropValue = propValue;\n propValue = function (evt) {\n oldPropValue.apply(this, [evt]);\n evt.target['oninput-value'] = evt.target.value; // may be HTMLTextAreaElement as well\n };\n }());\n }\n domNode[propName] = propValue;\n }\n }\n else if (type === 'string' && propName !== 'value' && propName !== 'innerHTML') {\n if (projectionOptions.namespace === NAMESPACE_SVG && propName === 'href') {\n domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);\n }\n else {\n domNode.setAttribute(propName, propValue);\n }\n }\n else {\n domNode[propName] = propValue;\n }\n }\n };\n for (var i = 0; i < propCount; i++) {\n _loop_1(i);\n }\n};\nvar updateProperties = function (domNode, previousProperties, properties, projectionOptions) {\n if (!properties) {\n return;\n }\n var propertiesUpdated = false;\n var propNames = Object.keys(properties);\n var propCount = propNames.length;\n for (var i = 0; i < propCount; i++) {\n var propName = propNames[i];\n // assuming that properties will be nullified instead of missing is by design\n var propValue = properties[propName];\n var previousValue = previousProperties[propName];\n if (propName === 'class') {\n if (previousValue !== propValue) {\n throw new Error('\"class\" property may not be updated. Use the \"classes\" property for conditional css classes.');\n }\n }\n else if (propName === 'classes') {\n var classList = domNode.classList;\n var classNames = Object.keys(propValue);\n var classNameCount = classNames.length;\n for (var j = 0; j < classNameCount; j++) {\n var className = classNames[j];\n var on = !!propValue[className];\n var previousOn = !!previousValue[className];\n if (on === previousOn) {\n continue;\n }\n propertiesUpdated = true;\n if (on) {\n classList.add(className);\n }\n else {\n classList.remove(className);\n }\n }\n }\n else if (propName === 'styles') {\n var styleNames = Object.keys(propValue);\n var styleCount = styleNames.length;\n for (var j = 0; j < styleCount; j++) {\n var styleName = styleNames[j];\n var newStyleValue = propValue[styleName];\n var oldStyleValue = previousValue[styleName];\n if (newStyleValue === oldStyleValue) {\n continue;\n }\n propertiesUpdated = true;\n if (newStyleValue) {\n checkStyleValue(newStyleValue);\n projectionOptions.styleApplyer(domNode, styleName, newStyleValue);\n }\n else {\n projectionOptions.styleApplyer(domNode, styleName, '');\n }\n }\n }\n else {\n if (!propValue && typeof previousValue === 'string') {\n propValue = '';\n }\n if (propName === 'value') {\n var domValue = domNode[propName];\n if (domValue !== propValue // The 'value' in the DOM tree !== newValue\n && (domNode['oninput-value']\n ? domValue === domNode['oninput-value'] // If the last reported value to 'oninput' does not match domValue, do nothing and wait for oninput\n : propValue !== previousValue // Only update the value if the vdom changed\n )) {\n domNode[propName] = propValue; // Reset the value, even if the virtual DOM did not change\n domNode['oninput-value'] = undefined;\n } // else do not update the domNode, otherwise the cursor position would be changed\n if (propValue !== previousValue) {\n propertiesUpdated = true;\n }\n }\n else if (propValue !== previousValue) {\n var type = typeof propValue;\n if (type === 'function') {\n throw new Error('Functions may not be updated on subsequent renders (property: ' + propName +\n '). Hint: declare event handler functions outside the render() function.');\n }\n if (type === 'string' && propName !== 'innerHTML') {\n if (projectionOptions.namespace === NAMESPACE_SVG && propName === 'href') {\n domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);\n }\n else if (propName === 'role' && propValue === '') {\n domNode.removeAttribute(propName);\n }\n else {\n domNode.setAttribute(propName, propValue);\n }\n }\n else {\n if (domNode[propName] !== propValue) {\n domNode[propName] = propValue;\n }\n }\n propertiesUpdated = true;\n }\n }\n }\n return propertiesUpdated;\n};\nvar findIndexOfChild = function (children, sameAs, start) {\n if (sameAs.vnodeSelector !== '') {\n // Never scan for text-nodes\n for (var i = start; i < children.length; i++) {\n if (same(children[i], sameAs)) {\n return i;\n }\n }\n }\n return -1;\n};\nvar nodeAdded = function (vNode, transitions) {\n if (vNode.properties) {\n var enterAnimation = vNode.properties.enterAnimation;\n if (enterAnimation) {\n if (typeof enterAnimation === 'function') {\n enterAnimation(vNode.domNode, vNode.properties);\n }\n else {\n transitions.enter(vNode.domNode, vNode.properties, enterAnimation);\n }\n }\n }\n};\nvar nodeToRemove = function (vNode, transitions) {\n var domNode = vNode.domNode;\n if (vNode.properties) {\n var exitAnimation = vNode.properties.exitAnimation;\n if (exitAnimation) {\n domNode.style.pointerEvents = 'none';\n var removeDomNode = function () {\n if (domNode.parentNode) {\n domNode.parentNode.removeChild(domNode);\n }\n };\n if (typeof exitAnimation === 'function') {\n exitAnimation(domNode, removeDomNode, vNode.properties);\n return;\n }\n else {\n transitions.exit(vNode.domNode, vNode.properties, exitAnimation, removeDomNode);\n return;\n }\n }\n }\n if (domNode.parentNode) {\n domNode.parentNode.removeChild(domNode);\n }\n};\nvar checkDistinguishable = function (childNodes, indexToCheck, parentVNode, operation) {\n var childNode = childNodes[indexToCheck];\n if (childNode.vnodeSelector === '') {\n return; // Text nodes need not be distinguishable\n }\n var properties = childNode.properties;\n var key = properties ? (properties.key === undefined ? properties.bind : properties.key) : undefined;\n if (!key) {\n for (var i = 0; i < childNodes.length; i++) {\n if (i !== indexToCheck) {\n var node = childNodes[i];\n if (same(node, childNode)) {\n if (operation === 'added') {\n throw new Error(parentVNode.vnodeSelector + ' had a ' + childNode.vnodeSelector + ' child ' +\n 'added, but there is now more than one. You must add unique key properties to make them distinguishable.');\n }\n else {\n throw new Error(parentVNode.vnodeSelector + ' had a ' + childNode.vnodeSelector + ' child ' +\n 'removed, but there were more than one. You must add unique key properties to make them distinguishable.');\n }\n }\n }\n }\n }\n};\nvar createDom;\nvar updateDom;\nvar updateChildren = function (vnode, domNode, oldChildren, newChildren, projectionOptions) {\n if (oldChildren === newChildren) {\n return false;\n }\n oldChildren = oldChildren || emptyArray;\n newChildren = newChildren || emptyArray;\n var oldChildrenLength = oldChildren.length;\n var newChildrenLength = newChildren.length;\n var transitions = projectionOptions.transitions;\n var oldIndex = 0;\n var newIndex = 0;\n var i;\n var textUpdated = false;\n while (newIndex < newChildrenLength) {\n var oldChild = (oldIndex < oldChildrenLength) ? oldChildren[oldIndex] : undefined;\n var newChild = newChildren[newIndex];\n if (oldChild !== undefined && same(oldChild, newChild)) {\n textUpdated = updateDom(oldChild, newChild, projectionOptions) || textUpdated;\n oldIndex++;\n }\n else {\n var findOldIndex = findIndexOfChild(oldChildren, newChild, oldIndex + 1);\n if (findOldIndex >= 0) {\n // Remove preceding missing children\n for (i = oldIndex; i < findOldIndex; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n textUpdated = updateDom(oldChildren[findOldIndex], newChild, projectionOptions) || textUpdated;\n oldIndex = findOldIndex + 1;\n }\n else {\n // New child\n createDom(newChild, domNode, (oldIndex < oldChildrenLength) ? oldChildren[oldIndex].domNode : undefined, projectionOptions);\n nodeAdded(newChild, transitions);\n checkDistinguishable(newChildren, newIndex, vnode, 'added');\n }\n }\n newIndex++;\n }\n if (oldChildrenLength > oldIndex) {\n // Remove child fragments\n for (i = oldIndex; i < oldChildrenLength; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n }\n return textUpdated;\n};\nvar addChildren = function (domNode, children, projectionOptions) {\n if (!children) {\n return;\n }\n for (var i = 0; i < children.length; i++) {\n createDom(children[i], domNode, undefined, projectionOptions);\n }\n};\nvar initPropertiesAndChildren = function (domNode, vnode, projectionOptions) {\n addChildren(domNode, vnode.children, projectionOptions); // children before properties, needed for value property of .\n if (vnode.text) {\n domNode.textContent = vnode.text;\n }\n setProperties(domNode, vnode.properties, projectionOptions);\n if (vnode.properties && vnode.properties.afterCreate) {\n vnode.properties.afterCreate.apply(vnode.properties.bind || vnode.properties, [domNode, projectionOptions, vnode.vnodeSelector, vnode.properties, vnode.children]);\n }\n};\nvar insertNode = function (parentNode, domNode, vnode, beforeNode) {\n if (vnode.properties && vnode.properties.beforeAttach) {\n vnode.properties.beforeAttach.apply(vnode.properties.bind || vnode.properties, [\n parentNode,\n domNode\n ]);\n }\n if (beforeNode) {\n parentNode.insertBefore(domNode, beforeNode);\n }\n else if (domNode.parentNode !== parentNode) {\n parentNode.appendChild(domNode);\n }\n};\ncreateDom = function (vnode, parentNode, insertBefore, projectionOptions) {\n var delayAttach = !!(vnode.properties && vnode.properties.delayAttach);\n var domNode, i, c, start = 0, type, found;\n var vnodeSelector = vnode.vnodeSelector;\n var doc = parentNode.ownerDocument;\n if (vnodeSelector === '') {\n domNode = vnode.domNode = doc.createTextNode(vnode.text);\n if (!delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n else {\n for (i = 0; i <= vnodeSelector.length; ++i) {\n c = vnodeSelector.charAt(i);\n if (i === vnodeSelector.length || c === '.' || c === '#') {\n type = vnodeSelector.charAt(start - 1);\n found = vnodeSelector.slice(start, i);\n if (type === '.') {\n domNode.classList.add(found);\n }\n else if (type === '#') {\n domNode.id = found;\n }\n else {\n if (found === 'svg') {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (projectionOptions.namespace !== undefined) {\n domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found);\n }\n else {\n domNode = vnode.domNode = (vnode.domNode || doc.createElement(found));\n if (found === 'input' && vnode.properties && vnode.properties.type !== undefined) {\n // IE8 and older don't support setting input type after the DOM Node has been added to the document\n domNode.setAttribute(\"type\", vnode.properties.type);\n }\n }\n if (!delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n start = i + 1;\n }\n }\n initPropertiesAndChildren(domNode, vnode, projectionOptions);\n if (delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n};\nupdateDom = function (previous, vnode, projectionOptions) {\n var domNode = previous.domNode;\n var textUpdated = false;\n if (previous === vnode) {\n return false; // By contract, VNode objects may not be modified anymore after passing them to maquette\n }\n var updated = false;\n if (vnode.vnodeSelector === '') {\n if (vnode.text !== previous.text) {\n var newVNode = domNode.ownerDocument.createTextNode(vnode.text);\n domNode.parentNode.replaceChild(newVNode, domNode);\n vnode.domNode = newVNode;\n textUpdated = true;\n return textUpdated;\n }\n }\n else {\n if (vnode.vnodeSelector.lastIndexOf('svg', 0) === 0) {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (previous.text !== vnode.text) {\n updated = true;\n if (vnode.text === undefined) {\n domNode.removeChild(domNode.firstChild); // the only textnode presumably\n }\n else {\n domNode.textContent = vnode.text;\n }\n }\n updated = updateChildren(vnode, domNode, previous.children, vnode.children, projectionOptions) || updated;\n updated = updateProperties(domNode, previous.properties, vnode.properties, projectionOptions) || updated;\n if (vnode.properties && vnode.properties.afterUpdate) {\n vnode.properties.afterUpdate.apply(vnode.properties.bind || vnode.properties, [domNode, projectionOptions, vnode.vnodeSelector, vnode.properties, vnode.children]);\n }\n }\n if (updated && vnode.properties && vnode.properties.updateAnimation) {\n vnode.properties.updateAnimation(domNode, vnode.properties, previous.properties);\n }\n vnode.domNode = previous.domNode;\n return textUpdated;\n};\nvar createProjection = function (vnode, projectionOptions) {\n return {\n update: function (updatedVnode) {\n if (vnode.vnodeSelector !== updatedVnode.vnodeSelector) {\n throw new Error('The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)');\n }\n updateDom(vnode, updatedVnode, projectionOptions);\n vnode = updatedVnode;\n },\n domNode: vnode.domNode\n };\n};\n// The other two parameters are not added here, because the Typescript compiler creates surrogate code for destructuring 'children'.\nexports.h = function (selector) {\n var properties = arguments[1];\n if (typeof selector !== 'string') {\n throw new Error();\n }\n var childIndex = 1;\n if (properties && !properties.hasOwnProperty('vnodeSelector') && !Array.isArray(properties) && typeof properties === 'object') {\n childIndex = 2;\n }\n else {\n // Optional properties argument was omitted\n properties = undefined;\n }\n var text;\n var children;\n var argsLength = arguments.length;\n // Recognize a common special case where there is only a single text node\n if (argsLength === childIndex + 1) {\n var onlyChild = arguments[childIndex];\n if (typeof onlyChild === 'string') {\n text = onlyChild;\n }\n else if (onlyChild !== undefined && onlyChild !== null && onlyChild.length === 1 && typeof onlyChild[0] === 'string') {\n text = onlyChild[0];\n }\n }\n if (text === undefined) {\n children = [];\n for (; childIndex < argsLength; childIndex++) {\n var child = arguments[childIndex];\n if (child === null || child === undefined) {\n }\n else if (Array.isArray(child)) {\n appendChildren(selector, child, children);\n }\n else if (child.hasOwnProperty('vnodeSelector')) {\n children.push(child);\n }\n else {\n children.push(toTextVNode(child));\n }\n }\n }\n return {\n vnodeSelector: selector,\n properties: properties,\n children: children,\n text: (text === '') ? undefined : text,\n domNode: null\n };\n};\n/**\n * Contains simple low-level utility functions to manipulate the real DOM.\n */\nexports.dom = {\n /**\n * Creates a real DOM tree from `vnode`. The [[Projection]] object returned will contain the resulting DOM Node in\n * its [[Projection.domNode|domNode]] property.\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection.\n * @returns The [[Projection]] which also contains the DOM Node that was created.\n */\n create: function (vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, document.createElement('div'), undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Appends a new child node to the DOM which is generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param parentNode - The parent node for the new child node.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n append: function (parentNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, parentNode, undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Inserts a new DOM node which is generated from a [[VNode]].\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param beforeNode - The node that the DOM Node is inserted before.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function.\n * NOTE: [[VNode]] objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n insertBefore: function (beforeNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, beforeNode.parentNode, beforeNode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Merges a new DOM node which is generated from a [[VNode]] with an existing DOM Node.\n * This means that the virtual DOM and the real DOM will have one overlapping element.\n * Therefore the selector for the root [[VNode]] will be ignored, but its properties and children will be applied to the Element provided.\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param element - The existing element to adopt as the root of the new virtual DOM. Existing attributes and child nodes are preserved.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]] objects\n * may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n merge: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n vnode.domNode = element;\n initPropertiesAndChildren(element, vnode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Replaces an existing DOM node with a node generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param element - The node for the [[VNode]] to replace.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n replace: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, element.parentNode, element, projectionOptions);\n element.parentNode.removeChild(element);\n return createProjection(vnode, projectionOptions);\n }\n};\n/**\n * Creates a [[CalculationCache]] object, useful for caching [[VNode]] trees.\n * In practice, caching of [[VNode]] trees is not needed, because achieving 60 frames per second is almost never a problem.\n * For more information, see [[CalculationCache]].\n *\n * @param The type of the value that is cached.\n */\nexports.createCache = function () {\n var cachedInputs;\n var cachedOutcome;\n return {\n invalidate: function () {\n cachedOutcome = undefined;\n cachedInputs = undefined;\n },\n result: function (inputs, calculation) {\n if (cachedInputs) {\n for (var i = 0; i < inputs.length; i++) {\n if (cachedInputs[i] !== inputs[i]) {\n cachedOutcome = undefined;\n }\n }\n }\n if (!cachedOutcome) {\n cachedOutcome = calculation();\n cachedInputs = inputs;\n }\n return cachedOutcome;\n }\n };\n};\n/**\n * Creates a {@link Mapping} instance that keeps an array of result objects synchronized with an array of source objects.\n * See {@link http://maquettejs.org/docs/arrays.html|Working with arrays}.\n *\n * @param The type of source items. A database-record for instance.\n * @param The type of target items. A [[Component]] for instance.\n * @param getSourceKey `function(source)` that must return a key to identify each source object. The result must either be a string or a number.\n * @param createResult `function(source, index)` that must create a new result object from a given source. This function is identical\n * to the `callback` argument in `Array.map(callback)`.\n * @param updateResult `function(source, target, index)` that updates a result to an updated source.\n */\nexports.createMapping = function (getSourceKey, createResult, updateResult) {\n var keys = [];\n var results = [];\n return {\n results: results,\n map: function (newSources) {\n var newKeys = newSources.map(getSourceKey);\n var oldTargets = results.slice();\n var oldIndex = 0;\n for (var i = 0; i < newSources.length; i++) {\n var source = newSources[i];\n var sourceKey = newKeys[i];\n if (sourceKey === keys[oldIndex]) {\n results[i] = oldTargets[oldIndex];\n updateResult(source, oldTargets[oldIndex], i);\n oldIndex++;\n }\n else {\n var found = false;\n for (var j = 1; j < keys.length + 1; j++) {\n var searchIndex = (oldIndex + j) % keys.length;\n if (keys[searchIndex] === sourceKey) {\n results[i] = oldTargets[searchIndex];\n updateResult(newSources[i], oldTargets[searchIndex], i);\n oldIndex = searchIndex + 1;\n found = true;\n break;\n }\n }\n if (!found) {\n results[i] = createResult(source, i);\n }\n }\n }\n results.length = newSources.length;\n keys = newKeys;\n }\n };\n};\n/**\n * Creates a [[Projector]] instance using the provided projectionOptions.\n *\n * For more information, see [[Projector]].\n *\n * @param projectorOptions Options that influence how the DOM is rendered and updated.\n */\nexports.createProjector = function (projectorOptions) {\n var projector;\n var projectionOptions = applyDefaultProjectionOptions(projectorOptions);\n projectionOptions.eventHandlerInterceptor = function (propertyName, eventHandler, domNode, properties) {\n return function () {\n // intercept function calls (event handlers) to do a render afterwards.\n projector.scheduleRender();\n return eventHandler.apply(properties.bind || this, arguments);\n };\n };\n var renderCompleted = true;\n var scheduled;\n var stopped = false;\n var projections = [];\n var renderFunctions = []; // matches the projections array\n var doRender = function () {\n scheduled = undefined;\n if (!renderCompleted) {\n return; // The last render threw an error, it should be logged in the browser console.\n }\n renderCompleted = false;\n for (var i = 0; i < projections.length; i++) {\n var updatedVnode = renderFunctions[i]();\n projections[i].update(updatedVnode);\n }\n renderCompleted = true;\n };\n projector = {\n renderNow: doRender,\n scheduleRender: function () {\n if (!scheduled && !stopped) {\n scheduled = requestAnimationFrame(doRender);\n }\n },\n stop: function () {\n if (scheduled) {\n cancelAnimationFrame(scheduled);\n scheduled = undefined;\n }\n stopped = true;\n },\n resume: function () {\n stopped = false;\n renderCompleted = true;\n projector.scheduleRender();\n },\n append: function (parentNode, renderMaquetteFunction) {\n projections.push(exports.dom.append(parentNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n insertBefore: function (beforeNode, renderMaquetteFunction) {\n projections.push(exports.dom.insertBefore(beforeNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n merge: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.merge(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n replace: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.replace(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n detach: function (renderMaquetteFunction) {\n for (var i = 0; i < renderFunctions.length; i++) {\n if (renderFunctions[i] === renderMaquetteFunction) {\n renderFunctions.splice(i, 1);\n return projections.splice(i, 1)[0];\n }\n }\n throw new Error('renderMaquetteFunction was not found');\n }\n };\n return projector;\n};\n\n//# sourceMappingURL=maquette.js.map\n"]} \ No newline at end of file diff --git a/dist/maquette.min.js b/dist/maquette.min.js index d4412fa..746dc85 100644 --- a/dist/maquette.min.js +++ b/dist/maquette.min.js @@ -1,2 +1,2 @@ -!function(e,r){"function"==typeof define&&define.amd?define(["exports"],r):r("object"==typeof exports&&"string"!=typeof exports.nodeName?exports:e.maquette={})}(this,function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,t,o="http://www.w3.org/2000/svg",n=[],i=function(e,r){var t={};return Object.keys(e).forEach(function(r){t[r]=e[r]}),r&&Object.keys(r).forEach(function(e){t[e]=r[e]}),t},s=function(e,r){return e.vnodeSelector===r.vnodeSelector&&(e.properties&&r.properties?e.properties.key===r.properties.key&&e.properties.bind===r.properties.bind:!e.properties&&!r.properties)},a=function(e){return{vnodeSelector:"",properties:void 0,children:void 0,text:e.toString(),domNode:null}},d=function(e,r,t){for(var o=0,n=r.length;o=0){for(p=f;pf)for(p=f;p=0){for(d=f;df)for(d=f;d= 0) {\n // Remove preceding missing children\n for (i = oldIndex; i < findOldIndex; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n textUpdated = updateDom(oldChildren[findOldIndex], newChild, projectionOptions) || textUpdated;\n oldIndex = findOldIndex + 1;\n } else {\n // New child\n createDom(newChild, domNode, oldIndex < oldChildrenLength ? oldChildren[oldIndex].domNode : undefined, projectionOptions);\n nodeAdded(newChild, transitions);\n checkDistinguishable(newChildren, newIndex, vnode, 'added');\n }\n }\n newIndex++;\n }\n if (oldChildrenLength > oldIndex) {\n // Remove child fragments\n for (i = oldIndex; i < oldChildrenLength; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n }\n return textUpdated;\n };\n var addChildren = function (domNode, children, projectionOptions) {\n if (!children) {\n return;\n }\n for (var i = 0; i < children.length; i++) {\n createDom(children[i], domNode, undefined, projectionOptions);\n }\n };\n var initPropertiesAndChildren = function (domNode, vnode, projectionOptions) {\n addChildren(domNode, vnode.children, projectionOptions);\n // children before properties, needed for value property of .\n if (vnode.text) {\n domNode.textContent = vnode.text;\n }\n setProperties(domNode, vnode.properties, projectionOptions);\n if (vnode.properties && vnode.properties.afterCreate) {\n vnode.properties.afterCreate.apply(vnode.properties.bind || vnode.properties, [\n domNode,\n projectionOptions,\n vnode.vnodeSelector,\n vnode.properties,\n vnode.children\n ]);\n }\n };\n var insertNode = function (parentNode, domNode, vnode, beforeNode) {\n if (vnode.properties && vnode.properties.beforeAttach) {\n vnode.properties.beforeAttach.apply(vnode.properties.bind || vnode.properties, [\n parentNode,\n domNode\n ]);\n }\n if (beforeNode) {\n parentNode.insertBefore(domNode, beforeNode);\n } else if (domNode.parentNode !== parentNode) {\n parentNode.appendChild(domNode);\n }\n };\n createDom = function (vnode, parentNode, insertBefore, projectionOptions) {\n var delayAttach = !!(vnode.properties && vnode.properties.delayAttach);\n var domNode, i, c, start = 0, type, found;\n var vnodeSelector = vnode.vnodeSelector;\n var doc = parentNode.ownerDocument;\n if (vnodeSelector === '') {\n domNode = vnode.domNode = doc.createTextNode(vnode.text);\n if (!delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n } else {\n for (i = 0; i <= vnodeSelector.length; ++i) {\n c = vnodeSelector.charAt(i);\n if (i === vnodeSelector.length || c === '.' || c === '#') {\n type = vnodeSelector.charAt(start - 1);\n found = vnodeSelector.slice(start, i);\n if (type === '.') {\n domNode.classList.add(found);\n } else if (type === '#') {\n domNode.id = found;\n } else {\n if (found === 'svg') {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (projectionOptions.namespace !== undefined) {\n domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found);\n } else {\n domNode = vnode.domNode = vnode.domNode || doc.createElement(found);\n if (found === 'input' && vnode.properties && vnode.properties.type !== undefined) {\n // IE8 and older don't support setting input type after the DOM Node has been added to the document\n domNode.setAttribute('type', vnode.properties.type);\n }\n }\n if (!delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n start = i + 1;\n }\n }\n initPropertiesAndChildren(domNode, vnode, projectionOptions);\n if (delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n };\n updateDom = function (previous, vnode, projectionOptions) {\n var domNode = previous.domNode;\n var textUpdated = false;\n if (previous === vnode) {\n return false; // By contract, VNode objects may not be modified anymore after passing them to maquette\n }\n var updated = false;\n if (vnode.vnodeSelector === '') {\n if (vnode.text !== previous.text) {\n var newVNode = domNode.ownerDocument.createTextNode(vnode.text);\n domNode.parentNode.replaceChild(newVNode, domNode);\n vnode.domNode = newVNode;\n textUpdated = true;\n return textUpdated;\n }\n } else {\n if (vnode.vnodeSelector.lastIndexOf('svg', 0) === 0) {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (previous.text !== vnode.text) {\n updated = true;\n if (vnode.text === undefined) {\n domNode.removeChild(domNode.firstChild); // the only textnode presumably\n } else {\n domNode.textContent = vnode.text;\n }\n }\n updated = updateChildren(vnode, domNode, previous.children, vnode.children, projectionOptions) || updated;\n updated = updateProperties(domNode, previous.properties, vnode.properties, projectionOptions) || updated;\n if (vnode.properties && vnode.properties.afterUpdate) {\n vnode.properties.afterUpdate.apply(vnode.properties.bind || vnode.properties, [\n domNode,\n projectionOptions,\n vnode.vnodeSelector,\n vnode.properties,\n vnode.children\n ]);\n }\n }\n if (updated && vnode.properties && vnode.properties.updateAnimation) {\n vnode.properties.updateAnimation(domNode, vnode.properties, previous.properties);\n }\n vnode.domNode = previous.domNode;\n return textUpdated;\n };\n var createProjection = function (vnode, projectionOptions) {\n return {\n update: function (updatedVnode) {\n if (vnode.vnodeSelector !== updatedVnode.vnodeSelector) {\n throw new Error('The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)');\n }\n updateDom(vnode, updatedVnode, projectionOptions);\n vnode = updatedVnode;\n },\n domNode: vnode.domNode\n };\n };\n // The other two parameters are not added here, because the Typescript compiler creates surrogate code for destructuring 'children'.\n exports.h = function (selector) {\n var properties = arguments[1];\n if (typeof selector !== 'string') {\n throw new Error();\n }\n var childIndex = 1;\n if (properties && !properties.hasOwnProperty('vnodeSelector') && !Array.isArray(properties) && typeof properties === 'object') {\n childIndex = 2;\n } else {\n // Optional properties argument was omitted\n properties = undefined;\n }\n var text;\n var children;\n var argsLength = arguments.length;\n // Recognize a common special case where there is only a single text node\n if (argsLength === childIndex + 1) {\n var onlyChild = arguments[childIndex];\n if (typeof onlyChild === 'string') {\n text = onlyChild;\n } else if (onlyChild !== undefined && onlyChild !== null && onlyChild.length === 1 && typeof onlyChild[0] === 'string') {\n text = onlyChild[0];\n }\n }\n if (text === undefined) {\n children = [];\n for (; childIndex < argsLength; childIndex++) {\n var child = arguments[childIndex];\n if (child === null || child === undefined) {\n } else if (Array.isArray(child)) {\n appendChildren(selector, child, children);\n } else if (child.hasOwnProperty('vnodeSelector')) {\n children.push(child);\n } else {\n children.push(toTextVNode(child));\n }\n }\n }\n return {\n vnodeSelector: selector,\n properties: properties,\n children: children,\n text: text === '' ? undefined : text,\n domNode: null\n };\n };\n /**\n * Contains simple low-level utility functions to manipulate the real DOM.\n */\n exports.dom = {\n /**\n * Creates a real DOM tree from `vnode`. The [[Projection]] object returned will contain the resulting DOM Node in\n * its [[Projection.domNode|domNode]] property.\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection.\n * @returns The [[Projection]] which also contains the DOM Node that was created.\n */\n create: function (vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, document.createElement('div'), undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Appends a new child node to the DOM which is generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param parentNode - The parent node for the new child node.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n append: function (parentNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, parentNode, undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Inserts a new DOM node which is generated from a [[VNode]].\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param beforeNode - The node that the DOM Node is inserted before.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function.\n * NOTE: [[VNode]] objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n insertBefore: function (beforeNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, beforeNode.parentNode, beforeNode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Merges a new DOM node which is generated from a [[VNode]] with an existing DOM Node.\n * This means that the virtual DOM and the real DOM will have one overlapping element.\n * Therefore the selector for the root [[VNode]] will be ignored, but its properties and children will be applied to the Element provided.\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param element - The existing element to adopt as the root of the new virtual DOM. Existing attributes and child nodes are preserved.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]] objects\n * may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n merge: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n vnode.domNode = element;\n initPropertiesAndChildren(element, vnode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Replaces an existing DOM node with a node generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param element - The node for the [[VNode]] to replace.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n replace: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, element.parentNode, element, projectionOptions);\n element.parentNode.removeChild(element);\n return createProjection(vnode, projectionOptions);\n }\n };\n /**\n * Creates a [[CalculationCache]] object, useful for caching [[VNode]] trees.\n * In practice, caching of [[VNode]] trees is not needed, because achieving 60 frames per second is almost never a problem.\n * For more information, see [[CalculationCache]].\n *\n * @param The type of the value that is cached.\n */\n exports.createCache = function () {\n var cachedInputs;\n var cachedOutcome;\n return {\n invalidate: function () {\n cachedOutcome = undefined;\n cachedInputs = undefined;\n },\n result: function (inputs, calculation) {\n if (cachedInputs) {\n for (var i = 0; i < inputs.length; i++) {\n if (cachedInputs[i] !== inputs[i]) {\n cachedOutcome = undefined;\n }\n }\n }\n if (!cachedOutcome) {\n cachedOutcome = calculation();\n cachedInputs = inputs;\n }\n return cachedOutcome;\n }\n };\n };\n /**\n * Creates a {@link Mapping} instance that keeps an array of result objects synchronized with an array of source objects.\n * See {@link http://maquettejs.org/docs/arrays.html|Working with arrays}.\n *\n * @param The type of source items. A database-record for instance.\n * @param The type of target items. A [[Component]] for instance.\n * @param getSourceKey `function(source)` that must return a key to identify each source object. The result must either be a string or a number.\n * @param createResult `function(source, index)` that must create a new result object from a given source. This function is identical\n * to the `callback` argument in `Array.map(callback)`.\n * @param updateResult `function(source, target, index)` that updates a result to an updated source.\n */\n exports.createMapping = function (getSourceKey, createResult, updateResult) {\n var keys = [];\n var results = [];\n return {\n results: results,\n map: function (newSources) {\n var newKeys = newSources.map(getSourceKey);\n var oldTargets = results.slice();\n var oldIndex = 0;\n for (var i = 0; i < newSources.length; i++) {\n var source = newSources[i];\n var sourceKey = newKeys[i];\n if (sourceKey === keys[oldIndex]) {\n results[i] = oldTargets[oldIndex];\n updateResult(source, oldTargets[oldIndex], i);\n oldIndex++;\n } else {\n var found = false;\n for (var j = 1; j < keys.length + 1; j++) {\n var searchIndex = (oldIndex + j) % keys.length;\n if (keys[searchIndex] === sourceKey) {\n results[i] = oldTargets[searchIndex];\n updateResult(newSources[i], oldTargets[searchIndex], i);\n oldIndex = searchIndex + 1;\n found = true;\n break;\n }\n }\n if (!found) {\n results[i] = createResult(source, i);\n }\n }\n }\n results.length = newSources.length;\n keys = newKeys;\n }\n };\n };\n /**\n * Creates a [[Projector]] instance using the provided projectionOptions.\n *\n * For more information, see [[Projector]].\n *\n * @param projectorOptions Options that influence how the DOM is rendered and updated.\n */\n exports.createProjector = function (projectorOptions) {\n var projector;\n var projectionOptions = applyDefaultProjectionOptions(projectorOptions);\n projectionOptions.eventHandlerInterceptor = function (propertyName, eventHandler, domNode, properties) {\n return function () {\n // intercept function calls (event handlers) to do a render afterwards.\n projector.scheduleRender();\n return eventHandler.apply(properties.bind || this, arguments);\n };\n };\n var renderCompleted = true;\n var scheduled;\n var stopped = false;\n var projections = [];\n var renderFunctions = [];\n // matches the projections array\n var doRender = function () {\n scheduled = undefined;\n if (!renderCompleted) {\n return; // The last render threw an error, it should be logged in the browser console.\n }\n renderCompleted = false;\n for (var i = 0; i < projections.length; i++) {\n var updatedVnode = renderFunctions[i]();\n projections[i].update(updatedVnode);\n }\n renderCompleted = true;\n };\n projector = {\n renderNow: doRender,\n scheduleRender: function () {\n if (!scheduled && !stopped) {\n scheduled = requestAnimationFrame(doRender);\n }\n },\n stop: function () {\n if (scheduled) {\n cancelAnimationFrame(scheduled);\n scheduled = undefined;\n }\n stopped = true;\n },\n resume: function () {\n stopped = false;\n renderCompleted = true;\n projector.scheduleRender();\n },\n append: function (parentNode, renderMaquetteFunction) {\n projections.push(exports.dom.append(parentNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n insertBefore: function (beforeNode, renderMaquetteFunction) {\n projections.push(exports.dom.insertBefore(beforeNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n merge: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.merge(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n replace: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.replace(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n detach: function (renderMaquetteFunction) {\n for (var i = 0; i < renderFunctions.length; i++) {\n if (renderFunctions[i] === renderMaquetteFunction) {\n renderFunctions.splice(i, 1);\n return projections.splice(i, 1)[0];\n }\n }\n throw new Error('renderMaquetteFunction was not found');\n }\n };\n return projector;\n };\n}));",null]} \ No newline at end of file diff --git a/src/maquette.ts b/src/maquette.ts index 9a37441..7e5a2b8 100644 --- a/src/maquette.ts +++ b/src/maquette.ts @@ -331,6 +331,8 @@ export interface VNodeProperties { */ readonly innerHTML?: string; + readonly delayAttach?: boolean; + /** * Everything that is not explicitly listed (properties and attributes that are either uncommon or custom). */ @@ -757,30 +759,30 @@ let initPropertiesAndChildren = function(domNode: Node, vnode: VNode, projection } }; -let insertNode = function (parentNode: Node, domNode: Node, vnode: VNode, beforeNode?: Node | null) { - let attach = true; +let insertNode = function (parentNode: Node, domNode: Node, vnode: VNode, beforeNode?: Node | null): void { if (vnode.properties && vnode.properties.beforeAttach) { - attach = vnode.properties.beforeAttach.apply(vnode.properties.bind || vnode.properties, [ + vnode.properties.beforeAttach.apply(vnode.properties.bind || vnode.properties, [ parentNode, domNode as Element ]); } - if (attach !== false) { - if (beforeNode) { - parentNode.insertBefore(domNode, beforeNode); - } else if (domNode.parentNode !== parentNode) { - parentNode.appendChild(domNode); - } + if (beforeNode) { + parentNode.insertBefore(domNode, beforeNode); + } else if (domNode.parentNode !== parentNode) { + parentNode.appendChild(domNode); } }; createDom = function(vnode, parentNode, insertBefore, projectionOptions) { + let delayAttach: boolean = !!(vnode.properties && vnode.properties.delayAttach); let domNode: Node | undefined, i: number, c: string, start = 0, type: string, found: string; let vnodeSelector = vnode.vnodeSelector; let doc = parentNode.ownerDocument; if (vnodeSelector === '') { domNode = vnode.domNode = doc.createTextNode(vnode.text!); - insertNode(parentNode, domNode, vnode, insertBefore); + if (!delayAttach) { + insertNode(parentNode, domNode, vnode, insertBefore); + } } else { for (i = 0; i <= vnodeSelector.length; ++i) { c = vnodeSelector.charAt(i); @@ -804,12 +806,18 @@ createDom = function(vnode, parentNode, insertBefore, projectionOptions) { (domNode as Element).setAttribute("type", vnode.properties.type); } } - insertNode(parentNode, domNode, vnode, insertBefore); + if (!delayAttach) { + insertNode(parentNode, domNode, vnode, insertBefore); + } } start = i + 1; } } initPropertiesAndChildren(domNode!, vnode, projectionOptions); + + if (delayAttach) { + insertNode(parentNode, domNode!, vnode, insertBefore); + } } }; From baa46d81cbc8b887dd1d8e6799526e9d8a3e1e9e Mon Sep 17 00:00:00 2001 From: Paul Shannon Date: Mon, 21 Aug 2017 17:42:33 -0700 Subject: [PATCH 3/5] add explicit check for custom elements --- dist/maquette.js | 18 ++++++++---------- dist/maquette.js.map | 2 +- dist/maquette.min.js | 2 +- dist/maquette.min.js.map | 2 +- src/maquette.ts | 21 ++++++++++----------- test/dom/create.ts | 6 ++++++ 6 files changed, 27 insertions(+), 24 deletions(-) diff --git a/dist/maquette.js b/dist/maquette.js index 3af22d9..afea27b 100644 --- a/dist/maquette.js +++ b/dist/maquette.js @@ -408,28 +408,26 @@ } }; var insertNode = function (parentNode, domNode, vnode, beforeNode) { - if (vnode.properties && vnode.properties.beforeAttach) { - vnode.properties.beforeAttach.apply(vnode.properties.bind || vnode.properties, [ - parentNode, - domNode - ]); - } if (beforeNode) { parentNode.insertBefore(domNode, beforeNode); } else if (domNode.parentNode !== parentNode) { parentNode.appendChild(domNode); } }; + /** + * Identifies custom element tags as defined in custom elements v1 draft spec + * + * @see https://www.w3.org/TR/custom-elements/#custom-elements-core-concepts + */ + var customElementRegex = /^[a-z][^-]*-/; createDom = function (vnode, parentNode, insertBefore, projectionOptions) { - var delayAttach = !!(vnode.properties && vnode.properties.delayAttach); var domNode, i, c, start = 0, type, found; var vnodeSelector = vnode.vnodeSelector; + var delayAttach = customElementRegex.test(vnodeSelector); var doc = parentNode.ownerDocument; if (vnodeSelector === '') { domNode = vnode.domNode = doc.createTextNode(vnode.text); - if (!delayAttach) { - insertNode(parentNode, domNode, vnode, insertBefore); - } + insertNode(parentNode, domNode, vnode, insertBefore); } else { for (i = 0; i <= vnodeSelector.length; ++i) { c = vnodeSelector.charAt(i); diff --git a/dist/maquette.js.map b/dist/maquette.js.map index c635431..a3f40b5 100644 --- a/dist/maquette.js.map +++ b/dist/maquette.js.map @@ -1 +1 @@ -{"version":3,"sources":["maquette.js","../../../../src/maquette.ts"],"names":["Object","defineProperty","exports","value","NAMESPACE_W3","NAMESPACE_SVG","NAMESPACE_XLINK","emptyArray","extend","base","overrides","result","keys","forEach","key","same","vnode1","vnode2","vnodeSelector","properties","bind","toTextVNode","data","undefined","children","text","toString","domNode","appendChildren","parentSelector","insertions","main","i","length_1","length","item","Array","isArray","hasOwnProperty","push","missingTransition","Error","DEFAULT_PROJECTION_OPTIONS","namespace","eventHandlerInterceptor","styleApplyer","styleName","style","transitions","enter","exit","applyDefaultProjectionOptions","projectorOptions","checkStyleValue","styleValue","setProperties","projectionOptions","propNames","propCount","_loop_1","propName","propValue","split","token","classList","add","classNames","classNameCount","j","className","styleNames","styleCount","type","lastIndexOf","oldPropValue","evt","apply","target","setAttributeNS","setAttribute","updateProperties","previousProperties","propertiesUpdated","previousValue","on","previousOn","remove","newStyleValue","oldStyleValue","domValue","removeAttribute","findIndexOfChild","sameAs","start","nodeAdded","vNode","enterAnimation","nodeToRemove","exitAnimation","pointerEvents","removeDomNode","parentNode","removeChild","checkDistinguishable","childNodes","indexToCheck","parentVNode","operation","childNode","node","createDom","updateDom","updateChildren","vnode","oldChildren","newChildren","oldChildrenLength","newChildrenLength","oldIndex","newIndex","textUpdated","oldChild","newChild","findOldIndex","addChildren","initPropertiesAndChildren","textContent","afterCreate","insertNode","beforeNode","beforeAttach","insertBefore","appendChild","delayAttach","c","found","doc","ownerDocument","createTextNode","charAt","slice","id","createElementNS","createElement","previous","updated","newVNode","replaceChild","firstChild","afterUpdate","updateAnimation","createProjection","update","updatedVnode","h","selector","arguments","childIndex","argsLength","onlyChild","child","dom","create","document","append","merge","element","replace","createCache","cachedInputs","cachedOutcome","invalidate","inputs","calculation","createMapping","getSourceKey","createResult","updateResult","results","map","newSources","newKeys","oldTargets","source","sourceKey","searchIndex","createProjector","projector","propertyName","eventHandler","scheduleRender","renderCompleted","scheduled","stopped","projections","renderFunctions","doRender","renderNow","requestAnimationFrame","stop","cancelAnimationFrame","resume","renderMaquetteFunction","detach","splice"],"mappings":";;;;;;;;;;;;IAAA,a;IAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,MAAA,CAAOC,cAAP,CAAsBC,OAAtB,EAA+B,YAA/B,EAA6C,EAAEC,KAAA,EAAO,IAAT,EAA7C,E;IC6VA,IAAMC,YAAA,GAAe,oBAArB,C;IACA,IAAMC,aAAA,GAAgBD,YAAA,GAAe,UAArC,C;IACA,IAAME,eAAA,GAAkBF,YAAA,GAAe,YAAvC,C;IAIA;AAAA,QAAIG,UAAA,GAAsB,EAA1B,C;IAEA,IAAIC,MAAA,GAAS,UAAIC,IAAJ,EAAaC,SAAb,EAA2B;AAAA,QACtC,IAAIC,MAAA,GAAS,EAAb,CADsC;AAAA,QAEtCX,MAAA,CAAOY,IAAP,CAAYH,IAAZ,EAAkBI,OAAlB,CAA0B,UAASC,GAAT,EAAY;AAAA,YACpCH,MAAA,CAA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;AAAA,gBAE/C2I,eAAA,CAAgB5J,IAAhB,CAAqBmK,sBAArB,EAF+C;AAAA,aApCvC;AAAA,YAyCVC,MAAA,EAAQ,UAASD,sBAAT,EAA+B;AAAA,gBACrC,KAAK,IAAI1K,CAAA,GAAI,CAAR,CAAL,CAAgBA,CAAA,GAAImK,eAAA,CAAgBjK,MAApC,EAA4CF,CAAA,EAA5C,EAAiD;AAAA,oBAC/C,IAAImK,eAAA,CAAgBnK,CAAhB,MAAuB0K,sBAA3B,EAAmD;AAAA,wBACjDP,eAAA,CAAgBS,MAAhB,CAAuB5K,CAAvB,EAA0B,CAA1B,EADiD;AAAA,wBAEjD,OAAOkK,WAAA,CAAYU,MAAZ,CAAmB5K,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CAAP,CAFiD;AAAA,qBADJ;AAAA,iBADZ;AAAA,gBAOrC,MAAM,IAAIS,KAAJ,CAAU,sCAAV,CAAN,CAPqC;AAAA,aAzC7B;AAAA,SAAZ,CA7BuE;AAAA,QAiFvE,OAAOkJ,SAAP,CAjFuE;AAAA,KAA9D,C","file":"maquette.js","sourcesContent":["\"use strict\";\n// Comment that is displayed in the API documentation for the maquette module:\n/**\n * Welcome to the API documentation of the **maquette** library.\n *\n * [[http://maquettejs.org/|To the maquette homepage]]\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar NAMESPACE_W3 = 'http://www.w3.org/';\nvar NAMESPACE_SVG = NAMESPACE_W3 + '2000/svg';\nvar NAMESPACE_XLINK = NAMESPACE_W3 + '1999/xlink';\n// Utilities\nvar emptyArray = [];\nvar extend = function (base, overrides) {\n var result = {};\n Object.keys(base).forEach(function (key) {\n result[key] = base[key];\n });\n if (overrides) {\n Object.keys(overrides).forEach(function (key) {\n result[key] = overrides[key];\n });\n }\n return result;\n};\n// Hyperscript helper functions\nvar same = function (vnode1, vnode2) {\n if (vnode1.vnodeSelector !== vnode2.vnodeSelector) {\n return false;\n }\n if (vnode1.properties && vnode2.properties) {\n if (vnode1.properties.key !== vnode2.properties.key) {\n return false;\n }\n return vnode1.properties.bind === vnode2.properties.bind;\n }\n return !vnode1.properties && !vnode2.properties;\n};\nvar toTextVNode = function (data) {\n return {\n vnodeSelector: '',\n properties: undefined,\n children: undefined,\n text: data.toString(),\n domNode: null\n };\n};\nvar appendChildren = function (parentSelector, insertions, main) {\n for (var i = 0, length_1 = insertions.length; i < length_1; i++) {\n var item = insertions[i];\n if (Array.isArray(item)) {\n appendChildren(parentSelector, item, main);\n }\n else {\n if (item !== null && item !== undefined) {\n if (!item.hasOwnProperty('vnodeSelector')) {\n item = toTextVNode(item);\n }\n main.push(item);\n }\n }\n }\n};\n// Render helper functions\nvar missingTransition = function () {\n throw new Error('Provide a transitions object to the projectionOptions to do animations');\n};\nvar DEFAULT_PROJECTION_OPTIONS = {\n namespace: undefined,\n eventHandlerInterceptor: undefined,\n styleApplyer: function (domNode, styleName, value) {\n // Provides a hook to add vendor prefixes for browsers that still need it.\n domNode.style[styleName] = value;\n },\n transitions: {\n enter: missingTransition,\n exit: missingTransition\n }\n};\nvar applyDefaultProjectionOptions = function (projectorOptions) {\n return extend(DEFAULT_PROJECTION_OPTIONS, projectorOptions);\n};\nvar checkStyleValue = function (styleValue) {\n if (typeof styleValue !== 'string') {\n throw new Error('Style values must be strings');\n }\n};\nvar setProperties = function (domNode, properties, projectionOptions) {\n if (!properties) {\n return;\n }\n var eventHandlerInterceptor = projectionOptions.eventHandlerInterceptor;\n var propNames = Object.keys(properties);\n var propCount = propNames.length;\n var _loop_1 = function (i) {\n var propName = propNames[i];\n /* tslint:disable:no-var-keyword: edge case */\n var propValue = properties[propName];\n /* tslint:enable:no-var-keyword */\n if (propName === 'className') {\n throw new Error('Property \"className\" is not supported, use \"class\".');\n }\n else if (propName === 'class') {\n propValue.split(/\\s+/).forEach(function (token) { return domNode.classList.add(token); });\n }\n else if (propName === 'classes') {\n // object with string keys and boolean values\n var classNames = Object.keys(propValue);\n var classNameCount = classNames.length;\n for (var j = 0; j < classNameCount; j++) {\n var className = classNames[j];\n if (propValue[className]) {\n domNode.classList.add(className);\n }\n }\n }\n else if (propName === 'styles') {\n // object with string keys and string (!) values\n var styleNames = Object.keys(propValue);\n var styleCount = styleNames.length;\n for (var j = 0; j < styleCount; j++) {\n var styleName = styleNames[j];\n var styleValue = propValue[styleName];\n if (styleValue) {\n checkStyleValue(styleValue);\n projectionOptions.styleApplyer(domNode, styleName, styleValue);\n }\n }\n }\n else if (propName !== 'key' && propValue !== null && propValue !== undefined) {\n var type = typeof propValue;\n if (type === 'function') {\n if (propName.lastIndexOf('on', 0) === 0) {\n if (eventHandlerInterceptor) {\n propValue = eventHandlerInterceptor(propName, propValue, domNode, properties); // intercept eventhandlers\n }\n if (propName === 'oninput') {\n (function () {\n // record the evt.target.value, because IE and Edge sometimes do a requestAnimationFrame between changing value and running oninput\n var oldPropValue = propValue;\n propValue = function (evt) {\n oldPropValue.apply(this, [evt]);\n evt.target['oninput-value'] = evt.target.value; // may be HTMLTextAreaElement as well\n };\n }());\n }\n domNode[propName] = propValue;\n }\n }\n else if (type === 'string' && propName !== 'value' && propName !== 'innerHTML') {\n if (projectionOptions.namespace === NAMESPACE_SVG && propName === 'href') {\n domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);\n }\n else {\n domNode.setAttribute(propName, propValue);\n }\n }\n else {\n domNode[propName] = propValue;\n }\n }\n };\n for (var i = 0; i < propCount; i++) {\n _loop_1(i);\n }\n};\nvar updateProperties = function (domNode, previousProperties, properties, projectionOptions) {\n if (!properties) {\n return;\n }\n var propertiesUpdated = false;\n var propNames = Object.keys(properties);\n var propCount = propNames.length;\n for (var i = 0; i < propCount; i++) {\n var propName = propNames[i];\n // assuming that properties will be nullified instead of missing is by design\n var propValue = properties[propName];\n var previousValue = previousProperties[propName];\n if (propName === 'class') {\n if (previousValue !== propValue) {\n throw new Error('\"class\" property may not be updated. Use the \"classes\" property for conditional css classes.');\n }\n }\n else if (propName === 'classes') {\n var classList = domNode.classList;\n var classNames = Object.keys(propValue);\n var classNameCount = classNames.length;\n for (var j = 0; j < classNameCount; j++) {\n var className = classNames[j];\n var on = !!propValue[className];\n var previousOn = !!previousValue[className];\n if (on === previousOn) {\n continue;\n }\n propertiesUpdated = true;\n if (on) {\n classList.add(className);\n }\n else {\n classList.remove(className);\n }\n }\n }\n else if (propName === 'styles') {\n var styleNames = Object.keys(propValue);\n var styleCount = styleNames.length;\n for (var j = 0; j < styleCount; j++) {\n var styleName = styleNames[j];\n var newStyleValue = propValue[styleName];\n var oldStyleValue = previousValue[styleName];\n if (newStyleValue === oldStyleValue) {\n continue;\n }\n propertiesUpdated = true;\n if (newStyleValue) {\n checkStyleValue(newStyleValue);\n projectionOptions.styleApplyer(domNode, styleName, newStyleValue);\n }\n else {\n projectionOptions.styleApplyer(domNode, styleName, '');\n }\n }\n }\n else {\n if (!propValue && typeof previousValue === 'string') {\n propValue = '';\n }\n if (propName === 'value') {\n var domValue = domNode[propName];\n if (domValue !== propValue // The 'value' in the DOM tree !== newValue\n && (domNode['oninput-value']\n ? domValue === domNode['oninput-value'] // If the last reported value to 'oninput' does not match domValue, do nothing and wait for oninput\n : propValue !== previousValue // Only update the value if the vdom changed\n )) {\n domNode[propName] = propValue; // Reset the value, even if the virtual DOM did not change\n domNode['oninput-value'] = undefined;\n } // else do not update the domNode, otherwise the cursor position would be changed\n if (propValue !== previousValue) {\n propertiesUpdated = true;\n }\n }\n else if (propValue !== previousValue) {\n var type = typeof propValue;\n if (type === 'function') {\n throw new Error('Functions may not be updated on subsequent renders (property: ' + propName +\n '). Hint: declare event handler functions outside the render() function.');\n }\n if (type === 'string' && propName !== 'innerHTML') {\n if (projectionOptions.namespace === NAMESPACE_SVG && propName === 'href') {\n domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);\n }\n else if (propName === 'role' && propValue === '') {\n domNode.removeAttribute(propName);\n }\n else {\n domNode.setAttribute(propName, propValue);\n }\n }\n else {\n if (domNode[propName] !== propValue) {\n domNode[propName] = propValue;\n }\n }\n propertiesUpdated = true;\n }\n }\n }\n return propertiesUpdated;\n};\nvar findIndexOfChild = function (children, sameAs, start) {\n if (sameAs.vnodeSelector !== '') {\n // Never scan for text-nodes\n for (var i = start; i < children.length; i++) {\n if (same(children[i], sameAs)) {\n return i;\n }\n }\n }\n return -1;\n};\nvar nodeAdded = function (vNode, transitions) {\n if (vNode.properties) {\n var enterAnimation = vNode.properties.enterAnimation;\n if (enterAnimation) {\n if (typeof enterAnimation === 'function') {\n enterAnimation(vNode.domNode, vNode.properties);\n }\n else {\n transitions.enter(vNode.domNode, vNode.properties, enterAnimation);\n }\n }\n }\n};\nvar nodeToRemove = function (vNode, transitions) {\n var domNode = vNode.domNode;\n if (vNode.properties) {\n var exitAnimation = vNode.properties.exitAnimation;\n if (exitAnimation) {\n domNode.style.pointerEvents = 'none';\n var removeDomNode = function () {\n if (domNode.parentNode) {\n domNode.parentNode.removeChild(domNode);\n }\n };\n if (typeof exitAnimation === 'function') {\n exitAnimation(domNode, removeDomNode, vNode.properties);\n return;\n }\n else {\n transitions.exit(vNode.domNode, vNode.properties, exitAnimation, removeDomNode);\n return;\n }\n }\n }\n if (domNode.parentNode) {\n domNode.parentNode.removeChild(domNode);\n }\n};\nvar checkDistinguishable = function (childNodes, indexToCheck, parentVNode, operation) {\n var childNode = childNodes[indexToCheck];\n if (childNode.vnodeSelector === '') {\n return; // Text nodes need not be distinguishable\n }\n var properties = childNode.properties;\n var key = properties ? (properties.key === undefined ? properties.bind : properties.key) : undefined;\n if (!key) {\n for (var i = 0; i < childNodes.length; i++) {\n if (i !== indexToCheck) {\n var node = childNodes[i];\n if (same(node, childNode)) {\n if (operation === 'added') {\n throw new Error(parentVNode.vnodeSelector + ' had a ' + childNode.vnodeSelector + ' child ' +\n 'added, but there is now more than one. You must add unique key properties to make them distinguishable.');\n }\n else {\n throw new Error(parentVNode.vnodeSelector + ' had a ' + childNode.vnodeSelector + ' child ' +\n 'removed, but there were more than one. You must add unique key properties to make them distinguishable.');\n }\n }\n }\n }\n }\n};\nvar createDom;\nvar updateDom;\nvar updateChildren = function (vnode, domNode, oldChildren, newChildren, projectionOptions) {\n if (oldChildren === newChildren) {\n return false;\n }\n oldChildren = oldChildren || emptyArray;\n newChildren = newChildren || emptyArray;\n var oldChildrenLength = oldChildren.length;\n var newChildrenLength = newChildren.length;\n var transitions = projectionOptions.transitions;\n var oldIndex = 0;\n var newIndex = 0;\n var i;\n var textUpdated = false;\n while (newIndex < newChildrenLength) {\n var oldChild = (oldIndex < oldChildrenLength) ? oldChildren[oldIndex] : undefined;\n var newChild = newChildren[newIndex];\n if (oldChild !== undefined && same(oldChild, newChild)) {\n textUpdated = updateDom(oldChild, newChild, projectionOptions) || textUpdated;\n oldIndex++;\n }\n else {\n var findOldIndex = findIndexOfChild(oldChildren, newChild, oldIndex + 1);\n if (findOldIndex >= 0) {\n // Remove preceding missing children\n for (i = oldIndex; i < findOldIndex; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n textUpdated = updateDom(oldChildren[findOldIndex], newChild, projectionOptions) || textUpdated;\n oldIndex = findOldIndex + 1;\n }\n else {\n // New child\n createDom(newChild, domNode, (oldIndex < oldChildrenLength) ? oldChildren[oldIndex].domNode : undefined, projectionOptions);\n nodeAdded(newChild, transitions);\n checkDistinguishable(newChildren, newIndex, vnode, 'added');\n }\n }\n newIndex++;\n }\n if (oldChildrenLength > oldIndex) {\n // Remove child fragments\n for (i = oldIndex; i < oldChildrenLength; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n }\n return textUpdated;\n};\nvar addChildren = function (domNode, children, projectionOptions) {\n if (!children) {\n return;\n }\n for (var i = 0; i < children.length; i++) {\n createDom(children[i], domNode, undefined, projectionOptions);\n }\n};\nvar initPropertiesAndChildren = function (domNode, vnode, projectionOptions) {\n addChildren(domNode, vnode.children, projectionOptions); // children before properties, needed for value property of .\n if (vnode.text) {\n domNode.textContent = vnode.text;\n }\n setProperties(domNode, vnode.properties, projectionOptions);\n if (vnode.properties && vnode.properties.afterCreate) {\n vnode.properties.afterCreate.apply(vnode.properties.bind || vnode.properties, [domNode, projectionOptions, vnode.vnodeSelector, vnode.properties, vnode.children]);\n }\n};\nvar insertNode = function (parentNode, domNode, vnode, beforeNode) {\n if (beforeNode) {\n parentNode.insertBefore(domNode, beforeNode);\n }\n else if (domNode.parentNode !== parentNode) {\n parentNode.appendChild(domNode);\n }\n};\n/**\n * Identifies custom element tags as defined in custom elements v1 draft spec\n *\n * @see https://www.w3.org/TR/custom-elements/#custom-elements-core-concepts\n */\nvar customElementRegex = /^[a-z][^-]*-/;\ncreateDom = function (vnode, parentNode, insertBefore, projectionOptions) {\n var domNode, i, c, start = 0, type, found;\n var vnodeSelector = vnode.vnodeSelector;\n var delayAttach = customElementRegex.test(vnodeSelector);\n var doc = parentNode.ownerDocument;\n if (vnodeSelector === '') {\n domNode = vnode.domNode = doc.createTextNode(vnode.text);\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n else {\n for (i = 0; i <= vnodeSelector.length; ++i) {\n c = vnodeSelector.charAt(i);\n if (i === vnodeSelector.length || c === '.' || c === '#') {\n type = vnodeSelector.charAt(start - 1);\n found = vnodeSelector.slice(start, i);\n if (type === '.') {\n domNode.classList.add(found);\n }\n else if (type === '#') {\n domNode.id = found;\n }\n else {\n if (found === 'svg') {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (projectionOptions.namespace !== undefined) {\n domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found);\n }\n else {\n domNode = vnode.domNode = (vnode.domNode || doc.createElement(found));\n if (found === 'input' && vnode.properties && vnode.properties.type !== undefined) {\n // IE8 and older don't support setting input type after the DOM Node has been added to the document\n domNode.setAttribute('type', vnode.properties.type);\n }\n }\n if (!delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n start = i + 1;\n }\n }\n initPropertiesAndChildren(domNode, vnode, projectionOptions);\n if (delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n};\nupdateDom = function (previous, vnode, projectionOptions) {\n var domNode = previous.domNode;\n var textUpdated = false;\n if (previous === vnode) {\n return false; // By contract, VNode objects may not be modified anymore after passing them to maquette\n }\n var updated = false;\n if (vnode.vnodeSelector === '') {\n if (vnode.text !== previous.text) {\n var newVNode = domNode.ownerDocument.createTextNode(vnode.text);\n domNode.parentNode.replaceChild(newVNode, domNode);\n vnode.domNode = newVNode;\n textUpdated = true;\n return textUpdated;\n }\n }\n else {\n if (vnode.vnodeSelector.lastIndexOf('svg', 0) === 0) {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (previous.text !== vnode.text) {\n updated = true;\n if (vnode.text === undefined) {\n domNode.removeChild(domNode.firstChild); // the only textnode presumably\n }\n else {\n domNode.textContent = vnode.text;\n }\n }\n updated = updateChildren(vnode, domNode, previous.children, vnode.children, projectionOptions) || updated;\n updated = updateProperties(domNode, previous.properties, vnode.properties, projectionOptions) || updated;\n if (vnode.properties && vnode.properties.afterUpdate) {\n vnode.properties.afterUpdate.apply(vnode.properties.bind || vnode.properties, [domNode, projectionOptions, vnode.vnodeSelector, vnode.properties, vnode.children]);\n }\n }\n if (updated && vnode.properties && vnode.properties.updateAnimation) {\n vnode.properties.updateAnimation(domNode, vnode.properties, previous.properties);\n }\n vnode.domNode = previous.domNode;\n return textUpdated;\n};\nvar createProjection = function (vnode, projectionOptions) {\n return {\n update: function (updatedVnode) {\n if (vnode.vnodeSelector !== updatedVnode.vnodeSelector) {\n throw new Error('The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)');\n }\n updateDom(vnode, updatedVnode, projectionOptions);\n vnode = updatedVnode;\n },\n domNode: vnode.domNode\n };\n};\n// The other two parameters are not added here, because the Typescript compiler creates surrogate code for destructuring 'children'.\nexports.h = function (selector) {\n var properties = arguments[1];\n if (typeof selector !== 'string') {\n throw new Error();\n }\n var childIndex = 1;\n if (properties && !properties.hasOwnProperty('vnodeSelector') && !Array.isArray(properties) && typeof properties === 'object') {\n childIndex = 2;\n }\n else {\n // Optional properties argument was omitted\n properties = undefined;\n }\n var text;\n var children;\n var argsLength = arguments.length;\n // Recognize a common special case where there is only a single text node\n if (argsLength === childIndex + 1) {\n var onlyChild = arguments[childIndex];\n if (typeof onlyChild === 'string') {\n text = onlyChild;\n }\n else if (onlyChild !== undefined && onlyChild !== null && onlyChild.length === 1 && typeof onlyChild[0] === 'string') {\n text = onlyChild[0];\n }\n }\n if (text === undefined) {\n children = [];\n for (; childIndex < argsLength; childIndex++) {\n var child = arguments[childIndex];\n if (child === null || child === undefined) {\n }\n else if (Array.isArray(child)) {\n appendChildren(selector, child, children);\n }\n else if (child.hasOwnProperty('vnodeSelector')) {\n children.push(child);\n }\n else {\n children.push(toTextVNode(child));\n }\n }\n }\n return {\n vnodeSelector: selector,\n properties: properties,\n children: children,\n text: (text === '') ? undefined : text,\n domNode: null\n };\n};\n/**\n * Contains simple low-level utility functions to manipulate the real DOM.\n */\nexports.dom = {\n /**\n * Creates a real DOM tree from `vnode`. The [[Projection]] object returned will contain the resulting DOM Node in\n * its [[Projection.domNode|domNode]] property.\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection.\n * @returns The [[Projection]] which also contains the DOM Node that was created.\n */\n create: function (vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, document.createElement('div'), undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Appends a new child node to the DOM which is generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param parentNode - The parent node for the new child node.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n append: function (parentNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, parentNode, undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Inserts a new DOM node which is generated from a [[VNode]].\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param beforeNode - The node that the DOM Node is inserted before.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function.\n * NOTE: [[VNode]] objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n insertBefore: function (beforeNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, beforeNode.parentNode, beforeNode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Merges a new DOM node which is generated from a [[VNode]] with an existing DOM Node.\n * This means that the virtual DOM and the real DOM will have one overlapping element.\n * Therefore the selector for the root [[VNode]] will be ignored, but its properties and children will be applied to the Element provided.\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param element - The existing element to adopt as the root of the new virtual DOM. Existing attributes and child nodes are preserved.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]] objects\n * may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n merge: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n vnode.domNode = element;\n initPropertiesAndChildren(element, vnode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Replaces an existing DOM node with a node generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param element - The node for the [[VNode]] to replace.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n replace: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, element.parentNode, element, projectionOptions);\n element.parentNode.removeChild(element);\n return createProjection(vnode, projectionOptions);\n }\n};\n/**\n * Creates a [[CalculationCache]] object, useful for caching [[VNode]] trees.\n * In practice, caching of [[VNode]] trees is not needed, because achieving 60 frames per second is almost never a problem.\n * For more information, see [[CalculationCache]].\n *\n * @param The type of the value that is cached.\n */\nexports.createCache = function () {\n var cachedInputs;\n var cachedOutcome;\n return {\n invalidate: function () {\n cachedOutcome = undefined;\n cachedInputs = undefined;\n },\n result: function (inputs, calculation) {\n if (cachedInputs) {\n for (var i = 0; i < inputs.length; i++) {\n if (cachedInputs[i] !== inputs[i]) {\n cachedOutcome = undefined;\n }\n }\n }\n if (!cachedOutcome) {\n cachedOutcome = calculation();\n cachedInputs = inputs;\n }\n return cachedOutcome;\n }\n };\n};\n/**\n * Creates a {@link Mapping} instance that keeps an array of result objects synchronized with an array of source objects.\n * See {@link http://maquettejs.org/docs/arrays.html|Working with arrays}.\n *\n * @param The type of source items. A database-record for instance.\n * @param The type of target items. A [[Component]] for instance.\n * @param getSourceKey `function(source)` that must return a key to identify each source object. The result must either be a string or a number.\n * @param createResult `function(source, index)` that must create a new result object from a given source. This function is identical\n * to the `callback` argument in `Array.map(callback)`.\n * @param updateResult `function(source, target, index)` that updates a result to an updated source.\n */\nexports.createMapping = function (getSourceKey, createResult, updateResult) {\n var keys = [];\n var results = [];\n return {\n results: results,\n map: function (newSources) {\n var newKeys = newSources.map(getSourceKey);\n var oldTargets = results.slice();\n var oldIndex = 0;\n for (var i = 0; i < newSources.length; i++) {\n var source = newSources[i];\n var sourceKey = newKeys[i];\n if (sourceKey === keys[oldIndex]) {\n results[i] = oldTargets[oldIndex];\n updateResult(source, oldTargets[oldIndex], i);\n oldIndex++;\n }\n else {\n var found = false;\n for (var j = 1; j < keys.length + 1; j++) {\n var searchIndex = (oldIndex + j) % keys.length;\n if (keys[searchIndex] === sourceKey) {\n results[i] = oldTargets[searchIndex];\n updateResult(newSources[i], oldTargets[searchIndex], i);\n oldIndex = searchIndex + 1;\n found = true;\n break;\n }\n }\n if (!found) {\n results[i] = createResult(source, i);\n }\n }\n }\n results.length = newSources.length;\n keys = newKeys;\n }\n };\n};\n/**\n * Creates a [[Projector]] instance using the provided projectionOptions.\n *\n * For more information, see [[Projector]].\n *\n * @param projectorOptions Options that influence how the DOM is rendered and updated.\n */\nexports.createProjector = function (projectorOptions) {\n var projector;\n var projectionOptions = applyDefaultProjectionOptions(projectorOptions);\n projectionOptions.eventHandlerInterceptor = function (propertyName, eventHandler, domNode, properties) {\n return function () {\n // intercept function calls (event handlers) to do a render afterwards.\n projector.scheduleRender();\n return eventHandler.apply(properties.bind || this, arguments);\n };\n };\n var renderCompleted = true;\n var scheduled;\n var stopped = false;\n var projections = [];\n var renderFunctions = []; // matches the projections array\n var doRender = function () {\n scheduled = undefined;\n if (!renderCompleted) {\n return; // The last render threw an error, it should be logged in the browser console.\n }\n renderCompleted = false;\n for (var i = 0; i < projections.length; i++) {\n var updatedVnode = renderFunctions[i]();\n projections[i].update(updatedVnode);\n }\n renderCompleted = true;\n };\n projector = {\n renderNow: doRender,\n scheduleRender: function () {\n if (!scheduled && !stopped) {\n scheduled = requestAnimationFrame(doRender);\n }\n },\n stop: function () {\n if (scheduled) {\n cancelAnimationFrame(scheduled);\n scheduled = undefined;\n }\n stopped = true;\n },\n resume: function () {\n stopped = false;\n renderCompleted = true;\n projector.scheduleRender();\n },\n append: function (parentNode, renderMaquetteFunction) {\n projections.push(exports.dom.append(parentNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n insertBefore: function (beforeNode, renderMaquetteFunction) {\n projections.push(exports.dom.insertBefore(beforeNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n merge: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.merge(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n replace: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.replace(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n detach: function (renderMaquetteFunction) {\n for (var i = 0; i < renderFunctions.length; i++) {\n if (renderFunctions[i] === renderMaquetteFunction) {\n renderFunctions.splice(i, 1);\n return projections.splice(i, 1)[0];\n }\n }\n throw new Error('renderMaquetteFunction was not found');\n }\n };\n return projector;\n};\n\n//# sourceMappingURL=maquette.js.map\n"]} diff --git a/dist/maquette.min.js b/dist/maquette.min.js index 746dc85..9bc3e8e 100644 --- a/dist/maquette.min.js +++ b/dist/maquette.min.js @@ -1,2 +1,2 @@ -!function(e,r){"function"==typeof define&&define.amd?define(["exports"],r):r("object"==typeof exports&&"string"!=typeof exports.nodeName?exports:e.maquette={})}(this,function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,t,o="http://www.w3.org/2000/svg",n=[],i=function(e,r){var t={};return Object.keys(e).forEach(function(r){t[r]=e[r]}),r&&Object.keys(r).forEach(function(e){t[e]=r[e]}),t},s=function(e,r){return e.vnodeSelector===r.vnodeSelector&&(e.properties&&r.properties?e.properties.key===r.properties.key&&e.properties.bind===r.properties.bind:!e.properties&&!r.properties)},p=function(e){return{vnodeSelector:"",properties:void 0,children:void 0,text:e.toString(),domNode:null}},a=function(e,r,t){for(var o=0,n=r.length;o=0){for(d=f;df)for(d=f;d=0){for(p=f;pf)for(p=f;p= 0) {\n // Remove preceding missing children\n for (i = oldIndex; i < findOldIndex; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n textUpdated = updateDom(oldChildren[findOldIndex], newChild, projectionOptions) || textUpdated;\n oldIndex = findOldIndex + 1;\n } else {\n // New child\n createDom(newChild, domNode, oldIndex < oldChildrenLength ? oldChildren[oldIndex].domNode : undefined, projectionOptions);\n nodeAdded(newChild, transitions);\n checkDistinguishable(newChildren, newIndex, vnode, 'added');\n }\n }\n newIndex++;\n }\n if (oldChildrenLength > oldIndex) {\n // Remove child fragments\n for (i = oldIndex; i < oldChildrenLength; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n }\n return textUpdated;\n };\n var addChildren = function (domNode, children, projectionOptions) {\n if (!children) {\n return;\n }\n for (var i = 0; i < children.length; i++) {\n createDom(children[i], domNode, undefined, projectionOptions);\n }\n };\n var initPropertiesAndChildren = function (domNode, vnode, projectionOptions) {\n addChildren(domNode, vnode.children, projectionOptions);\n // children before properties, needed for value property of .\n if (vnode.text) {\n domNode.textContent = vnode.text;\n }\n setProperties(domNode, vnode.properties, projectionOptions);\n if (vnode.properties && vnode.properties.afterCreate) {\n vnode.properties.afterCreate.apply(vnode.properties.bind || vnode.properties, [\n domNode,\n projectionOptions,\n vnode.vnodeSelector,\n vnode.properties,\n vnode.children\n ]);\n }\n };\n var insertNode = function (parentNode, domNode, vnode, beforeNode) {\n if (beforeNode) {\n parentNode.insertBefore(domNode, beforeNode);\n } else if (domNode.parentNode !== parentNode) {\n parentNode.appendChild(domNode);\n }\n };\n /**\n * Identifies custom element tags as defined in custom elements v1 draft spec\n *\n * @see https://www.w3.org/TR/custom-elements/#custom-elements-core-concepts\n */\n var customElementRegex = /^[a-z][^-]*-/;\n createDom = function (vnode, parentNode, insertBefore, projectionOptions) {\n var domNode, i, c, start = 0, type, found;\n var vnodeSelector = vnode.vnodeSelector;\n var delayAttach = customElementRegex.test(vnodeSelector);\n var doc = parentNode.ownerDocument;\n if (vnodeSelector === '') {\n domNode = vnode.domNode = doc.createTextNode(vnode.text);\n insertNode(parentNode, domNode, vnode, insertBefore);\n } else {\n for (i = 0; i <= vnodeSelector.length; ++i) {\n c = vnodeSelector.charAt(i);\n if (i === vnodeSelector.length || c === '.' || c === '#') {\n type = vnodeSelector.charAt(start - 1);\n found = vnodeSelector.slice(start, i);\n if (type === '.') {\n domNode.classList.add(found);\n } else if (type === '#') {\n domNode.id = found;\n } else {\n if (found === 'svg') {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (projectionOptions.namespace !== undefined) {\n domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found);\n } else {\n domNode = vnode.domNode = vnode.domNode || doc.createElement(found);\n if (found === 'input' && vnode.properties && vnode.properties.type !== undefined) {\n // IE8 and older don't support setting input type after the DOM Node has been added to the document\n domNode.setAttribute('type', vnode.properties.type);\n }\n }\n if (!delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n start = i + 1;\n }\n }\n initPropertiesAndChildren(domNode, vnode, projectionOptions);\n if (delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n };\n updateDom = function (previous, vnode, projectionOptions) {\n var domNode = previous.domNode;\n var textUpdated = false;\n if (previous === vnode) {\n return false; // By contract, VNode objects may not be modified anymore after passing them to maquette\n }\n var updated = false;\n if (vnode.vnodeSelector === '') {\n if (vnode.text !== previous.text) {\n var newVNode = domNode.ownerDocument.createTextNode(vnode.text);\n domNode.parentNode.replaceChild(newVNode, domNode);\n vnode.domNode = newVNode;\n textUpdated = true;\n return textUpdated;\n }\n } else {\n if (vnode.vnodeSelector.lastIndexOf('svg', 0) === 0) {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (previous.text !== vnode.text) {\n updated = true;\n if (vnode.text === undefined) {\n domNode.removeChild(domNode.firstChild); // the only textnode presumably\n } else {\n domNode.textContent = vnode.text;\n }\n }\n updated = updateChildren(vnode, domNode, previous.children, vnode.children, projectionOptions) || updated;\n updated = updateProperties(domNode, previous.properties, vnode.properties, projectionOptions) || updated;\n if (vnode.properties && vnode.properties.afterUpdate) {\n vnode.properties.afterUpdate.apply(vnode.properties.bind || vnode.properties, [\n domNode,\n projectionOptions,\n vnode.vnodeSelector,\n vnode.properties,\n vnode.children\n ]);\n }\n }\n if (updated && vnode.properties && vnode.properties.updateAnimation) {\n vnode.properties.updateAnimation(domNode, vnode.properties, previous.properties);\n }\n vnode.domNode = previous.domNode;\n return textUpdated;\n };\n var createProjection = function (vnode, projectionOptions) {\n return {\n update: function (updatedVnode) {\n if (vnode.vnodeSelector !== updatedVnode.vnodeSelector) {\n throw new Error('The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)');\n }\n updateDom(vnode, updatedVnode, projectionOptions);\n vnode = updatedVnode;\n },\n domNode: vnode.domNode\n };\n };\n // The other two parameters are not added here, because the Typescript compiler creates surrogate code for destructuring 'children'.\n exports.h = function (selector) {\n var properties = arguments[1];\n if (typeof selector !== 'string') {\n throw new Error();\n }\n var childIndex = 1;\n if (properties && !properties.hasOwnProperty('vnodeSelector') && !Array.isArray(properties) && typeof properties === 'object') {\n childIndex = 2;\n } else {\n // Optional properties argument was omitted\n properties = undefined;\n }\n var text;\n var children;\n var argsLength = arguments.length;\n // Recognize a common special case where there is only a single text node\n if (argsLength === childIndex + 1) {\n var onlyChild = arguments[childIndex];\n if (typeof onlyChild === 'string') {\n text = onlyChild;\n } else if (onlyChild !== undefined && onlyChild !== null && onlyChild.length === 1 && typeof onlyChild[0] === 'string') {\n text = onlyChild[0];\n }\n }\n if (text === undefined) {\n children = [];\n for (; childIndex < argsLength; childIndex++) {\n var child = arguments[childIndex];\n if (child === null || child === undefined) {\n } else if (Array.isArray(child)) {\n appendChildren(selector, child, children);\n } else if (child.hasOwnProperty('vnodeSelector')) {\n children.push(child);\n } else {\n children.push(toTextVNode(child));\n }\n }\n }\n return {\n vnodeSelector: selector,\n properties: properties,\n children: children,\n text: text === '' ? undefined : text,\n domNode: null\n };\n };\n /**\n * Contains simple low-level utility functions to manipulate the real DOM.\n */\n exports.dom = {\n /**\n * Creates a real DOM tree from `vnode`. The [[Projection]] object returned will contain the resulting DOM Node in\n * its [[Projection.domNode|domNode]] property.\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection.\n * @returns The [[Projection]] which also contains the DOM Node that was created.\n */\n create: function (vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, document.createElement('div'), undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Appends a new child node to the DOM which is generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param parentNode - The parent node for the new child node.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n append: function (parentNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, parentNode, undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Inserts a new DOM node which is generated from a [[VNode]].\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param beforeNode - The node that the DOM Node is inserted before.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function.\n * NOTE: [[VNode]] objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n insertBefore: function (beforeNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, beforeNode.parentNode, beforeNode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Merges a new DOM node which is generated from a [[VNode]] with an existing DOM Node.\n * This means that the virtual DOM and the real DOM will have one overlapping element.\n * Therefore the selector for the root [[VNode]] will be ignored, but its properties and children will be applied to the Element provided.\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param element - The existing element to adopt as the root of the new virtual DOM. Existing attributes and child nodes are preserved.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]] objects\n * may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n merge: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n vnode.domNode = element;\n initPropertiesAndChildren(element, vnode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Replaces an existing DOM node with a node generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param element - The node for the [[VNode]] to replace.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n replace: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, element.parentNode, element, projectionOptions);\n element.parentNode.removeChild(element);\n return createProjection(vnode, projectionOptions);\n }\n };\n /**\n * Creates a [[CalculationCache]] object, useful for caching [[VNode]] trees.\n * In practice, caching of [[VNode]] trees is not needed, because achieving 60 frames per second is almost never a problem.\n * For more information, see [[CalculationCache]].\n *\n * @param The type of the value that is cached.\n */\n exports.createCache = function () {\n var cachedInputs;\n var cachedOutcome;\n return {\n invalidate: function () {\n cachedOutcome = undefined;\n cachedInputs = undefined;\n },\n result: function (inputs, calculation) {\n if (cachedInputs) {\n for (var i = 0; i < inputs.length; i++) {\n if (cachedInputs[i] !== inputs[i]) {\n cachedOutcome = undefined;\n }\n }\n }\n if (!cachedOutcome) {\n cachedOutcome = calculation();\n cachedInputs = inputs;\n }\n return cachedOutcome;\n }\n };\n };\n /**\n * Creates a {@link Mapping} instance that keeps an array of result objects synchronized with an array of source objects.\n * See {@link http://maquettejs.org/docs/arrays.html|Working with arrays}.\n *\n * @param The type of source items. A database-record for instance.\n * @param The type of target items. A [[Component]] for instance.\n * @param getSourceKey `function(source)` that must return a key to identify each source object. The result must either be a string or a number.\n * @param createResult `function(source, index)` that must create a new result object from a given source. This function is identical\n * to the `callback` argument in `Array.map(callback)`.\n * @param updateResult `function(source, target, index)` that updates a result to an updated source.\n */\n exports.createMapping = function (getSourceKey, createResult, updateResult) {\n var keys = [];\n var results = [];\n return {\n results: results,\n map: function (newSources) {\n var newKeys = newSources.map(getSourceKey);\n var oldTargets = results.slice();\n var oldIndex = 0;\n for (var i = 0; i < newSources.length; i++) {\n var source = newSources[i];\n var sourceKey = newKeys[i];\n if (sourceKey === keys[oldIndex]) {\n results[i] = oldTargets[oldIndex];\n updateResult(source, oldTargets[oldIndex], i);\n oldIndex++;\n } else {\n var found = false;\n for (var j = 1; j < keys.length + 1; j++) {\n var searchIndex = (oldIndex + j) % keys.length;\n if (keys[searchIndex] === sourceKey) {\n results[i] = oldTargets[searchIndex];\n updateResult(newSources[i], oldTargets[searchIndex], i);\n oldIndex = searchIndex + 1;\n found = true;\n break;\n }\n }\n if (!found) {\n results[i] = createResult(source, i);\n }\n }\n }\n results.length = newSources.length;\n keys = newKeys;\n }\n };\n };\n /**\n * Creates a [[Projector]] instance using the provided projectionOptions.\n *\n * For more information, see [[Projector]].\n *\n * @param projectorOptions Options that influence how the DOM is rendered and updated.\n */\n exports.createProjector = function (projectorOptions) {\n var projector;\n var projectionOptions = applyDefaultProjectionOptions(projectorOptions);\n projectionOptions.eventHandlerInterceptor = function (propertyName, eventHandler, domNode, properties) {\n return function () {\n // intercept function calls (event handlers) to do a render afterwards.\n projector.scheduleRender();\n return eventHandler.apply(properties.bind || this, arguments);\n };\n };\n var renderCompleted = true;\n var scheduled;\n var stopped = false;\n var projections = [];\n var renderFunctions = [];\n // matches the projections array\n var doRender = function () {\n scheduled = undefined;\n if (!renderCompleted) {\n return; // The last render threw an error, it should be logged in the browser console.\n }\n renderCompleted = false;\n for (var i = 0; i < projections.length; i++) {\n var updatedVnode = renderFunctions[i]();\n projections[i].update(updatedVnode);\n }\n renderCompleted = true;\n };\n projector = {\n renderNow: doRender,\n scheduleRender: function () {\n if (!scheduled && !stopped) {\n scheduled = requestAnimationFrame(doRender);\n }\n },\n stop: function () {\n if (scheduled) {\n cancelAnimationFrame(scheduled);\n scheduled = undefined;\n }\n stopped = true;\n },\n resume: function () {\n stopped = false;\n renderCompleted = true;\n projector.scheduleRender();\n },\n append: function (parentNode, renderMaquetteFunction) {\n projections.push(exports.dom.append(parentNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n insertBefore: function (beforeNode, renderMaquetteFunction) {\n projections.push(exports.dom.insertBefore(beforeNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n merge: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.merge(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n replace: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.replace(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n detach: function (renderMaquetteFunction) {\n for (var i = 0; i < renderFunctions.length; i++) {\n if (renderFunctions[i] === renderMaquetteFunction) {\n renderFunctions.splice(i, 1);\n return projections.splice(i, 1)[0];\n }\n }\n throw new Error('renderMaquetteFunction was not found');\n }\n };\n return projector;\n };\n}));",null]} diff --git a/src/maquette.ts b/src/maquette.ts index 7e5a2b8..8727b37 100644 --- a/src/maquette.ts +++ b/src/maquette.ts @@ -760,12 +760,6 @@ let initPropertiesAndChildren = function(domNode: Node, vnode: VNode, projection }; let insertNode = function (parentNode: Node, domNode: Node, vnode: VNode, beforeNode?: Node | null): void { - if (vnode.properties && vnode.properties.beforeAttach) { - vnode.properties.beforeAttach.apply(vnode.properties.bind || vnode.properties, [ - parentNode, - domNode as Element - ]); - } if (beforeNode) { parentNode.insertBefore(domNode, beforeNode); } else if (domNode.parentNode !== parentNode) { @@ -773,16 +767,21 @@ let insertNode = function (parentNode: Node, domNode: Node, vnode: VNode, before } }; +/** + * Identifies custom element tags as defined in custom elements v1 draft spec + * + * @see https://www.w3.org/TR/custom-elements/#custom-elements-core-concepts + */ +const customElementRegex = /^[a-z][^-]*-/; + createDom = function(vnode, parentNode, insertBefore, projectionOptions) { - let delayAttach: boolean = !!(vnode.properties && vnode.properties.delayAttach); let domNode: Node | undefined, i: number, c: string, start = 0, type: string, found: string; let vnodeSelector = vnode.vnodeSelector; + const delayAttach = customElementRegex.test(vnodeSelector); let doc = parentNode.ownerDocument; if (vnodeSelector === '') { domNode = vnode.domNode = doc.createTextNode(vnode.text!); - if (!delayAttach) { - insertNode(parentNode, domNode, vnode, insertBefore); - } + insertNode(parentNode, domNode, vnode, insertBefore); } else { for (i = 0; i <= vnodeSelector.length; ++i) { c = vnodeSelector.charAt(i); @@ -803,7 +802,7 @@ createDom = function(vnode, parentNode, insertBefore, projectionOptions) { domNode = vnode.domNode = (vnode.domNode || doc.createElement(found)); if (found === 'input' && vnode.properties && vnode.properties.type !== undefined) { // IE8 and older don't support setting input type after the DOM Node has been added to the document - (domNode as Element).setAttribute("type", vnode.properties.type); + (domNode as Element).setAttribute('type', vnode.properties.type); } } if (!delayAttach) { diff --git a/test/dom/create.ts b/test/dom/create.ts index 2284005..7ea8c97 100644 --- a/test/dom/create.ts +++ b/test/dom/create.ts @@ -82,5 +82,11 @@ describe('dom', function() { expect(spy.called).to.be.false; }); + it('should delay attaching custom elements until after attribute and properties have been added', () => { + let projection = dom.create(h('custom-element', { + 'data-attr': 'attribute' + })); + expect(projection.domNode.outerHTML).to.equal(''); + }); }); }); From 5f2863aee00304b089966e82c71ee1682a3dea60 Mon Sep 17 00:00:00 2001 From: Paul Shannon Date: Mon, 21 Aug 2017 17:53:37 -0700 Subject: [PATCH 4/5] removed unused declarations --- dist/maquette.d.ts | 9 --------- dist/maquette.js.map | 2 +- dist/maquette.min.js.map | 2 +- src/maquette.ts | 10 ---------- 4 files changed, 2 insertions(+), 21 deletions(-) diff --git a/dist/maquette.d.ts b/dist/maquette.d.ts index b1079f9..be6886c 100644 --- a/dist/maquette.d.ts +++ b/dist/maquette.d.ts @@ -231,14 +231,6 @@ export interface VNodeProperties { * @param children - The children for this node. */ afterUpdate?(element: Element, projectionOptions: ProjectionOptions, vnodeSelector: string, properties: VNodeProperties, children: VNode[]): void; - /** - * Callback that is executed after this node has been created, but before it is added to the DOM. Child nodes and - * properties have not yet been applied. - * @param element - The element that was added to the DOM. - * @param parentNode - The parent the element will be added to this node - * @param beforeNode - The node that the element will be inserted before - */ - beforeAttach?(element: Element, parentNode: Node, beforeNode?: Node): boolean; /** * When specified, the event handlers will be invoked with 'this' pointing to the value. * This is useful when using the prototype/class based implementation of Components. @@ -318,7 +310,6 @@ export interface VNodeProperties { * Note: if you use innerHTML, maquette cannot protect you from XSS vulnerabilities and you must make sure that the innerHTML value is safe. */ readonly innerHTML?: string; - readonly delayAttach?: boolean; /** * Everything that is not explicitly listed (properties and attributes that are either uncommon or custom). */ diff --git a/dist/maquette.js.map b/dist/maquette.js.map index a3f40b5..6736afb 100644 --- a/dist/maquette.js.map +++ b/dist/maquette.js.map @@ -1 +1 @@ -{"version":3,"sources":["maquette.js","../../../../src/maquette.ts"],"names":["Object","defineProperty","exports","value","NAMESPACE_W3","NAMESPACE_SVG","NAMESPACE_XLINK","emptyArray","extend","base","overrides","result","keys","forEach","key","same","vnode1","vnode2","vnodeSelector","properties","bind","toTextVNode","data","undefined","children","text","toString","domNode","appendChildren","parentSelector","insertions","main","i","length_1","length","item","Array","isArray","hasOwnProperty","push","missingTransition","Error","DEFAULT_PROJECTION_OPTIONS","namespace","eventHandlerInterceptor","styleApplyer","styleName","style","transitions","enter","exit","applyDefaultProjectionOptions","projectorOptions","checkStyleValue","styleValue","setProperties","projectionOptions","propNames","propCount","_loop_1","propName","propValue","split","token","classList","add","classNames","classNameCount","j","className","styleNames","styleCount","type","lastIndexOf","oldPropValue","evt","apply","target","setAttributeNS","setAttribute","updateProperties","previousProperties","propertiesUpdated","previousValue","on","previousOn","remove","newStyleValue","oldStyleValue","domValue","removeAttribute","findIndexOfChild","sameAs","start","nodeAdded","vNode","enterAnimation","nodeToRemove","exitAnimation","pointerEvents","removeDomNode","parentNode","removeChild","checkDistinguishable","childNodes","indexToCheck","parentVNode","operation","childNode","node","createDom","updateDom","updateChildren","vnode","oldChildren","newChildren","oldChildrenLength","newChildrenLength","oldIndex","newIndex","textUpdated","oldChild","newChild","findOldIndex","addChildren","initPropertiesAndChildren","textContent","afterCreate","insertNode","beforeNode","insertBefore","appendChild","customElementRegex","c","found","delayAttach","test","doc","ownerDocument","createTextNode","charAt","slice","id","createElementNS","createElement","previous","updated","newVNode","replaceChild","firstChild","afterUpdate","updateAnimation","createProjection","update","updatedVnode","h","selector","arguments","childIndex","argsLength","onlyChild","child","dom","create","document","append","merge","element","replace","createCache","cachedInputs","cachedOutcome","invalidate","inputs","calculation","createMapping","getSourceKey","createResult","updateResult","results","map","newSources","newKeys","oldTargets","source","sourceKey","searchIndex","createProjector","projector","propertyName","eventHandler","scheduleRender","renderCompleted","scheduled","stopped","projections","renderFunctions","doRender","renderNow","requestAnimationFrame","stop","cancelAnimationFrame","resume","renderMaquetteFunction","detach","splice"],"mappings":";;;;;;;;;;;;IAAA,a;IAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,MAAA,CAAOC,cAAP,CAAsBC,OAAtB,EAA+B,YAA/B,EAA6C,EAAEC,KAAA,EAAO,IAAT,EAA7C,E;IC6VA,IAAMC,YAAA,GAAe,oBAArB,C;IACA,IAAMC,aAAA,GAAgBD,YAAA,GAAe,UAArC,C;IACA,IAAME,eAAA,GAAkBF,YAAA,GAAe,YAAvC,C;IAIA;AAAA,QAAIG,UAAA,GAAsB,EAA1B,C;IAEA,IAAIC,MAAA,GAAS,UAAIC,IAAJ,EAAaC,SAAb,EAA2B;AAAA,QACtC,IAAIC,MAAA,GAAS,EAAb,CADsC;AAAA,QAEtCX,MAAA,CAAOY,IAAP,CAAYH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BpK,CAAhB,MAAuB2K,sBAA3B,EAAmD;AAAA,wBACjDP,eAAA,CAAgBS,MAAhB,CAAuB7K,CAAvB,EAA0B,CAA1B,EADiD;AAAA,wBAEjD,OAAOmK,WAAA,CAAYU,MAAZ,CAAmB7K,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CAAP,CAFiD;AAAA,qBADJ;AAAA,iBADZ;AAAA,gBAOrC,MAAM,IAAIS,KAAJ,CAAU,sCAAV,CAAN,CAPqC;AAAA,aAzC7B;AAAA,SAAZ,CA7BuE;AAAA,QAiFvE,OAAOmJ,SAAP,CAjFuE;AAAA,KAA9D,C","file":"maquette.js","sourcesContent":["\"use strict\";\n// Comment that is displayed in the API documentation for the maquette module:\n/**\n * Welcome to the API documentation of the **maquette** library.\n *\n * [[http://maquettejs.org/|To the maquette homepage]]\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar NAMESPACE_W3 = 'http://www.w3.org/';\nvar NAMESPACE_SVG = NAMESPACE_W3 + '2000/svg';\nvar NAMESPACE_XLINK = NAMESPACE_W3 + '1999/xlink';\n// Utilities\nvar emptyArray = [];\nvar extend = function (base, overrides) {\n var result = {};\n Object.keys(base).forEach(function (key) {\n result[key] = base[key];\n });\n if (overrides) {\n Object.keys(overrides).forEach(function (key) {\n result[key] = overrides[key];\n });\n }\n return result;\n};\n// Hyperscript helper functions\nvar same = function (vnode1, vnode2) {\n if (vnode1.vnodeSelector !== vnode2.vnodeSelector) {\n return false;\n }\n if (vnode1.properties && vnode2.properties) {\n if (vnode1.properties.key !== vnode2.properties.key) {\n return false;\n }\n return vnode1.properties.bind === vnode2.properties.bind;\n }\n return !vnode1.properties && !vnode2.properties;\n};\nvar toTextVNode = function (data) {\n return {\n vnodeSelector: '',\n properties: undefined,\n children: undefined,\n text: data.toString(),\n domNode: null\n };\n};\nvar appendChildren = function (parentSelector, insertions, main) {\n for (var i = 0, length_1 = insertions.length; i < length_1; i++) {\n var item = insertions[i];\n if (Array.isArray(item)) {\n appendChildren(parentSelector, item, main);\n }\n else {\n if (item !== null && item !== undefined) {\n if (!item.hasOwnProperty('vnodeSelector')) {\n item = toTextVNode(item);\n }\n main.push(item);\n }\n }\n }\n};\n// Render helper functions\nvar missingTransition = function () {\n throw new Error('Provide a transitions object to the projectionOptions to do animations');\n};\nvar DEFAULT_PROJECTION_OPTIONS = {\n namespace: undefined,\n eventHandlerInterceptor: undefined,\n styleApplyer: function (domNode, styleName, value) {\n // Provides a hook to add vendor prefixes for browsers that still need it.\n domNode.style[styleName] = value;\n },\n transitions: {\n enter: missingTransition,\n exit: missingTransition\n }\n};\nvar applyDefaultProjectionOptions = function (projectorOptions) {\n return extend(DEFAULT_PROJECTION_OPTIONS, projectorOptions);\n};\nvar checkStyleValue = function (styleValue) {\n if (typeof styleValue !== 'string') {\n throw new Error('Style values must be strings');\n }\n};\nvar setProperties = function (domNode, properties, projectionOptions) {\n if (!properties) {\n return;\n }\n var eventHandlerInterceptor = projectionOptions.eventHandlerInterceptor;\n var propNames = Object.keys(properties);\n var propCount = propNames.length;\n var _loop_1 = function (i) {\n var propName = propNames[i];\n /* tslint:disable:no-var-keyword: edge case */\n var propValue = properties[propName];\n /* tslint:enable:no-var-keyword */\n if (propName === 'className') {\n throw new Error('Property \"className\" is not supported, use \"class\".');\n }\n else if (propName === 'class') {\n propValue.split(/\\s+/).forEach(function (token) { return domNode.classList.add(token); });\n }\n else if (propName === 'classes') {\n // object with string keys and boolean values\n var classNames = Object.keys(propValue);\n var classNameCount = classNames.length;\n for (var j = 0; j < classNameCount; j++) {\n var className = classNames[j];\n if (propValue[className]) {\n domNode.classList.add(className);\n }\n }\n }\n else if (propName === 'styles') {\n // object with string keys and string (!) values\n var styleNames = Object.keys(propValue);\n var styleCount = styleNames.length;\n for (var j = 0; j < styleCount; j++) {\n var styleName = styleNames[j];\n var styleValue = propValue[styleName];\n if (styleValue) {\n checkStyleValue(styleValue);\n projectionOptions.styleApplyer(domNode, styleName, styleValue);\n }\n }\n }\n else if (propName !== 'key' && propValue !== null && propValue !== undefined) {\n var type = typeof propValue;\n if (type === 'function') {\n if (propName.lastIndexOf('on', 0) === 0) {\n if (eventHandlerInterceptor) {\n propValue = eventHandlerInterceptor(propName, propValue, domNode, properties); // intercept eventhandlers\n }\n if (propName === 'oninput') {\n (function () {\n // record the evt.target.value, because IE and Edge sometimes do a requestAnimationFrame between changing value and running oninput\n var oldPropValue = propValue;\n propValue = function (evt) {\n oldPropValue.apply(this, [evt]);\n evt.target['oninput-value'] = evt.target.value; // may be HTMLTextAreaElement as well\n };\n }());\n }\n domNode[propName] = propValue;\n }\n }\n else if (type === 'string' && propName !== 'value' && propName !== 'innerHTML') {\n if (projectionOptions.namespace === NAMESPACE_SVG && propName === 'href') {\n domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);\n }\n else {\n domNode.setAttribute(propName, propValue);\n }\n }\n else {\n domNode[propName] = propValue;\n }\n }\n };\n for (var i = 0; i < propCount; i++) {\n _loop_1(i);\n }\n};\nvar updateProperties = function (domNode, previousProperties, properties, projectionOptions) {\n if (!properties) {\n return;\n }\n var propertiesUpdated = false;\n var propNames = Object.keys(properties);\n var propCount = propNames.length;\n for (var i = 0; i < propCount; i++) {\n var propName = propNames[i];\n // assuming that properties will be nullified instead of missing is by design\n var propValue = properties[propName];\n var previousValue = previousProperties[propName];\n if (propName === 'class') {\n if (previousValue !== propValue) {\n throw new Error('\"class\" property may not be updated. Use the \"classes\" property for conditional css classes.');\n }\n }\n else if (propName === 'classes') {\n var classList = domNode.classList;\n var classNames = Object.keys(propValue);\n var classNameCount = classNames.length;\n for (var j = 0; j < classNameCount; j++) {\n var className = classNames[j];\n var on = !!propValue[className];\n var previousOn = !!previousValue[className];\n if (on === previousOn) {\n continue;\n }\n propertiesUpdated = true;\n if (on) {\n classList.add(className);\n }\n else {\n classList.remove(className);\n }\n }\n }\n else if (propName === 'styles') {\n var styleNames = Object.keys(propValue);\n var styleCount = styleNames.length;\n for (var j = 0; j < styleCount; j++) {\n var styleName = styleNames[j];\n var newStyleValue = propValue[styleName];\n var oldStyleValue = previousValue[styleName];\n if (newStyleValue === oldStyleValue) {\n continue;\n }\n propertiesUpdated = true;\n if (newStyleValue) {\n checkStyleValue(newStyleValue);\n projectionOptions.styleApplyer(domNode, styleName, newStyleValue);\n }\n else {\n projectionOptions.styleApplyer(domNode, styleName, '');\n }\n }\n }\n else {\n if (!propValue && typeof previousValue === 'string') {\n propValue = '';\n }\n if (propName === 'value') {\n var domValue = domNode[propName];\n if (domValue !== propValue // The 'value' in the DOM tree !== newValue\n && (domNode['oninput-value']\n ? domValue === domNode['oninput-value'] // If the last reported value to 'oninput' does not match domValue, do nothing and wait for oninput\n : propValue !== previousValue // Only update the value if the vdom changed\n )) {\n domNode[propName] = propValue; // Reset the value, even if the virtual DOM did not change\n domNode['oninput-value'] = undefined;\n } // else do not update the domNode, otherwise the cursor position would be changed\n if (propValue !== previousValue) {\n propertiesUpdated = true;\n }\n }\n else if (propValue !== previousValue) {\n var type = typeof propValue;\n if (type === 'function') {\n throw new Error('Functions may not be updated on subsequent renders (property: ' + propName +\n '). Hint: declare event handler functions outside the render() function.');\n }\n if (type === 'string' && propName !== 'innerHTML') {\n if (projectionOptions.namespace === NAMESPACE_SVG && propName === 'href') {\n domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);\n }\n else if (propName === 'role' && propValue === '') {\n domNode.removeAttribute(propName);\n }\n else {\n domNode.setAttribute(propName, propValue);\n }\n }\n else {\n if (domNode[propName] !== propValue) {\n domNode[propName] = propValue;\n }\n }\n propertiesUpdated = true;\n }\n }\n }\n return propertiesUpdated;\n};\nvar findIndexOfChild = function (children, sameAs, start) {\n if (sameAs.vnodeSelector !== '') {\n // Never scan for text-nodes\n for (var i = start; i < children.length; i++) {\n if (same(children[i], sameAs)) {\n return i;\n }\n }\n }\n return -1;\n};\nvar nodeAdded = function (vNode, transitions) {\n if (vNode.properties) {\n var enterAnimation = vNode.properties.enterAnimation;\n if (enterAnimation) {\n if (typeof enterAnimation === 'function') {\n enterAnimation(vNode.domNode, vNode.properties);\n }\n else {\n transitions.enter(vNode.domNode, vNode.properties, enterAnimation);\n }\n }\n }\n};\nvar nodeToRemove = function (vNode, transitions) {\n var domNode = vNode.domNode;\n if (vNode.properties) {\n var exitAnimation = vNode.properties.exitAnimation;\n if (exitAnimation) {\n domNode.style.pointerEvents = 'none';\n var removeDomNode = function () {\n if (domNode.parentNode) {\n domNode.parentNode.removeChild(domNode);\n }\n };\n if (typeof exitAnimation === 'function') {\n exitAnimation(domNode, removeDomNode, vNode.properties);\n return;\n }\n else {\n transitions.exit(vNode.domNode, vNode.properties, exitAnimation, removeDomNode);\n return;\n }\n }\n }\n if (domNode.parentNode) {\n domNode.parentNode.removeChild(domNode);\n }\n};\nvar checkDistinguishable = function (childNodes, indexToCheck, parentVNode, operation) {\n var childNode = childNodes[indexToCheck];\n if (childNode.vnodeSelector === '') {\n return; // Text nodes need not be distinguishable\n }\n var properties = childNode.properties;\n var key = properties ? (properties.key === undefined ? properties.bind : properties.key) : undefined;\n if (!key) {\n for (var i = 0; i < childNodes.length; i++) {\n if (i !== indexToCheck) {\n var node = childNodes[i];\n if (same(node, childNode)) {\n if (operation === 'added') {\n throw new Error(parentVNode.vnodeSelector + ' had a ' + childNode.vnodeSelector + ' child ' +\n 'added, but there is now more than one. You must add unique key properties to make them distinguishable.');\n }\n else {\n throw new Error(parentVNode.vnodeSelector + ' had a ' + childNode.vnodeSelector + ' child ' +\n 'removed, but there were more than one. You must add unique key properties to make them distinguishable.');\n }\n }\n }\n }\n }\n};\nvar createDom;\nvar updateDom;\nvar updateChildren = function (vnode, domNode, oldChildren, newChildren, projectionOptions) {\n if (oldChildren === newChildren) {\n return false;\n }\n oldChildren = oldChildren || emptyArray;\n newChildren = newChildren || emptyArray;\n var oldChildrenLength = oldChildren.length;\n var newChildrenLength = newChildren.length;\n var transitions = projectionOptions.transitions;\n var oldIndex = 0;\n var newIndex = 0;\n var i;\n var textUpdated = false;\n while (newIndex < newChildrenLength) {\n var oldChild = (oldIndex < oldChildrenLength) ? oldChildren[oldIndex] : undefined;\n var newChild = newChildren[newIndex];\n if (oldChild !== undefined && same(oldChild, newChild)) {\n textUpdated = updateDom(oldChild, newChild, projectionOptions) || textUpdated;\n oldIndex++;\n }\n else {\n var findOldIndex = findIndexOfChild(oldChildren, newChild, oldIndex + 1);\n if (findOldIndex >= 0) {\n // Remove preceding missing children\n for (i = oldIndex; i < findOldIndex; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n textUpdated = updateDom(oldChildren[findOldIndex], newChild, projectionOptions) || textUpdated;\n oldIndex = findOldIndex + 1;\n }\n else {\n // New child\n createDom(newChild, domNode, (oldIndex < oldChildrenLength) ? oldChildren[oldIndex].domNode : undefined, projectionOptions);\n nodeAdded(newChild, transitions);\n checkDistinguishable(newChildren, newIndex, vnode, 'added');\n }\n }\n newIndex++;\n }\n if (oldChildrenLength > oldIndex) {\n // Remove child fragments\n for (i = oldIndex; i < oldChildrenLength; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n }\n return textUpdated;\n};\nvar addChildren = function (domNode, children, projectionOptions) {\n if (!children) {\n return;\n }\n for (var i = 0; i < children.length; i++) {\n createDom(children[i], domNode, undefined, projectionOptions);\n }\n};\nvar initPropertiesAndChildren = function (domNode, vnode, projectionOptions) {\n addChildren(domNode, vnode.children, projectionOptions); // children before properties, needed for value property of .\n if (vnode.text) {\n domNode.textContent = vnode.text;\n }\n setProperties(domNode, vnode.properties, projectionOptions);\n if (vnode.properties && vnode.properties.afterCreate) {\n vnode.properties.afterCreate.apply(vnode.properties.bind || vnode.properties, [domNode, projectionOptions, vnode.vnodeSelector, vnode.properties, vnode.children]);\n }\n};\nvar insertNode = function (parentNode, domNode, vnode, beforeNode) {\n if (beforeNode) {\n parentNode.insertBefore(domNode, beforeNode);\n }\n else if (domNode.parentNode !== parentNode) {\n parentNode.appendChild(domNode);\n }\n};\n/**\n * Identifies custom element tags as defined in custom elements v1 draft spec\n *\n * @see https://www.w3.org/TR/custom-elements/#custom-elements-core-concepts\n */\nvar customElementRegex = /^[a-z][^-]*-/;\ncreateDom = function (vnode, parentNode, insertBefore, projectionOptions) {\n var domNode, i, c, start = 0, type, found;\n var vnodeSelector = vnode.vnodeSelector;\n var delayAttach = customElementRegex.test(vnodeSelector);\n var doc = parentNode.ownerDocument;\n if (vnodeSelector === '') {\n domNode = vnode.domNode = doc.createTextNode(vnode.text);\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n else {\n for (i = 0; i <= vnodeSelector.length; ++i) {\n c = vnodeSelector.charAt(i);\n if (i === vnodeSelector.length || c === '.' || c === '#') {\n type = vnodeSelector.charAt(start - 1);\n found = vnodeSelector.slice(start, i);\n if (type === '.') {\n domNode.classList.add(found);\n }\n else if (type === '#') {\n domNode.id = found;\n }\n else {\n if (found === 'svg') {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (projectionOptions.namespace !== undefined) {\n domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found);\n }\n else {\n domNode = vnode.domNode = (vnode.domNode || doc.createElement(found));\n if (found === 'input' && vnode.properties && vnode.properties.type !== undefined) {\n // IE8 and older don't support setting input type after the DOM Node has been added to the document\n domNode.setAttribute('type', vnode.properties.type);\n }\n }\n if (!delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n start = i + 1;\n }\n }\n initPropertiesAndChildren(domNode, vnode, projectionOptions);\n if (delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n};\nupdateDom = function (previous, vnode, projectionOptions) {\n var domNode = previous.domNode;\n var textUpdated = false;\n if (previous === vnode) {\n return false; // By contract, VNode objects may not be modified anymore after passing them to maquette\n }\n var updated = false;\n if (vnode.vnodeSelector === '') {\n if (vnode.text !== previous.text) {\n var newVNode = domNode.ownerDocument.createTextNode(vnode.text);\n domNode.parentNode.replaceChild(newVNode, domNode);\n vnode.domNode = newVNode;\n textUpdated = true;\n return textUpdated;\n }\n }\n else {\n if (vnode.vnodeSelector.lastIndexOf('svg', 0) === 0) {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (previous.text !== vnode.text) {\n updated = true;\n if (vnode.text === undefined) {\n domNode.removeChild(domNode.firstChild); // the only textnode presumably\n }\n else {\n domNode.textContent = vnode.text;\n }\n }\n updated = updateChildren(vnode, domNode, previous.children, vnode.children, projectionOptions) || updated;\n updated = updateProperties(domNode, previous.properties, vnode.properties, projectionOptions) || updated;\n if (vnode.properties && vnode.properties.afterUpdate) {\n vnode.properties.afterUpdate.apply(vnode.properties.bind || vnode.properties, [domNode, projectionOptions, vnode.vnodeSelector, vnode.properties, vnode.children]);\n }\n }\n if (updated && vnode.properties && vnode.properties.updateAnimation) {\n vnode.properties.updateAnimation(domNode, vnode.properties, previous.properties);\n }\n vnode.domNode = previous.domNode;\n return textUpdated;\n};\nvar createProjection = function (vnode, projectionOptions) {\n return {\n update: function (updatedVnode) {\n if (vnode.vnodeSelector !== updatedVnode.vnodeSelector) {\n throw new Error('The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)');\n }\n updateDom(vnode, updatedVnode, projectionOptions);\n vnode = updatedVnode;\n },\n domNode: vnode.domNode\n };\n};\n// The other two parameters are not added here, because the Typescript compiler creates surrogate code for destructuring 'children'.\nexports.h = function (selector) {\n var properties = arguments[1];\n if (typeof selector !== 'string') {\n throw new Error();\n }\n var childIndex = 1;\n if (properties && !properties.hasOwnProperty('vnodeSelector') && !Array.isArray(properties) && typeof properties === 'object') {\n childIndex = 2;\n }\n else {\n // Optional properties argument was omitted\n properties = undefined;\n }\n var text;\n var children;\n var argsLength = arguments.length;\n // Recognize a common special case where there is only a single text node\n if (argsLength === childIndex + 1) {\n var onlyChild = arguments[childIndex];\n if (typeof onlyChild === 'string') {\n text = onlyChild;\n }\n else if (onlyChild !== undefined && onlyChild !== null && onlyChild.length === 1 && typeof onlyChild[0] === 'string') {\n text = onlyChild[0];\n }\n }\n if (text === undefined) {\n children = [];\n for (; childIndex < argsLength; childIndex++) {\n var child = arguments[childIndex];\n if (child === null || child === undefined) {\n }\n else if (Array.isArray(child)) {\n appendChildren(selector, child, children);\n }\n else if (child.hasOwnProperty('vnodeSelector')) {\n children.push(child);\n }\n else {\n children.push(toTextVNode(child));\n }\n }\n }\n return {\n vnodeSelector: selector,\n properties: properties,\n children: children,\n text: (text === '') ? undefined : text,\n domNode: null\n };\n};\n/**\n * Contains simple low-level utility functions to manipulate the real DOM.\n */\nexports.dom = {\n /**\n * Creates a real DOM tree from `vnode`. The [[Projection]] object returned will contain the resulting DOM Node in\n * its [[Projection.domNode|domNode]] property.\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection.\n * @returns The [[Projection]] which also contains the DOM Node that was created.\n */\n create: function (vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, document.createElement('div'), undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Appends a new child node to the DOM which is generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param parentNode - The parent node for the new child node.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n append: function (parentNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, parentNode, undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Inserts a new DOM node which is generated from a [[VNode]].\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param beforeNode - The node that the DOM Node is inserted before.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function.\n * NOTE: [[VNode]] objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n insertBefore: function (beforeNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, beforeNode.parentNode, beforeNode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Merges a new DOM node which is generated from a [[VNode]] with an existing DOM Node.\n * This means that the virtual DOM and the real DOM will have one overlapping element.\n * Therefore the selector for the root [[VNode]] will be ignored, but its properties and children will be applied to the Element provided.\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param element - The existing element to adopt as the root of the new virtual DOM. Existing attributes and child nodes are preserved.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]] objects\n * may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n merge: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n vnode.domNode = element;\n initPropertiesAndChildren(element, vnode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Replaces an existing DOM node with a node generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param element - The node for the [[VNode]] to replace.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n replace: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, element.parentNode, element, projectionOptions);\n element.parentNode.removeChild(element);\n return createProjection(vnode, projectionOptions);\n }\n};\n/**\n * Creates a [[CalculationCache]] object, useful for caching [[VNode]] trees.\n * In practice, caching of [[VNode]] trees is not needed, because achieving 60 frames per second is almost never a problem.\n * For more information, see [[CalculationCache]].\n *\n * @param The type of the value that is cached.\n */\nexports.createCache = function () {\n var cachedInputs;\n var cachedOutcome;\n return {\n invalidate: function () {\n cachedOutcome = undefined;\n cachedInputs = undefined;\n },\n result: function (inputs, calculation) {\n if (cachedInputs) {\n for (var i = 0; i < inputs.length; i++) {\n if (cachedInputs[i] !== inputs[i]) {\n cachedOutcome = undefined;\n }\n }\n }\n if (!cachedOutcome) {\n cachedOutcome = calculation();\n cachedInputs = inputs;\n }\n return cachedOutcome;\n }\n };\n};\n/**\n * Creates a {@link Mapping} instance that keeps an array of result objects synchronized with an array of source objects.\n * See {@link http://maquettejs.org/docs/arrays.html|Working with arrays}.\n *\n * @param The type of source items. A database-record for instance.\n * @param The type of target items. A [[Component]] for instance.\n * @param getSourceKey `function(source)` that must return a key to identify each source object. The result must either be a string or a number.\n * @param createResult `function(source, index)` that must create a new result object from a given source. This function is identical\n * to the `callback` argument in `Array.map(callback)`.\n * @param updateResult `function(source, target, index)` that updates a result to an updated source.\n */\nexports.createMapping = function (getSourceKey, createResult, updateResult) {\n var keys = [];\n var results = [];\n return {\n results: results,\n map: function (newSources) {\n var newKeys = newSources.map(getSourceKey);\n var oldTargets = results.slice();\n var oldIndex = 0;\n for (var i = 0; i < newSources.length; i++) {\n var source = newSources[i];\n var sourceKey = newKeys[i];\n if (sourceKey === keys[oldIndex]) {\n results[i] = oldTargets[oldIndex];\n updateResult(source, oldTargets[oldIndex], i);\n oldIndex++;\n }\n else {\n var found = false;\n for (var j = 1; j < keys.length + 1; j++) {\n var searchIndex = (oldIndex + j) % keys.length;\n if (keys[searchIndex] === sourceKey) {\n results[i] = oldTargets[searchIndex];\n updateResult(newSources[i], oldTargets[searchIndex], i);\n oldIndex = searchIndex + 1;\n found = true;\n break;\n }\n }\n if (!found) {\n results[i] = createResult(source, i);\n }\n }\n }\n results.length = newSources.length;\n keys = newKeys;\n }\n };\n};\n/**\n * Creates a [[Projector]] instance using the provided projectionOptions.\n *\n * For more information, see [[Projector]].\n *\n * @param projectorOptions Options that influence how the DOM is rendered and updated.\n */\nexports.createProjector = function (projectorOptions) {\n var projector;\n var projectionOptions = applyDefaultProjectionOptions(projectorOptions);\n projectionOptions.eventHandlerInterceptor = function (propertyName, eventHandler, domNode, properties) {\n return function () {\n // intercept function calls (event handlers) to do a render afterwards.\n projector.scheduleRender();\n return eventHandler.apply(properties.bind || this, arguments);\n };\n };\n var renderCompleted = true;\n var scheduled;\n var stopped = false;\n var projections = [];\n var renderFunctions = []; // matches the projections array\n var doRender = function () {\n scheduled = undefined;\n if (!renderCompleted) {\n return; // The last render threw an error, it should be logged in the browser console.\n }\n renderCompleted = false;\n for (var i = 0; i < projections.length; i++) {\n var updatedVnode = renderFunctions[i]();\n projections[i].update(updatedVnode);\n }\n renderCompleted = true;\n };\n projector = {\n renderNow: doRender,\n scheduleRender: function () {\n if (!scheduled && !stopped) {\n scheduled = requestAnimationFrame(doRender);\n }\n },\n stop: function () {\n if (scheduled) {\n cancelAnimationFrame(scheduled);\n scheduled = undefined;\n }\n stopped = true;\n },\n resume: function () {\n stopped = false;\n renderCompleted = true;\n projector.scheduleRender();\n },\n append: function (parentNode, renderMaquetteFunction) {\n projections.push(exports.dom.append(parentNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n insertBefore: function (beforeNode, renderMaquetteFunction) {\n projections.push(exports.dom.insertBefore(beforeNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n merge: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.merge(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n replace: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.replace(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n detach: function (renderMaquetteFunction) {\n for (var i = 0; i < renderFunctions.length; i++) {\n if (renderFunctions[i] === renderMaquetteFunction) {\n renderFunctions.splice(i, 1);\n return projections.splice(i, 1)[0];\n }\n }\n throw new Error('renderMaquetteFunction was not found');\n }\n };\n return projector;\n};\n\n//# sourceMappingURL=maquette.js.map\n"]} \ No newline at end of file diff --git a/dist/maquette.min.js.map b/dist/maquette.min.js.map index 5ecd8cd..fb25273 100644 --- a/dist/maquette.min.js.map +++ b/dist/maquette.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["maquette.js","../../../../src/maquette.ts"],"names":["Object","defineProperty","exports","value","createDom","updateDom","NAMESPACE_SVG","NAMESPACE_W3","emptyArray","extend","base","overrides","result","keys","forEach","key","same","vnode1","vnode2","vnodeSelector","properties","bind","toTextVNode","data","undefined","children","text","toString","domNode","appendChildren","parentSelector","insertions","main","i","length_1","length","item","Array","isArray","hasOwnProperty","push","missingTransition","Error","DEFAULT_PROJECTION_OPTIONS","namespace","eventHandlerInterceptor","styleApplyer","styleName","style","transitions","enter","exit","applyDefaultProjectionOptions","projectorOptions","checkStyleValue","styleValue","setProperties","projectionOptions","propNames","propCount","propName","propValue","split","token","classList","add","classNames","classNameCount","j","className","styleNames","styleCount","type","lastIndexOf","oldPropValue","evt","apply","this","target","setAttributeNS","setAttribute","_loop_1","updateProperties","previousProperties","propertiesUpdated","previousValue","on","remove","newStyleValue","domValue","removeAttribute","findIndexOfChild","sameAs","start","nodeAdded","vNode","enterAnimation","nodeToRemove","exitAnimation","pointerEvents","removeDomNode","parentNode","removeChild","checkDistinguishable","childNodes","indexToCheck","parentVNode","operation","childNode","node","updateChildren","vnode","oldChildren","newChildren","oldChildrenLength","newChildrenLength","oldIndex","newIndex","textUpdated","oldChild","newChild","findOldIndex","addChildren","initPropertiesAndChildren","textContent","afterCreate","insertNode","beforeNode","insertBefore","appendChild","customElementRegex","c","found","delayAttach","test","doc","ownerDocument","createTextNode","charAt","slice","id","createElementNS","createElement","previous","updated","newVNode","replaceChild","firstChild","afterUpdate","updateAnimation","createProjection","update","updatedVnode","h","selector","arguments","childIndex","argsLength","onlyChild","child","dom","create","document","append","merge","element","replace","createCache","cachedInputs","cachedOutcome","invalidate","inputs","calculation","createMapping","getSourceKey","createResult","updateResult","results","map","newSources","newKeys","oldTargets","source","sourceKey","searchIndex","createProjector","projector","propertyName","eventHandler","scheduleRender","scheduled","renderCompleted","stopped","projections","renderFunctions","doRender","renderNow","requestAnimationFrame","stop","cancelAnimationFrame","resume","renderMaquetteFunction","detach","splice"],"mappings":"kLAAA,aAOAA,OAAOC,eAAeC,EAAS,cAAgBC,OAAO,IC6VtD,IA6UIC,EACAC,EA7UEC,EAAgBC,6BAKlBC,KAEAC,EAAS,SAAIC,EAASC,GACxB,IAAIC,KASJ,OARAZ,OAAOa,KAAKH,GAAMI,QAAQ,SAASC,GACjCH,EAAOG,GAAQL,EAAaK,KAE1BJ,GACFX,OAAOa,KAAKF,GAAWG,QAAQ,SAACC,GAC9BH,EAAOG,GAAOJ,EAAUI,KAGrBH,GAKLI,EAAO,SAACC,EAAeC,GACzB,OAAID,EAAOE,gBAAkBD,EAAOC,gBAGhCF,EAAOG,YAAcF,EAAOE,WAC1BH,EAAOG,WAAWL,MAAQG,EAAOE,WAAWL,KAGzCE,EAAOG,WAAWC,OAASH,EAAOE,WAAWC,MAE9CJ,EAAOG,aAAeF,EAAOE,aAGnCE,EAAc,SAACC,GACjB,OACEJ,cAAe,GACfC,gBAAYI,EACZC,cAAUD,EACVE,KAAMH,EAAKI,WACXC,QAAS,OAITC,EAAiB,SAASC,EAAwBC,EAAmBC,GACvE,IAAK,IAAIC,EAAI,EAAGC,EAASH,EAAWI,OAAQF,EAAIC,EAAQD,IAAK,CAC3D,IAAIG,EAAOL,EAAWE,GAClBI,MAAMC,QAAQF,GAChBP,EAAeC,EAAgBM,EAAMJ,GAExB,OAATI,QAA0BZ,IAATY,IACdA,EAAKG,eAAe,mBACvBH,EAAOd,EAAYc,IAErBJ,EAAKQ,KAAKJ,MAQdK,EAAoB,WACtB,MAAM,IAAIC,MAAM,2EAGZC,GACJC,eAAWpB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aAAc,SAASD,EAAY0E,GACjCR,EAAYzJ,KAAKtC,EAAA8J,IAAIhC,aAAaD,EAAY0E,IAA0BhJ,IACxEyI,EAAgB1J,KAAKiK,IAGvBrC,MAAO,SAASxI,EAAS6K,GACvBR,EAAYzJ,KAAKtC,EAAA8J,IAAII,MAAMxI,EAAS6K,IAA0BhJ,IAC9DyI,EAAgB1J,KAAKiK,IAGvBnC,QAAS,SAAS1I,EAAS6K,GACzBR,EAAYzJ,KAAKtC,EAAA8J,IAAIM,QAAQ1I,EAAS6K,IAA0BhJ,IAChEyI,EAAgB1J,KAAKiK,IAGvBC,OAAQ,SAASD,GACf,IAAK,IAAIxK,EAAI,EAAGA,EAAIiK,EAAgB/J,OAAQF,IAC1C,GAAIiK,EAAgBjK,KAAOwK,EAEzB,OADAP,EAAgBS,OAAO1K,EAAG,GACnBgK,EAAYU,OAAO1K,EAAG,GAAG,GAGpC,MAAM,IAAIS,MAAM","file":"maquette.min.js","sourcesContent":["(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define(['exports'], factory);\n } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {\n // CommonJS\n factory(exports);\n } else {\n // Browser globals\n factory(root.maquette = {});\n }\n}(this, function (exports) {\n 'use strict';\n // Comment that is displayed in the API documentation for the maquette module:\n /**\n * Welcome to the API documentation of the **maquette** library.\n *\n * [[http://maquettejs.org/|To the maquette homepage]]\n */\n Object.defineProperty(exports, '__esModule', { value: true });\n var NAMESPACE_W3 = 'http://www.w3.org/';\n var NAMESPACE_SVG = NAMESPACE_W3 + '2000/svg';\n var NAMESPACE_XLINK = NAMESPACE_W3 + '1999/xlink';\n // Utilities\n var emptyArray = [];\n var extend = function (base, overrides) {\n var result = {};\n Object.keys(base).forEach(function (key) {\n result[key] = base[key];\n });\n if (overrides) {\n Object.keys(overrides).forEach(function (key) {\n result[key] = overrides[key];\n });\n }\n return result;\n };\n // Hyperscript helper functions\n var same = function (vnode1, vnode2) {\n if (vnode1.vnodeSelector !== vnode2.vnodeSelector) {\n return false;\n }\n if (vnode1.properties && vnode2.properties) {\n if (vnode1.properties.key !== vnode2.properties.key) {\n return false;\n }\n return vnode1.properties.bind === vnode2.properties.bind;\n }\n return !vnode1.properties && !vnode2.properties;\n };\n var toTextVNode = function (data) {\n return {\n vnodeSelector: '',\n properties: undefined,\n children: undefined,\n text: data.toString(),\n domNode: null\n };\n };\n var appendChildren = function (parentSelector, insertions, main) {\n for (var i = 0, length_1 = insertions.length; i < length_1; i++) {\n var item = insertions[i];\n if (Array.isArray(item)) {\n appendChildren(parentSelector, item, main);\n } else {\n if (item !== null && item !== undefined) {\n if (!item.hasOwnProperty('vnodeSelector')) {\n item = toTextVNode(item);\n }\n main.push(item);\n }\n }\n }\n };\n // Render helper functions\n var missingTransition = function () {\n throw new Error('Provide a transitions object to the projectionOptions to do animations');\n };\n var DEFAULT_PROJECTION_OPTIONS = {\n namespace: undefined,\n eventHandlerInterceptor: undefined,\n styleApplyer: function (domNode, styleName, value) {\n // Provides a hook to add vendor prefixes for browsers that still need it.\n domNode.style[styleName] = value;\n },\n transitions: {\n enter: missingTransition,\n exit: missingTransition\n }\n };\n var applyDefaultProjectionOptions = function (projectorOptions) {\n return extend(DEFAULT_PROJECTION_OPTIONS, projectorOptions);\n };\n var checkStyleValue = function (styleValue) {\n if (typeof styleValue !== 'string') {\n throw new Error('Style values must be strings');\n }\n };\n var setProperties = function (domNode, properties, projectionOptions) {\n if (!properties) {\n return;\n }\n var eventHandlerInterceptor = projectionOptions.eventHandlerInterceptor;\n var propNames = Object.keys(properties);\n var propCount = propNames.length;\n var _loop_1 = function (i) {\n var propName = propNames[i];\n /* tslint:disable:no-var-keyword: edge case */\n var propValue = properties[propName];\n /* tslint:enable:no-var-keyword */\n if (propName === 'className') {\n throw new Error('Property \"className\" is not supported, use \"class\".');\n } else if (propName === 'class') {\n propValue.split(/\\s+/).forEach(function (token) {\n return domNode.classList.add(token);\n });\n } else if (propName === 'classes') {\n // object with string keys and boolean values\n var classNames = Object.keys(propValue);\n var classNameCount = classNames.length;\n for (var j = 0; j < classNameCount; j++) {\n var className = classNames[j];\n if (propValue[className]) {\n domNode.classList.add(className);\n }\n }\n } else if (propName === 'styles') {\n // object with string keys and string (!) values\n var styleNames = Object.keys(propValue);\n var styleCount = styleNames.length;\n for (var j = 0; j < styleCount; j++) {\n var styleName = styleNames[j];\n var styleValue = propValue[styleName];\n if (styleValue) {\n checkStyleValue(styleValue);\n projectionOptions.styleApplyer(domNode, styleName, styleValue);\n }\n }\n } else if (propName !== 'key' && propValue !== null && propValue !== undefined) {\n var type = typeof propValue;\n if (type === 'function') {\n if (propName.lastIndexOf('on', 0) === 0) {\n if (eventHandlerInterceptor) {\n propValue = eventHandlerInterceptor(propName, propValue, domNode, properties); // intercept eventhandlers\n }\n if (propName === 'oninput') {\n (function () {\n // record the evt.target.value, because IE and Edge sometimes do a requestAnimationFrame between changing value and running oninput\n var oldPropValue = propValue;\n propValue = function (evt) {\n oldPropValue.apply(this, [evt]);\n evt.target['oninput-value'] = evt.target.value; // may be HTMLTextAreaElement as well\n };\n }());\n }\n domNode[propName] = propValue;\n }\n } else if (type === 'string' && propName !== 'value' && propName !== 'innerHTML') {\n if (projectionOptions.namespace === NAMESPACE_SVG && propName === 'href') {\n domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);\n } else {\n domNode.setAttribute(propName, propValue);\n }\n } else {\n domNode[propName] = propValue;\n }\n }\n };\n for (var i = 0; i < propCount; i++) {\n _loop_1(i);\n }\n };\n var updateProperties = function (domNode, previousProperties, properties, projectionOptions) {\n if (!properties) {\n return;\n }\n var propertiesUpdated = false;\n var propNames = Object.keys(properties);\n var propCount = propNames.length;\n for (var i = 0; i < propCount; i++) {\n var propName = propNames[i];\n // assuming that properties will be nullified instead of missing is by design\n var propValue = properties[propName];\n var previousValue = previousProperties[propName];\n if (propName === 'class') {\n if (previousValue !== propValue) {\n throw new Error('\"class\" property may not be updated. Use the \"classes\" property for conditional css classes.');\n }\n } else if (propName === 'classes') {\n var classList = domNode.classList;\n var classNames = Object.keys(propValue);\n var classNameCount = classNames.length;\n for (var j = 0; j < classNameCount; j++) {\n var className = classNames[j];\n var on = !!propValue[className];\n var previousOn = !!previousValue[className];\n if (on === previousOn) {\n continue;\n }\n propertiesUpdated = true;\n if (on) {\n classList.add(className);\n } else {\n classList.remove(className);\n }\n }\n } else if (propName === 'styles') {\n var styleNames = Object.keys(propValue);\n var styleCount = styleNames.length;\n for (var j = 0; j < styleCount; j++) {\n var styleName = styleNames[j];\n var newStyleValue = propValue[styleName];\n var oldStyleValue = previousValue[styleName];\n if (newStyleValue === oldStyleValue) {\n continue;\n }\n propertiesUpdated = true;\n if (newStyleValue) {\n checkStyleValue(newStyleValue);\n projectionOptions.styleApplyer(domNode, styleName, newStyleValue);\n } else {\n projectionOptions.styleApplyer(domNode, styleName, '');\n }\n }\n } else {\n if (!propValue && typeof previousValue === 'string') {\n propValue = '';\n }\n if (propName === 'value') {\n var domValue = domNode[propName];\n if (domValue !== propValue // The 'value' in the DOM tree !== newValue\n&& (domNode['oninput-value'] ? domValue === domNode['oninput-value'] // If the last reported value to 'oninput' does not match domValue, do nothing and wait for oninput\n : propValue !== previousValue // Only update the value if the vdom changed\n)) {\n domNode[propName] = propValue;\n // Reset the value, even if the virtual DOM did not change\n domNode['oninput-value'] = undefined;\n }\n // else do not update the domNode, otherwise the cursor position would be changed\n if (propValue !== previousValue) {\n propertiesUpdated = true;\n }\n } else if (propValue !== previousValue) {\n var type = typeof propValue;\n if (type === 'function') {\n throw new Error('Functions may not be updated on subsequent renders (property: ' + propName + '). Hint: declare event handler functions outside the render() function.');\n }\n if (type === 'string' && propName !== 'innerHTML') {\n if (projectionOptions.namespace === NAMESPACE_SVG && propName === 'href') {\n domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);\n } else if (propName === 'role' && propValue === '') {\n domNode.removeAttribute(propName);\n } else {\n domNode.setAttribute(propName, propValue);\n }\n } else {\n if (domNode[propName] !== propValue) {\n domNode[propName] = propValue;\n }\n }\n propertiesUpdated = true;\n }\n }\n }\n return propertiesUpdated;\n };\n var findIndexOfChild = function (children, sameAs, start) {\n if (sameAs.vnodeSelector !== '') {\n // Never scan for text-nodes\n for (var i = start; i < children.length; i++) {\n if (same(children[i], sameAs)) {\n return i;\n }\n }\n }\n return -1;\n };\n var nodeAdded = function (vNode, transitions) {\n if (vNode.properties) {\n var enterAnimation = vNode.properties.enterAnimation;\n if (enterAnimation) {\n if (typeof enterAnimation === 'function') {\n enterAnimation(vNode.domNode, vNode.properties);\n } else {\n transitions.enter(vNode.domNode, vNode.properties, enterAnimation);\n }\n }\n }\n };\n var nodeToRemove = function (vNode, transitions) {\n var domNode = vNode.domNode;\n if (vNode.properties) {\n var exitAnimation = vNode.properties.exitAnimation;\n if (exitAnimation) {\n domNode.style.pointerEvents = 'none';\n var removeDomNode = function () {\n if (domNode.parentNode) {\n domNode.parentNode.removeChild(domNode);\n }\n };\n if (typeof exitAnimation === 'function') {\n exitAnimation(domNode, removeDomNode, vNode.properties);\n return;\n } else {\n transitions.exit(vNode.domNode, vNode.properties, exitAnimation, removeDomNode);\n return;\n }\n }\n }\n if (domNode.parentNode) {\n domNode.parentNode.removeChild(domNode);\n }\n };\n var checkDistinguishable = function (childNodes, indexToCheck, parentVNode, operation) {\n var childNode = childNodes[indexToCheck];\n if (childNode.vnodeSelector === '') {\n return; // Text nodes need not be distinguishable\n }\n var properties = childNode.properties;\n var key = properties ? properties.key === undefined ? properties.bind : properties.key : undefined;\n if (!key) {\n for (var i = 0; i < childNodes.length; i++) {\n if (i !== indexToCheck) {\n var node = childNodes[i];\n if (same(node, childNode)) {\n if (operation === 'added') {\n throw new Error(parentVNode.vnodeSelector + ' had a ' + childNode.vnodeSelector + ' child ' + 'added, but there is now more than one. You must add unique key properties to make them distinguishable.');\n } else {\n throw new Error(parentVNode.vnodeSelector + ' had a ' + childNode.vnodeSelector + ' child ' + 'removed, but there were more than one. You must add unique key properties to make them distinguishable.');\n }\n }\n }\n }\n }\n };\n var createDom;\n var updateDom;\n var updateChildren = function (vnode, domNode, oldChildren, newChildren, projectionOptions) {\n if (oldChildren === newChildren) {\n return false;\n }\n oldChildren = oldChildren || emptyArray;\n newChildren = newChildren || emptyArray;\n var oldChildrenLength = oldChildren.length;\n var newChildrenLength = newChildren.length;\n var transitions = projectionOptions.transitions;\n var oldIndex = 0;\n var newIndex = 0;\n var i;\n var textUpdated = false;\n while (newIndex < newChildrenLength) {\n var oldChild = oldIndex < oldChildrenLength ? oldChildren[oldIndex] : undefined;\n var newChild = newChildren[newIndex];\n if (oldChild !== undefined && same(oldChild, newChild)) {\n textUpdated = updateDom(oldChild, newChild, projectionOptions) || textUpdated;\n oldIndex++;\n } else {\n var findOldIndex = findIndexOfChild(oldChildren, newChild, oldIndex + 1);\n if (findOldIndex >= 0) {\n // Remove preceding missing children\n for (i = oldIndex; i < findOldIndex; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n textUpdated = updateDom(oldChildren[findOldIndex], newChild, projectionOptions) || textUpdated;\n oldIndex = findOldIndex + 1;\n } else {\n // New child\n createDom(newChild, domNode, oldIndex < oldChildrenLength ? oldChildren[oldIndex].domNode : undefined, projectionOptions);\n nodeAdded(newChild, transitions);\n checkDistinguishable(newChildren, newIndex, vnode, 'added');\n }\n }\n newIndex++;\n }\n if (oldChildrenLength > oldIndex) {\n // Remove child fragments\n for (i = oldIndex; i < oldChildrenLength; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n }\n return textUpdated;\n };\n var addChildren = function (domNode, children, projectionOptions) {\n if (!children) {\n return;\n }\n for (var i = 0; i < children.length; i++) {\n createDom(children[i], domNode, undefined, projectionOptions);\n }\n };\n var initPropertiesAndChildren = function (domNode, vnode, projectionOptions) {\n addChildren(domNode, vnode.children, projectionOptions);\n // children before properties, needed for value property of .\n if (vnode.text) {\n domNode.textContent = vnode.text;\n }\n setProperties(domNode, vnode.properties, projectionOptions);\n if (vnode.properties && vnode.properties.afterCreate) {\n vnode.properties.afterCreate.apply(vnode.properties.bind || vnode.properties, [\n domNode,\n projectionOptions,\n vnode.vnodeSelector,\n vnode.properties,\n vnode.children\n ]);\n }\n };\n var insertNode = function (parentNode, domNode, vnode, beforeNode) {\n if (beforeNode) {\n parentNode.insertBefore(domNode, beforeNode);\n } else if (domNode.parentNode !== parentNode) {\n parentNode.appendChild(domNode);\n }\n };\n /**\n * Identifies custom element tags as defined in custom elements v1 draft spec\n *\n * @see https://www.w3.org/TR/custom-elements/#custom-elements-core-concepts\n */\n var customElementRegex = /^[a-z][^-]*-/;\n createDom = function (vnode, parentNode, insertBefore, projectionOptions) {\n var domNode, i, c, start = 0, type, found;\n var vnodeSelector = vnode.vnodeSelector;\n var delayAttach = customElementRegex.test(vnodeSelector);\n var doc = parentNode.ownerDocument;\n if (vnodeSelector === '') {\n domNode = vnode.domNode = doc.createTextNode(vnode.text);\n insertNode(parentNode, domNode, vnode, insertBefore);\n } else {\n for (i = 0; i <= vnodeSelector.length; ++i) {\n c = vnodeSelector.charAt(i);\n if (i === vnodeSelector.length || c === '.' || c === '#') {\n type = vnodeSelector.charAt(start - 1);\n found = vnodeSelector.slice(start, i);\n if (type === '.') {\n domNode.classList.add(found);\n } else if (type === '#') {\n domNode.id = found;\n } else {\n if (found === 'svg') {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (projectionOptions.namespace !== undefined) {\n domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found);\n } else {\n domNode = vnode.domNode = vnode.domNode || doc.createElement(found);\n if (found === 'input' && vnode.properties && vnode.properties.type !== undefined) {\n // IE8 and older don't support setting input type after the DOM Node has been added to the document\n domNode.setAttribute('type', vnode.properties.type);\n }\n }\n if (!delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n start = i + 1;\n }\n }\n initPropertiesAndChildren(domNode, vnode, projectionOptions);\n if (delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n };\n updateDom = function (previous, vnode, projectionOptions) {\n var domNode = previous.domNode;\n var textUpdated = false;\n if (previous === vnode) {\n return false; // By contract, VNode objects may not be modified anymore after passing them to maquette\n }\n var updated = false;\n if (vnode.vnodeSelector === '') {\n if (vnode.text !== previous.text) {\n var newVNode = domNode.ownerDocument.createTextNode(vnode.text);\n domNode.parentNode.replaceChild(newVNode, domNode);\n vnode.domNode = newVNode;\n textUpdated = true;\n return textUpdated;\n }\n } else {\n if (vnode.vnodeSelector.lastIndexOf('svg', 0) === 0) {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (previous.text !== vnode.text) {\n updated = true;\n if (vnode.text === undefined) {\n domNode.removeChild(domNode.firstChild); // the only textnode presumably\n } else {\n domNode.textContent = vnode.text;\n }\n }\n updated = updateChildren(vnode, domNode, previous.children, vnode.children, projectionOptions) || updated;\n updated = updateProperties(domNode, previous.properties, vnode.properties, projectionOptions) || updated;\n if (vnode.properties && vnode.properties.afterUpdate) {\n vnode.properties.afterUpdate.apply(vnode.properties.bind || vnode.properties, [\n domNode,\n projectionOptions,\n vnode.vnodeSelector,\n vnode.properties,\n vnode.children\n ]);\n }\n }\n if (updated && vnode.properties && vnode.properties.updateAnimation) {\n vnode.properties.updateAnimation(domNode, vnode.properties, previous.properties);\n }\n vnode.domNode = previous.domNode;\n return textUpdated;\n };\n var createProjection = function (vnode, projectionOptions) {\n return {\n update: function (updatedVnode) {\n if (vnode.vnodeSelector !== updatedVnode.vnodeSelector) {\n throw new Error('The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)');\n }\n updateDom(vnode, updatedVnode, projectionOptions);\n vnode = updatedVnode;\n },\n domNode: vnode.domNode\n };\n };\n // The other two parameters are not added here, because the Typescript compiler creates surrogate code for destructuring 'children'.\n exports.h = function (selector) {\n var properties = arguments[1];\n if (typeof selector !== 'string') {\n throw new Error();\n }\n var childIndex = 1;\n if (properties && !properties.hasOwnProperty('vnodeSelector') && !Array.isArray(properties) && typeof properties === 'object') {\n childIndex = 2;\n } else {\n // Optional properties argument was omitted\n properties = undefined;\n }\n var text;\n var children;\n var argsLength = arguments.length;\n // Recognize a common special case where there is only a single text node\n if (argsLength === childIndex + 1) {\n var onlyChild = arguments[childIndex];\n if (typeof onlyChild === 'string') {\n text = onlyChild;\n } else if (onlyChild !== undefined && onlyChild !== null && onlyChild.length === 1 && typeof onlyChild[0] === 'string') {\n text = onlyChild[0];\n }\n }\n if (text === undefined) {\n children = [];\n for (; childIndex < argsLength; childIndex++) {\n var child = arguments[childIndex];\n if (child === null || child === undefined) {\n } else if (Array.isArray(child)) {\n appendChildren(selector, child, children);\n } else if (child.hasOwnProperty('vnodeSelector')) {\n children.push(child);\n } else {\n children.push(toTextVNode(child));\n }\n }\n }\n return {\n vnodeSelector: selector,\n properties: properties,\n children: children,\n text: text === '' ? undefined : text,\n domNode: null\n };\n };\n /**\n * Contains simple low-level utility functions to manipulate the real DOM.\n */\n exports.dom = {\n /**\n * Creates a real DOM tree from `vnode`. The [[Projection]] object returned will contain the resulting DOM Node in\n * its [[Projection.domNode|domNode]] property.\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection.\n * @returns The [[Projection]] which also contains the DOM Node that was created.\n */\n create: function (vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, document.createElement('div'), undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Appends a new child node to the DOM which is generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param parentNode - The parent node for the new child node.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n append: function (parentNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, parentNode, undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Inserts a new DOM node which is generated from a [[VNode]].\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param beforeNode - The node that the DOM Node is inserted before.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function.\n * NOTE: [[VNode]] objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n insertBefore: function (beforeNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, beforeNode.parentNode, beforeNode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Merges a new DOM node which is generated from a [[VNode]] with an existing DOM Node.\n * This means that the virtual DOM and the real DOM will have one overlapping element.\n * Therefore the selector for the root [[VNode]] will be ignored, but its properties and children will be applied to the Element provided.\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param element - The existing element to adopt as the root of the new virtual DOM. Existing attributes and child nodes are preserved.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]] objects\n * may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n merge: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n vnode.domNode = element;\n initPropertiesAndChildren(element, vnode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Replaces an existing DOM node with a node generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param element - The node for the [[VNode]] to replace.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n replace: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, element.parentNode, element, projectionOptions);\n element.parentNode.removeChild(element);\n return createProjection(vnode, projectionOptions);\n }\n };\n /**\n * Creates a [[CalculationCache]] object, useful for caching [[VNode]] trees.\n * In practice, caching of [[VNode]] trees is not needed, because achieving 60 frames per second is almost never a problem.\n * For more information, see [[CalculationCache]].\n *\n * @param The type of the value that is cached.\n */\n exports.createCache = function () {\n var cachedInputs;\n var cachedOutcome;\n return {\n invalidate: function () {\n cachedOutcome = undefined;\n cachedInputs = undefined;\n },\n result: function (inputs, calculation) {\n if (cachedInputs) {\n for (var i = 0; i < inputs.length; i++) {\n if (cachedInputs[i] !== inputs[i]) {\n cachedOutcome = undefined;\n }\n }\n }\n if (!cachedOutcome) {\n cachedOutcome = calculation();\n cachedInputs = inputs;\n }\n return cachedOutcome;\n }\n };\n };\n /**\n * Creates a {@link Mapping} instance that keeps an array of result objects synchronized with an array of source objects.\n * See {@link http://maquettejs.org/docs/arrays.html|Working with arrays}.\n *\n * @param The type of source items. A database-record for instance.\n * @param The type of target items. A [[Component]] for instance.\n * @param getSourceKey `function(source)` that must return a key to identify each source object. The result must either be a string or a number.\n * @param createResult `function(source, index)` that must create a new result object from a given source. This function is identical\n * to the `callback` argument in `Array.map(callback)`.\n * @param updateResult `function(source, target, index)` that updates a result to an updated source.\n */\n exports.createMapping = function (getSourceKey, createResult, updateResult) {\n var keys = [];\n var results = [];\n return {\n results: results,\n map: function (newSources) {\n var newKeys = newSources.map(getSourceKey);\n var oldTargets = results.slice();\n var oldIndex = 0;\n for (var i = 0; i < newSources.length; i++) {\n var source = newSources[i];\n var sourceKey = newKeys[i];\n if (sourceKey === keys[oldIndex]) {\n results[i] = oldTargets[oldIndex];\n updateResult(source, oldTargets[oldIndex], i);\n oldIndex++;\n } else {\n var found = false;\n for (var j = 1; j < keys.length + 1; j++) {\n var searchIndex = (oldIndex + j) % keys.length;\n if (keys[searchIndex] === sourceKey) {\n results[i] = oldTargets[searchIndex];\n updateResult(newSources[i], oldTargets[searchIndex], i);\n oldIndex = searchIndex + 1;\n found = true;\n break;\n }\n }\n if (!found) {\n results[i] = createResult(source, i);\n }\n }\n }\n results.length = newSources.length;\n keys = newKeys;\n }\n };\n };\n /**\n * Creates a [[Projector]] instance using the provided projectionOptions.\n *\n * For more information, see [[Projector]].\n *\n * @param projectorOptions Options that influence how the DOM is rendered and updated.\n */\n exports.createProjector = function (projectorOptions) {\n var projector;\n var projectionOptions = applyDefaultProjectionOptions(projectorOptions);\n projectionOptions.eventHandlerInterceptor = function (propertyName, eventHandler, domNode, properties) {\n return function () {\n // intercept function calls (event handlers) to do a render afterwards.\n projector.scheduleRender();\n return eventHandler.apply(properties.bind || this, arguments);\n };\n };\n var renderCompleted = true;\n var scheduled;\n var stopped = false;\n var projections = [];\n var renderFunctions = [];\n // matches the projections array\n var doRender = function () {\n scheduled = undefined;\n if (!renderCompleted) {\n return; // The last render threw an error, it should be logged in the browser console.\n }\n renderCompleted = false;\n for (var i = 0; i < projections.length; i++) {\n var updatedVnode = renderFunctions[i]();\n projections[i].update(updatedVnode);\n }\n renderCompleted = true;\n };\n projector = {\n renderNow: doRender,\n scheduleRender: function () {\n if (!scheduled && !stopped) {\n scheduled = requestAnimationFrame(doRender);\n }\n },\n stop: function () {\n if (scheduled) {\n cancelAnimationFrame(scheduled);\n scheduled = undefined;\n }\n stopped = true;\n },\n resume: function () {\n stopped = false;\n renderCompleted = true;\n projector.scheduleRender();\n },\n append: function (parentNode, renderMaquetteFunction) {\n projections.push(exports.dom.append(parentNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n insertBefore: function (beforeNode, renderMaquetteFunction) {\n projections.push(exports.dom.insertBefore(beforeNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n merge: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.merge(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n replace: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.replace(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n detach: function (renderMaquetteFunction) {\n for (var i = 0; i < renderFunctions.length; i++) {\n if (renderFunctions[i] === renderMaquetteFunction) {\n renderFunctions.splice(i, 1);\n return projections.splice(i, 1)[0];\n }\n }\n throw new Error('renderMaquetteFunction was not found');\n }\n };\n return projector;\n };\n}));",null]} \ No newline at end of file diff --git a/src/maquette.ts b/src/maquette.ts index 8727b37..501e3ad 100644 --- a/src/maquette.ts +++ b/src/maquette.ts @@ -240,14 +240,6 @@ export interface VNodeProperties { */ afterUpdate?(element: Element, projectionOptions: ProjectionOptions, vnodeSelector: string, properties: VNodeProperties, children: VNode[]): void; - /** - * Callback that is executed after this node has been created, but before it is added to the DOM. Child nodes and - * properties have not yet been applied. - * @param element - The element that was added to the DOM. - * @param parentNode - The parent the element will be added to this node - * @param beforeNode - The node that the element will be inserted before - */ - beforeAttach?(element: Element, parentNode: Node, beforeNode?: Node): boolean; /** * When specified, the event handlers will be invoked with 'this' pointing to the value. * This is useful when using the prototype/class based implementation of Components. @@ -331,8 +323,6 @@ export interface VNodeProperties { */ readonly innerHTML?: string; - readonly delayAttach?: boolean; - /** * Everything that is not explicitly listed (properties and attributes that are either uncommon or custom). */ From 9bea89abcd1216ad999c42f35d14bdc62415cb59 Mon Sep 17 00:00:00 2001 From: Paul Shannon Date: Sat, 26 Aug 2017 22:52:32 -0700 Subject: [PATCH 5/5] switched regular expression for an indexOf --- dist/maquette.js | 9 ++------- dist/maquette.js.map | 2 +- dist/maquette.min.js | 2 +- dist/maquette.min.js.map | 2 +- src/maquette.ts | 10 ++-------- 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/dist/maquette.js b/dist/maquette.js index afea27b..751ee5a 100644 --- a/dist/maquette.js +++ b/dist/maquette.js @@ -414,16 +414,10 @@ parentNode.appendChild(domNode); } }; - /** - * Identifies custom element tags as defined in custom elements v1 draft spec - * - * @see https://www.w3.org/TR/custom-elements/#custom-elements-core-concepts - */ - var customElementRegex = /^[a-z][^-]*-/; createDom = function (vnode, parentNode, insertBefore, projectionOptions) { var domNode, i, c, start = 0, type, found; var vnodeSelector = vnode.vnodeSelector; - var delayAttach = customElementRegex.test(vnodeSelector); + var delayAttach = false; var doc = parentNode.ownerDocument; if (vnodeSelector === '') { domNode = vnode.domNode = doc.createTextNode(vnode.text); @@ -446,6 +440,7 @@ domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found); } else { domNode = vnode.domNode = vnode.domNode || doc.createElement(found); + delayAttach = domNode.nodeName.indexOf('-') !== -1; if (found === 'input' && vnode.properties && vnode.properties.type !== undefined) { // IE8 and older don't support setting input type after the DOM Node has been added to the document domNode.setAttribute('type', vnode.properties.type); diff --git a/dist/maquette.js.map b/dist/maquette.js.map index 6736afb..5f9394a 100644 --- a/dist/maquette.js.map +++ b/dist/maquette.js.map @@ -1 +1 @@ -{"version":3,"sources":["maquette.js","../../../../src/maquette.ts"],"names":["Object","defineProperty","exports","value","NAMESPACE_W3","NAMESPACE_SVG","NAMESPACE_XLINK","emptyArray","extend","base","overrides","result","keys","forEach","key","same","vnode1","vnode2","vnodeSelector","properties","bind","toTextVNode","data","undefined","children","text","toString","domNode","appendChildren","parentSelector","insertions","main","i","length_1","length","item","Array","isArray","hasOwnProperty","push","missingTransition","Error","DEFAULT_PROJECTION_OPTIONS","namespace","eventHandlerInterceptor","styleApplyer","styleName","style","transitions","enter","exit","applyDefaultProjectionOptions","projectorOptions","checkStyleValue","styleValue","setProperties","projectionOptions","propNames","propCount","_loop_1","propName","propValue","split","token","classList","add","classNames","classNameCount","j","className","styleNames","styleCount","type","lastIndexOf","oldPropValue","evt","apply","target","setAttributeNS","setAttribute","updateProperties","previousProperties","propertiesUpdated","previousValue","on","previousOn","remove","newStyleValue","oldStyleValue","domValue","removeAttribute","findIndexOfChild","sameAs","start","nodeAdded","vNode","enterAnimation","nodeToRemove","exitAnimation","pointerEvents","removeDomNode","parentNode","removeChild","checkDistinguishable","childNodes","indexToCheck","parentVNode","operation","childNode","node","createDom","updateDom","updateChildren","vnode","oldChildren","newChildren","oldChildrenLength","newChildrenLength","oldIndex","newIndex","textUpdated","oldChild","newChild","findOldIndex","addChildren","initPropertiesAndChildren","textContent","afterCreate","insertNode","beforeNode","insertBefore","appendChild","customElementRegex","c","found","delayAttach","test","doc","ownerDocument","createTextNode","charAt","slice","id","createElementNS","createElement","previous","updated","newVNode","replaceChild","firstChild","afterUpdate","updateAnimation","createProjection","update","updatedVnode","h","selector","arguments","childIndex","argsLength","onlyChild","child","dom","create","document","append","merge","element","replace","createCache","cachedInputs","cachedOutcome","invalidate","inputs","calculation","createMapping","getSourceKey","createResult","updateResult","results","map","newSources","newKeys","oldTargets","source","sourceKey","searchIndex","createProjector","projector","propertyName","eventHandler","scheduleRender","renderCompleted","scheduled","stopped","projections","renderFunctions","doRender","renderNow","requestAnimationFrame","stop","cancelAnimationFrame","resume","renderMaquetteFunction","detach","splice"],"mappings":";;;;;;;;;;;;IAAA,a;IAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,MAAA,CAAOC,cAAP,CAAsBC,OAAtB,EAA+B,YAA/B,EAA6C,EAAEC,KAAA,EAAO,IAAT,EAA7C,E;ICmVA,IAAMC,YAAA,GAAe,oBAArB,C;IACA,IAAMC,aAAA,GAAgBD,YAAA,GAAe,UAArC,C;IACA,IAAME,eAAA,GAAkBF,YAAA,GAAe,YAAvC,C;IAIA;AAAA,QAAIG,UAAA,GAAsB,EAA1B,C;IAEA,IAAIC,MAAA,GAAS,UAAIC,IAAJ,EAAaC,SAAb,EAA2B;AAAA,QACtC,IAAIC,MAAA,GAAS,EAAb,CADsC;AAAA,QAEtCX,MAAA,CAAOY,IAAP,CAAYH,IAAZ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AAhB,MAAuB2K,sBAA3B,EAAmD;AAAA,wBACjDP,eAAA,CAAgBS,MAAhB,CAAuB7K,CAAvB,EAA0B,CAA1B,EADiD;AAAA,wBAEjD,OAAOmK,WAAA,CAAYU,MAAZ,CAAmB7K,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CAAP,CAFiD;AAAA,qBADJ;AAAA,iBADZ;AAAA,gBAOrC,MAAM,IAAIS,KAAJ,CAAU,sCAAV,CAAN,CAPqC;AAAA,aAzC7B;AAAA,SAAZ,CA7BuE;AAAA,QAiFvE,OAAOmJ,SAAP,CAjFuE;AAAA,KAA9D,C","file":"maquette.js","sourcesContent":["\"use strict\";\n// Comment that is displayed in the API documentation for the maquette module:\n/**\n * Welcome to the API documentation of the **maquette** library.\n *\n * [[http://maquettejs.org/|To the maquette homepage]]\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar NAMESPACE_W3 = 'http://www.w3.org/';\nvar NAMESPACE_SVG = NAMESPACE_W3 + '2000/svg';\nvar NAMESPACE_XLINK = NAMESPACE_W3 + '1999/xlink';\n// Utilities\nvar emptyArray = [];\nvar extend = function (base, overrides) {\n var result = {};\n Object.keys(base).forEach(function (key) {\n result[key] = base[key];\n });\n if (overrides) {\n Object.keys(overrides).forEach(function (key) {\n result[key] = overrides[key];\n });\n }\n return result;\n};\n// Hyperscript helper functions\nvar same = function (vnode1, vnode2) {\n if (vnode1.vnodeSelector !== vnode2.vnodeSelector) {\n return false;\n }\n if (vnode1.properties && vnode2.properties) {\n if (vnode1.properties.key !== vnode2.properties.key) {\n return false;\n }\n return vnode1.properties.bind === vnode2.properties.bind;\n }\n return !vnode1.properties && !vnode2.properties;\n};\nvar toTextVNode = function (data) {\n return {\n vnodeSelector: '',\n properties: undefined,\n children: undefined,\n text: data.toString(),\n domNode: null\n };\n};\nvar appendChildren = function (parentSelector, insertions, main) {\n for (var i = 0, length_1 = insertions.length; i < length_1; i++) {\n var item = insertions[i];\n if (Array.isArray(item)) {\n appendChildren(parentSelector, item, main);\n }\n else {\n if (item !== null && item !== undefined) {\n if (!item.hasOwnProperty('vnodeSelector')) {\n item = toTextVNode(item);\n }\n main.push(item);\n }\n }\n }\n};\n// Render helper functions\nvar missingTransition = function () {\n throw new Error('Provide a transitions object to the projectionOptions to do animations');\n};\nvar DEFAULT_PROJECTION_OPTIONS = {\n namespace: undefined,\n eventHandlerInterceptor: undefined,\n styleApplyer: function (domNode, styleName, value) {\n // Provides a hook to add vendor prefixes for browsers that still need it.\n domNode.style[styleName] = value;\n },\n transitions: {\n enter: missingTransition,\n exit: missingTransition\n }\n};\nvar applyDefaultProjectionOptions = function (projectorOptions) {\n return extend(DEFAULT_PROJECTION_OPTIONS, projectorOptions);\n};\nvar checkStyleValue = function (styleValue) {\n if (typeof styleValue !== 'string') {\n throw new Error('Style values must be strings');\n }\n};\nvar setProperties = function (domNode, properties, projectionOptions) {\n if (!properties) {\n return;\n }\n var eventHandlerInterceptor = projectionOptions.eventHandlerInterceptor;\n var propNames = Object.keys(properties);\n var propCount = propNames.length;\n var _loop_1 = function (i) {\n var propName = propNames[i];\n /* tslint:disable:no-var-keyword: edge case */\n var propValue = properties[propName];\n /* tslint:enable:no-var-keyword */\n if (propName === 'className') {\n throw new Error('Property \"className\" is not supported, use \"class\".');\n }\n else if (propName === 'class') {\n propValue.split(/\\s+/).forEach(function (token) { return domNode.classList.add(token); });\n }\n else if (propName === 'classes') {\n // object with string keys and boolean values\n var classNames = Object.keys(propValue);\n var classNameCount = classNames.length;\n for (var j = 0; j < classNameCount; j++) {\n var className = classNames[j];\n if (propValue[className]) {\n domNode.classList.add(className);\n }\n }\n }\n else if (propName === 'styles') {\n // object with string keys and string (!) values\n var styleNames = Object.keys(propValue);\n var styleCount = styleNames.length;\n for (var j = 0; j < styleCount; j++) {\n var styleName = styleNames[j];\n var styleValue = propValue[styleName];\n if (styleValue) {\n checkStyleValue(styleValue);\n projectionOptions.styleApplyer(domNode, styleName, styleValue);\n }\n }\n }\n else if (propName !== 'key' && propValue !== null && propValue !== undefined) {\n var type = typeof propValue;\n if (type === 'function') {\n if (propName.lastIndexOf('on', 0) === 0) {\n if (eventHandlerInterceptor) {\n propValue = eventHandlerInterceptor(propName, propValue, domNode, properties); // intercept eventhandlers\n }\n if (propName === 'oninput') {\n (function () {\n // record the evt.target.value, because IE and Edge sometimes do a requestAnimationFrame between changing value and running oninput\n var oldPropValue = propValue;\n propValue = function (evt) {\n oldPropValue.apply(this, [evt]);\n evt.target['oninput-value'] = evt.target.value; // may be HTMLTextAreaElement as well\n };\n }());\n }\n domNode[propName] = propValue;\n }\n }\n else if (type === 'string' && propName !== 'value' && propName !== 'innerHTML') {\n if (projectionOptions.namespace === NAMESPACE_SVG && propName === 'href') {\n domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);\n }\n else {\n domNode.setAttribute(propName, propValue);\n }\n }\n else {\n domNode[propName] = propValue;\n }\n }\n };\n for (var i = 0; i < propCount; i++) {\n _loop_1(i);\n }\n};\nvar updateProperties = function (domNode, previousProperties, properties, projectionOptions) {\n if (!properties) {\n return;\n }\n var propertiesUpdated = false;\n var propNames = Object.keys(properties);\n var propCount = propNames.length;\n for (var i = 0; i < propCount; i++) {\n var propName = propNames[i];\n // assuming that properties will be nullified instead of missing is by design\n var propValue = properties[propName];\n var previousValue = previousProperties[propName];\n if (propName === 'class') {\n if (previousValue !== propValue) {\n throw new Error('\"class\" property may not be updated. Use the \"classes\" property for conditional css classes.');\n }\n }\n else if (propName === 'classes') {\n var classList = domNode.classList;\n var classNames = Object.keys(propValue);\n var classNameCount = classNames.length;\n for (var j = 0; j < classNameCount; j++) {\n var className = classNames[j];\n var on = !!propValue[className];\n var previousOn = !!previousValue[className];\n if (on === previousOn) {\n continue;\n }\n propertiesUpdated = true;\n if (on) {\n classList.add(className);\n }\n else {\n classList.remove(className);\n }\n }\n }\n else if (propName === 'styles') {\n var styleNames = Object.keys(propValue);\n var styleCount = styleNames.length;\n for (var j = 0; j < styleCount; j++) {\n var styleName = styleNames[j];\n var newStyleValue = propValue[styleName];\n var oldStyleValue = previousValue[styleName];\n if (newStyleValue === oldStyleValue) {\n continue;\n }\n propertiesUpdated = true;\n if (newStyleValue) {\n checkStyleValue(newStyleValue);\n projectionOptions.styleApplyer(domNode, styleName, newStyleValue);\n }\n else {\n projectionOptions.styleApplyer(domNode, styleName, '');\n }\n }\n }\n else {\n if (!propValue && typeof previousValue === 'string') {\n propValue = '';\n }\n if (propName === 'value') {\n var domValue = domNode[propName];\n if (domValue !== propValue // The 'value' in the DOM tree !== newValue\n && (domNode['oninput-value']\n ? domValue === domNode['oninput-value'] // If the last reported value to 'oninput' does not match domValue, do nothing and wait for oninput\n : propValue !== previousValue // Only update the value if the vdom changed\n )) {\n domNode[propName] = propValue; // Reset the value, even if the virtual DOM did not change\n domNode['oninput-value'] = undefined;\n } // else do not update the domNode, otherwise the cursor position would be changed\n if (propValue !== previousValue) {\n propertiesUpdated = true;\n }\n }\n else if (propValue !== previousValue) {\n var type = typeof propValue;\n if (type === 'function') {\n throw new Error('Functions may not be updated on subsequent renders (property: ' + propName +\n '). Hint: declare event handler functions outside the render() function.');\n }\n if (type === 'string' && propName !== 'innerHTML') {\n if (projectionOptions.namespace === NAMESPACE_SVG && propName === 'href') {\n domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);\n }\n else if (propName === 'role' && propValue === '') {\n domNode.removeAttribute(propName);\n }\n else {\n domNode.setAttribute(propName, propValue);\n }\n }\n else {\n if (domNode[propName] !== propValue) {\n domNode[propName] = propValue;\n }\n }\n propertiesUpdated = true;\n }\n }\n }\n return propertiesUpdated;\n};\nvar findIndexOfChild = function (children, sameAs, start) {\n if (sameAs.vnodeSelector !== '') {\n // Never scan for text-nodes\n for (var i = start; i < children.length; i++) {\n if (same(children[i], sameAs)) {\n return i;\n }\n }\n }\n return -1;\n};\nvar nodeAdded = function (vNode, transitions) {\n if (vNode.properties) {\n var enterAnimation = vNode.properties.enterAnimation;\n if (enterAnimation) {\n if (typeof enterAnimation === 'function') {\n enterAnimation(vNode.domNode, vNode.properties);\n }\n else {\n transitions.enter(vNode.domNode, vNode.properties, enterAnimation);\n }\n }\n }\n};\nvar nodeToRemove = function (vNode, transitions) {\n var domNode = vNode.domNode;\n if (vNode.properties) {\n var exitAnimation = vNode.properties.exitAnimation;\n if (exitAnimation) {\n domNode.style.pointerEvents = 'none';\n var removeDomNode = function () {\n if (domNode.parentNode) {\n domNode.parentNode.removeChild(domNode);\n }\n };\n if (typeof exitAnimation === 'function') {\n exitAnimation(domNode, removeDomNode, vNode.properties);\n return;\n }\n else {\n transitions.exit(vNode.domNode, vNode.properties, exitAnimation, removeDomNode);\n return;\n }\n }\n }\n if (domNode.parentNode) {\n domNode.parentNode.removeChild(domNode);\n }\n};\nvar checkDistinguishable = function (childNodes, indexToCheck, parentVNode, operation) {\n var childNode = childNodes[indexToCheck];\n if (childNode.vnodeSelector === '') {\n return; // Text nodes need not be distinguishable\n }\n var properties = childNode.properties;\n var key = properties ? (properties.key === undefined ? properties.bind : properties.key) : undefined;\n if (!key) {\n for (var i = 0; i < childNodes.length; i++) {\n if (i !== indexToCheck) {\n var node = childNodes[i];\n if (same(node, childNode)) {\n if (operation === 'added') {\n throw new Error(parentVNode.vnodeSelector + ' had a ' + childNode.vnodeSelector + ' child ' +\n 'added, but there is now more than one. You must add unique key properties to make them distinguishable.');\n }\n else {\n throw new Error(parentVNode.vnodeSelector + ' had a ' + childNode.vnodeSelector + ' child ' +\n 'removed, but there were more than one. You must add unique key properties to make them distinguishable.');\n }\n }\n }\n }\n }\n};\nvar createDom;\nvar updateDom;\nvar updateChildren = function (vnode, domNode, oldChildren, newChildren, projectionOptions) {\n if (oldChildren === newChildren) {\n return false;\n }\n oldChildren = oldChildren || emptyArray;\n newChildren = newChildren || emptyArray;\n var oldChildrenLength = oldChildren.length;\n var newChildrenLength = newChildren.length;\n var transitions = projectionOptions.transitions;\n var oldIndex = 0;\n var newIndex = 0;\n var i;\n var textUpdated = false;\n while (newIndex < newChildrenLength) {\n var oldChild = (oldIndex < oldChildrenLength) ? oldChildren[oldIndex] : undefined;\n var newChild = newChildren[newIndex];\n if (oldChild !== undefined && same(oldChild, newChild)) {\n textUpdated = updateDom(oldChild, newChild, projectionOptions) || textUpdated;\n oldIndex++;\n }\n else {\n var findOldIndex = findIndexOfChild(oldChildren, newChild, oldIndex + 1);\n if (findOldIndex >= 0) {\n // Remove preceding missing children\n for (i = oldIndex; i < findOldIndex; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n textUpdated = updateDom(oldChildren[findOldIndex], newChild, projectionOptions) || textUpdated;\n oldIndex = findOldIndex + 1;\n }\n else {\n // New child\n createDom(newChild, domNode, (oldIndex < oldChildrenLength) ? oldChildren[oldIndex].domNode : undefined, projectionOptions);\n nodeAdded(newChild, transitions);\n checkDistinguishable(newChildren, newIndex, vnode, 'added');\n }\n }\n newIndex++;\n }\n if (oldChildrenLength > oldIndex) {\n // Remove child fragments\n for (i = oldIndex; i < oldChildrenLength; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n }\n return textUpdated;\n};\nvar addChildren = function (domNode, children, projectionOptions) {\n if (!children) {\n return;\n }\n for (var i = 0; i < children.length; i++) {\n createDom(children[i], domNode, undefined, projectionOptions);\n }\n};\nvar initPropertiesAndChildren = function (domNode, vnode, projectionOptions) {\n addChildren(domNode, vnode.children, projectionOptions); // children before properties, needed for value property of .\n if (vnode.text) {\n domNode.textContent = vnode.text;\n }\n setProperties(domNode, vnode.properties, projectionOptions);\n if (vnode.properties && vnode.properties.afterCreate) {\n vnode.properties.afterCreate.apply(vnode.properties.bind || vnode.properties, [domNode, projectionOptions, vnode.vnodeSelector, vnode.properties, vnode.children]);\n }\n};\nvar insertNode = function (parentNode, domNode, vnode, beforeNode) {\n if (beforeNode) {\n parentNode.insertBefore(domNode, beforeNode);\n }\n else if (domNode.parentNode !== parentNode) {\n parentNode.appendChild(domNode);\n }\n};\ncreateDom = function (vnode, parentNode, insertBefore, projectionOptions) {\n var domNode, i, c, start = 0, type, found;\n var vnodeSelector = vnode.vnodeSelector;\n var delayAttach = false;\n var doc = parentNode.ownerDocument;\n if (vnodeSelector === '') {\n domNode = vnode.domNode = doc.createTextNode(vnode.text);\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n else {\n for (i = 0; i <= vnodeSelector.length; ++i) {\n c = vnodeSelector.charAt(i);\n if (i === vnodeSelector.length || c === '.' || c === '#') {\n type = vnodeSelector.charAt(start - 1);\n found = vnodeSelector.slice(start, i);\n if (type === '.') {\n domNode.classList.add(found);\n }\n else if (type === '#') {\n domNode.id = found;\n }\n else {\n if (found === 'svg') {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (projectionOptions.namespace !== undefined) {\n domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found);\n }\n else {\n domNode = vnode.domNode = (vnode.domNode || doc.createElement(found));\n delayAttach = domNode.nodeName.indexOf('-') !== -1;\n if (found === 'input' && vnode.properties && vnode.properties.type !== undefined) {\n // IE8 and older don't support setting input type after the DOM Node has been added to the document\n domNode.setAttribute('type', vnode.properties.type);\n }\n }\n if (!delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n start = i + 1;\n }\n }\n initPropertiesAndChildren(domNode, vnode, projectionOptions);\n if (delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n};\nupdateDom = function (previous, vnode, projectionOptions) {\n var domNode = previous.domNode;\n var textUpdated = false;\n if (previous === vnode) {\n return false; // By contract, VNode objects may not be modified anymore after passing them to maquette\n }\n var updated = false;\n if (vnode.vnodeSelector === '') {\n if (vnode.text !== previous.text) {\n var newVNode = domNode.ownerDocument.createTextNode(vnode.text);\n domNode.parentNode.replaceChild(newVNode, domNode);\n vnode.domNode = newVNode;\n textUpdated = true;\n return textUpdated;\n }\n }\n else {\n if (vnode.vnodeSelector.lastIndexOf('svg', 0) === 0) {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (previous.text !== vnode.text) {\n updated = true;\n if (vnode.text === undefined) {\n domNode.removeChild(domNode.firstChild); // the only textnode presumably\n }\n else {\n domNode.textContent = vnode.text;\n }\n }\n updated = updateChildren(vnode, domNode, previous.children, vnode.children, projectionOptions) || updated;\n updated = updateProperties(domNode, previous.properties, vnode.properties, projectionOptions) || updated;\n if (vnode.properties && vnode.properties.afterUpdate) {\n vnode.properties.afterUpdate.apply(vnode.properties.bind || vnode.properties, [domNode, projectionOptions, vnode.vnodeSelector, vnode.properties, vnode.children]);\n }\n }\n if (updated && vnode.properties && vnode.properties.updateAnimation) {\n vnode.properties.updateAnimation(domNode, vnode.properties, previous.properties);\n }\n vnode.domNode = previous.domNode;\n return textUpdated;\n};\nvar createProjection = function (vnode, projectionOptions) {\n return {\n update: function (updatedVnode) {\n if (vnode.vnodeSelector !== updatedVnode.vnodeSelector) {\n throw new Error('The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)');\n }\n updateDom(vnode, updatedVnode, projectionOptions);\n vnode = updatedVnode;\n },\n domNode: vnode.domNode\n };\n};\n// The other two parameters are not added here, because the Typescript compiler creates surrogate code for destructuring 'children'.\nexports.h = function (selector) {\n var properties = arguments[1];\n if (typeof selector !== 'string') {\n throw new Error();\n }\n var childIndex = 1;\n if (properties && !properties.hasOwnProperty('vnodeSelector') && !Array.isArray(properties) && typeof properties === 'object') {\n childIndex = 2;\n }\n else {\n // Optional properties argument was omitted\n properties = undefined;\n }\n var text;\n var children;\n var argsLength = arguments.length;\n // Recognize a common special case where there is only a single text node\n if (argsLength === childIndex + 1) {\n var onlyChild = arguments[childIndex];\n if (typeof onlyChild === 'string') {\n text = onlyChild;\n }\n else if (onlyChild !== undefined && onlyChild !== null && onlyChild.length === 1 && typeof onlyChild[0] === 'string') {\n text = onlyChild[0];\n }\n }\n if (text === undefined) {\n children = [];\n for (; childIndex < argsLength; childIndex++) {\n var child = arguments[childIndex];\n if (child === null || child === undefined) {\n }\n else if (Array.isArray(child)) {\n appendChildren(selector, child, children);\n }\n else if (child.hasOwnProperty('vnodeSelector')) {\n children.push(child);\n }\n else {\n children.push(toTextVNode(child));\n }\n }\n }\n return {\n vnodeSelector: selector,\n properties: properties,\n children: children,\n text: (text === '') ? undefined : text,\n domNode: null\n };\n};\n/**\n * Contains simple low-level utility functions to manipulate the real DOM.\n */\nexports.dom = {\n /**\n * Creates a real DOM tree from `vnode`. The [[Projection]] object returned will contain the resulting DOM Node in\n * its [[Projection.domNode|domNode]] property.\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection.\n * @returns The [[Projection]] which also contains the DOM Node that was created.\n */\n create: function (vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, document.createElement('div'), undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Appends a new child node to the DOM which is generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param parentNode - The parent node for the new child node.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n append: function (parentNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, parentNode, undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Inserts a new DOM node which is generated from a [[VNode]].\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param beforeNode - The node that the DOM Node is inserted before.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function.\n * NOTE: [[VNode]] objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n insertBefore: function (beforeNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, beforeNode.parentNode, beforeNode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Merges a new DOM node which is generated from a [[VNode]] with an existing DOM Node.\n * This means that the virtual DOM and the real DOM will have one overlapping element.\n * Therefore the selector for the root [[VNode]] will be ignored, but its properties and children will be applied to the Element provided.\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param element - The existing element to adopt as the root of the new virtual DOM. Existing attributes and child nodes are preserved.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]] objects\n * may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n merge: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n vnode.domNode = element;\n initPropertiesAndChildren(element, vnode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Replaces an existing DOM node with a node generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param element - The node for the [[VNode]] to replace.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n replace: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, element.parentNode, element, projectionOptions);\n element.parentNode.removeChild(element);\n return createProjection(vnode, projectionOptions);\n }\n};\n/**\n * Creates a [[CalculationCache]] object, useful for caching [[VNode]] trees.\n * In practice, caching of [[VNode]] trees is not needed, because achieving 60 frames per second is almost never a problem.\n * For more information, see [[CalculationCache]].\n *\n * @param The type of the value that is cached.\n */\nexports.createCache = function () {\n var cachedInputs;\n var cachedOutcome;\n return {\n invalidate: function () {\n cachedOutcome = undefined;\n cachedInputs = undefined;\n },\n result: function (inputs, calculation) {\n if (cachedInputs) {\n for (var i = 0; i < inputs.length; i++) {\n if (cachedInputs[i] !== inputs[i]) {\n cachedOutcome = undefined;\n }\n }\n }\n if (!cachedOutcome) {\n cachedOutcome = calculation();\n cachedInputs = inputs;\n }\n return cachedOutcome;\n }\n };\n};\n/**\n * Creates a {@link Mapping} instance that keeps an array of result objects synchronized with an array of source objects.\n * See {@link http://maquettejs.org/docs/arrays.html|Working with arrays}.\n *\n * @param The type of source items. A database-record for instance.\n * @param The type of target items. A [[Component]] for instance.\n * @param getSourceKey `function(source)` that must return a key to identify each source object. The result must either be a string or a number.\n * @param createResult `function(source, index)` that must create a new result object from a given source. This function is identical\n * to the `callback` argument in `Array.map(callback)`.\n * @param updateResult `function(source, target, index)` that updates a result to an updated source.\n */\nexports.createMapping = function (getSourceKey, createResult, updateResult) {\n var keys = [];\n var results = [];\n return {\n results: results,\n map: function (newSources) {\n var newKeys = newSources.map(getSourceKey);\n var oldTargets = results.slice();\n var oldIndex = 0;\n for (var i = 0; i < newSources.length; i++) {\n var source = newSources[i];\n var sourceKey = newKeys[i];\n if (sourceKey === keys[oldIndex]) {\n results[i] = oldTargets[oldIndex];\n updateResult(source, oldTargets[oldIndex], i);\n oldIndex++;\n }\n else {\n var found = false;\n for (var j = 1; j < keys.length + 1; j++) {\n var searchIndex = (oldIndex + j) % keys.length;\n if (keys[searchIndex] === sourceKey) {\n results[i] = oldTargets[searchIndex];\n updateResult(newSources[i], oldTargets[searchIndex], i);\n oldIndex = searchIndex + 1;\n found = true;\n break;\n }\n }\n if (!found) {\n results[i] = createResult(source, i);\n }\n }\n }\n results.length = newSources.length;\n keys = newKeys;\n }\n };\n};\n/**\n * Creates a [[Projector]] instance using the provided projectionOptions.\n *\n * For more information, see [[Projector]].\n *\n * @param projectorOptions Options that influence how the DOM is rendered and updated.\n */\nexports.createProjector = function (projectorOptions) {\n var projector;\n var projectionOptions = applyDefaultProjectionOptions(projectorOptions);\n projectionOptions.eventHandlerInterceptor = function (propertyName, eventHandler, domNode, properties) {\n return function () {\n // intercept function calls (event handlers) to do a render afterwards.\n projector.scheduleRender();\n return eventHandler.apply(properties.bind || this, arguments);\n };\n };\n var renderCompleted = true;\n var scheduled;\n var stopped = false;\n var projections = [];\n var renderFunctions = []; // matches the projections array\n var doRender = function () {\n scheduled = undefined;\n if (!renderCompleted) {\n return; // The last render threw an error, it should be logged in the browser console.\n }\n renderCompleted = false;\n for (var i = 0; i < projections.length; i++) {\n var updatedVnode = renderFunctions[i]();\n projections[i].update(updatedVnode);\n }\n renderCompleted = true;\n };\n projector = {\n renderNow: doRender,\n scheduleRender: function () {\n if (!scheduled && !stopped) {\n scheduled = requestAnimationFrame(doRender);\n }\n },\n stop: function () {\n if (scheduled) {\n cancelAnimationFrame(scheduled);\n scheduled = undefined;\n }\n stopped = true;\n },\n resume: function () {\n stopped = false;\n renderCompleted = true;\n projector.scheduleRender();\n },\n append: function (parentNode, renderMaquetteFunction) {\n projections.push(exports.dom.append(parentNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n insertBefore: function (beforeNode, renderMaquetteFunction) {\n projections.push(exports.dom.insertBefore(beforeNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n merge: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.merge(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n replace: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.replace(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n detach: function (renderMaquetteFunction) {\n for (var i = 0; i < renderFunctions.length; i++) {\n if (renderFunctions[i] === renderMaquetteFunction) {\n renderFunctions.splice(i, 1);\n return projections.splice(i, 1)[0];\n }\n }\n throw new Error('renderMaquetteFunction was not found');\n }\n };\n return projector;\n};\n\n//# sourceMappingURL=maquette.js.map\n"]} \ No newline at end of file diff --git a/dist/maquette.min.js b/dist/maquette.min.js index 9bc3e8e..eedae7f 100644 --- a/dist/maquette.min.js +++ b/dist/maquette.min.js @@ -1,2 +1,2 @@ -!function(e,t){"function"==typeof define&&define.amd?define(["exports"],t):t("object"==typeof exports&&"string"!=typeof exports.nodeName?exports:e.maquette={})}(this,function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t,r,o="http://www.w3.org/2000/svg",n=[],i=function(e,t){var r={};return Object.keys(e).forEach(function(t){r[t]=e[t]}),t&&Object.keys(t).forEach(function(e){r[e]=t[e]}),r},s=function(e,t){return e.vnodeSelector===t.vnodeSelector&&(e.properties&&t.properties?e.properties.key===t.properties.key&&e.properties.bind===t.properties.bind:!e.properties&&!t.properties)},a=function(e){return{vnodeSelector:"",properties:void 0,children:void 0,text:e.toString(),domNode:null}},d=function(e,t,r){for(var o=0,n=t.length;o=0){for(p=f;pf)for(p=f;p=0){for(p=f;pf)for(p=f;p= 0) {\n // Remove preceding missing children\n for (i = oldIndex; i < findOldIndex; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n textUpdated = updateDom(oldChildren[findOldIndex], newChild, projectionOptions) || textUpdated;\n oldIndex = findOldIndex + 1;\n } else {\n // New child\n createDom(newChild, domNode, oldIndex < oldChildrenLength ? oldChildren[oldIndex].domNode : undefined, projectionOptions);\n nodeAdded(newChild, transitions);\n checkDistinguishable(newChildren, newIndex, vnode, 'added');\n }\n }\n newIndex++;\n }\n if (oldChildrenLength > oldIndex) {\n // Remove child fragments\n for (i = oldIndex; i < oldChildrenLength; i++) {\n nodeToRemove(oldChildren[i], transitions);\n checkDistinguishable(oldChildren, i, vnode, 'removed');\n }\n }\n return textUpdated;\n };\n var addChildren = function (domNode, children, projectionOptions) {\n if (!children) {\n return;\n }\n for (var i = 0; i < children.length; i++) {\n createDom(children[i], domNode, undefined, projectionOptions);\n }\n };\n var initPropertiesAndChildren = function (domNode, vnode, projectionOptions) {\n addChildren(domNode, vnode.children, projectionOptions);\n // children before properties, needed for value property of .\n if (vnode.text) {\n domNode.textContent = vnode.text;\n }\n setProperties(domNode, vnode.properties, projectionOptions);\n if (vnode.properties && vnode.properties.afterCreate) {\n vnode.properties.afterCreate.apply(vnode.properties.bind || vnode.properties, [\n domNode,\n projectionOptions,\n vnode.vnodeSelector,\n vnode.properties,\n vnode.children\n ]);\n }\n };\n var insertNode = function (parentNode, domNode, vnode, beforeNode) {\n if (beforeNode) {\n parentNode.insertBefore(domNode, beforeNode);\n } else if (domNode.parentNode !== parentNode) {\n parentNode.appendChild(domNode);\n }\n };\n createDom = function (vnode, parentNode, insertBefore, projectionOptions) {\n var domNode, i, c, start = 0, type, found;\n var vnodeSelector = vnode.vnodeSelector;\n var delayAttach = false;\n var doc = parentNode.ownerDocument;\n if (vnodeSelector === '') {\n domNode = vnode.domNode = doc.createTextNode(vnode.text);\n insertNode(parentNode, domNode, vnode, insertBefore);\n } else {\n for (i = 0; i <= vnodeSelector.length; ++i) {\n c = vnodeSelector.charAt(i);\n if (i === vnodeSelector.length || c === '.' || c === '#') {\n type = vnodeSelector.charAt(start - 1);\n found = vnodeSelector.slice(start, i);\n if (type === '.') {\n domNode.classList.add(found);\n } else if (type === '#') {\n domNode.id = found;\n } else {\n if (found === 'svg') {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (projectionOptions.namespace !== undefined) {\n domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found);\n } else {\n domNode = vnode.domNode = vnode.domNode || doc.createElement(found);\n delayAttach = domNode.nodeName.indexOf('-') !== -1;\n if (found === 'input' && vnode.properties && vnode.properties.type !== undefined) {\n // IE8 and older don't support setting input type after the DOM Node has been added to the document\n domNode.setAttribute('type', vnode.properties.type);\n }\n }\n if (!delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n start = i + 1;\n }\n }\n initPropertiesAndChildren(domNode, vnode, projectionOptions);\n if (delayAttach) {\n insertNode(parentNode, domNode, vnode, insertBefore);\n }\n }\n };\n updateDom = function (previous, vnode, projectionOptions) {\n var domNode = previous.domNode;\n var textUpdated = false;\n if (previous === vnode) {\n return false; // By contract, VNode objects may not be modified anymore after passing them to maquette\n }\n var updated = false;\n if (vnode.vnodeSelector === '') {\n if (vnode.text !== previous.text) {\n var newVNode = domNode.ownerDocument.createTextNode(vnode.text);\n domNode.parentNode.replaceChild(newVNode, domNode);\n vnode.domNode = newVNode;\n textUpdated = true;\n return textUpdated;\n }\n } else {\n if (vnode.vnodeSelector.lastIndexOf('svg', 0) === 0) {\n projectionOptions = extend(projectionOptions, { namespace: NAMESPACE_SVG });\n }\n if (previous.text !== vnode.text) {\n updated = true;\n if (vnode.text === undefined) {\n domNode.removeChild(domNode.firstChild); // the only textnode presumably\n } else {\n domNode.textContent = vnode.text;\n }\n }\n updated = updateChildren(vnode, domNode, previous.children, vnode.children, projectionOptions) || updated;\n updated = updateProperties(domNode, previous.properties, vnode.properties, projectionOptions) || updated;\n if (vnode.properties && vnode.properties.afterUpdate) {\n vnode.properties.afterUpdate.apply(vnode.properties.bind || vnode.properties, [\n domNode,\n projectionOptions,\n vnode.vnodeSelector,\n vnode.properties,\n vnode.children\n ]);\n }\n }\n if (updated && vnode.properties && vnode.properties.updateAnimation) {\n vnode.properties.updateAnimation(domNode, vnode.properties, previous.properties);\n }\n vnode.domNode = previous.domNode;\n return textUpdated;\n };\n var createProjection = function (vnode, projectionOptions) {\n return {\n update: function (updatedVnode) {\n if (vnode.vnodeSelector !== updatedVnode.vnodeSelector) {\n throw new Error('The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)');\n }\n updateDom(vnode, updatedVnode, projectionOptions);\n vnode = updatedVnode;\n },\n domNode: vnode.domNode\n };\n };\n // The other two parameters are not added here, because the Typescript compiler creates surrogate code for destructuring 'children'.\n exports.h = function (selector) {\n var properties = arguments[1];\n if (typeof selector !== 'string') {\n throw new Error();\n }\n var childIndex = 1;\n if (properties && !properties.hasOwnProperty('vnodeSelector') && !Array.isArray(properties) && typeof properties === 'object') {\n childIndex = 2;\n } else {\n // Optional properties argument was omitted\n properties = undefined;\n }\n var text;\n var children;\n var argsLength = arguments.length;\n // Recognize a common special case where there is only a single text node\n if (argsLength === childIndex + 1) {\n var onlyChild = arguments[childIndex];\n if (typeof onlyChild === 'string') {\n text = onlyChild;\n } else if (onlyChild !== undefined && onlyChild !== null && onlyChild.length === 1 && typeof onlyChild[0] === 'string') {\n text = onlyChild[0];\n }\n }\n if (text === undefined) {\n children = [];\n for (; childIndex < argsLength; childIndex++) {\n var child = arguments[childIndex];\n if (child === null || child === undefined) {\n } else if (Array.isArray(child)) {\n appendChildren(selector, child, children);\n } else if (child.hasOwnProperty('vnodeSelector')) {\n children.push(child);\n } else {\n children.push(toTextVNode(child));\n }\n }\n }\n return {\n vnodeSelector: selector,\n properties: properties,\n children: children,\n text: text === '' ? undefined : text,\n domNode: null\n };\n };\n /**\n * Contains simple low-level utility functions to manipulate the real DOM.\n */\n exports.dom = {\n /**\n * Creates a real DOM tree from `vnode`. The [[Projection]] object returned will contain the resulting DOM Node in\n * its [[Projection.domNode|domNode]] property.\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection.\n * @returns The [[Projection]] which also contains the DOM Node that was created.\n */\n create: function (vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, document.createElement('div'), undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Appends a new child node to the DOM which is generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param parentNode - The parent node for the new child node.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n append: function (parentNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, parentNode, undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Inserts a new DOM node which is generated from a [[VNode]].\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param beforeNode - The node that the DOM Node is inserted before.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function.\n * NOTE: [[VNode]] objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n insertBefore: function (beforeNode, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, beforeNode.parentNode, beforeNode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Merges a new DOM node which is generated from a [[VNode]] with an existing DOM Node.\n * This means that the virtual DOM and the real DOM will have one overlapping element.\n * Therefore the selector for the root [[VNode]] will be ignored, but its properties and children will be applied to the Element provided.\n * This is a low-level method. Users wil typically use a [[Projector]] instead.\n * @param element - The existing element to adopt as the root of the new virtual DOM. Existing attributes and child nodes are preserved.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]] objects\n * may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].\n * @returns The [[Projection]] that was created.\n */\n merge: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n vnode.domNode = element;\n initPropertiesAndChildren(element, vnode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\n /**\n * Replaces an existing DOM node with a node generated from a [[VNode]].\n * This is a low-level method. Users will typically use a [[Projector]] instead.\n * @param element - The node for the [[VNode]] to replace.\n * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]\n * objects may only be rendered once.\n * @param projectionOptions - Options to be used to create and update the [[Projection]].\n * @returns The [[Projection]] that was created.\n */\n replace: function (element, vnode, projectionOptions) {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, element.parentNode, element, projectionOptions);\n element.parentNode.removeChild(element);\n return createProjection(vnode, projectionOptions);\n }\n };\n /**\n * Creates a [[CalculationCache]] object, useful for caching [[VNode]] trees.\n * In practice, caching of [[VNode]] trees is not needed, because achieving 60 frames per second is almost never a problem.\n * For more information, see [[CalculationCache]].\n *\n * @param The type of the value that is cached.\n */\n exports.createCache = function () {\n var cachedInputs;\n var cachedOutcome;\n return {\n invalidate: function () {\n cachedOutcome = undefined;\n cachedInputs = undefined;\n },\n result: function (inputs, calculation) {\n if (cachedInputs) {\n for (var i = 0; i < inputs.length; i++) {\n if (cachedInputs[i] !== inputs[i]) {\n cachedOutcome = undefined;\n }\n }\n }\n if (!cachedOutcome) {\n cachedOutcome = calculation();\n cachedInputs = inputs;\n }\n return cachedOutcome;\n }\n };\n };\n /**\n * Creates a {@link Mapping} instance that keeps an array of result objects synchronized with an array of source objects.\n * See {@link http://maquettejs.org/docs/arrays.html|Working with arrays}.\n *\n * @param The type of source items. A database-record for instance.\n * @param The type of target items. A [[Component]] for instance.\n * @param getSourceKey `function(source)` that must return a key to identify each source object. The result must either be a string or a number.\n * @param createResult `function(source, index)` that must create a new result object from a given source. This function is identical\n * to the `callback` argument in `Array.map(callback)`.\n * @param updateResult `function(source, target, index)` that updates a result to an updated source.\n */\n exports.createMapping = function (getSourceKey, createResult, updateResult) {\n var keys = [];\n var results = [];\n return {\n results: results,\n map: function (newSources) {\n var newKeys = newSources.map(getSourceKey);\n var oldTargets = results.slice();\n var oldIndex = 0;\n for (var i = 0; i < newSources.length; i++) {\n var source = newSources[i];\n var sourceKey = newKeys[i];\n if (sourceKey === keys[oldIndex]) {\n results[i] = oldTargets[oldIndex];\n updateResult(source, oldTargets[oldIndex], i);\n oldIndex++;\n } else {\n var found = false;\n for (var j = 1; j < keys.length + 1; j++) {\n var searchIndex = (oldIndex + j) % keys.length;\n if (keys[searchIndex] === sourceKey) {\n results[i] = oldTargets[searchIndex];\n updateResult(newSources[i], oldTargets[searchIndex], i);\n oldIndex = searchIndex + 1;\n found = true;\n break;\n }\n }\n if (!found) {\n results[i] = createResult(source, i);\n }\n }\n }\n results.length = newSources.length;\n keys = newKeys;\n }\n };\n };\n /**\n * Creates a [[Projector]] instance using the provided projectionOptions.\n *\n * For more information, see [[Projector]].\n *\n * @param projectorOptions Options that influence how the DOM is rendered and updated.\n */\n exports.createProjector = function (projectorOptions) {\n var projector;\n var projectionOptions = applyDefaultProjectionOptions(projectorOptions);\n projectionOptions.eventHandlerInterceptor = function (propertyName, eventHandler, domNode, properties) {\n return function () {\n // intercept function calls (event handlers) to do a render afterwards.\n projector.scheduleRender();\n return eventHandler.apply(properties.bind || this, arguments);\n };\n };\n var renderCompleted = true;\n var scheduled;\n var stopped = false;\n var projections = [];\n var renderFunctions = [];\n // matches the projections array\n var doRender = function () {\n scheduled = undefined;\n if (!renderCompleted) {\n return; // The last render threw an error, it should be logged in the browser console.\n }\n renderCompleted = false;\n for (var i = 0; i < projections.length; i++) {\n var updatedVnode = renderFunctions[i]();\n projections[i].update(updatedVnode);\n }\n renderCompleted = true;\n };\n projector = {\n renderNow: doRender,\n scheduleRender: function () {\n if (!scheduled && !stopped) {\n scheduled = requestAnimationFrame(doRender);\n }\n },\n stop: function () {\n if (scheduled) {\n cancelAnimationFrame(scheduled);\n scheduled = undefined;\n }\n stopped = true;\n },\n resume: function () {\n stopped = false;\n renderCompleted = true;\n projector.scheduleRender();\n },\n append: function (parentNode, renderMaquetteFunction) {\n projections.push(exports.dom.append(parentNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n insertBefore: function (beforeNode, renderMaquetteFunction) {\n projections.push(exports.dom.insertBefore(beforeNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n merge: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.merge(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n replace: function (domNode, renderMaquetteFunction) {\n projections.push(exports.dom.replace(domNode, renderMaquetteFunction(), projectionOptions));\n renderFunctions.push(renderMaquetteFunction);\n },\n detach: function (renderMaquetteFunction) {\n for (var i = 0; i < renderFunctions.length; i++) {\n if (renderFunctions[i] === renderMaquetteFunction) {\n renderFunctions.splice(i, 1);\n return projections.splice(i, 1)[0];\n }\n }\n throw new Error('renderMaquetteFunction was not found');\n }\n };\n return projector;\n };\n}));",null]} \ No newline at end of file diff --git a/src/maquette.ts b/src/maquette.ts index 501e3ad..2aca2cd 100644 --- a/src/maquette.ts +++ b/src/maquette.ts @@ -757,17 +757,10 @@ let insertNode = function (parentNode: Node, domNode: Node, vnode: VNode, before } }; -/** - * Identifies custom element tags as defined in custom elements v1 draft spec - * - * @see https://www.w3.org/TR/custom-elements/#custom-elements-core-concepts - */ -const customElementRegex = /^[a-z][^-]*-/; - createDom = function(vnode, parentNode, insertBefore, projectionOptions) { let domNode: Node | undefined, i: number, c: string, start = 0, type: string, found: string; let vnodeSelector = vnode.vnodeSelector; - const delayAttach = customElementRegex.test(vnodeSelector); + let delayAttach = false; let doc = parentNode.ownerDocument; if (vnodeSelector === '') { domNode = vnode.domNode = doc.createTextNode(vnode.text!); @@ -790,6 +783,7 @@ createDom = function(vnode, parentNode, insertBefore, projectionOptions) { domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found); } else { domNode = vnode.domNode = (vnode.domNode || doc.createElement(found)); + delayAttach = domNode.nodeName.indexOf('-') !== -1; if (found === 'input' && vnode.properties && vnode.properties.type !== undefined) { // IE8 and older don't support setting input type after the DOM Node has been added to the document (domNode as Element).setAttribute('type', vnode.properties.type);