feat: Fluent UI Outlook Lite + connections mockup

This commit is contained in:
Lago committed 2026-04-14 18:52:25 +00:00
1 parent 1199eff6c3
commit dfa4010406
34820 files changed
+1003810 -202

No files matched your search

+233
View File
@@ -0,0 +1,233 @@
<br />
<div align="center">
<p align="center">
<a href="https://www.embla-carousel.com/"><img width="100" height="100" src="https://www.embla-carousel.com/embla-logo.svg" alt="Embla Carousel">
</a>
</p>
<p align="center">
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/npm/l/embla-carousel?color=%238ab4f8"></a>
<a href="https://www.npmjs.com/package/embla-carousel"><img src="https://img.shields.io/npm/v/embla-carousel.svg?color=%23c1a8e2"></a>
<a href="https://github.com/davidjerleke/embla-carousel/actions?query=workflow%3A%22Continuous+Integration%22"><img src="https://img.shields.io/github/actions/workflow/status/davidjerleke/embla-carousel/cd.yml?color=%238ab4f8"></a>
<a href="https://prettier.io"><img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?color=%23c1a8e2"></a>
<a href="https://bundlephobia.com/result?p=embla-carousel@latest"><img src="https://img.shields.io/bundlephobia/minzip/embla-carousel?color=%238ab4f8&label=gzip%20size">
</a>
</p>
<strong>
<h2 align="center">Embla Carousel</h2>
</strong>
<p align="center">
<strong>Embla Carousel</strong> is a bare bones carousel library with great fluid motion and awesome swipe precision. It's library agnostic, dependency free and 100% open source.
</p>
<br>
<p align="center">
<strong>
<code>&nbsp;<a href="https://www.embla-carousel.com/examples/predefined/">Examples</a>&nbsp;</code>
</strong>
</p>
<p align="center">
<strong>
<code>&nbsp;<a href="https://www.embla-carousel.com/examples/generator/">Generator</a>&nbsp;</code>
</strong>
</p>
<p align="center">
<strong>
<code>&nbsp;<a href="https://www.embla-carousel.com/get-started/#choose-installation-type">Installation</a>&nbsp;</code>
</strong>
</p>
</div>
<br>
<div align="center">
<strong>
<h2 align="center">Ready for</h2>
</strong>
<p align="center">
<a href="https://www.embla-carousel.com/get-started/module/">
<img src="https://www.embla-carousel.com/javascript-logo.svg" width="40" height="40" />
</a>
<a href="https://www.embla-carousel.com/get-started/module/">
<img src="https://www.embla-carousel.com/typescript-logo.svg" width="40" height="40" />
</a>
<a href="https://www.embla-carousel.com/get-started/react/">
<img src="https://www.embla-carousel.com/react-logo.svg" width="40" height="40" />
</a>
<a href="https://www.embla-carousel.com/get-started/vue/">
<img src="https://www.embla-carousel.com/vue-logo.svg" width="40" height="40" />
</a>
<a href="https://www.embla-carousel.com/get-started/svelte/">
<img src="https://www.embla-carousel.com/svelte-logo.svg" width="40" height="40" />
</a>
<a href="https://www.embla-carousel.com/get-started/solid/">
<img src="https://www.embla-carousel.com/solid-logo.svg" width="40" height="40" />
</a>
<a href="https://github.com/donaldxdonald/embla-carousel-angular">
<img src="https://www.embla-carousel.com/angular-logo.svg" width="40" height="40" />
</a>
</p>
</div>
<br>
<div align="center">
<strong>
<h2 align="center">Contributors</h2>
</strong>
<p align="center">
Thank you to all contributors for making <a href="https://www.embla-carousel.com/">Embla Carousel</a> awesome! <a href="https://github.com/davidjerleke/embla-carousel/blob/master/CONTRIBUTING.md">Contributions</a> are welcome.
</p>
<p align="center">
<a href="https://github.com/davidjerleke">
<img src="https://avatars2.githubusercontent.com/u/11529148?s=120&v=4" title="davidjerleke" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/Ronit-gurjar">
<img src="https://avatars2.githubusercontent.com/u/92150685?s=120&v=4" title="Ronit-gurjar" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/zaaakher">
<img src="https://avatars2.githubusercontent.com/u/46135573?s=120&v=4" title="zaaakher" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/xiel">
<img src="https://avatars2.githubusercontent.com/u/615522?s=120&v=4" title="xiel" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/javiergonzalezGenially">
<img src="https://avatars2.githubusercontent.com/u/78730098?s=120&v=4" title="javiergonzalezGenially" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/meirroth">
<img src="https://avatars2.githubusercontent.com/u/12494197?s=120&v=4" title="meirroth" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/hamidrezahanafi">
<img src="https://avatars2.githubusercontent.com/u/91487491?s=120&v=4" title="hamidrezahanafi" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/negezor">
<img src="https://avatars2.githubusercontent.com/u/9392723?s=120&v=4" title="negezor" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/th-km">
<img src="https://avatars2.githubusercontent.com/u/35410212?s=120&v=4" title="th-km" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/openscript">
<img src="https://avatars2.githubusercontent.com/u/1105080?s=120&v=4" title="openscript" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/nwidynski">
<img src="https://avatars2.githubusercontent.com/u/25958801?s=120&v=4" title="nwidynski" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/wopian">
<img src="https://avatars2.githubusercontent.com/u/3440094?s=120&v=4" title="wopian" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/horseeyephil">
<img src="https://avatars2.githubusercontent.com/u/32337092?s=120&v=4" title="horseeyephil" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/pipisasa">
<img src="https://avatars2.githubusercontent.com/u/54534600?s=120&v=4" title="pipisasa" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/ranno-lauri">
<img src="https://avatars2.githubusercontent.com/u/87007115?s=120&v=4" title="ranno-lauri" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/ruijdacd">
<img src="https://avatars2.githubusercontent.com/u/9107610?s=120&v=4" title="ruijdacd" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/rojadesign">
<img src="https://avatars2.githubusercontent.com/u/35687281?s=120&v=4" title="rojadesign" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/sadeghbarati">
<img src="https://avatars2.githubusercontent.com/u/17789047?s=120&v=4" title="sadeghbarati" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/S-Shingler">
<img src="https://avatars2.githubusercontent.com/u/48463809?s=120&v=4" title="S-Shingler" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/Yonom">
<img src="https://avatars2.githubusercontent.com/u/1394504?s=120&v=4" title="Yonom" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/smultar">
<img src="https://avatars2.githubusercontent.com/u/6223536?s=120&v=4" title="smultar" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/dev-suraj-kumar">
<img src="https://avatars2.githubusercontent.com/u/184739775?s=120&v=4" title="dev-suraj-kumar" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/Matoseb">
<img src="https://avatars2.githubusercontent.com/u/24431250?s=120&v=4" title="Matoseb" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/tlo-johnson">
<img src="https://avatars2.githubusercontent.com/u/8763144?s=120&v=4" title="tlo-johnson" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/yasuhiro-yamamoto">
<img src="https://avatars2.githubusercontent.com/u/25109330?s=120&v=4" title="yasuhiro-yamamoto" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/anzbert">
<img src="https://avatars2.githubusercontent.com/u/38823700?s=120&v=4" title="anzbert" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/sarussss">
<img src="https://avatars2.githubusercontent.com/u/15656996?s=120&v=4" title="sarussss" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/silllli">
<img src="https://avatars2.githubusercontent.com/u/9334305?s=120&v=4" title="silllli" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/nikrowell">
<img src="https://avatars2.githubusercontent.com/u/260039?s=120&v=4" title="nikrowell" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/mujahidfa">
<img src="https://avatars2.githubusercontent.com/u/17759705?s=120&v=4" title="mujahidfa" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/Mitch-At-Work">
<img src="https://avatars2.githubusercontent.com/u/99835933?s=120&v=4" title="Mitch-At-Work" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/romellem">
<img src="https://avatars2.githubusercontent.com/u/8504000?s=120&v=4" title="romellem" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/junlarsen">
<img src="https://avatars2.githubusercontent.com/u/42585241?s=120&v=4" title="junlarsen" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/LucasMariniFalbo">
<img src="https://avatars2.githubusercontent.com/u/9245477?s=120&v=4" title="LucasMariniFalbo" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/LiamMartens">
<img src="https://avatars2.githubusercontent.com/u/5265324?s=120&v=4" title="LiamMartens" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/S1r-Lanzelot">
<img src="https://avatars2.githubusercontent.com/u/4487160?s=120&v=4" title="S1r-Lanzelot" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/ishaqibrahimbot">
<img src="https://avatars2.githubusercontent.com/u/74908398?s=120&v=4" title="ishaqibrahimbot" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/fcasibu">
<img src="https://avatars2.githubusercontent.com/u/75290989?s=120&v=4" title="fcasibu" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/cundd">
<img src="https://avatars2.githubusercontent.com/u/743122?s=120&v=4" title="cundd" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/sedlukha">
<img src="https://avatars2.githubusercontent.com/u/14075940?s=120&v=4" title="sedlukha" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/allen-garvey">
<img src="https://avatars2.githubusercontent.com/u/9314727?s=120&v=4" title="allen-garvey" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/lesha1201">
<img src="https://avatars2.githubusercontent.com/u/10157660?s=120&v=4" title="lesha1201" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/SaizFerri">
<img src="https://avatars2.githubusercontent.com/u/19834971?s=120&v=4" title="SaizFerri" width="50" height="50" style="max-width: 100%" />
</a>
</p>
</div>
<br>
<div align="center">
<strong>
<h2 align="center">Special Thanks</h2>
</strong>
<p align="center">
<sup>
<a href="https://github.com/gunnarx2">gunnarx2</a> - React wrapper <a href="https://www.embla-carousel.com/get-started/react/">useEmblaCarousel</a>.
</sup>
<br>
<sup>
<a href="https://github.com/LiamMartens">LiamMartens</a> - Solid wrapper <a href="https://www.embla-carousel.com/get-started/solid/">createEmblaCarousel</a>.
</sup>
<br>
<sup>
<a href="https://github.com/donaldxdonald">donaldxdonald</a>, <a href="https://github.com/zip-fa">zip-fa</a>, <a href="https://github.com/JeanMeche">JeanMeche</a> - Angular wrapper <a href="https://github.com/donaldxdonald/embla-carousel-angular?tab=readme-ov-file#installation">EmblaCarouselDirective</a>.
</sup>
<br>
<sup>
<a href="https://github.com/xiel">xiel</a> - Plugin <a href="https://github.com/xiel/embla-carousel-wheel-gestures">Embla Carousel Wheel Gestures</a>.
</sup>
<br>
<sup>
<a href="https://github.com/zaaakher">zaaakher</a> - Contributing <a href="https://github.com/davidjerleke/embla-carousel/blob/master/CONTRIBUTING.md">guidelines</a>.
</sup>
<br>
<sup>
<a href="https://github.com/sarussss">sarussss</a> - Answering questions.
</sup>
</p>
</div>
<br>
<h2 align="center">Open Source</h2>
<p align="center">
Embla is <a href="https://github.com/davidjerleke/embla-carousel/blob/master/LICENSE">MIT licensed</a> 💖.<br><br>
<sup>Embla Carousel - Copyright © 2019-present.</sup><br />
<sup>Package created by David Jerleke.</sup>
</p>
<p align="center">
<strong>· · ·</strong>
</p>
<p align="center">
Thanks <a href="https://www.browserstack.com">BrowserStack</a>.
</p>
<p align="center">
<a href="https://www.browserstack.com">
<img src="https://www.embla-carousel.com/browserstack-logo.svg" width="45" height="45" />
</a>
</p>
+5
View File
@@ -0,0 +1,5 @@
export type AlignmentOptionType = 'start' | 'center' | 'end' | ((viewSize: number, snapSize: number, index: number) => number);
export type AlignmentType = {
measure: (n: number, index: number) => number;
};
export declare function Alignment(align: AlignmentOptionType, viewSize: number): AlignmentType;
+13
View File
@@ -0,0 +1,13 @@
import { EngineType } from './Engine';
import { WindowType } from './utils';
export type AnimationsUpdateType = (engine: EngineType) => void;
export type AnimationsRenderType = (engine: EngineType, alpha: number) => void;
export type AnimationsType = {
init: () => void;
destroy: () => void;
start: () => void;
stop: () => void;
update: () => void;
render: (alpha: number) => void;
};
export declare function Animations(ownerDocument: Document, ownerWindow: WindowType, update: () => void, render: (alpha: number) => void): AnimationsType;
+14
View File
@@ -0,0 +1,14 @@
import { NodeRectType } from './NodeRects';
export type AxisOptionType = 'x' | 'y';
export type AxisDirectionOptionType = 'ltr' | 'rtl';
type AxisEdgeType = 'top' | 'right' | 'bottom' | 'left';
export type AxisType = {
scroll: AxisOptionType;
cross: AxisOptionType;
startEdge: AxisEdgeType;
endEdge: AxisEdgeType;
measureSize: (nodeRect: NodeRectType) => number;
direction: (n: number) => number;
};
export declare function Axis(axis: AxisOptionType, contentDirection: AxisDirectionOptionType): AxisType;
export {};
+7
View File
@@ -0,0 +1,7 @@
export type CounterType = {
get: () => number;
set: (n: number) => CounterType;
add: (n: number) => CounterType;
clone: () => CounterType;
};
export declare function Counter(max: number, start: number, loop: boolean): CounterType;
+21
View File
@@ -0,0 +1,21 @@
import { EmblaCarouselType } from './EmblaCarousel';
import { AnimationsType } from './Animations';
import { CounterType } from './Counter';
import { DragTrackerType, PointerEventType } from './DragTracker';
import { EventHandlerType } from './EventHandler';
import { AxisType } from './Axis';
import { ScrollBodyType } from './ScrollBody';
import { ScrollTargetType } from './ScrollTarget';
import { ScrollToType } from './ScrollTo';
import { Vector1DType } from './Vector1d';
import { PercentOfViewType } from './PercentOfView';
import { WindowType } from './utils';
type DragHandlerCallbackType = (emblaApi: EmblaCarouselType, evt: PointerEventType) => boolean | void;
export type DragHandlerOptionType = boolean | DragHandlerCallbackType;
export type DragHandlerType = {
init: (emblaApi: EmblaCarouselType) => void;
destroy: () => void;
pointerDown: () => boolean;
};
export declare function DragHandler(axis: AxisType, rootNode: HTMLElement, ownerDocument: Document, ownerWindow: WindowType, target: Vector1DType, dragTracker: DragTrackerType, location: Vector1DType, animation: AnimationsType, scrollTo: ScrollToType, scrollBody: ScrollBodyType, scrollTarget: ScrollTargetType, index: CounterType, eventHandler: EventHandlerType, percentOfView: PercentOfViewType, dragFree: boolean, dragThreshold: number, skipSnaps: boolean, baseFriction: number, watchDrag: DragHandlerOptionType): DragHandlerType;
export {};
+10
View File
@@ -0,0 +1,10 @@
import { AxisOptionType, AxisType } from './Axis';
import { WindowType } from './utils';
export type PointerEventType = TouchEvent | MouseEvent;
export type DragTrackerType = {
pointerDown: (evt: PointerEventType) => number;
pointerMove: (evt: PointerEventType) => number;
pointerUp: (evt: PointerEventType) => number;
readPoint: (evt: PointerEventType, evtAxis?: AxisOptionType) => number;
};
export declare function DragTracker(axis: AxisType, ownerWindow: WindowType): DragTrackerType;
+32
View File
@@ -0,0 +1,32 @@
import { EngineType } from './Engine';
import { EventHandlerType } from './EventHandler';
import { EmblaOptionsType } from './Options';
import { EmblaPluginsType, EmblaPluginType } from './Plugins';
export type EmblaCarouselType = {
canScrollNext: () => boolean;
canScrollPrev: () => boolean;
containerNode: () => HTMLElement;
internalEngine: () => EngineType;
destroy: () => void;
off: EventHandlerType['off'];
on: EventHandlerType['on'];
emit: EventHandlerType['emit'];
plugins: () => EmblaPluginsType;
previousScrollSnap: () => number;
reInit: (options?: EmblaOptionsType, plugins?: EmblaPluginType[]) => void;
rootNode: () => HTMLElement;
scrollNext: (jump?: boolean) => void;
scrollPrev: (jump?: boolean) => void;
scrollProgress: () => number;
scrollSnapList: () => number[];
scrollTo: (index: number, jump?: boolean) => void;
selectedScrollSnap: () => number;
slideNodes: () => HTMLElement[];
slidesInView: () => number[];
slidesNotInView: () => number[];
};
declare function EmblaCarousel(root: HTMLElement, userOptions?: EmblaOptionsType, userPlugins?: EmblaPluginType[]): EmblaCarouselType;
declare namespace EmblaCarousel {
let globalOptions: EmblaOptionsType | undefined;
}
export default EmblaCarousel;
+64
View File
@@ -0,0 +1,64 @@
import { AnimationsType } from './Animations';
import { AxisType } from './Axis';
import { CounterType } from './Counter';
import { DragHandlerType } from './DragHandler';
import { EventHandlerType } from './EventHandler';
import { EventStoreType } from './EventStore';
import { LimitType } from './Limit';
import { NodeRectType } from './NodeRects';
import { OptionsType } from './Options';
import { PercentOfViewType } from './PercentOfView';
import { ResizeHandlerType } from './ResizeHandler';
import { ScrollBodyType } from './ScrollBody';
import { ScrollBoundsType } from './ScrollBounds';
import { ScrollLooperType } from './ScrollLooper';
import { ScrollProgressType } from './ScrollProgress';
import { SlideRegistryType } from './SlideRegistry';
import { ScrollTargetType } from './ScrollTarget';
import { ScrollToType } from './ScrollTo';
import { SlideFocusType } from './SlideFocus';
import { SlideLooperType } from './SlideLooper';
import { SlidesHandlerType } from './SlidesHandler';
import { SlidesInViewType } from './SlidesInView';
import { SlidesToScrollType } from './SlidesToScroll';
import { TranslateType } from './Translate';
import { WindowType } from './utils';
import { Vector1DType } from './Vector1d';
export type EngineType = {
ownerDocument: Document;
ownerWindow: WindowType;
eventHandler: EventHandlerType;
axis: AxisType;
animation: AnimationsType;
scrollBounds: ScrollBoundsType;
scrollLooper: ScrollLooperType;
scrollProgress: ScrollProgressType;
index: CounterType;
indexPrevious: CounterType;
limit: LimitType;
location: Vector1DType;
offsetLocation: Vector1DType;
previousLocation: Vector1DType;
options: OptionsType;
percentOfView: PercentOfViewType;
scrollBody: ScrollBodyType;
dragHandler: DragHandlerType;
eventStore: EventStoreType;
slideLooper: SlideLooperType;
slidesInView: SlidesInViewType;
slidesToScroll: SlidesToScrollType;
target: Vector1DType;
translate: TranslateType;
resizeHandler: ResizeHandlerType;
slidesHandler: SlidesHandlerType;
scrollTo: ScrollToType;
scrollTarget: ScrollTargetType;
scrollSnapList: number[];
scrollSnaps: number[];
slideIndexes: number[];
slideFocus: SlideFocusType;
slideRegistry: SlideRegistryType['slideRegistry'];
containerRect: NodeRectType;
slideRects: NodeRectType[];
};
export declare function Engine(root: HTMLElement, container: HTMLElement, slides: HTMLElement[], ownerDocument: Document, ownerWindow: WindowType, options: OptionsType, eventHandler: EventHandlerType): EngineType;
+27
View File
@@ -0,0 +1,27 @@
import { EmblaCarouselType } from './EmblaCarousel';
type CallbackType = (emblaApi: EmblaCarouselType, evt: EmblaEventType) => void;
export type EmblaEventType = EmblaEventListType[keyof EmblaEventListType];
export interface EmblaEventListType {
init: 'init';
pointerDown: 'pointerDown';
pointerUp: 'pointerUp';
slidesChanged: 'slidesChanged';
slidesInView: 'slidesInView';
scroll: 'scroll';
select: 'select';
settle: 'settle';
destroy: 'destroy';
reInit: 'reInit';
resize: 'resize';
slideFocusStart: 'slideFocusStart';
slideFocus: 'slideFocus';
}
export type EventHandlerType = {
init: (emblaApi: EmblaCarouselType) => void;
emit: (evt: EmblaEventType) => EventHandlerType;
on: (evt: EmblaEventType, cb: CallbackType) => EventHandlerType;
off: (evt: EmblaEventType, cb: CallbackType) => EventHandlerType;
clear: () => void;
};
export declare function EventHandler(): EventHandlerType;
export {};
+9
View File
@@ -0,0 +1,9 @@
type EventNameType = keyof DocumentEventMap | keyof WindowEventMap;
type EventHandlerType = (evt: any) => void;
type EventOptionsType = boolean | AddEventListenerOptions | undefined;
export type EventStoreType = {
add: (node: EventTarget, type: EventNameType, handler: EventHandlerType, options?: EventOptionsType) => EventStoreType;
clear: () => void;
};
export declare function EventStore(): EventStoreType;
export {};
+11
View File
@@ -0,0 +1,11 @@
export type LimitType = {
min: number;
max: number;
length: number;
constrain: (n: number) => number;
reachedAny: (n: number) => boolean;
reachedMax: (n: number) => boolean;
reachedMin: (n: number) => boolean;
removeOffset: (n: number) => number;
};
export declare function Limit(min?: number, max?: number): LimitType;
+12
View File
@@ -0,0 +1,12 @@
export type NodeRectType = {
top: number;
right: number;
bottom: number;
left: number;
width: number;
height: number;
};
export type NodeRectsType = {
measure: (node: HTMLElement) => NodeRectType;
};
export declare function NodeRects(): NodeRectsType;
+40
View File
@@ -0,0 +1,40 @@
import { AlignmentOptionType } from './Alignment';
import { AxisDirectionOptionType, AxisOptionType } from './Axis';
import { SlidesToScrollOptionType } from './SlidesToScroll';
import { ScrollContainOptionType } from './ScrollContain';
import { DragHandlerOptionType } from './DragHandler';
import { ResizeHandlerOptionType } from './ResizeHandler';
import { SlidesHandlerOptionType } from './SlidesHandler';
import { SlidesInViewOptionsType } from './SlidesInView';
import { FocusHandlerOptionType } from './SlideFocus';
export type LooseOptionsType = {
[key: string]: unknown;
};
export type CreateOptionsType<Type extends LooseOptionsType> = Type & {
active: boolean;
breakpoints: {
[key: string]: Omit<Partial<CreateOptionsType<Type>>, 'breakpoints'>;
};
};
export type OptionsType = CreateOptionsType<{
align: AlignmentOptionType;
axis: AxisOptionType;
container: string | HTMLElement | null;
slides: string | HTMLElement[] | NodeListOf<HTMLElement> | null;
containScroll: ScrollContainOptionType;
direction: AxisDirectionOptionType;
slidesToScroll: SlidesToScrollOptionType;
dragFree: boolean;
dragThreshold: number;
inViewThreshold: SlidesInViewOptionsType;
loop: boolean;
skipSnaps: boolean;
duration: number;
startIndex: number;
watchDrag: DragHandlerOptionType;
watchResize: ResizeHandlerOptionType;
watchSlides: SlidesHandlerOptionType;
watchFocus: FocusHandlerOptionType;
}>;
export declare const defaultOptions: OptionsType;
export type EmblaOptionsType = Partial<OptionsType>;
+10
View File
@@ -0,0 +1,10 @@
import { LooseOptionsType, CreateOptionsType } from './Options';
import { WindowType } from './utils';
type OptionsType = Partial<CreateOptionsType<LooseOptionsType>>;
export type OptionsHandlerType = {
mergeOptions: <TypeA extends OptionsType, TypeB extends OptionsType>(optionsA: TypeA, optionsB?: TypeB) => TypeA;
optionsAtMedia: <Type extends OptionsType>(options: Type) => Type;
optionsMediaQueries: (optionsList: OptionsType[]) => MediaQueryList[];
};
export declare function OptionsHandler(ownerWindow: WindowType): OptionsHandlerType;
export {};
+4
View File
@@ -0,0 +1,4 @@
export type PercentOfViewType = {
measure: (n: number) => number;
};
export declare function PercentOfView(viewSize: number): PercentOfViewType;
+16
View File
@@ -0,0 +1,16 @@
import { CreateOptionsType, LooseOptionsType } from './Options';
import { EmblaCarouselType } from './EmblaCarousel';
import { OptionsHandlerType } from './OptionsHandler';
export type LoosePluginType = {
[key: string]: unknown;
};
export type CreatePluginType<TypeA extends LoosePluginType, TypeB extends LooseOptionsType> = TypeA & {
name: string;
options: Partial<CreateOptionsType<TypeB>>;
init: (embla: EmblaCarouselType, OptionsHandler: OptionsHandlerType) => void;
destroy: () => void;
};
export interface EmblaPluginsType {
[key: string]: CreatePluginType<LoosePluginType, {}>;
}
export type EmblaPluginType = EmblaPluginsType[keyof EmblaPluginsType];
+8
View File
@@ -0,0 +1,8 @@
import { EmblaCarouselType } from './EmblaCarousel';
import { OptionsHandlerType } from './OptionsHandler';
import { EmblaPluginsType, EmblaPluginType } from './Plugins';
export type PluginsHandlerType = {
init: (emblaApi: EmblaCarouselType, plugins: EmblaPluginType[]) => EmblaPluginsType;
destroy: () => void;
};
export declare function PluginsHandler(optionsHandler: OptionsHandlerType): PluginsHandlerType;
+13
View File
@@ -0,0 +1,13 @@
import { AxisType } from './Axis';
import { EmblaCarouselType } from './EmblaCarousel';
import { EventHandlerType } from './EventHandler';
import { NodeRectsType } from './NodeRects';
import { WindowType } from './utils';
type ResizeHandlerCallbackType = (emblaApi: EmblaCarouselType, entries: ResizeObserverEntry[]) => boolean | void;
export type ResizeHandlerOptionType = boolean | ResizeHandlerCallbackType;
export type ResizeHandlerType = {
init: (emblaApi: EmblaCarouselType) => void;
destroy: () => void;
};
export declare function ResizeHandler(container: HTMLElement, eventHandler: EventHandlerType, ownerWindow: WindowType, slides: HTMLElement[], axis: AxisType, watchResize: ResizeHandlerOptionType, nodeRects: NodeRectsType): ResizeHandlerType;
export {};
+13
View File
@@ -0,0 +1,13 @@
import { Vector1DType } from './Vector1d';
export type ScrollBodyType = {
direction: () => number;
duration: () => number;
velocity: () => number;
seek: () => ScrollBodyType;
settled: () => boolean;
useBaseFriction: () => ScrollBodyType;
useBaseDuration: () => ScrollBodyType;
useFriction: (n: number) => ScrollBodyType;
useDuration: (n: number) => ScrollBodyType;
};
export declare function ScrollBody(location: Vector1DType, offsetLocation: Vector1DType, previousLocation: Vector1DType, target: Vector1DType, baseDuration: number, baseFriction: number): ScrollBodyType;
+10
View File
@@ -0,0 +1,10 @@
import { LimitType } from './Limit';
import { ScrollBodyType } from './ScrollBody';
import { Vector1DType } from './Vector1d';
import { PercentOfViewType } from './PercentOfView';
export type ScrollBoundsType = {
shouldConstrain: () => boolean;
constrain: (pointerDown: boolean) => void;
toggleActive: (active: boolean) => void;
};
export declare function ScrollBounds(limit: LimitType, location: Vector1DType, target: Vector1DType, scrollBody: ScrollBodyType, percentOfView: PercentOfViewType): ScrollBoundsType;
+7
View File
@@ -0,0 +1,7 @@
import { LimitType } from './Limit';
export type ScrollContainOptionType = false | 'trimSnaps' | 'keepSnaps';
export type ScrollContainType = {
snapsContained: number[];
scrollContainLimit: LimitType;
};
export declare function ScrollContain(viewSize: number, contentSize: number, snapsAligned: number[], containScroll: ScrollContainOptionType, pixelTolerance: number): ScrollContainType;
+5
View File
@@ -0,0 +1,5 @@
import { LimitType } from './Limit';
export type ScrollLimitType = {
limit: LimitType;
};
export declare function ScrollLimit(contentSize: number, scrollSnaps: number[], loop: boolean): ScrollLimitType;
+6
View File
@@ -0,0 +1,6 @@
import { LimitType } from './Limit';
import { Vector1DType } from './Vector1d';
export type ScrollLooperType = {
loop: (direction: number) => void;
};
export declare function ScrollLooper(contentSize: number, limit: LimitType, location: Vector1DType, vectors: Vector1DType[]): ScrollLooperType;
+5
View File
@@ -0,0 +1,5 @@
import { LimitType } from './Limit';
export type ScrollProgressType = {
get: (n: number) => number;
};
export declare function ScrollProgress(limit: LimitType): ScrollProgressType;
+9
View File
@@ -0,0 +1,9 @@
import { AlignmentType } from './Alignment';
import { AxisType } from './Axis';
import { NodeRectType } from './NodeRects';
import { SlidesToScrollType } from './SlidesToScroll';
export type ScrollSnapsType = {
snaps: number[];
snapsAligned: number[];
};
export declare function ScrollSnaps(axis: AxisType, alignment: AlignmentType, containerRect: NodeRectType, slideRects: NodeRectType[], slidesToScroll: SlidesToScrollType): ScrollSnapsType;
+12
View File
@@ -0,0 +1,12 @@
import { LimitType } from './Limit';
import { Vector1DType } from './Vector1d';
export type TargetType = {
distance: number;
index: number;
};
export type ScrollTargetType = {
byIndex: (target: number, direction: number) => TargetType;
byDistance: (force: number, snap: boolean) => TargetType;
shortcut: (target: number, direction: number) => number;
};
export declare function ScrollTarget(loop: boolean, scrollSnaps: number[], contentSize: number, limit: LimitType, targetVector: Vector1DType): ScrollTargetType;
+11
View File
@@ -0,0 +1,11 @@
import { AnimationsType } from './Animations';
import { CounterType } from './Counter';
import { EventHandlerType } from './EventHandler';
import { ScrollBodyType } from './ScrollBody';
import { ScrollTargetType } from './ScrollTarget';
import { Vector1DType } from './Vector1d';
export type ScrollToType = {
distance: (n: number, snap: boolean) => void;
index: (n: number, direction: number) => void;
};
export declare function ScrollTo(animation: AnimationsType, indexCurrent: CounterType, indexPrevious: CounterType, scrollBody: ScrollBodyType, scrollTarget: ScrollTargetType, targetVector: Vector1DType, eventHandler: EventHandlerType): ScrollToType;
+13
View File
@@ -0,0 +1,13 @@
import { EmblaCarouselType } from './EmblaCarousel';
import { EventHandlerType } from './EventHandler';
import { EventStoreType } from './EventStore';
import { ScrollBodyType } from './ScrollBody';
import { ScrollToType } from './ScrollTo';
import { SlideRegistryType } from './SlideRegistry';
type FocusHandlerCallbackType = (emblaApi: EmblaCarouselType, evt: FocusEvent) => boolean | void;
export type FocusHandlerOptionType = boolean | FocusHandlerCallbackType;
export type SlideFocusType = {
init: (emblaApi: EmblaCarouselType) => void;
};
export declare function SlideFocus(root: HTMLElement, slides: HTMLElement[], slideRegistry: SlideRegistryType['slideRegistry'], scrollTo: ScrollToType, scrollBody: ScrollBodyType, eventStore: EventStoreType, eventHandler: EventHandlerType, watchFocus: FocusHandlerOptionType): SlideFocusType;
export {};
+18
View File
@@ -0,0 +1,18 @@
import { AxisType } from './Axis';
import { Vector1DType } from './Vector1d';
import { TranslateType } from './Translate';
type LoopPointType = {
loopPoint: number;
index: number;
translate: TranslateType;
slideLocation: Vector1DType;
target: () => number;
};
export type SlideLooperType = {
canLoop: () => boolean;
clear: () => void;
loop: () => void;
loopPoints: LoopPointType[];
};
export declare function SlideLooper(axis: AxisType, viewSize: number, contentSize: number, slideSizes: number[], slideSizesWithGaps: number[], snaps: number[], scrollSnaps: number[], location: Vector1DType, slides: HTMLElement[]): SlideLooperType;
export {};
+7
View File
@@ -0,0 +1,7 @@
import { LimitType } from './Limit';
import { ScrollContainOptionType } from './ScrollContain';
import { SlidesToScrollType } from './SlidesToScroll';
export type SlideRegistryType = {
slideRegistry: number[][];
};
export declare function SlideRegistry(containSnaps: boolean, containScroll: ScrollContainOptionType, scrollSnaps: number[], scrollContainLimit: LimitType, slidesToScroll: SlidesToScrollType, slideIndexes: number[]): SlideRegistryType;
+10
View File
@@ -0,0 +1,10 @@
import { AxisType } from './Axis';
import { NodeRectType } from './NodeRects';
import { WindowType } from './utils';
export type SlideSizesType = {
slideSizes: number[];
slideSizesWithGaps: number[];
startGap: number;
endGap: number;
};
export declare function SlideSizes(axis: AxisType, containerRect: NodeRectType, slideRects: NodeRectType[], slides: HTMLElement[], readEdgeGap: boolean, ownerWindow: WindowType): SlideSizesType;
+10
View File
@@ -0,0 +1,10 @@
import { EmblaCarouselType } from './EmblaCarousel';
import { EventHandlerType } from './EventHandler';
type SlidesHandlerCallbackType = (emblaApi: EmblaCarouselType, mutations: MutationRecord[]) => boolean | void;
export type SlidesHandlerOptionType = boolean | SlidesHandlerCallbackType;
export type SlidesHandlerType = {
init: (emblaApi: EmblaCarouselType) => void;
destroy: () => void;
};
export declare function SlidesHandler(container: HTMLElement, eventHandler: EventHandlerType, watchSlides: SlidesHandlerOptionType): SlidesHandlerType;
export {};
+8
View File
@@ -0,0 +1,8 @@
import { EventHandlerType } from './EventHandler';
export type SlidesInViewOptionsType = IntersectionObserverInit['threshold'];
export type SlidesInViewType = {
init: () => void;
destroy: () => void;
get: (inView?: boolean) => number[];
};
export declare function SlidesInView(container: HTMLElement, slides: HTMLElement[], eventHandler: EventHandlerType, threshold: SlidesInViewOptionsType): SlidesInViewType;
+7
View File
@@ -0,0 +1,7 @@
import { AxisType } from './Axis';
import { NodeRectType } from './NodeRects';
export type SlidesToScrollOptionType = 'auto' | number;
export type SlidesToScrollType = {
groupSlides: <Type>(array: Type[]) => Type[][];
};
export declare function SlidesToScroll(axis: AxisType, viewSize: number, slidesToScroll: SlidesToScrollOptionType, loop: boolean, containerRect: NodeRectType, slideRects: NodeRectType[], startGap: number, endGap: number, pixelTolerance: number): SlidesToScrollType;
+7
View File
@@ -0,0 +1,7 @@
import { AxisType } from './Axis';
export type TranslateType = {
clear: () => void;
to: (target: number) => void;
toggleActive: (active: boolean) => void;
};
export declare function Translate(axis: AxisType, container: HTMLElement): TranslateType;
+7
View File
@@ -0,0 +1,7 @@
export type Vector1DType = {
get: () => number;
set: (n: Vector1DType | number) => void;
add: (n: Vector1DType | number) => void;
subtract: (n: Vector1DType | number) => void;
};
export declare function Vector1D(initialValue: number): Vector1DType;
+19
View File
@@ -0,0 +1,19 @@
import { PointerEventType } from './DragTracker';
export type WindowType = Window & typeof globalThis;
export declare function isNumber(subject: unknown): subject is number;
export declare function isString(subject: unknown): subject is string;
export declare function isBoolean(subject: unknown): subject is boolean;
export declare function isObject(subject: unknown): subject is Record<string, unknown>;
export declare function mathAbs(n: number): number;
export declare function mathSign(n: number): number;
export declare function deltaAbs(valueB: number, valueA: number): number;
export declare function factorAbs(valueB: number, valueA: number): number;
export declare function roundToTwoDecimals(num: number): number;
export declare function arrayKeys<Type>(array: Type[]): number[];
export declare function arrayLast<Type>(array: Type[]): Type;
export declare function arrayLastIndex<Type>(array: Type[]): number;
export declare function arrayIsLastIndex<Type>(array: Type[], index: number): boolean;
export declare function arrayFromNumber(n: number, startAt?: number): number[];
export declare function objectKeys<Type extends object>(object: Type): string[];
export declare function objectsMergeDeep(objectA: Record<string, unknown>, objectB: Record<string, unknown>): Record<string, unknown>;
export declare function isMouseEvent(evt: PointerEventType, ownerWindow: WindowType): evt is MouseEvent;
File diff suppressed because it is too large. Load diff
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"embla-carousel.cjs.js","sources":["../src/components/utils.ts","../src/components/Alignment.ts","../src/components/EventStore.ts","../src/components/Animations.ts","../src/components/Axis.ts","../src/components/Limit.ts","../src/components/Counter.ts","../src/components/DragHandler.ts","../src/components/DragTracker.ts","../src/components/NodeRects.ts","../src/components/PercentOfView.ts","../src/components/ResizeHandler.ts","../src/components/ScrollBody.ts","../src/components/ScrollBounds.ts","../src/components/ScrollContain.ts","../src/components/ScrollLimit.ts","../src/components/ScrollLooper.ts","../src/components/ScrollProgress.ts","../src/components/ScrollSnaps.ts","../src/components/SlideRegistry.ts","../src/components/ScrollTarget.ts","../src/components/ScrollTo.ts","../src/components/SlideFocus.ts","../src/components/Vector1d.ts","../src/components/Translate.ts","../src/components/SlideLooper.ts","../src/components/SlidesHandler.ts","../src/components/SlidesInView.ts","../src/components/SlideSizes.ts","../src/components/SlidesToScroll.ts","../src/components/Engine.ts","../src/components/EventHandler.ts","../src/components/Options.ts","../src/components/OptionsHandler.ts","../src/components/PluginsHandler.ts","../src/components/EmblaCarousel.ts"],"sourcesContent":["import { PointerEventType } from './DragTracker'\n\nexport type WindowType = Window & typeof globalThis\n\nexport function isNumber(subject: unknown): subject is number {\n return typeof subject === 'number'\n}\n\nexport function isString(subject: unknown): subject is string {\n return typeof subject === 'string'\n}\n\nexport function isBoolean(subject: unknown): subject is boolean {\n return typeof subject === 'boolean'\n}\n\nexport function isObject(subject: unknown): subject is Record<string, unknown> {\n return Object.prototype.toString.call(subject) === '[object Object]'\n}\n\nexport function mathAbs(n: number): number {\n return Math.abs(n)\n}\n\nexport function mathSign(n: number): number {\n return Math.sign(n)\n}\n\nexport function deltaAbs(valueB: number, valueA: number): number {\n return mathAbs(valueB - valueA)\n}\n\nexport function factorAbs(valueB: number, valueA: number): number {\n if (valueB === 0 || valueA === 0) return 0\n if (mathAbs(valueB) <= mathAbs(valueA)) return 0\n const diff = deltaAbs(mathAbs(valueB), mathAbs(valueA))\n return mathAbs(diff / valueB)\n}\n\nexport function roundToTwoDecimals(num: number): number {\n return Math.round(num * 100) / 100\n}\n\nexport function arrayKeys<Type>(array: Type[]): number[] {\n return objectKeys(array).map(Number)\n}\n\nexport function arrayLast<Type>(array: Type[]): Type {\n return array[arrayLastIndex(array)]\n}\n\nexport function arrayLastIndex<Type>(array: Type[]): number {\n return Math.max(0, array.length - 1)\n}\n\nexport function arrayIsLastIndex<Type>(array: Type[], index: number): boolean {\n return index === arrayLastIndex(array)\n}\n\nexport function arrayFromNumber(n: number, startAt: number = 0): number[] {\n return Array.from(Array(n), (_, i) => startAt + i)\n}\n\nexport function objectKeys<Type extends object>(object: Type): string[] {\n return Object.keys(object)\n}\n\nexport function objectsMergeDeep(\n objectA: Record<string, unknown>,\n objectB: Record<string, unknown>\n): Record<string, unknown> {\n return [objectA, objectB].reduce((mergedObjects, currentObject) => {\n objectKeys(currentObject).forEach((key) => {\n const valueA = mergedObjects[key]\n const valueB = currentObject[key]\n const areObjects = isObject(valueA) && isObject(valueB)\n\n mergedObjects[key] = areObjects\n ? objectsMergeDeep(valueA, valueB)\n : valueB\n })\n return mergedObjects\n }, {})\n}\n\nexport function isMouseEvent(\n evt: PointerEventType,\n ownerWindow: WindowType\n): evt is MouseEvent {\n return (\n typeof ownerWindow.MouseEvent !== 'undefined' &&\n evt instanceof ownerWindow.MouseEvent\n )\n}\n","import { isString } from './utils'\n\nexport type AlignmentOptionType =\n | 'start'\n | 'center'\n | 'end'\n | ((viewSize: number, snapSize: number, index: number) => number)\n\nexport type AlignmentType = {\n measure: (n: number, index: number) => number\n}\n\nexport function Alignment(\n align: AlignmentOptionType,\n viewSize: number\n): AlignmentType {\n const predefined = { start, center, end }\n\n function start(): number {\n return 0\n }\n\n function center(n: number): number {\n return end(n) / 2\n }\n\n function end(n: number): number {\n return viewSize - n\n }\n\n function measure(n: number, index: number): number {\n if (isString(align)) return predefined[align](n)\n return align(viewSize, n, index)\n }\n\n const self: AlignmentType = {\n measure\n }\n return self\n}\n","type EventNameType = keyof DocumentEventMap | keyof WindowEventMap\ntype EventHandlerType = (evt: any) => void\ntype EventOptionsType = boolean | AddEventListenerOptioLine truncated
+11
View File
@@ -0,0 +1,11 @@
export { EmblaOptionsType } from './components/Options';
export { EmblaEventType } from './components/EventHandler';
export { EmblaPluginType } from './components/Plugins';
export { EmblaCarouselType } from './components/EmblaCarousel';
export { default } from './components/EmblaCarousel';
export { CreatePluginType, EmblaPluginsType } from './components/Plugins';
export { CreateOptionsType } from './components/Options';
export { OptionsHandlerType } from './components/OptionsHandler';
export { EmblaEventListType } from './components/EventHandler';
export { EngineType } from './components/Engine';
export { ScrollBodyType } from './components/ScrollBody';
+52
View File
@@ -0,0 +1,52 @@
{
"name": "embla-carousel",
"version": "8.6.0",
"author": "David Jerleke",
"description": "A lightweight carousel library with fluid motion and great swipe precision",
"repository": {
"type": "git",
"url": "git+https://github.com/davidjerleke/embla-carousel"
},
"bugs": {
"url": "https://github.com/davidjerleke/embla-carousel/issues"
},
"homepage": "https://www.embla-carousel.com",
"license": "MIT",
"keywords": [
"slider",
"carousel",
"slideshow",
"gallery",
"lightweight",
"touch",
"javascript",
"typescript",
"react",
"vue",
"svelte",
"solid"
],
"types": "index.d.ts",
"sideEffects": false,
"files": [
"embla-carousel*",
"components/**/*",
"index.d.ts"
],
"devDependencies": {
"@types/jest": "^29.5.6",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "2.8.8",
"rollup": "^4.22.4",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"main": "embla-carousel.cjs.js",
"type": "commonjs"
}
+5
View File
@@ -0,0 +1,5 @@
export type AlignmentOptionType = 'start' | 'center' | 'end' | ((viewSize: number, snapSize: number, index: number) => number);
export type AlignmentType = {
measure: (n: number, index: number) => number;
};
export declare function Alignment(align: AlignmentOptionType, viewSize: number): AlignmentType;
+13
View File
@@ -0,0 +1,13 @@
import { EngineType } from './Engine';
import { WindowType } from './utils';
export type AnimationsUpdateType = (engine: EngineType) => void;
export type AnimationsRenderType = (engine: EngineType, alpha: number) => void;
export type AnimationsType = {
init: () => void;
destroy: () => void;
start: () => void;
stop: () => void;
update: () => void;
render: (alpha: number) => void;
};
export declare function Animations(ownerDocument: Document, ownerWindow: WindowType, update: () => void, render: (alpha: number) => void): AnimationsType;
+14
View File
@@ -0,0 +1,14 @@
import { NodeRectType } from './NodeRects';
export type AxisOptionType = 'x' | 'y';
export type AxisDirectionOptionType = 'ltr' | 'rtl';
type AxisEdgeType = 'top' | 'right' | 'bottom' | 'left';
export type AxisType = {
scroll: AxisOptionType;
cross: AxisOptionType;
startEdge: AxisEdgeType;
endEdge: AxisEdgeType;
measureSize: (nodeRect: NodeRectType) => number;
direction: (n: number) => number;
};
export declare function Axis(axis: AxisOptionType, contentDirection: AxisDirectionOptionType): AxisType;
export {};
+7
View File
@@ -0,0 +1,7 @@
export type CounterType = {
get: () => number;
set: (n: number) => CounterType;
add: (n: number) => CounterType;
clone: () => CounterType;
};
export declare function Counter(max: number, start: number, loop: boolean): CounterType;
+21
View File
@@ -0,0 +1,21 @@
import { EmblaCarouselType } from './EmblaCarousel';
import { AnimationsType } from './Animations';
import { CounterType } from './Counter';
import { DragTrackerType, PointerEventType } from './DragTracker';
import { EventHandlerType } from './EventHandler';
import { AxisType } from './Axis';
import { ScrollBodyType } from './ScrollBody';
import { ScrollTargetType } from './ScrollTarget';
import { ScrollToType } from './ScrollTo';
import { Vector1DType } from './Vector1d';
import { PercentOfViewType } from './PercentOfView';
import { WindowType } from './utils';
type DragHandlerCallbackType = (emblaApi: EmblaCarouselType, evt: PointerEventType) => boolean | void;
export type DragHandlerOptionType = boolean | DragHandlerCallbackType;
export type DragHandlerType = {
init: (emblaApi: EmblaCarouselType) => void;
destroy: () => void;
pointerDown: () => boolean;
};
export declare function DragHandler(axis: AxisType, rootNode: HTMLElement, ownerDocument: Document, ownerWindow: WindowType, target: Vector1DType, dragTracker: DragTrackerType, location: Vector1DType, animation: AnimationsType, scrollTo: ScrollToType, scrollBody: ScrollBodyType, scrollTarget: ScrollTargetType, index: CounterType, eventHandler: EventHandlerType, percentOfView: PercentOfViewType, dragFree: boolean, dragThreshold: number, skipSnaps: boolean, baseFriction: number, watchDrag: DragHandlerOptionType): DragHandlerType;
export {};
+10
View File
@@ -0,0 +1,10 @@
import { AxisOptionType, AxisType } from './Axis';
import { WindowType } from './utils';
export type PointerEventType = TouchEvent | MouseEvent;
export type DragTrackerType = {
pointerDown: (evt: PointerEventType) => number;
pointerMove: (evt: PointerEventType) => number;
pointerUp: (evt: PointerEventType) => number;
readPoint: (evt: PointerEventType, evtAxis?: AxisOptionType) => number;
};
export declare function DragTracker(axis: AxisType, ownerWindow: WindowType): DragTrackerType;
+32
View File
@@ -0,0 +1,32 @@
import { EngineType } from './Engine';
import { EventHandlerType } from './EventHandler';
import { EmblaOptionsType } from './Options';
import { EmblaPluginsType, EmblaPluginType } from './Plugins';
export type EmblaCarouselType = {
canScrollNext: () => boolean;
canScrollPrev: () => boolean;
containerNode: () => HTMLElement;
internalEngine: () => EngineType;
destroy: () => void;
off: EventHandlerType['off'];
on: EventHandlerType['on'];
emit: EventHandlerType['emit'];
plugins: () => EmblaPluginsType;
previousScrollSnap: () => number;
reInit: (options?: EmblaOptionsType, plugins?: EmblaPluginType[]) => void;
rootNode: () => HTMLElement;
scrollNext: (jump?: boolean) => void;
scrollPrev: (jump?: boolean) => void;
scrollProgress: () => number;
scrollSnapList: () => number[];
scrollTo: (index: number, jump?: boolean) => void;
selectedScrollSnap: () => number;
slideNodes: () => HTMLElement[];
slidesInView: () => number[];
slidesNotInView: () => number[];
};
declare function EmblaCarousel(root: HTMLElement, userOptions?: EmblaOptionsType, userPlugins?: EmblaPluginType[]): EmblaCarouselType;
declare namespace EmblaCarousel {
let globalOptions: EmblaOptionsType | undefined;
}
export default EmblaCarousel;
+64
View File
@@ -0,0 +1,64 @@
import { AnimationsType } from './Animations';
import { AxisType } from './Axis';
import { CounterType } from './Counter';
import { DragHandlerType } from './DragHandler';
import { EventHandlerType } from './EventHandler';
import { EventStoreType } from './EventStore';
import { LimitType } from './Limit';
import { NodeRectType } from './NodeRects';
import { OptionsType } from './Options';
import { PercentOfViewType } from './PercentOfView';
import { ResizeHandlerType } from './ResizeHandler';
import { ScrollBodyType } from './ScrollBody';
import { ScrollBoundsType } from './ScrollBounds';
import { ScrollLooperType } from './ScrollLooper';
import { ScrollProgressType } from './ScrollProgress';
import { SlideRegistryType } from './SlideRegistry';
import { ScrollTargetType } from './ScrollTarget';
import { ScrollToType } from './ScrollTo';
import { SlideFocusType } from './SlideFocus';
import { SlideLooperType } from './SlideLooper';
import { SlidesHandlerType } from './SlidesHandler';
import { SlidesInViewType } from './SlidesInView';
import { SlidesToScrollType } from './SlidesToScroll';
import { TranslateType } from './Translate';
import { WindowType } from './utils';
import { Vector1DType } from './Vector1d';
export type EngineType = {
ownerDocument: Document;
ownerWindow: WindowType;
eventHandler: EventHandlerType;
axis: AxisType;
animation: AnimationsType;
scrollBounds: ScrollBoundsType;
scrollLooper: ScrollLooperType;
scrollProgress: ScrollProgressType;
index: CounterType;
indexPrevious: CounterType;
limit: LimitType;
location: Vector1DType;
offsetLocation: Vector1DType;
previousLocation: Vector1DType;
options: OptionsType;
percentOfView: PercentOfViewType;
scrollBody: ScrollBodyType;
dragHandler: DragHandlerType;
eventStore: EventStoreType;
slideLooper: SlideLooperType;
slidesInView: SlidesInViewType;
slidesToScroll: SlidesToScrollType;
target: Vector1DType;
translate: TranslateType;
resizeHandler: ResizeHandlerType;
slidesHandler: SlidesHandlerType;
scrollTo: ScrollToType;
scrollTarget: ScrollTargetType;
scrollSnapList: number[];
scrollSnaps: number[];
slideIndexes: number[];
slideFocus: SlideFocusType;
slideRegistry: SlideRegistryType['slideRegistry'];
containerRect: NodeRectType;
slideRects: NodeRectType[];
};
export declare function Engine(root: HTMLElement, container: HTMLElement, slides: HTMLElement[], ownerDocument: Document, ownerWindow: WindowType, options: OptionsType, eventHandler: EventHandlerType): EngineType;
+27
View File
@@ -0,0 +1,27 @@
import { EmblaCarouselType } from './EmblaCarousel';
type CallbackType = (emblaApi: EmblaCarouselType, evt: EmblaEventType) => void;
export type EmblaEventType = EmblaEventListType[keyof EmblaEventListType];
export interface EmblaEventListType {
init: 'init';
pointerDown: 'pointerDown';
pointerUp: 'pointerUp';
slidesChanged: 'slidesChanged';
slidesInView: 'slidesInView';
scroll: 'scroll';
select: 'select';
settle: 'settle';
destroy: 'destroy';
reInit: 'reInit';
resize: 'resize';
slideFocusStart: 'slideFocusStart';
slideFocus: 'slideFocus';
}
export type EventHandlerType = {
init: (emblaApi: EmblaCarouselType) => void;
emit: (evt: EmblaEventType) => EventHandlerType;
on: (evt: EmblaEventType, cb: CallbackType) => EventHandlerType;
off: (evt: EmblaEventType, cb: CallbackType) => EventHandlerType;
clear: () => void;
};
export declare function EventHandler(): EventHandlerType;
export {};
+9
View File
@@ -0,0 +1,9 @@
type EventNameType = keyof DocumentEventMap | keyof WindowEventMap;
type EventHandlerType = (evt: any) => void;
type EventOptionsType = boolean | AddEventListenerOptions | undefined;
export type EventStoreType = {
add: (node: EventTarget, type: EventNameType, handler: EventHandlerType, options?: EventOptionsType) => EventStoreType;
clear: () => void;
};
export declare function EventStore(): EventStoreType;
export {};
+11
View File
@@ -0,0 +1,11 @@
export type LimitType = {
min: number;
max: number;
length: number;
constrain: (n: number) => number;
reachedAny: (n: number) => boolean;
reachedMax: (n: number) => boolean;
reachedMin: (n: number) => boolean;
removeOffset: (n: number) => number;
};
export declare function Limit(min?: number, max?: number): LimitType;
+12
View File
@@ -0,0 +1,12 @@
export type NodeRectType = {
top: number;
right: number;
bottom: number;
left: number;
width: number;
height: number;
};
export type NodeRectsType = {
measure: (node: HTMLElement) => NodeRectType;
};
export declare function NodeRects(): NodeRectsType;
+40
View File
@@ -0,0 +1,40 @@
import { AlignmentOptionType } from './Alignment';
import { AxisDirectionOptionType, AxisOptionType } from './Axis';
import { SlidesToScrollOptionType } from './SlidesToScroll';
import { ScrollContainOptionType } from './ScrollContain';
import { DragHandlerOptionType } from './DragHandler';
import { ResizeHandlerOptionType } from './ResizeHandler';
import { SlidesHandlerOptionType } from './SlidesHandler';
import { SlidesInViewOptionsType } from './SlidesInView';
import { FocusHandlerOptionType } from './SlideFocus';
export type LooseOptionsType = {
[key: string]: unknown;
};
export type CreateOptionsType<Type extends LooseOptionsType> = Type & {
active: boolean;
breakpoints: {
[key: string]: Omit<Partial<CreateOptionsType<Type>>, 'breakpoints'>;
};
};
export type OptionsType = CreateOptionsType<{
align: AlignmentOptionType;
axis: AxisOptionType;
container: string | HTMLElement | null;
slides: string | HTMLElement[] | NodeListOf<HTMLElement> | null;
containScroll: ScrollContainOptionType;
direction: AxisDirectionOptionType;
slidesToScroll: SlidesToScrollOptionType;
dragFree: boolean;
dragThreshold: number;
inViewThreshold: SlidesInViewOptionsType;
loop: boolean;
skipSnaps: boolean;
duration: number;
startIndex: number;
watchDrag: DragHandlerOptionType;
watchResize: ResizeHandlerOptionType;
watchSlides: SlidesHandlerOptionType;
watchFocus: FocusHandlerOptionType;
}>;
export declare const defaultOptions: OptionsType;
export type EmblaOptionsType = Partial<OptionsType>;
+10
View File
@@ -0,0 +1,10 @@
import { LooseOptionsType, CreateOptionsType } from './Options';
import { WindowType } from './utils';
type OptionsType = Partial<CreateOptionsType<LooseOptionsType>>;
export type OptionsHandlerType = {
mergeOptions: <TypeA extends OptionsType, TypeB extends OptionsType>(optionsA: TypeA, optionsB?: TypeB) => TypeA;
optionsAtMedia: <Type extends OptionsType>(options: Type) => Type;
optionsMediaQueries: (optionsList: OptionsType[]) => MediaQueryList[];
};
export declare function OptionsHandler(ownerWindow: WindowType): OptionsHandlerType;
export {};
+4
View File
@@ -0,0 +1,4 @@
export type PercentOfViewType = {
measure: (n: number) => number;
};
export declare function PercentOfView(viewSize: number): PercentOfViewType;
+16
View File
@@ -0,0 +1,16 @@
import { CreateOptionsType, LooseOptionsType } from './Options';
import { EmblaCarouselType } from './EmblaCarousel';
import { OptionsHandlerType } from './OptionsHandler';
export type LoosePluginType = {
[key: string]: unknown;
};
export type CreatePluginType<TypeA extends LoosePluginType, TypeB extends LooseOptionsType> = TypeA & {
name: string;
options: Partial<CreateOptionsType<TypeB>>;
init: (embla: EmblaCarouselType, OptionsHandler: OptionsHandlerType) => void;
destroy: () => void;
};
export interface EmblaPluginsType {
[key: string]: CreatePluginType<LoosePluginType, {}>;
}
export type EmblaPluginType = EmblaPluginsType[keyof EmblaPluginsType];
+8
View File
@@ -0,0 +1,8 @@
import { EmblaCarouselType } from './EmblaCarousel';
import { OptionsHandlerType } from './OptionsHandler';
import { EmblaPluginsType, EmblaPluginType } from './Plugins';
export type PluginsHandlerType = {
init: (emblaApi: EmblaCarouselType, plugins: EmblaPluginType[]) => EmblaPluginsType;
destroy: () => void;
};
export declare function PluginsHandler(optionsHandler: OptionsHandlerType): PluginsHandlerType;
+13
View File
@@ -0,0 +1,13 @@
import { AxisType } from './Axis';
import { EmblaCarouselType } from './EmblaCarousel';
import { EventHandlerType } from './EventHandler';
import { NodeRectsType } from './NodeRects';
import { WindowType } from './utils';
type ResizeHandlerCallbackType = (emblaApi: EmblaCarouselType, entries: ResizeObserverEntry[]) => boolean | void;
export type ResizeHandlerOptionType = boolean | ResizeHandlerCallbackType;
export type ResizeHandlerType = {
init: (emblaApi: EmblaCarouselType) => void;
destroy: () => void;
};
export declare function ResizeHandler(container: HTMLElement, eventHandler: EventHandlerType, ownerWindow: WindowType, slides: HTMLElement[], axis: AxisType, watchResize: ResizeHandlerOptionType, nodeRects: NodeRectsType): ResizeHandlerType;
export {};
+13
View File
@@ -0,0 +1,13 @@
import { Vector1DType } from './Vector1d';
export type ScrollBodyType = {
direction: () => number;
duration: () => number;
velocity: () => number;
seek: () => ScrollBodyType;
settled: () => boolean;
useBaseFriction: () => ScrollBodyType;
useBaseDuration: () => ScrollBodyType;
useFriction: (n: number) => ScrollBodyType;
useDuration: (n: number) => ScrollBodyType;
};
export declare function ScrollBody(location: Vector1DType, offsetLocation: Vector1DType, previousLocation: Vector1DType, target: Vector1DType, baseDuration: number, baseFriction: number): ScrollBodyType;
+10
View File
@@ -0,0 +1,10 @@
import { LimitType } from './Limit';
import { ScrollBodyType } from './ScrollBody';
import { Vector1DType } from './Vector1d';
import { PercentOfViewType } from './PercentOfView';
export type ScrollBoundsType = {
shouldConstrain: () => boolean;
constrain: (pointerDown: boolean) => void;
toggleActive: (active: boolean) => void;
};
export declare function ScrollBounds(limit: LimitType, location: Vector1DType, target: Vector1DType, scrollBody: ScrollBodyType, percentOfView: PercentOfViewType): ScrollBoundsType;
+7
View File
@@ -0,0 +1,7 @@
import { LimitType } from './Limit';
export type ScrollContainOptionType = false | 'trimSnaps' | 'keepSnaps';
export type ScrollContainType = {
snapsContained: number[];
scrollContainLimit: LimitType;
};
export declare function ScrollContain(viewSize: number, contentSize: number, snapsAligned: number[], containScroll: ScrollContainOptionType, pixelTolerance: number): ScrollContainType;
+5
View File
@@ -0,0 +1,5 @@
import { LimitType } from './Limit';
export type ScrollLimitType = {
limit: LimitType;
};
export declare function ScrollLimit(contentSize: number, scrollSnaps: number[], loop: boolean): ScrollLimitType;
+6
View File
@@ -0,0 +1,6 @@
import { LimitType } from './Limit';
import { Vector1DType } from './Vector1d';
export type ScrollLooperType = {
loop: (direction: number) => void;
};
export declare function ScrollLooper(contentSize: number, limit: LimitType, location: Vector1DType, vectors: Vector1DType[]): ScrollLooperType;
+5
View File
@@ -0,0 +1,5 @@
import { LimitType } from './Limit';
export type ScrollProgressType = {
get: (n: number) => number;
};
export declare function ScrollProgress(limit: LimitType): ScrollProgressType;
+9
View File
@@ -0,0 +1,9 @@
import { AlignmentType } from './Alignment';
import { AxisType } from './Axis';
import { NodeRectType } from './NodeRects';
import { SlidesToScrollType } from './SlidesToScroll';
export type ScrollSnapsType = {
snaps: number[];
snapsAligned: number[];
};
export declare function ScrollSnaps(axis: AxisType, alignment: AlignmentType, containerRect: NodeRectType, slideRects: NodeRectType[], slidesToScroll: SlidesToScrollType): ScrollSnapsType;
+12
View File
@@ -0,0 +1,12 @@
import { LimitType } from './Limit';
import { Vector1DType } from './Vector1d';
export type TargetType = {
distance: number;
index: number;
};
export type ScrollTargetType = {
byIndex: (target: number, direction: number) => TargetType;
byDistance: (force: number, snap: boolean) => TargetType;
shortcut: (target: number, direction: number) => number;
};
export declare function ScrollTarget(loop: boolean, scrollSnaps: number[], contentSize: number, limit: LimitType, targetVector: Vector1DType): ScrollTargetType;
+11
View File
@@ -0,0 +1,11 @@
import { AnimationsType } from './Animations';
import { CounterType } from './Counter';
import { EventHandlerType } from './EventHandler';
import { ScrollBodyType } from './ScrollBody';
import { ScrollTargetType } from './ScrollTarget';
import { Vector1DType } from './Vector1d';
export type ScrollToType = {
distance: (n: number, snap: boolean) => void;
index: (n: number, direction: number) => void;
};
export declare function ScrollTo(animation: AnimationsType, indexCurrent: CounterType, indexPrevious: CounterType, scrollBody: ScrollBodyType, scrollTarget: ScrollTargetType, targetVector: Vector1DType, eventHandler: EventHandlerType): ScrollToType;
+13
View File
@@ -0,0 +1,13 @@
import { EmblaCarouselType } from './EmblaCarousel';
import { EventHandlerType } from './EventHandler';
import { EventStoreType } from './EventStore';
import { ScrollBodyType } from './ScrollBody';
import { ScrollToType } from './ScrollTo';
import { SlideRegistryType } from './SlideRegistry';
type FocusHandlerCallbackType = (emblaApi: EmblaCarouselType, evt: FocusEvent) => boolean | void;
export type FocusHandlerOptionType = boolean | FocusHandlerCallbackType;
export type SlideFocusType = {
init: (emblaApi: EmblaCarouselType) => void;
};
export declare function SlideFocus(root: HTMLElement, slides: HTMLElement[], slideRegistry: SlideRegistryType['slideRegistry'], scrollTo: ScrollToType, scrollBody: ScrollBodyType, eventStore: EventStoreType, eventHandler: EventHandlerType, watchFocus: FocusHandlerOptionType): SlideFocusType;
export {};
+18
View File
@@ -0,0 +1,18 @@
import { AxisType } from './Axis';
import { Vector1DType } from './Vector1d';
import { TranslateType } from './Translate';
type LoopPointType = {
loopPoint: number;
index: number;
translate: TranslateType;
slideLocation: Vector1DType;
target: () => number;
};
export type SlideLooperType = {
canLoop: () => boolean;
clear: () => void;
loop: () => void;
loopPoints: LoopPointType[];
};
export declare function SlideLooper(axis: AxisType, viewSize: number, contentSize: number, slideSizes: number[], slideSizesWithGaps: number[], snaps: number[], scrollSnaps: number[], location: Vector1DType, slides: HTMLElement[]): SlideLooperType;
export {};
+7
View File
@@ -0,0 +1,7 @@
import { LimitType } from './Limit';
import { ScrollContainOptionType } from './ScrollContain';
import { SlidesToScrollType } from './SlidesToScroll';
export type SlideRegistryType = {
slideRegistry: number[][];
};
export declare function SlideRegistry(containSnaps: boolean, containScroll: ScrollContainOptionType, scrollSnaps: number[], scrollContainLimit: LimitType, slidesToScroll: SlidesToScrollType, slideIndexes: number[]): SlideRegistryType;
+10
View File
@@ -0,0 +1,10 @@
import { AxisType } from './Axis';
import { NodeRectType } from './NodeRects';
import { WindowType } from './utils';
export type SlideSizesType = {
slideSizes: number[];
slideSizesWithGaps: number[];
startGap: number;
endGap: number;
};
export declare function SlideSizes(axis: AxisType, containerRect: NodeRectType, slideRects: NodeRectType[], slides: HTMLElement[], readEdgeGap: boolean, ownerWindow: WindowType): SlideSizesType;
+10
View File
@@ -0,0 +1,10 @@
import { EmblaCarouselType } from './EmblaCarousel';
import { EventHandlerType } from './EventHandler';
type SlidesHandlerCallbackType = (emblaApi: EmblaCarouselType, mutations: MutationRecord[]) => boolean | void;
export type SlidesHandlerOptionType = boolean | SlidesHandlerCallbackType;
export type SlidesHandlerType = {
init: (emblaApi: EmblaCarouselType) => void;
destroy: () => void;
};
export declare function SlidesHandler(container: HTMLElement, eventHandler: EventHandlerType, watchSlides: SlidesHandlerOptionType): SlidesHandlerType;
export {};
+8
View File
@@ -0,0 +1,8 @@
import { EventHandlerType } from './EventHandler';
export type SlidesInViewOptionsType = IntersectionObserverInit['threshold'];
export type SlidesInViewType = {
init: () => void;
destroy: () => void;
get: (inView?: boolean) => number[];
};
export declare function SlidesInView(container: HTMLElement, slides: HTMLElement[], eventHandler: EventHandlerType, threshold: SlidesInViewOptionsType): SlidesInViewType;
+7
View File
@@ -0,0 +1,7 @@
import { AxisType } from './Axis';
import { NodeRectType } from './NodeRects';
export type SlidesToScrollOptionType = 'auto' | number;
export type SlidesToScrollType = {
groupSlides: <Type>(array: Type[]) => Type[][];
};
export declare function SlidesToScroll(axis: AxisType, viewSize: number, slidesToScroll: SlidesToScrollOptionType, loop: boolean, containerRect: NodeRectType, slideRects: NodeRectType[], startGap: number, endGap: number, pixelTolerance: number): SlidesToScrollType;
+7
View File
@@ -0,0 +1,7 @@
import { AxisType } from './Axis';
export type TranslateType = {
clear: () => void;
to: (target: number) => void;
toggleActive: (active: boolean) => void;
};
export declare function Translate(axis: AxisType, container: HTMLElement): TranslateType;
+7
View File
@@ -0,0 +1,7 @@
export type Vector1DType = {
get: () => number;
set: (n: Vector1DType | number) => void;
add: (n: Vector1DType | number) => void;
subtract: (n: Vector1DType | number) => void;
};
export declare function Vector1D(initialValue: number): Vector1DType;
+19
View File
@@ -0,0 +1,19 @@
import { PointerEventType } from './DragTracker';
export type WindowType = Window & typeof globalThis;
export declare function isNumber(subject: unknown): subject is number;
export declare function isString(subject: unknown): subject is string;
export declare function isBoolean(subject: unknown): subject is boolean;
export declare function isObject(subject: unknown): subject is Record<string, unknown>;
export declare function mathAbs(n: number): number;
export declare function mathSign(n: number): number;
export declare function deltaAbs(valueB: number, valueA: number): number;
export declare function factorAbs(valueB: number, valueA: number): number;
export declare function roundToTwoDecimals(num: number): number;
export declare function arrayKeys<Type>(array: Type[]): number[];
export declare function arrayLast<Type>(array: Type[]): Type;
export declare function arrayLastIndex<Type>(array: Type[]): number;
export declare function arrayIsLastIndex<Type>(array: Type[], index: number): boolean;
export declare function arrayFromNumber(n: number, startAt?: number): number[];
export declare function objectKeys<Type extends object>(object: Type): string[];
export declare function objectsMergeDeep(objectA: Record<string, unknown>, objectB: Record<string, unknown>): Record<string, unknown>;
export declare function isMouseEvent(evt: PointerEventType, ownerWindow: WindowType): evt is MouseEvent;
+1
View File
@@ -0,0 +1 @@
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n="undefined"!=typeof globalThis?globalThis:n||self).EmblaCarousel=t()}(this,(function(){"use strict";function n(n){return"number"==typeof n}function t(n){return"string"==typeof n}function e(n){return"boolean"==typeof n}function r(n){return"[object Object]"===Object.prototype.toString.call(n)}function o(n){return Math.abs(n)}function i(n){return Math.sign(n)}function c(n,t){return o(n-t)}function u(n){return f(n).map(Number)}function s(n){return n[a(n)]}function a(n){return Math.max(0,n.length-1)}function d(n,t){return t===a(n)}function l(n,t=0){return Array.from(Array(n),((n,e)=>t+e))}function f(n){return Object.keys(n)}function p(n,t){return[n,t].reduce(((n,t)=>(f(t).forEach((e=>{const o=n[e],i=t[e],c=r(o)&&r(i);n[e]=c?p(o,i):i})),n)),{})}function m(n,t){return void 0!==t.MouseEvent&&n instanceof t.MouseEvent}function g(){let n=[];const t={add:function(e,r,o,i={passive:!0}){let c;if("addEventListener"in e)e.addEventListener(r,o,i),c=()=>e.removeEventListener(r,o,i);else{const n=e;n.addListener(o),c=()=>n.removeListener(o)}return n.push(c),t},clear:function(){n=n.filter((n=>n()))}};return t}function h(n,t,e,r){const o=g(),i=1e3/60;let c=null,u=0,s=0;function a(n){if(!s)return;c||(c=n,e(),e());const o=n-c;for(c=n,u+=o;u>=i;)e(),u-=i;r(u/i),s&&(s=t.requestAnimationFrame(a))}function d(){t.cancelAnimationFrame(s),c=null,u=0,s=0}return{init:function(){o.add(n,"visibilitychange",(()=>{n.hidden&&(c=null,u=0)}))},destroy:function(){d(),o.clear()},start:function(){s||(s=t.requestAnimationFrame(a))},stop:d,update:e,render:r}}function x(n=0,t=0){const e=o(n-t);function r(t){return t<n}function i(n){return n>t}function c(n){return r(n)||i(n)}return{length:e,max:t,min:n,constrain:function(e){return c(e)?r(e)?n:t:e},reachedAny:c,reachedMax:i,reachedMin:r,removeOffset:function(n){return e?n-e*Math.ceil((n-t)/e):n}}}function y(n,t,e){const{constrain:r}=x(0,n),i=n+1;let c=u(t);function u(n){return e?o((i+n)%i):r(n)}function s(){return c}function a(){return y(n,s(),e)}const d={get:s,set:function(n){return c=u(n),d},add:function(n){return a().set(s()+n)},clone:a};return d}function v(n,t,r,u,s,a,d,l,f,p,h,y,v,b,S,w,E,L,D){const{cross:I,direction:M}=n,A=["INPUT","SELECT","TEXTAREA"],F={passive:!1},T=g(),O=g(),P=x(50,225).constrain(b.measure(20)),z={mouse:300,touch:400},H={mouse:500,touch:600},k=S?43:25;let V=!1,B=0,C=0,N=!1,R=!1,j=!1,G=!1;function q(n){if(!m(n,u)&&n.touches.length>=2)return U(n);const t=a.readPoint(n),e=a.readPoint(n,I),r=c(t,B),o=c(e,C);if(!R&&!G){if(!n.cancelable)return U(n);if(R=r>o,!R)return U(n)}const i=a.pointerMove(n);r>w&&(j=!0),p.useFriction(.3).useDuration(.75),l.start(),s.add(M(i)),n.preventDefault()}function U(n){const t=h.byDistance(0,!1).index!==y.get(),e=a.pointerUp(n)*(S?H:z)[G?"mouse":"touch"],r=function(n,t){const e=y.add(-1*i(n)),r=h.byDistance(n,!S).distance;return S||o(n)<P?r:E&&t?.5*r:h.byIndex(e.get(),0).distance}(M(e),t),u=function(n,t){if(0===n||0===t)return 0;if(o(n)<=o(t))return 0;const e=c(o(n),o(t));return o(e/n)}(e,r),s=k-10*u,d=L+u/50;R=!1,N=!1,O.clear(),p.useDuration(s).useFriction(d),f.distance(r,!S),G=!1,v.emit("pointerUp")}function W(n){j&&(n.stopPropagation(),n.preventDefault(),j=!1)}return{init:function(n){if(!D)return;function o(o){(e(D)||D(n,o))&&function(n){const e=m(n,u);if(G=e,j=S&&e&&!n.buttons&&V,V=c(s.get(),d.get())>=2,e&&0!==n.button)return;if(function(n){const t=n.nodeName||"";return A.includes(t)}(n.target))return;N=!0,a.pointerDown(n),p.useFriction(0).useDuration(0),s.set(d),function(){const n=G?r:t;O.add(n,"touchmove",q,F).add(n,"touchend",U).add(n,"mousemove",q,F).add(n,"mouseup",U)}(),B=a.readPoint(n),C=a.readPoint(n,I),v.emit("pointerDown")}(o)}const i=t;T.add(i,"dragstart",(n=>n.preventDefault()),F).add(i,"touchmove",(()=>{}),F).add(i,"touchend",(()=>{})).add(i,"touchstart",o).add(i,"mousedown",o).add(i,"touchcancel",U).add(i,"contextmenu",U).add(i,"click",W,!0)},destroy:function(){T.clear(),O.clear()},pointerDown:function(){return N}}}function b(n,t){let e,r;function i(n){return n.timeStamp}function c(e,r){const o="client"+("x"===(r||n.scroll)?"X":"Y");return(m(e,t)?e:e.touches[0])[o]}return{pointerDown:function(n){return e=n,r=n,c(n)},pointerMove:function(n){const t=c(n)-c(r),o=i(n)-i(e)>170;return r=n,o&&(e=n),t},pointerUp:function(n){if(!e||!r)return 0;const t=c(r)-c(e),u=i(n)-i(e),s=i(n)-i(r)>170,a=t/u;return u&&!s&&o(a)>.1?a:0},readPoint:c}}function S(n,t,r,i,c,u,s){const a=[n].concat(i);let d,l,f=[],p=!1;function m(n){return c.measureSize(s.measure(n))}return{init:function(c){u&&(l=m(n),f=i.map(m),d=new ResizeObserver((r=>{(e(u)||u(c,r))&&function(e){for(const r of e){if(p)return;const e=r.target===n,u=i.indexOf(r.target),s=e?l:f[u];if(o(m(e?n:i[u])-s)>=.5){c.reInit(),t.emit("resize");break}}}(r)})),r.requestAnimationFrame((()=>{a.forEach((n=>d.observe(n)))})))},destroy:function(){p=!0,d&&d.disconnect()}}}function Line truncated
+5
View File
@@ -0,0 +1,5 @@
export type AlignmentOptionType = 'start' | 'center' | 'end' | ((viewSize: number, snapSize: number, index: number) => number);
export type AlignmentType = {
measure: (n: number, index: number) => number;
};
export declare function Alignment(align: AlignmentOptionType, viewSize: number): AlignmentType;
+13
View File
@@ -0,0 +1,13 @@
import { EngineType } from './Engine.js';
import { WindowType } from './utils.js';
export type AnimationsUpdateType = (engine: EngineType) => void;
export type AnimationsRenderType = (engine: EngineType, alpha: number) => void;
export type AnimationsType = {
init: () => void;
destroy: () => void;
start: () => void;
stop: () => void;
update: () => void;
render: (alpha: number) => void;
};
export declare function Animations(ownerDocument: Document, ownerWindow: WindowType, update: () => void, render: (alpha: number) => void): AnimationsType;
+14
View File
@@ -0,0 +1,14 @@
import { NodeRectType } from './NodeRects.js';
export type AxisOptionType = 'x' | 'y';
export type AxisDirectionOptionType = 'ltr' | 'rtl';
type AxisEdgeType = 'top' | 'right' | 'bottom' | 'left';
export type AxisType = {
scroll: AxisOptionType;
cross: AxisOptionType;
startEdge: AxisEdgeType;
endEdge: AxisEdgeType;
measureSize: (nodeRect: NodeRectType) => number;
direction: (n: number) => number;
};
export declare function Axis(axis: AxisOptionType, contentDirection: AxisDirectionOptionType): AxisType;
export {};
+7
View File
@@ -0,0 +1,7 @@
export type CounterType = {
get: () => number;
set: (n: number) => CounterType;
add: (n: number) => CounterType;
clone: () => CounterType;
};
export declare function Counter(max: number, start: number, loop: boolean): CounterType;
+21
View File
@@ -0,0 +1,21 @@
import { EmblaCarouselType } from './EmblaCarousel.js';
import { AnimationsType } from './Animations.js';
import { CounterType } from './Counter.js';
import { DragTrackerType, PointerEventType } from './DragTracker.js';
import { EventHandlerType } from './EventHandler.js';
import { AxisType } from './Axis.js';
import { ScrollBodyType } from './ScrollBody.js';
import { ScrollTargetType } from './ScrollTarget.js';
import { ScrollToType } from './ScrollTo.js';
import { Vector1DType } from './Vector1d.js';
import { PercentOfViewType } from './PercentOfView.js';
import { WindowType } from './utils.js';
type DragHandlerCallbackType = (emblaApi: EmblaCarouselType, evt: PointerEventType) => boolean | void;
export type DragHandlerOptionType = boolean | DragHandlerCallbackType;
export type DragHandlerType = {
init: (emblaApi: EmblaCarouselType) => void;
destroy: () => void;
pointerDown: () => boolean;
};
export declare function DragHandler(axis: AxisType, rootNode: HTMLElement, ownerDocument: Document, ownerWindow: WindowType, target: Vector1DType, dragTracker: DragTrackerType, location: Vector1DType, animation: AnimationsType, scrollTo: ScrollToType, scrollBody: ScrollBodyType, scrollTarget: ScrollTargetType, index: CounterType, eventHandler: EventHandlerType, percentOfView: PercentOfViewType, dragFree: boolean, dragThreshold: number, skipSnaps: boolean, baseFriction: number, watchDrag: DragHandlerOptionType): DragHandlerType;
export {};
+10
View File
@@ -0,0 +1,10 @@
import { AxisOptionType, AxisType } from './Axis.js';
import { WindowType } from './utils.js';
export type PointerEventType = TouchEvent | MouseEvent;
export type DragTrackerType = {
pointerDown: (evt: PointerEventType) => number;
pointerMove: (evt: PointerEventType) => number;
pointerUp: (evt: PointerEventType) => number;
readPoint: (evt: PointerEventType, evtAxis?: AxisOptionType) => number;
};
export declare function DragTracker(axis: AxisType, ownerWindow: WindowType): DragTrackerType;
+32
View File
@@ -0,0 +1,32 @@
import { EngineType } from './Engine.js';
import { EventHandlerType } from './EventHandler.js';
import { EmblaOptionsType } from './Options.js';
import { EmblaPluginsType, EmblaPluginType } from './Plugins.js';
export type EmblaCarouselType = {
canScrollNext: () => boolean;
canScrollPrev: () => boolean;
containerNode: () => HTMLElement;
internalEngine: () => EngineType;
destroy: () => void;
off: EventHandlerType['off'];
on: EventHandlerType['on'];
emit: EventHandlerType['emit'];
plugins: () => EmblaPluginsType;
previousScrollSnap: () => number;
reInit: (options?: EmblaOptionsType, plugins?: EmblaPluginType[]) => void;
rootNode: () => HTMLElement;
scrollNext: (jump?: boolean) => void;
scrollPrev: (jump?: boolean) => void;
scrollProgress: () => number;
scrollSnapList: () => number[];
scrollTo: (index: number, jump?: boolean) => void;
selectedScrollSnap: () => number;
slideNodes: () => HTMLElement[];
slidesInView: () => number[];
slidesNotInView: () => number[];
};
declare function EmblaCarousel(root: HTMLElement, userOptions?: EmblaOptionsType, userPlugins?: EmblaPluginType[]): EmblaCarouselType;
declare namespace EmblaCarousel {
let globalOptions: EmblaOptionsType | undefined;
}
export default EmblaCarousel;
+64
View File
@@ -0,0 +1,64 @@
import { AnimationsType } from './Animations.js';
import { AxisType } from './Axis.js';
import { CounterType } from './Counter.js';
import { DragHandlerType } from './DragHandler.js';
import { EventHandlerType } from './EventHandler.js';
import { EventStoreType } from './EventStore.js';
import { LimitType } from './Limit.js';
import { NodeRectType } from './NodeRects.js';
import { OptionsType } from './Options.js';
import { PercentOfViewType } from './PercentOfView.js';
import { ResizeHandlerType } from './ResizeHandler.js';
import { ScrollBodyType } from './ScrollBody.js';
import { ScrollBoundsType } from './ScrollBounds.js';
import { ScrollLooperType } from './ScrollLooper.js';
import { ScrollProgressType } from './ScrollProgress.js';
import { SlideRegistryType } from './SlideRegistry.js';
import { ScrollTargetType } from './ScrollTarget.js';
import { ScrollToType } from './ScrollTo.js';
import { SlideFocusType } from './SlideFocus.js';
import { SlideLooperType } from './SlideLooper.js';
import { SlidesHandlerType } from './SlidesHandler.js';
import { SlidesInViewType } from './SlidesInView.js';
import { SlidesToScrollType } from './SlidesToScroll.js';
import { TranslateType } from './Translate.js';
import { WindowType } from './utils.js';
import { Vector1DType } from './Vector1d.js';
export type EngineType = {
ownerDocument: Document;
ownerWindow: WindowType;
eventHandler: EventHandlerType;
axis: AxisType;
animation: AnimationsType;
scrollBounds: ScrollBoundsType;
scrollLooper: ScrollLooperType;
scrollProgress: ScrollProgressType;
index: CounterType;
indexPrevious: CounterType;
limit: LimitType;
location: Vector1DType;
offsetLocation: Vector1DType;
previousLocation: Vector1DType;
options: OptionsType;
percentOfView: PercentOfViewType;
scrollBody: ScrollBodyType;
dragHandler: DragHandlerType;
eventStore: EventStoreType;
slideLooper: SlideLooperType;
slidesInView: SlidesInViewType;
slidesToScroll: SlidesToScrollType;
target: Vector1DType;
translate: TranslateType;
resizeHandler: ResizeHandlerType;
slidesHandler: SlidesHandlerType;
scrollTo: ScrollToType;
scrollTarget: ScrollTargetType;
scrollSnapList: number[];
scrollSnaps: number[];
slideIndexes: number[];
slideFocus: SlideFocusType;
slideRegistry: SlideRegistryType['slideRegistry'];
containerRect: NodeRectType;
slideRects: NodeRectType[];
};
export declare function Engine(root: HTMLElement, container: HTMLElement, slides: HTMLElement[], ownerDocument: Document, ownerWindow: WindowType, options: OptionsType, eventHandler: EventHandlerType): EngineType;
+27
View File
@@ -0,0 +1,27 @@
import { EmblaCarouselType } from './EmblaCarousel.js';
type CallbackType = (emblaApi: EmblaCarouselType, evt: EmblaEventType) => void;
export type EmblaEventType = EmblaEventListType[keyof EmblaEventListType];
export interface EmblaEventListType {
init: 'init';
pointerDown: 'pointerDown';
pointerUp: 'pointerUp';
slidesChanged: 'slidesChanged';
slidesInView: 'slidesInView';
scroll: 'scroll';
select: 'select';
settle: 'settle';
destroy: 'destroy';
reInit: 'reInit';
resize: 'resize';
slideFocusStart: 'slideFocusStart';
slideFocus: 'slideFocus';
}
export type EventHandlerType = {
init: (emblaApi: EmblaCarouselType) => void;
emit: (evt: EmblaEventType) => EventHandlerType;
on: (evt: EmblaEventType, cb: CallbackType) => EventHandlerType;
off: (evt: EmblaEventType, cb: CallbackType) => EventHandlerType;
clear: () => void;
};
export declare function EventHandler(): EventHandlerType;
export {};
+9
View File
@@ -0,0 +1,9 @@
type EventNameType = keyof DocumentEventMap | keyof WindowEventMap;
type EventHandlerType = (evt: any) => void;
type EventOptionsType = boolean | AddEventListenerOptions | undefined;
export type EventStoreType = {
add: (node: EventTarget, type: EventNameType, handler: EventHandlerType, options?: EventOptionsType) => EventStoreType;
clear: () => void;
};
export declare function EventStore(): EventStoreType;
export {};
+11
View File
@@ -0,0 +1,11 @@
export type LimitType = {
min: number;
max: number;
length: number;
constrain: (n: number) => number;
reachedAny: (n: number) => boolean;
reachedMax: (n: number) => boolean;
reachedMin: (n: number) => boolean;
removeOffset: (n: number) => number;
};
export declare function Limit(min?: number, max?: number): LimitType;
+12
View File
@@ -0,0 +1,12 @@
export type NodeRectType = {
top: number;
right: number;
bottom: number;
left: number;
width: number;
height: number;
};
export type NodeRectsType = {
measure: (node: HTMLElement) => NodeRectType;
};
export declare function NodeRects(): NodeRectsType;
+40
View File
@@ -0,0 +1,40 @@
import { AlignmentOptionType } from './Alignment.js';
import { AxisDirectionOptionType, AxisOptionType } from './Axis.js';
import { SlidesToScrollOptionType } from './SlidesToScroll.js';
import { ScrollContainOptionType } from './ScrollContain.js';
import { DragHandlerOptionType } from './DragHandler.js';
import { ResizeHandlerOptionType } from './ResizeHandler.js';
import { SlidesHandlerOptionType } from './SlidesHandler.js';
import { SlidesInViewOptionsType } from './SlidesInView.js';
import { FocusHandlerOptionType } from './SlideFocus.js';
export type LooseOptionsType = {
[key: string]: unknown;
};
export type CreateOptionsType<Type extends LooseOptionsType> = Type & {
active: boolean;
breakpoints: {
[key: string]: Omit<Partial<CreateOptionsType<Type>>, 'breakpoints'>;
};
};
export type OptionsType = CreateOptionsType<{
align: AlignmentOptionType;
axis: AxisOptionType;
container: string | HTMLElement | null;
slides: string | HTMLElement[] | NodeListOf<HTMLElement> | null;
containScroll: ScrollContainOptionType;
direction: AxisDirectionOptionType;
slidesToScroll: SlidesToScrollOptionType;
dragFree: boolean;
dragThreshold: number;
inViewThreshold: SlidesInViewOptionsType;
loop: boolean;
skipSnaps: boolean;
duration: number;
startIndex: number;
watchDrag: DragHandlerOptionType;
watchResize: ResizeHandlerOptionType;
watchSlides: SlidesHandlerOptionType;
watchFocus: FocusHandlerOptionType;
}>;
export declare const defaultOptions: OptionsType;
export type EmblaOptionsType = Partial<OptionsType>;
+10
View File
@@ -0,0 +1,10 @@
import { LooseOptionsType, CreateOptionsType } from './Options.js';
import { WindowType } from './utils.js';
type OptionsType = Partial<CreateOptionsType<LooseOptionsType>>;
export type OptionsHandlerType = {
mergeOptions: <TypeA extends OptionsType, TypeB extends OptionsType>(optionsA: TypeA, optionsB?: TypeB) => TypeA;
optionsAtMedia: <Type extends OptionsType>(options: Type) => Type;
optionsMediaQueries: (optionsList: OptionsType[]) => MediaQueryList[];
};
export declare function OptionsHandler(ownerWindow: WindowType): OptionsHandlerType;
export {};
+4
View File
@@ -0,0 +1,4 @@
export type PercentOfViewType = {
measure: (n: number) => number;
};
export declare function PercentOfView(viewSize: number): PercentOfViewType;
+16
View File
@@ -0,0 +1,16 @@
import { CreateOptionsType, LooseOptionsType } from './Options.js';
import { EmblaCarouselType } from './EmblaCarousel.js';
import { OptionsHandlerType } from './OptionsHandler.js';
export type LoosePluginType = {
[key: string]: unknown;
};
export type CreatePluginType<TypeA extends LoosePluginType, TypeB extends LooseOptionsType> = TypeA & {
name: string;
options: Partial<CreateOptionsType<TypeB>>;
init: (embla: EmblaCarouselType, OptionsHandler: OptionsHandlerType) => void;
destroy: () => void;
};
export interface EmblaPluginsType {
[key: string]: CreatePluginType<LoosePluginType, {}>;
}
export type EmblaPluginType = EmblaPluginsType[keyof EmblaPluginsType];
+8
View File
@@ -0,0 +1,8 @@
import { EmblaCarouselType } from './EmblaCarousel.js';
import { OptionsHandlerType } from './OptionsHandler.js';
import { EmblaPluginsType, EmblaPluginType } from './Plugins.js';
export type PluginsHandlerType = {
init: (emblaApi: EmblaCarouselType, plugins: EmblaPluginType[]) => EmblaPluginsType;
destroy: () => void;
};
export declare function PluginsHandler(optionsHandler: OptionsHandlerType): PluginsHandlerType;
+13
View File
@@ -0,0 +1,13 @@
import { AxisType } from './Axis.js';
import { EmblaCarouselType } from './EmblaCarousel.js';
import { EventHandlerType } from './EventHandler.js';
import { NodeRectsType } from './NodeRects.js';
import { WindowType } from './utils.js';
type ResizeHandlerCallbackType = (emblaApi: EmblaCarouselType, entries: ResizeObserverEntry[]) => boolean | void;
export type ResizeHandlerOptionType = boolean | ResizeHandlerCallbackType;
export type ResizeHandlerType = {
init: (emblaApi: EmblaCarouselType) => void;
destroy: () => void;
};
export declare function ResizeHandler(container: HTMLElement, eventHandler: EventHandlerType, ownerWindow: WindowType, slides: HTMLElement[], axis: AxisType, watchResize: ResizeHandlerOptionType, nodeRects: NodeRectsType): ResizeHandlerType;
export {};
+13
View File
@@ -0,0 +1,13 @@
import { Vector1DType } from './Vector1d.js';
export type ScrollBodyType = {
direction: () => number;
duration: () => number;
velocity: () => number;
seek: () => ScrollBodyType;
settled: () => boolean;
useBaseFriction: () => ScrollBodyType;
useBaseDuration: () => ScrollBodyType;
useFriction: (n: number) => ScrollBodyType;
useDuration: (n: number) => ScrollBodyType;
};
export declare function ScrollBody(location: Vector1DType, offsetLocation: Vector1DType, previousLocation: Vector1DType, target: Vector1DType, baseDuration: number, baseFriction: number): ScrollBodyType;
+10
View File
@@ -0,0 +1,10 @@
import { LimitType } from './Limit.js';
import { ScrollBodyType } from './ScrollBody.js';
import { Vector1DType } from './Vector1d.js';
import { PercentOfViewType } from './PercentOfView.js';
export type ScrollBoundsType = {
shouldConstrain: () => boolean;
constrain: (pointerDown: boolean) => void;
toggleActive: (active: boolean) => void;
};
export declare function ScrollBounds(limit: LimitType, location: Vector1DType, target: Vector1DType, scrollBody: ScrollBodyType, percentOfView: PercentOfViewType): ScrollBoundsType;
Loaded 100 of 34820 files, more files were not shown because too many files have changed in this diff. Show more