@lvce-editor/extension-detail-view 3.54.0 → 3.56.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.
@@ -41,10 +41,24 @@ const Schema = 'Schema';
41
41
  const ScrollToTop$1 = 'Scroll to top';
42
42
  const Selector = 'Selector';
43
43
  const SetColorTheme$1 = 'Set Color Theme';
44
+ const Enable$1 = 'Enable';
44
45
  const Settings$1 = 'Settings';
45
46
  const Theme$1 = 'Theme';
46
47
  const Uninstall$1 = 'Uninstall';
47
48
  const WebViews$1 = 'WebViews';
49
+ const ImportTime = 'Import Time: ';
50
+ const ActivationTime = 'Activation Time: ';
51
+ const UnsupportedFeature = 'Unsupported Feature';
52
+ const SelectedFeatureUnknownOrUnsupported = 'Selected feature is unknown or unsupported';
53
+ const Identifier = 'Identifier';
54
+ 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';
48
62
 
49
63
  const installation = () => {
50
64
  return i18nString(Installation);
@@ -103,6 +117,9 @@ const schema = () => {
103
117
  const setColorTheme$3 = () => {
104
118
  return i18nString(SetColorTheme$1);
105
119
  };
120
+ const enable = () => {
121
+ return i18nString(Enable$1);
122
+ };
106
123
  const theme = () => {
107
124
  return i18nString(Theme$1);
108
125
  };
@@ -151,6 +168,45 @@ const noReadmeFound = () => {
151
168
  const emptyCommandsArray = () => {
152
169
  return i18nString(EmptyCommandsArray);
153
170
  };
171
+ const importTime = () => {
172
+ return i18nString(ImportTime);
173
+ };
174
+ const activationTime = () => {
175
+ return i18nString(ActivationTime);
176
+ };
177
+ const unsupportedFeature = () => {
178
+ return i18nString(UnsupportedFeature);
179
+ };
180
+ const selectedFeatureUnknownOrUnsupported = () => {
181
+ return i18nString(SelectedFeatureUnknownOrUnsupported);
182
+ };
183
+ const identifier = () => {
184
+ return i18nString(Identifier);
185
+ };
186
+ const version = () => {
187
+ return i18nString(Version);
188
+ };
189
+ const lastUpdated = () => {
190
+ return i18nString(LastUpdated);
191
+ };
192
+ const size = () => {
193
+ return i18nString(Size);
194
+ };
195
+ const published = () => {
196
+ return i18nString(Published);
197
+ };
198
+ const lastReleased = () => {
199
+ return i18nString(LastReleased);
200
+ };
201
+ const issues = () => {
202
+ return i18nString(Issues);
203
+ };
204
+ const repository = () => {
205
+ return i18nString(Repository);
206
+ };
207
+ const license = () => {
208
+ return i18nString(License);
209
+ };
154
210
 
155
211
  const getActivationEventsDetails = async extension => {
156
212
  const activationEvents = extension.activation || [];
@@ -561,10 +617,10 @@ const getFeatureUnsupportedVirtualDom = state => {
561
617
  }, {
562
618
  type: VirtualDomElements.H1,
563
619
  childCount: 1
564
- }, text('Unsupported Feature'), {
620
+ }, text(unsupportedFeature()), {
565
621
  type: VirtualDomElements.P,
566
622
  childCount: 1
567
- }, text('Selected feature is unknown or unsupported')];
623
+ }, text(selectedFeatureUnknownOrUnsupported())];
568
624
  };
569
625
 
570
626
  const features = Object.create(null);
@@ -638,9 +694,13 @@ const MarkdownWorker$1 = 300;
638
694
  const {
639
695
  invoke: invoke$9,
640
696
  set: set$9} = create$7(ExtensionHostWorker);
697
+ const getRuntimeStatus$2 = async extensionId => {
698
+ // @ts-ignore
699
+ return invoke$9('ExtensionHost.getRuntimeStatus', extensionId);
700
+ };
641
701
  const ExtensionHost = {
642
702
  __proto__: null,
643
- invoke: invoke$9,
703
+ getRuntimeStatus: getRuntimeStatus$2,
644
704
  set: set$9
645
705
  };
646
706
  const {
@@ -697,6 +757,9 @@ const sendMessagePortToFileSystemWorker$2 = async (port, rpcId) => {
697
757
  // @ts-ignore
698
758
  await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
699
759
  };
760
+ const disableExtension$2 = async id => {
761
+ return invoke$3('ExtensionManagement.disable', id);
762
+ };
700
763
  const sendMessagePortToExtensionHostWorker$2 = async (port, rpcId = 0) => {
701
764
  const command = 'HandleMessagePort.handleMessagePort2';
702
765
  await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
@@ -736,6 +799,7 @@ const openUrl$2 = async uri => {
736
799
  };
737
800
  const RendererWorker = {
738
801
  __proto__: null,
802
+ disableExtension: disableExtension$2,
739
803
  getAllExtensions: getAllExtensions$2,
740
804
  getExtension: getExtension$3,
741
805
  openExtensionSearch: openExtensionSearch$2,
@@ -755,13 +819,12 @@ const RendererWorker = {
755
819
 
756
820
  const {
757
821
  set: set$5,
758
- invoke: invoke$2
822
+ getRuntimeStatus: getRuntimeStatus$1
759
823
  } = ExtensionHost;
760
824
 
761
825
  const getRuntimeStatus = async extensionId => {
762
- // TODO simplify api
763
826
  // @ts-ignore
764
- const status = await invoke$2('ExtensionHost.getRuntimeStatus', extensionId);
827
+ const status = await getRuntimeStatus$1(extensionId);
765
828
  // @ts-ignore
766
829
  return status;
767
830
  };
@@ -795,26 +858,22 @@ const formatTime = time => {
795
858
  return time.toFixed(2) + 'ms';
796
859
  };
797
860
 
798
- const getActivationTimeVirtualDom = (importTime, activationTime) => {
799
- if (!activationTime && !importTime) {
861
+ const getActivationTimeVirtualDom = (importTime$1, activationTime$1) => {
862
+ if (!activationTime$1 && !importTime$1) {
800
863
  return [];
801
864
  }
802
- const formattedImportTime = formatTime(importTime);
803
- const formattedTime = formatTime(activationTime);
865
+ const formattedImportTime = formatTime(importTime$1);
866
+ const formattedTime = formatTime(activationTime$1);
804
867
  return [{
805
868
  type: VirtualDomElements.Dt,
806
869
  childCount: 1
807
- }, text('Import Time: '),
808
- // i18n
809
- {
870
+ }, text(importTime()), {
810
871
  type: VirtualDomElements.Dd,
811
872
  childCount: 1
812
873
  }, text(formattedImportTime), {
813
874
  type: VirtualDomElements.Dt,
814
875
  childCount: 1
815
- }, text('Activation Time: '),
816
- // i18n
817
- {
876
+ }, text(activationTime()), {
818
877
  type: VirtualDomElements.Dd,
819
878
  childCount: 1
820
879
  }, text(formattedTime)];
@@ -980,6 +1039,7 @@ const string = value => {
980
1039
 
981
1040
  const HandleClickCategory = 'handleClickCategory';
982
1041
  const HandleClickDisable = 'handleClickDisable';
1042
+ const HandleClickEnable = 'handleClickEnable';
983
1043
  const HandleClickScrollToTop = 'handleClickScrollToTop';
984
1044
  const HandleClickSetColorTheme = 'handleClickSetColorTheme';
985
1045
  const HandleClickSettings = 'handleClickSettings';
@@ -996,6 +1056,7 @@ const ActivationEvents = 'ActivationEvents';
996
1056
  const Changelog = 'Changelog';
997
1057
  const Commands = 'Commands';
998
1058
  const Details = 'Details';
1059
+ const Enable = 'Enable';
999
1060
  const Disable = 'Disable';
1000
1061
  const Features = 'Features';
1001
1062
  const JsonValidation = 'JsonValidation';
@@ -2340,12 +2401,13 @@ const terminate = () => {
2340
2401
  };
2341
2402
 
2342
2403
  const {
2404
+ disableExtension: disableExtension$1,
2343
2405
  getAllExtensions: getAllExtensions$1,
2344
2406
  getExtension: getExtension$2,
2345
2407
  openExtensionSearch: openExtensionSearch$1,
2346
- sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1,
2347
2408
  openNativeFolder,
2348
- writeClipBoardText,
2409
+ openUrl: openUrl$1,
2410
+ sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1,
2349
2411
  sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$1,
2350
2412
  sendMessagePortToMarkdownWorker: sendMessagePortToMarkdownWorker$1,
2351
2413
  set: set$2,
@@ -2354,7 +2416,7 @@ const {
2354
2416
  showContextMenu,
2355
2417
  uninstallExtension,
2356
2418
  writeClipBoardImage,
2357
- openUrl: openUrl$1
2419
+ writeClipBoardText
2358
2420
  } = RendererWorker;
2359
2421
 
2360
2422
  const writeClipboardImage = async blob => {
@@ -2418,6 +2480,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2418
2480
  wasActivatedByEvent: '',
2419
2481
  activationTime: 0,
2420
2482
  importTime: 0,
2483
+ disabled: false,
2421
2484
  status: 0,
2422
2485
  uid,
2423
2486
  activationEvents: [],
@@ -2596,7 +2659,16 @@ const handleClickCategory = async (state, categoryId) => {
2596
2659
  return state;
2597
2660
  };
2598
2661
 
2662
+ const disableExtension = id => {
2663
+ return disableExtension$1(id);
2664
+ };
2665
+
2599
2666
  const handleClickDisable = async state => {
2667
+ const {
2668
+ extensionId
2669
+ } = state;
2670
+ await disableExtension(extensionId);
2671
+ // TODO when it fails, show dialog / alert?
2600
2672
  return state;
2601
2673
  };
2602
2674
 
@@ -3017,16 +3089,21 @@ const getBaseUrl = (extensionPath, platform) => {
3017
3089
  }
3018
3090
  };
3019
3091
 
3020
- const getExtensionDetailButtons = (hasColorTheme, isBuiltin) => {
3092
+ const getExtensionDetailButtons = (hasColorTheme, isBuiltin, isDisabled) => {
3021
3093
  const allActions = [{
3022
3094
  label: setColorTheme$3(),
3023
3095
  onClick: HandleClickSetColorTheme,
3024
3096
  enabled: hasColorTheme,
3025
3097
  name: SetColorTheme
3098
+ }, {
3099
+ label: enable(),
3100
+ onClick: HandleClickEnable,
3101
+ enabled: isDisabled,
3102
+ name: Enable
3026
3103
  }, {
3027
3104
  label: disable(),
3028
3105
  onClick: HandleClickDisable,
3029
- enabled: true,
3106
+ enabled: !isDisabled,
3030
3107
  name: Disable
3031
3108
  }, {
3032
3109
  label: uninstall(),
@@ -3285,20 +3362,20 @@ const getFolderSize = async uri => {
3285
3362
 
3286
3363
  const getInstallationEntries = (displaySize, extensionId, extensionVersion, extensionUri) => {
3287
3364
  const entries = [{
3288
- key: 'Identifier',
3365
+ key: identifier(),
3289
3366
  value: extensionId,
3290
3367
  odd: true,
3291
3368
  code: true
3292
3369
  }, {
3293
- key: 'Version',
3370
+ key: version(),
3294
3371
  value: extensionVersion,
3295
3372
  code: true
3296
3373
  }, {
3297
- key: 'Last Updated',
3374
+ key: lastUpdated(),
3298
3375
  value: 'n/a',
3299
3376
  odd: true
3300
3377
  }, {
3301
- key: 'Size',
3378
+ key: size(),
3302
3379
  value: displaySize,
3303
3380
  onClick: HandleClickSize,
3304
3381
  title: extensionUri
@@ -3311,11 +3388,11 @@ const getMarketplaceEntries = isBuiltin => {
3311
3388
  return [];
3312
3389
  }
3313
3390
  return [{
3314
- key: 'Published',
3391
+ key: published(),
3315
3392
  value: 'n/a',
3316
3393
  odd: true
3317
3394
  }, {
3318
- key: 'Last Released',
3395
+ key: lastReleased(),
3319
3396
  value: 'n/a'
3320
3397
  }];
3321
3398
  };
@@ -3326,16 +3403,16 @@ const getResources = isBuiltin => {
3326
3403
  }
3327
3404
  // TODO
3328
3405
  return [{
3329
- label: 'Marketplace',
3406
+ label: marketplace(),
3330
3407
  url: '#'
3331
3408
  }, {
3332
- label: 'Issues',
3409
+ label: issues(),
3333
3410
  url: '#'
3334
3411
  }, {
3335
- label: 'Repository',
3412
+ label: repository(),
3336
3413
  url: '#'
3337
3414
  }, {
3338
- label: 'License',
3415
+ label: license(),
3339
3416
  url: '#'
3340
3417
  }];
3341
3418
  };
@@ -3434,7 +3511,8 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
3434
3511
  scrollToTopEnabled: true
3435
3512
  });
3436
3513
  const isBuiltin = extension?.isBuiltin;
3437
- const buttons = getExtensionDetailButtons(hasColorTheme, isBuiltin);
3514
+ const disabled = extension?.disabled;
3515
+ const buttons = getExtensionDetailButtons(hasColorTheme, isBuiltin, disabled);
3438
3516
  const enabledButtons = buttons.filter(button => button.enabled);
3439
3517
  const size = getViewletSize(width);
3440
3518
  const {
@@ -3465,6 +3543,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
3465
3543
  changelogScrollTop,
3466
3544
  description,
3467
3545
  detailsVirtualDom,
3546
+ disabled,
3468
3547
  displaySize,
3469
3548
  extension,
3470
3549
  extensionId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.54.0",
3
+ "version": "3.56.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",