marquee-content 5.0.2-dev.0 → 5.0.2-dev.1
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/dist/index.cjs +92 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +92 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -72,6 +72,7 @@ const OPTION_ATTRIBUTE_MAP = {
|
|
|
72
72
|
};
|
|
73
73
|
const MARQUEE_CONTENT_CSS_PROPS = ["--marquee-content-distance", "--marquee-content-duration"];
|
|
74
74
|
const SCROLL_TIME_SCALE_SMOOTHING_SECONDS = .12;
|
|
75
|
+
const SCROLL_ANIMATION_SEED_ITERATIONS = 500;
|
|
75
76
|
const MARQUEE_CONTENT_RUNTIME_CSS = `
|
|
76
77
|
@keyframes marquee-content-auto {
|
|
77
78
|
to {
|
|
@@ -146,7 +147,10 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
146
147
|
reducedMotion = false;
|
|
147
148
|
isListeningToScroll = false;
|
|
148
149
|
distance = 0;
|
|
149
|
-
|
|
150
|
+
scrollAnimation = null;
|
|
151
|
+
scrollAnimationDuration = 0;
|
|
152
|
+
scrollAnimationDistance = 0;
|
|
153
|
+
scrollProgress = 0;
|
|
150
154
|
scrollDirectionFactor = 1;
|
|
151
155
|
currentTimeScale = 1;
|
|
152
156
|
scrollBoostStartValue = 0;
|
|
@@ -257,6 +261,7 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
257
261
|
this.mounted = false;
|
|
258
262
|
this.stopAnimationLoop();
|
|
259
263
|
this.stopCssAnimation();
|
|
264
|
+
this.cancelScrollAnimation();
|
|
260
265
|
this.cancelScheduledRebuild();
|
|
261
266
|
this.updateScrollListener(false);
|
|
262
267
|
this.resizeObserver?.disconnect();
|
|
@@ -276,7 +281,7 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
276
281
|
this.style.removeProperty(prop);
|
|
277
282
|
});
|
|
278
283
|
this.distance = 0;
|
|
279
|
-
this.
|
|
284
|
+
this.scrollProgress = 0;
|
|
280
285
|
this.currentTimeScale = 1;
|
|
281
286
|
this.lastFrameTime = null;
|
|
282
287
|
}
|
|
@@ -309,7 +314,7 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
309
314
|
handleReducedMotionChange = (event) => {
|
|
310
315
|
this.reducedMotion = event.matches;
|
|
311
316
|
if (this.reducedMotion) this.track.style.transform = "none";
|
|
312
|
-
else if (this.options.mode === "scroll") this.
|
|
317
|
+
else if (this.options.mode === "scroll") this.track.style.transform = "";
|
|
313
318
|
this.updateAnimationLoopState();
|
|
314
319
|
};
|
|
315
320
|
handleScroll = () => {
|
|
@@ -328,8 +333,15 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
328
333
|
this.scrollBoostStartValue = extraSpeed;
|
|
329
334
|
this.scrollBoostStartedAt = now;
|
|
330
335
|
} else this.scrollBoostStartValue = 0;
|
|
331
|
-
this.
|
|
336
|
+
this.onScrollBoostChanged();
|
|
332
337
|
};
|
|
338
|
+
onScrollBoostChanged() {
|
|
339
|
+
if (!this.mounted || this.options.mode !== "scroll" || this.reducedMotion) return;
|
|
340
|
+
this.ensureScrollAnimation();
|
|
341
|
+
if (!this.scrollAnimation || !this.canAnimate()) return;
|
|
342
|
+
this.scrollAnimation.play();
|
|
343
|
+
this.startAnimationLoop();
|
|
344
|
+
}
|
|
333
345
|
updateScrollListener(shouldListen = this.mounted && this.options.mode === "scroll") {
|
|
334
346
|
if (shouldListen === this.isListeningToScroll) return;
|
|
335
347
|
if (shouldListen) {
|
|
@@ -382,7 +394,6 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
382
394
|
clone.setAttribute("aria-hidden", "true");
|
|
383
395
|
this.track.appendChild(clone);
|
|
384
396
|
this.distance = group.scrollWidth;
|
|
385
|
-
this.offset = this.normalizeOffset(this.offset);
|
|
386
397
|
if (this.distance <= 0) {
|
|
387
398
|
this.track.replaceChildren();
|
|
388
399
|
this.updateAnimationLoopState();
|
|
@@ -393,7 +404,6 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
393
404
|
this.style.setProperty("--marquee-content-distance", `${this.distance}px`);
|
|
394
405
|
this.style.setProperty("--marquee-content-duration", `${duration}s`);
|
|
395
406
|
if (this.reducedMotion) this.track.style.transform = "none";
|
|
396
|
-
else if (this.options.mode === "scroll") this.applyTransform();
|
|
397
407
|
else this.track.style.transform = "";
|
|
398
408
|
this.setAttribute("data-marquee-content-ready", "true");
|
|
399
409
|
this.updateAnimationLoopState();
|
|
@@ -463,16 +473,26 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
463
473
|
if (!this.mounted || this.distance <= 0 || this.reducedMotion) {
|
|
464
474
|
this.stopAnimationLoop();
|
|
465
475
|
this.stopCssAnimation();
|
|
476
|
+
this.cancelScrollAnimation();
|
|
466
477
|
if (this.reducedMotion) this.track.style.transform = "none";
|
|
467
478
|
return;
|
|
468
479
|
}
|
|
469
480
|
if (this.options.mode === "scroll") {
|
|
470
481
|
this.stopCssAnimation();
|
|
471
|
-
|
|
472
|
-
|
|
482
|
+
this.track.style.transform = "";
|
|
483
|
+
this.ensureScrollAnimation();
|
|
484
|
+
if (!this.scrollAnimation || !this.canAnimate()) {
|
|
485
|
+
this.scrollAnimation?.pause();
|
|
486
|
+
this.stopAnimationLoop();
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
this.scrollAnimation.play();
|
|
490
|
+
this.updateScrollPlaybackRate(performance.now(), true);
|
|
491
|
+
this.startAnimationLoop();
|
|
473
492
|
return;
|
|
474
493
|
}
|
|
475
494
|
this.stopAnimationLoop();
|
|
495
|
+
this.cancelScrollAnimation();
|
|
476
496
|
this.startCssAnimation();
|
|
477
497
|
this.track.style.animationPlayState = this.canAnimate() ? "running" : "paused";
|
|
478
498
|
}
|
|
@@ -485,7 +505,6 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
485
505
|
startAnimationLoop() {
|
|
486
506
|
if (this.animationFrameId !== null) return;
|
|
487
507
|
this.lastFrameTime = performance.now();
|
|
488
|
-
this.currentTimeScale = this.getCurrentTimeScale(this.lastFrameTime);
|
|
489
508
|
this.animationFrameId = requestAnimationFrame(this.tick);
|
|
490
509
|
}
|
|
491
510
|
stopAnimationLoop() {
|
|
@@ -518,25 +537,73 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
518
537
|
}
|
|
519
538
|
tick = (now) => {
|
|
520
539
|
this.animationFrameId = null;
|
|
521
|
-
if (!this.mounted || this.options.mode !== "scroll" || this.distance <= 0 || this.reducedMotion || !this.canAnimate())
|
|
522
|
-
|
|
540
|
+
if (!this.mounted || this.options.mode !== "scroll" || this.distance <= 0 || this.reducedMotion || !this.canAnimate() || !this.scrollAnimation) return;
|
|
541
|
+
if (!this.updateScrollPlaybackRate(now, false)) this.animationFrameId = requestAnimationFrame(this.tick);
|
|
542
|
+
};
|
|
543
|
+
ensureScrollAnimation() {
|
|
544
|
+
if (this.distance <= 0) {
|
|
545
|
+
this.cancelScrollAnimation();
|
|
523
546
|
return;
|
|
524
547
|
}
|
|
525
|
-
const previousTime = this.lastFrameTime ?? now;
|
|
526
|
-
const deltaTime = Math.min((now - previousTime) / 1e3, .064);
|
|
527
|
-
this.lastFrameTime = now;
|
|
528
548
|
const currentSpeed = this.getCurrentSpeed(this.clientWidth);
|
|
529
|
-
const
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
this.
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
549
|
+
const durationMs = currentSpeed > 0 ? this.distance / currentSpeed * 1e3 : 0;
|
|
550
|
+
if (durationMs <= 0) {
|
|
551
|
+
this.cancelScrollAnimation();
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
if (this.scrollAnimation && this.scrollAnimationDistance === this.distance && this.scrollAnimationDuration === durationMs) return;
|
|
555
|
+
const progress = this.getScrollAnimationProgress();
|
|
556
|
+
const hadAnimation = this.scrollAnimation !== null;
|
|
557
|
+
if (this.scrollAnimation) {
|
|
558
|
+
this.scrollAnimation.cancel();
|
|
559
|
+
this.scrollAnimation = null;
|
|
560
|
+
}
|
|
561
|
+
if (!hadAnimation) this.currentTimeScale = this.getDirectionFactor() * this.scrollDirectionFactor;
|
|
562
|
+
const animation = this.track.animate([{ transform: "translate3d(0px, 0, 0)" }, { transform: `translate3d(${-this.distance}px, 0, 0)` }], {
|
|
563
|
+
duration: durationMs,
|
|
564
|
+
iterations: Number.POSITIVE_INFINITY,
|
|
565
|
+
easing: "linear"
|
|
566
|
+
});
|
|
567
|
+
animation.currentTime = durationMs * (SCROLL_ANIMATION_SEED_ITERATIONS + progress);
|
|
568
|
+
animation.playbackRate = this.currentTimeScale;
|
|
569
|
+
this.scrollAnimation = animation;
|
|
570
|
+
this.scrollAnimationDuration = durationMs;
|
|
571
|
+
this.scrollAnimationDistance = this.distance;
|
|
572
|
+
this.scrollProgress = progress;
|
|
573
|
+
}
|
|
574
|
+
cancelScrollAnimation() {
|
|
575
|
+
if (!this.scrollAnimation) return;
|
|
576
|
+
this.scrollProgress = this.getScrollAnimationProgress();
|
|
577
|
+
this.scrollAnimation.cancel();
|
|
578
|
+
this.scrollAnimation = null;
|
|
579
|
+
this.scrollAnimationDuration = 0;
|
|
580
|
+
this.scrollAnimationDistance = 0;
|
|
581
|
+
}
|
|
582
|
+
getScrollAnimationProgress() {
|
|
583
|
+
const animation = this.scrollAnimation;
|
|
584
|
+
if (!animation || this.scrollAnimationDuration <= 0) return this.scrollProgress;
|
|
585
|
+
const currentTime = animation.currentTime;
|
|
586
|
+
if (typeof currentTime !== "number") return this.scrollProgress;
|
|
587
|
+
const fraction = currentTime / this.scrollAnimationDuration % 1;
|
|
588
|
+
return fraction < 0 ? fraction + 1 : fraction;
|
|
589
|
+
}
|
|
590
|
+
updateScrollPlaybackRate(now, immediate) {
|
|
591
|
+
if (!this.scrollAnimation) return true;
|
|
592
|
+
const target = this.getCurrentTimeScale(now);
|
|
593
|
+
if (immediate) {
|
|
594
|
+
this.currentTimeScale = target;
|
|
595
|
+
this.lastFrameTime = now;
|
|
596
|
+
} else {
|
|
597
|
+
const previousTime = this.lastFrameTime ?? now;
|
|
598
|
+
const deltaTime = Math.min((now - previousTime) / 1e3, .064);
|
|
599
|
+
this.lastFrameTime = now;
|
|
600
|
+
const smoothingFactor = 1 - Math.exp(-deltaTime / SCROLL_TIME_SCALE_SMOOTHING_SECONDS);
|
|
601
|
+
this.currentTimeScale += (target - this.currentTimeScale) * smoothingFactor;
|
|
602
|
+
}
|
|
603
|
+
const settled = this.scrollBoostStartValue === 0 && Math.abs(target - this.currentTimeScale) < .001;
|
|
604
|
+
if (settled) this.currentTimeScale = target;
|
|
605
|
+
if (this.scrollAnimation.playbackRate !== this.currentTimeScale) this.scrollAnimation.playbackRate = this.currentTimeScale;
|
|
606
|
+
return settled;
|
|
540
607
|
}
|
|
541
608
|
getCurrentTimeScale(now) {
|
|
542
609
|
const directionFactor = this.getDirectionFactor();
|
|
@@ -563,14 +630,6 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
563
630
|
const easedProgress = this.easeOutCubic(progress);
|
|
564
631
|
return this.scrollBoostStartValue * (1 - easedProgress);
|
|
565
632
|
}
|
|
566
|
-
applyTransform() {
|
|
567
|
-
this.track.style.transform = `translate3d(${-this.offset}px, 0, 0)`;
|
|
568
|
-
}
|
|
569
|
-
normalizeOffset(value) {
|
|
570
|
-
if (this.distance <= 0) return 0;
|
|
571
|
-
const normalized = value % this.distance;
|
|
572
|
-
return normalized < 0 ? normalized + this.distance : normalized;
|
|
573
|
-
}
|
|
574
633
|
getCurrentSpeed(containerWidth) {
|
|
575
634
|
if (!this.options.responsiveSpeed) return this.options.speed;
|
|
576
635
|
const factor = this.clamp(containerWidth / this.options.referenceWidth, this.options.minSpeedFactor, this.options.maxSpeedFactor);
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["DEFAULT_CSS_TEXT"],"sources":["../src/styles.ts","../src/marquee-content.ts","../src/index.ts"],"sourcesContent":["import './marquee-content.css';\nimport DEFAULT_CSS_TEXT from './marquee-content.css?inline';\n\nexport type MarqueeContentStyleInput = CSSStyleSheet | string | null | undefined;\n\nexport interface MarqueeContentStyleEntry {\n sheet: CSSStyleSheet | null;\n cssText: string;\n}\n\nexport const marqueeContentCssText = DEFAULT_CSS_TEXT;\n\nexport function createConstructableStyleSheet(cssText: string): CSSStyleSheet | null {\n if (\n typeof CSSStyleSheet === 'undefined' ||\n typeof CSSStyleSheet.prototype.replaceSync !== 'function'\n ) {\n return null;\n }\n\n try {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(cssText);\n return sheet;\n } catch {\n return null;\n }\n}\n\nexport function cssStyleSheetToText(sheet: CSSStyleSheet): string {\n try {\n return Array.from(sheet.cssRules)\n .map((rule) => rule.cssText)\n .join('\\n');\n } catch {\n return '';\n }\n}\n\nexport function normalizeStyleInput(input: MarqueeContentStyleInput): MarqueeContentStyleEntry {\n if (!input) {\n return {\n sheet: null,\n cssText: '',\n };\n }\n\n if (typeof input === 'string') {\n return {\n sheet: createConstructableStyleSheet(input),\n cssText: input,\n };\n }\n\n return {\n sheet: input,\n cssText: cssStyleSheetToText(input),\n };\n}\n\nexport function canUseAdoptedStyleSheets(root: ShadowRoot): boolean {\n return (\n typeof CSSStyleSheet !== 'undefined' &&\n 'adoptedStyleSheets' in root &&\n typeof CSSStyleSheet.prototype.replaceSync === 'function'\n );\n}\n","import {\n type MarqueeContentStyleEntry,\n type MarqueeContentStyleInput,\n marqueeContentCssText,\n normalizeStyleInput,\n} from './styles';\n\nexport type MarqueeContentDirection = 'rtl' | 'ltr';\nexport type MarqueeContentMode = 'auto' | 'scroll';\n\nexport interface MarqueeContentOptions {\n speed?: number | string | null;\n mode?: MarqueeContentMode | null;\n direction?: MarqueeContentDirection | null;\n pauseOnHover?: boolean | string | null;\n}\n\ninterface MarqueeContentResolvedOptions {\n speed: number;\n mode: MarqueeContentMode;\n direction: MarqueeContentDirection;\n minGroupWidthRatio: number;\n\n responsiveSpeed: boolean;\n referenceWidth: number;\n minSpeedFactor: number;\n maxSpeedFactor: number;\n\n pauseOnHover: boolean;\n pauseWhenOutOfView: boolean;\n recalculateAfterFontsReady: boolean;\n\n scrollVelocityFactor: number;\n scrollMinExtraSpeed: number;\n scrollMaxExtraSpeed: number;\n scrollInertiaDuration: number;\n}\n\nexport interface DefineMarqueeContentOptions {\n stylesheet?: MarqueeContentStyleInput;\n styleOverrides?: MarqueeContentStyleInput;\n}\n\nexport interface InitMarqueeContentsOptions extends DefineMarqueeContentOptions {\n tagName?: string;\n}\n\nexport const MARQUEE_CONTENT_TAG = 'marquee-content';\n\nconst DEFAULT_OPTIONS: MarqueeContentResolvedOptions = {\n speed: 90,\n mode: 'auto',\n direction: 'rtl',\n minGroupWidthRatio: 1.05,\n\n responsiveSpeed: true,\n referenceWidth: 1280,\n minSpeedFactor: 0.55,\n maxSpeedFactor: 1,\n\n pauseOnHover: false,\n pauseWhenOutOfView: true,\n recalculateAfterFontsReady: true,\n\n scrollVelocityFactor: 150,\n scrollMinExtraSpeed: 0.05,\n scrollMaxExtraSpeed: 5,\n scrollInertiaDuration: 2500,\n};\n\nconst OBSERVED_ATTRIBUTES = ['speed', 'mode', 'direction', 'pause-on-hover'] as const;\n\nconst OPTION_ATTRIBUTE_MAP: Record<keyof MarqueeContentOptions, string> = {\n speed: 'speed',\n mode: 'mode',\n direction: 'direction',\n pauseOnHover: 'pause-on-hover',\n};\n\nconst MARQUEE_CONTENT_CSS_PROPS = [\n '--marquee-content-distance',\n '--marquee-content-duration',\n] as const;\n\nconst SCROLL_TIME_SCALE_SMOOTHING_SECONDS = 0.12;\n\nconst MARQUEE_CONTENT_RUNTIME_CSS = `\n @keyframes marquee-content-auto {\n to {\n transform: translate3d(calc(-1 * var(--marquee-content-distance)), 0, 0);\n }\n }\n\n .marquee-content__source {\n position: absolute;\n width: 0;\n height: 0;\n overflow: hidden;\n }\n\n .marquee-content__source::slotted(*) {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n`;\n\nconst TEMPLATE = `\n <slot class=\"marquee-content__source\"></slot>\n\n <div class=\"marquee-content__viewport\" part=\"viewport\">\n <div class=\"marquee-content__track\" part=\"track\" aria-hidden=\"true\"></div>\n </div>\n`;\n\nexport class MarqueeContent extends HTMLElement {\n static get observedAttributes(): string[] {\n return [...OBSERVED_ATTRIBUTES];\n }\n\n private static readonly instances = new Set<MarqueeContent>();\n\n private static readonly runtimeStylesheetEntry: MarqueeContentStyleEntry = normalizeStyleInput(\n MARQUEE_CONTENT_RUNTIME_CSS,\n );\n\n private static stylesheetEntry: MarqueeContentStyleEntry =\n normalizeStyleInput(marqueeContentCssText);\n\n private static styleOverridesEntry: MarqueeContentStyleEntry = normalizeStyleInput(null);\n\n static configureStyles(options: DefineMarqueeContentOptions = {}): void {\n if ('stylesheet' in options) {\n MarqueeContent.stylesheetEntry = normalizeStyleInput(\n options.stylesheet ?? marqueeContentCssText,\n );\n }\n\n if ('styleOverrides' in options) {\n MarqueeContent.styleOverridesEntry = normalizeStyleInput(options.styleOverrides);\n }\n\n MarqueeContent.instances.forEach((instance) => {\n instance.applyAllStyles();\n });\n }\n\n static setStylesheet(stylesheet: MarqueeContentStyleInput): void {\n MarqueeContent.configureStyles({ stylesheet });\n }\n\n static setStyleOverrides(styleOverrides: MarqueeContentStyleInput): void {\n MarqueeContent.configureStyles({ styleOverrides });\n }\n\n private readonly shadow: ShadowRoot;\n private readonly sourceSlot: HTMLSlotElement;\n private readonly track: HTMLElement;\n\n private options: MarqueeContentResolvedOptions = { ...DEFAULT_OPTIONS };\n private sourceNodes: Node[] = [];\n\n private resizeObserver: ResizeObserver | null = null;\n private mutationObserver: MutationObserver | null = null;\n private intersectionObserver: IntersectionObserver | null = null;\n private abortController: AbortController | null = null;\n private reducedMotionMediaQuery: MediaQueryList | null = null;\n\n private animationFrameId: number | null = null;\n private rebuildFrameId: number | null = null;\n private lastFrameTime: number | null = null;\n\n private mounted = false;\n private isHovered = false;\n private isFocused = false;\n private isInViewport = true;\n private reducedMotion = false;\n private isListeningToScroll = false;\n\n private distance = 0;\n private offset = 0;\n\n private scrollDirectionFactor: 1 | -1 = 1;\n private currentTimeScale = 1;\n private scrollBoostStartValue = 0;\n private scrollBoostStartedAt = 0;\n private lastScrollY = 0;\n private lastScrollTime = 0;\n\n constructor() {\n super();\n\n this.shadow = this.attachShadow({ mode: 'open' });\n this.applyAllStyles();\n\n const template = document.createElement('template');\n template.innerHTML = TEMPLATE;\n this.shadow.appendChild(template.content.cloneNode(true));\n\n const sourceSlot = this.shadow.querySelector<HTMLSlotElement>('slot.marquee-content__source');\n\n const track = this.shadow.querySelector<HTMLElement>('.marquee-content__track');\n\n if (!sourceSlot) {\n throw new Error('[MarqueeContent] Source slot was not found.');\n }\n\n if (!track) {\n throw new Error('[MarqueeContent] Track element was not found.');\n }\n\n this.sourceSlot = sourceSlot;\n this.track = track;\n }\n\n connectedCallback(): void {\n if (this.mounted) {\n return;\n }\n\n MarqueeContent.instances.add(this);\n\n this.mounted = true;\n this.abortController = new AbortController();\n this.options = this.resolveOptions();\n\n this.lastScrollY = this.getScrollY();\n this.lastScrollTime = performance.now();\n\n this.sourceSlot.addEventListener('slotchange', this.handleSlotChange, {\n signal: this.abortController.signal,\n });\n\n this.shadow.addEventListener('load', this.scheduleRebuild, {\n capture: true,\n signal: this.abortController.signal,\n });\n\n this.addEventListener('pointerenter', this.handlePointerEnter, {\n signal: this.abortController.signal,\n });\n\n this.addEventListener('pointerleave', this.handlePointerLeave, {\n signal: this.abortController.signal,\n });\n\n this.addEventListener('focusin', this.handleFocusIn, {\n signal: this.abortController.signal,\n });\n\n this.addEventListener('focusout', this.handleFocusOut, {\n signal: this.abortController.signal,\n });\n\n window.addEventListener('orientationchange', this.scheduleRebuild, {\n signal: this.abortController.signal,\n });\n\n this.resizeObserver = new ResizeObserver(this.scheduleRebuild);\n this.resizeObserver.observe(this);\n\n this.intersectionObserver = new IntersectionObserver(this.handleIntersectionChange);\n this.intersectionObserver.observe(this);\n\n this.setupReducedMotionWatcher();\n this.watchSourceNodes();\n this.updateScrollListener();\n this.rebuild();\n\n if (this.options.recalculateAfterFontsReady) {\n this.rebuildAfterFontsReady();\n }\n }\n\n disconnectedCallback(): void {\n this.teardown();\n MarqueeContent.instances.delete(this);\n }\n\n attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void {\n if (oldValue === newValue) {\n return;\n }\n\n this.options = this.resolveOptions();\n\n if (!this.mounted) {\n return;\n }\n\n this.updateScrollListener();\n this.scheduleRebuild();\n }\n\n get speed(): number {\n return this.options.speed;\n }\n\n set speed(value: number | string | null | undefined) {\n this.setNullableAttribute('speed', value);\n }\n\n get mode(): MarqueeContentMode {\n return this.options.mode;\n }\n\n set mode(value: MarqueeContentMode | null | undefined) {\n this.setNullableAttribute('mode', value);\n }\n\n get direction(): MarqueeContentDirection {\n return this.options.direction;\n }\n\n set direction(value: MarqueeContentDirection | null | undefined) {\n this.setNullableAttribute('direction', value);\n }\n\n get pauseOnHover(): boolean {\n return this.options.pauseOnHover;\n }\n\n set pauseOnHover(value: boolean | string | null | undefined) {\n this.setNullableAttribute('pause-on-hover', value);\n }\n\n update(options: MarqueeContentOptions = {}): void {\n Object.entries(options).forEach(([key, value]) => {\n const attributeName = OPTION_ATTRIBUTE_MAP[key as keyof MarqueeContentOptions];\n\n if (attributeName) {\n this.setNullableAttribute(attributeName, value);\n }\n });\n\n this.options = this.resolveOptions();\n this.updateScrollListener();\n this.scheduleRebuild();\n }\n\n refresh(): void {\n this.scheduleRebuild();\n }\n\n private applyAllStyles(): void {\n const runtime = MarqueeContent.runtimeStylesheetEntry;\n const base = MarqueeContent.stylesheetEntry;\n const overrides = MarqueeContent.styleOverridesEntry;\n const sheets: CSSStyleSheet[] = [];\n\n if (runtime.sheet) {\n sheets.push(runtime.sheet);\n }\n\n if (base.sheet) {\n sheets.push(base.sheet);\n }\n\n if (overrides.sheet) {\n sheets.push(overrides.sheet);\n }\n\n this.shadow.adoptedStyleSheets = sheets;\n }\n\n private teardown(): void {\n if (!this.mounted) {\n return;\n }\n\n this.mounted = false;\n\n this.stopAnimationLoop();\n this.stopCssAnimation();\n this.cancelScheduledRebuild();\n this.updateScrollListener(false);\n\n this.resizeObserver?.disconnect();\n this.mutationObserver?.disconnect();\n this.intersectionObserver?.disconnect();\n\n this.removeReducedMotionWatcher();\n\n this.abortController?.abort();\n\n this.resizeObserver = null;\n this.mutationObserver = null;\n this.intersectionObserver = null;\n this.abortController = null;\n\n this.track.replaceChildren();\n this.removeAttribute('data-marquee-content-ready');\n this.removeAttribute('data-marquee-content-mode');\n this.removeAttribute('data-marquee-content-pause-on-hover');\n\n MARQUEE_CONTENT_CSS_PROPS.forEach((prop) => {\n this.style.removeProperty(prop);\n });\n\n this.distance = 0;\n this.offset = 0;\n this.currentTimeScale = 1;\n this.lastFrameTime = null;\n }\n\n private handleSlotChange = (): void => {\n this.watchSourceNodes();\n this.scheduleRebuild();\n };\n\n private handlePointerEnter = (): void => {\n this.isHovered = true;\n this.updateAnimationLoopState();\n };\n\n private handlePointerLeave = (): void => {\n this.isHovered = false;\n this.updateAnimationLoopState();\n };\n\n private handleFocusIn = (): void => {\n this.isFocused = true;\n this.updateAnimationLoopState();\n };\n\n private handleFocusOut = (): void => {\n this.isFocused = false;\n this.updateAnimationLoopState();\n };\n\n private handleIntersectionChange = (entries: IntersectionObserverEntry[]): void => {\n const entry = entries[0];\n\n if (!entry) {\n return;\n }\n\n this.isInViewport = entry.isIntersecting;\n this.updateAnimationLoopState();\n };\n\n private handleReducedMotionChange = (event: MediaQueryListEvent | MediaQueryList): void => {\n this.reducedMotion = event.matches;\n\n if (this.reducedMotion) {\n this.track.style.transform = 'none';\n } else if (this.options.mode === 'scroll') {\n this.applyTransform();\n }\n\n this.updateAnimationLoopState();\n };\n\n private handleScroll = (): void => {\n if (this.options.mode !== 'scroll') {\n return;\n }\n\n const now = performance.now();\n const currentScrollY = this.getScrollY();\n\n const deltaY = currentScrollY - this.lastScrollY;\n const deltaTime = Math.max((now - this.lastScrollTime) / 1000, 0.016);\n\n this.lastScrollY = currentScrollY;\n this.lastScrollTime = now;\n\n if (Math.abs(deltaY) < 0.5) {\n return;\n }\n\n const velocity = deltaY / deltaTime;\n\n this.scrollDirectionFactor = velocity >= 0 ? 1 : -1;\n\n const extraSpeed = this.clamp(\n velocity / this.options.scrollVelocityFactor,\n -this.options.scrollMaxExtraSpeed,\n this.options.scrollMaxExtraSpeed,\n );\n\n if (Math.abs(extraSpeed) >= this.options.scrollMinExtraSpeed) {\n this.scrollBoostStartValue = extraSpeed;\n this.scrollBoostStartedAt = now;\n } else {\n this.scrollBoostStartValue = 0;\n }\n\n this.updateAnimationLoopState();\n };\n\n private updateScrollListener(\n shouldListen = this.mounted && this.options.mode === 'scroll',\n ): void {\n if (shouldListen === this.isListeningToScroll) {\n return;\n }\n\n if (shouldListen) {\n this.lastScrollY = this.getScrollY();\n this.lastScrollTime = performance.now();\n window.addEventListener('scroll', this.handleScroll, { passive: true });\n } else {\n window.removeEventListener('scroll', this.handleScroll);\n }\n\n this.isListeningToScroll = shouldListen;\n }\n\n private scheduleRebuild = (): void => {\n if (!this.mounted) {\n return;\n }\n\n this.cancelScheduledRebuild();\n\n this.rebuildFrameId = requestAnimationFrame(() => {\n this.rebuildFrameId = null;\n this.rebuild();\n });\n };\n\n private cancelScheduledRebuild(): void {\n if (this.rebuildFrameId === null) {\n return;\n }\n\n cancelAnimationFrame(this.rebuildFrameId);\n this.rebuildFrameId = null;\n }\n\n private rebuild(): void {\n if (!this.mounted) {\n return;\n }\n\n this.options = this.resolveOptions();\n this.updateScrollListener();\n this.removeAttribute('data-marquee-content-ready');\n this.setAttribute('data-marquee-content-mode', this.options.mode);\n\n if (this.options.pauseOnHover) {\n this.setAttribute('data-marquee-content-pause-on-hover', 'true');\n } else {\n this.removeAttribute('data-marquee-content-pause-on-hover');\n }\n\n const containerWidth = this.clientWidth;\n\n if (containerWidth <= 0) {\n this.distance = 0;\n this.track.replaceChildren();\n this.updateAnimationLoopState();\n return;\n }\n\n this.sourceNodes = this.getSourceNodes();\n\n if (this.sourceNodes.length === 0) {\n this.distance = 0;\n this.track.replaceChildren();\n this.updateAnimationLoopState();\n return;\n }\n\n const group = this.createGroup();\n const targetWidth = containerWidth * this.options.minGroupWidthRatio;\n\n this.track.replaceChildren(group);\n this.expandGroupToWidth(group, targetWidth);\n\n const clone = group.cloneNode(true) as HTMLElement;\n\n clone.setAttribute('aria-hidden', 'true');\n this.track.appendChild(clone);\n\n this.distance = group.scrollWidth;\n this.offset = this.normalizeOffset(this.offset);\n\n if (this.distance <= 0) {\n this.track.replaceChildren();\n this.updateAnimationLoopState();\n return;\n }\n\n const currentSpeed = this.getCurrentSpeed(containerWidth);\n const duration = this.distance / currentSpeed;\n\n this.style.setProperty('--marquee-content-distance', `${this.distance}px`);\n this.style.setProperty('--marquee-content-duration', `${duration}s`);\n\n if (this.reducedMotion) {\n this.track.style.transform = 'none';\n } else if (this.options.mode === 'scroll') {\n this.applyTransform();\n } else {\n this.track.style.transform = '';\n }\n\n this.setAttribute('data-marquee-content-ready', 'true');\n this.updateAnimationLoopState();\n }\n\n private createGroup(): HTMLElement {\n const group = document.createElement('div');\n\n group.className = 'marquee-content__group';\n group.setAttribute('part', 'group');\n\n this.appendSourceNodes(group);\n\n return group;\n }\n\n private expandGroupToWidth(group: HTMLElement, targetWidth: number): void {\n const sourceSetWidth = group.scrollWidth;\n\n if (sourceSetWidth <= 0) {\n return;\n }\n\n const repeatCount = Math.ceil(targetWidth / sourceSetWidth);\n\n for (let index = 1; index < repeatCount; index += 1) {\n this.appendSourceNodes(group);\n }\n }\n\n private appendSourceNodes(target: HTMLElement): void {\n const fragment = document.createDocumentFragment();\n\n this.sourceNodes.forEach((node) => {\n fragment.append(this.cloneSourceNode(node));\n });\n\n target.appendChild(fragment);\n }\n\n private cloneSourceNode(node: Node): Node {\n const clone = node.cloneNode(true);\n\n if (clone instanceof Element) {\n const currentPart = clone.getAttribute('part');\n\n clone.setAttribute('part', currentPart ? `${currentPart} item` : 'item');\n }\n\n return clone;\n }\n\n private getSourceNodes(): Node[] {\n return this.sourceSlot.assignedNodes({ flatten: true }).filter((node) => {\n if (node.nodeType === Node.TEXT_NODE) {\n return Boolean(node.textContent?.trim());\n }\n\n return node.nodeType === Node.ELEMENT_NODE;\n });\n }\n\n private watchSourceNodes(): void {\n this.mutationObserver?.disconnect();\n\n this.mutationObserver = new MutationObserver(this.scheduleRebuild);\n\n this.getSourceNodes().forEach((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n this.mutationObserver?.observe(node, {\n attributes: true,\n childList: true,\n characterData: true,\n subtree: true,\n });\n\n return;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n this.mutationObserver?.observe(node, {\n characterData: true,\n });\n }\n });\n }\n\n private setupReducedMotionWatcher(): void {\n if (!('matchMedia' in window)) {\n return;\n }\n\n this.reducedMotionMediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');\n\n this.reducedMotion = this.reducedMotionMediaQuery.matches;\n this.reducedMotionMediaQuery.addEventListener('change', this.handleReducedMotionChange, {\n signal: this.abortController?.signal,\n });\n }\n\n private removeReducedMotionWatcher(): void {\n if (!this.reducedMotionMediaQuery) {\n return;\n }\n\n this.reducedMotionMediaQuery.removeEventListener('change', this.handleReducedMotionChange);\n\n this.reducedMotionMediaQuery = null;\n }\n\n private updateAnimationLoopState(): void {\n if (!this.mounted || this.distance <= 0 || this.reducedMotion) {\n this.stopAnimationLoop();\n this.stopCssAnimation();\n\n if (this.reducedMotion) {\n this.track.style.transform = 'none';\n }\n\n return;\n }\n\n if (this.options.mode === 'scroll') {\n this.stopCssAnimation();\n\n if (this.canAnimate()) {\n this.startAnimationLoop();\n } else {\n this.stopAnimationLoop();\n }\n\n return;\n }\n\n this.stopAnimationLoop();\n this.startCssAnimation();\n this.track.style.animationPlayState = this.canAnimate() ? 'running' : 'paused';\n }\n\n private canAnimate(): boolean {\n if (this.options.pauseOnHover && this.isHovered) {\n return false;\n }\n\n if (this.isFocused) {\n return false;\n }\n\n if (this.options.pauseWhenOutOfView && !this.isInViewport) {\n return false;\n }\n\n return true;\n }\n\n private startAnimationLoop(): void {\n if (this.animationFrameId !== null) {\n return;\n }\n\n this.lastFrameTime = performance.now();\n this.currentTimeScale = this.getCurrentTimeScale(this.lastFrameTime);\n this.animationFrameId = requestAnimationFrame(this.tick);\n }\n\n private stopAnimationLoop(): void {\n if (this.animationFrameId === null) {\n this.lastFrameTime = null;\n return;\n }\n\n cancelAnimationFrame(this.animationFrameId);\n this.animationFrameId = null;\n this.lastFrameTime = null;\n }\n\n private startCssAnimation(): void {\n const animationDirection = this.options.direction === 'ltr' ? 'reverse' : 'normal';\n\n this.track.style.transform = '';\n\n if (this.track.style.animationName !== 'marquee-content-auto') {\n this.track.style.animationName = 'marquee-content-auto';\n this.track.style.animationDuration = 'var(--marquee-content-duration)';\n this.track.style.animationTimingFunction = 'linear';\n this.track.style.animationIterationCount = 'infinite';\n }\n\n if (this.track.style.animationDirection !== animationDirection) {\n this.track.style.animationDirection = animationDirection;\n }\n }\n\n private stopCssAnimation(): void {\n this.track.style.animationName = '';\n this.track.style.animationDuration = '';\n this.track.style.animationTimingFunction = '';\n this.track.style.animationIterationCount = '';\n this.track.style.animationDirection = '';\n this.track.style.animationPlayState = '';\n }\n\n private tick = (now: number): void => {\n this.animationFrameId = null;\n\n if (\n !this.mounted ||\n this.options.mode !== 'scroll' ||\n this.distance <= 0 ||\n this.reducedMotion ||\n !this.canAnimate()\n ) {\n this.stopAnimationLoop();\n return;\n }\n\n const previousTime = this.lastFrameTime ?? now;\n const deltaTime = Math.min((now - previousTime) / 1000, 0.064);\n\n this.lastFrameTime = now;\n\n const currentSpeed = this.getCurrentSpeed(this.clientWidth);\n const targetTimeScale = this.getCurrentTimeScale(now);\n const smoothingFactor = this.getScrollTimeScaleSmoothingFactor(deltaTime);\n\n this.currentTimeScale += (targetTimeScale - this.currentTimeScale) * smoothingFactor;\n\n if (Math.abs(targetTimeScale - this.currentTimeScale) < 0.001) {\n this.currentTimeScale = targetTimeScale;\n }\n\n this.offset = this.normalizeOffset(\n this.offset + currentSpeed * this.currentTimeScale * deltaTime,\n );\n\n this.applyTransform();\n\n this.animationFrameId = requestAnimationFrame(this.tick);\n };\n\n private getScrollTimeScaleSmoothingFactor(deltaTime: number): number {\n if (this.options.mode !== 'scroll') {\n return 1;\n }\n\n return 1 - Math.exp(-deltaTime / SCROLL_TIME_SCALE_SMOOTHING_SECONDS);\n }\n\n private getCurrentTimeScale(now: number): number {\n const directionFactor = this.getDirectionFactor();\n\n if (this.options.mode !== 'scroll') {\n return directionFactor;\n }\n\n const boost = this.getScrollBoost(now);\n const scrollTimeScale = this.scrollDirectionFactor + boost;\n\n return this.clamp(\n directionFactor * scrollTimeScale,\n -1 - this.options.scrollMaxExtraSpeed,\n 1 + this.options.scrollMaxExtraSpeed,\n );\n }\n\n private getDirectionFactor(): 1 | -1 {\n return this.options.direction === 'ltr' ? -1 : 1;\n }\n\n private getScrollBoost(now: number): number {\n if (this.scrollBoostStartValue === 0) {\n return 0;\n }\n\n const duration = this.options.scrollInertiaDuration;\n\n if (duration <= 0) {\n this.scrollBoostStartValue = 0;\n return 0;\n }\n\n const progress = this.clamp((now - this.scrollBoostStartedAt) / duration, 0, 1);\n\n if (progress >= 1) {\n this.scrollBoostStartValue = 0;\n return 0;\n }\n\n const easedProgress = this.easeOutCubic(progress);\n\n return this.scrollBoostStartValue * (1 - easedProgress);\n }\n\n private applyTransform(): void {\n this.track.style.transform = `translate3d(${-this.offset}px, 0, 0)`;\n }\n\n private normalizeOffset(value: number): number {\n if (this.distance <= 0) {\n return 0;\n }\n\n const normalized = value % this.distance;\n\n return normalized < 0 ? normalized + this.distance : normalized;\n }\n\n private getCurrentSpeed(containerWidth: number): number {\n if (!this.options.responsiveSpeed) {\n return this.options.speed;\n }\n\n const factor = this.clamp(\n containerWidth / this.options.referenceWidth,\n this.options.minSpeedFactor,\n this.options.maxSpeedFactor,\n );\n\n return this.options.speed * factor;\n }\n\n private resolveOptions(): MarqueeContentResolvedOptions {\n return {\n ...DEFAULT_OPTIONS,\n speed: this.num('speed', DEFAULT_OPTIONS.speed, 10, 500),\n mode: this.parseMode(this.getAttribute('mode'), DEFAULT_OPTIONS.mode),\n direction: this.parseDirection(this.getAttribute('direction'), DEFAULT_OPTIONS.direction),\n pauseOnHover: this.parseBoolean(\n this.getAttribute('pause-on-hover'),\n DEFAULT_OPTIONS.pauseOnHover,\n ),\n };\n }\n\n private num(attributeName: string, fallback: number, min: number, max: number): number {\n return this.clamp(this.parseNumber(this.getAttribute(attributeName), fallback), min, max);\n }\n\n private parseNumber(value: string | null, fallback: number): number {\n if (value === null || value.trim() === '') {\n return fallback;\n }\n\n const parsed = Number(value);\n\n return Number.isFinite(parsed) ? parsed : fallback;\n }\n\n private parseBoolean(value: string | null, fallback: boolean): boolean {\n if (value === null) {\n return fallback;\n }\n\n const normalizedValue = value.trim().toLowerCase();\n\n if (normalizedValue === '') {\n return true;\n }\n\n if (['true', '1', 'yes', 'on'].includes(normalizedValue)) {\n return true;\n }\n\n if (['false', '0', 'no', 'off'].includes(normalizedValue)) {\n return false;\n }\n\n return fallback;\n }\n\n private parseMode(value: string | null, fallback: MarqueeContentMode): MarqueeContentMode {\n if (value === 'auto' || value === 'scroll') {\n return value;\n }\n\n return fallback;\n }\n\n private parseDirection(\n value: string | null,\n fallback: MarqueeContentDirection,\n ): MarqueeContentDirection {\n if (value === 'rtl' || value === 'ltr') {\n return value;\n }\n\n return fallback;\n }\n\n private setNullableAttribute(\n name: string,\n value: string | number | boolean | null | undefined,\n ): void {\n if (value === null || value === undefined) {\n this.removeAttribute(name);\n return;\n }\n\n this.setAttribute(name, String(value));\n }\n\n private getScrollY(): number {\n return window.scrollY || window.pageYOffset || 0;\n }\n\n private clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n }\n\n private easeOutCubic(value: number): number {\n return 1 - (1 - value) ** 3;\n }\n\n private rebuildAfterFontsReady(): void {\n const fonts = (\n document as Document & {\n fonts?: { ready: Promise<unknown> };\n }\n ).fonts;\n\n if (!fonts?.ready) {\n return;\n }\n\n void fonts.ready.then(this.scheduleRebuild).catch(() => undefined);\n }\n}\n\nexport function defineMarqueeContent(\n tagName = MARQUEE_CONTENT_TAG,\n options: DefineMarqueeContentOptions = {},\n): void {\n if (typeof window === 'undefined' || !window.customElements) {\n return;\n }\n\n MarqueeContent.configureStyles(options);\n\n if (!window.customElements.get(tagName)) {\n window.customElements.define(tagName, MarqueeContent);\n }\n}\n\nexport function initMarqueeContents(options: InitMarqueeContentsOptions = {}): void {\n const { tagName = MARQUEE_CONTENT_TAG, ...styleOptions } = options;\n\n defineMarqueeContent(tagName, styleOptions);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'marquee-content': MarqueeContent;\n }\n}\n","export type {\n DefineMarqueeContentOptions,\n InitMarqueeContentsOptions,\n MarqueeContentDirection,\n MarqueeContentMode,\n MarqueeContentOptions,\n} from './marquee-content';\nexport {\n defineMarqueeContent,\n initMarqueeContents,\n MARQUEE_CONTENT_TAG,\n MarqueeContent,\n} from './marquee-content';\nexport type {\n MarqueeContentStyleEntry,\n MarqueeContentStyleInput,\n} from './styles';\nexport {\n createConstructableStyleSheet,\n cssStyleSheetToText,\n marqueeContentCssText,\n normalizeStyleInput,\n} from './styles';\n\nimport { defineMarqueeContent } from './marquee-content';\n\ndefineMarqueeContent();\n"],"mappings":";;;;;;;AAUA,MAAa,wBAAw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AO;CAEtC,IAAI,CAAC,OAAO,eAAe,IAAI,OAAO,GACpC,OAAO,eAAe,OAAO,SAAS,cAAc;AAExD;AAEA,SAAgB,oBAAoB,UAAsC,CAAC,GAAS;CAClF,MAAM,EAAE,UAAU,qBAAqB,GAAG,iBAAiB;CAE3D,qBAAqB,SAAS,YAAY;AAC5C;;;;ACjgCA,qBAAqB"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["DEFAULT_CSS_TEXT"],"sources":["../src/styles.ts","../src/marquee-content.ts","../src/index.ts"],"sourcesContent":["import './marquee-content.css';\nimport DEFAULT_CSS_TEXT from './marquee-content.css?inline';\n\nexport type MarqueeContentStyleInput = CSSStyleSheet | string | null | undefined;\n\nexport interface MarqueeContentStyleEntry {\n sheet: CSSStyleSheet | null;\n cssText: string;\n}\n\nexport const marqueeContentCssText = DEFAULT_CSS_TEXT;\n\nexport function createConstructableStyleSheet(cssText: string): CSSStyleSheet | null {\n if (\n typeof CSSStyleSheet === 'undefined' ||\n typeof CSSStyleSheet.prototype.replaceSync !== 'function'\n ) {\n return null;\n }\n\n try {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(cssText);\n return sheet;\n } catch {\n return null;\n }\n}\n\nexport function cssStyleSheetToText(sheet: CSSStyleSheet): string {\n try {\n return Array.from(sheet.cssRules)\n .map((rule) => rule.cssText)\n .join('\\n');\n } catch {\n return '';\n }\n}\n\nexport function normalizeStyleInput(input: MarqueeContentStyleInput): MarqueeContentStyleEntry {\n if (!input) {\n return {\n sheet: null,\n cssText: '',\n };\n }\n\n if (typeof input === 'string') {\n return {\n sheet: createConstructableStyleSheet(input),\n cssText: input,\n };\n }\n\n return {\n sheet: input,\n cssText: cssStyleSheetToText(input),\n };\n}\n\nexport function canUseAdoptedStyleSheets(root: ShadowRoot): boolean {\n return (\n typeof CSSStyleSheet !== 'undefined' &&\n 'adoptedStyleSheets' in root &&\n typeof CSSStyleSheet.prototype.replaceSync === 'function'\n );\n}\n","import {\n type MarqueeContentStyleEntry,\n type MarqueeContentStyleInput,\n marqueeContentCssText,\n normalizeStyleInput,\n} from './styles';\n\nexport type MarqueeContentDirection = 'rtl' | 'ltr';\nexport type MarqueeContentMode = 'auto' | 'scroll';\n\nexport interface MarqueeContentOptions {\n speed?: number | string | null;\n mode?: MarqueeContentMode | null;\n direction?: MarqueeContentDirection | null;\n pauseOnHover?: boolean | string | null;\n}\n\ninterface MarqueeContentResolvedOptions {\n speed: number;\n mode: MarqueeContentMode;\n direction: MarqueeContentDirection;\n minGroupWidthRatio: number;\n\n responsiveSpeed: boolean;\n referenceWidth: number;\n minSpeedFactor: number;\n maxSpeedFactor: number;\n\n pauseOnHover: boolean;\n pauseWhenOutOfView: boolean;\n recalculateAfterFontsReady: boolean;\n\n scrollVelocityFactor: number;\n scrollMinExtraSpeed: number;\n scrollMaxExtraSpeed: number;\n scrollInertiaDuration: number;\n}\n\nexport interface DefineMarqueeContentOptions {\n stylesheet?: MarqueeContentStyleInput;\n styleOverrides?: MarqueeContentStyleInput;\n}\n\nexport interface InitMarqueeContentsOptions extends DefineMarqueeContentOptions {\n tagName?: string;\n}\n\nexport const MARQUEE_CONTENT_TAG = 'marquee-content';\n\nconst DEFAULT_OPTIONS: MarqueeContentResolvedOptions = {\n speed: 90,\n mode: 'auto',\n direction: 'rtl',\n minGroupWidthRatio: 1.05,\n\n responsiveSpeed: true,\n referenceWidth: 1280,\n minSpeedFactor: 0.55,\n maxSpeedFactor: 1,\n\n pauseOnHover: false,\n pauseWhenOutOfView: true,\n recalculateAfterFontsReady: true,\n\n scrollVelocityFactor: 150,\n scrollMinExtraSpeed: 0.05,\n scrollMaxExtraSpeed: 5,\n scrollInertiaDuration: 2500,\n};\n\nconst OBSERVED_ATTRIBUTES = ['speed', 'mode', 'direction', 'pause-on-hover'] as const;\n\nconst OPTION_ATTRIBUTE_MAP: Record<keyof MarqueeContentOptions, string> = {\n speed: 'speed',\n mode: 'mode',\n direction: 'direction',\n pauseOnHover: 'pause-on-hover',\n};\n\nconst MARQUEE_CONTENT_CSS_PROPS = [\n '--marquee-content-distance',\n '--marquee-content-duration',\n] as const;\n\nconst SCROLL_TIME_SCALE_SMOOTHING_SECONDS = 0.12;\n\nconst SCROLL_ANIMATION_SEED_ITERATIONS = 500;\n\nconst MARQUEE_CONTENT_RUNTIME_CSS = `\n @keyframes marquee-content-auto {\n to {\n transform: translate3d(calc(-1 * var(--marquee-content-distance)), 0, 0);\n }\n }\n\n .marquee-content__source {\n position: absolute;\n width: 0;\n height: 0;\n overflow: hidden;\n }\n\n .marquee-content__source::slotted(*) {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n`;\n\nconst TEMPLATE = `\n <slot class=\"marquee-content__source\"></slot>\n\n <div class=\"marquee-content__viewport\" part=\"viewport\">\n <div class=\"marquee-content__track\" part=\"track\" aria-hidden=\"true\"></div>\n </div>\n`;\n\nexport class MarqueeContent extends HTMLElement {\n static get observedAttributes(): string[] {\n return [...OBSERVED_ATTRIBUTES];\n }\n\n private static readonly instances = new Set<MarqueeContent>();\n\n private static readonly runtimeStylesheetEntry: MarqueeContentStyleEntry = normalizeStyleInput(\n MARQUEE_CONTENT_RUNTIME_CSS,\n );\n\n private static stylesheetEntry: MarqueeContentStyleEntry =\n normalizeStyleInput(marqueeContentCssText);\n\n private static styleOverridesEntry: MarqueeContentStyleEntry = normalizeStyleInput(null);\n\n static configureStyles(options: DefineMarqueeContentOptions = {}): void {\n if ('stylesheet' in options) {\n MarqueeContent.stylesheetEntry = normalizeStyleInput(\n options.stylesheet ?? marqueeContentCssText,\n );\n }\n\n if ('styleOverrides' in options) {\n MarqueeContent.styleOverridesEntry = normalizeStyleInput(options.styleOverrides);\n }\n\n MarqueeContent.instances.forEach((instance) => {\n instance.applyAllStyles();\n });\n }\n\n static setStylesheet(stylesheet: MarqueeContentStyleInput): void {\n MarqueeContent.configureStyles({ stylesheet });\n }\n\n static setStyleOverrides(styleOverrides: MarqueeContentStyleInput): void {\n MarqueeContent.configureStyles({ styleOverrides });\n }\n\n private readonly shadow: ShadowRoot;\n private readonly sourceSlot: HTMLSlotElement;\n private readonly track: HTMLElement;\n\n private options: MarqueeContentResolvedOptions = { ...DEFAULT_OPTIONS };\n private sourceNodes: Node[] = [];\n\n private resizeObserver: ResizeObserver | null = null;\n private mutationObserver: MutationObserver | null = null;\n private intersectionObserver: IntersectionObserver | null = null;\n private abortController: AbortController | null = null;\n private reducedMotionMediaQuery: MediaQueryList | null = null;\n\n private animationFrameId: number | null = null;\n private rebuildFrameId: number | null = null;\n private lastFrameTime: number | null = null;\n\n private mounted = false;\n private isHovered = false;\n private isFocused = false;\n private isInViewport = true;\n private reducedMotion = false;\n private isListeningToScroll = false;\n\n private distance = 0;\n\n private scrollAnimation: Animation | null = null;\n private scrollAnimationDuration = 0;\n private scrollAnimationDistance = 0;\n private scrollProgress = 0;\n\n private scrollDirectionFactor: 1 | -1 = 1;\n private currentTimeScale = 1;\n private scrollBoostStartValue = 0;\n private scrollBoostStartedAt = 0;\n private lastScrollY = 0;\n private lastScrollTime = 0;\n\n constructor() {\n super();\n\n this.shadow = this.attachShadow({ mode: 'open' });\n this.applyAllStyles();\n\n const template = document.createElement('template');\n template.innerHTML = TEMPLATE;\n this.shadow.appendChild(template.content.cloneNode(true));\n\n const sourceSlot = this.shadow.querySelector<HTMLSlotElement>('slot.marquee-content__source');\n\n const track = this.shadow.querySelector<HTMLElement>('.marquee-content__track');\n\n if (!sourceSlot) {\n throw new Error('[MarqueeContent] Source slot was not found.');\n }\n\n if (!track) {\n throw new Error('[MarqueeContent] Track element was not found.');\n }\n\n this.sourceSlot = sourceSlot;\n this.track = track;\n }\n\n connectedCallback(): void {\n if (this.mounted) {\n return;\n }\n\n MarqueeContent.instances.add(this);\n\n this.mounted = true;\n this.abortController = new AbortController();\n this.options = this.resolveOptions();\n\n this.lastScrollY = this.getScrollY();\n this.lastScrollTime = performance.now();\n\n this.sourceSlot.addEventListener('slotchange', this.handleSlotChange, {\n signal: this.abortController.signal,\n });\n\n this.shadow.addEventListener('load', this.scheduleRebuild, {\n capture: true,\n signal: this.abortController.signal,\n });\n\n this.addEventListener('pointerenter', this.handlePointerEnter, {\n signal: this.abortController.signal,\n });\n\n this.addEventListener('pointerleave', this.handlePointerLeave, {\n signal: this.abortController.signal,\n });\n\n this.addEventListener('focusin', this.handleFocusIn, {\n signal: this.abortController.signal,\n });\n\n this.addEventListener('focusout', this.handleFocusOut, {\n signal: this.abortController.signal,\n });\n\n window.addEventListener('orientationchange', this.scheduleRebuild, {\n signal: this.abortController.signal,\n });\n\n this.resizeObserver = new ResizeObserver(this.scheduleRebuild);\n this.resizeObserver.observe(this);\n\n this.intersectionObserver = new IntersectionObserver(this.handleIntersectionChange);\n this.intersectionObserver.observe(this);\n\n this.setupReducedMotionWatcher();\n this.watchSourceNodes();\n this.updateScrollListener();\n this.rebuild();\n\n if (this.options.recalculateAfterFontsReady) {\n this.rebuildAfterFontsReady();\n }\n }\n\n disconnectedCallback(): void {\n this.teardown();\n MarqueeContent.instances.delete(this);\n }\n\n attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void {\n if (oldValue === newValue) {\n return;\n }\n\n this.options = this.resolveOptions();\n\n if (!this.mounted) {\n return;\n }\n\n this.updateScrollListener();\n this.scheduleRebuild();\n }\n\n get speed(): number {\n return this.options.speed;\n }\n\n set speed(value: number | string | null | undefined) {\n this.setNullableAttribute('speed', value);\n }\n\n get mode(): MarqueeContentMode {\n return this.options.mode;\n }\n\n set mode(value: MarqueeContentMode | null | undefined) {\n this.setNullableAttribute('mode', value);\n }\n\n get direction(): MarqueeContentDirection {\n return this.options.direction;\n }\n\n set direction(value: MarqueeContentDirection | null | undefined) {\n this.setNullableAttribute('direction', value);\n }\n\n get pauseOnHover(): boolean {\n return this.options.pauseOnHover;\n }\n\n set pauseOnHover(value: boolean | string | null | undefined) {\n this.setNullableAttribute('pause-on-hover', value);\n }\n\n update(options: MarqueeContentOptions = {}): void {\n Object.entries(options).forEach(([key, value]) => {\n const attributeName = OPTION_ATTRIBUTE_MAP[key as keyof MarqueeContentOptions];\n\n if (attributeName) {\n this.setNullableAttribute(attributeName, value);\n }\n });\n\n this.options = this.resolveOptions();\n this.updateScrollListener();\n this.scheduleRebuild();\n }\n\n refresh(): void {\n this.scheduleRebuild();\n }\n\n private applyAllStyles(): void {\n const runtime = MarqueeContent.runtimeStylesheetEntry;\n const base = MarqueeContent.stylesheetEntry;\n const overrides = MarqueeContent.styleOverridesEntry;\n const sheets: CSSStyleSheet[] = [];\n\n if (runtime.sheet) {\n sheets.push(runtime.sheet);\n }\n\n if (base.sheet) {\n sheets.push(base.sheet);\n }\n\n if (overrides.sheet) {\n sheets.push(overrides.sheet);\n }\n\n this.shadow.adoptedStyleSheets = sheets;\n }\n\n private teardown(): void {\n if (!this.mounted) {\n return;\n }\n\n this.mounted = false;\n\n this.stopAnimationLoop();\n this.stopCssAnimation();\n this.cancelScrollAnimation();\n this.cancelScheduledRebuild();\n this.updateScrollListener(false);\n\n this.resizeObserver?.disconnect();\n this.mutationObserver?.disconnect();\n this.intersectionObserver?.disconnect();\n\n this.removeReducedMotionWatcher();\n\n this.abortController?.abort();\n\n this.resizeObserver = null;\n this.mutationObserver = null;\n this.intersectionObserver = null;\n this.abortController = null;\n\n this.track.replaceChildren();\n this.removeAttribute('data-marquee-content-ready');\n this.removeAttribute('data-marquee-content-mode');\n this.removeAttribute('data-marquee-content-pause-on-hover');\n\n MARQUEE_CONTENT_CSS_PROPS.forEach((prop) => {\n this.style.removeProperty(prop);\n });\n\n this.distance = 0;\n this.scrollProgress = 0;\n this.currentTimeScale = 1;\n this.lastFrameTime = null;\n }\n\n private handleSlotChange = (): void => {\n this.watchSourceNodes();\n this.scheduleRebuild();\n };\n\n private handlePointerEnter = (): void => {\n this.isHovered = true;\n this.updateAnimationLoopState();\n };\n\n private handlePointerLeave = (): void => {\n this.isHovered = false;\n this.updateAnimationLoopState();\n };\n\n private handleFocusIn = (): void => {\n this.isFocused = true;\n this.updateAnimationLoopState();\n };\n\n private handleFocusOut = (): void => {\n this.isFocused = false;\n this.updateAnimationLoopState();\n };\n\n private handleIntersectionChange = (entries: IntersectionObserverEntry[]): void => {\n const entry = entries[0];\n\n if (!entry) {\n return;\n }\n\n this.isInViewport = entry.isIntersecting;\n this.updateAnimationLoopState();\n };\n\n private handleReducedMotionChange = (event: MediaQueryListEvent | MediaQueryList): void => {\n this.reducedMotion = event.matches;\n\n if (this.reducedMotion) {\n this.track.style.transform = 'none';\n } else if (this.options.mode === 'scroll') {\n this.track.style.transform = '';\n }\n\n this.updateAnimationLoopState();\n };\n\n private handleScroll = (): void => {\n if (this.options.mode !== 'scroll') {\n return;\n }\n\n const now = performance.now();\n const currentScrollY = this.getScrollY();\n\n const deltaY = currentScrollY - this.lastScrollY;\n const deltaTime = Math.max((now - this.lastScrollTime) / 1000, 0.016);\n\n this.lastScrollY = currentScrollY;\n this.lastScrollTime = now;\n\n if (Math.abs(deltaY) < 0.5) {\n return;\n }\n\n const velocity = deltaY / deltaTime;\n\n this.scrollDirectionFactor = velocity >= 0 ? 1 : -1;\n\n const extraSpeed = this.clamp(\n velocity / this.options.scrollVelocityFactor,\n -this.options.scrollMaxExtraSpeed,\n this.options.scrollMaxExtraSpeed,\n );\n\n if (Math.abs(extraSpeed) >= this.options.scrollMinExtraSpeed) {\n this.scrollBoostStartValue = extraSpeed;\n this.scrollBoostStartedAt = now;\n } else {\n this.scrollBoostStartValue = 0;\n }\n\n this.onScrollBoostChanged();\n };\n\n private onScrollBoostChanged(): void {\n if (!this.mounted || this.options.mode !== 'scroll' || this.reducedMotion) {\n return;\n }\n\n this.ensureScrollAnimation();\n\n if (!this.scrollAnimation || !this.canAnimate()) {\n return;\n }\n\n this.scrollAnimation.play();\n this.startAnimationLoop();\n }\n\n private updateScrollListener(\n shouldListen = this.mounted && this.options.mode === 'scroll',\n ): void {\n if (shouldListen === this.isListeningToScroll) {\n return;\n }\n\n if (shouldListen) {\n this.lastScrollY = this.getScrollY();\n this.lastScrollTime = performance.now();\n window.addEventListener('scroll', this.handleScroll, { passive: true });\n } else {\n window.removeEventListener('scroll', this.handleScroll);\n }\n\n this.isListeningToScroll = shouldListen;\n }\n\n private scheduleRebuild = (): void => {\n if (!this.mounted) {\n return;\n }\n\n this.cancelScheduledRebuild();\n\n this.rebuildFrameId = requestAnimationFrame(() => {\n this.rebuildFrameId = null;\n this.rebuild();\n });\n };\n\n private cancelScheduledRebuild(): void {\n if (this.rebuildFrameId === null) {\n return;\n }\n\n cancelAnimationFrame(this.rebuildFrameId);\n this.rebuildFrameId = null;\n }\n\n private rebuild(): void {\n if (!this.mounted) {\n return;\n }\n\n this.options = this.resolveOptions();\n this.updateScrollListener();\n this.removeAttribute('data-marquee-content-ready');\n this.setAttribute('data-marquee-content-mode', this.options.mode);\n\n if (this.options.pauseOnHover) {\n this.setAttribute('data-marquee-content-pause-on-hover', 'true');\n } else {\n this.removeAttribute('data-marquee-content-pause-on-hover');\n }\n\n const containerWidth = this.clientWidth;\n\n if (containerWidth <= 0) {\n this.distance = 0;\n this.track.replaceChildren();\n this.updateAnimationLoopState();\n return;\n }\n\n this.sourceNodes = this.getSourceNodes();\n\n if (this.sourceNodes.length === 0) {\n this.distance = 0;\n this.track.replaceChildren();\n this.updateAnimationLoopState();\n return;\n }\n\n const group = this.createGroup();\n const targetWidth = containerWidth * this.options.minGroupWidthRatio;\n\n this.track.replaceChildren(group);\n this.expandGroupToWidth(group, targetWidth);\n\n const clone = group.cloneNode(true) as HTMLElement;\n\n clone.setAttribute('aria-hidden', 'true');\n this.track.appendChild(clone);\n\n this.distance = group.scrollWidth;\n\n if (this.distance <= 0) {\n this.track.replaceChildren();\n this.updateAnimationLoopState();\n return;\n }\n\n const currentSpeed = this.getCurrentSpeed(containerWidth);\n const duration = this.distance / currentSpeed;\n\n this.style.setProperty('--marquee-content-distance', `${this.distance}px`);\n this.style.setProperty('--marquee-content-duration', `${duration}s`);\n\n if (this.reducedMotion) {\n this.track.style.transform = 'none';\n } else {\n this.track.style.transform = '';\n }\n\n this.setAttribute('data-marquee-content-ready', 'true');\n this.updateAnimationLoopState();\n }\n\n private createGroup(): HTMLElement {\n const group = document.createElement('div');\n\n group.className = 'marquee-content__group';\n group.setAttribute('part', 'group');\n\n this.appendSourceNodes(group);\n\n return group;\n }\n\n private expandGroupToWidth(group: HTMLElement, targetWidth: number): void {\n const sourceSetWidth = group.scrollWidth;\n\n if (sourceSetWidth <= 0) {\n return;\n }\n\n const repeatCount = Math.ceil(targetWidth / sourceSetWidth);\n\n for (let index = 1; index < repeatCount; index += 1) {\n this.appendSourceNodes(group);\n }\n }\n\n private appendSourceNodes(target: HTMLElement): void {\n const fragment = document.createDocumentFragment();\n\n this.sourceNodes.forEach((node) => {\n fragment.append(this.cloneSourceNode(node));\n });\n\n target.appendChild(fragment);\n }\n\n private cloneSourceNode(node: Node): Node {\n const clone = node.cloneNode(true);\n\n if (clone instanceof Element) {\n const currentPart = clone.getAttribute('part');\n\n clone.setAttribute('part', currentPart ? `${currentPart} item` : 'item');\n }\n\n return clone;\n }\n\n private getSourceNodes(): Node[] {\n return this.sourceSlot.assignedNodes({ flatten: true }).filter((node) => {\n if (node.nodeType === Node.TEXT_NODE) {\n return Boolean(node.textContent?.trim());\n }\n\n return node.nodeType === Node.ELEMENT_NODE;\n });\n }\n\n private watchSourceNodes(): void {\n this.mutationObserver?.disconnect();\n\n this.mutationObserver = new MutationObserver(this.scheduleRebuild);\n\n this.getSourceNodes().forEach((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n this.mutationObserver?.observe(node, {\n attributes: true,\n childList: true,\n characterData: true,\n subtree: true,\n });\n\n return;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n this.mutationObserver?.observe(node, {\n characterData: true,\n });\n }\n });\n }\n\n private setupReducedMotionWatcher(): void {\n if (!('matchMedia' in window)) {\n return;\n }\n\n this.reducedMotionMediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');\n\n this.reducedMotion = this.reducedMotionMediaQuery.matches;\n this.reducedMotionMediaQuery.addEventListener('change', this.handleReducedMotionChange, {\n signal: this.abortController?.signal,\n });\n }\n\n private removeReducedMotionWatcher(): void {\n if (!this.reducedMotionMediaQuery) {\n return;\n }\n\n this.reducedMotionMediaQuery.removeEventListener('change', this.handleReducedMotionChange);\n\n this.reducedMotionMediaQuery = null;\n }\n\n private updateAnimationLoopState(): void {\n if (!this.mounted || this.distance <= 0 || this.reducedMotion) {\n this.stopAnimationLoop();\n this.stopCssAnimation();\n this.cancelScrollAnimation();\n\n if (this.reducedMotion) {\n this.track.style.transform = 'none';\n }\n\n return;\n }\n\n if (this.options.mode === 'scroll') {\n this.stopCssAnimation();\n this.track.style.transform = '';\n this.ensureScrollAnimation();\n\n if (!this.scrollAnimation || !this.canAnimate()) {\n this.scrollAnimation?.pause();\n this.stopAnimationLoop();\n return;\n }\n\n this.scrollAnimation.play();\n this.updateScrollPlaybackRate(performance.now(), true);\n this.startAnimationLoop();\n\n return;\n }\n\n this.stopAnimationLoop();\n this.cancelScrollAnimation();\n this.startCssAnimation();\n this.track.style.animationPlayState = this.canAnimate() ? 'running' : 'paused';\n }\n\n private canAnimate(): boolean {\n if (this.options.pauseOnHover && this.isHovered) {\n return false;\n }\n\n if (this.isFocused) {\n return false;\n }\n\n if (this.options.pauseWhenOutOfView && !this.isInViewport) {\n return false;\n }\n\n return true;\n }\n\n private startAnimationLoop(): void {\n if (this.animationFrameId !== null) {\n return;\n }\n\n this.lastFrameTime = performance.now();\n this.animationFrameId = requestAnimationFrame(this.tick);\n }\n\n private stopAnimationLoop(): void {\n if (this.animationFrameId === null) {\n this.lastFrameTime = null;\n return;\n }\n\n cancelAnimationFrame(this.animationFrameId);\n this.animationFrameId = null;\n this.lastFrameTime = null;\n }\n\n private startCssAnimation(): void {\n const animationDirection = this.options.direction === 'ltr' ? 'reverse' : 'normal';\n\n this.track.style.transform = '';\n\n if (this.track.style.animationName !== 'marquee-content-auto') {\n this.track.style.animationName = 'marquee-content-auto';\n this.track.style.animationDuration = 'var(--marquee-content-duration)';\n this.track.style.animationTimingFunction = 'linear';\n this.track.style.animationIterationCount = 'infinite';\n }\n\n if (this.track.style.animationDirection !== animationDirection) {\n this.track.style.animationDirection = animationDirection;\n }\n }\n\n private stopCssAnimation(): void {\n this.track.style.animationName = '';\n this.track.style.animationDuration = '';\n this.track.style.animationTimingFunction = '';\n this.track.style.animationIterationCount = '';\n this.track.style.animationDirection = '';\n this.track.style.animationPlayState = '';\n }\n\n private tick = (now: number): void => {\n this.animationFrameId = null;\n\n if (\n !this.mounted ||\n this.options.mode !== 'scroll' ||\n this.distance <= 0 ||\n this.reducedMotion ||\n !this.canAnimate() ||\n !this.scrollAnimation\n ) {\n return;\n }\n\n const settled = this.updateScrollPlaybackRate(now, false);\n\n if (!settled) {\n this.animationFrameId = requestAnimationFrame(this.tick);\n }\n };\n\n private ensureScrollAnimation(): void {\n if (this.distance <= 0) {\n this.cancelScrollAnimation();\n return;\n }\n\n const currentSpeed = this.getCurrentSpeed(this.clientWidth);\n const durationMs = currentSpeed > 0 ? (this.distance / currentSpeed) * 1000 : 0;\n\n if (durationMs <= 0) {\n this.cancelScrollAnimation();\n return;\n }\n\n if (\n this.scrollAnimation &&\n this.scrollAnimationDistance === this.distance &&\n this.scrollAnimationDuration === durationMs\n ) {\n return;\n }\n\n const progress = this.getScrollAnimationProgress();\n const hadAnimation = this.scrollAnimation !== null;\n\n if (this.scrollAnimation) {\n this.scrollAnimation.cancel();\n this.scrollAnimation = null;\n }\n\n if (!hadAnimation) {\n this.currentTimeScale = this.getDirectionFactor() * this.scrollDirectionFactor;\n }\n\n const animation = this.track.animate(\n [\n { transform: 'translate3d(0px, 0, 0)' },\n { transform: `translate3d(${-this.distance}px, 0, 0)` },\n ],\n {\n duration: durationMs,\n iterations: Number.POSITIVE_INFINITY,\n easing: 'linear',\n },\n );\n\n animation.currentTime = durationMs * (SCROLL_ANIMATION_SEED_ITERATIONS + progress);\n animation.playbackRate = this.currentTimeScale;\n\n this.scrollAnimation = animation;\n this.scrollAnimationDuration = durationMs;\n this.scrollAnimationDistance = this.distance;\n this.scrollProgress = progress;\n }\n\n private cancelScrollAnimation(): void {\n if (!this.scrollAnimation) {\n return;\n }\n\n this.scrollProgress = this.getScrollAnimationProgress();\n this.scrollAnimation.cancel();\n this.scrollAnimation = null;\n this.scrollAnimationDuration = 0;\n this.scrollAnimationDistance = 0;\n }\n\n private getScrollAnimationProgress(): number {\n const animation = this.scrollAnimation;\n\n if (!animation || this.scrollAnimationDuration <= 0) {\n return this.scrollProgress;\n }\n\n const currentTime = animation.currentTime;\n\n if (typeof currentTime !== 'number') {\n return this.scrollProgress;\n }\n\n const fraction = (currentTime / this.scrollAnimationDuration) % 1;\n\n return fraction < 0 ? fraction + 1 : fraction;\n }\n\n private updateScrollPlaybackRate(now: number, immediate: boolean): boolean {\n if (!this.scrollAnimation) {\n return true;\n }\n\n const target = this.getCurrentTimeScale(now);\n\n if (immediate) {\n this.currentTimeScale = target;\n this.lastFrameTime = now;\n } else {\n const previousTime = this.lastFrameTime ?? now;\n const deltaTime = Math.min((now - previousTime) / 1000, 0.064);\n\n this.lastFrameTime = now;\n\n const smoothingFactor = 1 - Math.exp(-deltaTime / SCROLL_TIME_SCALE_SMOOTHING_SECONDS);\n\n this.currentTimeScale += (target - this.currentTimeScale) * smoothingFactor;\n }\n\n const settled =\n this.scrollBoostStartValue === 0 && Math.abs(target - this.currentTimeScale) < 0.001;\n\n if (settled) {\n this.currentTimeScale = target;\n }\n\n if (this.scrollAnimation.playbackRate !== this.currentTimeScale) {\n this.scrollAnimation.playbackRate = this.currentTimeScale;\n }\n\n return settled;\n }\n\n private getCurrentTimeScale(now: number): number {\n const directionFactor = this.getDirectionFactor();\n\n if (this.options.mode !== 'scroll') {\n return directionFactor;\n }\n\n const boost = this.getScrollBoost(now);\n const scrollTimeScale = this.scrollDirectionFactor + boost;\n\n return this.clamp(\n directionFactor * scrollTimeScale,\n -1 - this.options.scrollMaxExtraSpeed,\n 1 + this.options.scrollMaxExtraSpeed,\n );\n }\n\n private getDirectionFactor(): 1 | -1 {\n return this.options.direction === 'ltr' ? -1 : 1;\n }\n\n private getScrollBoost(now: number): number {\n if (this.scrollBoostStartValue === 0) {\n return 0;\n }\n\n const duration = this.options.scrollInertiaDuration;\n\n if (duration <= 0) {\n this.scrollBoostStartValue = 0;\n return 0;\n }\n\n const progress = this.clamp((now - this.scrollBoostStartedAt) / duration, 0, 1);\n\n if (progress >= 1) {\n this.scrollBoostStartValue = 0;\n return 0;\n }\n\n const easedProgress = this.easeOutCubic(progress);\n\n return this.scrollBoostStartValue * (1 - easedProgress);\n }\n\n private getCurrentSpeed(containerWidth: number): number {\n if (!this.options.responsiveSpeed) {\n return this.options.speed;\n }\n\n const factor = this.clamp(\n containerWidth / this.options.referenceWidth,\n this.options.minSpeedFactor,\n this.options.maxSpeedFactor,\n );\n\n return this.options.speed * factor;\n }\n\n private resolveOptions(): MarqueeContentResolvedOptions {\n return {\n ...DEFAULT_OPTIONS,\n speed: this.num('speed', DEFAULT_OPTIONS.speed, 10, 500),\n mode: this.parseMode(this.getAttribute('mode'), DEFAULT_OPTIONS.mode),\n direction: this.parseDirection(this.getAttribute('direction'), DEFAULT_OPTIONS.direction),\n pauseOnHover: this.parseBoolean(\n this.getAttribute('pause-on-hover'),\n DEFAULT_OPTIONS.pauseOnHover,\n ),\n };\n }\n\n private num(attributeName: string, fallback: number, min: number, max: number): number {\n return this.clamp(this.parseNumber(this.getAttribute(attributeName), fallback), min, max);\n }\n\n private parseNumber(value: string | null, fallback: number): number {\n if (value === null || value.trim() === '') {\n return fallback;\n }\n\n const parsed = Number(value);\n\n return Number.isFinite(parsed) ? parsed : fallback;\n }\n\n private parseBoolean(value: string | null, fallback: boolean): boolean {\n if (value === null) {\n return fallback;\n }\n\n const normalizedValue = value.trim().toLowerCase();\n\n if (normalizedValue === '') {\n return true;\n }\n\n if (['true', '1', 'yes', 'on'].includes(normalizedValue)) {\n return true;\n }\n\n if (['false', '0', 'no', 'off'].includes(normalizedValue)) {\n return false;\n }\n\n return fallback;\n }\n\n private parseMode(value: string | null, fallback: MarqueeContentMode): MarqueeContentMode {\n if (value === 'auto' || value === 'scroll') {\n return value;\n }\n\n return fallback;\n }\n\n private parseDirection(\n value: string | null,\n fallback: MarqueeContentDirection,\n ): MarqueeContentDirection {\n if (value === 'rtl' || value === 'ltr') {\n return value;\n }\n\n return fallback;\n }\n\n private setNullableAttribute(\n name: string,\n value: string | number | boolean | null | undefined,\n ): void {\n if (value === null || value === undefined) {\n this.removeAttribute(name);\n return;\n }\n\n this.setAttribute(name, String(value));\n }\n\n private getScrollY(): number {\n return window.scrollY || window.pageYOffset || 0;\n }\n\n private clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n }\n\n private easeOutCubic(value: number): number {\n return 1 - (1 - value) ** 3;\n }\n\n private rebuildAfterFontsReady(): void {\n const fonts = (\n document as Document & {\n fonts?: { ready: Promise<unknown> };\n }\n ).fonts;\n\n if (!fonts?.ready) {\n return;\n }\n\n void fonts.ready.then(this.scheduleRebuild).catch(() => undefined);\n }\n}\n\nexport function defineMarqueeContent(\n tagName = MARQUEE_CONTENT_TAG,\n options: DefineMarqueeContentOptions = {},\n): void {\n if (typeof window === 'undefined' || !window.customElements) {\n return;\n }\n\n MarqueeContent.configureStyles(options);\n\n if (!window.customElements.get(tagName)) {\n window.customElements.define(tagName, MarqueeContent);\n }\n}\n\nexport function initMarqueeContents(options: InitMarqueeContentsOptions = {}): void {\n const { tagName = MARQUEE_CONTENT_TAG, ...styleOptions } = options;\n\n defineMarqueeContent(tagName, styleOptions);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'marquee-content': MarqueeContent;\n }\n}\n","export type {\n DefineMarqueeContentOptions,\n InitMarqueeContentsOptions,\n MarqueeContentDirection,\n MarqueeContentMode,\n MarqueeContentOptions,\n} from './marquee-content';\nexport {\n defineMarqueeContent,\n initMarqueeContents,\n MARQUEE_CONTENT_TAG,\n MarqueeContent,\n} from './marquee-content';\nexport type {\n MarqueeContentStyleEntry,\n MarqueeContentStyleInput,\n} from './styles';\nexport {\n createConstructableStyleSheet,\n cssStyleSheetToText,\n marqueeContentCssText,\n normalizeStyleInput,\n} from './styles';\n\nimport { defineMarqueeContent } from './marquee-content';\n\ndefineMarqueeContent();\n"],"mappings":";;;;;;;AAUA,MAAa,wBAAwBA;AAErC,SAAgB,8BAA8B,SAAuC;CACnF,IACE,OAAO,kBAAkB,eACzB,OAAO,cAAc,UAAU,gBAAgB,YAE/C,OAAO;CAGT,IAAI;EACF,MAAM,QAAQ,IAAI,cAAc;EAChC,MAAM,YAAY,OAAO;EACzB,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,oBAAoB,OAA8B;CAChE,IAAI;EACF,OAAO,MAAM,KAAK,MAAM,QAAQ,CAAC,CAC9B,KAAK,SAAS,KAAK,OAAO,CAAC,CAC3B,KAAK,IAAI;CACd,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,oBAAoB,OAA2D;CAC7F,IAAI,CAAC,OACH,OAAO;EACL,OAAO;EACP,SAAS;CACX;CAGF,IAAI,OAAO,UAAU,UACnB,OAAO;EACL,OAAO,8BAA8B,KAAK;EAC1C,SAAS;CACX;CAGF,OAAO;EACL,OAAO;EACP,SAAS,oBAAoB,KAAK;CACpC;AACF;;;;ACXA,MAAa,sBAAsB;AAEnC,MAAM,kBAAiD;CACrD,OAAO;CACP,MAAM;CACN,WAAW;CACX,oBAAoB;CAEpB,iBAAiB;CACjB,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CAEhB,cAAc;CACd,oBAAoB;CACpB,4BAA4B;CAE5B,sBAAsB;CACtB,qBAAqB;CACrB,qBAAqB;CACrB,uBAAuB;AACzB;AAEA,MAAM,sBAAsB;CAAC;CAAS;CAAQ;CAAa;AAAgB;AAE3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ACN,MACA,OACM;EACN,IAAI,UAAU,QAAQ,UAAU,QAAW;GACzC,KAAK,gBAAgB,IAAI;GACzB;EACF;EAEA,KAAK,aAAa,MAAM,OAAO,KAAK,CAAC;CACvC;CAEA,AAAQ,aAAqB;EAC3B,OAAO,OAAO,WAAW,OAAO,eAAe;CACjD;CAEA,AAAQ,MAAM,OAAe,KAAa,KAAqB;EAC7D,OAAO,KAAK,IAAI,KAAK,IAAI,OAAO,GAAG,GAAG,GAAG;CAC3C;CAEA,AAAQ,aAAa,OAAuB;EAC1C,OAAO,KAAK,IAAI,UAAU;CAC5B;CAEA,AAAQ,yBAA+B;EACrC,MAAM,QACJ,SAGA;EAEF,IAAI,CAAC,OAAO,OACV;EAGF,AAAK,MAAM,MAAM,KAAK,KAAK,eAAe,CAAC,CAAC,YAAY,MAAS;CACnE;AACF;AAEA,SAAgB,qBACd,UAAU,qBACV,UAAuC,CAAC,GAClC;CACN,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,gBAC3C;CAGF,eAAe,gBAAgB,OAAO;CAEtC,IAAI,CAAC,OAAO,eAAe,IAAI,OAAO,GACpC,OAAO,eAAe,OAAO,SAAS,cAAc;AAExD;AAEA,SAAgB,oBAAoB,UAAsC,CAAC,GAAS;CAClF,MAAM,EAAE,UAAU,qBAAqB,GAAG,iBAAiB;CAE3D,qBAAqB,SAAS,YAAY;AAC5C;;;;AC5mCA,qBAAqB"}
|
package/dist/index.d.cts
CHANGED
|
@@ -55,7 +55,10 @@ declare class MarqueeContent extends HTMLElement {
|
|
|
55
55
|
private reducedMotion;
|
|
56
56
|
private isListeningToScroll;
|
|
57
57
|
private distance;
|
|
58
|
-
private
|
|
58
|
+
private scrollAnimation;
|
|
59
|
+
private scrollAnimationDuration;
|
|
60
|
+
private scrollAnimationDistance;
|
|
61
|
+
private scrollProgress;
|
|
59
62
|
private scrollDirectionFactor;
|
|
60
63
|
private currentTimeScale;
|
|
61
64
|
private scrollBoostStartValue;
|
|
@@ -86,6 +89,7 @@ declare class MarqueeContent extends HTMLElement {
|
|
|
86
89
|
private handleIntersectionChange;
|
|
87
90
|
private handleReducedMotionChange;
|
|
88
91
|
private handleScroll;
|
|
92
|
+
private onScrollBoostChanged;
|
|
89
93
|
private updateScrollListener;
|
|
90
94
|
private scheduleRebuild;
|
|
91
95
|
private cancelScheduledRebuild;
|
|
@@ -105,12 +109,13 @@ declare class MarqueeContent extends HTMLElement {
|
|
|
105
109
|
private startCssAnimation;
|
|
106
110
|
private stopCssAnimation;
|
|
107
111
|
private tick;
|
|
108
|
-
private
|
|
112
|
+
private ensureScrollAnimation;
|
|
113
|
+
private cancelScrollAnimation;
|
|
114
|
+
private getScrollAnimationProgress;
|
|
115
|
+
private updateScrollPlaybackRate;
|
|
109
116
|
private getCurrentTimeScale;
|
|
110
117
|
private getDirectionFactor;
|
|
111
118
|
private getScrollBoost;
|
|
112
|
-
private applyTransform;
|
|
113
|
-
private normalizeOffset;
|
|
114
119
|
private getCurrentSpeed;
|
|
115
120
|
private resolveOptions;
|
|
116
121
|
private num;
|
package/dist/index.d.ts
CHANGED
|
@@ -55,7 +55,10 @@ declare class MarqueeContent extends HTMLElement {
|
|
|
55
55
|
private reducedMotion;
|
|
56
56
|
private isListeningToScroll;
|
|
57
57
|
private distance;
|
|
58
|
-
private
|
|
58
|
+
private scrollAnimation;
|
|
59
|
+
private scrollAnimationDuration;
|
|
60
|
+
private scrollAnimationDistance;
|
|
61
|
+
private scrollProgress;
|
|
59
62
|
private scrollDirectionFactor;
|
|
60
63
|
private currentTimeScale;
|
|
61
64
|
private scrollBoostStartValue;
|
|
@@ -86,6 +89,7 @@ declare class MarqueeContent extends HTMLElement {
|
|
|
86
89
|
private handleIntersectionChange;
|
|
87
90
|
private handleReducedMotionChange;
|
|
88
91
|
private handleScroll;
|
|
92
|
+
private onScrollBoostChanged;
|
|
89
93
|
private updateScrollListener;
|
|
90
94
|
private scheduleRebuild;
|
|
91
95
|
private cancelScheduledRebuild;
|
|
@@ -105,12 +109,13 @@ declare class MarqueeContent extends HTMLElement {
|
|
|
105
109
|
private startCssAnimation;
|
|
106
110
|
private stopCssAnimation;
|
|
107
111
|
private tick;
|
|
108
|
-
private
|
|
112
|
+
private ensureScrollAnimation;
|
|
113
|
+
private cancelScrollAnimation;
|
|
114
|
+
private getScrollAnimationProgress;
|
|
115
|
+
private updateScrollPlaybackRate;
|
|
109
116
|
private getCurrentTimeScale;
|
|
110
117
|
private getDirectionFactor;
|
|
111
118
|
private getScrollBoost;
|
|
112
|
-
private applyTransform;
|
|
113
|
-
private normalizeOffset;
|
|
114
119
|
private getCurrentSpeed;
|
|
115
120
|
private resolveOptions;
|
|
116
121
|
private num;
|
package/dist/index.js
CHANGED
|
@@ -70,6 +70,7 @@ const OPTION_ATTRIBUTE_MAP = {
|
|
|
70
70
|
};
|
|
71
71
|
const MARQUEE_CONTENT_CSS_PROPS = ["--marquee-content-distance", "--marquee-content-duration"];
|
|
72
72
|
const SCROLL_TIME_SCALE_SMOOTHING_SECONDS = .12;
|
|
73
|
+
const SCROLL_ANIMATION_SEED_ITERATIONS = 500;
|
|
73
74
|
const MARQUEE_CONTENT_RUNTIME_CSS = `
|
|
74
75
|
@keyframes marquee-content-auto {
|
|
75
76
|
to {
|
|
@@ -144,7 +145,10 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
144
145
|
reducedMotion = false;
|
|
145
146
|
isListeningToScroll = false;
|
|
146
147
|
distance = 0;
|
|
147
|
-
|
|
148
|
+
scrollAnimation = null;
|
|
149
|
+
scrollAnimationDuration = 0;
|
|
150
|
+
scrollAnimationDistance = 0;
|
|
151
|
+
scrollProgress = 0;
|
|
148
152
|
scrollDirectionFactor = 1;
|
|
149
153
|
currentTimeScale = 1;
|
|
150
154
|
scrollBoostStartValue = 0;
|
|
@@ -255,6 +259,7 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
255
259
|
this.mounted = false;
|
|
256
260
|
this.stopAnimationLoop();
|
|
257
261
|
this.stopCssAnimation();
|
|
262
|
+
this.cancelScrollAnimation();
|
|
258
263
|
this.cancelScheduledRebuild();
|
|
259
264
|
this.updateScrollListener(false);
|
|
260
265
|
this.resizeObserver?.disconnect();
|
|
@@ -274,7 +279,7 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
274
279
|
this.style.removeProperty(prop);
|
|
275
280
|
});
|
|
276
281
|
this.distance = 0;
|
|
277
|
-
this.
|
|
282
|
+
this.scrollProgress = 0;
|
|
278
283
|
this.currentTimeScale = 1;
|
|
279
284
|
this.lastFrameTime = null;
|
|
280
285
|
}
|
|
@@ -307,7 +312,7 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
307
312
|
handleReducedMotionChange = (event) => {
|
|
308
313
|
this.reducedMotion = event.matches;
|
|
309
314
|
if (this.reducedMotion) this.track.style.transform = "none";
|
|
310
|
-
else if (this.options.mode === "scroll") this.
|
|
315
|
+
else if (this.options.mode === "scroll") this.track.style.transform = "";
|
|
311
316
|
this.updateAnimationLoopState();
|
|
312
317
|
};
|
|
313
318
|
handleScroll = () => {
|
|
@@ -326,8 +331,15 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
326
331
|
this.scrollBoostStartValue = extraSpeed;
|
|
327
332
|
this.scrollBoostStartedAt = now;
|
|
328
333
|
} else this.scrollBoostStartValue = 0;
|
|
329
|
-
this.
|
|
334
|
+
this.onScrollBoostChanged();
|
|
330
335
|
};
|
|
336
|
+
onScrollBoostChanged() {
|
|
337
|
+
if (!this.mounted || this.options.mode !== "scroll" || this.reducedMotion) return;
|
|
338
|
+
this.ensureScrollAnimation();
|
|
339
|
+
if (!this.scrollAnimation || !this.canAnimate()) return;
|
|
340
|
+
this.scrollAnimation.play();
|
|
341
|
+
this.startAnimationLoop();
|
|
342
|
+
}
|
|
331
343
|
updateScrollListener(shouldListen = this.mounted && this.options.mode === "scroll") {
|
|
332
344
|
if (shouldListen === this.isListeningToScroll) return;
|
|
333
345
|
if (shouldListen) {
|
|
@@ -380,7 +392,6 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
380
392
|
clone.setAttribute("aria-hidden", "true");
|
|
381
393
|
this.track.appendChild(clone);
|
|
382
394
|
this.distance = group.scrollWidth;
|
|
383
|
-
this.offset = this.normalizeOffset(this.offset);
|
|
384
395
|
if (this.distance <= 0) {
|
|
385
396
|
this.track.replaceChildren();
|
|
386
397
|
this.updateAnimationLoopState();
|
|
@@ -391,7 +402,6 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
391
402
|
this.style.setProperty("--marquee-content-distance", `${this.distance}px`);
|
|
392
403
|
this.style.setProperty("--marquee-content-duration", `${duration}s`);
|
|
393
404
|
if (this.reducedMotion) this.track.style.transform = "none";
|
|
394
|
-
else if (this.options.mode === "scroll") this.applyTransform();
|
|
395
405
|
else this.track.style.transform = "";
|
|
396
406
|
this.setAttribute("data-marquee-content-ready", "true");
|
|
397
407
|
this.updateAnimationLoopState();
|
|
@@ -461,16 +471,26 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
461
471
|
if (!this.mounted || this.distance <= 0 || this.reducedMotion) {
|
|
462
472
|
this.stopAnimationLoop();
|
|
463
473
|
this.stopCssAnimation();
|
|
474
|
+
this.cancelScrollAnimation();
|
|
464
475
|
if (this.reducedMotion) this.track.style.transform = "none";
|
|
465
476
|
return;
|
|
466
477
|
}
|
|
467
478
|
if (this.options.mode === "scroll") {
|
|
468
479
|
this.stopCssAnimation();
|
|
469
|
-
|
|
470
|
-
|
|
480
|
+
this.track.style.transform = "";
|
|
481
|
+
this.ensureScrollAnimation();
|
|
482
|
+
if (!this.scrollAnimation || !this.canAnimate()) {
|
|
483
|
+
this.scrollAnimation?.pause();
|
|
484
|
+
this.stopAnimationLoop();
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
this.scrollAnimation.play();
|
|
488
|
+
this.updateScrollPlaybackRate(performance.now(), true);
|
|
489
|
+
this.startAnimationLoop();
|
|
471
490
|
return;
|
|
472
491
|
}
|
|
473
492
|
this.stopAnimationLoop();
|
|
493
|
+
this.cancelScrollAnimation();
|
|
474
494
|
this.startCssAnimation();
|
|
475
495
|
this.track.style.animationPlayState = this.canAnimate() ? "running" : "paused";
|
|
476
496
|
}
|
|
@@ -483,7 +503,6 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
483
503
|
startAnimationLoop() {
|
|
484
504
|
if (this.animationFrameId !== null) return;
|
|
485
505
|
this.lastFrameTime = performance.now();
|
|
486
|
-
this.currentTimeScale = this.getCurrentTimeScale(this.lastFrameTime);
|
|
487
506
|
this.animationFrameId = requestAnimationFrame(this.tick);
|
|
488
507
|
}
|
|
489
508
|
stopAnimationLoop() {
|
|
@@ -516,25 +535,73 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
516
535
|
}
|
|
517
536
|
tick = (now) => {
|
|
518
537
|
this.animationFrameId = null;
|
|
519
|
-
if (!this.mounted || this.options.mode !== "scroll" || this.distance <= 0 || this.reducedMotion || !this.canAnimate())
|
|
520
|
-
|
|
538
|
+
if (!this.mounted || this.options.mode !== "scroll" || this.distance <= 0 || this.reducedMotion || !this.canAnimate() || !this.scrollAnimation) return;
|
|
539
|
+
if (!this.updateScrollPlaybackRate(now, false)) this.animationFrameId = requestAnimationFrame(this.tick);
|
|
540
|
+
};
|
|
541
|
+
ensureScrollAnimation() {
|
|
542
|
+
if (this.distance <= 0) {
|
|
543
|
+
this.cancelScrollAnimation();
|
|
521
544
|
return;
|
|
522
545
|
}
|
|
523
|
-
const previousTime = this.lastFrameTime ?? now;
|
|
524
|
-
const deltaTime = Math.min((now - previousTime) / 1e3, .064);
|
|
525
|
-
this.lastFrameTime = now;
|
|
526
546
|
const currentSpeed = this.getCurrentSpeed(this.clientWidth);
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
this.
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
547
|
+
const durationMs = currentSpeed > 0 ? this.distance / currentSpeed * 1e3 : 0;
|
|
548
|
+
if (durationMs <= 0) {
|
|
549
|
+
this.cancelScrollAnimation();
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
if (this.scrollAnimation && this.scrollAnimationDistance === this.distance && this.scrollAnimationDuration === durationMs) return;
|
|
553
|
+
const progress = this.getScrollAnimationProgress();
|
|
554
|
+
const hadAnimation = this.scrollAnimation !== null;
|
|
555
|
+
if (this.scrollAnimation) {
|
|
556
|
+
this.scrollAnimation.cancel();
|
|
557
|
+
this.scrollAnimation = null;
|
|
558
|
+
}
|
|
559
|
+
if (!hadAnimation) this.currentTimeScale = this.getDirectionFactor() * this.scrollDirectionFactor;
|
|
560
|
+
const animation = this.track.animate([{ transform: "translate3d(0px, 0, 0)" }, { transform: `translate3d(${-this.distance}px, 0, 0)` }], {
|
|
561
|
+
duration: durationMs,
|
|
562
|
+
iterations: Number.POSITIVE_INFINITY,
|
|
563
|
+
easing: "linear"
|
|
564
|
+
});
|
|
565
|
+
animation.currentTime = durationMs * (SCROLL_ANIMATION_SEED_ITERATIONS + progress);
|
|
566
|
+
animation.playbackRate = this.currentTimeScale;
|
|
567
|
+
this.scrollAnimation = animation;
|
|
568
|
+
this.scrollAnimationDuration = durationMs;
|
|
569
|
+
this.scrollAnimationDistance = this.distance;
|
|
570
|
+
this.scrollProgress = progress;
|
|
571
|
+
}
|
|
572
|
+
cancelScrollAnimation() {
|
|
573
|
+
if (!this.scrollAnimation) return;
|
|
574
|
+
this.scrollProgress = this.getScrollAnimationProgress();
|
|
575
|
+
this.scrollAnimation.cancel();
|
|
576
|
+
this.scrollAnimation = null;
|
|
577
|
+
this.scrollAnimationDuration = 0;
|
|
578
|
+
this.scrollAnimationDistance = 0;
|
|
579
|
+
}
|
|
580
|
+
getScrollAnimationProgress() {
|
|
581
|
+
const animation = this.scrollAnimation;
|
|
582
|
+
if (!animation || this.scrollAnimationDuration <= 0) return this.scrollProgress;
|
|
583
|
+
const currentTime = animation.currentTime;
|
|
584
|
+
if (typeof currentTime !== "number") return this.scrollProgress;
|
|
585
|
+
const fraction = currentTime / this.scrollAnimationDuration % 1;
|
|
586
|
+
return fraction < 0 ? fraction + 1 : fraction;
|
|
587
|
+
}
|
|
588
|
+
updateScrollPlaybackRate(now, immediate) {
|
|
589
|
+
if (!this.scrollAnimation) return true;
|
|
590
|
+
const target = this.getCurrentTimeScale(now);
|
|
591
|
+
if (immediate) {
|
|
592
|
+
this.currentTimeScale = target;
|
|
593
|
+
this.lastFrameTime = now;
|
|
594
|
+
} else {
|
|
595
|
+
const previousTime = this.lastFrameTime ?? now;
|
|
596
|
+
const deltaTime = Math.min((now - previousTime) / 1e3, .064);
|
|
597
|
+
this.lastFrameTime = now;
|
|
598
|
+
const smoothingFactor = 1 - Math.exp(-deltaTime / SCROLL_TIME_SCALE_SMOOTHING_SECONDS);
|
|
599
|
+
this.currentTimeScale += (target - this.currentTimeScale) * smoothingFactor;
|
|
600
|
+
}
|
|
601
|
+
const settled = this.scrollBoostStartValue === 0 && Math.abs(target - this.currentTimeScale) < .001;
|
|
602
|
+
if (settled) this.currentTimeScale = target;
|
|
603
|
+
if (this.scrollAnimation.playbackRate !== this.currentTimeScale) this.scrollAnimation.playbackRate = this.currentTimeScale;
|
|
604
|
+
return settled;
|
|
538
605
|
}
|
|
539
606
|
getCurrentTimeScale(now) {
|
|
540
607
|
const directionFactor = this.getDirectionFactor();
|
|
@@ -561,14 +628,6 @@ var MarqueeContent = class MarqueeContent extends HTMLElement {
|
|
|
561
628
|
const easedProgress = this.easeOutCubic(progress);
|
|
562
629
|
return this.scrollBoostStartValue * (1 - easedProgress);
|
|
563
630
|
}
|
|
564
|
-
applyTransform() {
|
|
565
|
-
this.track.style.transform = `translate3d(${-this.offset}px, 0, 0)`;
|
|
566
|
-
}
|
|
567
|
-
normalizeOffset(value) {
|
|
568
|
-
if (this.distance <= 0) return 0;
|
|
569
|
-
const normalized = value % this.distance;
|
|
570
|
-
return normalized < 0 ? normalized + this.distance : normalized;
|
|
571
|
-
}
|
|
572
631
|
getCurrentSpeed(containerWidth) {
|
|
573
632
|
if (!this.options.responsiveSpeed) return this.options.speed;
|
|
574
633
|
const factor = this.clamp(containerWidth / this.options.referenceWidth, this.options.minSpeedFactor, this.options.maxSpeedFactor);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DEFAULT_CSS_TEXT"],"sources":["../src/styles.ts","../src/marquee-content.ts","../src/index.ts"],"sourcesContent":["import './marquee-content.css';\nimport DEFAULT_CSS_TEXT from './marquee-content.css?inline';\n\nexport type MarqueeContentStyleInput = CSSStyleSheet | string | null | undefined;\n\nexport interface MarqueeContentStyleEntry {\n sheet: CSSStyleSheet | null;\n cssText: string;\n}\n\nexport const marqueeContentCssText = DEFAULT_CSS_TEXT;\n\nexport function createConstructableStyleSheet(cssText: string): CSSStyleSheet | null {\n if (\n typeof CSSStyleSheet === 'undefined' ||\n typeof CSSStyleSheet.prototype.replaceSync !== 'function'\n ) {\n return null;\n }\n\n try {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(cssText);\n return sheet;\n } catch {\n return null;\n }\n}\n\nexport function cssStyleSheetToText(sheet: CSSStyleSheet): string {\n try {\n return Array.from(sheet.cssRules)\n .map((rule) => rule.cssText)\n .join('\\n');\n } catch {\n return '';\n }\n}\n\nexport function normalizeStyleInput(input: MarqueeContentStyleInput): MarqueeContentStyleEntry {\n if (!input) {\n return {\n sheet: null,\n cssText: '',\n };\n }\n\n if (typeof input === 'string') {\n return {\n sheet: createConstructableStyleSheet(input),\n cssText: input,\n };\n }\n\n return {\n sheet: input,\n cssText: cssStyleSheetToText(input),\n };\n}\n\nexport function canUseAdoptedStyleSheets(root: ShadowRoot): boolean {\n return (\n typeof CSSStyleSheet !== 'undefined' &&\n 'adoptedStyleSheets' in root &&\n typeof CSSStyleSheet.prototype.replaceSync === 'function'\n );\n}\n","import {\n type MarqueeContentStyleEntry,\n type MarqueeContentStyleInput,\n marqueeContentCssText,\n normalizeStyleInput,\n} from './styles';\n\nexport type MarqueeContentDirection = 'rtl' | 'ltr';\nexport type MarqueeContentMode = 'auto' | 'scroll';\n\nexport interface MarqueeContentOptions {\n speed?: number | string | null;\n mode?: MarqueeContentMode | null;\n direction?: MarqueeContentDirection | null;\n pauseOnHover?: boolean | string | null;\n}\n\ninterface MarqueeContentResolvedOptions {\n speed: number;\n mode: MarqueeContentMode;\n direction: MarqueeContentDirection;\n minGroupWidthRatio: number;\n\n responsiveSpeed: boolean;\n referenceWidth: number;\n minSpeedFactor: number;\n maxSpeedFactor: number;\n\n pauseOnHover: boolean;\n pauseWhenOutOfView: boolean;\n recalculateAfterFontsReady: boolean;\n\n scrollVelocityFactor: number;\n scrollMinExtraSpeed: number;\n scrollMaxExtraSpeed: number;\n scrollInertiaDuration: number;\n}\n\nexport interface DefineMarqueeContentOptions {\n stylesheet?: MarqueeContentStyleInput;\n styleOverrides?: MarqueeContentStyleInput;\n}\n\nexport interface InitMarqueeContentsOptions extends DefineMarqueeContentOptions {\n tagName?: string;\n}\n\nexport const MARQUEE_CONTENT_TAG = 'marquee-content';\n\nconst DEFAULT_OPTIONS: MarqueeContentResolvedOptions = {\n speed: 90,\n mode: 'auto',\n direction: 'rtl',\n minGroupWidthRatio: 1.05,\n\n responsiveSpeed: true,\n referenceWidth: 1280,\n minSpeedFactor: 0.55,\n maxSpeedFactor: 1,\n\n pauseOnHover: false,\n pauseWhenOutOfView: true,\n recalculateAfterFontsReady: true,\n\n scrollVelocityFactor: 150,\n scrollMinExtraSpeed: 0.05,\n scrollMaxExtraSpeed: 5,\n scrollInertiaDuration: 2500,\n};\n\nconst OBSERVED_ATTRIBUTES = ['speed', 'mode', 'direction', 'pause-on-hover'] as const;\n\nconst OPTION_ATTRIBUTE_MAP: Record<keyof MarqueeContentOptions, string> = {\n speed: 'speed',\n mode: 'mode',\n direction: 'direction',\n pauseOnHover: 'pause-on-hover',\n};\n\nconst MARQUEE_CONTENT_CSS_PROPS = [\n '--marquee-content-distance',\n '--marquee-content-duration',\n] as const;\n\nconst SCROLL_TIME_SCALE_SMOOTHING_SECONDS = 0.12;\n\nconst MARQUEE_CONTENT_RUNTIME_CSS = `\n @keyframes marquee-content-auto {\n to {\n transform: translate3d(calc(-1 * var(--marquee-content-distance)), 0, 0);\n }\n }\n\n .marquee-content__source {\n position: absolute;\n width: 0;\n height: 0;\n overflow: hidden;\n }\n\n .marquee-content__source::slotted(*) {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n`;\n\nconst TEMPLATE = `\n <slot class=\"marquee-content__source\"></slot>\n\n <div class=\"marquee-content__viewport\" part=\"viewport\">\n <div class=\"marquee-content__track\" part=\"track\" aria-hidden=\"true\"></div>\n </div>\n`;\n\nexport class MarqueeContent extends HTMLElement {\n static get observedAttributes(): string[] {\n return [...OBSERVED_ATTRIBUTES];\n }\n\n private static readonly instances = new Set<MarqueeContent>();\n\n private static readonly runtimeStylesheetEntry: MarqueeContentStyleEntry = normalizeStyleInput(\n MARQUEE_CONTENT_RUNTIME_CSS,\n );\n\n private static stylesheetEntry: MarqueeContentStyleEntry =\n normalizeStyleInput(marqueeContentCssText);\n\n private static styleOverridesEntry: MarqueeContentStyleEntry = normalizeStyleInput(null);\n\n static configureStyles(options: DefineMarqueeContentOptions = {}): void {\n if ('stylesheet' in options) {\n MarqueeContent.stylesheetEntry = normalizeStyleInput(\n options.stylesheet ?? marqueeContentCssText,\n );\n }\n\n if ('styleOverrides' in options) {\n MarqueeContent.styleOverridesEntry = normalizeStyleInput(options.styleOverrides);\n }\n\n MarqueeContent.instances.forEach((instance) => {\n instance.applyAllStyles();\n });\n }\n\n static setStylesheet(stylesheet: MarqueeContentStyleInput): void {\n MarqueeContent.configureStyles({ stylesheet });\n }\n\n static setStyleOverrides(styleOverrides: MarqueeContentStyleInput): void {\n MarqueeContent.configureStyles({ styleOverrides });\n }\n\n private readonly shadow: ShadowRoot;\n private readonly sourceSlot: HTMLSlotElement;\n private readonly track: HTMLElement;\n\n private options: MarqueeContentResolvedOptions = { ...DEFAULT_OPTIONS };\n private sourceNodes: Node[] = [];\n\n private resizeObserver: ResizeObserver | null = null;\n private mutationObserver: MutationObserver | null = null;\n private intersectionObserver: IntersectionObserver | null = null;\n private abortController: AbortController | null = null;\n private reducedMotionMediaQuery: MediaQueryList | null = null;\n\n private animationFrameId: number | null = null;\n private rebuildFrameId: number | null = null;\n private lastFrameTime: number | null = null;\n\n private mounted = false;\n private isHovered = false;\n private isFocused = false;\n private isInViewport = true;\n private reducedMotion = false;\n private isListeningToScroll = false;\n\n private distance = 0;\n private offset = 0;\n\n private scrollDirectionFactor: 1 | -1 = 1;\n private currentTimeScale = 1;\n private scrollBoostStartValue = 0;\n private scrollBoostStartedAt = 0;\n private lastScrollY = 0;\n private lastScrollTime = 0;\n\n constructor() {\n super();\n\n this.shadow = this.attachShadow({ mode: 'open' });\n this.applyAllStyles();\n\n const template = document.createElement('template');\n template.innerHTML = TEMPLATE;\n this.shadow.appendChild(template.content.cloneNode(true));\n\n const sourceSlot = this.shadow.querySelector<HTMLSlotElement>('slot.marquee-content__source');\n\n const track = this.shadow.querySelector<HTMLElement>('.marquee-content__track');\n\n if (!sourceSlot) {\n throw new Error('[MarqueeContent] Source slot was not found.');\n }\n\n if (!track) {\n throw new Error('[MarqueeContent] Track element was not found.');\n }\n\n this.sourceSlot = sourceSlot;\n this.track = track;\n }\n\n connectedCallback(): void {\n if (this.mounted) {\n return;\n }\n\n MarqueeContent.instances.add(this);\n\n this.mounted = true;\n this.abortController = new AbortController();\n this.options = this.resolveOptions();\n\n this.lastScrollY = this.getScrollY();\n this.lastScrollTime = performance.now();\n\n this.sourceSlot.addEventListener('slotchange', this.handleSlotChange, {\n signal: this.abortController.signal,\n });\n\n this.shadow.addEventListener('load', this.scheduleRebuild, {\n capture: true,\n signal: this.abortController.signal,\n });\n\n this.addEventListener('pointerenter', this.handlePointerEnter, {\n signal: this.abortController.signal,\n });\n\n this.addEventListener('pointerleave', this.handlePointerLeave, {\n signal: this.abortController.signal,\n });\n\n this.addEventListener('focusin', this.handleFocusIn, {\n signal: this.abortController.signal,\n });\n\n this.addEventListener('focusout', this.handleFocusOut, {\n signal: this.abortController.signal,\n });\n\n window.addEventListener('orientationchange', this.scheduleRebuild, {\n signal: this.abortController.signal,\n });\n\n this.resizeObserver = new ResizeObserver(this.scheduleRebuild);\n this.resizeObserver.observe(this);\n\n this.intersectionObserver = new IntersectionObserver(this.handleIntersectionChange);\n this.intersectionObserver.observe(this);\n\n this.setupReducedMotionWatcher();\n this.watchSourceNodes();\n this.updateScrollListener();\n this.rebuild();\n\n if (this.options.recalculateAfterFontsReady) {\n this.rebuildAfterFontsReady();\n }\n }\n\n disconnectedCallback(): void {\n this.teardown();\n MarqueeContent.instances.delete(this);\n }\n\n attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void {\n if (oldValue === newValue) {\n return;\n }\n\n this.options = this.resolveOptions();\n\n if (!this.mounted) {\n return;\n }\n\n this.updateScrollListener();\n this.scheduleRebuild();\n }\n\n get speed(): number {\n return this.options.speed;\n }\n\n set speed(value: number | string | null | undefined) {\n this.setNullableAttribute('speed', value);\n }\n\n get mode(): MarqueeContentMode {\n return this.options.mode;\n }\n\n set mode(value: MarqueeContentMode | null | undefined) {\n this.setNullableAttribute('mode', value);\n }\n\n get direction(): MarqueeContentDirection {\n return this.options.direction;\n }\n\n set direction(value: MarqueeContentDirection | null | undefined) {\n this.setNullableAttribute('direction', value);\n }\n\n get pauseOnHover(): boolean {\n return this.options.pauseOnHover;\n }\n\n set pauseOnHover(value: boolean | string | null | undefined) {\n this.setNullableAttribute('pause-on-hover', value);\n }\n\n update(options: MarqueeContentOptions = {}): void {\n Object.entries(options).forEach(([key, value]) => {\n const attributeName = OPTION_ATTRIBUTE_MAP[key as keyof MarqueeContentOptions];\n\n if (attributeName) {\n this.setNullableAttribute(attributeName, value);\n }\n });\n\n this.options = this.resolveOptions();\n this.updateScrollListener();\n this.scheduleRebuild();\n }\n\n refresh(): void {\n this.scheduleRebuild();\n }\n\n private applyAllStyles(): void {\n const runtime = MarqueeContent.runtimeStylesheetEntry;\n const base = MarqueeContent.stylesheetEntry;\n const overrides = MarqueeContent.styleOverridesEntry;\n const sheets: CSSStyleSheet[] = [];\n\n if (runtime.sheet) {\n sheets.push(runtime.sheet);\n }\n\n if (base.sheet) {\n sheets.push(base.sheet);\n }\n\n if (overrides.sheet) {\n sheets.push(overrides.sheet);\n }\n\n this.shadow.adoptedStyleSheets = sheets;\n }\n\n private teardown(): void {\n if (!this.mounted) {\n return;\n }\n\n this.mounted = false;\n\n this.stopAnimationLoop();\n this.stopCssAnimation();\n this.cancelScheduledRebuild();\n this.updateScrollListener(false);\n\n this.resizeObserver?.disconnect();\n this.mutationObserver?.disconnect();\n this.intersectionObserver?.disconnect();\n\n this.removeReducedMotionWatcher();\n\n this.abortController?.abort();\n\n this.resizeObserver = null;\n this.mutationObserver = null;\n this.intersectionObserver = null;\n this.abortController = null;\n\n this.track.replaceChildren();\n this.removeAttribute('data-marquee-content-ready');\n this.removeAttribute('data-marquee-content-mode');\n this.removeAttribute('data-marquee-content-pause-on-hover');\n\n MARQUEE_CONTENT_CSS_PROPS.forEach((prop) => {\n this.style.removeProperty(prop);\n });\n\n this.distance = 0;\n this.offset = 0;\n this.currentTimeScale = 1;\n this.lastFrameTime = null;\n }\n\n private handleSlotChange = (): void => {\n this.watchSourceNodes();\n this.scheduleRebuild();\n };\n\n private handlePointerEnter = (): void => {\n this.isHovered = true;\n this.updateAnimationLoopState();\n };\n\n private handlePointerLeave = (): void => {\n this.isHovered = false;\n this.updateAnimationLoopState();\n };\n\n private handleFocusIn = (): void => {\n this.isFocused = true;\n this.updateAnimationLoopState();\n };\n\n private handleFocusOut = (): void => {\n this.isFocused = false;\n this.updateAnimationLoopState();\n };\n\n private handleIntersectionChange = (entries: IntersectionObserverEntry[]): void => {\n const entry = entries[0];\n\n if (!entry) {\n return;\n }\n\n this.isInViewport = entry.isIntersecting;\n this.updateAnimationLoopState();\n };\n\n private handleReducedMotionChange = (event: MediaQueryListEvent | MediaQueryList): void => {\n this.reducedMotion = event.matches;\n\n if (this.reducedMotion) {\n this.track.style.transform = 'none';\n } else if (this.options.mode === 'scroll') {\n this.applyTransform();\n }\n\n this.updateAnimationLoopState();\n };\n\n private handleScroll = (): void => {\n if (this.options.mode !== 'scroll') {\n return;\n }\n\n const now = performance.now();\n const currentScrollY = this.getScrollY();\n\n const deltaY = currentScrollY - this.lastScrollY;\n const deltaTime = Math.max((now - this.lastScrollTime) / 1000, 0.016);\n\n this.lastScrollY = currentScrollY;\n this.lastScrollTime = now;\n\n if (Math.abs(deltaY) < 0.5) {\n return;\n }\n\n const velocity = deltaY / deltaTime;\n\n this.scrollDirectionFactor = velocity >= 0 ? 1 : -1;\n\n const extraSpeed = this.clamp(\n velocity / this.options.scrollVelocityFactor,\n -this.options.scrollMaxExtraSpeed,\n this.options.scrollMaxExtraSpeed,\n );\n\n if (Math.abs(extraSpeed) >= this.options.scrollMinExtraSpeed) {\n this.scrollBoostStartValue = extraSpeed;\n this.scrollBoostStartedAt = now;\n } else {\n this.scrollBoostStartValue = 0;\n }\n\n this.updateAnimationLoopState();\n };\n\n private updateScrollListener(\n shouldListen = this.mounted && this.options.mode === 'scroll',\n ): void {\n if (shouldListen === this.isListeningToScroll) {\n return;\n }\n\n if (shouldListen) {\n this.lastScrollY = this.getScrollY();\n this.lastScrollTime = performance.now();\n window.addEventListener('scroll', this.handleScroll, { passive: true });\n } else {\n window.removeEventListener('scroll', this.handleScroll);\n }\n\n this.isListeningToScroll = shouldListen;\n }\n\n private scheduleRebuild = (): void => {\n if (!this.mounted) {\n return;\n }\n\n this.cancelScheduledRebuild();\n\n this.rebuildFrameId = requestAnimationFrame(() => {\n this.rebuildFrameId = null;\n this.rebuild();\n });\n };\n\n private cancelScheduledRebuild(): void {\n if (this.rebuildFrameId === null) {\n return;\n }\n\n cancelAnimationFrame(this.rebuildFrameId);\n this.rebuildFrameId = null;\n }\n\n private rebuild(): void {\n if (!this.mounted) {\n return;\n }\n\n this.options = this.resolveOptions();\n this.updateScrollListener();\n this.removeAttribute('data-marquee-content-ready');\n this.setAttribute('data-marquee-content-mode', this.options.mode);\n\n if (this.options.pauseOnHover) {\n this.setAttribute('data-marquee-content-pause-on-hover', 'true');\n } else {\n this.removeAttribute('data-marquee-content-pause-on-hover');\n }\n\n const containerWidth = this.clientWidth;\n\n if (containerWidth <= 0) {\n this.distance = 0;\n this.track.replaceChildren();\n this.updateAnimationLoopState();\n return;\n }\n\n this.sourceNodes = this.getSourceNodes();\n\n if (this.sourceNodes.length === 0) {\n this.distance = 0;\n this.track.replaceChildren();\n this.updateAnimationLoopState();\n return;\n }\n\n const group = this.createGroup();\n const targetWidth = containerWidth * this.options.minGroupWidthRatio;\n\n this.track.replaceChildren(group);\n this.expandGroupToWidth(group, targetWidth);\n\n const clone = group.cloneNode(true) as HTMLElement;\n\n clone.setAttribute('aria-hidden', 'true');\n this.track.appendChild(clone);\n\n this.distance = group.scrollWidth;\n this.offset = this.normalizeOffset(this.offset);\n\n if (this.distance <= 0) {\n this.track.replaceChildren();\n this.updateAnimationLoopState();\n return;\n }\n\n const currentSpeed = this.getCurrentSpeed(containerWidth);\n const duration = this.distance / currentSpeed;\n\n this.style.setProperty('--marquee-content-distance', `${this.distance}px`);\n this.style.setProperty('--marquee-content-duration', `${duration}s`);\n\n if (this.reducedMotion) {\n this.track.style.transform = 'none';\n } else if (this.options.mode === 'scroll') {\n this.applyTransform();\n } else {\n this.track.style.transform = '';\n }\n\n this.setAttribute('data-marquee-content-ready', 'true');\n this.updateAnimationLoopState();\n }\n\n private createGroup(): HTMLElement {\n const group = document.createElement('div');\n\n group.className = 'marquee-content__group';\n group.setAttribute('part', 'group');\n\n this.appendSourceNodes(group);\n\n return group;\n }\n\n private expandGroupToWidth(group: HTMLElement, targetWidth: number): void {\n const sourceSetWidth = group.scrollWidth;\n\n if (sourceSetWidth <= 0) {\n return;\n }\n\n const repeatCount = Math.ceil(targetWidth / sourceSetWidth);\n\n for (let index = 1; index < repeatCount; index += 1) {\n this.appendSourceNodes(group);\n }\n }\n\n private appendSourceNodes(target: HTMLElement): void {\n const fragment = document.createDocumentFragment();\n\n this.sourceNodes.forEach((node) => {\n fragment.append(this.cloneSourceNode(node));\n });\n\n target.appendChild(fragment);\n }\n\n private cloneSourceNode(node: Node): Node {\n const clone = node.cloneNode(true);\n\n if (clone instanceof Element) {\n const currentPart = clone.getAttribute('part');\n\n clone.setAttribute('part', currentPart ? `${currentPart} item` : 'item');\n }\n\n return clone;\n }\n\n private getSourceNodes(): Node[] {\n return this.sourceSlot.assignedNodes({ flatten: true }).filter((node) => {\n if (node.nodeType === Node.TEXT_NODE) {\n return Boolean(node.textContent?.trim());\n }\n\n return node.nodeType === Node.ELEMENT_NODE;\n });\n }\n\n private watchSourceNodes(): void {\n this.mutationObserver?.disconnect();\n\n this.mutationObserver = new MutationObserver(this.scheduleRebuild);\n\n this.getSourceNodes().forEach((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n this.mutationObserver?.observe(node, {\n attributes: true,\n childList: true,\n characterData: true,\n subtree: true,\n });\n\n return;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n this.mutationObserver?.observe(node, {\n characterData: true,\n });\n }\n });\n }\n\n private setupReducedMotionWatcher(): void {\n if (!('matchMedia' in window)) {\n return;\n }\n\n this.reducedMotionMediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');\n\n this.reducedMotion = this.reducedMotionMediaQuery.matches;\n this.reducedMotionMediaQuery.addEventListener('change', this.handleReducedMotionChange, {\n signal: this.abortController?.signal,\n });\n }\n\n private removeReducedMotionWatcher(): void {\n if (!this.reducedMotionMediaQuery) {\n return;\n }\n\n this.reducedMotionMediaQuery.removeEventListener('change', this.handleReducedMotionChange);\n\n this.reducedMotionMediaQuery = null;\n }\n\n private updateAnimationLoopState(): void {\n if (!this.mounted || this.distance <= 0 || this.reducedMotion) {\n this.stopAnimationLoop();\n this.stopCssAnimation();\n\n if (this.reducedMotion) {\n this.track.style.transform = 'none';\n }\n\n return;\n }\n\n if (this.options.mode === 'scroll') {\n this.stopCssAnimation();\n\n if (this.canAnimate()) {\n this.startAnimationLoop();\n } else {\n this.stopAnimationLoop();\n }\n\n return;\n }\n\n this.stopAnimationLoop();\n this.startCssAnimation();\n this.track.style.animationPlayState = this.canAnimate() ? 'running' : 'paused';\n }\n\n private canAnimate(): boolean {\n if (this.options.pauseOnHover && this.isHovered) {\n return false;\n }\n\n if (this.isFocused) {\n return false;\n }\n\n if (this.options.pauseWhenOutOfView && !this.isInViewport) {\n return false;\n }\n\n return true;\n }\n\n private startAnimationLoop(): void {\n if (this.animationFrameId !== null) {\n return;\n }\n\n this.lastFrameTime = performance.now();\n this.currentTimeScale = this.getCurrentTimeScale(this.lastFrameTime);\n this.animationFrameId = requestAnimationFrame(this.tick);\n }\n\n private stopAnimationLoop(): void {\n if (this.animationFrameId === null) {\n this.lastFrameTime = null;\n return;\n }\n\n cancelAnimationFrame(this.animationFrameId);\n this.animationFrameId = null;\n this.lastFrameTime = null;\n }\n\n private startCssAnimation(): void {\n const animationDirection = this.options.direction === 'ltr' ? 'reverse' : 'normal';\n\n this.track.style.transform = '';\n\n if (this.track.style.animationName !== 'marquee-content-auto') {\n this.track.style.animationName = 'marquee-content-auto';\n this.track.style.animationDuration = 'var(--marquee-content-duration)';\n this.track.style.animationTimingFunction = 'linear';\n this.track.style.animationIterationCount = 'infinite';\n }\n\n if (this.track.style.animationDirection !== animationDirection) {\n this.track.style.animationDirection = animationDirection;\n }\n }\n\n private stopCssAnimation(): void {\n this.track.style.animationName = '';\n this.track.style.animationDuration = '';\n this.track.style.animationTimingFunction = '';\n this.track.style.animationIterationCount = '';\n this.track.style.animationDirection = '';\n this.track.style.animationPlayState = '';\n }\n\n private tick = (now: number): void => {\n this.animationFrameId = null;\n\n if (\n !this.mounted ||\n this.options.mode !== 'scroll' ||\n this.distance <= 0 ||\n this.reducedMotion ||\n !this.canAnimate()\n ) {\n this.stopAnimationLoop();\n return;\n }\n\n const previousTime = this.lastFrameTime ?? now;\n const deltaTime = Math.min((now - previousTime) / 1000, 0.064);\n\n this.lastFrameTime = now;\n\n const currentSpeed = this.getCurrentSpeed(this.clientWidth);\n const targetTimeScale = this.getCurrentTimeScale(now);\n const smoothingFactor = this.getScrollTimeScaleSmoothingFactor(deltaTime);\n\n this.currentTimeScale += (targetTimeScale - this.currentTimeScale) * smoothingFactor;\n\n if (Math.abs(targetTimeScale - this.currentTimeScale) < 0.001) {\n this.currentTimeScale = targetTimeScale;\n }\n\n this.offset = this.normalizeOffset(\n this.offset + currentSpeed * this.currentTimeScale * deltaTime,\n );\n\n this.applyTransform();\n\n this.animationFrameId = requestAnimationFrame(this.tick);\n };\n\n private getScrollTimeScaleSmoothingFactor(deltaTime: number): number {\n if (this.options.mode !== 'scroll') {\n return 1;\n }\n\n return 1 - Math.exp(-deltaTime / SCROLL_TIME_SCALE_SMOOTHING_SECONDS);\n }\n\n private getCurrentTimeScale(now: number): number {\n const directionFactor = this.getDirectionFactor();\n\n if (this.options.mode !== 'scroll') {\n return directionFactor;\n }\n\n const boost = this.getScrollBoost(now);\n const scrollTimeScale = this.scrollDirectionFactor + boost;\n\n return this.clamp(\n directionFactor * scrollTimeScale,\n -1 - this.options.scrollMaxExtraSpeed,\n 1 + this.options.scrollMaxExtraSpeed,\n );\n }\n\n private getDirectionFactor(): 1 | -1 {\n return this.options.direction === 'ltr' ? -1 : 1;\n }\n\n private getScrollBoost(now: number): number {\n if (this.scrollBoostStartValue === 0) {\n return 0;\n }\n\n const duration = this.options.scrollInertiaDuration;\n\n if (duration <= 0) {\n this.scrollBoostStartValue = 0;\n return 0;\n }\n\n const progress = this.clamp((now - this.scrollBoostStartedAt) / duration, 0, 1);\n\n if (progress >= 1) {\n this.scrollBoostStartValue = 0;\n return 0;\n }\n\n const easedProgress = this.easeOutCubic(progress);\n\n return this.scrollBoostStartValue * (1 - easedProgress);\n }\n\n private applyTransform(): void {\n this.track.style.transform = `translate3d(${-this.offset}px, 0, 0)`;\n }\n\n private normalizeOffset(value: number): number {\n if (this.distance <= 0) {\n return 0;\n }\n\n const normalized = value % this.distance;\n\n return normalized < 0 ? normalized + this.distance : normalized;\n }\n\n private getCurrentSpeed(containerWidth: number): number {\n if (!this.options.responsiveSpeed) {\n return this.options.speed;\n }\n\n const factor = this.clamp(\n containerWidth / this.options.referenceWidth,\n this.options.minSpeedFactor,\n this.options.maxSpeedFactor,\n );\n\n return this.options.speed * factor;\n }\n\n private resolveOptions(): MarqueeContentResolvedOptions {\n return {\n ...DEFAULT_OPTIONS,\n speed: this.num('speed', DEFAULT_OPTIONS.speed, 10, 500),\n mode: this.parseMode(this.getAttribute('mode'), DEFAULT_OPTIONS.mode),\n direction: this.parseDirection(this.getAttribute('direction'), DEFAULT_OPTIONS.direction),\n pauseOnHover: this.parseBoolean(\n this.getAttribute('pause-on-hover'),\n DEFAULT_OPTIONS.pauseOnHover,\n ),\n };\n }\n\n private num(attributeName: string, fallback: number, min: number, max: number): number {\n return this.clamp(this.parseNumber(this.getAttribute(attributeName), fallback), min, max);\n }\n\n private parseNumber(value: string | null, fallback: number): number {\n if (value === null || value.trim() === '') {\n return fallback;\n }\n\n const parsed = Number(value);\n\n return Number.isFinite(parsed) ? parsed : fallback;\n }\n\n private parseBoolean(value: string | null, fallback: boolean): boolean {\n if (value === null) {\n return fallback;\n }\n\n const normalizedValue = value.trim().toLowerCase();\n\n if (normalizedValue === '') {\n return true;\n }\n\n if (['true', '1', 'yes', 'on'].includes(normalizedValue)) {\n return true;\n }\n\n if (['false', '0', 'no', 'off'].includes(normalizedValue)) {\n return false;\n }\n\n return fallback;\n }\n\n private parseMode(value: string | null, fallback: MarqueeContentMode): MarqueeContentMode {\n if (value === 'auto' || value === 'scroll') {\n return value;\n }\n\n return fallback;\n }\n\n private parseDirection(\n value: string | null,\n fallback: MarqueeContentDirection,\n ): MarqueeContentDirection {\n if (value === 'rtl' || value === 'ltr') {\n return value;\n }\n\n return fallback;\n }\n\n private setNullableAttribute(\n name: string,\n value: string | number | boolean | null | undefined,\n ): void {\n if (value === null || value === undefined) {\n this.removeAttribute(name);\n return;\n }\n\n this.setAttribute(name, String(value));\n }\n\n private getScrollY(): number {\n return window.scrollY || window.pageYOffset || 0;\n }\n\n private clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n }\n\n private easeOutCubic(value: number): number {\n return 1 - (1 - value) ** 3;\n }\n\n private rebuildAfterFontsReady(): void {\n const fonts = (\n document as Document & {\n fonts?: { ready: Promise<unknown> };\n }\n ).fonts;\n\n if (!fonts?.ready) {\n return;\n }\n\n void fonts.ready.then(this.scheduleRebuild).catch(() => undefined);\n }\n}\n\nexport function defineMarqueeContent(\n tagName = MARQUEE_CONTENT_TAG,\n options: DefineMarqueeContentOptions = {},\n): void {\n if (typeof window === 'undefined' || !window.customElements) {\n return;\n }\n\n MarqueeContent.configureStyles(options);\n\n if (!window.customElements.get(tagName)) {\n window.customElements.define(tagName, MarqueeContent);\n }\n}\n\nexport function initMarqueeContents(options: InitMarqueeContentsOptions = {}): void {\n const { tagName = MARQUEE_CONTENT_TAG, ...styleOptions } = options;\n\n defineMarqueeContent(tagName, styleOptions);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'marquee-content': MarqueeContent;\n }\n}\n","export type {\n DefineMarqueeContentOptions,\n InitMarqueeContentsOptions,\n MarqueeContentDirection,\n MarqueeContentMode,\n MarqueeContentOptions,\n} from './marquee-content';\nexport {\n defineMarqueeContent,\n initMarqueeContents,\n MARQUEE_CONTENT_TAG,\n MarqueeContent,\n} from './marquee-content';\nexport type {\n MarqueeContentStyleEntry,\n MarqueeContentStyleInput,\n} from './styles';\nexport {\n createConstructableStyleSheet,\n cssStyleSheetToText,\n marqueeContentCssText,\n normalizeStyleInput,\n} from './styles';\n\nimport { defineMarqueeContent } from './marquee-content';\n\ndefineMarqueeContent();\n"],"mappings":";;;;;AAUA,MAAa,wBAAwBA;AAErC,SAAgB,8BAA8B,SAAuC;CACnF,IACE,OAAO,kBAAkB,eACzB,OAAO,cAAc,UAAU,gBAAgB,YAE/C,OAAO;CAGT,IAAI;EACF,MAAM,QAAQ,IAAI,cAAc;EAChC,MAAM,YAAY,OAAO;EACzB,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,oBAAoB,OAA8B;CAChE,IAAI;EACF,OAAO,MAAM,KAAK,MAAM,QAAQ,CAAC,CAC9B,KAAK,SAAS,KAAK,OAAO,CAAC,CAC3B,KAAK,IAAI;CACd,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,oBAAoB,OAA2D;CAC7F,IAAI,CAAC,OACH,OAAO;EACL,OAAO;EACP,SAAS;CACX;CAGF,IAAI,OAAO,UAAU,UACnB,OAAO;EACL,OAAO,8BAA8B,KAAK;EAC1C,SAAS;CACX;CAGF,OAAO;EACL,OAAO;EACP,SAAS,oBAAoB,KAAK;CACpC;AACF;;;;ACXA,MAAa,sBAAsB;AAEnC,MAAM,kBAAiD;CACrD,OAAO;CACP,MAAM;CACN,WAAW;CACX,oBAAoB;CAEpB,iBAAiB;CACjB,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CAEhB,cAAc;CACd,oBAAoB;CACpB,4BAA4B;CAE5B,sBAAsB;CACtB,qBAAqB;CACrB,qBAAqB;CACrB,uBAAuB;AACzB;AAEA,MAAM,sBAAsB;CAAC;CAAS;CAAQ;CAAa;AAAgB;AAE3E,MAAM,uBAAoE;CACxE,OAAO;CACP,MAAM;CACN,WAAW;CACX,cAAc;AAChB;AAEA,MAAM,4BAA4B,CAChC,8BACA,4BACF;AAEA,MAAM,sCAAsC;AAE5C,MAAM,8BAA8B;;;;;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C,CAAC,YAAY,MAAS;CACnE;AACF;AAEA,SAAgB,qBACd,UAAU,qBACV,UAAuC,CAAC,GAClC;CACN,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,gBAC3C;CAGF,eAAe,gBAAgB,OAAO;CAEtC,IAAI,CAAC,OAAO,eAAe,IAAI,OAAO,GACpC,OAAO,eAAe,OAAO,SAAS,cAAc;AAExD;AAEA,SAAgB,oBAAoB,UAAsC,CAAC,GAAS;CAClF,MAAM,EAAE,UAAU,qBAAqB,GAAG,iBAAiB;CAE3D,qBAAqB,SAAS,YAAY;AAC5C;;;;ACjgCA,qBAAqB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["DEFAULT_CSS_TEXT"],"sources":["../src/styles.ts","../src/marquee-content.ts","../src/index.ts"],"sourcesContent":["import './marquee-content.css';\nimport DEFAULT_CSS_TEXT from './marquee-content.css?inline';\n\nexport type MarqueeContentStyleInput = CSSStyleSheet | string | null | undefined;\n\nexport interface MarqueeContentStyleEntry {\n sheet: CSSStyleSheet | null;\n cssText: string;\n}\n\nexport const marqueeContentCssText = DEFAULT_CSS_TEXT;\n\nexport function createConstructableStyleSheet(cssText: string): CSSStyleSheet | null {\n if (\n typeof CSSStyleSheet === 'undefined' ||\n typeof CSSStyleSheet.prototype.replaceSync !== 'function'\n ) {\n return null;\n }\n\n try {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(cssText);\n return sheet;\n } catch {\n return null;\n }\n}\n\nexport function cssStyleSheetToText(sheet: CSSStyleSheet): string {\n try {\n return Array.from(sheet.cssRules)\n .map((rule) => rule.cssText)\n .join('\\n');\n } catch {\n return '';\n }\n}\n\nexport function normalizeStyleInput(input: MarqueeContentStyleInput): MarqueeContentStyleEntry {\n if (!input) {\n return {\n sheet: null,\n cssText: '',\n };\n }\n\n if (typeof input === 'string') {\n return {\n sheet: createConstructableStyleSheet(input),\n cssText: input,\n };\n }\n\n return {\n sheet: input,\n cssText: cssStyleSheetToText(input),\n };\n}\n\nexport function canUseAdoptedStyleSheets(root: ShadowRoot): boolean {\n return (\n typeof CSSStyleSheet !== 'undefined' &&\n 'adoptedStyleSheets' in root &&\n typeof CSSStyleSheet.prototype.replaceSync === 'function'\n );\n}\n","import {\n type MarqueeContentStyleEntry,\n type MarqueeContentStyleInput,\n marqueeContentCssText,\n normalizeStyleInput,\n} from './styles';\n\nexport type MarqueeContentDirection = 'rtl' | 'ltr';\nexport type MarqueeContentMode = 'auto' | 'scroll';\n\nexport interface MarqueeContentOptions {\n speed?: number | string | null;\n mode?: MarqueeContentMode | null;\n direction?: MarqueeContentDirection | null;\n pauseOnHover?: boolean | string | null;\n}\n\ninterface MarqueeContentResolvedOptions {\n speed: number;\n mode: MarqueeContentMode;\n direction: MarqueeContentDirection;\n minGroupWidthRatio: number;\n\n responsiveSpeed: boolean;\n referenceWidth: number;\n minSpeedFactor: number;\n maxSpeedFactor: number;\n\n pauseOnHover: boolean;\n pauseWhenOutOfView: boolean;\n recalculateAfterFontsReady: boolean;\n\n scrollVelocityFactor: number;\n scrollMinExtraSpeed: number;\n scrollMaxExtraSpeed: number;\n scrollInertiaDuration: number;\n}\n\nexport interface DefineMarqueeContentOptions {\n stylesheet?: MarqueeContentStyleInput;\n styleOverrides?: MarqueeContentStyleInput;\n}\n\nexport interface InitMarqueeContentsOptions extends DefineMarqueeContentOptions {\n tagName?: string;\n}\n\nexport const MARQUEE_CONTENT_TAG = 'marquee-content';\n\nconst DEFAULT_OPTIONS: MarqueeContentResolvedOptions = {\n speed: 90,\n mode: 'auto',\n direction: 'rtl',\n minGroupWidthRatio: 1.05,\n\n responsiveSpeed: true,\n referenceWidth: 1280,\n minSpeedFactor: 0.55,\n maxSpeedFactor: 1,\n\n pauseOnHover: false,\n pauseWhenOutOfView: true,\n recalculateAfterFontsReady: true,\n\n scrollVelocityFactor: 150,\n scrollMinExtraSpeed: 0.05,\n scrollMaxExtraSpeed: 5,\n scrollInertiaDuration: 2500,\n};\n\nconst OBSERVED_ATTRIBUTES = ['speed', 'mode', 'direction', 'pause-on-hover'] as const;\n\nconst OPTION_ATTRIBUTE_MAP: Record<keyof MarqueeContentOptions, string> = {\n speed: 'speed',\n mode: 'mode',\n direction: 'direction',\n pauseOnHover: 'pause-on-hover',\n};\n\nconst MARQUEE_CONTENT_CSS_PROPS = [\n '--marquee-content-distance',\n '--marquee-content-duration',\n] as const;\n\nconst SCROLL_TIME_SCALE_SMOOTHING_SECONDS = 0.12;\n\nconst SCROLL_ANIMATION_SEED_ITERATIONS = 500;\n\nconst MARQUEE_CONTENT_RUNTIME_CSS = `\n @keyframes marquee-content-auto {\n to {\n transform: translate3d(calc(-1 * var(--marquee-content-distance)), 0, 0);\n }\n }\n\n .marquee-content__source {\n position: absolute;\n width: 0;\n height: 0;\n overflow: hidden;\n }\n\n .marquee-content__source::slotted(*) {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n`;\n\nconst TEMPLATE = `\n <slot class=\"marquee-content__source\"></slot>\n\n <div class=\"marquee-content__viewport\" part=\"viewport\">\n <div class=\"marquee-content__track\" part=\"track\" aria-hidden=\"true\"></div>\n </div>\n`;\n\nexport class MarqueeContent extends HTMLElement {\n static get observedAttributes(): string[] {\n return [...OBSERVED_ATTRIBUTES];\n }\n\n private static readonly instances = new Set<MarqueeContent>();\n\n private static readonly runtimeStylesheetEntry: MarqueeContentStyleEntry = normalizeStyleInput(\n MARQUEE_CONTENT_RUNTIME_CSS,\n );\n\n private static stylesheetEntry: MarqueeContentStyleEntry =\n normalizeStyleInput(marqueeContentCssText);\n\n private static styleOverridesEntry: MarqueeContentStyleEntry = normalizeStyleInput(null);\n\n static configureStyles(options: DefineMarqueeContentOptions = {}): void {\n if ('stylesheet' in options) {\n MarqueeContent.stylesheetEntry = normalizeStyleInput(\n options.stylesheet ?? marqueeContentCssText,\n );\n }\n\n if ('styleOverrides' in options) {\n MarqueeContent.styleOverridesEntry = normalizeStyleInput(options.styleOverrides);\n }\n\n MarqueeContent.instances.forEach((instance) => {\n instance.applyAllStyles();\n });\n }\n\n static setStylesheet(stylesheet: MarqueeContentStyleInput): void {\n MarqueeContent.configureStyles({ stylesheet });\n }\n\n static setStyleOverrides(styleOverrides: MarqueeContentStyleInput): void {\n MarqueeContent.configureStyles({ styleOverrides });\n }\n\n private readonly shadow: ShadowRoot;\n private readonly sourceSlot: HTMLSlotElement;\n private readonly track: HTMLElement;\n\n private options: MarqueeContentResolvedOptions = { ...DEFAULT_OPTIONS };\n private sourceNodes: Node[] = [];\n\n private resizeObserver: ResizeObserver | null = null;\n private mutationObserver: MutationObserver | null = null;\n private intersectionObserver: IntersectionObserver | null = null;\n private abortController: AbortController | null = null;\n private reducedMotionMediaQuery: MediaQueryList | null = null;\n\n private animationFrameId: number | null = null;\n private rebuildFrameId: number | null = null;\n private lastFrameTime: number | null = null;\n\n private mounted = false;\n private isHovered = false;\n private isFocused = false;\n private isInViewport = true;\n private reducedMotion = false;\n private isListeningToScroll = false;\n\n private distance = 0;\n\n private scrollAnimation: Animation | null = null;\n private scrollAnimationDuration = 0;\n private scrollAnimationDistance = 0;\n private scrollProgress = 0;\n\n private scrollDirectionFactor: 1 | -1 = 1;\n private currentTimeScale = 1;\n private scrollBoostStartValue = 0;\n private scrollBoostStartedAt = 0;\n private lastScrollY = 0;\n private lastScrollTime = 0;\n\n constructor() {\n super();\n\n this.shadow = this.attachShadow({ mode: 'open' });\n this.applyAllStyles();\n\n const template = document.createElement('template');\n template.innerHTML = TEMPLATE;\n this.shadow.appendChild(template.content.cloneNode(true));\n\n const sourceSlot = this.shadow.querySelector<HTMLSlotElement>('slot.marquee-content__source');\n\n const track = this.shadow.querySelector<HTMLElement>('.marquee-content__track');\n\n if (!sourceSlot) {\n throw new Error('[MarqueeContent] Source slot was not found.');\n }\n\n if (!track) {\n throw new Error('[MarqueeContent] Track element was not found.');\n }\n\n this.sourceSlot = sourceSlot;\n this.track = track;\n }\n\n connectedCallback(): void {\n if (this.mounted) {\n return;\n }\n\n MarqueeContent.instances.add(this);\n\n this.mounted = true;\n this.abortController = new AbortController();\n this.options = this.resolveOptions();\n\n this.lastScrollY = this.getScrollY();\n this.lastScrollTime = performance.now();\n\n this.sourceSlot.addEventListener('slotchange', this.handleSlotChange, {\n signal: this.abortController.signal,\n });\n\n this.shadow.addEventListener('load', this.scheduleRebuild, {\n capture: true,\n signal: this.abortController.signal,\n });\n\n this.addEventListener('pointerenter', this.handlePointerEnter, {\n signal: this.abortController.signal,\n });\n\n this.addEventListener('pointerleave', this.handlePointerLeave, {\n signal: this.abortController.signal,\n });\n\n this.addEventListener('focusin', this.handleFocusIn, {\n signal: this.abortController.signal,\n });\n\n this.addEventListener('focusout', this.handleFocusOut, {\n signal: this.abortController.signal,\n });\n\n window.addEventListener('orientationchange', this.scheduleRebuild, {\n signal: this.abortController.signal,\n });\n\n this.resizeObserver = new ResizeObserver(this.scheduleRebuild);\n this.resizeObserver.observe(this);\n\n this.intersectionObserver = new IntersectionObserver(this.handleIntersectionChange);\n this.intersectionObserver.observe(this);\n\n this.setupReducedMotionWatcher();\n this.watchSourceNodes();\n this.updateScrollListener();\n this.rebuild();\n\n if (this.options.recalculateAfterFontsReady) {\n this.rebuildAfterFontsReady();\n }\n }\n\n disconnectedCallback(): void {\n this.teardown();\n MarqueeContent.instances.delete(this);\n }\n\n attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void {\n if (oldValue === newValue) {\n return;\n }\n\n this.options = this.resolveOptions();\n\n if (!this.mounted) {\n return;\n }\n\n this.updateScrollListener();\n this.scheduleRebuild();\n }\n\n get speed(): number {\n return this.options.speed;\n }\n\n set speed(value: number | string | null | undefined) {\n this.setNullableAttribute('speed', value);\n }\n\n get mode(): MarqueeContentMode {\n return this.options.mode;\n }\n\n set mode(value: MarqueeContentMode | null | undefined) {\n this.setNullableAttribute('mode', value);\n }\n\n get direction(): MarqueeContentDirection {\n return this.options.direction;\n }\n\n set direction(value: MarqueeContentDirection | null | undefined) {\n this.setNullableAttribute('direction', value);\n }\n\n get pauseOnHover(): boolean {\n return this.options.pauseOnHover;\n }\n\n set pauseOnHover(value: boolean | string | null | undefined) {\n this.setNullableAttribute('pause-on-hover', value);\n }\n\n update(options: MarqueeContentOptions = {}): void {\n Object.entries(options).forEach(([key, value]) => {\n const attributeName = OPTION_ATTRIBUTE_MAP[key as keyof MarqueeContentOptions];\n\n if (attributeName) {\n this.setNullableAttribute(attributeName, value);\n }\n });\n\n this.options = this.resolveOptions();\n this.updateScrollListener();\n this.scheduleRebuild();\n }\n\n refresh(): void {\n this.scheduleRebuild();\n }\n\n private applyAllStyles(): void {\n const runtime = MarqueeContent.runtimeStylesheetEntry;\n const base = MarqueeContent.stylesheetEntry;\n const overrides = MarqueeContent.styleOverridesEntry;\n const sheets: CSSStyleSheet[] = [];\n\n if (runtime.sheet) {\n sheets.push(runtime.sheet);\n }\n\n if (base.sheet) {\n sheets.push(base.sheet);\n }\n\n if (overrides.sheet) {\n sheets.push(overrides.sheet);\n }\n\n this.shadow.adoptedStyleSheets = sheets;\n }\n\n private teardown(): void {\n if (!this.mounted) {\n return;\n }\n\n this.mounted = false;\n\n this.stopAnimationLoop();\n this.stopCssAnimation();\n this.cancelScrollAnimation();\n this.cancelScheduledRebuild();\n this.updateScrollListener(false);\n\n this.resizeObserver?.disconnect();\n this.mutationObserver?.disconnect();\n this.intersectionObserver?.disconnect();\n\n this.removeReducedMotionWatcher();\n\n this.abortController?.abort();\n\n this.resizeObserver = null;\n this.mutationObserver = null;\n this.intersectionObserver = null;\n this.abortController = null;\n\n this.track.replaceChildren();\n this.removeAttribute('data-marquee-content-ready');\n this.removeAttribute('data-marquee-content-mode');\n this.removeAttribute('data-marquee-content-pause-on-hover');\n\n MARQUEE_CONTENT_CSS_PROPS.forEach((prop) => {\n this.style.removeProperty(prop);\n });\n\n this.distance = 0;\n this.scrollProgress = 0;\n this.currentTimeScale = 1;\n this.lastFrameTime = null;\n }\n\n private handleSlotChange = (): void => {\n this.watchSourceNodes();\n this.scheduleRebuild();\n };\n\n private handlePointerEnter = (): void => {\n this.isHovered = true;\n this.updateAnimationLoopState();\n };\n\n private handlePointerLeave = (): void => {\n this.isHovered = false;\n this.updateAnimationLoopState();\n };\n\n private handleFocusIn = (): void => {\n this.isFocused = true;\n this.updateAnimationLoopState();\n };\n\n private handleFocusOut = (): void => {\n this.isFocused = false;\n this.updateAnimationLoopState();\n };\n\n private handleIntersectionChange = (entries: IntersectionObserverEntry[]): void => {\n const entry = entries[0];\n\n if (!entry) {\n return;\n }\n\n this.isInViewport = entry.isIntersecting;\n this.updateAnimationLoopState();\n };\n\n private handleReducedMotionChange = (event: MediaQueryListEvent | MediaQueryList): void => {\n this.reducedMotion = event.matches;\n\n if (this.reducedMotion) {\n this.track.style.transform = 'none';\n } else if (this.options.mode === 'scroll') {\n this.track.style.transform = '';\n }\n\n this.updateAnimationLoopState();\n };\n\n private handleScroll = (): void => {\n if (this.options.mode !== 'scroll') {\n return;\n }\n\n const now = performance.now();\n const currentScrollY = this.getScrollY();\n\n const deltaY = currentScrollY - this.lastScrollY;\n const deltaTime = Math.max((now - this.lastScrollTime) / 1000, 0.016);\n\n this.lastScrollY = currentScrollY;\n this.lastScrollTime = now;\n\n if (Math.abs(deltaY) < 0.5) {\n return;\n }\n\n const velocity = deltaY / deltaTime;\n\n this.scrollDirectionFactor = velocity >= 0 ? 1 : -1;\n\n const extraSpeed = this.clamp(\n velocity / this.options.scrollVelocityFactor,\n -this.options.scrollMaxExtraSpeed,\n this.options.scrollMaxExtraSpeed,\n );\n\n if (Math.abs(extraSpeed) >= this.options.scrollMinExtraSpeed) {\n this.scrollBoostStartValue = extraSpeed;\n this.scrollBoostStartedAt = now;\n } else {\n this.scrollBoostStartValue = 0;\n }\n\n this.onScrollBoostChanged();\n };\n\n private onScrollBoostChanged(): void {\n if (!this.mounted || this.options.mode !== 'scroll' || this.reducedMotion) {\n return;\n }\n\n this.ensureScrollAnimation();\n\n if (!this.scrollAnimation || !this.canAnimate()) {\n return;\n }\n\n this.scrollAnimation.play();\n this.startAnimationLoop();\n }\n\n private updateScrollListener(\n shouldListen = this.mounted && this.options.mode === 'scroll',\n ): void {\n if (shouldListen === this.isListeningToScroll) {\n return;\n }\n\n if (shouldListen) {\n this.lastScrollY = this.getScrollY();\n this.lastScrollTime = performance.now();\n window.addEventListener('scroll', this.handleScroll, { passive: true });\n } else {\n window.removeEventListener('scroll', this.handleScroll);\n }\n\n this.isListeningToScroll = shouldListen;\n }\n\n private scheduleRebuild = (): void => {\n if (!this.mounted) {\n return;\n }\n\n this.cancelScheduledRebuild();\n\n this.rebuildFrameId = requestAnimationFrame(() => {\n this.rebuildFrameId = null;\n this.rebuild();\n });\n };\n\n private cancelScheduledRebuild(): void {\n if (this.rebuildFrameId === null) {\n return;\n }\n\n cancelAnimationFrame(this.rebuildFrameId);\n this.rebuildFrameId = null;\n }\n\n private rebuild(): void {\n if (!this.mounted) {\n return;\n }\n\n this.options = this.resolveOptions();\n this.updateScrollListener();\n this.removeAttribute('data-marquee-content-ready');\n this.setAttribute('data-marquee-content-mode', this.options.mode);\n\n if (this.options.pauseOnHover) {\n this.setAttribute('data-marquee-content-pause-on-hover', 'true');\n } else {\n this.removeAttribute('data-marquee-content-pause-on-hover');\n }\n\n const containerWidth = this.clientWidth;\n\n if (containerWidth <= 0) {\n this.distance = 0;\n this.track.replaceChildren();\n this.updateAnimationLoopState();\n return;\n }\n\n this.sourceNodes = this.getSourceNodes();\n\n if (this.sourceNodes.length === 0) {\n this.distance = 0;\n this.track.replaceChildren();\n this.updateAnimationLoopState();\n return;\n }\n\n const group = this.createGroup();\n const targetWidth = containerWidth * this.options.minGroupWidthRatio;\n\n this.track.replaceChildren(group);\n this.expandGroupToWidth(group, targetWidth);\n\n const clone = group.cloneNode(true) as HTMLElement;\n\n clone.setAttribute('aria-hidden', 'true');\n this.track.appendChild(clone);\n\n this.distance = group.scrollWidth;\n\n if (this.distance <= 0) {\n this.track.replaceChildren();\n this.updateAnimationLoopState();\n return;\n }\n\n const currentSpeed = this.getCurrentSpeed(containerWidth);\n const duration = this.distance / currentSpeed;\n\n this.style.setProperty('--marquee-content-distance', `${this.distance}px`);\n this.style.setProperty('--marquee-content-duration', `${duration}s`);\n\n if (this.reducedMotion) {\n this.track.style.transform = 'none';\n } else {\n this.track.style.transform = '';\n }\n\n this.setAttribute('data-marquee-content-ready', 'true');\n this.updateAnimationLoopState();\n }\n\n private createGroup(): HTMLElement {\n const group = document.createElement('div');\n\n group.className = 'marquee-content__group';\n group.setAttribute('part', 'group');\n\n this.appendSourceNodes(group);\n\n return group;\n }\n\n private expandGroupToWidth(group: HTMLElement, targetWidth: number): void {\n const sourceSetWidth = group.scrollWidth;\n\n if (sourceSetWidth <= 0) {\n return;\n }\n\n const repeatCount = Math.ceil(targetWidth / sourceSetWidth);\n\n for (let index = 1; index < repeatCount; index += 1) {\n this.appendSourceNodes(group);\n }\n }\n\n private appendSourceNodes(target: HTMLElement): void {\n const fragment = document.createDocumentFragment();\n\n this.sourceNodes.forEach((node) => {\n fragment.append(this.cloneSourceNode(node));\n });\n\n target.appendChild(fragment);\n }\n\n private cloneSourceNode(node: Node): Node {\n const clone = node.cloneNode(true);\n\n if (clone instanceof Element) {\n const currentPart = clone.getAttribute('part');\n\n clone.setAttribute('part', currentPart ? `${currentPart} item` : 'item');\n }\n\n return clone;\n }\n\n private getSourceNodes(): Node[] {\n return this.sourceSlot.assignedNodes({ flatten: true }).filter((node) => {\n if (node.nodeType === Node.TEXT_NODE) {\n return Boolean(node.textContent?.trim());\n }\n\n return node.nodeType === Node.ELEMENT_NODE;\n });\n }\n\n private watchSourceNodes(): void {\n this.mutationObserver?.disconnect();\n\n this.mutationObserver = new MutationObserver(this.scheduleRebuild);\n\n this.getSourceNodes().forEach((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n this.mutationObserver?.observe(node, {\n attributes: true,\n childList: true,\n characterData: true,\n subtree: true,\n });\n\n return;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n this.mutationObserver?.observe(node, {\n characterData: true,\n });\n }\n });\n }\n\n private setupReducedMotionWatcher(): void {\n if (!('matchMedia' in window)) {\n return;\n }\n\n this.reducedMotionMediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');\n\n this.reducedMotion = this.reducedMotionMediaQuery.matches;\n this.reducedMotionMediaQuery.addEventListener('change', this.handleReducedMotionChange, {\n signal: this.abortController?.signal,\n });\n }\n\n private removeReducedMotionWatcher(): void {\n if (!this.reducedMotionMediaQuery) {\n return;\n }\n\n this.reducedMotionMediaQuery.removeEventListener('change', this.handleReducedMotionChange);\n\n this.reducedMotionMediaQuery = null;\n }\n\n private updateAnimationLoopState(): void {\n if (!this.mounted || this.distance <= 0 || this.reducedMotion) {\n this.stopAnimationLoop();\n this.stopCssAnimation();\n this.cancelScrollAnimation();\n\n if (this.reducedMotion) {\n this.track.style.transform = 'none';\n }\n\n return;\n }\n\n if (this.options.mode === 'scroll') {\n this.stopCssAnimation();\n this.track.style.transform = '';\n this.ensureScrollAnimation();\n\n if (!this.scrollAnimation || !this.canAnimate()) {\n this.scrollAnimation?.pause();\n this.stopAnimationLoop();\n return;\n }\n\n this.scrollAnimation.play();\n this.updateScrollPlaybackRate(performance.now(), true);\n this.startAnimationLoop();\n\n return;\n }\n\n this.stopAnimationLoop();\n this.cancelScrollAnimation();\n this.startCssAnimation();\n this.track.style.animationPlayState = this.canAnimate() ? 'running' : 'paused';\n }\n\n private canAnimate(): boolean {\n if (this.options.pauseOnHover && this.isHovered) {\n return false;\n }\n\n if (this.isFocused) {\n return false;\n }\n\n if (this.options.pauseWhenOutOfView && !this.isInViewport) {\n return false;\n }\n\n return true;\n }\n\n private startAnimationLoop(): void {\n if (this.animationFrameId !== null) {\n return;\n }\n\n this.lastFrameTime = performance.now();\n this.animationFrameId = requestAnimationFrame(this.tick);\n }\n\n private stopAnimationLoop(): void {\n if (this.animationFrameId === null) {\n this.lastFrameTime = null;\n return;\n }\n\n cancelAnimationFrame(this.animationFrameId);\n this.animationFrameId = null;\n this.lastFrameTime = null;\n }\n\n private startCssAnimation(): void {\n const animationDirection = this.options.direction === 'ltr' ? 'reverse' : 'normal';\n\n this.track.style.transform = '';\n\n if (this.track.style.animationName !== 'marquee-content-auto') {\n this.track.style.animationName = 'marquee-content-auto';\n this.track.style.animationDuration = 'var(--marquee-content-duration)';\n this.track.style.animationTimingFunction = 'linear';\n this.track.style.animationIterationCount = 'infinite';\n }\n\n if (this.track.style.animationDirection !== animationDirection) {\n this.track.style.animationDirection = animationDirection;\n }\n }\n\n private stopCssAnimation(): void {\n this.track.style.animationName = '';\n this.track.style.animationDuration = '';\n this.track.style.animationTimingFunction = '';\n this.track.style.animationIterationCount = '';\n this.track.style.animationDirection = '';\n this.track.style.animationPlayState = '';\n }\n\n private tick = (now: number): void => {\n this.animationFrameId = null;\n\n if (\n !this.mounted ||\n this.options.mode !== 'scroll' ||\n this.distance <= 0 ||\n this.reducedMotion ||\n !this.canAnimate() ||\n !this.scrollAnimation\n ) {\n return;\n }\n\n const settled = this.updateScrollPlaybackRate(now, false);\n\n if (!settled) {\n this.animationFrameId = requestAnimationFrame(this.tick);\n }\n };\n\n private ensureScrollAnimation(): void {\n if (this.distance <= 0) {\n this.cancelScrollAnimation();\n return;\n }\n\n const currentSpeed = this.getCurrentSpeed(this.clientWidth);\n const durationMs = currentSpeed > 0 ? (this.distance / currentSpeed) * 1000 : 0;\n\n if (durationMs <= 0) {\n this.cancelScrollAnimation();\n return;\n }\n\n if (\n this.scrollAnimation &&\n this.scrollAnimationDistance === this.distance &&\n this.scrollAnimationDuration === durationMs\n ) {\n return;\n }\n\n const progress = this.getScrollAnimationProgress();\n const hadAnimation = this.scrollAnimation !== null;\n\n if (this.scrollAnimation) {\n this.scrollAnimation.cancel();\n this.scrollAnimation = null;\n }\n\n if (!hadAnimation) {\n this.currentTimeScale = this.getDirectionFactor() * this.scrollDirectionFactor;\n }\n\n const animation = this.track.animate(\n [\n { transform: 'translate3d(0px, 0, 0)' },\n { transform: `translate3d(${-this.distance}px, 0, 0)` },\n ],\n {\n duration: durationMs,\n iterations: Number.POSITIVE_INFINITY,\n easing: 'linear',\n },\n );\n\n animation.currentTime = durationMs * (SCROLL_ANIMATION_SEED_ITERATIONS + progress);\n animation.playbackRate = this.currentTimeScale;\n\n this.scrollAnimation = animation;\n this.scrollAnimationDuration = durationMs;\n this.scrollAnimationDistance = this.distance;\n this.scrollProgress = progress;\n }\n\n private cancelScrollAnimation(): void {\n if (!this.scrollAnimation) {\n return;\n }\n\n this.scrollProgress = this.getScrollAnimationProgress();\n this.scrollAnimation.cancel();\n this.scrollAnimation = null;\n this.scrollAnimationDuration = 0;\n this.scrollAnimationDistance = 0;\n }\n\n private getScrollAnimationProgress(): number {\n const animation = this.scrollAnimation;\n\n if (!animation || this.scrollAnimationDuration <= 0) {\n return this.scrollProgress;\n }\n\n const currentTime = animation.currentTime;\n\n if (typeof currentTime !== 'number') {\n return this.scrollProgress;\n }\n\n const fraction = (currentTime / this.scrollAnimationDuration) % 1;\n\n return fraction < 0 ? fraction + 1 : fraction;\n }\n\n private updateScrollPlaybackRate(now: number, immediate: boolean): boolean {\n if (!this.scrollAnimation) {\n return true;\n }\n\n const target = this.getCurrentTimeScale(now);\n\n if (immediate) {\n this.currentTimeScale = target;\n this.lastFrameTime = now;\n } else {\n const previousTime = this.lastFrameTime ?? now;\n const deltaTime = Math.min((now - previousTime) / 1000, 0.064);\n\n this.lastFrameTime = now;\n\n const smoothingFactor = 1 - Math.exp(-deltaTime / SCROLL_TIME_SCALE_SMOOTHING_SECONDS);\n\n this.currentTimeScale += (target - this.currentTimeScale) * smoothingFactor;\n }\n\n const settled =\n this.scrollBoostStartValue === 0 && Math.abs(target - this.currentTimeScale) < 0.001;\n\n if (settled) {\n this.currentTimeScale = target;\n }\n\n if (this.scrollAnimation.playbackRate !== this.currentTimeScale) {\n this.scrollAnimation.playbackRate = this.currentTimeScale;\n }\n\n return settled;\n }\n\n private getCurrentTimeScale(now: number): number {\n const directionFactor = this.getDirectionFactor();\n\n if (this.options.mode !== 'scroll') {\n return directionFactor;\n }\n\n const boost = this.getScrollBoost(now);\n const scrollTimeScale = this.scrollDirectionFactor + boost;\n\n return this.clamp(\n directionFactor * scrollTimeScale,\n -1 - this.options.scrollMaxExtraSpeed,\n 1 + this.options.scrollMaxExtraSpeed,\n );\n }\n\n private getDirectionFactor(): 1 | -1 {\n return this.options.direction === 'ltr' ? -1 : 1;\n }\n\n private getScrollBoost(now: number): number {\n if (this.scrollBoostStartValue === 0) {\n return 0;\n }\n\n const duration = this.options.scrollInertiaDuration;\n\n if (duration <= 0) {\n this.scrollBoostStartValue = 0;\n return 0;\n }\n\n const progress = this.clamp((now - this.scrollBoostStartedAt) / duration, 0, 1);\n\n if (progress >= 1) {\n this.scrollBoostStartValue = 0;\n return 0;\n }\n\n const easedProgress = this.easeOutCubic(progress);\n\n return this.scrollBoostStartValue * (1 - easedProgress);\n }\n\n private getCurrentSpeed(containerWidth: number): number {\n if (!this.options.responsiveSpeed) {\n return this.options.speed;\n }\n\n const factor = this.clamp(\n containerWidth / this.options.referenceWidth,\n this.options.minSpeedFactor,\n this.options.maxSpeedFactor,\n );\n\n return this.options.speed * factor;\n }\n\n private resolveOptions(): MarqueeContentResolvedOptions {\n return {\n ...DEFAULT_OPTIONS,\n speed: this.num('speed', DEFAULT_OPTIONS.speed, 10, 500),\n mode: this.parseMode(this.getAttribute('mode'), DEFAULT_OPTIONS.mode),\n direction: this.parseDirection(this.getAttribute('direction'), DEFAULT_OPTIONS.direction),\n pauseOnHover: this.parseBoolean(\n this.getAttribute('pause-on-hover'),\n DEFAULT_OPTIONS.pauseOnHover,\n ),\n };\n }\n\n private num(attributeName: string, fallback: number, min: number, max: number): number {\n return this.clamp(this.parseNumber(this.getAttribute(attributeName), fallback), min, max);\n }\n\n private parseNumber(value: string | null, fallback: number): number {\n if (value === null || value.trim() === '') {\n return fallback;\n }\n\n const parsed = Number(value);\n\n return Number.isFinite(parsed) ? parsed : fallback;\n }\n\n private parseBoolean(value: string | null, fallback: boolean): boolean {\n if (value === null) {\n return fallback;\n }\n\n const normalizedValue = value.trim().toLowerCase();\n\n if (normalizedValue === '') {\n return true;\n }\n\n if (['true', '1', 'yes', 'on'].includes(normalizedValue)) {\n return true;\n }\n\n if (['false', '0', 'no', 'off'].includes(normalizedValue)) {\n return false;\n }\n\n return fallback;\n }\n\n private parseMode(value: string | null, fallback: MarqueeContentMode): MarqueeContentMode {\n if (value === 'auto' || value === 'scroll') {\n return value;\n }\n\n return fallback;\n }\n\n private parseDirection(\n value: string | null,\n fallback: MarqueeContentDirection,\n ): MarqueeContentDirection {\n if (value === 'rtl' || value === 'ltr') {\n return value;\n }\n\n return fallback;\n }\n\n private setNullableAttribute(\n name: string,\n value: string | number | boolean | null | undefined,\n ): void {\n if (value === null || value === undefined) {\n this.removeAttribute(name);\n return;\n }\n\n this.setAttribute(name, String(value));\n }\n\n private getScrollY(): number {\n return window.scrollY || window.pageYOffset || 0;\n }\n\n private clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n }\n\n private easeOutCubic(value: number): number {\n return 1 - (1 - value) ** 3;\n }\n\n private rebuildAfterFontsReady(): void {\n const fonts = (\n document as Document & {\n fonts?: { ready: Promise<unknown> };\n }\n ).fonts;\n\n if (!fonts?.ready) {\n return;\n }\n\n void fonts.ready.then(this.scheduleRebuild).catch(() => undefined);\n }\n}\n\nexport function defineMarqueeContent(\n tagName = MARQUEE_CONTENT_TAG,\n options: DefineMarqueeContentOptions = {},\n): void {\n if (typeof window === 'undefined' || !window.customElements) {\n return;\n }\n\n MarqueeContent.configureStyles(options);\n\n if (!window.customElements.get(tagName)) {\n window.customElements.define(tagName, MarqueeContent);\n }\n}\n\nexport function initMarqueeContents(options: InitMarqueeContentsOptions = {}): void {\n const { tagName = MARQUEE_CONTENT_TAG, ...styleOptions } = options;\n\n defineMarqueeContent(tagName, styleOptions);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'marquee-content': MarqueeContent;\n }\n}\n","export type {\n DefineMarqueeContentOptions,\n InitMarqueeContentsOptions,\n MarqueeContentDirection,\n MarqueeContentMode,\n MarqueeContentOptions,\n} from './marquee-content';\nexport {\n defineMarqueeContent,\n initMarqueeContents,\n MARQUEE_CONTENT_TAG,\n MarqueeContent,\n} from './marquee-content';\nexport type {\n MarqueeContentStyleEntry,\n MarqueeContentStyleInput,\n} from './styles';\nexport {\n createConstructableStyleSheet,\n cssStyleSheetToText,\n marqueeContentCssText,\n normalizeStyleInput,\n} from './styles';\n\nimport { defineMarqueeContent } from './marquee-content';\n\ndefineMarqueeContent();\n"],"mappings":";;;;;AAUA,MAAa,wBAAwBA;AAErC,SAAgB,8BAA8B,SAAuC;CACnF,IACE,OAAO,kBAAkB,eACzB,OAAO,cAAc,UAAU,gBAAgB,YAE/C,OAAO;CAGT,IAAI;EACF,MAAM,QAAQ,IAAI,cAAc;EAChC,MAAM,YAAY,OAAO;EACzB,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,oBAAoB,OAA8B;CAChE,IAAI;EACF,OAAO,MAAM,KAAK,MAAM,QAAQ,CAAC,CAC9B,KAAK,SAAS,KAAK,OAAO,CAAC,CAC3B,KAAK,IAAI;CACd,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,oBAAoB,OAA2D;CAC7F,IAAI,CAAC,OACH,OAAO;EACL,OAAO;EACP,SAAS;CACX;CAGF,IAAI,OAAO,UAAU,UACnB,OAAO;EACL,OAAO,8BAA8B,KAAK;EAC1C,SAAS;CACX;CAGF,OAAO;EACL,OAAO;EACP,SAAS,oBAAoB,KAAK;CACpC;AACF;;;;ACXA,MAAa,sBAAsB;AAEnC,MAAM,kBAAiD;CACrD,OAAO;CACP,MAAM;CACN,WAAW;CACX,oBAAoB;CAEpB,iBAAiB;CACjB,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CAEhB,cAAc;C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