| @@ -1,8 +1,8 @@ | ||
| 1 | -/******/ (function() { // webpackBootstrap | |
| 1 | +/******/ (() => { // webpackBootstrap | |
| 2 | 2 | /******/ var __webpack_modules__ = ({ |
| 3 | 3 | |
| 4 | -/***/ 2152: | |
| 4 | +/***/ 8294: | |
| 5 | 5 | /***/ (function(module) { |
| 6 | 6 | |
| 7 | 7 | /*! |
| 8 | 8 | * clipboard.js v2.0.8 |
| @@ -955,10 +955,10 @@ | ||
| 955 | 955 | }); |
| 956 | 956 | |
| 957 | 957 | /***/ }), |
| 958 | 958 | |
| 959 | -/***/ 2441: | |
| 960 | -/***/ (function(module, exports, __webpack_require__) { | |
| 959 | +/***/ 7973: | |
| 960 | +/***/ ((module, exports, __webpack_require__) => { | |
| 961 | 961 | |
| 962 | 962 | var __WEBPACK_AMD_DEFINE_RESULT__;/*global define:false */ |
| 963 | 963 | /** |
| 964 | 964 | * Copyright 2012-2017 Craig Campbell |
| @@ -2021,10 +2021,10 @@ | ||
| 2021 | 2021 | |
| 2022 | 2022 | |
| 2023 | 2023 | /***/ }), |
| 2024 | 2024 | |
| 2025 | -/***/ 3956: | |
| 2026 | -/***/ (function() { | |
| 2025 | +/***/ 5538: | |
| 2026 | +/***/ (() => { | |
| 2027 | 2027 | |
| 2028 | 2028 | /** |
| 2029 | 2029 | * adds a bindGlobal method to Mousetrap that allows you to |
| 2030 | 2030 | * bind specific keyboard shortcuts that will still work |
| @@ -2072,25 +2072,8 @@ | ||
| 2072 | 2072 | Mousetrap.init(); |
| 2073 | 2073 | }) (typeof Mousetrap !== "undefined" ? Mousetrap : undefined); |
| 2074 | 2074 | |
| 2075 | 2075 | |
| 2076 | -/***/ }), | |
| 2077 | - | |
| 2078 | -/***/ 5464: | |
| 2079 | -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { | |
| 2080 | - | |
| 2081 | -var e=__webpack_require__(9196),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]}; | |
| 2082 | -//# sourceMappingURL=index.js.map | |
| 2083 | - | |
| 2084 | - | |
| 2085 | -/***/ }), | |
| 2086 | - | |
| 2087 | -/***/ 9196: | |
| 2088 | -/***/ (function(module) { | |
| 2089 | - | |
| 2090 | -"use strict"; | |
| 2091 | -module.exports = window["React"]; | |
| 2092 | - | |
| 2093 | 2076 | /***/ }) |
| 2094 | 2077 | |
| 2095 | 2078 | /******/ }); |
| 2096 | 2079 | /************************************************************************/ |
| @@ -2119,23 +2102,23 @@ | ||
| 2119 | 2102 | /******/ } |
| 2120 | 2103 | /******/ |
| 2121 | 2104 | /************************************************************************/ |
| 2122 | 2105 | /******/ /* webpack/runtime/compat get default export */ |
| 2123 | -/******/ !function() { | |
| 2106 | +/******/ (() => { | |
| 2124 | 2107 | /******/ // getDefaultExport function for compatibility with non-harmony modules |
| 2125 | -/******/ __webpack_require__.n = function(module) { | |
| 2108 | +/******/ __webpack_require__.n = (module) => { | |
| 2126 | 2109 | /******/ var getter = module && module.__esModule ? |
| 2127 | -/******/ function() { return module['default']; } : | |
| 2128 | -/******/ function() { return module; }; | |
| 2110 | +/******/ () => (module['default']) : | |
| 2111 | +/******/ () => (module); | |
| 2129 | 2112 | /******/ __webpack_require__.d(getter, { a: getter }); |
| 2130 | 2113 | /******/ return getter; |
| 2131 | 2114 | /******/ }; |
| 2132 | -/******/ }(); | |
| 2115 | +/******/ })(); | |
| 2133 | 2116 | /******/ |
| 2134 | 2117 | /******/ /* webpack/runtime/define property getters */ |
| 2135 | -/******/ !function() { | |
| 2118 | +/******/ (() => { | |
| 2136 | 2119 | /******/ // define getter functions for harmony exports |
| 2137 | -/******/ __webpack_require__.d = function(exports, definition) { | |
| 2120 | +/******/ __webpack_require__.d = (exports, definition) => { | |
| 2138 | 2121 | /******/ for(var key in definition) { |
| 2139 | 2122 | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 2140 | 2123 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 2141 | 2124 | /******/ } |
| @@ -2140,30 +2123,30 @@ | ||
| 2140 | 2123 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 2141 | 2124 | /******/ } |
| 2142 | 2125 | /******/ } |
| 2143 | 2126 | /******/ }; |
| 2144 | -/******/ }(); | |
| 2127 | +/******/ })(); | |
| 2145 | 2128 | /******/ |
| 2146 | 2129 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 2147 | -/******/ !function() { | |
| 2148 | -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } | |
| 2149 | -/******/ }(); | |
| 2130 | +/******/ (() => { | |
| 2131 | +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | |
| 2132 | +/******/ })(); | |
| 2150 | 2133 | /******/ |
| 2151 | 2134 | /******/ /* webpack/runtime/make namespace object */ |
| 2152 | -/******/ !function() { | |
| 2135 | +/******/ (() => { | |
| 2153 | 2136 | /******/ // define __esModule on exports |
| 2154 | -/******/ __webpack_require__.r = function(exports) { | |
| 2137 | +/******/ __webpack_require__.r = (exports) => { | |
| 2155 | 2138 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 2156 | 2139 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 2157 | 2140 | /******/ } |
| 2158 | 2141 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 2159 | 2142 | /******/ }; |
| 2160 | -/******/ }(); | |
| 2143 | +/******/ })(); | |
| 2161 | 2144 | /******/ |
| 2162 | 2145 | /************************************************************************/ |
| 2163 | 2146 | var __webpack_exports__ = {}; |
| 2164 | 2147 | // This entry need to be wrapped in an IIFE because it need to be in strict mode. |
| 2165 | -!function() { | |
| 2148 | +(() => { | |
| 2166 | 2149 | "use strict"; |
| 2167 | 2150 | // ESM COMPAT FLAG |
| 2168 | 2151 | __webpack_require__.r(__webpack_exports__); |
| 2169 | 2152 | |
| @@ -2168,46 +2151,388 @@ | ||
| 2168 | 2151 | __webpack_require__.r(__webpack_exports__); |
| 2169 | 2152 | |
| 2170 | 2153 | // EXPORTS |
| 2171 | 2154 | __webpack_require__.d(__webpack_exports__, { |
| 2172 | - "__experimentalUseDialog": function() { return /* reexport */ use_dialog; }, | |
| 2173 | - "__experimentalUseDisabled": function() { return /* reexport */ useDisabled; }, | |
| 2174 | - "__experimentalUseDragging": function() { return /* reexport */ useDragging; }, | |
| 2175 | - "__experimentalUseDropZone": function() { return /* reexport */ useDropZone; }, | |
| 2176 | - "__experimentalUseFixedWindowList": function() { return /* reexport */ useFixedWindowList; }, | |
| 2177 | - "__experimentalUseFocusOutside": function() { return /* reexport */ useFocusOutside; }, | |
| 2178 | - "compose": function() { return /* reexport */ compose; }, | |
| 2179 | - "createHigherOrderComponent": function() { return /* reexport */ create_higher_order_component; }, | |
| 2180 | - "ifCondition": function() { return /* reexport */ if_condition; }, | |
| 2181 | - "pure": function() { return /* reexport */ higher_order_pure; }, | |
| 2182 | - "useAsyncList": function() { return /* reexport */ use_async_list; }, | |
| 2183 | - "useConstrainedTabbing": function() { return /* reexport */ use_constrained_tabbing; }, | |
| 2184 | - "useCopyOnClick": function() { return /* reexport */ useCopyOnClick; }, | |
| 2185 | - "useCopyToClipboard": function() { return /* reexport */ useCopyToClipboard; }, | |
| 2186 | - "useDebounce": function() { return /* reexport */ useDebounce; }, | |
| 2187 | - "useFocusOnMount": function() { return /* reexport */ useFocusOnMount; }, | |
| 2188 | - "useFocusReturn": function() { return /* reexport */ use_focus_return; }, | |
| 2189 | - "useFocusableIframe": function() { return /* reexport */ useFocusableIframe; }, | |
| 2190 | - "useInstanceId": function() { return /* reexport */ useInstanceId; }, | |
| 2191 | - "useIsomorphicLayoutEffect": function() { return /* reexport */ use_isomorphic_layout_effect; }, | |
| 2192 | - "useKeyboardShortcut": function() { return /* reexport */ use_keyboard_shortcut; }, | |
| 2193 | - "useMediaQuery": function() { return /* reexport */ useMediaQuery; }, | |
| 2194 | - "useMergeRefs": function() { return /* reexport */ useMergeRefs; }, | |
| 2195 | - "usePrevious": function() { return /* reexport */ usePrevious; }, | |
| 2196 | - "useReducedMotion": function() { return /* reexport */ use_reduced_motion; }, | |
| 2197 | - "useRefEffect": function() { return /* reexport */ useRefEffect; }, | |
| 2198 | - "useResizeObserver": function() { return /* reexport */ use_resize_observer; }, | |
| 2199 | - "useThrottle": function() { return /* reexport */ useThrottle; }, | |
| 2200 | - "useViewportMatch": function() { return /* reexport */ use_viewport_match; }, | |
| 2201 | - "useWarnOnChange": function() { return /* reexport */ use_warn_on_change; }, | |
| 2202 | - "withGlobalEvents": function() { return /* reexport */ withGlobalEvents; }, | |
| 2203 | - "withInstanceId": function() { return /* reexport */ with_instance_id; }, | |
| 2204 | - "withSafeTimeout": function() { return /* reexport */ with_safe_timeout; }, | |
| 2205 | - "withState": function() { return /* reexport */ withState; } | |
| 2155 | + "__experimentalUseDialog": () => (/* reexport */ use_dialog), | |
| 2156 | + "__experimentalUseDragging": () => (/* reexport */ useDragging), | |
| 2157 | + "__experimentalUseDropZone": () => (/* reexport */ useDropZone), | |
| 2158 | + "__experimentalUseFixedWindowList": () => (/* reexport */ useFixedWindowList), | |
| 2159 | + "__experimentalUseFocusOutside": () => (/* reexport */ useFocusOutside), | |
| 2160 | + "compose": () => (/* reexport */ higher_order_compose), | |
| 2161 | + "createHigherOrderComponent": () => (/* reexport */ createHigherOrderComponent), | |
| 2162 | + "debounce": () => (/* reexport */ debounce), | |
| 2163 | + "ifCondition": () => (/* reexport */ if_condition), | |
| 2164 | + "pipe": () => (/* reexport */ higher_order_pipe), | |
| 2165 | + "pure": () => (/* reexport */ higher_order_pure), | |
| 2166 | + "throttle": () => (/* reexport */ throttle), | |
| 2167 | + "useAsyncList": () => (/* reexport */ use_async_list), | |
| 2168 | + "useConstrainedTabbing": () => (/* reexport */ use_constrained_tabbing), | |
| 2169 | + "useCopyOnClick": () => (/* reexport */ useCopyOnClick), | |
| 2170 | + "useCopyToClipboard": () => (/* reexport */ useCopyToClipboard), | |
| 2171 | + "useDebounce": () => (/* reexport */ useDebounce), | |
| 2172 | + "useDisabled": () => (/* reexport */ useDisabled), | |
| 2173 | + "useFocusOnMount": () => (/* reexport */ useFocusOnMount), | |
| 2174 | + "useFocusReturn": () => (/* reexport */ use_focus_return), | |
| 2175 | + "useFocusableIframe": () => (/* reexport */ useFocusableIframe), | |
| 2176 | + "useInstanceId": () => (/* reexport */ use_instance_id), | |
| 2177 | + "useIsomorphicLayoutEffect": () => (/* reexport */ use_isomorphic_layout_effect), | |
| 2178 | + "useKeyboardShortcut": () => (/* reexport */ use_keyboard_shortcut), | |
| 2179 | + "useMediaQuery": () => (/* reexport */ useMediaQuery), | |
| 2180 | + "useMergeRefs": () => (/* reexport */ useMergeRefs), | |
| 2181 | + "usePrevious": () => (/* reexport */ usePrevious), | |
| 2182 | + "useReducedMotion": () => (/* reexport */ use_reduced_motion), | |
| 2183 | + "useRefEffect": () => (/* reexport */ useRefEffect), | |
| 2184 | + "useResizeObserver": () => (/* reexport */ useResizeAware), | |
| 2185 | + "useThrottle": () => (/* reexport */ useThrottle), | |
| 2186 | + "useViewportMatch": () => (/* reexport */ use_viewport_match), | |
| 2187 | + "useWarnOnChange": () => (/* reexport */ use_warn_on_change), | |
| 2188 | + "withGlobalEvents": () => (/* reexport */ withGlobalEvents), | |
| 2189 | + "withInstanceId": () => (/* reexport */ with_instance_id), | |
| 2190 | + "withSafeTimeout": () => (/* reexport */ with_safe_timeout), | |
| 2191 | + "withState": () => (/* reexport */ withState) | |
| 2206 | 2192 | }); |
| 2207 | 2193 | |
| 2208 | -;// CONCATENATED MODULE: external "lodash" | |
| 2209 | -var external_lodash_namespaceObject = window["lodash"]; | |
| 2194 | +;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.js | |
| 2195 | +/*! ***************************************************************************** | |
| 2196 | +Copyright (c) Microsoft Corporation. | |
| 2197 | + | |
| 2198 | +Permission to use, copy, modify, and/or distribute this software for any | |
| 2199 | +purpose with or without fee is hereby granted. | |
| 2200 | + | |
| 2201 | +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | |
| 2202 | +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | |
| 2203 | +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | |
| 2204 | +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | |
| 2205 | +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | |
| 2206 | +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | |
| 2207 | +PERFORMANCE OF THIS SOFTWARE. | |
| 2208 | +***************************************************************************** */ | |
| 2209 | +/* global Reflect, Promise */ | |
| 2210 | + | |
| 2211 | +var extendStatics = function(d, b) { | |
| 2212 | + extendStatics = Object.setPrototypeOf || | |
| 2213 | + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | |
| 2214 | + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | |
| 2215 | + return extendStatics(d, b); | |
| 2216 | +}; | |
| 2217 | + | |
| 2218 | +function __extends(d, b) { | |
| 2219 | + if (typeof b !== "function" && b !== null) | |
| 2220 | + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | |
| 2221 | + extendStatics(d, b); | |
| 2222 | + function __() { this.constructor = d; } | |
| 2223 | + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
| 2224 | +} | |
| 2225 | + | |
| 2226 | +var __assign = function() { | |
| 2227 | + __assign = Object.assign || function __assign(t) { | |
| 2228 | + for (var s, i = 1, n = arguments.length; i < n; i++) { | |
| 2229 | + s = arguments[i]; | |
| 2230 | + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | |
| 2231 | + } | |
| 2232 | + return t; | |
| 2233 | + } | |
| 2234 | + return __assign.apply(this, arguments); | |
| 2235 | +} | |
| 2236 | + | |
| 2237 | +function __rest(s, e) { | |
| 2238 | + var t = {}; | |
| 2239 | + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | |
| 2240 | + t[p] = s[p]; | |
| 2241 | + if (s != null && typeof Object.getOwnPropertySymbols === "function") | |
| 2242 | + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | |
| 2243 | + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | |
| 2244 | + t[p[i]] = s[p[i]]; | |
| 2245 | + } | |
| 2246 | + return t; | |
| 2247 | +} | |
| 2248 | + | |
| 2249 | +function __decorate(decorators, target, key, desc) { | |
| 2250 | + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | |
| 2251 | + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | |
| 2252 | + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | |
| 2253 | + return c > 3 && r && Object.defineProperty(target, key, r), r; | |
| 2254 | +} | |
| 2255 | + | |
| 2256 | +function __param(paramIndex, decorator) { | |
| 2257 | + return function (target, key) { decorator(target, key, paramIndex); } | |
| 2258 | +} | |
| 2259 | + | |
| 2260 | +function __metadata(metadataKey, metadataValue) { | |
| 2261 | + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); | |
| 2262 | +} | |
| 2263 | + | |
| 2264 | +function __awaiter(thisArg, _arguments, P, generator) { | |
| 2265 | + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | |
| 2266 | + return new (P || (P = Promise))(function (resolve, reject) { | |
| 2267 | + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | |
| 2268 | + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | |
| 2269 | + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | |
| 2270 | + step((generator = generator.apply(thisArg, _arguments || [])).next()); | |
| 2271 | + }); | |
| 2272 | +} | |
| 2273 | + | |
| 2274 | +function __generator(thisArg, body) { | |
| 2275 | + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | |
| 2276 | + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | |
| 2277 | + function verb(n) { return function (v) { return step([n, v]); }; } | |
| 2278 | + function step(op) { | |
| 2279 | + if (f) throw new TypeError("Generator is already executing."); | |
| 2280 | + while (_) try { | |
| 2281 | + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | |
| 2282 | + if (y = 0, t) op = [op[0] & 2, t.value]; | |
| 2283 | + switch (op[0]) { | |
| 2284 | + case 0: case 1: t = op; break; | |
| 2285 | + case 4: _.label++; return { value: op[1], done: false }; | |
| 2286 | + case 5: _.label++; y = op[1]; op = [0]; continue; | |
| 2287 | + case 7: op = _.ops.pop(); _.trys.pop(); continue; | |
| 2288 | + default: | |
| 2289 | + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | |
| 2290 | + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | |
| 2291 | + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | |
| 2292 | + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | |
| 2293 | + if (t[2]) _.ops.pop(); | |
| 2294 | + _.trys.pop(); continue; | |
| 2295 | + } | |
| 2296 | + op = body.call(thisArg, _); | |
| 2297 | + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | |
| 2298 | + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | |
| 2299 | + } | |
| 2300 | +} | |
| 2301 | + | |
| 2302 | +var __createBinding = Object.create ? (function(o, m, k, k2) { | |
| 2303 | + if (k2 === undefined) k2 = k; | |
| 2304 | + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | |
| 2305 | +}) : (function(o, m, k, k2) { | |
| 2306 | + if (k2 === undefined) k2 = k; | |
| 2307 | + o[k2] = m[k]; | |
| 2308 | +}); | |
| 2309 | + | |
| 2310 | +function __exportStar(m, o) { | |
| 2311 | + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); | |
| 2312 | +} | |
| 2313 | + | |
| 2314 | +function __values(o) { | |
| 2315 | + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | |
| 2316 | + if (m) return m.call(o); | |
| 2317 | + if (o && typeof o.length === "number") return { | |
| 2318 | + next: function () { | |
| 2319 | + if (o && i >= o.length) o = void 0; | |
| 2320 | + return { value: o && o[i++], done: !o }; | |
| 2321 | + } | |
| 2322 | + }; | |
| 2323 | + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | |
| 2324 | +} | |
| 2325 | + | |
| 2326 | +function __read(o, n) { | |
| 2327 | + var m = typeof Symbol === "function" && o[Symbol.iterator]; | |
| 2328 | + if (!m) return o; | |
| 2329 | + var i = m.call(o), r, ar = [], e; | |
| 2330 | + try { | |
| 2331 | + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | |
| 2332 | + } | |
| 2333 | + catch (error) { e = { error: error }; } | |
| 2334 | + finally { | |
| 2335 | + try { | |
| 2336 | + if (r && !r.done && (m = i["return"])) m.call(i); | |
| 2337 | + } | |
| 2338 | + finally { if (e) throw e.error; } | |
| 2339 | + } | |
| 2340 | + return ar; | |
| 2341 | +} | |
| 2342 | + | |
| 2343 | +/** @deprecated */ | |
| 2344 | +function __spread() { | |
| 2345 | + for (var ar = [], i = 0; i < arguments.length; i++) | |
| 2346 | + ar = ar.concat(__read(arguments[i])); | |
| 2347 | + return ar; | |
| 2348 | +} | |
| 2349 | + | |
| 2350 | +/** @deprecated */ | |
| 2351 | +function __spreadArrays() { | |
| 2352 | + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | |
| 2353 | + for (var r = Array(s), k = 0, i = 0; i < il; i++) | |
| 2354 | + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | |
| 2355 | + r[k] = a[j]; | |
| 2356 | + return r; | |
| 2357 | +} | |
| 2358 | + | |
| 2359 | +function __spreadArray(to, from, pack) { | |
| 2360 | + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | |
| 2361 | + if (ar || !(i in from)) { | |
| 2362 | + if (!ar) ar = Array.prototype.slice.call(from, 0, i); | |
| 2363 | + ar[i] = from[i]; | |
| 2364 | + } | |
| 2365 | + } | |
| 2366 | + return to.concat(ar || from); | |
| 2367 | +} | |
| 2368 | + | |
| 2369 | +function __await(v) { | |
| 2370 | + return this instanceof __await ? (this.v = v, this) : new __await(v); | |
| 2371 | +} | |
| 2372 | + | |
| 2373 | +function __asyncGenerator(thisArg, _arguments, generator) { | |
| 2374 | + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | |
| 2375 | + var g = generator.apply(thisArg, _arguments || []), i, q = []; | |
| 2376 | + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; | |
| 2377 | + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } | |
| 2378 | + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } | |
| 2379 | + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | |
| 2380 | + function fulfill(value) { resume("next", value); } | |
| 2381 | + function reject(value) { resume("throw", value); } | |
| 2382 | + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } | |
| 2383 | +} | |
| 2384 | + | |
| 2385 | +function __asyncDelegator(o) { | |
| 2386 | + var i, p; | |
| 2387 | + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; | |
| 2388 | + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } | |
| 2389 | +} | |
| 2390 | + | |
| 2391 | +function __asyncValues(o) { | |
| 2392 | + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | |
| 2393 | + var m = o[Symbol.asyncIterator], i; | |
| 2394 | + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | |
| 2395 | + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | |
| 2396 | + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | |
| 2397 | +} | |
| 2398 | + | |
| 2399 | +function __makeTemplateObject(cooked, raw) { | |
| 2400 | + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } | |
| 2401 | + return cooked; | |
| 2402 | +}; | |
| 2403 | + | |
| 2404 | +var __setModuleDefault = Object.create ? (function(o, v) { | |
| 2405 | + Object.defineProperty(o, "default", { enumerable: true, value: v }); | |
| 2406 | +}) : function(o, v) { | |
| 2407 | + o["default"] = v; | |
| 2408 | +}; | |
| 2409 | + | |
| 2410 | +function __importStar(mod) { | |
| 2411 | + if (mod && mod.__esModule) return mod; | |
| 2412 | + var result = {}; | |
| 2413 | + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | |
| 2414 | + __setModuleDefault(result, mod); | |
| 2415 | + return result; | |
| 2416 | +} | |
| 2417 | + | |
| 2418 | +function __importDefault(mod) { | |
| 2419 | + return (mod && mod.__esModule) ? mod : { default: mod }; | |
| 2420 | +} | |
| 2421 | + | |
| 2422 | +function __classPrivateFieldGet(receiver, state, kind, f) { | |
| 2423 | + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); | |
| 2424 | + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); | |
| 2425 | + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); | |
| 2426 | +} | |
| 2427 | + | |
| 2428 | +function __classPrivateFieldSet(receiver, state, value, kind, f) { | |
| 2429 | + if (kind === "m") throw new TypeError("Private method is not writable"); | |
| 2430 | + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); | |
| 2431 | + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); | |
| 2432 | + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; | |
| 2433 | +} | |
| 2434 | + | |
| 2435 | +;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js | |
| 2436 | +/** | |
| 2437 | + * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt | |
| 2438 | + */ | |
| 2439 | +var SUPPORTED_LOCALE = { | |
| 2440 | + tr: { | |
| 2441 | + regexp: /\u0130|\u0049|\u0049\u0307/g, | |
| 2442 | + map: { | |
| 2443 | + İ: "\u0069", | |
| 2444 | + I: "\u0131", | |
| 2445 | + İ: "\u0069", | |
| 2446 | + }, | |
| 2447 | + }, | |
| 2448 | + az: { | |
| 2449 | + regexp: /\u0130/g, | |
| 2450 | + map: { | |
| 2451 | + İ: "\u0069", | |
| 2452 | + I: "\u0131", | |
| 2453 | + İ: "\u0069", | |
| 2454 | + }, | |
| 2455 | + }, | |
| 2456 | + lt: { | |
| 2457 | + regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, | |
| 2458 | + map: { | |
| 2459 | + I: "\u0069\u0307", | |
| 2460 | + J: "\u006A\u0307", | |
| 2461 | + Į: "\u012F\u0307", | |
| 2462 | + Ì: "\u0069\u0307\u0300", | |
| 2463 | + Í: "\u0069\u0307\u0301", | |
| 2464 | + Ĩ: "\u0069\u0307\u0303", | |
| 2465 | + }, | |
| 2466 | + }, | |
| 2467 | +}; | |
| 2468 | +/** | |
| 2469 | + * Localized lower case. | |
| 2470 | + */ | |
| 2471 | +function localeLowerCase(str, locale) { | |
| 2472 | + var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; | |
| 2473 | + if (lang) | |
| 2474 | + return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); | |
| 2475 | + return lowerCase(str); | |
| 2476 | +} | |
| 2477 | +/** | |
| 2478 | + * Lower case as a function. | |
| 2479 | + */ | |
| 2480 | +function lowerCase(str) { | |
| 2481 | + return str.toLowerCase(); | |
| 2482 | +} | |
| 2483 | + | |
| 2484 | +;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js | |
| 2485 | + | |
| 2486 | +// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). | |
| 2487 | +var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; | |
| 2488 | +// Remove all non-word characters. | |
| 2489 | +var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; | |
| 2490 | +/** | |
| 2491 | + * Normalize the string into something other libraries can manipulate easier. | |
| 2492 | + */ | |
| 2493 | +function noCase(input, options) { | |
| 2494 | + if (options === void 0) { options = {}; } | |
| 2495 | + var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; | |
| 2496 | + var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); | |
| 2497 | + var start = 0; | |
| 2498 | + var end = result.length; | |
| 2499 | + // Trim the delimiter from around the output string. | |
| 2500 | + while (result.charAt(start) === "\0") | |
| 2501 | + start++; | |
| 2502 | + while (result.charAt(end - 1) === "\0") | |
| 2503 | + end--; | |
| 2504 | + // Transform each token independently. | |
| 2505 | + return result.slice(start, end).split("\0").map(transform).join(delimiter); | |
| 2506 | +} | |
| 2507 | +/** | |
| 2508 | + * Replace `re` in the input string with the replacement value. | |
| 2509 | + */ | |
| 2510 | +function replace(input, re, value) { | |
| 2511 | + if (re instanceof RegExp) | |
| 2512 | + return input.replace(re, value); | |
| 2513 | + return re.reduce(function (input, re) { return input.replace(re, value); }, input); | |
| 2514 | +} | |
| 2515 | + | |
| 2516 | +;// CONCATENATED MODULE: ./node_modules/pascal-case/dist.es2015/index.js | |
| 2517 | + | |
| 2518 | + | |
| 2519 | +function pascalCaseTransform(input, index) { | |
| 2520 | + var firstChar = input.charAt(0); | |
| 2521 | + var lowerChars = input.substr(1).toLowerCase(); | |
| 2522 | + if (index > 0 && firstChar >= "0" && firstChar <= "9") { | |
| 2523 | + return "_" + firstChar + lowerChars; | |
| 2524 | + } | |
| 2525 | + return "" + firstChar.toUpperCase() + lowerChars; | |
| 2526 | +} | |
| 2527 | +function pascalCaseTransformMerge(input) { | |
| 2528 | + return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase(); | |
| 2529 | +} | |
| 2530 | +function pascalCase(input, options) { | |
| 2531 | + if (options === void 0) { options = {}; } | |
| 2532 | + return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options)); | |
| 2533 | +} | |
| 2534 | + | |
| 2210 | 2535 | ;// CONCATENATED MODULE: ./packages/compose/build-module/utils/create-higher-order-component/index.js |
| 2211 | 2536 | /** |
| 2212 | 2537 | * External dependencies |
| 2213 | 2538 | */ |
| @@ -2216,10 +2541,10 @@ | ||
| 2216 | 2541 | /** |
| 2217 | 2542 | * Given a function mapping a component to an enhanced component and modifier |
| 2218 | 2543 | * name, returns the enhanced component augmented with a generated displayName. |
| 2219 | 2544 | * |
| 2220 | - * @param mapComponent Function mapping component to enhanced component. | |
| 2221 | - * @param modifierName Seed name from which to generated display name. | |
| 2545 | + * @param mapComponent Function mapping component to enhanced component. | |
| 2546 | + * @param modifierName Seed name from which to generated display name. | |
| 2222 | 2547 | * |
| 2223 | 2548 | * @return Component class with generated display name assigned. |
| 2224 | 2549 | */ |
| 2225 | 2550 | function createHigherOrderComponent(mapComponent, modifierName) { |
| @@ -2224,19 +2549,430 @@ | ||
| 2224 | 2549 | */ |
| 2225 | 2550 | function createHigherOrderComponent(mapComponent, modifierName) { |
| 2226 | 2551 | return Inner => { |
| 2227 | 2552 | const Outer = mapComponent(Inner); |
| 2228 | - const displayName = Inner.displayName || Inner.name || 'Component'; | |
| 2229 | - Outer.displayName = `${(0,external_lodash_namespaceObject.upperFirst)((0,external_lodash_namespaceObject.camelCase)(modifierName))}(${displayName})`; | |
| 2553 | + Outer.displayName = hocName(modifierName, Inner); | |
| 2230 | 2554 | return Outer; |
| 2231 | 2555 | }; |
| 2232 | 2556 | } |
| 2557 | +/** | |
| 2558 | + * Returns a displayName for a higher-order component, given a wrapper name. | |
| 2559 | + * | |
| 2560 | + * @example | |
| 2561 | + * hocName( 'MyMemo', Widget ) === 'MyMemo(Widget)'; | |
| 2562 | + * hocName( 'MyMemo', <div /> ) === 'MyMemo(Component)'; | |
| 2563 | + * | |
| 2564 | + * @param name Name assigned to higher-order component's wrapper component. | |
| 2565 | + * @param Inner Wrapped component inside higher-order component. | |
| 2566 | + * @return Wrapped name of higher-order component. | |
| 2567 | + */ | |
| 2233 | 2568 | |
| 2234 | -/* harmony default export */ var create_higher_order_component = (createHigherOrderComponent); | |
| 2235 | -//# sourceMappingURL=index.js.map | |
| 2569 | +const hocName = (name, Inner) => { | |
| 2570 | + const inner = Inner.displayName || Inner.name || 'Component'; | |
| 2571 | + const outer = pascalCase(name !== null && name !== void 0 ? name : ''); | |
| 2572 | + return `${outer}(${inner})`; | |
| 2573 | +}; | |
| 2574 | + | |
| 2575 | +;// CONCATENATED MODULE: ./packages/compose/build-module/utils/debounce/index.js | |
| 2576 | +/** | |
| 2577 | + * Parts of this source were derived and modified from lodash, | |
| 2578 | + * released under the MIT license. | |
| 2579 | + * | |
| 2580 | + * https://github.com/lodash/lodash | |
| 2581 | + * | |
| 2582 | + * Copyright JS Foundation and other contributors <https://js.foundation/> | |
| 2583 | + * | |
| 2584 | + * Based on Underscore.js, copyright Jeremy Ashkenas, | |
| 2585 | + * DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> | |
| 2586 | + * | |
| 2587 | + * This software consists of voluntary contributions made by many | |
| 2588 | + * individuals. For exact contribution history, see the revision history | |
| 2589 | + * available at https://github.com/lodash/lodash | |
| 2590 | + * | |
| 2591 | + * The following license applies to all parts of this software except as | |
| 2592 | + * documented below: | |
| 2593 | + * | |
| 2594 | + * ==== | |
| 2595 | + * | |
| 2596 | + * Permission is hereby granted, free of charge, to any person obtaining | |
| 2597 | + * a copy of this software and associated documentation files (the | |
| 2598 | + * "Software"), to deal in the Software without restriction, including | |
| 2599 | + * without limitation the rights to use, copy, modify, merge, publish, | |
| 2600 | + * distribute, sublicense, and/or sell copies of the Software, and to | |
| 2601 | + * permit persons to whom the Software is furnished to do so, subject to | |
| 2602 | + * the following conditions: | |
| 2603 | + * | |
| 2604 | + * The above copyright notice and this permission notice shall be | |
| 2605 | + * included in all copies or substantial portions of the Software. | |
| 2606 | + * | |
| 2607 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
| 2608 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
| 2609 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
| 2610 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
| 2611 | + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
| 2612 | + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
| 2613 | + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 2614 | + */ | |
| 2615 | + | |
| 2616 | +/** | |
| 2617 | + * A simplified and properly typed version of lodash's `debounce`, that | |
| 2618 | + * always uses timers instead of sometimes using rAF. | |
| 2619 | + * | |
| 2620 | + * Creates a debounced function that delays invoking `func` until after `wait` | |
| 2621 | + * milliseconds have elapsed since the last time the debounced function was | |
| 2622 | + * invoked. The debounced function comes with a `cancel` method to cancel delayed | |
| 2623 | + * `func` invocations and a `flush` method to immediately invoke them. Provide | |
| 2624 | + * `options` to indicate whether `func` should be invoked on the leading and/or | |
| 2625 | + * trailing edge of the `wait` timeout. The `func` is invoked with the last | |
| 2626 | + * arguments provided to the debounced function. Subsequent calls to the debounced | |
| 2627 | + * function return the result of the last `func` invocation. | |
| 2628 | + * | |
| 2629 | + * **Note:** If `leading` and `trailing` options are `true`, `func` is | |
| 2630 | + * invoked on the trailing edge of the timeout only if the debounced function | |
| 2631 | + * is invoked more than once during the `wait` timeout. | |
| 2632 | + * | |
| 2633 | + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred | |
| 2634 | + * until the next tick, similar to `setTimeout` with a timeout of `0`. | |
| 2635 | + * | |
| 2636 | + * @param {Function} func The function to debounce. | |
| 2637 | + * @param {number} wait The number of milliseconds to delay. | |
| 2638 | + * @param {Partial< DebounceOptions >} options The options object. | |
| 2639 | + * @param {boolean} options.leading Specify invoking on the leading edge of the timeout. | |
| 2640 | + * @param {number} options.maxWait The maximum time `func` is allowed to be delayed before it's invoked. | |
| 2641 | + * @param {boolean} options.trailing Specify invoking on the trailing edge of the timeout. | |
| 2642 | + * | |
| 2643 | + * @return Returns the new debounced function. | |
| 2644 | + */ | |
| 2645 | +const debounce = (func, wait, options) => { | |
| 2646 | + let lastArgs; | |
| 2647 | + let lastThis; | |
| 2648 | + let maxWait = 0; | |
| 2649 | + let result; | |
| 2650 | + let timerId; | |
| 2651 | + let lastCallTime; | |
| 2652 | + let lastInvokeTime = 0; | |
| 2653 | + let leading = false; | |
| 2654 | + let maxing = false; | |
| 2655 | + let trailing = true; | |
| 2656 | + | |
| 2657 | + if (options) { | |
| 2658 | + leading = !!options.leading; | |
| 2659 | + maxing = 'maxWait' in options; | |
| 2660 | + | |
| 2661 | + if (options.maxWait !== undefined) { | |
| 2662 | + maxWait = Math.max(options.maxWait, wait); | |
| 2663 | + } | |
| 2664 | + | |
| 2665 | + trailing = 'trailing' in options ? !!options.trailing : trailing; | |
| 2666 | + } | |
| 2667 | + | |
| 2668 | + function invokeFunc(time) { | |
| 2669 | + const args = lastArgs; | |
| 2670 | + const thisArg = lastThis; | |
| 2671 | + lastArgs = undefined; | |
| 2672 | + lastThis = undefined; | |
| 2673 | + lastInvokeTime = time; | |
| 2674 | + result = func.apply(thisArg, args); | |
| 2675 | + return result; | |
| 2676 | + } | |
| 2677 | + | |
| 2678 | + function startTimer(pendingFunc, waitTime) { | |
| 2679 | + timerId = setTimeout(pendingFunc, waitTime); | |
| 2680 | + } | |
| 2681 | + | |
| 2682 | + function cancelTimer() { | |
| 2683 | + if (timerId !== undefined) { | |
| 2684 | + clearTimeout(timerId); | |
| 2685 | + } | |
| 2686 | + } | |
| 2687 | + | |
| 2688 | + function leadingEdge(time) { | |
| 2689 | + // Reset any `maxWait` timer. | |
| 2690 | + lastInvokeTime = time; // Start the timer for the trailing edge. | |
| 2691 | + | |
| 2692 | + startTimer(timerExpired, wait); // Invoke the leading edge. | |
| 2693 | + | |
| 2694 | + return leading ? invokeFunc(time) : result; | |
| 2695 | + } | |
| 2696 | + | |
| 2697 | + function getTimeSinceLastCall(time) { | |
| 2698 | + return time - (lastCallTime || 0); | |
| 2699 | + } | |
| 2700 | + | |
| 2701 | + function remainingWait(time) { | |
| 2702 | + const timeSinceLastCall = getTimeSinceLastCall(time); | |
| 2703 | + const timeSinceLastInvoke = time - lastInvokeTime; | |
| 2704 | + const timeWaiting = wait - timeSinceLastCall; | |
| 2705 | + return maxing ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; | |
| 2706 | + } | |
| 2707 | + | |
| 2708 | + function shouldInvoke(time) { | |
| 2709 | + const timeSinceLastCall = getTimeSinceLastCall(time); | |
| 2710 | + const timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the | |
| 2711 | + // trailing edge, the system time has gone backwards and we're treating | |
| 2712 | + // it as the trailing edge, or we've hit the `maxWait` limit. | |
| 2713 | + | |
| 2714 | + return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; | |
| 2715 | + } | |
| 2716 | + | |
| 2717 | + function timerExpired() { | |
| 2718 | + const time = Date.now(); | |
| 2719 | + | |
| 2720 | + if (shouldInvoke(time)) { | |
| 2721 | + return trailingEdge(time); | |
| 2722 | + } // Restart the timer. | |
| 2723 | + | |
| 2724 | + | |
| 2725 | + startTimer(timerExpired, remainingWait(time)); | |
| 2726 | + return undefined; | |
| 2727 | + } | |
| 2728 | + | |
| 2729 | + function clearTimer() { | |
| 2730 | + timerId = undefined; | |
| 2731 | + } | |
| 2732 | + | |
| 2733 | + function trailingEdge(time) { | |
| 2734 | + clearTimer(); // Only invoke if we have `lastArgs` which means `func` has been | |
| 2735 | + // debounced at least once. | |
| 2736 | + | |
| 2737 | + if (trailing && lastArgs) { | |
| 2738 | + return invokeFunc(time); | |
| 2739 | + } | |
| 2740 | + | |
| 2741 | + lastArgs = lastThis = undefined; | |
| 2742 | + return result; | |
| 2743 | + } | |
| 2744 | + | |
| 2745 | + function cancel() { | |
| 2746 | + cancelTimer(); | |
| 2747 | + lastInvokeTime = 0; | |
| 2748 | + clearTimer(); | |
| 2749 | + lastArgs = lastCallTime = lastThis = undefined; | |
| 2750 | + } | |
| 2751 | + | |
| 2752 | + function flush() { | |
| 2753 | + return pending() ? trailingEdge(Date.now()) : result; | |
| 2754 | + } | |
| 2755 | + | |
| 2756 | + function pending() { | |
| 2757 | + return timerId !== undefined; | |
| 2758 | + } | |
| 2759 | + | |
| 2760 | + function debounced() { | |
| 2761 | + const time = Date.now(); | |
| 2762 | + const isInvoking = shouldInvoke(time); | |
| 2763 | + | |
| 2764 | + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | |
| 2765 | + args[_key] = arguments[_key]; | |
| 2766 | + } | |
| 2767 | + | |
| 2768 | + lastArgs = args; | |
| 2769 | + lastThis = this; | |
| 2770 | + lastCallTime = time; | |
| 2771 | + | |
| 2772 | + if (isInvoking) { | |
| 2773 | + if (!pending()) { | |
| 2774 | + return leadingEdge(lastCallTime); | |
| 2775 | + } | |
| 2776 | + | |
| 2777 | + if (maxing) { | |
| 2778 | + // Handle invocations in a tight loop. | |
| 2779 | + startTimer(timerExpired, wait); | |
| 2780 | + return invokeFunc(lastCallTime); | |
| 2781 | + } | |
| 2782 | + } | |
| 2783 | + | |
| 2784 | + if (!pending()) { | |
| 2785 | + startTimer(timerExpired, wait); | |
| 2786 | + } | |
| 2787 | + | |
| 2788 | + return result; | |
| 2789 | + } | |
| 2790 | + | |
| 2791 | + debounced.cancel = cancel; | |
| 2792 | + debounced.flush = flush; | |
| 2793 | + debounced.pending = pending; | |
| 2794 | + return debounced; | |
| 2795 | +}; | |
| 2796 | + | |
| 2797 | +;// CONCATENATED MODULE: ./packages/compose/build-module/utils/throttle/index.js | |
| 2798 | +/** | |
| 2799 | + * Parts of this source were derived and modified from lodash, | |
| 2800 | + * released under the MIT license. | |
| 2801 | + * | |
| 2802 | + * https://github.com/lodash/lodash | |
| 2803 | + * | |
| 2804 | + * Copyright JS Foundation and other contributors <https://js.foundation/> | |
| 2805 | + * | |
| 2806 | + * Based on Underscore.js, copyright Jeremy Ashkenas, | |
| 2807 | + * DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> | |
| 2808 | + * | |
| 2809 | + * This software consists of voluntary contributions made by many | |
| 2810 | + * individuals. For exact contribution history, see the revision history | |
| 2811 | + * available at https://github.com/lodash/lodash | |
| 2812 | + * | |
| 2813 | + * The following license applies to all parts of this software except as | |
| 2814 | + * documented below: | |
| 2815 | + * | |
| 2816 | + * ==== | |
| 2817 | + * | |
| 2818 | + * Permission is hereby granted, free of charge, to any person obtaining | |
| 2819 | + * a copy of this software and associated documentation files (the | |
| 2820 | + * "Software"), to deal in the Software without restriction, including | |
| 2821 | + * without limitation the rights to use, copy, modify, merge, publish, | |
| 2822 | + * distribute, sublicense, and/or sell copies of the Software, and to | |
| 2823 | + * permit persons to whom the Software is furnished to do so, subject to | |
| 2824 | + * the following conditions: | |
| 2825 | + * | |
| 2826 | + * The above copyright notice and this permission notice shall be | |
| 2827 | + * included in all copies or substantial portions of the Software. | |
| 2828 | + * | |
| 2829 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
| 2830 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
| 2831 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
| 2832 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
| 2833 | + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
| 2834 | + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
| 2835 | + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 2836 | + */ | |
| 2837 | + | |
| 2838 | +/** | |
| 2839 | + * Internal dependencies | |
| 2840 | + */ | |
| 2841 | + | |
| 2842 | + | |
| 2843 | +/** | |
| 2844 | + * A simplified and properly typed version of lodash's `throttle`, that | |
| 2845 | + * always uses timers instead of sometimes using rAF. | |
| 2846 | + * | |
| 2847 | + * Creates a throttled function that only invokes `func` at most once per | |
| 2848 | + * every `wait` milliseconds. The throttled function comes with a `cancel` | |
| 2849 | + * method to cancel delayed `func` invocations and a `flush` method to | |
| 2850 | + * immediately invoke them. Provide `options` to indicate whether `func` | |
| 2851 | + * should be invoked on the leading and/or trailing edge of the `wait` | |
| 2852 | + * timeout. The `func` is invoked with the last arguments provided to the | |
| 2853 | + * throttled function. Subsequent calls to the throttled function return | |
| 2854 | + * the result of the last `func` invocation. | |
| 2855 | + * | |
| 2856 | + * **Note:** If `leading` and `trailing` options are `true`, `func` is | |
| 2857 | + * invoked on the trailing edge of the timeout only if the throttled function | |
| 2858 | + * is invoked more than once during the `wait` timeout. | |
| 2859 | + * | |
| 2860 | + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred | |
| 2861 | + * until the next tick, similar to `setTimeout` with a timeout of `0`. | |
| 2862 | + * | |
| 2863 | + * @param {Function} func The function to throttle. | |
| 2864 | + * @param {number} wait The number of milliseconds to throttle invocations to. | |
| 2865 | + * @param {Partial< ThrottleOptions >} options The options object. | |
| 2866 | + * @param {boolean} options.leading Specify invoking on the leading edge of the timeout. | |
| 2867 | + * @param {boolean} options.trailing Specify invoking on the trailing edge of the timeout. | |
| 2868 | + * @return Returns the new throttled function. | |
| 2869 | + */ | |
| 2870 | +const throttle = (func, wait, options) => { | |
| 2871 | + let leading = true; | |
| 2872 | + let trailing = true; | |
| 2873 | + | |
| 2874 | + if (options) { | |
| 2875 | + leading = 'leading' in options ? !!options.leading : leading; | |
| 2876 | + trailing = 'trailing' in options ? !!options.trailing : trailing; | |
| 2877 | + } | |
| 2878 | + | |
| 2879 | + return debounce(func, wait, { | |
| 2880 | + leading, | |
| 2881 | + trailing, | |
| 2882 | + maxWait: wait | |
| 2883 | + }); | |
| 2884 | +}; | |
| 2885 | + | |
| 2886 | +;// CONCATENATED MODULE: ./packages/compose/build-module/higher-order/pipe.js | |
| 2887 | +/** | |
| 2888 | + * Parts of this source were derived and modified from lodash, | |
| 2889 | + * released under the MIT license. | |
| 2890 | + * | |
| 2891 | + * https://github.com/lodash/lodash | |
| 2892 | + * | |
| 2893 | + * Copyright JS Foundation and other contributors <https://js.foundation/> | |
| 2894 | + * | |
| 2895 | + * Based on Underscore.js, copyright Jeremy Ashkenas, | |
| 2896 | + * DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> | |
| 2897 | + * | |
| 2898 | + * This software consists of voluntary contributions made by many | |
| 2899 | + * individuals. For exact contribution history, see the revision history | |
| 2900 | + * available at https://github.com/lodash/lodash | |
| 2901 | + * | |
| 2902 | + * The following license applies to all parts of this software except as | |
| 2903 | + * documented below: | |
| 2904 | + * | |
| 2905 | + * ==== | |
| 2906 | + * | |
| 2907 | + * Permission is hereby granted, free of charge, to any person obtaining | |
| 2908 | + * a copy of this software and associated documentation files (the | |
| 2909 | + * "Software"), to deal in the Software without restriction, including | |
| 2910 | + * without limitation the rights to use, copy, modify, merge, publish, | |
| 2911 | + * distribute, sublicense, and/or sell copies of the Software, and to | |
| 2912 | + * permit persons to whom the Software is furnished to do so, subject to | |
| 2913 | + * the following conditions: | |
| 2914 | + * | |
| 2915 | + * The above copyright notice and this permission notice shall be | |
| 2916 | + * included in all copies or substantial portions of the Software. | |
| 2917 | + * | |
| 2918 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
| 2919 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
| 2920 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
| 2921 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
| 2922 | + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
| 2923 | + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
| 2924 | + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 2925 | + */ | |
| 2926 | + | |
| 2927 | +/** | |
| 2928 | + * Creates a pipe function. | |
| 2929 | + * | |
| 2930 | + * Allows to choose whether to perform left-to-right or right-to-left composition. | |
| 2931 | + * | |
| 2932 | + * @see https://docs-lodash.com/v4/flow/ | |
| 2933 | + * | |
| 2934 | + * @param {boolean} reverse True if right-to-left, false for left-to-right composition. | |
| 2935 | + */ | |
| 2936 | +const basePipe = function () { | |
| 2937 | + let reverse = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; | |
| 2938 | + return function () { | |
| 2939 | + for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) { | |
| 2940 | + funcs[_key] = arguments[_key]; | |
| 2941 | + } | |
| 2942 | + | |
| 2943 | + return function () { | |
| 2944 | + const functions = funcs.flat(); | |
| 2945 | + | |
| 2946 | + if (reverse) { | |
| 2947 | + functions.reverse(); | |
| 2948 | + } | |
| 2949 | + | |
| 2950 | + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | |
| 2951 | + args[_key2] = arguments[_key2]; | |
| 2952 | + } | |
| 2953 | + | |
| 2954 | + return functions.reduce((prev, func) => [func(...prev)], args)[0]; | |
| 2955 | + }; | |
| 2956 | + }; | |
| 2957 | +}; | |
| 2958 | +/** | |
| 2959 | + * Composes multiple higher-order components into a single higher-order component. Performs left-to-right function | |
| 2960 | + * composition, where each successive invocation is supplied the return value of the previous. | |
| 2961 | + * | |
| 2962 | + * This is inspired by `lodash`'s `flow` function. | |
| 2963 | + * | |
| 2964 | + * @see https://docs-lodash.com/v4/flow/ | |
| 2965 | + */ | |
| 2966 | + | |
| 2967 | + | |
| 2968 | +const pipe = basePipe(); | |
| 2969 | + | |
| 2970 | +/* harmony default export */ const higher_order_pipe = (pipe); | |
| 2971 | + | |
| 2236 | 2972 | ;// CONCATENATED MODULE: ./packages/compose/build-module/higher-order/compose.js |
| 2237 | 2973 | /** |
| 2238 | - * External dependencies | |
| 2974 | + * Internal dependencies | |
| 2239 | 2975 | */ |
| 2240 | 2976 | |
| 2241 | 2977 | /** |
| 2242 | 2978 | * Composes multiple higher-order components into a single higher-order component. Performs right-to-left function |
| @@ -2241,21 +2977,26 @@ | ||
| 2241 | 2977 | /** |
| 2242 | 2978 | * Composes multiple higher-order components into a single higher-order component. Performs right-to-left function |
| 2243 | 2979 | * composition, where each successive invocation is supplied the return value of the previous. |
| 2244 | 2980 | * |
| 2245 | - * This is just a re-export of `lodash`'s `flowRight` function. | |
| 2981 | + * This is inspired by `lodash`'s `flowRight` function. | |
| 2246 | 2982 | * |
| 2247 | 2983 | * @see https://docs-lodash.com/v4/flow-right/ |
| 2248 | 2984 | */ |
| 2249 | 2985 | |
| 2250 | -/* harmony default export */ var compose = (external_lodash_namespaceObject.flowRight); | |
| 2251 | -//# sourceMappingURL=compose.js.map | |
| 2986 | +const compose = basePipe(true); | |
| 2987 | +/* harmony default export */ const higher_order_compose = (compose); | |
| 2988 | + | |
| 2252 | 2989 | ;// CONCATENATED MODULE: external ["wp","element"] |
| 2253 | -var external_wp_element_namespaceObject = window["wp"]["element"]; | |
| 2990 | +const external_wp_element_namespaceObject = window["wp"]["element"]; | |
| 2254 | 2991 | ;// CONCATENATED MODULE: ./packages/compose/build-module/higher-order/if-condition/index.js |
| 2255 | 2992 | |
| 2256 | 2993 | |
| 2257 | 2994 | /** |
| 2995 | + * External dependencies | |
| 2996 | + */ | |
| 2997 | + | |
| 2998 | +/** | |
| 2258 | 2999 | * Internal dependencies |
| 2259 | 3000 | */ |
| 2260 | 3001 | |
| 2261 | 3002 | /** |
| @@ -2275,25 +3016,31 @@ | ||
| 2275 | 3016 | * |
| 2276 | 3017 | * @return Higher-order component. |
| 2277 | 3018 | */ |
| 2278 | 3019 | |
| 2279 | -const ifCondition = predicate => create_higher_order_component(WrappedComponent => props => { | |
| 2280 | - if (!predicate(props)) { | |
| 2281 | - return null; | |
| 2282 | - } | |
| 3020 | +function ifCondition(predicate) { | |
| 3021 | + return createHigherOrderComponent(WrappedComponent => props => { | |
| 3022 | + if (!predicate(props)) { | |
| 3023 | + return null; | |
| 3024 | + } | |
| 2283 | 3025 | |
| 2284 | - return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, props); | |
| 2285 | -}, 'ifCondition'); | |
| 3026 | + return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, props); | |
| 3027 | + }, 'ifCondition'); | |
| 3028 | +} | |
| 2286 | 3029 | |
| 2287 | -/* harmony default export */ var if_condition = (ifCondition); | |
| 2288 | -//# sourceMappingURL=index.js.map | |
| 3030 | +/* harmony default export */ const if_condition = (ifCondition); | |
| 3031 | + | |
| 2289 | 3032 | ;// CONCATENATED MODULE: external ["wp","isShallowEqual"] |
| 2290 | -var external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; | |
| 3033 | +const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; | |
| 2291 | 3034 | var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); |
| 2292 | 3035 | ;// CONCATENATED MODULE: ./packages/compose/build-module/higher-order/pure/index.js |
| 2293 | 3036 | |
| 2294 | 3037 | |
| 2295 | 3038 | /** |
| 3039 | + * External dependencies | |
| 3040 | + */ | |
| 3041 | + | |
| 3042 | +/** | |
| 2296 | 3043 | * WordPress dependencies |
| 2297 | 3044 | */ |
| 2298 | 3045 | |
| 2299 | 3046 | |
| @@ -2302,18 +3049,15 @@ | ||
| 2302 | 3049 | */ |
| 2303 | 3050 | |
| 2304 | 3051 | |
| 2305 | 3052 | /** |
| 2306 | - * External dependencies | |
| 2307 | - */ | |
| 2308 | - | |
| 2309 | -/** | |
| 2310 | 3053 | * Given a component returns the enhanced component augmented with a component |
| 2311 | 3054 | * only re-rendering when its props/state change |
| 2312 | 3055 | */ |
| 2313 | -const pure = create_higher_order_component(Wrapped => { | |
| 2314 | - if (Wrapped.prototype instanceof external_wp_element_namespaceObject.Component) { | |
| 2315 | - return class extends Wrapped { | |
| 3056 | + | |
| 3057 | +const pure = createHigherOrderComponent(function (WrappedComponent) { | |
| 3058 | + if (WrappedComponent.prototype instanceof external_wp_element_namespaceObject.Component) { | |
| 3059 | + return class extends WrappedComponent { | |
| 2316 | 3060 | shouldComponentUpdate(nextProps, nextState) { |
| 2317 | 3061 | return !external_wp_isShallowEqual_default()(nextProps, this.props) || !external_wp_isShallowEqual_default()(nextState, this.state); |
| 2318 | 3062 | } |
| 2319 | 3063 | |
| @@ -2325,15 +3069,15 @@ | ||
| 2325 | 3069 | return !external_wp_isShallowEqual_default()(nextProps, this.props); |
| 2326 | 3070 | } |
| 2327 | 3071 | |
| 2328 | 3072 | render() { |
| 2329 | - return (0,external_wp_element_namespaceObject.createElement)(Wrapped, this.props); | |
| 3073 | + return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, this.props); | |
| 2330 | 3074 | } |
| 2331 | 3075 | |
| 2332 | 3076 | }; |
| 2333 | 3077 | }, 'pure'); |
| 2334 | -/* harmony default export */ var higher_order_pure = (pure); | |
| 2335 | -//# sourceMappingURL=index.js.map | |
| 3078 | +/* harmony default export */ const higher_order_pure = (pure); | |
| 3079 | + | |
| 2336 | 3080 | ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
| 2337 | 3081 | function _extends() { |
| 2338 | 3082 | _extends = Object.assign || function (target) { |
| 2339 | 3083 | for (var i = 1; i < arguments.length; i++) { |
| @@ -2351,21 +3095,16 @@ | ||
| 2351 | 3095 | |
| 2352 | 3096 | return _extends.apply(this, arguments); |
| 2353 | 3097 | } |
| 2354 | 3098 | ;// CONCATENATED MODULE: external ["wp","deprecated"] |
| 2355 | -var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; | |
| 3099 | +const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; | |
| 2356 | 3100 | var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); |
| 2357 | 3101 | ;// CONCATENATED MODULE: ./packages/compose/build-module/higher-order/with-global-events/listener.js |
| 2358 | 3102 | /** |
| 2359 | - * External dependencies | |
| 2360 | - */ | |
| 2361 | - | |
| 2362 | -/** | |
| 2363 | 3103 | * Class responsible for orchestrating event handling on the global window, |
| 2364 | 3104 | * binding a single event to be shared across all handling instances, and |
| 2365 | 3105 | * removing the handler when no instances are listening for the event. |
| 2366 | 3106 | */ |
| 2367 | - | |
| 2368 | 3107 | class Listener { |
| 2369 | 3108 | constructor() { |
| 2370 | 3109 | /** @type {any} */ |
| 2371 | 3110 | this.listeners = {}; |
| @@ -2390,10 +3129,16 @@ | ||
| 2390 | 3129 | /** @type {any} */ |
| 2391 | 3130 | eventType, |
| 2392 | 3131 | /** @type {any} */ |
| 2393 | 3132 | instance) { |
| 2394 | - this.listeners[eventType] = (0,external_lodash_namespaceObject.without)(this.listeners[eventType], instance); | |
| 3133 | + if (!this.listeners[eventType]) { | |
| 3134 | + return; | |
| 3135 | + } | |
| 2395 | 3136 | |
| 3137 | + this.listeners[eventType] = this.listeners[eventType].filter(( | |
| 3138 | + /** @type {any} */ | |
| 3139 | + listener) => listener !== instance); | |
| 3140 | + | |
| 2396 | 3141 | if (!this.listeners[eventType].length) { |
| 2397 | 3142 | // Removing last listener for this type, so unbind event. |
| 2398 | 3143 | window.removeEventListener(eventType, this.handleEvent); |
| 2399 | 3144 | delete this.listeners[eventType]; |
| @@ -2402,9 +3147,13 @@ | ||
| 2402 | 3147 | |
| 2403 | 3148 | handleEvent( |
| 2404 | 3149 | /** @type {any} */ |
| 2405 | 3150 | event) { |
| 2406 | - (0,external_lodash_namespaceObject.forEach)(this.listeners[event.type], instance => { | |
| 3151 | + var _this$listeners$event; | |
| 3152 | + | |
| 3153 | + (_this$listeners$event = this.listeners[event.type]) === null || _this$listeners$event === void 0 ? void 0 : _this$listeners$event.forEach(( | |
| 3154 | + /** @type {any} */ | |
| 3155 | + instance) => { | |
| 2407 | 3156 | instance.handleEvent(event); |
| 2408 | 3157 | }); |
| 2409 | 3158 | } |
| 2410 | 3159 | |
| @@ -2409,24 +3158,19 @@ | ||
| 2409 | 3158 | } |
| 2410 | 3159 | |
| 2411 | 3160 | } |
| 2412 | 3161 | |
| 2413 | -/* harmony default export */ var listener = (Listener); | |
| 2414 | -//# sourceMappingURL=listener.js.map | |
| 3162 | +/* harmony default export */ const listener = (Listener); | |
| 3163 | + | |
| 2415 | 3164 | ;// CONCATENATED MODULE: ./packages/compose/build-module/higher-order/with-global-events/index.js |
| 2416 | 3165 | |
| 2417 | 3166 | |
| 2418 | 3167 | |
| 2419 | 3168 | /** |
| 2420 | - * External dependencies | |
| 2421 | - */ | |
| 2422 | - | |
| 2423 | -/** | |
| 2424 | 3169 | * WordPress dependencies |
| 2425 | 3170 | */ |
| 2426 | 3171 | |
| 2427 | 3172 | |
| 2428 | - | |
| 2429 | 3173 | /** |
| 2430 | 3174 | * Internal dependencies |
| 2431 | 3175 | */ |
| 2432 | 3176 | |
| @@ -2464,9 +3208,9 @@ | ||
| 2464 | 3208 | since: '5.7', |
| 2465 | 3209 | alternative: 'useEffect' |
| 2466 | 3210 | }); // @ts-ignore We don't need to fix the type-related issues because this is deprecated. |
| 2467 | 3211 | |
| 2468 | - return create_higher_order_component(WrappedComponent => { | |
| 3212 | + return createHigherOrderComponent(WrappedComponent => { | |
| 2469 | 3213 | class Wrapper extends external_wp_element_namespaceObject.Component { |
| 2470 | 3214 | constructor( |
| 2471 | 3215 | /** @type {any} */ |
| 2472 | 3216 | props) { |
| @@ -2475,15 +3219,15 @@ | ||
| 2475 | 3219 | this.handleRef = this.handleRef.bind(this); |
| 2476 | 3220 | } |
| 2477 | 3221 | |
| 2478 | 3222 | componentDidMount() { |
| 2479 | - (0,external_lodash_namespaceObject.forEach)(eventTypesToHandlers, (_, eventType) => { | |
| 3223 | + Object.keys(eventTypesToHandlers).forEach(eventType => { | |
| 2480 | 3224 | with_global_events_listener.add(eventType, this); |
| 2481 | 3225 | }); |
| 2482 | 3226 | } |
| 2483 | 3227 | |
| 2484 | 3228 | componentWillUnmount() { |
| 2485 | - (0,external_lodash_namespaceObject.forEach)(eventTypesToHandlers, (_, eventType) => { | |
| 3229 | + Object.keys(eventTypesToHandlers).forEach(eventType => { | |
| 2486 | 3230 | with_global_events_listener.remove(eventType, this); |
| 2487 | 3231 | }); |
| 2488 | 3232 | } |
| 2489 | 3233 | |
| @@ -2528,29 +3272,20 @@ | ||
| 2528 | 3272 | }); |
| 2529 | 3273 | }); |
| 2530 | 3274 | }, 'withGlobalEvents'); |
| 2531 | 3275 | } |
| 2532 | -//# sourceMappingURL=index.js.map | |
| 3276 | + | |
| 2533 | 3277 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-instance-id/index.js |
| 2534 | -// Disable reason: Object and object are distinctly different types in TypeScript and we mean the lowercase object in thise case | |
| 2535 | -// but eslint wants to force us to use `Object`. See https://stackoverflow.com/questions/49464634/difference-between-object-and-object-in-typescript | |
| 2536 | - | |
| 2537 | -/* eslint-disable jsdoc/check-types */ | |
| 2538 | - | |
| 2539 | 3278 | /** |
| 2540 | 3279 | * WordPress dependencies |
| 2541 | 3280 | */ |
| 2542 | 3281 | |
| 2543 | -/** | |
| 2544 | - * @type {WeakMap<object, number>} | |
| 2545 | - */ | |
| 2546 | - | |
| 2547 | 3282 | const instanceMap = new WeakMap(); |
| 2548 | 3283 | /** |
| 2549 | 3284 | * Creates a new id for a given object. |
| 2550 | 3285 | * |
| 2551 | - * @param {object} object Object reference to create an id for. | |
| 2552 | - * @return {number} The instance id (index). | |
| 3286 | + * @param object Object reference to create an id for. | |
| 3287 | + * @return The instance id (index). | |
| 2553 | 3288 | */ |
| 2554 | 3289 | |
| 2555 | 3290 | function createId(object) { |
| 2556 | 3291 | const instances = instanceMap.get(object) || 0; |
| @@ -2557,19 +3292,28 @@ | ||
| 2557 | 3292 | instanceMap.set(object, instances + 1); |
| 2558 | 3293 | return instances; |
| 2559 | 3294 | } |
| 2560 | 3295 | /** |
| 2561 | - * Provides a unique instance ID. | |
| 3296 | + * Specify the useInstanceId *function* signatures. | |
| 2562 | 3297 | * |
| 2563 | - * @param {object} object Object reference to create an id for. | |
| 2564 | - * @param {string} [prefix] Prefix for the unique id. | |
| 2565 | - * @param {string | number} [preferredId=''] Default ID to use. | |
| 2566 | - * @return {string | number} The unique instance id. | |
| 3298 | + * More accurately, useInstanceId distinguishes between three different | |
| 3299 | + * signatures: | |
| 3300 | + * | |
| 3301 | + * 1. When only object is given, the returned value is a number | |
| 3302 | + * 2. When object and prefix is given, the returned value is a string | |
| 3303 | + * 3. When preferredId is given, the returned value is the type of preferredId | |
| 2567 | 3304 | */ |
| 2568 | 3305 | |
| 2569 | 3306 | |
| 2570 | -function useInstanceId(object, prefix) { | |
| 2571 | - let preferredId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | |
| 3307 | +/** | |
| 3308 | + * Provides a unique instance ID. | |
| 3309 | + * | |
| 3310 | + * @param object Object reference to create an id for. | |
| 3311 | + * @param [prefix] Prefix for the unique id. | |
| 3312 | + * @param [preferredId] Default ID to use. | |
| 3313 | + * @return The unique instance id. | |
| 3314 | + */ | |
| 3315 | +function useInstanceId(object, prefix, preferredId) { | |
| 2572 | 3316 | return (0,external_wp_element_namespaceObject.useMemo)(() => { |
| 2573 | 3317 | if (preferredId) return preferredId; |
| 2574 | 3318 | const id = createId(object); |
| 2575 | 3319 | return prefix ? `${prefix}-${id}` : id; |
| @@ -2574,10 +3318,11 @@ | ||
| 2574 | 3318 | const id = createId(object); |
| 2575 | 3319 | return prefix ? `${prefix}-${id}` : id; |
| 2576 | 3320 | }, [object]); |
| 2577 | 3321 | } |
| 2578 | -/* eslint-enable jsdoc/check-types */ | |
| 2579 | -//# sourceMappingURL=index.js.map | |
| 3322 | + | |
| 3323 | +/* harmony default export */ const use_instance_id = (useInstanceId); | |
| 3324 | + | |
| 2580 | 3325 | ;// CONCATENATED MODULE: ./packages/compose/build-module/higher-order/with-instance-id/index.js |
| 2581 | 3326 | |
| 2582 | 3327 | |
| 2583 | 3328 | |
| @@ -2585,32 +3330,28 @@ | ||
| 2585 | 3330 | * Internal dependencies |
| 2586 | 3331 | */ |
| 2587 | 3332 | |
| 2588 | 3333 | |
| 3334 | + | |
| 2589 | 3335 | /** |
| 2590 | 3336 | * A Higher Order Component used to be provide a unique instance ID by |
| 2591 | 3337 | * component. |
| 2592 | 3338 | */ |
| 2593 | - | |
| 2594 | -const withInstanceId = create_higher_order_component(WrappedComponent => { | |
| 3339 | +const withInstanceId = createHigherOrderComponent(WrappedComponent => { | |
| 2595 | 3340 | return props => { |
| 2596 | - const instanceId = useInstanceId(WrappedComponent); // @ts-ignore | |
| 3341 | + const instanceId = use_instance_id(WrappedComponent); // @ts-ignore | |
| 2597 | 3342 | |
| 2598 | 3343 | return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({}, props, { |
| 2599 | 3344 | instanceId: instanceId |
| 2600 | 3345 | })); |
| 2601 | 3346 | }; |
| 2602 | -}, 'withInstanceId'); | |
| 2603 | -/* harmony default export */ var with_instance_id = (withInstanceId); | |
| 2604 | -//# sourceMappingURL=index.js.map | |
| 3347 | +}, 'instanceId'); | |
| 3348 | +/* harmony default export */ const with_instance_id = (withInstanceId); | |
| 3349 | + | |
| 2605 | 3350 | ;// CONCATENATED MODULE: ./packages/compose/build-module/higher-order/with-safe-timeout/index.js |
| 2606 | 3351 | |
| 2607 | 3352 | |
| 2608 | -/** | |
| 2609 | - * External dependencies | |
| 2610 | - */ | |
| 2611 | 3353 | |
| 2612 | - | |
| 2613 | 3354 | /** |
| 2614 | 3355 | * WordPress dependencies |
| 2615 | 3356 | */ |
| 2616 | 3357 | |
| @@ -2631,9 +3372,9 @@ | ||
| 2631 | 3372 | /** |
| 2632 | 3373 | * A higher-order component used to provide and manage delayed function calls |
| 2633 | 3374 | * that ought to be bound to a component's lifecycle. |
| 2634 | 3375 | */ |
| 2635 | -const withSafeTimeout = create_higher_order_component(OriginalComponent => { | |
| 3376 | +const withSafeTimeout = createHigherOrderComponent(OriginalComponent => { | |
| 2636 | 3377 | return class WrappedComponent extends external_wp_element_namespaceObject.Component { |
| 2637 | 3378 | constructor(props) { |
| 2638 | 3379 | super(props); |
| 2639 | 3380 | this.timeouts = []; |
| @@ -2655,23 +3396,24 @@ | ||
| 2655 | 3396 | } |
| 2656 | 3397 | |
| 2657 | 3398 | clearTimeout(id) { |
| 2658 | 3399 | clearTimeout(id); |
| 2659 | - this.timeouts = (0,external_lodash_namespaceObject.without)(this.timeouts, id); | |
| 3400 | + this.timeouts.filter(timeoutId => timeoutId !== id); | |
| 2660 | 3401 | } |
| 2661 | 3402 | |
| 2662 | 3403 | render() { |
| 2663 | - const props = { ...this.props, | |
| 2664 | - setTimeout: this.setTimeout, | |
| 2665 | - clearTimeout: this.clearTimeout | |
| 2666 | - }; | |
| 2667 | - return (0,external_wp_element_namespaceObject.createElement)(OriginalComponent, props); | |
| 3404 | + return (// @ts-ignore | |
| 3405 | + (0,external_wp_element_namespaceObject.createElement)(OriginalComponent, _extends({}, this.props, { | |
| 3406 | + setTimeout: this.setTimeout, | |
| 3407 | + clearTimeout: this.clearTimeout | |
| 3408 | + })) | |
| 3409 | + ); | |
| 2668 | 3410 | } |
| 2669 | 3411 | |
| 2670 | 3412 | }; |
| 2671 | 3413 | }, 'withSafeTimeout'); |
| 2672 | -/* harmony default export */ var with_safe_timeout = (withSafeTimeout); | |
| 2673 | -//# sourceMappingURL=index.js.map | |
| 3414 | +/* harmony default export */ const with_safe_timeout = (withSafeTimeout); | |
| 3415 | + | |
| 2674 | 3416 | ;// CONCATENATED MODULE: ./packages/compose/build-module/higher-order/with-state/index.js |
| 2675 | 3417 | |
| 2676 | 3418 | |
| 2677 | 3419 | |
| @@ -2701,9 +3443,9 @@ | ||
| 2701 | 3443 | external_wp_deprecated_default()('wp.compose.withState', { |
| 2702 | 3444 | since: '5.8', |
| 2703 | 3445 | alternative: 'wp.element.useState' |
| 2704 | 3446 | }); |
| 2705 | - return create_higher_order_component(OriginalComponent => { | |
| 3447 | + return createHigherOrderComponent(OriginalComponent => { | |
| 2706 | 3448 | return class WrappedComponent extends external_wp_element_namespaceObject.Component { |
| 2707 | 3449 | constructor( |
| 2708 | 3450 | /** @type {any} */ |
| 2709 | 3451 | props) { |
| @@ -2720,13 +3462,13 @@ | ||
| 2720 | 3462 | |
| 2721 | 3463 | }; |
| 2722 | 3464 | }, 'withState'); |
| 2723 | 3465 | } |
| 2724 | -//# sourceMappingURL=index.js.map | |
| 3466 | + | |
| 2725 | 3467 | ;// CONCATENATED MODULE: external ["wp","keycodes"] |
| 2726 | -var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; | |
| 3468 | +const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; | |
| 2727 | 3469 | ;// CONCATENATED MODULE: external ["wp","dom"] |
| 2728 | -var external_wp_dom_namespaceObject = window["wp"]["dom"]; | |
| 3470 | +const external_wp_dom_namespaceObject = window["wp"]["dom"]; | |
| 2729 | 3471 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-ref-effect/index.js |
| 2730 | 3472 | /** |
| 2731 | 3473 | * External dependencies |
| 2732 | 3474 | */ |
| @@ -2764,9 +3506,9 @@ | ||
| 2764 | 3506 | cleanup.current(); |
| 2765 | 3507 | } |
| 2766 | 3508 | }, dependencies); |
| 2767 | 3509 | } |
| 2768 | -//# sourceMappingURL=index.js.map | |
| 3510 | + | |
| 2769 | 3511 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-constrained-tabbing/index.js |
| 2770 | 3512 | /** |
| 2771 | 3513 | * WordPress dependencies |
| 2772 | 3514 | */ |
| @@ -2850,12 +3592,12 @@ | ||
| 2850 | 3592 | }; |
| 2851 | 3593 | }, []); |
| 2852 | 3594 | } |
| 2853 | 3595 | |
| 2854 | -/* harmony default export */ var use_constrained_tabbing = (useConstrainedTabbing); | |
| 2855 | -//# sourceMappingURL=index.js.map | |
| 3596 | +/* harmony default export */ const use_constrained_tabbing = (useConstrainedTabbing); | |
| 3597 | + | |
| 2856 | 3598 | // EXTERNAL MODULE: ./node_modules/clipboard/dist/clipboard.js |
| 2857 | -var dist_clipboard = __webpack_require__(2152); | |
| 3599 | +var dist_clipboard = __webpack_require__(8294); | |
| 2858 | 3600 | var clipboard_default = /*#__PURE__*/__webpack_require__.n(dist_clipboard); |
| 2859 | 3601 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-copy-on-click/index.js |
| 2860 | 3602 | /** |
| 2861 | 3603 | * External dependencies |
| @@ -2937,9 +3679,9 @@ | ||
| 2937 | 3679 | }; |
| 2938 | 3680 | }, [text, timeout, setHasCopied]); |
| 2939 | 3681 | return hasCopied; |
| 2940 | 3682 | } |
| 2941 | -//# sourceMappingURL=index.js.map | |
| 3683 | + | |
| 2942 | 3684 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-copy-to-clipboard/index.js |
| 2943 | 3685 | /** |
| 2944 | 3686 | * External dependencies |
| 2945 | 3687 | */ |
| @@ -2977,9 +3719,9 @@ | ||
| 2977 | 3719 | */ |
| 2978 | 3720 | |
| 2979 | 3721 | |
| 2980 | 3722 | function useCopyToClipboard(text, onSuccess) { |
| 2981 | - // Store the dependencies as refs and continuesly update them so they're | |
| 3723 | + // Store the dependencies as refs and continuously update them so they're | |
| 2982 | 3724 | // fresh when the callback is called. |
| 2983 | 3725 | const textRef = useUpdatedRef(text); |
| 2984 | 3726 | const onSuccessRef = useUpdatedRef(onSuccess); |
| 2985 | 3727 | return useRefEffect(node => { |
| @@ -3010,9 +3752,9 @@ | ||
| 3010 | 3752 | clipboard.destroy(); |
| 3011 | 3753 | }; |
| 3012 | 3754 | }, []); |
| 3013 | 3755 | } |
| 3014 | -//# sourceMappingURL=index.js.map | |
| 3756 | + | |
| 3015 | 3757 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-focus-on-mount/index.js |
| 3016 | 3758 | /** |
| 3017 | 3759 | * WordPress dependencies |
| 3018 | 3760 | */ |
| @@ -3068,12 +3810,17 @@ | ||
| 3068 | 3810 | firstTabbable; |
| 3069 | 3811 | } |
| 3070 | 3812 | } |
| 3071 | 3813 | |
| 3072 | - target.focus(); | |
| 3814 | + target.focus({ | |
| 3815 | + // When focusing newly mounted dialogs, | |
| 3816 | + // the position of the popover is often not right on the first render | |
| 3817 | + // This prevents the layout shifts when focusing the dialogs. | |
| 3818 | + preventScroll: true | |
| 3819 | + }); | |
| 3073 | 3820 | }, []); |
| 3074 | 3821 | } |
| 3075 | -//# sourceMappingURL=index.js.map | |
| 3822 | + | |
| 3076 | 3823 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-focus-return/index.js |
| 3077 | 3824 | /** |
| 3078 | 3825 | * WordPress dependencies |
| 3079 | 3826 | */ |
| @@ -3147,10 +3894,10 @@ | ||
| 3147 | 3894 | } |
| 3148 | 3895 | }, []); |
| 3149 | 3896 | } |
| 3150 | 3897 | |
| 3151 | -/* harmony default export */ var use_focus_return = (useFocusReturn); | |
| 3152 | -//# sourceMappingURL=index.js.map | |
| 3898 | +/* harmony default export */ const use_focus_return = (useFocusReturn); | |
| 3899 | + | |
| 3153 | 3900 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-focus-outside/index.js |
| 3154 | 3901 | /** |
| 3155 | 3902 | * External dependencies |
| 3156 | 3903 | */ |
| @@ -3158,24 +3905,20 @@ | ||
| 3158 | 3905 | /** |
| 3159 | 3906 | * WordPress dependencies |
| 3160 | 3907 | */ |
| 3161 | 3908 | |
| 3162 | - | |
| 3163 | 3909 | /** |
| 3164 | 3910 | * Input types which are classified as button types, for use in considering |
| 3165 | 3911 | * whether element is a (focus-normalized) button. |
| 3166 | - * | |
| 3167 | - * @type {string[]} | |
| 3168 | 3912 | */ |
| 3169 | 3913 | |
| 3170 | 3914 | const INPUT_BUTTON_TYPES = ['button', 'submit']; |
| 3171 | 3915 | /** |
| 3172 | - * @typedef {HTMLButtonElement | HTMLLinkElement | HTMLInputElement} FocusNormalizedButton | |
| 3916 | + * List of HTML button elements subject to focus normalization | |
| 3917 | + * | |
| 3918 | + * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus | |
| 3173 | 3919 | */ |
| 3174 | -// Disable reason: Rule doesn't support predicate return types | |
| 3175 | 3920 | |
| 3176 | -/* eslint-disable jsdoc/valid-types */ | |
| 3177 | - | |
| 3178 | 3921 | /** |
| 3179 | 3922 | * Returns true if the given element is a button element subject to focus |
| 3180 | 3923 | * normalization, or false otherwise. |
| 3181 | 3924 | * |
| @@ -3180,13 +3923,12 @@ | ||
| 3180 | 3923 | * normalization, or false otherwise. |
| 3181 | 3924 | * |
| 3182 | 3925 | * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus |
| 3183 | 3926 | * |
| 3184 | - * @param {EventTarget} eventTarget The target from a mouse or touch event. | |
| 3927 | + * @param eventTarget The target from a mouse or touch event. | |
| 3185 | 3928 | * |
| 3186 | - * @return {eventTarget is FocusNormalizedButton} Whether element is a button. | |
| 3929 | + * @return Whether the element is a button element subject to focus normalization. | |
| 3187 | 3930 | */ |
| 3188 | - | |
| 3189 | 3931 | function isFocusNormalizedButton(eventTarget) { |
| 3190 | 3932 | if (!(eventTarget instanceof window.HTMLElement)) { |
| 3191 | 3933 | return false; |
| 3192 | 3934 | } |
| @@ -3196,58 +3938,24 @@ | ||
| 3196 | 3938 | case 'BUTTON': |
| 3197 | 3939 | return true; |
| 3198 | 3940 | |
| 3199 | 3941 | case 'INPUT': |
| 3200 | - return (0,external_lodash_namespaceObject.includes)(INPUT_BUTTON_TYPES, | |
| 3201 | - /** @type {HTMLInputElement} */ | |
| 3202 | - eventTarget.type); | |
| 3942 | + return INPUT_BUTTON_TYPES.includes(eventTarget.type); | |
| 3203 | 3943 | } |
| 3204 | 3944 | |
| 3205 | 3945 | return false; |
| 3206 | 3946 | } |
| 3207 | -/* eslint-enable jsdoc/valid-types */ | |
| 3208 | 3947 | |
| 3209 | 3948 | /** |
| 3210 | - * @typedef {import('react').SyntheticEvent} SyntheticEvent | |
| 3211 | - */ | |
| 3212 | - | |
| 3213 | -/** | |
| 3214 | - * @callback EventCallback | |
| 3215 | - * @param {SyntheticEvent} event input related event. | |
| 3216 | - */ | |
| 3217 | - | |
| 3218 | -/** | |
| 3219 | - * @typedef FocusOutsideReactElement | |
| 3220 | - * @property {EventCallback} handleFocusOutside callback for a focus outside event. | |
| 3221 | - */ | |
| 3222 | - | |
| 3223 | -/** | |
| 3224 | - * @typedef {import('react').MutableRefObject<FocusOutsideReactElement | undefined>} FocusOutsideRef | |
| 3225 | - */ | |
| 3226 | - | |
| 3227 | -/** | |
| 3228 | - * @typedef {Object} FocusOutsideReturnValue | |
| 3229 | - * @property {EventCallback} onFocus An event handler for focus events. | |
| 3230 | - * @property {EventCallback} onBlur An event handler for blur events. | |
| 3231 | - * @property {EventCallback} onMouseDown An event handler for mouse down events. | |
| 3232 | - * @property {EventCallback} onMouseUp An event handler for mouse up events. | |
| 3233 | - * @property {EventCallback} onTouchStart An event handler for touch start events. | |
| 3234 | - * @property {EventCallback} onTouchEnd An event handler for touch end events. | |
| 3235 | - */ | |
| 3236 | - | |
| 3237 | -/** | |
| 3238 | 3949 | * A react hook that can be used to check whether focus has moved outside the |
| 3239 | 3950 | * element the event handlers are bound to. |
| 3240 | 3951 | * |
| 3241 | - * @param {EventCallback} onFocusOutside A callback triggered when focus moves outside | |
| 3242 | - * the element the event handlers are bound to. | |
| 3952 | + * @param onFocusOutside A callback triggered when focus moves outside | |
| 3953 | + * the element the event handlers are bound to. | |
| 3243 | 3954 | * |
| 3244 | - * @return {FocusOutsideReturnValue} An object containing event handlers. Bind the event handlers | |
| 3245 | - * to a wrapping element element to capture when focus moves | |
| 3246 | - * outside that element. | |
| 3955 | + * @return An object containing event handlers. Bind the event handlers to a | |
| 3956 | + * wrapping element element to capture when focus moves outside that element. | |
| 3247 | 3957 | */ |
| 3248 | - | |
| 3249 | - | |
| 3250 | 3958 | function useFocusOutside(onFocusOutside) { |
| 3251 | 3959 | const currentOnFocusOutside = (0,external_wp_element_namespaceObject.useRef)(onFocusOutside); |
| 3252 | 3960 | (0,external_wp_element_namespaceObject.useEffect)(() => { |
| 3253 | 3961 | currentOnFocusOutside.current = onFocusOutside; |
| @@ -3252,12 +3960,8 @@ | ||
| 3252 | 3960 | (0,external_wp_element_namespaceObject.useEffect)(() => { |
| 3253 | 3961 | currentOnFocusOutside.current = onFocusOutside; |
| 3254 | 3962 | }, [onFocusOutside]); |
| 3255 | 3963 | const preventBlurCheck = (0,external_wp_element_namespaceObject.useRef)(false); |
| 3256 | - /** | |
| 3257 | - * @type {import('react').MutableRefObject<number | undefined>} | |
| 3258 | - */ | |
| 3259 | - | |
| 3260 | 3964 | const blurCheckTimeoutId = (0,external_wp_element_namespaceObject.useRef)(); |
| 3261 | 3965 | /** |
| 3262 | 3966 | * Cancel a blur check timeout. |
| 3263 | 3967 | */ |
| @@ -3281,11 +3985,10 @@ | ||
| 3281 | 3985 | * browsers, namely Firefox and Safari, do not emit a focus event on |
| 3282 | 3986 | * button elements when clicked, while others do. The logic here |
| 3283 | 3987 | * intends to normalize this as treating click on buttons as focus. |
| 3284 | 3988 | * |
| 3989 | + * @param event | |
| 3285 | 3990 | * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus |
| 3286 | - * | |
| 3287 | - * @param {SyntheticEvent} event Event for mousedown or mouseup. | |
| 3288 | 3991 | */ |
| 3289 | 3992 | |
| 3290 | 3993 | const normalizeButtonFocus = (0,external_wp_element_namespaceObject.useCallback)(event => { |
| 3291 | 3994 | const { |
| @@ -3291,9 +3994,9 @@ | ||
| 3291 | 3994 | const { |
| 3292 | 3995 | type, |
| 3293 | 3996 | target |
| 3294 | 3997 | } = event; |
| 3295 | - const isInteractionEnd = (0,external_lodash_namespaceObject.includes)(['mouseup', 'touchend'], type); | |
| 3998 | + const isInteractionEnd = ['mouseup', 'touchend'].includes(type); | |
| 3296 | 3999 | |
| 3297 | 4000 | if (isInteractionEnd) { |
| 3298 | 4001 | preventBlurCheck.current = false; |
| 3299 | 4002 | } else if (isFocusNormalizedButton(target)) { |
| @@ -3305,10 +4008,8 @@ | ||
| 3305 | 4008 | * is bound to. |
| 3306 | 4009 | * |
| 3307 | 4010 | * Calls the `onFocusOutside` callback in an immediate timeout if focus has |
| 3308 | 4011 | * move outside the bound element and is still within the document. |
| 3309 | - * | |
| 3310 | - * @param {SyntheticEvent} event Blur event. | |
| 3311 | 4012 | */ |
| 3312 | 4013 | |
| 3313 | 4014 | const queueBlurCheck = (0,external_wp_element_namespaceObject.useCallback)(event => { |
| 3314 | 4015 | // React does not allow using an event reference asynchronously |
| @@ -3342,9 +4043,9 @@ | ||
| 3342 | 4043 | onTouchEnd: normalizeButtonFocus, |
| 3343 | 4044 | onBlur: queueBlurCheck |
| 3344 | 4045 | }; |
| 3345 | 4046 | } |
| 3346 | -//# sourceMappingURL=index.js.map | |
| 4047 | + | |
| 3347 | 4048 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-merge-refs/index.js |
| 3348 | 4049 | /** |
| 3349 | 4050 | * WordPress dependencies |
| 3350 | 4051 | */ |
| @@ -3421,8 +4122,9 @@ | ||
| 3421 | 4122 | |
| 3422 | 4123 | |
| 3423 | 4124 | function useMergeRefs(refs) { |
| 3424 | 4125 | const element = (0,external_wp_element_namespaceObject.useRef)(); |
| 4126 | + const isAttached = (0,external_wp_element_namespaceObject.useRef)(false); | |
| 3425 | 4127 | const didElementChange = (0,external_wp_element_namespaceObject.useRef)(false); |
| 3426 | 4128 | /* eslint-disable jsdoc/no-undefined-types */ |
| 3427 | 4129 | |
| 3428 | 4130 | /** @type {import('react').MutableRefObject<TRef[]>} */ |
| @@ -3437,9 +4139,9 @@ | ||
| 3437 | 4139 | // ref with the node, except when the element changes in the same cycle, in |
| 3438 | 4140 | // which case the ref callbacks will already have been called. |
| 3439 | 4141 | |
| 3440 | 4142 | (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { |
| 3441 | - if (didElementChange.current === false) { | |
| 4143 | + if (didElementChange.current === false && isAttached.current === true) { | |
| 3442 | 4144 | refs.forEach((ref, index) => { |
| 3443 | 4145 | const previousRef = previousRefs.current[index]; |
| 3444 | 4146 | |
| 3445 | 4147 | if (ref !== previousRef) { |
| @@ -3461,9 +4163,10 @@ | ||
| 3461 | 4163 | return (0,external_wp_element_namespaceObject.useCallback)(value => { |
| 3462 | 4164 | // Update the element so it can be used when calling ref callbacks on a |
| 3463 | 4165 | // dependency change. |
| 3464 | 4166 | assignRef(element, value); |
| 3465 | - didElementChange.current = true; // When an element changes, the current ref callback should be called | |
| 4167 | + didElementChange.current = true; | |
| 4168 | + isAttached.current = value !== null; // When an element changes, the current ref callback should be called | |
| 3466 | 4169 | // with the new element and the previous one with `null`. |
| 3467 | 4170 | |
| 3468 | 4171 | const refsToAssign = value ? currentRefs.current : previousRefs.current; // Update the latest refs. |
| 3469 | 4172 | |
| @@ -3471,11 +4174,15 @@ | ||
| 3471 | 4174 | assignRef(ref, value); |
| 3472 | 4175 | } |
| 3473 | 4176 | }, []); |
| 3474 | 4177 | } |
| 3475 | -//# sourceMappingURL=index.js.map | |
| 4178 | + | |
| 3476 | 4179 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-dialog/index.js |
| 3477 | 4180 | /** |
| 4181 | + * External dependencies | |
| 4182 | + */ | |
| 4183 | + | |
| 4184 | +/** | |
| 3478 | 4185 | * WordPress dependencies |
| 3479 | 4186 | */ |
| 3480 | 4187 | |
| 3481 | 4188 | |
| @@ -3487,19 +4194,10 @@ | ||
| 3487 | 4194 | |
| 3488 | 4195 | |
| 3489 | 4196 | |
| 3490 | 4197 | |
| 3491 | -/* eslint-disable jsdoc/valid-types */ | |
| 3492 | 4198 | |
| 3493 | 4199 | /** |
| 3494 | - * @typedef DialogOptions | |
| 3495 | - * @property {Parameters<useFocusOnMount>[0]} focusOnMount Focus on mount arguments. | |
| 3496 | - * @property {() => void} onClose Function to call when the dialog is closed. | |
| 3497 | - */ | |
| 3498 | - | |
| 3499 | -/* eslint-enable jsdoc/valid-types */ | |
| 3500 | - | |
| 3501 | -/** | |
| 3502 | 4200 | * Returns a ref and props to apply to a dialog wrapper to enable the following behaviors: |
| 3503 | 4201 | * - constrained tabbing. |
| 3504 | 4202 | * - focus on mount. |
| 3505 | 4203 | * - return focus on unmount. |
| @@ -3504,15 +4202,11 @@ | ||
| 3504 | 4202 | * - focus on mount. |
| 3505 | 4203 | * - return focus on unmount. |
| 3506 | 4204 | * - focus outside. |
| 3507 | 4205 | * |
| 3508 | - * @param {DialogOptions} options Dialog Options. | |
| 4206 | + * @param options Dialog Options. | |
| 3509 | 4207 | */ |
| 3510 | - | |
| 3511 | 4208 | function useDialog(options) { |
| 3512 | - /** | |
| 3513 | - * @type {import('react').MutableRefObject<DialogOptions | undefined>} | |
| 3514 | - */ | |
| 3515 | 4209 | const currentOptions = (0,external_wp_element_namespaceObject.useRef)(); |
| 3516 | 4210 | (0,external_wp_element_namespaceObject.useEffect)(() => { |
| 3517 | 4211 | currentOptions.current = options; |
| 3518 | 4212 | }, Object.values(options)); |
| @@ -3523,11 +4217,9 @@ | ||
| 3523 | 4217 | var _currentOptions$curre, _currentOptions$curre2; |
| 3524 | 4218 | |
| 3525 | 4219 | // This unstable prop is here only to manage backward compatibility |
| 3526 | 4220 | // for the Popover component otherwise, the onClose should be enough. |
| 3527 | - // @ts-ignore unstable property | |
| 3528 | 4221 | if ((_currentOptions$curre = currentOptions.current) !== null && _currentOptions$curre !== void 0 && _currentOptions$curre.__unstableOnClose) { |
| 3529 | - // @ts-ignore unstable property | |
| 3530 | 4222 | currentOptions.current.__unstableOnClose('focus-outside', event); |
| 3531 | 4223 | } else if ((_currentOptions$curre2 = currentOptions.current) !== null && _currentOptions$curre2 !== void 0 && _currentOptions$curre2.onClose) { |
| 3532 | 4224 | currentOptions.current.onClose(); |
| 3533 | 4225 | } |
| @@ -3536,14 +4228,12 @@ | ||
| 3536 | 4228 | if (!node) { |
| 3537 | 4229 | return; |
| 3538 | 4230 | } |
| 3539 | 4231 | |
| 3540 | - node.addEventListener('keydown', ( | |
| 3541 | - /** @type {KeyboardEvent} */ | |
| 3542 | - event) => { | |
| 4232 | + node.addEventListener('keydown', event => { | |
| 3543 | 4233 | var _currentOptions$curre3; |
| 3544 | 4234 | |
| 3545 | - // Close on escape | |
| 4235 | + // Close on escape. | |
| 3546 | 4236 | if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented && (_currentOptions$curre3 = currentOptions.current) !== null && _currentOptions$curre3 !== void 0 && _currentOptions$curre3.onClose) { |
| 3547 | 4237 | event.preventDefault(); |
| 3548 | 4238 | currentOptions.current.onClose(); |
| 3549 | 4239 | } |
| @@ -3549,46 +4239,35 @@ | ||
| 3549 | 4239 | } |
| 3550 | 4240 | }); |
| 3551 | 4241 | }, []); |
| 3552 | 4242 | return [useMergeRefs([options.focusOnMount !== false ? constrainedTabbingRef : null, options.focusOnMount !== false ? focusReturnRef : null, options.focusOnMount !== false ? focusOnMountRef : null, closeOnEscapeRef]), { ...focusOutsideProps, |
| 3553 | - tabIndex: '-1' | |
| 4243 | + tabIndex: -1 | |
| 3554 | 4244 | }]; |
| 3555 | 4245 | } |
| 3556 | 4246 | |
| 3557 | -/* harmony default export */ var use_dialog = (useDialog); | |
| 3558 | -//# sourceMappingURL=index.js.map | |
| 4247 | +/* harmony default export */ const use_dialog = (useDialog); | |
| 4248 | + | |
| 3559 | 4249 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-disabled/index.js |
| 3560 | 4250 | /** |
| 3561 | - * External dependencies | |
| 4251 | + * Internal dependencies | |
| 3562 | 4252 | */ |
| 3563 | 4253 | |
| 3564 | -/** | |
| 3565 | - * WordPress dependencies | |
| 3566 | - */ | |
| 3567 | 4254 | |
| 3568 | - | |
| 3569 | - | |
| 3570 | 4255 | /** |
| 3571 | - * Names of control nodes which qualify for disabled behavior. | |
| 3572 | - * | |
| 3573 | - * See WHATWG HTML Standard: 4.10.18.5: "Enabling and disabling form controls: the disabled attribute". | |
| 3574 | - * | |
| 3575 | - * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#enabling-and-disabling-form-controls:-the-disabled-attribute | |
| 3576 | - * | |
| 3577 | - * @type {string[]} | |
| 3578 | - */ | |
| 3579 | - | |
| 3580 | -const DISABLED_ELIGIBLE_NODE_NAMES = ['BUTTON', 'FIELDSET', 'INPUT', 'OPTGROUP', 'OPTION', 'SELECT', 'TEXTAREA']; | |
| 3581 | -/** | |
| 3582 | 4256 | * In some circumstances, such as block previews, all focusable DOM elements |
| 3583 | 4257 | * (input fields, links, buttons, etc.) need to be disabled. This hook adds the |
| 3584 | 4258 | * behavior to disable nested DOM elements to the returned ref. |
| 3585 | 4259 | * |
| 3586 | - * @return {import('react').RefObject<HTMLElement>} Element Ref. | |
| 4260 | + * If you can, prefer the use of the inert HTML attribute. | |
| 3587 | 4261 | * |
| 4262 | + * @param {Object} config Configuration object. | |
| 4263 | + * @param {boolean=} config.isDisabled Whether the element should be disabled. | |
| 4264 | + * @return {import('react').RefCallback<HTMLElement>} Element Ref. | |
| 4265 | + * | |
| 3588 | 4266 | * @example |
| 3589 | 4267 | * ```js |
| 3590 | - * import { __experimentalUseDisabled as useDisabled } from '@wordpress/compose'; | |
| 4268 | + * import { useDisabled } from '@wordpress/compose'; | |
| 4269 | + * | |
| 3591 | 4270 | * const DisabledExample = () => { |
| 3592 | 4271 | * const disabledRef = useDisabled(); |
| 3593 | 4272 | * return ( |
| 3594 | 4273 | * <div ref={ disabledRef }> |
| @@ -3600,57 +4279,47 @@ | ||
| 3600 | 4279 | * ``` |
| 3601 | 4280 | */ |
| 3602 | 4281 | |
| 3603 | 4282 | function useDisabled() { |
| 3604 | - /** @type {import('react').RefObject<HTMLElement>} */ | |
| 3605 | - const node = (0,external_wp_element_namespaceObject.useRef)(null); | |
| 3606 | - | |
| 3607 | - const disable = () => { | |
| 3608 | - if (!node.current) { | |
| 4283 | + let { | |
| 4284 | + isDisabled: isDisabledProp = false | |
| 4285 | + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 4286 | + return useRefEffect(node => { | |
| 4287 | + if (isDisabledProp) { | |
| 3609 | 4288 | return; |
| 3610 | 4289 | } |
| 4290 | + /** A variable keeping track of the previous updates in order to restore them. */ | |
| 3611 | 4291 | |
| 3612 | - external_wp_dom_namespaceObject.focus.focusable.find(node.current).forEach(focusable => { | |
| 3613 | - if ((0,external_lodash_namespaceObject.includes)(DISABLED_ELIGIBLE_NODE_NAMES, focusable.nodeName)) { | |
| 3614 | - focusable.setAttribute('disabled', ''); | |
| 3615 | - } | |
| 3616 | 4292 | |
| 3617 | - if (focusable.nodeName === 'A') { | |
| 3618 | - focusable.setAttribute('tabindex', '-1'); | |
| 3619 | - } | |
| 4293 | + const updates = []; | |
| 3620 | 4294 | |
| 3621 | - const tabIndex = focusable.getAttribute('tabindex'); | |
| 4295 | + const disable = () => { | |
| 4296 | + node.childNodes.forEach(child => { | |
| 4297 | + if (!(child instanceof HTMLElement)) { | |
| 4298 | + return; | |
| 4299 | + } | |
| 3622 | 4300 | |
| 3623 | - if (tabIndex !== null && tabIndex !== '-1') { | |
| 3624 | - focusable.removeAttribute('tabindex'); | |
| 3625 | - } | |
| 4301 | + if (!child.getAttribute('inert')) { | |
| 4302 | + child.setAttribute('inert', 'true'); | |
| 4303 | + updates.push(() => { | |
| 4304 | + child.removeAttribute('inert'); | |
| 4305 | + }); | |
| 4306 | + } | |
| 4307 | + }); | |
| 4308 | + }; // Debounce re-disable since disabling process itself will incur | |
| 4309 | + // additional mutations which should be ignored. | |
| 3626 | 4310 | |
| 3627 | - if (focusable.hasAttribute('contenteditable')) { | |
| 3628 | - focusable.setAttribute('contenteditable', 'false'); | |
| 3629 | - } | |
| 4311 | + | |
| 4312 | + const debouncedDisable = debounce(disable, 0, { | |
| 4313 | + leading: true | |
| 3630 | 4314 | }); |
| 3631 | - }; // Debounce re-disable since disabling process itself will incur | |
| 3632 | - // additional mutations which should be ignored. | |
| 3633 | - | |
| 3634 | - | |
| 3635 | - const debouncedDisable = (0,external_wp_element_namespaceObject.useCallback)((0,external_lodash_namespaceObject.debounce)(disable, undefined, { | |
| 3636 | - leading: true | |
| 3637 | - }), []); | |
| 3638 | - (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { | |
| 3639 | 4315 | disable(); |
| 3640 | 4316 | /** @type {MutationObserver | undefined} */ |
| 3641 | 4317 | |
| 3642 | - let observer; | |
| 3643 | - | |
| 3644 | - if (node.current) { | |
| 3645 | - observer = new window.MutationObserver(debouncedDisable); | |
| 3646 | - observer.observe(node.current, { | |
| 3647 | - childList: true, | |
| 3648 | - attributes: true, | |
| 3649 | - subtree: true | |
| 3650 | - }); | |
| 3651 | - } | |
| 3652 | - | |
| 4318 | + const observer = new window.MutationObserver(debouncedDisable); | |
| 4319 | + observer.observe(node, { | |
| 4320 | + childList: true | |
| 4321 | + }); | |
| 3653 | 4322 | return () => { |
| 3654 | 4323 | if (observer) { |
| 3655 | 4324 | observer.disconnect(); |
| 3656 | 4325 | } |
| @@ -3655,13 +4324,13 @@ | ||
| 3655 | 4324 | observer.disconnect(); |
| 3656 | 4325 | } |
| 3657 | 4326 | |
| 3658 | 4327 | debouncedDisable.cancel(); |
| 4328 | + updates.forEach(update => update()); | |
| 3659 | 4329 | }; |
| 3660 | - }, []); | |
| 3661 | - return node; | |
| 4330 | + }, [isDisabledProp]); | |
| 3662 | 4331 | } |
| 3663 | -//# sourceMappingURL=index.js.map | |
| 4332 | + | |
| 3664 | 4333 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-isomorphic-layout-effect/index.js |
| 3665 | 4334 | /** |
| 3666 | 4335 | * WordPress dependencies |
| 3667 | 4336 | */ |
| @@ -3672,10 +4341,10 @@ | ||
| 3672 | 4341 | * throws a warning when using useLayoutEffect in that environment. |
| 3673 | 4342 | */ |
| 3674 | 4343 | |
| 3675 | 4344 | const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? external_wp_element_namespaceObject.useLayoutEffect : external_wp_element_namespaceObject.useEffect; |
| 3676 | -/* harmony default export */ var use_isomorphic_layout_effect = (useIsomorphicLayoutEffect); | |
| 3677 | -//# sourceMappingURL=index.js.map | |
| 4345 | +/* harmony default export */ const use_isomorphic_layout_effect = (useIsomorphicLayoutEffect); | |
| 4346 | + | |
| 3678 | 4347 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-dragging/index.js |
| 3679 | 4348 | /** |
| 3680 | 4349 | * WordPress dependencies |
| 3681 | 4350 | */ |
| @@ -3683,14 +4352,16 @@ | ||
| 3683 | 4352 | /** |
| 3684 | 4353 | * Internal dependencies |
| 3685 | 4354 | */ |
| 3686 | 4355 | |
| 4356 | + // Event handlers that are triggered from `document` listeners accept a MouseEvent, | |
| 4357 | +// while those triggered from React listeners accept a React.MouseEvent. | |
| 3687 | 4358 | |
| 3688 | 4359 | /** |
| 3689 | - * @param {Object} props | |
| 3690 | - * @param {(e: MouseEvent) => void} props.onDragStart | |
| 3691 | - * @param {(e: MouseEvent) => void} props.onDragMove | |
| 3692 | - * @param {(e: MouseEvent) => void} props.onDragEnd | |
| 4360 | + * @param {Object} props | |
| 4361 | + * @param {(e: import('react').MouseEvent) => void} props.onDragStart | |
| 4362 | + * @param {(e: MouseEvent) => void} props.onDragMove | |
| 4363 | + * @param {(e?: MouseEvent) => void} props.onDragEnd | |
| 3693 | 4364 | */ |
| 3694 | 4365 | |
| 3695 | 4366 | function useDragging(_ref) { |
| 3696 | 4367 | let { |
| @@ -3708,14 +4379,14 @@ | ||
| 3708 | 4379 | eventsRef.current.onDragStart = onDragStart; |
| 3709 | 4380 | eventsRef.current.onDragMove = onDragMove; |
| 3710 | 4381 | eventsRef.current.onDragEnd = onDragEnd; |
| 3711 | 4382 | }, [onDragStart, onDragMove, onDragEnd]); |
| 3712 | - const onMouseMove = (0,external_wp_element_namespaceObject.useCallback)(( | |
| 3713 | - /** @type {MouseEvent} */ | |
| 3714 | - event) => eventsRef.current.onDragMove && eventsRef.current.onDragMove(event), []); | |
| 3715 | - const endDrag = (0,external_wp_element_namespaceObject.useCallback)(( | |
| 3716 | - /** @type {MouseEvent} */ | |
| 3717 | - event) => { | |
| 4383 | + /** @type {(e: MouseEvent) => void} */ | |
| 4384 | + | |
| 4385 | + const onMouseMove = (0,external_wp_element_namespaceObject.useCallback)(event => eventsRef.current.onDragMove && eventsRef.current.onDragMove(event), []); | |
| 4386 | + /** @type {(e?: MouseEvent) => void} */ | |
| 4387 | + | |
| 4388 | + const endDrag = (0,external_wp_element_namespaceObject.useCallback)(event => { | |
| 3718 | 4389 | if (eventsRef.current.onDragEnd) { |
| 3719 | 4390 | eventsRef.current.onDragEnd(event); |
| 3720 | 4391 | } |
| 3721 | 4392 | |
| @@ -3722,11 +4393,11 @@ | ||
| 3722 | 4393 | document.removeEventListener('mousemove', onMouseMove); |
| 3723 | 4394 | document.removeEventListener('mouseup', endDrag); |
| 3724 | 4395 | setIsDragging(false); |
| 3725 | 4396 | }, []); |
| 3726 | - const startDrag = (0,external_wp_element_namespaceObject.useCallback)(( | |
| 3727 | - /** @type {MouseEvent} */ | |
| 3728 | - event) => { | |
| 4397 | + /** @type {(e: import('react').MouseEvent) => void} */ | |
| 4398 | + | |
| 4399 | + const startDrag = (0,external_wp_element_namespaceObject.useCallback)(event => { | |
| 3729 | 4400 | if (eventsRef.current.onDragStart) { |
| 3730 | 4401 | eventsRef.current.onDragStart(event); |
| 3731 | 4402 | } |
| 3732 | 4403 | |
| @@ -3748,14 +4419,14 @@ | ||
| 3748 | 4419 | endDrag, |
| 3749 | 4420 | isDragging |
| 3750 | 4421 | }; |
| 3751 | 4422 | } |
| 3752 | -//# sourceMappingURL=index.js.map | |
| 4423 | + | |
| 3753 | 4424 | // EXTERNAL MODULE: ./node_modules/mousetrap/mousetrap.js |
| 3754 | -var mousetrap_mousetrap = __webpack_require__(2441); | |
| 4425 | +var mousetrap_mousetrap = __webpack_require__(7973); | |
| 3755 | 4426 | var mousetrap_default = /*#__PURE__*/__webpack_require__.n(mousetrap_mousetrap); |
| 3756 | 4427 | // EXTERNAL MODULE: ./node_modules/mousetrap/plugins/global-bind/mousetrap-global-bind.js |
| 3757 | -var mousetrap_global_bind = __webpack_require__(3956); | |
| 4428 | +var mousetrap_global_bind = __webpack_require__(5538); | |
| 3758 | 4429 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-keyboard-shortcut/index.js |
| 3759 | 4430 | /** |
| 3760 | 4431 | * External dependencies |
| 3761 | 4432 | */ |
| @@ -3760,14 +4431,14 @@ | ||
| 3760 | 4431 | * External dependencies |
| 3761 | 4432 | */ |
| 3762 | 4433 | |
| 3763 | 4434 | |
| 3764 | - | |
| 3765 | 4435 | /** |
| 3766 | 4436 | * WordPress dependencies |
| 3767 | 4437 | */ |
| 3768 | 4438 | |
| 3769 | 4439 | |
| 4440 | + | |
| 3770 | 4441 | /** |
| 3771 | 4442 | * A block selection object. |
| 3772 | 4443 | * |
| 3773 | 4444 | * @typedef {Object} WPKeyboardShortcutConfig |
| @@ -3777,24 +4448,8 @@ | ||
| 3777 | 4448 | * @property {boolean} [isDisabled] Disables the keyboard handler if the value is true. |
| 3778 | 4449 | * @property {import('react').RefObject<HTMLElement>} [target] React reference to the DOM element used to catch the keyboard event. |
| 3779 | 4450 | */ |
| 3780 | 4451 | |
| 3781 | -/** | |
| 3782 | - * Return true if platform is MacOS. | |
| 3783 | - * | |
| 3784 | - * @param {Window} [_window] window object by default; used for DI testing. | |
| 3785 | - * | |
| 3786 | - * @return {boolean} True if MacOS; false otherwise. | |
| 3787 | - */ | |
| 3788 | - | |
| 3789 | -function isAppleOS() { | |
| 3790 | - let _window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; | |
| 3791 | - | |
| 3792 | - const { | |
| 3793 | - platform | |
| 3794 | - } = _window.navigator; | |
| 3795 | - return platform.indexOf('Mac') !== -1 || (0,external_lodash_namespaceObject.includes)(['iPad', 'iPhone'], platform); | |
| 3796 | -} | |
| 3797 | 4452 | /* eslint-disable jsdoc/valid-types */ |
| 3798 | 4453 | |
| 3799 | 4454 | /** |
| 3800 | 4455 | * Attach a keyboard shortcut handler. |
| @@ -3805,9 +4460,8 @@ | ||
| 3805 | 4460 | * @param {(e: import('mousetrap').ExtendedKeyboardEvent, combo: string) => void} callback Shortcut callback. |
| 3806 | 4461 | * @param {WPKeyboardShortcutConfig} options Shortcut options. |
| 3807 | 4462 | */ |
| 3808 | 4463 | |
| 3809 | - | |
| 3810 | 4464 | function useKeyboardShortcut( |
| 3811 | 4465 | /* eslint-enable jsdoc/valid-types */ |
| 3812 | 4466 | shortcuts, callback) { |
| 3813 | 4467 | let { |
| @@ -3827,15 +4481,16 @@ | ||
| 3827 | 4481 | } |
| 3828 | 4482 | |
| 3829 | 4483 | const mousetrap = new (mousetrap_default())(target && target.current ? target.current : // We were passing `document` here previously, so to successfully cast it to Element we must cast it first to `unknown`. |
| 3830 | 4484 | // Not sure if this is a mistake but it was the behavior previous to the addition of types so we're just doing what's |
| 3831 | - // necessary to maintain the existing behavior | |
| 4485 | + // necessary to maintain the existing behavior. | |
| 3832 | 4486 | |
| 3833 | 4487 | /** @type {Element} */ |
| 3834 | 4488 | |
| 3835 | 4489 | /** @type {unknown} */ |
| 3836 | 4490 | document); |
| 3837 | - (0,external_lodash_namespaceObject.castArray)(shortcuts).forEach(shortcut => { | |
| 4491 | + const shortcutsArray = Array.isArray(shortcuts) ? shortcuts : [shortcuts]; | |
| 4492 | + shortcutsArray.forEach(shortcut => { | |
| 3838 | 4493 | const keys = shortcut.split('+'); // Determines whether a key is a modifier by the length of the string. |
| 3839 | 4494 | // E.g. if I add a pass a shortcut Shift+Cmd+M, it'll determine that |
| 3840 | 4495 | // the modifiers are Shift and Cmd because they're not a single character. |
| 3841 | 4496 | |
| @@ -3842,9 +4497,9 @@ | ||
| 3842 | 4497 | const modifiers = new Set(keys.filter(value => value.length > 1)); |
| 3843 | 4498 | const hasAlt = modifiers.has('alt'); |
| 3844 | 4499 | const hasShift = modifiers.has('shift'); // This should be better moved to the shortcut registration instead. |
| 3845 | 4500 | |
| 3846 | - if (isAppleOS() && (modifiers.size === 1 && hasAlt || modifiers.size === 2 && hasAlt && hasShift)) { | |
| 4501 | + if ((0,external_wp_keycodes_namespaceObject.isAppleOS)() && (modifiers.size === 1 && hasAlt || modifiers.size === 2 && hasAlt && hasShift)) { | |
| 3847 | 4502 | throw new Error(`Cannot bind ${shortcut}. Alt and Shift+Alt modifiers are reserved for character input.`); |
| 3848 | 4503 | } |
| 3849 | 4504 | |
| 3850 | 4505 | const bindFn = bindGlobal ? 'bindGlobal' : 'bind'; // @ts-ignore `bindGlobal` is an undocumented property |
| @@ -3861,10 +4516,10 @@ | ||
| 3861 | 4516 | }; |
| 3862 | 4517 | }, [shortcuts, bindGlobal, eventName, target, isDisabled]); |
| 3863 | 4518 | } |
| 3864 | 4519 | |
| 3865 | -/* harmony default export */ var use_keyboard_shortcut = (useKeyboardShortcut); | |
| 3866 | -//# sourceMappingURL=index.js.map | |
| 4520 | +/* harmony default export */ const use_keyboard_shortcut = (useKeyboardShortcut); | |
| 4521 | + | |
| 3867 | 4522 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-media-query/index.js |
| 3868 | 4523 | /** |
| 3869 | 4524 | * WordPress dependencies |
| 3870 | 4525 | */ |
| @@ -3893,9 +4548,9 @@ | ||
| 3893 | 4548 | }; |
| 3894 | 4549 | }, [query]); |
| 3895 | 4550 | return !!query && match; |
| 3896 | 4551 | } |
| 3897 | -//# sourceMappingURL=index.js.map | |
| 4552 | + | |
| 3898 | 4553 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-previous/index.js |
| 3899 | 4554 | /** |
| 3900 | 4555 | * WordPress dependencies |
| 3901 | 4556 | */ |
| @@ -3918,9 +4573,9 @@ | ||
| 3918 | 4573 | // Return previous value (happens before update in useEffect above). |
| 3919 | 4574 | |
| 3920 | 4575 | return ref.current; |
| 3921 | 4576 | } |
| 3922 | -//# sourceMappingURL=index.js.map | |
| 4577 | + | |
| 3923 | 4578 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-reduced-motion/index.js |
| 3924 | 4579 | /** |
| 3925 | 4580 | * Internal dependencies |
| 3926 | 4581 | */ |
| @@ -3932,10 +4587,10 @@ | ||
| 3932 | 4587 | */ |
| 3933 | 4588 | |
| 3934 | 4589 | const useReducedMotion = () => useMediaQuery('(prefers-reduced-motion: reduce)'); |
| 3935 | 4590 | |
| 3936 | -/* harmony default export */ var use_reduced_motion = (useReducedMotion); | |
| 3937 | -//# sourceMappingURL=index.js.map | |
| 4591 | +/* harmony default export */ const use_reduced_motion = (useReducedMotion); | |
| 4592 | + | |
| 3938 | 4593 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-viewport-match/index.js |
| 3939 | 4594 | /** |
| 3940 | 4595 | * WordPress dependencies |
| 3941 | 4596 | */ |
| @@ -4021,27 +4676,213 @@ | ||
| 4021 | 4676 | return mediaQueryResult; |
| 4022 | 4677 | }; |
| 4023 | 4678 | |
| 4024 | 4679 | useViewportMatch.__experimentalWidthProvider = ViewportMatchWidthContext.Provider; |
| 4025 | -/* harmony default export */ var use_viewport_match = (useViewportMatch); | |
| 4026 | -//# sourceMappingURL=index.js.map | |
| 4027 | -// EXTERNAL MODULE: ./node_modules/react-resize-aware/dist/index.js | |
| 4028 | -var dist = __webpack_require__(5464); | |
| 4029 | -var dist_default = /*#__PURE__*/__webpack_require__.n(dist); | |
| 4680 | +/* harmony default export */ const use_viewport_match = (useViewportMatch); | |
| 4681 | + | |
| 4030 | 4682 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-resize-observer/index.js |
| 4683 | + | |
| 4684 | + | |
| 4031 | 4685 | /** |
| 4032 | 4686 | * External dependencies |
| 4033 | 4687 | */ |
| 4034 | 4688 | |
| 4035 | 4689 | /** |
| 4690 | + * WordPress dependencies | |
| 4691 | + */ | |
| 4692 | + | |
| 4693 | + | |
| 4694 | +// This of course could've been more streamlined with internal state instead of | |
| 4695 | +// refs, but then host hooks / components could not opt out of renders. | |
| 4696 | +// This could've been exported to its own module, but the current build doesn't | |
| 4697 | +// seem to work with module imports and I had no more time to spend on this... | |
| 4698 | +function useResolvedElement(subscriber, refOrElement) { | |
| 4699 | + const callbackRefElement = (0,external_wp_element_namespaceObject.useRef)(null); | |
| 4700 | + const lastReportRef = (0,external_wp_element_namespaceObject.useRef)(null); | |
| 4701 | + const cleanupRef = (0,external_wp_element_namespaceObject.useRef)(); | |
| 4702 | + const callSubscriber = (0,external_wp_element_namespaceObject.useCallback)(() => { | |
| 4703 | + let element = null; | |
| 4704 | + | |
| 4705 | + if (callbackRefElement.current) { | |
| 4706 | + element = callbackRefElement.current; | |
| 4707 | + } else if (refOrElement) { | |
| 4708 | + if (refOrElement instanceof HTMLElement) { | |
| 4709 | + element = refOrElement; | |
| 4710 | + } else { | |
| 4711 | + element = refOrElement.current; | |
| 4712 | + } | |
| 4713 | + } | |
| 4714 | + | |
| 4715 | + if (lastReportRef.current && lastReportRef.current.element === element && lastReportRef.current.reporter === callSubscriber) { | |
| 4716 | + return; | |
| 4717 | + } | |
| 4718 | + | |
| 4719 | + if (cleanupRef.current) { | |
| 4720 | + cleanupRef.current(); // Making sure the cleanup is not called accidentally multiple times. | |
| 4721 | + | |
| 4722 | + cleanupRef.current = null; | |
| 4723 | + } | |
| 4724 | + | |
| 4725 | + lastReportRef.current = { | |
| 4726 | + reporter: callSubscriber, | |
| 4727 | + element | |
| 4728 | + }; // Only calling the subscriber, if there's an actual element to report. | |
| 4729 | + | |
| 4730 | + if (element) { | |
| 4731 | + cleanupRef.current = subscriber(element); | |
| 4732 | + } | |
| 4733 | + }, [refOrElement, subscriber]); // On each render, we check whether a ref changed, or if we got a new raw | |
| 4734 | + // element. | |
| 4735 | + | |
| 4736 | + (0,external_wp_element_namespaceObject.useEffect)(() => { | |
| 4737 | + // With this we're *technically* supporting cases where ref objects' current value changes, but only if there's a | |
| 4738 | + // render accompanying that change as well. | |
| 4739 | + // To guarantee we always have the right element, one must use the ref callback provided instead, but we support | |
| 4740 | + // RefObjects to make the hook API more convenient in certain cases. | |
| 4741 | + callSubscriber(); | |
| 4742 | + }, [callSubscriber]); | |
| 4743 | + return (0,external_wp_element_namespaceObject.useCallback)(element => { | |
| 4744 | + callbackRefElement.current = element; | |
| 4745 | + callSubscriber(); | |
| 4746 | + }, [callSubscriber]); | |
| 4747 | +} | |
| 4748 | + | |
| 4749 | +// We're only using the first element of the size sequences, until future versions of the spec solidify on how | |
| 4750 | +// exactly it'll be used for fragments in multi-column scenarios: | |
| 4751 | +// From the spec: | |
| 4752 | +// > The box size properties are exposed as FrozenArray in order to support elements that have multiple fragments, | |
| 4753 | +// > which occur in multi-column scenarios. However the current definitions of content rect and border box do not | |
| 4754 | +// > mention how those boxes are affected by multi-column layout. In this spec, there will only be a single | |
| 4755 | +// > ResizeObserverSize returned in the FrozenArray, which will correspond to the dimensions of the first column. | |
| 4756 | +// > A future version of this spec will extend the returned FrozenArray to contain the per-fragment size information. | |
| 4757 | +// (https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface) | |
| 4758 | +// | |
| 4759 | +// Also, testing these new box options revealed that in both Chrome and FF everything is returned in the callback, | |
| 4760 | +// regardless of the "box" option. | |
| 4761 | +// The spec states the following on this: | |
| 4762 | +// > This does not have any impact on which box dimensions are returned to the defined callback when the event | |
| 4763 | +// > is fired, it solely defines which box the author wishes to observe layout changes on. | |
| 4764 | +// (https://drafts.csswg.org/resize-observer/#resize-observer-interface) | |
| 4765 | +// I'm not exactly clear on what this means, especially when you consider a later section stating the following: | |
| 4766 | +// > This section is non-normative. An author may desire to observe more than one CSS box. | |
| 4767 | +// > In this case, author will need to use multiple ResizeObservers. | |
| 4768 | +// (https://drafts.csswg.org/resize-observer/#resize-observer-interface) | |
| 4769 | +// Which is clearly not how current browser implementations behave, and seems to contradict the previous quote. | |
| 4770 | +// For this reason I decided to only return the requested size, | |
| 4771 | +// even though it seems we have access to results for all box types. | |
| 4772 | +// This also means that we get to keep the current api, being able to return a simple { width, height } pair, | |
| 4773 | +// regardless of box option. | |
| 4774 | +const extractSize = (entry, boxProp, sizeType) => { | |
| 4775 | + if (!entry[boxProp]) { | |
| 4776 | + if (boxProp === 'contentBoxSize') { | |
| 4777 | + // The dimensions in `contentBoxSize` and `contentRect` are equivalent according to the spec. | |
| 4778 | + // See the 6th step in the description for the RO algorithm: | |
| 4779 | + // https://drafts.csswg.org/resize-observer/#create-and-populate-resizeobserverentry-h | |
| 4780 | + // > Set this.contentRect to logical this.contentBoxSize given target and observedBox of "content-box". | |
| 4781 | + // In real browser implementations of course these objects differ, but the width/height values should be equivalent. | |
| 4782 | + return entry.contentRect[sizeType === 'inlineSize' ? 'width' : 'height']; | |
| 4783 | + } | |
| 4784 | + | |
| 4785 | + return undefined; | |
| 4786 | + } // A couple bytes smaller than calling Array.isArray() and just as effective here. | |
| 4787 | + | |
| 4788 | + | |
| 4789 | + return entry[boxProp][0] ? entry[boxProp][0][sizeType] : // TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's current | |
| 4790 | + // behaviour of returning objects instead of arrays for `borderBoxSize` and `contentBoxSize`. | |
| 4791 | + // @ts-ignore | |
| 4792 | + entry[boxProp][sizeType]; | |
| 4793 | +}; | |
| 4794 | + | |
| 4795 | +function useResizeObserver() { | |
| 4796 | + let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 4797 | + // Saving the callback as a ref. With this, I don't need to put onResize in the | |
| 4798 | + // effect dep array, and just passing in an anonymous function without memoising | |
| 4799 | + // will not reinstantiate the hook's ResizeObserver. | |
| 4800 | + const onResize = opts.onResize; | |
| 4801 | + const onResizeRef = (0,external_wp_element_namespaceObject.useRef)(undefined); | |
| 4802 | + onResizeRef.current = onResize; | |
| 4803 | + const round = opts.round || Math.round; // Using a single instance throughout the hook's lifetime | |
| 4804 | + | |
| 4805 | + const resizeObserverRef = (0,external_wp_element_namespaceObject.useRef)(); | |
| 4806 | + const [size, setSize] = (0,external_wp_element_namespaceObject.useState)({ | |
| 4807 | + width: undefined, | |
| 4808 | + height: undefined | |
| 4809 | + }); // In certain edge cases the RO might want to report a size change just after | |
| 4810 | + // the component unmounted. | |
| 4811 | + | |
| 4812 | + const didUnmount = (0,external_wp_element_namespaceObject.useRef)(false); | |
| 4813 | + (0,external_wp_element_namespaceObject.useEffect)(() => { | |
| 4814 | + return () => { | |
| 4815 | + didUnmount.current = true; | |
| 4816 | + }; | |
| 4817 | + }, []); // Using a ref to track the previous width / height to avoid unnecessary renders. | |
| 4818 | + | |
| 4819 | + const previous = (0,external_wp_element_namespaceObject.useRef)({ | |
| 4820 | + width: undefined, | |
| 4821 | + height: undefined | |
| 4822 | + }); // This block is kinda like a useEffect, only it's called whenever a new | |
| 4823 | + // element could be resolved based on the ref option. It also has a cleanup | |
| 4824 | + // function. | |
| 4825 | + | |
| 4826 | + const refCallback = useResolvedElement((0,external_wp_element_namespaceObject.useCallback)(element => { | |
| 4827 | + // We only use a single Resize Observer instance, and we're instantiating it on demand, only once there's something to observe. | |
| 4828 | + // This instance is also recreated when the `box` option changes, so that a new observation is fired if there was a previously observed element with a different box option. | |
| 4829 | + if (!resizeObserverRef.current || resizeObserverRef.current.box !== opts.box || resizeObserverRef.current.round !== round) { | |
| 4830 | + resizeObserverRef.current = { | |
| 4831 | + box: opts.box, | |
| 4832 | + round, | |
| 4833 | + instance: new ResizeObserver(entries => { | |
| 4834 | + const entry = entries[0]; | |
| 4835 | + let boxProp = 'borderBoxSize'; | |
| 4836 | + | |
| 4837 | + if (opts.box === 'border-box') { | |
| 4838 | + boxProp = 'borderBoxSize'; | |
| 4839 | + } else { | |
| 4840 | + boxProp = opts.box === 'device-pixel-content-box' ? 'devicePixelContentBoxSize' : 'contentBoxSize'; | |
| 4841 | + } | |
| 4842 | + | |
| 4843 | + const reportedWidth = extractSize(entry, boxProp, 'inlineSize'); | |
| 4844 | + const reportedHeight = extractSize(entry, boxProp, 'blockSize'); | |
| 4845 | + const newWidth = reportedWidth ? round(reportedWidth) : undefined; | |
| 4846 | + const newHeight = reportedHeight ? round(reportedHeight) : undefined; | |
| 4847 | + | |
| 4848 | + if (previous.current.width !== newWidth || previous.current.height !== newHeight) { | |
| 4849 | + const newSize = { | |
| 4850 | + width: newWidth, | |
| 4851 | + height: newHeight | |
| 4852 | + }; | |
| 4853 | + previous.current.width = newWidth; | |
| 4854 | + previous.current.height = newHeight; | |
| 4855 | + | |
| 4856 | + if (onResizeRef.current) { | |
| 4857 | + onResizeRef.current(newSize); | |
| 4858 | + } else if (!didUnmount.current) { | |
| 4859 | + setSize(newSize); | |
| 4860 | + } | |
| 4861 | + } | |
| 4862 | + }) | |
| 4863 | + }; | |
| 4864 | + } | |
| 4865 | + | |
| 4866 | + resizeObserverRef.current.instance.observe(element, { | |
| 4867 | + box: opts.box | |
| 4868 | + }); | |
| 4869 | + return () => { | |
| 4870 | + if (resizeObserverRef.current) { | |
| 4871 | + resizeObserverRef.current.instance.unobserve(element); | |
| 4872 | + } | |
| 4873 | + }; | |
| 4874 | + }, [opts.box, round]), opts.ref); | |
| 4875 | + return (0,external_wp_element_namespaceObject.useMemo)(() => ({ | |
| 4876 | + ref: refCallback, | |
| 4877 | + width: size.width, | |
| 4878 | + height: size.height | |
| 4879 | + }), [refCallback, size ? size.width : null, size ? size.height : null]); | |
| 4880 | +} | |
| 4881 | +/** | |
| 4036 | 4882 | * Hook which allows to listen the resize event of any target element when it changes sizes. |
| 4037 | - * _Note: `useResizeObserver` will report `null` until after first render_ | |
| 4883 | + * _Note: `useResizeObserver` will report `null` until after first render. | |
| 4038 | 4884 | * |
| 4039 | - * Simply a re-export of `react-resize-aware` so refer to its documentation <https://github.com/FezVrasta/react-resize-aware> | |
| 4040 | - * for more details. | |
| 4041 | - * | |
| 4042 | - * @see https://github.com/FezVrasta/react-resize-aware | |
| 4043 | - * | |
| 4044 | 4885 | * @example |
| 4045 | 4886 | * |
| 4046 | 4887 | * ```js |
| 4047 | 4888 | * const App = () => { |
| @@ -4054,15 +4895,43 @@ | ||
| 4054 | 4895 | * </div> |
| 4055 | 4896 | * ); |
| 4056 | 4897 | * }; |
| 4057 | 4898 | * ``` |
| 4058 | - * | |
| 4059 | 4899 | */ |
| 4060 | 4900 | |
| 4061 | -/* harmony default export */ var use_resize_observer = ((dist_default())); | |
| 4062 | -//# sourceMappingURL=index.js.map | |
| 4901 | + | |
| 4902 | +function useResizeAware() { | |
| 4903 | + const { | |
| 4904 | + ref, | |
| 4905 | + width, | |
| 4906 | + height | |
| 4907 | + } = useResizeObserver(); | |
| 4908 | + const sizes = (0,external_wp_element_namespaceObject.useMemo)(() => { | |
| 4909 | + return { | |
| 4910 | + width: width !== null && width !== void 0 ? width : null, | |
| 4911 | + height: height !== null && height !== void 0 ? height : null | |
| 4912 | + }; | |
| 4913 | + }, [width, height]); | |
| 4914 | + const resizeListener = (0,external_wp_element_namespaceObject.createElement)("div", { | |
| 4915 | + style: { | |
| 4916 | + position: 'absolute', | |
| 4917 | + top: 0, | |
| 4918 | + left: 0, | |
| 4919 | + right: 0, | |
| 4920 | + bottom: 0, | |
| 4921 | + pointerEvents: 'none', | |
| 4922 | + opacity: 0, | |
| 4923 | + overflow: 'hidden', | |
| 4924 | + zIndex: -1 | |
| 4925 | + }, | |
| 4926 | + "aria-hidden": "true", | |
| 4927 | + ref: ref | |
| 4928 | + }); | |
| 4929 | + return [resizeListener, sizes]; | |
| 4930 | +} | |
| 4931 | + | |
| 4063 | 4932 | ;// CONCATENATED MODULE: external ["wp","priorityQueue"] |
| 4064 | -var external_wp_priorityQueue_namespaceObject = window["wp"]["priorityQueue"]; | |
| 4933 | +const external_wp_priorityQueue_namespaceObject = window["wp"]["priorityQueue"]; | |
| 4065 | 4934 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-async-list/index.js |
| 4066 | 4935 | /** |
| 4067 | 4936 | * WordPress dependencies |
| 4068 | 4937 | */ |
| @@ -4137,10 +5006,10 @@ | ||
| 4137 | 5006 | }, [list]); |
| 4138 | 5007 | return current; |
| 4139 | 5008 | } |
| 4140 | 5009 | |
| 4141 | -/* harmony default export */ var use_async_list = (useAsyncList); | |
| 4142 | -//# sourceMappingURL=index.js.map | |
| 5010 | +/* harmony default export */ const use_async_list = (useAsyncList); | |
| 5011 | + | |
| 4143 | 5012 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-warn-on-change/index.js |
| 4144 | 5013 | /** |
| 4145 | 5014 | * Internal dependencies |
| 4146 | 5015 | */ |
| @@ -4186,12 +5055,12 @@ | ||
| 4186 | 5055 | } |
| 4187 | 5056 | }); |
| 4188 | 5057 | } |
| 4189 | 5058 | |
| 4190 | -/* harmony default export */ var use_warn_on_change = (useWarnOnChange); | |
| 4191 | -//# sourceMappingURL=index.js.map | |
| 4192 | -// EXTERNAL MODULE: external "React" | |
| 4193 | -var external_React_ = __webpack_require__(9196); | |
| 5059 | +/* harmony default export */ const use_warn_on_change = (useWarnOnChange); | |
| 5060 | + | |
| 5061 | +;// CONCATENATED MODULE: external "React" | |
| 5062 | +const external_React_namespaceObject = window["React"]; | |
| 4194 | 5063 | ;// CONCATENATED MODULE: ./node_modules/use-memo-one/dist/use-memo-one.esm.js |
| 4195 | 5064 | |
| 4196 | 5065 | |
| 4197 | 5066 | function areInputsEqual(newInputs, lastInputs) { |
| @@ -4208,21 +5077,21 @@ | ||
| 4208 | 5077 | return true; |
| 4209 | 5078 | } |
| 4210 | 5079 | |
| 4211 | 5080 | function useMemoOne(getResult, inputs) { |
| 4212 | - var initial = (0,external_React_.useState)(function () { | |
| 5081 | + var initial = (0,external_React_namespaceObject.useState)(function () { | |
| 4213 | 5082 | return { |
| 4214 | 5083 | inputs: inputs, |
| 4215 | 5084 | result: getResult() |
| 4216 | 5085 | }; |
| 4217 | 5086 | })[0]; |
| 4218 | - var committed = (0,external_React_.useRef)(initial); | |
| 5087 | + var committed = (0,external_React_namespaceObject.useRef)(initial); | |
| 4219 | 5088 | var isInputMatch = Boolean(inputs && committed.current.inputs && areInputsEqual(inputs, committed.current.inputs)); |
| 4220 | 5089 | var cache = isInputMatch ? committed.current : { |
| 4221 | 5090 | inputs: inputs, |
| 4222 | 5091 | result: getResult() |
| 4223 | 5092 | }; |
| 4224 | - (0,external_React_.useEffect)(function () { | |
| 5093 | + (0,external_React_namespaceObject.useEffect)(function () { | |
| 4225 | 5094 | committed.current = cache; |
| 4226 | 5095 | }, [cache]); |
| 4227 | 5096 | return cache.result; |
| 4228 | 5097 | } |
| @@ -4240,18 +5109,20 @@ | ||
| 4240 | 5109 | /** |
| 4241 | 5110 | * External dependencies |
| 4242 | 5111 | */ |
| 4243 | 5112 | |
| 4244 | - | |
| 4245 | 5113 | /** |
| 4246 | 5114 | * WordPress dependencies |
| 4247 | 5115 | */ |
| 4248 | 5116 | |
| 4249 | 5117 | |
| 4250 | -/* eslint-disable jsdoc/valid-types */ | |
| 5118 | +/** | |
| 5119 | + * Internal dependencies | |
| 5120 | + */ | |
| 4251 | 5121 | |
| 5122 | + | |
| 4252 | 5123 | /** |
| 4253 | - * Debounces a function with Lodash's `debounce`. A new debounced function will | |
| 5124 | + * Debounces a function similar to Lodash's `debounce`. A new debounced function will | |
| 4254 | 5125 | * be returned and any scheduled calls cancelled if any of the arguments change, |
| 4255 | 5126 | * including the function to debounce, so please wrap functions created on |
| 4256 | 5127 | * render in components in `useCallback`. |
| 4257 | 5128 | * |
| @@ -4258,34 +5129,37 @@ | ||
| 4258 | 5129 | * @see https://docs-lodash.com/v4/debounce/ |
| 4259 | 5130 | * |
| 4260 | 5131 | * @template {(...args: any[]) => void} TFunc |
| 4261 | 5132 | * |
| 4262 | - * @param {TFunc} fn The function to debounce. | |
| 4263 | - * @param {number} [wait] The number of milliseconds to delay. | |
| 4264 | - * @param {import('lodash').DebounceSettings} [options] The options object. | |
| 4265 | - * @return {import('lodash').DebouncedFunc<TFunc>} Debounced function. | |
| 5133 | + * @param {TFunc} fn The function to debounce. | |
| 5134 | + * @param {number} [wait] The number of milliseconds to delay. | |
| 5135 | + * @param {import('../../utils/debounce').DebounceOptions} [options] The options object. | |
| 5136 | + * @return {import('../../utils/debounce').DebouncedFunc<TFunc>} Debounced function. | |
| 4266 | 5137 | */ |
| 4267 | 5138 | |
| 4268 | 5139 | function useDebounce(fn, wait, options) { |
| 4269 | - /* eslint-enable jsdoc/valid-types */ | |
| 4270 | - const debounced = useMemoOne(() => (0,external_lodash_namespaceObject.debounce)(fn, wait, options), [fn, wait, options]); | |
| 5140 | + const debounced = useMemoOne(() => debounce(fn, wait !== null && wait !== void 0 ? wait : 0, options), [fn, wait, options]); | |
| 4271 | 5141 | (0,external_wp_element_namespaceObject.useEffect)(() => () => debounced.cancel(), [debounced]); |
| 4272 | 5142 | return debounced; |
| 4273 | 5143 | } |
| 4274 | -//# sourceMappingURL=index.js.map | |
| 5144 | + | |
| 4275 | 5145 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-throttle/index.js |
| 4276 | 5146 | /** |
| 4277 | 5147 | * External dependencies |
| 4278 | 5148 | */ |
| 4279 | 5149 | |
| 5150 | +/** | |
| 5151 | + * WordPress dependencies | |
| 5152 | + */ | |
| 4280 | 5153 | |
| 5154 | + | |
| 4281 | 5155 | /** |
| 4282 | - * WordPress dependencies | |
| 5156 | + * Internal dependencies | |
| 4283 | 5157 | */ |
| 4284 | 5158 | |
| 4285 | 5159 | |
| 4286 | 5160 | /** |
| 4287 | - * Throttles a function with Lodash's `throttle`. A new throttled function will | |
| 5161 | + * Throttles a function similar to Lodash's `throttle`. A new throttled function will | |
| 4288 | 5162 | * be returned and any scheduled calls cancelled if any of the arguments change, |
| 4289 | 5163 | * including the function to throttle, so please wrap functions created on |
| 4290 | 5164 | * render in components in `useCallback`. |
| 4291 | 5165 | * |
| @@ -4292,20 +5166,20 @@ | ||
| 4292 | 5166 | * @see https://docs-lodash.com/v4/throttle/ |
| 4293 | 5167 | * |
| 4294 | 5168 | * @template {(...args: any[]) => void} TFunc |
| 4295 | 5169 | * |
| 4296 | - * @param {TFunc} fn The function to throttle. | |
| 4297 | - * @param {number} [wait] The number of milliseconds to throttle invocations to. | |
| 4298 | - * @param {import('lodash').ThrottleSettings} [options] The options object. See linked documentation for details. | |
| 4299 | - * @return {import('lodash').DebouncedFunc<TFunc>} Throttled function. | |
| 5170 | + * @param {TFunc} fn The function to throttle. | |
| 5171 | + * @param {number} [wait] The number of milliseconds to throttle invocations to. | |
| 5172 | + * @param {import('../../utils/throttle').ThrottleOptions} [options] The options object. See linked documentation for details. | |
| 5173 | + * @return {import('../../utils/debounce').DebouncedFunc<TFunc>} Throttled function. | |
| 4300 | 5174 | */ |
| 4301 | 5175 | |
| 4302 | 5176 | function useThrottle(fn, wait, options) { |
| 4303 | - const throttled = useMemoOne(() => (0,external_lodash_namespaceObject.throttle)(fn, wait, options), [fn, wait, options]); | |
| 5177 | + const throttled = useMemoOne(() => throttle(fn, wait !== null && wait !== void 0 ? wait : 0, options), [fn, wait, options]); | |
| 4304 | 5178 | (0,external_wp_element_namespaceObject.useEffect)(() => () => throttled.cancel(), [throttled]); |
| 4305 | 5179 | return throttled; |
| 4306 | 5180 | } |
| 4307 | -//# sourceMappingURL=index.js.map | |
| 5181 | + | |
| 4308 | 5182 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-drop-zone/index.js |
| 4309 | 5183 | /** |
| 4310 | 5184 | * WordPress dependencies |
| 4311 | 5185 | */ |
| @@ -4319,9 +5193,9 @@ | ||
| 4319 | 5193 | |
| 4320 | 5194 | /** |
| 4321 | 5195 | * @template T |
| 4322 | 5196 | * @param {T} value |
| 4323 | - * @return {import('react').MutableRefObject<T>} A ref with the value. | |
| 5197 | + * @return {import('react').MutableRefObject<T|null>} A ref with the value. | |
| 4324 | 5198 | */ |
| 4325 | 5199 | |
| 4326 | 5200 | function useFreshRef(value) { |
| 4327 | 5201 | /* eslint-enable jsdoc/valid-types */ |
| @@ -4343,16 +5217,16 @@ | ||
| 4343 | 5217 | } |
| 4344 | 5218 | /** |
| 4345 | 5219 | * A hook to facilitate drag and drop handling. |
| 4346 | 5220 | * |
| 4347 | - * @param {Object} props Named parameters. | |
| 4348 | - * @param {boolean} props.isDisabled Whether or not to disable the drop zone. | |
| 4349 | - * @param {(e: DragEvent) => void} props.onDragStart Called when dragging has started. | |
| 4350 | - * @param {(e: DragEvent) => void} props.onDragEnter Called when the zone is entered. | |
| 4351 | - * @param {(e: DragEvent) => void} props.onDragOver Called when the zone is moved within. | |
| 4352 | - * @param {(e: DragEvent) => void} props.onDragLeave Called when the zone is left. | |
| 4353 | - * @param {(e: MouseEvent) => void} props.onDragEnd Called when dragging has ended. | |
| 4354 | - * @param {(e: DragEvent) => void} props.onDrop Called when dropping in the zone. | |
| 5221 | + * @param {Object} props Named parameters. | |
| 5222 | + * @param {boolean} [props.isDisabled] Whether or not to disable the drop zone. | |
| 5223 | + * @param {(e: DragEvent) => void} [props.onDragStart] Called when dragging has started. | |
| 5224 | + * @param {(e: DragEvent) => void} [props.onDragEnter] Called when the zone is entered. | |
| 5225 | + * @param {(e: DragEvent) => void} [props.onDragOver] Called when the zone is moved within. | |
| 5226 | + * @param {(e: DragEvent) => void} [props.onDragLeave] Called when the zone is left. | |
| 5227 | + * @param {(e: MouseEvent) => void} [props.onDragEnd] Called when dragging has ended. | |
| 5228 | + * @param {(e: DragEvent) => void} [props.onDrop] Called when dropping in the zone. | |
| 4355 | 5229 | * |
| 4356 | 5230 | * @return {import('react').RefCallback<HTMLElement>} Ref callback to be passed to the drop zone element. |
| 4357 | 5231 | */ |
| 4358 | 5232 | |
| @@ -4418,10 +5292,9 @@ | ||
| 4418 | 5292 | if (isDragging) { |
| 4419 | 5293 | return; |
| 4420 | 5294 | } |
| 4421 | 5295 | |
| 4422 | - isDragging = true; | |
| 4423 | - ownerDocument.removeEventListener('dragenter', maybeDragStart); // Note that `dragend` doesn't fire consistently for file and | |
| 5296 | + isDragging = true; // Note that `dragend` doesn't fire consistently for file and | |
| 4424 | 5297 | // HTML drag events where the drag origin is outside the browser |
| 4425 | 5298 | // window. In Firefox it may also not fire if the originating |
| 4426 | 5299 | // node is removed. |
| 4427 | 5300 | |
| @@ -4472,8 +5345,10 @@ | ||
| 4472 | 5345 | // elements, but we only want to call `onDragLeave` when |
| 4473 | 5346 | // leaving the drop zone, which means the `relatedTarget` |
| 4474 | 5347 | // (element that has been entered) should be outside the drop |
| 4475 | 5348 | // zone. |
| 5349 | + // Note: This is not entirely reliable in Safari due to this bug | |
| 5350 | + // https://bugs.webkit.org/show_bug.cgi?id=66547 | |
| 4476 | 5351 | if (isElementInZone(event.relatedTarget)) { |
| 4477 | 5352 | return; |
| 4478 | 5353 | } |
| 4479 | 5354 | |
| @@ -4513,9 +5388,8 @@ | ||
| 4513 | 5388 | return; |
| 4514 | 5389 | } |
| 4515 | 5390 | |
| 4516 | 5391 | isDragging = false; |
| 4517 | - ownerDocument.addEventListener('dragenter', maybeDragStart); | |
| 4518 | 5392 | ownerDocument.removeEventListener('dragend', maybeDragEnd); |
| 4519 | 5393 | ownerDocument.removeEventListener('mousemove', maybeDragEnd); |
| 4520 | 5394 | |
| 4521 | 5395 | if (onDragEndRef.current) { |
| @@ -4538,15 +5412,19 @@ | ||
| 4538 | 5412 | element.removeEventListener('dragover', onDragOver); |
| 4539 | 5413 | element.removeEventListener('dragleave', onDragLeave); |
| 4540 | 5414 | ownerDocument.removeEventListener('dragend', maybeDragEnd); |
| 4541 | 5415 | ownerDocument.removeEventListener('mousemove', maybeDragEnd); |
| 4542 | - ownerDocument.addEventListener('dragenter', maybeDragStart); | |
| 5416 | + ownerDocument.removeEventListener('dragenter', maybeDragStart); | |
| 4543 | 5417 | }; |
| 4544 | 5418 | }, [isDisabled]); |
| 4545 | 5419 | } |
| 4546 | -//# sourceMappingURL=index.js.map | |
| 5420 | + | |
| 4547 | 5421 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-focusable-iframe/index.js |
| 4548 | 5422 | /** |
| 5423 | + * External dependencies | |
| 5424 | + */ | |
| 5425 | + | |
| 5426 | +/** | |
| 4549 | 5427 | * Internal dependencies |
| 4550 | 5428 | */ |
| 4551 | 5429 | |
| 4552 | 5430 | /** |
| @@ -4552,9 +5430,9 @@ | ||
| 4552 | 5430 | /** |
| 4553 | 5431 | * Dispatches a bubbling focus event when the iframe receives focus. Use |
| 4554 | 5432 | * `onFocus` as usual on the iframe or a parent element. |
| 4555 | 5433 | * |
| 4556 | - * @return {Object} Ref to pass to the iframe. | |
| 5434 | + * @return Ref to pass to the iframe. | |
| 4557 | 5435 | */ |
| 4558 | 5436 | |
| 4559 | 5437 | function useFocusableIframe() { |
| 4560 | 5438 | return useRefEffect(element => { |
| @@ -4572,9 +5450,8 @@ | ||
| 4572 | 5450 | */ |
| 4573 | 5451 | |
| 4574 | 5452 | function checkFocus() { |
| 4575 | 5453 | if (ownerDocument && ownerDocument.activeElement === element) { |
| 4576 | - /** @type {HTMLElement} */ | |
| 4577 | 5454 | element.focus(); |
| 4578 | 5455 | } |
| 4579 | 5456 | } |
| 4580 | 5457 | |
| @@ -4583,21 +5460,21 @@ | ||
| 4583 | 5460 | defaultView.removeEventListener('blur', checkFocus); |
| 4584 | 5461 | }; |
| 4585 | 5462 | }, []); |
| 4586 | 5463 | } |
| 4587 | -//# sourceMappingURL=index.js.map | |
| 5464 | + | |
| 4588 | 5465 | ;// CONCATENATED MODULE: ./packages/compose/build-module/hooks/use-fixed-window-list/index.js |
| 4589 | 5466 | /** |
| 4590 | - * External dependencies | |
| 5467 | + * WordPress dependencies | |
| 4591 | 5468 | */ |
| 4592 | 5469 | |
| 5470 | + | |
| 5471 | + | |
| 4593 | 5472 | /** |
| 4594 | - * WordPress dependencies | |
| 5473 | + * Internal dependencies | |
| 4595 | 5474 | */ |
| 4596 | 5475 | |
| 4597 | 5476 | |
| 4598 | - | |
| 4599 | - | |
| 4600 | 5477 | const DEFAULT_INIT_WINDOW_SIZE = 30; |
| 4601 | 5478 | /** |
| 4602 | 5479 | * @typedef {Object} WPFixedWindowList |
| 4603 | 5480 | * |
| @@ -4656,9 +5533,9 @@ | ||
| 4656 | 5533 | if (!scrollContainer) { |
| 4657 | 5534 | return; |
| 4658 | 5535 | } |
| 4659 | 5536 | |
| 4660 | - const visibleItems = Math.ceil(scrollContainer.clientHeight / itemHeight); // Aim to keep opening list view fast, afterward we can optimize for scrolling | |
| 5537 | + const visibleItems = Math.ceil(scrollContainer.clientHeight / itemHeight); // Aim to keep opening list view fast, afterward we can optimize for scrolling. | |
| 4661 | 5538 | |
| 4662 | 5539 | const windowOverscan = initRender ? visibleItems : (_options$windowOversc = options === null || options === void 0 ? void 0 : options.windowOverscan) !== null && _options$windowOversc !== void 0 ? _options$windowOversc : visibleItems; |
| 4663 | 5540 | const firstViewableIndex = Math.floor(scrollContainer.scrollTop / itemHeight); |
| 4664 | 5541 | const start = Math.max(0, firstViewableIndex - windowOverscan); |
| @@ -4683,9 +5560,9 @@ | ||
| 4683 | 5560 | }); |
| 4684 | 5561 | }; |
| 4685 | 5562 | |
| 4686 | 5563 | measureWindow(true); |
| 4687 | - const debounceMeasureList = (0,external_lodash_namespaceObject.debounce)(() => { | |
| 5564 | + const debounceMeasureList = debounce(() => { | |
| 4688 | 5565 | measureWindow(); |
| 4689 | 5566 | }, 16); |
| 4690 | 5567 | scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.addEventListener('scroll', debounceMeasureList); |
| 4691 | 5568 | scrollContainer === null || scrollContainer === void 0 ? void 0 : (_scrollContainer$owne = scrollContainer.ownerDocument) === null || _scrollContainer$owne === void 0 ? void 0 : (_scrollContainer$owne2 = _scrollContainer$owne.defaultView) === null || _scrollContainer$owne2 === void 0 ? void 0 : _scrollContainer$owne2.addEventListener('resize', debounceMeasureList); |
| @@ -4748,24 +5625,26 @@ | ||
| 4748 | 5625 | }; |
| 4749 | 5626 | }, [totalItems, itemHeight, elementRef, fixedListWindow.visibleItems]); |
| 4750 | 5627 | return [fixedListWindow, setFixedListWindow]; |
| 4751 | 5628 | } |
| 4752 | -//# sourceMappingURL=index.js.map | |
| 5629 | + | |
| 4753 | 5630 | ;// CONCATENATED MODULE: ./packages/compose/build-module/index.js |
| 4754 | -// Utils | |
| 4755 | - // Compose helper (aliased flowRight from Lodash) | |
| 5631 | +// The `createHigherOrderComponent` helper and helper types. | |
| 5632 | + // The `debounce` helper and its types. | |
| 4756 | 5633 | |
| 4757 | - // Higher-order components | |
| 5634 | + // The `throttle` helper and its types. | |
| 4758 | 5635 | |
| 5636 | + // The `compose` and `pipe` helpers (inspired by `flowRight` and `flow` from Lodash). | |
| 4759 | 5637 | |
| 4760 | 5638 | |
| 5639 | + // Higher-order components. | |
| 4761 | 5640 | |
| 4762 | 5641 | |
| 4763 | 5642 | |
| 4764 | - // Hooks | |
| 4765 | 5643 | |
| 4766 | 5644 | |
| 4767 | 5645 | |
| 5646 | + // Hooks. | |
| 4768 | 5647 | |
| 4769 | 5648 | |
| 4770 | 5649 | |
| 4771 | 5650 | |
| @@ -4788,9 +5667,13 @@ | ||
| 4788 | 5667 | |
| 4789 | 5668 | |
| 4790 | 5669 | |
| 4791 | 5670 | |
| 4792 | -//# sourceMappingURL=index.js.map | |
| 4793 | -}(); | |
| 5671 | + | |
| 5672 | + | |
| 5673 | + | |
| 5674 | + | |
| 5675 | +})(); | |
| 5676 | + | |
| 4794 | 5677 | (window.wp = window.wp || {}).compose = __webpack_exports__; |
| 4795 | 5678 | /******/ })() |
| 4796 | 5679 | ; |