@lvce-editor/settings-view 2.27.3 → 2.28.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.
|
@@ -1780,6 +1780,10 @@ const filterSettingId = state => appendFilter(state, '@id:');
|
|
|
1780
1780
|
const filterStable = state => toggleExclusiveFilter(state, '@stable', ['@tag:preview', '@tag:experimental']);
|
|
1781
1781
|
const filterTag = state => appendFilter(state, '@tag:');
|
|
1782
1782
|
|
|
1783
|
+
const getComponentState = uid => {
|
|
1784
|
+
return get$1(uid).newState;
|
|
1785
|
+
};
|
|
1786
|
+
|
|
1783
1787
|
const Group = 'group';
|
|
1784
1788
|
const Tab$1 = 'tab';
|
|
1785
1789
|
const TabList = 'tablist';
|
|
@@ -4128,6 +4132,23 @@ const saveState = state => {
|
|
|
4128
4132
|
};
|
|
4129
4133
|
};
|
|
4130
4134
|
|
|
4135
|
+
const applyComponentState = (currentState, state) => {
|
|
4136
|
+
if (!state || typeof state !== 'object' || Array.isArray(state)) {
|
|
4137
|
+
throw new TypeError('Settings state must be an object');
|
|
4138
|
+
}
|
|
4139
|
+
const {
|
|
4140
|
+
id
|
|
4141
|
+
} = state;
|
|
4142
|
+
const {
|
|
4143
|
+
id: currentId
|
|
4144
|
+
} = currentState;
|
|
4145
|
+
if (id !== currentId) {
|
|
4146
|
+
throw new Error(`Settings state id must remain ${currentId}`);
|
|
4147
|
+
}
|
|
4148
|
+
return state;
|
|
4149
|
+
};
|
|
4150
|
+
const setComponentState = wrapCommand(applyComponentState);
|
|
4151
|
+
|
|
4131
4152
|
const useNextSearchValue = state => {
|
|
4132
4153
|
const {
|
|
4133
4154
|
history,
|
|
@@ -4194,6 +4215,7 @@ const commandMap = {
|
|
|
4194
4215
|
'Settings.filterStable': wrapCommand(filterStable),
|
|
4195
4216
|
'Settings.filterTag': wrapCommand(filterTag),
|
|
4196
4217
|
'Settings.getCommandIds': getCommandIds,
|
|
4218
|
+
'Settings.getComponentState': getComponentState,
|
|
4197
4219
|
'Settings.getKeyBindings': getKeyBindings,
|
|
4198
4220
|
'Settings.getMenuEntries': wrapGetter(getMenuEntries2),
|
|
4199
4221
|
'Settings.getMenuIds': getMenuIds,
|
|
@@ -4220,6 +4242,7 @@ const commandMap = {
|
|
|
4220
4242
|
'Settings.resetSetting': wrapCommand(resetSetting),
|
|
4221
4243
|
'Settings.restoreState': restoreState,
|
|
4222
4244
|
'Settings.saveState': wrapGetter(saveState),
|
|
4245
|
+
'Settings.setComponentState': setComponentState,
|
|
4223
4246
|
'Settings.terminate': terminate,
|
|
4224
4247
|
'Settings.useNextSearchValue': wrapCommand(useNextSearchValue),
|
|
4225
4248
|
'Settings.usePreviousSearchValue': wrapCommand(usePreviousSearchValue)
|