@lvce-editor/source-control-worker 1.18.0 → 1.19.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.
@@ -1040,10 +1040,10 @@ const TreeItem$1 = 'treeitem';
1040
1040
 
1041
1041
  const Button$2 = 1;
1042
1042
  const Div = 4;
1043
- const Input = 6;
1044
1043
  const Span = 8;
1045
1044
  const Text = 12;
1046
1045
  const Img = 17;
1046
+ const TextArea = 62;
1047
1047
 
1048
1048
  const TargetValue = 'event.target.value';
1049
1049
  const ClientX = 'event.clientX';
@@ -1605,7 +1605,8 @@ const create2 = (id, uri, x, y, width, height, workspacePath) => {
1605
1605
  workingTree: [],
1606
1606
  workspacePath,
1607
1607
  x,
1608
- y
1608
+ y,
1609
+ inputPlaceholder: ''
1609
1610
  };
1610
1611
  set$1(id, state, state);
1611
1612
  };
@@ -1968,6 +1969,28 @@ const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
1968
1969
  return Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize);
1969
1970
  };
1970
1971
 
1972
+ const emptyObject = {};
1973
+ const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1974
+ const i18nString = (key, placeholders = emptyObject) => {
1975
+ if (placeholders === emptyObject) {
1976
+ return key;
1977
+ }
1978
+ const replacer = (match, rest) => {
1979
+ return placeholders[rest];
1980
+ };
1981
+ return key.replaceAll(RE_PLACEHOLDER, replacer);
1982
+ };
1983
+
1984
+ const MessageEnterToCommitOnMaster = `Message (Enter) to commit on 'master'`;
1985
+ const SourceControlInput$1 = 'Source Control Input';
1986
+
1987
+ const messageEnterToCommitOnMaster = () => {
1988
+ return i18nString(MessageEnterToCommitOnMaster);
1989
+ };
1990
+ const sourceControlInput = () => {
1991
+ return i18nString(SourceControlInput$1);
1992
+ };
1993
+
1971
1994
  const loadContent = async state => {
1972
1995
  const {
1973
1996
  itemHeight,
@@ -1997,20 +2020,22 @@ const loadContent = async state => {
1997
2020
  const newFileIconCache = await getFileIcons(displayItems, fileIconCache);
1998
2021
  const visibleItems = getVisibleSourceControlItems(displayItems, minLineY, maxLineY, actionsCache, newFileIconCache);
1999
2022
  const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
2023
+ const inputPlaceholder = messageEnterToCommitOnMaster();
2000
2024
  return {
2001
2025
  ...state,
2026
+ actionsCache,
2002
2027
  allGroups,
2028
+ enabledProviderIds,
2029
+ fileIconCache: newFileIconCache,
2030
+ finalDeltaY,
2003
2031
  gitRoot,
2032
+ inputPlaceholder,
2004
2033
  items: displayItems,
2005
- visibleItems,
2006
- enabledProviderIds,
2007
- root,
2008
- splitButtonEnabled,
2009
2034
  maxLineY,
2035
+ root,
2010
2036
  scrollBarHeight,
2011
- finalDeltaY,
2012
- fileIconCache: newFileIconCache,
2013
- actionsCache
2037
+ splitButtonEnabled,
2038
+ visibleItems
2014
2039
  };
2015
2040
  };
2016
2041
 
@@ -2362,50 +2387,32 @@ const HandleMouseOver = 'handleMouseOver';
2362
2387
  const HandleMouseOverAt = 'handleMouseOverAt';
2363
2388
  const HandleWheel = 'handleWheel';
2364
2389
 
2365
- const SourceControlInput$1 = 'SourceControlInput';
2390
+ const SourceControlInput = 'SourceControlInput';
2366
2391
 
2367
- const emptyObject = {};
2368
- const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
2369
- const i18nString = (key, placeholders = emptyObject) => {
2370
- if (placeholders === emptyObject) {
2371
- return key;
2372
- }
2373
- const replacer = (match, rest) => {
2374
- return placeholders[rest];
2375
- };
2376
- return key.replaceAll(RE_PLACEHOLDER, replacer);
2377
- };
2378
-
2379
- const MessageEnterToCommitOnMaster = `Message (Enter) to commit on 'master'`;
2380
- const SourceControlInput = 'Source Control Input';
2381
-
2382
- const messageEnterToCommitOnMaster = () => {
2383
- return i18nString(MessageEnterToCommitOnMaster);
2384
- };
2385
- const sourceControlInput = () => {
2386
- return i18nString(SourceControlInput);
2387
- };
2388
-
2389
- const getSourceControlHeaderVirtualDom = () => {
2392
+ const getSourceControlInputDom = inputPlaceholder => {
2390
2393
  return [{
2391
- type: Div,
2392
- className: SourceControlHeader,
2393
- childCount: 1
2394
- }, {
2395
- type: Input,
2396
- className: InputBox,
2394
+ type: TextArea,
2395
+ className: mergeClassNames(InputBox, 'MultilineInputBox'),
2397
2396
  ariaLabel: sourceControlInput(),
2398
2397
  autocapitalize: 'off',
2399
2398
  autocorrect: 'off',
2400
2399
  childCount: 0,
2401
- name: SourceControlInput$1,
2400
+ name: SourceControlInput,
2402
2401
  onFocus: HandleFocus,
2403
2402
  onInput: HandleInput,
2404
- placeholder: messageEnterToCommitOnMaster(),
2403
+ placeholder: inputPlaceholder,
2405
2404
  spellcheck: false
2406
2405
  }];
2407
2406
  };
2408
2407
 
2408
+ const getSourceControlHeaderVirtualDom = inputPlaceholder => {
2409
+ return [{
2410
+ type: Div,
2411
+ className: SourceControlHeader,
2412
+ childCount: 1
2413
+ }, ...getSourceControlInputDom(inputPlaceholder)];
2414
+ };
2415
+
2409
2416
  const getBadgeVirtualDom = (className, count) => {
2410
2417
  return [{
2411
2418
  type: Div,
@@ -2621,7 +2628,7 @@ const getSplitButtonVirtualDom = (hasItems, splitButtonEnabled, buttonText) => {
2621
2628
  }];
2622
2629
  };
2623
2630
 
2624
- const getSourceControlVirtualDom = (items, splitButtonEnabled) => {
2631
+ const getSourceControlVirtualDom = (items, splitButtonEnabled, inputPlaceholder) => {
2625
2632
  const hasItems = items.length > 0;
2626
2633
  const dom = [{
2627
2634
  type: Div,
@@ -2632,13 +2639,17 @@ const getSourceControlVirtualDom = (items, splitButtonEnabled) => {
2632
2639
  onMouseOut: HandleMouseOut,
2633
2640
  onWheel: HandleWheel,
2634
2641
  childCount: splitButtonEnabled ? 3 : 2
2635
- }, ...getSourceControlHeaderVirtualDom(), ...getSplitButtonVirtualDom(hasItems, splitButtonEnabled, 'Commit'), ...getSourceControlListVirtualDom(items)];
2642
+ }, ...getSourceControlHeaderVirtualDom(inputPlaceholder), ...getSplitButtonVirtualDom(hasItems, splitButtonEnabled, 'Commit'), ...getSourceControlListVirtualDom(items)];
2636
2643
  return dom;
2637
2644
  };
2638
2645
 
2639
2646
  const renderItems = (oldState, newState) => {
2640
- const visible = newState.visibleItems;
2641
- const dom = getSourceControlVirtualDom(visible, newState.splitButtonEnabled);
2647
+ const {
2648
+ visibleItems,
2649
+ splitButtonEnabled,
2650
+ inputPlaceholder
2651
+ } = newState;
2652
+ const dom = getSourceControlVirtualDom(visibleItems, splitButtonEnabled, inputPlaceholder);
2642
2653
  return [SetDom2, dom];
2643
2654
  };
2644
2655
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/source-control-worker",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "description": "Source Control Worker",
5
5
  "keywords": [
6
6
  "Lvce Editor"