@wordpress/compose 7.33.1 → 7.34.1-next.2f1c7c01b.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/higher-order/compose.js +3 -1
- package/build/higher-order/compose.js.map +1 -1
- package/build/higher-order/if-condition/index.js +3 -1
- package/build/higher-order/if-condition/index.js.map +1 -1
- package/build/higher-order/pipe.js +4 -2
- package/build/higher-order/pipe.js.map +1 -1
- package/build/higher-order/pure/index.js +4 -2
- package/build/higher-order/pure/index.js.map +1 -1
- package/build/higher-order/with-global-events/index.js +4 -3
- package/build/higher-order/with-global-events/index.js.map +2 -2
- package/build/higher-order/with-global-events/listener.js +4 -2
- package/build/higher-order/with-global-events/listener.js.map +1 -1
- package/build/higher-order/with-instance-id/index.js +4 -2
- package/build/higher-order/with-instance-id/index.js.map +1 -1
- package/build/higher-order/with-safe-timeout/index.js +5 -3
- package/build/higher-order/with-safe-timeout/index.js.map +1 -1
- package/build/higher-order/with-state/index.js +3 -1
- package/build/higher-order/with-state/index.js.map +1 -1
- package/build/hooks/use-async-list/index.js +2 -0
- package/build/hooks/use-async-list/index.js.map +1 -1
- package/build/hooks/use-constrained-tabbing/index.js +2 -0
- package/build/hooks/use-constrained-tabbing/index.js.map +1 -1
- package/build/hooks/use-copy-on-click/index.js +2 -0
- package/build/hooks/use-copy-on-click/index.js.map +2 -2
- package/build/hooks/use-copy-to-clipboard/index.js +2 -0
- package/build/hooks/use-copy-to-clipboard/index.js.map +1 -1
- package/build/hooks/use-debounce/index.js +2 -0
- package/build/hooks/use-debounce/index.js.map +1 -1
- package/build/hooks/use-debounced-input/index.js +2 -0
- package/build/hooks/use-debounced-input/index.js.map +1 -1
- package/build/hooks/use-dialog/index.js +2 -0
- package/build/hooks/use-dialog/index.js.map +1 -1
- package/build/hooks/use-disabled/index.js +2 -0
- package/build/hooks/use-disabled/index.js.map +1 -1
- package/build/hooks/use-dragging/index.js +2 -0
- package/build/hooks/use-dragging/index.js.map +1 -1
- package/build/hooks/use-drop-zone/index.js +2 -0
- package/build/hooks/use-drop-zone/index.js.map +1 -1
- package/build/hooks/use-event/index.js +2 -0
- package/build/hooks/use-event/index.js.map +1 -1
- package/build/hooks/use-fixed-window-list/index.js +3 -1
- package/build/hooks/use-fixed-window-list/index.js.map +1 -1
- package/build/hooks/use-focus-on-mount/index.js +2 -0
- package/build/hooks/use-focus-on-mount/index.js.map +1 -1
- package/build/hooks/use-focus-outside/index.js +3 -1
- package/build/hooks/use-focus-outside/index.js.map +1 -1
- package/build/hooks/use-focus-return/index.js +3 -1
- package/build/hooks/use-focus-return/index.js.map +1 -1
- package/build/hooks/use-focusable-iframe/index.js +2 -0
- package/build/hooks/use-focusable-iframe/index.js.map +1 -1
- package/build/hooks/use-instance-id/index.js +3 -1
- package/build/hooks/use-instance-id/index.js.map +1 -1
- package/build/hooks/use-isomorphic-layout-effect/index.js +3 -1
- package/build/hooks/use-isomorphic-layout-effect/index.js.map +1 -1
- package/build/hooks/use-keyboard-shortcut/index.js +3 -4
- package/build/hooks/use-keyboard-shortcut/index.js.map +2 -2
- package/build/hooks/use-media-query/index.js +3 -1
- package/build/hooks/use-media-query/index.js.map +1 -1
- package/build/hooks/use-merge-refs/index.js +2 -0
- package/build/hooks/use-merge-refs/index.js.map +2 -2
- package/build/hooks/use-observable-value/index.js +2 -0
- package/build/hooks/use-observable-value/index.js.map +1 -1
- package/build/hooks/use-previous/index.js +2 -0
- package/build/hooks/use-previous/index.js.map +1 -1
- package/build/hooks/use-reduced-motion/index.js +3 -1
- package/build/hooks/use-reduced-motion/index.js.map +1 -1
- package/build/hooks/use-ref-effect/index.js +2 -0
- package/build/hooks/use-ref-effect/index.js.map +1 -1
- package/build/hooks/use-resize-observer/index.js +2 -0
- package/build/hooks/use-resize-observer/index.js.map +1 -1
- package/build/hooks/use-resize-observer/legacy/index.js +6 -4
- package/build/hooks/use-resize-observer/legacy/index.js.map +1 -1
- package/build/hooks/use-resize-observer/use-resize-observer.js +2 -0
- package/build/hooks/use-resize-observer/use-resize-observer.js.map +1 -1
- package/build/hooks/use-state-with-history/index.js +2 -0
- package/build/hooks/use-state-with-history/index.js.map +1 -1
- package/build/hooks/use-throttle/index.js +2 -0
- package/build/hooks/use-throttle/index.js.map +1 -1
- package/build/hooks/use-viewport-match/index.js +7 -5
- package/build/hooks/use-viewport-match/index.js.map +1 -1
- package/build/hooks/use-warn-on-change/index.js +2 -0
- package/build/hooks/use-warn-on-change/index.js.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/utils/create-higher-order-component/index.js +3 -1
- package/build/utils/create-higher-order-component/index.js.map +1 -1
- package/build/utils/debounce/index.js +3 -1
- package/build/utils/debounce/index.js.map +1 -1
- package/build/utils/observable-map/index.js +2 -0
- package/build/utils/observable-map/index.js.map +1 -1
- package/build/utils/throttle/index.js +3 -1
- package/build/utils/throttle/index.js.map +1 -1
- package/build-module/higher-order/compose.js +2 -1
- package/build-module/higher-order/compose.js.map +1 -1
- package/build-module/higher-order/if-condition/index.js +2 -1
- package/build-module/higher-order/if-condition/index.js.map +1 -1
- package/build-module/higher-order/pipe.js +3 -2
- package/build-module/higher-order/pipe.js.map +1 -1
- package/build-module/higher-order/pure/index.js +3 -2
- package/build-module/higher-order/pure/index.js.map +1 -1
- package/build-module/higher-order/with-global-events/index.js +3 -3
- package/build-module/higher-order/with-global-events/index.js.map +2 -2
- package/build-module/higher-order/with-global-events/listener.js +3 -2
- package/build-module/higher-order/with-global-events/listener.js.map +1 -1
- package/build-module/higher-order/with-instance-id/index.js +3 -2
- package/build-module/higher-order/with-instance-id/index.js.map +1 -1
- package/build-module/higher-order/with-safe-timeout/index.js +3 -2
- package/build-module/higher-order/with-safe-timeout/index.js.map +1 -1
- package/build-module/higher-order/with-state/index.js +2 -1
- package/build-module/higher-order/with-state/index.js.map +1 -1
- package/build-module/hooks/use-async-list/index.js +1 -0
- package/build-module/hooks/use-async-list/index.js.map +1 -1
- package/build-module/hooks/use-constrained-tabbing/index.js +1 -0
- package/build-module/hooks/use-constrained-tabbing/index.js.map +1 -1
- package/build-module/hooks/use-copy-on-click/index.js +1 -0
- package/build-module/hooks/use-copy-on-click/index.js.map +2 -2
- package/build-module/hooks/use-copy-to-clipboard/index.js +1 -0
- package/build-module/hooks/use-copy-to-clipboard/index.js.map +1 -1
- package/build-module/hooks/use-debounce/index.js +1 -0
- package/build-module/hooks/use-debounce/index.js.map +1 -1
- package/build-module/hooks/use-debounced-input/index.js +1 -0
- package/build-module/hooks/use-debounced-input/index.js.map +1 -1
- package/build-module/hooks/use-dialog/index.js +1 -0
- package/build-module/hooks/use-dialog/index.js.map +1 -1
- package/build-module/hooks/use-disabled/index.js +1 -0
- package/build-module/hooks/use-disabled/index.js.map +1 -1
- package/build-module/hooks/use-dragging/index.js +1 -0
- package/build-module/hooks/use-dragging/index.js.map +1 -1
- package/build-module/hooks/use-drop-zone/index.js +1 -0
- package/build-module/hooks/use-drop-zone/index.js.map +1 -1
- package/build-module/hooks/use-event/index.js +1 -0
- package/build-module/hooks/use-event/index.js.map +1 -1
- package/build-module/hooks/use-fixed-window-list/index.js +2 -1
- package/build-module/hooks/use-fixed-window-list/index.js.map +1 -1
- package/build-module/hooks/use-focus-on-mount/index.js +1 -0
- package/build-module/hooks/use-focus-on-mount/index.js.map +1 -1
- package/build-module/hooks/use-focus-outside/index.js +2 -1
- package/build-module/hooks/use-focus-outside/index.js.map +1 -1
- package/build-module/hooks/use-focus-return/index.js +2 -1
- package/build-module/hooks/use-focus-return/index.js.map +1 -1
- package/build-module/hooks/use-focusable-iframe/index.js +1 -0
- package/build-module/hooks/use-focusable-iframe/index.js.map +1 -1
- package/build-module/hooks/use-instance-id/index.js +2 -1
- package/build-module/hooks/use-instance-id/index.js.map +1 -1
- package/build-module/hooks/use-isomorphic-layout-effect/index.js +2 -1
- package/build-module/hooks/use-isomorphic-layout-effect/index.js.map +1 -1
- package/build-module/hooks/use-keyboard-shortcut/index.js +2 -4
- package/build-module/hooks/use-keyboard-shortcut/index.js.map +2 -2
- package/build-module/hooks/use-media-query/index.js +2 -1
- package/build-module/hooks/use-media-query/index.js.map +1 -1
- package/build-module/hooks/use-merge-refs/index.js +1 -0
- package/build-module/hooks/use-merge-refs/index.js.map +2 -2
- package/build-module/hooks/use-observable-value/index.js +1 -0
- package/build-module/hooks/use-observable-value/index.js.map +1 -1
- package/build-module/hooks/use-previous/index.js +1 -0
- package/build-module/hooks/use-previous/index.js.map +1 -1
- package/build-module/hooks/use-reduced-motion/index.js +2 -1
- package/build-module/hooks/use-reduced-motion/index.js.map +1 -1
- package/build-module/hooks/use-ref-effect/index.js +1 -0
- package/build-module/hooks/use-ref-effect/index.js.map +1 -1
- package/build-module/hooks/use-resize-observer/index.js +1 -0
- package/build-module/hooks/use-resize-observer/index.js.map +1 -1
- package/build-module/hooks/use-resize-observer/legacy/index.js +5 -4
- package/build-module/hooks/use-resize-observer/legacy/index.js.map +1 -1
- package/build-module/hooks/use-resize-observer/use-resize-observer.js +1 -0
- package/build-module/hooks/use-resize-observer/use-resize-observer.js.map +1 -1
- package/build-module/hooks/use-state-with-history/index.js +1 -0
- package/build-module/hooks/use-state-with-history/index.js.map +1 -1
- package/build-module/hooks/use-throttle/index.js +1 -0
- package/build-module/hooks/use-throttle/index.js.map +1 -1
- package/build-module/hooks/use-viewport-match/index.js +6 -5
- package/build-module/hooks/use-viewport-match/index.js.map +1 -1
- package/build-module/hooks/use-warn-on-change/index.js +1 -0
- package/build-module/hooks/use-warn-on-change/index.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/utils/create-higher-order-component/index.js +2 -1
- package/build-module/utils/create-higher-order-component/index.js.map +1 -1
- package/build-module/utils/debounce/index.js +2 -1
- package/build-module/utils/debounce/index.js.map +1 -1
- package/build-module/utils/observable-map/index.js +1 -0
- package/build-module/utils/observable-map/index.js.map +1 -1
- package/build-module/utils/throttle/index.js +2 -1
- package/build-module/utils/throttle/index.js.map +1 -1
- package/build-types/higher-order/with-global-events/index.d.ts.map +1 -1
- package/build-types/hooks/use-copy-on-click/index.d.ts.map +1 -1
- package/build-types/hooks/use-keyboard-shortcut/index.d.ts.map +1 -1
- package/build-types/hooks/use-merge-refs/index.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/higher-order/with-global-events/index.js +0 -2
- package/src/hooks/use-copy-on-click/index.js +0 -2
- package/src/hooks/use-focus-outside/index.native.js +0 -3
- package/src/hooks/use-keyboard-shortcut/index.js +1 -6
- package/src/hooks/use-merge-refs/index.js +0 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/build/hooks/use-preferred-color-scheme/index.android.js +0 -41
- package/build/hooks/use-preferred-color-scheme/index.android.js.map +0 -7
- package/build/hooks/use-preferred-color-scheme/index.ios.js +0 -27
- package/build/hooks/use-preferred-color-scheme/index.ios.js.map +0 -7
- package/build-module/hooks/use-preferred-color-scheme/index.android.js +0 -24
- package/build-module/hooks/use-preferred-color-scheme/index.android.js.map +0 -7
- package/build-module/hooks/use-preferred-color-scheme/index.ios.js +0 -7
- package/build-module/hooks/use-preferred-color-scheme/index.ios.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -16,12 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/compose/src/higher-order/compose.ts
|
|
19
21
|
var compose_exports = {};
|
|
20
22
|
__export(compose_exports, {
|
|
21
23
|
default: () => compose_default
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(compose_exports);
|
|
24
26
|
var import_pipe = require("./pipe");
|
|
25
|
-
|
|
27
|
+
var compose = (0, import_pipe.basePipe)(true);
|
|
26
28
|
var compose_default = compose;
|
|
27
29
|
//# sourceMappingURL=compose.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/higher-order/compose.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { basePipe } from './pipe';\n\n/**\n * Composes multiple higher-order components into a single higher-order component. Performs right-to-left function\n * composition, where each successive invocation is supplied the return value of the previous.\n *\n * This is inspired by `lodash`'s `flowRight` function.\n *\n * @see https://lodash.com/docs/4#flow-right\n */\nconst compose = basePipe( true );\n\nexport default compose;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAyB;AAUzB,IAAM,cAAU,sBAAU,IAAK;AAE/B,IAAO,kBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -16,13 +16,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/compose/src/higher-order/if-condition/index.tsx
|
|
19
21
|
var if_condition_exports = {};
|
|
20
22
|
__export(if_condition_exports, {
|
|
21
23
|
default: () => if_condition_default
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(if_condition_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
26
|
var import_create_higher_order_component = require("../../utils/create-higher-order-component");
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
28
|
function ifCondition(predicate) {
|
|
27
29
|
return (0, import_create_higher_order_component.createHigherOrderComponent)(
|
|
28
30
|
(WrappedComponent) => (props) => {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/higher-order/if-condition/index.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { ComponentType } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { createHigherOrderComponent } from '../../utils/create-higher-order-component';\n\n/**\n * Higher-order component creator, creating a new component which renders if\n * the given condition is satisfied or with the given optional prop name.\n *\n * @example\n * ```ts\n * type Props = { foo: string };\n * const Component = ( props: Props ) => <div>{ props.foo }</div>;\n * const ConditionalComponent = ifCondition( ( props: Props ) => props.foo.length !== 0 )( Component );\n * <ConditionalComponent foo=\"\" />; // => null\n * <ConditionalComponent foo=\"bar\" />; // => <div>bar</div>;\n * ```\n *\n * @param predicate Function to test condition.\n *\n * @return Higher-order component.\n */\nfunction ifCondition< Props extends {} >(\n\tpredicate: ( props: Props ) => boolean\n) {\n\treturn createHigherOrderComponent(\n\t\t( WrappedComponent: ComponentType< Props > ) => ( props: Props ) => {\n\t\t\tif ( ! predicate( props ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn <WrappedComponent { ...props } />;\n\t\t},\n\t\t'ifCondition'\n\t);\n}\n\nexport default ifCondition;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,2CAA2C;AA4BjC;AATV,SAAS,YACR,WACC;AACD,aAAO;AAAA,IACN,CAAE,qBAA8C,CAAE,UAAkB;AACnE,UAAK,CAAE,UAAW,KAAM,GAAI;AAC3B,eAAO;AAAA,MACR;AAEA,aAAO,4CAAC,oBAAmB,GAAG,OAAQ;AAAA,IACvC;AAAA,IACA;AAAA,EACD;AACD;AAEA,IAAO,uBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -16,13 +16,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/compose/src/higher-order/pipe.ts
|
|
19
21
|
var pipe_exports = {};
|
|
20
22
|
__export(pipe_exports, {
|
|
21
23
|
basePipe: () => basePipe,
|
|
22
24
|
default: () => pipe_default
|
|
23
25
|
});
|
|
24
26
|
module.exports = __toCommonJS(pipe_exports);
|
|
25
|
-
|
|
27
|
+
var basePipe = (reverse = false) => (...funcs) => (...args) => {
|
|
26
28
|
const functions = funcs.flat();
|
|
27
29
|
if (reverse) {
|
|
28
30
|
functions.reverse();
|
|
@@ -32,7 +34,7 @@ const basePipe = (reverse = false) => (...funcs) => (...args) => {
|
|
|
32
34
|
args
|
|
33
35
|
)[0];
|
|
34
36
|
};
|
|
35
|
-
|
|
37
|
+
var pipe = basePipe();
|
|
36
38
|
var pipe_default = pipe;
|
|
37
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
38
40
|
0 && (module.exports = {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/higher-order/pipe.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Parts of this source were derived and modified from lodash,\n * released under the MIT license.\n *\n * https://github.com/lodash/lodash\n *\n * Copyright JS Foundation and other contributors <https://js.foundation/>\n *\n * Based on Underscore.js, copyright Jeremy Ashkenas,\n * DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>\n *\n * This software consists of voluntary contributions made by many\n * individuals. For exact contribution history, see the revision history\n * available at https://github.com/lodash/lodash\n *\n * The following license applies to all parts of this software except as\n * documented below:\n *\n * ====\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * Creates a pipe function.\n *\n * Allows to choose whether to perform left-to-right or right-to-left composition.\n *\n * @see https://lodash.com/docs/4#flow\n *\n * @param {boolean} reverse True if right-to-left, false for left-to-right composition.\n */\nconst basePipe =\n\t( reverse: boolean = false ) =>\n\t( ...funcs: Function[] ) =>\n\t( ...args: unknown[] ) => {\n\t\tconst functions = funcs.flat();\n\t\tif ( reverse ) {\n\t\t\tfunctions.reverse();\n\t\t}\n\t\treturn functions.reduce(\n\t\t\t( prev, func ) => [ func( ...prev ) ],\n\t\t\targs\n\t\t)[ 0 ];\n\t};\n\n/**\n * Composes multiple higher-order components into a single higher-order component. Performs left-to-right function\n * composition, where each successive invocation is supplied the return value of the previous.\n *\n * This is inspired by `lodash`'s `flow` function.\n *\n * @see https://lodash.com/docs/4#flow\n */\nconst pipe = basePipe();\n\nexport { basePipe };\n\nexport default pipe;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiDA,IAAM,WACL,CAAE,UAAmB,UACrB,IAAK,UACL,IAAK,SAAqB;AACzB,QAAM,YAAY,MAAM,KAAK;AAC7B,MAAK,SAAU;AACd,cAAU,QAAQ;AAAA,EACnB;AACA,SAAO,UAAU;AAAA,IAChB,CAAE,MAAM,SAAU,CAAE,KAAM,GAAG,IAAK,CAAE;AAAA,IACpC;AAAA,EACD,EAAG,CAAE;AACN;AAUD,IAAM,OAAO,SAAS;AAItB,IAAO,eAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -26,16 +26,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/compose/src/higher-order/pure/index.tsx
|
|
29
31
|
var pure_exports = {};
|
|
30
32
|
__export(pure_exports, {
|
|
31
33
|
default: () => pure_default
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(pure_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_is_shallow_equal = __toESM(require("@wordpress/is-shallow-equal"));
|
|
36
37
|
var import_element = require("@wordpress/element");
|
|
37
38
|
var import_create_higher_order_component = require("../../utils/create-higher-order-component");
|
|
38
|
-
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
var pure = (0, import_create_higher_order_component.createHigherOrderComponent)(function(WrappedComponent) {
|
|
39
41
|
if (WrappedComponent.prototype instanceof import_element.Component) {
|
|
40
42
|
return class extends WrappedComponent {
|
|
41
43
|
shouldComponentUpdate(nextProps, nextState) {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/higher-order/pure/index.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { ComponentType, ComponentClass } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport isShallowEqual from '@wordpress/is-shallow-equal';\nimport { Component } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { createHigherOrderComponent } from '../../utils/create-higher-order-component';\n\n/**\n * Given a component returns the enhanced component augmented with a component\n * only re-rendering when its props/state change\n *\n * @deprecated Use `memo` or `PureComponent` instead.\n */\nconst pure = createHigherOrderComponent( function < Props extends {} >(\n\tWrappedComponent: ComponentType< Props >\n): ComponentType< Props > {\n\tif ( WrappedComponent.prototype instanceof Component ) {\n\t\treturn class extends ( WrappedComponent as ComponentClass< Props > ) {\n\t\t\tshouldComponentUpdate( nextProps: Props, nextState: any ) {\n\t\t\t\treturn (\n\t\t\t\t\t! isShallowEqual( nextProps, this.props ) ||\n\t\t\t\t\t! isShallowEqual( nextState, this.state )\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\t}\n\n\treturn class extends Component< Props > {\n\t\tshouldComponentUpdate( nextProps: Props ) {\n\t\t\treturn ! isShallowEqual( nextProps, this.props );\n\t\t}\n\n\t\trender() {\n\t\t\treturn <WrappedComponent { ...this.props } />;\n\t\t}\n\t};\n}, 'pure' );\n\nexport default pure;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,8BAA2B;AAC3B,qBAA0B;AAK1B,2CAA2C;AA4BjC;AApBV,IAAM,WAAO,iEAA4B,SACxC,kBACyB;AACzB,MAAK,iBAAiB,qBAAqB,0BAAY;AACtD,WAAO,cAAgB,iBAA8C;AAAA,MACpE,sBAAuB,WAAkB,WAAiB;AACzD,eACC,KAAE,wBAAAA,SAAgB,WAAW,KAAK,KAAM,KACxC,KAAE,wBAAAA,SAAgB,WAAW,KAAK,KAAM;AAAA,MAE1C;AAAA,IACD;AAAA,EACD;AAEA,SAAO,cAAc,yBAAmB;AAAA,IACvC,sBAAuB,WAAmB;AACzC,aAAO,KAAE,wBAAAA,SAAgB,WAAW,KAAK,KAAM;AAAA,IAChD;AAAA,IAEA,SAAS;AACR,aAAO,4CAAC,oBAAmB,GAAG,KAAK,OAAQ;AAAA,IAC5C;AAAA,EACD;AACD,GAAG,MAAO;AAEV,IAAO,eAAQ;",
|
|
6
6
|
"names": ["isShallowEqual"]
|
|
7
7
|
}
|
|
@@ -26,17 +26,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/compose/src/higher-order/with-global-events/index.js
|
|
29
31
|
var with_global_events_exports = {};
|
|
30
32
|
__export(with_global_events_exports, {
|
|
31
33
|
default: () => withGlobalEvents
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(with_global_events_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_element = require("@wordpress/element");
|
|
36
37
|
var import_deprecated = __toESM(require("@wordpress/deprecated"));
|
|
37
38
|
var import_create_higher_order_component = require("../../utils/create-higher-order-component");
|
|
38
39
|
var import_listener = __toESM(require("./listener"));
|
|
39
|
-
|
|
40
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
|
+
var listener = new import_listener.default();
|
|
40
42
|
function withGlobalEvents(eventTypesToHandlers) {
|
|
41
43
|
(0, import_deprecated.default)("wp.compose.withGlobalEvents", {
|
|
42
44
|
since: "5.7",
|
|
@@ -63,7 +65,6 @@ function withGlobalEvents(eventTypesToHandlers) {
|
|
|
63
65
|
const handler = eventTypesToHandlers[
|
|
64
66
|
/** @type {keyof GlobalEventHandlersEventMap} */
|
|
65
67
|
event.type
|
|
66
|
-
/* eslint-enable jsdoc/no-undefined-types */
|
|
67
68
|
];
|
|
68
69
|
if (typeof this.wrappedRef[handler] === "function") {
|
|
69
70
|
this.wrappedRef[handler](event);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/higher-order/with-global-events/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Component, forwardRef } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { createHigherOrderComponent } from '../../utils/create-higher-order-component';\nimport Listener from './listener';\n\n/**\n * Listener instance responsible for managing document event handling.\n */\nconst listener = new Listener();\n\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Component, forwardRef } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { createHigherOrderComponent } from '../../utils/create-higher-order-component';\nimport Listener from './listener';\n\n/**\n * Listener instance responsible for managing document event handling.\n */\nconst listener = new Listener();\n\n/**\n * Higher-order component creator which, given an object of DOM event types and\n * values corresponding to a callback function name on the component, will\n * create or update a window event handler to invoke the callback when an event\n * occurs. On behalf of the consuming developer, the higher-order component\n * manages unbinding when the component unmounts, and binding at most a single\n * event handler for the entire application.\n *\n * @deprecated\n *\n * @param {Record<keyof GlobalEventHandlersEventMap, string>} eventTypesToHandlers Object with keys of DOM\n * event type, the value a\n * name of the function on\n * the original component's\n * instance which handles\n * the event.\n *\n * @return {any} Higher-order component.\n */\nexport default function withGlobalEvents( eventTypesToHandlers ) {\n\tdeprecated( 'wp.compose.withGlobalEvents', {\n\t\tsince: '5.7',\n\t\talternative: 'useEffect',\n\t} );\n\n\t// @ts-ignore We don't need to fix the type-related issues because this is deprecated.\n\treturn createHigherOrderComponent( ( WrappedComponent ) => {\n\t\tclass Wrapper extends Component {\n\t\t\tconstructor( /** @type {any} */ props ) {\n\t\t\t\tsuper( props );\n\n\t\t\t\tthis.handleEvent = this.handleEvent.bind( this );\n\t\t\t\tthis.handleRef = this.handleRef.bind( this );\n\t\t\t}\n\n\t\t\tcomponentDidMount() {\n\t\t\t\tObject.keys( eventTypesToHandlers ).forEach( ( eventType ) => {\n\t\t\t\t\tlistener.add( eventType, this );\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcomponentWillUnmount() {\n\t\t\t\tObject.keys( eventTypesToHandlers ).forEach( ( eventType ) => {\n\t\t\t\t\tlistener.remove( eventType, this );\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\thandleEvent( /** @type {any} */ event ) {\n\t\t\t\tconst handler =\n\t\t\t\t\teventTypesToHandlers[\n\t\t\t\t\t\t/** @type {keyof GlobalEventHandlersEventMap} */ (\n\t\t\t\t\t\t\tevent.type\n\t\t\t\t\t\t)\n\t\t\t\t\t];\n\t\t\t\tif ( typeof this.wrappedRef[ handler ] === 'function' ) {\n\t\t\t\t\tthis.wrappedRef[ handler ]( event );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thandleRef( /** @type {any} */ el ) {\n\t\t\t\tthis.wrappedRef = el;\n\t\t\t\t// Any component using `withGlobalEvents` that is not setting a `ref`\n\t\t\t\t// will cause `this.props.forwardedRef` to be `null`, so we need this\n\t\t\t\t// check.\n\t\t\t\tif ( this.props.forwardedRef ) {\n\t\t\t\t\tthis.props.forwardedRef( el );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trender() {\n\t\t\t\treturn (\n\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t{ ...this.props.ownProps }\n\t\t\t\t\t\tref={ this.handleRef }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn forwardRef( ( props, ref ) => {\n\t\t\treturn <Wrapper ownProps={ props } forwardedRef={ ref } />;\n\t\t} );\n\t}, 'withGlobalEvents' );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAsC;AACtC,wBAAuB;AAKvB,2CAA2C;AAC3C,sBAAqB;AA8EhB;AAzEL,IAAM,WAAW,IAAI,gBAAAA,QAAS;AAqBf,SAAR,iBAAmC,sBAAuB;AAChE,wBAAAC,SAAY,+BAA+B;AAAA,IAC1C,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAGF,aAAO,iEAA4B,CAAE,qBAAsB;AAAA,IAC1D,MAAM,gBAAgB,yBAAU;AAAA,MAC/B,YAAgC,OAAQ;AACvC,cAAO,KAAM;AAEb,aAAK,cAAc,KAAK,YAAY,KAAM,IAAK;AAC/C,aAAK,YAAY,KAAK,UAAU,KAAM,IAAK;AAAA,MAC5C;AAAA,MAEA,oBAAoB;AACnB,eAAO,KAAM,oBAAqB,EAAE,QAAS,CAAE,cAAe;AAC7D,mBAAS,IAAK,WAAW,IAAK;AAAA,QAC/B,CAAE;AAAA,MACH;AAAA,MAEA,uBAAuB;AACtB,eAAO,KAAM,oBAAqB,EAAE,QAAS,CAAE,cAAe;AAC7D,mBAAS,OAAQ,WAAW,IAAK;AAAA,QAClC,CAAE;AAAA,MACH;AAAA,MAEA,YAAgC,OAAQ;AACvC,cAAM,UACL;AAAA;AAAA,UAEE,MAAM;AAAA,QAER;AACD,YAAK,OAAO,KAAK,WAAY,OAAQ,MAAM,YAAa;AACvD,eAAK,WAAY,OAAQ,EAAG,KAAM;AAAA,QACnC;AAAA,MACD;AAAA,MAEA,UAA8B,IAAK;AAClC,aAAK,aAAa;AAIlB,YAAK,KAAK,MAAM,cAAe;AAC9B,eAAK,MAAM,aAAc,EAAG;AAAA,QAC7B;AAAA,MACD;AAAA,MAEA,SAAS;AACR,eACC;AAAA,UAAC;AAAA;AAAA,YACE,GAAG,KAAK,MAAM;AAAA,YAChB,KAAM,KAAK;AAAA;AAAA,QACZ;AAAA,MAEF;AAAA,IACD;AAEA,eAAO,2BAAY,CAAE,OAAO,QAAS;AACpC,aAAO,4CAAC,WAAQ,UAAW,OAAQ,cAAe,KAAM;AAAA,IACzD,CAAE;AAAA,EACH,GAAG,kBAAmB;AACvB;",
|
|
6
6
|
"names": ["Listener", "deprecated"]
|
|
7
7
|
}
|
|
@@ -16,12 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/compose/src/higher-order/with-global-events/listener.js
|
|
19
21
|
var listener_exports = {};
|
|
20
22
|
__export(listener_exports, {
|
|
21
23
|
default: () => listener_default
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(listener_exports);
|
|
24
|
-
|
|
26
|
+
var Listener = class {
|
|
25
27
|
constructor() {
|
|
26
28
|
this.listeners = {};
|
|
27
29
|
this.handleEvent = this.handleEvent.bind(this);
|
|
@@ -52,6 +54,6 @@ class Listener {
|
|
|
52
54
|
}
|
|
53
55
|
);
|
|
54
56
|
}
|
|
55
|
-
}
|
|
57
|
+
};
|
|
56
58
|
var listener_default = Listener;
|
|
57
59
|
//# sourceMappingURL=listener.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/higher-order/with-global-events/listener.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * Class responsible for orchestrating event handling on the global window,\n * binding a single event to be shared across all handling instances, and\n * removing the handler when no instances are listening for the event.\n */\nclass Listener {\n\tconstructor() {\n\t\t/** @type {any} */\n\t\tthis.listeners = {};\n\n\t\tthis.handleEvent = this.handleEvent.bind( this );\n\t}\n\n\tadd( /** @type {any} */ eventType, /** @type {any} */ instance ) {\n\t\tif ( ! this.listeners[ eventType ] ) {\n\t\t\t// Adding first listener for this type, so bind event.\n\t\t\twindow.addEventListener( eventType, this.handleEvent );\n\t\t\tthis.listeners[ eventType ] = [];\n\t\t}\n\n\t\tthis.listeners[ eventType ].push( instance );\n\t}\n\n\tremove( /** @type {any} */ eventType, /** @type {any} */ instance ) {\n\t\tif ( ! this.listeners[ eventType ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.listeners[ eventType ] = this.listeners[ eventType ].filter(\n\t\t\t( /** @type {any} */ listener ) => listener !== instance\n\t\t);\n\n\t\tif ( ! this.listeners[ eventType ].length ) {\n\t\t\t// Removing last listener for this type, so unbind event.\n\t\t\twindow.removeEventListener( eventType, this.handleEvent );\n\t\t\tdelete this.listeners[ eventType ];\n\t\t}\n\t}\n\n\thandleEvent( /** @type {any} */ event ) {\n\t\tthis.listeners[ event.type ]?.forEach(\n\t\t\t( /** @type {any} */ instance ) => {\n\t\t\t\tinstance.handleEvent( event );\n\t\t\t}\n\t\t);\n\t}\n}\n\nexport default Listener;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,IAAM,WAAN,MAAe;AAAA,EACd,cAAc;AAEb,SAAK,YAAY,CAAC;AAElB,SAAK,cAAc,KAAK,YAAY,KAAM,IAAK;AAAA,EAChD;AAAA,EAEA,IAAwB,WAA8B,UAAW;AAChE,QAAK,CAAE,KAAK,UAAW,SAAU,GAAI;AAEpC,aAAO,iBAAkB,WAAW,KAAK,WAAY;AACrD,WAAK,UAAW,SAAU,IAAI,CAAC;AAAA,IAChC;AAEA,SAAK,UAAW,SAAU,EAAE,KAAM,QAAS;AAAA,EAC5C;AAAA,EAEA,OAA2B,WAA8B,UAAW;AACnE,QAAK,CAAE,KAAK,UAAW,SAAU,GAAI;AACpC;AAAA,IACD;AAEA,SAAK,UAAW,SAAU,IAAI,KAAK,UAAW,SAAU,EAAE;AAAA,MACzD,CAAqB,aAAc,aAAa;AAAA,IACjD;AAEA,QAAK,CAAE,KAAK,UAAW,SAAU,EAAE,QAAS;AAE3C,aAAO,oBAAqB,WAAW,KAAK,WAAY;AACxD,aAAO,KAAK,UAAW,SAAU;AAAA,IAClC;AAAA,EACD;AAAA,EAEA,YAAgC,OAAQ;AACvC,SAAK,UAAW,MAAM,IAAK,GAAG;AAAA,MAC7B,CAAqB,aAAc;AAClC,iBAAS,YAAa,KAAM;AAAA,MAC7B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,mBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -26,15 +26,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/compose/src/higher-order/with-instance-id/index.tsx
|
|
29
31
|
var with_instance_id_exports = {};
|
|
30
32
|
__export(with_instance_id_exports, {
|
|
31
33
|
default: () => with_instance_id_default
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(with_instance_id_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_create_higher_order_component = require("../../utils/create-higher-order-component");
|
|
36
37
|
var import_use_instance_id = __toESM(require("../../hooks/use-instance-id"));
|
|
37
|
-
|
|
38
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
|
+
var withInstanceId = (0, import_create_higher_order_component.createHigherOrderComponent)(
|
|
38
40
|
(WrappedComponent) => {
|
|
39
41
|
return (props) => {
|
|
40
42
|
const instanceId = (0, import_use_instance_id.default)(WrappedComponent);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/higher-order/with-instance-id/index.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type {\n\tWithInjectedProps,\n\tWithoutInjectedProps,\n} from '../../utils/create-higher-order-component';\nimport { createHigherOrderComponent } from '../../utils/create-higher-order-component';\nimport useInstanceId from '../../hooks/use-instance-id';\n\ntype InstanceIdProps = { instanceId: string | number };\n\n/**\n * A Higher Order Component used to provide a unique instance ID by component.\n */\nconst withInstanceId = createHigherOrderComponent(\n\t< C extends WithInjectedProps< C, InstanceIdProps > >(\n\t\tWrappedComponent: C\n\t) => {\n\t\treturn ( props: WithoutInjectedProps< C, InstanceIdProps > ) => {\n\t\t\tconst instanceId = useInstanceId( WrappedComponent );\n\t\t\t// @ts-ignore\n\t\t\treturn <WrappedComponent { ...props } instanceId={ instanceId } />;\n\t\t};\n\t},\n\t'instanceId'\n);\n\nexport default withInstanceId;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,2CAA2C;AAC3C,6BAA0B;AAchB;AAPV,IAAM,qBAAiB;AAAA,EACtB,CACC,qBACI;AACJ,WAAO,CAAE,UAAuD;AAC/D,YAAM,iBAAa,uBAAAA,SAAe,gBAAiB;AAEnD,aAAO,4CAAC,oBAAmB,GAAG,OAAQ,YAA0B;AAAA,IACjE;AAAA,EACD;AAAA,EACA;AACD;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": ["useInstanceId"]
|
|
7
7
|
}
|
|
@@ -16,18 +16,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/compose/src/higher-order/with-safe-timeout/index.tsx
|
|
19
21
|
var with_safe_timeout_exports = {};
|
|
20
22
|
__export(with_safe_timeout_exports, {
|
|
21
23
|
default: () => with_safe_timeout_default
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(with_safe_timeout_exports);
|
|
26
|
+
var import_element = require("@wordpress/element");
|
|
27
|
+
var import_create_higher_order_component = require("../../utils/create-higher-order-component");
|
|
24
28
|
var import_jsx_runtime = (
|
|
25
29
|
// @ts-ignore
|
|
26
30
|
require("react/jsx-runtime")
|
|
27
31
|
);
|
|
28
|
-
var
|
|
29
|
-
var import_create_higher_order_component = require("../../utils/create-higher-order-component");
|
|
30
|
-
const withSafeTimeout = (0, import_create_higher_order_component.createHigherOrderComponent)(
|
|
32
|
+
var withSafeTimeout = (0, import_create_higher_order_component.createHigherOrderComponent)(
|
|
31
33
|
(OriginalComponent) => {
|
|
32
34
|
return class WrappedComponent extends import_element.Component {
|
|
33
35
|
timeouts;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/higher-order/with-safe-timeout/index.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tWithInjectedProps,\n\tWithoutInjectedProps,\n} from '../../utils/create-higher-order-component';\nimport { createHigherOrderComponent } from '../../utils/create-higher-order-component';\n\n/**\n * We cannot use the `Window['setTimeout']` and `Window['clearTimeout']`\n * types here because those functions include functionality that is not handled\n * by this component, like the ability to pass extra arguments.\n *\n * In the case of this component, we only handle the simplest case where\n * `setTimeout` only accepts a function (not a string) and an optional delay.\n */\ninterface TimeoutProps {\n\tsetTimeout: ( fn: () => void, delay: number ) => number;\n\tclearTimeout: ( id: number ) => void;\n}\n\n/**\n * A higher-order component used to provide and manage delayed function calls\n * that ought to be bound to a component's lifecycle.\n */\nconst withSafeTimeout = createHigherOrderComponent(\n\t< C extends WithInjectedProps< C, TimeoutProps > >(\n\t\tOriginalComponent: C\n\t) => {\n\t\ttype WrappedProps = WithoutInjectedProps< C, TimeoutProps >;\n\t\treturn class WrappedComponent extends Component< WrappedProps > {\n\t\t\ttimeouts: number[];\n\n\t\t\tconstructor( props: WrappedProps ) {\n\t\t\t\tsuper( props );\n\t\t\t\tthis.timeouts = [];\n\t\t\t\tthis.setTimeout = this.setTimeout.bind( this );\n\t\t\t\tthis.clearTimeout = this.clearTimeout.bind( this );\n\t\t\t}\n\n\t\t\tcomponentWillUnmount() {\n\t\t\t\tthis.timeouts.forEach( clearTimeout );\n\t\t\t}\n\n\t\t\tsetTimeout( fn: () => void, delay: number ) {\n\t\t\t\tconst id = setTimeout( () => {\n\t\t\t\t\tfn();\n\t\t\t\t\tthis.clearTimeout( id );\n\t\t\t\t}, delay );\n\t\t\t\tthis.timeouts.push( id );\n\t\t\t\treturn id;\n\t\t\t}\n\n\t\t\tclearTimeout( id: number ) {\n\t\t\t\tclearTimeout( id );\n\t\t\t\tthis.timeouts = this.timeouts.filter(\n\t\t\t\t\t( timeoutId ) => timeoutId !== id\n\t\t\t\t);\n\t\t\t}\n\n\t\t\trender() {\n\t\t\t\treturn (\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t<OriginalComponent\n\t\t\t\t\t\t{ ...this.props }\n\t\t\t\t\t\tsetTimeout={ this.setTimeout }\n\t\t\t\t\t\tclearTimeout={ this.clearTimeout }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\t},\n\t'withSafeTimeout'\n);\n\nexport default withSafeTimeout;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA0B;AAS1B,2CAA2C;AAyDtC;AAAA;AAAA;AAAA;AAtCL,IAAM,sBAAkB;AAAA,EACvB,CACC,sBACI;AAEJ,WAAO,MAAM,yBAAyB,yBAA0B;AAAA,MAC/D;AAAA,MAEA,YAAa,OAAsB;AAClC,cAAO,KAAM;AACb,aAAK,WAAW,CAAC;AACjB,aAAK,aAAa,KAAK,WAAW,KAAM,IAAK;AAC7C,aAAK,eAAe,KAAK,aAAa,KAAM,IAAK;AAAA,MAClD;AAAA,MAEA,uBAAuB;AACtB,aAAK,SAAS,QAAS,YAAa;AAAA,MACrC;AAAA,MAEA,WAAY,IAAgB,OAAgB;AAC3C,cAAM,KAAK,WAAY,MAAM;AAC5B,aAAG;AACH,eAAK,aAAc,EAAG;AAAA,QACvB,GAAG,KAAM;AACT,aAAK,SAAS,KAAM,EAAG;AACvB,eAAO;AAAA,MACR;AAAA,MAEA,aAAc,IAAa;AAC1B,qBAAc,EAAG;AACjB,aAAK,WAAW,KAAK,SAAS;AAAA,UAC7B,CAAE,cAAe,cAAc;AAAA,QAChC;AAAA,MACD;AAAA,MAEA,SAAS;AACR,eAEC;AAAA,UAAC;AAAA;AAAA,YACE,GAAG,KAAK;AAAA,YACV,YAAa,KAAK;AAAA,YAClB,cAAe,KAAK;AAAA;AAAA,QACrB;AAAA,MAEF;AAAA,IACD;AAAA,EACD;AAAA,EACA;AACD;AAEA,IAAO,4BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -26,15 +26,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/compose/src/higher-order/with-state/index.js
|
|
29
31
|
var with_state_exports = {};
|
|
30
32
|
__export(with_state_exports, {
|
|
31
33
|
default: () => withState
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(with_state_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_element = require("@wordpress/element");
|
|
36
37
|
var import_deprecated = __toESM(require("@wordpress/deprecated"));
|
|
37
38
|
var import_create_higher_order_component = require("../../utils/create-higher-order-component");
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
40
|
function withState(initialState = {}) {
|
|
39
41
|
(0, import_deprecated.default)("wp.compose.withState", {
|
|
40
42
|
since: "5.8",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/higher-order/with-state/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { createHigherOrderComponent } from '../../utils/create-higher-order-component';\n\n/**\n * A Higher Order Component used to provide and manage internal component state\n * via props.\n *\n * @deprecated Use `useState` instead.\n *\n * @param {any} initialState Optional initial state of the component.\n *\n * @return {any} A higher order component wrapper accepting a component that takes the state props + its own props + `setState` and returning a component that only accepts the own props.\n */\nexport default function withState( initialState = {} ) {\n\tdeprecated( 'wp.compose.withState', {\n\t\tsince: '5.8',\n\t\talternative: 'wp.element.useState',\n\t} );\n\n\treturn createHigherOrderComponent( ( OriginalComponent ) => {\n\t\treturn class WrappedComponent extends Component {\n\t\t\tconstructor( /** @type {any} */ props ) {\n\t\t\t\tsuper( props );\n\n\t\t\t\tthis.setState = this.setState.bind( this );\n\n\t\t\t\tthis.state = initialState;\n\t\t\t}\n\n\t\t\trender() {\n\t\t\t\treturn (\n\t\t\t\t\t<OriginalComponent\n\t\t\t\t\t\t{ ...this.props }\n\t\t\t\t\t\t{ ...this.state }\n\t\t\t\t\t\tsetState={ this.setState }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\t}, 'withState' );\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA0B;AAC1B,wBAAuB;AAKvB,2CAA2C;AA8BtC;AAlBU,SAAR,UAA4B,eAAe,CAAC,GAAI;AACtD,wBAAAA,SAAY,wBAAwB;AAAA,IACnC,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAEF,aAAO,iEAA4B,CAAE,sBAAuB;AAC3D,WAAO,MAAM,yBAAyB,yBAAU;AAAA,MAC/C,YAAgC,OAAQ;AACvC,cAAO,KAAM;AAEb,aAAK,WAAW,KAAK,SAAS,KAAM,IAAK;AAEzC,aAAK,QAAQ;AAAA,MACd;AAAA,MAEA,SAAS;AACR,eACC;AAAA,UAAC;AAAA;AAAA,YACE,GAAG,KAAK;AAAA,YACR,GAAG,KAAK;AAAA,YACV,UAAW,KAAK;AAAA;AAAA,QACjB;AAAA,MAEF;AAAA,IACD;AAAA,EACD,GAAG,WAAY;AAChB;",
|
|
6
6
|
"names": ["deprecated"]
|
|
7
7
|
}
|
|
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/compose/src/hooks/use-async-list/index.ts
|
|
19
21
|
var use_async_list_exports = {};
|
|
20
22
|
__export(use_async_list_exports, {
|
|
21
23
|
default: () => use_async_list_default
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/use-async-list/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { flushSync, useEffect, useState } from '@wordpress/element';\nimport { createQueue } from '@wordpress/priority-queue';\n\ntype AsyncListConfig = {\n\tstep: number;\n};\n\n/**\n * Returns the first items from list that are present on state.\n *\n * @param list New array.\n * @param state Current state.\n * @return First items present in state.\n */\nfunction getFirstItemsPresentInState< T >( list: T[], state: T[] ): T[] {\n\tconst firstItems = [];\n\n\tfor ( let i = 0; i < list.length; i++ ) {\n\t\tconst item = list[ i ];\n\t\tif ( ! state.includes( item ) ) {\n\t\t\tbreak;\n\t\t}\n\n\t\tfirstItems.push( item );\n\t}\n\n\treturn firstItems;\n}\n\n/**\n * React hook returns an array which items get asynchronously appended from a source array.\n * This behavior is useful if we want to render a list of items asynchronously for performance reasons.\n *\n * @param list Source array.\n * @param config Configuration object.\n *\n * @return Async array.\n */\nfunction useAsyncList< T >(\n\tlist: T[],\n\tconfig: AsyncListConfig = { step: 1 }\n): T[] {\n\tconst { step = 1 } = config;\n\tconst [ current, setCurrent ] = useState< T[] >( [] );\n\n\tuseEffect( () => {\n\t\t// On reset, we keep the first items that were previously rendered.\n\t\tlet firstItems = getFirstItemsPresentInState( list, current );\n\t\tif ( firstItems.length < step ) {\n\t\t\tfirstItems = firstItems.concat(\n\t\t\t\tlist.slice( firstItems.length, step )\n\t\t\t);\n\t\t}\n\t\tsetCurrent( firstItems );\n\n\t\tconst asyncQueue = createQueue();\n\t\tfor ( let i = firstItems.length; i < list.length; i += step ) {\n\t\t\tasyncQueue.add( {}, () => {\n\t\t\t\tflushSync( () => {\n\t\t\t\t\tsetCurrent( ( state ) => [\n\t\t\t\t\t\t...state,\n\t\t\t\t\t\t...list.slice( i, i + step ),\n\t\t\t\t\t] );\n\t\t\t\t} );\n\t\t\t} );\n\t\t}\n\n\t\treturn () => asyncQueue.reset();\n\t}, [ list ] );\n\n\treturn current;\n}\n\nexport default useAsyncList;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA+C;AAC/C,4BAA4B;AAa5B,SAAS,4BAAkC,MAAW,OAAkB;AACvE,QAAM,aAAa,CAAC;AAEpB,WAAU,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAM;AACvC,UAAM,OAAO,KAAM,CAAE;AACrB,QAAK,CAAE,MAAM,SAAU,IAAK,GAAI;AAC/B;AAAA,IACD;AAEA,eAAW,KAAM,IAAK;AAAA,EACvB;AAEA,SAAO;AACR;AAWA,SAAS,aACR,MACA,SAA0B,EAAE,MAAM,EAAE,GAC9B;AACN,QAAM,EAAE,OAAO,EAAE,IAAI;AACrB,QAAM,CAAE,SAAS,UAAW,QAAI,yBAAiB,CAAC,CAAE;AAEpD,gCAAW,MAAM;AAEhB,QAAI,aAAa,4BAA6B,MAAM,OAAQ;AAC5D,QAAK,WAAW,SAAS,MAAO;AAC/B,mBAAa,WAAW;AAAA,QACvB,KAAK,MAAO,WAAW,QAAQ,IAAK;AAAA,MACrC;AAAA,IACD;AACA,eAAY,UAAW;AAEvB,UAAM,iBAAa,mCAAY;AAC/B,aAAU,IAAI,WAAW,QAAQ,IAAI,KAAK,QAAQ,KAAK,MAAO;AAC7D,iBAAW,IAAK,CAAC,GAAG,MAAM;AACzB,sCAAW,MAAM;AAChB,qBAAY,CAAE,UAAW;AAAA,YACxB,GAAG;AAAA,YACH,GAAG,KAAK,MAAO,GAAG,IAAI,IAAK;AAAA,UAC5B,CAAE;AAAA,QACH,CAAE;AAAA,MACH,CAAE;AAAA,IACH;AAEA,WAAO,MAAM,WAAW,MAAM;AAAA,EAC/B,GAAG,CAAE,IAAK,CAAE;AAEZ,SAAO;AACR;AAEA,IAAO,yBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/compose/src/hooks/use-constrained-tabbing/index.js
|
|
29
31
|
var use_constrained_tabbing_exports = {};
|
|
30
32
|
__export(use_constrained_tabbing_exports, {
|
|
31
33
|
default: () => use_constrained_tabbing_default
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/use-constrained-tabbing/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport useRefEffect from '../use-ref-effect';\n\n/**\n * In Dialogs/modals, the tabbing must be constrained to the content of\n * the wrapper element. This hook adds the behavior to the returned ref.\n *\n * @return {import('react').RefCallback<Element>} Element Ref.\n *\n * @example\n * ```js\n * import { useConstrainedTabbing } from '@wordpress/compose';\n *\n * const ConstrainedTabbingExample = () => {\n * const constrainedTabbingRef = useConstrainedTabbing()\n * return (\n * <div ref={ constrainedTabbingRef }>\n * <Button />\n * <Button />\n * </div>\n * );\n * }\n * ```\n */\nfunction useConstrainedTabbing() {\n\treturn useRefEffect( ( /** @type {HTMLElement} */ node ) => {\n\t\tfunction onKeyDown( /** @type {KeyboardEvent} */ event ) {\n\t\t\tconst { key, shiftKey, target } = event;\n\n\t\t\tif ( key !== 'Tab' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst action = shiftKey ? 'findPrevious' : 'findNext';\n\t\t\tconst nextElement =\n\t\t\t\tfocus.tabbable[ action ](\n\t\t\t\t\t/** @type {HTMLElement} */ ( target )\n\t\t\t\t) || null;\n\n\t\t\t// When the target element contains the element that is about to\n\t\t\t// receive focus, for example when the target is a tabbable\n\t\t\t// container, browsers may disagree on where to move focus next.\n\t\t\t// In this case we can't rely on native browsers behavior. We need\n\t\t\t// to manage focus instead.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/46041.\n\t\t\tif (\n\t\t\t\t/** @type {HTMLElement} */ ( target ).contains( nextElement )\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tnextElement?.focus();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the element that is about to receive focus is inside the\n\t\t\t// area, rely on native browsers behavior and let tabbing follow\n\t\t\t// the native tab sequence.\n\t\t\tif ( node.contains( nextElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the element that is about to receive focus is outside the\n\t\t\t// area, move focus to a div and insert it at the start or end of\n\t\t\t// the area, depending on the direction. Without preventing default\n\t\t\t// behaviour, the browser will then move focus to the next element.\n\t\t\tconst domAction = shiftKey ? 'append' : 'prepend';\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst trap = ownerDocument.createElement( 'div' );\n\n\t\t\ttrap.tabIndex = -1;\n\t\t\tnode[ domAction ]( trap );\n\n\t\t\t// Remove itself when the trap loses focus.\n\t\t\ttrap.addEventListener( 'blur', () => node.removeChild( trap ) );\n\n\t\t\ttrap.focus();\n\t\t}\n\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n\nexport default useConstrainedTabbing;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBAAsB;AAKtB,4BAAyB;AAuBzB,SAAS,wBAAwB;AAChC,aAAO,sBAAAA,SAAc,CAA6B,SAAU;AAC3D,aAAS,UAAwC,OAAQ;AACxD,YAAM,EAAE,KAAK,UAAU,OAAO,IAAI;AAElC,UAAK,QAAQ,OAAQ;AACpB;AAAA,MACD;AAEA,YAAM,SAAS,WAAW,iBAAiB;AAC3C,YAAM,cACL,iBAAM,SAAU,MAAO;AAAA;AAAA,QACO;AAAA,MAC9B,KAAK;AAQN;AAAA;AAAA,QAC8B,OAAS,SAAU,WAAY;AAAA,QAC3D;AACD,cAAM,eAAe;AACrB,qBAAa,MAAM;AACnB;AAAA,MACD;AAKA,UAAK,KAAK,SAAU,WAAY,GAAI;AACnC;AAAA,MACD;AAMA,YAAM,YAAY,WAAW,WAAW;AACxC,YAAM,EAAE,cAAc,IAAI;AAC1B,YAAM,OAAO,cAAc,cAAe,KAAM;AAEhD,WAAK,WAAW;AAChB,WAAM,SAAU,EAAG,IAAK;AAGxB,WAAK,iBAAkB,QAAQ,MAAM,KAAK,YAAa,IAAK,CAAE;AAE9D,WAAK,MAAM;AAAA,IACZ;AAEA,SAAK,iBAAkB,WAAW,SAAU;AAC5C,WAAO,MAAM;AACZ,WAAK,oBAAqB,WAAW,SAAU;AAAA,IAChD;AAAA,EACD,GAAG,CAAC,CAAE;AACP;AAEA,IAAO,kCAAQ;",
|
|
6
6
|
"names": ["useRefEffect"]
|
|
7
7
|
}
|
|
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/compose/src/hooks/use-copy-on-click/index.js
|
|
29
31
|
var use_copy_on_click_exports = {};
|
|
30
32
|
__export(use_copy_on_click_exports, {
|
|
31
33
|
default: () => useCopyOnClick
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/use-copy-on-click/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport Clipboard from 'clipboard';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect, useState } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport Clipboard from 'clipboard';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect, useState } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Copies the text to the clipboard when the element is clicked.\n *\n * @deprecated\n *\n * @param {import('react').RefObject<string | Element | NodeListOf<Element>>} ref Reference with the element.\n * @param {string|Function} text The text to copy.\n * @param {number} [timeout] Optional timeout to reset the returned\n * state. 4 seconds by default.\n *\n * @return {boolean} Whether or not the text has been copied. Resets after the\n * timeout.\n */\nexport default function useCopyOnClick( ref, text, timeout = 4000 ) {\n\tdeprecated( 'wp.compose.useCopyOnClick', {\n\t\tsince: '5.8',\n\t\talternative: 'wp.compose.useCopyToClipboard',\n\t} );\n\n\t/** @type {import('react').MutableRefObject<Clipboard | undefined>} */\n\tconst clipboardRef = useRef();\n\tconst [ hasCopied, setHasCopied ] = useState( false );\n\n\tuseEffect( () => {\n\t\t/** @type {number | undefined} */\n\t\tlet timeoutId;\n\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Clipboard listens to click events.\n\t\tclipboardRef.current = new Clipboard( ref.current, {\n\t\t\ttext: () => ( typeof text === 'function' ? text() : text ),\n\t\t} );\n\n\t\tclipboardRef.current.on( 'success', ( { clearSelection, trigger } ) => {\n\t\t\t// Clearing selection will move focus back to the triggering button,\n\t\t\t// ensuring that it is not reset to the body, and further that it is\n\t\t\t// kept within the rendered node.\n\t\t\tclearSelection();\n\n\t\t\t// Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680\n\t\t\tif ( trigger ) {\n\t\t\t\t/** @type {HTMLElement} */ ( trigger ).focus();\n\t\t\t}\n\n\t\t\tif ( timeout ) {\n\t\t\t\tsetHasCopied( true );\n\t\t\t\tclearTimeout( timeoutId );\n\t\t\t\ttimeoutId = setTimeout( () => setHasCopied( false ), timeout );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tif ( clipboardRef.current ) {\n\t\t\t\tclipboardRef.current.destroy();\n\t\t\t}\n\t\t\tclearTimeout( timeoutId );\n\t\t};\n\t}, [ text, timeout, setHasCopied ] );\n\n\treturn hasCopied;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAsB;AAKtB,qBAA4C;AAC5C,wBAAuB;AAeR,SAAR,eAAiC,KAAK,MAAM,UAAU,KAAO;AACnE,wBAAAA,SAAY,6BAA6B;AAAA,IACxC,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAGF,QAAM,mBAAe,uBAAO;AAC5B,QAAM,CAAE,WAAW,YAAa,QAAI,yBAAU,KAAM;AAEpD,gCAAW,MAAM;AAEhB,QAAI;AAEJ,QAAK,CAAE,IAAI,SAAU;AACpB;AAAA,IACD;AAGA,iBAAa,UAAU,IAAI,iBAAAC,QAAW,IAAI,SAAS;AAAA,MAClD,MAAM,MAAQ,OAAO,SAAS,aAAa,KAAK,IAAI;AAAA,IACrD,CAAE;AAEF,iBAAa,QAAQ,GAAI,WAAW,CAAE,EAAE,gBAAgB,QAAQ,MAAO;AAItE,qBAAe;AAGf,UAAK,SAAU;AACa,QAAE,QAAU,MAAM;AAAA,MAC9C;AAEA,UAAK,SAAU;AACd,qBAAc,IAAK;AACnB,qBAAc,SAAU;AACxB,oBAAY,WAAY,MAAM,aAAc,KAAM,GAAG,OAAQ;AAAA,MAC9D;AAAA,IACD,CAAE;AAEF,WAAO,MAAM;AACZ,UAAK,aAAa,SAAU;AAC3B,qBAAa,QAAQ,QAAQ;AAAA,MAC9B;AACA,mBAAc,SAAU;AAAA,IACzB;AAAA,EACD,GAAG,CAAE,MAAM,SAAS,YAAa,CAAE;AAEnC,SAAO;AACR;",
|
|
6
6
|
"names": ["deprecated", "Clipboard"]
|
|
7
7
|
}
|
|
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/compose/src/hooks/use-copy-to-clipboard/index.js
|
|
29
31
|
var use_copy_to_clipboard_exports = {};
|
|
30
32
|
__export(use_copy_to_clipboard_exports, {
|
|
31
33
|
default: () => useCopyToClipboard
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/use-copy-to-clipboard/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport Clipboard from 'clipboard';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useLayoutEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useRefEffect from '../use-ref-effect';\n\n/**\n * @template T\n * @param {T} value\n * @return {import('react').RefObject<T>} The updated ref\n */\nfunction useUpdatedRef( value ) {\n\tconst ref = useRef( value );\n\tuseLayoutEffect( () => {\n\t\tref.current = value;\n\t}, [ value ] );\n\treturn ref;\n}\n\n/**\n * Copies the given text to the clipboard when the element is clicked.\n *\n * @template {HTMLElement} TElementType\n * @param {string | (() => string)} text The text to copy. Use a function if not\n * already available and expensive to compute.\n * @param {Function} onSuccess Called when to text is copied.\n *\n * @return {import('react').Ref<TElementType>} A ref to assign to the target element.\n */\nexport default function useCopyToClipboard( text, onSuccess ) {\n\t// Store the dependencies as refs and continuously update them so they're\n\t// fresh when the callback is called.\n\tconst textRef = useUpdatedRef( text );\n\tconst onSuccessRef = useUpdatedRef( onSuccess );\n\treturn useRefEffect( ( node ) => {\n\t\t// Clipboard listens to click events.\n\t\tconst clipboard = new Clipboard( node, {\n\t\t\ttext() {\n\t\t\t\treturn typeof textRef.current === 'function'\n\t\t\t\t\t? textRef.current()\n\t\t\t\t\t: textRef.current || '';\n\t\t\t},\n\t\t} );\n\n\t\tclipboard.on( 'success', ( { clearSelection } ) => {\n\t\t\t// Clearing selection will move focus back to the triggering\n\t\t\t// button, ensuring that it is not reset to the body, and\n\t\t\t// further that it is kept within the rendered node.\n\t\t\tclearSelection();\n\n\t\t\tif ( onSuccessRef.current ) {\n\t\t\t\tonSuccessRef.current();\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tclipboard.destroy();\n\t\t};\n\t}, [] );\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAsB;AAKtB,qBAAwC;AAKxC,4BAAyB;AAOzB,SAAS,cAAe,OAAQ;AAC/B,QAAM,UAAM,uBAAQ,KAAM;AAC1B,sCAAiB,MAAM;AACtB,QAAI,UAAU;AAAA,EACf,GAAG,CAAE,KAAM,CAAE;AACb,SAAO;AACR;AAYe,SAAR,mBAAqC,MAAM,WAAY;AAG7D,QAAM,UAAU,cAAe,IAAK;AACpC,QAAM,eAAe,cAAe,SAAU;AAC9C,aAAO,sBAAAA,SAAc,CAAE,SAAU;AAEhC,UAAM,YAAY,IAAI,iBAAAC,QAAW,MAAM;AAAA,MACtC,OAAO;AACN,eAAO,OAAO,QAAQ,YAAY,aAC/B,QAAQ,QAAQ,IAChB,QAAQ,WAAW;AAAA,MACvB;AAAA,IACD,CAAE;AAEF,cAAU,GAAI,WAAW,CAAE,EAAE,eAAe,MAAO;AAIlD,qBAAe;AAEf,UAAK,aAAa,SAAU;AAC3B,qBAAa,QAAQ;AAAA,MACtB;AAAA,IACD,CAAE;AAEF,WAAO,MAAM;AACZ,gBAAU,QAAQ;AAAA,IACnB;AAAA,EACD,GAAG,CAAC,CAAE;AACP;",
|
|
6
6
|
"names": ["useRefEffect", "Clipboard"]
|
|
7
7
|
}
|
|
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/compose/src/hooks/use-debounce/index.js
|
|
19
21
|
var use_debounce_exports = {};
|
|
20
22
|
__export(use_debounce_exports, {
|
|
21
23
|
default: () => useDebounce
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/use-debounce/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport { useMemoOne } from 'use-memo-one';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { debounce } from '../../utils/debounce';\n\n/**\n * Debounces a function similar to Lodash's `debounce`. A new debounced function will\n * be returned and any scheduled calls cancelled if any of the arguments change,\n * including the function to debounce, so please wrap functions created on\n * render in components in `useCallback`.\n *\n * @see https://lodash.com/docs/4#debounce\n *\n * @template {(...args: any[]) => void} TFunc\n *\n * @param {TFunc} fn The function to debounce.\n * @param {number} [wait] The number of milliseconds to delay.\n * @param {import('../../utils/debounce').DebounceOptions} [options] The options object.\n * @return {import('../../utils/debounce').DebouncedFunc<TFunc>} Debounced function.\n */\nexport default function useDebounce( fn, wait, options ) {\n\tconst debounced = useMemoOne(\n\t\t() => debounce( fn, wait ?? 0, options ),\n\t\t[ fn, wait, options?.leading, options?.trailing, options?.maxWait ]\n\t);\n\tuseEffect( () => () => debounced.cancel(), [ debounced ] );\n\treturn debounced;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA2B;AAK3B,qBAA0B;AAK1B,sBAAyB;AAiBV,SAAR,YAA8B,IAAI,MAAM,SAAU;AACxD,QAAM,gBAAY;AAAA,IACjB,UAAM,0BAAU,IAAI,QAAQ,GAAG,OAAQ;AAAA,IACvC,CAAE,IAAI,MAAM,SAAS,SAAS,SAAS,UAAU,SAAS,OAAQ;AAAA,EACnE;AACA,gCAAW,MAAM,MAAM,UAAU,OAAO,GAAG,CAAE,SAAU,CAAE;AACzD,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/compose/src/hooks/use-debounced-input/index.ts
|
|
29
31
|
var use_debounced_input_exports = {};
|
|
30
32
|
__export(use_debounced_input_exports, {
|
|
31
33
|
default: () => useDebouncedInput
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/use-debounced-input/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useDebounce from '../use-debounce';\n\n/**\n * Helper hook for input fields that need to debounce the value before using it.\n *\n * @param defaultValue The default value to use.\n * @return The input value, the setter and the debounced input value.\n */\nexport default function useDebouncedInput(\n\tdefaultValue = ''\n): [ string, ( value: string ) => void, string ] {\n\tconst [ input, setInput ] = useState< string >( defaultValue );\n\tconst [ debouncedInput, setDebouncedState ] = useState( defaultValue );\n\n\tconst setDebouncedInput = useDebounce( setDebouncedState, 250 );\n\n\tuseEffect( () => {\n\t\tsetDebouncedInput( input );\n\t}, [ input, setDebouncedInput ] );\n\n\treturn [ input, setInput, debouncedInput ];\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAoC;AAKpC,0BAAwB;AAQT,SAAR,kBACN,eAAe,IACiC;AAChD,QAAM,CAAE,OAAO,QAAS,QAAI,yBAAoB,YAAa;AAC7D,QAAM,CAAE,gBAAgB,iBAAkB,QAAI,yBAAU,YAAa;AAErE,QAAM,wBAAoB,oBAAAA,SAAa,mBAAmB,GAAI;AAE9D,gCAAW,MAAM;AAChB,sBAAmB,KAAM;AAAA,EAC1B,GAAG,CAAE,OAAO,iBAAkB,CAAE;AAEhC,SAAO,CAAE,OAAO,UAAU,cAAe;AAC1C;",
|
|
6
6
|
"names": ["useDebounce"]
|
|
7
7
|
}
|
|
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/compose/src/hooks/use-dialog/index.ts
|
|
29
31
|
var use_dialog_exports = {};
|
|
30
32
|
__export(use_dialog_exports, {
|
|
31
33
|
default: () => use_dialog_default
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/use-dialog/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { RefCallback, SyntheticEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect, useCallback } from '@wordpress/element';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport useConstrainedTabbing from '../use-constrained-tabbing';\nimport useFocusOnMount from '../use-focus-on-mount';\nimport useFocusReturn from '../use-focus-return';\nimport useFocusOutside from '../use-focus-outside';\nimport useMergeRefs from '../use-merge-refs';\n\ntype DialogOptions = {\n\t/**\n\t * Determines whether focus should be automatically moved to the popover\n\t * when it mounts. `false` causes no focus shift, `true` causes the popover\n\t * itself to gain focus, and `firstElement` focuses the first focusable\n\t * element within the popover.\n\t *\n\t * @default 'firstElement'\n\t */\n\tfocusOnMount?: Parameters< typeof useFocusOnMount >[ 0 ];\n\t/**\n\t * Determines whether tabbing is constrained to within the popover,\n\t * preventing keyboard focus from leaving the popover content without\n\t * explicit focus elsewhere, or whether the popover remains part of the\n\t * wider tab order.\n\t * If no value is passed, it will be derived from `focusOnMount`.\n\t *\n\t * @see focusOnMount\n\t * @default `focusOnMount` !== false\n\t */\n\tconstrainTabbing?: boolean;\n\tonClose?: () => void;\n\t/**\n\t * Use the `onClose` prop instead.\n\t *\n\t * @deprecated\n\t */\n\t__unstableOnClose?: (\n\t\ttype: string | undefined,\n\t\tevent: SyntheticEvent\n\t) => void;\n};\n\ntype useDialogReturn = [\n\tRefCallback< HTMLElement >,\n\tReturnType< typeof useFocusOutside > & Pick< HTMLElement, 'tabIndex' >,\n];\n\n/**\n * Returns a ref and props to apply to a dialog wrapper to enable the following behaviors:\n * - constrained tabbing.\n * - focus on mount.\n * - return focus on unmount.\n * - focus outside.\n *\n * @param options Dialog Options.\n */\nfunction useDialog( options: DialogOptions ): useDialogReturn {\n\tconst currentOptions = useRef< DialogOptions | undefined >();\n\tconst { constrainTabbing = options.focusOnMount !== false } = options;\n\tuseEffect( () => {\n\t\tcurrentOptions.current = options;\n\t}, Object.values( options ) );\n\tconst constrainedTabbingRef = useConstrainedTabbing();\n\tconst focusOnMountRef = useFocusOnMount( options.focusOnMount );\n\tconst focusReturnRef = useFocusReturn();\n\tconst focusOutsideProps = useFocusOutside( ( event ) => {\n\t\t// This unstable prop is here only to manage backward compatibility\n\t\t// for the Popover component otherwise, the onClose should be enough.\n\t\tif ( currentOptions.current?.__unstableOnClose ) {\n\t\t\tcurrentOptions.current.__unstableOnClose( 'focus-outside', event );\n\t\t} else if ( currentOptions.current?.onClose ) {\n\t\t\tcurrentOptions.current.onClose();\n\t\t}\n\t} );\n\tconst closeOnEscapeRef = useCallback( ( node: HTMLElement ) => {\n\t\tif ( ! node ) {\n\t\t\treturn;\n\t\t}\n\n\t\tnode.addEventListener( 'keydown', ( event: KeyboardEvent ) => {\n\t\t\t// Close on escape.\n\t\t\tif (\n\t\t\t\tevent.keyCode === ESCAPE &&\n\t\t\t\t! event.defaultPrevented &&\n\t\t\t\tcurrentOptions.current?.onClose\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcurrentOptions.current.onClose();\n\t\t\t}\n\t\t} );\n\t}, [] );\n\n\treturn [\n\t\tuseMergeRefs( [\n\t\t\tconstrainTabbing ? constrainedTabbingRef : null,\n\t\t\toptions.focusOnMount !== false ? focusReturnRef : null,\n\t\t\toptions.focusOnMount !== false ? focusOnMountRef : null,\n\t\t\tcloseOnEscapeRef,\n\t\t] ),\n\t\t{\n\t\t\t...focusOutsideProps,\n\t\t\ttabIndex: -1,\n\t\t},\n\t];\n}\n\nexport default useDialog;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,qBAA+C;AAC/C,sBAAuB;AAKvB,qCAAkC;AAClC,gCAA4B;AAC5B,8BAA2B;AAC3B,+BAA4B;AAC5B,4BAAyB;AAiDzB,SAAS,UAAW,SAA0C;AAC7D,QAAM,qBAAiB,uBAAoC;AAC3D,QAAM,EAAE,mBAAmB,QAAQ,iBAAiB,MAAM,IAAI;AAC9D,gCAAW,MAAM;AAChB,mBAAe,UAAU;AAAA,EAC1B,GAAG,OAAO,OAAQ,OAAQ,CAAE;AAC5B,QAAM,4BAAwB,+BAAAA,SAAsB;AACpD,QAAM,sBAAkB,0BAAAC,SAAiB,QAAQ,YAAa;AAC9D,QAAM,qBAAiB,wBAAAC,SAAe;AACtC,QAAM,wBAAoB,yBAAAC,SAAiB,CAAE,UAAW;AAGvD,QAAK,eAAe,SAAS,mBAAoB;AAChD,qBAAe,QAAQ,kBAAmB,iBAAiB,KAAM;AAAA,IAClE,WAAY,eAAe,SAAS,SAAU;AAC7C,qBAAe,QAAQ,QAAQ;AAAA,IAChC;AAAA,EACD,CAAE;AACF,QAAM,uBAAmB,4BAAa,CAAE,SAAuB;AAC9D,QAAK,CAAE,MAAO;AACb;AAAA,IACD;AAEA,SAAK,iBAAkB,WAAW,CAAE,UAA0B;AAE7D,UACC,MAAM,YAAY,0BAClB,CAAE,MAAM,oBACR,eAAe,SAAS,SACvB;AACD,cAAM,eAAe;AACrB,uBAAe,QAAQ,QAAQ;AAAA,MAChC;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAC,CAAE;AAEN,SAAO;AAAA,QACN,sBAAAC,SAAc;AAAA,MACb,mBAAmB,wBAAwB;AAAA,MAC3C,QAAQ,iBAAiB,QAAQ,iBAAiB;AAAA,MAClD,QAAQ,iBAAiB,QAAQ,kBAAkB;AAAA,MACnD;AAAA,IACD,CAAE;AAAA,IACF;AAAA,MACC,GAAG;AAAA,MACH,UAAU;AAAA,IACX;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": ["useConstrainedTabbing", "useFocusOnMount", "useFocusReturn", "useFocusOutside", "useMergeRefs"]
|
|
7
7
|
}
|
|
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/compose/src/hooks/use-disabled/index.ts
|
|
29
31
|
var use_disabled_exports = {};
|
|
30
32
|
__export(use_disabled_exports, {
|
|
31
33
|
default: () => useDisabled
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/use-disabled/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { debounce } from '../../utils/debounce';\nimport useRefEffect from '../use-ref-effect';\n\n/**\n * In some circumstances, such as block previews, all focusable DOM elements\n * (input fields, links, buttons, etc.) need to be disabled. This hook adds the\n * behavior to disable nested DOM elements to the returned ref.\n *\n * If you can, prefer the use of the inert HTML attribute.\n *\n * @param {Object} config Configuration object.\n * @param {boolean=} config.isDisabled Whether the element should be disabled.\n * @return {import('react').RefCallback<HTMLElement>} Element Ref.\n *\n * @example\n * ```js\n * import { useDisabled } from '@wordpress/compose';\n *\n * const DisabledExample = () => {\n * \tconst disabledRef = useDisabled();\n *\treturn (\n *\t\t<div ref={ disabledRef }>\n *\t\t\t<a href=\"#\">This link will have tabindex set to -1</a>\n *\t\t\t<input placeholder=\"This input will have the disabled attribute added to it.\" type=\"text\" />\n *\t\t</div>\n *\t);\n * };\n * ```\n */\nexport default function useDisabled( {\n\tisDisabled: isDisabledProp = false,\n} = {} ) {\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( isDisabledProp ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst defaultView = node?.ownerDocument?.defaultView;\n\t\t\tif ( ! defaultView ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t/** A variable keeping track of the previous updates in order to restore them. */\n\t\t\tconst updates: Function[] = [];\n\t\t\tconst disable = () => {\n\t\t\t\tnode.childNodes.forEach( ( child ) => {\n\t\t\t\t\tif ( ! ( child instanceof defaultView.HTMLElement ) ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif ( ! child.getAttribute( 'inert' ) ) {\n\t\t\t\t\t\tchild.setAttribute( 'inert', 'true' );\n\t\t\t\t\t\tupdates.push( () => {\n\t\t\t\t\t\t\tchild.removeAttribute( 'inert' );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t};\n\n\t\t\t// Debounce re-disable since disabling process itself will incur\n\t\t\t// additional mutations which should be ignored.\n\t\t\tconst debouncedDisable = debounce( disable, 0, {\n\t\t\t\tleading: true,\n\t\t\t} );\n\t\t\tdisable();\n\n\t\t\t/** @type {MutationObserver | undefined} */\n\t\t\tconst observer = new window.MutationObserver( debouncedDisable );\n\t\t\tobserver.observe( node, {\n\t\t\t\tchildList: true,\n\t\t\t} );\n\n\t\t\treturn () => {\n\t\t\t\tif ( observer ) {\n\t\t\t\t\tobserver.disconnect();\n\t\t\t\t}\n\t\t\t\tdebouncedDisable.cancel();\n\t\t\t\tupdates.forEach( ( update ) => update() );\n\t\t\t};\n\t\t},\n\t\t[ isDisabledProp ]\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAyB;AACzB,4BAAyB;AA4BV,SAAR,YAA8B;AAAA,EACpC,YAAY,iBAAiB;AAC9B,IAAI,CAAC,GAAI;AACR,aAAO,sBAAAA;AAAA,IACN,CAAE,SAAU;AACX,UAAK,gBAAiB;AACrB;AAAA,MACD;AAEA,YAAM,cAAc,MAAM,eAAe;AACzC,UAAK,CAAE,aAAc;AACpB;AAAA,MACD;AAGA,YAAM,UAAsB,CAAC;AAC7B,YAAM,UAAU,MAAM;AACrB,aAAK,WAAW,QAAS,CAAE,UAAW;AACrC,cAAK,EAAI,iBAAiB,YAAY,cAAgB;AACrD;AAAA,UACD;AACA,cAAK,CAAE,MAAM,aAAc,OAAQ,GAAI;AACtC,kBAAM,aAAc,SAAS,MAAO;AACpC,oBAAQ,KAAM,MAAM;AACnB,oBAAM,gBAAiB,OAAQ;AAAA,YAChC,CAAE;AAAA,UACH;AAAA,QACD,CAAE;AAAA,MACH;AAIA,YAAM,uBAAmB,0BAAU,SAAS,GAAG;AAAA,QAC9C,SAAS;AAAA,MACV,CAAE;AACF,cAAQ;AAGR,YAAM,WAAW,IAAI,OAAO,iBAAkB,gBAAiB;AAC/D,eAAS,QAAS,MAAM;AAAA,QACvB,WAAW;AAAA,MACZ,CAAE;AAEF,aAAO,MAAM;AACZ,YAAK,UAAW;AACf,mBAAS,WAAW;AAAA,QACrB;AACA,yBAAiB,OAAO;AACxB,gBAAQ,QAAS,CAAE,WAAY,OAAO,CAAE;AAAA,MACzC;AAAA,IACD;AAAA,IACA,CAAE,cAAe;AAAA,EAClB;AACD;",
|
|
6
6
|
"names": ["useRefEffect"]
|
|
7
7
|
}
|
|
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/compose/src/hooks/use-dragging/index.js
|
|
29
31
|
var use_dragging_exports = {};
|
|
30
32
|
__export(use_dragging_exports, {
|
|
31
33
|
default: () => useDragging
|