index.d.ts 45 KB

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