@lvce-editor/extension-detail-view 3.56.0 → 3.58.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.
@@ -11,7 +11,7 @@ const i18nString = (key, placeholders = emptyObject) => {
11
11
  };
12
12
 
13
13
  const ActivationEvents$1 = 'Activation Events';
14
- const RuntimeStatus$1 = 'Runtime Status';
14
+ const ActivationTime = 'Activation Time: ';
15
15
  const Categories$1 = 'Categories';
16
16
  const Changelog$2 = 'Changelog';
17
17
  const Commands$1 = 'Commands';
@@ -22,43 +22,43 @@ const CopyImageUrl = 'Copy Image Url';
22
22
  const Details$1 = 'Details';
23
23
  const Disable$1 = 'Disable';
24
24
  const Elements = 'Elements';
25
+ const EmptyCommandsArray = 'The extension contributes an empty commands array.';
26
+ const Enable$1 = 'Enable';
25
27
  const Features$2 = 'Features';
26
28
  const FileMatch = 'File Match';
27
29
  const Id = 'ID';
30
+ const Identifier = 'Identifier';
31
+ const ImportTime = 'Import Time: ';
28
32
  const Installation = 'Installation';
33
+ const Issues = 'Issues';
29
34
  const JsonValidation$1 = 'Json Validation';
30
35
  const Label = 'Label';
36
+ const LastReleased = 'Last Released';
37
+ const LastUpdated = 'Last Updated';
38
+ const License = 'License';
31
39
  const Marketplace = 'Marketplace';
32
40
  const None$3 = 'None';
33
41
  const NoReadmeFound = 'No Readme Found.';
34
- const EmptyCommandsArray = 'The extension contributed an empty commands array.';
35
42
  const OpenImageInNewTab = 'Open Image in New Tab';
36
43
  const OpenInNewTab = 'Open in New Tab';
37
44
  const ProgrammingLanguages$1 = 'Programming Languages';
45
+ const Published = 'Published';
46
+ const Repository = 'Repository';
38
47
  const Resources$1 = 'Resources';
48
+ const RuntimeStatus$1 = 'Runtime Status';
39
49
  const SaveImageAs = 'Save Image as';
40
50
  const Schema = 'Schema';
41
51
  const ScrollToTop$1 = 'Scroll to top';
52
+ const SelectedFeatureUnknownOrUnsupported = 'Selected feature is unknown or unsupported';
42
53
  const Selector = 'Selector';
43
54
  const SetColorTheme$1 = 'Set Color Theme';
44
- const Enable$1 = 'Enable';
45
55
  const Settings$1 = 'Settings';
56
+ const Size = 'Size';
46
57
  const Theme$1 = 'Theme';
47
58
  const Uninstall$1 = 'Uninstall';
48
- const WebViews$1 = 'WebViews';
49
- const ImportTime = 'Import Time: ';
50
- const ActivationTime = 'Activation Time: ';
51
59
  const UnsupportedFeature = 'Unsupported Feature';
52
- const SelectedFeatureUnknownOrUnsupported = 'Selected feature is unknown or unsupported';
53
- const Identifier = 'Identifier';
54
60
  const Version = 'Version';
55
- const LastUpdated = 'Last Updated';
56
- const Size = 'Size';
57
- const Published = 'Published';
58
- const LastReleased = 'Last Released';
59
- const Issues = 'Issues';
60
- const Repository = 'Repository';
61
- const License = 'License';
61
+ const WebViews$1 = 'WebViews';
62
62
 
63
63
  const installation = () => {
64
64
  return i18nString(Installation);
@@ -248,6 +248,7 @@ const THead = 14;
248
248
  const Tr = 15;
249
249
  const Img = 17;
250
250
  const H2 = 22;
251
+ const Aside$1 = 28;
251
252
  const Dd = 43;
252
253
  const Dl = 44;
253
254
  const Li = 48;
@@ -260,6 +261,7 @@ const Dt = 67;
260
261
  const VirtualDomElements = {
261
262
  __proto__: null,
262
263
  A,
264
+ Aside: Aside$1,
263
265
  Button: Button$1,
264
266
  Code: Code$2,
265
267
  Dd,
@@ -524,10 +526,11 @@ const getCommandsVirtualDom = state => {
524
526
  };
525
527
 
526
528
  const getJsonValidationTableEntry = validation => {
529
+ // TODO handle case when validation is invalid like null
527
530
  const {
528
- fileMatch,
529
- schema
531
+ fileMatch
530
532
  } = validation;
533
+ const schema = validation.schema ?? validation.url;
531
534
  return [{
532
535
  type: Code,
533
536
  value: fileMatch
@@ -688,9 +691,9 @@ const create$7 = rpcId => {
688
691
  };
689
692
  };
690
693
  const ExtensionHostWorker = 44;
691
- const RendererWorker$1 = 1;
692
694
  const FileSystemWorker$1 = 209;
693
695
  const MarkdownWorker$1 = 300;
696
+ const RendererWorker$1 = 1;
694
697
  const {
695
698
  invoke: invoke$9,
696
699
  set: set$9} = create$7(ExtensionHostWorker);
@@ -902,17 +905,21 @@ const getStatusMessage = statusType => {
902
905
  }
903
906
  };
904
907
 
908
+ const key = {
909
+ type: VirtualDomElements.Dt,
910
+ childCount: 1,
911
+ className: 'RuntimeStatusDefinitionListKey'
912
+ };
913
+ const value = {
914
+ type: VirtualDomElements.Dd,
915
+ className: 'RuntimeStatusDefinitionListValue',
916
+ childCount: 1
917
+ };
905
918
  const getStatusVirtualDom = status => {
906
919
  const statusString = getStatusMessage(status);
907
- return [{
908
- type: VirtualDomElements.Dt,
909
- childCount: 1
910
- }, text(`Status: `),
920
+ return [key, text(`Status: `),
911
921
  // i18n
912
- {
913
- type: VirtualDomElements.Dd,
914
- childCount: 1
915
- }, text(`${statusString}`)];
922
+ value, text(`${statusString}`)];
916
923
  };
917
924
 
918
925
  const getChildCount$1 = (status, activationTime, importTime) => {
@@ -937,6 +944,7 @@ const getRuntimeStatusVirtualDom = state => {
937
944
  childCount: 2
938
945
  }, ...getFeatureContentHeadingVirtualDom(heading), {
939
946
  type: VirtualDomElements.Dl,
947
+ className: 'RuntimeStatusDefinitionList',
940
948
  childCount
941
949
  }, ...getStatusVirtualDom(status), ...getActivationTimeVirtualDom(activationTime, importTime)];
942
950
  };
@@ -1929,7 +1937,8 @@ const splitLines = lines => {
1929
1937
  return lines.split(NewLine);
1930
1938
  };
1931
1939
  const getCurrentStack = () => {
1932
- const currentStack = joinLines(splitLines(new Error().stack || '').slice(2));
1940
+ const stackLinesToSkip = 3;
1941
+ const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
1933
1942
  return currentStack;
1934
1943
  };
1935
1944
  const getNewLineIndex = (string, startIndex = undefined) => {
@@ -2200,6 +2209,12 @@ const invokeAndTransfer = (ipc, method, ...params) => {
2200
2209
  return invokeHelper(ipc, method, params, true);
2201
2210
  };
2202
2211
 
2212
+ class CommandNotFoundError extends Error {
2213
+ constructor(command) {
2214
+ super(`Command not found ${command}`);
2215
+ this.name = 'CommandNotFoundError';
2216
+ }
2217
+ }
2203
2218
  const commands = Object.create(null);
2204
2219
  const register = commandMap => {
2205
2220
  Object.assign(commands, commandMap);
@@ -2210,7 +2225,7 @@ const getCommand = key => {
2210
2225
  const execute = (command, ...args) => {
2211
2226
  const fn = getCommand(command);
2212
2227
  if (!fn) {
2213
- throw new Error(`command not found ${command}`);
2228
+ throw new CommandNotFoundError(command);
2214
2229
  }
2215
2230
  return fn(...args);
2216
2231
  };
@@ -2498,6 +2513,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2498
2513
  description: '',
2499
2514
  detailsVirtualDom: [],
2500
2515
  displaySize: '',
2516
+ downloadCount: 'n/a',
2501
2517
  installationEntries: [],
2502
2518
  extension: {},
2503
2519
  extensionId: '',
@@ -2512,6 +2528,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2512
2528
  name: '',
2513
2529
  platform,
2514
2530
  programmingLanguages: [],
2531
+ rating: 'n/a',
2515
2532
  readmeScrollTop: 0,
2516
2533
  resources: [],
2517
2534
  scrollSource: 0,
@@ -2529,11 +2546,17 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2529
2546
  uri,
2530
2547
  webViews: [],
2531
2548
  width,
2532
- readmeUrl: ''
2549
+ readmeUrl: '',
2550
+ paddingLeft: 0,
2551
+ paddingRight: 0
2533
2552
  };
2534
2553
  set(uid, state, state);
2535
2554
  };
2536
2555
 
2556
+ const isEqual$3 = (oldState, newState) => {
2557
+ return oldState.paddingLeft === newState.paddingLeft && oldState.paddingRight === newState.paddingRight;
2558
+ };
2559
+
2537
2560
  const isEqual$2 = (oldState, newState) => {
2538
2561
  return oldState.focus === newState.focus;
2539
2562
  };
@@ -2552,9 +2575,10 @@ const isEqual = (oldState, newState) => {
2552
2575
  const RenderFocus = 2;
2553
2576
  const RenderItems = 3;
2554
2577
  const RenderScrollTop = 4;
2578
+ const RenderCss = 5;
2555
2579
 
2556
- const modules = [isEqual$1, isEqual$2, isEqual];
2557
- const numbers = [RenderItems, RenderFocus, RenderScrollTop];
2580
+ const modules = [isEqual$1, isEqual$2, isEqual, isEqual$3];
2581
+ const numbers = [RenderItems, RenderFocus, RenderScrollTop, RenderCss];
2558
2582
 
2559
2583
  const diff2 = uid => {
2560
2584
  const {
@@ -3326,7 +3350,8 @@ function prettyBytes(number, options) {
3326
3350
  const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
3327
3351
  number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
3328
3352
  if (!localeOptions) {
3329
- number = number.toPrecision(3);
3353
+ const minPrecision = Math.max(3, Number.parseInt(number, 10).toString().length);
3354
+ number = number.toPrecision(minPrecision);
3330
3355
  }
3331
3356
  const numberString = toLocaleString(Number(number), options.locale, localeOptions);
3332
3357
  const unit = UNITS[exponent];
@@ -3534,6 +3559,8 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
3534
3559
  resources,
3535
3560
  folderSize
3536
3561
  } = await loadSideBarContent(extensionId, extensionVersion, extensionUri, isBuiltin);
3562
+ const paddingLeft = 30;
3563
+ const paddingRight = 30;
3537
3564
  return {
3538
3565
  ...state,
3539
3566
  badge,
@@ -3565,7 +3592,9 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
3565
3592
  selectedTab,
3566
3593
  sizeOnDisk: size,
3567
3594
  sizeValue,
3568
- tabs: enabledTabs
3595
+ tabs: enabledTabs,
3596
+ paddingLeft,
3597
+ paddingRight
3569
3598
  };
3570
3599
  };
3571
3600
 
@@ -3586,6 +3615,27 @@ const openImageInNewTab = async state => {
3586
3615
  return state;
3587
3616
  };
3588
3617
 
3618
+ /* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
3619
+
3620
+ const createCss = object => {
3621
+ const inner = Object.entries(object).map(([key, value]) => ` --${key}: ${value}px;`).join('\n');
3622
+ const full = `:root {\n${inner}\n}`;
3623
+ return full;
3624
+ };
3625
+
3626
+ const renderCss = (oldState, newState) => {
3627
+ const {
3628
+ uid,
3629
+ paddingLeft,
3630
+ paddingRight
3631
+ } = newState;
3632
+ const css = createCss({
3633
+ ExtensionDetailPaddingLeft: paddingLeft,
3634
+ ExtensionDetailPaddingRight: paddingRight
3635
+ });
3636
+ return ['Viewlet.setCss', uid, css];
3637
+ };
3638
+
3589
3639
  const getChangelogVirtualDom = changelogDom => {
3590
3640
  // const notImplemented = ExtensionDetailStrings.notImplemented()
3591
3641
  // TODO set tabpanel role
@@ -3642,12 +3692,14 @@ const getMoreInfoEntryKeyVirtualDom = item => {
3642
3692
  return [parentNode, text(key)];
3643
3693
  };
3644
3694
 
3695
+ const classLink = mergeClassNames(MoreInfoEntryValue, Link);
3696
+ const classCode = mergeClassNames(MoreInfoEntryValue, Code$1);
3645
3697
  const getMoreInfoEntryValueClassName = (onClick, code) => {
3646
3698
  if (onClick) {
3647
- return mergeClassNames(MoreInfoEntryValue, Link);
3699
+ return classLink;
3648
3700
  }
3649
3701
  if (code) {
3650
- return mergeClassNames(MoreInfoEntryValue, Code$1);
3702
+ return classCode;
3651
3703
  }
3652
3704
  return MoreInfoEntryValue;
3653
3705
  };
@@ -3672,7 +3724,7 @@ const getMoreInfoEntryValueVirtualDom = item => {
3672
3724
  const type = getMoreInfoEntryValueTag(onClick, code);
3673
3725
  const className = getMoreInfoEntryValueClassName(onClick, code);
3674
3726
  return [{
3675
- type: type,
3727
+ type,
3676
3728
  className,
3677
3729
  childCount: 1,
3678
3730
  onClick,
@@ -3681,12 +3733,12 @@ const getMoreInfoEntryValueVirtualDom = item => {
3681
3733
  };
3682
3734
 
3683
3735
  const parentNodeEven = {
3684
- type: VirtualDomElements.Dt,
3736
+ type: VirtualDomElements.Div,
3685
3737
  className: MoreInfoEntry,
3686
3738
  childCount: 2
3687
3739
  };
3688
3740
  const parentNodeOdd = {
3689
- type: VirtualDomElements.Dt,
3741
+ type: VirtualDomElements.Div,
3690
3742
  className: mergeClassNames(MoreInfoEntry, MoreInfoEntryOdd),
3691
3743
  childCount: 2
3692
3744
  };
@@ -3732,7 +3784,7 @@ const getAdditionalDetailsVirtualDom = (showAdditionalDetails, firstHeading, ent
3732
3784
  return [];
3733
3785
  }
3734
3786
  return [{
3735
- type: VirtualDomElements.Div,
3787
+ type: VirtualDomElements.Aside,
3736
3788
  className: Aside,
3737
3789
  childCount: 1
3738
3790
  }, {
@@ -3797,6 +3849,15 @@ const getFeatureListVirtualDom = features => {
3797
3849
  }, ...features.flatMap(getFeatureListItemVirtualDom)];
3798
3850
  };
3799
3851
 
3852
+ const getFeaturesEmptyVirtualDom = () => {
3853
+ const none$1 = none();
3854
+ return [{
3855
+ type: VirtualDomElements.Div,
3856
+ className: Features$1,
3857
+ childCount: 1
3858
+ }, text(none$1)];
3859
+ };
3860
+
3800
3861
  const sash = {
3801
3862
  type: VirtualDomElements.Div,
3802
3863
  className: mergeClassNames(Sash, SashVertical),
@@ -3804,12 +3865,7 @@ const sash = {
3804
3865
  };
3805
3866
  const getFeaturesVirtualDom = (features, selectedFeature, state) => {
3806
3867
  if (features.length === 0) {
3807
- const none$1 = none();
3808
- return [{
3809
- type: VirtualDomElements.Div,
3810
- className: Features$1,
3811
- childCount: 1
3812
- }, text(none$1)];
3868
+ return getFeaturesEmptyVirtualDom();
3813
3869
  }
3814
3870
  const fn = getFeatureVirtualDomHandler(selectedFeature);
3815
3871
  const featureVirtualDom = fn(state);
@@ -4049,6 +4105,8 @@ const getRenderer = diffType => {
4049
4105
  return renderFocus;
4050
4106
  case RenderScrollTop:
4051
4107
  return renderScrollTop;
4108
+ case RenderCss:
4109
+ return renderCss;
4052
4110
  default:
4053
4111
  throw new Error('unknown renderer');
4054
4112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.56.0",
3
+ "version": "3.58.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",