Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(patterns): user defined theme level patterns #302

Merged
merged 20 commits into from
May 11, 2022
Merged

Conversation

pretzelhammer
Copy link
Collaborator

@pretzelhammer pretzelhammer commented Apr 19, 2022

Describe the problem this PR addresses

#269

Describe the changes in this PR

  • adds support for user-defined theme-level patterns to theming system
  • adds default MText patterns: headline, title, paragraph, label
  • adds default MButton patterns: primary, secondary, tertiary
  • removes MHeading
  • adds h1-h6 as supported values for MText element prop
  • makes MText have 0 margin by default for all elements (including default p element)
  • updates MText's textAlign, textTransform, fontSize, fontStyle, fontFamily, lineHeight, and color props to accept all valid CSS values for those properties
  • prefixes all Maker public css vars with maker
  • renames Maker public CSS var --color-heading to --maker-color-heading
  • renames Maker public CSS var --color-text to --maker-color-body
  • adds heading, body, and label objects to fonts object in theme definition which support fontFamily and fontWeight fields, customizing these fields customizes the default MText patterns as well as customizing how typography is rendered in all Maker components, e.g. MButton, MCalendar, MContainer, MModal, MSelect, MChoice, etc etc

Migration Guide: v9 -> v11

  • if you don't want to set a themeable prop but must pass some value then '' (empty string) no longer works for that use-case, you must now explicitly pass undefined
  • refactor<m-heading>s to <m-text pattern="title">s, copy over any other props & values as-is
  • remove MHeading
  • move any MHeading theming into the new fonts.heading part of the theme, e.g. change this:
heading: {
  fontFamily: 'whatever',
  fontWeight: 'whatever',
},

to this:

fonts: {
  heading: {
    fontFamily: 'whatever',
    fontWeight: 'whatever',
  },
},
  • optional (but recommended, since it updates typography used in all Maker components) copy any MText theming into fonts.body, e.g. copy this:
text: {
  fontFamily: 'whatever',
  fontWeight: 'whatever',
},

to this:

fonts: {
  body: {
    fontFamily: 'whatever',
    fontWeight: 'whatever',
  },
},
  • if necessary, re-add margin to <m-text element="p"> (p is the default element)
  • refactor these maker public CSS vars using this table:
before after
--neutral-0 --maker-color-neutral-0
--neutral-10 --maker-color-neutral-10
--neutral-20 --maker-color-neutral-20
--neutral-80 --maker-color-neutral-80
--neutral-90 --maker-color-neutral-90
--neutral-100 --maker-color-neutral-100
--color-primary --maker-color-primary
--color-background --maker-color-background
--color-heading --maker-color-heading
--maker-color-title --maker-color-heading
--color-text --maker-color-body
--maker-color-paragraph --maker-color-body
--color-elevation --maker-color-elevation
--color-overlay --maker-color-overlay
--font-family-title --maker-font-heading-font-family
--maker-font-family-title --maker-font-heading-font-family
--font-weight-title --maker-font-heading-font-weight
--maker-font-weight-title --maker-font-heading-font-weight
--font-family-paragraph --maker-font-body-font-family
--maker-font-family-paragraph --maker-font-body-font-family
--font-weight-paragraph --maker-font-body-font-weight
--maker-font-weight-paragraph --maker-font-body-font-weight
--font-family-label --maker-font-label-font-family
--maker-font-family-label --maker-font-label-font-family
--font-weight-label --maker-font-label-font-weight
--maker-font-weight-label --maker-font-label-font-weight
  • optional: refactor <m-button variant="primary"> to <m-button pattern="primary"> (for all button variants)

* feat(text)!: theme variants

* refactor(heading)!: removes heading component after merging it into text component

* refactor!: changes mtext theme defaults & theme prop resolution algo

* docs(text): variant docs

* feat(button)!: user defined theme variants
* fix!: typography defaults

* docs: theme lab typo controls (#286)

* docs: adds basic typography controls to ThemeTest lab

* docs: adds typography variants controls to ThemeTest lab

* docs: moves typography controls to top of themetest lab
* feat(input): theme input component text style

* feat(textarea): themes textarea text style

* feat(actionbarbutton): themes actionbarbutton's text style

* feat(button): themes button text style

* feat(calendar): themes calendar text styles

* feat(choice): themes Choice text style

* feat(container): themes container's label & content text styles

* docs: more spacing in ThemeTest lab

* feat(notice): themes notice's text content

* feat(pininput): themes pininput text content

* feat: themes SegmentedControl & Select text content

* feat(stepper): themes stepper text content

* feat(textbutton): themes textbutton's text content

* feat: themes labels & sublabels in inline form controls

* fix(container): fixes which global text styles are applied to container

* docs: adds title family & weight to ThemeTest lab

* feat: themes text content in Blades, Dialogs, Modals

* fix: headlines have same font family as titles

* fix: themed colors for Calendar, Container, & Inline Form components

* refactor!: renames heading & body colors to title & paragraph

* fix: title & paragraph color theming

* fix: label default theme

* feat: more typography css inheritance

* docs: updates ThemeTest docs & Text docs

* refactor: minimizes paragraph css in calendar

* refactor: minimizes css styles in container

* refactor: minimizes typo css in modal, dialog, blade

* refactor: minimizes typo css in input

* refactor: minimizes typo css in notice

* refactor: minimizes typo css in select

* refactor: minimizes typo css in inline form controls
@github-actions
Copy link

Styleguide deployed to https://square.github.io/maker/styleguide/beta/#/

@github-actions
Copy link

github-actions bot commented Apr 19, 2022

📊 Package size report   -1.85%↓

File Before After
components/ActionBar/script.js 14.5 kB -0.06%↓14.5 kB
components/ActionBar/styles.css 5.6 kB 1%↑5.7 kB
components/Blade/script.js 6.2 kB 0.2%↑6.2 kB
components/Button/script.js 6.3 kB 0.7%↑6.3 kB
components/Button/styles.css 3.8 kB 2%↑3.9 kB
components/Calendar/styles.css 2.1 kB 3%↑2.2 kB
components/Card/styles.css 614 B 3%↑632 B
components/Checkbox/styles.css 1.4 kB 3%↑1.4 kB
components/Choice/script.js 4.7 kB 0.09%↑4.7 kB
components/Choice/styles.css 1.3 kB 10%↑1.4 kB
components/Container/styles.css 1.0 kB 16%↑1.2 kB
components/Dialog/styles.css 1.2 kB 0.5%↑1.2 kB
components/Divider/styles.css 160 B 8%↑172 B
components/Heading/index.js 46 B
components/Heading/script.js 4.7 kB
components/Heading/styles.css 5.1 kB
components/ImageUploader/styles.css 2.4 kB 2%↑2.4 kB
components/Input/styles.css 2.1 kB 1%↑2.1 kB
components/Menu/styles.css 2.9 kB 1%↑3.0 kB
components/Modal/styles.css 1.0 kB 0.6%↑1.1 kB
components/Notice/styles.css 1.1 kB 1%↑1.1 kB
components/PinInput/styles.css 1.3 kB 10%↑1.4 kB
components/Popover/styles.css 531 B 3%↑549 B
components/Radio/styles.css 1.4 kB 3%↑1.5 kB
components/SegmentedControl/script.js 3.2 kB 0.7%↑3.2 kB
components/SegmentedControl/styles.css 1.3 kB 12%↑1.5 kB
components/Select/styles.css 2.4 kB 1%↑2.5 kB
components/Skeleton/styles.css 930 B 5%↑978 B
components/Stepper/styles.css 1.1 kB 8%↑1.2 kB
components/Text/script.js 4.5 kB 3%↑4.6 kB
components/Text/styles.css 5.1 kB -6.96%↓4.7 kB
components/Textarea/styles.css 1.4 kB 9%↑1.5 kB
components/TextButton/script.js 3.7 kB 0.2%↑3.7 kB
components/TextButton/styles.css 1.5 kB 7%↑1.6 kB
components/Theme/script.js 5.8 kB 32%↑7.6 kB
components/Theme/styles.css 136 B 78%↑242 B
utils/css-validator.js 933 B
utils/InlineFormControlLayout/script.js 2.5 kB -2.55%↓2.5 kB
utils/InlineFormControlLayout/styles.css 380 B -17.1%↓315 B
Total (Includes all files) 1.4 MB -1.85%↓1.4 MB
Tarball size 261.6 kB -2.02%↓256.3 kB
Unchanged files
File Size
components/ActionBar/index.js 46 B
components/Blade/index.js 46 B
components/Blade/styles.css 740 B
components/Button/index.js 46 B
components/Calendar/index.js 46 B
components/Calendar/script.js 7.7 kB
components/Card/index.js 46 B
components/Card/script.js 2.4 kB
components/Checkbox/index.js 46 B
components/Checkbox/script.js 3.9 kB
components/Choice/index.js 46 B
components/Container/index.js 46 B
components/Container/script.js 4.5 kB
components/Dialog/index.js 46 B
components/Dialog/script.js 7.4 kB
components/Divider/index.js 46 B
components/Divider/script.js 1.7 kB
components/Image/index.js 46 B
components/Image/script.js 3.8 kB
components/Image/styles.css 608 B
components/ImageUploader/index.js 46 B
components/ImageUploader/script.js 11.7 kB
components/Input/index.js 46 B
components/Input/script.js 4.3 kB
components/Loading/index.js 46 B
components/Loading/script.js 2.2 kB
components/Loading/styles.css 1.2 kB
components/Menu/index.js 46 B
components/Menu/script.js 10.9 kB
components/Modal/index.js 46 B
components/Modal/script.js 9.8 kB
components/Notice/index.js 46 B
components/Notice/script.js 4.7 kB
components/PinInput/index.js 46 B
components/PinInput/script.js 5.8 kB
components/Popover/index.js 46 B
components/Popover/script.js 10.6 kB
components/ProgressBar/index.js 46 B
components/ProgressBar/script.js 2.9 kB
components/ProgressBar/styles.css 1.1 kB
components/Radio/index.js 46 B
components/Radio/script.js 3.6 kB
components/SegmentedControl/index.js 46 B
components/Select/index.js 46 B
components/Select/script.js 5.3 kB
components/Skeleton/index.js 46 B
components/Skeleton/script.js 4.3 kB
components/StarRating/index.js 46 B
components/StarRating/script.js 5.9 kB
components/StarRating/styles.css 322 B
components/Stepper/index.js 46 B
components/Stepper/script.js 5.7 kB
components/Text/index.js 46 B
components/Textarea/index.js 46 B
components/Textarea/script.js 3.6 kB
components/TextButton/index.js 46 B
components/Theme/index.js 46 B
components/Toggle/index.js 46 B
components/Toggle/script.js 3.7 kB
components/Toggle/styles.css 3.5 kB
components/TouchCapture/index.js 25 B
components/TouchCapture/script.js 3.5 kB
components/TransitionFadeIn/index.js 25 B
components/TransitionFadeIn/script.js 2.3 kB
components/TransitionResize/index.js 25 B
components/TransitionResize/script.js 3.6 kB
components/TransitionSpringLeft/index.js 25 B
components/TransitionSpringLeft/script.js 2.3 kB
components/TransitionSpringUp/index.js 25 B
components/TransitionSpringUp/script.js 2.3 kB
components/TransitionStaggered/index.js 25 B
components/TransitionStaggered/script.js 2.5 kB
LICENSE 552 B
package.json 5.1 kB
README.md 327 B
utils/assert.js 1.1 kB
utils/BlockFormControlLayout/index.js 46 B
utils/BlockFormControlLayout/script.js 1.8 kB
utils/BlockFormControlLayout/styles.css 234 B
utils/constants.js 689 B
utils/debug.js 1.0 kB
utils/get-contrast.js 1.1 kB
utils/InlineFormControlLayout/index.js 46 B
utils/Row/index.js 46 B
utils/Row/script.js 2.4 kB
utils/Row/styles.css 610 B
utils/Transition/index.js 25 B
utils/Transition/script.js 2.4 kB
utils/TransitionResponsive/index.js 25 B
utils/TransitionResponsive/script.js 2.2 kB
utils/transitions.js 4.2 kB
Hidden files
File Before After
components/ActionBar/script.js.map 55.5 kB 0.1%↑55.6 kB
components/ActionBar/styles.css.map 18.5 kB 0.4%↑18.6 kB
components/Blade/script.js.map 23.3 kB 0.08%↑23.3 kB
components/Blade/styles.css.map 3.9 kB 0.4%↑3.9 kB
components/Button/script.js.map 25.0 kB 2%↑25.5 kB
components/Button/styles.css.map 10.9 kB 3%↑11.2 kB
components/Calendar/script.js.map 29.6 kB 0.2%↑29.7 kB
components/Calendar/styles.css.map 10.4 kB 0.7%↑10.5 kB
components/Card/script.js.map 11.9 kB 0.2%↑11.9 kB
components/Card/styles.css.map 1.6 kB 1%↑1.6 kB
components/Checkbox/script.js.map 18.6 kB 0.2%↑18.7 kB
components/Checkbox/styles.css.map 3.7 kB 1%↑3.8 kB
components/Choice/script.js.map 20.7 kB 0.5%↑20.8 kB
components/Choice/styles.css.map 6.4 kB 2%↑6.5 kB
components/Container/script.js.map 18.1 kB 1%↑18.2 kB
components/Container/styles.css.map 4.9 kB 4%↑5.1 kB
components/Dialog/script.js.map 28.6 kB 0.02%↑28.6 kB
components/Dialog/styles.css.map 6.8 kB 0.09%↑6.8 kB
components/Divider/script.js.map 8.8 kB 0.1%↑8.8 kB
components/Divider/styles.css.map 723 B 2%↑735 B
components/Heading/script.js.map 22.4 kB
components/Heading/styles.css.map 11.6 kB
components/Image/script.js.map 15.6 kB 15.6 kB
components/Image/styles.css.map 3.7 kB 3.7 kB
components/ImageUploader/script.js.map 46.0 kB 0.09%↑46.1 kB
components/ImageUploader/styles.css.map 20.3 kB 0.2%↑20.3 kB
components/Input/script.js.map 20.3 kB 0.1%↑20.3 kB
components/Input/styles.css.map 4.9 kB 0.4%↑4.9 kB
components/Loading/script.js.map 11.0 kB 11.0 kB
components/Loading/styles.css.map 2.3 kB 2.3 kB
components/Menu/script.js.map 41.2 kB 0.06%↑41.3 kB
components/Menu/styles.css.map 13.1 kB 0.1%↑13.1 kB
components/Modal/script.js.map 34.9 kB 0.02%↑34.9 kB
components/Modal/styles.css.map 10.7 kB 0.06%↑10.7 kB
components/Notice/script.js.map 18.7 kB 0.06%↑18.7 kB
components/Notice/styles.css.map 4.3 kB 0.1%↑4.3 kB
components/PinInput/script.js.map 23.3 kB 0.6%↑23.4 kB
components/PinInput/styles.css.map 6.7 kB 2%↑6.9 kB
components/Popover/script.js.map 37.6 kB 0.05%↑37.6 kB
components/Popover/styles.css.map 6.8 kB 0.3%↑6.9 kB
components/ProgressBar/script.js.map 13.4 kB 13.4 kB
components/ProgressBar/styles.css.map 2.7 kB 2.7 kB
components/Radio/script.js.map 17.5 kB 0.2%↑17.6 kB
components/Radio/styles.css.map 3.6 kB 1%↑3.7 kB
components/SegmentedControl/script.js.map 14.7 kB 2%↑14.9 kB
components/SegmentedControl/styles.css.map 3.8 kB 5%↑4.0 kB
components/Select/script.js.map 23.9 kB 0.1%↑23.9 kB
components/Select/styles.css.map 6.0 kB 0.3%↑6.1 kB
components/Skeleton/script.js.map 17.8 kB 0.3%↑17.8 kB
components/Skeleton/styles.css.map 3.0 kB 2%↑3.1 kB
components/StarRating/script.js.map 22.3 kB 22.3 kB
components/StarRating/styles.css.map 6.3 kB 6.3 kB
components/Stepper/script.js.map 22.1 kB 0.4%↑22.2 kB
components/Stepper/styles.css.map 6.5 kB 1%↑6.6 kB
components/Text/script.js.map 21.5 kB 4%↑22.3 kB
components/Text/styles.css.map 10.9 kB 5%↑11.5 kB
components/Textarea/script.js.map 17.6 kB 0.7%↑17.7 kB
components/Textarea/styles.css.map 3.8 kB 3%↑3.9 kB
components/TextButton/script.js.map 16.9 kB 0.7%↑17.0 kB
components/TextButton/styles.css.map 4.2 kB 3%↑4.3 kB
components/Theme/script.js.map 22.7 kB 24%↑28.0 kB
components/Theme/styles.css.map 2.4 kB 28%↑3.1 kB
components/Toggle/script.js.map 19.6 kB 19.6 kB
components/Toggle/styles.css.map 5.4 kB 5.4 kB
components/TouchCapture/script.js.map 12.0 kB 12.0 kB
components/TransitionFadeIn/script.js.map 10.5 kB 10.5 kB
components/TransitionResize/script.js.map 14.4 kB 14.4 kB
components/TransitionSpringLeft/script.js.map 10.5 kB 10.5 kB
components/TransitionSpringUp/script.js.map 10.5 kB 10.5 kB
components/TransitionStaggered/script.js.map 11.1 kB 11.1 kB
utils/assert.js.map 4.2 kB 4.2 kB
utils/BlockFormControlLayout/script.js.map 8.4 kB 8.4 kB
utils/BlockFormControlLayout/styles.css.map 762 B 762 B
utils/constants.js.map 2.5 kB 2.5 kB
utils/css-validator.js.map 3.3 kB
utils/debug.js.map 3.6 kB 3.6 kB
utils/get-contrast.js.map 4.9 kB 4.9 kB
utils/InlineFormControlLayout/script.js.map 12.8 kB -1.66%↓12.6 kB
utils/InlineFormControlLayout/styles.css.map 1.5 kB -7.06%↓1.4 kB
utils/Row/script.js.map 11.5 kB 11.5 kB
utils/Row/styles.css.map 1.8 kB 1.8 kB
utils/Transition/script.js.map 10.7 kB 10.7 kB
utils/TransitionResponsive/script.js.map 10.3 kB 10.3 kB
utils/transitions.js.map 16.8 kB 16.8 kB

🤖 This report was automatically generated by pkg-size-action

Copy link
Contributor

@landondurnan landondurnan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't merge this as-is. I have suggested changes to the data structure I'll submit as a PR against beta.

Also some brief testing with the theme lab and things aren't working as expected, not all the of code has been been converted correctly to work with these changes and it appears that are bugs with some of the default output.

@landondurnan

This comment was marked as resolved.

@github-actions
Copy link

Styleguide deployed to https://square.github.io/maker/styleguide/beta/#/

* refactor!: prefix public css vars

* docs: update themes lab to use public css var
@github-actions
Copy link

Styleguide deployed to https://square.github.io/maker/styleguide/beta/#/

@github-actions
Copy link

Styleguide deployed to https://square.github.io/maker/styleguide/beta/#/

* refactor!: renames font-related color, family, & weight vars

* docs(theme): updates after font-related var renames

* docs(themetest): updates themetest lab after font-related var renames

* docs: adds table of reusable theme vars to theme docs

* refactor!: rename css vars again
@github-actions
Copy link

github-actions bot commented May 2, 2022

Styleguide deployed to https://square.github.io/maker/styleguide/beta/#/

@pretzelhammer pretzelhammer marked this pull request as ready for review May 2, 2022 11:42
@pretzelhammer pretzelhammer requested a review from a team as a code owner May 2, 2022 11:42
@github-actions
Copy link

github-actions bot commented May 2, 2022

Styleguide deployed to https://square.github.io/maker/styleguide/beta/#/

@github-actions
Copy link

Styleguide deployed to https://square.github.io/maker/styleguide/beta/#/

Copy link
Contributor

@landondurnan landondurnan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything is looking good, but the Theme lab should be updated. It's currently not rendering due to the changes. If we can get that updated it should be good to go.

@github-actions
Copy link

Styleguide deployed to https://square.github.io/maker/styleguide/beta/#/

@github-actions
Copy link

Styleguide deployed to https://square.github.io/maker/styleguide/beta/#/

@pretzelhammer
Copy link
Collaborator Author

@landondurnan Themes lab has been fixed

@github-actions
Copy link

Styleguide deployed to https://square.github.io/maker/styleguide/beta/#/

@pretzelhammer pretzelhammer merged commit 65647d4 into master May 11, 2022
@github-actions
Copy link

🎉 This PR is included in version 9.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version 10.0.0-beta.15 🎉

The release is available on:

Your semantic-release bot 📦🚀

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants