@lvce-editor/extension-detail-view 3.52.0 → 3.53.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.
package/README.md CHANGED
@@ -14,3 +14,7 @@ npm test
14
14
  ## Gitpod
15
15
 
16
16
  [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/lvce-editor/extension-detail-view)
17
+
18
+ ## Credits
19
+
20
+ The extension detail view is based on VSCode's extension detail view.
@@ -11,6 +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
15
  const Categories$1 = 'Categories';
15
16
  const Changelog$2 = 'Changelog';
16
17
  const Commands$1 = 'Commands';
@@ -28,7 +29,7 @@ const Installation = 'Installation';
28
29
  const JsonValidation$1 = 'Json Validation';
29
30
  const Label = 'Label';
30
31
  const Marketplace = 'Marketplace';
31
- const None$2 = 'None';
32
+ const None$3 = 'None';
32
33
  const NoReadmeFound = 'No Readme Found.';
33
34
  const EmptyCommandsArray = 'The extension contributed an empty commands array.';
34
35
  const OpenImageInNewTab = 'Open Image in New Tab';
@@ -79,7 +80,7 @@ const features$1 = () => {
79
80
  return i18nString(Features$2);
80
81
  };
81
82
  const none = () => {
82
- return i18nString(None$2);
83
+ return i18nString(None$3);
83
84
  };
84
85
  const openInNewTab = () => {
85
86
  return i18nString(OpenInNewTab);
@@ -114,6 +115,9 @@ const webViews = () => {
114
115
  const activationEvents = () => {
115
116
  return i18nString(ActivationEvents$1);
116
117
  };
118
+ const runtimeStatus = () => {
119
+ return i18nString(RuntimeStatus$1);
120
+ };
117
121
  const jsonValidation = () => {
118
122
  return i18nString(JsonValidation$1);
119
123
  };
@@ -162,13 +166,13 @@ const featureActivationEventsEnabled = extension => {
162
166
  return Array.isArray(extension.activation);
163
167
  };
164
168
 
165
- const None$1 = 'none';
169
+ const None$2 = 'none';
166
170
  const Panel = 'panel';
167
171
  const Tab$1 = 'tab';
168
172
  const TabList = 'tablist';
169
173
  const AriaRoles = {
170
174
  __proto__: null,
171
- None: None$1,
175
+ None: None$2,
172
176
  Panel,
173
177
  Tab: Tab$1,
174
178
  TabList};
@@ -594,147 +598,6 @@ const getFeatureVirtualDomHandler = featureName => {
594
598
  return feature.getVirtualDom;
595
599
  };
596
600
 
597
- const getSettingsTableEntry = setting => {
598
- const {
599
- id,
600
- label
601
- } = setting;
602
- // TODO watch out for null/undefined/number/string/array
603
- return [{
604
- type: Text,
605
- value: id
606
- }, {
607
- type: Text,
608
- value: label
609
- }];
610
- };
611
-
612
- const getSettingsDetails = async extension => {
613
- const settings = extension.settings || [];
614
- const rows = settings.map(getSettingsTableEntry);
615
- return {
616
- settings: rows
617
- };
618
- };
619
-
620
- const featureSettingsEnabled = extension => {
621
- if (!extension || typeof extension !== 'object' || !('settings' in extension)) {
622
- return false;
623
- }
624
- return Array.isArray(extension.settings);
625
- };
626
-
627
- const getSettingsTableEntries = rows => {
628
- const textId = id$1();
629
- const textLabel = label();
630
- return {
631
- headings: [textId, textLabel],
632
- rows
633
- };
634
- };
635
-
636
- const getFeatureSettingsVirtualDom = rows => {
637
- const heading = settings();
638
- const tableInfo = getSettingsTableEntries(rows);
639
- return [{
640
- type: VirtualDomElements.Div,
641
- className: FeatureContent,
642
- childCount: 2
643
- }, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
644
- };
645
-
646
- const getSettingsVirtualDom = state => {
647
- return getFeatureSettingsVirtualDom(state.settings);
648
- };
649
-
650
- class AssertionError extends Error {
651
- constructor(message) {
652
- super(message);
653
- this.name = 'AssertionError';
654
- }
655
- }
656
- const Object$1 = 1;
657
- const Number$1 = 2;
658
- const Array$1 = 3;
659
- const String = 4;
660
- const Boolean$1 = 5;
661
- const Function = 6;
662
- const Null = 7;
663
- const Unknown = 8;
664
- const getType = value => {
665
- switch (typeof value) {
666
- case 'number':
667
- return Number$1;
668
- case 'function':
669
- return Function;
670
- case 'string':
671
- return String;
672
- case 'object':
673
- if (value === null) {
674
- return Null;
675
- }
676
- if (Array.isArray(value)) {
677
- return Array$1;
678
- }
679
- return Object$1;
680
- case 'boolean':
681
- return Boolean$1;
682
- default:
683
- return Unknown;
684
- }
685
- };
686
- const string = value => {
687
- const type = getType(value);
688
- if (type !== String) {
689
- throw new AssertionError('expected value to be of type string');
690
- }
691
- };
692
-
693
- const HandleClickCategory = 'handleClickCategory';
694
- const HandleClickDisable = 'handleClickDisable';
695
- const HandleClickScrollToTop = 'handleClickScrollToTop';
696
- const HandleClickSetColorTheme = 'handleClickSetColorTheme';
697
- const HandleClickSettings = 'handleClickSettings';
698
- const HandleClickSize = 'handleClickSize';
699
- const HandleClickUninstall = 'handleClickUninstall';
700
- const HandleFeaturesClick = 'handleFeaturesClick';
701
- const HandleIconError = 'handleIconError';
702
- const HandleImageContextMenu = 'handleImageContextMenu';
703
- const HandleReadmeContextMenu = 'handleReadmeContextMenu';
704
- const HandleReadmeScroll = 'handleReadmeScroll';
705
- const HandleTabsClick = 'handleTabsClick';
706
-
707
- const ActivationEvents = 'ActivationEvents';
708
- const Changelog = 'Changelog';
709
- const Commands = 'Commands';
710
- const Details = 'Details';
711
- const Disable = 'Disable';
712
- const Features = 'Features';
713
- const JsonValidation = 'JsonValidation';
714
- const ProgrammingLanguages = 'ProgrammingLanguages';
715
- const ScrollToTop = 'scrolltotop';
716
- const SetColorTheme = 'SetColorTheme';
717
- const Settings = 'Settings';
718
- const Theme = 'Theme';
719
- const Uninstall = 'Uninstall';
720
- const WebViews = 'WebViews';
721
-
722
- const getScrollToTopVirtualDom = scrollToTopButtonEnabled => {
723
- return [{
724
- type: VirtualDomElements.Button,
725
- className: ScrollToTopButton,
726
- childCount: 1,
727
- onClick: HandleClickScrollToTop,
728
- ariaLabel: scrollToTop(),
729
- name: ScrollToTop
730
- }, {
731
- type: VirtualDomElements.Div,
732
- className: 'MaskIcon MaskIconChevronUp',
733
- childCount: 0,
734
- role: AriaRoles.None
735
- }];
736
- };
737
-
738
601
  const rpcs = Object.create(null);
739
602
  const set$g = (id, rpc) => {
740
603
  rpcs[id] = rpc;
@@ -773,9 +636,11 @@ const RendererWorker$1 = 1;
773
636
  const FileSystemWorker$1 = 209;
774
637
  const MarkdownWorker$1 = 300;
775
638
  const {
639
+ invoke: invoke$9,
776
640
  set: set$9} = create$7(ExtensionHostWorker);
777
641
  const ExtensionHost = {
778
642
  __proto__: null,
643
+ invoke: invoke$9,
779
644
  set: set$9
780
645
  };
781
646
  const {
@@ -890,6 +755,253 @@ const RendererWorker = {
890
755
 
891
756
  const {
892
757
  set: set$5,
758
+ invoke: invoke$2
759
+ } = ExtensionHost;
760
+
761
+ const getRuntimeStatus = async extensionId => {
762
+ // TODO simplify api
763
+ // @ts-ignore
764
+ const status = await invoke$2('ExtensionHost.getRuntimeStatus', extensionId);
765
+ // @ts-ignore
766
+ return status;
767
+ };
768
+
769
+ const getRuntimeStatusDetails = async extension => {
770
+ const {
771
+ activationEvent,
772
+ status,
773
+ activationTime
774
+ } = await getRuntimeStatus(extension.id);
775
+ return {
776
+ wasActivatedByEvent: activationEvent,
777
+ activationTime,
778
+ status
779
+ };
780
+ };
781
+
782
+ const featureRuntimeStatusEnabled = extension => {
783
+ if (!extension || typeof extension !== 'object') {
784
+ return false;
785
+ }
786
+ if ('main' in extension || 'browser' in extension) {
787
+ return true;
788
+ }
789
+ return false;
790
+ };
791
+
792
+ const None$1 = 0;
793
+ const Importing = 1;
794
+ const Activating = 2;
795
+ const Activated = 3;
796
+ const Error$1 = 4;
797
+
798
+ const getStatusMessage = statusType => {
799
+ switch (statusType) {
800
+ case Activated:
801
+ return 'activated';
802
+ case None$1:
803
+ return 'none';
804
+ case Activating:
805
+ return 'Activating';
806
+ case Error$1:
807
+ return 'error';
808
+ case Importing:
809
+ return 'importing';
810
+ default:
811
+ return 'unknown';
812
+ }
813
+ };
814
+
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
+ const getStatusVirtualDom = status => {
831
+ const statusString = getStatusMessage(status);
832
+ return [{
833
+ type: VirtualDomElements.P,
834
+ childCount: 2
835
+ }, text(`Status: `),
836
+ // i18n
837
+ text(`${statusString}`)];
838
+ };
839
+ const getChildCount$1 = (status, activationTime) => {
840
+ let childCount = 1; // heading
841
+ childCount++; // status
842
+ if (activationTime) {
843
+ childCount++; // activation time
844
+ }
845
+ return childCount;
846
+ };
847
+ const getRuntimeStatusVirtualDom = state => {
848
+ const {
849
+ status,
850
+ activationTime
851
+ } = state;
852
+ const heading = runtimeStatus();
853
+ const childCount = getChildCount$1(status, activationTime);
854
+ return [{
855
+ type: VirtualDomElements.Div,
856
+ className: FeatureContent,
857
+ childCount: childCount
858
+ }, ...getFeatureContentHeadingVirtualDom(heading), ...getStatusVirtualDom(status), ...getActivationTimeVirtualDom(activationTime)];
859
+ };
860
+
861
+ const getSettingsTableEntry = setting => {
862
+ const {
863
+ id,
864
+ label
865
+ } = setting;
866
+ // TODO watch out for null/undefined/number/string/array
867
+ return [{
868
+ type: Text,
869
+ value: id
870
+ }, {
871
+ type: Text,
872
+ value: label
873
+ }];
874
+ };
875
+
876
+ const getSettingsDetails = async extension => {
877
+ const settings = extension.settings || [];
878
+ const rows = settings.map(getSettingsTableEntry);
879
+ return {
880
+ settings: rows
881
+ };
882
+ };
883
+
884
+ const featureSettingsEnabled = extension => {
885
+ if (!extension || typeof extension !== 'object' || !('settings' in extension)) {
886
+ return false;
887
+ }
888
+ return Array.isArray(extension.settings);
889
+ };
890
+
891
+ const getSettingsTableEntries = rows => {
892
+ const textId = id$1();
893
+ const textLabel = label();
894
+ return {
895
+ headings: [textId, textLabel],
896
+ rows
897
+ };
898
+ };
899
+
900
+ const getFeatureSettingsVirtualDom = rows => {
901
+ const heading = settings();
902
+ const tableInfo = getSettingsTableEntries(rows);
903
+ return [{
904
+ type: VirtualDomElements.Div,
905
+ className: FeatureContent,
906
+ childCount: 2
907
+ }, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
908
+ };
909
+
910
+ const getSettingsVirtualDom = state => {
911
+ return getFeatureSettingsVirtualDom(state.settings);
912
+ };
913
+
914
+ class AssertionError extends Error {
915
+ constructor(message) {
916
+ super(message);
917
+ this.name = 'AssertionError';
918
+ }
919
+ }
920
+ const Object$1 = 1;
921
+ const Number$1 = 2;
922
+ const Array$1 = 3;
923
+ const String = 4;
924
+ const Boolean$1 = 5;
925
+ const Function = 6;
926
+ const Null = 7;
927
+ const Unknown = 8;
928
+ const getType = value => {
929
+ switch (typeof value) {
930
+ case 'number':
931
+ return Number$1;
932
+ case 'function':
933
+ return Function;
934
+ case 'string':
935
+ return String;
936
+ case 'object':
937
+ if (value === null) {
938
+ return Null;
939
+ }
940
+ if (Array.isArray(value)) {
941
+ return Array$1;
942
+ }
943
+ return Object$1;
944
+ case 'boolean':
945
+ return Boolean$1;
946
+ default:
947
+ return Unknown;
948
+ }
949
+ };
950
+ const string = value => {
951
+ const type = getType(value);
952
+ if (type !== String) {
953
+ throw new AssertionError('expected value to be of type string');
954
+ }
955
+ };
956
+
957
+ const HandleClickCategory = 'handleClickCategory';
958
+ const HandleClickDisable = 'handleClickDisable';
959
+ const HandleClickScrollToTop = 'handleClickScrollToTop';
960
+ const HandleClickSetColorTheme = 'handleClickSetColorTheme';
961
+ const HandleClickSettings = 'handleClickSettings';
962
+ const HandleClickSize = 'handleClickSize';
963
+ const HandleClickUninstall = 'handleClickUninstall';
964
+ const HandleFeaturesClick = 'handleFeaturesClick';
965
+ const HandleIconError = 'handleIconError';
966
+ const HandleImageContextMenu = 'handleImageContextMenu';
967
+ const HandleReadmeContextMenu = 'handleReadmeContextMenu';
968
+ const HandleReadmeScroll = 'handleReadmeScroll';
969
+ const HandleTabsClick = 'handleTabsClick';
970
+
971
+ const ActivationEvents = 'ActivationEvents';
972
+ const Changelog = 'Changelog';
973
+ const Commands = 'Commands';
974
+ const Details = 'Details';
975
+ const Disable = 'Disable';
976
+ const Features = 'Features';
977
+ const JsonValidation = 'JsonValidation';
978
+ const ProgrammingLanguages = 'ProgrammingLanguages';
979
+ const RuntimeStatus = 'RuntimeStatus';
980
+ const ScrollToTop = 'scrolltotop';
981
+ const SetColorTheme = 'SetColorTheme';
982
+ const Settings = 'Settings';
983
+ const Theme = 'Theme';
984
+ const Uninstall = 'Uninstall';
985
+ const WebViews = 'WebViews';
986
+
987
+ const getScrollToTopVirtualDom = scrollToTopButtonEnabled => {
988
+ return [{
989
+ type: VirtualDomElements.Button,
990
+ className: ScrollToTopButton,
991
+ childCount: 1,
992
+ onClick: HandleClickScrollToTop,
993
+ ariaLabel: scrollToTop(),
994
+ name: ScrollToTop
995
+ }, {
996
+ type: VirtualDomElements.Div,
997
+ className: 'MaskIcon MaskIconChevronUp',
998
+ childCount: 0,
999
+ role: AriaRoles.None
1000
+ }];
1001
+ };
1002
+
1003
+ const {
1004
+ set: set$4,
893
1005
  getVirtualDom,
894
1006
  render
895
1007
  } = MarkdownWorker;
@@ -1150,6 +1262,13 @@ const registerAllFeatures = () => {
1150
1262
  getDetails: getActivationEventsDetails,
1151
1263
  getVirtualDom: getActivationEventsVirtualDom
1152
1264
  });
1265
+ register$1({
1266
+ id: RuntimeStatus,
1267
+ getLabel: runtimeStatus,
1268
+ isEnabled: featureRuntimeStatusEnabled,
1269
+ getDetails: getRuntimeStatusDetails,
1270
+ getVirtualDom: getRuntimeStatusVirtualDom
1271
+ });
1153
1272
  };
1154
1273
 
1155
1274
  const normalizeLine = line => {
@@ -1626,7 +1745,7 @@ const create$4 = (method, params) => {
1626
1745
  };
1627
1746
  };
1628
1747
  const callbacks = Object.create(null);
1629
- const set$4 = (id, fn) => {
1748
+ const set$3 = (id, fn) => {
1630
1749
  callbacks[id] = fn;
1631
1750
  };
1632
1751
  const get$1 = id => {
@@ -1645,7 +1764,7 @@ const registerPromise = () => {
1645
1764
  resolve,
1646
1765
  promise
1647
1766
  } = Promise.withResolvers();
1648
- set$4(id, resolve);
1767
+ set$3(id, resolve);
1649
1768
  return {
1650
1769
  id,
1651
1770
  promise
@@ -2205,7 +2324,7 @@ const {
2205
2324
  writeClipBoardText,
2206
2325
  sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$1,
2207
2326
  sendMessagePortToMarkdownWorker: sendMessagePortToMarkdownWorker$1,
2208
- set: set$3,
2327
+ set: set$2,
2209
2328
  setColorTheme: setColorTheme$1,
2210
2329
  setExtensionsSearchValue,
2211
2330
  showContextMenu,
@@ -2222,7 +2341,7 @@ const writeText = async text => {
2222
2341
  };
2223
2342
 
2224
2343
  const {
2225
- set: set$2,
2344
+ set: set$1,
2226
2345
  exists,
2227
2346
  readFile: readFile$1,
2228
2347
  invoke
@@ -2262,7 +2381,7 @@ const copyImageUrl = async state => {
2262
2381
 
2263
2382
  const {
2264
2383
  get,
2265
- set: set$1,
2384
+ set,
2266
2385
  dispose: dispose$1,
2267
2386
  wrapCommand,
2268
2387
  wrapGetter,
@@ -2273,7 +2392,8 @@ const {
2273
2392
  const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2274
2393
  const state = {
2275
2394
  wasActivatedByEvent: '',
2276
- status: '',
2395
+ activationTime: 0,
2396
+ status: 0,
2277
2397
  uid,
2278
2398
  activationEvents: [],
2279
2399
  assetDir: assetDir || '',
@@ -2323,7 +2443,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2323
2443
  width,
2324
2444
  readmeUrl: ''
2325
2445
  };
2326
- set$1(uid, state, state);
2446
+ set(uid, state, state);
2327
2447
  };
2328
2448
 
2329
2449
  const isEqual$2 = (oldState, newState) => {
@@ -2754,12 +2874,9 @@ const createExtensionHostWorkerRpc = async () => {
2754
2874
  }
2755
2875
  };
2756
2876
 
2757
- const {
2758
- set} = ExtensionHost;
2759
-
2760
2877
  const initializeExtensionHostWorker = async () => {
2761
2878
  const rpc = await createExtensionHostWorkerRpc();
2762
- set(rpc);
2879
+ set$5(rpc);
2763
2880
  };
2764
2881
 
2765
2882
  const sendMessagePortToFileSystemWorker = async port => {
@@ -2780,7 +2897,7 @@ const createFileSystemWorkerRpc = async () => {
2780
2897
 
2781
2898
  const initializeFileSystemWorker = async () => {
2782
2899
  const rpc = await createFileSystemWorkerRpc();
2783
- set$2(rpc);
2900
+ set$1(rpc);
2784
2901
  };
2785
2902
 
2786
2903
  const sendMessagePortToMarkdownWorker = async port => {
@@ -2801,7 +2918,7 @@ const createMarkdownWorkerRpc = async () => {
2801
2918
 
2802
2919
  const initializeMarkdownWorker = async () => {
2803
2920
  const rpc = await createMarkdownWorkerRpc();
2804
- set$5(rpc);
2921
+ set$4(rpc);
2805
2922
  };
2806
2923
 
2807
2924
  const initialize = async () => {
@@ -3565,6 +3682,11 @@ const getFeatureListVirtualDom = features => {
3565
3682
  }, ...features.flatMap(getFeatureListItemVirtualDom)];
3566
3683
  };
3567
3684
 
3685
+ const sash = {
3686
+ type: VirtualDomElements.Div,
3687
+ className: mergeClassNames(Sash, SashVertical),
3688
+ childCount: 0
3689
+ };
3568
3690
  const getFeaturesVirtualDom = (features, selectedFeature, state) => {
3569
3691
  if (features.length === 0) {
3570
3692
  const none$1 = none();
@@ -3580,11 +3702,7 @@ const getFeaturesVirtualDom = (features, selectedFeature, state) => {
3580
3702
  type: VirtualDomElements.Div,
3581
3703
  className: Features$1,
3582
3704
  childCount: 3
3583
- }, ...getFeatureListVirtualDom(features), {
3584
- type: VirtualDomElements.Div,
3585
- className: mergeClassNames(Sash, SashVertical),
3586
- childCount: 0
3587
- }, ...featureVirtualDom];
3705
+ }, ...getFeatureListVirtualDom(features), sash, ...featureVirtualDom];
3588
3706
  };
3589
3707
 
3590
3708
  const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, selectedTab, width, scrollToTopButtonEnabled, categories, resources, breakpoint, changelogDom, state) => {
@@ -3838,7 +3956,7 @@ const render2 = (uid, diffResult) => {
3838
3956
  oldState,
3839
3957
  newState
3840
3958
  } = get(uid);
3841
- set$1(uid, newState, newState);
3959
+ set(uid, newState, newState);
3842
3960
  const commands = applyRender(oldState, newState, diffResult);
3843
3961
  return commands;
3844
3962
  };
@@ -3951,7 +4069,7 @@ const listen = async () => {
3951
4069
  const rpc = await WebWorkerRpcClient.create({
3952
4070
  commandMap: commandMap
3953
4071
  });
3954
- set$3(rpc);
4072
+ set$2(rpc);
3955
4073
  };
3956
4074
 
3957
4075
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.52.0",
3
+ "version": "3.53.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",