@lvce-editor/extension-detail-view 4.8.0 → 4.9.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.
@@ -27,6 +27,10 @@ const Enable$1 = 'Enable';
27
27
  const Features$2 = 'Features';
28
28
  const FileMatch = 'File Match';
29
29
  const Id = 'ID';
30
+ const Name = 'Name';
31
+ const FileExtensions = 'File Extensions';
32
+ const Grammar = 'Grammar';
33
+ const Snippets = 'Snippets';
30
34
  const Identifier = 'Identifier';
31
35
  const ImportTime = 'Import Time: ';
32
36
  const Installation = 'Installation';
@@ -151,6 +155,18 @@ const settings = () => {
151
155
  const id$1 = () => {
152
156
  return i18nString(Id);
153
157
  };
158
+ const name = () => {
159
+ return i18nString(Name);
160
+ };
161
+ const fileExtensions = () => {
162
+ return i18nString(FileExtensions);
163
+ };
164
+ const grammar = () => {
165
+ return i18nString(Grammar);
166
+ };
167
+ const snippets = () => {
168
+ return i18nString(Snippets);
169
+ };
154
170
  const selector = () => {
155
171
  return i18nString(Selector);
156
172
  };
@@ -258,8 +274,15 @@ const getActivationEventsDetails = async extension => {
258
274
  };
259
275
  };
260
276
 
277
+ const hasProperty = (object, key) => {
278
+ if (!object || typeof object !== 'object' || !(key in object)) {
279
+ return false;
280
+ }
281
+ return true;
282
+ };
283
+
261
284
  const featureActivationEventsEnabled = extension => {
262
- if (!extension || typeof extension !== 'object' || !('activation' in extension)) {
285
+ if (!hasProperty(extension, 'activation')) {
263
286
  return false;
264
287
  }
265
288
  return Array.isArray(extension.activation);
@@ -446,7 +469,7 @@ const getCommandsDetails = async extension => {
446
469
  };
447
470
 
448
471
  const featureCommandsEnabled = extension => {
449
- if (!extension || typeof extension !== 'object' || !('commands' in extension)) {
472
+ if (!hasProperty(extension, 'commands')) {
450
473
  return false;
451
474
  }
452
475
  return Array.isArray(extension.commands);
@@ -782,7 +805,7 @@ const getJsonValidationDetails = async extension => {
782
805
  };
783
806
 
784
807
  const featureJsonValidationEnabled = extension => {
785
- if (!extension || typeof extension !== 'object' || !('jsonValidation' in extension)) {
808
+ if (!hasProperty(extension, 'jsonValidation')) {
786
809
  return false;
787
810
  }
788
811
  return Array.isArray(extension.jsonValidation);
@@ -816,27 +839,42 @@ const getProgrammingLanguagesDetails = async extension => {
816
839
  };
817
840
 
818
841
  const featureProgrammingLanguagesEnabled = extension => {
819
- if (!extension || typeof extension !== 'object' || !('programmingLanguages' in extension)) {
842
+ if (!hasProperty(extension, 'languages')) {
820
843
  return false;
821
844
  }
822
845
  const {
823
- programmingLanguages
846
+ languages
824
847
  } = extension;
825
- return Array.isArray(programmingLanguages);
848
+ return Array.isArray(languages);
826
849
  };
827
850
 
828
- const getFeatureProgrammingLanguagesVirtualDom = () => {
851
+ const getProgrammingLanguagesTableEntries = rows => {
852
+ const id = id$1();
853
+ const name$1 = name();
854
+ const fileExtensions$1 = fileExtensions();
855
+ const grammar$1 = grammar();
856
+ const snippets$1 = snippets();
857
+ return {
858
+ headings: [id, name$1, fileExtensions$1, grammar$1, snippets$1],
859
+ rows
860
+ };
861
+ };
862
+
863
+ const getFeatureProgrammingLanguagesVirtualDom = programmingLanguages$1 => {
829
864
  const heading = programmingLanguages();
830
- // TODO
865
+ const tableInfo = getProgrammingLanguagesTableEntries(programmingLanguages$1);
831
866
  return [{
832
867
  type: Div,
833
868
  className: FeatureContent,
834
- childCount: 1
835
- }, ...getFeatureContentHeadingVirtualDom(heading)];
869
+ childCount: 2
870
+ }, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
836
871
  };
837
872
 
838
873
  const getProgrammingLanguagesVirtualDom = state => {
839
- return getFeatureProgrammingLanguagesVirtualDom();
874
+ const {
875
+ programmingLanguages
876
+ } = state;
877
+ return getFeatureProgrammingLanguagesVirtualDom(programmingLanguages);
840
878
  };
841
879
 
842
880
  class FeatureNotFoundError extends Error {
@@ -2602,7 +2640,7 @@ const getSettingsDetails = async extension => {
2602
2640
  };
2603
2641
 
2604
2642
  const featureSettingsEnabled = extension => {
2605
- if (!extension || typeof extension !== 'object' || !('settings' in extension)) {
2643
+ if (!hasProperty(extension, 'settings')) {
2606
2644
  return false;
2607
2645
  }
2608
2646
  return Array.isArray(extension.settings);
@@ -2846,21 +2884,21 @@ const getThemeDetails = async (extension, baseUrl, locationProtocol) => {
2846
2884
  };
2847
2885
 
2848
2886
  const featureColorThemeEnabled = extension => {
2849
- if (!extension || typeof extension !== 'object' || !('colorThemes' in extension)) {
2887
+ if (!hasProperty(extension, 'colorThemes')) {
2850
2888
  return false;
2851
2889
  }
2852
2890
  return Array.isArray(extension.colorThemes);
2853
2891
  };
2854
2892
 
2855
2893
  const featureIconThemeEnabled = extension => {
2856
- if (!extension || typeof extension !== 'object' || !('iconThemes' in extension)) {
2894
+ if (!hasProperty(extension, 'iconThemes')) {
2857
2895
  return false;
2858
2896
  }
2859
2897
  return Array.isArray(extension.iconThemes);
2860
2898
  };
2861
2899
 
2862
2900
  const featureProductIconThemeEnabled = extension => {
2863
- if (!extension || typeof extension !== 'object' || !('productIconThemes' in extension)) {
2901
+ if (!hasProperty(extension, 'productIconThemes')) {
2864
2902
  return false;
2865
2903
  }
2866
2904
  return Array.isArray(extension.productIconThemes);
@@ -2929,7 +2967,7 @@ const getWebViewsDetails = async extension => {
2929
2967
  };
2930
2968
 
2931
2969
  const featureWebViewsEnabled = extension => {
2932
- if (!extension || typeof extension !== 'object' || !('webViews' in extension)) {
2970
+ if (!hasProperty(extension, 'webViews')) {
2933
2971
  return false;
2934
2972
  }
2935
2973
  return Array.isArray(extension.webViews);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "4.8.0",
3
+ "version": "4.9.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "repository": {
6
6
  "type": "git",