@red-hat-developer-hub/backstage-plugin-theme 0.2.0 → 0.2.2

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 +12 -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 +13 -3
@@ -0,0 +1,527 @@
1
+ const createComponents = (themeConfig) => {
2
+ const options = themeConfig.options ?? {};
3
+ const disableRipple = options?.rippleEffect !== "on";
4
+ const palette = themeConfig.palette ?? {};
5
+ const general = palette.rhdh?.general || {};
6
+ const rhdhPrimary = palette.rhdh?.primary || {};
7
+ const rhdhSecondary = palette.rhdh?.secondary || {};
8
+ const components = {};
9
+ if (options.components === "backstage" || options.components === "mui") {
10
+ return components;
11
+ }
12
+ if (options.buttons !== "mui") {
13
+ components.MuiTypography = {
14
+ styleOverrides: {
15
+ button: {
16
+ textTransform: "none",
17
+ fontWeight: "bold"
18
+ }
19
+ }
20
+ };
21
+ }
22
+ if (options.paper !== "mui") {
23
+ components.MuiPaper = {
24
+ styleOverrides: {
25
+ root: {
26
+ boxShadow: "none",
27
+ backgroundColor: general.cardBackgroundColor,
28
+ // hide the first child element which is a divider with MuiDivider-root classname in MuiPaper
29
+ '& > hr:first-child[class|="MuiDivider-root"]': {
30
+ height: 0
31
+ }
32
+ },
33
+ elevation0: {
34
+ '& div[class*="Mui-disabled"]': {
35
+ backgroundColor: "unset"
36
+ },
37
+ '& span[class*="Mui-disabled"]': {
38
+ backgroundColor: "unset"
39
+ },
40
+ '& input[class*="Mui-disabled"]': {
41
+ backgroundColor: "unset"
42
+ }
43
+ },
44
+ elevation1: {
45
+ boxShadow: "none",
46
+ borderRadius: "0",
47
+ outline: `1px solid ${general.cardBorderColor}`,
48
+ '& > hr[class|="MuiDivider-root"]': {
49
+ backgroundColor: general.cardBorderColor
50
+ }
51
+ },
52
+ elevation2: {
53
+ backgroundColor: general.tableBackgroundColor,
54
+ boxShadow: "none",
55
+ outline: `1px solid ${general.cardBorderColor}`,
56
+ padding: "1rem"
57
+ }
58
+ }
59
+ };
60
+ }
61
+ if (options.buttons !== "mui") {
62
+ components.MuiButton = {
63
+ defaultProps: {
64
+ disableRipple
65
+ },
66
+ styleOverrides: {
67
+ root: {
68
+ textTransform: "none",
69
+ border: "0",
70
+ borderRadius: "3px"
71
+ },
72
+ contained: {
73
+ boxShadow: "none",
74
+ "&:hover": {
75
+ border: "0",
76
+ boxShadow: "none"
77
+ },
78
+ "&:-webkit-any-link:focus-visible": {
79
+ outlineOffset: "0"
80
+ }
81
+ },
82
+ containedPrimary: {
83
+ "&:focus-visible": {
84
+ boxShadow: `inset 0 0 0 1px ${rhdhPrimary.focusVisibleBorder}`,
85
+ outline: `${rhdhPrimary.focusVisibleBorder} solid 1px`
86
+ },
87
+ "&:disabled": {
88
+ color: general.disabled,
89
+ backgroundColor: general.disabledBackground
90
+ }
91
+ },
92
+ containedSecondary: {
93
+ "&:focus-visible": {
94
+ boxShadow: `inset 0 0 0 1px ${rhdhSecondary.focusVisibleBorder}`,
95
+ outline: `${rhdhSecondary.focusVisibleBorder} solid 1px`
96
+ },
97
+ "&:disabled": {
98
+ color: general.disabled,
99
+ backgroundColor: general.disabledBackground
100
+ }
101
+ },
102
+ outlined: {
103
+ "&:hover": {
104
+ backgroundColor: "transparent"
105
+ }
106
+ },
107
+ outlinedPrimary: {
108
+ "&:hover": {
109
+ backgroundColor: "transparent"
110
+ }
111
+ },
112
+ outlinedSecondary: {
113
+ "&:hover": {
114
+ backgroundColor: "transparent"
115
+ }
116
+ },
117
+ text: {
118
+ "&:focus-visible": {
119
+ boxShadow: `inset 0 0 0 2px ${rhdhPrimary.main}`,
120
+ outline: `${rhdhPrimary.focusVisibleBorder} solid 1px`
121
+ }
122
+ }
123
+ }
124
+ };
125
+ components.MuiToggleButton = {
126
+ styleOverrides: {
127
+ root: {
128
+ textTransform: "none"
129
+ }
130
+ }
131
+ };
132
+ components.MuiIconButton = {
133
+ styleOverrides: {
134
+ root: {
135
+ "&:disabled": {
136
+ color: general.disabled
137
+ }
138
+ }
139
+ }
140
+ };
141
+ components.MuiLink = {
142
+ styleOverrides: {
143
+ underlineHover: {
144
+ "&:hover": {
145
+ textDecoration: "none"
146
+ }
147
+ }
148
+ }
149
+ };
150
+ }
151
+ if (options.inputs !== "mui") {
152
+ components.MuiInputBase = {
153
+ styleOverrides: {
154
+ input: {
155
+ "&::placeholder": {
156
+ color: general.disabled,
157
+ opacity: 1
158
+ }
159
+ }
160
+ }
161
+ };
162
+ components.MuiOutlinedInput = {
163
+ styleOverrides: {
164
+ input: {
165
+ "&:autofill": {
166
+ boxShadow: `0 0 0 100px ${general.formControlBackgroundColor} inset`,
167
+ borderRadius: "unset"
168
+ }
169
+ }
170
+ }
171
+ };
172
+ }
173
+ if (options.accordions !== "mui") {
174
+ components.MuiAccordion = {
175
+ styleOverrides: {
176
+ root: {
177
+ boxShadow: "none"
178
+ },
179
+ rounded: {
180
+ "&:first-child": {
181
+ borderTopLeftRadius: "0",
182
+ borderTopRightRadius: "0"
183
+ },
184
+ "&:last-child": {
185
+ borderBottomLeftRadius: "0",
186
+ borderBottomRightRadius: "0"
187
+ }
188
+ }
189
+ }
190
+ };
191
+ }
192
+ if (options.cards !== "mui") {
193
+ components.MuiCard = {
194
+ styleOverrides: {
195
+ root: {
196
+ display: "flex",
197
+ flexDirection: "column",
198
+ backgroundColor: general.cardBackgroundColor
199
+ }
200
+ }
201
+ };
202
+ components.MuiCardHeader = {
203
+ styleOverrides: {
204
+ content: {
205
+ "& > span > nav span": {
206
+ textTransform: "unset",
207
+ letterSpacing: "normal",
208
+ fountweight: "normal"
209
+ }
210
+ },
211
+ title: {
212
+ fontSize: "1.125rem"
213
+ },
214
+ action: {
215
+ "& > a > span > svg": {
216
+ fontSize: "1.125rem"
217
+ },
218
+ '& > a[class*="MuiIconButton-root"]:hover': {
219
+ backgroundColor: "transparent"
220
+ }
221
+ }
222
+ }
223
+ };
224
+ components.MuiCardContent = {
225
+ styleOverrides: {
226
+ root: {
227
+ flexGrow: "1",
228
+ backgroundColor: general.cardBackgroundColor,
229
+ '& > div > div > h2[class*="MuiTypography-h2-"]': {
230
+ textTransform: "unset",
231
+ opacity: "40%"
232
+ },
233
+ '& > div > div > div[class*="MuiChip-sizeSmall"]': {
234
+ backgroundColor: "transparent",
235
+ borderRadius: "8px",
236
+ outline: `1px solid ${general.disabled}`
237
+ },
238
+ '& > div[class*="Mui-expanded"]': {
239
+ margin: "auto"
240
+ },
241
+ '& > div[class*="MuiAccordion-root"]:before': {
242
+ height: 0
243
+ },
244
+ // Override the default line-clamp from 10 to 2 for the Software template catalog
245
+ '& > div[class*="MuiGrid-root-"][class*="MuiGrid-container-"][class*="MuiGrid-spacing-xs-2-"] > div[class*="MuiGrid-root-"][class*="MuiGrid-item-"][class*="MuiGrid-grid-xs-12-"] > div[class*="MuiBox-root-"]': {
246
+ "-webkit-line-clamp": "2"
247
+ }
248
+ }
249
+ }
250
+ };
251
+ }
252
+ if (options.tables !== "mui") {
253
+ components.MuiTable = {
254
+ styleOverrides: {
255
+ root: {
256
+ backgroundColor: general.tableBackgroundColor
257
+ }
258
+ }
259
+ };
260
+ components.MuiTableRow = {
261
+ styleOverrides: {
262
+ root: {
263
+ backgroundColor: general.tableBackgroundColor,
264
+ '&:not([class*="MuiTableRow-footer"]):hover': {
265
+ backgroundColor: `${general.tableRowHover} !important`
266
+ },
267
+ '& > th[class*="MuiTableCell-head"]': {
268
+ backgroundColor: general.tableBackgroundColor
269
+ }
270
+ }
271
+ }
272
+ };
273
+ components.MuiTableCell = {
274
+ styleOverrides: {
275
+ root: {
276
+ textTransform: "none",
277
+ '&[class*="BackstageTableHeader-header"]': {
278
+ borderTop: "unset",
279
+ borderBottom: `1px solid ${general.tableBorderColor}`
280
+ }
281
+ },
282
+ // @ts-expect-error: MUI types are not up to date
283
+ head: {
284
+ textTransform: "unset !important",
285
+ color: `${general.tableColumnTitleColor} !important`,
286
+ '& > span[class*="MuiTableSortLabel-active"]': {
287
+ color: `${rhdhPrimary.main} !important`
288
+ },
289
+ '& > span > svg[class*="MuiTableSortLabel-icon"]': {
290
+ color: "inherit !important"
291
+ }
292
+ },
293
+ body: {
294
+ color: general.tableTitleColor,
295
+ '& > div[class*="MuiChip-sizeSmall"]': {
296
+ margin: "2px"
297
+ }
298
+ }
299
+ }
300
+ };
301
+ components.MuiTableFooter = {
302
+ styleOverrides: {
303
+ root: {
304
+ "& > tr > td": {
305
+ borderBottom: "none"
306
+ }
307
+ }
308
+ }
309
+ };
310
+ }
311
+ if (options.toolbars !== "mui") {
312
+ components.MuiToolbar = {
313
+ styleOverrides: {
314
+ regular: {
315
+ '& > div > h2[class*="MuiTypography-h5"]': {
316
+ fontSize: "1.25rem",
317
+ color: general.tableTitleColor
318
+ }
319
+ }
320
+ }
321
+ };
322
+ }
323
+ if (options.dialogs !== "mui") {
324
+ components.MuiDialogContent = {
325
+ styleOverrides: {
326
+ root: {
327
+ "& > div": {
328
+ backgroundColor: general.cardBackgroundColor
329
+ }
330
+ }
331
+ }
332
+ };
333
+ }
334
+ if (options.tabs !== "mui") {
335
+ components.MuiTabs = {
336
+ styleOverrides: {
337
+ root: {
338
+ boxShadow: `0 -1px ${general.tabsBottomBorderColor} inset`,
339
+ padding: "0 1.5rem"
340
+ },
341
+ flexContainerVertical: {
342
+ "& > button:hover": {
343
+ boxShadow: `-3px 0 ${general.tabsBottomBorderColor} inset`
344
+ }
345
+ }
346
+ }
347
+ };
348
+ components.MuiTab = {
349
+ defaultProps: {
350
+ disableRipple
351
+ },
352
+ styleOverrides: {
353
+ root: {
354
+ textTransform: "none",
355
+ minWidth: "initial !important",
356
+ "&.Mui-disabled": {
357
+ backgroundColor: general.disabledBackground
358
+ }
359
+ }
360
+ }
361
+ };
362
+ }
363
+ if (options.tabs !== "mui") {
364
+ components.BackstageHeaderTabs = {
365
+ styleOverrides: {
366
+ tabsWrapper: {
367
+ paddingLeft: "0",
368
+ backgroundColor: general.mainSectionBackgroundColor
369
+ },
370
+ defaultTab: {
371
+ textTransform: "none",
372
+ fontSize: "1rem",
373
+ fontWeight: "500",
374
+ color: general.disabled,
375
+ padding: "0.5rem 1rem",
376
+ "&:hover": {
377
+ boxShadow: `0 -3px ${general.tabsBottomBorderColor} inset`
378
+ }
379
+ },
380
+ tabRoot: {
381
+ "&:hover": {
382
+ backgroundColor: "unset"
383
+ },
384
+ "&:not(.Mui-selected):hover": {
385
+ color: general.disabled
386
+ }
387
+ }
388
+ }
389
+ };
390
+ }
391
+ if (options.sidebars !== "mui") {
392
+ components.BackstageSidebar = {
393
+ styleOverrides: {
394
+ drawer: {
395
+ backgroundColor: general.sideBarBackgroundColor
396
+ }
397
+ }
398
+ };
399
+ components.BackstageSidebarItem = {
400
+ styleOverrides: {
401
+ label: {
402
+ '&[class*="MuiTypography-subtitle2"]': {
403
+ fontWeight: "500"
404
+ }
405
+ }
406
+ }
407
+ };
408
+ }
409
+ if (options.pages !== "mui") {
410
+ components.BackstagePage = {
411
+ styleOverrides: {
412
+ root: {
413
+ backgroundColor: general.mainSectionBackgroundColor
414
+ }
415
+ }
416
+ };
417
+ components.BackstageContent = {
418
+ styleOverrides: {
419
+ root: {
420
+ backgroundColor: general.mainSectionBackgroundColor,
421
+ "& div:first-child": {
422
+ '& > div[class*="-searchBar"]': {
423
+ backgroundColor: general.formControlBackgroundColor,
424
+ border: `1px solid ${general.searchBarBorderColor}`,
425
+ boxShadow: "none"
426
+ }
427
+ }
428
+ }
429
+ }
430
+ };
431
+ components.BackstageContentHeader = {
432
+ styleOverrides: {
433
+ leftItemsBox: {
434
+ '& > h2[class*="BackstageContentHeader-title-"][class*="MuiTypography-h4-"]': {
435
+ fontWeight: "bold",
436
+ fontSize: "1.75rem"
437
+ }
438
+ }
439
+ }
440
+ };
441
+ }
442
+ if (options.headers !== "mui") {
443
+ components.BackstageHeader = {
444
+ styleOverrides: {
445
+ header: {
446
+ boxShadow: "none",
447
+ borderBottom: `1px solid ${general.headerBottomBorderColor}`
448
+ },
449
+ title: {
450
+ fontWeight: "bold",
451
+ '&[class*="MuiTypography-h1-"]': {
452
+ fontWeight: "bold",
453
+ fontSize: "2rem"
454
+ }
455
+ }
456
+ }
457
+ };
458
+ components.BackstageItemCardHeader = {
459
+ styleOverrides: {
460
+ root: {
461
+ // This is required to increase the css specificity, to OVERRIDE the styles from
462
+ // BackstageItemCardHeader (https://github.com/backstage/backstage/blob/master/packages/core-components/src/layout/ItemCard/ItemCardHeader.tsx)
463
+ // These are applied with a CSS class as well.
464
+ // This variant is used when running the Storybook locally (dev mode) and in Backstage/RHDH!
465
+ '&[class*="MuiBox-root-"]': {
466
+ color: palette.rhdh?.cards?.headerTextColor,
467
+ backgroundColor: palette.rhdh?.cards?.headerBackgroundColor,
468
+ backgroundImage: palette.rhdh?.cards?.headerBackgroundImage,
469
+ borderBottom: `1px solid ${general.cardBorderColor}`
470
+ },
471
+ // This variant is used when building a static Storybook (`storybook:build`)
472
+ '&[class~="MuiBox-root"]': {
473
+ color: palette.rhdh?.cards?.headerTextColor,
474
+ backgroundColor: palette.rhdh?.cards?.headerBackgroundColor,
475
+ backgroundImage: palette.rhdh?.cards?.headerBackgroundImage,
476
+ borderBottom: `1px solid ${general.cardBorderColor}`
477
+ },
478
+ '& > h3[class*="MuiTypography-subtitle2-"] > div > div:first-child': {
479
+ textTransform: "capitalize"
480
+ }
481
+ }
482
+ }
483
+ };
484
+ }
485
+ if (options.toolbars !== "mui") {
486
+ components.BackstageTableToolbar = {
487
+ styleOverrides: {
488
+ root: {
489
+ "& h2": {
490
+ fontWeight: "bold"
491
+ }
492
+ },
493
+ title: {
494
+ "& > h2": {
495
+ fontWeight: "bold"
496
+ }
497
+ }
498
+ }
499
+ };
500
+ }
501
+ components.CatalogReactUserListPicker = {
502
+ styleOverrides: {
503
+ root: {
504
+ borderRadius: "4px"
505
+ },
506
+ title: {
507
+ textTransform: "none"
508
+ }
509
+ }
510
+ };
511
+ if (options.tabs !== "mui") {
512
+ components.PrivateTabIndicator = {
513
+ styleOverrides: {
514
+ root: {
515
+ height: "3px"
516
+ },
517
+ vertical: {
518
+ width: "3px"
519
+ }
520
+ }
521
+ };
522
+ }
523
+ return components;
524
+ };
525
+
526
+ export { createComponents };
527
+ //# sourceMappingURL=createComponents.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createComponents.esm.js","sources":["../../src/utils/createComponents.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { type UnifiedThemeOptions } from '@backstage/theme';\nimport { ThemeConfig, ThemeConfigOptions, RHDHThemePalette } from '../types';\n\nexport type Component = {\n defaultProps?: unknown;\n styleOverrides?: unknown;\n variants?: unknown;\n};\n\nexport type Components = UnifiedThemeOptions['components'] & {\n BackstageHeaderTabs?: Component;\n BackstageSidebar?: Component;\n BackstageSidebarItem?: Component;\n BackstagePage?: Component;\n BackstageContent?: Component;\n BackstageContentHeader?: Component;\n BackstageHeader?: Component;\n BackstageItemCardHeader?: Component;\n BackstageTableToolbar?: Component;\n CatalogReactUserListPicker?: Component;\n PrivateTabIndicator?: Component;\n};\n\nexport const createComponents = (themeConfig: ThemeConfig): Components => {\n // Short hands to ensure that the code doesn't break if one of the properties is not defined.\n\n const options = themeConfig.options ?? ({} as ThemeConfigOptions);\n const disableRipple = options?.rippleEffect !== 'on'; // by default ripple effect is disabled\n\n const palette = themeConfig.palette ?? {};\n\n const general = palette.rhdh?.general || ({} as RHDHThemePalette['general']);\n const rhdhPrimary =\n palette.rhdh?.primary || ({} as RHDHThemePalette['primary']);\n const rhdhSecondary =\n palette.rhdh?.secondary || ({} as RHDHThemePalette['secondary']);\n\n const components: Components = {};\n if (options.components === 'backstage' || options.components === 'mui') {\n return components;\n }\n\n //\n // MUI components\n //\n\n // MUI base\n if (options.buttons !== 'mui') {\n components.MuiTypography = {\n styleOverrides: {\n button: {\n textTransform: 'none',\n fontWeight: 'bold',\n },\n },\n };\n }\n\n // MUI container\n if (options.paper !== 'mui') {\n components.MuiPaper = {\n styleOverrides: {\n root: {\n boxShadow: 'none',\n backgroundColor: general.cardBackgroundColor,\n // hide the first child element which is a divider with MuiDivider-root classname in MuiPaper\n '& > hr:first-child[class|=\"MuiDivider-root\"]': {\n height: 0,\n },\n },\n elevation0: {\n '& div[class*=\"Mui-disabled\"]': {\n backgroundColor: 'unset',\n },\n '& span[class*=\"Mui-disabled\"]': {\n backgroundColor: 'unset',\n },\n '& input[class*=\"Mui-disabled\"]': {\n backgroundColor: 'unset',\n },\n },\n elevation1: {\n boxShadow: 'none',\n borderRadius: '0',\n outline: `1px solid ${general.cardBorderColor}`,\n '& > hr[class|=\"MuiDivider-root\"]': {\n backgroundColor: general.cardBorderColor,\n },\n },\n elevation2: {\n backgroundColor: general.tableBackgroundColor,\n boxShadow: 'none',\n outline: `1px solid ${general.cardBorderColor}`,\n padding: '1rem',\n },\n },\n };\n }\n\n // MUI buttons\n // Don't disableRipple for MuiButtonBase as it will affect all the buttons\n // and we need to ensure that the buttons have a right touch and focus styling.\n if (options.buttons !== 'mui') {\n components.MuiButton = {\n defaultProps: {\n disableRipple,\n },\n styleOverrides: {\n root: {\n textTransform: 'none',\n border: '0',\n borderRadius: '3px',\n },\n contained: {\n boxShadow: 'none',\n '&:hover': {\n border: '0',\n boxShadow: 'none',\n },\n '&:-webkit-any-link:focus-visible': {\n outlineOffset: '0',\n },\n },\n containedPrimary: {\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 1px ${rhdhPrimary.focusVisibleBorder}`,\n outline: `${rhdhPrimary.focusVisibleBorder} solid 1px`,\n },\n '&:disabled': {\n color: general.disabled,\n backgroundColor: general.disabledBackground,\n },\n },\n containedSecondary: {\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 1px ${rhdhSecondary.focusVisibleBorder}`,\n outline: `${rhdhSecondary.focusVisibleBorder} solid 1px`,\n },\n '&:disabled': {\n color: general.disabled,\n backgroundColor: general.disabledBackground,\n },\n },\n outlined: {\n '&:hover': {\n backgroundColor: 'transparent',\n },\n },\n outlinedPrimary: {\n '&:hover': {\n backgroundColor: 'transparent',\n },\n },\n outlinedSecondary: {\n '&:hover': {\n backgroundColor: 'transparent',\n },\n },\n text: {\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px ${rhdhPrimary.main}`,\n outline: `${rhdhPrimary.focusVisibleBorder} solid 1px`,\n },\n },\n },\n };\n components.MuiToggleButton = {\n styleOverrides: {\n root: {\n textTransform: 'none',\n },\n },\n };\n components.MuiIconButton = {\n styleOverrides: {\n root: {\n '&:disabled': {\n color: general.disabled,\n },\n },\n },\n };\n components.MuiLink = {\n styleOverrides: {\n underlineHover: {\n '&:hover': {\n textDecoration: 'none',\n },\n },\n },\n };\n }\n\n // MUI input fields\n if (options.inputs !== 'mui') {\n components.MuiInputBase = {\n styleOverrides: {\n input: {\n '&::placeholder': {\n color: general.disabled,\n opacity: 1,\n },\n },\n },\n };\n components.MuiOutlinedInput = {\n styleOverrides: {\n input: {\n '&:autofill': {\n boxShadow: `0 0 0 100px ${general.formControlBackgroundColor} inset`,\n borderRadius: 'unset',\n },\n },\n },\n };\n }\n\n // MUI accordion\n if (options.accordions !== 'mui') {\n components.MuiAccordion = {\n styleOverrides: {\n root: {\n boxShadow: 'none',\n },\n rounded: {\n '&:first-child': {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n },\n '&:last-child': {\n borderBottomLeftRadius: '0',\n borderBottomRightRadius: '0',\n },\n },\n },\n };\n }\n\n // MUI cards\n if (options.cards !== 'mui') {\n components.MuiCard = {\n styleOverrides: {\n root: {\n display: 'flex',\n flexDirection: 'column',\n backgroundColor: general.cardBackgroundColor,\n },\n },\n };\n components.MuiCardHeader = {\n styleOverrides: {\n content: {\n '& > span > nav span': {\n textTransform: 'unset',\n letterSpacing: 'normal',\n fountweight: 'normal',\n },\n },\n title: {\n fontSize: '1.125rem',\n },\n action: {\n '& > a > span > svg': {\n fontSize: '1.125rem',\n },\n '& > a[class*=\"MuiIconButton-root\"]:hover': {\n backgroundColor: 'transparent',\n },\n },\n },\n };\n components.MuiCardContent = {\n styleOverrides: {\n root: {\n flexGrow: '1',\n backgroundColor: general.cardBackgroundColor,\n '& > div > div > h2[class*=\"MuiTypography-h2-\"]': {\n textTransform: 'unset',\n opacity: '40%',\n },\n '& > div > div > div[class*=\"MuiChip-sizeSmall\"]': {\n backgroundColor: 'transparent',\n borderRadius: '8px',\n outline: `1px solid ${general.disabled}`,\n },\n '& > div[class*=\"Mui-expanded\"]': {\n margin: 'auto',\n },\n '& > div[class*=\"MuiAccordion-root\"]:before': {\n height: 0,\n },\n // Override the default line-clamp from 10 to 2 for the Software template catalog\n '& > div[class*=\"MuiGrid-root-\"][class*=\"MuiGrid-container-\"][class*=\"MuiGrid-spacing-xs-2-\"] > div[class*=\"MuiGrid-root-\"][class*=\"MuiGrid-item-\"][class*=\"MuiGrid-grid-xs-12-\"] > div[class*=\"MuiBox-root-\"]':\n {\n '-webkit-line-clamp': '2',\n },\n },\n },\n };\n }\n\n // MUI table\n if (options.tables !== 'mui') {\n components.MuiTable = {\n styleOverrides: {\n root: {\n backgroundColor: general.tableBackgroundColor,\n },\n },\n };\n components.MuiTableRow = {\n styleOverrides: {\n root: {\n backgroundColor: general.tableBackgroundColor,\n '&:not([class*=\"MuiTableRow-footer\"]):hover': {\n backgroundColor: `${general.tableRowHover} !important`,\n },\n '& > th[class*=\"MuiTableCell-head\"]': {\n backgroundColor: general.tableBackgroundColor,\n },\n },\n },\n };\n components.MuiTableCell = {\n styleOverrides: {\n root: {\n textTransform: 'none',\n '&[class*=\"BackstageTableHeader-header\"]': {\n borderTop: 'unset',\n borderBottom: `1px solid ${general.tableBorderColor}`,\n },\n },\n // @ts-expect-error: MUI types are not up to date\n head: {\n textTransform: 'unset !important',\n color: `${general.tableColumnTitleColor} !important`,\n '& > span[class*=\"MuiTableSortLabel-active\"]': {\n color: `${rhdhPrimary.main} !important`,\n },\n '& > span > svg[class*=\"MuiTableSortLabel-icon\"]': {\n color: 'inherit !important',\n },\n },\n body: {\n color: general.tableTitleColor,\n '& > div[class*=\"MuiChip-sizeSmall\"]': {\n margin: '2px',\n },\n },\n },\n };\n components.MuiTableFooter = {\n styleOverrides: {\n root: {\n '& > tr > td': {\n borderBottom: 'none',\n },\n },\n },\n };\n }\n\n // MUI toolbar\n if (options.toolbars !== 'mui') {\n components.MuiToolbar = {\n styleOverrides: {\n regular: {\n '& > div > h2[class*=\"MuiTypography-h5\"]': {\n fontSize: '1.25rem',\n color: general.tableTitleColor,\n },\n },\n },\n };\n }\n\n // MUI dialogs\n if (options.dialogs !== 'mui') {\n components.MuiDialogContent = {\n styleOverrides: {\n root: {\n '& > div': {\n backgroundColor: general.cardBackgroundColor,\n },\n },\n },\n };\n }\n\n // MUI tabs\n if (options.tabs !== 'mui') {\n components.MuiTabs = {\n styleOverrides: {\n root: {\n boxShadow: `0 -1px ${general.tabsBottomBorderColor} inset`,\n padding: '0 1.5rem',\n },\n flexContainerVertical: {\n '& > button:hover': {\n boxShadow: `-3px 0 ${general.tabsBottomBorderColor} inset`,\n },\n },\n },\n };\n components.MuiTab = {\n defaultProps: {\n disableRipple,\n },\n styleOverrides: {\n root: {\n textTransform: 'none',\n minWidth: 'initial !important',\n '&.Mui-disabled': {\n backgroundColor: general.disabledBackground,\n },\n },\n },\n };\n }\n\n //\n // Backstage\n //\n if (options.tabs !== 'mui') {\n components.BackstageHeaderTabs = {\n styleOverrides: {\n tabsWrapper: {\n paddingLeft: '0',\n backgroundColor: general.mainSectionBackgroundColor,\n },\n defaultTab: {\n textTransform: 'none',\n fontSize: '1rem',\n fontWeight: '500',\n color: general.disabled,\n padding: '0.5rem 1rem',\n '&:hover': {\n boxShadow: `0 -3px ${general.tabsBottomBorderColor} inset`,\n },\n },\n tabRoot: {\n '&:hover': {\n backgroundColor: 'unset',\n },\n '&:not(.Mui-selected):hover': {\n color: general.disabled,\n },\n },\n },\n };\n }\n\n if (options.sidebars !== 'mui') {\n components.BackstageSidebar = {\n styleOverrides: {\n drawer: {\n backgroundColor: general.sideBarBackgroundColor,\n },\n },\n };\n components.BackstageSidebarItem = {\n styleOverrides: {\n label: {\n '&[class*=\"MuiTypography-subtitle2\"]': {\n fontWeight: '500',\n },\n },\n },\n };\n }\n\n if (options.pages !== 'mui') {\n components.BackstagePage = {\n styleOverrides: {\n root: {\n backgroundColor: general.mainSectionBackgroundColor,\n },\n },\n };\n components.BackstageContent = {\n styleOverrides: {\n root: {\n backgroundColor: general.mainSectionBackgroundColor,\n '& div:first-child': {\n '& > div[class*=\"-searchBar\"]': {\n backgroundColor: general.formControlBackgroundColor,\n border: `1px solid ${general.searchBarBorderColor}`,\n boxShadow: 'none',\n },\n },\n },\n },\n };\n components.BackstageContentHeader = {\n styleOverrides: {\n leftItemsBox: {\n '& > h2[class*=\"BackstageContentHeader-title-\"][class*=\"MuiTypography-h4-\"]':\n {\n fontWeight: 'bold',\n fontSize: '1.75rem',\n },\n },\n },\n };\n }\n\n if (options.headers !== 'mui') {\n components.BackstageHeader = {\n styleOverrides: {\n header: {\n boxShadow: 'none',\n borderBottom: `1px solid ${general.headerBottomBorderColor}`,\n },\n title: {\n fontWeight: 'bold',\n '&[class*=\"MuiTypography-h1-\"]': {\n fontWeight: 'bold',\n fontSize: '2rem',\n },\n },\n },\n };\n components.BackstageItemCardHeader = {\n styleOverrides: {\n root: {\n // This is required to increase the css specificity, to OVERRIDE the styles from\n // BackstageItemCardHeader (https://github.com/backstage/backstage/blob/master/packages/core-components/src/layout/ItemCard/ItemCardHeader.tsx)\n // These are applied with a CSS class as well.\n\n // This variant is used when running the Storybook locally (dev mode) and in Backstage/RHDH!\n '&[class*=\"MuiBox-root-\"]': {\n color: palette.rhdh?.cards?.headerTextColor,\n backgroundColor: palette.rhdh?.cards?.headerBackgroundColor,\n backgroundImage: palette.rhdh?.cards?.headerBackgroundImage,\n borderBottom: `1px solid ${general.cardBorderColor}`,\n },\n // This variant is used when building a static Storybook (`storybook:build`)\n '&[class~=\"MuiBox-root\"]': {\n color: palette.rhdh?.cards?.headerTextColor,\n backgroundColor: palette.rhdh?.cards?.headerBackgroundColor,\n backgroundImage: palette.rhdh?.cards?.headerBackgroundImage,\n borderBottom: `1px solid ${general.cardBorderColor}`,\n },\n '& > h3[class*=\"MuiTypography-subtitle2-\"] > div > div:first-child': {\n textTransform: 'capitalize',\n },\n },\n },\n };\n }\n\n if (options.toolbars !== 'mui') {\n components.BackstageTableToolbar = {\n styleOverrides: {\n root: {\n '& h2': {\n fontWeight: 'bold',\n },\n },\n title: {\n '& > h2': {\n fontWeight: 'bold',\n },\n },\n },\n };\n }\n\n //\n // Others\n //\n components.CatalogReactUserListPicker = {\n styleOverrides: {\n root: {\n borderRadius: '4px',\n },\n title: {\n textTransform: 'none',\n },\n },\n };\n\n if (options.tabs !== 'mui') {\n components.PrivateTabIndicator = {\n styleOverrides: {\n root: {\n height: '3px',\n },\n vertical: {\n width: '3px',\n },\n },\n };\n }\n\n return components;\n};\n"],"names":[],"mappings":"AAsCa,MAAA,gBAAA,GAAmB,CAAC,WAAyC,KAAA;AAGxE,EAAM,MAAA,OAAA,GAAU,WAAY,CAAA,OAAA,IAAY,EAAC;AACzC,EAAM,MAAA,aAAA,GAAgB,SAAS,YAAiB,KAAA,IAAA;AAEhD,EAA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M,KAAO,EAAA,eAAA;AAAA,YAC5B,eAAA,EAAiB,OAAQ,CAAA,IAAA,EAAM,KAAO,EAAA,qBAAA;AAAA,YACtC,eAAA,EAAiB,OAAQ,CAAA,IAAA,EAAM,KAAO,EAAA,qBAAA;AAAA,YACtC,YAAA,EAAc,CAAa,UAAA,EAAA,OAAA,CAAQ,eAAe,CAAA;AAAA,WACpD;AAAA,UACA,mEAAqE,EAAA;AAAA,YACnE,aAAe,EAAA;AAAA;AACjB;AACF;AACF,KACF;AAAA;AAGF,EAAI,IAAA,OAAA,CAAQ,aAAa,KAAO,EAAA;AAC9B,IAAA,UAAA,CAAW,qBAAwB,GAAA;AAAA,MACjC,cAAgB,EAAA;AAAA,QACd,IAAM,EAAA;AAAA,UACJ,MAAQ,EAAA;AAAA,YACN,UAAY,EAAA;AAAA;AACd,SACF;AAAA,QACA,KAAO,EAAA;AAAA,UACL,QAAU,EAAA;AAAA,YACR,UAAY,EAAA;AAAA;AACd;AACF;AACF,KACF;AAAA;AAMF,EAAA,UAAA,CAAW,0BAA6B,GAAA;AAAA,IACtC,cAAgB,EAAA;AAAA,MACd,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA;AAAA,OAChB;AAAA,MACA,KAAO,EAAA;AAAA,QACL,aAAe,EAAA;AAAA;AACjB;AACF,GACF;AAEA,EAAI,IAAA,OAAA,CAAQ,SAAS,KAAO,EAAA;AAC1B,IAAA,UAAA,CAAW,mBAAsB,GAAA;AAAA,MAC/B,cAAgB,EAAA;AAAA,QACd,IAAM,EAAA;AAAA,UACJ,MAAQ,EAAA;AAAA,SACV;AAAA,QACA,QAAU,EAAA;AAAA,UACR,KAAO,EAAA;AAAA;AACT;AACF,KACF;AAAA;AAGF,EAAO,OAAA,UAAA;AACT;;;;"}
@@ -0,0 +1,27 @@
1
+ import { shapes, genPageTheme } from '@backstage/theme';
2
+
3
+ const createPageTheme = (pageThemeConfig) => {
4
+ let colors = pageThemeConfig.backgroundColor ?? pageThemeConfig.colors;
5
+ if (typeof colors === "string") {
6
+ colors = [colors];
7
+ } else if (!colors?.length) {
8
+ colors = ["transparent"];
9
+ }
10
+ let shape = pageThemeConfig.backgroundImage ?? shapes[pageThemeConfig.shape] ?? pageThemeConfig.shape ?? "none";
11
+ if (shape.startsWith("data:") || shape.startsWith("http://") || shape.startsWith("https://") || shape.startsWith("/")) {
12
+ shape = `url("${shape}")`;
13
+ } else if (shape.startsWith("<svg") && shape.endsWith(">")) {
14
+ shape = `url("data:image/svg+xml,${encodeURIComponent(shape)}")`;
15
+ }
16
+ return genPageTheme({
17
+ colors,
18
+ shape,
19
+ options: {
20
+ fontColor: pageThemeConfig.fontColor
21
+ // default is white in genPageTheme!
22
+ }
23
+ });
24
+ };
25
+
26
+ export { createPageTheme };
27
+ //# sourceMappingURL=createPageTheme.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPageTheme.esm.js","sources":["../../src/utils/createPageTheme.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { PageTheme, genPageTheme, shapes } from '@backstage/theme';\nimport { ThemeConfigPageTheme } from '../types';\n\n/**\n * Creates a page theme from a page theme configuration (app-config.yaml).\n *\n * This allows the user to specificy a custom header with:\n *\n * * `backgroundColor` or `colors` like `'#ff0000'`, `['#ff0000']` or `['#ff0000', '#00ff00', '#0000ff']`.\n *\n * More then one color will create a gradient from left to right.\n *\n * * a `shape` like `round`, `wave`, `wave2`, or `none`.\n *\n * * or an `backgroundImage` that supports different types of images references:\n *\n * 1. CSS urls like `data:image/svg+xml,...` or `url(data:image/svg+xml,...)`\n * 2. Absolute or relative URLs starting with `http://`, `https://` or `/`\n * 3. Inline <svg>...</svg> images will be transformed to `url(data:image/svg+xml,<svg>...</svg>)`\n *\n * * `fontColor` like `'#ffffff'` or `'#000000'`\n */\nexport const createPageTheme = (\n pageThemeConfig: ThemeConfigPageTheme,\n): PageTheme => {\n let colors = pageThemeConfig.backgroundColor ?? pageThemeConfig.colors;\n if (typeof colors === 'string') {\n colors = [colors];\n } else if (!colors?.length) {\n colors = ['transparent'];\n }\n\n let shape =\n pageThemeConfig.backgroundImage ??\n shapes[pageThemeConfig.shape as string] ??\n pageThemeConfig.shape ??\n 'none';\n if (\n shape.startsWith('data:') ||\n shape.startsWith('http://') ||\n shape.startsWith('https://') ||\n shape.startsWith('/')\n ) {\n shape = `url(\"${shape}\")`;\n } else if (shape.startsWith('<svg') && shape.endsWith('>')) {\n shape = `url(\"data:image/svg+xml,${encodeURIComponent(shape)}\")`;\n }\n\n // https://github.com/backstage/backstage/blob/master/packages/theme/src/base/pageTheme.ts#L59-L87\n return genPageTheme({\n colors,\n shape,\n options: {\n fontColor: pageThemeConfig.fontColor, // default is white in genPageTheme!\n },\n });\n};\n"],"names":[],"mappings":";;AAqCa,MAAA,eAAA,GAAkB,CAC7B,eACc,KAAA;AACd,EAAI,IAAA,MAAA,GAAS,eAAgB,CAAA,eAAA,IAAmB,eAAgB,CAAA,MAAA;AAChE,EAAI,IAAA,OAAO,WAAW,QAAU,EAAA;AAC9B,IAAA,MAAA,GAAS,CAAC,MAAM,CAAA;AAAA,GAClB,MAAA,IAAW,CAAC,MAAA,EAAQ,MAAQ,EAAA;AAC1B,IAAA,MAAA,GAAS,CAAC,aAAa,CAAA;AAAA;AAGzB,EAAI,IAAA,KAAA,GACF,gBAAgB,eAChB,IAAA,MAAA,CAAO,gBAAgB,KAAe,CAAA,IACtC,gBAAgB,KAChB,IAAA,MAAA;AACF,EAAA,IACE,KAAM,CAAA,UAAA,CAAW,OAAO,CAAA,IACxB,MAAM,UAAW,CAAA,SAAS,CAC1B,IAAA,KAAA,CAAM,WAAW,UAAU,CAAA,IAC3B,KAAM,CAAA,UAAA,CAAW,GAAG,CACpB,EAAA;AACA,IAAA,KAAA,GAAQ,QAAQ,KAAK,CAAA,EAAA,CAAA;AAAA,GACvB,MAAA,IAAW,MAAM,UAAW,CAAA,MAAM,KAAK,KAAM,CAAA,QAAA,CAAS,GAAG,CAAG,EAAA;AAC1D,IAAQ,KAAA,GAAA,CAAA,wBAAA,EAA2B,kBAAmB,CAAA,KAAK,CAAC,CAAA,EAAA,CAAA;AAAA;AAI9D,EAAA,OAAO,YAAa,CAAA;AAAA,IAClB,MAAA;AAAA,IACA,KAAA;AAAA,IACA,OAAS,EAAA;AAAA,MACP,WAAW,eAAgB,CAAA;AAAA;AAAA;AAC7B,GACD,CAAA;AACH;;;;"}
@@ -0,0 +1,17 @@
1
+ import { createPageTheme } from './createPageTheme.esm.js';
2
+
3
+ const createPageThemes = (themeConfig) => {
4
+ if (!themeConfig?.pageTheme || !Object.keys(themeConfig.pageTheme).length) {
5
+ return void 0;
6
+ }
7
+ const pageThemes = {};
8
+ for (const page in themeConfig.pageTheme) {
9
+ if (Object.hasOwn(themeConfig.pageTheme, page)) {
10
+ pageThemes[page] = createPageTheme(themeConfig.pageTheme[page]);
11
+ }
12
+ }
13
+ return pageThemes;
14
+ };
15
+
16
+ export { createPageThemes };
17
+ //# sourceMappingURL=createPageThemes.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPageThemes.esm.js","sources":["../../src/utils/createPageThemes.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { PageTheme } from '@backstage/theme';\nimport { ThemeConfig } from '../types';\nimport { createPageTheme } from './createPageTheme';\n\nexport const createPageThemes = (\n themeConfig: ThemeConfig | undefined,\n): Record<string, PageTheme> | undefined => {\n if (!themeConfig?.pageTheme || !Object.keys(themeConfig.pageTheme).length) {\n return undefined;\n }\n\n const pageThemes: Record<string, PageTheme> = {};\n\n for (const page in themeConfig.pageTheme) {\n if (Object.hasOwn(themeConfig.pageTheme, page)) {\n pageThemes[page] = createPageTheme(themeConfig.pageTheme[page]);\n }\n }\n\n return pageThemes;\n};\n"],"names":[],"mappings":";;AAmBa,MAAA,gBAAA,GAAmB,CAC9B,WAC0C,KAAA;AAC1C,EAAI,IAAA,CAAC,aAAa,SAAa,IAAA,CAAC,OAAO,IAAK,CAAA,WAAA,CAAY,SAAS,CAAA,CAAE,MAAQ,EAAA;AACzE,IAAO,OAAA,KAAA,CAAA;AAAA;AAGT,EAAA,MAAM,aAAwC,EAAC;AAE/C,EAAW,KAAA,MAAA,IAAA,IAAQ,YAAY,SAAW,EAAA;AACxC,IAAA,IAAI,MAAO,CAAA,MAAA,CAAO,WAAY,CAAA,SAAA,EAAW,IAAI,CAAG,EAAA;AAC9C,MAAA,UAAA,CAAW,IAAI,CAAI,GAAA,eAAA,CAAgB,WAAY,CAAA,SAAA,CAAU,IAAI,CAAC,CAAA;AAAA;AAChE;AAGF,EAAO,OAAA,UAAA;AACT;;;;"}