Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.13.1 #2064

Merged
merged 21 commits into from Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4728c83
test: increase code coverage and test @theme-ui/css/utils
hasparus Dec 27, 2021
30d75ed
chore: replace ThemeContext.Provider with ThemeProvider
appsparkler Dec 29, 2021
296aa99
chore: preset object instead of func, extra padding to select field f…
appsparkler Dec 29, 2021
544f60b
Update packages/docs/src/components/presets-demo.js
hasparus Dec 29, 2021
5208e59
Merge pull request #2045 from appsparkler/develop
hasparus Dec 29, 2021
b907fd6
fix(e2e): downgrade Cypress to 9.0.0
hasparus Dec 29, 2021
e71c9f1
chore(deps-dev): bump typescript from 4.4.4 to 4.5.4
dependabot[bot] Dec 29, 2021
0860ede
chore(deps-dev): bump babel-preset-gatsby from 2.2.0 to 2.4.0
dependabot[bot] Dec 29, 2021
44d4432
chore(deps): bump gatsby-plugin-catch-links from 4.2.0 to 4.4.0
dependabot[bot] Dec 29, 2021
4976224
chore(deps-dev): bump @types/node from 16.11.9 to 17.0.5
dependabot[bot] Dec 29, 2021
3ae4756
chore(deps): bump type-fest from 2.7.0 to 2.8.0
dependabot[bot] Dec 29, 2021
50f7a34
chore(deps): bump @emotion/react from 11.6.0 to 11.7.1
dependabot[bot] Dec 29, 2021
4e2c10b
chore(deps-dev): bump @emotion/jest from 11.6.0 to 11.7.1
dependabot[bot] Dec 29, 2021
c85e117
chore(deps): bump gatsby from 4.2.0 to 4.4.0
dependabot[bot] Dec 29, 2021
b35cbed
css: Make background a theme-aware property
lachlanjc Dec 30, 2021
e08041c
chore(deps-dev): bump @babel/helper-validator-identifier
dependabot[bot] Jan 1, 2022
9109660
chore(deps): bump gatsby-plugin-react-helmet from 5.2.0 to 5.4.0
dependabot[bot] Jan 1, 2022
4b774d7
Merge pull request #2059 from system-ui/dependabot/npm_and_yarn/babel…
hasparus Jan 3, 2022
4434984
Merge pull request #2056 from system-ui/lachlanjc-css-background
hasparus Jan 3, 2022
03a5c65
chore(deps-dev): bump @types/jest from 27.0.3 to 27.4.0
dependabot[bot] Jan 1, 2022
a29c63c
chore(deps-dev): bump ts-jest from 27.0.7 to 27.1.2
dependabot[bot] Jan 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Expand Up @@ -93,3 +93,6 @@ updates:
- dependency-name: 'stringify-object'
versions:
- '>= 3'
- dependency-name: 'cypress'
versions:
- '> 9.0.0, < 10'
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -49,7 +49,7 @@
"@preconstruct/cli": "^2.1.5",
"@testing-library/react": "^12.1.2",
"@types/jest": "^27.0.3",
"@types/node": "^16.11.9",
"@types/node": "^17.0.5",
"@types/react-dom": "^17.0.11",
"@types/react-test-renderer": "^17.0.1",
"@typescript-eslint/eslint-plugin": "^4.33.0",
Expand Down
9 changes: 9 additions & 0 deletions packages/color/test/index.tsx
Expand Up @@ -26,6 +26,7 @@ import {
complement,
invert,
grayscale,
getColor,
} from '../src'

expect.extend(matchers)
Expand Down Expand Up @@ -373,3 +374,11 @@ test('typechecks', () => {
}
//#endregion
})

describe('getColor', () => {
test('throws error if given CSS custom property', () => {
expect(() => getColor({}, 'var(--theme-ui-colors-primary)')).toThrow(
'A CSS property was passed to `getColor`.'
)
})
})
3 changes: 2 additions & 1 deletion packages/css/src/index.ts
Expand Up @@ -111,10 +111,12 @@ export const multiples = {

export const scales = {
color: 'colors',
background: 'colors',
backgroundColor: 'colors',
borderColor: 'colors',
caretColor: 'colors',
columnRuleColor: 'colors',
outlineColor: 'colors',
textDecorationColor: 'colors',
opacity: 'opacities',
transition: 'transitions',
Expand Down Expand Up @@ -233,7 +235,6 @@ export const scales = {
borderStartEndRadius: 'radii',
borderStartStartRadius: 'radii',
columnRuleWidth: 'borderWidths',
outlineColor: 'colors',
boxShadow: 'shadows',
textShadow: 'shadows',
zIndex: 'zIndices',
Expand Down
62 changes: 62 additions & 0 deletions packages/css/test/utils.ts
@@ -0,0 +1,62 @@
import { Theme } from '../src'
import { makeColorsScale, makeStyles, makeTheme } from '../src/utils'
import { AssertTrue, expecter, IsExact } from '@theme-ui/test-utils'

const symbolPretendingToBeTheme = Symbol() as Theme

describe(makeTheme, () => {
it('returns input unchanged', () => {
const actual = makeTheme(symbolPretendingToBeTheme)
expect(actual).toEqual(symbolPretendingToBeTheme)
})

it('preserves type of the argument', () => {
const theme = makeTheme({
colors: {
primary: 'tomato',
},
})

type _ = AssertTrue<
IsExact<typeof theme, { colors: { primary: 'tomato' } }>
>
})

it('is exposed from entrypoint /utils and validates Theme type', () => {
expecter('import { makeTheme } from "@theme-ui/css/utils"')(
'const t = makeTheme("banana")'
).toFail(/Type '"banana"' has no properties in common with type 'Theme'./)
})
})

describe(makeStyles, () => {
it('returns input unchanged', () => {
const actual = makeTheme(symbolPretendingToBeTheme)
expect(actual).toEqual(symbolPretendingToBeTheme)
})

it('preserves type of the argument', () => {
const styles = makeStyles({
code: {},
})

type _ = AssertTrue<IsExact<typeof styles, { code: {} }>>
})
})

describe(makeColorsScale, () => {
it('returns input unchanged', () => {
const actual = makeTheme(symbolPretendingToBeTheme)
expect(actual).toEqual(symbolPretendingToBeTheme)
})

it('preserves type of the argument', () => {
const colors = makeColorsScale({
blue: {
light: '#e6f7ff',
},
})

type _ = AssertTrue<IsExact<typeof colors, { blue: { light: '#e6f7ff' } }>>
})
})
2 changes: 1 addition & 1 deletion packages/docs/package.json
Expand Up @@ -93,6 +93,6 @@
"@babel/register": "^7.8.6"
},
"resolutions": {
"@emotion/react": "11.4.0"
"@emotion/react": "11.7.1"
}
}
12 changes: 6 additions & 6 deletions packages/docs/src/components/presets-demo.js
@@ -1,6 +1,5 @@
/** @jsx jsx */
import { jsx, Themed, components, Select } from 'theme-ui'
import { ThemeContext } from '@emotion/react'
import { jsx, Themed, components, Select, ThemeProvider } from 'theme-ui'
import { MDXProvider } from '@mdx-js/react'
import { useState } from 'react'
import { Helmet } from 'react-helmet'
Expand All @@ -16,7 +15,8 @@ import Lorem from './lorem.mdx'

export default function PresetsDemo() {
const [theme, setTheme] = useState('base')
const preset = presets[theme]
const preset = presets[theme]


return (
<div>
Expand Down Expand Up @@ -46,7 +46,7 @@ export default function PresetsDemo() {
<span>Preset:</span>
<Select
id="theme"
sx={{ display: 'inline-flex' }}
sx={{ display: 'inline-flex', paddingRight: 32 }}
value={theme}
onChange={(e) => {
setTheme(e.target.value)
Expand All @@ -57,7 +57,7 @@ export default function PresetsDemo() {
))}
</Select>
</label>
<ThemeContext.Provider value={preset}>
<ThemeProvider theme={preset}>
<Themed.root sx={{ bg: 'background', color: 'text', p: 3 }}>
<Themed.h2>Colors</Themed.h2>
<ColorPalette omit={['modes', 'header']} />
Expand Down Expand Up @@ -94,7 +94,7 @@ export default function PresetsDemo() {
}}
/>
</Themed.root>
</ThemeContext.Provider>
</ThemeProvider>
</div>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/package.json
Expand Up @@ -15,7 +15,7 @@
"@percy/cli": "^1.0.0-beta.54",
"@percy/cypress": "^3.1.1",
"@testing-library/cypress": "^8.0.2",
"cypress": "9.1.0",
"cypress": "9.0.0",
"esbuild": "^0.14.1"
}
}
2 changes: 2 additions & 0 deletions packages/tachyons/src/index.ts
@@ -1,3 +1,5 @@
/* istanbul ignore file */

import { Theme } from '@theme-ui/css'

const KEY_MAPPING: {
Expand Down