@lvce-editor/source-control-worker 3.17.0 → 3.18.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.
@@ -4,7 +4,7 @@
4
4
  "description": "Controls whether source control actions use a split button.",
5
5
  "heading": "Split Button",
6
6
  "id": "sourceControl.splitButtonEnabled",
7
- "type": 3,
7
+ "type": "boolean",
8
8
  "value": "false"
9
9
  }
10
10
  ]
@@ -2038,6 +2038,18 @@ const getEnabledProviderIds = (scheme, root, assetDir, platform) => {
2038
2038
  const getGroups$1 = (providerId, root, assetDir, platform) => {
2039
2039
  return getGroups$2(providerId, root, assetDir, platform);
2040
2040
  };
2041
+ const getIconDefinition = (icon, baseUri, platform) => {
2042
+ if (!URL.canParse(icon, baseUri)) {
2043
+ throw new Error('Invalid source control icon URL');
2044
+ }
2045
+ const uri = new URL(icon, baseUri).href;
2046
+ if (platform === Electron || platform === Remote) {
2047
+ const protocol = getProtocol(uri);
2048
+ const path = getPath(protocol, uri);
2049
+ return `/remote${path.startsWith('/') ? '' : '/'}${path}`;
2050
+ }
2051
+ return uri;
2052
+ };
2041
2053
  const getIconDefinitions = async (providerIds, assetDir, platform) => {
2042
2054
  try {
2043
2055
  if (providerIds.length === 0) {
@@ -2053,15 +2065,7 @@ const getIconDefinitions = async (providerIds, assetDir, platform) => {
2053
2065
  }
2054
2066
  const icons = extension['source-control-icons'].filter(icon => typeof icon === 'string');
2055
2067
  const baseUri = extension.uri.endsWith('/') ? extension.uri : `${extension.uri}/`;
2056
- return icons.map(icon => {
2057
- const uri = new URL(icon, baseUri).href;
2058
- if (platform === Electron || platform === Remote) {
2059
- const protocol = getProtocol(uri);
2060
- const path = getPath(protocol, uri);
2061
- return `/remote${path.startsWith('/') ? '' : '/'}${path}`;
2062
- }
2063
- return uri;
2064
- });
2068
+ return icons.map(icon => getIconDefinition(icon, baseUri, platform));
2065
2069
  } catch {
2066
2070
  return [];
2067
2071
  }
@@ -3914,6 +3918,9 @@ const getIconsDom = (icon, fileIcon) => {
3914
3918
  if (icon === ChevronRight) {
3915
3919
  return [chevron, getIconVirtualDom(icon)];
3916
3920
  }
3921
+ if (!fileIcon) {
3922
+ return [];
3923
+ }
3917
3924
  return [getFileIconVirtualDom(fileIcon)];
3918
3925
  };
3919
3926
  const createItemOther = item => {
@@ -3935,16 +3942,17 @@ const createItemOther = item => {
3935
3942
  const dom = [];
3936
3943
  const hasButtons = buttons.length;
3937
3944
  const buttonsDom = getButtonsVirtualDom(buttons);
3945
+ const iconsDom = getIconsDom(icon, fileIcon);
3938
3946
  const treeItemClassName = getTreeItemClassName(indent);
3939
3947
  dom.push({
3940
3948
  ariaPosInSet: posInSet,
3941
3949
  ariaSetSize: setSize,
3942
- childCount: 3 + (hasButtons ? 1 : 0),
3950
+ childCount: 2 + (iconsDom.length > 0 ? 1 : 0) + (hasButtons ? 1 : 0),
3943
3951
  className: treeItemClassName,
3944
3952
  role: TreeItem$1,
3945
3953
  title: file,
3946
3954
  type: Div
3947
- }, ...getIconsDom(icon, fileIcon));
3955
+ }, ...iconsDom);
3948
3956
  const labelDom = {
3949
3957
  childCount: 1,
3950
3958
  className: labelClassName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/source-control-worker",
3
- "version": "3.17.0",
3
+ "version": "3.18.0",
4
4
  "description": "Source Control Worker",
5
5
  "keywords": [
6
6
  "Lvce Editor"