File size: 1,579 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import type { Pseudos } from "csstype"

type AriaAttributes =
  | "[aria-disabled]"
  | "[aria-hidden]"
  | "[aria-invalid]"
  | "[aria-readonly]"
  | "[aria-required]"
  | "[aria-selected]"
  | "[aria-checked]"
  | "[aria-expanded]"
  | "[aria-pressed]"
  | `[aria-current=${"page" | "step" | "location" | "date" | "time"}]`
  | "[aria-invalid]"
  | `[aria-sort=${"ascending" | "descending"}]`

type DataAttributes =
  | "[data-selected]"
  | "[data-highlighted]"
  | "[data-hover]"
  | "[data-active]"
  | "[data-checked]"
  | "[data-disabled]"
  | "[data-readonly]"
  | "[data-focus]"
  | "[data-focus-visible]"
  | "[data-focus-visible-added]"
  | "[data-invalid]"
  | "[data-pressed]"
  | "[data-expanded]"
  | "[data-grabbed]"
  | "[data-dragged]"
  | "[data-orientation=horizontal]"
  | "[data-orientation=vertical]"
  | "[data-in-range]"
  | "[data-out-of-range]"
  | "[data-placeholder-shown]"
  | `[data-part=${string}]`
  | `[data-attr=${string}]`
  | `[data-placement=${string}]`
  | `[data-theme=${string}]`
  | `[data-size=${string}]`
  | `[data-state=${string}]`
  | "[data-empty]"
  | "[data-loading]"
  | "[data-loaded]"
  | "[data-enter]"
  | "[data-entering]"
  | "[data-exited]"
  | "[data-exiting]"

type AttributeSelector = `&${Pseudos | DataAttributes | AriaAttributes}`
type ParentSelector = `${DataAttributes | AriaAttributes} &`

type AtRuleType = "media" | "layer" | "container" | "supports" | "page"

export type AnySelector =
  | `${string}&`
  | `&${string}`
  | `@${AtRuleType}${string}`

export type Selectors = AttributeSelector | ParentSelector