index.d.ts 44 KB

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