unholy-design-tokens 1.0.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/.github/workflows/lint-format-build.yml +35 -0
- package/.github/workflows/publish_release.yml +18 -0
- package/.prettierrc +9 -0
- package/ANALOGY_HOUSE.md +139 -0
- package/ANALOGY_I18NEXT.md +160 -0
- package/LICENSE +201 -0
- package/README.md +90 -0
- package/WHY_THIS_EXISTS.md +74 -0
- package/bin/build-tokens.ts +34 -0
- package/build/css/bg/bg.css +60 -0
- package/build/css/border/border.css +51 -0
- package/build/css/colors.css +204 -0
- package/build/css/conditional.css +8 -0
- package/build/css/cube/cube.block.css +18 -0
- package/build/css/cube/cube.composition.css +16 -0
- package/build/css/cube/cube.utility.css +185 -0
- package/build/css/font/font.css +24 -0
- package/build/css/space.css +20 -0
- package/build/css/text/text.css +48 -0
- package/build/css/themes/private-theme.css +228 -0
- package/build/css/themes/public-theme.css +228 -0
- package/build/css/variant/variant.css +42 -0
- package/build/css/variants.css +167 -0
- package/build/types/theme.d.ts +932 -0
- package/build/types/tokens.ts +653 -0
- package/dist/bin/build-tokens.js +27 -0
- package/dist/scripts/build-style-dictionary.js +32 -0
- package/dist/scripts/generate-typography-tokens.js +125 -0
- package/dist/src/colors/color.config.js +45 -0
- package/dist/src/colors/color.filter.js +19 -0
- package/dist/src/colors/color.formatter.js +25 -0
- package/dist/src/colors/index.js +2 -0
- package/dist/src/cube-css/cube.config.js +42 -0
- package/dist/src/cube-css/cube.formatter.js +89 -0
- package/dist/src/style-dictionary.config.js +143 -0
- package/dist/src/type-declarations/type-declarations.config.js +29 -0
- package/dist/src/type-declarations/type-declarations.formatter.js +111 -0
- package/dist/src/utils/helpers.js +9 -0
- package/dist/src/utils/index.js +4 -0
- package/dist/src/utils/template.js +83 -0
- package/dist/src/utils/tokens.js +80 -0
- package/dist/src/utils/utopia.js +19 -0
- package/eslint.config.js +67 -0
- package/package.json +60 -0
- package/scripts/build-style-dictionary.ts +44 -0
- package/scripts/generate-typography-tokens.ts +138 -0
- package/src/LICENSE +201 -0
- package/src/README.md +88 -0
- package/src/colors/color.config.ts +48 -0
- package/src/colors/color.filter.ts +28 -0
- package/src/colors/color.formatter.ts +43 -0
- package/src/colors/index.ts +6 -0
- package/src/cube-css/cube.config.ts +50 -0
- package/src/cube-css/cube.formatter.ts +104 -0
- package/src/formatters/spacing.js +95 -0
- package/src/style-dictionary.config.ts +151 -0
- package/src/theme/README.md +256 -0
- package/src/theme/cube-theme-addon.js +44 -0
- package/src/theme/helper.js +38 -0
- package/src/theme/index.js +6 -0
- package/src/theme/theme.config.js +42 -0
- package/src/theme/theme.filter.js +42 -0
- package/src/theme/theme.formatter.js +71 -0
- package/src/tokens/1 - primitives/README.md +58 -0
- package/src/tokens/1 - primitives/border.json +54 -0
- package/src/tokens/1 - primitives/breakpoint.json +10 -0
- package/src/tokens/1 - primitives/color-pool.json +266 -0
- package/src/tokens/1 - primitives/color.json +266 -0
- package/src/tokens/1 - primitives/font-scale.json +27 -0
- package/src/tokens/1 - primitives/font.json +23 -0
- package/src/tokens/1 - primitives/shadow.json +26 -0
- package/src/tokens/1 - primitives/space.json +27 -0
- package/src/tokens/2 - semantic/README.md +49 -0
- package/src/tokens/2 - semantic/border.json +27 -0
- package/src/tokens/2 - semantic/color.json +263 -0
- package/src/tokens/2 - semantic/details.md +1 -0
- package/src/tokens/2 - semantic/layout.json +52 -0
- package/src/tokens/2 - semantic/radius.json +13 -0
- package/src/tokens/2 - semantic/shadow.json +19 -0
- package/src/tokens/2 - semantic/spacing.json +25 -0
- package/src/tokens/3 - intent/README.md +43 -0
- package/src/tokens/3 - intent/background.json +135 -0
- package/src/tokens/3 - intent/color.json +265 -0
- package/src/tokens/3 - intent/font.json +61 -0
- package/src/tokens/3 - intent/text +67 -0
- package/src/tokens/README.md +176 -0
- package/src/tokens/color/brand.json +316 -0
- package/src/tokens/component/theming.json +69 -0
- package/src/tokens/conditional.json +40 -0
- package/src/tokens/custom/4 - (OPTIONAL) cube css/README.md +38 -0
- package/src/tokens/custom/4 - (OPTIONAL) cube css/block.json +24 -0
- package/src/tokens/custom/4 - (OPTIONAL) cube css/composition.json +26 -0
- package/src/tokens/custom/4 - (OPTIONAL) cube css/global.json +15 -0
- package/src/tokens/custom/4 - (OPTIONAL) cube css/utility.json +224 -0
- package/src/tokens/custom/OKlch/color.json +61 -0
- package/src/tokens/custom/OKlch/state.json +107 -0
- package/src/tokens/custom/OKlch/theme-color.json +34 -0
- package/src/tokens/custom/OKlch/variant.json +67 -0
- package/src/tokens/custom/components/highlighted.json +16 -0
- package/src/tokens/state.js +29 -0
- package/src/tokens/theme-color.json +34 -0
- package/src/type-declarations/type-declarations.config.ts +34 -0
- package/src/type-declarations/type-declarations.formatter.ts +122 -0
- package/src/utils/helpers.ts +11 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/template.ts +110 -0
- package/src/utils/tokens.ts +95 -0
- package/src/utils/utopia.ts +36 -0
- package/tailwind.md +720 -0
- package/tsconfig.json +19 -0
- package/turbowatch.ts +14 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Lint Format Build
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
# https://zellwk.com/blog/github-actions-deploy/
|
|
9
|
+
jobs:
|
|
10
|
+
lint-format-build:
|
|
11
|
+
if: ${{ ! startsWith(github.event.pull_request.head.ref, 'renovate/') }}
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout code
|
|
16
|
+
uses: actions/checkout@v5
|
|
17
|
+
|
|
18
|
+
- name: Setup Node.js and pnpm
|
|
19
|
+
uses: pnpm/action-setup@v4
|
|
20
|
+
with:
|
|
21
|
+
version: 10
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: pnpm install --no-frozen-lockfile
|
|
25
|
+
|
|
26
|
+
- name: Lint
|
|
27
|
+
run: pnpm lint
|
|
28
|
+
|
|
29
|
+
- name: Format
|
|
30
|
+
if: ${{ always() }}
|
|
31
|
+
run: pnpm format
|
|
32
|
+
|
|
33
|
+
# - name: Build
|
|
34
|
+
# if: ${{ always() }}
|
|
35
|
+
# run: pnpm build
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
ci:
|
|
10
|
+
uses: arthur-plazanet/github-actions-kit/.github/workflows/reusable_release_publish.yml@main
|
|
11
|
+
# with:
|
|
12
|
+
# node-version: '20'
|
|
13
|
+
# publish: true
|
|
14
|
+
secrets:
|
|
15
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
16
|
+
permissions:
|
|
17
|
+
contents: write # create releases/tags
|
|
18
|
+
id-token: write # npm provenance (OIDC)
|
package/.prettierrc
ADDED
package/ANALOGY_HOUSE.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Analogy - π Building a House, and how the abstraction works
|
|
2
|
+
|
|
3
|
+
Imagine that you want to build a house yourself, starting from the foundation up to the roof.
|
|
4
|
+
|
|
5
|
+
## Step 1 β You make a decision on which materials to use
|
|
6
|
+
|
|
7
|
+
You probably don't want to build your new house with not recognized materials.
|
|
8
|
+
You start by knowing and choosing the _**raw materials**_ you will use, which can be:
|
|
9
|
+
|
|
10
|
+
- πͺ΅ Wood
|
|
11
|
+
- π§± Bricks
|
|
12
|
+
- πͺ¨ Concrete
|
|
13
|
+
- π© Metal
|
|
14
|
+
- πͺ Glass
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
These are the basic ingredients of your house.
|
|
19
|
+
While having them is technically enough to start building your house, but it's not very practical:
|
|
20
|
+
|
|
21
|
+
- Every time you will need a wall, you will have to recalculate:
|
|
22
|
+
|
|
23
|
+
- how many bricks
|
|
24
|
+
- how much cement
|
|
25
|
+
- what thickness
|
|
26
|
+
- which type of reinforcement
|
|
27
|
+
|
|
28
|
+
- Nothing is standardized or reusable
|
|
29
|
+
- The house can be inconsistent
|
|
30
|
+
- If someone else joins the project later, you will need to explain EVERYTHING from scratch.
|
|
31
|
+
|
|
32
|
+
- If at some point you want to expand your house and involve other people, every new builder has to relearn everything
|
|
33
|
+
|
|
34
|
+
## π§± Step 2 β You create building parts to go faster
|
|
35
|
+
|
|
36
|
+
Instead of redefining everything every time, you create reusable parts:
|
|
37
|
+
|
|
38
|
+
- π« Some standard walls
|
|
39
|
+
- πͺ Standard doors
|
|
40
|
+
- πͺ Standard windows
|
|
41
|
+
|
|
42
|
+
They allow you to be faster, and you don't have to worry about the raw materials anymore.
|
|
43
|
+
|
|
44
|
+
Instead of thinking:
|
|
45
|
+
|
|
46
|
+
> "How many bricks and cement do I need to build this wall?"
|
|
47
|
+
|
|
48
|
+
You now think:
|
|
49
|
+
|
|
50
|
+
> "I need this specific wall"
|
|
51
|
+
|
|
52
|
+
These parts are reusable, consistent, and easier to understand.
|
|
53
|
+
|
|
54
|
+
## πͺ Step 3 β You want to create rooms with purpose
|
|
55
|
+
|
|
56
|
+
Now that you have standard parts, you want to create rooms with specific purposes:
|
|
57
|
+
|
|
58
|
+
- π bedroom (place to sleep)
|
|
59
|
+
- π³ kitchen (place to cook)
|
|
60
|
+
- πΏ bathroom (place to wash)
|
|
61
|
+
- πΌ office (place to work)
|
|
62
|
+
|
|
63
|
+
All of these rooms are made of parts you defined earlier (walls, doors, windows, roofs), but they have a specific purpose.
|
|
64
|
+
|
|
65
|
+
When you think about building a bedroom, you don't think
|
|
66
|
+
|
|
67
|
+
> 4 blue walls, 1 red doors
|
|
68
|
+
|
|
69
|
+
you think about
|
|
70
|
+
|
|
71
|
+
> "a place to sleep".
|
|
72
|
+
|
|
73
|
+
## ποΈ Step 4 β People live inside (Components)
|
|
74
|
+
|
|
75
|
+
Furniture, people, behavior β all of this sits on top of rooms.
|
|
76
|
+
|
|
77
|
+
No one sleeping in the bedroom wonders:
|
|
78
|
+
|
|
79
|
+
- βIs this wall brick or concrete?β
|
|
80
|
+
|
|
81
|
+
- βWhat thickness is the insulation?β
|
|
82
|
+
|
|
83
|
+
- βWhat type of screws did they use?β
|
|
84
|
+
|
|
85
|
+
They only care that it's a bedroom, and it serves its purpose.
|
|
86
|
+
They can then add furniture, decorate it, and use it as intended, according to the room's purpose.
|
|
87
|
+
|
|
88
|
+
## What if you want to change something?
|
|
89
|
+
|
|
90
|
+
When a house is finished, and you want to apport changes, you usually not:
|
|
91
|
+
|
|
92
|
+
- Directly change raw materials
|
|
93
|
+
- Rebuild rooms from scratch or change their purpose
|
|
94
|
+
|
|
95
|
+
What you do is updating what is directly visible:
|
|
96
|
+
|
|
97
|
+
- Change the paint color of the walls
|
|
98
|
+
- Change the type of furniture
|
|
99
|
+
- Swap a door for a bigger one
|
|
100
|
+
- Add more windows for more light
|
|
101
|
+
etc.
|
|
102
|
+
|
|
103
|
+
These pieces define the style, look and feel of the house without changing its fundamental structure, or the purpose of each room.
|
|
104
|
+
|
|
105
|
+
So if you want:
|
|
106
|
+
|
|
107
|
+
a modern house β update colors, finishes, fixtures
|
|
108
|
+
|
|
109
|
+
a cozy house β use warm tones, wooden textures
|
|
110
|
+
|
|
111
|
+
a minimalist house β simplify surfaces and spacing
|
|
112
|
+
|
|
113
|
+
All these changes happen in the layer that controls the appearance,
|
|
114
|
+
not in the foundation, not in the room layout,
|
|
115
|
+
and not in the purpose of the spaces.
|
|
116
|
+
|
|
117
|
+
It's the part that's meant to be changed later
|
|
118
|
+
while everything else stays stable.
|
|
119
|
+
|
|
120
|
+
- **Parts with purpose**: Is
|
|
121
|
+
- **Abstraction layers**: Each step represents a layer of abstraction, from raw materials to functional spaces. This mirrors how design tokens abstract raw values into meaningful components.
|
|
122
|
+
|
|
123
|
+
## πͺ The abstraction protects the user
|
|
124
|
+
|
|
125
|
+
Just like:
|
|
126
|
+
|
|
127
|
+
Components donβt care about RGB values
|
|
128
|
+
|
|
129
|
+
Developers donβt care about the exact blue hex
|
|
130
|
+
|
|
131
|
+
Designers donβt want to debate spacing values every time
|
|
132
|
+
|
|
133
|
+
The abstraction protects the user.
|
|
134
|
+
|
|
135
|
+
- How to screw a simple door
|
|
136
|
+
- Fix some wall together (which material is it even?)
|
|
137
|
+
- or how to properly install and even isolate a window
|
|
138
|
+
|
|
139
|
+
But for example, you don't need to know the raw material that was used to create the door,; neither
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# i18next analogy with Design Tokens
|
|
2
|
+
|
|
3
|
+
## Hard-coded-string: the "old wayβ
|
|
4
|
+
|
|
5
|
+
Before having translation tools, you hard-code strings directly in components:
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
// React, Vue, whatever
|
|
9
|
+
<Alert type="success">Profile updated successfully!</Alert>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Strings are hard-coded:
|
|
13
|
+
|
|
14
|
+
- Not reusable
|
|
15
|
+
- Not translatable
|
|
16
|
+
- Not themeable per language/brand/product
|
|
17
|
+
|
|
18
|
+
So you introduce **i18next**.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Layer 1 β Translation resources (raw data)
|
|
23
|
+
|
|
24
|
+
You define your resources:
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
// en/translation.json
|
|
28
|
+
{
|
|
29
|
+
"profile": {
|
|
30
|
+
"updated": "Profile updated successfully!"
|
|
31
|
+
},
|
|
32
|
+
"errors": {
|
|
33
|
+
"network": "Something went wrong. Please try again."
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
// fr/translation.json
|
|
41
|
+
{
|
|
42
|
+
"profile": {
|
|
43
|
+
"updated": "Profil mis à jour avec succès !"
|
|
44
|
+
},
|
|
45
|
+
"errors": {
|
|
46
|
+
"network": "Une erreur est survenue. Veuillez rΓ©essayer."
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This is just **structured data**:
|
|
53
|
+
|
|
54
|
+
- One language per file
|
|
55
|
+
- Raw strings
|
|
56
|
+
- No component logic
|
|
57
|
+
|
|
58
|
+
Think of it as **your translation βdatabaseβ**, nothing more.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Layer 2 β Meaningful keys & namespaces
|
|
63
|
+
|
|
64
|
+
Then you start organizing things:
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
// common.json
|
|
68
|
+
{
|
|
69
|
+
"actions": {
|
|
70
|
+
"save": "Save",
|
|
71
|
+
"cancel": "Cancel"
|
|
72
|
+
},
|
|
73
|
+
"status": {
|
|
74
|
+
"success": "Success",
|
|
75
|
+
"error": "Error"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// profile.json
|
|
80
|
+
{
|
|
81
|
+
"messages": {
|
|
82
|
+
"updated": "Profile updated successfully!"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
You now have:
|
|
89
|
+
|
|
90
|
+
- **Namespaces**: `common`, `profile`, `errors`
|
|
91
|
+
- **Meaningful keys**: `actions.save`, `status.success`, `messages.updated`
|
|
92
|
+
|
|
93
|
+
Developers donβt write βSauvegarderβ or βSpeichernβ β
|
|
94
|
+
|
|
95
|
+
they write:
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
t('common.actions.save');
|
|
99
|
+
t('profile.messages.updated');
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Youβve created a **semantic layer** of _meaningful keys_ above raw strings.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Layer 3 β Component usage / intent
|
|
107
|
+
|
|
108
|
+
Now imagine an `Alert`:
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
function Alert({ intent }: { intent: 'success' | 'error' | 'warning' }) {
|
|
112
|
+
const { t } = useTranslation('common');
|
|
113
|
+
|
|
114
|
+
const titleKey = {
|
|
115
|
+
success: 'status.success',
|
|
116
|
+
error: 'status.error',
|
|
117
|
+
warning: 'status.warning',
|
|
118
|
+
}[intent];
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<div className={`alert alert--${intent}`}>
|
|
122
|
+
<strong>{t(titleKey)}</strong>
|
|
123
|
+
{/* ... */}
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
From the componentβs perspective:
|
|
130
|
+
|
|
131
|
+
- It doesnβt know the language
|
|
132
|
+
- It doesnβt know the string content
|
|
133
|
+
- It only knows **βI am an alert with `intent='success'`β**
|
|
134
|
+
|
|
135
|
+
And that **intent** is mapped to a key like `status.success`,
|
|
136
|
+
|
|
137
|
+
which resolves, via resources, to the actual text.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## π§© Put it all together
|
|
142
|
+
|
|
143
|
+
We essentially have:
|
|
144
|
+
|
|
145
|
+
1. **Raw translations (resources)**
|
|
146
|
+
- JSON per language
|
|
147
|
+
- Strings only
|
|
148
|
+
2. **Meaningful keys / namespaces**
|
|
149
|
+
- `common.actions.save`
|
|
150
|
+
- `status.success`
|
|
151
|
+
- `profile.messages.updated`
|
|
152
|
+
3. **Component-facing API (intent / usage)**
|
|
153
|
+
- Components call `t(key)`
|
|
154
|
+
- Or even higher-level things like `getAlertCopy('success')`
|
|
155
|
+
|
|
156
|
+
No one doing UI work should touch the raw strings directly anymore.
|
|
157
|
+
|
|
158
|
+
They work with **keys and intent**.
|
|
159
|
+
|
|
160
|
+
> resources = raw values, keys = semantic meaning, `t()` calls = component intent.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# πΏ Unholy Design Tokens - A Practical Guide to Design Tokens (Without the Fluff)
|
|
2
|
+
|
|
3
|
+
<img width="2550" height="920" alt="MacBook Pro 16_ - 6" src="https://github.com/user-attachments/assets/03a1b857-0881-4ad9-b14e-4480b5e181ad" />
|
|
4
|
+
|
|
5
|
+
See [Figma](https://www.figma.com/design/ALxCJnoWLP4kBiYr59tHqG/useSimpleDesignTokens?node-id=1-5537&t=perH3yNxowfIDyWu-1)
|
|
6
|
+
|
|
7
|
+
_A brutally clear, developer-friendly design token system using Style Dictionary._
|
|
8
|
+
|
|
9
|
+
This project is a playground to try to simplify the concept of design tokens and provide a practical framework for implementing and customize them using Style Dictionary.
|
|
10
|
+
|
|
11
|
+
## π Understanding Design Tokens through a House
|
|
12
|
+
|
|
13
|
+
To represent the concept of design tokens, you can use the following analogies:
|
|
14
|
+
|
|
15
|
+
β [**House-Building Analogy** (practical approach)](ANALOGY_HOUSE.md)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Goals:
|
|
20
|
+
|
|
21
|
+
- Avoid abstraction and provide a short and practical definition of design tokens.
|
|
22
|
+
- Propose a clear structure for organizing design tokens.
|
|
23
|
+
- Clarify **_who owns what_** between **Designers** and **Developers** regarding token levels
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## π Repository Structure
|
|
28
|
+
|
|
29
|
+
```graphql
|
|
30
|
+
/
|
|
31
|
+
ββ README.md β you're here
|
|
32
|
+
ββ ANALOGY_HOUSE.md β build a house analogy for design tokens
|
|
33
|
+
ββ ANALOGY_I18NEXT.md β analogy applied to translations
|
|
34
|
+
ββ WHY_THIS_EXISTS.md β motivation behind the repo
|
|
35
|
+
β
|
|
36
|
+
ββ src/
|
|
37
|
+
ββ tokens/
|
|
38
|
+
ββ README.md β token system overview
|
|
39
|
+
ββ 1-primitives/ β raw values (colors, spacingβ¦)
|
|
40
|
+
ββ 2-semantic/ β meaningful roles
|
|
41
|
+
ββ 3-intent/ β purpose/state
|
|
42
|
+
ββ 4-cube/ β layout primitives
|
|
43
|
+
ββ component/ β per-component token mapping
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## π Token source
|
|
48
|
+
|
|
49
|
+
Tokens live here:
|
|
50
|
+
π [`src/tokens`](./src/tokens)
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## π Explanations
|
|
55
|
+
|
|
56
|
+
- β Why this repo exists β [`WHY_THIS_EXISTS.md`](WHY_THIS_EXISTS.md)
|
|
57
|
+
- βοΈ Style Dictionary pipeline β [`STYLE_DICTIONARY.md`](STYLE_DICTIONARY.md)
|
|
58
|
+
- i18n analogy β [`ANALOGY_I18NEXT.md`](ANALOGY_I18NEXT.md)
|
|
59
|
+
- π House-building analogy β [`ANALOGY_HOUSE.md`](ANALOGY_HOUSE.md)
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Use the package
|
|
64
|
+
|
|
65
|
+
### A) Local dev (TS, no install)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pnpm exec tsx bin/build-tokens.ts ../../lib
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### B) Local project (compiled CLI)
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pnpm exec build-tokens ../../lib
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### C) As a dependency in another repo
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pnpm add style-dictionary-example-complete
|
|
83
|
+
pnpm exec build-tokens ./tokens
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### D) One-off usage
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npx style-dictionary-example-complete ./tokens
|
|
90
|
+
```
|