index.d.ts 46 KB

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