19
|
1 |
/******/ (function() { // webpackBootstrap |
|
2 |
/******/ "use strict"; |
|
3 |
/******/ // The require scope |
|
4 |
/******/ var __webpack_require__ = {}; |
|
5 |
/******/ |
|
6 |
/************************************************************************/ |
|
7 |
/******/ /* webpack/runtime/compat get default export */ |
|
8 |
/******/ !function() { |
|
9 |
/******/ // getDefaultExport function for compatibility with non-harmony modules |
|
10 |
/******/ __webpack_require__.n = function(module) { |
|
11 |
/******/ var getter = module && module.__esModule ? |
|
12 |
/******/ function() { return module['default']; } : |
|
13 |
/******/ function() { return module; }; |
|
14 |
/******/ __webpack_require__.d(getter, { a: getter }); |
|
15 |
/******/ return getter; |
9
|
16 |
/******/ }; |
19
|
17 |
/******/ }(); |
|
18 |
/******/ |
|
19 |
/******/ /* webpack/runtime/define property getters */ |
|
20 |
/******/ !function() { |
|
21 |
/******/ // define getter functions for harmony exports |
|
22 |
/******/ __webpack_require__.d = function(exports, definition) { |
|
23 |
/******/ for(var key in definition) { |
|
24 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
|
25 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
|
26 |
/******/ } |
|
27 |
/******/ } |
|
28 |
/******/ }; |
|
29 |
/******/ }(); |
|
30 |
/******/ |
|
31 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
|
32 |
/******/ !function() { |
|
33 |
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
|
34 |
/******/ }(); |
|
35 |
/******/ |
|
36 |
/******/ /* webpack/runtime/make namespace object */ |
|
37 |
/******/ !function() { |
|
38 |
/******/ // define __esModule on exports |
|
39 |
/******/ __webpack_require__.r = function(exports) { |
|
40 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|
41 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
42 |
/******/ } |
|
43 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
44 |
/******/ }; |
|
45 |
/******/ }(); |
|
46 |
/******/ |
9
|
47 |
/************************************************************************/ |
19
|
48 |
var __webpack_exports__ = {}; |
18
|
49 |
// ESM COMPAT FLAG |
|
50 |
__webpack_require__.r(__webpack_exports__); |
9
|
51 |
|
16
|
52 |
// EXPORTS |
19
|
53 |
__webpack_require__.d(__webpack_exports__, { |
|
54 |
"DotTip": function() { return /* reexport */ dot_tip; }, |
|
55 |
"store": function() { return /* reexport */ store; } |
|
56 |
}); |
18
|
57 |
|
|
58 |
// NAMESPACE OBJECT: ./node_modules/@wordpress/nux/build-module/store/actions.js |
|
59 |
var actions_namespaceObject = {}; |
|
60 |
__webpack_require__.r(actions_namespaceObject); |
19
|
61 |
__webpack_require__.d(actions_namespaceObject, { |
|
62 |
"disableTips": function() { return disableTips; }, |
|
63 |
"dismissTip": function() { return dismissTip; }, |
|
64 |
"enableTips": function() { return enableTips; }, |
|
65 |
"triggerGuide": function() { return triggerGuide; } |
|
66 |
}); |
18
|
67 |
|
|
68 |
// NAMESPACE OBJECT: ./node_modules/@wordpress/nux/build-module/store/selectors.js |
|
69 |
var selectors_namespaceObject = {}; |
|
70 |
__webpack_require__.r(selectors_namespaceObject); |
19
|
71 |
__webpack_require__.d(selectors_namespaceObject, { |
|
72 |
"areTipsEnabled": function() { return selectors_areTipsEnabled; }, |
|
73 |
"getAssociatedGuide": function() { return getAssociatedGuide; }, |
|
74 |
"isTipVisible": function() { return isTipVisible; } |
|
75 |
}); |
9
|
76 |
|
19
|
77 |
;// CONCATENATED MODULE: external ["wp","deprecated"] |
|
78 |
var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; |
|
79 |
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); |
|
80 |
;// CONCATENATED MODULE: external ["wp","data"] |
|
81 |
var external_wp_data_namespaceObject = window["wp"]["data"]; |
|
82 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/reducer.js |
18
|
83 |
/** |
|
84 |
* WordPress dependencies |
|
85 |
*/ |
|
86 |
|
|
87 |
/** |
|
88 |
* 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 |
* |
19
|
91 |
* @param {Array} state Current state. |
18
|
92 |
* @param {Object} action Dispatched action. |
|
93 |
* |
|
94 |
* @return {Array} Updated state. |
|
95 |
*/ |
9
|
96 |
|
19
|
97 |
function guides() { |
|
98 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
|
99 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
|
100 |
|
18
|
101 |
switch (action.type) { |
|
102 |
case 'TRIGGER_GUIDE': |
|
103 |
return [...state, action.tipIds]; |
|
104 |
} |
|
105 |
|
|
106 |
return state; |
|
107 |
} |
|
108 |
/** |
|
109 |
* Reducer that tracks whether or not tips are globally enabled. |
|
110 |
* |
19
|
111 |
* @param {boolean} state Current state. |
|
112 |
* @param {Object} action Dispatched action. |
18
|
113 |
* |
|
114 |
* @return {boolean} Updated state. |
|
115 |
*/ |
|
116 |
|
19
|
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 |
|
18
|
121 |
switch (action.type) { |
|
122 |
case 'DISABLE_TIPS': |
|
123 |
return false; |
|
124 |
|
|
125 |
case 'ENABLE_TIPS': |
|
126 |
return true; |
|
127 |
} |
|
128 |
|
|
129 |
return state; |
|
130 |
} |
|
131 |
/** |
|
132 |
* Reducer that tracks which tips have been dismissed. If the state object |
|
133 |
* contains a tip identifier, then that tip is dismissed. |
|
134 |
* |
|
135 |
* @param {Object} state Current state. |
|
136 |
* @param {Object} action Dispatched action. |
|
137 |
* |
|
138 |
* @return {Object} Updated state. |
|
139 |
*/ |
|
140 |
|
19
|
141 |
function dismissedTips() { |
|
142 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
143 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
|
144 |
|
18
|
145 |
switch (action.type) { |
|
146 |
case 'DISMISS_TIP': |
|
147 |
return { ...state, |
|
148 |
[action.id]: true |
|
149 |
}; |
|
150 |
|
|
151 |
case 'ENABLE_TIPS': |
|
152 |
return {}; |
|
153 |
} |
9
|
154 |
|
18
|
155 |
return state; |
|
156 |
} |
19
|
157 |
const preferences = (0,external_wp_data_namespaceObject.combineReducers)({ |
18
|
158 |
areTipsEnabled, |
|
159 |
dismissedTips |
|
160 |
}); |
19
|
161 |
/* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ |
18
|
162 |
guides, |
|
163 |
preferences |
|
164 |
})); |
|
165 |
|
19
|
166 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/actions.js |
18
|
167 |
/** |
|
168 |
* Returns an action object that, when dispatched, presents a guide that takes |
|
169 |
* the user through a series of tips step by step. |
|
170 |
* |
|
171 |
* @param {string[]} tipIds Which tips to show in the guide. |
|
172 |
* |
|
173 |
* @return {Object} Action object. |
|
174 |
*/ |
|
175 |
function triggerGuide(tipIds) { |
|
176 |
return { |
|
177 |
type: 'TRIGGER_GUIDE', |
|
178 |
tipIds |
|
179 |
}; |
|
180 |
} |
|
181 |
/** |
|
182 |
* Returns an action object that, when dispatched, dismisses the given tip. A |
|
183 |
* dismissed tip will not show again. |
|
184 |
* |
|
185 |
* @param {string} id The tip to dismiss. |
|
186 |
* |
|
187 |
* @return {Object} Action object. |
|
188 |
*/ |
|
189 |
|
|
190 |
function dismissTip(id) { |
|
191 |
return { |
|
192 |
type: 'DISMISS_TIP', |
|
193 |
id |
|
194 |
}; |
|
195 |
} |
|
196 |
/** |
|
197 |
* Returns an action object that, when dispatched, prevents all tips from |
|
198 |
* showing again. |
|
199 |
* |
|
200 |
* @return {Object} Action object. |
|
201 |
*/ |
9
|
202 |
|
18
|
203 |
function disableTips() { |
|
204 |
return { |
|
205 |
type: 'DISABLE_TIPS' |
|
206 |
}; |
|
207 |
} |
|
208 |
/** |
|
209 |
* Returns an action object that, when dispatched, makes all tips show again. |
|
210 |
* |
|
211 |
* @return {Object} Action object. |
|
212 |
*/ |
|
213 |
|
|
214 |
function enableTips() { |
|
215 |
return { |
|
216 |
type: 'ENABLE_TIPS' |
|
217 |
}; |
|
218 |
} |
|
219 |
|
19
|
220 |
;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js |
9
|
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 |
*/ |
19
|
318 |
/* harmony default export */ function rememo(selector, getDependants ) { |
9
|
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; |
19
|
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 |
|
499 |
/** |
|
500 |
* External dependencies |
|
501 |
*/ |
9
|
502 |
|
|
503 |
|
19
|
504 |
/** |
|
505 |
* An object containing information about a guide. |
|
506 |
* |
|
507 |
* @typedef {Object} NUXGuideInfo |
|
508 |
* @property {string[]} tipIds Which tips the guide contains. |
|
509 |
* @property {?string} currentTipId The guide's currently showing tip. |
|
510 |
* @property {?string} nextTipId The guide's next tip to show. |
|
511 |
*/ |
|
512 |
|
|
513 |
/** |
|
514 |
* Returns an object describing the guide, if any, that the given tip is a part |
|
515 |
* of. |
|
516 |
* |
|
517 |
* @param {Object} state Global application state. |
|
518 |
* @param {string} tipId The tip to query. |
|
519 |
* |
|
520 |
* @return {?NUXGuideInfo} Information about the associated guide. |
|
521 |
*/ |
9
|
522 |
|
19
|
523 |
const getAssociatedGuide = rememo((state, tipId) => { |
|
524 |
for (const tipIds of state.guides) { |
|
525 |
if ((0,external_lodash_namespaceObject.includes)(tipIds, tipId)) { |
|
526 |
const nonDismissedTips = (0,external_lodash_namespaceObject.difference)(tipIds, (0,external_lodash_namespaceObject.keys)(state.preferences.dismissedTips)); |
|
527 |
const [currentTipId = null, nextTipId = null] = nonDismissedTips; |
|
528 |
return { |
|
529 |
tipIds, |
|
530 |
currentTipId, |
|
531 |
nextTipId |
|
532 |
}; |
|
533 |
} |
|
534 |
} |
18
|
535 |
|
19
|
536 |
return null; |
|
537 |
}, state => [state.guides, state.preferences.dismissedTips]); |
|
538 |
/** |
|
539 |
* 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 |
|
541 |
* guide that they have been added to. |
|
542 |
* |
|
543 |
* @param {Object} state Global application state. |
|
544 |
* @param {string} tipId The tip to query. |
|
545 |
* |
|
546 |
* @return {boolean} Whether or not the given tip is showing. |
|
547 |
*/ |
18
|
548 |
|
19
|
549 |
function isTipVisible(state, tipId) { |
|
550 |
if (!state.preferences.areTipsEnabled) { |
|
551 |
return false; |
|
552 |
} |
|
553 |
|
|
554 |
if ((0,external_lodash_namespaceObject.has)(state.preferences.dismissedTips, [tipId])) { |
|
555 |
return false; |
|
556 |
} |
|
557 |
|
|
558 |
const associatedGuide = getAssociatedGuide(state, tipId); |
|
559 |
|
|
560 |
if (associatedGuide && associatedGuide.currentTipId !== tipId) { |
|
561 |
return false; |
|
562 |
} |
18
|
563 |
|
19
|
564 |
return true; |
|
565 |
} |
|
566 |
/** |
|
567 |
* Returns whether or not tips are globally enabled. |
|
568 |
* |
|
569 |
* @param {Object} state Global application state. |
|
570 |
* |
|
571 |
* @return {boolean} Whether tips are globally enabled. |
|
572 |
*/ |
|
573 |
|
|
574 |
function selectors_areTipsEnabled(state) { |
|
575 |
return state.preferences.areTipsEnabled; |
|
576 |
} |
|
577 |
|
|
578 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/index.js |
|
579 |
/** |
|
580 |
* WordPress dependencies |
|
581 |
*/ |
|
582 |
|
|
583 |
/** |
|
584 |
* Internal dependencies |
|
585 |
*/ |
|
586 |
|
|
587 |
|
|
588 |
|
9
|
589 |
|
19
|
590 |
const STORE_NAME = 'core/nux'; |
|
591 |
/** |
|
592 |
* Store definition for the nux namespace. |
|
593 |
* |
|
594 |
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
|
595 |
* |
|
596 |
* @type {Object} |
|
597 |
*/ |
|
598 |
|
|
599 |
const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { |
|
600 |
reducer: reducer, |
|
601 |
actions: actions_namespaceObject, |
|
602 |
selectors: selectors_namespaceObject, |
|
603 |
persist: ['preferences'] |
|
604 |
}); // 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. |
|
606 |
|
|
607 |
(0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, { |
|
608 |
reducer: reducer, |
|
609 |
actions: actions_namespaceObject, |
|
610 |
selectors: selectors_namespaceObject, |
|
611 |
persist: ['preferences'] |
|
612 |
}); |
|
613 |
|
|
614 |
;// CONCATENATED MODULE: external ["wp","element"] |
|
615 |
var 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"] |
|
623 |
var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
|
624 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js |
9
|
625 |
|
|
626 |
|
|
627 |
/** |
|
628 |
* WordPress dependencies |
|
629 |
*/ |
|
630 |
|
19
|
631 |
const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
18
|
632 |
xmlns: "http://www.w3.org/2000/svg", |
|
633 |
viewBox: "0 0 24 24" |
19
|
634 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
18
|
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" |
|
636 |
})); |
19
|
637 |
/* harmony default export */ var library_close = (close_close); |
|
638 |
|
|
639 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/components/dot-tip/index.js |
|
640 |
|
|
641 |
|
|
642 |
/** |
|
643 |
* WordPress dependencies |
|
644 |
*/ |
|
645 |
|
|
646 |
|
|
647 |
|
|
648 |
|
|
649 |
|
|
650 |
|
|
651 |
/** |
|
652 |
* Internal dependencies |
|
653 |
*/ |
|
654 |
|
9
|
655 |
|
|
656 |
|
19
|
657 |
function onClick(event) { |
|
658 |
// Tips are often nested within buttons. We stop propagation so that clicking |
|
659 |
// on a tip doesn't result in the button being clicked. |
|
660 |
event.stopPropagation(); |
|
661 |
} |
|
662 |
|
|
663 |
function DotTip(_ref) { |
|
664 |
let { |
|
665 |
position = 'middle right', |
|
666 |
children, |
|
667 |
isVisible, |
|
668 |
hasNextTip, |
|
669 |
onDismiss, |
|
670 |
onDisable |
|
671 |
} = _ref; |
|
672 |
const anchorParent = (0,external_wp_element_namespaceObject.useRef)(null); |
|
673 |
const onFocusOutsideCallback = (0,external_wp_element_namespaceObject.useCallback)(event => { |
|
674 |
if (!anchorParent.current) { |
|
675 |
return; |
|
676 |
} |
|
677 |
|
|
678 |
if (anchorParent.current.contains(event.relatedTarget)) { |
|
679 |
return; |
|
680 |
} |
|
681 |
|
|
682 |
onDisable(); |
|
683 |
}, [onDisable, anchorParent]); |
|
684 |
|
|
685 |
if (!isVisible) { |
|
686 |
return null; |
|
687 |
} |
9
|
688 |
|
19
|
689 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, { |
|
690 |
className: "nux-dot-tip", |
|
691 |
position: position, |
|
692 |
noArrow: true, |
|
693 |
focusOnMount: "container", |
|
694 |
shouldAnchorIncludePadding: true, |
|
695 |
role: "dialog", |
|
696 |
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Editor tips'), |
|
697 |
onClick: onClick, |
|
698 |
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, { |
|
700 |
variant: "link", |
|
701 |
onClick: onDismiss |
|
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, { |
|
703 |
className: "nux-dot-tip__disable", |
|
704 |
icon: library_close, |
|
705 |
label: (0,external_wp_i18n_namespaceObject.__)('Disable tips'), |
|
706 |
onClick: onDisable |
|
707 |
})); |
|
708 |
} |
|
709 |
/* harmony default export */ var dot_tip = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => { |
|
710 |
let { |
|
711 |
tipId |
|
712 |
} = _ref2; |
|
713 |
const { |
|
714 |
isTipVisible, |
|
715 |
getAssociatedGuide |
|
716 |
} = select(store); |
|
717 |
const associatedGuide = getAssociatedGuide(tipId); |
|
718 |
return { |
|
719 |
isVisible: isTipVisible(tipId), |
|
720 |
hasNextTip: !!(associatedGuide && associatedGuide.nextTipId) |
|
721 |
}; |
|
722 |
}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => { |
|
723 |
let { |
|
724 |
tipId |
|
725 |
} = _ref3; |
|
726 |
const { |
|
727 |
dismissTip, |
|
728 |
disableTips |
|
729 |
} = dispatch(store); |
|
730 |
return { |
|
731 |
onDismiss() { |
|
732 |
dismissTip(tipId); |
|
733 |
}, |
|
734 |
|
|
735 |
onDisable() { |
|
736 |
disableTips(); |
|
737 |
} |
|
738 |
|
|
739 |
}; |
|
740 |
}))(DotTip)); |
|
741 |
|
|
742 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/index.js |
|
743 |
/** |
|
744 |
* WordPress dependencies |
|
745 |
*/ |
|
746 |
|
|
747 |
|
|
748 |
|
|
749 |
external_wp_deprecated_default()('wp.nux', { |
|
750 |
since: '5.4', |
|
751 |
hint: 'wp.components.Guide can be used to show a user guide.', |
|
752 |
version: '6.2' |
|
753 |
}); |
|
754 |
|
|
755 |
(window.wp = window.wp || {}).nux = __webpack_exports__; |
|
756 |
/******/ })() |
|
757 |
; |