index.d.ts 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699
  1. /**
  2. * The type that matches any function.
  3. */
  4. declare type AnyFunction$1 = (...args: any[]) => any;
  5. /**
  6. * The union for CSS properties.
  7. *
  8. * @since 0.0.1
  9. */
  10. declare type CSSProperties = Exclude<keyof CSSStyleDeclaration, number | 'length' | 'parentRule' | 'getPropertyPriority' | 'getPropertyValue' | 'item' | 'removeProperty' | 'setProperty'>;
  11. /**
  12. * The type for an array with remover functions.
  13. *
  14. * @since 0.0.1
  15. */
  16. declare type Removers = [() => void, object?][];
  17. /**
  18. * The interface for the EventBinder instance.
  19. *
  20. * @since 0.0.1
  21. */
  22. interface EventBinder {
  23. bind(target: EventTarget, events: string | string[], callback: AnyFunction$1, options?: AddEventListenerOptions): void;
  24. create(): EventBinder;
  25. destroy(): void;
  26. }
  27. /**
  28. * The constructor function to provide methods to subscribe native events.
  29. *
  30. * @since 0.0.1
  31. * @constructor
  32. *
  33. * @return An EventBinder instance.
  34. */
  35. declare function EventBinder(removersRef?: Removers): EventBinder;
  36. /**
  37. * The type for an array with listener data as `[ event, callback, key ]`.
  38. *
  39. * @since 0.0.1
  40. */
  41. declare type Listeners = [string, AnyFunction$1, object?][];
  42. /**
  43. * The interface for the EventBus instance.
  44. *
  45. * @since 0.0.1
  46. */
  47. interface EventBus<M extends Record<string, AnyFunction$1> = Record<string, AnyFunction$1>> {
  48. on<K extends keyof M & string>(event: K, callback: M[K]): void;
  49. on(events: string | string[], callback: AnyFunction$1): void;
  50. off<K extends keyof M & string>(event: K, callback?: M[K]): void;
  51. off(events: string | string[], callback?: AnyFunction$1): void;
  52. emit<K extends keyof M & string>(event: K, ...args: Parameters<M[K]>): void;
  53. emit(event: string, ...args: any[]): void;
  54. create(): EventBus<M>;
  55. destroy(): void;
  56. }
  57. /**
  58. * Provides the simple event system.
  59. * Note that `M` - type for an event map - must have index signature,
  60. * but that makes all callback function `AnyFunction`.
  61. * To avoid this:
  62. * - Use a type alias instead of interface.
  63. * - Or do like `EventBus<EventMap & Record<string, AnyFunction>, keyof EventMap>`.
  64. *
  65. * @see https://github.com/microsoft/TypeScript/issues/15300
  66. *
  67. * @since 0.0.1
  68. * @constructor
  69. *
  70. * @param listenersRef - An array with listener data. Internal use only.
  71. *
  72. * @return An EventBus instance.
  73. */
  74. declare function EventBus<M extends Record<string, AnyFunction$1>, K extends keyof M & string>(listenersRef?: Listeners): EventBus<M>;
  75. /**
  76. * The interface for the EventInterface object.
  77. *
  78. * @since 0.0.1
  79. */
  80. interface EventInterface<M extends Record<string, AnyFunction$1> = Record<string, AnyFunction$1>> extends Omit<EventBinder, 'create'>, Omit<EventBus<M>, 'create'> {
  81. create(): EventInterface<M>;
  82. destroy(): void;
  83. }
  84. /**
  85. * The constructor function that provides interface for both internal and native events.
  86. *
  87. * @since 0.0.1
  88. * @constructor
  89. * @internal
  90. *
  91. * @param binder - An `EventBinder` instance. Internal use only.
  92. * @param bus - An `EventBus` instance. Internal use only.
  93. *
  94. * @return A collection of interface functions.
  95. */
  96. declare function EventInterface<M extends Record<string, AnyFunction$1> = Record<string, AnyFunction$1>>(binder?: EventBinder, bus?: EventBus<Record<string, AnyFunction$1>>): EventInterface<M>;
  97. /**
  98. * The interface for the State object.
  99. *
  100. * @since 0.0.1
  101. */
  102. interface State {
  103. set(state: number): void;
  104. is(states: number | number[]): boolean;
  105. }
  106. /**
  107. * The function providing a super simple state system.
  108. *
  109. * @param initialState - Specifies the initial state.
  110. */
  111. declare function State(initialState: number): State;
  112. /**
  113. * The interface for the Media component.
  114. *
  115. * @since 4.0.0
  116. */
  117. interface MediaComponent extends BaseComponent {
  118. /** @internal */
  119. reduce(reduced: boolean): void;
  120. set(options: Options, base?: boolean, notify?: boolean): void;
  121. }
  122. /**
  123. * The interface for the Direction component.
  124. *
  125. * @since 3.0.0
  126. */
  127. interface DirectionComponent extends BaseComponent {
  128. resolve<R extends string>(prop: string, axisOnly?: boolean, direction?: Options['direction']): R;
  129. orient(value: number): number;
  130. }
  131. /**
  132. * The interface for elements which the slider consists of.
  133. *
  134. * @since 3.0.0
  135. */
  136. interface ElementCollection {
  137. root: HTMLElement;
  138. track: HTMLElement;
  139. list: HTMLElement;
  140. slides: HTMLElement[];
  141. arrows?: HTMLElement;
  142. pagination?: HTMLUListElement;
  143. prev?: HTMLButtonElement;
  144. next?: HTMLButtonElement;
  145. bar?: HTMLElement;
  146. toggle?: HTMLElement;
  147. }
  148. /**
  149. * The interface for the Elements component.
  150. *
  151. * @since 3.0.0
  152. */
  153. interface ElementsComponent extends BaseComponent, ElementCollection {
  154. }
  155. /**
  156. * The interface for the Slide sub component.
  157. *
  158. * @since 3.0.0
  159. */
  160. interface SlideComponent extends BaseComponent {
  161. index: number;
  162. slideIndex: number;
  163. slide: HTMLElement;
  164. container: HTMLElement;
  165. isClone: boolean;
  166. update(): void;
  167. position(): number;
  168. size(): number;
  169. style(prop: CSSProperties, value: string | number, useContainer?: boolean): void;
  170. isWithin(from: number, distance: number): boolean;
  171. }
  172. /**
  173. * The interface for the Layout component.
  174. *
  175. * @since 3.0.0
  176. */
  177. interface LayoutComponent extends BaseComponent {
  178. listSize(): number;
  179. slideSize(index: number, withoutGap?: boolean): number;
  180. sliderSize(withoutGap?: boolean): number;
  181. totalSize(index?: number, withoutGap?: boolean): number;
  182. getPadding(right: boolean): number;
  183. isOverflow(): boolean;
  184. /** @internal */
  185. resize(force?: boolean): void;
  186. }
  187. /**
  188. * The interface for the Clone component.
  189. *
  190. * @since 3.0.0
  191. */
  192. interface ClonesComponent extends BaseComponent {
  193. }
  194. /**
  195. * The interface for the Move component.
  196. *
  197. * @since 3.0.0
  198. */
  199. interface MoveComponent extends BaseComponent {
  200. move(dest: number, index: number, prev: number, callback?: AnyFunction): void;
  201. jump(index: number): void;
  202. translate(position: number, preventLoop?: boolean): void;
  203. shift(position: number, backwards: boolean): number;
  204. cancel(): void;
  205. toIndex(position: number): number;
  206. toPosition(index: number, trimming?: boolean): number;
  207. getPosition(): number;
  208. getLimit(max: boolean): number;
  209. exceededLimit(max?: boolean | undefined, position?: number): boolean;
  210. /** @internal */
  211. reposition(): void;
  212. }
  213. /**
  214. * The interface for the Controller component.
  215. *
  216. * @since 3.0.0
  217. */
  218. interface ControllerComponent extends BaseComponent {
  219. go(control: number | string, allowSameIndex?: boolean, callback?: AnyFunction): void;
  220. scroll(destination: number, duration?: number, snap?: boolean, callback?: AnyFunction): void;
  221. getNext(destination?: boolean): number;
  222. getPrev(destination?: boolean): number;
  223. getEnd(): number;
  224. setIndex(index: number): void;
  225. getIndex(prev?: boolean): number;
  226. toIndex(page: number): number;
  227. toPage(index: number): number;
  228. toDest(position: number): number;
  229. hasFocus(): boolean;
  230. isBusy(): boolean;
  231. /** @internal */
  232. getAdjacent(prev: boolean, destination?: boolean): number;
  233. }
  234. /**
  235. * The interface for the Arrows component.
  236. *
  237. * @since 3.0.0
  238. */
  239. interface ArrowsComponent extends BaseComponent {
  240. arrows: {
  241. prev?: HTMLButtonElement;
  242. next?: HTMLButtonElement;
  243. };
  244. /** @internal */
  245. update(): void;
  246. }
  247. /**
  248. * The interface for the Autoplay component.
  249. *
  250. * @since 3.0.0
  251. */
  252. interface AutoplayComponent extends BaseComponent {
  253. play(): void;
  254. pause(): void;
  255. isPaused(): boolean;
  256. }
  257. /**
  258. * The interface for the Cover component.
  259. *
  260. * @since 3.0.0
  261. */
  262. interface CoverComponent extends BaseComponent {
  263. }
  264. /**
  265. * The interface for the Scroll component.
  266. *
  267. * @since 3.0.0
  268. */
  269. interface ScrollComponent extends BaseComponent {
  270. scroll(position: number, duration?: number, snap?: boolean, callback?: AnyFunction): void;
  271. cancel(): void;
  272. }
  273. /**
  274. * The interface for the Drag component.
  275. *
  276. * @since 3.0.0
  277. */
  278. interface DragComponent extends BaseComponent {
  279. disable(disabled: boolean): void;
  280. isDragging(): boolean;
  281. }
  282. /**
  283. * The interface for the Keyboard component.
  284. *
  285. * @since 3.0.0
  286. */
  287. interface KeyboardComponent extends BaseComponent {
  288. disable(disabled: boolean): void;
  289. }
  290. /**
  291. * The interface for the LazyLoad component.
  292. *
  293. * @since 3.0.0
  294. */
  295. interface LazyLoadComponent extends BaseComponent {
  296. /** @internal */
  297. check(): void;
  298. }
  299. /**
  300. * The interface for the Pagination component.
  301. *
  302. * @since 3.0.0
  303. */
  304. interface PaginationComponent extends BaseComponent {
  305. items: PaginationItem[];
  306. getAt(index: number): PaginationItem;
  307. update(): void;
  308. }
  309. /**
  310. * The interface for data of the pagination.
  311. *
  312. * @since 3.0.0
  313. */
  314. interface PaginationData {
  315. list: HTMLUListElement;
  316. items: PaginationItem[];
  317. }
  318. /**
  319. * The interface for each pagination item.
  320. *
  321. * @since 3.0.0
  322. */
  323. interface PaginationItem {
  324. li: HTMLLIElement;
  325. button: HTMLButtonElement;
  326. page: number;
  327. }
  328. /**
  329. * The interface for the Sync component.
  330. *
  331. * @since 3.0.0
  332. */
  333. interface SyncComponent extends BaseComponent {
  334. remount(): void;
  335. }
  336. /**
  337. * The interface for the Wheel component.
  338. *
  339. * @since 3.0.0
  340. */
  341. interface WheelComponent extends BaseComponent {
  342. }
  343. /**
  344. * The interface for the Live component.
  345. *
  346. * @since 4.0.0
  347. */
  348. interface LiveComponent extends BaseComponent {
  349. disable(disabled: boolean): void;
  350. }
  351. /**
  352. * The collection of i18n strings.
  353. *
  354. * @since 3.0.0
  355. */
  356. declare const I18N: {
  357. prev: string;
  358. next: string;
  359. first: string;
  360. last: string;
  361. slideX: string;
  362. pageX: string;
  363. play: string;
  364. pause: string;
  365. carousel: string;
  366. slide: string;
  367. select: string;
  368. slideLabel: string;
  369. };
  370. /**
  371. * The interface for options.
  372. *
  373. * @since 3.0.0
  374. */
  375. interface Options extends ResponsiveOptions {
  376. /**
  377. * The type of the slider.
  378. * - 'slide': A slider with the slide transition
  379. * - 'loop' : A carousel slider
  380. * - 'fade' : A slider with the fade transition. This does not support the perPage option.
  381. */
  382. type?: string;
  383. /**
  384. * The `role` attribute for the root element.
  385. * If the tag is `<section>`, this value will not be used. The default value is `'region'`.
  386. */
  387. role?: string;
  388. /**
  389. * Determines whether to disable any actions while the slider is transitioning.
  390. * Even if `false`, the slider forcibly waits for transition on the loop points.
  391. */
  392. waitForTransition?: boolean;
  393. /**
  394. * If `true`, the width of slides are determined by their width.
  395. * The `perPage` and `perMove` options should be `1`.
  396. */
  397. autoWidth?: boolean;
  398. /**
  399. * If `true`, the height of slides are determined by their height.
  400. * The `perPage` and `perMove` options should be `1`.
  401. */
  402. autoHeight?: boolean;
  403. /**
  404. * The start index.
  405. */
  406. start?: number;
  407. /**
  408. * Changes the arrow SVG path, like 'm7.61 0.807-2.12...'.
  409. */
  410. arrowPath?: string;
  411. /**
  412. * Determines whether to activate autoplay or not.
  413. * If `paused`, it will not begin when the slider becomes active.
  414. * You need to provided play/pause buttons or manually start it by `Autoplay#play()`.
  415. */
  416. autoplay?: boolean | 'pause';
  417. /**
  418. * The autoplay interval in milliseconds.
  419. */
  420. interval?: number;
  421. /**
  422. * Determines whether to pause autoplay on mouseover.
  423. */
  424. pauseOnHover?: boolean;
  425. /**
  426. * Determines whether to pause autoplay when the slider contains the active element (focused element).
  427. * This should be `true` for accessibility.
  428. */
  429. pauseOnFocus?: boolean;
  430. /**
  431. * Determines whether to reset the autoplay progress when it is requested to start again.
  432. */
  433. resetProgress?: boolean;
  434. /**
  435. * Enables lazy loading.
  436. * Provide the `src` by the `data-splide-lazy` or the `srcset` by the `data-splide-lazy-srcset`.
  437. * You may also provide `src` for the placeholder, but the value must be different with the data.
  438. *
  439. * - `false`: Disables lazy loading
  440. * - `'nearby'`: Starts loading only images around the active slide (page)
  441. * - `'sequential'`: Loads images sequentially
  442. */
  443. lazyLoad?: boolean | 'nearby' | 'sequential';
  444. /**
  445. * Determine how many pages (not slides) around the active slide should be loaded beforehand.
  446. * This only works when the `lazyLoad` option is `'nearby'`.
  447. */
  448. preloadPages?: number;
  449. /**
  450. * Enables keyboard shortcuts for the slider control.
  451. * - `true` or `'global'`: Listens to the `keydown` event of the document.
  452. * - 'focused': Listens to the `keydown` event of the slider root element with adding `tabindex="0"` to it.
  453. * - `false`: Disables keyboard shortcuts (default).
  454. */
  455. keyboard?: boolean | 'global' | 'focused';
  456. /**
  457. * Enables navigation by the mouse wheel.
  458. * Set `waitForTransition` to `ture` or provide the `wheelSleep` duration.
  459. */
  460. wheel?: boolean;
  461. /**
  462. * The threshold to cut off the small delta produced by inertia scroll.
  463. */
  464. wheelMinThreshold?: number;
  465. /**
  466. * The sleep time in milliseconds until accepting next wheel.
  467. * The timer starts when the transition begins.
  468. */
  469. wheelSleep?: number;
  470. /**
  471. * Determines whether to release the wheel event when the slider reaches the first or last slide.
  472. */
  473. releaseWheel?: boolean;
  474. /**
  475. * The direction of the slider.
  476. * - 'ltr': Left to right
  477. * - 'rtl': Right to left
  478. * - 'ttb': Top to bottom
  479. */
  480. direction?: 'ltr' | 'rtl' | 'ttb';
  481. /**
  482. * Converts the image `src` to the css `background-image` URL of the parent element.
  483. * This requires `fixedHeight` or `heightRatio` option.
  484. */
  485. cover?: boolean;
  486. /**
  487. * Determines whether to add `tabindex="0"` to visible slides or not.
  488. */
  489. slideFocus?: boolean;
  490. /**
  491. * If `true`, the slider makes slides clickable to navigate another slider.
  492. * Use `Splide#sync()` to sync multiple sliders.
  493. */
  494. isNavigation?: boolean;
  495. /**
  496. * Determines whether to trim spaces before/after the slider if the `focus` option is available.
  497. * - `true`: Trims spaces. The slider may stay on the same location even when requested to move.
  498. * - `'move'`: Trims spaces and forces to move the slider when requested.
  499. */
  500. trimSpace?: boolean | 'move';
  501. /**
  502. * If `true` and the `focus` option is available:
  503. * - Disables the next arrow when a carousel reaches the last page even if the active slide is not the last slide.
  504. * - Omits redundant pagination dots which just change the active slide and do not move a carousel.
  505. */
  506. omitEnd?: boolean;
  507. /**
  508. * Updates the `is-active` status of slides just before moving the slider.
  509. */
  510. updateOnMove?: boolean;
  511. /**
  512. * If `min`, the media query for breakpoints will be `min-width`, or otherwise, `max-width`.
  513. */
  514. mediaQuery?: 'min' | 'max';
  515. /**
  516. * The selector to find focusable elements
  517. * where `tabindex="-1"` will be assigned when their ascendant slide is hidden.
  518. */
  519. focusableNodes?: string;
  520. /**
  521. * The selector for nodes that cannot be dragged.
  522. */
  523. noDrag?: string;
  524. /**
  525. * Enables the live region by `aria-live`.
  526. * If `true`, screen readers will read a content of each slide whenever slide changes.
  527. */
  528. live?: boolean;
  529. /**
  530. * Determines whether to use the Transition component or not.
  531. */
  532. useScroll?: boolean;
  533. /**
  534. * Options for specific breakpoints.
  535. *
  536. * @example
  537. * ```ts
  538. * {
  539. * 1000: {
  540. * perPage: 3,
  541. * gap : 20
  542. * },
  543. * 600: {
  544. * perPage: 1,
  545. * gap : 5,
  546. * },
  547. * }
  548. * ```
  549. */
  550. breakpoints?: Record<string | number, ResponsiveOptions>;
  551. /**
  552. * Options used when the `(prefers-reduced-motion: reduce)` is detected.
  553. */
  554. reducedMotion?: Options;
  555. /**
  556. * The collection of class names.
  557. */
  558. classes?: Record<string, string>;
  559. /**
  560. * The collection of i18n strings.
  561. */
  562. i18n?: Record<keyof typeof I18N | string, string>;
  563. }
  564. /**
  565. * The interface for options that can correspond with breakpoints.
  566. *
  567. * @since 3.0.0
  568. */
  569. interface ResponsiveOptions {
  570. /**
  571. * Accepts arbitrary properties for extensions, although it's not ideal typing.
  572. */
  573. [key: string]: any;
  574. /**
  575. * The label for the root element.
  576. * Use `labelledby` instead if there is a visible label.
  577. */
  578. label?: string;
  579. /**
  580. * The ID for the element that used as the label of the carousel.
  581. */
  582. labelledby?: string;
  583. /**
  584. * The transition speed in milliseconds.
  585. */
  586. speed?: number;
  587. /**
  588. * Determines whether to rewind the carousel or not.
  589. * This is ignored when the `type` option is `'loop'`.
  590. */
  591. rewind?: boolean;
  592. /**
  593. * The transition speed on rewind in milliseconds.
  594. */
  595. rewindSpeed?: number;
  596. /**
  597. * Allows to rewind a carousel by drag if the `rewind` option is enabled.
  598. */
  599. rewindByDrag?: boolean;
  600. /**
  601. * Defines the slider max width, accepting the CSS format such as 10em, 80vw.
  602. */
  603. width?: number | string;
  604. /**
  605. * Defines the slider height, accepting the CSS format.
  606. */
  607. height?: number | string;
  608. /**
  609. * Fixes width of slides, accepting the CSS format.
  610. * The slider will ignore the `perPage` option if you provide this value.
  611. */
  612. fixedWidth?: number | string;
  613. /**
  614. * Fixes height of slides, accepting the CSS format.
  615. * The slider will ignore the `heightRatio` option if you provide this value.
  616. */
  617. fixedHeight?: number | string;
  618. /**
  619. * Determines height of slides by the ratio to the slider width.
  620. * For example, when the slider width is `1000` and the ratio is `0.5`, the height will be `500`.
  621. */
  622. heightRatio?: number;
  623. /**
  624. * Determines the number of slides to display in a page.
  625. */
  626. perPage?: number;
  627. /**
  628. * Determines the number of slides to move at once.
  629. */
  630. perMove?: number;
  631. /**
  632. * Determine the number of clones on each side of the slider.
  633. * In most cases, you don't need to provide this value.
  634. */
  635. clones?: number;
  636. /**
  637. * Determines whether to clone status classes for clones or not.
  638. */
  639. cloneStatus?: boolean;
  640. /**
  641. * Determines which slide should be active if there are multiple slides in a page.
  642. * Numbers and `'center'` are acceptable.
  643. */
  644. focus?: number | 'center';
  645. /**
  646. * The gap between slides. The CSS format is acceptable, such as `1em`.
  647. */
  648. gap?: number | string;
  649. /**
  650. * Sets padding left/right or top/bottom of the slider.
  651. * The CSS format is acceptable, such as `1em`.
  652. *
  653. * @example
  654. * ```ts
  655. * // By number
  656. * padding: 10,
  657. *
  658. * // By the CSS format
  659. * padding: '1rem',
  660. *
  661. * // Specifies each value for a horizontal slider
  662. * padding: { left: 10, right: 20 },
  663. * padding: { left: '1rem', right: '2rem' },
  664. *
  665. * // Specified each value for a vertical slider
  666. * padding: { top: 10, bottom: 20 },
  667. * ```
  668. */
  669. padding?: number | string | {
  670. left?: number | string;
  671. right?: number | string;
  672. } | {
  673. top?: number | string;
  674. bottom?: number | string;
  675. };
  676. /**
  677. * Determines whether to create/find arrows or not.
  678. */
  679. arrows?: boolean;
  680. /**
  681. * Determines whether to create pagination (indicator dots) or not.
  682. */
  683. pagination?: boolean;
  684. /**
  685. * Determines whether to enable keyboard shortcuts for pagination when it contains focus.
  686. * The default value is `true`.
  687. */
  688. paginationKeyboard?: boolean;
  689. /**
  690. * Explicitly sets the pagination direction that does not only affect appearance but also shortcuts and ARIA attributes.
  691. * The default value is same with the carousel direction.
  692. */
  693. paginationDirection?: Options['direction'];
  694. /**
  695. * The timing function for the CSS transition. For example, `linear`, ease or `cubic-bezier()`.
  696. */
  697. easing?: string;
  698. /**
  699. * The easing function for the drag free mode.
  700. * The default function is the `easeOutQuart` interpolation.
  701. */
  702. easingFunc?: (t: number) => number;
  703. /**
  704. * Allows to drag the slider by a mouse or swipe.
  705. * If `free`, the slider does not snap to a slide after drag.
  706. */
  707. drag?: boolean | 'free';
  708. /**
  709. * Snaps the closest slide in the drag-free mode.
  710. */
  711. snap?: boolean;
  712. /**
  713. * The required distance to start moving the slider by the touch action.
  714. * If you want to define the threshold for the mouse, provide an object.
  715. */
  716. dragMinThreshold?: number | {
  717. mouse: number;
  718. touch: number;
  719. };
  720. /**
  721. * Determine the power of "flick". The larger number this is, the farther the slider runs.
  722. * Around 500 is recommended.
  723. */
  724. flickPower?: number;
  725. /**
  726. * Limits the number of pages to move by "flick".
  727. */
  728. flickMaxPages?: number;
  729. /**
  730. * Destroys the slider.
  731. */
  732. destroy?: boolean | 'completely';
  733. }
  734. /**
  735. * The type for any function.
  736. *
  737. * @since 3.0.0
  738. */
  739. declare type AnyFunction = (...args: any[]) => any;
  740. /**
  741. * The type for a component.
  742. *
  743. * @since 3.0.0
  744. */
  745. declare type ComponentConstructor = (Splide: Splide, Components: Components, options: Options, event: EventInterface) => BaseComponent;
  746. /**
  747. * The interface for any component.
  748. *
  749. * @since 3.0.0
  750. */
  751. interface BaseComponent {
  752. setup?(): void;
  753. mount?(): void;
  754. destroy?(completely?: boolean): void;
  755. }
  756. /**
  757. * The interface for the Transition component.
  758. *
  759. * @since 3.0.0
  760. */
  761. interface TransitionComponent extends BaseComponent {
  762. start(index: number, done: () => void): void;
  763. cancel(): void;
  764. }
  765. /**
  766. * The interface for info of a splide instance to sync with.
  767. *
  768. * @since 3.2.8
  769. */
  770. interface SyncTarget {
  771. splide: Splide;
  772. isParent?: boolean;
  773. }
  774. /**
  775. * The interface for all components.
  776. *
  777. * @since 3.0.0
  778. */
  779. interface Components {
  780. [key: string]: BaseComponent | undefined;
  781. Media: MediaComponent;
  782. Direction: DirectionComponent;
  783. Elements: ElementsComponent;
  784. Slides: SlidesComponent;
  785. Layout: LayoutComponent;
  786. Clones: ClonesComponent;
  787. Move: MoveComponent;
  788. Controller: ControllerComponent;
  789. Arrows: ArrowsComponent;
  790. Autoplay: AutoplayComponent;
  791. Cover: CoverComponent;
  792. Scroll: ScrollComponent;
  793. Drag: DragComponent;
  794. Keyboard: KeyboardComponent;
  795. LazyLoad: LazyLoadComponent;
  796. Pagination: PaginationComponent;
  797. Sync: SyncComponent;
  798. Wheel: WheelComponent;
  799. Live: LiveComponent;
  800. Transition: TransitionComponent;
  801. }
  802. /**
  803. * The interface for all internal events.
  804. *
  805. * @since 3.0.0
  806. */
  807. interface EventMap {
  808. 'mounted': () => void;
  809. 'ready': () => void;
  810. 'click': (Slide: SlideComponent, e: MouseEvent) => void;
  811. 'move': (index: number, prev: number, dest: number) => void;
  812. 'moved': (index: number, prev: number, dest: number) => void;
  813. 'active': (Slide: SlideComponent) => void;
  814. 'inactive': (Slide: SlideComponent) => void;
  815. 'visible': (Slide: SlideComponent) => void;
  816. 'hidden': (Slide: SlideComponent) => void;
  817. 'refresh': () => void;
  818. 'updated': (options: Options) => void;
  819. 'resize': () => void;
  820. 'resized': () => void;
  821. 'drag': () => void;
  822. 'dragging': () => void;
  823. 'dragged': () => void;
  824. 'scroll': () => void;
  825. 'scrolled': () => void;
  826. 'overflow': (overflow: boolean) => void;
  827. 'destroy': () => void;
  828. 'arrows:mounted': (prev: HTMLButtonElement, next: HTMLButtonElement) => void;
  829. 'arrows:updated': (prev: HTMLButtonElement, next: HTMLButtonElement, prevIndex: number, nextIndex: number) => void;
  830. 'pagination:mounted': (data: PaginationData, item: PaginationItem) => void;
  831. 'pagination:updated': (data: PaginationData, prev: PaginationItem, curr: PaginationItem) => void;
  832. 'navigation:mounted': (splides: Splide[]) => void;
  833. 'autoplay:play': () => void;
  834. 'autoplay:playing': (rate: number) => void;
  835. 'autoplay:pause': () => void;
  836. 'lazyload:loaded': (img: HTMLImageElement, Slide: SlideComponent) => void;
  837. }
  838. /**
  839. * Casts T to U.
  840. *
  841. * @internal
  842. */
  843. declare type Cast<T, U> = T extends U ? T : U;
  844. /**
  845. * Makes the T easy to read.
  846. */
  847. declare type Resolve<T> = {
  848. [K in keyof T]: T[K];
  849. } & unknown;
  850. /**
  851. * Pushes U to tuple T.
  852. *
  853. * @internal
  854. */
  855. declare type Push<T extends any[], U = any> = [...T, U];
  856. /**
  857. * Returns the first type of the tuple.
  858. *
  859. * @internal
  860. */
  861. declare type Head<T extends any[]> = ((...args: T) => any) extends (arg: infer A, ...args: any[]) => any ? A : never;
  862. /**
  863. * Removes the first type from the tuple T.
  864. *
  865. * @internal
  866. */
  867. declare type Shift<T extends any[]> = ((...args: T) => any) extends (arg: any, ...args: infer A) => any ? A : never;
  868. /**
  869. * Removes the N types from the tuple T.
  870. *
  871. * @internal
  872. */
  873. declare type ShiftN<T extends any[], N extends number, C extends any[] = []> = {
  874. 0: T;
  875. 1: ShiftN<Shift<T>, N, Push<C>>;
  876. }[C['length'] extends N ? 0 : 1] extends infer A ? Cast<A, any[]> : never;
  877. /**
  878. * The interface for the Slides component.
  879. *
  880. * @since 3.0.0
  881. */
  882. interface SlidesComponent extends BaseComponent {
  883. update(): void;
  884. register(slide: HTMLElement, index: number, slideIndex: number): void;
  885. get(excludeClones?: boolean): SlideComponent[];
  886. getIn(page: number): SlideComponent[];
  887. getAt(index: number): SlideComponent | undefined;
  888. add(slide: string | Element | Array<string | Element>, index?: number): void;
  889. remove(selector: SlideMatcher): void;
  890. forEach(iteratee: SlidesIteratee, excludeClones?: boolean): void;
  891. filter(matcher: SlideMatcher): SlideComponent[];
  892. style(prop: string, value: string | number, useContainer?: boolean): void;
  893. getLength(excludeClones?: boolean): number;
  894. isEnough(): boolean;
  895. }
  896. /**
  897. * The iteratee function for Slides.
  898. *
  899. * @since 3.0.0
  900. */
  901. declare type SlidesIteratee = (Slide: SlideComponent, index: number, Slides: SlideComponent[]) => void;
  902. /**
  903. * The predicate function for Slides.
  904. *
  905. * @since 3.0.0
  906. */
  907. declare type SlidesPredicate = (Slide: SlideComponent, index: number, Slides: SlideComponent[]) => any;
  908. /**
  909. * The type for filtering SlideComponent objects.
  910. *
  911. * @since 3.0.0
  912. */
  913. declare type SlideMatcher = number | number[] | string | SlidesPredicate;
  914. /**
  915. * The frontend class for the Splide slider.
  916. *
  917. * @since 3.0.0
  918. */
  919. declare class Splide {
  920. /**
  921. * Changes the default options for all Splide instances.
  922. */
  923. static defaults: Options;
  924. /**
  925. * The collection of state numbers.
  926. */
  927. static readonly STATES: {
  928. CREATED: number;
  929. MOUNTED: number;
  930. IDLE: number;
  931. MOVING: number;
  932. SCROLLING: number;
  933. DRAGGING: number;
  934. DESTROYED: number;
  935. };
  936. /**
  937. * The root element where the Splide is applied.
  938. */
  939. readonly root: HTMLElement;
  940. /**
  941. * The EventBusObject object.
  942. */
  943. readonly event: EventInterface<Record<string, AnyFunction$1>>;
  944. /**
  945. * The collection of all component objects.
  946. */
  947. readonly Components: Components;
  948. /**
  949. * The StateObject object.
  950. */
  951. readonly state: State;
  952. /**
  953. * An array with SyncTarget objects for splide instances to sync with.
  954. */
  955. readonly splides: SyncTarget[];
  956. /**
  957. * The current options.
  958. */
  959. private readonly _o;
  960. /**
  961. * The collection of all components.
  962. */
  963. private _C;
  964. /**
  965. * The collection of extensions.
  966. */
  967. private _E;
  968. /**
  969. * The Transition component.
  970. */
  971. private _T;
  972. /**
  973. * The Splide constructor.
  974. *
  975. * @param target - The selector for the target element, or the element itself.
  976. * @param options - Optional. An object with options.
  977. */
  978. constructor(target: string | HTMLElement, options?: Options);
  979. /**
  980. * Initializes the instance.
  981. *
  982. * @param Extensions - Optional. An object with extensions.
  983. * @param Transition - Optional. A Transition component.
  984. *
  985. * @return `this`
  986. */
  987. mount(Extensions?: Record<string, ComponentConstructor>, Transition?: ComponentConstructor): this;
  988. /**
  989. * Syncs the slider with the provided one.
  990. * This method must be called before the `mount()`.
  991. *
  992. * @example
  993. * ```ts
  994. * const primary = new Splide();
  995. * const secondary = new Splide();
  996. *
  997. * primary.sync( secondary );
  998. * primary.mount();
  999. * secondary.mount();
  1000. * ```
  1001. *
  1002. * @param splide - A Splide instance to sync with.
  1003. *
  1004. * @return `this`
  1005. */
  1006. sync(splide: Splide): this;
  1007. /**
  1008. * Moves the slider with the following control pattern.
  1009. *
  1010. * | Pattern | Description |
  1011. * |---|---|
  1012. * | `i` | Goes to the slide `i` |
  1013. * | `'+${i}'` | Increments the slide index by `i` |
  1014. * | `'-${i}'` | Decrements the slide index by `i` |
  1015. * | `'>'` | Goes to the next page |
  1016. * | `'<'` | Goes to the previous page |
  1017. * | `>${i}` | Goes to the page `i` |
  1018. *
  1019. * In most cases, `'>'` and `'<'` notations are enough to control the slider
  1020. * because they respect `perPage` and `perMove` options.
  1021. *
  1022. * @example
  1023. * ```ts
  1024. * const splide = new Splide();
  1025. *
  1026. * // Goes to the slide 1:
  1027. * splide.go( 1 );
  1028. *
  1029. * // Increments the index:
  1030. * splide.go( '+2' );
  1031. *
  1032. * // Goes to the next page:
  1033. * splide.go( '>' );
  1034. *
  1035. * // Goes to the page 2:
  1036. * splide.go( '>2' );
  1037. * ```
  1038. *
  1039. * @param control - A control pattern.
  1040. *
  1041. * @return `this`
  1042. */
  1043. go(control: number | string): this;
  1044. /**
  1045. * Registers an event handler.
  1046. *
  1047. * @example
  1048. * ```ts
  1049. * const splide = new Splide();
  1050. *
  1051. * // Listens to a single event:
  1052. * splide.on( 'move', function() {} );
  1053. *
  1054. * // Listens to multiple events:
  1055. * splide.on( 'move resize', function() {} );
  1056. *
  1057. * // Appends a namespace:
  1058. * splide.on( 'move.myNamespace resize.myNamespace', function() {} );
  1059. * ```
  1060. *
  1061. * @param events - An event name or names separated by spaces. Use a dot(.) to append a namespace.
  1062. * @param callback - A callback function.
  1063. *
  1064. * @return `this`
  1065. */
  1066. on<K extends keyof EventMap>(events: K, callback: EventMap[K]): this;
  1067. on(events: string | string[], callback: AnyFunction): this;
  1068. /**
  1069. * Removes the registered all handlers for the specified event or events.
  1070. * If you want to only remove a particular handler, use namespace to identify it.
  1071. *
  1072. * @example
  1073. * ```ts
  1074. * const splide = new Splide();
  1075. *
  1076. * // Removes all handlers assigned to "move":
  1077. * splide.off( 'move' );
  1078. *
  1079. * // Only removes handlers that belong to the specified namespace:
  1080. * splide.off( 'move.myNamespace' );
  1081. * ```
  1082. *
  1083. * @param events - An event name or names separated by spaces. Use a dot(.) to append a namespace.
  1084. * @param callback - A callback function to remove.
  1085. *
  1086. * @return `this`
  1087. */
  1088. off<K extends keyof EventMap>(events: K | K[] | string | string[], callback: AnyFunction): this;
  1089. /**
  1090. * Emits an event and triggers registered handlers.
  1091. *
  1092. * @param event - An event name to emit.
  1093. * @param args - Optional. Any number of arguments to pass to handlers.
  1094. *
  1095. * @return `this`
  1096. */
  1097. emit<K extends keyof EventMap>(event: K, ...args: Parameters<EventMap[K]>): this;
  1098. emit(event: string, ...args: any[]): this;
  1099. /**
  1100. * Inserts a slide at the specified position.
  1101. *
  1102. * @example
  1103. * ```ts
  1104. * const splide = new Splide();
  1105. * splide.mount();
  1106. *
  1107. * // Adds the slide by the HTML:
  1108. * splide.add( '<li></li> );
  1109. *
  1110. * // or adds the element:
  1111. * splide.add( document.createElement( 'li' ) );
  1112. * ```
  1113. *
  1114. * @param slides - A slide element, an HTML string that represents a slide, or an array with them.
  1115. * @param index - Optional. An index to insert a slide at.
  1116. *
  1117. * @return `this`
  1118. */
  1119. add(slides: string | HTMLElement | Array<string | HTMLElement>, index?: number): this;
  1120. /**
  1121. * Removes slides that match the matcher
  1122. * that can be an index, an array with indices, a selector, or an iteratee function.
  1123. *
  1124. * @param matcher - An index, an array with indices, a selector string, or an iteratee function.
  1125. */
  1126. remove(matcher: SlideMatcher): this;
  1127. /**
  1128. * Checks the slider type.
  1129. *
  1130. * @param type - A type to test.
  1131. *
  1132. * @return `true` if the type matches the current one, or otherwise `false`.
  1133. */
  1134. is(type: string): boolean;
  1135. /**
  1136. * Refreshes the slider.
  1137. *
  1138. * @return `this`
  1139. */
  1140. refresh(): this;
  1141. /**
  1142. * Destroys the slider.
  1143. *
  1144. * @param completely - Optional. If `true`, Splide will not remount the slider by breakpoints.
  1145. *
  1146. * @return `this`
  1147. */
  1148. destroy(completely?: boolean): this;
  1149. /**
  1150. * Returns options.
  1151. *
  1152. * @return An object with the latest options.
  1153. */
  1154. get options(): Options;
  1155. /**
  1156. * Merges options to the current options and emits `updated` event.
  1157. *
  1158. * @param options - An object with new options.
  1159. */
  1160. set options(options: Options);
  1161. /**
  1162. * Returns the number of slides without clones.
  1163. *
  1164. * @return The number of slides.
  1165. */
  1166. get length(): number;
  1167. /**
  1168. * Returns the active slide index.
  1169. *
  1170. * @return The active slide index.
  1171. */
  1172. get index(): number;
  1173. }
  1174. /**
  1175. * The interface for the content of each slide.
  1176. *
  1177. * @since 3.0.0
  1178. */
  1179. interface SlideContent {
  1180. /**
  1181. * The HTML or text for each slide.
  1182. */
  1183. html?: string;
  1184. /**
  1185. * The collection of styles. They will remain after Splide is applied.
  1186. */
  1187. styles?: Record<string, string | number>;
  1188. /**
  1189. * The collection of attributes. They will remain after Splide is applied.
  1190. */
  1191. attrs?: Record<string, string | number | boolean>;
  1192. }
  1193. /**
  1194. * The interface for the config of the renderer.
  1195. *
  1196. * @since 3.0.0
  1197. */
  1198. interface RendererConfig {
  1199. /**
  1200. * The slider ID.
  1201. */
  1202. id?: string;
  1203. /**
  1204. * The additional class for the root element.
  1205. */
  1206. rootClass?: string;
  1207. /**
  1208. * The tag used for the list element.
  1209. */
  1210. listTag?: string;
  1211. /**
  1212. * The tag used for each slide.
  1213. */
  1214. slideTag?: string;
  1215. /**
  1216. * Determines whether to render arrows or not.
  1217. */
  1218. arrows?: boolean;
  1219. /**
  1220. * Keeps the slider hidden.
  1221. */
  1222. hidden?: boolean;
  1223. /**
  1224. * Determines whether to wrap the track by the slider element or not.
  1225. */
  1226. slider?: boolean;
  1227. /**
  1228. * The additional HTML rendered before the slider element.
  1229. */
  1230. beforeSlider?: string;
  1231. /**
  1232. * The additional HTML rendered after the slider element.
  1233. */
  1234. afterSlider?: string;
  1235. /**
  1236. * The additional HTML rendered before the track element.
  1237. */
  1238. beforeTrack?: string;
  1239. /**
  1240. * The additional HTML rendered after the track element.
  1241. */
  1242. afterTrack?: string;
  1243. }
  1244. /**
  1245. * The class to generate static HTML of the slider for the first view.
  1246. *
  1247. * @since 3.0.0
  1248. */
  1249. declare class SplideRenderer {
  1250. /**
  1251. * Removes a style element and clones.
  1252. *
  1253. * @param splide - A Splide instance.
  1254. */
  1255. static clean(splide: Splide): void;
  1256. /**
  1257. * Holds slide contents.
  1258. */
  1259. private readonly contents;
  1260. /**
  1261. * Stores data of slides.
  1262. */
  1263. private readonly slides;
  1264. /**
  1265. * The Direction component.
  1266. */
  1267. private readonly Direction;
  1268. /**
  1269. * Holds the Style instance.
  1270. */
  1271. private readonly Style;
  1272. /**
  1273. * Holds options.
  1274. */
  1275. private readonly options;
  1276. /**
  1277. * Holds options for this instance.
  1278. */
  1279. private readonly config;
  1280. /**
  1281. * The slider ID.
  1282. */
  1283. private readonly id;
  1284. /**
  1285. * An array with options for each breakpoint.
  1286. */
  1287. private readonly breakpoints;
  1288. /**
  1289. * The SplideRenderer constructor.
  1290. *
  1291. * @param contents - An array with slide contents. Each item must be an HTML or a plain text.
  1292. * @param options - Optional. Slider options.
  1293. * @param config - Static default options.
  1294. * @param defaults - Default options for the slider. Pass `Splide.defaults` if you are using it.
  1295. */
  1296. constructor(contents: string[] | SlideContent[], options?: Options, config?: RendererConfig, defaults?: Options);
  1297. /**
  1298. * Initializes the instance.
  1299. */
  1300. private init;
  1301. /**
  1302. * Initializes slides.
  1303. */
  1304. private initSlides;
  1305. /**
  1306. * Registers styles for the root element.
  1307. */
  1308. private registerRootStyles;
  1309. /**
  1310. * Registers styles for the track element.
  1311. */
  1312. private registerTrackStyles;
  1313. /**
  1314. * Registers styles for the list element.
  1315. */
  1316. private registerListStyles;
  1317. /**
  1318. * Registers styles for slides and clones.
  1319. */
  1320. private registerSlideStyles;
  1321. /**
  1322. * Builds multiple `translateX` for the list element.
  1323. *
  1324. * @param options - Options for each breakpoint.
  1325. *
  1326. * @return A string with multiple translate functions.
  1327. */
  1328. private buildTranslate;
  1329. /**
  1330. * Returns offset for the list element.
  1331. * This does not include gaps because it can not be converted into percent.
  1332. *
  1333. * @param options - Options for each breakpoint.
  1334. *
  1335. * @return The offset.
  1336. */
  1337. private cssOffsetClones;
  1338. /**
  1339. * Returns offset for centering the active slide.
  1340. *
  1341. * Note:
  1342. * ( 100% + gap ) / perPage - gap
  1343. * 100% / perPage + gap / perPage - gap;
  1344. * 50% / perPage + ( gap / perPage - gap ) / 2;
  1345. *
  1346. * @param options - Options for each breakpoint.
  1347. *
  1348. * @return The offset.
  1349. */
  1350. private cssOffsetCenter;
  1351. /**
  1352. * Returns offset for gaps.
  1353. *
  1354. * @param options - Options for each breakpoint.
  1355. *
  1356. * @return The offset as `calc()`.
  1357. */
  1358. private cssOffsetGaps;
  1359. /**
  1360. * Resolves the prop for the current direction and converts it into the Kebab case.
  1361. *
  1362. * @param prop - A property name to resolve.
  1363. *
  1364. * @return A resolved property name in the Kebab case.
  1365. */
  1366. private resolve;
  1367. /**
  1368. * Returns padding in the CSS format.
  1369. *
  1370. * @param options - Options.
  1371. * @param right - Determines whether to get padding right or left.
  1372. *
  1373. * @return Padding in the CSS format.
  1374. */
  1375. private cssPadding;
  1376. /**
  1377. * Returns height of the track element in the CSS format.
  1378. *
  1379. * @param options - Options.
  1380. *
  1381. * @return Height in the CSS format.
  1382. */
  1383. private cssTrackHeight;
  1384. /**
  1385. * Returns height provided though options in the CSS format.
  1386. *
  1387. * @param options - Options.
  1388. *
  1389. * @return Height in the CSS format.
  1390. */
  1391. private cssHeight;
  1392. /**
  1393. * Returns width of each slide in the CSS format.
  1394. *
  1395. * @param options - Options.
  1396. *
  1397. * @return Width in the CSS format.
  1398. */
  1399. private cssSlideWidth;
  1400. /**
  1401. * Returns height of each slide in the CSS format.
  1402. *
  1403. * @param options - Options.
  1404. *
  1405. * @return Height in the CSS format.
  1406. */
  1407. private cssSlideHeight;
  1408. /**
  1409. * Returns width or height of each slide in the CSS format, considering the current direction.
  1410. *
  1411. * @param options - Options.
  1412. *
  1413. * @return Width or height in the CSS format.
  1414. */
  1415. private cssSlideSize;
  1416. /**
  1417. * Returns the aspectRatio value to simulate the `heightRatio` option.
  1418. *
  1419. * @param options - Options.
  1420. *
  1421. * @return aspectRatio in the CSS format.
  1422. */
  1423. private cssAspectRatio;
  1424. /**
  1425. * Builds the css value by the provided value and unit.
  1426. *
  1427. * @param value - A value.
  1428. * @param unit - A CSS unit.
  1429. *
  1430. * @return A built value for a CSS value.
  1431. */
  1432. private buildCssValue;
  1433. /**
  1434. * Parses the CSS value into number and unit.
  1435. *
  1436. * @param value - A value to parse.
  1437. *
  1438. * @return An object with value and unit.
  1439. */
  1440. private parseCssValue;
  1441. /**
  1442. * Parses breakpoints and generate options for each breakpoint.
  1443. */
  1444. private parseBreakpoints;
  1445. /**
  1446. * Checks if the slide width is fixed or not.
  1447. *
  1448. * @return `true` if the slide width is fixed, or otherwise `false`.
  1449. */
  1450. private isFixedWidth;
  1451. /**
  1452. * Checks if the slider type is loop or not.
  1453. *
  1454. * @return `true` if the slider type is loop, or otherwise `false`.
  1455. */
  1456. private isLoop;
  1457. /**
  1458. * Checks if the active slide should be centered or not.
  1459. *
  1460. * @return `true` if the slide should be centered, or otherwise `false`.
  1461. */
  1462. private isCenter;
  1463. /**
  1464. * Checks if the direction is TTB or not.
  1465. *
  1466. * @return `true` if the direction is TTB, or otherwise `false`.
  1467. */
  1468. private isVertical;
  1469. /**
  1470. * Builds classes of the root element.
  1471. *
  1472. * @return Classes for the root element as a single string.
  1473. */
  1474. private buildClasses;
  1475. /**
  1476. * Converts provided attributes into a single string.
  1477. *
  1478. * @param attrs - An object with attributes.
  1479. *
  1480. * @return A built string.
  1481. */
  1482. private buildAttrs;
  1483. /**
  1484. * Converts provided styles into a single string.
  1485. *
  1486. * @param styles - An object with styles.
  1487. *
  1488. * @return A built string.
  1489. */
  1490. private buildStyles;
  1491. /**
  1492. * Generates HTML of slides with inserting provided contents.
  1493. *
  1494. * @return The HTML for all slides and clones.
  1495. */
  1496. private renderSlides;
  1497. /**
  1498. * Add the `background` style for the cover mode.
  1499. *
  1500. * @param content - A slide content.
  1501. */
  1502. private cover;
  1503. /**
  1504. * Generates clones.
  1505. *
  1506. * @param contents - An array with SlideContent objects.
  1507. */
  1508. private generateClones;
  1509. /**
  1510. * Returns the number of clones to generate.
  1511. *
  1512. * @return A number of clones.
  1513. */
  1514. private getCloneCount;
  1515. /**
  1516. * Generates arrows and the wrapper element.
  1517. *
  1518. * @return The HTML for arrows.
  1519. */
  1520. private renderArrows;
  1521. /**
  1522. * Generates an arrow HTML.
  1523. * Some attributes are temporary, and Splide changes them after mount.
  1524. *
  1525. * @param prev - Options for each breakpoint.
  1526. *
  1527. * @return The HTML for the prev or next arrow.
  1528. */
  1529. private renderArrow;
  1530. /**
  1531. * Returns the HTML of the slider.
  1532. *
  1533. * @return The generated HTML.
  1534. */
  1535. html(): string;
  1536. }
  1537. declare const EVENT_MOUNTED = "mounted";
  1538. declare const EVENT_READY = "ready";
  1539. declare const EVENT_MOVE = "move";
  1540. declare const EVENT_MOVED = "moved";
  1541. declare const EVENT_CLICK = "click";
  1542. declare const EVENT_ACTIVE = "active";
  1543. declare const EVENT_INACTIVE = "inactive";
  1544. declare const EVENT_VISIBLE = "visible";
  1545. declare const EVENT_HIDDEN = "hidden";
  1546. declare const EVENT_REFRESH = "refresh";
  1547. declare const EVENT_UPDATED = "updated";
  1548. declare const EVENT_RESIZE = "resize";
  1549. declare const EVENT_RESIZED = "resized";
  1550. declare const EVENT_DRAG = "drag";
  1551. declare const EVENT_DRAGGING = "dragging";
  1552. declare const EVENT_DRAGGED = "dragged";
  1553. declare const EVENT_SCROLL = "scroll";
  1554. declare const EVENT_SCROLLED = "scrolled";
  1555. declare const EVENT_OVERFLOW = "overflow";
  1556. declare const EVENT_DESTROY = "destroy";
  1557. declare const EVENT_ARROWS_MOUNTED = "arrows:mounted";
  1558. declare const EVENT_ARROWS_UPDATED = "arrows:updated";
  1559. declare const EVENT_PAGINATION_MOUNTED = "pagination:mounted";
  1560. declare const EVENT_PAGINATION_UPDATED = "pagination:updated";
  1561. declare const EVENT_NAVIGATION_MOUNTED = "navigation:mounted";
  1562. declare const EVENT_AUTOPLAY_PLAY = "autoplay:play";
  1563. declare const EVENT_AUTOPLAY_PLAYING = "autoplay:playing";
  1564. declare const EVENT_AUTOPLAY_PAUSE = "autoplay:pause";
  1565. declare const EVENT_LAZYLOAD_LOADED = "lazyload:loaded";
  1566. /** @internal */
  1567. declare const EVENT_SLIDE_KEYDOWN = "sk";
  1568. declare const EVENT_SHIFTED = "sh";
  1569. declare const EVENT_END_INDEX_CHANGED = "ei";
  1570. /**
  1571. * All classes as constants.
  1572. */
  1573. declare const CLASS_ROOT = "splide";
  1574. declare const CLASS_TRACK: string;
  1575. declare const CLASS_LIST: string;
  1576. declare const CLASS_SLIDE: string;
  1577. declare const CLASS_CLONE: string;
  1578. declare const CLASS_CONTAINER: string;
  1579. declare const CLASS_ARROWS: string;
  1580. declare const CLASS_ARROW: string;
  1581. declare const CLASS_ARROW_PREV: string;
  1582. declare const CLASS_ARROW_NEXT: string;
  1583. declare const CLASS_PAGINATION: string;
  1584. declare const CLASS_PAGINATION_PAGE: string;
  1585. declare const CLASS_PROGRESS: string;
  1586. declare const CLASS_PROGRESS_BAR: string;
  1587. declare const CLASS_TOGGLE: string;
  1588. declare const CLASS_TOGGLE_PLAY: string;
  1589. declare const CLASS_TOGGLE_PAUSE: string;
  1590. declare const CLASS_SPINNER: string;
  1591. declare const CLASS_SR: string;
  1592. declare const CLASS_INITIALIZED: string;
  1593. declare const CLASS_ACTIVE: string;
  1594. declare const CLASS_PREV: string;
  1595. declare const CLASS_NEXT: string;
  1596. declare const CLASS_VISIBLE: string;
  1597. declare const CLASS_LOADING: string;
  1598. declare const CLASS_FOCUS_IN: string;
  1599. declare const CLASS_OVERFLOW: string;
  1600. /**
  1601. * The array with all status classes except for `is-initialized`.
  1602. *
  1603. * @since 3.0.0
  1604. */
  1605. declare const STATUS_CLASSES: string[];
  1606. /**
  1607. * The collection of classes for elements that Splide dynamically creates.
  1608. *
  1609. * @since 3.0.0
  1610. */
  1611. declare const CLASSES: {
  1612. slide: string;
  1613. clone: string;
  1614. arrows: string;
  1615. arrow: string;
  1616. prev: string;
  1617. next: string;
  1618. pagination: string;
  1619. page: string;
  1620. spinner: string;
  1621. };
  1622. /**
  1623. * The collection of default options.
  1624. * Note that this collection does not contain all options.
  1625. *
  1626. * @since 3.0.0
  1627. */
  1628. declare const DEFAULTS: Options;
  1629. /**
  1630. * Enumerates slides from left to right.
  1631. */
  1632. declare const LTR = "ltr";
  1633. /**
  1634. * Enumerates slides from right to left.
  1635. */
  1636. declare const RTL = "rtl";
  1637. /**
  1638. * Enumerates slides in a col.
  1639. */
  1640. declare const TTB = "ttb";
  1641. /**
  1642. * The type for the regular slider.
  1643. *
  1644. * @since 3.0.0
  1645. */
  1646. declare const SLIDE = "slide";
  1647. /**
  1648. * The type for the carousel slider.
  1649. *
  1650. * @since 3.0.0
  1651. */
  1652. declare const LOOP = "loop";
  1653. /**
  1654. * The type for the fade slider that can not have multiple slides in a page.
  1655. *
  1656. * @since 3.0.0
  1657. */
  1658. declare const FADE = "fade";
  1659. export { AnyFunction, ArrowsComponent, AutoplayComponent, BaseComponent, CLASSES, CLASS_ACTIVE, CLASS_ARROW, CLASS_ARROWS, CLASS_ARROW_NEXT, CLASS_ARROW_PREV, CLASS_CLONE, CLASS_CONTAINER, CLASS_FOCUS_IN, CLASS_INITIALIZED, CLASS_LIST, CLASS_LOADING, CLASS_NEXT, CLASS_OVERFLOW, CLASS_PAGINATION, CLASS_PAGINATION_PAGE, CLASS_PREV, CLASS_PROGRESS, CLASS_PROGRESS_BAR, CLASS_ROOT, CLASS_SLIDE, CLASS_SPINNER, CLASS_SR, CLASS_TOGGLE, CLASS_TOGGLE_PAUSE, CLASS_TOGGLE_PLAY, CLASS_TRACK, CLASS_VISIBLE, Cast, ClonesComponent, ComponentConstructor, Components, ControllerComponent, CoverComponent, DEFAULTS, DirectionComponent, DragComponent, EVENT_ACTIVE, EVENT_ARROWS_MOUNTED, EVENT_ARROWS_UPDATED, EVENT_AUTOPLAY_PAUSE, EVENT_AUTOPLAY_PLAY, EVENT_AUTOPLAY_PLAYING, EVENT_CLICK, EVENT_DESTROY, EVENT_DRAG, EVENT_DRAGGED, EVENT_DRAGGING, EVENT_END_INDEX_CHANGED, EVENT_HIDDEN, EVENT_INACTIVE, EVENT_LAZYLOAD_LOADED, EVENT_MOUNTED, EVENT_MOVE, EVENT_MOVED, EVENT_NAVIGATION_MOUNTED, EVENT_OVERFLOW, EVENT_PAGINATION_MOUNTED, EVENT_PAGINATION_UPDATED, EVENT_READY, EVENT_REFRESH, EVENT_RESIZE, EVENT_RESIZED, EVENT_SCROLL, EVENT_SCROLLED, EVENT_SHIFTED, EVENT_SLIDE_KEYDOWN, EVENT_UPDATED, EVENT_VISIBLE, ElementsComponent, EventMap, FADE, Head, KeyboardComponent, LOOP, LTR, LayoutComponent, LazyLoadComponent, LiveComponent, MediaComponent, MoveComponent, Options, PaginationComponent, PaginationData, PaginationItem, Push, RTL, Resolve, ResponsiveOptions, SLIDE, STATUS_CLASSES, ScrollComponent, Shift, ShiftN, SlideComponent, SlidesComponent, Splide, SplideRenderer, SyncComponent, SyncTarget, TTB, TransitionComponent, WheelComponent, Splide as default };