Last commit july 5th

This commit is contained in:
2024-07-05 13:46:23 +02:00
parent dad0d86e8c
commit b0e4dfbb76
24982 changed files with 2621219 additions and 413 deletions

2
spa/node_modules/preact/test-utils/dist/testUtils.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
var r=require("preact");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;
//# sourceMappingURL=testUtils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"testUtils.js","sources":["../src/index.js"],"sourcesContent":["import { options } from 'preact';\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() => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t},\n\t\t\t\t\te => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\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,EAoGR,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,aAtGeC,SAAIR,GACnB,KAAMK,EAAW,EAAG,CAOnB,IACC,IAAMI,EAAST,IACf,GAAIE,EAAWO,GACd,OAAOA,EAAOL,KACb,aACGC,CACF,EACD,SAAAK,GAEC,OADEL,EACIK,CACN,EAMH,CAHC,MAAOA,GAER,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"}

View File

@@ -0,0 +1,2 @@
import{options as t}from"preact";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};
//# sourceMappingURL=testUtils.module.js.map

View File

@@ -0,0 +1,2 @@
import{options as t}from"preact";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};
//# sourceMappingURL=testUtils.module.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"testUtils.module.js","sources":["../src/index.js"],"sourcesContent":["import { options } from 'preact';\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() => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t},\n\t\t\t\t\te => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\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,KACb,aACGC,CACF,EACD,SAAAG,GAEC,OADEH,EACIG,CACN,EAMH,CAHC,MAAOA,GAER,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"}

View File

@@ -0,0 +1,2 @@
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"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});
//# sourceMappingURL=testUtils.umd.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"testUtils.umd.js","sources":["../src/index.js"],"sourcesContent":["import { options } from 'preact';\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() => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t},\n\t\t\t\t\te => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\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,EAoGR,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,OAtGeC,SAAIR,GACnB,KAAMK,EAAW,EAAG,CAOnB,IACC,IAAMI,EAAST,IACf,GAAIE,EAAWO,GACd,OAAOA,EAAOL,KACb,aACGC,CACF,EACD,SAAAK,GAEC,OADEL,EACIK,CACN,EAMH,CAHC,MAAOA,GAER,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"}

28
spa/node_modules/preact/test-utils/package.json generated vendored Normal file
View File

@@ -0,0 +1,28 @@
{
"name": "test-utils",
"amdName": "preactTestUtils",
"version": "0.1.0",
"private": true,
"description": "Test-utils for Preact",
"main": "dist/testUtils.js",
"module": "dist/testUtils.module.js",
"umd:main": "dist/testUtils.umd.js",
"source": "src/index.js",
"license": "MIT",
"types": "src/index.d.ts",
"peerDependencies": {
"preact": "^10.0.0"
},
"mangle": {
"regex": "^_"
},
"exports": {
".": {
"types": "./src/index.d.ts",
"browser": "./dist/testUtils.module.js",
"umd": "./dist/testUtils.umd.js",
"import": "./dist/testUtils.mjs",
"require": "./dist/testUtils.js"
}
}
}

3
spa/node_modules/preact/test-utils/src/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export function setupRerender(): () => void;
export function act(callback: () => void | Promise<void>): Promise<void>;
export function teardown(): void;

129
spa/node_modules/preact/test-utils/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,129 @@
import { options } from 'preact';
/**
* Setup a rerender function that will drain the queue of pending renders
* @returns {() => void}
*/
export function setupRerender() {
options.__test__previousDebounce = options.debounceRendering;
options.debounceRendering = cb => (options.__test__drainQueue = cb);
return () => options.__test__drainQueue && options.__test__drainQueue();
}
const isThenable = value => value != null && typeof value.then == 'function';
/** Depth of nested calls to `act`. */
let actDepth = 0;
/**
* Run a test function, and flush all effects and rerenders after invoking it.
*
* Returns a Promise which resolves "immediately" if the callback is
* synchronous or when the callback's result resolves if it is asynchronous.
*
* @param {() => void|Promise<void>} cb The function under test. This may be sync or async.
* @return {Promise<void>}
*/
export function act(cb) {
if (++actDepth > 1) {
// If calls to `act` are nested, a flush happens only when the
// outermost call returns. In the inner call, we just execute the
// callback and return since the infrastructure for flushing has already
// been set up.
//
// If an exception occurs, the outermost `act` will handle cleanup.
try {
const result = cb();
if (isThenable(result)) {
return result.then(
() => {
--actDepth;
},
e => {
--actDepth;
throw e;
}
);
}
} catch (e) {
--actDepth;
throw e;
}
--actDepth;
return Promise.resolve();
}
const previousRequestAnimationFrame = options.requestAnimationFrame;
const rerender = setupRerender();
/** @type {() => void} */
let flush, toFlush;
// Override requestAnimationFrame so we can flush pending hooks.
options.requestAnimationFrame = fc => (flush = fc);
const finish = () => {
try {
rerender();
while (flush) {
toFlush = flush;
flush = null;
toFlush();
rerender();
}
} catch (e) {
if (!err) {
err = e;
}
} finally {
teardown();
}
options.requestAnimationFrame = previousRequestAnimationFrame;
--actDepth;
};
let err;
let result;
try {
result = cb();
} catch (e) {
err = e;
}
if (isThenable(result)) {
return result.then(finish, err => {
finish();
throw err;
});
}
// nb. If the callback is synchronous, effects must be flushed before
// `act` returns, so that the caller does not have to await the result,
// even though React recommends this.
finish();
if (err) {
throw err;
}
return Promise.resolve();
}
/**
* Teardown test environment and reset preact's internal state
*/
export function teardown() {
if (options.__test__drainQueue) {
// Flush any pending updates leftover by test
options.__test__drainQueue();
delete options.__test__drainQueue;
}
if (typeof options.__test__previousDebounce != 'undefined') {
options.debounceRendering = options.__test__previousDebounce;
delete options.__test__previousDebounce;
} else {
options.debounceRendering = undefined;
}
}