Skip to content
Merged

0.15.5 #2390

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d30c023
fix: Fix logo script typo
lachlanjc Nov 20, 2022
9dc959e
Bump versions to: 0.15.5-develop.0 [skip ci]
hasparus Nov 20, 2022
cdbff73
docs: Reorganize Color Modes doc for clarity
lachlanjc Nov 20, 2022
aa8a976
docs: Add missing `useMDXComponents` import (#2370)
Nischal2015 Nov 25, 2022
8e4b9d4
docs: Add `@theme-ui/mdx` to Gatsby install instructions (#2373)
LekoArts Dec 2, 2022
9fbd1fc
chore: Upgrade Cypress GitHub Action to use Node 18
lachlanjc Dec 2, 2022
115e22d
Start global
lachlanjc Nov 20, 2022
e044fad
Improve testing
lachlanjc Jan 16, 2023
9bc8b3b
Add global dep to docs
lachlanjc Jan 16, 2023
4c104fc
Add back makeTheme in Next example
hasparus Jan 22, 2023
a9dba92
Add supressHydrationWarning to colorMode toggle — ofc server content…
hasparus Jan 22, 2023
6e8f8d2
Accept GlobalProps.styles instead of GlobalProps.sx
hasparus Jan 22, 2023
8837825
test(global): change the test a bit to make it work consistently
hasparus Jan 22, 2023
8bc670a
chore: use Global.styles in sidenav
hasparus Jan 22, 2023
af0ed1c
chore: explicitly type Global return value to work around "Global can…
hasparus Jan 22, 2023
ac36c53
chore: update the rest of Global.sx to Global.styles
hasparus Jan 22, 2023
f9c7f93
Merge pull request #2385 from system-ui/2207-global-component
hasparus Jan 22, 2023
83bd581
Bump versions to: 0.15.5-develop.1 [skip ci]
hasparus Jan 22, 2023
2d8bfc3
components: Rewrite Spinner for better performance (#2384)
lachlanjc Jan 23, 2023
91f14e9
fix(custom-properties): use default key name if pluralize returns emp…
wahidrahim Feb 3, 2023
4c84e7d
Merge pull request #2389 from wahidrahim/fix-custom-properties
hasparus Feb 7, 2023
8aa5c36
Bump versions to: 0.15.5-develop.2 [skip ci]
hasparus Feb 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- run: pnpm build:docs
- run: cd packages/e2e && pnpm cypress install

- uses: cypress-io/github-action@v4.2.0
- uses: cypress-io/github-action@v5.0.0
with:
record: true
parallel: true
Expand Down
2 changes: 2 additions & 0 deletions examples/next/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { Button, useColorMode } from 'theme-ui'

const Header = () => {
const [colorMode, setColorMode] = useColorMode()

return (
<header>
<Button
suppressHydrationWarning
onClick={() => setColorMode(colorMode === 'light' ? 'dark' : 'light')}
>
Toggle {colorMode === 'light' ? 'Dark' : 'Light'}
Expand Down
1 change: 1 addition & 0 deletions examples/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@mdx-js/loader": "^2.1.2",
"@mdx-js/react": "^2.1.2",
"@next/mdx": "^12.0.7",
"@theme-ui/css": "workspace:^",
"next": "^12.1.0",
"react": "^18",
"react-dom": "^18",
Expand Down
2 changes: 2 additions & 0 deletions examples/next/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import Head from 'next/head'
import About from '../components/about.mdx'
import { Global } from 'theme-ui'

export default function Page() {
return (
<>
<Head>
<title>Next.js Theme UI</title>
</Head>
<Global styles={{ h1: { color: 'salmon !important' } }} />
<About />
</>
)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test:coverage": "cross-env \"NODE_OPTIONS=--experimental-vm-modules --no-warnings\" jest --coverage",
"typecheck": "tsc --noEmit",
"typecheck:tests": "tsc --noEmit -P ./tsconfig.test.json",
"logo": "pnpm run --filter docs docs logo",
"logo": "pnpm run --filter docs logo",
"postinstall": "preconstruct dev",
"dev": "preconstruct dev",
"release": "pnpm clean && pnpm build && pnpm shipit && node scripts/publish-to-npm.mjs",
Expand Down
2 changes: 1 addition & 1 deletion 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.15.4",
"version": "0.15.5-develop.2",
"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 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.15.4",
"version": "0.15.5-develop.2",
"source": "src/index.ts",
"main": "dist/theme-ui-color.cjs.js",
"module": "dist/theme-ui-color.esm.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@theme-ui/components",
"version": "0.15.4",
"version": "0.15.5-develop.2",
"main": "dist/theme-ui-components.cjs.js",
"module": "dist/theme-ui-components.esm.js",
"types": "dist/theme-ui-components.cjs.d.ts",
Expand Down
67 changes: 24 additions & 43 deletions packages/components/src/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
import React, { SVGAttributes } from 'react'
import { keyframes } from '@emotion/react'

import React from 'react'
import type { ThemeUICSSObject } from '@theme-ui/css'

import { Box, BoxOwnProps, BoxProps } from './Box'
import type { ForwardRef } from './types'
import { __internalProps } from './util'

const spin = keyframes({
from: {
transform: 'rotate(0deg)',
},
to: {
transform: 'rotate(360deg)',
},
})

export interface SpinnerProps
extends Omit<
React.ComponentPropsWithRef<'svg'>,
'opacity' | 'color' | 'css' | 'sx' | 'strokeWidth'
>,
BoxOwnProps {
size?: number | string
size?: number
strokeWidth?: number
title?: string
duration?: number
Expand All @@ -34,37 +23,17 @@ export const Spinner: ForwardRef<SVGSVGElement, SpinnerProps> =
size = 48,
strokeWidth = 4,
max = 1,
title = 'Loading...',
duration = 500,
title = 'Loading',
duration = 750,
...props
},
ref
) {
const r = 16 - strokeWidth
const C = 2 * r * Math.PI
const offset = C - (1 / 4) * C

const __css: ThemeUICSSObject = {
color: 'primary',
overflow: 'visible',
}

const circleProps: SVGAttributes<SVGCircleElement> = {
cx: 16,
cy: 16,
r,
strokeDasharray: C,
strokeDashoffset: offset,
}

const __circleCss: ThemeUICSSObject = {
transformOrigin: '50% 50%',
animationName: spin.toString(),
animationTimingFunction: 'linear',
animationDuration: duration + 'ms',
animationIterationCount: 'infinite',
}

const svgProps = {
strokeWidth,

Expand All @@ -77,6 +46,14 @@ export const Spinner: ForwardRef<SVGSVGElement, SpinnerProps> =
role: 'img',
}

const circleProps = {
strokeWidth,
r: 16 - strokeWidth,
cx: 16,
cy: 16,
fill: 'none',
}

return (
<Box
ref={ref}
Expand All @@ -86,14 +63,18 @@ export const Spinner: ForwardRef<SVGSVGElement, SpinnerProps> =
{...__internalProps({ __css })}
>
<title>{title}</title>
<circle cx={16} cy={16} r={r} opacity={1 / 8} />
<Box
as="circle"
{...(circleProps as {})}
{...__internalProps({
__css: __circleCss,
})}
/>
<circle {...circleProps} opacity={1 / 8} />
<circle {...circleProps} strokeDasharray="20 110">
<animateTransform
attributeName="transform"
attributeType="XML"
type="rotate"
from="0 16 16"
to="360 16 16"
dur={`${duration}ms`}
repeatCount="indefinite"
/>
</circle>
</Box>
)
})
53 changes: 17 additions & 36 deletions packages/components/test/__snapshots__/index.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1329,22 +1329,6 @@ exports[`Slider renders 1`] = `
`;

exports[`Spinner renders 1`] = `
@keyframes animation-0 {
from {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}

to {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}

.emotion-0 {
box-sizing: border-box;
margin: 0;
Expand All @@ -1353,21 +1337,6 @@ exports[`Spinner renders 1`] = `
overflow: visible;
}

.emotion-1 {
box-sizing: border-box;
margin: 0;
min-width: 0;
transform-origin: 50% 50%;
-webkit-animation-name: animation-0;
animation-name: animation-0;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-duration: 500ms;
animation-duration: 500ms;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}

<svg
className="emotion-0"
fill="none"
Expand All @@ -1379,22 +1348,34 @@ exports[`Spinner renders 1`] = `
width={48}
>
<title>
Loading...
Loading
</title>
<circle
cx={16}
cy={16}
fill="none"
opacity={0.125}
r={12}
strokeWidth={4}
/>
<circle
className="emotion-1"
cx={16}
cy={16}
fill="none"
r={12}
strokeDasharray={75.39822368615503}
strokeDashoffset={56.548667764616276}
/>
strokeDasharray="20 110"
strokeWidth={4}
>
<animateTransform
attributeName="transform"
attributeType="XML"
dur="750ms"
from="0 16 16"
repeatCount="indefinite"
to="360 16 16"
type="rotate"
/>
</circle>
</svg>
`;

Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@theme-ui/core",
"version": "0.15.4",
"version": "0.15.5-develop.2",
"source": "src/index.ts",
"main": "dist/theme-ui-core.cjs.js",
"module": "dist/theme-ui-core.esm.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/css/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@theme-ui/css",
"version": "0.15.4",
"version": "0.15.5-develop.2",
"source": "src/index.ts",
"main": "dist/theme-ui-css.cjs.js",
"module": "dist/theme-ui-css.esm.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/custom-properties/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@theme-ui/custom-properties",
"description": "Generate CSS custom properties for use with Theme UI",
"version": "0.15.4",
"version": "0.15.5-develop.2",
"source": "src/index.ts",
"main": "dist/theme-ui-custom-properties.cjs.js",
"module": "dist/theme-ui-custom-properties.esm.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/custom-properties/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function makeCustomProperties(theme: Theme, prefix?: string) {

const generateProperties = (object: object, previousKey?: string) => {
Object.entries(object).forEach(([key, value]) => {
let formattedKey = pluralize(key, 1)
let formattedKey = pluralize(key, 1) || key

if (
process.env.NODE_ENV !== 'production' &&
Expand Down
6 changes: 6 additions & 0 deletions packages/custom-properties/test/__snapshots__/test.mjs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ exports[`transforms a theme config to CSS custom properties 1`] = `
"--fontWeight-heading": 700,
"--lineHeight-0": 1.5,
"--lineHeight-1": 1.125,
"--radius-l": "0.5em",
"--radius-m": "0.25em",
"--radius-s": "0.125em",
"--size-0": "10em",
"--size-1": "20em",
"--size-2": "30em",
Expand Down Expand Up @@ -49,6 +52,9 @@ exports[`transforms a theme config to CSS custom properties with prefix 1`] = `
"--🍭-fontWeight-heading": 700,
"--🍭-lineHeight-0": 1.5,
"--🍭-lineHeight-1": 1.125,
"--🍭-radius-l": "0.5em",
"--🍭-radius-m": "0.25em",
"--🍭-radius-s": "0.125em",
"--🍭-size-0": "10em",
"--🍭-size-1": "20em",
"--🍭-size-2": "30em",
Expand Down
5 changes: 5 additions & 0 deletions packages/custom-properties/test/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ const theme = {
lineHeights: [1.5, 1.125],
space: [0, 2, 3, 4, 5, 6],
size: ['10em', '20em', '30em', '40em'],
radii: {
s: '0.125em',
m: '0.25em',
l: '0.5em',
},
}

it('transforms a theme config to CSS custom properties', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "docs",
"version": "0.15.4",
"version": "0.15.5-develop.2",
"main": "dist/docs.cjs.js",
"author": "Brent Jackson <jxnblk@gmail.com>",
"license": "MIT",
Expand All @@ -26,6 +26,7 @@
"@theme-ui/core": "workspace:^",
"@theme-ui/components": "workspace:^",
"@theme-ui/css": "workspace:^",
"@theme-ui/global": "workspace:^",
"@theme-ui/match-media": "workspace:^",
"@theme-ui/mdx": "workspace:^",
"@theme-ui/presets": "workspace:^",
Expand Down
Loading