feat(tokens): add design tokens architecture (#29245)

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

Following the Design Doc for the new Ionic Design System, an
architecture for Design Tokens was added.

1. Added new `foundations` folder inside the `src`, to hold all the
tokens related files.
2. On this file, a json with all the tokens for the new Design System
was added. The format followed was the one suggested on the [W3C
draft](https://design-tokens.github.io/community-group/format/).
3. Added a dev dependency for [Styles
Dictionary](https://amzn.github.io/style-dictionary/#/), version 3.9.2.
4. Added a tokens.js script that will take care of transforming the json
tokens into the desired output. For now, three files are being
generated: ionic.vars.css (:root with all CSS Variables); ionic.vars.css
(scss variables for each token) and ionic.utility.css (a new
utility-class for each token)
5. Added the script `npm run build.tokens` to package.json, that will
generate the three files mentioned above.

For now, all these changes bring no impact to the rest of the Framework,
as these variables are not yet being consumed.

The `margin`, `padding` and `border-radius` were removed from the
prohibited properties on lint, to prevent lint errors with the new
utility-classes. This is very open to discussion/feedback if it's seen
as not ok.

The `build` command now includes the `build.tokens` script, to make sure
the files are always generated, in case someone forget to run the
command, after changing the json file!

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
6. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->

---------

Co-authored-by: Sean Perkins <13732623+sean-perkins@users.noreply.github.com>
This commit is contained in:
Bernardo Cardoso
2024-04-05 09:27:48 +01:00
committed by GitHub
parent 1c4b6bd8f2
commit 19f7be8877
10 changed files with 2837 additions and 475 deletions

View File

@ -0,0 +1,120 @@
/**
* This is an auto-generated file, please do not change it directly.
* Ionic Design System
*/
:root {
--ionic-color-primary-10: #f7faff;
--ionic-color-primary-50: #cbdffe;
--ionic-color-primary-100: #9ec4fd;
--ionic-color-primary-200: #74aafc;
--ionic-color-primary-300: #4991fb;
--ionic-color-primary-400: #1068eb;
--ionic-color-primary-500: #0750be;
--ionic-color-primary-600: #053d90;
--ionic-color-primary-700: #062b63;
--ionic-color-primary-800: #061935;
--ionic-color-primary-900: #010408;
--ionic-color-primary: #1068eb;
--ionic-color-secondary: #303d60;
--ionic-color-neutral-10: #f5f5f5;
--ionic-color-neutral-50: #e7e7e7;
--ionic-color-neutral-100: #dadada;
--ionic-color-neutral-200: #c9c9c9;
--ionic-color-neutral-300: #b8b8b8;
--ionic-color-neutral-400: #9a9a9a;
--ionic-color-neutral-500: #767676;
--ionic-color-neutral-600: #535353;
--ionic-color-neutral-700: #373737;
--ionic-color-neutral-800: #212121;
--ionic-color-neutral-900: #05080f;
--ionic-color-error-10: #fffafa;
--ionic-color-error-50: #ffd5d5;
--ionic-color-error-100: #ffafaf;
--ionic-color-error-200: #ff8a8a;
--ionic-color-error-300: #ff6666;
--ionic-color-error-400: #f72c2c;
--ionic-color-error-500: #c71212;
--ionic-color-error-600: #970606;
--ionic-color-error-700: #670202;
--ionic-color-error-800: #380101;
--ionic-color-error-900: #080000;
--ionic-color-error: #f72c2c;
--ionic-color-warning-10: #fffdfa;
--ionic-color-warning-50: #ffecce;
--ionic-color-warning-100: #ffdba0;
--ionic-color-warning-200: #ffca73;
--ionic-color-warning-300: #ffb845;
--ionic-color-warning-400: #ff9707;
--ionic-color-warning-500: #ce7a06;
--ionic-color-warning-600: #9c5f0a;
--ionic-color-warning-700: #6b430c;
--ionic-color-warning-800: #39260b;
--ionic-color-warning-900: #080502;
--ionic-color-warning: #ff9707;
--ionic-color-success-10: #fbfffa;
--ionic-color-success-50: #def7d8;
--ionic-color-success-100: #c6f0b7;
--ionic-color-success-200: #a4e188;
--ionic-color-success-300: #73c346;
--ionic-color-success-400: #52a518;
--ionic-color-success-500: #36870c;
--ionic-color-success-600: #36870c;
--ionic-color-success-700: #226907;
--ionic-color-success-800: #144b05;
--ionic-color-success-900: #030f02;
--ionic-color-success: #52a518;
--ionic-color-info-10: #f5fbff;
--ionic-color-info-50: #c6e7ff;
--ionic-color-info-100: #97d3ff;
--ionic-color-info-200: #6ac0fe;
--ionic-color-info-300: #3dadfe;
--ionic-color-info-400: #008bef;
--ionic-color-info-500: #0071c2;
--ionic-color-info-600: #005796;
--ionic-color-info-700: #003d69;
--ionic-color-info-800: #02243c;
--ionic-color-info-900: #020a0f;
--ionic-color-info: #008bef;
--ionic-font-size-h1: 32px;
--ionic-font-size-h2: 28px;
--ionic-font-size-h3: 26px;
--ionic-font-size-h4: 22px;
--ionic-font-size-h5: 20px;
--ionic-font-size-h6: 18px;
--ionic-font-size-display: 36px;
--ionic-font-size-base: 16px;
--ionic-font-size-s: 14px;
--ionic-font-size-xs: 12px;
--ionic-font-light: 300;
--ionic-font-regular: 400;
--ionic-font-semi-bold: 600;
--ionic-font-bold: 700;
--ionic-space-none: 0;
--ionic-space-xxxxs: 2px;
--ionic-space-xxxs: 4px;
--ionic-space-xss: 6px;
--ionic-space-xs: 8px;
--ionic-space-s: 12px;
--ionic-space-base: 16px;
--ionic-space-m: 20px;
--ionic-space-l: 24px;
--ionic-space-xl: 28px;
--ionic-space-xxl: 32px;
--ionic-space-xxxl: 36px;
--ionic-space-xxxxl: 40px;
--ionic-border-radius-square: 0;
--ionic-border-radius-rounded-small: 4px;
--ionic-border-radius-rounded-medium: 8px;
--ionic-border-radius-rounded-large: 16px;
--ionic-border-radius-rounded-x-large: 32px;
--ionic-border-radius-rounded-full: 100%;
--ionic-border-size-small: 1px;
--ionic-border-size-medium: 2px;
--ionic-border-size-large: 3px;
--ionic-elevation-0: none;
--ionic-elevation-1: 0px 3px 9px 0px rgba(0, 0, 0, 0.07), 0px 0px 4px 0px rgba(0, 0, 0, 0.04);
--ionic-elevation-2: 0px 8px 25px 0px rgba(0, 0, 0, 0.08), 0px 1px 5px 0px rgba(0, 0, 0, 0.05);
--ionic-elevation-3: 0px 2px 7px 0px rgba(0, 0, 0, 0.05), 0px 15px 32px 0px rgba(0, 0, 0, 0.09);
--ionic-elevation-4: 0px 3px 14px 0px rgba(0, 0, 0, 0.12), 0px 20px 48px 0px rgba(0, 0, 0, 0.12);
}