@bpmn-io/properties-panel 2.2.1 → 3.1.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 (116) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +34 -34
  3. package/assets/properties-panel.css +1180 -1114
  4. package/dist/index.esm.js +657 -507
  5. package/dist/index.esm.js.map +1 -1
  6. package/dist/index.js +656 -505
  7. package/dist/index.js.map +1 -1
  8. package/package.json +90 -90
  9. package/preact/README.md +56 -51
  10. package/preact/compat/client.js +19 -0
  11. package/preact/compat/client.mjs +22 -0
  12. package/preact/compat/dist/compat.js +1 -1
  13. package/preact/compat/dist/compat.js.map +1 -1
  14. package/preact/compat/dist/compat.mjs +1 -1
  15. package/preact/compat/dist/compat.module.js +1 -1
  16. package/preact/compat/dist/compat.module.js.map +1 -1
  17. package/preact/compat/dist/compat.umd.js +1 -1
  18. package/preact/compat/dist/compat.umd.js.map +1 -1
  19. package/preact/compat/jsx-dev-runtime.js +2 -0
  20. package/preact/compat/jsx-dev-runtime.mjs +2 -0
  21. package/preact/compat/jsx-runtime.js +2 -0
  22. package/preact/compat/jsx-runtime.mjs +2 -0
  23. package/preact/compat/package.json +31 -0
  24. package/preact/compat/scheduler.js +15 -0
  25. package/preact/compat/{src/scheduler.js → scheduler.mjs} +8 -9
  26. package/preact/compat/server.browser.js +4 -0
  27. package/preact/compat/src/PureComponent.js +1 -1
  28. package/preact/compat/src/forwardRef.js +2 -9
  29. package/preact/compat/src/index.d.ts +58 -4
  30. package/preact/compat/src/index.js +73 -2
  31. package/preact/compat/src/portals.js +4 -2
  32. package/preact/compat/src/render.js +133 -76
  33. package/preact/compat/src/suspense-list.d.ts +2 -2
  34. package/preact/compat/src/suspense-list.js +14 -13
  35. package/preact/compat/src/suspense.d.ts +4 -4
  36. package/preact/compat/src/suspense.js +6 -6
  37. package/preact/compat/src/util.js +10 -0
  38. package/preact/debug/dist/debug.js +1 -1
  39. package/preact/debug/dist/debug.js.map +1 -1
  40. package/preact/debug/dist/debug.mjs +1 -1
  41. package/preact/debug/dist/debug.module.js +1 -1
  42. package/preact/debug/dist/debug.module.js.map +1 -1
  43. package/preact/debug/dist/debug.umd.js +1 -1
  44. package/preact/debug/dist/debug.umd.js.map +1 -1
  45. package/preact/debug/package.json +9 -0
  46. package/preact/debug/src/check-props.js +3 -3
  47. package/preact/debug/src/debug.js +38 -17
  48. package/preact/debug/src/index.d.ts +4 -0
  49. package/preact/debug/src/util.js +4 -0
  50. package/preact/devtools/dist/devtools.js +1 -1
  51. package/preact/devtools/dist/devtools.js.map +1 -1
  52. package/preact/devtools/dist/devtools.mjs +1 -1
  53. package/preact/devtools/dist/devtools.module.js +1 -1
  54. package/preact/devtools/dist/devtools.module.js.map +1 -1
  55. package/preact/devtools/dist/devtools.umd.js +1 -1
  56. package/preact/devtools/dist/devtools.umd.js.map +1 -1
  57. package/preact/devtools/package.json +23 -14
  58. package/preact/devtools/src/devtools.js +1 -1
  59. package/preact/dist/preact.js +1 -1
  60. package/preact/dist/preact.js.map +1 -1
  61. package/preact/dist/preact.min.js +1 -1
  62. package/preact/dist/preact.min.js.map +1 -1
  63. package/preact/dist/preact.min.module.js +2 -0
  64. package/preact/dist/preact.min.module.js.map +1 -0
  65. package/preact/dist/preact.min.umd.js +2 -0
  66. package/preact/dist/preact.min.umd.js.map +1 -0
  67. package/preact/dist/preact.mjs +1 -1
  68. package/preact/dist/preact.module.js +1 -1
  69. package/preact/dist/preact.module.js.map +1 -1
  70. package/preact/dist/preact.umd.js +1 -1
  71. package/preact/dist/preact.umd.js.map +1 -1
  72. package/preact/hooks/dist/hooks.js +1 -1
  73. package/preact/hooks/dist/hooks.js.map +1 -1
  74. package/preact/hooks/dist/hooks.mjs +1 -1
  75. package/preact/hooks/dist/hooks.module.js +1 -1
  76. package/preact/hooks/dist/hooks.module.js.map +1 -1
  77. package/preact/hooks/dist/hooks.umd.js +1 -1
  78. package/preact/hooks/dist/hooks.umd.js.map +1 -1
  79. package/preact/hooks/package.json +9 -0
  80. package/preact/hooks/src/index.d.ts +26 -14
  81. package/preact/hooks/src/index.js +169 -44
  82. package/preact/hooks/src/internal.d.ts +12 -2
  83. package/preact/jsx-runtime/dist/jsxRuntime.js +1 -1
  84. package/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -1
  85. package/preact/jsx-runtime/dist/jsxRuntime.mjs +1 -1
  86. package/preact/jsx-runtime/dist/jsxRuntime.module.js +1 -1
  87. package/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -1
  88. package/preact/jsx-runtime/dist/jsxRuntime.umd.js +1 -1
  89. package/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -1
  90. package/preact/jsx-runtime/package.json +26 -17
  91. package/preact/jsx-runtime/src/index.js +19 -13
  92. package/preact/package.json +315 -262
  93. package/preact/src/clone-element.js +16 -10
  94. package/preact/src/component.js +33 -23
  95. package/preact/src/constants.js +2 -1
  96. package/preact/src/create-context.js +8 -3
  97. package/preact/src/create-element.js +9 -11
  98. package/preact/src/diff/catch-error.js +4 -2
  99. package/preact/src/diff/children.js +41 -32
  100. package/preact/src/diff/index.js +81 -34
  101. package/preact/src/diff/props.js +15 -14
  102. package/preact/src/index.d.ts +369 -301
  103. package/preact/src/internal.d.ts +11 -2
  104. package/preact/src/jsx.d.ts +1862 -626
  105. package/preact/src/options.js +1 -2
  106. package/preact/src/render.js +5 -6
  107. package/preact/src/util.js +6 -0
  108. package/preact/test-utils/dist/testUtils.js +1 -1
  109. package/preact/test-utils/dist/testUtils.js.map +1 -1
  110. package/preact/test-utils/dist/testUtils.mjs +1 -1
  111. package/preact/test-utils/dist/testUtils.module.js +1 -1
  112. package/preact/test-utils/dist/testUtils.module.js.map +1 -1
  113. package/preact/test-utils/dist/testUtils.umd.js +1 -1
  114. package/preact/test-utils/dist/testUtils.umd.js.map +1 -1
  115. package/preact/test-utils/package.json +9 -0
  116. package/preact/test-utils/src/index.js +2 -1
@@ -10,8 +10,7 @@ import { _catchError } from './diff/catch-error';
10
10
  * @type {import('./internal').Options}
11
11
  */
12
12
  const options = {
13
- _catchError,
14
- _vnodeId: 0
13
+ _catchError
15
14
  };
16
15
 
17
16
  export default options;
@@ -1,7 +1,8 @@
1
- import { EMPTY_OBJ, EMPTY_ARR } from './constants';
1
+ import { EMPTY_OBJ } from './constants';
2
2
  import { commitRoot, diff } from './diff/index';
3
3
  import { createElement, Fragment } from './create-element';
4
4
  import options from './options';
5
+ import { slice } from './util';
5
6
 
6
7
  /**
7
8
  * Render a Preact virtual node into a DOM element
@@ -28,10 +29,8 @@ export function render(vnode, parentDom, replaceNode) {
28
29
  ? null
29
30
  : (replaceNode && replaceNode._children) || parentDom._children;
30
31
 
31
- vnode = (
32
- (!isHydrating && replaceNode) ||
33
- parentDom
34
- )._children = createElement(Fragment, null, [vnode]);
32
+ vnode = ((!isHydrating && replaceNode) || parentDom)._children =
33
+ createElement(Fragment, null, [vnode]);
35
34
 
36
35
  // List of effects that need to be called after diffing.
37
36
  let commitQueue = [];
@@ -48,7 +47,7 @@ export function render(vnode, parentDom, replaceNode) {
48
47
  : oldVNode
49
48
  ? null
50
49
  : parentDom.firstChild
51
- ? EMPTY_ARR.slice.call(parentDom.childNodes)
50
+ ? slice.call(parentDom.childNodes)
52
51
  : null,
53
52
  commitQueue,
54
53
  !isHydrating && replaceNode
@@ -1,3 +1,7 @@
1
+ import { EMPTY_ARR } from './constants';
2
+
3
+ export const isArray = Array.isArray;
4
+
1
5
  /**
2
6
  * Assign properties from `props` to `obj`
3
7
  * @template O, P The obj and props types
@@ -21,3 +25,5 @@ export function removeNode(node) {
21
25
  let parentNode = node.parentNode;
22
26
  if (parentNode) parentNode.removeChild(node);
23
27
  }
28
+
29
+ export const slice = EMPTY_ARR.slice;
@@ -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.setupRerender=n,exports.act=function(u){if(++e>1){var i=u();return t(i)?i.then(function(){--e}):(--e,Promise.resolve())}var c,f,a=r.options.requestAnimationFrame,v=n();r.options.requestAnimationFrame=function(r){return c=r};var l,p,s=function(){try{for(v();c;)f=c,c=null,f(),v();o()}catch(r){l||(l=r)}r.options.requestAnimationFrame=a,--e};try{p=u()}catch(r){l=r}if(t(p))return p.then(s,function(r){throw s(),r});if(s(),l)throw l;return Promise.resolve()},exports.teardown=o;
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;
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\tteardown();\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\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":"wBAMA,SAAgBA,WACfC,UAAQC,EAA2BD,UAAQE,kBAC3CF,UAAQE,kBAAoB,SAAAC,UAAOH,UAAQI,EAAqBD,GACzD,kBAAMH,UAAQI,GAAsBJ,UAAQI,KAGpD,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,MAGtDC,EAAW,EAwFf,SAAgBC,IACXT,UAAQI,IAEXJ,UAAQI,WACDJ,UAAQI,QAG+B,IAApCJ,UAAQC,GAClBD,UAAQE,kBAAoBF,UAAQC,SAC7BD,UAAQC,GAEfD,UAAQE,uBAAoBQ,sCAxFvB,SAAaP,QACbK,EAAW,EAAG,KAObG,EAASR,WACXE,EAAWM,GACPA,EAAOJ,KAAK,aAChBC,OAGFA,EACKI,QAAQC,eAOZC,EAAOC,EAJLC,EAAgChB,UAAQiB,sBACxCC,EAAWnB,IAMjBC,UAAQiB,sBAAwB,SAAAE,UAAOL,EAAQK,OAuB3CC,EACAT,EAtBEU,EAAS,mBAEbH,IACOJ,GACNC,EAAUD,EACVA,EAAQ,KAERC,IACAG,IAEDT,IACC,MAAOa,GACHF,IACJA,EAAME,GAIRtB,UAAQiB,sBAAwBD,IAC9BR,OAOFG,EAASR,IACR,MAAOmB,GACRF,EAAME,KAGHjB,EAAWM,UACPA,EAAOJ,KAAKc,EAAQ,SAAAD,SAC1BC,IACMD,OAORC,IACID,QACGA,SAEAR,QAAQC"}
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,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 i=u();return t(i)?i.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();e()}catch(n){v||(v=n)}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 e(){n.o&&(n.o(),delete n.o),void 0!==n.t?(n.debounceRendering=n.t,delete n.t):n.debounceRendering=void 0}export{r as setupRerender,u as act,e as teardown};
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};
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 i=u();return t(i)?i.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();e()}catch(n){v||(v=n)}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 e(){n.o&&(n.o(),delete n.o),void 0!==n.t?(n.debounceRendering=n.t,delete n.t):n.debounceRendering=void 0}export{r as setupRerender,u as act,e as teardown};
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};
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\tteardown();\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\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","teardown","e","undefined"],"mappings":"iCAMA,SAAgBA,WACfC,EAAQC,EAA2BD,EAAQE,kBAC3CF,EAAQE,kBAAoB,SAAAC,UAAOH,EAAQI,EAAqBD,GACzD,kBAAMH,EAAQI,GAAsBJ,EAAQI,KAGpD,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,MAGtDC,EAAW,EAWR,SAASC,EAAIN,QACbK,EAAW,EAAG,KAObE,EAASP,WACXE,EAAWK,GACPA,EAAOH,KAAK,aAChBC,OAGFA,EACKG,QAAQC,eAOZC,EAAOC,EAJLC,EAAgCf,EAAQgB,sBACxCC,EAAWlB,IAMjBC,EAAQgB,sBAAwB,SAAAE,UAAOL,EAAQK,OAuB3CC,EACAT,EAtBEU,EAAS,mBAEbH,IACOJ,GACNC,EAAUD,EACVA,EAAQ,KAERC,IACAG,IAEDI,IACC,MAAOC,GACHH,IACJA,EAAMG,GAIRtB,EAAQgB,sBAAwBD,IAC9BP,OAOFE,EAASP,IACR,MAAOmB,GACRH,EAAMG,KAGHjB,EAAWK,UACPA,EAAOH,KAAKa,EAAQ,SAAAD,SAC1BC,IACMD,OAORC,IACID,QACGA,SAEAR,QAAQC,UAMhB,SAAgBS,IACXrB,EAAQI,IAEXJ,EAAQI,WACDJ,EAAQI,QAG+B,IAApCJ,EAAQC,GAClBD,EAAQE,kBAAoBF,EAAQC,SAC7BD,EAAQC,GAEfD,EAAQE,uBAAoBqB"}
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,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.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.setupRerender=e,n.act=function(n){if(++o>1){var u=n();return r(u)?u.then(function(){--o}):(--o,Promise.resolve())}var f,c,d=t.options.requestAnimationFrame,p=e();t.options.requestAnimationFrame=function(n){return f=n};var a,l,s=function(){try{for(p();f;)c=f,f=null,c(),p();i()}catch(n){a||(a=n)}t.options.requestAnimationFrame=d,--o};try{l=n()}catch(n){a=n}if(r(l))return l.then(s,function(n){throw s(),n});if(s(),a)throw a;return Promise.resolve()},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){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});
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\tteardown();\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\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":"2NAMO,SAASA,WACfC,UAAQC,EAA2BD,UAAQE,kBAC3CF,UAAQE,kBAAoB,SAAAC,UAAOH,UAAQI,EAAqBD,GACzD,kBAAMH,UAAQI,GAAsBJ,UAAQI,KAGpD,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,MAGtDC,EAAW,EAwFR,SAASC,IACXT,UAAQI,IAEXJ,UAAQI,WACDJ,UAAQI,QAG+B,IAApCJ,UAAQC,GAClBD,UAAQE,kBAAoBF,UAAQC,SAC7BD,UAAQC,GAEfD,UAAQE,uBAAoBQ,0BAxFvB,SAAaP,QACbK,EAAW,EAAG,KAObG,EAASR,WACXE,EAAWM,GACPA,EAAOJ,KAAK,aAChBC,OAGFA,EACKI,QAAQC,eAOZC,EAAOC,EAJLC,EAAgChB,UAAQiB,sBACxCC,EAAWnB,IAMjBC,UAAQiB,sBAAwB,SAAAE,UAAOL,EAAQK,OAuB3CC,EACAT,EAtBEU,EAAS,mBAEbH,IACOJ,GACNC,EAAUD,EACVA,EAAQ,KAERC,IACAG,IAEDT,IACC,MAAOa,GACHF,IACJA,EAAME,GAIRtB,UAAQiB,sBAAwBD,IAC9BR,OAOFG,EAASR,IACR,MAAOmB,GACRF,EAAME,KAGHjB,EAAWM,UACPA,EAAOJ,KAAKc,EAAQ,SAAAD,SAC1BC,IACMD,OAORC,IACID,QACGA,SAEAR,QAAQC"}
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"}
@@ -15,5 +15,14 @@
15
15
  },
16
16
  "mangle": {
17
17
  "regex": "^_"
18
+ },
19
+ "exports": {
20
+ ".": {
21
+ "types": "./src/index.d.ts",
22
+ "browser": "./dist/testUtils.module.js",
23
+ "umd": "./dist/testUtils.umd.js",
24
+ "import": "./dist/testUtils.mjs",
25
+ "require": "./dist/testUtils.js"
26
+ }
18
27
  }
19
28
  }
@@ -61,11 +61,12 @@ export function act(cb) {
61
61
  toFlush();
62
62
  rerender();
63
63
  }
64
- teardown();
65
64
  } catch (e) {
66
65
  if (!err) {
67
66
  err = e;
68
67
  }
68
+ } finally {
69
+ teardown();
69
70
  }
70
71
 
71
72
  options.requestAnimationFrame = previousRequestAnimationFrame;