index.d.ts 45 KB

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