Files
webstudio/packages/html-data/src/pseudo-classes.ts
Bogdan Chadkin 3506fe881f feat: add element component (#5231)
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
2025-05-25 14:26:40 +03:00

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"],
};