@wordpress/hooks 3.34.0 → 3.35.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 3.35.0 (2023-06-07)
6
+
5
7
  ## 3.34.0 (2023-05-24)
6
8
 
7
9
  ## 3.33.0 (2023-05-10)
@@ -35,8 +35,7 @@ var _validateHookName = _interopRequireDefault(require("./validateHookName.js"))
35
35
  * @return {AddHook} Function that adds a new hook.
36
36
  */
37
37
  function createAddHook(hooks, storeKey) {
38
- return function addHook(hookName, namespace, callback) {
39
- let priority = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10;
38
+ return function addHook(hookName, namespace, callback, priority = 10) {
40
39
  const hooksStore = hooks[storeKey];
41
40
 
42
41
  if (!(0, _validateHookName.default)(hookName)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/hooks/src/createAddHook.js"],"names":["createAddHook","hooks","storeKey","addHook","hookName","namespace","callback","priority","hooksStore","console","error","handler","handlers","i","length","splice","__current","forEach","hookInfo","name","currentIndex","runs","doAction"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAT,CAAwBC,KAAxB,EAA+BC,QAA/B,EAA0C;AACzC,SAAO,SAASC,OAAT,CAAkBC,QAAlB,EAA4BC,SAA5B,EAAuCC,QAAvC,EAAiE;AAAA,QAAhBC,QAAgB,uEAAL,EAAK;AACvE,UAAMC,UAAU,GAAGP,KAAK,CAAEC,QAAF,CAAxB;;AAEA,QAAK,CAAE,+BAAkBE,QAAlB,CAAP,EAAsC;AACrC;AACA;;AAED,QAAK,CAAE,gCAAmBC,SAAnB,CAAP,EAAwC;AACvC;AACA;;AAED,QAAK,e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AED,OAAF,CADc;AAExBU,QAAAA,IAAI,EAAE;AAFkB,OAAzB;AAIA;;AAED,QAAKjB,QAAQ,KAAK,WAAlB,EAAgC;AAC/BH,MAAAA,KAAK,CAACqB,QAAN,CACC,WADD,EAEClB,QAFD,EAGCC,SAHD,EAICC,QAJD,EAKCC,QALD;AAOA;AACD,GA7ED;AA8EA;;eAEcP,a","sourcesContent":["/**\n * Internal dependencies\n */\nimport validateNamespace from './validateNamespace.js';\nimport validateHookName from './validateHookName.js';\n\n/**\n * @callback AddHook\n *\n * Adds the hook to the appropriate hooks container.\n *\n * @param {string} hookName Name of hook to add\n * @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.\n * @param {import('.').Callback} callback Function to call when the hook is run\n * @param {number} [priority=10] Priority of this hook\n */\n\n/**\n * Returns a function which, when invoked, will add a hook.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {AddHook} Function that adds a new hook.\n */\nfunction createAddHook( hooks, storeKey ) {\n\treturn function addHook( hookName, namespace, callback, priority = 10 ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! validateHookName( hookName ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! validateNamespace( namespace ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( 'function' !== typeof callback ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( 'The hook callback must be a function.' );\n\t\t\treturn;\n\t\t}\n\n\t\t// Validate numeric priority\n\t\tif ( 'number' !== typeof priority ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'If specified, the hook priority must be a number.'\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst handler = { callback, priority, namespace };\n\n\t\tif ( hooksStore[ hookName ] ) {\n\t\t\t// Find the correct insert index of the new hook.\n\t\t\tconst handlers = hooksStore[ hookName ].handlers;\n\n\t\t\t/** @type {number} */\n\t\t\tlet i;\n\t\t\tfor ( i = handlers.length; i > 0; i-- ) {\n\t\t\t\tif ( priority >= handlers[ i - 1 ].priority ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( i === handlers.length ) {\n\t\t\t\t// If append, operate via direct assignment.\n\t\t\t\thandlers[ i ] = handler;\n\t\t\t} else {\n\t\t\t\t// Otherwise, insert before index via splice.\n\t\t\t\thandlers.splice( i, 0, handler );\n\t\t\t}\n\n\t\t\t// We may also be currently executing this hook. If the callback\n\t\t\t// we're adding would come after the current callback, there's no\n\t\t\t// problem; otherwise we need to increase the execution index of\n\t\t\t// any other runs by 1 to account for the added element.\n\t\t\thooksStore.__current.forEach( ( hookInfo ) => {\n\t\t\t\tif (\n\t\t\t\t\thookInfo.name === hookName &&\n\t\t\t\t\thookInfo.currentIndex >= i\n\t\t\t\t) {\n\t\t\t\t\thookInfo.currentIndex++;\n\t\t\t\t}\n\t\t\t} );\n\t\t} else {\n\t\t\t// This is the first hook of its type.\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\thandlers: [ handler ],\n\t\t\t\truns: 0,\n\t\t\t};\n\t\t}\n\n\t\tif ( hookName !== 'hookAdded' ) {\n\t\t\thooks.doAction(\n\t\t\t\t'hookAdded',\n\t\t\t\thookName,\n\t\t\t\tnamespace,\n\t\t\t\tcallback,\n\t\t\t\tpriority\n\t\t\t);\n\t\t}\n\t};\n}\n\nexport default createAddHook;\n"]}
1
+ {"version":3,"sources":["@wordpress/hooks/src/createAddHook.js"],"names":["createAddHook","hooks","storeKey","addHook","hookName","namespace","callback","priority","hooksStore","console","error","handler","handlers","i","length","splice","__current","forEach","hookInfo","name","currentIndex","runs","doAction"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAT,CAAwBC,KAAxB,EAA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,MAAAA,UAAU,CAACQ,SAAX,CAAqBC,OAArB,CAAgCC,QAAF,IAAgB;AAC7C,YACCA,QAAQ,CAACC,IAAT,KAAkBf,QAAlB,IACAc,QAAQ,CAACE,YAAT,IAAyBP,CAF1B,EAGE;AACDK,UAAAA,QAAQ,CAACE,YAAT;AACA;AACD,OAPD;AAQA,KAhCD,MAgCO;AACN;AACAZ,MAAAA,UAAU,CAAEJ,QAAF,CAAV,GAAyB;AACxBQ,QAAAA,QAAQ,EAAE,CAAED,OAAF,CADc;AAExBU,QAAAA,IAAI,EAAE;AAFkB,OAAzB;AAIA;;AAED,QAAKjB,QAAQ,KAAK,WAAlB,EAAgC;AAC/BH,MAAAA,KAAK,CAACqB,QAAN,CACC,WADD,EAEClB,QAFD,EAGCC,SAHD,EAICC,QAJD,EAKCC,QALD;AAOA;AACD,GA7ED;AA8EA;;eAEcP,a","sourcesContent":["/**\n * Internal dependencies\n */\nimport validateNamespace from './validateNamespace.js';\nimport validateHookName from './validateHookName.js';\n\n/**\n * @callback AddHook\n *\n * Adds the hook to the appropriate hooks container.\n *\n * @param {string} hookName Name of hook to add\n * @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.\n * @param {import('.').Callback} callback Function to call when the hook is run\n * @param {number} [priority=10] Priority of this hook\n */\n\n/**\n * Returns a function which, when invoked, will add a hook.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {AddHook} Function that adds a new hook.\n */\nfunction createAddHook( hooks, storeKey ) {\n\treturn function addHook( hookName, namespace, callback, priority = 10 ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! validateHookName( hookName ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! validateNamespace( namespace ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( 'function' !== typeof callback ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( 'The hook callback must be a function.' );\n\t\t\treturn;\n\t\t}\n\n\t\t// Validate numeric priority\n\t\tif ( 'number' !== typeof priority ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'If specified, the hook priority must be a number.'\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst handler = { callback, priority, namespace };\n\n\t\tif ( hooksStore[ hookName ] ) {\n\t\t\t// Find the correct insert index of the new hook.\n\t\t\tconst handlers = hooksStore[ hookName ].handlers;\n\n\t\t\t/** @type {number} */\n\t\t\tlet i;\n\t\t\tfor ( i = handlers.length; i > 0; i-- ) {\n\t\t\t\tif ( priority >= handlers[ i - 1 ].priority ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( i === handlers.length ) {\n\t\t\t\t// If append, operate via direct assignment.\n\t\t\t\thandlers[ i ] = handler;\n\t\t\t} else {\n\t\t\t\t// Otherwise, insert before index via splice.\n\t\t\t\thandlers.splice( i, 0, handler );\n\t\t\t}\n\n\t\t\t// We may also be currently executing this hook. If the callback\n\t\t\t// we're adding would come after the current callback, there's no\n\t\t\t// problem; otherwise we need to increase the execution index of\n\t\t\t// any other runs by 1 to account for the added element.\n\t\t\thooksStore.__current.forEach( ( hookInfo ) => {\n\t\t\t\tif (\n\t\t\t\t\thookInfo.name === hookName &&\n\t\t\t\t\thookInfo.currentIndex >= i\n\t\t\t\t) {\n\t\t\t\t\thookInfo.currentIndex++;\n\t\t\t\t}\n\t\t\t} );\n\t\t} else {\n\t\t\t// This is the first hook of its type.\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\thandlers: [ handler ],\n\t\t\t\truns: 0,\n\t\t\t};\n\t\t}\n\n\t\tif ( hookName !== 'hookAdded' ) {\n\t\t\thooks.doAction(\n\t\t\t\t'hookAdded',\n\t\t\t\thookName,\n\t\t\t\tnamespace,\n\t\t\t\tcallback,\n\t\t\t\tpriority\n\t\t\t);\n\t\t}\n\t};\n}\n\nexport default createAddHook;\n"]}
@@ -17,10 +17,10 @@ exports.default = void 0;
17
17
  */
18
18
  function createCurrentHook(hooks, storeKey) {
19
19
  return function currentHook() {
20
- var _hooksStore$__current, _hooksStore$__current2;
20
+ var _hooksStore$__current;
21
21
 
22
22
  const hooksStore = hooks[storeKey];
23
- return (_hooksStore$__current = (_hooksStore$__current2 = hooksStore.__current[hooksStore.__current.length - 1]) === null || _hooksStore$__current2 === void 0 ? void 0 : _hooksStore$__current2.name) !== null && _hooksStore$__current !== void 0 ? _hooksStore$__current : null;
23
+ return (_hooksStore$__current = hooksStore.__current[hooksStore.__current.length - 1]?.name) !== null && _hooksStore$__current !== void 0 ? _hooksStore$__current : null;
24
24
  };
25
25
  }
26
26
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/hooks/src/createCurrentHook.js"],"names":["createCurrentHook","hooks","storeKey","currentHook","hooksStore","__current","length","name"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAT,CAA4BC,KAA5B,EAAmCC,QAAnC,EAA8C;AAC7C,SAAO,SAASC,WAAT,GAAuB;AAAA;;AAC7B,UAAMC,UAAU,GAAGH,KAAK,CAAEC,QAAF,CAAxB;AAEA,8DACCE,UAAU,CAACC,SAAX,CAAsBD,UAAU,CAACC,SAAX,CAAqBC,MAArB,GAA8B,CAApD,CADD,2DACC,uBAAyDC,IAD1D,yEAEC,IAFD;AAIA,GAPD;AAQA;;eAEcP,iB","sourcesContent":["/**\n * Returns a function which, when invoked, will return the name of the\n * currently running hook, or `null` if no hook of the given type is currently\n * running.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {() => string | null} Function that returns the current hook name or null.\n */\nfunction createCurrentHook( hooks, storeKey ) {\n\treturn function currentHook() {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\treturn (\n\t\t\thooksStore.__current[ hooksStore.__current.length - 1 ]?.name ??\n\t\t\tnull\n\t\t);\n\t};\n}\n\nexport default createCurrentHook;\n"]}
1
+ {"version":3,"sources":["@wordpress/hooks/src/createCurrentHook.js"],"names":["createCurrentHook","hooks","storeKey","currentHook","hooksStore","__current","length","name"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAT,CAA4BC,KAA5B,EAAmCC,QAAnC,EAA8C;AAC7C,SAAO,SAASC,WAAT,GAAuB;AAAA;;AAC7B,UAAMC,UAAU,GAAGH,KAAK,CAAEC,QAAF,CAAxB;AAEA,oCACCE,UAAU,CAACC,SAAX,CAAsBD,UAAU,CAACC,SAAX,CAAqBC,MAArB,GAA8B,CAApD,GAAyDC,IAD1D,yEAEC,IAFD;AAIA,GAPD;AAQA;;eAEcP,iB","sourcesContent":["/**\n * Returns a function which, when invoked, will return the name of the\n * currently running hook, or `null` if no hook of the given type is currently\n * running.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {() => string | null} Function that returns the current hook name or null.\n */\nfunction createCurrentHook( hooks, storeKey ) {\n\treturn function currentHook() {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\treturn (\n\t\t\thooksStore.__current[ hooksStore.__current.length - 1 ]?.name ??\n\t\t\tnull\n\t\t);\n\t};\n}\n\nexport default createCurrentHook;\n"]}
@@ -39,8 +39,7 @@ var _validateHookName = _interopRequireDefault(require("./validateHookName.js"))
39
39
  *
40
40
  * @return {RemoveHook} Function that removes hooks.
41
41
  */
42
- function createRemoveHook(hooks, storeKey) {
43
- let removeAll = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
42
+ function createRemoveHook(hooks, storeKey, removeAll = false) {
44
43
  return function removeHook(hookName, namespace) {
45
44
  const hooksStore = hooks[storeKey];
46
45
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/hooks/src/createRemoveHook.js"],"names":["createRemoveHook","hooks","storeKey","removeAll","removeHook","hookName","namespace","hooksStore","handlersRemoved","handlers","length","runs","i","splice","__current","forEach","hookInfo","name","currentIndex","doAction"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAT,CAA2BC,KAA3B,EAAkCC,QAAlC,EAAgE;AAAA,MAApBC,SAAoB,uEAAR,KAAQ;AAC/D,SAAO,SAASC,UAAT,CAAqBC,QAArB,EAA+BC,SAA/B,EAA2C;AACjD,UAAMC,UAAU,GAAGN,KAAK,CAAEC,QAAF,CAAxB;;AAEA,QAAK,CAAE,+BAAkBG,QAAlB,CAAP,EAAsC;AACrC;AACA;;AAED,QAAK,CAAEF,SAAF,IAAe,CAAE,gCAAmBG,SAAnB,CAAtB,EAAuD;AACtD;AACA,KATgD,CAWjD;;;AACA,QAAK,CAAEC,UAAU,CAAEF,QAAF,CAAjB,EAAgC;AAC/B,aAAO,CAAP;AACA;;AAED,QAAIG,eAAe,GAAG,CAAtB;;AAEA,QAAKL,SAAL,EAAiB;AAChBK,MAAAA,eAAe,GAAGD,UAAU,CAAEF,QAAF,CAAV,CAAuBI,QAAvB,CAAgCC,MAAlD;AACAH,MAAAA,UAAU,CAAEF,QAAF,CAAV,GAAyB;AACxBM,QAAAA,IAAI,EAAEJ,UAAU,CAAEF,QAAF,CAAV,CAAuBM,IADL;AAExBF,QAAAA,QAAQ,EAAE;AAFc,OAAzB;AAIA,KAND,MAMO;AACN;AACA,YAAMA,QAAQ,GAAGF,UAAU,CAAEF,QAAF,CAAV,CAAuBI,QAAxC;;AACA,WAAM,IAAIG,CAAC,GAAGH,QAAQ,CAACC,MAAT,GAAkB,CAAhC,EAAmCE,CAAC,IAAI,CAAxC,EAA2CA,CAAC,EAA5C,EAAiD;AAChD,YAAKH,QAAQ,CAAEG,CAAF,CAAR,CAAcN,SAAd,KAA4BA,SAAjC,EAA6C;AAC5CG,UAAAA,QAAQ,CAACI,MAAT,CAAiBD,CAAjB,EAAoB,CAApB;AACAJ,UAAAA,eAAe,GAF6B,CAG5C;AACA;AACA;AACA;AACA;;AACAD,UAAAA,UAAU,CAACO,SAAX,CAAqBC,OAArB,CAAgCC,QAAF,IAAgB;AAC7C,gBACCA,QAAQ,CAACC,IAAT,KAAkBZ,QAAlB,IACAW,QAAQ,CAACE,YAAT,IAAyBN,CAF1B,EAGE;AACDI,cAAAA,QAAQ,CAACE,YAAT;AACA;AACD,WAPD;AAQA;AACD;AACD;;AAED,QAAKb,QAAQ,KAAK,aAAlB,EAAkC;AACjCJ,MAAAA,KAAK,CAACkB,QAAN,CAAgB,aAAhB,EAA+Bd,QAA/B,EAAyCC,SAAzC;AACA;;AAED,WAAOE,eAAP;AACA,GArDD;AAsDA;;eAEcR,gB","sourcesContent":["/**\n * Internal dependencies\n */\nimport validateNamespace from './validateNamespace.js';\nimport validateHookName from './validateHookName.js';\n\n/**\n * @callback RemoveHook\n * Removes the specified callback (or all callbacks) from the hook with a given hookName\n * and namespace.\n *\n * @param {string} hookName The name of the hook to modify.\n * @param {string} namespace The unique namespace identifying the callback in the\n * form `vendor/plugin/function`.\n *\n * @return {number | undefined} The number of callbacks removed.\n */\n\n/**\n * Returns a function which, when invoked, will remove a specified hook or all\n * hooks by the given name.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n * @param {boolean} [removeAll=false] Whether to remove all callbacks for a hookName,\n * without regard to namespace. Used to create\n * `removeAll*` functions.\n *\n * @return {RemoveHook} Function that removes hooks.\n */\nfunction createRemoveHook( hooks, storeKey, removeAll = false ) {\n\treturn function removeHook( hookName, namespace ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! validateHookName( hookName ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! removeAll && ! validateNamespace( namespace ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Bail if no hooks exist by this name.\n\t\tif ( ! hooksStore[ hookName ] ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tlet handlersRemoved = 0;\n\n\t\tif ( removeAll ) {\n\t\t\thandlersRemoved = hooksStore[ hookName ].handlers.length;\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\truns: hooksStore[ hookName ].runs,\n\t\t\t\thandlers: [],\n\t\t\t};\n\t\t} else {\n\t\t\t// Try to find the specified callback to remove.\n\t\t\tconst handlers = hooksStore[ hookName ].handlers;\n\t\t\tfor ( let i = handlers.length - 1; i >= 0; i-- ) {\n\t\t\t\tif ( handlers[ i ].namespace === namespace ) {\n\t\t\t\t\thandlers.splice( i, 1 );\n\t\t\t\t\thandlersRemoved++;\n\t\t\t\t\t// This callback may also be part of a hook that is\n\t\t\t\t\t// currently executing. If the callback we're removing\n\t\t\t\t\t// comes after the current callback, there's no problem;\n\t\t\t\t\t// otherwise we need to decrease the execution index of any\n\t\t\t\t\t// other runs by 1 to account for the removed element.\n\t\t\t\t\thooksStore.__current.forEach( ( hookInfo ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thookInfo.name === hookName &&\n\t\t\t\t\t\t\thookInfo.currentIndex >= i\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\thookInfo.currentIndex--;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( hookName !== 'hookRemoved' ) {\n\t\t\thooks.doAction( 'hookRemoved', hookName, namespace );\n\t\t}\n\n\t\treturn handlersRemoved;\n\t};\n}\n\nexport default createRemoveHook;\n"]}
1
+ {"version":3,"sources":["@wordpress/hooks/src/createRemoveHook.js"],"names":["createRemoveHook","hooks","storeKey","removeAll","removeHook","hookName","namespace","hooksStore","handlersRemoved","handlers","length","runs","i","splice","__current","forEach","hookInfo","name","currentIndex","doAction"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;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AAAA,UAAU,CAACO,SAAX,CAAqBC,OAArB,CAAgCC,QAAF,IAAgB;AAC7C,gBACCA,QAAQ,CAACC,IAAT,KAAkBZ,QAAlB,IACAW,QAAQ,CAACE,YAAT,IAAyBN,CAF1B,EAGE;AACDI,cAAAA,QAAQ,CAACE,YAAT;AACA;AACD,WAPD;AAQA;AACD;AACD;;AAED,QAAKb,QAAQ,KAAK,aAAlB,EAAkC;AACjCJ,MAAAA,KAAK,CAACkB,QAAN,CAAgB,aAAhB,EAA+Bd,QAA/B,EAAyCC,SAAzC;AACA;;AAED,WAAOE,eAAP;AACA,GArDD;AAsDA;;eAEcR,gB","sourcesContent":["/**\n * Internal dependencies\n */\nimport validateNamespace from './validateNamespace.js';\nimport validateHookName from './validateHookName.js';\n\n/**\n * @callback RemoveHook\n * Removes the specified callback (or all callbacks) from the hook with a given hookName\n * and namespace.\n *\n * @param {string} hookName The name of the hook to modify.\n * @param {string} namespace The unique namespace identifying the callback in the\n * form `vendor/plugin/function`.\n *\n * @return {number | undefined} The number of callbacks removed.\n */\n\n/**\n * Returns a function which, when invoked, will remove a specified hook or all\n * hooks by the given name.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n * @param {boolean} [removeAll=false] Whether to remove all callbacks for a hookName,\n * without regard to namespace. Used to create\n * `removeAll*` functions.\n *\n * @return {RemoveHook} Function that removes hooks.\n */\nfunction createRemoveHook( hooks, storeKey, removeAll = false ) {\n\treturn function removeHook( hookName, namespace ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! validateHookName( hookName ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! removeAll && ! validateNamespace( namespace ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Bail if no hooks exist by this name.\n\t\tif ( ! hooksStore[ hookName ] ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tlet handlersRemoved = 0;\n\n\t\tif ( removeAll ) {\n\t\t\thandlersRemoved = hooksStore[ hookName ].handlers.length;\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\truns: hooksStore[ hookName ].runs,\n\t\t\t\thandlers: [],\n\t\t\t};\n\t\t} else {\n\t\t\t// Try to find the specified callback to remove.\n\t\t\tconst handlers = hooksStore[ hookName ].handlers;\n\t\t\tfor ( let i = handlers.length - 1; i >= 0; i-- ) {\n\t\t\t\tif ( handlers[ i ].namespace === namespace ) {\n\t\t\t\t\thandlers.splice( i, 1 );\n\t\t\t\t\thandlersRemoved++;\n\t\t\t\t\t// This callback may also be part of a hook that is\n\t\t\t\t\t// currently executing. If the callback we're removing\n\t\t\t\t\t// comes after the current callback, there's no problem;\n\t\t\t\t\t// otherwise we need to decrease the execution index of any\n\t\t\t\t\t// other runs by 1 to account for the removed element.\n\t\t\t\t\thooksStore.__current.forEach( ( hookInfo ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thookInfo.name === hookName &&\n\t\t\t\t\t\t\thookInfo.currentIndex >= i\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\thookInfo.currentIndex--;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( hookName !== 'hookRemoved' ) {\n\t\t\thooks.doAction( 'hookRemoved', hookName, namespace );\n\t\t}\n\n\t\treturn handlersRemoved;\n\t};\n}\n\nexport default createRemoveHook;\n"]}
@@ -17,9 +17,8 @@ exports.default = void 0;
17
17
  *
18
18
  * @return {(hookName:string, ...args: unknown[]) => unknown} Function that runs hook callbacks.
19
19
  */
20
- function createRunHook(hooks, storeKey) {
21
- let returnFirstArg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
22
- return function runHooks(hookName) {
20
+ function createRunHook(hooks, storeKey, returnFirstArg = false) {
21
+ return function runHooks(hookName, ...args) {
23
22
  const hooksStore = hooks[storeKey];
24
23
 
25
24
  if (!hooksStore[hookName]) {
@@ -39,10 +38,6 @@ function createRunHook(hooks, storeKey) {
39
38
  }
40
39
  }
41
40
 
42
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
43
- args[_key - 1] = arguments[_key];
44
- }
45
-
46
41
  if (!handlers || !handlers.length) {
47
42
  return returnFirstArg ? args[0] : undefined;
48
43
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/hooks/src/createRunHook.js"],"names":["createRunHook","hooks","storeKey","returnFirstArg","runHooks","hookName","hooksStore","handlers","runs","process","env","NODE_ENV","all","push","args","length","undefined","hookInfo","name","currentIndex","__current","handler","result","callback","apply","pop"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAT,CAAwBC,KAAxB,EAA+BC,QAA/B,EAAkE;AAAA,MAAzBC,cAAyB,uEAAR,KAAQ;AACjE,SAAO,SAASC,QAAT,CAAmBC,QAAnB,EAAuC;AAC7C,UAAMC,UAAU,GAAGL,KAAK,CAAEC,QAAF,CAAxB;;AAEA,QAAK,CAAEI,UAAU,CAAED,QAAF,CAAjB,EAAgC;AAC/BC,MAAAA,UAAU,CAAED,QAAF,CAAV,GAAyB;AACxBE,QAAAA,QAAQ,EAAE,EADc;AAExBC,QAAAA,IAAI,EAAE;AAFkB,OAAzB;AAIA;;AAEDF,IAAAA,UAAU,CAAED,QAAF,CAAV,CAAuBG,IAAvB;AAEA,UAAMD,QAAQ,GAAGD,UAAU,CAAED,QAAF,CAAV,CAAuBE,QAAxC,CAZ6C,CAc7C;;AACA,QAAK,iBAAiBE,OAAO,CAACC,GAAR,CAAYC,QAAlC,EAA6C;AAC5C;AACA,UAAK,gBAAgBN,QAAhB,IAA4BC,UAAU,CAACM,GAA5C,EAAkD;AACjDL,QAAAA,QAAQ,CAACM,IAAT,CAAe,GAAGP,UAAU,CAACM,GAAX,CAAeL,QAAjC;AACA;AACD;;AApB4C,sCAAPO,IAAO;AAAPA,MAAAA,IAAO;AAAA;;AAsB7C,QAAK,CAAEP,QAAF,IAAc,CAAEA,QAAQ,CAACQ,MAA9B,EAAuC;AACtC,aAAOZ,cAAc,GAAGW,IAAI,CAAE,CAAF,CAAP,GAAeE,SAApC;AACA;;AAED,UAAMC,QAAQ,GAAG;AAChBC,MAAAA,IAAI,EAAEb,QADU;AAEhBc,MAAAA,YAAY,EAAE;AAFE,KAAjB;;AAKAb,IAAAA,UAAU,CAACc,SAAX,CAAqBP,IAArB,CAA2BI,QAA3B;;AAEA,WAAQA,QAAQ,CAACE,YAAT,GAAwBZ,QAAQ,CAACQ,MAAzC,EAAkD;AACjD,YAAMM,OAAO,GAAGd,QAAQ,CAAEU,QAAQ,CAACE,YAAX,CAAxB;AAEA,YAAMG,MAAM,GAAGD,OAAO,CAACE,QAAR,CAAiBC,KAAjB,CAAwB,IAAxB,EAA8BV,IAA9B,CAAf;;AACA,UAAKX,cAAL,EAAsB;AACrBW,QAAAA,IAAI,CAAE,CAAF,CAAJ,GAAYQ,MAAZ;AACA;;AAEDL,MAAAA,QAAQ,CAACE,YAAT;AACA;;AAEDb,IAAAA,UAAU,CAACc,SAAX,CAAqBK,GAArB;;AAEA,QAAKtB,cAAL,EAAsB;AACrB,aAAOW,IAAI,CAAE,CAAF,CAAX;AACA;AACD,GAjDD;AAkDA;;eAEcd,a","sourcesContent":["/**\n * Returns a function which, when invoked, will execute all callbacks\n * registered to a hook of the specified type, optionally returning the final\n * value of the call chain.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n * @param {boolean} [returnFirstArg=false] Whether each hook callback is expected to\n * return its first argument.\n *\n * @return {(hookName:string, ...args: unknown[]) => unknown} Function that runs hook callbacks.\n */\nfunction createRunHook( hooks, storeKey, returnFirstArg = false ) {\n\treturn function runHooks( hookName, ...args ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! hooksStore[ hookName ] ) {\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\thandlers: [],\n\t\t\t\truns: 0,\n\t\t\t};\n\t\t}\n\n\t\thooksStore[ hookName ].runs++;\n\n\t\tconst handlers = hooksStore[ hookName ].handlers;\n\n\t\t// The following code is stripped from production builds.\n\t\tif ( 'production' !== process.env.NODE_ENV ) {\n\t\t\t// Handle any 'all' hooks registered.\n\t\t\tif ( 'hookAdded' !== hookName && hooksStore.all ) {\n\t\t\t\thandlers.push( ...hooksStore.all.handlers );\n\t\t\t}\n\t\t}\n\n\t\tif ( ! handlers || ! handlers.length ) {\n\t\t\treturn returnFirstArg ? args[ 0 ] : undefined;\n\t\t}\n\n\t\tconst hookInfo = {\n\t\t\tname: hookName,\n\t\t\tcurrentIndex: 0,\n\t\t};\n\n\t\thooksStore.__current.push( hookInfo );\n\n\t\twhile ( hookInfo.currentIndex < handlers.length ) {\n\t\t\tconst handler = handlers[ hookInfo.currentIndex ];\n\n\t\t\tconst result = handler.callback.apply( null, args );\n\t\t\tif ( returnFirstArg ) {\n\t\t\t\targs[ 0 ] = result;\n\t\t\t}\n\n\t\t\thookInfo.currentIndex++;\n\t\t}\n\n\t\thooksStore.__current.pop();\n\n\t\tif ( returnFirstArg ) {\n\t\t\treturn args[ 0 ];\n\t\t}\n\t};\n}\n\nexport default createRunHook;\n"]}
1
+ {"version":3,"sources":["@wordpress/hooks/src/createRunHook.js"],"names":["createRunHook","hooks","storeKey","returnFirstArg","runHooks","hookName","args","hooksStore","handlers","runs","process","env","NODE_ENV","all","push","length","undefined","hookInfo","name","currentIndex","__current","handler","result","callback","apply","pop"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAT,CAAwBC,KAAxB,EAA+BC,QAA/B,EAAyCC,cAAc,GAAG,KAA1D,EAAkE;AACjE,SAAO,SAASC,QAAT,CAAmBC,QAAnB,EAA6B,GAAGC,IAAhC,EAAuC;AAC7C,UAAMC,UAAU,GAAGN,KAAK,CAAEC,QAAF,CAAxB;;AAEA,QAA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BK,GAArB;;AAEA,QAAKtB,cAAL,EAAsB;AACrB,aAAOG,IAAI,CAAE,CAAF,CAAX;AACA;AACD,GAjDD;AAkDA;;eAEcN,a","sourcesContent":["/**\n * Returns a function which, when invoked, will execute all callbacks\n * registered to a hook of the specified type, optionally returning the final\n * value of the call chain.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n * @param {boolean} [returnFirstArg=false] Whether each hook callback is expected to\n * return its first argument.\n *\n * @return {(hookName:string, ...args: unknown[]) => unknown} Function that runs hook callbacks.\n */\nfunction createRunHook( hooks, storeKey, returnFirstArg = false ) {\n\treturn function runHooks( hookName, ...args ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! hooksStore[ hookName ] ) {\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\thandlers: [],\n\t\t\t\truns: 0,\n\t\t\t};\n\t\t}\n\n\t\thooksStore[ hookName ].runs++;\n\n\t\tconst handlers = hooksStore[ hookName ].handlers;\n\n\t\t// The following code is stripped from production builds.\n\t\tif ( 'production' !== process.env.NODE_ENV ) {\n\t\t\t// Handle any 'all' hooks registered.\n\t\t\tif ( 'hookAdded' !== hookName && hooksStore.all ) {\n\t\t\t\thandlers.push( ...hooksStore.all.handlers );\n\t\t\t}\n\t\t}\n\n\t\tif ( ! handlers || ! handlers.length ) {\n\t\t\treturn returnFirstArg ? args[ 0 ] : undefined;\n\t\t}\n\n\t\tconst hookInfo = {\n\t\t\tname: hookName,\n\t\t\tcurrentIndex: 0,\n\t\t};\n\n\t\thooksStore.__current.push( hookInfo );\n\n\t\twhile ( hookInfo.currentIndex < handlers.length ) {\n\t\t\tconst handler = handlers[ hookInfo.currentIndex ];\n\n\t\t\tconst result = handler.callback.apply( null, args );\n\t\t\tif ( returnFirstArg ) {\n\t\t\t\targs[ 0 ] = result;\n\t\t\t}\n\n\t\t\thookInfo.currentIndex++;\n\t\t}\n\n\t\thooksStore.__current.pop();\n\n\t\tif ( returnFirstArg ) {\n\t\t\treturn args[ 0 ];\n\t\t}\n\t};\n}\n\nexport default createRunHook;\n"]}
@@ -24,8 +24,7 @@ import validateHookName from './validateHookName.js';
24
24
  */
25
25
 
26
26
  function createAddHook(hooks, storeKey) {
27
- return function addHook(hookName, namespace, callback) {
28
- let priority = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10;
27
+ return function addHook(hookName, namespace, callback, priority = 10) {
29
28
  const hooksStore = hooks[storeKey];
30
29
 
31
30
  if (!validateHookName(hookName)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/hooks/src/createAddHook.js"],"names":["validateNamespace","validateHookName","createAddHook","hooks","storeKey","addHook","hookName","namespace","callback","priority","hooksStore","console","error","handler","handlers","i","length","splice","__current","forEach","hookInfo","name","currentIndex","runs","doAction"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,iBAAP,MAA8B,wBAA9B;AACA,OAAOC,gBAAP,MAA6B,uBAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,aAAT,CAAwBC,KAAxB,EAA+BC,QAA/B,EAA0C;AACzC,SAAO,SAASC,OAAT,CAAkBC,QAAlB,EAA4BC,SAA5B,EAAuCC,QAAvC,EAAiE;AAAA,QAAhBC,QAAgB,uEAAL,EAAK;AACvE,UAAMC,UAAU,GAAGP,KAAK,CAAEC,QAAF,CAAxB;;AAEA,QAAK,CAAEH,gBAAgB,CAAEK,QAAF,CAAvB,EAAsC;AACrC;AACA;;AAED,QAAK,CAAEN,iBAAiB,CAAEO,SAAF,CAAxB,EAAwC;AACvC;AACA;;AAED,QAAK,eAAe,OAAOC,QAA3B,EAAsC;AACrC;AACAG,MAAAA,OAAO,CAACC,KAAR,CAAe,uCAAf;AACA;AACA,KAfsE,CAiBvE;;;AACA,QAAK,aAAa,OAAOH,QAAzB,EAAoC;AACnC;AACAE,MAAAA,OAAO,CAACC,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EAICC,QAJD,EAKCC,QALD;AAOA;AACD,GA7ED;AA8EA;;AAED,eAAeP,aAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport validateNamespace from './validateNamespace.js';\nimport validateHookName from './validateHookName.js';\n\n/**\n * @callback AddHook\n *\n * Adds the hook to the appropriate hooks container.\n *\n * @param {string} hookName Name of hook to add\n * @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.\n * @param {import('.').Callback} callback Function to call when the hook is run\n * @param {number} [priority=10] Priority of this hook\n */\n\n/**\n * Returns a function which, when invoked, will add a hook.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {AddHook} Function that adds a new hook.\n */\nfunction createAddHook( hooks, storeKey ) {\n\treturn function addHook( hookName, namespace, callback, priority = 10 ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! validateHookName( hookName ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! validateNamespace( namespace ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( 'function' !== typeof callback ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( 'The hook callback must be a function.' );\n\t\t\treturn;\n\t\t}\n\n\t\t// Validate numeric priority\n\t\tif ( 'number' !== typeof priority ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'If specified, the hook priority must be a number.'\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst handler = { callback, priority, namespace };\n\n\t\tif ( hooksStore[ hookName ] ) {\n\t\t\t// Find the correct insert index of the new hook.\n\t\t\tconst handlers = hooksStore[ hookName ].handlers;\n\n\t\t\t/** @type {number} */\n\t\t\tlet i;\n\t\t\tfor ( i = handlers.length; i > 0; i-- ) {\n\t\t\t\tif ( priority >= handlers[ i - 1 ].priority ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( i === handlers.length ) {\n\t\t\t\t// If append, operate via direct assignment.\n\t\t\t\thandlers[ i ] = handler;\n\t\t\t} else {\n\t\t\t\t// Otherwise, insert before index via splice.\n\t\t\t\thandlers.splice( i, 0, handler );\n\t\t\t}\n\n\t\t\t// We may also be currently executing this hook. If the callback\n\t\t\t// we're adding would come after the current callback, there's no\n\t\t\t// problem; otherwise we need to increase the execution index of\n\t\t\t// any other runs by 1 to account for the added element.\n\t\t\thooksStore.__current.forEach( ( hookInfo ) => {\n\t\t\t\tif (\n\t\t\t\t\thookInfo.name === hookName &&\n\t\t\t\t\thookInfo.currentIndex >= i\n\t\t\t\t) {\n\t\t\t\t\thookInfo.currentIndex++;\n\t\t\t\t}\n\t\t\t} );\n\t\t} else {\n\t\t\t// This is the first hook of its type.\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\thandlers: [ handler ],\n\t\t\t\truns: 0,\n\t\t\t};\n\t\t}\n\n\t\tif ( hookName !== 'hookAdded' ) {\n\t\t\thooks.doAction(\n\t\t\t\t'hookAdded',\n\t\t\t\thookName,\n\t\t\t\tnamespace,\n\t\t\t\tcallback,\n\t\t\t\tpriority\n\t\t\t);\n\t\t}\n\t};\n}\n\nexport default createAddHook;\n"]}
1
+ {"version":3,"sources":["@wordpress/hooks/src/createAddHook.js"],"names":["validateNamespace","validateHookName","createAddHook","hooks","storeKey","addHook","hookName","namespace","callback","priority","hooksStore","console","error","handler","handlers","i","length","splice","__current","forEach","hookInfo","name","currentIndex","runs","doAction"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,iBAAP,MAA8B,wBAA9B;AACA,OAAOC,gBAAP,MAA6B,uBAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,aAAT,CAAwBC,KAAxB,EAA+BC,QAA/B,EAA0C;AACzC,SAAO,SAASC,OAAT,CAAkBC,QAAlB,EAA4BC,SAA5B,EAAuCC,QAAvC,EAAiDC,QAAQ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,IAAT,KAAkBf,QAAlB,IACAc,QAAQ,CAACE,YAAT,IAAyBP,CAF1B,EAGE;AACDK,UAAAA,QAAQ,CAACE,YAAT;AACA;AACD,OAPD;AAQA,KAhCD,MAgCO;AACN;AACAZ,MAAAA,UAAU,CAAEJ,QAAF,CAAV,GAAyB;AACxBQ,QAAAA,QAAQ,EAAE,CAAED,OAAF,CADc;AAExBU,QAAAA,IAAI,EAAE;AAFkB,OAAzB;AAIA;;AAED,QAAKjB,QAAQ,KAAK,WAAlB,EAAgC;AAC/BH,MAAAA,KAAK,CAACqB,QAAN,CACC,WADD,EAEClB,QAFD,EAGCC,SAHD,EAICC,QAJD,EAKCC,QALD;AAOA;AACD,GA7ED;AA8EA;;AAED,eAAeP,aAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport validateNamespace from './validateNamespace.js';\nimport validateHookName from './validateHookName.js';\n\n/**\n * @callback AddHook\n *\n * Adds the hook to the appropriate hooks container.\n *\n * @param {string} hookName Name of hook to add\n * @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.\n * @param {import('.').Callback} callback Function to call when the hook is run\n * @param {number} [priority=10] Priority of this hook\n */\n\n/**\n * Returns a function which, when invoked, will add a hook.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {AddHook} Function that adds a new hook.\n */\nfunction createAddHook( hooks, storeKey ) {\n\treturn function addHook( hookName, namespace, callback, priority = 10 ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! validateHookName( hookName ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! validateNamespace( namespace ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( 'function' !== typeof callback ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( 'The hook callback must be a function.' );\n\t\t\treturn;\n\t\t}\n\n\t\t// Validate numeric priority\n\t\tif ( 'number' !== typeof priority ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'If specified, the hook priority must be a number.'\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst handler = { callback, priority, namespace };\n\n\t\tif ( hooksStore[ hookName ] ) {\n\t\t\t// Find the correct insert index of the new hook.\n\t\t\tconst handlers = hooksStore[ hookName ].handlers;\n\n\t\t\t/** @type {number} */\n\t\t\tlet i;\n\t\t\tfor ( i = handlers.length; i > 0; i-- ) {\n\t\t\t\tif ( priority >= handlers[ i - 1 ].priority ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( i === handlers.length ) {\n\t\t\t\t// If append, operate via direct assignment.\n\t\t\t\thandlers[ i ] = handler;\n\t\t\t} else {\n\t\t\t\t// Otherwise, insert before index via splice.\n\t\t\t\thandlers.splice( i, 0, handler );\n\t\t\t}\n\n\t\t\t// We may also be currently executing this hook. If the callback\n\t\t\t// we're adding would come after the current callback, there's no\n\t\t\t// problem; otherwise we need to increase the execution index of\n\t\t\t// any other runs by 1 to account for the added element.\n\t\t\thooksStore.__current.forEach( ( hookInfo ) => {\n\t\t\t\tif (\n\t\t\t\t\thookInfo.name === hookName &&\n\t\t\t\t\thookInfo.currentIndex >= i\n\t\t\t\t) {\n\t\t\t\t\thookInfo.currentIndex++;\n\t\t\t\t}\n\t\t\t} );\n\t\t} else {\n\t\t\t// This is the first hook of its type.\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\thandlers: [ handler ],\n\t\t\t\truns: 0,\n\t\t\t};\n\t\t}\n\n\t\tif ( hookName !== 'hookAdded' ) {\n\t\t\thooks.doAction(\n\t\t\t\t'hookAdded',\n\t\t\t\thookName,\n\t\t\t\tnamespace,\n\t\t\t\tcallback,\n\t\t\t\tpriority\n\t\t\t);\n\t\t}\n\t};\n}\n\nexport default createAddHook;\n"]}
@@ -10,10 +10,10 @@
10
10
  */
11
11
  function createCurrentHook(hooks, storeKey) {
12
12
  return function currentHook() {
13
- var _hooksStore$__current, _hooksStore$__current2;
13
+ var _hooksStore$__current;
14
14
 
15
15
  const hooksStore = hooks[storeKey];
16
- return (_hooksStore$__current = (_hooksStore$__current2 = hooksStore.__current[hooksStore.__current.length - 1]) === null || _hooksStore$__current2 === void 0 ? void 0 : _hooksStore$__current2.name) !== null && _hooksStore$__current !== void 0 ? _hooksStore$__current : null;
16
+ return (_hooksStore$__current = hooksStore.__current[hooksStore.__current.length - 1]?.name) !== null && _hooksStore$__current !== void 0 ? _hooksStore$__current : null;
17
17
  };
18
18
  }
19
19
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/hooks/src/createCurrentHook.js"],"names":["createCurrentHook","hooks","storeKey","currentHook","hooksStore","__current","length","name"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAT,CAA4BC,KAA5B,EAAmCC,QAAnC,EAA8C;AAC7C,SAAO,SAASC,WAAT,GAAuB;AAAA;;AAC7B,UAAMC,UAAU,GAAGH,KAAK,CAAEC,QAAF,CAAxB;AAEA,8DACCE,UAAU,CAACC,SAAX,CAAsBD,UAAU,CAACC,SAAX,CAAqBC,MAArB,GAA8B,CAApD,CADD,2DACC,uBAAyDC,IAD1D,yEAEC,IAFD;AAIA,GAPD;AAQA;;AAED,eAAeP,iBAAf","sourcesContent":["/**\n * Returns a function which, when invoked, will return the name of the\n * currently running hook, or `null` if no hook of the given type is currently\n * running.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {() => string | null} Function that returns the current hook name or null.\n */\nfunction createCurrentHook( hooks, storeKey ) {\n\treturn function currentHook() {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\treturn (\n\t\t\thooksStore.__current[ hooksStore.__current.length - 1 ]?.name ??\n\t\t\tnull\n\t\t);\n\t};\n}\n\nexport default createCurrentHook;\n"]}
1
+ {"version":3,"sources":["@wordpress/hooks/src/createCurrentHook.js"],"names":["createCurrentHook","hooks","storeKey","currentHook","hooksStore","__current","length","name"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAT,CAA4BC,KAA5B,EAAmCC,QAAnC,EAA8C;AAC7C,SAAO,SAASC,WAAT,GAAuB;AAAA;;AAC7B,UAAMC,UAAU,GAAGH,KAAK,CAAEC,QAAF,CAAxB;AAEA,oCACCE,UAAU,CAACC,SAAX,CAAsBD,UAAU,CAACC,SAAX,CAAqBC,MAArB,GAA8B,CAApD,GAAyDC,IAD1D,yEAEC,IAFD;AAIA,GAPD;AAQA;;AAED,eAAeP,iBAAf","sourcesContent":["/**\n * Returns a function which, when invoked, will return the name of the\n * currently running hook, or `null` if no hook of the given type is currently\n * running.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {() => string | null} Function that returns the current hook name or null.\n */\nfunction createCurrentHook( hooks, storeKey ) {\n\treturn function currentHook() {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\treturn (\n\t\t\thooksStore.__current[ hooksStore.__current.length - 1 ]?.name ??\n\t\t\tnull\n\t\t);\n\t};\n}\n\nexport default createCurrentHook;\n"]}
@@ -28,8 +28,7 @@ import validateHookName from './validateHookName.js';
28
28
  * @return {RemoveHook} Function that removes hooks.
29
29
  */
30
30
 
31
- function createRemoveHook(hooks, storeKey) {
32
- let removeAll = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
31
+ function createRemoveHook(hooks, storeKey, removeAll = false) {
33
32
  return function removeHook(hookName, namespace) {
34
33
  const hooksStore = hooks[storeKey];
35
34
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/hooks/src/createRemoveHook.js"],"names":["validateNamespace","validateHookName","createRemoveHook","hooks","storeKey","removeAll","removeHook","hookName","namespace","hooksStore","handlersRemoved","handlers","length","runs","i","splice","__current","forEach","hookInfo","name","currentIndex","doAction"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,iBA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AACI,MAAT,CAAiBD,CAAjB,EAAoB,CAApB;AACAJ,UAAAA,eAAe,GAF6B,CAG5C;AACA;AACA;AACA;AACA;;AACAD,UAAAA,UAAU,CAACO,SAAX,CAAqBC,OAArB,CAAgCC,QAAF,IAAgB;AAC7C,gBACCA,QAAQ,CAACC,IAAT,KAAkBZ,QAAlB,IACAW,QAAQ,CAACE,YAAT,IAAyBN,CAF1B,EAGE;AACDI,cAAAA,QAAQ,CAACE,YAAT;AACA;AACD,WAPD;AAQA;AACD;AACD;;AAED,QAAKb,QAAQ,KAAK,aAAlB,EAAkC;AACjCJ,MAAAA,KAAK,CAACkB,QAAN,CAAgB,aAAhB,EAA+Bd,QAA/B,EAAyCC,SAAzC;AACA;;AAED,WAAOE,eAAP;AACA,GArDD;AAsDA;;AAED,eAAeR,gBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport validateNamespace from './validateNamespace.js';\nimport validateHookName from './validateHookName.js';\n\n/**\n * @callback RemoveHook\n * Removes the specified callback (or all callbacks) from the hook with a given hookName\n * and namespace.\n *\n * @param {string} hookName The name of the hook to modify.\n * @param {string} namespace The unique namespace identifying the callback in the\n * form `vendor/plugin/function`.\n *\n * @return {number | undefined} The number of callbacks removed.\n */\n\n/**\n * Returns a function which, when invoked, will remove a specified hook or all\n * hooks by the given name.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n * @param {boolean} [removeAll=false] Whether to remove all callbacks for a hookName,\n * without regard to namespace. Used to create\n * `removeAll*` functions.\n *\n * @return {RemoveHook} Function that removes hooks.\n */\nfunction createRemoveHook( hooks, storeKey, removeAll = false ) {\n\treturn function removeHook( hookName, namespace ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! validateHookName( hookName ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! removeAll && ! validateNamespace( namespace ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Bail if no hooks exist by this name.\n\t\tif ( ! hooksStore[ hookName ] ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tlet handlersRemoved = 0;\n\n\t\tif ( removeAll ) {\n\t\t\thandlersRemoved = hooksStore[ hookName ].handlers.length;\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\truns: hooksStore[ hookName ].runs,\n\t\t\t\thandlers: [],\n\t\t\t};\n\t\t} else {\n\t\t\t// Try to find the specified callback to remove.\n\t\t\tconst handlers = hooksStore[ hookName ].handlers;\n\t\t\tfor ( let i = handlers.length - 1; i >= 0; i-- ) {\n\t\t\t\tif ( handlers[ i ].namespace === namespace ) {\n\t\t\t\t\thandlers.splice( i, 1 );\n\t\t\t\t\thandlersRemoved++;\n\t\t\t\t\t// This callback may also be part of a hook that is\n\t\t\t\t\t// currently executing. If the callback we're removing\n\t\t\t\t\t// comes after the current callback, there's no problem;\n\t\t\t\t\t// otherwise we need to decrease the execution index of any\n\t\t\t\t\t// other runs by 1 to account for the removed element.\n\t\t\t\t\thooksStore.__current.forEach( ( hookInfo ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thookInfo.name === hookName &&\n\t\t\t\t\t\t\thookInfo.currentIndex >= i\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\thookInfo.currentIndex--;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( hookName !== 'hookRemoved' ) {\n\t\t\thooks.doAction( 'hookRemoved', hookName, namespace );\n\t\t}\n\n\t\treturn handlersRemoved;\n\t};\n}\n\nexport default createRemoveHook;\n"]}
1
+ {"version":3,"sources":["@wordpress/hooks/src/createRemoveHook.js"],"names":["validateNamespace","validateHookName","createRemoveHook","hooks","storeKey","removeAll","removeHook","hookName","namespace","hooksStore","handlersRemoved","handlers","length","runs","i","splice","__current","forEach","hookInfo","name","currentIndex","doAction"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,iBAAP,MAA8B,wBAA9B;AACA,OAAOC,gBAAP,MA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AAAA,eAAe,GAF6B,CAG5C;AACA;AACA;AACA;AACA;;AACAD,UAAAA,UAAU,CAACO,SAAX,CAAqBC,OAArB,CAAgCC,QAAF,IAAgB;AAC7C,gBACCA,QAAQ,CAACC,IAAT,KAAkBZ,QAAlB,IACAW,QAAQ,CAACE,YAAT,IAAyBN,CAF1B,EAGE;AACDI,cAAAA,QAAQ,CAACE,YAAT;AACA;AACD,WAPD;AAQA;AACD;AACD;;AAED,QAAKb,QAAQ,KAAK,aAAlB,EAAkC;AACjCJ,MAAAA,KAAK,CAACkB,QAAN,CAAgB,aAAhB,EAA+Bd,QAA/B,EAAyCC,SAAzC;AACA;;AAED,WAAOE,eAAP;AACA,GArDD;AAsDA;;AAED,eAAeR,gBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport validateNamespace from './validateNamespace.js';\nimport validateHookName from './validateHookName.js';\n\n/**\n * @callback RemoveHook\n * Removes the specified callback (or all callbacks) from the hook with a given hookName\n * and namespace.\n *\n * @param {string} hookName The name of the hook to modify.\n * @param {string} namespace The unique namespace identifying the callback in the\n * form `vendor/plugin/function`.\n *\n * @return {number | undefined} The number of callbacks removed.\n */\n\n/**\n * Returns a function which, when invoked, will remove a specified hook or all\n * hooks by the given name.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n * @param {boolean} [removeAll=false] Whether to remove all callbacks for a hookName,\n * without regard to namespace. Used to create\n * `removeAll*` functions.\n *\n * @return {RemoveHook} Function that removes hooks.\n */\nfunction createRemoveHook( hooks, storeKey, removeAll = false ) {\n\treturn function removeHook( hookName, namespace ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! validateHookName( hookName ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! removeAll && ! validateNamespace( namespace ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Bail if no hooks exist by this name.\n\t\tif ( ! hooksStore[ hookName ] ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tlet handlersRemoved = 0;\n\n\t\tif ( removeAll ) {\n\t\t\thandlersRemoved = hooksStore[ hookName ].handlers.length;\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\truns: hooksStore[ hookName ].runs,\n\t\t\t\thandlers: [],\n\t\t\t};\n\t\t} else {\n\t\t\t// Try to find the specified callback to remove.\n\t\t\tconst handlers = hooksStore[ hookName ].handlers;\n\t\t\tfor ( let i = handlers.length - 1; i >= 0; i-- ) {\n\t\t\t\tif ( handlers[ i ].namespace === namespace ) {\n\t\t\t\t\thandlers.splice( i, 1 );\n\t\t\t\t\thandlersRemoved++;\n\t\t\t\t\t// This callback may also be part of a hook that is\n\t\t\t\t\t// currently executing. If the callback we're removing\n\t\t\t\t\t// comes after the current callback, there's no problem;\n\t\t\t\t\t// otherwise we need to decrease the execution index of any\n\t\t\t\t\t// other runs by 1 to account for the removed element.\n\t\t\t\t\thooksStore.__current.forEach( ( hookInfo ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thookInfo.name === hookName &&\n\t\t\t\t\t\t\thookInfo.currentIndex >= i\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\thookInfo.currentIndex--;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( hookName !== 'hookRemoved' ) {\n\t\t\thooks.doAction( 'hookRemoved', hookName, namespace );\n\t\t}\n\n\t\treturn handlersRemoved;\n\t};\n}\n\nexport default createRemoveHook;\n"]}
@@ -10,9 +10,8 @@
10
10
  *
11
11
  * @return {(hookName:string, ...args: unknown[]) => unknown} Function that runs hook callbacks.
12
12
  */
13
- function createRunHook(hooks, storeKey) {
14
- let returnFirstArg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
15
- return function runHooks(hookName) {
13
+ function createRunHook(hooks, storeKey, returnFirstArg = false) {
14
+ return function runHooks(hookName, ...args) {
16
15
  const hooksStore = hooks[storeKey];
17
16
 
18
17
  if (!hooksStore[hookName]) {
@@ -32,10 +31,6 @@ function createRunHook(hooks, storeKey) {
32
31
  }
33
32
  }
34
33
 
35
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
36
- args[_key - 1] = arguments[_key];
37
- }
38
-
39
34
  if (!handlers || !handlers.length) {
40
35
  return returnFirstArg ? args[0] : undefined;
41
36
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/hooks/src/createRunHook.js"],"names":["createRunHook","hooks","storeKey","returnFirstArg","runHooks","hookName","hooksStore","handlers","runs","process","env","NODE_ENV","all","push","args","length","undefined","hookInfo","name","currentIndex","__current","handler","result","callback","apply","pop"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAT,CAAwBC,KAAxB,EAA+BC,QAA/B,EAAkE;AAAA,MAAzBC,cAAyB,uEAAR,KAAQ;AACjE,SAAO,SAASC,QAAT,CAAmBC,QAAnB,EAAuC;AAC7C,UAAMC,UAAU,GAAGL,KAAK,CAAEC,QAAF,CAAxB;;AAEA,QAAK,CAAEI,UAAU,CAAED,QAAF,CAAjB,EAAgC;AAC/BC,MAAAA,UAAU,CAAED,QAAF,CAAV,GAAyB;AACxBE,QAAAA,QAAQ,EAAE,EADc;AAExBC,QAAAA,IAAI,EAAE;AAFkB,OAAzB;AAIA;;AAEDF,IAAAA,UAAU,CAAED,QAAF,CAAV,CAAuBG,IAAvB;AAEA,UAAMD,QAAQ,GAAGD,UAAU,CAAED,QAAF,CAAV,CAAuBE,QAAxC,CAZ6C,CAc7C;;AACA,QAAK,iBAAiBE,OAAO,CAACC,GAAR,CAAYC,QAAlC,EAA6C;AAC5C;AACA,UAAK,gBAAgBN,QAAhB,IAA4BC,UAAU,CAACM,GAA5C,EAAkD;AACjDL,QAAAA,QAAQ,CAACM,IAAT,CAAe,GAAGP,UAAU,CAACM,GAAX,CAAeL,QAAjC;AACA;AACD;;AApB4C,sCAAPO,IAAO;AAAPA,MAAAA,IAAO;AAAA;;AAsB7C,QAAK,CAAEP,QAAF,IAAc,CAAEA,QAAQ,CAACQ,MAA9B,EAAuC;AACtC,aAAOZ,cAAc,GAAGW,IAAI,CAAE,CAAF,CAAP,GAAeE,SAApC;AACA;;AAED,UAAMC,QAAQ,GAAG;AAChBC,MAAAA,IAAI,EAAEb,QADU;AAEhBc,MAAAA,YAAY,EAAE;AAFE,KAAjB;;AAKAb,IAAAA,UAAU,CAACc,SAAX,CAAqBP,IAArB,CAA2BI,QAA3B;;AAEA,WAAQA,QAAQ,CAACE,YAAT,GAAwBZ,QAAQ,CAACQ,MAAzC,EAAkD;AACjD,YAAMM,OAAO,GAAGd,QAAQ,CAAEU,QAAQ,CAACE,YAAX,CAAxB;AAEA,YAAMG,MAAM,GAAGD,OAAO,CAACE,QAAR,CAAiBC,KAAjB,CAAwB,IAAxB,EAA8BV,IAA9B,CAAf;;AACA,UAAKX,cAAL,EAAsB;AACrBW,QAAAA,IAAI,CAAE,CAAF,CAAJ,GAAYQ,MAAZ;AACA;;AAEDL,MAAAA,QAAQ,CAACE,YAAT;AACA;;AAEDb,IAAAA,UAAU,CAACc,SAAX,CAAqBK,GAArB;;AAEA,QAAKtB,cAAL,EAAsB;AACrB,aAAOW,IAAI,CAAE,CAAF,CAAX;AACA;AACD,GAjDD;AAkDA;;AAED,eAAed,aAAf","sourcesContent":["/**\n * Returns a function which, when invoked, will execute all callbacks\n * registered to a hook of the specified type, optionally returning the final\n * value of the call chain.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n * @param {boolean} [returnFirstArg=false] Whether each hook callback is expected to\n * return its first argument.\n *\n * @return {(hookName:string, ...args: unknown[]) => unknown} Function that runs hook callbacks.\n */\nfunction createRunHook( hooks, storeKey, returnFirstArg = false ) {\n\treturn function runHooks( hookName, ...args ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! hooksStore[ hookName ] ) {\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\thandlers: [],\n\t\t\t\truns: 0,\n\t\t\t};\n\t\t}\n\n\t\thooksStore[ hookName ].runs++;\n\n\t\tconst handlers = hooksStore[ hookName ].handlers;\n\n\t\t// The following code is stripped from production builds.\n\t\tif ( 'production' !== process.env.NODE_ENV ) {\n\t\t\t// Handle any 'all' hooks registered.\n\t\t\tif ( 'hookAdded' !== hookName && hooksStore.all ) {\n\t\t\t\thandlers.push( ...hooksStore.all.handlers );\n\t\t\t}\n\t\t}\n\n\t\tif ( ! handlers || ! handlers.length ) {\n\t\t\treturn returnFirstArg ? args[ 0 ] : undefined;\n\t\t}\n\n\t\tconst hookInfo = {\n\t\t\tname: hookName,\n\t\t\tcurrentIndex: 0,\n\t\t};\n\n\t\thooksStore.__current.push( hookInfo );\n\n\t\twhile ( hookInfo.currentIndex < handlers.length ) {\n\t\t\tconst handler = handlers[ hookInfo.currentIndex ];\n\n\t\t\tconst result = handler.callback.apply( null, args );\n\t\t\tif ( returnFirstArg ) {\n\t\t\t\targs[ 0 ] = result;\n\t\t\t}\n\n\t\t\thookInfo.currentIndex++;\n\t\t}\n\n\t\thooksStore.__current.pop();\n\n\t\tif ( returnFirstArg ) {\n\t\t\treturn args[ 0 ];\n\t\t}\n\t};\n}\n\nexport default createRunHook;\n"]}
1
+ {"version":3,"sources":["@wordpress/hooks/src/createRunHook.js"],"names":["createRunHook","hooks","storeKey","returnFirstArg","runHooks","hookName","args","hooksStore","handlers","runs","process","env","NODE_ENV","all","push","length","undefined","hookInfo","name","currentIndex","__current","handler","result","callback","apply","pop"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAT,CAAwBC,KAAxB,EAA+BC,QAA/B,EAAyCC,cAAc,GAAG,KAA1D,EAAkE;AACjE,SAAO,SAASC,QAAT,CAAmBC,QAAnB,EAA6B,GAAGC,IAAhC,EAAuC;AAC7C,UAAMC,UAAU,G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ACA;;AAEDZ,IAAAA,UAAU,CAACa,SAAX,CAAqBK,GAArB;;AAEA,QAAKtB,cAAL,EAAsB;AACrB,aAAOG,IAAI,CAAE,CAAF,CAAX;AACA;AACD,GAjDD;AAkDA;;AAED,eAAeN,aAAf","sourcesContent":["/**\n * Returns a function which, when invoked, will execute all callbacks\n * registered to a hook of the specified type, optionally returning the final\n * value of the call chain.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n * @param {boolean} [returnFirstArg=false] Whether each hook callback is expected to\n * return its first argument.\n *\n * @return {(hookName:string, ...args: unknown[]) => unknown} Function that runs hook callbacks.\n */\nfunction createRunHook( hooks, storeKey, returnFirstArg = false ) {\n\treturn function runHooks( hookName, ...args ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! hooksStore[ hookName ] ) {\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\thandlers: [],\n\t\t\t\truns: 0,\n\t\t\t};\n\t\t}\n\n\t\thooksStore[ hookName ].runs++;\n\n\t\tconst handlers = hooksStore[ hookName ].handlers;\n\n\t\t// The following code is stripped from production builds.\n\t\tif ( 'production' !== process.env.NODE_ENV ) {\n\t\t\t// Handle any 'all' hooks registered.\n\t\t\tif ( 'hookAdded' !== hookName && hooksStore.all ) {\n\t\t\t\thandlers.push( ...hooksStore.all.handlers );\n\t\t\t}\n\t\t}\n\n\t\tif ( ! handlers || ! handlers.length ) {\n\t\t\treturn returnFirstArg ? args[ 0 ] : undefined;\n\t\t}\n\n\t\tconst hookInfo = {\n\t\t\tname: hookName,\n\t\t\tcurrentIndex: 0,\n\t\t};\n\n\t\thooksStore.__current.push( hookInfo );\n\n\t\twhile ( hookInfo.currentIndex < handlers.length ) {\n\t\t\tconst handler = handlers[ hookInfo.currentIndex ];\n\n\t\t\tconst result = handler.callback.apply( null, args );\n\t\t\tif ( returnFirstArg ) {\n\t\t\t\targs[ 0 ] = result;\n\t\t\t}\n\n\t\t\thookInfo.currentIndex++;\n\t\t}\n\n\t\thooksStore.__current.pop();\n\n\t\tif ( returnFirstArg ) {\n\t\t\treturn args[ 0 ];\n\t\t}\n\t};\n}\n\nexport default createRunHook;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/hooks",
3
- "version": "3.34.0",
3
+ "version": "3.35.0",
4
4
  "description": "WordPress hooks library.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,5 +31,5 @@
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "c7c79cb11b677adcbf06cf5f8cfb6c5ec1699f19"
34
+ "gitHead": "a92f606309b1541b834ff9b0a76ed2a466fc45ed"
35
35
  }