@graphprotocol/gds-css 0.0.1 → 0.1.1
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/LICENSE +21 -0
- package/README.md +2 -4
- package/package.json +9 -24
- package/styles/global.css +27 -10
- package/styles/theme.css +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Edge & Node
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -12,9 +12,9 @@ pnpm add @graphprotocol/gds-css
|
|
|
12
12
|
|
|
13
13
|
## Setup
|
|
14
14
|
|
|
15
|
-
1. [
|
|
15
|
+
1. Ensure [Tailwind CSS is installed and configured](https://tailwindcss.com/docs/installation) in your project (preferably with Vite).
|
|
16
16
|
|
|
17
|
-
2.
|
|
17
|
+
2. Replace the `tailwind` import in your main CSS file with `@graphprotocol/gds-css` and register the Tailwind plugin:
|
|
18
18
|
|
|
19
19
|
```diff
|
|
20
20
|
- @import 'tailwindcss';
|
|
@@ -22,8 +22,6 @@ pnpm add @graphprotocol/gds-css
|
|
|
22
22
|
+ @plugin '@graphprotocol/gds-css/tailwind-plugin';
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Tailwind is already imported by `@graphprotocol/gds-css`, so you don't need the `@import 'tailwindcss'` line.
|
|
26
|
-
|
|
27
25
|
3. [Register source paths](https://tailwindcss.com/docs/detecting-classes-in-source-files#explicitly-registering-sources) relative to your CSS file:
|
|
28
26
|
|
|
29
27
|
```diff
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphprotocol/gds-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Tailwind preset and design tokens for The Graph Design System",
|
|
5
5
|
"author": "Edge & Node and contributors",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/graphprotocol/gds.git",
|
|
9
|
+
"url": "git+https://github.com/graphprotocol/gds.git",
|
|
10
10
|
"directory": "packages/css"
|
|
11
11
|
},
|
|
12
12
|
"homepage": "https://github.com/graphprotocol/gds/tree/main/packages/css",
|
|
@@ -16,24 +16,10 @@
|
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
18
|
"style": "./styles/tailwind.css",
|
|
19
|
-
"
|
|
20
|
-
"default": "./src/index.ts"
|
|
19
|
+
"default": "./dist/index.js"
|
|
21
20
|
},
|
|
22
21
|
"./tailwind.css": "./styles/tailwind.css",
|
|
23
|
-
"./tailwind-plugin":
|
|
24
|
-
"typecheck": "./dist/tailwind-plugin.d.ts",
|
|
25
|
-
"default": "./src/tailwind-plugin.ts"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"publishConfig": {
|
|
29
|
-
"exports": {
|
|
30
|
-
".": {
|
|
31
|
-
"style": "./styles/tailwind.css",
|
|
32
|
-
"default": "./dist/index.js"
|
|
33
|
-
},
|
|
34
|
-
"./tailwind.css": "./styles/tailwind.css",
|
|
35
|
-
"./tailwind-plugin": "./dist/tailwind-plugin.js"
|
|
36
|
-
}
|
|
22
|
+
"./tailwind-plugin": "./dist/tailwind-plugin.js"
|
|
37
23
|
},
|
|
38
24
|
"files": [
|
|
39
25
|
"styles",
|
|
@@ -46,20 +32,19 @@
|
|
|
46
32
|
"tailwindcss": "^4.1.14"
|
|
47
33
|
},
|
|
48
34
|
"dependencies": {
|
|
49
|
-
"@graphprotocol/gds-utils": "workspace:*",
|
|
50
|
-
"@graphprotocol/tailwindcss-animate": "workspace:*",
|
|
51
35
|
"cssesc": "^3.0.0",
|
|
52
|
-
"ts-extras": "^0.16.0"
|
|
36
|
+
"ts-extras": "^0.16.0",
|
|
37
|
+
"@graphprotocol/gds-utils": "0.1.0",
|
|
38
|
+
"@graphprotocol/tailwindcss-animate": "0.1.1"
|
|
53
39
|
},
|
|
54
40
|
"devDependencies": {
|
|
55
41
|
"@types/cssesc": "^3.0.2",
|
|
56
|
-
"@types/node": "^24.10.
|
|
42
|
+
"@types/node": "^24.10.4"
|
|
57
43
|
},
|
|
58
44
|
"scripts": {
|
|
59
|
-
"prepare": "pnpm generate:design-tokens",
|
|
60
45
|
"generate:design-tokens": "tsx scripts/generate-design-tokens.ts",
|
|
61
46
|
"build": "tsc --build tsconfig.build.json",
|
|
62
47
|
"test": "vitest run",
|
|
63
48
|
"test:watch": "vitest"
|
|
64
49
|
}
|
|
65
|
-
}
|
|
50
|
+
}
|
package/styles/global.css
CHANGED
|
@@ -58,21 +58,22 @@
|
|
|
58
58
|
* Better defaults for outlines.
|
|
59
59
|
* - `outline-0` makes them work like borders, which are reset similarly in Preflight
|
|
60
60
|
* (https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/preflight.css#L15)
|
|
61
|
-
* - `outline-offset-1` and `outline-
|
|
62
|
-
* Because `transition` includes `outline-color`, only applying `outline-
|
|
63
|
-
* an unexpected color transition (from `auto` to `focus`) when the indicator appears. And if a consumer actually
|
|
64
|
-
* the focus indicator's color (
|
|
65
|
-
* on `:focus-visible` would make the outline "jump" when it appears or disappears,
|
|
61
|
+
* - `outline-offset-1` and `outline-focus` are in case a `transition` is used on an element with a focus indicator.
|
|
62
|
+
* Because `transition` includes `outline-color`, only applying `outline-focus` on `:focus-visible` would result in
|
|
63
|
+
* an unexpected color transition (from `auto` to `focus`) when the indicator appears. And if a consumer actually
|
|
64
|
+
* wants to transition the focus indicator's color (e.g. `outline transition not-focus-visible:outline-transparent`),
|
|
65
|
+
* only applying `outline-offset-1` on `:focus-visible` would make the outline "jump" when it appears or disappears,
|
|
66
|
+
* since the default offset is 0.
|
|
66
67
|
*/
|
|
67
|
-
@apply outline-0 outline-offset-1 outline-
|
|
68
|
+
@apply outline-0 outline-offset-1 outline-focus;
|
|
68
69
|
/**
|
|
69
70
|
* Default focus indicator.
|
|
70
|
-
* Technically, we shouldn't have to repeat the `outline-offset-1 outline-
|
|
71
|
-
* where resetting the `outline-style` and/or `outline-width` (maybe just when done in a state like `:focus-visible`)
|
|
72
|
-
* the `outline-color`, so better be safe than sorry. TODO: Investigate
|
|
71
|
+
* Technically, we shouldn't have to repeat the `outline-offset-1 outline-focus` from above, but Firefox has a bug
|
|
72
|
+
* where resetting the `outline-style` and/or `outline-width` (maybe just when done in a state like `:focus-visible`)
|
|
73
|
+
* also resets the `outline-color`, so better be safe than sorry. TODO: Investigate and report the bug.
|
|
73
74
|
*/
|
|
74
75
|
&:focus-visible {
|
|
75
|
-
@apply outline outline-offset-1 outline-
|
|
76
|
+
@apply outline outline-offset-1 outline-focus;
|
|
76
77
|
}
|
|
77
78
|
/* Prevent accidental animations (e.g. `text-20 sm:text-24 duration-200`) */
|
|
78
79
|
@apply transition-none;
|
|
@@ -201,3 +202,19 @@
|
|
|
201
202
|
inherits: false;
|
|
202
203
|
initial-value: 0;
|
|
203
204
|
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Restrict the transition of particular properties (e.g. `width`) to specific state changes, e.g. when toggling between
|
|
208
|
+
* idle and hover, but not when a prop changes. See how it's used in the `Search` component, and the CSS proposal that
|
|
209
|
+
* would make this hacky workaround obsolete: https://github.com/w3c/csswg-drafts/issues/13224.
|
|
210
|
+
*/
|
|
211
|
+
@keyframes width-1 {
|
|
212
|
+
100% {
|
|
213
|
+
width: revert-layer;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
@keyframes width-2 {
|
|
217
|
+
100% {
|
|
218
|
+
width: revert-layer;
|
|
219
|
+
}
|
|
220
|
+
}
|
package/styles/theme.css
CHANGED
|
@@ -167,6 +167,8 @@
|
|
|
167
167
|
|
|
168
168
|
/* Border colors */
|
|
169
169
|
--border-color-focus: var(--color-brand-500);
|
|
170
|
+
--outline-color-focus: var(--color-brand-500);
|
|
171
|
+
|
|
170
172
|
--border-color-subtle: light-dark(var(--color-foam-300), var(--color-space-1500));
|
|
171
173
|
--border-color-muted: light-dark(var(--color-foam-400), var(--color-space-1400));
|
|
172
174
|
--border-color-default: light-dark(var(--color-foam-500), var(--color-space-1300));
|