@furystack/shades-common-components 13.1.0 → 13.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 (142) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/esm/components/app-bar.d.ts.map +1 -1
  3. package/esm/components/app-bar.js +12 -3
  4. package/esm/components/app-bar.js.map +1 -1
  5. package/esm/components/avatar.d.ts.map +1 -1
  6. package/esm/components/avatar.js +3 -5
  7. package/esm/components/avatar.js.map +1 -1
  8. package/esm/components/command-palette/command-palette-input.d.ts +1 -2
  9. package/esm/components/command-palette/command-palette-input.d.ts.map +1 -1
  10. package/esm/components/command-palette/command-palette-input.js +14 -36
  11. package/esm/components/command-palette/command-palette-input.js.map +1 -1
  12. package/esm/components/command-palette/command-palette-input.spec.js +14 -116
  13. package/esm/components/command-palette/command-palette-input.spec.js.map +1 -1
  14. package/esm/components/command-palette/index.d.ts.map +1 -1
  15. package/esm/components/command-palette/index.js +3 -0
  16. package/esm/components/command-palette/index.js.map +1 -1
  17. package/esm/components/drawer/index.d.ts.map +1 -1
  18. package/esm/components/drawer/index.js +4 -0
  19. package/esm/components/drawer/index.js.map +1 -1
  20. package/esm/components/drawer/index.spec.js +47 -0
  21. package/esm/components/drawer/index.spec.js.map +1 -1
  22. package/esm/components/noty-list.d.ts.map +1 -1
  23. package/esm/components/noty-list.js +1 -3
  24. package/esm/components/noty-list.js.map +1 -1
  25. package/esm/services/css-variable-theme.d.ts +1 -1
  26. package/esm/services/css-variable-theme.d.ts.map +1 -1
  27. package/esm/services/css-variable-theme.js +5 -5
  28. package/esm/services/css-variable-theme.js.map +1 -1
  29. package/esm/services/css-variable-theme.spec.js +29 -1
  30. package/esm/services/css-variable-theme.spec.js.map +1 -1
  31. package/esm/services/layout-service.d.ts +8 -0
  32. package/esm/services/layout-service.d.ts.map +1 -1
  33. package/esm/services/layout-service.js +16 -0
  34. package/esm/services/layout-service.js.map +1 -1
  35. package/esm/services/layout-service.spec.js +55 -0
  36. package/esm/services/layout-service.spec.js.map +1 -1
  37. package/esm/services/theme-provider-service.d.ts +11 -10
  38. package/esm/services/theme-provider-service.d.ts.map +1 -1
  39. package/esm/services/theme-provider-service.js +3 -2
  40. package/esm/services/theme-provider-service.js.map +1 -1
  41. package/esm/services/theme-provider-service.spec.js +35 -1
  42. package/esm/services/theme-provider-service.spec.js.map +1 -1
  43. package/esm/themes/architect-theme.d.ts +1 -0
  44. package/esm/themes/architect-theme.d.ts.map +1 -1
  45. package/esm/themes/architect-theme.js +1 -0
  46. package/esm/themes/architect-theme.js.map +1 -1
  47. package/esm/themes/auditore-theme.d.ts +1 -0
  48. package/esm/themes/auditore-theme.d.ts.map +1 -1
  49. package/esm/themes/auditore-theme.js +1 -0
  50. package/esm/themes/auditore-theme.js.map +1 -1
  51. package/esm/themes/black-mesa-theme.d.ts +1 -0
  52. package/esm/themes/black-mesa-theme.d.ts.map +1 -1
  53. package/esm/themes/black-mesa-theme.js +1 -0
  54. package/esm/themes/black-mesa-theme.js.map +1 -1
  55. package/esm/themes/default-dark-theme.d.ts +1 -0
  56. package/esm/themes/default-dark-theme.d.ts.map +1 -1
  57. package/esm/themes/default-dark-theme.js +1 -0
  58. package/esm/themes/default-dark-theme.js.map +1 -1
  59. package/esm/themes/default-light-theme.d.ts +1 -0
  60. package/esm/themes/default-light-theme.d.ts.map +1 -1
  61. package/esm/themes/default-light-theme.js +1 -0
  62. package/esm/themes/default-light-theme.js.map +1 -1
  63. package/esm/themes/dragonborn-theme.d.ts +1 -0
  64. package/esm/themes/dragonborn-theme.d.ts.map +1 -1
  65. package/esm/themes/dragonborn-theme.js +1 -0
  66. package/esm/themes/dragonborn-theme.js.map +1 -1
  67. package/esm/themes/hawkins-theme.d.ts +1 -0
  68. package/esm/themes/hawkins-theme.d.ts.map +1 -1
  69. package/esm/themes/hawkins-theme.js +1 -0
  70. package/esm/themes/hawkins-theme.js.map +1 -1
  71. package/esm/themes/jedi-theme.d.ts +1 -0
  72. package/esm/themes/jedi-theme.d.ts.map +1 -1
  73. package/esm/themes/jedi-theme.js +1 -0
  74. package/esm/themes/jedi-theme.js.map +1 -1
  75. package/esm/themes/neon-runner-theme.d.ts +1 -0
  76. package/esm/themes/neon-runner-theme.d.ts.map +1 -1
  77. package/esm/themes/neon-runner-theme.js +1 -0
  78. package/esm/themes/neon-runner-theme.js.map +1 -1
  79. package/esm/themes/plumber-theme.d.ts +1 -0
  80. package/esm/themes/plumber-theme.d.ts.map +1 -1
  81. package/esm/themes/plumber-theme.js +1 -0
  82. package/esm/themes/plumber-theme.js.map +1 -1
  83. package/esm/themes/replicant-theme.d.ts +1 -0
  84. package/esm/themes/replicant-theme.d.ts.map +1 -1
  85. package/esm/themes/replicant-theme.js +1 -0
  86. package/esm/themes/replicant-theme.js.map +1 -1
  87. package/esm/themes/sandworm-theme.d.ts +1 -0
  88. package/esm/themes/sandworm-theme.d.ts.map +1 -1
  89. package/esm/themes/sandworm-theme.js +1 -0
  90. package/esm/themes/sandworm-theme.js.map +1 -1
  91. package/esm/themes/shadow-broker-theme.d.ts +1 -0
  92. package/esm/themes/shadow-broker-theme.d.ts.map +1 -1
  93. package/esm/themes/shadow-broker-theme.js +1 -0
  94. package/esm/themes/shadow-broker-theme.js.map +1 -1
  95. package/esm/themes/sith-theme.d.ts +1 -0
  96. package/esm/themes/sith-theme.d.ts.map +1 -1
  97. package/esm/themes/sith-theme.js +1 -0
  98. package/esm/themes/sith-theme.js.map +1 -1
  99. package/esm/themes/vault-dweller-theme.d.ts +1 -0
  100. package/esm/themes/vault-dweller-theme.d.ts.map +1 -1
  101. package/esm/themes/vault-dweller-theme.js +1 -0
  102. package/esm/themes/vault-dweller-theme.js.map +1 -1
  103. package/esm/themes/wild-hunt-theme.d.ts +1 -0
  104. package/esm/themes/wild-hunt-theme.d.ts.map +1 -1
  105. package/esm/themes/wild-hunt-theme.js +1 -0
  106. package/esm/themes/wild-hunt-theme.js.map +1 -1
  107. package/esm/themes/xenomorph-theme.d.ts +1 -0
  108. package/esm/themes/xenomorph-theme.d.ts.map +1 -1
  109. package/esm/themes/xenomorph-theme.js +1 -0
  110. package/esm/themes/xenomorph-theme.js.map +1 -1
  111. package/package.json +1 -1
  112. package/src/components/app-bar.tsx +12 -3
  113. package/src/components/avatar.tsx +20 -5
  114. package/src/components/command-palette/command-palette-input.spec.tsx +14 -156
  115. package/src/components/command-palette/command-palette-input.tsx +13 -45
  116. package/src/components/command-palette/index.tsx +4 -0
  117. package/src/components/drawer/index.spec.tsx +64 -0
  118. package/src/components/drawer/index.tsx +5 -0
  119. package/src/components/noty-list.tsx +1 -3
  120. package/src/services/css-variable-theme.spec.ts +43 -1
  121. package/src/services/css-variable-theme.ts +5 -5
  122. package/src/services/layout-service.spec.ts +74 -0
  123. package/src/services/layout-service.ts +18 -0
  124. package/src/services/theme-provider-service.spec.ts +49 -1
  125. package/src/services/theme-provider-service.ts +12 -11
  126. package/src/themes/architect-theme.ts +1 -0
  127. package/src/themes/auditore-theme.ts +1 -0
  128. package/src/themes/black-mesa-theme.ts +1 -0
  129. package/src/themes/default-dark-theme.ts +1 -0
  130. package/src/themes/default-light-theme.ts +1 -0
  131. package/src/themes/dragonborn-theme.ts +1 -0
  132. package/src/themes/hawkins-theme.ts +1 -0
  133. package/src/themes/jedi-theme.ts +1 -0
  134. package/src/themes/neon-runner-theme.ts +1 -0
  135. package/src/themes/plumber-theme.ts +1 -0
  136. package/src/themes/replicant-theme.ts +1 -0
  137. package/src/themes/sandworm-theme.ts +1 -0
  138. package/src/themes/shadow-broker-theme.ts +1 -0
  139. package/src/themes/sith-theme.ts +1 -0
  140. package/src/themes/vault-dweller-theme.ts +1 -0
  141. package/src/themes/wild-hunt-theme.ts +1 -0
  142. package/src/themes/xenomorph-theme.ts +1 -0
@@ -1,4 +1,4 @@
1
- import { beforeEach, describe, expect, it } from 'vitest'
1
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest'
2
2
  import { ThemeProviderService } from './theme-provider-service.js'
3
3
 
4
4
  describe('ThemeProviderService', () => {
@@ -19,4 +19,52 @@ describe('ThemeProviderService', () => {
19
19
  expect(service.theme.name).toBe('css-variable-theme')
20
20
  })
21
21
  })
22
+
23
+ describe('setAssignedTheme with custom root', () => {
24
+ let customRoot: HTMLElement
25
+
26
+ beforeEach(() => {
27
+ customRoot = document.createElement('div')
28
+ document.body.appendChild(customRoot)
29
+ })
30
+
31
+ afterEach(() => {
32
+ customRoot.remove()
33
+ document.documentElement.style.cssText = ''
34
+ })
35
+
36
+ it('should apply CSS variables to the provided root element', () => {
37
+ service.setAssignedTheme(
38
+ {
39
+ text: { primary: '#abcdef' },
40
+ palette: { primary: { main: '#123456' } },
41
+ },
42
+ customRoot,
43
+ )
44
+
45
+ expect(customRoot.style.getPropertyValue('--shades-theme-text-primary')).toBe('#abcdef')
46
+ expect(customRoot.style.getPropertyValue('--shades-theme-palette-primary-main')).toBe('#123456')
47
+ expect(document.documentElement.style.getPropertyValue('--shades-theme-text-primary')).toBe('')
48
+ })
49
+
50
+ it('should still update the stored theme when a custom root is provided', () => {
51
+ const theme = { text: { primary: '#111' } }
52
+ service.setAssignedTheme(theme, customRoot)
53
+
54
+ expect(service.getAssignedTheme()).toBe(theme)
55
+ })
56
+
57
+ it('should emit themeChanged when a custom root is provided', () => {
58
+ const theme = { text: { primary: '#222' } }
59
+ let emittedTheme: unknown
60
+
61
+ service.subscribe('themeChanged', (t) => {
62
+ emittedTheme = t
63
+ })
64
+
65
+ service.setAssignedTheme(theme, customRoot)
66
+
67
+ expect(emittedTheme).toBe(theme)
68
+ })
69
+ })
22
70
  })
@@ -85,8 +85,8 @@ export interface Background {
85
85
  default: Color
86
86
  /** Elevated surface background (cards, dialogs, etc.) */
87
87
  paper: Color
88
- /** Optional CSS background-image for paper surfaces (e.g. a tiled texture) */
89
- paperImage?: string
88
+ /** CSS background-image for paper surfaces (e.g. a tiled texture). Use 'none' for no image. */
89
+ paperImage: string
90
90
  }
91
91
 
92
92
  /**
@@ -131,8 +131,8 @@ export type BorderRadiusScale = {
131
131
  export type Shape = {
132
132
  /** Border radius scale */
133
133
  borderRadius: BorderRadiusScale
134
- /** Border width for surface components (paper, card, etc.). Defaults to 0. */
135
- borderWidth?: string
134
+ /** Border width for surface components (paper, card, etc.). Use '0px' for no border. */
135
+ borderWidth: string
136
136
  }
137
137
 
138
138
  /**
@@ -230,9 +230,9 @@ export type ThemeTypography = {
230
230
  /** Line height scale */
231
231
  lineHeight: LineHeightScale
232
232
  /** Letter spacing scale */
233
- letterSpacing?: LetterSpacingScale
234
- /** CSS text-shadow value applied globally to text */
235
- textShadow?: string
233
+ letterSpacing: LetterSpacingScale
234
+ /** CSS text-shadow value applied globally to text. Use 'none' for no shadow. */
235
+ textShadow: string
236
236
  }
237
237
 
238
238
  /**
@@ -358,9 +358,9 @@ export interface Theme {
358
358
  /** Spacing scale */
359
359
  spacing: Spacing
360
360
  /** Z-index stacking layers */
361
- zIndex?: ZIndex
361
+ zIndex: ZIndex
362
362
  /** Visual effect tokens (blur, backdrop) */
363
- effects?: Effects
363
+ effects: Effects
364
364
  }
365
365
 
366
366
  /**
@@ -382,10 +382,11 @@ export class ThemeProviderService extends EventHub<{ themeChanged: DeepPartial<T
382
382
  /**
383
383
  * Assigns a new theme, updates the CSS variables and emits a themeChanged event
384
384
  * @param theme The Theme instance
385
+ * @param root Optional HTML element to scope CSS variables to. Defaults to `:root`.
385
386
  */
386
- public setAssignedTheme(theme: DeepPartial<Theme>) {
387
+ public setAssignedTheme(theme: DeepPartial<Theme>, root?: HTMLElement) {
387
388
  this._assignedTheme = theme
388
- useThemeCssVariables(theme)
389
+ useThemeCssVariables(theme, root)
389
390
  this.emit('themeChanged', theme)
390
391
  }
391
392
  }
@@ -88,6 +88,7 @@ export const architectTheme = {
88
88
  wider: '1.5px',
89
89
  widest: '2.5px',
90
90
  },
91
+ textShadow: 'none',
91
92
  },
92
93
  transitions: {
93
94
  duration: {
@@ -88,6 +88,7 @@ export const auditoreTheme = {
88
88
  wider: '1px',
89
89
  widest: '1.5px',
90
90
  },
91
+ textShadow: 'none',
91
92
  },
92
93
  transitions: {
93
94
  duration: {
@@ -88,6 +88,7 @@ export const blackMesaTheme = {
88
88
  wider: '1.25px',
89
89
  widest: '2px',
90
90
  },
91
+ textShadow: 'none',
91
92
  },
92
93
  transitions: {
93
94
  duration: {
@@ -83,6 +83,7 @@ export const defaultDarkTheme = {
83
83
  wider: '0.5px',
84
84
  widest: '1.5px',
85
85
  },
86
+ textShadow: 'none',
86
87
  },
87
88
  transitions: {
88
89
  duration: {
@@ -83,6 +83,7 @@ export const defaultLightTheme = {
83
83
  wider: '0.5px',
84
84
  widest: '1.5px',
85
85
  },
86
+ textShadow: 'none',
86
87
  },
87
88
  transitions: {
88
89
  duration: {
@@ -88,6 +88,7 @@ export const dragonbornTheme = {
88
88
  wider: '1px',
89
89
  widest: '1.5px',
90
90
  },
91
+ textShadow: 'none',
91
92
  },
92
93
  transitions: {
93
94
  duration: {
@@ -88,6 +88,7 @@ export const hawkinsTheme = {
88
88
  wider: '1px',
89
89
  widest: '2px',
90
90
  },
91
+ textShadow: 'none',
91
92
  },
92
93
  transitions: {
93
94
  duration: {
@@ -88,6 +88,7 @@ export const jediTheme = {
88
88
  wider: '0.75px',
89
89
  widest: '1.5px',
90
90
  },
91
+ textShadow: 'none',
91
92
  },
92
93
  transitions: {
93
94
  duration: {
@@ -85,6 +85,7 @@ export const neonRunnerTheme = {
85
85
  wider: '1.5px',
86
86
  widest: '2.5px',
87
87
  },
88
+ textShadow: 'none',
88
89
  },
89
90
  transitions: {
90
91
  duration: {
@@ -86,6 +86,7 @@ export const plumberTheme = {
86
86
  wider: '1px',
87
87
  widest: '1.5px',
88
88
  },
89
+ textShadow: 'none',
89
90
  },
90
91
  transitions: {
91
92
  duration: {
@@ -88,6 +88,7 @@ export const replicantTheme = {
88
88
  wider: '2px',
89
89
  widest: '3px',
90
90
  },
91
+ textShadow: 'none',
91
92
  },
92
93
  transitions: {
93
94
  duration: {
@@ -88,6 +88,7 @@ export const sandwormTheme = {
88
88
  wider: '1px',
89
89
  widest: '1.5px',
90
90
  },
91
+ textShadow: 'none',
91
92
  },
92
93
  transitions: {
93
94
  duration: {
@@ -86,6 +86,7 @@ export const shadowBrokerTheme = {
86
86
  wider: '1.25px',
87
87
  widest: '2px',
88
88
  },
89
+ textShadow: 'none',
89
90
  },
90
91
  transitions: {
91
92
  duration: {
@@ -88,6 +88,7 @@ export const sithTheme = {
88
88
  wider: '1.5px',
89
89
  widest: '2.5px',
90
90
  },
91
+ textShadow: 'none',
91
92
  },
92
93
  transitions: {
93
94
  duration: {
@@ -88,6 +88,7 @@ export const vaultDwellerTheme = {
88
88
  wider: '1.5px',
89
89
  widest: '2.5px',
90
90
  },
91
+ textShadow: 'none',
91
92
  },
92
93
  transitions: {
93
94
  duration: {
@@ -88,6 +88,7 @@ export const wildHuntTheme = {
88
88
  wider: '1px',
89
89
  widest: '1.5px',
90
90
  },
91
+ textShadow: 'none',
91
92
  },
92
93
  transitions: {
93
94
  duration: {
@@ -86,6 +86,7 @@ export const xenomorphTheme = {
86
86
  wider: '1.25px',
87
87
  widest: '2px',
88
88
  },
89
+ textShadow: 'none',
89
90
  },
90
91
  transitions: {
91
92
  duration: {