Skip to content
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

task: responsive tokens #14

Open
wants to merge 4 commits into
base: task/prefix
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 19 additions & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { permutateThemes, registerTransforms } from '@tokens-studio/sd-transform
import { generateSemanticFiles } from "./utils/generateSemanticFiles.js";

import { formatFontFace } from "./utils/formats/formatFontFace.js";
import { formatResponsiveCSS } from "./utils/formats/formatResponsiveCSS.js";
import { transformAttributeThemeable } from "./utils/transforms/transformAttributeThemeable.js";
import { transformRem } from "./utils/transforms/transformRem.js";
import { transformFont } from "./utils/transforms/transformFont.js";
Expand Down Expand Up @@ -72,6 +73,11 @@ async function run() {
fontPathPrefix: "../../assets/"
}
},
{
destination: "responsive.css",
format: "custom/css/responsive",
filter: "custom/excludeTokens"
},
...generateSemanticFiles(excludedFromSemantic, theme),
]
}
Expand All @@ -89,6 +95,11 @@ async function run() {

});

sd.registerFormat({
name: 'custom/css/responsive',
format: ({ dictionary }) => formatResponsiveCSS(dictionary)
});

sd.registerTransform({
name: "custom/attribute/themeable",
type: "attribute",
Expand All @@ -107,7 +118,7 @@ async function run() {
type: 'value',
transitive: true,
filter: token =>
['sizing', 'spacing', 'borderRadius', 'fontSizes', 'lineHeights', 'letterSpacing'].includes(
['sizing', 'spacing', 'borderRadius', 'fontSizes', 'letterSpacing'].includes(
token.type,
),
transform: token => transformRem(token.value),
Expand All @@ -127,6 +138,13 @@ async function run() {
}
});

sd.registerFilter({
name: 'custom/excludeTokens',
filter: (prop) => {
return !prop.path.some(part => excludedPaths.includes(part));
}
});

await sd.cleanAllPlatforms();
await sd.buildAllPlatforms();
}
Expand Down
24 changes: 12 additions & 12 deletions generatedTokens/css/core.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@
--wds-font-size-32: 2rem;
--wds-font-size-34: 2.125rem;
--wds-font-size-40: 2.5rem;
--wds-font-line-height-19: 1.1875rem;
--wds-font-line-height-22: 1.375rem;
--wds-font-line-height-24: 1.5rem;
--wds-font-line-height-28: 1.75rem;
--wds-font-line-height-30: 1.875rem;
--wds-font-line-height-33: 2.0625rem;
--wds-font-line-height-36: 2.25rem;
--wds-font-line-height-42: 2.625rem;
--wds-font-line-height-48: 3rem;
--wds-font-line-height-60: 3.75rem;
--wds-font-line-height-64: 4rem;
--wds-font-line-height-relaxed: 0.09375rem;
--wds-font-line-height-19: 19;
--wds-font-line-height-22: 22;
--wds-font-line-height-24: 24;
--wds-font-line-height-28: 28;
--wds-font-line-height-30: 30;
--wds-font-line-height-33: 33;
--wds-font-line-height-36: 36;
--wds-font-line-height-42: 42;
--wds-font-line-height-48: 48;
--wds-font-line-height-60: 60;
--wds-font-line-height-64: 64;
Copy link
Member Author

Choose a reason for hiding this comment

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

I think these line heights will be removed from Tokens Studio

--wds-font-line-height-relaxed: 1.5;
--wds-font-text-case-uppercase: uppercase;
--wds-font-text-case-none: none;
--wds-artboard-desktop: 90rem;
Expand Down
69 changes: 69 additions & 0 deletions generatedTokens/css/responsive.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
:root {
--wds-font-heading-brand-h0: 700 2rem/1.5 Wellcome;
--wds-font-heading-brand-h1: 700 1.5rem/1.5 Wellcome;
--wds-font-heading-brand-h2: 700 1.375rem/1.5 Wellcome;
--wds-font-heading-brand-h3: 700 1.125rem/1.5 Wellcome;
--wds-font-heading-brand-h4: 700 1rem/1.5 Wellcome;
--wds-font-heading-brand-h5: 700 0.875rem/1.5 Wellcome;
--wds-font-heading-sans-serif-h0: 500 2rem/1.5 'Helvetica Neue';
--wds-font-heading-sans-serif-h1: 500 1.5rem/42 'Helvetica Neue';
--wds-font-heading-sans-serif-h2: 500 1.375rem/1.5 'Helvetica Neue';
--wds-font-heading-sans-serif-h3: 500 1.125rem/1.5 'Helvetica Neue';
--wds-font-heading-sans-serif-h4: 500 1rem/1.5 'Helvetica Neue';
--wds-font-heading-sans-serif-h5: 500 0.875rem/1.5 'Helvetica Neue';
--wds-space-xxl: 3rem;
--wds-space-xl: 2rem;
--wds-space-l: 1.5rem;
--wds-space-m: 1rem;
--wds-space-s: 0.75rem;
--wds-space-xs: 0.5rem;
--wds-space-xxs: 0.25rem;
}

@media (min-width: 48rem) {
:root {
--wds-font-heading-brand-h0: 700 2.125rem/1.5 Wellcome;
--wds-font-heading-brand-h1: 700 1.75rem/1.5 Wellcome;
--wds-font-heading-brand-h2: 700 1.375rem/1.5 Wellcome;
--wds-font-heading-brand-h3: 700 1.125rem/1.5 Wellcome;
--wds-font-heading-brand-h4: 700 1rem/1.5 Wellcome;
--wds-font-heading-brand-h5: 700 0.875rem/22 Wellcome;
--wds-font-heading-sans-serif-h0: 500 2.125rem/1.5 'Helvetica Neue';
--wds-font-heading-sans-serif-h1: 500 1.75rem/1.5 'Helvetica Neue';
--wds-font-heading-sans-serif-h2: 500 1.375rem/1.5 'Helvetica Neue';
--wds-font-heading-sans-serif-h3: 500 1.125rem/1.5 'Helvetica Neue';
--wds-font-heading-sans-serif-h4: 500 1rem/1.5 'Helvetica Neue';
--wds-font-heading-sans-serif-h5: 500 0.875rem/1.5 'Helvetica Neue';
--wds-space-xxl: 4.5rem;
--wds-space-xl: 3rem;
--wds-space-l: 2rem;
--wds-space-m: 1.5rem;
--wds-space-s: 1rem;
--wds-space-xs: 0.5rem;
--wds-space-xxs: 0.25rem;
}
}

@media (min-width: 90rem) {
:root {
--wds-font-heading-brand-h0: 700 2.5rem/1.5 Wellcome;
--wds-font-heading-brand-h1: 700 2rem/1.5 Wellcome;
--wds-font-heading-brand-h2: 700 1.5rem/1.5 Wellcome;
--wds-font-heading-brand-h3: 700 1.25rem/1.5 Wellcome;
--wds-font-heading-brand-h4: 700 1rem/1.5 Wellcome;
--wds-font-heading-brand-h5: 700 0.875rem/1.5 Wellcome;
--wds-font-heading-sans-serif-h0: 500 2.5rem/1.5 'Helvetica Neue';
--wds-font-heading-sans-serif-h1: 500 2rem/1.5 'Helvetica Neue';
--wds-font-heading-sans-serif-h2: 500 1.5rem/1.5 'Helvetica Neue';
--wds-font-heading-sans-serif-h3: 500 1.25rem/1.5 'Helvetica Neue';
--wds-font-heading-sans-serif-h4: 500 1rem/1.5 'Helvetica Neue';
--wds-font-heading-sans-serif-h5: 500 0.875rem/1.5 'Helvetica Neue';
--wds-space-xxl: 6rem;
--wds-space-xl: 4rem;
--wds-space-l: 3rem;
--wds-space-m: 2rem;
--wds-space-s: 1rem;
--wds-space-xs: 0.5rem;
--wds-space-xxs: 0.25rem;
}
}
86 changes: 43 additions & 43 deletions generatedTokens/css/semantic.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,49 @@
*/

:host {
--wds-font-heading-desktop-brand-h0: 700 2.5rem/0.094rem Wellcome; /* To be used for heroes */
--wds-font-heading-desktop-brand-h1: 700 2rem/0.094rem Wellcome;
--wds-font-heading-desktop-brand-h2: 700 1.5rem/0.094rem Wellcome;
--wds-font-heading-desktop-brand-h3: 700 1.25rem/0.094rem Wellcome;
--wds-font-heading-desktop-brand-h4: 700 1rem/0.094rem Wellcome;
--wds-font-heading-desktop-brand-h5: 700 0.875rem/0.094rem Wellcome;
--wds-font-heading-desktop-sans-serif-h0: 500 2.5rem/0.094rem 'Helvetica Neue';
--wds-font-heading-desktop-sans-serif-h1: 500 2rem/0.094rem 'Helvetica Neue';
--wds-font-heading-desktop-sans-serif-h2: 500 1.5rem/0.094rem 'Helvetica Neue';
--wds-font-heading-desktop-sans-serif-h3: 500 1.25rem/0.094rem 'Helvetica Neue';
--wds-font-heading-desktop-sans-serif-h4: 500 1rem/0.094rem 'Helvetica Neue';
--wds-font-heading-desktop-sans-serif-h5: 500 0.875rem/0.094rem 'Helvetica Neue';
--wds-font-heading-tablet-brand-h0: 700 2.125rem/0.094rem Wellcome; /* To be used for heroes */
--wds-font-heading-tablet-brand-h1: 700 1.75rem/0.094rem Wellcome;
--wds-font-heading-tablet-brand-h2: 700 1.375rem/0.094rem Wellcome;
--wds-font-heading-tablet-brand-h3: 700 1.125rem/0.094rem Wellcome;
--wds-font-heading-tablet-brand-h4: 700 1rem/0.094rem Wellcome;
--wds-font-heading-tablet-brand-h5: 700 0.875rem/1.375rem Wellcome;
--wds-font-heading-tablet-sans-serif-h0: 500 2.125rem/0.094rem 'Helvetica Neue';
--wds-font-heading-tablet-sans-serif-h1: 500 1.75rem/0.094rem 'Helvetica Neue';
--wds-font-heading-tablet-sans-serif-h2: 500 1.375rem/0.094rem 'Helvetica Neue';
--wds-font-heading-tablet-sans-serif-h3: 500 1.125rem/0.094rem 'Helvetica Neue';
--wds-font-heading-tablet-sans-serif-h4: 500 1rem/0.094rem 'Helvetica Neue';
--wds-font-heading-tablet-sans-serif-h5: 500 0.875rem/0.094rem 'Helvetica Neue';
--wds-font-heading-mobile-brand-h0: 700 2rem/0.094rem Wellcome; /* To be used for heroes */
--wds-font-heading-mobile-brand-h1: 700 1.5rem/0.094rem Wellcome;
--wds-font-heading-mobile-brand-h2: 700 1.375rem/0.094rem Wellcome;
--wds-font-heading-mobile-brand-h3: 700 1.125rem/0.094rem Wellcome;
--wds-font-heading-mobile-brand-h4: 700 1rem/0.094rem Wellcome;
--wds-font-heading-mobile-brand-h5: 700 0.875rem/0.094rem Wellcome;
--wds-font-heading-mobile-sans-serif-h0: 500 2rem/0.094rem 'Helvetica Neue';
--wds-font-heading-mobile-sans-serif-h1: 500 1.5rem/2.625rem 'Helvetica Neue';
--wds-font-heading-mobile-sans-serif-h2: 500 1.375rem/0.094rem 'Helvetica Neue';
--wds-font-heading-mobile-sans-serif-h3: 500 1.125rem/0.094rem 'Helvetica Neue';
--wds-font-heading-mobile-sans-serif-h4: 500 1rem/0.094rem 'Helvetica Neue';
--wds-font-heading-mobile-sans-serif-h5: 500 0.875rem/0.094rem 'Helvetica Neue';
--wds-font-body-xl: 400 1.5rem/0.094rem 'Helvetica Neue';
--wds-font-body-l: 400 1.25rem/0.094rem 'Helvetica Neue';
--wds-font-body-m: 400 1rem/1.5rem 'Helvetica Neue';
--wds-font-body-s: 400 0.875rem/0.094rem 'Helvetica Neue';
--wds-font-body-xs: 400 0.75rem/0.094rem 'Helvetica Neue';
--wds-font-link: 400 1rem/1.5rem 'Helvetica Neue';
--wds-font-table-header: 500 0.625rem/1.5rem 'Helvetica Neue';
--wds-font-heading-desktop-brand-h0: 700 2.5rem/1.5 Wellcome; /* To be used for heroes */
--wds-font-heading-desktop-brand-h1: 700 2rem/1.5 Wellcome;
--wds-font-heading-desktop-brand-h2: 700 1.5rem/1.5 Wellcome;
--wds-font-heading-desktop-brand-h3: 700 1.25rem/1.5 Wellcome;
--wds-font-heading-desktop-brand-h4: 700 1rem/1.5 Wellcome;
--wds-font-heading-desktop-brand-h5: 700 0.875rem/1.5 Wellcome;
--wds-font-heading-desktop-sans-serif-h0: 500 2.5rem/1.5 'Helvetica Neue';
--wds-font-heading-desktop-sans-serif-h1: 500 2rem/1.5 'Helvetica Neue';
--wds-font-heading-desktop-sans-serif-h2: 500 1.5rem/1.5 'Helvetica Neue';
--wds-font-heading-desktop-sans-serif-h3: 500 1.25rem/1.5 'Helvetica Neue';
--wds-font-heading-desktop-sans-serif-h4: 500 1rem/1.5 'Helvetica Neue';
--wds-font-heading-desktop-sans-serif-h5: 500 0.875rem/1.5 'Helvetica Neue';
--wds-font-heading-tablet-brand-h0: 700 2.125rem/1.5 Wellcome; /* To be used for heroes */
--wds-font-heading-tablet-brand-h1: 700 1.75rem/1.5 Wellcome;
--wds-font-heading-tablet-brand-h2: 700 1.375rem/1.5 Wellcome;
--wds-font-heading-tablet-brand-h3: 700 1.125rem/1.5 Wellcome;
--wds-font-heading-tablet-brand-h4: 700 1rem/1.5 Wellcome;
--wds-font-heading-tablet-brand-h5: 700 0.875rem/22 Wellcome;
--wds-font-heading-tablet-sans-serif-h0: 500 2.125rem/1.5 'Helvetica Neue';
--wds-font-heading-tablet-sans-serif-h1: 500 1.75rem/1.5 'Helvetica Neue';
--wds-font-heading-tablet-sans-serif-h2: 500 1.375rem/1.5 'Helvetica Neue';
--wds-font-heading-tablet-sans-serif-h3: 500 1.125rem/1.5 'Helvetica Neue';
--wds-font-heading-tablet-sans-serif-h4: 500 1rem/1.5 'Helvetica Neue';
--wds-font-heading-tablet-sans-serif-h5: 500 0.875rem/1.5 'Helvetica Neue';
--wds-font-heading-mobile-brand-h0: 700 2rem/1.5 Wellcome; /* To be used for heroes */
--wds-font-heading-mobile-brand-h1: 700 1.5rem/1.5 Wellcome;
--wds-font-heading-mobile-brand-h2: 700 1.375rem/1.5 Wellcome;
--wds-font-heading-mobile-brand-h3: 700 1.125rem/1.5 Wellcome;
--wds-font-heading-mobile-brand-h4: 700 1rem/1.5 Wellcome;
--wds-font-heading-mobile-brand-h5: 700 0.875rem/1.5 Wellcome;
--wds-font-heading-mobile-sans-serif-h0: 500 2rem/1.5 'Helvetica Neue';
--wds-font-heading-mobile-sans-serif-h1: 500 1.5rem/42 'Helvetica Neue';
--wds-font-heading-mobile-sans-serif-h2: 500 1.375rem/1.5 'Helvetica Neue';
--wds-font-heading-mobile-sans-serif-h3: 500 1.125rem/1.5 'Helvetica Neue';
--wds-font-heading-mobile-sans-serif-h4: 500 1rem/1.5 'Helvetica Neue';
--wds-font-heading-mobile-sans-serif-h5: 500 0.875rem/1.5 'Helvetica Neue';
--wds-font-body-xl: 400 1.5rem/1.5 'Helvetica Neue';
--wds-font-body-l: 400 1.25rem/1.5 'Helvetica Neue';
--wds-font-body-m: 400 1rem/24 'Helvetica Neue';
--wds-font-body-s: 400 0.875rem/1.5 'Helvetica Neue';
--wds-font-body-xs: 400 0.75rem/1.5 'Helvetica Neue';
--wds-font-link: 400 1rem/24 'Helvetica Neue';
--wds-font-table-header: 500 0.625rem/24 'Helvetica Neue';
--wds-space-desktop-xxl: 6rem;
--wds-space-desktop-xl: 4rem;
--wds-space-desktop-l: 3rem;
Expand Down
4 changes: 4 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion split-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const jsonData = JSON.parse(rawData);
const baseDir = path.join(__dirname, 'tokens');

// Define keys to exclude
const excludeKeys = ['$themes'];
// We don't need these tokens in the design system
const excludeKeys = ['$themes', 'BREAKPOINTS/desktop', 'BREAKPOINTS/tablet', 'BREAKPOINTS/mobile'];

// Function to write data to file
const writeFile = (filePath, data) => {
Expand Down
124 changes: 0 additions & 124 deletions tokens/desktop.json

This file was deleted.

Loading