@motionone/dom
Advanced tools
Comparing version 10.11.1 to 10.11.2
@@ -5,18 +5,4 @@ 'use strict'; | ||
var utils = require('@motionone/utils'); | ||
var resolveElements = require('../utils/resolve-elements.cjs.js'); | ||
let supportsDocumentRoot; | ||
function getDefaultRoot() { | ||
if (supportsDocumentRoot === undefined) { | ||
try { | ||
new IntersectionObserver(utils.noop, { root: document }); | ||
supportsDocumentRoot = true; | ||
} | ||
catch (e) { | ||
supportsDocumentRoot = false; | ||
} | ||
} | ||
return supportsDocumentRoot ? document : undefined; | ||
} | ||
const thresholds = { | ||
@@ -63,3 +49,3 @@ any: 0, | ||
const observer = new IntersectionObserver(onIntersectionChange, { | ||
root: root || getDefaultRoot(), | ||
root, | ||
rootMargin, | ||
@@ -66,0 +52,0 @@ threshold: typeof amount === "number" ? amount : thresholds[amount], |
@@ -1,17 +0,3 @@ | ||
import { noop } from '@motionone/utils'; | ||
import { resolveElements } from '../utils/resolve-elements.es.js'; | ||
let supportsDocumentRoot; | ||
function getDefaultRoot() { | ||
if (supportsDocumentRoot === undefined) { | ||
try { | ||
new IntersectionObserver(noop, { root: document }); | ||
supportsDocumentRoot = true; | ||
} | ||
catch (e) { | ||
supportsDocumentRoot = false; | ||
} | ||
} | ||
return supportsDocumentRoot ? document : undefined; | ||
} | ||
const thresholds = { | ||
@@ -58,3 +44,3 @@ any: 0, | ||
const observer = new IntersectionObserver(onIntersectionChange, { | ||
root: root || getDefaultRoot(), | ||
root, | ||
rootMargin, | ||
@@ -61,0 +47,0 @@ threshold: typeof amount === "number" ? amount : thresholds[amount], |
@@ -1,1 +0,1 @@ | ||
const e=()=>{};let t;function n(){if(void 0===t)try{new IntersectionObserver(e,{root:document}),t=!0}catch(e){t=!1}return t?document:void 0}const r={any:0,all:1};function o(e,t,{root:o,margin:c,amount:i="any"}={}){if("undefined"==typeof IntersectionObserver)return()=>{};const s=function(e,t){var n;return"string"==typeof e?t?(null!==(n=t[e])&&void 0!==n||(t[e]=document.querySelectorAll(e)),e=t[e]):e=document.querySelectorAll(e):e instanceof Element&&(e=[e]),Array.from(e||[])}(e),a=new WeakMap,u=new IntersectionObserver((e=>{e.forEach((e=>{const n=a.get(e.target);if(e.isIntersecting!==Boolean(n))if(e.isIntersecting){const n=t(e);"function"==typeof n?a.set(e.target,n):u.unobserve(e.target)}else n&&(n(e),a.delete(e.target))}))}),{root:o||n(),rootMargin:c,threshold:"number"==typeof i?i:r[i]});return s.forEach((e=>u.observe(e))),()=>u.disconnect()}export{o as inView}; | ||
const e={any:0,all:1};function t(t,n,{root:r,margin:o,amount:c="any"}={}){if("undefined"==typeof IntersectionObserver)return()=>{};const s=function(e,t){var n;return"string"==typeof e?t?(null!==(n=t[e])&&void 0!==n||(t[e]=document.querySelectorAll(e)),e=t[e]):e=document.querySelectorAll(e):e instanceof Element&&(e=[e]),Array.from(e||[])}(t),i=new WeakMap,a=new IntersectionObserver((e=>{e.forEach((e=>{const t=i.get(e.target);if(e.isIntersecting!==Boolean(t))if(e.isIntersecting){const t=n(e);"function"==typeof t?i.set(e.target,t):a.unobserve(e.target)}else t&&(t(e),i.delete(e.target))}))}),{root:r,rootMargin:o,threshold:"number"==typeof c?c:e[c]});return s.forEach((e=>a.observe(e))),()=>a.disconnect()}export{t as inView}; |
@@ -1,16 +0,2 @@ | ||
import { noop } from "@motionone/utils"; | ||
import { resolveElements } from "../utils/resolve-elements"; | ||
let supportsDocumentRoot; | ||
function getDefaultRoot() { | ||
if (supportsDocumentRoot === undefined) { | ||
try { | ||
new IntersectionObserver(noop, { root: document }); | ||
supportsDocumentRoot = true; | ||
} | ||
catch (e) { | ||
supportsDocumentRoot = false; | ||
} | ||
} | ||
return supportsDocumentRoot ? document : undefined; | ||
} | ||
const thresholds = { | ||
@@ -57,3 +43,3 @@ any: 0, | ||
const observer = new IntersectionObserver(onIntersectionChange, { | ||
root: root || getDefaultRoot(), | ||
root, | ||
rootMargin, | ||
@@ -60,0 +46,0 @@ threshold: typeof amount === "number" ? amount : thresholds[amount], |
{ | ||
"name": "@motionone/dom", | ||
"version": "10.11.1", | ||
"version": "10.11.2", | ||
"description": "A tiny, performant animation library for the DOM", | ||
@@ -55,3 +55,3 @@ "license": "MIT", | ||
], | ||
"gitHead": "25a8e264f860ca7b52f857fa48d1242542699542" | ||
"gitHead": "1dba049a7571f579e2d1221d8c1386350c29496a" | ||
} |
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
283445
4410