@sap-ux/control-property-editor 0.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/.eslintignore +1 -0
- package/.eslintrc.js +16 -0
- package/CHANGELOG.md +7 -0
- package/LICENSE +201 -0
- package/README.md +16 -0
- package/dist/app.css +2 -0
- package/dist/app.css.map +7 -0
- package/dist/app.js +347 -0
- package/dist/app.js.map +7 -0
- package/esbuild.js +25 -0
- package/jest.config.js +20 -0
- package/package.json +68 -0
- package/src/App.scss +57 -0
- package/src/App.tsx +136 -0
- package/src/Workarounds.scss +79 -0
- package/src/actions.ts +3 -0
- package/src/components/AppLogo.module.scss +8 -0
- package/src/components/AppLogo.tsx +75 -0
- package/src/components/ChangeIndicator.tsx +80 -0
- package/src/components/Separator.tsx +32 -0
- package/src/components/ThemeSelectorCallout.scss +48 -0
- package/src/components/ThemeSelectorCallout.tsx +125 -0
- package/src/components/ToolBar.scss +39 -0
- package/src/components/ToolBar.tsx +26 -0
- package/src/components/index.ts +4 -0
- package/src/devices.ts +18 -0
- package/src/global.d.ts +4 -0
- package/src/i18n/i18n.json +68 -0
- package/src/i18n.ts +25 -0
- package/src/icons.tsx +198 -0
- package/src/index.css +1288 -0
- package/src/index.tsx +47 -0
- package/src/middleware.ts +54 -0
- package/src/panels/LeftPanel.scss +17 -0
- package/src/panels/LeftPanel.tsx +48 -0
- package/src/panels/changes/ChangeStack.module.scss +3 -0
- package/src/panels/changes/ChangeStack.tsx +219 -0
- package/src/panels/changes/ChangeStackHeader.tsx +43 -0
- package/src/panels/changes/ChangesPanel.module.scss +18 -0
- package/src/panels/changes/ChangesPanel.tsx +90 -0
- package/src/panels/changes/ControlGroup.module.scss +17 -0
- package/src/panels/changes/ControlGroup.tsx +61 -0
- package/src/panels/changes/PropertyChange.module.scss +24 -0
- package/src/panels/changes/PropertyChange.tsx +159 -0
- package/src/panels/changes/UnknownChange.module.scss +46 -0
- package/src/panels/changes/UnknownChange.tsx +96 -0
- package/src/panels/changes/index.tsx +3 -0
- package/src/panels/changes/utils.ts +36 -0
- package/src/panels/index.ts +2 -0
- package/src/panels/outline/Funnel.tsx +64 -0
- package/src/panels/outline/NoControlFound.tsx +45 -0
- package/src/panels/outline/OutlinePanel.scss +98 -0
- package/src/panels/outline/OutlinePanel.tsx +38 -0
- package/src/panels/outline/Tree.tsx +393 -0
- package/src/panels/outline/index.ts +1 -0
- package/src/panels/outline/utils.ts +154 -0
- package/src/panels/properties/Clipboard.tsx +44 -0
- package/src/panels/properties/DeviceSelector.tsx +40 -0
- package/src/panels/properties/DeviceToggle.tsx +39 -0
- package/src/panels/properties/DropdownEditor.tsx +80 -0
- package/src/panels/properties/Funnel.tsx +64 -0
- package/src/panels/properties/HeaderField.tsx +150 -0
- package/src/panels/properties/IconValueHelp.tsx +203 -0
- package/src/panels/properties/InputTypeSelector.tsx +20 -0
- package/src/panels/properties/InputTypeToggle.module.scss +4 -0
- package/src/panels/properties/InputTypeToggle.tsx +79 -0
- package/src/panels/properties/InputTypeWrapper.tsx +259 -0
- package/src/panels/properties/NoControlSelected.tsx +38 -0
- package/src/panels/properties/Properties.scss +102 -0
- package/src/panels/properties/PropertiesList.tsx +162 -0
- package/src/panels/properties/PropertiesPanel.tsx +30 -0
- package/src/panels/properties/PropertyDocumentation.module.scss +81 -0
- package/src/panels/properties/PropertyDocumentation.tsx +174 -0
- package/src/panels/properties/SapUiIcon.scss +109 -0
- package/src/panels/properties/StringEditor.tsx +122 -0
- package/src/panels/properties/ViewChanger.module.scss +5 -0
- package/src/panels/properties/ViewChanger.tsx +143 -0
- package/src/panels/properties/constants.ts +2 -0
- package/src/panels/properties/index.tsx +1 -0
- package/src/panels/properties/propertyValuesCache.ts +39 -0
- package/src/panels/properties/types.ts +49 -0
- package/src/slice.ts +216 -0
- package/src/store.ts +19 -0
- package/src/use-local-storage.ts +40 -0
- package/src/use-window-size.ts +39 -0
- package/src/variables.scss +2 -0
- package/test/unit/App.test.tsx +207 -0
- package/test/unit/appIndex.test.ts +23 -0
- package/test/unit/components/ChangeIndicator.test.tsx +120 -0
- package/test/unit/components/ThemeSelector.test.tsx +41 -0
- package/test/unit/middleware.test.ts +116 -0
- package/test/unit/panels/changes/ChangesPanel.test.tsx +261 -0
- package/test/unit/panels/changes/utils.test.ts +40 -0
- package/test/unit/panels/outline/OutlinePanel.test.tsx +353 -0
- package/test/unit/panels/outline/__snapshots__/utils.test.ts.snap +36 -0
- package/test/unit/panels/outline/utils.test.ts +83 -0
- package/test/unit/panels/properties/Clipboard.test.tsx +18 -0
- package/test/unit/panels/properties/DropdownEditor.test.tsx +62 -0
- package/test/unit/panels/properties/Funnel.test.tsx +34 -0
- package/test/unit/panels/properties/HeaderField.test.tsx +36 -0
- package/test/unit/panels/properties/IconValueHelp.test.tsx +60 -0
- package/test/unit/panels/properties/InputTypeToggle.test.tsx +126 -0
- package/test/unit/panels/properties/InputTypeWrapper.test.tsx +430 -0
- package/test/unit/panels/properties/PropertyDocumentation.test.tsx +131 -0
- package/test/unit/panels/properties/StringEditor.test.tsx +107 -0
- package/test/unit/panels/properties/ViewChanger.test.tsx +190 -0
- package/test/unit/panels/properties/propertyValuesCache.test.ts +23 -0
- package/test/unit/slice.test.ts +268 -0
- package/test/unit/utils.tsx +67 -0
- package/test/utils/utils.tsx +25 -0
- package/tsconfig.eslint.json +4 -0
- package/tsconfig.json +39 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { UIIconButton, UiIcons, UICallout } from '@sap-ux/ui-components';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import { useId } from '@fluentui/react-hooks';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
|
|
7
|
+
import './ThemeSelectorCallout.scss';
|
|
8
|
+
|
|
9
|
+
export type ThemeName = 'dark' | 'light' | 'high contrast';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* React element for theme selector.
|
|
13
|
+
*
|
|
14
|
+
* @returns ReactElement
|
|
15
|
+
*/
|
|
16
|
+
export function ThemeSelectorCallout(): ReactElement {
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
const [isCalloutVisible, setValue] = useState(false);
|
|
19
|
+
const theme = localStorage.getItem('theme') ?? 'dark';
|
|
20
|
+
const [currentTheme, setTheme] = useState(theme);
|
|
21
|
+
const buttonId = useId('callout-button');
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param newTheme - ThemeName
|
|
26
|
+
*/
|
|
27
|
+
function updateTheme(newTheme: ThemeName): void {
|
|
28
|
+
setTheme(newTheme);
|
|
29
|
+
localStorage.setItem('theme', newTheme);
|
|
30
|
+
setThemeOnDocument(newTheme);
|
|
31
|
+
}
|
|
32
|
+
interface ThemeButtonProps {
|
|
33
|
+
name: string;
|
|
34
|
+
tooltip: string;
|
|
35
|
+
}
|
|
36
|
+
const themes: ThemeButtonProps[] = [
|
|
37
|
+
{
|
|
38
|
+
name: 'light',
|
|
39
|
+
tooltip: 'LIGHT_THEME_NAME'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'dark',
|
|
43
|
+
tooltip: 'DARK_THEME_NAME'
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'high contrast',
|
|
47
|
+
tooltip: 'HIGH_CONTRAST_THEME_NAME'
|
|
48
|
+
}
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* React element for theme button.
|
|
53
|
+
*
|
|
54
|
+
* @param themeButtonProps - ThemeButtonProps
|
|
55
|
+
* @returns ReactElement
|
|
56
|
+
*/
|
|
57
|
+
function createThemeButton(themeButtonProps: ThemeButtonProps): ReactElement {
|
|
58
|
+
const { name, tooltip } = themeButtonProps;
|
|
59
|
+
const nameSlug = name.replace(/ /g, '-');
|
|
60
|
+
const isCurrentTheme = currentTheme === name;
|
|
61
|
+
return (
|
|
62
|
+
<div
|
|
63
|
+
id={`theme-${nameSlug}-rect`}
|
|
64
|
+
key={name}
|
|
65
|
+
title={t(tooltip)}
|
|
66
|
+
className={`theme-child${isCurrentTheme ? ' selected' : ''}`}
|
|
67
|
+
style={{
|
|
68
|
+
pointerEvents: 'auto',
|
|
69
|
+
cursor: 'pointer'
|
|
70
|
+
}}
|
|
71
|
+
role="button"
|
|
72
|
+
aria-pressed={isCurrentTheme}
|
|
73
|
+
onClick={(): void => {
|
|
74
|
+
updateTheme(name as ThemeName);
|
|
75
|
+
}}>
|
|
76
|
+
<div id={`theme-${nameSlug}`}></div>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<>
|
|
83
|
+
<UIIconButton
|
|
84
|
+
id={buttonId}
|
|
85
|
+
iconProps={{
|
|
86
|
+
iconName: UiIcons.Settings
|
|
87
|
+
}}
|
|
88
|
+
title={t('SETTINGS')}
|
|
89
|
+
onClick={(): void => {
|
|
90
|
+
setValue(!isCalloutVisible);
|
|
91
|
+
}}
|
|
92
|
+
/>
|
|
93
|
+
{isCalloutVisible && (
|
|
94
|
+
<UICallout
|
|
95
|
+
id={'themes-selector'}
|
|
96
|
+
role="alertdialog"
|
|
97
|
+
alignTargetEdge
|
|
98
|
+
target={`#${buttonId}`}
|
|
99
|
+
finalHeight={45}
|
|
100
|
+
isBeakVisible={true}
|
|
101
|
+
beakWidth={5}
|
|
102
|
+
directionalHint={1}
|
|
103
|
+
styles={{
|
|
104
|
+
calloutMain: {
|
|
105
|
+
minWidth: 100
|
|
106
|
+
}
|
|
107
|
+
}}
|
|
108
|
+
onDismiss={(): void => {
|
|
109
|
+
setValue(false);
|
|
110
|
+
}}>
|
|
111
|
+
{...themes.map(createThemeButton)}
|
|
112
|
+
</UICallout>
|
|
113
|
+
)}
|
|
114
|
+
</>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Set theme.
|
|
120
|
+
*
|
|
121
|
+
* @param themeName - ThemeName
|
|
122
|
+
*/
|
|
123
|
+
export function setThemeOnDocument(themeName: ThemeName): void {
|
|
124
|
+
document.getElementsByTagName('HTML')[0].setAttribute('data-theme', themeName);
|
|
125
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copied over from App modeler
|
|
2
|
+
.ui-toolbar {
|
|
3
|
+
// We do not need fixed if we use flexes
|
|
4
|
+
position: static;
|
|
5
|
+
top: initial;
|
|
6
|
+
left: initial;
|
|
7
|
+
&__container {
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
}
|
|
10
|
+
// Move to right edge
|
|
11
|
+
.column-right {
|
|
12
|
+
justify-content: flex-end;
|
|
13
|
+
flex-grow: 0;
|
|
14
|
+
}
|
|
15
|
+
.column-left {
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
}
|
|
18
|
+
.ui-toolbar__content {
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
background-color: inherit;
|
|
21
|
+
flex-wrap: nowrap;
|
|
22
|
+
min-width: 0;
|
|
23
|
+
}
|
|
24
|
+
// Margins according to design
|
|
25
|
+
.ui-toolbar__column__content {
|
|
26
|
+
align-items: center;
|
|
27
|
+
margin: 9px 15px;
|
|
28
|
+
|
|
29
|
+
> .ms-Button:first-child {
|
|
30
|
+
margin-left: 0;
|
|
31
|
+
}
|
|
32
|
+
> .ms-Button:last-child {
|
|
33
|
+
margin-right: 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
.ui-divider {
|
|
37
|
+
margin: 0;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReactElement, PropsWithChildren } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { UIToolbar, UIToolbarColumn } from '@sap-ux/ui-components';
|
|
5
|
+
|
|
6
|
+
import './ToolBar.scss';
|
|
7
|
+
|
|
8
|
+
export interface ToolbarProps {
|
|
9
|
+
left?: React.ReactNode;
|
|
10
|
+
right?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* React element with children.
|
|
14
|
+
*
|
|
15
|
+
* @param propsWithChildren PropsWithChildren<ToolbarProps>
|
|
16
|
+
* @returns ReactElement
|
|
17
|
+
*/
|
|
18
|
+
export function Toolbar(propsWithChildren: PropsWithChildren<ToolbarProps>): ReactElement {
|
|
19
|
+
const { left, right, children } = propsWithChildren;
|
|
20
|
+
return (
|
|
21
|
+
<UIToolbar>
|
|
22
|
+
<UIToolbarColumn className="column-left">{left ?? children}</UIToolbarColumn>
|
|
23
|
+
<UIToolbarColumn className="column-right">{right}</UIToolbarColumn>
|
|
24
|
+
</UIToolbar>
|
|
25
|
+
);
|
|
26
|
+
}
|
package/src/devices.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const enum DeviceType {
|
|
2
|
+
Desktop = 'desktop',
|
|
3
|
+
Tablet = 'tablet',
|
|
4
|
+
Phone = 'phone'
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const DEVICE_TYPES = [DeviceType.Desktop, DeviceType.Tablet, DeviceType.Phone];
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Device screen width in pixels
|
|
11
|
+
*/
|
|
12
|
+
export const DEVICE_WIDTH_MAP = new Map<DeviceType, number>([
|
|
13
|
+
[DeviceType.Desktop, 1200],
|
|
14
|
+
[DeviceType.Tablet, 720],
|
|
15
|
+
[DeviceType.Phone, 480]
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
export const DEFAULT_DEVICE_WIDTH = 1200;
|
package/src/global.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"APPLICATION_PREVIEW_TITLE": "Application Preview",
|
|
3
|
+
"PROPERTIES": "PROPERTIES",
|
|
4
|
+
"COPIED_TO_CLIPBOARD_TOAST_MESSAGE": "✓ Copied to clipboard: {{value}}",
|
|
5
|
+
"CONTROL_ID_LABEL": "CONTROL ID",
|
|
6
|
+
"CONTROL_TYPE_LABEL": "CONTROL TYPE",
|
|
7
|
+
"TOOL_DISCLAIMER_TITLE": "Warning",
|
|
8
|
+
"TOOL_DISCLAIMER_TEXT": "The Control Property Editor enables you to change control properties and behavior directly. These changes may not have the desired effect with Fiori elements applications. Please consult documentation to learn which changes are supported.",
|
|
9
|
+
"FE_DOCUMENTATION_LINK_TEXT": "Developing Apps with SAP Fiori Elements",
|
|
10
|
+
"DONT_SHOW_WARNING_ON_START": "Don't show again",
|
|
11
|
+
"OK": "OK",
|
|
12
|
+
"CANCEL": "Cancel",
|
|
13
|
+
"LIGHT_THEME_NAME": "Light",
|
|
14
|
+
"DARK_THEME_NAME": "Dark",
|
|
15
|
+
"HIGH_CONTRAST_THEME_NAME": "High Contrast",
|
|
16
|
+
"SEARCH_OUTLINE": "Search Outline",
|
|
17
|
+
"NO_CONTROL_FOUND": "No control found",
|
|
18
|
+
"MODIFY_SEARCH_INPUT": "Modify the search input",
|
|
19
|
+
"APP_TITLE": "Control Property Editor",
|
|
20
|
+
"DEVICE_TYPE_DESKTOP": "Desktop",
|
|
21
|
+
"DEVICE_TYPE_TABLET": "Tablet",
|
|
22
|
+
"DEVICE_TYPE_PHONE": "Phone",
|
|
23
|
+
"BOOLEAN_TYPE_TRUE": "true",
|
|
24
|
+
"BOOLEAN_TYPE_FALSE": "false",
|
|
25
|
+
"ENUM_TYPE": "enumeration",
|
|
26
|
+
"STRING_TYPE": "string",
|
|
27
|
+
"INTEGER_TYPE": "integer",
|
|
28
|
+
"FLOAT_TYPE": "float",
|
|
29
|
+
"EXPRESSION_TYPE": "expression",
|
|
30
|
+
"ZOOM_IN": "Zoom in",
|
|
31
|
+
"ZOOM_OUT": "Zoom out",
|
|
32
|
+
"SETTINGS": "Settings",
|
|
33
|
+
"ICON_EDITABLE": "Editable",
|
|
34
|
+
"ICON_HIDDEN": "Hidden",
|
|
35
|
+
"FOCUS_EDITABLE": "Focus editable",
|
|
36
|
+
"FOCUS_COMMONLY_USED": "Show only commonly used",
|
|
37
|
+
"ICON_NAME": "Name",
|
|
38
|
+
"ICON": "Icon",
|
|
39
|
+
"SELECT_ICON": "Select Icon",
|
|
40
|
+
"NO_CONTROL_SELECTED": "No control selected",
|
|
41
|
+
"PROPERTIES_MODIFY_TEXT": "Select a control on the canvas to see and modify its properties",
|
|
42
|
+
"SEARCH_PROPERTIES": "Search Properties",
|
|
43
|
+
"SHOW_EDITABLE_PROPERTIES": "Show only editable properties",
|
|
44
|
+
"COPIED_TO_CLIPBOARD": "Copied to clipboard",
|
|
45
|
+
"PROPERTY_NAME": "Property name",
|
|
46
|
+
"PROPERTY_TYPE": "Property type",
|
|
47
|
+
"DEFAULT_VALUE": "Default value",
|
|
48
|
+
"DEFAULT_VALUE_TOOLTIP": "This is default value set by SAP UI5 control and it may be different than the one that is used by SAP Fiori Elements. This means that after deleting all the changes for the property it's value may differ from the one displayed here.",
|
|
49
|
+
"CURRENT_VALUE": "Current value",
|
|
50
|
+
"DESCRIPTION": "Description",
|
|
51
|
+
"SAVED_AND_UNSAVED_CHANGES": "Saved & Unsaved",
|
|
52
|
+
"UNSAVED_CHANGES": "Modified & Unsaved",
|
|
53
|
+
"SAVED_CHANGES": "Modified & Saved",
|
|
54
|
+
"SAVED_VALUE": "Saved value",
|
|
55
|
+
"CONFIRM_DELETE": "Delete",
|
|
56
|
+
"CANCEL_DELETE": "Cancel",
|
|
57
|
+
"DELETE_ALL_PROPERTY_CHANGES_TOOLTIP": "Delete all changes for this property",
|
|
58
|
+
"CONFIRM_DELETE_TITLE": "Confirm property change deletion",
|
|
59
|
+
"CONFIRM_DELETE_SUBTEXT": "Are you sure you want to delete all changes for this property? This action cannot be undone.",
|
|
60
|
+
"FIT_PREVIEW": "Fit",
|
|
61
|
+
"FILTER": "Filter",
|
|
62
|
+
"CHANGE_SUMMARY_SAVED_CHANGES": "SAVED CHANGES",
|
|
63
|
+
"CHANGE_SUMMARY_UNSAVED_CHANGES": "UNSAVED CHANGES",
|
|
64
|
+
"CONFIRM_CHANGE_SUMMARY_DELETE_SUBTEXT": "Are you sure you want to delete the change for this property? This action cannot be undone.",
|
|
65
|
+
"NO_CONTROL_CHANGES_FOUND": "No Control Changes Found",
|
|
66
|
+
"CHANGE": "Change",
|
|
67
|
+
"FILE": "File: "
|
|
68
|
+
}
|
package/src/i18n.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import i18n from 'i18next';
|
|
2
|
+
import { initReactI18next } from 'react-i18next';
|
|
3
|
+
import * as i18nEn from './i18n/i18n.json';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param language default to 'en'
|
|
8
|
+
*/
|
|
9
|
+
export function initI18n(language = 'en'): void {
|
|
10
|
+
i18n.use(initReactI18next)
|
|
11
|
+
.init({
|
|
12
|
+
resources: {
|
|
13
|
+
en: {
|
|
14
|
+
translation: i18nEn
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
lng: language,
|
|
18
|
+
fallbackLng: 'en',
|
|
19
|
+
interpolation: {
|
|
20
|
+
escapeValue: false
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
.then(() => console.log('i18n initialized'))
|
|
24
|
+
.catch((error) => console.error(error));
|
|
25
|
+
}
|
package/src/icons.tsx
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { registerIcons } from '@fluentui/react';
|
|
3
|
+
|
|
4
|
+
export enum IconName {
|
|
5
|
+
desktop = 'desktop',
|
|
6
|
+
table = 'tablet',
|
|
7
|
+
phone = 'phone',
|
|
8
|
+
funnel = 'funnel',
|
|
9
|
+
eyeClosed = 'eyeClosed',
|
|
10
|
+
lock = 'lock',
|
|
11
|
+
noEdit = 'noEdit',
|
|
12
|
+
editable = 'editable',
|
|
13
|
+
boolTrue = 'boolTrue',
|
|
14
|
+
boolFalse = 'boolFalse',
|
|
15
|
+
dropdown = 'dropdown',
|
|
16
|
+
string = 'string',
|
|
17
|
+
number = 'number',
|
|
18
|
+
expression = 'expression',
|
|
19
|
+
arrow = 'arrow',
|
|
20
|
+
grabber = 'grabber'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function registerAppIcons(): void {
|
|
24
|
+
registerIcons({
|
|
25
|
+
icons: {
|
|
26
|
+
boolTrue: (
|
|
27
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
28
|
+
<path
|
|
29
|
+
fillRule="evenodd"
|
|
30
|
+
clipRule="evenodd"
|
|
31
|
+
d="M12.3536 5.35359L6.00004 11.7071L3.64648 9.35359L4.35359 8.64648L6.00004 10.2929L11.6465 4.64648L12.3536 5.35359Z"
|
|
32
|
+
fill="var(--vscode-icon-foreground)"
|
|
33
|
+
/>
|
|
34
|
+
</svg>
|
|
35
|
+
),
|
|
36
|
+
boolFalse: (
|
|
37
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
38
|
+
<path
|
|
39
|
+
fillRule="evenodd"
|
|
40
|
+
clipRule="evenodd"
|
|
41
|
+
d="M8.00004 8.70715L11.6465 12.3536L12.3536 11.6465L8.70715 8.00004L12.3536 4.35359L11.6465 3.64648L8.00004 7.29293L4.35359 3.64648L3.64648 4.35359L7.29293 8.00004L3.64648 11.6465L4.35359 12.3536L8.00004 8.70715Z"
|
|
42
|
+
fill="var(--vscode-icon-foreground)"
|
|
43
|
+
/>
|
|
44
|
+
</svg>
|
|
45
|
+
),
|
|
46
|
+
dropdown: (
|
|
47
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
48
|
+
<path
|
|
49
|
+
fillRule="evenodd"
|
|
50
|
+
clipRule="evenodd"
|
|
51
|
+
d="M3.14648 6.35359L3.85359 5.64648L8.00004 9.79293L12.1465 5.64648L12.8536 6.35359L8.00004 11.2071L3.14648 6.35359Z"
|
|
52
|
+
fill="var(--vscode-icon-foreground)"
|
|
53
|
+
/>
|
|
54
|
+
</svg>
|
|
55
|
+
),
|
|
56
|
+
string: (
|
|
57
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
58
|
+
<path
|
|
59
|
+
fillRule="evenodd"
|
|
60
|
+
clipRule="evenodd"
|
|
61
|
+
d="M4.0082 12L4.58594 9.89858H7.16875L7.74648 12H8.74336L6.42109 4.01929H5.33359L3 12H4.0082ZM6.21152 6.39819L6.94219 9.05464H4.8125L5.54316 6.39819C5.75085 5.5939 5.86224 5.14832 5.87734 5.06147L5.92266 5.24272C6.05104 5.77137 6.14733 6.15653 6.21152 6.39819ZM9.40283 11.6616C9.67497 11.9588 10.0527 12.1074 10.5361 12.1074C10.8799 12.1074 11.1681 12.0322 11.4009 11.8818C11.6372 11.7279 11.8306 11.5076 11.981 11.2212H12.0024C12.0096 11.4002 12.0132 11.5309 12.0132 11.6133L12.0239 12H12.8672C12.86 11.7064 12.8564 11.2373 12.8564 10.5928V8.0415C12.8564 7.40771 12.7043 6.92253 12.3999 6.58594C12.0991 6.24935 11.6623 6.08105 11.0894 6.08105C10.6561 6.08105 10.2873 6.17236 9.98291 6.35498C9.68213 6.53402 9.40462 6.79899 9.15039 7.1499L9.78955 7.67627C10.0223 7.37191 10.2336 7.16064 10.4233 7.04248C10.6167 6.92432 10.828 6.86523 11.0571 6.86523C11.3543 6.86523 11.5817 6.97087 11.7393 7.18213C11.9004 7.38981 11.981 7.7085 11.981 8.13818V8.58936L11.0195 8.61084C10.4215 8.62158 9.93457 8.77197 9.55859 9.06201C9.1862 9.34847 9 9.81038 9 10.4478C9 10.9598 9.13428 11.3644 9.40283 11.6616ZM11.4116 11.1299C11.229 11.2552 11.0142 11.3179 10.7671 11.3179C10.5057 11.3179 10.2998 11.2391 10.1494 11.0815C9.99902 10.924 9.92383 10.7056 9.92383 10.4263C9.92383 10.0288 10.0402 9.74593 10.2729 9.57764C10.5057 9.40934 10.8065 9.31803 11.1753 9.30371L11.9702 9.28223V9.92139C11.9702 10.172 11.9219 10.4048 11.8252 10.6196C11.7321 10.8309 11.5942 11.001 11.4116 11.1299Z"
|
|
62
|
+
fill="var(--vscode-icon-foreground)"
|
|
63
|
+
/>
|
|
64
|
+
</svg>
|
|
65
|
+
),
|
|
66
|
+
number: (
|
|
67
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
68
|
+
<path
|
|
69
|
+
fillRule="evenodd"
|
|
70
|
+
clipRule="evenodd"
|
|
71
|
+
d="M7 4H6V6H4V7H6V9H4V10H6V12H7V10H9V12H10V10H12V9H10V7H12V6H10V4H9V6H7V4ZM9 9V7H7V9H9Z"
|
|
72
|
+
fill="var(--vscode-icon-foreground)"
|
|
73
|
+
/>
|
|
74
|
+
</svg>
|
|
75
|
+
),
|
|
76
|
+
|
|
77
|
+
expression: (
|
|
78
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
79
|
+
<path
|
|
80
|
+
fillRule="evenodd"
|
|
81
|
+
clipRule="evenodd"
|
|
82
|
+
d="M5.70711 3.5C4.87868 3.5 4.20711 4.17157 4.20711 5V6.58579C4.20711 6.71839 4.15443 6.84557 4.06066 6.93934L3 8L4.06066 9.06066C4.15443 9.15443 4.20711 9.28161 4.20711 9.41421V11C4.20711 11.8284 4.87868 12.5 5.70711 12.5H6.20711V11.5H5.70711C5.43096 11.5 5.20711 11.2761 5.20711 11V9.41421C5.20711 9.01639 5.04907 8.63486 4.76777 8.35355L4.41421 8L4.76777 7.64645C5.04907 7.36514 5.20711 6.98361 5.20711 6.58579V5C5.20711 4.72386 5.43096 4.5 5.70711 4.5H6.20711V3.5H5.70711Z"
|
|
83
|
+
fill="var(--vscode-icon-foreground)"
|
|
84
|
+
/>
|
|
85
|
+
<path
|
|
86
|
+
fillRule="evenodd"
|
|
87
|
+
clipRule="evenodd"
|
|
88
|
+
d="M10.2929 3.5C11.1213 3.5 11.7929 4.17157 11.7929 5V6.58579C11.7929 6.71839 11.8456 6.84557 11.9393 6.93934L13 8L11.9393 9.06066C11.8456 9.15443 11.7929 9.28161 11.7929 9.41421V11C11.7929 11.8284 11.1213 12.5 10.2929 12.5H9.79289V11.5H10.2929C10.569 11.5 10.7929 11.2761 10.7929 11V9.41421C10.7929 9.01639 10.9509 8.63486 11.2322 8.35355L11.5858 8L11.2322 7.64645C10.9509 7.36514 10.7929 6.98361 10.7929 6.58579V5C10.7929 4.72386 10.569 4.5 10.2929 4.5H9.79289V3.5H10.2929Z"
|
|
89
|
+
fill="var(--vscode-icon-foreground)"
|
|
90
|
+
/>
|
|
91
|
+
</svg>
|
|
92
|
+
),
|
|
93
|
+
desktop: (
|
|
94
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
95
|
+
<path
|
|
96
|
+
fillRule="evenodd"
|
|
97
|
+
clipRule="evenodd"
|
|
98
|
+
d="M1 2C1 1.44772 1.44772 1 2 1H14C14.5523 1 15 1.44772 15 2V12C15 12.5523 14.5523 13 14 13H9V14H12V15H4V14H7V13H2C1.44772 13 1 12.5523 1 12V2ZM14 12V2H2V12H14Z"
|
|
99
|
+
fill="var(--vscode-icon-foreground)"
|
|
100
|
+
/>
|
|
101
|
+
</svg>
|
|
102
|
+
),
|
|
103
|
+
tablet: (
|
|
104
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
105
|
+
<path
|
|
106
|
+
fillRule="evenodd"
|
|
107
|
+
clipRule="evenodd"
|
|
108
|
+
d="M2 3C2 2.44772 2.44772 2 3 2H13C13.5523 2 14 2.44772 14 3V13C14 13.5523 13.5523 14 13 14H3C2.44772 14 2 13.5523 2 13V3ZM3 3H13V11H3V3ZM7.5 12C7.22386 12 7 12.2239 7 12.5C7 12.7761 7.22386 13 7.5 13H8.5C8.77614 13 9 12.7761 9 12.5C9 12.2239 8.77614 12 8.5 12H7.5Z"
|
|
109
|
+
fill="var(--vscode-icon-foreground)"
|
|
110
|
+
/>
|
|
111
|
+
</svg>
|
|
112
|
+
),
|
|
113
|
+
phone: (
|
|
114
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
115
|
+
<path
|
|
116
|
+
fillRule="evenodd"
|
|
117
|
+
clipRule="evenodd"
|
|
118
|
+
d="M5 2C4.44771 2 4 2.44772 4 3V13C4 13.5523 4.44771 14 5 14H11C11.5523 14 12 13.5523 12 13V3C12 2.44772 11.5523 2 11 2H5ZM11 3H5V13H11V3Z"
|
|
119
|
+
fill="var(--vscode-icon-foreground)"
|
|
120
|
+
/>
|
|
121
|
+
<rect x="7" y="11" width="2" height="1" rx="0.5" fill="var(--vscode-icon-foreground)" />
|
|
122
|
+
</svg>
|
|
123
|
+
),
|
|
124
|
+
funnel: (
|
|
125
|
+
<svg width="15" height="13" viewBox="0 0 15 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
126
|
+
<path
|
|
127
|
+
fillRule="evenodd"
|
|
128
|
+
clipRule="evenodd"
|
|
129
|
+
d="M0.019 1.708L5.015 6.71L5.014 12.003H5.513L9.021 12.002L9.019 6.715L14.01 1.709L14.013 0.008L0 0L0.019 1.708ZM6.015 6.296L1.014 1.29L1.012 1.001L13.011 1.008V1.295L8.019 6.301L8.021 11.002L6.014 11.003L6.015 6.296Z"
|
|
130
|
+
fill="var(--vscode-icon-foreground)"
|
|
131
|
+
/>
|
|
132
|
+
</svg>
|
|
133
|
+
),
|
|
134
|
+
eyeClosed: (
|
|
135
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
136
|
+
<path
|
|
137
|
+
d="M2.45586 1.45583C2.2606 1.26057 1.94402 1.26057 1.74876 1.45583C1.5535 1.6511 1.5535 1.96768 1.74876 2.16294L9.90808 10.3223C10.1033 10.5175 10.4199 10.5175 10.6152 10.3223C10.8105 10.127 10.8105 9.81042 10.6152 9.61516L8 6.99999C8 5.89542 7.10457 4.99999 6 4.99999L4.35352 3.35349C4.85565 3.1264 5.41306 2.99999 6 2.99999C8.20914 2.99999 10 4.79085 10 6.99999H11C11 4.23856 8.76143 1.99999 6 1.99999C5.13358 1.99999 4.31862 2.22036 3.60814 2.60812L2.45586 1.45583Z"
|
|
138
|
+
fill="var(--vscode-icon-foreground)"
|
|
139
|
+
/>
|
|
140
|
+
<path
|
|
141
|
+
d="M2.12852 3.83561L2.84007 4.54716C2.31354 5.2245 2 6.07563 2 6.99999H1C1 5.79935 1.42317 4.69755 2.12852 3.83561Z"
|
|
142
|
+
fill="var(--vscode-icon-foreground)"
|
|
143
|
+
/>
|
|
144
|
+
<path
|
|
145
|
+
d="M5.03387 6.74096L4.27692 5.984C4.10097 6.28176 4 6.62908 4 6.99999C4 8.10456 4.89543 8.99999 6 8.99999C6.37091 8.99999 6.71823 8.89902 7.01599 8.72307L6.25902 7.96611C6.17641 7.98821 6.08958 7.99999 6 7.99999C5.44771 7.99999 5 7.55227 5 6.99999C5 6.91041 5.01178 6.82358 5.03387 6.74096Z"
|
|
146
|
+
fill="var(--vscode-icon-foreground)"
|
|
147
|
+
/>
|
|
148
|
+
</svg>
|
|
149
|
+
),
|
|
150
|
+
lock: (
|
|
151
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
152
|
+
<path
|
|
153
|
+
fillRule="evenodd"
|
|
154
|
+
clipRule="evenodd"
|
|
155
|
+
d="M9 4V5C9.55229 5 10 5.44772 10 6V10C10 10.5523 9.55229 11 9 11H3C2.44771 11 2 10.5523 2 10V6C2 5.44772 2.44771 5 3 5V4C3 2.34315 4.34314 1 6 1C7.65686 1 9 2.34315 9 4ZM8 4C8 2.89543 7.10457 2 6 2C4.89543 2 4 2.89543 4 4V5H8V4ZM5 7H7V10H6V8H5V7Z"
|
|
156
|
+
fill="var(--vscode-icon-foreground)"
|
|
157
|
+
/>
|
|
158
|
+
</svg>
|
|
159
|
+
),
|
|
160
|
+
noEdit: (
|
|
161
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
162
|
+
<path
|
|
163
|
+
d="M9.86438 3.41631L6.99388 6.2868L7.69432 6.98723L10.5648 4.11674C11.1451 3.53648 11.1451 2.5957 10.5648 2.01545L9.98456 1.43519C9.4043 0.854936 8.46352 0.854936 7.88326 1.43519L5.01278 4.30568L5.7132 5.00611L8.58369 2.13562C8.77711 1.9422 9.0907 1.9422 9.28412 2.13562L9.86438 2.71588C10.0578 2.9093 10.0578 3.22289 9.86438 3.41631Z"
|
|
164
|
+
fill="var(--vscode-icon-foreground)"
|
|
165
|
+
/>
|
|
166
|
+
<path
|
|
167
|
+
fillRule="evenodd"
|
|
168
|
+
clipRule="evenodd"
|
|
169
|
+
d="M1 8.31845L3.76653 5.55193L4.46695 6.25236L3.18626 7.53305L4.46695 8.81373L5.79958 7.48112L6.5 8.18155L3.68155 11H1V8.31845ZM3.76653 9.51416L2.48584 8.23348L1.99055 8.72876V10.0094H3.27124L3.76653 9.51416Z"
|
|
170
|
+
fill="var(--vscode-icon-foreground)"
|
|
171
|
+
/>
|
|
172
|
+
<path
|
|
173
|
+
d="M2.16968 1.46259C1.97443 1.26733 1.65784 1.26733 1.46259 1.46259C1.26732 1.65785 1.26732 1.97444 1.46259 2.1697L9.785 10.4921C9.98027 10.6874 10.2968 10.6874 10.4921 10.4921C10.6874 10.2969 10.6874 9.98028 10.4921 9.78502L2.16968 1.46259Z"
|
|
174
|
+
fill="var(--vscode-icon-foreground)"
|
|
175
|
+
/>
|
|
176
|
+
</svg>
|
|
177
|
+
),
|
|
178
|
+
editable: (
|
|
179
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
180
|
+
<path
|
|
181
|
+
fillRule="evenodd"
|
|
182
|
+
clipRule="evenodd"
|
|
183
|
+
d="M10.5648 2.01545C11.1451 2.5957 11.1451 3.53648 10.5648 4.11674L3.68155 11H1V8.31845L7.88326 1.43519C8.46352 0.854936 9.4043 0.854936 9.98456 1.43519L10.5648 2.01545ZM8.58369 2.13562C8.77711 1.9422 9.0907 1.9422 9.28412 2.13562L9.86438 2.71588C10.0578 2.9093 10.0578 3.30658 9.86438 3.5L4.46695 8.81373L3.18626 7.53305L8.58369 2.13562ZM3.76653 9.51416L2.48584 8.23348L1.99055 8.72876V10.0094H3.27124L3.76653 9.51416Z"
|
|
184
|
+
fill="var(--vscode-icon-foreground)"
|
|
185
|
+
/>
|
|
186
|
+
</svg>
|
|
187
|
+
),
|
|
188
|
+
arrow: (
|
|
189
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="9" viewBox="0 0 12 9" fill="none">
|
|
190
|
+
<path
|
|
191
|
+
d="M1 4C0.723858 4 0.5 4.22386 0.5 4.5C0.5 4.77614 0.723858 5 1 5V4ZM11.3536 4.85355C11.5488 4.65829 11.5488 4.34171 11.3536 4.14645L8.17157 0.964466C7.97631 0.769204 7.65973 0.769204 7.46447 0.964466C7.2692 1.15973 7.2692 1.47631 7.46447 1.67157L10.2929 4.5L7.46447 7.32843C7.2692 7.52369 7.2692 7.84027 7.46447 8.03553C7.65973 8.2308 7.97631 8.2308 8.17157 8.03553L11.3536 4.85355ZM1 5H11V4H1V5Z"
|
|
192
|
+
fill="var(--vscode-editor-foreground)"
|
|
193
|
+
/>
|
|
194
|
+
</svg>
|
|
195
|
+
)
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|