@lvce-editor/extension-detail-view 3.25.0 → 3.27.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.
@@ -784,7 +784,7 @@ const send = (transport, method, ...params) => {
784
784
  const message = create$4(method, params);
785
785
  transport.send(message);
786
786
  };
787
- const invoke$1 = (ipc, method, ...params) => {
787
+ const invoke = (ipc, method, ...params) => {
788
788
  return invokeHelper(ipc, method, params, false);
789
789
  };
790
790
  const invokeAndTransfer = (ipc, method, ...params) => {
@@ -817,7 +817,7 @@ const createRpc = ipc => {
817
817
  send(ipc, method, ...params);
818
818
  },
819
819
  invoke(method, ...params) {
820
- return invoke$1(ipc, method, ...params);
820
+ return invoke(ipc, method, ...params);
821
821
  },
822
822
  invokeAndTransfer(method, ...params) {
823
823
  return invokeAndTransfer(ipc, method, ...params);
@@ -873,8 +873,6 @@ const WebWorkerRpcClient = {
873
873
  create: create$3
874
874
  };
875
875
 
876
- const assetDir = '';
877
-
878
876
  const create$2 = () => {
879
877
  const states = Object.create(null);
880
878
  return {
@@ -933,6 +931,11 @@ const create$2 = () => {
933
931
  }
934
932
  };
935
933
  };
934
+ const terminate = () => {
935
+ globalThis.close();
936
+ };
937
+
938
+ const assetDir = '';
936
939
 
937
940
  const {
938
941
  get: get$1,
@@ -962,7 +965,8 @@ const create$1 = (uid, uri, x, y, width, height, platform, assetDir$1) => {
962
965
  features: [],
963
966
  folderSize: 0,
964
967
  assetDir: assetDir$1 || assetDir,
965
- platform
968
+ platform,
969
+ settingsButtonEnabled: false
966
970
  };
967
971
  set$1(uid, state, state);
968
972
  };
@@ -1002,7 +1006,7 @@ const dispose = uid => {
1002
1006
  dispose$1(uid);
1003
1007
  };
1004
1008
 
1005
- const commandIds = ['getMenuEntries', 'handleClickDisable', 'handleClickSize', 'handleClickUninstall', 'handleFeaturesClick', 'handleIconError', 'handleTabsClick', 'renderEventListeners', 'resize', 'saveState', 'selectTab', 'terminate'];
1009
+ const commandIds = ['getMenuEntries', 'handleClickDisable', 'handleClickSettings', 'handleClickSetColorTheme', 'handleClickSize', 'handleClickUninstall', 'handleFeaturesClick', 'handleIconError', 'handleTabsClick', 'renderEventListeners', 'resize', 'saveState', 'selectTab', 'terminate'];
1006
1010
 
1007
1011
  const getCommandIds = () => {
1008
1012
  return commandIds;
@@ -1020,10 +1024,18 @@ const i18nString = (key, placeholders = emptyObject) => {
1020
1024
  return key.replaceAll(RE_PLACEHOLDER, replacer);
1021
1025
  };
1022
1026
 
1027
+ const Installation = 'Installation';
1028
+ const Marketplace = 'Marketplace';
1029
+ const Categories$1 = 'Categories';
1030
+ const Resources$1 = 'Resources';
1031
+ const Changelog$2 = 'Changelog';
1023
1032
  const Commands$1 = 'Commands';
1024
1033
  const ContentSecurityPolicy = 'ContentSecurityPolicy';
1025
1034
  const Copy = 'Copy';
1035
+ const Details$1 = 'Details';
1036
+ const Disable = 'Disable';
1026
1037
  const Elements = 'Elements';
1038
+ const Features$2 = 'Features';
1027
1039
  const FileMatch = 'File Match';
1028
1040
  const None$1 = 'None';
1029
1041
  const Id = 'ID';
@@ -1036,13 +1048,39 @@ const SaveImageAs = 'Save Image as';
1036
1048
  const Schema = 'Schema';
1037
1049
  const Selector = 'Selector';
1038
1050
  const Settings$1 = 'Settings';
1051
+ const SetColorTheme = 'Set Color Theme';
1039
1052
  const Theme$1 = 'Theme';
1053
+ const Uninstall = 'Uninstall';
1040
1054
  const WebViews$1 = 'WebViews';
1041
1055
  const NotImplemented = 'Not Implemented';
1042
1056
 
1057
+ const installation = () => {
1058
+ return i18nString(Installation);
1059
+ };
1060
+ const marketplace = () => {
1061
+ return i18nString(Marketplace);
1062
+ };
1063
+ const categories = () => {
1064
+ return i18nString(Categories$1);
1065
+ };
1066
+ const resources = () => {
1067
+ return i18nString(Resources$1);
1068
+ };
1043
1069
  const copy = () => {
1044
1070
  return i18nString(Copy);
1045
1071
  };
1072
+ const changelog = () => {
1073
+ return i18nString(Changelog$2);
1074
+ };
1075
+ const details = () => {
1076
+ return i18nString(Details$1);
1077
+ };
1078
+ const disable = () => {
1079
+ return i18nString(Disable);
1080
+ };
1081
+ const features = () => {
1082
+ return i18nString(Features$2);
1083
+ };
1046
1084
  const none = () => {
1047
1085
  return i18nString(None$1);
1048
1086
  };
@@ -1064,6 +1102,9 @@ const fileMatch = () => {
1064
1102
  const schema = () => {
1065
1103
  return i18nString(Schema);
1066
1104
  };
1105
+ const setColorTheme$3 = () => {
1106
+ return i18nString(SetColorTheme);
1107
+ };
1067
1108
  const theme = () => {
1068
1109
  return i18nString(Theme$1);
1069
1110
  };
@@ -1097,6 +1138,9 @@ const elements = () => {
1097
1138
  const notImplemented = () => {
1098
1139
  return i18nString(NotImplemented);
1099
1140
  };
1141
+ const uninstall = () => {
1142
+ return i18nString(Uninstall);
1143
+ };
1100
1144
 
1101
1145
  const None = 0;
1102
1146
 
@@ -1212,6 +1256,10 @@ const RendererWorker$1 = 1;
1212
1256
  const {
1213
1257
  invoke: invoke$3,
1214
1258
  set: set$3} = create(RendererWorker$1);
1259
+ const setColorTheme$2 = async id => {
1260
+ // @ts-ignore
1261
+ return invoke$3(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
1262
+ };
1215
1263
  const readFile$2 = async uri => {
1216
1264
  return invoke$3('FileSystem.readFile', uri);
1217
1265
  };
@@ -1230,6 +1278,10 @@ const getMarkdownDom$1 = async html => {
1230
1278
  // @ts-ignore
1231
1279
  return invoke$3('Markdown.getVirtualDom', html);
1232
1280
  };
1281
+ const renderMarkdown$2 = async (markdown, options) => {
1282
+ // @ts-ignore
1283
+ return invoke$3('Markdown.renderMarkdown', markdown, options);
1284
+ };
1233
1285
  const openNativeFolder$1 = async uri => {
1234
1286
  // @ts-ignore
1235
1287
  await invoke$3('OpenNativeFolder.openNativeFolder', uri);
@@ -1240,21 +1292,49 @@ const RendererWorker = {
1240
1292
  getExtension: getExtension$3,
1241
1293
  getFolderSize: getFolderSize$2,
1242
1294
  getMarkdownDom: getMarkdownDom$1,
1243
- invoke: invoke$3,
1244
1295
  openNativeFolder: openNativeFolder$1,
1245
1296
  readFile: readFile$2,
1246
- set: set$3};
1297
+ renderMarkdown: renderMarkdown$2,
1298
+ set: set$3,
1299
+ setColorTheme: setColorTheme$2};
1247
1300
 
1248
1301
  const {
1249
- invoke,
1250
- set,
1251
- readFile: readFile$1,
1252
1302
  getAllExtensions: getAllExtensions$1,
1303
+ getExtension: getExtension$2,
1253
1304
  getFolderSize: getFolderSize$1,
1254
- openNativeFolder,
1255
1305
  getMarkdownDom,
1256
- getExtension: getExtension$2
1257
- } = RendererWorker;
1306
+ openNativeFolder,
1307
+ readFile: readFile$1,
1308
+ renderMarkdown: renderMarkdown$1,
1309
+ set,
1310
+ setColorTheme: setColorTheme$1} = RendererWorker;
1311
+
1312
+ const setColorTheme = id => {
1313
+ return setColorTheme$1(id);
1314
+ };
1315
+
1316
+ const getColorThemeId = extension => {
1317
+ if (extension && Array.isArray(extension.colorThemes) && extension.colorThemes.length > 0) {
1318
+ const colorTheme = extension.colorThemes[0];
1319
+ return colorTheme.id || colorTheme.label;
1320
+ }
1321
+ return undefined;
1322
+ };
1323
+ const handleClickSetColorTheme = async state => {
1324
+ const {
1325
+ extension
1326
+ } = state;
1327
+ const colorThemeId = getColorThemeId(extension);
1328
+ if (colorThemeId) {
1329
+ await setColorTheme(colorThemeId);
1330
+ }
1331
+ return state;
1332
+ };
1333
+
1334
+ const handleClickSettings = state => {
1335
+ // TODO: Implement settings functionality
1336
+ return state;
1337
+ };
1258
1338
 
1259
1339
  const handleClickSize = async state => {
1260
1340
  const {
@@ -1355,8 +1435,7 @@ const getThemeMarkdown = (themes, iconThemes, productIconThemes) => {
1355
1435
  };
1356
1436
 
1357
1437
  const renderMarkdown = async (markdown, options = {}) => {
1358
- // @ts-ignore todo
1359
- const html = await invoke('Markdown.renderMarkdown', markdown, options);
1438
+ const html = await renderMarkdown$1(markdown, options);
1360
1439
  return html;
1361
1440
  };
1362
1441
 
@@ -1404,6 +1483,10 @@ const handleTabsClick = (state, name) => {
1404
1483
  return selectTab(state, name);
1405
1484
  };
1406
1485
 
1486
+ const initialize = async () => {
1487
+ // TODO create connection to file system worker
1488
+ };
1489
+
1407
1490
  const isLanguageBasicsExtension = extension => {
1408
1491
  return extension.name && extension.name.startsWith('Language Basics');
1409
1492
  };
@@ -1572,14 +1655,6 @@ const getViewletSize = width => {
1572
1655
  };
1573
1656
 
1574
1657
  const readFile = async uri => {
1575
- if (uri.startsWith('http://') || uri.startsWith('https://')) {
1576
- const response = await fetch(uri);
1577
- if (!response.ok) {
1578
- throw new Error(response.statusText);
1579
- }
1580
- const result = await response.text();
1581
- return result;
1582
- }
1583
1658
  return readFile$1(uri);
1584
1659
  };
1585
1660
 
@@ -1602,6 +1677,8 @@ const loadReadmeContent = async path => {
1602
1677
  if (isEnoentError(error)) {
1603
1678
  return '';
1604
1679
  }
1680
+ // TODO send message to error worker
1681
+ // @ts-ignore
1605
1682
  console.error(new VError(error, 'Failed to load Readme content'));
1606
1683
  return `${error}`;
1607
1684
  }
@@ -1719,6 +1796,7 @@ const mergeClassNames = (...classNames) => {
1719
1796
  const Button$1 = 1;
1720
1797
  const Div = 4;
1721
1798
  const H1 = 5;
1799
+ const Span = 8;
1722
1800
  const Table$1 = 9;
1723
1801
  const TBody = 10;
1724
1802
  const Td = 11;
@@ -1730,15 +1808,18 @@ const Img = 17;
1730
1808
  const H2 = 22;
1731
1809
  const Pre = 51;
1732
1810
  const A = 53;
1811
+ const Code$1 = 65;
1733
1812
  const VirtualDomElements = {
1734
1813
  __proto__: null,
1735
1814
  A,
1736
1815
  Button: Button$1,
1816
+ Code: Code$1,
1737
1817
  Div,
1738
1818
  H1,
1739
1819
  H2,
1740
1820
  Img,
1741
1821
  Pre,
1822
+ Span,
1742
1823
  TBody,
1743
1824
  THead,
1744
1825
  Table: Table$1,
@@ -1774,6 +1855,8 @@ const ExtensionDetailHeaderDetails = 'ExtensionDetailHeaderDetails';
1774
1855
  const ExtensionDetailIcon = 'ExtensionDetailIcon';
1775
1856
  const ExtensionDetailName = 'ExtensionDetailName';
1776
1857
  const ExtensionDetailPanel = 'ExtensionDetailPanel';
1858
+ const SettingsButton = 'SettingsButton';
1859
+ const SettingsIcon = 'SettingsIcon';
1777
1860
  const ExtensionDetailTab = 'ExtensionDetailTab';
1778
1861
  const ExtensionDetailTabs = 'ExtensionDetailTabs';
1779
1862
  const ExtensionDetailTabSelected = 'ExtensionDetailTabSelected';
@@ -1892,6 +1975,37 @@ const getDisplaySize = size => {
1892
1975
  });
1893
1976
  };
1894
1977
 
1978
+ const HandleClickDisable = 'handleClickDisable';
1979
+ const HandleClickSetColorTheme = 'handleClickSetColorTheme';
1980
+ const HandleClickSettings = 'handleClickSettings';
1981
+ const HandleClickSize = 'handleClickSize';
1982
+ const HandleClickUninstall = 'handleClickUninstall';
1983
+ const HandleFeaturesClick = 'handleFeaturesClick';
1984
+ const HandleIconError = 'handleIconError';
1985
+ const HandleReadmeContextMenu = 'handleReadmeContextMenu';
1986
+ const HandleTabsClick = 'handleTabsClick';
1987
+
1988
+ const hasColorThemes = extension => {
1989
+ return Boolean(extension && extension.colorThemes && extension.colorThemes.length > 0);
1990
+ };
1991
+
1992
+ const getExtensionDetailButtons = extension => {
1993
+ const allActions = [{
1994
+ label: setColorTheme$3(),
1995
+ onClick: HandleClickSetColorTheme,
1996
+ enabled: hasColorThemes(extension)
1997
+ }, {
1998
+ label: disable(),
1999
+ onClick: HandleClickDisable,
2000
+ enabled: true
2001
+ }, {
2002
+ label: uninstall(),
2003
+ onClick: HandleClickUninstall,
2004
+ enabled: !extension?.builtin
2005
+ }];
2006
+ return allActions;
2007
+ };
2008
+
1895
2009
  const getChangelogVirtualDom = () => {
1896
2010
  const notImplemented$1 = notImplemented();
1897
2011
  // TODO set tabpanel role
@@ -2047,13 +2161,12 @@ const getAdditionalDetailsVirtualDom = (showAdditionalDetails, firstHeading, ent
2047
2161
  }, ...getAdditionalDetailsEntryVirtualDom(firstHeading, entries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(secondHeading, secondEntries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(thirdHeading, categories, getCategoriesDom), ...getAdditionalDetailsEntryVirtualDom(fourthHeading, resources, getResourcesVirtualDom)];
2048
2162
  };
2049
2163
 
2050
- const HandleClickDisable = 'handleClickDisable';
2051
- const HandleClickSize = 'handleClickSize';
2052
- const HandleClickUninstall = 'handleClickUninstall';
2053
- const HandleFeaturesClick = 'handleFeaturesClick';
2054
- const HandleIconError = 'handleIconError';
2055
- const HandleReadmeContextMenu = 'handleReadmeContextMenu';
2056
- const HandleTabsClick = 'handleTabsClick';
2164
+ const getCategories = () => {
2165
+ return [{
2166
+ id: 'themes',
2167
+ label: 'Themes'
2168
+ }];
2169
+ };
2057
2170
 
2058
2171
  const getInstallationEntries = (displaySize, extensionId, extensionVersion) => {
2059
2172
  const entries = [{
@@ -2094,18 +2207,8 @@ const getMarketplaceEntries = () => {
2094
2207
  }];
2095
2208
  };
2096
2209
 
2097
- const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width) => {
2098
- const firstHeading = 'Installation';
2099
- const entries = getInstallationEntries(displaySize, extensionId, extensionVersion);
2100
- const secondHeading = 'Marketplace';
2101
- const secondEntries = getMarketplaceEntries();
2102
- const thirdHeading = 'Categories';
2103
- const categories = [{
2104
- id: 'themes',
2105
- label: 'Themes'
2106
- }];
2107
- const fourthHeading = 'Resources';
2108
- const resources = [{
2210
+ const getResources = () => {
2211
+ return [{
2109
2212
  label: 'Marketplace',
2110
2213
  url: '#'
2111
2214
  }, {
@@ -2118,6 +2221,17 @@ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionI
2118
2221
  label: 'License',
2119
2222
  url: '#'
2120
2223
  }];
2224
+ };
2225
+
2226
+ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width) => {
2227
+ const firstHeading = installation();
2228
+ const entries = getInstallationEntries(displaySize, extensionId, extensionVersion);
2229
+ const secondHeading = marketplace();
2230
+ const secondEntries = getMarketplaceEntries();
2231
+ const thirdHeading = categories();
2232
+ const categories$1 = getCategories();
2233
+ const fourthHeading = resources();
2234
+ const resources$1 = getResources();
2121
2235
  const showAdditionalDetailsBreakpoint = 600;
2122
2236
  const showAdditionalDetails = width > showAdditionalDetailsBreakpoint;
2123
2237
  const childCount = showAdditionalDetails ? 2 : 1;
@@ -2126,7 +2240,7 @@ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionI
2126
2240
  className: ExtensionDetailPanel,
2127
2241
  childCount: childCount,
2128
2242
  role: Panel
2129
- }, ...(await getMarkdownVirtualDom(sanitizedReadmeHtml)), ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories, fourthHeading, resources)];
2243
+ }, ...(await getMarkdownVirtualDom(sanitizedReadmeHtml)), ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories$1, fourthHeading, resources$1)];
2130
2244
  return dom;
2131
2245
  };
2132
2246
 
@@ -2180,8 +2294,7 @@ const getCellCodeVirtualDom = value => {
2180
2294
  className: TableCell,
2181
2295
  childCount: 1
2182
2296
  }, {
2183
- type: VirtualDomElements.Div,
2184
- // TODO use code tag
2297
+ type: VirtualDomElements.Code,
2185
2298
  childCount: 1
2186
2299
  }, text(value)];
2187
2300
  };
@@ -2345,11 +2458,11 @@ const getFeatureSettingsVirtualDom = extension => {
2345
2458
  }, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
2346
2459
  };
2347
2460
 
2348
- const getVirtualDomChildCount = markdownDom => {
2349
- const max = markdownDom.length - 1;
2461
+ const getVirtualDomChildCount = dom => {
2462
+ const max = dom.length - 1;
2350
2463
  let stack = [];
2351
2464
  for (let i = max; i >= 0; i--) {
2352
- const element = markdownDom[i];
2465
+ const element = dom[i];
2353
2466
  if (element.childCount > 0) {
2354
2467
  stack = stack.slice(element.childCount);
2355
2468
  }
@@ -2517,6 +2630,14 @@ const getExtensionDetailContentVirtualDom = async (sanitizedReadmeHtml, themesHt
2517
2630
  }
2518
2631
  };
2519
2632
 
2633
+ const getExtensionDetailDescriptionVirtualDom = description => {
2634
+ return [{
2635
+ type: VirtualDomElements.Div,
2636
+ className: ExtensionDetailDescription,
2637
+ childCount: 1
2638
+ }, text(description)];
2639
+ };
2640
+
2520
2641
  const getButtonVirtualDom = (message, onClick) => {
2521
2642
  return [{
2522
2643
  type: VirtualDomElements.Button,
@@ -2526,21 +2647,51 @@ const getButtonVirtualDom = (message, onClick) => {
2526
2647
  }, text(message)];
2527
2648
  };
2528
2649
 
2529
- const getExtensionDetailHeaderActionsVirtualDom = () => {
2650
+ const getSettingsButtonVirtualDom = enabled => {
2651
+ if (!enabled) {
2652
+ return [];
2653
+ }
2654
+ return [{
2655
+ type: VirtualDomElements.Button,
2656
+ className: SettingsButton,
2657
+ onClick: HandleClickSettings,
2658
+ childCount: 1,
2659
+ title: 'Settings'
2660
+ }, {
2661
+ type: VirtualDomElements.Span,
2662
+ className: SettingsIcon,
2663
+ childCount: 0,
2664
+ text: '⚙️'
2665
+ }];
2666
+ };
2667
+
2668
+ const getExtensionDetailHeaderActionsVirtualDom = (buttonDefs, settingsButtonEnabled) => {
2669
+ const enabledButtons = buttonDefs.filter(btn => btn.enabled);
2670
+ const buttons = enabledButtons.flatMap(btn => getButtonVirtualDom(btn.label, btn.onClick));
2671
+ const settingsButton = getSettingsButtonVirtualDom(settingsButtonEnabled);
2530
2672
  const dom = [{
2531
2673
  type: VirtualDomElements.Div,
2532
2674
  className: ExtensionDetailHeaderActions,
2533
- childCount: 2
2534
- }, ...getButtonVirtualDom('Disable', HandleClickDisable), ...getButtonVirtualDom('Uninstall', HandleClickUninstall)];
2675
+ childCount: enabledButtons.length + settingsButton.length
2676
+ }, ...buttons, ...settingsButton];
2535
2677
  return dom;
2536
2678
  };
2537
2679
 
2538
- const getExtensionDetailHeaderVirtualDom = extensionDetail => {
2539
- const {
2540
- name,
2541
- iconSrc,
2542
- description
2543
- } = extensionDetail;
2680
+ const getNameBadgeVirtualDom = badge => {
2681
+ {
2682
+ return [];
2683
+ }
2684
+ };
2685
+
2686
+ const getExtensionDetailNameVirtualDom = (name, badge) => {
2687
+ return [{
2688
+ type: VirtualDomElements.Div,
2689
+ className: ExtensionDetailName,
2690
+ childCount: badge ? 2 : 1
2691
+ }, text(name), ...getNameBadgeVirtualDom()];
2692
+ };
2693
+
2694
+ const getExtensionDetailHeaderVirtualDom = (name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled) => {
2544
2695
  const dom = [{
2545
2696
  type: VirtualDomElements.Div,
2546
2697
  className: ExtensionDetailHeader,
@@ -2556,29 +2707,21 @@ const getExtensionDetailHeaderVirtualDom = extensionDetail => {
2556
2707
  type: VirtualDomElements.Div,
2557
2708
  className: ExtensionDetailHeaderDetails,
2558
2709
  childCount: 3
2559
- }, {
2560
- type: VirtualDomElements.Div,
2561
- className: ExtensionDetailName,
2562
- childCount: 1
2563
- }, text(name), {
2564
- type: VirtualDomElements.Div,
2565
- className: ExtensionDetailDescription,
2566
- childCount: 1
2567
- }, text(description), ...getExtensionDetailHeaderActionsVirtualDom()];
2710
+ }, ...getExtensionDetailNameVirtualDom(name, badge), ...getExtensionDetailDescriptionVirtualDom(description), ...getExtensionDetailHeaderActionsVirtualDom(buttonDefs, settingsButtonEnabled)];
2568
2711
  return dom;
2569
2712
  };
2570
2713
 
2571
2714
  const getTabs = selectedTab => {
2572
2715
  const tabs = [{
2573
- label: 'Details',
2716
+ label: details(),
2574
2717
  name: Details,
2575
2718
  selected: selectedTab === Details
2576
2719
  }, {
2577
- label: 'Features',
2720
+ label: features(),
2578
2721
  name: Features$1,
2579
2722
  selected: selectedTab === Features$1
2580
2723
  }, {
2581
- label: 'Changelog',
2724
+ label: changelog(),
2582
2725
  name: Changelog$1,
2583
2726
  selected: selectedTab === Changelog$1
2584
2727
  }];
@@ -2630,7 +2773,7 @@ const getClassNames = size => {
2630
2773
  }
2631
2774
  };
2632
2775
 
2633
- const getExtensionDetailVirtualDom = async (extensionDetail, sanitizedReadmeHtml, selectedTab, newState) => {
2776
+ const getExtensionDetailVirtualDom = async (newState, sanitizedReadmeHtml, selectedTab) => {
2634
2777
  // TODO move this to view model so that rendering occurs like
2635
2778
  // 1. state
2636
2779
  // 2. view model
@@ -2648,16 +2791,26 @@ const getExtensionDetailVirtualDom = async (extensionDetail, sanitizedReadmeHtml
2648
2791
  const tabs = getTabs(selectedTab);
2649
2792
  const sizeValue = getViewletSize(newState?.width || 0);
2650
2793
  const sizeClass = getClassNames(sizeValue);
2794
+ const buttonDefs = getExtensionDetailButtons(extension);
2795
+ const {
2796
+ name,
2797
+ iconSrc,
2798
+ description
2799
+ } = newState;
2800
+ const badge = '';
2801
+ const {
2802
+ settingsButtonEnabled
2803
+ } = newState;
2651
2804
  const dom = [{
2652
2805
  type: VirtualDomElements.Div,
2653
2806
  className: mergeClassNames(Viewlet, ExtensionDetail, sizeClass),
2654
2807
  childCount: 3
2655
- }, ...getExtensionDetailHeaderVirtualDom(extensionDetail), ...getTabsVirtualDom(tabs), ...(await getExtensionDetailContentVirtualDom(sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width))];
2808
+ }, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled), ...getTabsVirtualDom(tabs), ...(await getExtensionDetailContentVirtualDom(sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width))];
2656
2809
  return dom;
2657
2810
  };
2658
2811
 
2659
2812
  const renderDom = async (oldState, newState) => {
2660
- const dom = await getExtensionDetailVirtualDom(newState, newState.sanitizedReadmeHtml, newState.selectedTab, newState);
2813
+ const dom = await getExtensionDetailVirtualDom(newState, newState.sanitizedReadmeHtml, newState.selectedTab);
2661
2814
  return ['Viewlet.setDom2', dom];
2662
2815
  };
2663
2816
 
@@ -2714,9 +2867,15 @@ const renderEventListeners = () => {
2714
2867
  }, {
2715
2868
  name: HandleClickDisable,
2716
2869
  params: ['handleClickDisable']
2870
+ }, {
2871
+ name: HandleClickSettings,
2872
+ params: ['handleClickSettings']
2717
2873
  }, {
2718
2874
  name: HandleClickUninstall,
2719
2875
  params: ['handleClickUninstall']
2876
+ }, {
2877
+ name: HandleClickSetColorTheme,
2878
+ params: ['handleClickSetColorTheme']
2720
2879
  }];
2721
2880
  };
2722
2881
 
@@ -2741,10 +2900,6 @@ const saveState = uid => {
2741
2900
  };
2742
2901
  };
2743
2902
 
2744
- const terminate = () => {
2745
- globalThis.close();
2746
- };
2747
-
2748
2903
  const commandMap = {
2749
2904
  'ExtensionDetail.create': create$1,
2750
2905
  'ExtensionDetail.diff2': diff2,
@@ -2752,6 +2907,8 @@ const commandMap = {
2752
2907
  'ExtensionDetail.getCommandIds': getCommandIds,
2753
2908
  'ExtensionDetail.getMenuEntries': getMenuEntries,
2754
2909
  'ExtensionDetail.handleClickDisable': wrapCommand(handleClickDisable),
2910
+ 'ExtensionDetail.handleClickSettings': wrapCommand(handleClickSettings),
2911
+ 'ExtensionDetail.handleClickSetColorTheme': wrapCommand(handleClickSetColorTheme),
2755
2912
  'ExtensionDetail.handleClickSize': wrapCommand(handleClickSize),
2756
2913
  'ExtensionDetail.handleClickUninstall': wrapCommand(handleClickUninstall),
2757
2914
  'ExtensionDetail.handleFeaturesClick': wrapCommand(handleClickFeatures),
@@ -2763,7 +2920,8 @@ const commandMap = {
2763
2920
  'ExtensionDetail.resize': resize,
2764
2921
  'ExtensionDetail.saveState': saveState,
2765
2922
  'ExtensionDetail.selectTab': wrapCommand(selectTab),
2766
- 'ExtensionDetail.terminate': terminate
2923
+ 'ExtensionDetail.terminate': terminate,
2924
+ 'ExtensionDetail.initialize': initialize
2767
2925
  };
2768
2926
 
2769
2927
  const listen = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.25.0",
3
+ "version": "3.27.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",