@thednp/shorty 1.0.2 → 1.0.3
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/README.md +4 -4
- package/dist/shorty.esm.js +33 -28
- package/dist/shorty.esm.min.js +2 -2
- package/dist/shorty.js +33 -28
- package/dist/shorty.min.js +2 -2
- package/package.json +1 -1
- package/src/boolean/supportPassive.js +1 -0
- package/src/get/getDocument.js +6 -2
- package/src/get/getDocumentBody.js +1 -1
- package/src/get/getDocumentElement.js +1 -1
- package/src/get/getDocumentHead.js +1 -1
- package/src/get/getWindow.js +3 -12
- package/src/index.js +2 -0
- package/src/is/isObject.js +8 -0
- package/src/misc/OriginalEvent.js +2 -1
- package/types/index.d.ts +1 -0
- package/types/module/shorty.ts +1 -0
- package/types/shorty.d.ts +19 -8
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# shorty
|
|
2
2
|
[](https://coveralls.io/github/thednp/shorty)
|
|
3
3
|
[](https://github.com/thednp/shorty/actions/workflows/ci.yml)
|
|
4
|
-
[](https://www.npmjs.com/package/shorty)
|
|
5
|
-
[](http://npm-stat.com/charts.html?package
|
|
6
|
-

|
|
7
|
-
](https://www.npmjs.com/package/@thednp/shorty)
|
|
5
|
+
[](http://npm-stat.com/charts.html?package=@thednp/shorty)
|
|
6
|
+
[](https://www.jsdelivr.com/package/npm/@thednp/shorty)
|
|
7
|
+

|
|
8
8
|

|
|
9
9
|
|
|
10
10
|
A small ES6+ library with various JavaScript tools, all ESLint valid and with TypeScript definitions, everything useful for creating light libraries or web components. If there is anything that is consistently repeating itself, **shorty** can help you save up to 50% of the code required, with little to no performance cost.
|
package/dist/shorty.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Shorty v1.0.
|
|
2
|
+
* Shorty v1.0.3 (https://github.com/thednp/shorty)
|
|
3
3
|
* Copyright 2019-2022 © dnp_theme
|
|
4
4
|
* Licensed under MIT (https://github.com/thednp/shorty/blob/master/LICENSE)
|
|
5
5
|
*/
|
|
@@ -917,6 +917,7 @@ const supportPassive = (() => {
|
|
|
917
917
|
return result;
|
|
918
918
|
},
|
|
919
919
|
});
|
|
920
|
+
/* istanbul ignore next */
|
|
920
921
|
one(document, DOMContentLoadedEvent, () => {}, opts);
|
|
921
922
|
} catch (e) {
|
|
922
923
|
// throw Error('Passive events are not supported');
|
|
@@ -1148,15 +1149,6 @@ const Data = {
|
|
|
1148
1149
|
*/
|
|
1149
1150
|
const getInstance = (target, component) => Data.get(target, component);
|
|
1150
1151
|
|
|
1151
|
-
/**
|
|
1152
|
-
* Checks if an object is a `Document`.
|
|
1153
|
-
* @see https://dom.spec.whatwg.org/#node
|
|
1154
|
-
*
|
|
1155
|
-
* @param {any} object the target object
|
|
1156
|
-
* @returns {boolean} the query result
|
|
1157
|
-
*/
|
|
1158
|
-
const isDocument = (object) => (object && object.nodeType === 9) || false;
|
|
1159
|
-
|
|
1160
1152
|
/**
|
|
1161
1153
|
* Checks if an object is a `Node`.
|
|
1162
1154
|
*
|
|
@@ -1175,16 +1167,29 @@ const isNode = (element) => (element && [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|
|
|
1175
1167
|
*/
|
|
1176
1168
|
const isWindow = (object) => (object && object.constructor.name === 'Window') || false;
|
|
1177
1169
|
|
|
1170
|
+
/**
|
|
1171
|
+
* Checks if an object is a `Document`.
|
|
1172
|
+
* @see https://dom.spec.whatwg.org/#node
|
|
1173
|
+
*
|
|
1174
|
+
* @param {any} object the target object
|
|
1175
|
+
* @returns {boolean} the query result
|
|
1176
|
+
*/
|
|
1177
|
+
const isDocument = (object) => (object && object.nodeType === 9) || false;
|
|
1178
|
+
|
|
1178
1179
|
/**
|
|
1179
1180
|
* Returns the `document` or the `#document` element.
|
|
1180
1181
|
* @see https://github.com/floating-ui/floating-ui
|
|
1181
|
-
* @param {(
|
|
1182
|
+
* @param {(Node | Window)=} node
|
|
1182
1183
|
* @returns {Document}
|
|
1183
1184
|
*/
|
|
1184
1185
|
function getDocument(node) {
|
|
1186
|
+
// node instanceof Document
|
|
1185
1187
|
if (isDocument(node)) return node;
|
|
1188
|
+
// node instanceof Node
|
|
1186
1189
|
if (isNode(node)) return node.ownerDocument;
|
|
1190
|
+
// node instanceof Window
|
|
1187
1191
|
if (isWindow(node)) return node.document;
|
|
1192
|
+
// node is undefined | NULL
|
|
1188
1193
|
return window.document;
|
|
1189
1194
|
}
|
|
1190
1195
|
|
|
@@ -1700,6 +1705,14 @@ function normalizeOptions(element, defaultOps, inputOps, ns) {
|
|
|
1700
1705
|
*/
|
|
1701
1706
|
const ObjectValues = (obj) => Object.values(obj);
|
|
1702
1707
|
|
|
1708
|
+
/**
|
|
1709
|
+
* Checks if an object is an `Object`.
|
|
1710
|
+
*
|
|
1711
|
+
* @param {any} obj the target object
|
|
1712
|
+
* @returns {boolean} the query result
|
|
1713
|
+
*/
|
|
1714
|
+
const isObject = (obj) => (typeof obj === 'object') || false;
|
|
1715
|
+
|
|
1703
1716
|
/**
|
|
1704
1717
|
* Returns a namespaced `CustomEvent` specific to each component.
|
|
1705
1718
|
* @param {string} EventType Event.type
|
|
@@ -1712,7 +1725,7 @@ function OriginalEvent(EventType, config) {
|
|
|
1712
1725
|
});
|
|
1713
1726
|
|
|
1714
1727
|
/* istanbul ignore else */
|
|
1715
|
-
if (config
|
|
1728
|
+
if (isObject(config)) {
|
|
1716
1729
|
ObjectAssign(OriginalCustomEvent, config);
|
|
1717
1730
|
}
|
|
1718
1731
|
return OriginalCustomEvent;
|
|
@@ -1874,7 +1887,7 @@ function getBoundingClientRect(element, includeScale) {
|
|
|
1874
1887
|
/**
|
|
1875
1888
|
* Returns the `document.body` or the `<body>` element.
|
|
1876
1889
|
*
|
|
1877
|
-
* @param {(
|
|
1890
|
+
* @param {(Node | Window)=} node
|
|
1878
1891
|
* @returns {HTMLBodyElement}
|
|
1879
1892
|
*/
|
|
1880
1893
|
function getDocumentBody(node) {
|
|
@@ -1884,7 +1897,7 @@ function getDocumentBody(node) {
|
|
|
1884
1897
|
/**
|
|
1885
1898
|
* Returns the `document.documentElement` or the `<html>` element.
|
|
1886
1899
|
*
|
|
1887
|
-
* @param {(
|
|
1900
|
+
* @param {(Node | Window)=} node
|
|
1888
1901
|
* @returns {HTMLHtmlElement}
|
|
1889
1902
|
*/
|
|
1890
1903
|
function getDocumentElement(node) {
|
|
@@ -1894,7 +1907,7 @@ function getDocumentElement(node) {
|
|
|
1894
1907
|
/**
|
|
1895
1908
|
* Returns the `document.head` or the `<head>` element.
|
|
1896
1909
|
*
|
|
1897
|
-
* @param {(
|
|
1910
|
+
* @param {(Node | Window)=} node
|
|
1898
1911
|
* @returns {HTMLHeadElement}
|
|
1899
1912
|
*/
|
|
1900
1913
|
function getDocumentHead(node) {
|
|
@@ -2036,20 +2049,11 @@ function getUID(element, key) {
|
|
|
2036
2049
|
*/
|
|
2037
2050
|
function getWindow(node) {
|
|
2038
2051
|
// node is undefined | NULL
|
|
2039
|
-
if (!node)
|
|
2040
|
-
return window;
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2052
|
+
if (!node) return window;
|
|
2043
2053
|
// node instanceof Document
|
|
2044
|
-
if (isDocument(node))
|
|
2045
|
-
return node.defaultView;
|
|
2046
|
-
}
|
|
2047
|
-
|
|
2054
|
+
if (isDocument(node)) return node.defaultView;
|
|
2048
2055
|
// node instanceof Node
|
|
2049
|
-
if (isNode(node))
|
|
2050
|
-
return node.ownerDocument.defaultView;
|
|
2051
|
-
}
|
|
2052
|
-
|
|
2056
|
+
if (isNode(node)) return node.ownerDocument.defaultView;
|
|
2053
2057
|
// node is instanceof Window
|
|
2054
2058
|
return node;
|
|
2055
2059
|
}
|
|
@@ -2359,7 +2363,7 @@ function matches(target, selector) {
|
|
|
2359
2363
|
return matchesFn.call(target, selector);
|
|
2360
2364
|
}
|
|
2361
2365
|
|
|
2362
|
-
var version = "1.0.
|
|
2366
|
+
var version = "1.0.3";
|
|
2363
2367
|
|
|
2364
2368
|
/**
|
|
2365
2369
|
* A global namespace for library version.
|
|
@@ -2547,6 +2551,7 @@ const SHORTY = {
|
|
|
2547
2551
|
isDocument,
|
|
2548
2552
|
isElementsArray,
|
|
2549
2553
|
isFunction,
|
|
2554
|
+
isObject,
|
|
2550
2555
|
isWindow,
|
|
2551
2556
|
isMedia,
|
|
2552
2557
|
isRTL,
|
package/dist/shorty.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// Shorty v1.0.
|
|
2
|
-
const e={DOMContentLoaded:"DOMContentLoaded",DOMMouseScroll:"DOMMouseScroll",abort:"abort",beforeunload:"beforeunload",blur:"blur",change:"change",click:"click",contextmenu:"contextmenu",dblclick:"dblclick",error:"error",focus:"focus",focusin:"focusin",focusout:"focusout",gesturechange:"gesturechange",gestureend:"gestureend",gesturestart:"gesturestart",hover:"hover",keydown:"keydown",keypress:"keypress",keyup:"keyup",load:"load",mousedown:"mousedown",mousemove:"mousemove",mousein:"mousein",mouseout:"mouseout",mouseenter:"mouseenter",mouseleave:"mouseleave",mouseover:"mouseover",mouseup:"mouseup",mousewheel:"mousewheel",move:"move",orientationchange:"orientationchange",pointercancel:"pointercancel",pointerdown:"pointerdown",pointerleave:"pointerleave",pointermove:"pointermove",pointerup:"pointerup",readystatechange:"readystatechange",reset:"reset",resize:"resize",scroll:"scroll",select:"select",selectend:"selectend",selectstart:"selectstart",submit:"submit",touchcancel:"touchcancel",touchend:"touchend",touchmove:"touchmove",touchstart:"touchstart",unload:"unload"},t="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],{head:n}=document,o="webkitAnimation"in n.style?"webkitAnimationDuration":"animationDuration",i="webkitAnimation"in n.style?"webkitAnimationDelay":"animationDelay",r="webkitAnimation"in n.style?"webkitAnimationName":"animationName",a="webkitAnimation"in n.style?"webkitAnimationEnd":"animationend",s="webkitTransition"in n.style?"webkitTransitionDuration":"transitionDuration",c="webkitTransition"in n.style?"webkitTransitionDelay":"transitionDelay",u="webkitTransition"in n.style?"webkitTransitionEnd":"transitionend",l="webkitTransition"in n.style?"webkitTransitionProperty":"transitionProperty",{userAgentData:m}=navigator,d=m,{userAgent:g}=navigator,p=g,y=/iPhone|iPad|iPod|Android/i;let b=!1;b=d?d.brands.some(e=>y.test(e.brand)):y.test(p);const v=b,f=/(iPhone|iPod|iPad)/,E=d?d.brands.some(e=>f.test(e.brand)):f.test(p),h=!!p&&p.includes("Firefox"),w="webkitPerspective"in n.style||"perspective"in n.style;function k(e,t,n,o){const i=o||!1;e.addEventListener(t,n,i)}function A(e,t,n,o){const i=o||!1;e.removeEventListener(t,n,i)}function L(e,t,n,o){const i=r=>{r.target===e&&(n.apply(e,[r]),A(e,t,i,o))};k(e,t,i,o)}const D=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,e)});L(document,"DOMContentLoaded",()=>{},t)}catch(e){}return e})(),N="webkitTransform"in n.style||"transform"in n.style,T="ontouchstart"in window||"msMaxTouchPoints"in navigator,S="webkitAnimation"in n.style||"animation"in n.style,M="webkitTransition"in n.style||"transition"in n.style,C=(e,t)=>e.getAttribute(t),O=(e,t,n)=>e.setAttribute(t,n);const z=e=>e&&1===e.nodeType||!1,I=new Map,x={set:(e,t,n)=>{if(!z(e))return;I.has(t)||I.set(t,new Map);I.get(t).set(e,n)},getAllFor:e=>I.get(e)||null,get:(e,t)=>{if(!z(e)||!t)return null;const n=x.getAllFor(t);return e&&n&&n.get(e)||null},remove:(e,t)=>{const n=I.get(t);n&&z(e)&&(n.delete(e),0===n.size&&I.delete(t))}},P=e=>e&&9===e.nodeType||!1,F=e=>e&&[1,2,3,4,5,6,7,8,9,10,11].some(t=>+e.nodeType===t)||!1,H=e=>e&&"Window"===e.constructor.name||!1;function B(e){return P(e)?e:F(e)?e.ownerDocument:H(e)?e.document:window.document}const V=(e,t)=>Object.assign(e,t);const R=e=>Object.entries(e);const j=(e,t)=>e.dispatchEvent(t);function W(e,t){const n=getComputedStyle(e);return t.includes("--")?n.getPropertyValue(t):n[t]}function Q(e){const t=W(e,"animationName"),n=W(e,"animationDelay"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function U(e){const t=W(e,"animationName"),n=W(e,"animationDuration"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function q(e){const t=W(e,r),n=W(e,i),o=n.includes("ms")?1:1e3,a=S&&t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(a)?0:a}function G(e){const t=W(e,r),n=W(e,o),i=n.includes("ms")?1:1e3,a=S&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(a)?0:a}function K(e){const t=W(e,"transitionProperty"),n=W(e,"transitionDelay"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function X(e){const t=W(e,"transitionProperty"),n=W(e,"transitionDuration"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function Y(e){const t=W(e,l),n=W(e,c),o=n.includes("ms")?1:1e3,i=M&&t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function Z(e){const t=W(e,l),n=W(e,s),o=n.includes("ms")?1:1e3,i=M&&t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function J(e){return!!["true",!0].includes(e)||!["false",!1].includes(e)&&(""===e||"null"===e?null:""===e||Number.isNaN(+e)?e:+e)}const $=e=>Object.keys(e),_=e=>e.toLowerCase();const ee=!!D&&{passive:!0},te=new Map,ne={set:(e,t,n,o)=>{if(z(e))if(o&&o.length){te.has(e)||te.set(e,new Map);te.get(e).set(o,setTimeout(t,n))}else te.set(e,setTimeout(t,n))},get:(e,t)=>{if(!z(e))return null;const n=te.get(e);return t&&t.length&&n&&n.get?n.get(t)||null:n||null},clear:(e,t)=>{if(z(e))if(t&&t.length){const n=te.get(e);n&&n.get&&(clearTimeout(n.get(t)),n.delete(t),0===n.size&&te.delete(e))}else clearTimeout(te.get(e)),te.delete(e)}};function oe(e,t){const{width:n,height:o,top:i,right:r,bottom:a,left:s}=e.getBoundingClientRect();let c=1,u=1;if(t&&z(e)){const{offsetWidth:t,offsetHeight:i}=e;c=t>0?Math.round(n)/t:1,u=i>0?Math.round(o)/i:1}return{width:n/c,height:o/u,top:i/u,right:r/c,bottom:a/u,left:s/c,x:s/c,y:i/u}}function ie(e){return B(e).documentElement}const re=e=>e&&"ShadowRoot"===e.constructor.name||!1;function ae(e){if(!e||!z(e))return!1;const{width:t,height:n}=oe(e),{offsetWidth:o,offsetHeight:i}=e;return Math.round(t)!==o||Math.round(n)!==i}let se=0,ce=0;const ue=new Map;function le(e){return e?P(e)?e.defaultView:F(e)?e.ownerDocument.defaultView:e:window}const me=e=>e&&!!e.shadowRoot||!1;function de(e,t){return(F(t)?t:B()).getElementsByTagName(e)}const ge=Element.prototype,pe=ge.matches||ge.matchesSelector||ge.webkitMatchesSelector||ge.mozMatchesSelector||ge.msMatchesSelector||ge.oMatchesSelector||function(){return!1};const ye={ariaChecked:"aria-checked",ariaDescription:"aria-description",ariaDescribedBy:"aria-describedby",ariaExpanded:"aria-expanded",ariaHidden:"aria-hidden",ariaHasPopup:"aria-haspopup",ariaLabel:"aria-label",ariaLabelledBy:"aria-labelledby",ariaModal:"aria-modal",ariaPressed:"aria-pressed",ariaSelected:"aria-selected",ariaValueMin:"aria-valuemin",ariaValueMax:"aria-valuemax",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",nativeEvents:e,abortEvent:"abort",blurEvent:"blur",moveEvent:"move",changeEvent:"change",errorEvent:"error",resetEvent:"reset",resizeEvent:"resize",scrollEvent:"scroll",submitEvent:"submit",loadEvent:"load",loadstartEvent:"loadstart",unloadEvent:"unload",readystatechangeEvent:"readystatechange",beforeunloadEvent:"beforeunload",orientationchangeEvent:"orientationchange",contextmenuEvent:"contextmenu",DOMContentLoadedEvent:"DOMContentLoaded",DOMMouseScrollEvent:"DOMMouseScroll",selectEvent:"select",selectendEvent:"selectend",selectstartEvent:"selectstart",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedblclickEvent:"dblclick",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mousehoverEvent:"hover",mouseHoverEvents:t,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",mouseinEvent:"mousein",mouseoutEvent:"mouseout",mouseoverEvent:"mouseover",mousemoveEvent:"mousemove",mousewheelEvent:"mousewheel",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",pointercancelEvent:"pointercancel",pointerdownEvent:"pointerdown",pointerleaveEvent:"pointerleave",pointermoveEvent:"pointermove",pointerupEvent:"pointerup",focusEvents:{in:"focusin",out:"focusout"},focusEvent:"focus",focusinEvent:"focusin",focusoutEvent:"focusout",gesturechangeEvent:"gesturechange",gestureendEvent:"gestureend",gesturestartEvent:"gesturestart",bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:"animationDuration",animationDurationLegacy:o,animationDelay:"animationDelay",animationDelayLegacy:i,animationName:"animationName",animationNameLegacy:r,animationEndEvent:"animationend",animationEndEventLegacy:a,transitionDuration:"transitionDuration",transitionDurationLegacy:s,transitionDelay:"transitionDelay",transitionDelayLegacy:c,transitionEndEvent:"transitionend",transitionEndEventLegacy:u,transitionProperty:"transitionProperty",transitionPropertyLegacy:l,isMobile:v,isApple:E,isFirefox:h,support3DTransform:w,supportPassive:D,supportTransform:N,supportTouch:T,supportAnimation:S,supportTransition:M,addEventListener:"addEventListener",removeEventListener:"removeEventListener",keyboardEventKeys:{Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},keydownEvent:"keydown",keypressEvent:"keypress",keyupEvent:"keyup",keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyEscape:"Escape",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",offsetHeight:"offsetHeight",offsetWidth:"offsetWidth",scrollHeight:"scrollHeight",scrollWidth:"scrollWidth",userAgentData:d,userAgent:p,addClass:function(e,t){e.classList.add(t)},removeClass:function(e,t){e.classList.remove(t)},hasClass:function(e,t){return e.classList.contains(t)},on:k,off:A,one:L,dispatchEvent:j,distinct:(e,t,n)=>n.indexOf(e)===t,Data:x,getInstance:(e,t)=>x.get(e,t),createElement:function e(t){if(!t)return null;if("string"==typeof t)return B().createElement(t);const{tagName:n}=t,o={...t},i=e(n);return delete o.tagName,V(i,o),i},createElementNS:function e(t,n){if(!t&&!n)return null;if("string"==typeof n)return B().createElementNS(t,n);const{tagName:o}=n,i={...n},r=e(t,o);return delete i.tagName,R(i).forEach(([e,t])=>{O(r,e,t)}),r},toUpperCase:e=>e.toUpperCase(),toLowerCase:_,Timer:ne,emulateAnimationEnd:function(e,t){let n=0;const o=new Event("animationend"),i=U(e),r=Q(e);if(i){const a=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener("animationend",a),n=1)};e.addEventListener("animationend",a),setTimeout(()=>{n||j(e,o)},i+r+17)}else t.apply(e,[o])},emulateAnimationEndLegacy:function(e,t){let n=0;const o=new Event(a),i=G(e),r=q(e);if(S&&i){const s=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener(a,s),n=1)};e.addEventListener(a,s),setTimeout(()=>{n||j(e,o)},i+r+17)}else t.apply(e,[o])},emulateTransitionEnd:function(e,t){let n=0;const o=new Event("transitionend"),i=X(e),r=K(e);if(i){const a=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener("transitionend",a),n=1)};e.addEventListener("transitionend",a),setTimeout(()=>{n||j(e,o)},i+r+17)}else t.apply(e,[o])},emulateTransitionEndLegacy:function(e,t){let n=0;const o=new Event(u),i=Z(e),r=Y(e);if(M&&i){const a=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener(u,a),n=1)};e.addEventListener(u,a),setTimeout(()=>{n||j(e,o)},i+r+17)}else t.apply(e,[o])},isElementInScrollRange:e=>{if(!e||!F(e))return!1;const{top:t,bottom:n}=oe(e),{clientHeight:o}=ie(e);return t<=o&&n>=0},isElementInViewport:e=>{if(!e||!F(e))return!1;const{clientWidth:t,clientHeight:n}=ie(e),{top:o,left:i,bottom:r,right:a}=oe(e,!0);return o>=0&&i>=0&&r<=n&&a<=t},passiveHandler:{passive:!0},passiveHandlerLegacy:ee,getElementAnimationDuration:U,getElementAnimationDurationLegacy:G,getElementAnimationDelay:Q,getElementAnimationDelayLegacy:q,getElementTransitionDuration:X,getElementTransitionDurationLegacy:Z,getElementTransitionDelay:K,getElementTransitionDelayLegacy:Y,getNodeScroll:function(e){const t="scrollX"in e;return{x:t?e.scrollX:e.scrollLeft,y:t?e.scrollY:e.scrollTop}},getParentNode:function(e){return"HTML"===e.nodeName?e:e.assignedSlot||e.parentNode||re(e)&&e.host||ie(e)},getRectRelativeToOffsetParent:function(e,t,n){const o=z(t),i=oe(e,o&&ae(t)),r={x:0,y:0};if(o){const e=oe(t,!0);r.x=e.x+t.clientLeft,r.y=e.y+t.clientTop}return{x:i.left+n.x-r.x,y:i.top+n.y-r.y,width:i.width,height:i.height}},getWindow:le,isArray:e=>Array.isArray(e),isString:e=>"string"==typeof e,isCustomElement:me,isElement:e=>e&&[1,2,3,4,5,6,7,8].some(t=>e.nodeType===t)||!1,isNode:F,isNumber:e=>"number"==typeof e,isHTMLElement:z,isHTMLImageElement:e=>e&&"IMG"===e.tagName||!1,isSVGElement:e=>e&&e instanceof le(e).SVGElement||!1,isNodeList:e=>e&&"NodeList"===e.constructor.name||!1,isHTMLCollection:e=>e&&"HTMLCollection"===e.constructor.name||!1,isScaledElement:ae,isTableElement:e=>e&&["TABLE","TD","TH"].includes(e.tagName)||!1,isShadowRoot:re,isDocument:P,isElementsArray:e=>Array.isArray(e)&&e.every(z),isFunction:e=>e&&"Function"===e.constructor.name||!1,isWindow:H,isMedia:e=>e&&1===e.nodeType&&["SVG","Image","Video"].some(t=>e.constructor.name.includes(t))||!1,isRTL:e=>"rtl"===ie(e).dir,closest:function e(t,n){return t?t.closest(n)||e(t.getRootNode().host,n):null},querySelector:function(e,t){return F(e)?e:(F(t)?t:B()).querySelector(e)},getCustomElements:function(e){return[...de("*",e)].filter(me)},getElementById:function(e,t){return B(t).getElementById(e)},querySelectorAll:function(e,t){return(F(t)?t:B()).querySelectorAll(e)},getElementsByClassName:function(e,t){return(F(t)?t:B()).getElementsByClassName(e)},getElementsByTagName:de,matches:function(e,t){return e.matches(t)},matchesLegacy:function(e,t){return pe.call(e,t)},normalizeValue:J,normalizeOptions:function(e,t,n,o){const i={...e.dataset},r={},a={};return $(i).forEach(e=>{const t=o&&e.includes(o)?e.replace(o,"").replace(/[A-Z]/,e=>_(e)):e;a[t]=J(i[e])}),$(n).forEach(e=>{n[e]=J(n[e])}),$(t).forEach(o=>{r[o]=o in n?n[o]:o in a?a[o]:"title"===o?C(e,"title"):t[o]}),r},reflow:e=>e.offsetHeight,noop:()=>{},focus:e=>e.focus(),getUID:function e(t,n){let o=n?se:ce;if(n){const i=e(t),r=ue.get(i)||new Map;ue.has(i)||ue.set(i,r),r.has(n)?o=r.get(n):(r.set(n,o),se+=1)}else{const e=t.id||t;ue.has(e)?o=ue.get(e):(ue.set(e,o),ce+=1)}return o},ArrayFrom:e=>Array.from(e),Float32ArrayFrom:e=>Float32Array.from(Array.from(e)),Float64ArrayFrom:e=>Float64Array.from(Array.from(e)),ObjectAssign:V,ObjectEntries:R,ObjectKeys:$,ObjectValues:e=>Object.values(e),OriginalEvent:function(e,t){const n=new CustomEvent(e,{cancelable:!0,bubbles:!0});return t instanceof Object&&V(n,t),n},getBoundingClientRect:oe,getDocument:B,getDocumentBody:function(e){return B(e).body},getDocumentElement:ie,getDocumentHead:function(e){return B(e).head},getElementStyle:W,setElementStyle:(e,t)=>{R(t).forEach(([t,n])=>{if(t.includes("--"))e.style.setProperty(t,n);else{const o={};o[t]=n,V(e.style,o)}})},hasAttribute:(e,t)=>e.hasAttribute(t),hasAttributeNS:(e,t,n)=>t.hasAttributeNS(e,n),getAttribute:C,getAttributeNS:(e,t,n)=>t.getAttributeNS(e,n),setAttribute:O,setAttributeNS:(e,t,n,o)=>t.setAttributeNS(e,n,o),removeAttribute:(e,t)=>e.removeAttribute(t),removeAttributeNS:(e,t,n)=>t.removeAttributeNS(e,n),Version:"1.0.2"};export{ye as default};
|
|
1
|
+
// Shorty v1.0.3 | dnp_theme © 2022 | MIT-License
|
|
2
|
+
const e={DOMContentLoaded:"DOMContentLoaded",DOMMouseScroll:"DOMMouseScroll",abort:"abort",beforeunload:"beforeunload",blur:"blur",change:"change",click:"click",contextmenu:"contextmenu",dblclick:"dblclick",error:"error",focus:"focus",focusin:"focusin",focusout:"focusout",gesturechange:"gesturechange",gestureend:"gestureend",gesturestart:"gesturestart",hover:"hover",keydown:"keydown",keypress:"keypress",keyup:"keyup",load:"load",mousedown:"mousedown",mousemove:"mousemove",mousein:"mousein",mouseout:"mouseout",mouseenter:"mouseenter",mouseleave:"mouseleave",mouseover:"mouseover",mouseup:"mouseup",mousewheel:"mousewheel",move:"move",orientationchange:"orientationchange",pointercancel:"pointercancel",pointerdown:"pointerdown",pointerleave:"pointerleave",pointermove:"pointermove",pointerup:"pointerup",readystatechange:"readystatechange",reset:"reset",resize:"resize",scroll:"scroll",select:"select",selectend:"selectend",selectstart:"selectstart",submit:"submit",touchcancel:"touchcancel",touchend:"touchend",touchmove:"touchmove",touchstart:"touchstart",unload:"unload"},t="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],{head:n}=document,o="webkitAnimation"in n.style?"webkitAnimationDuration":"animationDuration",i="webkitAnimation"in n.style?"webkitAnimationDelay":"animationDelay",r="webkitAnimation"in n.style?"webkitAnimationName":"animationName",a="webkitAnimation"in n.style?"webkitAnimationEnd":"animationend",s="webkitTransition"in n.style?"webkitTransitionDuration":"transitionDuration",c="webkitTransition"in n.style?"webkitTransitionDelay":"transitionDelay",u="webkitTransition"in n.style?"webkitTransitionEnd":"transitionend",l="webkitTransition"in n.style?"webkitTransitionProperty":"transitionProperty",{userAgentData:m}=navigator,d=m,{userAgent:g}=navigator,p=g,y=/iPhone|iPad|iPod|Android/i;let b=!1;b=d?d.brands.some(e=>y.test(e.brand)):y.test(p);const v=b,f=/(iPhone|iPod|iPad)/,E=d?d.brands.some(e=>f.test(e.brand)):f.test(p),h=!!p&&p.includes("Firefox"),w="webkitPerspective"in n.style||"perspective"in n.style;function k(e,t,n,o){const i=o||!1;e.addEventListener(t,n,i)}function A(e,t,n,o){const i=o||!1;e.removeEventListener(t,n,i)}function L(e,t,n,o){const i=r=>{r.target===e&&(n.apply(e,[r]),A(e,t,i,o))};k(e,t,i,o)}const D=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,e)});L(document,"DOMContentLoaded",()=>{},t)}catch(e){}return e})(),N="webkitTransform"in n.style||"transform"in n.style,T="ontouchstart"in window||"msMaxTouchPoints"in navigator,S="webkitAnimation"in n.style||"animation"in n.style,M="webkitTransition"in n.style||"transition"in n.style,C=(e,t)=>e.getAttribute(t),O=(e,t,n)=>e.setAttribute(t,n);const z=e=>e&&1===e.nodeType||!1,I=new Map,x={set:(e,t,n)=>{if(!z(e))return;I.has(t)||I.set(t,new Map);I.get(t).set(e,n)},getAllFor:e=>I.get(e)||null,get:(e,t)=>{if(!z(e)||!t)return null;const n=x.getAllFor(t);return e&&n&&n.get(e)||null},remove:(e,t)=>{const n=I.get(t);n&&z(e)&&(n.delete(e),0===n.size&&I.delete(t))}},P=e=>e&&[1,2,3,4,5,6,7,8,9,10,11].some(t=>+e.nodeType===t)||!1,F=e=>e&&"Window"===e.constructor.name||!1,H=e=>e&&9===e.nodeType||!1;function B(e){return H(e)?e:P(e)?e.ownerDocument:F(e)?e.document:window.document}const V=(e,t)=>Object.assign(e,t);const R=e=>Object.entries(e);const j=(e,t)=>e.dispatchEvent(t);function W(e,t){const n=getComputedStyle(e);return t.includes("--")?n.getPropertyValue(t):n[t]}function Q(e){const t=W(e,"animationName"),n=W(e,"animationDelay"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function U(e){const t=W(e,"animationName"),n=W(e,"animationDuration"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function q(e){const t=W(e,r),n=W(e,i),o=n.includes("ms")?1:1e3,a=S&&t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(a)?0:a}function G(e){const t=W(e,r),n=W(e,o),i=n.includes("ms")?1:1e3,a=S&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(a)?0:a}function K(e){const t=W(e,"transitionProperty"),n=W(e,"transitionDelay"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function X(e){const t=W(e,"transitionProperty"),n=W(e,"transitionDuration"),o=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function Y(e){const t=W(e,l),n=W(e,c),o=n.includes("ms")?1:1e3,i=M&&t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function Z(e){const t=W(e,l),n=W(e,s),o=n.includes("ms")?1:1e3,i=M&&t&&"none"!==t?parseFloat(n)*o:0;return Number.isNaN(i)?0:i}function J(e){return!!["true",!0].includes(e)||!["false",!1].includes(e)&&(""===e||"null"===e?null:""===e||Number.isNaN(+e)?e:+e)}const $=e=>Object.keys(e),_=e=>e.toLowerCase();const ee=e=>"object"==typeof e||!1;const te=!!D&&{passive:!0},ne=new Map,oe={set:(e,t,n,o)=>{if(z(e))if(o&&o.length){ne.has(e)||ne.set(e,new Map);ne.get(e).set(o,setTimeout(t,n))}else ne.set(e,setTimeout(t,n))},get:(e,t)=>{if(!z(e))return null;const n=ne.get(e);return t&&t.length&&n&&n.get?n.get(t)||null:n||null},clear:(e,t)=>{if(z(e))if(t&&t.length){const n=ne.get(e);n&&n.get&&(clearTimeout(n.get(t)),n.delete(t),0===n.size&&ne.delete(e))}else clearTimeout(ne.get(e)),ne.delete(e)}};function ie(e,t){const{width:n,height:o,top:i,right:r,bottom:a,left:s}=e.getBoundingClientRect();let c=1,u=1;if(t&&z(e)){const{offsetWidth:t,offsetHeight:i}=e;c=t>0?Math.round(n)/t:1,u=i>0?Math.round(o)/i:1}return{width:n/c,height:o/u,top:i/u,right:r/c,bottom:a/u,left:s/c,x:s/c,y:i/u}}function re(e){return B(e).documentElement}const ae=e=>e&&"ShadowRoot"===e.constructor.name||!1;function se(e){if(!e||!z(e))return!1;const{width:t,height:n}=ie(e),{offsetWidth:o,offsetHeight:i}=e;return Math.round(t)!==o||Math.round(n)!==i}let ce=0,ue=0;const le=new Map;function me(e){return e?H(e)?e.defaultView:P(e)?e.ownerDocument.defaultView:e:window}const de=e=>e&&!!e.shadowRoot||!1;function ge(e,t){return(P(t)?t:B()).getElementsByTagName(e)}const pe=Element.prototype,ye=pe.matches||pe.matchesSelector||pe.webkitMatchesSelector||pe.mozMatchesSelector||pe.msMatchesSelector||pe.oMatchesSelector||function(){return!1};const be={ariaChecked:"aria-checked",ariaDescription:"aria-description",ariaDescribedBy:"aria-describedby",ariaExpanded:"aria-expanded",ariaHidden:"aria-hidden",ariaHasPopup:"aria-haspopup",ariaLabel:"aria-label",ariaLabelledBy:"aria-labelledby",ariaModal:"aria-modal",ariaPressed:"aria-pressed",ariaSelected:"aria-selected",ariaValueMin:"aria-valuemin",ariaValueMax:"aria-valuemax",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",nativeEvents:e,abortEvent:"abort",blurEvent:"blur",moveEvent:"move",changeEvent:"change",errorEvent:"error",resetEvent:"reset",resizeEvent:"resize",scrollEvent:"scroll",submitEvent:"submit",loadEvent:"load",loadstartEvent:"loadstart",unloadEvent:"unload",readystatechangeEvent:"readystatechange",beforeunloadEvent:"beforeunload",orientationchangeEvent:"orientationchange",contextmenuEvent:"contextmenu",DOMContentLoadedEvent:"DOMContentLoaded",DOMMouseScrollEvent:"DOMMouseScroll",selectEvent:"select",selectendEvent:"selectend",selectstartEvent:"selectstart",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedblclickEvent:"dblclick",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mousehoverEvent:"hover",mouseHoverEvents:t,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",mouseinEvent:"mousein",mouseoutEvent:"mouseout",mouseoverEvent:"mouseover",mousemoveEvent:"mousemove",mousewheelEvent:"mousewheel",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",pointercancelEvent:"pointercancel",pointerdownEvent:"pointerdown",pointerleaveEvent:"pointerleave",pointermoveEvent:"pointermove",pointerupEvent:"pointerup",focusEvents:{in:"focusin",out:"focusout"},focusEvent:"focus",focusinEvent:"focusin",focusoutEvent:"focusout",gesturechangeEvent:"gesturechange",gestureendEvent:"gestureend",gesturestartEvent:"gesturestart",bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:"animationDuration",animationDurationLegacy:o,animationDelay:"animationDelay",animationDelayLegacy:i,animationName:"animationName",animationNameLegacy:r,animationEndEvent:"animationend",animationEndEventLegacy:a,transitionDuration:"transitionDuration",transitionDurationLegacy:s,transitionDelay:"transitionDelay",transitionDelayLegacy:c,transitionEndEvent:"transitionend",transitionEndEventLegacy:u,transitionProperty:"transitionProperty",transitionPropertyLegacy:l,isMobile:v,isApple:E,isFirefox:h,support3DTransform:w,supportPassive:D,supportTransform:N,supportTouch:T,supportAnimation:S,supportTransition:M,addEventListener:"addEventListener",removeEventListener:"removeEventListener",keyboardEventKeys:{Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},keydownEvent:"keydown",keypressEvent:"keypress",keyupEvent:"keyup",keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyEscape:"Escape",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",offsetHeight:"offsetHeight",offsetWidth:"offsetWidth",scrollHeight:"scrollHeight",scrollWidth:"scrollWidth",userAgentData:d,userAgent:p,addClass:function(e,t){e.classList.add(t)},removeClass:function(e,t){e.classList.remove(t)},hasClass:function(e,t){return e.classList.contains(t)},on:k,off:A,one:L,dispatchEvent:j,distinct:(e,t,n)=>n.indexOf(e)===t,Data:x,getInstance:(e,t)=>x.get(e,t),createElement:function e(t){if(!t)return null;if("string"==typeof t)return B().createElement(t);const{tagName:n}=t,o={...t},i=e(n);return delete o.tagName,V(i,o),i},createElementNS:function e(t,n){if(!t&&!n)return null;if("string"==typeof n)return B().createElementNS(t,n);const{tagName:o}=n,i={...n},r=e(t,o);return delete i.tagName,R(i).forEach(([e,t])=>{O(r,e,t)}),r},toUpperCase:e=>e.toUpperCase(),toLowerCase:_,Timer:oe,emulateAnimationEnd:function(e,t){let n=0;const o=new Event("animationend"),i=U(e),r=Q(e);if(i){const a=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener("animationend",a),n=1)};e.addEventListener("animationend",a),setTimeout(()=>{n||j(e,o)},i+r+17)}else t.apply(e,[o])},emulateAnimationEndLegacy:function(e,t){let n=0;const o=new Event(a),i=G(e),r=q(e);if(S&&i){const s=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener(a,s),n=1)};e.addEventListener(a,s),setTimeout(()=>{n||j(e,o)},i+r+17)}else t.apply(e,[o])},emulateTransitionEnd:function(e,t){let n=0;const o=new Event("transitionend"),i=X(e),r=K(e);if(i){const a=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener("transitionend",a),n=1)};e.addEventListener("transitionend",a),setTimeout(()=>{n||j(e,o)},i+r+17)}else t.apply(e,[o])},emulateTransitionEndLegacy:function(e,t){let n=0;const o=new Event(u),i=Z(e),r=Y(e);if(M&&i){const a=o=>{o.target===e&&(t.apply(e,[o]),e.removeEventListener(u,a),n=1)};e.addEventListener(u,a),setTimeout(()=>{n||j(e,o)},i+r+17)}else t.apply(e,[o])},isElementInScrollRange:e=>{if(!e||!P(e))return!1;const{top:t,bottom:n}=ie(e),{clientHeight:o}=re(e);return t<=o&&n>=0},isElementInViewport:e=>{if(!e||!P(e))return!1;const{clientWidth:t,clientHeight:n}=re(e),{top:o,left:i,bottom:r,right:a}=ie(e,!0);return o>=0&&i>=0&&r<=n&&a<=t},passiveHandler:{passive:!0},passiveHandlerLegacy:te,getElementAnimationDuration:U,getElementAnimationDurationLegacy:G,getElementAnimationDelay:Q,getElementAnimationDelayLegacy:q,getElementTransitionDuration:X,getElementTransitionDurationLegacy:Z,getElementTransitionDelay:K,getElementTransitionDelayLegacy:Y,getNodeScroll:function(e){const t="scrollX"in e;return{x:t?e.scrollX:e.scrollLeft,y:t?e.scrollY:e.scrollTop}},getParentNode:function(e){return"HTML"===e.nodeName?e:e.assignedSlot||e.parentNode||ae(e)&&e.host||re(e)},getRectRelativeToOffsetParent:function(e,t,n){const o=z(t),i=ie(e,o&&se(t)),r={x:0,y:0};if(o){const e=ie(t,!0);r.x=e.x+t.clientLeft,r.y=e.y+t.clientTop}return{x:i.left+n.x-r.x,y:i.top+n.y-r.y,width:i.width,height:i.height}},getWindow:me,isArray:e=>Array.isArray(e),isString:e=>"string"==typeof e,isCustomElement:de,isElement:e=>e&&[1,2,3,4,5,6,7,8].some(t=>e.nodeType===t)||!1,isNode:P,isNumber:e=>"number"==typeof e,isHTMLElement:z,isHTMLImageElement:e=>e&&"IMG"===e.tagName||!1,isSVGElement:e=>e&&e instanceof me(e).SVGElement||!1,isNodeList:e=>e&&"NodeList"===e.constructor.name||!1,isHTMLCollection:e=>e&&"HTMLCollection"===e.constructor.name||!1,isScaledElement:se,isTableElement:e=>e&&["TABLE","TD","TH"].includes(e.tagName)||!1,isShadowRoot:ae,isDocument:H,isElementsArray:e=>Array.isArray(e)&&e.every(z),isFunction:e=>e&&"Function"===e.constructor.name||!1,isObject:ee,isWindow:F,isMedia:e=>e&&1===e.nodeType&&["SVG","Image","Video"].some(t=>e.constructor.name.includes(t))||!1,isRTL:e=>"rtl"===re(e).dir,closest:function e(t,n){return t?t.closest(n)||e(t.getRootNode().host,n):null},querySelector:function(e,t){return P(e)?e:(P(t)?t:B()).querySelector(e)},getCustomElements:function(e){return[...ge("*",e)].filter(de)},getElementById:function(e,t){return B(t).getElementById(e)},querySelectorAll:function(e,t){return(P(t)?t:B()).querySelectorAll(e)},getElementsByClassName:function(e,t){return(P(t)?t:B()).getElementsByClassName(e)},getElementsByTagName:ge,matches:function(e,t){return e.matches(t)},matchesLegacy:function(e,t){return ye.call(e,t)},normalizeValue:J,normalizeOptions:function(e,t,n,o){const i={...e.dataset},r={},a={};return $(i).forEach(e=>{const t=o&&e.includes(o)?e.replace(o,"").replace(/[A-Z]/,e=>_(e)):e;a[t]=J(i[e])}),$(n).forEach(e=>{n[e]=J(n[e])}),$(t).forEach(o=>{r[o]=o in n?n[o]:o in a?a[o]:"title"===o?C(e,"title"):t[o]}),r},reflow:e=>e.offsetHeight,noop:()=>{},focus:e=>e.focus(),getUID:function e(t,n){let o=n?ce:ue;if(n){const i=e(t),r=le.get(i)||new Map;le.has(i)||le.set(i,r),r.has(n)?o=r.get(n):(r.set(n,o),ce+=1)}else{const e=t.id||t;le.has(e)?o=le.get(e):(le.set(e,o),ue+=1)}return o},ArrayFrom:e=>Array.from(e),Float32ArrayFrom:e=>Float32Array.from(Array.from(e)),Float64ArrayFrom:e=>Float64Array.from(Array.from(e)),ObjectAssign:V,ObjectEntries:R,ObjectKeys:$,ObjectValues:e=>Object.values(e),OriginalEvent:function(e,t){const n=new CustomEvent(e,{cancelable:!0,bubbles:!0});return ee(t)&&V(n,t),n},getBoundingClientRect:ie,getDocument:B,getDocumentBody:function(e){return B(e).body},getDocumentElement:re,getDocumentHead:function(e){return B(e).head},getElementStyle:W,setElementStyle:(e,t)=>{R(t).forEach(([t,n])=>{if(t.includes("--"))e.style.setProperty(t,n);else{const o={};o[t]=n,V(e.style,o)}})},hasAttribute:(e,t)=>e.hasAttribute(t),hasAttributeNS:(e,t,n)=>t.hasAttributeNS(e,n),getAttribute:C,getAttributeNS:(e,t,n)=>t.getAttributeNS(e,n),setAttribute:O,setAttributeNS:(e,t,n,o)=>t.setAttributeNS(e,n,o),removeAttribute:(e,t)=>e.removeAttribute(t),removeAttributeNS:(e,t,n)=>t.removeAttributeNS(e,n),Version:"1.0.3"};export{be as default};
|
package/dist/shorty.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Shorty v1.0.
|
|
2
|
+
* Shorty v1.0.3 (https://github.com/thednp/shorty)
|
|
3
3
|
* Copyright 2019-2022 © dnp_theme
|
|
4
4
|
* Licensed under MIT (https://github.com/thednp/shorty/blob/master/LICENSE)
|
|
5
5
|
*/
|
|
@@ -923,6 +923,7 @@
|
|
|
923
923
|
return result;
|
|
924
924
|
},
|
|
925
925
|
});
|
|
926
|
+
/* istanbul ignore next */
|
|
926
927
|
one(document, DOMContentLoadedEvent, function () {}, opts);
|
|
927
928
|
} catch (e) {
|
|
928
929
|
// throw Error('Passive events are not supported');
|
|
@@ -1154,15 +1155,6 @@
|
|
|
1154
1155
|
*/
|
|
1155
1156
|
var getInstance = function (target, component) { return Data.get(target, component); };
|
|
1156
1157
|
|
|
1157
|
-
/**
|
|
1158
|
-
* Checks if an object is a `Document`.
|
|
1159
|
-
* @see https://dom.spec.whatwg.org/#node
|
|
1160
|
-
*
|
|
1161
|
-
* @param {any} object the target object
|
|
1162
|
-
* @returns {boolean} the query result
|
|
1163
|
-
*/
|
|
1164
|
-
var isDocument = function (object) { return (object && object.nodeType === 9) || false; };
|
|
1165
|
-
|
|
1166
1158
|
/**
|
|
1167
1159
|
* Checks if an object is a `Node`.
|
|
1168
1160
|
*
|
|
@@ -1181,16 +1173,29 @@
|
|
|
1181
1173
|
*/
|
|
1182
1174
|
var isWindow = function (object) { return (object && object.constructor.name === 'Window') || false; };
|
|
1183
1175
|
|
|
1176
|
+
/**
|
|
1177
|
+
* Checks if an object is a `Document`.
|
|
1178
|
+
* @see https://dom.spec.whatwg.org/#node
|
|
1179
|
+
*
|
|
1180
|
+
* @param {any} object the target object
|
|
1181
|
+
* @returns {boolean} the query result
|
|
1182
|
+
*/
|
|
1183
|
+
var isDocument = function (object) { return (object && object.nodeType === 9) || false; };
|
|
1184
|
+
|
|
1184
1185
|
/**
|
|
1185
1186
|
* Returns the `document` or the `#document` element.
|
|
1186
1187
|
* @see https://github.com/floating-ui/floating-ui
|
|
1187
|
-
* @param {(
|
|
1188
|
+
* @param {(Node | Window)=} node
|
|
1188
1189
|
* @returns {Document}
|
|
1189
1190
|
*/
|
|
1190
1191
|
function getDocument(node) {
|
|
1192
|
+
// node instanceof Document
|
|
1191
1193
|
if (isDocument(node)) { return node; }
|
|
1194
|
+
// node instanceof Node
|
|
1192
1195
|
if (isNode(node)) { return node.ownerDocument; }
|
|
1196
|
+
// node instanceof Window
|
|
1193
1197
|
if (isWindow(node)) { return node.document; }
|
|
1198
|
+
// node is undefined | NULL
|
|
1194
1199
|
return window.document;
|
|
1195
1200
|
}
|
|
1196
1201
|
|
|
@@ -1709,6 +1714,14 @@
|
|
|
1709
1714
|
*/
|
|
1710
1715
|
var ObjectValues = function (obj) { return Object.values(obj); };
|
|
1711
1716
|
|
|
1717
|
+
/**
|
|
1718
|
+
* Checks if an object is an `Object`.
|
|
1719
|
+
*
|
|
1720
|
+
* @param {any} obj the target object
|
|
1721
|
+
* @returns {boolean} the query result
|
|
1722
|
+
*/
|
|
1723
|
+
var isObject = function (obj) { return (typeof obj === 'object') || false; };
|
|
1724
|
+
|
|
1712
1725
|
/**
|
|
1713
1726
|
* Returns a namespaced `CustomEvent` specific to each component.
|
|
1714
1727
|
* @param {string} EventType Event.type
|
|
@@ -1721,7 +1734,7 @@
|
|
|
1721
1734
|
});
|
|
1722
1735
|
|
|
1723
1736
|
/* istanbul ignore else */
|
|
1724
|
-
if (config
|
|
1737
|
+
if (isObject(config)) {
|
|
1725
1738
|
ObjectAssign(OriginalCustomEvent, config);
|
|
1726
1739
|
}
|
|
1727
1740
|
return OriginalCustomEvent;
|
|
@@ -1891,7 +1904,7 @@
|
|
|
1891
1904
|
/**
|
|
1892
1905
|
* Returns the `document.body` or the `<body>` element.
|
|
1893
1906
|
*
|
|
1894
|
-
* @param {(
|
|
1907
|
+
* @param {(Node | Window)=} node
|
|
1895
1908
|
* @returns {HTMLBodyElement}
|
|
1896
1909
|
*/
|
|
1897
1910
|
function getDocumentBody(node) {
|
|
@@ -1901,7 +1914,7 @@
|
|
|
1901
1914
|
/**
|
|
1902
1915
|
* Returns the `document.documentElement` or the `<html>` element.
|
|
1903
1916
|
*
|
|
1904
|
-
* @param {(
|
|
1917
|
+
* @param {(Node | Window)=} node
|
|
1905
1918
|
* @returns {HTMLHtmlElement}
|
|
1906
1919
|
*/
|
|
1907
1920
|
function getDocumentElement(node) {
|
|
@@ -1911,7 +1924,7 @@
|
|
|
1911
1924
|
/**
|
|
1912
1925
|
* Returns the `document.head` or the `<head>` element.
|
|
1913
1926
|
*
|
|
1914
|
-
* @param {(
|
|
1927
|
+
* @param {(Node | Window)=} node
|
|
1915
1928
|
* @returns {HTMLHeadElement}
|
|
1916
1929
|
*/
|
|
1917
1930
|
function getDocumentHead(node) {
|
|
@@ -2056,20 +2069,11 @@
|
|
|
2056
2069
|
*/
|
|
2057
2070
|
function getWindow(node) {
|
|
2058
2071
|
// node is undefined | NULL
|
|
2059
|
-
if (!node) {
|
|
2060
|
-
return window;
|
|
2061
|
-
}
|
|
2062
|
-
|
|
2072
|
+
if (!node) { return window; }
|
|
2063
2073
|
// node instanceof Document
|
|
2064
|
-
if (isDocument(node)) {
|
|
2065
|
-
return node.defaultView;
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2074
|
+
if (isDocument(node)) { return node.defaultView; }
|
|
2068
2075
|
// node instanceof Node
|
|
2069
|
-
if (isNode(node)) {
|
|
2070
|
-
return node.ownerDocument.defaultView;
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2076
|
+
if (isNode(node)) { return node.ownerDocument.defaultView; }
|
|
2073
2077
|
// node is instanceof Window
|
|
2074
2078
|
return node;
|
|
2075
2079
|
}
|
|
@@ -2386,7 +2390,7 @@
|
|
|
2386
2390
|
return matchesFn.call(target, selector);
|
|
2387
2391
|
}
|
|
2388
2392
|
|
|
2389
|
-
var version = "1.0.
|
|
2393
|
+
var version = "1.0.3";
|
|
2390
2394
|
|
|
2391
2395
|
/**
|
|
2392
2396
|
* A global namespace for library version.
|
|
@@ -2574,6 +2578,7 @@
|
|
|
2574
2578
|
isDocument: isDocument,
|
|
2575
2579
|
isElementsArray: isElementsArray,
|
|
2576
2580
|
isFunction: isFunction,
|
|
2581
|
+
isObject: isObject,
|
|
2577
2582
|
isWindow: isWindow,
|
|
2578
2583
|
isMedia: isMedia,
|
|
2579
2584
|
isRTL: isRTL,
|
package/dist/shorty.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// Shorty v1.0.
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SHORTY=t()}(this,(function(){"use strict";var e={DOMContentLoaded:"DOMContentLoaded",DOMMouseScroll:"DOMMouseScroll",abort:"abort",beforeunload:"beforeunload",blur:"blur",change:"change",click:"click",contextmenu:"contextmenu",dblclick:"dblclick",error:"error",focus:"focus",focusin:"focusin",focusout:"focusout",gesturechange:"gesturechange",gestureend:"gestureend",gesturestart:"gesturestart",hover:"hover",keydown:"keydown",keypress:"keypress",keyup:"keyup",load:"load",mousedown:"mousedown",mousemove:"mousemove",mousein:"mousein",mouseout:"mouseout",mouseenter:"mouseenter",mouseleave:"mouseleave",mouseover:"mouseover",mouseup:"mouseup",mousewheel:"mousewheel",move:"move",orientationchange:"orientationchange",pointercancel:"pointercancel",pointerdown:"pointerdown",pointerleave:"pointerleave",pointermove:"pointermove",pointerup:"pointerup",readystatechange:"readystatechange",reset:"reset",resize:"resize",scroll:"scroll",select:"select",selectend:"selectend",selectstart:"selectstart",submit:"submit",touchcancel:"touchcancel",touchend:"touchend",touchmove:"touchmove",touchstart:"touchstart",unload:"unload"},t="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],n=document.head,r="webkitAnimation"in n.style?"webkitAnimationDuration":"animationDuration",i="webkitAnimation"in n.style?"webkitAnimationDelay":"animationDelay",o="webkitAnimation"in n.style?"webkitAnimationName":"animationName",a="webkitAnimation"in n.style?"webkitAnimationEnd":"animationend",u="webkitTransition"in n.style?"webkitTransitionDuration":"transitionDuration",s="webkitTransition"in n.style?"webkitTransitionDelay":"transitionDelay",c="webkitTransition"in n.style?"webkitTransitionEnd":"transitionend",l="webkitTransition"in n.style?"webkitTransitionProperty":"transitionProperty",m=navigator.userAgentData,d=navigator.userAgent,f=/iPhone|iPad|iPod|Android/i,v=m?m.brands.some((function(e){return f.test(e.brand)})):f.test(d),g=/(iPhone|iPod|iPad)/,p=m?m.brands.some((function(e){return g.test(e.brand)})):g.test(d),b=!!d&&d.includes("Firefox"),y="webkitPerspective"in n.style||"perspective"in n.style;function E(e,t,n,r){var i=r||!1;e.addEventListener(t,n,i)}function h(e,t,n,r){var i=r||!1;e.removeEventListener(t,n,i)}function w(e,t,n,r){var i=function(o){o.target===e&&(n.apply(e,[o]),h(e,t,i,r))};E(e,t,i,r)}var k=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0}});w(document,"DOMContentLoaded",(function(){}),t)}catch(e){}return e}(),A="webkitTransform"in n.style||"transform"in n.style,L="ontouchstart"in window||"msMaxTouchPoints"in navigator,D="webkitAnimation"in n.style||"animation"in n.style,N="webkitTransition"in n.style||"transition"in n.style,T=function(e,t){return e.getAttribute(t)},S=function(e,t,n){return e.setAttribute(t,n)};var M=function(e){return e&&1===e.nodeType||!1},O=new Map,C={set:function(e,t,n){M(e)&&(O.has(t)||O.set(t,new Map),O.get(t).set(e,n))},getAllFor:function(e){return O.get(e)||null},get:function(e,t){if(!M(e)||!t)return null;var n=C.getAllFor(t);return e&&n&&n.get(e)||null},remove:function(e,t){var n=O.get(t);n&&M(e)&&(n.delete(e),0===n.size&&O.delete(t))}},z=function(e){return e&&9===e.nodeType||!1},x=function(e){return e&&[1,2,3,4,5,6,7,8,9,10,11].some((function(t){return+e.nodeType===t}))||!1},I=function(e){return e&&"Window"===e.constructor.name||!1};function P(e){return z(e)?e:x(e)?e.ownerDocument:I(e)?e.document:window.document}var H=function(e,t){return Object.assign(e,t)};var F=function(e){return Object.entries(e)};var B=function(e,t){return e.dispatchEvent(t)};function R(e,t){var n=getComputedStyle(e);return t.includes("--")?n.getPropertyValue(t):n[t]}function V(e){var t=R(e,"animationName"),n=R(e,"animationDelay"),r=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*r:0;return Number.isNaN(i)?0:i}function j(e){var t=R(e,"animationName"),n=R(e,"animationDuration"),r=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*r:0;return Number.isNaN(i)?0:i}function W(e){var t=R(e,o),n=R(e,i),r=n.includes("ms")?1:1e3,a=D&&t&&"none"!==t?parseFloat(n)*r:0;return Number.isNaN(a)?0:a}function Q(e){var t=R(e,o),n=R(e,r),i=n.includes("ms")?1:1e3,a=D&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(a)?0:a}function U(e){var t=R(e,"transitionProperty"),n=R(e,"transitionDelay"),r=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*r:0;return Number.isNaN(i)?0:i}function q(e){var t=R(e,"transitionProperty"),n=R(e,"transitionDuration"),r=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*r:0;return Number.isNaN(i)?0:i}function G(e){var t=R(e,l),n=R(e,s),r=n.includes("ms")?1:1e3,i=N&&t&&"none"!==t?parseFloat(n)*r:0;return Number.isNaN(i)?0:i}function K(e){var t=R(e,l),n=R(e,u),r=n.includes("ms")?1:1e3,i=N&&t&&"none"!==t?parseFloat(n)*r:0;return Number.isNaN(i)?0:i}function X(e){return!!["true",!0].includes(e)||!["false",!1].includes(e)&&(""===e||"null"===e?null:""===e||Number.isNaN(+e)?e:+e)}var Y=function(e){return Object.keys(e)},Z=function(e){return e.toLowerCase()};var J=!!k&&{passive:!0},$=new Map,_={set:function(e,t,n,r){M(e)&&(r&&r.length?($.has(e)||$.set(e,new Map),$.get(e).set(r,setTimeout(t,n))):$.set(e,setTimeout(t,n)))},get:function(e,t){if(!M(e))return null;var n=$.get(e);return t&&t.length&&n&&n.get?n.get(t)||null:n||null},clear:function(e,t){if(M(e))if(t&&t.length){var n=$.get(e);n&&n.get&&(clearTimeout(n.get(t)),n.delete(t),0===n.size&&$.delete(e))}else clearTimeout($.get(e)),$.delete(e)}};function ee(e,t){var n=e.getBoundingClientRect(),r=n.width,i=n.height,o=n.top,a=n.right,u=n.bottom,s=n.left,c=1,l=1;if(t&&M(e)){var m=e.offsetWidth,d=e.offsetHeight;c=m>0?Math.round(r)/m:1,l=d>0?Math.round(i)/d:1}return{width:r/c,height:i/l,top:o/l,right:a/c,bottom:u/l,left:s/c,x:s/c,y:o/l}}function te(e){return P(e).documentElement}var ne=function(e){return e&&"ShadowRoot"===e.constructor.name||!1};function re(e){if(!e||!M(e))return!1;var t=ee(e),n=t.width,r=t.height,i=e.offsetWidth,o=e.offsetHeight;return Math.round(n)!==i||Math.round(r)!==o}var ie=0,oe=0,ae=new Map;function ue(e){return e?z(e)?e.defaultView:x(e)?e.ownerDocument.defaultView:e:window}var se=function(e){return e&&!!e.shadowRoot||!1};function ce(e,t){return(x(t)?t:P()).getElementsByTagName(e)}var le=Element.prototype,me=le.matches||le.matchesSelector||le.webkitMatchesSelector||le.mozMatchesSelector||le.msMatchesSelector||le.oMatchesSelector||function(){return!1};return{ariaChecked:"aria-checked",ariaDescription:"aria-description",ariaDescribedBy:"aria-describedby",ariaExpanded:"aria-expanded",ariaHidden:"aria-hidden",ariaHasPopup:"aria-haspopup",ariaLabel:"aria-label",ariaLabelledBy:"aria-labelledby",ariaModal:"aria-modal",ariaPressed:"aria-pressed",ariaSelected:"aria-selected",ariaValueMin:"aria-valuemin",ariaValueMax:"aria-valuemax",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",nativeEvents:e,abortEvent:"abort",blurEvent:"blur",moveEvent:"move",changeEvent:"change",errorEvent:"error",resetEvent:"reset",resizeEvent:"resize",scrollEvent:"scroll",submitEvent:"submit",loadEvent:"load",loadstartEvent:"loadstart",unloadEvent:"unload",readystatechangeEvent:"readystatechange",beforeunloadEvent:"beforeunload",orientationchangeEvent:"orientationchange",contextmenuEvent:"contextmenu",DOMContentLoadedEvent:"DOMContentLoaded",DOMMouseScrollEvent:"DOMMouseScroll",selectEvent:"select",selectendEvent:"selectend",selectstartEvent:"selectstart",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedblclickEvent:"dblclick",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mousehoverEvent:"hover",mouseHoverEvents:t,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",mouseinEvent:"mousein",mouseoutEvent:"mouseout",mouseoverEvent:"mouseover",mousemoveEvent:"mousemove",mousewheelEvent:"mousewheel",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",pointercancelEvent:"pointercancel",pointerdownEvent:"pointerdown",pointerleaveEvent:"pointerleave",pointermoveEvent:"pointermove",pointerupEvent:"pointerup",focusEvents:{in:"focusin",out:"focusout"},focusEvent:"focus",focusinEvent:"focusin",focusoutEvent:"focusout",gesturechangeEvent:"gesturechange",gestureendEvent:"gestureend",gesturestartEvent:"gesturestart",bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:"animationDuration",animationDurationLegacy:r,animationDelay:"animationDelay",animationDelayLegacy:i,animationName:"animationName",animationNameLegacy:o,animationEndEvent:"animationend",animationEndEventLegacy:a,transitionDuration:"transitionDuration",transitionDurationLegacy:u,transitionDelay:"transitionDelay",transitionDelayLegacy:s,transitionEndEvent:"transitionend",transitionEndEventLegacy:c,transitionProperty:"transitionProperty",transitionPropertyLegacy:l,isMobile:v,isApple:p,isFirefox:b,support3DTransform:y,supportPassive:k,supportTransform:A,supportTouch:L,supportAnimation:D,supportTransition:N,addEventListener:"addEventListener",removeEventListener:"removeEventListener",keyboardEventKeys:{Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},keydownEvent:"keydown",keypressEvent:"keypress",keyupEvent:"keyup",keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyEscape:"Escape",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",offsetHeight:"offsetHeight",offsetWidth:"offsetWidth",scrollHeight:"scrollHeight",scrollWidth:"scrollWidth",userAgentData:m,userAgent:d,addClass:function(e,t){e.classList.add(t)},removeClass:function(e,t){e.classList.remove(t)},hasClass:function(e,t){return e.classList.contains(t)},on:E,off:h,one:w,dispatchEvent:B,distinct:function(e,t,n){return n.indexOf(e)===t},Data:C,getInstance:function(e,t){return C.get(e,t)},createElement:function e(t){if(!t)return null;if("string"==typeof t)return P().createElement(t);var n=t.tagName,r=Object.assign({},t),i=e(n);return delete r.tagName,H(i,r),i},createElementNS:function e(t,n){if(!t&&!n)return null;if("string"==typeof n)return P().createElementNS(t,n);var r=n.tagName,i=Object.assign({},n),o=e(t,r);return delete i.tagName,F(i).forEach((function(e){var t=e[0],n=e[1];S(o,t,n)})),o},toUpperCase:function(e){return e.toUpperCase()},toLowerCase:Z,Timer:_,emulateAnimationEnd:function(e,t){var n=0,r=new Event("animationend"),i=j(e),o=V(e);if(i){var a=function(r){r.target===e&&(t.apply(e,[r]),e.removeEventListener("animationend",a),n=1)};e.addEventListener("animationend",a),setTimeout((function(){n||B(e,r)}),i+o+17)}else t.apply(e,[r])},emulateAnimationEndLegacy:function(e,t){var n=0,r=new Event(a),i=Q(e),o=W(e);if(D&&i){var u=function(r){r.target===e&&(t.apply(e,[r]),e.removeEventListener(a,u),n=1)};e.addEventListener(a,u),setTimeout((function(){n||B(e,r)}),i+o+17)}else t.apply(e,[r])},emulateTransitionEnd:function(e,t){var n=0,r=new Event("transitionend"),i=q(e),o=U(e);if(i){var a=function(r){r.target===e&&(t.apply(e,[r]),e.removeEventListener("transitionend",a),n=1)};e.addEventListener("transitionend",a),setTimeout((function(){n||B(e,r)}),i+o+17)}else t.apply(e,[r])},emulateTransitionEndLegacy:function(e,t){var n=0,r=new Event(c),i=K(e),o=G(e);if(N&&i){var a=function(r){r.target===e&&(t.apply(e,[r]),e.removeEventListener(c,a),n=1)};e.addEventListener(c,a),setTimeout((function(){n||B(e,r)}),i+o+17)}else t.apply(e,[r])},isElementInScrollRange:function(e){if(!e||!x(e))return!1;var t=ee(e),n=t.top,r=t.bottom;return n<=te(e).clientHeight&&r>=0},isElementInViewport:function(e){if(!e||!x(e))return!1;var t=te(e),n=t.clientWidth,r=t.clientHeight,i=ee(e,!0),o=i.top,a=i.left,u=i.bottom,s=i.right;return o>=0&&a>=0&&u<=r&&s<=n},passiveHandler:{passive:!0},passiveHandlerLegacy:J,getElementAnimationDuration:j,getElementAnimationDurationLegacy:Q,getElementAnimationDelay:V,getElementAnimationDelayLegacy:W,getElementTransitionDuration:q,getElementTransitionDurationLegacy:K,getElementTransitionDelay:U,getElementTransitionDelayLegacy:G,getNodeScroll:function(e){var t="scrollX"in e;return{x:t?e.scrollX:e.scrollLeft,y:t?e.scrollY:e.scrollTop}},getParentNode:function(e){return"HTML"===e.nodeName?e:e.assignedSlot||e.parentNode||ne(e)&&e.host||te(e)},getRectRelativeToOffsetParent:function(e,t,n){var r=M(t),i=ee(e,r&&re(t)),o={x:0,y:0};if(r){var a=ee(t,!0);o.x=a.x+t.clientLeft,o.y=a.y+t.clientTop}return{x:i.left+n.x-o.x,y:i.top+n.y-o.y,width:i.width,height:i.height}},getWindow:ue,isArray:function(e){return Array.isArray(e)},isString:function(e){return"string"==typeof e},isCustomElement:se,isElement:function(e){return e&&[1,2,3,4,5,6,7,8].some((function(t){return e.nodeType===t}))||!1},isNode:x,isNumber:function(e){return"number"==typeof e},isHTMLElement:M,isHTMLImageElement:function(e){return e&&"IMG"===e.tagName||!1},isSVGElement:function(e){return e&&e instanceof ue(e).SVGElement||!1},isNodeList:function(e){return e&&"NodeList"===e.constructor.name||!1},isHTMLCollection:function(e){return e&&"HTMLCollection"===e.constructor.name||!1},isScaledElement:re,isTableElement:function(e){return e&&["TABLE","TD","TH"].includes(e.tagName)||!1},isShadowRoot:ne,isDocument:z,isElementsArray:function(e){return Array.isArray(e)&&e.every(M)},isFunction:function(e){return e&&"Function"===e.constructor.name||!1},isWindow:I,isMedia:function(e){return e&&1===e.nodeType&&["SVG","Image","Video"].some((function(t){return e.constructor.name.includes(t)}))||!1},isRTL:function(e){return"rtl"===te(e).dir},closest:function e(t,n){return t?t.closest(n)||e(t.getRootNode().host,n):null},querySelector:function(e,t){return x(e)?e:(x(t)?t:P()).querySelector(e)},getCustomElements:function(e){var t=ce("*",e);return[].concat(t).filter(se)},getElementById:function(e,t){return P(t).getElementById(e)},querySelectorAll:function(e,t){return(x(t)?t:P()).querySelectorAll(e)},getElementsByClassName:function(e,t){return(x(t)?t:P()).getElementsByClassName(e)},getElementsByTagName:ce,matches:function(e,t){return e.matches(t)},matchesLegacy:function(e,t){return me.call(e,t)},normalizeValue:X,normalizeOptions:function(e,t,n,r){var i=Object.assign({},e.dataset),o={},a={};return Y(i).forEach((function(e){var t=r&&e.includes(r)?e.replace(r,"").replace(/[A-Z]/,(function(e){return Z(e)})):e;a[t]=X(i[e])})),Y(n).forEach((function(e){n[e]=X(n[e])})),Y(t).forEach((function(r){o[r]=r in n?n[r]:r in a?a[r]:"title"===r?T(e,"title"):t[r]})),o},reflow:function(e){return e.offsetHeight},noop:function(){},focus:function(e){return e.focus()},getUID:function e(t,n){var r=n?ie:oe;if(n){var i=e(t),o=ae.get(i)||new Map;ae.has(i)||ae.set(i,o),o.has(n)?r=o.get(n):(o.set(n,r),ie+=1)}else{var a=t.id||t;ae.has(a)?r=ae.get(a):(ae.set(a,r),oe+=1)}return r},ArrayFrom:function(e){return Array.from(e)},Float32ArrayFrom:function(e){return Float32Array.from(Array.from(e))},Float64ArrayFrom:function(e){return Float64Array.from(Array.from(e))},ObjectAssign:H,ObjectEntries:F,ObjectKeys:Y,ObjectValues:function(e){return Object.values(e)},OriginalEvent:function(e,t){var n=new CustomEvent(e,{cancelable:!0,bubbles:!0});return t instanceof Object&&H(n,t),n},getBoundingClientRect:ee,getDocument:P,getDocumentBody:function(e){return P(e).body},getDocumentElement:te,getDocumentHead:function(e){return P(e).head},getElementStyle:R,setElementStyle:function(e,t){F(t).forEach((function(t){var n=t[0],r=t[1];if(n.includes("--"))e.style.setProperty(n,r);else{var i={};i[n]=r,H(e.style,i)}}))},hasAttribute:function(e,t){return e.hasAttribute(t)},hasAttributeNS:function(e,t,n){return t.hasAttributeNS(e,n)},getAttribute:T,getAttributeNS:function(e,t,n){return t.getAttributeNS(e,n)},setAttribute:S,setAttributeNS:function(e,t,n,r){return t.setAttributeNS(e,n,r)},removeAttribute:function(e,t){return e.removeAttribute(t)},removeAttributeNS:function(e,t,n){return t.removeAttributeNS(e,n)},Version:"1.0.2"}}));
|
|
1
|
+
// Shorty v1.0.3 | dnp_theme © 2022 | MIT-License
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SHORTY=t()}(this,(function(){"use strict";var e={DOMContentLoaded:"DOMContentLoaded",DOMMouseScroll:"DOMMouseScroll",abort:"abort",beforeunload:"beforeunload",blur:"blur",change:"change",click:"click",contextmenu:"contextmenu",dblclick:"dblclick",error:"error",focus:"focus",focusin:"focusin",focusout:"focusout",gesturechange:"gesturechange",gestureend:"gestureend",gesturestart:"gesturestart",hover:"hover",keydown:"keydown",keypress:"keypress",keyup:"keyup",load:"load",mousedown:"mousedown",mousemove:"mousemove",mousein:"mousein",mouseout:"mouseout",mouseenter:"mouseenter",mouseleave:"mouseleave",mouseover:"mouseover",mouseup:"mouseup",mousewheel:"mousewheel",move:"move",orientationchange:"orientationchange",pointercancel:"pointercancel",pointerdown:"pointerdown",pointerleave:"pointerleave",pointermove:"pointermove",pointerup:"pointerup",readystatechange:"readystatechange",reset:"reset",resize:"resize",scroll:"scroll",select:"select",selectend:"selectend",selectstart:"selectstart",submit:"submit",touchcancel:"touchcancel",touchend:"touchend",touchmove:"touchmove",touchstart:"touchstart",unload:"unload"},t="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],n=document.head,r="webkitAnimation"in n.style?"webkitAnimationDuration":"animationDuration",i="webkitAnimation"in n.style?"webkitAnimationDelay":"animationDelay",o="webkitAnimation"in n.style?"webkitAnimationName":"animationName",a="webkitAnimation"in n.style?"webkitAnimationEnd":"animationend",u="webkitTransition"in n.style?"webkitTransitionDuration":"transitionDuration",s="webkitTransition"in n.style?"webkitTransitionDelay":"transitionDelay",c="webkitTransition"in n.style?"webkitTransitionEnd":"transitionend",l="webkitTransition"in n.style?"webkitTransitionProperty":"transitionProperty",m=navigator.userAgentData,d=navigator.userAgent,f=/iPhone|iPad|iPod|Android/i,v=m?m.brands.some((function(e){return f.test(e.brand)})):f.test(d),g=/(iPhone|iPod|iPad)/,p=m?m.brands.some((function(e){return g.test(e.brand)})):g.test(d),b=!!d&&d.includes("Firefox"),y="webkitPerspective"in n.style||"perspective"in n.style;function E(e,t,n,r){var i=r||!1;e.addEventListener(t,n,i)}function h(e,t,n,r){var i=r||!1;e.removeEventListener(t,n,i)}function w(e,t,n,r){var i=function(o){o.target===e&&(n.apply(e,[o]),h(e,t,i,r))};E(e,t,i,r)}var k=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0}});w(document,"DOMContentLoaded",(function(){}),t)}catch(e){}return e}(),A="webkitTransform"in n.style||"transform"in n.style,L="ontouchstart"in window||"msMaxTouchPoints"in navigator,D="webkitAnimation"in n.style||"animation"in n.style,N="webkitTransition"in n.style||"transition"in n.style,T=function(e,t){return e.getAttribute(t)},S=function(e,t,n){return e.setAttribute(t,n)};var M=function(e){return e&&1===e.nodeType||!1},O=new Map,C={set:function(e,t,n){M(e)&&(O.has(t)||O.set(t,new Map),O.get(t).set(e,n))},getAllFor:function(e){return O.get(e)||null},get:function(e,t){if(!M(e)||!t)return null;var n=C.getAllFor(t);return e&&n&&n.get(e)||null},remove:function(e,t){var n=O.get(t);n&&M(e)&&(n.delete(e),0===n.size&&O.delete(t))}},z=function(e){return e&&[1,2,3,4,5,6,7,8,9,10,11].some((function(t){return+e.nodeType===t}))||!1},x=function(e){return e&&"Window"===e.constructor.name||!1},I=function(e){return e&&9===e.nodeType||!1};function P(e){return I(e)?e:z(e)?e.ownerDocument:x(e)?e.document:window.document}var H=function(e,t){return Object.assign(e,t)};var F=function(e){return Object.entries(e)};var B=function(e,t){return e.dispatchEvent(t)};function j(e,t){var n=getComputedStyle(e);return t.includes("--")?n.getPropertyValue(t):n[t]}function R(e){var t=j(e,"animationName"),n=j(e,"animationDelay"),r=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*r:0;return Number.isNaN(i)?0:i}function V(e){var t=j(e,"animationName"),n=j(e,"animationDuration"),r=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*r:0;return Number.isNaN(i)?0:i}function W(e){var t=j(e,o),n=j(e,i),r=n.includes("ms")?1:1e3,a=D&&t&&"none"!==t?parseFloat(n)*r:0;return Number.isNaN(a)?0:a}function Q(e){var t=j(e,o),n=j(e,r),i=n.includes("ms")?1:1e3,a=D&&t&&"none"!==t?parseFloat(n)*i:0;return Number.isNaN(a)?0:a}function U(e){var t=j(e,"transitionProperty"),n=j(e,"transitionDelay"),r=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*r:0;return Number.isNaN(i)?0:i}function q(e){var t=j(e,"transitionProperty"),n=j(e,"transitionDuration"),r=n.includes("ms")?1:1e3,i=t&&"none"!==t?parseFloat(n)*r:0;return Number.isNaN(i)?0:i}function G(e){var t=j(e,l),n=j(e,s),r=n.includes("ms")?1:1e3,i=N&&t&&"none"!==t?parseFloat(n)*r:0;return Number.isNaN(i)?0:i}function K(e){var t=j(e,l),n=j(e,u),r=n.includes("ms")?1:1e3,i=N&&t&&"none"!==t?parseFloat(n)*r:0;return Number.isNaN(i)?0:i}function X(e){return!!["true",!0].includes(e)||!["false",!1].includes(e)&&(""===e||"null"===e?null:""===e||Number.isNaN(+e)?e:+e)}var Y=function(e){return Object.keys(e)},Z=function(e){return e.toLowerCase()};var J=function(e){return"object"==typeof e||!1};var $=!!k&&{passive:!0},_=new Map,ee={set:function(e,t,n,r){M(e)&&(r&&r.length?(_.has(e)||_.set(e,new Map),_.get(e).set(r,setTimeout(t,n))):_.set(e,setTimeout(t,n)))},get:function(e,t){if(!M(e))return null;var n=_.get(e);return t&&t.length&&n&&n.get?n.get(t)||null:n||null},clear:function(e,t){if(M(e))if(t&&t.length){var n=_.get(e);n&&n.get&&(clearTimeout(n.get(t)),n.delete(t),0===n.size&&_.delete(e))}else clearTimeout(_.get(e)),_.delete(e)}};function te(e,t){var n=e.getBoundingClientRect(),r=n.width,i=n.height,o=n.top,a=n.right,u=n.bottom,s=n.left,c=1,l=1;if(t&&M(e)){var m=e.offsetWidth,d=e.offsetHeight;c=m>0?Math.round(r)/m:1,l=d>0?Math.round(i)/d:1}return{width:r/c,height:i/l,top:o/l,right:a/c,bottom:u/l,left:s/c,x:s/c,y:o/l}}function ne(e){return P(e).documentElement}var re=function(e){return e&&"ShadowRoot"===e.constructor.name||!1};function ie(e){if(!e||!M(e))return!1;var t=te(e),n=t.width,r=t.height,i=e.offsetWidth,o=e.offsetHeight;return Math.round(n)!==i||Math.round(r)!==o}var oe=0,ae=0,ue=new Map;function se(e){return e?I(e)?e.defaultView:z(e)?e.ownerDocument.defaultView:e:window}var ce=function(e){return e&&!!e.shadowRoot||!1};function le(e,t){return(z(t)?t:P()).getElementsByTagName(e)}var me=Element.prototype,de=me.matches||me.matchesSelector||me.webkitMatchesSelector||me.mozMatchesSelector||me.msMatchesSelector||me.oMatchesSelector||function(){return!1};return{ariaChecked:"aria-checked",ariaDescription:"aria-description",ariaDescribedBy:"aria-describedby",ariaExpanded:"aria-expanded",ariaHidden:"aria-hidden",ariaHasPopup:"aria-haspopup",ariaLabel:"aria-label",ariaLabelledBy:"aria-labelledby",ariaModal:"aria-modal",ariaPressed:"aria-pressed",ariaSelected:"aria-selected",ariaValueMin:"aria-valuemin",ariaValueMax:"aria-valuemax",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",nativeEvents:e,abortEvent:"abort",blurEvent:"blur",moveEvent:"move",changeEvent:"change",errorEvent:"error",resetEvent:"reset",resizeEvent:"resize",scrollEvent:"scroll",submitEvent:"submit",loadEvent:"load",loadstartEvent:"loadstart",unloadEvent:"unload",readystatechangeEvent:"readystatechange",beforeunloadEvent:"beforeunload",orientationchangeEvent:"orientationchange",contextmenuEvent:"contextmenu",DOMContentLoadedEvent:"DOMContentLoaded",DOMMouseScrollEvent:"DOMMouseScroll",selectEvent:"select",selectendEvent:"selectend",selectstartEvent:"selectstart",mouseClickEvents:{down:"mousedown",up:"mouseup"},mouseclickEvent:"click",mousedblclickEvent:"dblclick",mousedownEvent:"mousedown",mouseupEvent:"mouseup",mousehoverEvent:"hover",mouseHoverEvents:t,mouseenterEvent:"mouseenter",mouseleaveEvent:"mouseleave",mouseinEvent:"mousein",mouseoutEvent:"mouseout",mouseoverEvent:"mouseover",mousemoveEvent:"mousemove",mousewheelEvent:"mousewheel",mouseSwipeEvents:{start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},touchEvents:{start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},touchstartEvent:"touchstart",touchmoveEvent:"touchmove",touchcancelEvent:"touchcancel",touchendEvent:"touchend",pointercancelEvent:"pointercancel",pointerdownEvent:"pointerdown",pointerleaveEvent:"pointerleave",pointermoveEvent:"pointermove",pointerupEvent:"pointerup",focusEvents:{in:"focusin",out:"focusout"},focusEvent:"focus",focusinEvent:"focusin",focusoutEvent:"focusout",gesturechangeEvent:"gesturechange",gestureendEvent:"gestureend",gesturestartEvent:"gesturestart",bezierEasings:{linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},animationDuration:"animationDuration",animationDurationLegacy:r,animationDelay:"animationDelay",animationDelayLegacy:i,animationName:"animationName",animationNameLegacy:o,animationEndEvent:"animationend",animationEndEventLegacy:a,transitionDuration:"transitionDuration",transitionDurationLegacy:u,transitionDelay:"transitionDelay",transitionDelayLegacy:s,transitionEndEvent:"transitionend",transitionEndEventLegacy:c,transitionProperty:"transitionProperty",transitionPropertyLegacy:l,isMobile:v,isApple:p,isFirefox:b,support3DTransform:y,supportPassive:k,supportTransform:A,supportTouch:L,supportAnimation:D,supportTransition:N,addEventListener:"addEventListener",removeEventListener:"removeEventListener",keyboardEventKeys:{Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},keydownEvent:"keydown",keypressEvent:"keypress",keyupEvent:"keyup",keyAlt:"Alt",keyArrowDown:"ArrowDown",keyArrowLeft:"ArrowLeft",keyArrowRight:"ArrowRight",keyArrowUp:"ArrowUp",keyBackspace:"Backspace",keyCapsLock:"CapsLock",keyControl:"Control",keyDelete:"Delete",keyEnter:"Enter",keyEscape:"Escape",keyInsert:"Insert",keyMeta:"Meta",keyPause:"Pause",keyScrollLock:"ScrollLock",keyShift:"Shift",keySpace:"Space",keyTab:"Tab",offsetHeight:"offsetHeight",offsetWidth:"offsetWidth",scrollHeight:"scrollHeight",scrollWidth:"scrollWidth",userAgentData:m,userAgent:d,addClass:function(e,t){e.classList.add(t)},removeClass:function(e,t){e.classList.remove(t)},hasClass:function(e,t){return e.classList.contains(t)},on:E,off:h,one:w,dispatchEvent:B,distinct:function(e,t,n){return n.indexOf(e)===t},Data:C,getInstance:function(e,t){return C.get(e,t)},createElement:function e(t){if(!t)return null;if("string"==typeof t)return P().createElement(t);var n=t.tagName,r=Object.assign({},t),i=e(n);return delete r.tagName,H(i,r),i},createElementNS:function e(t,n){if(!t&&!n)return null;if("string"==typeof n)return P().createElementNS(t,n);var r=n.tagName,i=Object.assign({},n),o=e(t,r);return delete i.tagName,F(i).forEach((function(e){var t=e[0],n=e[1];S(o,t,n)})),o},toUpperCase:function(e){return e.toUpperCase()},toLowerCase:Z,Timer:ee,emulateAnimationEnd:function(e,t){var n=0,r=new Event("animationend"),i=V(e),o=R(e);if(i){var a=function(r){r.target===e&&(t.apply(e,[r]),e.removeEventListener("animationend",a),n=1)};e.addEventListener("animationend",a),setTimeout((function(){n||B(e,r)}),i+o+17)}else t.apply(e,[r])},emulateAnimationEndLegacy:function(e,t){var n=0,r=new Event(a),i=Q(e),o=W(e);if(D&&i){var u=function(r){r.target===e&&(t.apply(e,[r]),e.removeEventListener(a,u),n=1)};e.addEventListener(a,u),setTimeout((function(){n||B(e,r)}),i+o+17)}else t.apply(e,[r])},emulateTransitionEnd:function(e,t){var n=0,r=new Event("transitionend"),i=q(e),o=U(e);if(i){var a=function(r){r.target===e&&(t.apply(e,[r]),e.removeEventListener("transitionend",a),n=1)};e.addEventListener("transitionend",a),setTimeout((function(){n||B(e,r)}),i+o+17)}else t.apply(e,[r])},emulateTransitionEndLegacy:function(e,t){var n=0,r=new Event(c),i=K(e),o=G(e);if(N&&i){var a=function(r){r.target===e&&(t.apply(e,[r]),e.removeEventListener(c,a),n=1)};e.addEventListener(c,a),setTimeout((function(){n||B(e,r)}),i+o+17)}else t.apply(e,[r])},isElementInScrollRange:function(e){if(!e||!z(e))return!1;var t=te(e),n=t.top,r=t.bottom;return n<=ne(e).clientHeight&&r>=0},isElementInViewport:function(e){if(!e||!z(e))return!1;var t=ne(e),n=t.clientWidth,r=t.clientHeight,i=te(e,!0),o=i.top,a=i.left,u=i.bottom,s=i.right;return o>=0&&a>=0&&u<=r&&s<=n},passiveHandler:{passive:!0},passiveHandlerLegacy:$,getElementAnimationDuration:V,getElementAnimationDurationLegacy:Q,getElementAnimationDelay:R,getElementAnimationDelayLegacy:W,getElementTransitionDuration:q,getElementTransitionDurationLegacy:K,getElementTransitionDelay:U,getElementTransitionDelayLegacy:G,getNodeScroll:function(e){var t="scrollX"in e;return{x:t?e.scrollX:e.scrollLeft,y:t?e.scrollY:e.scrollTop}},getParentNode:function(e){return"HTML"===e.nodeName?e:e.assignedSlot||e.parentNode||re(e)&&e.host||ne(e)},getRectRelativeToOffsetParent:function(e,t,n){var r=M(t),i=te(e,r&&ie(t)),o={x:0,y:0};if(r){var a=te(t,!0);o.x=a.x+t.clientLeft,o.y=a.y+t.clientTop}return{x:i.left+n.x-o.x,y:i.top+n.y-o.y,width:i.width,height:i.height}},getWindow:se,isArray:function(e){return Array.isArray(e)},isString:function(e){return"string"==typeof e},isCustomElement:ce,isElement:function(e){return e&&[1,2,3,4,5,6,7,8].some((function(t){return e.nodeType===t}))||!1},isNode:z,isNumber:function(e){return"number"==typeof e},isHTMLElement:M,isHTMLImageElement:function(e){return e&&"IMG"===e.tagName||!1},isSVGElement:function(e){return e&&e instanceof se(e).SVGElement||!1},isNodeList:function(e){return e&&"NodeList"===e.constructor.name||!1},isHTMLCollection:function(e){return e&&"HTMLCollection"===e.constructor.name||!1},isScaledElement:ie,isTableElement:function(e){return e&&["TABLE","TD","TH"].includes(e.tagName)||!1},isShadowRoot:re,isDocument:I,isElementsArray:function(e){return Array.isArray(e)&&e.every(M)},isFunction:function(e){return e&&"Function"===e.constructor.name||!1},isObject:J,isWindow:x,isMedia:function(e){return e&&1===e.nodeType&&["SVG","Image","Video"].some((function(t){return e.constructor.name.includes(t)}))||!1},isRTL:function(e){return"rtl"===ne(e).dir},closest:function e(t,n){return t?t.closest(n)||e(t.getRootNode().host,n):null},querySelector:function(e,t){return z(e)?e:(z(t)?t:P()).querySelector(e)},getCustomElements:function(e){var t=le("*",e);return[].concat(t).filter(ce)},getElementById:function(e,t){return P(t).getElementById(e)},querySelectorAll:function(e,t){return(z(t)?t:P()).querySelectorAll(e)},getElementsByClassName:function(e,t){return(z(t)?t:P()).getElementsByClassName(e)},getElementsByTagName:le,matches:function(e,t){return e.matches(t)},matchesLegacy:function(e,t){return de.call(e,t)},normalizeValue:X,normalizeOptions:function(e,t,n,r){var i=Object.assign({},e.dataset),o={},a={};return Y(i).forEach((function(e){var t=r&&e.includes(r)?e.replace(r,"").replace(/[A-Z]/,(function(e){return Z(e)})):e;a[t]=X(i[e])})),Y(n).forEach((function(e){n[e]=X(n[e])})),Y(t).forEach((function(r){o[r]=r in n?n[r]:r in a?a[r]:"title"===r?T(e,"title"):t[r]})),o},reflow:function(e){return e.offsetHeight},noop:function(){},focus:function(e){return e.focus()},getUID:function e(t,n){var r=n?oe:ae;if(n){var i=e(t),o=ue.get(i)||new Map;ue.has(i)||ue.set(i,o),o.has(n)?r=o.get(n):(o.set(n,r),oe+=1)}else{var a=t.id||t;ue.has(a)?r=ue.get(a):(ue.set(a,r),ae+=1)}return r},ArrayFrom:function(e){return Array.from(e)},Float32ArrayFrom:function(e){return Float32Array.from(Array.from(e))},Float64ArrayFrom:function(e){return Float64Array.from(Array.from(e))},ObjectAssign:H,ObjectEntries:F,ObjectKeys:Y,ObjectValues:function(e){return Object.values(e)},OriginalEvent:function(e,t){var n=new CustomEvent(e,{cancelable:!0,bubbles:!0});return J(t)&&H(n,t),n},getBoundingClientRect:te,getDocument:P,getDocumentBody:function(e){return P(e).body},getDocumentElement:ne,getDocumentHead:function(e){return P(e).head},getElementStyle:j,setElementStyle:function(e,t){F(t).forEach((function(t){var n=t[0],r=t[1];if(n.includes("--"))e.style.setProperty(n,r);else{var i={};i[n]=r,H(e.style,i)}}))},hasAttribute:function(e,t){return e.hasAttribute(t)},hasAttributeNS:function(e,t,n){return t.hasAttributeNS(e,n)},getAttribute:T,getAttributeNS:function(e,t,n){return t.getAttributeNS(e,n)},setAttribute:S,setAttributeNS:function(e,t,n,r){return t.setAttributeNS(e,n,r)},removeAttribute:function(e,t){return e.removeAttribute(t)},removeAttributeNS:function(e,t,n){return t.removeAttributeNS(e,n)},Version:"1.0.3"}}));
|
package/package.json
CHANGED
package/src/get/getDocument.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import isDocument from '../is/isDocument';
|
|
2
1
|
import isNode from '../is/isNode';
|
|
3
2
|
import isWindow from '../is/isWindow';
|
|
3
|
+
import isDocument from '../is/isDocument';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Returns the `document` or the `#document` element.
|
|
7
7
|
* @see https://github.com/floating-ui/floating-ui
|
|
8
|
-
* @param {(
|
|
8
|
+
* @param {(Node | Window)=} node
|
|
9
9
|
* @returns {Document}
|
|
10
10
|
*/
|
|
11
11
|
export default function getDocument(node) {
|
|
12
|
+
// node instanceof Document
|
|
12
13
|
if (isDocument(node)) return node;
|
|
14
|
+
// node instanceof Node
|
|
13
15
|
if (isNode(node)) return node.ownerDocument;
|
|
16
|
+
// node instanceof Window
|
|
14
17
|
if (isWindow(node)) return node.document;
|
|
18
|
+
// node is undefined | NULL
|
|
15
19
|
return window.document;
|
|
16
20
|
}
|
|
@@ -2,7 +2,7 @@ import getDocument from './getDocument';
|
|
|
2
2
|
/**
|
|
3
3
|
* Returns the `document.body` or the `<body>` element.
|
|
4
4
|
*
|
|
5
|
-
* @param {(
|
|
5
|
+
* @param {(Node | Window)=} node
|
|
6
6
|
* @returns {HTMLBodyElement}
|
|
7
7
|
*/
|
|
8
8
|
export default function getDocumentBody(node) {
|
|
@@ -3,7 +3,7 @@ import getDocument from './getDocument';
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns the `document.documentElement` or the `<html>` element.
|
|
5
5
|
*
|
|
6
|
-
* @param {(
|
|
6
|
+
* @param {(Node | Window)=} node
|
|
7
7
|
* @returns {HTMLHtmlElement}
|
|
8
8
|
*/
|
|
9
9
|
export default function getDocumentElement(node) {
|
|
@@ -2,7 +2,7 @@ import getDocument from './getDocument';
|
|
|
2
2
|
/**
|
|
3
3
|
* Returns the `document.head` or the `<head>` element.
|
|
4
4
|
*
|
|
5
|
-
* @param {(
|
|
5
|
+
* @param {(Node | Window)=} node
|
|
6
6
|
* @returns {HTMLHeadElement}
|
|
7
7
|
*/
|
|
8
8
|
export default function getDocumentHead(node) {
|
package/src/get/getWindow.js
CHANGED
|
@@ -10,20 +10,11 @@ import isNode from '../is/isNode';
|
|
|
10
10
|
*/
|
|
11
11
|
export default function getWindow(node) {
|
|
12
12
|
// node is undefined | NULL
|
|
13
|
-
if (!node)
|
|
14
|
-
return window;
|
|
15
|
-
}
|
|
16
|
-
|
|
13
|
+
if (!node) return window;
|
|
17
14
|
// node instanceof Document
|
|
18
|
-
if (isDocument(node))
|
|
19
|
-
return node.defaultView;
|
|
20
|
-
}
|
|
21
|
-
|
|
15
|
+
if (isDocument(node)) return node.defaultView;
|
|
22
16
|
// node instanceof Node
|
|
23
|
-
if (isNode(node))
|
|
24
|
-
return node.ownerDocument.defaultView;
|
|
25
|
-
}
|
|
26
|
-
|
|
17
|
+
if (isNode(node)) return node.ownerDocument.defaultView;
|
|
27
18
|
// node is instanceof Window
|
|
28
19
|
return node;
|
|
29
20
|
}
|
package/src/index.js
CHANGED
|
@@ -222,6 +222,7 @@ import isElementInScrollRange from './is/isElementInScrollRange';
|
|
|
222
222
|
import isElementInViewport from './is/isElementInViewport';
|
|
223
223
|
import isElementsArray from './is/isElementsArray';
|
|
224
224
|
import isFunction from './is/isFunction';
|
|
225
|
+
import isObject from './is/isObject';
|
|
225
226
|
import isHTMLCollection from './is/isHTMLCollection';
|
|
226
227
|
import isHTMLElement from './is/isHTMLElement';
|
|
227
228
|
import isHTMLImageElement from './is/isHTMLImageElement';
|
|
@@ -428,6 +429,7 @@ const SHORTY = {
|
|
|
428
429
|
isDocument,
|
|
429
430
|
isElementsArray,
|
|
430
431
|
isFunction,
|
|
432
|
+
isObject,
|
|
431
433
|
isWindow,
|
|
432
434
|
isMedia,
|
|
433
435
|
isRTL,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import isObject from '../is/isObject';
|
|
1
2
|
import ObjectAssign from './ObjectAssign';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -12,7 +13,7 @@ export default function OriginalEvent(EventType, config) {
|
|
|
12
13
|
});
|
|
13
14
|
|
|
14
15
|
/* istanbul ignore else */
|
|
15
|
-
if (config
|
|
16
|
+
if (isObject(config)) {
|
|
16
17
|
ObjectAssign(OriginalCustomEvent, config);
|
|
17
18
|
}
|
|
18
19
|
return OriginalCustomEvent;
|
package/types/index.d.ts
CHANGED
|
@@ -201,6 +201,7 @@ export { default as isHTMLImageElement } from 'shorty/src/is/isHTMLImageElement'
|
|
|
201
201
|
export { default as isMedia } from 'shorty/src/is/isMedia';
|
|
202
202
|
export { default as isNode } from 'shorty/src/is/isNode';
|
|
203
203
|
export { default as isNodeList } from 'shorty/src/is/isNodeList';
|
|
204
|
+
export { default as isObject } from 'shorty/src/is/isObject';
|
|
204
205
|
export { default as isRTL } from 'shorty/src/is/isRTL';
|
|
205
206
|
export { default as isScaledElement } from 'shorty/src/is/isScaledElement';
|
|
206
207
|
export { default as isShadowRoot } from 'shorty/src/is/isShadowRoot';
|
package/types/module/shorty.ts
CHANGED
|
@@ -224,6 +224,7 @@ export { default as isHTMLImageElement } from '../../src/is/isHTMLImageElement';
|
|
|
224
224
|
export { default as isMedia } from '../../src/is/isMedia';
|
|
225
225
|
export { default as isNode } from '../../src/is/isNode';
|
|
226
226
|
export { default as isNodeList } from '../../src/is/isNodeList';
|
|
227
|
+
export { default as isObject } from '../../src/is/isObject';
|
|
227
228
|
export { default as isRTL } from '../../src/is/isRTL';
|
|
228
229
|
export { default as isScaledElement } from '../../src/is/isScaledElement';
|
|
229
230
|
export { default as isShadowRoot } from '../../src/is/isShadowRoot';
|
package/types/shorty.d.ts
CHANGED
|
@@ -1279,37 +1279,37 @@ declare module "shorty/src/get/getDocument" {
|
|
|
1279
1279
|
/**
|
|
1280
1280
|
* Returns the `document` or the `#document` element.
|
|
1281
1281
|
* @see https://github.com/floating-ui/floating-ui
|
|
1282
|
-
* @param {(
|
|
1282
|
+
* @param {(Node | Window)=} node
|
|
1283
1283
|
* @returns {Document}
|
|
1284
1284
|
*/
|
|
1285
|
-
export default function getDocument(node?: (
|
|
1285
|
+
export default function getDocument(node?: (Node | Window) | undefined): Document;
|
|
1286
1286
|
}
|
|
1287
1287
|
declare module "shorty/src/get/getDocumentBody" {
|
|
1288
1288
|
/**
|
|
1289
1289
|
* Returns the `document.body` or the `<body>` element.
|
|
1290
1290
|
*
|
|
1291
|
-
* @param {(
|
|
1291
|
+
* @param {(Node | Window)=} node
|
|
1292
1292
|
* @returns {HTMLBodyElement}
|
|
1293
1293
|
*/
|
|
1294
|
-
export default function getDocumentBody(node?: (
|
|
1294
|
+
export default function getDocumentBody(node?: (Node | Window) | undefined): HTMLBodyElement;
|
|
1295
1295
|
}
|
|
1296
1296
|
declare module "shorty/src/get/getDocumentElement" {
|
|
1297
1297
|
/**
|
|
1298
1298
|
* Returns the `document.documentElement` or the `<html>` element.
|
|
1299
1299
|
*
|
|
1300
|
-
* @param {(
|
|
1300
|
+
* @param {(Node | Window)=} node
|
|
1301
1301
|
* @returns {HTMLHtmlElement}
|
|
1302
1302
|
*/
|
|
1303
|
-
export default function getDocumentElement(node?: (
|
|
1303
|
+
export default function getDocumentElement(node?: (Node | Window) | undefined): HTMLHtmlElement;
|
|
1304
1304
|
}
|
|
1305
1305
|
declare module "shorty/src/get/getDocumentHead" {
|
|
1306
1306
|
/**
|
|
1307
1307
|
* Returns the `document.head` or the `<head>` element.
|
|
1308
1308
|
*
|
|
1309
|
-
* @param {(
|
|
1309
|
+
* @param {(Node | Window)=} node
|
|
1310
1310
|
* @returns {HTMLHeadElement}
|
|
1311
1311
|
*/
|
|
1312
|
-
export default function getDocumentHead(node?: (
|
|
1312
|
+
export default function getDocumentHead(node?: (Node | Window) | undefined): HTMLHeadElement;
|
|
1313
1313
|
}
|
|
1314
1314
|
declare module "shorty/src/get/getElementStyle" {
|
|
1315
1315
|
/**
|
|
@@ -1872,6 +1872,16 @@ declare module "shorty/src/is/isElementsArray" {
|
|
|
1872
1872
|
*/
|
|
1873
1873
|
function isElementsArray(object: any): boolean;
|
|
1874
1874
|
}
|
|
1875
|
+
declare module "shorty/src/is/isObject" {
|
|
1876
|
+
export default isObject;
|
|
1877
|
+
/**
|
|
1878
|
+
* Checks if an object is an `Object`.
|
|
1879
|
+
*
|
|
1880
|
+
* @param {any} obj the target object
|
|
1881
|
+
* @returns {boolean} the query result
|
|
1882
|
+
*/
|
|
1883
|
+
function isObject(obj: any): boolean;
|
|
1884
|
+
}
|
|
1875
1885
|
declare module "shorty/src/is/isFunction" {
|
|
1876
1886
|
export default isFunction;
|
|
1877
1887
|
/**
|
|
@@ -2278,6 +2288,7 @@ declare module "shorty/types/module/shorty" {
|
|
|
2278
2288
|
export { default as isElementInViewport } from "shorty/src/is/isElementInViewport";
|
|
2279
2289
|
export { default as isElementsArray } from "shorty/src/is/isElementsArray";
|
|
2280
2290
|
export { default as isFunction } from "shorty/src/is/isFunction";
|
|
2291
|
+
export { default as isObject } from "shorty/src/is/isObject";
|
|
2281
2292
|
export { default as isHTMLCollection } from "shorty/src/is/isHTMLCollection";
|
|
2282
2293
|
export { default as isHTMLElement } from "shorty/src/is/isHTMLElement";
|
|
2283
2294
|
export { default as isHTMLImageElement } from "shorty/src/is/isHTMLImageElement";
|