@theme-ui/css
Advanced tools
Comparing version 0.17.0 to 0.17.1-develop.0
{ | ||
"name": "@theme-ui/css", | ||
"version": "0.17.0", | ||
"version": "0.17.1-develop.0", | ||
"source": "src/index.ts", | ||
@@ -37,3 +37,3 @@ "main": "dist/theme-ui-css.cjs.js", | ||
"dependencies": { | ||
"csstype": "3.0.10" | ||
"csstype": "^3.0.10" | ||
}, | ||
@@ -46,3 +46,3 @@ "peerDependencies": { | ||
"@types/react": "^18.2.12", | ||
"@theme-ui/test-utils": "^0.17.0" | ||
"@theme-ui/test-utils": "^0.17.1-develop.0" | ||
}, | ||
@@ -49,0 +49,0 @@ "preconstruct": { |
@@ -10,38 +10,2 @@ import { expecter } from '@theme-ui/test-utils' | ||
describe('Theme', () => { | ||
test('shows friendly error only on bad property', () => { | ||
expectSnippet(` | ||
css({ | ||
bg: 'salmon', | ||
whiteSpace: 'no-works', | ||
'> form': { | ||
color: 'blue', | ||
widows: 'bar', | ||
// unknown CSS property is accepted | ||
whitePace: 'this-works', | ||
}, | ||
}) | ||
`).toFail( | ||
/Error snippet\.tsx \(\d+,\d+\): Type '"no-works"' is not assignable to type [\s\S]+'./ | ||
) | ||
}) | ||
test('shows friendly error on nested object', () => { | ||
expectSnippet(` | ||
css({ | ||
bg: 'salmon', | ||
'> form': { | ||
color: 'blue', | ||
whiteSpace: 'banana', | ||
}, | ||
}) | ||
`).toFail( | ||
new RegExp( | ||
`Error snippet\\.tsx \\(\\d+,\\d+\\): Type '{ color: "blue"; whiteSpace: "banana"; }'` + | ||
` is not assignable to type '[\\s\\S]+'.\\n\\s+` + | ||
`Types of property 'whiteSpace' are incompatible.\\n\\s+` + | ||
`Type '"banana"' is not assignable to type [\\s\\S]+` | ||
) | ||
) | ||
}) | ||
test('accepts unknown CSS property without error', () => { | ||
@@ -100,5 +64,2 @@ expect(css({ '> form': { windows: 'baz' } })({})).toStrictEqual({ | ||
const parse = (x: string | number | undefined | {}) => parseInt(String(x)) | ||
css({ | ||
size: (t) => parse(t.space?.[3]) + parse(t.sizes?.[5]), | ||
}) | ||
@@ -115,26 +76,2 @@ // Current limitation. If you broke this one, that's actually pretty awesome, | ||
// This is not a feature, but the TypeScript chapter in the docs will need an | ||
// update if this test fails. | ||
test('inferred type `string` is too wide for `whiteSpace`', () => { | ||
expectSnippet(` | ||
const style = { | ||
whiteSpace: 'pre-line' | ||
} | ||
css(style); | ||
`).toFail( | ||
/Type '{ whiteSpace: string; }' is not assignable to type 'ThemeUICSSObject'./ | ||
) | ||
expectSnippet(` | ||
import { ThemeUICSSObject } from './packages/css' | ||
const style: ThemeUICSSObject = { | ||
whiteSpace: 'pre-line' | ||
} | ||
css(style); | ||
`).toSucceed() | ||
}) | ||
describe('ColorMode', () => { | ||
@@ -141,0 +78,0 @@ const expectedSnippet = expectSnippet(` |
@@ -35,1 +35,8 @@ import { css, Theme, THEME_UI_DEFAULT_KEY } from '..' | ||
}) | ||
// https://github.com/system-ui/theme-ui/issues/2520 | ||
it('accepts number as aspect ratio', () => { | ||
const actual = css({ aspectRatio: 0.5 })({}) | ||
expect(actual).toStrictEqual({ aspectRatio: 0.5 }) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
178912
4856
+ Added@babel/code-frame@7.26.0(transitive)
+ Added@babel/generator@7.26.0(transitive)
+ Added@babel/parser@7.26.1(transitive)
+ Added@babel/runtime@7.26.0(transitive)
+ Added@babel/types@7.26.0(transitive)
+ Addedcsstype@3.1.3(transitive)
- Removed@babel/code-frame@7.25.9(transitive)
- Removed@babel/generator@7.25.9(transitive)
- Removed@babel/highlight@7.25.9(transitive)
- Removed@babel/parser@7.25.9(transitive)
- Removed@babel/runtime@7.25.9(transitive)
- Removed@babel/types@7.25.9(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcsstype@3.0.10(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedsupports-color@5.5.0(transitive)
Updatedcsstype@^3.0.10