Skip to content

Commit

Permalink
Fix: Missing transform unit auto-completion
Browse files Browse the repository at this point in the history
  • Loading branch information
BenSeage committed Aug 6, 2024
1 parent 8fb1def commit 0ac51c1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/core/src/config/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,14 @@ const functions: FunctionDefinitions = {
'conic-gradient': {},
'repeating-linear-gradient': {},
'repeating-radial-gradient': {},
'repeating-conic-gradient': {}
'repeating-conic-gradient': {},
'matrix': { unit: '' },
'matrix3d': { unit: '' },
'scale': { unit: '' },
'scale3d': { unit: '' },
'scaleX': { unit: '' },
'scaleY': { unit: '' },
'scaleZ': { unit: '' },
}

export default functions
1 change: 1 addition & 0 deletions packages/core/src/config/syntaxes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ const syntaxes = {
analyze(className: string) {
return [className.startsWith('transform') ? className.slice(10) : className]
},
unit: 'px',
variables: ['spacing']
} as SyntaxDefinition,
'transition-property': {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/tests/config/functions/calc.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { it, test, expect } from 'vitest'
import { it, expect } from 'vitest'
import { MasterCSS } from '../../../src'

it.concurrent('calc', () => {
Expand All @@ -23,4 +23,5 @@ it.concurrent('calc with variables', () => {
expect(new MasterCSS({
variables: { '1x': 60 }
}).create('w:calc(-1*($(1x)*2)*3-2)')?.text).toBe('.w\\:calc\\(-1\\*\\(\\$\\(1x\\)\\*2\\)\\*3-2\\){width:calc(-1 * (60 * 2) * 3 / 16 * 1rem - 0.125rem)}')
expect(new MasterCSS().create('translateX(calc(-25%-2x))')?.text).toBe('.translateX\\(calc\\(-25\\%-2x\\)\\){transform:translateX(calc(-25% - 8px))}')
})

0 comments on commit 0ac51c1

Please sign in to comment.