UNPKG

postcss-pseudo-companion-classes

Version:

PostCSS plugin to add companion classes to pseudo-classes for testing purposes (works with css modules)

176 lines (145 loc) 2.77 kB
:root { color: blue; } ::selection, .\:selection { background-color: mintcream; } a { text-decoration: none; } a:hover, a.\:hover { text-decoration: underline; } a:active, a.\:active { font-weight: bold; } a:hover, a:focus, a.\:hover, a.\:focus { font-weight: bold; } a.lol:active, a.lol.\:active { font-weight: normal; } a:nth-child(5), a.\:nth-child(5) { border: 1px solid papayawhip; } a:hover:focus, a:hover.\:focus, a.\:hover:focus, a.\:hover.\:focus { font-weight: bold; } a:before { color: white; } a::before { color: white; } a:before, a::before { color: white; } a:hover::before, a.\:hover::before { border-top-color: blue; } a:active:focus:hover::after, a:active:focus.\:hover::after, a:active.\:focus:hover::after, a:active.\:focus.\:hover::after, a.\:active:focus:hover::after, a.\:active:focus.\:hover::after, a.\:active.\:focus:hover::after, a.\:active.\:focus.\:hover::after { border-bottom-color: blue; } a:active:focus + div:hover, a:active:focus + div.\:hover, a:active.\:focus + div:hover, a:active.\:focus + div.\:hover, a.\:active:focus + div:hover, a.\:active:focus + div.\:hover, a.\:active.\:focus + div:hover, a.\:active.\:focus + div.\:hover { color: magenta; } :global a { border-top-color: burlywood; } :global(a) { color: firebrick; } :global a:hover, :global a.\:hover { color: peachpuff; } :global a:hover b:focus, :global a:hover b.\:focus, :global a.\:hover b:focus, :global a.\:hover b.\:focus { color: thistle; } :global(a:hover), :global(a.\:hover) { color: cadetblue } :global(a:hover) b:focus, :global(a:hover) b.\:focus, :global(a.\:hover) b:focus, :global(a.\:hover) b.\:focus { color: whitesmoke; } :host { color: blue; } :host-context(a) { color: blue; } :host([disabled]) { opacity: .4; } :host([enabled]) { opacity: 1; } a:hover, :host, a.\:hover { color: blue; } .block .element:active, .block .element.\:active { color: blue; } :host .block .element:active, :host .block .element.\:active { color: blue; } /*test multiple pseudo classes on one element but one is excluded (:host) no useful css rule, but another pseudo class, like :nth-child could be added by the user. */ .element:host:active, .element:host.\:active { color:blue } /*test :host (excluded) with modifier class on host (element)*/ .hostVariant:host .block .element:active, .hostVariant:host .block .element.\:active { color: blue; } /*test :host (excluded) with modifier class on host (element)*/ :host.hostVariant .block .element:active, :host.hostVariant .block .element.\:active { color: blue; } /*test :host (excluded) with id on host (element)*/ :host#specialVariantId .block .element:active, :host#specialVariantId .block .element.\:active { color: blue; }