@repobuddy/storybook 0.11.0 → 0.11.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from '@just-web/css';
|
|
2
|
+
import type { ThemeVars } from 'storybook/internal/theming';
|
|
2
3
|
/**
|
|
3
4
|
* Configuration parameters for `storybook-dark-mode`.
|
|
4
5
|
*/
|
|
@@ -23,6 +24,10 @@ export interface DarkModeParam {
|
|
|
23
24
|
* This only works when using `withStoryRoot`.
|
|
24
25
|
*/
|
|
25
26
|
lightStyle?: CSSProperties | undefined;
|
|
27
|
+
/** Dark theme variables */
|
|
28
|
+
dark?: ThemeVars;
|
|
29
|
+
/** Light theme variables */
|
|
30
|
+
light?: ThemeVars;
|
|
26
31
|
/** Element to apply theme classes to ('html' or 'body') */
|
|
27
32
|
classTarget?: 'html' | 'body' | undefined;
|
|
28
33
|
/** Whether to apply theme styles to preview iframe */
|
|
@@ -39,7 +39,7 @@ function addClass(target, className) {
|
|
|
39
39
|
if (!className)
|
|
40
40
|
return;
|
|
41
41
|
if (typeof className === 'string') {
|
|
42
|
-
target.classList.add(className);
|
|
42
|
+
target.classList.add(...className.split(' '));
|
|
43
43
|
}
|
|
44
44
|
else if (Array.isArray(className)) {
|
|
45
45
|
target.classList.add(...className);
|
|
@@ -49,7 +49,7 @@ function removeClass(target, className) {
|
|
|
49
49
|
if (!className)
|
|
50
50
|
return;
|
|
51
51
|
if (typeof className === 'string') {
|
|
52
|
-
target.classList.remove(className);
|
|
52
|
+
target.classList.remove(...className.split(' '));
|
|
53
53
|
}
|
|
54
54
|
else if (Array.isArray(className)) {
|
|
55
55
|
target.classList.remove(...className);
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from '@just-web/css'
|
|
2
|
+
import type { ThemeVars } from 'storybook/internal/theming'
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Configuration parameters for `storybook-dark-mode`.
|
|
@@ -24,6 +25,10 @@ export interface DarkModeParam {
|
|
|
24
25
|
* This only works when using `withStoryRoot`.
|
|
25
26
|
*/
|
|
26
27
|
lightStyle?: CSSProperties | undefined
|
|
28
|
+
/** Dark theme variables */
|
|
29
|
+
dark?: ThemeVars
|
|
30
|
+
/** Light theme variables */
|
|
31
|
+
light?: ThemeVars
|
|
27
32
|
/** Element to apply theme classes to ('html' or 'body') */
|
|
28
33
|
classTarget?: 'html' | 'body' | undefined
|
|
29
34
|
/** Whether to apply theme styles to preview iframe */
|
|
@@ -58,7 +58,7 @@ export function withDarkMode(
|
|
|
58
58
|
function addClass(target: HTMLElement, className: string | string[] | undefined) {
|
|
59
59
|
if (!className) return
|
|
60
60
|
if (typeof className === 'string') {
|
|
61
|
-
target.classList.add(className)
|
|
61
|
+
target.classList.add(...className.split(' '))
|
|
62
62
|
} else if (Array.isArray(className)) {
|
|
63
63
|
target.classList.add(...className)
|
|
64
64
|
}
|
|
@@ -67,7 +67,7 @@ function addClass(target: HTMLElement, className: string | string[] | undefined)
|
|
|
67
67
|
function removeClass(target: HTMLElement, className: string | string[] | undefined) {
|
|
68
68
|
if (!className) return
|
|
69
69
|
if (typeof className === 'string') {
|
|
70
|
-
target.classList.remove(className)
|
|
70
|
+
target.classList.remove(...className.split(' '))
|
|
71
71
|
} else if (Array.isArray(className)) {
|
|
72
72
|
target.classList.remove(...className)
|
|
73
73
|
}
|