Skip to content

Commit

Permalink
feat(core): add missing native definitions (#2933)
Browse files Browse the repository at this point in the history
  • Loading branch information
idoros committed Jan 1, 2024
1 parent 1c5fa31 commit c0d7d59
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
20 changes: 20 additions & 0 deletions packages/core/src/native-reserved-lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const nativePseudoClasses = [
'any',
'any-link',
'checked',
'indeterminate',
'default',
'defined',
'dir',
Expand Down Expand Up @@ -48,6 +49,14 @@ export const nativePseudoClasses = [
'valid',
'visited',
'where',
'user-valid',
'user-invalid',
'autofill',
'modal',
'popover-open',
'future',
'past',
'picture-in-picture',
];

export const CSSWideKeywords = ['initial', 'inherit', 'unset'];
Expand Down Expand Up @@ -100,6 +109,15 @@ export const nativePseudoElements = [
'selection',
'slotted',
'spelling-error',
'file-selector-button',
'highlight',
'part',
'target-text',
'view-transition',
'view-transition-group',
'view-transition-image-pair',
'view-transition-new',
'view-transition-old',
];

export const nativeFunctionsDic: Record<string, { preserveQuotes: boolean }> = {
Expand Down Expand Up @@ -164,6 +182,7 @@ export const nativeFunctionsDic: Record<string, { preserveQuotes: boolean }> = {
scaleY: { preserveQuotes: false },
scaleZ: { preserveQuotes: false },
scroll: { preserveQuotes: false },
view: { preserveQuotes: true },
sepia: { preserveQuotes: false },
skew: { preserveQuotes: false },
skewX: { preserveQuotes: false },
Expand All @@ -188,6 +207,7 @@ export const nativeFunctionsDic: Record<string, { preserveQuotes: boolean }> = {
oklch: { preserveQuotes: true },
supports: { preserveQuotes: true },
anchor: { preserveQuotes: true },
'anchor-size': { preserveQuotes: true },
selector: { preserveQuotes: true /* TODO:transform the nested selector */ },
style: { preserveQuotes: true /* TODO: transform the dashed ident property */ },
'image-set': { preserveQuotes: true },
Expand Down
10 changes: 6 additions & 4 deletions packages/core/test/features/st-structure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ describe('@st structure', () => {
it('should prevent automatic .class=>::part definition', () => {
testStylableCore(`
@st .root;
.part {}
.customPart {}
/*
@transform-error ${transformerStringDiagnostics.UNKNOWN_PSEUDO_ELEMENT(`part`)}
@rule .entry__root::part
@transform-error ${transformerStringDiagnostics.UNKNOWN_PSEUDO_ELEMENT(
`customPart`
)}
@rule .entry__root::customPart
*/
.root::part {}
.root::customPart {}
`);
});
it('should register css class', () => {
Expand Down

0 comments on commit c0d7d59

Please sign in to comment.