@splunk/themes 0.9.0 → 0.10.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 +5 -0
- package/getTheme.js +19 -1
- package/package.json +1 -1
- package/types/storybook-addon-splunk-themes/SplunkThemesTool.d.ts +2 -1
- package/types/types.d.ts +8 -0
- package/types/useSplunkTheme.d.ts +2 -2
- package/types/utils.d.ts +1 -1
- package/useSplunkTheme.js +2 -2
- package/utils.js +20 -2
- package/withSplunkTheme.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
Change Log
|
|
2
2
|
============
|
|
3
3
|
|
|
4
|
+
0.10.0 - February 23, 2022
|
|
5
|
+
----------
|
|
6
|
+
New Features:
|
|
7
|
+
* Utility variables, `isPrisma`, `isEnterprise`, `isComfortable`, `isCompact`, `isDark`, and `isLight`, added to `useSplunkTheme()` and `withSplunkTheme()` (SUI-2376).
|
|
8
|
+
|
|
4
9
|
0.9.0 - September 8, 2021
|
|
5
10
|
----------
|
|
6
11
|
API Changes:
|
package/getTheme.js
CHANGED
|
@@ -41,6 +41,12 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
41
41
|
* @param {'prisma' | 'enterprise'} [options.family = 'prisma']
|
|
42
42
|
* @param {'dark' | 'light'} [options.colorScheme = 'dark']
|
|
43
43
|
* @param {'comfortable' | 'compact'} [options.density = 'comfortable']
|
|
44
|
+
* @param {Boolean} [options.isPrisma = true]
|
|
45
|
+
* @param {Boolean} [options.isEnterprise = false]
|
|
46
|
+
* @param {Boolean} [options.isComfortable = true]
|
|
47
|
+
* @param {Boolean} [options.isCompact = false]
|
|
48
|
+
* @param {Boolean} [options.isDark = true]
|
|
49
|
+
* @param {Boolean} [options.isLight = false]
|
|
44
50
|
* @returns {object} A flat object of all variables and their values.
|
|
45
51
|
* @public
|
|
46
52
|
*/
|
|
@@ -52,10 +58,22 @@ function getTheme() {
|
|
|
52
58
|
colorScheme = _addThemeDefaults.colorScheme,
|
|
53
59
|
density = _addThemeDefaults.density;
|
|
54
60
|
|
|
61
|
+
var isPrisma = family === 'prisma';
|
|
62
|
+
var isEnterprise = family === 'enterprise';
|
|
63
|
+
var isComfortable = density === 'comfortable';
|
|
64
|
+
var isCompact = density === 'compact';
|
|
65
|
+
var isDark = colorScheme === 'dark';
|
|
66
|
+
var isLight = colorScheme === 'light';
|
|
55
67
|
return Object.freeze(_objectSpread({
|
|
56
68
|
colorScheme: colorScheme,
|
|
57
69
|
density: density,
|
|
58
|
-
family: family
|
|
70
|
+
family: family,
|
|
71
|
+
isPrisma: isPrisma,
|
|
72
|
+
isEnterprise: isEnterprise,
|
|
73
|
+
isComfortable: isComfortable,
|
|
74
|
+
isCompact: isCompact,
|
|
75
|
+
isDark: isDark,
|
|
76
|
+
isLight: isLight
|
|
59
77
|
}, family === 'enterprise' ? (0, _enterprise["default"])({
|
|
60
78
|
colorScheme: colorScheme,
|
|
61
79
|
density: density
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splunk/themes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Theme variables and mixins for the Splunk design language",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "cross-env NODE_ENV=production babel src -d . --ignore src/babel-plugin-base64-png,src/tests --extensions .js,.ts,.tsx && yarn types:build",
|
|
@@ -4,6 +4,7 @@ declare type ThemeOption = {
|
|
|
4
4
|
name: string;
|
|
5
5
|
values: string[];
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
declare type ThemeOptions = Pick<Record<keyof ThemeSettings, ThemeOption>, 'family' | 'colorScheme' | 'density'>;
|
|
8
|
+
export declare const themeOptions: ThemeOptions;
|
|
8
9
|
export declare const SplunkThemesTool: FunctionComponent;
|
|
9
10
|
export {};
|
package/types/types.d.ts
CHANGED
|
@@ -6,15 +6,23 @@ declare type Density = 'comfortable' | 'compact';
|
|
|
6
6
|
interface ThemeSettingsBase {
|
|
7
7
|
colorScheme: ColorScheme;
|
|
8
8
|
density: Density;
|
|
9
|
+
isPrisma: boolean;
|
|
10
|
+
isEnterprise: boolean;
|
|
11
|
+
isComfortable: boolean;
|
|
12
|
+
isCompact: boolean;
|
|
13
|
+
isDark: boolean;
|
|
14
|
+
isLight: boolean;
|
|
9
15
|
}
|
|
10
16
|
interface ThemeSettings<T extends AnyTheme = AnyTheme> extends ThemeSettingsBase {
|
|
11
17
|
family: T extends Enterprise ? 'enterprise' : 'prisma';
|
|
12
18
|
}
|
|
13
19
|
declare type Enterprise = EnterpriseVariables & ThemeSettingsBase & {
|
|
14
20
|
family: 'enterprise';
|
|
21
|
+
isEnterprise: true;
|
|
15
22
|
};
|
|
16
23
|
declare type Prisma = PrismaVariables & ThemeSettingsBase & {
|
|
17
24
|
family: 'prisma';
|
|
25
|
+
isPrisma: true;
|
|
18
26
|
};
|
|
19
27
|
declare type CustomizeTheme<T extends AnyTheme = AnyTheme> = {
|
|
20
28
|
bivarianceHack(theme: T): T;
|
|
@@ -10,11 +10,11 @@ import { AnyTheme } from './types';
|
|
|
10
10
|
* import useSplunkTheme from '@splunk/themes/useSplunkTheme';
|
|
11
11
|
* ...
|
|
12
12
|
* export function() {
|
|
13
|
-
* const {
|
|
13
|
+
* const { isComfortable, focusColor } = useSplunkTheme();
|
|
14
14
|
*
|
|
15
15
|
* const style = {
|
|
16
16
|
* color: focusColor,
|
|
17
|
-
* padding:
|
|
17
|
+
* padding: isComfortable ? '10px' : '5px',
|
|
18
18
|
* }
|
|
19
19
|
*
|
|
20
20
|
* ...
|
package/types/utils.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ThemeSettings, CustomizeTheme, AnyTheme } from './types';
|
|
|
4
4
|
* Accepts a theme object and returns supported values and defaults.
|
|
5
5
|
* @private
|
|
6
6
|
*/
|
|
7
|
-
export declare const addThemeDefaults: ({ family, colorScheme, density, }?: Partial<ThemeSettings>) => ThemeSettings;
|
|
7
|
+
export declare const addThemeDefaults: ({ family, colorScheme, density, isPrisma, isEnterprise, isComfortable, isCompact, isDark, isLight, }?: Partial<ThemeSettings>) => ThemeSettings;
|
|
8
8
|
declare function getCustomizedThemeUnmemo<T extends AnyTheme>(settings?: Partial<ThemeSettings<T>>, customizer?: CustomizeTheme<T>): T;
|
|
9
9
|
/**
|
|
10
10
|
* Accepts a theme object and customizer, and returns supported values and defaults.
|
package/useSplunkTheme.js
CHANGED
|
@@ -32,11 +32,11 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
32
32
|
* import useSplunkTheme from '@splunk/themes/useSplunkTheme';
|
|
33
33
|
* ...
|
|
34
34
|
* export function() {
|
|
35
|
-
* const {
|
|
35
|
+
* const { isComfortable, focusColor } = useSplunkTheme();
|
|
36
36
|
*
|
|
37
37
|
* const style = {
|
|
38
38
|
* color: focusColor,
|
|
39
|
-
* padding:
|
|
39
|
+
* padding: isComfortable ? '10px' : '5px',
|
|
40
40
|
* }
|
|
41
41
|
*
|
|
42
42
|
* ...
|
package/utils.js
CHANGED
|
@@ -22,12 +22,30 @@ var addThemeDefaults = function addThemeDefaults() {
|
|
|
22
22
|
_ref$colorScheme = _ref.colorScheme,
|
|
23
23
|
colorScheme = _ref$colorScheme === void 0 ? 'dark' : _ref$colorScheme,
|
|
24
24
|
_ref$density = _ref.density,
|
|
25
|
-
density = _ref$density === void 0 ? 'comfortable' : _ref$density
|
|
25
|
+
density = _ref$density === void 0 ? 'comfortable' : _ref$density,
|
|
26
|
+
_ref$isPrisma = _ref.isPrisma,
|
|
27
|
+
isPrisma = _ref$isPrisma === void 0 ? true : _ref$isPrisma,
|
|
28
|
+
_ref$isEnterprise = _ref.isEnterprise,
|
|
29
|
+
isEnterprise = _ref$isEnterprise === void 0 ? false : _ref$isEnterprise,
|
|
30
|
+
_ref$isComfortable = _ref.isComfortable,
|
|
31
|
+
isComfortable = _ref$isComfortable === void 0 ? true : _ref$isComfortable,
|
|
32
|
+
_ref$isCompact = _ref.isCompact,
|
|
33
|
+
isCompact = _ref$isCompact === void 0 ? false : _ref$isCompact,
|
|
34
|
+
_ref$isDark = _ref.isDark,
|
|
35
|
+
isDark = _ref$isDark === void 0 ? true : _ref$isDark,
|
|
36
|
+
_ref$isLight = _ref.isLight,
|
|
37
|
+
isLight = _ref$isLight === void 0 ? false : _ref$isLight;
|
|
26
38
|
|
|
27
39
|
return {
|
|
28
40
|
family: family,
|
|
29
41
|
colorScheme: colorScheme,
|
|
30
|
-
density: density
|
|
42
|
+
density: density,
|
|
43
|
+
isPrisma: isPrisma,
|
|
44
|
+
isEnterprise: isEnterprise,
|
|
45
|
+
isComfortable: isComfortable,
|
|
46
|
+
isCompact: isCompact,
|
|
47
|
+
isDark: isDark,
|
|
48
|
+
isLight: isLight
|
|
31
49
|
};
|
|
32
50
|
};
|
|
33
51
|
|
package/withSplunkTheme.js
CHANGED
|
@@ -50,11 +50,11 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
50
50
|
* };
|
|
51
51
|
*
|
|
52
52
|
* render() {
|
|
53
|
-
* const {
|
|
53
|
+
* const { isComfortable, focusColor } = this.props.splunkTheme;
|
|
54
54
|
*
|
|
55
55
|
* const style = {
|
|
56
56
|
* color: focusColor,
|
|
57
|
-
* padding:
|
|
57
|
+
* padding: isComfortable ? '10px' : '5px',
|
|
58
58
|
* }
|
|
59
59
|
*
|
|
60
60
|
* return (
|