@lvce-editor/extension-detail-view 3.19.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) => {
@@ -927,7 +955,7 @@ const diff2 = uid => {
927
955
  };
928
956
 
929
957
  const dispose = uid => {
930
- remove(uid);
958
+ dispose$1(uid);
931
959
  };
932
960
 
933
961
  const commandIds = ['getMenuEntries', 'handleClickDisable', 'handleClickSize', 'handleClickUninstall', 'handleFeaturesClick', 'handleIconError', 'handleTabsClick', 'renderEventListeners', 'resize', 'saveState', 'selectTab', 'terminate'];
@@ -1215,7 +1243,7 @@ const getCategoriesDom = categories => {
1215
1243
  }, ...categories.flatMap(getCategoryVirtualDom)];
1216
1244
  };
1217
1245
 
1218
- const parentNode = {
1246
+ const parentNode$1 = {
1219
1247
  type: Div,
1220
1248
  className: MoreInfoEntryKey,
1221
1249
  childCount: 1
@@ -1224,7 +1252,7 @@ const getMoreInfoEntryKeyVirtualDom = item => {
1224
1252
  const {
1225
1253
  key
1226
1254
  } = item;
1227
- return [parentNode, text(key)];
1255
+ return [parentNode$1, text(key)];
1228
1256
  };
1229
1257
 
1230
1258
  const getTag = (onClick, code) => {
@@ -1444,8 +1472,10 @@ const getCommandTableEntry = command => {
1444
1472
  const getCommandTableEntries = extension => {
1445
1473
  const commands = extension.commands || [];
1446
1474
  const rows = commands.map(getCommandTableEntry);
1475
+ const id$1 = id();
1476
+ const label$1 = label();
1447
1477
  return {
1448
- headings: ['ID', 'Label'],
1478
+ headings: [id$1, label$1],
1449
1479
  rows
1450
1480
  };
1451
1481
  };
@@ -1567,14 +1597,15 @@ const getJsonValidationTableEntries = extension => {
1567
1597
  };
1568
1598
  };
1569
1599
 
1600
+ const parentNode = {
1601
+ type: Div,
1602
+ className: FeatureContent,
1603
+ childCount: 2
1604
+ };
1570
1605
  const getFeatureJsonValidationVirtualDom = extension => {
1571
1606
  const heading = jsonValidation();
1572
1607
  const tableInfo = getJsonValidationTableEntries(extension);
1573
- return [{
1574
- type: Div,
1575
- className: FeatureContent,
1576
- childCount: 2
1577
- }, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
1608
+ return [parentNode, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
1578
1609
  };
1579
1610
 
1580
1611
  const getFeatureNotImplementedVirtualDom = () => {
@@ -1820,7 +1851,7 @@ const getExtensionDetailContentVirtualDom = async (sanitizedReadmeHtml, themesHt
1820
1851
  const getButtonVirtualDom = (message, onClick) => {
1821
1852
  return [{
1822
1853
  type: Button,
1823
- className: Button$1 + ' ' + ButtonPrimary,
1854
+ className: mergeClassNames(Button$1, ButtonPrimary),
1824
1855
  onClick,
1825
1856
  childCount: 1
1826
1857
  }, text(message)];
@@ -2557,21 +2588,6 @@ const terminate = () => {
2557
2588
  globalThis.close();
2558
2589
  };
2559
2590
 
2560
- const wrapCommand = fn => {
2561
- const wrapped = async (uid, ...args) => {
2562
- const {
2563
- newState
2564
- } = get$1(uid);
2565
- const newerState = await fn(newState, ...args);
2566
- if (newState === newerState) {
2567
- return;
2568
- }
2569
- const latest = get$1(uid);
2570
- set$1(uid, latest.oldState, newerState);
2571
- };
2572
- return wrapped;
2573
- };
2574
-
2575
2591
  const commandMap = {
2576
2592
  'ExtensionDetail.create': create,
2577
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.19.0",
3
+ "version": "3.20.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",