playbook_ui 13.32.0.pre.alpha.PLAY14143267 → 13.32.0.pre.alpha.PLAY14143271
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dist/chunks/_typeahead.js +32 -33673
- data/dist/chunks/_weekday_stacked.js +54 -12975
- data/dist/chunks/lazysizes.js +1 -611
- data/dist/chunks/pb_form_validation.js +1 -60
- data/dist/chunks/vendor.js +1 -6
- data/dist/playbook-doc.js +630 -67840
- data/dist/playbook-rails-react-bindings.js +1 -97
- data/dist/playbook-rails.js +1 -408
- data/dist/playbook.css +2 -61394
- data/dist/reset.css +1 -62
- data/lib/playbook/version.rb +1 -1
- metadata +1 -1
data/dist/chunks/lazysizes.js
CHANGED
@@ -1,611 +1 @@
|
|
1
|
-
var
|
2
|
-
var hasRequiredLazysizes;
|
3
|
-
function requireLazysizes() {
|
4
|
-
if (hasRequiredLazysizes) return lazysizes.exports;
|
5
|
-
hasRequiredLazysizes = 1;
|
6
|
-
(function(module) {
|
7
|
-
(function(window2, factory) {
|
8
|
-
var lazySizes = factory(window2, window2.document, Date);
|
9
|
-
window2.lazySizes = lazySizes;
|
10
|
-
if (module.exports) {
|
11
|
-
module.exports = lazySizes;
|
12
|
-
}
|
13
|
-
})(
|
14
|
-
typeof window != "undefined" ? window : {},
|
15
|
-
/**
|
16
|
-
* import("./types/global")
|
17
|
-
* @typedef { import("./types/lazysizes-config").LazySizesConfigPartial } LazySizesConfigPartial
|
18
|
-
*/
|
19
|
-
function l(window2, document, Date2) {
|
20
|
-
var lazysizes2, lazySizesCfg;
|
21
|
-
(function() {
|
22
|
-
var prop;
|
23
|
-
var lazySizesDefaults = {
|
24
|
-
lazyClass: "lazyload",
|
25
|
-
loadedClass: "lazyloaded",
|
26
|
-
loadingClass: "lazyloading",
|
27
|
-
preloadClass: "lazypreload",
|
28
|
-
errorClass: "lazyerror",
|
29
|
-
//strictClass: 'lazystrict',
|
30
|
-
autosizesClass: "lazyautosizes",
|
31
|
-
fastLoadedClass: "ls-is-cached",
|
32
|
-
iframeLoadMode: 0,
|
33
|
-
srcAttr: "data-src",
|
34
|
-
srcsetAttr: "data-srcset",
|
35
|
-
sizesAttr: "data-sizes",
|
36
|
-
//preloadAfterLoad: false,
|
37
|
-
minSize: 40,
|
38
|
-
customMedia: {},
|
39
|
-
init: true,
|
40
|
-
expFactor: 1.5,
|
41
|
-
hFac: 0.8,
|
42
|
-
loadMode: 2,
|
43
|
-
loadHidden: true,
|
44
|
-
ricTimeout: 0,
|
45
|
-
throttleDelay: 125
|
46
|
-
};
|
47
|
-
lazySizesCfg = window2.lazySizesConfig || window2.lazysizesConfig || {};
|
48
|
-
for (prop in lazySizesDefaults) {
|
49
|
-
if (!(prop in lazySizesCfg)) {
|
50
|
-
lazySizesCfg[prop] = lazySizesDefaults[prop];
|
51
|
-
}
|
52
|
-
}
|
53
|
-
})();
|
54
|
-
if (!document || !document.getElementsByClassName) {
|
55
|
-
return {
|
56
|
-
init: function() {
|
57
|
-
},
|
58
|
-
/**
|
59
|
-
* @type { LazySizesConfigPartial }
|
60
|
-
*/
|
61
|
-
cfg: lazySizesCfg,
|
62
|
-
/**
|
63
|
-
* @type { true }
|
64
|
-
*/
|
65
|
-
noSupport: true
|
66
|
-
};
|
67
|
-
}
|
68
|
-
var docElem = document.documentElement;
|
69
|
-
var supportPicture = window2.HTMLPictureElement;
|
70
|
-
var _addEventListener = "addEventListener";
|
71
|
-
var _getAttribute = "getAttribute";
|
72
|
-
var addEventListener = window2[_addEventListener].bind(window2);
|
73
|
-
var setTimeout = window2.setTimeout;
|
74
|
-
var requestAnimationFrame = window2.requestAnimationFrame || setTimeout;
|
75
|
-
var requestIdleCallback = window2.requestIdleCallback;
|
76
|
-
var regPicture = /^picture$/i;
|
77
|
-
var loadEvents = ["load", "error", "lazyincluded", "_lazyloaded"];
|
78
|
-
var regClassCache = {};
|
79
|
-
var forEach = Array.prototype.forEach;
|
80
|
-
var hasClass = function(ele, cls) {
|
81
|
-
if (!regClassCache[cls]) {
|
82
|
-
regClassCache[cls] = new RegExp("(\\s|^)" + cls + "(\\s|$)");
|
83
|
-
}
|
84
|
-
return regClassCache[cls].test(ele[_getAttribute]("class") || "") && regClassCache[cls];
|
85
|
-
};
|
86
|
-
var addClass = function(ele, cls) {
|
87
|
-
if (!hasClass(ele, cls)) {
|
88
|
-
ele.setAttribute("class", (ele[_getAttribute]("class") || "").trim() + " " + cls);
|
89
|
-
}
|
90
|
-
};
|
91
|
-
var removeClass = function(ele, cls) {
|
92
|
-
var reg;
|
93
|
-
if (reg = hasClass(ele, cls)) {
|
94
|
-
ele.setAttribute("class", (ele[_getAttribute]("class") || "").replace(reg, " "));
|
95
|
-
}
|
96
|
-
};
|
97
|
-
var addRemoveLoadEvents = function(dom, fn, add) {
|
98
|
-
var action = add ? _addEventListener : "removeEventListener";
|
99
|
-
if (add) {
|
100
|
-
addRemoveLoadEvents(dom, fn);
|
101
|
-
}
|
102
|
-
loadEvents.forEach(function(evt) {
|
103
|
-
dom[action](evt, fn);
|
104
|
-
});
|
105
|
-
};
|
106
|
-
var triggerEvent = function(elem, name, detail, noBubbles, noCancelable) {
|
107
|
-
var event = document.createEvent("Event");
|
108
|
-
if (!detail) {
|
109
|
-
detail = {};
|
110
|
-
}
|
111
|
-
detail.instance = lazysizes2;
|
112
|
-
event.initEvent(name, !noBubbles, !noCancelable);
|
113
|
-
event.detail = detail;
|
114
|
-
elem.dispatchEvent(event);
|
115
|
-
return event;
|
116
|
-
};
|
117
|
-
var updatePolyfill = function(el, full) {
|
118
|
-
var polyfill;
|
119
|
-
if (!supportPicture && (polyfill = window2.picturefill || lazySizesCfg.pf)) {
|
120
|
-
if (full && full.src && !el[_getAttribute]("srcset")) {
|
121
|
-
el.setAttribute("srcset", full.src);
|
122
|
-
}
|
123
|
-
polyfill({ reevaluate: true, elements: [el] });
|
124
|
-
} else if (full && full.src) {
|
125
|
-
el.src = full.src;
|
126
|
-
}
|
127
|
-
};
|
128
|
-
var getCSS = function(elem, style) {
|
129
|
-
return (getComputedStyle(elem, null) || {})[style];
|
130
|
-
};
|
131
|
-
var getWidth = function(elem, parent, width) {
|
132
|
-
width = width || elem.offsetWidth;
|
133
|
-
while (width < lazySizesCfg.minSize && parent && !elem._lazysizesWidth) {
|
134
|
-
width = parent.offsetWidth;
|
135
|
-
parent = parent.parentNode;
|
136
|
-
}
|
137
|
-
return width;
|
138
|
-
};
|
139
|
-
var rAF = function() {
|
140
|
-
var running, waiting;
|
141
|
-
var firstFns = [];
|
142
|
-
var secondFns = [];
|
143
|
-
var fns = firstFns;
|
144
|
-
var run = function() {
|
145
|
-
var runFns = fns;
|
146
|
-
fns = firstFns.length ? secondFns : firstFns;
|
147
|
-
running = true;
|
148
|
-
waiting = false;
|
149
|
-
while (runFns.length) {
|
150
|
-
runFns.shift()();
|
151
|
-
}
|
152
|
-
running = false;
|
153
|
-
};
|
154
|
-
var rafBatch = function(fn, queue) {
|
155
|
-
if (running && !queue) {
|
156
|
-
fn.apply(this, arguments);
|
157
|
-
} else {
|
158
|
-
fns.push(fn);
|
159
|
-
if (!waiting) {
|
160
|
-
waiting = true;
|
161
|
-
(document.hidden ? setTimeout : requestAnimationFrame)(run);
|
162
|
-
}
|
163
|
-
}
|
164
|
-
};
|
165
|
-
rafBatch._lsFlush = run;
|
166
|
-
return rafBatch;
|
167
|
-
}();
|
168
|
-
var rAFIt = function(fn, simple) {
|
169
|
-
return simple ? function() {
|
170
|
-
rAF(fn);
|
171
|
-
} : function() {
|
172
|
-
var that = this;
|
173
|
-
var args = arguments;
|
174
|
-
rAF(function() {
|
175
|
-
fn.apply(that, args);
|
176
|
-
});
|
177
|
-
};
|
178
|
-
};
|
179
|
-
var throttle = function(fn) {
|
180
|
-
var running;
|
181
|
-
var lastTime = 0;
|
182
|
-
var gDelay = lazySizesCfg.throttleDelay;
|
183
|
-
var rICTimeout = lazySizesCfg.ricTimeout;
|
184
|
-
var run = function() {
|
185
|
-
running = false;
|
186
|
-
lastTime = Date2.now();
|
187
|
-
fn();
|
188
|
-
};
|
189
|
-
var idleCallback = requestIdleCallback && rICTimeout > 49 ? function() {
|
190
|
-
requestIdleCallback(run, { timeout: rICTimeout });
|
191
|
-
if (rICTimeout !== lazySizesCfg.ricTimeout) {
|
192
|
-
rICTimeout = lazySizesCfg.ricTimeout;
|
193
|
-
}
|
194
|
-
} : rAFIt(function() {
|
195
|
-
setTimeout(run);
|
196
|
-
}, true);
|
197
|
-
return function(isPriority) {
|
198
|
-
var delay;
|
199
|
-
if (isPriority = isPriority === true) {
|
200
|
-
rICTimeout = 33;
|
201
|
-
}
|
202
|
-
if (running) {
|
203
|
-
return;
|
204
|
-
}
|
205
|
-
running = true;
|
206
|
-
delay = gDelay - (Date2.now() - lastTime);
|
207
|
-
if (delay < 0) {
|
208
|
-
delay = 0;
|
209
|
-
}
|
210
|
-
if (isPriority || delay < 9) {
|
211
|
-
idleCallback();
|
212
|
-
} else {
|
213
|
-
setTimeout(idleCallback, delay);
|
214
|
-
}
|
215
|
-
};
|
216
|
-
};
|
217
|
-
var debounce = function(func) {
|
218
|
-
var timeout, timestamp;
|
219
|
-
var wait = 99;
|
220
|
-
var run = function() {
|
221
|
-
timeout = null;
|
222
|
-
func();
|
223
|
-
};
|
224
|
-
var later = function() {
|
225
|
-
var last = Date2.now() - timestamp;
|
226
|
-
if (last < wait) {
|
227
|
-
setTimeout(later, wait - last);
|
228
|
-
} else {
|
229
|
-
(requestIdleCallback || run)(run);
|
230
|
-
}
|
231
|
-
};
|
232
|
-
return function() {
|
233
|
-
timestamp = Date2.now();
|
234
|
-
if (!timeout) {
|
235
|
-
timeout = setTimeout(later, wait);
|
236
|
-
}
|
237
|
-
};
|
238
|
-
};
|
239
|
-
var loader = function() {
|
240
|
-
var preloadElems, isCompleted, resetPreloadingTimer, loadMode, started;
|
241
|
-
var eLvW, elvH, eLtop, eLleft, eLright, eLbottom, isBodyHidden;
|
242
|
-
var regImg = /^img$/i;
|
243
|
-
var regIframe = /^iframe$/i;
|
244
|
-
var supportScroll = "onscroll" in window2 && !/(gle|ing)bot/.test(navigator.userAgent);
|
245
|
-
var shrinkExpand = 0;
|
246
|
-
var currentExpand = 0;
|
247
|
-
var isLoading = 0;
|
248
|
-
var lowRuns = -1;
|
249
|
-
var resetPreloading = function(e) {
|
250
|
-
isLoading--;
|
251
|
-
if (!e || isLoading < 0 || !e.target) {
|
252
|
-
isLoading = 0;
|
253
|
-
}
|
254
|
-
};
|
255
|
-
var isVisible = function(elem) {
|
256
|
-
if (isBodyHidden == null) {
|
257
|
-
isBodyHidden = getCSS(document.body, "visibility") == "hidden";
|
258
|
-
}
|
259
|
-
return isBodyHidden || !(getCSS(elem.parentNode, "visibility") == "hidden" && getCSS(elem, "visibility") == "hidden");
|
260
|
-
};
|
261
|
-
var isNestedVisible = function(elem, elemExpand) {
|
262
|
-
var outerRect;
|
263
|
-
var parent = elem;
|
264
|
-
var visible = isVisible(elem);
|
265
|
-
eLtop -= elemExpand;
|
266
|
-
eLbottom += elemExpand;
|
267
|
-
eLleft -= elemExpand;
|
268
|
-
eLright += elemExpand;
|
269
|
-
while (visible && (parent = parent.offsetParent) && parent != document.body && parent != docElem) {
|
270
|
-
visible = (getCSS(parent, "opacity") || 1) > 0;
|
271
|
-
if (visible && getCSS(parent, "overflow") != "visible") {
|
272
|
-
outerRect = parent.getBoundingClientRect();
|
273
|
-
visible = eLright > outerRect.left && eLleft < outerRect.right && eLbottom > outerRect.top - 1 && eLtop < outerRect.bottom + 1;
|
274
|
-
}
|
275
|
-
}
|
276
|
-
return visible;
|
277
|
-
};
|
278
|
-
var checkElements = function() {
|
279
|
-
var eLlen, i, rect, autoLoadElem, loadedSomething, elemExpand, elemNegativeExpand, elemExpandVal, beforeExpandVal, defaultExpand, preloadExpand, hFac;
|
280
|
-
var lazyloadElems = lazysizes2.elements;
|
281
|
-
if ((loadMode = lazySizesCfg.loadMode) && isLoading < 8 && (eLlen = lazyloadElems.length)) {
|
282
|
-
i = 0;
|
283
|
-
lowRuns++;
|
284
|
-
for (; i < eLlen; i++) {
|
285
|
-
if (!lazyloadElems[i] || lazyloadElems[i]._lazyRace) {
|
286
|
-
continue;
|
287
|
-
}
|
288
|
-
if (!supportScroll || lazysizes2.prematureUnveil && lazysizes2.prematureUnveil(lazyloadElems[i])) {
|
289
|
-
unveilElement(lazyloadElems[i]);
|
290
|
-
continue;
|
291
|
-
}
|
292
|
-
if (!(elemExpandVal = lazyloadElems[i][_getAttribute]("data-expand")) || !(elemExpand = elemExpandVal * 1)) {
|
293
|
-
elemExpand = currentExpand;
|
294
|
-
}
|
295
|
-
if (!defaultExpand) {
|
296
|
-
defaultExpand = !lazySizesCfg.expand || lazySizesCfg.expand < 1 ? docElem.clientHeight > 500 && docElem.clientWidth > 500 ? 500 : 370 : lazySizesCfg.expand;
|
297
|
-
lazysizes2._defEx = defaultExpand;
|
298
|
-
preloadExpand = defaultExpand * lazySizesCfg.expFactor;
|
299
|
-
hFac = lazySizesCfg.hFac;
|
300
|
-
isBodyHidden = null;
|
301
|
-
if (currentExpand < preloadExpand && isLoading < 1 && lowRuns > 2 && loadMode > 2 && !document.hidden) {
|
302
|
-
currentExpand = preloadExpand;
|
303
|
-
lowRuns = 0;
|
304
|
-
} else if (loadMode > 1 && lowRuns > 1 && isLoading < 6) {
|
305
|
-
currentExpand = defaultExpand;
|
306
|
-
} else {
|
307
|
-
currentExpand = shrinkExpand;
|
308
|
-
}
|
309
|
-
}
|
310
|
-
if (beforeExpandVal !== elemExpand) {
|
311
|
-
eLvW = innerWidth + elemExpand * hFac;
|
312
|
-
elvH = innerHeight + elemExpand;
|
313
|
-
elemNegativeExpand = elemExpand * -1;
|
314
|
-
beforeExpandVal = elemExpand;
|
315
|
-
}
|
316
|
-
rect = lazyloadElems[i].getBoundingClientRect();
|
317
|
-
if ((eLbottom = rect.bottom) >= elemNegativeExpand && (eLtop = rect.top) <= elvH && (eLright = rect.right) >= elemNegativeExpand * hFac && (eLleft = rect.left) <= eLvW && (eLbottom || eLright || eLleft || eLtop) && (lazySizesCfg.loadHidden || isVisible(lazyloadElems[i])) && (isCompleted && isLoading < 3 && !elemExpandVal && (loadMode < 3 || lowRuns < 4) || isNestedVisible(lazyloadElems[i], elemExpand))) {
|
318
|
-
unveilElement(lazyloadElems[i]);
|
319
|
-
loadedSomething = true;
|
320
|
-
if (isLoading > 9) {
|
321
|
-
break;
|
322
|
-
}
|
323
|
-
} else if (!loadedSomething && isCompleted && !autoLoadElem && isLoading < 4 && lowRuns < 4 && loadMode > 2 && (preloadElems[0] || lazySizesCfg.preloadAfterLoad) && (preloadElems[0] || !elemExpandVal && (eLbottom || eLright || eLleft || eLtop || lazyloadElems[i][_getAttribute](lazySizesCfg.sizesAttr) != "auto"))) {
|
324
|
-
autoLoadElem = preloadElems[0] || lazyloadElems[i];
|
325
|
-
}
|
326
|
-
}
|
327
|
-
if (autoLoadElem && !loadedSomething) {
|
328
|
-
unveilElement(autoLoadElem);
|
329
|
-
}
|
330
|
-
}
|
331
|
-
};
|
332
|
-
var throttledCheckElements = throttle(checkElements);
|
333
|
-
var switchLoadingClass = function(e) {
|
334
|
-
var elem = e.target;
|
335
|
-
if (elem._lazyCache) {
|
336
|
-
delete elem._lazyCache;
|
337
|
-
return;
|
338
|
-
}
|
339
|
-
resetPreloading(e);
|
340
|
-
addClass(elem, lazySizesCfg.loadedClass);
|
341
|
-
removeClass(elem, lazySizesCfg.loadingClass);
|
342
|
-
addRemoveLoadEvents(elem, rafSwitchLoadingClass);
|
343
|
-
triggerEvent(elem, "lazyloaded");
|
344
|
-
};
|
345
|
-
var rafedSwitchLoadingClass = rAFIt(switchLoadingClass);
|
346
|
-
var rafSwitchLoadingClass = function(e) {
|
347
|
-
rafedSwitchLoadingClass({ target: e.target });
|
348
|
-
};
|
349
|
-
var changeIframeSrc = function(elem, src) {
|
350
|
-
var loadMode2 = elem.getAttribute("data-load-mode") || lazySizesCfg.iframeLoadMode;
|
351
|
-
if (loadMode2 == 0) {
|
352
|
-
elem.contentWindow.location.replace(src);
|
353
|
-
} else if (loadMode2 == 1) {
|
354
|
-
elem.src = src;
|
355
|
-
}
|
356
|
-
};
|
357
|
-
var handleSources = function(source) {
|
358
|
-
var customMedia;
|
359
|
-
var sourceSrcset = source[_getAttribute](lazySizesCfg.srcsetAttr);
|
360
|
-
if (customMedia = lazySizesCfg.customMedia[source[_getAttribute]("data-media") || source[_getAttribute]("media")]) {
|
361
|
-
source.setAttribute("media", customMedia);
|
362
|
-
}
|
363
|
-
if (sourceSrcset) {
|
364
|
-
source.setAttribute("srcset", sourceSrcset);
|
365
|
-
}
|
366
|
-
};
|
367
|
-
var lazyUnveil = rAFIt(function(elem, detail, isAuto, sizes, isImg) {
|
368
|
-
var src, srcset, parent, isPicture, event, firesLoad;
|
369
|
-
if (!(event = triggerEvent(elem, "lazybeforeunveil", detail)).defaultPrevented) {
|
370
|
-
if (sizes) {
|
371
|
-
if (isAuto) {
|
372
|
-
addClass(elem, lazySizesCfg.autosizesClass);
|
373
|
-
} else {
|
374
|
-
elem.setAttribute("sizes", sizes);
|
375
|
-
}
|
376
|
-
}
|
377
|
-
srcset = elem[_getAttribute](lazySizesCfg.srcsetAttr);
|
378
|
-
src = elem[_getAttribute](lazySizesCfg.srcAttr);
|
379
|
-
if (isImg) {
|
380
|
-
parent = elem.parentNode;
|
381
|
-
isPicture = parent && regPicture.test(parent.nodeName || "");
|
382
|
-
}
|
383
|
-
firesLoad = detail.firesLoad || "src" in elem && (srcset || src || isPicture);
|
384
|
-
event = { target: elem };
|
385
|
-
addClass(elem, lazySizesCfg.loadingClass);
|
386
|
-
if (firesLoad) {
|
387
|
-
clearTimeout(resetPreloadingTimer);
|
388
|
-
resetPreloadingTimer = setTimeout(resetPreloading, 2500);
|
389
|
-
addRemoveLoadEvents(elem, rafSwitchLoadingClass, true);
|
390
|
-
}
|
391
|
-
if (isPicture) {
|
392
|
-
forEach.call(parent.getElementsByTagName("source"), handleSources);
|
393
|
-
}
|
394
|
-
if (srcset) {
|
395
|
-
elem.setAttribute("srcset", srcset);
|
396
|
-
} else if (src && !isPicture) {
|
397
|
-
if (regIframe.test(elem.nodeName)) {
|
398
|
-
changeIframeSrc(elem, src);
|
399
|
-
} else {
|
400
|
-
elem.src = src;
|
401
|
-
}
|
402
|
-
}
|
403
|
-
if (isImg && (srcset || isPicture)) {
|
404
|
-
updatePolyfill(elem, { src });
|
405
|
-
}
|
406
|
-
}
|
407
|
-
if (elem._lazyRace) {
|
408
|
-
delete elem._lazyRace;
|
409
|
-
}
|
410
|
-
removeClass(elem, lazySizesCfg.lazyClass);
|
411
|
-
rAF(function() {
|
412
|
-
var isLoaded = elem.complete && elem.naturalWidth > 1;
|
413
|
-
if (!firesLoad || isLoaded) {
|
414
|
-
if (isLoaded) {
|
415
|
-
addClass(elem, lazySizesCfg.fastLoadedClass);
|
416
|
-
}
|
417
|
-
switchLoadingClass(event);
|
418
|
-
elem._lazyCache = true;
|
419
|
-
setTimeout(function() {
|
420
|
-
if ("_lazyCache" in elem) {
|
421
|
-
delete elem._lazyCache;
|
422
|
-
}
|
423
|
-
}, 9);
|
424
|
-
}
|
425
|
-
if (elem.loading == "lazy") {
|
426
|
-
isLoading--;
|
427
|
-
}
|
428
|
-
}, true);
|
429
|
-
});
|
430
|
-
var unveilElement = function(elem) {
|
431
|
-
if (elem._lazyRace) {
|
432
|
-
return;
|
433
|
-
}
|
434
|
-
var detail;
|
435
|
-
var isImg = regImg.test(elem.nodeName);
|
436
|
-
var sizes = isImg && (elem[_getAttribute](lazySizesCfg.sizesAttr) || elem[_getAttribute]("sizes"));
|
437
|
-
var isAuto = sizes == "auto";
|
438
|
-
if ((isAuto || !isCompleted) && isImg && (elem[_getAttribute]("src") || elem.srcset) && !elem.complete && !hasClass(elem, lazySizesCfg.errorClass) && hasClass(elem, lazySizesCfg.lazyClass)) {
|
439
|
-
return;
|
440
|
-
}
|
441
|
-
detail = triggerEvent(elem, "lazyunveilread").detail;
|
442
|
-
if (isAuto) {
|
443
|
-
autoSizer.updateElem(elem, true, elem.offsetWidth);
|
444
|
-
}
|
445
|
-
elem._lazyRace = true;
|
446
|
-
isLoading++;
|
447
|
-
lazyUnveil(elem, detail, isAuto, sizes, isImg);
|
448
|
-
};
|
449
|
-
var afterScroll = debounce(function() {
|
450
|
-
lazySizesCfg.loadMode = 3;
|
451
|
-
throttledCheckElements();
|
452
|
-
});
|
453
|
-
var altLoadmodeScrollListner = function() {
|
454
|
-
if (lazySizesCfg.loadMode == 3) {
|
455
|
-
lazySizesCfg.loadMode = 2;
|
456
|
-
}
|
457
|
-
afterScroll();
|
458
|
-
};
|
459
|
-
var onload = function() {
|
460
|
-
if (isCompleted) {
|
461
|
-
return;
|
462
|
-
}
|
463
|
-
if (Date2.now() - started < 999) {
|
464
|
-
setTimeout(onload, 999);
|
465
|
-
return;
|
466
|
-
}
|
467
|
-
isCompleted = true;
|
468
|
-
lazySizesCfg.loadMode = 3;
|
469
|
-
throttledCheckElements();
|
470
|
-
addEventListener("scroll", altLoadmodeScrollListner, true);
|
471
|
-
};
|
472
|
-
return {
|
473
|
-
_: function() {
|
474
|
-
started = Date2.now();
|
475
|
-
lazysizes2.elements = document.getElementsByClassName(lazySizesCfg.lazyClass);
|
476
|
-
preloadElems = document.getElementsByClassName(lazySizesCfg.lazyClass + " " + lazySizesCfg.preloadClass);
|
477
|
-
addEventListener("scroll", throttledCheckElements, true);
|
478
|
-
addEventListener("resize", throttledCheckElements, true);
|
479
|
-
addEventListener("pageshow", function(e) {
|
480
|
-
if (e.persisted) {
|
481
|
-
var loadingElements = document.querySelectorAll("." + lazySizesCfg.loadingClass);
|
482
|
-
if (loadingElements.length && loadingElements.forEach) {
|
483
|
-
requestAnimationFrame(function() {
|
484
|
-
loadingElements.forEach(function(img) {
|
485
|
-
if (img.complete) {
|
486
|
-
unveilElement(img);
|
487
|
-
}
|
488
|
-
});
|
489
|
-
});
|
490
|
-
}
|
491
|
-
}
|
492
|
-
});
|
493
|
-
if (window2.MutationObserver) {
|
494
|
-
new MutationObserver(throttledCheckElements).observe(docElem, { childList: true, subtree: true, attributes: true });
|
495
|
-
} else {
|
496
|
-
docElem[_addEventListener]("DOMNodeInserted", throttledCheckElements, true);
|
497
|
-
docElem[_addEventListener]("DOMAttrModified", throttledCheckElements, true);
|
498
|
-
setInterval(throttledCheckElements, 999);
|
499
|
-
}
|
500
|
-
addEventListener("hashchange", throttledCheckElements, true);
|
501
|
-
["focus", "mouseover", "click", "load", "transitionend", "animationend"].forEach(function(name) {
|
502
|
-
document[_addEventListener](name, throttledCheckElements, true);
|
503
|
-
});
|
504
|
-
if (/d$|^c/.test(document.readyState)) {
|
505
|
-
onload();
|
506
|
-
} else {
|
507
|
-
addEventListener("load", onload);
|
508
|
-
document[_addEventListener]("DOMContentLoaded", throttledCheckElements);
|
509
|
-
setTimeout(onload, 2e4);
|
510
|
-
}
|
511
|
-
if (lazysizes2.elements.length) {
|
512
|
-
checkElements();
|
513
|
-
rAF._lsFlush();
|
514
|
-
} else {
|
515
|
-
throttledCheckElements();
|
516
|
-
}
|
517
|
-
},
|
518
|
-
checkElems: throttledCheckElements,
|
519
|
-
unveil: unveilElement,
|
520
|
-
_aLSL: altLoadmodeScrollListner
|
521
|
-
};
|
522
|
-
}();
|
523
|
-
var autoSizer = function() {
|
524
|
-
var autosizesElems;
|
525
|
-
var sizeElement = rAFIt(function(elem, parent, event, width) {
|
526
|
-
var sources, i, len;
|
527
|
-
elem._lazysizesWidth = width;
|
528
|
-
width += "px";
|
529
|
-
elem.setAttribute("sizes", width);
|
530
|
-
if (regPicture.test(parent.nodeName || "")) {
|
531
|
-
sources = parent.getElementsByTagName("source");
|
532
|
-
for (i = 0, len = sources.length; i < len; i++) {
|
533
|
-
sources[i].setAttribute("sizes", width);
|
534
|
-
}
|
535
|
-
}
|
536
|
-
if (!event.detail.dataAttr) {
|
537
|
-
updatePolyfill(elem, event.detail);
|
538
|
-
}
|
539
|
-
});
|
540
|
-
var getSizeElement = function(elem, dataAttr, width) {
|
541
|
-
var event;
|
542
|
-
var parent = elem.parentNode;
|
543
|
-
if (parent) {
|
544
|
-
width = getWidth(elem, parent, width);
|
545
|
-
event = triggerEvent(elem, "lazybeforesizes", { width, dataAttr: !!dataAttr });
|
546
|
-
if (!event.defaultPrevented) {
|
547
|
-
width = event.detail.width;
|
548
|
-
if (width && width !== elem._lazysizesWidth) {
|
549
|
-
sizeElement(elem, parent, event, width);
|
550
|
-
}
|
551
|
-
}
|
552
|
-
}
|
553
|
-
};
|
554
|
-
var updateElementsSizes = function() {
|
555
|
-
var i;
|
556
|
-
var len = autosizesElems.length;
|
557
|
-
if (len) {
|
558
|
-
i = 0;
|
559
|
-
for (; i < len; i++) {
|
560
|
-
getSizeElement(autosizesElems[i]);
|
561
|
-
}
|
562
|
-
}
|
563
|
-
};
|
564
|
-
var debouncedUpdateElementsSizes = debounce(updateElementsSizes);
|
565
|
-
return {
|
566
|
-
_: function() {
|
567
|
-
autosizesElems = document.getElementsByClassName(lazySizesCfg.autosizesClass);
|
568
|
-
addEventListener("resize", debouncedUpdateElementsSizes);
|
569
|
-
},
|
570
|
-
checkElems: debouncedUpdateElementsSizes,
|
571
|
-
updateElem: getSizeElement
|
572
|
-
};
|
573
|
-
}();
|
574
|
-
var init = function() {
|
575
|
-
if (!init.i && document.getElementsByClassName) {
|
576
|
-
init.i = true;
|
577
|
-
autoSizer._();
|
578
|
-
loader._();
|
579
|
-
}
|
580
|
-
};
|
581
|
-
setTimeout(function() {
|
582
|
-
if (lazySizesCfg.init) {
|
583
|
-
init();
|
584
|
-
}
|
585
|
-
});
|
586
|
-
lazysizes2 = {
|
587
|
-
/**
|
588
|
-
* @type { LazySizesConfigPartial }
|
589
|
-
*/
|
590
|
-
cfg: lazySizesCfg,
|
591
|
-
autoSizer,
|
592
|
-
loader,
|
593
|
-
init,
|
594
|
-
uP: updatePolyfill,
|
595
|
-
aC: addClass,
|
596
|
-
rC: removeClass,
|
597
|
-
hC: hasClass,
|
598
|
-
fire: triggerEvent,
|
599
|
-
gW: getWidth,
|
600
|
-
rAF
|
601
|
-
};
|
602
|
-
return lazysizes2;
|
603
|
-
}
|
604
|
-
);
|
605
|
-
})(lazysizes);
|
606
|
-
return lazysizes.exports;
|
607
|
-
}
|
608
|
-
requireLazysizes();
|
609
|
-
export {
|
610
|
-
requireLazysizes as r
|
611
|
-
};
|
1
|
+
var te={exports:{}},ze;function Ne(){return ze||(ze=1,function(ae){(function(j,h){var d=h(j,j.document,Date);j.lazySizes=d,ae.exports&&(ae.exports=d)})(typeof window<"u"?window:{},function(h,d,R){var S,r;if(function(){var a,t={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};r=h.lazySizesConfig||h.lazysizesConfig||{};for(a in t)a in r||(r[a]=t[a])}(),!d||!d.getElementsByClassName)return{init:function(){},cfg:r,noSupport:!0};var B=d.documentElement,ge=h.HTMLPictureElement,k="addEventListener",y="getAttribute",F=h[k].bind(h),A=h.setTimeout,re=h.requestAnimationFrame||A,X=h.requestIdleCallback,ie=/^picture$/i,pe=["load","error","lazyincluded","_lazyloaded"],G={},ye=Array.prototype.forEach,q=function(a,t){return G[t]||(G[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),G[t].test(a[y]("class")||"")&&G[t]},H=function(a,t){q(a,t)||a.setAttribute("class",(a[y]("class")||"").trim()+" "+t)},Y=function(a,t){var s;(s=q(a,t))&&a.setAttribute("class",(a[y]("class")||"").replace(s," "))},Z=function(a,t,s){var c=s?k:"removeEventListener";s&&Z(a,t),pe.forEach(function(f){a[c](f,t)})},O=function(a,t,s,c,f){var n=d.createEvent("Event");return s||(s={}),s.instance=S,n.initEvent(t,!c,!f),n.detail=s,a.dispatchEvent(n),n},w=function(a,t){var s;!ge&&(s=h.picturefill||r.pf)?(t&&t.src&&!a[y]("srcset")&&a.setAttribute("srcset",t.src),s({reevaluate:!0,elements:[a]})):t&&t.src&&(a.src=t.src)},$=function(a,t){return(getComputedStyle(a,null)||{})[t]},se=function(a,t,s){for(s=s||a.offsetWidth;s<r.minSize&&t&&!a._lazysizesWidth;)s=t.offsetWidth,t=t.parentNode;return s},U=function(){var a,t,s=[],c=[],f=s,n=function(){var o=f;for(f=s.length?c:s,a=!0,t=!1;o.length;)o.shift()();a=!1},v=function(o,u){a&&!u?o.apply(this,arguments):(f.push(o),t||(t=!0,(d.hidden?A:re)(n)))};return v._lsFlush=n,v}(),J=function(a,t){return t?function(){U(a)}:function(){var s=this,c=arguments;U(function(){a.apply(s,c)})}},he=function(a){var t,s=0,c=r.throttleDelay,f=r.ricTimeout,n=function(){t=!1,s=R.now(),a()},v=X&&f>49?function(){X(n,{timeout:f}),f!==r.ricTimeout&&(f=r.ricTimeout)}:J(function(){A(n)},!0);return function(o){var u;(o=o===!0)&&(f=33),!t&&(t=!0,u=c-(R.now()-s),u<0&&(u=0),o||u<9?v():A(v,u))}},ne=function(a){var t,s,c=99,f=function(){t=null,a()},n=function(){var v=R.now()-s;v<c?A(n,c-v):(X||f)(f)};return function(){s=R.now(),t||(t=A(n,c))}},oe=function(){var a,t,s,c,f,n,v,o,u,C,m,T,Ce=/^img$/i,Ee=/^iframe$/i,be="onscroll"in h&&!/(gle|ing)bot/.test(navigator.userAgent),Ae=0,V=0,L=0,I=-1,le=function(e){L--,(!e||L<0||!e.target)&&(L=0)},ue=function(e){return T==null&&(T=$(d.body,"visibility")=="hidden"),T||!($(e.parentNode,"visibility")=="hidden"&&$(e,"visibility")=="hidden")},Le=function(e,i){var l,z=e,g=ue(e);for(o-=i,m+=i,u-=i,C+=i;g&&(z=z.offsetParent)&&z!=d.body&&z!=B;)g=($(z,"opacity")||1)>0,g&&$(z,"overflow")!="visible"&&(l=z.getBoundingClientRect(),g=C>l.left&&u<l.right&&m>l.top-1&&o<l.bottom+1);return g},fe=function(){var e,i,l,z,g,p,_,x,N,M,W,P,b=S.elements;if((c=r.loadMode)&&L<8&&(e=b.length)){for(i=0,I++;i<e;i++)if(!(!b[i]||b[i]._lazyRace)){if(!be||S.prematureUnveil&&S.prematureUnveil(b[i])){D(b[i]);continue}if((!(x=b[i][y]("data-expand"))||!(p=x*1))&&(p=V),M||(M=!r.expand||r.expand<1?B.clientHeight>500&&B.clientWidth>500?500:370:r.expand,S._defEx=M,W=M*r.expFactor,P=r.hFac,T=null,V<W&&L<1&&I>2&&c>2&&!d.hidden?(V=W,I=0):c>1&&I>1&&L<6?V=M:V=Ae),N!==p&&(n=innerWidth+p*P,v=innerHeight+p,_=p*-1,N=p),l=b[i].getBoundingClientRect(),(m=l.bottom)>=_&&(o=l.top)<=v&&(C=l.right)>=_*P&&(u=l.left)<=n&&(m||C||u||o)&&(r.loadHidden||ue(b[i]))&&(t&&L<3&&!x&&(c<3||I<4)||Le(b[i],p))){if(D(b[i]),g=!0,L>9)break}else!g&&t&&!z&&L<4&&I<4&&c>2&&(a[0]||r.preloadAfterLoad)&&(a[0]||!x&&(m||C||u||o||b[i][y](r.sizesAttr)!="auto"))&&(z=a[0]||b[i])}z&&!g&&D(z)}},E=he(fe),ce=function(e){var i=e.target;if(i._lazyCache){delete i._lazyCache;return}le(e),H(i,r.loadedClass),Y(i,r.loadingClass),Z(i,de),O(i,"lazyloaded")},me=J(ce),de=function(e){me({target:e.target})},Se=function(e,i){var l=e.getAttribute("data-load-mode")||r.iframeLoadMode;l==0?e.contentWindow.location.replace(i):l==1&&(e.src=i)},_e=function(e){var i,l=e[y](r.srcsetAttr);(i=r.customMedia[e[y]("data-media")||e[y]("media")])&&e.setAttribute("media",i),l&&e.setAttribute("srcset",l)},xe=J(function(e,i,l,z,g){var p,_,x,N,M,W;(M=O(e,"lazybeforeunveil",i)).defaultPrevented||(z&&(l?H(e,r.autosizesClass):e.setAttribute("sizes",z)),_=e[y](r.srcsetAttr),p=e[y](r.srcAttr),g&&(x=e.parentNode,N=x&&ie.test(x.nodeName||"")),W=i.firesLoad||"src"in e&&(_||p||N),M={target:e},H(e,r.loadingClass),W&&(clearTimeout(s),s=A(le,2500),Z(e,de,!0)),N&&ye.call(x.getElementsByTagName("source"),_e),_?e.setAttribute("srcset",_):p&&!N&&(Ee.test(e.nodeName)?Se(e,p):e.src=p),g&&(_||N)&&w(e,{src:p})),e._lazyRace&&delete e._lazyRace,Y(e,r.lazyClass),U(function(){var P=e.complete&&e.naturalWidth>1;(!W||P)&&(P&&H(e,r.fastLoadedClass),ce(M),e._lazyCache=!0,A(function(){"_lazyCache"in e&&delete e._lazyCache},9)),e.loading=="lazy"&&L--},!0)}),D=function(e){if(!e._lazyRace){var i,l=Ce.test(e.nodeName),z=l&&(e[y](r.sizesAttr)||e[y]("sizes")),g=z=="auto";(g||!t)&&l&&(e[y]("src")||e.srcset)&&!e.complete&&!q(e,r.errorClass)&&q(e,r.lazyClass)||(i=O(e,"lazyunveilread").detail,g&&ee.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,L++,xe(e,i,g,z,l))}},Me=ne(function(){r.loadMode=3,E()}),ve=function(){r.loadMode==3&&(r.loadMode=2),Me()},Q=function(){if(!t){if(R.now()-f<999){A(Q,999);return}t=!0,r.loadMode=3,E(),F("scroll",ve,!0)}};return{_:function(){f=R.now(),S.elements=d.getElementsByClassName(r.lazyClass),a=d.getElementsByClassName(r.lazyClass+" "+r.preloadClass),F("scroll",E,!0),F("resize",E,!0),F("pageshow",function(e){if(e.persisted){var i=d.querySelectorAll("."+r.loadingClass);i.length&&i.forEach&&re(function(){i.forEach(function(l){l.complete&&D(l)})})}}),h.MutationObserver?new MutationObserver(E).observe(B,{childList:!0,subtree:!0,attributes:!0}):(B[k]("DOMNodeInserted",E,!0),B[k]("DOMAttrModified",E,!0),setInterval(E,999)),F("hashchange",E,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){d[k](e,E,!0)}),/d$|^c/.test(d.readyState)?Q():(F("load",Q),d[k]("DOMContentLoaded",E),A(Q,2e4)),S.elements.length?(fe(),U._lsFlush()):E()},checkElems:E,unveil:D,_aLSL:ve}}(),ee=function(){var a,t=J(function(n,v,o,u){var C,m,T;if(n._lazysizesWidth=u,u+="px",n.setAttribute("sizes",u),ie.test(v.nodeName||""))for(C=v.getElementsByTagName("source"),m=0,T=C.length;m<T;m++)C[m].setAttribute("sizes",u);o.detail.dataAttr||w(n,o.detail)}),s=function(n,v,o){var u,C=n.parentNode;C&&(o=se(n,C,o),u=O(n,"lazybeforesizes",{width:o,dataAttr:!!v}),u.defaultPrevented||(o=u.detail.width,o&&o!==n._lazysizesWidth&&t(n,C,u,o)))},c=function(){var n,v=a.length;if(v)for(n=0;n<v;n++)s(a[n])},f=ne(c);return{_:function(){a=d.getElementsByClassName(r.autosizesClass),F("resize",f)},checkElems:f,updateElem:s}}(),K=function(){!K.i&&d.getElementsByClassName&&(K.i=!0,ee._(),oe._())};return A(function(){r.init&&K()}),S={cfg:r,autoSizer:ee,loader:oe,init:K,uP:w,aC:H,rC:Y,hC:q,fire:O,gW:se,rAF:U},S})}(te)),te.exports}Ne();export{Ne as r};
|
@@ -1,60 +1 @@
|
|
1
|
-
import
|
2
|
-
const KIT_SELECTOR = '[class^="pb_"][class*="_kit"]';
|
3
|
-
const ERROR_MESSAGE_SELECTOR = ".pb_body_kit_negative";
|
4
|
-
const FORM_SELECTOR = 'form[data-pb-form-validation="true"]';
|
5
|
-
const REQUIRED_FIELDS_SELECTOR = "input[required],textarea[required],select[required]";
|
6
|
-
const FIELD_EVENTS = [
|
7
|
-
"change",
|
8
|
-
"valid",
|
9
|
-
"invalid"
|
10
|
-
];
|
11
|
-
class PbFormValidation extends PbEnhancedElement {
|
12
|
-
static get selector() {
|
13
|
-
return FORM_SELECTOR;
|
14
|
-
}
|
15
|
-
connect() {
|
16
|
-
this.formValidationFields.forEach((field) => {
|
17
|
-
FIELD_EVENTS.forEach((e) => {
|
18
|
-
field.addEventListener(e, lodashExports.debounce((event) => {
|
19
|
-
this.validateFormField(event);
|
20
|
-
}, 250), false);
|
21
|
-
});
|
22
|
-
});
|
23
|
-
}
|
24
|
-
validateFormField(event) {
|
25
|
-
event.preventDefault();
|
26
|
-
const { target } = event;
|
27
|
-
target.setCustomValidity("");
|
28
|
-
const isValid = event.target.validity.valid;
|
29
|
-
if (isValid) {
|
30
|
-
this.clearError(target);
|
31
|
-
} else {
|
32
|
-
this.showValidationMessage(target);
|
33
|
-
}
|
34
|
-
}
|
35
|
-
showValidationMessage(target) {
|
36
|
-
const { parentElement } = target;
|
37
|
-
this.clearError(target);
|
38
|
-
parentElement.closest(KIT_SELECTOR).classList.add("error");
|
39
|
-
const errorMessageContainer = this.errorMessageContainer;
|
40
|
-
if (target.dataset.message) target.setCustomValidity(target.dataset.message);
|
41
|
-
errorMessageContainer.innerHTML = target.validationMessage;
|
42
|
-
parentElement.appendChild(errorMessageContainer);
|
43
|
-
}
|
44
|
-
clearError(target) {
|
45
|
-
const { parentElement } = target;
|
46
|
-
parentElement.closest(KIT_SELECTOR).classList.remove("error");
|
47
|
-
const errorMessageContainer = parentElement.querySelector(ERROR_MESSAGE_SELECTOR);
|
48
|
-
if (errorMessageContainer) errorMessageContainer.remove();
|
49
|
-
}
|
50
|
-
get errorMessageContainer() {
|
51
|
-
const errorContainer = document.createElement("div");
|
52
|
-
const kitClassName = ERROR_MESSAGE_SELECTOR.replace(/\./, "");
|
53
|
-
errorContainer.classList.add(kitClassName);
|
54
|
-
return errorContainer;
|
55
|
-
}
|
56
|
-
get formValidationFields() {
|
57
|
-
return this._formValidationFields = this._formValidationFields || this.element.querySelectorAll(REQUIRED_FIELDS_SELECTOR);
|
58
|
-
}
|
59
|
-
}
|
60
|
-
window.PbFormValidation = PbFormValidation;
|
1
|
+
import{P as i,l as o}from"./lib.js";const a='[class^="pb_"][class*="_kit"]',r=".pb_body_kit_negative",n='form[data-pb-form-validation="true"]',l="input[required],textarea[required],select[required]",d=["change","valid","invalid"];class c extends i{static get selector(){return n}connect(){this.formValidationFields.forEach(e=>{d.forEach(s=>{e.addEventListener(s,o.debounce(t=>{this.validateFormField(t)},250),!1)})})}validateFormField(e){e.preventDefault();const{target:s}=e;s.setCustomValidity(""),e.target.validity.valid?this.clearError(s):this.showValidationMessage(s)}showValidationMessage(e){const{parentElement:s}=e;this.clearError(e),s.closest(a).classList.add("error");const t=this.errorMessageContainer;e.dataset.message&&e.setCustomValidity(e.dataset.message),t.innerHTML=e.validationMessage,s.appendChild(t)}clearError(e){const{parentElement:s}=e;s.closest(a).classList.remove("error");const t=s.querySelector(r);t&&t.remove()}get errorMessageContainer(){const e=document.createElement("div"),s=r.replace(/\./,"");return e.classList.add(s),e}get formValidationFields(){return this._formValidationFields=this._formValidationFields||this.element.querySelectorAll(l)}}window.PbFormValidation=c;
|