@lvce-editor/extension-detail-view 3.53.0 → 3.54.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.
@@ -770,12 +770,14 @@ const getRuntimeStatusDetails = async extension => {
770
770
  const {
771
771
  activationEvent,
772
772
  status,
773
- activationTime
773
+ activationTime,
774
+ importTime
774
775
  } = await getRuntimeStatus(extension.id);
775
776
  return {
776
777
  wasActivatedByEvent: activationEvent,
777
778
  activationTime,
778
- status
779
+ status,
780
+ importTime
779
781
  };
780
782
  };
781
783
 
@@ -789,6 +791,35 @@ const featureRuntimeStatusEnabled = extension => {
789
791
  return false;
790
792
  };
791
793
 
794
+ const formatTime = time => {
795
+ return time.toFixed(2) + 'ms';
796
+ };
797
+
798
+ const getActivationTimeVirtualDom = (importTime, activationTime) => {
799
+ if (!activationTime && !importTime) {
800
+ return [];
801
+ }
802
+ const formattedImportTime = formatTime(importTime);
803
+ const formattedTime = formatTime(activationTime);
804
+ return [{
805
+ type: VirtualDomElements.Dt,
806
+ childCount: 1
807
+ }, text('Import Time: '),
808
+ // i18n
809
+ {
810
+ type: VirtualDomElements.Dd,
811
+ childCount: 1
812
+ }, text(formattedImportTime), {
813
+ type: VirtualDomElements.Dt,
814
+ childCount: 1
815
+ }, text('Activation Time: '),
816
+ // i18n
817
+ {
818
+ type: VirtualDomElements.Dd,
819
+ childCount: 1
820
+ }, text(formattedTime)];
821
+ };
822
+
792
823
  const None$1 = 0;
793
824
  const Importing = 1;
794
825
  const Activating = 2;
@@ -812,50 +843,43 @@ const getStatusMessage = statusType => {
812
843
  }
813
844
  };
814
845
 
815
- const formatTime = time => {
816
- return time.toFixed(2) + 'ms';
817
- };
818
- const getActivationTimeVirtualDom = activationTime => {
819
- if (!activationTime) {
820
- return [];
821
- }
822
- const formattedTime = formatTime(activationTime);
823
- return [{
824
- type: VirtualDomElements.P,
825
- childCount: 2
826
- }, text('Activation Time: '),
827
- // i18n
828
- text(formattedTime)];
829
- };
830
846
  const getStatusVirtualDom = status => {
831
847
  const statusString = getStatusMessage(status);
832
848
  return [{
833
- type: VirtualDomElements.P,
834
- childCount: 2
849
+ type: VirtualDomElements.Dt,
850
+ childCount: 1
835
851
  }, text(`Status: `),
836
852
  // i18n
837
- text(`${statusString}`)];
853
+ {
854
+ type: VirtualDomElements.Dd,
855
+ childCount: 1
856
+ }, text(`${statusString}`)];
838
857
  };
839
- const getChildCount$1 = (status, activationTime) => {
840
- let childCount = 1; // heading
841
- childCount++; // status
842
- if (activationTime) {
843
- childCount++; // activation time
858
+
859
+ const getChildCount$1 = (status, activationTime, importTime) => {
860
+ let childCount = 0;
861
+ childCount += 2; // status
862
+ if (importTime || activationTime) {
863
+ childCount += 4;
844
864
  }
845
865
  return childCount;
846
866
  };
847
867
  const getRuntimeStatusVirtualDom = state => {
848
868
  const {
849
869
  status,
850
- activationTime
870
+ activationTime,
871
+ importTime
851
872
  } = state;
852
873
  const heading = runtimeStatus();
853
- const childCount = getChildCount$1(status, activationTime);
874
+ const childCount = getChildCount$1(status, activationTime, importTime);
854
875
  return [{
855
876
  type: VirtualDomElements.Div,
856
877
  className: FeatureContent,
857
- childCount: childCount
858
- }, ...getFeatureContentHeadingVirtualDom(heading), ...getStatusVirtualDom(status), ...getActivationTimeVirtualDom(activationTime)];
878
+ childCount: 2
879
+ }, ...getFeatureContentHeadingVirtualDom(heading), {
880
+ type: VirtualDomElements.Dl,
881
+ childCount
882
+ }, ...getStatusVirtualDom(status), ...getActivationTimeVirtualDom(activationTime, importTime)];
859
883
  };
860
884
 
861
885
  const getSettingsTableEntry = setting => {
@@ -2393,6 +2417,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2393
2417
  const state = {
2394
2418
  wasActivatedByEvent: '',
2395
2419
  activationTime: 0,
2420
+ importTime: 0,
2396
2421
  status: 0,
2397
2422
  uid,
2398
2423
  activationEvents: [],
@@ -2666,6 +2691,14 @@ const handleClickUninstall = async state => {
2666
2691
  return state;
2667
2692
  };
2668
2693
 
2694
+ const handleExtensionsStatusUpdate = async state => {
2695
+ const details = await getRuntimeStatusDetails(state.extension);
2696
+ return {
2697
+ ...state,
2698
+ ...details
2699
+ };
2700
+ };
2701
+
2669
2702
  const extensionDefaultIcon = assetDir => {
2670
2703
  return `${assetDir}/icons/extensionDefaultIcon.png`;
2671
2704
  };
@@ -3365,7 +3398,10 @@ const restoreState = savedState => {
3365
3398
  };
3366
3399
  };
3367
3400
 
3368
- const loadContent = async (state, platform, savedState) => {
3401
+ const loadContent = async (state, platform, savedState, isTest = false) => {
3402
+ if (isTest) {
3403
+ savedState = undefined;
3404
+ }
3369
3405
  const {
3370
3406
  width,
3371
3407
  uri
@@ -3454,8 +3490,8 @@ const loadContent = async (state, platform, savedState) => {
3454
3490
  };
3455
3491
  };
3456
3492
 
3457
- const loadContent2 = async (state, savedState) => {
3458
- return loadContent(state, state.platform, savedState);
3493
+ const loadContent2 = async (state, savedState, isTest = false) => {
3494
+ return loadContent(state, state.platform, savedState, isTest);
3459
3495
  };
3460
3496
 
3461
3497
  const openUrl = async uri => {
@@ -4045,6 +4081,7 @@ const commandMap = {
4045
4081
  'ExtensionDetail.handleClickSettings': wrapCommand(handleClickSettings),
4046
4082
  'ExtensionDetail.handleClickSize': wrapCommand(handleClickSize),
4047
4083
  'ExtensionDetail.handleClickUninstall': wrapCommand(handleClickUninstall),
4084
+ 'ExtensionDetail.handleExtensionsStatusUpdate': wrapCommand(handleExtensionsStatusUpdate),
4048
4085
  'ExtensionDetail.handleFeaturesClick': wrapCommand(handleClickFeatures),
4049
4086
  'ExtensionDetail.handleIconError': wrapCommand(handleIconError),
4050
4087
  'ExtensionDetail.handleImageContextMenu': wrapCommand(handleImageContextMenu),
@@ -4052,16 +4089,15 @@ const commandMap = {
4052
4089
  'ExtensionDetail.handleTabsClick': wrapCommand(handleTabsClick),
4053
4090
  'ExtensionDetail.handleWheel': wrapCommand(handleScroll),
4054
4091
  // deprecated
4092
+ 'ExtensionDetail.initialize': initialize,
4055
4093
  'ExtensionDetail.loadContent2': wrapCommand(loadContent2),
4056
4094
  'ExtensionDetail.openImageInNewTab': wrapCommand(openImageInNewTab),
4057
4095
  'ExtensionDetail.render2': render2,
4058
4096
  'ExtensionDetail.renderEventListeners': renderEventListeners,
4059
4097
  'ExtensionDetail.resize': wrapCommand(resize),
4060
- // @ts-ignore
4061
4098
  'ExtensionDetail.saveState': wrapGetter(saveState),
4062
4099
  'ExtensionDetail.selectTab': wrapCommand(selectTab),
4063
- 'ExtensionDetail.terminate': terminate,
4064
- 'ExtensionDetail.initialize': initialize
4100
+ 'ExtensionDetail.terminate': terminate
4065
4101
  };
4066
4102
 
4067
4103
  const listen = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.53.0",
3
+ "version": "3.54.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",