1 /******/ (function() { // webpackBootstrap |
1 /******/ (() => { // webpackBootstrap |
2 /******/ "use strict"; |
2 /******/ "use strict"; |
3 /******/ // The require scope |
3 /******/ // The require scope |
4 /******/ var __webpack_require__ = {}; |
4 /******/ var __webpack_require__ = {}; |
5 /******/ |
5 /******/ |
6 /************************************************************************/ |
6 /************************************************************************/ |
7 /******/ /* webpack/runtime/compat get default export */ |
7 /******/ /* webpack/runtime/compat get default export */ |
8 /******/ !function() { |
8 /******/ (() => { |
9 /******/ // getDefaultExport function for compatibility with non-harmony modules |
9 /******/ // getDefaultExport function for compatibility with non-harmony modules |
10 /******/ __webpack_require__.n = function(module) { |
10 /******/ __webpack_require__.n = (module) => { |
11 /******/ var getter = module && module.__esModule ? |
11 /******/ var getter = module && module.__esModule ? |
12 /******/ function() { return module['default']; } : |
12 /******/ () => (module['default']) : |
13 /******/ function() { return module; }; |
13 /******/ () => (module); |
14 /******/ __webpack_require__.d(getter, { a: getter }); |
14 /******/ __webpack_require__.d(getter, { a: getter }); |
15 /******/ return getter; |
15 /******/ return getter; |
16 /******/ }; |
16 /******/ }; |
17 /******/ }(); |
17 /******/ })(); |
18 /******/ |
18 /******/ |
19 /******/ /* webpack/runtime/define property getters */ |
19 /******/ /* webpack/runtime/define property getters */ |
20 /******/ !function() { |
20 /******/ (() => { |
21 /******/ // define getter functions for harmony exports |
21 /******/ // define getter functions for harmony exports |
22 /******/ __webpack_require__.d = function(exports, definition) { |
22 /******/ __webpack_require__.d = (exports, definition) => { |
23 /******/ for(var key in definition) { |
23 /******/ for(var key in definition) { |
24 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
24 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
25 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
25 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
26 /******/ } |
26 /******/ } |
27 /******/ } |
27 /******/ } |
28 /******/ }; |
28 /******/ }; |
29 /******/ }(); |
29 /******/ })(); |
30 /******/ |
30 /******/ |
31 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
31 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
32 /******/ !function() { |
32 /******/ (() => { |
33 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
33 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
34 /******/ }(); |
34 /******/ })(); |
35 /******/ |
35 /******/ |
36 /******/ /* webpack/runtime/make namespace object */ |
36 /******/ /* webpack/runtime/make namespace object */ |
37 /******/ !function() { |
37 /******/ (() => { |
38 /******/ // define __esModule on exports |
38 /******/ // define __esModule on exports |
39 /******/ __webpack_require__.r = function(exports) { |
39 /******/ __webpack_require__.r = (exports) => { |
40 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
40 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
41 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
41 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
42 /******/ } |
42 /******/ } |
43 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
43 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
44 /******/ }; |
44 /******/ }; |
45 /******/ }(); |
45 /******/ })(); |
46 /******/ |
46 /******/ |
47 /************************************************************************/ |
47 /************************************************************************/ |
48 var __webpack_exports__ = {}; |
48 var __webpack_exports__ = {}; |
49 // ESM COMPAT FLAG |
49 // ESM COMPAT FLAG |
50 __webpack_require__.r(__webpack_exports__); |
50 __webpack_require__.r(__webpack_exports__); |
51 |
51 |
52 // EXPORTS |
52 // EXPORTS |
53 __webpack_require__.d(__webpack_exports__, { |
53 __webpack_require__.d(__webpack_exports__, { |
54 "DotTip": function() { return /* reexport */ dot_tip; }, |
54 DotTip: () => (/* reexport */ dot_tip), |
55 "store": function() { return /* reexport */ store; } |
55 store: () => (/* reexport */ store) |
56 }); |
56 }); |
57 |
57 |
58 // NAMESPACE OBJECT: ./node_modules/@wordpress/nux/build-module/store/actions.js |
58 // NAMESPACE OBJECT: ./node_modules/@wordpress/nux/build-module/store/actions.js |
59 var actions_namespaceObject = {}; |
59 var actions_namespaceObject = {}; |
60 __webpack_require__.r(actions_namespaceObject); |
60 __webpack_require__.r(actions_namespaceObject); |
61 __webpack_require__.d(actions_namespaceObject, { |
61 __webpack_require__.d(actions_namespaceObject, { |
62 "disableTips": function() { return disableTips; }, |
62 disableTips: () => (disableTips), |
63 "dismissTip": function() { return dismissTip; }, |
63 dismissTip: () => (dismissTip), |
64 "enableTips": function() { return enableTips; }, |
64 enableTips: () => (enableTips), |
65 "triggerGuide": function() { return triggerGuide; } |
65 triggerGuide: () => (triggerGuide) |
66 }); |
66 }); |
67 |
67 |
68 // NAMESPACE OBJECT: ./node_modules/@wordpress/nux/build-module/store/selectors.js |
68 // NAMESPACE OBJECT: ./node_modules/@wordpress/nux/build-module/store/selectors.js |
69 var selectors_namespaceObject = {}; |
69 var selectors_namespaceObject = {}; |
70 __webpack_require__.r(selectors_namespaceObject); |
70 __webpack_require__.r(selectors_namespaceObject); |
71 __webpack_require__.d(selectors_namespaceObject, { |
71 __webpack_require__.d(selectors_namespaceObject, { |
72 "areTipsEnabled": function() { return selectors_areTipsEnabled; }, |
72 areTipsEnabled: () => (selectors_areTipsEnabled), |
73 "getAssociatedGuide": function() { return getAssociatedGuide; }, |
73 getAssociatedGuide: () => (getAssociatedGuide), |
74 "isTipVisible": function() { return isTipVisible; } |
74 isTipVisible: () => (isTipVisible) |
75 }); |
75 }); |
76 |
76 |
77 ;// CONCATENATED MODULE: external ["wp","deprecated"] |
77 ;// CONCATENATED MODULE: external ["wp","deprecated"] |
78 var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; |
78 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; |
79 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); |
79 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); |
80 ;// CONCATENATED MODULE: external ["wp","data"] |
80 ;// CONCATENATED MODULE: external ["wp","data"] |
81 var external_wp_data_namespaceObject = window["wp"]["data"]; |
81 const external_wp_data_namespaceObject = window["wp"]["data"]; |
82 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/reducer.js |
82 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/reducer.js |
83 /** |
83 /** |
84 * WordPress dependencies |
84 * WordPress dependencies |
85 */ |
85 */ |
|
86 |
86 |
87 |
87 /** |
88 /** |
88 * Reducer that tracks which tips are in a guide. Each guide is represented by |
89 * Reducer that tracks which tips are in a guide. Each guide is represented by |
89 * an array which contains the tip identifiers contained within that guide. |
90 * an array which contains the tip identifiers contained within that guide. |
90 * |
91 * |
91 * @param {Array} state Current state. |
92 * @param {Array} state Current state. |
92 * @param {Object} action Dispatched action. |
93 * @param {Object} action Dispatched action. |
93 * |
94 * |
94 * @return {Array} Updated state. |
95 * @return {Array} Updated state. |
95 */ |
96 */ |
96 |
97 function guides(state = [], action) { |
97 function guides() { |
|
98 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
|
99 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
100 |
|
101 switch (action.type) { |
98 switch (action.type) { |
102 case 'TRIGGER_GUIDE': |
99 case 'TRIGGER_GUIDE': |
103 return [...state, action.tipIds]; |
100 return [...state, action.tipIds]; |
104 } |
101 } |
105 |
|
106 return state; |
102 return state; |
107 } |
103 } |
|
104 |
108 /** |
105 /** |
109 * Reducer that tracks whether or not tips are globally enabled. |
106 * Reducer that tracks whether or not tips are globally enabled. |
110 * |
107 * |
111 * @param {boolean} state Current state. |
108 * @param {boolean} state Current state. |
112 * @param {Object} action Dispatched action. |
109 * @param {Object} action Dispatched action. |
113 * |
110 * |
114 * @return {boolean} Updated state. |
111 * @return {boolean} Updated state. |
115 */ |
112 */ |
116 |
113 function areTipsEnabled(state = true, action) { |
117 function areTipsEnabled() { |
|
118 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; |
|
119 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
120 |
|
121 switch (action.type) { |
114 switch (action.type) { |
122 case 'DISABLE_TIPS': |
115 case 'DISABLE_TIPS': |
123 return false; |
116 return false; |
124 |
|
125 case 'ENABLE_TIPS': |
117 case 'ENABLE_TIPS': |
126 return true; |
118 return true; |
127 } |
119 } |
128 |
|
129 return state; |
120 return state; |
130 } |
121 } |
|
122 |
131 /** |
123 /** |
132 * Reducer that tracks which tips have been dismissed. If the state object |
124 * Reducer that tracks which tips have been dismissed. If the state object |
133 * contains a tip identifier, then that tip is dismissed. |
125 * contains a tip identifier, then that tip is dismissed. |
134 * |
126 * |
135 * @param {Object} state Current state. |
127 * @param {Object} state Current state. |
136 * @param {Object} action Dispatched action. |
128 * @param {Object} action Dispatched action. |
137 * |
129 * |
138 * @return {Object} Updated state. |
130 * @return {Object} Updated state. |
139 */ |
131 */ |
140 |
132 function dismissedTips(state = {}, action) { |
141 function dismissedTips() { |
|
142 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
143 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
144 |
|
145 switch (action.type) { |
133 switch (action.type) { |
146 case 'DISMISS_TIP': |
134 case 'DISMISS_TIP': |
147 return { ...state, |
135 return { |
|
136 ...state, |
148 [action.id]: true |
137 [action.id]: true |
149 }; |
138 }; |
150 |
|
151 case 'ENABLE_TIPS': |
139 case 'ENABLE_TIPS': |
152 return {}; |
140 return {}; |
153 } |
141 } |
154 |
|
155 return state; |
142 return state; |
156 } |
143 } |
157 const preferences = (0,external_wp_data_namespaceObject.combineReducers)({ |
144 const preferences = (0,external_wp_data_namespaceObject.combineReducers)({ |
158 areTipsEnabled, |
145 areTipsEnabled, |
159 dismissedTips |
146 dismissedTips |
160 }); |
147 }); |
161 /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ |
148 /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ |
162 guides, |
149 guides, |
163 preferences |
150 preferences |
164 })); |
151 })); |
165 |
152 |
166 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/actions.js |
153 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/actions.js |
176 return { |
163 return { |
177 type: 'TRIGGER_GUIDE', |
164 type: 'TRIGGER_GUIDE', |
178 tipIds |
165 tipIds |
179 }; |
166 }; |
180 } |
167 } |
|
168 |
181 /** |
169 /** |
182 * Returns an action object that, when dispatched, dismisses the given tip. A |
170 * Returns an action object that, when dispatched, dismisses the given tip. A |
183 * dismissed tip will not show again. |
171 * dismissed tip will not show again. |
184 * |
172 * |
185 * @param {string} id The tip to dismiss. |
173 * @param {string} id The tip to dismiss. |
186 * |
174 * |
187 * @return {Object} Action object. |
175 * @return {Object} Action object. |
188 */ |
176 */ |
189 |
|
190 function dismissTip(id) { |
177 function dismissTip(id) { |
191 return { |
178 return { |
192 type: 'DISMISS_TIP', |
179 type: 'DISMISS_TIP', |
193 id |
180 id |
194 }; |
181 }; |
195 } |
182 } |
|
183 |
196 /** |
184 /** |
197 * Returns an action object that, when dispatched, prevents all tips from |
185 * Returns an action object that, when dispatched, prevents all tips from |
198 * showing again. |
186 * showing again. |
199 * |
187 * |
200 * @return {Object} Action object. |
188 * @return {Object} Action object. |
201 */ |
189 */ |
202 |
|
203 function disableTips() { |
190 function disableTips() { |
204 return { |
191 return { |
205 type: 'DISABLE_TIPS' |
192 type: 'DISABLE_TIPS' |
206 }; |
193 }; |
207 } |
194 } |
|
195 |
208 /** |
196 /** |
209 * Returns an action object that, when dispatched, makes all tips show again. |
197 * Returns an action object that, when dispatched, makes all tips show again. |
210 * |
198 * |
211 * @return {Object} Action object. |
199 * @return {Object} Action object. |
212 */ |
200 */ |
213 |
|
214 function enableTips() { |
201 function enableTips() { |
215 return { |
202 return { |
216 type: 'ENABLE_TIPS' |
203 type: 'ENABLE_TIPS' |
217 }; |
204 }; |
218 } |
205 } |
219 |
206 |
220 ;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js |
|
221 |
|
222 |
|
223 var LEAF_KEY, hasWeakMap; |
|
224 |
|
225 /** |
|
226 * Arbitrary value used as key for referencing cache object in WeakMap tree. |
|
227 * |
|
228 * @type {Object} |
|
229 */ |
|
230 LEAF_KEY = {}; |
|
231 |
|
232 /** |
|
233 * Whether environment supports WeakMap. |
|
234 * |
|
235 * @type {boolean} |
|
236 */ |
|
237 hasWeakMap = typeof WeakMap !== 'undefined'; |
|
238 |
|
239 /** |
|
240 * Returns the first argument as the sole entry in an array. |
|
241 * |
|
242 * @param {*} value Value to return. |
|
243 * |
|
244 * @return {Array} Value returned as entry in array. |
|
245 */ |
|
246 function arrayOf( value ) { |
|
247 return [ value ]; |
|
248 } |
|
249 |
|
250 /** |
|
251 * Returns true if the value passed is object-like, or false otherwise. A value |
|
252 * is object-like if it can support property assignment, e.g. object or array. |
|
253 * |
|
254 * @param {*} value Value to test. |
|
255 * |
|
256 * @return {boolean} Whether value is object-like. |
|
257 */ |
|
258 function isObjectLike( value ) { |
|
259 return !! value && 'object' === typeof value; |
|
260 } |
|
261 |
|
262 /** |
|
263 * Creates and returns a new cache object. |
|
264 * |
|
265 * @return {Object} Cache object. |
|
266 */ |
|
267 function createCache() { |
|
268 var cache = { |
|
269 clear: function() { |
|
270 cache.head = null; |
|
271 }, |
|
272 }; |
|
273 |
|
274 return cache; |
|
275 } |
|
276 |
|
277 /** |
|
278 * Returns true if entries within the two arrays are strictly equal by |
|
279 * reference from a starting index. |
|
280 * |
|
281 * @param {Array} a First array. |
|
282 * @param {Array} b Second array. |
|
283 * @param {number} fromIndex Index from which to start comparison. |
|
284 * |
|
285 * @return {boolean} Whether arrays are shallowly equal. |
|
286 */ |
|
287 function isShallowEqual( a, b, fromIndex ) { |
|
288 var i; |
|
289 |
|
290 if ( a.length !== b.length ) { |
|
291 return false; |
|
292 } |
|
293 |
|
294 for ( i = fromIndex; i < a.length; i++ ) { |
|
295 if ( a[ i ] !== b[ i ] ) { |
|
296 return false; |
|
297 } |
|
298 } |
|
299 |
|
300 return true; |
|
301 } |
|
302 |
|
303 /** |
|
304 * Returns a memoized selector function. The getDependants function argument is |
|
305 * called before the memoized selector and is expected to return an immutable |
|
306 * reference or array of references on which the selector depends for computing |
|
307 * its own return value. The memoize cache is preserved only as long as those |
|
308 * dependant references remain the same. If getDependants returns a different |
|
309 * reference(s), the cache is cleared and the selector value regenerated. |
|
310 * |
|
311 * @param {Function} selector Selector function. |
|
312 * @param {Function} getDependants Dependant getter returning an immutable |
|
313 * reference or array of reference used in |
|
314 * cache bust consideration. |
|
315 * |
|
316 * @return {Function} Memoized selector. |
|
317 */ |
|
318 /* harmony default export */ function rememo(selector, getDependants ) { |
|
319 var rootCache, getCache; |
|
320 |
|
321 // Use object source as dependant if getter not provided |
|
322 if ( ! getDependants ) { |
|
323 getDependants = arrayOf; |
|
324 } |
|
325 |
|
326 /** |
|
327 * Returns the root cache. If WeakMap is supported, this is assigned to the |
|
328 * root WeakMap cache set, otherwise it is a shared instance of the default |
|
329 * cache object. |
|
330 * |
|
331 * @return {(WeakMap|Object)} Root cache object. |
|
332 */ |
|
333 function getRootCache() { |
|
334 return rootCache; |
|
335 } |
|
336 |
|
337 /** |
|
338 * Returns the cache for a given dependants array. When possible, a WeakMap |
|
339 * will be used to create a unique cache for each set of dependants. This |
|
340 * is feasible due to the nature of WeakMap in allowing garbage collection |
|
341 * to occur on entries where the key object is no longer referenced. Since |
|
342 * WeakMap requires the key to be an object, this is only possible when the |
|
343 * dependant is object-like. The root cache is created as a hierarchy where |
|
344 * each top-level key is the first entry in a dependants set, the value a |
|
345 * WeakMap where each key is the next dependant, and so on. This continues |
|
346 * so long as the dependants are object-like. If no dependants are object- |
|
347 * like, then the cache is shared across all invocations. |
|
348 * |
|
349 * @see isObjectLike |
|
350 * |
|
351 * @param {Array} dependants Selector dependants. |
|
352 * |
|
353 * @return {Object} Cache object. |
|
354 */ |
|
355 function getWeakMapCache( dependants ) { |
|
356 var caches = rootCache, |
|
357 isUniqueByDependants = true, |
|
358 i, dependant, map, cache; |
|
359 |
|
360 for ( i = 0; i < dependants.length; i++ ) { |
|
361 dependant = dependants[ i ]; |
|
362 |
|
363 // Can only compose WeakMap from object-like key. |
|
364 if ( ! isObjectLike( dependant ) ) { |
|
365 isUniqueByDependants = false; |
|
366 break; |
|
367 } |
|
368 |
|
369 // Does current segment of cache already have a WeakMap? |
|
370 if ( caches.has( dependant ) ) { |
|
371 // Traverse into nested WeakMap. |
|
372 caches = caches.get( dependant ); |
|
373 } else { |
|
374 // Create, set, and traverse into a new one. |
|
375 map = new WeakMap(); |
|
376 caches.set( dependant, map ); |
|
377 caches = map; |
|
378 } |
|
379 } |
|
380 |
|
381 // We use an arbitrary (but consistent) object as key for the last item |
|
382 // in the WeakMap to serve as our running cache. |
|
383 if ( ! caches.has( LEAF_KEY ) ) { |
|
384 cache = createCache(); |
|
385 cache.isUniqueByDependants = isUniqueByDependants; |
|
386 caches.set( LEAF_KEY, cache ); |
|
387 } |
|
388 |
|
389 return caches.get( LEAF_KEY ); |
|
390 } |
|
391 |
|
392 // Assign cache handler by availability of WeakMap |
|
393 getCache = hasWeakMap ? getWeakMapCache : getRootCache; |
|
394 |
|
395 /** |
|
396 * Resets root memoization cache. |
|
397 */ |
|
398 function clear() { |
|
399 rootCache = hasWeakMap ? new WeakMap() : createCache(); |
|
400 } |
|
401 |
|
402 // eslint-disable-next-line jsdoc/check-param-names |
|
403 /** |
|
404 * The augmented selector call, considering first whether dependants have |
|
405 * changed before passing it to underlying memoize function. |
|
406 * |
|
407 * @param {Object} source Source object for derivation. |
|
408 * @param {...*} extraArgs Additional arguments to pass to selector. |
|
409 * |
|
410 * @return {*} Selector result. |
|
411 */ |
|
412 function callSelector( /* source, ...extraArgs */ ) { |
|
413 var len = arguments.length, |
|
414 cache, node, i, args, dependants; |
|
415 |
|
416 // Create copy of arguments (avoid leaking deoptimization). |
|
417 args = new Array( len ); |
|
418 for ( i = 0; i < len; i++ ) { |
|
419 args[ i ] = arguments[ i ]; |
|
420 } |
|
421 |
|
422 dependants = getDependants.apply( null, args ); |
|
423 cache = getCache( dependants ); |
|
424 |
|
425 // If not guaranteed uniqueness by dependants (primitive type or lack |
|
426 // of WeakMap support), shallow compare against last dependants and, if |
|
427 // references have changed, destroy cache to recalculate result. |
|
428 if ( ! cache.isUniqueByDependants ) { |
|
429 if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { |
|
430 cache.clear(); |
|
431 } |
|
432 |
|
433 cache.lastDependants = dependants; |
|
434 } |
|
435 |
|
436 node = cache.head; |
|
437 while ( node ) { |
|
438 // Check whether node arguments match arguments |
|
439 if ( ! isShallowEqual( node.args, args, 1 ) ) { |
|
440 node = node.next; |
|
441 continue; |
|
442 } |
|
443 |
|
444 // At this point we can assume we've found a match |
|
445 |
|
446 // Surface matched node to head if not already |
|
447 if ( node !== cache.head ) { |
|
448 // Adjust siblings to point to each other. |
|
449 node.prev.next = node.next; |
|
450 if ( node.next ) { |
|
451 node.next.prev = node.prev; |
|
452 } |
|
453 |
|
454 node.next = cache.head; |
|
455 node.prev = null; |
|
456 cache.head.prev = node; |
|
457 cache.head = node; |
|
458 } |
|
459 |
|
460 // Return immediately |
|
461 return node.val; |
|
462 } |
|
463 |
|
464 // No cached value found. Continue to insertion phase: |
|
465 |
|
466 node = { |
|
467 // Generate the result from original function |
|
468 val: selector.apply( null, args ), |
|
469 }; |
|
470 |
|
471 // Avoid including the source object in the cache. |
|
472 args[ 0 ] = null; |
|
473 node.args = args; |
|
474 |
|
475 // Don't need to check whether node is already head, since it would |
|
476 // have been returned above already if it was |
|
477 |
|
478 // Shift existing head down list |
|
479 if ( cache.head ) { |
|
480 cache.head.prev = node; |
|
481 node.next = cache.head; |
|
482 } |
|
483 |
|
484 cache.head = node; |
|
485 |
|
486 return node.val; |
|
487 } |
|
488 |
|
489 callSelector.getDependants = getDependants; |
|
490 callSelector.clear = clear; |
|
491 clear(); |
|
492 |
|
493 return callSelector; |
|
494 } |
|
495 |
|
496 ;// CONCATENATED MODULE: external "lodash" |
|
497 var external_lodash_namespaceObject = window["lodash"]; |
|
498 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/selectors.js |
207 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/selectors.js |
499 /** |
208 /** |
500 * External dependencies |
209 * WordPress dependencies |
501 */ |
210 */ |
502 |
211 |
503 |
212 |
504 /** |
213 /** |
505 * An object containing information about a guide. |
214 * An object containing information about a guide. |
517 * @param {Object} state Global application state. |
226 * @param {Object} state Global application state. |
518 * @param {string} tipId The tip to query. |
227 * @param {string} tipId The tip to query. |
519 * |
228 * |
520 * @return {?NUXGuideInfo} Information about the associated guide. |
229 * @return {?NUXGuideInfo} Information about the associated guide. |
521 */ |
230 */ |
522 |
231 const getAssociatedGuide = (0,external_wp_data_namespaceObject.createSelector)((state, tipId) => { |
523 const getAssociatedGuide = rememo((state, tipId) => { |
|
524 for (const tipIds of state.guides) { |
232 for (const tipIds of state.guides) { |
525 if ((0,external_lodash_namespaceObject.includes)(tipIds, tipId)) { |
233 if (tipIds.includes(tipId)) { |
526 const nonDismissedTips = (0,external_lodash_namespaceObject.difference)(tipIds, (0,external_lodash_namespaceObject.keys)(state.preferences.dismissedTips)); |
234 const nonDismissedTips = tipIds.filter(tId => !Object.keys(state.preferences.dismissedTips).includes(tId)); |
527 const [currentTipId = null, nextTipId = null] = nonDismissedTips; |
235 const [currentTipId = null, nextTipId = null] = nonDismissedTips; |
528 return { |
236 return { |
529 tipIds, |
237 tipIds, |
530 currentTipId, |
238 currentTipId, |
531 nextTipId |
239 nextTipId |
532 }; |
240 }; |
533 } |
241 } |
534 } |
242 } |
535 |
|
536 return null; |
243 return null; |
537 }, state => [state.guides, state.preferences.dismissedTips]); |
244 }, state => [state.guides, state.preferences.dismissedTips]); |
|
245 |
538 /** |
246 /** |
539 * Determines whether or not the given tip is showing. Tips are hidden if they |
247 * Determines whether or not the given tip is showing. Tips are hidden if they |
540 * are disabled, have been dismissed, or are not the current tip in any |
248 * are disabled, have been dismissed, or are not the current tip in any |
541 * guide that they have been added to. |
249 * guide that they have been added to. |
542 * |
250 * |
543 * @param {Object} state Global application state. |
251 * @param {Object} state Global application state. |
544 * @param {string} tipId The tip to query. |
252 * @param {string} tipId The tip to query. |
545 * |
253 * |
546 * @return {boolean} Whether or not the given tip is showing. |
254 * @return {boolean} Whether or not the given tip is showing. |
547 */ |
255 */ |
548 |
|
549 function isTipVisible(state, tipId) { |
256 function isTipVisible(state, tipId) { |
550 if (!state.preferences.areTipsEnabled) { |
257 if (!state.preferences.areTipsEnabled) { |
551 return false; |
258 return false; |
552 } |
259 } |
553 |
260 if (state.preferences.dismissedTips?.hasOwnProperty(tipId)) { |
554 if ((0,external_lodash_namespaceObject.has)(state.preferences.dismissedTips, [tipId])) { |
|
555 return false; |
261 return false; |
556 } |
262 } |
557 |
|
558 const associatedGuide = getAssociatedGuide(state, tipId); |
263 const associatedGuide = getAssociatedGuide(state, tipId); |
559 |
|
560 if (associatedGuide && associatedGuide.currentTipId !== tipId) { |
264 if (associatedGuide && associatedGuide.currentTipId !== tipId) { |
561 return false; |
265 return false; |
562 } |
266 } |
563 |
|
564 return true; |
267 return true; |
565 } |
268 } |
|
269 |
566 /** |
270 /** |
567 * Returns whether or not tips are globally enabled. |
271 * Returns whether or not tips are globally enabled. |
568 * |
272 * |
569 * @param {Object} state Global application state. |
273 * @param {Object} state Global application state. |
570 * |
274 * |
571 * @return {boolean} Whether tips are globally enabled. |
275 * @return {boolean} Whether tips are globally enabled. |
572 */ |
276 */ |
573 |
|
574 function selectors_areTipsEnabled(state) { |
277 function selectors_areTipsEnabled(state) { |
575 return state.preferences.areTipsEnabled; |
278 return state.preferences.areTipsEnabled; |
576 } |
279 } |
577 |
280 |
578 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/index.js |
281 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/index.js |
579 /** |
282 /** |
580 * WordPress dependencies |
283 * WordPress dependencies |
581 */ |
284 */ |
582 |
285 |
|
286 |
583 /** |
287 /** |
584 * Internal dependencies |
288 * Internal dependencies |
585 */ |
289 */ |
586 |
290 |
587 |
291 |
588 |
292 |
589 |
|
590 const STORE_NAME = 'core/nux'; |
293 const STORE_NAME = 'core/nux'; |
|
294 |
591 /** |
295 /** |
592 * Store definition for the nux namespace. |
296 * Store definition for the nux namespace. |
593 * |
297 * |
594 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
298 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
595 * |
299 * |
596 * @type {Object} |
300 * @type {Object} |
597 */ |
301 */ |
598 |
|
599 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { |
302 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { |
600 reducer: reducer, |
303 reducer: reducer, |
601 actions: actions_namespaceObject, |
304 actions: actions_namespaceObject, |
602 selectors: selectors_namespaceObject, |
305 selectors: selectors_namespaceObject, |
603 persist: ['preferences'] |
306 persist: ['preferences'] |
604 }); // Once we build a more generic persistence plugin that works across types of stores |
307 }); |
|
308 |
|
309 // Once we build a more generic persistence plugin that works across types of stores |
605 // we'd be able to replace this with a register call. |
310 // we'd be able to replace this with a register call. |
606 |
|
607 (0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, { |
311 (0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, { |
608 reducer: reducer, |
312 reducer: reducer, |
609 actions: actions_namespaceObject, |
313 actions: actions_namespaceObject, |
610 selectors: selectors_namespaceObject, |
314 selectors: selectors_namespaceObject, |
611 persist: ['preferences'] |
315 persist: ['preferences'] |
612 }); |
316 }); |
613 |
317 |
|
318 ;// CONCATENATED MODULE: external ["wp","compose"] |
|
319 const external_wp_compose_namespaceObject = window["wp"]["compose"]; |
|
320 ;// CONCATENATED MODULE: external ["wp","components"] |
|
321 const external_wp_components_namespaceObject = window["wp"]["components"]; |
|
322 ;// CONCATENATED MODULE: external ["wp","i18n"] |
|
323 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
614 ;// CONCATENATED MODULE: external ["wp","element"] |
324 ;// CONCATENATED MODULE: external ["wp","element"] |
615 var external_wp_element_namespaceObject = window["wp"]["element"]; |
325 const external_wp_element_namespaceObject = window["wp"]["element"]; |
616 ;// CONCATENATED MODULE: external ["wp","compose"] |
|
617 var external_wp_compose_namespaceObject = window["wp"]["compose"]; |
|
618 ;// CONCATENATED MODULE: external ["wp","components"] |
|
619 var external_wp_components_namespaceObject = window["wp"]["components"]; |
|
620 ;// CONCATENATED MODULE: external ["wp","i18n"] |
|
621 var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
|
622 ;// CONCATENATED MODULE: external ["wp","primitives"] |
326 ;// CONCATENATED MODULE: external ["wp","primitives"] |
623 var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
327 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
|
328 ;// CONCATENATED MODULE: external "ReactJSXRuntime" |
|
329 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; |
624 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js |
330 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js |
625 |
331 /** |
626 |
332 * WordPress dependencies |
627 /** |
333 */ |
628 * WordPress dependencies |
334 |
629 */ |
335 |
630 |
336 const close_close = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { |
631 const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
632 xmlns: "http://www.w3.org/2000/svg", |
337 xmlns: "http://www.w3.org/2000/svg", |
633 viewBox: "0 0 24 24" |
338 viewBox: "0 0 24 24", |
634 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
339 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { |
635 d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" |
340 d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" |
636 })); |
341 }) |
637 /* harmony default export */ var library_close = (close_close); |
342 }); |
|
343 /* harmony default export */ const library_close = (close_close); |
638 |
344 |
639 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/components/dot-tip/index.js |
345 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/components/dot-tip/index.js |
640 |
346 /** |
641 |
347 * WordPress dependencies |
642 /** |
348 */ |
643 * WordPress dependencies |
349 |
644 */ |
|
645 |
350 |
646 |
351 |
647 |
352 |
648 |
353 |
649 |
354 |
657 function onClick(event) { |
362 function onClick(event) { |
658 // Tips are often nested within buttons. We stop propagation so that clicking |
363 // Tips are often nested within buttons. We stop propagation so that clicking |
659 // on a tip doesn't result in the button being clicked. |
364 // on a tip doesn't result in the button being clicked. |
660 event.stopPropagation(); |
365 event.stopPropagation(); |
661 } |
366 } |
662 |
367 function DotTip({ |
663 function DotTip(_ref) { |
368 position = 'middle right', |
664 let { |
369 children, |
665 position = 'middle right', |
370 isVisible, |
666 children, |
371 hasNextTip, |
667 isVisible, |
372 onDismiss, |
668 hasNextTip, |
373 onDisable |
669 onDismiss, |
374 }) { |
670 onDisable |
|
671 } = _ref; |
|
672 const anchorParent = (0,external_wp_element_namespaceObject.useRef)(null); |
375 const anchorParent = (0,external_wp_element_namespaceObject.useRef)(null); |
673 const onFocusOutsideCallback = (0,external_wp_element_namespaceObject.useCallback)(event => { |
376 const onFocusOutsideCallback = (0,external_wp_element_namespaceObject.useCallback)(event => { |
674 if (!anchorParent.current) { |
377 if (!anchorParent.current) { |
675 return; |
378 return; |
676 } |
379 } |
677 |
|
678 if (anchorParent.current.contains(event.relatedTarget)) { |
380 if (anchorParent.current.contains(event.relatedTarget)) { |
679 return; |
381 return; |
680 } |
382 } |
681 |
|
682 onDisable(); |
383 onDisable(); |
683 }, [onDisable, anchorParent]); |
384 }, [onDisable, anchorParent]); |
684 |
|
685 if (!isVisible) { |
385 if (!isVisible) { |
686 return null; |
386 return null; |
687 } |
387 } |
688 |
388 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Popover, { |
689 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, { |
|
690 className: "nux-dot-tip", |
389 className: "nux-dot-tip", |
691 position: position, |
390 position: position, |
692 noArrow: true, |
391 focusOnMount: true, |
693 focusOnMount: "container", |
|
694 shouldAnchorIncludePadding: true, |
|
695 role: "dialog", |
392 role: "dialog", |
696 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Editor tips'), |
393 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Editor tips'), |
697 onClick: onClick, |
394 onClick: onClick, |
698 onFocusOutside: onFocusOutsideCallback |
395 onFocusOutside: onFocusOutsideCallback, |
699 }, (0,external_wp_element_namespaceObject.createElement)("p", null, children), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
396 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { |
700 variant: "link", |
397 children: children |
701 onClick: onDismiss |
398 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { |
702 }, hasNextTip ? (0,external_wp_i18n_namespaceObject.__)('See next tip') : (0,external_wp_i18n_namespaceObject.__)('Got it'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
399 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { |
703 className: "nux-dot-tip__disable", |
400 variant: "link", |
704 icon: library_close, |
401 onClick: onDismiss, |
705 label: (0,external_wp_i18n_namespaceObject.__)('Disable tips'), |
402 children: hasNextTip ? (0,external_wp_i18n_namespaceObject.__)('See next tip') : (0,external_wp_i18n_namespaceObject.__)('Got it') |
706 onClick: onDisable |
403 }) |
707 })); |
404 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { |
708 } |
405 className: "nux-dot-tip__disable", |
709 /* harmony default export */ var dot_tip = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => { |
406 icon: library_close, |
710 let { |
407 label: (0,external_wp_i18n_namespaceObject.__)('Disable tips'), |
711 tipId |
408 onClick: onDisable |
712 } = _ref2; |
409 })] |
|
410 }); |
|
411 } |
|
412 /* harmony default export */ const dot_tip = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, { |
|
413 tipId |
|
414 }) => { |
713 const { |
415 const { |
714 isTipVisible, |
416 isTipVisible, |
715 getAssociatedGuide |
417 getAssociatedGuide |
716 } = select(store); |
418 } = select(store); |
717 const associatedGuide = getAssociatedGuide(tipId); |
419 const associatedGuide = getAssociatedGuide(tipId); |
718 return { |
420 return { |
719 isVisible: isTipVisible(tipId), |
421 isVisible: isTipVisible(tipId), |
720 hasNextTip: !!(associatedGuide && associatedGuide.nextTipId) |
422 hasNextTip: !!(associatedGuide && associatedGuide.nextTipId) |
721 }; |
423 }; |
722 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => { |
424 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { |
723 let { |
425 tipId |
724 tipId |
426 }) => { |
725 } = _ref3; |
|
726 const { |
427 const { |
727 dismissTip, |
428 dismissTip, |
728 disableTips |
429 disableTips |
729 } = dispatch(store); |
430 } = dispatch(store); |
730 return { |
431 return { |
731 onDismiss() { |
432 onDismiss() { |
732 dismissTip(tipId); |
433 dismissTip(tipId); |
733 }, |
434 }, |
734 |
|
735 onDisable() { |
435 onDisable() { |
736 disableTips(); |
436 disableTips(); |
737 } |
437 } |
738 |
|
739 }; |
438 }; |
740 }))(DotTip)); |
439 }))(DotTip)); |
741 |
440 |
742 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/index.js |
441 ;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/index.js |
743 /** |
442 /** |