@lvce-editor/extension-detail-view 4.7.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';
@@ -57,6 +61,7 @@ const Selector = 'Selector';
57
61
  const SetColorTheme$1 = 'Set Color Theme';
58
62
  const Settings$1 = 'Settings';
59
63
  const Size = 'Size';
64
+ const StringMustNotBeEmpty = 'String must not be empty';
60
65
  const Theme$1 = 'Theme';
61
66
  const Uninstall$1 = 'Uninstall';
62
67
  const UnsupportedFeature = 'Unsupported Feature';
@@ -150,6 +155,18 @@ const settings = () => {
150
155
  const id$1 = () => {
151
156
  return i18nString(Id);
152
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
+ };
153
170
  const selector = () => {
154
171
  return i18nString(Selector);
155
172
  };
@@ -213,6 +230,9 @@ const license = () => {
213
230
  const propertyMustBeOfTypeString = () => {
214
231
  return i18nString(PropertyMustBeOfTypeString);
215
232
  };
233
+ const stringMustNotBeEmpty = () => {
234
+ return i18nString(StringMustNotBeEmpty);
235
+ };
216
236
  const schemaNotFound = () => {
217
237
  return i18nString(SchemaNotFound);
218
238
  };
@@ -220,15 +240,49 @@ const invalidLink = () => {
220
240
  return i18nString(InvalidLink);
221
241
  };
222
242
 
243
+ const getActivationEntry = value => {
244
+ if (typeof value !== 'string') {
245
+ return {
246
+ isValid: false,
247
+ stringValue: JSON.stringify(value),
248
+ errorMessage: propertyMustBeOfTypeString()
249
+ };
250
+ }
251
+ if (!value) {
252
+ return {
253
+ isValid: false,
254
+ stringValue: '',
255
+ errorMessage: stringMustNotBeEmpty()
256
+ };
257
+ }
258
+ return {
259
+ isValid: true,
260
+ stringValue: value,
261
+ errorMessage: ''
262
+ };
263
+ };
264
+ const getActivationEntries = activation => {
265
+ return activation.map(getActivationEntry);
266
+ };
267
+
223
268
  const getActivationEventsDetails = async extension => {
224
269
  const activationEvents = extension.activation || [];
270
+ const activationEntries = getActivationEntries(activationEvents);
225
271
  return {
226
- activationEvents
272
+ activationEvents,
273
+ activationEntries
227
274
  };
228
275
  };
229
276
 
277
+ const hasProperty = (object, key) => {
278
+ if (!object || typeof object !== 'object' || !(key in object)) {
279
+ return false;
280
+ }
281
+ return true;
282
+ };
283
+
230
284
  const featureActivationEventsEnabled = extension => {
231
- if (!extension || typeof extension !== 'object' || !('activation' in extension)) {
285
+ if (!hasProperty(extension, 'activation')) {
232
286
  return false;
233
287
  }
234
288
  return Array.isArray(extension.activation);
@@ -348,7 +402,20 @@ const code = {
348
402
  childCount: 1
349
403
  };
350
404
  const getActivationEventVirtualDom = event => {
351
- return [li, code, text(event)];
405
+ const {
406
+ stringValue,
407
+ errorMessage,
408
+ isValid
409
+ } = event;
410
+ if (!isValid) {
411
+ return [{
412
+ type: Li,
413
+ childCount: 1,
414
+ title: errorMessage,
415
+ className: 'ListItem ListItemInvalid'
416
+ }, code, text(stringValue)];
417
+ }
418
+ return [li, code, text(stringValue)];
352
419
  };
353
420
 
354
421
  const getFeatureContentHeadingVirtualDom = heading => {
@@ -371,7 +438,7 @@ const getFeatureActivationEventsVirtualDom = activationEvents$1 => {
371
438
  };
372
439
 
373
440
  const getActivationEventsVirtualDom = state => {
374
- return getFeatureActivationEventsVirtualDom(state.activationEvents);
441
+ return getFeatureActivationEventsVirtualDom(state.activationEntries);
375
442
  };
376
443
 
377
444
  const Text = 1;
@@ -402,7 +469,7 @@ const getCommandsDetails = async extension => {
402
469
  };
403
470
 
404
471
  const featureCommandsEnabled = extension => {
405
- if (!extension || typeof extension !== 'object' || !('commands' in extension)) {
472
+ if (!hasProperty(extension, 'commands')) {
406
473
  return false;
407
474
  }
408
475
  return Array.isArray(extension.commands);
@@ -738,7 +805,7 @@ const getJsonValidationDetails = async extension => {
738
805
  };
739
806
 
740
807
  const featureJsonValidationEnabled = extension => {
741
- if (!extension || typeof extension !== 'object' || !('jsonValidation' in extension)) {
808
+ if (!hasProperty(extension, 'jsonValidation')) {
742
809
  return false;
743
810
  }
744
811
  return Array.isArray(extension.jsonValidation);
@@ -772,27 +839,42 @@ const getProgrammingLanguagesDetails = async extension => {
772
839
  };
773
840
 
774
841
  const featureProgrammingLanguagesEnabled = extension => {
775
- if (!extension || typeof extension !== 'object' || !('programmingLanguages' in extension)) {
842
+ if (!hasProperty(extension, 'languages')) {
776
843
  return false;
777
844
  }
778
845
  const {
779
- programmingLanguages
846
+ languages
780
847
  } = extension;
781
- return Array.isArray(programmingLanguages);
848
+ return Array.isArray(languages);
782
849
  };
783
850
 
784
- 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 => {
785
864
  const heading = programmingLanguages();
786
- // TODO
865
+ const tableInfo = getProgrammingLanguagesTableEntries(programmingLanguages$1);
787
866
  return [{
788
867
  type: Div,
789
868
  className: FeatureContent,
790
- childCount: 1
791
- }, ...getFeatureContentHeadingVirtualDom(heading)];
869
+ childCount: 2
870
+ }, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
792
871
  };
793
872
 
794
873
  const getProgrammingLanguagesVirtualDom = state => {
795
- return getFeatureProgrammingLanguagesVirtualDom();
874
+ const {
875
+ programmingLanguages
876
+ } = state;
877
+ return getFeatureProgrammingLanguagesVirtualDom(programmingLanguages);
796
878
  };
797
879
 
798
880
  class FeatureNotFoundError extends Error {
@@ -2558,7 +2640,7 @@ const getSettingsDetails = async extension => {
2558
2640
  };
2559
2641
 
2560
2642
  const featureSettingsEnabled = extension => {
2561
- if (!extension || typeof extension !== 'object' || !('settings' in extension)) {
2643
+ if (!hasProperty(extension, 'settings')) {
2562
2644
  return false;
2563
2645
  }
2564
2646
  return Array.isArray(extension.settings);
@@ -2802,21 +2884,21 @@ const getThemeDetails = async (extension, baseUrl, locationProtocol) => {
2802
2884
  };
2803
2885
 
2804
2886
  const featureColorThemeEnabled = extension => {
2805
- if (!extension || typeof extension !== 'object' || !('colorThemes' in extension)) {
2887
+ if (!hasProperty(extension, 'colorThemes')) {
2806
2888
  return false;
2807
2889
  }
2808
2890
  return Array.isArray(extension.colorThemes);
2809
2891
  };
2810
2892
 
2811
2893
  const featureIconThemeEnabled = extension => {
2812
- if (!extension || typeof extension !== 'object' || !('iconThemes' in extension)) {
2894
+ if (!hasProperty(extension, 'iconThemes')) {
2813
2895
  return false;
2814
2896
  }
2815
2897
  return Array.isArray(extension.iconThemes);
2816
2898
  };
2817
2899
 
2818
2900
  const featureProductIconThemeEnabled = extension => {
2819
- if (!extension || typeof extension !== 'object' || !('productIconThemes' in extension)) {
2901
+ if (!hasProperty(extension, 'productIconThemes')) {
2820
2902
  return false;
2821
2903
  }
2822
2904
  return Array.isArray(extension.productIconThemes);
@@ -2885,7 +2967,7 @@ const getWebViewsDetails = async extension => {
2885
2967
  };
2886
2968
 
2887
2969
  const featureWebViewsEnabled = extension => {
2888
- if (!extension || typeof extension !== 'object' || !('webViews' in extension)) {
2970
+ if (!hasProperty(extension, 'webViews')) {
2889
2971
  return false;
2890
2972
  }
2891
2973
  return Array.isArray(extension.webViews);
@@ -3220,7 +3302,8 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
3220
3302
  paddingRight: 0,
3221
3303
  showSideBar: true,
3222
3304
  sideBarWidth: 0,
3223
- locationProtocol: ''
3305
+ locationProtocol: '',
3306
+ activationEntries: []
3224
3307
  };
3225
3308
  set(uid, state, state);
3226
3309
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "4.7.0",
3
+ "version": "4.9.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "repository": {
6
6
  "type": "git",