@times-design-system/theme-scss 2.8.0 → 2.9.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 (43) hide show
  1. package/dist/palettes/business-dark.scss +332 -330
  2. package/dist/palettes/business-light.scss +332 -330
  3. package/dist/palettes/comment-dark.scss +332 -330
  4. package/dist/palettes/comment-light.scss +332 -330
  5. package/dist/palettes/core-dark.scss +332 -330
  6. package/dist/palettes/core-light.scss +332 -330
  7. package/dist/palettes/culture-dark.scss +332 -330
  8. package/dist/palettes/culture-light.scss +332 -330
  9. package/dist/palettes/foundation-light.scss +3 -0
  10. package/dist/palettes/home-dark.scss +332 -330
  11. package/dist/palettes/home-light.scss +332 -330
  12. package/dist/palettes/ireland-dark.scss +332 -330
  13. package/dist/palettes/ireland-light.scss +332 -330
  14. package/dist/palettes/lifeAndStyle-dark.scss +332 -330
  15. package/dist/palettes/lifeAndStyle-light.scss +332 -330
  16. package/dist/palettes/magazineLuxx-dark.scss +332 -330
  17. package/dist/palettes/magazineLuxx-light.scss +332 -330
  18. package/dist/palettes/magazineSundayTimes-dark.scss +332 -330
  19. package/dist/palettes/magazineSundayTimes-light.scss +332 -330
  20. package/dist/palettes/magazineTimes-dark.scss +332 -330
  21. package/dist/palettes/magazineTimes-light.scss +332 -330
  22. package/dist/palettes/money-dark.scss +332 -330
  23. package/dist/palettes/money-light.scss +332 -330
  24. package/dist/palettes/obituaries-dark.scss +332 -330
  25. package/dist/palettes/obituaries-light.scss +332 -330
  26. package/dist/palettes/puzzles-dark.scss +332 -330
  27. package/dist/palettes/puzzles-light.scss +332 -330
  28. package/dist/palettes/sport-dark.scss +332 -330
  29. package/dist/palettes/sport-light.scss +332 -330
  30. package/dist/palettes/timesEvents-dark.scss +332 -330
  31. package/dist/palettes/timesEvents-light.scss +332 -330
  32. package/dist/palettes/timesPlus-dark.scss +332 -330
  33. package/dist/palettes/timesPlus-light.scss +332 -330
  34. package/dist/palettes/timesRadio-dark.scss +44 -42
  35. package/dist/palettes/timesRadio-light.scss +44 -42
  36. package/dist/palettes/travel-dark.scss +332 -330
  37. package/dist/palettes/travel-light.scss +332 -330
  38. package/dist/palettes/uk-dark.scss +332 -330
  39. package/dist/palettes/uk-light.scss +332 -330
  40. package/dist/palettes/world-dark.scss +332 -330
  41. package/dist/palettes/world-light.scss +332 -330
  42. package/dist/theme-apply.scss +126 -256
  43. package/package.json +2 -2
@@ -1,6 +1,8 @@
1
- // Theme Apply Mixin
2
- // Generates all theme variants with palette-scoped values
3
- // Simple mixin approach: define blocks for each theme, each with its palette available
1
+ // Theme Apply Mixin (Refactored)
2
+ // Generates theme-scoped property values on-demand via mixin
3
+ // Only outputs selectors for properties you actually use (no DOM variable bloat)
4
+ // Dark mode is applied via [data-mode="dark"] attribute
5
+ // Theme variants use [data-theme="themeName"] attribute
4
6
 
5
7
  // Light mode palettes
6
8
  @use './palettes/core-light' as core;
@@ -46,336 +48,204 @@
46
48
  @use './palettes/timesEvents-dark' as timesEventsDark;
47
49
  @use './palettes/timesRadio-dark' as timesRadioDark;
48
50
 
49
- /// Main mixin that generates all theme variants (light and dark)
50
- /// Usage in blocks: @include themes.apply-theme() { ... }
51
- /// Within the content block, use: core.$token-name, sport.$token-name, etc.
52
- /// Or use the theme-specific helper mixins below
53
- /// Dark mode is applied via [data-mode="dark"] attribute
54
-
55
- @mixin apply-theme() {
51
+ /// Apply a single token value across all theme/mode combinations
52
+ /// Generates theme-scoped selectors on-demand for properties you actually use
53
+ ///
54
+ /// Usage examples:
55
+ /// @include theme-value('color', 'text-primary');
56
+ /// @include theme-value('background-color', 'surface-canvas');
57
+ /// @include theme-value('border-color', 'border-primary');
58
+ ///
59
+ /// Parameters:
60
+ /// $property: CSS property name (e.g., 'color', 'background-color', 'border-color')
61
+ /// $token-name: Token key from the palette map (without $tds- prefix or $ symbol)
62
+ /// Examples: 'text-primary', 'surface-canvas', 'border-primary', 'surface-level-1'
63
+ ///
64
+ /// Generated output spans all 19 themes × 2 modes (light + dark)
65
+ /// Example output from @include theme-value('color', 'text-primary');
66
+ /// .component { color: [core light value]; }
67
+ /// [data-mode="dark"] .component { color: [core dark value]; }
68
+ /// [data-theme="sport"] .component { color: [sport light value]; }
69
+ /// [data-theme="sport"][data-mode="dark"] .component { color: [sport dark value]; }
70
+ /// ... (etc for all themes)
71
+
72
+ @mixin theme-value($property, $token-name) {
56
73
  // Core theme (default) - light mode
57
- @include _apply-core-theme() { @content; }
74
+ #{$property}: map-get(core.$palette, $token-name);
58
75
 
59
76
  // Core theme - dark mode
60
- [data-mode="dark"] & { @include _apply-core-dark-theme() { @content; } }
77
+ [data-mode="dark"] & {
78
+ #{$property}: map-get(coreDark.$palette, $token-name);
79
+ }
61
80
 
62
81
  // Sport theme
63
82
  [data-theme="sport"] & {
64
- @include _apply-sport-theme() { @content; }
65
- &[data-mode="dark"] { @include _apply-sport-dark-theme() { @content; } }
83
+ #{$property}: map-get(sport.$palette, $token-name);
84
+
85
+ &[data-mode="dark"] {
86
+ #{$property}: map-get(sportDark.$palette, $token-name);
87
+ }
66
88
  }
67
89
 
68
90
  // Culture theme
69
91
  [data-theme="culture"] & {
70
- @include _apply-culture-theme() { @content; }
71
- &[data-mode="dark"] { @include _apply-culture-dark-theme() { @content; } }
92
+ #{$property}: map-get(culture.$palette, $token-name);
93
+
94
+ &[data-mode="dark"] {
95
+ #{$property}: map-get(cultureDark.$palette, $token-name);
96
+ }
72
97
  }
73
98
 
74
99
  // Comment theme
75
100
  [data-theme="comment"] & {
76
- @include _apply-comment-theme() { @content; }
77
- &[data-mode="dark"] { @include _apply-comment-dark-theme() { @content; } }
101
+ #{$property}: map-get(comment.$palette, $token-name);
102
+
103
+ &[data-mode="dark"] {
104
+ #{$property}: map-get(commentDark.$palette, $token-name);
105
+ }
78
106
  }
79
107
 
80
108
  // Home theme
81
109
  [data-theme="home"] & {
82
- @include _apply-home-theme() { @content; }
83
- &[data-mode="dark"] { @include _apply-home-dark-theme() { @content; } }
110
+ #{$property}: map-get(home.$palette, $token-name);
111
+
112
+ &[data-mode="dark"] {
113
+ #{$property}: map-get(homeDark.$palette, $token-name);
114
+ }
84
115
  }
85
116
 
86
117
  // Business theme
87
118
  [data-theme="business"] & {
88
- @include _apply-business-theme() { @content; }
89
- &[data-mode="dark"] { @include _apply-business-dark-theme() { @content; } }
119
+ #{$property}: map-get(business.$palette, $token-name);
120
+
121
+ &[data-mode="dark"] {
122
+ #{$property}: map-get(businessDark.$palette, $token-name);
123
+ }
90
124
  }
91
125
 
92
126
  // Travel theme
93
127
  [data-theme="travel"] & {
94
- @include _apply-travel-theme() { @content; }
95
- &[data-mode="dark"] { @include _apply-travel-dark-theme() { @content; } }
128
+ #{$property}: map-get(travel.$palette, $token-name);
129
+
130
+ &[data-mode="dark"] {
131
+ #{$property}: map-get(travelDark.$palette, $token-name);
132
+ }
96
133
  }
97
134
 
98
135
  // UK theme
99
136
  [data-theme="uk"] & {
100
- @include _apply-uk-theme() { @content; }
101
- &[data-mode="dark"] { @include _apply-uk-dark-theme() { @content; } }
137
+ #{$property}: map-get(uk.$palette, $token-name);
138
+
139
+ &[data-mode="dark"] {
140
+ #{$property}: map-get(ukDark.$palette, $token-name);
141
+ }
102
142
  }
103
143
 
104
144
  // World theme
105
145
  [data-theme="world"] & {
106
- @include _apply-world-theme() { @content; }
107
- &[data-mode="dark"] { @include _apply-world-dark-theme() { @content; } }
146
+ #{$property}: map-get(world.$palette, $token-name);
147
+
148
+ &[data-mode="dark"] {
149
+ #{$property}: map-get(worldDark.$palette, $token-name);
150
+ }
108
151
  }
109
152
 
110
153
  // Money theme
111
154
  [data-theme="money"] & {
112
- @include _apply-money-theme() { @content; }
113
- &[data-mode="dark"] { @include _apply-money-dark-theme() { @content; } }
155
+ #{$property}: map-get(money.$palette, $token-name);
156
+
157
+ &[data-mode="dark"] {
158
+ #{$property}: map-get(moneyDark.$palette, $token-name);
159
+ }
114
160
  }
115
161
 
116
162
  // Puzzles theme
117
163
  [data-theme="puzzles"] & {
118
- @include _apply-puzzles-theme() { @content; }
119
- &[data-mode="dark"] { @include _apply-puzzles-dark-theme() { @content; } }
164
+ #{$property}: map-get(puzzles.$palette, $token-name);
165
+
166
+ &[data-mode="dark"] {
167
+ #{$property}: map-get(puzzlesDark.$palette, $token-name);
168
+ }
120
169
  }
121
170
 
122
171
  // Life & Style theme
123
172
  [data-theme="lifeAndStyle"] & {
124
- @include _apply-lifeAndStyle-theme() { @content; }
125
- &[data-mode="dark"] { @include _apply-lifeAndStyle-dark-theme() { @content; } }
173
+ #{$property}: map-get(lifeAndStyle.$palette, $token-name);
174
+
175
+ &[data-mode="dark"] {
176
+ #{$property}: map-get(lifeAndStyleDark.$palette, $token-name);
177
+ }
126
178
  }
127
179
 
128
180
  // Obituaries theme
129
181
  [data-theme="obituaries"] & {
130
- @include _apply-obituaries-theme() { @content; }
131
- &[data-mode="dark"] { @include _apply-obituaries-dark-theme() { @content; } }
182
+ #{$property}: map-get(obituaries.$palette, $token-name);
183
+
184
+ &[data-mode="dark"] {
185
+ #{$property}: map-get(obituariesDark.$palette, $token-name);
186
+ }
132
187
  }
133
188
 
134
189
  // Ireland theme
135
190
  [data-theme="ireland"] & {
136
- @include _apply-ireland-theme() { @content; }
137
- &[data-mode="dark"] { @include _apply-ireland-dark-theme() { @content; } }
191
+ #{$property}: map-get(ireland.$palette, $token-name);
192
+
193
+ &[data-mode="dark"] {
194
+ #{$property}: map-get(irelandDark.$palette, $token-name);
195
+ }
138
196
  }
139
197
 
140
198
  // Magazine Luxx theme
141
199
  [data-theme="magazineLuxx"] & {
142
- @include _apply-magazineLuxx-theme() { @content; }
143
- &[data-mode="dark"] { @include _apply-magazineLuxx-dark-theme() { @content; } }
200
+ #{$property}: map-get(magazineLuxx.$palette, $token-name);
201
+
202
+ &[data-mode="dark"] {
203
+ #{$property}: map-get(magazineLuxxDark.$palette, $token-name);
204
+ }
144
205
  }
145
206
 
146
207
  // Magazine Sunday Times theme
147
208
  [data-theme="magazineSundayTimes"] & {
148
- @include _apply-magazineSundayTimes-theme() { @content; }
149
- &[data-mode="dark"] { @include _apply-magazineSundayTimes-dark-theme() { @content; } }
209
+ #{$property}: map-get(magazineSundayTimes.$palette, $token-name);
210
+
211
+ &[data-mode="dark"] {
212
+ #{$property}: map-get(magazineSundayTimesDark.$palette, $token-name);
213
+ }
150
214
  }
151
215
 
152
216
  // Magazine Times theme
153
217
  [data-theme="magazineTimes"] & {
154
- @include _apply-magazineTimes-theme() { @content; }
155
- &[data-mode="dark"] { @include _apply-magazineTimes-dark-theme() { @content; } }
218
+ #{$property}: map-get(magazineTimes.$palette, $token-name);
219
+
220
+ &[data-mode="dark"] {
221
+ #{$property}: map-get(magazineTimesDark.$palette, $token-name);
222
+ }
156
223
  }
157
224
 
158
225
  // Times+ theme
159
226
  [data-theme="timesPlus"] & {
160
- @include _apply-timesPlus-theme() { @content; }
161
- &[data-mode="dark"] { @include _apply-timesPlus-dark-theme() { @content; } }
227
+ #{$property}: map-get(timesPlus.$palette, $token-name);
228
+
229
+ &[data-mode="dark"] {
230
+ #{$property}: map-get(timesPlusDark.$palette, $token-name);
231
+ }
162
232
  }
163
233
 
164
234
  // Times Events theme
165
235
  [data-theme="timesEvents"] & {
166
- @include _apply-timesEvents-theme() { @content; }
167
- &[data-mode="dark"] { @include _apply-timesEvents-dark-theme() { @content; } }
236
+ #{$property}: map-get(timesEvents.$palette, $token-name);
237
+
238
+ &[data-mode="dark"] {
239
+ #{$property}: map-get(timesEventsDark.$palette, $token-name);
240
+ }
168
241
  }
169
242
 
170
243
  // Times Radio theme
171
244
  [data-theme="timesRadio"] & {
172
- @include _apply-timesRadio-theme() { @content; }
173
- &[data-mode="dark"] { @include _apply-timesRadio-dark-theme() { @content; } }
245
+ #{$property}: map-get(timesRadio.$palette, $token-name);
246
+
247
+ &[data-mode="dark"] {
248
+ #{$property}: map-get(timesRadioDark.$palette, $token-name);
249
+ }
174
250
  }
175
251
  }
176
-
177
- // Light mode theme-specific helper mixins
178
- // Each exposes its palette as a local variable for use in content blocks
179
-
180
- @mixin _apply-core-theme() {
181
- $palette: core \!default;
182
- @content;
183
- }
184
-
185
- @mixin _apply-sport-theme() {
186
- $palette: sport \!default;
187
- @content;
188
- }
189
-
190
- @mixin _apply-culture-theme() {
191
- $palette: culture \!default;
192
- @content;
193
- }
194
-
195
- @mixin _apply-comment-theme() {
196
- $palette: comment \!default;
197
- @content;
198
- }
199
-
200
- @mixin _apply-home-theme() {
201
- $palette: home \!default;
202
- @content;
203
- }
204
-
205
- @mixin _apply-business-theme() {
206
- $palette: business \!default;
207
- @content;
208
- }
209
-
210
- @mixin _apply-travel-theme() {
211
- $palette: travel \!default;
212
- @content;
213
- }
214
-
215
- @mixin _apply-uk-theme() {
216
- $palette: uk \!default;
217
- @content;
218
- }
219
-
220
- @mixin _apply-world-theme() {
221
- $palette: world \!default;
222
- @content;
223
- }
224
-
225
- @mixin _apply-money-theme() {
226
- $palette: money \!default;
227
- @content;
228
- }
229
-
230
- @mixin _apply-puzzles-theme() {
231
- $palette: puzzles \!default;
232
- @content;
233
- }
234
-
235
- @mixin _apply-lifeAndStyle-theme() {
236
- $palette: lifeAndStyle \!default;
237
- @content;
238
- }
239
-
240
- @mixin _apply-obituaries-theme() {
241
- $palette: obituaries \!default;
242
- @content;
243
- }
244
-
245
- @mixin _apply-ireland-theme() {
246
- $palette: ireland \!default;
247
- @content;
248
- }
249
-
250
- @mixin _apply-magazineLuxx-theme() {
251
- $palette: magazineLuxx \!default;
252
- @content;
253
- }
254
-
255
- @mixin _apply-magazineSundayTimes-theme() {
256
- $palette: magazineSundayTimes \!default;
257
- @content;
258
- }
259
-
260
- @mixin _apply-magazineTimes-theme() {
261
- $palette: magazineTimes \!default;
262
- @content;
263
- }
264
-
265
- @mixin _apply-timesPlus-theme() {
266
- $palette: timesPlus \!default;
267
- @content;
268
- }
269
-
270
- @mixin _apply-timesEvents-theme() {
271
- $palette: timesEvents \!default;
272
- @content;
273
- }
274
-
275
- @mixin _apply-timesRadio-theme() {
276
- $palette: timesRadio \!default;
277
- @content;
278
- }
279
-
280
- // Dark mode theme-specific helper mixins
281
- // Each exposes its dark palette as a local variable for use in content blocks
282
-
283
- @mixin _apply-core-dark-theme() {
284
- $palette: coreDark \!default;
285
- @content;
286
- }
287
-
288
- @mixin _apply-sport-dark-theme() {
289
- $palette: sportDark \!default;
290
- @content;
291
- }
292
-
293
- @mixin _apply-culture-dark-theme() {
294
- $palette: cultureDark \!default;
295
- @content;
296
- }
297
-
298
- @mixin _apply-comment-dark-theme() {
299
- $palette: commentDark \!default;
300
- @content;
301
- }
302
-
303
- @mixin _apply-home-dark-theme() {
304
- $palette: homeDark \!default;
305
- @content;
306
- }
307
-
308
- @mixin _apply-business-dark-theme() {
309
- $palette: businessDark \!default;
310
- @content;
311
- }
312
-
313
- @mixin _apply-travel-dark-theme() {
314
- $palette: travelDark \!default;
315
- @content;
316
- }
317
-
318
- @mixin _apply-uk-dark-theme() {
319
- $palette: ukDark \!default;
320
- @content;
321
- }
322
-
323
- @mixin _apply-world-dark-theme() {
324
- $palette: worldDark \!default;
325
- @content;
326
- }
327
-
328
- @mixin _apply-money-dark-theme() {
329
- $palette: moneyDark \!default;
330
- @content;
331
- }
332
-
333
- @mixin _apply-puzzles-dark-theme() {
334
- $palette: puzzlesDark \!default;
335
- @content;
336
- }
337
-
338
- @mixin _apply-lifeAndStyle-dark-theme() {
339
- $palette: lifeAndStyleDark \!default;
340
- @content;
341
- }
342
-
343
- @mixin _apply-obituaries-dark-theme() {
344
- $palette: obituariesDark \!default;
345
- @content;
346
- }
347
-
348
- @mixin _apply-ireland-dark-theme() {
349
- $palette: irelandDark \!default;
350
- @content;
351
- }
352
-
353
- @mixin _apply-magazineLuxx-dark-theme() {
354
- $palette: magazineLuxxDark \!default;
355
- @content;
356
- }
357
-
358
- @mixin _apply-magazineSundayTimes-dark-theme() {
359
- $palette: magazineSundayTimesDark \!default;
360
- @content;
361
- }
362
-
363
- @mixin _apply-magazineTimes-dark-theme() {
364
- $palette: magazineTimesDark \!default;
365
- @content;
366
- }
367
-
368
- @mixin _apply-timesPlus-dark-theme() {
369
- $palette: timesPlusDark \!default;
370
- @content;
371
- }
372
-
373
- @mixin _apply-timesEvents-dark-theme() {
374
- $palette: timesEventsDark \!default;
375
- @content;
376
- }
377
-
378
- @mixin _apply-timesRadio-dark-theme() {
379
- $palette: timesRadioDark \!default;
380
- @content;
381
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@times-design-system/theme-scss",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "type": "module",
5
5
  "description": "Times Design System theme package - pre-resolved color tokens for React",
6
6
  "keywords": [
@@ -44,5 +44,5 @@
44
44
  "url": "https://github.com/newsuk/times-design-system/issues"
45
45
  },
46
46
  "homepage": "https://github.com/newsuk/times-design-system#readme",
47
- "gitHead": "9e5bbc79ba162448c3ba5e3434533e50645d9b2c"
47
+ "gitHead": "4546787f4cf8edb08cd9f63f6905b6e2182edda8"
48
48
  }