list.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. declare namespace list {
  2. type List = {
  3. /**
  4. * Safely splits comma-separated values (such as those for `transition-*`
  5. * and `background` properties).
  6. *
  7. * ```js
  8. * Once (root, { list }) {
  9. * list.comma('black, linear-gradient(white, black)')
  10. * //=> ['black', 'linear-gradient(white, black)']
  11. * }
  12. * ```
  13. *
  14. * @param str Comma-separated values.
  15. * @return Split values.
  16. */
  17. comma(str: string): string[]
  18. default: List
  19. /**
  20. * Safely splits space-separated values (such as those for `background`,
  21. * `border-radius`, and other shorthand properties).
  22. *
  23. * ```js
  24. * Once (root, { list }) {
  25. * list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)']
  26. * }
  27. * ```
  28. *
  29. * @param str Space-separated values.
  30. * @return Split values.
  31. */
  32. space(str: string): string[]
  33. /**
  34. * Safely splits values.
  35. *
  36. * ```js
  37. * Once (root, { list }) {
  38. * list.split('1px calc(10% + 1px)', [' ', '\n', '\t']) //=> ['1px', 'calc(10% + 1px)']
  39. * }
  40. * ```
  41. *
  42. * @param string separated values.
  43. * @param separators array of separators.
  44. * @param last boolean indicator.
  45. * @return Split values.
  46. */
  47. split(string: string, separators: string[], last: boolean): string[]
  48. }
  49. }
  50. // eslint-disable-next-line @typescript-eslint/no-redeclare
  51. declare const list: list.List
  52. export = list