@neovici/cosmoz-tokens 1.2.0 → 2.0.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/README.md +0 -37
- package/package.json +1 -5
- package/src/utilities.css.d.ts +0 -18
- package/src/utilities.css.js +0 -118
package/README.md
CHANGED
|
@@ -57,43 +57,6 @@ customElements.define(
|
|
|
57
57
|
);
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
### Using utilities in web components
|
|
61
|
-
|
|
62
|
-
The utilities stylesheet provides **layout primitives** as a `CSSStyleSheet` for use with Shadow DOM:
|
|
63
|
-
|
|
64
|
-
> **Philosophy:** This is intentionally a minimal set. Web components have scoped CSS,
|
|
65
|
-
> so you don't need utility classes for everything. Use CSS custom properties
|
|
66
|
-
> (tokens) directly in your component styles for margins, padding, colors, etc.
|
|
67
|
-
|
|
68
|
-
```js
|
|
69
|
-
import { component } from '@pionjs/pion';
|
|
70
|
-
import { normalize } from '@neovici/cosmoz-tokens/normalize';
|
|
71
|
-
import { utilities } from '@neovici/cosmoz-tokens/utilities';
|
|
72
|
-
import { style } from './my-component.css.js';
|
|
73
|
-
|
|
74
|
-
const MyComponent = () => {
|
|
75
|
-
return html`<div class="flex items-center gap-4">Hello World</div>`;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
customElements.define(
|
|
79
|
-
'my-component',
|
|
80
|
-
component(MyComponent, {
|
|
81
|
-
styleSheets: [normalize, utilities, style],
|
|
82
|
-
}),
|
|
83
|
-
);
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
Available utility classes:
|
|
87
|
-
|
|
88
|
-
| Category | Classes |
|
|
89
|
-
| -------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
90
|
-
| Flexbox | `flex`, `flex-col`, `flex-wrap`, `items-center`, `items-start`, `items-end`, `justify-center`, `justify-between`, `justify-end` |
|
|
91
|
-
| Gap | `gap-0`, `gap-1`, `gap-2`, `gap-3`, `gap-4`, `gap-5`, `gap-6`, `gap-8` |
|
|
92
|
-
| Display | `hidden`, `block`, `grid` |
|
|
93
|
-
| Sizing | `w-full`, `h-full` |
|
|
94
|
-
| Position | `relative`, `absolute` |
|
|
95
|
-
| Text | `truncate` |
|
|
96
|
-
|
|
97
60
|
## Dark Mode
|
|
98
61
|
|
|
99
62
|
Semantic tokens automatically adapt to dark mode. Enable it by adding a class or data attribute to the root element:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neovici/cosmoz-tokens",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Design tokens for Cosmoz web components based on Untitled UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design-tokens",
|
|
@@ -26,10 +26,6 @@
|
|
|
26
26
|
"types": "./src/normalize.css.d.ts",
|
|
27
27
|
"default": "./src/normalize.css.js"
|
|
28
28
|
},
|
|
29
|
-
"./utilities": {
|
|
30
|
-
"types": "./src/utilities.css.d.ts",
|
|
31
|
-
"default": "./src/utilities.css.js"
|
|
32
|
-
},
|
|
33
29
|
"./primitives": "./src/primitives.css",
|
|
34
30
|
"./typography": "./src/typography.css",
|
|
35
31
|
"./spacing": "./src/spacing.css",
|
package/src/utilities.css.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Raw CSS string for utilities - can be used in Light DOM contexts.
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* import { utilitiesCSS } from '@neovici/cosmoz-tokens/utilities';
|
|
6
|
-
* html`<style>${utilitiesCSS}</style>`;
|
|
7
|
-
*/
|
|
8
|
-
export const utilitiesCSS: string;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Utilities stylesheet as a CSSStyleSheet for Shadow DOM usage.
|
|
12
|
-
* Use with the `styleSheets` option in @pionjs/pion components.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* import { utilities } from '@neovici/cosmoz-tokens/utilities';
|
|
16
|
-
* customElements.define('my-el', component(MyEl, { styleSheets: [utilities] }));
|
|
17
|
-
*/
|
|
18
|
-
export const utilities: CSSStyleSheet;
|
package/src/utilities.css.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cosmoz Design Tokens - Utilities
|
|
3
|
-
*
|
|
4
|
-
* Minimal layout primitives for web component shadow DOMs.
|
|
5
|
-
* Uses --cz-spacing for consistent spacing scale.
|
|
6
|
-
*
|
|
7
|
-
* Philosophy: This is intentionally a minimal set. Web components have scoped CSS,
|
|
8
|
-
* so you don't need utility classes for everything. Use CSS custom properties
|
|
9
|
-
* (tokens) directly in your component styles for margins, padding, colors, etc.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { css, sheet } from '@pionjs/pion';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Raw CSS for utilities - can be used in Light DOM contexts
|
|
16
|
-
* @example
|
|
17
|
-
* import { utilitiesCSS } from '@neovici/cosmoz-tokens/utilities';
|
|
18
|
-
* html`<style>${utilitiesCSS}</style>`;
|
|
19
|
-
*/
|
|
20
|
-
export const utilitiesCSS = css`
|
|
21
|
-
/* Flexbox */
|
|
22
|
-
.flex {
|
|
23
|
-
display: flex;
|
|
24
|
-
}
|
|
25
|
-
.flex-col {
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-direction: column;
|
|
28
|
-
}
|
|
29
|
-
.flex-wrap {
|
|
30
|
-
flex-wrap: wrap;
|
|
31
|
-
}
|
|
32
|
-
.items-center {
|
|
33
|
-
align-items: center;
|
|
34
|
-
}
|
|
35
|
-
.items-start {
|
|
36
|
-
align-items: flex-start;
|
|
37
|
-
}
|
|
38
|
-
.items-end {
|
|
39
|
-
align-items: flex-end;
|
|
40
|
-
}
|
|
41
|
-
.justify-center {
|
|
42
|
-
justify-content: center;
|
|
43
|
-
}
|
|
44
|
-
.justify-between {
|
|
45
|
-
justify-content: space-between;
|
|
46
|
-
}
|
|
47
|
-
.justify-end {
|
|
48
|
-
justify-content: flex-end;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* Gap (using --cz-spacing: 4px) */
|
|
52
|
-
.gap-0 {
|
|
53
|
-
gap: 0;
|
|
54
|
-
}
|
|
55
|
-
.gap-1 {
|
|
56
|
-
gap: calc(var(--cz-spacing) * 1);
|
|
57
|
-
}
|
|
58
|
-
.gap-2 {
|
|
59
|
-
gap: calc(var(--cz-spacing) * 2);
|
|
60
|
-
}
|
|
61
|
-
.gap-3 {
|
|
62
|
-
gap: calc(var(--cz-spacing) * 3);
|
|
63
|
-
}
|
|
64
|
-
.gap-4 {
|
|
65
|
-
gap: calc(var(--cz-spacing) * 4);
|
|
66
|
-
}
|
|
67
|
-
.gap-5 {
|
|
68
|
-
gap: calc(var(--cz-spacing) * 5);
|
|
69
|
-
}
|
|
70
|
-
.gap-6 {
|
|
71
|
-
gap: calc(var(--cz-spacing) * 6);
|
|
72
|
-
}
|
|
73
|
-
.gap-8 {
|
|
74
|
-
gap: calc(var(--cz-spacing) * 8);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/* Display */
|
|
78
|
-
.hidden {
|
|
79
|
-
display: none;
|
|
80
|
-
}
|
|
81
|
-
.block {
|
|
82
|
-
display: block;
|
|
83
|
-
}
|
|
84
|
-
.grid {
|
|
85
|
-
display: grid;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/* Sizing */
|
|
89
|
-
.w-full {
|
|
90
|
-
width: 100%;
|
|
91
|
-
}
|
|
92
|
-
.h-full {
|
|
93
|
-
height: 100%;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/* Position */
|
|
97
|
-
.relative {
|
|
98
|
-
position: relative;
|
|
99
|
-
}
|
|
100
|
-
.absolute {
|
|
101
|
-
position: absolute;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/* Text */
|
|
105
|
-
.truncate {
|
|
106
|
-
overflow: hidden;
|
|
107
|
-
text-overflow: ellipsis;
|
|
108
|
-
white-space: nowrap;
|
|
109
|
-
}
|
|
110
|
-
`;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* CSSStyleSheet for utilities - use with Shadow DOM components
|
|
114
|
-
* @example
|
|
115
|
-
* import { utilities } from '@neovici/cosmoz-tokens/utilities';
|
|
116
|
-
* customElements.define('my-el', component(MyEl, { styleSheets: [utilities] }));
|
|
117
|
-
*/
|
|
118
|
-
export const utilities = sheet(utilitiesCSS);
|