@rocket.chat/fuselage-tokens 0.36.0 → 0.37.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -44
- package/dist/badge.d.json.ts +2 -2
- package/dist/border.d.json.ts +2 -2
- package/dist/breakpoints.d.json.ts +2 -2
- package/dist/button.d.json.ts +2 -2
- package/dist/colors.d.json.ts +2 -2
- package/dist/font.d.json.ts +2 -2
- package/dist/package.json +3 -0
- package/dist/shadow.d.json.ts +2 -2
- package/dist/spacing.d.json.ts +11 -0
- package/dist/spacing.json +10 -0
- package/dist/spacing.scss +15 -0
- package/dist/status.d.json.ts +2 -2
- package/dist/statusBullet.d.json.ts +2 -2
- package/dist/stroke.d.json.ts +2 -2
- package/dist/surface.d.json.ts +2 -2
- package/dist/typography.d.json.ts +2 -2
- package/dist/zIndex.d.json.ts +7 -0
- package/dist/zIndex.json +6 -0
- package/dist/zIndex.scss +11 -0
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -1,79 +1,106 @@
|
|
|
1
|
-
<!--header-->
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<a href="https://rocket.chat" title="Rocket.Chat">
|
|
5
|
-
<img src="https://github.com/RocketChat/Rocket.Chat.Artwork/raw/master/Logos/2020/png/logo-horizontal-red.png" alt="Rocket.Chat" />
|
|
6
|
-
</a>
|
|
7
|
-
</p>
|
|
8
|
-
|
|
9
1
|
# `@rocket.chat/fuselage-tokens`
|
|
10
2
|
|
|
11
|
-
> Design tokens for Fuselage, Rocket.Chat's design system
|
|
3
|
+
> Design tokens for Fuselage, Rocket.Chat's design system, as JSON and SCSS.
|
|
12
4
|
|
|
13
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@rocket.chat/fuselage-tokens) [](https://www.npmjs.com/package/@rocket.chat/fuselage-tokens)
|
|
14
6
|
|
|
15
|
-
|
|
7
|
+
The colors, typography, breakpoints, border and spacing values that Fuselage and the Rocket.Chat clients are styled with. They are defined once and built with [Style Dictionary](https://styledictionary.com/) into JSON files (with TypeScript declarations) and SCSS maps.
|
|
16
8
|
|
|
17
|
-
|
|
9
|
+
Use this package when you need Rocket.Chat's design values outside of Fuselage's React components: charts, emails, PDFs, native code, or your own stylesheets. If you use `@rocket.chat/fuselage`, its `Box` props and `Palette` already read from these tokens.
|
|
18
10
|
|
|
19
|
-
|
|
11
|
+
## Installation
|
|
20
12
|
|
|
21
|
-
|
|
13
|
+
```sh
|
|
14
|
+
npm install @rocket.chat/fuselage-tokens
|
|
15
|
+
```
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
The package has no dependencies and no JavaScript entry point. Import the files under `dist/` directly.
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
## Usage
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
### JavaScript and TypeScript
|
|
22
|
+
|
|
23
|
+
Each token category is a JSON file:
|
|
29
24
|
|
|
30
|
-
|
|
25
|
+
```ts
|
|
26
|
+
import breakpoints from '@rocket.chat/fuselage-tokens/dist/breakpoints.json';
|
|
27
|
+
import colors from '@rocket.chat/fuselage-tokens/dist/colors.json';
|
|
28
|
+
import typography from '@rocket.chat/fuselage-tokens/dist/typography.json';
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
colors.n900; // '#…', the darkest neutral
|
|
31
|
+
typography.fontScale.h1; // { fontSize: 32, fontWeight: 700, letterSpacing: 0, lineHeight: 40 }
|
|
32
|
+
breakpoints.md.minViewportWidth; // 768
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
In Node.js ES modules, add the import attribute: `import colors from '@rocket.chat/fuselage-tokens/dist/colors.json' with { type: 'json' };`.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
TypeScript resolves the types through `resolveJsonModule`. Each file also has a `<name>.d.json.ts` declaration next to it, which TypeScript uses when `allowArbitraryExtensions` is enabled.
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Theme-aware categories have one object per theme:
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
```ts
|
|
42
|
+
import surface from '@rocket.chat/fuselage-tokens/dist/surface.json';
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
const background = surface.dark.room;
|
|
45
|
+
```
|
|
45
46
|
|
|
46
|
-
###
|
|
47
|
+
### SCSS
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
Each category is also a flat Sass map, with keys made from the token path in kebab case:
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
```scss
|
|
52
|
+
@use 'sass:map';
|
|
53
|
+
@use '@rocket.chat/fuselage-tokens/dist/breakpoints.scss';
|
|
54
|
+
@use '@rocket.chat/fuselage-tokens/dist/colors.scss';
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
.sidebar {
|
|
57
|
+
color: map.get(colors.$colors, 'n900');
|
|
58
|
+
|
|
59
|
+
@media (min-width: map.get(breakpoints.$breakpoints, 'md-min-viewport-width')) {
|
|
60
|
+
padding-inline: map.get(breakpoints.$breakpoints, 'md-gutter-width');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
54
63
|
```
|
|
55
64
|
|
|
56
|
-
|
|
65
|
+
The map is named after the category in kebab case: `$colors`, `$surface`, `$status-bullet`, and so on. Add `node_modules` to your Sass load paths (or let your bundler resolve package imports) for the `@use` paths above to work.
|
|
57
66
|
|
|
58
|
-
|
|
67
|
+
## API
|
|
59
68
|
|
|
60
|
-
|
|
61
|
-
Before commiting, check if your code fits our style by running:
|
|
69
|
+
Every category is available as `dist/<category>.json`, `dist/<category>.d.json.ts` and `dist/<category>.scss`.
|
|
62
70
|
|
|
63
|
-
|
|
71
|
+
| Category | Contents |
|
|
72
|
+
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
73
|
+
| `colors` | The base palette: `white` and graded scales for neutral (`n100`–`n900`), red (`r`), orange (`o`), purple (`p`), yellow (`y`), green (`g`) and blue (`b`). |
|
|
74
|
+
| `surface` | Background colors (`light`, `tint`, `room`, `hover`, `selected`, `sidebar`…). |
|
|
75
|
+
| `font` | Text and icon colors (`default`, `titlesLabels`, `hint`, `info`, `danger`…). |
|
|
76
|
+
| `stroke` | Border colors (`extraLight`, `light`, `medium`, `dark`, `highlight`, `error`…). |
|
|
77
|
+
| `status` | Status backgrounds and the text color to use on each (`info`, `font-on-info`, `success`, `danger`, `warning`, `service-1`…). |
|
|
78
|
+
| `statusBullet` | User presence colors (`online`, `away`, `busy`, `disabled`, `offline`, `loading`). |
|
|
79
|
+
| `badge` | Badge backgrounds (`level-0` to `level-4`). |
|
|
80
|
+
| `button` | Button background and text colors per variant and state. |
|
|
81
|
+
| `shadow` | Shadow colors (`highlight`, `danger`, `elevation-1`…). |
|
|
82
|
+
| `typography` | `fontFamily` (`sans`, `mono`) and `fontScale` (`hero`, `h1`–`h5`, `p1`, `p1m`, `p1b`, `p2`, `p2m`, `p2b`, `c1`, `c2`, `micro`). |
|
|
83
|
+
| `breakpoints` | `xs`, `sm`, `md`, `lg`, `xl`, `xxl` and `xxxl`, each with `minViewportWidth`, `columns` and `gutterWidth`. |
|
|
84
|
+
| `border` | `radius` (`none`, `default`, `small`, `medium`, `large`, `extra-large`, `full`) and `width` (`none`, `default`, `medium`, `large`, `extra-large`). |
|
|
85
|
+
| `spacing` | The spacing scale for margins, paddings and gaps: `x4`, `x8`, `x12`, `x16`, `x20`, `x24`, `x32` and `x40`. The SCSS map holds them in `px`. |
|
|
86
|
+
| `zIndex` | Stacking layers: `raised` (1), `overlap` (2), `sticky` (10) and `overlay` (100). |
|
|
64
87
|
|
|
65
|
-
|
|
66
|
-
yarn lint
|
|
67
|
-
```
|
|
88
|
+
`surface`, `font`, `stroke`, `status`, `statusBullet`, `badge`, `button` and `shadow` are split by theme: `light`, `dark` and `high-contrast`.
|
|
68
89
|
|
|
69
|
-
|
|
90
|
+
In the JSON files, sizes are plain numbers in pixels and colors are hex strings.
|
|
70
91
|
|
|
71
|
-
|
|
92
|
+
## Development
|
|
72
93
|
|
|
73
|
-
|
|
94
|
+
This package lives in the [Rocket.Chat monorepo](https://github.com/RocketChat/Rocket.Chat/tree/develop/packages/fuselage-tokens). From the repository root:
|
|
74
95
|
|
|
75
96
|
```sh
|
|
76
|
-
yarn
|
|
97
|
+
yarn workspace @rocket.chat/fuselage-tokens build
|
|
98
|
+
yarn workspace @rocket.chat/fuselage-tokens lint
|
|
99
|
+
yarn workspace @rocket.chat/fuselage-tokens lint:fix
|
|
77
100
|
```
|
|
78
101
|
|
|
79
|
-
|
|
102
|
+
Token sources live in `src/` as Style Dictionary JSON. `build.js` and `config.js` define the transforms and output formats.
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
MIT — see [LICENSE](https://github.com/RocketChat/Rocket.Chat/blob/develop/LICENSE).
|
package/dist/badge.d.json.ts
CHANGED
package/dist/border.d.json.ts
CHANGED
package/dist/button.d.json.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export default button;
|
|
2
1
|
declare const button: {
|
|
3
2
|
"light": {
|
|
4
3
|
"backgroundPrimaryDefault": "#156ff5",
|
|
@@ -126,4 +125,5 @@ declare const button: {
|
|
|
126
125
|
"fontOnSuccess": "#ffffff",
|
|
127
126
|
"fontOnSuccessDisabled": "#757575"
|
|
128
127
|
}
|
|
129
|
-
};
|
|
128
|
+
};
|
|
129
|
+
export = button;
|
package/dist/colors.d.json.ts
CHANGED
package/dist/font.d.json.ts
CHANGED
package/dist/shadow.d.json.ts
CHANGED
package/dist/status.d.json.ts
CHANGED
package/dist/stroke.d.json.ts
CHANGED
package/dist/surface.d.json.ts
CHANGED
package/dist/zIndex.json
ADDED
package/dist/zIndex.scss
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rocket.chat/fuselage-tokens",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0-rc.0",
|
|
4
4
|
"description": "Design tokens for Fuselage, Rocket.Chat's design system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design",
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"fuselage",
|
|
9
9
|
"rocket.chat"
|
|
10
10
|
],
|
|
11
|
-
"homepage": "https://
|
|
11
|
+
"homepage": "https://github.com/RocketChat/Rocket.Chat#readme",
|
|
12
12
|
"bugs": {
|
|
13
|
-
"url": "https://github.com/RocketChat/
|
|
13
|
+
"url": "https://github.com/RocketChat/Rocket.Chat/issues"
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/RocketChat/
|
|
17
|
+
"url": "git+https://github.com/RocketChat/Rocket.Chat.git",
|
|
18
18
|
"directory": "packages/fuselage-tokens"
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
@@ -24,19 +24,20 @@
|
|
|
24
24
|
},
|
|
25
25
|
"type": "module",
|
|
26
26
|
"files": [
|
|
27
|
-
"dist"
|
|
27
|
+
"/dist"
|
|
28
28
|
],
|
|
29
29
|
"scripts": {
|
|
30
|
-
"build": "
|
|
30
|
+
"build": "rm -rf dist && node ./build.js",
|
|
31
|
+
"lint": "yarn run -T oxlint",
|
|
32
|
+
"lint:fix": "yarn run -T oxlint --fix"
|
|
31
33
|
},
|
|
32
34
|
"devDependencies": {
|
|
33
|
-
"
|
|
34
|
-
"eslint-config-prettier": "~10.1.8",
|
|
35
|
-
"lint-all": "^0.31.25",
|
|
36
|
-
"prettier": "~3.6.2",
|
|
37
|
-
"rimraf": "~6.1.3",
|
|
35
|
+
"change-case": "~5.4.4",
|
|
38
36
|
"style-dictionary": "~5.5.3"
|
|
39
37
|
},
|
|
38
|
+
"volta": {
|
|
39
|
+
"extends": "../../package.json"
|
|
40
|
+
},
|
|
40
41
|
"publishConfig": {
|
|
41
42
|
"access": "public"
|
|
42
43
|
}
|