@lukso/transaction-view-core 0.4.1 → 0.5.0-dev.5ea12c5

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.
Files changed (39) hide show
  1. package/.turbo/turbo-build.log +16 -16
  2. package/.turbo/turbo-typecheck.log +4 -0
  3. package/CHANGELOG.md +15 -0
  4. package/dist/index.cjs +39 -159
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +0 -9
  7. package/dist/index.d.ts +0 -9
  8. package/dist/index.js +66 -191
  9. package/dist/index.js.map +1 -1
  10. package/dist/shared/index.cjs +23 -60
  11. package/dist/shared/index.cjs.map +1 -1
  12. package/dist/shared/index.d.cts +4 -16
  13. package/dist/shared/index.d.ts +4 -16
  14. package/dist/shared/index.js +35 -72
  15. package/dist/shared/index.js.map +1 -1
  16. package/package.json +5 -4
  17. package/src/components/asset-card.ts +2 -22
  18. package/src/components/contract-card.ts +2 -67
  19. package/src/components/info-panel.ts +1 -21
  20. package/src/components/transaction-playback.ts +4 -4
  21. package/src/index.ts +1 -1
  22. package/src/shared/address-display.ts +3 -6
  23. package/src/shared/address-view.ts +2 -18
  24. package/src/shared/custom-select.ts +1 -1
  25. package/src/shared/function-name-view.ts +1 -1
  26. package/src/shared/gas-provider-view.ts +4 -7
  27. package/src/shared/icon-view.ts +7 -9
  28. package/src/shared/image-list.ts +3 -3
  29. package/src/shared/load-web-components.ts +3 -2
  30. package/src/shared/notification-view.ts +1 -1
  31. package/src/shared/progress-view.ts +1 -10
  32. package/src/shared/scroll-to-bottom-button.ts +1 -1
  33. package/src/shared/signal-controller.ts +3 -1
  34. package/src/shared/transaction-view-controller.ts +1 -1
  35. package/src/shared/url-view.ts +3 -3
  36. package/src/shared/value-view.ts +6 -12
  37. package/src/styles/styles.css +1 -1
  38. package/src/vue-entry.ts +0 -1
  39. package/tsup.config.ts +3 -3
@@ -87,13 +87,13 @@ var AddressDisplay = class extends import_lit.LitElement {
87
87
  this.showCopyButton = false;
88
88
  this.nameOnly = false;
89
89
  this.maxWidth = 200;
90
- this.isLoadingImage = false;
91
90
  // Composables
92
91
  this.imageLoader = (0, import_transaction_view_headless.useImageLoader)();
93
92
  this.addressResolver = (0, import_transaction_view_headless.useAddressResolver)();
93
+ this.isLoadingImage = false;
94
94
  // Task for loading profile image
95
95
  this.imageTask = new import_task.Task(this, {
96
- task: async ([resolved], { signal }) => {
96
+ task: async ([resolved]) => {
97
97
  if (!resolved) return null;
98
98
  this.isLoadingImage = true;
99
99
  try {
@@ -348,12 +348,6 @@ __decorateClass([
348
348
  __decorateClass([
349
349
  (0, import_decorators.property)({ type: Number, attribute: "max-width" })
350
350
  ], AddressDisplay.prototype, "maxWidth", 2);
351
- __decorateClass([
352
- (0, import_decorators.state)()
353
- ], AddressDisplay.prototype, "imageData", 2);
354
- __decorateClass([
355
- (0, import_decorators.state)()
356
- ], AddressDisplay.prototype, "isLoadingImage", 2);
357
351
  AddressDisplay = __decorateClass([
358
352
  safeCustomElement("address-display")
359
353
  ], AddressDisplay);
@@ -368,7 +362,7 @@ var import_decorators2 = require("lit/decorators.js");
368
362
  // src/shared/load-web-components.ts
369
363
  var originalDefine = typeof customElements !== "undefined" ? customElements.define.bind(customElements) : null;
370
364
  if (typeof customElements !== "undefined" && originalDefine) {
371
- customElements.define = function(name, constructor, options) {
365
+ customElements.define = (name, constructor, options) => {
372
366
  if (!customElements.get(name)) {
373
367
  originalDefine(name, constructor, options);
374
368
  }
@@ -420,14 +414,14 @@ var AddressView = class extends CoreLitElement {
420
414
  this.addressResolver = (0, import_transaction_view_headless2.useAddressResolver)();
421
415
  // Task for resolving address data
422
416
  this.addressTask = new import_task2.Task(this, {
423
- task: async ([address], { signal }) => {
417
+ task: async ([address]) => {
424
418
  if (!address) return null;
425
419
  this.isLoadingAddress = true;
426
420
  try {
427
421
  const resolved = await this.addressResolver.resolveAddress(address);
428
422
  this.requestUpdate();
429
423
  return resolved;
430
- } catch (error) {
424
+ } catch (_error) {
431
425
  return null;
432
426
  } finally {
433
427
  this.isLoadingAddress = false;
@@ -454,20 +448,6 @@ var AddressView = class extends CoreLitElement {
454
448
  const computedName = this.addressResolver.formatDisplayName(resolved);
455
449
  return this.label || computedName || "Anonymous";
456
450
  }
457
- /**
458
- * Check if this is a contract address (non-profile)
459
- */
460
- get isContract() {
461
- const resolved = this.addressTask.value;
462
- return resolved ? resolved.__gqltype !== "Profile" : false;
463
- }
464
- /**
465
- * Check if this should show the address hash (profiles show hash, contracts don't)
466
- */
467
- get shouldShowAddressHash() {
468
- const resolved = this.addressTask.value;
469
- return resolved ? resolved.__gqltype === "Profile" : true;
470
- }
471
451
  /**
472
452
  * Get prefix for the address display
473
453
  */
@@ -1046,7 +1026,7 @@ var GasProviderView = class extends CoreLitElement {
1046
1026
  }
1047
1027
  displayRelayerResetDate() {
1048
1028
  const date = new Date(this.relayerResetDate);
1049
- return isNaN(date.getTime()) ? "N/A" : date.toLocaleDateString();
1029
+ return Number.isNaN(date.getTime()) ? "N/A" : date.toLocaleDateString();
1050
1030
  }
1051
1031
  render() {
1052
1032
  const formatted = this.formatToken(this.balance);
@@ -1065,9 +1045,9 @@ var GasProviderView = class extends CoreLitElement {
1065
1045
  const options = [...relayerOptions, ...controllerOption];
1066
1046
  const selectedValue = this.selectedGasProvider ? this.selectedGasProvider.type === "controller" ? this.controllerAddress : (() => {
1067
1047
  const r = this.allRelayers.find(
1068
- (x) => x.id === this.selectedGasProvider.id
1048
+ (x) => x.id === this.selectedGasProvider?.id
1069
1049
  );
1070
- return r?.website || r?.apiUrl || `relayer:${this.selectedGasProvider.id}`;
1050
+ return r?.website || r?.apiUrl || `relayer:${this.selectedGasProvider?.id}`;
1071
1051
  })() : void 0;
1072
1052
  return import_lit6.html`
1073
1053
  <div class="w-full">
@@ -1138,14 +1118,14 @@ var IconView = class extends CoreLitElement {
1138
1118
  this.showIconIdenticon = true;
1139
1119
  this.showLabelIdenticon = false;
1140
1120
  this.forceUnresolved = false;
1141
- this.isLoadingImage = false;
1142
- this.isLoadingAddress = false;
1143
1121
  // Composables
1144
1122
  this.imageLoader = (0, import_transaction_view_headless3.useImageLoader)();
1145
1123
  this.addressResolver = (0, import_transaction_view_headless3.useAddressResolver)();
1124
+ this.isLoadingAddress = false;
1125
+ this.isLoadingImage = false;
1146
1126
  // Task for resolving address data
1147
1127
  this.addressTask = new import_task3.Task(this, {
1148
- task: async ([address], { signal }) => {
1128
+ task: async ([address]) => {
1149
1129
  if (!address) return null;
1150
1130
  this.isLoadingAddress = true;
1151
1131
  try {
@@ -1163,11 +1143,11 @@ var IconView = class extends CoreLitElement {
1163
1143
  });
1164
1144
  // Task for loading profile image
1165
1145
  this.imageTask = new import_task3.Task(this, {
1166
- task: async ([resolved], { signal }) => {
1146
+ task: async ([resolved]) => {
1167
1147
  if (!resolved) return null;
1168
1148
  this.isLoadingImage = true;
1169
1149
  try {
1170
- let image;
1150
+ let image = null;
1171
1151
  if (this.imageHint && resolved[this.imageHint]) {
1172
1152
  const imageArray = resolved[this.imageHint];
1173
1153
  if (Array.isArray(imageArray) && imageArray.length > 0) {
@@ -1305,15 +1285,6 @@ __decorateClass([
1305
1285
  __decorateClass([
1306
1286
  (0, import_decorators6.property)({ type: Number, attribute: "image-index" })
1307
1287
  ], IconView.prototype, "imageIndex", 2);
1308
- __decorateClass([
1309
- (0, import_decorators6.state)()
1310
- ], IconView.prototype, "imageData", 2);
1311
- __decorateClass([
1312
- (0, import_decorators6.state)()
1313
- ], IconView.prototype, "isLoadingImage", 2);
1314
- __decorateClass([
1315
- (0, import_decorators6.state)()
1316
- ], IconView.prototype, "isLoadingAddress", 2);
1317
1288
  IconView = __decorateClass([
1318
1289
  safeCustomElement("icon-view")
1319
1290
  ], IconView);
@@ -1559,14 +1530,6 @@ var ProgressView = class extends CoreLitElement {
1559
1530
  `}
1560
1531
  `;
1561
1532
  }
1562
- renderAddressLabel() {
1563
- return import_lit9.html`
1564
- <value-view
1565
- .value=${this.address}
1566
- .unit=${this.unit}
1567
- ></value-view>
1568
- `;
1569
- }
1570
1533
  render() {
1571
1534
  const isError = (this.className || "").split(/\s+/).includes("error");
1572
1535
  return import_lit9.html`
@@ -1712,7 +1675,9 @@ var MultiSignalController = class {
1712
1675
  });
1713
1676
  }
1714
1677
  hostDisconnected() {
1715
- this.unsubscribes.forEach((unsubscribe) => unsubscribe());
1678
+ this.unsubscribes.forEach((unsubscribe) => {
1679
+ unsubscribe();
1680
+ });
1716
1681
  this.unsubscribes = [];
1717
1682
  }
1718
1683
  getValue(index) {
@@ -1985,14 +1950,14 @@ var UrlView = class extends CoreLitElement {
1985
1950
  this.favicon = this.faviconCandidates[this.faviconIndex];
1986
1951
  const hostname = u.hostname.replace(/^www\./, "");
1987
1952
  const hostnamePretty = hostname.split(".").filter(Boolean).slice(-2).join(" ").replace(/-/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
1988
- if (this.label && this.label.trim()) {
1953
+ if (this.label?.trim()) {
1989
1954
  this.displayName = this.label.trim();
1990
1955
  } else {
1991
1956
  this.displayName = hostnamePretty || this.url;
1992
1957
  }
1993
1958
  } catch {
1994
1959
  this.favicon = void 0;
1995
- this.displayName = this.label && this.label.trim() ? this.label : this.url;
1960
+ this.displayName = this.label?.trim() ? this.label : this.url;
1996
1961
  }
1997
1962
  }
1998
1963
  handleImageError() {
@@ -2179,14 +2144,15 @@ var ValueView = class extends CoreLitElement {
2179
2144
  if (value === null) return "null";
2180
2145
  if (value === void 0) return "undefined";
2181
2146
  switch (effectiveType) {
2182
- case "currency":
2147
+ case "currency": {
2183
2148
  const { numeric, symbol } = this.getCurrencyParts();
2184
2149
  return `${numeric} ${symbol}`;
2150
+ }
2185
2151
  case "bigint":
2186
2152
  if (typeof value === "bigint") {
2187
- return value.toString() + "n";
2153
+ return `${value.toString()}n`;
2188
2154
  }
2189
- return String(value) + "n";
2155
+ return `${String(value)}n`;
2190
2156
  case "boolean":
2191
2157
  return value ? "true" : "false";
2192
2158
  case "number":
@@ -2214,7 +2180,7 @@ var ValueView = class extends CoreLitElement {
2214
2180
  try {
2215
2181
  if (typeof value === "bigint") {
2216
2182
  numeric = formatUnits(value, effectiveDecimals);
2217
- } else if (typeof value === "string" && !isNaN(Number(value))) {
2183
+ } else if (typeof value === "string" && !Number.isNaN(Number(value))) {
2218
2184
  const bigintValue = BigInt(value);
2219
2185
  numeric = formatUnits(bigintValue, effectiveDecimals);
2220
2186
  }
@@ -2443,9 +2409,6 @@ __decorateClass([
2443
2409
  __decorateClass([
2444
2410
  (0, import_decorators11.property)()
2445
2411
  ], ValueView.prototype, "address", 2);
2446
- __decorateClass([
2447
- (0, import_decorators11.state)()
2448
- ], ValueView.prototype, "resolvedMetadata", 2);
2449
2412
  __decorateClass([
2450
2413
  (0, import_decorators11.state)()
2451
2414
  ], ValueView.prototype, "_hasSlotContent", 2);