@lvce-editor/source-control-worker 3.13.0 → 3.14.1

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.
@@ -1744,8 +1744,9 @@ const getIconDefinitions = async (providerIds, assetDir, platform) => {
1744
1744
  return [];
1745
1745
  }
1746
1746
  const icons = extension['source-control-icons'].filter(icon => typeof icon === 'string');
1747
+ const baseUri = extension.uri.endsWith('/') ? extension.uri : `${extension.uri}/`;
1747
1748
  return icons.map(icon => {
1748
- const uri = `${extension.uri}/${icon}`;
1749
+ const uri = new URL(icon, baseUri).href;
1749
1750
  if (platform === Electron || platform === Remote) {
1750
1751
  const protocol = getProtocol(uri);
1751
1752
  const path = getPath(protocol, uri);
@@ -3102,9 +3103,19 @@ const set = rpc => {
3102
3103
  state.connected = true;
3103
3104
  };
3104
3105
 
3105
- const handleRendererProcessMessagePort = async port => {
3106
+ const handleRendererProcessMessagePort = async (port, viewletCommandMap) => {
3107
+ const executeViewletCommand = async (uid, command, ...args) => {
3108
+ const fn = viewletCommandMap[`SourceControl.${command}`];
3109
+ if (typeof fn !== 'function') {
3110
+ throw new TypeError(`Viewlet command not found: ${command}`);
3111
+ }
3112
+ await fn(uid, ...args);
3113
+ await invoke$1('Viewlet.requestRender', uid);
3114
+ };
3106
3115
  const rpc = await create$4({
3107
- commandMap: {},
3116
+ commandMap: {
3117
+ 'Viewlet.executeViewletCommand': executeViewletCommand
3118
+ },
3108
3119
  messagePort: port
3109
3120
  });
3110
3121
  set(rpc);
@@ -3334,11 +3345,18 @@ const renderCss = (oldState, newState) => {
3334
3345
  const listHeight = Math.max(height - headerHeight, 0);
3335
3346
  const scrollBarY = scrollBarHeight > 0 ? getScrollBarY(deltaY, finalDeltaY, listHeight, scrollBarHeight) : 0;
3336
3347
  const itemOffset = -(deltaY % itemHeight);
3337
- const indentCss = indentRules ? `\n${indentRules}\n` : '';
3348
+ const indentCss = indentRules ? `${indentRules}\n` : '';
3338
3349
  const css = `:root {
3339
3350
  --SourceControlInputHeight: ${inputBoxHeight}px;
3340
3351
  }
3341
3352
 
3353
+ .SourceControl .SplitButtonContent > .MaskIcon {
3354
+ width: 16px;
3355
+ height: 16px;
3356
+ margin-right: 4px;
3357
+ flex-shrink: 0;
3358
+ }
3359
+
3342
3360
  .SourceControl .ScrollBarThumb {
3343
3361
  height: ${scrollBarHeight}px;
3344
3362
  translate: 0 ${Math.round(scrollBarY)}px;
@@ -3347,7 +3365,11 @@ const renderCss = (oldState, newState) => {
3347
3365
  .SourceControlItems > .TreeItem:first-child {
3348
3366
  margin-top: ${itemOffset}px;
3349
3367
  }
3350
- ${indentCss}`;
3368
+
3369
+ ${indentCss}.IndentRight-12 {
3370
+ padding-right: 12px;
3371
+ }
3372
+ `;
3351
3373
  return [SetCss, id, css];
3352
3374
  };
3353
3375
 
@@ -3371,6 +3393,7 @@ const InputBox = 'InputBox';
3371
3393
  const Label = 'Label';
3372
3394
  const LabelDetail = 'LabelDetail';
3373
3395
  const List = 'List';
3396
+ const ListItems = 'ListItems';
3374
3397
  const Message = 'Message';
3375
3398
  const Progress = 'Progress';
3376
3399
  const ProgressContainer = 'ProgressContainer';
@@ -3389,6 +3412,7 @@ const SplitButtonDisabled = 'SplitButtonDisabled';
3389
3412
  const StrikeThrough = 'StrikeThrough';
3390
3413
  const TreeItem = 'TreeItem';
3391
3414
  const Viewlet = 'Viewlet';
3415
+ const ViewSourceControlInput = 'ViewSourceControlInput';
3392
3416
 
3393
3417
  const HandleClickAt = 1;
3394
3418
  const HandleContextMenu = 2;
@@ -3459,8 +3483,13 @@ const messageNode$1 = {
3459
3483
  className: Message,
3460
3484
  type: Div
3461
3485
  };
3486
+ const inputWrapperNode = {
3487
+ childCount: 1,
3488
+ className: ViewSourceControlInput,
3489
+ type: Div
3490
+ };
3462
3491
  const getSourceControlInputDom = (inputPlaceholder, inputMessage) => {
3463
- const dom = [{
3492
+ const dom = [inputWrapperNode, {
3464
3493
  ariaLabel: sourceControlInput(),
3465
3494
  autocapitalize: 'off',
3466
3495
  autocorrect: 'off',
@@ -3554,13 +3583,9 @@ const getLabelClassName = decorationStrikeThrough => {
3554
3583
  };
3555
3584
 
3556
3585
  const getTreeItemClassName = indent => {
3557
- let className = TreeItem;
3558
- className = mergeClassNames(className, `Indent-${indent}`);
3559
- return className;
3586
+ return mergeClassNames(TreeItem, `Indent-${indent}`, 'IndentRight-12');
3560
3587
  };
3561
3588
 
3562
- const PaddingRight = '12px';
3563
-
3564
3589
  const createItemDirectory = item => {
3565
3590
  const {
3566
3591
  badgeCount,
@@ -3583,7 +3608,6 @@ const createItemDirectory = item => {
3583
3608
  ariaSetSize: setSize,
3584
3609
  childCount: 3 + (hasButtons ? 1 : 0),
3585
3610
  className: treeItemClassName,
3586
- paddingRight: PaddingRight,
3587
3611
  role: TreeItem$1,
3588
3612
  type: Div
3589
3613
  }, {
@@ -3648,7 +3672,6 @@ const createItemOther = item => {
3648
3672
  ariaSetSize: setSize,
3649
3673
  childCount: 3 + (hasButtons ? 1 : 0),
3650
3674
  className: treeItemClassName,
3651
- paddingRight: '12px',
3652
3675
  role: TreeItem$1,
3653
3676
  title: file,
3654
3677
  type: Div
@@ -3692,7 +3715,7 @@ const getSourceControlListVirtualDom = (items, scrollBarHeight, scrollBarActive)
3692
3715
  type: Div
3693
3716
  }, {
3694
3717
  childCount: items.length,
3695
- className: SourceControlItems,
3718
+ className: mergeClassNames(ListItems, SourceControlItems),
3696
3719
  onClick: HandleClickAt,
3697
3720
  onPointerOut: HandleMouseOutAt,
3698
3721
  onPointerOver: HandleMouseOverAt,
@@ -4014,6 +4037,7 @@ const viewAsList = state => {
4014
4037
  };
4015
4038
  };
4016
4039
 
4040
+ const handleDirectMessagePort = port => handleRendererProcessMessagePort(port, commandMap);
4017
4041
  const commandMap = {
4018
4042
  'Initialize.initialize': initialize,
4019
4043
  'SourceControl.acceptInput': wrapCommand(acceptInput),
@@ -4042,7 +4066,7 @@ const commandMap = {
4042
4066
  'SourceControl.handleMouseOutAt': wrapCommand(handleMouseOutAt),
4043
4067
  'SourceControl.handleMouseOver': wrapCommand(handleMouseOver),
4044
4068
  'SourceControl.handleMouseOverAt': wrapCommand(handleMouseOverAt),
4045
- 'SourceControl.handleRendererProcessMessagePort': handleRendererProcessMessagePort,
4069
+ 'SourceControl.handleRendererProcessMessagePort': handleDirectMessagePort,
4046
4070
  'SourceControl.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
4047
4071
  'SourceControl.handleScrollBarClick': wrapCommand(handleScrollBarClick),
4048
4072
  'SourceControl.handleScrollBarMove': wrapCommand(handleScrollBarMove),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/source-control-worker",
3
- "version": "3.13.0",
3
+ "version": "3.14.1",
4
4
  "description": "Source Control Worker",
5
5
  "keywords": [
6
6
  "Lvce Editor"