@lvce-editor/extension-detail-view 3.21.0 → 3.22.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.
@@ -424,7 +424,7 @@ const create$4 = (method, params) => {
424
424
  };
425
425
  };
426
426
  const callbacks = Object.create(null);
427
- const set$2 = (id, fn) => {
427
+ const set$4 = (id, fn) => {
428
428
  callbacks[id] = fn;
429
429
  };
430
430
  const get$2 = id => {
@@ -443,7 +443,7 @@ const registerPromise = () => {
443
443
  resolve,
444
444
  promise
445
445
  } = Promise.withResolvers();
446
- set$2(id, resolve);
446
+ set$4(id, resolve);
447
447
  return {
448
448
  id,
449
449
  promise
@@ -886,6 +886,20 @@ const create$1 = () => {
886
886
  };
887
887
  };
888
888
  return wrapped;
889
+ },
890
+ diff(uid, modules, numbers) {
891
+ const {
892
+ oldState,
893
+ newState
894
+ } = states[uid];
895
+ const diffResult = [];
896
+ for (let i = 0; i < modules.length; i++) {
897
+ const fn = modules[i];
898
+ if (!fn(oldState, newState)) {
899
+ diffResult.push(numbers[i]);
900
+ }
901
+ }
902
+ return diffResult;
889
903
  }
890
904
  };
891
905
  };
@@ -1131,20 +1145,32 @@ const handleClickFeatures = async (state, name) => {
1131
1145
  return selectFeature(state, name);
1132
1146
  };
1133
1147
 
1134
- const RendererWorker = 1;
1135
-
1136
1148
  const rpcs = Object.create(null);
1137
- const set = (id, rpc) => {
1149
+ const set$3 = (id, rpc) => {
1138
1150
  rpcs[id] = rpc;
1139
1151
  };
1140
1152
  const get = id => {
1141
1153
  return rpcs[id];
1142
1154
  };
1143
-
1144
- const invoke = (method, ...params) => {
1145
- const rpc = get(RendererWorker);
1155
+ const RendererWorker$1 = 1;
1156
+ const invoke$2 = (method, ...params) => {
1157
+ const rpc = get(RendererWorker$1);
1158
+ // @ts-ignore
1146
1159
  return rpc.invoke(method, ...params);
1147
1160
  };
1161
+ const set$2 = rpc => {
1162
+ set$3(RendererWorker$1, rpc);
1163
+ };
1164
+ const RendererWorker = {
1165
+ __proto__: null,
1166
+ invoke: invoke$2,
1167
+ set: set$2
1168
+ };
1169
+
1170
+ const {
1171
+ invoke,
1172
+ set
1173
+ } = RendererWorker;
1148
1174
 
1149
1175
  const handleClickSize = async state => {
1150
1176
  const {
@@ -1245,6 +1271,7 @@ const getThemeMarkdown = (themes, iconThemes, productIconThemes) => {
1245
1271
  };
1246
1272
 
1247
1273
  const renderMarkdown = async (markdown, options = {}) => {
1274
+ // @ts-ignore todo
1248
1275
  const html = await invoke('Markdown.renderMarkdown', markdown, options);
1249
1276
  return html;
1250
1277
  };
@@ -1362,6 +1389,7 @@ const getExtension$1 = async (id, platform) => {
1362
1389
  };
1363
1390
 
1364
1391
  const getExtensionNew = async id => {
1392
+ // @ts-ignore todo
1365
1393
  return invoke('ExtensionManagement.getExtension', id);
1366
1394
  };
1367
1395
  const getExtension = async (id, platform) => {
@@ -1439,6 +1467,7 @@ const getFolderSize = async uri => {
1439
1467
  throw new VError(`uri is required`);
1440
1468
  }
1441
1469
  try {
1470
+ // @ts-ignore todo
1442
1471
  return await invoke('FileSystem.getFolderSize', uri);
1443
1472
  } catch {
1444
1473
  return 0;
@@ -1667,8 +1696,29 @@ const toLocaleString = (number, locale, options) => {
1667
1696
  }
1668
1697
  return result;
1669
1698
  };
1699
+ const log10 = numberOrBigInt => {
1700
+ if (typeof numberOrBigInt === 'number') {
1701
+ return Math.log10(numberOrBigInt);
1702
+ }
1703
+ const string = numberOrBigInt.toString(10);
1704
+ return string.length + Math.log10('0.' + string.slice(0, 15));
1705
+ };
1706
+ const log = numberOrBigInt => {
1707
+ if (typeof numberOrBigInt === 'number') {
1708
+ return Math.log(numberOrBigInt);
1709
+ }
1710
+ return log10(numberOrBigInt) * Math.log(10);
1711
+ };
1712
+ const divide = (numberOrBigInt, divisor) => {
1713
+ if (typeof numberOrBigInt === 'number') {
1714
+ return numberOrBigInt / divisor;
1715
+ }
1716
+ const integerPart = numberOrBigInt / BigInt(divisor);
1717
+ const remainder = numberOrBigInt % BigInt(divisor);
1718
+ return Number(integerPart) + Number(remainder) / divisor;
1719
+ };
1670
1720
  function prettyBytes(number, options) {
1671
- if (!Number.isFinite(number)) {
1721
+ if (typeof number !== 'bigint' && !Number.isFinite(number)) {
1672
1722
  throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
1673
1723
  }
1674
1724
  options = {
@@ -1679,7 +1729,7 @@ function prettyBytes(number, options) {
1679
1729
  };
1680
1730
  const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
1681
1731
  const separator = options.space ? ' ' : '';
1682
- if (options.signed && number === 0) {
1732
+ if (options.signed && (typeof number === 'number' ? number === 0 : number === 0n)) {
1683
1733
  return ` 0${separator}${UNITS[0]}`;
1684
1734
  }
1685
1735
  const isNegative = number < 0;
@@ -1703,8 +1753,8 @@ function prettyBytes(number, options) {
1703
1753
  const numberString = toLocaleString(number, options.locale, localeOptions);
1704
1754
  return prefix + numberString + separator + UNITS[0];
1705
1755
  }
1706
- const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
1707
- number /= (options.binary ? 1024 : 1000) ** exponent;
1756
+ const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
1757
+ number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
1708
1758
  if (!localeOptions) {
1709
1759
  number = number.toPrecision(3);
1710
1760
  }
@@ -1932,6 +1982,7 @@ const getInstallationEntries = (displaySize, extensionId, extensionVersion) => {
1932
1982
 
1933
1983
  const getMarkdownVirtualDom = async html => {
1934
1984
  string(html);
1985
+ // @ts-ignore todo
1935
1986
  const dom = await invoke('Markdown.getVirtualDom', html);
1936
1987
  return dom;
1937
1988
  };
@@ -2623,7 +2674,7 @@ const listen = async () => {
2623
2674
  const rpc = await WebWorkerRpcClient.create({
2624
2675
  commandMap: commandMap
2625
2676
  });
2626
- set(RendererWorker, rpc);
2677
+ set(rpc);
2627
2678
  };
2628
2679
 
2629
2680
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.21.0",
3
+ "version": "3.22.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",