index.d.ts 46 KB

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