Skip to content
Merged
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
60 changes: 44 additions & 16 deletions scripts/convert-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ const formatTypographyStyles = (name: string, value: any) => {
StyleDictionary.registerFormat({
name: 'theme',
formatter({ dictionary, options }) {
/** Used with the `??` operator when you only want to include styles on the root stylesheet */
const root = options.selector === ':root' ? undefined : ''

return dedent`
/* THIS FILE IS AUTOGENERATED, DO NOT EDIT */

Expand Down Expand Up @@ -141,12 +144,30 @@ StyleDictionary.registerFormat({
})
.join('\n')}

${dictionary.allProperties
.filter((prop) => prop.type === 'borderRadius')
.map((prop) => {
return `--${prop.name}: ${prop.value};`
})
.join('\n')}
${
root ??
dictionary.allProperties
.filter((prop) => prop.type === 'borderRadius')
.map((prop) => {
return `--${prop.name}: ${prop.value};`
})
.join('\n')
}

${
root ??
dictionary.allProperties
.filter((prop) => prop.type === 'boxShadow')
.map((prop) => {
return `--${prop.name}: ${[prop.value]
.flat()
.map((v) =>
typeof v === 'object' ? `${v.x}px ${v.y}px ${v.blur}px ${v.color}` : v,
)};`
})
.join('\n')
}

}\n`
},
})
Expand Down Expand Up @@ -235,16 +256,23 @@ StyleDictionary.registerFormat({
}

module.exports.elevationUtilities = {
${boxShadow.map(
({ name, value }) =>
`'.${name}': {
'box-shadow': '${[value]
.flat()
.map((v) =>
typeof v === 'object' ? `${v.x}px ${v.y}px ${v.blur}px ${v.color}` : v,
)
.join(', ')}'}`,
)}
${boxShadow
.map(
({ name }, index) =>
`'.elevation-${index}': {
'box-shadow': 'var(--${name})',
'background-color': 'var(--surface-${
index === 0
? 'default'
: index === 1
? 'hover'
: index === 2
? 'secondary'
: 'tertiary'
})',
}`,
)
.join(',\n')}
}

module.exports.borderRadiusTokens = {
Expand Down
4 changes: 0 additions & 4 deletions styles/dist/blue.css
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,4 @@

--theme-notice-800-rgb: var(--base-yellow-800-rgb);
--theme-notice-800: rgb(var(--theme-notice-800-rgb));

--border-radius-sm: 0.125rem;
--border-radius: 0.1875rem;
--border-radius-full: 624.9375rem;
}
8 changes: 8 additions & 0 deletions styles/dist/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -561,4 +561,12 @@
--border-radius-sm: 0.125rem;
--border-radius: 0.1875rem;
--border-radius-full: 624.9375rem;

--box-shadow-0: none;
--box-shadow-1: 0px 0.656px 4.625px #00000021, 0px 3px 13px #00000033,
0px 7.594px 34.875px #00000045, 0px 15px 80px #00000066;
--box-shadow-2: 0px 2.188px 4.625px #00000021, 0px 10px 13px #00000033,
0px 25.313px 34.875px #00000045, 0px 50px 80px #00000066;
--box-shadow-3: 0px 4.375px 4.625px #00000021, 0px 20px 13px #00000033,
0px 50.625px 34.875px #00000045, 0px 100px 80px #00000066;
}
4 changes: 0 additions & 4 deletions styles/dist/purple.css
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,4 @@

--theme-notice-800-rgb: var(--base-yellow-800-rgb);
--theme-notice-800: rgb(var(--theme-notice-800-rgb));

--border-radius-sm: 0.125rem;
--border-radius: 0.1875rem;
--border-radius-full: 624.9375rem;
}
15 changes: 8 additions & 7 deletions styles/dist/tailwind-tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -934,19 +934,20 @@ module.exports.colorUtilities = {

module.exports.elevationUtilities = {
'.elevation-0': {
'box-shadow': 'none',
'box-shadow': 'var(--box-shadow-0)',
'background-color': 'var(--surface-default)',
},
'.elevation-1': {
'box-shadow':
'0px 0.656px 4.625px #00000021, 0px 3px 13px #00000033, 0px 7.594px 34.875px #00000045, 0px 15px 80px #00000066',
'box-shadow': 'var(--box-shadow-1)',
'background-color': 'var(--surface-hover)',
},
'.elevation-2': {
'box-shadow':
'0px 2.188px 4.625px #00000021, 0px 10px 13px #00000033, 0px 25.313px 34.875px #00000045, 0px 50px 80px #00000066',
'box-shadow': 'var(--box-shadow-2)',
'background-color': 'var(--surface-secondary)',
},
'.elevation-3': {
'box-shadow':
'0px 4.375px 4.625px #00000021, 0px 20px 13px #00000033, 0px 50.625px 34.875px #00000045, 0px 100px 80px #00000066',
'box-shadow': 'var(--box-shadow-3)',
'background-color': 'var(--surface-tertiary)',
},
}

Expand Down
4 changes: 0 additions & 4 deletions styles/dist/yellow.css
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,4 @@

--theme-notice-800-rgb: var(--base-yellow-800-rgb);
--theme-notice-800: rgb(var(--theme-notice-800-rgb));

--border-radius-sm: 0.125rem;
--border-radius: 0.1875rem;
--border-radius-full: 624.9375rem;
}
Loading