@lvce-editor/extension-detail-view 3.17.0 → 3.19.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;
@@ -908,7 +911,11 @@ const isEqual = (oldState, newState) => {
908
911
  const modules = [isEqual, isEqual$1];
909
912
  const numbers = [diffType, diffType$1];
910
913
 
911
- const diff = (oldState, newState) => {
914
+ const diff2 = uid => {
915
+ const {
916
+ oldState,
917
+ newState
918
+ } = get$1(uid);
912
919
  const diffResult = [];
913
920
  for (let i = 0; i < modules.length; i++) {
914
921
  const fn = modules[i];
@@ -919,15 +926,6 @@ const diff = (oldState, newState) => {
919
926
  return diffResult;
920
927
  };
921
928
 
922
- const diff2 = uid => {
923
- const {
924
- oldState,
925
- newState
926
- } = get$1(uid);
927
- const diffResult = diff(oldState, newState);
928
- return diffResult;
929
- };
930
-
931
929
  const dispose = uid => {
932
930
  remove(uid);
933
931
  };
@@ -944,6 +942,7 @@ const AdditionalDetailsTitle = 'AdditionalDetailsTitle';
944
942
  const Aside = 'Aside';
945
943
  const Button$1 = 'Button';
946
944
  const ButtonPrimary = 'ButtonPrimary';
945
+ const DefaultMarkdown = 'DefaultMarkdown';
947
946
  const Categories = 'Categories';
948
947
  const Category = 'Category';
949
948
  const Changelog$1 = 'Changelog';
@@ -967,6 +966,8 @@ const Features$1 = 'Features';
967
966
  const FeaturesList = 'FeaturesList';
968
967
  const FeatureWebView = 'FeatureWebView';
969
968
  const Large$1 = 'Large';
969
+ const Sash = 'Sash';
970
+ const SashVertical = 'SashVertical';
970
971
  const MoreInfo = 'MoreInfo';
971
972
  const MoreInfoEntry = 'MoreInfoEntry';
972
973
  const MoreInfoEntryKey = 'MoreInfoEntryKey';
@@ -1053,6 +1054,96 @@ const getDisplaySize = size => {
1053
1054
  });
1054
1055
  };
1055
1056
 
1057
+ const emptyObject = {};
1058
+ const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1059
+ const i18nString = (key, placeholders = emptyObject) => {
1060
+ if (placeholders === emptyObject) {
1061
+ return key;
1062
+ }
1063
+ const replacer = (match, rest) => {
1064
+ return placeholders[rest];
1065
+ };
1066
+ return key.replaceAll(RE_PLACEHOLDER, replacer);
1067
+ };
1068
+
1069
+ const Commands$1 = 'Commands';
1070
+ const ContentSecurityPolicy = 'ContentSecurityPolicy';
1071
+ const Copy = 'Copy';
1072
+ const Elements = 'Elements';
1073
+ const FileMatch = 'File Match';
1074
+ const None$1 = 'None';
1075
+ const Id = 'ID';
1076
+ const JsonValidation$1 = 'Json Validation';
1077
+ const Label = 'Label';
1078
+ const OpenImageInNewTab = 'Open Image in New Tab';
1079
+ const OpenInNewTab = 'Open in New Tab';
1080
+ const ProgrammingLanguages$1 = 'Programming Languages';
1081
+ const SaveImageAs = 'Save Image as';
1082
+ const Schema = 'Schema';
1083
+ const Selector = 'Selector';
1084
+ const Settings$1 = 'Settings';
1085
+ const Theme$1 = 'Theme';
1086
+ const WebViews$1 = 'WebViews';
1087
+ const NotImplemented = 'Not Implemented';
1088
+
1089
+ const copy = () => {
1090
+ return i18nString(Copy);
1091
+ };
1092
+ const none = () => {
1093
+ return i18nString(None$1);
1094
+ };
1095
+ const openInNewTab = () => {
1096
+ return i18nString(OpenInNewTab);
1097
+ };
1098
+ const label = () => {
1099
+ return i18nString(Label);
1100
+ };
1101
+ const openImageInNewTab = () => {
1102
+ return i18nString(OpenImageInNewTab);
1103
+ };
1104
+ const saveImageAs = () => {
1105
+ return i18nString(SaveImageAs);
1106
+ };
1107
+ const fileMatch = () => {
1108
+ return i18nString(FileMatch);
1109
+ };
1110
+ const schema = () => {
1111
+ return i18nString(Schema);
1112
+ };
1113
+ const theme = () => {
1114
+ return i18nString(Theme$1);
1115
+ };
1116
+ const commands = () => {
1117
+ return i18nString(Commands$1);
1118
+ };
1119
+ const webViews = () => {
1120
+ return i18nString(WebViews$1);
1121
+ };
1122
+ const jsonValidation = () => {
1123
+ return i18nString(JsonValidation$1);
1124
+ };
1125
+ const programmingLanguages = () => {
1126
+ return i18nString(ProgrammingLanguages$1);
1127
+ };
1128
+ const settings = () => {
1129
+ return i18nString(Settings$1);
1130
+ };
1131
+ const id = () => {
1132
+ return i18nString(Id);
1133
+ };
1134
+ const selector = () => {
1135
+ return i18nString(Selector);
1136
+ };
1137
+ const contentSecurityPolicy = () => {
1138
+ return i18nString(ContentSecurityPolicy);
1139
+ };
1140
+ const elements = () => {
1141
+ return i18nString(Elements);
1142
+ };
1143
+ const notImplemented = () => {
1144
+ return i18nString(NotImplemented);
1145
+ };
1146
+
1056
1147
  const A = 53;
1057
1148
  const Button = 1;
1058
1149
  const Div = 4;
@@ -1063,11 +1154,14 @@ const Pre = 51;
1063
1154
  const Table = 9;
1064
1155
  const TBody = 10;
1065
1156
  const Td = 11;
1066
- const Text$1 = 12;
1067
1157
  const Th = 13;
1068
1158
  const THead = 14;
1069
1159
  const Tr = 15;
1070
1160
 
1161
+ const mergeClassNames = (...classNames) => {
1162
+ return classNames.filter(Boolean).join(' ');
1163
+ };
1164
+ const Text$1 = 12;
1071
1165
  const text = data => {
1072
1166
  return {
1073
1167
  type: Text$1,
@@ -1077,12 +1171,13 @@ const text = data => {
1077
1171
  };
1078
1172
 
1079
1173
  const getChangelogVirtualDom = () => {
1174
+ const notImplemented$1 = notImplemented();
1080
1175
  // TODO set tabpanel role
1081
1176
  return [{
1082
1177
  type: Div,
1083
1178
  className: Changelog$1,
1084
1179
  childCount: 1
1085
- }, text('Not Implemented')];
1180
+ }, text(notImplemented$1)];
1086
1181
  };
1087
1182
 
1088
1183
  const TabList = 'tablist';
@@ -1120,15 +1215,16 @@ const getCategoriesDom = categories => {
1120
1215
  }, ...categories.flatMap(getCategoryVirtualDom)];
1121
1216
  };
1122
1217
 
1218
+ const parentNode = {
1219
+ type: Div,
1220
+ className: MoreInfoEntryKey,
1221
+ childCount: 1
1222
+ };
1123
1223
  const getMoreInfoEntryKeyVirtualDom = item => {
1124
1224
  const {
1125
1225
  key
1126
1226
  } = item;
1127
- return [{
1128
- type: Div,
1129
- className: MoreInfoEntryKey,
1130
- childCount: 1
1131
- }, text(key)];
1227
+ return [parentNode, text(key)];
1132
1228
  };
1133
1229
 
1134
1230
  const getTag = (onClick, code) => {
@@ -1173,7 +1269,7 @@ const parentNodeEven = {
1173
1269
  };
1174
1270
  const parentNodeOdd = {
1175
1271
  type: Div,
1176
- className: MoreInfoEntry + ' ' + MoreInfoEntryOdd,
1272
+ className: mergeClassNames(MoreInfoEntry, MoreInfoEntryOdd),
1177
1273
  childCount: 2
1178
1274
  };
1179
1275
  const getMoreInfoEntryVirtualDom = item => {
@@ -1327,88 +1423,6 @@ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionI
1327
1423
  return dom;
1328
1424
  };
1329
1425
 
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
1426
  const Text = 1;
1413
1427
  const Code = 2;
1414
1428
 
@@ -1644,7 +1658,7 @@ const getFeatureThemesVirtualDom = async themesHtml => {
1644
1658
  childCount: 2
1645
1659
  }, ...getFeatureContentHeadingVirtualDom(heading), {
1646
1660
  type: Div,
1647
- className: 'DefaultMarkdown',
1661
+ className: DefaultMarkdown,
1648
1662
  childCount
1649
1663
  }, ...markdownDom];
1650
1664
  };
@@ -1772,11 +1786,12 @@ const getFeatureListVirtualDom = features => {
1772
1786
 
1773
1787
  const getFeaturesVirtualDom = async (features, themesHtml, selectedFeature, extension) => {
1774
1788
  if (features.length === 0) {
1789
+ const none$1 = none();
1775
1790
  return [{
1776
1791
  type: Div,
1777
1792
  className: Features$1,
1778
1793
  childCount: 3
1779
- }, text('None')];
1794
+ }, text(none$1)];
1780
1795
  }
1781
1796
  return [{
1782
1797
  type: Div,
@@ -1784,7 +1799,7 @@ const getFeaturesVirtualDom = async (features, themesHtml, selectedFeature, exte
1784
1799
  childCount: 3
1785
1800
  }, ...getFeatureListVirtualDom(features), {
1786
1801
  type: Div,
1787
- className: 'Sash SashVertical',
1802
+ className: mergeClassNames(Sash, SashVertical),
1788
1803
  childCount: 0
1789
1804
  }, ...(await getFeatureContentVirtualDom(features, themesHtml, selectedFeature, extension))];
1790
1805
  };
@@ -1912,14 +1927,6 @@ const getTabs = selectedTab => {
1912
1927
  return tabs;
1913
1928
  };
1914
1929
 
1915
- const joinBySpace = (...items) => {
1916
- return items.join(' ');
1917
- };
1918
-
1919
- const mergeClassNames = (...classNames) => {
1920
- return joinBySpace(...classNames.filter(Boolean));
1921
- };
1922
-
1923
1930
  const selectedClassName = mergeClassNames(ExtensionDetailTab, ExtensionDetailTabSelected);
1924
1931
  const defaultClassName = ExtensionDetailTab;
1925
1932
  const getTabVirtualDom = tab => {
@@ -2351,7 +2358,7 @@ const loadReadmeContent = async path => {
2351
2358
  if (isEnoentError(error)) {
2352
2359
  return '';
2353
2360
  }
2354
- console.error(error);
2361
+ console.error(new VError(error, 'Failed to load Readme content'));
2355
2362
  return `${error}`;
2356
2363
  }
2357
2364
  };
@@ -2552,17 +2559,15 @@ const terminate = () => {
2552
2559
 
2553
2560
  const wrapCommand = fn => {
2554
2561
  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;
2562
+ const {
2563
+ newState
2564
+ } = get$1(uid);
2565
+ const newerState = await fn(newState, ...args);
2566
+ if (newState === newerState) {
2567
+ return;
2565
2568
  }
2569
+ const latest = get$1(uid);
2570
+ set$1(uid, latest.oldState, newerState);
2566
2571
  };
2567
2572
  return wrapped;
2568
2573
  };
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.19.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",