index.d.ts 46 KB

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