@lvce-editor/settings-view 1.2.0 → 1.3.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.
|
@@ -932,7 +932,8 @@ const create$1 = (id, uri, x, y, width, height) => {
|
|
|
932
932
|
x,
|
|
933
933
|
y,
|
|
934
934
|
width,
|
|
935
|
-
height
|
|
935
|
+
height,
|
|
936
|
+
tabs: []
|
|
936
937
|
};
|
|
937
938
|
set$1(id, state, state);
|
|
938
939
|
};
|
|
@@ -975,12 +976,25 @@ const initialize = async () => {
|
|
|
975
976
|
// TODO
|
|
976
977
|
};
|
|
977
978
|
|
|
979
|
+
const getTabs = () => {
|
|
980
|
+
const tabs = ['Text Editor', 'Workbench', 'Window', 'Features', 'Applications', 'Security', 'Extensions'];
|
|
981
|
+
return tabs;
|
|
982
|
+
};
|
|
983
|
+
|
|
978
984
|
const loadContent = async (state, savedState) => {
|
|
985
|
+
const tabs = getTabs();
|
|
979
986
|
return {
|
|
980
|
-
...state
|
|
987
|
+
...state,
|
|
988
|
+
tabs
|
|
981
989
|
};
|
|
982
990
|
};
|
|
983
991
|
|
|
992
|
+
const Tab$1 = 'tab';
|
|
993
|
+
const TabList = 'tablist';
|
|
994
|
+
const AriaRoles = {
|
|
995
|
+
__proto__: null,
|
|
996
|
+
Tab: Tab$1,
|
|
997
|
+
TabList};
|
|
984
998
|
const Viewlet$1 = 'Viewlet';
|
|
985
999
|
const ClassNames = {
|
|
986
1000
|
__proto__: null,
|
|
@@ -989,12 +1003,18 @@ const mergeClassNames = (...classNames) => {
|
|
|
989
1003
|
return classNames.filter(Boolean).join(' ');
|
|
990
1004
|
};
|
|
991
1005
|
const Div = 4;
|
|
992
|
-
const
|
|
1006
|
+
const Input = 6;
|
|
993
1007
|
const Text = 12;
|
|
1008
|
+
const H2 = 22;
|
|
1009
|
+
const Aside = 28;
|
|
1010
|
+
const Ul = 60;
|
|
994
1011
|
const VirtualDomElements = {
|
|
995
1012
|
__proto__: null,
|
|
1013
|
+
Aside,
|
|
996
1014
|
Div,
|
|
997
|
-
|
|
1015
|
+
H2,
|
|
1016
|
+
Input,
|
|
1017
|
+
Ul};
|
|
998
1018
|
const text = data => {
|
|
999
1019
|
return {
|
|
1000
1020
|
type: Text,
|
|
@@ -1007,19 +1027,87 @@ const {
|
|
|
1007
1027
|
Viewlet} = ClassNames;
|
|
1008
1028
|
const Settings = 'Settings';
|
|
1009
1029
|
|
|
1010
|
-
const
|
|
1030
|
+
const getSettingsInputDom = () => {
|
|
1031
|
+
const placeholder = 'Search Settings';
|
|
1032
|
+
return [{
|
|
1033
|
+
type: VirtualDomElements.Div,
|
|
1034
|
+
className: 'SettingsInputWrapper',
|
|
1035
|
+
childCount: 1
|
|
1036
|
+
}, {
|
|
1037
|
+
type: VirtualDomElements.Input,
|
|
1038
|
+
className: 'InputBox SettingsSearchInput',
|
|
1039
|
+
placeholder
|
|
1040
|
+
}];
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
const getSettingsHeaderDom = () => {
|
|
1044
|
+
return [{
|
|
1045
|
+
type: VirtualDomElements.Div,
|
|
1046
|
+
className: 'SettingsHeader',
|
|
1047
|
+
childCount: 1
|
|
1048
|
+
}, ...getSettingsInputDom()];
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
const getSettingsContentDom = () => {
|
|
1011
1052
|
return [{
|
|
1012
1053
|
type: VirtualDomElements.Div,
|
|
1054
|
+
className: 'SettingsContent',
|
|
1055
|
+
childCount: 1
|
|
1056
|
+
}, text('Settings Content')];
|
|
1057
|
+
};
|
|
1058
|
+
|
|
1059
|
+
const getTabVirtualDom = tab => {
|
|
1060
|
+
return [{
|
|
1061
|
+
type: VirtualDomElements.Div,
|
|
1062
|
+
className: 'Tab',
|
|
1013
1063
|
childCount: 1,
|
|
1014
|
-
|
|
1064
|
+
role: AriaRoles.Tab
|
|
1065
|
+
}, text(tab)];
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
const getSettingsTabsDom = tabs => {
|
|
1069
|
+
return [{
|
|
1070
|
+
type: VirtualDomElements.Ul,
|
|
1071
|
+
className: 'SettingsTabs',
|
|
1072
|
+
role: AriaRoles.TabList,
|
|
1073
|
+
childCount: tabs.length
|
|
1074
|
+
}, ...tabs.flatMap(getTabVirtualDom)];
|
|
1075
|
+
};
|
|
1076
|
+
|
|
1077
|
+
const getSettingsSideBarDom = tabs => {
|
|
1078
|
+
const sideBarHeading = 'Settings SideBar';
|
|
1079
|
+
return [{
|
|
1080
|
+
type: VirtualDomElements.Aside,
|
|
1081
|
+
className: 'SettingsSideBar',
|
|
1082
|
+
childCount: 2
|
|
1015
1083
|
}, {
|
|
1016
|
-
type: VirtualDomElements.
|
|
1084
|
+
type: VirtualDomElements.H2,
|
|
1085
|
+
className: 'SettingsSideBarHeading',
|
|
1017
1086
|
childCount: 1
|
|
1018
|
-
}, text(
|
|
1087
|
+
}, text(sideBarHeading), ...getSettingsTabsDom(tabs)];
|
|
1088
|
+
};
|
|
1089
|
+
|
|
1090
|
+
const getSettingsMainDom = tabs => {
|
|
1091
|
+
return [{
|
|
1092
|
+
type: VirtualDomElements.Div,
|
|
1093
|
+
className: 'SettingsMain',
|
|
1094
|
+
childCount: 2
|
|
1095
|
+
}, ...getSettingsSideBarDom(tabs), ...getSettingsContentDom()];
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
const getSettingsDom = state => {
|
|
1099
|
+
const {
|
|
1100
|
+
tabs
|
|
1101
|
+
} = state;
|
|
1102
|
+
return [{
|
|
1103
|
+
type: VirtualDomElements.Div,
|
|
1104
|
+
childCount: 2,
|
|
1105
|
+
className: mergeClassNames(Viewlet, Settings)
|
|
1106
|
+
}, ...getSettingsHeaderDom(), ...getSettingsMainDom(tabs)];
|
|
1019
1107
|
};
|
|
1020
1108
|
|
|
1021
1109
|
const renderItems = (oldState, newState) => {
|
|
1022
|
-
const dom = getSettingsDom();
|
|
1110
|
+
const dom = getSettingsDom(newState);
|
|
1023
1111
|
return ['Viewlet.setDom2', newState.id, dom];
|
|
1024
1112
|
};
|
|
1025
1113
|
|