@lvce-editor/extension-detail-view 3.18.0 → 3.20.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.
@@ -430,7 +430,7 @@ const set$2 = (id, fn) => {
430
430
  const get$2 = id => {
431
431
  return callbacks[id];
432
432
  };
433
- const remove$1 = id => {
433
+ const remove = id => {
434
434
  delete callbacks[id];
435
435
  };
436
436
  let id$1 = 0;
@@ -607,7 +607,7 @@ const resolve = (id, response) => {
607
607
  return;
608
608
  }
609
609
  fn(response);
610
- remove$1(id);
610
+ remove(id);
611
611
  };
612
612
  const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
613
613
  const getErrorType = prettyError => {
@@ -857,8 +857,35 @@ const create$1 = () => {
857
857
  newState
858
858
  };
859
859
  },
860
- remove(uid) {
860
+ dispose(uid) {
861
861
  delete states[uid];
862
+ },
863
+ getKeys() {
864
+ return Object.keys(states).map(key => {
865
+ return Number.parseInt(key);
866
+ });
867
+ },
868
+ clear() {
869
+ for (const key of Object.keys(states)) {
870
+ delete states[key];
871
+ }
872
+ },
873
+ wrapCommand(fn) {
874
+ const wrapped = async (uid, ...args) => {
875
+ const {
876
+ newState
877
+ } = states[uid];
878
+ const newerState = await fn(newState, ...args);
879
+ if (newState === newerState) {
880
+ return;
881
+ }
882
+ const latest = states[uid];
883
+ states[uid] = {
884
+ oldState: latest.oldState,
885
+ newState: newerState
886
+ };
887
+ };
888
+ return wrapped;
862
889
  }
863
890
  };
864
891
  };
@@ -866,7 +893,8 @@ const create$1 = () => {
866
893
  const {
867
894
  get: get$1,
868
895
  set: set$1,
869
- remove
896
+ dispose: dispose$1,
897
+ wrapCommand
870
898
  } = create$1();
871
899
 
872
900
  const create = (uid, uri, width, height, platform, assetDir$1) => {
@@ -911,7 +939,11 @@ const isEqual = (oldState, newState) => {
911
939
  const modules = [isEqual, isEqual$1];
912
940
  const numbers = [diffType, diffType$1];
913
941
 
914
- const diff = (oldState, newState) => {
942
+ const diff2 = uid => {
943
+ const {
944
+ oldState,
945
+ newState
946
+ } = get$1(uid);
915
947
  const diffResult = [];
916
948
  for (let i = 0; i < modules.length; i++) {
917
949
  const fn = modules[i];
@@ -922,17 +954,8 @@ const diff = (oldState, newState) => {
922
954
  return diffResult;
923
955
  };
924
956
 
925
- const diff2 = uid => {
926
- const {
927
- oldState,
928
- newState
929
- } = get$1(uid);
930
- const diffResult = diff(oldState, newState);
931
- return diffResult;
932
- };
933
-
934
957
  const dispose = uid => {
935
- remove(uid);
958
+ dispose$1(uid);
936
959
  };
937
960
 
938
961
  const commandIds = ['getMenuEntries', 'handleClickDisable', 'handleClickSize', 'handleClickUninstall', 'handleFeaturesClick', 'handleIconError', 'handleTabsClick', 'renderEventListeners', 'resize', 'saveState', 'selectTab', 'terminate'];
@@ -1076,6 +1099,7 @@ const ContentSecurityPolicy = 'ContentSecurityPolicy';
1076
1099
  const Copy = 'Copy';
1077
1100
  const Elements = 'Elements';
1078
1101
  const FileMatch = 'File Match';
1102
+ const None$1 = 'None';
1079
1103
  const Id = 'ID';
1080
1104
  const JsonValidation$1 = 'Json Validation';
1081
1105
  const Label = 'Label';
@@ -1093,6 +1117,9 @@ const NotImplemented = 'Not Implemented';
1093
1117
  const copy = () => {
1094
1118
  return i18nString(Copy);
1095
1119
  };
1120
+ const none = () => {
1121
+ return i18nString(None$1);
1122
+ };
1096
1123
  const openInNewTab = () => {
1097
1124
  return i18nString(OpenInNewTab);
1098
1125
  };
@@ -1155,11 +1182,14 @@ const Pre = 51;
1155
1182
  const Table = 9;
1156
1183
  const TBody = 10;
1157
1184
  const Td = 11;
1158
- const Text$1 = 12;
1159
1185
  const Th = 13;
1160
1186
  const THead = 14;
1161
1187
  const Tr = 15;
1162
1188
 
1189
+ const mergeClassNames = (...classNames) => {
1190
+ return classNames.filter(Boolean).join(' ');
1191
+ };
1192
+ const Text$1 = 12;
1163
1193
  const text = data => {
1164
1194
  return {
1165
1195
  type: Text$1,
@@ -1213,15 +1243,16 @@ const getCategoriesDom = categories => {
1213
1243
  }, ...categories.flatMap(getCategoryVirtualDom)];
1214
1244
  };
1215
1245
 
1246
+ const parentNode$1 = {
1247
+ type: Div,
1248
+ className: MoreInfoEntryKey,
1249
+ childCount: 1
1250
+ };
1216
1251
  const getMoreInfoEntryKeyVirtualDom = item => {
1217
1252
  const {
1218
1253
  key
1219
1254
  } = item;
1220
- return [{
1221
- type: Div,
1222
- className: MoreInfoEntryKey,
1223
- childCount: 1
1224
- }, text(key)];
1255
+ return [parentNode$1, text(key)];
1225
1256
  };
1226
1257
 
1227
1258
  const getTag = (onClick, code) => {
@@ -1266,7 +1297,7 @@ const parentNodeEven = {
1266
1297
  };
1267
1298
  const parentNodeOdd = {
1268
1299
  type: Div,
1269
- className: MoreInfoEntry + ' ' + MoreInfoEntryOdd,
1300
+ className: mergeClassNames(MoreInfoEntry, MoreInfoEntryOdd),
1270
1301
  childCount: 2
1271
1302
  };
1272
1303
  const getMoreInfoEntryVirtualDom = item => {
@@ -1441,8 +1472,10 @@ const getCommandTableEntry = command => {
1441
1472
  const getCommandTableEntries = extension => {
1442
1473
  const commands = extension.commands || [];
1443
1474
  const rows = commands.map(getCommandTableEntry);
1475
+ const id$1 = id();
1476
+ const label$1 = label();
1444
1477
  return {
1445
- headings: ['ID', 'Label'],
1478
+ headings: [id$1, label$1],
1446
1479
  rows
1447
1480
  };
1448
1481
  };
@@ -1564,14 +1597,15 @@ const getJsonValidationTableEntries = extension => {
1564
1597
  };
1565
1598
  };
1566
1599
 
1600
+ const parentNode = {
1601
+ type: Div,
1602
+ className: FeatureContent,
1603
+ childCount: 2
1604
+ };
1567
1605
  const getFeatureJsonValidationVirtualDom = extension => {
1568
1606
  const heading = jsonValidation();
1569
1607
  const tableInfo = getJsonValidationTableEntries(extension);
1570
- return [{
1571
- type: Div,
1572
- className: FeatureContent,
1573
- childCount: 2
1574
- }, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
1608
+ return [parentNode, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
1575
1609
  };
1576
1610
 
1577
1611
  const getFeatureNotImplementedVirtualDom = () => {
@@ -1781,21 +1815,14 @@ const getFeatureListVirtualDom = features => {
1781
1815
  }, ...features.flatMap(getFeatureListItemVirtualDom)];
1782
1816
  };
1783
1817
 
1784
- const joinBySpace = (...items) => {
1785
- return items.join(' ');
1786
- };
1787
-
1788
- const mergeClassNames = (...classNames) => {
1789
- return joinBySpace(...classNames.filter(Boolean));
1790
- };
1791
-
1792
1818
  const getFeaturesVirtualDom = async (features, themesHtml, selectedFeature, extension) => {
1793
1819
  if (features.length === 0) {
1820
+ const none$1 = none();
1794
1821
  return [{
1795
1822
  type: Div,
1796
1823
  className: Features$1,
1797
1824
  childCount: 3
1798
- }, text('None')];
1825
+ }, text(none$1)];
1799
1826
  }
1800
1827
  return [{
1801
1828
  type: Div,
@@ -1824,7 +1851,7 @@ const getExtensionDetailContentVirtualDom = async (sanitizedReadmeHtml, themesHt
1824
1851
  const getButtonVirtualDom = (message, onClick) => {
1825
1852
  return [{
1826
1853
  type: Button,
1827
- className: Button$1 + ' ' + ButtonPrimary,
1854
+ className: mergeClassNames(Button$1, ButtonPrimary),
1828
1855
  onClick,
1829
1856
  childCount: 1
1830
1857
  }, text(message)];
@@ -2561,21 +2588,6 @@ const terminate = () => {
2561
2588
  globalThis.close();
2562
2589
  };
2563
2590
 
2564
- const wrapCommand = fn => {
2565
- const wrapped = async (uid, ...args) => {
2566
- const {
2567
- newState
2568
- } = get$1(uid);
2569
- const newerState = await fn(newState, ...args);
2570
- if (newState === newerState) {
2571
- return;
2572
- }
2573
- const latest = get$1(uid);
2574
- set$1(uid, latest.oldState, newerState);
2575
- };
2576
- return wrapped;
2577
- };
2578
-
2579
2591
  const commandMap = {
2580
2592
  'ExtensionDetail.create': create,
2581
2593
  'ExtensionDetail.diff2': diff2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.18.0",
3
+ "version": "3.20.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",