remarqueeble 0.3.0 → 0.4.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/README.md +54 -8
- package/dist/lite.css +73 -0
- package/dist/remarqueeble-auto.cjs +5 -3
- package/dist/remarqueeble-auto.min.js +2 -2
- package/dist/remarqueeble-auto.mjs +5 -3
- package/dist/remarqueeble.cjs +5 -3
- package/dist/remarqueeble.mjs +5 -3
- package/package.json +11 -3
- package/dist/remarqueeble.min.js +0 -52
- package/dist/remarqueeble.min.mjs +0 -215
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ By Rémino Rem
|
|
|
21
21
|
- [Usage](#usage)
|
|
22
22
|
- [Attributes](#attributes)
|
|
23
23
|
- [API](#api)
|
|
24
|
+
- [Remarquee Lite](#remarquee-lite)
|
|
24
25
|
- [Development](#development)
|
|
25
26
|
- [Contributing](#contributing)
|
|
26
27
|
- [Licence](#licence)
|
|
@@ -36,22 +37,28 @@ By Rémino Rem
|
|
|
36
37
|
Register the custom elements automatically from a CDN:
|
|
37
38
|
|
|
38
39
|
```html
|
|
39
|
-
<script
|
|
40
|
-
type="module"
|
|
41
|
-
src="https://unpkg.com/remarqueeble/dist/remarqueeble-auto.min.js"></script>
|
|
40
|
+
<script src="https://unpkg.com/remarqueeble"></script>
|
|
42
41
|
```
|
|
43
42
|
|
|
44
43
|
Mirrors:
|
|
45
44
|
|
|
46
|
-
- https://unpkg.com/remarqueeble
|
|
47
|
-
- https://cdn.jsdelivr.net/npm/remarqueeble
|
|
45
|
+
- https://unpkg.com/remarqueeble
|
|
46
|
+
- https://cdn.jsdelivr.net/npm/remarqueeble
|
|
48
47
|
|
|
49
48
|
Use a pinned version in production:
|
|
50
49
|
|
|
51
50
|
```html
|
|
52
|
-
<script
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
<script src="https://unpkg.com/remarqueeble@0.3.0"></script>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
If you want the API instead of auto-registration, import the ES module directly:
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<script type="module">
|
|
58
|
+
import { defineRemarqueebleElements } from 'https://unpkg.com/remarqueeble@0.3.0/dist/remarqueeble.mjs'
|
|
59
|
+
|
|
60
|
+
defineRemarqueebleElements()
|
|
61
|
+
</script>
|
|
55
62
|
```
|
|
56
63
|
|
|
57
64
|
### npm
|
|
@@ -78,6 +85,9 @@ defineRemarqueebleElements()
|
|
|
78
85
|
|
|
79
86
|
TypeScript declarations are included with the package.
|
|
80
87
|
|
|
88
|
+
Bundlers normally minify production builds for you, so npm users should prefer
|
|
89
|
+
the package exports above instead of importing files from `dist/` directly.
|
|
90
|
+
|
|
81
91
|
### Direct download
|
|
82
92
|
|
|
83
93
|
Download the package tarball or individual files from npm/CDN:
|
|
@@ -88,6 +98,14 @@ Download the package tarball or individual files from npm/CDN:
|
|
|
88
98
|
|
|
89
99
|
The browser-ready auto-registration file is `dist/remarqueeble-auto.min.js`.
|
|
90
100
|
|
|
101
|
+
Distribution files:
|
|
102
|
+
|
|
103
|
+
- `dist/remarqueeble.mjs`: ES module library API.
|
|
104
|
+
- `dist/remarqueeble.cjs`: CommonJS library API.
|
|
105
|
+
- `dist/remarqueeble-auto.mjs`: ES module auto-registration entry.
|
|
106
|
+
- `dist/remarqueeble-auto.cjs`: CommonJS auto-registration entry.
|
|
107
|
+
- `dist/remarqueeble-auto.min.js`: minified classic browser auto-registration.
|
|
108
|
+
|
|
91
109
|
[Back to top](#)
|
|
92
110
|
|
|
93
111
|
---
|
|
@@ -138,6 +156,34 @@ marquee.start()
|
|
|
138
156
|
|
|
139
157
|
---
|
|
140
158
|
|
|
159
|
+
## Remarquee Lite
|
|
160
|
+
|
|
161
|
+
For a CSS-only marquee, import `remarqueeble/lite.css` or load
|
|
162
|
+
`dist/lite.css` directly:
|
|
163
|
+
|
|
164
|
+
```html
|
|
165
|
+
<link rel="stylesheet" href="https://unpkg.com/remarqueeble/dist/lite.css" />
|
|
166
|
+
|
|
167
|
+
<div class="re-marquee" style="--re-marquee-duration: 12s;">
|
|
168
|
+
<div class="re-marquee__track">CSS-only marquee</div>
|
|
169
|
+
</div>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The lite CSS follows the simpler pure-CSS pattern and does not require
|
|
173
|
+
duplicated content. It does not emulate legacy `<marquee>` measurement,
|
|
174
|
+
`behavior`, `scrollamount`, `scrolldelay`, or finite `loop` handling.
|
|
175
|
+
|
|
176
|
+
Optional classes:
|
|
177
|
+
|
|
178
|
+
- `re-marquee--reverse`: scroll in the opposite direction.
|
|
179
|
+
- `re-marquee--vertical`: scroll vertically.
|
|
180
|
+
- `re-marquee--paused`: pause the animation.
|
|
181
|
+
- `re-marquee--pause-on-hover`: pause while hovered.
|
|
182
|
+
|
|
183
|
+
[Back to top](#)
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
141
187
|
## Development
|
|
142
188
|
|
|
143
189
|
```sh
|
package/dist/lite.css
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*! remarqueeble v0.4.0 | (c) 2026 Rémino Rem <https://remino.net/> | ISC Licence */
|
|
2
|
+
.re-marquee {
|
|
3
|
+
--re-marquee-duration: 20s;
|
|
4
|
+
--re-marquee-play-state: running;
|
|
5
|
+
--re-marquee-timing-function: linear;
|
|
6
|
+
|
|
7
|
+
display: block;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.re-marquee__track {
|
|
13
|
+
animation: re-marquee-scroll var(--re-marquee-duration)
|
|
14
|
+
var(--re-marquee-timing-function) infinite;
|
|
15
|
+
animation-play-state: var(--re-marquee-play-state);
|
|
16
|
+
display: inline-block;
|
|
17
|
+
min-inline-size: max-content;
|
|
18
|
+
will-change: transform;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.re-marquee--reverse > .re-marquee__track {
|
|
22
|
+
animation-direction: reverse;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.re-marquee--paused {
|
|
26
|
+
--re-marquee-play-state: paused;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.re-marquee--pause-on-hover:hover {
|
|
30
|
+
--re-marquee-play-state: paused;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.re-marquee--vertical {
|
|
34
|
+
block-size: 12rem;
|
|
35
|
+
white-space: normal;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.re-marquee--vertical > .re-marquee__track {
|
|
39
|
+
animation-name: re-marquee-scroll-y;
|
|
40
|
+
display: inline-flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
min-inline-size: auto;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@media (prefers-reduced-motion: reduce) {
|
|
46
|
+
.re-marquee {
|
|
47
|
+
overflow: auto;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.re-marquee__track {
|
|
51
|
+
animation: none;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@keyframes re-marquee-scroll {
|
|
56
|
+
from {
|
|
57
|
+
transform: translateX(clamp(100%, 40rem, 100vw));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
to {
|
|
61
|
+
transform: translateX(var(--re-marquee-end-pos, -100%));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@keyframes re-marquee-scroll-y {
|
|
66
|
+
from {
|
|
67
|
+
transform: translateY(clamp(100%, 40rem, 100vh));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
to {
|
|
71
|
+
transform: translateY(var(--re-marquee-end-pos, -100%));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! remarqueeble v0.
|
|
1
|
+
/*! remarqueeble v0.4.0 | (c) 2026 Rémino Rem <https://remino.net/> | ISC Licence */
|
|
2
2
|
//#region src/lib/remarqueeble.ts
|
|
3
3
|
var DEFAULT_DIRECTION = "left";
|
|
4
4
|
var DEFAULT_BEHAVIOR = "scroll";
|
|
@@ -295,10 +295,12 @@ var RemarqueebleElement = class extends HTMLElementBase {
|
|
|
295
295
|
return this.hasAttribute(ATTR_LOOP) && Number.isFinite(this.loop) && this.loop > 0;
|
|
296
296
|
}
|
|
297
297
|
};
|
|
298
|
+
var ReMarqueeElement = class extends RemarqueebleElement {};
|
|
299
|
+
var ReMarqueeBleElement = class extends RemarqueebleElement {};
|
|
298
300
|
var defineRemarqueebleElements = () => {
|
|
299
301
|
if (typeof customElements === "undefined") return;
|
|
300
|
-
if (!customElements.get("re-marquee")) customElements.define("re-marquee",
|
|
301
|
-
if (!customElements.get("re-marquee-ble")) customElements.define("re-marquee-ble",
|
|
302
|
+
if (!customElements.get("re-marquee")) customElements.define("re-marquee", ReMarqueeElement);
|
|
303
|
+
if (!customElements.get("re-marquee-ble")) customElements.define("re-marquee-ble", ReMarqueeBleElement);
|
|
302
304
|
};
|
|
303
305
|
//#endregion
|
|
304
306
|
//#region src/lib/auto.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! remarqueeble v0.
|
|
1
|
+
/*! remarqueeble v0.4.0 | (c) 2026 Rémino Rem <https://remino.net/> | ISC Licence */
|
|
2
2
|
(function(){var e=`direction`,t=`behavior`,n=`scrollamount`,r=`scrolldelay`,i=`truespeed`,a=`loop`,o=`bgcolor`,s=`width`,c=`height`,l=`hspace`,u=`vspace`,d=`--attr-width`,f=`--attr-height`,p=`--attr-hspace`,m=`--attr-vspace`,h=`--attr-bgcolor`,g=`--animation-duration`,_=`--animation-direction`,v=`--animation-iteration-count`,y=`--animation-play-state`,b=`--animation-timing-function`,x=`--translate-x-end`,S=`--translate-x-start`,C=`--translate-y-end`,w=`--translate-y-start`,T=globalThis.HTMLElement??class{},E=e=>{if(e===null)return null;let t=e.trim();return t===``?null:/^[+-]?(?:\d+|\d*\.\d+)$/.test(t)?`${t}px`:globalThis.CSS?.supports(`width`,t)?t:null},D=[{attribute:s,cssVar:d,parser:E},{attribute:c,cssVar:f,parser:E,fallback(e){return e.isVerticalDirection&&!e.hasAttribute(c)?`200px`:null}},{attribute:l,cssVar:p,parser:E},{attribute:u,cssVar:m,parser:E},{attribute:o,cssVar:h,parser:e=>{if(e===null)return null;let t=e.trim();return t===``?null:globalThis.CSS?.supports(`background-color`,t)?t:null}}],O=class extends T{static observedAttributes=[e,t,n,r,i,a,o,s,c,l,u];track;running=!1;constructor(){super();let e=this.attachShadow({mode:`open`});e.innerHTML=`
|
|
3
3
|
<style>
|
|
4
4
|
:host {
|
|
@@ -49,4 +49,4 @@
|
|
|
49
49
|
</style>
|
|
50
50
|
|
|
51
51
|
<span class="track"><slot></slot></span>
|
|
52
|
-
`;let t=e.querySelector(`.track`);if(!t)throw Error(`Remarqueeble track element was not created.`);this.track=t,this.track.addEventListener(`animationend`,()=>this.handleAnimationEnd())}connectedCallback(){this.running=!0,this.syncPresentationalHints(),requestAnimationFrame(()=>{!this.isConnected||!this.running||this.reset()})}disconnectedCallback(){this.running=!1}attributeChangedCallback(e,t,n){t!==n&&(this.syncPresentationalHints(),this.isConnected&&this.reset())}get direction(){return this.getAttribute(e)||`left`}get behavior(){return this.getAttribute(t)||`scroll`}get scrollAmount(){let e=this.getAttribute(n),t=e===null||e.trim()===``?NaN:Number(e);return Number.isFinite(t)&&t>=0?t:6}get scrollDelay(){let e=this.getAttribute(r),t=e===null||e.trim()===``?NaN:Number(e),n=Number.isFinite(t)&&t>=0?t:85;return this.hasAttribute(i)?n:Math.max(n,60)}get loop(){let e=this.getAttribute(a);return e===null?-1:Number(e)}get directionSign(){return this.direction===`right`||this.direction===`down`?1:-1}get isVerticalDirection(){return this.direction===`up`||this.direction===`down`}start(){this.running||(this.running=!0,this.reset(),this.syncAnimationPlayState())}stop(){this.running=!1,this.syncAnimationPlayState()}syncPresentationalHints(){for(let e of D)this.syncVar(e);this.syncAnimationPlayState()}syncVar(e){let t=this.getAttribute(e.attribute),n=e.parser(t),r=e.fallback?e.fallback(this):null;if(n==null){r==null?this.style.removeProperty(e.cssVar):this.style.setProperty(e.cssVar,r);return}this.style.setProperty(e.cssVar,n)}reset(){let e=this.getHostSize(),t=this.getTrackSize();this.syncAnimation(e,t)}getHostSize(){return this.isVerticalDirection?this.clientHeight:this.clientWidth}getTrackSize(){return this.isVerticalDirection?this.track.offsetHeight:this.track.offsetWidth}getStartPosition(e,t){return this.directionSign<0?e:-t}getFlushEndPosition(e,t){return this.directionSign<0?0:e-t}getOffEndPosition(e,t){return this.directionSign<0?-t:e}getSlideEndPosition(e,t){return this.directionSign<0?0:e-t}getAlternateStartPosition(e,t){return this.directionSign<0?e-t:0}syncAnimationPlayState(){this.style.setProperty(y,this.running?`running`:`paused`)}syncAnimation(e,t){let n=this.behavior===`alternate`?this.getAlternateStartPosition(e,t):this.getStartPosition(e,t),r=this.behavior===`slide`?this.getSlideEndPosition(e,t):this.behavior===`alternate`?this.getFlushEndPosition(e,t):this.getOffEndPosition(e,t),i=Math.abs(r-n),a=Math.max(1,Math.ceil(i/Math.max(1,this.scrollAmount))),o=Math.max(1,a*this.scrollDelay),s=this.getCssIterationCount();this.track.style.removeProperty(`transform`),this.style.setProperty(g,`${o}ms`),this.style.setProperty(_,this.behavior===`alternate`?`alternate`:`normal`),this.style.setProperty(v,s),this.style.setProperty(b,`steps(${a}, end)`),this.isVerticalDirection?(this.style.setProperty(S,`0px`),this.style.setProperty(x,`0px`),this.style.setProperty(w,`${n}px`),this.style.setProperty(C,`${r}px`)):(this.style.setProperty(S,`${n}px`),this.style.setProperty(x,`${r}px`),this.style.setProperty(w,`0px`),this.style.setProperty(C,`0px`)),this.restartAnimation()}getCssIterationCount(){return this.behavior===`slide`&&!this.hasAttribute(a)?`1`:this.hasAttribute(a)&&Number.isFinite(this.loop)&&this.loop>0?String(this.loop):`infinite`}handleAnimationEnd(){this.hasFiniteAnimation()&&(this.running=!1,this.syncAnimationPlayState())}restartAnimation(){this.track.style.animationName=`none`,this.track.offsetWidth,this.track.style.removeProperty(`animation-name`)}hasFiniteAnimation(){return this.behavior===`slide`&&!this.hasAttribute(a)?!0:this.hasAttribute(a)&&Number.isFinite(this.loop)&&this.loop>0}};typeof customElements>`u`||(customElements.get(`re-marquee`)||customElements.define(`re-marquee`,
|
|
52
|
+
`;let t=e.querySelector(`.track`);if(!t)throw Error(`Remarqueeble track element was not created.`);this.track=t,this.track.addEventListener(`animationend`,()=>this.handleAnimationEnd())}connectedCallback(){this.running=!0,this.syncPresentationalHints(),requestAnimationFrame(()=>{!this.isConnected||!this.running||this.reset()})}disconnectedCallback(){this.running=!1}attributeChangedCallback(e,t,n){t!==n&&(this.syncPresentationalHints(),this.isConnected&&this.reset())}get direction(){return this.getAttribute(e)||`left`}get behavior(){return this.getAttribute(t)||`scroll`}get scrollAmount(){let e=this.getAttribute(n),t=e===null||e.trim()===``?NaN:Number(e);return Number.isFinite(t)&&t>=0?t:6}get scrollDelay(){let e=this.getAttribute(r),t=e===null||e.trim()===``?NaN:Number(e),n=Number.isFinite(t)&&t>=0?t:85;return this.hasAttribute(i)?n:Math.max(n,60)}get loop(){let e=this.getAttribute(a);return e===null?-1:Number(e)}get directionSign(){return this.direction===`right`||this.direction===`down`?1:-1}get isVerticalDirection(){return this.direction===`up`||this.direction===`down`}start(){this.running||(this.running=!0,this.reset(),this.syncAnimationPlayState())}stop(){this.running=!1,this.syncAnimationPlayState()}syncPresentationalHints(){for(let e of D)this.syncVar(e);this.syncAnimationPlayState()}syncVar(e){let t=this.getAttribute(e.attribute),n=e.parser(t),r=e.fallback?e.fallback(this):null;if(n==null){r==null?this.style.removeProperty(e.cssVar):this.style.setProperty(e.cssVar,r);return}this.style.setProperty(e.cssVar,n)}reset(){let e=this.getHostSize(),t=this.getTrackSize();this.syncAnimation(e,t)}getHostSize(){return this.isVerticalDirection?this.clientHeight:this.clientWidth}getTrackSize(){return this.isVerticalDirection?this.track.offsetHeight:this.track.offsetWidth}getStartPosition(e,t){return this.directionSign<0?e:-t}getFlushEndPosition(e,t){return this.directionSign<0?0:e-t}getOffEndPosition(e,t){return this.directionSign<0?-t:e}getSlideEndPosition(e,t){return this.directionSign<0?0:e-t}getAlternateStartPosition(e,t){return this.directionSign<0?e-t:0}syncAnimationPlayState(){this.style.setProperty(y,this.running?`running`:`paused`)}syncAnimation(e,t){let n=this.behavior===`alternate`?this.getAlternateStartPosition(e,t):this.getStartPosition(e,t),r=this.behavior===`slide`?this.getSlideEndPosition(e,t):this.behavior===`alternate`?this.getFlushEndPosition(e,t):this.getOffEndPosition(e,t),i=Math.abs(r-n),a=Math.max(1,Math.ceil(i/Math.max(1,this.scrollAmount))),o=Math.max(1,a*this.scrollDelay),s=this.getCssIterationCount();this.track.style.removeProperty(`transform`),this.style.setProperty(g,`${o}ms`),this.style.setProperty(_,this.behavior===`alternate`?`alternate`:`normal`),this.style.setProperty(v,s),this.style.setProperty(b,`steps(${a}, end)`),this.isVerticalDirection?(this.style.setProperty(S,`0px`),this.style.setProperty(x,`0px`),this.style.setProperty(w,`${n}px`),this.style.setProperty(C,`${r}px`)):(this.style.setProperty(S,`${n}px`),this.style.setProperty(x,`${r}px`),this.style.setProperty(w,`0px`),this.style.setProperty(C,`0px`)),this.restartAnimation()}getCssIterationCount(){return this.behavior===`slide`&&!this.hasAttribute(a)?`1`:this.hasAttribute(a)&&Number.isFinite(this.loop)&&this.loop>0?String(this.loop):`infinite`}handleAnimationEnd(){this.hasFiniteAnimation()&&(this.running=!1,this.syncAnimationPlayState())}restartAnimation(){this.track.style.animationName=`none`,this.track.offsetWidth,this.track.style.removeProperty(`animation-name`)}hasFiniteAnimation(){return this.behavior===`slide`&&!this.hasAttribute(a)?!0:this.hasAttribute(a)&&Number.isFinite(this.loop)&&this.loop>0}},k=class extends O{},A=class extends O{};typeof customElements>`u`||(customElements.get(`re-marquee`)||customElements.define(`re-marquee`,k),customElements.get(`re-marquee-ble`)||customElements.define(`re-marquee-ble`,A))})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! remarqueeble v0.
|
|
1
|
+
/*! remarqueeble v0.4.0 | (c) 2026 Rémino Rem <https://remino.net/> | ISC Licence */
|
|
2
2
|
//#region src/lib/remarqueeble.ts
|
|
3
3
|
var DEFAULT_DIRECTION = "left";
|
|
4
4
|
var DEFAULT_BEHAVIOR = "scroll";
|
|
@@ -295,10 +295,12 @@ var RemarqueebleElement = class extends HTMLElementBase {
|
|
|
295
295
|
return this.hasAttribute(ATTR_LOOP) && Number.isFinite(this.loop) && this.loop > 0;
|
|
296
296
|
}
|
|
297
297
|
};
|
|
298
|
+
var ReMarqueeElement = class extends RemarqueebleElement {};
|
|
299
|
+
var ReMarqueeBleElement = class extends RemarqueebleElement {};
|
|
298
300
|
var defineRemarqueebleElements = () => {
|
|
299
301
|
if (typeof customElements === "undefined") return;
|
|
300
|
-
if (!customElements.get("re-marquee")) customElements.define("re-marquee",
|
|
301
|
-
if (!customElements.get("re-marquee-ble")) customElements.define("re-marquee-ble",
|
|
302
|
+
if (!customElements.get("re-marquee")) customElements.define("re-marquee", ReMarqueeElement);
|
|
303
|
+
if (!customElements.get("re-marquee-ble")) customElements.define("re-marquee-ble", ReMarqueeBleElement);
|
|
302
304
|
};
|
|
303
305
|
//#endregion
|
|
304
306
|
//#region src/lib/auto.ts
|
package/dist/remarqueeble.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! remarqueeble v0.
|
|
1
|
+
/*! remarqueeble v0.4.0 | (c) 2026 Rémino Rem <https://remino.net/> | ISC Licence */
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
//#region src/lib/remarqueeble.ts
|
|
4
4
|
var DEFAULT_DIRECTION = "left";
|
|
@@ -296,10 +296,12 @@ var RemarqueebleElement = class extends HTMLElementBase {
|
|
|
296
296
|
return this.hasAttribute(ATTR_LOOP) && Number.isFinite(this.loop) && this.loop > 0;
|
|
297
297
|
}
|
|
298
298
|
};
|
|
299
|
+
var ReMarqueeElement = class extends RemarqueebleElement {};
|
|
300
|
+
var ReMarqueeBleElement = class extends RemarqueebleElement {};
|
|
299
301
|
var defineRemarqueebleElements = () => {
|
|
300
302
|
if (typeof customElements === "undefined") return;
|
|
301
|
-
if (!customElements.get("re-marquee")) customElements.define("re-marquee",
|
|
302
|
-
if (!customElements.get("re-marquee-ble")) customElements.define("re-marquee-ble",
|
|
303
|
+
if (!customElements.get("re-marquee")) customElements.define("re-marquee", ReMarqueeElement);
|
|
304
|
+
if (!customElements.get("re-marquee-ble")) customElements.define("re-marquee-ble", ReMarqueeBleElement);
|
|
303
305
|
};
|
|
304
306
|
//#endregion
|
|
305
307
|
exports.RemarqueebleElement = RemarqueebleElement;
|
package/dist/remarqueeble.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! remarqueeble v0.
|
|
1
|
+
/*! remarqueeble v0.4.0 | (c) 2026 Rémino Rem <https://remino.net/> | ISC Licence */
|
|
2
2
|
//#region src/lib/remarqueeble.ts
|
|
3
3
|
var DEFAULT_DIRECTION = "left";
|
|
4
4
|
var DEFAULT_BEHAVIOR = "scroll";
|
|
@@ -295,10 +295,12 @@ var RemarqueebleElement = class extends HTMLElementBase {
|
|
|
295
295
|
return this.hasAttribute(ATTR_LOOP) && Number.isFinite(this.loop) && this.loop > 0;
|
|
296
296
|
}
|
|
297
297
|
};
|
|
298
|
+
var ReMarqueeElement = class extends RemarqueebleElement {};
|
|
299
|
+
var ReMarqueeBleElement = class extends RemarqueebleElement {};
|
|
298
300
|
var defineRemarqueebleElements = () => {
|
|
299
301
|
if (typeof customElements === "undefined") return;
|
|
300
|
-
if (!customElements.get("re-marquee")) customElements.define("re-marquee",
|
|
301
|
-
if (!customElements.get("re-marquee-ble")) customElements.define("re-marquee-ble",
|
|
302
|
+
if (!customElements.get("re-marquee")) customElements.define("re-marquee", ReMarqueeElement);
|
|
303
|
+
if (!customElements.get("re-marquee-ble")) customElements.define("re-marquee-ble", ReMarqueeBleElement);
|
|
302
304
|
};
|
|
303
305
|
//#endregion
|
|
304
306
|
export { RemarqueebleElement, defineRemarqueebleElements, parseLegacyColor, parsePresentationalDimension };
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "Rémino Rem",
|
|
4
4
|
"url": "https://remino.net/"
|
|
5
5
|
},
|
|
6
|
-
"browser": "dist/remarqueeble.
|
|
6
|
+
"browser": "./dist/remarqueeble-auto.min.js",
|
|
7
7
|
"description": "Custom element tribute to the cursed glory of marquee.",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@astrojs/check": "^0.9.4",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"astro-compressor": "^1.3.0",
|
|
17
17
|
"astro-eslint-parser": "^1.4.0",
|
|
18
18
|
"astro-minify-html": "^0.1.1",
|
|
19
|
+
"dompurify": "^3.4.11",
|
|
19
20
|
"eslint": "^10.6.0",
|
|
20
21
|
"eslint-config-prettier": "^10.1.8",
|
|
21
22
|
"eslint-plugin-astro": "^1.7.0",
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
"jasmine": "^6.3.0",
|
|
24
25
|
"prettier": "^3.7.4",
|
|
25
26
|
"prettier-plugin-astro": "^0.14.1",
|
|
27
|
+
"shiki": "^4.3.0",
|
|
26
28
|
"tsx": "^4.22.4",
|
|
27
29
|
"typescript": "^5.9.3",
|
|
28
30
|
"typescript-eslint": "^8.62.0",
|
|
@@ -31,6 +33,7 @@
|
|
|
31
33
|
"exports": {
|
|
32
34
|
".": {
|
|
33
35
|
"types": "./dist/remarqueeble.d.ts",
|
|
36
|
+
"unpkg": "./dist/remarqueeble-auto.min.js",
|
|
34
37
|
"import": "./dist/remarqueeble.mjs",
|
|
35
38
|
"require": "./dist/remarqueeble.cjs"
|
|
36
39
|
},
|
|
@@ -38,7 +41,8 @@
|
|
|
38
41
|
"types": "./dist/auto.d.ts",
|
|
39
42
|
"import": "./dist/remarqueeble-auto.mjs",
|
|
40
43
|
"require": "./dist/remarqueeble-auto.cjs"
|
|
41
|
-
}
|
|
44
|
+
},
|
|
45
|
+
"./lite.css": "./dist/lite.css"
|
|
42
46
|
},
|
|
43
47
|
"files": [
|
|
44
48
|
"dist/*"
|
|
@@ -53,8 +57,12 @@
|
|
|
53
57
|
"main": "dist/remarqueeble.cjs",
|
|
54
58
|
"module": "dist/remarqueeble.mjs",
|
|
55
59
|
"name": "remarqueeble",
|
|
60
|
+
"unpkg": "./dist/remarqueeble-auto.min.js",
|
|
61
|
+
"jsdelivr": "./dist/remarqueeble-auto.min.js",
|
|
56
62
|
"sideEffects": [
|
|
57
63
|
"./dist/remarqueeble-auto.*",
|
|
64
|
+
"./dist/lite.css",
|
|
65
|
+
"./src/assets/js/demo.js",
|
|
58
66
|
"./src/lib/auto.ts"
|
|
59
67
|
],
|
|
60
68
|
"scripts": {
|
|
@@ -80,5 +88,5 @@
|
|
|
80
88
|
},
|
|
81
89
|
"type": "module",
|
|
82
90
|
"types": "dist/remarqueeble.d.ts",
|
|
83
|
-
"version": "0.
|
|
91
|
+
"version": "0.4.0"
|
|
84
92
|
}
|
package/dist/remarqueeble.min.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/*! remarqueeble v0.3.0 | (c) 2026 Rémino Rem <https://remino.net/> | ISC Licence */
|
|
2
|
-
var remarqueeble=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=`left`,n=`scroll`,r=6,i=85,a=60,o=`200px`,s=`calc(100% - (var(--attr-hspace, 0px) * 2))`,c=`direction`,l=`behavior`,u=`scrollamount`,d=`scrolldelay`,f=`truespeed`,p=`loop`,m=`bgcolor`,h=`width`,g=`height`,_=`hspace`,v=`vspace`,y=`--attr-width`,b=`--attr-height`,x=`--attr-hspace`,S=`--attr-vspace`,C=`--attr-bgcolor`,w=`--animation-duration`,T=`--animation-direction`,E=`--animation-iteration-count`,D=`--animation-play-state`,O=`--animation-timing-function`,k=`--translate-x-end`,A=`--translate-x-start`,j=`--translate-y-end`,M=`--translate-y-start`,N=globalThis.HTMLElement??class{},P=e=>{if(e===null)return null;let t=e.trim();return t===``?null:/^[+-]?(?:\d+|\d*\.\d+)$/.test(t)?`${t}px`:globalThis.CSS?.supports(`width`,t)?t:null},F=e=>{if(e===null)return null;let t=e.trim();return t===``?null:globalThis.CSS?.supports(`background-color`,t)?t:null},I=[{attribute:h,cssVar:y,parser:P},{attribute:g,cssVar:b,parser:P,fallback(e){return e.isVerticalDirection&&!e.hasAttribute(g)?o:null}},{attribute:_,cssVar:x,parser:P},{attribute:v,cssVar:S,parser:P},{attribute:m,cssVar:C,parser:F}],L=class extends N{static observedAttributes=[c,l,u,d,f,p,m,h,g,_,v];track;running=!1;constructor(){super();let e=this.attachShadow({mode:`open`});e.innerHTML=`
|
|
3
|
-
<style>
|
|
4
|
-
:host {
|
|
5
|
-
display: inline-block;
|
|
6
|
-
text-align: initial;
|
|
7
|
-
overflow: hidden !important;
|
|
8
|
-
white-space: nowrap;
|
|
9
|
-
width: var(${y}, ${s});
|
|
10
|
-
height: var(${b}, auto);
|
|
11
|
-
margin-inline: var(${x}, 0px);
|
|
12
|
-
margin-block: var(${S}, 0px);
|
|
13
|
-
background-color: var(${C}, transparent);
|
|
14
|
-
box-sizing: border-box;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
:host([direction="up"]),
|
|
18
|
-
:host([direction="down"]) {
|
|
19
|
-
white-space: normal;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.track {
|
|
23
|
-
animation: remarqueeble-motion
|
|
24
|
-
var(${w}, 10s)
|
|
25
|
-
var(${O}, linear)
|
|
26
|
-
var(${E}, infinite)
|
|
27
|
-
var(${T}, normal)
|
|
28
|
-
both;
|
|
29
|
-
animation-play-state: var(${D}, running);
|
|
30
|
-
display: inline-block;
|
|
31
|
-
will-change: transform;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@keyframes remarqueeble-motion {
|
|
35
|
-
from {
|
|
36
|
-
transform: translate(
|
|
37
|
-
var(${A}, 100%),
|
|
38
|
-
var(${M}, 0px)
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
to {
|
|
43
|
-
transform: translate(
|
|
44
|
-
var(${k}, -100%),
|
|
45
|
-
var(${j}, 0px)
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
</style>
|
|
50
|
-
|
|
51
|
-
<span class="track"><slot></slot></span>
|
|
52
|
-
`;let t=e.querySelector(`.track`);if(!t)throw Error(`Remarqueeble track element was not created.`);this.track=t,this.track.addEventListener(`animationend`,()=>this.handleAnimationEnd())}connectedCallback(){this.running=!0,this.syncPresentationalHints(),requestAnimationFrame(()=>{!this.isConnected||!this.running||this.reset()})}disconnectedCallback(){this.running=!1}attributeChangedCallback(e,t,n){t!==n&&(this.syncPresentationalHints(),this.isConnected&&this.reset())}get direction(){return this.getAttribute(c)||t}get behavior(){return this.getAttribute(l)||n}get scrollAmount(){let e=this.getAttribute(u),t=e===null||e.trim()===``?NaN:Number(e);return Number.isFinite(t)&&t>=0?t:r}get scrollDelay(){let e=this.getAttribute(d),t=e===null||e.trim()===``?NaN:Number(e),n=Number.isFinite(t)&&t>=0?t:i;return this.hasAttribute(f)?n:Math.max(n,a)}get loop(){let e=this.getAttribute(p);return e===null?-1:Number(e)}get directionSign(){return this.direction===`right`||this.direction===`down`?1:-1}get isVerticalDirection(){return this.direction===`up`||this.direction===`down`}start(){this.running||(this.running=!0,this.reset(),this.syncAnimationPlayState())}stop(){this.running=!1,this.syncAnimationPlayState()}syncPresentationalHints(){for(let e of I)this.syncVar(e);this.syncAnimationPlayState()}syncVar(e){let t=this.getAttribute(e.attribute),n=e.parser(t),r=e.fallback?e.fallback(this):null;if(n==null){r==null?this.style.removeProperty(e.cssVar):this.style.setProperty(e.cssVar,r);return}this.style.setProperty(e.cssVar,n)}reset(){let e=this.getHostSize(),t=this.getTrackSize();this.syncAnimation(e,t)}getHostSize(){return this.isVerticalDirection?this.clientHeight:this.clientWidth}getTrackSize(){return this.isVerticalDirection?this.track.offsetHeight:this.track.offsetWidth}getStartPosition(e,t){return this.directionSign<0?e:-t}getFlushEndPosition(e,t){return this.directionSign<0?0:e-t}getOffEndPosition(e,t){return this.directionSign<0?-t:e}getSlideEndPosition(e,t){return this.directionSign<0?0:e-t}getAlternateStartPosition(e,t){return this.directionSign<0?e-t:0}syncAnimationPlayState(){this.style.setProperty(D,this.running?`running`:`paused`)}syncAnimation(e,t){let n=this.behavior===`alternate`?this.getAlternateStartPosition(e,t):this.getStartPosition(e,t),r=this.behavior===`slide`?this.getSlideEndPosition(e,t):this.behavior===`alternate`?this.getFlushEndPosition(e,t):this.getOffEndPosition(e,t),i=Math.abs(r-n),a=Math.max(1,Math.ceil(i/Math.max(1,this.scrollAmount))),o=Math.max(1,a*this.scrollDelay),s=this.getCssIterationCount();this.track.style.removeProperty(`transform`),this.style.setProperty(w,`${o}ms`),this.style.setProperty(T,this.behavior===`alternate`?`alternate`:`normal`),this.style.setProperty(E,s),this.style.setProperty(O,`steps(${a}, end)`),this.isVerticalDirection?(this.style.setProperty(A,`0px`),this.style.setProperty(k,`0px`),this.style.setProperty(M,`${n}px`),this.style.setProperty(j,`${r}px`)):(this.style.setProperty(A,`${n}px`),this.style.setProperty(k,`${r}px`),this.style.setProperty(M,`0px`),this.style.setProperty(j,`0px`)),this.restartAnimation()}getCssIterationCount(){return this.behavior===`slide`&&!this.hasAttribute(p)?`1`:this.hasAttribute(p)&&Number.isFinite(this.loop)&&this.loop>0?String(this.loop):`infinite`}handleAnimationEnd(){this.hasFiniteAnimation()&&(this.running=!1,this.syncAnimationPlayState())}restartAnimation(){this.track.style.animationName=`none`,this.track.offsetWidth,this.track.style.removeProperty(`animation-name`)}hasFiniteAnimation(){return this.behavior===`slide`&&!this.hasAttribute(p)?!0:this.hasAttribute(p)&&Number.isFinite(this.loop)&&this.loop>0}};return e.RemarqueebleElement=L,e.defineRemarqueebleElements=()=>{typeof customElements>`u`||(customElements.get(`re-marquee`)||customElements.define(`re-marquee`,L),customElements.get(`re-marquee-ble`)||customElements.define(`re-marquee-ble`,L))},e.parseLegacyColor=F,e.parsePresentationalDimension=P,e})({});
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/*! remarqueeble v0.3.0 | (c) 2026 Rémino Rem <https://remino.net/> | ISC Licence */
|
|
2
|
-
//#region src/lib/remarqueeble.ts
|
|
3
|
-
var e = "direction", t = "behavior", n = "scrollamount", r = "scrolldelay", i = "truespeed", a = "loop", o = "bgcolor", s = "width", c = "height", l = "hspace", u = "vspace", d = "--attr-width", f = "--attr-height", p = "--attr-hspace", m = "--attr-vspace", h = "--attr-bgcolor", g = "--animation-duration", _ = "--animation-direction", v = "--animation-iteration-count", y = "--animation-play-state", b = "--animation-timing-function", x = "--translate-x-end", S = "--translate-x-start", C = "--translate-y-end", w = "--translate-y-start", T = globalThis.HTMLElement ?? class {}, E = (e) => {
|
|
4
|
-
if (e === null) return null;
|
|
5
|
-
let t = e.trim();
|
|
6
|
-
return t === "" ? null : /^[+-]?(?:\d+|\d*\.\d+)$/.test(t) ? `${t}px` : globalThis.CSS?.supports("width", t) ? t : null;
|
|
7
|
-
}, D = (e) => {
|
|
8
|
-
if (e === null) return null;
|
|
9
|
-
let t = e.trim();
|
|
10
|
-
return t === "" ? null : globalThis.CSS?.supports("background-color", t) ? t : null;
|
|
11
|
-
}, O = [
|
|
12
|
-
{
|
|
13
|
-
attribute: s,
|
|
14
|
-
cssVar: d,
|
|
15
|
-
parser: E
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
attribute: c,
|
|
19
|
-
cssVar: f,
|
|
20
|
-
parser: E,
|
|
21
|
-
fallback(e) {
|
|
22
|
-
return e.isVerticalDirection && !e.hasAttribute(c) ? "200px" : null;
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
attribute: l,
|
|
27
|
-
cssVar: p,
|
|
28
|
-
parser: E
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
attribute: u,
|
|
32
|
-
cssVar: m,
|
|
33
|
-
parser: E
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
attribute: o,
|
|
37
|
-
cssVar: h,
|
|
38
|
-
parser: D
|
|
39
|
-
}
|
|
40
|
-
], k = class extends T {
|
|
41
|
-
static observedAttributes = [
|
|
42
|
-
e,
|
|
43
|
-
t,
|
|
44
|
-
n,
|
|
45
|
-
r,
|
|
46
|
-
i,
|
|
47
|
-
a,
|
|
48
|
-
o,
|
|
49
|
-
s,
|
|
50
|
-
c,
|
|
51
|
-
l,
|
|
52
|
-
u
|
|
53
|
-
];
|
|
54
|
-
track;
|
|
55
|
-
running = !1;
|
|
56
|
-
constructor() {
|
|
57
|
-
super();
|
|
58
|
-
let e = this.attachShadow({ mode: "open" });
|
|
59
|
-
e.innerHTML = `
|
|
60
|
-
<style>
|
|
61
|
-
:host {
|
|
62
|
-
display: inline-block;
|
|
63
|
-
text-align: initial;
|
|
64
|
-
overflow: hidden !important;
|
|
65
|
-
white-space: nowrap;
|
|
66
|
-
width: var(${d}, calc(100% - (var(--attr-hspace, 0px) * 2)));
|
|
67
|
-
height: var(${f}, auto);
|
|
68
|
-
margin-inline: var(${p}, 0px);
|
|
69
|
-
margin-block: var(${m}, 0px);
|
|
70
|
-
background-color: var(${h}, transparent);
|
|
71
|
-
box-sizing: border-box;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
:host([direction="up"]),
|
|
75
|
-
:host([direction="down"]) {
|
|
76
|
-
white-space: normal;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.track {
|
|
80
|
-
animation: remarqueeble-motion
|
|
81
|
-
var(${g}, 10s)
|
|
82
|
-
var(${b}, linear)
|
|
83
|
-
var(${v}, infinite)
|
|
84
|
-
var(${_}, normal)
|
|
85
|
-
both;
|
|
86
|
-
animation-play-state: var(${y}, running);
|
|
87
|
-
display: inline-block;
|
|
88
|
-
will-change: transform;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
@keyframes remarqueeble-motion {
|
|
92
|
-
from {
|
|
93
|
-
transform: translate(
|
|
94
|
-
var(${S}, 100%),
|
|
95
|
-
var(${w}, 0px)
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
to {
|
|
100
|
-
transform: translate(
|
|
101
|
-
var(${x}, -100%),
|
|
102
|
-
var(${C}, 0px)
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
</style>
|
|
107
|
-
|
|
108
|
-
<span class="track"><slot></slot></span>
|
|
109
|
-
`;
|
|
110
|
-
let t = e.querySelector(".track");
|
|
111
|
-
if (!t) throw Error("Remarqueeble track element was not created.");
|
|
112
|
-
this.track = t, this.track.addEventListener("animationend", () => this.handleAnimationEnd());
|
|
113
|
-
}
|
|
114
|
-
connectedCallback() {
|
|
115
|
-
this.running = !0, this.syncPresentationalHints(), requestAnimationFrame(() => {
|
|
116
|
-
!this.isConnected || !this.running || this.reset();
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
disconnectedCallback() {
|
|
120
|
-
this.running = !1;
|
|
121
|
-
}
|
|
122
|
-
attributeChangedCallback(e, t, n) {
|
|
123
|
-
t !== n && (this.syncPresentationalHints(), this.isConnected && this.reset());
|
|
124
|
-
}
|
|
125
|
-
get direction() {
|
|
126
|
-
return this.getAttribute(e) || "left";
|
|
127
|
-
}
|
|
128
|
-
get behavior() {
|
|
129
|
-
return this.getAttribute(t) || "scroll";
|
|
130
|
-
}
|
|
131
|
-
get scrollAmount() {
|
|
132
|
-
let e = this.getAttribute(n), t = e === null || e.trim() === "" ? NaN : Number(e);
|
|
133
|
-
return Number.isFinite(t) && t >= 0 ? t : 6;
|
|
134
|
-
}
|
|
135
|
-
get scrollDelay() {
|
|
136
|
-
let e = this.getAttribute(r), t = e === null || e.trim() === "" ? NaN : Number(e), n = Number.isFinite(t) && t >= 0 ? t : 85;
|
|
137
|
-
return this.hasAttribute(i) ? n : Math.max(n, 60);
|
|
138
|
-
}
|
|
139
|
-
get loop() {
|
|
140
|
-
let e = this.getAttribute(a);
|
|
141
|
-
return e === null ? -1 : Number(e);
|
|
142
|
-
}
|
|
143
|
-
get directionSign() {
|
|
144
|
-
return this.direction === "right" || this.direction === "down" ? 1 : -1;
|
|
145
|
-
}
|
|
146
|
-
get isVerticalDirection() {
|
|
147
|
-
return this.direction === "up" || this.direction === "down";
|
|
148
|
-
}
|
|
149
|
-
start() {
|
|
150
|
-
this.running || (this.running = !0, this.reset(), this.syncAnimationPlayState());
|
|
151
|
-
}
|
|
152
|
-
stop() {
|
|
153
|
-
this.running = !1, this.syncAnimationPlayState();
|
|
154
|
-
}
|
|
155
|
-
syncPresentationalHints() {
|
|
156
|
-
for (let e of O) this.syncVar(e);
|
|
157
|
-
this.syncAnimationPlayState();
|
|
158
|
-
}
|
|
159
|
-
syncVar(e) {
|
|
160
|
-
let t = this.getAttribute(e.attribute), n = e.parser(t), r = e.fallback ? e.fallback(this) : null;
|
|
161
|
-
if (n == null) {
|
|
162
|
-
r == null ? this.style.removeProperty(e.cssVar) : this.style.setProperty(e.cssVar, r);
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
this.style.setProperty(e.cssVar, n);
|
|
166
|
-
}
|
|
167
|
-
reset() {
|
|
168
|
-
let e = this.getHostSize(), t = this.getTrackSize();
|
|
169
|
-
this.syncAnimation(e, t);
|
|
170
|
-
}
|
|
171
|
-
getHostSize() {
|
|
172
|
-
return this.isVerticalDirection ? this.clientHeight : this.clientWidth;
|
|
173
|
-
}
|
|
174
|
-
getTrackSize() {
|
|
175
|
-
return this.isVerticalDirection ? this.track.offsetHeight : this.track.offsetWidth;
|
|
176
|
-
}
|
|
177
|
-
getStartPosition(e, t) {
|
|
178
|
-
return this.directionSign < 0 ? e : -t;
|
|
179
|
-
}
|
|
180
|
-
getFlushEndPosition(e, t) {
|
|
181
|
-
return this.directionSign < 0 ? 0 : e - t;
|
|
182
|
-
}
|
|
183
|
-
getOffEndPosition(e, t) {
|
|
184
|
-
return this.directionSign < 0 ? -t : e;
|
|
185
|
-
}
|
|
186
|
-
getSlideEndPosition(e, t) {
|
|
187
|
-
return this.directionSign < 0 ? 0 : e - t;
|
|
188
|
-
}
|
|
189
|
-
getAlternateStartPosition(e, t) {
|
|
190
|
-
return this.directionSign < 0 ? e - t : 0;
|
|
191
|
-
}
|
|
192
|
-
syncAnimationPlayState() {
|
|
193
|
-
this.style.setProperty(y, this.running ? "running" : "paused");
|
|
194
|
-
}
|
|
195
|
-
syncAnimation(e, t) {
|
|
196
|
-
let n = this.behavior === "alternate" ? this.getAlternateStartPosition(e, t) : this.getStartPosition(e, t), r = this.behavior === "slide" ? this.getSlideEndPosition(e, t) : this.behavior === "alternate" ? this.getFlushEndPosition(e, t) : this.getOffEndPosition(e, t), i = Math.abs(r - n), a = Math.max(1, Math.ceil(i / Math.max(1, this.scrollAmount))), o = Math.max(1, a * this.scrollDelay), s = this.getCssIterationCount();
|
|
197
|
-
this.track.style.removeProperty("transform"), this.style.setProperty(g, `${o}ms`), this.style.setProperty(_, this.behavior === "alternate" ? "alternate" : "normal"), this.style.setProperty(v, s), this.style.setProperty(b, `steps(${a}, end)`), this.isVerticalDirection ? (this.style.setProperty(S, "0px"), this.style.setProperty(x, "0px"), this.style.setProperty(w, `${n}px`), this.style.setProperty(C, `${r}px`)) : (this.style.setProperty(S, `${n}px`), this.style.setProperty(x, `${r}px`), this.style.setProperty(w, "0px"), this.style.setProperty(C, "0px")), this.restartAnimation();
|
|
198
|
-
}
|
|
199
|
-
getCssIterationCount() {
|
|
200
|
-
return this.behavior === "slide" && !this.hasAttribute(a) ? "1" : this.hasAttribute(a) && Number.isFinite(this.loop) && this.loop > 0 ? String(this.loop) : "infinite";
|
|
201
|
-
}
|
|
202
|
-
handleAnimationEnd() {
|
|
203
|
-
this.hasFiniteAnimation() && (this.running = !1, this.syncAnimationPlayState());
|
|
204
|
-
}
|
|
205
|
-
restartAnimation() {
|
|
206
|
-
this.track.style.animationName = "none", this.track.offsetWidth, this.track.style.removeProperty("animation-name");
|
|
207
|
-
}
|
|
208
|
-
hasFiniteAnimation() {
|
|
209
|
-
return this.behavior === "slide" && !this.hasAttribute(a) ? !0 : this.hasAttribute(a) && Number.isFinite(this.loop) && this.loop > 0;
|
|
210
|
-
}
|
|
211
|
-
}, A = () => {
|
|
212
|
-
typeof customElements > "u" || (customElements.get("re-marquee") || customElements.define("re-marquee", k), customElements.get("re-marquee-ble") || customElements.define("re-marquee-ble", k));
|
|
213
|
-
};
|
|
214
|
-
//#endregion
|
|
215
|
-
export { k as RemarqueebleElement, A as defineRemarqueebleElements, D as parseLegacyColor, E as parsePresentationalDimension };
|