@interactjs/utils
Advanced tools
Comparing version 1.9.20 to 1.9.21
import domObjects from "./domObjects.js"; | ||
import is from "./is.js"; | ||
import win from "./window.js"; | ||
import * as win from "./window.js"; | ||
const browser = { | ||
@@ -5,0 +5,0 @@ init, |
@@ -1,2 +0,2 @@ | ||
import e from"./domObjects.min.js";import t from"./is.min.js";import o from"./window.min.js";const n={init(r){const s=e.Element,i=o.window.navigator;n.supportsTouch="ontouchstart"in r||t.func(r.DocumentTouch)&&e.document instanceof r.DocumentTouch,n.supportsPointerEvent=!1!==i.pointerEnabled&&!!e.PointerEvent,n.isIOS=/iP(hone|od|ad)/.test(i.platform),n.isIOS7=/iP(hone|od|ad)/.test(i.platform)&&/OS 7[^\d]/.test(i.appVersion),n.isIe9=/MSIE 9/.test(i.userAgent),n.isOperaMobile="Opera"===i.appName&&n.supportsTouch&&/Presto/.test(i.userAgent),n.prefixedMatchesSelector="matches"in s.prototype?"matches":"webkitMatchesSelector"in s.prototype?"webkitMatchesSelector":"mozMatchesSelector"in s.prototype?"mozMatchesSelector":"oMatchesSelector"in s.prototype?"oMatchesSelector":"msMatchesSelector",n.pEventTypes=n.supportsPointerEvent?e.PointerEvent===r.MSPointerEvent?{up:"MSPointerUp",down:"MSPointerDown",over:"mouseover",out:"mouseout",move:"MSPointerMove",cancel:"MSPointerCancel"}:{up:"pointerup",down:"pointerdown",over:"pointerover",out:"pointerout",move:"pointermove",cancel:"pointercancel"}:null,n.wheelEvent="onmousewheel"in e.document?"mousewheel":"wheel"},supportsTouch:null,supportsPointerEvent:null,isIOS7:null,isIOS:null,isIe9:null,isOperaMobile:null,prefixedMatchesSelector:null,pEventTypes:null,wheelEvent:null};export default n; | ||
import e from"./domObjects.min.js";import t from"./is.min.js";import*as o from"./window.min.js";const n={init(r){const s=e.Element,i=o.window.navigator;n.supportsTouch="ontouchstart"in r||t.func(r.DocumentTouch)&&e.document instanceof r.DocumentTouch,n.supportsPointerEvent=!1!==i.pointerEnabled&&!!e.PointerEvent,n.isIOS=/iP(hone|od|ad)/.test(i.platform),n.isIOS7=/iP(hone|od|ad)/.test(i.platform)&&/OS 7[^\d]/.test(i.appVersion),n.isIe9=/MSIE 9/.test(i.userAgent),n.isOperaMobile="Opera"===i.appName&&n.supportsTouch&&/Presto/.test(i.userAgent),n.prefixedMatchesSelector="matches"in s.prototype?"matches":"webkitMatchesSelector"in s.prototype?"webkitMatchesSelector":"mozMatchesSelector"in s.prototype?"mozMatchesSelector":"oMatchesSelector"in s.prototype?"oMatchesSelector":"msMatchesSelector",n.pEventTypes=n.supportsPointerEvent?e.PointerEvent===r.MSPointerEvent?{up:"MSPointerUp",down:"MSPointerDown",over:"mouseover",out:"mouseout",move:"MSPointerMove",cancel:"MSPointerCancel"}:{up:"pointerup",down:"pointerdown",over:"pointerover",out:"pointerout",move:"pointermove",cancel:"pointercancel"}:null,n.wheelEvent="onmousewheel"in e.document?"mousewheel":"wheel"},supportsTouch:null,supportsPointerEvent:null,isIOS7:null,isIOS:null,isIe9:null,isOperaMobile:null,prefixedMatchesSelector:null,pEventTypes:null,wheelEvent:null};export default n; | ||
//# sourceMappingURL=browser.min.js.map |
import browser from "./browser.js"; | ||
import domObjects from "./domObjects.js"; | ||
import is from "./is.js"; | ||
import win, { getWindow } from "./window.js"; | ||
import * as win from "./window.js"; | ||
export function nodeContains(parent, child) { | ||
if (parent.contains) { | ||
return parent.contains(child); | ||
} | ||
while (child) { | ||
@@ -147,4 +151,4 @@ if (child === parent) { | ||
function zIndexIsHigherThan(higherNode, lowerNode) { | ||
const higherIndex = parseInt(getWindow(higherNode).getComputedStyle(higherNode).zIndex, 10) || 0; | ||
const lowerIndex = parseInt(getWindow(lowerNode).getComputedStyle(lowerNode).zIndex, 10) || 0; | ||
const higherIndex = parseInt(win.getWindow(higherNode).getComputedStyle(higherNode).zIndex, 10) || 0; | ||
const lowerIndex = parseInt(win.getWindow(lowerNode).getComputedStyle(lowerNode).zIndex, 10) || 0; | ||
return higherIndex >= lowerIndex; | ||
@@ -169,3 +173,3 @@ } | ||
export function getActualElement(element) { | ||
return element instanceof domObjects.SVGElementInstance ? element.correspondingUseElement : element; | ||
return element.correspondingUseElement || element; | ||
} | ||
@@ -172,0 +176,0 @@ export function getScrollXY(relevantWindow) { |
@@ -1,2 +0,2 @@ | ||
import e from"./browser.min.js";import t from"./domObjects.min.js";import n from"./is.min.js";import o,{getWindow as r}from"./window.min.js";export function nodeContains(e,t){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}export function closest(e,t){for(;n.element(e);){if(matchesSelector(e,t))return e;e=parentNode(e)}return null}export function parentNode(e){let t=e.parentNode;if(n.docFrag(t)){for(;(t=t.host)&&n.docFrag(t););return t}return t}export function matchesSelector(t,n){return o.window!==o.realWindow&&(n=n.replace(/\/deep\//g," ")),t[e.prefixedMatchesSelector](n)}const i=e=>e.parentNode||e.host;export function indexOfDeepestElement(e){let n,o=[];for(let r=0;r<e.length;r++){const u=e[r],f=e[n];if(!u||r===n)continue;if(!f){n=r;continue}const s=i(u),m=i(f);if(s===u.ownerDocument)continue;if(m===u.ownerDocument){n=r;continue}if(s===m){l(u,f)&&(n=r);continue}let p;if(o=o.length?o:c(f),f instanceof t.HTMLElement&&u instanceof t.SVGElement&&!(u instanceof t.SVGSVGElement)){if(u===m)continue;p=u.ownerSVGElement}else p=u;const d=c(p,f.ownerDocument);let a=0;for(;d[a]&&d[a]===o[a];)a++;const g=[d[a-1],d[a],o[a]];let h=g[0].lastChild;for(;h;){if(h===g[1]){n=r,o=d;break}if(h===g[2])break;h=h.previousSibling}}return n}function c(e,t){const n=[];let o,r=e;for(;(o=i(r))&&r!==t&&o!==r.ownerDocument;)n.unshift(r),r=o;return n}function l(e,t){return(parseInt(r(e).getComputedStyle(e).zIndex,10)||0)>=(parseInt(r(t).getComputedStyle(t).zIndex,10)||0)}export function matchesUpTo(e,t,o){for(;n.element(e);){if(matchesSelector(e,t))return!0;if((e=parentNode(e))===o)return matchesSelector(e,t)}return!1}export function getActualElement(e){return e instanceof t.SVGElementInstance?e.correspondingUseElement:e}export function getScrollXY(e){return{x:(e=e||o.window).scrollX||e.document.documentElement.scrollLeft,y:e.scrollY||e.document.documentElement.scrollTop}}export function getElementClientRect(e){const n=e instanceof t.SVGElement?e.getBoundingClientRect():e.getClientRects()[0];return n&&{left:n.left,right:n.right,top:n.top,bottom:n.bottom,width:n.width||n.right-n.left,height:n.height||n.bottom-n.top}}export function getElementRect(t){const n=getElementClientRect(t);if(!e.isIOS7&&n){const e=getScrollXY(o.getWindow(t));n.left+=e.x,n.right+=e.x,n.top+=e.y,n.bottom+=e.y}return n}export function getPath(e){const t=[];for(;e;)t.push(e),e=parentNode(e);return t}export function trySelector(e){return!!n.string(e)&&(t.document.querySelector(e),!0)} | ||
import e from"./browser.min.js";import t from"./domObjects.min.js";import n from"./is.min.js";import*as o from"./window.min.js";export function nodeContains(e,t){if(e.contains)return e.contains(t);for(;t;){if(t===e)return!0;t=t.parentNode}return!1}export function closest(e,t){for(;n.element(e);){if(matchesSelector(e,t))return e;e=parentNode(e)}return null}export function parentNode(e){let t=e.parentNode;if(n.docFrag(t)){for(;(t=t.host)&&n.docFrag(t););return t}return t}export function matchesSelector(t,n){return o.window!==o.realWindow&&(n=n.replace(/\/deep\//g," ")),t[e.prefixedMatchesSelector](n)}const r=e=>e.parentNode||e.host;export function indexOfDeepestElement(e){let n,o=[];for(let l=0;l<e.length;l++){const u=e[l],f=e[n];if(!u||l===n)continue;if(!f){n=l;continue}const s=r(u),m=r(f);if(s===u.ownerDocument)continue;if(m===u.ownerDocument){n=l;continue}if(s===m){c(u,f)&&(n=l);continue}let p;if(o=o.length?o:i(f),f instanceof t.HTMLElement&&u instanceof t.SVGElement&&!(u instanceof t.SVGSVGElement)){if(u===m)continue;p=u.ownerSVGElement}else p=u;const d=i(p,f.ownerDocument);let a=0;for(;d[a]&&d[a]===o[a];)a++;const g=[d[a-1],d[a],o[a]];let h=g[0].lastChild;for(;h;){if(h===g[1]){n=l,o=d;break}if(h===g[2])break;h=h.previousSibling}}return n}function i(e,t){const n=[];let o,i=e;for(;(o=r(i))&&i!==t&&o!==i.ownerDocument;)n.unshift(i),i=o;return n}function c(e,t){return(parseInt(o.getWindow(e).getComputedStyle(e).zIndex,10)||0)>=(parseInt(o.getWindow(t).getComputedStyle(t).zIndex,10)||0)}export function matchesUpTo(e,t,o){for(;n.element(e);){if(matchesSelector(e,t))return!0;if((e=parentNode(e))===o)return matchesSelector(e,t)}return!1}export function getActualElement(e){return e.correspondingUseElement||e}export function getScrollXY(e){return{x:(e=e||o.window).scrollX||e.document.documentElement.scrollLeft,y:e.scrollY||e.document.documentElement.scrollTop}}export function getElementClientRect(e){const n=e instanceof t.SVGElement?e.getBoundingClientRect():e.getClientRects()[0];return n&&{left:n.left,right:n.right,top:n.top,bottom:n.bottom,width:n.width||n.right-n.left,height:n.height||n.bottom-n.top}}export function getElementRect(t){const n=getElementClientRect(t);if(!e.isIOS7&&n){const e=getScrollXY(o.getWindow(t));n.left+=e.x,n.right+=e.x,n.top+=e.y,n.bottom+=e.y}return n}export function getPath(e){const t=[];for(;e;)t.push(e),e=parentNode(e);return t}export function trySelector(e){return!!n.string(e)&&(t.document.querySelector(e),!0)} | ||
//# sourceMappingURL=domUtils.min.js.map |
import isWindow from "./isWindow.js"; | ||
import win from "./window.js"; | ||
import * as win from "./window.js"; | ||
@@ -4,0 +4,0 @@ const window = thing => thing === win.window || isWindow(thing); |
@@ -1,2 +0,2 @@ | ||
import t from"./isWindow.min.js";import e from"./window.min.js";const n=t=>!!t&&"object"==typeof t,o=t=>"function"==typeof t;export default{window(n){return n===e.window||t(n)},docFrag(t){return n(t)&&11===t.nodeType},object:n,func:o,number(t){return"number"==typeof t},bool(t){return"boolean"==typeof t},string(t){return"string"==typeof t},element(t){if(!t||"object"!=typeof t)return!1;const n=e.getWindow(t)||e.window;return/object|function/.test(typeof n.Element)?t instanceof n.Element:1===t.nodeType&&"string"==typeof t.nodeName},plainObject(t){return n(t)&&!!t.constructor&&/function Object\b/.test(t.constructor.toString())},array(t){return n(t)&&void 0!==t.length&&o(t.splice)}}; | ||
import t from"./isWindow.min.js";import*as e from"./window.min.js";const n=t=>!!t&&"object"==typeof t,o=t=>"function"==typeof t;export default{window(n){return n===e.window||t(n)},docFrag(t){return n(t)&&11===t.nodeType},object:n,func:o,number(t){return"number"==typeof t},bool(t){return"boolean"==typeof t},string(t){return"string"==typeof t},element(t){if(!t||"object"!=typeof t)return!1;const n=e.getWindow(t)||e.window;return/object|function/.test(typeof n.Element)?t instanceof n.Element:1===t.nodeType&&"string"==typeof t.nodeName},plainObject(t){return n(t)&&!!t.constructor&&/function Object\b/.test(t.constructor.toString())},array(t){return n(t)&&void 0!==t.length&&o(t.splice)}}; | ||
//# sourceMappingURL=is.min.js.map |
@@ -1,2 +0,2 @@ | ||
import win from "./window.js"; | ||
import { window } from "./window.js"; | ||
export function warnOnce(method, message) { | ||
@@ -6,3 +6,3 @@ let warned = false; | ||
if (!warned) { | ||
win.window.console.warn(message); | ||
window.console.warn(message); | ||
warned = true; | ||
@@ -9,0 +9,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import n from"./window.min.js";export function warnOnce(e,o){let r=!1;return function(){return r||(n.window.console.warn(o),r=!0),e.apply(this,arguments)}}export function copyAction(n,e){return n.name=e.name,n.axis=e.axis,n.edges=e.edges,n} | ||
import{window as n}from"./window.min.js";export function warnOnce(e,o){let r=!1;return function(){return r||(n.console.warn(o),r=!0),e.apply(this,arguments)}}export function copyAction(n,e){return n.name=e.name,n.axis=e.axis,n.edges=e.edges,n} | ||
//# sourceMappingURL=misc.min.js.map |
{ | ||
"name": "@interactjs/utils", | ||
"version": "1.9.20", | ||
"version": "1.9.21", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -79,12 +79,7 @@ import browser from "./browser.js"; | ||
} | ||
export function setCoords(targetObj, pointers, timeStamp) { | ||
export function setCoords(dest, pointers, timeStamp) { | ||
const pointer = pointers.length > 1 ? pointerAverage(pointers) : pointers[0]; | ||
const tmpXY = {}; | ||
getPageXY(pointer, tmpXY); | ||
targetObj.page.x = tmpXY.x; | ||
targetObj.page.y = tmpXY.y; | ||
getClientXY(pointer, tmpXY); | ||
targetObj.client.x = tmpXY.x; | ||
targetObj.client.y = tmpXY.y; | ||
targetObj.timeStamp = timeStamp; | ||
getPageXY(pointer, dest.page); | ||
getClientXY(pointer, dest.client); | ||
dest.timeStamp = timeStamp; | ||
} | ||
@@ -138,3 +133,3 @@ export function getTouchPair(event) { | ||
export function touchBBox(event) { | ||
if (!event.length && !(event.touches && event.touches.length > 1)) { | ||
if (!event.length) { | ||
return null; | ||
@@ -141,0 +136,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import t from"./browser.min.js";import e from"./domObjects.min.js";import*as n from"./domUtils.min.js";import o from"./hypot.min.js";import r from"./is.min.js";import i from"./pointerExtend.min.js";export function copyCoords(t,e){t.page=t.page||{},t.page.x=e.page.x,t.page.y=e.page.y,t.client=t.client||{},t.client.x=e.client.x,t.client.y=e.client.y,t.timeStamp=e.timeStamp}export function setCoordDeltas(t,e,n){t.page.x=n.page.x-e.page.x,t.page.y=n.page.y-e.page.y,t.client.x=n.client.x-e.client.x,t.client.y=n.client.y-e.client.y,t.timeStamp=n.timeStamp-e.timeStamp}export function setCoordVelocity(t,e){const n=Math.max(e.timeStamp/1e3,.001);t.page.x=e.page.x/n,t.page.y=e.page.y/n,t.client.x=e.client.x/n,t.client.y=e.client.y/n,t.timeStamp=n}export function setZeroCoords(t){t.page.x=0,t.page.y=0,t.client.x=0,t.client.y=0}export function isNativePointer(t){return t instanceof e.Event||t instanceof e.Touch}export function getXY(t,e,n){return t=t||"page",(n=n||{}).x=e[t+"X"],n.y=e[t+"Y"],n}export function getPageXY(e,n){return n=n||{x:0,y:0},t.isOperaMobile&&isNativePointer(e)?(getXY("screen",e,n),n.x+=window.scrollX,n.y+=window.scrollY):getXY("page",e,n),n}export function getClientXY(e,n){return n=n||{},t.isOperaMobile&&isNativePointer(e)?getXY("screen",e,n):getXY("client",e,n),n}export function getPointerId(t){return r.number(t.pointerId)?t.pointerId:t.identifier}export function setCoords(t,e,n){const o=e.length>1?pointerAverage(e):e[0],r={};getPageXY(o,r),t.page.x=r.x,t.page.y=r.y,getClientXY(o,r),t.client.x=r.x,t.client.y=r.y,t.timeStamp=n}export function getTouchPair(t){const e=[];return r.array(t)?(e[0]=t[0],e[1]=t[1]):"touchend"===t.type?1===t.touches.length?(e[0]=t.touches[0],e[1]=t.changedTouches[0]):0===t.touches.length&&(e[0]=t.changedTouches[0],e[1]=t.changedTouches[1]):(e[0]=t.touches[0],e[1]=t.touches[1]),e}export function pointerAverage(t){const e={pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0};for(const n of t)for(const t in e)e[t]+=n[t];for(const n in e)e[n]/=t.length;return e}export function touchBBox(t){if(!(t.length||t.touches&&t.touches.length>1))return null;const e=getTouchPair(t),n=Math.min(e[0].pageX,e[1].pageX),o=Math.min(e[0].pageY,e[1].pageY),r=Math.max(e[0].pageX,e[1].pageX),i=Math.max(e[0].pageY,e[1].pageY);return{x:n,y:o,left:n,top:o,right:r,bottom:i,width:r-n,height:i-o}}export function touchDistance(t,e){const n=e+"X",r=e+"Y",i=getTouchPair(t),c=i[0][n]-i[1][n],p=i[0][r]-i[1][r];return o(c,p)}export function touchAngle(t,e){const n=e+"X",o=e+"Y",r=getTouchPair(t),i=r[1][n]-r[0][n],c=r[1][o]-r[0][o];return 180*Math.atan2(c,i)/Math.PI}export function getPointerType(t){return r.string(t.pointerType)?t.pointerType:r.number(t.pointerType)?[void 0,void 0,"touch","pen","mouse"][t.pointerType]:/touch/.test(t.type)||t instanceof e.Touch?"touch":"mouse"}export function getEventTargets(t){const e=r.func(t.composedPath)?t.composedPath():t.path;return[n.getActualElement(e?e[0]:t.target),n.getActualElement(t.currentTarget)]}export function newCoords(){return{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0}}export function coordsToEvent(t){return{coords:t,get page(){return this.coords.page},get client(){return this.coords.client},get timeStamp(){return this.coords.timeStamp},get pageX(){return this.coords.page.x},get pageY(){return this.coords.page.y},get clientX(){return this.coords.client.x},get clientY(){return this.coords.client.y},get pointerId(){return this.coords.pointerId},get target(){return this.coords.target},get type(){return this.coords.type},get pointerType(){return this.coords.pointerType},get buttons(){return this.coords.buttons},preventDefault(){}}}export{i as pointerExtend}; | ||
import t from"./browser.min.js";import e from"./domObjects.min.js";import*as n from"./domUtils.min.js";import o from"./hypot.min.js";import r from"./is.min.js";import i from"./pointerExtend.min.js";export function copyCoords(t,e){t.page=t.page||{},t.page.x=e.page.x,t.page.y=e.page.y,t.client=t.client||{},t.client.x=e.client.x,t.client.y=e.client.y,t.timeStamp=e.timeStamp}export function setCoordDeltas(t,e,n){t.page.x=n.page.x-e.page.x,t.page.y=n.page.y-e.page.y,t.client.x=n.client.x-e.client.x,t.client.y=n.client.y-e.client.y,t.timeStamp=n.timeStamp-e.timeStamp}export function setCoordVelocity(t,e){const n=Math.max(e.timeStamp/1e3,.001);t.page.x=e.page.x/n,t.page.y=e.page.y/n,t.client.x=e.client.x/n,t.client.y=e.client.y/n,t.timeStamp=n}export function setZeroCoords(t){t.page.x=0,t.page.y=0,t.client.x=0,t.client.y=0}export function isNativePointer(t){return t instanceof e.Event||t instanceof e.Touch}export function getXY(t,e,n){return t=t||"page",(n=n||{}).x=e[t+"X"],n.y=e[t+"Y"],n}export function getPageXY(e,n){return n=n||{x:0,y:0},t.isOperaMobile&&isNativePointer(e)?(getXY("screen",e,n),n.x+=window.scrollX,n.y+=window.scrollY):getXY("page",e,n),n}export function getClientXY(e,n){return n=n||{},t.isOperaMobile&&isNativePointer(e)?getXY("screen",e,n):getXY("client",e,n),n}export function getPointerId(t){return r.number(t.pointerId)?t.pointerId:t.identifier}export function setCoords(t,e,n){const o=e.length>1?pointerAverage(e):e[0];getPageXY(o,t.page),getClientXY(o,t.client),t.timeStamp=n}export function getTouchPair(t){const e=[];return r.array(t)?(e[0]=t[0],e[1]=t[1]):"touchend"===t.type?1===t.touches.length?(e[0]=t.touches[0],e[1]=t.changedTouches[0]):0===t.touches.length&&(e[0]=t.changedTouches[0],e[1]=t.changedTouches[1]):(e[0]=t.touches[0],e[1]=t.touches[1]),e}export function pointerAverage(t){const e={pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0};for(const n of t)for(const t in e)e[t]+=n[t];for(const n in e)e[n]/=t.length;return e}export function touchBBox(t){if(!t.length)return null;const e=getTouchPair(t),n=Math.min(e[0].pageX,e[1].pageX),o=Math.min(e[0].pageY,e[1].pageY),r=Math.max(e[0].pageX,e[1].pageX),i=Math.max(e[0].pageY,e[1].pageY);return{x:n,y:o,left:n,top:o,right:r,bottom:i,width:r-n,height:i-o}}export function touchDistance(t,e){const n=e+"X",r=e+"Y",i=getTouchPair(t),c=i[0][n]-i[1][n],p=i[0][r]-i[1][r];return o(c,p)}export function touchAngle(t,e){const n=e+"X",o=e+"Y",r=getTouchPair(t),i=r[1][n]-r[0][n],c=r[1][o]-r[0][o];return 180*Math.atan2(c,i)/Math.PI}export function getPointerType(t){return r.string(t.pointerType)?t.pointerType:r.number(t.pointerType)?[void 0,void 0,"touch","pen","mouse"][t.pointerType]:/touch/.test(t.type)||t instanceof e.Touch?"touch":"mouse"}export function getEventTargets(t){const e=r.func(t.composedPath)?t.composedPath():t.path;return[n.getActualElement(e?e[0]:t.target),n.getActualElement(t.currentTarget)]}export function newCoords(){return{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0}}export function coordsToEvent(t){return{coords:t,get page(){return this.coords.page},get client(){return this.coords.client},get timeStamp(){return this.coords.timeStamp},get pageX(){return this.coords.page.x},get pageY(){return this.coords.page.y},get clientX(){return this.coords.client.x},get clientY(){return this.coords.client.y},get pointerId(){return this.coords.pointerId},get target(){return this.coords.target},get type(){return this.coords.type},get pointerType(){return this.coords.pointerType},get buttons(){return this.coords.buttons},preventDefault(){}}}export{i as pointerExtend}; | ||
//# sourceMappingURL=pointerUtils.min.js.map |
@@ -18,2 +18,5 @@ let lastTime = 0; | ||
request = request && request.bind(window); | ||
cancel = cancel && cancel.bind(window); | ||
if (!request) { | ||
@@ -24,3 +27,3 @@ request = callback => { | ||
const token = setTimeout(() => { | ||
const token = window.setTimeout(() => { | ||
callback(currTime + timeToCall); | ||
@@ -27,0 +30,0 @@ }, timeToCall); |
@@ -1,2 +0,2 @@ | ||
let e,t,n=0;export default{request(t){return e(t)},cancel(e){return t(e)},init(a){if(e=a.requestAnimationFrame,t=a.cancelAnimationFrame,!e){const n=["ms","moz","webkit","o"];for(const i of n)e=a[i+"RequestAnimationFrame"],t=a[i+"CancelAnimationFrame"]||a[i+"CancelRequestAnimationFrame"]}e||(e=e=>{const t=Date.now(),a=Math.max(0,16-(t-n)),i=setTimeout(()=>{e(t+a)},a);return n=t+a,i},t=e=>clearTimeout(e))}}; | ||
let e,t,n=0;export default{request(t){return e(t)},cancel(e){return t(e)},init(a){if(e=a.requestAnimationFrame,t=a.cancelAnimationFrame,!e){const n=["ms","moz","webkit","o"];for(const i of n)e=a[i+"RequestAnimationFrame"],t=a[i+"CancelAnimationFrame"]||a[i+"CancelRequestAnimationFrame"]}e=e&&e.bind(a),t=t&&t.bind(a),e||(e=e=>{const t=Date.now(),i=Math.max(0,16-(t-n)),o=a.setTimeout(()=>{e(t+i)},i);return n=t+i,o},t=e=>clearTimeout(e))}}; | ||
//# sourceMappingURL=raf.min.js.map |
import isWindow from "./isWindow.js"; | ||
const win = { | ||
realWindow: undefined, | ||
window: undefined, | ||
getWindow, | ||
init | ||
}; | ||
export let realWindow = undefined; | ||
let win = undefined; | ||
export { win as window }; | ||
export function init(window) { | ||
// get wrapped window if using Shadow DOM polyfill | ||
win.realWindow = window; // create a TextNode | ||
realWindow = window; // create a TextNode | ||
@@ -19,9 +16,6 @@ const el = window.document.createTextNode(''); // check if it's wrapped by a polyfill | ||
win.window = window; | ||
win = window; | ||
} | ||
if (typeof window === 'undefined') { | ||
win.window = undefined; | ||
win.realWindow = undefined; | ||
} else { | ||
if (typeof window !== 'undefined' && !!window) { | ||
init(window); | ||
@@ -38,4 +32,2 @@ } | ||
} | ||
win.init = init; | ||
export default win; | ||
//# sourceMappingURL=window.js.map |
@@ -1,2 +0,2 @@ | ||
import i from"./isWindow.min.js";const n={realWindow:void 0,window:void 0,getWindow:getWindow,init:init};export function init(i){n.realWindow=i;const o=i.document.createTextNode("");o.ownerDocument!==i.document&&"function"==typeof i.wrap&&i.wrap(o)===o&&(i=i.wrap(i)),n.window=i}"undefined"==typeof window?(n.window=void 0,n.realWindow=void 0):init(window);export function getWindow(o){if(i(o))return o;return(o.ownerDocument||o).defaultView||n.window}n.init=init;export default n; | ||
import o from"./isWindow.min.js";export let realWindow=void 0;let n=void 0;export{n as window};export function init(o){realWindow=o;const e=o.document.createTextNode("");e.ownerDocument!==o.document&&"function"==typeof o.wrap&&o.wrap(e)===e&&(o=o.wrap(o)),n=o}"undefined"!=typeof window&&window&&init(window);export function getWindow(e){if(o(e))return e;return(e.ownerDocument||e).defaultView||n.window} | ||
//# sourceMappingURL=window.min.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158686
812