-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby-design-tokens): v2 #21240
Conversation
- add black/whiteFade[90,40,20,5] - fix black/whiteFade[80], was 85%
- bgInline -> backgroundInline - bg -> background
This contained almost only sizes very specific to gatsbyjs.org — `avatar` and `headerHeight` aside. `gatsby-interface` has its own `dimensions` definitions and should be unaffected by this change.
Add named font-weights, including the required theme-ui defaults `body`, `heading`, and `bold` (https://theme-ui.com/theme-spec#typography): - body: 400 - semiBold: 600 - gatsbyjs.org's source code expects this to be `medium`, needs minor refactor - bold: 700 - `gatsby-interface` defines `bold` as `800`, whatever it consumes needs to refactor to use `extraBold` instead - heading: 700 - extraBold: 800 - gatsbyjs.org's source code expects this to be `headingPrimary`, needs minor refactor
- comply with theme-ui requirements: https://theme-ui.com/theme-spec#typography - consumers need to refactor `fonts.header` to `fonts.heading`
… ah well. TBD.
These tokens started as only being consumed via styled-system. In its context, and using an object to define breakpoints, this somewhat made sense/was required. Since we switched to theme-ui, it doesn't anymore. And since `gatsby-interface` defines its own breakpoints, and gatsbyjs.org's source code already removes this breakpoint along adjusting the scale from object to array as required by `theme-ui`, this shouldn't hurt.
… first step to bring stuff in line with `gatsby-interface`
Both themes don't tree-shake yet, so no agadoo. This enables - `import { theme as default } from "gatsby-design-tokens/dist/theme-gatsbyjs-org"` in `www/src/gatsby-plugin-theme-ui/index` - directly import individual token groups with `import { mediaQueries } from "gatsby-design-tokens/dist/theme-gatsbyjs-org"`
Pretty sure this is the most unelegant way to do this :D - add export `breakpointsArray`: breakpoints as expected by `theme-ui` - add export `fontsStrings`: oh naming things :-P … CSS value for `font-family` - add export `fontSizesRem`, - add export `spaceRem`: values in `rem`, as used by both gatsbyjs.org and `gatsby-interface` - adust `theme.js` accordingly - add TODO re:https://reverent-keller-9597e8.netlify.com/?path=/story/theme--tones
We also have preferences irt default units. - `fontsSizes` exports `rem` values now; old values available at `fontSizesRaw` - `space` exports `rem` values now, too; old stuff available at `spaceRaw` - `fonts` exports a string now, ready to be used with the `font-family` CSS prop; old array of font family names available as `fontsLists`
For clarity, see discussion in gatsby-inc/gatsby-interface#181
- backgroundInline -> bgInline - background -> bg
- bump `gatsby-plugin-emotion` - remove `@emotion/core`, `@mdx-js/react` (ref. https://github.com/system-ui/theme-ui/blob/master/CHANGELOG.md#v030-2019-01-22) - `gatsby-design-tokens` currently has the version number provided by `gatsby-dev`, see #21240 for context)
Ay, this is missing a youtube link: https://www.youtube.com/watch?v=zhVgbZdMdb0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌮 🌮 🌮
Published in |
Thank you @sidharthachatterjee! 💜 To everyone following along: Let's continue the discussion about further changes over at https://github.com/gatsby-inc/gatsby-interface/issues/181 — the 2.0 release is by no means meant to be a stop to that (, and moar updates). 🤗 cc @wardpeet The changed |
FWIW — botched updating the changelog — my commit messages (that, squashed, became the PR commit message body) didn't contain the required things, only my PR description had these, and we missed c&p that when merging. Will get a follow-up PR in. ✌️ |
For anyone following along, unfortunately the I have my guesses on why that is (or … hold on, |
* Update to `theme-ui`, `gatsby-plugin-theme-ui` v0.3 - bump `gatsby-plugin-emotion` - remove `@emotion/core`, `@mdx-js/react` (ref. https://github.com/system-ui/theme-ui/blob/master/CHANGELOG.md#v030-2019-01-22) - `gatsby-design-tokens` currently has the version number provided by `gatsby-dev`, see #21240 for context) * No need to suffix `px` for `radii` in template literals and outside of `sx` anymore * Import `theme-ui` theme from `gatsby-design-tokens` * `fonts.header` -> `fonts-heading * Import from `gatsby-design-tokens/dist/theme-gatsbyjs-org` * `fonts.system` -> `fonts.body` Not a required change because `fonts.system` is still available, but IMO it's good to follow the `theme-ui` convention. * Stray `radii` suffix missed in 86de7c0 * `fontWeights.headingPrimary` -> `fontWeights.extraBold` * `fontWeights.medium` -> `fontWeights.semiBold` * `${t.transition.speed.default} ${t.transition.curve.default}` -> `default We can omit the transition-property/keyword, defaults to `all`. * `code.background` -> `code.bg` * Adjust sidebar transition speed The next v of `gatsby-design-tokens` defines `speed.slow` as `500ms`, before it was `250`. Let's use the default of `250ms` instead. Snappier actually feels better. * Use `transition.default` shortcut * Bump `gatsby-design-tokens` * FWIW bump moar
* Update to `theme-ui`, `gatsby-plugin-theme-ui` v0.3 - bump `gatsby-plugin-emotion` - remove `@emotion/core`, `@mdx-js/react` (ref. https://github.com/system-ui/theme-ui/blob/master/CHANGELOG.md#v030-2019-01-22) - `gatsby-design-tokens` currently has the version number provided by `gatsby-dev`, see gatsbyjs/gatsby#21240 for context) * No need to suffix `px` for `radii` in template literals and outside of `sx` anymore * Import `theme-ui` theme from `gatsby-design-tokens` * `fonts.header` -> `fonts-heading * Import from `gatsby-design-tokens/dist/theme-gatsbyjs-org` * `fonts.system` -> `fonts.body` Not a required change because `fonts.system` is still available, but IMO it's good to follow the `theme-ui` convention. * Stray `radii` suffix missed in 86de7c0 * `fontWeights.headingPrimary` -> `fontWeights.extraBold` * `fontWeights.medium` -> `fontWeights.semiBold` * `${t.transition.speed.default} ${t.transition.curve.default}` -> `default We can omit the transition-property/keyword, defaults to `all`. * `code.background` -> `code.bg` * Adjust sidebar transition speed The next v of `gatsby-design-tokens` defines `speed.slow` as `500ms`, before it was `250`. Let's use the default of `250ms` instead. Snappier actually feels better. * Use `transition.default` shortcut * Bump `gatsby-design-tokens` * FWIW bump moar
If we ever use
This makes sense, I can try tackling this when I have a bit more free time :) |
👍 Yeah TBH I can't really make sense of this myself anymore (multiple entry points/tree-shaking aside) — I probably thought |
I already did look into this a little, maybe I can get a draft PR up … |
I actually have added some definitions to |
* Update to `theme-ui`, `gatsby-plugin-theme-ui` v0.3 - bump `gatsby-plugin-emotion` - remove `@emotion/core`, `@mdx-js/react` (ref. https://github.com/system-ui/theme-ui/blob/master/CHANGELOG.md#v030-2019-01-22) - `gatsby-design-tokens` currently has the version number provided by `gatsby-dev`, see gatsbyjs/gatsby#21240 for context) * No need to suffix `px` for `radii` in template literals and outside of `sx` anymore * Import `theme-ui` theme from `gatsby-design-tokens` * `fonts.header` -> `fonts-heading * Import from `gatsby-design-tokens/dist/theme-gatsbyjs-org` * `fonts.system` -> `fonts.body` Not a required change because `fonts.system` is still available, but IMO it's good to follow the `theme-ui` convention. * Stray `radii` suffix missed in 86de7c0 * `fontWeights.headingPrimary` -> `fontWeights.extraBold` * `fontWeights.medium` -> `fontWeights.semiBold` * `${t.transition.speed.default} ${t.transition.curve.default}` -> `default We can omit the transition-property/keyword, defaults to `all`. * `code.background` -> `code.bg` * Adjust sidebar transition speed The next v of `gatsby-design-tokens` defines `speed.slow` as `500ms`, before it was `250`. Let's use the default of `250ms` instead. Snappier actually feels better. * Use `transition.default` shortcut * Bump `gatsby-design-tokens` * FWIW bump moar
Description
This PR drafts the next major version (2) of
gatsby-design-tokens
.TL;DR, we want to
theme-ui
Gatsby theme, and the gatsbyjs.org-specifictheme-ui
theme; also ref. [www][gatsby-design-tokens] Port tokens / consolidate/add theme-ui theme fromwww
#19115; wondering if those should be separate packages?Documentation / Changelog
Tokens
This update, apart from the goals mentioned above, moves the rudimentary tokens even closer to our current sole target, CSS. This e.g. means that instead of exporting an array of integers for
fontSizes
orspace
, we now providerem
values instead (while still making the v1 variants available — but we do have "soft" preferences irt default units for CSS which are emphasized by these breaking changes).We currently only consume these tokens in the context of CSS, so let's make things a bit easier there:
fontsSizes
exportsrem
values now; old values available atfontSizesRaw
space
exportsrem
values now, too; old stuff available atspaceRaw
fonts
exports a string now, ready to be used with thefont-family
CSS prop; old array of font family names available asfontsLists
radii
now contains thepx
unitThe update also embraces
theme-ui
a bit more directly by partially adopting and/or inheriting its naming conventions for a bunch of tokens, making "theme composition using token groups" even easier than before.Regarding the discussion in https://github.com/gatsby-inc/gatsby-interface/issues/181, everything but the
space
scale has been adjusted to hopefully "just work", or work easier than before. The update to v2 ofgatsby-design-tokens
should require almost no refactoring of values ingatsby-interface
—transition
properties partially follow a different naming conventionfonts.header
changed tofonts.headling
radii
values now come with thepx
unit, so the latter is not needed anymore in template literals— and apart from that should be solved by removing the transformation of
fontSizes
andspaces
to
rem, and the
joinof
fonts` stacks. (cc @amberleyromo @greglobinski @Elanhant — please also see the "Infamous last words" section at the end).Here's all changes listed by "token group":
breakpoints
breakpoints.xxs
styled-system
. In its context, and using an object to define breakpoints,breakpoints.xxs
made sense/was required. Since we switched totheme-ui
, it doesn't anymore.gatsby-interface
defines its own set ofbreakpoints
; thewww
source already adjusted this when composing itstheme-ui
theme, so this shouldn't hurt at all.breakpointsArray
, ready fortheme-ui
's responsive styles featurecolors
colors.blackFade
andcolors.whiteFade
:colors.blackFade[90]
colors.blackFade[40]
colors.blackFade[20]
colors.blackFade[5]
colors.whiteFade[90]
colors.whiteFade[40]
colors.whiteFade[20]
colors.whiteFade[5]
colors.blackFade[80]
,colors.whiteFade[80]
.85
, adjusted to.8
gatsby-interface
and related (.com/Cloud dashboard).colors.code
from the gatsbyjs.orgtheme-ui
theme to thecolors
tokenscolors.code.copyButton
colors.code.lineHighlightBackground
colors.code.scrollbarTrack
fonts
body
andsans
forfonts.system
fonts.header
tofonts.heading
theme-ui
requirements: https://theme-ui.com/theme-spec#typography.fonts.header
tofonts.heading
.brand
forfonts.heading
fonts
exports a string now, ready to be used with thefont-family
CSS prop; the array of font family names is still available asfontsLists
join
font family names ingatsby-interface
any longer.fontSizes
fontSizes
does now containrem
values; old scale (integers) still available asfontSizesRaw
fontSizesPx
rem
ingatsby-interface
anymore.fontWeights
fontWeights
— switch from array to objectbody
,heading
, andbold
(https://theme-ui.com/theme-spec#typography).body: 400
semiBold: 600
medium
, needs minor refactorbold: 700
gatsby-interface
definesbold
as800
, whatever it consumes needs to refactor to useextraBold
insteadheading: 700
extraBold: 800
headingPrimary
, needs minor refactorlineHeights
heading
(equivalent to the existingdense
) andbody
(equivalent to the existingdefault
) to satisfytheme-ui
's "Typography" theme requirementsradii
px
unit to radii scale values.px
unit in when used in template literals, etc.px
from usages in template literals, etc.sizes
sizes
tokens totheme-gatsbyjs-org
for clarity, until a clear pattern emerges.space
space
does now containrem
values; old scale (integers) still available asspaceRaw
spacePx
rem
ingatsby-interface
anymore.transition
transition.default
shortcuttransition.curve.fastOutLinearIn
fromgatsby-interface
transition.speed.faster
(50ms
), matchinggatsby-interface
'sblink
transition.speed.slower
(1000ms
), matchinggatsby-interface
'ssnail
transition.speed.slow
from350ms
to500ms
, now matchinggatsby-interface
gatsby-interface
, naming of two properties differs.gatsby-interface
and related.zIndices
zIndices
tokens totheme-gatsbyjs-org
for clarity, until a clear pattern emerges.Themes
Tested and working with
gatsby-plugin-theme-ui@^0.3.0
,theme-ui@^0.3.1
; currentwww
version of the two is assumed to be working, too. I have a version ofwww
working withgatsby-design-tokens-next
that I'll get a PR up for. — Edit: see PR #21276theme-ui
Gatsby theme, gatsbyjs.orgtheme-ui
themeagadoo
yet in the correspondinggatsby-design-tokens/package.json
scripts. @wardpeet I'd love to take your offer and would appreciate if we could take a look at the mess I made next week! 🙏theme-ui
theme astheme
and also provide individual token group exports (because we require them inwww
for usage outside of thetheme-ui
context).www
— see PR chore(www): Adjust forgatsby-design-tokens
v2 #21276:export { theme as default } from "gatsby-design-tokens/dist/theme-gatsbyjs-org"
inwww/src/gatsby-plugin-theme-ui/index
import { mediaQueries } from "gatsby-design-tokens/dist/theme-gatsbyjs-org"
.Related Issues
www
#19115 [www][gatsby-design-tokens] Port tokens / consolidate/add theme-ui theme fromwww
gatsby-design-tokens
updategatsby-design-tokens
v2 #21276 chore(www): Adjust forgatsby-design-tokens
v2Infamous last words
gatsby-design-tokens
togatsby-interface
?gatsby-interface
TONES
vs "role-based tokens" ingatsby-design-tokens
, andtheme-ui
's variants — e.g. would be nice to have theTONES
available for usage with the themes, andtheme-ui
'ssx
prop,variants
seems great to spec components (even if we don't usetheme-ui
components), etc.colors
, we already have a need for a bit of functionality like e.g. this around additional metadata