-
Notifications
You must be signed in to change notification settings - Fork 8
Docs/2882 [documentation] design tokens documentation is not updated #3212
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
Draft
anna-lach
wants to merge
14
commits into
main
Choose a base branch
from
docs/2882-documentation-design-tokens-documentation-is-not-updated
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4129c9a
copying system and primitives tokens, first changes to color table
anna-lach 438c375
Merge remote-tracking branch 'origin/main' into docs/2882-documentati…
anna-lach d66cef3
table with colors from system.json
anna-lach 3975ae7
Merge remote-tracking branch 'origin/main' into docs/2882-documentati…
anna-lach bce14e3
Merge remote-tracking branch 'origin/main' into docs/2882-documentati…
anna-lach fa4ede5
Size tokens and layout changes
anna-lach bc3c363
design tokens pages layout changes, updated color and text pages with…
anna-lach fdf195a
color tokens page changes
anna-lach ae0380a
opacity, border and space tokens pages changes
anna-lach 6569eed
Merge remote-tracking branch 'origin/main' into docs/2882-documentati…
anna-lach 52ffdb2
Opacity, size and space tokens docs changes
anna-lach 1d5f38b
Border, color, opacity, text tokens docs changes, new elevation token…
anna-lach ee5eea1
tokens docs improvements, main description of the design tokens docs …
anna-lach 09a99ae
changes after Copilot review
anna-lach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,238 @@ | ||
| { | ||
| "icon": { | ||
| "typeset": { | ||
| "fontWeight": { | ||
| "solid": { | ||
| "$type": "fontWeights", | ||
| "$value": "{icon.typeset.fontWeight.icon-solid}" | ||
| }, | ||
| "regular": { | ||
| "$type": "fontWeights", | ||
| "$value": "{icon.typeset.fontWeight.icon-regular}" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "size": { | ||
| "icon": { | ||
| "font": { | ||
| "lg": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.icon.font.lg}" | ||
| }, | ||
| "md": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.icon.font.md}" | ||
| }, | ||
| "sm": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.icon.font.sm}" | ||
| }, | ||
| "xl": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.icon.font.xl}" | ||
| }, | ||
| "xs": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.icon.font.xs}" | ||
| }, | ||
| "2xl": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.icon.font.2xl}" | ||
| }, | ||
| "2xs": { | ||
| "$type": "fontSizes", | ||
| "$value": "{size-new.icon.2xs}" | ||
| }, | ||
| "3xl": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.icon.font.3xl}" | ||
| }, | ||
| "4xl": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.icon.font.4xl}" | ||
| } | ||
| } | ||
| }, | ||
| "text-new": { | ||
| "body": { | ||
| "lg": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.text-new.body.lg}" | ||
| }, | ||
| "md": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.text-new.body.md}", | ||
| "$description": "default text size for body" | ||
| }, | ||
| "sm": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.text-new.body.sm}" | ||
| } | ||
| }, | ||
| "heading": { | ||
| "lg": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.text-new.heading.lg}" | ||
| }, | ||
| "md": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.text-new.heading.md}" | ||
| }, | ||
| "sm": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.text-new.heading.sm}" | ||
| }, | ||
| "xl": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.text-new.heading.xl}" | ||
| }, | ||
| "2xl": { | ||
| "$type": "fontSizes", | ||
| "$value": "{base.size.text-new.heading.2xl}" | ||
| } | ||
| } | ||
| }, | ||
| "borderWidth": { | ||
| "action": { | ||
| "$type": "borderWidth", | ||
| "$value": "{base.size.borderWidth.action}", | ||
| "$description": "Sets the standard border width for action components." | ||
| }, | ||
| "default": { | ||
| "$type": "borderWidth", | ||
| "$value": "{base.size.borderWidth.default}", | ||
| "$description": "Sets the standard border width for UI elements." | ||
| } | ||
| }, | ||
| "borderRadius": { | ||
| "full": { | ||
| "$type": "borderRadius", | ||
| "$value": "{base.size.borderRadius.full}", | ||
| "$description": "Use for pill-shaped elements like badges, and circular rounding for components with equal width and height, such as icon buttons and avatars." | ||
| }, | ||
| "child": { | ||
| "$type": "borderRadius", | ||
| "$value": "{base.size.borderRadius.child}", | ||
| "$description": "The standard border radius for most components. Use for elements that need subtle rounding without emphasizing their shape." | ||
| }, | ||
| "default": { | ||
| "$type": "borderRadius", | ||
| "$value": "{base.size.borderRadius.default}", | ||
| "$description": "The standard border radius for most components. Use for elements that need subtle rounding without emphasizing their shape." | ||
| }, | ||
| "focusRing": { | ||
| "inside": { | ||
| "$type": "borderRadius", | ||
| "$value": "{base.size.borderRadius.focusRing.inside}", | ||
| "$description": "Use for focusring inside of component when outside focus ring is not possible" | ||
| }, | ||
| "outside": { | ||
| "$type": "borderRadius", | ||
| "$value": "{base.size.borderRadius.focusRing.outside}", | ||
| "$description": "Use for focusring outside of component" | ||
| } | ||
| } | ||
| }, | ||
| "outlineWidth": { | ||
| "default": { | ||
| "$type": "borderWidth", | ||
| "$value": "{base.size.outlineWidth.default}", | ||
| "$description": "Sets the standard outline width for UI elements." | ||
| } | ||
| } | ||
| }, | ||
| "space": { | ||
| "offset": { | ||
| "default": { | ||
| "$type": "spacing", | ||
| "$value": "{base.space.offset.default}", | ||
| "$description": "Defines the standard spacing offset." | ||
| } | ||
| } | ||
| }, | ||
| "text-new": { | ||
| "body": { | ||
| "lg": { | ||
| "$type": "typography", | ||
| "$value": "{base.text-new.body.lg}" | ||
| }, | ||
| "md": { | ||
| "$type": "typography", | ||
| "$value": "{base.text-new.body.md}" | ||
| }, | ||
| "sm": { | ||
| "$type": "typography", | ||
| "$value": "{base.text-new.body.sm}" | ||
| } | ||
| }, | ||
| "icon": { | ||
| "solid": { | ||
| "$type": "typography", | ||
| "$value": "{base.text-new.icon.solid}" | ||
| }, | ||
| "outline": { | ||
| "$type": "typography", | ||
| "$value": "{base.text-new.icon.outline}" | ||
| } | ||
| }, | ||
| "input": { | ||
| "lg": { | ||
| "$type": "typography", | ||
| "$value": "{base.text-new.input.lg}" | ||
| }, | ||
| "md": { | ||
| "$type": "typography", | ||
| "$value": "{base.text-new.input.md}" | ||
| } | ||
| }, | ||
| "heading": { | ||
| "lg": { | ||
| "$type": "typography", | ||
| "$value": "{base.text-new.heading.lg}" | ||
| }, | ||
| "md": { | ||
| "$type": "typography", | ||
| "$value": "{base.text-new.heading.md}" | ||
| }, | ||
| "sm": { | ||
| "$type": "typography", | ||
| "$value": "{base.text-new.heading.sm}" | ||
| }, | ||
| "xl": { | ||
| "$type": "typography", | ||
| "$value": "{base.text-new.heading.xl}" | ||
| }, | ||
| "2xl": { | ||
| "$type": "typography", | ||
| "$value": "{base.text-new.heading.2xl}" | ||
| } | ||
| }, | ||
| "typeset": { | ||
| "fontFamily": { | ||
| "body": { | ||
| "$type": "fontFamilies", | ||
| "$value": "{base.text-new.typeset.fontFamily.body}" | ||
| }, | ||
| "icon": { | ||
| "$type": "fontFamilies", | ||
| "$value": "{base.text-new.typeset.fontFamily.icon}" | ||
| }, | ||
| "heading": { | ||
| "$type": "fontFamilies", | ||
| "$value": "{base.text-new.typeset.fontFamily.heading}" | ||
| } | ||
| }, | ||
| "fontWeight": { | ||
| "regular": { | ||
| "$type": "fontWeights", | ||
| "$value": "{base.text-new.typeset.fontWeight.regular}" | ||
| }, | ||
| "semiBold": { | ||
| "$type": "fontWeights", | ||
| "$value": "{base.text-new.typeset.fontWeight.semiBold}" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| const baseNew = require('./base-new.json'); | ||
| const system = require('./system.json'); | ||
|
|
||
| function flattenTokens(obj, prefix) { | ||
| const results = []; | ||
| for (const [key, val] of Object.entries(obj)) { | ||
| if (val && val['$type']) { | ||
| let rawValue = (typeof val['$value'] === 'string' ? val['$value'] : '').replace(/[{}]/g, ''); | ||
| if (/\s[-+*/]\s/.test(rawValue)) { | ||
| rawValue = `calc(${rawValue})`; | ||
| } | ||
| const tokenName = (prefix + key).replace(/^--sl-/, ''); | ||
| results.push({ | ||
| token: prefix + key, | ||
| value: rawValue, | ||
| title: tokenName | ||
| .replace(/([a-z])([A-Z])/g, '$1 $2') | ||
| .replace(/[.\-]/g, ' ') | ||
| .replace(/\b\w/g, c => c.toUpperCase()), | ||
| type: val['$type'] || '', | ||
| description: val['$description'] || '' | ||
| }); | ||
| } else if (val && typeof val === 'object') { | ||
| results.push(...flattenTokens(val, prefix + key + '-')); | ||
| } | ||
| } | ||
| return results; | ||
| } | ||
|
|
||
| module.exports = { | ||
| borderWidth: [ | ||
| ...flattenTokens(system.size.borderWidth, '--sl-size-borderWidth-'), | ||
| ...flattenTokens(baseNew.size.borderWidth, '--sl-size-borderWidth-') | ||
| ], | ||
| borderRadius: [ | ||
| ...flattenTokens(system.size.borderRadius, '--sl-size-borderRadius-'), | ||
| ...flattenTokens(baseNew.size.borderRadius, '--sl-size-borderRadius-') | ||
| ], | ||
| outlineWidth: [ | ||
| ...flattenTokens(system.size.outlineWidth, '--sl-size-outlineWidth-'), | ||
| ...flattenTokens(baseNew.size.outlineWidth, '--sl-size-outlineWidth-') | ||
| ], | ||
| outlineOffset: flattenTokens(system.size.outlineOffset, '--sl-size-outlineOffset-') | ||
| }; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| const system = require('./system.json'); | ||
| const themeNew = require('./theme-new.json'); | ||
|
|
||
| function flattenTokens(obj, prefix) { | ||
| const results = []; | ||
| for (const [key, val] of Object.entries(obj)) { | ||
| if (val && val['$type']) { | ||
| const rawValue = val['$value']; | ||
| const tokenName = (prefix + key).replace(/^--sl-/, ''); | ||
| const isBoxShadow = val['$type'] === 'boxShadow'; | ||
| results.push({ | ||
| token: prefix + key, | ||
| value: isBoxShadow ? formatBoxShadow(rawValue) : (typeof rawValue === 'string' ? rawValue.replace(/[{}]/g, '') : rawValue), | ||
| title: tokenName | ||
| .replace(/([a-z])([A-Z])/g, '$1 $2') | ||
| .replace(/[.\-]/g, ' ') | ||
| .replace(/\b\w/g, c => c.toUpperCase()), | ||
| type: val['$type'] || '', | ||
| description: val['$description'] || '' | ||
| }); | ||
| } else if (val && typeof val === 'object' && !Array.isArray(val)) { | ||
| results.push(...flattenTokens(val, prefix + key + '-')); | ||
| } | ||
| } | ||
| return results; | ||
| } | ||
|
|
||
| function formatBoxShadow(layers) { | ||
| if (!Array.isArray(layers)) return String(layers); | ||
| return layers.map(l => { | ||
| const parts = [l.x || '0', l.y || '0', l.blur || '0']; | ||
| if (l.spread) parts.push(l.spread); | ||
| parts.push(String(l.color || '').replace(/[{}]/g, '')); | ||
| return parts.join(' '); | ||
| }).join(', '); | ||
| } | ||
|
|
||
| module.exports = { | ||
| shadow: flattenTokens(system.elevation.shadow, '--sl-elevation-shadow-'), | ||
| surface: flattenTokens(themeNew.elevation.surface, '--sl-elevation-surface-') | ||
| }; | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.