maquette 3.6.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,7 +9,7 @@ Maquette is a Javascript utility which makes it easy to synchronize the DOM tree
9
9
  It uses a technique called 'Virtual DOM'.
10
10
  Compared to other virtual DOM implementations, maquette has the following advantages:
11
11
 
12
- * It is very lightweight (3.6Kb gzipped)
12
+ * It is very lightweight (3.7Kb gzipped)
13
13
  * It allows changes to be animated
14
14
  * It makes your frontend [easy to unit-test](https://maquettejs.org/docs/unit-testing.html)
15
15
 
package/dist/cache.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,IAAI,WAAW,GAAG;IACvB,IAAI,YAAmC,CAAC;IACxC,IAAI,aAAiC,CAAC;IAEtC,OAAO;QACL,UAAU,EAAE;YACV,aAAa,GAAG,SAAS,CAAC;YAC1B,YAAY,GAAG,SAAS,CAAC;QAC3B,CAAC;QAED,MAAM,EAAE,UAAC,MAAiB,EAAE,WAAyB;YACnD,IAAI,YAAY,EAAE;gBAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACtC,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE;wBACjC,aAAa,GAAG,SAAS,CAAC;qBAC3B;iBACF;aACF;YACD,IAAI,CAAC,aAAa,EAAE;gBAClB,aAAa,GAAG,WAAW,EAAE,CAAC;gBAC9B,YAAY,GAAG,MAAM,CAAC;aACvB;YACD,OAAO,aAAa,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { CalculationCache } from \"./interfaces\";\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 <Result> The type of the value that is cached.\n */\nexport let createCache = <Result>(): CalculationCache<Result> => {\n let cachedInputs: unknown[] | undefined;\n let cachedOutcome: Result | undefined;\n\n return {\n invalidate: () => {\n cachedOutcome = undefined;\n cachedInputs = undefined;\n },\n\n result: (inputs: unknown[], calculation: () => Result) => {\n if (cachedInputs) {\n for (let 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"]}
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,IAAI,WAAW,GAAG;IACvB,IAAI,YAAmC,CAAC;IACxC,IAAI,aAAiC,CAAC;IAEtC,OAAO;QACL,UAAU,EAAE;YACV,aAAa,GAAG,SAAS,CAAC;YAC1B,YAAY,GAAG,SAAS,CAAC;QAC3B,CAAC;QAED,MAAM,EAAE,UAAC,MAAiB,EAAE,WAAyB;YACnD,IAAI,YAAY,EAAE,CAAC;gBACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBACvC,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;wBAClC,aAAa,GAAG,SAAS,CAAC;oBAC5B,CAAC;gBACH,CAAC;YACH,CAAC;YACD,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnB,aAAa,GAAG,WAAW,EAAE,CAAC;gBAC9B,YAAY,GAAG,MAAM,CAAC;YACxB,CAAC;YACD,OAAO,aAAa,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { CalculationCache } from \"./interfaces\";\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 <Result> The type of the value that is cached.\n */\nexport let createCache = <Result,>(): CalculationCache<Result> => {\n let cachedInputs: unknown[] | undefined;\n let cachedOutcome: Result | undefined;\n\n return {\n invalidate: () => {\n cachedOutcome = undefined;\n cachedInputs = undefined;\n },\n\n result: (inputs: unknown[], calculation: () => Result) => {\n if (cachedInputs) {\n for (let 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"]}
package/dist/dom.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"dom.js","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAE9F,IAAM,0BAA0B,GAAsB;IACpD,SAAS,EAAE,SAAS;IACpB,iBAAiB,EAAE,cAAM,OAAA,SAAS,EAAT,CAAS;IAClC,uBAAuB,EAAE,SAAS;IAClC,YAAY,EAAE,UAAC,OAAoB,EAAE,SAAiB,EAAE,KAAa;QACnE,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YAC/B,8CAA8C;YAC9C,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;SAC7C;aAAM;YACL,iEAAiE;YAChE,OAAO,CAAC,KAAa,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;SAC3C;IACH,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,IAAI,6BAA6B,GAAG,UACzC,gBAAoC;IAEpC,OAAO,M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,KAAK,EAAE,iBAAiB,CAAC,CAAC;IACpD,CAAC;IAED;;;;;;;;OAQG;IACH,OAAO,EAAE,UAAC,OAAgB,EAAE,KAAY,EAAE,iBAAqC;QAC7E,iBAAiB,GAAG,6BAA6B,CAAC,iBAAiB,CAAC,CAAC;QACrE,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,UAAW,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAClE,OAAO,CAAC,UAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;IACpD,CAAC;CACF,CAAC","sourcesContent":["/**\n * Contains simple low-level utility functions to manipulate the real DOM.\n */\nimport { Projection, ProjectionOptions, VNode } from \"./interfaces\";\nimport { createDom, createProjection, extend, initPropertiesAndChildren } from \"./projection\";\n\nconst DEFAULT_PROJECTION_OPTIONS: ProjectionOptions = {\n namespace: undefined,\n performanceLogger: () => undefined,\n eventHandlerInterceptor: undefined,\n styleApplyer: (domNode: HTMLElement, styleName: string, value: string) => {\n if (styleName.charAt(0) === \"-\") {\n // CSS variables must be set using setProperty\n domNode.style.setProperty(styleName, value);\n } else {\n // properties like 'backgroundColor' must be set as a js-property\n (domNode.style as any)[styleName] = value;\n }\n },\n};\n\nexport let applyDefaultProjectionOptions = (\n projectorOptions?: ProjectionOptions\n): ProjectionOptions => {\n return extend(DEFAULT_PROJECTION_OPTIONS, projectorOptions);\n};\n\nexport let 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: (vnode: VNode, projectionOptions?: ProjectionOptions): Projection => {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, document.createElement(\"div\"), undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\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: (\n parentNode: Element,\n vnode: VNode,\n projectionOptions?: ProjectionOptions\n ): Projection => {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, parentNode, undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\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: (\n beforeNode: Element,\n vnode: VNode,\n projectionOptions?: ProjectionOptions\n ): Projection => {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, beforeNode.parentNode!, beforeNode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\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: (element: Element, vnode: VNode, projectionOptions?: ProjectionOptions): Projection => {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n vnode.domNode = element;\n initPropertiesAndChildren(element, vnode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\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: (element: Element, vnode: VNode, projectionOptions?: ProjectionOptions): Projection => {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, element.parentNode!, element, projectionOptions);\n element.parentNode!.removeChild(element);\n return createProjection(vnode, projectionOptions);\n },\n};\n"]}
1
+ {"version":3,"file":"dom.js","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAE9F,IAAM,0BAA0B,GAAsB;IACpD,SAAS,EAAE,SAAS;IACpB,iBAAiB,EAAE,cAAM,OAAA,SAAS,EAAT,CAAS;IAClC,uBAAuB,EAAE,SAAS;IAClC,YAAY,EAAE,UAAC,OAAoB,EAAE,SAAiB,EAAE,KAAa;QACnE,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAChC,8CAA8C;YAC9C,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,iEAAiE;YAChE,OAAO,CAAC,KAAa,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;QAC5C,CAAC;IACH,CAAC;CACF,CAAC;AAEF,MAAM,C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,EAAE,iBAAiB,CAAC,CAAC;QAC7D,OAAO,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;IACpD,CAAC;IAED;;;;;;;;OAQG;IACH,OAAO,EAAE,UAAC,OAAgB,EAAE,KAAY,EAAE,iBAAqC;QAC7E,iBAAiB,GAAG,6BAA6B,CAAC,iBAAiB,CAAC,CAAC;QACrE,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,UAAW,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAClE,OAAO,CAAC,UAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;IACpD,CAAC;CACF,CAAC","sourcesContent":["/**\n * Contains simple low-level utility functions to manipulate the real DOM.\n */\nimport { Projection, ProjectionOptions, VNode } from \"./interfaces\";\nimport { createDom, createProjection, extend, initPropertiesAndChildren } from \"./projection\";\n\nconst DEFAULT_PROJECTION_OPTIONS: ProjectionOptions = {\n namespace: undefined,\n performanceLogger: () => undefined,\n eventHandlerInterceptor: undefined,\n styleApplyer: (domNode: HTMLElement, styleName: string, value: string) => {\n if (styleName.charAt(0) === \"-\") {\n // CSS variables must be set using setProperty\n domNode.style.setProperty(styleName, value);\n } else {\n // properties like 'backgroundColor' must be set as a js-property\n (domNode.style as any)[styleName] = value;\n }\n },\n};\n\nexport let applyDefaultProjectionOptions = (\n projectorOptions?: ProjectionOptions\n): ProjectionOptions => {\n return extend(DEFAULT_PROJECTION_OPTIONS, projectorOptions);\n};\n\nexport let 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: (vnode: VNode, projectionOptions?: ProjectionOptions): Projection => {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, document.createElement(\"div\"), undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\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: (\n parentNode: Element,\n vnode: VNode,\n projectionOptions?: ProjectionOptions\n ): Projection => {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, parentNode, undefined, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\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: (\n beforeNode: Element,\n vnode: VNode,\n projectionOptions?: ProjectionOptions\n ): Projection => {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, beforeNode.parentNode!, beforeNode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\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: (element: Element, vnode: VNode, projectionOptions?: ProjectionOptions): Projection => {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n vnode.domNode = element;\n initPropertiesAndChildren(element, vnode, projectionOptions);\n return createProjection(vnode, projectionOptions);\n },\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: (element: Element, vnode: VNode, projectionOptions?: ProjectionOptions): Projection => {\n projectionOptions = applyDefaultProjectionOptions(projectionOptions);\n createDom(vnode, element.parentNode!, element, projectionOptions);\n element.parentNode!.removeChild(element);\n return createProjection(vnode, projectionOptions);\n },\n};\n"]}
package/dist/h.d.ts CHANGED
@@ -13,7 +13,7 @@ import { VNode, VNodeChild, VNodeProperties } from "./interfaces";
13
13
  *
14
14
  * @returns A VNode object, used to render a real DOM later.
15
15
  *
16
- * NOTE: There are {@link http://maquettejs.org/docs/rules.html|two basic rules} you should be aware of when updating the virtual DOM.
16
+ * NOTE: There are {@link http://maquettejs.org/docs/rules.html two basic rules} you should be aware of when updating the virtual DOM.
17
17
  */
18
18
  export declare function h(selector: string, properties?: VNodeProperties, children?: VNodeChild[] | null): VNode;
19
19
  /**
@@ -29,6 +29,6 @@ export declare function h(selector: string, properties?: VNodeProperties, childr
29
29
  *
30
30
  * @returns A VNode object, used to render a real DOM later.
31
31
  *
32
- * NOTE: There are {@link http://maquettejs.org/docs/rules.html|two basic rules} you should be aware of when updating the virtual DOM.
32
+ * NOTE: There are {@link http://maquettejs.org/docs/rules.html two basic rules} you should be aware of when updating the virtual DOM.
33
33
  */
34
34
  export declare function h(selector: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AC,aAAa,CAAC,CAAC;QACrF,CAAC,QAAQ,IAAI,CAAC,OAAQ,QAAgB,KAAK,QAAQ,IAAK,QAAgB,CAAC,aAAa,CAAC,CAAC,EACxF;QACA,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;KACpD;IACD,IAAI,IAAwB,CAAC;IAC7B,IAAI,iBAAsC,CAAC;IAC3C,yEAAyE;IACzE,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;QACxE,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;KACpB;SAAM,IAAI,QAAQ,EAAE;QACnB,iBAAiB,GAAG,EAAE,CAAC;QACvB,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QACtD,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,iBAAiB,GAAG,SAAS,CAAC;SAC/B;KACF;IACD,OAAO;QACL,aAAa,EAAE,QAAQ;QACvB,UAAU,EAAE,UAAU;QACtB,QAAQ,EAAE,iBAAiB;QAC3B,IAAI,EAAE,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI;QACpC,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC","sourcesContent":["import { VNode, VNodeChild, VNodeProperties } from \"./interfaces\";\n\nlet toTextVNode = (data: string): VNode => {\n return {\n vnodeSelector: \"\",\n properties: undefined,\n children: undefined,\n text: data.toString(),\n domNode: null,\n };\n};\n\nlet appendChildren = (parentSelector: string, insertions: VNodeChild[], main: VNode[]) => {\n for (let i = 0, length = insertions.length; i < length; i++) {\n let item = insertions[i];\n if (Array.isArray(item)) {\n appendChildren(parentSelector, item, main);\n } else {\n if (item !== null && item !== undefined && item !== false) {\n if (typeof item === \"string\") {\n item = toTextVNode(item);\n }\n main.push(item);\n }\n }\n }\n};\n\n/**\n * The `h` function is used to create a virtual DOM node.\n * This function is largely inspired by the mercuryjs and mithril frameworks.\n * The `h` stands for (virtual) hyperscript.\n *\n * @param selector Contains the tagName, id and fixed css classnames in CSS selector format.\n * It is formatted as follows: `tagname.cssclass1.cssclass2#id`.\n * @param properties An object literal containing properties that will be placed on the DOM node.\n * @param children Virtual DOM nodes and strings to add as child nodes.\n * `children` may contain [[VNode]]s, `string`s, nested arrays, `null` and `undefined`.\n * Nested arrays are flattened, `null` and `undefined` are removed.\n *\n * @returns A VNode object, used to render a real DOM later.\n *\n * NOTE: There are {@link http://maquettejs.org/docs/rules.html|two basic rules} you should be aware of when updating the virtual DOM.\n */\nexport function h(\n selector: string,\n properties?: VNodeProperties,\n children?: VNodeChild[] | null\n): VNode;\n/**\n * The `h` function is used to create a virtual DOM node.\n * This function is largely inspired by the mercuryjs and mithril frameworks.\n * The `h` stands for (virtual) hyperscript.\n *\n * @param selector Contains the tagName, id and fixed css classnames in CSS selector format.\n * It is formatted as follows: `tagname.cssclass1.cssclass2#id`.\n * @param children Virtual DOM nodes and strings to add as child nodes.\n * `children` may contain [[VNode]]s, `string`s, nested arrays, `null` and `undefined`.\n * Nested arrays are flattened, `null` and `undefined` are removed.\n *\n * @returns A VNode object, used to render a real DOM later.\n *\n * NOTE: There are {@link http://maquettejs.org/docs/rules.html|two basic rules} you should be aware of when updating the virtual DOM.\n */\nexport function h(selector: string, children: VNodeChild[]): VNode;\n\nexport function h(\n selector: string,\n properties?: VNodeProperties,\n children?: VNodeChild[] | null\n): VNode {\n if (Array.isArray(properties)) {\n children = properties;\n properties = undefined;\n } else if (\n (properties && (typeof (properties as any) === \"string\" || properties.vnodeSelector)) ||\n (children && (typeof (children as any) === \"string\" || (children as any).vnodeSelector))\n ) {\n throw new Error(\"h called with invalid arguments\");\n }\n let text: string | undefined;\n let flattenedChildren: VNode[] | undefined;\n // Recognize a common special case where there is only a single text node\n if (children && children.length === 1 && typeof children[0] === \"string\") {\n text = children[0];\n } else if (children) {\n flattenedChildren = [];\n appendChildren(selector, children, flattenedChildren);\n if (flattenedChildren.length === 0) {\n flattenedChildren = undefined;\n }\n }\n return {\n vnodeSelector: selector,\n properties: properties,\n children: flattenedChildren,\n text: text === \"\" ? undefined : text,\n domNode: null,\n };\n}\n"]}
1
+ {"version":3,"file":"h.js","sourceRoot":"","sources":["../src/h.ts"],"names":[],"mappings":"AAEA,IAAI,WAAW,GAAG,UAAC,IAAY;IAC7B,OAAO;QACL,aAAa,EAAE,EAAE;QACjB,UAAU,EAAE,SAAS;QACrB,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE;QACrB,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC,CAAC;AAEF,IAAI,cAAc,GAAG,UAAC,cAAsB,EAAE,UAAwB,EAAE,IAAa;IACnF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,QAAM,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,QAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5D,IAAI,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7C,CAAC;aAAM,CAAC;YACN,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;gBAC1D,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;oBAC7B,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;gBAC3B,CAAC;gBACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAwCF,MAAM,UAAU,CAAC,CACf,QAAgB,EAChB,UAA4B,EAC5B,QAA8B;IAE9B,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,QAAQ,GAAG,UAAU,CAAC;QACtB,UAAU,GAAG,SAAS,CAAC;IACzB,CAAC;SAAM,IACL,CAAC,UAAU,IAAI,CAAC,OAAQ,UAAkB,KAAK,QAAQ,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;QACrF,CAAC,QAAQ,IAAI,CAAC,OAAQ,QAAgB,KAAK,QAAQ,IAAK,QAAgB,CAAC,aAAa,CAAC,CAAC,EACxF,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,IAAwB,CAAC;IAC7B,IAAI,iBAAsC,CAAC;IAC3C,yEAAyE;IACzE,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QACzE,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QACpB,iBAAiB,GAAG,EAAE,CAAC;QACvB,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QACtD,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnC,iBAAiB,GAAG,SAAS,CAAC;QAChC,CAAC;IACH,CAAC;IACD,OAAO;QACL,aAAa,EAAE,QAAQ;QACvB,UAAU,EAAE,UAAU;QACtB,QAAQ,EAAE,iBAAiB;QAC3B,IAAI,EAAE,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI;QACpC,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC","sourcesContent":["import { VNode, VNodeChild, VNodeProperties } from \"./interfaces\";\n\nlet toTextVNode = (data: string): VNode => {\n return {\n vnodeSelector: \"\",\n properties: undefined,\n children: undefined,\n text: data.toString(),\n domNode: null,\n };\n};\n\nlet appendChildren = (parentSelector: string, insertions: VNodeChild[], main: VNode[]) => {\n for (let i = 0, length = insertions.length; i < length; i++) {\n let item = insertions[i];\n if (Array.isArray(item)) {\n appendChildren(parentSelector, item, main);\n } else {\n if (item !== null && item !== undefined && item !== false) {\n if (typeof item === \"string\") {\n item = toTextVNode(item);\n }\n main.push(item);\n }\n }\n }\n};\n\n/**\n * The `h` function is used to create a virtual DOM node.\n * This function is largely inspired by the mercuryjs and mithril frameworks.\n * The `h` stands for (virtual) hyperscript.\n *\n * @param selector Contains the tagName, id and fixed css classnames in CSS selector format.\n * It is formatted as follows: `tagname.cssclass1.cssclass2#id`.\n * @param properties An object literal containing properties that will be placed on the DOM node.\n * @param children Virtual DOM nodes and strings to add as child nodes.\n * `children` may contain [[VNode]]s, `string`s, nested arrays, `null` and `undefined`.\n * Nested arrays are flattened, `null` and `undefined` are removed.\n *\n * @returns A VNode object, used to render a real DOM later.\n *\n * NOTE: There are {@link http://maquettejs.org/docs/rules.html two basic rules} you should be aware of when updating the virtual DOM.\n */\nexport function h(\n selector: string,\n properties?: VNodeProperties,\n children?: VNodeChild[] | null\n): VNode;\n/**\n * The `h` function is used to create a virtual DOM node.\n * This function is largely inspired by the mercuryjs and mithril frameworks.\n * The `h` stands for (virtual) hyperscript.\n *\n * @param selector Contains the tagName, id and fixed css classnames in CSS selector format.\n * It is formatted as follows: `tagname.cssclass1.cssclass2#id`.\n * @param children Virtual DOM nodes and strings to add as child nodes.\n * `children` may contain [[VNode]]s, `string`s, nested arrays, `null` and `undefined`.\n * Nested arrays are flattened, `null` and `undefined` are removed.\n *\n * @returns A VNode object, used to render a real DOM later.\n *\n * NOTE: There are {@link http://maquettejs.org/docs/rules.html two basic rules} you should be aware of when updating the virtual DOM.\n */\nexport function h(selector: string, children: VNodeChild[]): VNode;\n\nexport function h(\n selector: string,\n properties?: VNodeProperties,\n children?: VNodeChild[] | null\n): VNode {\n if (Array.isArray(properties)) {\n children = properties;\n properties = undefined;\n } else if (\n (properties && (typeof (properties as any) === \"string\" || properties.vnodeSelector)) ||\n (children && (typeof (children as any) === \"string\" || (children as any).vnodeSelector))\n ) {\n throw new Error(\"h called with invalid arguments\");\n }\n let text: string | undefined;\n let flattenedChildren: VNode[] | undefined;\n // Recognize a common special case where there is only a single text node\n if (children && children.length === 1 && typeof children[0] === \"string\") {\n text = children[0];\n } else if (children) {\n flattenedChildren = [];\n appendChildren(selector, children, flattenedChildren);\n if (flattenedChildren.length === 0) {\n flattenedChildren = undefined;\n }\n }\n return {\n vnodeSelector: selector,\n properties: properties,\n children: flattenedChildren,\n text: text === \"\" ? undefined : text,\n domNode: null,\n };\n}\n"]}
@@ -100,7 +100,7 @@ export interface VNode {
100
100
  export interface VNodeProperties {
101
101
  /**
102
102
  * The animation to perform when this node is added to an already existing parent.
103
- * {@link http://maquettejs.org/docs/animations.html|More about animations}.
103
+ * {@link http://maquettejs.org/docs/animations.html More about animations}.
104
104
  * @param element - Element that was just added to the DOM.
105
105
  * @param properties - The properties object that was supplied to the [[h]] method
106
106
  */
@@ -117,7 +117,7 @@ export interface VNodeProperties {
117
117
  /**
118
118
  * The animation to perform when the properties of this node change.
119
119
  * This also includes attributes, styles, css classes. This callback is also invoked when node contains only text and that text changes.
120
- * {@link http://maquettejs.org/docs/animations.html|More about animations}.
120
+ * {@link http://maquettejs.org/docs/animations.html More about animations}.
121
121
  * @param element - Element that was modified in the DOM.
122
122
  * @param properties - The last properties object that was supplied to the [[h]] method
123
123
  * @param previousProperties - The previous properties object that was supplied to the [[h]] method
@@ -146,7 +146,7 @@ export interface VNodeProperties {
146
146
  /**
147
147
  * Callback that is called when a node has been removed from the tree.
148
148
  * The callback is called during idle state or after a timeout (fallback).
149
- * {@link https://maquettejs.org/docs/dom-node-removal.html|More info}
149
+ * {@link https://maquettejs.org/docs/dom-node-removal.html More info}
150
150
  * @param element - The element that has been removed from the DOM.
151
151
  */
152
152
  afterRemoved?(element: Element): void;
@@ -163,6 +163,27 @@ export interface VNodeProperties {
163
163
  * NOTE: this does not have to be a string or number, a [[MaquetteComponent]] Object for instance is also common.
164
164
  */
165
165
  readonly key?: unknown;
166
+ /**
167
+ * An object containing event handlers to attach using addEventListener.
168
+ * Note that `projector.scheduleRender()` is called automatically when these event handlers are invoked.
169
+ */
170
+ readonly on?: {
171
+ [eventName: string]: EventHandler | {
172
+ listener: EventHandler;
173
+ options: {
174
+ capture?: boolean;
175
+ passive?: boolean;
176
+ once?: boolean;
177
+ };
178
+ };
179
+ };
180
+ /**
181
+ * An object containing event handlers to attach using addEventListener.
182
+ * Note that `projector.scheduleRender()` is called automatically when these event handlers are invoked.
183
+ */
184
+ readonly onCapture?: {
185
+ [eventName: string]: EventHandler;
186
+ };
166
187
  /**
167
188
  * An object literal like `{important:true}` which allows css classes, like `important` to be added and removed
168
189
  * dynamically.
@@ -219,6 +240,14 @@ export interface VNodeProperties {
219
240
  onmousewheel?(ev: WheelEvent): boolean | void;
220
241
  onscroll?(ev: UIEvent): boolean | void;
221
242
  onsubmit?(ev: Event): boolean | void;
243
+ onpointercancel?(ev: PointerEvent): boolean | void;
244
+ onpointerdown?(ev: PointerEvent): boolean | void;
245
+ onpointerenter?(ev: PointerEvent): boolean | void;
246
+ onpointerleave?(ev: PointerEvent): boolean | void;
247
+ onpointermove?(ev: PointerEvent): boolean | void;
248
+ onpointerout?(ev: PointerEvent): boolean | void;
249
+ onpointerover?(ev: PointerEvent): boolean | void;
250
+ onpointerup?(ev: PointerEvent): boolean | void;
222
251
  readonly spellcheck?: boolean;
223
252
  readonly tabIndex?: number;
224
253
  readonly disabled?: boolean;
@@ -322,7 +351,7 @@ export interface ProjectionOptions extends ProjectorOptions {
322
351
  }
323
352
  /**
324
353
  * Keeps an array of result objects synchronized with an array of source objects.
325
- * See {@link http://maquettejs.org/docs/arrays.html|Working with arrays}.
354
+ * See {@link http://maquettejs.org/docs/arrays.html Working with arrays}.
326
355
  *
327
356
  * Mapping provides a [[map]] function that updates its [[results]].
328
357
  * The [[map]] function can be called multiple times and the results will get created, removed and updated accordingly.
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["export interface ProjectorService {\n /**\n * Instructs the projector to re-render to the DOM at the next animation-frame using the registered `render` functions.\n * This method is automatically called for you when event-handlers that are registered in the [[VNode]]s are invoked.\n *\n * You need to call this method when timeouts expire, when AJAX responses arrive or other asynchronous actions happen.\n */\n scheduleRender(): void;\n /**\n * Synchronously re-renders to the DOM. You should normally call the `scheduleRender()` function to keep the\n * user interface more performant. There is however one good reason to call renderNow(),\n * when you want to put the focus into a newly created element in iOS.\n * This is only allowed when triggered by a user-event, not during requestAnimationFrame.\n */\n renderNow(): void;\n}\n\nexport interface Projector extends ProjectorService {\n /**\n * Appends a new child node to the DOM using the result from the provided `renderFunction`.\n * The `renderFunction` will be invoked again to update the DOM when needed.\n * @param parentNode - The parent node for the new child node.\n * @param renderFunction - Function with zero arguments that returns a [[VNode]] tree.\n */\n append(parentNode: Element, renderFunction: () => VNode): void;\n /**\n * Inserts a new DOM node using the result from the provided `renderFunction`.\n * The `renderFunction` will be invoked again to update the DOM when needed.\n * @param beforeNode - The node that the DOM Node is inserted before.\n * @param renderFunction - Function with zero arguments that returns a [[VNode]] tree.\n */\n insertBefore(beforeNode: Element, renderFunction: () => VNode): void;\n /**\n * Merges a new DOM node using the result from the provided `renderFunction` with an existing DOM Node.\n * This means that the virtual DOM and real DOM 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 * The `renderFunction` will be invoked again to update the DOM when needed.\n * @param domNode - The existing element to adopt as the root of the new virtual DOM. Existing attributes and child nodes are preserved.\n * @param renderFunction - Function with zero arguments that returns a [[VNode]] tree.\n */\n merge(domNode: Element, renderFunction: () => VNode): void;\n /**\n * Replaces an existing DOM node with the result from the provided `renderFunction`.\n * The `renderFunction` will be invoked again to update the DOM when needed.\n * @param domNode - The DOM node to replace.\n * @param renderFunction - Function with zero arguments that returns a [[VNode]] tree.\n */\n replace(domNode: Element, renderFunction: () => VNode): void;\n /**\n * Resumes the projector. Use this method to resume rendering after [[stop]] was called or an error occurred during rendering.\n */\n resume(): void;\n /**\n * Stops running the `renderFunction` to update the DOM. The `renderFunction` must have been\n * registered using [[append]], [[merge]], [[insertBefore]] or [[replace]].\n *\n * @returns The [[Projection]] which was created using this `renderFunction`.\n * The [[Projection]] contains a reference to the DOM Node that was rendered.\n */\n detach(renderFunction: () => VNode): Projection;\n /**\n * Stops the projector. This means that the registered `render` functions will not be called anymore.\n *\n * Note that calling [[stop]] is not mandatory. A projector is a passive object that will get garbage collected\n * as usual if it is no longer in scope.\n */\n stop(): void;\n}\n\n/**\n * A virtual representation of a DOM Node. Maquette assumes that [[VNode]] objects are never modified externally.\n * Instances of [[VNode]] can be created using [[h]].\n */\nexport interface VNode {\n /**\n * The CSS selector containing tagname, css classnames and id. An empty string is used to denote a text node.\n */\n readonly vnodeSelector: string;\n /**\n * Object containing attributes, properties, event handlers and more, see [[h]].\n */\n readonly properties: VNodeProperties | undefined;\n /**\n * Array of [[VNode]]s to be used as children. This array is already flattened.\n */\n readonly children: VNode[] | undefined;\n /**\n * Used in a special case when a [[VNode]] only has one child node which is a text node. Only used in combination with children === undefined.\n */\n readonly text: string | undefined;\n /**\n * Used by maquette to store the domNode that was produced from this [[VNode]].\n */\n domNode: Node | null;\n}\n\n/**\n * Object containing attributes, properties, event handlers and more that can be put on DOM nodes.\n *\n * For your convenience, all common attributes, properties and event handlers are listed here and are\n * type-checked when using Typescript.\n */\nexport interface VNodeProperties {\n /**\n * The animation to perform when this node is added to an already existing parent.\n * {@link http://maquettejs.org/docs/animations.html|More about animations}.\n * @param element - Element that was just added to the DOM.\n * @param properties - The properties object that was supplied to the [[h]] method\n */\n enterAnimation?: (element: Element, properties?: VNodeProperties) => void;\n /**\n * The animation to perform when this node is removed while its parent remains.\n * @param element - Element that ought to be removed from to the DOM.\n * @param removeElement - Function that removes the element from the DOM.\n * This argument is provided purely for convenience.\n * You may use this function to remove the element when the animation is done.\n * @param properties - The properties object that was supplied to the [[h]] method that rendered this [[VNode]] the previous time.\n */\n exitAnimation?(element: Element, removeElement: () => void, properties?: VNodeProperties): void;\n /**\n * The animation to perform when the properties of this node change.\n * This also includes attributes, styles, css classes. This callback is also invoked when node contains only text and that text changes.\n * {@link http://maquettejs.org/docs/animations.html|More about animations}.\n * @param element - Element that was modified in the DOM.\n * @param properties - The last properties object that was supplied to the [[h]] method\n * @param previousProperties - The previous properties object that was supplied to the [[h]] method\n */\n updateAnimation?(\n element: Element,\n properties?: VNodeProperties,\n previousProperties?: VNodeProperties\n ): void;\n /**\n * Callback that is executed after this node is added to the DOM. Child nodes and properties have\n * already been applied.\n * @param element - The element that was added to the DOM.\n * @param projectionOptions - The projection options that were used, see [[createProjector]].\n * @param vnodeSelector - The selector passed to the [[h]] function.\n * @param properties - The properties passed to the [[h]] function.\n * @param children - The children that were created.\n */\n afterCreate?(\n element: Element,\n projectionOptions: ProjectionOptions,\n vnodeSelector: string,\n properties: VNodeProperties,\n children: VNode[] | undefined\n ): void;\n /**\n * Callback that is executed every time this node may have been updated. Child nodes and properties\n * have already been updated.\n * @param element - The element that may have been updated in the DOM.\n * @param projectionOptions - The projection options that were used, see [[createProjector]].\n * @param vnodeSelector - The selector passed to the [[h]] function.\n * @param properties - The properties passed to the [[h]] function.\n * @param children - The children for this node.\n */\n afterUpdate?(\n element: Element,\n projectionOptions: ProjectionOptions,\n vnodeSelector: string,\n properties: VNodeProperties,\n children: VNode[] | undefined\n ): void;\n\n /**\n * Callback that is called when a node has been removed from the tree.\n * The callback is called during idle state or after a timeout (fallback).\n * {@link https://maquettejs.org/docs/dom-node-removal.html|More info}\n * @param element - The element that has been removed from the DOM.\n */\n afterRemoved?(element: Element): void;\n /**\n * When specified, the event handlers will be invoked with 'this' pointing to the value.\n * This is useful when using the prototype/class based implementation of MaquetteComponents.\n *\n * When no [[key]] is present, this object is also used to uniquely identify a DOM node.\n */\n readonly bind?: unknown;\n /**\n * Used to uniquely identify a DOM node among siblings.\n * A key is required when there are more children with the same selector and these children are added or removed dynamically.\n * NOTE: this does not have to be a string or number, a [[MaquetteComponent]] Object for instance is also common.\n */\n readonly key?: unknown;\n /**\n * An object literal like `{important:true}` which allows css classes, like `important` to be added and removed\n * dynamically.\n */\n readonly classes?: { [index: string]: boolean | null | undefined };\n /**\n * An object literal like `{height:'100px'}` which allows styles to be changed dynamically. All values must be strings.\n */\n readonly styles?: Partial<CSSStyleDeclaration> | { [cssVariable: string]: string };\n /**\n * For custom elements\n */\n readonly is?: string;\n\n // From Element\n ontouchcancel?(ev: TouchEvent): boolean | void;\n ontouchend?(ev: TouchEvent): boolean | void;\n ontouchmove?(ev: TouchEvent): boolean | void;\n ontouchstart?(ev: TouchEvent): boolean | void;\n // From HTMLFormElement\n readonly action?: string;\n readonly encoding?: string;\n readonly enctype?: string;\n readonly method?: string;\n readonly name?: string;\n readonly target?: string;\n // From HTMLAnchorElement\n readonly href?: string;\n readonly rel?: string;\n // From HTMLElement\n onblur?(ev: FocusEvent): boolean | void;\n onchange?(ev: Event): boolean | void;\n onclick?(ev: MouseEvent): boolean | void;\n ondblclick?(ev: MouseEvent): boolean | void;\n ondrag?(ev: DragEvent): boolean | void;\n ondragend?(ev: DragEvent): boolean | void;\n ondragenter?(ev: DragEvent): boolean | void;\n ondragleave?(ev: DragEvent): boolean | void;\n ondragover?(ev: DragEvent): boolean | void;\n ondragstart?(ev: DragEvent): boolean | void;\n ondrop?(ev: DragEvent): boolean | void;\n onfocus?(ev: FocusEvent): boolean | void;\n oninput?(ev: Event): boolean | void;\n onkeydown?(ev: KeyboardEvent): boolean | void;\n onkeypress?(ev: KeyboardEvent): boolean | void;\n onkeyup?(ev: KeyboardEvent): boolean | void;\n onload?(ev: Event): boolean | void;\n onmousedown?(ev: MouseEvent): boolean | void;\n onmouseenter?(ev: MouseEvent): boolean | void;\n onmouseleave?(ev: MouseEvent): boolean | void;\n onmousemove?(ev: MouseEvent): boolean | void;\n onmouseout?(ev: MouseEvent): boolean | void;\n onmouseover?(ev: MouseEvent): boolean | void;\n onmouseup?(ev: MouseEvent): boolean | void;\n onmousewheel?(ev: WheelEvent): boolean | void;\n onscroll?(ev: UIEvent): boolean | void;\n onsubmit?(ev: Event): boolean | void;\n readonly spellcheck?: boolean;\n readonly tabIndex?: number;\n readonly disabled?: boolean;\n readonly title?: string;\n readonly accessKey?: string;\n readonly class?: string;\n readonly id?: string;\n readonly draggable?: boolean;\n // From HTMLInputElement\n readonly type?: string;\n readonly autocomplete?: string;\n readonly checked?: boolean;\n readonly placeholder?: string;\n readonly readOnly?: boolean;\n readonly src?: string;\n readonly value?: string;\n // From HTMLImageElement\n readonly alt?: string;\n readonly srcset?: string;\n /**\n * Puts a non-interactive string of html inside the DOM node.\n *\n * Note: if you use innerHTML, maquette cannot protect you from XSS vulnerabilities and you must make sure that the innerHTML value is safe.\n */\n readonly innerHTML?: string;\n\n /**\n * Do not use className, use class instead\n */\n readonly className?: never | \"Hint: do not use `className`, use `class` instead\";\n\n /**\n * Everything that is not explicitly listed (properties and attributes that are either uncommon or custom).\n */\n readonly [index: string]: any;\n}\n\n/**\n * Only needed for the definition of [[VNodeChild]].\n * @deprecated use VNodeChild\n */\nexport interface VNodeChildren extends Array<VNodeChild> {}\n/**\n * These are valid values for the children parameter of the [[h]] function.\n */\nexport type VNodeChild = string | VNode | Array<VNodeChild> | false | null | undefined;\n\n/**\n * Represents a [[VNode]] tree that has been rendered to a real DOM tree.\n */\nexport interface Projection {\n /**\n * The DOM node that is used as the root of this [[Projection]].\n */\n readonly domNode: Element;\n /**\n * Updates the real DOM to match the new virtual DOM tree.\n * @param updatedVnode The updated virtual DOM tree. Note: The selector for the root of the [[VNode]] tree may not change.\n */\n update(updatedVnode: VNode): void;\n getLastRender(): VNode;\n}\n\nexport type EventHandler = (this: Node, event: Event) => boolean | undefined | void;\n\n/**\n * Options that influence how the DOM is rendered and updated.\n */\nexport type EventHandlerInterceptor = (\n propertyName: string,\n eventHandler: EventHandler,\n domNode: Node,\n properties: VNodeProperties\n) => undefined | EventHandler;\n\nexport type PerformanceLoggerEvent =\n | \"domEvent\"\n | \"domEventProcessed\"\n | \"renderStart\"\n | \"rendered\"\n | \"patched\"\n | \"renderDone\";\nexport type ProjectorPerformanceLogger = (\n eventType: PerformanceLoggerEvent,\n trigger: Event | undefined\n) => void;\n/**\n * Options that may be passed when creating the [[Projector]]\n */\nexport interface ProjectorOptions {\n /**\n * Can be used to log performance metrics\n */\n performanceLogger?: ProjectorPerformanceLogger;\n\n /**\n * May be used to add vendor prefixes when applying inline styles when needed.\n * This function is called when {@link VNodeProperties#styles} is used.\n * This function should execute `domNode.style[styleName] = value` or do something smarter.\n *\n * @param domNode The DOM Node that needs to receive the style\n * @param styleName The name of the style that should be applied, for example `transform`.\n * @param value The value of this style, for example `rotate(45deg)`.\n */\n styleApplyer?(domNode: HTMLElement, styleName: string, value: string): void;\n}\n\nexport interface ProjectionOptions extends ProjectorOptions {\n /**\n * Only for internal use. Used for rendering SVG Nodes.\n */\n readonly namespace?: string;\n /**\n * May be used to intercept registration of event-handlers.\n *\n * Used by the [[Projector]] to wrap eventHandler-calls to call {@link Projector#scheduleRender} as well.\n *\n * @param propertyName The name of the property to be assigned, for example onclick\n * @param eventHandler The function that was registered on the [[VNode]]\n * @param domNode The real DOM element\n * @param properties The whole set of properties that was put on the VNode\n * @returns The function that is to be placed on the DOM node as the event handler, instead of `eventHandler`.\n */\n eventHandlerInterceptor?: EventHandlerInterceptor;\n}\n\n/**\n * 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 * Mapping provides a [[map]] function that updates its [[results]].\n * The [[map]] function can be called multiple times and the results will get created, removed and updated accordingly.\n * A Mapping can be used to keep an array of components (objects with a `render` method) synchronized with an array of data.\n * Instances of Mapping can be created using [[createMapping]].\n *\n * @param <Source> The type of source elements. Usually the data type.\n * @param <Target> The type of target elements. Usually the component type.\n */\nexport interface Mapping<Source, Target> {\n /**\n * The array of results. These results will be synchronized with the latest array of sources that were provided using [[map]].\n */\n results: Target[];\n /**\n * Maps a new array of sources and updates [[results]].\n *\n * @param newSources The new array of sources.\n */\n map(newSources: Source[]): void;\n}\n\n/**\n * A CalculationCache object remembers the previous outcome of a calculation along with the inputs.\n * On subsequent calls the previous outcome is returned if the inputs are identical.\n * This object can be used to bypass both rendering and diffing of a virtual DOM subtree.\n * Instances of CalculationCache can be created using [[createCache]].\n *\n * @param <Result> The type of the value that is cached.\n */\nexport interface CalculationCache<Result> {\n /**\n * Manually invalidates the cached outcome.\n */\n invalidate(): void;\n /**\n * If the inputs array matches the inputs array from the previous invocation, this method returns the result of the previous invocation.\n * Otherwise, the calculation function is invoked and its result is cached and returned.\n * Objects in the inputs array are compared using ===.\n * @param inputs - Array of objects that are to be compared using === with the inputs from the previous invocation.\n * These objects are assumed to be immutable primitive values.\n * @param calculation - Function that takes zero arguments and returns an object (A [[VNode]] presumably) that can be cached.\n */\n result(inputs: unknown[], calculation: () => Result): Result;\n}\n\n/**\n * @deprecated Use [[MaquetteComponent]] instead.\n * @since 3.0\n */\nexport interface Component {\n renderMaquette(): VNode | null | undefined;\n}\n\n/**\n * A component is a pattern with which you can split up your web application into self-contained parts.\n *\n * A component may contain other components.\n * This can be achieved by calling the subcomponents `render` functions during the [[render]] function and by using the\n * resulting [[VNode]]s in the return value.\n *\n * This interface is not used anywhere in the maquette sourcecode, but this is a widely used pattern.\n */\nexport interface MaquetteComponent {\n /**\n * A function that returns the DOM representation of the component.\n */\n render(): VNode | null | undefined;\n}\n\nexport interface 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(vnode: VNode, projectionOptions?: ProjectionOptions): Projection;\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(parentNode: Element, vnode: VNode, projectionOptions?: ProjectionOptions): Projection;\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(\n beforeNode: Element,\n vnode: VNode,\n projectionOptions?: ProjectionOptions\n ): Projection;\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(element: Element, vnode: VNode, projectionOptions?: ProjectionOptions): Projection;\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(element: Element, vnode: VNode, projectionOptions?: ProjectionOptions): Projection;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["export interface ProjectorService {\n /**\n * Instructs the projector to re-render to the DOM at the next animation-frame using the registered `render` functions.\n * This method is automatically called for you when event-handlers that are registered in the [[VNode]]s are invoked.\n *\n * You need to call this method when timeouts expire, when AJAX responses arrive or other asynchronous actions happen.\n */\n scheduleRender(): void;\n /**\n * Synchronously re-renders to the DOM. You should normally call the `scheduleRender()` function to keep the\n * user interface more performant. There is however one good reason to call renderNow(),\n * when you want to put the focus into a newly created element in iOS.\n * This is only allowed when triggered by a user-event, not during requestAnimationFrame.\n */\n renderNow(): void;\n}\n\nexport interface Projector extends ProjectorService {\n /**\n * Appends a new child node to the DOM using the result from the provided `renderFunction`.\n * The `renderFunction` will be invoked again to update the DOM when needed.\n * @param parentNode - The parent node for the new child node.\n * @param renderFunction - Function with zero arguments that returns a [[VNode]] tree.\n */\n append(parentNode: Element, renderFunction: () => VNode): void;\n /**\n * Inserts a new DOM node using the result from the provided `renderFunction`.\n * The `renderFunction` will be invoked again to update the DOM when needed.\n * @param beforeNode - The node that the DOM Node is inserted before.\n * @param renderFunction - Function with zero arguments that returns a [[VNode]] tree.\n */\n insertBefore(beforeNode: Element, renderFunction: () => VNode): void;\n /**\n * Merges a new DOM node using the result from the provided `renderFunction` with an existing DOM Node.\n * This means that the virtual DOM and real DOM 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 * The `renderFunction` will be invoked again to update the DOM when needed.\n * @param domNode - The existing element to adopt as the root of the new virtual DOM. Existing attributes and child nodes are preserved.\n * @param renderFunction - Function with zero arguments that returns a [[VNode]] tree.\n */\n merge(domNode: Element, renderFunction: () => VNode): void;\n /**\n * Replaces an existing DOM node with the result from the provided `renderFunction`.\n * The `renderFunction` will be invoked again to update the DOM when needed.\n * @param domNode - The DOM node to replace.\n * @param renderFunction - Function with zero arguments that returns a [[VNode]] tree.\n */\n replace(domNode: Element, renderFunction: () => VNode): void;\n /**\n * Resumes the projector. Use this method to resume rendering after [[stop]] was called or an error occurred during rendering.\n */\n resume(): void;\n /**\n * Stops running the `renderFunction` to update the DOM. The `renderFunction` must have been\n * registered using [[append]], [[merge]], [[insertBefore]] or [[replace]].\n *\n * @returns The [[Projection]] which was created using this `renderFunction`.\n * The [[Projection]] contains a reference to the DOM Node that was rendered.\n */\n detach(renderFunction: () => VNode): Projection;\n /**\n * Stops the projector. This means that the registered `render` functions will not be called anymore.\n *\n * Note that calling [[stop]] is not mandatory. A projector is a passive object that will get garbage collected\n * as usual if it is no longer in scope.\n */\n stop(): void;\n}\n\n/**\n * A virtual representation of a DOM Node. Maquette assumes that [[VNode]] objects are never modified externally.\n * Instances of [[VNode]] can be created using [[h]].\n */\nexport interface VNode {\n /**\n * The CSS selector containing tagname, css classnames and id. An empty string is used to denote a text node.\n */\n readonly vnodeSelector: string;\n /**\n * Object containing attributes, properties, event handlers and more, see [[h]].\n */\n readonly properties: VNodeProperties | undefined;\n /**\n * Array of [[VNode]]s to be used as children. This array is already flattened.\n */\n readonly children: VNode[] | undefined;\n /**\n * Used in a special case when a [[VNode]] only has one child node which is a text node. Only used in combination with children === undefined.\n */\n readonly text: string | undefined;\n /**\n * Used by maquette to store the domNode that was produced from this [[VNode]].\n */\n domNode: Node | null;\n}\n\n/**\n * Object containing attributes, properties, event handlers and more that can be put on DOM nodes.\n *\n * For your convenience, all common attributes, properties and event handlers are listed here and are\n * type-checked when using Typescript.\n */\nexport interface VNodeProperties {\n /**\n * The animation to perform when this node is added to an already existing parent.\n * {@link http://maquettejs.org/docs/animations.html More about animations}.\n * @param element - Element that was just added to the DOM.\n * @param properties - The properties object that was supplied to the [[h]] method\n */\n enterAnimation?: (element: Element, properties?: VNodeProperties) => void;\n /**\n * The animation to perform when this node is removed while its parent remains.\n * @param element - Element that ought to be removed from to the DOM.\n * @param removeElement - Function that removes the element from the DOM.\n * This argument is provided purely for convenience.\n * You may use this function to remove the element when the animation is done.\n * @param properties - The properties object that was supplied to the [[h]] method that rendered this [[VNode]] the previous time.\n */\n exitAnimation?(element: Element, removeElement: () => void, properties?: VNodeProperties): void;\n /**\n * The animation to perform when the properties of this node change.\n * This also includes attributes, styles, css classes. This callback is also invoked when node contains only text and that text changes.\n * {@link http://maquettejs.org/docs/animations.html More about animations}.\n * @param element - Element that was modified in the DOM.\n * @param properties - The last properties object that was supplied to the [[h]] method\n * @param previousProperties - The previous properties object that was supplied to the [[h]] method\n */\n updateAnimation?(\n element: Element,\n properties?: VNodeProperties,\n previousProperties?: VNodeProperties\n ): void;\n /**\n * Callback that is executed after this node is added to the DOM. Child nodes and properties have\n * already been applied.\n * @param element - The element that was added to the DOM.\n * @param projectionOptions - The projection options that were used, see [[createProjector]].\n * @param vnodeSelector - The selector passed to the [[h]] function.\n * @param properties - The properties passed to the [[h]] function.\n * @param children - The children that were created.\n */\n afterCreate?(\n element: Element,\n projectionOptions: ProjectionOptions,\n vnodeSelector: string,\n properties: VNodeProperties,\n children: VNode[] | undefined\n ): void;\n /**\n * Callback that is executed every time this node may have been updated. Child nodes and properties\n * have already been updated.\n * @param element - The element that may have been updated in the DOM.\n * @param projectionOptions - The projection options that were used, see [[createProjector]].\n * @param vnodeSelector - The selector passed to the [[h]] function.\n * @param properties - The properties passed to the [[h]] function.\n * @param children - The children for this node.\n */\n afterUpdate?(\n element: Element,\n projectionOptions: ProjectionOptions,\n vnodeSelector: string,\n properties: VNodeProperties,\n children: VNode[] | undefined\n ): void;\n\n /**\n * Callback that is called when a node has been removed from the tree.\n * The callback is called during idle state or after a timeout (fallback).\n * {@link https://maquettejs.org/docs/dom-node-removal.html More info}\n * @param element - The element that has been removed from the DOM.\n */\n afterRemoved?(element: Element): void;\n\n /**\n * When specified, the event handlers will be invoked with 'this' pointing to the value.\n * This is useful when using the prototype/class based implementation of MaquetteComponents.\n *\n * When no [[key]] is present, this object is also used to uniquely identify a DOM node.\n */\n readonly bind?: unknown;\n\n /**\n * Used to uniquely identify a DOM node among siblings.\n * A key is required when there are more children with the same selector and these children are added or removed dynamically.\n * NOTE: this does not have to be a string or number, a [[MaquetteComponent]] Object for instance is also common.\n */\n readonly key?: unknown;\n\n /**\n * An object containing event handlers to attach using addEventListener.\n * Note that `projector.scheduleRender()` is called automatically when these event handlers are invoked.\n */\n readonly on?: {\n [eventName: string]:\n | EventHandler\n | {\n listener: EventHandler;\n options: { capture?: boolean; passive?: boolean; once?: boolean };\n };\n };\n\n /**\n * An object containing event handlers to attach using addEventListener.\n * Note that `projector.scheduleRender()` is called automatically when these event handlers are invoked.\n */\n readonly onCapture?: { [eventName: string]: EventHandler };\n\n /**\n * An object literal like `{important:true}` which allows css classes, like `important` to be added and removed\n * dynamically.\n */\n readonly classes?: { [index: string]: boolean | null | undefined };\n\n /**\n * An object literal like `{height:'100px'}` which allows styles to be changed dynamically. All values must be strings.\n */\n readonly styles?: Partial<CSSStyleDeclaration> | { [cssVariable: string]: string };\n\n /**\n * For custom elements\n */\n readonly is?: string;\n\n // From Element\n ontouchcancel?(ev: TouchEvent): boolean | void;\n ontouchend?(ev: TouchEvent): boolean | void;\n ontouchmove?(ev: TouchEvent): boolean | void;\n ontouchstart?(ev: TouchEvent): boolean | void;\n // From HTMLFormElement\n readonly action?: string;\n readonly encoding?: string;\n readonly enctype?: string;\n readonly method?: string;\n readonly name?: string;\n readonly target?: string;\n // From HTMLAnchorElement\n readonly href?: string;\n readonly rel?: string;\n // From HTMLElement\n onblur?(ev: FocusEvent): boolean | void;\n onchange?(ev: Event): boolean | void;\n onclick?(ev: MouseEvent): boolean | void;\n ondblclick?(ev: MouseEvent): boolean | void;\n ondrag?(ev: DragEvent): boolean | void;\n ondragend?(ev: DragEvent): boolean | void;\n ondragenter?(ev: DragEvent): boolean | void;\n ondragleave?(ev: DragEvent): boolean | void;\n ondragover?(ev: DragEvent): boolean | void;\n ondragstart?(ev: DragEvent): boolean | void;\n ondrop?(ev: DragEvent): boolean | void;\n onfocus?(ev: FocusEvent): boolean | void;\n oninput?(ev: Event): boolean | void;\n onkeydown?(ev: KeyboardEvent): boolean | void;\n onkeypress?(ev: KeyboardEvent): boolean | void;\n onkeyup?(ev: KeyboardEvent): boolean | void;\n onload?(ev: Event): boolean | void;\n onmousedown?(ev: MouseEvent): boolean | void;\n onmouseenter?(ev: MouseEvent): boolean | void;\n onmouseleave?(ev: MouseEvent): boolean | void;\n onmousemove?(ev: MouseEvent): boolean | void;\n onmouseout?(ev: MouseEvent): boolean | void;\n onmouseover?(ev: MouseEvent): boolean | void;\n onmouseup?(ev: MouseEvent): boolean | void;\n onmousewheel?(ev: WheelEvent): boolean | void;\n onscroll?(ev: UIEvent): boolean | void;\n onsubmit?(ev: Event): boolean | void;\n onpointercancel?(ev: PointerEvent): boolean | void;\n onpointerdown?(ev: PointerEvent): boolean | void;\n onpointerenter?(ev: PointerEvent): boolean | void;\n onpointerleave?(ev: PointerEvent): boolean | void;\n onpointermove?(ev: PointerEvent): boolean | void;\n onpointerout?(ev: PointerEvent): boolean | void;\n onpointerover?(ev: PointerEvent): boolean | void;\n onpointerup?(ev: PointerEvent): boolean | void;\n readonly spellcheck?: boolean;\n readonly tabIndex?: number;\n readonly disabled?: boolean;\n readonly title?: string;\n readonly accessKey?: string;\n readonly class?: string;\n readonly id?: string;\n readonly draggable?: boolean;\n // From HTMLInputElement\n readonly type?: string;\n readonly autocomplete?: string;\n readonly checked?: boolean;\n readonly placeholder?: string;\n readonly readOnly?: boolean;\n readonly src?: string;\n readonly value?: string;\n // From HTMLImageElement\n readonly alt?: string;\n readonly srcset?: string;\n /**\n * Puts a non-interactive string of html inside the DOM node.\n *\n * Note: if you use innerHTML, maquette cannot protect you from XSS vulnerabilities and you must make sure that the innerHTML value is safe.\n */\n readonly innerHTML?: string;\n\n /**\n * Do not use className, use class instead\n */\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n readonly className?: never | \"Hint: do not use `className`, use `class` instead\";\n\n /**\n * Everything that is not explicitly listed (properties and attributes that are either uncommon or custom).\n */\n readonly [index: string]: any;\n}\n\n/**\n * Only needed for the definition of [[VNodeChild]].\n * @deprecated use VNodeChild\n */\nexport interface VNodeChildren extends Array<VNodeChild> {}\n/**\n * These are valid values for the children parameter of the [[h]] function.\n */\nexport type VNodeChild = string | VNode | Array<VNodeChild> | false | null | undefined;\n\n/**\n * Represents a [[VNode]] tree that has been rendered to a real DOM tree.\n */\nexport interface Projection {\n /**\n * The DOM node that is used as the root of this [[Projection]].\n */\n readonly domNode: Element;\n /**\n * Updates the real DOM to match the new virtual DOM tree.\n * @param updatedVnode The updated virtual DOM tree. Note: The selector for the root of the [[VNode]] tree may not change.\n */\n update(updatedVnode: VNode): void;\n getLastRender(): VNode;\n}\n\nexport type EventHandler = (this: Node, event: Event) => boolean | undefined | void;\n\n/**\n * Options that influence how the DOM is rendered and updated.\n */\nexport type EventHandlerInterceptor = (\n propertyName: string,\n eventHandler: EventHandler,\n domNode: Node,\n properties: VNodeProperties\n) => undefined | EventHandler;\n\nexport type PerformanceLoggerEvent =\n | \"domEvent\"\n | \"domEventProcessed\"\n | \"renderStart\"\n | \"rendered\"\n | \"patched\"\n | \"renderDone\";\nexport type ProjectorPerformanceLogger = (\n eventType: PerformanceLoggerEvent,\n trigger: Event | undefined\n) => void;\n/**\n * Options that may be passed when creating the [[Projector]]\n */\nexport interface ProjectorOptions {\n /**\n * Can be used to log performance metrics\n */\n performanceLogger?: ProjectorPerformanceLogger;\n\n /**\n * May be used to add vendor prefixes when applying inline styles when needed.\n * This function is called when {@link VNodeProperties#styles} is used.\n * This function should execute `domNode.style[styleName] = value` or do something smarter.\n *\n * @param domNode The DOM Node that needs to receive the style\n * @param styleName The name of the style that should be applied, for example `transform`.\n * @param value The value of this style, for example `rotate(45deg)`.\n */\n styleApplyer?(domNode: HTMLElement, styleName: string, value: string): void;\n}\n\nexport interface ProjectionOptions extends ProjectorOptions {\n /**\n * Only for internal use. Used for rendering SVG Nodes.\n */\n readonly namespace?: string;\n /**\n * May be used to intercept registration of event-handlers.\n *\n * Used by the [[Projector]] to wrap eventHandler-calls to call {@link Projector#scheduleRender} as well.\n *\n * @param propertyName The name of the property to be assigned, for example onclick\n * @param eventHandler The function that was registered on the [[VNode]]\n * @param domNode The real DOM element\n * @param properties The whole set of properties that was put on the VNode\n * @returns The function that is to be placed on the DOM node as the event handler, instead of `eventHandler`.\n */\n eventHandlerInterceptor?: EventHandlerInterceptor;\n}\n\n/**\n * 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 * Mapping provides a [[map]] function that updates its [[results]].\n * The [[map]] function can be called multiple times and the results will get created, removed and updated accordingly.\n * A Mapping can be used to keep an array of components (objects with a `render` method) synchronized with an array of data.\n * Instances of Mapping can be created using [[createMapping]].\n *\n * @param <Source> The type of source elements. Usually the data type.\n * @param <Target> The type of target elements. Usually the component type.\n */\nexport interface Mapping<Source, Target> {\n /**\n * The array of results. These results will be synchronized with the latest array of sources that were provided using [[map]].\n */\n results: Target[];\n /**\n * Maps a new array of sources and updates [[results]].\n *\n * @param newSources The new array of sources.\n */\n map(newSources: Source[]): void;\n}\n\n/**\n * A CalculationCache object remembers the previous outcome of a calculation along with the inputs.\n * On subsequent calls the previous outcome is returned if the inputs are identical.\n * This object can be used to bypass both rendering and diffing of a virtual DOM subtree.\n * Instances of CalculationCache can be created using [[createCache]].\n *\n * @param <Result> The type of the value that is cached.\n */\nexport interface CalculationCache<Result> {\n /**\n * Manually invalidates the cached outcome.\n */\n invalidate(): void;\n /**\n * If the inputs array matches the inputs array from the previous invocation, this method returns the result of the previous invocation.\n * Otherwise, the calculation function is invoked and its result is cached and returned.\n * Objects in the inputs array are compared using ===.\n * @param inputs - Array of objects that are to be compared using === with the inputs from the previous invocation.\n * These objects are assumed to be immutable primitive values.\n * @param calculation - Function that takes zero arguments and returns an object (A [[VNode]] presumably) that can be cached.\n */\n result(inputs: unknown[], calculation: () => Result): Result;\n}\n\n/**\n * @deprecated Use [[MaquetteComponent]] instead.\n * @since 3.0\n */\nexport interface Component {\n renderMaquette(): VNode | null | undefined;\n}\n\n/**\n * A component is a pattern with which you can split up your web application into self-contained parts.\n *\n * A component may contain other components.\n * This can be achieved by calling the subcomponents `render` functions during the [[render]] function and by using the\n * resulting [[VNode]]s in the return value.\n *\n * This interface is not used anywhere in the maquette sourcecode, but this is a widely used pattern.\n */\nexport interface MaquetteComponent {\n /**\n * A function that returns the DOM representation of the component.\n */\n render(): VNode | null | undefined;\n}\n\nexport interface 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(vnode: VNode, projectionOptions?: ProjectionOptions): Projection;\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(parentNode: Element, vnode: VNode, projectionOptions?: ProjectionOptions): Projection;\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(\n beforeNode: Element,\n vnode: VNode,\n projectionOptions?: ProjectionOptions\n ): Projection;\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(element: Element, vnode: VNode, projectionOptions?: ProjectionOptions): Projection;\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(element: Element, vnode: VNode, projectionOptions?: ProjectionOptions): Projection;\n}\n"]}
package/dist/mapping.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Mapping } from "./interfaces";
2
2
  /**
3
3
  * Creates a {@link Mapping} instance that keeps an array of result objects synchronized with an array of source objects.
4
- * See {@link http://maquettejs.org/docs/arrays.html|Working with arrays}.
4
+ * See {@link http://maquettejs.org/docs/arrays.html Working with arrays}.
5
5
  *
6
6
  * @param <Source> The type of source items. A database-record for instance.
7
7
  * @param <Target> The type of target items. A [[MaquetteComponent]] for instance.
package/dist/mapping.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Creates a {@link Mapping} instance that keeps an array of result objects synchronized with an array of source objects.
3
- * See {@link http://maquettejs.org/docs/arrays.html|Working with arrays}.
3
+ * See {@link http://maquettejs.org/docs/arrays.html Working with arrays}.
4
4
  *
5
5
  * @param <Source> The type of source items. A database-record for instance.
6
6
  * @param <Target> The type of target items. A [[MaquetteComponent]] for instance.
@@ -1 +1 @@
1
- {"version":3,"file":"mapping.js","sourceRoot":"","sources":["../src/mapping.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,IAAI,aAAa,GAAG,UACzB,YAAiD,EACjD,YAAuD,EACvD,YAAqE;IAErE,IAAI,IAAI,GAAG,EAAe,CAAC;IAC3B,IAAI,OAAO,GAAG,EAAc,CAAC;IAE7B,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,GAAG,EAAE,UAAC,UAAoB;YACxB,IAAI,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAC3C,IAAI,UAAU,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;YACjC,IAAI,QAAQ,GAAG,CAAC,CAAC;YACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC1C,IAAI,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC3B,IAAI,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;gBAC3B,IAAI,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,EAAE;oBAChC,OAAO,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;oBAClC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;oBAC9C,QAAQ,EAAE,CAAC;iBACZ;qBAAM;oBACL,IAAI,KAAK,GAAG,KAAK,CAAC;oBAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;wBACxC,IAAI,WAAW,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;wBAC/C,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,SAAS,EAAE;4BACnC,OAAO,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;4BACrC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;4BACxD,QAAQ,GAAG,WAAW,GAAG,CAAC,CAAC;4BAC3B,KAAK,GAAG,IAAI,CAAC;4BACb,MAAM;yBACP;qBACF;oBACD,IAAI,CAAC,KAAK,EAAE;wBACV,OAAO,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;qBACtC;iBACF;aACF;YACD,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;YACnC,IAAI,GAAG,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Mapping } from \"./interfaces\";\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 <Source> The type of source items. A database-record for instance.\n * @param <Target> The type of target items. A [[MaquetteComponent]] 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 */\nexport let createMapping = <Source, Target>(\n getSourceKey: (source: Source) => string | number,\n createResult: (source: Source, index: number) => Target,\n updateResult: (source: Source, target: Target, index: number) => void\n): Mapping<Source, Target> => {\n let keys = [] as unknown[];\n let results = [] as Target[];\n\n return {\n results: results,\n map: (newSources: Source[]) => {\n let newKeys = newSources.map(getSourceKey);\n let oldTargets = results.slice();\n let oldIndex = 0;\n for (let i = 0; i < newSources.length; i++) {\n let source = newSources[i];\n let sourceKey = newKeys[i];\n if (sourceKey === keys[oldIndex]) {\n results[i] = oldTargets[oldIndex];\n updateResult(source, oldTargets[oldIndex], i);\n oldIndex++;\n } else {\n let found = false;\n for (let j = 1; j < keys.length + 1; j++) {\n let 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"]}
1
+ {"version":3,"file":"mapping.js","sourceRoot":"","sources":["../src/mapping.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,IAAI,aAAa,GAAG,UACzB,YAAiD,EACjD,YAAuD,EACvD,YAAqE;IAErE,IAAI,IAAI,GAAG,EAAe,CAAC;IAC3B,IAAI,OAAO,GAAG,EAAc,CAAC;IAE7B,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,GAAG,EAAE,UAAC,UAAoB;YACxB,IAAI,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAC3C,IAAI,UAAU,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;YACjC,IAAI,QAAQ,GAAG,CAAC,CAAC;YACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC3C,IAAI,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC3B,IAAI,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;gBAC3B,IAAI,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;oBACjC,OAAO,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;oBAClC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;oBAC9C,QAAQ,EAAE,CAAC;gBACb,CAAC;qBAAM,CAAC;oBACN,IAAI,KAAK,GAAG,KAAK,CAAC;oBAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;wBACzC,IAAI,WAAW,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;wBAC/C,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,SAAS,EAAE,CAAC;4BACpC,OAAO,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;4BACrC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;4BACxD,QAAQ,GAAG,WAAW,GAAG,CAAC,CAAC;4BAC3B,KAAK,GAAG,IAAI,CAAC;4BACb,MAAM;wBACR,CAAC;oBACH,CAAC;oBACD,IAAI,CAAC,KAAK,EAAE,CAAC;wBACX,OAAO,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;oBACvC,CAAC;gBACH,CAAC;YACH,CAAC;YACD,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;YACnC,IAAI,GAAG,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Mapping } from \"./interfaces\";\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 <Source> The type of source items. A database-record for instance.\n * @param <Target> The type of target items. A [[MaquetteComponent]] 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 */\nexport let createMapping = <Source, Target>(\n getSourceKey: (source: Source) => string | number,\n createResult: (source: Source, index: number) => Target,\n updateResult: (source: Source, target: Target, index: number) => void\n): Mapping<Source, Target> => {\n let keys = [] as unknown[];\n let results = [] as Target[];\n\n return {\n results: results,\n map: (newSources: Source[]) => {\n let newKeys = newSources.map(getSourceKey);\n let oldTargets = results.slice();\n let oldIndex = 0;\n for (let i = 0; i < newSources.length; i++) {\n let source = newSources[i];\n let sourceKey = newKeys[i];\n if (sourceKey === keys[oldIndex]) {\n results[i] = oldTargets[oldIndex];\n updateResult(source, oldTargets[oldIndex], i);\n oldIndex++;\n } else {\n let found = false;\n for (let j = 1; j < keys.length + 1; j++) {\n let 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"]}
@@ -167,6 +167,19 @@ var setProperties = function (domNode, properties, projectionOptions) {
167
167
  }
168
168
  }
169
169
  }
170
+ else if (propName === "on" && propValue) {
171
+ // object with string keys and function values
172
+ for (var _i = 0, _a = Object.entries(properties.on); _i < _a.length; _i++) {
173
+ var _b = _a[_i], key = _b[0], handler = _b[1];
174
+ var listener = typeof handler === "function" ? handler : handler.listener;
175
+ if (eventHandlerInterceptor) {
176
+ listener = eventHandlerInterceptor(key, listener, domNode, properties);
177
+ }
178
+ if (listener) {
179
+ domNode.addEventListener(key, listener, typeof handler === "function" ? undefined : handler.options);
180
+ }
181
+ }
182
+ }
170
183
  else if (propName !== "key" && propValue !== null && propValue !== undefined) {
171
184
  var type = typeof propValue;
172
185
  if (type === "function") {
@@ -724,6 +737,7 @@ var findVNodeByParentNodePath = function (vnode, parentNodePath) {
724
737
  var createEventHandlerInterceptor = function (projector, getProjection, performanceLogger) {
725
738
  return function (propertyName, eventHandler, domNode, properties) { return modifiedEventHandler; };
726
739
  function modifiedEventHandler(evt) {
740
+ var _a, _b;
727
741
  performanceLogger("domEvent", evt);
728
742
  var projection = getProjection();
729
743
  var parentNodePath = createParentNodePath(evt.currentTarget, projection.domNode);
@@ -733,7 +747,8 @@ var createEventHandlerInterceptor = function (projector, getProjection, performa
733
747
  var result;
734
748
  if (matchingVNode) {
735
749
  /* eslint-disable prefer-rest-params */
736
- result = matchingVNode.properties["on".concat(evt.type)].apply(matchingVNode.properties.bind || this, arguments);
750
+ var listener = (_b = (_a = matchingVNode.properties["on".concat(evt.type)]) !== null && _a !== void 0 ? _a : matchingVNode.properties.on[evt.type].listener) !== null && _b !== void 0 ? _b : matchingVNode.properties.on[evt.type];
751
+ result = listener.apply(matchingVNode.properties.bind || this, arguments);
737
752
  /* eslint-enable prefer-rest-params */
738
753
  }
739
754
  performanceLogger("domEventProcessed", evt);
@@ -862,7 +877,7 @@ var createCache = function () {
862
877
 
863
878
  /**
864
879
  * Creates a {@link Mapping} instance that keeps an array of result objects synchronized with an array of source objects.
865
- * See {@link http://maquettejs.org/docs/arrays.html|Working with arrays}.
880
+ * See {@link http://maquettejs.org/docs/arrays.html Working with arrays}.
866
881
  *
867
882
  * @param <Source> The type of source items. A database-record for instance.
868
883
  * @param <Target> The type of target items. A [[MaquetteComponent]] for instance.
@@ -171,6 +171,19 @@
171
171
  }
172
172
  }
173
173
  }
174
+ else if (propName === "on" && propValue) {
175
+ // object with string keys and function values
176
+ for (var _i = 0, _a = Object.entries(properties.on); _i < _a.length; _i++) {
177
+ var _b = _a[_i], key = _b[0], handler = _b[1];
178
+ var listener = typeof handler === "function" ? handler : handler.listener;
179
+ if (eventHandlerInterceptor) {
180
+ listener = eventHandlerInterceptor(key, listener, domNode, properties);
181
+ }
182
+ if (listener) {
183
+ domNode.addEventListener(key, listener, typeof handler === "function" ? undefined : handler.options);
184
+ }
185
+ }
186
+ }
174
187
  else if (propName !== "key" && propValue !== null && propValue !== undefined) {
175
188
  var type = typeof propValue;
176
189
  if (type === "function") {
@@ -728,6 +741,7 @@
728
741
  var createEventHandlerInterceptor = function (projector, getProjection, performanceLogger) {
729
742
  return function (propertyName, eventHandler, domNode, properties) { return modifiedEventHandler; };
730
743
  function modifiedEventHandler(evt) {
744
+ var _a, _b;
731
745
  performanceLogger("domEvent", evt);
732
746
  var projection = getProjection();
733
747
  var parentNodePath = createParentNodePath(evt.currentTarget, projection.domNode);
@@ -737,7 +751,8 @@
737
751
  var result;
738
752
  if (matchingVNode) {
739
753
  /* eslint-disable prefer-rest-params */
740
- result = matchingVNode.properties["on".concat(evt.type)].apply(matchingVNode.properties.bind || this, arguments);
754
+ var listener = (_b = (_a = matchingVNode.properties["on".concat(evt.type)]) !== null && _a !== void 0 ? _a : matchingVNode.properties.on[evt.type].listener) !== null && _b !== void 0 ? _b : matchingVNode.properties.on[evt.type];
755
+ result = listener.apply(matchingVNode.properties.bind || this, arguments);
741
756
  /* eslint-enable prefer-rest-params */
742
757
  }
743
758
  performanceLogger("domEventProcessed", evt);
@@ -866,7 +881,7 @@
866
881
 
867
882
  /**
868
883
  * Creates a {@link Mapping} instance that keeps an array of result objects synchronized with an array of source objects.
869
- * See {@link http://maquettejs.org/docs/arrays.html|Working with arrays}.
884
+ * See {@link http://maquettejs.org/docs/arrays.html Working with arrays}.
870
885
  *
871
886
  * @param <Source> The type of source items. A database-record for instance.
872
887
  * @param <Target> The type of target items. A [[MaquetteComponent]] for instance.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).maquette={})}(this,function(e){"use strict";function l(t,r){var o={};return Object.keys(t).forEach(function(e){o[e]=t[e]}),r&&Object.keys(r).forEach(function(e){o[e]=r[e]}),o}function t(e){(e.children||[]).forEach(t),e.properties&&e.properties.afterRemoved&&e.properties.afterRemoved.call(e.properties.bind||e.properties,e.domNode)}function r(){s=!1,a.forEach(t),a.length=0}function o(e){a.push(e),s||(s=!0,"undefined"!=typeof window&&"requestIdleCallback"in window?window.requestIdleCallback(r,{timeout:16}):setTimeout(r,16))}function f(e,t,r){c(e,t.children,r),t.text&&(e.textContent=t.text),p(e,t.properties,r),t.properties&&t.properties.afterCreate&&t.properties.afterCreate.call(t.properties.bind||t.properties,e,r,t.vnodeSelector,t.properties,t.children)}function n(t,r){return{getLastRender:function(){return t},update:function(e){if(t.vnodeSelector!==e.vnodeSelector)throw Error("The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)");x(t,t=e,r)},domNode:t.domNode}}function d(e){return l(u,e)}var i="http://www.w3.org/",A="".concat(i,"2000/svg"),S="".concat(i,"1999/xlink"),v=[],h=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)},w=function(e){if("string"!=typeof e)throw Error("Style values must be strings")},m=function(e,t,r){if(""!==t.vnodeSelector)for(var o=r;o<e.length;o++)if(h(e[o],t))return o;return-1},g=function(e,t,r,o){var n=e[t];if(""!==n.vnodeSelector){var i=n.properties;if(!(i&&(void 0===i.key?i.bind:i.key)))for(var d=0;d<e.length;d++)if(d!==t){var a=e[d];if(h(a,n))throw{error:Error("".concat(r.vnodeSelector," had a ").concat(n.vnodeSelector," child ").concat("added"===o?o:"removed",", but there is now more than one. You must add unique key properties to make them distinguishable.")),parentNode:r,childNode:n}}}},y=function(e){var t;e.properties&&(t=e.properties.enterAnimation)&&t(e.domNode,e.properties)},a=[],s=!1,N=function(e){var t=e.domNode;if(e.properties){var r=e.properties.exitAnimation;if(r)return t.style.pointerEvents="none",void r(t,function(){t.parentNode&&(t.parentNode.removeChild(t),o(e))},e.properties)}t.parentNode&&(t.parentNode.removeChild(t),o(e))},p=function(f,u,v){if(u)for(var h=v.eventHandlerInterceptor,m=Object.keys(u),e=m.length,g=0;g<e;g++)!function(){var e,t,r=m[g],o=u[r];if("className"===r)throw Error('Property "className" is not supported, use "class".');if("class"===r)k(f,o,!0);else if("classes"===r)for(var n=Object.keys(o),i=n.length,d=0;d<i;d++){var a=n[d];o[a]&&f.classList.add(a)}else if("styles"===r)for(var s=Object.keys(o),p=s.length,d=0;d<p;d++){var c=s[d],l=o[c];l&&(w(l),v.styleApplyer(f,c,l))}else"key"!==r&&null!=o&&("function"==(e=typeof o)?(r.lastIndexOf("on",0)||(h&&(o=h(r,o,f,u)),"oninput"===r&&(t=o,o=function(e){t.call(this,e),e.target["oninput-value"]=e.target.value})),f[r]=o):v.namespace===A?"href"===r?f.setAttributeNS(S,r,o):f.setAttribute(r,o):"string"==e&&"value"!==r&&"innerHTML"!==r?f.setAttribute(r,o):f[r]=o)}()},c=function(e,t,r){if(t)for(var o=0,n=t;o<n.length;o++){var i=n[o];b(i,e,void 0,r)}},b=function(e,t,r,o){var n,i=0,d=e.vnodeSelector,a=t.ownerDocument;if(""===d)e.domNode?e.domNode.nodeValue=e.text:(n=e.domNode=a.createTextNode(e.text),void 0!==r?t.insertBefore(n,r):t.appendChild(n));else{for(var s=0;s<=d.length;++s){var p,c=d[0|s]||"";s!==d.length&&"."!=c&&"#"!=c||(c=d[0|i-1]||"",p=d.slice(i,s),"."==c?n.classList.add(p):"#"==c?n.id=p:(void 0!==(o="svg"===p?l(o,{namespace:A}):o).namespace?n=e.domNode=a.createElementNS(o.namespace,p):(n=e.domNode=e.domNode||(null!=(c=e.properties)&&c.is?a.createElement(p,{is:e.properties.is}):a.createElement(p)),"input"===p&&e.properties&&void 0!==e.properties.type&&n.setAttribute("type",e.properties.type)),void 0!==r?t.insertBefore(n,r):n.parentNode!==t&&t.appendChild(n)),i=s+1)}f(n,e,o)}},k=function(t,e,r){e&&e.split(" ").forEach(function(e){e&&t.classList.toggle(e,r)})},x=function(e,t,r){var o=e.domNode;if(e!==t){var n,i=!1;if(""===t.vnodeSelector){if(t.text!==e.text)return n=o.ownerDocument.createTextNode(t.text),o.parentNode.replaceChild(n,o),t.domNode=n,!0;t.domNode=o}else t.vnodeSelector.lastIndexOf("svg",0)||(r=l(r,{namespace:A})),e.text!==t.text&&(i=!0,void 0===t.text?o.removeChild(o.firstChild):o.textContent=t.text),t.domNode=o,i=function(e,t,r,o,n){if(r===o)return!1;for(var i,d=(r=r||v).length,a=(o=o||v).length,s=0,p=0,c=!1;p<a;){var l=s<d?r[s]:void 0,f=o[p];if(void 0!==l&&h(l,f))c=x(l,f,n)||c,s++;else{var u=m(r,f,s+1);if(u<0)b(f,t,s<d?r[s].domNode:void 0,n),y(f),g(o,p,e,"added");else{for(i=s;i<u;i++)N(r[i]),g(r,i,e,"removed");c=x(r[u],f,n)||c,s=u+1}}p++}if(s<d)for(i=s;i<d;i++)N(r[i]),g(r,i,e,"removed");return c}(t,o,e.children,t.children,r)||i,i=function(e,t,r,o){if(r){for(var n=!1,i=Object.keys(r),d=i.length,a=0;a<d;a++){var s,p=i[a],c=r[p],l=t[p];if("class"===p)l!==c&&(k(e,l,!1),k(e,c,!0));else if("classes"===p)for(var f=e.classList,u=Object.keys(c),v=u.length,h=0;h<v;h++){var m=u[h],g=!!c[m];g!=!!l[m]&&(n=!0,g?f.add(m):f.remove(m))}else if("styles"===p)for(var y=Object.keys(c),N=y.length,h=0;h<N;h++){var b=y[h],x=c[b];x!==l[b]&&(n=!0,x?(w(x),o.styleApplyer(e,b,x)):o.styleApplyer(e,b,""))}else c||"string"!=typeof l||(c=""),"value"===p?((s=e[p])!==c&&(e["oninput-value"]?s===e["oninput-value"]:c!==l)&&(e[p]=c,e["oninput-value"]=void 0),c!==l&&(n=!0)):c===l||"function"==(s=typeof c)&&o.eventHandlerInterceptor||(o.namespace===A?"href"===p?e.setAttributeNS(S,p,c):e.setAttribute(p,c):"string"==s&&"innerHTML"!==p?"role"===p&&""===c?e.removeAttribute(p):e.setAttribute(p,c):e[p]!==c&&(e[p]=c),n=!0)}return n}}(o,e.properties,t.properties,r)||i,t.properties&&t.properties.afterUpdate&&t.properties.afterUpdate.call(t.properties.bind||t.properties,o,r,t.vnodeSelector,t.properties,t.children);i&&t.properties&&t.properties.updateAnimation&&t.properties.updateAnimation(o,t.properties,e.properties)}return!1},u={namespace:void 0,performanceLogger:function(){},eventHandlerInterceptor:void 0,styleApplyer:function(e,t,r){"-"==(t[0]||"")?e.style.setProperty(t,r):e.style[t]=r}},E={create:function(e,t){return t=d(t),b(e,document.createElement("div"),void 0,t),n(e,t)},append:function(e,t,r){return r=d(r),b(t,e,void 0,r),n(t,r)},insertBefore:function(e,t,r){return r=d(r),b(t,e.parentNode,e,r),n(t,r)},merge:function(e,t,r){return r=d(r),f(t.domNode=e,t,r),n(t,r)},replace:function(e,t,r){return r=d(r),b(t,e.parentNode,e,r),e.parentNode.removeChild(e),n(t,r)}},C=Array.prototype.find?function(e,t){return e.find(t)}:function(e,t){return e.filter(t)[0]};e.createCache=function(){var o,n;return{invalidate:function(){o=n=void 0},result:function(e,t){if(o)for(var r=0;r<e.length;r++)o[r]!==e[r]&&(n=void 0);return n||(n=t(),o=e),n}}},e.createMapping=function(c,l,f){var u=[],v=[];return{results:v,map:function(e){for(var t=e.map(c),r=v.slice(),o=0,n=0;n<e.length;n++){var i=e[n],d=t[n];if(d===u[o])v[n]=r[o],f(i,r[o],n),o++;else{for(var a=!1,s=1;s<u.length+1;s++){var p=(o+s)%u.length;if(u[p]===d){v[n]=r[p],f(e[n],r[p],n),o=1+p,a=!0;break}}a||(v[n]=l(i,n))}}v.length=e.length,u=t}}},e.createProjector=function(e){function r(e,t,r){var i,d,a;function n(e){a("domEvent",e);var t,r,o=i,n=function(e,t){for(var r=[];e&&e!==t;)r.push(e),e=e.parentNode;return r}(e.currentTarget,o.domNode),o=(n.reverse(),o=o.getLastRender(),r=o,n.forEach(function(t){r=r&&r.children?C(r.children,function(e){return e.domNode===t}):void 0}),r);return d.scheduleRender(),o&&(t=o.properties["on".concat(e.type)].apply(o.properties.bind||this,arguments)),a("domEventProcessed",e),t}s.eventHandlerInterceptor=(d=f,a=p,function(e,t,r,o){return n}),i=e(t,r(),s),c.push(i),l.push(r)}function t(){if(o=void 0,n){n=!1,p("renderStart",void 0);for(var e=0;e<c.length;e++){var t=l[e]();p("rendered",void 0),c[e].update(t),p("patched",void 0)}p("renderDone",void 0),n=!0}}var o,s=d(e),p=s.performanceLogger,n=!0,i=!1,c=[],l=[],f={renderNow:t,scheduleRender:function(){o||i||(o=requestAnimationFrame(t))},stop:function(){o&&(cancelAnimationFrame(o),o=void 0),i=!0},resume:function(){n=!(i=!1),f.scheduleRender()},append:function(e,t){r(E.append,e,t)},insertBefore:function(e,t){r(E.insertBefore,e,t)},merge:function(e,t){r(E.merge,e,t)},replace:function(e,t){r(E.replace,e,t)},detach:function(e){for(var t=0;t<l.length;t++)if(l[t]===e)return l.splice(t,1),c.splice(t,1)[0];throw Error("renderFunction was not found")}};return f},e.dom=E,e.h=function(e,t,r){if(Array.isArray(t))r=t,t=void 0;else if(t&&("string"==typeof t||t.vnodeSelector)||r&&("string"==typeof r||r.vnodeSelector))throw Error("h called with invalid arguments");var o,n;return r&&1===r.length&&"string"==typeof r[0]?o=r[0]:r&&(function e(t,r,o){for(var n=0,i=r.length;n<i;n++){var d=r[n];Array.isArray(d)?e(t,d,o):null!=d&&!1!==d&&("string"==typeof d&&(d={vnodeSelector:"",properties:void 0,children:void 0,text:d.toString(),domNode:null}),o.push(d))}}(e,r,n=[]),0===n.length)&&(n=void 0),{vnodeSelector:e,properties:t,children:n,text:""===o?void 0:o,domNode:null}}});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).maquette={})}(this,function(e){"use strict";function l(t,r){var o={};return Object.keys(t).forEach(function(e){o[e]=t[e]}),r&&Object.keys(r).forEach(function(e){o[e]=r[e]}),o}function t(e){(e.children||[]).forEach(t),e.properties&&e.properties.afterRemoved&&e.properties.afterRemoved.call(e.properties.bind||e.properties,e.domNode)}function r(){p=!1,a.forEach(t),a.length=0}function o(e){a.push(e),p||(p=!0,"undefined"!=typeof window&&"requestIdleCallback"in window?window.requestIdleCallback(r,{timeout:16}):setTimeout(r,16))}function f(e,t,r){c(e,t.children,r),t.text&&(e.textContent=t.text),s(e,t.properties,r),t.properties&&t.properties.afterCreate&&t.properties.afterCreate.call(t.properties.bind||t.properties,e,r,t.vnodeSelector,t.properties,t.children)}function n(t,r){return{getLastRender:function(){return t},update:function(e){if(t.vnodeSelector!==e.vnodeSelector)throw Error("The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)");x(t,t=e,r)},domNode:t.domNode}}function d(e){return l(u,e)}var i="http://www.w3.org/",S="".concat(i,"2000/svg"),w="".concat(i,"1999/xlink"),v=[],h=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)},E=function(e){if("string"!=typeof e)throw Error("Style values must be strings")},m=function(e,t,r){if(""!==t.vnodeSelector)for(var o=r;o<e.length;o++)if(h(e[o],t))return o;return-1},g=function(e,t,r,o){var n=e[t];if(""!==n.vnodeSelector){var i=n.properties;if(!(i&&(void 0===i.key?i.bind:i.key)))for(var d=0;d<e.length;d++)if(d!==t){var a=e[d];if(h(a,n))throw{error:Error("".concat(r.vnodeSelector," had a ").concat(n.vnodeSelector," child ").concat("added"===o?o:"removed",", but there is now more than one. You must add unique key properties to make them distinguishable.")),parentNode:r,childNode:n}}}},y=function(e){var t;e.properties&&(t=e.properties.enterAnimation)&&t(e.domNode,e.properties)},a=[],p=!1,N=function(e){var t=e.domNode;if(e.properties){var r=e.properties.exitAnimation;if(r)return t.style.pointerEvents="none",void r(t,function(){t.parentNode&&(t.parentNode.removeChild(t),o(e))},e.properties)}t.parentNode&&(t.parentNode.removeChild(t),o(e))},s=function(g,y,N){if(y)for(var b=N.eventHandlerInterceptor,x=Object.keys(y),e=x.length,A=0;A<e;A++)!function(){var e,t,r=x[A],o=y[r];if("className"===r)throw Error('Property "className" is not supported, use "class".');if("class"===r)k(g,o,!0);else if("classes"===r)for(var n=Object.keys(o),i=n.length,d=0;d<i;d++){var a=n[d];o[a]&&g.classList.add(a)}else if("styles"===r)for(var p=Object.keys(o),s=p.length,d=0;d<s;d++){var c=p[d],l=o[c];l&&(E(l),N.styleApplyer(g,c,l))}else if("on"===r&&o)for(var f=0,u=Object.entries(y.on);f<u.length;f++){var v=u[f],h=v[0],v=v[1],m="function"==typeof v?v:v.listener;(m=b?b(h,m,g,y):m)&&g.addEventListener(h,m,"function"==typeof v?void 0:v.options)}else"key"!==r&&null!=o&&("function"==(e=typeof o)?(r.lastIndexOf("on",0)||(b&&(o=b(r,o,g,y)),"oninput"===r&&(t=o,o=function(e){t.call(this,e),e.target["oninput-value"]=e.target.value})),g[r]=o):N.namespace===S?"href"===r?g.setAttributeNS(w,r,o):g.setAttribute(r,o):"string"==e&&"value"!==r&&"innerHTML"!==r?g.setAttribute(r,o):g[r]=o)}()},c=function(e,t,r){if(t)for(var o=0,n=t;o<n.length;o++){var i=n[o];b(i,e,void 0,r)}},b=function(e,t,r,o){var n,i=0,d=e.vnodeSelector,a=t.ownerDocument;if(""===d)e.domNode?e.domNode.nodeValue=e.text:(n=e.domNode=a.createTextNode(e.text),void 0!==r?t.insertBefore(n,r):t.appendChild(n));else{for(var p=0;p<=d.length;++p){var s,c=d[0|p]||"";p!==d.length&&"."!=c&&"#"!=c||(c=d[0|i-1]||"",s=d.slice(i,p),"."==c?n.classList.add(s):"#"==c?n.id=s:(void 0!==(o="svg"===s?l(o,{namespace:S}):o).namespace?n=e.domNode=a.createElementNS(o.namespace,s):(n=e.domNode=e.domNode||(null!=(c=e.properties)&&c.is?a.createElement(s,{is:e.properties.is}):a.createElement(s)),"input"===s&&e.properties&&void 0!==e.properties.type&&n.setAttribute("type",e.properties.type)),void 0!==r?t.insertBefore(n,r):n.parentNode!==t&&t.appendChild(n)),i=p+1)}f(n,e,o)}},k=function(t,e,r){e&&e.split(" ").forEach(function(e){e&&t.classList.toggle(e,r)})},x=function(e,t,r){var o=e.domNode;if(e!==t){var n,i=!1;if(""===t.vnodeSelector){if(t.text!==e.text)return n=o.ownerDocument.createTextNode(t.text),o.parentNode.replaceChild(n,o),t.domNode=n,!0;t.domNode=o}else t.vnodeSelector.lastIndexOf("svg",0)||(r=l(r,{namespace:S})),e.text!==t.text&&(i=!0,void 0===t.text?o.removeChild(o.firstChild):o.textContent=t.text),t.domNode=o,i=function(e,t,r,o,n){if(r===o)return!1;for(var i,d=(r=r||v).length,a=(o=o||v).length,p=0,s=0,c=!1;s<a;){var l=p<d?r[p]:void 0,f=o[s];if(void 0!==l&&h(l,f))c=x(l,f,n)||c,p++;else{var u=m(r,f,p+1);if(u<0)b(f,t,p<d?r[p].domNode:void 0,n),y(f),g(o,s,e,"added");else{for(i=p;i<u;i++)N(r[i]),g(r,i,e,"removed");c=x(r[u],f,n)||c,p=u+1}}s++}if(p<d)for(i=p;i<d;i++)N(r[i]),g(r,i,e,"removed");return c}(t,o,e.children,t.children,r)||i,i=function(e,t,r,o){if(r){for(var n=!1,i=Object.keys(r),d=i.length,a=0;a<d;a++){var p,s=i[a],c=r[s],l=t[s];if("class"===s)l!==c&&(k(e,l,!1),k(e,c,!0));else if("classes"===s)for(var f=e.classList,u=Object.keys(c),v=u.length,h=0;h<v;h++){var m=u[h],g=!!c[m];g!=!!l[m]&&(n=!0,g?f.add(m):f.remove(m))}else if("styles"===s)for(var y=Object.keys(c),N=y.length,h=0;h<N;h++){var b=y[h],x=c[b];x!==l[b]&&(n=!0,x?(E(x),o.styleApplyer(e,b,x)):o.styleApplyer(e,b,""))}else c||"string"!=typeof l||(c=""),"value"===s?((p=e[s])!==c&&(e["oninput-value"]?p===e["oninput-value"]:c!==l)&&(e[s]=c,e["oninput-value"]=void 0),c!==l&&(n=!0)):c===l||"function"==(p=typeof c)&&o.eventHandlerInterceptor||(o.namespace===S?"href"===s?e.setAttributeNS(w,s,c):e.setAttribute(s,c):"string"==p&&"innerHTML"!==s?"role"===s&&""===c?e.removeAttribute(s):e.setAttribute(s,c):e[s]!==c&&(e[s]=c),n=!0)}return n}}(o,e.properties,t.properties,r)||i,t.properties&&t.properties.afterUpdate&&t.properties.afterUpdate.call(t.properties.bind||t.properties,o,r,t.vnodeSelector,t.properties,t.children);i&&t.properties&&t.properties.updateAnimation&&t.properties.updateAnimation(o,t.properties,e.properties)}return!1},u={namespace:void 0,performanceLogger:function(){},eventHandlerInterceptor:void 0,styleApplyer:function(e,t,r){"-"==(t[0]||"")?e.style.setProperty(t,r):e.style[t]=r}},A={create:function(e,t){return t=d(t),b(e,document.createElement("div"),void 0,t),n(e,t)},append:function(e,t,r){return r=d(r),b(t,e,void 0,r),n(t,r)},insertBefore:function(e,t,r){return r=d(r),b(t,e.parentNode,e,r),n(t,r)},merge:function(e,t,r){return r=d(r),f(t.domNode=e,t,r),n(t,r)},replace:function(e,t,r){return r=d(r),b(t,e.parentNode,e,r),e.parentNode.removeChild(e),n(t,r)}},C=Array.prototype.find?function(e,t){return e.find(t)}:function(e,t){return e.filter(t)[0]};e.createCache=function(){var o,n;return{invalidate:function(){o=n=void 0},result:function(e,t){if(o)for(var r=0;r<e.length;r++)o[r]!==e[r]&&(n=void 0);return n||(n=t(),o=e),n}}},e.createMapping=function(c,l,f){var u=[],v=[];return{results:v,map:function(e){for(var t=e.map(c),r=v.slice(),o=0,n=0;n<e.length;n++){var i=e[n],d=t[n];if(d===u[o])v[n]=r[o],f(i,r[o],n),o++;else{for(var a=!1,p=1;p<u.length+1;p++){var s=(o+p)%u.length;if(u[s]===d){v[n]=r[s],f(e[n],r[s],n),o=1+s,a=!0;break}}a||(v[n]=l(i,n))}}v.length=e.length,u=t}}},e.createProjector=function(e){function r(e,t,r){var i,d,a;function n(e){a("domEvent",e);var t,r,o=i,n=function(e,t){for(var r=[];e&&e!==t;)r.push(e),e=e.parentNode;return r}(e.currentTarget,o.domNode),o=(n.reverse(),o=o.getLastRender(),r=o,n.forEach(function(t){r=r&&r.children?C(r.children,function(e){return e.domNode===t}):void 0}),r);return d.scheduleRender(),o&&(t=(null!=(n=null!=(n=o.properties["on".concat(e.type)])?n:o.properties.on[e.type].listener)?n:o.properties.on[e.type]).apply(o.properties.bind||this,arguments)),a("domEventProcessed",e),t}p.eventHandlerInterceptor=(d=f,a=s,function(e,t,r,o){return n}),i=e(t,r(),p),c.push(i),l.push(r)}function t(){if(o=void 0,n){n=!1,s("renderStart",void 0);for(var e=0;e<c.length;e++){var t=l[e]();s("rendered",void 0),c[e].update(t),s("patched",void 0)}s("renderDone",void 0),n=!0}}var o,p=d(e),s=p.performanceLogger,n=!0,i=!1,c=[],l=[],f={renderNow:t,scheduleRender:function(){o||i||(o=requestAnimationFrame(t))},stop:function(){o&&(cancelAnimationFrame(o),o=void 0),i=!0},resume:function(){n=!(i=!1),f.scheduleRender()},append:function(e,t){r(A.append,e,t)},insertBefore:function(e,t){r(A.insertBefore,e,t)},merge:function(e,t){r(A.merge,e,t)},replace:function(e,t){r(A.replace,e,t)},detach:function(e){for(var t=0;t<l.length;t++)if(l[t]===e)return l.splice(t,1),c.splice(t,1)[0];throw Error("renderFunction was not found")}};return f},e.dom=A,e.h=function(e,t,r){if(Array.isArray(t))r=t,t=void 0;else if(t&&("string"==typeof t||t.vnodeSelector)||r&&("string"==typeof r||r.vnodeSelector))throw Error("h called with invalid arguments");var o,n;return r&&1===r.length&&"string"==typeof r[0]?o=r[0]:r&&(function e(t,r,o){for(var n=0,i=r.length;n<i;n++){var d=r[n];Array.isArray(d)?e(t,d,o):null!=d&&!1!==d&&("string"==typeof d&&(d={vnodeSelector:"",properties:void 0,children:void 0,text:d.toString(),domNode:null}),o.push(d))}}(e,r,n=[]),0===n.length)&&(n=void 0),{vnodeSelector:e,properties:t,children:n,text:""===o?void 0:o,domNode:null}}});
@@ -165,6 +165,19 @@ var setProperties = function (domNode, properties, projectionOptions) {
165
165
  }
166
166
  }
167
167
  }
168
+ else if (propName === "on" && propValue) {
169
+ // object with string keys and function values
170
+ for (var _i = 0, _a = Object.entries(properties.on); _i < _a.length; _i++) {
171
+ var _b = _a[_i], key = _b[0], handler = _b[1];
172
+ var listener = typeof handler === "function" ? handler : handler.listener;
173
+ if (eventHandlerInterceptor) {
174
+ listener = eventHandlerInterceptor(key, listener, domNode, properties);
175
+ }
176
+ if (listener) {
177
+ domNode.addEventListener(key, listener, typeof handler === "function" ? undefined : handler.options);
178
+ }
179
+ }
180
+ }
168
181
  else if (propName !== "key" && propValue !== null && propValue !== undefined) {
169
182
  var type = typeof propValue;
170
183
  if (type === "function") {
@@ -1 +1 @@
1
- {"version":3,"file":"projection.js","sourceRoot":"","sources":["../src/projection.ts"],"names":[],"mappings":"AAKA,IAAM,YAAY,GAAG,oBAAoB,CAAC;AAC1C,IAAM,aAAa,GAAG,UAAG,YAAY,aAAU,CAAC;AAChD,IAAM,eAAe,GAAG,UAAG,YAAY,eAAY,CAAC;AAEpD,IAAI,UAAU,GAAY,EAAE,CAAC;AAE7B,MAAM,CAAC,IAAI,MAAM,GAAG,UAAmB,IAAO,EAAE,SAAc;IAC5D,IAAI,MAAM,GAAG,EAAS,CAAC;IACvB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;QAC5B,MAAM,CAAC,GAAG,CAAC,GAAI,IAAY,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IACH,IAAI,SAAS,EAAE;QACb,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;YACjC,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;KACJ;IACD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U,CAAC,IAAI,IAAI,KAAK,CAAC,UAAU,EAAE;gBACnE,OAAO;gBAChB,iBAAiB;gBACjB,KAAK,CAAC,aAAa;gBACnB,KAAK,CAAC,UAAU;gBAChB,KAAK,CAAC,QAAQ;aACf,CAAC,CAAC;SACJ;KACF;IACD,IAAI,OAAO,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE;QACnE,KAAK,CAAC,UAAU,CAAC,eAAe,CAAU,OAAO,EAAE,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;KAC3F;IACD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,CAAC,IAAI,gBAAgB,GAAG,UAAC,KAAY,EAAE,iBAAoC;IAC/E,OAAO;QACL,aAAa,EAAE,cAAM,OAAA,KAAK,EAAL,CAAK;QAC1B,MAAM,EAAE,UAAC,YAAmB;YAC1B,IAAI,KAAK,CAAC,aAAa,KAAK,YAAY,CAAC,aAAa,EAAE;gBACtD,MAAM,IAAI,KAAK,CACb,2HAA2H,CAC5H,CAAC;aACH;YACD,IAAI,aAAa,GAAG,KAAK,CAAC;YAC1B,KAAK,GAAG,YAAY,CAAC;YACrB,SAAS,CAAC,aAAa,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,EAAW,KAAK,CAAC,OAAO;KAChC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * Exports here are NOT re-exported to maquette\n */\nimport { Projection, ProjectionOptions, VNode, VNodeProperties } from \"./interfaces\";\n\nconst NAMESPACE_W3 = \"http://www.w3.org/\";\nconst NAMESPACE_SVG = `${NAMESPACE_W3}2000/svg`;\nconst NAMESPACE_XLINK = `${NAMESPACE_W3}1999/xlink`;\n\nlet emptyArray = <VNode[]>[];\n\nexport let extend = <T extends object>(base: T, overrides: any): T => {\n let result = {} as any;\n Object.keys(base).forEach((key) => {\n result[key] = (base as any)[key];\n });\n if (overrides) {\n Object.keys(overrides).forEach((key) => {\n result[key] = overrides[key];\n });\n }\n return result;\n};\n\nlet same = (vnode1: VNode, vnode2: VNode) => {\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\nlet checkStyleValue = (styleValue: unknown) => {\n if (typeof styleValue !== \"string\") {\n throw new Error(\"Style values must be strings\");\n }\n};\n\nlet findIndexOfChild = (children: VNode[], sameAs: VNode, start: number) => {\n if (sameAs.vnodeSelector !== \"\") {\n // Never scan for text-nodes\n for (let i = start; i < children.length; i++) {\n if (same(children[i], sameAs)) {\n return i;\n }\n }\n }\n return -1;\n};\n\nlet checkDistinguishable = (\n childNodes: VNode[],\n indexToCheck: number,\n parentVNode: VNode,\n operation: string\n) => {\n let childNode = childNodes[indexToCheck];\n if (childNode.vnodeSelector === \"\") {\n return; // Text nodes need not be distinguishable\n }\n let properties = childNode.properties;\n let key = properties\n ? properties.key === undefined\n ? properties.bind\n : properties.key\n : undefined;\n if (!key) {\n // A key is just assumed to be unique\n for (let i = 0; i < childNodes.length; i++) {\n if (i !== indexToCheck) {\n let node = childNodes[i];\n if (same(node, childNode)) {\n throw {\n error: new Error(\n `${parentVNode.vnodeSelector} had a ${childNode.vnodeSelector} child ${\n operation === \"added\" ? operation : \"removed\"\n }, but there is now more than one. You must add unique key properties to make them distinguishable.`\n ),\n parentNode: parentVNode,\n childNode,\n };\n }\n }\n }\n }\n};\n\nlet nodeAdded = (vNode: VNode) => {\n if (vNode.properties) {\n let enterAnimation = vNode.properties.enterAnimation;\n if (enterAnimation) {\n enterAnimation(vNode.domNode as Element, vNode.properties);\n }\n }\n};\n\nlet removedNodes: VNode[] = [];\nlet requestedIdleCallback = false;\n\nlet visitRemovedNode = (node: VNode) => {\n (node.children || []).forEach(visitRemovedNode);\n\n if (node.properties && node.properties.afterRemoved) {\n node.properties.afterRemoved.apply(node.properties.bind || node.properties, [\n <Element>node.domNode,\n ]);\n }\n};\n\nlet processPendingNodeRemovals = (): void => {\n requestedIdleCallback = false;\n\n removedNodes.forEach(visitRemovedNode);\n removedNodes.length = 0;\n};\n\nlet scheduleNodeRemoval = (vNode: VNode): void => {\n removedNodes.push(vNode);\n\n if (!requestedIdleCallback) {\n requestedIdleCallback = true;\n if (typeof window !== \"undefined\" && \"requestIdleCallback\" in window) {\n window.requestIdleCallback(processPendingNodeRemovals, { timeout: 16 });\n } else {\n setTimeout(processPendingNodeRemovals, 16);\n }\n }\n};\n\nlet nodeToRemove = (vNode: VNode) => {\n let domNode: Node = vNode.domNode!;\n if (vNode.properties) {\n let exitAnimation = vNode.properties.exitAnimation;\n if (exitAnimation) {\n (domNode as HTMLElement).style.pointerEvents = \"none\";\n let removeDomNode = () => {\n if (domNode.parentNode) {\n domNode.parentNode.removeChild(domNode);\n scheduleNodeRemoval(vNode);\n }\n };\n exitAnimation(domNode as Element, removeDomNode, vNode.properties);\n return;\n }\n }\n if (domNode.parentNode) {\n domNode.parentNode.removeChild(domNode);\n scheduleNodeRemoval(vNode);\n }\n};\n\nlet setProperties = (\n domNode: Node,\n properties: VNodeProperties | undefined,\n projectionOptions: ProjectionOptions\n) => {\n if (!properties) {\n return;\n }\n let eventHandlerInterceptor = projectionOptions.eventHandlerInterceptor;\n let propNames = Object.keys(properties);\n let propCount = propNames.length;\n for (let i = 0; i < propCount; i++) {\n let propName = propNames[i];\n let propValue = properties[propName];\n if (propName === \"className\") {\n throw new Error('Property \"className\" is not supported, use \"class\".');\n } else if (propName === \"class\") {\n toggleClasses(domNode as HTMLElement, propValue as string, true);\n } else if (propName === \"classes\") {\n // object with string keys and boolean values\n let classNames = Object.keys(propValue);\n let classNameCount = classNames.length;\n for (let j = 0; j < classNameCount; j++) {\n let className = classNames[j];\n if (propValue[className]) {\n (domNode as Element).classList.add(className);\n }\n }\n } else if (propName === \"styles\") {\n // object with string keys and string (!) values\n let styleNames = Object.keys(propValue);\n let styleCount = styleNames.length;\n for (let j = 0; j < styleCount; j++) {\n let styleName = styleNames[j];\n let styleValue = propValue[styleName];\n if (styleValue) {\n checkStyleValue(styleValue);\n projectionOptions.styleApplyer!(<HTMLElement>domNode, styleName, styleValue);\n }\n }\n } else if (propName !== \"key\" && propValue !== null && propValue !== undefined) {\n let type = typeof propValue;\n if (type === \"function\") {\n if (propName.lastIndexOf(\"on\", 0) === 0) {\n // lastIndexOf(,0)===0 -> startsWith\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 let oldPropValue = propValue;\n propValue = function (this: HTMLElement, evt: Event) {\n oldPropValue.apply(this, [evt]);\n (evt.target as any)[\"oninput-value\"] = (evt.target as HTMLInputElement).value; // may be HTMLTextAreaElement as well\n };\n })();\n }\n }\n (domNode as any)[propName] = propValue;\n } else if (projectionOptions.namespace === NAMESPACE_SVG) {\n if (propName === \"href\") {\n (domNode as Element).setAttributeNS(NAMESPACE_XLINK, propName, propValue);\n } else {\n // all SVG attributes are read-only in DOM, so...\n (domNode as Element).setAttribute(propName, propValue);\n }\n } else if (type === \"string\" && propName !== \"value\" && propName !== \"innerHTML\") {\n (domNode as Element).setAttribute(propName, propValue);\n } else {\n (domNode as any)[propName] = propValue;\n }\n }\n }\n};\n\nlet addChildren = (\n domNode: Node,\n children: VNode[] | undefined,\n projectionOptions: ProjectionOptions\n) => {\n if (!children) {\n return;\n }\n for (let child of children) {\n createDom(child, domNode, undefined, projectionOptions);\n }\n};\n\nexport let initPropertiesAndChildren = (\n domNode: Node,\n vnode: VNode,\n projectionOptions: ProjectionOptions\n): void => {\n addChildren(domNode, vnode.children, projectionOptions); // children before properties, needed for value property of <select>.\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 as Element,\n projectionOptions,\n vnode.vnodeSelector,\n vnode.properties,\n vnode.children,\n ]);\n }\n};\n\nexport let createDom = (\n vnode: VNode,\n parentNode: Node,\n insertBefore: Node | null | undefined,\n projectionOptions: ProjectionOptions\n): void => {\n let domNode: Node | undefined;\n let start = 0;\n let vnodeSelector = vnode.vnodeSelector;\n let doc = parentNode.ownerDocument!;\n if (vnodeSelector === \"\") {\n if (vnode.domNode) {\n vnode.domNode.nodeValue = vnode.text!;\n } else {\n domNode = vnode.domNode = doc.createTextNode(vnode.text!);\n if (insertBefore !== undefined) {\n parentNode.insertBefore(domNode, insertBefore);\n } else {\n parentNode.appendChild(domNode);\n }\n }\n } else {\n for (let i = 0; i <= vnodeSelector.length; ++i) {\n let c = vnodeSelector.charAt(i);\n if (i === vnodeSelector.length || c === \".\" || c === \"#\") {\n let type = vnodeSelector.charAt(start - 1);\n let found = vnodeSelector.slice(start, i);\n if (type === \".\") {\n (domNode! as HTMLElement).classList.add(found);\n } else if (type === \"#\") {\n (domNode! as Element).id = found;\n } else {\n if (found === \"svg\") {\n projectionOptions = extend(projectionOptions, {\n namespace: NAMESPACE_SVG,\n });\n }\n if (projectionOptions.namespace !== undefined) {\n domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found);\n } else {\n domNode = vnode.domNode =\n vnode.domNode ||\n (vnode.properties?.is\n ? doc.createElement(found, { is: vnode.properties.is })\n : 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 as Element).setAttribute(\"type\", vnode.properties.type);\n }\n }\n if (insertBefore !== undefined) {\n parentNode.insertBefore(domNode, insertBefore);\n } else if (domNode.parentNode !== parentNode) {\n parentNode.appendChild(domNode);\n }\n }\n start = i + 1;\n }\n }\n initPropertiesAndChildren(domNode!, vnode, projectionOptions);\n }\n};\n\nlet updateDom: (previous: VNode, vnode: VNode, projectionOptions: ProjectionOptions) => boolean;\n\n/**\n * Adds or removes classes from an Element\n * @param domNode the element\n * @param classes a string separated list of classes\n * @param on true means add classes, false means remove\n */\nlet toggleClasses = (domNode: HTMLElement, classes: string | null | undefined, on: boolean) => {\n if (!classes) {\n return;\n }\n classes.split(\" \").forEach((classToToggle) => {\n if (classToToggle) {\n domNode.classList.toggle(classToToggle, on);\n }\n });\n};\n\nlet updateProperties = (\n domNode: Node,\n previousProperties: VNodeProperties | undefined,\n properties: VNodeProperties | undefined,\n projectionOptions: ProjectionOptions\n) => {\n if (!properties) {\n return;\n }\n let propertiesUpdated = false;\n let propNames = Object.keys(properties);\n let propCount = propNames.length;\n for (let i = 0; i < propCount; i++) {\n let propName = propNames[i];\n // assuming that properties will be nullified instead of missing is by design\n let propValue = properties[propName];\n let previousValue = previousProperties![propName];\n if (propName === \"class\") {\n if (previousValue !== propValue) {\n toggleClasses(domNode as HTMLElement, previousValue, false);\n toggleClasses(domNode as HTMLElement, propValue, true);\n }\n } else if (propName === \"classes\") {\n let classList = (domNode as Element).classList;\n let classNames = Object.keys(propValue);\n let classNameCount = classNames.length;\n for (let j = 0; j < classNameCount; j++) {\n let className = classNames[j];\n let on = !!propValue[className];\n let 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 let styleNames = Object.keys(propValue);\n let styleCount = styleNames.length;\n for (let j = 0; j < styleCount; j++) {\n let styleName = styleNames[j];\n let newStyleValue = propValue[styleName];\n let oldStyleValue = previousValue[styleName];\n if (newStyleValue === oldStyleValue) {\n continue;\n }\n propertiesUpdated = true;\n if (newStyleValue) {\n checkStyleValue(newStyleValue);\n projectionOptions.styleApplyer!(domNode as HTMLElement, styleName, newStyleValue);\n } else {\n projectionOptions.styleApplyer!(domNode as HTMLElement, styleName, \"\");\n }\n }\n } else {\n if (!propValue && typeof previousValue === \"string\") {\n propValue = \"\";\n }\n if (propName === \"value\") {\n // value can be manipulated by the user directly and using event.preventDefault() is not an option\n let domValue = (domNode as any)[propName];\n if (\n domValue !== propValue && // The 'value' in the DOM tree !== newValue\n ((domNode as any)[\"oninput-value\"]\n ? domValue === (domNode as any)[\"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 // The edge cases are described in the tests\n (domNode as any)[propName] = propValue; // Reset the value, even if the virtual DOM did not change\n (domNode as any)[\"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 } else if (propValue !== previousValue) {\n let type = typeof propValue;\n if (type !== \"function\" || !projectionOptions.eventHandlerInterceptor) {\n // Function updates are expected to be handled by the EventHandlerInterceptor\n if (projectionOptions.namespace === NAMESPACE_SVG) {\n if (propName === \"href\") {\n (domNode as Element).setAttributeNS(NAMESPACE_XLINK, propName, propValue);\n } else {\n // all SVG attributes are read-only in DOM, so...\n (domNode as Element).setAttribute(propName, propValue);\n }\n } else if (type === \"string\" && propName !== \"innerHTML\") {\n if (propName === \"role\" && propValue === \"\") {\n (domNode as any).removeAttribute(propName);\n } else {\n (domNode as Element).setAttribute(propName, propValue);\n }\n } else if ((domNode as any)[propName] !== propValue) {\n // Comparison is here for side-effects in Edge with scrollLeft and scrollTop\n (domNode as any)[propName] = propValue;\n }\n\n propertiesUpdated = true;\n }\n }\n }\n }\n return propertiesUpdated;\n};\n\nlet updateChildren = (\n vnode: VNode,\n domNode: Node,\n oldChildren: VNode[] | undefined,\n newChildren: VNode[] | undefined,\n projectionOptions: ProjectionOptions\n) => {\n if (oldChildren === newChildren) {\n return false;\n }\n oldChildren = oldChildren || emptyArray;\n newChildren = newChildren || emptyArray;\n let oldChildrenLength = oldChildren.length;\n let newChildrenLength = newChildren.length;\n\n let oldIndex = 0;\n let newIndex = 0;\n let i: number;\n let textUpdated = false;\n while (newIndex < newChildrenLength) {\n let oldChild = oldIndex < oldChildrenLength ? oldChildren[oldIndex] : undefined;\n let newChild = newChildren[newIndex];\n if (oldChild !== undefined && same(oldChild, newChild)) {\n textUpdated = updateDom(oldChild, newChild, projectionOptions) || textUpdated;\n oldIndex++;\n } else {\n let 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]);\n checkDistinguishable(oldChildren, i, vnode, \"removed\");\n }\n textUpdated =\n updateDom(oldChildren[findOldIndex], newChild, projectionOptions) || textUpdated;\n oldIndex = findOldIndex + 1;\n } else {\n // New child\n createDom(\n newChild,\n domNode,\n oldIndex < oldChildrenLength ? oldChildren[oldIndex].domNode : undefined,\n projectionOptions\n );\n nodeAdded(newChild);\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]);\n checkDistinguishable(oldChildren, i, vnode, \"removed\");\n }\n }\n return textUpdated;\n};\n\nupdateDom = (previous, vnode, projectionOptions) => {\n let domNode = previous.domNode!;\n let 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 let updated = false;\n if (vnode.vnodeSelector === \"\") {\n if (vnode.text !== previous.text) {\n let newTextNode = domNode.ownerDocument!.createTextNode(vnode.text!);\n domNode.parentNode!.replaceChild(newTextNode, domNode);\n vnode.domNode = newTextNode;\n textUpdated = true;\n return textUpdated;\n }\n vnode.domNode = domNode;\n } else {\n if (vnode.vnodeSelector.lastIndexOf(\"svg\", 0) === 0) {\n // lastIndexOf(needle,0)===0 means StartsWith\n projectionOptions = extend(projectionOptions, {\n namespace: NAMESPACE_SVG,\n });\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 vnode.domNode = domNode;\n updated =\n updateChildren(vnode, domNode, previous.children, vnode.children, projectionOptions) ||\n updated;\n updated =\n updateProperties(domNode, previous.properties, vnode.properties, projectionOptions) ||\n updated;\n if (vnode.properties && vnode.properties.afterUpdate) {\n vnode.properties.afterUpdate.apply(vnode.properties.bind || vnode.properties, [\n <Element>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(<Element>domNode, vnode.properties, previous.properties);\n }\n return textUpdated;\n};\n\nexport let createProjection = (vnode: VNode, projectionOptions: ProjectionOptions): Projection => {\n return {\n getLastRender: () => vnode,\n update: (updatedVnode: VNode) => {\n if (vnode.vnodeSelector !== updatedVnode.vnodeSelector) {\n throw new Error(\n \"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 }\n let previousVNode = vnode;\n vnode = updatedVnode;\n updateDom(previousVNode, updatedVnode, projectionOptions);\n },\n domNode: <Element>vnode.domNode,\n };\n};\n"]}
1
+ {"version":3,"file":"projection.js","sourceRoot":"","sources":["../src/projection.ts"],"names":[],"mappings":"AAKA,IAAM,YAAY,GAAG,oBAAoB,CAAC;AAC1C,IAAM,aAAa,GAAG,UAAG,YAAY,aAAU,CAAC;AAChD,IAAM,eAAe,GAAG,UAAG,YAAY,eAAY,CAAC;AAEpD,IAAI,UAAU,GAAY,EAAE,CAAC;AAE7B,MAAM,CAAC,IAAI,MAAM,GAAG,UAAmB,IAAO,EAAE,SAAc;IAC5D,IAAI,MAAM,GAAG,EAAS,CAAC;IACvB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAC,GAA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CAAC,QAAQ;aACf,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;QACpE,KAAK,CAAC,UAAU,CAAC,eAAe,CAAU,OAAO,EAAE,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,CAAC,IAAI,gBAAgB,GAAG,UAAC,KAAY,EAAE,iBAAoC;IAC/E,OAAO;QACL,aAAa,EAAE,cAAM,OAAA,KAAK,EAAL,CAAK;QAC1B,MAAM,EAAE,UAAC,YAAmB;YAC1B,IAAI,KAAK,CAAC,aAAa,KAAK,YAAY,CAAC,aAAa,EAAE,CAAC;gBACvD,MAAM,IAAI,KAAK,CACb,2HAA2H,CAC5H,CAAC;YACJ,CAAC;YACD,IAAI,aAAa,GAAG,KAAK,CAAC;YAC1B,KAAK,GAAG,YAAY,CAAC;YACrB,SAAS,CAAC,aAAa,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,EAAW,KAAK,CAAC,OAAO;KAChC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * Exports here are NOT re-exported to maquette\n */\nimport { EventHandler, Projection, ProjectionOptions, VNode, VNodeProperties } from \"./interfaces\";\n\nconst NAMESPACE_W3 = \"http://www.w3.org/\";\nconst NAMESPACE_SVG = `${NAMESPACE_W3}2000/svg`;\nconst NAMESPACE_XLINK = `${NAMESPACE_W3}1999/xlink`;\n\nlet emptyArray = <VNode[]>[];\n\nexport let extend = <T extends object>(base: T, overrides: any): T => {\n let result = {} as any;\n Object.keys(base).forEach((key) => {\n result[key] = (base as any)[key];\n });\n if (overrides) {\n Object.keys(overrides).forEach((key) => {\n result[key] = overrides[key];\n });\n }\n return result;\n};\n\nlet same = (vnode1: VNode, vnode2: VNode) => {\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\nlet checkStyleValue = (styleValue: unknown) => {\n if (typeof styleValue !== \"string\") {\n throw new Error(\"Style values must be strings\");\n }\n};\n\nlet findIndexOfChild = (children: VNode[], sameAs: VNode, start: number) => {\n if (sameAs.vnodeSelector !== \"\") {\n // Never scan for text-nodes\n for (let i = start; i < children.length; i++) {\n if (same(children[i], sameAs)) {\n return i;\n }\n }\n }\n return -1;\n};\n\nlet checkDistinguishable = (\n childNodes: VNode[],\n indexToCheck: number,\n parentVNode: VNode,\n operation: string\n) => {\n let childNode = childNodes[indexToCheck];\n if (childNode.vnodeSelector === \"\") {\n return; // Text nodes need not be distinguishable\n }\n let properties = childNode.properties;\n let key = properties\n ? properties.key === undefined\n ? properties.bind\n : properties.key\n : undefined;\n if (!key) {\n // A key is just assumed to be unique\n for (let i = 0; i < childNodes.length; i++) {\n if (i !== indexToCheck) {\n let node = childNodes[i];\n if (same(node, childNode)) {\n throw {\n error: new Error(\n `${parentVNode.vnodeSelector} had a ${childNode.vnodeSelector} child ${\n operation === \"added\" ? operation : \"removed\"\n }, but there is now more than one. You must add unique key properties to make them distinguishable.`\n ),\n parentNode: parentVNode,\n childNode,\n };\n }\n }\n }\n }\n};\n\nlet nodeAdded = (vNode: VNode) => {\n if (vNode.properties) {\n let enterAnimation = vNode.properties.enterAnimation;\n if (enterAnimation) {\n enterAnimation(vNode.domNode as Element, vNode.properties);\n }\n }\n};\n\nlet removedNodes: VNode[] = [];\nlet requestedIdleCallback = false;\n\nlet visitRemovedNode = (node: VNode) => {\n (node.children || []).forEach(visitRemovedNode);\n\n if (node.properties && node.properties.afterRemoved) {\n node.properties.afterRemoved.apply(node.properties.bind || node.properties, [\n <Element>node.domNode,\n ]);\n }\n};\n\nlet processPendingNodeRemovals = (): void => {\n requestedIdleCallback = false;\n\n removedNodes.forEach(visitRemovedNode);\n removedNodes.length = 0;\n};\n\nlet scheduleNodeRemoval = (vNode: VNode): void => {\n removedNodes.push(vNode);\n\n if (!requestedIdleCallback) {\n requestedIdleCallback = true;\n if (typeof window !== \"undefined\" && \"requestIdleCallback\" in window) {\n window.requestIdleCallback(processPendingNodeRemovals, { timeout: 16 });\n } else {\n setTimeout(processPendingNodeRemovals, 16);\n }\n }\n};\n\nlet nodeToRemove = (vNode: VNode) => {\n let domNode: Node = vNode.domNode!;\n if (vNode.properties) {\n let exitAnimation = vNode.properties.exitAnimation;\n if (exitAnimation) {\n (domNode as HTMLElement).style.pointerEvents = \"none\";\n let removeDomNode = () => {\n if (domNode.parentNode) {\n domNode.parentNode.removeChild(domNode);\n scheduleNodeRemoval(vNode);\n }\n };\n exitAnimation(domNode as Element, removeDomNode, vNode.properties);\n return;\n }\n }\n if (domNode.parentNode) {\n domNode.parentNode.removeChild(domNode);\n scheduleNodeRemoval(vNode);\n }\n};\n\nlet setProperties = (\n domNode: Node,\n properties: VNodeProperties | undefined,\n projectionOptions: ProjectionOptions\n) => {\n if (!properties) {\n return;\n }\n let eventHandlerInterceptor = projectionOptions.eventHandlerInterceptor;\n let propNames = Object.keys(properties);\n let propCount = propNames.length;\n for (let i = 0; i < propCount; i++) {\n let propName = propNames[i];\n let propValue = properties[propName];\n if (propName === \"className\") {\n throw new Error('Property \"className\" is not supported, use \"class\".');\n } else if (propName === \"class\") {\n toggleClasses(domNode as HTMLElement, propValue as string, true);\n } else if (propName === \"classes\") {\n // object with string keys and boolean values\n let classNames = Object.keys(propValue);\n let classNameCount = classNames.length;\n for (let j = 0; j < classNameCount; j++) {\n let className = classNames[j];\n if (propValue[className]) {\n (domNode as Element).classList.add(className);\n }\n }\n } else if (propName === \"styles\") {\n // object with string keys and string (!) values\n let styleNames = Object.keys(propValue);\n let styleCount = styleNames.length;\n for (let j = 0; j < styleCount; j++) {\n let styleName = styleNames[j];\n let styleValue = propValue[styleName];\n if (styleValue) {\n checkStyleValue(styleValue);\n projectionOptions.styleApplyer!(<HTMLElement>domNode, styleName, styleValue);\n }\n }\n } else if (propName === \"on\" && propValue) {\n // object with string keys and function values\n for (let [key, handler] of Object.entries(properties.on!)) {\n let listener: EventHandler | undefined =\n typeof handler === \"function\" ? handler : handler.listener;\n if (eventHandlerInterceptor) {\n listener = eventHandlerInterceptor(key, listener, domNode, properties);\n }\n if (listener) {\n domNode.addEventListener(\n key,\n listener,\n typeof handler === \"function\" ? undefined : handler.options\n );\n }\n }\n } else if (propName !== \"key\" && propValue !== null && propValue !== undefined) {\n let type = typeof propValue;\n if (type === \"function\") {\n if (propName.lastIndexOf(\"on\", 0) === 0) {\n // lastIndexOf(,0)===0 -> startsWith\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 let oldPropValue = propValue;\n propValue = function (this: HTMLElement, evt: Event) {\n oldPropValue.apply(this, [evt]);\n (evt.target as any)[\"oninput-value\"] = (evt.target as HTMLInputElement).value; // may be HTMLTextAreaElement as well\n };\n })();\n }\n }\n (domNode as any)[propName] = propValue;\n } else if (projectionOptions.namespace === NAMESPACE_SVG) {\n if (propName === \"href\") {\n (domNode as Element).setAttributeNS(NAMESPACE_XLINK, propName, propValue);\n } else {\n // all SVG attributes are read-only in DOM, so...\n (domNode as Element).setAttribute(propName, propValue);\n }\n } else if (type === \"string\" && propName !== \"value\" && propName !== \"innerHTML\") {\n (domNode as Element).setAttribute(propName, propValue);\n } else {\n (domNode as any)[propName] = propValue;\n }\n }\n }\n};\n\nlet addChildren = (\n domNode: Node,\n children: VNode[] | undefined,\n projectionOptions: ProjectionOptions\n) => {\n if (!children) {\n return;\n }\n for (let child of children) {\n createDom(child, domNode, undefined, projectionOptions);\n }\n};\n\nexport let initPropertiesAndChildren = (\n domNode: Node,\n vnode: VNode,\n projectionOptions: ProjectionOptions\n): void => {\n addChildren(domNode, vnode.children, projectionOptions); // children before properties, needed for value property of <select>.\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 as Element,\n projectionOptions,\n vnode.vnodeSelector,\n vnode.properties,\n vnode.children,\n ]);\n }\n};\n\nexport let createDom = (\n vnode: VNode,\n parentNode: Node,\n insertBefore: Node | null | undefined,\n projectionOptions: ProjectionOptions\n): void => {\n let domNode: Node | undefined;\n let start = 0;\n let vnodeSelector = vnode.vnodeSelector;\n let doc = parentNode.ownerDocument!;\n if (vnodeSelector === \"\") {\n if (vnode.domNode) {\n vnode.domNode.nodeValue = vnode.text!;\n } else {\n domNode = vnode.domNode = doc.createTextNode(vnode.text!);\n if (insertBefore !== undefined) {\n parentNode.insertBefore(domNode, insertBefore);\n } else {\n parentNode.appendChild(domNode);\n }\n }\n } else {\n for (let i = 0; i <= vnodeSelector.length; ++i) {\n let c = vnodeSelector.charAt(i);\n if (i === vnodeSelector.length || c === \".\" || c === \"#\") {\n let type = vnodeSelector.charAt(start - 1);\n let found = vnodeSelector.slice(start, i);\n if (type === \".\") {\n (domNode! as HTMLElement).classList.add(found);\n } else if (type === \"#\") {\n (domNode! as Element).id = found;\n } else {\n if (found === \"svg\") {\n projectionOptions = extend(projectionOptions, {\n namespace: NAMESPACE_SVG,\n });\n }\n if (projectionOptions.namespace !== undefined) {\n domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found);\n } else {\n domNode = vnode.domNode =\n vnode.domNode ||\n (vnode.properties?.is\n ? doc.createElement(found, { is: vnode.properties.is })\n : 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 as Element).setAttribute(\"type\", vnode.properties.type);\n }\n }\n if (insertBefore !== undefined) {\n parentNode.insertBefore(domNode, insertBefore);\n } else if (domNode.parentNode !== parentNode) {\n parentNode.appendChild(domNode);\n }\n }\n start = i + 1;\n }\n }\n initPropertiesAndChildren(domNode!, vnode, projectionOptions);\n }\n};\n\nlet updateDom: (previous: VNode, vnode: VNode, projectionOptions: ProjectionOptions) => boolean;\n\n/**\n * Adds or removes classes from an Element\n * @param domNode the element\n * @param classes a string separated list of classes\n * @param on true means add classes, false means remove\n */\nlet toggleClasses = (domNode: HTMLElement, classes: string | null | undefined, on: boolean) => {\n if (!classes) {\n return;\n }\n classes.split(\" \").forEach((classToToggle) => {\n if (classToToggle) {\n domNode.classList.toggle(classToToggle, on);\n }\n });\n};\n\nlet updateProperties = (\n domNode: Node,\n previousProperties: VNodeProperties | undefined,\n properties: VNodeProperties | undefined,\n projectionOptions: ProjectionOptions\n) => {\n if (!properties) {\n return;\n }\n let propertiesUpdated = false;\n let propNames = Object.keys(properties);\n let propCount = propNames.length;\n for (let i = 0; i < propCount; i++) {\n let propName = propNames[i];\n // assuming that properties will be nullified instead of missing is by design\n let propValue = properties[propName];\n let previousValue = previousProperties![propName];\n if (propName === \"class\") {\n if (previousValue !== propValue) {\n toggleClasses(domNode as HTMLElement, previousValue, false);\n toggleClasses(domNode as HTMLElement, propValue, true);\n }\n } else if (propName === \"classes\") {\n let classList = (domNode as Element).classList;\n let classNames = Object.keys(propValue);\n let classNameCount = classNames.length;\n for (let j = 0; j < classNameCount; j++) {\n let className = classNames[j];\n let on = !!propValue[className];\n let 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 let styleNames = Object.keys(propValue);\n let styleCount = styleNames.length;\n for (let j = 0; j < styleCount; j++) {\n let styleName = styleNames[j];\n let newStyleValue = propValue[styleName];\n let oldStyleValue = previousValue[styleName];\n if (newStyleValue === oldStyleValue) {\n continue;\n }\n propertiesUpdated = true;\n if (newStyleValue) {\n checkStyleValue(newStyleValue);\n projectionOptions.styleApplyer!(domNode as HTMLElement, styleName, newStyleValue);\n } else {\n projectionOptions.styleApplyer!(domNode as HTMLElement, styleName, \"\");\n }\n }\n } else {\n if (!propValue && typeof previousValue === \"string\") {\n propValue = \"\";\n }\n if (propName === \"value\") {\n // value can be manipulated by the user directly and using event.preventDefault() is not an option\n let domValue = (domNode as any)[propName];\n if (\n domValue !== propValue && // The 'value' in the DOM tree !== newValue\n ((domNode as any)[\"oninput-value\"]\n ? domValue === (domNode as any)[\"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 // The edge cases are described in the tests\n (domNode as any)[propName] = propValue; // Reset the value, even if the virtual DOM did not change\n (domNode as any)[\"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 } else if (propValue !== previousValue) {\n let type = typeof propValue;\n if (type !== \"function\" || !projectionOptions.eventHandlerInterceptor) {\n // Function updates are expected to be handled by the EventHandlerInterceptor\n if (projectionOptions.namespace === NAMESPACE_SVG) {\n if (propName === \"href\") {\n (domNode as Element).setAttributeNS(NAMESPACE_XLINK, propName, propValue);\n } else {\n // all SVG attributes are read-only in DOM, so...\n (domNode as Element).setAttribute(propName, propValue);\n }\n } else if (type === \"string\" && propName !== \"innerHTML\") {\n if (propName === \"role\" && propValue === \"\") {\n (domNode as any).removeAttribute(propName);\n } else {\n (domNode as Element).setAttribute(propName, propValue);\n }\n } else if ((domNode as any)[propName] !== propValue) {\n // Comparison is here for side-effects in Edge with scrollLeft and scrollTop\n (domNode as any)[propName] = propValue;\n }\n\n propertiesUpdated = true;\n }\n }\n }\n }\n return propertiesUpdated;\n};\n\nlet updateChildren = (\n vnode: VNode,\n domNode: Node,\n oldChildren: VNode[] | undefined,\n newChildren: VNode[] | undefined,\n projectionOptions: ProjectionOptions\n) => {\n if (oldChildren === newChildren) {\n return false;\n }\n oldChildren = oldChildren || emptyArray;\n newChildren = newChildren || emptyArray;\n let oldChildrenLength = oldChildren.length;\n let newChildrenLength = newChildren.length;\n\n let oldIndex = 0;\n let newIndex = 0;\n let i: number;\n let textUpdated = false;\n while (newIndex < newChildrenLength) {\n let oldChild = oldIndex < oldChildrenLength ? oldChildren[oldIndex] : undefined;\n let newChild = newChildren[newIndex];\n if (oldChild !== undefined && same(oldChild, newChild)) {\n textUpdated = updateDom(oldChild, newChild, projectionOptions) || textUpdated;\n oldIndex++;\n } else {\n let 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]);\n checkDistinguishable(oldChildren, i, vnode, \"removed\");\n }\n textUpdated =\n updateDom(oldChildren[findOldIndex], newChild, projectionOptions) || textUpdated;\n oldIndex = findOldIndex + 1;\n } else {\n // New child\n createDom(\n newChild,\n domNode,\n oldIndex < oldChildrenLength ? oldChildren[oldIndex].domNode : undefined,\n projectionOptions\n );\n nodeAdded(newChild);\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]);\n checkDistinguishable(oldChildren, i, vnode, \"removed\");\n }\n }\n return textUpdated;\n};\n\nupdateDom = (previous, vnode, projectionOptions) => {\n let domNode = previous.domNode!;\n let 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 let updated = false;\n if (vnode.vnodeSelector === \"\") {\n if (vnode.text !== previous.text) {\n let newTextNode = domNode.ownerDocument!.createTextNode(vnode.text!);\n domNode.parentNode!.replaceChild(newTextNode, domNode);\n vnode.domNode = newTextNode;\n textUpdated = true;\n return textUpdated;\n }\n vnode.domNode = domNode;\n } else {\n if (vnode.vnodeSelector.lastIndexOf(\"svg\", 0) === 0) {\n // lastIndexOf(needle,0)===0 means StartsWith\n projectionOptions = extend(projectionOptions, {\n namespace: NAMESPACE_SVG,\n });\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 vnode.domNode = domNode;\n updated =\n updateChildren(vnode, domNode, previous.children, vnode.children, projectionOptions) ||\n updated;\n updated =\n updateProperties(domNode, previous.properties, vnode.properties, projectionOptions) ||\n updated;\n if (vnode.properties && vnode.properties.afterUpdate) {\n vnode.properties.afterUpdate.apply(vnode.properties.bind || vnode.properties, [\n <Element>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(<Element>domNode, vnode.properties, previous.properties);\n }\n return textUpdated;\n};\n\nexport let createProjection = (vnode: VNode, projectionOptions: ProjectionOptions): Projection => {\n return {\n getLastRender: () => vnode,\n update: (updatedVnode: VNode) => {\n if (vnode.vnodeSelector !== updatedVnode.vnodeSelector) {\n throw new Error(\n \"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 }\n let previousVNode = vnode;\n vnode = updatedVnode;\n updateDom(previousVNode, updatedVnode, projectionOptions);\n },\n domNode: <Element>vnode.domNode,\n };\n};\n"]}
package/dist/projector.js CHANGED
@@ -27,6 +27,7 @@ var findVNodeByParentNodePath = function (vnode, parentNodePath) {
27
27
  var createEventHandlerInterceptor = function (projector, getProjection, performanceLogger) {
28
28
  return function (propertyName, eventHandler, domNode, properties) { return modifiedEventHandler; };
29
29
  function modifiedEventHandler(evt) {
30
+ var _a, _b;
30
31
  performanceLogger("domEvent", evt);
31
32
  var projection = getProjection();
32
33
  var parentNodePath = createParentNodePath(evt.currentTarget, projection.domNode);
@@ -36,7 +37,8 @@ var createEventHandlerInterceptor = function (projector, getProjection, performa
36
37
  var result;
37
38
  if (matchingVNode) {
38
39
  /* eslint-disable prefer-rest-params */
39
- result = matchingVNode.properties["on".concat(evt.type)].apply(matchingVNode.properties.bind || this, arguments);
40
+ var listener = (_b = (_a = matchingVNode.properties["on".concat(evt.type)]) !== null && _a !== void 0 ? _a : matchingVNode.properties.on[evt.type].listener) !== null && _b !== void 0 ? _b : matchingVNode.properties.on[evt.type];
41
+ result = listener.apply(matchingVNode.properties.bind || this, arguments);
40
42
  /* eslint-enable prefer-rest-params */
41
43
  }
42
44
  performanceLogger("domEventProcessed", evt);
@@ -1 +1 @@
1
- {"version":3,"file":"projector.js","sourceRoot":"","sources":["../src/projector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AA8B3D,IAAI,oBAAoB,GAAG,UAAC,IAAiB,EAAE,QAAiB;IAC9D,IAAI,cAAc,GAAW,EAAE,CAAC;IAChC,OAAO,IAAI,IAAI,IAAI,KAAK,QAAQ,EAAE;QAChC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;KACxB;IACD,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC;AAEF,IAAI,IAAuE,CAAC;AAC5E,IAAK,KAAK,CAAC,SAAiB,CAAC,IAAI,EAAE;IACjC,IAAI,GAAG,UAAC,KAAK,EAAE,SAAS,IAAK,OAAA,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAArB,CAAqB,CAAC;CACpD;KAAM;IACL,IAAI,GAAG,UAAC,KAAK,EAAE,SAAS,IAAK,OAAA,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAA1B,CAA0B,CAAC;CACzD;AAED,IAAI,yBAAyB,GAAG,UAAC,KA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OAAO,EAAE,cAAc,CAAC,CAAC;QACtD,CAAC;QAED,MAAM,EAAE,UAAC,cAAc;YACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC/C,IAAI,eAAe,CAAC,CAAC,CAAC,KAAK,cAAc,EAAE;oBACzC,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;oBAC7B,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBACpC;aACF;YACD,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;KACF,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { applyDefaultProjectionOptions, dom } from \"./dom\";\n/**\n * A projector is used to create the real DOM from the the virtual DOM and to keep it up-to-date afterwards.\n *\n * You can call [[append]], [[merge]], [[insertBefore]] and [[replace]] to add the virtual DOM to the real DOM.\n * The `renderFunction` callbacks will be called to create the real DOM immediately.\n * Afterwards, the `renderFunction` callbacks will be called again to update the DOM on the next animation-frame after:\n *\n * - The Projector's [[scheduleRender]] function was called\n * - An event handler (like `onclick`) on a rendered [[VNode]] was called.\n *\n * The projector stops when [[stop]] is called or when an error is thrown during rendering.\n * It is possible to use `window.onerror` to handle these errors.\n * Instances of [[Projector]] can be created using [[createProjector]].\n *\n * If you need a customized projector, please check the maquette-advanced-projector project which provides a\n * versatile stand-in replacement.\n */\nimport {\n EventHandler,\n EventHandlerInterceptor,\n Projection,\n ProjectionOptions,\n Projector,\n ProjectorOptions,\n ProjectorPerformanceLogger,\n VNode,\n VNodeProperties,\n} from \"./interfaces\";\n\nlet createParentNodePath = (node: Node | null, rootNode: Element) => {\n let parentNodePath: Node[] = [];\n while (node && node !== rootNode) {\n parentNodePath.push(node);\n node = node.parentNode;\n }\n return parentNodePath;\n};\n\nlet find: <T>(items: T[], predicate: (item: T) => boolean) => T | undefined;\nif ((Array.prototype as any).find) {\n find = (items, predicate) => items.find(predicate);\n} else {\n find = (items, predicate) => items.filter(predicate)[0];\n}\n\nlet findVNodeByParentNodePath = (vnode: VNode, parentNodePath: Node[]): VNode | undefined => {\n let result: VNode | undefined = vnode;\n parentNodePath.forEach((node) => {\n result =\n result && result.children\n ? find(result.children, (child) => child.domNode === node)\n : undefined;\n });\n return result;\n};\n\nlet createEventHandlerInterceptor = (\n projector: Projector,\n getProjection: () => Projection | undefined,\n performanceLogger: ProjectorPerformanceLogger\n): EventHandlerInterceptor => {\n return (\n propertyName: string,\n eventHandler: EventHandler,\n domNode: Node,\n properties: VNodeProperties\n ) => modifiedEventHandler;\n\n function modifiedEventHandler(this: Node, evt: Event): boolean | undefined | void {\n performanceLogger(\"domEvent\", evt);\n let projection = getProjection()!;\n let parentNodePath = createParentNodePath(evt.currentTarget as Element, projection.domNode);\n parentNodePath.reverse();\n let matchingVNode = findVNodeByParentNodePath(projection.getLastRender(), parentNodePath);\n\n projector.scheduleRender();\n\n let result: any;\n if (matchingVNode) {\n /* eslint-disable prefer-rest-params */\n result = matchingVNode.properties![`on${evt.type}`].apply(\n matchingVNode.properties!.bind || this,\n arguments\n );\n /* eslint-enable prefer-rest-params */\n }\n performanceLogger(\"domEventProcessed\", evt);\n return result;\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 */\nexport let createProjector = (projectorOptions?: ProjectorOptions): Projector => {\n let projector: Projector;\n let projectionOptions = applyDefaultProjectionOptions(projectorOptions);\n let performanceLogger = projectionOptions.performanceLogger!;\n let renderCompleted = true;\n let scheduled: number | undefined;\n let stopped = false;\n let projections = [] as Projection[];\n let renderFunctions = [] as (() => VNode)[]; // matches the projections array\n\n let addProjection = (\n /* one of: dom.append, dom.insertBefore, dom.replace, dom.merge */\n domFunction: (node: Element, vnode: VNode, projectionOptions: ProjectionOptions) => Projection,\n /* the parameter of the domFunction */\n node: Element,\n renderFunction: () => VNode\n ): void => {\n let projection: Projection | undefined;\n let getProjection = () => projection;\n projectionOptions.eventHandlerInterceptor = createEventHandlerInterceptor(\n projector,\n getProjection,\n performanceLogger\n );\n projection = domFunction(node, renderFunction(), projectionOptions);\n projections.push(projection);\n renderFunctions.push(renderFunction);\n };\n\n let doRender = () => {\n scheduled = undefined;\n if (!renderCompleted) {\n return; // The last render threw an error, it should have been logged in the browser console.\n }\n renderCompleted = false;\n performanceLogger(\"renderStart\", undefined);\n for (let i = 0; i < projections.length; i++) {\n let updatedVnode = renderFunctions[i]();\n performanceLogger(\"rendered\", undefined);\n projections[i].update(updatedVnode);\n performanceLogger(\"patched\", undefined);\n }\n performanceLogger(\"renderDone\", undefined);\n renderCompleted = true;\n };\n\n projector = {\n renderNow: doRender,\n scheduleRender: () => {\n if (!scheduled && !stopped) {\n scheduled = requestAnimationFrame(doRender);\n }\n },\n stop: () => {\n if (scheduled) {\n cancelAnimationFrame(scheduled);\n scheduled = undefined;\n }\n stopped = true;\n },\n\n resume: () => {\n stopped = false;\n renderCompleted = true;\n projector.scheduleRender();\n },\n\n append: (parentNode, renderFunction) => {\n addProjection(dom.append, parentNode, renderFunction);\n },\n\n insertBefore: (beforeNode, renderFunction) => {\n addProjection(dom.insertBefore, beforeNode, renderFunction);\n },\n\n merge: (domNode, renderFunction) => {\n addProjection(dom.merge, domNode, renderFunction);\n },\n\n replace: (domNode, renderFunction) => {\n addProjection(dom.replace, domNode, renderFunction);\n },\n\n detach: (renderFunction) => {\n for (let i = 0; i < renderFunctions.length; i++) {\n if (renderFunctions[i] === renderFunction) {\n renderFunctions.splice(i, 1);\n return projections.splice(i, 1)[0];\n }\n }\n throw new Error(\"renderFunction was not found\");\n },\n };\n return projector;\n};\n"]}
1
+ {"version":3,"file":"projector.js","sourceRoot":"","sources":["../src/projector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6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eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;oBAC7B,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrC,CAAC;YACH,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;KACF,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { applyDefaultProjectionOptions, dom } from \"./dom\";\n/**\n * A projector is used to create the real DOM from the the virtual DOM and to keep it up-to-date afterwards.\n *\n * You can call [[append]], [[merge]], [[insertBefore]] and [[replace]] to add the virtual DOM to the real DOM.\n * The `renderFunction` callbacks will be called to create the real DOM immediately.\n * Afterwards, the `renderFunction` callbacks will be called again to update the DOM on the next animation-frame after:\n *\n * - The Projector's [[scheduleRender]] function was called\n * - An event handler (like `onclick`) on a rendered [[VNode]] was called.\n *\n * The projector stops when [[stop]] is called or when an error is thrown during rendering.\n * It is possible to use `window.onerror` to handle these errors.\n * Instances of [[Projector]] can be created using [[createProjector]].\n *\n * If you need a customized projector, please check the maquette-advanced-projector project which provides a\n * versatile stand-in replacement.\n */\nimport {\n EventHandler,\n EventHandlerInterceptor,\n Projection,\n ProjectionOptions,\n Projector,\n ProjectorOptions,\n ProjectorPerformanceLogger,\n VNode,\n VNodeProperties,\n} from \"./interfaces\";\n\nlet createParentNodePath = (node: Node | null, rootNode: Element) => {\n let parentNodePath: Node[] = [];\n while (node && node !== rootNode) {\n parentNodePath.push(node);\n node = node.parentNode;\n }\n return parentNodePath;\n};\n\nlet find: <T>(items: T[], predicate: (item: T) => boolean) => T | undefined;\nif ((Array.prototype as any).find) {\n find = (items, predicate) => items.find(predicate);\n} else {\n find = (items, predicate) => items.filter(predicate)[0];\n}\n\nlet findVNodeByParentNodePath = (vnode: VNode, parentNodePath: Node[]): VNode | undefined => {\n let result: VNode | undefined = vnode;\n parentNodePath.forEach((node) => {\n result =\n result && result.children\n ? find(result.children, (child) => child.domNode === node)\n : undefined;\n });\n return result;\n};\n\nlet createEventHandlerInterceptor = (\n projector: Projector,\n getProjection: () => Projection | undefined,\n performanceLogger: ProjectorPerformanceLogger\n): EventHandlerInterceptor => {\n return (\n propertyName: string,\n eventHandler: EventHandler,\n domNode: Node,\n properties: VNodeProperties\n ) => modifiedEventHandler;\n\n function modifiedEventHandler(this: Node, evt: Event): boolean | undefined | void {\n performanceLogger(\"domEvent\", evt);\n let projection = getProjection()!;\n let parentNodePath = createParentNodePath(evt.currentTarget as Element, projection.domNode);\n parentNodePath.reverse();\n let matchingVNode = findVNodeByParentNodePath(projection.getLastRender(), parentNodePath);\n\n projector.scheduleRender();\n\n let result: any;\n if (matchingVNode) {\n /* eslint-disable prefer-rest-params */\n let listener =\n matchingVNode.properties![`on${evt.type}`] ??\n (matchingVNode.properties!.on![evt.type] as { listener: EventHandler }).listener ??\n (matchingVNode.properties!.on![evt.type] as EventHandler);\n result = listener.apply(matchingVNode.properties!.bind || this, arguments);\n /* eslint-enable prefer-rest-params */\n }\n performanceLogger(\"domEventProcessed\", evt);\n return result;\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 */\nexport let createProjector = (projectorOptions?: ProjectorOptions): Projector => {\n let projector: Projector;\n let projectionOptions = applyDefaultProjectionOptions(projectorOptions);\n let performanceLogger = projectionOptions.performanceLogger!;\n let renderCompleted = true;\n let scheduled: number | undefined;\n let stopped = false;\n let projections = [] as Projection[];\n let renderFunctions = [] as (() => VNode)[]; // matches the projections array\n\n let addProjection = (\n /* one of: dom.append, dom.insertBefore, dom.replace, dom.merge */\n domFunction: (node: Element, vnode: VNode, projectionOptions: ProjectionOptions) => Projection,\n /* the parameter of the domFunction */\n node: Element,\n renderFunction: () => VNode\n ): void => {\n let projection: Projection | undefined;\n let getProjection = () => projection;\n projectionOptions.eventHandlerInterceptor = createEventHandlerInterceptor(\n projector,\n getProjection,\n performanceLogger\n );\n projection = domFunction(node, renderFunction(), projectionOptions);\n projections.push(projection);\n renderFunctions.push(renderFunction);\n };\n\n let doRender = () => {\n scheduled = undefined;\n if (!renderCompleted) {\n return; // The last render threw an error, it should have been logged in the browser console.\n }\n renderCompleted = false;\n performanceLogger(\"renderStart\", undefined);\n for (let i = 0; i < projections.length; i++) {\n let updatedVnode = renderFunctions[i]();\n performanceLogger(\"rendered\", undefined);\n projections[i].update(updatedVnode);\n performanceLogger(\"patched\", undefined);\n }\n performanceLogger(\"renderDone\", undefined);\n renderCompleted = true;\n };\n\n projector = {\n renderNow: doRender,\n scheduleRender: () => {\n if (!scheduled && !stopped) {\n scheduled = requestAnimationFrame(doRender);\n }\n },\n stop: () => {\n if (scheduled) {\n cancelAnimationFrame(scheduled);\n scheduled = undefined;\n }\n stopped = true;\n },\n\n resume: () => {\n stopped = false;\n renderCompleted = true;\n projector.scheduleRender();\n },\n\n append: (parentNode, renderFunction) => {\n addProjection(dom.append, parentNode, renderFunction);\n },\n\n insertBefore: (beforeNode, renderFunction) => {\n addProjection(dom.insertBefore, beforeNode, renderFunction);\n },\n\n merge: (domNode, renderFunction) => {\n addProjection(dom.merge, domNode, renderFunction);\n },\n\n replace: (domNode, renderFunction) => {\n addProjection(dom.replace, domNode, renderFunction);\n },\n\n detach: (renderFunction) => {\n for (let i = 0; i < renderFunctions.length; i++) {\n if (renderFunctions[i] === renderFunction) {\n renderFunctions.splice(i, 1);\n return projections.splice(i, 1)[0];\n }\n }\n throw new Error(\"renderFunction was not found\");\n },\n };\n return projector;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"window-performance-projector-logger.js","sourceRoot":"","sources":["../../src/utilities/window-performance-projector-logger.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,IAAI,gCAA4D,CAAC;AAExE,IAAK,MAAc,CAAC,WAAW,IAAK,MAAc,CAAC,WAAW,CAAC,OAAO,EAAE;IACtE,IAAI,aAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IACrC,IAAI,UAA4C,CAAC;IACjD,gCAAgC,GAAG,UACjC,SAAiC,EACjC,OAA0B;QAE1B,aAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5B,QAAQ,SAAS,EAAE;YACjB,KAAK,mBAAmB;gBACtB,aAAW,CAAC,OAAO,CAAC,cAAc,EAAE,UAAU,EAAE,mBAAmB,CAAC,CAAC;gBACrE,MAAM;YACR,KAAK,YAAY;gBACf,aAAW,CAAC,OAAO,CAAC,aAAa,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;gBAChE,MAAM;YACR,KAAK,UAAU;gBACb,aAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAQ,EAAE,UAAU,CAAC,CAAC;gBACpD,MAAM;YACR,KAAK,SAAS;gBACZ,aAAW,CAAC,OAAO,CAAC,YAAY,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;gBACzD,MAAM;SACT;QACD,UAAQ,GAAG,SAAS,CAAC;IACvB,CAAC,CAAC;CACH;KAAM;IACL,gCAAgC,GAAG,cAAM,OAAA,SAAS,EAAT,CAAS,CAAC;CACpD","sourcesContent":["import { PerformanceLoggerEvent, ProjectorPerformanceLogger } from \"../interfaces\";\n\n/**\n * A `ProjectorPerformanceLogger` that reports measurements to window.performance.measure\n *\n * Can be passed to `createProjector` to get more insights into the virtual DOM performance.\n */\nexport let windowPerformanceProjectorLogger: ProjectorPerformanceLogger;\n\nif ((window as any).performance && (window as any).performance.measure) {\n let performance = window.performance;\n let lastMark: PerformanceLoggerEvent | undefined;\n windowPerformanceProjectorLogger = (\n eventType: PerformanceLoggerEvent,\n trigger: Event | undefined\n ) => {\n performance.mark(eventType);\n switch (eventType) {\n case \"domEventProcessed\":\n performance.measure(\"eventHandler\", \"domEvent\", \"domEventProcessed\");\n break;\n case \"renderDone\":\n performance.measure(\"renderCycle\", \"renderStart\", \"renderDone\");\n break;\n case \"rendered\":\n performance.measure(\"render\", lastMark, \"rendered\");\n break;\n case \"patched\":\n performance.measure(\"diff+patch\", \"rendered\", \"patched\");\n break;\n }\n lastMark = eventType;\n };\n} else {\n windowPerformanceProjectorLogger = () => undefined;\n}\n"]}
1
+ {"version":3,"file":"window-performance-projector-logger.js","sourceRoot":"","sources":["../../src/utilities/window-performance-projector-logger.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,IAAI,gCAA4D,CAAC;AAExE,IAAK,MAAc,CAAC,WAAW,IAAK,MAAc,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;IACvE,IAAI,aAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IACrC,IAAI,UAA4C,CAAC;IACjD,gCAAgC,GAAG,UACjC,SAAiC,EACjC,OAA0B;QAE1B,aAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5B,QAAQ,SAAS,EAAE,CAAC;YAClB,KAAK,mBAAmB;gBACtB,aAAW,CAAC,OAAO,CAAC,cAAc,EAAE,UAAU,EAAE,mBAAmB,CAAC,CAAC;gBACrE,MAAM;YACR,KAAK,YAAY;gBACf,aAAW,CAAC,OAAO,CAAC,aAAa,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;gBAChE,MAAM;YACR,KAAK,UAAU;gBACb,aAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAQ,EAAE,UAAU,CAAC,CAAC;gBACpD,MAAM;YACR,KAAK,SAAS;gBACZ,aAAW,CAAC,OAAO,CAAC,YAAY,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;gBACzD,MAAM;QACV,CAAC;QACD,UAAQ,GAAG,SAAS,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC;KAAM,CAAC;IACN,gCAAgC,GAAG,cAAM,OAAA,SAAS,EAAT,CAAS,CAAC;AACrD,CAAC","sourcesContent":["import { PerformanceLoggerEvent, ProjectorPerformanceLogger } from \"../interfaces\";\n\n/**\n * A `ProjectorPerformanceLogger` that reports measurements to window.performance.measure\n *\n * Can be passed to `createProjector` to get more insights into the virtual DOM performance.\n */\nexport let windowPerformanceProjectorLogger: ProjectorPerformanceLogger;\n\nif ((window as any).performance && (window as any).performance.measure) {\n let performance = window.performance;\n let lastMark: PerformanceLoggerEvent | undefined;\n windowPerformanceProjectorLogger = (\n eventType: PerformanceLoggerEvent,\n trigger: Event | undefined\n ) => {\n performance.mark(eventType);\n switch (eventType) {\n case \"domEventProcessed\":\n performance.measure(\"eventHandler\", \"domEvent\", \"domEventProcessed\");\n break;\n case \"renderDone\":\n performance.measure(\"renderCycle\", \"renderStart\", \"renderDone\");\n break;\n case \"rendered\":\n performance.measure(\"render\", lastMark, \"rendered\");\n break;\n case \"patched\":\n performance.measure(\"diff+patch\", \"rendered\", \"patched\");\n break;\n }\n lastMark = eventType;\n };\n} else {\n windowPerformanceProjectorLogger = () => undefined;\n}\n"]}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "animation",
9
9
  "transitions"
10
10
  ],
11
- "version": "3.6.0",
11
+ "version": "4.0.1",
12
12
  "author": "Johan Gorter <johan@johangorter.com>",
13
13
  "repository": {
14
14
  "type": "git",
@@ -27,9 +27,10 @@
27
27
  "fixall": "tsa fixall",
28
28
  "clean": "tsa clean",
29
29
  "dist": "tsc -p ./src/tsconfig.json && tsc -p ./examples/tsconfig.json && rollup -c --bundleConfigAsCjs && uglifyjs ./dist/maquette.umd.js -c unsafe=true,unsafe_comps=true,unsafe_math=true,passes=3 -m -o ./dist/maquette.umd.min.js",
30
+ "start": "npm -s run dist && npx http-server . -p 8080 -o",
30
31
  "test": "tsa ci",
31
32
  "ci": "tsa ci && npm -s run dist && ts-node ./tools/check-file-size",
32
- "publish-website": "cd website && npm install --no-optional --force && node generate && npm run typedoc && ./node_modules/.bin/firebase deploy",
33
+ "publish-website": "cd website && npm install --no-optional --force && npm run deploy",
33
34
  "test-also-with-browser": "npm run dist && cd examples/todomvc && npm install --no-save bower && bower install && cd ../../browser-tests && npm install && npm test"
34
35
  },
35
36
  "license": "MIT",
@@ -77,18 +78,18 @@
77
78
  }
78
79
  },
79
80
  "devDependencies": {
80
- "@types/chai-as-promised": "7.1.5",
81
- "@types/node": "18.15.11",
82
- "@types/sinon": "10.0.13",
83
- "@types/sinon-chai": "3.2.9",
84
- "@types/sinonjs__fake-timers": "8.1.2",
81
+ "@types/chai-as-promised": "7.1.8",
82
+ "@types/node": "20.11.10",
83
+ "@types/sinon": "17.0.3",
84
+ "@types/sinon-chai": "3.2.12",
85
+ "@types/sinonjs__fake-timers": "8.1.5",
85
86
  "chai-as-promised": "7.1.1",
86
- "jsdom": "21.1.1",
87
+ "jsdom": "24.0.0",
87
88
  "jsdom-global": "3.0.2",
88
- "rollup": "3.20.2",
89
- "sinon": "15.0.3",
89
+ "rollup": "4.9.6",
90
+ "sinon": "17.0.1",
90
91
  "sinon-chai": "3.7.0",
91
- "typescript-assistant": "^0.60.0"
92
+ "typescript-assistant": "0.65.7"
92
93
  },
93
94
  "importSort": {
94
95
  ".js, .jsx, .ts, .tsx": {