@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.
- package/CHANGELOG.md +39 -0
- package/esm/components/app-bar.d.ts.map +1 -1
- package/esm/components/app-bar.js +12 -3
- package/esm/components/app-bar.js.map +1 -1
- package/esm/components/avatar.d.ts.map +1 -1
- package/esm/components/avatar.js +3 -5
- package/esm/components/avatar.js.map +1 -1
- package/esm/components/command-palette/command-palette-input.d.ts +1 -2
- package/esm/components/command-palette/command-palette-input.d.ts.map +1 -1
- package/esm/components/command-palette/command-palette-input.js +14 -36
- package/esm/components/command-palette/command-palette-input.js.map +1 -1
- package/esm/components/command-palette/command-palette-input.spec.js +14 -116
- package/esm/components/command-palette/command-palette-input.spec.js.map +1 -1
- package/esm/components/command-palette/index.d.ts.map +1 -1
- package/esm/components/command-palette/index.js +3 -0
- package/esm/components/command-palette/index.js.map +1 -1
- package/esm/components/drawer/index.d.ts.map +1 -1
- package/esm/components/drawer/index.js +4 -0
- package/esm/components/drawer/index.js.map +1 -1
- package/esm/components/drawer/index.spec.js +47 -0
- package/esm/components/drawer/index.spec.js.map +1 -1
- package/esm/components/noty-list.d.ts.map +1 -1
- package/esm/components/noty-list.js +1 -3
- package/esm/components/noty-list.js.map +1 -1
- package/esm/services/css-variable-theme.d.ts +1 -1
- package/esm/services/css-variable-theme.d.ts.map +1 -1
- package/esm/services/css-variable-theme.js +5 -5
- package/esm/services/css-variable-theme.js.map +1 -1
- package/esm/services/css-variable-theme.spec.js +29 -1
- package/esm/services/css-variable-theme.spec.js.map +1 -1
- package/esm/services/layout-service.d.ts +8 -0
- package/esm/services/layout-service.d.ts.map +1 -1
- package/esm/services/layout-service.js +16 -0
- package/esm/services/layout-service.js.map +1 -1
- package/esm/services/layout-service.spec.js +55 -0
- package/esm/services/layout-service.spec.js.map +1 -1
- package/esm/services/theme-provider-service.d.ts +11 -10
- package/esm/services/theme-provider-service.d.ts.map +1 -1
- package/esm/services/theme-provider-service.js +3 -2
- package/esm/services/theme-provider-service.js.map +1 -1
- package/esm/services/theme-provider-service.spec.js +35 -1
- package/esm/services/theme-provider-service.spec.js.map +1 -1
- package/esm/themes/architect-theme.d.ts +1 -0
- package/esm/themes/architect-theme.d.ts.map +1 -1
- package/esm/themes/architect-theme.js +1 -0
- package/esm/themes/architect-theme.js.map +1 -1
- package/esm/themes/auditore-theme.d.ts +1 -0
- package/esm/themes/auditore-theme.d.ts.map +1 -1
- package/esm/themes/auditore-theme.js +1 -0
- package/esm/themes/auditore-theme.js.map +1 -1
- package/esm/themes/black-mesa-theme.d.ts +1 -0
- package/esm/themes/black-mesa-theme.d.ts.map +1 -1
- package/esm/themes/black-mesa-theme.js +1 -0
- package/esm/themes/black-mesa-theme.js.map +1 -1
- package/esm/themes/default-dark-theme.d.ts +1 -0
- package/esm/themes/default-dark-theme.d.ts.map +1 -1
- package/esm/themes/default-dark-theme.js +1 -0
- package/esm/themes/default-dark-theme.js.map +1 -1
- package/esm/themes/default-light-theme.d.ts +1 -0
- package/esm/themes/default-light-theme.d.ts.map +1 -1
- package/esm/themes/default-light-theme.js +1 -0
- package/esm/themes/default-light-theme.js.map +1 -1
- package/esm/themes/dragonborn-theme.d.ts +1 -0
- package/esm/themes/dragonborn-theme.d.ts.map +1 -1
- package/esm/themes/dragonborn-theme.js +1 -0
- package/esm/themes/dragonborn-theme.js.map +1 -1
- package/esm/themes/hawkins-theme.d.ts +1 -0
- package/esm/themes/hawkins-theme.d.ts.map +1 -1
- package/esm/themes/hawkins-theme.js +1 -0
- package/esm/themes/hawkins-theme.js.map +1 -1
- package/esm/themes/jedi-theme.d.ts +1 -0
- package/esm/themes/jedi-theme.d.ts.map +1 -1
- package/esm/themes/jedi-theme.js +1 -0
- package/esm/themes/jedi-theme.js.map +1 -1
- package/esm/themes/neon-runner-theme.d.ts +1 -0
- package/esm/themes/neon-runner-theme.d.ts.map +1 -1
- package/esm/themes/neon-runner-theme.js +1 -0
- package/esm/themes/neon-runner-theme.js.map +1 -1
- package/esm/themes/plumber-theme.d.ts +1 -0
- package/esm/themes/plumber-theme.d.ts.map +1 -1
- package/esm/themes/plumber-theme.js +1 -0
- package/esm/themes/plumber-theme.js.map +1 -1
- package/esm/themes/replicant-theme.d.ts +1 -0
- package/esm/themes/replicant-theme.d.ts.map +1 -1
- package/esm/themes/replicant-theme.js +1 -0
- package/esm/themes/replicant-theme.js.map +1 -1
- package/esm/themes/sandworm-theme.d.ts +1 -0
- package/esm/themes/sandworm-theme.d.ts.map +1 -1
- package/esm/themes/sandworm-theme.js +1 -0
- package/esm/themes/sandworm-theme.js.map +1 -1
- package/esm/themes/shadow-broker-theme.d.ts +1 -0
- package/esm/themes/shadow-broker-theme.d.ts.map +1 -1
- package/esm/themes/shadow-broker-theme.js +1 -0
- package/esm/themes/shadow-broker-theme.js.map +1 -1
- package/esm/themes/sith-theme.d.ts +1 -0
- package/esm/themes/sith-theme.d.ts.map +1 -1
- package/esm/themes/sith-theme.js +1 -0
- package/esm/themes/sith-theme.js.map +1 -1
- package/esm/themes/vault-dweller-theme.d.ts +1 -0
- package/esm/themes/vault-dweller-theme.d.ts.map +1 -1
- package/esm/themes/vault-dweller-theme.js +1 -0
- package/esm/themes/vault-dweller-theme.js.map +1 -1
- package/esm/themes/wild-hunt-theme.d.ts +1 -0
- package/esm/themes/wild-hunt-theme.d.ts.map +1 -1
- package/esm/themes/wild-hunt-theme.js +1 -0
- package/esm/themes/wild-hunt-theme.js.map +1 -1
- package/esm/themes/xenomorph-theme.d.ts +1 -0
- package/esm/themes/xenomorph-theme.d.ts.map +1 -1
- package/esm/themes/xenomorph-theme.js +1 -0
- package/esm/themes/xenomorph-theme.js.map +1 -1
- package/package.json +1 -1
- package/src/components/app-bar.tsx +12 -3
- package/src/components/avatar.tsx +20 -5
- package/src/components/command-palette/command-palette-input.spec.tsx +14 -156
- package/src/components/command-palette/command-palette-input.tsx +13 -45
- package/src/components/command-palette/index.tsx +4 -0
- package/src/components/drawer/index.spec.tsx +64 -0
- package/src/components/drawer/index.tsx +5 -0
- package/src/components/noty-list.tsx +1 -3
- package/src/services/css-variable-theme.spec.ts +43 -1
- package/src/services/css-variable-theme.ts +5 -5
- package/src/services/layout-service.spec.ts +74 -0
- package/src/services/layout-service.ts +18 -0
- package/src/services/theme-provider-service.spec.ts +49 -1
- package/src/services/theme-provider-service.ts +12 -11
- package/src/themes/architect-theme.ts +1 -0
- package/src/themes/auditore-theme.ts +1 -0
- package/src/themes/black-mesa-theme.ts +1 -0
- package/src/themes/default-dark-theme.ts +1 -0
- package/src/themes/default-light-theme.ts +1 -0
- package/src/themes/dragonborn-theme.ts +1 -0
- package/src/themes/hawkins-theme.ts +1 -0
- package/src/themes/jedi-theme.ts +1 -0
- package/src/themes/neon-runner-theme.ts +1 -0
- package/src/themes/plumber-theme.ts +1 -0
- package/src/themes/replicant-theme.ts +1 -0
- package/src/themes/sandworm-theme.ts +1 -0
- package/src/themes/shadow-broker-theme.ts +1 -0
- package/src/themes/sith-theme.ts +1 -0
- package/src/themes/vault-dweller-theme.ts +1 -0
- package/src/themes/wild-hunt-theme.ts +1 -0
- 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
|
-
/**
|
|
89
|
-
paperImage
|
|
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.).
|
|
135
|
-
borderWidth
|
|
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
|
|
234
|
-
/** CSS text-shadow value applied globally to text */
|
|
235
|
-
textShadow
|
|
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
|
|
361
|
+
zIndex: ZIndex
|
|
362
362
|
/** Visual effect tokens (blur, backdrop) */
|
|
363
|
-
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
|
}
|
package/src/themes/jedi-theme.ts
CHANGED
package/src/themes/sith-theme.ts
CHANGED