@wordpress/hooks 4.31.1-next.f56bd8138.0 → 4.32.1-next.47f435fc9.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 +2 -0
- package/build/createAddHook.js +53 -53
- package/build/createAddHook.js.map +7 -1
- package/build/createCurrentHook.js +24 -22
- package/build/createCurrentHook.js.map +7 -1
- package/build/createDidHook.js +35 -28
- package/build/createDidHook.js.map +7 -1
- package/build/createDoingHook.js +27 -31
- package/build/createDoingHook.js.map +7 -1
- package/build/createHasHook.js +27 -29
- package/build/createHasHook.js.map +7 -1
- package/build/createHooks.js +87 -53
- package/build/createHooks.js.map +7 -1
- package/build/createRemoveHook.js +40 -43
- package/build/createRemoveHook.js.map +7 -1
- package/build/createRunHook.js +30 -32
- package/build/createRunHook.js.map +7 -1
- package/build/index.js +81 -73
- package/build/index.js.map +7 -1
- package/build/types.js +16 -5
- package/build/types.js.map +7 -1
- package/build/validateHookName.js +29 -22
- package/build/validateHookName.js.map +7 -1
- package/build/validateNamespace.js +28 -19
- package/build/validateNamespace.js.map +7 -1
- package/build-module/createAddHook.js +23 -46
- package/build-module/createAddHook.js.map +7 -1
- package/build-module/createCurrentHook.js +6 -18
- package/build-module/createCurrentHook.js.map +7 -1
- package/build-module/createDidHook.js +6 -22
- package/build-module/createDidHook.js.map +7 -1
- package/build-module/createDoingHook.js +9 -27
- package/build-module/createDoingHook.js.map +7 -1
- package/build-module/createHasHook.js +9 -25
- package/build-module/createHasHook.js.map +7 -1
- package/build-module/createHooks.js +56 -47
- package/build-module/createHooks.js.map +7 -1
- package/build-module/createRemoveHook.js +10 -36
- package/build-module/createRemoveHook.js.map +7 -1
- package/build-module/createRunHook.js +12 -28
- package/build-module/createRunHook.js.map +7 -1
- package/build-module/index.js +28 -8
- package/build-module/index.js.map +7 -1
- package/build-module/types.js +1 -2
- package/build-module/types.js.map +7 -1
- package/build-module/validateHookName.js +11 -18
- package/build-module/validateHookName.js.map +7 -1
- package/build-module/validateNamespace.js +10 -15
- package/build-module/validateNamespace.js.map +7 -1
- package/package.json +10 -5
package/build/createHooks.js
CHANGED
|
@@ -1,62 +1,96 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var createHooks_exports = {};
|
|
30
|
+
__export(createHooks_exports, {
|
|
31
|
+
_Hooks: () => _Hooks,
|
|
32
|
+
default: () => createHooks_default
|
|
6
33
|
});
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal class for constructing hooks. Use `createHooks()` function
|
|
21
|
-
*
|
|
22
|
-
* Note, it is necessary to expose this class to make its type public.
|
|
23
|
-
*
|
|
24
|
-
* @private
|
|
25
|
-
*/
|
|
34
|
+
module.exports = __toCommonJS(createHooks_exports);
|
|
35
|
+
var import_createAddHook = __toESM(require("./createAddHook"));
|
|
36
|
+
var import_createRemoveHook = __toESM(require("./createRemoveHook"));
|
|
37
|
+
var import_createHasHook = __toESM(require("./createHasHook"));
|
|
38
|
+
var import_createRunHook = __toESM(require("./createRunHook"));
|
|
39
|
+
var import_createCurrentHook = __toESM(require("./createCurrentHook"));
|
|
40
|
+
var import_createDoingHook = __toESM(require("./createDoingHook"));
|
|
41
|
+
var import_createDidHook = __toESM(require("./createDidHook"));
|
|
26
42
|
class _Hooks {
|
|
43
|
+
actions;
|
|
44
|
+
filters;
|
|
45
|
+
addAction;
|
|
46
|
+
addFilter;
|
|
47
|
+
removeAction;
|
|
48
|
+
removeFilter;
|
|
49
|
+
hasAction;
|
|
50
|
+
hasFilter;
|
|
51
|
+
removeAllActions;
|
|
52
|
+
removeAllFilters;
|
|
53
|
+
doAction;
|
|
54
|
+
doActionAsync;
|
|
55
|
+
applyFilters;
|
|
56
|
+
applyFiltersAsync;
|
|
57
|
+
currentAction;
|
|
58
|
+
currentFilter;
|
|
59
|
+
doingAction;
|
|
60
|
+
doingFilter;
|
|
61
|
+
didAction;
|
|
62
|
+
didFilter;
|
|
27
63
|
constructor() {
|
|
28
|
-
this.actions = Object.create(null);
|
|
29
|
-
this.actions.__current = new Set();
|
|
30
|
-
this.filters = Object.create(null);
|
|
31
|
-
this.filters.__current = new Set();
|
|
32
|
-
this.addAction = (0,
|
|
33
|
-
this.addFilter = (0,
|
|
34
|
-
this.removeAction = (0,
|
|
35
|
-
this.removeFilter = (0,
|
|
36
|
-
this.hasAction = (0,
|
|
37
|
-
this.hasFilter = (0,
|
|
38
|
-
this.removeAllActions = (0,
|
|
39
|
-
this.removeAllFilters = (0,
|
|
40
|
-
this.doAction = (0,
|
|
41
|
-
this.doActionAsync = (0,
|
|
42
|
-
this.applyFilters = (0,
|
|
43
|
-
this.applyFiltersAsync = (0,
|
|
44
|
-
this.currentAction = (0,
|
|
45
|
-
this.currentFilter = (0,
|
|
46
|
-
this.doingAction = (0,
|
|
47
|
-
this.doingFilter = (0,
|
|
48
|
-
this.didAction = (0,
|
|
49
|
-
this.didFilter = (0,
|
|
64
|
+
this.actions = /* @__PURE__ */ Object.create(null);
|
|
65
|
+
this.actions.__current = /* @__PURE__ */ new Set();
|
|
66
|
+
this.filters = /* @__PURE__ */ Object.create(null);
|
|
67
|
+
this.filters.__current = /* @__PURE__ */ new Set();
|
|
68
|
+
this.addAction = (0, import_createAddHook.default)(this, "actions");
|
|
69
|
+
this.addFilter = (0, import_createAddHook.default)(this, "filters");
|
|
70
|
+
this.removeAction = (0, import_createRemoveHook.default)(this, "actions");
|
|
71
|
+
this.removeFilter = (0, import_createRemoveHook.default)(this, "filters");
|
|
72
|
+
this.hasAction = (0, import_createHasHook.default)(this, "actions");
|
|
73
|
+
this.hasFilter = (0, import_createHasHook.default)(this, "filters");
|
|
74
|
+
this.removeAllActions = (0, import_createRemoveHook.default)(this, "actions", true);
|
|
75
|
+
this.removeAllFilters = (0, import_createRemoveHook.default)(this, "filters", true);
|
|
76
|
+
this.doAction = (0, import_createRunHook.default)(this, "actions", false, false);
|
|
77
|
+
this.doActionAsync = (0, import_createRunHook.default)(this, "actions", false, true);
|
|
78
|
+
this.applyFilters = (0, import_createRunHook.default)(this, "filters", true, false);
|
|
79
|
+
this.applyFiltersAsync = (0, import_createRunHook.default)(this, "filters", true, true);
|
|
80
|
+
this.currentAction = (0, import_createCurrentHook.default)(this, "actions");
|
|
81
|
+
this.currentFilter = (0, import_createCurrentHook.default)(this, "filters");
|
|
82
|
+
this.doingAction = (0, import_createDoingHook.default)(this, "actions");
|
|
83
|
+
this.doingFilter = (0, import_createDoingHook.default)(this, "filters");
|
|
84
|
+
this.didAction = (0, import_createDidHook.default)(this, "actions");
|
|
85
|
+
this.didFilter = (0, import_createDidHook.default)(this, "filters");
|
|
50
86
|
}
|
|
51
87
|
}
|
|
52
|
-
exports._Hooks = _Hooks;
|
|
53
|
-
/**
|
|
54
|
-
* Returns an instance of the hooks object.
|
|
55
|
-
*
|
|
56
|
-
* @return A Hooks instance.
|
|
57
|
-
*/
|
|
58
88
|
function createHooks() {
|
|
59
89
|
return new _Hooks();
|
|
60
90
|
}
|
|
61
|
-
var
|
|
62
|
-
|
|
91
|
+
var createHooks_default = createHooks;
|
|
92
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
93
|
+
0 && (module.exports = {
|
|
94
|
+
_Hooks
|
|
95
|
+
});
|
|
96
|
+
//# sourceMappingURL=createHooks.js.map
|
package/build/createHooks.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/createHooks.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport createAddHook from './createAddHook';\nimport createRemoveHook from './createRemoveHook';\nimport createHasHook from './createHasHook';\nimport createRunHook from './createRunHook';\nimport createCurrentHook from './createCurrentHook';\nimport createDoingHook from './createDoingHook';\nimport createDidHook from './createDidHook';\nimport type { Store } from './types';\n\n/**\n * Internal class for constructing hooks. Use `createHooks()` function\n *\n * Note, it is necessary to expose this class to make its type public.\n *\n * @private\n */\nexport class _Hooks {\n\tpublic actions: Store;\n\tpublic filters: Store;\n\n\tpublic addAction: ReturnType< typeof createAddHook >;\n\tpublic addFilter: ReturnType< typeof createAddHook >;\n\tpublic removeAction: ReturnType< typeof createRemoveHook >;\n\tpublic removeFilter: ReturnType< typeof createRemoveHook >;\n\tpublic hasAction: ReturnType< typeof createHasHook >;\n\tpublic hasFilter: ReturnType< typeof createHasHook >;\n\tpublic removeAllActions: ReturnType< typeof createRemoveHook >;\n\tpublic removeAllFilters: ReturnType< typeof createRemoveHook >;\n\tpublic doAction: ReturnType< typeof createRunHook >;\n\tpublic doActionAsync: ReturnType< typeof createRunHook >;\n\tpublic applyFilters: ReturnType< typeof createRunHook >;\n\tpublic applyFiltersAsync: ReturnType< typeof createRunHook >;\n\tpublic currentAction: ReturnType< typeof createCurrentHook >;\n\tpublic currentFilter: ReturnType< typeof createCurrentHook >;\n\tpublic doingAction: ReturnType< typeof createDoingHook >;\n\tpublic doingFilter: ReturnType< typeof createDoingHook >;\n\tpublic didAction: ReturnType< typeof createDidHook >;\n\tpublic didFilter: ReturnType< typeof createDidHook >;\n\n\tconstructor() {\n\t\tthis.actions = Object.create( null );\n\t\tthis.actions.__current = new Set();\n\n\t\tthis.filters = Object.create( null );\n\t\tthis.filters.__current = new Set();\n\n\t\tthis.addAction = createAddHook( this, 'actions' );\n\t\tthis.addFilter = createAddHook( this, 'filters' );\n\t\tthis.removeAction = createRemoveHook( this, 'actions' );\n\t\tthis.removeFilter = createRemoveHook( this, 'filters' );\n\t\tthis.hasAction = createHasHook( this, 'actions' );\n\t\tthis.hasFilter = createHasHook( this, 'filters' );\n\t\tthis.removeAllActions = createRemoveHook( this, 'actions', true );\n\t\tthis.removeAllFilters = createRemoveHook( this, 'filters', true );\n\t\tthis.doAction = createRunHook( this, 'actions', false, false );\n\t\tthis.doActionAsync = createRunHook( this, 'actions', false, true );\n\t\tthis.applyFilters = createRunHook( this, 'filters', true, false );\n\t\tthis.applyFiltersAsync = createRunHook( this, 'filters', true, true );\n\t\tthis.currentAction = createCurrentHook( this, 'actions' );\n\t\tthis.currentFilter = createCurrentHook( this, 'filters' );\n\t\tthis.doingAction = createDoingHook( this, 'actions' );\n\t\tthis.doingFilter = createDoingHook( this, 'filters' );\n\t\tthis.didAction = createDidHook( this, 'actions' );\n\t\tthis.didFilter = createDidHook( this, 'filters' );\n\t}\n}\n\nexport type Hooks = _Hooks;\n\n/**\n * Returns an instance of the hooks object.\n *\n * @return A Hooks instance.\n */\nfunction createHooks(): Hooks {\n\treturn new _Hooks();\n}\n\nexport default createHooks;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,2BAA0B;AAC1B,8BAA6B;AAC7B,2BAA0B;AAC1B,2BAA0B;AAC1B,+BAA8B;AAC9B,6BAA4B;AAC5B,2BAA0B;AAUnB,MAAM,OAAO;AAAA,EACZ;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEP,cAAc;AACb,SAAK,UAAU,uBAAO,OAAQ,IAAK;AACnC,SAAK,QAAQ,YAAY,oBAAI,IAAI;AAEjC,SAAK,UAAU,uBAAO,OAAQ,IAAK;AACnC,SAAK,QAAQ,YAAY,oBAAI,IAAI;AAEjC,SAAK,gBAAY,qBAAAA,SAAe,MAAM,SAAU;AAChD,SAAK,gBAAY,qBAAAA,SAAe,MAAM,SAAU;AAChD,SAAK,mBAAe,wBAAAC,SAAkB,MAAM,SAAU;AACtD,SAAK,mBAAe,wBAAAA,SAAkB,MAAM,SAAU;AACtD,SAAK,gBAAY,qBAAAC,SAAe,MAAM,SAAU;AAChD,SAAK,gBAAY,qBAAAA,SAAe,MAAM,SAAU;AAChD,SAAK,uBAAmB,wBAAAD,SAAkB,MAAM,WAAW,IAAK;AAChE,SAAK,uBAAmB,wBAAAA,SAAkB,MAAM,WAAW,IAAK;AAChE,SAAK,eAAW,qBAAAE,SAAe,MAAM,WAAW,OAAO,KAAM;AAC7D,SAAK,oBAAgB,qBAAAA,SAAe,MAAM,WAAW,OAAO,IAAK;AACjE,SAAK,mBAAe,qBAAAA,SAAe,MAAM,WAAW,MAAM,KAAM;AAChE,SAAK,wBAAoB,qBAAAA,SAAe,MAAM,WAAW,MAAM,IAAK;AACpE,SAAK,oBAAgB,yBAAAC,SAAmB,MAAM,SAAU;AACxD,SAAK,oBAAgB,yBAAAA,SAAmB,MAAM,SAAU;AACxD,SAAK,kBAAc,uBAAAC,SAAiB,MAAM,SAAU;AACpD,SAAK,kBAAc,uBAAAA,SAAiB,MAAM,SAAU;AACpD,SAAK,gBAAY,qBAAAC,SAAe,MAAM,SAAU;AAChD,SAAK,gBAAY,qBAAAA,SAAe,MAAM,SAAU;AAAA,EACjD;AACD;AASA,SAAS,cAAqB;AAC7B,SAAO,IAAI,OAAO;AACnB;AAEA,IAAO,sBAAQ;",
|
|
6
|
+
"names": ["createAddHook", "createRemoveHook", "createHasHook", "createRunHook", "createCurrentHook", "createDoingHook", "createDidHook"]
|
|
7
|
+
}
|
|
@@ -1,44 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var createRemoveHook_exports = {};
|
|
30
|
+
__export(createRemoveHook_exports, {
|
|
31
|
+
default: () => createRemoveHook_default
|
|
6
32
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Removes the specified callback (or all callbacks) from the hook with a given hookName
|
|
16
|
-
* and namespace.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Returns a function which, when invoked, will remove a specified hook or all
|
|
21
|
-
* hooks by the given name.
|
|
22
|
-
*
|
|
23
|
-
* @param hooks Hooks instance.
|
|
24
|
-
* @param storeKey
|
|
25
|
-
* @param [removeAll=false] Whether to remove all callbacks for a hookName,
|
|
26
|
-
* without regard to namespace. Used to create
|
|
27
|
-
* `removeAll*` functions.
|
|
28
|
-
*
|
|
29
|
-
* @return Function that removes hooks.
|
|
30
|
-
*/
|
|
33
|
+
module.exports = __toCommonJS(createRemoveHook_exports);
|
|
34
|
+
var import_validateNamespace = __toESM(require("./validateNamespace"));
|
|
35
|
+
var import_validateHookName = __toESM(require("./validateHookName"));
|
|
31
36
|
function createRemoveHook(hooks, storeKey, removeAll = false) {
|
|
32
37
|
return function removeHook(hookName, namespace) {
|
|
33
38
|
const hooksStore = hooks[storeKey];
|
|
34
|
-
if (!(0,
|
|
39
|
+
if (!(0, import_validateHookName.default)(hookName)) {
|
|
35
40
|
return;
|
|
36
41
|
}
|
|
37
|
-
if (!removeAll && !(0,
|
|
42
|
+
if (!removeAll && !(0, import_validateNamespace.default)(namespace)) {
|
|
38
43
|
return;
|
|
39
44
|
}
|
|
40
|
-
|
|
41
|
-
// Bail if no hooks exist by this name.
|
|
42
45
|
if (!hooksStore[hookName]) {
|
|
43
46
|
return 0;
|
|
44
47
|
}
|
|
@@ -50,18 +53,12 @@ function createRemoveHook(hooks, storeKey, removeAll = false) {
|
|
|
50
53
|
handlers: []
|
|
51
54
|
};
|
|
52
55
|
} else {
|
|
53
|
-
// Try to find the specified callback to remove.
|
|
54
56
|
const handlers = hooksStore[hookName].handlers;
|
|
55
57
|
for (let i = handlers.length - 1; i >= 0; i--) {
|
|
56
58
|
if (handlers[i].namespace === namespace) {
|
|
57
59
|
handlers.splice(i, 1);
|
|
58
60
|
handlersRemoved++;
|
|
59
|
-
|
|
60
|
-
// currently executing. If the callback we're removing
|
|
61
|
-
// comes after the current callback, there's no problem;
|
|
62
|
-
// otherwise we need to decrease the execution index of any
|
|
63
|
-
// other runs by 1 to account for the removed element.
|
|
64
|
-
hooksStore.__current.forEach(hookInfo => {
|
|
61
|
+
hooksStore.__current.forEach((hookInfo) => {
|
|
65
62
|
if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
|
|
66
63
|
hookInfo.currentIndex--;
|
|
67
64
|
}
|
|
@@ -69,11 +66,11 @@ function createRemoveHook(hooks, storeKey, removeAll = false) {
|
|
|
69
66
|
}
|
|
70
67
|
}
|
|
71
68
|
}
|
|
72
|
-
if (hookName !==
|
|
73
|
-
hooks.doAction(
|
|
69
|
+
if (hookName !== "hookRemoved") {
|
|
70
|
+
hooks.doAction("hookRemoved", hookName, namespace);
|
|
74
71
|
}
|
|
75
72
|
return handlersRemoved;
|
|
76
73
|
};
|
|
77
74
|
}
|
|
78
|
-
var
|
|
79
|
-
//# sourceMappingURL=createRemoveHook.js.map
|
|
75
|
+
var createRemoveHook_default = createRemoveHook;
|
|
76
|
+
//# sourceMappingURL=createRemoveHook.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/createRemoveHook.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport validateNamespace from './validateNamespace';\nimport validateHookName from './validateHookName';\nimport type { Hooks, StoreKey } from './types';\n\n/**\n * Removes the specified callback (or all callbacks) from the hook with a given hookName\n * and namespace.\n */\nexport type RemoveHook = (\n\t/**\n\t * The name of the hook to modify.\n\t */\n\thookName: string,\n\t/**\n\t * The unique namespace identifying the callback in the form `vendor/plugin/function`.\n\t */\n\tnamespace: string\n) => number | undefined;\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 hooks Hooks instance.\n * @param storeKey\n * @param [removeAll=false] Whether to remove all callbacks for a hookName,\n * without regard to namespace. Used to create\n * `removeAll*` functions.\n *\n * @return Function that removes hooks.\n */\nfunction createRemoveHook(\n\thooks: Hooks,\n\tstoreKey: StoreKey,\n\tremoveAll: boolean = false\n): RemoveHook {\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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAA8B;AAC9B,8BAA6B;AA8B7B,SAAS,iBACR,OACA,UACA,YAAqB,OACR;AACb,SAAO,SAAS,WAAY,UAAU,WAAY;AACjD,UAAM,aAAa,MAAO,QAAS;AAEnC,QAAK,KAAE,wBAAAA,SAAkB,QAAS,GAAI;AACrC;AAAA,IACD;AAEA,QAAK,CAAE,aAAa,KAAE,yBAAAC,SAAmB,SAAU,GAAI;AACtD;AAAA,IACD;AAGA,QAAK,CAAE,WAAY,QAAS,GAAI;AAC/B,aAAO;AAAA,IACR;AAEA,QAAI,kBAAkB;AAEtB,QAAK,WAAY;AAChB,wBAAkB,WAAY,QAAS,EAAE,SAAS;AAClD,iBAAY,QAAS,IAAI;AAAA,QACxB,MAAM,WAAY,QAAS,EAAE;AAAA,QAC7B,UAAU,CAAC;AAAA,MACZ;AAAA,IACD,OAAO;AAEN,YAAM,WAAW,WAAY,QAAS,EAAE;AACxC,eAAU,IAAI,SAAS,SAAS,GAAG,KAAK,GAAG,KAAM;AAChD,YAAK,SAAU,CAAE,EAAE,cAAc,WAAY;AAC5C,mBAAS,OAAQ,GAAG,CAAE;AACtB;AAMA,qBAAW,UAAU,QAAS,CAAE,aAAc;AAC7C,gBACC,SAAS,SAAS,YAClB,SAAS,gBAAgB,GACxB;AACD,uBAAS;AAAA,YACV;AAAA,UACD,CAAE;AAAA,QACH;AAAA,MACD;AAAA,IACD;AAEA,QAAK,aAAa,eAAgB;AACjC,YAAM,SAAU,eAAe,UAAU,SAAU;AAAA,IACpD;AAEA,WAAO;AAAA,EACR;AACD;AAEA,IAAO,2BAAQ;",
|
|
6
|
+
"names": ["validateHookName", "validateNamespace"]
|
|
7
|
+
}
|
package/build/createRunHook.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var createRunHook_exports = {};
|
|
20
|
+
__export(createRunHook_exports, {
|
|
21
|
+
default: () => createRunHook_default
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Returns a function which, when invoked, will execute all callbacks
|
|
13
|
-
* registered to a hook of the specified type, optionally returning the final
|
|
14
|
-
* value of the call chain.
|
|
15
|
-
*
|
|
16
|
-
* @param hooks Hooks instance.
|
|
17
|
-
* @param storeKey
|
|
18
|
-
* @param returnFirstArg Whether each hook callback is expected to return its first argument.
|
|
19
|
-
* @param async Whether the hook callback should be run asynchronously
|
|
20
|
-
*
|
|
21
|
-
* @return Function that runs hook callbacks.
|
|
22
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(createRunHook_exports);
|
|
23
24
|
function createRunHook(hooks, storeKey, returnFirstArg, async) {
|
|
24
25
|
return function runHook(hookName, ...args) {
|
|
25
26
|
const hooksStore = hooks[storeKey];
|
|
@@ -31,16 +32,13 @@ function createRunHook(hooks, storeKey, returnFirstArg, async) {
|
|
|
31
32
|
}
|
|
32
33
|
hooksStore[hookName].runs++;
|
|
33
34
|
const handlers = hooksStore[hookName].handlers;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if ('production' !== process.env.NODE_ENV) {
|
|
37
|
-
// Handle any 'all' hooks registered.
|
|
38
|
-
if ('hookAdded' !== hookName && hooksStore.all) {
|
|
35
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
36
|
+
if ("hookAdded" !== hookName && hooksStore.all) {
|
|
39
37
|
handlers.push(...hooksStore.all.handlers);
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
if (!handlers || !handlers.length) {
|
|
43
|
-
return returnFirstArg ? args[0] :
|
|
41
|
+
return returnFirstArg ? args[0] : void 0;
|
|
44
42
|
}
|
|
45
43
|
const hookInfo = {
|
|
46
44
|
name: hookName,
|
|
@@ -49,7 +47,7 @@ function createRunHook(hooks, storeKey, returnFirstArg, async) {
|
|
|
49
47
|
async function asyncRunner() {
|
|
50
48
|
try {
|
|
51
49
|
hooksStore.__current.add(hookInfo);
|
|
52
|
-
let result = returnFirstArg ? args[0] :
|
|
50
|
+
let result = returnFirstArg ? args[0] : void 0;
|
|
53
51
|
while (hookInfo.currentIndex < handlers.length) {
|
|
54
52
|
const handler = handlers[hookInfo.currentIndex];
|
|
55
53
|
result = await handler.callback.apply(null, args);
|
|
@@ -58,7 +56,7 @@ function createRunHook(hooks, storeKey, returnFirstArg, async) {
|
|
|
58
56
|
}
|
|
59
57
|
hookInfo.currentIndex++;
|
|
60
58
|
}
|
|
61
|
-
return returnFirstArg ? result :
|
|
59
|
+
return returnFirstArg ? result : void 0;
|
|
62
60
|
} finally {
|
|
63
61
|
hooksStore.__current.delete(hookInfo);
|
|
64
62
|
}
|
|
@@ -66,7 +64,7 @@ function createRunHook(hooks, storeKey, returnFirstArg, async) {
|
|
|
66
64
|
function syncRunner() {
|
|
67
65
|
try {
|
|
68
66
|
hooksStore.__current.add(hookInfo);
|
|
69
|
-
let result = returnFirstArg ? args[0] :
|
|
67
|
+
let result = returnFirstArg ? args[0] : void 0;
|
|
70
68
|
while (hookInfo.currentIndex < handlers.length) {
|
|
71
69
|
const handler = handlers[hookInfo.currentIndex];
|
|
72
70
|
result = handler.callback.apply(null, args);
|
|
@@ -75,7 +73,7 @@ function createRunHook(hooks, storeKey, returnFirstArg, async) {
|
|
|
75
73
|
}
|
|
76
74
|
hookInfo.currentIndex++;
|
|
77
75
|
}
|
|
78
|
-
return returnFirstArg ? result :
|
|
76
|
+
return returnFirstArg ? result : void 0;
|
|
79
77
|
} finally {
|
|
80
78
|
hooksStore.__current.delete(hookInfo);
|
|
81
79
|
}
|
|
@@ -83,5 +81,5 @@ function createRunHook(hooks, storeKey, returnFirstArg, async) {
|
|
|
83
81
|
return (async ? asyncRunner : syncRunner)();
|
|
84
82
|
};
|
|
85
83
|
}
|
|
86
|
-
var
|
|
87
|
-
//# sourceMappingURL=createRunHook.js.map
|
|
84
|
+
var createRunHook_default = createRunHook;
|
|
85
|
+
//# sourceMappingURL=createRunHook.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/createRunHook.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Hooks, StoreKey } from './types';\n\nexport type RunHook = (\n\thookName: string,\n\t...args: unknown[]\n) => undefined | unknown;\n\n/**\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 hooks Hooks instance.\n * @param storeKey\n * @param returnFirstArg Whether each hook callback is expected to return its first argument.\n * @param async Whether the hook callback should be run asynchronously\n *\n * @return Function that runs hook callbacks.\n */\nfunction createRunHook(\n\thooks: Hooks,\n\tstoreKey: StoreKey,\n\treturnFirstArg: boolean,\n\tasync: boolean\n): RunHook {\n\treturn function runHook( 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\tasync function asyncRunner() {\n\t\t\ttry {\n\t\t\t\thooksStore.__current.add( hookInfo );\n\t\t\t\tlet result = returnFirstArg ? args[ 0 ] : undefined;\n\t\t\t\twhile ( hookInfo.currentIndex < handlers.length ) {\n\t\t\t\t\tconst handler = handlers[ hookInfo.currentIndex ];\n\t\t\t\t\tresult = await handler.callback.apply( null, args );\n\t\t\t\t\tif ( returnFirstArg ) {\n\t\t\t\t\t\targs[ 0 ] = result;\n\t\t\t\t\t}\n\t\t\t\t\thookInfo.currentIndex++;\n\t\t\t\t}\n\t\t\t\treturn returnFirstArg ? result : undefined;\n\t\t\t} finally {\n\t\t\t\thooksStore.__current.delete( hookInfo );\n\t\t\t}\n\t\t}\n\n\t\tfunction syncRunner() {\n\t\t\ttry {\n\t\t\t\thooksStore.__current.add( hookInfo );\n\t\t\t\tlet result = returnFirstArg ? args[ 0 ] : undefined;\n\t\t\t\twhile ( hookInfo.currentIndex < handlers.length ) {\n\t\t\t\t\tconst handler = handlers[ hookInfo.currentIndex ];\n\t\t\t\t\tresult = handler.callback.apply( null, args );\n\t\t\t\t\tif ( returnFirstArg ) {\n\t\t\t\t\t\targs[ 0 ] = result;\n\t\t\t\t\t}\n\t\t\t\t\thookInfo.currentIndex++;\n\t\t\t\t}\n\t\t\t\treturn returnFirstArg ? result : undefined;\n\t\t\t} finally {\n\t\t\t\thooksStore.__current.delete( hookInfo );\n\t\t\t}\n\t\t}\n\n\t\treturn ( async ? asyncRunner : syncRunner )();\n\t};\n}\n\nexport default createRunHook;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBA,SAAS,cACR,OACA,UACA,gBACA,OACU;AACV,SAAO,SAAS,QAAS,aAAa,MAAO;AAC5C,UAAM,aAAa,MAAO,QAAS;AAEnC,QAAK,CAAE,WAAY,QAAS,GAAI;AAC/B,iBAAY,QAAS,IAAI;AAAA,QACxB,UAAU,CAAC;AAAA,QACX,MAAM;AAAA,MACP;AAAA,IACD;AAEA,eAAY,QAAS,EAAE;AAEvB,UAAM,WAAW,WAAY,QAAS,EAAE;AAGxC,QAAK,iBAAiB,QAAQ,IAAI,UAAW;AAE5C,UAAK,gBAAgB,YAAY,WAAW,KAAM;AACjD,iBAAS,KAAM,GAAG,WAAW,IAAI,QAAS;AAAA,MAC3C;AAAA,IACD;AAEA,QAAK,CAAE,YAAY,CAAE,SAAS,QAAS;AACtC,aAAO,iBAAiB,KAAM,CAAE,IAAI;AAAA,IACrC;AAEA,UAAM,WAAW;AAAA,MAChB,MAAM;AAAA,MACN,cAAc;AAAA,IACf;AAEA,mBAAe,cAAc;AAC5B,UAAI;AACH,mBAAW,UAAU,IAAK,QAAS;AACnC,YAAI,SAAS,iBAAiB,KAAM,CAAE,IAAI;AAC1C,eAAQ,SAAS,eAAe,SAAS,QAAS;AACjD,gBAAM,UAAU,SAAU,SAAS,YAAa;AAChD,mBAAS,MAAM,QAAQ,SAAS,MAAO,MAAM,IAAK;AAClD,cAAK,gBAAiB;AACrB,iBAAM,CAAE,IAAI;AAAA,UACb;AACA,mBAAS;AAAA,QACV;AACA,eAAO,iBAAiB,SAAS;AAAA,MAClC,UAAE;AACD,mBAAW,UAAU,OAAQ,QAAS;AAAA,MACvC;AAAA,IACD;AAEA,aAAS,aAAa;AACrB,UAAI;AACH,mBAAW,UAAU,IAAK,QAAS;AACnC,YAAI,SAAS,iBAAiB,KAAM,CAAE,IAAI;AAC1C,eAAQ,SAAS,eAAe,SAAS,QAAS;AACjD,gBAAM,UAAU,SAAU,SAAS,YAAa;AAChD,mBAAS,QAAQ,SAAS,MAAO,MAAM,IAAK;AAC5C,cAAK,gBAAiB;AACrB,iBAAM,CAAE,IAAI;AAAA,UACb;AACA,mBAAS;AAAA,QACV;AACA,eAAO,iBAAiB,SAAS;AAAA,MAClC,UAAE;AACD,mBAAW,UAAU,OAAQ,QAAS;AAAA,MACvC;AAAA,IACD;AAEA,YAAS,QAAQ,cAAc,YAAa;AAAA,EAC7C;AACD;AAEA,IAAO,wBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/index.js
CHANGED
|
@@ -1,59 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
removeAction: true,
|
|
12
|
-
removeFilter: true,
|
|
13
|
-
hasAction: true,
|
|
14
|
-
hasFilter: true,
|
|
15
|
-
removeAllActions: true,
|
|
16
|
-
removeAllFilters: true,
|
|
17
|
-
doAction: true,
|
|
18
|
-
doActionAsync: true,
|
|
19
|
-
applyFilters: true,
|
|
20
|
-
applyFiltersAsync: true,
|
|
21
|
-
currentAction: true,
|
|
22
|
-
currentFilter: true,
|
|
23
|
-
doingAction: true,
|
|
24
|
-
doingFilter: true,
|
|
25
|
-
didAction: true,
|
|
26
|
-
didFilter: true,
|
|
27
|
-
actions: true,
|
|
28
|
-
filters: true,
|
|
29
|
-
createHooks: true
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
30
11
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
36
17
|
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var index_exports = {};
|
|
31
|
+
__export(index_exports, {
|
|
32
|
+
actions: () => actions,
|
|
33
|
+
addAction: () => addAction,
|
|
34
|
+
addFilter: () => addFilter,
|
|
35
|
+
applyFilters: () => applyFilters,
|
|
36
|
+
applyFiltersAsync: () => applyFiltersAsync,
|
|
37
|
+
createHooks: () => import_createHooks.default,
|
|
38
|
+
currentAction: () => currentAction,
|
|
39
|
+
currentFilter: () => currentFilter,
|
|
40
|
+
defaultHooks: () => defaultHooks,
|
|
41
|
+
didAction: () => didAction,
|
|
42
|
+
didFilter: () => didFilter,
|
|
43
|
+
doAction: () => doAction,
|
|
44
|
+
doActionAsync: () => doActionAsync,
|
|
45
|
+
doingAction: () => doingAction,
|
|
46
|
+
doingFilter: () => doingFilter,
|
|
47
|
+
filters: () => filters,
|
|
48
|
+
hasAction: () => hasAction,
|
|
49
|
+
hasFilter: () => hasFilter,
|
|
50
|
+
removeAction: () => removeAction,
|
|
51
|
+
removeAllActions: () => removeAllActions,
|
|
52
|
+
removeAllFilters: () => removeAllFilters,
|
|
53
|
+
removeFilter: () => removeFilter
|
|
37
54
|
});
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (key === "default" || key === "__esModule") return;
|
|
43
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
44
|
-
if (key in exports && exports[key] === _types[key]) return;
|
|
45
|
-
Object.defineProperty(exports, key, {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
get: function () {
|
|
48
|
-
return _types[key];
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
/**
|
|
53
|
-
* Internal dependencies
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
const defaultHooks = exports.defaultHooks = (0, _createHooks.default)();
|
|
55
|
+
module.exports = __toCommonJS(index_exports);
|
|
56
|
+
var import_createHooks = __toESM(require("./createHooks"));
|
|
57
|
+
__reExport(index_exports, require("./types"), module.exports);
|
|
58
|
+
const defaultHooks = (0, import_createHooks.default)();
|
|
57
59
|
const {
|
|
58
60
|
addAction,
|
|
59
61
|
addFilter,
|
|
@@ -76,24 +78,30 @@ const {
|
|
|
76
78
|
actions,
|
|
77
79
|
filters
|
|
78
80
|
} = defaultHooks;
|
|
79
|
-
|
|
80
|
-
exports
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
81
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
+
0 && (module.exports = {
|
|
83
|
+
actions,
|
|
84
|
+
addAction,
|
|
85
|
+
addFilter,
|
|
86
|
+
applyFilters,
|
|
87
|
+
applyFiltersAsync,
|
|
88
|
+
createHooks,
|
|
89
|
+
currentAction,
|
|
90
|
+
currentFilter,
|
|
91
|
+
defaultHooks,
|
|
92
|
+
didAction,
|
|
93
|
+
didFilter,
|
|
94
|
+
doAction,
|
|
95
|
+
doActionAsync,
|
|
96
|
+
doingAction,
|
|
97
|
+
doingFilter,
|
|
98
|
+
filters,
|
|
99
|
+
hasAction,
|
|
100
|
+
hasFilter,
|
|
101
|
+
removeAction,
|
|
102
|
+
removeAllActions,
|
|
103
|
+
removeAllFilters,
|
|
104
|
+
removeFilter,
|
|
105
|
+
...require("./types")
|
|
106
|
+
});
|
|
107
|
+
//# sourceMappingURL=index.js.map
|