@lvce-editor/extension-detail-view 3.11.0 → 3.13.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.
@@ -923,12 +923,15 @@ const Markdown = 'Markdown';
923
923
  const MoreInfo = 'MoreInfo';
924
924
  const MoreInfoEntry = 'MoreInfoEntry';
925
925
  const MoreInfoEntryKey = 'MoreInfoEntryKey';
926
+ const MoreInfoEntryOdd = 'MoreInfoEntryOdd';
926
927
  const MoreInfoEntryValue = 'MoreInfoEntryValue';
927
928
  const Normal$1 = 'Normal';
928
929
  const Resource = 'Resource';
929
930
  const Resources = 'Resources';
930
931
  const Small$1 = 'Small';
931
932
  const Table$1 = 'Table';
933
+ const TableCell = 'TableCell';
934
+ const TableHeading = 'TableHeading';
932
935
  const Viewlet = 'Viewlet';
933
936
 
934
937
  const BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
@@ -1149,7 +1152,7 @@ const parentNodeEven = {
1149
1152
  };
1150
1153
  const parentNodeOdd = {
1151
1154
  type: Div$1,
1152
- className: MoreInfoEntry + ' ' + 'MoreInfoEntryOdd',
1155
+ className: MoreInfoEntry + ' ' + MoreInfoEntryOdd,
1153
1156
  childCount: 2
1154
1157
  };
1155
1158
  const getMoreInfoEntryVirtualDom = item => {
@@ -1168,16 +1171,17 @@ const getMoreInfoVirtualDom = items => {
1168
1171
  }, ...items.flatMap(getMoreInfoEntryVirtualDom)];
1169
1172
  };
1170
1173
 
1174
+ const resourceNode = {
1175
+ // TODO use link with url
1176
+ type: Div$1,
1177
+ className: Resource,
1178
+ childCount: 1
1179
+ };
1171
1180
  const getResourceVirtualDom = resource => {
1172
1181
  const {
1173
1182
  label
1174
1183
  } = resource;
1175
- return [{
1176
- // TODO use link with url
1177
- type: Div$1,
1178
- className: Resource,
1179
- childCount: 1
1180
- }, text(label)];
1184
+ return [resourceNode, text(label)];
1181
1185
  };
1182
1186
 
1183
1187
  const getResourcesVirtualDom = resources => {
@@ -1208,6 +1212,7 @@ const HandleClickDisable = 'handleClickDisable';
1208
1212
  const HandleClickSize = 'handleClickSize';
1209
1213
  const HandleClickUninstall = 'handleClickUninstall';
1210
1214
  const HandleFeaturesClick = 'handleFeaturesClick';
1215
+ const HandleIconError = 'handleIconError';
1211
1216
  const HandleReadmeContextMenu = 'handleReadmeContextMenu';
1212
1217
  const HandleTabsClick = 'handleTabsClick';
1213
1218
 
@@ -1768,6 +1773,7 @@ const Elements = 'Elements';
1768
1773
  const FileMatch = 'File Match';
1769
1774
  const Id = 'ID';
1770
1775
  const JsonValidation$1 = 'Json Validation';
1776
+ const Label = 'Label';
1771
1777
  const OpenImageInNewTab = 'Open Image in New Tab';
1772
1778
  const OpenInNewTab = 'Open in New Tab';
1773
1779
  const ProgrammingLanguages$1 = 'Programming Languages';
@@ -1784,6 +1790,9 @@ const copy = () => {
1784
1790
  const openInNewTab = () => {
1785
1791
  return i18nString(OpenInNewTab);
1786
1792
  };
1793
+ const label = () => {
1794
+ return i18nString(Label);
1795
+ };
1787
1796
  const openImageInNewTab = () => {
1788
1797
  return i18nString(OpenImageInNewTab);
1789
1798
  };
@@ -1844,6 +1853,7 @@ const getCommandTableEntry = command => {
1844
1853
  value: label
1845
1854
  }];
1846
1855
  };
1856
+
1847
1857
  const getCommandTableEntries = extension => {
1848
1858
  const commands = extension.commands || [];
1849
1859
  const rows = commands.map(getCommandTableEntry);
@@ -1860,10 +1870,18 @@ const getFeatureContentHeadingVirtualDom = heading => {
1860
1870
  }, text(heading)];
1861
1871
  };
1862
1872
 
1873
+ const getTableHeadingVirtualDom = heading => {
1874
+ return [{
1875
+ type: Th,
1876
+ className: TableHeading,
1877
+ childCount: 1
1878
+ }, text(heading)];
1879
+ };
1880
+
1863
1881
  const getCellCodeVirtualDom = value => {
1864
1882
  return [{
1865
1883
  type: Td,
1866
- className: 'TableCell',
1884
+ className: TableCell,
1867
1885
  childCount: 1
1868
1886
  }, {
1869
1887
  type: Div$1,
@@ -1875,7 +1893,7 @@ const getCellCodeVirtualDom = value => {
1875
1893
  const getCellTextVirtualDom = value => {
1876
1894
  return [{
1877
1895
  type: Td,
1878
- className: 'TableCell',
1896
+ className: TableCell,
1879
1897
  childCount: 1
1880
1898
  }, text(value)];
1881
1899
  };
@@ -1900,20 +1918,13 @@ const getCellVirtualDom = entry => {
1900
1918
  return fn(value);
1901
1919
  };
1902
1920
 
1903
- const getTableHeadingVirtualDom = heading => {
1904
- return [{
1905
- type: Th,
1906
- className: 'TableHeading',
1907
- childCount: 1
1908
- }, text(heading)];
1909
- };
1910
-
1911
1921
  const getTableRowVirtualDom = entries => {
1912
1922
  return [{
1913
1923
  type: Tr,
1914
1924
  childCount: entries.length
1915
1925
  }, ...entries.flatMap(getCellVirtualDom)];
1916
1926
  };
1927
+
1917
1928
  const getTableVirtualDom = tableInfo => {
1918
1929
  const {
1919
1930
  headings,
@@ -1935,6 +1946,7 @@ const getTableVirtualDom = tableInfo => {
1935
1946
  }, ...rows.flatMap(getTableRowVirtualDom)];
1936
1947
  };
1937
1948
 
1949
+ // TODO have typed view-model
1938
1950
  const getFeatureCommandsVirtualDom = extension => {
1939
1951
  const heading = commands();
1940
1952
  const tableInfo = getCommandTableEntries(extension);
@@ -2014,11 +2026,14 @@ const getSettingsTableEntry = setting => {
2014
2026
  value: label
2015
2027
  }];
2016
2028
  };
2029
+
2017
2030
  const getSettingsTableEntries = extension => {
2018
2031
  const settings = extension.settings || [];
2019
2032
  const rows = settings.map(getSettingsTableEntry);
2033
+ const textId = id();
2034
+ const textLabel = label();
2020
2035
  return {
2021
- headings: ['ID', 'Label'],
2036
+ headings: [textId, textLabel],
2022
2037
  rows
2023
2038
  };
2024
2039
  };
@@ -2063,6 +2078,8 @@ const item = {
2063
2078
  className: DefinitionListItem,
2064
2079
  childCount: 2
2065
2080
  };
2081
+
2082
+ // TODO move json stringify to view model
2066
2083
  const getWebViewVirtualDom = webView => {
2067
2084
  const {
2068
2085
  id: id$1,
@@ -2264,7 +2281,13 @@ const getFeatures = (selectedFeature, extension) => {
2264
2281
  if (!selectedFeature) {
2265
2282
  selectedFeature = Theme;
2266
2283
  }
2267
- const features = [...ifElseFeature(Theme, 'Theme', hasThemes, selectedFeature, extension), ...ifElseFeature(Commands, 'Commands', hasCommands, selectedFeature, extension), ...ifElseFeature(JsonValidation, 'Json Validation', hasJsonValidation, selectedFeature, extension), ...ifElseFeature(ProgrammingLanguages, 'Programming Languages', hasProgrammingLanguages, selectedFeature, extension), ...ifElseFeature(Settings, 'Settings', hasSettings, selectedFeature, extension), ...ifElseFeature(WebViews, 'WebViews', hasWebViews, selectedFeature, extension)];
2284
+ const textTheme = theme();
2285
+ const textCommands = commands();
2286
+ const textJsonValidation = jsonValidation();
2287
+ const programmingLanguages$1 = programmingLanguages();
2288
+ const settings$1 = settings();
2289
+ const webViews$1 = webViews();
2290
+ const features = [...ifElseFeature(Theme, textTheme, hasThemes, selectedFeature, extension), ...ifElseFeature(Commands, textCommands, hasCommands, selectedFeature, extension), ...ifElseFeature(JsonValidation, textJsonValidation, hasJsonValidation, selectedFeature, extension), ...ifElseFeature(ProgrammingLanguages, programmingLanguages$1, hasProgrammingLanguages, selectedFeature, extension), ...ifElseFeature(Settings, settings$1, hasSettings, selectedFeature, extension), ...ifElseFeature(WebViews, webViews$1, hasWebViews, selectedFeature, extension)];
2268
2291
  return features;
2269
2292
  };
2270
2293
 
@@ -5312,6 +5335,31 @@ const loadContent = async (state, platform, savedState) => {
5312
5335
  };
5313
5336
  };
5314
5337
 
5338
+ const renderEventListeners = () => {
5339
+ return [{
5340
+ name: HandleIconError,
5341
+ params: ['handleIconError']
5342
+ }, {
5343
+ name: HandleReadmeContextMenu,
5344
+ params: ['handleReadmeContextMenu', 'event.clientX', 'event.clientY', 'event.target.href', 'event.target.src']
5345
+ }, {
5346
+ name: HandleTabsClick,
5347
+ params: ['handleTabsClick', 'event.target.name']
5348
+ }, {
5349
+ name: HandleFeaturesClick,
5350
+ params: ['handleFeaturesClick', 'event.target.name']
5351
+ }, {
5352
+ name: HandleClickSize,
5353
+ params: ['handleClickSize', 'event.target.name']
5354
+ }, {
5355
+ name: HandleClickDisable,
5356
+ params: ['handleClickDisable']
5357
+ }, {
5358
+ name: HandleClickUninstall,
5359
+ params: ['handleClickUninstall']
5360
+ }];
5361
+ };
5362
+
5315
5363
  const resize = (state, dimensions) => {
5316
5364
  return {
5317
5365
  ...state,
@@ -5365,6 +5413,7 @@ const commandMap = {
5365
5413
  'ExtensionDetail.handleIconError': wrapCommand(handleIconError),
5366
5414
  'ExtensionDetail.handleTabsClick': wrapCommand(handleTabsClick),
5367
5415
  'ExtensionDetail.loadContent': wrapCommand(loadContent),
5416
+ 'ExtensionDetail.renderEventListeners': renderEventListeners,
5368
5417
  'ExtensionDetail.resize': resize,
5369
5418
  'ExtensionDetail.saveState': saveState,
5370
5419
  'ExtensionDetail.selectTab': wrapCommand(selectTab),
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.11.0",
3
+ "version": "3.13.0",
4
4
  "description": "Extension Detail View Worker",
5
- "keywords": [],
6
5
  "license": "MIT",
7
6
  "author": "Lvce Editor",
8
7
  "type": "module",