marquee-content 3.1.1 → 4.1.0

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 ux-ui.pro
3
+ Copyright (c) 2024 ux-ui.pro
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,32 +1,31 @@
1
1
  <br>
2
- <p align="center"><strong>marquee-content</strong></p>
3
-
4
2
  <div align="center">
5
3
 
4
+ # marquee-content
5
+ A simple, lightweight library for creating the effect of running horizontal blocks of content, also known as a marquee or ticker. Uses GSAP and Resize Observer for better performance.
6
+
6
7
  [![npm](https://img.shields.io/npm/v/marquee-content.svg?colorB=brightgreen)](https://www.npmjs.com/package/marquee-content)
7
8
  [![GitHub package version](https://img.shields.io/github/package-json/v/ux-ui-pro/marquee-content.svg)](https://github.com/ux-ui-pro/marquee-content)
8
9
  [![NPM Downloads](https://img.shields.io/npm/dm/marquee-content.svg?style=flat)](https://www.npmjs.org/package/marquee-content)
9
10
 
11
+ <sup>1kB gzipped</sup>
12
+
13
+ ### <a href="https://codepen.io/ux-ui/full/dygzqYm">Demo</a>
14
+
10
15
  </div>
11
16
 
12
- <p align="center">A simple, lightweight library for creating the effect of running horizontal blocks of content, also known as a marquee or ticker. Uses GSAP and Resize Observer for better performance.</p>
13
- <p align="center"><sup>1kB gzipped</sup></p>
14
- <p align="center"><a href="https://codepen.io/ux-ui/full/dygzqYm">Demo</a></p>
15
17
  <br>
16
18
 
17
19
  &#10148; **Install**
18
-
19
20
  ```
20
21
  yarn add gsap
21
22
  yarn add marquee-content
22
23
  ```
23
-
24
24
  <br>
25
25
 
26
26
  &#10148; **Import**
27
-
28
27
  ```javascript
29
- import gsap from 'gsap';
28
+ import { gsap } from 'gsap';
30
29
  import { ScrollTrigger } from 'gsap/ScrollTrigger';
31
30
  import MarqueeContent from 'marquee-content';
32
31
 
@@ -36,14 +35,32 @@ MarqueeContent.registerGSAP(gsap);
36
35
  <br>
37
36
 
38
37
  &#10148; **Usage**
38
+ ```javascript
39
+ const marquee = new MarqueeContent({
40
+ element: '.marquee',
41
+ });
39
42
 
40
- ```HTML
41
- <marquee-content data-mc-duration="30" role="marquee">
42
- content
43
- </marquee-content>
43
+ marquee.init();
44
+ ```
45
+ or
46
+ ```javascript
47
+ document.querySelectorAll('.marquee').forEach((element) => {
48
+ const marquee = new MarqueeContent({
49
+ element,
50
+ });
51
+
52
+ marquee.init();
53
+ });
44
54
  ```
45
55
  <br>
46
56
 
57
+ &#10148; **Options**
58
+
59
+ | Option | Type | Default | Description |
60
+ |:----------|:-----------------------------:|:-----------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
61
+ | `element` | `string` &vert; `HTMLElement` | `.marquee` | The option `element` defines the DOM element to which the animation will be applied. This option offers two ways to specify the target element:<br>**1.** As a string with a CSS selector. If `element` is given as a string, it is used to find the element in the DOM through the `document.querySelector` method. This allows for easy identification of elements by their id, class, or other selector.<br>**2.** As an HTMLElement object. If `element` is already an HTMLElement object, it is used directly, without the need for additional searching in the DOM. |
62
+ <br>
63
+
47
64
  &#10148; **Settings**
48
65
 
49
66
  | Option | Default | Description |
@@ -53,7 +70,6 @@ MarqueeContent.registerGSAP(gsap);
53
70
  | `data-mc-skew` | `null` | Transforms the component by tilting it along the Y axis (a positive or negative value is acceptable). |
54
71
  | `data-mc-min` | `null` | Sets the **minimum** width at which the animation will play (when the breakpoint intersects, the cloned elements are removed and the component styles are cleared). |
55
72
  | `data-mc-max` | `null` | Sets the **maximum** width. |
56
-
57
73
  <br>
58
74
 
59
75
  &#10148; **License**
package/dist/index.js CHANGED
@@ -10,136 +10,121 @@ function $parcel$export(e, n, v, s) {
10
10
  $parcel$defineInteropFlag(module.exports);
11
11
 
12
12
  $parcel$export(module.exports, "default", () => $4fa36e821943b400$export$2e2bcd8739ae039);
13
- function $fa2d7eec3b4b552b$var$breakpoints() {
14
- this.breakpoint = "";
15
- if (this.dataset.mcMax) this.breakpoint = `(max-width: ${this.dataset.mcMax - 0.02}px)`;
16
- else if (this.dataset.mcMin) this.breakpoint = `(min-width: ${this.dataset.mcMin}px)`;
17
- }
18
- var $fa2d7eec3b4b552b$export$2e2bcd8739ae039 = $fa2d7eec3b4b552b$var$breakpoints;
19
-
20
-
21
- function $66606e06234aec1c$var$cloning() {
13
+ const $4559ecf940edc78d$export$61fc7d43ac8f84b0 = function(func) {
14
+ let timer;
15
+ return (...args)=>{
16
+ cancelAnimationFrame(timer);
17
+ timer = requestAnimationFrame(()=>func(...args));
18
+ };
19
+ };
20
+ const $4559ecf940edc78d$export$ecad260a8a5fef4f = function(element, gsap, MM, timeline, update) {
21
+ timeline?.kill();
22
+ timeline = gsap.timeline({
23
+ scrollTrigger: {
24
+ trigger: element,
25
+ start: "top bottom",
26
+ end: "bottom top",
27
+ toggleActions: "resume pause resume pause",
28
+ onUpdate: (self)=>{
29
+ if (element.dataset.mcDirection === "ltr") timeline.timeScale(-1);
30
+ else if (element.dataset.mcDirection === "auto") timeline.timeScale(self.direction);
31
+ }
32
+ }
33
+ });
34
+ MM.add(element.dataset.mcBreakpoint, ()=>{
35
+ timeline.to(element.children, {
36
+ duration: element.dataset.mcDuration ?? 20,
37
+ x: "-100%",
38
+ repeat: -1,
39
+ ease: "none"
40
+ });
41
+ timeline.totalProgress(0.5);
42
+ return ()=>timeline?.kill();
43
+ });
44
+ update.timeline = timeline;
45
+ return timeline;
46
+ };
47
+ const $4559ecf940edc78d$export$d07517a676ce386f = function(element) {
48
+ element.dataset.mcBreakpoint = element.dataset.mcMax ? `(max-width: ${element.dataset.mcMax - 0.02}px)` : element.dataset.mcMin ? `(min-width: ${element.dataset.mcMin}px)` : "";
49
+ };
50
+ const $4559ecf940edc78d$export$6a732ac1b1fdc86b = function(timeline, element, gsap) {
51
+ timeline?.kill();
52
+ timeline = null;
53
+ gsap.set(element.children, {
54
+ clearProps: "all"
55
+ });
56
+ };
57
+ const $4559ecf940edc78d$export$7c4d14cd3c92bf0b = function(element, gsap, MM) {
22
58
  const removingClones = ()=>{
23
- while(this.childElementCount > 1)this.removeChild(this.lastChild);
59
+ while(element.childElementCount > 1)element.removeChild(element.lastChild);
24
60
  };
25
61
  removingClones();
26
- this.MM.add(this.breakpoint, ()=>{
27
- const requiredQuantity = Math.ceil(this.scrollWidth / this.firstElementChild.clientWidth + 2);
28
- if (this.childElementCount < requiredQuantity) {
62
+ MM.add(element.dataset.mcBreakpoint, ()=>{
63
+ const requiredQuantity = Math.ceil(element.scrollWidth / element.firstElementChild.clientWidth + 2);
64
+ if (element.childElementCount < requiredQuantity) {
65
+ const fragment = document.createDocumentFragment();
29
66
  const clones = Array.from({
30
67
  length: requiredQuantity - 1
31
- }, ()=>this.firstElementChild.cloneNode(true));
32
- this.append(...clones);
68
+ }, ()=>element.firstElementChild.cloneNode(true));
69
+ clones.forEach((clone)=>fragment.appendChild(clone));
70
+ element.appendChild(fragment);
33
71
  }
34
72
  return removingClones;
35
73
  });
36
- }
37
- var $66606e06234aec1c$export$2e2bcd8739ae039 = $66606e06234aec1c$var$cloning;
38
-
39
-
40
- function $8ce6f1187c98529f$var$skewed() {
41
- if (!this.dataset.mcSkew) return;
42
- const abs = Math.abs(parseInt(this.dataset.mcSkew, 10));
43
- const { style: style } = this;
44
- this.MM.add(this.breakpoint, ()=>{
45
- style.transformOrigin = "center center";
46
- style.transform = `skew(0deg, ${this.dataset.mcSkew}deg)`;
47
- style.minHeight = `calc(${abs * 1.25}vh + ${abs * 1.25}vw)`;
48
- return ()=>{
49
- style.cssText = "transform-origin: unset; transform: unset; min-height: unset;";
50
- };
51
- });
52
- }
53
- var $8ce6f1187c98529f$export$2e2bcd8739ae039 = $8ce6f1187c98529f$var$skewed;
54
-
55
-
56
- function $26261098b528e5f4$var$clearTimeline() {
57
- if (this.timeline) {
58
- this.timeline.kill();
59
- this.timeline = null;
60
- }
61
- this.gsap.set(this.children, {
62
- clearProps: true
63
- });
64
- }
65
- var $26261098b528e5f4$export$2e2bcd8739ae039 = $26261098b528e5f4$var$clearTimeline;
66
-
67
-
68
- function $7206b27cbeabecb6$var$animation() {
69
- if (this.timeline) (0, $26261098b528e5f4$export$2e2bcd8739ae039).call(this);
70
- this.MM.add(this.breakpoint, ()=>{
71
- this.timeline = this.gsap.to(this.children, {
72
- duration: this.dataset.mcDuration || 20,
73
- x: "-100%",
74
- repeat: -1,
75
- ease: "none",
76
- scrollTrigger: {
77
- trigger: this,
78
- start: "-=50% bottom",
79
- end: "bottom top",
80
- toggleActions: "resume pause resume pause",
81
- onUpdate: (self)=>{
82
- if (this.dataset.mcDirection === "ltr") this.timeline.timeScale(-1);
83
- else if (this.dataset.mcDirection === "auto") this.timeline.timeScale(self.direction);
84
- }
85
- }
86
- });
87
- this.timeline.totalProgress(0.5);
88
- return ()=>{
89
- if (this.timeline) (0, $26261098b528e5f4$export$2e2bcd8739ae039).call(this);
90
- };
91
- });
92
- }
93
- var $7206b27cbeabecb6$export$2e2bcd8739ae039 = $7206b27cbeabecb6$var$animation;
94
-
95
-
96
-
97
- class $4fa36e821943b400$export$2e2bcd8739ae039 extends HTMLElement {
98
- constructor(){
99
- super();
100
- this.gsap = $4fa36e821943b400$export$2e2bcd8739ae039.gsap || window.gsap;
101
- this.MM = this.gsap.matchMedia();
102
- this.timeline = null;
103
- this.update = this.update.bind(this);
104
- this.resizeObserver = new ResizeObserver(this.debounce(this.update.bind(this)));
105
- this.resizeObserver.observe(this);
74
+ };
75
+ const $4559ecf940edc78d$export$3484d11c6bb42ecc = function(element) {
76
+ if (!element.dataset.mcSkew) return;
77
+ const abs = Math.abs(parseInt(element.dataset.mcSkew, 10));
78
+ const { style: style } = element;
79
+ style.transformOrigin = "center center";
80
+ style.transform = `skew(0deg, ${element.dataset.mcSkew}deg)`;
81
+ style.minHeight = `calc(${abs * 1.25}vh + ${abs * 1.25}vw)`;
82
+ };
83
+
84
+
85
+ class $4fa36e821943b400$var$MarqueeContent {
86
+ #gsap;
87
+ #MM;
88
+ #timeline;
89
+ #element;
90
+ #resizeObserver;
91
+ #animationFrame;
92
+ constructor({ element: element = ".marquee" } = {}){
93
+ this.#gsap = $4fa36e821943b400$var$MarqueeContent.gsap ?? window.gsap;
94
+ this.#MM = this.#gsap.matchMedia();
95
+ this.#timeline = null;
96
+ this.#element = element instanceof HTMLElement ? element : document.querySelector(element);
97
+ if (!this.#element) return;
98
+ this.#resizeObserver = new ResizeObserver($4559ecf940edc78d$export$61fc7d43ac8f84b0(()=>this.#update()));
99
+ this.#resizeObserver.observe(this.#element);
106
100
  }
107
101
  static registerGSAP(gsap) {
108
- $4fa36e821943b400$export$2e2bcd8739ae039.gsap = gsap;
102
+ $4fa36e821943b400$var$MarqueeContent.gsap = gsap;
109
103
  }
110
- debounce = ()=>{
111
- let timer;
112
- return ()=>{
113
- cancelAnimationFrame(timer);
114
- timer = requestAnimationFrame(this.update);
115
- };
104
+ #commonInit = ()=>{
105
+ $4559ecf940edc78d$export$6a732ac1b1fdc86b(this.#timeline, this.#element, this.#gsap);
106
+ $4559ecf940edc78d$export$7c4d14cd3c92bf0b(this.#element, this.#gsap, this.#MM);
107
+ $4559ecf940edc78d$export$d07517a676ce386f(this.#element);
108
+ $4559ecf940edc78d$export$3484d11c6bb42ecc(this.#element);
109
+ this.#timeline = $4559ecf940edc78d$export$ecad260a8a5fef4f(this.#element, this.#gsap, this.#MM, this.#timeline, this);
116
110
  };
117
- update() {
118
- cancelAnimationFrame(this.af);
119
- if (this.firstElementChild) this.af = requestAnimationFrame(()=>{
120
- (0, $66606e06234aec1c$export$2e2bcd8739ae039).call(this);
121
- (0, $7206b27cbeabecb6$export$2e2bcd8739ae039).call(this);
111
+ #update = ()=>{
112
+ cancelAnimationFrame(this.#animationFrame);
113
+ this.#animationFrame = requestAnimationFrame(()=>{
114
+ this.#commonInit();
115
+ ScrollTrigger.refresh();
122
116
  });
123
- }
124
- init() {
125
- (0, $fa2d7eec3b4b552b$export$2e2bcd8739ae039).call(this);
126
- (0, $8ce6f1187c98529f$export$2e2bcd8739ae039).call(this);
127
- (0, $66606e06234aec1c$export$2e2bcd8739ae039).call(this);
128
- (0, $7206b27cbeabecb6$export$2e2bcd8739ae039).call(this);
129
- }
130
- destroy() {
131
- cancelAnimationFrame(this.af);
132
- (0, $26261098b528e5f4$export$2e2bcd8739ae039).call(this);
133
- if (this.resizeObserver) this.resizeObserver.disconnect();
134
- }
135
- connectedCallback() {
136
- this.init();
137
- }
138
- disconnectedCallback() {
139
- this.destroy();
140
- }
117
+ };
118
+ init = ()=>{
119
+ this.#commonInit();
120
+ };
121
+ destroy = ()=>{
122
+ cancelAnimationFrame(this.#animationFrame);
123
+ $4559ecf940edc78d$export$6a732ac1b1fdc86b(this.#timeline, this.#element, this.#gsap);
124
+ this.#resizeObserver?.disconnect();
125
+ };
141
126
  }
142
- if (!customElements.get("marquee-content")) customElements.define("marquee-content", $4fa36e821943b400$export$2e2bcd8739ae039);
127
+ var $4fa36e821943b400$export$2e2bcd8739ae039 = $4fa36e821943b400$var$MarqueeContent;
143
128
 
144
129
 
145
130
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;ACAA,SAAS;IACP,IAAI,CAAC,UAAU,GAAG;IAElB,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EACpB,IAAI,CAAC,UAAU,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC;SAC1D,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAC3B,IAAI,CAAC,UAAU,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;AAE5D;IAEA,2CA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C,IAAI,CAAC,IAAI;QAC5E,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI;IAClC;IAEA,OAAO,aAAa,IAAI,EAAE;QACxB,yCAAe,IAAI,GAAG;IACxB;IAEA,WAAW;QACT,IAAI;QAEJ,OAAO;YACL,qBAAqB;YACrB,QAAQ,sBAAsB,IAAI,CAAC,MAAM;QAC3C;IACF,EAAE;IAEF,SAAS;QACP,qBAAqB,IAAI,CAAC,EAAE;QAE5B,IAAI,IAAI,CAAC,iBAAiB,EACxB,IAAI,CAAC,EAAE,GAAG,sBAAsB;YAC9B,CAAA,GAAA,wCAAM,EAAE,IAAI,CAAC,IAAI;YACjB,CAAA,GAAA,wCAAQ,EAAE,IAAI,CAAC,IAAI;QACrB;IAEJ;IAEA,OAAO;QACL,CAAA,GAAA,wCAAU,EAAE,IAAI,CAAC,IAAI;QACrB,CAAA,GAAA,wCAAK,EAAE,IAAI,CAAC,IAAI;QAChB,CAAA,GAAA,wCAAM,EAAE,IAAI,CAAC,IAAI;QACjB,CAAA,GAAA,wCAAQ,EAAE,IAAI,CAAC,IAAI;IACrB;IAEA,UAAU;QACR,qBAAqB,IAAI,CAAC,EAAE;QAE5B,CAAA,GAAA,wCAAY,EAAE,IAAI,CAAC,IAAI;QAEvB,IAAI,IAAI,CAAC,cAAc,EACrB,IAAI,CAAC,cAAc,CAAC,UAAU;IAElC;IAEA,oBAAoB;QAClB,IAAI,CAAC,IAAI;IACX;IAEA,uBAAuB;QACrB,IAAI,CAAC,OAAO;IACd;AACF;AAEA,IAAI,CAAC,eAAe,GAAG,CAAC,oBACtB,eAAe,MAAM,CAAC,mBAAmB","sources":["src/index.js","src/utils/breakpoints.js","src/utils/cloning.js","src/utils/skewed.js","src/utils/animation.js","src/utils/clearTimeline.js"],"sourcesContent":["import breakpoints from './utils/breakpoints';\nimport cloning from './utils/cloning';\nimport skewed from './utils/skewed';\nimport animation from './utils/animation';\nimport clearTimeline from './utils/clearTimeline';\n\nexport default class MarqueeContent extends HTMLElement {\n constructor() {\n super();\n\n this.gsap = MarqueeContent.gsap || window.gsap;\n this.MM = this.gsap.matchMedia();\n this.timeline = null;\n this.update = this.update.bind(this);\n this.resizeObserver = new ResizeObserver(this.debounce(this.update.bind(this)));\n this.resizeObserver.observe(this);\n }\n\n static registerGSAP(gsap) {\n MarqueeContent.gsap = gsap;\n }\n\n debounce = () => {\n let timer;\n\n return () => {\n cancelAnimationFrame(timer);\n timer = requestAnimationFrame(this.update);\n };\n };\n\n update() {\n cancelAnimationFrame(this.af);\n\n if (this.firstElementChild) {\n this.af = requestAnimationFrame(() => {\n cloning.call(this);\n animation.call(this);\n });\n }\n }\n\n init() {\n breakpoints.call(this);\n skewed.call(this);\n cloning.call(this);\n animation.call(this);\n }\n\n destroy() {\n cancelAnimationFrame(this.af);\n\n clearTimeline.call(this);\n\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n }\n }\n\n connectedCallback() {\n this.init();\n }\n\n disconnectedCallback() {\n this.destroy();\n }\n}\n\nif (!customElements.get('marquee-content')) {\n customElements.define('marquee-content', MarqueeContent);\n}\n","function breakpoints() {\n this.breakpoint = '';\n\n if (this.dataset.mcMax) {\n this.breakpoint = `(max-width: ${this.dataset.mcMax - 0.02}px)`;\n } else if (this.dataset.mcMin) {\n this.breakpoint = `(min-width: ${this.dataset.mcMin}px)`;\n }\n};\n\nexport default breakpoints;\n","function cloning() {\n const removingClones = () => {\n while (this.childElementCount > 1) {\n this.removeChild(this.lastChild);\n }\n };\n\n removingClones();\n\n this.MM.add(this.breakpoint, () => {\n const requiredQuantity = Math.ceil(this.scrollWidth / this.firstElementChild.clientWidth + 2);\n\n if (this.childElementCount < requiredQuantity) {\n const clones = Array.from({ length: requiredQuantity - 1 }, () => this.firstElementChild.cloneNode(true));\n this.append(...clones);\n }\n\n return removingClones;\n });\n}\n\nexport default cloning;\n","function skewed() {\n if (!this.dataset.mcSkew) return;\n\n const abs = Math.abs(parseInt(this.dataset.mcSkew, 10));\n const { style } = this;\n\n this.MM.add(this.breakpoint, () => {\n style.transformOrigin = 'center center';\n style.transform = `skew(0deg, ${this.dataset.mcSkew}deg)`;\n style.minHeight = `calc(${abs * 1.25}vh + ${abs * 1.25}vw)`;\n\n return () => {\n style.cssText = 'transform-origin: unset; transform: unset; min-height: unset;';\n };\n });\n}\n\nexport default skewed;\n","import clearTimeline from './clearTimeline';\n\nfunction animation() {\n if (this.timeline) {\n clearTimeline.call(this);\n }\n\n this.MM.add(this.breakpoint, () => {\n this.timeline = this.gsap.to(this.children, {\n duration: this.dataset.mcDuration || 20,\n x: '-100%',\n repeat: -1,\n ease: 'none',\n scrollTrigger: {\n trigger: this,\n start: '-=50% bottom',\n end: 'bottom top',\n toggleActions: 'resume pause resume pause',\n onUpdate: (self) => {\n if (this.dataset.mcDirection === 'ltr') {\n this.timeline.timeScale(-1);\n } else if (this.dataset.mcDirection === 'auto') {\n this.timeline.timeScale(self.direction);\n }\n },\n },\n });\n\n this.timeline.totalProgress(0.5);\n\n return () => {\n if (this.timeline) {\n clearTimeline.call(this);\n }\n };\n });\n}\n\nexport default animation;\n","function clearTimeline() {\n if (this.timeline) {\n this.timeline.kill();\n this.timeline = null;\n }\n\n this.gsap.set(this.children, { clearProps: true });\n}\n\nexport default clearTimeline;\n"],"names":[],"version":3,"file":"index.js.map"}
1
+ {"mappings":";;;;;;;;;;;;ACAO,MAAM,4CAAW,SAAS,IAAI;IACnC,IAAI;IAEJ,OAAO,CAAC,GAAG;QACT,qBAAqB;QAErB,QAAQ,sBAAsB,IAAM,QAAQ;IAC9C;AACF;AAEO,MAAM,4CAAY,SAAS,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM;IACnE,UAAU;IAEV,WAAW,KAAK,QAAQ,CAAC;QACvB,eAAe;YACb,SAAS;YACT,OAAO;YACP,KAAK;YACL,eAAe;YACf,UAAU,CAAC;gBACT,IAAI,QAAQ,OAAO,CAAC,WAAW,KAAK,OAClC,SAAS,SAAS,CA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AAC,IAAI,CAAC,CAAC,OAAO;IAC5C;IAEA,OAAO,aAAa,IAAI,EAAE;QACxB,qCAAe,IAAI,GAAG;IACxB;IAEA,CAAC,UAAU,GAAG;QACZ,0CAAoB,IAAI,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI;QAC7D,0CAAc,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE;QACjD,0CAAkB,IAAI,CAAC,CAAC,OAAO;QAC/B,0CAAa,IAAI,CAAC,CAAC,OAAO;QAE1B,IAAI,CAAC,CAAC,QAAQ,GAAG,0CAAgB,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,QAAQ,EAAE,IAAI;IAC5F,EAAE;IAEF,CAAC,MAAM,GAAG;QACR,qBAAqB,IAAI,CAAC,CAAC,cAAc;QACzC,IAAI,CAAC,CAAC,cAAc,GAAG,sBAAsB;YAC3C,IAAI,CAAC,CAAC,UAAU;YAEhB,cAAc,OAAO;QACvB;IACF,EAAE;IAEF,OAAO;QACL,IAAI,CAAC,CAAC,UAAU;IAClB,EAAC;IAED,UAAU;QACR,qBAAqB,IAAI,CAAC,CAAC,cAAc;QAEzC,0CAAoB,IAAI,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI;QAE7D,IAAI,CAAC,CAAC,cAAc,EAAE;IACxB,EAAC;AACH;IAEA,2CAAe","sources":["src/index.js","src/utils.js"],"sourcesContent":["import * as Utils from './utils.js';\n\nclass MarqueeContent {\n #gsap;\n\n #MM;\n\n #timeline;\n\n #element;\n\n #resizeObserver;\n\n #animationFrame;\n\n constructor({element = '.marquee'} = {}) {\n this.#gsap = MarqueeContent.gsap ?? window.gsap;\n this.#MM = this.#gsap.matchMedia();\n this.#timeline = null;\n this.#element = element instanceof HTMLElement ? element : document.querySelector(element);\n\n if (!this.#element) return;\n\n this.#resizeObserver = new ResizeObserver(Utils.debounce(() => this.#update()));\n this.#resizeObserver.observe(this.#element);\n }\n\n static registerGSAP(gsap) {\n MarqueeContent.gsap = gsap;\n }\n\n #commonInit = () => {\n Utils.clearTimeline(this.#timeline, this.#element, this.#gsap);\n Utils.cloning(this.#element, this.#gsap, this.#MM);\n Utils.breakpoints(this.#element);\n Utils.skewed(this.#element);\n\n this.#timeline = Utils.animation(this.#element, this.#gsap, this.#MM, this.#timeline, this);\n };\n\n #update = () => {\n cancelAnimationFrame(this.#animationFrame);\n this.#animationFrame = requestAnimationFrame(() => {\n this.#commonInit();\n\n ScrollTrigger.refresh();\n });\n };\n\n init = () => {\n this.#commonInit();\n }\n\n destroy = () => {\n cancelAnimationFrame(this.#animationFrame);\n\n Utils.clearTimeline(this.#timeline, this.#element, this.#gsap);\n\n this.#resizeObserver?.disconnect();\n }\n}\n\nexport default MarqueeContent;\n","export const debounce = function(func) {\n let timer;\n\n return (...args) => {\n cancelAnimationFrame(timer);\n\n timer = requestAnimationFrame(() => func(...args));\n };\n};\n\nexport const animation = function(element, gsap, MM, timeline, update) {\n timeline?.kill();\n\n timeline = gsap.timeline({\n scrollTrigger: {\n trigger: element,\n start: 'top bottom',\n end: 'bottom top',\n toggleActions: 'resume pause resume pause',\n onUpdate: (self) => {\n if (element.dataset.mcDirection === 'ltr') {\n timeline.timeScale(-1);\n } else if (element.dataset.mcDirection === 'auto') {\n timeline.timeScale(self.direction);\n }\n },\n }\n });\n\n MM.add(element.dataset.mcBreakpoint, () => {\n timeline.to(element.children, {\n duration: element.dataset.mcDuration ?? 20,\n x: '-100%',\n repeat: -1,\n ease: 'none',\n });\n\n timeline.totalProgress(0.5);\n\n return () => timeline?.kill();\n });\n\n update.timeline = timeline;\n\n return timeline;\n};\n\nexport const breakpoints = function(element) {\n element.dataset.mcBreakpoint = element.dataset.mcMax\n ? `(max-width: ${element.dataset.mcMax - 0.02}px)`\n : element.dataset.mcMin ? `(min-width: ${element.dataset.mcMin}px)` : '';\n};\n\nexport const clearTimeline = function(timeline, element, gsap) {\n timeline?.kill();\n timeline = null;\n\n gsap.set(element.children, { clearProps: 'all' });\n};\n\nexport const cloning = function(element, gsap, MM) {\n const removingClones = () => {\n while (element.childElementCount > 1) {\n element.removeChild(element.lastChild);\n }\n };\n\n removingClones();\n\n MM.add(element.dataset.mcBreakpoint, () => {\n const requiredQuantity = Math.ceil(element.scrollWidth / element.firstElementChild.clientWidth + 2);\n\n if (element.childElementCount < requiredQuantity) {\n const fragment = document.createDocumentFragment();\n const clones = Array.from({ length: requiredQuantity - 1 }, () => element.firstElementChild.cloneNode(true));\n\n clones.forEach(clone => fragment.appendChild(clone));\n\n element.appendChild(fragment);\n }\n\n return removingClones;\n });\n};\n\nexport const skewed = function(element) {\n if (!element.dataset.mcSkew) return;\n\n const abs = Math.abs(parseInt(element.dataset.mcSkew, 10));\n const { style } = element;\n\n style.transformOrigin = 'center center';\n style.transform = `skew(0deg, ${element.dataset.mcSkew}deg)`;\n style.minHeight = `calc(${abs * 1.25}vh + ${abs * 1.25}vw)`;\n};\n"],"names":[],"version":3,"file":"index.js.map"}
@@ -1,133 +1,118 @@
1
- function $0247ba718e967cec$var$breakpoints() {
2
- this.breakpoint = "";
3
- if (this.dataset.mcMax) this.breakpoint = `(max-width: ${this.dataset.mcMax - 0.02}px)`;
4
- else if (this.dataset.mcMin) this.breakpoint = `(min-width: ${this.dataset.mcMin}px)`;
5
- }
6
- var $0247ba718e967cec$export$2e2bcd8739ae039 = $0247ba718e967cec$var$breakpoints;
7
-
8
-
9
- function $2b68722c48061d80$var$cloning() {
1
+ const $f3ad94c9f84f4d57$export$61fc7d43ac8f84b0 = function(func) {
2
+ let timer;
3
+ return (...args)=>{
4
+ cancelAnimationFrame(timer);
5
+ timer = requestAnimationFrame(()=>func(...args));
6
+ };
7
+ };
8
+ const $f3ad94c9f84f4d57$export$ecad260a8a5fef4f = function(element, gsap, MM, timeline, update) {
9
+ timeline?.kill();
10
+ timeline = gsap.timeline({
11
+ scrollTrigger: {
12
+ trigger: element,
13
+ start: "top bottom",
14
+ end: "bottom top",
15
+ toggleActions: "resume pause resume pause",
16
+ onUpdate: (self)=>{
17
+ if (element.dataset.mcDirection === "ltr") timeline.timeScale(-1);
18
+ else if (element.dataset.mcDirection === "auto") timeline.timeScale(self.direction);
19
+ }
20
+ }
21
+ });
22
+ MM.add(element.dataset.mcBreakpoint, ()=>{
23
+ timeline.to(element.children, {
24
+ duration: element.dataset.mcDuration ?? 20,
25
+ x: "-100%",
26
+ repeat: -1,
27
+ ease: "none"
28
+ });
29
+ timeline.totalProgress(0.5);
30
+ return ()=>timeline?.kill();
31
+ });
32
+ update.timeline = timeline;
33
+ return timeline;
34
+ };
35
+ const $f3ad94c9f84f4d57$export$d07517a676ce386f = function(element) {
36
+ element.dataset.mcBreakpoint = element.dataset.mcMax ? `(max-width: ${element.dataset.mcMax - 0.02}px)` : element.dataset.mcMin ? `(min-width: ${element.dataset.mcMin}px)` : "";
37
+ };
38
+ const $f3ad94c9f84f4d57$export$6a732ac1b1fdc86b = function(timeline, element, gsap) {
39
+ timeline?.kill();
40
+ timeline = null;
41
+ gsap.set(element.children, {
42
+ clearProps: "all"
43
+ });
44
+ };
45
+ const $f3ad94c9f84f4d57$export$7c4d14cd3c92bf0b = function(element, gsap, MM) {
10
46
  const removingClones = ()=>{
11
- while(this.childElementCount > 1)this.removeChild(this.lastChild);
47
+ while(element.childElementCount > 1)element.removeChild(element.lastChild);
12
48
  };
13
49
  removingClones();
14
- this.MM.add(this.breakpoint, ()=>{
15
- const requiredQuantity = Math.ceil(this.scrollWidth / this.firstElementChild.clientWidth + 2);
16
- if (this.childElementCount < requiredQuantity) {
50
+ MM.add(element.dataset.mcBreakpoint, ()=>{
51
+ const requiredQuantity = Math.ceil(element.scrollWidth / element.firstElementChild.clientWidth + 2);
52
+ if (element.childElementCount < requiredQuantity) {
53
+ const fragment = document.createDocumentFragment();
17
54
  const clones = Array.from({
18
55
  length: requiredQuantity - 1
19
- }, ()=>this.firstElementChild.cloneNode(true));
20
- this.append(...clones);
56
+ }, ()=>element.firstElementChild.cloneNode(true));
57
+ clones.forEach((clone)=>fragment.appendChild(clone));
58
+ element.appendChild(fragment);
21
59
  }
22
60
  return removingClones;
23
61
  });
24
- }
25
- var $2b68722c48061d80$export$2e2bcd8739ae039 = $2b68722c48061d80$var$cloning;
26
-
27
-
28
- function $dfb0cb0db0a7e917$var$skewed() {
29
- if (!this.dataset.mcSkew) return;
30
- const abs = Math.abs(parseInt(this.dataset.mcSkew, 10));
31
- const { style: style } = this;
32
- this.MM.add(this.breakpoint, ()=>{
33
- style.transformOrigin = "center center";
34
- style.transform = `skew(0deg, ${this.dataset.mcSkew}deg)`;
35
- style.minHeight = `calc(${abs * 1.25}vh + ${abs * 1.25}vw)`;
36
- return ()=>{
37
- style.cssText = "transform-origin: unset; transform: unset; min-height: unset;";
38
- };
39
- });
40
- }
41
- var $dfb0cb0db0a7e917$export$2e2bcd8739ae039 = $dfb0cb0db0a7e917$var$skewed;
62
+ };
63
+ const $f3ad94c9f84f4d57$export$3484d11c6bb42ecc = function(element) {
64
+ if (!element.dataset.mcSkew) return;
65
+ const abs = Math.abs(parseInt(element.dataset.mcSkew, 10));
66
+ const { style: style } = element;
67
+ style.transformOrigin = "center center";
68
+ style.transform = `skew(0deg, ${element.dataset.mcSkew}deg)`;
69
+ style.minHeight = `calc(${abs * 1.25}vh + ${abs * 1.25}vw)`;
70
+ };
42
71
 
43
72
 
44
- function $44f92944fa78205a$var$clearTimeline() {
45
- if (this.timeline) {
46
- this.timeline.kill();
47
- this.timeline = null;
48
- }
49
- this.gsap.set(this.children, {
50
- clearProps: true
51
- });
52
- }
53
- var $44f92944fa78205a$export$2e2bcd8739ae039 = $44f92944fa78205a$var$clearTimeline;
54
-
55
-
56
- function $5138c3f25fef74d5$var$animation() {
57
- if (this.timeline) (0, $44f92944fa78205a$export$2e2bcd8739ae039).call(this);
58
- this.MM.add(this.breakpoint, ()=>{
59
- this.timeline = this.gsap.to(this.children, {
60
- duration: this.dataset.mcDuration || 20,
61
- x: "-100%",
62
- repeat: -1,
63
- ease: "none",
64
- scrollTrigger: {
65
- trigger: this,
66
- start: "-=50% bottom",
67
- end: "bottom top",
68
- toggleActions: "resume pause resume pause",
69
- onUpdate: (self)=>{
70
- if (this.dataset.mcDirection === "ltr") this.timeline.timeScale(-1);
71
- else if (this.dataset.mcDirection === "auto") this.timeline.timeScale(self.direction);
72
- }
73
- }
74
- });
75
- this.timeline.totalProgress(0.5);
76
- return ()=>{
77
- if (this.timeline) (0, $44f92944fa78205a$export$2e2bcd8739ae039).call(this);
78
- };
79
- });
80
- }
81
- var $5138c3f25fef74d5$export$2e2bcd8739ae039 = $5138c3f25fef74d5$var$animation;
82
-
83
-
84
-
85
- class $cf838c15c8b009ba$export$2e2bcd8739ae039 extends HTMLElement {
86
- constructor(){
87
- super();
88
- this.gsap = $cf838c15c8b009ba$export$2e2bcd8739ae039.gsap || window.gsap;
89
- this.MM = this.gsap.matchMedia();
90
- this.timeline = null;
91
- this.update = this.update.bind(this);
92
- this.resizeObserver = new ResizeObserver(this.debounce(this.update.bind(this)));
93
- this.resizeObserver.observe(this);
73
+ class $cf838c15c8b009ba$var$MarqueeContent {
74
+ #gsap;
75
+ #MM;
76
+ #timeline;
77
+ #element;
78
+ #resizeObserver;
79
+ #animationFrame;
80
+ constructor({ element: element = ".marquee" } = {}){
81
+ this.#gsap = $cf838c15c8b009ba$var$MarqueeContent.gsap ?? window.gsap;
82
+ this.#MM = this.#gsap.matchMedia();
83
+ this.#timeline = null;
84
+ this.#element = element instanceof HTMLElement ? element : document.querySelector(element);
85
+ if (!this.#element) return;
86
+ this.#resizeObserver = new ResizeObserver($f3ad94c9f84f4d57$export$61fc7d43ac8f84b0(()=>this.#update()));
87
+ this.#resizeObserver.observe(this.#element);
94
88
  }
95
89
  static registerGSAP(gsap) {
96
- $cf838c15c8b009ba$export$2e2bcd8739ae039.gsap = gsap;
90
+ $cf838c15c8b009ba$var$MarqueeContent.gsap = gsap;
97
91
  }
98
- debounce = ()=>{
99
- let timer;
100
- return ()=>{
101
- cancelAnimationFrame(timer);
102
- timer = requestAnimationFrame(this.update);
103
- };
92
+ #commonInit = ()=>{
93
+ $f3ad94c9f84f4d57$export$6a732ac1b1fdc86b(this.#timeline, this.#element, this.#gsap);
94
+ $f3ad94c9f84f4d57$export$7c4d14cd3c92bf0b(this.#element, this.#gsap, this.#MM);
95
+ $f3ad94c9f84f4d57$export$d07517a676ce386f(this.#element);
96
+ $f3ad94c9f84f4d57$export$3484d11c6bb42ecc(this.#element);
97
+ this.#timeline = $f3ad94c9f84f4d57$export$ecad260a8a5fef4f(this.#element, this.#gsap, this.#MM, this.#timeline, this);
104
98
  };
105
- update() {
106
- cancelAnimationFrame(this.af);
107
- if (this.firstElementChild) this.af = requestAnimationFrame(()=>{
108
- (0, $2b68722c48061d80$export$2e2bcd8739ae039).call(this);
109
- (0, $5138c3f25fef74d5$export$2e2bcd8739ae039).call(this);
99
+ #update = ()=>{
100
+ cancelAnimationFrame(this.#animationFrame);
101
+ this.#animationFrame = requestAnimationFrame(()=>{
102
+ this.#commonInit();
103
+ ScrollTrigger.refresh();
110
104
  });
111
- }
112
- init() {
113
- (0, $0247ba718e967cec$export$2e2bcd8739ae039).call(this);
114
- (0, $dfb0cb0db0a7e917$export$2e2bcd8739ae039).call(this);
115
- (0, $2b68722c48061d80$export$2e2bcd8739ae039).call(this);
116
- (0, $5138c3f25fef74d5$export$2e2bcd8739ae039).call(this);
117
- }
118
- destroy() {
119
- cancelAnimationFrame(this.af);
120
- (0, $44f92944fa78205a$export$2e2bcd8739ae039).call(this);
121
- if (this.resizeObserver) this.resizeObserver.disconnect();
122
- }
123
- connectedCallback() {
124
- this.init();
125
- }
126
- disconnectedCallback() {
127
- this.destroy();
128
- }
105
+ };
106
+ init = ()=>{
107
+ this.#commonInit();
108
+ };
109
+ destroy = ()=>{
110
+ cancelAnimationFrame(this.#animationFrame);
111
+ $f3ad94c9f84f4d57$export$6a732ac1b1fdc86b(this.#timeline, this.#element, this.#gsap);
112
+ this.#resizeObserver?.disconnect();
113
+ };
129
114
  }
130
- if (!customElements.get("marquee-content")) customElements.define("marquee-content", $cf838c15c8b009ba$export$2e2bcd8739ae039);
115
+ var $cf838c15c8b009ba$export$2e2bcd8739ae039 = $cf838c15c8b009ba$var$MarqueeContent;
131
116
 
132
117
 
133
118
  export {$cf838c15c8b009ba$export$2e2bcd8739ae039 as default};