@synergy-design-system/tokens 1.0.0-main.1 → 1.0.0-main.11
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/CHANGELOG.md +70 -0
- package/LICENSE +28 -0
- package/README.md +126 -31
- package/dist/js/index.js +934 -0
- package/dist/scss/_tokens.scss +190 -0
- package/dist/themes/dark.css +251 -0
- package/dist/themes/light.css +251 -0
- package/package.json +23 -8
- package/src/figma-tokens/$metadata.json +13 -0
- package/src/figma-tokens/$themes.json +334 -0
- package/src/figma-tokens/_docs.json +1256 -0
- package/src/figma-tokens/color/dark.json +286 -0
- package/src/figma-tokens/color/light.json +286 -0
- package/src/figma-tokens/color/primitives.json +292 -0
- package/src/figma-tokens/globals.json +415 -0
- package/src/figma-tokens/semantic/button.json +18 -0
- package/src/figma-tokens/semantic/focus-ring.json +16 -0
- package/src/figma-tokens/semantic/input.json +266 -0
- package/src/figma-tokens/semantic/toggle.json +18 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
+
# [@synergy-design-system/tokens-v1.0.0-main.11](https://github.com/SickDesignSystem/synergy/compare/tokens/1.0.0-main.10...tokens/1.0.0-main.11) (2023-11-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 🐛 add toggle tokens namespacing ([#160](https://github.com/SickDesignSystem/synergy/issues/160)) ([8734cf2](https://github.com/SickDesignSystem/synergy/commit/8734cf201e199defa23ff1419f20fa1efdf2fc56))
|
|
7
|
+
|
|
8
|
+
# [@synergy-design-system/tokens-v1.0.0-main.10](https://github.com/SickDesignSystem/synergy/compare/tokens/1.0.0-main.9...tokens/1.0.0-main.10) (2023-11-20)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* 🐛 fix focus ring offset ([#159](https://github.com/SickDesignSystem/synergy/issues/159)) ([816983e](https://github.com/SickDesignSystem/synergy/commit/816983ed01d22c5aa0bda18892e399d26462b1ef))
|
|
14
|
+
|
|
15
|
+
# [@synergy-design-system/tokens-v1.0.0-main.9](https://github.com/SickDesignSystem/synergy/compare/tokens/1.0.0-main.8...tokens/1.0.0-main.9) (2023-11-17)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* changed focus-ring offset and color token ([#157](https://github.com/SickDesignSystem/synergy/issues/157)) ([8a553e5](https://github.com/SickDesignSystem/synergy/commit/8a553e53ca31e3ac5fa44c176fbeec5797cf37a9))
|
|
21
|
+
|
|
22
|
+
# [@synergy-design-system/tokens-v1.0.0-main.8](https://github.com/SickDesignSystem/synergy/compare/tokens/1.0.0-main.7...tokens/1.0.0-main.8) (2023-11-16)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* 🐛 use correct focus ring width ([#144](https://github.com/SickDesignSystem/synergy/issues/144)) ([12d3cbe](https://github.com/SickDesignSystem/synergy/commit/12d3cbe9241a4edca0afabc20dad74cd9874d3b0))
|
|
28
|
+
|
|
29
|
+
# [@synergy-design-system/tokens-v1.0.0-main.7](https://github.com/SickDesignSystem/synergy/compare/tokens/1.0.0-main.6...tokens/1.0.0-main.7) (2023-11-16)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* ✨ add syn-button ([#118](https://github.com/SickDesignSystem/synergy/issues/118)) ([ca9385b](https://github.com/SickDesignSystem/synergy/commit/ca9385beef3f868679d51088d3fa372423277223))
|
|
35
|
+
|
|
36
|
+
# [@synergy-design-system/tokens-v1.0.0-main.6](https://github.com/SickDesignSystem/synergy/compare/tokens/1.0.0-main.5...tokens/1.0.0-main.6) (2023-11-07)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
* ✨ add scss and js support for tokens ([#120](https://github.com/SickDesignSystem/synergy/issues/120)) ([1830066](https://github.com/SickDesignSystem/synergy/commit/1830066b12a061013a4fb67adaf0856de11f5e9a))
|
|
42
|
+
|
|
43
|
+
# [@synergy-design-system/tokens-v1.0.0-main.5](https://github.com/SickDesignSystem/synergy/compare/tokens/1.0.0-main.4...tokens/1.0.0-main.5) (2023-11-07)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
* ✨ clearable-color ([#106](https://github.com/SickDesignSystem/synergy/issues/106)) ([13cc5ec](https://github.com/SickDesignSystem/synergy/commit/13cc5ecd0a9f4776dae711c78a3d9e40a0d930e8))
|
|
49
|
+
|
|
50
|
+
# [@synergy-design-system/tokens-v1.0.0-main.4](https://github.com/SickDesignSystem/synergy/compare/tokens/1.0.0-main.3...tokens/1.0.0-main.4) (2023-11-02)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Features
|
|
54
|
+
|
|
55
|
+
* ✨ add button tokens ([#109](https://github.com/SickDesignSystem/synergy/issues/109)) ([237148c](https://github.com/SickDesignSystem/synergy/commit/237148ccf64be74fc3721dc5381010c5495890f8))
|
|
56
|
+
|
|
57
|
+
# [@synergy-design-system/tokens-v1.0.0-main.3](https://github.com/SickDesignSystem/synergy/compare/tokens/1.0.0-main.2...tokens/1.0.0-main.3) (2023-10-26)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### Features
|
|
61
|
+
|
|
62
|
+
* update input-tokens ([#97](https://github.com/SickDesignSystem/synergy/issues/97)) ([630d8e2](https://github.com/SickDesignSystem/synergy/commit/630d8e25b053daae1c78944e5e56577aead1a6c2))
|
|
63
|
+
|
|
64
|
+
# [@synergy-design-system/tokens-v1.0.0-main.2](https://github.com/SickDesignSystem/synergy/compare/tokens/1.0.0-main.1...tokens/1.0.0-main.2) (2023-10-26)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Features
|
|
68
|
+
|
|
69
|
+
* ✨ React component support ([#88](https://github.com/SickDesignSystem/synergy/issues/88)) ([967b7dd](https://github.com/SickDesignSystem/synergy/commit/967b7ddce3f2e1f6a1c55898c1368f0560947101))
|
|
70
|
+
|
|
1
71
|
# @synergy-design-system/tokens-v1.0.0-main.1 (2023-10-23)
|
|
2
72
|
|
|
3
73
|
|
package/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023, SickDesignSystem
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,54 +1,149 @@
|
|
|
1
|
-
|
|
1
|
+
# @synergy-design-system/tokens
|
|
2
|
+
|
|
3
|
+
This package provides the design tokens that form the base for all components of the synergy design system.
|
|
4
|
+
It provides multiple exports that can be consumed in applications.
|
|
2
5
|
|
|
3
6
|
---
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
## Installation
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
This script is designed to inspect and append missing CSS variables based on a given prefix.
|
|
10
|
+
Please make sure to install the tokens package as a dependency:
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
```bash
|
|
13
|
+
npm install --save @synergy-design-system/tokens
|
|
14
|
+
```
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
---
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
## Provided tokens
|
|
19
|
+
|
|
20
|
+
As projects may use various forms of applying styles, we provide different ways to consume our tokens.
|
|
21
|
+
|
|
22
|
+
### Using CSS themes
|
|
23
|
+
|
|
24
|
+
Provides the css variables that are used in synergy components as css variables and is **required** if you are using `@synergy-design-system/components` or a derived package like `@synergy-design-system/react`.
|
|
25
|
+
The tokens package ships with two themes: 🌞 light and 🌛 dark.
|
|
26
|
+
|
|
27
|
+
> The css styles are used as a single source of truth, also when working with the provided JavaScript or SASS exports!
|
|
28
|
+
> Always make sure to load one of the css themes!
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<!DOCTYPE html>
|
|
32
|
+
<head>
|
|
33
|
+
<!-- Example 1: Referencing directly in a HTML document -->
|
|
34
|
+
<!-- Make sure to add the stylesheet before using any components -->
|
|
35
|
+
<link rel="stylesheet" href="/node_modules/@synergy-design-system/tokens/themes/light.css" />
|
|
36
|
+
|
|
37
|
+
<!-- Alternative: Use the dark theme -->
|
|
38
|
+
<link rel="stylesheet" href="/node_modules/@synergy-design-system/tokens/themes/dark.css" />
|
|
39
|
+
</head>
|
|
40
|
+
<body>
|
|
41
|
+
<div style="background: var(--syn-color-primary-500)">
|
|
42
|
+
Content
|
|
43
|
+
</div>
|
|
44
|
+
</body>
|
|
45
|
+
</html>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
// Example 2: Importing for bundlers
|
|
50
|
+
// In most build systems, you will be able to import css files directly
|
|
51
|
+
// Use this way when you already use a build system like webpack or vite
|
|
52
|
+
// to make it part of your bundle.
|
|
53
|
+
// Note this import should happen BEFORE you render any components!
|
|
54
|
+
import '@synergy-design-system/tokens/themes/light.css';
|
|
55
|
+
```
|
|
19
56
|
|
|
20
57
|
---
|
|
21
58
|
|
|
22
|
-
###
|
|
59
|
+
### Usage in JavaScript
|
|
23
60
|
|
|
24
|
-
|
|
25
|
-
|
|
61
|
+
We provide JavaScript exports for the design tokens.
|
|
62
|
+
All tokens map to the corresponding css variables to make sure we have a single source of truth.
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
// Using variables in JavaScript
|
|
26
66
|
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
- A custom format for outputting the generated tokens is also defined.
|
|
67
|
+
// Import the css variables first as they are our single source of truth
|
|
68
|
+
import '@synergy-design-system/tokens/themes/light.css';
|
|
30
69
|
|
|
31
|
-
|
|
70
|
+
// Imports all tokens
|
|
71
|
+
import * as tokens from '@synergy-design-system/tokens';
|
|
32
72
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
73
|
+
// Set the background color of a queried div via JavaScript
|
|
74
|
+
const elm = document.querySelector('div');
|
|
75
|
+
div.style.backgroundColor = tokens.SynColorPrimary500;
|
|
76
|
+
|
|
77
|
+
// Get the value
|
|
78
|
+
console.log(div.style.backgroundColor);
|
|
79
|
+
// Will print 'var(--syn-color-primary-500)'
|
|
80
|
+
```
|
|
39
81
|
|
|
40
82
|
---
|
|
41
83
|
|
|
42
|
-
###
|
|
84
|
+
### Usage in SCSS:
|
|
85
|
+
|
|
86
|
+
Our variables are also available as scss variables that make it possible to consume them in sass based projects.
|
|
87
|
+
|
|
88
|
+
```scss
|
|
89
|
+
// Import the design tokens first.
|
|
90
|
+
// This can be done in a sass file or in any other way described above.
|
|
91
|
+
// Make sure to NOT add the .css file suffix, this will not work in sass
|
|
92
|
+
@import "~@synergy-design-system/tokens/themes/light";
|
|
93
|
+
|
|
94
|
+
// Import the scss variables
|
|
95
|
+
@import "@synergy-design-system/tokens/scss/tokens";
|
|
96
|
+
|
|
97
|
+
div {
|
|
98
|
+
background: $SynColorPrimary500;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// This will render the following output:
|
|
102
|
+
:root {
|
|
103
|
+
--syn-color-primary-500: #0ca2eb;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
div {
|
|
107
|
+
background: var(--syn-color-primary-500);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Optional: Configuring tokens in VSCode
|
|
114
|
+
|
|
115
|
+
Using VSCode?
|
|
116
|
+
You may also want to install vunguyentuan.vscode-css-variables to include css variable auto completion in your project.
|
|
117
|
+
Just make sure to add a valid path to the light theme in the `.vscode/settings.json` file like this:
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
"cssVariables.lookupFiles": [
|
|
121
|
+
"node_modules/@synergy-design-system/tokens/themes/light.css"
|
|
122
|
+
],
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Documentation
|
|
128
|
+
|
|
129
|
+
### Building the tokens
|
|
130
|
+
|
|
131
|
+
Outputs of the tokens are created using [Style Dictionary](https://amzn.github.io/style-dictionary/).
|
|
132
|
+
You can trigger a build using `pnpm build` in the `tokens` package root. This will create the css themes (located in `dist/themes/light.css` and `dist/themes/dark.css`), as well as the JavaScript exports (located at `dist/js/index.js`) and scss variables (`dist/scss/_tokens.scss`).
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
### `add-missing-tokens.js`
|
|
43
137
|
|
|
44
138
|
**Purpose**:
|
|
45
|
-
This script
|
|
139
|
+
This script is designed to inspect and append missing CSS variables based on a given prefix.
|
|
46
140
|
|
|
47
|
-
- It
|
|
48
|
-
-
|
|
141
|
+
- It reads from a source directory containing fallback styles and checks against a target directory for missing variables.
|
|
142
|
+
- Variables are extracted based on a specified prefix.
|
|
143
|
+
- Missing variables are appended to the target files.
|
|
49
144
|
|
|
50
145
|
**Key Functions**:
|
|
51
146
|
|
|
52
|
-
- `
|
|
53
|
-
|
|
54
|
-
|
|
147
|
+
- `extractVariables(data, prefix)`: Extracts variables from the provided data based on the prefix.
|
|
148
|
+
- `compareAndAppendVariables(sourceFilePath, targetFilePath, prefix)`: Compares source and target files for missing variables and appends them.
|
|
149
|
+
- `addMissingTokens(prefix)`: Main function that loops through target files and checks for missing variables.
|