@reimujs/aos 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/dist/aos.umd.js +1 -1
  2. package/package.json +11 -7
package/dist/aos.umd.js CHANGED
@@ -1 +1 @@
1
- !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).AOS=t()}(this,(function(){"use strict";const e=/iphone|ipod|android.*mobile|windows phone|blackberry|opera mini|mobile|phone/i,t=/ipad|android(?!.*mobile)|tablet|kindle/i,n=e=>e.test(navigator.userAgent),i=(e,t)=>document.dispatchEvent(new CustomEvent(e,{detail:t})),s=(e,t)=>{if(e.animated===t)return;const{options:n,node:s}=e,o=t?"aos:in":"aos:out",a=t?"add":"remove";n.animatedClassNames?.forEach((e=>s.classList[a](e))),i(o,s),n.id&&i(`${o}:${n.id}`,s),e.animated=t};var o=(e,t)=>{e.forEach((e=>((e,t)=>{const{options:n,position:i}=e;n.mirror&&t>=i.out&&!n.once?s(e,!1):t>=i.in?s(e,!0):e.animated&&!n.once&&s(e,!1)})(e,(e=>e===window?e.pageYOffset:e.scrollTop)(t))))},a=(e,t,n)=>{const i=e.getAttribute(`data-aos-${t}`);return"true"===i||"false"!==i&&(i||n)};const r=function(e,t){let n=0;for(;e;)n+=e.offsetTop-("BODY"!=e.tagName?e.scrollTop:0),e=e.offsetParent===t?null:e.offsetParent;return n},l=(e,t)=>{const n=a(e,"anchor");if(n){const e=(t===window?document:t).querySelector(n);if(e)return e}return e},d=(e,t,n,i)=>{const s=(e=>e===window?e.innerHeight:e.clientHeight)(i),o=a(e,"anchor-placement"),d=Number(a(e,"offset",o?0:t)),c=o||n,h=l(e,i);let m=r(h,i)-s;const[u,f]=c.split("-");return"center"===f?m+=s/2:"top"===f&&(m+=s),"center"===u?m+=h.offsetHeight/2:"bottom"===u&&(m+=h.offsetHeight),m+d},c=(e,t,n)=>{const i=a(e,"offset",t),s=l(e,n);return r(s,n)+s.offsetHeight-i},h=e=>[...e].some((e=>e.dataset?.aos||e.children&&h(e.children))),m={offset:120,delay:0,easing:"ease",duration:400,disable:!1,once:!1,mirror:!1,anchorPlacement:"top-bottom",startEvent:"DOMContentLoaded",animatedClassName:"aos-animate",initClassName:"aos-init",useClassNames:!1,disableMutationObserver:!1,throttleDelay:99,debounceDelay:50,container:window};class u{elements=[];initialized=!1;options=m;container=null;observer=null;scrollHandler=null;resizeHandler=null;startHandler=null;static getElements(e){return[...(e===window?document:e).querySelectorAll("[data-aos]")].map((e=>({node:e})))}static isDisabled(i){return!0===i||"mobile"===i&&(n(e)||n(t))||"phone"===i&&n(e)||"tablet"===i&&n(t)||"function"==typeof i&&i()}initializeScroll(){const{container:e}=this;return this.elements=function(e,t,n){return e.forEach((e=>{const{node:i}=e,s=a(i,"mirror",t.mirror),o=a(i,"once",t.once),r=a(i,"id"),l=t.useClassNames&&i.getAttribute("data-aos")?.split(" ")||[],h=[t.animatedClassName,...l].filter((e=>"string"==typeof e));t.initClassName&&i.classList.add(t.initClassName),e.position={in:d(i,t.offset,t.anchorPlacement,n),out:s&&c(i,t.offset,n)},e.options={once:o,mirror:s,animatedClassNames:h,id:r}})),e}(this.elements,this.options,e),o(this.elements,this.container),this.scrollHandler=function(e,t){let n,i;return(...s)=>{const o=Date.now();!i||o-i>=t?(e(...s),i=o):(clearTimeout(n),n=setTimeout((()=>{e(...s),i=Date.now()}),t-(o-i)))}}((()=>{o(this.elements,e)}),this.options.throttleDelay),e.addEventListener("scroll",this.scrollHandler,{passive:!0}),this.elements}init(e={}){this.destroy(),this.options={...m,...e};const t=(e=>e instanceof Element||e===window?e:"string"==typeof e?document.querySelector(e):null)(this.options.container);if(!t)throw"AOS - cannot find the container element. The container option must be an HTMLElement or a CSS Selector.";if(this.elements=u.getElements(t),this.container=t,u.isDisabled(this.options.disable))return this.disable();this.options.disableMutationObserver||(this.observer=(e=>{const t=new MutationObserver((t=>{t?.some((({addedNodes:e,removedNodes:t})=>h([...e,...t])))&&e()}));return t.observe(document.documentElement,{childList:!0,subtree:!0}),t})(this.refreshHard.bind(this))),document.body.setAttribute("data-aos-easing",this.options.easing),document.body.setAttribute("data-aos-duration",this.options.duration),document.body.setAttribute("data-aos-delay",this.options.delay),this.startHandler={handler:this.refresh.bind(this),type:"document"},["DOMContentLoaded","load"].includes(this.options.startEvent)?(window.addEventListener("load",this.startHandler.handler),this.startHandler.type="window"):document.addEventListener(this.options.startEvent,this.startHandler.handler),"DOMContentLoaded"===this.options.startEvent&&["complete","interactive"].indexOf(document.readyState)>-1&&this.refresh(!0),this.resizeHandler=function(e,t){let n;return(...i)=>{clearTimeout(n),n=setTimeout((()=>e(...i)),t)}}(this.refresh.bind(this),this.options.debounceDelay),window.addEventListener("resize",this.resizeHandler),window.addEventListener("orientationchange",this.resizeHandler)}refresh(e=!1){e&&(this.initialized=!0),this.initialized&&this.initializeScroll()}refreshHard(){if(this.elements=u.getElements(this.container),u.isDisabled(this.options.disable))return this.disable();this.refresh()}disable(){this.elements.forEach((({node:e})=>{e.removeAttribute("data-aos"),e.removeAttribute("data-aos-easing"),e.removeAttribute("data-aos-duration"),e.removeAttribute("data-aos-delay"),this.options.initClassName&&e.classList.remove(this.options.initClassName),this.options.animatedClassName&&e.classList.remove(this.options.animatedClassName)}))}destroy(){if(this.observer?.disconnect(),this.observer=null,this.startHandler){const{handler:e,type:t}=this.startHandler;"document"===t?document.removeEventListener(this.options.startEvent,e):window.removeEventListener("load",e),this.startHandler=null}this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),window.removeEventListener("orientationchange",this.resizeHandler),this.resizeHandler=null)}}return new u}));
1
+ !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).AOS=t()}(this,function(){"use strict";const e=/iphone|ipod|android.*mobile|windows phone|blackberry|opera mini|mobile|phone/i,t=/ipad|android(?!.*mobile)|tablet|kindle/i,n=e=>e.test(navigator.userAgent),i=(e,t)=>document.dispatchEvent(new CustomEvent(e,{detail:t})),s=(e,t)=>{if(e.animated===t)return;const{options:n,node:s}=e,o=t?"aos:in":"aos:out",a=t?"add":"remove";n.animatedClassNames?.forEach(e=>s.classList[a](e)),i(o,s),n.id&&i(`${o}:${n.id}`,s),e.animated=t};var o=(e,t)=>{e.forEach(e=>((e,t)=>{const{options:n,position:i}=e;n.mirror&&t>=i.out&&!n.once?s(e,!1):t>=i.in?s(e,!0):e.animated&&!n.once&&s(e,!1)})(e,(e=>e===window?e.pageYOffset:e.scrollTop)(t)))},a=(e,t,n)=>{const i=e.getAttribute(`data-aos-${t}`);return"true"===i||"false"!==i&&(i||n)};const r=function(e,t){let n=0;for(;e;)n+=e.offsetTop-("BODY"!=e.tagName?e.scrollTop:0),e=e.offsetParent===t?null:e.offsetParent;return n},l=(e,t)=>{const n=a(e,"anchor");if(n){const e=(t===window?document:t).querySelector(n);if(e)return e}return e},d=(e,t,n,i)=>{const s=(e=>e===window?e.innerHeight:e.clientHeight)(i),o=a(e,"anchor-placement"),d=Number(a(e,"offset",o?0:t)),c=o||n,h=l(e,i);let m=r(h,i)-s;const[u,f]=c.split("-");return"center"===f?m+=s/2:"top"===f&&(m+=s),"center"===u?m+=h.offsetHeight/2:"bottom"===u&&(m+=h.offsetHeight),m+d},c=(e,t,n)=>{const i=a(e,"offset",t),s=l(e,n);return r(s,n)+s.offsetHeight-i},h=e=>[...e].some(e=>e.dataset?.aos||e.children&&h(e.children)),m={offset:120,delay:0,easing:"ease",duration:400,disable:!1,once:!1,mirror:!1,anchorPlacement:"top-bottom",startEvent:"DOMContentLoaded",animatedClassName:"aos-animate",initClassName:"aos-init",useClassNames:!1,disableMutationObserver:!1,throttleDelay:99,debounceDelay:50,container:window};class u{elements=[];initialized=!1;options=m;container=null;observer=null;scrollHandler=null;resizeHandler=null;startHandler=null;static getElements(e){return[...(e===window?document:e).querySelectorAll("[data-aos]")].map(e=>({node:e}))}static isDisabled(i){return!0===i||"mobile"===i&&(n(e)||n(t))||"phone"===i&&n(e)||"tablet"===i&&n(t)||"function"==typeof i&&i()}initializeScroll(){const{container:e}=this;return this.elements=function(e,t,n){return e.forEach(e=>{const{node:i}=e,s=a(i,"mirror",t.mirror),o=a(i,"once",t.once),r=a(i,"id"),l=t.useClassNames&&i.getAttribute("data-aos")?.split(" ")||[],h=[t.animatedClassName,...l].filter(e=>"string"==typeof e);t.initClassName&&i.classList.add(t.initClassName),e.position={in:d(i,t.offset,t.anchorPlacement,n),out:s&&c(i,t.offset,n)},e.options={once:o,mirror:s,animatedClassNames:h,id:r}}),e}(this.elements,this.options,e),o(this.elements,this.container),this.scrollHandler=function(e,t){let n,i;return(...s)=>{const o=Date.now();!i||o-i>=t?(e(...s),i=o):(clearTimeout(n),n=setTimeout(()=>{e(...s),i=Date.now()},t-(o-i)))}}(()=>{o(this.elements,e)},this.options.throttleDelay),e.addEventListener("scroll",this.scrollHandler,{passive:!0}),this.elements}init(e={}){this.destroy(),this.options={...m,...e};const t=(e=>e instanceof Element||e===window?e:"string"==typeof e?document.querySelector(e):null)(this.options.container);if(!t)throw"AOS - cannot find the container element. The container option must be an HTMLElement or a CSS Selector.";if(this.elements=u.getElements(t),this.container=t,u.isDisabled(this.options.disable))return this.disable();this.options.disableMutationObserver||(this.observer=(e=>{const t=new MutationObserver(t=>{t?.some(({addedNodes:e,removedNodes:t})=>h([...e,...t]))&&e()});return t.observe(document.documentElement,{childList:!0,subtree:!0}),t})(this.refreshHard.bind(this))),document.body.setAttribute("data-aos-easing",this.options.easing),document.body.setAttribute("data-aos-duration",this.options.duration),document.body.setAttribute("data-aos-delay",this.options.delay),this.startHandler={handler:this.refresh.bind(this),type:"document"},["DOMContentLoaded","load"].includes(this.options.startEvent)?(window.addEventListener("load",this.startHandler.handler),this.startHandler.type="window"):document.addEventListener(this.options.startEvent,this.startHandler.handler),"DOMContentLoaded"===this.options.startEvent&&["complete","interactive"].indexOf(document.readyState)>-1&&this.refresh(!0),this.resizeHandler=function(e,t){let n;return(...i)=>{clearTimeout(n),n=setTimeout(()=>e(...i),t)}}(this.refresh.bind(this),this.options.debounceDelay),window.addEventListener("resize",this.resizeHandler),window.addEventListener("orientationchange",this.resizeHandler)}refresh(e=!1){e&&(this.initialized=!0),this.initialized&&this.initializeScroll()}refreshHard(){if(this.elements=u.getElements(this.container),u.isDisabled(this.options.disable))return this.disable();this.refresh()}disable(){this.elements.forEach(({node:e})=>{e.removeAttribute("data-aos"),e.removeAttribute("data-aos-easing"),e.removeAttribute("data-aos-duration"),e.removeAttribute("data-aos-delay"),this.options.initClassName&&e.classList.remove(this.options.initClassName),this.options.animatedClassName&&e.classList.remove(this.options.animatedClassName)})}destroy(){if(this.observer?.disconnect(),this.observer=null,this.startHandler){const{handler:e,type:t}=this.startHandler;"document"===t?document.removeEventListener(this.options.startEvent,e):window.removeEventListener("load",e),this.startHandler=null}this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),window.removeEventListener("orientationchange",this.resizeHandler),this.resizeHandler=null)}}return new u});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reimujs/aos",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "main": "dist/aos.cjs.js",
5
5
  "module": "dist/aos.esm.js",
6
6
  "browser": "dist/aos.umd.js",
@@ -29,16 +29,20 @@
29
29
  "description": "Animate on scroll library",
30
30
  "devDependencies": {
31
31
  "@rollup/plugin-node-resolve": "^16.0.3",
32
- "@rollup/plugin-terser": "^0.4.4",
32
+ "@rollup/plugin-terser": "^1.0.0",
33
33
  "@rollup/plugin-typescript": "^12.3.0",
34
- "@vitest/coverage-v8": "^4.0.14",
35
- "jsdom": "^27.2.0",
36
- "rollup": "^4.53.3",
34
+ "@vitest/coverage-v8": "^4.1.10",
35
+ "jsdom": "^29.1.1",
36
+ "rollup": "^4.62.2",
37
37
  "rollup-plugin-scss": "^3.0.0",
38
- "sass": "^1.94.2",
38
+ "sass": "^1.102.0",
39
39
  "tslib": "^2.8.1",
40
40
  "typescript": "^5.9.3",
41
- "vitest": "^4.0.14"
41
+ "vitest": "^4.1.10"
42
+ },
43
+ "publishConfig": {
44
+ "provenance": true,
45
+ "access": "public"
42
46
  },
43
47
  "repository": {
44
48
  "type": "git",