mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-02 18:18:35 +09:00
Ref https://github.com/webstudio-is/webstudio/issues/3632 Here unflagged element component in components panel and html paste. Additionally - migrate link template to html element - added :local-link state to links which is replaced with [aria-current=page] when css is generated, sadly not yet supported in any browser - migrated many templates from legacy components to html elements - put tailwind paste behind flag
71 lines
1.3 KiB
TypeScript
71 lines
1.3 KiB
TypeScript
// https://drafts.csswg.org/selectors
|
|
|
|
const location = [
|
|
// ':link',
|
|
":visited",
|
|
// ':any-link',
|
|
":local-link",
|
|
// ':target',
|
|
// ':target-within',
|
|
];
|
|
|
|
const userAction = [":hover", ":focus-visible", ":focus-within", ":active"];
|
|
|
|
const ability = [
|
|
// ":enabled",
|
|
":disabled",
|
|
];
|
|
|
|
const validity = [
|
|
// ":valid",
|
|
":invalid",
|
|
// ":user-valid",
|
|
":user-invalid",
|
|
];
|
|
|
|
const required = [
|
|
":required",
|
|
// ":optional"
|
|
];
|
|
|
|
export const pseudoClassesByTag: Record<string, string[]> = {
|
|
"*": userAction,
|
|
a: [...location],
|
|
area: [...location],
|
|
button: [...ability],
|
|
label: [],
|
|
input: [
|
|
":placeholder-shown",
|
|
// @todo temporary until proper pseudo elements support is added
|
|
"::placeholder",
|
|
...ability,
|
|
...validity,
|
|
...required,
|
|
":checked",
|
|
// ":indeterminate",
|
|
// :in-range
|
|
// :out-of-range
|
|
// ":open",
|
|
],
|
|
textarea: [
|
|
":placeholder-shown",
|
|
// @todo temporary until proper pseudo elements support is added
|
|
"::placeholder",
|
|
...ability,
|
|
...validity,
|
|
...required,
|
|
],
|
|
select: [
|
|
...ability,
|
|
...validity,
|
|
...required,
|
|
// ":open"
|
|
],
|
|
optgroup: [...ability],
|
|
option: [...ability, ":checked", ":default"],
|
|
fieldset: [...ability, ...validity],
|
|
progress: [":indeterminate"],
|
|
details: [":open"],
|
|
dialog: [":open"],
|
|
};
|