@red-hat-developer-hub/backstage-plugin-theme 0.2.0 → 0.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +139 -6
  3. package/config.d.ts +30 -0
  4. package/dist/backstage.esm.js +13 -0
  5. package/dist/backstage.esm.js.map +1 -0
  6. package/dist/darkTheme.esm.js +63 -0
  7. package/dist/darkTheme.esm.js.map +1 -0
  8. package/dist/hooks/useBranding.esm.js +17 -0
  9. package/dist/hooks/useBranding.esm.js.map +1 -0
  10. package/dist/hooks/useTheme.esm.js +15 -0
  11. package/dist/hooks/useTheme.esm.js.map +1 -0
  12. package/dist/hooks/useThemeConfig.esm.js +25 -0
  13. package/dist/hooks/useThemeConfig.esm.js.map +1 -0
  14. package/dist/hooks/useThemeOptions.esm.js +41 -0
  15. package/dist/hooks/useThemeOptions.esm.js.map +1 -0
  16. package/dist/index.d.ts +100 -9
  17. package/dist/index.esm.js +4 -1
  18. package/dist/index.esm.js.map +1 -1
  19. package/dist/lightTheme.esm.js +67 -0
  20. package/dist/lightTheme.esm.js.map +1 -0
  21. package/dist/rhdh.esm.js +25 -0
  22. package/dist/rhdh.esm.js.map +1 -0
  23. package/dist/themes.esm.js +109 -132
  24. package/dist/themes.esm.js.map +1 -1
  25. package/dist/typography.esm.js +75 -0
  26. package/dist/typography.esm.js.map +1 -0
  27. package/dist/utils/createComponents.esm.js +527 -0
  28. package/dist/utils/createComponents.esm.js.map +1 -0
  29. package/dist/utils/createPageTheme.esm.js +27 -0
  30. package/dist/utils/createPageTheme.esm.js.map +1 -0
  31. package/dist/utils/createPageThemes.esm.js +17 -0
  32. package/dist/utils/createPageThemes.esm.js.map +1 -0
  33. package/dist/utils/mergeTheme.esm.js +47 -0
  34. package/dist/utils/mergeTheme.esm.js.map +1 -0
  35. package/dist/utils/migrateTheme.esm.js +64 -0
  36. package/dist/utils/migrateTheme.esm.js.map +1 -0
  37. package/fonts/OPEN-FONT-LICENSE +94 -0
  38. package/fonts/README.md +9 -0
  39. package/fonts/RedHatDisplay/RedHatDisplay-Black.woff2 +0 -0
  40. package/fonts/RedHatDisplay/RedHatDisplay-BlackItalic.woff2 +0 -0
  41. package/fonts/RedHatDisplay/RedHatDisplay-Bold.woff2 +0 -0
  42. package/fonts/RedHatDisplay/RedHatDisplay-BoldItalic.woff2 +0 -0
  43. package/fonts/RedHatDisplay/RedHatDisplay-Italic.woff2 +0 -0
  44. package/fonts/RedHatDisplay/RedHatDisplay-Light.woff2 +0 -0
  45. package/fonts/RedHatDisplay/RedHatDisplay-LightItalic.woff2 +0 -0
  46. package/fonts/RedHatDisplay/RedHatDisplay-Medium.woff2 +0 -0
  47. package/fonts/RedHatDisplay/RedHatDisplay-MediumItalic.woff2 +0 -0
  48. package/fonts/RedHatDisplay/RedHatDisplay-Regular.woff2 +0 -0
  49. package/fonts/RedHatDisplay/RedHatDisplayVF-Italic.woff2 +0 -0
  50. package/fonts/RedHatDisplay/RedHatDisplayVF.woff2 +0 -0
  51. package/fonts/RedHatMono/RedHatMono-Bold.woff2 +0 -0
  52. package/fonts/RedHatMono/RedHatMono-BoldItalic.woff2 +0 -0
  53. package/fonts/RedHatMono/RedHatMono-Italic.woff2 +0 -0
  54. package/fonts/RedHatMono/RedHatMono-Light.woff2 +0 -0
  55. package/fonts/RedHatMono/RedHatMono-LightItalic.woff2 +0 -0
  56. package/fonts/RedHatMono/RedHatMono-Medium.woff2 +0 -0
  57. package/fonts/RedHatMono/RedHatMono-MediumItalic.woff2 +0 -0
  58. package/fonts/RedHatMono/RedHatMono-Regular.woff2 +0 -0
  59. package/fonts/RedHatMono/RedHatMonoVF-Italic.woff2 +0 -0
  60. package/fonts/RedHatMono/RedHatMonoVF.woff2 +0 -0
  61. package/fonts/RedHatText/RedHatText-Bold.woff2 +0 -0
  62. package/fonts/RedHatText/RedHatText-BoldItalic.woff2 +0 -0
  63. package/fonts/RedHatText/RedHatText-Italic.woff2 +0 -0
  64. package/fonts/RedHatText/RedHatText-Light.woff2 +0 -0
  65. package/fonts/RedHatText/RedHatText-LightItalic.woff2 +0 -0
  66. package/fonts/RedHatText/RedHatText-Medium.woff2 +0 -0
  67. package/fonts/RedHatText/RedHatText-MediumItalic.woff2 +0 -0
  68. package/fonts/RedHatText/RedHatText-Regular.woff2 +0 -0
  69. package/fonts/RedHatText/RedHatTextVF-Italic.woff2 +0 -0
  70. package/fonts/RedHatText/RedHatTextVF.woff2 +0 -0
  71. package/fonts/font.css +54 -0
  72. package/fonts/font.min.css +43 -0
  73. package/fonts/index.html +374 -0
  74. package/package.json +10 -2
@@ -0,0 +1,374 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta http-equiv="X-UA-Compatible" content="ie=edge" />
7
+ <title>Red Hat Font Family</title>
8
+ <link rel="stylesheet" href="./font.css" />
9
+ <style>
10
+ :root {
11
+ --font-weight: 500;
12
+ }
13
+
14
+ *,
15
+ *:before,
16
+ *:after {
17
+ box-sizing: border-box;
18
+ }
19
+
20
+ html {
21
+ font-size: 100%;
22
+ }
23
+
24
+ body {
25
+ line-height: 1.1;
26
+ text-rendering: optimizeLegibility;
27
+ margin: 0;
28
+ padding: 0;
29
+ }
30
+
31
+ header {
32
+ --font-weight: 700;
33
+ font-size: clamp(1.2rem, 2.5vw, 4rem);
34
+ background-color: #151515;
35
+ height: 80vh;
36
+ color: #fff;
37
+ padding: 30px;
38
+ display: grid;
39
+ align-items: center;
40
+ grid-template-rows: auto 100px;
41
+ }
42
+
43
+ header .vf-header {
44
+ place-self: center;
45
+ padding-top: 80px;
46
+ }
47
+
48
+ header .controls {
49
+ place-self: end;
50
+ }
51
+
52
+ header input[type='range']::-moz-range-track {
53
+ background-color: white;
54
+ }
55
+
56
+ main {
57
+ font-size: clamp(1.2rem, 2.5vw, 2.2rem);
58
+ margin-bottom: 50px;
59
+ }
60
+
61
+ .RedHatDisplay {
62
+ font-family: 'RedHatDisplay';
63
+ }
64
+
65
+ .RedHatText {
66
+ font-family: 'RedHatText';
67
+ }
68
+
69
+ .RedHatMono {
70
+ font-family: 'RedHatMono';
71
+ }
72
+
73
+ .w200 {
74
+ font-weight: 200;
75
+ }
76
+
77
+ .w300 {
78
+ font-weight: 300;
79
+ }
80
+
81
+ .w400 {
82
+ font-weight: 400;
83
+ }
84
+
85
+ .w500 {
86
+ font-weight: 500;
87
+ }
88
+
89
+ .w700 {
90
+ font-weight: 700;
91
+ }
92
+
93
+ .w900 {
94
+ font-weight: 900;
95
+ }
96
+
97
+ .section-title {
98
+ margin-top: 50px;
99
+ font-size: clamp(1.8rem, 4vw, 4rem);
100
+ }
101
+
102
+ .section-bg {
103
+ padding: 0 30px 80px;
104
+ }
105
+
106
+ .section-bg:nth-child(even) {
107
+ background-color: #f0f0f0;
108
+ }
109
+
110
+ section {
111
+ position: relative;
112
+ overflow: hidden;
113
+ max-width: 800px;
114
+ margin: 0 auto;
115
+ }
116
+
117
+ section h3 {
118
+ border-top: 1px solid #d2d2d2;
119
+ padding: 50px 0 0;
120
+ margin: 50px 0 30px;
121
+ }
122
+
123
+ section p {
124
+ margin: 0;
125
+ }
126
+
127
+ section p + p {
128
+ margin-top: 20px;
129
+ }
130
+
131
+ .demo * {
132
+ font-variation-settings: 'wght' var(--font-weight);
133
+ }
134
+
135
+ .controls {
136
+ font-size: clamp(0.9rem, 1.5vw, 1.2rem);
137
+ margin-top: 30px;
138
+ padding: 15px;
139
+ }
140
+
141
+ input[type='range'] {
142
+ background-color: transparent;
143
+ }
144
+
145
+ .controls--bg {
146
+ background-color: #f0f0f0;
147
+ }
148
+
149
+ .section-bg:nth-child(even) .controls--bg {
150
+ background-color: #fff;
151
+ }
152
+ </style>
153
+ </head>
154
+ <body>
155
+ <header id="header">
156
+ <div class="vf-header demo">
157
+ <h1 class="RedHatDisplay">Red Hat Font Demo</h1>
158
+ </div>
159
+ <div class="controls range-slider">
160
+ <label class="RedHatMono" for="vf-header">Adjust Weight: </label>
161
+ <input
162
+ type="range"
163
+ id="vf-header"
164
+ name="range-slider"
165
+ value="700"
166
+ class="controls--slider"
167
+ min="300"
168
+ max="900"
169
+ />
170
+ </div>
171
+ </header>
172
+
173
+ <main id="main">
174
+ <div class="section-bg">
175
+ <section>
176
+ <h2 class="section-title RedHatDisplay w700">Red Hat Display</h2>
177
+
178
+ <h3 class="RedHatDisplay w200">Red Hat Display Light</h3>
179
+ <p class="RedHatDisplay w200">
180
+ The quick brown fox jumps over the lazy dog.
181
+ </p>
182
+ <p class="RedHatDisplay w200">
183
+ <em>The quick brown fox jumps over the lazy dog.</em>
184
+ </p>
185
+
186
+ <h3 class="RedHatDisplay w300">Red Hat Display Regular</h3>
187
+ <p class="RedHatDisplay w300">
188
+ The quick brown fox jumps over the lazy dog.
189
+ </p>
190
+ <p class="RedHatDisplay w300">
191
+ <em>The quick brown fox jumps over the lazy dog.</em>
192
+ </p>
193
+
194
+ <h3 class="RedHatDisplay w400">Red Hat Display Medium</h3>
195
+ <p class="RedHatDisplay w400">
196
+ The quick brown fox jumps over the lazy dog.
197
+ </p>
198
+ <p class="RedHatDisplay w400">
199
+ <em>The quick brown fox jumps over the lazy dog.</em>
200
+ </p>
201
+
202
+ <h3 class="RedHatDisplay w700">Red Hat Display Bold</h3>
203
+ <p class="RedHatDisplay w700">
204
+ The quick brown fox jumps over the lazy dog.
205
+ </p>
206
+ <p class="RedHatDisplay w700">
207
+ <em>The quick brown fox jumps over the lazy dog.</em>
208
+ </p>
209
+
210
+ <h3 class="RedHatDisplay w900">Red Hat Display Black</h3>
211
+ <p class="RedHatDisplay w900">
212
+ The quick brown fox jumps over the lazy dog.
213
+ </p>
214
+ <p class="RedHatDisplay w900">
215
+ <em>The quick brown fox jumps over the lazy dog.</em>
216
+ </p>
217
+
218
+ <div class="demo vf-rh-display RedHatDisplay">
219
+ <h3>Red Hat Display Variable Font</h3>
220
+ <p>The quick brown fox jumps over the lazy dog.</p>
221
+ <p><em>The quick brown fox jumps over the lazy dog.</em></p>
222
+ </div>
223
+
224
+ <div class="controls controls--bg">
225
+ <label class="RedHatMono" for="vf-rh-display"
226
+ >Adjust Weight:
227
+ </label>
228
+ <input
229
+ type="range"
230
+ id="vf-rh-display"
231
+ name="range-slider"
232
+ value="500"
233
+ class="controls--slider"
234
+ min="300"
235
+ max="900"
236
+ />
237
+ </div>
238
+ </section>
239
+ </div>
240
+
241
+ <div class="section-bg">
242
+ <section>
243
+ <h2 class="section-title RedHatText w500">Red Hat Text</h2>
244
+
245
+ <h3 class="RedHatText w300">Red Hat Text Light</h3>
246
+ <p class="RedHatText w300">
247
+ The quick brown fox jumps over the lazy dog.
248
+ </p>
249
+ <p class="RedHatText w300">
250
+ <em>The quick brown fox jumps over the lazy dog.</em>
251
+ </p>
252
+
253
+ <h3 class="RedHatText w400">Red Hat Text Regular</h3>
254
+ <p class="RedHatText w400">
255
+ The quick brown fox jumps over the lazy dog.
256
+ </p>
257
+ <p class="RedHatText w400">
258
+ <em>The quick brown fox jumps over the lazy dog.</em>
259
+ </p>
260
+
261
+ <h3 class="RedHatText w500">Red Hat Text Medium</h3>
262
+ <p class="RedHatText w500">
263
+ The quick brown fox jumps over the lazy dog.
264
+ </p>
265
+ <p class="RedHatText w500">
266
+ <em>The quick brown fox jumps over the lazy dog.</em>
267
+ </p>
268
+
269
+ <h3 class="RedHatText w700">Red Hat Text Bold</h3>
270
+ <p class="RedHatText w700">
271
+ The quick brown fox jumps over the lazy dog.
272
+ </p>
273
+ <p class="RedHatText w700">
274
+ <em>The quick brown fox jumps over the lazy dog.</em>
275
+ </p>
276
+
277
+ <div class="demo vf-rh-text RedHatText">
278
+ <h3>Red Hat Text Variable Font</h3>
279
+ <p>The quick brown fox jumps over the lazy dog.</p>
280
+ <p><em>The quick brown fox jumps over the lazy dog.</em></p>
281
+ </div>
282
+
283
+ <div class="controls controls--bg">
284
+ <label class="RedHatMono" for="vf-rh-text">Adjust Weight: </label>
285
+ <input
286
+ type="range"
287
+ id="vf-rh-text"
288
+ name="range-slider"
289
+ value="500"
290
+ class="controls--slider"
291
+ min="300"
292
+ max="700"
293
+ />
294
+ </div>
295
+ </section>
296
+ </div>
297
+
298
+ <div class="section-bg">
299
+ <section>
300
+ <h2 class="section-title RedHatMono w500">Red Hat Mono</h2>
301
+
302
+ <h3 class="RedHatMono w300">Red Hat Mono Light</h3>
303
+ <p class="RedHatMono w300">
304
+ The quick brown fox jumps over the lazy dog.
305
+ </p>
306
+ <p class="RedHatMono w300">
307
+ <em>The quick brown fox jumps over the lazy dog.</em>
308
+ </p>
309
+
310
+ <h3 class="RedHatMono w400">Red Hat Mono Regular</h3>
311
+ <p class="RedHatMono w400">
312
+ The quick brown fox jumps over the lazy dog.
313
+ </p>
314
+ <p class="RedHatMono w400">
315
+ <em>The quick brown fox jumps over the lazy dog.</em>
316
+ </p>
317
+
318
+ <h3 class="RedHatMono w500">Red Hat Mono Medium</h3>
319
+ <p class="RedHatMono w500">
320
+ The quick brown fox jumps over the lazy dog.
321
+ </p>
322
+ <p class="RedHatMono w500">
323
+ <em>The quick brown fox jumps over the lazy dog.</em>
324
+ </p>
325
+
326
+ <h3 class="RedHatMono w700">Red Hat Mono Bold</h3>
327
+ <p class="RedHatMono w700">
328
+ The quick brown fox jumps over the lazy dog.
329
+ </p>
330
+ <p class="RedHatMono w700">
331
+ <em>The quick brown fox jumps over the lazy dog.</em>
332
+ </p>
333
+
334
+ <div class="demo vf-rh-mono RedHatMono">
335
+ <h3>Red Hat Mono Variable Font</h3>
336
+ <p>The quick brown fox jumps over the lazy dog.</p>
337
+ <p><em>The quick brown fox jumps over the lazy dog.</em></p>
338
+ </div>
339
+
340
+ <div class="controls controls--bg">
341
+ <label class="RedHatMono" for="vf-rh-mono">Adjust Weight: </label>
342
+ <input
343
+ type="range"
344
+ id="vf-rh-mono"
345
+ name="range-slider"
346
+ value="500"
347
+ class="controls--slider"
348
+ min="300"
349
+ max="700"
350
+ />
351
+ </div>
352
+ </section>
353
+ </div>
354
+ </main>
355
+
356
+ <script>
357
+ // Find all range inputs and wire them up so they automatically change
358
+ // the font weight.
359
+ const inputs = document.querySelectorAll('input[type="range"]');
360
+
361
+ // listen for changes
362
+ inputs.forEach(input => input.addEventListener('change', handleUpdate));
363
+ inputs.forEach(input =>
364
+ input.addEventListener('mousemove', handleUpdate),
365
+ );
366
+
367
+ function handleUpdate(e) {
368
+ document
369
+ .querySelector(`.${this.id}`)
370
+ .style.setProperty('--font-weight', this.value);
371
+ }
372
+ </script>
373
+ </body>
374
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@red-hat-developer-hub/backstage-plugin-theme",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "main": "dist/index.esm.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -27,6 +27,9 @@
27
27
  "prepack": "backstage-cli package prepack",
28
28
  "postpack": "backstage-cli package postpack"
29
29
  },
30
+ "dependencies": {
31
+ "@mui/material": "^5.0.0"
32
+ },
30
33
  "peerDependencies": {
31
34
  "@backstage/core-components": "^0.15.1",
32
35
  "@backstage/core-plugin-api": "^1.10.0",
@@ -42,15 +45,20 @@
42
45
  "@backstage/dev-utils": "^1.1.2",
43
46
  "@backstage/test-utils": "^1.7.0",
44
47
  "@backstage/theme": "^0.6.0",
48
+ "@backstage/types": "^1.2.0",
45
49
  "@material-ui/icons": "^4.11.3",
46
50
  "@testing-library/jest-dom": "^6.0.0",
47
51
  "@testing-library/react": "^14.0.0",
52
+ "@testing-library/react-hooks": "^8.0.1",
48
53
  "@testing-library/user-event": "^14.0.0",
49
54
  "msw": "^1.0.0",
50
55
  "react": "^16.13.1 || ^17.0.0 || ^18.0.0"
51
56
  },
57
+ "configSchema": "config.d.ts",
52
58
  "files": [
53
- "dist"
59
+ "config.d.ts",
60
+ "dist",
61
+ "fonts"
54
62
  ],
55
63
  "module": "./dist/index.esm.js"
56
64
  }