@sap-ux/control-property-editor 0.5.0 → 0.5.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.
- package/CHANGELOG.md +12 -0
- package/dist/app.css +1 -1
- package/dist/app.css.map +3 -3
- package/dist/app.js +55 -58
- package/dist/app.js.map +3 -3
- package/package.json +3 -3
- package/src/components/ThemeSelectorCallout.scss +6 -6
- package/src/components/ThemeSelectorCallout.tsx +9 -20
- package/src/index.css +506 -449
- package/src/index.tsx +0 -5
- package/src/panels/LeftPanel.tsx +2 -1
- package/src/panels/changes/ChangesPanel.module.scss +1 -4
- package/src/panels/changes/ChangesPanel.tsx +1 -1
- package/src/panels/outline/OutlinePanel.scss +4 -3
- package/src/panels/outline/Tree.tsx +14 -3
- package/src/use-theme.ts +19 -0
- package/test/unit/toolbar/ThemeSelector.test.tsx +7 -7
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"displayName": "Control Property Editor",
|
|
4
4
|
"description": "Control Property Editor",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"version": "0.5.
|
|
6
|
+
"version": "0.5.2",
|
|
7
7
|
"main": "dist/app.js",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"autoprefixer": "10.4.7",
|
|
50
50
|
"postcss": "8.4.31",
|
|
51
51
|
"yargs-parser": "21.1.1",
|
|
52
|
-
"@sap-ux
|
|
53
|
-
"@sap-ux/
|
|
52
|
+
"@sap-ux/ui-components": "1.18.0",
|
|
53
|
+
"@sap-ux-private/control-property-editor-common": "0.5.0"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"clean": "rimraf --glob dist coverage *.tsbuildinfo",
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
#theme-light {
|
|
1
|
+
#theme-light-modern {
|
|
2
2
|
border-radius: 50%;
|
|
3
3
|
width: 14px;
|
|
4
4
|
height: 14px;
|
|
5
5
|
background: #ffffff;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
#theme-dark {
|
|
8
|
+
#theme-dark-modern {
|
|
9
9
|
border-radius: 50%;
|
|
10
10
|
width: 14px;
|
|
11
11
|
height: 14px;
|
|
12
12
|
background-color: #3c3c3c;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
#theme-high-contrast {
|
|
15
|
+
#theme-high-contrast-black {
|
|
16
16
|
border-radius: 50%;
|
|
17
17
|
width: 14px;
|
|
18
18
|
height: 14px;
|
|
@@ -46,16 +46,16 @@
|
|
|
46
46
|
background-color: var(--vscode-progressBar-background);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
div#theme-light {
|
|
49
|
+
div#theme-light-modern {
|
|
50
50
|
margin-left: 3px;
|
|
51
51
|
margin-bottom: 3px;
|
|
52
52
|
margin-top: 3px;
|
|
53
53
|
}
|
|
54
|
-
div#theme-dark {
|
|
54
|
+
div#theme-dark-modern {
|
|
55
55
|
margin-left: 3px;
|
|
56
56
|
margin-top: 3px;
|
|
57
57
|
}
|
|
58
|
-
div#theme-high-contrast {
|
|
58
|
+
div#theme-high-contrast-black {
|
|
59
59
|
margin-left: 3px;
|
|
60
60
|
margin-top: 3px;
|
|
61
61
|
}
|
|
@@ -6,8 +6,8 @@ import { useTranslation } from 'react-i18next';
|
|
|
6
6
|
|
|
7
7
|
import './ThemeSelectorCallout.scss';
|
|
8
8
|
import { IconName } from '../icons';
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import { useTheme } from '../use-theme';
|
|
10
|
+
import type { ThemeName } from '../use-theme';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* React element for theme selector.
|
|
@@ -17,35 +17,24 @@ export type ThemeName = 'dark' | 'light' | 'high contrast';
|
|
|
17
17
|
export function ThemeSelectorCallout(): ReactElement {
|
|
18
18
|
const { t } = useTranslation();
|
|
19
19
|
const [isCalloutVisible, setValue] = useState(false);
|
|
20
|
-
const theme =
|
|
21
|
-
const [currentTheme, setTheme] = useState(theme);
|
|
20
|
+
const [theme, setTheme] = useTheme();
|
|
22
21
|
const buttonId = useId('callout-button');
|
|
23
22
|
const initialFocusRoot = useRef<HTMLElement | null>(null);
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @param newTheme - ThemeName
|
|
28
|
-
*/
|
|
29
|
-
function updateTheme(newTheme: ThemeName): void {
|
|
30
|
-
setTheme(newTheme);
|
|
31
|
-
localStorage.setItem('theme', newTheme);
|
|
32
|
-
setThemeOnDocument(newTheme);
|
|
33
|
-
}
|
|
34
23
|
interface ThemeButtonProps {
|
|
35
|
-
name:
|
|
24
|
+
name: ThemeName;
|
|
36
25
|
tooltip: string;
|
|
37
26
|
}
|
|
38
27
|
const themes: ThemeButtonProps[] = [
|
|
39
28
|
{
|
|
40
|
-
name: 'light',
|
|
29
|
+
name: 'light modern',
|
|
41
30
|
tooltip: 'LIGHT_THEME_NAME'
|
|
42
31
|
},
|
|
43
32
|
{
|
|
44
|
-
name: 'dark',
|
|
33
|
+
name: 'dark modern',
|
|
45
34
|
tooltip: 'DARK_THEME_NAME'
|
|
46
35
|
},
|
|
47
36
|
{
|
|
48
|
-
name: 'high contrast',
|
|
37
|
+
name: 'high contrast black',
|
|
49
38
|
tooltip: 'HIGH_CONTRAST_THEME_NAME'
|
|
50
39
|
}
|
|
51
40
|
];
|
|
@@ -59,7 +48,7 @@ export function ThemeSelectorCallout(): ReactElement {
|
|
|
59
48
|
function createThemeButton(themeButtonProps: ThemeButtonProps): ReactElement {
|
|
60
49
|
const { name, tooltip } = themeButtonProps;
|
|
61
50
|
const nameSlug = name.replace(/ /g, '-');
|
|
62
|
-
const isCurrentTheme =
|
|
51
|
+
const isCurrentTheme = theme === name;
|
|
63
52
|
return (
|
|
64
53
|
<div
|
|
65
54
|
data-is-focusable={true}
|
|
@@ -74,7 +63,7 @@ export function ThemeSelectorCallout(): ReactElement {
|
|
|
74
63
|
role="button"
|
|
75
64
|
aria-pressed={isCurrentTheme}
|
|
76
65
|
onClick={(): void => {
|
|
77
|
-
|
|
66
|
+
setTheme(name);
|
|
78
67
|
}}>
|
|
79
68
|
<div id={`theme-${nameSlug}`}></div>
|
|
80
69
|
</div>
|