4b964499e73bf48abf64873a866513d9679e3a180fedeb3d9ba56358d1e44ca4a1368eae23b07594da852e53a891d2fc750abd4de37095bf3907f76cff5a21 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import {List} from 'immutable';
  2. import {Value} from './index';
  3. /**
  4. * Possible separators used by Sass lists. The special separator `null` is only
  5. * used for lists with fewer than two elements, and indicates that the separator
  6. * has not yet been decided for this list.
  7. *
  8. * @category Custom Function
  9. */
  10. export type ListSeparator = ',' | '/' | ' ' | null;
  11. /**
  12. * Sass's [list type](https://sass-lang.com/documentation/values/lists).
  13. *
  14. * @category Custom Function
  15. */
  16. export class SassList extends Value {
  17. /**
  18. * Creates a new list.
  19. *
  20. * @param contents - The contents of the list. This may be either a plain
  21. * JavaScript array or an immutable {@link List} from the [`immutable`
  22. * package](https://immutable-js.com/).
  23. *
  24. * @param options.separator - The separator to use between elements of this
  25. * list. Defaults to `','`.
  26. *
  27. * @param options.brackets - Whether the list has square brackets. Defaults to
  28. * `false`.
  29. */
  30. constructor(
  31. contents: Value[] | List<Value>,
  32. options?: {
  33. separator?: ListSeparator;
  34. brackets?: boolean;
  35. }
  36. );
  37. /**
  38. * Creates an empty list.
  39. *
  40. * @param options.separator - The separator to use between elements of this
  41. * list. Defaults to `','`.
  42. *
  43. * @param options.brackets - Whether the list has square brackets. Defaults to
  44. * `false`.
  45. */
  46. constructor(options?: {separator?: ListSeparator; brackets?: boolean});
  47. /** @hidden */
  48. get separator(): ListSeparator;
  49. }