UNPKG

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