@times-design-system/theme-css 2.1.0 → 2.2.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.
Files changed (3) hide show
  1. package/README.md +63 -92
  2. package/dist/variables.css +455 -355
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -5,7 +5,7 @@ Times Design System CSS theme package with 2,748+ pre-compiled CSS custom proper
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install @times-design-system/theme-css
8
+ yarn add @times-design-system/theme-css
9
9
  ```
10
10
 
11
11
  ## Usage
@@ -18,50 +18,47 @@ npm install @times-design-system/theme-css
18
18
  rel="stylesheet"
19
19
  href="node_modules/@times-design-system/theme-css/variables.css"
20
20
  />
21
+
22
+ <!-- Via CDN with cachable version reference -->
23
+ <link
24
+ rel="stylesheet"
25
+ href="https://unpkg.com/@times-design-system/theme-css@[VERSION_NUMBER]/dist/variables.css"
26
+ />
21
27
  ```
22
28
 
23
29
  ### Use CSS Variables in Your Stylesheet
24
30
 
25
31
  ```css
26
- /* Color tokens */
32
+ /* Color tokens - prescoped within media queries for both mode (light/dark) and theme (e.g. [data-theme="sport"])*/
27
33
  body {
28
- background-color: var(--tds-surface-canvas);
29
- color: var(--tds-text-primary);
34
+ background-color: var(surface-canvas);
35
+ color: var(text-primary);
30
36
  }
31
37
 
32
38
  /* Spacing tokens */
33
39
  .component {
34
- padding: var(--tds-spacing-100);
35
- margin: var(--tds-spacing-050);
36
- gap: var(--tds-spacing-200);
37
- }
38
-
39
- /* Typography */
40
- h1 {
41
- font-size: var(--tds-font-size-100);
42
- line-height: var(--tds-line-height-heading);
43
- letter-spacing: var(--tds-letter-spacing-tight);
44
- }
45
-
46
- /* Dark mode with light-dark() */
47
- .card {
48
- background: light-dark(
49
- var(--tds-surface-level-1),
50
- var(--tds-surface-level-1-dark)
51
- );
52
- border-color: light-dark(
53
- var(--tds-border-primary),
54
- var(--tds-border-primary-dark)
55
- );
40
+ padding: var(spacing-100);
41
+ margin: var(spacing-050);
42
+ gap: var(spacing-200);
56
43
  }
57
44
 
58
45
  /* Shadows/Elevation */
59
46
  .elevated {
60
- box-shadow: var(--tds-elevation-100);
47
+ box-shadow: var(elevation-100);
61
48
  }
62
49
  ```
63
50
 
64
- ### Import in JavaScript
51
+ ### Use Typographic classes in markup
52
+
53
+ ```js
54
+ /* Typography */
55
+ /* Typographic styling should be adopted through typographic classes */
56
+ <h1 className="brand-heading-fluid-bold-xlarge">Styled Heading</h1>
57
+
58
+ <Text typographyStyle="brand-heading-fluid-bold-xlarge">Styled Text Component</Text>
59
+ ```
60
+
61
+ ### Alternative Import in JavaScript
65
62
 
66
63
  ```javascript
67
64
  // If bundling CSS
@@ -69,7 +66,7 @@ import '@times-design-system/theme-css/variables.css';
69
66
 
70
67
  // Then use in JS
71
68
  const element = document.querySelector('.component');
72
- const spacing = getComputedStyle(element).getPropertyValue('--tds-spacing-100');
69
+ const spacing = getComputedStyle(element).getPropertyValue('spacing-100');
73
70
  ```
74
71
 
75
72
  ## Package Contents
@@ -87,88 +84,62 @@ All semantic and brand colors:
87
84
 
88
85
  ```css
89
86
  /* Semantic colors */
90
- --tds-text-primary
91
- --tds-text-secondary
92
- --tds-text-tertiary
93
- --tds-surface-canvas
94
- --tds-surface-level-1
95
- --tds-surface-level-2
96
- --tds-border-primary
97
- --tds-border-secondary
87
+ text-primary
88
+ text-secondary
89
+ text-tertiary
90
+ surface-canvas
91
+ surface-level-1
92
+ surface-level-2
93
+ border-primary
94
+ border-secondary
98
95
 
99
96
  /* Brand/Channel colors (e.g.) */
100
- --tds-brand-home-500
101
- --tds-brand-business-500
102
- --tds-channel-sport-500
103
- --tds-channel-money-500
97
+ brand-home-500
98
+ brand-business-500
99
+ channel-sport-500
100
+ channel-money-500
104
101
  ```
105
102
 
106
103
  ### Spacing Tokens
107
104
 
108
105
  ```css
109
- --tds-spacing-025 /* 0.25rem */
110
- --tds-spacing-050 /* 0.5rem */
111
- --tds-spacing-100 /* 1rem */
112
- --tds-spacing-200 /* 1.5rem */
113
- --tds-spacing-300 /* 2rem */
114
- --tds-spacing-400 /* 2.5rem */
106
+ spacing-025 /* 0.25rem */
107
+ spacing-050 /* 0.5rem */
108
+ spacing-100 /* 1rem */
109
+ spacing-200 /* 1.5rem */
110
+ spacing-300 /* 2rem */
111
+ spacing-400 /* 2.5rem */
115
112
  ```
116
113
 
117
114
  ### Typography Tokens
118
115
 
119
116
  ```css
120
- --tds-font-size-025 /* 0.75rem */
121
- --tds-font-size-050 /* 1rem */
122
- --tds-font-size-100 /* 2.25rem */
123
- --tds-font-family-sans
124
- --tds-font-family-serif
125
- --tds-font-weight-regular /* 400 */
126
- --tds-font-weight-bold /* 700 */
127
- --tds-line-height-tight
128
- --tds-line-height-normal
129
- --tds-letter-spacing-tight
117
+ font-size-025 /* 0.75rem */
118
+ font-size-050 /* 1rem */
119
+ font-size-100 /* 2.25rem */
120
+ font-family-sans
121
+ font-family-serif
122
+ font-weight-regular /* 400 */
123
+ font-weight-bold /* 700 */
124
+ line-height-tight
125
+ line-height-normal
126
+ letter-spacing-tight
130
127
  ```
131
128
 
132
129
  ### Other Tokens
133
130
 
134
131
  ```css
135
- --tds-radius-100 /* Border radius */
136
- --tds-radius-200
137
- --tds-elevation-100 /* Box shadows */
138
- --tds-elevation-200
139
- --tds-transition-normal
140
- --tds-transition-smooth
141
- ```
142
-
143
- ## Dark Mode
144
-
145
- All tokens support light and dark variants through CSS variable naming. Use with `light-dark()` for automatic switching:
146
-
147
- ```css
148
- :root {
149
- color-scheme: light dark;
150
- }
151
-
152
- body {
153
- color: light-dark(var(--tds-text-primary), var(--tds-text-primary-dark));
154
- background: light-dark(
155
- var(--tds-surface-canvas),
156
- var(--tds-surface-canvas-dark)
157
- );
158
- }
159
-
160
- @media (prefers-color-scheme: dark) {
161
- :root {
162
- --tds-text-primary: #ffffff;
163
- --tds-surface-canvas: #000000;
164
- /* ... */
165
- }
166
- }
132
+ radius-100 /* Border radius */
133
+ radius-200
134
+ elevation-100 /* Box shadows */
135
+ elevation-200
136
+ transition-normal
137
+ transition-smooth
167
138
  ```
168
139
 
169
140
  ## Browser Support
170
141
 
171
- - **Modern browsers**: Full support with `light-dark()` and CSS custom properties
142
+ - **Modern browsers**: Full support with scoped CSS
172
143
  - **All other modern browsers (Chrome, Firefox, Safari, Edge)**: CSS custom properties supported
173
144
  - **Fallback**: Provide fallback values for older browsers
174
145
 
@@ -177,7 +148,7 @@ body {
177
148
  /* Fallback for older browsers */
178
149
  padding: 1rem;
179
150
  /* Override if CSS variables supported */
180
- padding: var(--tds-spacing-100, 1rem);
151
+ padding: var(spacing-100, 1rem);
181
152
  }
182
153
  ```
183
154
 
@@ -198,7 +169,7 @@ body {
198
169
  To rebuild the package after modifying tokens:
199
170
 
200
171
  ```bash
201
- npm run build
172
+ yarn build
202
173
  ```
203
174
 
204
175
  ## License