Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
Sync tokens & Add a GitHub action that will automatically keep figma-design-tokens.ts up to date (#778)
Roman Pominov4d1a86b90237
diff --git a/.github/workflows/build-figma-tokens.yml b/.github/workflows/build-figma-tokens.ymlnew file mode 100644index 0000000000..8bb732366a--- /dev/null+++ b/.github/workflows/build-figma-tokens.yml@@ -0,0 +1,37 @@+name: Build and commit Figma tokens++on:+ push:+ branches:+ - figma-tokens+ paths:+ - packages/design-system/src/__generated__/figma-design-tokens.json++jobs:+ main:+ runs-on: ubuntu-latest++ steps:+ - uses: actions/checkout@v3+ with:+ # We don't need a token to push from an action,+ # but we need it if want the commit to trigger other workflows as normal+ token: ${{ secrets.ACCESS_TOKEN_FOR_FIGMA_TOKENS }}++ - uses: ./.github/actions/ci-setup++ - name: Configure git+ run: |+ git config --global user.name 'Bot (build-figma-tokens.yml)'+ git config --global user.email 'bot@localhost'++ - name: Switch branch+ run: git checkout figma-tokens++ - name: Build tokens+ run: pnpm build-figma-tokens++ - name: Commit and push+ run: |+ [[ -z `git status | grep figma-design-tokens.ts` ]] || git commit -m "Update figma-design-tokens.ts" packages/design-system/src/__generated__/figma-design-tokens.ts+ git pushdiff --git a/package.json b/package.jsonindex 680a3f49c4..748ea8ffd9 100644--- a/package.json+++ b/package.json@@ -15,7 +15,8 @@"storybook": "turbo run storybook:run","storybook:build": "npm run build && turbo run storybook:build","storybook:ds:build": "turbo run storybook:build --filter=@webstudio-is/design-system",- "migrations": "cd apps/designer && pnpm migrations --dev"+ "migrations": "cd apps/designer && pnpm migrations --dev",+ "build-figma-tokens": "cd packages/design-system && pnpm build-figma-tokens"},"devDependencies": {"@changesets/get-dependents-graph": "^1.3.4",diff --git a/packages/design-system/package.json b/packages/design-system/package.jsonindex 32df663c99..6f3f5b0534 100644--- a/packages/design-system/package.json+++ b/packages/design-system/package.json@@ -6,8 +6,9 @@"homepage": "https://webstudio.is","type": "module","scripts": {- "dev": "tsx ./bin/transform-figma-tokens.ts && build-package --watch",- "build": "tsx ./bin/transform-figma-tokens.ts && build-package",+ "dev": "build-package --watch",+ "build": "build-package",+ "build-figma-tokens": "tsx ./bin/transform-figma-tokens.ts","typecheck": "tsc --noEmit","lint": "eslint ./src --ext .ts,.tsx --max-warnings 0","test": "NODE_OPTIONS=--experimental-vm-modules jest",diff --git a/packages/design-system/src/__generated__/figma-design-tokens.json b/packages/design-system/src/__generated__/figma-design-tokens.jsonindex 76af12ac7a..9bb0d187cb 100644--- a/packages/design-system/src/__generated__/figma-design-tokens.json+++ b/packages/design-system/src/__generated__/figma-design-tokens.json@@ -26,13 +26,13 @@"value": "Inter","type": "fontFamilies"},- "roboto": {- "value": "Roboto",- "type": "fontFamilies"- },"manrope": {"value": "Manrope","type": "fontFamilies"+ },+ "roboto-mono": {+ "value": "Roboto Mono",+ "type": "fontFamilies"}},"lineHeights": {@@ -70,10 +70,6 @@"value": "Bold","type": "fontWeights"},- "roboto-3": {- "value": "Regular",- "type": "fontWeights"- },"inter-4": {"value": "Semi Bold","type": "fontWeights"@@ -81,6 +77,10 @@"manrope-5": {"value": "SemiBold","type": "fontWeights"+ },+ "roboto-mono-3": {+ "value": "Regular",+ "type": "fontWeights"}},"fontSize": {@@ -143,7 +143,21 @@},"type": "typography"},- "Labels": {+ "Labels - Title Case": {+ "value": {+ "fontFamily": "{fontFamilies.inter}",+ "fontWeight": "{fontWeights.inter-1}",+ "lineHeight": "{lineHeights.0}",+ "fontSize": "{fontSize.2}",+ "letterSpacing": "{letterSpacing.0}",+ "paragraphSpacing": "{paragraphSpacing.0}",+ "paragraphIndent": "{paragraphIndent.0}",+ "textCase": "{textCase.capitalize}",+ "textDecoration": "{textDecoration.none}"+ },+ "type": "typography"+ },+ "Labels - Sentence case": {"value": {"fontFamily": "{fontFamilies.inter}","fontWeight": "{fontWeights.inter-1}",@@ -173,8 +187,8 @@},"Mono": {"value": {- "fontFamily": "{fontFamilies.roboto}",- "fontWeight": "{fontWeights.roboto-3}",+ "fontFamily": "{fontFamilies.roboto-mono}",+ "fontWeight": "{fontWeights.roboto-mono-3}","lineHeight": "{lineHeights.0}","fontSize": "{fontSize.2}","letterSpacing": "{letterSpacing.2}",@@ -185,13 +199,13 @@},"type": "typography"},- "Tiny": {+ "Big Title": {"value": {"fontFamily": "{fontFamilies.inter}","fontWeight": "{fontWeights.inter-1}",- "lineHeight": "{lineHeights.1}",- "fontSize": "{fontSize.0}",- "letterSpacing": "{letterSpacing.1}",+ "lineHeight": "{lineHeights.3}",+ "fontSize": "{fontSize.4}",+ "letterSpacing": "{letterSpacing.0}","paragraphSpacing": "{paragraphSpacing.0}","paragraphIndent": "{paragraphIndent.0}","textCase": "{textCase.none}",@@ -199,35 +213,50 @@},"type": "typography"},- "Unit": {+ "Small": {"value": {"fontFamily": "{fontFamilies.inter}",- "fontWeight": "{fontWeights.inter-1}",- "lineHeight": "{lineHeights.2}",+ "fontWeight": "{fontWeights.inter-0}",+ "lineHeight": "{lineHeights.4}","fontSize": "{fontSize.1}",- "letterSpacing": "{letterSpacing.3}",+ "letterSpacing": "{letterSpacing.2}","paragraphSpacing": "{paragraphSpacing.0}","paragraphIndent": "{paragraphIndent.0}",- "textCase": "{textCase.uppercase}",+ "textCase": "{textCase.none}",+ "textDecoration": "{textDecoration.none}"+ },+ "type": "typography",+ "description": "When Regular is too big and Tiny is too tiny."+ },+ "Tiny": {+ "value": {+ "fontFamily": "{fontFamilies.inter}",+ "fontWeight": "{fontWeights.inter-1}",+ "lineHeight": "{lineHeights.1}",+ "fontSize": "{fontSize.0}",+ "letterSpacing": "{letterSpacing.1}",+ "paragraphSpacing": "{paragraphSpacing.0}",+ "paragraphIndent": "{paragraphIndent.0}",+ "textCase": "{textCase.none}","textDecoration": "{textDecoration.none}"},"type": "typography"},- "Spacing Section Value Text": {+ "Unit": {"value": {"fontFamily": "{fontFamilies.inter}","fontWeight": "{fontWeights.inter-1}","lineHeight": "{lineHeights.2}","fontSize": "{fontSize.1}",- "letterSpacing": "{letterSpacing.2}",+ "letterSpacing": "{letterSpacing.3}","paragraphSpacing": "{paragraphSpacing.0}","paragraphIndent": "{paragraphIndent.0}",- "textCase": "{textCase.none}",+ "textCase": "{textCase.uppercase}","textDecoration": "{textDecoration.none}"},"type": "typography"},- "Spacing Section Unit Text": {+ "Space Section Unit Text": {"value": {"fontFamily": "{fontFamilies.inter}","fontWeight": "{fontWeights.inter-4}",@@ -241,13 +270,13 @@},"type": "typography"},- "Big Title": {+ "Space Section Value Text": {"value": {"fontFamily": "{fontFamilies.inter}","fontWeight": "{fontWeights.inter-1}",- "lineHeight": "{lineHeights.3}",- "fontSize": "{fontSize.4}",- "letterSpacing": "{letterSpacing.0}",+ "lineHeight": "{lineHeights.2}",+ "fontSize": "{fontSize.1}",+ "letterSpacing": "{letterSpacing.2}","paragraphSpacing": "{paragraphSpacing.0}","paragraphIndent": "{paragraphIndent.0}","textCase": "{textCase.none}",@@ -263,6 +292,10 @@"uppercase": {"value": "uppercase","type": "textCase"+ },+ "capitalize": {+ "value": "capitalize",+ "type": "textCase"}},"textDecoration": {@@ -483,6 +516,11 @@"value": "#7e868c","type": "color","description": "color for the hidden current item in the navigator item component"+ },+ "menu-item-hover": {+ "value": "#c9c9c9",+ "type": "color",+ "description": "The hover state on menu item components."}},"tooltip": {@@ -879,49 +917,6 @@"description": "sets border width value to 2. Used for focus borders (among other things)"}},- "Space Section Value Text": {- "value": {- "fontFamily": "{fontFamilies.inter}",- "fontWeight": "{fontWeights.inter-1}",- "lineHeight": "{lineHeights.2}",- "fontSize": "{fontSize.1}",- "letterSpacing": "{letterSpacing.2}",- "paragraphSpacing": "{paragraphSpacing.0}",- "paragraphIndent": "{paragraphIndent.0}",- "textCase": "{textCase.none}",- "textDecoration": "{textDecoration.none}"- },- "type": "typography"- },- "Space Section Unit Text": {- "value": {- "fontFamily": "{fontFamilies.inter}",- "fontWeight": "{fontWeights.inter-4}",- "lineHeight": "{lineHeights.1}",- "fontSize": "{fontSize.0}",- "letterSpacing": "{letterSpacing.1}",- "paragraphSpacing": "{paragraphSpacing.0}",- "paragraphIndent": "{paragraphIndent.0}",- "textCase": "{textCase.uppercase}",- "textDecoration": "{textDecoration.none}"- },- "type": "typography"- },- "Small": {- "value": {- "fontFamily": "{fontFamilies.inter}",- "fontWeight": "{fontWeights.inter-0}",- "lineHeight": "{lineHeights.4}",- "fontSize": "{fontSize.1}",- "letterSpacing": "{letterSpacing.2}",- "paragraphSpacing": "{paragraphSpacing.0}",- "paragraphIndent": "{paragraphIndent.0}",- "textCase": "{textCase.none}",- "textDecoration": "{textDecoration.none}"- },- "type": "typography",- "description": "When Regular is too big and Tiny is too tiny."- },"paragraphIndent": {"0": {"value": "0px",diff --git a/packages/design-system/src/__generated__/figma-design-tokens.ts b/packages/design-system/src/__generated__/figma-design-tokens.tsindex 16285218dc..0cd7a83e2a 100644--- a/packages/design-system/src/__generated__/figma-design-tokens.ts+++ b/packages/design-system/src/__generated__/figma-design-tokens.ts@@ -49,8 +49,8 @@ export const boxShadow = {export const fontFamilies = {inter: "Inter",- roboto: "Roboto",manrope: "Manrope",+ robotoMono: "Roboto Mono",} as const;export const lineHeights = {@@ -65,9 +65,9 @@ export const fontWeights = {inter0: "Regular",inter1: "Medium",inter2: "Bold",- roboto3: "Regular",inter4: "Semi Bold",manrope5: "SemiBold",+ robotoMono3: "Regular",} as const;export const fontSizes = {@@ -99,7 +99,18 @@ export const typography = {textCase: "none",textDecoration: "none",},- labels: {+ labelsTitleCase: {+ fontFamily: "Inter",+ fontWeight: "Medium",+ lineHeight: 16,+ fontSize: 12,+ letterSpacing: "0.5%",+ paragraphSpacing: 0,+ paragraphIndent: "0px",+ textCase: "capitalize",+ textDecoration: "none",+ },+ labelsSentenceCase: {fontFamily: "Inter",fontWeight: "Medium",lineHeight: 16,@@ -122,7 +133,7 @@ export const typography = {textDecoration: "none",},mono: {- fontFamily: "Roboto",+ fontFamily: "Roboto Mono",fontWeight: "Regular",lineHeight: 16,fontSize: 12,@@ -132,32 +143,21 @@ export const typography = {textCase: "none",textDecoration: "none",},- tiny: {+ bigTitle: {fontFamily: "Inter",fontWeight: "Medium",- lineHeight: 8,- fontSize: 8,- letterSpacing: "1%",+ lineHeight: "AUTO",+ fontSize: 32,+ letterSpacing: "0.5%",paragraphSpacing: 0,paragraphIndent: "0px",textCase: "none",textDecoration: "none",},- unit: {- fontFamily: "Inter",- fontWeight: "Medium",- lineHeight: 10,- fontSize: 10,- letterSpacing: 0,- paragraphSpacing: 0,- paragraphIndent: "0px",- textCase: "uppercase",- textDecoration: "none",- },- spacingSectionValueText: {+ small: {fontFamily: "Inter",- fontWeight: "Medium",- lineHeight: 10,+ fontWeight: "Regular",+ lineHeight: 11,fontSize: 10,letterSpacing: "0%",paragraphSpacing: 0,@@ -165,48 +165,26 @@ export const typography = {textCase: "none",textDecoration: "none",},- spacingSectionUnitText: {+ tiny: {fontFamily: "Inter",- fontWeight: "Semi Bold",+ fontWeight: "Medium",lineHeight: 8,fontSize: 8,letterSpacing: "1%",paragraphSpacing: 0,paragraphIndent: "0px",- textCase: "uppercase",- textDecoration: "none",- },- bigTitle: {- fontFamily: "Inter",- fontWeight: "Medium",- lineHeight: "AUTO",- fontSize: 32,- letterSpacing: "0.5%",- paragraphSpacing: 0,- paragraphIndent: "0px",textCase: "none",textDecoration: "none",},- brandTitle: {- fontFamily: "Manrope",- fontWeight: "SemiBold",- lineHeight: "AUTO",- fontSize: 20,- letterSpacing: "0.5%",- paragraphSpacing: 0,- paragraphIndent: "0px",- textCase: "none",- textDecoration: "none",- },- spaceSectionValueText: {+ unit: {fontFamily: "Inter",fontWeight: "Medium",lineHeight: 10,fontSize: 10,- letterSpacing: "0%",+ letterSpacing: 0,paragraphSpacing: 0,paragraphIndent: "0px",- textCase: "none",+ textCase: "uppercase",textDecoration: "none",},spaceSectionUnitText: {@@ -220,10 +198,10 @@ export const typography = {textCase: "uppercase",textDecoration: "none",},- small: {+ spaceSectionValueText: {fontFamily: "Inter",- fontWeight: "Regular",- lineHeight: 11,+ fontWeight: "Medium",+ lineHeight: 10,fontSize: 10,letterSpacing: "0%",paragraphSpacing: 0,@@ -231,9 +209,24 @@ export const typography = {textCase: "none",textDecoration: "none",},+ brandTitle: {+ fontFamily: "Manrope",+ fontWeight: "SemiBold",+ lineHeight: "AUTO",+ fontSize: 20,+ letterSpacing: "0.5%",+ paragraphSpacing: 0,+ paragraphIndent: "0px",+ textCase: "none",+ textDecoration: "none",+ },} as const;-export const textCase = { none: "none", uppercase: "uppercase" } as const;+export const textCase = {+ none: "none",+ uppercase: "uppercase",+ capitalize: "capitalize",+} as const;export const textDecoration = { none: "none" } as const;@@ -282,6 +275,7 @@ export const color = {backgroundItemCurrent: "#0081f1",backgroundItemCurrentChild: "#e1f0ff",backgroundItemCurrentHidden: "#7e868c",+ backgroundItemMenuItemHover: "#c9c9c9",backgroundTooltipMain: "#11181c",backgroundTooltipDesigner: "#ffffff",backgroundSpacingTopBottom: "#f1f3f5",