1 | import Container, {
|
2 | ContainerProps,
|
3 | ContainerWithChildren
|
4 | } from './container.js'
|
5 |
|
6 | declare namespace Rule {
|
7 | export interface RuleRaws extends Record<string, unknown> {
|
8 | |
9 |
|
10 |
|
11 | after?: string
|
12 |
|
13 | |
14 |
|
15 |
|
16 |
|
17 | before?: string
|
18 |
|
19 | |
20 |
|
21 |
|
22 | between?: string
|
23 |
|
24 | |
25 |
|
26 |
|
27 | ownSemicolon?: string
|
28 |
|
29 | |
30 |
|
31 |
|
32 | selector?: {
|
33 | raw: string
|
34 | value: string
|
35 | }
|
36 |
|
37 | |
38 |
|
39 |
|
40 | semicolon?: boolean
|
41 | }
|
42 |
|
43 | export type RuleProps = {
|
44 |
|
45 | raws?: RuleRaws
|
46 | } & (
|
47 | | {
|
48 |
|
49 | selector: string
|
50 | selectors?: never
|
51 | }
|
52 | | {
|
53 | selector?: never
|
54 |
|
55 | selectors: readonly string[]
|
56 | }
|
57 | ) & ContainerProps
|
58 |
|
59 |
|
60 | export { Rule_ as default }
|
61 | }
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 | declare class Rule_ extends Container {
|
82 | nodes: NonNullable<Container['nodes']>
|
83 | parent: ContainerWithChildren | undefined
|
84 | raws: Rule.RuleRaws
|
85 | type: 'rule'
|
86 | constructor(defaults?: Rule.RuleProps)
|
87 |
|
88 | assign(overrides: object | Rule.RuleProps): this
|
89 | clone(overrides?: Partial<Rule.RuleProps>): this
|
90 |
|
91 | cloneAfter(overrides?: Partial<Rule.RuleProps>): this
|
92 |
|
93 | cloneBefore(overrides?: Partial<Rule.RuleProps>): this
|
94 | /**
|
95 | * The rule’s full selector represented as a string.
|
96 | *
|
97 | * ```js
|
98 | * const root = postcss.parse('a, b { }')
|
99 | * const rule = root.first
|
100 | * rule.selector //=> 'a, b'
|
101 | * ```
|
102 | */
|
103 | get selector(): string
|
104 | set selector(value: string)
|
105 | /**
|
106 | * An array containing the rule’s individual selectors.
|
107 | * Groups of selectors are split at commas.
|
108 | *
|
109 | * ```js
|
110 | * const root = postcss.parse('a, b { }')
|
111 | * const rule = root.first
|
112 | *
|
113 | * rule.selector //=> 'a, b'
|
114 | * rule.selectors //=> ['a', 'b']
|
115 | *
|
116 | * rule.selectors = ['a', 'strong']
|
117 | * rule.selector //=> 'a, strong'
|
118 | * ```
|
119 | */
|
120 | get selectors(): string[]
|
121 | set selectors(values: string[])
|
122 | }
|
123 |
|
124 | declare class Rule extends Rule_ {}
|
125 |
|
126 | export = Rule
|