@wordpress/compose 5.0.4 → 5.0.7
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/build/higher-order/with-global-events/index.js +3 -1
- package/build/higher-order/with-global-events/index.js.map +1 -1
- package/build/higher-order/with-state/index.js +2 -1
- package/build/higher-order/with-state/index.js.map +1 -1
- package/build/hooks/use-async-list/index.js +4 -3
- package/build/hooks/use-async-list/index.js.map +1 -1
- package/build/hooks/use-constrained-tabbing/index.js +2 -2
- package/build/hooks/use-constrained-tabbing/index.js.map +1 -1
- package/build/hooks/use-copy-on-click/index.js +8 -5
- package/build/hooks/use-copy-on-click/index.js.map +1 -1
- package/build/hooks/use-copy-to-clipboard/index.js +4 -3
- package/build/hooks/use-copy-to-clipboard/index.js.map +1 -1
- package/build/hooks/use-dialog/index.js +2 -2
- package/build/hooks/use-dialog/index.js.map +1 -1
- package/build/hooks/use-disabled/index.js +114 -0
- package/build/hooks/use-disabled/index.js.map +1 -0
- package/build/hooks/use-dragging/index.js +12 -11
- package/build/hooks/use-dragging/index.js.map +1 -1
- package/build/hooks/use-drop-zone/index.js +10 -9
- package/build/hooks/use-drop-zone/index.js.map +1 -1
- package/build/hooks/use-fixed-window-list/index.js +175 -0
- package/build/hooks/use-fixed-window-list/index.js.map +1 -0
- package/build/hooks/use-focus-on-mount/index.js +2 -1
- package/build/hooks/use-focus-on-mount/index.js.map +1 -1
- package/build/hooks/use-instance-id/index.js +2 -1
- package/build/hooks/use-instance-id/index.js.map +1 -1
- package/build/hooks/use-keyboard-shortcut/index.js +17 -15
- package/build/hooks/use-keyboard-shortcut/index.js.map +1 -1
- package/build/hooks/use-preferred-color-scheme/index.android.js +4 -3
- package/build/hooks/use-preferred-color-scheme/index.android.js.map +1 -1
- package/build/hooks/use-resize-observer/index.native.js +4 -3
- package/build/hooks/use-resize-observer/index.native.js.map +1 -1
- package/build/hooks/use-viewport-match/index.js +2 -1
- package/build/hooks/use-viewport-match/index.js.map +1 -1
- package/build/hooks/use-warn-on-change/index.js +5 -2
- package/build/hooks/use-warn-on-change/index.js.map +1 -1
- package/build/index.js +66 -50
- package/build/index.js.map +1 -1
- package/build/index.native.js +46 -46
- package/build-module/higher-order/with-global-events/index.js +3 -1
- package/build-module/higher-order/with-global-events/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 +4 -3
- package/build-module/hooks/use-async-list/index.js.map +1 -1
- package/build-module/hooks/use-constrained-tabbing/index.js +2 -2
- package/build-module/hooks/use-constrained-tabbing/index.js.map +1 -1
- package/build-module/hooks/use-copy-on-click/index.js +8 -5
- package/build-module/hooks/use-copy-on-click/index.js.map +1 -1
- package/build-module/hooks/use-copy-to-clipboard/index.js +4 -3
- package/build-module/hooks/use-copy-to-clipboard/index.js.map +1 -1
- package/build-module/hooks/use-dialog/index.js +2 -2
- package/build-module/hooks/use-dialog/index.js.map +1 -1
- package/build-module/hooks/use-disabled/index.js +104 -0
- package/build-module/hooks/use-disabled/index.js.map +1 -0
- package/build-module/hooks/use-dragging/index.js +12 -11
- package/build-module/hooks/use-dragging/index.js.map +1 -1
- package/build-module/hooks/use-drop-zone/index.js +10 -9
- package/build-module/hooks/use-drop-zone/index.js.map +1 -1
- package/build-module/hooks/use-fixed-window-list/index.js +164 -0
- package/build-module/hooks/use-fixed-window-list/index.js.map +1 -0
- package/build-module/hooks/use-focus-on-mount/index.js +2 -1
- package/build-module/hooks/use-focus-on-mount/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-keyboard-shortcut/index.js +17 -15
- package/build-module/hooks/use-keyboard-shortcut/index.js.map +1 -1
- package/build-module/hooks/use-preferred-color-scheme/index.android.js +4 -3
- package/build-module/hooks/use-preferred-color-scheme/index.android.js.map +1 -1
- package/build-module/hooks/use-resize-observer/index.native.js +4 -3
- package/build-module/hooks/use-resize-observer/index.native.js.map +1 -1
- package/build-module/hooks/use-viewport-match/index.js +2 -1
- package/build-module/hooks/use-viewport-match/index.js.map +1 -1
- package/build-module/hooks/use-warn-on-change/index.js +5 -2
- package/build-module/hooks/use-warn-on-change/index.js.map +1 -1
- package/build-module/index.js +2 -0
- package/build-module/index.js.map +1 -1
- package/build-types/hooks/use-disabled/index.d.ts +23 -0
- package/build-types/hooks/use-disabled/index.d.ts.map +1 -0
- package/build-types/hooks/use-fixed-window-list/index.d.ts +57 -0
- package/build-types/hooks/use-fixed-window-list/index.d.ts.map +1 -0
- package/build-types/index.d.ts +2 -0
- package/package.json +9 -9
- package/src/hooks/use-disabled/index.js +113 -0
- package/src/hooks/use-disabled/test/index.js +90 -0
- package/src/hooks/use-fixed-window-list/index.js +174 -0
- package/src/index.js +2 -0
- package/tsconfig.tsbuildinfo +1 -1
package/build/index.js
CHANGED
|
@@ -5,52 +5,70 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
Object.defineProperty(exports, "
|
|
8
|
+
Object.defineProperty(exports, "__experimentalUseDialog", {
|
|
9
9
|
enumerable: true,
|
|
10
10
|
get: function () {
|
|
11
|
-
return
|
|
11
|
+
return _useDialog.default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
Object.defineProperty(exports, "
|
|
14
|
+
Object.defineProperty(exports, "__experimentalUseDisabled", {
|
|
15
15
|
enumerable: true,
|
|
16
16
|
get: function () {
|
|
17
|
-
return
|
|
17
|
+
return _useDisabled.default;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
Object.defineProperty(exports, "
|
|
20
|
+
Object.defineProperty(exports, "__experimentalUseDragging", {
|
|
21
21
|
enumerable: true,
|
|
22
22
|
get: function () {
|
|
23
|
-
return
|
|
23
|
+
return _useDragging.default;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
Object.defineProperty(exports, "
|
|
26
|
+
Object.defineProperty(exports, "__experimentalUseDropZone", {
|
|
27
27
|
enumerable: true,
|
|
28
28
|
get: function () {
|
|
29
|
-
return
|
|
29
|
+
return _useDropZone.default;
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
Object.defineProperty(exports, "
|
|
32
|
+
Object.defineProperty(exports, "__experimentalUseFixedWindowList", {
|
|
33
33
|
enumerable: true,
|
|
34
34
|
get: function () {
|
|
35
|
-
return
|
|
35
|
+
return _useFixedWindowList.default;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
Object.defineProperty(exports, "
|
|
38
|
+
Object.defineProperty(exports, "__experimentalUseFocusOutside", {
|
|
39
39
|
enumerable: true,
|
|
40
40
|
get: function () {
|
|
41
|
-
return
|
|
41
|
+
return _useFocusOutside.default;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
Object.defineProperty(exports, "
|
|
44
|
+
Object.defineProperty(exports, "compose", {
|
|
45
45
|
enumerable: true,
|
|
46
46
|
get: function () {
|
|
47
|
-
return
|
|
47
|
+
return _compose.default;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
Object.defineProperty(exports, "
|
|
50
|
+
Object.defineProperty(exports, "createHigherOrderComponent", {
|
|
51
51
|
enumerable: true,
|
|
52
52
|
get: function () {
|
|
53
|
-
return
|
|
53
|
+
return _createHigherOrderComponent.default;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, "ifCondition", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () {
|
|
59
|
+
return _ifCondition.default;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(exports, "pure", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function () {
|
|
65
|
+
return _pure.default;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(exports, "useAsyncList", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () {
|
|
71
|
+
return _useAsyncList.default;
|
|
54
72
|
}
|
|
55
73
|
});
|
|
56
74
|
Object.defineProperty(exports, "useConstrainedTabbing", {
|
|
@@ -71,16 +89,10 @@ Object.defineProperty(exports, "useCopyToClipboard", {
|
|
|
71
89
|
return _useCopyToClipboard.default;
|
|
72
90
|
}
|
|
73
91
|
});
|
|
74
|
-
Object.defineProperty(exports, "
|
|
75
|
-
enumerable: true,
|
|
76
|
-
get: function () {
|
|
77
|
-
return _useDialog.default;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
Object.defineProperty(exports, "__experimentalUseDragging", {
|
|
92
|
+
Object.defineProperty(exports, "useDebounce", {
|
|
81
93
|
enumerable: true,
|
|
82
94
|
get: function () {
|
|
83
|
-
return
|
|
95
|
+
return _useDebounce.default;
|
|
84
96
|
}
|
|
85
97
|
});
|
|
86
98
|
Object.defineProperty(exports, "useFocusOnMount", {
|
|
@@ -89,16 +101,16 @@ Object.defineProperty(exports, "useFocusOnMount", {
|
|
|
89
101
|
return _useFocusOnMount.default;
|
|
90
102
|
}
|
|
91
103
|
});
|
|
92
|
-
Object.defineProperty(exports, "
|
|
104
|
+
Object.defineProperty(exports, "useFocusReturn", {
|
|
93
105
|
enumerable: true,
|
|
94
106
|
get: function () {
|
|
95
|
-
return
|
|
107
|
+
return _useFocusReturn.default;
|
|
96
108
|
}
|
|
97
109
|
});
|
|
98
|
-
Object.defineProperty(exports, "
|
|
110
|
+
Object.defineProperty(exports, "useFocusableIframe", {
|
|
99
111
|
enumerable: true,
|
|
100
112
|
get: function () {
|
|
101
|
-
return
|
|
113
|
+
return _useFocusableIframe.default;
|
|
102
114
|
}
|
|
103
115
|
});
|
|
104
116
|
Object.defineProperty(exports, "useInstanceId", {
|
|
@@ -125,6 +137,12 @@ Object.defineProperty(exports, "useMediaQuery", {
|
|
|
125
137
|
return _useMediaQuery.default;
|
|
126
138
|
}
|
|
127
139
|
});
|
|
140
|
+
Object.defineProperty(exports, "useMergeRefs", {
|
|
141
|
+
enumerable: true,
|
|
142
|
+
get: function () {
|
|
143
|
+
return _useMergeRefs.default;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
128
146
|
Object.defineProperty(exports, "usePrevious", {
|
|
129
147
|
enumerable: true,
|
|
130
148
|
get: function () {
|
|
@@ -137,10 +155,10 @@ Object.defineProperty(exports, "useReducedMotion", {
|
|
|
137
155
|
return _useReducedMotion.default;
|
|
138
156
|
}
|
|
139
157
|
});
|
|
140
|
-
Object.defineProperty(exports, "
|
|
158
|
+
Object.defineProperty(exports, "useRefEffect", {
|
|
141
159
|
enumerable: true,
|
|
142
160
|
get: function () {
|
|
143
|
-
return
|
|
161
|
+
return _useRefEffect.default;
|
|
144
162
|
}
|
|
145
163
|
});
|
|
146
164
|
Object.defineProperty(exports, "useResizeObserver", {
|
|
@@ -149,52 +167,46 @@ Object.defineProperty(exports, "useResizeObserver", {
|
|
|
149
167
|
return _useResizeObserver.default;
|
|
150
168
|
}
|
|
151
169
|
});
|
|
152
|
-
Object.defineProperty(exports, "
|
|
153
|
-
enumerable: true,
|
|
154
|
-
get: function () {
|
|
155
|
-
return _useAsyncList.default;
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
Object.defineProperty(exports, "useWarnOnChange", {
|
|
170
|
+
Object.defineProperty(exports, "useThrottle", {
|
|
159
171
|
enumerable: true,
|
|
160
172
|
get: function () {
|
|
161
|
-
return
|
|
173
|
+
return _useThrottle.default;
|
|
162
174
|
}
|
|
163
175
|
});
|
|
164
|
-
Object.defineProperty(exports, "
|
|
176
|
+
Object.defineProperty(exports, "useViewportMatch", {
|
|
165
177
|
enumerable: true,
|
|
166
178
|
get: function () {
|
|
167
|
-
return
|
|
179
|
+
return _useViewportMatch.default;
|
|
168
180
|
}
|
|
169
181
|
});
|
|
170
|
-
Object.defineProperty(exports, "
|
|
182
|
+
Object.defineProperty(exports, "useWarnOnChange", {
|
|
171
183
|
enumerable: true,
|
|
172
184
|
get: function () {
|
|
173
|
-
return
|
|
185
|
+
return _useWarnOnChange.default;
|
|
174
186
|
}
|
|
175
187
|
});
|
|
176
|
-
Object.defineProperty(exports, "
|
|
188
|
+
Object.defineProperty(exports, "withGlobalEvents", {
|
|
177
189
|
enumerable: true,
|
|
178
190
|
get: function () {
|
|
179
|
-
return
|
|
191
|
+
return _withGlobalEvents.default;
|
|
180
192
|
}
|
|
181
193
|
});
|
|
182
|
-
Object.defineProperty(exports, "
|
|
194
|
+
Object.defineProperty(exports, "withInstanceId", {
|
|
183
195
|
enumerable: true,
|
|
184
196
|
get: function () {
|
|
185
|
-
return
|
|
197
|
+
return _withInstanceId.default;
|
|
186
198
|
}
|
|
187
199
|
});
|
|
188
|
-
Object.defineProperty(exports, "
|
|
200
|
+
Object.defineProperty(exports, "withSafeTimeout", {
|
|
189
201
|
enumerable: true,
|
|
190
202
|
get: function () {
|
|
191
|
-
return
|
|
203
|
+
return _withSafeTimeout.default;
|
|
192
204
|
}
|
|
193
205
|
});
|
|
194
|
-
Object.defineProperty(exports, "
|
|
206
|
+
Object.defineProperty(exports, "withState", {
|
|
195
207
|
enumerable: true,
|
|
196
208
|
get: function () {
|
|
197
|
-
return
|
|
209
|
+
return _withState.default;
|
|
198
210
|
}
|
|
199
211
|
});
|
|
200
212
|
|
|
@@ -222,6 +234,8 @@ var _useCopyToClipboard = _interopRequireDefault(require("./hooks/use-copy-to-cl
|
|
|
222
234
|
|
|
223
235
|
var _useDialog = _interopRequireDefault(require("./hooks/use-dialog"));
|
|
224
236
|
|
|
237
|
+
var _useDisabled = _interopRequireDefault(require("./hooks/use-disabled"));
|
|
238
|
+
|
|
225
239
|
var _useDragging = _interopRequireDefault(require("./hooks/use-dragging"));
|
|
226
240
|
|
|
227
241
|
var _useFocusOnMount = _interopRequireDefault(require("./hooks/use-focus-on-mount"));
|
|
@@ -261,4 +275,6 @@ var _useRefEffect = _interopRequireDefault(require("./hooks/use-ref-effect"));
|
|
|
261
275
|
var _useDropZone = _interopRequireDefault(require("./hooks/use-drop-zone"));
|
|
262
276
|
|
|
263
277
|
var _useFocusableIframe = _interopRequireDefault(require("./hooks/use-focusable-iframe"));
|
|
278
|
+
|
|
279
|
+
var _useFixedWindowList = _interopRequireDefault(require("./hooks/use-fixed-window-list"));
|
|
264
280
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/compose/src/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/compose/src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAGA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["// Utils\nexport { default as createHigherOrderComponent } from './utils/create-higher-order-component';\n\n// Compose helper (aliased flowRight from Lodash)\nexport { default as compose } from './higher-order/compose';\n\n// Higher-order components\nexport { default as ifCondition } from './higher-order/if-condition';\nexport { default as pure } from './higher-order/pure';\nexport { default as withGlobalEvents } from './higher-order/with-global-events';\nexport { default as withInstanceId } from './higher-order/with-instance-id';\nexport { default as withSafeTimeout } from './higher-order/with-safe-timeout';\nexport { default as withState } from './higher-order/with-state';\n\n// Hooks\nexport { default as useConstrainedTabbing } from './hooks/use-constrained-tabbing';\nexport { default as useCopyOnClick } from './hooks/use-copy-on-click';\nexport { default as useCopyToClipboard } from './hooks/use-copy-to-clipboard';\nexport { default as __experimentalUseDialog } from './hooks/use-dialog';\nexport { default as __experimentalUseDisabled } from './hooks/use-disabled';\nexport { default as __experimentalUseDragging } from './hooks/use-dragging';\nexport { default as useFocusOnMount } from './hooks/use-focus-on-mount';\nexport { default as __experimentalUseFocusOutside } from './hooks/use-focus-outside';\nexport { default as useFocusReturn } from './hooks/use-focus-return';\nexport { default as useInstanceId } from './hooks/use-instance-id';\nexport { default as useIsomorphicLayoutEffect } from './hooks/use-isomorphic-layout-effect';\nexport { default as useKeyboardShortcut } from './hooks/use-keyboard-shortcut';\nexport { default as useMediaQuery } from './hooks/use-media-query';\nexport { default as usePrevious } from './hooks/use-previous';\nexport { default as useReducedMotion } from './hooks/use-reduced-motion';\nexport { default as useViewportMatch } from './hooks/use-viewport-match';\nexport { default as useResizeObserver } from './hooks/use-resize-observer';\nexport { default as useAsyncList } from './hooks/use-async-list';\nexport { default as useWarnOnChange } from './hooks/use-warn-on-change';\nexport { default as useDebounce } from './hooks/use-debounce';\nexport { default as useThrottle } from './hooks/use-throttle';\nexport { default as useMergeRefs } from './hooks/use-merge-refs';\nexport { default as useRefEffect } from './hooks/use-ref-effect';\nexport { default as __experimentalUseDropZone } from './hooks/use-drop-zone';\nexport { default as useFocusableIframe } from './hooks/use-focusable-iframe';\nexport { default as __experimentalUseFixedWindowList } from './hooks/use-fixed-window-list';\n"]}
|
package/build/index.native.js
CHANGED
|
@@ -5,100 +5,100 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
Object.defineProperty(exports, "
|
|
8
|
+
Object.defineProperty(exports, "__experimentalUseDragging", {
|
|
9
9
|
enumerable: true,
|
|
10
10
|
get: function () {
|
|
11
|
-
return
|
|
11
|
+
return _useDragging.default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
Object.defineProperty(exports, "
|
|
14
|
+
Object.defineProperty(exports, "__experimentalUseFocusOutside", {
|
|
15
15
|
enumerable: true,
|
|
16
16
|
get: function () {
|
|
17
|
-
return
|
|
17
|
+
return _useFocusOutside.default;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
Object.defineProperty(exports, "
|
|
20
|
+
Object.defineProperty(exports, "compose", {
|
|
21
21
|
enumerable: true,
|
|
22
22
|
get: function () {
|
|
23
|
-
return
|
|
23
|
+
return _compose.default;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
Object.defineProperty(exports, "
|
|
26
|
+
Object.defineProperty(exports, "createHigherOrderComponent", {
|
|
27
27
|
enumerable: true,
|
|
28
28
|
get: function () {
|
|
29
|
-
return
|
|
29
|
+
return _createHigherOrderComponent.default;
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
Object.defineProperty(exports, "
|
|
32
|
+
Object.defineProperty(exports, "ifCondition", {
|
|
33
33
|
enumerable: true,
|
|
34
34
|
get: function () {
|
|
35
|
-
return
|
|
35
|
+
return _ifCondition.default;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
Object.defineProperty(exports, "
|
|
38
|
+
Object.defineProperty(exports, "pure", {
|
|
39
39
|
enumerable: true,
|
|
40
40
|
get: function () {
|
|
41
|
-
return
|
|
41
|
+
return _pure.default;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
Object.defineProperty(exports, "
|
|
44
|
+
Object.defineProperty(exports, "useAsyncList", {
|
|
45
45
|
enumerable: true,
|
|
46
46
|
get: function () {
|
|
47
|
-
return
|
|
47
|
+
return _useAsyncList.default;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
Object.defineProperty(exports, "
|
|
50
|
+
Object.defineProperty(exports, "useConstrainedTabbing", {
|
|
51
51
|
enumerable: true,
|
|
52
52
|
get: function () {
|
|
53
|
-
return
|
|
53
|
+
return _useConstrainedTabbing.default;
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
-
Object.defineProperty(exports, "
|
|
56
|
+
Object.defineProperty(exports, "useDebounce", {
|
|
57
57
|
enumerable: true,
|
|
58
58
|
get: function () {
|
|
59
|
-
return
|
|
59
|
+
return _useDebounce.default;
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
Object.defineProperty(exports, "
|
|
62
|
+
Object.defineProperty(exports, "useInstanceId", {
|
|
63
63
|
enumerable: true,
|
|
64
64
|
get: function () {
|
|
65
|
-
return
|
|
65
|
+
return _useInstanceId.default;
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
-
Object.defineProperty(exports, "
|
|
68
|
+
Object.defineProperty(exports, "useIsomorphicLayoutEffect", {
|
|
69
69
|
enumerable: true,
|
|
70
70
|
get: function () {
|
|
71
|
-
return
|
|
71
|
+
return _useIsomorphicLayoutEffect.default;
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
|
-
Object.defineProperty(exports, "
|
|
74
|
+
Object.defineProperty(exports, "useKeyboardShortcut", {
|
|
75
75
|
enumerable: true,
|
|
76
76
|
get: function () {
|
|
77
|
-
return
|
|
77
|
+
return _useKeyboardShortcut.default;
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
|
-
Object.defineProperty(exports, "
|
|
80
|
+
Object.defineProperty(exports, "useMediaQuery", {
|
|
81
81
|
enumerable: true,
|
|
82
82
|
get: function () {
|
|
83
|
-
return
|
|
83
|
+
return _useMediaQuery.default;
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
|
-
Object.defineProperty(exports, "
|
|
86
|
+
Object.defineProperty(exports, "useMergeRefs", {
|
|
87
87
|
enumerable: true,
|
|
88
88
|
get: function () {
|
|
89
|
-
return
|
|
89
|
+
return _useMergeRefs.default;
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
-
Object.defineProperty(exports, "
|
|
92
|
+
Object.defineProperty(exports, "usePreferredColorScheme", {
|
|
93
93
|
enumerable: true,
|
|
94
94
|
get: function () {
|
|
95
|
-
return
|
|
95
|
+
return _usePreferredColorScheme.default;
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
|
-
Object.defineProperty(exports, "
|
|
98
|
+
Object.defineProperty(exports, "usePreferredColorSchemeStyle", {
|
|
99
99
|
enumerable: true,
|
|
100
100
|
get: function () {
|
|
101
|
-
return
|
|
101
|
+
return _usePreferredColorSchemeStyle.default;
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
Object.defineProperty(exports, "usePrevious", {
|
|
@@ -113,46 +113,46 @@ Object.defineProperty(exports, "useReducedMotion", {
|
|
|
113
113
|
return _useReducedMotion.default;
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
|
-
Object.defineProperty(exports, "
|
|
116
|
+
Object.defineProperty(exports, "useResizeObserver", {
|
|
117
117
|
enumerable: true,
|
|
118
118
|
get: function () {
|
|
119
|
-
return
|
|
119
|
+
return _useResizeObserver.default;
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
|
-
Object.defineProperty(exports, "
|
|
122
|
+
Object.defineProperty(exports, "useViewportMatch", {
|
|
123
123
|
enumerable: true,
|
|
124
124
|
get: function () {
|
|
125
|
-
return
|
|
125
|
+
return _useViewportMatch.default;
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
|
-
Object.defineProperty(exports, "
|
|
128
|
+
Object.defineProperty(exports, "withGlobalEvents", {
|
|
129
129
|
enumerable: true,
|
|
130
130
|
get: function () {
|
|
131
|
-
return
|
|
131
|
+
return _withGlobalEvents.default;
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
|
-
Object.defineProperty(exports, "
|
|
134
|
+
Object.defineProperty(exports, "withInstanceId", {
|
|
135
135
|
enumerable: true,
|
|
136
136
|
get: function () {
|
|
137
|
-
return
|
|
137
|
+
return _withInstanceId.default;
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
|
-
Object.defineProperty(exports, "
|
|
140
|
+
Object.defineProperty(exports, "withPreferredColorScheme", {
|
|
141
141
|
enumerable: true,
|
|
142
142
|
get: function () {
|
|
143
|
-
return
|
|
143
|
+
return _withPreferredColorScheme.default;
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
|
-
Object.defineProperty(exports, "
|
|
146
|
+
Object.defineProperty(exports, "withSafeTimeout", {
|
|
147
147
|
enumerable: true,
|
|
148
148
|
get: function () {
|
|
149
|
-
return
|
|
149
|
+
return _withSafeTimeout.default;
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
|
-
Object.defineProperty(exports, "
|
|
152
|
+
Object.defineProperty(exports, "withState", {
|
|
153
153
|
enumerable: true,
|
|
154
154
|
get: function () {
|
|
155
|
-
return
|
|
155
|
+
return _withState.default;
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
158
|
|
|
@@ -76,7 +76,9 @@ export default function withGlobalEvents(eventTypesToHandlers) {
|
|
|
76
76
|
event) {
|
|
77
77
|
const handler = eventTypesToHandlers[
|
|
78
78
|
/** @type {keyof GlobalEventHandlersEventMap} */
|
|
79
|
-
event.type
|
|
79
|
+
event.type
|
|
80
|
+
/* eslint-enable jsdoc/no-undefined-types */
|
|
81
|
+
];
|
|
80
82
|
|
|
81
83
|
if (typeof this.wrappedRef[handler] === 'function') {
|
|
82
84
|
this.wrappedRef[handler](event);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/compose/src/higher-order/with-global-events/index.js"],"names":["forEach","Component","forwardRef","deprecated","createHigherOrderComponent","Listener","listener","withGlobalEvents","eventTypesToHandlers","since","alternative","WrappedComponent","Wrapper","constructor","props","handleEvent","bind","handleRef","componentDidMount","_","eventType","add","componentWillUnmount","remove","event","handler","type","wrappedRef","el","forwardedRef","render","ownProps","ref"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,UAApB,QAAsC,oBAAtC;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAA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+
{"version":3,"sources":["@wordpress/compose/src/higher-order/with-global-events/index.js"],"names":["forEach","Component","forwardRef","deprecated","createHigherOrderComponent","Listener","listener","withGlobalEvents","eventTypesToHandlers","since","alternative","WrappedComponent","Wrapper","constructor","props","handleEvent","bind","handleRef","componentDidMount","_","eventType","add","componentWillUnmount","remove","event","handler","type","wrappedRef","el","forwardedRef","render","ownProps","ref"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,UAApB,QAAsC,oBAAtC;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,0BAAP,MAAuC,2CAAvC;AACA,OAAOC,QAAP,MAAqB,YAArB;AAEA;AACA;AACA;;AACA,MAAMC,QAAQ,GAAG,IAAID,QAAJ,EAAjB;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASE,gBAAT,CAA2BC,oBAA3B,EAAkD;AAChEL,EAAAA,UAAU,CAAE,6BAAF,EAAiC;AAC1CM,IAAAA,KAAK,EAAE,KADmC;AAE1CC,IAAAA,WAAW,EAAE;AAF6B,GAAjC,CAAV;AAKA,SAAON,0BAA0B,CAAIO,gBAAF,IAAwB;AAC1D,UAAMC,OAAN,SAAsBX,SAAtB,CAAgC;AAC/BY,MAAAA,WAAW;AAAE;AAAmBC,MAAAA,KAArB,EAA6B;AACvC,cAAOA,KAAP;AAEA,aAAKC,WAAL,GAAmB,KAAKA,WAAL,CAAiBC,IAAjB,CAAuB,IAAvB,CAAnB;AACA,aAAKC,SAAL,GAAiB,KAAKA,SAAL,CAAeD,IAAf,CAAqB,IAArB,CAAjB;AACA;;AAEDE,MAAAA,iBAAiB,GAAG;AACnBlB,QAAAA,OAAO,CAAEQ,oBAAF,EAAwB,CAAEW,CAAF,EAAKC,SAAL,KAAoB;AAClDd,UAAAA,QAAQ,CAACe,GAAT,CAAcD,SAAd,EAAyB,IAAzB;AACA,SAFM,CAAP;AAGA;;AAEDE,MAAAA,oBAAoB,GAAG;AACtBtB,QAAAA,OAAO,CAAEQ,oBAAF,EAAwB,CAAEW,CAAF,EAAKC,SAAL,KAAoB;AAClDd,UAAAA,QAAQ,CAACiB,MAAT,CAAiBH,SAAjB,EAA4B,IAA5B;AACA,SAFM,CAAP;AAGA;;AAEDL,MAAAA,WAAW;AAAE;AAAmBS,MAAAA,KAArB,EAA6B;AACvC,cAAMC,OAAO,GACZjB,oBAAoB;AACnB;AAAmDgB,QAAAA,KAAK,CAACE;AACzD;AAFmB,SADrB;;AAKA,YAAK,OAAO,KAAKC,UAAL,CAAiBF,OAAjB,CAAP,KAAsC,UAA3C,EAAwD;AACvD,eAAKE,UAAL,CAAiBF,OAAjB,EAA4BD,KAA5B;AACA;AACD;;AAEDP,MAAAA,SAAS;AAAE;AAAmBW,MAAAA,EAArB,EAA0B;AAClC,aAAKD,UAAL,GAAkBC,EAAlB,CADkC,CAElC;AACA;AACA;;AACA,YAAK,KAAKd,KAAL,CAAWe,YAAhB,EAA+B;AAC9B,eAAKf,KAAL,CAAWe,YAAX,CAAyBD,EAAzB;AACA;AACD;;AAEDE,MAAAA,MAAM,GAAG;AACR,eACC,cAAC,gBAAD,eACM,KAAKhB,KAAL,CAAWiB,QADjB;AAEC,UAAA,GAAG,EAAG,KAAKd;AAFZ,WADD;AAMA;;AAhD8B;;AAmDhC,WAAOf,UAAU,CAAE,CAAEY,KAAF,EAASkB,GAAT,KAAkB;AACpC,aAAO,cAAC,OAAD;AAAS,QAAA,QAAQ,EAAGlB,KAApB;AAA4B,QAAA,YAAY,EAAGkB;AAA3C,QAAP;AACA,KAFgB,CAAjB;AAGA,GAvDgC,EAuD9B,kBAvD8B,CAAjC;AAwDA","sourcesContent":["/**\n * External dependencies\n */\nimport { forEach } from 'lodash';\n\n/**\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/* eslint-disable jsdoc/no-undefined-types */\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\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\tforEach( eventTypesToHandlers, ( _, 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\tforEach( eventTypesToHandlers, ( _, 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} */ ( event.type )\n\t\t\t\t\t\t/* eslint-enable jsdoc/no-undefined-types */\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"]}
|
|
@@ -22,7 +22,8 @@ import createHigherOrderComponent from '../../utils/create-higher-order-componen
|
|
|
22
22
|
* @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.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
export default function withState(
|
|
25
|
+
export default function withState() {
|
|
26
|
+
let initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26
27
|
deprecated('wp.compose.withState', {
|
|
27
28
|
alternative: 'wp.element.useState'
|
|
28
29
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/compose/src/higher-order/with-state/index.js"],"names":["Component","deprecated","createHigherOrderComponent","withState","initialState","alternative","OriginalComponent","WrappedComponent","constructor","props","setState","bind","state","render"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,0BAAP,MAAuC,2CAAvC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,SAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/compose/src/higher-order/with-state/index.js"],"names":["Component","deprecated","createHigherOrderComponent","withState","initialState","alternative","OriginalComponent","WrappedComponent","constructor","props","setState","bind","state","render"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,0BAAP,MAAuC,2CAAvC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,SAAT,GAAwC;AAAA,MAApBC,YAAoB,uEAAL,EAAK;AACtDH,EAAAA,UAAU,CAAE,sBAAF,EAA0B;AACnCI,IAAAA,WAAW,EAAE;AADsB,GAA1B,CAAV;AAIA,SAAOH,0BAA0B,CAAII,iBAAF,IAAyB;AAC3D,WAAO,MAAMC,gBAAN,SAA+BP,SAA/B,CAAyC;AAC/CQ,MAAAA,WAAW;AAAE;AAAmBC,MAAAA,KAArB,EAA6B;AACvC,cAAOA,KAAP;AAEA,aAAKC,QAAL,GAAgB,KAAKA,QAAL,CAAcC,IAAd,CAAoB,IAApB,CAAhB;AAEA,aAAKC,KAAL,GAAaR,YAAb;AACA;;AAEDS,MAAAA,MAAM,GAAG;AACR,eACC,cAAC,iBAAD,eACM,KAAKJ,KADX,EAEM,KAAKG,KAFX;AAGC,UAAA,QAAQ,EAAG,KAAKF;AAHjB,WADD;AAOA;;AAjB8C,KAAhD;AAmBA,GApBgC,EAoB9B,WApB8B,CAAjC;AAqBA","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\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"]}
|
|
@@ -37,9 +37,10 @@ function getFirstItemsPresentInState(list, state) {
|
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
function useAsyncList(list
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
function useAsyncList(list) {
|
|
41
|
+
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
42
|
+
step: 1
|
|
43
|
+
};
|
|
43
44
|
const {
|
|
44
45
|
step = 1
|
|
45
46
|
} = config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/compose/src/hooks/use-async-list/index.ts"],"names":["useEffect","useState","createQueue","getFirstItemsPresentInState","list","state","firstItems","i","length","item","includes","push","useAsyncList","config","step","current","setCurrent","concat","slice","nextIndex","asyncQueue","append","add","reset"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,WAAT,QAA4B,2BAA5B;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,2BAAT,CAA2CC,IAA3C,EAAsDC,KAAtD,EAAwE;AACvE,QAAMC,UAAU,GAAG,EAAnB;;AAEA,OAAM,IAAIC,CAAC,GAAG,CAAd,EAAiBA,CAAC,GAAGH,IAAI,CAACI,MAA1B,EAAkCD,CAAC,EAAnC,EAAwC;AACvC,UAAME,IAAI,GAAGL,IAAI,CAAEG,CAAF,CAAjB;;AACA,QAAK,CAAEF,KAAK,CAACK,QAAN,CAAgBD,IAAhB,CAAP,EAAgC;AAC/B;AACA;;AAEDH,IAAAA,UAAU,CAACK,IAAX,CAAiBF,IAAjB;AACA;;AAED,SAAOH,UAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASM,YAAT,CACCR,IADD,
|
|
1
|
+
{"version":3,"sources":["@wordpress/compose/src/hooks/use-async-list/index.ts"],"names":["useEffect","useState","createQueue","getFirstItemsPresentInState","list","state","firstItems","i","length","item","includes","push","useAsyncList","config","step","current","setCurrent","concat","slice","nextIndex","asyncQueue","append","add","reset"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,WAAT,QAA4B,2BAA5B;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,2BAAT,CAA2CC,IAA3C,EAAsDC,KAAtD,EAAwE;AACvE,QAAMC,UAAU,GAAG,EAAnB;;AAEA,OAAM,IAAIC,CAAC,GAAG,CAAd,EAAiBA,CAAC,GAAGH,IAAI,CAACI,MAA1B,EAAkCD,CAAC,EAAnC,EAAwC;AACvC,UAAME,IAAI,GAAGL,IAAI,CAAEG,CAAF,CAAjB;;AACA,QAAK,CAAEF,KAAK,CAACK,QAAN,CAAgBD,IAAhB,CAAP,EAAgC;AAC/B;AACA;;AAEDH,IAAAA,UAAU,CAACK,IAAX,CAAiBF,IAAjB;AACA;;AAED,SAAOH,UAAP;AACA;A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H,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { 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 iin 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( [] as 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\t\tlet nextIndex = firstItems.length;\n\n\t\tconst asyncQueue = createQueue();\n\t\tconst append = () => {\n\t\t\tif ( list.length <= nextIndex ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetCurrent( ( state ) => [\n\t\t\t\t...state,\n\t\t\t\t...list.slice( nextIndex, nextIndex + step ),\n\t\t\t] );\n\t\t\tnextIndex += step;\n\t\t\tasyncQueue.add( {}, append );\n\t\t};\n\t\tasyncQueue.add( {}, append );\n\n\t\treturn () => asyncQueue.reset();\n\t}, [ list ] );\n\n\treturn current;\n}\n\nexport default useAsyncList;\n"]}
|
|
@@ -31,9 +31,9 @@ import useRefEffect from '../use-ref-effect';
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
function useConstrainedTabbing() {
|
|
34
|
-
return useRefEffect(
|
|
34
|
+
return useRefEffect((
|
|
35
35
|
/** @type {HTMLElement} */
|
|
36
|
-
node => {
|
|
36
|
+
node) => {
|
|
37
37
|
/** @type {number|undefined} */
|
|
38
38
|
let timeoutId;
|
|
39
39
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/compose/src/hooks/use-constrained-tabbing/index.js"],"names":["TAB","focus","useRefEffect","useConstrainedTabbing","node","timeoutId","onKeyDown","event","keyCode","shiftKey","target","action","nextElement","tabbable","contains","domAction","ownerDocument","trap","createElement","tabIndex","setTimeout","removeChild","addEventListener","removeEventListener","clearTimeout"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,qBAApB;AACA,SAASC,KAAT,QAAsB,gBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,mBAAzB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,qBAAT,GAAiC;AAChC,SAAOD,YAAY;
|
|
1
|
+
{"version":3,"sources":["@wordpress/compose/src/hooks/use-constrained-tabbing/index.js"],"names":["TAB","focus","useRefEffect","useConstrainedTabbing","node","timeoutId","onKeyDown","event","keyCode","shiftKey","target","action","nextElement","tabbable","contains","domAction","ownerDocument","trap","createElement","tabIndex","setTimeout","removeChild","addEventListener","removeEventListener","clearTimeout"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,qBAApB;AACA,SAASC,KAAT,QAAsB,gBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,mBAAzB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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A,GAzCkB,EAyChB,EAzCgB,CAAnB;AA0CA;;AAED,eAAeF,qBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { TAB } from '@wordpress/keycodes';\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\t/** @type {number|undefined} */\n\t\tlet timeoutId;\n\n\t\tfunction onKeyDown( /** @type {KeyboardEvent} */ event ) {\n\t\t\tconst { keyCode, shiftKey, target } = event;\n\n\t\t\tif ( keyCode !== 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// 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\tif ( node.contains( nextElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\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\t\t\ttrap.focus();\n\t\t\t// Remove after the browser moves focus to the next element.\n\t\t\ttimeoutId = setTimeout( () => node.removeChild( trap ) );\n\t\t}\n\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tclearTimeout( timeoutId );\n\t\t};\n\t}, [] );\n}\n\nexport default useConstrainedTabbing;\n"]}
|
|
@@ -24,7 +24,9 @@ import deprecated from '@wordpress/deprecated';
|
|
|
24
24
|
* timeout.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
export default function useCopyOnClick(ref, text
|
|
27
|
+
export default function useCopyOnClick(ref, text) {
|
|
28
|
+
let timeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 4000;
|
|
29
|
+
|
|
28
30
|
/* eslint-enable jsdoc/no-undefined-types */
|
|
29
31
|
deprecated('wp.compose.useCopyOnClick', {
|
|
30
32
|
since: '10.3',
|
|
@@ -47,10 +49,11 @@ export default function useCopyOnClick(ref, text, timeout = 4000) {
|
|
|
47
49
|
clipboard.current = new Clipboard(ref.current, {
|
|
48
50
|
text: () => typeof text === 'function' ? text() : text
|
|
49
51
|
});
|
|
50
|
-
clipboard.current.on('success',
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
clipboard.current.on('success', _ref => {
|
|
53
|
+
let {
|
|
54
|
+
clearSelection,
|
|
55
|
+
trigger
|
|
56
|
+
} = _ref;
|
|
54
57
|
// Clearing selection will move focus back to the triggering button,
|
|
55
58
|
// ensuring that it is not reset to the body, and further that it is
|
|
56
59
|
// kept within the rendered node.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/compose/src/hooks/use-copy-on-click/index.js"],"names":["Clipboard","useRef","useEffect","useState","deprecated","useCopyOnClick","ref","text","timeout","since","plugin","alternative","clipboard","hasCopied","setHasCopied","timeoutId","current","on","clearSelection","trigger","focus","clearTimeout","setTimeout","destroy"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,WAAtB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,SAAjB,EAA4BC,QAA5B,QAA4C,oBAA5C;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,cAAT,CAAyBC,GAAzB,EAA8BC,IAA9B,
|
|
1
|
+
{"version":3,"sources":["@wordpress/compose/src/hooks/use-copy-on-click/index.js"],"names":["Clipboard","useRef","useEffect","useState","deprecated","useCopyOnClick","ref","text","timeout","since","plugin","alternative","clipboard","hasCopied","setHasCopied","timeoutId","current","on","clearSelection","trigger","focus","clearTimeout","setTimeout","destroy"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,WAAtB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,SAAjB,EAA4BC,QAA5B,QAA4C,oBAA5C;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,cAAT,CAAyBC,GAAzB,EAA8BC,IAA9B,EAAqD;AAAA,MAAjBC,OAAiB,uEAAP,IAAO;;AACnE;AACAJ,EAAAA,UAAU,CAAE,2BAAF,EAA+B;AACxCK,IAAAA,KAAK,EAAE,MADiC;AAExCC,IAAAA,MAAM,EAAE,WAFgC;AAGxCC,IAAAA,WAAW,EAAE;AAH2B,GAA/B,CAAV;AAMA;;AACA,QAAMC,SAAS,GAAGX,MAAM,EAAxB;AACA,QAAM,CAAEY,SAAF,EAAaC,YAAb,IAA8BX,QAAQ,CAAE,KAAF,CAA5C;AAEAD,EAAAA,SAAS,CAAE,MAAM;AAChB;AACA,QAAIa,SAAJ;;AAEA,QAAK,CAAET,GAAG,CAACU,OAAX,EAAqB;AACpB;AACA,KANe,CAQhB;;;AACAJ,IAAAA,SAAS,CAACI,OAAV,GAAoB,IAAIhB,SAAJ,CAAeM,GAAG,CAACU,OAAnB,EAA4B;AAC/CT,MAAAA,IAAI,EAAE,MAAQ,OAAOA,IAAP,KAAgB,UAAhB,GAA6BA,IAAI,EAAjC,GAAsCA;AADL,KAA5B,CAApB;AAIAK,IAAAA,SAAS,CAACI,OAAV,CAAkBC,EAAlB,CAAsB,SAAtB,EAAiC,QAAmC;AAAA,UAAjC;AAAEC,QAAAA,cAAF;AAAkBC,QAAAA;AAAlB,OAAiC;AACnE;AACA;AACA;AACAD,MAAAA,cAAc,GAJqD,CAMnE;;AACA,UAAKC,OAAL,EAAe;AACd;AAA6BA,QAAAA,OAAF,CAAYC,KAAZ;AAC3B;;AAED,UAAKZ,OAAL,EAAe;AACdM,QAAAA,YAAY,CAAE,IAAF,CAAZ;AACAO,QAAAA,YAAY,CAAEN,SAAF,CAAZ;AACAA,QAAAA,SAAS,GAAGO,UAAU,CAAE,MAAMR,YAAY,CAAE,KAAF,CAApB,EAA+BN,OAA/B,CAAtB;AACA;AACD,KAhBD;AAkBA,WAAO,MAAM;AACZ,UAAKI,SAAS,CAACI,OAAf,EAAyB;AACxBJ,QAAAA,SAAS,CAACI,OAAV,CAAkBO,OAAlB;AACA;;AACDF,MAAAA,YAAY,CAAEN,SAAF,CAAZ;AACA,KALD;AAMA,GArCQ,EAqCN,CAAER,IAAF,EAAQC,OAAR,EAAiBM,YAAjB,CArCM,CAAT;AAuCA,SAAOD,SAAP;AACA","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/* eslint-disable jsdoc/no-undefined-types */\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\t/* eslint-enable jsdoc/no-undefined-types */\n\tdeprecated( 'wp.compose.useCopyOnClick', {\n\t\tsince: '10.3',\n\t\tplugin: 'Gutenberg',\n\t\talternative: 'wp.compose.useCopyToClipboard',\n\t} );\n\n\t/** @type {import('react').MutableRefObject<Clipboard | undefined>} */\n\tconst clipboard = 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\tclipboard.current = new Clipboard( ref.current, {\n\t\t\ttext: () => ( typeof text === 'function' ? text() : text ),\n\t\t} );\n\n\t\tclipboard.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 ( clipboard.current ) {\n\t\t\t\tclipboard.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"]}
|