80 /******/ // __webpack_public_path__ |
80 /******/ // __webpack_public_path__ |
81 /******/ __webpack_require__.p = ""; |
81 /******/ __webpack_require__.p = ""; |
82 /******/ |
82 /******/ |
83 /******/ |
83 /******/ |
84 /******/ // Load entry module and return exports |
84 /******/ // Load entry module and return exports |
85 /******/ return __webpack_require__(__webpack_require__.s = 445); |
85 /******/ return __webpack_require__(__webpack_require__.s = "PD33"); |
86 /******/ }) |
86 /******/ }) |
87 /************************************************************************/ |
87 /************************************************************************/ |
88 /******/ ({ |
88 /******/ ({ |
89 |
89 |
90 /***/ 0: |
90 /***/ "1CF3": |
91 /***/ (function(module, exports) { |
91 /***/ (function(module, exports) { |
92 |
92 |
93 (function() { module.exports = this["wp"]["element"]; }()); |
93 (function() { module.exports = window["wp"]["dom"]; }()); |
94 |
94 |
95 /***/ }), |
95 /***/ }), |
96 |
96 |
97 /***/ 12: |
97 /***/ "GRId": |
|
98 /***/ (function(module, exports) { |
|
99 |
|
100 (function() { module.exports = window["wp"]["element"]; }()); |
|
101 |
|
102 /***/ }), |
|
103 |
|
104 /***/ "NMb1": |
|
105 /***/ (function(module, exports) { |
|
106 |
|
107 (function() { module.exports = window["wp"]["deprecated"]; }()); |
|
108 |
|
109 /***/ }), |
|
110 |
|
111 /***/ "PD33": |
98 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
112 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
99 |
113 |
100 "use strict"; |
114 "use strict"; |
101 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; }); |
115 // ESM COMPAT FLAG |
102 function _assertThisInitialized(self) { |
116 __webpack_require__.r(__webpack_exports__); |
103 if (self === void 0) { |
117 |
104 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); |
118 // EXPORTS |
|
119 __webpack_require__.d(__webpack_exports__, "createHigherOrderComponent", function() { return /* reexport */ create_higher_order_component; }); |
|
120 __webpack_require__.d(__webpack_exports__, "compose", function() { return /* reexport */ compose; }); |
|
121 __webpack_require__.d(__webpack_exports__, "ifCondition", function() { return /* reexport */ if_condition; }); |
|
122 __webpack_require__.d(__webpack_exports__, "pure", function() { return /* reexport */ higher_order_pure; }); |
|
123 __webpack_require__.d(__webpack_exports__, "withGlobalEvents", function() { return /* reexport */ withGlobalEvents; }); |
|
124 __webpack_require__.d(__webpack_exports__, "withInstanceId", function() { return /* reexport */ with_instance_id; }); |
|
125 __webpack_require__.d(__webpack_exports__, "withSafeTimeout", function() { return /* reexport */ with_safe_timeout; }); |
|
126 __webpack_require__.d(__webpack_exports__, "withState", function() { return /* reexport */ withState; }); |
|
127 __webpack_require__.d(__webpack_exports__, "useConstrainedTabbing", function() { return /* reexport */ use_constrained_tabbing; }); |
|
128 __webpack_require__.d(__webpack_exports__, "useCopyOnClick", function() { return /* reexport */ useCopyOnClick; }); |
|
129 __webpack_require__.d(__webpack_exports__, "useCopyToClipboard", function() { return /* reexport */ useCopyToClipboard; }); |
|
130 __webpack_require__.d(__webpack_exports__, "__experimentalUseDialog", function() { return /* reexport */ use_dialog; }); |
|
131 __webpack_require__.d(__webpack_exports__, "__experimentalUseDragging", function() { return /* reexport */ useDragging; }); |
|
132 __webpack_require__.d(__webpack_exports__, "useFocusOnMount", function() { return /* reexport */ useFocusOnMount; }); |
|
133 __webpack_require__.d(__webpack_exports__, "__experimentalUseFocusOutside", function() { return /* reexport */ useFocusOutside; }); |
|
134 __webpack_require__.d(__webpack_exports__, "useFocusReturn", function() { return /* reexport */ use_focus_return; }); |
|
135 __webpack_require__.d(__webpack_exports__, "useInstanceId", function() { return /* reexport */ useInstanceId; }); |
|
136 __webpack_require__.d(__webpack_exports__, "useIsomorphicLayoutEffect", function() { return /* reexport */ use_isomorphic_layout_effect; }); |
|
137 __webpack_require__.d(__webpack_exports__, "useKeyboardShortcut", function() { return /* reexport */ use_keyboard_shortcut; }); |
|
138 __webpack_require__.d(__webpack_exports__, "useMediaQuery", function() { return /* reexport */ useMediaQuery; }); |
|
139 __webpack_require__.d(__webpack_exports__, "usePrevious", function() { return /* reexport */ usePrevious; }); |
|
140 __webpack_require__.d(__webpack_exports__, "useReducedMotion", function() { return /* reexport */ use_reduced_motion; }); |
|
141 __webpack_require__.d(__webpack_exports__, "useViewportMatch", function() { return /* reexport */ use_viewport_match; }); |
|
142 __webpack_require__.d(__webpack_exports__, "useResizeObserver", function() { return /* reexport */ use_resize_observer; }); |
|
143 __webpack_require__.d(__webpack_exports__, "useAsyncList", function() { return /* reexport */ use_async_list; }); |
|
144 __webpack_require__.d(__webpack_exports__, "useWarnOnChange", function() { return /* reexport */ use_warn_on_change; }); |
|
145 __webpack_require__.d(__webpack_exports__, "useDebounce", function() { return /* reexport */ useDebounce; }); |
|
146 __webpack_require__.d(__webpack_exports__, "useThrottle", function() { return /* reexport */ useThrottle; }); |
|
147 __webpack_require__.d(__webpack_exports__, "useMergeRefs", function() { return /* reexport */ useMergeRefs; }); |
|
148 __webpack_require__.d(__webpack_exports__, "useRefEffect", function() { return /* reexport */ useRefEffect; }); |
|
149 __webpack_require__.d(__webpack_exports__, "__experimentalUseDropZone", function() { return /* reexport */ useDropZone; }); |
|
150 |
|
151 // EXTERNAL MODULE: external "lodash" |
|
152 var external_lodash_ = __webpack_require__("YLtl"); |
|
153 |
|
154 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/utils/create-higher-order-component/index.js |
|
155 /** |
|
156 * External dependencies |
|
157 */ |
|
158 // eslint-disable-next-line no-restricted-imports |
|
159 |
|
160 /** |
|
161 * Given a function mapping a component to an enhanced component and modifier |
|
162 * name, returns the enhanced component augmented with a generated displayName. |
|
163 * |
|
164 * @param mapComponentToEnhancedComponent Function mapping component to enhanced component. |
|
165 * @param modifierName Seed name from which to generated display name. |
|
166 * |
|
167 * @return Component class with generated display name assigned. |
|
168 */ |
|
169 function createHigherOrderComponent(mapComponent, modifierName) { |
|
170 return Inner => { |
|
171 const Outer = mapComponent(Inner); |
|
172 const displayName = Inner.displayName || Inner.name || 'Component'; |
|
173 Outer.displayName = `${Object(external_lodash_["upperFirst"])(Object(external_lodash_["camelCase"])(modifierName))}(${displayName})`; |
|
174 return Outer; |
|
175 }; |
|
176 } |
|
177 |
|
178 /* harmony default export */ var create_higher_order_component = (createHigherOrderComponent); |
|
179 |
|
180 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/compose.js |
|
181 /** |
|
182 * External dependencies |
|
183 */ |
|
184 |
|
185 /** |
|
186 * Composes multiple higher-order components into a single higher-order component. Performs right-to-left function |
|
187 * composition, where each successive invocation is supplied the return value of the previous. |
|
188 * |
|
189 * @param {...Function} hocs The HOC functions to invoke. |
|
190 * |
|
191 * @return {Function} Returns the new composite function. |
|
192 */ |
|
193 |
|
194 /* harmony default export */ var compose = (external_lodash_["flowRight"]); |
|
195 |
|
196 // EXTERNAL MODULE: external ["wp","element"] |
|
197 var external_wp_element_ = __webpack_require__("GRId"); |
|
198 |
|
199 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/if-condition/index.js |
|
200 |
|
201 |
|
202 /** |
|
203 * Internal dependencies |
|
204 */ |
|
205 // eslint-disable-next-line no-duplicate-imports |
|
206 |
|
207 /** |
|
208 * Higher-order component creator, creating a new component which renders if |
|
209 * the given condition is satisfied or with the given optional prop name. |
|
210 * |
|
211 * @example |
|
212 * ```ts |
|
213 * type Props = { foo: string }; |
|
214 * const Component = ( props: Props ) => <div>{ props.foo }</div>; |
|
215 * const ConditionalComponent = ifCondition( ( props: Props ) => props.foo.length !== 0 )( Component ); |
|
216 * <ConditionalComponent foo="" />; // => null |
|
217 * <ConditionalComponent foo="bar" />; // => <div>bar</div>; |
|
218 * ``` |
|
219 * |
|
220 * @param predicate Function to test condition. |
|
221 * |
|
222 * @return Higher-order component. |
|
223 */ |
|
224 const ifCondition = predicate => create_higher_order_component(WrappedComponent => props => { |
|
225 if (!predicate(props)) { |
|
226 return null; |
105 } |
227 } |
106 |
228 |
107 return self; |
229 return Object(external_wp_element_["createElement"])(WrappedComponent, props); |
108 } |
230 }, 'ifCondition'); |
|
231 |
|
232 /* harmony default export */ var if_condition = (ifCondition); |
|
233 |
|
234 // EXTERNAL MODULE: external ["wp","isShallowEqual"] |
|
235 var external_wp_isShallowEqual_ = __webpack_require__("rl8x"); |
|
236 var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_); |
|
237 |
|
238 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/pure/index.js |
|
239 |
|
240 |
|
241 /** |
|
242 * WordPress dependencies |
|
243 */ |
|
244 |
|
245 |
|
246 /** |
|
247 * Internal dependencies |
|
248 */ |
|
249 |
|
250 // eslint-disable-next-line no-duplicate-imports |
|
251 |
|
252 /** |
|
253 * Given a component returns the enhanced component augmented with a component |
|
254 * only rerendering when its props/state change |
|
255 */ |
|
256 const pure = create_higher_order_component(Wrapped => { |
|
257 if (Wrapped.prototype instanceof external_wp_element_["Component"]) { |
|
258 return class extends Wrapped { |
|
259 shouldComponentUpdate(nextProps, nextState) { |
|
260 return !external_wp_isShallowEqual_default()(nextProps, this.props) || !external_wp_isShallowEqual_default()(nextState, this.state); |
|
261 } |
|
262 |
|
263 }; |
|
264 } |
|
265 |
|
266 return class extends external_wp_element_["Component"] { |
|
267 shouldComponentUpdate(nextProps) { |
|
268 return !external_wp_isShallowEqual_default()(nextProps, this.props); |
|
269 } |
|
270 |
|
271 render() { |
|
272 return Object(external_wp_element_["createElement"])(Wrapped, this.props); |
|
273 } |
|
274 |
|
275 }; |
|
276 }, 'pure'); |
|
277 /* harmony default export */ var higher_order_pure = (pure); |
|
278 |
|
279 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
|
280 var esm_extends = __webpack_require__("wx14"); |
|
281 |
|
282 // EXTERNAL MODULE: external ["wp","deprecated"] |
|
283 var external_wp_deprecated_ = __webpack_require__("NMb1"); |
|
284 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_); |
|
285 |
|
286 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-global-events/listener.js |
|
287 /** |
|
288 * External dependencies |
|
289 */ |
|
290 |
|
291 /** |
|
292 * Class responsible for orchestrating event handling on the global window, |
|
293 * binding a single event to be shared across all handling instances, and |
|
294 * removing the handler when no instances are listening for the event. |
|
295 */ |
|
296 |
|
297 class listener_Listener { |
|
298 constructor() { |
|
299 this.listeners = {}; |
|
300 this.handleEvent = this.handleEvent.bind(this); |
|
301 } |
|
302 |
|
303 add(eventType, instance) { |
|
304 if (!this.listeners[eventType]) { |
|
305 // Adding first listener for this type, so bind event. |
|
306 window.addEventListener(eventType, this.handleEvent); |
|
307 this.listeners[eventType] = []; |
|
308 } |
|
309 |
|
310 this.listeners[eventType].push(instance); |
|
311 } |
|
312 |
|
313 remove(eventType, instance) { |
|
314 this.listeners[eventType] = Object(external_lodash_["without"])(this.listeners[eventType], instance); |
|
315 |
|
316 if (!this.listeners[eventType].length) { |
|
317 // Removing last listener for this type, so unbind event. |
|
318 window.removeEventListener(eventType, this.handleEvent); |
|
319 delete this.listeners[eventType]; |
|
320 } |
|
321 } |
|
322 |
|
323 handleEvent(event) { |
|
324 Object(external_lodash_["forEach"])(this.listeners[event.type], instance => { |
|
325 instance.handleEvent(event); |
|
326 }); |
|
327 } |
|
328 |
|
329 } |
|
330 |
|
331 /* harmony default export */ var listener = (listener_Listener); |
|
332 |
|
333 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-global-events/index.js |
|
334 |
|
335 |
|
336 |
|
337 /** |
|
338 * External dependencies |
|
339 */ |
|
340 |
|
341 /** |
|
342 * WordPress dependencies |
|
343 */ |
|
344 |
|
345 |
|
346 |
|
347 /** |
|
348 * Internal dependencies |
|
349 */ |
|
350 |
|
351 |
|
352 |
|
353 /** |
|
354 * Listener instance responsible for managing document event handling. |
|
355 * |
|
356 * @type {Listener} |
|
357 */ |
|
358 |
|
359 const with_global_events_listener = new listener(); |
|
360 /** |
|
361 * Higher-order component creator which, given an object of DOM event types and |
|
362 * values corresponding to a callback function name on the component, will |
|
363 * create or update a window event handler to invoke the callback when an event |
|
364 * occurs. On behalf of the consuming developer, the higher-order component |
|
365 * manages unbinding when the component unmounts, and binding at most a single |
|
366 * event handler for the entire application. |
|
367 * |
|
368 * @deprecated |
|
369 * |
|
370 * @param {Object<string,string>} eventTypesToHandlers Object with keys of DOM |
|
371 * event type, the value a |
|
372 * name of the function on |
|
373 * the original component's |
|
374 * instance which handles |
|
375 * the event. |
|
376 * |
|
377 * @return {Function} Higher-order component. |
|
378 */ |
|
379 |
|
380 function withGlobalEvents(eventTypesToHandlers) { |
|
381 external_wp_deprecated_default()('wp.compose.withGlobalEvents', { |
|
382 since: '5.7', |
|
383 alternative: 'useEffect' |
|
384 }); |
|
385 return create_higher_order_component(WrappedComponent => { |
|
386 class Wrapper extends external_wp_element_["Component"] { |
|
387 constructor() { |
|
388 super(...arguments); |
|
389 this.handleEvent = this.handleEvent.bind(this); |
|
390 this.handleRef = this.handleRef.bind(this); |
|
391 } |
|
392 |
|
393 componentDidMount() { |
|
394 Object(external_lodash_["forEach"])(eventTypesToHandlers, (handler, eventType) => { |
|
395 with_global_events_listener.add(eventType, this); |
|
396 }); |
|
397 } |
|
398 |
|
399 componentWillUnmount() { |
|
400 Object(external_lodash_["forEach"])(eventTypesToHandlers, (handler, eventType) => { |
|
401 with_global_events_listener.remove(eventType, this); |
|
402 }); |
|
403 } |
|
404 |
|
405 handleEvent(event) { |
|
406 const handler = eventTypesToHandlers[event.type]; |
|
407 |
|
408 if (typeof this.wrappedRef[handler] === 'function') { |
|
409 this.wrappedRef[handler](event); |
|
410 } |
|
411 } |
|
412 |
|
413 handleRef(el) { |
|
414 this.wrappedRef = el; // Any component using `withGlobalEvents` that is not setting a `ref` |
|
415 // will cause `this.props.forwardedRef` to be `null`, so we need this |
|
416 // check. |
|
417 |
|
418 if (this.props.forwardedRef) { |
|
419 this.props.forwardedRef(el); |
|
420 } |
|
421 } |
|
422 |
|
423 render() { |
|
424 return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, this.props.ownProps, { |
|
425 ref: this.handleRef |
|
426 })); |
|
427 } |
|
428 |
|
429 } |
|
430 |
|
431 return Object(external_wp_element_["forwardRef"])((props, ref) => { |
|
432 return Object(external_wp_element_["createElement"])(Wrapper, { |
|
433 ownProps: props, |
|
434 forwardedRef: ref |
|
435 }); |
|
436 }); |
|
437 }, 'withGlobalEvents'); |
|
438 } |
|
439 |
|
440 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js |
|
441 // Disable reason: Object and object are distinctly different types in TypeScript and we mean the lowercase object in thise case |
|
442 // but eslint wants to force us to use `Object`. See https://stackoverflow.com/questions/49464634/difference-between-object-and-object-in-typescript |
|
443 |
|
444 /* eslint-disable jsdoc/check-types */ |
|
445 |
|
446 /** |
|
447 * WordPress dependencies |
|
448 */ |
|
449 |
|
450 /** |
|
451 * @type {WeakMap<object, number>} |
|
452 */ |
|
453 |
|
454 const instanceMap = new WeakMap(); |
|
455 /** |
|
456 * Creates a new id for a given object. |
|
457 * |
|
458 * @param {object} object Object reference to create an id for. |
|
459 * @return {number} The instance id (index). |
|
460 */ |
|
461 |
|
462 function createId(object) { |
|
463 const instances = instanceMap.get(object) || 0; |
|
464 instanceMap.set(object, instances + 1); |
|
465 return instances; |
|
466 } |
|
467 /** |
|
468 * Provides a unique instance ID. |
|
469 * |
|
470 * @param {object} object Object reference to create an id for. |
|
471 * @param {string} [prefix] Prefix for the unique id. |
|
472 * @param {string} [preferredId=''] Default ID to use. |
|
473 * @return {string | number} The unique instance id. |
|
474 */ |
|
475 |
|
476 |
|
477 function useInstanceId(object, prefix, preferredId = '') { |
|
478 return Object(external_wp_element_["useMemo"])(() => { |
|
479 if (preferredId) return preferredId; |
|
480 const id = createId(object); |
|
481 return prefix ? `${prefix}-${id}` : id; |
|
482 }, [object]); |
|
483 } |
|
484 /* eslint-enable jsdoc/check-types */ |
|
485 |
|
486 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-instance-id/index.js |
|
487 |
|
488 |
|
489 |
|
490 /** |
|
491 * External dependencies |
|
492 */ |
|
493 // eslint-disable-next-line no-restricted-imports |
|
494 |
|
495 /** |
|
496 * Internal dependencies |
|
497 */ |
|
498 // eslint-disable-next-line no-duplicate-imports |
|
499 |
|
500 |
|
501 /** |
|
502 * A Higher Order Component used to be provide a unique instance ID by |
|
503 * component. |
|
504 */ |
|
505 |
|
506 const withInstanceId = create_higher_order_component(WrappedComponent => { |
|
507 return props => { |
|
508 const instanceId = useInstanceId(WrappedComponent); |
|
509 return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, { |
|
510 instanceId: instanceId |
|
511 })); |
|
512 }; |
|
513 }, 'withInstanceId'); |
|
514 /* harmony default export */ var with_instance_id = (withInstanceId); |
|
515 |
|
516 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-safe-timeout/index.js |
|
517 |
|
518 |
|
519 |
|
520 /** |
|
521 * External dependencies |
|
522 */ |
|
523 |
|
524 /** |
|
525 * WordPress dependencies |
|
526 */ |
|
527 |
|
528 |
|
529 /** |
|
530 * Internal dependencies |
|
531 */ |
|
532 |
|
533 |
|
534 /** |
|
535 * A higher-order component used to provide and manage delayed function calls |
|
536 * that ought to be bound to a component's lifecycle. |
|
537 * |
|
538 * @param {WPComponent} OriginalComponent Component requiring setTimeout |
|
539 * |
|
540 * @return {WPComponent} Wrapped component. |
|
541 */ |
|
542 |
|
543 const withSafeTimeout = create_higher_order_component(OriginalComponent => { |
|
544 return class WrappedComponent extends external_wp_element_["Component"] { |
|
545 constructor() { |
|
546 super(...arguments); |
|
547 this.timeouts = []; |
|
548 this.setTimeout = this.setTimeout.bind(this); |
|
549 this.clearTimeout = this.clearTimeout.bind(this); |
|
550 } |
|
551 |
|
552 componentWillUnmount() { |
|
553 this.timeouts.forEach(clearTimeout); |
|
554 } |
|
555 |
|
556 setTimeout(fn, delay) { |
|
557 const id = setTimeout(() => { |
|
558 fn(); |
|
559 this.clearTimeout(id); |
|
560 }, delay); |
|
561 this.timeouts.push(id); |
|
562 return id; |
|
563 } |
|
564 |
|
565 clearTimeout(id) { |
|
566 clearTimeout(id); |
|
567 this.timeouts = Object(external_lodash_["without"])(this.timeouts, id); |
|
568 } |
|
569 |
|
570 render() { |
|
571 return Object(external_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, this.props, { |
|
572 setTimeout: this.setTimeout, |
|
573 clearTimeout: this.clearTimeout |
|
574 })); |
|
575 } |
|
576 |
|
577 }; |
|
578 }, 'withSafeTimeout'); |
|
579 /* harmony default export */ var with_safe_timeout = (withSafeTimeout); |
|
580 |
|
581 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-state/index.js |
|
582 |
|
583 |
|
584 |
|
585 /** |
|
586 * WordPress dependencies |
|
587 */ |
|
588 |
|
589 /** |
|
590 * Internal dependencies |
|
591 */ |
|
592 |
|
593 |
|
594 /** |
|
595 * A Higher Order Component used to provide and manage internal component state |
|
596 * via props. |
|
597 * |
|
598 * @param {?Object} initialState Optional initial state of the component. |
|
599 * |
|
600 * @return {WPComponent} Wrapped component. |
|
601 */ |
|
602 |
|
603 function withState(initialState = {}) { |
|
604 return create_higher_order_component(OriginalComponent => { |
|
605 return class WrappedComponent extends external_wp_element_["Component"] { |
|
606 constructor() { |
|
607 super(...arguments); |
|
608 this.setState = this.setState.bind(this); |
|
609 this.state = initialState; |
|
610 } |
|
611 |
|
612 render() { |
|
613 return Object(external_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, this.props, this.state, { |
|
614 setState: this.setState |
|
615 })); |
|
616 } |
|
617 |
|
618 }; |
|
619 }, 'withState'); |
|
620 } |
|
621 |
|
622 // EXTERNAL MODULE: external ["wp","keycodes"] |
|
623 var external_wp_keycodes_ = __webpack_require__("RxS6"); |
|
624 |
|
625 // EXTERNAL MODULE: external ["wp","dom"] |
|
626 var external_wp_dom_ = __webpack_require__("1CF3"); |
|
627 |
|
628 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-constrained-tabbing/index.js |
|
629 /** |
|
630 * WordPress dependencies |
|
631 */ |
|
632 |
|
633 |
|
634 |
|
635 /** |
|
636 * In Dialogs/modals, the tabbing must be constrained to the content of |
|
637 * the wrapper element. This hook adds the behavior to the returned ref. |
|
638 * |
|
639 * @return {Object|Function} Element Ref. |
|
640 * |
|
641 * @example |
|
642 * ```js |
|
643 * import { useConstrainedTabbing } from '@wordpress/compose'; |
|
644 * |
|
645 * const ConstrainedTabbingExample = () => { |
|
646 * const constrainedTabbingRef = useConstrainedTabbing() |
|
647 * return ( |
|
648 * <div ref={ constrainedTabbingRef }> |
|
649 * <Button /> |
|
650 * <Button /> |
|
651 * </div> |
|
652 * ); |
|
653 * } |
|
654 * ``` |
|
655 */ |
|
656 |
|
657 function useConstrainedTabbing() { |
|
658 const ref = Object(external_wp_element_["useCallback"])( |
|
659 /** @type {Element} */ |
|
660 node => { |
|
661 if (!node) { |
|
662 return; |
|
663 } |
|
664 |
|
665 node.addEventListener('keydown', |
|
666 /** @type {Event} */ |
|
667 event => { |
|
668 if (!(event instanceof window.KeyboardEvent)) { |
|
669 return; |
|
670 } |
|
671 |
|
672 if (event.keyCode !== external_wp_keycodes_["TAB"]) { |
|
673 return; |
|
674 } |
|
675 |
|
676 const tabbables = external_wp_dom_["focus"].tabbable.find(node); |
|
677 |
|
678 if (!tabbables.length) { |
|
679 return; |
|
680 } |
|
681 |
|
682 const firstTabbable = tabbables[0]; |
|
683 const lastTabbable = tabbables[tabbables.length - 1]; |
|
684 |
|
685 if (event.shiftKey && event.target === firstTabbable) { |
|
686 event.preventDefault(); |
|
687 /** @type {HTMLElement} */ |
|
688 |
|
689 lastTabbable.focus(); |
|
690 } else if (!event.shiftKey && event.target === lastTabbable) { |
|
691 event.preventDefault(); |
|
692 /** @type {HTMLElement} */ |
|
693 |
|
694 firstTabbable.focus(); |
|
695 /* |
|
696 * When pressing Tab and none of the tabbables has focus, the keydown |
|
697 * event happens on the wrapper div: move focus on the first tabbable. |
|
698 */ |
|
699 } else if (!tabbables.includes( |
|
700 /** @type {Element} */ |
|
701 event.target)) { |
|
702 event.preventDefault(); |
|
703 /** @type {HTMLElement} */ |
|
704 |
|
705 firstTabbable.focus(); |
|
706 } |
|
707 }); |
|
708 }, []); |
|
709 return ref; |
|
710 } |
|
711 |
|
712 /* harmony default export */ var use_constrained_tabbing = (useConstrainedTabbing); |
|
713 |
|
714 // EXTERNAL MODULE: ./node_modules/clipboard/dist/clipboard.js |
|
715 var dist_clipboard = __webpack_require__("sxGJ"); |
|
716 var clipboard_default = /*#__PURE__*/__webpack_require__.n(dist_clipboard); |
|
717 |
|
718 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-copy-on-click/index.js |
|
719 /** |
|
720 * External dependencies |
|
721 */ |
|
722 |
|
723 /** |
|
724 * WordPress dependencies |
|
725 */ |
|
726 |
|
727 |
|
728 |
|
729 /** |
|
730 * Copies the text to the clipboard when the element is clicked. |
|
731 * |
|
732 * @deprecated |
|
733 * |
|
734 * @param {Object} ref Reference with the element. |
|
735 * @param {string|Function} text The text to copy. |
|
736 * @param {number} timeout Optional timeout to reset the returned |
|
737 * state. 4 seconds by default. |
|
738 * |
|
739 * @return {boolean} Whether or not the text has been copied. Resets after the |
|
740 * timeout. |
|
741 */ |
|
742 |
|
743 function useCopyOnClick(ref, text, timeout = 4000) { |
|
744 external_wp_deprecated_default()('wp.compose.useCopyOnClick', { |
|
745 since: '10.3', |
|
746 plugin: 'Gutenberg', |
|
747 alternative: 'wp.compose.useCopyToClipboard' |
|
748 }); |
|
749 const clipboard = Object(external_wp_element_["useRef"])(); |
|
750 const [hasCopied, setHasCopied] = Object(external_wp_element_["useState"])(false); |
|
751 Object(external_wp_element_["useEffect"])(() => { |
|
752 let timeoutId; // Clipboard listens to click events. |
|
753 |
|
754 clipboard.current = new clipboard_default.a(ref.current, { |
|
755 text: () => typeof text === 'function' ? text() : text |
|
756 }); |
|
757 clipboard.current.on('success', ({ |
|
758 clearSelection, |
|
759 trigger |
|
760 }) => { |
|
761 // Clearing selection will move focus back to the triggering button, |
|
762 // ensuring that it is not reset to the body, and further that it is |
|
763 // kept within the rendered node. |
|
764 clearSelection(); // Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680 |
|
765 |
|
766 if (trigger) { |
|
767 trigger.focus(); |
|
768 } |
|
769 |
|
770 if (timeout) { |
|
771 setHasCopied(true); |
|
772 clearTimeout(timeoutId); |
|
773 timeoutId = setTimeout(() => setHasCopied(false), timeout); |
|
774 } |
|
775 }); |
|
776 return () => { |
|
777 clipboard.current.destroy(); |
|
778 clearTimeout(timeoutId); |
|
779 }; |
|
780 }, [text, timeout, setHasCopied]); |
|
781 return hasCopied; |
|
782 } |
|
783 |
|
784 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-ref-effect/index.js |
|
785 /** |
|
786 * WordPress dependencies |
|
787 */ |
|
788 |
|
789 /** |
|
790 * Effect-like ref callback. Just like with `useEffect`, this allows you to |
|
791 * return a cleanup function to be run if the ref changes or one of the |
|
792 * dependencies changes. The ref is provided as an argument to the callback |
|
793 * functions. The main difference between this and `useEffect` is that |
|
794 * the `useEffect` callback is not called when the ref changes, but this is. |
|
795 * Pass the returned ref callback as the component's ref and merge multiple refs |
|
796 * with `useMergeRefs`. |
|
797 * |
|
798 * It's worth noting that if the dependencies array is empty, there's not |
|
799 * strictly a need to clean up event handlers for example, because the node is |
|
800 * to be removed. It *is* necessary if you add dependencies because the ref |
|
801 * callback will be called multiple times for the same node. |
|
802 * |
|
803 * @param {Function} callback Callback with ref as argument. |
|
804 * @param {Array} dependencies Dependencies of the callback. |
|
805 * |
|
806 * @return {Function} Ref callback. |
|
807 */ |
|
808 |
|
809 function useRefEffect(callback, dependencies) { |
|
810 const cleanup = Object(external_wp_element_["useRef"])(); |
|
811 return Object(external_wp_element_["useCallback"])(node => { |
|
812 if (node) { |
|
813 cleanup.current = callback(node); |
|
814 } else if (cleanup.current) { |
|
815 cleanup.current(); |
|
816 } |
|
817 }, dependencies); |
|
818 } |
|
819 |
|
820 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-copy-to-clipboard/index.js |
|
821 /** |
|
822 * External dependencies |
|
823 */ |
|
824 |
|
825 /** |
|
826 * WordPress dependencies |
|
827 */ |
|
828 |
|
829 |
|
830 /** |
|
831 * Internal dependencies |
|
832 */ |
|
833 |
|
834 |
|
835 /** @typedef {import('@wordpress/element').RefObject} RefObject */ |
|
836 |
|
837 function useUpdatedRef(value) { |
|
838 const ref = Object(external_wp_element_["useRef"])(value); |
|
839 ref.current = value; |
|
840 return ref; |
|
841 } |
|
842 /** |
|
843 * Copies the given text to the clipboard when the element is clicked. |
|
844 * |
|
845 * @param {text|Function} text The text to copy. Use a function if not |
|
846 * already available and expensive to compute. |
|
847 * @param {Function} onSuccess Called when to text is copied. |
|
848 * |
|
849 * @return {RefObject} A ref to assign to the target element. |
|
850 */ |
|
851 |
|
852 |
|
853 function useCopyToClipboard(text, onSuccess) { |
|
854 // Store the dependencies as refs and continuesly update them so they're |
|
855 // fresh when the callback is called. |
|
856 const textRef = useUpdatedRef(text); |
|
857 const onSuccesRef = useUpdatedRef(onSuccess); |
|
858 return useRefEffect(node => { |
|
859 // Clipboard listens to click events. |
|
860 const clipboard = new clipboard_default.a(node, { |
|
861 text() { |
|
862 return typeof textRef.current === 'function' ? textRef.current() : textRef.current; |
|
863 } |
|
864 |
|
865 }); |
|
866 clipboard.on('success', ({ |
|
867 clearSelection |
|
868 }) => { |
|
869 // Clearing selection will move focus back to the triggering |
|
870 // button, ensuring that it is not reset to the body, and |
|
871 // further that it is kept within the rendered node. |
|
872 clearSelection(); // Handle ClipboardJS focus bug, see |
|
873 // https://github.com/zenorocha/clipboard.js/issues/680 |
|
874 |
|
875 node.focus(); |
|
876 |
|
877 if (onSuccesRef.current) { |
|
878 onSuccesRef.current(); |
|
879 } |
|
880 }); |
|
881 return () => { |
|
882 clipboard.destroy(); |
|
883 }; |
|
884 }, []); |
|
885 } |
|
886 |
|
887 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-focus-on-mount/index.js |
|
888 /** |
|
889 * WordPress dependencies |
|
890 */ |
|
891 |
|
892 |
|
893 /** |
|
894 * Hook used to focus the first tabbable element on mount. |
|
895 * |
|
896 * @param {boolean|string} focusOnMount Focus on mount mode. |
|
897 * @return {Function} Ref callback. |
|
898 * |
|
899 * @example |
|
900 * ```js |
|
901 * import { useFocusOnMount } from '@wordpress/compose'; |
|
902 * |
|
903 * const WithFocusOnMount = () => { |
|
904 * const ref = useFocusOnMount() |
|
905 * return ( |
|
906 * <div ref={ ref }> |
|
907 * <Button /> |
|
908 * <Button /> |
|
909 * </div> |
|
910 * ); |
|
911 * } |
|
912 * ``` |
|
913 */ |
|
914 |
|
915 function useFocusOnMount(focusOnMount = 'firstElement') { |
|
916 const focusOnMountRef = Object(external_wp_element_["useRef"])(focusOnMount); |
|
917 Object(external_wp_element_["useEffect"])(() => { |
|
918 focusOnMountRef.current = focusOnMount; |
|
919 }, [focusOnMount]); |
|
920 return Object(external_wp_element_["useCallback"])(node => { |
|
921 if (!node || focusOnMountRef.current === false) { |
|
922 return; |
|
923 } |
|
924 |
|
925 if (node.contains(node.ownerDocument.activeElement)) { |
|
926 return; |
|
927 } |
|
928 |
|
929 let target = node; |
|
930 |
|
931 if (focusOnMountRef.current === 'firstElement') { |
|
932 const firstTabbable = external_wp_dom_["focus"].tabbable.find(node)[0]; |
|
933 |
|
934 if (firstTabbable) { |
|
935 target = firstTabbable; |
|
936 } |
|
937 } |
|
938 |
|
939 target.focus(); |
|
940 }, []); |
|
941 } |
|
942 |
|
943 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-focus-return/index.js |
|
944 /** |
|
945 * WordPress dependencies |
|
946 */ |
|
947 |
|
948 /** |
|
949 * When opening modals/sidebars/dialogs, the focus |
|
950 * must move to the opened area and return to the |
|
951 * previously focused element when closed. |
|
952 * The current hook implements the returning behavior. |
|
953 * |
|
954 * @param {Function?} onFocusReturn Overrides the default return behavior. |
|
955 * @return {Function} Element Ref. |
|
956 * |
|
957 * @example |
|
958 * ```js |
|
959 * import { useFocusReturn } from '@wordpress/compose'; |
|
960 * |
|
961 * const WithFocusReturn = () => { |
|
962 * const ref = useFocusReturn() |
|
963 * return ( |
|
964 * <div ref={ ref }> |
|
965 * <Button /> |
|
966 * <Button /> |
|
967 * </div> |
|
968 * ); |
|
969 * } |
|
970 * ``` |
|
971 */ |
|
972 |
|
973 function useFocusReturn(onFocusReturn) { |
|
974 const ref = Object(external_wp_element_["useRef"])(); |
|
975 const focusedBeforeMount = Object(external_wp_element_["useRef"])(); |
|
976 const onFocusReturnRef = Object(external_wp_element_["useRef"])(onFocusReturn); |
|
977 Object(external_wp_element_["useEffect"])(() => { |
|
978 onFocusReturnRef.current = onFocusReturn; |
|
979 }, [onFocusReturn]); |
|
980 return Object(external_wp_element_["useCallback"])(node => { |
|
981 if (node) { |
|
982 // Set ref to be used when unmounting. |
|
983 ref.current = node; // Only set when the node mounts. |
|
984 |
|
985 if (focusedBeforeMount.current) { |
|
986 return; |
|
987 } |
|
988 |
|
989 focusedBeforeMount.current = node.ownerDocument.activeElement; |
|
990 } else if (focusedBeforeMount.current) { |
|
991 const isFocused = ref.current.contains(ref.current.ownerDocument.activeElement); |
|
992 |
|
993 if (ref.current.isConnected && !isFocused) { |
|
994 return; |
|
995 } // Defer to the component's own explicit focus return behavior, if |
|
996 // specified. This allows for support that the `onFocusReturn` |
|
997 // decides to allow the default behavior to occur under some |
|
998 // conditions. |
|
999 |
|
1000 |
|
1001 if (onFocusReturnRef.current) { |
|
1002 onFocusReturnRef.current(); |
|
1003 } else { |
|
1004 focusedBeforeMount.current.focus(); |
|
1005 } |
|
1006 } |
|
1007 }, []); |
|
1008 } |
|
1009 |
|
1010 /* harmony default export */ var use_focus_return = (useFocusReturn); |
|
1011 |
|
1012 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-focus-outside/index.js |
|
1013 /** |
|
1014 * External dependencies |
|
1015 */ |
|
1016 |
|
1017 /** |
|
1018 * WordPress dependencies |
|
1019 */ |
|
1020 |
|
1021 |
|
1022 /** |
|
1023 * Input types which are classified as button types, for use in considering |
|
1024 * whether element is a (focus-normalized) button. |
|
1025 * |
|
1026 * @type {string[]} |
|
1027 */ |
|
1028 |
|
1029 const INPUT_BUTTON_TYPES = ['button', 'submit']; |
|
1030 /** |
|
1031 * @typedef {HTMLButtonElement | HTMLLinkElement | HTMLInputElement} FocusNormalizedButton |
|
1032 */ |
|
1033 // Disable reason: Rule doesn't support predicate return types |
|
1034 |
|
1035 /* eslint-disable jsdoc/valid-types */ |
|
1036 |
|
1037 /** |
|
1038 * Returns true if the given element is a button element subject to focus |
|
1039 * normalization, or false otherwise. |
|
1040 * |
|
1041 * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus |
|
1042 * |
|
1043 * @param {EventTarget} eventTarget The target from a mouse or touch event. |
|
1044 * |
|
1045 * @return {eventTarget is FocusNormalizedButton} Whether element is a button. |
|
1046 */ |
|
1047 |
|
1048 function isFocusNormalizedButton(eventTarget) { |
|
1049 if (!(eventTarget instanceof window.HTMLElement)) { |
|
1050 return false; |
|
1051 } |
|
1052 |
|
1053 switch (eventTarget.nodeName) { |
|
1054 case 'A': |
|
1055 case 'BUTTON': |
|
1056 return true; |
|
1057 |
|
1058 case 'INPUT': |
|
1059 return Object(external_lodash_["includes"])(INPUT_BUTTON_TYPES, |
|
1060 /** @type {HTMLInputElement} */ |
|
1061 eventTarget.type); |
|
1062 } |
|
1063 |
|
1064 return false; |
|
1065 } |
|
1066 /* eslint-enable jsdoc/valid-types */ |
|
1067 |
|
1068 /** |
|
1069 * @typedef {import('react').SyntheticEvent} SyntheticEvent |
|
1070 */ |
|
1071 |
|
1072 /** |
|
1073 * @callback EventCallback |
|
1074 * @param {SyntheticEvent} event input related event. |
|
1075 */ |
|
1076 |
|
1077 /** |
|
1078 * @typedef FocusOutsideReactElement |
|
1079 * @property {EventCallback} handleFocusOutside callback for a focus outside event. |
|
1080 */ |
|
1081 |
|
1082 /** |
|
1083 * @typedef {import('react').MutableRefObject<FocusOutsideReactElement | undefined>} FocusOutsideRef |
|
1084 */ |
|
1085 |
|
1086 /** |
|
1087 * @typedef {Object} FocusOutsideReturnValue |
|
1088 * @property {EventCallback} onFocus An event handler for focus events. |
|
1089 * @property {EventCallback} onBlur An event handler for blur events. |
|
1090 * @property {EventCallback} onMouseDown An event handler for mouse down events. |
|
1091 * @property {EventCallback} onMouseUp An event handler for mouse up events. |
|
1092 * @property {EventCallback} onTouchStart An event handler for touch start events. |
|
1093 * @property {EventCallback} onTouchEnd An event handler for touch end events. |
|
1094 */ |
|
1095 |
|
1096 /** |
|
1097 * A react hook that can be used to check whether focus has moved outside the |
|
1098 * element the event handlers are bound to. |
|
1099 * |
|
1100 * @param {EventCallback} onFocusOutside A callback triggered when focus moves outside |
|
1101 * the element the event handlers are bound to. |
|
1102 * |
|
1103 * @return {FocusOutsideReturnValue} An object containing event handlers. Bind the event handlers |
|
1104 * to a wrapping element element to capture when focus moves |
|
1105 * outside that element. |
|
1106 */ |
|
1107 |
|
1108 |
|
1109 function useFocusOutside(onFocusOutside) { |
|
1110 const currentOnFocusOutside = Object(external_wp_element_["useRef"])(onFocusOutside); |
|
1111 Object(external_wp_element_["useEffect"])(() => { |
|
1112 currentOnFocusOutside.current = onFocusOutside; |
|
1113 }, [onFocusOutside]); |
|
1114 const preventBlurCheck = Object(external_wp_element_["useRef"])(false); |
|
1115 /** |
|
1116 * @type {import('react').MutableRefObject<number | undefined>} |
|
1117 */ |
|
1118 |
|
1119 const blurCheckTimeoutId = Object(external_wp_element_["useRef"])(); |
|
1120 /** |
|
1121 * Cancel a blur check timeout. |
|
1122 */ |
|
1123 |
|
1124 const cancelBlurCheck = Object(external_wp_element_["useCallback"])(() => { |
|
1125 clearTimeout(blurCheckTimeoutId.current); |
|
1126 }, []); // Cancel blur checks on unmount. |
|
1127 |
|
1128 Object(external_wp_element_["useEffect"])(() => { |
|
1129 return () => cancelBlurCheck(); |
|
1130 }, []); // Cancel a blur check if the callback or ref is no longer provided. |
|
1131 |
|
1132 Object(external_wp_element_["useEffect"])(() => { |
|
1133 if (!onFocusOutside) { |
|
1134 cancelBlurCheck(); |
|
1135 } |
|
1136 }, [onFocusOutside, cancelBlurCheck]); |
|
1137 /** |
|
1138 * Handles a mousedown or mouseup event to respectively assign and |
|
1139 * unassign a flag for preventing blur check on button elements. Some |
|
1140 * browsers, namely Firefox and Safari, do not emit a focus event on |
|
1141 * button elements when clicked, while others do. The logic here |
|
1142 * intends to normalize this as treating click on buttons as focus. |
|
1143 * |
|
1144 * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus |
|
1145 * |
|
1146 * @param {SyntheticEvent} event Event for mousedown or mouseup. |
|
1147 */ |
|
1148 |
|
1149 const normalizeButtonFocus = Object(external_wp_element_["useCallback"])(event => { |
|
1150 const { |
|
1151 type, |
|
1152 target |
|
1153 } = event; |
|
1154 const isInteractionEnd = Object(external_lodash_["includes"])(['mouseup', 'touchend'], type); |
|
1155 |
|
1156 if (isInteractionEnd) { |
|
1157 preventBlurCheck.current = false; |
|
1158 } else if (isFocusNormalizedButton(target)) { |
|
1159 preventBlurCheck.current = true; |
|
1160 } |
|
1161 }, []); |
|
1162 /** |
|
1163 * A callback triggered when a blur event occurs on the element the handler |
|
1164 * is bound to. |
|
1165 * |
|
1166 * Calls the `onFocusOutside` callback in an immediate timeout if focus has |
|
1167 * move outside the bound element and is still within the document. |
|
1168 * |
|
1169 * @param {SyntheticEvent} event Blur event. |
|
1170 */ |
|
1171 |
|
1172 const queueBlurCheck = Object(external_wp_element_["useCallback"])(event => { |
|
1173 // React does not allow using an event reference asynchronously |
|
1174 // due to recycling behavior, except when explicitly persisted. |
|
1175 event.persist(); // Skip blur check if clicking button. See `normalizeButtonFocus`. |
|
1176 |
|
1177 if (preventBlurCheck.current) { |
|
1178 return; |
|
1179 } |
|
1180 |
|
1181 blurCheckTimeoutId.current = setTimeout(() => { |
|
1182 // If document is not focused then focus should remain |
|
1183 // inside the wrapped component and therefore we cancel |
|
1184 // this blur event thereby leaving focus in place. |
|
1185 // https://developer.mozilla.org/en-US/docs/Web/API/Document/hasFocus. |
|
1186 if (!document.hasFocus()) { |
|
1187 event.preventDefault(); |
|
1188 return; |
|
1189 } |
|
1190 |
|
1191 if ('function' === typeof currentOnFocusOutside.current) { |
|
1192 currentOnFocusOutside.current(event); |
|
1193 } |
|
1194 }, 0); |
|
1195 }, []); |
|
1196 return { |
|
1197 onFocus: cancelBlurCheck, |
|
1198 onMouseDown: normalizeButtonFocus, |
|
1199 onMouseUp: normalizeButtonFocus, |
|
1200 onTouchStart: normalizeButtonFocus, |
|
1201 onTouchEnd: normalizeButtonFocus, |
|
1202 onBlur: queueBlurCheck |
|
1203 }; |
|
1204 } |
|
1205 |
|
1206 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-merge-refs/index.js |
|
1207 /** |
|
1208 * WordPress dependencies |
|
1209 */ |
|
1210 |
|
1211 /** @typedef {import('@wordpress/element').RefObject} RefObject */ |
|
1212 |
|
1213 /** @typedef {import('@wordpress/element').RefCallback} RefCallback */ |
|
1214 |
|
1215 function assignRef(ref, value) { |
|
1216 if (typeof ref === 'function') { |
|
1217 ref(value); |
|
1218 } else if (ref && ref.hasOwnProperty('current')) { |
|
1219 ref.current = value; |
|
1220 } |
|
1221 } |
|
1222 /** |
|
1223 * Merges refs into one ref callback. Ensures the merged ref callbacks are only |
|
1224 * called when it changes (as a result of a `useCallback` dependency update) or |
|
1225 * when the ref value changes. If you don't wish a ref callback to be called on |
|
1226 * every render, wrap it with `useCallback( ref, [] )`. |
|
1227 * Dependencies can be added, but when a dependency changes, the old ref |
|
1228 * callback will be called with `null` and the new ref callback will be called |
|
1229 * with the same node. |
|
1230 * |
|
1231 * @param {Array<RefObject|RefCallback>} refs The refs to be merged. |
|
1232 * |
|
1233 * @return {RefCallback} The merged ref callback. |
|
1234 */ |
|
1235 |
|
1236 |
|
1237 function useMergeRefs(refs) { |
|
1238 const element = Object(external_wp_element_["useRef"])(); |
|
1239 const didElementChange = Object(external_wp_element_["useRef"])(false); |
|
1240 const previousRefs = Object(external_wp_element_["useRef"])([]); |
|
1241 const currentRefs = Object(external_wp_element_["useRef"])(refs); // Update on render before the ref callback is called, so the ref callback |
|
1242 // always has access to the current refs. |
|
1243 |
|
1244 currentRefs.current = refs; // If any of the refs change, call the previous ref with `null` and the new |
|
1245 // ref with the node, except when the element changes in the same cycle, in |
|
1246 // which case the ref callbacks will already have been called. |
|
1247 |
|
1248 Object(external_wp_element_["useLayoutEffect"])(() => { |
|
1249 if (didElementChange.current === false) { |
|
1250 refs.forEach((ref, index) => { |
|
1251 const previousRef = previousRefs.current[index]; |
|
1252 |
|
1253 if (ref !== previousRef) { |
|
1254 assignRef(previousRef, null); |
|
1255 assignRef(ref, element.current); |
|
1256 } |
|
1257 }); |
|
1258 } |
|
1259 |
|
1260 previousRefs.current = refs; |
|
1261 }, refs); // No dependencies, must be reset after every render so ref callbacks are |
|
1262 // correctly called after a ref change. |
|
1263 |
|
1264 Object(external_wp_element_["useLayoutEffect"])(() => { |
|
1265 didElementChange.current = false; |
|
1266 }); // There should be no dependencies so that `callback` is only called when |
|
1267 // the node changes. |
|
1268 |
|
1269 return Object(external_wp_element_["useCallback"])(value => { |
|
1270 // Update the element so it can be used when calling ref callbacks on a |
|
1271 // dependency change. |
|
1272 assignRef(element, value); |
|
1273 didElementChange.current = true; // When an element changes, the current ref callback should be called |
|
1274 // with the new element and the previous one with `null`. |
|
1275 |
|
1276 const refsToAssign = value ? currentRefs.current : previousRefs.current; // Update the latest refs. |
|
1277 |
|
1278 for (const ref of refsToAssign) { |
|
1279 assignRef(ref, value); |
|
1280 } |
|
1281 }, []); |
|
1282 } |
|
1283 |
|
1284 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-dialog/index.js |
|
1285 /** |
|
1286 * WordPress dependencies |
|
1287 */ |
|
1288 |
|
1289 |
|
1290 /** |
|
1291 * Internal dependencies |
|
1292 */ |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 /** |
|
1300 * Returns a ref and props to apply to a dialog wrapper to enable the following behaviors: |
|
1301 * - constrained tabbing. |
|
1302 * - focus on mount. |
|
1303 * - return focus on unmount. |
|
1304 * - focus outside. |
|
1305 * |
|
1306 * @param {Object} options Dialog Options. |
|
1307 */ |
|
1308 |
|
1309 function useDialog(options) { |
|
1310 const onClose = Object(external_wp_element_["useRef"])(); |
|
1311 Object(external_wp_element_["useEffect"])(() => { |
|
1312 onClose.current = options.onClose; |
|
1313 }, [options.onClose]); |
|
1314 const constrainedTabbingRef = use_constrained_tabbing(); |
|
1315 const focusOnMountRef = useFocusOnMount(); |
|
1316 const focusReturnRef = use_focus_return(); |
|
1317 const focusOutsideProps = useFocusOutside(options.onClose); |
|
1318 const closeOnEscapeRef = Object(external_wp_element_["useCallback"])(node => { |
|
1319 if (!node) { |
|
1320 return; |
|
1321 } |
|
1322 |
|
1323 node.addEventListener('keydown', event => { |
|
1324 // Close on escape |
|
1325 if (event.keyCode === external_wp_keycodes_["ESCAPE"] && onClose.current) { |
|
1326 event.stopPropagation(); |
|
1327 onClose.current(); |
|
1328 } |
|
1329 }); |
|
1330 }, []); |
|
1331 return [useMergeRefs([constrainedTabbingRef, focusReturnRef, focusOnMountRef, closeOnEscapeRef]), { ...focusOutsideProps, |
|
1332 tabIndex: '-1' |
|
1333 }]; |
|
1334 } |
|
1335 |
|
1336 /* harmony default export */ var use_dialog = (useDialog); |
|
1337 |
|
1338 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-isomorphic-layout-effect/index.js |
|
1339 /** |
|
1340 * WordPress dependencies |
|
1341 */ |
|
1342 |
|
1343 /** |
|
1344 * Preferred over direct usage of `useLayoutEffect` when supporting |
|
1345 * server rendered components (SSR) because currently React |
|
1346 * throws a warning when using useLayoutEffect in that environment. |
|
1347 */ |
|
1348 |
|
1349 const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? external_wp_element_["useLayoutEffect"] : external_wp_element_["useEffect"]; |
|
1350 /* harmony default export */ var use_isomorphic_layout_effect = (useIsomorphicLayoutEffect); |
|
1351 |
|
1352 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-dragging/index.js |
|
1353 /** |
|
1354 * WordPress dependencies |
|
1355 */ |
|
1356 |
|
1357 /** |
|
1358 * Internal dependencies |
|
1359 */ |
|
1360 |
|
1361 |
|
1362 function useDragging({ |
|
1363 onDragStart, |
|
1364 onDragMove, |
|
1365 onDragEnd |
|
1366 }) { |
|
1367 const [isDragging, setIsDragging] = Object(external_wp_element_["useState"])(false); |
|
1368 const eventsRef = Object(external_wp_element_["useRef"])({ |
|
1369 onDragStart, |
|
1370 onDragMove, |
|
1371 onDragEnd |
|
1372 }); |
|
1373 use_isomorphic_layout_effect(() => { |
|
1374 eventsRef.current.onDragStart = onDragStart; |
|
1375 eventsRef.current.onDragMove = onDragMove; |
|
1376 eventsRef.current.onDragEnd = onDragEnd; |
|
1377 }, [onDragStart, onDragMove, onDragEnd]); |
|
1378 const onMouseMove = Object(external_wp_element_["useCallback"])((...args) => eventsRef.current.onDragMove && eventsRef.current.onDragMove(...args), []); |
|
1379 const endDrag = Object(external_wp_element_["useCallback"])((...args) => { |
|
1380 if (eventsRef.current.onDragEnd) { |
|
1381 eventsRef.current.onDragEnd(...args); |
|
1382 } |
|
1383 |
|
1384 document.removeEventListener('mousemove', onMouseMove); |
|
1385 document.removeEventListener('mouseup', endDrag); |
|
1386 setIsDragging(false); |
|
1387 }, []); |
|
1388 const startDrag = Object(external_wp_element_["useCallback"])((...args) => { |
|
1389 if (eventsRef.current.onDragStart) { |
|
1390 eventsRef.current.onDragStart(...args); |
|
1391 } |
|
1392 |
|
1393 document.addEventListener('mousemove', onMouseMove); |
|
1394 document.addEventListener('mouseup', endDrag); |
|
1395 setIsDragging(true); |
|
1396 }, []); // Remove the global events when unmounting if needed. |
|
1397 |
|
1398 Object(external_wp_element_["useEffect"])(() => { |
|
1399 return () => { |
|
1400 if (isDragging) { |
|
1401 document.removeEventListener('mousemove', onMouseMove); |
|
1402 document.removeEventListener('mouseup', endDrag); |
|
1403 } |
|
1404 }; |
|
1405 }, [isDragging]); |
|
1406 return { |
|
1407 startDrag, |
|
1408 endDrag, |
|
1409 isDragging |
|
1410 }; |
|
1411 } |
|
1412 |
|
1413 // EXTERNAL MODULE: ./node_modules/mousetrap/mousetrap.js |
|
1414 var mousetrap_mousetrap = __webpack_require__("imBb"); |
|
1415 var mousetrap_default = /*#__PURE__*/__webpack_require__.n(mousetrap_mousetrap); |
|
1416 |
|
1417 // EXTERNAL MODULE: ./node_modules/mousetrap/plugins/global-bind/mousetrap-global-bind.js |
|
1418 var mousetrap_global_bind = __webpack_require__("VcSt"); |
|
1419 |
|
1420 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-keyboard-shortcut/index.js |
|
1421 /** |
|
1422 * External dependencies |
|
1423 */ |
|
1424 |
|
1425 |
|
1426 |
|
1427 /** |
|
1428 * WordPress dependencies |
|
1429 */ |
|
1430 |
|
1431 |
|
1432 /** |
|
1433 * A block selection object. |
|
1434 * |
|
1435 * @typedef {Object} WPKeyboardShortcutConfig |
|
1436 * |
|
1437 * @property {boolean} [bindGlobal] Handle keyboard events anywhere including inside textarea/input fields. |
|
1438 * @property {string} [eventName] Event name used to trigger the handler, defaults to keydown. |
|
1439 * @property {boolean} [isDisabled] Disables the keyboard handler if the value is true. |
|
1440 * @property {Object} [target] React reference to the DOM element used to catch the keyboard event. |
|
1441 */ |
|
1442 |
|
1443 /** |
|
1444 * Return true if platform is MacOS. |
|
1445 * |
|
1446 * @param {Object} _window window object by default; used for DI testing. |
|
1447 * |
|
1448 * @return {boolean} True if MacOS; false otherwise. |
|
1449 */ |
|
1450 |
|
1451 function isAppleOS(_window = window) { |
|
1452 const { |
|
1453 platform |
|
1454 } = _window.navigator; |
|
1455 return platform.indexOf('Mac') !== -1 || Object(external_lodash_["includes"])(['iPad', 'iPhone'], platform); |
|
1456 } |
|
1457 /** |
|
1458 * Attach a keyboard shortcut handler. |
|
1459 * |
|
1460 * @param {string[]|string} shortcuts Keyboard Shortcuts. |
|
1461 * @param {Function} callback Shortcut callback. |
|
1462 * @param {WPKeyboardShortcutConfig} options Shortcut options. |
|
1463 */ |
|
1464 |
|
1465 |
|
1466 function useKeyboardShortcut(shortcuts, callback, { |
|
1467 bindGlobal = false, |
|
1468 eventName = 'keydown', |
|
1469 isDisabled = false, |
|
1470 // This is important for performance considerations. |
|
1471 target |
|
1472 } = {}) { |
|
1473 const currentCallback = Object(external_wp_element_["useRef"])(callback); |
|
1474 Object(external_wp_element_["useEffect"])(() => { |
|
1475 currentCallback.current = callback; |
|
1476 }, [callback]); |
|
1477 Object(external_wp_element_["useEffect"])(() => { |
|
1478 if (isDisabled) { |
|
1479 return; |
|
1480 } |
|
1481 |
|
1482 const mousetrap = new mousetrap_default.a(target ? target.current : document); |
|
1483 Object(external_lodash_["castArray"])(shortcuts).forEach(shortcut => { |
|
1484 const keys = shortcut.split('+'); // Determines whether a key is a modifier by the length of the string. |
|
1485 // E.g. if I add a pass a shortcut Shift+Cmd+M, it'll determine that |
|
1486 // the modifiers are Shift and Cmd because they're not a single character. |
|
1487 |
|
1488 const modifiers = new Set(keys.filter(value => value.length > 1)); |
|
1489 const hasAlt = modifiers.has('alt'); |
|
1490 const hasShift = modifiers.has('shift'); // This should be better moved to the shortcut registration instead. |
|
1491 |
|
1492 if (isAppleOS() && (modifiers.size === 1 && hasAlt || modifiers.size === 2 && hasAlt && hasShift)) { |
|
1493 throw new Error(`Cannot bind ${shortcut}. Alt and Shift+Alt modifiers are reserved for character input.`); |
|
1494 } |
|
1495 |
|
1496 const bindFn = bindGlobal ? 'bindGlobal' : 'bind'; |
|
1497 mousetrap[bindFn](shortcut, (...args) => currentCallback.current(...args), eventName); |
|
1498 }); |
|
1499 return () => { |
|
1500 mousetrap.reset(); |
|
1501 }; |
|
1502 }, [shortcuts, bindGlobal, eventName, target, isDisabled]); |
|
1503 } |
|
1504 |
|
1505 /* harmony default export */ var use_keyboard_shortcut = (useKeyboardShortcut); |
|
1506 |
|
1507 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-media-query/index.js |
|
1508 /** |
|
1509 * WordPress dependencies |
|
1510 */ |
|
1511 |
|
1512 /** |
|
1513 * Runs a media query and returns its value when it changes. |
|
1514 * |
|
1515 * @param {string} [query] Media Query. |
|
1516 * @return {boolean} return value of the media query. |
|
1517 */ |
|
1518 |
|
1519 function useMediaQuery(query) { |
|
1520 const [match, setMatch] = Object(external_wp_element_["useState"])(() => !!(query && typeof window !== 'undefined' && window.matchMedia(query).matches)); |
|
1521 Object(external_wp_element_["useEffect"])(() => { |
|
1522 if (!query) { |
|
1523 return; |
|
1524 } |
|
1525 |
|
1526 const updateMatch = () => setMatch(window.matchMedia(query).matches); |
|
1527 |
|
1528 updateMatch(); |
|
1529 const list = window.matchMedia(query); |
|
1530 list.addListener(updateMatch); |
|
1531 return () => { |
|
1532 list.removeListener(updateMatch); |
|
1533 }; |
|
1534 }, [query]); |
|
1535 return query && match; |
|
1536 } |
|
1537 |
|
1538 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-previous/index.js |
|
1539 /** |
|
1540 * WordPress dependencies |
|
1541 */ |
|
1542 |
|
1543 /** |
|
1544 * Use something's value from the previous render. |
|
1545 * Based on https://usehooks.com/usePrevious/. |
|
1546 * |
|
1547 * @template T |
|
1548 * |
|
1549 * @param {T} value The value to track. |
|
1550 * |
|
1551 * @return {T|undefined} The value from the previous render. |
|
1552 */ |
|
1553 |
|
1554 function usePrevious(value) { |
|
1555 // Disable reason: without an explicit type detail, the type of ref will be |
|
1556 // inferred based on the initial useRef argument, which is undefined. |
|
1557 // https://github.com/WordPress/gutenberg/pull/22597#issuecomment-633588366 |
|
1558 |
|
1559 /* eslint-disable jsdoc/no-undefined-types */ |
|
1560 const ref = Object(external_wp_element_["useRef"])( |
|
1561 /** @type {T|undefined} */ |
|
1562 undefined); |
|
1563 /* eslint-enable jsdoc/no-undefined-types */ |
|
1564 // Store current value in ref. |
|
1565 |
|
1566 Object(external_wp_element_["useEffect"])(() => { |
|
1567 ref.current = value; |
|
1568 }, [value]); // Re-run when value changes. |
|
1569 // Return previous value (happens before update in useEffect above). |
|
1570 |
|
1571 return ref.current; |
|
1572 } |
|
1573 |
|
1574 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-reduced-motion/index.js |
|
1575 /** |
|
1576 * Internal dependencies |
|
1577 */ |
|
1578 |
|
1579 /** |
|
1580 * Whether or not the user agent is Internet Explorer. |
|
1581 * |
|
1582 * @type {boolean} |
|
1583 */ |
|
1584 |
|
1585 const IS_IE = typeof window !== 'undefined' && window.navigator.userAgent.indexOf('Trident') >= 0; |
|
1586 /** |
|
1587 * Hook returning whether the user has a preference for reduced motion. |
|
1588 * |
|
1589 * @return {boolean} Reduced motion preference value. |
|
1590 */ |
|
1591 |
|
1592 const useReducedMotion = undefined || IS_IE ? () => true : () => useMediaQuery('(prefers-reduced-motion: reduce)'); |
|
1593 /* harmony default export */ var use_reduced_motion = (useReducedMotion); |
|
1594 |
|
1595 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-viewport-match/index.js |
|
1596 /** |
|
1597 * WordPress dependencies |
|
1598 */ |
|
1599 |
|
1600 /** |
|
1601 * Internal dependencies |
|
1602 */ |
|
1603 |
|
1604 |
|
1605 /** |
|
1606 * @typedef {"huge"|"wide"|"large"|"medium"|"small"|"mobile"} WPBreakpoint |
|
1607 */ |
|
1608 |
|
1609 /** |
|
1610 * Hash of breakpoint names with pixel width at which it becomes effective. |
|
1611 * |
|
1612 * @see _breakpoints.scss |
|
1613 * |
|
1614 * @type {Object<WPBreakpoint,number>} |
|
1615 */ |
|
1616 |
|
1617 const BREAKPOINTS = { |
|
1618 huge: 1440, |
|
1619 wide: 1280, |
|
1620 large: 960, |
|
1621 medium: 782, |
|
1622 small: 600, |
|
1623 mobile: 480 |
|
1624 }; |
|
1625 /** |
|
1626 * @typedef {">="|"<"} WPViewportOperator |
|
1627 */ |
|
1628 |
|
1629 /** |
|
1630 * Object mapping media query operators to the condition to be used. |
|
1631 * |
|
1632 * @type {Object<WPViewportOperator,string>} |
|
1633 */ |
|
1634 |
|
1635 const CONDITIONS = { |
|
1636 '>=': 'min-width', |
|
1637 '<': 'max-width' |
|
1638 }; |
|
1639 /** |
|
1640 * Object mapping media query operators to a function that given a breakpointValue and a width evaluates if the operator matches the values. |
|
1641 * |
|
1642 * @type {Object<WPViewportOperator,Function>} |
|
1643 */ |
|
1644 |
|
1645 const OPERATOR_EVALUATORS = { |
|
1646 '>=': (breakpointValue, width) => width >= breakpointValue, |
|
1647 '<': (breakpointValue, width) => width < breakpointValue |
|
1648 }; |
|
1649 const ViewportMatchWidthContext = Object(external_wp_element_["createContext"])(null); |
|
1650 /** |
|
1651 * Returns true if the viewport matches the given query, or false otherwise. |
|
1652 * |
|
1653 * @param {WPBreakpoint} breakpoint Breakpoint size name. |
|
1654 * @param {WPViewportOperator} [operator=">="] Viewport operator. |
|
1655 * |
|
1656 * @example |
|
1657 * |
|
1658 * ```js |
|
1659 * useViewportMatch( 'huge', '<' ); |
|
1660 * useViewportMatch( 'medium' ); |
|
1661 * ``` |
|
1662 * |
|
1663 * @return {boolean} Whether viewport matches query. |
|
1664 */ |
|
1665 |
|
1666 const useViewportMatch = (breakpoint, operator = '>=') => { |
|
1667 const simulatedWidth = Object(external_wp_element_["useContext"])(ViewportMatchWidthContext); |
|
1668 const mediaQuery = !simulatedWidth && `(${CONDITIONS[operator]}: ${BREAKPOINTS[breakpoint]}px)`; |
|
1669 const mediaQueryResult = useMediaQuery(mediaQuery); |
|
1670 |
|
1671 if (simulatedWidth) { |
|
1672 return OPERATOR_EVALUATORS[operator](BREAKPOINTS[breakpoint], simulatedWidth); |
|
1673 } |
|
1674 |
|
1675 return mediaQueryResult; |
|
1676 }; |
|
1677 |
|
1678 useViewportMatch.__experimentalWidthProvider = ViewportMatchWidthContext.Provider; |
|
1679 /* harmony default export */ var use_viewport_match = (useViewportMatch); |
|
1680 |
|
1681 // EXTERNAL MODULE: ./node_modules/react-resize-aware/dist/index.js |
|
1682 var dist = __webpack_require__("SSiF"); |
|
1683 var dist_default = /*#__PURE__*/__webpack_require__.n(dist); |
|
1684 |
|
1685 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-resize-observer/index.js |
|
1686 /** |
|
1687 * External dependencies |
|
1688 */ |
|
1689 |
|
1690 /** |
|
1691 * Hook which allows to listen the resize event of any target element when it changes sizes. |
|
1692 * _Note: `useResizeObserver` will report `null` until after first render_ |
|
1693 * |
|
1694 * @return {Array} An array of {Element} `resizeListener` and {?Object} `sizes` with properties `width` and `height` |
|
1695 * |
|
1696 * @example |
|
1697 * |
|
1698 * ```js |
|
1699 * const App = () => { |
|
1700 * const [ resizeListener, sizes ] = useResizeObserver(); |
|
1701 * |
|
1702 * return ( |
|
1703 * <div> |
|
1704 * { resizeListener } |
|
1705 * Your content here |
|
1706 * </div> |
|
1707 * ); |
|
1708 * }; |
|
1709 * ``` |
|
1710 * |
|
1711 */ |
|
1712 |
|
1713 /* harmony default export */ var use_resize_observer = (dist_default.a); |
|
1714 |
|
1715 // EXTERNAL MODULE: external ["wp","priorityQueue"] |
|
1716 var external_wp_priorityQueue_ = __webpack_require__("XI5e"); |
|
1717 |
|
1718 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-async-list/index.js |
|
1719 /** |
|
1720 * WordPress dependencies |
|
1721 */ |
|
1722 |
|
1723 |
|
1724 /** |
|
1725 * Returns the first items from list that are present on state. |
|
1726 * |
|
1727 * @param list New array. |
|
1728 * @param state Current state. |
|
1729 * @return First items present iin state. |
|
1730 */ |
|
1731 |
|
1732 function getFirstItemsPresentInState(list, state) { |
|
1733 const firstItems = []; |
|
1734 |
|
1735 for (let i = 0; i < list.length; i++) { |
|
1736 const item = list[i]; |
|
1737 |
|
1738 if (!state.includes(item)) { |
|
1739 break; |
|
1740 } |
|
1741 |
|
1742 firstItems.push(item); |
|
1743 } |
|
1744 |
|
1745 return firstItems; |
|
1746 } |
|
1747 /** |
|
1748 * React hook returns an array which items get asynchronously appended from a source array. |
|
1749 * This behavior is useful if we want to render a list of items asynchronously for performance reasons. |
|
1750 * |
|
1751 * @param list Source array. |
|
1752 * @return Async array. |
|
1753 */ |
|
1754 |
|
1755 |
|
1756 function useAsyncList(list) { |
|
1757 const [current, setCurrent] = Object(external_wp_element_["useState"])([]); |
|
1758 Object(external_wp_element_["useEffect"])(() => { |
|
1759 // On reset, we keep the first items that were previously rendered. |
|
1760 const firstItems = getFirstItemsPresentInState(list, current); |
|
1761 setCurrent(firstItems); |
|
1762 const asyncQueue = Object(external_wp_priorityQueue_["createQueue"])(); |
|
1763 |
|
1764 const append = index => () => { |
|
1765 if (list.length <= index) { |
|
1766 return; |
|
1767 } |
|
1768 |
|
1769 setCurrent(state => [...state, list[index]]); |
|
1770 asyncQueue.add({}, append(index + 1)); |
|
1771 }; |
|
1772 |
|
1773 asyncQueue.add({}, append(firstItems.length)); |
|
1774 return () => asyncQueue.reset(); |
|
1775 }, [list]); |
|
1776 return current; |
|
1777 } |
|
1778 |
|
1779 /* harmony default export */ var use_async_list = (useAsyncList); |
|
1780 |
|
1781 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-warn-on-change/index.js |
|
1782 /** |
|
1783 * Internal dependencies |
|
1784 */ |
|
1785 |
|
1786 /** |
|
1787 * Hook that performs a shallow comparison between the preview value of an object |
|
1788 * and the new one, if there's a difference, it prints it to the console. |
|
1789 * this is useful in performance related work, to check why a component re-renders. |
|
1790 * |
|
1791 * @example |
|
1792 * |
|
1793 * ```jsx |
|
1794 * function MyComponent(props) { |
|
1795 * useWarnOnChange(props); |
|
1796 * |
|
1797 * return "Something"; |
|
1798 * } |
|
1799 * ``` |
|
1800 * |
|
1801 * @param {Object} object Object which changes to compare. |
|
1802 * @param {string} prefix Just a prefix to show when console logging. |
|
1803 */ |
|
1804 |
|
1805 function useWarnOnChange(object, prefix = 'Change detection') { |
|
1806 const previousValues = usePrevious(object); |
|
1807 Object.entries(previousValues !== null && previousValues !== void 0 ? previousValues : []).forEach(([key, value]) => { |
|
1808 if (value !== object[key]) { |
|
1809 // eslint-disable-next-line no-console |
|
1810 console.warn(`${prefix}: ${key} key changed:`, value, object[key]); |
|
1811 } |
|
1812 }); |
|
1813 } |
|
1814 |
|
1815 /* harmony default export */ var use_warn_on_change = (useWarnOnChange); |
|
1816 |
|
1817 // EXTERNAL MODULE: ./node_modules/use-memo-one/dist/use-memo-one.esm.js |
|
1818 var use_memo_one_esm = __webpack_require__("mHlH"); |
|
1819 |
|
1820 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-debounce/index.js |
|
1821 /** |
|
1822 * External dependencies |
|
1823 */ |
|
1824 |
|
1825 |
|
1826 /** |
|
1827 * WordPress dependencies |
|
1828 */ |
|
1829 |
|
1830 |
|
1831 /** |
|
1832 * Debounces a function with Lodash's `debounce`. A new debounced function will |
|
1833 * be returned and any scheduled calls cancelled if any of the arguments change, |
|
1834 * including the function to debounce, so please wrap functions created on |
|
1835 * render in components in `useCallback`. |
|
1836 * |
|
1837 * @param {...any} args Arguments passed to Lodash's `debounce`. |
|
1838 * |
|
1839 * @return {Function} Debounced function. |
|
1840 */ |
|
1841 |
|
1842 function useDebounce(...args) { |
|
1843 const debounced = Object(use_memo_one_esm["a" /* useMemoOne */])(() => Object(external_lodash_["debounce"])(...args), args); |
|
1844 Object(external_wp_element_["useEffect"])(() => () => debounced.cancel(), [debounced]); |
|
1845 return debounced; |
|
1846 } |
|
1847 |
|
1848 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-throttle/index.js |
|
1849 /** |
|
1850 * External dependencies |
|
1851 */ |
|
1852 |
|
1853 |
|
1854 /** |
|
1855 * WordPress dependencies |
|
1856 */ |
|
1857 |
|
1858 |
|
1859 /** |
|
1860 * Throttles a function with Lodash's `throttle`. A new throttled function will |
|
1861 * be returned and any scheduled calls cancelled if any of the arguments change, |
|
1862 * including the function to throttle, so please wrap functions created on |
|
1863 * render in components in `useCallback`. |
|
1864 * |
|
1865 * @param {...any} args Arguments passed to Lodash's `throttle`. |
|
1866 * |
|
1867 * @return {Function} Throttled function. |
|
1868 */ |
|
1869 |
|
1870 function useThrottle(...args) { |
|
1871 const throttled = Object(use_memo_one_esm["a" /* useMemoOne */])(() => Object(external_lodash_["throttle"])(...args), args); |
|
1872 Object(external_wp_element_["useEffect"])(() => () => throttled.cancel(), [throttled]); |
|
1873 return throttled; |
|
1874 } |
|
1875 |
|
1876 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-drop-zone/index.js |
|
1877 /** |
|
1878 * WordPress dependencies |
|
1879 */ |
|
1880 |
|
1881 /** |
|
1882 * Internal dependencies |
|
1883 */ |
|
1884 |
|
1885 |
|
1886 /** @typedef {import('@wordpress/element').RefCallback} RefCallback */ |
|
1887 |
|
1888 function useFreshRef(value) { |
|
1889 const ref = Object(external_wp_element_["useRef"])(); |
|
1890 ref.current = value; |
|
1891 return ref; |
|
1892 } |
|
1893 /** |
|
1894 * A hook to facilitate drag and drop handling. |
|
1895 * |
|
1896 * @param {Object} $1 Named parameters. |
|
1897 * @param {boolean} $1.isDisabled Whether or not to disable the drop zone. |
|
1898 * @param {DragEvent} $1.onDragStart Called when dragging has started. |
|
1899 * @param {DragEvent} $1.onDragEnter Called when the zone is entered. |
|
1900 * @param {DragEvent} $1.onDragOver Called when the zone is moved within. |
|
1901 * @param {DragEvent} $1.onDragLeave Called when the zone is left. |
|
1902 * @param {MouseEvent} $1.onDragEnd Called when dragging has ended. |
|
1903 * @param {DragEvent} $1.onDrop Called when dropping in the zone. |
|
1904 * |
|
1905 * @return {RefCallback} Ref callback to be passed to the drop zone element. |
|
1906 */ |
|
1907 |
|
1908 |
|
1909 function useDropZone({ |
|
1910 isDisabled, |
|
1911 onDrop: _onDrop, |
|
1912 onDragStart: _onDragStart, |
|
1913 onDragEnter: _onDragEnter, |
|
1914 onDragLeave: _onDragLeave, |
|
1915 onDragEnd: _onDragEnd, |
|
1916 onDragOver: _onDragOver |
|
1917 }) { |
|
1918 const onDropRef = useFreshRef(_onDrop); |
|
1919 const onDragStartRef = useFreshRef(_onDragStart); |
|
1920 const onDragEnterRef = useFreshRef(_onDragEnter); |
|
1921 const onDragLeaveRef = useFreshRef(_onDragLeave); |
|
1922 const onDragEndRef = useFreshRef(_onDragEnd); |
|
1923 const onDragOverRef = useFreshRef(_onDragOver); |
|
1924 return useRefEffect(element => { |
|
1925 if (isDisabled) { |
|
1926 return; |
|
1927 } |
|
1928 |
|
1929 let isDragging = false; |
|
1930 const { |
|
1931 ownerDocument |
|
1932 } = element; |
|
1933 /** |
|
1934 * Checks if an element is in the drop zone. |
|
1935 * |
|
1936 * @param {HTMLElement|null} elementToCheck |
|
1937 * |
|
1938 * @return {boolean} True if in drop zone, false if not. |
|
1939 */ |
|
1940 |
|
1941 function isElementInZone(elementToCheck) { |
|
1942 if (!elementToCheck || !element.contains(elementToCheck)) { |
|
1943 return false; |
|
1944 } |
|
1945 |
|
1946 do { |
|
1947 if (elementToCheck.dataset.isDropZone) { |
|
1948 return elementToCheck === element; |
|
1949 } |
|
1950 } while (elementToCheck = elementToCheck.parentElement); |
|
1951 |
|
1952 return false; |
|
1953 } |
|
1954 |
|
1955 function maybeDragStart( |
|
1956 /** @type {DragEvent} */ |
|
1957 event) { |
|
1958 if (isDragging) { |
|
1959 return; |
|
1960 } |
|
1961 |
|
1962 isDragging = true; |
|
1963 ownerDocument.removeEventListener('dragenter', maybeDragStart); // Note that `dragend` doesn't fire consistently for file and |
|
1964 // HTML drag events where the drag origin is outside the browser |
|
1965 // window. In Firefox it may also not fire if the originating |
|
1966 // node is removed. |
|
1967 |
|
1968 ownerDocument.addEventListener('dragend', maybeDragEnd); |
|
1969 ownerDocument.addEventListener('mousemove', maybeDragEnd); |
|
1970 |
|
1971 if (onDragStartRef.current) { |
|
1972 onDragStartRef.current(event); |
|
1973 } |
|
1974 } |
|
1975 |
|
1976 function onDragEnter(event) { |
|
1977 event.preventDefault(); // The `dragenter` event will also fire when entering child |
|
1978 // elements, but we only want to call `onDragEnter` when |
|
1979 // entering the drop zone, which means the `relatedTarget` |
|
1980 // (element that has been left) should be outside the drop zone. |
|
1981 |
|
1982 if (element.contains(event.relatedTarget)) { |
|
1983 return; |
|
1984 } |
|
1985 |
|
1986 if (onDragEnterRef.current) { |
|
1987 onDragEnterRef.current(event); |
|
1988 } |
|
1989 } |
|
1990 |
|
1991 function onDragOver(event) { |
|
1992 // Only call onDragOver for the innermost hovered drop zones. |
|
1993 if (!event.defaultPrevented && onDragOverRef.current) { |
|
1994 onDragOverRef.current(event); |
|
1995 } // Prevent the browser default while also signalling to parent |
|
1996 // drop zones that `onDragOver` is already handled. |
|
1997 |
|
1998 |
|
1999 event.preventDefault(); |
|
2000 } |
|
2001 |
|
2002 function onDragLeave(event) { |
|
2003 // The `dragleave` event will also fire when leaving child |
|
2004 // elements, but we only want to call `onDragLeave` when |
|
2005 // leaving the drop zone, which means the `relatedTarget` |
|
2006 // (element that has been entered) should be outside the drop |
|
2007 // zone. |
|
2008 if (isElementInZone(event.relatedTarget)) { |
|
2009 return; |
|
2010 } |
|
2011 |
|
2012 if (onDragLeaveRef.current) { |
|
2013 onDragLeaveRef.current(event); |
|
2014 } |
|
2015 } |
|
2016 |
|
2017 function onDrop(event) { |
|
2018 // Don't handle drop if an inner drop zone already handled it. |
|
2019 if (event.defaultPrevented) { |
|
2020 return; |
|
2021 } // Prevent the browser default while also signalling to parent |
|
2022 // drop zones that `onDrop` is already handled. |
|
2023 |
|
2024 |
|
2025 event.preventDefault(); // This seemingly useless line has been shown to resolve a |
|
2026 // Safari issue where files dragged directly from the dock are |
|
2027 // not recognized. |
|
2028 // eslint-disable-next-line no-unused-expressions |
|
2029 |
|
2030 event.dataTransfer && event.dataTransfer.files.length; |
|
2031 |
|
2032 if (onDropRef.current) { |
|
2033 onDropRef.current(event); |
|
2034 } |
|
2035 |
|
2036 maybeDragEnd(event); |
|
2037 } |
|
2038 |
|
2039 function maybeDragEnd(event) { |
|
2040 if (!isDragging) { |
|
2041 return; |
|
2042 } |
|
2043 |
|
2044 isDragging = false; |
|
2045 ownerDocument.addEventListener('dragenter', maybeDragStart); |
|
2046 ownerDocument.removeEventListener('dragend', maybeDragEnd); |
|
2047 ownerDocument.removeEventListener('mousemove', maybeDragEnd); |
|
2048 |
|
2049 if (onDragEndRef.current) { |
|
2050 onDragEndRef.current(event); |
|
2051 } |
|
2052 } |
|
2053 |
|
2054 element.dataset.isDropZone = 'true'; |
|
2055 element.addEventListener('drop', onDrop); |
|
2056 element.addEventListener('dragenter', onDragEnter); |
|
2057 element.addEventListener('dragover', onDragOver); |
|
2058 element.addEventListener('dragleave', onDragLeave); // The `dragstart` event doesn't fire if the drag started outside |
|
2059 // the document. |
|
2060 |
|
2061 ownerDocument.addEventListener('dragenter', maybeDragStart); |
|
2062 return () => { |
|
2063 delete element.dataset.isDropZone; |
|
2064 element.removeEventListener('drop', onDrop); |
|
2065 element.removeEventListener('dragenter', onDragEnter); |
|
2066 element.removeEventListener('dragover', onDragOver); |
|
2067 element.removeEventListener('dragleave', onDragLeave); |
|
2068 ownerDocument.removeEventListener('dragend', maybeDragEnd); |
|
2069 ownerDocument.removeEventListener('mousemove', maybeDragEnd); |
|
2070 ownerDocument.addEventListener('dragenter', maybeDragStart); |
|
2071 }; |
|
2072 }, [isDisabled]); |
|
2073 } |
|
2074 |
|
2075 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/index.js |
|
2076 // Utils |
|
2077 // Compose helper (aliased flowRight from Lodash) |
|
2078 |
|
2079 // Higher-order components |
|
2080 |
|
2081 |
|
2082 |
|
2083 |
|
2084 |
|
2085 |
|
2086 // Hooks |
|
2087 |
|
2088 |
|
2089 |
|
2090 |
|
2091 |
|
2092 |
|
2093 |
|
2094 |
|
2095 |
|
2096 |
|
2097 |
|
2098 |
|
2099 |
|
2100 |
|
2101 |
|
2102 |
|
2103 |
|
2104 |
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 |
|
2111 |
109 |
2112 |
110 /***/ }), |
2113 /***/ }), |
111 |
2114 |
112 /***/ 13: |
2115 /***/ "RxS6": |
113 /***/ (function(module, exports) { |
2116 /***/ (function(module, exports) { |
114 |
2117 |
115 (function() { module.exports = this["React"]; }()); |
2118 (function() { module.exports = window["wp"]["keycodes"]; }()); |
116 |
2119 |
117 /***/ }), |
2120 /***/ }), |
118 |
2121 |
119 /***/ 14: |
2122 /***/ "SSiF": |
120 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
2123 /***/ (function(module, exports, __webpack_require__) { |
121 |
2124 |
122 "use strict"; |
2125 var e=__webpack_require__("cDcd"),n={display:"block",opacity:0,position:"absolute",top:0,left:0,height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:-1},t=function(t){var r=t.onResize,u=e.useRef();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function u(){t();var e=r();e&&e.addEventListener("resize",t)}e.useEffect((function(){return r()?u():n.current&&n.current.addEventListener&&n.current.addEventListener("load",u),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(u,(function(){return r(u)})),e.createElement("iframe",{style:n,src:"about:blank",ref:u,"aria-hidden":!0,tabIndex:-1,frameBorder:0})},r=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};module.exports=function(n){void 0===n&&(n=r);var u=e.useState(n(null)),o=u[0],i=u[1],c=e.useCallback((function(e){return i(n(e.current))}),[n]);return[e.useMemo((function(){return e.createElement(t,{onResize:c})}),[c]),o]}; |
123 |
2126 |
124 // EXPORTS |
|
125 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; }); |
|
126 |
|
127 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js |
|
128 var arrayWithHoles = __webpack_require__(38); |
|
129 |
|
130 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js |
|
131 function _iterableToArrayLimit(arr, i) { |
|
132 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; |
|
133 var _arr = []; |
|
134 var _n = true; |
|
135 var _d = false; |
|
136 var _e = undefined; |
|
137 |
|
138 try { |
|
139 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { |
|
140 _arr.push(_s.value); |
|
141 |
|
142 if (i && _arr.length === i) break; |
|
143 } |
|
144 } catch (err) { |
|
145 _d = true; |
|
146 _e = err; |
|
147 } finally { |
|
148 try { |
|
149 if (!_n && _i["return"] != null) _i["return"](); |
|
150 } finally { |
|
151 if (_d) throw _e; |
|
152 } |
|
153 } |
|
154 |
|
155 return _arr; |
|
156 } |
|
157 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
|
158 var unsupportedIterableToArray = __webpack_require__(29); |
|
159 |
|
160 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js |
|
161 var nonIterableRest = __webpack_require__(39); |
|
162 |
|
163 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 function _slicedToArray(arr, i) { |
|
169 return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])(); |
|
170 } |
|
171 |
2127 |
172 /***/ }), |
2128 /***/ }), |
173 |
2129 |
174 /***/ 149: |
2130 /***/ "VcSt": |
175 /***/ (function(module, exports, __webpack_require__) { |
2131 /***/ (function(module, exports) { |
176 |
2132 |
177 var e=__webpack_require__(13),n={display:"block",opacity:0,position:"absolute",top:0,left:0,height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:-1},t=function(t){var r=t.onResize,u=e.useRef();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function u(){t();var e=r();e&&e.addEventListener("resize",t)}e.useEffect((function(){return r()?u():n.current&&n.current.addEventListener&&n.current.addEventListener("load",u),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(u,(function(){return r(u)})),e.createElement("iframe",{style:n,src:"about:blank",ref:u,"aria-hidden":!0,tabIndex:-1,frameBorder:0})},r=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};module.exports=function(n){void 0===n&&(n=r);var u=e.useState(n(null)),o=u[0],i=u[1],c=e.useCallback((function(e){return i(n(e.current))}),[n]);return[e.useMemo((function(){return e.createElement(t,{onResize:c})}),[c]),o]}; |
2133 /** |
|
2134 * adds a bindGlobal method to Mousetrap that allows you to |
|
2135 * bind specific keyboard shortcuts that will still work |
|
2136 * inside a text input field |
|
2137 * |
|
2138 * usage: |
|
2139 * Mousetrap.bindGlobal('ctrl+s', _saveChanges); |
|
2140 */ |
|
2141 /* global Mousetrap:true */ |
|
2142 (function(Mousetrap) { |
|
2143 if (! Mousetrap) { |
|
2144 return; |
|
2145 } |
|
2146 var _globalCallbacks = {}; |
|
2147 var _originalStopCallback = Mousetrap.prototype.stopCallback; |
|
2148 |
|
2149 Mousetrap.prototype.stopCallback = function(e, element, combo, sequence) { |
|
2150 var self = this; |
|
2151 |
|
2152 if (self.paused) { |
|
2153 return true; |
|
2154 } |
|
2155 |
|
2156 if (_globalCallbacks[combo] || _globalCallbacks[sequence]) { |
|
2157 return false; |
|
2158 } |
|
2159 |
|
2160 return _originalStopCallback.call(self, e, element, combo); |
|
2161 }; |
|
2162 |
|
2163 Mousetrap.prototype.bindGlobal = function(keys, callback, action) { |
|
2164 var self = this; |
|
2165 self.bind(keys, callback, action); |
|
2166 |
|
2167 if (keys instanceof Array) { |
|
2168 for (var i = 0; i < keys.length; i++) { |
|
2169 _globalCallbacks[keys[i]] = true; |
|
2170 } |
|
2171 return; |
|
2172 } |
|
2173 |
|
2174 _globalCallbacks[keys] = true; |
|
2175 }; |
|
2176 |
|
2177 Mousetrap.init(); |
|
2178 }) (typeof Mousetrap !== "undefined" ? Mousetrap : undefined); |
178 |
2179 |
179 |
2180 |
180 /***/ }), |
2181 /***/ }), |
181 |
2182 |
182 /***/ 150: |
2183 /***/ "XI5e": |
183 /***/ (function(module, exports) { |
2184 /***/ (function(module, exports) { |
184 |
2185 |
185 (function() { module.exports = this["wp"]["priorityQueue"]; }()); |
2186 (function() { module.exports = window["wp"]["priorityQueue"]; }()); |
186 |
2187 |
187 /***/ }), |
2188 /***/ }), |
188 |
2189 |
189 /***/ 16: |
2190 /***/ "YLtl": |
190 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
2191 /***/ (function(module, exports) { |
191 |
2192 |
192 "use strict"; |
2193 (function() { module.exports = window["lodash"]; }()); |
193 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; }); |
|
194 function _getPrototypeOf(o) { |
|
195 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { |
|
196 return o.__proto__ || Object.getPrototypeOf(o); |
|
197 }; |
|
198 return _getPrototypeOf(o); |
|
199 } |
|
200 |
2194 |
201 /***/ }), |
2195 /***/ }), |
202 |
2196 |
203 /***/ 18: |
2197 /***/ "cDcd": |
204 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
2198 /***/ (function(module, exports) { |
205 |
2199 |
206 "use strict"; |
2200 (function() { module.exports = window["React"]; }()); |
207 |
|
208 // EXPORTS |
|
209 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; }); |
|
210 |
|
211 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js |
|
212 var arrayLikeToArray = __webpack_require__(26); |
|
213 |
|
214 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js |
|
215 |
|
216 function _arrayWithoutHoles(arr) { |
|
217 if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr); |
|
218 } |
|
219 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js |
|
220 var iterableToArray = __webpack_require__(35); |
|
221 |
|
222 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
|
223 var unsupportedIterableToArray = __webpack_require__(29); |
|
224 |
|
225 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js |
|
226 function _nonIterableSpread() { |
|
227 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
|
228 } |
|
229 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 function _toConsumableArray(arr) { |
|
235 return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread(); |
|
236 } |
|
237 |
2201 |
238 /***/ }), |
2202 /***/ }), |
239 |
2203 |
240 /***/ 19: |
2204 /***/ "imBb": |
241 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
242 |
|
243 "use strict"; |
|
244 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; }); |
|
245 function _defineProperties(target, props) { |
|
246 for (var i = 0; i < props.length; i++) { |
|
247 var descriptor = props[i]; |
|
248 descriptor.enumerable = descriptor.enumerable || false; |
|
249 descriptor.configurable = true; |
|
250 if ("value" in descriptor) descriptor.writable = true; |
|
251 Object.defineProperty(target, descriptor.key, descriptor); |
|
252 } |
|
253 } |
|
254 |
|
255 function _createClass(Constructor, protoProps, staticProps) { |
|
256 if (protoProps) _defineProperties(Constructor.prototype, protoProps); |
|
257 if (staticProps) _defineProperties(Constructor, staticProps); |
|
258 return Constructor; |
|
259 } |
|
260 |
|
261 /***/ }), |
|
262 |
|
263 /***/ 2: |
|
264 /***/ (function(module, exports) { |
|
265 |
|
266 (function() { module.exports = this["lodash"]; }()); |
|
267 |
|
268 /***/ }), |
|
269 |
|
270 /***/ 20: |
|
271 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
272 |
|
273 "use strict"; |
|
274 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; }); |
|
275 function _classCallCheck(instance, Constructor) { |
|
276 if (!(instance instanceof Constructor)) { |
|
277 throw new TypeError("Cannot call a class as a function"); |
|
278 } |
|
279 } |
|
280 |
|
281 /***/ }), |
|
282 |
|
283 /***/ 22: |
|
284 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
285 |
|
286 "use strict"; |
|
287 |
|
288 // EXPORTS |
|
289 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _inherits; }); |
|
290 |
|
291 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js |
|
292 function _setPrototypeOf(o, p) { |
|
293 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { |
|
294 o.__proto__ = p; |
|
295 return o; |
|
296 }; |
|
297 |
|
298 return _setPrototypeOf(o, p); |
|
299 } |
|
300 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js |
|
301 |
|
302 function _inherits(subClass, superClass) { |
|
303 if (typeof superClass !== "function" && superClass !== null) { |
|
304 throw new TypeError("Super expression must either be null or a function"); |
|
305 } |
|
306 |
|
307 subClass.prototype = Object.create(superClass && superClass.prototype, { |
|
308 constructor: { |
|
309 value: subClass, |
|
310 writable: true, |
|
311 configurable: true |
|
312 } |
|
313 }); |
|
314 if (superClass) _setPrototypeOf(subClass, superClass); |
|
315 } |
|
316 |
|
317 /***/ }), |
|
318 |
|
319 /***/ 23: |
|
320 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
321 |
|
322 "use strict"; |
|
323 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; }); |
|
324 /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40); |
|
325 /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12); |
|
326 |
|
327 |
|
328 function _possibleConstructorReturn(self, call) { |
|
329 if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) { |
|
330 return call; |
|
331 } |
|
332 |
|
333 return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self); |
|
334 } |
|
335 |
|
336 /***/ }), |
|
337 |
|
338 /***/ 26: |
|
339 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
340 |
|
341 "use strict"; |
|
342 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; }); |
|
343 function _arrayLikeToArray(arr, len) { |
|
344 if (len == null || len > arr.length) len = arr.length; |
|
345 |
|
346 for (var i = 0, arr2 = new Array(len); i < len; i++) { |
|
347 arr2[i] = arr[i]; |
|
348 } |
|
349 |
|
350 return arr2; |
|
351 } |
|
352 |
|
353 /***/ }), |
|
354 |
|
355 /***/ 272: |
|
356 /***/ (function(module, exports, __webpack_require__) { |
|
357 |
|
358 /*! |
|
359 * clipboard.js v2.0.6 |
|
360 * https://clipboardjs.com/ |
|
361 * |
|
362 * Licensed MIT © Zeno Rocha |
|
363 */ |
|
364 (function webpackUniversalModuleDefinition(root, factory) { |
|
365 if(true) |
|
366 module.exports = factory(); |
|
367 else {} |
|
368 })(this, function() { |
|
369 return /******/ (function(modules) { // webpackBootstrap |
|
370 /******/ // The module cache |
|
371 /******/ var installedModules = {}; |
|
372 /******/ |
|
373 /******/ // The require function |
|
374 /******/ function __webpack_require__(moduleId) { |
|
375 /******/ |
|
376 /******/ // Check if module is in cache |
|
377 /******/ if(installedModules[moduleId]) { |
|
378 /******/ return installedModules[moduleId].exports; |
|
379 /******/ } |
|
380 /******/ // Create a new module (and put it into the cache) |
|
381 /******/ var module = installedModules[moduleId] = { |
|
382 /******/ i: moduleId, |
|
383 /******/ l: false, |
|
384 /******/ exports: {} |
|
385 /******/ }; |
|
386 /******/ |
|
387 /******/ // Execute the module function |
|
388 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
|
389 /******/ |
|
390 /******/ // Flag the module as loaded |
|
391 /******/ module.l = true; |
|
392 /******/ |
|
393 /******/ // Return the exports of the module |
|
394 /******/ return module.exports; |
|
395 /******/ } |
|
396 /******/ |
|
397 /******/ |
|
398 /******/ // expose the modules object (__webpack_modules__) |
|
399 /******/ __webpack_require__.m = modules; |
|
400 /******/ |
|
401 /******/ // expose the module cache |
|
402 /******/ __webpack_require__.c = installedModules; |
|
403 /******/ |
|
404 /******/ // define getter function for harmony exports |
|
405 /******/ __webpack_require__.d = function(exports, name, getter) { |
|
406 /******/ if(!__webpack_require__.o(exports, name)) { |
|
407 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
|
408 /******/ } |
|
409 /******/ }; |
|
410 /******/ |
|
411 /******/ // define __esModule on exports |
|
412 /******/ __webpack_require__.r = function(exports) { |
|
413 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|
414 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
415 /******/ } |
|
416 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
417 /******/ }; |
|
418 /******/ |
|
419 /******/ // create a fake namespace object |
|
420 /******/ // mode & 1: value is a module id, require it |
|
421 /******/ // mode & 2: merge all properties of value into the ns |
|
422 /******/ // mode & 4: return value when already ns object |
|
423 /******/ // mode & 8|1: behave like require |
|
424 /******/ __webpack_require__.t = function(value, mode) { |
|
425 /******/ if(mode & 1) value = __webpack_require__(value); |
|
426 /******/ if(mode & 8) return value; |
|
427 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
|
428 /******/ var ns = Object.create(null); |
|
429 /******/ __webpack_require__.r(ns); |
|
430 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
|
431 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
|
432 /******/ return ns; |
|
433 /******/ }; |
|
434 /******/ |
|
435 /******/ // getDefaultExport function for compatibility with non-harmony modules |
|
436 /******/ __webpack_require__.n = function(module) { |
|
437 /******/ var getter = module && module.__esModule ? |
|
438 /******/ function getDefault() { return module['default']; } : |
|
439 /******/ function getModuleExports() { return module; }; |
|
440 /******/ __webpack_require__.d(getter, 'a', getter); |
|
441 /******/ return getter; |
|
442 /******/ }; |
|
443 /******/ |
|
444 /******/ // Object.prototype.hasOwnProperty.call |
|
445 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
|
446 /******/ |
|
447 /******/ // __webpack_public_path__ |
|
448 /******/ __webpack_require__.p = ""; |
|
449 /******/ |
|
450 /******/ |
|
451 /******/ // Load entry module and return exports |
|
452 /******/ return __webpack_require__(__webpack_require__.s = 6); |
|
453 /******/ }) |
|
454 /************************************************************************/ |
|
455 /******/ ([ |
|
456 /* 0 */ |
|
457 /***/ (function(module, exports) { |
|
458 |
|
459 function select(element) { |
|
460 var selectedText; |
|
461 |
|
462 if (element.nodeName === 'SELECT') { |
|
463 element.focus(); |
|
464 |
|
465 selectedText = element.value; |
|
466 } |
|
467 else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { |
|
468 var isReadOnly = element.hasAttribute('readonly'); |
|
469 |
|
470 if (!isReadOnly) { |
|
471 element.setAttribute('readonly', ''); |
|
472 } |
|
473 |
|
474 element.select(); |
|
475 element.setSelectionRange(0, element.value.length); |
|
476 |
|
477 if (!isReadOnly) { |
|
478 element.removeAttribute('readonly'); |
|
479 } |
|
480 |
|
481 selectedText = element.value; |
|
482 } |
|
483 else { |
|
484 if (element.hasAttribute('contenteditable')) { |
|
485 element.focus(); |
|
486 } |
|
487 |
|
488 var selection = window.getSelection(); |
|
489 var range = document.createRange(); |
|
490 |
|
491 range.selectNodeContents(element); |
|
492 selection.removeAllRanges(); |
|
493 selection.addRange(range); |
|
494 |
|
495 selectedText = selection.toString(); |
|
496 } |
|
497 |
|
498 return selectedText; |
|
499 } |
|
500 |
|
501 module.exports = select; |
|
502 |
|
503 |
|
504 /***/ }), |
|
505 /* 1 */ |
|
506 /***/ (function(module, exports) { |
|
507 |
|
508 function E () { |
|
509 // Keep this empty so it's easier to inherit from |
|
510 // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) |
|
511 } |
|
512 |
|
513 E.prototype = { |
|
514 on: function (name, callback, ctx) { |
|
515 var e = this.e || (this.e = {}); |
|
516 |
|
517 (e[name] || (e[name] = [])).push({ |
|
518 fn: callback, |
|
519 ctx: ctx |
|
520 }); |
|
521 |
|
522 return this; |
|
523 }, |
|
524 |
|
525 once: function (name, callback, ctx) { |
|
526 var self = this; |
|
527 function listener () { |
|
528 self.off(name, listener); |
|
529 callback.apply(ctx, arguments); |
|
530 }; |
|
531 |
|
532 listener._ = callback |
|
533 return this.on(name, listener, ctx); |
|
534 }, |
|
535 |
|
536 emit: function (name) { |
|
537 var data = [].slice.call(arguments, 1); |
|
538 var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); |
|
539 var i = 0; |
|
540 var len = evtArr.length; |
|
541 |
|
542 for (i; i < len; i++) { |
|
543 evtArr[i].fn.apply(evtArr[i].ctx, data); |
|
544 } |
|
545 |
|
546 return this; |
|
547 }, |
|
548 |
|
549 off: function (name, callback) { |
|
550 var e = this.e || (this.e = {}); |
|
551 var evts = e[name]; |
|
552 var liveEvents = []; |
|
553 |
|
554 if (evts && callback) { |
|
555 for (var i = 0, len = evts.length; i < len; i++) { |
|
556 if (evts[i].fn !== callback && evts[i].fn._ !== callback) |
|
557 liveEvents.push(evts[i]); |
|
558 } |
|
559 } |
|
560 |
|
561 // Remove event from queue to prevent memory leak |
|
562 // Suggested by https://github.com/lazd |
|
563 // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910 |
|
564 |
|
565 (liveEvents.length) |
|
566 ? e[name] = liveEvents |
|
567 : delete e[name]; |
|
568 |
|
569 return this; |
|
570 } |
|
571 }; |
|
572 |
|
573 module.exports = E; |
|
574 module.exports.TinyEmitter = E; |
|
575 |
|
576 |
|
577 /***/ }), |
|
578 /* 2 */ |
|
579 /***/ (function(module, exports, __webpack_require__) { |
|
580 |
|
581 var is = __webpack_require__(3); |
|
582 var delegate = __webpack_require__(4); |
|
583 |
|
584 /** |
|
585 * Validates all params and calls the right |
|
586 * listener function based on its target type. |
|
587 * |
|
588 * @param {String|HTMLElement|HTMLCollection|NodeList} target |
|
589 * @param {String} type |
|
590 * @param {Function} callback |
|
591 * @return {Object} |
|
592 */ |
|
593 function listen(target, type, callback) { |
|
594 if (!target && !type && !callback) { |
|
595 throw new Error('Missing required arguments'); |
|
596 } |
|
597 |
|
598 if (!is.string(type)) { |
|
599 throw new TypeError('Second argument must be a String'); |
|
600 } |
|
601 |
|
602 if (!is.fn(callback)) { |
|
603 throw new TypeError('Third argument must be a Function'); |
|
604 } |
|
605 |
|
606 if (is.node(target)) { |
|
607 return listenNode(target, type, callback); |
|
608 } |
|
609 else if (is.nodeList(target)) { |
|
610 return listenNodeList(target, type, callback); |
|
611 } |
|
612 else if (is.string(target)) { |
|
613 return listenSelector(target, type, callback); |
|
614 } |
|
615 else { |
|
616 throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList'); |
|
617 } |
|
618 } |
|
619 |
|
620 /** |
|
621 * Adds an event listener to a HTML element |
|
622 * and returns a remove listener function. |
|
623 * |
|
624 * @param {HTMLElement} node |
|
625 * @param {String} type |
|
626 * @param {Function} callback |
|
627 * @return {Object} |
|
628 */ |
|
629 function listenNode(node, type, callback) { |
|
630 node.addEventListener(type, callback); |
|
631 |
|
632 return { |
|
633 destroy: function() { |
|
634 node.removeEventListener(type, callback); |
|
635 } |
|
636 } |
|
637 } |
|
638 |
|
639 /** |
|
640 * Add an event listener to a list of HTML elements |
|
641 * and returns a remove listener function. |
|
642 * |
|
643 * @param {NodeList|HTMLCollection} nodeList |
|
644 * @param {String} type |
|
645 * @param {Function} callback |
|
646 * @return {Object} |
|
647 */ |
|
648 function listenNodeList(nodeList, type, callback) { |
|
649 Array.prototype.forEach.call(nodeList, function(node) { |
|
650 node.addEventListener(type, callback); |
|
651 }); |
|
652 |
|
653 return { |
|
654 destroy: function() { |
|
655 Array.prototype.forEach.call(nodeList, function(node) { |
|
656 node.removeEventListener(type, callback); |
|
657 }); |
|
658 } |
|
659 } |
|
660 } |
|
661 |
|
662 /** |
|
663 * Add an event listener to a selector |
|
664 * and returns a remove listener function. |
|
665 * |
|
666 * @param {String} selector |
|
667 * @param {String} type |
|
668 * @param {Function} callback |
|
669 * @return {Object} |
|
670 */ |
|
671 function listenSelector(selector, type, callback) { |
|
672 return delegate(document.body, selector, type, callback); |
|
673 } |
|
674 |
|
675 module.exports = listen; |
|
676 |
|
677 |
|
678 /***/ }), |
|
679 /* 3 */ |
|
680 /***/ (function(module, exports) { |
|
681 |
|
682 /** |
|
683 * Check if argument is a HTML element. |
|
684 * |
|
685 * @param {Object} value |
|
686 * @return {Boolean} |
|
687 */ |
|
688 exports.node = function(value) { |
|
689 return value !== undefined |
|
690 && value instanceof HTMLElement |
|
691 && value.nodeType === 1; |
|
692 }; |
|
693 |
|
694 /** |
|
695 * Check if argument is a list of HTML elements. |
|
696 * |
|
697 * @param {Object} value |
|
698 * @return {Boolean} |
|
699 */ |
|
700 exports.nodeList = function(value) { |
|
701 var type = Object.prototype.toString.call(value); |
|
702 |
|
703 return value !== undefined |
|
704 && (type === '[object NodeList]' || type === '[object HTMLCollection]') |
|
705 && ('length' in value) |
|
706 && (value.length === 0 || exports.node(value[0])); |
|
707 }; |
|
708 |
|
709 /** |
|
710 * Check if argument is a string. |
|
711 * |
|
712 * @param {Object} value |
|
713 * @return {Boolean} |
|
714 */ |
|
715 exports.string = function(value) { |
|
716 return typeof value === 'string' |
|
717 || value instanceof String; |
|
718 }; |
|
719 |
|
720 /** |
|
721 * Check if argument is a function. |
|
722 * |
|
723 * @param {Object} value |
|
724 * @return {Boolean} |
|
725 */ |
|
726 exports.fn = function(value) { |
|
727 var type = Object.prototype.toString.call(value); |
|
728 |
|
729 return type === '[object Function]'; |
|
730 }; |
|
731 |
|
732 |
|
733 /***/ }), |
|
734 /* 4 */ |
|
735 /***/ (function(module, exports, __webpack_require__) { |
|
736 |
|
737 var closest = __webpack_require__(5); |
|
738 |
|
739 /** |
|
740 * Delegates event to a selector. |
|
741 * |
|
742 * @param {Element} element |
|
743 * @param {String} selector |
|
744 * @param {String} type |
|
745 * @param {Function} callback |
|
746 * @param {Boolean} useCapture |
|
747 * @return {Object} |
|
748 */ |
|
749 function _delegate(element, selector, type, callback, useCapture) { |
|
750 var listenerFn = listener.apply(this, arguments); |
|
751 |
|
752 element.addEventListener(type, listenerFn, useCapture); |
|
753 |
|
754 return { |
|
755 destroy: function() { |
|
756 element.removeEventListener(type, listenerFn, useCapture); |
|
757 } |
|
758 } |
|
759 } |
|
760 |
|
761 /** |
|
762 * Delegates event to a selector. |
|
763 * |
|
764 * @param {Element|String|Array} [elements] |
|
765 * @param {String} selector |
|
766 * @param {String} type |
|
767 * @param {Function} callback |
|
768 * @param {Boolean} useCapture |
|
769 * @return {Object} |
|
770 */ |
|
771 function delegate(elements, selector, type, callback, useCapture) { |
|
772 // Handle the regular Element usage |
|
773 if (typeof elements.addEventListener === 'function') { |
|
774 return _delegate.apply(null, arguments); |
|
775 } |
|
776 |
|
777 // Handle Element-less usage, it defaults to global delegation |
|
778 if (typeof type === 'function') { |
|
779 // Use `document` as the first parameter, then apply arguments |
|
780 // This is a short way to .unshift `arguments` without running into deoptimizations |
|
781 return _delegate.bind(null, document).apply(null, arguments); |
|
782 } |
|
783 |
|
784 // Handle Selector-based usage |
|
785 if (typeof elements === 'string') { |
|
786 elements = document.querySelectorAll(elements); |
|
787 } |
|
788 |
|
789 // Handle Array-like based usage |
|
790 return Array.prototype.map.call(elements, function (element) { |
|
791 return _delegate(element, selector, type, callback, useCapture); |
|
792 }); |
|
793 } |
|
794 |
|
795 /** |
|
796 * Finds closest match and invokes callback. |
|
797 * |
|
798 * @param {Element} element |
|
799 * @param {String} selector |
|
800 * @param {String} type |
|
801 * @param {Function} callback |
|
802 * @return {Function} |
|
803 */ |
|
804 function listener(element, selector, type, callback) { |
|
805 return function(e) { |
|
806 e.delegateTarget = closest(e.target, selector); |
|
807 |
|
808 if (e.delegateTarget) { |
|
809 callback.call(element, e); |
|
810 } |
|
811 } |
|
812 } |
|
813 |
|
814 module.exports = delegate; |
|
815 |
|
816 |
|
817 /***/ }), |
|
818 /* 5 */ |
|
819 /***/ (function(module, exports) { |
|
820 |
|
821 var DOCUMENT_NODE_TYPE = 9; |
|
822 |
|
823 /** |
|
824 * A polyfill for Element.matches() |
|
825 */ |
|
826 if (typeof Element !== 'undefined' && !Element.prototype.matches) { |
|
827 var proto = Element.prototype; |
|
828 |
|
829 proto.matches = proto.matchesSelector || |
|
830 proto.mozMatchesSelector || |
|
831 proto.msMatchesSelector || |
|
832 proto.oMatchesSelector || |
|
833 proto.webkitMatchesSelector; |
|
834 } |
|
835 |
|
836 /** |
|
837 * Finds the closest parent that matches a selector. |
|
838 * |
|
839 * @param {Element} element |
|
840 * @param {String} selector |
|
841 * @return {Function} |
|
842 */ |
|
843 function closest (element, selector) { |
|
844 while (element && element.nodeType !== DOCUMENT_NODE_TYPE) { |
|
845 if (typeof element.matches === 'function' && |
|
846 element.matches(selector)) { |
|
847 return element; |
|
848 } |
|
849 element = element.parentNode; |
|
850 } |
|
851 } |
|
852 |
|
853 module.exports = closest; |
|
854 |
|
855 |
|
856 /***/ }), |
|
857 /* 6 */ |
|
858 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
859 |
|
860 "use strict"; |
|
861 __webpack_require__.r(__webpack_exports__); |
|
862 |
|
863 // EXTERNAL MODULE: ./node_modules/select/src/select.js |
|
864 var src_select = __webpack_require__(0); |
|
865 var select_default = /*#__PURE__*/__webpack_require__.n(src_select); |
|
866 |
|
867 // CONCATENATED MODULE: ./src/clipboard-action.js |
|
868 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
|
869 |
|
870 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
871 |
|
872 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
873 |
|
874 |
|
875 |
|
876 /** |
|
877 * Inner class which performs selection from either `text` or `target` |
|
878 * properties and then executes copy or cut operations. |
|
879 */ |
|
880 |
|
881 var clipboard_action_ClipboardAction = function () { |
|
882 /** |
|
883 * @param {Object} options |
|
884 */ |
|
885 function ClipboardAction(options) { |
|
886 _classCallCheck(this, ClipboardAction); |
|
887 |
|
888 this.resolveOptions(options); |
|
889 this.initSelection(); |
|
890 } |
|
891 |
|
892 /** |
|
893 * Defines base properties passed from constructor. |
|
894 * @param {Object} options |
|
895 */ |
|
896 |
|
897 |
|
898 _createClass(ClipboardAction, [{ |
|
899 key: 'resolveOptions', |
|
900 value: function resolveOptions() { |
|
901 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
902 |
|
903 this.action = options.action; |
|
904 this.container = options.container; |
|
905 this.emitter = options.emitter; |
|
906 this.target = options.target; |
|
907 this.text = options.text; |
|
908 this.trigger = options.trigger; |
|
909 |
|
910 this.selectedText = ''; |
|
911 } |
|
912 |
|
913 /** |
|
914 * Decides which selection strategy is going to be applied based |
|
915 * on the existence of `text` and `target` properties. |
|
916 */ |
|
917 |
|
918 }, { |
|
919 key: 'initSelection', |
|
920 value: function initSelection() { |
|
921 if (this.text) { |
|
922 this.selectFake(); |
|
923 } else if (this.target) { |
|
924 this.selectTarget(); |
|
925 } |
|
926 } |
|
927 |
|
928 /** |
|
929 * Creates a fake textarea element, sets its value from `text` property, |
|
930 * and makes a selection on it. |
|
931 */ |
|
932 |
|
933 }, { |
|
934 key: 'selectFake', |
|
935 value: function selectFake() { |
|
936 var _this = this; |
|
937 |
|
938 var isRTL = document.documentElement.getAttribute('dir') == 'rtl'; |
|
939 |
|
940 this.removeFake(); |
|
941 |
|
942 this.fakeHandlerCallback = function () { |
|
943 return _this.removeFake(); |
|
944 }; |
|
945 this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true; |
|
946 |
|
947 this.fakeElem = document.createElement('textarea'); |
|
948 // Prevent zooming on iOS |
|
949 this.fakeElem.style.fontSize = '12pt'; |
|
950 // Reset box model |
|
951 this.fakeElem.style.border = '0'; |
|
952 this.fakeElem.style.padding = '0'; |
|
953 this.fakeElem.style.margin = '0'; |
|
954 // Move element out of screen horizontally |
|
955 this.fakeElem.style.position = 'absolute'; |
|
956 this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px'; |
|
957 // Move element to the same position vertically |
|
958 var yPosition = window.pageYOffset || document.documentElement.scrollTop; |
|
959 this.fakeElem.style.top = yPosition + 'px'; |
|
960 |
|
961 this.fakeElem.setAttribute('readonly', ''); |
|
962 this.fakeElem.value = this.text; |
|
963 |
|
964 this.container.appendChild(this.fakeElem); |
|
965 |
|
966 this.selectedText = select_default()(this.fakeElem); |
|
967 this.copyText(); |
|
968 } |
|
969 |
|
970 /** |
|
971 * Only removes the fake element after another click event, that way |
|
972 * a user can hit `Ctrl+C` to copy because selection still exists. |
|
973 */ |
|
974 |
|
975 }, { |
|
976 key: 'removeFake', |
|
977 value: function removeFake() { |
|
978 if (this.fakeHandler) { |
|
979 this.container.removeEventListener('click', this.fakeHandlerCallback); |
|
980 this.fakeHandler = null; |
|
981 this.fakeHandlerCallback = null; |
|
982 } |
|
983 |
|
984 if (this.fakeElem) { |
|
985 this.container.removeChild(this.fakeElem); |
|
986 this.fakeElem = null; |
|
987 } |
|
988 } |
|
989 |
|
990 /** |
|
991 * Selects the content from element passed on `target` property. |
|
992 */ |
|
993 |
|
994 }, { |
|
995 key: 'selectTarget', |
|
996 value: function selectTarget() { |
|
997 this.selectedText = select_default()(this.target); |
|
998 this.copyText(); |
|
999 } |
|
1000 |
|
1001 /** |
|
1002 * Executes the copy operation based on the current selection. |
|
1003 */ |
|
1004 |
|
1005 }, { |
|
1006 key: 'copyText', |
|
1007 value: function copyText() { |
|
1008 var succeeded = void 0; |
|
1009 |
|
1010 try { |
|
1011 succeeded = document.execCommand(this.action); |
|
1012 } catch (err) { |
|
1013 succeeded = false; |
|
1014 } |
|
1015 |
|
1016 this.handleResult(succeeded); |
|
1017 } |
|
1018 |
|
1019 /** |
|
1020 * Fires an event based on the copy operation result. |
|
1021 * @param {Boolean} succeeded |
|
1022 */ |
|
1023 |
|
1024 }, { |
|
1025 key: 'handleResult', |
|
1026 value: function handleResult(succeeded) { |
|
1027 this.emitter.emit(succeeded ? 'success' : 'error', { |
|
1028 action: this.action, |
|
1029 text: this.selectedText, |
|
1030 trigger: this.trigger, |
|
1031 clearSelection: this.clearSelection.bind(this) |
|
1032 }); |
|
1033 } |
|
1034 |
|
1035 /** |
|
1036 * Moves focus away from `target` and back to the trigger, removes current selection. |
|
1037 */ |
|
1038 |
|
1039 }, { |
|
1040 key: 'clearSelection', |
|
1041 value: function clearSelection() { |
|
1042 if (this.trigger) { |
|
1043 this.trigger.focus(); |
|
1044 } |
|
1045 document.activeElement.blur(); |
|
1046 window.getSelection().removeAllRanges(); |
|
1047 } |
|
1048 |
|
1049 /** |
|
1050 * Sets the `action` to be performed which can be either 'copy' or 'cut'. |
|
1051 * @param {String} action |
|
1052 */ |
|
1053 |
|
1054 }, { |
|
1055 key: 'destroy', |
|
1056 |
|
1057 |
|
1058 /** |
|
1059 * Destroy lifecycle. |
|
1060 */ |
|
1061 value: function destroy() { |
|
1062 this.removeFake(); |
|
1063 } |
|
1064 }, { |
|
1065 key: 'action', |
|
1066 set: function set() { |
|
1067 var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy'; |
|
1068 |
|
1069 this._action = action; |
|
1070 |
|
1071 if (this._action !== 'copy' && this._action !== 'cut') { |
|
1072 throw new Error('Invalid "action" value, use either "copy" or "cut"'); |
|
1073 } |
|
1074 } |
|
1075 |
|
1076 /** |
|
1077 * Gets the `action` property. |
|
1078 * @return {String} |
|
1079 */ |
|
1080 , |
|
1081 get: function get() { |
|
1082 return this._action; |
|
1083 } |
|
1084 |
|
1085 /** |
|
1086 * Sets the `target` property using an element |
|
1087 * that will be have its content copied. |
|
1088 * @param {Element} target |
|
1089 */ |
|
1090 |
|
1091 }, { |
|
1092 key: 'target', |
|
1093 set: function set(target) { |
|
1094 if (target !== undefined) { |
|
1095 if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) { |
|
1096 if (this.action === 'copy' && target.hasAttribute('disabled')) { |
|
1097 throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); |
|
1098 } |
|
1099 |
|
1100 if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) { |
|
1101 throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); |
|
1102 } |
|
1103 |
|
1104 this._target = target; |
|
1105 } else { |
|
1106 throw new Error('Invalid "target" value, use a valid Element'); |
|
1107 } |
|
1108 } |
|
1109 } |
|
1110 |
|
1111 /** |
|
1112 * Gets the `target` property. |
|
1113 * @return {String|HTMLElement} |
|
1114 */ |
|
1115 , |
|
1116 get: function get() { |
|
1117 return this._target; |
|
1118 } |
|
1119 }]); |
|
1120 |
|
1121 return ClipboardAction; |
|
1122 }(); |
|
1123 |
|
1124 /* harmony default export */ var clipboard_action = (clipboard_action_ClipboardAction); |
|
1125 // EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js |
|
1126 var tiny_emitter = __webpack_require__(1); |
|
1127 var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter); |
|
1128 |
|
1129 // EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js |
|
1130 var listen = __webpack_require__(2); |
|
1131 var listen_default = /*#__PURE__*/__webpack_require__.n(listen); |
|
1132 |
|
1133 // CONCATENATED MODULE: ./src/clipboard.js |
|
1134 var clipboard_typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
|
1135 |
|
1136 var clipboard_createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
|
1137 |
|
1138 function clipboard_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
1139 |
|
1140 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } |
|
1141 |
|
1142 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 /** |
|
1149 * Base class which takes one or more elements, adds event listeners to them, |
|
1150 * and instantiates a new `ClipboardAction` on each click. |
|
1151 */ |
|
1152 |
|
1153 var clipboard_Clipboard = function (_Emitter) { |
|
1154 _inherits(Clipboard, _Emitter); |
|
1155 |
|
1156 /** |
|
1157 * @param {String|HTMLElement|HTMLCollection|NodeList} trigger |
|
1158 * @param {Object} options |
|
1159 */ |
|
1160 function Clipboard(trigger, options) { |
|
1161 clipboard_classCallCheck(this, Clipboard); |
|
1162 |
|
1163 var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this)); |
|
1164 |
|
1165 _this.resolveOptions(options); |
|
1166 _this.listenClick(trigger); |
|
1167 return _this; |
|
1168 } |
|
1169 |
|
1170 /** |
|
1171 * Defines if attributes would be resolved using internal setter functions |
|
1172 * or custom functions that were passed in the constructor. |
|
1173 * @param {Object} options |
|
1174 */ |
|
1175 |
|
1176 |
|
1177 clipboard_createClass(Clipboard, [{ |
|
1178 key: 'resolveOptions', |
|
1179 value: function resolveOptions() { |
|
1180 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
1181 |
|
1182 this.action = typeof options.action === 'function' ? options.action : this.defaultAction; |
|
1183 this.target = typeof options.target === 'function' ? options.target : this.defaultTarget; |
|
1184 this.text = typeof options.text === 'function' ? options.text : this.defaultText; |
|
1185 this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body; |
|
1186 } |
|
1187 |
|
1188 /** |
|
1189 * Adds a click event listener to the passed trigger. |
|
1190 * @param {String|HTMLElement|HTMLCollection|NodeList} trigger |
|
1191 */ |
|
1192 |
|
1193 }, { |
|
1194 key: 'listenClick', |
|
1195 value: function listenClick(trigger) { |
|
1196 var _this2 = this; |
|
1197 |
|
1198 this.listener = listen_default()(trigger, 'click', function (e) { |
|
1199 return _this2.onClick(e); |
|
1200 }); |
|
1201 } |
|
1202 |
|
1203 /** |
|
1204 * Defines a new `ClipboardAction` on each click event. |
|
1205 * @param {Event} e |
|
1206 */ |
|
1207 |
|
1208 }, { |
|
1209 key: 'onClick', |
|
1210 value: function onClick(e) { |
|
1211 var trigger = e.delegateTarget || e.currentTarget; |
|
1212 |
|
1213 if (this.clipboardAction) { |
|
1214 this.clipboardAction = null; |
|
1215 } |
|
1216 |
|
1217 this.clipboardAction = new clipboard_action({ |
|
1218 action: this.action(trigger), |
|
1219 target: this.target(trigger), |
|
1220 text: this.text(trigger), |
|
1221 container: this.container, |
|
1222 trigger: trigger, |
|
1223 emitter: this |
|
1224 }); |
|
1225 } |
|
1226 |
|
1227 /** |
|
1228 * Default `action` lookup function. |
|
1229 * @param {Element} trigger |
|
1230 */ |
|
1231 |
|
1232 }, { |
|
1233 key: 'defaultAction', |
|
1234 value: function defaultAction(trigger) { |
|
1235 return getAttributeValue('action', trigger); |
|
1236 } |
|
1237 |
|
1238 /** |
|
1239 * Default `target` lookup function. |
|
1240 * @param {Element} trigger |
|
1241 */ |
|
1242 |
|
1243 }, { |
|
1244 key: 'defaultTarget', |
|
1245 value: function defaultTarget(trigger) { |
|
1246 var selector = getAttributeValue('target', trigger); |
|
1247 |
|
1248 if (selector) { |
|
1249 return document.querySelector(selector); |
|
1250 } |
|
1251 } |
|
1252 |
|
1253 /** |
|
1254 * Returns the support of the given action, or all actions if no action is |
|
1255 * given. |
|
1256 * @param {String} [action] |
|
1257 */ |
|
1258 |
|
1259 }, { |
|
1260 key: 'defaultText', |
|
1261 |
|
1262 |
|
1263 /** |
|
1264 * Default `text` lookup function. |
|
1265 * @param {Element} trigger |
|
1266 */ |
|
1267 value: function defaultText(trigger) { |
|
1268 return getAttributeValue('text', trigger); |
|
1269 } |
|
1270 |
|
1271 /** |
|
1272 * Destroy lifecycle. |
|
1273 */ |
|
1274 |
|
1275 }, { |
|
1276 key: 'destroy', |
|
1277 value: function destroy() { |
|
1278 this.listener.destroy(); |
|
1279 |
|
1280 if (this.clipboardAction) { |
|
1281 this.clipboardAction.destroy(); |
|
1282 this.clipboardAction = null; |
|
1283 } |
|
1284 } |
|
1285 }], [{ |
|
1286 key: 'isSupported', |
|
1287 value: function isSupported() { |
|
1288 var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut']; |
|
1289 |
|
1290 var actions = typeof action === 'string' ? [action] : action; |
|
1291 var support = !!document.queryCommandSupported; |
|
1292 |
|
1293 actions.forEach(function (action) { |
|
1294 support = support && !!document.queryCommandSupported(action); |
|
1295 }); |
|
1296 |
|
1297 return support; |
|
1298 } |
|
1299 }]); |
|
1300 |
|
1301 return Clipboard; |
|
1302 }(tiny_emitter_default.a); |
|
1303 |
|
1304 /** |
|
1305 * Helper function to retrieve attribute value. |
|
1306 * @param {String} suffix |
|
1307 * @param {Element} element |
|
1308 */ |
|
1309 |
|
1310 |
|
1311 function getAttributeValue(suffix, element) { |
|
1312 var attribute = 'data-clipboard-' + suffix; |
|
1313 |
|
1314 if (!element.hasAttribute(attribute)) { |
|
1315 return; |
|
1316 } |
|
1317 |
|
1318 return element.getAttribute(attribute); |
|
1319 } |
|
1320 |
|
1321 /* harmony default export */ var clipboard = __webpack_exports__["default"] = (clipboard_Clipboard); |
|
1322 |
|
1323 /***/ }) |
|
1324 /******/ ])["default"]; |
|
1325 }); |
|
1326 |
|
1327 /***/ }), |
|
1328 |
|
1329 /***/ 273: |
|
1330 /***/ (function(module, exports, __webpack_require__) { |
2205 /***/ (function(module, exports, __webpack_require__) { |
1331 |
2206 |
1332 var __WEBPACK_AMD_DEFINE_RESULT__;/*global define:false */ |
2207 var __WEBPACK_AMD_DEFINE_RESULT__;/*global define:false */ |
1333 /** |
2208 /** |
1334 * Copyright 2012-2017 Craig Campbell |
2209 * Copyright 2012-2017 Craig Campbell |
2390 }) (typeof window !== 'undefined' ? window : null, typeof window !== 'undefined' ? document : null); |
3265 }) (typeof window !== 'undefined' ? window : null, typeof window !== 'undefined' ? document : null); |
2391 |
3266 |
2392 |
3267 |
2393 /***/ }), |
3268 /***/ }), |
2394 |
3269 |
2395 /***/ 29: |
3270 /***/ "mHlH": |
2396 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
3271 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
2397 |
3272 |
2398 "use strict"; |
3273 "use strict"; |
2399 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; }); |
3274 /* unused harmony export useCallback */ |
2400 /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26); |
3275 /* unused harmony export useCallbackOne */ |
2401 |
3276 /* unused harmony export useMemo */ |
2402 function _unsupportedIterableToArray(o, minLen) { |
3277 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useMemoOne; }); |
2403 if (!o) return; |
3278 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cDcd"); |
2404 if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
3279 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
2405 var n = Object.prototype.toString.call(o).slice(8, -1); |
3280 |
2406 if (n === "Object" && o.constructor) n = o.constructor.name; |
3281 |
2407 if (n === "Map" || n === "Set") return Array.from(o); |
3282 function areInputsEqual(newInputs, lastInputs) { |
2408 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
3283 if (newInputs.length !== lastInputs.length) { |
2409 } |
3284 return false; |
|
3285 } |
|
3286 |
|
3287 for (var i = 0; i < newInputs.length; i++) { |
|
3288 if (newInputs[i] !== lastInputs[i]) { |
|
3289 return false; |
|
3290 } |
|
3291 } |
|
3292 |
|
3293 return true; |
|
3294 } |
|
3295 |
|
3296 function useMemoOne(getResult, inputs) { |
|
3297 var initial = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(function () { |
|
3298 return { |
|
3299 inputs: inputs, |
|
3300 result: getResult() |
|
3301 }; |
|
3302 })[0]; |
|
3303 var isFirstRun = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(true); |
|
3304 var committed = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(initial); |
|
3305 var useCache = isFirstRun.current || Boolean(inputs && committed.current.inputs && areInputsEqual(inputs, committed.current.inputs)); |
|
3306 var cache = useCache ? committed.current : { |
|
3307 inputs: inputs, |
|
3308 result: getResult() |
|
3309 }; |
|
3310 Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () { |
|
3311 isFirstRun.current = false; |
|
3312 committed.current = cache; |
|
3313 }, [cache]); |
|
3314 return cache.result; |
|
3315 } |
|
3316 function useCallbackOne(callback, inputs) { |
|
3317 return useMemoOne(function () { |
|
3318 return callback; |
|
3319 }, inputs); |
|
3320 } |
|
3321 var useMemo = useMemoOne; |
|
3322 var useCallback = useCallbackOne; |
|
3323 |
|
3324 |
|
3325 |
2410 |
3326 |
2411 /***/ }), |
3327 /***/ }), |
2412 |
3328 |
2413 /***/ 35: |
3329 /***/ "rl8x": |
2414 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
3330 /***/ (function(module, exports) { |
|
3331 |
|
3332 (function() { module.exports = window["wp"]["isShallowEqual"]; }()); |
|
3333 |
|
3334 /***/ }), |
|
3335 |
|
3336 /***/ "sxGJ": |
|
3337 /***/ (function(module, exports, __webpack_require__) { |
|
3338 |
|
3339 /*! |
|
3340 * clipboard.js v2.0.8 |
|
3341 * https://clipboardjs.com/ |
|
3342 * |
|
3343 * Licensed MIT © Zeno Rocha |
|
3344 */ |
|
3345 (function webpackUniversalModuleDefinition(root, factory) { |
|
3346 if(true) |
|
3347 module.exports = factory(); |
|
3348 else {} |
|
3349 })(this, function() { |
|
3350 return /******/ (function() { // webpackBootstrap |
|
3351 /******/ var __webpack_modules__ = ({ |
|
3352 |
|
3353 /***/ 134: |
|
3354 /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
2415 |
3355 |
2416 "use strict"; |
3356 "use strict"; |
2417 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); |
3357 |
2418 function _iterableToArray(iter) { |
3358 // EXPORTS |
2419 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); |
3359 __webpack_require__.d(__webpack_exports__, { |
2420 } |
3360 "default": function() { return /* binding */ clipboard; } |
|
3361 }); |
|
3362 |
|
3363 // EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js |
|
3364 var tiny_emitter = __webpack_require__(279); |
|
3365 var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter); |
|
3366 // EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js |
|
3367 var listen = __webpack_require__(370); |
|
3368 var listen_default = /*#__PURE__*/__webpack_require__.n(listen); |
|
3369 // EXTERNAL MODULE: ./node_modules/select/src/select.js |
|
3370 var src_select = __webpack_require__(817); |
|
3371 var select_default = /*#__PURE__*/__webpack_require__.n(src_select); |
|
3372 ;// CONCATENATED MODULE: ./src/clipboard-action.js |
|
3373 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } |
|
3374 |
|
3375 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
3376 |
|
3377 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
3378 |
|
3379 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } |
|
3380 |
|
3381 |
|
3382 /** |
|
3383 * Inner class which performs selection from either `text` or `target` |
|
3384 * properties and then executes copy or cut operations. |
|
3385 */ |
|
3386 |
|
3387 var ClipboardAction = /*#__PURE__*/function () { |
|
3388 /** |
|
3389 * @param {Object} options |
|
3390 */ |
|
3391 function ClipboardAction(options) { |
|
3392 _classCallCheck(this, ClipboardAction); |
|
3393 |
|
3394 this.resolveOptions(options); |
|
3395 this.initSelection(); |
|
3396 } |
|
3397 /** |
|
3398 * Defines base properties passed from constructor. |
|
3399 * @param {Object} options |
|
3400 */ |
|
3401 |
|
3402 |
|
3403 _createClass(ClipboardAction, [{ |
|
3404 key: "resolveOptions", |
|
3405 value: function resolveOptions() { |
|
3406 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3407 this.action = options.action; |
|
3408 this.container = options.container; |
|
3409 this.emitter = options.emitter; |
|
3410 this.target = options.target; |
|
3411 this.text = options.text; |
|
3412 this.trigger = options.trigger; |
|
3413 this.selectedText = ''; |
|
3414 } |
|
3415 /** |
|
3416 * Decides which selection strategy is going to be applied based |
|
3417 * on the existence of `text` and `target` properties. |
|
3418 */ |
|
3419 |
|
3420 }, { |
|
3421 key: "initSelection", |
|
3422 value: function initSelection() { |
|
3423 if (this.text) { |
|
3424 this.selectFake(); |
|
3425 } else if (this.target) { |
|
3426 this.selectTarget(); |
|
3427 } |
|
3428 } |
|
3429 /** |
|
3430 * Creates a fake textarea element, sets its value from `text` property, |
|
3431 */ |
|
3432 |
|
3433 }, { |
|
3434 key: "createFakeElement", |
|
3435 value: function createFakeElement() { |
|
3436 var isRTL = document.documentElement.getAttribute('dir') === 'rtl'; |
|
3437 this.fakeElem = document.createElement('textarea'); // Prevent zooming on iOS |
|
3438 |
|
3439 this.fakeElem.style.fontSize = '12pt'; // Reset box model |
|
3440 |
|
3441 this.fakeElem.style.border = '0'; |
|
3442 this.fakeElem.style.padding = '0'; |
|
3443 this.fakeElem.style.margin = '0'; // Move element out of screen horizontally |
|
3444 |
|
3445 this.fakeElem.style.position = 'absolute'; |
|
3446 this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically |
|
3447 |
|
3448 var yPosition = window.pageYOffset || document.documentElement.scrollTop; |
|
3449 this.fakeElem.style.top = "".concat(yPosition, "px"); |
|
3450 this.fakeElem.setAttribute('readonly', ''); |
|
3451 this.fakeElem.value = this.text; |
|
3452 return this.fakeElem; |
|
3453 } |
|
3454 /** |
|
3455 * Get's the value of fakeElem, |
|
3456 * and makes a selection on it. |
|
3457 */ |
|
3458 |
|
3459 }, { |
|
3460 key: "selectFake", |
|
3461 value: function selectFake() { |
|
3462 var _this = this; |
|
3463 |
|
3464 var fakeElem = this.createFakeElement(); |
|
3465 |
|
3466 this.fakeHandlerCallback = function () { |
|
3467 return _this.removeFake(); |
|
3468 }; |
|
3469 |
|
3470 this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true; |
|
3471 this.container.appendChild(fakeElem); |
|
3472 this.selectedText = select_default()(fakeElem); |
|
3473 this.copyText(); |
|
3474 this.removeFake(); |
|
3475 } |
|
3476 /** |
|
3477 * Only removes the fake element after another click event, that way |
|
3478 * a user can hit `Ctrl+C` to copy because selection still exists. |
|
3479 */ |
|
3480 |
|
3481 }, { |
|
3482 key: "removeFake", |
|
3483 value: function removeFake() { |
|
3484 if (this.fakeHandler) { |
|
3485 this.container.removeEventListener('click', this.fakeHandlerCallback); |
|
3486 this.fakeHandler = null; |
|
3487 this.fakeHandlerCallback = null; |
|
3488 } |
|
3489 |
|
3490 if (this.fakeElem) { |
|
3491 this.container.removeChild(this.fakeElem); |
|
3492 this.fakeElem = null; |
|
3493 } |
|
3494 } |
|
3495 /** |
|
3496 * Selects the content from element passed on `target` property. |
|
3497 */ |
|
3498 |
|
3499 }, { |
|
3500 key: "selectTarget", |
|
3501 value: function selectTarget() { |
|
3502 this.selectedText = select_default()(this.target); |
|
3503 this.copyText(); |
|
3504 } |
|
3505 /** |
|
3506 * Executes the copy operation based on the current selection. |
|
3507 */ |
|
3508 |
|
3509 }, { |
|
3510 key: "copyText", |
|
3511 value: function copyText() { |
|
3512 var succeeded; |
|
3513 |
|
3514 try { |
|
3515 succeeded = document.execCommand(this.action); |
|
3516 } catch (err) { |
|
3517 succeeded = false; |
|
3518 } |
|
3519 |
|
3520 this.handleResult(succeeded); |
|
3521 } |
|
3522 /** |
|
3523 * Fires an event based on the copy operation result. |
|
3524 * @param {Boolean} succeeded |
|
3525 */ |
|
3526 |
|
3527 }, { |
|
3528 key: "handleResult", |
|
3529 value: function handleResult(succeeded) { |
|
3530 this.emitter.emit(succeeded ? 'success' : 'error', { |
|
3531 action: this.action, |
|
3532 text: this.selectedText, |
|
3533 trigger: this.trigger, |
|
3534 clearSelection: this.clearSelection.bind(this) |
|
3535 }); |
|
3536 } |
|
3537 /** |
|
3538 * Moves focus away from `target` and back to the trigger, removes current selection. |
|
3539 */ |
|
3540 |
|
3541 }, { |
|
3542 key: "clearSelection", |
|
3543 value: function clearSelection() { |
|
3544 if (this.trigger) { |
|
3545 this.trigger.focus(); |
|
3546 } |
|
3547 |
|
3548 document.activeElement.blur(); |
|
3549 window.getSelection().removeAllRanges(); |
|
3550 } |
|
3551 /** |
|
3552 * Sets the `action` to be performed which can be either 'copy' or 'cut'. |
|
3553 * @param {String} action |
|
3554 */ |
|
3555 |
|
3556 }, { |
|
3557 key: "destroy", |
|
3558 |
|
3559 /** |
|
3560 * Destroy lifecycle. |
|
3561 */ |
|
3562 value: function destroy() { |
|
3563 this.removeFake(); |
|
3564 } |
|
3565 }, { |
|
3566 key: "action", |
|
3567 set: function set() { |
|
3568 var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy'; |
|
3569 this._action = action; |
|
3570 |
|
3571 if (this._action !== 'copy' && this._action !== 'cut') { |
|
3572 throw new Error('Invalid "action" value, use either "copy" or "cut"'); |
|
3573 } |
|
3574 } |
|
3575 /** |
|
3576 * Gets the `action` property. |
|
3577 * @return {String} |
|
3578 */ |
|
3579 , |
|
3580 get: function get() { |
|
3581 return this._action; |
|
3582 } |
|
3583 /** |
|
3584 * Sets the `target` property using an element |
|
3585 * that will be have its content copied. |
|
3586 * @param {Element} target |
|
3587 */ |
|
3588 |
|
3589 }, { |
|
3590 key: "target", |
|
3591 set: function set(target) { |
|
3592 if (target !== undefined) { |
|
3593 if (target && _typeof(target) === 'object' && target.nodeType === 1) { |
|
3594 if (this.action === 'copy' && target.hasAttribute('disabled')) { |
|
3595 throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); |
|
3596 } |
|
3597 |
|
3598 if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) { |
|
3599 throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); |
|
3600 } |
|
3601 |
|
3602 this._target = target; |
|
3603 } else { |
|
3604 throw new Error('Invalid "target" value, use a valid Element'); |
|
3605 } |
|
3606 } |
|
3607 } |
|
3608 /** |
|
3609 * Gets the `target` property. |
|
3610 * @return {String|HTMLElement} |
|
3611 */ |
|
3612 , |
|
3613 get: function get() { |
|
3614 return this._target; |
|
3615 } |
|
3616 }]); |
|
3617 |
|
3618 return ClipboardAction; |
|
3619 }(); |
|
3620 |
|
3621 /* harmony default export */ var clipboard_action = (ClipboardAction); |
|
3622 ;// CONCATENATED MODULE: ./src/clipboard.js |
|
3623 function clipboard_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { clipboard_typeof = function _typeof(obj) { return typeof obj; }; } else { clipboard_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return clipboard_typeof(obj); } |
|
3624 |
|
3625 function clipboard_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|
3626 |
|
3627 function clipboard_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } |
|
3628 |
|
3629 function clipboard_createClass(Constructor, protoProps, staticProps) { if (protoProps) clipboard_defineProperties(Constructor.prototype, protoProps); if (staticProps) clipboard_defineProperties(Constructor, staticProps); return Constructor; } |
|
3630 |
|
3631 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } |
|
3632 |
|
3633 function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } |
|
3634 |
|
3635 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } |
|
3636 |
|
3637 function _possibleConstructorReturn(self, call) { if (call && (clipboard_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } |
|
3638 |
|
3639 function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } |
|
3640 |
|
3641 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
3642 |
|
3643 function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } |
|
3644 |
|
3645 |
|
3646 |
|
3647 |
|
3648 /** |
|
3649 * Helper function to retrieve attribute value. |
|
3650 * @param {String} suffix |
|
3651 * @param {Element} element |
|
3652 */ |
|
3653 |
|
3654 function getAttributeValue(suffix, element) { |
|
3655 var attribute = "data-clipboard-".concat(suffix); |
|
3656 |
|
3657 if (!element.hasAttribute(attribute)) { |
|
3658 return; |
|
3659 } |
|
3660 |
|
3661 return element.getAttribute(attribute); |
|
3662 } |
|
3663 /** |
|
3664 * Base class which takes one or more elements, adds event listeners to them, |
|
3665 * and instantiates a new `ClipboardAction` on each click. |
|
3666 */ |
|
3667 |
|
3668 |
|
3669 var Clipboard = /*#__PURE__*/function (_Emitter) { |
|
3670 _inherits(Clipboard, _Emitter); |
|
3671 |
|
3672 var _super = _createSuper(Clipboard); |
|
3673 |
|
3674 /** |
|
3675 * @param {String|HTMLElement|HTMLCollection|NodeList} trigger |
|
3676 * @param {Object} options |
|
3677 */ |
|
3678 function Clipboard(trigger, options) { |
|
3679 var _this; |
|
3680 |
|
3681 clipboard_classCallCheck(this, Clipboard); |
|
3682 |
|
3683 _this = _super.call(this); |
|
3684 |
|
3685 _this.resolveOptions(options); |
|
3686 |
|
3687 _this.listenClick(trigger); |
|
3688 |
|
3689 return _this; |
|
3690 } |
|
3691 /** |
|
3692 * Defines if attributes would be resolved using internal setter functions |
|
3693 * or custom functions that were passed in the constructor. |
|
3694 * @param {Object} options |
|
3695 */ |
|
3696 |
|
3697 |
|
3698 clipboard_createClass(Clipboard, [{ |
|
3699 key: "resolveOptions", |
|
3700 value: function resolveOptions() { |
|
3701 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3702 this.action = typeof options.action === 'function' ? options.action : this.defaultAction; |
|
3703 this.target = typeof options.target === 'function' ? options.target : this.defaultTarget; |
|
3704 this.text = typeof options.text === 'function' ? options.text : this.defaultText; |
|
3705 this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body; |
|
3706 } |
|
3707 /** |
|
3708 * Adds a click event listener to the passed trigger. |
|
3709 * @param {String|HTMLElement|HTMLCollection|NodeList} trigger |
|
3710 */ |
|
3711 |
|
3712 }, { |
|
3713 key: "listenClick", |
|
3714 value: function listenClick(trigger) { |
|
3715 var _this2 = this; |
|
3716 |
|
3717 this.listener = listen_default()(trigger, 'click', function (e) { |
|
3718 return _this2.onClick(e); |
|
3719 }); |
|
3720 } |
|
3721 /** |
|
3722 * Defines a new `ClipboardAction` on each click event. |
|
3723 * @param {Event} e |
|
3724 */ |
|
3725 |
|
3726 }, { |
|
3727 key: "onClick", |
|
3728 value: function onClick(e) { |
|
3729 var trigger = e.delegateTarget || e.currentTarget; |
|
3730 |
|
3731 if (this.clipboardAction) { |
|
3732 this.clipboardAction = null; |
|
3733 } |
|
3734 |
|
3735 this.clipboardAction = new clipboard_action({ |
|
3736 action: this.action(trigger), |
|
3737 target: this.target(trigger), |
|
3738 text: this.text(trigger), |
|
3739 container: this.container, |
|
3740 trigger: trigger, |
|
3741 emitter: this |
|
3742 }); |
|
3743 } |
|
3744 /** |
|
3745 * Default `action` lookup function. |
|
3746 * @param {Element} trigger |
|
3747 */ |
|
3748 |
|
3749 }, { |
|
3750 key: "defaultAction", |
|
3751 value: function defaultAction(trigger) { |
|
3752 return getAttributeValue('action', trigger); |
|
3753 } |
|
3754 /** |
|
3755 * Default `target` lookup function. |
|
3756 * @param {Element} trigger |
|
3757 */ |
|
3758 |
|
3759 }, { |
|
3760 key: "defaultTarget", |
|
3761 value: function defaultTarget(trigger) { |
|
3762 var selector = getAttributeValue('target', trigger); |
|
3763 |
|
3764 if (selector) { |
|
3765 return document.querySelector(selector); |
|
3766 } |
|
3767 } |
|
3768 /** |
|
3769 * Returns the support of the given action, or all actions if no action is |
|
3770 * given. |
|
3771 * @param {String} [action] |
|
3772 */ |
|
3773 |
|
3774 }, { |
|
3775 key: "defaultText", |
|
3776 |
|
3777 /** |
|
3778 * Default `text` lookup function. |
|
3779 * @param {Element} trigger |
|
3780 */ |
|
3781 value: function defaultText(trigger) { |
|
3782 return getAttributeValue('text', trigger); |
|
3783 } |
|
3784 /** |
|
3785 * Destroy lifecycle. |
|
3786 */ |
|
3787 |
|
3788 }, { |
|
3789 key: "destroy", |
|
3790 value: function destroy() { |
|
3791 this.listener.destroy(); |
|
3792 |
|
3793 if (this.clipboardAction) { |
|
3794 this.clipboardAction.destroy(); |
|
3795 this.clipboardAction = null; |
|
3796 } |
|
3797 } |
|
3798 }], [{ |
|
3799 key: "isSupported", |
|
3800 value: function isSupported() { |
|
3801 var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut']; |
|
3802 var actions = typeof action === 'string' ? [action] : action; |
|
3803 var support = !!document.queryCommandSupported; |
|
3804 actions.forEach(function (action) { |
|
3805 support = support && !!document.queryCommandSupported(action); |
|
3806 }); |
|
3807 return support; |
|
3808 } |
|
3809 }]); |
|
3810 |
|
3811 return Clipboard; |
|
3812 }((tiny_emitter_default())); |
|
3813 |
|
3814 /* harmony default export */ var clipboard = (Clipboard); |
2421 |
3815 |
2422 /***/ }), |
3816 /***/ }), |
2423 |
3817 |
2424 /***/ 38: |
3818 /***/ 828: |
2425 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
3819 /***/ (function(module) { |
2426 |
3820 |
2427 "use strict"; |
3821 var DOCUMENT_NODE_TYPE = 9; |
2428 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); |
3822 |
2429 function _arrayWithHoles(arr) { |
3823 /** |
2430 if (Array.isArray(arr)) return arr; |
3824 * A polyfill for Element.matches() |
2431 } |
3825 */ |
|
3826 if (typeof Element !== 'undefined' && !Element.prototype.matches) { |
|
3827 var proto = Element.prototype; |
|
3828 |
|
3829 proto.matches = proto.matchesSelector || |
|
3830 proto.mozMatchesSelector || |
|
3831 proto.msMatchesSelector || |
|
3832 proto.oMatchesSelector || |
|
3833 proto.webkitMatchesSelector; |
|
3834 } |
|
3835 |
|
3836 /** |
|
3837 * Finds the closest parent that matches a selector. |
|
3838 * |
|
3839 * @param {Element} element |
|
3840 * @param {String} selector |
|
3841 * @return {Function} |
|
3842 */ |
|
3843 function closest (element, selector) { |
|
3844 while (element && element.nodeType !== DOCUMENT_NODE_TYPE) { |
|
3845 if (typeof element.matches === 'function' && |
|
3846 element.matches(selector)) { |
|
3847 return element; |
|
3848 } |
|
3849 element = element.parentNode; |
|
3850 } |
|
3851 } |
|
3852 |
|
3853 module.exports = closest; |
|
3854 |
2432 |
3855 |
2433 /***/ }), |
3856 /***/ }), |
2434 |
3857 |
2435 /***/ 39: |
3858 /***/ 438: |
2436 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
3859 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { |
2437 |
3860 |
2438 "use strict"; |
3861 var closest = __webpack_require__(828); |
2439 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); |
3862 |
2440 function _nonIterableRest() { |
3863 /** |
2441 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
3864 * Delegates event to a selector. |
2442 } |
3865 * |
|
3866 * @param {Element} element |
|
3867 * @param {String} selector |
|
3868 * @param {String} type |
|
3869 * @param {Function} callback |
|
3870 * @param {Boolean} useCapture |
|
3871 * @return {Object} |
|
3872 */ |
|
3873 function _delegate(element, selector, type, callback, useCapture) { |
|
3874 var listenerFn = listener.apply(this, arguments); |
|
3875 |
|
3876 element.addEventListener(type, listenerFn, useCapture); |
|
3877 |
|
3878 return { |
|
3879 destroy: function() { |
|
3880 element.removeEventListener(type, listenerFn, useCapture); |
|
3881 } |
|
3882 } |
|
3883 } |
|
3884 |
|
3885 /** |
|
3886 * Delegates event to a selector. |
|
3887 * |
|
3888 * @param {Element|String|Array} [elements] |
|
3889 * @param {String} selector |
|
3890 * @param {String} type |
|
3891 * @param {Function} callback |
|
3892 * @param {Boolean} useCapture |
|
3893 * @return {Object} |
|
3894 */ |
|
3895 function delegate(elements, selector, type, callback, useCapture) { |
|
3896 // Handle the regular Element usage |
|
3897 if (typeof elements.addEventListener === 'function') { |
|
3898 return _delegate.apply(null, arguments); |
|
3899 } |
|
3900 |
|
3901 // Handle Element-less usage, it defaults to global delegation |
|
3902 if (typeof type === 'function') { |
|
3903 // Use `document` as the first parameter, then apply arguments |
|
3904 // This is a short way to .unshift `arguments` without running into deoptimizations |
|
3905 return _delegate.bind(null, document).apply(null, arguments); |
|
3906 } |
|
3907 |
|
3908 // Handle Selector-based usage |
|
3909 if (typeof elements === 'string') { |
|
3910 elements = document.querySelectorAll(elements); |
|
3911 } |
|
3912 |
|
3913 // Handle Array-like based usage |
|
3914 return Array.prototype.map.call(elements, function (element) { |
|
3915 return _delegate(element, selector, type, callback, useCapture); |
|
3916 }); |
|
3917 } |
|
3918 |
|
3919 /** |
|
3920 * Finds closest match and invokes callback. |
|
3921 * |
|
3922 * @param {Element} element |
|
3923 * @param {String} selector |
|
3924 * @param {String} type |
|
3925 * @param {Function} callback |
|
3926 * @return {Function} |
|
3927 */ |
|
3928 function listener(element, selector, type, callback) { |
|
3929 return function(e) { |
|
3930 e.delegateTarget = closest(e.target, selector); |
|
3931 |
|
3932 if (e.delegateTarget) { |
|
3933 callback.call(element, e); |
|
3934 } |
|
3935 } |
|
3936 } |
|
3937 |
|
3938 module.exports = delegate; |
|
3939 |
2443 |
3940 |
2444 /***/ }), |
3941 /***/ }), |
2445 |
3942 |
2446 /***/ 40: |
3943 /***/ 879: |
2447 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
3944 /***/ (function(__unused_webpack_module, exports) { |
2448 |
3945 |
2449 "use strict"; |
3946 /** |
2450 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); |
3947 * Check if argument is a HTML element. |
2451 function _typeof(obj) { |
3948 * |
2452 "@babel/helpers - typeof"; |
3949 * @param {Object} value |
2453 |
3950 * @return {Boolean} |
2454 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { |
3951 */ |
2455 _typeof = function _typeof(obj) { |
3952 exports.node = function(value) { |
2456 return typeof obj; |
3953 return value !== undefined |
|
3954 && value instanceof HTMLElement |
|
3955 && value.nodeType === 1; |
|
3956 }; |
|
3957 |
|
3958 /** |
|
3959 * Check if argument is a list of HTML elements. |
|
3960 * |
|
3961 * @param {Object} value |
|
3962 * @return {Boolean} |
|
3963 */ |
|
3964 exports.nodeList = function(value) { |
|
3965 var type = Object.prototype.toString.call(value); |
|
3966 |
|
3967 return value !== undefined |
|
3968 && (type === '[object NodeList]' || type === '[object HTMLCollection]') |
|
3969 && ('length' in value) |
|
3970 && (value.length === 0 || exports.node(value[0])); |
|
3971 }; |
|
3972 |
|
3973 /** |
|
3974 * Check if argument is a string. |
|
3975 * |
|
3976 * @param {Object} value |
|
3977 * @return {Boolean} |
|
3978 */ |
|
3979 exports.string = function(value) { |
|
3980 return typeof value === 'string' |
|
3981 || value instanceof String; |
|
3982 }; |
|
3983 |
|
3984 /** |
|
3985 * Check if argument is a function. |
|
3986 * |
|
3987 * @param {Object} value |
|
3988 * @return {Boolean} |
|
3989 */ |
|
3990 exports.fn = function(value) { |
|
3991 var type = Object.prototype.toString.call(value); |
|
3992 |
|
3993 return type === '[object Function]'; |
|
3994 }; |
|
3995 |
|
3996 |
|
3997 /***/ }), |
|
3998 |
|
3999 /***/ 370: |
|
4000 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { |
|
4001 |
|
4002 var is = __webpack_require__(879); |
|
4003 var delegate = __webpack_require__(438); |
|
4004 |
|
4005 /** |
|
4006 * Validates all params and calls the right |
|
4007 * listener function based on its target type. |
|
4008 * |
|
4009 * @param {String|HTMLElement|HTMLCollection|NodeList} target |
|
4010 * @param {String} type |
|
4011 * @param {Function} callback |
|
4012 * @return {Object} |
|
4013 */ |
|
4014 function listen(target, type, callback) { |
|
4015 if (!target && !type && !callback) { |
|
4016 throw new Error('Missing required arguments'); |
|
4017 } |
|
4018 |
|
4019 if (!is.string(type)) { |
|
4020 throw new TypeError('Second argument must be a String'); |
|
4021 } |
|
4022 |
|
4023 if (!is.fn(callback)) { |
|
4024 throw new TypeError('Third argument must be a Function'); |
|
4025 } |
|
4026 |
|
4027 if (is.node(target)) { |
|
4028 return listenNode(target, type, callback); |
|
4029 } |
|
4030 else if (is.nodeList(target)) { |
|
4031 return listenNodeList(target, type, callback); |
|
4032 } |
|
4033 else if (is.string(target)) { |
|
4034 return listenSelector(target, type, callback); |
|
4035 } |
|
4036 else { |
|
4037 throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList'); |
|
4038 } |
|
4039 } |
|
4040 |
|
4041 /** |
|
4042 * Adds an event listener to a HTML element |
|
4043 * and returns a remove listener function. |
|
4044 * |
|
4045 * @param {HTMLElement} node |
|
4046 * @param {String} type |
|
4047 * @param {Function} callback |
|
4048 * @return {Object} |
|
4049 */ |
|
4050 function listenNode(node, type, callback) { |
|
4051 node.addEventListener(type, callback); |
|
4052 |
|
4053 return { |
|
4054 destroy: function() { |
|
4055 node.removeEventListener(type, callback); |
|
4056 } |
|
4057 } |
|
4058 } |
|
4059 |
|
4060 /** |
|
4061 * Add an event listener to a list of HTML elements |
|
4062 * and returns a remove listener function. |
|
4063 * |
|
4064 * @param {NodeList|HTMLCollection} nodeList |
|
4065 * @param {String} type |
|
4066 * @param {Function} callback |
|
4067 * @return {Object} |
|
4068 */ |
|
4069 function listenNodeList(nodeList, type, callback) { |
|
4070 Array.prototype.forEach.call(nodeList, function(node) { |
|
4071 node.addEventListener(type, callback); |
|
4072 }); |
|
4073 |
|
4074 return { |
|
4075 destroy: function() { |
|
4076 Array.prototype.forEach.call(nodeList, function(node) { |
|
4077 node.removeEventListener(type, callback); |
|
4078 }); |
|
4079 } |
|
4080 } |
|
4081 } |
|
4082 |
|
4083 /** |
|
4084 * Add an event listener to a selector |
|
4085 * and returns a remove listener function. |
|
4086 * |
|
4087 * @param {String} selector |
|
4088 * @param {String} type |
|
4089 * @param {Function} callback |
|
4090 * @return {Object} |
|
4091 */ |
|
4092 function listenSelector(selector, type, callback) { |
|
4093 return delegate(document.body, selector, type, callback); |
|
4094 } |
|
4095 |
|
4096 module.exports = listen; |
|
4097 |
|
4098 |
|
4099 /***/ }), |
|
4100 |
|
4101 /***/ 817: |
|
4102 /***/ (function(module) { |
|
4103 |
|
4104 function select(element) { |
|
4105 var selectedText; |
|
4106 |
|
4107 if (element.nodeName === 'SELECT') { |
|
4108 element.focus(); |
|
4109 |
|
4110 selectedText = element.value; |
|
4111 } |
|
4112 else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { |
|
4113 var isReadOnly = element.hasAttribute('readonly'); |
|
4114 |
|
4115 if (!isReadOnly) { |
|
4116 element.setAttribute('readonly', ''); |
|
4117 } |
|
4118 |
|
4119 element.select(); |
|
4120 element.setSelectionRange(0, element.value.length); |
|
4121 |
|
4122 if (!isReadOnly) { |
|
4123 element.removeAttribute('readonly'); |
|
4124 } |
|
4125 |
|
4126 selectedText = element.value; |
|
4127 } |
|
4128 else { |
|
4129 if (element.hasAttribute('contenteditable')) { |
|
4130 element.focus(); |
|
4131 } |
|
4132 |
|
4133 var selection = window.getSelection(); |
|
4134 var range = document.createRange(); |
|
4135 |
|
4136 range.selectNodeContents(element); |
|
4137 selection.removeAllRanges(); |
|
4138 selection.addRange(range); |
|
4139 |
|
4140 selectedText = selection.toString(); |
|
4141 } |
|
4142 |
|
4143 return selectedText; |
|
4144 } |
|
4145 |
|
4146 module.exports = select; |
|
4147 |
|
4148 |
|
4149 /***/ }), |
|
4150 |
|
4151 /***/ 279: |
|
4152 /***/ (function(module) { |
|
4153 |
|
4154 function E () { |
|
4155 // Keep this empty so it's easier to inherit from |
|
4156 // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) |
|
4157 } |
|
4158 |
|
4159 E.prototype = { |
|
4160 on: function (name, callback, ctx) { |
|
4161 var e = this.e || (this.e = {}); |
|
4162 |
|
4163 (e[name] || (e[name] = [])).push({ |
|
4164 fn: callback, |
|
4165 ctx: ctx |
|
4166 }); |
|
4167 |
|
4168 return this; |
|
4169 }, |
|
4170 |
|
4171 once: function (name, callback, ctx) { |
|
4172 var self = this; |
|
4173 function listener () { |
|
4174 self.off(name, listener); |
|
4175 callback.apply(ctx, arguments); |
2457 }; |
4176 }; |
2458 } else { |
4177 |
2459 _typeof = function _typeof(obj) { |
4178 listener._ = callback |
2460 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; |
4179 return this.on(name, listener, ctx); |
2461 }; |
|
2462 } |
|
2463 |
|
2464 return _typeof(obj); |
|
2465 } |
|
2466 |
|
2467 /***/ }), |
|
2468 |
|
2469 /***/ 411: |
|
2470 /***/ (function(module, exports) { |
|
2471 |
|
2472 /** |
|
2473 * adds a bindGlobal method to Mousetrap that allows you to |
|
2474 * bind specific keyboard shortcuts that will still work |
|
2475 * inside a text input field |
|
2476 * |
|
2477 * usage: |
|
2478 * Mousetrap.bindGlobal('ctrl+s', _saveChanges); |
|
2479 */ |
|
2480 /* global Mousetrap:true */ |
|
2481 (function(Mousetrap) { |
|
2482 if (! Mousetrap) { |
|
2483 return; |
|
2484 } |
|
2485 var _globalCallbacks = {}; |
|
2486 var _originalStopCallback = Mousetrap.prototype.stopCallback; |
|
2487 |
|
2488 Mousetrap.prototype.stopCallback = function(e, element, combo, sequence) { |
|
2489 var self = this; |
|
2490 |
|
2491 if (self.paused) { |
|
2492 return true; |
|
2493 } |
|
2494 |
|
2495 if (_globalCallbacks[combo] || _globalCallbacks[sequence]) { |
|
2496 return false; |
|
2497 } |
|
2498 |
|
2499 return _originalStopCallback.call(self, e, element, combo); |
|
2500 }; |
|
2501 |
|
2502 Mousetrap.prototype.bindGlobal = function(keys, callback, action) { |
|
2503 var self = this; |
|
2504 self.bind(keys, callback, action); |
|
2505 |
|
2506 if (keys instanceof Array) { |
|
2507 for (var i = 0; i < keys.length; i++) { |
|
2508 _globalCallbacks[keys[i]] = true; |
|
2509 } |
|
2510 return; |
|
2511 } |
|
2512 |
|
2513 _globalCallbacks[keys] = true; |
|
2514 }; |
|
2515 |
|
2516 Mousetrap.init(); |
|
2517 }) (typeof Mousetrap !== "undefined" ? Mousetrap : undefined); |
|
2518 |
|
2519 |
|
2520 /***/ }), |
|
2521 |
|
2522 /***/ 445: |
|
2523 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
2524 |
|
2525 "use strict"; |
|
2526 // ESM COMPAT FLAG |
|
2527 __webpack_require__.r(__webpack_exports__); |
|
2528 |
|
2529 // EXPORTS |
|
2530 __webpack_require__.d(__webpack_exports__, "createHigherOrderComponent", function() { return /* reexport */ create_higher_order_component; }); |
|
2531 __webpack_require__.d(__webpack_exports__, "compose", function() { return /* reexport */ compose; }); |
|
2532 __webpack_require__.d(__webpack_exports__, "ifCondition", function() { return /* reexport */ if_condition; }); |
|
2533 __webpack_require__.d(__webpack_exports__, "pure", function() { return /* reexport */ higher_order_pure; }); |
|
2534 __webpack_require__.d(__webpack_exports__, "withGlobalEvents", function() { return /* reexport */ with_global_events; }); |
|
2535 __webpack_require__.d(__webpack_exports__, "withInstanceId", function() { return /* reexport */ with_instance_id; }); |
|
2536 __webpack_require__.d(__webpack_exports__, "withSafeTimeout", function() { return /* reexport */ with_safe_timeout; }); |
|
2537 __webpack_require__.d(__webpack_exports__, "withState", function() { return /* reexport */ withState; }); |
|
2538 __webpack_require__.d(__webpack_exports__, "useCopyOnClick", function() { return /* reexport */ useCopyOnClick; }); |
|
2539 __webpack_require__.d(__webpack_exports__, "__experimentalUseDragging", function() { return /* reexport */ useDragging; }); |
|
2540 __webpack_require__.d(__webpack_exports__, "useInstanceId", function() { return /* reexport */ useInstanceId; }); |
|
2541 __webpack_require__.d(__webpack_exports__, "useKeyboardShortcut", function() { return /* reexport */ use_keyboard_shortcut; }); |
|
2542 __webpack_require__.d(__webpack_exports__, "useMediaQuery", function() { return /* reexport */ useMediaQuery; }); |
|
2543 __webpack_require__.d(__webpack_exports__, "usePrevious", function() { return /* reexport */ usePrevious; }); |
|
2544 __webpack_require__.d(__webpack_exports__, "useReducedMotion", function() { return /* reexport */ use_reduced_motion; }); |
|
2545 __webpack_require__.d(__webpack_exports__, "useViewportMatch", function() { return /* reexport */ use_viewport_match; }); |
|
2546 __webpack_require__.d(__webpack_exports__, "useResizeObserver", function() { return /* reexport */ use_resize_observer; }); |
|
2547 __webpack_require__.d(__webpack_exports__, "useAsyncList", function() { return /* reexport */ use_async_list; }); |
|
2548 __webpack_require__.d(__webpack_exports__, "useWarnOnChange", function() { return /* reexport */ use_warn_on_change; }); |
|
2549 |
|
2550 // EXTERNAL MODULE: external {"this":"lodash"} |
|
2551 var external_this_lodash_ = __webpack_require__(2); |
|
2552 |
|
2553 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/utils/create-higher-order-component/index.js |
|
2554 /** |
|
2555 * External dependencies |
|
2556 */ |
|
2557 |
|
2558 /** |
|
2559 * Given a function mapping a component to an enhanced component and modifier |
|
2560 * name, returns the enhanced component augmented with a generated displayName. |
|
2561 * |
|
2562 * @param {Function} mapComponentToEnhancedComponent Function mapping component |
|
2563 * to enhanced component. |
|
2564 * @param {string} modifierName Seed name from which to |
|
2565 * generated display name. |
|
2566 * |
|
2567 * @return {WPComponent} Component class with generated display name assigned. |
|
2568 */ |
|
2569 |
|
2570 function createHigherOrderComponent(mapComponentToEnhancedComponent, modifierName) { |
|
2571 return function (OriginalComponent) { |
|
2572 var EnhancedComponent = mapComponentToEnhancedComponent(OriginalComponent); |
|
2573 var _OriginalComponent$di = OriginalComponent.displayName, |
|
2574 displayName = _OriginalComponent$di === void 0 ? OriginalComponent.name || 'Component' : _OriginalComponent$di; |
|
2575 EnhancedComponent.displayName = "".concat(Object(external_this_lodash_["upperFirst"])(Object(external_this_lodash_["camelCase"])(modifierName)), "(").concat(displayName, ")"); |
|
2576 return EnhancedComponent; |
|
2577 }; |
|
2578 } |
|
2579 |
|
2580 /* harmony default export */ var create_higher_order_component = (createHigherOrderComponent); |
|
2581 |
|
2582 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/compose.js |
|
2583 /** |
|
2584 * External dependencies |
|
2585 */ |
|
2586 |
|
2587 /** |
|
2588 * Composes multiple higher-order components into a single higher-order component. Performs right-to-left function |
|
2589 * composition, where each successive invocation is supplied the return value of the previous. |
|
2590 * |
|
2591 * @param {...Function} hocs The HOC functions to invoke. |
|
2592 * |
|
2593 * @return {Function} Returns the new composite function. |
|
2594 */ |
|
2595 |
|
2596 /* harmony default export */ var compose = (external_this_lodash_["flowRight"]); |
|
2597 |
|
2598 // EXTERNAL MODULE: external {"this":["wp","element"]} |
|
2599 var external_this_wp_element_ = __webpack_require__(0); |
|
2600 |
|
2601 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/if-condition/index.js |
|
2602 |
|
2603 |
|
2604 /** |
|
2605 * Internal dependencies |
|
2606 */ |
|
2607 |
|
2608 /** |
|
2609 * Higher-order component creator, creating a new component which renders if |
|
2610 * the given condition is satisfied or with the given optional prop name. |
|
2611 * |
|
2612 * @param {Function} predicate Function to test condition. |
|
2613 * |
|
2614 * @return {Function} Higher-order component. |
|
2615 */ |
|
2616 |
|
2617 var if_condition_ifCondition = function ifCondition(predicate) { |
|
2618 return create_higher_order_component(function (WrappedComponent) { |
|
2619 return function (props) { |
|
2620 if (!predicate(props)) { |
|
2621 return null; |
|
2622 } |
|
2623 |
|
2624 return Object(external_this_wp_element_["createElement"])(WrappedComponent, props); |
|
2625 }; |
|
2626 }, 'ifCondition'); |
|
2627 }; |
|
2628 |
|
2629 /* harmony default export */ var if_condition = (if_condition_ifCondition); |
|
2630 |
|
2631 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js |
|
2632 var classCallCheck = __webpack_require__(20); |
|
2633 |
|
2634 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js |
|
2635 var createClass = __webpack_require__(19); |
|
2636 |
|
2637 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js |
|
2638 var possibleConstructorReturn = __webpack_require__(23); |
|
2639 |
|
2640 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js |
|
2641 var getPrototypeOf = __webpack_require__(16); |
|
2642 |
|
2643 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules |
|
2644 var inherits = __webpack_require__(22); |
|
2645 |
|
2646 // EXTERNAL MODULE: external {"this":["wp","isShallowEqual"]} |
|
2647 var external_this_wp_isShallowEqual_ = __webpack_require__(64); |
|
2648 var external_this_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_isShallowEqual_); |
|
2649 |
|
2650 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/pure/index.js |
|
2651 |
|
2652 |
|
2653 |
|
2654 |
|
2655 |
|
2656 |
|
2657 |
|
2658 function _createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
2659 |
|
2660 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
2661 |
|
2662 /** |
|
2663 * WordPress dependencies |
|
2664 */ |
|
2665 |
|
2666 |
|
2667 /** |
|
2668 * Internal dependencies |
|
2669 */ |
|
2670 |
|
2671 |
|
2672 /** |
|
2673 * Given a component returns the enhanced component augmented with a component |
|
2674 * only rerendering when its props/state change |
|
2675 * |
|
2676 * @param {Function} mapComponentToEnhancedComponent Function mapping component |
|
2677 * to enhanced component. |
|
2678 * @param {string} modifierName Seed name from which to |
|
2679 * generated display name. |
|
2680 * |
|
2681 * @return {WPComponent} Component class with generated display name assigned. |
|
2682 */ |
|
2683 |
|
2684 var pure = create_higher_order_component(function (Wrapped) { |
|
2685 if (Wrapped.prototype instanceof external_this_wp_element_["Component"]) { |
|
2686 return /*#__PURE__*/function (_Wrapped) { |
|
2687 Object(inherits["a" /* default */])(_class, _Wrapped); |
|
2688 |
|
2689 var _super = _createSuper(_class); |
|
2690 |
|
2691 function _class() { |
|
2692 Object(classCallCheck["a" /* default */])(this, _class); |
|
2693 |
|
2694 return _super.apply(this, arguments); |
|
2695 } |
|
2696 |
|
2697 Object(createClass["a" /* default */])(_class, [{ |
|
2698 key: "shouldComponentUpdate", |
|
2699 value: function shouldComponentUpdate(nextProps, nextState) { |
|
2700 return !external_this_wp_isShallowEqual_default()(nextProps, this.props) || !external_this_wp_isShallowEqual_default()(nextState, this.state); |
|
2701 } |
|
2702 }]); |
|
2703 |
|
2704 return _class; |
|
2705 }(Wrapped); |
|
2706 } |
|
2707 |
|
2708 return /*#__PURE__*/function (_Component) { |
|
2709 Object(inherits["a" /* default */])(_class2, _Component); |
|
2710 |
|
2711 var _super2 = _createSuper(_class2); |
|
2712 |
|
2713 function _class2() { |
|
2714 Object(classCallCheck["a" /* default */])(this, _class2); |
|
2715 |
|
2716 return _super2.apply(this, arguments); |
|
2717 } |
|
2718 |
|
2719 Object(createClass["a" /* default */])(_class2, [{ |
|
2720 key: "shouldComponentUpdate", |
|
2721 value: function shouldComponentUpdate(nextProps) { |
|
2722 return !external_this_wp_isShallowEqual_default()(nextProps, this.props); |
|
2723 } |
|
2724 }, { |
|
2725 key: "render", |
|
2726 value: function render() { |
|
2727 return Object(external_this_wp_element_["createElement"])(Wrapped, this.props); |
|
2728 } |
|
2729 }]); |
|
2730 |
|
2731 return _class2; |
|
2732 }(external_this_wp_element_["Component"]); |
|
2733 }, 'pure'); |
|
2734 /* harmony default export */ var higher_order_pure = (pure); |
|
2735 |
|
2736 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
|
2737 var esm_extends = __webpack_require__(8); |
|
2738 |
|
2739 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js |
|
2740 var assertThisInitialized = __webpack_require__(12); |
|
2741 |
|
2742 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-global-events/listener.js |
|
2743 |
|
2744 |
|
2745 |
|
2746 /** |
|
2747 * External dependencies |
|
2748 */ |
|
2749 |
|
2750 /** |
|
2751 * Class responsible for orchestrating event handling on the global window, |
|
2752 * binding a single event to be shared across all handling instances, and |
|
2753 * removing the handler when no instances are listening for the event. |
|
2754 */ |
|
2755 |
|
2756 var listener_Listener = /*#__PURE__*/function () { |
|
2757 function Listener() { |
|
2758 Object(classCallCheck["a" /* default */])(this, Listener); |
|
2759 |
|
2760 this.listeners = {}; |
|
2761 this.handleEvent = this.handleEvent.bind(this); |
|
2762 } |
|
2763 |
|
2764 Object(createClass["a" /* default */])(Listener, [{ |
|
2765 key: "add", |
|
2766 value: function add(eventType, instance) { |
|
2767 if (!this.listeners[eventType]) { |
|
2768 // Adding first listener for this type, so bind event. |
|
2769 window.addEventListener(eventType, this.handleEvent); |
|
2770 this.listeners[eventType] = []; |
|
2771 } |
|
2772 |
|
2773 this.listeners[eventType].push(instance); |
|
2774 } |
|
2775 }, { |
|
2776 key: "remove", |
|
2777 value: function remove(eventType, instance) { |
|
2778 this.listeners[eventType] = Object(external_this_lodash_["without"])(this.listeners[eventType], instance); |
|
2779 |
|
2780 if (!this.listeners[eventType].length) { |
|
2781 // Removing last listener for this type, so unbind event. |
|
2782 window.removeEventListener(eventType, this.handleEvent); |
|
2783 delete this.listeners[eventType]; |
|
2784 } |
|
2785 } |
|
2786 }, { |
|
2787 key: "handleEvent", |
|
2788 value: function handleEvent(event) { |
|
2789 Object(external_this_lodash_["forEach"])(this.listeners[event.type], function (instance) { |
|
2790 instance.handleEvent(event); |
|
2791 }); |
|
2792 } |
|
2793 }]); |
|
2794 |
|
2795 return Listener; |
|
2796 }(); |
|
2797 |
|
2798 /* harmony default export */ var listener = (listener_Listener); |
|
2799 |
|
2800 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-global-events/index.js |
|
2801 |
|
2802 |
|
2803 |
|
2804 |
|
2805 |
|
2806 |
|
2807 |
|
2808 |
|
2809 |
|
2810 function with_global_events_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (with_global_events_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
2811 |
|
2812 function with_global_events_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
2813 |
|
2814 /** |
|
2815 * External dependencies |
|
2816 */ |
|
2817 |
|
2818 /** |
|
2819 * WordPress dependencies |
|
2820 */ |
|
2821 |
|
2822 |
|
2823 /** |
|
2824 * Internal dependencies |
|
2825 */ |
|
2826 |
|
2827 |
|
2828 |
|
2829 /** |
|
2830 * Listener instance responsible for managing document event handling. |
|
2831 * |
|
2832 * @type {Listener} |
|
2833 */ |
|
2834 |
|
2835 var with_global_events_listener = new listener(); |
|
2836 /** |
|
2837 * Higher-order component creator which, given an object of DOM event types and |
|
2838 * values corresponding to a callback function name on the component, will |
|
2839 * create or update a window event handler to invoke the callback when an event |
|
2840 * occurs. On behalf of the consuming developer, the higher-order component |
|
2841 * manages unbinding when the component unmounts, and binding at most a single |
|
2842 * event handler for the entire application. |
|
2843 * |
|
2844 * @param {Object<string,string>} eventTypesToHandlers Object with keys of DOM |
|
2845 * event type, the value a |
|
2846 * name of the function on |
|
2847 * the original component's |
|
2848 * instance which handles |
|
2849 * the event. |
|
2850 * |
|
2851 * @return {Function} Higher-order component. |
|
2852 */ |
|
2853 |
|
2854 function withGlobalEvents(eventTypesToHandlers) { |
|
2855 return create_higher_order_component(function (WrappedComponent) { |
|
2856 var Wrapper = /*#__PURE__*/function (_Component) { |
|
2857 Object(inherits["a" /* default */])(Wrapper, _Component); |
|
2858 |
|
2859 var _super = with_global_events_createSuper(Wrapper); |
|
2860 |
|
2861 function Wrapper() { |
|
2862 var _this; |
|
2863 |
|
2864 Object(classCallCheck["a" /* default */])(this, Wrapper); |
|
2865 |
|
2866 _this = _super.apply(this, arguments); |
|
2867 _this.handleEvent = _this.handleEvent.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
|
2868 _this.handleRef = _this.handleRef.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
|
2869 return _this; |
|
2870 } |
|
2871 |
|
2872 Object(createClass["a" /* default */])(Wrapper, [{ |
|
2873 key: "componentDidMount", |
|
2874 value: function componentDidMount() { |
|
2875 var _this2 = this; |
|
2876 |
|
2877 Object(external_this_lodash_["forEach"])(eventTypesToHandlers, function (handler, eventType) { |
|
2878 with_global_events_listener.add(eventType, _this2); |
|
2879 }); |
|
2880 } |
|
2881 }, { |
|
2882 key: "componentWillUnmount", |
|
2883 value: function componentWillUnmount() { |
|
2884 var _this3 = this; |
|
2885 |
|
2886 Object(external_this_lodash_["forEach"])(eventTypesToHandlers, function (handler, eventType) { |
|
2887 with_global_events_listener.remove(eventType, _this3); |
|
2888 }); |
|
2889 } |
|
2890 }, { |
|
2891 key: "handleEvent", |
|
2892 value: function handleEvent(event) { |
|
2893 var handler = eventTypesToHandlers[event.type]; |
|
2894 |
|
2895 if (typeof this.wrappedRef[handler] === 'function') { |
|
2896 this.wrappedRef[handler](event); |
|
2897 } |
|
2898 } |
|
2899 }, { |
|
2900 key: "handleRef", |
|
2901 value: function handleRef(el) { |
|
2902 this.wrappedRef = el; // Any component using `withGlobalEvents` that is not setting a `ref` |
|
2903 // will cause `this.props.forwardedRef` to be `null`, so we need this |
|
2904 // check. |
|
2905 |
|
2906 if (this.props.forwardedRef) { |
|
2907 this.props.forwardedRef(el); |
|
2908 } |
|
2909 } |
|
2910 }, { |
|
2911 key: "render", |
|
2912 value: function render() { |
|
2913 return Object(external_this_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, this.props.ownProps, { |
|
2914 ref: this.handleRef |
|
2915 })); |
|
2916 } |
|
2917 }]); |
|
2918 |
|
2919 return Wrapper; |
|
2920 }(external_this_wp_element_["Component"]); |
|
2921 |
|
2922 return Object(external_this_wp_element_["forwardRef"])(function (props, ref) { |
|
2923 return Object(external_this_wp_element_["createElement"])(Wrapper, { |
|
2924 ownProps: props, |
|
2925 forwardedRef: ref |
|
2926 }); |
|
2927 }); |
|
2928 }, 'withGlobalEvents'); |
|
2929 } |
|
2930 |
|
2931 /* harmony default export */ var with_global_events = (withGlobalEvents); |
|
2932 |
|
2933 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js |
|
2934 /** |
|
2935 * WordPress dependencies |
|
2936 */ |
|
2937 |
|
2938 var instanceMap = new WeakMap(); |
|
2939 /** |
|
2940 * Creates a new id for a given object. |
|
2941 * |
|
2942 * @param {Object} object Object reference to create an id for. |
|
2943 */ |
|
2944 |
|
2945 function createId(object) { |
|
2946 var instances = instanceMap.get(object) || 0; |
|
2947 instanceMap.set(object, instances + 1); |
|
2948 return instances; |
|
2949 } |
|
2950 /** |
|
2951 * Provides a unique instance ID. |
|
2952 * |
|
2953 * @param {Object} object Object reference to create an id for. |
|
2954 * @param {string} prefix Prefix for the unique id. |
|
2955 */ |
|
2956 |
|
2957 |
|
2958 function useInstanceId(object, prefix) { |
|
2959 return Object(external_this_wp_element_["useMemo"])(function () { |
|
2960 var id = createId(object); |
|
2961 return prefix ? "".concat(prefix, "-").concat(id) : id; |
|
2962 }, [object]); |
|
2963 } |
|
2964 |
|
2965 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-instance-id/index.js |
|
2966 |
|
2967 |
|
2968 |
|
2969 /** |
|
2970 * Internal dependencies |
|
2971 */ |
|
2972 |
|
2973 |
|
2974 /** |
|
2975 * A Higher Order Component used to be provide a unique instance ID by |
|
2976 * component. |
|
2977 * |
|
2978 * @param {WPComponent} WrappedComponent The wrapped component. |
|
2979 * |
|
2980 * @return {WPComponent} Component with an instanceId prop. |
|
2981 */ |
|
2982 |
|
2983 /* harmony default export */ var with_instance_id = (create_higher_order_component(function (WrappedComponent) { |
|
2984 return function (props) { |
|
2985 var instanceId = useInstanceId(WrappedComponent); |
|
2986 return Object(external_this_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, { |
|
2987 instanceId: instanceId |
|
2988 })); |
|
2989 }; |
|
2990 }, 'withInstanceId')); |
|
2991 |
|
2992 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-safe-timeout/index.js |
|
2993 |
|
2994 |
|
2995 |
|
2996 |
|
2997 |
|
2998 |
|
2999 |
|
3000 |
|
3001 |
|
3002 function with_safe_timeout_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (with_safe_timeout_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
3003 |
|
3004 function with_safe_timeout_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
3005 |
|
3006 /** |
|
3007 * External dependencies |
|
3008 */ |
|
3009 |
|
3010 /** |
|
3011 * WordPress dependencies |
|
3012 */ |
|
3013 |
|
3014 |
|
3015 /** |
|
3016 * Internal dependencies |
|
3017 */ |
|
3018 |
|
3019 |
|
3020 /** |
|
3021 * A higher-order component used to provide and manage delayed function calls |
|
3022 * that ought to be bound to a component's lifecycle. |
|
3023 * |
|
3024 * @param {WPComponent} OriginalComponent Component requiring setTimeout |
|
3025 * |
|
3026 * @return {WPComponent} Wrapped component. |
|
3027 */ |
|
3028 |
|
3029 var withSafeTimeout = create_higher_order_component(function (OriginalComponent) { |
|
3030 return /*#__PURE__*/function (_Component) { |
|
3031 Object(inherits["a" /* default */])(WrappedComponent, _Component); |
|
3032 |
|
3033 var _super = with_safe_timeout_createSuper(WrappedComponent); |
|
3034 |
|
3035 function WrappedComponent() { |
|
3036 var _this; |
|
3037 |
|
3038 Object(classCallCheck["a" /* default */])(this, WrappedComponent); |
|
3039 |
|
3040 _this = _super.apply(this, arguments); |
|
3041 _this.timeouts = []; |
|
3042 _this.setTimeout = _this.setTimeout.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
|
3043 _this.clearTimeout = _this.clearTimeout.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
|
3044 return _this; |
|
3045 } |
|
3046 |
|
3047 Object(createClass["a" /* default */])(WrappedComponent, [{ |
|
3048 key: "componentWillUnmount", |
|
3049 value: function componentWillUnmount() { |
|
3050 this.timeouts.forEach(clearTimeout); |
|
3051 } |
|
3052 }, { |
|
3053 key: "setTimeout", |
|
3054 value: function (_setTimeout) { |
|
3055 function setTimeout(_x, _x2) { |
|
3056 return _setTimeout.apply(this, arguments); |
|
3057 } |
|
3058 |
|
3059 setTimeout.toString = function () { |
|
3060 return _setTimeout.toString(); |
|
3061 }; |
|
3062 |
|
3063 return setTimeout; |
|
3064 }(function (fn, delay) { |
|
3065 var _this2 = this; |
|
3066 |
|
3067 var id = setTimeout(function () { |
|
3068 fn(); |
|
3069 |
|
3070 _this2.clearTimeout(id); |
|
3071 }, delay); |
|
3072 this.timeouts.push(id); |
|
3073 return id; |
|
3074 }) |
|
3075 }, { |
|
3076 key: "clearTimeout", |
|
3077 value: function (_clearTimeout) { |
|
3078 function clearTimeout(_x3) { |
|
3079 return _clearTimeout.apply(this, arguments); |
|
3080 } |
|
3081 |
|
3082 clearTimeout.toString = function () { |
|
3083 return _clearTimeout.toString(); |
|
3084 }; |
|
3085 |
|
3086 return clearTimeout; |
|
3087 }(function (id) { |
|
3088 clearTimeout(id); |
|
3089 this.timeouts = Object(external_this_lodash_["without"])(this.timeouts, id); |
|
3090 }) |
|
3091 }, { |
|
3092 key: "render", |
|
3093 value: function render() { |
|
3094 return Object(external_this_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, this.props, { |
|
3095 setTimeout: this.setTimeout, |
|
3096 clearTimeout: this.clearTimeout |
|
3097 })); |
|
3098 } |
|
3099 }]); |
|
3100 |
|
3101 return WrappedComponent; |
|
3102 }(external_this_wp_element_["Component"]); |
|
3103 }, 'withSafeTimeout'); |
|
3104 /* harmony default export */ var with_safe_timeout = (withSafeTimeout); |
|
3105 |
|
3106 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-state/index.js |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 |
|
3116 function with_state_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (with_state_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } |
|
3117 |
|
3118 function with_state_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } |
|
3119 |
|
3120 /** |
|
3121 * WordPress dependencies |
|
3122 */ |
|
3123 |
|
3124 /** |
|
3125 * Internal dependencies |
|
3126 */ |
|
3127 |
|
3128 |
|
3129 /** |
|
3130 * A Higher Order Component used to provide and manage internal component state |
|
3131 * via props. |
|
3132 * |
|
3133 * @param {?Object} initialState Optional initial state of the component. |
|
3134 * |
|
3135 * @return {WPComponent} Wrapped component. |
|
3136 */ |
|
3137 |
|
3138 function withState() { |
|
3139 var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
3140 return create_higher_order_component(function (OriginalComponent) { |
|
3141 return /*#__PURE__*/function (_Component) { |
|
3142 Object(inherits["a" /* default */])(WrappedComponent, _Component); |
|
3143 |
|
3144 var _super = with_state_createSuper(WrappedComponent); |
|
3145 |
|
3146 function WrappedComponent() { |
|
3147 var _this; |
|
3148 |
|
3149 Object(classCallCheck["a" /* default */])(this, WrappedComponent); |
|
3150 |
|
3151 _this = _super.apply(this, arguments); |
|
3152 _this.setState = _this.setState.bind(Object(assertThisInitialized["a" /* default */])(_this)); |
|
3153 _this.state = initialState; |
|
3154 return _this; |
|
3155 } |
|
3156 |
|
3157 Object(createClass["a" /* default */])(WrappedComponent, [{ |
|
3158 key: "render", |
|
3159 value: function render() { |
|
3160 return Object(external_this_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, this.props, this.state, { |
|
3161 setState: this.setState |
|
3162 })); |
|
3163 } |
|
3164 }]); |
|
3165 |
|
3166 return WrappedComponent; |
|
3167 }(external_this_wp_element_["Component"]); |
|
3168 }, 'withState'); |
|
3169 } |
|
3170 |
|
3171 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules |
|
3172 var slicedToArray = __webpack_require__(14); |
|
3173 |
|
3174 // EXTERNAL MODULE: ./node_modules/clipboard/dist/clipboard.js |
|
3175 var dist_clipboard = __webpack_require__(272); |
|
3176 var clipboard_default = /*#__PURE__*/__webpack_require__.n(dist_clipboard); |
|
3177 |
|
3178 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-copy-on-click/index.js |
|
3179 |
|
3180 |
|
3181 /** |
|
3182 * External dependencies |
|
3183 */ |
|
3184 |
|
3185 /** |
|
3186 * WordPress dependencies |
|
3187 */ |
|
3188 |
|
3189 |
|
3190 /** |
|
3191 * Copies the text to the clipboard when the element is clicked. |
|
3192 * |
|
3193 * @param {Object} ref Reference with the element. |
|
3194 * @param {string|Function} text The text to copy. |
|
3195 * @param {number} timeout Optional timeout to reset the returned |
|
3196 * state. 4 seconds by default. |
|
3197 * |
|
3198 * @return {boolean} Whether or not the text has been copied. Resets after the |
|
3199 * timeout. |
|
3200 */ |
|
3201 |
|
3202 function useCopyOnClick(ref, _text) { |
|
3203 var timeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 4000; |
|
3204 var clipboard = Object(external_this_wp_element_["useRef"])(); |
|
3205 |
|
3206 var _useState = Object(external_this_wp_element_["useState"])(false), |
|
3207 _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), |
|
3208 hasCopied = _useState2[0], |
|
3209 setHasCopied = _useState2[1]; |
|
3210 |
|
3211 Object(external_this_wp_element_["useEffect"])(function () { |
|
3212 var timeoutId; // Clipboard listens to click events. |
|
3213 |
|
3214 clipboard.current = new clipboard_default.a(ref.current, { |
|
3215 text: function text() { |
|
3216 return typeof _text === 'function' ? _text() : _text; |
|
3217 } |
|
3218 }); |
|
3219 clipboard.current.on('success', function (_ref) { |
|
3220 var clearSelection = _ref.clearSelection, |
|
3221 trigger = _ref.trigger; |
|
3222 // Clearing selection will move focus back to the triggering button, |
|
3223 // ensuring that it is not reset to the body, and further that it is |
|
3224 // kept within the rendered node. |
|
3225 clearSelection(); // Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680 |
|
3226 |
|
3227 if (trigger) { |
|
3228 trigger.focus(); |
|
3229 } |
|
3230 |
|
3231 if (timeout) { |
|
3232 setHasCopied(true); |
|
3233 clearTimeout(timeoutId); |
|
3234 timeoutId = setTimeout(function () { |
|
3235 return setHasCopied(false); |
|
3236 }, timeout); |
|
3237 } |
|
3238 }); |
|
3239 return function () { |
|
3240 clipboard.current.destroy(); |
|
3241 clearTimeout(timeoutId); |
|
3242 }; |
|
3243 }, [_text, timeout, setHasCopied]); |
|
3244 return hasCopied; |
|
3245 } |
|
3246 |
|
3247 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-dragging/index.js |
|
3248 |
|
3249 |
|
3250 /** |
|
3251 * WordPress dependencies |
|
3252 */ |
|
3253 |
|
3254 var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? external_this_wp_element_["useLayoutEffect"] : external_this_wp_element_["useEffect"]; |
|
3255 function useDragging(_ref) { |
|
3256 var onDragStart = _ref.onDragStart, |
|
3257 onDragMove = _ref.onDragMove, |
|
3258 onDragEnd = _ref.onDragEnd; |
|
3259 |
|
3260 var _useState = Object(external_this_wp_element_["useState"])(false), |
|
3261 _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), |
|
3262 isDragging = _useState2[0], |
|
3263 setIsDragging = _useState2[1]; |
|
3264 |
|
3265 var eventsRef = Object(external_this_wp_element_["useRef"])({ |
|
3266 onDragStart: onDragStart, |
|
3267 onDragMove: onDragMove, |
|
3268 onDragEnd: onDragEnd |
|
3269 }); |
|
3270 useIsomorphicLayoutEffect(function () { |
|
3271 eventsRef.current.onDragStart = onDragStart; |
|
3272 eventsRef.current.onDragMove = onDragMove; |
|
3273 eventsRef.current.onDragEnd = onDragEnd; |
|
3274 }, [onDragStart, onDragMove, onDragEnd]); |
|
3275 var onMouseMove = Object(external_this_wp_element_["useCallback"])(function () { |
|
3276 var _eventsRef$current; |
|
3277 |
|
3278 return eventsRef.current.onDragMove && (_eventsRef$current = eventsRef.current).onDragMove.apply(_eventsRef$current, arguments); |
|
3279 }, []); |
|
3280 var endDrag = Object(external_this_wp_element_["useCallback"])(function () { |
|
3281 if (eventsRef.current.onDragEnd) { |
|
3282 var _eventsRef$current2; |
|
3283 |
|
3284 (_eventsRef$current2 = eventsRef.current).onDragEnd.apply(_eventsRef$current2, arguments); |
|
3285 } |
|
3286 |
|
3287 document.removeEventListener('mousemove', onMouseMove); |
|
3288 document.removeEventListener('mouseup', endDrag); |
|
3289 setIsDragging(false); |
|
3290 }, []); |
|
3291 var startDrag = Object(external_this_wp_element_["useCallback"])(function () { |
|
3292 if (eventsRef.current.onDragStart) { |
|
3293 var _eventsRef$current3; |
|
3294 |
|
3295 (_eventsRef$current3 = eventsRef.current).onDragStart.apply(_eventsRef$current3, arguments); |
|
3296 } |
|
3297 |
|
3298 document.addEventListener('mousemove', onMouseMove); |
|
3299 document.addEventListener('mouseup', endDrag); |
|
3300 setIsDragging(true); |
|
3301 }, []); // Remove the global events when unmounting if needed. |
|
3302 |
|
3303 Object(external_this_wp_element_["useEffect"])(function () { |
|
3304 return function () { |
|
3305 if (isDragging) { |
|
3306 document.removeEventListener('mousemove', onMouseMove); |
|
3307 document.removeEventListener('mouseup', endDrag); |
|
3308 } |
|
3309 }; |
|
3310 }, [isDragging]); |
|
3311 return { |
|
3312 startDrag: startDrag, |
|
3313 endDrag: endDrag, |
|
3314 isDragging: isDragging |
|
3315 }; |
|
3316 } |
|
3317 |
|
3318 // EXTERNAL MODULE: ./node_modules/mousetrap/mousetrap.js |
|
3319 var mousetrap_mousetrap = __webpack_require__(273); |
|
3320 var mousetrap_default = /*#__PURE__*/__webpack_require__.n(mousetrap_mousetrap); |
|
3321 |
|
3322 // EXTERNAL MODULE: ./node_modules/mousetrap/plugins/global-bind/mousetrap-global-bind.js |
|
3323 var mousetrap_global_bind = __webpack_require__(411); |
|
3324 |
|
3325 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-keyboard-shortcut/index.js |
|
3326 /** |
|
3327 * External dependencies |
|
3328 */ |
|
3329 |
|
3330 |
|
3331 |
|
3332 /** |
|
3333 * WordPress dependencies |
|
3334 */ |
|
3335 |
|
3336 |
|
3337 /** |
|
3338 * A block selection object. |
|
3339 * |
|
3340 * @typedef {Object} WPKeyboardShortcutConfig |
|
3341 * |
|
3342 * @property {boolean} [bindGlobal] Handle keyboard events anywhere including inside textarea/input fields. |
|
3343 * @property {string} [eventName] Event name used to trigger the handler, defaults to keydown. |
|
3344 * @property {boolean} [isDisabled] Disables the keyboard handler if the value is true. |
|
3345 * @property {Object} [target] React reference to the DOM element used to catch the keyboard event. |
|
3346 */ |
|
3347 |
|
3348 /** |
|
3349 * Return true if platform is MacOS. |
|
3350 * |
|
3351 * @param {Object} _window window object by default; used for DI testing. |
|
3352 * |
|
3353 * @return {boolean} True if MacOS; false otherwise. |
|
3354 */ |
|
3355 |
|
3356 function isAppleOS() { |
|
3357 var _window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; |
|
3358 |
|
3359 var platform = _window.navigator.platform; |
|
3360 return platform.indexOf('Mac') !== -1 || Object(external_this_lodash_["includes"])(['iPad', 'iPhone'], platform); |
|
3361 } |
|
3362 /** |
|
3363 * Attach a keyboard shortcut handler. |
|
3364 * |
|
3365 * @param {string[]|string} shortcuts Keyboard Shortcuts. |
|
3366 * @param {Function} callback Shortcut callback. |
|
3367 * @param {WPKeyboardShortcutConfig} options Shortcut options. |
|
3368 */ |
|
3369 |
|
3370 |
|
3371 function useKeyboardShortcut(shortcuts, callback) { |
|
3372 var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, |
|
3373 _ref$bindGlobal = _ref.bindGlobal, |
|
3374 bindGlobal = _ref$bindGlobal === void 0 ? false : _ref$bindGlobal, |
|
3375 _ref$eventName = _ref.eventName, |
|
3376 eventName = _ref$eventName === void 0 ? 'keydown' : _ref$eventName, |
|
3377 _ref$isDisabled = _ref.isDisabled, |
|
3378 isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled, |
|
3379 target = _ref.target; |
|
3380 |
|
3381 var currentCallback = Object(external_this_wp_element_["useRef"])(callback); |
|
3382 Object(external_this_wp_element_["useEffect"])(function () { |
|
3383 currentCallback.current = callback; |
|
3384 }, [callback]); |
|
3385 Object(external_this_wp_element_["useEffect"])(function () { |
|
3386 if (isDisabled) { |
|
3387 return; |
|
3388 } |
|
3389 |
|
3390 var mousetrap = new mousetrap_default.a(target ? target.current : document); |
|
3391 Object(external_this_lodash_["castArray"])(shortcuts).forEach(function (shortcut) { |
|
3392 var keys = shortcut.split('+'); // Determines whether a key is a modifier by the length of the string. |
|
3393 // E.g. if I add a pass a shortcut Shift+Cmd+M, it'll determine that |
|
3394 // the modifiers are Shift and Cmd because they're not a single character. |
|
3395 |
|
3396 var modifiers = new Set(keys.filter(function (value) { |
|
3397 return value.length > 1; |
|
3398 })); |
|
3399 var hasAlt = modifiers.has('alt'); |
|
3400 var hasShift = modifiers.has('shift'); // This should be better moved to the shortcut registration instead. |
|
3401 |
|
3402 if (isAppleOS() && (modifiers.size === 1 && hasAlt || modifiers.size === 2 && hasAlt && hasShift)) { |
|
3403 throw new Error("Cannot bind ".concat(shortcut, ". Alt and Shift+Alt modifiers are reserved for character input.")); |
|
3404 } |
|
3405 |
|
3406 var bindFn = bindGlobal ? 'bindGlobal' : 'bind'; |
|
3407 mousetrap[bindFn](shortcut, function () { |
|
3408 return currentCallback.current.apply(currentCallback, arguments); |
|
3409 }, eventName); |
|
3410 }); |
|
3411 return function () { |
|
3412 mousetrap.reset(); |
|
3413 }; |
|
3414 }, [shortcuts, bindGlobal, eventName, target, isDisabled]); |
|
3415 } |
|
3416 |
|
3417 /* harmony default export */ var use_keyboard_shortcut = (useKeyboardShortcut); |
|
3418 |
|
3419 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-media-query/index.js |
|
3420 |
|
3421 |
|
3422 /** |
|
3423 * WordPress dependencies |
|
3424 */ |
|
3425 |
|
3426 /** |
|
3427 * Runs a media query and returns its value when it changes. |
|
3428 * |
|
3429 * @param {string} [query] Media Query. |
|
3430 * @return {boolean} return value of the media query. |
|
3431 */ |
|
3432 |
|
3433 function useMediaQuery(query) { |
|
3434 var _useState = Object(external_this_wp_element_["useState"])(query && window.matchMedia(query).matches), |
|
3435 _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), |
|
3436 match = _useState2[0], |
|
3437 setMatch = _useState2[1]; |
|
3438 |
|
3439 Object(external_this_wp_element_["useEffect"])(function () { |
|
3440 if (!query) { |
|
3441 return; |
|
3442 } |
|
3443 |
|
3444 var updateMatch = function updateMatch() { |
|
3445 return setMatch(window.matchMedia(query).matches); |
|
3446 }; |
|
3447 |
|
3448 updateMatch(); |
|
3449 var list = window.matchMedia(query); |
|
3450 list.addListener(updateMatch); |
|
3451 return function () { |
|
3452 list.removeListener(updateMatch); |
|
3453 }; |
|
3454 }, [query]); |
|
3455 return query && match; |
|
3456 } |
|
3457 |
|
3458 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-previous/index.js |
|
3459 /** |
|
3460 * WordPress dependencies |
|
3461 */ |
|
3462 |
|
3463 /** |
|
3464 * Use something's value from the previous render. |
|
3465 * Based on https://usehooks.com/usePrevious/. |
|
3466 * |
|
3467 * @template T |
|
3468 * |
|
3469 * @param {T} value The value to track. |
|
3470 * |
|
3471 * @return {T|undefined} The value from the previous render. |
|
3472 */ |
|
3473 |
|
3474 function usePrevious(value) { |
|
3475 // Disable reason: without an explicit type detail, the type of ref will be |
|
3476 // inferred based on the initial useRef argument, which is undefined. |
|
3477 // https://github.com/WordPress/gutenberg/pull/22597#issuecomment-633588366 |
|
3478 |
|
3479 /* eslint-disable jsdoc/no-undefined-types */ |
|
3480 var ref = Object(external_this_wp_element_["useRef"])( |
|
3481 /** @type {T|undefined} */ |
|
3482 undefined); |
|
3483 /* eslint-enable jsdoc/no-undefined-types */ |
|
3484 // Store current value in ref. |
|
3485 |
|
3486 Object(external_this_wp_element_["useEffect"])(function () { |
|
3487 ref.current = value; |
|
3488 }, [value]); // Re-run when value changes. |
|
3489 // Return previous value (happens before update in useEffect above). |
|
3490 |
|
3491 return ref.current; |
|
3492 } |
|
3493 |
|
3494 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-reduced-motion/index.js |
|
3495 /** |
|
3496 * Internal dependencies |
|
3497 */ |
|
3498 |
|
3499 /** |
|
3500 * Whether or not the user agent is Internet Explorer. |
|
3501 * |
|
3502 * @type {boolean} |
|
3503 */ |
|
3504 |
|
3505 var IS_IE = typeof window !== 'undefined' && window.navigator.userAgent.indexOf('Trident') >= 0; |
|
3506 /** |
|
3507 * Hook returning whether the user has a preference for reduced motion. |
|
3508 * |
|
3509 * @return {boolean} Reduced motion preference value. |
|
3510 */ |
|
3511 |
|
3512 var useReducedMotion = undefined || IS_IE ? function () { |
|
3513 return true; |
|
3514 } : function () { |
|
3515 return useMediaQuery('(prefers-reduced-motion: reduce)'); |
|
3516 }; |
|
3517 /* harmony default export */ var use_reduced_motion = (useReducedMotion); |
|
3518 |
|
3519 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-viewport-match/index.js |
|
3520 /** |
|
3521 * WordPress dependencies |
|
3522 */ |
|
3523 |
|
3524 /** |
|
3525 * Internal dependencies |
|
3526 */ |
|
3527 |
|
3528 |
|
3529 /** |
|
3530 * @typedef {"huge"|"wide"|"large"|"medium"|"small"|"mobile"} WPBreakpoint |
|
3531 */ |
|
3532 |
|
3533 /** |
|
3534 * Hash of breakpoint names with pixel width at which it becomes effective. |
|
3535 * |
|
3536 * @see _breakpoints.scss |
|
3537 * |
|
3538 * @type {Object<WPBreakpoint,number>} |
|
3539 */ |
|
3540 |
|
3541 var BREAKPOINTS = { |
|
3542 huge: 1440, |
|
3543 wide: 1280, |
|
3544 large: 960, |
|
3545 medium: 782, |
|
3546 small: 600, |
|
3547 mobile: 480 |
|
3548 }; |
|
3549 /** |
|
3550 * @typedef {">="|"<"} WPViewportOperator |
|
3551 */ |
|
3552 |
|
3553 /** |
|
3554 * Object mapping media query operators to the condition to be used. |
|
3555 * |
|
3556 * @type {Object<WPViewportOperator,string>} |
|
3557 */ |
|
3558 |
|
3559 var CONDITIONS = { |
|
3560 '>=': 'min-width', |
|
3561 '<': 'max-width' |
|
3562 }; |
|
3563 /** |
|
3564 * Object mapping media query operators to a function that given a breakpointValue and a width evaluates if the operator matches the values. |
|
3565 * |
|
3566 * @type {Object<WPViewportOperator,Function>} |
|
3567 */ |
|
3568 |
|
3569 var OPERATOR_EVALUATORS = { |
|
3570 '>=': function _(breakpointValue, width) { |
|
3571 return width >= breakpointValue; |
|
3572 }, |
4180 }, |
3573 '<': function _(breakpointValue, width) { |
4181 |
3574 return width < breakpointValue; |
4182 emit: function (name) { |
|
4183 var data = [].slice.call(arguments, 1); |
|
4184 var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); |
|
4185 var i = 0; |
|
4186 var len = evtArr.length; |
|
4187 |
|
4188 for (i; i < len; i++) { |
|
4189 evtArr[i].fn.apply(evtArr[i].ctx, data); |
|
4190 } |
|
4191 |
|
4192 return this; |
|
4193 }, |
|
4194 |
|
4195 off: function (name, callback) { |
|
4196 var e = this.e || (this.e = {}); |
|
4197 var evts = e[name]; |
|
4198 var liveEvents = []; |
|
4199 |
|
4200 if (evts && callback) { |
|
4201 for (var i = 0, len = evts.length; i < len; i++) { |
|
4202 if (evts[i].fn !== callback && evts[i].fn._ !== callback) |
|
4203 liveEvents.push(evts[i]); |
|
4204 } |
|
4205 } |
|
4206 |
|
4207 // Remove event from queue to prevent memory leak |
|
4208 // Suggested by https://github.com/lazd |
|
4209 // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910 |
|
4210 |
|
4211 (liveEvents.length) |
|
4212 ? e[name] = liveEvents |
|
4213 : delete e[name]; |
|
4214 |
|
4215 return this; |
3575 } |
4216 } |
3576 }; |
4217 }; |
3577 var ViewportMatchWidthContext = Object(external_this_wp_element_["createContext"])(null); |
4218 |
3578 /** |
4219 module.exports = E; |
3579 * Returns true if the viewport matches the given query, or false otherwise. |
4220 module.exports.TinyEmitter = E; |
3580 * |
4221 |
3581 * @param {WPBreakpoint} breakpoint Breakpoint size name. |
4222 |
3582 * @param {WPViewportOperator} [operator=">="] Viewport operator. |
4223 /***/ }) |
3583 * |
4224 |
3584 * @example |
4225 /******/ }); |
3585 * |
4226 /************************************************************************/ |
3586 * ```js |
4227 /******/ // The module cache |
3587 * useViewportMatch( 'huge', '<' ); |
4228 /******/ var __webpack_module_cache__ = {}; |
3588 * useViewportMatch( 'medium' ); |
4229 /******/ |
3589 * ``` |
4230 /******/ // The require function |
3590 * |
4231 /******/ function __webpack_require__(moduleId) { |
3591 * @return {boolean} Whether viewport matches query. |
4232 /******/ // Check if module is in cache |
3592 */ |
4233 /******/ if(__webpack_module_cache__[moduleId]) { |
3593 |
4234 /******/ return __webpack_module_cache__[moduleId].exports; |
3594 var use_viewport_match_useViewportMatch = function useViewportMatch(breakpoint) { |
4235 /******/ } |
3595 var operator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '>='; |
4236 /******/ // Create a new module (and put it into the cache) |
3596 var simulatedWidth = Object(external_this_wp_element_["useContext"])(ViewportMatchWidthContext); |
4237 /******/ var module = __webpack_module_cache__[moduleId] = { |
3597 var mediaQuery = !simulatedWidth && "(".concat(CONDITIONS[operator], ": ").concat(BREAKPOINTS[breakpoint], "px)"); |
4238 /******/ // no module.id needed |
3598 var mediaQueryResult = useMediaQuery(mediaQuery); |
4239 /******/ // no module.loaded needed |
3599 |
4240 /******/ exports: {} |
3600 if (simulatedWidth) { |
4241 /******/ }; |
3601 return OPERATOR_EVALUATORS[operator](BREAKPOINTS[breakpoint], simulatedWidth); |
4242 /******/ |
3602 } |
4243 /******/ // Execute the module function |
3603 |
4244 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
3604 return mediaQueryResult; |
4245 /******/ |
3605 }; |
4246 /******/ // Return the exports of the module |
3606 |
4247 /******/ return module.exports; |
3607 use_viewport_match_useViewportMatch.__experimentalWidthProvider = ViewportMatchWidthContext.Provider; |
4248 /******/ } |
3608 /* harmony default export */ var use_viewport_match = (use_viewport_match_useViewportMatch); |
4249 /******/ |
3609 |
4250 /************************************************************************/ |
3610 // EXTERNAL MODULE: ./node_modules/react-resize-aware/dist/index.js |
4251 /******/ /* webpack/runtime/compat get default export */ |
3611 var dist = __webpack_require__(149); |
4252 /******/ !function() { |
3612 var dist_default = /*#__PURE__*/__webpack_require__.n(dist); |
4253 /******/ // getDefaultExport function for compatibility with non-harmony modules |
3613 |
4254 /******/ __webpack_require__.n = function(module) { |
3614 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-resize-observer/index.js |
4255 /******/ var getter = module && module.__esModule ? |
3615 /** |
4256 /******/ function() { return module['default']; } : |
3616 * External dependencies |
4257 /******/ function() { return module; }; |
3617 */ |
4258 /******/ __webpack_require__.d(getter, { a: getter }); |
3618 |
4259 /******/ return getter; |
3619 /** |
4260 /******/ }; |
3620 * Hook which allows to listen the resize event of any target element when it changes sizes. |
4261 /******/ }(); |
3621 * _Note: `useResizeObserver` will report `null` until after first render_ |
4262 /******/ |
3622 * |
4263 /******/ /* webpack/runtime/define property getters */ |
3623 * @return {Array} An array of {Element} `resizeListener` and {?Object} `sizes` with properties `width` and `height` |
4264 /******/ !function() { |
3624 * |
4265 /******/ // define getter functions for harmony exports |
3625 * @example |
4266 /******/ __webpack_require__.d = function(exports, definition) { |
3626 * |
4267 /******/ for(var key in definition) { |
3627 * ```js |
4268 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
3628 * const App = () => { |
4269 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
3629 * const [ resizeListener, sizes ] = useResizeObserver(); |
4270 /******/ } |
3630 * |
4271 /******/ } |
3631 * return ( |
4272 /******/ }; |
3632 * <div> |
4273 /******/ }(); |
3633 * { resizeListener } |
4274 /******/ |
3634 * Your content here |
4275 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
3635 * </div> |
4276 /******/ !function() { |
3636 * ); |
4277 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
3637 * }; |
4278 /******/ }(); |
3638 * ``` |
4279 /******/ |
3639 * |
4280 /************************************************************************/ |
3640 */ |
4281 /******/ // module exports must be returned from runtime so entry inlining is disabled |
3641 |
4282 /******/ // startup |
3642 /* harmony default export */ var use_resize_observer = (dist_default.a); |
4283 /******/ // Load entry module and return exports |
3643 |
4284 /******/ return __webpack_require__(134); |
3644 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules |
4285 /******/ })() |
3645 var toConsumableArray = __webpack_require__(18); |
4286 .default; |
3646 |
4287 }); |
3647 // EXTERNAL MODULE: external {"this":["wp","priorityQueue"]} |
|
3648 var external_this_wp_priorityQueue_ = __webpack_require__(150); |
|
3649 |
|
3650 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-async-list/index.js |
|
3651 |
|
3652 |
|
3653 |
|
3654 /** |
|
3655 * WordPress dependencies |
|
3656 */ |
|
3657 |
|
3658 |
|
3659 /** |
|
3660 * Returns the first items from list that are present on state. |
|
3661 * |
|
3662 * @param {Array} list New array. |
|
3663 * @param {Array} state Current state. |
|
3664 * @return {Array} First items present iin state. |
|
3665 */ |
|
3666 |
|
3667 function getFirstItemsPresentInState(list, state) { |
|
3668 var firstItems = []; |
|
3669 |
|
3670 for (var i = 0; i < list.length; i++) { |
|
3671 var item = list[i]; |
|
3672 |
|
3673 if (!state.includes(item)) { |
|
3674 break; |
|
3675 } |
|
3676 |
|
3677 firstItems.push(item); |
|
3678 } |
|
3679 |
|
3680 return firstItems; |
|
3681 } |
|
3682 /** |
|
3683 * Reducer keeping track of a list of appended items. |
|
3684 * |
|
3685 * @param {Array} state Current state |
|
3686 * @param {Object} action Action |
|
3687 * |
|
3688 * @return {Array} update state. |
|
3689 */ |
|
3690 |
|
3691 |
|
3692 function listReducer(state, action) { |
|
3693 if (action.type === 'reset') { |
|
3694 return action.list; |
|
3695 } |
|
3696 |
|
3697 if (action.type === 'append') { |
|
3698 return [].concat(Object(toConsumableArray["a" /* default */])(state), [action.item]); |
|
3699 } |
|
3700 |
|
3701 return state; |
|
3702 } |
|
3703 /** |
|
3704 * React hook returns an array which items get asynchronously appended from a source array. |
|
3705 * This behavior is useful if we want to render a list of items asynchronously for performance reasons. |
|
3706 * |
|
3707 * @param {Array} list Source array. |
|
3708 * @return {Array} Async array. |
|
3709 */ |
|
3710 |
|
3711 |
|
3712 function useAsyncList(list) { |
|
3713 var _useReducer = Object(external_this_wp_element_["useReducer"])(listReducer, []), |
|
3714 _useReducer2 = Object(slicedToArray["a" /* default */])(_useReducer, 2), |
|
3715 current = _useReducer2[0], |
|
3716 dispatch = _useReducer2[1]; |
|
3717 |
|
3718 Object(external_this_wp_element_["useEffect"])(function () { |
|
3719 // On reset, we keep the first items that were previously rendered. |
|
3720 var firstItems = getFirstItemsPresentInState(list, current); |
|
3721 dispatch({ |
|
3722 type: 'reset', |
|
3723 list: firstItems |
|
3724 }); |
|
3725 var asyncQueue = Object(external_this_wp_priorityQueue_["createQueue"])(); |
|
3726 |
|
3727 var append = function append(index) { |
|
3728 return function () { |
|
3729 if (list.length <= index) { |
|
3730 return; |
|
3731 } |
|
3732 |
|
3733 dispatch({ |
|
3734 type: 'append', |
|
3735 item: list[index] |
|
3736 }); |
|
3737 asyncQueue.add({}, append(index + 1)); |
|
3738 }; |
|
3739 }; |
|
3740 |
|
3741 asyncQueue.add({}, append(firstItems.length)); |
|
3742 return function () { |
|
3743 return asyncQueue.reset(); |
|
3744 }; |
|
3745 }, [list]); |
|
3746 return current; |
|
3747 } |
|
3748 |
|
3749 /* harmony default export */ var use_async_list = (useAsyncList); |
|
3750 |
|
3751 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-warn-on-change/index.js |
|
3752 |
|
3753 |
|
3754 /** |
|
3755 * Internal dependencies |
|
3756 */ |
|
3757 |
|
3758 /** |
|
3759 * Hook that performs a shallow comparison between the preview value of an object |
|
3760 * and the new one, if there's a difference, it prints it to the console. |
|
3761 * this is useful in performance related work, to check why a component re-renders. |
|
3762 * |
|
3763 * @example |
|
3764 * |
|
3765 * ```jsx |
|
3766 * function MyComponent(props) { |
|
3767 * useWarnOnChange(props); |
|
3768 * |
|
3769 * return "Something"; |
|
3770 * } |
|
3771 * ``` |
|
3772 * |
|
3773 * @param {Object} object Object which changes to compare. |
|
3774 * @param {string} prefix Just a prefix to show when console logging. |
|
3775 */ |
|
3776 |
|
3777 function useWarnOnChange(object) { |
|
3778 var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Change detection'; |
|
3779 var previousValues = usePrevious(object); |
|
3780 Object.entries(previousValues !== null && previousValues !== void 0 ? previousValues : []).forEach(function (_ref) { |
|
3781 var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 2), |
|
3782 key = _ref2[0], |
|
3783 value = _ref2[1]; |
|
3784 |
|
3785 if (value !== object[key]) { |
|
3786 // eslint-disable-next-line no-console |
|
3787 console.warn("".concat(prefix, ": ").concat(key, " key changed:"), value, object[key]); |
|
3788 } |
|
3789 }); |
|
3790 } |
|
3791 |
|
3792 /* harmony default export */ var use_warn_on_change = (useWarnOnChange); |
|
3793 |
|
3794 // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/index.js |
|
3795 // Utils |
|
3796 // Compose helper (aliased flowRight from Lodash) |
|
3797 |
|
3798 // Higher-order components |
|
3799 |
|
3800 |
|
3801 |
|
3802 |
|
3803 |
|
3804 |
|
3805 // Hooks |
|
3806 |
|
3807 |
|
3808 |
|
3809 |
|
3810 |
|
3811 |
|
3812 |
|
3813 |
|
3814 |
|
3815 |
|
3816 |
|
3817 |
|
3818 |
|
3819 |
4288 |
3820 /***/ }), |
4289 /***/ }), |
3821 |
4290 |
3822 /***/ 64: |
4291 /***/ "wx14": |
3823 /***/ (function(module, exports) { |
|
3824 |
|
3825 (function() { module.exports = this["wp"]["isShallowEqual"]; }()); |
|
3826 |
|
3827 /***/ }), |
|
3828 |
|
3829 /***/ 8: |
|
3830 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
4292 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
3831 |
4293 |
3832 "use strict"; |
4294 "use strict"; |
3833 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); |
4295 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); |
3834 function _extends() { |
4296 function _extends() { |