Skip to content

Commit

Permalink
Merge branch 'develop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
hasparus committed Oct 18, 2024
2 parents 19b70b7 + 18af785 commit 0d177c4
Show file tree
Hide file tree
Showing 57 changed files with 16,645 additions and 11,933 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 8
version: 9.12.1

- uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 8
version: 9.12.1

- uses: actions/setup-node@v3
with:
Expand All @@ -90,7 +90,7 @@ jobs:
registry-url: 'https://registry.npmjs.org'

- name: Install
run: pnpm install --no-optional --no-frozen-lockfile
run: pnpm install --no-optional

- name: Queue in release turnstile
id: turnstyle
Expand All @@ -99,6 +99,9 @@ jobs:
with:
abort-after-seconds: 600

- name: Fetch
run: git fetch --all

- name: Create release
if: steps.turnstyle.outcome == 'success'
# failing to release a canary because of network problems or duplicate tag shouldn't give the same message as failing tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 7
version: 9.12.1

- uses: actions/setup-node@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions auto.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const conventionalCommitsOptions: ConventionalCommitsOptions = {
defaultReleaseType: 'none',
}

const allContributorsOptions: IAllContributorsPluginOptions = {
const _allContributorsOptions: IAllContributorsPluginOptions = {
exclude: [
'dependabot',
'dependabot[bot]',
Expand Down Expand Up @@ -61,7 +61,7 @@ export default function config(): AutoRc {
['conventional-commits', conventionalCommitsOptions],
'first-time-contributor',
'released',
['all-contributors', allContributorsOptions],
// ['all-contributors', allContributorsOptions],
['omit-commits', omitCommitsOptions],
// 'magic-zero',
],
Expand Down
2 changes: 1 addition & 1 deletion examples/gatsby-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build": "gatsby build"
},
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.13.3",
"gatsby": "^5",
"gatsby-plugin-mdx": "^5",
"gatsby-plugin-theme-ui": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion examples/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build": "gatsby build"
},
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.13.3",
"@mdx-js/react": "^2.3.0",
"@theme-ui/mdx": "workspace:^",
"gatsby": "^5",
Expand Down
4 changes: 2 additions & 2 deletions examples/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.13.3",
"@mdx-js/loader": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@next/mdx": "^14.0.4",
Expand All @@ -25,6 +25,6 @@
"devDependencies": {
"@types/react": "^18.2.12",
"typescript": "^5",
"webpack": "^5.86.0"
"webpack": "^5.91.0"
}
}
51 changes: 26 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,56 +63,57 @@
}
},
"dependencies": {
"@auto-it/all-contributors": "^10.46.0",
"@auto-it/conventional-commits": "^10.46.0",
"@auto-it/core": "^10.46.0",
"@auto-it/first-time-contributor": "^10.46.0",
"@auto-it/magic-zero": "^10.46.0",
"@auto-it/npm": "^10.46.0",
"@auto-it/omit-commits": "^11.0.4",
"@auto-it/released": "^10.46.0",
"@auto-it/all-contributors": "^11.2.1",
"@auto-it/conventional-commits": "^11.2.1",
"@auto-it/core": "^11.2.1",
"@auto-it/first-time-contributor": "^11.2.1",
"@auto-it/magic-zero": "^11.2.1",
"@auto-it/npm": "^11.2.1",
"@auto-it/omit-commits": "^11.2.1",
"@auto-it/released": "^11.2.1",
"@babel/cli": "^7.22.5",
"@babel/helper-string-parser": "^7.22.5",
"@babel/helper-validator-identifier": "^7.22.5",
"@babel/plugin-transform-runtime": "^7.22.5",
"@babel/plugin-transform-runtime": "^7.24.3",
"@babel/preset-env": "^7.22.5",
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"@babel/runtime": "^7.22.5",
"@babel/runtime": "^7.25.7",
"@codechecks/build-size-watcher": "^0.1.0",
"@codechecks/client": "0.1.12",
"@emotion/jest": "^11.11.0",
"@jest/types": "^29.5.0",
"@preconstruct/cli": "^2.7.0",
"@emotion/jest": "^11.13.0",
"@jest/types": "^29.6.3",
"@preconstruct/cli": "^2.8.9",
"@testing-library/react": "^14.2.1",
"@types/eslint": "8.56.2",
"@types/jest": "^29.5.2",
"@types/jest": "^29.5.13",
"@types/node": "^20.3.1",
"@types/react-dom": "^18.2.5",
"@types/react-test-renderer": "^18.0.0",
"@types/react-test-renderer": "^18.3.0",
"@types/semver": "^7.5.0",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"auto": "^11.0.4",
"auto": "^11.2.1",
"babel-jest": "^29.7.0",
"babel-preset-gatsby": "^3.10.0",
"babel-preset-gatsby": "^3.13.2",
"cross-env": "^7.0.3",
"egzek": "^1.2.0",
"eslint": "^8.56.0",
"eslint-config-react-app": "^7.0.1",
"jest": "^29.5.0",
"jest-canvas-mock": "^2.5.1",
"jest-environment-jsdom": "^29.5.0",
"jest": "^29.7.0",
"jest-canvas-mock": "^2.5.2",
"jest-environment-jsdom": "^29.7.0",
"jest-mock-console": "^2.0.0",
"jest-ts-webcompat-resolver": "^1.0.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.8.8",
"react-test-renderer": "^18.2.0",
"react-test-renderer": "^18.3.1",
"rimraf": "^5.0.1",
"semver": "^7.5.1",
"ts-jest": "^29.1.0",
"semver": "^7.6.3",
"ts-jest": "^29.2.5",
"ts-toolbelt": "^9.6.0",
"typecov": "^0.2.3",
"typescript": "^5"
}
"typescript": "^5.6.3"
},
"packageManager": "[email protected]+sha512.e5a7e52a4183a02d5931057f7a0dbff9d5e9ce3161e33fa68ae392125b79282a8a8a470a51dfc8a0ed86221442eb2fb57019b0990ed24fab519bf0e1bc5ccfc4"
}
6 changes: 3 additions & 3 deletions packages/color-modes/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@theme-ui/color-modes",
"version": "0.16.2",
"version": "0.17.0-develop.0",
"main": "dist/theme-ui-color-modes.cjs.js",
"module": "dist/theme-ui-color-modes.esm.js",
"types": "dist/theme-ui-color-modes.cjs.d.ts",
Expand All @@ -19,11 +19,11 @@
"deepmerge": "^4.2.2"
},
"peerDependencies": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.13.3",
"react": ">=18"
},
"devDependencies": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.13.3",
"@theme-ui/test-utils": "workspace:^",
"@types/react": "^18.2.12",
"react": "^18.1.0"
Expand Down
65 changes: 37 additions & 28 deletions packages/color-modes/src/custom-properties.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { ColorMode, ColorModesScale, css, Theme } from '@theme-ui/css'
import {
ColorMode,
ColorModesScale,
css,
Theme,
ThemeUICSSObject,
} from '@theme-ui/css'

const toVarName = (key: string) => `--theme-ui-${key.replace('-__default', '')}`
const toVarValue = (key: string) => `var(${toVarName(key)})`
Expand Down Expand Up @@ -75,40 +81,43 @@ export const __createColorStyles = (theme: Theme = {}) => {
} = theme.config || theme || {}
const colors = theme.rawColors || theme.colors

if (!colors || useRootStyles === false) return {}
if (useCustomProperties === false) {
return css({
color: 'text',
bg: 'background',
})(theme)
}

const modes = colors.modes || {}
if (!colors) return {}

const styles = __createColorProperties(colors, modes)
const res: ThemeUICSSObject = {}

if (printColorModeName) {
let printMode = modes[printColorModeName]
if (!printMode && printColorModeName === initialColorModeName)
printMode = colors

if (printMode) {
styles['@media print'] = __objectToVars('colors', printMode)
if (useRootStyles !== false) {
if (useCustomProperties === false) {
res.color = 'text'
res.bg = 'background'
} else {
console.error(
`Theme UI \`printColorModeName\` was not found in colors scale`,
{ colors, printColorModeName }
)
res.color = toVarValue('colors-text')
res.bg = toVarValue('colors-background')
}
}

const colorToVarValue = (color: string) => toVarValue(`colors-${color}`)
if (useCustomProperties !== false) {
const modes = colors.modes || {}
const styles = __createColorProperties(colors, modes)

if (printColorModeName) {
let printMode = modes[printColorModeName]
if (!printMode && printColorModeName === initialColorModeName)
printMode = colors

if (printMode) {
styles['@media print'] = __objectToVars('colors', printMode)
} else {
console.error(
`Theme UI \`printColorModeName\` was not found in colors scale`,
{ colors, printColorModeName }
)
}
}

Object.assign(res, styles)
}

return css({
...styles,
color: colorToVarValue('text'),
bg: colorToVarValue('background'),
})(theme)
return css(res)(theme)
}

/**
Expand Down
12 changes: 5 additions & 7 deletions packages/color-modes/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -903,12 +903,11 @@ test('colorMode accepts function from previous state to new one', () => {
test('warns when localStorage is disabled', () => {
const restoreConsole = mockConsole()

const localStorage = window.localStorage
Object.defineProperty(window, 'localStorage', {
get: jest.fn(() => {
const spy = jest
.spyOn(Storage.prototype, 'getItem')
.mockImplementation(() => {
throw new Error('SecurityError: The operation is insecure.')
}),
})
})

let mode = ''
const Consumer = () => {
Expand All @@ -927,8 +926,6 @@ test('warns when localStorage is disabled', () => {

expect(mode).toBe(undefined)

Object.defineProperty(window, 'localStorage', { value: localStorage })

expect((console.warn as jest.Mock).mock.calls[0]).toMatchInlineSnapshot(`
[
"localStorage is disabled and color mode might not work as expected.",
Expand All @@ -937,6 +934,7 @@ test('warns when localStorage is disabled', () => {
]
`)

spy.mockClear()
restoreConsole()
})

Expand Down
2 changes: 1 addition & 1 deletion packages/color/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@theme-ui/color",
"version": "0.16.2",
"version": "0.17.0-develop.0",
"source": "src/index.ts",
"main": "dist/theme-ui-color.cjs.js",
"module": "dist/theme-ui-color.esm.js",
Expand Down
6 changes: 3 additions & 3 deletions packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@theme-ui/components",
"version": "0.16.2",
"version": "0.17.0-develop.0",
"main": "dist/theme-ui-components.cjs.js",
"module": "dist/theme-ui-components.esm.js",
"types": "dist/theme-ui-components.cjs.d.ts",
Expand All @@ -15,12 +15,12 @@
"@types/styled-system": "^5.1.13"
},
"peerDependencies": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.13.3",
"@theme-ui/theme-provider": "workspace:^",
"react": ">=18"
},
"devDependencies": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.13.3",
"@theme-ui/test-utils": "workspace:^",
"@types/react": "^18.2.12",
"react": "^18.1.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/jsx-dev-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"sideEffects": false,
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.13.3",
"react": "^18"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/jsx-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"sideEffects": false,
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.13.3",
"react": "^18"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@theme-ui/core",
"version": "0.16.2",
"version": "0.17.0-develop.0",
"source": "src/index.ts",
"main": "dist/theme-ui-core.cjs.js",
"module": "dist/theme-ui-core.esm.js",
Expand Down Expand Up @@ -48,11 +48,11 @@
"deepmerge": "^4.2.2"
},
"peerDependencies": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.13.3",
"react": ">=18"
},
"devDependencies": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.13.3",
"@theme-ui/test-utils": "workspace:^",
"@types/react": "^18.2.12",
"react": "^18.1.0"
Expand Down
Loading

0 comments on commit 0d177c4

Please sign in to comment.