@bpmn-io/properties-panel 3.13.0 → 3.14.0

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.
Files changed (90) hide show
  1. package/dist/assets/properties-panel.css +0 -4
  2. package/dist/index.esm.js +31 -22
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.js +66 -63
  5. package/dist/index.js.map +1 -1
  6. package/package.json +27 -30
  7. package/preact/README.md +2 -2
  8. package/preact/compat/LICENSE +21 -0
  9. package/preact/compat/dist/compat.js +1 -1
  10. package/preact/compat/dist/compat.js.map +1 -1
  11. package/preact/compat/dist/compat.mjs +1 -1
  12. package/preact/compat/dist/compat.module.js +1 -1
  13. package/preact/compat/dist/compat.module.js.map +1 -1
  14. package/preact/compat/dist/compat.umd.js +1 -1
  15. package/preact/compat/dist/compat.umd.js.map +1 -1
  16. package/preact/compat/server.browser.js +7 -0
  17. package/preact/compat/server.mjs +7 -0
  18. package/preact/compat/src/index.d.ts +22 -8
  19. package/preact/compat/src/index.js +35 -3
  20. package/preact/compat/src/portals.js +26 -35
  21. package/preact/compat/src/suspense.js +9 -6
  22. package/preact/compat/src/util.js +0 -5
  23. package/preact/debug/LICENSE +21 -0
  24. package/preact/debug/dist/debug.js +1 -1
  25. package/preact/debug/dist/debug.js.map +1 -1
  26. package/preact/debug/dist/debug.mjs +1 -1
  27. package/preact/debug/dist/debug.module.js +1 -1
  28. package/preact/debug/dist/debug.module.js.map +1 -1
  29. package/preact/debug/dist/debug.umd.js +1 -1
  30. package/preact/debug/dist/debug.umd.js.map +1 -1
  31. package/preact/debug/src/debug.js +124 -42
  32. package/preact/devtools/LICENSE +21 -0
  33. package/preact/devtools/dist/devtools.js +1 -1
  34. package/preact/devtools/dist/devtools.js.map +1 -1
  35. package/preact/devtools/dist/devtools.mjs +1 -1
  36. package/preact/devtools/dist/devtools.module.js +1 -1
  37. package/preact/devtools/dist/devtools.module.js.map +1 -1
  38. package/preact/devtools/dist/devtools.umd.js +1 -1
  39. package/preact/devtools/dist/devtools.umd.js.map +1 -1
  40. package/preact/devtools/src/devtools.js +1 -1
  41. package/preact/dist/preact.js +1 -1
  42. package/preact/dist/preact.js.map +1 -1
  43. package/preact/dist/preact.min.js +1 -1
  44. package/preact/dist/preact.min.js.map +1 -1
  45. package/preact/dist/preact.min.module.js +1 -1
  46. package/preact/dist/preact.min.module.js.map +1 -1
  47. package/preact/dist/preact.min.umd.js +1 -1
  48. package/preact/dist/preact.min.umd.js.map +1 -1
  49. package/preact/dist/preact.mjs +1 -1
  50. package/preact/dist/preact.module.js +1 -1
  51. package/preact/dist/preact.module.js.map +1 -1
  52. package/preact/dist/preact.umd.js +1 -1
  53. package/preact/dist/preact.umd.js.map +1 -1
  54. package/preact/hooks/LICENSE +21 -0
  55. package/preact/jsx-runtime/LICENSE +21 -0
  56. package/preact/jsx-runtime/dist/jsxRuntime.js +1 -1
  57. package/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -1
  58. package/preact/jsx-runtime/dist/jsxRuntime.mjs +1 -1
  59. package/preact/jsx-runtime/dist/jsxRuntime.module.js +1 -1
  60. package/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -1
  61. package/preact/jsx-runtime/dist/jsxRuntime.umd.js +1 -1
  62. package/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -1
  63. package/preact/jsx-runtime/src/index.d.ts +10 -0
  64. package/preact/jsx-runtime/src/index.js +113 -4
  65. package/preact/jsx-runtime/src/utils.js +36 -0
  66. package/preact/package.json +4 -3
  67. package/preact/src/clone-element.js +6 -4
  68. package/preact/src/component.js +34 -28
  69. package/preact/src/constants.js +13 -1
  70. package/preact/src/create-context.js +3 -3
  71. package/preact/src/create-element.js +14 -11
  72. package/preact/src/diff/catch-error.js +11 -7
  73. package/preact/src/diff/children.js +321 -218
  74. package/preact/src/diff/index.js +188 -142
  75. package/preact/src/diff/props.js +31 -38
  76. package/preact/src/index.d.ts +38 -19
  77. package/preact/src/index.js +1 -1
  78. package/preact/src/internal.d.ts +183 -153
  79. package/preact/src/jsx.d.ts +883 -19
  80. package/preact/src/options.js +1 -1
  81. package/preact/src/render.js +11 -11
  82. package/preact/src/util.js +2 -2
  83. package/preact/test-utils/dist/testUtils.js +1 -1
  84. package/preact/test-utils/dist/testUtils.js.map +1 -1
  85. package/preact/test-utils/dist/testUtils.mjs +1 -1
  86. package/preact/test-utils/dist/testUtils.module.js +1 -1
  87. package/preact/test-utils/dist/testUtils.module.js.map +1 -1
  88. package/preact/test-utils/dist/testUtils.umd.js +1 -1
  89. package/preact/test-utils/dist/testUtils.umd.js.map +1 -1
  90. package/preact/test-utils/src/index.js +13 -5
@@ -7,7 +7,7 @@ import { _catchError } from './diff/catch-error';
7
7
  * and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`
8
8
  * for a full list of available option hooks (most editors/IDEs allow you to
9
9
  * ctrl+click or cmd+click on mac the type definition below).
10
- * @type {import('./internal').Options}
10
+ * @type {Options}
11
11
  */
12
12
  const options = {
13
13
  _catchError
@@ -6,10 +6,9 @@ import { slice } from './util';
6
6
 
7
7
  /**
8
8
  * Render a Preact virtual node into a DOM element
9
- * @param {import('./internal').ComponentChild} vnode The virtual node to render
10
- * @param {import('./internal').PreactElement} parentDom The DOM element to
11
- * render into
12
- * @param {import('./internal').PreactElement | object} [replaceNode] Optional: Attempt to re-use an
9
+ * @param {ComponentChild} vnode The virtual node to render
10
+ * @param {PreactElement} parentDom The DOM element to render into
11
+ * @param {PreactElement | object} [replaceNode] Optional: Attempt to re-use an
13
12
  * existing DOM tree rooted at `replaceNode`
14
13
  */
15
14
  export function render(vnode, parentDom, replaceNode) {
@@ -18,7 +17,7 @@ export function render(vnode, parentDom, replaceNode) {
18
17
  // We abuse the `replaceNode` parameter in `hydrate()` to signal if we are in
19
18
  // hydration mode or not by passing the `hydrate` function instead of a DOM
20
19
  // element..
21
- let isHydrating = typeof replaceNode === 'function';
20
+ let isHydrating = typeof replaceNode == 'function';
22
21
 
23
22
  // To be able to support calling `render()` multiple times on the same
24
23
  // DOM node, we need to obtain a reference to the previous tree. We do
@@ -33,7 +32,8 @@ export function render(vnode, parentDom, replaceNode) {
33
32
  createElement(Fragment, null, [vnode]);
34
33
 
35
34
  // List of effects that need to be called after diffing.
36
- let commitQueue = [];
35
+ let commitQueue = [],
36
+ refQueue = [];
37
37
  diff(
38
38
  parentDom,
39
39
  // Determine the new vnode tree and store it on the DOM element on
@@ -55,18 +55,18 @@ export function render(vnode, parentDom, replaceNode) {
55
55
  : oldVNode
56
56
  ? oldVNode._dom
57
57
  : parentDom.firstChild,
58
- isHydrating
58
+ isHydrating,
59
+ refQueue
59
60
  );
60
61
 
61
62
  // Flush all queued effects
62
- commitRoot(commitQueue, vnode);
63
+ commitRoot(commitQueue, vnode, refQueue);
63
64
  }
64
65
 
65
66
  /**
66
67
  * Update an existing DOM element with data from a Preact virtual node
67
- * @param {import('./internal').ComponentChild} vnode The virtual node to render
68
- * @param {import('./internal').PreactElement} parentDom The DOM element to
69
- * update
68
+ * @param {ComponentChild} vnode The virtual node to render
69
+ * @param {PreactElement} parentDom The DOM element to update
70
70
  */
71
71
  export function hydrate(vnode, parentDom) {
72
72
  render(vnode, parentDom, hydrate);
@@ -10,7 +10,7 @@ export const isArray = Array.isArray;
10
10
  * @returns {O & P}
11
11
  */
12
12
  export function assign(obj, props) {
13
- // @ts-ignore We change the type of `obj` to be `O & P`
13
+ // @ts-expect-error We change the type of `obj` to be `O & P`
14
14
  for (let i in props) obj[i] = props[i];
15
15
  return /** @type {O & P} */ (obj);
16
16
  }
@@ -19,7 +19,7 @@ export function assign(obj, props) {
19
19
  * Remove a child node from its parent if attached. This is a workaround for
20
20
  * IE11 which doesn't support `Element.prototype.remove()`. Using this function
21
21
  * is smaller than including a dedicated polyfill.
22
- * @param {Node} node The node to remove
22
+ * @param {preact.ContainerNode} node The node to remove
23
23
  */
24
24
  export function removeNode(node) {
25
25
  let parentNode = node.parentNode;
@@ -1,2 +1,2 @@
1
- var r=require("../..");function n(){return r.options.t=r.options.debounceRendering,r.options.debounceRendering=function(n){return r.options.o=n},function(){return r.options.o&&r.options.o()}}var t=function(r){return null!=r&&"function"==typeof r.then},e=0;function o(){r.options.o&&(r.options.o(),delete r.options.o),void 0!==r.options.t?(r.options.debounceRendering=r.options.t,delete r.options.t):r.options.debounceRendering=void 0}exports.act=function(u){if(++e>1){var i=u();return t(i)?i.then(function(){--e}):(--e,Promise.resolve())}var f,c,a=r.options.requestAnimationFrame,l=n();r.options.requestAnimationFrame=function(r){return f=r};var v,p,s=function(){try{for(l();f;)c=f,f=null,c(),l()}catch(r){v||(v=r)}finally{o()}r.options.requestAnimationFrame=a,--e};try{p=u()}catch(r){v=r}if(t(p))return p.then(s,function(r){throw s(),r});if(s(),v)throw v;return Promise.resolve()},exports.setupRerender=n,exports.teardown=o;
1
+ var r=require("../..");function t(){return r.options.t=r.options.debounceRendering,r.options.debounceRendering=function(t){return r.options.o=t},function(){return r.options.o&&r.options.o()}}var n=function(r){return null!=r&&"function"==typeof r.then},o=0;function e(){r.options.o&&(r.options.o(),delete r.options.o),void 0!==r.options.t?(r.options.debounceRendering=r.options.t,delete r.options.t):r.options.debounceRendering=void 0}exports.act=function(u){if(++o>1){try{var i=u();if(n(i))return i.then(function(){--o},function(r){throw--o,r})}catch(r){throw--o,r}return--o,Promise.resolve()}var c,f,a=r.options.requestAnimationFrame,l=t();r.options.requestAnimationFrame=function(r){return c=r};var h,v,p=function(){try{for(l();c;)f=c,c=null,f(),l()}catch(r){h||(h=r)}finally{e()}r.options.requestAnimationFrame=a,--o};try{v=u()}catch(r){h=r}if(n(v))return v.then(p,function(r){throw p(),r});if(p(),h)throw h;return Promise.resolve()},exports.setupRerender=t,exports.teardown=e;
2
2
  //# sourceMappingURL=testUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"testUtils.js","sources":["../src/index.js"],"sourcesContent":["import { options } from '../..';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\tconst result = cb();\n\t\tif (isThenable(result)) {\n\t\t\treturn result.then(() => {\n\t\t\t\t--actDepth;\n\t\t\t});\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flush, toFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => (flush = fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flush) {\n\t\t\t\ttoFlush = flush;\n\t\t\t\tflush = null;\n\n\t\t\t\ttoFlush();\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","teardown","undefined","result","Promise","resolve","flush","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","fc","err","finish","e"],"mappings":"iCAMgBA,IAGf,OAFAC,EAAOA,QAACC,EAA2BD,EAAAA,QAAQE,kBAC3CF,EAAOA,QAACE,kBAAoB,SAAAC,UAAOH,UAAQI,EAAqBD,CAAlC,EACvB,WAAA,OAAMH,EAAOA,QAACI,GAAsBJ,UAAQI,GAA5C,CACP,CAED,IAAMC,EAAa,SAAAC,GAAK,OAAa,MAATA,GAAsC,mBAAdA,EAAMC,IAAlC,EAGpBC,EAAW,EAyFR,SAASC,IACXT,EAAOA,QAACI,IAEXJ,EAAOA,QAACI,WACDJ,EAAAA,QAAQI,QAG+B,IAApCJ,UAAQC,GAClBD,EAAAA,QAAQE,kBAAoBF,EAAOA,QAACC,SAC7BD,EAAOA,QAACC,GAEfD,EAAAA,QAAQE,uBAAoBQ,CAE7B,aA3FM,SAAaP,GACnB,KAAMK,EAAW,EAAG,CAOnB,IAAMG,EAASR,IACf,OAAIE,EAAWM,GACPA,EAAOJ,KAAK,aAChBC,CACF,MAEAA,EACKI,QAAQC,UACf,CAED,IAIIC,EAAOC,EAJLC,EAAgChB,EAAOA,QAACiB,sBACxCC,EAAWnB,IAMjBC,EAAOA,QAACiB,sBAAwB,SAAAE,GAAOL,OAAAA,EAAQK,CAAb,EAElC,IAsBIC,EACAT,EAvBEU,EAAS,WACd,IAEC,IADAH,IACOJ,GACNC,EAAUD,EACVA,EAAQ,KAERC,IACAG,GAQD,CANC,MAAOI,GACHF,IACJA,EAAME,EAEP,CAbD,QAcCb,GACA,CAEDT,EAAOA,QAACiB,sBAAwBD,IAC9BR,CACF,EAKD,IACCG,EAASR,GAGT,CAFC,MAAOmB,GACRF,EAAME,CACN,CAED,GAAIjB,EAAWM,GACd,OAAOA,EAAOJ,KAAKc,EAAQ,SAAAD,GAE1B,MADAC,IACMD,CACN,GAOF,GADAC,IACID,EACH,MAAMA,EAEP,OAAOR,QAAQC,SACf"}
1
+ {"version":3,"file":"testUtils.js","sources":["../src/index.js"],"sourcesContent":["import { options } from '../..';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\ttry {\n\t\t\tconst result = cb();\n\t\t\tif (isThenable(result)) {\n\t\t\t\treturn result.then(() => {\n\t\t\t\t\t--actDepth;\n\t\t\t\t}, (e) => {\n\t\t\t\t\t--actDepth;\n\t\t\t\t\tthrow e;\n\t\t\t\t})\n\t\t\t}\n\t\t} catch(e) {\n\t\t\t--actDepth;\n\t\t\tthrow e;\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flush, toFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => (flush = fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flush) {\n\t\t\t\ttoFlush = flush;\n\t\t\t\tflush = null;\n\n\t\t\t\ttoFlush();\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","teardown","undefined","act","result","e","Promise","resolve","flush","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","fc","err","finish"],"mappings":"wBAMO,SAASA,IAGf,OAFAC,EAAOA,QAACC,EAA2BD,EAAAA,QAAQE,kBAC3CF,EAAOA,QAACE,kBAAoB,SAAAC,GAAOH,OAAAA,EAAAA,QAAQI,EAAqBD,CAAlC,EACvB,WAAA,OAAMH,EAAAA,QAAQI,GAAsBJ,UAAQI,GAA5C,CACP,CAED,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,IAAlC,EAGpBC,EAAW,EAiGR,SAASC,IACXT,EAAOA,QAACI,IAEXJ,EAAOA,QAACI,WACDJ,EAAOA,QAACI,QAG+B,IAApCJ,EAAAA,QAAQC,GAClBD,EAAOA,QAACE,kBAAoBF,EAAAA,QAAQC,SAC7BD,EAAOA,QAACC,GAEfD,EAAAA,QAAQE,uBAAoBQ,CAE7B,aAnGeC,SAAIR,GACnB,KAAMK,EAAW,EAAG,CAOnB,IACC,IAAMI,EAAST,IACf,GAAIE,EAAWO,GACd,OAAOA,EAAOL,KAAK,aAChBC,CACF,EAAE,SAACK,GAEH,OADEL,EACIK,CACN,EAKF,CAHC,MAAMA,GAEP,OADEL,EACIK,CACN,CAED,QADEL,EACKM,QAAQC,SACf,CAED,IAIIC,EAAOC,EAJLC,EAAgClB,EAAAA,QAAQmB,sBACxCC,EAAWrB,IAMjBC,UAAQmB,sBAAwB,SAAAE,UAAOL,EAAQK,CAAb,EAElC,IAsBIC,EACAV,EAvBEW,EAAS,WACd,IAEC,IADAH,IACOJ,GACNC,EAAUD,EACVA,EAAQ,KAERC,IACAG,GAQD,CANC,MAAOP,GACHS,IACJA,EAAMT,EAEP,CAbD,QAcCJ,GACA,CAEDT,EAAAA,QAAQmB,sBAAwBD,IAC9BV,CACF,EAKD,IACCI,EAAST,GAGT,CAFC,MAAOU,GACRS,EAAMT,CACN,CAED,GAAIR,EAAWO,GACd,OAAOA,EAAOL,KAAKgB,EAAQ,SAAAD,GAE1B,MADAC,IACMD,CACN,GAOF,GADAC,IACID,EACH,MAAMA,EAEP,OAAOR,QAAQC,SACf"}
@@ -1,2 +1,2 @@
1
- import{options as n}from"../..";function r(){return n.t=n.debounceRendering,n.debounceRendering=function(r){return n.o=r},function(){return n.o&&n.o()}}var t=function(n){return null!=n&&"function"==typeof n.then},o=0;function u(u){if(++o>1){var e=u();return t(e)?e.then(function(){--o}):(--o,Promise.resolve())}var f,c,a=n.requestAnimationFrame,l=r();n.requestAnimationFrame=function(n){return f=n};var v,d,h=function(){try{for(l();f;)c=f,f=null,c(),l()}catch(n){v||(v=n)}finally{i()}n.requestAnimationFrame=a,--o};try{d=u()}catch(n){v=n}if(t(d))return d.then(h,function(n){throw h(),n});if(h(),v)throw v;return Promise.resolve()}function i(){n.o&&(n.o(),delete n.o),void 0!==n.t?(n.debounceRendering=n.t,delete n.t):n.debounceRendering=void 0}export{u as act,r as setupRerender,i as teardown};
1
+ import{options as t}from"../..";function n(){return t.t=t.debounceRendering,t.debounceRendering=function(n){return t.o=n},function(){return t.o&&t.o()}}var r=function(t){return null!=t&&"function"==typeof t.then},o=0;function u(u){if(++o>1){try{var e=u();if(r(e))return e.then(function(){--o},function(t){throw--o,t})}catch(t){throw--o,t}return--o,Promise.resolve()}var f,c,a=t.requestAnimationFrame,l=n();t.requestAnimationFrame=function(t){return f=t};var h,v,y=function(){try{for(l();f;)c=f,f=null,c(),l()}catch(t){h||(h=t)}finally{i()}t.requestAnimationFrame=a,--o};try{v=u()}catch(t){h=t}if(r(v))return v.then(y,function(t){throw y(),t});if(y(),h)throw h;return Promise.resolve()}function i(){t.o&&(t.o(),delete t.o),void 0!==t.t?(t.debounceRendering=t.t,delete t.t):t.debounceRendering=void 0}export{u as act,n as setupRerender,i as teardown};
2
2
  //# sourceMappingURL=testUtils.module.js.map
@@ -1,2 +1,2 @@
1
- import{options as n}from"../..";function r(){return n.t=n.debounceRendering,n.debounceRendering=function(r){return n.o=r},function(){return n.o&&n.o()}}var t=function(n){return null!=n&&"function"==typeof n.then},o=0;function u(u){if(++o>1){var e=u();return t(e)?e.then(function(){--o}):(--o,Promise.resolve())}var f,c,a=n.requestAnimationFrame,l=r();n.requestAnimationFrame=function(n){return f=n};var v,d,h=function(){try{for(l();f;)c=f,f=null,c(),l()}catch(n){v||(v=n)}finally{i()}n.requestAnimationFrame=a,--o};try{d=u()}catch(n){v=n}if(t(d))return d.then(h,function(n){throw h(),n});if(h(),v)throw v;return Promise.resolve()}function i(){n.o&&(n.o(),delete n.o),void 0!==n.t?(n.debounceRendering=n.t,delete n.t):n.debounceRendering=void 0}export{u as act,r as setupRerender,i as teardown};
1
+ import{options as t}from"../..";function n(){return t.t=t.debounceRendering,t.debounceRendering=function(n){return t.o=n},function(){return t.o&&t.o()}}var r=function(t){return null!=t&&"function"==typeof t.then},o=0;function u(u){if(++o>1){try{var e=u();if(r(e))return e.then(function(){--o},function(t){throw--o,t})}catch(t){throw--o,t}return--o,Promise.resolve()}var f,c,a=t.requestAnimationFrame,l=n();t.requestAnimationFrame=function(t){return f=t};var h,v,y=function(){try{for(l();f;)c=f,f=null,c(),l()}catch(t){h||(h=t)}finally{i()}t.requestAnimationFrame=a,--o};try{v=u()}catch(t){h=t}if(r(v))return v.then(y,function(t){throw y(),t});if(y(),h)throw h;return Promise.resolve()}function i(){t.o&&(t.o(),delete t.o),void 0!==t.t?(t.debounceRendering=t.t,delete t.t):t.debounceRendering=void 0}export{u as act,n as setupRerender,i as teardown};
2
2
  //# sourceMappingURL=testUtils.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"testUtils.module.js","sources":["../src/index.js"],"sourcesContent":["import { options } from '../..';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\tconst result = cb();\n\t\tif (isThenable(result)) {\n\t\t\treturn result.then(() => {\n\t\t\t\t--actDepth;\n\t\t\t});\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flush, toFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => (flush = fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flush) {\n\t\t\t\ttoFlush = flush;\n\t\t\t\tflush = null;\n\n\t\t\t\ttoFlush();\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","act","result","Promise","resolve","flush","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","fc","err","finish","e","teardown","undefined"],"mappings":"0CAMgBA,IAGf,OAFAC,EAAQC,EAA2BD,EAAQE,kBAC3CF,EAAQE,kBAAoB,SAAAC,UAAOH,EAAQI,EAAqBD,CAAlC,EACvB,WAAA,OAAMH,EAAQI,GAAsBJ,EAAQI,GAA5C,CACP,CAED,IAAMC,EAAa,SAAAC,GAAK,OAAa,MAATA,GAAsC,mBAAdA,EAAMC,IAAlC,EAGpBC,EAAW,EAWR,SAASC,EAAIN,GACnB,KAAMK,EAAW,EAAG,CAOnB,IAAME,EAASP,IACf,OAAIE,EAAWK,GACPA,EAAOH,KAAK,aAChBC,CACF,MAEAA,EACKG,QAAQC,UACf,CAED,IAIIC,EAAOC,EAJLC,EAAgCf,EAAQgB,sBACxCC,EAAWlB,IAMjBC,EAAQgB,sBAAwB,SAAAE,GAAOL,OAAAA,EAAQK,CAAb,EAElC,IAsBIC,EACAT,EAvBEU,EAAS,WACd,IAEC,IADAH,IACOJ,GACNC,EAAUD,EACVA,EAAQ,KAERC,IACAG,GAQD,CANC,MAAOI,GACHF,IACJA,EAAME,EAEP,CAbD,QAcCC,GACA,CAEDtB,EAAQgB,sBAAwBD,IAC9BP,CACF,EAKD,IACCE,EAASP,GAGT,CAFC,MAAOkB,GACRF,EAAME,CACN,CAED,GAAIhB,EAAWK,GACd,OAAOA,EAAOH,KAAKa,EAAQ,SAAAD,GAE1B,MADAC,IACMD,CACN,GAOF,GADAC,IACID,EACH,MAAMA,EAEP,OAAOR,QAAQC,SACf,CAKM,SAASU,IACXtB,EAAQI,IAEXJ,EAAQI,WACDJ,EAAQI,QAG+B,IAApCJ,EAAQC,GAClBD,EAAQE,kBAAoBF,EAAQC,SAC7BD,EAAQC,GAEfD,EAAQE,uBAAoBqB,CAE7B"}
1
+ {"version":3,"file":"testUtils.module.js","sources":["../src/index.js"],"sourcesContent":["import { options } from '../..';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\ttry {\n\t\t\tconst result = cb();\n\t\t\tif (isThenable(result)) {\n\t\t\t\treturn result.then(() => {\n\t\t\t\t\t--actDepth;\n\t\t\t\t}, (e) => {\n\t\t\t\t\t--actDepth;\n\t\t\t\t\tthrow e;\n\t\t\t\t})\n\t\t\t}\n\t\t} catch(e) {\n\t\t\t--actDepth;\n\t\t\tthrow e;\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flush, toFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => (flush = fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flush) {\n\t\t\t\ttoFlush = flush;\n\t\t\t\tflush = null;\n\n\t\t\t\ttoFlush();\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","act","result","e","Promise","resolve","flush","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","fc","err","finish","teardown","undefined"],"mappings":"iCAMO,SAASA,IAGf,OAFAC,EAAQC,EAA2BD,EAAQE,kBAC3CF,EAAQE,kBAAoB,SAAAC,GAAOH,OAAAA,EAAQI,EAAqBD,CAAlC,EACvB,WAAA,OAAMH,EAAQI,GAAsBJ,EAAQI,GAA5C,CACP,CAED,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,IAAlC,EAGpBC,EAAW,EAWCC,SAAAA,EAAIN,GACnB,KAAMK,EAAW,EAAG,CAOnB,IACC,IAAME,EAASP,IACf,GAAIE,EAAWK,GACd,OAAOA,EAAOH,KAAK,aAChBC,CACF,EAAE,SAACG,GAEH,OADEH,EACIG,CACN,EAKF,CAHC,MAAMA,GAEP,OADEH,EACIG,CACN,CAED,QADEH,EACKI,QAAQC,SACf,CAED,IAIIC,EAAOC,EAJLC,EAAgChB,EAAQiB,sBACxCC,EAAWnB,IAMjBC,EAAQiB,sBAAwB,SAAAE,UAAOL,EAAQK,CAAb,EAElC,IAsBIC,EACAV,EAvBEW,EAAS,WACd,IAEC,IADAH,IACOJ,GACNC,EAAUD,EACVA,EAAQ,KAERC,IACAG,GAQD,CANC,MAAOP,GACHS,IACJA,EAAMT,EAEP,CAbD,QAcCW,GACA,CAEDtB,EAAQiB,sBAAwBD,IAC9BR,CACF,EAKD,IACCE,EAASP,GAGT,CAFC,MAAOQ,GACRS,EAAMT,CACN,CAED,GAAIN,EAAWK,GACd,OAAOA,EAAOH,KAAKc,EAAQ,SAAAD,GAE1B,MADAC,IACMD,CACN,GAOF,GADAC,IACID,EACH,MAAMA,EAEP,OAAOR,QAAQC,SACf,CAKM,SAASS,IACXtB,EAAQI,IAEXJ,EAAQI,WACDJ,EAAQI,QAG+B,IAApCJ,EAAQC,GAClBD,EAAQE,kBAAoBF,EAAQC,SAC7BD,EAAQC,GAEfD,EAAQE,uBAAoBqB,CAE7B"}
@@ -1,2 +1,2 @@
1
- !function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("../..")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((n||self).preactTestUtils={},n.preact)}(this,function(n,t){function e(){return t.options.t=t.options.debounceRendering,t.options.debounceRendering=function(n){return t.options.o=n},function(){return t.options.o&&t.options.o()}}var r=function(n){return null!=n&&"function"==typeof n.then},o=0;function i(){t.options.o&&(t.options.o(),delete t.options.o),void 0!==t.options.t?(t.options.debounceRendering=t.options.t,delete t.options.t):t.options.debounceRendering=void 0}n.act=function(n){if(++o>1){var f=n();return r(f)?f.then(function(){--o}):(--o,Promise.resolve())}var u,c,l=t.options.requestAnimationFrame,d=e();t.options.requestAnimationFrame=function(n){return u=n};var a,p,s=function(){try{for(d();u;)c=u,u=null,c(),d()}catch(n){a||(a=n)}finally{i()}t.options.requestAnimationFrame=l,--o};try{p=n()}catch(n){a=n}if(r(p))return p.then(s,function(n){throw s(),n});if(s(),a)throw a;return Promise.resolve()},n.setupRerender=e,n.teardown=i});
1
+ !function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("../..")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((n||self).preactTestUtils={},n.preact)}(this,function(n,t){function e(){return t.options.t=t.options.debounceRendering,t.options.debounceRendering=function(n){return t.options.o=n},function(){return t.options.o&&t.options.o()}}var r=function(n){return null!=n&&"function"==typeof n.then},o=0;function i(){t.options.o&&(t.options.o(),delete t.options.o),void 0!==t.options.t?(t.options.debounceRendering=t.options.t,delete t.options.t):t.options.debounceRendering=void 0}n.act=function(n){if(++o>1){try{var f=n();if(r(f))return f.then(function(){--o},function(n){throw--o,n})}catch(n){throw--o,n}return--o,Promise.resolve()}var u,c,l=t.options.requestAnimationFrame,a=e();t.options.requestAnimationFrame=function(n){return u=n};var d,h,p=function(){try{for(a();u;)c=u,u=null,c(),a()}catch(n){d||(d=n)}finally{i()}t.options.requestAnimationFrame=l,--o};try{h=n()}catch(n){d=n}if(r(h))return h.then(p,function(n){throw p(),n});if(p(),d)throw d;return Promise.resolve()},n.setupRerender=e,n.teardown=i});
2
2
  //# sourceMappingURL=testUtils.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"testUtils.umd.js","sources":["../src/index.js"],"sourcesContent":["import { options } from '../..';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\tconst result = cb();\n\t\tif (isThenable(result)) {\n\t\t\treturn result.then(() => {\n\t\t\t\t--actDepth;\n\t\t\t});\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flush, toFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => (flush = fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flush) {\n\t\t\t\ttoFlush = flush;\n\t\t\t\tflush = null;\n\n\t\t\t\ttoFlush();\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","teardown","undefined","result","Promise","resolve","flush","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","fc","err","finish","e"],"mappings":"wRAMgBA,IAGf,OAFAC,EAAOA,QAACC,EAA2BD,EAAAA,QAAQE,kBAC3CF,EAAOA,QAACE,kBAAoB,SAAAC,UAAOH,UAAQI,EAAqBD,CAAlC,EACvB,WAAA,OAAMH,EAAOA,QAACI,GAAsBJ,UAAQI,GAA5C,CACP,CAED,IAAMC,EAAa,SAAAC,GAAK,OAAa,MAATA,GAAsC,mBAAdA,EAAMC,IAAlC,EAGpBC,EAAW,EAyFR,SAASC,IACXT,EAAOA,QAACI,IAEXJ,EAAOA,QAACI,WACDJ,EAAAA,QAAQI,QAG+B,IAApCJ,UAAQC,GAClBD,EAAAA,QAAQE,kBAAoBF,EAAOA,QAACC,SAC7BD,EAAOA,QAACC,GAEfD,EAAAA,QAAQE,uBAAoBQ,CAE7B,OA3FM,SAAaP,GACnB,KAAMK,EAAW,EAAG,CAOnB,IAAMG,EAASR,IACf,OAAIE,EAAWM,GACPA,EAAOJ,KAAK,aAChBC,CACF,MAEAA,EACKI,QAAQC,UACf,CAED,IAIIC,EAAOC,EAJLC,EAAgChB,EAAOA,QAACiB,sBACxCC,EAAWnB,IAMjBC,EAAOA,QAACiB,sBAAwB,SAAAE,GAAOL,OAAAA,EAAQK,CAAb,EAElC,IAsBIC,EACAT,EAvBEU,EAAS,WACd,IAEC,IADAH,IACOJ,GACNC,EAAUD,EACVA,EAAQ,KAERC,IACAG,GAQD,CANC,MAAOI,GACHF,IACJA,EAAME,EAEP,CAbD,QAcCb,GACA,CAEDT,EAAOA,QAACiB,sBAAwBD,IAC9BR,CACF,EAKD,IACCG,EAASR,GAGT,CAFC,MAAOmB,GACRF,EAAME,CACN,CAED,GAAIjB,EAAWM,GACd,OAAOA,EAAOJ,KAAKc,EAAQ,SAAAD,GAE1B,MADAC,IACMD,CACN,GAOF,GADAC,IACID,EACH,MAAMA,EAEP,OAAOR,QAAQC,SACf"}
1
+ {"version":3,"file":"testUtils.umd.js","sources":["../src/index.js"],"sourcesContent":["import { options } from '../..';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\ttry {\n\t\t\tconst result = cb();\n\t\t\tif (isThenable(result)) {\n\t\t\t\treturn result.then(() => {\n\t\t\t\t\t--actDepth;\n\t\t\t\t}, (e) => {\n\t\t\t\t\t--actDepth;\n\t\t\t\t\tthrow e;\n\t\t\t\t})\n\t\t\t}\n\t\t} catch(e) {\n\t\t\t--actDepth;\n\t\t\tthrow e;\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flush, toFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => (flush = fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flush) {\n\t\t\t\ttoFlush = flush;\n\t\t\t\tflush = null;\n\n\t\t\t\ttoFlush();\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","teardown","undefined","act","result","e","Promise","resolve","flush","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","fc","err","finish"],"mappings":"+QAMO,SAASA,IAGf,OAFAC,EAAOA,QAACC,EAA2BD,EAAAA,QAAQE,kBAC3CF,EAAOA,QAACE,kBAAoB,SAAAC,GAAOH,OAAAA,EAAAA,QAAQI,EAAqBD,CAAlC,EACvB,WAAA,OAAMH,EAAAA,QAAQI,GAAsBJ,UAAQI,GAA5C,CACP,CAED,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,IAAlC,EAGpBC,EAAW,EAiGR,SAASC,IACXT,EAAOA,QAACI,IAEXJ,EAAOA,QAACI,WACDJ,EAAOA,QAACI,QAG+B,IAApCJ,EAAAA,QAAQC,GAClBD,EAAOA,QAACE,kBAAoBF,EAAAA,QAAQC,SAC7BD,EAAOA,QAACC,GAEfD,EAAAA,QAAQE,uBAAoBQ,CAE7B,OAnGeC,SAAIR,GACnB,KAAMK,EAAW,EAAG,CAOnB,IACC,IAAMI,EAAST,IACf,GAAIE,EAAWO,GACd,OAAOA,EAAOL,KAAK,aAChBC,CACF,EAAE,SAACK,GAEH,OADEL,EACIK,CACN,EAKF,CAHC,MAAMA,GAEP,OADEL,EACIK,CACN,CAED,QADEL,EACKM,QAAQC,SACf,CAED,IAIIC,EAAOC,EAJLC,EAAgClB,EAAAA,QAAQmB,sBACxCC,EAAWrB,IAMjBC,UAAQmB,sBAAwB,SAAAE,UAAOL,EAAQK,CAAb,EAElC,IAsBIC,EACAV,EAvBEW,EAAS,WACd,IAEC,IADAH,IACOJ,GACNC,EAAUD,EACVA,EAAQ,KAERC,IACAG,GAQD,CANC,MAAOP,GACHS,IACJA,EAAMT,EAEP,CAbD,QAcCJ,GACA,CAEDT,EAAAA,QAAQmB,sBAAwBD,IAC9BV,CACF,EAKD,IACCI,EAAST,GAGT,CAFC,MAAOU,GACRS,EAAMT,CACN,CAED,GAAIR,EAAWO,GACd,OAAOA,EAAOL,KAAKgB,EAAQ,SAAAD,GAE1B,MADAC,IACMD,CACN,GAOF,GADAC,IACID,EACH,MAAMA,EAEP,OAAOR,QAAQC,SACf"}
@@ -32,11 +32,19 @@ export function act(cb) {
32
32
  // been set up.
33
33
  //
34
34
  // If an exception occurs, the outermost `act` will handle cleanup.
35
- const result = cb();
36
- if (isThenable(result)) {
37
- return result.then(() => {
38
- --actDepth;
39
- });
35
+ try {
36
+ const result = cb();
37
+ if (isThenable(result)) {
38
+ return result.then(() => {
39
+ --actDepth;
40
+ }, (e) => {
41
+ --actDepth;
42
+ throw e;
43
+ })
44
+ }
45
+ } catch(e) {
46
+ --actDepth;
47
+ throw e;
40
48
  }
41
49
  --actDepth;
42
50
  return Promise.resolve();