@neovici/cosmoz-tokens 3.2.0 → 3.2.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 CHANGED
@@ -57,6 +57,43 @@ customElements.define(
57
57
  );
58
58
  ```
59
59
 
60
+ ### CSS Utilities
61
+
62
+ Reusable Lit CSS template literals for common styling patterns.
63
+
64
+ #### Skeuomorphic Highlight
65
+
66
+ Adds a subtle "lit from above" inner highlight effect to buttons using a `::before` pseudo-element with a gradient mask:
67
+
68
+ ```js
69
+ import { skeumorphicHighlight } from '@neovici/cosmoz-tokens/skeumorphic';
70
+
71
+ const styles = css`
72
+ .button {
73
+ ${skeumorphicHighlight}
74
+ }
75
+ `;
76
+ ```
77
+
78
+ Customization via CSS custom properties:
79
+
80
+ - `--skeumorphic-color`: Border color (default: `rgba(255, 255, 255, 0.12)`)
81
+ - `--skeumorphic-radius`: Inner border radius (default: `calc(var(--cz-radius-md) - 1px)`)
82
+
83
+ #### Truncate
84
+
85
+ Truncate text with ellipsis (equivalent to Tailwind's `truncate`):
86
+
87
+ ```js
88
+ import { truncate } from '@neovici/cosmoz-tokens/truncate';
89
+
90
+ const styles = css`
91
+ .label {
92
+ ${truncate}
93
+ }
94
+ `;
95
+ ```
96
+
60
97
  ## Dark Mode
61
98
 
62
99
  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.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "Design tokens for Cosmoz web components based on Untitled UI",
5
5
  "keywords": [
6
6
  "design-tokens",
@@ -2,24 +2,65 @@
2
2
  * Cosmoz Design Tokens - Normalize
3
3
  * Re-usable normalize stylesheet for web component shadow DOMs.
4
4
  * Based on Tailwind's preflight.css, adapted for shadow DOM usage.
5
+ *
6
+ * Note: We intentionally avoid resetting margin/padding/border on * selector
7
+ * to prevent conflicts with child web components whose :host styles would
8
+ * be overridden by the parent's * selector.
5
9
  */
6
10
 
7
11
  import { css, sheet } from '@pionjs/pion';
8
12
 
9
13
  export const normalize = sheet(css`
10
14
  /*
11
- * 1. Prevent padding and border from affecting element width.
12
- * 2. Remove default margins and padding.
13
- * 3. Reset all borders.
15
+ * Use border-box sizing for all elements.
16
+ * This is safe and doesn't conflict with child component styles.
14
17
  */
15
18
  *,
16
- ::after,
17
19
  ::before,
20
+ ::after,
18
21
  ::backdrop,
19
22
  ::file-selector-button {
20
23
  box-sizing: border-box;
24
+ }
25
+
26
+ /*
27
+ * Reset margins and padding on elements that typically have browser defaults.
28
+ * This is more targeted than using * to avoid affecting custom elements.
29
+ */
30
+ h1,
31
+ h2,
32
+ h3,
33
+ h4,
34
+ h5,
35
+ h6,
36
+ p,
37
+ blockquote,
38
+ pre,
39
+ ul,
40
+ ol,
41
+ li,
42
+ dl,
43
+ dt,
44
+ dd,
45
+ figure,
46
+ figcaption,
47
+ fieldset,
48
+ legend,
49
+ form,
50
+ hr,
51
+ table,
52
+ th,
53
+ td {
21
54
  margin: 0;
22
55
  padding: 0;
56
+ }
57
+
58
+ /*
59
+ * Reset borders on elements that typically have them.
60
+ */
61
+ fieldset,
62
+ hr,
63
+ iframe {
23
64
  border: 0 solid;
24
65
  }
25
66
 
@@ -118,9 +159,11 @@ export const normalize = sheet(css`
118
159
  }
119
160
 
120
161
  /*
162
+ * Reset form controls:
121
163
  * 1. Inherit font styles in all browsers.
122
- * 2. Remove border radius.
123
- * 3. Remove background color.
164
+ * 2. Remove default margins, padding, and borders.
165
+ * 3. Remove border radius.
166
+ * 4. Remove background color.
124
167
  */
125
168
  button,
126
169
  input,
@@ -128,6 +171,9 @@ export const normalize = sheet(css`
128
171
  optgroup,
129
172
  textarea,
130
173
  ::file-selector-button {
174
+ margin: 0;
175
+ padding: 0;
176
+ border: 0 solid;
131
177
  font: inherit;
132
178
  font-feature-settings: inherit;
133
179
  font-variation-settings: inherit;