index.d.ts 47 KB

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