9
|
1 |
this["wp"] = this["wp"] || {}; this["wp"]["viewport"] = |
|
2 |
/******/ (function(modules) { // webpackBootstrap |
|
3 |
/******/ // The module cache |
|
4 |
/******/ var installedModules = {}; |
|
5 |
/******/ |
|
6 |
/******/ // The require function |
|
7 |
/******/ function __webpack_require__(moduleId) { |
|
8 |
/******/ |
|
9 |
/******/ // Check if module is in cache |
|
10 |
/******/ if(installedModules[moduleId]) { |
|
11 |
/******/ return installedModules[moduleId].exports; |
|
12 |
/******/ } |
|
13 |
/******/ // Create a new module (and put it into the cache) |
|
14 |
/******/ var module = installedModules[moduleId] = { |
|
15 |
/******/ i: moduleId, |
|
16 |
/******/ l: false, |
|
17 |
/******/ exports: {} |
|
18 |
/******/ }; |
|
19 |
/******/ |
|
20 |
/******/ // Execute the module function |
|
21 |
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
|
22 |
/******/ |
|
23 |
/******/ // Flag the module as loaded |
|
24 |
/******/ module.l = true; |
|
25 |
/******/ |
|
26 |
/******/ // Return the exports of the module |
|
27 |
/******/ return module.exports; |
|
28 |
/******/ } |
|
29 |
/******/ |
|
30 |
/******/ |
|
31 |
/******/ // expose the modules object (__webpack_modules__) |
|
32 |
/******/ __webpack_require__.m = modules; |
|
33 |
/******/ |
|
34 |
/******/ // expose the module cache |
|
35 |
/******/ __webpack_require__.c = installedModules; |
|
36 |
/******/ |
|
37 |
/******/ // define getter function for harmony exports |
|
38 |
/******/ __webpack_require__.d = function(exports, name, getter) { |
|
39 |
/******/ if(!__webpack_require__.o(exports, name)) { |
|
40 |
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
|
41 |
/******/ } |
|
42 |
/******/ }; |
|
43 |
/******/ |
|
44 |
/******/ // define __esModule on exports |
|
45 |
/******/ __webpack_require__.r = function(exports) { |
|
46 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|
47 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
48 |
/******/ } |
|
49 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
50 |
/******/ }; |
|
51 |
/******/ |
|
52 |
/******/ // create a fake namespace object |
|
53 |
/******/ // mode & 1: value is a module id, require it |
|
54 |
/******/ // mode & 2: merge all properties of value into the ns |
|
55 |
/******/ // mode & 4: return value when already ns object |
|
56 |
/******/ // mode & 8|1: behave like require |
|
57 |
/******/ __webpack_require__.t = function(value, mode) { |
|
58 |
/******/ if(mode & 1) value = __webpack_require__(value); |
|
59 |
/******/ if(mode & 8) return value; |
|
60 |
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
|
61 |
/******/ var ns = Object.create(null); |
|
62 |
/******/ __webpack_require__.r(ns); |
|
63 |
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
|
64 |
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
|
65 |
/******/ return ns; |
|
66 |
/******/ }; |
|
67 |
/******/ |
|
68 |
/******/ // getDefaultExport function for compatibility with non-harmony modules |
|
69 |
/******/ __webpack_require__.n = function(module) { |
|
70 |
/******/ var getter = module && module.__esModule ? |
|
71 |
/******/ function getDefault() { return module['default']; } : |
|
72 |
/******/ function getModuleExports() { return module; }; |
|
73 |
/******/ __webpack_require__.d(getter, 'a', getter); |
|
74 |
/******/ return getter; |
|
75 |
/******/ }; |
|
76 |
/******/ |
|
77 |
/******/ // Object.prototype.hasOwnProperty.call |
|
78 |
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
|
79 |
/******/ |
|
80 |
/******/ // __webpack_public_path__ |
|
81 |
/******/ __webpack_require__.p = ""; |
|
82 |
/******/ |
|
83 |
/******/ |
|
84 |
/******/ // Load entry module and return exports |
|
85 |
/******/ return __webpack_require__(__webpack_require__.s = 372); |
|
86 |
/******/ }) |
|
87 |
/************************************************************************/ |
|
88 |
/******/ ({ |
|
89 |
|
|
90 |
/***/ 2: |
|
91 |
/***/ (function(module, exports) { |
|
92 |
|
|
93 |
(function() { module.exports = this["lodash"]; }()); |
|
94 |
|
|
95 |
/***/ }), |
|
96 |
|
|
97 |
/***/ 372: |
|
98 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
99 |
|
|
100 |
"use strict"; |
|
101 |
__webpack_require__.r(__webpack_exports__); |
|
102 |
var actions_namespaceObject = {}; |
|
103 |
__webpack_require__.r(actions_namespaceObject); |
|
104 |
__webpack_require__.d(actions_namespaceObject, "setIsMatching", function() { return setIsMatching; }); |
|
105 |
var selectors_namespaceObject = {}; |
|
106 |
__webpack_require__.r(selectors_namespaceObject); |
|
107 |
__webpack_require__.d(selectors_namespaceObject, "isViewportMatch", function() { return isViewportMatch; }); |
|
108 |
|
|
109 |
// EXTERNAL MODULE: external "lodash" |
|
110 |
var external_lodash_ = __webpack_require__(2); |
|
111 |
|
|
112 |
// EXTERNAL MODULE: external {"this":["wp","data"]} |
|
113 |
var external_this_wp_data_ = __webpack_require__(5); |
|
114 |
|
|
115 |
// CONCATENATED MODULE: ./node_modules/@wordpress/viewport/build-module/store/reducer.js |
|
116 |
/** |
|
117 |
* Reducer returning the viewport state, as keys of breakpoint queries with |
|
118 |
* boolean value representing whether query is matched. |
|
119 |
* |
|
120 |
* @param {Object} state Current state. |
|
121 |
* @param {Object} action Dispatched action. |
|
122 |
* |
|
123 |
* @return {Object} Updated state. |
|
124 |
*/ |
|
125 |
function reducer() { |
|
126 |
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
127 |
var action = arguments.length > 1 ? arguments[1] : undefined; |
|
128 |
|
|
129 |
switch (action.type) { |
|
130 |
case 'SET_IS_MATCHING': |
|
131 |
return action.values; |
|
132 |
} |
|
133 |
|
|
134 |
return state; |
|
135 |
} |
|
136 |
|
|
137 |
/* harmony default export */ var store_reducer = (reducer); |
|
138 |
|
|
139 |
// CONCATENATED MODULE: ./node_modules/@wordpress/viewport/build-module/store/actions.js |
|
140 |
/** |
|
141 |
* Returns an action object used in signalling that viewport queries have been |
|
142 |
* updated. Values are specified as an object of breakpoint query keys where |
|
143 |
* value represents whether query matches. |
|
144 |
* |
|
145 |
* @param {Object} values Breakpoint query matches. |
|
146 |
* |
|
147 |
* @return {Object} Action object. |
|
148 |
*/ |
|
149 |
function setIsMatching(values) { |
|
150 |
return { |
|
151 |
type: 'SET_IS_MATCHING', |
|
152 |
values: values |
|
153 |
}; |
|
154 |
} |
|
155 |
|
|
156 |
// CONCATENATED MODULE: ./node_modules/@wordpress/viewport/build-module/store/selectors.js |
|
157 |
/** |
|
158 |
* Returns true if the viewport matches the given query, or false otherwise. |
|
159 |
* |
|
160 |
* @param {Object} state Viewport state object. |
|
161 |
* @param {string} query Query string. Includes operator and breakpoint name, |
|
162 |
* space separated. Operator defaults to >=. |
|
163 |
* |
|
164 |
* @example |
|
165 |
* |
|
166 |
* ```js |
|
167 |
* isViewportMatch( state, '< huge' ); |
|
168 |
* isViewPortMatch( state, 'medium' ); |
|
169 |
* ``` |
|
170 |
* |
|
171 |
* @return {boolean} Whether viewport matches query. |
|
172 |
*/ |
|
173 |
function isViewportMatch(state, query) { |
|
174 |
// Default to `>=` if no operator is present. |
|
175 |
if (query.indexOf(' ') === -1) { |
|
176 |
query = '>= ' + query; |
|
177 |
} |
|
178 |
|
|
179 |
return !!state[query]; |
|
180 |
} |
|
181 |
|
|
182 |
// CONCATENATED MODULE: ./node_modules/@wordpress/viewport/build-module/store/index.js |
|
183 |
/** |
|
184 |
* WordPress dependencies |
|
185 |
*/ |
|
186 |
|
|
187 |
/** |
|
188 |
* Internal dependencies |
|
189 |
*/ |
|
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
/* harmony default export */ var store = (Object(external_this_wp_data_["registerStore"])('core/viewport', { |
|
195 |
reducer: store_reducer, |
|
196 |
actions: actions_namespaceObject, |
|
197 |
selectors: selectors_namespaceObject |
|
198 |
})); |
|
199 |
|
|
200 |
// EXTERNAL MODULE: external {"this":["wp","compose"]} |
|
201 |
var external_this_wp_compose_ = __webpack_require__(6); |
|
202 |
|
|
203 |
// CONCATENATED MODULE: ./node_modules/@wordpress/viewport/build-module/with-viewport-match.js |
|
204 |
/** |
|
205 |
* External dependencies |
|
206 |
*/ |
|
207 |
|
|
208 |
/** |
|
209 |
* WordPress dependencies |
|
210 |
*/ |
|
211 |
|
|
212 |
|
|
213 |
|
|
214 |
/** |
|
215 |
* Higher-order component creator, creating a new component which renders with |
|
216 |
* the given prop names, where the value passed to the underlying component is |
|
217 |
* the result of the query assigned as the object's value. |
|
218 |
* |
|
219 |
* @see isViewportMatch |
|
220 |
* |
|
221 |
* @param {Object} queries Object of prop name to viewport query. |
|
222 |
* |
|
223 |
* @example |
|
224 |
* |
|
225 |
* ```jsx |
|
226 |
* function MyComponent( { isMobile } ) { |
|
227 |
* return ( |
|
228 |
* <div>Currently: { isMobile ? 'Mobile' : 'Not Mobile' }</div> |
|
229 |
* ); |
|
230 |
* } |
|
231 |
* |
|
232 |
* MyComponent = withViewportMatch( { isMobile: '< small' } )( MyComponent ); |
|
233 |
* ``` |
|
234 |
* |
|
235 |
* @return {Function} Higher-order component. |
|
236 |
*/ |
|
237 |
|
|
238 |
var with_viewport_match_withViewportMatch = function withViewportMatch(queries) { |
|
239 |
return Object(external_this_wp_compose_["createHigherOrderComponent"])(Object(external_this_wp_data_["withSelect"])(function (select) { |
|
240 |
return Object(external_lodash_["mapValues"])(queries, function (query) { |
|
241 |
return select('core/viewport').isViewportMatch(query); |
|
242 |
}); |
|
243 |
}), 'withViewportMatch'); |
|
244 |
}; |
|
245 |
|
|
246 |
/* harmony default export */ var with_viewport_match = (with_viewport_match_withViewportMatch); |
|
247 |
|
|
248 |
// CONCATENATED MODULE: ./node_modules/@wordpress/viewport/build-module/if-viewport-matches.js |
|
249 |
/** |
|
250 |
* WordPress dependencies |
|
251 |
*/ |
|
252 |
|
|
253 |
/** |
|
254 |
* Internal dependencies |
|
255 |
*/ |
|
256 |
|
|
257 |
|
|
258 |
/** |
|
259 |
* Higher-order component creator, creating a new component which renders if |
|
260 |
* the viewport query is satisfied. |
|
261 |
* |
|
262 |
* @see withViewportMatches |
|
263 |
* |
|
264 |
* @param {string} query Viewport query. |
|
265 |
* |
|
266 |
* @example |
|
267 |
* |
|
268 |
* ```jsx |
|
269 |
* function MyMobileComponent() { |
|
270 |
* return <div>I'm only rendered on mobile viewports!</div>; |
|
271 |
* } |
|
272 |
* |
|
273 |
* MyMobileComponent = ifViewportMatches( '< small' )( MyMobileComponent ); |
|
274 |
* ``` |
|
275 |
* |
|
276 |
* @return {Function} Higher-order component. |
|
277 |
*/ |
|
278 |
|
|
279 |
var if_viewport_matches_ifViewportMatches = function ifViewportMatches(query) { |
|
280 |
return Object(external_this_wp_compose_["createHigherOrderComponent"])(Object(external_this_wp_compose_["compose"])([with_viewport_match({ |
|
281 |
isViewportMatch: query |
|
282 |
}), Object(external_this_wp_compose_["ifCondition"])(function (props) { |
|
283 |
return props.isViewportMatch; |
|
284 |
})]), 'ifViewportMatches'); |
|
285 |
}; |
|
286 |
|
|
287 |
/* harmony default export */ var if_viewport_matches = (if_viewport_matches_ifViewportMatches); |
|
288 |
|
|
289 |
// CONCATENATED MODULE: ./node_modules/@wordpress/viewport/build-module/index.js |
|
290 |
/* concated harmony reexport ifViewportMatches */__webpack_require__.d(__webpack_exports__, "ifViewportMatches", function() { return if_viewport_matches; }); |
|
291 |
/* concated harmony reexport withViewportMatch */__webpack_require__.d(__webpack_exports__, "withViewportMatch", function() { return with_viewport_match; }); |
|
292 |
/** |
|
293 |
* External dependencies |
|
294 |
*/ |
|
295 |
|
|
296 |
/** |
|
297 |
* WordPress dependencies |
|
298 |
*/ |
|
299 |
|
|
300 |
|
|
301 |
/** |
|
302 |
* Internal dependencies |
|
303 |
*/ |
|
304 |
|
|
305 |
|
|
306 |
|
|
307 |
|
|
308 |
/** |
|
309 |
* Hash of breakpoint names with pixel width at which it becomes effective. |
|
310 |
* |
|
311 |
* @see _breakpoints.scss |
|
312 |
* |
|
313 |
* @type {Object} |
|
314 |
*/ |
|
315 |
|
|
316 |
var BREAKPOINTS = { |
|
317 |
huge: 1440, |
|
318 |
wide: 1280, |
|
319 |
large: 960, |
|
320 |
medium: 782, |
|
321 |
small: 600, |
|
322 |
mobile: 480 |
|
323 |
}; |
|
324 |
/** |
|
325 |
* Hash of query operators with corresponding condition for media query. |
|
326 |
* |
|
327 |
* @type {Object} |
|
328 |
*/ |
|
329 |
|
|
330 |
var OPERATORS = { |
|
331 |
'<': 'max-width', |
|
332 |
'>=': 'min-width' |
|
333 |
}; |
|
334 |
/** |
|
335 |
* Callback invoked when media query state should be updated. Is invoked a |
|
336 |
* maximum of one time per call stack. |
|
337 |
*/ |
|
338 |
|
|
339 |
var build_module_setIsMatching = Object(external_lodash_["debounce"])(function () { |
|
340 |
var values = Object(external_lodash_["mapValues"])(build_module_queries, function (query) { |
|
341 |
return query.matches; |
|
342 |
}); |
|
343 |
Object(external_this_wp_data_["dispatch"])('core/viewport').setIsMatching(values); |
|
344 |
}, { |
|
345 |
leading: true |
|
346 |
}); |
|
347 |
/** |
|
348 |
* Hash of breakpoint names with generated MediaQueryList for corresponding |
|
349 |
* media query. |
|
350 |
* |
|
351 |
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia |
|
352 |
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList |
|
353 |
* |
|
354 |
* @type {Object<string,MediaQueryList>} |
|
355 |
*/ |
|
356 |
|
|
357 |
var build_module_queries = Object(external_lodash_["reduce"])(BREAKPOINTS, function (result, width, name) { |
|
358 |
Object(external_lodash_["forEach"])(OPERATORS, function (condition, operator) { |
|
359 |
var list = window.matchMedia("(".concat(condition, ": ").concat(width, "px)")); |
|
360 |
list.addListener(build_module_setIsMatching); |
|
361 |
var key = [operator, name].join(' '); |
|
362 |
result[key] = list; |
|
363 |
}); |
|
364 |
return result; |
|
365 |
}, {}); |
|
366 |
window.addEventListener('orientationchange', build_module_setIsMatching); // Set initial values |
|
367 |
|
|
368 |
build_module_setIsMatching(); |
|
369 |
build_module_setIsMatching.flush(); |
|
370 |
|
|
371 |
|
|
372 |
/***/ }), |
|
373 |
|
|
374 |
/***/ 5: |
|
375 |
/***/ (function(module, exports) { |
|
376 |
|
|
377 |
(function() { module.exports = this["wp"]["data"]; }()); |
|
378 |
|
|
379 |
/***/ }), |
|
380 |
|
|
381 |
/***/ 6: |
|
382 |
/***/ (function(module, exports) { |
|
383 |
|
|
384 |
(function() { module.exports = this["wp"]["compose"]; }()); |
|
385 |
|
|
386 |
/***/ }) |
|
387 |
|
|
388 |
/******/ }); |