Skip to content
Draft
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
545 changes: 545 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions packages/insomnia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"verify-bundle-plugins": "esr --cache ./scripts/verify-bundle-plugins.ts",
"install-x64-native-dependencies": "esr --cache ./scripts/install-x64-native-dependencies.ts",
"build": "react-router build && esr --cache ./scripts/build.ts --noErrorTruncation",
"build:design-token": "esr --cache ./scripts/build-token.ts",
"build:react-router": "react-router build",
"generate:schema": "esr ./src/schema.ts",
"build:electron-entrypoints": "cross-env NODE_ENV=development esr esbuild.entrypoints.ts",
Expand Down Expand Up @@ -193,6 +194,7 @@
"esbuild": "^0.25.10",
"esbuild-runner": "^2.2.2",
"openapi-types": "^12.1.3",
"style-dictionary": "^5.1.1",
"type-fest": "^4.40.0",
"typescript": "^5.8.3",
"vite": "^7.1.3"
Expand Down
19 changes: 19 additions & 0 deletions packages/insomnia/scripts/build-token.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import StyleDictionary from 'style-dictionary';

const sd = new StyleDictionary({
source: ['src/ui/design-tokens/index.ts'],
platforms: {
css: {
transformGroup: 'css',
prefix: 'inso',
buildPath: 'src/ui/css/',
files: [
{
destination: 'token.css',
format: 'css/variables',
},
],
},
},
});
sd.buildAllPlatforms();
1 change: 1 addition & 0 deletions packages/insomnia/src/ui/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
@import './lib/codemirror/material.css';
@import 'monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon.css';
@import './main.css';
@import './token.css';

@tailwind base;
@tailwind components;
Expand Down
43 changes: 43 additions & 0 deletions packages/insomnia/src/ui/css/token.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Do not edit directly, this file was auto-generated.
*/

:root {
--inso-color-background-default: #ffffff;
--inso-color-background-default-hover: #f3f4f6;
--inso-color-background-default-active: #f3f4f6;
--inso-color-background-default-focus: #84cc16;
--inso-color-text-default: #f3f4f6;
--inso-color-text-default-hover: #f3f4f6;
--inso-color-text-default-active: #f3f4f6;
--inso-color-text-default-disabled: #f3f4f6;
--inso-color-border-default: #f3f4f6;
--inso-color-border-default-hover: #f3f4f6;
--inso-color-border-default-active: #f3f4f6;
--inso-color-border-default-disabled: #f3f4f6;
--inso-radius-none: 0px;
--inso-radius-xs: 2px;
--inso-radius-sm: 4px;
--inso-radius-md: 6px;
--inso-radius-lg: 8px;
--inso-radius-xl: 12px;
--inso-spacing-xs: 4px;
--inso-spacing-sm: 8px;
--inso-spacing-md: 16px;
--inso-spacing-lg: 24px;
--inso-spacing-xl: 32px;
--inso-line-height-xs: 16px;
--inso-line-height-sm: 20px;
--inso-line-height-md: 24px;
--inso-line-height-lg: 28px;
--inso-line-height-xl: 32px;
--inso-font-size-xs: 12px;
--inso-font-size-sm: 14px;
--inso-font-size-md: 16px;
--inso-font-size-lg: 20px;
--inso-font-size-xl: 24px;
--inso-font-weight-light: 300;
--inso-font-weight-regular: 400;
--inso-font-weight-medium: 500;
--inso-font-weight-bold: 700;
}
Empty file.
15 changes: 15 additions & 0 deletions packages/insomnia/src/ui/design-tokens/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-nocheck
import color from './tokens/color.ts';
import radius from './tokens/radius.ts';
import spacing from './tokens/spacing.ts';
import typography from './tokens/typography.ts';
const { lineHeight, fontSize, fontWeight } = typography;
export default {
color,
radius,
spacing,
lineHeight,
fontSize,
fontWeight,
};
145 changes: 145 additions & 0 deletions packages/insomnia/src/ui/design-tokens/tokens/color.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
// tokens -> css variable -> tailwind config -> component usage
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);

const tailwindColors = require('tailwindcss/colors');

const background = {
default: {
_: { value: '#fff', type: 'color', comment: '' },
hover: { value: tailwindColors.gray[100], type: 'color', comment: '' },
active: { value: tailwindColors.gray[100], type: 'color', comment: '' },
focus: { value: '#84cc16', type: 'color', comment: '' },
disabled: '',
},
success: {
base: '',
Copy link
Member Author

Choose a reason for hiding this comment

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

use '_' instead

hover: '',
active: '',
disabled: '',
},
notice: {
base: '',
hover: '',
active: '',
disabled: '',
},
warning: {
base: '',
hover: '',
active: '',
disabled: '',
},
danger: {
base: '',
hover: '',
active: '',
disabled: '',
},
surprise: {
base: '',
hover: '',
active: '',
disabled: '',
},
info: {
base: '',
hover: '',
active: '',
disabled: '',
},
};
const text = {
default: {
_: { value: tailwindColors.gray[100], type: 'color', comment: '' },
hover: { value: tailwindColors.gray[100], type: 'color', comment: '' },
active: { value: tailwindColors.gray[100], type: 'color', comment: '' },
disabled: { value: tailwindColors.gray[100], type: 'color', comment: '' },
},
success: {
base: '',
hover: '',
active: '',
disabled: '',
},
notice: {
base: '',
hover: '',
active: '',
disabled: '',
},
warning: {
base: '',
hover: '',
active: '',
disabled: '',
},
danger: {
base: '',
hover: '',
active: '',
disabled: '',
},
surprise: {
base: '',
hover: '',
active: '',
disabled: '',
},
info: {
base: '',
hover: '',
active: '',
disabled: '',
},
};
const border = {
default: {
_: { value: tailwindColors.gray[100], type: 'color', comment: '' },
hover: { value: tailwindColors.gray[100], type: 'color', comment: '' },
active: { value: tailwindColors.gray[100], type: 'color', comment: '' },
disabled: { value: tailwindColors.gray[100], type: 'color', comment: '' },
},
success: {
base: '',
hover: '',
active: '',
disabled: '',
},
notice: {
base: '',
hover: '',
active: '',
disabled: '',
},
warning: {
base: '',
hover: '',
active: '',
disabled: '',
},
danger: {
base: '',
hover: '',
active: '',
disabled: '',
},
surprise: {
base: '',
hover: '',
active: '',
disabled: '',
},
info: {
base: '',
hover: '',
active: '',
disabled: '',
},
};

export default {
background,
text,
border,
};
8 changes: 8 additions & 0 deletions packages/insomnia/src/ui/design-tokens/tokens/radius.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
none: { value: '0px' },
xs: { value: '2px' },
sm: { value: '4px' },
md: { value: '6px' },
lg: { value: '8px' },
xl: { value: '12px' },
};
7 changes: 7 additions & 0 deletions packages/insomnia/src/ui/design-tokens/tokens/spacing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
xs: { value: '4px' },
sm: { value: '8px' },
md: { value: '16px' },
lg: { value: '24px' },
xl: { value: '32px' },
};
30 changes: 30 additions & 0 deletions packages/insomnia/src/ui/design-tokens/tokens/typography.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export default {
fontWeight: {
light: {
value: '300',
},
regular: {
value: '400',
},
medium: {
value: '500',
},
bold: {
value: '700',
},
},
fontSize: {
xs: { value: '12px' },
sm: { value: '14px' },
md: { value: '16px' },
lg: { value: '20px' },
xl: { value: '24px' },
},
lineHeight: {
xs: { value: '16px' },
sm: { value: '20px' },
md: { value: '24px' },
lg: { value: '28px' },
xl: { value: '32px' },
},
};
Loading