uikit 3.16.11-dev.85cdca725 → 3.16.11-dev.cc1aeb568
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/uikit-core-rtl.css +1 -1
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +1 -1
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +1 -1
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +1 -1
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +1 -1
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +1 -1
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +7 -491
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +7 -491
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +1 -1
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +1 -1
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +1 -1
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +1 -1
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +1 -1
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +1 -1
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +1 -1
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +1 -1
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +1 -1
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +155 -161
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +1 -1
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +155 -161
- package/dist/js/uikit.min.js +1 -1
- package/package.json +1 -1
- package/src/js/api/computed.js +47 -6
- package/src/js/api/hooks.js +9 -8
- package/src/js/api/observer.js +14 -32
- package/src/js/api/update.js +6 -1
- package/src/js/api/watch.js +6 -22
- package/src/js/core/drop.js +1 -1
- package/src/js/core/dropnav.js +23 -35
- package/src/js/core/img.js +6 -5
- package/src/js/core/navbar.js +17 -21
- package/src/js/core/scrollspy.js +6 -5
- package/src/js/core/switcher.js +5 -9
- package/src/js/core/toggle.js +3 -7
- package/src/js/{util → mixin/internal}/scroll.js +1 -5
- package/src/js/mixin/modal.js +1 -1
- package/tests/drop.html +0 -1
- package/tests/dropnav.html +1 -1
- package/tests/icon.html +0 -2
- package/tests/modal.html +0 -1
- package/tests/nav.html +0 -1
- package/tests/navbar.html +0 -1
- package/tests/progress.html +0 -1
- package/tests/scroll.html +0 -1
- package/tests/sticky-navbar.html +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! UIkit 3.16.11-dev.
|
|
1
|
+
/*! UIkit 3.16.11-dev.cc1aeb568 | https://www.getuikit.com | (c) 2014 - 2023 YOOtheme | MIT License */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! UIkit 3.16.11-dev.
|
|
1
|
+
/*! UIkit 3.16.11-dev.cc1aeb568 | https://www.getuikit.com | (c) 2014 - 2023 YOOtheme | MIT License */(function(t,s){typeof exports=="object"&&typeof module<"u"?module.exports=s(require("uikit-util")):typeof define=="function"&&define.amd?define("uikitcountdown",["uikit-util"],s):(t=typeof globalThis<"u"?globalThis:t||self,t.UIkitCountdown=s(t.UIkit.util))})(this,function(t){"use strict";var s={connected(){t.addClass(this.$el,this.$options.id)}};const d=["days","hours","minutes","seconds"];var r={mixins:[s],props:{date:String,clsWrapper:String,role:String},data:{date:"",clsWrapper:".uk-countdown-%unit%",role:"timer"},connected(){t.attr(this.$el,"role",this.role),this.date=t.toFloat(Date.parse(this.$props.date)),this.end=!1,this.start()},disconnected(){this.stop()},events:{name:"visibilitychange",el(){return document},handler(){document.hidden?this.stop():this.start()}},methods:{start(){this.stop(),this.update(),this.timer||(t.trigger(this.$el,"countdownstart"),this.timer=setInterval(this.update,1e3))},stop(){this.timer&&(clearInterval(this.timer),t.trigger(this.$el,"countdownstop"),this.timer=null)},update(){const o=a(this.date);o.total||(this.stop(),this.end||(t.trigger(this.$el,"countdownend"),this.end=!0));for(const n of d){const i=t.$(this.clsWrapper.replace("%unit%",n),this.$el);if(!i)continue;let e=String(Math.trunc(o[n]));e=e.length<2?`0${e}`:e,i.textContent!==e&&(e=e.split(""),e.length!==i.children.length&&t.html(i,e.map(()=>"<span></span>").join("")),e.forEach((h,u)=>i.children[u].textContent=h))}}}};function a(o){const n=Math.max(0,o-Date.now())/1e3;return{total:n,seconds:n%60,minutes:n/60%60,hours:n/60/60%24,days:n/60/60/24}}return typeof window<"u"&&window.UIkit&&window.UIkit.component("countdown",r),r});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! UIkit 3.16.11-dev.
|
|
1
|
+
/*! UIkit 3.16.11-dev.cc1aeb568 | https://www.getuikit.com | (c) 2014 - 2023 YOOtheme | MIT License */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! UIkit 3.16.11-dev.
|
|
1
|
+
/*! UIkit 3.16.11-dev.cc1aeb568 | https://www.getuikit.com | (c) 2014 - 2023 YOOtheme | MIT License */(function(s,u){typeof exports=="object"&&typeof module<"u"?module.exports=u(require("uikit-util")):typeof define=="function"&&define.amd?define("uikitfilter",["uikit-util"],u):(s=typeof globalThis<"u"?globalThis:s||self,s.UIkitFilter=u(s.UIkit.util))})(this,function(s){"use strict";function u(n){return b(s.observeResize,n,"resize")}function N(n){return b(s.observeMutation,n)}function b(n,e,o){return{observe:n,handler(){this.$emit(o)},...e}}N({options:{childList:!0,attributes:!0,attributeFilter:["style"]}}),u({target:({$el:n})=>[n,...s.toArray(n.children)]});function T(n){return C(n,"top","bottom")}function q(n){const e=[];for(const o of n){const t=C(o,"left","right");for(let r=0;r<t.length;r++)e[r]=e[r]?e[r].concat(t[r]):t[r]}return s.isRtl?e.reverse():e}function C(n,e,o){const t=[[]];for(const r of n){if(!s.isVisible(r))continue;let a=y(r);for(let c=t.length-1;c>=0;c--){const f=t[c];if(!f[0]){f.push(r);break}let h;if(f[0].offsetParent===r.offsetParent?h=y(f[0]):(a=y(r,!0),h=y(f[0],!0)),a[e]>=h[o]-1&&a[e]!==h[e]){t.push([r]);break}if(a[o]-1>h[e]||a[e]===h[e]){f.push(r);break}if(c===0){t.unshift([r]);break}}}return t}function y(n,e=!1){let{offsetTop:o,offsetLeft:t,offsetHeight:r,offsetWidth:a}=n;return e&&([o,t]=s.offsetPosition(n)),{top:o,left:t,bottom:o+r,right:t+a}}const w="uk-transition-leave",v="uk-transition-enter";function $(n,e,o,t=0){const r=g(e,!0),a={opacity:1},c={opacity:0},f=p=>()=>r===g(e)?p():Promise.reject(),h=f(async()=>{s.addClass(e,w),await Promise.all(P(e).map((p,l)=>new Promise(d=>setTimeout(()=>s.Transition.start(p,c,o/2,"ease").then(d),l*t)))),s.removeClass(e,w)}),i=f(async()=>{const p=s.height(e);s.addClass(e,v),n(),s.css(s.children(e),{opacity:0}),await L();const l=s.children(e),d=s.height(e);s.css(e,"alignContent","flex-start"),s.height(e,p);const m=P(e);s.css(l,c);const z=m.map(async(Y,Z)=>{await O(Z*t),await s.Transition.start(Y,a,o/2,"ease")});p!==d&&z.push(s.Transition.start(e,{height:d},o/2+m.length*t,"ease")),await Promise.all(z).then(()=>{s.removeClass(e,v),r===g(e)&&(s.css(e,{height:"",alignContent:""}),s.css(l,{opacity:""}),delete e.dataset.transition)})});return s.hasClass(e,w)?S(e).then(i):s.hasClass(e,v)?S(e).then(h).then(i):h().then(i)}function g(n,e){return e&&(n.dataset.transition=1+g(n)),s.toNumber(n.dataset.transition)||0}function S(n){return Promise.all(s.children(n).filter(s.Transition.inProgress).map(e=>new Promise(o=>s.once(e,"transitionend transitioncanceled",o))))}function P(n){return T(s.children(n)).reduce((e,o)=>e.concat(s.sortBy(o.filter(t=>s.isInView(t)),"offsetLeft")),[])}function L(){return new Promise(n=>requestAnimationFrame(n))}function O(n){return new Promise(e=>setTimeout(e,n))}async function H(n,e,o){await E();let t=s.children(e);const r=t.map(d=>I(d,!0)),a={...s.css(e,["height","padding"]),display:"block"};await Promise.all(t.concat(e).map(s.Transition.cancel)),n(),t=t.concat(s.children(e).filter(d=>!s.includes(t,d))),await Promise.resolve(),s.fastdom.flush();const c=s.attr(e,"style"),f=s.css(e,["height","padding"]),[h,i]=V(e,t,r),p=t.map(d=>({style:s.attr(d,"style")}));t.forEach((d,m)=>i[m]&&s.css(d,i[m])),s.css(e,a),s.trigger(e,"scroll"),s.fastdom.flush(),await E();const l=t.map((d,m)=>s.parent(d)===e&&s.Transition.start(d,h[m],o,"ease")).concat(s.Transition.start(e,f,o,"ease"));try{await Promise.all(l),t.forEach((d,m)=>{s.attr(d,p[m]),s.parent(d)===e&&s.css(d,"display",h[m].opacity===0?"none":"")}),s.attr(e,"style",c)}catch{s.attr(t,"style",""),D(e,a)}}function I(n,e){const o=s.css(n,"zIndex");return s.isVisible(n)?{display:"",opacity:e?s.css(n,"opacity"):"0",pointerEvents:"none",position:"absolute",zIndex:o==="auto"?s.index(n):o,...F(n)}:!1}function V(n,e,o){const t=e.map((a,c)=>s.parent(a)&&c in o?o[c]?s.isVisible(a)?F(a):{opacity:0}:{opacity:s.isVisible(a)?1:0}:!1),r=t.map((a,c)=>{const f=s.parent(e[c])===n&&(o[c]||I(e[c]));if(!f)return!1;if(!a)delete f.opacity;else if(!("opacity"in a)){const{opacity:h}=f;h%1?a.opacity=1:delete f.opacity}return f});return[t,r]}function D(n,e){for(const o in e)s.css(n,o,"")}function F(n){const{height:e,width:o}=s.offset(n);return{height:e,width:o,transform:"",...s.position(n),...s.css(n,["marginTop","marginLeft"])}}function E(){return new Promise(n=>requestAnimationFrame(n))}var M={props:{duration:Number,animation:Boolean},data:{duration:150,animation:"slide"},methods:{animate(n,e=this.$el){const o=this.animation;return(o==="fade"?$:o==="delayed-fade"?(...r)=>$(...r,40):o?H:()=>(n(),Promise.resolve()))(n,e,this.duration).catch(s.noop)}}};function R(n,e=[]){try{return n?s.startsWith(n,"{")?JSON.parse(n):e.length&&!s.includes(n,":")?{[e[0]]:n}:n.split(";").reduce((o,t)=>{const[r,a]=t.split(/:(.*)/);return r&&!s.isUndefined(a)&&(o[r.trim()]=a.trim()),o},{}):{}}catch{return{}}}const W={TAB:9,ESC:27,SPACE:32,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40};var x={mixins:[M],args:"target",props:{target:Boolean,selActive:Boolean},data:{target:null,selActive:!1,attrItem:"uk-filter-control",cls:"uk-active",duration:250},computed:{toggles({attrItem:n},e){return s.$$(`[${n}],[data-${n}]`,e)},children({target:n},e){return s.$$(`${n} > *`,e)}},watch:{toggles(n){this.updateState();const e=s.$$(this.selActive,this.$el);for(const o of n){this.selActive!==!1&&s.toggleClass(o,this.cls,s.includes(e,o));const t=X(o);s.isTag(t,"a")&&s.attr(t,"role","button")}},children(n,e){e&&this.updateState()}},events:{name:"click keydown",delegate(){return`[${this.attrItem}],[data-${this.attrItem}]`},handler(n){n.type==="keydown"&&n.keyCode!==W.SPACE||s.closest(n.target,"a,button")&&(n.preventDefault(),this.apply(n.current))}},methods:{apply(n){const e=this.getState(),o=B(n,this.attrItem,this.getState());j(e,o)||this.setState(o)},getState(){return this.toggles.filter(n=>s.hasClass(n,this.cls)).reduce((n,e)=>B(e,this.attrItem,n),{filter:{"":""},sort:[]})},async setState(n,e=!0){n={filter:{"":""},sort:[],...n},s.trigger(this.$el,"beforeFilter",[this,n]);for(const o of this.toggles)s.toggleClass(o,this.cls,J(o,this.attrItem,n));await Promise.all(s.$$(this.target,this.$el).map(o=>{const t=()=>{G(n,o,s.children(o)),this.$update(this.$el)};return e?this.animate(t,o):t()})),s.trigger(this.$el,"afterFilter",[this])},updateState(){s.fastdom.write(()=>this.setState(this.getState(),!1))}}};function A(n,e){return R(s.data(n,e),["filter"])}function j(n,e){return["filter","sort"].every(o=>s.isEqual(n[o],e[o]))}function G(n,e,o){const t=K(n);o.forEach(c=>s.css(c,"display",t&&!s.matches(c,t)?"none":""));const[r,a]=n.sort;if(r){const c=Q(o,r,a);s.isEqual(c,o)||s.append(e,c)}}function B(n,e,o){const{filter:t,group:r,sort:a,order:c="asc"}=A(n,e);return(t||s.isUndefined(a))&&(r?t?(delete o.filter[""],o.filter[r]=t):(delete o.filter[r],(s.isEmpty(o.filter)||""in o.filter)&&(o.filter={"":t||""})):o.filter={"":t||""}),s.isUndefined(a)||(o.sort=[a,c]),o}function J(n,e,{filter:o={"":""},sort:[t,r]}){const{filter:a="",group:c="",sort:f,order:h="asc"}=A(n,e);return s.isUndefined(f)?c in o&&a===o[c]||!a&&c&&!(c in o)&&!o[""]:t===f&&r===h}function K({filter:n}){let e="";return s.each(n,o=>e+=o||""),e}function Q(n,e,o){return[...n].sort((t,r)=>s.data(t,e).localeCompare(s.data(r,e),void 0,{numeric:!0})*(o==="asc"||-1))}function X(n){return s.$("a,button",n)||n}return typeof window<"u"&&window.UIkit&&window.UIkit.component("filter",x),x});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! UIkit 3.16.11-dev.
|
|
1
|
+
/*! UIkit 3.16.11-dev.cc1aeb568 | https://www.getuikit.com | (c) 2014 - 2023 YOOtheme | MIT License */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
|
|
@@ -266,500 +266,16 @@
|
|
|
266
266
|
);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
const hyphenateRe = /\B([A-Z])/g;
|
|
270
|
-
const hyphenate = memoize((str) => str.replace(hyphenateRe, "-$1").toLowerCase());
|
|
271
|
-
const ucfirst = memoize((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
|
272
|
-
function startsWith(str, search) {
|
|
273
|
-
var _a;
|
|
274
|
-
return (_a = str == null ? void 0 : str.startsWith) == null ? void 0 : _a.call(str, search);
|
|
275
|
-
}
|
|
276
|
-
function includes(obj, search) {
|
|
277
|
-
var _a;
|
|
278
|
-
return (_a = obj == null ? void 0 : obj.includes) == null ? void 0 : _a.call(obj, search);
|
|
279
|
-
}
|
|
280
|
-
function findIndex(array, predicate) {
|
|
281
|
-
var _a;
|
|
282
|
-
return (_a = array == null ? void 0 : array.findIndex) == null ? void 0 : _a.call(array, predicate);
|
|
283
|
-
}
|
|
284
|
-
const { isArray, from: toArray } = Array;
|
|
285
|
-
function isFunction(obj) {
|
|
286
|
-
return typeof obj === "function";
|
|
287
|
-
}
|
|
288
|
-
function isObject(obj) {
|
|
289
|
-
return obj !== null && typeof obj === "object";
|
|
290
|
-
}
|
|
291
|
-
function isWindow(obj) {
|
|
292
|
-
return isObject(obj) && obj === obj.window;
|
|
293
|
-
}
|
|
294
|
-
function isDocument(obj) {
|
|
295
|
-
return nodeType(obj) === 9;
|
|
296
|
-
}
|
|
297
|
-
function isNode(obj) {
|
|
298
|
-
return nodeType(obj) >= 1;
|
|
299
|
-
}
|
|
300
|
-
function isElement(obj) {
|
|
301
|
-
return nodeType(obj) === 1;
|
|
302
|
-
}
|
|
303
|
-
function nodeType(obj) {
|
|
304
|
-
return !isWindow(obj) && isObject(obj) && obj.nodeType;
|
|
305
|
-
}
|
|
306
|
-
function isString(value) {
|
|
307
|
-
return typeof value === "string";
|
|
308
|
-
}
|
|
309
|
-
function isNumber(value) {
|
|
310
|
-
return typeof value === "number";
|
|
311
|
-
}
|
|
312
|
-
function isNumeric(value) {
|
|
313
|
-
return isNumber(value) || isString(value) && !isNaN(value - parseFloat(value));
|
|
314
|
-
}
|
|
315
|
-
function isUndefined(value) {
|
|
316
|
-
return value === void 0;
|
|
317
|
-
}
|
|
318
|
-
function toFloat(value) {
|
|
319
|
-
return parseFloat(value) || 0;
|
|
320
|
-
}
|
|
321
|
-
function toNode(element) {
|
|
322
|
-
return toNodes(element)[0];
|
|
323
|
-
}
|
|
324
|
-
function toNodes(element) {
|
|
325
|
-
return isNode(element) ? [element] : Array.from(element || []).filter(isNode);
|
|
326
|
-
}
|
|
327
|
-
function toWindow(element) {
|
|
328
|
-
if (isWindow(element)) {
|
|
329
|
-
return element;
|
|
330
|
-
}
|
|
331
|
-
element = toNode(element);
|
|
332
|
-
const document = isDocument(element) ? element : element == null ? void 0 : element.ownerDocument;
|
|
333
|
-
return (document == null ? void 0 : document.defaultView) || window;
|
|
334
|
-
}
|
|
335
|
-
function each(obj, cb) {
|
|
336
|
-
for (const key in obj) {
|
|
337
|
-
if (false === cb(obj[key], key)) {
|
|
338
|
-
return false;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
return true;
|
|
342
|
-
}
|
|
343
|
-
function sumBy(array, iteratee) {
|
|
344
|
-
return array.reduce(
|
|
345
|
-
(sum, item) => sum + toFloat(isFunction(iteratee) ? iteratee(item) : item[iteratee]),
|
|
346
|
-
0
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
function memoize(fn) {
|
|
350
|
-
const cache = /* @__PURE__ */ Object.create(null);
|
|
351
|
-
return (key) => cache[key] || (cache[key] = fn(key));
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
function attr(element, name, value) {
|
|
355
|
-
var _a;
|
|
356
|
-
if (isObject(name)) {
|
|
357
|
-
for (const key in name) {
|
|
358
|
-
attr(element, key, name[key]);
|
|
359
|
-
}
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
if (isUndefined(value)) {
|
|
363
|
-
return (_a = toNode(element)) == null ? void 0 : _a.getAttribute(name);
|
|
364
|
-
} else {
|
|
365
|
-
for (const el of toNodes(element)) {
|
|
366
|
-
if (isFunction(value)) {
|
|
367
|
-
value = value.call(el, attr(el, name));
|
|
368
|
-
}
|
|
369
|
-
if (value === null) {
|
|
370
|
-
removeAttr(el, name);
|
|
371
|
-
} else {
|
|
372
|
-
el.setAttribute(name, value);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
function removeAttr(element, name) {
|
|
378
|
-
toNodes(element).forEach((element2) => element2.removeAttribute(name));
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
function parent(element) {
|
|
382
|
-
var _a;
|
|
383
|
-
return (_a = toNode(element)) == null ? void 0 : _a.parentElement;
|
|
384
|
-
}
|
|
385
|
-
function filter(element, selector) {
|
|
386
|
-
return toNodes(element).filter((element2) => matches(element2, selector));
|
|
387
|
-
}
|
|
388
|
-
function matches(element, selector) {
|
|
389
|
-
return toNodes(element).some((element2) => element2.matches(selector));
|
|
390
|
-
}
|
|
391
|
-
function closest(element, selector) {
|
|
392
|
-
return isElement(element) ? element.closest(startsWith(selector, ">") ? selector.slice(1) : selector) : toNodes(element).map((element2) => closest(element2, selector)).filter(Boolean);
|
|
393
|
-
}
|
|
394
|
-
function within(element, selector) {
|
|
395
|
-
return isString(selector) ? !!closest(element, selector) : toNode(selector).contains(toNode(element));
|
|
396
|
-
}
|
|
397
|
-
function parents(element, selector) {
|
|
398
|
-
const elements = [];
|
|
399
|
-
while (element = parent(element)) {
|
|
400
|
-
if (!selector || matches(element, selector)) {
|
|
401
|
-
elements.push(element);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
return elements;
|
|
405
|
-
}
|
|
406
|
-
function children(element, selector) {
|
|
407
|
-
element = toNode(element);
|
|
408
|
-
const children2 = element ? toNodes(element.children) : [];
|
|
409
|
-
return selector ? filter(children2, selector) : children2;
|
|
410
|
-
}
|
|
411
|
-
function index(element, ref) {
|
|
412
|
-
return ref ? toNodes(element).indexOf(toNode(ref)) : children(parent(element)).indexOf(element);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
function findAll(selector, context) {
|
|
416
|
-
return toNodes(_query(selector, toNode(context), "querySelectorAll"));
|
|
417
|
-
}
|
|
418
|
-
const contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
|
|
419
|
-
const isContextSelector = memoize((selector) => selector.match(contextSelectorRe));
|
|
420
|
-
const contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
|
|
421
|
-
const sanatize = memoize((selector) => selector.replace(contextSanitizeRe, "$1 *"));
|
|
422
|
-
function _query(selector, context = document, queryFn) {
|
|
423
|
-
if (!selector || !isString(selector)) {
|
|
424
|
-
return selector;
|
|
425
|
-
}
|
|
426
|
-
selector = sanatize(selector);
|
|
427
|
-
if (isContextSelector(selector)) {
|
|
428
|
-
const split = splitSelector(selector);
|
|
429
|
-
selector = "";
|
|
430
|
-
for (let sel of split) {
|
|
431
|
-
let ctx = context;
|
|
432
|
-
if (sel[0] === "!") {
|
|
433
|
-
const selectors = sel.substr(1).trim().split(" ");
|
|
434
|
-
ctx = closest(parent(context), selectors[0]);
|
|
435
|
-
sel = selectors.slice(1).join(" ").trim();
|
|
436
|
-
if (!sel.length && split.length === 1) {
|
|
437
|
-
return ctx;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
if (sel[0] === "-") {
|
|
441
|
-
const selectors = sel.substr(1).trim().split(" ");
|
|
442
|
-
const prev = (ctx || context).previousElementSibling;
|
|
443
|
-
ctx = matches(prev, sel.substr(1)) ? prev : null;
|
|
444
|
-
sel = selectors.slice(1).join(" ");
|
|
445
|
-
}
|
|
446
|
-
if (ctx) {
|
|
447
|
-
selector += `${selector ? "," : ""}${domPath(ctx)} ${sel}`;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
context = document;
|
|
451
|
-
}
|
|
452
|
-
try {
|
|
453
|
-
return context[queryFn](selector);
|
|
454
|
-
} catch (e) {
|
|
455
|
-
return null;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
const selectorRe = /.*?[^\\](?:,|$)/g;
|
|
459
|
-
const splitSelector = memoize(
|
|
460
|
-
(selector) => selector.match(selectorRe).map((selector2) => selector2.replace(/,$/, "").trim())
|
|
461
|
-
);
|
|
462
|
-
function domPath(element) {
|
|
463
|
-
const names = [];
|
|
464
|
-
while (element.parentNode) {
|
|
465
|
-
const id = attr(element, "id");
|
|
466
|
-
if (id) {
|
|
467
|
-
names.unshift(`#${escape(id)}`);
|
|
468
|
-
break;
|
|
469
|
-
} else {
|
|
470
|
-
let { tagName } = element;
|
|
471
|
-
if (tagName !== "HTML") {
|
|
472
|
-
tagName += `:nth-child(${index(element) + 1})`;
|
|
473
|
-
}
|
|
474
|
-
names.unshift(tagName);
|
|
475
|
-
element = element.parentNode;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
return names.join(" > ");
|
|
479
|
-
}
|
|
480
|
-
function escape(css) {
|
|
481
|
-
return isString(css) ? CSS.escape(css) : "";
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
function on(...args) {
|
|
485
|
-
let [targets, types, selector, listener, useCapture = false] = getArgs(args);
|
|
486
|
-
if (listener.length > 1) {
|
|
487
|
-
listener = detail(listener);
|
|
488
|
-
}
|
|
489
|
-
if (useCapture == null ? void 0 : useCapture.self) {
|
|
490
|
-
listener = selfFilter(listener);
|
|
491
|
-
}
|
|
492
|
-
if (selector) {
|
|
493
|
-
listener = delegate(selector, listener);
|
|
494
|
-
}
|
|
495
|
-
for (const type of types) {
|
|
496
|
-
for (const target of targets) {
|
|
497
|
-
target.addEventListener(type, listener, useCapture);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
return () => off(targets, types, listener, useCapture);
|
|
501
|
-
}
|
|
502
|
-
function off(...args) {
|
|
503
|
-
let [targets, types, , listener, useCapture = false] = getArgs(args);
|
|
504
|
-
for (const type of types) {
|
|
505
|
-
for (const target of targets) {
|
|
506
|
-
target.removeEventListener(type, listener, useCapture);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
function getArgs(args) {
|
|
511
|
-
args[0] = toEventTargets(args[0]);
|
|
512
|
-
if (isString(args[1])) {
|
|
513
|
-
args[1] = args[1].split(" ");
|
|
514
|
-
}
|
|
515
|
-
if (isFunction(args[2])) {
|
|
516
|
-
args.splice(2, 0, false);
|
|
517
|
-
}
|
|
518
|
-
return args;
|
|
519
|
-
}
|
|
520
|
-
function delegate(selector, listener) {
|
|
521
|
-
return (e) => {
|
|
522
|
-
const current = selector[0] === ">" ? findAll(selector, e.currentTarget).reverse().filter((element) => within(e.target, element))[0] : closest(e.target, selector);
|
|
523
|
-
if (current) {
|
|
524
|
-
e.current = current;
|
|
525
|
-
listener.call(this, e);
|
|
526
|
-
delete e.current;
|
|
527
|
-
}
|
|
528
|
-
};
|
|
529
|
-
}
|
|
530
|
-
function detail(listener) {
|
|
531
|
-
return (e) => isArray(e.detail) ? listener(e, ...e.detail) : listener(e);
|
|
532
|
-
}
|
|
533
|
-
function selfFilter(listener) {
|
|
534
|
-
return function(e) {
|
|
535
|
-
if (e.target === e.currentTarget || e.target === e.current) {
|
|
536
|
-
return listener.call(null, e);
|
|
537
|
-
}
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
function isEventTarget(target) {
|
|
541
|
-
return target && "addEventListener" in target;
|
|
542
|
-
}
|
|
543
|
-
function toEventTarget(target) {
|
|
544
|
-
return isEventTarget(target) ? target : toNode(target);
|
|
545
|
-
}
|
|
546
|
-
function toEventTargets(target) {
|
|
547
|
-
return isArray(target) ? target.map(toEventTarget).filter(Boolean) : isString(target) ? findAll(target) : isEventTarget(target) ? [target] : toNodes(target);
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
const cssNumber = {
|
|
551
|
-
"animation-iteration-count": true,
|
|
552
|
-
"column-count": true,
|
|
553
|
-
"fill-opacity": true,
|
|
554
|
-
"flex-grow": true,
|
|
555
|
-
"flex-shrink": true,
|
|
556
|
-
"font-weight": true,
|
|
557
|
-
"line-height": true,
|
|
558
|
-
opacity: true,
|
|
559
|
-
order: true,
|
|
560
|
-
orphans: true,
|
|
561
|
-
"stroke-dasharray": true,
|
|
562
|
-
"stroke-dashoffset": true,
|
|
563
|
-
widows: true,
|
|
564
|
-
"z-index": true,
|
|
565
|
-
zoom: true
|
|
566
|
-
};
|
|
567
|
-
function css(element, property, value, priority) {
|
|
568
|
-
const elements = toNodes(element);
|
|
569
|
-
for (const element2 of elements) {
|
|
570
|
-
if (isString(property)) {
|
|
571
|
-
property = propName(property);
|
|
572
|
-
if (isUndefined(value)) {
|
|
573
|
-
return getComputedStyle(element2).getPropertyValue(property);
|
|
574
|
-
} else {
|
|
575
|
-
element2.style.setProperty(
|
|
576
|
-
property,
|
|
577
|
-
isNumeric(value) && !cssNumber[property] ? `${value}px` : value || isNumber(value) ? value : "",
|
|
578
|
-
priority
|
|
579
|
-
);
|
|
580
|
-
}
|
|
581
|
-
} else if (isArray(property)) {
|
|
582
|
-
const props = {};
|
|
583
|
-
for (const prop of property) {
|
|
584
|
-
props[prop] = css(element2, prop);
|
|
585
|
-
}
|
|
586
|
-
return props;
|
|
587
|
-
} else if (isObject(property)) {
|
|
588
|
-
priority = value;
|
|
589
|
-
each(property, (value2, property2) => css(element2, property2, value2, priority));
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
return elements[0];
|
|
593
|
-
}
|
|
594
|
-
const propName = memoize((name) => vendorPropName(name));
|
|
595
|
-
function vendorPropName(name) {
|
|
596
|
-
if (startsWith(name, "--")) {
|
|
597
|
-
return name;
|
|
598
|
-
}
|
|
599
|
-
name = hyphenate(name);
|
|
600
|
-
const { style } = document.documentElement;
|
|
601
|
-
if (name in style) {
|
|
602
|
-
return name;
|
|
603
|
-
}
|
|
604
|
-
for (const prefix of ["webkit", "moz"]) {
|
|
605
|
-
const prefixedName = `-${prefix}-${name}`;
|
|
606
|
-
if (prefixedName in style) {
|
|
607
|
-
return prefixedName;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
const dirs = {
|
|
613
|
-
width: ["left", "right"],
|
|
614
|
-
height: ["top", "bottom"]
|
|
615
|
-
};
|
|
616
|
-
function dimensions(element) {
|
|
617
|
-
const rect = isElement(element) ? toNode(element).getBoundingClientRect() : { height: height(element), width: width(element), top: 0, left: 0 };
|
|
618
|
-
return {
|
|
619
|
-
height: rect.height,
|
|
620
|
-
width: rect.width,
|
|
621
|
-
top: rect.top,
|
|
622
|
-
left: rect.left,
|
|
623
|
-
bottom: rect.top + rect.height,
|
|
624
|
-
right: rect.left + rect.width
|
|
625
|
-
};
|
|
626
|
-
}
|
|
627
|
-
function offset(element, coordinates) {
|
|
628
|
-
const currentOffset = dimensions(element);
|
|
629
|
-
if (element) {
|
|
630
|
-
const { scrollY, scrollX } = toWindow(element);
|
|
631
|
-
const offsetBy = { height: scrollY, width: scrollX };
|
|
632
|
-
for (const dir in dirs) {
|
|
633
|
-
for (const prop of dirs[dir]) {
|
|
634
|
-
currentOffset[prop] += offsetBy[dir];
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
if (!coordinates) {
|
|
639
|
-
return currentOffset;
|
|
640
|
-
}
|
|
641
|
-
const pos = css(element, "position");
|
|
642
|
-
each(
|
|
643
|
-
css(element, ["left", "top"]),
|
|
644
|
-
(value, prop) => css(
|
|
645
|
-
element,
|
|
646
|
-
prop,
|
|
647
|
-
coordinates[prop] - currentOffset[prop] + toFloat(pos === "absolute" && value === "auto" ? position(element)[prop] : value)
|
|
648
|
-
)
|
|
649
|
-
);
|
|
650
|
-
}
|
|
651
|
-
function position(element) {
|
|
652
|
-
let { top, left } = offset(element);
|
|
653
|
-
const {
|
|
654
|
-
ownerDocument: { body, documentElement },
|
|
655
|
-
offsetParent
|
|
656
|
-
} = toNode(element);
|
|
657
|
-
let parent = offsetParent || documentElement;
|
|
658
|
-
while (parent && (parent === body || parent === documentElement) && css(parent, "position") === "static") {
|
|
659
|
-
parent = parent.parentNode;
|
|
660
|
-
}
|
|
661
|
-
if (isElement(parent)) {
|
|
662
|
-
const parentOffset = offset(parent);
|
|
663
|
-
top -= parentOffset.top + toFloat(css(parent, "borderTopWidth"));
|
|
664
|
-
left -= parentOffset.left + toFloat(css(parent, "borderLeftWidth"));
|
|
665
|
-
}
|
|
666
|
-
return {
|
|
667
|
-
top: top - toFloat(css(element, "marginTop")),
|
|
668
|
-
left: left - toFloat(css(element, "marginLeft"))
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
const height = dimension("height");
|
|
672
|
-
const width = dimension("width");
|
|
673
|
-
function dimension(prop) {
|
|
674
|
-
const propName = ucfirst(prop);
|
|
675
|
-
return (element, value) => {
|
|
676
|
-
if (isUndefined(value)) {
|
|
677
|
-
if (isWindow(element)) {
|
|
678
|
-
return element[`inner${propName}`];
|
|
679
|
-
}
|
|
680
|
-
if (isDocument(element)) {
|
|
681
|
-
const doc = element.documentElement;
|
|
682
|
-
return Math.max(doc[`offset${propName}`], doc[`scroll${propName}`]);
|
|
683
|
-
}
|
|
684
|
-
element = toNode(element);
|
|
685
|
-
value = css(element, prop);
|
|
686
|
-
value = value === "auto" ? element[`offset${propName}`] : toFloat(value) || 0;
|
|
687
|
-
return value - boxModelAdjust(element, prop);
|
|
688
|
-
} else {
|
|
689
|
-
return css(
|
|
690
|
-
element,
|
|
691
|
-
prop,
|
|
692
|
-
!value && value !== 0 ? "" : +value + boxModelAdjust(element, prop) + "px"
|
|
693
|
-
);
|
|
694
|
-
}
|
|
695
|
-
};
|
|
696
|
-
}
|
|
697
|
-
function boxModelAdjust(element, prop, sizing = "border-box") {
|
|
698
|
-
return css(element, "boxSizing") === sizing ? sumBy(
|
|
699
|
-
dirs[prop].map(ucfirst),
|
|
700
|
-
(prop2) => toFloat(css(element, `padding${prop2}`)) + toFloat(css(element, `border${prop2}Width`))
|
|
701
|
-
) : 0;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
function scrollParents(element, scrollable = false, props = []) {
|
|
705
|
-
const scrollEl = scrollingElement(element);
|
|
706
|
-
let ancestors = parents(element).reverse();
|
|
707
|
-
ancestors = ancestors.slice(ancestors.indexOf(scrollEl) + 1);
|
|
708
|
-
const fixedIndex = findIndex(ancestors, (el) => css(el, "position") === "fixed");
|
|
709
|
-
if (~fixedIndex) {
|
|
710
|
-
ancestors = ancestors.slice(fixedIndex);
|
|
711
|
-
}
|
|
712
|
-
return [scrollEl].concat(
|
|
713
|
-
ancestors.filter(
|
|
714
|
-
(parent) => css(parent, "overflow").split(" ").some((prop) => includes(["auto", "scroll", ...props], prop)) && (!scrollable || parent.scrollHeight > offsetViewport(parent).height)
|
|
715
|
-
)
|
|
716
|
-
).reverse();
|
|
717
|
-
}
|
|
718
|
-
function offsetViewport(scrollElement) {
|
|
719
|
-
const window = toWindow(scrollElement);
|
|
720
|
-
const {
|
|
721
|
-
visualViewport,
|
|
722
|
-
document: { documentElement }
|
|
723
|
-
} = window;
|
|
724
|
-
let viewportElement = scrollElement === scrollingElement(scrollElement) ? window : scrollElement;
|
|
725
|
-
if (isWindow(viewportElement) && visualViewport) {
|
|
726
|
-
let { height, width, scale, pageTop: top, pageLeft: left } = visualViewport;
|
|
727
|
-
height = Math.round(height * scale);
|
|
728
|
-
width = Math.round(width * scale);
|
|
729
|
-
return { height, width, top, left, bottom: top + height, right: left + width };
|
|
730
|
-
}
|
|
731
|
-
let rect = offset(viewportElement);
|
|
732
|
-
if (css(viewportElement, "display") === "inline") {
|
|
733
|
-
return rect;
|
|
734
|
-
}
|
|
735
|
-
for (let [prop, dir, start, end] of [
|
|
736
|
-
["width", "x", "left", "right"],
|
|
737
|
-
["height", "y", "top", "bottom"]
|
|
738
|
-
]) {
|
|
739
|
-
if (isWindow(viewportElement)) {
|
|
740
|
-
viewportElement = documentElement;
|
|
741
|
-
} else {
|
|
742
|
-
rect[start] += toFloat(css(viewportElement, `border-${start}-width`));
|
|
743
|
-
}
|
|
744
|
-
rect[prop] = rect[dir] = viewportElement[`client${ucfirst(prop)}`];
|
|
745
|
-
rect[end] = rect[prop] + rect[start];
|
|
746
|
-
}
|
|
747
|
-
return rect;
|
|
748
|
-
}
|
|
749
|
-
function scrollingElement(element) {
|
|
750
|
-
return toWindow(element).document.scrollingElement;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
269
|
let prevented;
|
|
754
270
|
function preventBackgroundScroll(el) {
|
|
755
|
-
const off = on(
|
|
271
|
+
const off = util.on(
|
|
756
272
|
el,
|
|
757
273
|
"touchmove",
|
|
758
274
|
(e) => {
|
|
759
|
-
if (e.targetTouches.length !== 1 || matches(e.target, 'input[type="range"')) {
|
|
275
|
+
if (e.targetTouches.length !== 1 || util.matches(e.target, 'input[type="range"')) {
|
|
760
276
|
return;
|
|
761
277
|
}
|
|
762
|
-
let [{ scrollHeight, clientHeight }] = scrollParents(e.target);
|
|
278
|
+
let [{ scrollHeight, clientHeight }] = util.scrollParents(e.target);
|
|
763
279
|
if (clientHeight >= scrollHeight && e.cancelable) {
|
|
764
280
|
e.preventDefault();
|
|
765
281
|
}
|
|
@@ -771,15 +287,15 @@
|
|
|
771
287
|
}
|
|
772
288
|
prevented = true;
|
|
773
289
|
const { scrollingElement } = document;
|
|
774
|
-
css(scrollingElement, {
|
|
290
|
+
util.css(scrollingElement, {
|
|
775
291
|
overflowY: CSS.supports("overflow", "clip") ? "clip" : "hidden",
|
|
776
292
|
touchAction: "none",
|
|
777
|
-
paddingRight: width(window) - scrollingElement.clientWidth || ""
|
|
293
|
+
paddingRight: util.width(window) - scrollingElement.clientWidth || ""
|
|
778
294
|
});
|
|
779
295
|
return () => {
|
|
780
296
|
prevented = false;
|
|
781
297
|
off();
|
|
782
|
-
css(scrollingElement, { overflowY: "", touchAction: "", paddingRight: "" });
|
|
298
|
+
util.css(scrollingElement, { overflowY: "", touchAction: "", paddingRight: "" });
|
|
783
299
|
};
|
|
784
300
|
}
|
|
785
301
|
|