@lvce-editor/extension-detail-view 3.17.0 → 3.18.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.
@@ -791,6 +791,9 @@ const createRpc = ipc => {
791
791
  },
792
792
  invokeAndTransfer(method, ...params) {
793
793
  return invokeAndTransfer(ipc, method, ...params);
794
+ },
795
+ async dispose() {
796
+ await ipc?.dispose();
794
797
  }
795
798
  };
796
799
  return rpc;
@@ -944,6 +947,7 @@ const AdditionalDetailsTitle = 'AdditionalDetailsTitle';
944
947
  const Aside = 'Aside';
945
948
  const Button$1 = 'Button';
946
949
  const ButtonPrimary = 'ButtonPrimary';
950
+ const DefaultMarkdown = 'DefaultMarkdown';
947
951
  const Categories = 'Categories';
948
952
  const Category = 'Category';
949
953
  const Changelog$1 = 'Changelog';
@@ -967,6 +971,8 @@ const Features$1 = 'Features';
967
971
  const FeaturesList = 'FeaturesList';
968
972
  const FeatureWebView = 'FeatureWebView';
969
973
  const Large$1 = 'Large';
974
+ const Sash = 'Sash';
975
+ const SashVertical = 'SashVertical';
970
976
  const MoreInfo = 'MoreInfo';
971
977
  const MoreInfoEntry = 'MoreInfoEntry';
972
978
  const MoreInfoEntryKey = 'MoreInfoEntryKey';
@@ -1053,6 +1059,92 @@ const getDisplaySize = size => {
1053
1059
  });
1054
1060
  };
1055
1061
 
1062
+ const emptyObject = {};
1063
+ const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1064
+ const i18nString = (key, placeholders = emptyObject) => {
1065
+ if (placeholders === emptyObject) {
1066
+ return key;
1067
+ }
1068
+ const replacer = (match, rest) => {
1069
+ return placeholders[rest];
1070
+ };
1071
+ return key.replaceAll(RE_PLACEHOLDER, replacer);
1072
+ };
1073
+
1074
+ const Commands$1 = 'Commands';
1075
+ const ContentSecurityPolicy = 'ContentSecurityPolicy';
1076
+ const Copy = 'Copy';
1077
+ const Elements = 'Elements';
1078
+ const FileMatch = 'File Match';
1079
+ const Id = 'ID';
1080
+ const JsonValidation$1 = 'Json Validation';
1081
+ const Label = 'Label';
1082
+ const OpenImageInNewTab = 'Open Image in New Tab';
1083
+ const OpenInNewTab = 'Open in New Tab';
1084
+ const ProgrammingLanguages$1 = 'Programming Languages';
1085
+ const SaveImageAs = 'Save Image as';
1086
+ const Schema = 'Schema';
1087
+ const Selector = 'Selector';
1088
+ const Settings$1 = 'Settings';
1089
+ const Theme$1 = 'Theme';
1090
+ const WebViews$1 = 'WebViews';
1091
+ const NotImplemented = 'Not Implemented';
1092
+
1093
+ const copy = () => {
1094
+ return i18nString(Copy);
1095
+ };
1096
+ const openInNewTab = () => {
1097
+ return i18nString(OpenInNewTab);
1098
+ };
1099
+ const label = () => {
1100
+ return i18nString(Label);
1101
+ };
1102
+ const openImageInNewTab = () => {
1103
+ return i18nString(OpenImageInNewTab);
1104
+ };
1105
+ const saveImageAs = () => {
1106
+ return i18nString(SaveImageAs);
1107
+ };
1108
+ const fileMatch = () => {
1109
+ return i18nString(FileMatch);
1110
+ };
1111
+ const schema = () => {
1112
+ return i18nString(Schema);
1113
+ };
1114
+ const theme = () => {
1115
+ return i18nString(Theme$1);
1116
+ };
1117
+ const commands = () => {
1118
+ return i18nString(Commands$1);
1119
+ };
1120
+ const webViews = () => {
1121
+ return i18nString(WebViews$1);
1122
+ };
1123
+ const jsonValidation = () => {
1124
+ return i18nString(JsonValidation$1);
1125
+ };
1126
+ const programmingLanguages = () => {
1127
+ return i18nString(ProgrammingLanguages$1);
1128
+ };
1129
+ const settings = () => {
1130
+ return i18nString(Settings$1);
1131
+ };
1132
+ const id = () => {
1133
+ return i18nString(Id);
1134
+ };
1135
+ const selector = () => {
1136
+ return i18nString(Selector);
1137
+ };
1138
+ const contentSecurityPolicy = () => {
1139
+ return i18nString(ContentSecurityPolicy);
1140
+ };
1141
+ const elements = () => {
1142
+ return i18nString(Elements);
1143
+ };
1144
+ const notImplemented = () => {
1145
+ return i18nString(NotImplemented);
1146
+ };
1147
+
1056
1148
  const A = 53;
1057
1149
  const Button = 1;
1058
1150
  const Div = 4;
@@ -1077,12 +1169,13 @@ const text = data => {
1077
1169
  };
1078
1170
 
1079
1171
  const getChangelogVirtualDom = () => {
1172
+ const notImplemented$1 = notImplemented();
1080
1173
  // TODO set tabpanel role
1081
1174
  return [{
1082
1175
  type: Div,
1083
1176
  className: Changelog$1,
1084
1177
  childCount: 1
1085
- }, text('Not Implemented')];
1178
+ }, text(notImplemented$1)];
1086
1179
  };
1087
1180
 
1088
1181
  const TabList = 'tablist';
@@ -1327,88 +1420,6 @@ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionI
1327
1420
  return dom;
1328
1421
  };
1329
1422
 
1330
- const emptyObject = {};
1331
- const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1332
- const i18nString = (key, placeholders = emptyObject) => {
1333
- if (placeholders === emptyObject) {
1334
- return key;
1335
- }
1336
- const replacer = (match, rest) => {
1337
- return placeholders[rest];
1338
- };
1339
- return key.replaceAll(RE_PLACEHOLDER, replacer);
1340
- };
1341
-
1342
- const Commands$1 = 'Commands';
1343
- const ContentSecurityPolicy = 'ContentSecurityPolicy';
1344
- const Copy = 'Copy';
1345
- const Elements = 'Elements';
1346
- const FileMatch = 'File Match';
1347
- const Id = 'ID';
1348
- const JsonValidation$1 = 'Json Validation';
1349
- const Label = 'Label';
1350
- const OpenImageInNewTab = 'Open Image in New Tab';
1351
- const OpenInNewTab = 'Open in New Tab';
1352
- const ProgrammingLanguages$1 = 'Programming Languages';
1353
- const SaveImageAs = 'Save Image as';
1354
- const Schema = 'Schema';
1355
- const Selector = 'Selector';
1356
- const Settings$1 = 'Settings';
1357
- const Theme$1 = 'Theme';
1358
- const WebViews$1 = 'WebViews';
1359
-
1360
- const copy = () => {
1361
- return i18nString(Copy);
1362
- };
1363
- const openInNewTab = () => {
1364
- return i18nString(OpenInNewTab);
1365
- };
1366
- const label = () => {
1367
- return i18nString(Label);
1368
- };
1369
- const openImageInNewTab = () => {
1370
- return i18nString(OpenImageInNewTab);
1371
- };
1372
- const saveImageAs = () => {
1373
- return i18nString(SaveImageAs);
1374
- };
1375
- const fileMatch = () => {
1376
- return i18nString(FileMatch);
1377
- };
1378
- const schema = () => {
1379
- return i18nString(Schema);
1380
- };
1381
- const theme = () => {
1382
- return i18nString(Theme$1);
1383
- };
1384
- const commands = () => {
1385
- return i18nString(Commands$1);
1386
- };
1387
- const webViews = () => {
1388
- return i18nString(WebViews$1);
1389
- };
1390
- const jsonValidation = () => {
1391
- return i18nString(JsonValidation$1);
1392
- };
1393
- const programmingLanguages = () => {
1394
- return i18nString(ProgrammingLanguages$1);
1395
- };
1396
- const settings = () => {
1397
- return i18nString(Settings$1);
1398
- };
1399
- const id = () => {
1400
- return i18nString(Id);
1401
- };
1402
- const selector = () => {
1403
- return i18nString(Selector);
1404
- };
1405
- const contentSecurityPolicy = () => {
1406
- return i18nString(ContentSecurityPolicy);
1407
- };
1408
- const elements = () => {
1409
- return i18nString(Elements);
1410
- };
1411
-
1412
1423
  const Text = 1;
1413
1424
  const Code = 2;
1414
1425
 
@@ -1644,7 +1655,7 @@ const getFeatureThemesVirtualDom = async themesHtml => {
1644
1655
  childCount: 2
1645
1656
  }, ...getFeatureContentHeadingVirtualDom(heading), {
1646
1657
  type: Div,
1647
- className: 'DefaultMarkdown',
1658
+ className: DefaultMarkdown,
1648
1659
  childCount
1649
1660
  }, ...markdownDom];
1650
1661
  };
@@ -1770,6 +1781,14 @@ const getFeatureListVirtualDom = features => {
1770
1781
  }, ...features.flatMap(getFeatureListItemVirtualDom)];
1771
1782
  };
1772
1783
 
1784
+ const joinBySpace = (...items) => {
1785
+ return items.join(' ');
1786
+ };
1787
+
1788
+ const mergeClassNames = (...classNames) => {
1789
+ return joinBySpace(...classNames.filter(Boolean));
1790
+ };
1791
+
1773
1792
  const getFeaturesVirtualDom = async (features, themesHtml, selectedFeature, extension) => {
1774
1793
  if (features.length === 0) {
1775
1794
  return [{
@@ -1784,7 +1803,7 @@ const getFeaturesVirtualDom = async (features, themesHtml, selectedFeature, exte
1784
1803
  childCount: 3
1785
1804
  }, ...getFeatureListVirtualDom(features), {
1786
1805
  type: Div,
1787
- className: 'Sash SashVertical',
1806
+ className: mergeClassNames(Sash, SashVertical),
1788
1807
  childCount: 0
1789
1808
  }, ...(await getFeatureContentVirtualDom(features, themesHtml, selectedFeature, extension))];
1790
1809
  };
@@ -1912,14 +1931,6 @@ const getTabs = selectedTab => {
1912
1931
  return tabs;
1913
1932
  };
1914
1933
 
1915
- const joinBySpace = (...items) => {
1916
- return items.join(' ');
1917
- };
1918
-
1919
- const mergeClassNames = (...classNames) => {
1920
- return joinBySpace(...classNames.filter(Boolean));
1921
- };
1922
-
1923
1934
  const selectedClassName = mergeClassNames(ExtensionDetailTab, ExtensionDetailTabSelected);
1924
1935
  const defaultClassName = ExtensionDetailTab;
1925
1936
  const getTabVirtualDom = tab => {
@@ -2351,7 +2362,7 @@ const loadReadmeContent = async path => {
2351
2362
  if (isEnoentError(error)) {
2352
2363
  return '';
2353
2364
  }
2354
- console.error(error);
2365
+ console.error(new VError(error, 'Failed to load Readme content'));
2355
2366
  return `${error}`;
2356
2367
  }
2357
2368
  };
@@ -2552,17 +2563,15 @@ const terminate = () => {
2552
2563
 
2553
2564
  const wrapCommand = fn => {
2554
2565
  const wrapped = async (uid, ...args) => {
2555
- if (typeof uid === 'number') {
2556
- const {
2557
- newState
2558
- } = get$1(uid);
2559
- const newerState = await fn(newState, ...args);
2560
- set$1(uid, newState, newerState);
2561
- } else {
2562
- // deprecated
2563
- const newerState = await fn(uid, ...args);
2564
- return newerState;
2566
+ const {
2567
+ newState
2568
+ } = get$1(uid);
2569
+ const newerState = await fn(newState, ...args);
2570
+ if (newState === newerState) {
2571
+ return;
2565
2572
  }
2573
+ const latest = get$1(uid);
2574
+ set$1(uid, latest.oldState, newerState);
2566
2575
  };
2567
2576
  return wrapped;
2568
2577
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.17.0",
3
+ "version": "3.18.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",