@lvce-editor/source-control-worker 3.10.0 → 3.10.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/dist/sourceControlWorkerMain.js +22 -16
- package/package.json +1 -1
|
@@ -1927,13 +1927,13 @@ const get$1 = key => {
|
|
|
1927
1927
|
const isCompatible = (extension, platform) => {
|
|
1928
1928
|
return platform !== Web || extension?.compatibility?.web !== false;
|
|
1929
1929
|
};
|
|
1930
|
-
const getExtensions = async platform => {
|
|
1931
|
-
const extensions = await invoke$
|
|
1930
|
+
const getExtensions = async (assetDir, platform) => {
|
|
1931
|
+
const extensions = await invoke$1('Extensions.getAllExtensions', assetDir, platform);
|
|
1932
1932
|
return extensions.filter(extension => isCompatible(extension, platform));
|
|
1933
1933
|
};
|
|
1934
1934
|
|
|
1935
|
-
const requestSourceActions = async (platform = 0) => {
|
|
1936
|
-
const extensions = await getExtensions(platform);
|
|
1935
|
+
const requestSourceActions = async (assetDir = '', platform = 0) => {
|
|
1936
|
+
const extensions = await getExtensions(assetDir, platform);
|
|
1937
1937
|
const newCache = Object.create(null);
|
|
1938
1938
|
for (const extension of extensions) {
|
|
1939
1939
|
if (!extension || !extension['source-control-actions']) {
|
|
@@ -1947,8 +1947,8 @@ const requestSourceActions = async (platform = 0) => {
|
|
|
1947
1947
|
return newCache;
|
|
1948
1948
|
};
|
|
1949
1949
|
|
|
1950
|
-
const requestSourceControlButtons = async (platform = 0) => {
|
|
1951
|
-
const extensions = await getExtensions(platform);
|
|
1950
|
+
const requestSourceControlButtons = async (assetDir = '', platform = 0) => {
|
|
1951
|
+
const extensions = await getExtensions(assetDir, platform);
|
|
1952
1952
|
const buttons = [];
|
|
1953
1953
|
for (const extension of extensions) {
|
|
1954
1954
|
if (!extension || !Array.isArray(extension['source-control-buttons'])) {
|
|
@@ -2018,7 +2018,7 @@ const getNewDeltaPercent = (height, scrollBarHeight, relativeY) => {
|
|
|
2018
2018
|
};
|
|
2019
2019
|
};
|
|
2020
2020
|
|
|
2021
|
-
const
|
|
2021
|
+
const loadContentActual = async (state, savedState) => {
|
|
2022
2022
|
const {
|
|
2023
2023
|
fileIconCache,
|
|
2024
2024
|
height,
|
|
@@ -2052,8 +2052,8 @@ const loadContent = async (state, savedState) => {
|
|
|
2052
2052
|
} = await getGroups(enabledProviderIds, root, assetDir, platform);
|
|
2053
2053
|
const expandedGroups = restoreExpandedGroups(allGroups);
|
|
2054
2054
|
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2055
|
-
const actionsCache = enabledProviderIds.length === 0 ? Object.create(null) : await requestSourceActions(platform);
|
|
2056
|
-
const sourceControlButtons = enabledProviderIds.length === 0 ? [] : await requestSourceControlButtons(platform);
|
|
2055
|
+
const actionsCache = enabledProviderIds.length === 0 ? Object.create(null) : await requestSourceActions(assetDir, platform);
|
|
2056
|
+
const sourceControlButtons = enabledProviderIds.length === 0 ? [] : await requestSourceControlButtons(assetDir, platform);
|
|
2057
2057
|
|
|
2058
2058
|
// TODO make preferences async and more functional
|
|
2059
2059
|
const splitButtonEnabled = await get$1('sourceControl.splitButtonEnabled');
|
|
@@ -2084,7 +2084,6 @@ const loadContent = async (state, savedState) => {
|
|
|
2084
2084
|
gitRoot,
|
|
2085
2085
|
headerHeight,
|
|
2086
2086
|
iconDefinitions,
|
|
2087
|
-
initial: false,
|
|
2088
2087
|
inputBoxHeight,
|
|
2089
2088
|
inputPlaceholder,
|
|
2090
2089
|
inputValue,
|
|
@@ -2100,6 +2099,14 @@ const loadContent = async (state, savedState) => {
|
|
|
2100
2099
|
visibleItems
|
|
2101
2100
|
};
|
|
2102
2101
|
};
|
|
2102
|
+
const loadContent = (state, savedState) => {
|
|
2103
|
+
// eslint-disable-next-line unicorn/prefer-await
|
|
2104
|
+
return loadContentActual(state, savedState).catch(error => ({
|
|
2105
|
+
...state,
|
|
2106
|
+
loading: false,
|
|
2107
|
+
providerUnavailableMessage: error.message
|
|
2108
|
+
}));
|
|
2109
|
+
};
|
|
2103
2110
|
|
|
2104
2111
|
const info = (...args) => {
|
|
2105
2112
|
// @ts-ignore
|
|
@@ -3637,8 +3644,7 @@ const messageNode = {
|
|
|
3637
3644
|
};
|
|
3638
3645
|
const getSourceControlVirtualDom = (items, buttons, disabled, placeholder, inputMessage, message, loading, scrollBarHeight, scrollBarActive) => {
|
|
3639
3646
|
const content = message ? [messageNode, text(message)] : [...getSourceControlHeaderVirtualDom(placeholder, inputMessage), ...buttons.flatMap(button => getSourceControlButtonVirtualDom(button, disabled)), ...getSourceControlListVirtualDom(items, scrollBarHeight, scrollBarActive)];
|
|
3640
|
-
|
|
3641
|
-
const dom = [{
|
|
3647
|
+
return [{
|
|
3642
3648
|
ariaBusy: loading,
|
|
3643
3649
|
childCount: (message ? 1 : 2 + buttons.length) + (loading ? 1 : 0),
|
|
3644
3650
|
className: className,
|
|
@@ -3648,8 +3654,9 @@ const getSourceControlVirtualDom = (items, buttons, disabled, placeholder, input
|
|
|
3648
3654
|
onWheel: HandleWheel,
|
|
3649
3655
|
tabIndex: 0,
|
|
3650
3656
|
type: Div
|
|
3651
|
-
},
|
|
3652
|
-
|
|
3657
|
+
},
|
|
3658
|
+
// eslint-disable-next-line virtual-dom/no-conditional-spread
|
|
3659
|
+
...(loading ? getProgressVirtualDom() : []), ...content];
|
|
3653
3660
|
};
|
|
3654
3661
|
|
|
3655
3662
|
const renderItems = (oldState, newState) => {
|
|
@@ -3669,8 +3676,7 @@ const renderItems = (oldState, newState) => {
|
|
|
3669
3676
|
if (initial) {
|
|
3670
3677
|
return [SetDom2, id, []];
|
|
3671
3678
|
}
|
|
3672
|
-
const
|
|
3673
|
-
const dom = getSourceControlVirtualDom(visibleItems, sourceControlButtons, items.length === 0, inputPlaceholder, inputMessage, unavailableMessage, loading, scrollBarHeight, scrollBarActive);
|
|
3679
|
+
const dom = getSourceControlVirtualDom(visibleItems, sourceControlButtons, items.length === 0, inputPlaceholder, inputMessage, loading ? '' : providerUnavailableMessage, loading, scrollBarHeight, scrollBarActive);
|
|
3674
3680
|
return [SetDom2, id, dom];
|
|
3675
3681
|
};
|
|
3676
3682
|
|