Q2W3 Fixed Widget - Version 6.0.0-beta-2

Version Description

Download this release

Release Info

Developer webzunft
Plugin Icon 128x128 Q2W3 Fixed Widget
Version 6.0.0-beta-2
Comparing to
See all releases

Code changes from version 6.0.0-beta-1 to 6.0.0-beta-2

js/backend.asset.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => '1dcd7da92f570e27f7433b7d8e719c95');
js/backend.js ADDED
@@ -0,0 +1,1665 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******/ (function() { // webpackBootstrap
2
+ /******/ "use strict";
3
+ /******/ var __webpack_modules__ = ({
4
+
5
+ /***/ "./node_modules/object-assign/index.js":
6
+ /*!*********************************************!*\
7
+ !*** ./node_modules/object-assign/index.js ***!
8
+ \*********************************************/
9
+ /***/ (function(module) {
10
+
11
+ /*
12
+ object-assign
13
+ (c) Sindre Sorhus
14
+ @license MIT
15
+ */
16
+
17
+
18
+ /* eslint-disable no-unused-vars */
19
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
20
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
21
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
22
+
23
+ function toObject(val) {
24
+ if (val === null || val === undefined) {
25
+ throw new TypeError('Object.assign cannot be called with null or undefined');
26
+ }
27
+
28
+ return Object(val);
29
+ }
30
+
31
+ function shouldUseNative() {
32
+ try {
33
+ if (!Object.assign) {
34
+ return false;
35
+ }
36
+
37
+ // Detect buggy property enumeration order in older V8 versions.
38
+
39
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
40
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
41
+ test1[5] = 'de';
42
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
43
+ return false;
44
+ }
45
+
46
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
47
+ var test2 = {};
48
+ for (var i = 0; i < 10; i++) {
49
+ test2['_' + String.fromCharCode(i)] = i;
50
+ }
51
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
52
+ return test2[n];
53
+ });
54
+ if (order2.join('') !== '0123456789') {
55
+ return false;
56
+ }
57
+
58
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
59
+ var test3 = {};
60
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
61
+ test3[letter] = letter;
62
+ });
63
+ if (Object.keys(Object.assign({}, test3)).join('') !==
64
+ 'abcdefghijklmnopqrst') {
65
+ return false;
66
+ }
67
+
68
+ return true;
69
+ } catch (err) {
70
+ // We don't expect any of the above to throw, but better to be safe.
71
+ return false;
72
+ }
73
+ }
74
+
75
+ module.exports = shouldUseNative() ? Object.assign : function (target, source) {
76
+ var from;
77
+ var to = toObject(target);
78
+ var symbols;
79
+
80
+ for (var s = 1; s < arguments.length; s++) {
81
+ from = Object(arguments[s]);
82
+
83
+ for (var key in from) {
84
+ if (hasOwnProperty.call(from, key)) {
85
+ to[key] = from[key];
86
+ }
87
+ }
88
+
89
+ if (getOwnPropertySymbols) {
90
+ symbols = getOwnPropertySymbols(from);
91
+ for (var i = 0; i < symbols.length; i++) {
92
+ if (propIsEnumerable.call(from, symbols[i])) {
93
+ to[symbols[i]] = from[symbols[i]];
94
+ }
95
+ }
96
+ }
97
+ }
98
+
99
+ return to;
100
+ };
101
+
102
+
103
+ /***/ }),
104
+
105
+ /***/ "./node_modules/react/cjs/react-jsx-runtime.development.js":
106
+ /*!*****************************************************************!*\
107
+ !*** ./node_modules/react/cjs/react-jsx-runtime.development.js ***!
108
+ \*****************************************************************/
109
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
110
+
111
+ /** @license React v17.0.2
112
+ * react-jsx-runtime.development.js
113
+ *
114
+ * Copyright (c) Facebook, Inc. and its affiliates.
115
+ *
116
+ * This source code is licensed under the MIT license found in the
117
+ * LICENSE file in the root directory of this source tree.
118
+ */
119
+
120
+
121
+
122
+ if (true) {
123
+ (function() {
124
+ 'use strict';
125
+
126
+ var React = __webpack_require__(/*! react */ "react");
127
+ var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js");
128
+
129
+ // ATTENTION
130
+ // When adding new symbols to this file,
131
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
132
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
133
+ // nor polyfill, then a plain number is used for performance.
134
+ var REACT_ELEMENT_TYPE = 0xeac7;
135
+ var REACT_PORTAL_TYPE = 0xeaca;
136
+ exports.Fragment = 0xeacb;
137
+ var REACT_STRICT_MODE_TYPE = 0xeacc;
138
+ var REACT_PROFILER_TYPE = 0xead2;
139
+ var REACT_PROVIDER_TYPE = 0xeacd;
140
+ var REACT_CONTEXT_TYPE = 0xeace;
141
+ var REACT_FORWARD_REF_TYPE = 0xead0;
142
+ var REACT_SUSPENSE_TYPE = 0xead1;
143
+ var REACT_SUSPENSE_LIST_TYPE = 0xead8;
144
+ var REACT_MEMO_TYPE = 0xead3;
145
+ var REACT_LAZY_TYPE = 0xead4;
146
+ var REACT_BLOCK_TYPE = 0xead9;
147
+ var REACT_SERVER_BLOCK_TYPE = 0xeada;
148
+ var REACT_FUNDAMENTAL_TYPE = 0xead5;
149
+ var REACT_SCOPE_TYPE = 0xead7;
150
+ var REACT_OPAQUE_ID_TYPE = 0xeae0;
151
+ var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
152
+ var REACT_OFFSCREEN_TYPE = 0xeae2;
153
+ var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
154
+
155
+ if (typeof Symbol === 'function' && Symbol.for) {
156
+ var symbolFor = Symbol.for;
157
+ REACT_ELEMENT_TYPE = symbolFor('react.element');
158
+ REACT_PORTAL_TYPE = symbolFor('react.portal');
159
+ exports.Fragment = symbolFor('react.fragment');
160
+ REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
161
+ REACT_PROFILER_TYPE = symbolFor('react.profiler');
162
+ REACT_PROVIDER_TYPE = symbolFor('react.provider');
163
+ REACT_CONTEXT_TYPE = symbolFor('react.context');
164
+ REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
165
+ REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
166
+ REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
167
+ REACT_MEMO_TYPE = symbolFor('react.memo');
168
+ REACT_LAZY_TYPE = symbolFor('react.lazy');
169
+ REACT_BLOCK_TYPE = symbolFor('react.block');
170
+ REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
171
+ REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
172
+ REACT_SCOPE_TYPE = symbolFor('react.scope');
173
+ REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
174
+ REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
175
+ REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
176
+ REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
177
+ }
178
+
179
+ var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
180
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
181
+ function getIteratorFn(maybeIterable) {
182
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
183
+ return null;
184
+ }
185
+
186
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
187
+
188
+ if (typeof maybeIterator === 'function') {
189
+ return maybeIterator;
190
+ }
191
+
192
+ return null;
193
+ }
194
+
195
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
196
+
197
+ function error(format) {
198
+ {
199
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
200
+ args[_key2 - 1] = arguments[_key2];
201
+ }
202
+
203
+ printWarning('error', format, args);
204
+ }
205
+ }
206
+
207
+ function printWarning(level, format, args) {
208
+ // When changing this logic, you might want to also
209
+ // update consoleWithStackDev.www.js as well.
210
+ {
211
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
212
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
213
+
214
+ if (stack !== '') {
215
+ format += '%s';
216
+ args = args.concat([stack]);
217
+ }
218
+
219
+ var argsWithFormat = args.map(function (item) {
220
+ return '' + item;
221
+ }); // Careful: RN currently depends on this prefix
222
+
223
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
224
+ // breaks IE9: https://github.com/facebook/react/issues/13610
225
+ // eslint-disable-next-line react-internal/no-production-logging
226
+
227
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
228
+ }
229
+ }
230
+
231
+ // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
232
+
233
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
234
+
235
+ function isValidElementType(type) {
236
+ if (typeof type === 'string' || typeof type === 'function') {
237
+ return true;
238
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
239
+
240
+
241
+ if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
242
+ return true;
243
+ }
244
+
245
+ if (typeof type === 'object' && type !== null) {
246
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
247
+ return true;
248
+ }
249
+ }
250
+
251
+ return false;
252
+ }
253
+
254
+ function getWrappedName(outerType, innerType, wrapperName) {
255
+ var functionName = innerType.displayName || innerType.name || '';
256
+ return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
257
+ }
258
+
259
+ function getContextName(type) {
260
+ return type.displayName || 'Context';
261
+ }
262
+
263
+ function getComponentName(type) {
264
+ if (type == null) {
265
+ // Host root, text node or just invalid type.
266
+ return null;
267
+ }
268
+
269
+ {
270
+ if (typeof type.tag === 'number') {
271
+ error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
272
+ }
273
+ }
274
+
275
+ if (typeof type === 'function') {
276
+ return type.displayName || type.name || null;
277
+ }
278
+
279
+ if (typeof type === 'string') {
280
+ return type;
281
+ }
282
+
283
+ switch (type) {
284
+ case exports.Fragment:
285
+ return 'Fragment';
286
+
287
+ case REACT_PORTAL_TYPE:
288
+ return 'Portal';
289
+
290
+ case REACT_PROFILER_TYPE:
291
+ return 'Profiler';
292
+
293
+ case REACT_STRICT_MODE_TYPE:
294
+ return 'StrictMode';
295
+
296
+ case REACT_SUSPENSE_TYPE:
297
+ return 'Suspense';
298
+
299
+ case REACT_SUSPENSE_LIST_TYPE:
300
+ return 'SuspenseList';
301
+ }
302
+
303
+ if (typeof type === 'object') {
304
+ switch (type.$$typeof) {
305
+ case REACT_CONTEXT_TYPE:
306
+ var context = type;
307
+ return getContextName(context) + '.Consumer';
308
+
309
+ case REACT_PROVIDER_TYPE:
310
+ var provider = type;
311
+ return getContextName(provider._context) + '.Provider';
312
+
313
+ case REACT_FORWARD_REF_TYPE:
314
+ return getWrappedName(type, type.render, 'ForwardRef');
315
+
316
+ case REACT_MEMO_TYPE:
317
+ return getComponentName(type.type);
318
+
319
+ case REACT_BLOCK_TYPE:
320
+ return getComponentName(type._render);
321
+
322
+ case REACT_LAZY_TYPE:
323
+ {
324
+ var lazyComponent = type;
325
+ var payload = lazyComponent._payload;
326
+ var init = lazyComponent._init;
327
+
328
+ try {
329
+ return getComponentName(init(payload));
330
+ } catch (x) {
331
+ return null;
332
+ }
333
+ }
334
+ }
335
+ }
336
+
337
+ return null;
338
+ }
339
+
340
+ // Helpers to patch console.logs to avoid logging during side-effect free
341
+ // replaying on render function. This currently only patches the object
342
+ // lazily which won't cover if the log function was extracted eagerly.
343
+ // We could also eagerly patch the method.
344
+ var disabledDepth = 0;
345
+ var prevLog;
346
+ var prevInfo;
347
+ var prevWarn;
348
+ var prevError;
349
+ var prevGroup;
350
+ var prevGroupCollapsed;
351
+ var prevGroupEnd;
352
+
353
+ function disabledLog() {}
354
+
355
+ disabledLog.__reactDisabledLog = true;
356
+ function disableLogs() {
357
+ {
358
+ if (disabledDepth === 0) {
359
+ /* eslint-disable react-internal/no-production-logging */
360
+ prevLog = console.log;
361
+ prevInfo = console.info;
362
+ prevWarn = console.warn;
363
+ prevError = console.error;
364
+ prevGroup = console.group;
365
+ prevGroupCollapsed = console.groupCollapsed;
366
+ prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
367
+
368
+ var props = {
369
+ configurable: true,
370
+ enumerable: true,
371
+ value: disabledLog,
372
+ writable: true
373
+ }; // $FlowFixMe Flow thinks console is immutable.
374
+
375
+ Object.defineProperties(console, {
376
+ info: props,
377
+ log: props,
378
+ warn: props,
379
+ error: props,
380
+ group: props,
381
+ groupCollapsed: props,
382
+ groupEnd: props
383
+ });
384
+ /* eslint-enable react-internal/no-production-logging */
385
+ }
386
+
387
+ disabledDepth++;
388
+ }
389
+ }
390
+ function reenableLogs() {
391
+ {
392
+ disabledDepth--;
393
+
394
+ if (disabledDepth === 0) {
395
+ /* eslint-disable react-internal/no-production-logging */
396
+ var props = {
397
+ configurable: true,
398
+ enumerable: true,
399
+ writable: true
400
+ }; // $FlowFixMe Flow thinks console is immutable.
401
+
402
+ Object.defineProperties(console, {
403
+ log: _assign({}, props, {
404
+ value: prevLog
405
+ }),
406
+ info: _assign({}, props, {
407
+ value: prevInfo
408
+ }),
409
+ warn: _assign({}, props, {
410
+ value: prevWarn
411
+ }),
412
+ error: _assign({}, props, {
413
+ value: prevError
414
+ }),
415
+ group: _assign({}, props, {
416
+ value: prevGroup
417
+ }),
418
+ groupCollapsed: _assign({}, props, {
419
+ value: prevGroupCollapsed
420
+ }),
421
+ groupEnd: _assign({}, props, {
422
+ value: prevGroupEnd
423
+ })
424
+ });
425
+ /* eslint-enable react-internal/no-production-logging */
426
+ }
427
+
428
+ if (disabledDepth < 0) {
429
+ error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
430
+ }
431
+ }
432
+ }
433
+
434
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
435
+ var prefix;
436
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
437
+ {
438
+ if (prefix === undefined) {
439
+ // Extract the VM specific prefix used by each line.
440
+ try {
441
+ throw Error();
442
+ } catch (x) {
443
+ var match = x.stack.trim().match(/\n( *(at )?)/);
444
+ prefix = match && match[1] || '';
445
+ }
446
+ } // We use the prefix to ensure our stacks line up with native stack frames.
447
+
448
+
449
+ return '\n' + prefix + name;
450
+ }
451
+ }
452
+ var reentry = false;
453
+ var componentFrameCache;
454
+
455
+ {
456
+ var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
457
+ componentFrameCache = new PossiblyWeakMap();
458
+ }
459
+
460
+ function describeNativeComponentFrame(fn, construct) {
461
+ // If something asked for a stack inside a fake render, it should get ignored.
462
+ if (!fn || reentry) {
463
+ return '';
464
+ }
465
+
466
+ {
467
+ var frame = componentFrameCache.get(fn);
468
+
469
+ if (frame !== undefined) {
470
+ return frame;
471
+ }
472
+ }
473
+
474
+ var control;
475
+ reentry = true;
476
+ var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
477
+
478
+ Error.prepareStackTrace = undefined;
479
+ var previousDispatcher;
480
+
481
+ {
482
+ previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
483
+ // for warnings.
484
+
485
+ ReactCurrentDispatcher.current = null;
486
+ disableLogs();
487
+ }
488
+
489
+ try {
490
+ // This should throw.
491
+ if (construct) {
492
+ // Something should be setting the props in the constructor.
493
+ var Fake = function () {
494
+ throw Error();
495
+ }; // $FlowFixMe
496
+
497
+
498
+ Object.defineProperty(Fake.prototype, 'props', {
499
+ set: function () {
500
+ // We use a throwing setter instead of frozen or non-writable props
501
+ // because that won't throw in a non-strict mode function.
502
+ throw Error();
503
+ }
504
+ });
505
+
506
+ if (typeof Reflect === 'object' && Reflect.construct) {
507
+ // We construct a different control for this case to include any extra
508
+ // frames added by the construct call.
509
+ try {
510
+ Reflect.construct(Fake, []);
511
+ } catch (x) {
512
+ control = x;
513
+ }
514
+
515
+ Reflect.construct(fn, [], Fake);
516
+ } else {
517
+ try {
518
+ Fake.call();
519
+ } catch (x) {
520
+ control = x;
521
+ }
522
+
523
+ fn.call(Fake.prototype);
524
+ }
525
+ } else {
526
+ try {
527
+ throw Error();
528
+ } catch (x) {
529
+ control = x;
530
+ }
531
+
532
+ fn();
533
+ }
534
+ } catch (sample) {
535
+ // This is inlined manually because closure doesn't do it for us.
536
+ if (sample && control && typeof sample.stack === 'string') {
537
+ // This extracts the first frame from the sample that isn't also in the control.
538
+ // Skipping one frame that we assume is the frame that calls the two.
539
+ var sampleLines = sample.stack.split('\n');
540
+ var controlLines = control.stack.split('\n');
541
+ var s = sampleLines.length - 1;
542
+ var c = controlLines.length - 1;
543
+
544
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
545
+ // We expect at least one stack frame to be shared.
546
+ // Typically this will be the root most one. However, stack frames may be
547
+ // cut off due to maximum stack limits. In this case, one maybe cut off
548
+ // earlier than the other. We assume that the sample is longer or the same
549
+ // and there for cut off earlier. So we should find the root most frame in
550
+ // the sample somewhere in the control.
551
+ c--;
552
+ }
553
+
554
+ for (; s >= 1 && c >= 0; s--, c--) {
555
+ // Next we find the first one that isn't the same which should be the
556
+ // frame that called our sample function and the control.
557
+ if (sampleLines[s] !== controlLines[c]) {
558
+ // In V8, the first line is describing the message but other VMs don't.
559
+ // If we're about to return the first line, and the control is also on the same
560
+ // line, that's a pretty good indicator that our sample threw at same line as
561
+ // the control. I.e. before we entered the sample frame. So we ignore this result.
562
+ // This can happen if you passed a class to function component, or non-function.
563
+ if (s !== 1 || c !== 1) {
564
+ do {
565
+ s--;
566
+ c--; // We may still have similar intermediate frames from the construct call.
567
+ // The next one that isn't the same should be our match though.
568
+
569
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
570
+ // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
571
+ var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
572
+
573
+ {
574
+ if (typeof fn === 'function') {
575
+ componentFrameCache.set(fn, _frame);
576
+ }
577
+ } // Return the line we found.
578
+
579
+
580
+ return _frame;
581
+ }
582
+ } while (s >= 1 && c >= 0);
583
+ }
584
+
585
+ break;
586
+ }
587
+ }
588
+ }
589
+ } finally {
590
+ reentry = false;
591
+
592
+ {
593
+ ReactCurrentDispatcher.current = previousDispatcher;
594
+ reenableLogs();
595
+ }
596
+
597
+ Error.prepareStackTrace = previousPrepareStackTrace;
598
+ } // Fallback to just using the name if we couldn't make it throw.
599
+
600
+
601
+ var name = fn ? fn.displayName || fn.name : '';
602
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
603
+
604
+ {
605
+ if (typeof fn === 'function') {
606
+ componentFrameCache.set(fn, syntheticFrame);
607
+ }
608
+ }
609
+
610
+ return syntheticFrame;
611
+ }
612
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
613
+ {
614
+ return describeNativeComponentFrame(fn, false);
615
+ }
616
+ }
617
+
618
+ function shouldConstruct(Component) {
619
+ var prototype = Component.prototype;
620
+ return !!(prototype && prototype.isReactComponent);
621
+ }
622
+
623
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
624
+
625
+ if (type == null) {
626
+ return '';
627
+ }
628
+
629
+ if (typeof type === 'function') {
630
+ {
631
+ return describeNativeComponentFrame(type, shouldConstruct(type));
632
+ }
633
+ }
634
+
635
+ if (typeof type === 'string') {
636
+ return describeBuiltInComponentFrame(type);
637
+ }
638
+
639
+ switch (type) {
640
+ case REACT_SUSPENSE_TYPE:
641
+ return describeBuiltInComponentFrame('Suspense');
642
+
643
+ case REACT_SUSPENSE_LIST_TYPE:
644
+ return describeBuiltInComponentFrame('SuspenseList');
645
+ }
646
+
647
+ if (typeof type === 'object') {
648
+ switch (type.$$typeof) {
649
+ case REACT_FORWARD_REF_TYPE:
650
+ return describeFunctionComponentFrame(type.render);
651
+
652
+ case REACT_MEMO_TYPE:
653
+ // Memo may contain any component type so we recursively resolve it.
654
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
655
+
656
+ case REACT_BLOCK_TYPE:
657
+ return describeFunctionComponentFrame(type._render);
658
+
659
+ case REACT_LAZY_TYPE:
660
+ {
661
+ var lazyComponent = type;
662
+ var payload = lazyComponent._payload;
663
+ var init = lazyComponent._init;
664
+
665
+ try {
666
+ // Lazy may contain any component type so we recursively resolve it.
667
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
668
+ } catch (x) {}
669
+ }
670
+ }
671
+ }
672
+
673
+ return '';
674
+ }
675
+
676
+ var loggedTypeFailures = {};
677
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
678
+
679
+ function setCurrentlyValidatingElement(element) {
680
+ {
681
+ if (element) {
682
+ var owner = element._owner;
683
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
684
+ ReactDebugCurrentFrame.setExtraStackFrame(stack);
685
+ } else {
686
+ ReactDebugCurrentFrame.setExtraStackFrame(null);
687
+ }
688
+ }
689
+ }
690
+
691
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
692
+ {
693
+ // $FlowFixMe This is okay but Flow doesn't know it.
694
+ var has = Function.call.bind(Object.prototype.hasOwnProperty);
695
+
696
+ for (var typeSpecName in typeSpecs) {
697
+ if (has(typeSpecs, typeSpecName)) {
698
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
699
+ // fail the render phase where it didn't fail before. So we log it.
700
+ // After these have been cleaned up, we'll let them throw.
701
+
702
+ try {
703
+ // This is intentionally an invariant that gets caught. It's the same
704
+ // behavior as without this statement except with a better message.
705
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
706
+ var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
707
+ err.name = 'Invariant Violation';
708
+ throw err;
709
+ }
710
+
711
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
712
+ } catch (ex) {
713
+ error$1 = ex;
714
+ }
715
+
716
+ if (error$1 && !(error$1 instanceof Error)) {
717
+ setCurrentlyValidatingElement(element);
718
+
719
+ error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
720
+
721
+ setCurrentlyValidatingElement(null);
722
+ }
723
+
724
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
725
+ // Only monitor this failure once because there tends to be a lot of the
726
+ // same error.
727
+ loggedTypeFailures[error$1.message] = true;
728
+ setCurrentlyValidatingElement(element);
729
+
730
+ error('Failed %s type: %s', location, error$1.message);
731
+
732
+ setCurrentlyValidatingElement(null);
733
+ }
734
+ }
735
+ }
736
+ }
737
+ }
738
+
739
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
740
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
741
+ var RESERVED_PROPS = {
742
+ key: true,
743
+ ref: true,
744
+ __self: true,
745
+ __source: true
746
+ };
747
+ var specialPropKeyWarningShown;
748
+ var specialPropRefWarningShown;
749
+ var didWarnAboutStringRefs;
750
+
751
+ {
752
+ didWarnAboutStringRefs = {};
753
+ }
754
+
755
+ function hasValidRef(config) {
756
+ {
757
+ if (hasOwnProperty.call(config, 'ref')) {
758
+ var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
759
+
760
+ if (getter && getter.isReactWarning) {
761
+ return false;
762
+ }
763
+ }
764
+ }
765
+
766
+ return config.ref !== undefined;
767
+ }
768
+
769
+ function hasValidKey(config) {
770
+ {
771
+ if (hasOwnProperty.call(config, 'key')) {
772
+ var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
773
+
774
+ if (getter && getter.isReactWarning) {
775
+ return false;
776
+ }
777
+ }
778
+ }
779
+
780
+ return config.key !== undefined;
781
+ }
782
+
783
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
784
+ {
785
+ if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
786
+ var componentName = getComponentName(ReactCurrentOwner.current.type);
787
+
788
+ if (!didWarnAboutStringRefs[componentName]) {
789
+ error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
790
+
791
+ didWarnAboutStringRefs[componentName] = true;
792
+ }
793
+ }
794
+ }
795
+ }
796
+
797
+ function defineKeyPropWarningGetter(props, displayName) {
798
+ {
799
+ var warnAboutAccessingKey = function () {
800
+ if (!specialPropKeyWarningShown) {
801
+ specialPropKeyWarningShown = true;
802
+
803
+ error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
804
+ }
805
+ };
806
+
807
+ warnAboutAccessingKey.isReactWarning = true;
808
+ Object.defineProperty(props, 'key', {
809
+ get: warnAboutAccessingKey,
810
+ configurable: true
811
+ });
812
+ }
813
+ }
814
+
815
+ function defineRefPropWarningGetter(props, displayName) {
816
+ {
817
+ var warnAboutAccessingRef = function () {
818
+ if (!specialPropRefWarningShown) {
819
+ specialPropRefWarningShown = true;
820
+
821
+ error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
822
+ }
823
+ };
824
+
825
+ warnAboutAccessingRef.isReactWarning = true;
826
+ Object.defineProperty(props, 'ref', {
827
+ get: warnAboutAccessingRef,
828
+ configurable: true
829
+ });
830
+ }
831
+ }
832
+ /**
833
+ * Factory method to create a new React element. This no longer adheres to
834
+ * the class pattern, so do not use new to call it. Also, instanceof check
835
+ * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
836
+ * if something is a React Element.
837
+ *
838
+ * @param {*} type
839
+ * @param {*} props
840
+ * @param {*} key
841
+ * @param {string|object} ref
842
+ * @param {*} owner
843
+ * @param {*} self A *temporary* helper to detect places where `this` is
844
+ * different from the `owner` when React.createElement is called, so that we
845
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
846
+ * functions, and as long as `this` and owner are the same, there will be no
847
+ * change in behavior.
848
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
849
+ * indicating filename, line number, and/or other information.
850
+ * @internal
851
+ */
852
+
853
+
854
+ var ReactElement = function (type, key, ref, self, source, owner, props) {
855
+ var element = {
856
+ // This tag allows us to uniquely identify this as a React Element
857
+ $$typeof: REACT_ELEMENT_TYPE,
858
+ // Built-in properties that belong on the element
859
+ type: type,
860
+ key: key,
861
+ ref: ref,
862
+ props: props,
863
+ // Record the component responsible for creating this element.
864
+ _owner: owner
865
+ };
866
+
867
+ {
868
+ // The validation flag is currently mutative. We put it on
869
+ // an external backing store so that we can freeze the whole object.
870
+ // This can be replaced with a WeakMap once they are implemented in
871
+ // commonly used development environments.
872
+ element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
873
+ // the validation flag non-enumerable (where possible, which should
874
+ // include every environment we run tests in), so the test framework
875
+ // ignores it.
876
+
877
+ Object.defineProperty(element._store, 'validated', {
878
+ configurable: false,
879
+ enumerable: false,
880
+ writable: true,
881
+ value: false
882
+ }); // self and source are DEV only properties.
883
+
884
+ Object.defineProperty(element, '_self', {
885
+ configurable: false,
886
+ enumerable: false,
887
+ writable: false,
888
+ value: self
889
+ }); // Two elements created in two different places should be considered
890
+ // equal for testing purposes and therefore we hide it from enumeration.
891
+
892
+ Object.defineProperty(element, '_source', {
893
+ configurable: false,
894
+ enumerable: false,
895
+ writable: false,
896
+ value: source
897
+ });
898
+
899
+ if (Object.freeze) {
900
+ Object.freeze(element.props);
901
+ Object.freeze(element);
902
+ }
903
+ }
904
+
905
+ return element;
906
+ };
907
+ /**
908
+ * https://github.com/reactjs/rfcs/pull/107
909
+ * @param {*} type
910
+ * @param {object} props
911
+ * @param {string} key
912
+ */
913
+
914
+ function jsxDEV(type, config, maybeKey, source, self) {
915
+ {
916
+ var propName; // Reserved names are extracted
917
+
918
+ var props = {};
919
+ var key = null;
920
+ var ref = null; // Currently, key can be spread in as a prop. This causes a potential
921
+ // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
922
+ // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
923
+ // but as an intermediary step, we will use jsxDEV for everything except
924
+ // <div {...props} key="Hi" />, because we aren't currently able to tell if
925
+ // key is explicitly declared to be undefined or not.
926
+
927
+ if (maybeKey !== undefined) {
928
+ key = '' + maybeKey;
929
+ }
930
+
931
+ if (hasValidKey(config)) {
932
+ key = '' + config.key;
933
+ }
934
+
935
+ if (hasValidRef(config)) {
936
+ ref = config.ref;
937
+ warnIfStringRefCannotBeAutoConverted(config, self);
938
+ } // Remaining properties are added to a new props object
939
+
940
+
941
+ for (propName in config) {
942
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
943
+ props[propName] = config[propName];
944
+ }
945
+ } // Resolve default props
946
+
947
+
948
+ if (type && type.defaultProps) {
949
+ var defaultProps = type.defaultProps;
950
+
951
+ for (propName in defaultProps) {
952
+ if (props[propName] === undefined) {
953
+ props[propName] = defaultProps[propName];
954
+ }
955
+ }
956
+ }
957
+
958
+ if (key || ref) {
959
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
960
+
961
+ if (key) {
962
+ defineKeyPropWarningGetter(props, displayName);
963
+ }
964
+
965
+ if (ref) {
966
+ defineRefPropWarningGetter(props, displayName);
967
+ }
968
+ }
969
+
970
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
971
+ }
972
+ }
973
+
974
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
975
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
976
+
977
+ function setCurrentlyValidatingElement$1(element) {
978
+ {
979
+ if (element) {
980
+ var owner = element._owner;
981
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
982
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
983
+ } else {
984
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
985
+ }
986
+ }
987
+ }
988
+
989
+ var propTypesMisspellWarningShown;
990
+
991
+ {
992
+ propTypesMisspellWarningShown = false;
993
+ }
994
+ /**
995
+ * Verifies the object is a ReactElement.
996
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
997
+ * @param {?object} object
998
+ * @return {boolean} True if `object` is a ReactElement.
999
+ * @final
1000
+ */
1001
+
1002
+ function isValidElement(object) {
1003
+ {
1004
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1005
+ }
1006
+ }
1007
+
1008
+ function getDeclarationErrorAddendum() {
1009
+ {
1010
+ if (ReactCurrentOwner$1.current) {
1011
+ var name = getComponentName(ReactCurrentOwner$1.current.type);
1012
+
1013
+ if (name) {
1014
+ return '\n\nCheck the render method of `' + name + '`.';
1015
+ }
1016
+ }
1017
+
1018
+ return '';
1019
+ }
1020
+ }
1021
+
1022
+ function getSourceInfoErrorAddendum(source) {
1023
+ {
1024
+ if (source !== undefined) {
1025
+ var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1026
+ var lineNumber = source.lineNumber;
1027
+ return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1028
+ }
1029
+
1030
+ return '';
1031
+ }
1032
+ }
1033
+ /**
1034
+ * Warn if there's no key explicitly set on dynamic arrays of children or
1035
+ * object keys are not valid. This allows us to keep track of children between
1036
+ * updates.
1037
+ */
1038
+
1039
+
1040
+ var ownerHasKeyUseWarning = {};
1041
+
1042
+ function getCurrentComponentErrorInfo(parentType) {
1043
+ {
1044
+ var info = getDeclarationErrorAddendum();
1045
+
1046
+ if (!info) {
1047
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1048
+
1049
+ if (parentName) {
1050
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1051
+ }
1052
+ }
1053
+
1054
+ return info;
1055
+ }
1056
+ }
1057
+ /**
1058
+ * Warn if the element doesn't have an explicit key assigned to it.
1059
+ * This element is in an array. The array could grow and shrink or be
1060
+ * reordered. All children that haven't already been validated are required to
1061
+ * have a "key" property assigned to it. Error statuses are cached so a warning
1062
+ * will only be shown once.
1063
+ *
1064
+ * @internal
1065
+ * @param {ReactElement} element Element that requires a key.
1066
+ * @param {*} parentType element's parent's type.
1067
+ */
1068
+
1069
+
1070
+ function validateExplicitKey(element, parentType) {
1071
+ {
1072
+ if (!element._store || element._store.validated || element.key != null) {
1073
+ return;
1074
+ }
1075
+
1076
+ element._store.validated = true;
1077
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1078
+
1079
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1080
+ return;
1081
+ }
1082
+
1083
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1084
+ // property, it may be the creator of the child that's responsible for
1085
+ // assigning it a key.
1086
+
1087
+ var childOwner = '';
1088
+
1089
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1090
+ // Give the component that originally created this child.
1091
+ childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
1092
+ }
1093
+
1094
+ setCurrentlyValidatingElement$1(element);
1095
+
1096
+ error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1097
+
1098
+ setCurrentlyValidatingElement$1(null);
1099
+ }
1100
+ }
1101
+ /**
1102
+ * Ensure that every element either is passed in a static location, in an
1103
+ * array with an explicit keys property defined, or in an object literal
1104
+ * with valid key property.
1105
+ *
1106
+ * @internal
1107
+ * @param {ReactNode} node Statically passed child of any type.
1108
+ * @param {*} parentType node's parent's type.
1109
+ */
1110
+
1111
+
1112
+ function validateChildKeys(node, parentType) {
1113
+ {
1114
+ if (typeof node !== 'object') {
1115
+ return;
1116
+ }
1117
+
1118
+ if (Array.isArray(node)) {
1119
+ for (var i = 0; i < node.length; i++) {
1120
+ var child = node[i];
1121
+
1122
+ if (isValidElement(child)) {
1123
+ validateExplicitKey(child, parentType);
1124
+ }
1125
+ }
1126
+ } else if (isValidElement(node)) {
1127
+ // This element was passed in a valid location.
1128
+ if (node._store) {
1129
+ node._store.validated = true;
1130
+ }
1131
+ } else if (node) {
1132
+ var iteratorFn = getIteratorFn(node);
1133
+
1134
+ if (typeof iteratorFn === 'function') {
1135
+ // Entry iterators used to provide implicit keys,
1136
+ // but now we print a separate warning for them later.
1137
+ if (iteratorFn !== node.entries) {
1138
+ var iterator = iteratorFn.call(node);
1139
+ var step;
1140
+
1141
+ while (!(step = iterator.next()).done) {
1142
+ if (isValidElement(step.value)) {
1143
+ validateExplicitKey(step.value, parentType);
1144
+ }
1145
+ }
1146
+ }
1147
+ }
1148
+ }
1149
+ }
1150
+ }
1151
+ /**
1152
+ * Given an element, validate that its props follow the propTypes definition,
1153
+ * provided by the type.
1154
+ *
1155
+ * @param {ReactElement} element
1156
+ */
1157
+
1158
+
1159
+ function validatePropTypes(element) {
1160
+ {
1161
+ var type = element.type;
1162
+
1163
+ if (type === null || type === undefined || typeof type === 'string') {
1164
+ return;
1165
+ }
1166
+
1167
+ var propTypes;
1168
+
1169
+ if (typeof type === 'function') {
1170
+ propTypes = type.propTypes;
1171
+ } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1172
+ // Inner props are checked in the reconciler.
1173
+ type.$$typeof === REACT_MEMO_TYPE)) {
1174
+ propTypes = type.propTypes;
1175
+ } else {
1176
+ return;
1177
+ }
1178
+
1179
+ if (propTypes) {
1180
+ // Intentionally inside to avoid triggering lazy initializers:
1181
+ var name = getComponentName(type);
1182
+ checkPropTypes(propTypes, element.props, 'prop', name, element);
1183
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1184
+ propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1185
+
1186
+ var _name = getComponentName(type);
1187
+
1188
+ error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
1189
+ }
1190
+
1191
+ if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
1192
+ error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1193
+ }
1194
+ }
1195
+ }
1196
+ /**
1197
+ * Given a fragment, validate that it can only be provided with fragment props
1198
+ * @param {ReactElement} fragment
1199
+ */
1200
+
1201
+
1202
+ function validateFragmentProps(fragment) {
1203
+ {
1204
+ var keys = Object.keys(fragment.props);
1205
+
1206
+ for (var i = 0; i < keys.length; i++) {
1207
+ var key = keys[i];
1208
+
1209
+ if (key !== 'children' && key !== 'key') {
1210
+ setCurrentlyValidatingElement$1(fragment);
1211
+
1212
+ error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1213
+
1214
+ setCurrentlyValidatingElement$1(null);
1215
+ break;
1216
+ }
1217
+ }
1218
+
1219
+ if (fragment.ref !== null) {
1220
+ setCurrentlyValidatingElement$1(fragment);
1221
+
1222
+ error('Invalid attribute `ref` supplied to `React.Fragment`.');
1223
+
1224
+ setCurrentlyValidatingElement$1(null);
1225
+ }
1226
+ }
1227
+ }
1228
+
1229
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1230
+ {
1231
+ var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1232
+ // succeed and there will likely be errors in render.
1233
+
1234
+ if (!validType) {
1235
+ var info = '';
1236
+
1237
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1238
+ info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
1239
+ }
1240
+
1241
+ var sourceInfo = getSourceInfoErrorAddendum(source);
1242
+
1243
+ if (sourceInfo) {
1244
+ info += sourceInfo;
1245
+ } else {
1246
+ info += getDeclarationErrorAddendum();
1247
+ }
1248
+
1249
+ var typeString;
1250
+
1251
+ if (type === null) {
1252
+ typeString = 'null';
1253
+ } else if (Array.isArray(type)) {
1254
+ typeString = 'array';
1255
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1256
+ typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
1257
+ info = ' Did you accidentally export a JSX literal instead of a component?';
1258
+ } else {
1259
+ typeString = typeof type;
1260
+ }
1261
+
1262
+ error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
1263
+ }
1264
+
1265
+ var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1266
+ // TODO: Drop this when these are no longer allowed as the type argument.
1267
+
1268
+ if (element == null) {
1269
+ return element;
1270
+ } // Skip key warning if the type isn't valid since our key validation logic
1271
+ // doesn't expect a non-string/function type and can throw confusing errors.
1272
+ // We don't want exception behavior to differ between dev and prod.
1273
+ // (Rendering will throw with a helpful message and as soon as the type is
1274
+ // fixed, the key warnings will appear.)
1275
+
1276
+
1277
+ if (validType) {
1278
+ var children = props.children;
1279
+
1280
+ if (children !== undefined) {
1281
+ if (isStaticChildren) {
1282
+ if (Array.isArray(children)) {
1283
+ for (var i = 0; i < children.length; i++) {
1284
+ validateChildKeys(children[i], type);
1285
+ }
1286
+
1287
+ if (Object.freeze) {
1288
+ Object.freeze(children);
1289
+ }
1290
+ } else {
1291
+ error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
1292
+ }
1293
+ } else {
1294
+ validateChildKeys(children, type);
1295
+ }
1296
+ }
1297
+ }
1298
+
1299
+ if (type === exports.Fragment) {
1300
+ validateFragmentProps(element);
1301
+ } else {
1302
+ validatePropTypes(element);
1303
+ }
1304
+
1305
+ return element;
1306
+ }
1307
+ } // These two functions exist to still get child warnings in dev
1308
+ // even with the prod transform. This means that jsxDEV is purely
1309
+ // opt-in behavior for better messages but that we won't stop
1310
+ // giving you warnings if you use production apis.
1311
+
1312
+ function jsxWithValidationStatic(type, props, key) {
1313
+ {
1314
+ return jsxWithValidation(type, props, key, true);
1315
+ }
1316
+ }
1317
+ function jsxWithValidationDynamic(type, props, key) {
1318
+ {
1319
+ return jsxWithValidation(type, props, key, false);
1320
+ }
1321
+ }
1322
+
1323
+ var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
1324
+ // for now we can ship identical prod functions
1325
+
1326
+ var jsxs = jsxWithValidationStatic ;
1327
+
1328
+ exports.jsx = jsx;
1329
+ exports.jsxs = jsxs;
1330
+ })();
1331
+ }
1332
+
1333
+
1334
+ /***/ }),
1335
+
1336
+ /***/ "./node_modules/react/jsx-runtime.js":
1337
+ /*!*******************************************!*\
1338
+ !*** ./node_modules/react/jsx-runtime.js ***!
1339
+ \*******************************************/
1340
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1341
+
1342
+
1343
+
1344
+ if (false) {} else {
1345
+ module.exports = __webpack_require__(/*! ./cjs/react-jsx-runtime.development.js */ "./node_modules/react/cjs/react-jsx-runtime.development.js");
1346
+ }
1347
+
1348
+
1349
+ /***/ }),
1350
+
1351
+ /***/ "./editor/components.tsx":
1352
+ /*!*******************************!*\
1353
+ !*** ./editor/components.tsx ***!
1354
+ \*******************************/
1355
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1356
+
1357
+ __webpack_require__.r(__webpack_exports__);
1358
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1359
+ /* harmony export */ "FixedWidgetBlock": function() { return /* binding */ FixedWidgetBlock; }
1360
+ /* harmony export */ });
1361
+ /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js");
1362
+ /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
1363
+ /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__);
1364
+ /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
1365
+ /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__);
1366
+ /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose");
1367
+ /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_3__);
1368
+ /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
1369
+ /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_4__);
1370
+ /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
1371
+ /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__);
1372
+ /* harmony import */ var _consts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./consts */ "./editor/consts.ts");
1373
+
1374
+
1375
+
1376
+
1377
+
1378
+
1379
+
1380
+ const WidgetTypeSelector = (props) => (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.RadioControl, { selected: props.selected, options: [
1381
+ { label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Unfixed widget', 'q2w3-fixed-widget'), value: '' },
1382
+ { label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Fix widget', 'q2w3-fixed-widget'), value: _consts__WEBPACK_IMPORTED_MODULE_6__.FixedWidgetClassName },
1383
+ { label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Stop widget', 'q2w3-fixed-widget'), value: _consts__WEBPACK_IMPORTED_MODULE_6__.StopWidgetClassName },
1384
+ ], onChange: props.onSelect }, void 0);
1385
+ const FixedWidgetBlock = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_3__.createHigherOrderComponent)((BlockEdit) => (props) => {
1386
+ if (!(0,_consts__WEBPACK_IMPORTED_MODULE_6__.isFixableWidget)(props.name)) {
1387
+ return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(BlockEdit, Object.assign({}, props), void 0);
1388
+ }
1389
+ const isDynamicWidget = props.name in _consts__WEBPACK_IMPORTED_MODULE_6__.dynamicWidgets;
1390
+ return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.Fragment, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(BlockEdit, Object.assign({}, props), void 0), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InspectorControls, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.PanelBody, Object.assign({ title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Fixed Widget', 'q2w3-fixed-widget'), initialOpen: true }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(WidgetTypeSelector, { selected: isDynamicWidget ? _consts__WEBPACK_IMPORTED_MODULE_6__.dynamicWidgets[props.name] : props.attributes.fixed_widget, onSelect: (fixed_widget) => {
1391
+ if (isDynamicWidget) {
1392
+ _consts__WEBPACK_IMPORTED_MODULE_6__.dynamicWidgets[props.name] = fixed_widget;
1393
+ props.setAttributes({ className: (0,_consts__WEBPACK_IMPORTED_MODULE_6__.assignClassName)(props.attributes.className, fixed_widget) });
1394
+ }
1395
+ props.setAttributes({ fixed_widget });
1396
+ } }, void 0) }), void 0) }, void 0)] }, void 0);
1397
+ }, 'withInspectorControl');
1398
+
1399
+
1400
+ /***/ }),
1401
+
1402
+ /***/ "./editor/consts.ts":
1403
+ /*!**************************!*\
1404
+ !*** ./editor/consts.ts ***!
1405
+ \**************************/
1406
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1407
+
1408
+ __webpack_require__.r(__webpack_exports__);
1409
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1410
+ /* harmony export */ "StopWidgetClassName": function() { return /* binding */ StopWidgetClassName; },
1411
+ /* harmony export */ "FixedWidgetClassName": function() { return /* binding */ FixedWidgetClassName; },
1412
+ /* harmony export */ "dynamicWidgets": function() { return /* binding */ dynamicWidgets; },
1413
+ /* harmony export */ "isFixableWidget": function() { return /* binding */ isFixableWidget; },
1414
+ /* harmony export */ "isDynamicWidget": function() { return /* binding */ isDynamicWidget; },
1415
+ /* harmony export */ "isPluginEnabled": function() { return /* binding */ isPluginEnabled; },
1416
+ /* harmony export */ "filterWidgetClassName": function() { return /* binding */ filterWidgetClassName; },
1417
+ /* harmony export */ "assignClassName": function() { return /* binding */ assignClassName; }
1418
+ /* harmony export */ });
1419
+ const StopWidgetClassName = 'FixedWidget__stop_widget';
1420
+ const FixedWidgetClassName = 'FixedWidget__fixed_widget';
1421
+ const unFixableWidgets = {
1422
+ 'core/legacy-widget': true
1423
+ };
1424
+ const dynamicWidgets = {};
1425
+ /**
1426
+ * @param {string} widget - Widget's name
1427
+ * @returns {boolean} `true`, if widget is fixable
1428
+ */
1429
+ const isFixableWidget = (widget) => !(widget in unFixableWidgets);
1430
+ /**
1431
+ * Dynamic Widgets return null from save method
1432
+ * @param w
1433
+ * @returns true, if widget is dynamic
1434
+ */
1435
+ const isDynamicWidget = (w) => {
1436
+ try {
1437
+ return w.save(w.example) === null;
1438
+ }
1439
+ catch (_e) {
1440
+ return false;
1441
+ }
1442
+ };
1443
+ const availablePages = ['/widgets.php'];
1444
+ const isPluginEnabled = (pathname) => availablePages.some((page) => pathname.includes(page));
1445
+ /**
1446
+ * Remove widget's class names from `className`
1447
+ * @param {string} className
1448
+ * @returns {string}
1449
+ */
1450
+ const filterWidgetClassName = (className = '') => className
1451
+ .split(' ')
1452
+ .filter((c) => !!c && c !== StopWidgetClassName && c !== FixedWidgetClassName)
1453
+ .join(' ');
1454
+ const assignClassName = (className = '', fixed_widget) => `${filterWidgetClassName(className)} ${fixed_widget}`.trim();
1455
+
1456
+
1457
+ /***/ }),
1458
+
1459
+ /***/ "./editor/widget.ts":
1460
+ /*!**************************!*\
1461
+ !*** ./editor/widget.ts ***!
1462
+ \**************************/
1463
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1464
+
1465
+ __webpack_require__.r(__webpack_exports__);
1466
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1467
+ /* harmony export */ "addWidgetClassName": function() { return /* binding */ addWidgetClassName; },
1468
+ /* harmony export */ "addWidgetTypeAttribute": function() { return /* binding */ addWidgetTypeAttribute; }
1469
+ /* harmony export */ });
1470
+ /* harmony import */ var _consts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./consts */ "./editor/consts.ts");
1471
+
1472
+ const addWidgetClassName = (props, _block, attributes) => Object.assign({}, props, {
1473
+ className: (0,_consts__WEBPACK_IMPORTED_MODULE_0__.assignClassName)(props.className, attributes.fixed_widget)
1474
+ });
1475
+ const addWidgetTypeAttribute = (settings, name) => {
1476
+ if (!(0,_consts__WEBPACK_IMPORTED_MODULE_0__.isFixableWidget)(name)) {
1477
+ return settings;
1478
+ }
1479
+ if ((0,_consts__WEBPACK_IMPORTED_MODULE_0__.isDynamicWidget)(settings)) {
1480
+ _consts__WEBPACK_IMPORTED_MODULE_0__.dynamicWidgets[name] = '';
1481
+ return settings;
1482
+ }
1483
+ return Object.assign({}, settings, {
1484
+ attributes: Object.assign({}, settings.attributes, {
1485
+ fixed_widget: { default: '', type: 'string', },
1486
+ }),
1487
+ });
1488
+ };
1489
+
1490
+
1491
+ /***/ }),
1492
+
1493
+ /***/ "react":
1494
+ /*!************************!*\
1495
+ !*** external "React" ***!
1496
+ \************************/
1497
+ /***/ (function(module) {
1498
+
1499
+ module.exports = window["React"];
1500
+
1501
+ /***/ }),
1502
+
1503
+ /***/ "@wordpress/block-editor":
1504
+ /*!*************************************!*\
1505
+ !*** external ["wp","blockEditor"] ***!
1506
+ \*************************************/
1507
+ /***/ (function(module) {
1508
+
1509
+ module.exports = window["wp"]["blockEditor"];
1510
+
1511
+ /***/ }),
1512
+
1513
+ /***/ "@wordpress/components":
1514
+ /*!************************************!*\
1515
+ !*** external ["wp","components"] ***!
1516
+ \************************************/
1517
+ /***/ (function(module) {
1518
+
1519
+ module.exports = window["wp"]["components"];
1520
+
1521
+ /***/ }),
1522
+
1523
+ /***/ "@wordpress/compose":
1524
+ /*!*********************************!*\
1525
+ !*** external ["wp","compose"] ***!
1526
+ \*********************************/
1527
+ /***/ (function(module) {
1528
+
1529
+ module.exports = window["wp"]["compose"];
1530
+
1531
+ /***/ }),
1532
+
1533
+ /***/ "@wordpress/element":
1534
+ /*!*********************************!*\
1535
+ !*** external ["wp","element"] ***!
1536
+ \*********************************/
1537
+ /***/ (function(module) {
1538
+
1539
+ module.exports = window["wp"]["element"];
1540
+
1541
+ /***/ }),
1542
+
1543
+ /***/ "@wordpress/hooks":
1544
+ /*!*******************************!*\
1545
+ !*** external ["wp","hooks"] ***!
1546
+ \*******************************/
1547
+ /***/ (function(module) {
1548
+
1549
+ module.exports = window["wp"]["hooks"];
1550
+
1551
+ /***/ }),
1552
+
1553
+ /***/ "@wordpress/i18n":
1554
+ /*!******************************!*\
1555
+ !*** external ["wp","i18n"] ***!
1556
+ \******************************/
1557
+ /***/ (function(module) {
1558
+
1559
+ module.exports = window["wp"]["i18n"];
1560
+
1561
+ /***/ })
1562
+
1563
+ /******/ });
1564
+ /************************************************************************/
1565
+ /******/ // The module cache
1566
+ /******/ var __webpack_module_cache__ = {};
1567
+ /******/
1568
+ /******/ // The require function
1569
+ /******/ function __webpack_require__(moduleId) {
1570
+ /******/ // Check if module is in cache
1571
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
1572
+ /******/ if (cachedModule !== undefined) {
1573
+ /******/ return cachedModule.exports;
1574
+ /******/ }
1575
+ /******/ // Create a new module (and put it into the cache)
1576
+ /******/ var module = __webpack_module_cache__[moduleId] = {
1577
+ /******/ // no module.id needed
1578
+ /******/ // no module.loaded needed
1579
+ /******/ exports: {}
1580
+ /******/ };
1581
+ /******/
1582
+ /******/ // Execute the module function
1583
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
1584
+ /******/
1585
+ /******/ // Return the exports of the module
1586
+ /******/ return module.exports;
1587
+ /******/ }
1588
+ /******/
1589
+ /************************************************************************/
1590
+ /******/ /* webpack/runtime/compat get default export */
1591
+ /******/ !function() {
1592
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
1593
+ /******/ __webpack_require__.n = function(module) {
1594
+ /******/ var getter = module && module.__esModule ?
1595
+ /******/ function() { return module['default']; } :
1596
+ /******/ function() { return module; };
1597
+ /******/ __webpack_require__.d(getter, { a: getter });
1598
+ /******/ return getter;
1599
+ /******/ };
1600
+ /******/ }();
1601
+ /******/
1602
+ /******/ /* webpack/runtime/define property getters */
1603
+ /******/ !function() {
1604
+ /******/ // define getter functions for harmony exports
1605
+ /******/ __webpack_require__.d = function(exports, definition) {
1606
+ /******/ for(var key in definition) {
1607
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
1608
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
1609
+ /******/ }
1610
+ /******/ }
1611
+ /******/ };
1612
+ /******/ }();
1613
+ /******/
1614
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
1615
+ /******/ !function() {
1616
+ /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
1617
+ /******/ }();
1618
+ /******/
1619
+ /******/ /* webpack/runtime/make namespace object */
1620
+ /******/ !function() {
1621
+ /******/ // define __esModule on exports
1622
+ /******/ __webpack_require__.r = function(exports) {
1623
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1624
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1625
+ /******/ }
1626
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
1627
+ /******/ };
1628
+ /******/ }();
1629
+ /******/
1630
+ /************************************************************************/
1631
+ var __webpack_exports__ = {};
1632
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
1633
+ !function() {
1634
+ /*!***************************!*\
1635
+ !*** ./editor/backend.ts ***!
1636
+ \***************************/
1637
+ __webpack_require__.r(__webpack_exports__);
1638
+ /* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/hooks */ "@wordpress/hooks");
1639
+ /* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_0__);
1640
+ /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components */ "./editor/components.tsx");
1641
+ /* harmony import */ var _consts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./consts */ "./editor/consts.ts");
1642
+ /* harmony import */ var _widget__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./widget */ "./editor/widget.ts");
1643
+
1644
+
1645
+
1646
+
1647
+ (() => {
1648
+ if (typeof window === 'undefined' || !(0,_consts__WEBPACK_IMPORTED_MODULE_2__.isPluginEnabled)(window.location.pathname)) {
1649
+ return;
1650
+ }
1651
+ //#region init
1652
+ (0,_wordpress_hooks__WEBPACK_IMPORTED_MODULE_0__.addFilter)('blocks.registerBlockType', 'fixed_widget', _widget__WEBPACK_IMPORTED_MODULE_3__.addWidgetTypeAttribute);
1653
+ //#endregion
1654
+ //#region sidebar
1655
+ (0,_wordpress_hooks__WEBPACK_IMPORTED_MODULE_0__.addFilter)('editor.BlockEdit', 'fixed_widget', _components__WEBPACK_IMPORTED_MODULE_1__.FixedWidgetBlock);
1656
+ //#endregion
1657
+ //#region apply class names on save
1658
+ (0,_wordpress_hooks__WEBPACK_IMPORTED_MODULE_0__.addFilter)('blocks.getSaveContent.extraProps', 'fixed_widget', _widget__WEBPACK_IMPORTED_MODULE_3__.addWidgetClassName);
1659
+ //#endregion
1660
+ })();
1661
+
1662
+ }();
1663
+ /******/ })()
1664
+ ;
1665
+ //# sourceMappingURL=backend.js.map
js/backend.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var e={418:function(e){var t=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function n(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach((function(e){i[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}()?Object.assign:function(e,o){for(var s,a,d=n(e),c=1;c<arguments.length;c++){for(var l in s=Object(arguments[c]))r.call(s,l)&&(d[l]=s[l]);if(t){a=t(s);for(var f=0;f<a.length;f++)i.call(s,a[f])&&(d[a[f]]=s[a[f]])}}return d}},251:function(e,t,r){r(418);var i=r(196),n=60103;if("function"==typeof Symbol&&Symbol.for){var o=Symbol.for;n=o("react.element"),o("react.fragment")}var s=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a=Object.prototype.hasOwnProperty,d={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,r){var i,o={},c=null,l=null;for(i in void 0!==r&&(c=""+r),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(l=t.ref),t)a.call(t,i)&&!d.hasOwnProperty(i)&&(o[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===o[i]&&(o[i]=t[i]);return{$$typeof:n,type:e,key:c,ref:l,props:o,_owner:s.current}}t.jsx=c,t.jsxs=c},893:function(e,t,r){e.exports=r(251)},196:function(e){e.exports=window.React}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var o=t[i]={exports:{}};return e[i](o,o.exports,r),o.exports}!function(){var e=window.wp.hooks,t=r(893),i=window.wp.blockEditor,n=window.wp.components,o=window.wp.compose,s=window.wp.element,a=window.wp.i18n;const d="FixedWidget__stop_widget",c="FixedWidget__fixed_widget",l={"core/legacy-widget":!0},f={},w=e=>!(e in l),p=(e="",t)=>`${((e="")=>e.split(" ").filter((e=>!!e&&e!==d&&e!==c)).join(" "))(e)} ${t}`.trim(),u=e=>(0,t.jsx)(n.RadioControl,{selected:e.selected,options:[{label:(0,a.__)("Unfixed widget","q2w3-fixed-widget"),value:""},{label:(0,a.__)("Fix widget","q2w3-fixed-widget"),value:c},{label:(0,a.__)("Stop widget","q2w3-fixed-widget"),value:d}],onChange:e.onSelect},void 0),g=(0,o.createHigherOrderComponent)((e=>r=>{if(!w(r.name))return(0,t.jsx)(e,Object.assign({},r),void 0);const o=r.name in f;return(0,t.jsxs)(s.Fragment,{children:[(0,t.jsx)(e,Object.assign({},r),void 0),(0,t.jsx)(i.InspectorControls,{children:(0,t.jsx)(n.PanelBody,Object.assign({title:(0,a.__)("Fixed Widget","q2w3-fixed-widget"),initialOpen:!0},{children:(0,t.jsx)(u,{selected:o?f[r.name]:r.attributes.fixed_widget,onSelect:e=>{o&&(f[r.name]=e,r.setAttributes({className:p(r.attributes.className,e)})),r.setAttributes({fixed_widget:e})}},void 0)}),void 0)},void 0)]},void 0)}),"withInspectorControl");var b;"undefined"!=typeof window&&(b=window.location.pathname,["/widgets.php"].some((e=>b.includes(e))))&&((0,e.addFilter)("blocks.registerBlockType","fixed_widget",((e,t)=>w(t)?(e=>{try{return null===e.save(e.example)}catch(e){return!1}})(e)?(f[t]="",e):Object.assign({},e,{attributes:Object.assign({},e.attributes,{fixed_widget:{default:"",type:"string"}})}):e)),(0,e.addFilter)("editor.BlockEdit","fixed_widget",g),(0,e.addFilter)("blocks.getSaveContent.extraProps","fixed_widget",((e,t,r)=>Object.assign({},e,{className:p(e.className,r.fixed_widget)}))))}()}();
js/frontend.js ADDED
@@ -0,0 +1,437 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ /*! *****************************************************************************
4
+ Copyright (c) Microsoft Corporation.
5
+
6
+ Permission to use, copy, modify, and/or distribute this software for any
7
+ purpose with or without fee is hereby granted.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
16
+ ***************************************************************************** */
17
+ /* global Reflect, Promise */
18
+
19
+ var extendStatics = function(d, b) {
20
+ extendStatics = Object.setPrototypeOf ||
21
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
23
+ return extendStatics(d, b);
24
+ };
25
+
26
+ function __extends(d, b) {
27
+ if (typeof b !== "function" && b !== null)
28
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29
+ extendStatics(d, b);
30
+ function __() { this.constructor = d; }
31
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32
+ }
33
+
34
+ var __assign = function() {
35
+ __assign = Object.assign || function __assign(t) {
36
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
37
+ s = arguments[i];
38
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
39
+ }
40
+ return t;
41
+ };
42
+ return __assign.apply(this, arguments);
43
+ };
44
+
45
+ function __spreadArray(to, from, pack) {
46
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
47
+ if (ar || !(i in from)) {
48
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
49
+ ar[i] = from[i];
50
+ }
51
+ }
52
+ return to.concat(ar || Array.prototype.slice.call(from));
53
+ }
54
+
55
+ var queryWidgets = function (container, className) {
56
+ return Array.from(container.querySelectorAll("." + className))
57
+ .filter(function (el) { return el !== null; });
58
+ };
59
+
60
+ var Widget = /** @class */ (function () {
61
+ function Widget(el) {
62
+ this.el = el;
63
+ this.top_offset = 0;
64
+ /** total offset from current element to root parent */
65
+ this.root_offset = 0;
66
+ this.need_to_calc_el_offset = function (_) { return false; };
67
+ }
68
+ Widget.prototype.render = function () { };
69
+ Widget.prototype.mount = function (user_margins, layer, _max_top_offset) {
70
+ if (!this.el || !this.el.parentElement) {
71
+ return;
72
+ }
73
+ this.el.style.zIndex = "" + layer;
74
+ this.top_offset = this.get_total_top_offset(user_margins);
75
+ this.root_offset = get_root_offset(this.el, document.body);
76
+ };
77
+ Widget.prototype.getSidebar = function () {
78
+ return this.el && this.el.parentElement;
79
+ };
80
+ Widget.prototype.get_total_top_offset = function (margins) {
81
+ var next = function (el) { return el && el.previousElementSibling; };
82
+ return get_sibilings_offset(next, this.need_to_calc_el_offset, next(this.el), margins.margin_top);
83
+ };
84
+ Widget.queryAll = function () {
85
+ var _this = this;
86
+ return []
87
+ .concat(Array.from(document.querySelectorAll("." + this.CLASSNAME)), Array.from(document.querySelectorAll("[data-fixed_widget=" + this.CLASSNAME)))
88
+ .map(function (el) {
89
+ el.classList.remove(_this.CLASSNAME);
90
+ el.removeAttribute('data-fixed_widget');
91
+ return new _this(getWidgetContainer(el));
92
+ });
93
+ };
94
+ Widget.CLASSNAME = 'FixedWidget__';
95
+ return Widget;
96
+ }());
97
+ var getWidgetContainer = function (el) {
98
+ return el.parentElement && (el.parentElement.childElementCount === 1 ||
99
+ /**
100
+ * Group can contain multiple children, but this is one Widget,
101
+ */
102
+ el.parentElement.classList.toString().includes('wp-block-group') ||
103
+ el.parentElement.classList.contains('widget')) ? getWidgetContainer(el.parentElement) : el;
104
+ };
105
+ var PositionWidget = /** @class */ (function (_super) {
106
+ __extends(PositionWidget, _super);
107
+ function PositionWidget() {
108
+ var _this = _super !== null && _super.apply(this, arguments) || this;
109
+ _this.bottom_offset = 0;
110
+ _this.top_margin = 0;
111
+ /** Top offset of StopWidget */
112
+ _this.max_top_offset = 0;
113
+ _this.bottom_margin = 0;
114
+ _this.user_margins = {};
115
+ _this.prevScrollTop = 0;
116
+ return _this;
117
+ }
118
+ PositionWidget.prototype.mount = function (user_margins, layer, max_top_offset) {
119
+ _super.prototype.mount.call(this, user_margins, layer, max_top_offset);
120
+ if (!this.el || !this.el.parentElement) {
121
+ return;
122
+ }
123
+ this.user_margins = user_margins;
124
+ var _a = getComputedStyle(this.el), marginTop = _a.marginTop, marginBottom = _a.marginBottom;
125
+ this.bottom_margin = parseInt(marginBottom);
126
+ this.top_margin = parseInt(marginTop);
127
+ this.bottom_offset = this.get_total_bottom_offset(user_margins);
128
+ this.max_top_offset = max_top_offset;
129
+ };
130
+ PositionWidget.prototype.render = function () {
131
+ if (!this.el || !this.el.parentElement) {
132
+ return;
133
+ }
134
+ var scrollTop = document.documentElement.scrollTop;
135
+ this.prevScrollTop = scrollTop;
136
+ this.onScroll(scrollTop);
137
+ };
138
+ PositionWidget.prototype.onScroll = function (_scrollTop) { };
139
+ PositionWidget.prototype.get_total_bottom_offset = function (margins) {
140
+ var next = function (el) { return el && el.nextElementSibling; };
141
+ return get_sibilings_offset(next, this.need_to_calc_el_offset, next(this.el), margins.margin_bottom);
142
+ };
143
+ PositionWidget.CLASSNAME = 'FixedWidget__fixed_widget';
144
+ return PositionWidget;
145
+ }(Widget));
146
+ /**
147
+ * Calc total offset of all fixed/sticked sibislings
148
+ * @param next
149
+ * @param el
150
+ * @param offset
151
+ * @returns
152
+ */
153
+ var get_sibilings_offset = function (next, need_to_calc_el_offset, el, offset) {
154
+ if (offset === void 0) { offset = 0; }
155
+ if (!el) {
156
+ return offset;
157
+ }
158
+ if (!need_to_calc_el_offset(el)) {
159
+ return get_sibilings_offset(next, need_to_calc_el_offset, next(el), offset);
160
+ }
161
+ var _a = getComputedStyle(el), marginTop = _a.marginTop, marginBottom = _a.marginBottom;
162
+ return get_sibilings_offset(next, need_to_calc_el_offset, next(el), offset + el.offsetHeight + parseInt(marginTop || '0') + parseInt(marginBottom || '0'));
163
+ };
164
+ /**
165
+ * Calc total offset from current element to root parent
166
+ * @param el
167
+ * @param top_parent
168
+ * @param offset
169
+ * @returns
170
+ */
171
+ var get_root_offset = function (el, top_parent, offset) {
172
+ if (offset === void 0) { offset = 0; }
173
+ if (!el || el === top_parent) {
174
+ return offset;
175
+ }
176
+ return offset + get_root_offset(el.offsetParent, top_parent, el.offsetTop);
177
+ };
178
+
179
+ var FixedWidget = /** @class */ (function (_super) {
180
+ __extends(FixedWidget, _super);
181
+ function FixedWidget(el) {
182
+ var _this = _super.call(this, el) || this;
183
+ _this.is_pinned = false;
184
+ _this.relative_top = 0;
185
+ _this.init_style = { position: 'static', top: '', bottom: '', width: '', height: '' };
186
+ _this.need_to_calc_el_offset = function (el) {
187
+ return el.classList.contains(FixedWidget.CLASSNAME);
188
+ };
189
+ if (!_this.el || !_this.el.parentElement) {
190
+ return _this;
191
+ }
192
+ _this.el.classList.add(FixedWidget.CLASSNAME);
193
+ return _this;
194
+ }
195
+ FixedWidget.prototype.mount = function (margins, layer, max_top_offset) {
196
+ _super.prototype.mount.call(this, margins, layer, max_top_offset);
197
+ if (!this.el) {
198
+ return;
199
+ }
200
+ this.relative_top =
201
+ this.max_top_offset
202
+ - this.top_offset
203
+ - this.el.clientHeight
204
+ - this.bottom_offset
205
+ - this.bottom_margin
206
+ - this.top_margin;
207
+ this.clone();
208
+ this.store_style(getComputedStyle(this.el));
209
+ };
210
+ FixedWidget.prototype.clone = function () {
211
+ var _this = this;
212
+ var _a;
213
+ if (!this.el) {
214
+ return;
215
+ }
216
+ this.clone_el = this.el.cloneNode(false);
217
+ this.clone_el.getAttributeNames().forEach(function (attr) {
218
+ _this.clone_el.removeAttribute(attr);
219
+ });
220
+ this.clone_el.style.height = this.el.clientHeight + "px";
221
+ this.clone_el.style.width = this.el.clientWidth + "px";
222
+ this.clone_el.style.display = 'none';
223
+ (_a = this.el.parentElement) === null || _a === void 0 ? void 0 : _a.insertBefore(this.clone_el, this.el);
224
+ };
225
+ FixedWidget.prototype.store_style = function (style) {
226
+ this.init_style.position = style.position;
227
+ this.init_style.top = style.top;
228
+ this.init_style.width = style.width;
229
+ this.init_style.height = style.top;
230
+ };
231
+ FixedWidget.prototype.restore_style = function (style) {
232
+ if (!this.is_pinned) {
233
+ return;
234
+ }
235
+ this.is_pinned = false;
236
+ style.position = this.init_style.position;
237
+ style.top = this.init_style.top;
238
+ if (this.clone_el) {
239
+ this.clone_el.style.display = 'none';
240
+ }
241
+ };
242
+ FixedWidget.prototype.onScroll = function (scrollTop) {
243
+ if (!this.el) {
244
+ return;
245
+ }
246
+ var need_to_fix = scrollTop > this.root_offset - this.top_offset;
247
+ var limited_by_stop_element = this.max_top_offset !== 0 && scrollTop > this.relative_top;
248
+ var top = limited_by_stop_element ? this.relative_top - scrollTop + this.top_offset : this.top_offset;
249
+ need_to_fix ?
250
+ this.fix(top) :
251
+ this.restore_style(this.el.style);
252
+ };
253
+ FixedWidget.prototype.fix = function (top) {
254
+ if (!this.el) {
255
+ return;
256
+ }
257
+ this.el.style.top = top + "px";
258
+ if (this.is_pinned) {
259
+ return;
260
+ }
261
+ this.is_pinned = true;
262
+ this.el.style.position = 'fixed';
263
+ this.el.style.transition = 'transform 0.5s';
264
+ this.el.style.width = this.init_style.width;
265
+ this.el.style.height = this.init_style.height;
266
+ if (!this.clone_el) {
267
+ return;
268
+ }
269
+ this.clone_el.style.display = 'block';
270
+ };
271
+ FixedWidget.new = function (selector) {
272
+ return new FixedWidget(document.querySelector(selector));
273
+ };
274
+ FixedWidget.is = function (selector) {
275
+ var el = document.querySelector(selector);
276
+ return !!el && el.classList.contains(FixedWidget.CLASSNAME);
277
+ };
278
+ return FixedWidget;
279
+ }(PositionWidget));
280
+
281
+ var StopWidget = /** @class */ (function (_super) {
282
+ __extends(StopWidget, _super);
283
+ function StopWidget(el) {
284
+ var _this = _super.call(this, el) || this;
285
+ _this.need_to_calc_el_offset = function () { return true; };
286
+ if (!_this.el || !_this.el.parentElement) {
287
+ return _this;
288
+ }
289
+ _this.el.classList.add(StopWidget.CLASSNAME);
290
+ return _this;
291
+ }
292
+ StopWidget.new = function (selector) {
293
+ return new StopWidget(document.querySelector(selector));
294
+ };
295
+ StopWidget.is = function (selector) {
296
+ var el = document.querySelector(selector);
297
+ return !!el && el.classList.contains(StopWidget.CLASSNAME);
298
+ };
299
+ StopWidget.CLASSNAME = 'FixedWidget__stop_widget';
300
+ return StopWidget;
301
+ }(Widget));
302
+
303
+ var StickyWidget = /** @class */ (function (_super) {
304
+ __extends(StickyWidget, _super);
305
+ function StickyWidget(el) {
306
+ var _this = _super.call(this, el) || this;
307
+ _this.margins = 0;
308
+ _this.borderBox = 0; /** cleintHeight+ top & bottom margins */
309
+ _this.need_to_calc_el_offset = function (el) {
310
+ return el.classList.contains(StickyWidget.CLASSNAME) ||
311
+ el.classList.contains(StopWidget.CLASSNAME);
312
+ };
313
+ if (!_this.el || !_this.el.parentElement) {
314
+ return _this;
315
+ }
316
+ _this.el.classList.add(StickyWidget.CLASSNAME);
317
+ return _this;
318
+ }
319
+ StickyWidget.prototype.mount = function (margins, layer, max_top_offset) {
320
+ _super.prototype.mount.call(this, margins, layer, max_top_offset);
321
+ if (!this.el || !this.el.parentElement) {
322
+ return;
323
+ }
324
+ this.borderBox = this.el.clientHeight + this.top_margin + this.bottom_margin;
325
+ this.margins = this.el.parentElement.clientHeight - this.borderBox;
326
+ this.el.style.position = 'sticky';
327
+ this.el.style.position = '-webkit-sticky';
328
+ this.el.style.transition = 'transform 0s';
329
+ this.el.style.boxSizing = 'border-box';
330
+ this.el.style.top = this.top_offset + "px";
331
+ };
332
+ StickyWidget.prototype.onScroll = function () {
333
+ if (!this.el || !this.el.parentElement) {
334
+ return;
335
+ }
336
+ var bottom_margin = this.max_top_offset ?
337
+ Math.min(this.max_top_offset - this.el.offsetTop - this.borderBox, this.margins - this.el.offsetTop)
338
+ : this.margins - this.el.offsetTop;
339
+ if (bottom_margin > this.bottom_offset) {
340
+ return;
341
+ }
342
+ this.el.style.transform = "translateY(" + (bottom_margin - this.bottom_offset) + "px)";
343
+ };
344
+ StickyWidget.new = function (selector) {
345
+ return new StickyWidget(document.querySelector(selector));
346
+ };
347
+ StickyWidget.is = function (selector) {
348
+ var el = document.querySelector(selector);
349
+ return !!el && el.classList.contains(StickyWidget.CLASSNAME);
350
+ };
351
+ return StickyWidget;
352
+ }(PositionWidget));
353
+
354
+ var initSidebars = function (options) {
355
+ var WidgetContructor = typeof options.use_sticky_position === 'undefined' || options.use_sticky_position ? StickyWidget : FixedWidget;
356
+ var sticky_widgets = WidgetContructor.queryAll() // widgets by classNames from editor's plugin
357
+ .concat((options.widgets || []) // widgets from option's custom selectors
358
+ .filter(Boolean)
359
+ .map(WidgetContructor.new));
360
+ var stop_widgets = StopWidget.queryAll() // widgets by classNames from editor's plugin;
361
+ .concat((options.stop_elements_selectors || '') // widgets from option's custom selectors
362
+ .split('/n')
363
+ .filter(Boolean)
364
+ .map(StopWidget.new));
365
+ var sidebars = create_sidebars(__spreadArray(__spreadArray([], sticky_widgets, true), stop_widgets, true), options);
366
+ sidebars.forEach(function (sidebar) { sidebar.mount(); });
367
+ document.addEventListener('scroll', function () {
368
+ sidebars.forEach(function (sidebar) { return sidebar.render(); });
369
+ });
370
+ };
371
+ var create_sidebars = function (widgets, options) {
372
+ return Array.from(new Set(widgets.map(function (widget) { return widget.getSidebar(); })))
373
+ .filter(function (sidebar_el) { return sidebar_el !== null; })
374
+ .map(function (sidebar_el) {
375
+ return new Sidebar(sidebar_el, options, typeof options.use_sticky_position === 'undefined' || options.use_sticky_position);
376
+ });
377
+ };
378
+ var Sidebar = /** @class */ (function () {
379
+ function Sidebar(el, margins, use_sticky_position) {
380
+ this.el = el;
381
+ this.margins = margins;
382
+ this.use_sticky_position = use_sticky_position;
383
+ this.not_widgets = [];
384
+ this.widgets = [];
385
+ this.stop_widgets = [];
386
+ this.min_top_offset = 0;
387
+ this.stop_widgets = queryWidgets(this.el, StopWidget.CLASSNAME).map(function (el) { return new StopWidget(el); });
388
+ this.not_widgets = Array.from(this.el.querySelectorAll(".widget:not(." + StickyWidget.CLASSNAME + ",." + StopWidget.CLASSNAME + ")"));
389
+ var WidgetContructor = typeof use_sticky_position === 'undefined' || use_sticky_position ? StickyWidget : FixedWidget;
390
+ this.widgets = queryWidgets(this.el, WidgetContructor.CLASSNAME).map(function (el) { return new WidgetContructor(el); });
391
+ if (!use_sticky_position) {
392
+ return;
393
+ }
394
+ this.el.style.position = 'relative';
395
+ if (this.stop_widgets.length !== 0) {
396
+ return;
397
+ }
398
+ this.el.style.height = '100%';
399
+ }
400
+ Sidebar.prototype.mount = function () {
401
+ var _this = this;
402
+ this.stop_widgets.forEach(function (widget, i) { return widget.mount(_this.margins, 0, 0); });
403
+ this.min_top_offset = this.stop_widgets.length !== 0 ? Math.min.apply(Math, this.stop_widgets.map(this.use_sticky_position ?
404
+ function (w) { return w.top_offset; } :
405
+ function (w) { return w.root_offset; })) :
406
+ 0;
407
+ this.widgets.forEach(function (widget, i) { return widget.mount(_this.margins, i, _this.min_top_offset); });
408
+ };
409
+ Sidebar.prototype.render = function () {
410
+ this.widgets.forEach(function (widget) { return widget.render(); });
411
+ };
412
+ return Sidebar;
413
+ }());
414
+
415
+ var initPlugin = function (options) {
416
+ if (options === void 0) { options = []; }
417
+ initSidebars(options.reduce(function (prev, cur) { return (__assign(__assign(__assign({}, prev), cur), { widgets: prev.widgets.concat(cur.widgets || []) })); }, { widgets: [] }));
418
+ };
419
+
420
+ window.addEventListener('load', onDocumentLoaded);
421
+ document.readyState === "complete" && onDocumentLoaded();
422
+ function onDocumentLoaded() {
423
+ var admin_panel = document.querySelector('#wpadminbar');
424
+ // @ts-ignore
425
+ var user_options = window['q2w3_sidebar_options'] || [{}];
426
+ var options = user_options.map(function (option) {
427
+ option.margin_top = (option.margin_top || 0) + ((admin_panel === null || admin_panel === void 0 ? void 0 : admin_panel.clientHeight) || 0);
428
+ return option;
429
+ });
430
+ if (options.some(function (option) {
431
+ return window.innerWidth < option.screen_max_width ||
432
+ window.innerHeight < option.screen_max_height;
433
+ })) {
434
+ return;
435
+ }
436
+ initPlugin(options);
437
+ }
js/frontend.min.js ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /*! *****************************************************************************
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+ ***************************************************************************** */var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};function e(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var i=function(){return i=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};function n(t,e,i){if(i||2===arguments.length)for(var n,o=0,s=e.length;o<s;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}var o=function(t,e){return Array.from(t.querySelectorAll("."+e)).filter((function(t){return null!==t}))},s=function(){function t(t){this.el=t,this.top_offset=0,this.root_offset=0,this.need_to_calc_el_offset=function(t){return!1}}return t.prototype.render=function(){},t.prototype.mount=function(t,e,i){this.el&&this.el.parentElement&&(this.el.style.zIndex=""+e,this.top_offset=this.get_total_top_offset(t),this.root_offset=f(this.el,document.body))},t.prototype.getSidebar=function(){return this.el&&this.el.parentElement},t.prototype.get_total_top_offset=function(t){var e=function(t){return t&&t.previousElementSibling};return c(e,this.need_to_calc_el_offset,e(this.el),t.margin_top)},t.queryAll=function(){var t=this;return[].concat(Array.from(document.querySelectorAll("."+this.CLASSNAME)),Array.from(document.querySelectorAll("[data-fixed_widget="+this.CLASSNAME))).map((function(e){return e.classList.remove(t.CLASSNAME),e.removeAttribute("data-fixed_widget"),new t(r(e))}))},t.CLASSNAME="FixedWidget__",t}(),r=function(t){return t.parentElement&&(1===t.parentElement.childElementCount||t.parentElement.classList.toString().includes("wp-block-group")||t.parentElement.classList.contains("widget"))?r(t.parentElement):t},l=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.bottom_offset=0,e.top_margin=0,e.max_top_offset=0,e.bottom_margin=0,e.user_margins={},e.prevScrollTop=0,e}return e(i,t),i.prototype.mount=function(e,i,n){if(t.prototype.mount.call(this,e,i,n),this.el&&this.el.parentElement){this.user_margins=e;var o=getComputedStyle(this.el),s=o.marginTop,r=o.marginBottom;this.bottom_margin=parseInt(r),this.top_margin=parseInt(s),this.bottom_offset=this.get_total_bottom_offset(e),this.max_top_offset=n}},i.prototype.render=function(){if(this.el&&this.el.parentElement){var t=document.documentElement.scrollTop;this.prevScrollTop=t,this.onScroll(t)}},i.prototype.onScroll=function(t){},i.prototype.get_total_bottom_offset=function(t){var e=function(t){return t&&t.nextElementSibling};return c(e,this.need_to_calc_el_offset,e(this.el),t.margin_bottom)},i.CLASSNAME="FixedWidget__fixed_widget",i}(s),c=function(t,e,i,n){if(void 0===n&&(n=0),!i)return n;if(!e(i))return c(t,e,t(i),n);var o=getComputedStyle(i),s=o.marginTop,r=o.marginBottom;return c(t,e,t(i),n+i.offsetHeight+parseInt(s||"0")+parseInt(r||"0"))},f=function(t,e,i){return void 0===i&&(i=0),t&&t!==e?i+f(t.offsetParent,e,t.offsetTop):i},h=function(t){function i(e){var n=t.call(this,e)||this;return n.is_pinned=!1,n.relative_top=0,n.init_style={position:"static",top:"",bottom:"",width:"",height:""},n.need_to_calc_el_offset=function(t){return t.classList.contains(i.CLASSNAME)},n.el&&n.el.parentElement?(n.el.classList.add(i.CLASSNAME),n):n}return e(i,t),i.prototype.mount=function(e,i,n){t.prototype.mount.call(this,e,i,n),this.el&&(this.relative_top=this.max_top_offset-this.top_offset-this.el.clientHeight-this.bottom_offset-this.bottom_margin-this.top_margin,this.clone(),this.store_style(getComputedStyle(this.el)))},i.prototype.clone=function(){var t,e=this;this.el&&(this.clone_el=this.el.cloneNode(!1),this.clone_el.getAttributeNames().forEach((function(t){e.clone_el.removeAttribute(t)})),this.clone_el.style.height=this.el.clientHeight+"px",this.clone_el.style.width=this.el.clientWidth+"px",this.clone_el.style.display="none",null===(t=this.el.parentElement)||void 0===t||t.insertBefore(this.clone_el,this.el))},i.prototype.store_style=function(t){this.init_style.position=t.position,this.init_style.top=t.top,this.init_style.width=t.width,this.init_style.height=t.top},i.prototype.restore_style=function(t){this.is_pinned&&(this.is_pinned=!1,t.position=this.init_style.position,t.top=this.init_style.top,this.clone_el&&(this.clone_el.style.display="none"))},i.prototype.onScroll=function(t){if(this.el){var e=t>this.root_offset-this.top_offset,i=0!==this.max_top_offset&&t>this.relative_top?this.relative_top-t+this.top_offset:this.top_offset;e?this.fix(i):this.restore_style(this.el.style)}},i.prototype.fix=function(t){this.el&&(this.el.style.top=t+"px",this.is_pinned||(this.is_pinned=!0,this.el.style.position="fixed",this.el.style.transition="transform 0.5s",this.el.style.width=this.init_style.width,this.el.style.height=this.init_style.height,this.clone_el&&(this.clone_el.style.display="block")))},i.new=function(t){return new i(document.querySelector(t))},i.is=function(t){var e=document.querySelector(t);return!!e&&e.classList.contains(i.CLASSNAME)},i}(l),u=function(t){function i(e){var n=t.call(this,e)||this;return n.need_to_calc_el_offset=function(){return!0},n.el&&n.el.parentElement?(n.el.classList.add(i.CLASSNAME),n):n}return e(i,t),i.new=function(t){return new i(document.querySelector(t))},i.is=function(t){var e=document.querySelector(t);return!!e&&e.classList.contains(i.CLASSNAME)},i.CLASSNAME="FixedWidget__stop_widget",i}(s),a=function(t){function i(e){var n=t.call(this,e)||this;return n.margins=0,n.borderBox=0,n.need_to_calc_el_offset=function(t){return t.classList.contains(i.CLASSNAME)||t.classList.contains(u.CLASSNAME)},n.el&&n.el.parentElement?(n.el.classList.add(i.CLASSNAME),n):n}return e(i,t),i.prototype.mount=function(e,i,n){t.prototype.mount.call(this,e,i,n),this.el&&this.el.parentElement&&(this.borderBox=this.el.clientHeight+this.top_margin+this.bottom_margin,this.margins=this.el.parentElement.clientHeight-this.borderBox,this.el.style.position="sticky",this.el.style.position="-webkit-sticky",this.el.style.transition="transform 0s",this.el.style.boxSizing="border-box",this.el.style.top=this.top_offset+"px")},i.prototype.onScroll=function(){if(this.el&&this.el.parentElement){var t=this.max_top_offset?Math.min(this.max_top_offset-this.el.offsetTop-this.borderBox,this.margins-this.el.offsetTop):this.margins-this.el.offsetTop;t>this.bottom_offset||(this.el.style.transform="translateY("+(t-this.bottom_offset)+"px)")}},i.new=function(t){return new i(document.querySelector(t))},i.is=function(t){var e=document.querySelector(t);return!!e&&e.classList.contains(i.CLASSNAME)},i}(l),p=function(t,e){return Array.from(new Set(t.map((function(t){return t.getSidebar()})))).filter((function(t){return null!==t})).map((function(t){return new _(t,e,void 0===e.use_sticky_position||e.use_sticky_position)}))},_=function(){function t(t,e,i){this.el=t,this.margins=e,this.use_sticky_position=i,this.not_widgets=[],this.widgets=[],this.stop_widgets=[],this.min_top_offset=0,this.stop_widgets=o(this.el,u.CLASSNAME).map((function(t){return new u(t)})),this.not_widgets=Array.from(this.el.querySelectorAll(".widget:not(."+a.CLASSNAME+",."+u.CLASSNAME+")"));var n=void 0===i||i?a:h;this.widgets=o(this.el,n.CLASSNAME).map((function(t){return new n(t)})),i&&(this.el.style.position="relative",0===this.stop_widgets.length&&(this.el.style.height="100%"))}return t.prototype.mount=function(){var t=this;this.stop_widgets.forEach((function(e,i){return e.mount(t.margins,0,0)})),this.min_top_offset=0!==this.stop_widgets.length?Math.min.apply(Math,this.stop_widgets.map(this.use_sticky_position?function(t){return t.top_offset}:function(t){return t.root_offset})):0,this.widgets.forEach((function(e,i){return e.mount(t.margins,i,t.min_top_offset)}))},t.prototype.render=function(){this.widgets.forEach((function(t){return t.render()}))},t}(),m=function(t){void 0===t&&(t=[]),function(t){var e=void 0===t.use_sticky_position||t.use_sticky_position?a:h,i=e.queryAll().concat((t.widgets||[]).filter(Boolean).map(e.new)),o=u.queryAll().concat((t.stop_elements_selectors||"").split("/n").filter(Boolean).map(u.new)),s=p(n(n([],i,!0),o,!0),t);s.forEach((function(t){t.mount()})),document.addEventListener("scroll",(function(){s.forEach((function(t){return t.render()}))}))}(t.reduce((function(t,e){return i(i(i({},t),e),{widgets:t.widgets.concat(e.widgets||[])})}),{widgets:[]}))};function d(){var t=document.querySelector("#wpadminbar"),e=(window.q2w3_sidebar_options||[{}]).map((function(e){return e.margin_top=(e.margin_top||0)+((null==t?void 0:t.clientHeight)||0),e}));e.some((function(t){return window.innerWidth<t.screen_max_width||window.innerHeight<t.screen_max_height}))||m(e)}window.addEventListener("load",d),"complete"===document.readyState&&d();
js/q2w3-fixed-widget.js DELETED
@@ -1,350 +0,0 @@
1
- 'use strict';
2
-
3
- const queryWidgets = (container, className) => Array.from(container.querySelectorAll(`.${className}`))
4
- .filter((el) => el !== null);
5
-
6
- class Widget {
7
- el;
8
- top_offset = 0;
9
- /** total offset from current element to root parent */
10
- root_offset = 0;
11
- constructor(el) {
12
- this.el = el;
13
- }
14
- render() { }
15
- mount(user_margins, layer, _max_top_offset) {
16
- if (!this.el || !this.el.parentElement) {
17
- return;
18
- }
19
- this.el.style.zIndex = `${layer}`;
20
- this.top_offset = this.get_total_top_offset(user_margins);
21
- this.root_offset = get_root_offset(this.el, document.body);
22
- }
23
- ;
24
- getElement() {
25
- return this.el;
26
- }
27
- getSidebar() {
28
- return this.el && this.el.parentElement;
29
- }
30
- get_total_top_offset(margins) {
31
- const next = (el) => el && el.previousElementSibling;
32
- return get_sibilings_offset(next, this.need_to_calc_el_offset, next(this.el), margins.margin_top);
33
- }
34
- }
35
- class PositionWidget extends Widget {
36
- bottom_offset = 0;
37
- top_margin = 0;
38
- /** Top offset of StopWidget */
39
- max_top_offset = 0;
40
- bottom_margin = 0;
41
- user_margins = {};
42
- margins = 0;
43
- prevScrollTop = 0;
44
- mount(user_margins, layer, max_top_offset) {
45
- super.mount(user_margins, layer, max_top_offset);
46
- if (!this.el || !this.el.parentElement) {
47
- return;
48
- }
49
- this.user_margins = user_margins;
50
- const { marginTop, marginBottom } = getComputedStyle(this.el);
51
- this.bottom_margin = parseInt(marginBottom);
52
- this.top_margin = parseInt(marginTop);
53
- this.margins = this.el.parentElement.clientHeight - this.el.clientHeight - this.top_margin - this.bottom_margin;
54
- this.bottom_offset = this.get_total_bottom_offset(user_margins);
55
- this.max_top_offset = max_top_offset;
56
- }
57
- ;
58
- render() {
59
- if (!this.el || !this.el.parentElement) {
60
- return;
61
- }
62
- const scrollTop = document.documentElement.scrollTop;
63
- const deltaScroll = scrollTop - this.prevScrollTop;
64
- this.prevScrollTop = scrollTop;
65
- this.onScroll(scrollTop);
66
- deltaScroll > 0 ? this.onScrollDown(scrollTop) : this.onScrollUp(scrollTop);
67
- }
68
- onScroll(_scrollTop) { }
69
- onScrollDown(_scrollTop) { }
70
- onScrollUp(_scrollTop) { }
71
- get_total_bottom_offset(margins) {
72
- const next = (el) => el && el.nextElementSibling;
73
- return get_sibilings_offset(next, this.need_to_calc_el_offset, next(this.el), margins.margin_bottom);
74
- }
75
- }
76
- /**
77
- * Calc total offset of all fixed/sticked sibislings
78
- * @param next
79
- * @param el
80
- * @param offset
81
- * @returns
82
- */
83
- const get_sibilings_offset = (next, need_to_calc_el_offset, el, offset = 0) => {
84
- if (!el) {
85
- return offset;
86
- }
87
- if (!need_to_calc_el_offset(el)) {
88
- return get_sibilings_offset(next, need_to_calc_el_offset, next(el), offset);
89
- }
90
- const { marginTop, marginBottom } = getComputedStyle(el);
91
- return get_sibilings_offset(next, need_to_calc_el_offset, next(el), offset + el.offsetHeight + parseInt(marginTop || '0') + parseInt(marginBottom || '0'));
92
- };
93
- /**
94
- * Calc total offset from current element to root parent
95
- * @param el
96
- * @param top_parent
97
- * @param offset
98
- * @returns
99
- */
100
- const get_root_offset = (el, top_parent, offset = 0) => {
101
- if (!el || el === top_parent) {
102
- return offset;
103
- }
104
- return offset + get_root_offset(el.offsetParent, top_parent, el.offsetTop);
105
- };
106
-
107
- const DELTA_SCROLL = 200;
108
- class FixedWidget extends PositionWidget {
109
- clone_el;
110
- is_pinned = false;
111
- relative_top = 0;
112
- init_style = { position: 'static', top: '', bottom: '', width: '', height: '' };
113
- static CLASSNAME = 'FixedWidget__fixed';
114
- constructor(el) {
115
- super(el);
116
- if (!this.el || !this.el.parentElement) {
117
- return;
118
- }
119
- this.el.classList.add(FixedWidget.CLASSNAME);
120
- }
121
- mount(margins, layer, max_top_offset) {
122
- super.mount(margins, layer, max_top_offset);
123
- if (!this.el) {
124
- return;
125
- }
126
- this.relative_top =
127
- this.max_top_offset
128
- // - this.top_offset
129
- // + (this.root_offset - this.top_offset)
130
- - this.el.clientHeight
131
- - this.bottom_offset
132
- - this.bottom_margin
133
- - this.top_margin;
134
- this.clone();
135
- this.store_style(getComputedStyle(this.el));
136
- }
137
- clone() {
138
- if (!this.el) {
139
- return;
140
- }
141
- this.clone_el = this.el.cloneNode(false);
142
- this.clone_el.getAttributeNames().forEach((attr) => {
143
- this.clone_el.removeAttribute(attr);
144
- });
145
- this.clone_el.style.height = `${this.el.clientHeight}px`;
146
- this.clone_el.style.width = `${this.el.clientWidth}px`;
147
- this.clone_el.style.display = 'none';
148
- this.el.parentElement?.insertBefore(this.clone_el, this.el);
149
- }
150
- store_style(style) {
151
- this.init_style.position = style.position;
152
- this.init_style.top = style.top;
153
- this.init_style.width = style.width;
154
- this.init_style.height = style.top;
155
- }
156
- restore_style(style) {
157
- if (!this.is_pinned) {
158
- return;
159
- }
160
- this.is_pinned = false;
161
- style.position = this.init_style.position;
162
- style.top = this.init_style.top;
163
- if (this.clone_el) {
164
- this.clone_el.style.display = 'none';
165
- }
166
- }
167
- onScroll(scrollTop) {
168
- if (!this.el) {
169
- return;
170
- }
171
- const need_to_fix = scrollTop > this.root_offset - this.top_offset;
172
- const limited_by_stop_element = this.max_top_offset !== 0 && scrollTop + DELTA_SCROLL > this.relative_top;
173
- need_to_fix ?
174
- this.fix(limited_by_stop_element ? this.relative_top - scrollTop : this.top_offset) :
175
- this.restore_style(this.el.style);
176
- }
177
- need_to_calc_el_offset = (el) => el.classList.contains(FixedWidget.CLASSNAME);
178
- fix(top) {
179
- if (!this.el) {
180
- return;
181
- }
182
- this.el.style.top = `${top}px`;
183
- if (this.is_pinned) {
184
- return;
185
- }
186
- this.is_pinned = true;
187
- this.el.style.position = 'fixed';
188
- this.el.style.transition = 'transform 0.5s';
189
- this.el.style.width = this.init_style.width;
190
- this.el.style.height = this.init_style.height;
191
- if (!this.clone_el) {
192
- return;
193
- }
194
- this.clone_el.style.display = 'block';
195
- }
196
- static new(selector) {
197
- return new FixedWidget(document.querySelector(selector));
198
- }
199
- static is(selector) {
200
- const el = document.querySelector(selector);
201
- return !!el && el.classList.contains(FixedWidget.CLASSNAME);
202
- }
203
- }
204
-
205
- class StopWidget extends Widget {
206
- static CLASSNAME = 'FixedWidget__stop_widget';
207
- constructor(el) {
208
- super(el);
209
- if (!this.el || !this.el.parentElement) {
210
- return;
211
- }
212
- this.el.classList.add(StopWidget.CLASSNAME);
213
- }
214
- need_to_calc_el_offset = () => true;
215
- static new(selector) {
216
- return new StopWidget(document.querySelector(selector));
217
- }
218
- static is(selector) {
219
- const el = document.querySelector(selector);
220
- return !!el && el.classList.contains(StopWidget.CLASSNAME);
221
- }
222
- }
223
-
224
- class StickyWidget extends PositionWidget {
225
- static CLASSNAME = 'FixedWidget__sticky';
226
- constructor(el) {
227
- super(el);
228
- if (!this.el || !this.el.parentElement) {
229
- return;
230
- }
231
- this.el.classList.add(StickyWidget.CLASSNAME);
232
- }
233
- mount(margins, layer, max_top_offset) {
234
- super.mount(margins, layer, max_top_offset);
235
- if (!this.el || !this.el.parentElement) {
236
- return;
237
- }
238
- this.el.style.position = 'sticky';
239
- this.el.style.position = '-webkit-sticky';
240
- this.el.style.transition = 'transform 0s';
241
- this.el.style.boxSizing = 'border-box';
242
- this.el.style.top = `${this.top_offset}px`;
243
- }
244
- onScrollDown() {
245
- if (!this.el || !this.el.parentElement) {
246
- return;
247
- }
248
- const bottom = this.margins - this.el.offsetTop;
249
- if (bottom > this.bottom_offset) {
250
- return;
251
- }
252
- const translateY = this.bottom_offset - bottom;
253
- this.el.style.transform = `translateY(-${translateY}px)`;
254
- }
255
- onScrollUp() {
256
- if (!this.el || !this.el.parentElement) {
257
- return;
258
- }
259
- const bottom = this.margins - this.el.offsetTop;
260
- const translateY = this.bottom_offset - bottom;
261
- this.el.style.transform = `translateY(-${translateY}px)`;
262
- if (bottom < this.bottom_offset) {
263
- return;
264
- }
265
- this.el.style.transform = '';
266
- }
267
- need_to_calc_el_offset = (el) => el.classList.contains(StickyWidget.CLASSNAME) ||
268
- el.classList.contains(StopWidget.CLASSNAME);
269
- static new(selector) {
270
- return new StickyWidget(document.querySelector(selector));
271
- }
272
- static is(selector) {
273
- const el = document.querySelector(selector);
274
- return !!el && el.classList.contains(StickyWidget.CLASSNAME);
275
- }
276
- }
277
-
278
- const init_sidebars = (options) => {
279
- const sticky_widgets = (options.widgets || [])
280
- .filter(Boolean)
281
- .map(options.use_sticky_position ? StickyWidget.new : FixedWidget.new);
282
- const stop_widgets = (options.stop_elements_selectors || '')
283
- .split('/n')
284
- .filter(Boolean)
285
- .map(StopWidget.new);
286
- const sidebars = create_sidebars([...sticky_widgets, ...stop_widgets], options);
287
- sidebars.forEach((sidebar) => { sidebar.mount(); });
288
- document.addEventListener('scroll', () => {
289
- sidebars.forEach((sidebar) => sidebar.render());
290
- });
291
- };
292
- const create_sidebars = (widgets, options) => Array.from(new Set(widgets.map((widget) => widget.getSidebar())))
293
- .filter((sidebar_el) => sidebar_el !== null)
294
- .map((sidebar_el) => new Sidebar(sidebar_el, options, !!options.use_sticky_position));
295
- class Sidebar {
296
- el;
297
- margins;
298
- use_sticky_position;
299
- not_widgets = [];
300
- widgets = [];
301
- stop_widgets = [];
302
- min_top_offset = 0;
303
- constructor(el, margins, use_sticky_position) {
304
- this.el = el;
305
- this.margins = margins;
306
- this.use_sticky_position = use_sticky_position;
307
- this.stop_widgets = queryWidgets(this.el, StopWidget.CLASSNAME).map((el) => new StopWidget(el));
308
- this.not_widgets = Array.from(this.el.querySelectorAll(`.widget:not(.${StickyWidget.CLASSNAME},.${StopWidget.CLASSNAME})`));
309
- const WidgetContructor = use_sticky_position ? StickyWidget : FixedWidget;
310
- this.widgets = queryWidgets(this.el, WidgetContructor.CLASSNAME).map((el) => new WidgetContructor(el));
311
- if (use_sticky_position && this.stop_widgets.length === 0) {
312
- this.el.style.height = '100%';
313
- }
314
- }
315
- mount() {
316
- this.stop_widgets.forEach((widget, i) => widget.mount(this.margins, 0, 0));
317
- this.min_top_offset = this.stop_widgets.length !== 0 ?
318
- Math.min(...this.stop_widgets.map(this.use_sticky_position ?
319
- (w) => w.top_offset :
320
- (w) => w.root_offset)) :
321
- 0;
322
- this.widgets.forEach((widget, i) => widget.mount(this.margins, i, this.min_top_offset));
323
- }
324
- render() {
325
- this.widgets.forEach((widget) => widget.render());
326
- }
327
- }
328
-
329
- const new_sticky_widget = (options = []) => {
330
- init_sidebars(options.reduce((prev, cur) => ({
331
- ...prev,
332
- widgets: prev.widgets.concat(cur.widgets),
333
- })));
334
- };
335
-
336
- window.addEventListener('load', onDocumentLoaded);
337
- document.readyState === "complete" && onDocumentLoaded();
338
- function onDocumentLoaded() {
339
- // @ts-ignore
340
- const user_options = window['q2w3_sidebar_options'];
341
- const admin_panel = document.querySelector('#wpadminbar');
342
- const options = (user_options || []).map((option) => {
343
- option.margin_top += admin_panel?.clientHeight || 0;
344
- return option;
345
- });
346
- if (options.some((option) => window.innerWidth < option.screen_max_width || window.innerHeight < option.screen_max_height)) {
347
- return;
348
- }
349
- new_sticky_widget(options);
350
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/q2w3-fixed-widget.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";const t=(t,e)=>Array.from(t.querySelectorAll(`.${e}`)).filter((t=>null!==t));class e{el;top_offset=0;root_offset=0;constructor(t){this.el=t}render(){}mount(t,e,s){this.el&&this.el.parentElement&&(this.el.style.zIndex=`${e}`,this.top_offset=this.get_total_top_offset(t),this.root_offset=o(this.el,document.body))}getElement(){return this.el}getSidebar(){return this.el&&this.el.parentElement}get_total_top_offset(t){const e=t=>t&&t.previousElementSibling;return i(e,this.need_to_calc_el_offset,e(this.el),t.margin_top)}}class s extends e{bottom_offset=0;top_margin=0;max_top_offset=0;bottom_margin=0;user_margins={};margins=0;prevScrollTop=0;mount(t,e,s){if(super.mount(t,e,s),!this.el||!this.el.parentElement)return;this.user_margins=t;const{marginTop:i,marginBottom:o}=getComputedStyle(this.el);this.bottom_margin=parseInt(o),this.top_margin=parseInt(i),this.margins=this.el.parentElement.clientHeight-this.el.clientHeight-this.top_margin-this.bottom_margin,this.bottom_offset=this.get_total_bottom_offset(t),this.max_top_offset=s}render(){if(!this.el||!this.el.parentElement)return;const t=document.documentElement.scrollTop,e=t-this.prevScrollTop;this.prevScrollTop=t,this.onScroll(t),e>0?this.onScrollDown(t):this.onScrollUp(t)}onScroll(t){}onScrollDown(t){}onScrollUp(t){}get_total_bottom_offset(t){const e=t=>t&&t.nextElementSibling;return i(e,this.need_to_calc_el_offset,e(this.el),t.margin_bottom)}}const i=(t,e,s,o=0)=>{if(!s)return o;if(!e(s))return i(t,e,t(s),o);const{marginTop:n,marginBottom:l}=getComputedStyle(s);return i(t,e,t(s),o+s.offsetHeight+parseInt(n||"0")+parseInt(l||"0"))},o=(t,e,s=0)=>t&&t!==e?s+o(t.offsetParent,e,t.offsetTop):s;class n extends s{clone_el;is_pinned=!1;relative_top=0;init_style={position:"static",top:"",bottom:"",width:"",height:""};static CLASSNAME="FixedWidget__fixed";constructor(t){super(t),this.el&&this.el.parentElement&&this.el.classList.add(n.CLASSNAME)}mount(t,e,s){super.mount(t,e,s),this.el&&(this.relative_top=this.max_top_offset-this.el.clientHeight-this.bottom_offset-this.bottom_margin-this.top_margin,this.clone(),this.store_style(getComputedStyle(this.el)))}clone(){this.el&&(this.clone_el=this.el.cloneNode(!1),this.clone_el.getAttributeNames().forEach((t=>{this.clone_el.removeAttribute(t)})),this.clone_el.style.height=`${this.el.clientHeight}px`,this.clone_el.style.width=`${this.el.clientWidth}px`,this.clone_el.style.display="none",this.el.parentElement?.insertBefore(this.clone_el,this.el))}store_style(t){this.init_style.position=t.position,this.init_style.top=t.top,this.init_style.width=t.width,this.init_style.height=t.top}restore_style(t){this.is_pinned&&(this.is_pinned=!1,t.position=this.init_style.position,t.top=this.init_style.top,this.clone_el&&(this.clone_el.style.display="none"))}onScroll(t){if(!this.el)return;const e=t>this.root_offset-this.top_offset,s=0!==this.max_top_offset&&t+200>this.relative_top;e?this.fix(s?this.relative_top-t:this.top_offset):this.restore_style(this.el.style)}need_to_calc_el_offset=t=>t.classList.contains(n.CLASSNAME);fix(t){this.el&&(this.el.style.top=`${t}px`,this.is_pinned||(this.is_pinned=!0,this.el.style.position="fixed",this.el.style.transition="transform 0.5s",this.el.style.width=this.init_style.width,this.el.style.height=this.init_style.height,this.clone_el&&(this.clone_el.style.display="block")))}static new(t){return new n(document.querySelector(t))}static is(t){const e=document.querySelector(t);return!!e&&e.classList.contains(n.CLASSNAME)}}class l extends e{static CLASSNAME="FixedWidget__stop_widget";constructor(t){super(t),this.el&&this.el.parentElement&&this.el.classList.add(l.CLASSNAME)}need_to_calc_el_offset=()=>!0;static new(t){return new l(document.querySelector(t))}static is(t){const e=document.querySelector(t);return!!e&&e.classList.contains(l.CLASSNAME)}}class r extends s{static CLASSNAME="FixedWidget__sticky";constructor(t){super(t),this.el&&this.el.parentElement&&this.el.classList.add(r.CLASSNAME)}mount(t,e,s){super.mount(t,e,s),this.el&&this.el.parentElement&&(this.el.style.position="sticky",this.el.style.position="-webkit-sticky",this.el.style.transition="transform 0s",this.el.style.boxSizing="border-box",this.el.style.top=`${this.top_offset}px`)}onScrollDown(){if(!this.el||!this.el.parentElement)return;const t=this.margins-this.el.offsetTop;if(t>this.bottom_offset)return;const e=this.bottom_offset-t;this.el.style.transform=`translateY(-${e}px)`}onScrollUp(){if(!this.el||!this.el.parentElement)return;const t=this.margins-this.el.offsetTop,e=this.bottom_offset-t;this.el.style.transform=`translateY(-${e}px)`,t<this.bottom_offset||(this.el.style.transform="")}need_to_calc_el_offset=t=>t.classList.contains(r.CLASSNAME)||t.classList.contains(l.CLASSNAME);static new(t){return new r(document.querySelector(t))}static is(t){const e=document.querySelector(t);return!!e&&e.classList.contains(r.CLASSNAME)}}const h=(t,e)=>Array.from(new Set(t.map((t=>t.getSidebar())))).filter((t=>null!==t)).map((t=>new c(t,e,!!e.use_sticky_position)));class c{el;margins;use_sticky_position;not_widgets=[];widgets=[];stop_widgets=[];min_top_offset=0;constructor(e,s,i){this.el=e,this.margins=s,this.use_sticky_position=i,this.stop_widgets=t(this.el,l.CLASSNAME).map((t=>new l(t))),this.not_widgets=Array.from(this.el.querySelectorAll(`.widget:not(.${r.CLASSNAME},.${l.CLASSNAME})`));const o=i?r:n;this.widgets=t(this.el,o.CLASSNAME).map((t=>new o(t))),i&&0===this.stop_widgets.length&&(this.el.style.height="100%")}mount(){this.stop_widgets.forEach(((t,e)=>t.mount(this.margins,0,0))),this.min_top_offset=0!==this.stop_widgets.length?Math.min(...this.stop_widgets.map(this.use_sticky_position?t=>t.top_offset:t=>t.root_offset)):0,this.widgets.forEach(((t,e)=>t.mount(this.margins,e,this.min_top_offset)))}render(){this.widgets.forEach((t=>t.render()))}}const _=(t=[])=>{(t=>{const e=(t.widgets||[]).filter(Boolean).map(t.use_sticky_position?r.new:n.new),s=(t.stop_elements_selectors||"").split("/n").filter(Boolean).map(l.new),i=h([...e,...s],t);i.forEach((t=>{t.mount()})),document.addEventListener("scroll",(()=>{i.forEach((t=>t.render()))}))})(t.reduce(((t,e)=>({...t,widgets:t.widgets.concat(e.widgets)}))))};function a(){const t=window.q2w3_sidebar_options,e=document.querySelector("#wpadminbar"),s=(t||[]).map((t=>(t.margin_top+=e?.clientHeight||0,t)));s.some((t=>window.innerWidth<t.screen_max_width||window.innerHeight<t.screen_max_height))||_(s)}window.addEventListener("load",a),"complete"===document.readyState&&a();
 
q2w3-fixed-widget.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://wpadvancedads.com/fixed-widget-wordpress/
5
  Description: Use the fixed widget plugin to create sticky widgets that stay in the visible screen area when the page is scrolled up or down and boost your conversions.
6
  Text Domain: q2w3-fixed-widget
7
  Author: Thomas Maier, Max Bond
8
- Version: 6.0.0-beta-1
9
  Author URI: https://wpadvancedads.com/fixed-widget-wordpress/
10
  */
11
 
@@ -23,7 +23,7 @@ class q2w3_fixed_widget {
23
 
24
  const ID = 'q2w3_fixed_widget';
25
 
26
- const VERSION = '6.0.0-beta-1';
27
 
28
  protected static $sidebars_widgets;
29
 
@@ -50,6 +50,8 @@ class q2w3_fixed_widget {
50
 
51
  // add stylesheets for the plugin's backend
52
  add_action( 'admin_enqueue_scripts', array( __CLASS__, 'load_custom_be_styles' ) );
 
 
53
 
54
  if ( ! is_admin() ) {
55
  if ( $options['fix-widget-id'] ) {
@@ -61,6 +63,21 @@ class q2w3_fixed_widget {
61
  }
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  /**
65
  * Load backend styles
66
  */
@@ -80,7 +97,7 @@ class q2w3_fixed_widget {
80
  self::custom_ids();
81
  self::fixed_wigets();
82
 
83
- wp_enqueue_script( self::ID, plugin_dir_url( __FILE__ ) . 'js/q2w3-fixed-widget.min.js', array(), self::VERSION, true );
84
 
85
  self::wp_localize_script();
86
  }
5
  Description: Use the fixed widget plugin to create sticky widgets that stay in the visible screen area when the page is scrolled up or down and boost your conversions.
6
  Text Domain: q2w3-fixed-widget
7
  Author: Thomas Maier, Max Bond
8
+ Version: 6.0.0-beta-2
9
  Author URI: https://wpadvancedads.com/fixed-widget-wordpress/
10
  */
11
 
23
 
24
  const ID = 'q2w3_fixed_widget';
25
 
26
+ const VERSION = '6.0.0-beta-2';
27
 
28
  protected static $sidebars_widgets;
29
 
50
 
51
  // add stylesheets for the plugin's backend
52
  add_action( 'admin_enqueue_scripts', array( __CLASS__, 'load_custom_be_styles' ) );
53
+ self::sidebar_plugin_register();
54
+ add_action( 'enqueue_block_editor_assets', array( __CLASS__, 'sidebar_plugin_script_enqueue' ));
55
 
56
  if ( ! is_admin() ) {
57
  if ( $options['fix-widget-id'] ) {
63
  }
64
  }
65
 
66
+ public static function sidebar_plugin_script_enqueue() {
67
+ wp_enqueue_script('js/backend.min.js');
68
+ }
69
+
70
+ public static function sidebar_plugin_register() {
71
+ $asset_file = include( plugin_dir_path( __FILE__ ) . 'js/backend.asset.php' );
72
+ wp_register_script(
73
+ 'js/backend.min.js',
74
+ plugins_url( 'js/backend.min.js', __FILE__ ),
75
+ $asset_file['dependencies'],
76
+ $asset_file['version']
77
+ );
78
+ wp_set_script_translations('js/backend.min.js', 'q2w3_fixed_widget');
79
+ }
80
+
81
  /**
82
  * Load backend styles
83
  */
97
  self::custom_ids();
98
  self::fixed_wigets();
99
 
100
+ wp_enqueue_script( self::ID, plugin_dir_url( __FILE__ ) . 'js/frontend.min.js', array(), self::VERSION, true );
101
 
102
  self::wp_localize_script();
103
  }
readme.txt CHANGED
@@ -17,13 +17,18 @@ That's why this option is worthwhile for ads or other elements that visitors sho
17
 
18
  * [Manual and demo](https://wpadvancedads.com/fixed-widget-wordpress/)
19
 
20
- = Test version 6.0.0 =
21
 
22
- Please download and test [version 6.0.0](https://downloads.wordpress.org/plugin/q2w3-fixed-widget.zip).
 
23
 
24
- It solves a lot of edge cases with various themes and improves PageSpeed scores.
25
 
26
- Most changes are available when you switch on "Test new version" under Appearance > Fixed Widget Options.
 
 
 
 
27
 
28
  Please test and [let us know](https://wordpress.org/support/plugin/q2w3-fixed-widget/) if you discover any issues.
29
 
@@ -31,11 +36,12 @@ Please test and [let us know](https://wordpress.org/support/plugin/q2w3-fixed-wi
31
 
32
  All the features are free.
33
 
34
- * **Sticky Widgets** Use the Fixed Widget option on any widget in any sidebar
35
  * **Sticky Elements** Choose any element on your site and make it sticky
36
  * **Margin Top** allows you to stop sticky elements to cover sticky menu bars
37
  * **Margin Bottom** pushes sticky elements up before they reach a certain distance towards the bottom window
38
  * **Stop Elements** push sticky elements up when they are scrolling into view
 
39
  * **Minimum Screen Width** and **Minimum Screen Height** allow you to disable sticky behavior on small screens
40
 
41
  = Compatibility =
@@ -43,11 +49,7 @@ All the features are free.
43
  Theme requirements:
44
 
45
  * `wp_head()` and `wp_footer()` functions in `header.php` and `footer.php` files
46
- * Sticky widgets must have an ID attribute
47
  * JavaScript errors could break sticky widgets
48
- * jQuery is no longer required
49
-
50
- In some themes, fixed widgets „jump“ during scrolling, etc. Some CSS changes at your theme will be required in this case.
51
 
52
  == Installation ==
53
 
@@ -56,7 +58,6 @@ In some themes, fixed widgets „jump“ during scrolling, etc. Some CSS changes
56
  3. Go to Appearance -> Widgets, enable the "Fixed Widget" option on any active widget
57
  4. Fine tune plugin parameters on Appearance -> Fixed Widget Options page
58
 
59
-
60
  == Frequently Asked Questions ==
61
 
62
  = Why is the Fixed Widget plugin not working? =
@@ -72,14 +73,6 @@ There are several reasons:
72
 
73
  Yes, it is possible to fix more than one widget even if they are located in different sidebars.
74
 
75
- = Why is the plugin not working in Chrome (and other Webkit based browsers)? =
76
-
77
- Check your CSS files for these two instructions:
78
- `-webkit-backface-visibility:hidden;
79
- -webkit-transform: translate3d(0,0,0);`
80
-
81
- If found, disable them and see the result.
82
-
83
  = How to prevent overlapping with the footer? =
84
 
85
  Go to WP admin area, Appearance -> Fixed Widget Options. Here you can define the top and bottom margins. Set bottom margin value >= footer height. Check the result, please.
@@ -92,15 +85,17 @@ Use the options `Minimum Screen Width` and `Minimum Screen Height` to disable st
92
  == Screenshots ==
93
 
94
  1. The Fixed Widget for WordPress plugin in action
 
 
95
 
96
  == Changelog ==
97
 
98
- = 6.0.0-beta-1 =
99
 
100
  Version 6.0 is a full rewrite of the frontend script. It fixes many edge cases like jumping, reloading, or resizing widgets.
101
  The rewrite also resolves bad Cumulative Layout Shifts.
102
 
103
- Most changes are available when you switch on "Test new version" under Appearance > Fixed Widget Options.
104
 
105
  Please test and [let us know](https://wordpress.org/support/plugin/q2w3-fixed-widget/) if you discover any issues.
106
 
@@ -108,6 +103,8 @@ Please test and [let us know](https://wordpress.org/support/plugin/q2w3-fixed-wi
108
  - the frontend script does not need jQuery anymore
109
  - removed unneeded options that previously helped resolving edge cases
110
  - "Stop Elements" and "Custom Fixed Elements" now accept any selector, including IDs, Class, and Type selectors.
 
 
111
  - improved option descriptions on the admin page
112
  - improved behavior for elements higher than the screen – they first stick at the top and scroll to the bottom later
113
  - removed duplicating widget code
@@ -266,4 +263,4 @@ Please test and [let us know](https://wordpress.org/support/plugin/q2w3-fixed-wi
266
 
267
  = 6.0.0 =
268
 
269
- Major rewrite of the frontend JavaScript with fixes for a lot of edge cases. Does not need jQuery anymore. See more details in the Changelog.
17
 
18
  * [Manual and demo](https://wpadvancedads.com/fixed-widget-wordpress/)
19
 
20
+ = Changes in version 6.0.0 =
21
 
22
+ Version 6.0 is a full rewrite of the frontend script. It fixes many edge cases like jumping, reloading, or resizing widgets.
23
+ The rewrite also resolves bad Cumulative Layout Shifts.
24
 
25
+ Enable "Test new version" under Appearance > Fixed Widget Options.
26
 
27
+ - the frontend script does not need jQuery anymore
28
+ - removed unneeded options that previously helped resolving edge cases
29
+ - "Stop Elements" and "Custom Fixed Elements" now accept any selector, including IDs, Class, and Type selectors.
30
+ - works with the widget block editor introduced in WordPress 5.8
31
+ - added "stop" option to widget blocks
32
 
33
  Please test and [let us know](https://wordpress.org/support/plugin/q2w3-fixed-widget/) if you discover any issues.
34
 
36
 
37
  All the features are free.
38
 
39
+ * **Sticky Widgets** Use the Fixed Widget option on any widget and blocks in the sidebar
40
  * **Sticky Elements** Choose any element on your site and make it sticky
41
  * **Margin Top** allows you to stop sticky elements to cover sticky menu bars
42
  * **Margin Bottom** pushes sticky elements up before they reach a certain distance towards the bottom window
43
  * **Stop Elements** push sticky elements up when they are scrolling into view
44
+ * **Stop Blocks** defines blocks in your sidebar that push fixed blocks out of the page
45
  * **Minimum Screen Width** and **Minimum Screen Height** allow you to disable sticky behavior on small screens
46
 
47
  = Compatibility =
49
  Theme requirements:
50
 
51
  * `wp_head()` and `wp_footer()` functions in `header.php` and `footer.php` files
 
52
  * JavaScript errors could break sticky widgets
 
 
 
53
 
54
  == Installation ==
55
 
58
  3. Go to Appearance -> Widgets, enable the "Fixed Widget" option on any active widget
59
  4. Fine tune plugin parameters on Appearance -> Fixed Widget Options page
60
 
 
61
  == Frequently Asked Questions ==
62
 
63
  = Why is the Fixed Widget plugin not working? =
73
 
74
  Yes, it is possible to fix more than one widget even if they are located in different sidebars.
75
 
 
 
 
 
 
 
 
 
76
  = How to prevent overlapping with the footer? =
77
 
78
  Go to WP admin area, Appearance -> Fixed Widget Options. Here you can define the top and bottom margins. Set bottom margin value >= footer height. Check the result, please.
85
  == Screenshots ==
86
 
87
  1. The Fixed Widget for WordPress plugin in action
88
+ 2. Fixed Widget plugin options
89
+ 3. Block options in the widget editor
90
 
91
  == Changelog ==
92
 
93
+ = 6.0.0 =
94
 
95
  Version 6.0 is a full rewrite of the frontend script. It fixes many edge cases like jumping, reloading, or resizing widgets.
96
  The rewrite also resolves bad Cumulative Layout Shifts.
97
 
98
+ Most changes are available when you enable "Test new version" under Appearance > Fixed Widget Options.
99
 
100
  Please test and [let us know](https://wordpress.org/support/plugin/q2w3-fixed-widget/) if you discover any issues.
101
 
103
  - the frontend script does not need jQuery anymore
104
  - removed unneeded options that previously helped resolving edge cases
105
  - "Stop Elements" and "Custom Fixed Elements" now accept any selector, including IDs, Class, and Type selectors.
106
+ - fixed blocks in sidebars as introduced in WordPress 5.8
107
+ - define stop blocks in sidebars that move up fixed blocks on scrolling
108
  - improved option descriptions on the admin page
109
  - improved behavior for elements higher than the screen – they first stick at the top and scroll to the bottom later
110
  - removed duplicating widget code
263
 
264
  = 6.0.0 =
265
 
266
+ Major rewrite of the frontend JavaScript with fixes for a lot of edge cases. Does not need jQuery anymore. See more details in the Changelog.