index.d.ts 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. declare const figureSet: {
  2. readonly tick: string;
  3. readonly info: string;
  4. readonly warning: string;
  5. readonly cross: string;
  6. readonly square: string;
  7. readonly squareSmall: string;
  8. readonly squareSmallFilled: string;
  9. readonly squareDarkShade: string;
  10. readonly squareMediumShade: string;
  11. readonly squareLightShade: string;
  12. readonly squareTop: string;
  13. readonly squareBottom: string;
  14. readonly squareLeft: string;
  15. readonly squareRight: string;
  16. readonly squareCenter: string;
  17. readonly circle: string;
  18. readonly circleFilled: string;
  19. readonly circleDotted: string;
  20. readonly circleDouble: string;
  21. readonly circleCircle: string;
  22. readonly circleCross: string;
  23. readonly circlePipe: string;
  24. readonly circleQuestionMark: string;
  25. readonly radioOn: string;
  26. readonly radioOff: string;
  27. readonly checkboxOn: string;
  28. readonly checkboxOff: string;
  29. readonly checkboxCircleOn: string;
  30. readonly checkboxCircleOff: string;
  31. readonly questionMarkPrefix: string;
  32. readonly bullet: string;
  33. readonly dot: string;
  34. readonly ellipsis: string;
  35. readonly pointer: string;
  36. readonly pointerSmall: string;
  37. readonly triangleUp: string;
  38. readonly triangleUpSmall: string;
  39. readonly triangleUpOutline: string;
  40. readonly triangleDown: string;
  41. readonly triangleDownSmall: string;
  42. readonly triangleLeft: string;
  43. readonly triangleLeftSmall: string;
  44. readonly triangleRight: string;
  45. readonly triangleRightSmall: string;
  46. readonly lozenge: string;
  47. readonly lozengeOutline: string;
  48. readonly home: string;
  49. readonly hamburger: string;
  50. readonly smiley: string;
  51. readonly mustache: string;
  52. readonly heart: string;
  53. readonly star: string;
  54. readonly play: string;
  55. readonly musicNote: string;
  56. readonly musicNoteBeamed: string;
  57. readonly nodejs: string;
  58. readonly arrowUp: string;
  59. readonly arrowDown: string;
  60. readonly arrowLeft: string;
  61. readonly arrowRight: string;
  62. readonly arrowLeftRight: string;
  63. readonly arrowUpDown: string;
  64. readonly almostEqual: string;
  65. readonly notEqual: string;
  66. readonly lessOrEqual: string;
  67. readonly greaterOrEqual: string;
  68. readonly identical: string;
  69. readonly infinity: string;
  70. readonly subscriptZero: string;
  71. readonly subscriptOne: string;
  72. readonly subscriptTwo: string;
  73. readonly subscriptThree: string;
  74. readonly subscriptFour: string;
  75. readonly subscriptFive: string;
  76. readonly subscriptSix: string;
  77. readonly subscriptSeven: string;
  78. readonly subscriptEight: string;
  79. readonly subscriptNine: string;
  80. readonly oneHalf: string;
  81. readonly oneThird: string;
  82. readonly oneQuarter: string;
  83. readonly oneFifth: string;
  84. readonly oneSixth: string;
  85. readonly oneSeventh: string;
  86. readonly oneEighth: string;
  87. readonly oneNinth: string;
  88. readonly oneTenth: string;
  89. readonly twoThirds: string;
  90. readonly twoFifths: string;
  91. readonly threeQuarters: string;
  92. readonly threeFifths: string;
  93. readonly threeEighths: string;
  94. readonly fourFifths: string;
  95. readonly fiveSixths: string;
  96. readonly fiveEighths: string;
  97. readonly sevenEighth: string;
  98. readonly line: string;
  99. readonly lineBold: string;
  100. readonly lineDouble: string;
  101. readonly lineDashed0: string;
  102. readonly lineDashed1: string;
  103. readonly lineDashed2: string;
  104. readonly lineDashed3: string;
  105. readonly lineDashed4: string;
  106. readonly lineDashed5: string;
  107. readonly lineDashed6: string;
  108. readonly lineDashed7: string;
  109. readonly lineDashed8: string;
  110. readonly lineDashed9: string;
  111. readonly lineDashed10: string;
  112. readonly lineDashed11: string;
  113. readonly lineDashed12: string;
  114. readonly lineDashed13: string;
  115. readonly lineDashed14: string;
  116. readonly lineDashed15: string;
  117. readonly lineVertical: string;
  118. readonly lineVerticalBold: string;
  119. readonly lineVerticalDouble: string;
  120. readonly lineVerticalDashed0: string;
  121. readonly lineVerticalDashed1: string;
  122. readonly lineVerticalDashed2: string;
  123. readonly lineVerticalDashed3: string;
  124. readonly lineVerticalDashed4: string;
  125. readonly lineVerticalDashed5: string;
  126. readonly lineVerticalDashed6: string;
  127. readonly lineVerticalDashed7: string;
  128. readonly lineVerticalDashed8: string;
  129. readonly lineVerticalDashed9: string;
  130. readonly lineVerticalDashed10: string;
  131. readonly lineVerticalDashed11: string;
  132. readonly lineDownLeft: string;
  133. readonly lineDownLeftArc: string;
  134. readonly lineDownBoldLeftBold: string;
  135. readonly lineDownBoldLeft: string;
  136. readonly lineDownLeftBold: string;
  137. readonly lineDownDoubleLeftDouble: string;
  138. readonly lineDownDoubleLeft: string;
  139. readonly lineDownLeftDouble: string;
  140. readonly lineDownRight: string;
  141. readonly lineDownRightArc: string;
  142. readonly lineDownBoldRightBold: string;
  143. readonly lineDownBoldRight: string;
  144. readonly lineDownRightBold: string;
  145. readonly lineDownDoubleRightDouble: string;
  146. readonly lineDownDoubleRight: string;
  147. readonly lineDownRightDouble: string;
  148. readonly lineUpLeft: string;
  149. readonly lineUpLeftArc: string;
  150. readonly lineUpBoldLeftBold: string;
  151. readonly lineUpBoldLeft: string;
  152. readonly lineUpLeftBold: string;
  153. readonly lineUpDoubleLeftDouble: string;
  154. readonly lineUpDoubleLeft: string;
  155. readonly lineUpLeftDouble: string;
  156. readonly lineUpRight: string;
  157. readonly lineUpRightArc: string;
  158. readonly lineUpBoldRightBold: string;
  159. readonly lineUpBoldRight: string;
  160. readonly lineUpRightBold: string;
  161. readonly lineUpDoubleRightDouble: string;
  162. readonly lineUpDoubleRight: string;
  163. readonly lineUpRightDouble: string;
  164. readonly lineUpDownLeft: string;
  165. readonly lineUpBoldDownBoldLeftBold: string;
  166. readonly lineUpBoldDownBoldLeft: string;
  167. readonly lineUpDownLeftBold: string;
  168. readonly lineUpBoldDownLeftBold: string;
  169. readonly lineUpDownBoldLeftBold: string;
  170. readonly lineUpDownBoldLeft: string;
  171. readonly lineUpBoldDownLeft: string;
  172. readonly lineUpDoubleDownDoubleLeftDouble: string;
  173. readonly lineUpDoubleDownDoubleLeft: string;
  174. readonly lineUpDownLeftDouble: string;
  175. readonly lineUpDownRight: string;
  176. readonly lineUpBoldDownBoldRightBold: string;
  177. readonly lineUpBoldDownBoldRight: string;
  178. readonly lineUpDownRightBold: string;
  179. readonly lineUpBoldDownRightBold: string;
  180. readonly lineUpDownBoldRightBold: string;
  181. readonly lineUpDownBoldRight: string;
  182. readonly lineUpBoldDownRight: string;
  183. readonly lineUpDoubleDownDoubleRightDouble: string;
  184. readonly lineUpDoubleDownDoubleRight: string;
  185. readonly lineUpDownRightDouble: string;
  186. readonly lineDownLeftRight: string;
  187. readonly lineDownBoldLeftBoldRightBold: string;
  188. readonly lineDownLeftBoldRightBold: string;
  189. readonly lineDownBoldLeftRight: string;
  190. readonly lineDownBoldLeftBoldRight: string;
  191. readonly lineDownBoldLeftRightBold: string;
  192. readonly lineDownLeftRightBold: string;
  193. readonly lineDownLeftBoldRight: string;
  194. readonly lineDownDoubleLeftDoubleRightDouble: string;
  195. readonly lineDownDoubleLeftRight: string;
  196. readonly lineDownLeftDoubleRightDouble: string;
  197. readonly lineUpLeftRight: string;
  198. readonly lineUpBoldLeftBoldRightBold: string;
  199. readonly lineUpLeftBoldRightBold: string;
  200. readonly lineUpBoldLeftRight: string;
  201. readonly lineUpBoldLeftBoldRight: string;
  202. readonly lineUpBoldLeftRightBold: string;
  203. readonly lineUpLeftRightBold: string;
  204. readonly lineUpLeftBoldRight: string;
  205. readonly lineUpDoubleLeftDoubleRightDouble: string;
  206. readonly lineUpDoubleLeftRight: string;
  207. readonly lineUpLeftDoubleRightDouble: string;
  208. readonly lineUpDownLeftRight: string;
  209. readonly lineUpBoldDownBoldLeftBoldRightBold: string;
  210. readonly lineUpDownBoldLeftBoldRightBold: string;
  211. readonly lineUpBoldDownLeftBoldRightBold: string;
  212. readonly lineUpBoldDownBoldLeftRightBold: string;
  213. readonly lineUpBoldDownBoldLeftBoldRight: string;
  214. readonly lineUpBoldDownLeftRight: string;
  215. readonly lineUpDownBoldLeftRight: string;
  216. readonly lineUpDownLeftBoldRight: string;
  217. readonly lineUpDownLeftRightBold: string;
  218. readonly lineUpBoldDownBoldLeftRight: string;
  219. readonly lineUpDownLeftBoldRightBold: string;
  220. readonly lineUpBoldDownLeftBoldRight: string;
  221. readonly lineUpBoldDownLeftRightBold: string;
  222. readonly lineUpDownBoldLeftBoldRight: string;
  223. readonly lineUpDownBoldLeftRightBold: string;
  224. readonly lineUpDoubleDownDoubleLeftDoubleRightDouble: string;
  225. readonly lineUpDoubleDownDoubleLeftRight: string;
  226. readonly lineUpDownLeftDoubleRightDouble: string;
  227. readonly lineCross: string;
  228. readonly lineBackslash: string;
  229. readonly lineSlash: string;
  230. };
  231. type FigureSet = typeof figureSet;
  232. /**
  233. Symbols to use when the terminal supports Unicode symbols.
  234. */
  235. export const mainSymbols: FigureSet;
  236. /**
  237. Symbols to use when the terminal does not support Unicode symbols.
  238. */
  239. export const fallbackSymbols: FigureSet;
  240. /**
  241. Symbols to use on any terminal.
  242. */
  243. export default figureSet;
  244. export type Options = {
  245. /**
  246. Whether to replace symbols with fallbacks.
  247. This can be set to `true` to always use fallback symbols, whether the terminal has poor Unicode support or not.
  248. @default `true` if the terminal has poor Unicode support
  249. */
  250. readonly useFallback?: boolean;
  251. };
  252. /**
  253. Returns the input with replaced fallback symbols if the terminal has poor Unicode support.
  254. @param string - String where the Unicode symbols will be replaced with fallback symbols depending on the terminal.
  255. @returns The input with replaced fallback Unicode symbols.
  256. @example
  257. ```
  258. import figures, {replaceSymbols} from 'figures';
  259. console.log(replaceSymbols('✔ check'));
  260. // On terminals with Unicode symbols: ✔ check
  261. // On other terminals: √ check
  262. console.log(replaceSymbols('✔ check', {useFallback: true}));
  263. // On terminals with Unicode symbols: √ check
  264. // On other terminals: √ check
  265. ```
  266. */
  267. export function replaceSymbols(string: string, options?: Options): string;