UNPKG

1.59 kBTypeScriptView Raw
1import {List, OrderedMap} from 'immutable';
2
3import {Value} from './index';
4import {SassList, ListSeparator} from './list';
5
6/**
7 * Sass's [argument list
8 * type](https://sass-lang.com/documentation/values/lists#argument-lists).
9 *
10 * An argument list comes from a rest argument. It's distinct from a normal
11 * {@link SassList} in that it may contain a keyword map as well as the
12 * positional arguments.
13 *
14 * @category Custom Function
15 */
16export class SassArgumentList extends SassList {
17 /**
18 * Creates a new argument list.
19 *
20 * @param contents - The positional arguments that make up the primary
21 * contents of the list. This may be either a plain JavaScript array or an
22 * immutable {@link List} from the [`immutable`
23 * package](https://immutable-js.com/).
24 *
25 * @param keywords - The keyword arguments attached to this argument list,
26 * whose names should exclude `$`. This can be either a plain JavaScript
27 * object with argument names as fields, or an immutable {@link OrderedMap}
28 * from the [`immutable` package](https://immutable-js.com/)
29 *
30 * @param separator - The separator for this list. Defaults to `','`.
31 */
32 constructor(
33 contents: Value[] | List<Value>,
34 keywords: Record<string, Value> | OrderedMap<string, Value>,
35 separator?: ListSeparator
36 );
37
38 /**
39 * The keyword arguments attached to this argument list.
40 *
41 * The argument names don't include `$`.
42 *
43 * @returns An immutable {@link OrderedMap} from the [`immutable`
44 * package](https://immutable-js.com/).
45 */
46 get keywords(): OrderedMap<string, Value>;
47}